Wonderware/Aveva - writing to ShortDesc attribute with script

ASF

Lifetime Supporting Member
Join Date
Jun 2012
Location
Australia
Posts
3,921
Hi all,

Currently delving into Wonderware/Aveva System Platform for the first time, and I'm trying to set up a script to automatically write to the object description.

I have a template called, say, $Tank. $Tank has an attribute Number (integer).

I also have templates called $Motor, $Valve and $Sensor

I created derived templates of $Motor, $Valve and $Sensor and dragged them into the $Tank template. Inside the $Tank template I renamed them to Agitator, InletValve and LevelSensor.

Then I add a script to the $Tank template that executes on a Me.Number data change. I have confirmed that the script is executing as expected.

In the script, I have:
Code:
Me.Agitator.ShortDesc = "Tank " + StringFromIntg(Me.Number, 10) + " Agitator";
Me.InletValve.ShortDesc = "Tank " + StringFromIntg(Me.Number, 10) + " Inlet Valve";
Me.LevelSensor.ShortDesc = "Tank " + StringFromIntg(Me.Number, 10) + " Level Sensor";
Then I create 100 instances of the $Tank template, update the Number attribute in all of them, and I would expect the ShortDesc attribute of each motor, valve and sensor to be updated to "Tank x Agitator/Inlet Valve/Level Sensor", but it does not work.

Using the same script to write instead to another user-created attribute, e.g.
Code:
Me.Agitator.MyStringAttribute = "Tank " + StringFromIntg(Me.Number, 10) + " Agitator";
...works just fine, but it seems to have no effect when writing to the ShortDesc attribute. Even just trying to write a simple script that writes "Testing" to the ShortDesc attribute doesn't seem to work.

Is there something wrong with my script? Is the ShortDesc parameter not editable by a script? Is there another way to achieve my outcome short of manually opening 100 instances of each device and manually typing it in?

I posted this on the Wonderware technical support forums and got crickets, hopefully PLCs.Net can help me out again!
 
Last edited:
I created derived templates of $Motor, $Valve and $Sensor and dragged them into the $Tank template.

I'm not sure what your base templates are, but I'm guessing that they are all based on $UserDefined.

Since you "dragged" $Motor et al "under" $Tank, you are effectively making each Motor derived from each tank. The base template -- Tank -- knows nothing about its children. It's a template with general properties (Attributes, scripts) that may or may not get passed down to its children depending on whether the attribute etc. is locked or not.

It looks like in addition to having each "Tank" having a "Agitator" attribute which have nothing to do with the $Motor template under each (? any?). And thus don't have a ".ShortDescription", but only a ".Description".

I don't know how you've managed your binding scripts (tying your motors to PLC values), but things might not work as you'd like.

Screenshots of your Derived view (and perhaps Deployment view as well) would help.

------

A better approach might be to create instances of $Area called "Tank 01", etc., make your $Motor user-defined objects based solely on $UserDefined, with whatever naming convention your motors and valves have ("M1492"). In the deployment view, you may have under "Tank 01" M1492, YV1776, and YV1812, with different motors and valves deployed to different tanks/areas.

Then the $Motor template might have a locked script with something like

Me.ShortDescription = MyArea.Name + " Agitator" ;
(or perhaps the value of attribute "MotorType" which would define whether the motor is an Agitator, Pump, etc., either as a hard-coded string, or as a enumeration value (INT))

Now your object M1492's description would be "Tank 01 Agitator". There would be other motor Attributes (Start, Stop, Running), that would not be shared with valve attributes (Open, Close, IsOpen).

You might even also have a $Tank user-defined objects that has tank attributes, and each instance ("Tank_01") could be deployed to its designated area ("Tank 01").

Depending on how distributed your control is, your Tank "area" may be deployed to different OI servers, pointing to different PLCs, and then all the children deployed to that tank would also be know which PLC has its information.

I'm still a System Platform newbie, and there's lots of ways to skin these cats. But hopefully this helps.
 
Last edited:
Thanks for the detailed reply!
I'm not sure what your base templates are, but I'm guessing that they are all based on $UserDefined
Ultimately yes, via a few other templates to add base functionality.

Since you "dragged" $Motor et al "under" $Tank, you are effectively making each Motor derived from each tank. The base template -- Tank -- knows nothing about its children
I'm not sure I follow. The base template does know about it's children - I'm doing lots of "Me.Agitator.SomeAttribute = SomeValue" scripts and so on which are working fine, it's onyl when I try to write to the ShortDesc attribute that nothing appears to happen.

It looks like in addition to having each "Tank" having a "Agitator" attribute which have nothing to do with the $Motor template under each (? any?). And thus don't have a ".ShortDescription", but only a ".Description".
I can find the ShortDesc attribute in the object viewer, it definitely exists. Maybe I'll try reading from it and see what results that gives me...

I don't know how you've managed your binding scripts (tying your motors to PLC values), but things might not work as you'd like.
That part of it is working fine using another script

A better approach might be to create instances of $Area called "Tank 01", etc., make your $Motor user-defined objects based solely on $UserDefined, with whatever naming convention your motors and valves have ("M1492"). In the deployment view, you may have under "Tank 01" M1492, YV1776, and YV1812, with different motors and valves deployed to different tanks/areas.

Then the $Motor template might have a locked script with something like

Me.ShortDescription = MyArea.Name + " Agitator" ;
(or perhaps the value of attribute "MotorType" which would define whether the motor is an Agitator, Pump, etc., either as a hard-coded string, or as a enumeration value (INT))

Now your object M1492's description would be "Tank 01 Agitator". There would be other motor Attributes (Start, Stop, Running), that would not be shared with valve attributes (Open, Close, IsOpen).
The issue is not with establishing what the description should be, it's getting it into the ShortDesc property. I can write it to any other property - e.g. if instead of writing to Me.Agitator.ShortDesc I write to Me.Agitator.SomeStringAttribute, then the agitator's MyStringAttribute is updated with the correct string. I just can't make it write to the ShortDesc attribute. Even just adding a one-off script to the Agitator instances themselves, saying "run every 1 second", and the script being simply Me.ShortDesc = "Testing" does not work.
 
So after some more digging, the writeability of the ShortDesc property is "Writeable at config only" which I take to mean "can only be edited using the GUI in the object properties editor".

What a total pain.
 

Similar Topics

Hi, We are setting up an Aveva Plant SCADA node with the intention to connect it to a Wonderware Historian node. Everywhere I look online I see...
Replies
1
Views
179
Hello, I have Aveva 2020 R2 running on a Windows 10 PC. My issue is that the tags on the HMI do not all update (some do) while logged in as...
Replies
2
Views
1,703
I consider myself extremely versed with Wonderware InTouch and Archestra, but have not touched 2020 yet. In terms of InTouch scripting, SQL...
Replies
2
Views
2,314
Seems odd that you can make a symbol and place many of them but if the text on a button and or elsewhere in the symbol comes from a Custom...
Replies
0
Views
1,641
Hi guys, I have experience with PLC to Excel etc...just starting on using intouch scada screens. I have an Excel sheet that uses mainly...
Replies
1
Views
149
Back
Top Bottom