Commands in DNP Slave Protocol

<< Click to Display Table of Contents >>

 

Commands in DNP Slave Protocol

This Driver supports receiving Select, Operate, or Direct Operate commands for objects 12 Variation 1 and 41 Variations 1, 2, 3, or 4.

If the Command Response Profile option is defined as Wait for Application Response, the full sequence to handle a command is the following:

1.A Select, Operate, or Direct Operate command is received.

2.An individual Tag or Block Tag with parameter N2 or B2 equal to 3 (three), 4 (four), or 5 (five) must be read and handled by the application, such as sending it to another Driver to send it to a device.

3.When receiving an answer of this command to a device, users must write back to the same Tag whose command status was read. If the answer of the command to the device was positive, users must write the same value back. Otherwise, users must write a different value.

4.If no writing is performed to the Tag in an interval of 10 seconds, the Driver sends an answer with status equal to 6, that is, Request Not Accepted. Hardware Problems.

 

To receive a command request from these objects, users can use an individual Tag or a Block Tag, according to the next objects.

 

Object 12 Variation 1

For an individual Tag, the Tag value when read contains the value of the Control Code field. To use the Select and Operate commands, users must create two Tags, each one receiving a reading at the moment the corresponding command occurs, Select or Operate. To use the Direct Operate (5) command, only a single Tag is needed with the following parameters:

N1: Not used

N2: 3, 4, or 5

N3: 1201 or 41XX

N4: Point index

 

For a Block Tag, use the previous configurations, but this Block Tag can have up to six Elements. The difference is that, regardless of the command, Select, Operate, or Direct Operate, only a single Block Tag with the next Elements is needed, because the operation is returned in Element 5 (five).

Element 0: Control Code

Element 1: Count

Element 2: On Time

Element 3: Off Time

Element 4: Status

Element 5: Command (3: Select, 4: Operate, or 5: Direct Operate)

 

Object 41 Variations 1, 2, 3, or 4

For an individual Tag, the Tag value when read contains the value of the Control Code field. To use the Select and Operate command, users must create two Tags, each one receiving the reading at the moment the corresponding command occurs, Select or Operate. To use the Direct Operate (5) command, only a single Tag is needed with the following parameters:

N1: Not used

N2: 5

N3: 1201 or 41XX

N4: Point index

 

For a Block Tag, use the previous configurations, but this Block Tag can have up to three Elements:

Element 0: Value

Element 1: Status

Element 2: Command

 

The next example handles the reception of commands in an Object 12 Variation 1.

// The OpenClose Block Tag contains 5 Elements
// This example assumes sending a received command
// to another DNP Master Driver
 
Sub OpenClose_OnRead()
  Set Digital = Parent.Parent.Item("DigitalReadings")
  ControlCode = Item("ControlCode").Value
 
  Trip = 1
  Close = 0
  CmdOk = 1
 
  Select Case ControlCode
    Case 65 'Pulse On Close
      VCommand = Close
    Case 66 'Pulse off close
      VCommand = Close
    Case 67 'Latch On Close
      VCommand = Close
    Case 68 'Latch Off Close
      VCommand = Close
    Case 129 'Pulse On Trip
      VCommand = Trip
    Case 130 'Pulse Off Trip
      VCommand = Trip
    Case 131 'Latch On Trip
      VCommand = Trip
    Case 132 'Latch Off Trip
      VCommand = Trip
    Case Else 'Invalid command
      CmdOk = 0
  End Select
 
  If Not(CmdOk) Then
    WStatus = 7
  Else
    If Digital.Item("STATUSDL01").WriteEx(VCommand, , , WStatus) Then
      WStatus = 0 'Forces value 0 - Success
      'Status expected by the Master in case of error
      'Select Case WStatus
      '  Case 1
      '    Endtext = "Operate received after a selection time-out"
      '  Case 2
      '    Endtext = "No message of previous selection"
      '  Case 3
      '    Endtext = "Format error in the command"
      '  Case 4
      '    Endtext = "Operation not supported for this point"
      '  Case 5
      '    Endtext = "Queue is full or point is already active"
      '  Case 6
      '    Endtext = "Hardware problem"
      '  Case Else
      '    Endtext = "Undefined problem"
      'End Select
    Else
      WStatus = 7
    End If
  End If
  Item("Status").Value = WStatus
  Write(EWriteSyncMode)
End Sub

Was this page useful?