[?]: Ladder sequence

примеры программ
Post Reply
Coyote
Posts: 41
Joined: Wed Sep 06, 2006 10:07 am
Location: Slovenia

[?]: Ladder sequence

Post by Coyote » Fri Jan 18, 2008 8:35 am

I would apreciate the knowledge of programming tricks.
One of the mostly used and needed type of program in PLC is a sequencer.
I would like to open a discussion about how to make the best possible sequence in ladder diagram.

As I know there are two tecniques for defining each step of a sequence:
1. using self retaining contacts
2. using integer number as a step

Anybody have a good solution for using it in S7?

Nedjeljko
Posts: 118
Joined: Mon Nov 05, 2007 10:59 pm
Location: Croatia

Post by Nedjeljko » Wed Jan 23, 2008 8:11 pm

...I usualy use integer value in one parameter...
...with this solution u can always be shore in which step are you, and you can easly show state on HMI.. :wink: :wink:

Coyote
Posts: 41
Joined: Wed Sep 06, 2006 10:07 am
Location: Slovenia

Post by Coyote » Mon Jan 28, 2008 11:12 am

I have been using self retainig coils until now, I never use set/reset coils for coding steps as it's seen in many tutorial examples, anyway I have made the new type of sequence using integers. Here is a first valutation of problems and features using integers vs. self-retaining coils:
1.Self-retaining coils: It is good when debugging program (monitoring), all steps are reset simply by removing consense bit. Steps are defined with bits (BOOL) and they could be stored localy in function block, so you can copy-paste FB for each new sequence. It's diffcult to make branches and jumps from one step to another.
2.Integers: It's easy to jump and branch. The integer has to be defined in M area, so you have to redifine variables for each new sequence. If a sequence has more than 32 steps you have to expand with another DINT. When monitoring is not cool.

Any suggestion?

Nedjeljko
Posts: 118
Joined: Mon Nov 05, 2007 10:59 pm
Location: Croatia

Post by Nedjeljko » Mon Jan 28, 2008 8:47 pm

..I somtime have step controll with S or R bits, but only in small projects...
...in biger projects I always use Int, first I make sequential charts for tehnologie, and after that I choose which step will be marked with wich value of that int parameter..
...If I have couple of lines I use more of int parametrs..

..If some project is same for long time, I invest time to make some standard blocks of sequential steps and just insert in project when i need :D :D :D

Maxime
Posts: 53
Joined: Sun Oct 01, 2006 12:17 pm
Location: Europe

Sequencers

Post by Maxime » Wed Mar 12, 2008 3:51 pm

Hi,

In S7 you can use S and R for the steps, the first step Sets a bit and the second step Resets that bit and in the mean time Sets another bit.
There is also Graph, you just add as many steps you need, Siemens does it almost all for you...
Nedjeljko could you show us a little more on how you program it with integer value in one paramter?
Regards
Maxime

Nedjeljko
Posts: 118
Joined: Mon Nov 05, 2007 10:59 pm
Location: Croatia

Post by Nedjeljko » Wed Mar 12, 2008 4:13 pm

Code: Select all

Netw_1
//------------------------------ 

 A     "Parametri".AUTO
      AN    "Parametri".Stop_Req
      A     "Parametri".Pasterizacija_Req
      A(    
      O(    
      L     0
      L     "Parametri".Pasterizacija_status
      ==I   
      )     
      O     "Parametri".Recirkulacija
      )     
      FP    #temp
      =     L     20.0
      A     L     20.0
      JNB   _001
      L     1
      T     "Parametri".Pasterizacija_status
_001: NOP   0
      A     L     20.0
      BLD   102
      R     "Parametri".Pasterizacija_Req
//-----------------------------------------------
Netw_2
//-----------------------------------------------
   A     "Parametri".AUTO
      A(    
      L     1
      L     "Parametri".Pasterizacija_status
      ==I   
      )     
      A     "LSH11_IDB".QOUT
      A     "LSH21_IDB".QOUT
      A     "LSH31_IDB".QOUT
      A     "LSH41_IDB".QOUT
      A     "LSH51_IDB".QOUT
      A     "LSH61_IDB".QOUT
      FP    #temp_1
      JNB   _002
      L     2
      T     "Parametri".Pasterizacija_status
_002: NOP   0
//-----------------------------------------------
Netw_3
//-----------------------------------------------
    A(    
      A     "Parametri".AUTO
      A(    
      L     2
      L     "Parametri".Pasterizacija_status
      ==I   
      )     
      L     S5T#18S
      SD    T      9
      AN    "Parametri".AUTO
      R     T      9
      NOP   0
      LC    T      9
      T     #T9_WORD
      A     T      9
      )     
      FP    #temp_2
      JNB   _003
      L     3
      T     "Parametri".Pasterizacija_status
_003: NOP   0
//-----------------------------------------------
Netw_4
//-----------------------------------------------
   A(    
      A     "Parametri".AUTO
      A(    
      L     3
      L     "Parametri".Pasterizacija_status
      ==I   
      )     
      L     S5T#2M
      SD    T     10
      AN    "Parametri".AUTO
      R     T     10
      NOP   0
      LC    T     10
      T     #T10_WORD
      A     T     10
      )     
      FP    #temp_3
      JNB   _004
      L     4
      T     "Parametri".Pasterizacija_status
_004: NOP   0
///...................................................................
This is one example, where is used one parameter "INT" "Parametri".Pasterizacija_status ..

when I start in this case pasteur...buton for start move value 1 to int parameter "Parametri".Pasterizacija_status when that step is ower (Netw1), I made move value 2 to int parameter "Parametri".Pasterizacija_status

...each network here represent one step, after step is finish (conditions), they move value in int "Parametri".Pasterizacija_status

and thats all
:P :P :P

Maxime
Posts: 53
Joined: Sun Oct 01, 2006 12:17 pm
Location: Europe

Nedjeljko

Post by Maxime » Thu Mar 13, 2008 12:41 pm

What is your native language?
Your code looks very interesting!

grtz
Maxime

Nedjeljko
Posts: 118
Joined: Mon Nov 05, 2007 10:59 pm
Location: Croatia

Post by Nedjeljko » Thu Mar 13, 2008 1:07 pm

my native language is Croatian...why you ask!?

If you have any question about this or step functions just shoot...

...I usualy use blocks with stepover bools... :wink:

Maxime
Posts: 53
Joined: Sun Oct 01, 2006 12:17 pm
Location: Europe

Graphcet

Post by Maxime » Thu Mar 13, 2008 2:08 pm

Nejeljko, I just wondered because of the language which is used in your program, that's all :D.
Why not using Graph from Siemens?

grtz
Maxime

Nedjeljko
Posts: 118
Joined: Mon Nov 05, 2007 10:59 pm
Location: Croatia

Post by Nedjeljko » Thu Mar 13, 2008 2:19 pm

...yea...graph is solution for all step functions...
...but i have no knowlege about s7Graph...I know that is simple to learn, but I have no time to invest for learning...

..are you use Graph in your projects?! In couple weeks I planing to put all steps in new projects with s7 Graph...

...question about graph:
- Which DB and FC i must to put in project for S7graph
- When i define steps and transitions - I must to put some timers into steps?! Last try to make s7 graph steps I missout with some timers in steps...after that Im quit with investigation for s7 graph, so I made own FBs for couple mashine which wie sale...

Maxime
Posts: 53
Joined: Sun Oct 01, 2006 12:17 pm
Location: Europe

Graph

Post by Maxime » Thu Mar 13, 2008 3:29 pm

Nedjeljko,

Probably you allready have some Graph installed on your system.
You add a Function Bolck and choose language GRAPH.
So you will get in GRAPH editor, which hasn't much to do with PLC programming anymore.
Still you need some logical skills.
As for normal FB's you choose your own DB to write to.
For example you take FB10 and DB10, easy to search for they have the same name.
Then you can call FB10, DB10 from anywhere, from a FC or a FB. You get then a block call whith a DB, just as normal. And there you can put some conditions into to start or whatever, just get the documentation and read what you need to use.
When you're in the GRAPH editor, the right side you have the actions, so you put a timer there.
It says Add New Element -> Action, you get an empty box with 2 parts and right-click on it, go for Object Properties. You get a window, go to the lower part of it and select an Operator: Event for example S1 - Step is activated and Instruction: TL, TD or TR which all are timers :D
The rest is up to you and your creativity.

It's better to say to your boss to take some time to learn or get some training. If you can't, you will loose time searching anyway but it will be on the time from the customer which is more expensive than the time off your boss.
Now and then people need to sharpen their skills by taking classes or further education.

grtz
Maxime

Nedjeljko
Posts: 118
Joined: Mon Nov 05, 2007 10:59 pm
Location: Croatia

Post by Nedjeljko » Thu Mar 13, 2008 4:08 pm

...no my boss understand that wie need to put graph into the projects...but you know how is - customer wants this in that time, and plus more 10 customers....that is much works to do...

...so In next two mount wie will crash that hustle...so I will in future use Graph for shore...

...Thanks for explanation...I will invest my time for investigate that...If Ill have question, I will free to ask you..Ok?

Thanks

Maxime
Posts: 53
Joined: Sun Oct 01, 2006 12:17 pm
Location: Europe

Questions about Graph

Post by Maxime » Fri Mar 14, 2008 7:53 am

Nedjeljko,

You can always ask, it's for both of us a learning process. You can teach me stuff and the other way around.
If you have problems, i'll try to help you out!

grtz
Maxime

Maxime
Posts: 53
Joined: Sun Oct 01, 2006 12:17 pm
Location: Europe

graph

Post by Maxime » Fri Mar 14, 2008 10:38 am

Nedjeljko,

Do you use only 1 db to write this program: T "Paramteri".Pasterizacija_status?

grtz
Maxime

Nedjeljko
Posts: 118
Joined: Mon Nov 05, 2007 10:59 pm
Location: Croatia

Post by Nedjeljko » Fri Mar 14, 2008 11:08 am

...yes ...for example..I use one DB (Shared) for Pasteuer...in that DB I have all information about process parameters (Status, Recipie) and bools for conditions...
...DB has a name "Paramteri" and parameter (INT) in to that DB has a name Pasterizacija_status....that is one parameter for All steps in mashine...
...with that Im allways shore where is position of production...so I can easly put indication on HMI :wink:

ivanweiner
Posts: 10
Joined: Thu Feb 05, 2009 11:46 pm
Location: Philippines

a request to ladder conversion

Post by ivanweiner » Thu Aug 06, 2009 1:53 am

hi Nedjeljko

i read your example program. unfortunately and i'm sorry i can't convert it to ladder format. can i ask you a favor can you convert for me and how DB you use looks like. i try to figure your program for a month to see the programming tricks but unfortunately i failed. rigth now i'm starting to study programming in stl format because almost our plc used in our company is been converted to siemens for uniformity and for the training purposes. it would be great help for me your proram to develop a new techinque. i only used self retaining coil but when i read your forum here i'm very interested on your programming techniques. i never been seen using integer in programming tricks and i'm sure it will help me in troubleshooting purposes. it's not stated in sitrain powerpoint that my friends give to me and maybe i can't acquire it in sitrain training center. pls share to me 8)

best regard

Nedjeljko
Posts: 118
Joined: Mon Nov 05, 2007 10:59 pm
Location: Croatia

Re: [?]: Ladder sequence

Post by Nedjeljko » Sat Jan 15, 2011 5:26 pm

...Im sory for long time no answer...I didnt see your post. Sory again.
If you need something just send me email: nedjeljko.vranic[at]atip.hr

Post Reply