필터 지우기
필터 지우기

Resetting Integrator by output of state flow in Simulink

조회 수: 7 (최근 30일)
Philipp Pasolli
Philipp Pasolli 2021년 8월 30일
댓글: Philipp Pasolli 2021년 8월 31일
Hello,
i have a simulink model containing an integrator and a state flow diagram. The integrators output is an input to the state flow diagram and is multiplied with a value depending on the state of the state flow diagram.
The state flow diagram also outputs the current state, e.g. 1,2,3, etc. I would like to e.g. reset the integrator when the stateflow diagram reaches state 2. However, this configuration triggers an error in the simulation:
"'untitled/Chart' or the model referenced by it contains a block that updates persistent or state variables while computing outputs and is not supported in an algebraic loop. It is in an algebraic loop with the following blocks."
simulI am not sure why, since a simple reset of the integrators shouldn't call for such a behavior? In any way, does anybody has a suggestion on how to fix this issue?
Attached are screenshots of the model and the state flow diagram, as well as the model itself.

채택된 답변

Jonas
Jonas 2021년 8월 31일
Simulink cannot know which action to do first, since they depend on eachother. If you take output of the Stateflow s, reset the integrator, then the input of the Stateflow Int is different, which changes the state, which means it should NOT reset the integrator, which means the input of the Stateflow Int is different, which changes the state, which means ........ This is an algebraic loop.
Solution: add a Transport Delay block somewhere on the signal line marked in red.
  댓글 수: 3
Jonas
Jonas 2021년 8월 31일
편집: Jonas 2021년 8월 31일
The Stateflow block calculates its outputs based on its inputs. So it first tries to determine all the inputs. It sees that the integrator block depends on the comparison block. It then sees that the comparison block depends on the output 's' of your Stateflow. Then it gets stuck because it did not determine the outputs of the Stateflow yet, because it was still trying to determine the inputs.
Indeed, a 'human' would be able to see-through the algebraic loop. There may be a few workarounds, by for example disabling the Algebraic Loop error in the Configuration Parameter settings? Maybe the Chart has a few settings, related to initialization. Don't have experience on this specific example.
Philipp Pasolli
Philipp Pasolli 2021년 8월 31일
Fair point, thanks for the clarification and suggestions.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Complex Logic에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by