Applies To:
  • CitectSCADA x.x

Summary:
 How do I send Counter Interrogation commands in IEC870IP driver?

Solution:
 Counter Interrogation functionality is supported by the IEC870IP driver and there are two ways we can achieve this in the driver.

A) Setting the ini parameter in the citect.ini file, by this way we specify that Counter Interrogations are done as a regular poll and cannot be controlled dynamically.
B) Writing 1 to the variable tag with addresses explained in detail below, by this way we can control the interrogations dynamically on demand.

There are four types of Counter Interrogation commands in IEC870-5-104 protocol.

1) No Freeze or Reset - Counter is neither freezed or reset to 0.
2) Freeze without Reset - Counter is freezed and not reset to 0.
3) Freeze with Reset - Counter is freezed and reset to 0.
4) Reset Only - Counter is not freezed but only reset to 0.


INI Parameter:

The ini parameter that is used to control the type of interrogation that takes place as a poll is [IEC870IP] CounterPollType, the default value is 1 and the values for this parameter are 

0 - No freeze or reset
1 - Freeze without reset
2 - Freeze with reset
3 - Reset only

Variable Tags:

If you like to control the Counter Interrogations dynamically and only sent on Demand you can use this method in which you need to create variable tags (Digital Tags) with the following addresses and writing 1 to these variable tags will force a Counter Interrogation of the device.

1) FORCECI - No Freeze and No Reset.

2) COUNTFZ - Freeze and no Reset. 

3) COUNTRS - No Freeze and Reset.

4) COUNTFZRS - Freeze and Reset.


You can use any of the above methods or both the methods to control the type of Counter Interrogation you are sending to the device.

If you like to find out if the correct messages are sent to the device you can enable the driver debug and look for the following messages in syslog.

To enable driver debug you have to set [IEC870IP]Debugstr = * ALL and restart your runtime. Please make sure you rename you old syslog.dat before restarting so that fresh copy is created.

You will see the following messages in syslog

2009/12/11-12:20:57.044 RX: Chan= 0,  Length 16
68 0E 3E 00 12 00 65 01 47 00 03 00 00 00 00 40

So a Typical Counter Interrogation message will look as below:

68 0E 04 00 FE 00 65 01 06 00 01 00 00 00 00 05

(68 to 00 is header, 65 to 05 is Counter Interrogation message). You can search for 65 in the given syslog to find the Counter Interrogation messages.

The last value determines the type of Interrogation command being sent to the device. In the above example we have 05 meaning this is a No Freeze and No Reset command so either they have set the ini parameter [IEC870IP]CounterPollType = 0 or forced a value 1 to FORCECI variable tag. The different values for different commands are given below.

FORCECI		 05
COUNTFZ 45
COUNTFZRS 85
COUNTRS C5

There was an issue in the previous version of IEC870IP driver before IEC870IP_3.00.04.000 in which the Counter Interrogation commands do not work.


Keywords:
 Counter Interrogation, IEC870IP

Attachments