UAV Toolbox Guidance Model block has mask callback that modifies model at compile time, which prohibits multi-instance model reference

1 回表示 (過去 30 日間)
UAV Toolbox Guidance Model block, doc link: Reduced-order model for UAV - Simulink (mathworks.com), consists mask callbacks that perform tasks such as bus object creation according to UAV type & data type. This poses problem in situations such as the one in the attachment, where ChildMdl.slx containing this block is being refered twice in the ParentMdl.slx, i.e. multi-instance of the child model under the same parent model. Try to run ParentMdl.slx and see the error message:
The model 'ChildMdl' has changed between the time when two instances of this model were compiled. This is not allowed for models referenced in Normal Mode.
I tried to completely dismantle the mask of this block, however, this error message persists. It is potentially due to the inner mask on top of the ComputeDerivative & StateVector2Struct system object. Does anybody know any workaround?

採用された回答

Jianxin Sun
Jianxin Sun 2021 年 4 月 6 日
Hi Zhang,
Thanks for bringing up this issue. You can try a few workarounds:
  1. You can change the model reference block's simulation mode to accelerator mode. Check the doc page for reference.
open_system('ParentMdl.slx');
set_param('ParentMdl/UAV1', 'SimulationMode', 'Accelerator');
set_param('ParentMdl/UAV2', 'SimulationMode', 'Accelerator');
This should let you simulate from parent model.
2. Alternatively, you can use the fixedwing MATLAB API in a MATLAB function block. This should let you compute the derivatives of the equation of motion. You can then use integrator block to get the UAV state.
Thanks,
Jianxin
  1 件のコメント
Yingao Zhang
Yingao Zhang 2021 年 4 月 6 日
Hi, Jianxin, Thanks for your brilliant idea. I actually translated the block into S-function using embedded coder as workaround. Which is functionally the same as accelerator run. Cheers!

サインインしてコメントする。

その他の回答 (0 件)

タグ

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by