randomplcuser
I'd like to connect the MATIEC compiler's output to the foreign function interface of my multiphysics engine (Modelica!) for co-simulation of digital designs.

So, Multiphysics <->PLC Model. I was thinking (effectively) of writing a shim around the DLL produced by MATIEC/OpenPLC, but I'm unsure exactly how that would look - I would also like to be able to externally control the "tick rate" of the PLC model (because the Runtime is using the local PC's clock and the Multiphysics engine's sense of time progresses differently, I'd have to find a way to interface them.

I'm wondering if anyone out there is also interested in this, or understands the OpenPLC codebase well enough to point me in the right direction. Thanks everyone!
Reply 0 0
thiagoralves
The easiest way would be to write an OpenPLC driver that attaches to your Modelica simulation. The driver accesses the OpenPLC buffers and can become the bridge between OpenPLC located variables (%QX, %IX, etc) and your simulation. If writing a driver is too much, maybe you could write a Python bridge that talks Modbus with OpenPLC and something else with your Modelica simulation. This Python bridge could be added as a Modbus slave device on the OpenPLC runtime, essentially achieving the same goal.
 
Now, all these ideas require your simulation to run in real time, which doesn't seem to be the case. To synchronize the OpenPLC runtime and your simulation on the same clock will require some forward thinking. I suggest you begin by attaching the IOs first and then you solve the clock issue.
Reply 0 0
Reply