continuous하게만 사용가능한 블럭들을 한번에 볼수 있는 방법이 있을까요?
3 views (last 30 days)
Show older comments
MathWorks Support Team
on 8 Sep 2020
Edited: MathWorks Support Team
on 14 Nov 2025 at 7:00
시뮬링크를 fixed step solver를 사용하고자하는데, 다음과 같은 에러가 발생합니다.
"FixedStepDiscrete" solver cannot be used to simulate block diagram <model_name> because it contains continuous states.
continuous 하게만 사용가능한 블럭들을 모델에서 포함하고 있는것 같은데, 이런 에러 블럭들을 한번에 볼수 있는 방법이 있을까요?
Accepted Answer
MathWorks Support Team
on 14 Nov 2025 at 0:00
Edited: MathWorks Support Team
on 14 Nov 2025 at 7:00
Continuous 블락을 찾는 방법을 알려드립니다. 일단 솔버는 기존에 에러 없이 사용가능하셨던 Variable Steps 솔버로 세팅 후, 하기의 과정을 진행합니다.
1. Simulink.BlockDiagram.getInitialState 명령어 사용
예시)
open_system(docpath(fullfile(docroot, 'toolbox','simulink','examples','ex_execution_order')))
model = gcs;
states = Simulink.BlockDiagram.getInitialState(model);
if ~isempty(states)
for n=1:length(states.signals)
if strcmp(states.signals(n).label,'CSTATE')
states.signals(n).blockName
end
end
end
코드 실행 결과:
ans =
'ex_execution_order/car dynamics/Integrator'
2. sldebug 명령어 사용
하기의 예시와 같이 sldebug 사용 후, states 입력하시면 모든 states 에 대한 결과가 표시됩니다. 디버깅 종료는 quit 을 입력합니다.
예시)
>> open_system(docpath(fullfile(docroot, 'toolbox','simulink','examples','ex_execution_order')))
>> sldebug(bdroot)
%----------------------------------------------------------------%
[TM = 0 ] simulate(ex_execution_order)
(sldebug @0): >> states
Continuous States for 'ex_execution_order':Idx Value (system:block:element Name 'BlockName') 0. 0 (0:0:0 CSTATE 'ex_execution_order/car dynamics/Integrator')
Discrete States for 'ex_execution_order':
Idx Value (system:block:element Name 'BlockName')
0 0 (1:0:0 DSTATE 'ex_execution_order/discrete cruise controller/Unit Delay1')
1 0 (1:5:0 DSTATE 'ex_execution_order/discrete cruise controller/Unit Delay')
(sldebug @0): >> quit
0 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!