dandec
Hi,

Brand new here.  Trying to find out why my coil M6 is staying on in the simulator.  I am trying to hold outputs M5-M8 on only while their respective timers are timing, and keep them in sequence.  Each timer starts then upon completion activates the next and deactivates itself.  then loops back around.  perhaps I am breaking some rules here but please see the below. 

Why does coil M6 stay on.png 


Thanks,
Dandec
Reply 0 0
thiagoralves
Having the full programs helps making a better analysis. Are you setting M6 somewhere else in your program? EN and ENO are actually not used for that, they're just meant to enable or disable a given FB. Perhaps you could just make one generic big timer that counts up to a big number and then just use comparison blocks (EQ, LT, GT) with the timer's ET to set your coils.
Reply 0 0
dandec
Hi Thiagor,

Thanks for the reply!  I tried sending only the relevant parts, please see the below for the remainder (I hope that screenshots are the most relevant thing to share or I can share something else if it works better).  I am not touching M6 anywhere else in the program.  In fact the strange part is that M6-M8 all behave the same way (stay Active) while M5 operates as I thought it should. 

remainder of M6 coil issue code.png 

Also, I don't see why ENO can't be used as a status bit to enable other features while the timer is active.  I understand that it might be undesirable to use EN and IN in the fashion shown above but I only need them to be active at the same time for use and deactivate them for reset. 

I agree that a big timer could be beneficial but i am trialing code on the OpenPLC platform for a largely limited device (Schneider Electric Zelio Smart Relay) where the only allowable comparators are for counters which can't be programmed from the display, and for Analog inputs.

I have enjoyed using the OpenPLC Editor so far and am intrigued to trial it on some hardware.  I am curious though if I have found a bug or if I am indeed butchering best practice.

Thanks,
Dandec
Reply 0 0
thiagoralves
Attach your project folder here as a .zip file
Reply 0 0
dandec
of course.... that would only make sense... zip Hoist r2.zip     
Reply 0 0
dandec
Hello Thiagor, did you ever have a chance to try the prev?

Thanks,
Reply 0 0
thiagoralves
Hi @dandec I just checked your code. This idea of using the EN pin is not good. The problem with this approach is that, in essence, the EN pin is converted to a conditional IF clause in the ST code, which means that the program will completely skip the whole rung if the EN is off. Since the EN pin is tied with the IN pin of your timer, what happens is that your timer never gets reset, as if it was frozen in time while the EN is off! When the timer comes back with the EN pin active, it sees the IN active as well, as if you had never lifted that input, so the timer remains on the last count. Same goes for the outputs. Since there is nothing changing the state of the coils, they just remain the same when the EN pin is off. If you want to implement a cyclic state machine in ladder logic (SFC is a better language for state machines, but...), I would recommend creating a main timer that auto-resets and counts from 0 to the total amount in your full cycle. Then you simply use comparisons with the main timer's ET output to activate things along the way, something like this:
cyclic_timer.png 
I'm attaching the full example program for you to check. I hope that helps.
Reply 0 0
Reply