Introduction to FactoryTalk View Three State Color Animation
In this section, we’ll set up a FactoryTalk View Three State Color Animation. For example, we’ll consider a pump. We can enable or disable the pump. If the pump is disabled, we want the color to be grey. When the pump is enabled, we can start or stop the pump. If the pump is running, we want the color to be green. On the other hand, if we stop the pump, it will turn red.
In this case, we’ll keep it simple. We’ll animate an ellipse object. Basically, you can animate most any object. This includes objects from the FactoryTalk View library.
Before we begin, we need to make sure we have communication to the processor. We configure communication in FactoryTalk Linx. In older versions, they call this RSLinx Enterprise. Under FactoryTalk Linx, go to Communication setup. If you don’t already have a shortcut pointing to your processor, then we’ll create one. Be sure the shortcut, and your processor are highlighted at the same time. At last click “Apply”. Always remember to click “Apply”. Otherwise, FactoryTalk view will not save your changes. Additionally, if this is going to run on a PanelView, or FactoryTalk View Station, we need to configure the runtime tab. If the path of the station or PanelView is the same as your computer, simply copy from design to runtime (target). You have a button for that. If the communication path is different, then obviously you will need to configure the runtime (target) path manually.
Create Your Tags for Three State Color Animation
Let’s create some tags. Keep in mind that normally your logic will write to these tags. We’ll create a tag called “PumpEnabled”, and another tag called “PumpRunning” Both of these will have the BOOL data type. Remember what we are after. When we disable the pump, the animation will show a grey color. Running will be green, and not running will be red as long as as the pump is still enabled.
Add an Object to your Display
At this point, we’ll add an object onto your display. As I’ve said before, we’ll keep this simple. Let’s just add an ellipse object. This could be just about any object, including text, or a library object.
Animate the Object
Finally, we are ready to configure the animation. Right click on the object (or part of the object) that you wish to animate. Go to Animation | Color.
Remember that we have two tags to look at. These are PumpEnabled, and PumpRunning. We’ll configure the animation so that state 0 is grey. Likewise, state 1 will be red, and state 2 will be green.
Next, we will set up an expression. Remember that when the Pump is NOT enabled, our expression returns a zero. If the we enable the pump, but the pump is NOT running, we need to return the value of 1. This will cause the animation to turn red. Likewise, if we enable the pump, and the pump is running, we will return a value of 3. The animation turns green.
Let’s write the expression:
Keep in mind that this whole expression will return a value. The color animation will use whatever value the expression returns to reflect the state of the object.
Test your Work!
Test the display. When we disable the pump in logic, our object should be grey.
Likewise, if we enable the pump, but it’s not running, we need the color to be red.
Similarly, when we enable and run the pump, it should be green.
Summary of Three State Color Animation
In short, the three state color animation is simple. We simply look at a couple tags. Our expression returns a number based on the value of these tags. The color animation uses this number to reflect the state for the animation.
— Ricky Bryce