フィルターのクリア

same input output signal name in simulink

14 ビュー (過去 30 日間)
TaeHee Kwun
TaeHee Kwun 2019 年 7 月 12 日
コメント済み: sreedevi 2021 年 6 月 13 日
I want to make code below by model (or stateflow) using Code Generation
if( var > 10){
var = 10;
}
In this case, upper 'var' is input of chart(or subsystem) and lower 'var' is output of chart.
So, it occurs signal complication if I use same variables name or I can't make same name of chart's input and output.
I can make this if sentance by using two variables, but I hope to make this by using one.
Thanks for your help.
Sincerely,
TaeHee Kwun.

採用された回答

Phani Teja
Phani Teja 2019 年 7 月 16 日
編集済み: Phani Teja 2019 年 7 月 16 日
Yeh It can be possible with Data store memory block.
Make a Variable 'Var' in stateflow and change its scope to Data store memory .
You can also control the variable storage class by resolving data store memory with simulink signal.
The generated code looks like:
/* Real-time model */
RT_MODEL_Chart_T Chart_M_;
RT_MODEL_Chart_T *const Chart_M = &Chart_M_;
/* Model step function */
void Chart_step(void)
{
/* Chart: '<Root>/Chart' */
/* Re-use inputs */
if (Var > 10) {
/* NEW_PATTERN */
Var = 10;
}
/* End of Chart: '<Root>/Chart' */
}
  2 件のコメント
TaeHee Kwun
TaeHee Kwun 2019 年 7 月 20 日
Thanks for your answer!
But, I can't still understand how to make this blocks...
If you can, can you upload some of your blocks?
Thanks.
sreedevi
sreedevi 2021 年 6 月 13 日
Hi ,Did you get an answer for the question.If yes please post it

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSimulink Functions についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by