Hello, Wonderware InTouch Users. In the series of Wonderware programming tutorials we have crafted another tutorial for you all. In this tutorial we will discuss the infamous tank filling example. Unlike other tank filling examples this has many additional features.
Various features included in this tank filling example are – use of three tanks each with a valve and pipe combination. As there are more tanks and pipes, consequently, there is more wonderware programming. We would now discuss the process to make tank filling example in wonderware intouch application using wonderware script. In order to grasp the example more easily please follow steps given below.
Step to make Tank Filling Example using Wonderware Progarmming Script –
Step 1 – Draw the layout of the components
The basic layout of the components used in the example is shown in the picture below. Make the layout shown below using components available in the symbol factory.
Step 2 – Give the tagnames to the components in the tank filling example
We already know the importance of tagnames In wonderware programming. In regard of this, our next step is to provide tagnames to the components used.
The various tagnames that we have chosen are as follows (in order – top to bottom) – Refer picture above.
- Valve (v)
- Tank (t1)
- Valve (v1)
- Pipe (p1) –Right angle pipe
- Pipe (p2)
- Right angle pipe – Pipe (p3)
- Valve (v2)
- Tank (t2)
- Valve (v3)
- Pipe (p4)
- Pipe (p5) – Right angle pipe
- Tank (t3)
If you want to know about tagnames in wonderware programming please visit – Wonderware Tagnames.
Step 3 – Wonderware programming Script
This is the most important step. Moreover, this step is the main aim of this article. Here we will write the script required for the task. But, firstly we should discuss what the task is.
The task for this tank filling example is as follows. In this example we would –
- Switch on the valve v.
- Fill the tank t1 when v gets on.
- Turn on valve v1 when t1 is full.
- Start flow in pipe p1 and p2 when v1 turned on.
- Start flow in p3 when p2 full.
- Turn on valve v2 when p3 is full.
- Fill the tank t2 when v2 gets on.
- Turn on valve v3 when t2 is full.
- Start flow in p4 and p5 when v3 is on.
- Start filling tank t3 when p5 is full.
So, above is the sequence of tasks which we need to accomplish. In regard of this, we would now write the wonderware script required for the above tank filling exercise.
Wonderware script for the On Show –
Wonderware Script for the While showing –
IF t1==0 THEN v=1;ENDIF;
IF v==1 AND t1<=100 THEN t1=t1+1;ENDIF;
IF t1>=100 THEN v1=1; ENDIF;
IF v1==1 AND p1<=100 THEN p1=p1+1;ENDIF;
IF p1>=100 THEN p2=p2+1;ENDIF;
IF p2>=100 THEN p3=p3+1;ENDIF;
IF p3>=100 THEN v2=1;ENDIF;
IF v2==1 THEN t2=t2+1;ENDIF;
IF t2>=100 THEN v3=1;ENDIF;
IF v3==1 THEN p4=p4+1;ENDIF;
IF p4>=100 THEN p5=p5+1;ENDIF;
IF p5>=100 THEN t3=t3+1;ENDIF;
For those who don’t know what ‘On show’ and ‘While Showing’ is – Visit Wonderware script Example.
Step 4 – Run the Tank Filling Example
Now, we have written the wonderware programming script for the tank filling example. In this step, we will run the project made in the runtime window. Let’s see how our completed example looks like.
To know more about wonderware programming you can visit these related tutorials.
To see the complete making of this tutorial visit – Wonderware Programming Example at YouTube.
Stay tuned with us for more wonderware programming script related tutorials.