S7 Sequence Programming Solution ?

There are many interesting examples here.. :)
I think I´ll go with the integer solution.. I dont have the S7-Graph.. but it sounds very good..

As some of you claims, it is important to leave som space to add more steps in the sequence if more coplexity shows up later in the process.. I think I will try the Integer funktion with some space and the "MOVE" intruction...

Thanks for so many answers.. helps alot..
 
I have a few objections to jump lists.

1. They break the "thou shalt not use GOTO" injunction seen in other programming languages...

JL is more similar to Switch/case then to GOTO but whatever.
When you use Siemens S7-300(in particular to S7-315) its meter what kind of code you use.
End somenting more if you open Graph or HiGraph(which I use at the moment) Stl code you will see that the compiler is using this instruction very often:
Some piece of code:
AABG: L DIW 76
JL AABF
JU AABH
JU AABI
JU AABJ
JU AABK
JU AABL
JU AABM

AABF: SET
L DIW 76
JL AABE
JU AABN
JU AABO
JU AABP
JU AABQ
JU AABR
JU AABS

AABE: L DIW 76
JL AABT
JU AABU
JU AABV
JU AABW
JU AABX
JU AABY
JU AABZ

AABT: BE
 
JL is more similar to Switch/case then to GOTO but whatever.
When you use Siemens S7-300(in particular to S7-315) its meter what kind of code you use.
End somenting more if you open Graph or HiGraph(which I use at the moment) Stl code you will see that the compiler is using this instruction very often:

AABT: BE

You're right, it is more like a case statement in C or VB etc but in the PLC context it is more like a GOTO because unlike programming in a high level language where lines are routinely skipped with IF/ELSE statements, no other conditional jump statements are regularly used in LAD/FBD. I think it's one of the strengths of ladder/FBD etc that each rung is like a little program which executes each scan.
 
Binaural;309310I think it's one of the strengths of ladder/FBD etc that each rung is like a little program which executes each scan.[/quote said:
I consider that to be a flaw because code that is not applicable t to the current state is checked. Ladder isn't efficient. The case statement or JL allows one to avoid executing the code in the other cases or state. This results is faster programs. When thing get stuck you can see what case is supposed to be running and go to that state.
 
I consider that to be a flaw because code that is not applicable t to the current state is checked. Ladder isn't efficient. The case statement or JL allows one to avoid executing the code in the other cases or state. This results is faster programs. When thing get stuck you can see what case is supposed to be running and go to that state.

Ladder logic should compile efficiently, given its simplicity. I had a look but can't find any information on exactly how efficient, but what little I know about what compilers want suggest that it is probably pretty to very good. That we have to optimize it says more about the pathetic performance of the S7 processor than the format of the code. The VIPA processors make it pretty clear that Siemens have been pretty lazy when it comes to improving the performance of their hardware for a long time now.

I disagree on the readability front, as well. As mentioned before using jump lists forces you to use a set/reset structure for controlling that many find more difficult to read, since it spreads these operations out amongst many states.
 
Hi,

Here I am writing Sequencer using S7 JL instruction. It seams Ok to me. Now I am another task to do is doing Multiple Task inside one STEP with subsequenc-that is to be done step by step again. So this will a Sequence within main Sequence. I still dont know the if is possible to use JL instruction within each STEP to do sub-sequencer program!

hi, Peter you are doing good.

Any one can tel me how it can be done?
 
you shouldn’t use integers to control a sequencer, it does not ensure a complete scan of the program whilst changing steps, and if you were here it would be audited and rejected. The correct way is to use a set/reset arrangement, which is upside down in the program. E.g. step 1 is at the bottom of the program, and final step at the top. This ensures a complete scan of the process which offers the security of ensuring every part of the process receives acknowledgment that the step has changed. EG (notice it’s inverted)

a Step2
an step3
reset step2
set step3

a Step1
an step2
reset step1
set step2

a Step0
an step1
reset step0
set step1

Good luck
 
How does it not ensure complete scan of program?

With integers you can use "going to step" and "current step" then at the beginning of program move "going to setp" to "current step" now it always scans once whole progam.
 
See previous post

One more Thing that you need to aware of when writing sequences this way is to use an InputStep register and an OutputStep register.

To test if a step is active use the InputStep Register e.g.

If InputStep = 10 The Step10 = True

When looking for a transition, set the next step value in the Output Register e.g.

If Step10 = True && Transition10 = True then OutputStep = 11

At the end of the sequence, transfer the OutputStep register to the InputStep Register e.g.

InputStep = OutputStep

Using the above method has two real advantages: 1) each step is active for at least one program scan so that its state can be evaluated eleswhere in the program. 2) Only one step is ever active in one scan so that the sequence doesn't zip through 10 steps in one scan.

Hope this is helpful to you.

Nick

Nick
 
you shouldn’t use integers to control a sequencer,

You are, of course, entitled to your opinion but I couldn't dissagree with you more. Perhaps I haven't explained the philosophy adequately so I've attached a simple example as a pdf file. As you correctly point out, it is important to ensure that 1) Only one state is active at any one time and 2)That the sequencer does not skip through multiple steps in one scan.

The attached example is in S7 but the same principles can be used in any PLC.

The input state word is used to determine whether a step is currently active and the output state word is used to set the Next step; Output state word is copied to input state word at the end of the program only.

Using this methodology it becomes quite simple to produce complex sequences with multiple paths that are east to follow / modify.

IMHO, using set/reset instructions for state/transition logic is clumsy and inflexible.

Nick
 
I also disagree with freddofrog. I programmed some time ago seguencer with 17 steps and I used only SR flip flops at first. It was hard to troubleshoot and program was messy, someone would call it to "spaghetti" code.

Eventually I decided to program it again before commission, this time I used integers and exactly same technique than Nick described. Now program is clean and easy to understand, what it wasn't at first time when I used SR flip flops...


Lare
 
Last edited:
Step7 Graph is PERFECT for sequences

Since I have recently gone through this exercise... please take my simple advice. If you are using Step7, and you are not an expert in ladder, FDB or STL, stay clear of using anything, but Graph to develop a sequence. I am not a fan of Step 7 because it it not popular in my industry, or the US in general. However, I am a HUGE fan of S7 Graph after working with it for the past several weeks.

Yes a sequence can be done in ladder. There are people out there that would try to build a web page with ladder before they used something more appropriate. If you are dealing with a 3 step sequence, fine use ladder, but how about 30 steps?

Even for your 3 step sequence...Do you need to display what the sequencer is doing on a SCADA screen?, step number?, step time? pause a step?, skip a step?, acknowledge an alarm? That is possible with ladder, but it is about 50 pages of sketchiness that needs to be debugged like a mad scientist vs. 5-6 pages of S7 Graph logic that is much more certain and understandable. Which one would you like to spend your time trying to debug? You can still develop complex pieces of you programs in ladder, or FB or STL and use Graph to sequence all of those pieces. I wish I had read a post like this a month ago when I was thumbing through my 80 page ladder sequence! What a nightmare. Threw it all out and started from scratch with s7 Graph. I'm pretty sure Graph comes with Step7 Pro, so if you have the budget, get the full package or waste your weekends toying with a ladder based sequence.
 
Parallel paths is where a tool like S7 Graph really comes in to its own. It can be done using integers but you have to program your parallel path as a sub-sequence using its own integers for Input word and Output word.

Nick
 

Similar Topics

Hello, i have a machine with 3 axis that can run simultaneously controlled by other software but sometimes this goes wrong due operator fault. So...
Replies
9
Views
2,914
Hello, I am trying to make a sequence program by using MOV function to change the value of a register. So far I have always used SET and RSET for...
Replies
5
Views
2,208
I am taking my first attempt at modifying a program on our little bottling machine. We need to automate a sequence to purge the tank on the...
Replies
2
Views
4,821
hello all experts. i'd like to know your experiences about sequence programming. i use positive or negative edge detection(|p|or |n| elements)...
Replies
1
Views
6,591
hello i am currently working on my program. i have some problem where i need some guidance. i have a question where when i do the next network...
Replies
2
Views
1,558
Back
Top Bottom