Machine sequence logic, multiple instances vs one master

JZerb

Member
Join Date
Oct 2016
Location
Here
Posts
421
So, i have a machine that I'm programming say the sequence is 1-2-3-4-5.

If the operator hits the 'start' button it will step through the sequence 1-2-3-4-5.

now, there is another button that the operator can press at a different time, while the machine is not moving of course, that will do a FEW of the same movements that the aforementioned sequence would do. so say this button is 'go here' and then the machine would go through the sequence 2-3-4.

now the way i have it written is that the 'start' button and 'go here' button each have their own respective sequence logic, so Start sequence is 1-2-3-4-5 and Go here sequence is 1-2-3 does that make the most sense? or should i set it up so that there is one "master" sequence and depending upon which button is pressed it would start at its respective part of the sequence?

i think the way i have it written is best, but im no expert so i was curious of other opinions.
 
Hi,

There is no right or wrong way I guess, the way you written it is good, in such it is much easier to trouble shoot, readable, and also easier to modify it when necessary.

Regards
 
if I understand you correctly.

the start button operates sequence 1,2,3,4,5
and when the machine is not running the operator can push go here
then when you press the start button, you get sequence 2,3,4

are the sequences 2,3,4 involving the same steps?
how do you determine what sequences to run if the go there button is a pushbutton as well as the start button?

if you can create a signal to separate which sequences to run.

create subroutines 1,2,3,4,5, 6, and 7
subroutine 6 - jump to subroutines 1,2,3,4,5
subroutine 7 - jump to subroutines 2,3,4
when the start button is pushed and the go there signal is not on, execute subroutine 6.
when the start button is pushed and the go there signal is on, execute subroutine 7.


food for thought
james
 
if I understand you correctly.

the start button operates sequence 1,2,3,4,5
and when the machine is not running the operator can push go here
then when you press the start button, you get sequence 2,3,4

are the sequences 2,3,4 involving the same steps?
how do you determine what sequences to run if the go there button is a pushbutton as well as the start button?

if you can create a signal to separate which sequences to run.

create subroutines 1,2,3,4,5, 6, and 7
subroutine 6 - jump to subroutines 1,2,3,4,5
subroutine 7 - jump to subroutines 2,3,4
when the start button is pushed and the go there signal is not on, execute subroutine 6.
when the start button is pushed and the go there signal is on, execute subroutine 7.


food for thought
james


so maybe i can explain it a bit clearer. the machine has 7 'setpoints' per-say.

so when you hit START you get to go through those setpoints 1-2-3-4-5-6-7. done.

if you hit GO HERE you are hitting those same setpoints, but only needing to go 1-2-3. done.

the way i have it written now i determine which button was hit by a seal in circuit in the logic. so if you hit START that sets a START RUN bit and then steps through its own index to tell you where you are within that sequence. Same thing applies for the GO HERE sequence. what i was unsure of was having to use two different sequences that both could in turn set the same bit to move the machine to say setpoint 1.

xic---(start sequence step index)EQU--------OTE
|
xic---(go here sequence step index)EQU---

the more i type it out and read my code i think what i did is the clearest in regards to being able to 'follow' each sequence separately if need be. but again i was just curious of other opinions, the JSR idea crossed my mind but i didnt see it through as of yet.
 
I would first draw it out in SFC/GRAFCET, and consider "done" as step 0.

the basic sequence stays the same, but after step 3 - when "START" is high, you got to step 4 and when "GO HERE" is high, you branch to step 0 (done)

maybe an extra step to unseal/reset the "START" and "GO HERE" flags
 
I recently wrote a program with a similar situation, where I had multiple sequences with overlapping steps. I started out with them combined, but in the end revised the code so that each sequence was separate because I felt like it was easier to read and troubleshoot (this was in ladder). I've seen it done both ways though, I'd agree that there's no real right way.
 
Can't you instead have one sequence and at the end of step 3 decide whether to go on to step 4 or complete the sequence based on which button you pushed to start it?

This is, in my opinion, a lot clearer as there would only really be one sequence to take care of (assuming the steps will always be the same).

Which is basically what wimpiesplc wrote.
 
I would first draw it out in SFC/GRAFCET, and consider "done" as step 0.

the basic sequence stays the same, but after step 3 - when "START" is high, you got to step 4 and when "GO HERE" is high, you branch to step 0 (done)

maybe an extra step to unseal/reset the "START" and "GO HERE" flags

This is what I would do
 
I recently wrote a program with a similar situation, where I had multiple sequences with overlapping steps. I started out with them combined, but in the end revised the code so that each sequence was separate because I felt like it was easier to read and troubleshoot (this was in ladder). I've seen it done both ways though, I'd agree that there's no real right way.

this was my initial thoughts as well. keeping the different sequences separate for ease of troubleshooting. But I also get the idea behind the single sequence with just different stopping or starting points.
 
this was my initial thoughts as well. keeping the different sequences separate for ease of troubleshooting. But I also get the idea behind the single sequence with just different stopping or starting points.

How easy to troubleshoot is it when you're looking at the wrong sequence?

Of course, two sequences have the advantage that if in the future they are to be different, the code is halfway there.

On the other hand, any change to the sequence will require two modifications.
 
Can't you instead have one sequence and at the end of step 3 decide whether to go on to step 4 or complete the sequence based on which button you pushed to start it?

This is, in my opinion, a lot clearer as there would only really be one sequence to take care of (assuming the steps will always be the same).

Which is basically what wimpiesplc wrote.

The above is the way i acomplish this, whenever it comes up.
 
If it is a true sequence then use a sequence word for example start puts a 1 in the sequence word, compare to 1 to run the sequence (routine), at the end of the sequence increment the word to 2 & so on until say last sequence.
To start a sequence of say 3,4,5. On the press of other button put a 3 in the sequencer and set a bit, when the sequencer runs and gets to seq. 5 at the end of seq. 5 test the bit and exit (put the sequencer back to 0).
Or if you need a more complex one you could put values into an array. i.e. 1,3,6,4,5,0 or 1,2,3,4,5,6 or 5,3,4,2,0,0 and increment the array, this will run the sequence number in order of the values in the array you would need to test for unused values in the array to end the seq. if 0 is found.
 
thanks for all of the suggestions!

i have it setup right now with step index's for each sequence depending upon what button is pressed. But the more i test, and the more 'can it do this too and then what if we stop it can it go to here' that i keep getting requests for, the more i think i will need to take a step back and re-evaluate what i need to do from scratch. I like James Mcquade's angle of attack, i think that leaves me the most open for interpenetration in the field at final setup.
 
I used the step sequencer on a pallet strap machine, due to varying customer requirements, speed etc. it required different sequences depending on the pallet type, size & various other parameters. These were determined by sensors for example length, number of runners, blind or open (if blind bottom of pallet had continuous running boards or if open only top boards) this determined if swords to apply strap were used, if not blind then feed straps without swords or if blind then swords inserted to feed strap between runners. size determined if one or two out of three strap positions used, rotation to strap both ways & the list goes on. The solution I posted earlier worked a treat it also had to position the pallet depending on the length, width of the runners.
I created many routines for each function including moving back/forward if sensors detected feed area was blocked on a go forward/back a couple of times & alarm if routes not clear. I can't remember how many routines I had to create but written long hand it would not fit into the PLC memory and meant reproducing similar logic for many routines. All known functions were called via a recipe arrays of types coded into memory i.e. 1,5,1,3,4 and each number represented the routine to run so some routines ran more than once and in the order of the array. It also meant that a recipe could be added if another type of pallet was introduced, providing that the function was available.
 
Jzerb,

in any machine, and I mean any machine!
you have to have manual controls to reset the machine to the home position and clean it out or restart the operation.

what I was talking about was the following and maybe you understood.

if start and not go there
jsr seq 1
jsr seq 2
jsr seq 3

jsr seq 7
cycle end
wait for next start instruction.

if start pb and go there
jsr seq 2
jsr seq 3
jsr seq 4

cycle end
wait for next start instruction

as I said earlier, you must have manual logic to home the machine AND in the proper order to prevent you from tearing up the machine.

I saw a machine that cost 2.5 million tore to pieces when the company lost power and when power was restored, they hit the home button per the instructions. everything went home all at once and did $250k in damage and took 9 months to rebuild. the programmers were fired by the oem and the oem was not happy having to pay the repair costs and lost revenue bill.

james
 

Similar Topics

Hi guys, I have a sequence for my water treatment units and I'm running it with a "sort of" state machine. I say that because I'm not sure if...
Replies
5
Views
1,958
Its a silly question but I wonder if anyone else experience this... Our plants make thermostat devices, almost all of its parts made in house so...
Replies
21
Views
598
Hi I am wondering if the RXI-042 PLC model (below PN) is programable via Proficy Machine Endition, if so, what is the firmware version needed for...
Replies
2
Views
60
Hi all, I'm having trouble solving a problem I've been working on for several months, and thought you might like a stab at it. The machine runs...
Replies
22
Views
840
I have an issue. I am trying to resolve what logic is in a 90-30 PLC (364 CPU). I have 3 Machine Edition backups with different names. All show...
Replies
2
Views
139
Back
Top Bottom