Command Handling

<< Click to Display Table of Contents >>

 

Command Handling

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.A Tag or Block with the N2 parameter equal to 3 (three), 4 (four), or 5 (five) must be read and handled by the application, such as by sending to another Driver that sends it to a device.

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

4.If no writing was performed on the Tag during 10 seconds, this Driver sends a response with a status equal to 6 (six, Request Not Accepted. Hardware Problems).

 

To receive a command request for these objects, users can use an individual Tag or a Block Tag.

Object 12 Variation 1

For an individual Tag, this Tag's value when read contains the value of the Control Code field. To use Select and Operate operations, two Tags must be created and each one receives the reading at the moment the corresponding operation, Select or Operate, occurs. To use a Direct Operate operation (5), only a single Tag is needed with the following parameters:

N1: Not used

N2: 3 (three), 4 (four), or 5 (five)

N3: 1201 or 41XX

N4: Point's index

 

For a Block Tag, the same previous configurations are valid, but this Block can have up to six Elements. The difference is that regardless the operation (Select, Operate,or Direct Operate), only a single Block is needed, because the operation returns in Element 5 (five):

Element 0: Control Code

Element 1: Count

Element 2: On Time

Element 3: Off Time

Element 4: Status

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

Element 6: Master address

 

Object 41 Variations 1, 2, 3, or 4

For an individual Tag, this Tag's value when read contains the value of the Control Code field. To use Select and Operate operations, two Tags must be created, and each one receives the reading at the moment the corresponding operation, Select or Operate, occurs. To use a Direct Operate operation (5), only a single operation is needed, with the following parameters:

N1: Not used

N2: 5 (five)

N3: 1201 or 41XX

N4: Point's index

 

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

Element 0: Value

Element 1: Status

Element 2: Operation

 

Example of a script to handle the reception of commands in an Object 12 Variation 1.

// The OpenClose Block is formed by five Elements
// This example assumes sending the received command
// to another Master DNP Driver
 
Sub OpenClose_OnRead()
  Set Digital = Parent.Parent.Item("DigitalReading")
  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 or not formatted command
      CmdOk = 0
  End Select
 
  If Not(CmdOk) Then
    WStatus = 7
  Else
    If Digital.Item("STATUSDL01").WriteEx(VCommand, , , WStatus) Then
      WStatus = 0 'Forces 0 - Writing successful
      Status waited by the Master in case of error:
      Select Case WStatus
        Case 1
          Endtext = " Operate received after selection time-out"
        Case 2
          Endtext = " No previous selection message"
        Case 3
          Endtext = " Format error in command"
        Case 4
          Endtext = " Operation not supported for this point"
        Case 5
          Endtext = " Queue is full or this point is already active"
        Case 6
          Endtext = " Hardware problems"
        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?