Need help on fixing Stateflow model.
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Jung Sunghun
le 20 Jan 2023
Réponse apportée : Fangjun Jiang
le 20 Jan 2023
Hello, I would appreciate if you help me on fixing my Stateflow model.
I am currently building a Stateflow model to control the amount of charging current flowing into a battery pack and control logic can be found in the following figure.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1269295/image.jpeg)
To achieve objective, I decided to use a Stateflow based model built as follows, but I contronted an error message shown below.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1269300/image.jpeg)
Variables used are listed and defined as below.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1269305/image.jpeg)
The model file is attached in here. I do appreciate your time on considering this issue.
PS: MATLAB R2021b
0 commentaires
Réponse acceptée
Fangjun Jiang
le 20 Jan 2023
First, "d" is not a parameter. You need to change it to be a "local data" and give an initial value, e.g. 0.
The error message regarding "default transition" is puzzling. To me, it seems to be a new type of error related to a "default transition". My guess is this. The chart contains states, thus it is a "state chart", not a pure "flow chart". The "default transition" has to be guaranteed to reach a state. Your logic has various conditions and it is not guaranteed, thus the error.
The easiest fix is to insert a blank state between your default transion and your top junction. The model then simulates. Obviously, this blank state is reduntant. You might want to change your implementation. For example, move the condition for "Bat_cur" outside of the chart.
One more improvement, there is no need to fill the "[Bat_vol>=Bat_vol_max]" condition. Leave it empty.
You don't need to write this code
if a>0
...
elseif a<=0
...
end
Instead, you can write
if a>0
...
else
...
end
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Complex Logic dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!