Run simulation with Arduino IO programmatically

5 visualizaciones (últimos 30 días)
Manfred Mevenkamp
Manfred Mevenkamp el 20 de Jun. de 2022
Comentada: Manfred Mevenkamp el 4 de Jul. de 2022
Using
set_param('model', 'SimulationMode', 'external')
set_param('model', 'SimulationCommand', 'Start')
a simulation with Arduino I/O can be run from an M-script.
Can the same be done in the simpler "Connected IO" mode?
I was searching a SimulationMode like 'connected_io', but it doesn't seem to exist.
Or does it?

Respuestas (1)

Aman Banthia
Aman Banthia el 4 de Jul. de 2022
Hi Manfred, I understand you are trying to call "Connected IO" mode for simulation programmatically, you can use the following code to do that, it may not show any visible changes when MATLAB opens up but it should run if the Simulink Model is run programmatically too.
set_param('model', 'SimulationMode', 'external')
set_param('model', 'SimulationCommand', 'Start')
set_param('model','ConnectedIO','on')
  1 comentario
Manfred Mevenkamp
Manfred Mevenkamp el 4 de Jul. de 2022
Thank you Aman.
set_param('model','ConnectedIO','on')
is what I needed. After setting this parameter my simulation could be run simply with the 'sim' command.
However, with
set_param('model', 'SimulationMode', 'external')
set_param('model', 'SimulationCommand', 'Start')
Simulink always uses code generation and runs the model in the "Monitor&Tune" mode, not in "Connected IO" mode. The additional "set_param('model','ConnectedIO','on')" then seems to have no effect.
In short:
set_param('model', 'SimulationMode', 'normal')
set_param('model','ConnectedIO','on')
sim('model')
does the job.

Iniciar sesión para comentar.

Categorías

Más información sobre Arduino Hardware en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by