0% found this document useful (0 votes)
80 views25 pages

AC800M Modbus Interface White Paper

Uploaded by

rubhernandez
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
80 views25 pages

AC800M Modbus Interface White Paper

Uploaded by

rubhernandez
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 25

1 (25)

Doc. no.: JRR0002 en


Rev. ind. 0
Date 10/4/2006 03:34:00
PM
From JRRege
Dept. ATPA Operations
Location Wickliffe
White Paper

AC800M Modbus Interface -- Sample Programs

SUMMARY
This document presents sample Modbus serial interface programs written in Structured Text for
the AC800M. Since the system available for testing has not yet been upgraded to 800xA, the
standalone version of Control Builder M Professional (version 3.2/7, system baseline 2) was
used for this exercise. As the Modbus interface function blocks have not changed in the new
system release, the programs documented here should also work with the 800xA system. While
the programs are specific to the test case, they illustrate the requirements for interfacing
Modbus to the AC800M and serve as models for project-specific Modbus implementations.

CONTENTS

1. TEST ENVIRONMENT.......................................................................................................... 3
2. SOFTWARE DESCRIPTION................................................................................................ 4
3. NOTES.................................................................................................................................. 4
3.1 Addressing................................................................................................................... 4
3.2 Hardware Settings....................................................................................................... 5
3.3 Modbus Read/Write Function Codes...........................................................................5
4. APPLICATION_1 - (CONTROLLER_1.NORMAL)...............................................................6
4.1 Data Types.................................................................................................................. 6
4.1.1 ModbusCoilRead............................................................................................... 6
4.1.2 ModbusCoilSend............................................................................................... 7
4.1.3 ModbusRegisterRead........................................................................................7
4.1.4 ModbusRegisterSend........................................................................................ 9
4.1.5 ModbusRegisterStore........................................................................................9
4.2 Programs................................................................................................................... 13
4.2.1 Main - (Controller_1.Normal)...........................................................................13
4.2.2 ProcessPanelDX - (Controller_1.ProcessPanel)..............................................14
4.2.3 ModbusEmulatorDX - (Controller_1.ModbusEmulator)....................................18
4.2.4 Diagnostics - (Controller_1.Slow)....................................................................19
5. HARDWARE AC 800M...................................................................................................... 21
5.1 0 PM860 / TP830............................................................................................... 21
5.1.1 1 Ethernet................................................................................................ 22
5.1.2 2 Ethernet................................................................................................ 22
5.1.3 3 Com...................................................................................................... 23
5.1.4 4 Com...................................................................................................... 23
5.1.5 11 ModuleBus.......................................................................................... 23
5.2 1 CI853.............................................................................................................. 24
5.2.1 1 Com...................................................................................................... 24
5.2.2 2 Com...................................................................................................... 24

ABB Inc.
2 (25)
Doc. no.: JRR0002 en
Rev. ind. 0
10/4/2006 03:34:00
Date
PM

ABB Inc.
3 (25)
Doc. no.: JRR0002 en
Rev. ind. 0
10/4/2006 03:34:00
Date
PM

FIGURES
Figure 1 – Test Environment........................................................................................................ 3

SUPPORTING DOCUMENTS
1. Application Programming, Strategy and Design, EngineerIT AC800M/C, Version 3.2,
document number 3BSE 028 765 R201 Rev B, November 2002.
2. Communication, Protocols and Design, ControlIT AC800M/C, Version 3.2, document
number 3BSE 028 811 R301, October 2002.

ABB Inc.
4 (25)
Doc. no.: JRR0002 en
Rev. ind. 0
10/4/2006 03:34:00
Date
PM

1. TEST ENVIRONMENT
Figure 1 shows the system used to test the Modbus serial connections to the AC800M.

Figure 1 – Test Environment

On the AC800M, two serial interfaces run simultaneously. A PC running a 3rd-party Modbus
Emulator package is connected to port 1 of a CI853 serial module, and the RS-232 port on a
Process Panel 235 is connected to port 3 of a PM860. This system is also used to test the Data
Exchange capability of the Process Panel, so the Process Panel is connected to an Allen-
Bradley PLC-5 and provides data transfer to the PM860. Configuration tools (ABB Control
Builder M, ABB Process Panel Builder, and A/B RSLogix) reside on a separate PC connected
via Ethernet to the target devices. This PC is used strictly for configuration and troubleshooting.
The PM860 is the master for all Modbus communications.
In operation, the Process Panel reads data from the PLC-5. This data is then transferred to a
Modbus memory area where it is read by the AC800M. The AC800M also reads data from the
Modbus Emulator on the PC. The AC800M manipulates a subset of the data and performs run
time calculations, then writes back to the Process Panel. The Process Panel displays data both
from the PLC-5 and from the AC800M. The user can reset certain run time counters by
manipulating software switches on the Process Panel.

ABB Inc.
5 (25)
Doc. no.: JRR0002 en
Rev. ind. 0
10/4/2006 03:34:00
Date
PM

2. SOFTWARE DESCRIPTION
The AC800M application comprises three programs.
1. Program ModbusEmulatorDX reads 100 integers from input registers in the PC Modbus
Emulator. These integers are stored in global variable EmulatorValues (structure of 100
ints).
2. Program ProcessPanelDX communicates with the Process Panel. The following reads
and writes are performed:
 200 integers are read from holding registers (2 reads of 100 each) and stored in global
variable ModbusRegisterStore (structure of 200 ints).
 64 booleans are read from coils and stored in global variable MBCoilRead (structure of
64 bools).
 12 integers are written to holding registers from global variable MBRegWrite (structure
of 12 ints).
 16 booleans are written to coils from global variable MBCoilWrite (structure of 16 bools).
3. Program Main keeps track of run time and moves data between the input variables and
the output variables.
The programs make use of custom structured data types to read and store data from the various
devices.
Of the Modbus communications programs, ModbusEmulatorDX is very straightforward and is a
good starting point for investigating Modbus operations.
Sections 4 and 5 include the Application and Hardware documentation generated directly from
Control Builder M.

3. NOTES

3.1 Addressing
Standard Modbus addressing is as follows:
 Coils (read/write) start at address 00000.
 Discrete inputs (read only) start at address 10000.
 Input registers (read only) start at address 30000.
 Holding registers (read/write) start at address 40000.
In the AC800M, Modbus addresses are not used directly. Instead, the base addresses for each
data type are encoded in the address string as follows:
 The address string for coils is ‘%QX10#x’, where x is the coil number starting at 0.
‘%QX10#99’ corresponds to coil 100, address 00099.
 The address string for discrete inputs is ‘%IX10#x’, where x is the input number starting
at 0. ‘%IX10#99’ corresponds to discrete input 100, address 10099.

ABB Inc.
6 (25)
Doc. no.: JRR0002 en
Rev. ind. 0
10/4/2006 03:34:00
Date
PM

 The address string for input registers is ‘%IW10#x’, where x is the register number
starting at 0. ‘%IW10#99’ corresponds to input register 100, address 30099.
 The address string for holding registers is ‘%MW10#x’, where x is the register number
starting at 0. ‘%MW10#99’ corresponds to holding register 100, address 40099.
Note that coil, input, and register addressing is device-specific and can start at either 0 or 1 (i.e.,
the first coil can be either coil 0 or coil 1) depending on the device.

3.2 Hardware Settings


The following parameters apply to the serial connection on either a direct AC800M port or on a
CI853 module (when that connection is configured to be Modbus).
 Modbus type (always set to Master)
 Modbus address (always set to 1)
 Poll time (see following paragraph)
 Timeout time (the time in msec for an operation to timeout)
 Number of resends (the number of retries before a connection is taken out of service)
These parameters are fairly self-explanatory with one exception – the “poll time” parameter has
nothing to do with normal data polling. Rather, it is the time between Modbus diagnostic
requests made by the AC800M. Entering a non-zero value for this parameter enables
diagnostics. Be aware that this results in the AC800M sending out a Read Modbus Exceptions
request at the requested frequency (Modbus exceptions are error indicators). This can cause
problems with Modbus devices that do not support Exception requests. Also, if there are any
read/write problems with the Modbus function codes, the exception (error) data is presented in
the Status field. For these reasons, unless there is a specific application need, it appears to be
best to set the poll time parameter to 0, disabling Modbus diagnostics.

3.3 Modbus Read/Write Function Codes


The Modbus read/write function codes are used to both request an operation and to check
whether or not the requested operation has completed. This is controlled via the Request
parameter – “true” queues a new request and “false” checks for completion of a previously
requested operation. One of the goals of the programs shown below was to check maximum
throughput rate (Note that the maximum tested rate was 500 operations/sec; 400 reads and 100
writes. This specific test case is not included in the programs below.) For this reason, upon
completion of a read or write operation, the programs loop back and immediately request
another operation, rather than waiting for the next execution cycle.

ABB Inc.
7 (25)
Doc. no.: JRR0002 en
Rev. ind. 0
10/4/2006 03:34:00
Date
PM

4. APPLICATION_1 - (CONTROLLER_1.NORMAL)

Name Data Type Attributes Initial value I/O address Access Description
Variables
1 CountReadStarts int retain 0
2 CountWriteStarts int retain 0
3 ReadNotDoneCount int retain 0
4 WriteNotDoneCount int retain 0
5 MBRegStore ModbusRegisterStore retain
6 MBCoilRead ModbusCoilRead retain
7 MBRegWrite ModbusRegisterSend retain
8 MBCoilWrite ModbusCoilSend retain
9 EmulatorValues ModbusRegisterRead retain

Table 1. Application - Application_1 (Global variables)

4.1 Data Types

4.1.1 ModbusCoilRead
Name Data Type Attributes Initial value Description
1 Coil1 bool retain
2 Coil2 bool retain
3 Coil3 bool retain
4 Coil4 bool retain
5 Coil5 bool retain
6 Coil6 bool retain
7 Coil7 bool retain
8 Coil8 bool retain
9 Coil9 bool retain
10 Coil10 bool retain
11 Coil11 bool retain
12 Coil12 bool retain
13 Coil13 bool retain
14 Coil14 bool retain
15 Coil15 bool retain
16 Coil16 bool retain
17 Coil17 bool retain
18 Coil18 bool retain
19 Coil19 bool retain
20 Coil20 bool retain
21 Coil21 bool retain
22 Coil22 bool retain
23 Coil23 bool retain
24 Coil24 bool retain
25 Coil25 bool retain
26 Coil26 bool retain
27 Coil27 bool retain
28 Coil28 bool retain
29 Coil29 bool retain
30 Coil30 bool retain
31 Coil31 bool retain
32 Coil32 bool retain
33 Coil33 bool retain
34 Coil34 bool retain
35 Coil35 bool retain
36 Coil36 bool retain
37 Coil37 bool retain
38 Coil38 bool retain
39 Coil39 bool retain
40 Coil40 bool retain

ABB Inc.
8 (25)
Doc. no.: JRR0002 en
Rev. ind. 0
10/4/2006 03:34:00
Date
PM

Name Data Type Attributes Initial value Description


41 Coil41 bool retain
42 Coil42 bool retain
43 Coil43 bool retain
44 Coil44 bool retain
45 Coil45 bool retain
46 Coil46 bool retain
47 Coil47 bool retain
48 Coil48 bool retain
49 Coil49 bool retain
50 Coil50 bool retain
51 Coil51 bool retain
52 Coil52 bool retain
53 Coil53 bool retain
54 Coil54 bool retain
55 Coil55 bool retain
56 Coil56 bool retain
57 Coil57 bool retain
58 Coil58 bool retain
59 Coil59 bool retain
60 Coil60 bool retain
61 Coil61 bool retain
62 Coil62 bool retain
63 Coil63 bool retain
64 Coil64 bool retain

Table 2. Data Type - Application_1:ModbusCoilRead (Components)

4.1.2 ModbusCoilSend
Name Data Type Attributes Initial value Description
1 Coil1 bool retain
2 Coil2 bool retain
3 Coil3 bool retain
4 Coil4 bool retain
5 Coil5 bool retain
6 Coil6 bool retain
7 Coil7 bool retain
8 Coil8 bool retain
9 Coil9 bool retain
10 Coil10 bool retain
11 Coil11 bool retain
12 Coil12 bool retain
13 Coil13 bool retain
14 Coil14 bool retain
15 Coil15 bool retain
16 Coil16 bool retain

Table 3. Data Type - Application_1:ModbusCoilSend (Components)

4.1.3 ModbusRegisterRead
Name Data Type Attributes Initial value Description
1 Reg1 int retain
2 Reg2 int retain
3 Reg3 int retain
4 Reg4 int retain
5 Reg5 int retain
6 Reg6 int retain
7 Reg7 int retain
8 Reg8 int retain
9 Reg9 int retain
10 Reg10 int retain
11 Reg11 int retain
12 Reg12 int retain

ABB Inc.
9 (25)
Doc. no.: JRR0002 en
Rev. ind. 0
10/4/2006 03:34:00
Date
PM

Name Data Type Attributes Initial value Description


13 Reg13 int retain
14 Reg14 int retain
15 Reg15 int retain
16 Reg16 int retain
17 Reg17 int retain
18 Reg18 int retain
19 Reg19 int retain
20 Reg20 int retain
21 Reg21 int retain
22 Reg22 int retain
23 Reg23 int retain
24 Reg24 int retain
25 Reg25 int retain
26 Reg26 int retain
27 Reg27 int retain
28 Reg28 int retain
29 Reg29 int retain
30 Reg30 int retain
31 Reg31 int retain
32 Reg32 int retain
33 Reg33 int retain
34 Reg34 int retain
35 Reg35 int retain
36 Reg36 int retain
37 Reg37 int retain
38 Reg38 int retain
39 Reg39 int retain
40 Reg40 int retain
41 Reg41 int retain
42 Reg42 int retain
43 Reg43 int retain
44 Reg44 int retain
45 Reg45 int retain
46 Reg46 int retain
47 Reg47 int retain
48 Reg48 int retain
49 Reg49 int retain
50 Reg50 int retain
51 Reg51 int retain
52 Reg52 int retain
53 Reg53 int retain
54 Reg54 int retain
55 Reg55 int retain
56 Reg56 int retain
57 Reg57 int retain
58 Reg58 int retain
59 Reg59 int retain
60 Reg60 int retain
61 Reg61 int retain
62 Reg62 int retain
63 Reg63 int retain
64 Reg64 int retain
65 Reg65 int retain
66 Reg66 int retain
67 Reg67 int retain
68 Reg68 int retain
69 Reg69 int retain
70 Reg70 int retain
71 Reg71 int retain
72 Reg72 int retain
73 Reg73 int retain
74 Reg74 int retain
75 Reg75 int retain
76 Reg76 int retain
77 Reg77 int retain
78 Reg78 int retain

ABB Inc.
10 (25)
Doc. no.: JRR0002 en
Rev. ind. 0
10/4/2006 03:34:00
Date
PM

Name Data Type Attributes Initial value Description


79 Reg79 int retain
80 Reg80 int retain
81 Reg81 int retain
82 Reg82 int retain
83 Reg83 int retain
84 Reg84 int retain
85 Reg85 int retain
86 Reg86 int retain
87 Reg87 int retain
88 Reg88 int retain
89 Reg89 int retain
90 Reg90 int retain
91 Reg91 int retain
92 Reg92 int retain
93 Reg93 int retain
94 Reg94 int retain
95 Reg95 int retain
96 Reg96 int retain
97 Reg97 int retain
98 Reg98 int retain
99 Reg99 int retain
100 Reg100 int retain

Table 4. Data Type - Application_1:ModbusRegisterRead (Components)

4.1.4 ModbusRegisterSend
Name Data Type Attributes Initial value Description
1 Reg1 int retain
2 Reg2 int retain
3 Reg3 int retain
4 Reg4 int retain
5 Reg5 int retain
6 Reg6 int retain
7 Reg7 int retain
8 Reg8 int retain
9 Reg9 int retain
10 Reg10 int retain
11 Reg11 int retain
12 Reg12 int retain

Table 5. Data Type - Application_1:ModbusRegisterSend (Components)

4.1.5 ModbusRegisterStore
Name Data Type Attributes Initial value Description
1 Reg1 int retain
2 Reg2 int retain
3 Reg3 int retain
4 Reg4 int retain
5 Reg5 int retain
6 Reg6 int retain
7 Reg7 int retain
8 Reg8 int retain
9 Reg9 int retain
10 Reg10 int retain
11 Reg11 int retain
12 Reg12 int retain
13 Reg13 int retain
14 Reg14 int retain
15 Reg15 int retain
16 Reg16 int retain
17 Reg17 int retain
18 Reg18 int retain

ABB Inc.
11 (25)
Doc. no.: JRR0002 en
Rev. ind. 0
10/4/2006 03:34:00
Date
PM

Name Data Type Attributes Initial value Description


19 Reg19 int retain
20 Reg20 int retain
21 Reg21 int retain
22 Reg22 int retain
23 Reg23 int retain
24 Reg24 int retain
25 Reg25 int retain
26 Reg26 int retain
27 Reg27 int retain
28 Reg28 int retain
29 Reg29 int retain
30 Reg30 int retain
31 Reg31 int retain
32 Reg32 int retain
33 Reg33 int retain
34 Reg34 int retain
35 Reg35 int retain
36 Reg36 int retain
37 Reg37 int retain
38 Reg38 int retain
39 Reg39 int retain
40 Reg40 int retain
41 Reg41 int retain
42 Reg42 int retain
43 Reg43 int retain
44 Reg44 int retain
45 Reg45 int retain
46 Reg46 int retain
47 Reg47 int retain
48 Reg48 int retain
49 Reg49 int retain
50 Reg50 int retain
51 Reg51 int retain
52 Reg52 int retain
53 Reg53 int retain
54 Reg54 int retain
55 Reg55 int retain
56 Reg56 int retain
57 Reg57 int retain
58 Reg58 int retain
59 Reg59 int retain
60 Reg60 int retain
61 Reg61 int retain
62 Reg62 int retain
63 Reg63 int retain
64 Reg64 int retain
65 Reg65 int retain
66 Reg66 int retain
67 Reg67 int retain
68 Reg68 int retain
69 Reg69 int retain
70 Reg70 int retain
71 Reg71 int retain
72 Reg72 int retain
73 Reg73 int retain
74 Reg74 int retain
75 Reg75 int retain
76 Reg76 int retain
77 Reg77 int retain
78 Reg78 int retain
79 Reg79 int retain
80 Reg80 int retain
81 Reg81 int retain
82 Reg82 int retain
83 Reg83 int retain
84 Reg84 int retain

ABB Inc.
12 (25)
Doc. no.: JRR0002 en
Rev. ind. 0
10/4/2006 03:34:00
Date
PM

Name Data Type Attributes Initial value Description


85 Reg85 int retain
86 Reg86 int retain
87 Reg87 int retain
88 Reg88 int retain
89 Reg89 int retain
90 Reg90 int retain
91 Reg91 int retain
92 Reg92 int retain
93 Reg93 int retain
94 Reg94 int retain
95 Reg95 int retain
96 Reg96 int retain
97 Reg97 int retain
98 Reg98 int retain
99 Reg99 int retain
100 Reg100 int retain
101 Reg101 int retain
102 Reg102 int retain
103 Reg103 int retain
104 Reg104 int retain
105 Reg105 int retain
106 Reg106 int retain
107 Reg107 int retain
108 Reg108 int retain
109 Reg109 int retain
110 Reg110 int retain
111 Reg111 int retain
112 Reg112 int retain
113 Reg113 int retain
114 Reg114 int retain
115 Reg115 int retain
116 Reg116 int retain
117 Reg117 int retain
118 Reg118 int retain
119 Reg119 int retain
120 Reg120 int retain
121 Reg121 int retain
122 Reg122 int retain
123 Reg123 int retain
124 Reg124 int retain
125 Reg125 int retain
126 Reg126 int retain
127 Reg127 int retain
128 Reg128 int retain
129 Reg129 int retain
130 Reg130 int retain
131 Reg131 int retain
132 Reg132 int retain
133 Reg133 int retain
134 Reg134 int retain
135 Reg135 int retain
136 Reg136 int retain
137 Reg137 int retain
138 Reg138 int retain
139 Reg139 int retain
140 Reg140 int retain
141 Reg141 int retain
142 Reg142 int retain
143 Reg143 int retain
144 Reg144 int retain
145 Reg145 int retain
146 Reg146 int retain
147 Reg147 int retain
148 Reg148 int retain
149 Reg149 int retain
150 Reg150 int retain

ABB Inc.
13 (25)
Doc. no.: JRR0002 en
Rev. ind. 0
10/4/2006 03:34:00
Date
PM

Name Data Type Attributes Initial value Description


151 Reg151 int retain
152 Reg152 int retain
153 Reg153 int retain
154 Reg154 int retain
155 Reg155 int retain
156 Reg156 int retain
157 Reg157 int retain
158 Reg158 int retain
159 Reg159 int retain
160 Reg160 int retain
161 Reg161 int retain
162 Reg162 int retain
163 Reg163 int retain
164 Reg164 int retain
165 Reg165 int retain
166 Reg166 int retain
167 Reg167 int retain
168 Reg168 int retain
169 Reg169 int retain
170 Reg170 int retain
171 Reg171 int retain
172 Reg172 int retain
173 Reg173 int retain
174 Reg174 int retain
175 Reg175 int retain
176 Reg176 int retain
177 Reg177 int retain
178 Reg178 int retain
179 Reg179 int retain
180 Reg180 int retain
181 Reg181 int retain
182 Reg182 int retain
183 Reg183 int retain
184 Reg184 int retain
185 Reg185 int retain
186 Reg186 int retain
187 Reg187 int retain
188 Reg188 int retain
189 Reg189 int retain
190 Reg190 int retain
191 Reg191 int retain
192 Reg192 int retain
193 Reg193 int retain
194 Reg194 int retain
195 Reg195 int retain
196 Reg196 int retain
197 Reg197 int retain
198 Reg198 int retain
199 Reg199 int retain
200 Reg200 int retain

Table 6. Data Type - Application_1:ModbusRegisterStore (Components)

ABB Inc.
14 (25)
Doc. no.: JRR0002 en
Rev. ind. 0
10/4/2006 03:34:00
Date
PM

4.2 Programs

4.2.1 Main - (Controller_1.Normal)


Name Data Type Attributes Initial value I/O address Access Description
Variables
1 First bool retain true
2 ET Timer retain
3 Enable bool retain true
4 Hold bool retain false
5 TotalSeconds dint retain 0
6 TotalHours dint retain 0
7 Minutes int retain 0

Table 7. Program - Application_1:Main (Variables)

4.2.1.1 Code
if First then
Timer(ET,Enable,Hold);
First := false;
end_if;

TotalSeconds := time_to_dint(TimerElapsed(ET))/1000;
TotalHours := TotalSeconds/3600;
Minutes := dint_to_int(mod(TotalSeconds,3600)/60);

(# Transfer data into the CoilWrite buffer. #)

MBCoilWrite.Coil1 := MBCoilRead.Coil1;
MBCoilWrite.Coil2 := MBCoilRead.Coil2;
MBCoilWrite.Coil3 := MBCoilRead.Coil3;
MBCoilWrite.Coil4 := MBCoilRead.Coil4;
MBCoilWrite.Coil5 := MBCoilRead.Coil16;
MBCoilWrite.Coil6 := MBCoilRead.Coil24;
MBCoilWrite.Coil7 := MBCoilRead.Coil32;
MBCoilWrite.Coil8 := MBCoilRead.Coil33;
MBCoilWrite.Coil9 := MBCoilRead.Coil34;
MBCoilWrite.Coil10 := MBCoilRead.Coil35;
MBCoilWrite.Coil11 := MBCoilRead.Coil48;
MBCoilWrite.Coil12 := MBCoilRead.Coil49;
MBCoilWrite.Coil13 := MBCoilRead.Coil64;

(# If switch 32 on the Process Panel is UP,


reset the following counters. #)

if MBCoilRead.Coil32 = true then


ReadNotDoneCount := 0;
WriteNotDoneCount := 0;

ABB Inc.
15 (25)
Doc. no.: JRR0002 en
Rev. ind. 0
10/4/2006 03:34:00
Date
PM

CountReadStarts := 0;
CountWriteStarts := 0;
end_if;

(# Transfer data in the RegisterWrite buffer. #)

MBRegWrite.Reg1 := MBRegStore.Reg1;
MBRegWrite.Reg2 := MBRegStore.Reg100;
MBRegWrite.Reg3 := MBRegStore.Reg180;
MBRegWrite.Reg4 := MBRegStore.Reg190;
MBRegWrite.Reg5 := MBRegStore.Reg191;
MBRegWrite.Reg6 := EmulatorValues.Reg1;
MBRegWrite.Reg7 := dint_to_int(TotalHours);
MBRegWrite.Reg8 := Minutes;
MBRegWrite.Reg9 := ReadNotDoneCount;
MBRegWrite.Reg10 := WriteNotDoneCount;
MBRegWrite.Reg11 := CountReadStarts;
MBRegWrite.Reg12 := CountWriteStarts;

4.2.2 ProcessPanelDX - (Controller_1.ProcessPanel)


Name Data Type Attributes Initial value I/O address Access Description
Variables
1 ConnectReq bool true
2 Channel string retain '0.3'
3 Partner string retain '2'
4 ConnectValid bool false
5 ConnectError bool
6 ConnectStatus dint 0
7 Id_MB Comm_Channel_MB
8 ReadReq bool true
9 StartAddrMBR string
10 Address1 string retain '%MW10#1'
11 Address2 string retain '%MW10#101'
12 Address3 string retain '%QX10#1'
13 Address5 string retain '%MW10#1001'
14 Address6 string retain '%QX10#101'
15 ReadComplete bool
16 ReadError bool
17 ReadStatus dint
18 MBRegRead ModbusRegisterRead retain
19 WriteReq bool true
20 StartAddrMBW string
21 WriteComplete bool
22 WriteError bool
23 WriteStatus dint 0
24 LoopDone bool
25 ReadCycle bool true
26 WriteCycle bool false
27 FunctionStatus dint
28 Val int
29 ReadNumber dint retain 1
30 WriteNumber dint retain 1
31 ReadIndex dint retain 1
32 StoreIndex dint retain
33 CoilIndex dint retain

ABB Inc.
16 (25)
Doc. no.: JRR0002 en
Rev. ind. 0
10/4/2006 03:34:00
Date
PM

Table 8. Program - Application_1:ProcessPanelDX (Variables)

Name Function Block Type Task Connection Description


1 MBConnect MBConnect
2 MBRead MBRead[1]
3 MBWrite MBWrite[1]

Table 9. Program - Application_1:ProcessPanelDX (Function blocks)

4.2.2.1 Code
(# Connect on startup. Also connect on timeout (status < 0).
The latter is not strictly required, but appears to be more robust
in practice. After a timeout, the Read or Write operation must be
re-initialized by setting the appropriate request flag.
The counters are for diagnostic purposes. #)

if ConnectStatus <> 1 or ReadStatus < 0 or WriteStatus < 0 then


MBConnect( En_C := ConnectReq,
Channel := Channel,
Partner := Partner,
Valid => ConnectValid,
Error => ConnectError,
Status => ConnectStatus,
Id := Id_MB );
if ReadStatus < 0 and ConnectStatus = 1 then
ReadReq := true;
CountReadStarts := CountReadStarts + 1;
end_if;
if WriteStatus < 0 and ConnectStatus = 1 then
WriteReq := true;
CountWriteStarts := CountWriteStarts + 1;
end_if;
end_if;

(# This application makes 2 Read calls of 100 integers each,


1 Read call of 64 booleans, 1 Write call of 12 integers, and
1 Write call of 16 boolens. The 200 Read integers
are stored in a single structured variable, MBRegStore.
Various counters are used for diagnostic purposes. The repeat
loop is used to maximize throughput -- when an operation
completes, the next operation is immediately queued without
having to wait for the next execution cycle. #)

if ConnectStatus = 1 then
repeat
LoopDone := true;
if ReadCycle then

ABB Inc.
17 (25)
Doc. no.: JRR0002 en
Rev. ind. 0
10/4/2006 03:34:00
Date
PM

case ReadNumber of
1 : StartAddrMBR := Address1;
2 : StartAddrMBR := Address2;
3 : StartAddrMBR := Address3;
end_case;
if ReadNumber <= 2 then
MBRead( Req := ReadReq,
Id := Id_MB,
StartAddr := StartAddrMBR,
Ndr => ReadComplete,
Error => ReadError,
Status => ReadStatus,
Rd[1] := MBRegRead );
else
MBRead( Req := ReadReq,
Id := Id_MB,
StartAddr := StartAddrMBR,
Ndr => ReadComplete,
Error => ReadError,
Status => ReadStatus,
Rd[1] := MBCoilRead );
end_if;
if not ReadComplete then
if ReadReq then
ReadReq := false;
else
ReadNotDoneCount := ReadNotDoneCount + 1;
end_if;
else

(# This is where the data just read gets moved


into the Storage structured variable. #)

if ReadNumber <= 2 then


for ReadIndex := 1 to 100 do
GetStructComponent( Struct := MBRegRead,
ComponentIndex := ReadIndex,
ResultStruct := Val,
Status := FunctionStatus );
StoreIndex := (ReadNumber - 1) * 100 + ReadIndex;
PutStructComponent( Struct := MBRegStore,
ComponentIndex := StoreIndex,
InputStruct := Val,
Status := FunctionStatus );
end_for;
end_if;

ABB Inc.
18 (25)
Doc. no.: JRR0002 en
Rev. ind. 0
10/4/2006 03:34:00
Date
PM

(# After the last Read, set up the Write. #)

if ReadNumber = 3 then
ReadNumber := 1;
WriteReq := true;
ReadCycle := false;
WriteCycle := true;
else
ReadNumber := ReadNumber + 1;
ReadReq := true;
LoopDone := false;
end_if;
end_if;
end_if;
if WriteCycle then
case WriteNumber of
1 : StartAddrMBW := Address5;
2 : StartAddrMBW := Address6;
end_case;
if WriteNumber = 1 then
MBWrite( Req := WriteReq,
Id := Id_MB,
StartAddr := StartAddrMBW,
Done => WriteComplete,
Error => WriteError,
Status => WriteStatus,
Sd[1] := MBRegWrite );
else
MBWrite( Req := WriteReq,
Id := Id_MB,
StartAddr := StartAddrMBW,
Done => WriteComplete,
Error => WriteError,
Status => WriteStatus,
Sd[1] := MBCoilWrite );
End_if;
if not WriteComplete then
if WriteReq then
WriteReq := false;
else
WriteNotDoneCount := WriteNotDoneCount + 1;
end_if;
else
LoopDone := false;
if WriteNumber = 2 then
WriteNumber := 1;
ReadReq := true;

ABB Inc.
19 (25)
Doc. no.: JRR0002 en
Rev. ind. 0
10/4/2006 03:34:00
Date
PM

ReadCycle := true;
WriteCycle := false;
else
WriteNumber := WriteNumber + 1;
WriteReq := true;
end_if;
end_if;
end_if;
until LoopDone end_repeat;
end_if;

4.2.3 ModbusEmulatorDX - (Controller_1.ModbusEmulator)


Name Data Type Attributes Initial value I/O address Access Description
Variables
1 ConnectReq bool true
2 Channel string retain '1.1'
3 Partner string retain '3'
4 ConnectValid bool false
5 ConnectError bool
6 ConnectStatus dint 0
7 Id_MB Comm_Channel_MB
8 RdReq bool retain true
9 StartAddr string retain '%IW10#0'
10 Done bool retain
11 RdStatus dint retain
12 RdError bool retain
13 LoopDone bool retain

Table 10. Program - Application_1:ModbusEmulatorDX (Variables)

Name Function Block Type Task Connection Description


1 MBConnect MBConnect
2 MBRead MBRead[1]

Table 11. Program - Application_1:ModbusEmulatorDX (Function blocks)

4.2.3.1 Code
if ConnectStatus <> 1 or RdStatus < 0 then
MBConnect( En_C := ConnectReq,
Channel := Channel,
Partner := Partner,
Valid => ConnectValid,
Error => ConnectError,
Status => ConnectStatus,
Id := Id_MB );
RdReq := true;
end_if;

(# The 'repeat' statement is used to avoid having any cycles where


there are no outstanding operations. When a read completes, go back
and queue up another read. Otherwise, this would not happen until

ABB Inc.
20 (25)
Doc. no.: JRR0002 en
Rev. ind. 0
10/4/2006 03:34:00
Date
PM

the next execution cycle. #)

if ConnectStatus = 1 then
repeat
MBRead( Req := RdReq,
Id := Id_MB,
StartAddr := StartAddr,
Ndr => Done,
Error => RdError,
Status => RdStatus,
Rd[1] := EmulatorValues );
if not Done then
RdReq := false;
LoopDone := true;
else
RdReq := true;
LoopDone := false;
end_if;
until LoopDone end_repeat;
end_if;

4.2.4 Diagnostics - (Controller_1.Slow)


Name Data Type Attributes Initial value I/O address Access Description
Variables
1 DownLoadQuotaExc bool retain
2 DurOfPFAtLastOcc time retain
3 DurOfPFSinceRst time retain
4 NoOfPFAtLastOcc dint retain
5 NoOfPFSinceRst dint retain
6 OccOfLastPF date_and_time retain
7 OccOfRst date_and_time retain
8 QuotaExc bool retain

Table 12. Program - Application_1:Diagnostics (Variables)

Name Function Block Type Task Connection Description


1 PowerFailureInfos PowerFailureInfos
2 SystemDiagnostics SystemDiagnostics
3 SetTime SetDT
4 SetTimeZone SetTimeZoneInfo

Table 13. Program - Application_1:Diagnostics (Function blocks)

4.2.4.1 Diagnostics
(* System support *)

PowerFailureInfos( NoOfPFSinceRst => NoOfPFSinceRst,


DurOfPFSinceRst => DurOfPFSinceRst,
OccOfRst => OccOfRst,
NoOfPFAtLastOcc => NoOfPFAtLastOcc,

ABB Inc.
21 (25)
Doc. no.: JRR0002 en
Rev. ind. 0
10/4/2006 03:34:00
Date
PM

DurOfPFAtLastOcc => DurOfPFAtLastOcc,


OccOfLastPF => OccOfLastPF );

SystemDiagnostics( QuotaExc => QuotaExc,


DownLoadQuotaExc => DownLoadQuotaExc);

SetTime( );

SetTimeZone( );

(* *);

ABB Inc.
22 (25)
Doc. no.: JRR0002 en
Rev. ind. 0
10/4/2006 03:34:00
Date
PM

5. HARDWARE AC 800M

Parameter Value Type Unit Min Max


Copy unconnected channels None enum
Latched hardware state Enabled enum
System alarms on hardware units Enabled enum
Simple events on hardware units Enabled enum
HwStatus update cycle time 1000 dint ms 500 30000

Table 14. Controller_1 (10.127.32.21). AC 800M (Settings)

Channel Name Type Variable I/O description


IW0 AllUnitStatus dint

Table 15. Controller_1. AC 800M (Connections)

5.1 0 PM860 / TP830


Parameter Value Type Unit Min Max
Enable SattBus on TCP/IP false bool
Routing method rnrp enum
Default gateway string
System AE class 9950 dint 1 9999
System AE low severity 920 dint 1 1000
System AE medium severity 930 dint 1 1000
System AE high severity 940 dint 1 1000
System AE critical severity 950 dint 1 1000
System AE fatal severity 960 dint 1 1000
System events to controller log Medium Severity enum
Event queue size 300 dint 10 3000
Max number of event queues 0 dint 0 5
Event subscription queue size 300 dint 200 3000
Max number of subscriptions 1 dint 0 5
Event subscription time out 360 dint min 0 1440
Low level event buffer size 2 dint 2 4000
Ext undeclared event class 2 dint 1 9999
Ext undeclared event severity 200 dint 1 1000
RNRP Default network ID 10.127.32.0 string
RNRP Number of own areas 1 dint 1 4
RNRP Number of remote areas 0 dint 0 8
RNRP Max Lost Messages 3 dint 1 10
RNRP Send Period 1 dint s 1 60
RNRP Max no of hops 3 dint 1 3
Tool Routing Disabled enum
Tool Routing max no of connections 20 dint 5 50
CS CNCP ClockMaster Order No 0 dint 0 10
CS Protocol Type CNCP enum
CS Time Set Enabled True enum
CS Synch Interval 20 dint s 1 240
CS SNTP ServerAddr 1 string
CS SNTP ServerAddr 2 string

Table 16. Controller_1 (10.127.32.21).0 PM860 / TP830 (Settings)

ABB Inc.
23 (25)
Doc. no.: JRR0002 en
Rev. ind. 0
10/4/2006 03:34:00
Date
PM

Channel Name Type Variable I/O description


IW0.0 UnitStatus dint

Table 17. Controller_1.0 PM860 / TP830 (Connections)

5.1.1 1 Ethernet
Parameter Value Type Unit Min Max
IP address 10.127.32.21 string
IP subnet mask 255.255.255.0 string
Network Area 1 dint 0 35
Path Number 0 dint 0 3
Node Number 21 dint 0 500
Network Area Local false bool
Send Period 1 dint s 1 60
Max Lost Messages 3 dint 1 10
Proxy router 10.127.32.5 string
Target address 10.127.32.5 string

Table 18. Controller_1 (10.127.32.21).0.1 Ethernet (Settings)

Channel Name Type Variable I/O description


IW0.1.0 UnitStatus dint

Table 19. Controller_1.0.1 Ethernet (Connections)

5.1.2 2 Ethernet
Parameter Value Type Unit Min Max
IP address 172.16.0.0 string
IP subnet mask 255.255.0.0 string
Network Area 0 dint 0 35
Path Number 0 dint 0 3
Node Number 0 dint 0 500
Network Area Local false bool
Send Period 1 dint s 1 60
Max Lost Messages 3 dint 1 10
Proxy router 0.0.0.0 string
Target address 0.0.0.0 string
Enable Ethernet false bool
channel

Table 20. Controller_1 (10.127.32.21).0.2 Ethernet (Settings)

Channel Name Type Variable I/O description


IW0.2.0 UnitStatus dint

Table 21. Controller_1.0.2 Ethernet (Connections)

ABB Inc.
24 (25)
Doc. no.: JRR0002 en
Rev. ind. 0
10/4/2006 03:34:00
Date
PM

5.1.3 3 Com
Parameter Value Type Unit Min Max
Baudrate 19.2 enum KBIT/S
Parity none enum
Databits 8 enum
Stopbits 1 enum
Flow control None enum
Delay of the RTS-signal 0 dint msec 0 255

Table 22. Controller_1 (10.127.32.21).0.3 Com (Settings)

5.1.3.1 MODBUS
Parameter Value Type Unit Min Max
MODBUS type Master enum
MODBUS address 1 dint 1 247
Poll time 0 dint msec 0 8000
Timeout time 2000 dint msec 500 6000
Number of resends 3 dint 1 6

Table 23. Controller_1 (10.127.32.21).0.3 MODBUS (Settings)

5.1.4 4 Com

5.1.4.1 PPP
Parameter Value Type Unit Min Max
IP address 192.168.255.254 string
IP subnet mask 255.255.255.0 string
Network Area 0 dint 0 35
Path Number 0 dint 0 3
Node Number 0 dint 0 500
Network Area Local false bool
Send Period 5 dint s 1 60
Max Lost Messages 3 dint 1 10
Proxy router 0.0.0.0 string
Target address 0.0.0.0 string
Remote IP address 192.168.255.253 string

Table 24. Controller_1 (10.127.32.21).0.4 PPP (Settings)

Channel Name Type Variable I/O description


IW0.4.0.0 UnitStatus dint

Table 25. Controller_1.0.4 PPP (Connections)

5.1.5 11 ModuleBus
Parameter Value Type Unit Min Max
External power supervision true bool
Scan Cycle Time 0 dint ms 0 100

Table 26. Controller_1 (10.127.32.21).0.11 ModuleBus (Settings)

ABB Inc.
25 (25)
Doc. no.: JRR0002 en
Rev. ind. 0
10/4/2006 03:34:00
Date
PM

5.2 1 CI853
Channel Name Type Variable I/O description
IW1.0 UnitStatus dint

Table 27. Controller_1.1 CI853 (Connections)

5.2.1 1 Com
Parameter Value Type Unit Min Max
Baudrate 19.2 enum KBIT/S
Parity none enum
Databits 8 enum
Stopbits 1 enum
Flow control None enum
Delay of the RTS-signal 0 dint msec 0 255

Table 28. Controller_1 (10.127.32.21).1.1 Com (Settings)

5.2.1.1 MODBUS
Parameter Value Type Unit Min Max
MODBUS type Master enum
MODBUS address 1 dint 1 247
Poll time 0 dint msec 0 8000
Timeout time 2000 dint msec 500 6000
Number of resends 3 dint 1 6

Table 29. Controller_1 (10.127.32.21).1.1 MODBUS (Settings)

5.2.2 2 Com
Parameter Value Type Unit Min Max
Baudrate 19.2 enum KBIT/S
Parity none enum
Databits 8 enum
Stopbits 1 enum
Flow control None enum
Delay of the RTS-signal 0 dint msec 0 255

Table 30. Controller_1 (10.127.32.21).1.2 Com (Settings)

5.2.2.1 MODBUS
Parameter Value Type Unit Min Max
MODBUS type Master enum
MODBUS address 11 dint 1 247
Poll time 0 dint msec 0 8000
Timeout time 4000 dint msec 500 6000
Number of resends 3 dint 1 6

Table 31. Controller_1 (10.127.32.21).1.2 MODBUS (Settings)

ABB Inc.

You might also like