jean-jean
Hi everyone!

I've just fond thit project, for those who want industrial protection :

https://www.kickstarter.com/projects/279405789/megaio-ind-industrial-and-building-automation-for
Reply 0 0
NWT.Stuff
Reckon I’ve got it know.

Yes it will be very very handy for adding new sensors to the arduino 🙂
Reply 0 0
thiagoralves
This is not for the Arduino as it can’t run python. The idea behind PSM is to use it on the Raspberry Pi itself, or any other platform that supports python.
Reply 0 0
mbeffa
This is REALLY great news not for the MegaIO-IND, but for all of our boards. 
We installed OpenPLC and tested it with our Home Automation Board. 
Alex the software guru reports that he was able right away to read an input and set a relay using OpenPLC.
We still have to test with the analog inputs and outputs, we'll report back soon. 
We have 15-20 I/O boards for Raspberry Pi and they all have Python libraries.
Killing so many birds with one stone... Thanks Thiago.
Reply 1 0
NWT.Stuff
Quote:
his is not for the Arduino as it can’t run python. The idea behind PSM is to use it on the Raspberry Pi itself, or any other platform that supports python.


OK Thiago, got it now. I'll give it a spin on a RPI and let you know how I get on 🙂
Reply 0 0
alexburcea
Hi,

The PSM is a big thing, good job! I start to connect the Sequent Microsystems Home Automation card to OpenPLC. The logical inputs and outputs work just fine  (optocoupled inputs and relays). I have an issue when I need to read one ADC channel and try to put the value in a REAL variable "psm.set_var("ID0", valAdc)" does not update the variable. The "valAdc" is a floating point variable containing the voltage readings. Please tell me what I am doing wrong.
I mention that if I read the raw value and update a integer value it works.
Thank you in advance,
Alex.
Reply 0 0
thiagoralves
OpenPLC analog inputs are 16-bit integers. Think of that like ADC registers on microcontrollers. You will have to do some scaling (like multiplying by 100 or any other constant) to properly fit on the 16 bit integer
Reply 0 0
NWT.Stuff
Thiago, Are there any minimum requirements for this PSM with regard the RPI. e.g. Hardware RPI2A, RPI-OS e.g. buster, stretch etc. Python 2 /3 etc.? 
Reply 0 0
alexburcea
My question was why I can not update a REAL variable with the "psm.set_var()" function?
Reply 0 0
thiagoralves
alexburcea wrote:
My question was why I can not update a REAL variable with the "psm.set_var()" function?

because psm.set_var() expects a boolean or an integer. You need to wrap your variable with the int() call, like:
psm.set_var('IW0', int(my_float_var))

As for ID0, OpenPLC does not have hardware buffers for that, so PSM can't do anything about it. The only hardware buffers OpenPLC has are booleans inputs/outputs (IX0.0, QX0.0) and integer (analog) inputs/outputs (IW0, QW0).

In the future I might add more hardware buffers if needed to accommodate different types of hardware data
Reply 0 0
thiagoralves
mbeffa wrote:
This is REALLY great news not for the MegaIO-IND, but for all of our boards. 
We installed OpenPLC and tested it with our Home Automation Board. 
Alex the software guru reports that he was able right away to read an input and set a relay using OpenPLC.
We still have to test with the analog inputs and outputs, we'll report back soon. 
We have 15-20 I/O boards for Raspberry Pi and they all have Python libraries.
Killing so many birds with one stone... Thanks Thiago.

Thanks @mbeffa! I knew that PSM would be a big thing, that's why I wanted to take the time to code it properly. It is still in "beta", I haven't made any official statement about it yet, so please test it throughly and let me know if you find any bug.
Reply 0 0
thiagoralves
NWT.Stuff wrote:
Thiago, Are there any minimum requirements for this PSM with regard the RPI. e.g. Hardware RPI2A, RPI-OS e.g. buster, stretch etc. Python 2 /3 etc.? 

PSM should be able to run on anything that can run Python 3. OpenPLC installer should automatically install Python 3 if it is not already installed on your system. The only "internal" requirement for PSM is PyModbus for Python 3, but OpenPLC installer takes care of that as well.
Reply 1 0
NWT.Stuff
Thiago,

Just installed on a RPI4.  It went smooth no errors and all seems OK.

Before I do any sample coding I wanted to check a couple of things.

1. My Potential Application 
As we have discussed in the past I have RPI Systems running Open PLC for all things that are well suited to PLC control..  However I also have a Python Routine running on start up that handles data and status logging to database.  This can be values for arduino on USB or Stuff from the PLC accessed with PyModbus.  My HMI is PHP which is animated from the MariaDB database which is effectively representing a Tag Server in HMI Speak.

So I am assuming with PSM I can basically more less paste my routine into the PSM window ?

So Questions are:-
Python Module is started on START PLC button ?
What happens if there is an error in the Python Routine ? Does the PLC carry on ?
I am kind of hoping it does as my PLC Programs run faultlessly however as the Python Routine is handling all the comms tasks it is much harder to debug for all eventualities.
I would implement a Python Heartbeat and write to a PLC Register.  Absence of Heartbeat would trigger a PLC alarm.

This brings me along to my next point = Alarms and Warning and Error Handling.  This has always been a headache for as the python and PLC is split. I believe PSM will enable me to implement a proper system in place in the PLC.  Also PLC Ladder logic is great for masking alarms 🙂

2. Mapping
I am assuming that if I choose the PSM for Linux Option then the raspberrypi.cpp file is not taken into account ? Likewise I am assuming that no IO is mapped so I do this in the PSM code area like I would conventionally do with a Python Routine ?

Kevin



   
Reply 0 0
alexburcea

because psm.set_var() expects a boolean or an integer. You need to wrap your variable with the int() call, like:
psm.set_var('IW0', int(my_float_var))

As for ID0, OpenPLC does not have hardware buffers for that, so PSM can't do anything about it. The only hardware buffers OpenPLC has are booleans inputs/outputs (IX0.0, QX0.0) and integer (analog) inputs/outputs (IW0, QW0).

In the future I might add more hardware buffers if needed to accommodate different types of hardware data


This clarify my question, thank you. Is my first interaction with OpenPLC, you did a grate job.
And something off topic: I follow your instructions to install ScadaBR and try to connect one of our cards (standalone) thru MODBUS RTU on RS485. I get some java errors related to serial port, can you help me or I need to read more documentation? (maybe you can tell me the user and password to access the linux that runs the ScadaBR)

Alex. 
Reply 0 0
thiagoralves

NWT.Stuff wrote:

1. Python Module is started on START PLC button ?
2. What happens if there is an error in the Python Routine ? Does the PLC carry on ?
3. I am assuming that if I choose the PSM for Linux Option then the raspberrypi.cpp file is not taken into account ?
4. Likewise I am assuming that no IO is mapped so I do this in the PSM code area like I would conventionally do with a Python Routine ?

1. Yes
2. In case of any error, PSM shuts itself down. OpenPLC runtime continues running with PSM disabled (you will see a message on dashboard indicating that PSM was disabled)
3. Yes. Only one driver can be loaded. If you load PSM, there is no Raspberry driver in there
4. In that case, for the Raspberry Pi you can manually map all your GPIO pins in python using PSM like you would do on a normal python program. Just tie each GPIO pin with the OpenPLC variable you want using psm.get_var() and psm.set_var() calls.

Reply 2 0
thiagoralves

alexburcea wrote:

I follow your instructions to install ScadaBR and try to connect one of our cards (standalone) thru MODBUS RTU on RS485. I get some java errors related to serial port, can you help me or I need to read more documentation? (maybe you can tell me the user and password to access the linux that runs the ScadaBR)

Are you trying to use the serial port through VirtualBox? That's a bad idea. You would need to redirect the serial port from the VM to your computer, and that's a pain. The best approach is to install ScadaBR natively on a linux machine.

In any case, the username / password for the VM is scadabr / scadabr (normal user) and root / scadabr (admin)

Reply 0 0
Reply