How would you solve this control problem?

Join Date
Apr 2002
Location
No income tax, no capital gains tax. Freedom!
Posts
8,351
Let me start by saying I already know how. I was wondering how others would solve this problem.

Assume you have a machine control application that requires a motion controller and a light curtain. The machine executes the same sequences of steps or state every cycle or part. Also assume there are many simple moves that must be made so there are many states.

What do you do when someone breaks the light curtain? Obviously the motion must stop, the real question is how do you restart the state machine or step sequencer? SFCs, sequential function charts go from one step to another when a transition is satisfied. This doesn't seem adequate to solve this problem. Do SFCs have the concept of interrupts? I have the IEC 61131-3 specifications and I don't see interrupts mentioned. Maybe they are just an extenstion.

When the light curtain breaks the current state machine or SFC must be stopped but how do you restart the sequence? From what I have seen this is not possible without starting over. Ideally it would be best if the state machine or SFC could be restarted at the current step or actually back at the last motion command so the motion command will be re-issued. This need to go back to the last motion command means that and interrupt is not going to work because an interrupt will restart where it was interrupted which is probably waiting for the in position bit to be set which will never happen now that the motion is stopped.

What I am looking for are really clean/simple solutions. I don't want to taint the ideas with mine so I will keep mine to myself right now. I am a little concerned that my solution will require unfamiliar concepts.
 
Humm what do you mean by ligth curtain broken? and if the curtain broke ( sequence stopped) at certain stage, does it require a specific way of rolling back or restarting or u could just jump to first state from any point? :)
 
The devil is always in the details, and the details will vary from one manufacturer's implementation of SFC to another's.

When I do a sequential operation in ladder logic I include a "Paused" condition. If the sequence is paused, no state transitions are possible and hardwired outputs are turned off. A "Resume" command takes the sequence out of the paused condition and allows resumption of the sequence. I also include an "Abort" condition that requires that all elements be returned to a known state and the sequence can only start from the beginning. Some abnormal conditions drive the sequence to the paused condition, others drive it to the abort state.
 
I would program my own Step Sequencer. The current step (number) would be remembered. A restart would simply activate the current step including issueing any commands and waiting for that steps completion conditions.
 
Humm what do you mean by ligth curtain broken?
I should have said the light curtain beams.

Steve Bailey said:
A "Resume" command takes the sequence out of the paused condition and allows resumption of the sequence.
Assuming the pause condition stops the motion controller too, how does the resume command know how many steps to go back to restart the motion? The motion profile could be started a few steps previously and different steps were triggered as the motion controller passed different positions.
 
well i can only thing of state machine where u keep checking the condition and if the condition fails u follow a backward path to get to starting state
seems like u need some sort of memory to keep track what state are u in.
statedz6.jpg
 
Assuming the pause condition stops the motion controller too, how does the resume command know how many steps to go back to restart the motion?
If the motion controller allows has a feedrate override feature, you might be able to use that. Essentially it tells the axis to execute the current move command at zero velocity. I'm not sure if that would be in compliance with safety regulations though.
 
It would help to know what the "state machine or step sequencer" is, Peter. Assuming this "step sequencer" is the one telling the motion controller(s) when and where top move, it should be quite simple.

Everyone has their own version of sequencer logic, but within it, you need to have some sort of an "OK to continue to the next step" bit in every step. The light curtain controls this enable bit. That way, the program will pause in the current step when the curtain is broken. Of course, the light curtain is also tied into the safety circuit as well.

Here's a rework of the 'simplified' version of my sequence logic from THIS post, to include this 'enable' bit...

|
| STEP 1 IN CYCLE
|----] [------------------------( S )
|
| COMPLETE IN CYCLE
|----] [---+--------------------( R )
| |
| RESET |
|----] [---+
|
| STEP 5 STEP 5 DONE COMPLETE
|----] [-------] [--------------( S )
|
| IN CYCLE COMPLETE
|----]/[---+--------------------( R )
| |
| RESET |
|----] [---+
|
| STEP 4 STEP 4 DONE ENABLE STEP 5
|----] [-------] [-------] [----( S )
|
| COMPLETE STEP 5
|----] [---+--------------------( R )
| |
| RESET |
|----] [---+
|
| STEP 3 STEP 3 DONE ENABLE STEP 4
|----] [-------] [-------] [----( S )
|
| STEP 5 STEP 4
|----] [---+--------------------( R )
| |
| RESET |
|----] [---+
|
| STEP 2 STEP 2 DONE ENABLE STEP 3
|----] [-------] [-------] [----( S )
|
| STEP 4 STEP 3
|----] [---+--------------------( R )
| |
| RESET |
|----] [---+
|
| STEP 1 STEP 1 DONE ENABLE STEP 2
|----] [-------] [-------] [----( S )
|
| STEP 3 STEP 2
|----] [---+--------------------( R )
| |
| RESET |
|----] [---+
|
| START IN CYCLE ENABLE STEP 1
|----] [-------]/[-------] [----( S )
|
| STEP 2 STEP 1
|----] [---+--------------------( R )
| |
| RESET |
|----] [---+

Recovery from the pause depends on what occurs at each step. With some steps, it might make more sense to finish the current motion. In others, it might make more sense to move back to the beginning of the motion. In either case, the sequencer never misses a beat. I would probably finish (or return to the start of) the motion at a slow speed, but again, that depends on what's happening.

🍻

-Eric
 
I don't use the PLC manuf SFC - I find that they are too restrictive in sequence recovery (to say nothing about bubba looking at it later). Like John Gaunt and Steve Bailey I would use ladder.
Usually I find that I need a "Master" sequence that controls the overall machine steps. This Master seq is not usually reset when the "light curtain" (safety relay) trips, it is however usually paused (like Steve Bailey). I usually use a slave seq for each axis. The slave Seq has all of the step recovery programming - e.g. finish existing move at slow speed. Note: The slave sequence is reset when the safety trips.
I have not yet had to program motion where the controller had to "backup" so that the motion velocity profile was correct. A quick design would be Master seq holds Start and Stop positions for each step and the slave goes to the start position first - Waits for all the other axis to catch up then all axis redo the move and master sequence then takes control. Again all machine dependant.

Another method that I have used with sucess is a virtual axis (Controllogix platform) - The virtual axis Stops when the safety trips (in this example). The slave axis's are Cammed to the virtual. On recovery the slave axis use the virtual axis and the CAM to go to the correct location for restart.

I know that there situations where more recovery effort is required eg a CNC tool moves about a work piece and the recovery move must be sequenced to not go through the work piece but I have not had to program them yet. That said I have had coordinated recovery requirements where 4 interlocking axes had to sequence themselves to recover.

Looking at what I have said I suppose that they all could be programmed using Master and slave SFC's (poor bubba).


Mike
 
The trick is restarting the motion in an intelligent way

well i can only thing of state machine where u keep checking the condition and if the condition fails u follow a backward path to get to starting state
seems like u need some sort of memory to keep track what state are u in.
The goal is not to restart at the beginning. In some cases this means a lot of scrap. If one can continue without trashing the parts in progress one saves time and parts. This can be worth a lot.

Yes, the state machine would keep track of the the current state.

f the motion controller allows has a feedrate override feature, you might be able to use that. Essentially it tells the axis to execute the current move command at zero velocity. I'm not sure if that would be in compliance with safety regulations though.
I like that idea. This is similar to an idea that I had about slowing down time to a stop. Your idea is simpler but not as flexible. However, it would just require a change velocity command. The good thing is that it your idea wouldn't require a lot of programming in the state machine. I think your idea or mine is the simplest way for the programmers.

Eric the basics of state machines are known. The trick is restarting the state machine or, as discussed in my reply to Steve, not have a special pause state but just have a way of scaling the motion controller down to 0% speed and then resuming 100% speed when everything is OK.

I don't use the PLC manuf SFC - I find that they are too restrictive in sequence recovery (to say nothing about bubba looking at it later). Like John Gaunt and Steve Bailey I would use ladder.
I think this can be done in SFC much easier than ladder. Ladder programming is good for things that must be scanned all the time. Making a a state machine can be done, as Eric has shown, but SFC are a natural.

Usually I find that I need a "Master" sequence that controls the overall machine steps. This Master seq is not usually reset when the "light curtain" (safety relay) trips, it is however usually paused (like Steve Bailey).
Yes, but the motion controller must be stopped and restarted. What if the axis ramps down but passes some position threshold or hits some limit switch that should cause the state machine to go to the next state even while paused?

I usually use a slave seq for each axis. The slave Seq has all of the step recovery programming - e.g. finish existing move at slow speed. Note: The slave sequence is reset when the safety trips.
I have not yet had to program motion where the controller had to "backup" so that the motion velocity profile was correct. A quick design would be Master seq holds Start and Stop positions for each step and the slave goes to the start position first - Waits for all the other axis to catch up then all axis redo the move and master sequence then takes control. Again all machine dependant.
Yes, but this is getting very complex. It seems that no standard program will do.

Another method that I have used with sucess is a virtual axis (Controllogix platform) - The virtual axis Stops when the safety trips (in this example). The slave axis's are Cammed to the virtual. On recovery the slave axis use the virtual axis and the CAM to go to the correct location for restart.
Yes, this is similar to what Steve and I suggested above. I like this idea too but this requires the customer to make cam tables. We actually have a better method than cam tables, but the commands are not simple point to point moves. I like the idea of slowing down the point to point moves to a stop.

I know that there situations where more recovery effort is required eg a CNC tool moves about a work piece and the recovery move must be sequenced to not go through the work piece but I have not had to program them yet. That said I have had coordinated recovery requirements where 4 interlocking axes had to sequence themselves to recover.
Now you are getting into the very complex but I need to solve that too.

Looking at what I have said I suppose that they all could be programmed using Master and slave SFC's (poor bubba).
Bubba doesn't have a chance with the cam tables either. SFCs done right make performance and debugging easier.

So far I like the idea of slowing down time to a stop or scaling the velocity down to 0%.

I am asking this because some of our customers have asked this question and we are trying to find the easiest solutions. At this time we need to add a pause step for every normal step. This doubles the program length and chances for errors. I will see if I can provide an example tomorrow.

BTW, pausing and starting relative moves gets tricky.
 
Since I am THE BUBBA that resides here I have a few things to say.

I believe, for the most part, that every system (now) should have an HMI (or something) and code incorporated to pretty much deal with all failed conditions. Basically us Bubba's of the world should not need to go into the program.

Technically state machine could apply to any machine because for the most part they have to perform an action before the next action takes place.

Since I am not proficient with SFC and other languages all I can do is revert back to IF, THEN, ELSE. IF conditions are OK, THEN goto next step, ELSE if conditions not OK...STOP

It depends on the situation what happens from there, due to inertia etc involved with motion control you may have moved past that step. If you can make the conditions OK for that step then you should be able to restart and to go to the next step OR be allowed to go back to any step that the sequence conditions can be OKed OR abort and start from the beginning.

Speaking as a Bubba I have faith in most of y'alls capabilities. It may cost more but in the end may be more proficient. How does it go? We have the technology, Better, Stronger, Faster.

Just my thoughts, like to say something here and there, us Bubba's have to keep y'all on your toes.
 
One thing to keep in mind is a light curtain is a safety circuit on many machines, basically causing a "sensed" E-Stop condition that may need to kill all power to outputs and any motion system. If the motion system powers down and homing is necessary, you may not have a choice but to start over from the first step. o_O

On the other hand, if a complete shutdown is not necessary or a motion feedback is used that does not require homing, it is real easy to put the system into a pause state remembering where it was before the incident. When the operator starts the machine again, jump back to the last step which should re-issue any motion commands and you are off and running.

I use state machines a lot but never use the canned approach (SFCs) provided by the manufacturer. I like the lattitude and freedom of my own code. :nodi:
 
If the motion system powers down and homing is necessary
Modern servo systems normally do not loose their home positions during a safety stop. Either the control supply is maintained so all movements are tracked or the they use an absolute feedback device (eg resolver) that does not care if power is removed.

So far I like the idea of slowing down time to a stop or scaling the velocity down to 0%.
Peter - I too like this method. Yet when thinking about the machines I have programmed. The usual reason an operator has entered the machine is to fix something that has gone wrong (product misplacement, jam up). What do you do if while the operator is in the machine an axis is physically pushed (no brake on the servo) - how do you recover? or the operator by pushing has reached and gone past the next limit switch in the sequence?

Note: We are assuming that the machine has been made safe to enter - i.e. Servo loops disabled and mets the local safety code.


Your pause step for each step is a pain - I fully understand why you are looking for solutions.

SFCs done right make performance and debugging easier
Yep key words done right - I am aware of an industrial accident (read the analysis report) where incorrectly used SFC was a contributing factor simply
Cage Hoist with locking tabs when fully raised.
Step 4 - remove lock tabs (hydraulic) with limit checking to confirm removed
Step 7 - much longer delay than usual
Step 8 - lower assuming locktabs removed (as checked in earlier step) however had come off limit (hydraulic problem), cage became hung up, rope payed out onto top of cage (Code problem), became heavy enough to break locktabs (mechanical) -> cage then fell -> jerk load on rope broke connection to cage (mechanical - not installed properly) -> freefalling cage -> Lots of damage, down time etc

I am aware that this problem can occur in any sequence programming - just because the earlier step says "good to go" does not mean that it is still "good to go". However for most of my clients they make onsite changes and ladder is what they are used to, so I program in ladder to reduce the possibility that they do fall into the above trap.
 
One thing to keep in mind is a light curtain is a safety circuit on many machines, basically causing a "sensed" E-Stop condition that may need to kill all power to outputs and any motion system. If the motion system powers down and homing is necessary, you may not have a choice but to start over from the first step.
This is why I am a big fan of SSI absolute encoders. One should always use absolute encoders if homing means the production line must be cleared and the products scrapped. The return on investment is high.

One must also have a good way of programming this. I think have the best solution now.
 
Peter Nachtwey said:
When the light curtain breaks the current state machine or SFC must be stopped but how do you restart the sequence? From what I have seen this is not possible without starting over. Ideally it would be best if the state machine or SFC could be restarted at the current step or actually back at the last motion command so the motion command will be re-issued. This need to go back to the last motion command means that and interrupt is not going to work because an interrupt will restart where it was interrupted which is probably waiting for the in position bit to be set which will never happen now that the motion is stopped.
On the A-B platforms that support SFC's (PLC5 & ControlLogix), the default restart method can be set to either "initial step" or "last active step". In addition, there are ladder instructions (SFR, SFP) which allow for halting execution of the SFC and restarting at any desired step.

The logic for deciding where to restart depending on where the stop occurred is going to be application specific.

There's also the scenario where an operator switches an automatic sequence to manual (stop) for whatever reason, moves or jogs the system perhaps part way through the sequence, then switches back to auto, presses start and the sequence resumes at the correct point. For this scenario, the PLC5 SDS instruction was particularly useful. SFC implementation is possible but requires separate analysis of relevant inputs to determine the restating point - all of which is built-in to the SDS.
 

Similar Topics

We switched from a SLC5/04 to a 5069-L320ER, and the SLC's NI4's were replaced with the 5069-IY4, which is a pretty neat card; however, the IY4's...
Replies
3
Views
1,712
First time posting. I'm just a mechanical engineer trying to be a programmer so bear with me on some potentially stupid questions. I'm attempting...
Replies
4
Views
4,168
Hello, I'm creating a small application to operate a valve on an existing application between a CompactLogix and a FTView SE instance. I...
Replies
4
Views
1,414
Replies
49
Views
10,595
please help i didn't solve this problem with rslogix. I counted but i am not using timer. How i will fix this situation? Please anyone solve this...
Replies
18
Views
4,875
Back
Top Bottom