Skip to content

1) Point: Object Group (group) and Index

DNP3 data points usually consist of several key points:

  • Object Group
  • Variation
  • Index

NG Gateway current version simplifies to:

  • group: Object Group (Enum)
  • index: Index

Common group meanings:

  • BinaryInput: Digital Input
  • DoubleBitBinaryInput: Double Bit Digital Input
  • BinaryOutput: Digital Output Status
  • Counter: Counter
  • FrozenCounter: Frozen Counter
  • AnalogInput: Analog Input
  • AnalogOutput: Analog Output Status
  • OctetString: Octet String

Modeling Suggestion:

  • BinaryInput / DoubleBitBinaryInput: Recommend data_type=Boolean or UInt8 (Per field semantics)
  • AnalogInput: Recommend Float32/Float64 (Configure scale if necessary)
  • Counter / FrozenCounter: Recommend UInt32/UInt64
  • OctetString: Recommend String or Binary

2) DataType and DNP3 Variation Mapping Relationship

2.1 Design Philosophy

In DNP3 protocol, each Object Group has multiple Variations, for example:

GroupVariationMeaning
30132-bit Analog Input With Flag
30216-bit Analog Input With Flag
30332-bit Analog Input Without Flag
305Single-precision (Float32) With Flag
306Double-precision (Float64) With Flag

NG Gateway adopts Simplified Modeling strategy:

  • Read Direction: Use Class Data request, let Outstation decide which Variation to return
  • Write Direction: Implicitly select corresponding Variation via DataType field

Advantages of this design:

  1. Best Compatibility: Different Outstations may support different Variations
  2. User Friendly: No need to deeply understand DNP3 protocol details
  3. Compliant with IEEE 1815 Standard: Class Data is the recommended data request method

2.2 Variation Handling on Read

When NG Gateway executes Integrity Scan or Event Scan:

Master (NG Gateway)                    Outstation
        |                                   |
        |--- READ Class 0/1/2/3 ----------->|
        |    (Group60Var1~4)                |
        |                                   |
        |<-- Response with actual data -----|
        |    (Group30Var1 or Var5 etc.)     |
  • Driver underlying library (dnp3-rs) will unify convert responses of different Variations to standard Rust types
  • For example: Group30Var1, Group30Var5, Group30Var6 are all converted to AnalogInput { value: f64, flags: Flags, time: Option<Time> }
  • Your configured DataType is used for Final Value Conversion (e.g., f64Int32 truncation)

Important

In uplink path, your DataType configuration does not affect request, only affects type conversion of the final value.

2.3 Variation Selection on Write

When writing commands (WritePoint / Action), DataType directly determines which DNP3 Variation to use:

Analog Output Command (AnalogOutputCommand - Group 41)

DataTypeDNP3 VariationDescription
Int16 / UInt16Group41Var216-bit Analog Output
Int32 / UInt32Group41Var132-bit Analog Output
Float32Group41Var3Single-precision Float
Float64Group41Var4Double-precision Float

CROB Command (Control Relay Output Block - Group 12)

CROB always uses Group12Var1:

DataTypeValue ParsingDescription
UInt8 (Recommended)value=u8 (Control Code)Product-level unified semantics: Downlink value only accepts numeric control code; but gateway only allows explicit safe subset (See crob.md)

2.3.1 CROB Control Code Bitfield Semantics

In NG Gateway current implementation, CROB ControlCode is an 8-bit bitfield, composed of:

  • bits 7..6: Trip/Close Code (TCC)
    • 0b00 → Nul
    • 0b01 → Close
    • 0b10 → Trip
    • 0b11 → Reserved (Gateway Rejects)
  • bit 5: clear
  • bit 4: queue (Obsolete in standard, but still representable; support depends on Outstation)
  • bits 3..0: OpType (Operation Type)
    • 1 → PulseOn
    • 2 → PulseOff
    • 3 → LatchOn
    • 4 → LatchOff
    • 0/5..15 (Gateway Rejects)

Common Control Code Examples

Note

Table below assumes tcc=Nul, clear=false, queue=false, so control code is op (low 4 bits). Note gateway Disallows op=0(Nul).

If you need Trip/Close or queue/clear, please refer to gateway allowed values, full value table see crob.md.

Semanticsop_typecontrol_code (Dec)control_code (Hex)
PulseOnPulseOn10x01
PulseOffPulseOff20x02
LatchOnLatchOn30x03
LatchOffLatchOff40x04

2.4 Full Variation Reference Table

Below are main Variations of DNP3 object groups and their usage (For reference):

Binary Input (Group 1/2)

GroupVarTypeDescription
11StaticPacked Format (No flags)
12StaticWith Flags
21EventWithout Time
22EventWith Absolute Time
23EventWith Relative Time

Analog Input (Group 30/32)

GroupVarTypeDescription
301Static32-bit With Flag
302Static16-bit With Flag
303Static32-bit Without Flag
305StaticSingle-precision (f32) With Flag
306StaticDouble-precision (f64) With Flag
321Event32-bit Without Time
323Event32-bit With Time
325EventSingle-precision Without Time
327EventSingle-precision With Time

Counter (Group 20/21/22)

GroupVarTypeDescription
201Static32-bit With Flag
202Static16-bit With Flag
205Static32-bit Without Flag
211Frozen32-bit With Flag
215Frozen32-bit With Flag and Time
221Event32-bit With Flag
225Event32-bit With Flag and Time

Analog Output (Group 40/41/42)

GroupVarTypeDescription
401Status32-bit With Flag
402Status16-bit With Flag
403StatusSingle-precision With Flag
411Command32-bit ← DataType=Int32
412Command16-bit ← DataType=Int16
413CommandSingle-precision ← DataType=Float32
414CommandDouble-precision ← DataType=Float64
427EventSingle-precision With Time

3) Scan Semantics: Integrity vs Event

Driver will periodically execute:

  • Integrity Scan: Acquire "Full Snapshot" (Class 0/1/2/3)
  • Event Scan: Acquire "Event Changes" (Class 1/2/3)

The difference depends on Outstation configuration and whether data points support event reporting.

Released under the Apache License 2.0.