Execute command on Host PC (windows) triggered by simulink real time model

4 views (last 30 days)
Stefano Truzzi
Stefano Truzzi on 17 Dec 2021
Answered: Midhulesh Vellanki on 31 Mar 2022
my setup is the following:
  • Device under test (MCU board)
  • Host PC (Windows) running simulink real time and python application
  • Target PC (Speedgoat) running the real time application
I tried to use a test sequence to run the simulink model on the target PC while triggering a python script that activates specific functions on the device under test. I used the matlab
command to run a .bat file to launch the python script but it is not supported by simulink coder hence it rightfully does not build the real time application.
How is it possible to trigger commands on the host PC from the target PC at runtime?
What I would like to verify with the real time application and hardware is if the sequence of commands written in the python script and launched by the host PC, are executed correctly by the device under test.
The following figure shows the configuration of the system.
Thank you

Answers (1)

Midhulesh Vellanki
Midhulesh Vellanki on 31 Mar 2022
This might be a little late but here is my suggestion:
  1. You stream data using matlab sdi command line interface. So you can add a logic in your simulink model to set a variable when it is time to trigger your pythn script.
  2. You can read trigger in matlab on host machine using sdi command line interface (this is just a simple matlab script that can start your real-time application and waits for a trigger from your target.)
  3. Once your your matlab script recieves the trigger it can lauch your python script with system() on your host machine.
Let me know how that works out for you

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!