Update cookies preferences
Promotic

PmDNP3 - Driver for communication by the DNP3 protocol

This driver serves for communication with devices using the DNP3 protocol. See Communication by the DNP3 protocol.
 
Before using this driver in the PROMOTIC application it is highly recommended to watch "PROMOTIC video tutorial 4 - Communication drivers".

Basic properties of the driver:
- Usage of this driver requires purchase of the PmDNP3 licence. When developing the application in the freeware mode PmFree, or with development environment and while testing it in runtime, this component is always functional.
- The communication is done for Ethernet (PROMOTIC application is client).
- The driver is incorporated into the PROMOTIC system by means of the PmaComm object.
The driver supports the usage of both PmaCommMsg and PmaCommGroup objects. For common case of the data transfer, it is better to use the PmaCommGroup object.
For easy integration of this driver into the application it is handy to use: Preconfigurations in group "DNP3"


Recommended values of the PmaComm object parameters:

Recommended values for the Ethernet-client parameters:
TCP/UDP remote port number20000 (according to the DNP3 standard)
 
See: Wikipedia: A list of TCP and UDP port numbers used by protocols to run network applications.
Ethernet transfer typeTCP (mandatory)
Timeout of one packet transfer [ms]2000
Filter ECHO charsNo
Description and recommended values for the Protocol parameters:
DNP3 address of this applicationDNP3 address of this PROMOTIC application.
The default value is 0.
Keep-Alive Timer [ms]A timeout (in milliseconds) for testing if TCP connection is active.
If nothing is transmitted during this time, then a system message REQUEST_LINK_STATUS is sent to the corresponding DNP3 address (outstation).
The default value is 5000.
Enable time synchronizationIf checked, then after receiving a message from the device, in which the Bit 4: NEED_TIME bit is set, the driver automatically sent a message of the "Time Synchronization" type to this device.

The communication description by means of the PmaCommGroup object

Description of the "ItemId" configurator:
ItemId is the text identifier of the item that is used for addressing the item in the device. The "ItemId" configurator tells the driver how to receive or send the item value.
The text can be either written manually, or it can be assembled in the window opened by the button to the right of the configurator.
Macro expression can be used for input (it is evaluated after the application is launched).
The ItemId identifier may look like for example "dev1.g30.v0.i20.tFlag", where:
dev1 = The item is in the device (device) with address 1.
The devD (=default address) can be entered instead of the number and the device address will be determined according to the "Default device address (outstation)" configurator.
g30 = Group number. See Supported data types.
v0 = Variation number (optional). See Supported data types.
If not set, then it is v0, i.e. the station (outstation) sends the value in the format considered appropriate.
i20 = Item index (optional).
If not set, then it is i0.
tFlag = Type of the item (optional).
If not set, then it is the value of the item.
If it is the tFlag, then it is the Flag of the item.
 
Description of the "PmaCommGroup > Parameters > Special Parameters" configurator:
Default device address (outstation)The device address to communicate with.
The device is often preset to address 1.
Maximum number of objects transferred in one messageThe PmaCommGroup object creates groups of variables, that will be queried in each communication message.
Here you can specify the maximum number of variables in one message.
Maximum number of consecutive spaces between objects in one messageCommunication message that queries variables, can only contain variables of the same type in sequential address order.
The number of unused variables to be transmitted in the message can be specified here.

The communication description by means of the PmaCommMsg object:

List and description of communication messages:
- Read Static Points:
This message is not intended for group types:
- Info (i.e. Group 60 = Class objects).
The message Read Batch of Points is intended for such transmissions.
Message parameters:
Maximum number of read itemsMaximum number of items that can be received at once in the response to this message.
Required number of read items is then specified in the Count variable on the "Data-received" tab.
What to saveSpecifies what will be stored into the "Data-received" tab:
0 = Value (+Quality+Time) -
For one DNP3 item there will be only one variable (ValN) on the "Data-received" tab and the value will be stored in it (in the PmVar.Value property).
If in the message the time or Flag will come with this entry, then the time is stored in the variable into the PmVar.TimeSource property and Flag is recalculated into the PmVar.Quality property.
1 = Value+Flag (+Quality+Time) -
There will be two variables per one DNP3 item.
The first variable (ValN) will store the value (into the PmVar.Value property).
If in the message the time or Flag will come with this entry, then the time is saved into the PmVar.TimeSource property and Flag is recalculated into the PmVar.Quality property.
The second variable (FlagN) stores the Flag value of the DNP3 item.
If this item does not contain the Flag, then the value 0 is stored.
There are following variables on the "Data-sent" tab:
ItemId: (String) The identifier of the first read item.
The form of this identifier is the same as in the PmaCommGroup object, see Description of the "ItemId" configurator.
All other items will be of the same type, but they will follow one another by index.
Count: (Long) Required number of read items.
The value must be less then or equal to value in the "Maximum number of read items" configurator.
There are following variables on the "Data-received" tab:
IntInd: (Long) Internal Indications.
The bits in this value (of the Long type) indicate certain states and error conditions within the outstation.
See The values in the Internal Indications variable.
Val0: (Variant) First read value.
Flag0: (Long) Flag of the first read value.
This variable is present only if in the "What to save" configurator 1 = Value+Flag (+Quality+Time) option is set.
After these variables there are additional variables Val1, Flag1, Val2, Flag2 ... Their number is determined by the value in the "Maximum number of read items" configurator.

- Write Static Points:
This message is intended for writing data from groups of the Static type, i.e. for:
Message parameters:
Maximum number of written itemsMaximum number of items that can be sent at the same time in this message.
Required number of written items is then specified in the Count variable on the "Data-sent" tab.
There are following variables on the "Data-sent" tab:
ItemId: (String) The identifier of the first written item.
The form of this identifier is the same as in the PmaCommGroup object, see Description of the "ItemId" configurator.
All other items will be of the same type, but they will follow one another by index.
Count: (Long) Required number of written items.
The value must be less then or equal to value in the "Maximum number of written items" configurator.
Val0: (Variant) The first value sent.
After these variables are the other variables Val1, Val2 ... Their number is determined by the value in the "Maximum number of written items" configurator.
There are following variables on the "Data-received" tab:
IntInd: (Long) Internal Indications.
The bits in this value (of the Long type) indicate certain states and error conditions within the outstation.
See The values in the Internal Indications variable.
Error: (Long) The message transfer success value.
For a list of values see the pEvent.Error parameter in the PmaCommMsg.onEndOfTransfer event.

- Write Commands:
This message is intended for writing data from groups of the Cmnd type, i.e. for:
Message parameters:
Maximum number of written itemsMaximum number of items that can be sent at the same time in this message.
Required number of written items is then specified in the Count variable on the "Data-sent" tab.
There are following variables on the "Data-sent" tab:
ItemId: (String) The identifier of the first written item.
The form of this identifier is the same as in the PmaCommGroup object, see Description of the "ItemId" configurator.
All other items will be of the same type, but they will follow one another by index.
Count: (Long) Required number of written items.
The value must be less then or equal to value in the "Maximum number of written items" configurator.
Val0: (Variant) The first value sent.
After these variables are the other variables Val1, Val2 ... Their number is determined by the value in the "Maximum number of written items" configurator.
There are following variables on the "Data-received" tab:
IntInd: (Long) Internal Indications.
The bits in this value (of the Long type) indicate certain states and error conditions within the outstation.
See The values in the Internal Indications variable.
Error: (Long) The message transfer success value.
For a list of values see the pEvent.Error parameter in the PmaCommMsg.onEndOfTransfer event.

- Read Batch of Points: This message does not read a specific item from a group but it reads:
- either only changed items in the group
- or all items in a given group (only for g60.v1).
It is therefore not determined in advance which items will be received, how many there will be and even in one reply there can be one item present multiple times (e.g. with a different change).
Therefore in the response (in the Data variable) there is a value of the String type, in which all items are stored in the JSON format.

There are following variables on the "Data-sent" tab:
ItemId: (String) The form of this identifier is similar to in the PmaCommGroup object, see Description of the "ItemId" configurator.
This identifier does not address a specific item, but the entire group. Therefore, this identifier has a simpler form,
e.g. g32.v5 (i.e. a request to receive changes to alarm inputs, v5=floating-point with time). No index is entered here because it is not known in advance which entries have changed.
There are following variables on the "Data-received" tab:
IntInd: (Long) Internal Indications.
The bits in this value (of the Long type) indicate certain states and error conditions within the outstation.
See The values in the Internal Indications variable.
Data: (String) Received values of items.
The data is in the JSON format. The syntax has the following structure:
[
  {"g":2,"v":2,"i":1,"val":0,"f":1,"t":45076.6068058565},
  {"g":2,"v":2,"i":7,"val":0,"f":1,"t":45076.6070141319}
]
It means: 2 items have been received,
- both items are of the g2.v2 type (see Group 2 = Single-bit Binary Input Event),
- index ("i") of the first item is 1, and the second is 7,
- the value of both items ("val") is 0,
- Flag of both items ("f") is 1 (see The Flag values of the DNP3 object) and
- the item change time ("t") is a real number. You can detect the date and time from this number e.g. by the Pm.CreatePmDateObject method.
This text string can be converted to an array by the Pm.JsonParse method and thus get easy access to all values.

- Time Synchronization:
This message sends the current time of the computer to the specified station (performs time synchronization).
If in the protocol parameters the "Enable time synchronization" configurator is set, then the time synchronization is performed automatically. This message is then only necessary for the cases when synchronization needs to be done regardless of whether the station requires synchronization.

There are following variables on the "Data-sent" tab:
DevAddr: (Byte) Device address (station / device / outstation).
There are following variables on the "Data-received" tab:
IntInd: (Long) Internal Indications.
The bits in this value (of the Long type) indicate certain states and error conditions within the outstation.
See The values in the Internal Indications variable.


Supported data types

The DNP3 protocol divides data types into groups (so-called Group), which are specified by their number.
In each group, data can be transmitted in different formats (so-called Variation), which are also designated by their number.
A query for a variable with Variation=0 means that the other side (so-called outstation) will send a response in whatever format it deems appropriate.
 
- Group 1 = Single-bit Binary Input: (Type: Static, read only)
- Variation 1 = g1.v1: Packet format
- Variation 2 = g1.v2: With Flag
 
- Group 2 = Single-bit Binary Input Event: (Type: Event, read only)
- Variation 1 = g2.v1: Without time
- Variation 2 = g2.v2: With absolute time
- Variation 3 = g2.v3: With relative time
 
- Group 3 = Double-bit Binary Input: (Type: Static, read only)
- Variation 1 = g3.v1: Packet format
- Variation 2 = g3.v2: With Flag
 
- Group 4 = Double-bit Binary Input Event: (Type: Event, read only)
- Variation 1 = g4.v1: Without time
- Variation 2 = g4.v2: With absolute time
- Variation 3 = g4.v3: With relative time
 
- Group 10 = Binary Output: (Type: Static, for read and write)
- Variation 1 = g10.v1: Packed format (for read and write)
- Variation 2 = g10.v2: Output status with Flag (read only)
 
- Group 11 = Binary Output Event: (Type: Event, read only)
- Variation 1 = g11.v1: Status without time
- Variation 2 = g11.v2: Status with time
 
- Group 12 = Binary Output Command: (Type: Cmnd, for write only)
- Variation 1 = g12.v1: Control relay output block (CROB)
- Variation 2 = g12.v2: Pattern control block (PCB)
- Variation 3 = g12.v3: Pattern mask
 
- Group 13 = Binary Output Command Event: (Type: Event, read only)
- Variation 1 = g13.v1: Command status without time
- Variation 2 = g13.v2: Command status with time
 
- Group 20 = Counter: (Type: Static, read only)
- Variation 1 = g20.v1: 32-bit with Flag
- Variation 2 = g20.v2: 16-bit with Flag
- Variation 3 = g20.v3: 32-bit with Flag, delta
- Variation 4 = g20.v4: 16-bit with Flag, delta
- Variation 5 = g20.v5: 32-bit without Flag
- Variation 6 = g20.v6: 16-bit without Flag
- Variation 7 = g20.v7: 32-bit without Flag, delta
- Variation 8 = g20.v8: 16-bit without Flag, delta
 
- Group 21 = Frozen Counter: (Type: Static, read only)
- Variation 1 = g21.v1: 32-bit with Flag
- Variation 2 = g21.v2: 16-bit with Flag
- Variation 3 = g21.v3: 32-bit with Flag, delta
- Variation 4 = g21.v4: 16-bit with Flag, delta
- Variation 5 = g21.v5: 32-bit with Flag and time
- Variation 6 = g21.v6: 16-bit with Flag and time
- Variation 7 = g21.v7: 32-bit with Flag and time, delta
- Variation 8 = g21.v8: 16-bit with Flag and time, delta
- Variation 9 = g21.v9: 32-bit without Flag
- Variation 10 = g21.v10: 16-bit without Flag
- Variation 11 = g21.v11: 32-bit without Flag, delta
- Variation 12 = g21.v12: 16-bit without Flag, delta
 
- Group 22 = Counter Event: (Type: Event, read only)
- Variation 1 = g22.v1: 32-bit with Flag
- Variation 2 = g22.v2: 16-bit with Flag
- Variation 3 = g22.v3: 32-bit with Flag, delta
- Variation 4 = g22.v4: 16-bit with Flag, delta
- Variation 5 = g22.v5: 32-bit with Flag and time
- Variation 6 = g22.v6: 16-bit with Flag and time
- Variation 7 = g22.v7: 32-bit with Flag and time, delta
- Variation 8 = g22.v8: 16-bit with Flag and time, delta
 
- Group 23 = Frozen Counter Event: (Type: Event, read only)
- Variation 1 = g23.v1: 32-bit with Flag
- Variation 2 = g23.v2: 16-bit with Flag
- Variation 3 = g23.v3: 32-bit with Flag, delta
- Variation 4 = g23.v4: 16-bit with Flag, delta
- Variation 5 = g23.v5: 32-bit with Flag and time
- Variation 6 = g23.v6: 16-bit with Flag and time
- Variation 7 = g23.v7: 32-bit with Flag and time, delta
- Variation 8 = g23.v8: 16-bit with Flag and time, delta
 
- Group 30 = Analog Input: (Type: Static, read only)
- Variation 1 = g30.v1: 32-bit with Flag
- Variation 2 = g30.v2: 16-bit with Flag
- Variation 3 = g30.v3: 32-bit without Flag
- Variation 4 = g30.v4: 16-bit without Flag
- Variation 5 = g30.v5: Single-precision, floating-point with Flag
- Variation 6 = g30.v6: Double-precision, floating-point with Flag
 
- Group 31 = Frozen Analog Input: (Type: Static, read only)
- Variation 1 = g31.v1: 32-bit with Flag
- Variation 2 = g31.v2: 16-bit with Flag
- Variation 3 = g31.v3: 32-bit with time-of-freeze
- Variation 4 = g31.v4): 16-bit with time-of-freeze
- Variation 5 = g31.v5: 32-bit without Flag
- Variation 6 = g31.v6: 16-bit without Flag
- Variation 7 = g31.v7: Single-precision, floating-point with Flag
- Variation 8 = g31.v8: Double-precision, floating-point with Flag
 
- Group 32 = Analog Input Event: (Type: Event, read only)
- Variation 1 = g32.v1: 32-bit without time
- Variation 2 = g32.v2: 16-bit without time
- Variation 3 = g32.v3: 32-bit with time
- Variation 4 = g32.v4: 16-bit with time
- Variation 5 = g32.v5: Single-precision, floating-point without time
- Variation 6 = g32.v6: Double-precision, floating-point without time
- Variation 7 = g32.v7: Single-precision, floating-point with time
- Variation 8 = g32.v8: Double-precision, floating-point with time
 
- Group 33 = Frozen Analog Input Event: (Type: Event, read only)
- Variation 1 = g33.v1: 32-bit without time
- Variation 2 = g33.v2: 16-bit without time
- Variation 3 = g33.v3: 32-bit with time
- Variation 4 = g33.v4: 16-bit with time
- Variation 5 = g33.v5: Single-precision, floating-point without time
- Variation 6 = g33.v6: Double-precision, floating-point without time
- Variation 7 = g33.v7: Single-precision, floating-point with time
- Variation 8 = g33.v8: Double-precision, floating-point with time
 
- Group 34 = Analog Input Reporting Deadband: (Type: Static, for read and write)
- Variation 1 = g34.v1: 16-bit
- Variation 2 = g34.v2: 32-bit
- Variation 3 = g34.v3: Single-precision, floating-point
 
- Group 40 = Analog Output Status: (Type: Static, read only)
- Variation 1 = g40.v1: 32-bit with Flag
- Variation 2 = g40.v2: 16-bit with Flag
- Variation 3 = g40.v3: Single-precision, floating-point with Flag
- Variation 4 = g40.v4: Double-precision, floating-point with Flag
 
- Group 41 = Analog Output: (Type: Cmnd, for write only)
- Variation 1 = g41.v1: 32-bit
- Variation 2 = g41.v2: 16-bit
- Variation 3 = g41.v3: Single-precision, floating-point
- Variation 4 = g41.v4: Double-precision, floating-point
 
- Group 42 = Analog Output Event: (Type: Event, read only)
- Variation 1 = g42.v1: 32-bit without time
- Variation 2 = g42.v2: 16-bit without time
- Variation 3 = g42.v3: 32-bit with time
- Variation 4 = g42.v4: 16-bit with time
- Variation 5 = g42.v5: Single-precision, floating-point without time
- Variation 6 = g42.v6: Double-precision, floating-point without time
- Variation 7 = g42.v7: Single-precision, floating-point with time
- Variation 8 = g42.v8: Double-precision, floating-point with time
 
- Group 43 = Analog Output Command Event: (Type: Event, read only)
- Variation 1 = g43.v1: 32-bit without time
- Variation 2 = g43.v2: 16-bit without time
- Variation 3 = g43.v3: 32-bit with time
- Variation 4 = g43.v4: 16-bit with time
- Variation 5 = g43.v5: Single-precision, floating-point without time
- Variation 6 = g43.v6: Double-precision, floating-point without time
- Variation 7 = g43.v7: Single-precision, floating-point with time
- Variation 8 = g43.v8: Double-precision, floating-point with time
 
- Group 50 = Time and Date: (Type: Info, for read and write)
- Variation 1 = g50.v1: Absolute time
- Variation 2 = g50.v2: Absolute time and interval
- Variation 3 = g50.v3: Absolute time and last recorded time
- Variation 4 = g50.v4: Indexed absolute time and long interval
 
- Group 51 = Time and Date Common Time-of-Occurence: (Type: Info, read only)
- Variation 1 = g51.v1: Absolute time, synchronized
- Variation 2 = g51.v2: Absolute time, unsynchronized
 
- Group 52 = Time Delay: (Type: Info, read only)
- Variation 1 = g52.v1: Coarse
- Variation 2 = g52.v2: Fine
 
- Group 60 = Class objects: (Type: Info, read only)
- Variation 1 = g60.v1: Class 0 data (Static)
- Variation 2 = g60.v2: Class 1 data (Event)
- Variation 3 = g60.v3: Class 2 data (Event)
- Variation 4 = g60.v4: Class 3 data (Event)
 
- Group 80 = Internal Indications: (Type: Static, for read and write)
- Variation 1 = g80.v1: Packed format

The Flag values of the DNP3 object

Some types of DNP3 objects send in the message along with their value also a Flag (of the Byte type).
This Flag is composed of bits that indicate conditions or attributes of the DNP3 object.
 
Bit 0: ONLINE
The 0 value indicates that the point is inactive, disabled, unavailable, out-of-service etc.
Bit 1: RESTART
The 1 value indicates that the data has not been updated from the field since device restart.
Bit 2: COMM_LOST
The 1 value indicates that there is a communication failure and the object value may be stale.
Bit 3: REMOTE_FORCED
The 1 value indicates, that the data value is overridden in a downstream reporting device.
Bit 4: LOCAL_FORCED
The 1 value indicates that the data value is overriden by the device, that reports this flag.
Bit 5: CHATTER_FILTER
The 1 value indicates that the binary data value is presently changing between states at a sufficiently high enough rate to active a chatter filter.
Bit 5: OVER_RANGE
Only applicable to object groups:
The 1 value indicates that the data object's true value exceeds the valid measurement range of the object.
Bit 6: DISCONTINUITY
Only applicable to object groups:
The 1 value indicates that the reported counter value cannot be compared against a prior value to obtain the correct count difference.
Bit 6: REFERENCE_ERR
The 1 value indicates that the measurement process determined that the object's data value might not have the expected level of accuracy.

The values in the Internal Indications variable

The bits in this value (of the Long type) indicate certain states and error conditions within the outstation.
This value can be read:
- by means of the PmaCommMsg object in messages (the value is always in the IntInd variable): or
- by means of the PmaCommGroup object by reading type "Group 80 = Internal Indications" (i.e. ItemId="g80.v1").


Bit 0: BROADCAST
A broadcast message was received.
Bit 1: CLASS_1_EVENTS
The outstation has unreported Class1 events.
Bit 2: CLASS_2_EVENTS
The outstation has unreported Class2 events.
Bit 3: CLASS_3_EVENTS
The outstation has unreported Class3 events.
Bit 4: NEED_TIME
Time synchronization is required. See the "Enable time synchronization" configurator.
Bit 5: LOCAL_CONTROL
One or more of the outstation's points are in local control mode.
Bit 6: DEVICE_TROUBLE
An abnormal, device-specific condition exists in the outstation.
Bit 7: DEVICE_RESTART
The outstation restarted.

Bit 8: NO_FUNC_CODE_SUPPORT
The outstation does not support this function code.
Bit 9: OBJECT_UNKNOWN
The outstation does not support requested operation for objects in the request.
Bit 10: PARAMETER_ERROR
A parameter error was detected.
Bit 11: EVENT_BUFFER_OVERFLOW
An event buffer overflow condition exists in the outstation, and at least one unconfirmed event was lost.
Bit 12: ALREADY_EXECUTING
The operation requested is already executing.
Bit 13: CONFIG_CORRUPT
The outstation detected corrupt configuration.

History:
Pm9.00.25: Created
PROMOTIC 9.0.31 SCADA system documentation MICROSYS, spol. s r.o.

Send page remarkContact responsible person
© MICROSYS, spol. s r.o.