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,487
Hello everyone, I'm working on a project that involves controlling an array of nozzles within a CNC environment, where the nozzles travel along a...
Replies
5
Views
105
Hi, I was noticing that Profibus connectors have 2 ports on them that can house 2 separate cables. Can I use 2 cables with Profibus signals...
Replies
3
Views
108
Hi, Seeking consultation on an implementation matter, and have a question about Modicon Compact 984 communication through RS485: Three Modicon...
Replies
2
Views
76
Dear all, I don't know why setup of password became challenging and weird. After setting up the password and try to upload the ladder from the plc...
Replies
3
Views
89
Back
Top Bottom