Hello, Wondwerware InTouch Users. I hope every one of you must be doing great experiments with your InTouch Wonderware application. Recently, we described about each Wonderware InTouch function. And in that description we also talked about orientation function in InTouch. Orientation function in Wonderware InTouch is a very important and interesting function. However, it is also a bit tricky to use.
Nonetheless, with practice you can ace that very easily. Only thing to understand in Orientation function is the position of the coordinates. And still you face problems we are here to help you.
In this regard, we have prepared this post. In order to have a better grasp on the functionality of orientation function, explanation is done using an example. The example, however, is a task. The task is to make an analog clock. Let’s complete the task to understand how orientation works.
We would break the given task in following parts –
- Prepare the design of the clock
- Analyze the logic of operation
- Set tagnames and associated values of orientation
- Write down the wonderware script based on the logic
- Run the wonderware program
Now we have described the parts of the task, let’s discuss them in details. And simultaneously conquer them.
Prepare the Design of the Clock –
Our first task is to prepare the design of the clock. I think this would not be that difficult. To make a clock on the windowmaker, take ellipse maker from the side panel.
Put it on the window and expand in such a way that it becomes a circle. To ensure that It becomes a circle, just look at the W,H on the bottom panel.
In a similar manner take a line maker from side panel.
Make three lines inside the circle you just made above. For convenience you can change the color of these lines. I have taken Pink, Green and Blue color for hour, minute and second hands respectively.
By this time our designing task for the clock must be completed. Consequently, we move on for the second part of the task.
Analyze the Logic of Operation –
Wonderware programming is not at all difficult. Just figure out the logic for a program. Give values to the variables/tagnames and your program is finished. So, figuring out logic for the program is crucial. However, it is not hard.
Let’s, figure out what could be the logic for this task. For this we need to think what a clock does. It shows us time. Wow, what a nice answer. But, unfortunately that is not enough here. We need a little more that is ‘How’. How does it show the time?
Also, we don’t need to go that technical to find the answer of this how. We just need to answer how seconds make minutes and how minutes make hours. And that is quite easy.
60 seconds = 1 minute, 60 minutes = 1 hour, 60 hours = 1 day.
That’s enough. We got the logic. So, we are required to make a program in which –
If second’s hand of the clock rotates 60 times then minute hand should rotate one time. Similarly, if minute hand rotates 60 times then hour hand should rotate one time. And if hour hand rotates 60 times we say a day is complete.
Now, we have the logic we write wonderware tagnames based on this logic. This would not only improve our wonderware programming but also would help in learning orientation function more easily.
Set Tagnames and Associated Values of Orientation –
Tagnames are mandatory in wonderware programming. And here we would write tagnames required in our program. The requirement here is of 3 tagnames i.e. hour’s hand, minute’s hand and second’s hand. H2, m and s are respectively the tagnames used. However, you can name them according to your choice.
Now, as tagnames are defined under orientation function property we need to fill in the values for these tags also. In orientation function, the values that needs to be set are –
- Properties Values
- Value at Max CCW
- Value at Max CW
- CCW Rotation
- CW Rotation
- Center of Rotaion Offset from Object Rotation values
- X Position
- Y Position
Of these values, the most important are Center of Rotaion Offset from Object Rotation values. These two position values can irritate you the most. But don’t worry now as you are reading this post and hence have the solution.
The values that you would put in these are –
For X position – Half of the X-coordinate value of the tag that you want to rotate. Positive if rotation is CCW and negative for CW.
For Y position – Half of the Y- coordinate value of the tag that you want to rotate. Positive if rotation CW and negative for CCW.
That’s it. Orientation function values are set. For our case values are as shown in below pictures –
Now, we have tagnames and associated values set we write wonderware script based on this.
Write Down Wonderware Script Based On the Logic –
The logic is simple as discussed above. Let’s quickly convert the logic above to wonderware script. And almost everyone of us can understand the below script written by us. Below is ‘While showing’ script.
IF s<60 THEN s=s+1;ENDIF;
IF s==59 AND m<60 THEN m=m+1 ;ENDIF;
IF s>=60 THEN s=0;ENDIF;
IF m==59 AND h2<60 THEN h2=h2+1;ENDIF;
IF m>=60 THEN m=0;ENDIF;
IF h2>=60 THEN h2=0 ;ENDIF;
Any confusion? I guess there should be none. However, if you still have doubts about this wonderware script you can share your thoughts in the comment section.
Now we have written the wonderware script for orientation function, let’s run the program to test it.
Run the Wonderware Program –
Lastly, to see logic more clearly play the video below –
If this post helped you in any manner please show us your love by following us on @Facebook.