BinaryCounter (FB)¶
FUNCTION_BLOCK FINAL BinaryCounter EXTENDS PointWithFlags
DNP3 datapoint of type (Binary) Counter.
An instance of BinaryCounter does represent an instance of a datapoint of DNP3 object group 20 “counters”, and optionally also a datapoint of DNP3 object group 21 “frozen counters”. This function block ist called BinaryCounter, because the slang term “Binary Counter” is used frequently in DNP3 realm.
DNP3 object group 21 “frozen counters” behaviour¶
In general the DNP3 “freeze” is an activity only relevant for the master, the “frozen” value is not of any interest for the application. Nevertheless DNP3 defines a “freeze-and-clear” operation. The DNP3 standard states - begin of citation … Freeze operations take two forms—freeze and freeze-and-clear. With a freeze-and-clear type operation, the counter value is zeroed after its counts are copied to the frozen counter. … end of citation.
This functionality is optional, and can be disabled setting enableFreezeAndClear:=FALSE. If enabled, there are two aspects to take care of. First: the counter value will be zeroed during a “freeze-and-clear” operation - be aware: the variable value will be modified. Second: eventually the application need to know, that an “freeze-and-clear” operation happend and need to do someting useful. The output freezeAndClearOccurred is set to TRUE for one application cycle, to signal the application to do its part.
- InOut:
Scope
Name
Type
Initial
Comment
Inherited from
Input
DescriptionSTRINGDescription of the datapoint - this is a configuration, changes are ignored after Outstation was enabled.
NumberDINT-1
Point number - this is a configuration, changes are ignored after Outstation was enabled.. The point number can be configured if needed to either:
start with Point number > 0
have gaps in Point numbers
If set to -1 (the default) the OutstationDataModel (more precisely the related “Group”) takes care to set the Point number internally:
starting at 0, if first Point number is not set explicitly.
increment by 1
In case you set Point number explicitly please keep it consistent:
Point numbers need to be >= 0
Point numbers need to be ascending
EventClassUSINTConstants.TMWDEFS_CLASS_MASK_ONE
The initial event class - this is a configuration, changes are ignored after Outstation was enabled. Operational event class may be changed by a master.
EventModePointEventMode.EVENT_MODE_SOE
The event mode - this is a configuration, changes are ignored after Outstation was enabled. Only used if the sampling rate is set within the outstation configuration.
tScanPeriodTIMETIME#0ms
Scan period for datapoint. If tScanPeriod is set to T#0MS, the Group related tScanPeriod or the OutstationDataModel.tScanPeriod is used.
udiLogOptionsUDINTOutstationLoggingOptions.None
LoggingOptions can be combined using OR.
Output
xErrorBOOLAn error occured.
eErrorIDThe specific error.
Input
flagsBYTEConstants.DNPDEFS_DBAS_FLAG_ON_LINE
Flags used by the point. Can be changed in case a point goes offline or any other error. If set to 0, the variation without flags will be used by DNP3
EventWithTimeStampBOOLTRUE
Enable / disable if events will be send with / without timestamp - this is a configuration, changes are ignored after Outstation was enabled.
EnableFreezeBOOLFALSE
Enable / disable freezing the current value - this is a configuration, changes are ignored after Outstation was enabled. If enabled, an instance of DNP3 object group 21 “frozen counters” is created.
FreezeEventClassUSINTConstants.TMWDEFS_CLASS_MASK_ONE
The initial event class used for the optional datapoint of DNP3 object group 21 “frozen counters” - this is a configuration, changes are ignored after Outstation was enabled. Operational event class may be changed by a master.
FreezeEventModePointEventMode.EVENT_MODE_SOE
The event mode used for the optional datapoint of DNP3 object group 21 “frozen counters” - this is a configuration, changes are ignored after Outstation was enabled. Only used if the sampling rate is set within the outstation configuration.
enableFreezeAndClearBOOLTRUE
Enable / disable “freeze-and-clear” operation.
valueThe current value to use, in most cases using the POINTER TO value representation is appropriate.
Output
freezeAndClearOccurredBOOLA freeze-and-clear occured.
Properties:
Methods:
GetDescriptionString, inherited from Point
IdentificationToString, inherited from Point
ToString, inherited from PointWithFlags