Junior - developer
Hello,

Am new at this and am wondering if you could help me. I have two raspberrypi 3b and trying to use them as PLCs to communicate with each other by exchanging information. I installed the OpenPLC following your instructions. The only problem I got is on the last step when installing PLCopenEditor. After I installed all the packages for python as the instructions said, on the last command "python PLCopenEditor.py" I got an error "not such file directory". I got in the directory of PLCopenEditor so I cant see where the problem is.

Any ideas? Maybe I could just skip the PLCopenEditor and use it on my PC and then just move the project to my rasberrypi for compile?

Thanks in advance.
thiagoralves
The "o" in PLCO penEditor.py is upper case.

In any case, you are not supposed to run the editor on the Rpi itself, unless you have a lot of patience and don't mind having poor performance. The editor should run on your more powerful desktop computer. Once you're done creating your project, you just generate the ST file (File->Generate Program) and upload the generated ST file over the web interface.

From openplcproject.com website:

The OpenPLC application has a NodeJS webserver that controls if the OpenPLC is running or not and enables the user to upload programs (.st) files generated using the PLCopen Editor to the OpenPLC. To start, enter in the OpenPLC_v2 directory and type:


sudo nodejs server.js

Now, just point your browser to http://ip-address-of-your-RaspberryPi:8080. You will see a web interface that will let you upload new programs to the OpenPLC. When a new program is uploaded, it is automatically compiled into a new application and executed

Reply 0 0
Junior - developer
Ok yhea that makes more sense am working on my computer. But do you know how I can make the two Rpis communicate and send information to each other?  
Reply 0 0
thiagoralves
OpenPLC by itself cannot communicate with another OpenPLC. You would have to write a small application to run alongside OpenPLC in one of the RPi responsible for reading the other RPi OpenPLC buffer and writing to the local OpenPLC buffer. By default, OpenPLC talks Modbus/TCP and DNP3. You can use either one of these protocols (I recommend Modbus because it is simpler) to read and write OpenPLC buffers remotely. You can find more information about Modbus here:  http://www.simplymodbus.ca/
Reply 0 0
Junior - developer
Hello again,

I made the connection between two Raspberry Pi 3 using the EasyModbus with Java libraries. Am getting the following message:

"Server: Listening on port 502

Server: waiting for new client...

Server: Client accepted! Creating thread for the new client ID: 4...

Server: waiting for new client...Server: Thread created for client ID: 4


Server: Something is wrong with the client ID: 4 message Size : -1"

Do you know what could case these problem?
I would really appreciate your help thank you!
Reply 0 0
thiagoralves
It seems that your java modbus implementation might be terminating the connection sooner than expected. Can you get any data from OpenPLC on your java application?
Reply 0 0
Junior - developer
Thank you very much for your quick response.

It seems that I cant. What am trying to do at first, is just a simple configuration to exchange data from the PLC registers (Raspberry Pi) using EasyModbus with Java. 

My Raspberry Pi I/O don't have any inputs or sensors connected to them but is that a problem?
Also, can you show me a simple example with PLCEditor to write some values in the registers? 

Thank you again.
Reply 0 0
thiagoralves
You don’t have to have anything connected to have values on the registers. Usually the easiest way to try Modbus is to have a little wire with positive voltage (3v3 in case of Raspberry Pi) connected to one of the input pins. Then you can read input status register that reflects directly the digital inputs from the pins
Reply 0 0
Junior - developer
I think I solved the issue [smile] 
Thank you very much for your quick response. You are always willing to help I really appreciate it thanks again!
Reply 0 0
thiagoralves
Would you mind sharing your solution with the community?
Reply 0 0
Junior - developer
Sure. I was trying to have a connection to exchange register's data between my Raspberry Pis using the EasyModbus/tcp protocol, with Java libraries. The problem appeared to be in the Java code because I didn't close the connection with the PLC server. So, with the command "modbusclient.Disconnect" at the end of the program problem solved. 
You can find the libraries in the following link with a project sample video at the end of the page.

https://sourceforge.net/projects/easymodbustcp-udp-java/#focus

Just note that in this video the command to terminate the connection is missing ("modbusclient.Disconnect").
Reply 0 0
Junior - developer
Hello again, just a quick question please. How can I clean the OpenPLC server Log without stopping and restarting the server? Because after some operation time when the requests are too many, I can't see on screen the most recent Logs.

 
Reply 0 0
thiagoralves
You can't, unless you modify the server.js code. The most recent logs always appear at the bottom, so all you have to do is scroll. If the problem is that the page keeps refreshing you can try to copy/paste the logs into notepad, just type CTRL+A followed by CTRL+C to copy.
Reply 0 0
Reply