Wonderware Number Formatting

Jay@Haynes

Member
Join Date
May 2014
Location
Oklahoma
Posts
10
I've got a hopefully easy one of you guys. I developed a new screen for a Wonderware app that is subjected to using data and formats of an existing PLC (not ours and still under warranty) that I would rather not manipulate if I didn't have to. The PLC is using three different numbers to indicate a runtime in seconds, minutes and hours. I've got the data reading in Wonderware by creating three different analog displays, 2 digits long (##) separated by a colon (result ##:##:##). When each value is less than ten, then result looks like this - 1_:2_:3_ where each underscore is a blank space. I would like to display single digit values preceded by a zero to display 01:02:03. I tried the normal formatting procedures and I'm afraid it is going to have to be a script for each value. I'm not very proficient in scripting, so that's why I haven't looked very hard into that yet. Any help would be greatly appreciated.

Jay
 
If you have access the run time as a continuous SECONDS value in the PLC, you can use this script to convert the SECONDS to HHMMSS;

QuickFunction: HHMMSS(secondsTag)

Code:
DIM Hours AS INTEGER;
DIM Minutes AS INTEGER;

Hours = (Seconds / 3600) - ((Seconds / 3600) MOD 1);
 
Minutes = (Seconds / 60) - ((Seconds / 60) MOD 1) - (Hours * 60);
 
Seconds = (Seconds MOD 3600) MOD 60;
 
RETURN Text(Hours,"00") +":"+ Text(Minutes,"00") +":"+ Text(Seconds,"00");
You can call this quick function directly form your value display, call the function and pass the tag, it will return the format as HH:MM:SS
 
Thank you for the info. It got me pointed in the right direction anyways. There isn't a continuous seconds counter. It resets after each minute, the minutes reset after each hour, thus the reason for three individual tags.

I was able to create a single text object and use it as a string display. My expression for the string display ended up being Text( HoursTag, "00") +":"+ Text( MinutesTag, "00") +":"+Text( SecondsTag, "00"). It worked perfect. I'm realizing how little I really know about Wonderware.

Again thanks for the help.
 
If you have access the run time as a continuous SECONDS value in the PLC, you can use this script to convert the SECONDS to HHMMSS;

QuickFunction: HHMMSS(secondsTag)

Code:
DIM Hours AS INTEGER;
DIM Minutes AS INTEGER;

Hours = (Seconds / 3600) - ((Seconds / 3600) MOD 1);
 
Minutes = (Seconds / 60) - ((Seconds / 60) MOD 1) - (Hours * 60);
 
Seconds = (Seconds MOD 3600) MOD 60;
 
RETURN Text(Hours,"00") +":"+ Text(Minutes,"00") +":"+ Text(Seconds,"00");
You can call this quick function directly form your value display, call the function and pass the tag, it will return the format as HH:MM:SS

Nice idea..
 

Similar Topics

Good Day Guys, We have a 3 stand alone wonderware project, that has to be merge into 1 stand alone project, Our problem now is that the Total Tag...
Replies
63
Views
23,257
One of our consultants I am working with is using Wonderware 7.??? I believe and has been using the programming scripts to do the HMI, I believe...
Replies
6
Views
3,906
Hi folks, I am working with a client running an Intouch 9.0 application. They have approximately 7000 alarms...configured across 2096 Alarm...
Replies
2
Views
5,865
Hi there, can somebody give me a hint on how to dial a certain telephone number out of Wonderware. I simply would like to use a tag or discrete...
Replies
5
Views
3,776
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
137
Back
Top Bottom