![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/519737/image.png)
How to use Enabled subsystems?
2 次查看(过去 30 天)
显示 更早的评论
The model has to output the value of battery charge increase at the end of braking. So there will be an interval when I brake and the battery state of charge increases. Example: start t=1 SOC=0, end t=20 SOC=5. When braking is finished I must have SOC=5 as output. As soon as I have sent this signal as output I must have zero and wait for the new braking and indicate in the output what is the accumulated state of charge (SOC).
I was thinking of using the enabled system. Where as input I have Mode (which can take values 0=acceleration 1,2=braking) and delta SOC which is a cumulative value of my battery state of charge (i.e. how much it is charging).
I set the switch so that it gives me a value of 0 when Mode is non-zero and thus have an increase in SOC. As soon as Mode is equal to zero it means that I have finished braking and I can send the system what I have accumulated.
However, the system is not working, and furthermore I would like to understand how the accumulative SOC signal can be sent at the initial instant of mode=0 and not for the entire interval.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/519022/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/519027/image.jpeg)
0 个评论
回答(1 个)
Jonas
2021-2-15
Change the Enable Port of the enabled subsystem to be 'Reset' for 'Status when enabling'. Set the 'Output when disabled' of the output port of the enabled subsystem to be 'reset', and set 'Initial Output' to 0.
Then, instead of directly feeding the output of the switch block to the enable port of the enabled subsytem, compare its signal using a relational operator with its signal of one unit delay, to find a falling edge to enable to enabled subsystem.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/519737/image.png)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!