Karnaugh chart program

In these days of PLC's, do you think Karnaugh charts are still usefull?

  • Yes, sure!

    Votes: 8 40.0%
  • Don't know, maybe

    Votes: 7 35.0%
  • No way!

    Votes: 0 0.0%
  • What are Karnaugh charts?

    Votes: 5 25.0%

  • Total voters
    20

jvdcande

Member
Join Date
Apr 2002
Location
Menen
Posts
2,178
Hi folks,

while doing an effort to learn Java, I recently developped a Java applet to simplify Boolean functions by means of a Karnaugh chart.

I wrote the programm in Dutch, but tried to translate the intreface to English, French, German, Italian and Spanish. Since I don't speak Italian and Spanish, and my French is a bit rusty, I used a programm to translate the terms used in the interface. I would like you all to take a look at the result and give me some feedback so I can improve the programm.

To use it, simply fill in the number of variables you're using (limited to the range 2..8) and click on the chart to toggle the values from 0 to 1 and reverse. These are buttons to reset the chart and to invert the chart.

The URL's are (in alphabetical order of the languages):
I anybody would like to see a version with yet another language, send me a PM with the translation of all used terms on the chart, and I'll see what I can do to oblige.

Kind regards,

Jean Pierre Vandecandelaere
Trainer PLC - SCADA
VDAB Bruges
 
Jean Pierre,

This is a good thing! Thanks.

But, wouldn't ya know it? The first time I tried it, I found a bug!

Set the Map to 8 variables. Set all of the bits in the upper right quadrant to "1". The result should be "NOT-E and A".

Now, press invert.

Instead of getting the K-Map solution for the inverted form, it appears that you get a binary listing of individual K-Map locations.


The Invert worked fine on smaller K-Maps.

Suggestion:

Instead of clicking on the number, how about clicking anywhere on that square? It was a bit of a pain to click eack number... the target is small.

How about Drag-Grouping?
Click at top of Column for Column Select,
Click at left of Row for Row Select,
Shift-Click to add more Columns and Rows

Then select action to be performed...

- Invert all
- SET All ("1")
- RST All ("0")
 
Terry,

Glad you like it. I'll think about your suggestions. But keep in mind I'm only started learning this Java stuff. I used to program in Basic and Pascal, but since a dozen years I've not programmed very much, apart from PLC's and SCADA systems that is. I really had some problems with the fact that global variables seem to be non-existing in Java. It took me most evening of about 2.5 months to complete this program. I can't neglect the family, you know!

I think that the problem with the larger K-maps is related to the calculation time needed (the original Basic program I based this upon was restricted to 64 1's). I might consider an hourglass or something alike to appear while calculating, at the same time preventing incomplete results to show. Thanks for testing anyway!

Kind regards,

Jean Pierre Vandecandelaere
 
I had the same results as Peter. That is, once I got past all the &%$#* popups... :p

Here's the error log if that helps you any...
Code:
java.lang.NullPointerException: string is null
	at sun.java2d.SunGraphics2D.drawString(Unknown Source)
	at Karnaugh.drawCard(Karnaugh.java:672)
	at Karnaugh.paint(Karnaugh.java:171)
	at Karnaugh.redraw(Karnaugh.java:176)
	at Karnaugh.run(Karnaugh.java:134)
	at java.lang.Thread.run(Unknown Source)
java.lang.NullPointerException: string is null
	at sun.java2d.SunGraphics2D.drawString(Unknown Source)
	at Karnaugh.drawCard(Karnaugh.java:672)
	at Karnaugh.paint(Karnaugh.java:171)
	at Karnaugh.redraw(Karnaugh.java:176)
	at Karnaugh.bereken(Karnaugh.java:232)
	at Karnaugh.start(Karnaugh.java:126)
	at sun.applet.AppletPanel.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
beerchug

-Eric
 
Ya know, Jean Pierre,

I think your poll (if everyone was to get on it) would indicate something very disturbing...

Why do I need to know math? I've got a Calculator!

Why do I need to know K-Maps? I've got...
 
Let me say this.

I am probably a perfect candidate to learn anything concerning Karnaugh Maps and using them.

I went to the website and had no problem with accessing the java program, it made no sense to me. Maybe I missed something, it would allow me to change values in the table and state things on the left. I have no idea what those statements are.

Excuse my ignorance.Give me a few days and maybe I will understand it.
 
Thanks guys. I see I've stirred up something.

First of all, I have to agree with Terry Woods.Me too, I'm concerned with the fact that people involved with PLC's don't know K-maps. I always thought it was essential to know logic, and K-maps have always made my life easier when I was simplifying a logic equation. It's a lot harder to do it the mathematical way! For those who need more info, follow this link: http://www.cs.usm.maine.edu/~welty/karnaugh.htm or search the web for Karnaugh maps.

Secondly, Pete Nachtwey and Eric Nelson, thank for the debugging info. While building the program, I've got several of such error logs. But the published version gave me nothing of that kind. I'll try to find out what is wrong. I have discovered, after the first reaction (by Terry) that every thing worked fine up to a maximum of 64 minterms (the 1's in the map), even with the maps with 7 and 8 variables. Guess I have to do my homework again, or at least part of it.

Thirdly: concerning those "&%$#* popups". I know, they're annoying me too. But I started a website to communicate with my former trainees. I didn't want to spend any money on webhosting and software, because it had to remain a hobby. And that is what you get if you don't want to spend :rolleyes: .

I know there are more advanced programs around. If you search the web, I'm sure you'll find plenty, but as I stated earlier, this project was mainly for me to learn Java. In the near future I get a student here to make his masterpiece. He will be constructing a visualisation based on the CP343-1IT from Siemens. This is an Ethernet communication module with an integrated website. Since this module has to be programmed in Java, I'll be seeing plenty of it. And I don't want to look ignorant in the eyes of this youngster. So I started to study the basics of Java. Now you all know the history of it. ;)

Kind regards,
Jean Pierre Vandecandelaere

BTW this remains my number 1 website for PLC. Hope everybody enjoys it as much as I do. Congrats to Phil and the rest for maintaining it. I hope I can help with a few posts.
 
Hi Jean
Did I understand you correctly in that you said a Siemens module will require Java to program? This is interesting to me. I am back at school doing a sotfware development programming course. While I have learnt/learning Java, C, C++, Visual Basic, Cobol, I need to pick one language to major in. I was leaning towards Visual Basic because of its use ( I think ) in OPC for PLCs, but really wanted to choose Java because of its flexibility but didnt think it would come in handy in a control world. When I finish I dont want to do traditionally IT but more industrial/controls type work because of my background in it.
Do you know of other uses for Java?

Regards
TFC
 
TimeFluxCap,

several PLC manufacturers offer communication modules for Ethernet or TCP/IP. Some of them, like Siemens, incorporate a website in order to facilitate in an easy way to control the PLC from a distance. Especially the fact that you don't have the need to obtain pricey keys just to look at what is happening in your automation (you simply use your browser) makes this development very interesting. I remember I have seen a similar masterpiece anounced a few years ago, but based on an Omron device and with somewhat limited options.

With the Siemens module, the datatransport between the CPU of the PLC and the website of the communication processor is programmed by means of javabeans. And that is something I yet have to master! Well, it keeps me busy and I like to learn.

Kind regards,

Jean Pierre Vandecandelaere

BTW the name is Jean Pierre and not Jean. It was an error from a public servant that I lost the hyphen, my parents intended to name me Jean-Pierre. Unfortunately, in Belgium the public servants are always right :rolleyes: and we're always wrong.
 
"Unfortunately, in Belgium the public servants are always right and we're always wrong."

hmmm... We all ain't so different, after all (after all the public servants, that is).
 
Karnaugh gets so much attention but...

What about De Morgan? I find that I use De Morgan's laws more often than Karnaugh maps. I have NEVER seen anything about De Morgan's laws on this site or any other PLC site about De Morgan even though De Morgan's laws should be part of boolean logic 101 or PLC 101. Does everyone know these laws already and is therefore obvious?


Terry, I agree with your comments about a calculator. I asked our FPGA programmer if he used Karnaugh maps and he said rarely because his VHDL tools take care of optimizing the logic for him. He too said he used De Morgan's laws much more frequently.


Jean Pierre, I was able to run your program on another computer. I didn't see where 'don't cares' are supported. I am curious how you are doing K maps programmatically. I'll think about this the next time I am stuck on a plane or a air port. It alse makes me wonder if the PLC manufacturer 'optimize' ladder using the techniques similar to what your are developing in your java K map program. I doubt it. Would this be a good thing? I don't think it would make much difference to the PLC, but simplifying logic does make it easier to understand.
 
Siemens CP343-1IT

Jean-Pierre,
I too could not get your program to work. I have the latest and the greatest JDK installed on my PC. (J2SDK 1.4.0_03). It's throwing an
exception.
I tried to find the Siemens CP343-1IT. I could not get to it!
Could you please provide a link to it?
I would like to check it out. I am surprised to find that
this product is JAVA programmable, considering the steep learning curve involved. I have seen other products (soft PLC's etc) with
JAVA programming capability but to my knowledge it never caught on in the world of PLC's. I think it's because the learning curve is too steep. Perhaps in this specific instance it makes sense because after
all JAVA is the language of Internet. So if you could help me out here
with the link I would appreciate it.
Thanks.

you can do
 
Jiri,

seems Java isn't that universal after all. I programmed it with JDK 1.1.8, which is a somewhat older version of Java. It works fine for me, up to a maximum of 64 1's in the chart.

For the CP343-1IT, the order number from Siemens is 6GK7343-1GX00-0XE0. I hope this info will lead to the info you need.

Kind regards,

Jean Pierre Vandecandelaere
 
Peter Nachtwey:

Yes, I agree but you could have stated the main point of De Morgan (which I did bring up in Terrys massive K-map thread :) ).

Basically DeMorgan is useful when you want to negate a combination of bits. The basic rules are

(not)(A and B) == (not A) OR (not B)
(not)(A or B) == (not A) AND (not B)

Many times it can save you the intermediary step of creating the positive logic and then negating it. As with most things, taken to the extreem it can make for highly confusing code. But for an example...

Without DeMorgan:

A B C
-----] [-----] [-----( )-----

C D
-----]\[-------------( )-----

.

With DeMorgan:

A D
-----]\[-----+-------( )-----
|
B |
-----]\[-----+

.


Which is easier to understand.... I suppose it depends on the user :unsure: .

But I suppose it's always a good idea to look at the before and after code and see if you really simplified things or not.
 

Similar Topics

Hey, I know how to make a Karnaugh map. But, making the formula seems to be a problem. I know that u have to fish after 1's. I have to draw...
Replies
7
Views
3,123
Ya got me looking and here is a freebie I found. http://www.puz.com/sw/karnaugh/karnaugh_12.htm Thanks for making me remember something from...
Replies
10
Views
6,207
Hey All, I am attempting to create a bar graph(histograph) in FTView Studio. I would like to graph water consumption for each day of the week (7...
Replies
5
Views
1,394
I need an X/Y plot to visually represent data o a roundness gage I am designing. ActiveX ME Chart Control UDT seems broke. Any advise one how to...
Replies
0
Views
673
Anyone used the ActiveX Chart Control for their HMI Programs before? Short Demo Here : https://www.youtube.com/watch?v=jrS41-PhSGY Some Rockwell...
Replies
0
Views
1,297
Back
Top Bottom