필터 지우기
필터 지우기

How to set the limits of a saturation block from workspace

조회 수: 4 (최근 30일)
Christian Boettcher
Christian Boettcher 2016년 7월 20일
댓글: Mark McBroom 2016년 8월 24일
Hello everyone!
I have several saturation blocks in my model and i want to change the upper and lower limits at once. I defined a variable in the workspace, and simulink just takes it as the upper and lower limit. But if i build code nothing happens. There are no range checks at all. If i enter the value directly, i get correct results...
For example:
myLimit = 5
Upper Limit: myLimit
Lower Limit: -myLimit
-> Noting happens in the Code
Upper Limit: 5
Lower Limit: -5
->Range checks as desired
Are there any ways to change these limits with a single line of code?
  댓글 수: 3
Christian Boettcher
Christian Boettcher 2016년 7월 21일
Yep, they are victims of the optimization. The code doesn't change at all...
I tried your suggestion and it works.
I don't want to have this value tunable actually. It's just a limitation to avoid overflows. So it's set once and shouldn't be touched after that. I want to have this value centrally to avoid magic numbers in the model and if i must change it, i would like to save time.
I would love to have something, which leads to a #define in the c code and does the range checks against the defined value...
Mark McBroom
Mark McBroom 2016년 8월 24일
Change storage class from SimulinkGlobal to ExportedDefine

댓글을 달려면 로그인하십시오.

답변 (0개)

태그

Community Treasure Hunt

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

Start Hunting!

Translated by