How to run Matlab Function in a triggered subsystem in Simulink

3 views (last 30 days)
Good evening.
I am running a simulation in Simulink/Simscape with a fundamental sample time (set in the Powergui block) equal to 5e-6 seconds.
Then in the model I need to run a certain code each 5e-3 seconds; I tryed to make it with a triggered subsystem containing the MATLAB Function block where the code is written, but I get an error message. I also tried to latch the inputs but still it does not work.
The main model is this one
while the triggered subsystem is this one
Finally, this is the error message
.
Thank you for your kind help.
Alberto

Accepted Answer

Sindhu Yerragunta
Sindhu Yerragunta on 7 Aug 2017
Hi Alberto,
From the error message I understand that the issue is due to having different sample times for 'Boost_Converter2/Subsystem/Out1' and 'Boost_Converter2/DC-DC Boost/Sum1'. This can be resolved by keeping a Rate Trasition Block between these two ports.
For further information on Rate Trasition Block please refer the following link,
If you do not want to change your model, you can change the 'Multitask rate trasition' option in 'Configuration Parameters--> Diagnostics--> Sample Time' to warning.
Hope this resolves the issue.
-Sindhu

More Answers (0)

Community Treasure Hunt

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

Start Hunting!