Clear Filters
Clear Filters

Execution order of mdlOutputs and mdlUpdate

4 views (last 30 days)
Martin
Martin on 10 Jul 2015
Hi,
I have a Simulink model with two types of blocks, A and B. A does some pre- and postcalculation in each simulation step (there is only one block of type A in the model), while the main computation is done by blocks of type B. It is important that mdlOutputs of all blocks of type B is executed between the pre- and the postcalculation in block A. So far, I solved it by setting the option SS_OPTION_PLACE_ASAP for block A, doing the precalculation in A::mdlOutputs, and the postcalculation in A::mdlUpdate. This works if all blocks have the same sample time. For example, if the sample time is 0.1 and I have two blocks of type B (namely B1 and B2), I get the following execution order:
t = 0.0
A::mdlOutputs (precalculation)
B1::mdlOutputs
B2::mdlOutputs
A::mdlUpdate (postcalculation)
t = 0.1
A::mdlOutputs (precalculation)
B1::mdlOutputs
B2::mdlOutputs
A::mdlUpdate (postcalculation)
t = 0.2
A::mdlOutputs (precalculation)
B1::mdlOutputs
B2::mdlOutputs
A::mdlUpdate (postcalculation)
However, if I change the sample time of block B2 to 0.2, it doesn't work any longer:
t = 0.0
A::mdlOutputs (precalculation)
B1::mdlOutputs
A::mdlUpdate (postcalculation)
B2::mdlOutputs // after postcalculation -> wrong
t = 0.1
A::mdlOutputs (precalculation)
B1::mdlOutputs
A::mdlUpdate (postcalculation)
t = 0.2
A::mdlOutputs (precalculation)
B1::mdlOutputs
A::mdlUpdate (postcalculation)
B2::mdlOutputs // after postcalculation -> wrong
Is there a way to get B2::mdlOutputs called between the calls of A::mdlOutputs and A::mdlUpdate?
Many thanks in advance, Martin

Answers (0)

Categories

Find more on General Applications in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!