foringerj
I cannot get the PLC to "start" with the blank program or any program I upload - I have followed the installation instructions perfectly and didn't have any errors - i have tried several times.  FYI - i had this working fine on this same pi for months and then the pi got corrupted and I had to reinstall everything on a new clean version of Despian - now it won't work - any advice?  
Reply 0 0
thiagoralves
Can you expand more on “it doesn’t start”? What happens when you click on Start PLC? Any error messages on the dashboard? What is your hardware layer configuration? Try starting the runtime from terminal with
sudo systemctl stop OpenPLC
cd ~/OpenPLC_v3
sudo  start_openplc.sh
 
And then check if there are any messages on terminal when you try to start the PLC.
 
OpenPLC works best on a clean installation of Raspbian. Try reinstalling on a clean image of the latest Raspbian version
Reply 0 0
foringerj
When I click on Start Plc - the log screen flashes "opening logs" for a split second and then nothing - it doesn't start.  I followed your instructions above and was able to stop and start Open PLC without issue.  I reinstalled Open PLC and when I started it after the install the blank program worked with the hardware set to Blank - but when i moved it over to Pi it won't start again.  all the installs are on a fresh copy of Raspbian, it is a Pi4.  I did notice the old runtime i was using had a red theme, this new one has a blue theme.  
Reply 0 0
thiagoralves
What I asked was, what are the logs on terminal when you start the runtime from terminal and click on Start PLC
Reply 0 0
foringerj
Got it - when i type it exactly as you have it - I get the following error - Failed to Stop OpenPLC.service: Unit Open PLC.service not loaded.  
 
When I type it as Sudo systemctl stop openplc  and Sudo systemctl start openplc it doesn't give any errors.  and when i check it with systemctl status openplc it seems to show it as dead and active as it should.  
Reply 0 0
foringerj
wondering if i need to go back to an earlier version of raspbian - that is the only thing that i changed from my previous working install - the whole reason i reinstalled it was because i think i turned the Pi off so many times without shutting it down properly  I'm currently on bookworm and was running bullseye before
Reply 0 0
foringerj
Just an FYI - when i reinstalled the bullseye OS for Pi everything worked fine - Not sure why bookworm didn't work - maybe the Wiring PI was outdated for bookworm 
Reply 0 0
thiagoralves
The only way to figure out what went wrong would be to start OpenPLC from terminal as I said and check the error messages. I didn’t ask you to start the Systemctl service, as that runs on the background and won’t let you see the messages. 
Reply 0 0
plc_ingenieur_ger
I have the same Problem, and after i typed the commands in the terminal, i received this masses on the terminal:

cp: cannot stat '/workdir/webserver/dnp3_default.cfg': No such file or directory
cp: cannot stat '/workdir/webserver/openplc_default.db': No such file or directory
cp: cannot stat '/workdir/webserver/st_files_default/*': No such file or directory
* Serving Flask app 'webserver'
* Debug mode: off
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on all addresses (0.0.0.0)
* Running on http://127.0.0.1:8080
* Running on http://192.168.2.57:8080
Reply 0 0
thiagoralves
Great. With that running on terminal, open the browser and start the plc. Then post here what you get on terminal when you try to do that
Reply 0 0
foringerj
The only way to figure out what went wrong would be to start OpenPLC from terminal as I said and check the error messages. I didn’t ask you to start the Systemctl service, as that runs on the background and won’t let you see the messages. 
Sorry - I stumble around linux  - I reinstalled the bullseye version of the OS and it worked just fine 
Reply 0 0
plc_ingenieur_ger
Okay, now i started start_openplc.sh on the terminal and pressed "Start PLC" again. I got this message on the Terminal:

[2023-12-30 11:17:05,125] ERROR in app: Exception on /start_plc [GET]
Traceback (most recent call last):
File "/home/root/OpenPLC_v3/OpenPLC_v3/.venv/lib/python3.11/site-packages/flask/app.py", line 2190, in wsgi_app
response = self.full_dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/root/OpenPLC_v3/OpenPLC_v3/.venv/lib/python3.11/site-packages/flask/app.py", line 1486, in full_dispatch_request
rv = self.handle_user_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/root/OpenPLC_v3/OpenPLC_v3/.venv/lib/python3.11/site-packages/flask/app.py", line 1484, in full_dispatch_request
rv = self.dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^
File "/home/root/OpenPLC_v3/OpenPLC_v3/.venv/lib/python3.11/site-packages/flask/app.py", line 1469, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/root/OpenPLC_v3/OpenPLC_v3/webserver/webserver.py", line 474, in start_plc
openplc_runtime.start_runtime()
File "/home/root/OpenPLC_v3/OpenPLC_v3/webserver/openplc.py", line 79, in start_runtime
self.theprocess = subprocess.Popen(['./core/openplc']) # XXX: iPAS
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/subprocess.py", line 1024, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib/python3.11/subprocess.py", line 1901, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: './core/openplc'
192.168.2.34 - - [30/Dec/2023 11:17:05] "GET /start_plc HTTP/1.1" 500 -
192.168.2.34 - - [30/Dec/2023 11:17:05] "GET /favicon.ico HTTP/1.1" 404 -
 
Seems like it does not find the path './core/openplc'.
Reply 0 0
plc_ingenieur_ger
root@raspberrypi:~/OpenPLC_v3/webserver/core $ ls
client.cpp enipStruct.h modbus_master.cpp
custom_layer.h hardware_layers pccc.cpp
custom_layer.original interactive_server.cpp persistent_storage.cpp
dnp3.cfg ladder.h psm
dnp3.cpp lib server.cpp
dnp3_dummy.disabled main.cpp
enip.cpp modbus.cpp
 
These are the files in the '~/OpenPLC_v3/webserver/core' directory
 
It seems that there is no folder named "openplc"
Reply 0 0
plc_ingenieur_ger
I installed the BullesEye OS on my Raspberry Pi 4. Now it works!
Reply 2 0
thiagoralves
It couldn’t find core/openplc because something happened while trying to compile your last program (most likely when you switched to the Raspberry Pi hardware layer).
Reply 0 0
Reply