Motor Control Blockset examples: Using variant source block

Hello,
a Variant source block is used in 'mcb_pmsm_operating_mode_f28379d.slx' model example to switch betwen SIMulation mode and CODE-generation mode. Inside Varian source block, there are two variables: mcb_isCodeGenVar() and mcb_isSimVar().
Could you please tell me where and how are those variables set? When the model decides what mode is to be chosen? Do I have to play with a Variant manager?
Thanks
Petr

 採用された回答

Mark McBroom
Mark McBroom 2020 年 6 月 11 日

1 投票

Those are functions, not variables. They are p-coded M-Files that are shipped with the example. Type the following to see where the files exist:
who mcb_isCodeGenVar
Thanks.
Mark.

5 件のコメント

Petr Kadanik
Petr Kadanik 2020 年 6 月 11 日
Hello Mark,
thanks for reply.
Have tried 'who mcb_isCodeGenVar' in the Matlab command window, but it doesn't return any value.
I've found out that 'variant source' block inputs automatically swap if I simulate or if I want to deploy the code.
However, I still don't know where the functions mcb_isCodeGenVar() & mcb_isSimVar() are located? Can I modify/edit them? Is it a specific part of 'motor control toolbox'?
Cheers
Petr
Mark McBroom
Mark McBroom 2020 年 6 月 11 日
My mistake, use "which" not "who". The file mcb_isCodeGenVar() should be in the same folder as the example simulink model. You can not modify these 2 functions ( .p code is a unreadable form of an .m file).
Thanks.
Mark.
>> which mcb_pmsm_operating_mode_f28379d
/Applications/MATLAB_R2020a.app/toolbox/mcb/mcbexamples/mcb_pmsm_operating_mode_f28379d.slx % block diagram loaded
>> which mcb_isCodeGenVar
/Applications/MATLAB_R2020a.app/toolbox/mcb/mcbexamples/mcb_isCodeGenVar.p
>>
Petr Kadanik
Petr Kadanik 2020 年 6 月 11 日
Perfect. Thanks.
So, mcb_isCodeGenVar() function (and associated p-file) is a specific item of MotorControl Toolbox. Please, confirm.
Is there any document with the list and of those 'integrated' functions for the MC toolbox (including a function description and applicability)?
Petr
Mark McBroom
Mark McBroom 2020 年 6 月 11 日
Yes, those two functions are part of the Motor Control Toolbox. Neither of these two functions are currently documented in MATLAB Help. I'll add a change request to have them added to the help documentation.
Petr Kadanik
Petr Kadanik 2020 年 6 月 11 日
I would be perfect. Thanks a lot.

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMotor Control Blockset についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by