How to Make a Simulink Scheduler for a Matlab Block Function to run each 40 ms of simulation?
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Gianluca Mammone
el 10 de Ag. de 2022
Editada: Gianluca Mammone
el 18 de Ag. de 2022
Hello, I am trying to make a controller for a system that must run every 40-50 ms. I am having difficulties with Stateflow because if I try to adapt the example given by Mathworks the matlab blocks runs just once.
In the picture you see the controller that I adapted from the example
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1093480/image.png)
this is "Edge to Function" block
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1093485/image.png)
and this is the simple subsystem called by Call() event
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1093490/image.png)
inside the matlab block there is only
j = 0;
for i = 1:10
j = j+1;
end
and here the plot of the output j, as you can see the block is triggered just once
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1093510/image.png)
Can you please help me to understand how to call the matlab block every 40 seconds or address me to a good stateflow scheduler tutorial? I haven't been lucky
0 comentarios
Respuesta aceptada
Fangjun Jiang
el 10 de Ag. de 2022
Use a Function-call Generator block, specify the sample time. Put the MATLAB Function block inside a triggered subsystem, specify the trigger as Function-call.
3 comentarios
Fangjun Jiang
el 18 de Ag. de 2022
"triggered system in a loop"?? It sounds too complicated. Please state your task, there might be a better way to construct the model to implement it.
Más respuestas (0)
Ver también
Categorías
Más información sobre Schedule Model Components 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!