btz5026
Hello. I'm trying to use OpenPLC with a RPi and Sequent Microsystems Modules (SM_16RELAY and SM_16DIN). I want to write and test code on the physical PLC as well as a "soft PLC" via OpenPLC Runtime hosted on my Windows PC. Ideally, I could run the same code that runs on the physical RPi + Sequent Micro. Modules on my WIndows hosted runtime instance. This would allow me to connect it to Factory I/O or other simulation software (via modbus) to do virtual commissioning without the PLC hardware.
 
I wrote the simple test program below and it compiled fine on my Windows hosted OpenPLC Editor. I logged into my OpenPLC Runtime (hosted on my Windows PC), selected "Sequent HAT" as my Hardware driver, and tried to upload the program, but I get a compile error (hardware_layer.cpp:37:10: fatal error: linux/i2c-dev.h: No such file or directory). Screen shots below. Can you please advise? Is this possible?
 
Thank you!
 
[203128%2F9360360%2Fmceclip0]
 
[203128%2F9360361%2Fmceclip0]
Reply 0 0
thiagoralves
The sequent driver was made to run on a Raspberry Pi, it won’t compile on Windows. You can’t run a program made for sequent hardware on Windows
Reply 0 0
btz5026
Ah, that makes sense. I was hoping to use the Windows Runtime to act as a "soft PLC" and simulate the RPi based PLC. Thanks anyway!
Reply 0 0
thiagoralves
You can simulate the program on the editor itself (blue running man icon at the top toolbar). This includes full debug capabilities, with forcing variables, and viewing variables in real time.
Reply 0 0
btz5026
Yes, that is helpful. However, I want to connect the "soft PLC" to ProtoTwin (https://prototwin.com/) or some other digital twin software to better visualize and simulate real-world robot/equipment behavior. This is possible by using the OpenPLC Runtime Modbus server, but I can't get the code to compile and run when using the specialized function blocks used by Sequent Microsystems to address the IO.

The best solution that I can think of is to write 2 versions of the code. #1 can run on a physical Sequent Microsystems PLC and uses the specialized code blocks to address the IO. #2 does not include the specialized blocks, compiles and runs on the Windows OpenPLC Runtime, and uses the Modbus physical addressing scheme per your documentation. This mostly accomplishes my goals, but requires code changes when going from virtual testing (soft PLC + digital twin SW) to physical testing (physical PLC + physical equipment).

Does that make sense? Do you have other suggestions or approaches? Thanks! ________________________________
Reply 0 0
thiagoralves
Yes, the only way to do that is by having two versions of the code. What I would suggest, to make things simpler, is to wire all your I/O on a separate program. Use global variables to connect the IO program with the logic program. Global variables can be declared in the Res0 configuration from the project tree. Then declare the global variables again in the IO program and in the logic program as External. When you want to compile the project to the softPLC, simply delete the IO program and it will run normally without any sequent hardware.
Reply 0 0
btz5026
Nice, thanks for the suggestion! I'll try it out. Appreciate the fantastic support.
Reply 1 0
Reply