Example Ac500 Ha Cs3

Download as pdf or txt
Download as pdf or txt
You are on page 1of 93

Library Example Description V1.

HA Library Version 2.4.2


(HA_CS31_AC500_V23.lib)
Application Examples Description
Content
1. ..... Disclaimer .................................................................................................................. 4
2. ..... INTRODUCTION TO DOCUMENT ............................................................................. 5
2.1.... Scope of the document ................................................................................................... 5
2.2.... Overview of the Content ................................................................................................. 5
2.3.... Compatibility ................................................................................................................... 5
2.4.... Safety Instructions .......................................................................................................... 5
3. ..... Overview .................................................................................................................... 6
4. ..... Overview of HA Functional Blocks Used ................................................................ 7
4.1.... HA_CS31_CONTROL....................................................................................................... 7
4.2.... HA_CS31_DIAG ............................................................................................................... 8
4.3.... HA_CS31_DIAG_VIA_CM574 .......................................................................................... 8
4.4.... HA_CS31_DIAG_ON_CM574........................................................................................... 8
5. ..... Example program for HA Application using CPU COM1 CS31 Bus ...................... 9
5.1.... Configuration (Automation Builder) ............................................................................. 10
5.1.1. Target ....................................................................................................... 10
5.1.2. CS31 & CI590........................................................................................... 10
5.1.3. Inputs/Outputs .......................................................................................... 12
5.1.4. Ethernet , UDP data exchange and CM577 .............................................. 13
5.2.... Programing (CoDeSys) ................................................................................................. 16
5.2.1. Overview .................................................................................................. 16
5.2.2. Library ...................................................................................................... 16
5.2.3. HA_PROGRAM (POU) ............................................................................. 17
5.2.4. Application Programs................................................................................ 18
5.2.5. CALLBACK_STOP (POU) ........................................................................ 26
5.3.... Task configuration (CoDeSys) ..................................................................................... 26
5.3.1. HA TASK .................................................................................................. 27
5.3.2. MAIN_TASK ............................................................................................. 29
5.4.... Program Download ....................................................................................................... 29
5.5.... Operation ....................................................................................................................... 29
5.5.1. Panel Builder program and Configuration for HMI with redundant Scripts. 31
6. ..... Example program for HA Application using CPU COM1 CS31 Bus and CM574
CS31 Bus .......................................................................................................................... 33
6.1.... CPU Configuration (in Automation Builder) ................................................................ 34
6.1.1. Target ....................................................................................................... 34
6.1.2. CS31 & CI590........................................................................................... 34
6.1.3. Inputs/Outputs .......................................................................................... 37
6.1.4. Ethernet , UDP Data Exchange and CM577 ............................................. 38
6.2.... CPU Programing (CoDeSys) ......................................................................................... 40
6.2.1. Overview .................................................................................................. 40
6.2.2. Library ...................................................................................................... 40
6.2.3. HA_PROGRAM (POU) ............................................................................. 41
6.2.4. Application Programs................................................................................ 42
6.2.5. CALLBACK_STOP (POU) ........................................................................ 47
6.3.... CPU Task Configuration (CoDeSys) ............................................................................ 47
6.3.1. HA Task.................................................................................................... 47
6.3.2. MAIN_TASK ............................................................................................. 48
6.4.... Download to CPU .......................................................................................................... 48
6.5.... CM574 Configuration (Automation Builder) ................................................................ 48
6.6.... CM574 Programing (CoDeSys) ..................................................................................... 50
6.6.1. Library ...................................................................................................... 50
6.6.2. PLC_PRG................................................................................................. 50
6.7.... CM574 TASK Configuration (CoDeSys) ....................................................................... 51
6.7.1. HA_TASK ................................................................................................. 51
6.8.... Download to CM574 ...................................................................................................... 53
6.9.... Operation ....................................................................................................................... 53
7. ..... Sample OPC Server configuration for High Availability ..................................... 55
7.1.... Requirements ................................................................................................................ 55
7.2.... Configure user account for OPC Server ...................................................................... 55
7.3.... Default folder and contents .......................................................................................... 57
7.3.1. Win7 64Bit , Windows Server 64Bit .......................................................... 57
7.3.2. Win7 32Bit , Windows Server 2008 32Bit.................................................. 58
7.3.3. WinXP 32Bit , Windows Server 2003 32Bit ............................................... 58
7.4.... Opening sample file ...................................................................................................... 59
7.5.... Usage of the CoDeSys OPC Server.............................................................................. 60
7.6.... Configure and download symbol file ........................................................................... 60
7.7.... Configure OPC data access.......................................................................................... 64
7.7.1. Settings for the OPC Server ..................................................................... 64
7.7.2. Settings for the PLC.................................................................................. 65
7.7.3. Settings for the connection to the PLC...................................................... 68
7.7.4. Configuration of a Redundant PLC ........................................................... 71
7.8.... Configure OPC alarms .................................................................................................. 73
7.8.1. Configuration of Limit Alarms .................................................................... 76
7.8.2. Configuration of Digital Alarms ................................................................. 77
7.8.3. Language settings .................................................................................... 78
7.8.4. Check of configuration .............................................................................. 80
7.8.5. Connection of alarms with OPC items ...................................................... 81
7.8.6. Recommendation for configuration of system alarms................................ 85
8. ..... REVISION HISTORY ................................................................................................ 90

2 AC 500 - HA-CS31 Library Application Example Description


AC 500 - HA-CS31 Library Application Example Description 3
1. Disclaimer

A. For customers domiciled outside Germany /


Für Kunden mit Sitz außerhalb Deutschlands

„Warranty, Liability:
The user shall be solely responsible for the use of this application example described within this file. ABB
shall be under no warranty whatsoever. ABB's liability in connection with this application example or the
files included within this file, irrespective of the legal ground, shall be excluded. The exclusion of liability
shall not apply in the case of intention or gross negligence. The present declaration shall be governed by
and construed in accordance with the laws of Switzerland under exclusion of its conflict of laws rules and of
the Vienna Convention on the International Sale of Goods (CISG)."

„Gewährleistung und Haftung:


Der Nutzer ist allein für die Verwendung des in dieser Datei beschriebenen Anwendungsbeispiels
verantwortlich.
ABB unterliegt keiner Gewährleistung. Die Haftung von ABB im Zusammenhang mit diesem
Anwendungsbeispiel oder den in dieser Datei enthaltenen Dateien - gleich aus welchem Rechtsgrund - ist
ausgeschlossen. Dieser Ausschluß gilt nicht im Falle von Vorsatz oder grober Fahrlässigkeit. Diese
Erklärung unterliegt Schweizer Recht unter Ausschluß der Verweisungsnormen und des UN-Kaufrechts
(CISG)."

B. Nur für Kunden mit Sitz in Deutschland

„Gewährleistung und Haftung:


Die in diesem Anwendungsbeispiel enthaltenen Dateien beschreiben eine mögliche Anwendung der AC500
bzw. zeigen eine mögliche Einsatzart. Sie stellen nur Beispiele für Programmierungen dar, sind aber keine
fertigen Lösungen. Eine Gewähr kann nicht übernommen werden.
Der Nutzer ist für die ordnungsgemäße, insbesondere vollständige und fehlerfreie Programmierung der
Steuerungen selbst verantwortlich. Im Falle der teilweisen oder ganzen Übernahme der
Programmierbeispiele können gegen ABB keine Ansprüche geltend gemacht werden.
Die Haftung von ABB, gleich aus welchem Rechtsgrund, im Zusammenhang mit den
Anwendungsbeispielen oder den in dieser Datei enthaltenen Dateien wird ausgeschlossen. Der
Haftungsausschluß gilt jedoch nicht in Fällen des Vorsatzes, der groben Fahrlässigkeit, bei Ansprüchen
nach dem Produkthaftungsgesetz, im Falle der Verletzung des Lebens, des Körpers oder der Gesundheit
oder bei schuldhafter Verletzung einer wesentlichen Vertragspflicht. Im Falle der Verletzung einer
wesentlichen Vertragspflicht ist die Haftung jedoch auf den vertragstypischen, vorhersehbaren Schaden
begrenzt, soweit nicht zugleich ein anderer der in Satz 2 dieses Unterabsatzes erwähnten Fälle gegeben
ist. Eine Änderung der Beweislast zum Nachteil des Nutzers ist hiermit nicht verbunden.
Es gilt materielles deutsches Recht unter Ausschluß des UN-Kaufrechts."

4 AC 500 - HA-CS31 Library Application Example Description


2. INTRODUCTION TO DOCUMENT
2.1. Scope of the document

The purpose of this document is to explain how to develop an application with High
Availability (HA) functionalities.

2.2. Overview of the Content

There are two examples discussed in this document for the two different HA setups.

In chapter 5 the example for counter application is described using HA setup only with CPU
COM CS31 bus. It also explains about sample redundant Panel Builder program.

In chapter 6 the example is described using HA setup with both CPU COM and CM574
COM CS31 bus.

The necessary preparation of the AC500 is explained at the beginning of each of these
example chapters.

2.3. Compatibility

The example programs explained in this document have been used with the below
engineering system versions. They should also work with other versions; nevertheless
some small adaptations may be necessary, for future versions.

Engineering Tool: - Automation Builder V 1.1.0

2.4. Safety Instructions

The user must follow all applicable safety instructions and the guidelines mentioned in the
user documents of the ABB products used in the example program.

Read the complete safety instructions for the AC500 before installation and commissioning.

Read all safety instructions of your control station system manuals.

AC 500 - HA-CS31 Library Application Example Description 5


3. Overview
The library HA_CS31_AC500_V23.lib (V2.4.2) is intended to be used for a AC500 High
Availability project consisting of the following components:

· CI590 CS31 Bus Modules


· Two AC500 PLC CPU with
o CS31 bus on PM5xx (and CM574-RS for extension)
o Ethernet Port on PM5xx (for data sync) and CM577 (for HMI)
· Optionally HMI, for example a desktop running DigiVis & OPC Server

A comprehensive documentation to High Availability system and library can be found in the
online help.

This document is an extended version of the online help chapter: High Availibility – System
Technology - Guidelines for Usage. Engineering and operation of different HA systems are
explained with all detailed steps, using the example project which comes along with this
document (See folder \AutomationBuilder\Examples\HA-CS31)

6 AC 500 - HA-CS31 Library Application Example Description


4. Overview of HA Functional Blocks Used
The AC500 High Availability Function Block Library HA_CS31_AC500_V23.lib (V2.4.2)
contains 19 Function Blocks.

Each HA application requires few mandatory function blocks and settings to be done in
every project. Following is an overview of the function blocks which are needed for an
extended system with CM574. The detailed explanation for each function block is available
in the online help chapter: High Availibility Library – Control and Diagnosis Function Blocks.

4.1. HA_CS31_CONTROL

Fig 1 :- HA_CS31_CONTROL FB

The HA_CS31_CONTROL function block handles AC500 HA operation such as change


over from primary to secondary CPU in case of fault with related diagnostics and also data
transfer between HA CPUs.

AC 500 - HA-CS31 Library Application Example Description 7


4.2. HA_CS31_DIAG

Fig 2:- HA_CS31_DIAG FB

The HA_CS31_DIAG Function Block handles the control and status bytes of each CI590
Module on the CPU COM CS31 Bus and related diagnostics.

4.3. HA_CS31_DIAG_VIA_CM574

Fig 3 :- HA_CS31_DIAG_VIA_CM574 FB

This HA_CS31_DIAG_VIA_CM574 function block will work only on the CPU and gives the
status of CI590 on the CM574 module. This Function Block works only if a corresponding
HA_CS31_DIAG_ON_CM574 is enabled in CM574-RS program.

4.4. HA_CS31_DIAG_ON_CM574

Fig 4 :- HA_CS31_DIAG_ON_CM574FB.

This HA_CS31_DIAG_ON_CM574 function block will work only on the CM574 RS. This
function block works only if HA_CS31_DIAG_VIA_CM574 is enabled in the CPU program

8 AC 500 - HA-CS31 Library Application Example Description


5. Example program for HA Application using CPU COM1 CS31 Bus
The Automation Builder project can be found in the folder
\AutomationBuilder\Examples\HA-CS31. The Example program using only the CPU is
available under “HA_CS31_Example_OnlyCPU_PM5xx” project node in Automation
Builder.

RECOMMENDED HA CONNECTION

Desktop Running With Digivis & OPC Server

Bridge Connection
PC Ethernet Card 1 PC Ethernet Card 2

Level 2 Managed Ethernet Level 2 Managed Ethernet


Switch 1 Switch 2

CM577 PM5xx CM577 PM5xx


24V DC 24V DC
POWER POWER
SUPPLY POWER POWER SUPPLY
SUPPLY ETH SUPPLY ETH
1 1
COM1 COM1
COM2 COM2
2 2

CS31 Line 1
CI590 S500 XXX S500 XXX

CS31 Line A
CS31 Line B
UDP Data Exchange
ETH Card 1 ETH Cable
ETH Card 2 ETH Cable

This chapter describes how HA Counter, Ramp and PID Function Block is used for CPU
COM1 CS31 bus example program. The following components are required:

· Two identical PLC setups (PM573 or higher) connected with CI590 and IO modules
using CS31.
· One PLC setup will act as primary setup and other one as secondary, which will be
decided by the HA library itself
· Separate CM577 Ethernet modules can be used for downloading the program.
· Please refer chapter 2.3 for correct Automation Builder version details, Automation
Builder running on a PC which is connected to the AC500 via Ethernet.
· Library: HA_CS31_AC500_V23.lib.
· Example project: “ Example_AC500_HA_CS31_V242.project ”.

AC 500 - HA-CS31 Library Application Example Description 9


5.1. Configuration (Automation Builder)

Note: - User can skip the following steps by opening the example project directly from
\AutomationBuilder\Examples\HA-CS31path.

5.1.1. Target

Open new Automation Builder Plus and choose your PLC type.

5.1.2. CS31 & CI590

Plug CS31 bus under COM1 interface

10 AC 500 - HA-CS31 Library Application Example Description


Add present modules by adding CI590 modules and their own IO-Bus modules.

Set a unique address for each CI590 module connected on the same CS31 bus network.
The same must be given on the hardware using the rotary switch.

For addressing more than one CI590 module user has to configure the first CI590 line
completely in Automation Builder and double click on the CI590 module to check the actual
no CS31 modules.In the next CI590 module, the given address should be higher than the
number of CS31 modules in the previous line.

AC 500 - HA-CS31 Library Application Example Description 11


For example in the below picture if the first CI590 and IO modules consuming 7 CS31
modules then the next CI590 address should be 8 or higher than that.

5.1.3. Inputs/Outputs

The WORD variables corresponding to Input and Output channels shall be renamed in a
manner that they are accessible and understood more easily.

This example comes along with a mapping table (see


Example_AC500_HA_CS31_V242_IO mapping.xlsx in the same folder)

For example:

· For outputs of the first CI590 in the configuration: CI590_Counter1_O


· For outputs of the second CI590 in the configuration: CI590_Counter2_O
· For outputs of first CI590 second IO module (AX521) configuration: Ramp and PID
inputs and outputs are configured.

12 AC 500 - HA-CS31 Library Application Example Description


User must configure the IO module parameters under Configuration tab.For analog
modules must be configured for each IO to get it activated.

5.1.4. Ethernet , UDP data exchange and CM577

Refer to ⇘ “Recommended Use of Ethernet Connections” for more details.

Ethernet è

PLCs and CM577s must be given a fix IP address, e.g.:

PLC1: 192.168.0.201

PLC2: 192.168.0.202

CM577 on PLC1: 192.168.0.203

CM577 on PLC2: 192.168.0.204

AC 500 - HA-CS31 Library Application Example Description 13


UDP data exchange element. è

Right click on Onboard Ethernet and select add device

Select UDP data exchange

14 AC 500 - HA-CS31 Library Application Example Description


Add CM577 for program download è

Right click on the slot and select plug device

Select CM577

ADD Modbus_TCP_IP_Server è

Right click on CM577-ETH and add Modbus_TCP_IP_Server configuration for HMI

communication.

AC 500 - HA-CS31 Library Application Example Description 15


5.2. Programing (CoDeSys)

5.2.1. Overview

Below picture shows the Mandatory Function Blocks for HA system to work. Inside dotted
box are not the mandatory Function Blocks for HA system to work.

5.2.2. Library

HA_CS31_AC500_V23.lib must be added to project in order to have access to HA function


block.

In library manager (accessible by Resources menu), right click on library list and select
Additional library.

Select HA_CS31_AC500_V23.lib in the right folder (C:\Program Files\Common Files\CAA-


Targets\ABB_AC500\AC500_V12\Library).

16 AC 500 - HA-CS31 Library Application Example Description


5.2.3. HA_PROGRAM (POU)

Right click on POUs manager and select Add Object. Name this object HA_PROGRAM and
choose FBD language and validate this box.

Add the both HA function blocks (Standard function blocks):

HA_CS31_CONTROL è The function block controls the HA Operation. For more details
about the function block please refer online help file.

HA_CS31_DIAG è The function block reads the status byte and writes control byte of all
CI590 connected on HA-CPU COM1 with relevant diagnostics. For more details about the
function block please refer online help file.

The following variables must be initialized.

xEnable_1 and xEnable_2 must be set to TRUE to enable function block.

byCom:=1; for COM1 (PLC CS31 port)

stAC500_PM1:= 192.168.0.201; this address must correspond to address affected in


section Ethernet configuration

AC 500 - HA-CS31 Library Application Example Description 17


stAc500_PM2:= 192.168.0.202; this address must correspond to address affected in
section Ethernet configuration

5.2.4. Application Programs


5.2.4.1. PLC_PRG(POU)

Right click on POUs manager and select Add Object. Name this object PLC_PRG and
choose CFC language and validate this box.

Note:- The user can select any other suitable programming style such as ST or FBD.

Program named PLC_PRG is equivalent to Main for C program. For this example, the
PLC_PRG Program is calling other programs.

For this example EXAMPLE_COUNTER_FB, EXAMPLE_PID_FB , HMI_DATA_EXCHANG


, EXAMPLE_DIGIVIS and EXAMPLE_RAMP_FB program is called.

18 AC 500 - HA-CS31 Library Application Example Description


5.2.4.2. EXAMPLE_COUNTER_FB

There are 3 different types of counters in HA library:

· HA_CS31_CTD: Counter Down with HA Data Synchronization


· HA_CS31_CTU: Counter Up with HA Data Synchronization
· HA_CS31_CTUD: Counter Up Down with HA Data Synchronization

The three counters are incremented or decremented with the same clock signal. When the
counter limit is reached, a preload value is loaded and the cycle restarts infinitely.

For HA_CS31_CTUD block, when the increment period (reach of counter limit) is finished,
counter goes to decrement mode until to the low limit.

Description of the program è

A general Enable signal is used for the three counters [0, 1].

The clock signal is the same for the entire counter [3, 4, 5, 6].

There is an automatic management of mode counter (only for Counter2: CTUD)[2,7,8,9,10].

AC 500 - HA-CS31 Library Application Example Description 19


Counter instantiations are linked directly to outputs: count1 (CTU), count2 (CTUD) outputs
are respectively connected to CI590 first module, CI590 second module. Count3 (CTD)
output is connected to an internal variable.

Reset management and Load Value management are treated just after HA function blocks
took into account their levels.

Limits of counters are tested there, and when a counter reach a limit, according to mode
management, counters restart or change counting mode.

20 AC 500 - HA-CS31 Library Application Example Description


Output of the BLINK is used generate clock signal for all the three counters.

5.2.4.3. EXAMPLE_RAMP_FB

There is one type of High Availability ramp:

HA_CS31_RAMP_INT: Basic RAMP_INT FB with inbuilt HA Data Synchronization.

Description of the program è

The program generates the following waveform signal:

The basis signal is a simple blinking output as a clock signal and the period for reaching
limit is determined by Limit_Ratio numbers of clocks.

AC 500 - HA-CS31 Library Application Example Description 21


For this example: clock period is 1 s and Limit_Ratio = 20, for 40 seconds the limit to reach
is eitherIN_VALUE_H or IN_VALUE_L.

RST ratio management enables to redone the test infinitely by re-initializing CTU blocks.

Programming Example 15 High Availability Ramp AC500/Issue: 04.2009

Ramp set point is switching between IN_VALUE_H and IN_VALUE_L according to


increasing ramp or decreasing.

Parameters of the ramp:

· ASCEND: increment step (1000 for this example)


· DESCEND: decrement step (1000 for this example)
· TIMEBASE: period between step (300ms for this example)

22 AC 500 - HA-CS31 Library Application Example Description


These parameters allow the ramp function block to reach the limit in:

+25000 – (-25000) = 50000

50000 / 1000 = 50 steps

50 x 300ms = 15 seconds

Output of an AX522 module is affected by ramp output and the signal can be check by
oscilloscope.

5.2.4.4. EXAMPLE_PID_FB

There are 2 different types of PID’s in HA library:

HA_CS31_PID: Basic PID controller with inbuilt HA Data Synchronization

HA_CS31_PID_FIXCYCLE: Basic PID controller with fix cycle with inbuilt HA Data
Synchronization.

The both PID are controlled with the same “SET POINT” signal. This signal switches
between -25000 and+25000.

Description of the program è

Switching between the limits PID_VAL_H and PID_VAL_L respectively +25000 and -25000.

AC 500 - HA-CS31 Library Application Example Description 23


The both PID set points are affected with the same value.

Read of the actual state directly with the inputs corresponding to PID controlled outputs. A
conversion is needed to affect PID inputs.

The PID parameters are defined during declaring variables. The both type of PID are
instantiated there.

The outputs of the PID blocks are converted to be connected directly with outputs.

24 AC 500 - HA-CS31 Library Application Example Description


5.2.4.5. HMI_DATA_EXCHANG

This is a sample program for showing the data exchange between PLC and HMI.

Here some variables and output values are incremented in each PLC cycle.

5.2.4.6. EXAMPLE_DIGIVIS

This is a sample program for displaying IP address, PID, RAMP and COUNTER values in
Digivis screen. Digivis program is available in the Example program folder.

Digivis with OPC server is recommended for HA system for writing data to PLC as it will
write data to both the PLC at the same time and read data from the Primary PLC.

AC 500 - HA-CS31 Library Application Example Description 25


Digivis screen available with the example project folder is as below.

OPC Server configuration is explained under chapter 6 and sample configuration files can
be find inside Automation Builder example folder.

5.2.5. CALLBACK_STOP (POU)

This program is used only with HA function blocks.

HA_CS31_CALLBACK_STOP function should be called in CPU program as a function


using Task Configurator -> System Events. Below are the steps for calling the function.

1. Go to Task configuration, select the system event


2. Enable STOP event,
3. Type a name in ‘Called POU’ column (POU name must start with the prefix
‘CALLBACK’).
4. Click on ‘Create POU and create the function with the name CALLBACK_STOP’,
5. It creates a new function CALLBACK_STOP (FUN) in the project POU list.
6. Go to CALLBACK_STOP POU and insert HA_CS31_CALLBACK_STOP function.

Note: Callback Stop Event must be in followed the name patters as below “callback_xxx”.
The usage of prefix ‘callback’ is mandatory.

5.3. Task configuration (CoDeSys)

26 AC 500 - HA-CS31 Library Application Example Description


5.3.1.1.1. HA TASK

At least, two tasks must be defined:

MAIN: for example, it will be executed cyclically each 30 ms and with a priority of 11.

HA Task: it will be executed cyclically each 30 ms and with a priority of 10.

Note:-

HA Task for the mandatory HA functions blocks HA_CS31_CONTROL, HA_CS31_DIAG: It


will be executed cyclically.The cycle times are dependent on the CS31 cycle time which is
calculated by the Automation Builder and indicated in the CS31 bus node (Tab “Check
CS31 modules”). Minimum HA CPU Cycle time must be either 30 ms or equal to CS31
Cycle time whichever value is higher. The priority must be higher than the other tasks in the
project

MAIN Task for the application itself: lower priority than the HA task. Cycle time should be
equal to CS31 cycle time (Automation buider indicated) or higher.This also based on PLC
Type and Application.

Right click on Task configuration menu and select Append Task.

Fill the following fields:

· Name of task
· Priority as seen before
· Type: cyclic
· Interval: 10ms

AC 500 - HA-CS31 Library Application Example Description 27


After creating task executed periodically each 30ms, the program HA_PROGRAM must be
called by this task.

Right click on HA_TASK and select Append Program Call.

28 AC 500 - HA-CS31 Library Application Example Description


5.3.2. MAIN_TASK

Do the same as above for MAIN task and call PLC_PRG program and have the following
screen.

You can download your program now in both PLC and check configuration errors.

5.4. Program Download

The CPU program can be downloaded to PLC using normal TCP/IP gateway.

To avoid any difference in configurations we recommend you to create a single Automation


Builder / CoDeSys project for High Availability and download the same in to both CPUs –
one after the other.

It is recommended to use dedicated Ethernet port for Program download.If the PLC is not
having more than one onboard ETH port then the user need to use a CM577-ETH slot for
downloading program to both PLC.If the PLC is having more than one onboard ETH port
then the user can use ETH2 for program downlaod, If no CM577-ETH is available, onboard
Ethernet slot can be used for downloading the program.

After downloading the program create a boot project

5.5. Operation

The HA_CS31_CONTROL function block handles the AC500 HA operation such as change
over from primary to secondary CPU in case of fault with related diagnostics and also data
transfer between HA CPUs. This is a mandatory function block for HA to RUN.

The HA_CS31_DIAG function block will be used for getting diagnostic information only from
CPU COM1 CS31 line .Please refer function block online help file for more detailed
information about the block.

AC 500 - HA-CS31 Library Application Example Description 29


The HA_CS31_DATA_SYNC function block is used for synchronizing non HA utility
function blocks or any other data .Refer Function Block online help file more details.

The HA Utility function blocks outputs are internally synchronized and can be used directly
without using HA_CS31_SYNC function block.

Note :

· During HA system startup if all CI590 modules are not powered on or having wrong
module address system will not become stable.
· If any CI590 module address changed after HA system startup system will continue
running as it is. Restart is required for the complete system for the new address to
get active.

Below is the HA over view visualization.

1. Shows the PLC status as “PRIMARY“ or “SECONDARY“


2. Shows PLC IP address
3. Shows HA_CS31_CONTROL FB error code
4. Acknowledge change over button.
5. Shows PLC RUN status. Green when running, Red when stopped.
6. Shows UDP data exchange Ethernet status. Green if there is no error, Red if there
is any error.
7. Green square surrounding to PLC shows, to which PLC desktop is connected and
online.
8. Manual change over button. Only visible from Primary PLC.
9. Line A CS31, Green when online, Red when there is error or off line.
10. Line B CS31, Green when online, Red when there is error or off line.
11. Shows CS31 Line number.
12. Shows active slaves in that particular CS31 line
13. Shows configured slaves in that particular CS31 line.
14. Shows error related to that particular CS31 line
15. Shows MIX wire error. White if there is no error, Red if there is MIX wire error.
16. Shows CM577 if configured.

30 AC 500 - HA-CS31 Library Application Example Description


Note: - HA visualization can be used only for the monitoring purpose. Customer can view
only the logged in PLC information using visualization. Customer can use Digivis and OPC
server for read and write data to HA System. For more information please refer chapter
4.2.4.6 and 7.

5.5.1. Panel Builder program and Configuration for HMI with redundant Scripts.

Panel builder program and scripts are available with example program under
“HA_CS31_Example_OnlyCPU_HMI” program node in Automation Builder. Please find
below recommended HA connection diagram for CP6xx HMI.

Note: - Example HMI program can be used with CP6xx having one / two Ethernet ports.

This is a sample program for users who wants to use the CP6xx series HMI with redundant
applications.In Codesys program fG_HA_PRIMARY and fG_HA_CPU_STOP variable
status must be passed to Panel builder program for HMI to identify the Primary PLC.
fG_HA_CPU_STOP variable status must be used under callback stop POU as
below.Please refer chapter 5.2.4.5 for HMI Data exchange program in PLC.

AC 500 - HA-CS31 Library Application Example Description 31


The scripts in the HMI program will make sure it always displays the data from the Primary
PLC. This example has a screen where in the user can select one of the two PLCs. The
data will be read related to the selected PLC only. This is done using the IP override
functionality. With minor modifications the screens can be made application specific.

Below is the screen shot from the HMI sample screens

Note :- HMI is recommend only to read the data from PLC as it will always read data from
Primary PLC. It is not recommended to write data from HMI as it will write only to the
Primary PLC.

User can go to HMI protocol tab and change the communication protocol to Modbus TCP if
required.

32 AC 500 - HA-CS31 Library Application Example Description


6. Example program for HA Application using CPU COM1 CS31 Bus and
CM574 CS31 Bus
The Automation Builder project can be found in the folder
\AutomationBuilder\Examples\HA-CS31. The Example program and configuration for PLC
are available under “HA_CS31_Example_CPUandCM_PM5xx” project node in Automation
Builder. Example program and configuration for CM574-RS are available under
“HA_CS31_Example_CPUandCM_CM574” project node in Automation Builder. Both these
programs should be downloaded to respective PLC and CM574-RS for establishing CM574
CS31 communication.

This chapter describes how HA Counter ,PID and Ramp Function Block is used for CPU
COM1 CS31 bus and CM574 CS31 bus example program. The following components are
required:

· Two identical PLC setups (PM573 or higher) plugged with CM574 and
CM577connected with CI590 and IO modules using CS31. One PLC setup will act
as primary setup and other one as secondary.
· Separate CM577 Ethernet modules can be used for downloading the program.
· Please refer chapter 2.3 for correct Automation Builder version details, Automation
Builder running on a PC which is connected to the AC500 via Ethernet

AC 500 - HA-CS31 Library Application Example Description 33


· Library: HA_CS31_AC500_V23.lib
· Example project: “ Example_AC500_HA_CS31_V242.project ”

6.1. CPU Configuration (in Automation Builder)

6.1.1. Target

Open new Automation Builder Plus program => Right click and select Add device =>
choose your PLC type.

Refer 5.1.1 for more detailed description and screen shots

6.1.2. CS31 & CI590

Plug CS31 bus under COM1 interface and Add present modules by adding CI590 modules
and their own IO-Bus modules. Set different Module address for each CI590 module
connected on the same CS31 bus network.

Refer 5.1.2 for more detailed description

For CM574 CS31 lines add CM574 under the respective SLOT no as shown below.

Select CM574-RS from the list as shown below and select Plug Device

34 AC 500 - HA-CS31 Library Application Example Description


For adding CS31 bus under CM574, right click on the respective Channel no and select
Plug Device.

Select CS31 bus from the list and Plug Device as shown below

AC 500 - HA-CS31 Library Application Example Description 35


Right click on CS31 bus and select CI590 module as shown below

Right click on the CI590 and select Add device again for adding the IO modules as shown
below

36 AC 500 - HA-CS31 Library Application Example Description


Add all modules on the CI590 by repeating the previous step.

For addressing more than one CI590 module user as to configure the first CI590 line
completely in Automation Builder and double click on the CI590 module to check the actual
no CS31 modules and the next CI590 module address should be higher than the number of
CS31 modules in the previous line.

For example as the below picture if the first CI590 and IO modules consuming 7 CS31
modules then the next CI590 address should be 8 or higher than that.

6.1.3. Inputs/Outputs

The WORD variables corresponding to Input and Output channels shall be renamed to be
accessible more easily.

This example comes along with a mapping table (see


Example_AC500_HA_CS31_V242_IO mapping.xlsx in the same folder)

AC 500 - HA-CS31 Library Application Example Description 37


For example:

· For outputs of the CPU COM1 first CI590 in the configuration: CI590_Counter1_O
· For outputs of the CM574 COM1 first CI590 in the configuration: CI590_Counter2_O
· For outputs of the CM574 COM2 first CI590 in the configuration: CI590_Counter3_O
· For outputs of the first CM574 second CI590 IO module AX522 configuration is
having Ramp and PID inputs and outputs configuration.

Refer 5.1.3.for more detailed description and screen shots

6.1.4. Ethernet , UDP Data Exchange and CM577

Refer to ⇘ “Recommended Use of Ethernet Connections” for more details.

Ethernet è

PLCs and CM577s must be affected with a fix IP address, e.g.:

PLC1: 192.168.0.80

PLC2: 192.168.0.81

CM577 on PLC1: 192.168.0.70

CM577 on PLC2: 192.168.0.71

Add UDP data exchange element. è

Right click on Onboard Ethernet => select add device => Select UDP data exchange

Refer 5.1.4.for more detailed description and screen shots

38 AC 500 - HA-CS31 Library Application Example Description


Add CM577 for program download. è

Right click on the slot => select plug device => Select CM577

Refer 5.1.4.for more detailed description and screen shots

Note:

It may be observed that in the complete CS31 line each CI590 might take different time to
initialize based on the number of I/O devices connected to it. So it is a good practice to
make the CI 590 initialize and update the input and outputs together. In order to achieve it
the ‘max wait time’ setting must be configured as per the process explained below:

First we need to physically check the time taken CI590 modules to get stable once the
system is powered on. Once the PLC is powered ON, the CI 590 starts initializing. Note the
time taken by the CI590

· to get its CS31 LEDs stable and


· When the LEDs of digital and analog outputs of all the I/O modules attached to it are
glowing.

The above time must be calculated only for the CI590 which takes the maximum time to get
stable among all the CI590 devices in the set up.

Then open the Automation Builder project and click on the com port of the CM574 module
on which the CS31 line is configured, as shown in the screenshot below.

In the Max wait run enter the time as per the calculations done above. For example of the
time taken for all the CI 590s to get stable is 60secs, enter the value slightly higher than
this.

The following pictures explain the effect of having the max wait time value.

AC 500 - HA-CS31 Library Application Example Description 39


6.2. CPU Programing (CoDeSys)

6.2.1. Overview

Below picture shows the mandatory function blocks for HA system to work with CM574
CS31 bus connected with IO modules. This is supported by library
HA_CS31_AC500_V23.lib or higher. Inside dotted line box function blocks are not
mandatory for HA system to run.

CM574-RS PM5xx

HA_CS31_CONTROL

HA_CS31_CALLBACK_STOP

HA_CS31_DIAG
CPU COM1
(COM1, SLOT0-CPU)

HA_CS31_DIAG_EXTD
(SLOT0 , COM1-CPU)

CM574-RS (SLOT1)
HA_CS31_DIAG_ON_CM574 HA_CS31_DIAG_VIA_CM574
CM574 SLOT1 COM1 (SLOT1,COM1) (SLOT1,COM1)
HA_CS31_DIAG_EXTD_VIA_CM574
(SLOT1,COM1)
HA_CS31_DIAG_ON_CM574 HA_CS31_DIAG_VIA_CM574
CM574 SLOT1 COM2
(SLOT1,COM2) (SLOT1,COM2)
HA_CS31_DIAG_EXTD_VIA_CM574
(SLOT1,COM2)

CM574-RS (SLOT4)
HA_CS31_DIAG_ON_CM574 HA_CS31_DIAG_VIA_CM574
CM574 SLOT4 COM1 (SLOT4,COM1) (SLOT4,COM1)
HA_CS31_DIAG_EXTD_VIA_CM574
(SLOT4 , COM1)
HA_CS31_DIAG_ON_CM574 HA_CS31_DIAG_VIA_CM574
CM574 SLOT4 COM2
(SLOT4 , COM2) (SLOT4 , COM2)
HA_CS31_DIAG_EXTD_VIA_CM574
(SLOT4 , COM2)

HA_CS31_DATA_SYNC

HA CS31 Utility FB's


HA_CS31_CTD
HA_CS31_CTU

HA_CS31_TOF
HA_CS31_TON

6.2.2. Library

HA_CS31_AC500_V23.lib must be added to project in order to have access to HA function


block.

In library manager (accessible by Resources menu), right click on library list and select
Additional library =>Select HA_CS31_AC500_V23.lib in the right folder => C:\Program
Files\Common Files\CAA-Targets\ABB_AC500\AC500_V12\Library.

Refer 5.2.1.for more detailed description and screen shots

40 AC 500 - HA-CS31 Library Application Example Description


6.2.3. HA_PROGRAM (POU)

Right click on POUs manager => select Add Object. Name this object HA_TASK=> choose
FBD language => Press OK.

Add the both HA function blocks (Standard function blocks):

HA_CS31_CONTROL è The function block controls the HA Operation. For more details
about the function block please refer the online help file.

HA_CS31_DIAG è The function block reads the status byte and writes control byte of all
CI590 connected on HA-CPU COM1 with relevant diagnostics. For more details about the
function block please refer the online help file.

The following variables must be initialized

· xEnable_1 and xEnable_2 must be set to TRUE to enable function block.


· byCOM_1 := 1; for COM1 (PLC CS31 port)
· stAC500_PM1:= 192.168.0.80; this address must correspond to address affected in
section Ethernet configuration
· stAC500_PM2 := 192.168.0.81; this address must correspond to address affected in
section Ethernet configuration

Refer 5.2.2.for more detailed description and screen shots.

HA_CS31_DIAG_VIA_CM574 è This function block reads the status byte and writes
control byte of all CI590-CS31-HAconnected on HA - CM574-RS COM with relevant
diagnostics. This is a mandatory function block for CM574-RS CS31 bus to work. For more
details about the function block please refer the online help file.

For each CM574 CS31 lines it is mandatory to call HA_CS31_DIAG_VIA_CM574 FB as


shown below

xEnable_3 & xEnable_4 must be set to true for enabling function block.

bySlot_3 & bySlot_4:=2; this is to represent the SLOT NO in which CM574 is plugged.

byCom_3 & byCom_4:= 1 & 2 respectively to identify the CS31 COM no in CM574.

AC 500 - HA-CS31 Library Application Example Description 41


6.2.4. Application Programs

Right click on POUs manager and select Add Object. Name this object PLC_PRG and
choose CFC language and validate this box. The user can select any other suitable
programming style such as ST or FBD.

Program named PLC_PRG is equivalent to Main for C program. For this example, the
PLC_PRG Program is calling other programs.

For this example COUNTER_EXAMPLE_FB, EXAMPLE_RAMP_FB and


EXAMPLE_PID_FB program is called.

42 AC 500 - HA-CS31 Library Application Example Description


6.2.4.1. EXAMPLE_COUNTER_FB

There are 3 different types of counters in HA library:

· HA_CS31_CTD: Counter Down with HA Data Synchronization


· HA_CS31_CTU: Counter Up with HA Data Synchronization
· HA_CS31_CTUD: Counter Up Down with HA Data Synchronization

The three counters are incremented or decremented with the same clock signal. When the
counter limit is reached, a preload value is loaded and the cycle restarts infinitely.

For HA_CS31_CTUD block, when the increment period (reach of counter limit) is finished,
counter goes to decrement mode until to the low limit.

Description of the program è

A general Enable signal is used for the three counters [0, 1].

The clock signal is the same for all the counter [3, 4, 5, 6].

There is an automatic management of mode counter (only for Counter2: CTUD)[ 2, 7, 8, 9,


10].

Counter instantiations are linked directly to outputs: count1 (CTU), count2 (CTUD), Count3
(CTD) outputs are respectively connected to CPU COM1 CS31 CI590 first module, SLOT2
CM574 COM1 CI590 first module , SLOT2 CM574 COM2 CI590 first module.

AC 500 - HA-CS31 Library Application Example Description 43


Reset management and Load Value management are treated just after HA function blocks
took into account their levels.

Limits of counters are tested there, and when a counter reach a limit, according to mode
management, counters restart or change counting mode.

Output of the BLINK is used generate clock signal for all the three counters.

Refer 5.4 for more detailed description and screen shots

6.2.4.2. EXAMPLE_RAMP_FB

There is one type of High Availability ramp:

HA_CS31_RAMP_INT: Basic RAMP_INT with inbuilt HA Data Synchronization

Description of the program è

The program generates the following waveform signal:

The basis signal is a simple blinking output as a clock signal and the period for reaching
limit is determined by Limit_Ratio numbers of clocks.

For this example: clock period is 1 s and Limit_Ratio = 20, for 40 seconds the limit to reach
is eitherIN_VALUE_H or IN_VALUE_L.

44 AC 500 - HA-CS31 Library Application Example Description


RST ratio management enables to redone the test infinitely by re-initializing CTU blocks.

Programming Example 15 High Availability Ramp AC500/Issue: 04.2009

Ramp set point is switching between IN_VALUE_H and IN_VALUE_L according to


increasing ramp or decreasing.

Parameters of the ramp:

· ASCEND: increment step (1000 for this example)


· DESCEND: decrement step (1000 for this example)
· TIMEBASE: period between step (300ms for this example)

These parameters allow the ramp function block to reach the limit in:

+25000 – (-25000) = 50000

50000 / 1000 = 50 steps

50 x 300ms = 15 seconds

Output of an AX522 module is affected by ramp output and the signal can be check by
oscilloscope.

AC 500 - HA-CS31 Library Application Example Description 45


6.2.4.3. EXAMPLE_PID_FB

There are 2 different types of PID’s in HA library:

HA_CS31_PID: Basic PID controller with inbuilt HA Data Synchronization

HA_CS31_PID_FIXCYCLE: Basic PID controller with fix cycle with inbuilt HA Data
Synchronization

The both PID are controlled with the same “SET POINT” signal. This signal switches
between -25000 and+25000.

Description of the program è

Switching between the limits PID_VAL_H and PID_VAL_L respectively +25000 and -25000

The both PID set points are affected with the same value.

Read of the actual state directly with the inputs corresponding to PID controlled outputs. A
conversion is needed to affect PID inputs.

The PID parameters are defined during declaring variables. The both type of PID are
instantiated there.

46 AC 500 - HA-CS31 Library Application Example Description


The outputs of the PID blocks are converted to be connected directly with outputs.

6.2.5. CALLBACK_STOP (POU)

This program is used only with HA function blocks.

HA_CS31_CALLBACK_STOP Function should be called in CPU program as a Function


using Task Configurator -> System Events.

Refer 5.2.5.for more detailed description and screen shots

6.3. CPU Task Configuration (CoDeSys)

6.3.1. HA Task

At least, two tasks must be defined:

· MAIN: for example, it will be executed cyclically each 30 ms and with a priority of 11.
· HA_Task: it will be executed cyclically each 30 ms and with a priority of 10.

Note :-

HA Task for the mandatory HA functions blocks HA_CS31_CONTROL, HA_CS31_DIAG,


HA_CS31_DIAG_VIA_CM574: It will be executed cyclically with the cycle time more than
the calculated CS31 cycle in the Automation builder project. The priority must be higher
than the other tasks in the project

AC 500 - HA-CS31 Library Application Example Description 47


MAIN Task for the application itself: lower priority than the HA task. Cycle should be eual or
higher than CS31 cycle time (Autonmation builder indicated).This also based on PLC Type
and application,

Right click on Task configuration menu => select Append Task.

Fill the following fields:

· Name of task
· Priority as seen before
· Type: cyclic
· Interval: 10ms

After creating task executed periodically each 10ms, the program HA_PROGRAM must be
called by this task.

Right click on HA_TASK and select Append Program Call.

Refer 5.3.1.for more detailed description and screen shots

6.3.2. MAIN_TASK

Do the same as above for MAIN task and call PLC_PRG program

Refer 5.3.2.for more detailed description and screen shots

You can download your program now in both PLC and check configuration errors.

6.4. Download to CPU

The CPU program can be downloaded to PLC using normal TCP/IP gateway. For more
details please refer Chapter 5.5.After downloading the program create a boot project.

6.5. CM574 Configuration (Automation Builder)

Example CM574 configuration and program is available under


“HA_CS31_Example_CPUandCM_CM574” program node in Automation Builder. This
should be used along with “HA_CS31_Example_CPUandCM_PM5xx” program to establish
CS31 communication on CM574 modules.

Open new Automationl Builder Plus program => select create a new project => Select
CM574 RS as device

48 AC 500 - HA-CS31 Library Application Example Description


Right click on COM1 and select Plug Device

Select COM1-Shared from the list

Based on actual hardware setup configure COM1 & COM2 as Shared Interface

AC 500 - HA-CS31 Library Application Example Description 49


6.6. CM574 Programing (CoDeSys)

6.6.1. Library

HA_CS31_AC500_V23.lib must be added to project in order to have access to HA function


block.

In library manager (accessible by Resources menu), right click on library list and select
Additional library =>Select HA_CS31_AC500_V23.lib in the right folder => C:\Program
Files\Common Files\CAA-Targets\ABB_AC500\AC500_V12\Library

Refer 5.2.1.for more detailed description and screen shots

6.6.2. PLC_PRG

Go to Project tab and Rebuild the blank project once and again go to Project => Object =>
Convert

Select FBD and press OK

Note:- The user can select any other suitable programming style such as ST or FBD.

Add the HA function blocks (Standard function blocks):

HA_CS31_DIAG_ON_CM574 è The function block reads the status byte and writes
control byte of all CI590 connected on CM574-RS COM with relevant diagnostics.

For more detailed description about the function block please refer the online help file.

The following variables must be initialized

· xEnable_1 and xEnable_2 must be set to TRUE to enable function block.


· byCom_1 :=1 ; for CM574 COM1 & byCom_2 :=2 ; for CM574 COM2

50 AC 500 - HA-CS31 Library Application Example Description


6.7. CM574 TASK Configuration (CoDeSys)

6.7.1. HA_TASK

Right click on Task configuration menu and select Append Task.

Fill the following fields:

· Name of task
· Priority as 10
· Type: cyclic
· Interval: 10ms

AC 500 - HA-CS31 Library Application Example Description 51


After creating task executed periodically each 10ms, the program PLC_PRG must be called
by this task. CM574-RS program cycle time must be equal or less than HA Task cycle time
in CPU.

Right click on HA_TASK and select Append Program Call.

Call PLC_PRG inside program Call

Note :-

52 AC 500 - HA-CS31 Library Application Example Description


The program which calls the function block HA_C31_DIAG_ON_CM574 must be called
assigned to a cyclic task.
The cycle time of this task must not be more than the cycle time of the HA Task in the CPU
program.

CPU program and configuration should be downloaded to PLC before CM574 Program and
configuration downloading to CM574-RS.

6.8. Download to CM574

CPU Configuration must be downloaded to CPU before CM574 Configuration and Program
download.

Download the configuration and program to CM574 via Ethernet level 2 root driver.

The following figure shows the setting of a gateway channel for connection via the AC500
CPU with the IP address 192.168.3.10 with routing to the CM574-RS plugged into slot 2
(line 2).

The following settings have to be specified:

Address - IP address of the AC500 CPU, in the example: 192.168.3.10

Routing levels - 1

Coupler (Level1) - Line 2

Motorola byteorder - Yes

For more programing access to CM574 refer online help file “Programming Access to the
CM574-RS“.

After downloading the program create a boot project.

6.9. Operation

The functionality of the function blocks HA_CS31_CONTROL, HA_CS31_DIAG and


HA_CS31_DATA_SYNC was already described in chapter 2)

AC 500 - HA-CS31 Library Application Example Description 53


For each remote CS31 line there is a pair of HA_CS31_DIAG_VIA_CM574 on the CPU and
HA_CS31_DIAG_ON_CM574 on the CM574-RS, see also figure in the beginning of this
chapter 3). Each pair is handling the diagnosis of the related CS31 line.

The functionality of the function blocks of HA_CS31_DIAG_ON_CM574 is already


described in chapter 3.

For each remote CS31 line there is a pair HA_CS31_DIAG_ON_CM574 on the CM574-RS,
see also figure in the beginning of this chapter 3. Each pair is handling the diagnosis of the
related CS31 line.

Below is the HA over view visualization.

1. Shows the PLC status as “PRIMARY“ or “SECONDARY“.


2. Shows PLC IP address.
3. Shows HA_CS31_CONTROL FB error code.
4. Acknowledge change over button.
5. Shows PLC RUN status. Green when running, Red when stopped.
6. Green square surrounding to PLC shows, to which PLC desktop is connected and
online.
7. Shows UDP data exchange Ethernet status. Green if there is no error and Red if
there is any error.
8. Manual changeover button, only available in Primary PLC.
9. Shows CM577 if configured.
10. Shows CS31 line status. Green if CS31 line is active, Red if not active.
11. Shows CS31 line number.
12. Shows active slaves in that particular CS31 line.
13. Shows configured slaves in that particular CS31 line.
14. Shows error related to that particular CS31 line.
15. Shows MIX wire error. White if there is no error, Red if there is MIX wire error.

Note: - HA visualization can be used only for the monitoring purpose. Customer can view
only the logged in PLC information using visualization. User can use Digivis and OPC
server for read and write data to HA System. For more information about the OPC
configuration please refer chapter 6.

54 AC 500 - HA-CS31 Library Application Example Description


7. Sample OPC Server configuration for High Availability
7.1. Requirements

The OPC server V3 and the AEConfigurator must be installed from the PS501 installation
CD. Please refer to the installation description.

Note :- CoDeSys OPC server v2x supports only data access.

Note: The OPC server can generally also be registered as service. This must not be
accomplished in the context of a DigiVis 500 installation since the OPC tunnel itself starts
the OPC server automatically.

7.2. Configure user account for OPC Server

By default the OPC Server (WinCoDeSysOPC.exe) runs in the same user account of the
process that launched the OPC Server. Depending on the user account this could lead to
unpredictable behavior. Thus it is required to configure the user account for the OPC
server. These instructions apply to Windows XP with at least SP 2 and Windows 7installed
and those systems where only OPC clients that are installed on the same machine connect
to the OPC server. Remote access via DCOM would require additional configuration that is
not described here.

Considerations for choosing the user account:

· The user account does not need administrative rights.


· If possible it is a good practice to use the same user account of the user who is usually
logged in and starts CoDeSys (if CoDeSys is running on the same machine).
· If company password policies require an expiration of passwords for interactive user, a
user account should be created that does not allow interactive login and has password
that never expires.

The procedure to configure the user account has to be repeated every time after:

· The OPC server was reinstalled


· The OPC server was registered by using the command “WinCoDeSysOPC.exe
/RegServer” even if the displayed settings are the same.

To configure the user account performs the following procedure as user that is member of
the “Administrators” group:

1. Make sure that the OPC server is not running. If DigiVis500 is installed the OPC Tunnel
service needs to be stopped (via Control panel -> Administrative Tools -> Services).
Use the task manager to verify that there is no process “WinCoDeSysOPC.exe” when
the option “Show processes from all users” is selected.
2. Start “Component Services” by calling “dcomcnfg” from the command prompt or from
“Start ‚ Run”. If Component Services are already running restart them after the OPC
server was installed and registered.

AC 500 - HA-CS31 Library Application Example Description 55


3. Select at first the node “Component Services” below “Console Root” and then expand
the nodes “Computers” ‚ “My Computer” ‚ “DCOM Config” by clicking on the “+” sign of
each node.
4. Select the node “CoDeSysOPCDA”, press the right mouse button and choose
“Properties” from the context menu.

5. Select for “Authentication Level” the value “None” in the tab page “General”.
6. Open the tab page “Identity”

56 AC 500 - HA-CS31 Library Application Example Description


7. Select “This user”.
8. Enter the name of the desired user account in the field “User”.
9. Enter the password of this user in the fields “Password” and “Confirm password”.
10. Press “OK”. The dialog checks that the password is valid and displays an error
message if the password is wrong.

Note:

If the desired user is already entered select the option “The interactive user”, press “Apply”
and continue with step 6. Otherwise it could happen that the displayed settings are not
really used.

7.3. Default folder and contents

7.3.1. Win7 64Bit , Windows Server 64Bit


OPC Server V2 Win7 64Bit, Windows Server 2008 64Bit
CoDeSysOPC.exe c:\Program Files (x86)\3S Software\CoDeSysOPC\
OPCConfig.exe
OPCConfig_e.exe
OPC_20_how_to_use_D.pdf
OPC_20_how_to_use_E.pdf
CoDeSysOPC.ini c:\ProgramData\CoDeSysOPCV2.3
OPCServer.log
Symbol file *.SDB, *.SYM Automation Builder open, after Project build or rebuild all: in
the project folder
Symbol file *.SDB after login in AC500: c:\ProgramData\Gateway Files\
after start CoDeSys OPC Server c:\ProgramData\Gateway
Files\Upload\
Gateway.exe c:\Windows\SysWOW64\Gateway.exe
OPC Server V3 Win7 64Bit, Windows Server 2008 64Bit
WinCoDeSysOPC.exe c:\Program Files (x86)\3S CoDeSys\CoDeSys OPC Server 3\
OPCConfig.exe
AEConfiguration.exe
CoDeSys_OPC_Server_V3_User_Guide.
pdf
CoDeSys_OPC_Server_V3_Benutzerhan

AC 500 - HA-CS31 Library Application Example Description 57


dbuch.pdf
AeConfigurator_UserGuide.pdf
OPCServer.ini c:\ProgramData\CoDeSysOPC\
OPCServerA.ini
OPCServer.log
Symbol file *.SDB, *.SYM Automation Builder open, after Project build or rebuild all: in
the project folder
Symbol file *.SDB after login in AC500: c:\ProgramData\Gateway Files\
after start CoDeSys OPC Server c:\ProgramData\Gateway
Files\Upload\
Gateway.exe c:\Windows\SysWOW64\Gateway.exe

7.3.2. Win7 32Bit , Windows Server 2008 32Bit


Win7 32Bit, Windows Server 2008 32Bit
OPC Server V2
CoDeSysOPC.exe c:\Program Files\3S Software\CoDeSysOPC\
OPCConfig.exe
OPCConfig_e.exe
OPC_20_how_to_use_D.pdf
OPC_20_how_to_use_E.pdf
CoDeSysOPC.ini c:\ProgramData\CoDeSysOPCV2.3
OPCServer.log
Symbol file *.SDB, *.SYM Automation Builder open, after Project build or rebuild all: in
the project folder
Symbol file *.SDB after login in AC500: c:\ProgramData\Gateway Files\
after start CoDeSys OPC Server c:\ProgramData\Gateway
Files\Upload\
Gateway.exe c:\Windows\System32\Gateway.exe

OPC Server V3 Win7 32Bit, Windows Server 2008 32Bit


WinCoDeSysOPC.exe c:\Program Files\3S CoDeSys\CoDeSys OPC Server 3\
OPCConfig.exe
AEConfiguration.exe
CoDeSys_OPC_Server_V3_User_Guide.
pdf
CoDeSys_OPC_Server_V3_Benutzerhan
dbuch.pdf
AeConfigurator_UserGuide.pdf
OPCServer.ini c:\ProgramData\CoDeSysOPC\
OPCServerA.ini
OPCServer.log
Symbol file *.SDB, *.SYM Automation Builder open, after Project build or rebuild all: in
the project folder
Symbol file *.SDB after login in AC500: c:\ProgramData\Gateway Files\
after start CoDeSys OPC Server c:\ProgramData\Gateway
Files\Upload\
Gateway.exe c:\Windows\System32\Gateway.exe

7.3.3. WinXP 32Bit , Windows Server 2003 32Bit


OPC Server V2 Win7 32Bit, Windows Server 2003 32Bit
CoDeSysOPC.exe c:\Program Files\3S Software\CoDeSysOPC\
OPCConfig.exe
OPCConfig_e.exe
OPC_20_how_to_use_D.pdf
OPC_20_how_to_use_E.pdf
CoDeSysOPC.ini
OPCServer.log
Symbol file *.SDB, *.SYM Automation Builder open, after Project build or rebuild all: in
the project folder
Symbol file *.SDB after login in AC500: c:\WINDOWS\Gateway Files\
after start CoDeSys OPC Server c:\WINDOWS\Gateway
Files\Upload\

58 AC 500 - HA-CS31 Library Application Example Description


Gateway.exe c:\Windows\System32\Gateway.exe

OPC Server V3 Win7 32Bit, Windows Server 2008 32Bit


WinCoDeSysOPC.exe c:\Program Files\3S CoDeSys\CoDeSys OPC Server 3\
OPCConfig.exe
AEConfiguration.exe
CoDeSys_OPC_Server_V3_User_Guide.
pdf
CoDeSys_OPC_Server_V3_Benutzerhan
dbuch.pdf
AeConfigurator_UserGuide.pdf
OPCServer.ini
OPCServerA.ini
OPCServer.log
Symbol file *.SDB, *.SYM Automation Builder open, after Project build or rebuild all: in
the project folder
Symbol file *.SDB after login in AC500: c:\WINDOWS\Gateway Files\
after start CoDeSys OPC Server c:\WINDOWS\Gateway
Files\Upload\
Gateway.exe c:\Windows\System32\Gateway.exe

If you can not find the folder


c:\ProgramData\
you have to set the
Control Panel\All Control Panel
Items\Folder Option to
“Show hidden files, folders and
drives”.

7.4. Opening sample file

One sample files are present in this folder:

• Example_AC500_HA_CS31_V242.project.This files show the base of a HA program in


which the main program is developed in ST language.

AC 500 - HA-CS31 Library Application Example Description 59


Information: All application program related steps presented in this document have already
been performed with the program sample.

7.5. Usage of the CoDeSys OPC Server

After the installation of the OPC Server it should be offered for selection by the OPC client
(e.g. visualization). The name of the OPC Server is CoDeSys.OPC.DA The name of the
Alarms and Events OPC Server is CoDeSys.OPC.AE The OPC Server will be started
automatically by the operating system as soon as a client establishes a connection. The
OPC Server then will terminate automatically as soon as all clients have closed their
connections to the server. There will be no OPC Server icon in the task bar, but it will be
only handled in the Windows Task Manager as a process.

Note: If DigiVis500 is used as OPC client the OPC server remains active (due to the OPC
tunnel) even if all DigiVis clients have been shut down. To stop the OPC server (e.g. after
reconfiguration) the OPC tunnel must be used. It offers a restart of the OPC server from the
tray menu (see DigiVis500 documentation). Unless the service of the OPC tunnel is not
stopped the OPC server will always be restarted after termination.

7.6. Configure and download symbol file

Symbol includes the items (variables) which exchanges with PLC, this is needed for OPC
communication. After build the project, two symbol files will be generated under the project
(.pro) folder. One is .sdb, another is .sym.

File .sdb is a binary file and is needed by OPC server indeed. File .sym has the same
content but in text, which can be understood by human. It can be used to check if it is
generated correctly.

Please refer to REF5 Online help for how to configure CoDeSys for
symbol file.

Note

60 AC 500 - HA-CS31 Library Application Example Description


Start of the Symbol configuration with Project, Options, checkbox "Dump symbol entries"
must be enabled, Configure symbol file …

Sometimes the symbol file looks different than really configured, e.g. more
symbols than expected. In such case please follow the steps to create a
clean symbol file:
TIP

Go to Projectà Optionsà Symbol configurationà Configure symbol file…

Uncheck all the options in Symbol file configuration, and confirm with OK
and OK again (2 times OK).

AC 500 - HA-CS31 Library Application Example Description 61


Go to Projectà Optionsà Symbol configurationà Configure symbol file…
again, first choose the variables which should be communicated as symbol:

Then check the following options:

62 AC 500 - HA-CS31 Library Application Example Description


Confirm it with two times OK again and you can rebuild the project.

Following option can be chosen to download the .sdb file also to PLC.

When OPC server is started, the .sdb file will be copied from PLC (if available) or from
Gateway folder to “C:\WINNT\Gateway Files\Upload” for Gateway communication.

AC 500 - HA-CS31 Library Application Example Description 63


Do not configure the program as a cyclic program, please use a task
configuration. Call the PLC Browser and have a look to the task time
(command “tsk in the command line). For example the program has a cycle
Note time of 40ms, use a task time of 50 or 60ms. So the CPU has time to
answer the OPC request from the OPC Server between the tasks.

7.7. Configure OPC data access

With the OPC data access configuration it is determined which controllers shall
communicate via OPC. For this, the gateway channel must be determined, the project
name must be entered and the individual parameters (e.g. transmission rate, timeout
values, etc.) must be defined.

Note: The OPC configuration must be saved as <OPCServer.ini>at the OPC server
execution directory.

Note: Each change of the OPC configuration will only come to action if the OPC server is
restarted after saving the configuration as <OPCServer.ini>at the OPC server execution
directory.

7.7.1. Settings for the OPC Server

To start the configuration start the application ‘OPCConfig.exe’ from the installation
directory.

Following parameters can be selected:

Update Rate (default 200 ms):

Basic Update Rate of the OPC-Server in milliseconds. This is the cycle time according to
which all item data are read from the PLC. The Update Rate should match to the client
Update Rate (means to be smaller). The given update rate is the fastest cycle in which the

64 AC 500 - HA-CS31 Library Application Example Description


OPC server updates the variables from all PLC’s. If the number of items is to large for the
cycle then it will need as long as required.

Ø for the example selected: 200ms

Public Groups (default not activated):

The OPC server creates a Public Group for each IEC function block and also for the global
variables.

Ø for the example selected: set deactive

Sync Init (default activated):

Synchronized initialization: The OPC server reacts at start only if the symbol configuration
was loaded before.

Ø for the example selected: set active

Log Events (default not activated):

If this function is activated, the actions and occurred errors of the OPC server are logged
and stored in a log file. The file is created in the project directory and given the name
OPCServer.log. The messages of several OPC sessions are assembled in the same log
file.

Ø for the example selected: set active

7.7.2. Settings for the PLC

To configure a specific PLC select “Append PLC” via the “Edit” menue:

AC 500 - HA-CS31 Library Application Example Description 65


The inserted PLC will be presented in the left window. The configuration will be done at the
PLC node and the underlying Connection node.

The following parameters can be selected for the PLC configuration:

Interface (default ARTI):

Name of the interface used for the communication between programming system and PLC.

Ø for the example selected: GATEWAY

Project name (default empty):

Name of the currently concerned and loaded CoDeSys project.

Note: If the OPC server is communicating via the same Gateway channel over which the
program has been sent to the PLC, then no project name must be given. If another
Gateway channel is used for the OPC server, then the project name must be given in this
place. A project name must also be provided for Offline configuration (PLC not connected).

Caution: It is important that the individual OPC projects get different project names for
Single PLC’s. For a HA PLC pair the same project is downloaded to both HA PLC’s.

Timeout (ms, default: 10000):

If within this period of time the OPC server does not receive any feedback on a sent
request from the PLC, it will consider the request as failed.

Ø for the example selected: 10000ms

Number of Tries (default: 3):

Number of attempts of the OPC server to send a request in case a timeout occurred. The
original request is included in this number, if the value is 3 then the OPC server will retry for
2 times before the connection is considered as broken. Thus the Timeout multiplied by the

66 AC 500 - HA-CS31 Library Application Example Description


Number of Tries indicates the time until a connection failure is detected and reported to the
client. With this example configuration this time is 30000 ms (Timeout (ms) * Number of
Tries).

Ø for the example selected: 3

Buffer Size (bytes, default: 0):

Size of the communication buffer on the target system. For all AC500 PLC’s, a buffer size <
5000 must be entered.

Ø for the example selected: 4800 bytes

Wait Time (s, default: 10):

Time in seconds, which the OPC server waits for readyness of the individual PLC (
important with autostart of the control system). After the start of the OPC server it is tried to
establish communication with the configured controllers. Then it sends a message to the
client whether a communication exists or not. Within the waiting time, the controllers have
the possibility to register before the status is passed on to the client.

Note: This time must be chosen long enough so that all participants can register. If this
time is set too short, then it can happen that some participants are not registered at the
start. In this case the time should be increased.

The time depends on the number of participants and also on the items defined in the
symbol file.

Note: If the CoDeSys project should be changed and new items be added in the symbol
configuration, then it can happen that the previously set parameters are not correct any
more. In this case the parameters must be adapted (i.e. increasing the waiting time).

Ø for the example selected: 10s

Reconnect Time (s, default: 15):

Time interval between two tries in which the OPC server attempts to reconnect the
connection to the control system via the gateway after a communication interruption had
occurred.

Ø for the example selected: 15s

Note:

The longest configured Reconnect Time of all PLC’s defines the reconnection time for all
PLC’s.

Active (default: activated):

This parameter should be activated with a hooklet. If it is deactivated, communication is not


possible with the corresponding participant. With extensive configurations and using this
parameter, it is possible to select with which participant shall be communicated (e.g. for
putting participants into operation step-by-step or switching them off in case of errors).

AC 500 - HA-CS31 Library Application Example Description 67


Ø for the example selected: set active

Motorola Byteorder (default: not activated):

Selection whether the target system of the project does use the Motorola byte order.

Note:

With all AC500 control systems, this function is active. With all AC31 control systems, this
function is not active.

Ø for the example selected: set active

No Login-Service (default not activated): This option must be deactivated with such
target system, where it is necessary to send a login service.

Note:

With all AC500 control systems, no login service must be sent. This function must be
active.

Ø for the example selected: set active

Enable logging (default activated):

If this function is activated, the actions and occurred errors of the OPC server regarding the
selected PLC are logged and stored in the log file. To activate the logging for one PLC the
general “Log Events” setting must be activated within the previous parameter dialog.

Ø for the example selected: set active

Log additional Events (default not activated):

Additional logging information for service personal purpose can be activated by this
parameter.

Ø for the example selected: set deactive

Add Debug Events (default not activated):

Additional more detailed logging information for service personal purpose can be activated
by this parameter. Í for the example selected: set deactive

7.7.3. Settings for the connection to the PLC

If the entry 'Connection' is selected, the settings for the connection to the PLC can be
defined in the right part of the window.

68 AC 500 - HA-CS31 Library Application Example Description


If no settings are entered yet or if settings are to be modified, the dialog 'Communication
Parameters' can be opened from the menu 'Edit'. This is equal with the available settings
of the gateway in the CoDeSys programming software under <Online><Communication
Parameters>.

By pressing the ‘Gateway’ Button the gateway channel over which the OPC server
communicates with the PLC can be selected.

At first, it is selected, whether it should be communicated via a local or a TCP/IP gateway


channel.

AC 500 - HA-CS31 Library Application Example Description 69


The Gateway connection can be set to local or TCP/IP. A local connection can be used, if
the OPC server and the used gateway reside on the same computer. A TCP/IP connection
must be used, if the gateway of another computer is accessed by the OPC server via a
network and TCP/IP can also be used if the OPC server and the used gateway reside on
the same computer.

If TCP/IP is selected the ‘Address’ can be selected between “localhost” and an IP address
of the computer where the Gateway is running.

70 AC 500 - HA-CS31 Library Application Example Description


The ‘Port’ for the Gateway must have the value 1210.

Note:

The connection setting “local” is only working if the OPC user is the same as the interactive
user (refer to DCOM configuration settings as in chapter 3.

Ø It is recommended to use “Tcp/Ip” as connection setting.

Note:

It must be ensured that the required Gateway ports (1210) is not occupied by a different
process. Otherwise the Gateway communication cannot be established.

Possible applications that also use port 1210 are:

- Java update client


- ABB 800xA System

Ø If there are problems to establish Gateway communication check the usage of ports
1210 and 1211 (via any port scanning tool, e.g. SysInternals or portscanner)

The communication parameters of the PLC’s already configured within CoDeSys are
presented if a PLC is selected.

Note:

The configuration steps of a PLC described in chapter “Settings for the PLC” and chapter
“Settings for the connection to the PLC” must be repeated for each PLC the OPC server
shall have access to.

Ø In this example the settings for the two HA PLC’s must be configured.

7.7.4. Configuration of a Redundant PLC

AC 500 - HA-CS31 Library Application Example Description 71


To define a HA PLC pair a ‘Redundancy Group’ can be appended via the ‘Edit’ menu.

Selecting the newly created Redundancy item in the tree list will open a new dialog where it
can be defined which two of the presented PLC’s shall be combined as one HA PLC pair.

This is done by selecting the relevant two PLC’s (one by one) and switching them to the
right window by pressing “ >> “.

After the PLC’s are presented in the right window the both individual PLC’s have to be
selected and the ‘Master Variable’ must be set for both PLC’s to the value
<.fG_HA_PRIMARY>.

This variable is defined in the HA library Global Variables within CoDeSys and is used by
the OPC Server to identify which PLC is the Primary.

The ‘LifeCounter Variable’ must only be set once to the value <.dwG_HA_ServerAlive>.

72 AC 500 - HA-CS31 Library Application Example Description


!! Caution:

The ‘Master Variable’ must be set for both PLC’sto the value <.fG_HA_PRIMARY>.

The ‘LifeCounter Variable’ must be set to the value <.dwG_HA_ServerAlive>.

If one setting is missing or misspelled (case sensitive) the OPC server will not work
properly.

Additionally the ‘Default PLC’ must be selected.

This is those PLC of the HA pair which the OPC server will take for client data exchange if
no Primary is indicated by the PLC’s (error state).

Note:

The OPC server exchanges the subscribed read and write data with the PLC’s in the
following way, depending on the availability (network connection) of the Primary (PRIM)
and Secondary (SEC) PLC’s:

PRIM and SEC available: Read from PRIM, Write to PRIM and SEC

Only PRIM available: Read from PRIM, Write to PRIM

Only SEC available: Read from SEC, Write not allowedèWRITE ERROR

7.8. Configure OPC alarms

The OPC server supports the OPC Alarms and events specification (AE interface).

AC 500 - HA-CS31 Library Application Example Description 73


By this the OPC server is able to provide alarms to an OPC client (as DigiVis 500) which
also supports the AE interface.

The alarms are generated by the OPC server itself which means that also the time stamps
of the messages are provided by the OPC server.

For the determination of alarms the OPC server monitors specific OPC items and compares
the values with configured alarm conditions. If the alarm condition is given the OPC server
reports this with an alarm message to the client.

Note:

As for the data access the OPC server takes the values from the Primary PLC also for
alarm determination.

If no Primary PLC is available the defined ‘Default PLC’ is taken.

To configure the OPC alarm conditions the AEConfigurator tool will be used.

With the AEConfigurator limit and digital alarms can be defined and assigned to OPC items
from the PLC’s.

The AEConfigurator will be started with the execution of the application


<AEConfiguration.exe> from the

AEConfigurator installation directory.

The following window appears:

It is separated into the configuration part and below to it the error list is located which will
present configuration errors after checking the configuration.

74 AC 500 - HA-CS31 Library Application Example Description


To be able to start a configuration of alarms an ini-File must be opened or a new one must
be created.

A new alarm can be added via context menu in the list view or via the menu with
<Edit><Append Alarm>.

AC 500 - HA-CS31 Library Application Example Description 75


7.8.1. Configuration of Limit Alarms

Limit alarms can be used to monitor analog variables as integer and real types. For the
limit alarm four alarm limits can be defined: Lo, Hi, LoLo, HiHi.

Lo and LoLo limits check against undercut, Hi and HiHi limits check against exceeding,
whereby the alarm is already triggered if the defined limit value is reached.

The configurable ‘Update Rate in Ms’ defines the period in which the OPC server
recalculates the alarm condition again. Typically 500ms is a reasonable value.

Following parameters can be addressed for each limit:

Limit value: Limit which will be taken for comparison with PLC variable value

Severity: OPC severity (1..1000), shall be set according to the OPC clients mapping

Acknowledge required: If set the alarm needs an acknowledge from client before leaving
alarm list

Enabled: Enables the alarm check for specific limit. If not set the limit will not be checked

Message texts: Message text that will be reported to the client if the limit is triggered.

Several languages can be configured.

76 AC 500 - HA-CS31 Library Application Example Description


The ‘Return to normal’ tab offers the possibility to define a message text for the normal
state (none alarm state). It will be sent to the client if the alarm condition is passive after
previous activation.

7.8.2. Configuration of Digital Alarms

Digital alarms can be used to monitor digital variables as Boolean types.

As with the limit alarms the digital alarm offers ‘Update Rate in Ms’, ‘Severity’ and ‘Return
to normal’.

These parameters have the same meaning as for limit alarms.

Different for digital alarms is the alarm trigger condition. Instead of four limit values only one
trigger condition can be set:

Generate Alarm On:

If “true” set then alarm will be triggered if the according boolean variable is “TRUE”

If “false” set then alarm will be triggered if the according boolean variable is “FALSE”

‘Acknowledge required’, ‘Variable enabled’ and ‘Message texts’ have the same
meaning as for limit alarms. (please refer to previous chapter)

AC 500 - HA-CS31 Library Application Example Description 77


7.8.3. Language settings

New languages for message texts can be added by clicking the <A+> field in the menu.
After this a dialog appears to enter the desired language abbreviation.

Note: It is only possible to add new languages if an entry within the <settings.ini> file at
the AEConfigurator installation directory is set:

[addlangbutton]

enable=true

78 AC 500 - HA-CS31 Library Application Example Description


The new language appears additionally in the message text splitter window and it is
possible to enter additional message texts for this language.

The language setting is valid for the whole configuration. After saving the configuration the
new language setting is added to the <settings.ini> file. From then the language will
always be offered while opening the AEConfigurator tool.

If language settings shall not appear the specific language setting needs to be removed
from the <settings.ini> file:

[lang]

0=EN-EN <English>

1=DE-DE <German>

2=FR-FR <French>

The actual message text language that shall be presented by the Client can be selected by
the selection list for ‘Current Language’.

A change of the language will only be activated if the OPC server is restarted after saving
the new setting to <OPCServerA.ini>.

AC 500 - HA-CS31 Library Application Example Description 79


Note:

The OPC alarm configuration must be saved as <OPCServerA.ini>at the OPC server
execution directory.

Note:

Each change of the OPC alarm configuration will only come to action if the OPC server is
restarted after saving the configuration as <OPCServerA.ini>at the OPC server execution
directory.

7.8.4. Check of configuration

The configuration can be checked according correctness. If the configuration check detects
a misconfiguration (e.g. Lo limit greater than Hi limit) an error message will be presented for
each error in the error list of the dialog. Warnings will be presented with yellow indication,
error are presented with red indication.

The check will be activated at opening or close of a configuration or by activating the


<Check>-Button at the tool bar.

80 AC 500 - HA-CS31 Library Application Example Description


The error causing wrong limit configuration can be selected by clicking on the respective
error line. Ultimately the erroneous limit will be addressed.

7.8.5. Connection of alarms with OPC items

Before an alarm is generated out of the alarm configuration the limit and digital alarms need
to be assigned to PLC items (variables or FB pins). Only after this assignment the OPC
server can apply the alarm determination rules on the PLC items.

If a connection exists to the OPC server the variables can directly get from there for the
assignment. Therefor the OPC server needs to be connected. This can be done by
<Rightclicking> the “CoDeSys.OPC.DA” entry in the OPC symbol list:

AC 500 - HA-CS31 Library Application Example Description 81


If OPC server is not available the alarm<->variable mappings can also be given manually
by entering new items into the “Connected Alarm Item” list by clicking the left symbol
above the list.

Then the full OPC item name and the alarm name need to be given. Since this is not so
convenient and also fault-prone the way with connected OPC server is recommended.

After the browsing of the OPC server is completed the list of available OPC items is
presented in a tree structure.

To map an alarm to a PLC variable simply the variable has to be selected within the tree
and additionally the desired alarm definition has to be selected.

82 AC 500 - HA-CS31 Library Application Example Description


The connected alarm will then be added to the “Connected Alarm Item” list.

Only those alarm definitions which fit to the OPC item data type can be assigned to the
OPC items. This means that Digital alarm definitions will only be available for Boolean OPC
items, Limit alarms can be assigned to numeric OPC items.

AC 500 - HA-CS31 Library Application Example Description 83


With the above described proceeding the alarms for the example project were assigned
and are presented within the “Connected Alarm Item” list as in the next picture.

Only those alarms will be handled by the OPC server which are connected. It is possible to
delete connected alarms from the list by selecting the items to be deleted item and pressing
the cross symbol above the “Connected Alarm Item” list.

84 AC 500 - HA-CS31 Library Application Example Description


The information of the alarm connection mappings must also be saved within the as
<OPCServerA.ini>file. Since this connection is also a configuration change the OPC sever
must be started again afterwards.

Note:

The OPC alarm configuration must be saved as <OPCServerA.ini>at the OPC server
execution directory.

Note:

Each change of the OPC alarm configuration will only come to action if the OPC server is
restarted after saving the configuration as <OPCServerA.ini>at the OPC server execution
directory.

Please regard that the no client is connected while the OPC server is restarted by the OPC
tunnel and that also the OPC AE config tool has no connection open to the OPC server.

An open client prevents the OPC server from restarting.

7.8.6. Recommendation for configuration of system alarms

Since the alarm generation is provided by the OPC server itself and not by the PLC’s there
are no predefined system alarms for PLC states (START, STOP, Communication abort, …
) available.

Those alarms can be provided by the CoDeSys application if the relevant PLC state
indicators are mapped to variables which then can be accessed from the OPC server.
Mostly digital alarms will then be mapped to those variables to indicate a binary state (e.g.
PLC stopped).

Please refer to the CoDeSys documentation to identify which means are provided for
getting PLC states.

7.8.6.1. Alarm for “CPU STOP”

The following example shows the configuration of an alarm to notify a stopped CPU.

For this the predefined HA variable <.fG_HA_CPU_STOP>is used to be mapped to a


Digital alarm definition:

AC 500 - HA-CS31 Library Application Example Description 85


7.8.6.2. Alarm for monitoring connection between OPC server and PLC(‘s)

86 AC 500 - HA-CS31 Library Application Example Description


Additionally the OPC server itself provides two items for the communication status of the
OPC<->PLC communication:

<__CommStateOkPLC1>and <__CommStateOKPLC2>: ‘TRUE’ if communication PLC<-


>OPC is OK

For a HA PLC both variables are provided, for a single PLC only <__CommStatePLC1> is
provided.

The following two pictures illustrate the definition and mapping of these alarms:

7.8.6.3. Alarm for detection of missing Primary PLC

AC 500 - HA-CS31 Library Application Example Description 87


As explained above the writing via OPC server to the PLC’s is only possible if at least the
Primary PLC is available.

Since this is not obvious from the DigiVis500 operator console it is recommended to notify
the user about a missing Primary PLC with the configuration of an alarm for this event. This
is possible by monitoring the predefined HA variable <.fG_HA_PRIMARY>. It is true if the
Primary PLC has contact to the OPC server.

The following example illustrates this:

After saving as <OPCServerA.ini> file and restarting the OPC server the connection from
both HA PLC’s to the OPC server is monitored and if e.g. the connection to PLC2 is broken

88 AC 500 - HA-CS31 Library Application Example Description


(__CommStateOKPLC2 == FALSE) the Digital Alarm with the message “Connection abort
PLC2” will be submitted to the alarms and events client (e.g. DigiVis500).

The following picture shows the complete alarm mapping of the example project:

Note : Please refer below link for OPC server Alarm event release note.

http://abblibrary.abb.com/global/scot/scot397.nsf/veritydisplay/1dbdeeda5f253ea8c1257c21
00539d1d/$file/2cdc125027k0201.pdf

AC 500 - HA-CS31 Library Application Example Description 89


8. REVISION HISTORY
Rev. ind. Page (P) Description Date
Chapt. (C) Dept./Init
V1.0 All First Release DEAPR/ 2014-05-07
V1.1 Version and Second release IDC / 2015-03-27
Task
confiuration

90 AC 500 - HA-CS31 Library Application Example Description


AC 500 - HA-CS31 Library Application Example Description 91
Note:
We reserve the right to make technical changes or modify the contents of this document without prior notice. With regard to purchase orders, the agreed
particulars shall prevail. ABB AG does not accept any responsibility whatsoever for potential errors or possible lack of information in this document.
We reserve all rights in this document and in the subject matter and illustrations contained therein. Any reproduction, disclosure to third parties or utilization
of its contents – in whole or in parts – is forbidden without prior written consent of ABB AG.
© Copyright 2014 ABB , All rights reserved

Manual No. 3ADR 023070 M0201

abb
ABB Automation Products GmbH
Wallstadter Str. 59
68526 Ladenburg, Germany
Phone: +49 62 21 701 1444
Fax : +49 62 21 701 1382
E-Mail: [email protected]

www.abb.com/plc

You might also like