Is there a MATLAB simulation time command supported by Simulink Design Verifier?
Mostrar comentarios más antiguos
I am working on a Simulink model with a MATLAB Function block. The function in the function block requires the current simulation time. At the moment this is solved via an input with a Digital Clock block.
Is there a MATLAB command that could do this and is compatible with the Simulink Design Verifier?
4 comentarios
I'll look into this for you.
Thanks.
Joshua
el 18 de Oct. de 2024
Pat Canny
el 18 de Oct. de 2024
I got several options from some internal experts:
- To get the simulation time at the MATLAB prompt: "get_param(bdroot,'SimulationTime')"
- To get the simulation time inside a MATLAB System block: matlab.system.getcurrenttime
- To get the simulation time inside a Stateflow chart (MATLAB action language): getSimulationTime();
- To get the simulation time inside a MATLAB Function block: we don't think there is a function for that. If the block is fixed-step discrete, the recommendation is to take the sample time as a parameter and count the time in the code.
Hopefully that helps. If so, let me know and I can submit this as an Answer.
Joshua
el 18 de Oct. de 2024
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre MATLAB Function Block Basics en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!