I have a Model with 2 charts created with code. My first chart is a test simulation which go to a TIMER EXPIRED
state when TimerStatus = 1;
. The error occurs with my timer chart :
When I try to simulate I get the error :
'ES_TestDS/Timer_principal' updates persistent or state variables while computing outputs, therefore it cannot be used in an algebraic loop. However, it is in a loop with the following blocks. For more information, see Algebraic Loops with MATLAB Function and Stateflow Blocks.
How can i fix this ? I read about Moore chart but i don't know how to convert mine into Moore chart.
Edit 1 : I have this warning in addition to the error :
If the inport 'ES_TestDS/Timer_principal/Start_Timer' of subsystem 'ES_TestDS/Timer_principal' involves direct feedback, then an algebraic loop exists, which Simulink cannot remove. Consider clearing the 'Minimize algebraic loop occurrences' parameter to avoid this warning.
Same for Stop_Timer
Edit : Maybe it can help if i show the connection between my timer and my chart
I found a manual solution :
Moore
for the Chart which cause the errorentry, during, exit ...
statements in your ChartThe problem is i still don't know how to set the State Machine Type with Matlab code if someone know
Edit : cht.StateMachineType = 'Moore';