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,545
Hi, I'm trying to use the IO Device Library (Product Versions) which is configured to work with the 1756-EN4TR & 1756-EN2TR but my system uses...
Replies
0
Views
35
Hello, As part of our project, we are using an M241 controller. This controller interfaces with an industrial computer and a router via a switch...
Replies
2
Views
65
I'm trying to write a data in Arduino using MODWR function block .I used the code I got from online for both PLC and Arduino. I made the wiring...
Replies
4
Views
78
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
157
Back
Top Bottom