Reputation: 263
I have a new project about plc (siemens), but I dont know how they work. What I have to do, is by given some data from the plc I have to handle the data and to display it on a simple GUI. The PLC (I dont know if there are different types) that I have to use is a "proximity sensor" which only capture if something is infront of it, then it hasto send some data to my program in Java and then I have to display it on the GUI (Basically some red or green circles) I dont have to handle the behavior of the PLC, I just have to do display a red or green circle by given the data from the PLC
Questions:
I thought of Java because I know that is a powerful language, but is it the best for what I have to do?
Second if Java is the best choice, are there any librarys for working with PLC?
Third... I started to read something about some languages like:
What are they for?
Upvotes: 1
Views: 11095
Reputation: 119
This depends on the application that you want to design, if the application is based on the web, it is better to use a easymodbus TCP that sends data through TCP connection, and if you want a desktop application, it is better to use Easy Modbus RTU that Using RS485, this library it's the best.
I Recommended to use this library it's also for future (Smart Phone, Desktop and Web Application using Spring Boot MVC).
Upvotes: 0
Reputation: 11
i had similar problem and this is how i sorted it out: Communication protocol that most PLCs are using are either modbus, bacnet, lonworks and milion others. In your case , i assume that Siemens uses modbus. Firstly you neet the Rs485 to usb adapter (arround 20Eur on Amazon) you have to read registers from modbus - please use easyModbus api This approach works fine but it is not happening in the real time as the modbus communication could run in separate threads.
Upvotes: 0
Reputation: 76
To communicate with a Siemens plc you could use a few different options based on the exact type of PLC that you use.
A few communication protocols supported by Siemens:
opc: the industry standard for communication between PLC and other devices
libary like Snap7 http://snap7.sourceforge.net/ which has lots of supported programming languages
for the programming language you can use Java but as alternative you could use C# or vb.net in cooperation with Visual Studio for creating a simple GUI.
If you need any further information please let me know.
Upvotes: 1
Reputation: 421
"The PLC(...) that I have to use is a "proximity sensor" which only capture something in front of it."
Do you mean to state here that you are connecting a proximity sensor to a PLC, reading the data from the PLC and back to your UI program OR do you want to read the proximity sensor directly back to your UI program? If it’s the latter connect your sensor to a microcontroller and then send the data serially to your computer.
If you are using a PLC you will need some interface card (i.e. digital or analogue). Connect your sensor to the applicable card. If you want to read an S7 PLC you will need a library - libnodave is a good one. If you are using a library like libnodave you will need to use ones of its supported languages - it includes Java but you can also use others e.g. C. You could also use Snap7.
FBD is one of the IEC61131-3 programming languages - see: http://www.automation.com/pdf_articles/IEC_Programming_Thayer_L.pdf
Upvotes: 2
Reputation: 1322
The PLC should have an RS232/485 interface. All communications happen via serial communications. Java does have the Java Communications API, But before you go down that path, What is the computer that would be interfacing with the PLC device - A low power ARM SBC or a x86 PC ? The downsides of using Java is the footprint related to the JDK. If it were me, I'd stick to C/ Rust or GoLang based on the constraints of the platform.
Upvotes: 1