panic mode
Member
Ok here is one more idea, just to cover the topic.
a) I use different approaches depending on situation but one I really like to use
is one with an integer (show me PLC that doesn't have it) to count steps.
This is VERY convenient for HMI and prompts to operator (multistate indicators),
program looping, jumps etc.
b) Next I convert the integer into bit-sequence (DCD instruction in RSL500,
XPY or CPT in RSL5K, DECO in Mitsubishi etc.). Bits are just so much more
convenient in RLL that "EQU N7:5 13". As a bonus bits are much easier to
watch online, every PLC editor I used so far highlights them when they "pass signal"
while only some will do the same for any instructions (shame on AB and RS for this...).
It is usually easy to improvise with bit shift instructions or data tables if particular PLC
doesn't already have something like DECO...
Anyway this bit sequence (destination) is called "Initiate Sequence Step" (just remember it for now).
c) Write bunch of rungs of type:
Now, here is some example of what I had in mind. I will use AB sintax just because
this is what hopefully most of readers are familiar with:
And that was the portable sequencer (without masked moves and SCO
so every electrician will be more than happy to work with it... - just about
everything is plain old Relay Ladder Logic).
Oh, and how do you turn an output with it? Well consider the
following two rungs (ok, it's simplified to please the audience
and keep this post short when posiible ):
regards
a) I use different approaches depending on situation but one I really like to use
is one with an integer (show me PLC that doesn't have it) to count steps.
This is VERY convenient for HMI and prompts to operator (multistate indicators),
program looping, jumps etc.
b) Next I convert the integer into bit-sequence (DCD instruction in RSL500,
XPY or CPT in RSL5K, DECO in Mitsubishi etc.). Bits are just so much more
convenient in RLL that "EQU N7:5 13". As a bonus bits are much easier to
watch online, every PLC editor I used so far highlights them when they "pass signal"
while only some will do the same for any instructions (shame on AB and RS for this...).
It is usually easy to improvise with bit shift instructions or data tables if particular PLC
doesn't already have something like DECO...
Anyway this bit sequence (destination) is called "Initiate Sequence Step" (just remember it for now).
c) Write bunch of rungs of type:
initiate_stepN some_condition stepN_complete
--------| |--------------| |-----------------------( )
Now, here is some example of what I had in mind. I will use AB sintax just because
this is what hopefully most of readers are familiar with:
N7:0 - Step_Counter (0-15)
B3:0 - Initiate_Step (0-15)
B3:1 - Step Complete (0-15)
B3:2 - Temporary (Step Complete Check)
// (a) Use step counter
// You will need to Reset it once in while...
firstscan
S:1/15 step_counter
----| |------------------+-------------[CLR N7:0]
|
reset |
I:2/0 |
----| |------------------+
|
last_step_done |
B3:1/12 |
----| |------------------+
// Check if last step was completed
auto_cycle init_steps steps_complete step_counter step_counter
---| |----------[EQU B3:0 B3:1]-----------------[ADD N7:0 1 N7:0]
// When last step is completed move to next step
// Note: it is possible to run backward sequence but I'm not going
// to show it here (hint : try to decrement counter)
// Jump to any step when needed (step 4 in this case)
// (this is optional and just an example)
Some_condition step_counter
----| |------------------------------[MOV 4 N7:0]
// Note you can add as many jumps as you want (see above) but
// well planed program will have none or very few ones.
// If you really (!) need more, consider using multiple sequencers
// And we are done... so let's do the next ting:
// (b) Lets's do the decoding
"always_on" step_counter init_steps
---| |---------------------------------[DCD N7:0 B3:0]
// Now that was simple. What is left is individual step conditions (c):
// Please note that first and last instruction use same bit (part of the
// address after "/"
init_step.0 step_done.0
B3:0/0 some_condition0 B3:1/0
------| |-------------| |----------------------------( )
init_step.1 step_done.1
B3:0/0 some_condition1 B3:1/0
------| |-------------| |----------------------------( )
init_step.2 step_done.2
B3:0/0 some_condition2 B3:1/0
------| |-------------| |----------------------------( )
init_step.3 step_done.3
B3:0/0 some_condition3 B3:1/0
------| |-------------| |----------------------------( )
init_step.4 step_done.4
B3:0/0 some_condition4 B3:1/0
------| |-------------| |----------------------------( )
// Etc. (...)
init_step.12 step_done.12
B3:0/12 some_condition12 B3:1/12
------| |-------------| |----------------------------( )
And that was the portable sequencer (without masked moves and SCO
so every electrician will be more than happy to work with it... - just about
everything is plain old Relay Ladder Logic).
Oh, and how do you turn an output with it? Well consider the
following two rungs (ok, it's simplified to please the audience
and keep this post short when posiible ):
auto_cycle init_step.2 open_clamp close_clamp
------| |----+----| |----------+-------|/|-----------( )
| |
| init_step.3 |
+----| |----------+
|
manual_mode man_clamp |
------| |---------| |----------+
auto_cycle init_step.1 close_clamp open_clamp
------| |----+----| |----------+---------|/|-----------( )
| |
| init_step.4 |
+----| |----------+
|
manual_mode man_unclamp |
------| |---------| |----------+
regards