How to use Callbacks in SimEvents?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Matthias Meißner
el 29 de Nov. de 2017
Respondida: Teresa Hubscher-Younger
el 30 de Nov. de 2017
I want to change the value of an attribute of an entity within the SimEvents Block Entity Generator. Background is that I want to change this attribute dependent on the simulation time. However, I did not find a way to get access to the appropriate Attribute because I am not able to find the correct name of these parameter to use the set_param function. Did someone knows a way to solve this problem?
0 comentarios
Respuestas (1)
Teresa Hubscher-Younger
el 30 de Nov. de 2017
Hi,
If you want entities generated at a certain simulation time to have a certain attribute, the best way to do that is within SimEvents, not to have Simulink to control it via callbacks. You can do this by having the Entity Generator call out to a Simulink Function on the Generate Event Action to check the time. This MATLAB Answers post talks about how to get current simulation time using Simulink blocks while the model is executing https://www.mathworks.com/matlabcentral/answers/57825-how-to-get-current-time-of-simulation-while-model-is-executing. You can put that in a Simulink Function and access that via MATLAB in an Event Action to determine which attribute should be assigned. Here is help on the Simulink Function block: https://www.mathworks.com/help/simulink/slref/simulinkfunction.html Here is an example with a Simulink Function: https://www.mathworks.com/help/simevents/examples/simulate-scheduler-of-a-multicore-control-system.html
Please let me know if this helps.
Thanks, Teresa
0 comentarios
Ver también
Categorías
Más información sobre Discrete-Event Simulation 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!