The text of a manual · part 14 of 15
CERI Installation and Programming Manual: 9 Virtual PLC Memory, pages 106 to 114
Pages 106 to 114 of 122, from CERI Installation and Programming Manual
The original document is the PDF (1.9 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.
Filed in the catalog under the AEG DEP-210
Page 106
9
Virtual PLC Memory
Overview Many installed Compact PLCs include some type of Modbus serial master such as an HMI (Human Machine Interface) or Distributed Control System (DCS) directly connected to the CPU. The CERI includes an innovative mailbox data system to allow the user to continue to use the old HMI. The CERI provides a virtual PLC memory space to mimic the 0x, 1x, 3x, and 4x memory space of the original PLC. This memory may be accessed from the serial port or through Modbus/TCP Ethernet. Figure 9.1: Old System Compact CPU
Serial HMI St a rt
St o p
Figure 9.1 shows the old system with the HMI connected to the RS-232 port of the Compact PLC. This HMI generates Modbus RTU messages to read/write 0x coils and 4x registers as well as reading 1x bits and 3x registers from the PLC. The new system shown in Figure 9.2 has the HMI connected to the RS-232 port of the CERI. In cases where the old Compact CPU had an RJ45 RS-232 serial port, the same serial cable may be directly plugged into the CERI's RS-232 port. If the old CPU had a 9-pin RS-232 connector, then the Niobrara MM5 is used to adapt that cable to the CERI. The new PLC uses entries in its I/O Scanner to populate the virtual PLC memory in the CERI so the HMI thinks that it is still connected directly to the old Compact PLC. The Modbus slave address used by the CERI for the virtual PLC defaults to the value 200 but is configurable to match the drop number of the old Compact PLC.
CERI Manual
111
Page 107
Figure 9.2: New System Serial HMI NOE
PLC
St a rt
St o p
CERI
N R & D
CERI
Ethernet Switch
Operation The CERI includes several memory spaces that are accessed from the serial port or Ethernet by unique Modbus slave/index addresses. Modbus slave 255 accesses the internal “setup” Holding Registers (4x) for the CERI. Slaves 0 or 1 access the “data” Holding Registers (4x) for the Compact I/O. Slaves 200, 201, and 202 are used by the “virtual plc”. Table 9.1: CERI Modbus Slave/Index Memory Spaces Slave
0x
1x
3x
4x
6x
Description
255
-
-
-
R/W R/W CERI Configuration and Status
0/1
-
-
-
R/W
-
Compact I/O Data
200
R/W
R
R
R/W
-
Virtual PLC Memory
201
-
-
-
R/W
-
Virtual PLC 4x space (Coils aligned with I/O Scanner Coils)
202
-
-
-
R/W
-
Virtual PLC 4x space (Coils aligned with 4x words)
NOTE: Slave 200 may be assigned a different address to match the previous PLC address. The default value is 200 but any address (1-200) is possible. WARNING: Selecting slave address 1 for the virtual PLC memory will cause the controlling I/O Scanner to access the virtual PLC memory data 112 Virtual PLC Memory 9
CERI Manual
Page 108
instead of the Compact I/O data resulting in loss of control and possibly equipment damage and personal injury or death. Modbus slaves 200, 201, and 202 all access the same volatile mailbox memory.
Slave 200 Modbus slave 200 accesses the mailbox data as four separate address spaces. NOTE: Reads and writes to the 0x and 4x registers act on different memory spaces to the HMI will not read back the data it writes unless the PLC has logic to copy the values from the HMI write space to the HMI read space. Table 9.2: CERI Slave 200 memory space sizes Space
Count
Description
0x
1600
Read/Write by HMI
1x
1600
Read Only by HMI
3x
512
Read Only by HMI
4x
512
Read/Write by HMI
Modbus opcodes 1, 2, 3, 4, 5, 6, 15, 16, 23, and 43 (subop 14) are supported on slave 200. Modbus read/writes to coils/registers outside the legal ranges will result in exception 02 replies (Illegal Data Address). NOTE: This data is volatile, and is reset to zero on CERI power-up.
CERI Manual
9 Virtual PLC Memory 113
Page 109
Slave 201 and 202 Modbus slaves 201 and 202 access the slave 200 mailbox data as one 4x address space. The difference between the two slaves is the mapping of the coil/bit data. Table 9.3: CERI Slave 201 and 292 memory space sizes Drop 200 Space
Drop 201/202 Registers
HMI Direction
PLC Direction
0x1 through 0x1600
4x1 through 4x100
Read
Write
0x1 through 0x1600
4x10001 through 4x10100
Write
Read
0x1 through 0x1600
4x20001 through 4x20100
Clears HMI Write Bits on 1>0
Write
0x1 through 0x1600
4x30001 through 4x30100
Sets HMI Write Bits on 0>1
Write
1x1 through 1x1600
4x1001 through 4x1100
Read
Write
3x1 through 3x512
4x3001 through 4x3512
Read
Write
4x1 through 4x512
4x4001 through 4x4512
Read
Write
4x1 through 4x512
4x14001 through 4x14512
Write
Read
4x1 through 4x512
4x24001 through 4x24512
Overwrite HMI Write Data on Change
Write
Modbus opcodes 3, 6, 16, and 23 are supported on slaves 201 and 202. Modbus read/writes to registers outside the supported registers will read a value of zero and writes will be ignored without error. NOTE: This data is volatile, and is reset to zero on CERI power-up. The difference between slave 201 and 202 is how the bits are mapped. Slave 201 is the normal reversed bit mapping used when a Modicon I/O Scanner source is 0x or 1x and the target is 4x. Bit 1 is the Most Significant Bit (MSB) and bit 16 is the LSB. Slave 202 is the direct mapping where bit 1 is the LSB and bit 16 is the MSB. The 0x blocks that start at 4x20001 and 4x30001 are used for the special cases where the PLC needs to clear (or set) a coil that has been written (or cleared) by the HMI. Separate I/O Scanner entries in the controlling PLC write these blocks 114 Virtual PLC Memory 9
CERI Manual
Page 110
continuously. The CERI watches for any bit in the 4x20001 group to change from 1 to 0 and at that point, it zeroes the corresponding bit in the 4x10001 group. The CERI also watches the bits in the 4x30001 group to change from a 0 to 1 and at that point, it sets the corresponding bit in the 4x10001 group to 1. Examples for using these groups are shown in Chapter 9 Virtual PLC Memory. Holding Register block 24001 is used to have the PLC override analog values written by the HMI. The CERI watches the data written to this block by the PLC and when the value of a register changes, the new data is copied into the 14001 block. Table 9.4: CERI Slave 201 and 292 bit mapping 8000 4000 2000 1000 0800 0400 0200 Bit Significance MSB (hex)
0100
0080
0040
0020 0010 0008 0004 0002
0001 LSB
Drop 201 Coil (984LL)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Drop 202 Coil (984LL)
16
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
Drop 201 Coil (IEC)
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Drop 202 Coil (IEC)
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
1X Input Bit Example Figure 9.3 shows a simple example of copying the discrete inputs 1x0001 through 1x00032 from the new Quantum PLC to the virtual PLC memory in the CERI. The HMI may then query the 1x bits from the CERI's virtual PLC memory. The I/O Scanner Entry in the Quantum is a write to index 201. The source for the write is 1x00001 (input bits in the Quantum PLC). The target for the write is Holding Register 4x1001 in the CERI. The length of the write is 2 words. Selecting index 201 allows the CERI to map the 32 bits into index 200 in the same order that they are in the Quantum PLC. The HMI simply does a read of bits 1x0001 through 1x0032 from the CERI using Modbus Slave 200. The mapping from the original bits in the Quantum is preserved.
CERI Manual
9 Virtual PLC Memory 115
Page 111
Figure 9.3: 1x Input Bits to be read by the HMI
N R & D
CERI
Read
Write
Sta rt
Sto p
Drop 200 1x1 1x2 1x3 1x4 ... 1x15 1x16 1x17 1x18 … 1x31 1x32
Drop 201 4x1001 4x1002
I/O Scanner Write
I/O Scanner Write: Index = 201 Local = 1x0001 Remote = 4x1001 Count = 2
1x1 1x2 1x3 1x4 ... 1x15 1x16 1x17 1x18 … 1x31 1x32
Read
1x1 1x2 1x3 1x4 ... 1x15 1x16 1x17 1x18 … 1x31 1x32
HMI Read: Slave = 200 Start = 1x0001 Bit Count = 32
3X Input Registers Example Figure 9.4 shows a simple example of copying the Analog Input Regsiters 3x0001 through 3x0005 from the new Quantum PLC to the virtual PLC memory in the CERI. The HMI may then query the 3x words from the CERI's virtual PLC memory. The I/O Scanner Entry in the Quantum is a write to index 201. The source for the write is 3x0001 (input words in the Quantum PLC). The target for the write is Holding Register 4x3001 in the CERI. The length of the write is 5 words. The HMI simply does a read of words 3x0001 through 3x0005 from the CERI 116 Virtual PLC Memory 9
CERI Manual
Page 112
using Modbus Slave 200. NOTE: 3x and 4x operations are the same for index 201 and 202. The only difference is the bit ordering of the 0x and 1x bits. Figure 9.4: 3x Input Words to be read by the HMI
N R & D
Write
CERI
Read
Drop 201 3x0001 3x0002 3x0003 3x0004 3x0005
Write
4x3001 4x3002 4x3003 4x3004 4x3005
I/O Scanner Write: Index = 201 Local = 3x0001 Remote = 4x3001 Count = 5
Sta rt
Sto p
Drop 200
Same Data
3x0001 3x0002 3x0003 3x0004 3x0005
Read
3x0001 3x0002 3x0003 3x0004 3x0005
HMI Read: Slave = 200 Start = 3x0001 Count = 5
0X Output Coil Example 0X output operation through the virtual PLC mailbox is somewhat more complicated than the 1x input bits. The HMI may read some 0x coils and it may also write other 0x coils. The CERI handles this by splitting the HMI read data into one block of memory and the write data into a separate block. The controlling PLC writes the data that the HMI reads and reads back the data that the HMI writes. It is up to the PLC to merge these two data blocks back together. NOTE: There will be a limited number of coils written by the HMI. The PLC only needs to merge the coils that are possibly modified.
CERI Manual
9 Virtual PLC Memory 117
Page 113
NOTE: The mailbox data is volatile and is zeroed on CERI power-up. Figure 9.7 shows an example of copying the discrete outputs 0x0001 through 0x00048 from the Quantum PLC to the virtual PLC memory in the CERI. The HMI may then query the 0x bits from the CERI's virtual PLC memory. The I/O Scanner Entry in the Quantum is a write to index 201. The source for the write is 0x00001 (output coils in the Quantum PLC). The target for the write is Holding Register 4x0001 in the CERI. The length of the write is 3 words. Selecting index 201 allows the CERI to map the 48 bits into index 200 in the same order that they are in the Quantum PLC. The HMI simply does a read of bits 1x0001 through 1x0032 from the CERI using Modbus Slave 200. The mapping from the original bits in the Quantum is preserved. Writing data from the HMI back to the controlling PLC is handled by the CERI saving the write data into Holding Registers 4x10001 through 4x10100. The PLC then does an I/O Scan read to retrieve any possibly updated data. Figure 9.6 show with this example, the source for this read will be index 201, the remote register is 4x10001, the local register is 0x0161, and the count will be 3 words (48 bits). Local starting coil 0x0161 was chosen to ensure the HMI write data does not corrupt the normal PLC coils 1 through 48. The PLC program will include code to copy the data written by the HMI to the appropriate coil. For example, the HMI sends a write to coil 0x33 in the CERI. The CERI sets register 4x10003 bit 1 (MSB in index 201). The I/O Scanner read places this data into PLC coil 0x193. The segment of LL in Figure 9.5 forces PLC coil 0x33 to match the state of coils 0x193. Figure 9.5: LL section to copy HMI coil to PLC coil
00193
118 Virtual PLC Memory 9
00033
CERI Manual
Page 114
Figure 9.6: 0x Output Bits to be written by the HMI
N R & D
Read
CERI
Write
Sta rt
Sto p
Drop 200 0x161 0x162 0x163 0x164 ... 0x175 0x176 0x177 0x178 … 0x191 0x192 0x193 0x194 … 0x207 0x208
Drop 201
4x10001 4x10002 4x10003
Read Word to Bit
I/O Scanner Read: Index = 201 Local = 0x0161 Remote = 4x10001 Count = 3
Bit to Word
0x1 0x2 0x3 0x4 ... 0x15 0x16 0x17 0x18 … 0x31 0x32 0x33 0x34 … 0x47 0x48
Bit Write
0x1 0x2 0x3 0x4 ... 0x15 0x16 0x17 0x18 … 0x31 0x32 0x33 0x34 … 0x47 0x48
HMI Write: Slave = 200 Start = 0x0001 Bit Count = 48
NOTE: It is up to the PLC program to copy coils written by the HMI back into the area that is read by the HMI. NOTE: The CERI mailbox is zeroed on power-up.
CERI Manual
9 Virtual PLC Memory 119