PLC Trainer: Mixing Tank Simulation

It’s been a while since I’ve made a ladder logic program. I decided to go back to the mixing tank simulation that seems to come up wherever I go to learn about ladder logic programming.

The machine adds two ingredients into a tank, and then stirs it all for 10 seconds. The mixture is dumped from the tank and the process can be started over. A toggle switch allows for the ratio of the two ingredients to be changed. The process can be stopped at any time, at which point the tank will be emptied. This is all shown in the video.

Some notes:

– Along with the stop button, an overflow situation will also throw the program into a fault. I didn’t program in any intentional overflows, though that was part of the original plan. While I was debugging, there were times when errors in my program got the ingredient valves stuck open and the imaginary tank would overflow. If there are any hidden bugs that come out later on, hopefully that will catch it.

– Something that I discovered that I guess I forgot from my lessons is that outputs in subroutines will remain the way they are even if the subroutine isn’t called…

– Any time an ingredient valve is open, a counter is increased by 1 every second.  Any time the empty valve is open, 1 is deducted from the same counter every second. The float switches are simulated using compare instructions that compare constant numbers to the accumulator value of the counter. It’s two seconds between each float switch, so a full tank (not an overflowing tank) would take 14 seconds from empty because there are 7 LEDs, or 7 float switches.

So that’s it! I didn’t think it would be done this quickly. It took about a day to complete, but that’s thanks to planning everything in a Word document first.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s