Using MOD function in Wonderware to run conditional script

defcon.klaxon

Lifetime Supporting Member
Join Date
Feb 2015
Location
Far NorCal
Posts
616
Hey guys,

I'm working on an existing system where the old programmer (from like 25 years ago) used a bunch of conditional scripts in Wonderware to execute said scripts once a minute. Programmer did this by using "$Second MOD 59 == 0" as the condition. Seems like it would work, but doesn't this condition become true twice a minute (when $Second == 59, but also when $Second == 0)?

The problem is, the operators aren't aware of what is new and what is old, so when they notice something not working, they assume it's because of my new work, and not something that has literally been around for 25 years (and I've already fixed a few bugs they've been complaining about for literally 25 years!).

I'm going to remove the conditional scripts and create the same code in LD (flow totalizers and ETM) but for future reference, was wondering if the $Second MOD xx == 0 code is valid, or if it should be avoided.
 
I think the script is probably triggered on the transition of the expression from false to true. There is no false to true transition when the value of $Second goes from 59 to zero.

Ahhhh, I bet that's exactly it, and that's why I'm having issues...apparently older versions of Wonderware allowed multiple instances of identical condition scripts (there are four to five instances of the same condition in the existing program) and as it exists, it's ok...but if you want to make a change to any of the scripts, it'll throw an error, saying there's already another script with that condition. What I did was I took some of the code from the MOD 59 == 0 and cut/pasted into a new script with MOD 58 == 0. BUT, MOD 58 == 0 will false to true transition twice instead of once, which would explain why the totalizers in question are reading double what they should. Thanks for the help Steve!
 

Similar Topics

Hello, Trying to understand the MOD in Logix 5000 when used in a CPT block. I'm familiar with MOD or modulo as a ratio or division...
Replies
6
Views
3,535
Hey all, i have a panelview screen (image attached), with 4 items on it. Program 1, Program 2, ...3, ...4. The PLC i am using is a compactlogix...
Replies
5
Views
127
I am trying to set up a piece of equipment with a Horner HE-X4R. I'd like to use structured text and so far I'm just trying to get a basic On/off...
Replies
0
Views
53
SELECTED NEW FILE SELECTED PROCESSOR TYPE SELECTED I/O CONFIGURATIONS IM UNABLE TO CONFIGURE MY I/O’S. I HAVE A PAPER COPY OF A PROGRAM AND I...
Replies
0
Views
62
Have a system that has been running for over a year and all of a sudden getting a ExcessiveVelocityFault on one of the drives when the MSO command...
Replies
2
Views
130
Back
Top Bottom