Sign in to follow this  
Followers 0
TConnolly

Karnaugh Maps

7 posts in this topic

I downloaded and looked at the manual linked at the forum front page http://forums.mrplc.com/index.php?&act=Down...&CODE=02&id=156 Lots of good stuff in there, but one item in particular caught my attention: Karnaugh maps. When I was a newbie fresh out of college I wrote a couple of prorgrams that I was quite proud of. I mapped everything and applied my newly minted logic reduction skills. The programs were slick and streamlined. But no one could read them, some of the logic was not at all obvious. Two years later, not even I could read them. And what about all that memory I saved? Its still there, in the PLC, bought and paid for, consuming power, doing nothing really fast. Since then I've abandoned logic reduction, perfering to write more obvious code that doens't require my future attention, but instead is far more readable so that at 3:00 am some maintenance tech somewhere can handle it. I've frequently even taken it to the opposit extreme, to the point of repeating some logic that might be covered by one bit in the rung if it helps make the rung's function more obvious.

Share this post


Link to post
Share on other sites
The only place I've ever used Karnaugh Maps is in electronic circuitry design. I think they are more for reducing the number of logic gates - which are at a premium in a circuit - and not to improve efficiency. Edited by Spedley

Share this post


Link to post
Share on other sites
My idea behind K-maps was that they were the tool to use when; if you have a complex logical expression and efficient minimisation by boolean algebra if difficult k-maps are the thing. Sometimes though the size of the map can make it really crazy to work out. I think that there is alot to be said about making the program easy to read, especially for people who will have to just come to the mahchine and fix it. Takes you back to college and University doesn't it.

Share this post


Link to post
Share on other sites
Alaric, Post this question over at PLCs.net and sit back and wait for Terry Woods to respond. Or search that site for K-Maps.

Share this post


Link to post
Share on other sites
K-maps! That brings me back to my early EE classes.. From what I recall, you'd apply a K-map to a truth table to produce the simplest Boolean expression that would generate that truth table. I'm not sure how that would best serve a PLC programmer. I suppose if you had a really complicated rung full of branches, you could reduce the rung to a truth table and then apply a K-map. But really, I don't see the benefit. Is there something I'm overlooking?

Share this post


Link to post
Share on other sites
Hi Alaric and others, Your questions are very good. I put Karnaugh maps in the book mainly because of my own bias from previous EE studies. In practice I actually skip that chapter with my students to save time. However, Karnaugh maps are a nice visual alternative to using algebra to simplify the Boolean equations. For students or beginners these methods help them explore many programming alternatives and emphasize some important lessons including, - there are multiple ways to write the same program - logic has some rules and general forms - to prepare for more advanced techniques and logic I would expect that a controls engineer would rarely -write- a Boolean equation. But, it doesn't mean they are not using them intuitively. Hugh

Share this post


Link to post
Share on other sites
Hugh, thanks for your reply.... As I indicated, I havent done a K-map since shortly after I entered the workforce. I got started PLC programming my Jr. year while working part time while attending school and I enjoyed it so much that was the path I took. You are right, there are perhaps ways in which I intuitively use the principles involved to simplify logic, but since I would rather let the plant maintenance staff handle the troubleshooting I prefer to put as much pertinent info on a rung as possible without overcomplicating the rung, even if its actually redundant, because that means fewer middle of the night phone calls for me (though I still got one of those at 4:10 am this morning). For example, I may have a hydraulic valve that has a bAuto_Mode bit as a permissive. The bAuto_Mode may have a permissive such as bSafety_Shield_Closed. But I will go ahead and program an XIC for both the bAuto_Mode and the bSafety_Shield_Closed on the output rung, even though the former is covered by the latter, if it makes sense in making the program more readable. I know the first place in the program a maintenance guy is going to go is to look at the rung that controls the output to the valve. A lot of these guys can look at a rung and figure out what it does, but they don't do as well when following the whole program, and the first time they don't get it they reach for the phone instead of trying to understand it (which is sometimes understandable when the foreman is breathing down their necks). Your book appears to be really helpful and I definitely think I'm going to refrer to it in future training sessions for our maintenance staff. Thanks for making it available. Edited by Alaric

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0