Running C++ code in Simulink S-Functions
Hello,
We have some Simulink models developed and are planning to use an AXC F 2152 controller to use it as HIL (hardware in the loop), communicating the PLC via Modbus TCP.
I know that the Simulink plug-in creates C++ code and that code is then built into IEC, appearing as a library in the PLCnext project. My doubt is that inside the Simulink model there are some S-Functions with C++ code inside them and I would like to know if it would work correctly or if there are any limitations about using these kind of functions.
Related to this, and just to fulfill my curiosity, python programs can be called from Simulink too, would they also work?
Thanks in advance,
Asier
We have some Simulink models developed and are planning to use an AXC F 2152 controller to use it as HIL (hardware in the loop), communicating the PLC via Modbus TCP.
I know that the Simulink plug-in creates C++ code and that code is then built into IEC, appearing as a library in the PLCnext project. My doubt is that inside the Simulink model there are some S-Functions with C++ code inside them and I would like to know if it would work correctly or if there are any limitations about using these kind of functions.
Related to this, and just to fulfill my curiosity, python programs can be called from Simulink too, would they also work?
Thanks in advance,
Asier
Comments
sorry for letting you wait, but I've had to catch one of our simulink experts.
Here comes his feedback:
Another possible alternative to call python scripts might be the PLCnext Base library. With this lib it is possible to call bash commands and inside the command you can call your script.
BR,
Frank
Thank you for your answer.
I am glad the C++ writen F-functions will work. I will also take a look to the TLC based S-Funtions and to the PLCnext.Base library, both seem really useful.
Best regards,
Asier