Sequence Question

jthornton

Member
Join Date
Jul 2002
Location
Poplar Bluff, MO
Posts
295
I'm having a vapor lock in my brain today, if any one can point me in the correct direction thanks a million...

I have two cylinders that have four different states
The valves are single coil with the Idle position being the output is off.

Cylinder Idle S1 S2 S3
Minor In Out In Out
Major Out In Out Out

I am having a brain lock on how to best code this. I'm using a bit to call for each state and a bit to respond that a state is ready.

The processer is AB SLC500/01 1747 L511 using RSLogix500.

If anyone has any examples or hints to get me out of this rut please help.

Thanks a Million
John
 
Also each cylinder has a magnetic switch on each end.

The general sequence is:

Set bit for Goto Stage 1
Move cylinders as needed
When cylinders are in position set bit for Stage 1 ready &
reset bit for Goto Stage 1

Set bit for Goto Stage 2
...
 
I would write it just the way you wrote it; in stages. Assuming this is a cyclic system and you always want to start-up prepared to go into stage 1, I would use a register value that is set to 0 on start-up.

When your set bit for stage 1 goes high, set the register value to 1. So long as the register is set to that value, execute the logic you described. Once everything is in its satisfied state, enable going to stage 2. Repeat this for each stage.

At the end of the cycle (stage 4 is satisfied in your example), reset the register value back to 0 and wait for the stage 1 set bit again.

I like this type of programming because it allows you to easily see what state you are in at all times and you can put almost all of the pertinent logic in the same place. It often makes for redundant programming, but I think it is worth it.

Steve
 
John,

That's a good way to do it. One point--latches make it easy, as you latch the at stage one bit, unlatch the move to stage 1 bit. Then when you examine some event to to latch the move to stage 2 bit, unlatch the at stage one bit, etc. Also, use the xic of the present state while looking for the evnt for the next. I.E.--if moving to stage 2 and at stage 2 LS, latch at stage 2 and unlatch moving to stage 2. It really helps to organize the logic. If you group the latch bits into words, it makes it easy to clear them all, if you need to, by wrting zero to that word(s). I write all my step type logic with latches.
 
Hi John,

Thanks for the reply. I think that between the last two anwsers I have the 99% of the idea.

Do you have a bit of code you can send me that I can look at for style and form?

Thanks a million

john paley said:
John,

That's a good way to do it. One point--latches make it easy, as you latch the at stage one bit, unlatch the move to stage 1 bit. Then when you examine some event to to latch the move to stage 2 bit, unlatch the at stage one bit, etc. Also, use the xic of the present state while looking for the evnt for the next. I.E.--if moving to stage 2 and at stage 2 LS, latch at stage 2 and unlatch moving to stage 2. It really helps to organize the logic. If you group the latch bits into words, it makes it easy to clear them all, if you need to, by wrting zero to that word(s). I write all my step type logic with latches.
 
I'll go deeper as work schedule permits - but first things first -

you don't have any logic to turn on the S1_GOTO, S2_GOTO, S3_GOTO bits - so the sequence won't advance as written. You have UNLATCHES to turn them off - but nothing to LATCH them on.

Basic ideas look sound though.

Also, S:1/15 turns on S0_GOTO. That means that this sequence is going to automatically start up every time the processor goes into run mode. Is this what you intended?

I'm offline until tomorrow - but there are plenty of guys here to help.
 
Last edited:
I think you're making your code to hard.

Think in terms of STEPS and TRANSITIONS, and ACTIONS.
You kind of have that with your "READY" and

STEP CODE:

STEP_X TRANS_A other Transitions STEP_X
---| |--------| |--- (. . .---| |--- . . .)---+-----(U)
|
| STEP_Y
+-----(L)




You would repeat the above for each step in the sequence.
"IF I'm on Step X, and the transition happens, leave step X and go to step Y"
If you use consecutive numbered bits (B3/0 = Step/State 0, B3/1 = Step/state 1, it's easier to follow.


INDEPENDENTLY, define your transitions.

CYLINDER A CYLINDER B SYSTEM IS IN
IS RETRACTED IS RETRACTED STATE 0
-----| |-------------| |------------( )


CYLINDER A CYLINDER B SYSTEM IS IN
IS EXTENDED IS RETRACTED STATE 1
-----| |-------------| |------------( )



and so forth
If that's how they are supposed to be (I'm not carefully checking)
You may want to have the status of all 4 limit switches define a state.

Again, sequentially numbering the bits but in a different B-file (say B13) makes it easy to follow.

Use these coils as the TRANSITION contact(s) in your sequencer.


Now for the ACTIONS.
This you have (I'm posting it for the lurkers & those who don't have RSLogix)

STEP_0 CYL_A
---| |---+-----( )
|
STEP_2 |
---| |---+


STEP_1 CYL_B
---| |---------( )




<HR>

Ron's analysis of your GOTO bits is correct. Also, your READY bits don't Do anything (other than latch and unlatch) - you aren't using their contacts.

If you were to combine them, then you'll pretty much have what I've got above, and your sequencer will take off.

The next question is - how will you stop it?
 
Thanks so much for every reply. I will study each one carefully. The GOTO bits are latched in another area of the program. I didn't want to upload too big of a program just this part. But, I can upload it all if anyone cares to comment on it when I am done.

Basicly this part is controlled by the main ladder. I just used the 1500 as it is sitting on my desk and I manually simulated the calling of the steps.

State 0 is the power up state so on first scan I am going to state 0 and zeroing out the B3:0 word. Then this part of the code just waits for a call to go to state 1,2, & 3.

Allen Thanks for the indepth anwser, I will study it tonight and try and upload the code that I get from that.

Thanks a million guys you guys are the greatest
John
 
J,

I really couldn't decifer the sequence as you described it. I'm sure the other guys were just generalizing... at least, maybe, until they saw your AB file, which I can't look at. I don't do AB. I do PLC's. (Flame Shields Up!)

At any rate...
This is one of those situations where it is best to look at the process backwards... that is, under what conditions do you want...

Cyl-1 Extended...
Cyl-2 Extended...
Cyl-3 Extended...
Cyl-4 Extended?

You indicated that the Cylinder Valves are ON/OFF = EXT/RET (I think).

It's easy enough to build a simple table...

Stage-1 Stage-2 Stage-3 Stage-4 ... Stage-X
+---------+---------+---------+---------+-->
EXT Cyl-1 | ON | OFF | OFF | OFF |
+---------+---------+---------+---------+-->
EXT Cyl-2 | OFF | ON | OFF | OFF |
+---------+---------+---------+---------+-->
EXT Cyl-3 | OFF | OFF | ON | ON |
+---------+---------+---------+---------+-->
EXT Cyl-4 | OFF | OFF | OFF | ON |
+---------+---------+---------+---------+-->




If EXT Cyl-X is ON, as defined by the particular stage, then turn ON Cyl-X.

So, if Stage-X, or Stage-Y, or... then EXT Cyl-X, -Y?, -Z? Turn ON whatever is required by the particular Stage.

When you "see" that Stage-X has been accomplished (reading your reed-switches), change stage numbers.

That is, if "Do Stage-X" and "IS Stage-X", then RESET "Do Stage-X and SET "Do Stage-Y"

Controlling the actual outputs is the easy part...

If Stage-1, then Cyl-1 and Cyl-?
If Stage-2, then Cyl-2 and Cyl-?
etc...

The harder part, which ain't hard at all, is to determine the current "Stage".

You somehow determine that you need to begin the sequence; fine.

Then it becomes a matter of calling for a "Stage" and then verifying that the Stage has occurred. Once the Stage has occurred, quit calling for that particular Stage and then call for the next Stage.

Now, assuming that there are four cylinders, Cyl-1, -2, -3, and -4 and each cylinder is called "individualy" in sequence, that is,

Cyl-1 Ext, then
Cyl-1 RET, and Cyl-2 Ext, then
Cyl-2 RET, and Cyl-3 Ext, then
Cyl-3 RET, and Cyl-4 Ext, then, the code looks like this...

initializing code ---> "Do Stage-1"

If "Do Stage-1" and "IS Stage-1" then
RST "Do Stage-1"
SET "Do Stage-2"

If "Do Stage-2" and "IS Stage-2" then
RST "Do Stage-2"
SET "Do Stage-3"

If "Do Stage-3" and "IS Stage-3" then
RST "Do Stage-3"
SET "Do Stage-4"

If "Do Stage-4" and "IS Stage-4" then
RST "Do Stage-4"
SET ...... "Done"???

This comment isn't any better than some of the others, but it might give some insight to other lurkers.

You certainly can use "words" if you want to for the "cute" effect, but you can also use simple control relay bits for the same effect and they will be easier to troubleshoot. That is, the "status" will be easily apparent!
 
Allen if you have the time to check out the attached text file let me know if I have the big picture you are talking about as far as:

Steps
Transitions
Actions

The portion of the code in the RSLogix file will make more sense when you look at the total operation of the machine as outlined in the text file.

Again Thanks So Much for your time and help

John
 
Terry,

I'm sorry I should have uploaded a jpeg as well of the ladder.

Here it is.

BTW, what types of PLC's do you program?

I programed Automation Direct for a few years...

Thanks for the time to sent the great reply.

John
 
These days, I do the TI-505 Series and the Siemens S7-200 Series.

The S7-200 series is a TI spawn - Siemens bought out TI. The S7-200 Series was developed by TI while the S5 and S7-300, -400 are definately Siemens creations (it is self-evident).

I've done AB (long ago), Telemechanique, GE, and ... some other little guy that I can't remember.... oh yeah, OMRON!
 
jThorton,

I saw your post to PERSPOLIS.

Is this what you mean? If so, now things are clear(er).


Cylinder Idle Stage-1 Stage-2 Stage-3
+------+-------+-------+-------+
Cylinder-1 | In | Out | In | Out |
+------+-------+-------+-------+
Cylinder-2 | Out | In | Out | Out |
+------+-------+-------+-------+


.
To build a table, preface the table with the word "LADDER" (without the quote marks) surrounded with square brackets. After the Table, add "/LADDER" in the same manner.

Refer to the formatting buttons above the "New Post" or "Your Reply" window.

Now that I understand what you are trying to do (sorta), if "IN" means "Retracted" = "OFF", and "OUT" means "Extended" = "ON", then...

Cyl-1 = Stage-1 -OR- Stage-2
Cyl-2 = Idle -OR- Stage-2 -OR- Stage-3

That is... (I'm using that "LADDER" thing I told you about, with "BOLD" and Font Size control)...


Stage-1
---| |----+-------(Cyl-1)
|
Stage-2 |
---| |----+


Idle
---| |----+-------(Cyl-2)
|
Stage-1 |
---| |----+
|
Stage-2 |
---| |----+





Now, if indeed, "IN" means "Retracted", and "Out" means "Extended"...

I see the "end-point" of your cylinder-stack (I have to assume that you are talking about a cylinder-stack) doing one of two sequences...

Sequence-1:
Start at Point-A, then Retract, then return to Point-A, then Extend beyond Point-A.

Sequence-2:
Start at Point-A, Extend to Point-B, then Retract to Point-A, then Extend beyond Point-B.

As you have described it... AND if your "stages" proceed in order, AND if your cylinders are plumbed to be Retracted if OFF, then it has to be one of those two sequences .

Is one of those sequences the one you are trying to do?

I must also indicate that you actually have "5" positions! Both cylinders retracted is a valid position. That is, on "Start-Up", it is most likely (100% likely if they Extend under power) that BOTH cylinders will be retracted! This means that you have to do something to bring the cylinders to what you call the "IDLE" position.

When I see "IN" and "OUT" I can't tell if those terms are being used relative to the Cylinder or to the Local Area where the Cylinder is being used - as in... "the Cylinder is IN the Jaw". This might mean that the cylinder is Extended or Retracted... depends!

I did see your info indicating that "IN" meant "RETRACTED"

Your Table could have been made more clear by using "EXTENDED" & "RETRACTED".


Cylinder Idle Stage-1 Stage-2 Stage-3
+------+-------+-------+-------+
Cylinder-1 | RET | EXT | RET | EXT |
+------+-------+-------+-------+
Cylinder-2 | EXT | RET | EXT | EXT |
+------+-------+-------+-------+


.
But then, whether a Cylinder is Extended or Retracted Under Power depends on the plumbing!

Now, in terms of controlling the Outputs to Cyl-1 and Cyl-2, your Table could have been made even more clear by using "ON" & "OFF".


Cylinder Idle Stage-1 Stage-2 Stage-3
+------+-------+-------+-------+
Cylinder-1 | OFF | ON | OFF | ON |
+------+-------+-------+-------+
Cylinder-2 | ON | OFF | ON | ON |
+------+-------+-------+-------+


.
 
Last edited:
I was wondering how you did the ladder thing.

This is seperate cylinders. I have two cylinders connected to the same valve that close the minor flaps on the box and one that closes the major flap on the case. The minor flap cylinders extend first then the major flap cyl then the minor flap cylinders retract and the case is ejected. Then the major flap retracts after the case clears the station.



output off on
cyl 1 retracted extended
cyl 2 retracted extended



This is the ladder for the flap closers following Allen's advice on format and style (I think). Let me know what you think.

CLOSER_START is latched by the indexer code when the case has been lowered down and has been filled with product.

ladder1.jpg

ladder2.jpg
 

Similar Topics

This should be a pretty easy question, would just like to have it explained a bit so I can understand it. In the attached program, why does the...
Replies
15
Views
4,713
Hello, I need to write the following program in Ladder language, but I could not integrate the Fibonacci sequence into the ladder. Can you help...
Replies
16
Views
208
To sequence through multiple MSG instructions with a Studio 5k program what are some preferred methods?
Replies
6
Views
519
Hi everyone, I am a newbie and I have trouble in the control sequence. I have a system with 4 pumps. The required: Ex: Push a button to start in...
Replies
21
Views
2,769
Hello, I am having some trouble trying to use Port 2 on the direct logic (250-1) for K-sequence. I am trying to use RS-232, I have a breakout...
Replies
0
Views
552
Back
Top Bottom