dirk
Hi, we develop the RevolutionPi which is an industrial RaspberryPi based on the Compute Module (CM). A community member has asked how he could integrate the OpenPLC SPS.  Here is the original discussion and my answer. So if you have ideas how we could help to put the OpenPLC into operation on the RevPi it would be great.
Reply 0 0
thiagoralves
Try seeing the full logs from systemd:
journalctl -u openplc
or
journalctl -u openplc -b
Reply 0 0
Udo
Dear Thiago Alves,
is the RevolutionPI driver already an official part of the OpenPLC repository? And does the driver also work with a RevolutionPi Connect+?
Is the RevolutionPI driver limited to RevolutionPi modules or can any Modbus-capable device be addressed?

By the way, great work!

Thanks in advance,
Udo
Reply 0 0
ljb_nj
Thiago, it doesn't look like anything out of the ordinary in the logs. All looks OK now that I resolved the pyserial package problem. But just for fun, here's what I have after booting up (see attached). I do see a lot of start/stops for server threads, but I figure this is normal (start plc, plc program complete, stop program, restart program)?

Now, the next potential bug I see is on the monitoring page. After booting up, if I go to monitoring, nothing is shown. When I check physically, I do have IO. Currently, I have a very basic program loaded just to confirm addressing (DI1=DO1, etc.). So putting 24V at DI1, I get 24V at DO1. Now, when I hit Stop PLC, and then Start PLC, now I see everything on the monitoring page, and my IO updates accordingly. Looking in the log, I did see this after booting:

Nov 16 14:29:24 RevPi40957 start_openplc.sh[1066]: Issued runtime_logs() command
Nov 16 14:29:24 RevPi40957 start_openplc.sh[1066]: Interactive Server: client ID: 11 has closed the connection
Nov 16 14:29:24 RevPi40957 start_openplc.sh[1066]: Terminating interactive server connections
Nov 16 14:29:24 RevPi40957 start_openplc.sh[1066]: Interactive Server: Client accepted! Creating thread for the new client ID: 11...
Nov 16 14:29:24 RevPi40957 start_openplc.sh[1066]: Interactive Server: waiting for new client...
Nov 16 14:29:24 RevPi40957 start_openplc.sh[1066]: Interactive Server: Thread created for client ID: 11
Nov 16 14:29:24 RevPi40957 start_openplc.sh[1066]: Interactive Server: client ID: 11 has closed the connection
Nov 16 14:29:24 RevPi40957 start_openplc.sh[1066]: Terminating interactive server connections
Nov 16 14:29:24 RevPi40957 start_openplc.sh[1066]: Interactive Server: Client accepted! Creating thread for the new client ID: 11...
Nov 16 14:29:24 RevPi40957 start_openplc.sh[1066]: Interactive Server: waiting for ne192.168.254.239 - - [16/Nov/2020 14:29:24] "GET /runtime_logs HTTP/1.1" 200 -
Nov 16 14:29:25 RevPi40957 start_openplc.sh[1066]: getSO_ERROR: Bad file descriptor
Nov 16 14:29:25 RevPi40957 start_openplc.sh[1066]: close: Bad file descriptor
Nov 16 14:29:25 RevPi40957 start_openplc.sh[1066]: 192.168.254.239 - - [16/Nov/2020 14:29:25] "GET /monitoring HTTP/1.1" 200 -
Nov 16 14:29:25 RevPi40957 start_openplc.sh[1066]: 192.168.254.239 - - [16/Nov/2020 14:29:25] "GET /monitor-update?mb_port=502 HTTP/1.1" 200 -

 
Versus this after hitting stop and then start again from the webserve:
Nov 16 14:31:00 RevPi40957 start_openplc.sh[1066]: Terminating interactive server connections
Nov 16 14:31:00 RevPi40957 start_openplc.sh[1066]: Interactive Server: Client accepted! Creating thread for the new client ID: 14...
Nov 16 14:31:00 RevPi40957 start_openplc.sh[1066]: Interactive Server: waiting for new client...
Nov 16 14:31:00 RevPi40957 start_openplc.sh[1066]: Interactive Server192.168.254.239 - - [16/Nov/2020 14:31:00] "GET /runtime_logs HTTP/1.1" 200 -
Nov 16 14:31:01 RevPi40957 start_openplc.sh[1066]: 192.168.254.239 - - [16/Nov/2020 14:31:01] "GET /runtime_logs HTTP/1.1" 200 -
Nov 16 14:31:02 RevPi40957 start_openplc.sh[1066]: 192.168.254.239 - - [16/Nov/2020 14:31:02] "GET /runtime_logs HTTP/1.1" 200 -
Nov 16 14:31:02 RevPi40957 start_openplc.sh[1066]: 192.168.254.239 - - [16/Nov/2020 14:31:02] "GET /monitoring HTTP/1.1" 200 -
Nov 16 14:31:02 RevPi40957 start_openplc.sh[1066]: 192.168.254.239 - - [16/Nov/2020 14:31:02] "GET /monitor-update?mb_port=502 HTTP/1.1" 200 -
Reply 0 0
thiagoralves
These logs are all fine. They only indicate the internal service connecting and disconnecting as you use the web portal, which is expected. It seems that the monitoring problem you're facing is related to OpenPLC auto starting the program. It seems that the monitoring service is only triggered when you click on the "start plc" button. I'll check that 
Reply 0 0
thiagoralves
Udo wrote:
Dear Thiago Alves,
is the RevolutionPI driver already an official part of the OpenPLC repository? And does the driver also work with a RevolutionPi Connect+?
Is the RevolutionPI driver limited to RevolutionPi modules or can any Modbus-capable device be addressed?

By the way, great work!

Thanks in advance,
Udo

It is not part of the official repository yet. I was in the hope that more users would try it and confirm that it works well with all the iterations of RevPi hardware. It should work with Connect+ just fine.

About the Modbus-capable devices, it has nothing to do with the RevPi driver. The RevPi driver is only used to connect to the RevPi modules (which doesn't use Modbus by the way). OpenPLC has an internal Slave Devices mechanism meant just for Modbus devices. You can check the documentation on the References section of the website to learn more. Basically all you have to do is click on Slave Devices on the web portal and add your devices in there.
Reply 0 0
ljb_nj
Thiago, thank you. Since I have the device, and plan to mess around with it, let me know if there's anything I can help with as far as testing.
Reply 0 0
Udo
Dear Thiago Alves,
OK, I got it. I don't plan to use the RevPI modules ... Calculated down to a single measuring point, the prices are simply far too high for the range of functions offered.

So when I use a modbus module I can use the normal Linux runtime for Stretch, right?

If I may, I would like to give you a tip for cheaper, robust and electrically isolated Modbus modules. Take a look at the components of inlog .. here are a few examples:

inLog EDAM-9017 Ethernet-based 8-ch isolated Analog Input Module
http://www.inlog.com.tw/index.php?action=products_data&cid=283&id=136&tc=&cc=&sc=&sl=3

inLog EDAM-9050 Ethernet-Based 12 isolated Digital Input channels(Dry contact)
and 6 digital Output channels module
http://www.inlog.com.tw/index.php?action=products_data&cid=286&id=181&tc=&cc=&sc=

The prices per module are around $ 100. Calculated down to a industrial grade measuring point, that's a snap.

Thanks in advance,
Udo

Reply 0 0
thiagoralves
These modules are nice. They look like the Chinese counterpart of the ADAM modules. They should work out of the box with OpenPLC runtime on any platform (PC, Linux, Raspberry, RevPi, etc). All you have to do is setup a slave device as Generic Modbus Slave and configure the number of registers from the device. That’s it!
Reply 0 0
etienne1984
Hello,

We tested in my company "RevPi Core 3+" + "RevPi DIO" + "RevPi AIO", following the above procedure.

Everything worked fine, OpenPLC compilation, configuration etc., we had only three problems :
  • service starting OpenPLC webserver at end of installation did not work, even after reboot (we started server by hand, reading command in .service file)
  • loosing some time to understand how to configure locations in OpenPLCEditor
  • then we had digital IO working fine but not analog IO detected.
Concerning the last point, we processed to a minor fix :
$ diff blank.txt blank_fixed.txt
336c336
<             else if (!strncmp(var_temp,"WORD",4) || !strncmp(var_temp,"UINT",4))
---
>             else if (!strncmp(var_temp,"WORD",4) || !strncmp(var_temp,"UINT",4) || !strncmp(var_temp,"INT",3))


And analog device worked!

Please find the attached fixed blank.txt file to install following above explanations.
Reply 0 0
etienne1984
Sorry, I am answering to this discussion  : https://openplc.discussion.community/post/revolutionpi-support-10181282?pid=1309008482 but my answers arrives in this post I do not understand how ?????
Reply 0 0
thiagoralves
etienne1984 wrote:
Sorry, I am answering to this discussion  : https://openplc.discussion.community/post/revolutionpi-support-10181282?pid=1309008482 but my answers arrives in this post I do not understand how ?????

That's because we are already on the second page of the discussion. The link you posted is for the first page. 

By the way, thanks for submitting the fix. I'll incorporate that on a final driver for the RevPi
Reply 0 0
etienne1984

Oups I feel a bit stupid... I don't know how I could miss all these following discussions... It solves some of the listed problems in my message.

We are trying to make modbus work now, it seems that it should work if I believe some posts above. I keep you informed.

Reply 0 0
jordi2219
Hi, I'm having trouble installing the OpenPLC on RevPi Core 3.
When I try to follow the following code it doesn't install properly and corrupts the "Jessie" image. Fortunately I can install the image again, but the same thing keeps happening.
It is possible that with "Jessie" it cannot be installed correctly? Does anyone know what happens?

Code:
sudo apt-get update
sudo apt-get upgrade -y
git config --global http.sslVerify "false"
git clone http://github.com/thiagoralves/OpenPLC_v3.git
cd OpenPLC_v3
./ install.sh rpi
Reply 0 0
thiagoralves
You're not following the instructions correctly. You should install it for Linux, not Raspberry Pi:
Screen Shot 2021-01-11 at 12.36.14 PM.png 
Reply 0 0
jordi2219
I have also tried linux and it gives me the same problem.
It damaged the image and I have to install it again.
Has anyone managed to install it with "Jessie"? I will try to install "Stretch" and see what happens.
Reply 0 0
Reply