Lewis_D
-OpenPLC Runtime does not start automatically on reboot or initial boot of the Raspberry pi.

-When I downloaded OpenPLC I expected it to show up in the applications menu but it didn't.
I've tried downloading it twice and no difference.

-I'm trying to run my first program.
Writing and downloading the program seems to be ok.
When I try to start the PLC from the dashboard I get a runtime log of "OpenPLC Runtime is not running"
I can see that the dashboard and Raspberry are communicating.

The Terminal shows the following when I try to start runtime from the dashboard

OpenPLC Runtime starting...

Interactive Server: Listening on port 43628

Interactive Server: waiting for new client...

pinMode PWM: Unable to do this when using /dev/gpiomem. Try sudo?

OpenPLC Runtime is not running. Error: [Errno 111] Connection refused

192.168.0.101 - - [14/Feb/2021 15:14:28] "GET /runtime_logs HTTP/1.1" 200 -

Openning database

Enabling Modbus on port 502

Enabling DNP3 on port 20000

Enabling EtherNet/IP on port 44818

Disabling Persistent Storage

persistent.file removed!

Name: push_button

Location: %IX0.7

Type: BOOL

 

Name: lamp

Location: %QX0.7

Type: BOOL

The program is a simple pushbutton turning on a lamp. One line only.

 

192.168.0.101 - - [14/Feb/2021 15:14:29] "GET /start_plc HTTP/1.1" 302 -

192.168.0.101 - - [14/Feb/2021 15:14:29] "GET /dashboard HTTP/1.1" 200 -

192.168.0.101 - - [14/Feb/2021 15:14:30] "GET /runtime_logs HTTP/1.1" 200 -

192.168.0.101 - - [14/Feb/2021 15:14:31] "GET /runtime_logs HTTP/1.1" 200 -

Any help would be appreciated. I'm not sure where I went wrong.
Thanks,
Reply 0 0
thiagoralves
Lewis_D wrote:

pinMode PWM: Unable to do this when using /dev/gpiomem. Try sudo?


As the error message is saying, you need to start OpenPLC with sudo 
Reply 0 0
NWT.Stuff
I have installed OpenPLC runtime on RPI's following this procedure maybe 10-15 times and have never had a problem.

https://www.openplcproject.com/runtime/raspberry-pi/
Reply 0 0
Lewis_D
I restored/reset Raspbian to its factory default. 
reloaded OpenPLC.
still could only start Runtime by going to the OpenPLC_v3 directory,
I downloaded my program and started the PLC
got a status "running" and the following runtime log
I'm not sure what the means but the program does not work.
does the log below indicate an obvious problem?
Thanks,


OpenPLC Runtime starting...
Skipping configuration of Slave Devices (mbconfig.cfg file not found)
Interactive Server: Listening on port 43628
Warning: Persistent Storage file not found
Issued start_modbus() command to start on port: 502
Server: error binding socket => Permission denied
Server: waiting for new client...
Issued start_dnp3() command to start on port: 20000
DNP3 ID manager: Starting thread (0)
DNP3 ID DNP3_Server: Listening on: 0.0.0.0:20000
Issued start_enip() command to start on port: 44818
Server: Listening on port 44818
Server: waiting for new client...
Issued stop_pstorage() command
Reply 0 0
thiagoralves

!!!!! you need to start OpenPLC with sudo !!!!! 
Reply 0 0
Lewis_D
I tried sudo and got this. It still wont work.

pi@Lewis:~/OpenPLC_v3 $ ls

appveyor.yml             doxygen.conf     install.sh         utils

background_installer.sh   get-pip.py        README.md          webserver

Dockerfile               installed.db     requirements.txt

documentation            install_log.txt  start_openplc.sh

pi@Lewis:~/OpenPLC_v3 $ sudo ./ start_openplc.sh

Traceback (most recent call last):

  File "webserver.py", line 12, in <module>

    import monitoring as monitor

  File "/home/pi/OpenPLC_v3/webserver/monitoring.py", line 3, in <module>

    from pymodbus.client.sync import ModbusTcpClient

ImportError: No module named pymodbus.client.sync

pi@Lewis:~/OpenPLC_v3 $

 

Reply 0 0
thiagoralves
Your installation was messed up. You didn’t get the required libraries installed for the root user. You can try to fix it by running
sudo -H pip2 install flask
sudo -H  pip2 install flask-login
sudo -H  pip2 install pyserial
sudo -H  pip2 install pymodbus

If it doesn’t work, reinstall OpenPLC
Reply 0 0
Lewis_D
I cleared and loaded Raspberry Pi OS on my micro sd card.
Installed OpenPLC per the website's instructions.
Loaded my program and it worked.
Thank you for your help.
Reply 1 0
NWT.Stuff
Good news 🙂 Enjoy
Reply 0 0
espressobot

I'm having problems getting OpenPLC_v3 to start up after having this particular install run fine for the past 6 months or so.
The error I'm seeing is:

pi@refusr:~/OpenPLC_v3 $ ./start_openplc.sh 
Traceback (most recent call last):
File "webserver.py", line 2382, in <module>
openplc_runtime.project_name = str(row[1])
TypeError: 'NoneType' object has no attribute '__getitem__'
pi@refusr:~/OpenPLC_v3 $

I'm wondering if the

webserver/openplc.db
is corrupt and if there's an easy way to fix it. 

I gave up trying to debug the problem and backed up my .st code and reinstalled from scratch.

I got the OpenPLC_v3 webserver up and running once after the re-install, but after shutting down the Pi and re-starting it, I'm running into the same error above.

Is there an easy way to fix this or to keep it from happening repeatedly ?

 

Reply 0 0
thiagoralves
This error appears usually when you delete the currently running program. Upon launch OpenPLC tries to load the last ran program, but if it was deleted, you end up getting a ‘None’ object.
Reply 0 0
espressobot

This error appears usually when you delete the currently running program. Upon launch OpenPLC tries to load the last ran program, but if it was deleted, you end up getting a ‘None’ object.


Hmmm...I don't remember doing that.
How do I fix it ? Is it enough to make sure that the program in active_program exists under webserver/st_files

Reply 0 0
thiagoralves
It must exist under st_files and on the database (openplc.db)
Reply 0 0
Reply