Commands

<< Click to Display Table of Contents >>

 

Commands

When using a Control Relay Output Block (Object 12, Variation 1) object, a series of data is sent by this Driver, as described next.

 

Byte 0: Control Code

The value of a Tag configured in the application is copied to this byte, which specifies details about the command's operation. This field is subdivided as follows.

 

Bit

7

6

5

4

3

2

1

0

Meaning

Trip or Close

Clear

Queue

Code

 

Trip or Close: This field determines which control relay is activated in a system where a pair of Trip and Close relays is used to energize and de-energize points in the field. Possible values are, in binary format, 00: NUL, 01: Close, and 10: Trip. The NUL value can be used to activate the selection relay without activating the Trip or Close relays. In a system without selection relays, the NUL value does not perform any operation. In a system without Trip or Close relays, on the other hand, this field must be always NUL to indicate a normal operation of digital control, where the exact control point is implicit or fully known. This field does not support Trip and Close commands simultaneously, which is considered an illegal operation

Clear: If the command contains this field set as 1 (one, turned on), all control operations are removed from the queue, including the command currently executing, and this control operation is performed

Queue: Indicates placing a command in a command queue in the device. If this field is equal to 0 (zero, NUL) then no operation is added to the queue and this queue is cleared from all controls, including the command that is executing if the Clear field is turned on. When the control function is executed and completed, it is removed from the queue. If this command contains a Queue attribute turned on, then this operation returns to the queue (at the end) for that point

Code: This field specifies a type of operation. This command can be used with devices that support queuing commands, point-to-point, or other control mechanisms. In the first type, any control command must be queued for the point. In the second type, each control is performed until completed before the next command be accepted for that point.

 

Possible values for Code (in binary format)

Value

Operation

Description

0000

NUL

No operation is performed

0001

PULSE ON

Points are connected by the time specified in On-Time, turned off by the time specified in Off-Time, and kept in an OFF status

0010

PULSE OFF

Points are disconnected by the time specified in Off-Time, turned on by the time specified in On-Time, and kept in an ON status

0011

LATCH ON

Keeps all points in an ON status

0100

LATCH OFF

Keeps all points in an OFF status

 

Other values outside this table are not defined.

 

Byte 1: Count

This byte indicates how many times an operation is executed. This value is kept fixed in 1 (one) by this Driver.

 

Bytes 2 a 5: On-Time

On-time, in milliseconds. It is defined on Driver's extra configurations window and it is fixed for all commands.

 

Bytes 6 a 9: Off-Time

Off-time, in milliseconds. It is defined on Driver's extra configurations window and it is fixed for all commands.

 

Byte 10: Status

Status of the operation returned by this Driver if that operation was successful. Status is only interpreted in the response, and it can be used by an application to check if the command was performed successfully. The available codes are the following:

0: Command correctly executed, including Select and Operate operations

1: Operate command sent after a maximum Select time defined by the slave

2: Operate command was sent without a previous Select command

3: Formatting errors in the message

4: Operation not supported for this point

5: Queue is full or point is already active

6: Hardware problems

Others: Non-standard error codes

 

The value of the Status field can be obtained by an E3 or Elipse Power application using the WStatus parameter of the WriteEx method of I/O Tags or Block Tags, as described on the next examples.

To send commands, users can use a PLC Tag (IOTag) as well as a Block Tag. When using a PLC Tag, it must be set with a number between 0 (zero) and 255, which corresponds to the Control Code (message's byte zero). Remaining bytes are retrieved from this Driver's default configuration, defined on extra configurations window.

For a Block Tag, users must use a script that executes Block Tag's Write method. To do so, this Block Tag must have only four Elements, which must have their individual writing properties disabled:

Element 0: Control Code

Element 1: Count

Element 2: Relay On-Time

Element 3: Relay Off-Time

 

This feature can be used if individual command programming is needed for each point, ignoring default On-Time and Off-Time timings.

 

Example of a script in Elipse SCADA using a Block Tag with four Elements

//Configurations: B2=5 (DIRECT OPERATE), B3 = 1201
Block1.Element0 = 65  // Operation Code
Block1.Element1 = 1   // Count
Block1.Element2 = 500 // On Time
Block1.Element3 = 500 // Off Time
Block1.Write()

 

Example of a script in E3 or Elipse Power using a simple command Tag

Value = 65 // Operation Code
msg = MsgBox("Send this command?", 292, "Command")
If msg = 7 Then
  MsgBox "Command aborted", 48, "Quit"
ElseIf msg = 6 Then
  If MsgBox("Confirm sending this command?", 292, "Warning") = 6 Then
    Set Tag = Application.GetObject("DNPDriver.TagName")
    If Tag.WriteEx(Value, , , WStatus) = False Then
      MsgBox "Error sending this command", 48, "Error"
    Else
      If WStatus <> 0 Then
        MsgTrack = "Command not executed,"
        EndText = ""
        Select Case WStatus
          Case 1
            EndText = " Operate received after a Selection time-out"
          Case 2
            EndText = " No previous Selection message"
          Case 3
            EndText = " Formatting error in this 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 problems"
          Case Else
            EndText = " Undefined problem"
        End Select
        MsgBox MsgTrack & EndText, 48, "Error"
    End If
  End If
End If

Was this page useful?