learning timers - mixer example

Pandiani

Lifetime Supporting Member
Join Date
Apr 2005
Location
Tz
Posts
718
Hello,
I'm reading about timers from Siemens online courses, and I there is example of using timers (not ladder diagram). I simplified it so there are two pumps: pump1 and pump2, and and onr mixer. Program is as follows:
when user press start (there are start and stop button) pump1 is activated and work for 10 s. After that pump1 is turned off and pump2 is activated for 5 sec. After pump2 is finished mixer is activated for 10 sec. After that whole process stops and operator need to pres start again for whole new cycle. I ommited drain valeve for simplification. Now I'm writting ladder diagram and test it stp by step.
Here is my logic:
1. If start is pressed and not stop and not pump2 is working and not mixer is working and timer is not finished start pump1.
And I translate this to following rung:


start pump2 mixer pump1_finish pump1
1-|-||-|--|/|---|/|----|/|----------( )
| |
|-||-|
stop


2. When pump1 is activated turn on timer for a 10 sec. When timer is signaled turn off pump1

pump1 pump1_finish
2-||---TON(on delay 10 sec)--( )



I decide to test only this two rungs to see if timer signal will turn off pump1.
It's working as expected, but if start is remain pressed cycle will repaet itself. I'd like to know how it is possible to make that after one cycle all stops and if start is being pressed all th time, it must be released first and the again pressed for new cycle?
I'm on the begining of the program and already have problems, but I hope you'll help me.
Thanks very much
 
I'd like to know how it is possible to make that after one cycle all stops and if start is being pressed all th time, it must be released first and the again pressed for new cycle?

I don't know anything about Siemens, but you might want to use a "one shot".
When the rung conditions preceding the "one shot" instruction goes from false-to-true, the "one shot" instruction is true for one scan. After one scan is complete, the one shot instruction becomes false, even if the rung conditions preceding it remain true. The one shot instruction becomes true again if the rung conditions preceding it transition from false-to-true.

 
start PB oneshot bit 1
----] [--------(OSR)--------( )--




In the above example if the start PB is held in, bit 1 will still only be true for one scan.
 
I again dont know about siemens but i would use a Latch/Unlatch relay for the Start Stop sequence

The Unlatch could be held off if the Start PB is being held or jammed in stopping the pump and mixer timing circuit from resetting

See quick example i just did in the AB World on Logix 500

edit: BTW i havent tested this so it may have errors!
 
Last edited:
Another way using a single timer for the complete cycle and compares to start stop each device. This has not been tested and may or may not be correct. Just something I threw together on the fly.
 
mixer in Siemens Step7 Microwin

Since I dont have Siemens Step7 on this pc but only the Step7 Microwin, here my prog. in Step7 Microwin.
The prog. will be very similar in Step7.

[edit]
To prevent a restart when the start button remains pressed, put a pulsmerker -|p|- in series with the start button.
[/edit]
 
Last edited:
The first and most important talent that any "thinker", in any field, must develop is the ability to clearly define a problem. Clearly defined problems solve themselves. The more clearly defined the problem, the more likely the problem will solve itself. These solutions tend to be more elegant.

If the solution is not readily apparent (or not very elegant) then the problem is, most likely, not clearly defined.

Note:
The following is just a simple control scheme. It does not include such things as motor overload detection, etc.

User Presses Start to "Do Cycle"
Pump-1 is activated
After 10-sec, Pump-1 stops and Pump-2 starts
After 5-sec, Pump-2 stops and Mixer starts
After 10-sec, end of cycle.

The only way to get into cycle is by pressing Start while NOT "Do Cycle".
Get out of cycle at any time by pressing Stop, otherwise, cycle ends at the completion of the sequence.

Note:
A user could "tape down" the Start button thus causing the cycle to repeat over and over...
This can be prevented by using a "transition bit" for the Start button. That is, once the cycle ends, the cycle will not restart unless the program "sees" the Start button go from Off to On. "--|P|--" is a "P"ositive transition... from Off to On.


Cycle Control...
While NOT "Do Cycle"... Reset and Disable all timers.
While "Do Cycle"... Run Timer-1 (10-sec)
While Timer-1 Timeout, Run Timer-2 (5-sec)
While Timer-2 Timeout, Run Timer-3 (10-sec)
If Timer-3 Timeout (Cycle Done), Unlatch Do Cycle

Output Control...
While Do Cycle and NOT Timer-1 Timeout... Run Pump-1
While Timer-1 Timeout and NOT Timer-2 Timeout... Run Pump-2
While Timer-2 Timeout and NOT Timer-3 Timeout (Cycle Done)... Run Mixer

Cycle
Start Stop Done
---|P|---+---| |-------|/|----( "Do Cycle" )
|
Do |
Cycle |
---| |---+

Do
Cycle
---|/|----------------------------+----( Rst Tmr-1 )
|
+----( Rst Tmr-2 )
|
+----( Rst Tmr-3 )

Do +-------+
Cycle | Tmr-1 |
---| |-----------------+ 10 +------( Tmr-1 Timeout )
| Sec |
+-------+


Tmr-1 +-------+
Timeout | Tmr-2 |
---| |-----------------+ 5 +------( Tmr-2 Timeout )
| Sec |
+-------+


Tmr-2 +-------+
Timeout | Tmr-3 |
---| |-----------------+ 10 +------( Cycle Done )
| Sec |
+-------+


Do Tmr-1
Cycle Timeout
---| |-------|/|----------------------( Run Pump-1 )


Tmr-1 Tmr-2
Timeout Timeout
---| |-------|/|----------------------( Run Pump-2 )



Tmr-2 Cycle
Timeout Done
---| |-------|/|----------------------( Run Mixer )

 
Thank you guys so much for these elegeant solutions. I'm going to study them until I completely understand every detail. I must admit I had more than 10 rungs with dozen variables and still could not make it work. I was complicating too much and now i feel shame about how stupid my attempt was :(. And Terry, I know that the most important part in learning process is ability to define problem. I couldn't do that but I hope I'll be to do that in near future by experimenting with this stuff.
I must admit I didn't expect this generous help on this forum, I'm delighted to have you to help me, otherwise I would spend maybe days until I solve these problems by myself, and I know I must use this to understand and learn to do it myself.
I'll certainly have more questions because practicaly I'm learning this almost all by myself.

Thans again very very much.
 
Pandiani said...

And Terry, I know that the most important part in learning process is ability to define problem.

I just want to make it clear that I was referring to clearly defining the problem for yourself... not for me.
 
Terry Woods said:
Pandiani said...

And Terry, I know that the most important part in learning process is ability to define problem.

I just want to make it clear that I was referring to clearly defining the problem for yourself... not for me.

Thanks to my bad English maybe we didn't undesrstand each other.
That sentence should be:
And Terry, I now know that the most important part in learning process is ability to define problem.

I'm very grateful for your help.
 
Ok, now I'm thinking to expand this program to allow user to choose working mode. For example mode 1 means pump1 works for 10 sec, pump2 works 5 sec and mixer works for 10 sec,
mode 2: pump1 5 sec, pump2 5 sec, pump3 8 sec. First idea is to add two more inputs and to copy all rungs from previos example. I mean just to add the same rugns, only this time to change timers and to choose betwen them with if mod1 is selected and mode2 isn't then enable rungs from 2 to 6. This way I practicaly double number of rungs. Is there any way to set timers time depending on mode inputs?
I mean something like this

mod1 mod2
--||---|/|----(Set time1)

...--(timer1 -time1)
mod1 mod2
--|/|---||----(Set time2)
...


Because I'm learning Siemens programming I tried to use function blocks and to make data block instances to cover all cases, but the question is how to arrange that function block call appropriate datablock depening on user mode?
Thanks for help
 
Pandiani said:
Is there any way to set timers time depending on mode inputs?

There is in AB slc examples

Depending on the Input switched you can copy the desired times to the timer preset say T4:0.PRE using the copy instruction

I am sure someone here will let you know how to do it with an FB in siemens
 
Hello pandiani;

Here is a simple way to set timer values depending on different logical conditions:

s7_timer.jpg



You can use any of 5 Siemens standard timers, and of course the memory location can also be part of a DB (as long as it is formatted as a S5time variable). If you choose IEC timers, then you will need to format the variable as a TIME variable.
And of course, you will have to select distinct logical conditions to MOVE different timer presets to your timer.
ake sure you do not change the TV value of a timer while it is timing! Best case, it will simply ignore the modification during its timing sequence; worst case, it will block...
Hope this helps,
Daniel Chartier
 

Similar Topics

I've gotten to the learning curve where I can program a call for pump to come on at set point but I'm not sure how to turn the same pump off when...
Replies
0
Views
22
I want to pick up an Allen Bradley PLC so I can practice writing programs. I have 10 years as a maintenance tech and a good understanding of...
Replies
8
Views
221
Hi all, i have started a new chapter in my career with a local company. a lot of their plc's is omron and i have the cx version 9.75 software...
Replies
25
Views
4,152
Can you guys recommend a course or book for my son to start learning PLC programming? He’s telling me he’s thinking of taking some $100 course...
Replies
31
Views
6,973
Hello All, I have recently had the opportunity to dabble in TIA portal for the first time. Been working in automation for almost a decade now and...
Replies
18
Views
2,594
Back
Top Bottom