How do I get stateflow to use parameters in Simulink.parameter object?
22 ビュー (過去 30 日間)
古いコメントを表示
Hi,
I have been looking around for a answer to this but have not found any concrete usefull information.
I have a simulink model containing a stateflow chart. In this stateflow chart I would like to use parameters from a Simulink.parameter object. I will be building the model using ert_shrlib target.
The struct looks like this:
Futhermore i have a bus defined like this (it has the two parameters im using in my test setup):
I have tried to look at the example sf_bus_demo but that seems to build the bus in simulink and then pass it to Stateflow via an input. What i would like to do is to make the parameters available in stateflow like done with non-simulink.parameters objects (see picture below):
I have tried to mess arround with adding the "ParamStruct" bus but have not been able to get it to work.
I can't seem to figure out how to do this. Maybe my understanding of how to approach this is not correct?
I have attached the small test setup im trying to get to work.
Thanks,
Ebbe Nielsen
0 件のコメント
採用された回答
Fangjun Jiang
2020 年 3 月 20 日
If you add a "data1" in Stateflow and specify its scope as "Parameter" and "Type" (meaning data type) as "Inherit: same as Simulink", it will automatically look for the variable "data1" in base workspace (or data dictionrary). You can then define "data1" as a Simulink.Parameter object. They will be linked.
Your "ParamStruct" is a Simulink.Bus object. In that case, define it in base workspace. In Stateflow, when you add data, specify the "type" as "Bus: ParamStruct".
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Simulink Functions についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!