Setting up Elipse Power’s command to write in tag bits.

Question:

How can I set up an Elipse Power’s command to write in tag bits?

Solution:

To do so, link the bit to the command unit’s OperateWriteTag property and adapt the command template’s script to write in this bit. To adapt this script, follow these procedures:

1. Create a new command template. To do so, use Add option on Commands tab at PowerConfig object. In this example, a discrete command template called Write_bit was created:

2. After creating the discrete command, create its semantics. In the figure below, you can see Write_1 e Write_0, and all its values (Operate Value, Operate Feedback, Select Value, Select Feedback, Cancel Value, Cancel Feedback) were set up as either 1 or 0, according to the semantics’ number.

NOTE: You don’t need to create a new command template; editing an old one should be enough.

3. Create the following script at the command’s OnOperate method:

element = Left(OperateWriteTag, Len(OperateWriteTag) – 6)
auxBit = Right(OperateWriteTag, 5)
Set Tag = Application.GetObject(element)
Execute “Tag.” & auxBit & ” = ” & WriteValue

 

4. This script removes the bit from the tag’s path, which makes it possible to search for the tag via GetObjetct method. After that, the bit will be concatenated again and the bit will be written in.

Example: The following tag was linked to the OperateWriteTag property:
“Driver1.Tag1.Bit02”
According to the suggested script, the element variable will receive:
“Driver1.Tag1”
And the auxBit variable will receive:
“bit02”
After that, the GetObject method will search for the corresponding tag from element variable, which in this case is “Driver1.Tag1”. Then, the tag bit will be written in, from the object (tag) concatenated to the corresponding bit (auxBit).

5. Finally, link the command unit’s OperateWriteTag property to the desired bit, as seen below:

NOTE: Remember to enable the driver’s UsebitFields property to be able to use its tags’ bits.

Print Friendly, PDF & Email

Este artigo foi útil? Was this helpful?

Classificação média - Average rating 0 / 5. Count: 0

Leave a Reply

Your email address will not be published.Required fields are marked *