Execution order of mdlOutputs and mdlUpdate
조회 수: 4 (최근 30일)
이전 댓글 표시
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
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 General Applications에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!