jbuening
Hello!  I've managed to get OpenPLC working and I am now trying to create a simple program using ladder diagram.

Could someone provide direction on the best way to sequence between 3 outputs?  I'm trying to create a sequence so that:

Output1 on for 3 seconds, followed by
Output2 on for 3 seconds, followed by
Output3 on for 3 seconds, repeating back to 1

I've been reading all I can about TON and TOF, but it doesn't seem to be as simple a program to create as I expected.

-JB
Quote 0 0
jbuening
The example at the page below would seem to be exactly what I need, except I don't see retentive timers available in PLCOpen Editor.  Would there be a simple change to make this work with normal TON?

https://www.sanfoundry.com/plc-program-control-lights-sequence-1/
Quote 0 0
thiagoralves
OpenPLC does not have a retentive timer instruction. However, there are many ways to accomplish what you want, you just need to have your head thinking around the tools you have available. I answered a similar question here, which might help you get started:  https://openplc.discussion.community/post/simple-circuit-help-9665652?highlight=allen-bradley&pid=1303401130

Another way to do it is to use a Pulse Timers (PTs) instead of using TONs. The PT timer will generate a pulse on the output Q with PT duration every time the input IN changes from 0 to 1. For example, if you set PT to T#3000ms, it means that whenever you have a change at the input from 0 to 1 (a button press for example), the timer will have the Q output on for 3 seconds, no matter if your button press was quicker or longer than 3 seconds. Here is the graph diagram for the PT timer:
Capture.png 

If you just concatenate 3 PTs one after the other, you might be able to accomplish what you need. Something like this (untested):
Capture.png 

Keep in mind that TP0_out and TP1_out contacts are falling edge contacts (type N)
Quote 0 0
thiagoralves
Here is your whole project, now tested =)
Quote 0 0
jbuening
Thanks!  I had been working through this and trying to figure out where TP2_out needed to be used to set off TP0 again.  I had not succeeded before noticing your recent reply.

One other question I have.  If I push the start button while the second output is on, the first will begin again.  Is there a way to block a push of the start_button from being effective unless the program is stopped first?

Would a negative latch in series with the second run do this?

I'll try and see what happens.
Quote 0 0
leo.golden
I tried out the shared sequencing, the logic does not loop back, once it goes to the last rung, the TP2Out fires in the second rung, but it does not restart the process, just goes one time down. 
Quote 0 0
thiagoralves
It will loop back if you release the "start_button". If you keep it pressed, TP0 will never reset its count, so it won't start. This is another example of sequencing timer that might be better: https://openplc.discussion.community/post/reset-timer-10412971?highlight=tp+reset&pid=1310630188
Quote 0 0
leo.golden
Got it, i was trying it out in the simu, with forceTrue staying on. I had a diff requirement where i needed to flash the same led every couple of seconds once the contact switch is on - like festival lights. I was able to accomplish that by understanding your implementation for this requirement of phased light turn ons. I am kindergardner when it comes to plc, so your program helped me quite a lot. Thank you very much!
Quote 0 0