Writing Variables

<< Click to Display Table of Contents >>

 

Writing Variables

When commands must be sent to a device by an external system, users must create script to interpret this command and send it to the Master Driver. This is the case of an external system configured to send the value 65 in a certain variable to indicate a Breaker must be closed, but the field device is expecting the value 1 (one) to execute a close command. This way, Elipse Power Gateway must convert this value before sending it to the field device.

This script must be created according to information available on the manual of the Slave Driver in use. This can be performed in a centralized or distributed way, that is, this script can be created on a single place or directly in each Driver. In addition, users must disable the EnableDeadBand property in the Tags receiving the external commands, so that all writing received by the Slave Driver is handled by the Driver itself.

 

Centralized Script

In this scenario, only one script is created to handle all commands sent. The Driver contains an OnTagRead event, which is triggered whenever a Tag receives a new Reading. In this case, the Tag's EnableDriverEvent must be configured to True. This event receives as a parameter the Tag receiving the reading, which allows verifying in which variable users must proceed with sending commands. Therefore, users can define in this event how to handle all commands received in a single place.

 

TIP

Ideally, this script must be created in the most generic way, so that it does not contain many If or Select Case conditions. Users can define a rule for names of I/O Tags, and then create a script that simply applies that rule to reach the Tag in the Master Driver.

 

The next example shows a simplified form of this script. This example aims to send to the Master Driver, whose Tags have the same names of Tags in the Slave Driver, the same value received by the Slave Driver.

Sub SlaveDriver_OnTagRead(Tag)
  MasterDriverTagName = Replace(Tag.PathName, "SlaveDriver", "MasterDriver")
  Set MasterDriverTag = Application.GetObject(MasterDriverTagName)
  MasterDriverTag.WriteEx Tag.Value
End Sub

 

Distributed Script

In this scenario, a script is created in each one of the Tags receiving external commands. On the OnRead event of each Tag there is a script responsible for interpreting the command request and send it to the Tag in the Master Driver. In the next example, a writing is generated in the Master Driver at each new command received by the Slave Driver, both with the same value.

Sub BreakePosition_Open_Operate_OnRead
  Application.GetObject("MasterDriver.DJ5201.Commands.BreakerPosition_Open_Operate").WriteEx Value
End Sub

Was this page useful?