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,615
Hello, We are now working on a software to collet the configuration of different PLC brands ,using a third software to backup all the simens...
Replies
6
Views
122
Hi, I wrote a sequence loop using EQU and MOV instructions and would like to validate that i'm doing this properly. i attached a picture of the...
Replies
8
Views
173
Hi I'm very new to PLC programming and I'm trying to find out if this library (Tc2_NcFifoAxes) is necessary for our task In our case we need to...
Replies
0
Views
50
I have a project to automate four generator sets. The system will monitor and store the load demand of the factory. Once there's Power outage, the...
Replies
0
Views
95
Back
Top Bottom