Logo! help on task

aidan5192

Member
Join Date
Jan 2022
Location
tamworth
Posts
7
Hi i have recently been studying PLC for work and i have had a task now which i believe i am close to finishing but i cannot think how to correct my problem. Any help would be much appreciated.

I need to run the mixing tank for 10 seconds and then empty the tank after but i can only manage to get them both to come on at the same time but i need the empty tank to come on after the 10 seconds. I cant see where i am going wrong as i have tried several ways and i just end up braking the rest of the circuit.

this is what i have been given if anyone could see a solution to my problem or let me know if i am way off.

• When the Start ‘push to make’ (not toggle) switch (I1) is pressed/released and gets latched on (B1: RS latch), the start ‘fill’ pump (Q1) will be energized and the tank will start to fill.
• The pulses generated by flow meter 1 (B5: pulse generator) should be used to increment the counter (B6: Up/down). Tank level full is when the counter function on = 10 and tank low level is when counter off = 1. These values can be used as feedback to control the pumps (instead of the high/low level sensors shown above) and can be called the ‘tank high/low level count indicator’ (Q5 or use a flag M1)
• When the full liquid level in the tank is sensed by the tank high/low level count indicator (Q5), the fill pump will be shut-off and the FULL light (Q2) on the control panel is to be energized.
• When the tank is full, start the mixer (Q3) and run for 10 seconds (B8: off-delay timer).
• When the 10 seconds has expired, stop the mixer (Q3) and start ‘empty’ pump P3 (Q4).
• Pump 3 (Q4) will be required to run until the tank is empty. Tank empty can be detected using the low-level sensor (I3).
• The pulses generated by flow meter 3 (B15) should be used to decrement the counter (B6: Up/down). Tank empty can be detected by the high/low level count indicator (Q5 or use a flag M1) to switch off the pump
• When the stop button (I2) is operated, the process must stop immediately (Q1, Q3, Q4).


Thanks

Task Logo.png
 
Last edited:
This could be done with ladder easily enough, but the principles should be the same.

Inputs

  • Start (momentary)
  • Stop (momentary?)
  • Flow pulses (not sure if they are needed, if there are independent high and low level switches, but whatever)
  • Levels?
    • High level? (not sure if this is an actual switch, or output Q2, or an "inflow pulses counted up and reached 10 or more" result)
    • Low level? (not sure if this is a switch or an "outflow pulses counted down and reached 1 or less" result)
Outputs

  • Q1 Filling pump
  • Q2 Tank full (seems to be conflated with Q5?)
  • Q3 Mixer
  • Q4 Emptying pump
  • Q5 Tank Hi/Low count? (Seems to be conflated with Q2?)

There are four states

  • Idle, which on Start=1 transitions to
  • Filling, which on TankFull=1 transitions to
  • Mixing, which on TimerOff expiring transtions to
  • Emptying, which on TankEmpty transitions back to Idle (above)
It could be argued that there are an additional four states, representing the states in between those four i.e. the transitions, e.g. State is Idle and Start=1 but we have not yet transitioned to Filling.

Also, when Stop=1, always transition to Idle.

We could maintain states either

  • by the logic of what is happening at any moment e.g. combining inputs and output 1s and 0s logically, so once mixer starts we can no longer be in Filling state
  • OR
  • in independent internal bits that get latched as the process moves from state to state.
    • E.g. B001 is Set (becomes 1) when Start is pushed.
With the latter, we can ISOLATE

  • the transition logic i.e.
    • which state, N, are we in now
    • AND
    • if we are in N, and Event E(N) happens, transition to state N+1.
FROM

  • the output logic i.e.
    • When we are in Mixing state, then turn on Mixer
The nice thing about that is that you can know if you are in a state N if state bit N is 1, AND state bit N+1 is 0.

So the state map looks like this:

  • Idle
    • All state bits are 0
  • Filling
    • Filling bit is 1
    • Mixing bit is 0
    • Emptying bit is 0
  • Mixing
    • Mixing bit is 1
    • Filling bit is 1 (still)
    • Emptying bit is 0
  • Emptying
    • Emptying bit is 1
    • Filling bit is 1 (still)
    • Mixing bit is 1 (still)
That is overkill: to identify if the process is in any one State N, wee need only to check if that (State bit N is 1) AND the next (State bit N+1 is 0). So, for example, when Mixing state bit is 1 and Emptying state bit is 0, turn on the Mixer and the emptying pump will not be on at the same time because the Emptying bit is 0.

I haven't seen this exact style of logic before, but it seems pretty straightforward.

Suggestion

You have probably figured it out by now, but I think the Off Parameter on the Up/Down Counter should be 2, not 1, so the Q bit will change to 0 when the count reaches 1, otherwise the Q bit will continue to be 1.

yyy.png

Although from what you wrote, your problem seems to be before that i.e. the mixer.
 
Possible solution, but there is a problem if the system is reset (e.g. I2 Stop pressed) while the counter output (Q) is 1, because the next time I1 Start is pressed, there can be no rising edge to Reset the Filling State. That can probably be fixed by removing the AND-edge of the counter output Q, but then the mixer will run when Start is pressed if that counter Q is 1.

xxx.png
 
Last edited:
Thanks for commenting , i will have another look at it now. Also everything that is on there
like the " (Q5) high/low tank indicator" and flow meters all been set up for the task ive had to fill in the rest haha, also never tried ladder actually thought that would of been harder (only been shown FBD).

All that said thank you for taking some time to answer me. much appreciated
 
I just re-read the OP, I did not notice there an input, I3, that indicates a low level, presumably that is a level switch. I was wondering about that, because counting filling flowmeter pulses up and emptying flowmeter pulses down will eventually not represent the actual level. So my logic will not work.


Also, I realized the diagram in the OP uses Asynchronous Pulse Generators (see this link)as proxies, in B002 and B01, for the filling and emptying flowmeters' pulses.

There is also the question of what to do next after the [I2] Stop momentary is pressed somewhere in the middle of the sequence:

  • Should the tank be somehow drained, until [I3] is 1, without any (more?) mixing?
  • Or should there be an option to do some mixing first?
  • Or filling then mixing?
This process seems ill-defined; is this a homework assignment, or a contrived exercise to learn how to program LOGO?
 
Last edited:
yeah its an assignment for work but they gave me this to work out. been told i have to get all 3 stages to work , print screen etc all individual outputs working/ not working and copy of the program .

1 - tank has to fill and energise Q1
2 - When tank full Q5 & Q2 energize and DE-energize & start mixer Q3 for 10 seconds
3 - when 10 seconds expire, shut off Mixer (Q3) & energize Empty pump Q2
4 - assuming empty pump for 10 seconds (Not quite sure with advice i got given) as
5 - need to energize Q5 again When tank empty so need to decrement counter
6 - I2 ( stop button) needs to shut off ( Q1 , Q2 & Q3 immediately)

That is the advice i got when i asked trainer at work so wasn't really helpful in the slightest.
4 -
 
I am starting to read the LOGO! syntax better, so I looked at the OP code again. It was very close, only two things needed fixing:

  1. Invert the input connection into B007 from B009 output, so the Emptying Pump would not run while the Mixer Timer Output was 1 and the mixer was running,
  2. Change B011 to a Latching relay.
See below.


Sidebar/minor issue: Is B006 needed? Can Q5 instead be connected directly to both B009/1 and B007/2?


xxx.png
 
Also, here is a similar approach, it's basically the same thing, but saves one block by using only a single pulse generator for both filling and emptying.

xxx.png
 
Reduce it by one more block, assuming the Fill/Mix/Empty sequence should repeat automatically once the process has been started with [I1 Start switch].

Also, B008 may not be necessary, if the [I2 Stop switch] to [B006 Reset] leaves B006 output in a 0 state after [I2] is released when the Tank Mixer is running, which would get us down to 7 blocks total.

Untested, of course.

xxx.png
 
Yeah i realized about the inverter. had a read through the manual etc and couple of youtube videos, made me realized thats what i was missing. also the latching relay did the job instead of the pulse relay thanks.

But i see what your on about ill give it a try see what happens, i know ive tried the "and-edge" b006 instead of the "or" but it did not work out with the circuit for some reason so had to go back tho the "or"

I can see you put some thought into this now which is amazing since im new to all of this and i found it very confusing to be honest but i do value your input and have found it informative :)

also i cannot try the last diagram you have presented as the 4 outputs and the 3 inputs (Q5 included) is what i have been told i must present and cant remove any of them, but thanks anyways, you have definitely showed me how i could make it much simpler if i had the choice.

This is what i have come up with, and it works, except the stop does not stop Q2 & Q5 now

Task done.png
 
This is what i have come up with, and it works, except the stop does not stop Q2 & Q5 now


I think that is as it should be; in the OP it said that the Stop Switch should stop the process and specifically called out Q1, Q3, and Q4, but did not call out Q2 or Q5.


Q2 and Q5 indicate that the tank either is full, or was full and has not since been emptied; why should stopping the process (pumps and mixer) somehow "declare" the tank not full?
 
Last edited:
You are absolutely correct , i have been so tunneled visioned trying to finish this task i forgot what was actually stating in the task. Thank you very much for support you have given me , i do appreciate you taking the time to help.
 
You are absolutely correct , i have been so tunneled visioned trying to finish this task i forgot what was actually stating in the task. Thank you very much for support you have given me , i do appreciate you taking the time to help.

Glad to help.

Here it is in ladder, with a few extra twists.

P.S. well done, you fixed your code yourself, which code was almost working. It is very difficult to learn a new language like that; after a while you will know to look for things like edge detection, but for now just keep reading the manuals and asking questions.


I am a "code golfer," and that rarely makes for maintainable production code.

The next step I would suggest is commenting the code; if LOGO! doesn't allow for it in the app, copy screenshots into a document and write the comments. Comments are crucial three months down the road when summat changes in the process and you have to troubleshoot a problem. Also, often when I write comments I find subtle bugs. Comments should be process-focused, not code-focused e.g. "Start mixer and mixer timer when tank reaches full," not "Start B009 timer when B006 output has a rising edge."
 
Last edited:

Similar Topics

Hello Team, I am desperate for some help with an assessment I have as part of a Level 3 general engineering course. I am in a role that is much...
Replies
9
Views
293
Hi all, First, thank you for reading the thread. So I had a task as the following: An up-counter must be programmed as part of a batch-counting...
Replies
7
Views
242
Hi all, I'm having a bit of difficulty when it comes to the final question of my assignment, and wondered if anybody could shine some light on it...
Replies
6
Views
1,081
Hi All, first post on here looking for help, the site has been a treasure chest full of useful stuff so far during my course work, so thanks a...
Replies
5
Views
2,620
Hello All, I am using Siemens LOGO!Soft V8 to write a program and am unsure of where the function is fo the CTU as seen in the attached picture...
Replies
6
Views
2,309
Back
Top Bottom