OPCServer:Optimization

From IBHsoftec Wiki English
Jump to: navigation, search

Optimization of the IBH OPC Server V4.x

The IBH OPC server by default tries to optimize variable read/write operations with the PLC. This means, that variables are automatically arranged into blocks. These blocks are then read at once from the PLC. This happens automatically and has no influence on the client application.


If the client adds the variables Flag 2.0 and Flag 23.5 to the OPC server, the server starts reading the Flagbytes 2 to 23 in one block from the PLC, since this is faster than reading every variable separately from the PLC. The reason for this behaviour is how the PLCs communication protocols work.


The optimization into the blocks is organized by operand areas, that are read in separate requests from the PLC. Each reading from areas like inputs, outputs, flags and every datablock will be organized to a block request. Every block sends it´s own request to the PLC.


Example: The following variables I2.0, I23.5, Q2.0, Q23.5, M2.0, M23.5, DB10.DBX2.0, DB10.DBX23.5, DB20.DBX2.0, DB20.DBX23.5 are to be read from the PLC.


The IBH OPC server creates 5 requests for the PLC, each request is read in a block operation. In the sample the areas IB2 - IB23, QB2 - QB23, MB2 - MB23, DB10.DBB2 - DB10.DBB23, DB20.DBB2 - DB20.DBB23 are read, because this is faster than reading the single bits.


The optimization can be taken to absurdity!


Example: Only the variables I2.0, I1023.5, Q2.0, Q1023.5, M2.0, M1023.5, DB10.DBX2.0, DB10.DBX1023.5, DB20.DBX2.0, DB20.DBX1023.5 are to be read.


The IBH OPC server also creates 5 requests to the PLC. Each request, again, is read in block operations. In the sample this would be the areas (blocks) IB2 - IB1023, QB2 - QB1023, MB2 - MB1023, DB10.DBB2 - DB10.DBB1023, DB20.DBB2 - DB20.DBB1023. Now per block approximately 1 kByte unnecessary data will be read. For the client and the function itself, this does not have any influence, but it puts a heavy load on the communication line. This strongly reduces performance, since much more data than required is now read.


In such a case it makes more sense to "collect" the required variables via the PLCs program into one datablock, which is reduced to the minimum. In this case the IBH OPC server reads and writes only the variables of the "interface" DB. If spreading the written values form the "interface" DB to the PLCs operands is also performed by the PLC program, the internal optimization can work up to full optimization and the maximum performace is reached.


The throughput with a S7-IBHLink is approximately 100 ms for a variable block of 150 bytes. For a ethernet module CPx43 the throughput is higher. With serial adaptors like a PC adaptor or with a S5, that work at a speed of 9600 baud, the throughput is lower. As we can see, the communication interface in use also has a significant influence on the performance of the server. These consideration should be taken into account when selecting and arranging the variables.