How to use Enabled subsystems?

3 views (last 30 days)
SIMONE PARENTELA
SIMONE PARENTELA on 14 Feb 2021
Commented: Jonas on 15 Feb 2021
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.

Answers (1)

Jonas
Jonas on 15 Feb 2021
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.
  2 Comments
SIMONE PARENTELA
SIMONE PARENTELA on 15 Feb 2021
I didn't understand this part
Set the 'Output when disabled' of the output port of the enabled subsystem to be 'reset', and set 'Initial Output' to 0.

Sign in to comment.

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!