Applies To:
  • CitectSCADA 5.xx

Summary:
When using Citect's SSEVEN driver with the Siemens S7 PLC and Siemens standard PID library, some values are not displayed correctly. Why?

Solution:
Citect uses a "blocking" approach to reading registers from a PLC to maximise the performance / utilisation of communications links. This approach requires that addresses start on consistent address boundaries within the PLC's memory structure.

As an example of an inconsistent address boundary, the following register setup will not work:

INT
BYTE
INT

As an example of a consistent address boundary, the following register setup will work:

INT
BYTE
BYTE
INT

The use of the Siemens Standard PID library enforces what Citect considers to be 'inconsistent' address boundaries. This means that Citect will report incorrect values for some tags. To avoid this situation, one of the following methods must be used when using the Siemens Standard PID library with Citect:

  1. Disable blocking on the SSEVEN driver.

This will mean that Citect will never create a block that includes more than one tag, and hence will not be affected by inconsistent address boundaries. The effect on performance in this case is severe.

  1. Use PLC code to extract data into consistent blocks.

This method uses PLC code to, for example, put all integers in a contiguous block, all bytes into a separate contiguous block etc., thereby ensuring consistent address boundaries. Citect will read each block of data correctly, and also maintain the performance that the blocking approach allows. Operating with read/write data can be difficult.

  1. Define Words, Reals, and Longs as an array of bytes.

Defining Words, Reals, and Longs as an array of bytes will ensure consistent address boundaries, but will require some conversion in Citect. For example, to display a Word in Citect you would define a word tag as an array of two bytes. i.e.:

Tag name: TAG1
Address: DB1,1[2]
Data type: BYTE

To display the tag, you need to create a function to convert the array of bytes into a word. Use the following as an example of the function:

INT FUNCTION S7ByteToInt( INT tag1 )
    INT tag2 = 0;
    tag2 = tag1[1] + ( 256 * tag1[0] );
    return tag2;
END

Then use the expression S7ByteToInt(TAG1) in any place where you need to display TAG1 as a word.

 

Keywords:
 

Attachments