Reply To: Wonderware script subtraction problem!

#3822
StixoffireKen S
Participant
  • Topics: 3
  • Replies: 14
  • Total Posts: 17
Karma: 35
Rank: Padawan

Just a Question.
1: You are using InTouch and not Application System Platform ?
2: As a design standpoint – let your HMI be an HMI.. do your math in the PLC.
3: InTouch : Looking at your code- what triggers your script to run ?
4: If Hour is between 23 and 1 nothing happens.
You say your Intouch Tag has the correct value ?
If this were me, I would do the calculation all in one IF statement and 1 Time Stamp because At Hour 23 it has one value and at hour 1 it has another value …
If $Hour==MyTimeInterval
MyIntervalPLCTimeVal = CurrentPLCVal;
MyPreviousPLCTimeVal = MyPreviousPLCTimeVal  РMyIntervalPLCTimeVal
EndIf;

However this code can have an Issue – your value can be NEGATIVE if you have no previous time value!!