How do you fix "not in scope" errors in simulink s-function?

조회 수: 16 (최근 30일)
Stephen Von Vogt
Stephen Von Vogt 2018년 2월 10일
편집: Mark McBroom 2018년 3월 10일
I'm running into an error with an S-function that I created from a Simulink Stateflow block using the Simulink Coder.
When I try to use the S-Function, I get the error: "Simulink.DataType object 'Braking_ControlModeType' is not in scope from 'HW_Sfun/Control/PLC/Braking_Control_fxdStp/Braking_Control_sfcn'"
I'm clueless as to what "not in scope" means in this context, and haven't found it addressed in the documentation. Can anyone point me to the right documentation?
Thanks!
PS I'm running this in R2017b. (Pictures and c code attached, in case it's helpful.)

답변 (1개)

Mark McBroom
Mark McBroom 2018년 3월 10일
편집: Mark McBroom 2018년 3월 10일
Is Braking_Control a signal/variable in your Stateflow diagram? I am guessing that this is the Active State Output of the state machine? For this feature, Simulink implicitly creates an enumerated data type to represent the state. A couple of possible workarounds:
1. If you don't need to output this state, then disable the feature in Stateflow and regenerate s-function.
2. If you do need to output the state, then you could try creating Simulink Enumerated data type. The name of the data type should be: Braking_ControlModeType and the enumerator values should be the names you have used for the states in your state machine.

카테고리

Help CenterFile Exchange에서 Simulink Coder에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by