How to update a variable value in discrete time step depending on the state it is in?
3 次查看(过去 30 天)
显示 更早的评论
I am using a state flow chart to determine the state the system is in. A & B are discrete variables.
There are two main OR states ON and OFF and in the ON state there are more 3 OR states namely High,low and last stored.
I have used switch,flag and key which are nothing but Boolean inputs to the state-flow chart and depending on the value of these variables the transition in states take place.
I have defined temp as a output variable. This temp variable is again used as a feedback into the state flow. The logic that I want to implement is as below....
IF *_On _* OR IF *_OFF_*
|
IF High :temp= discrete value of A | temp= discrete value of A
OR |
IF Low :temp= discrete value of A |
OR |
IF Last stored :temp= discrete value of B |
I am finding it difficult to update the output variable temp with respect to the state in discrete time step and then use it as a feed back in the stateflow. There is an error when there is change in state
I am always getting this error message "Simulink cannot solve the algebraic loop containing 'Validation/Chart1' at time 201.0 using the TrustRegion-based algorithm due to one of the following reasons: the model is ill-defined i.e., the system equations do not have a solution; or the nonlinear equation solver failed to converge due to numerical issues. To rule out solver convergence as the cause of this error, either a) switch to LineSearch-based algorithm using set_param('Validation','AlgebraicLoopSolver','LineSearch') b) reducing the fixed step size. If the error persists in spite of the above changes, then the model is likely ill-defined and requires modification."
I would appreciate any suggestion on this. Thanks.
0 个评论
采纳的回答
Azzi Abdelmalek
2012-8-2
编辑:Azzi Abdelmalek
2012-8-2
when u use an output as feedback, pass it through a block "unit delay" before feedback. don't forget to set a sample time of your unit delay block.
0 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!