Conditionals and triggered subsystems in Simulink

1 view (last 30 days)
I am running a simulation where my model parameters are defined in an m-file and the differential equations are in Simulink. Specifically, I have a battery model and would like to charge the battery at a constant current (input) until a high threshold voltage (output) is reached, then reverse the direction of current until a low threshold voltage is reached. I would then like to repeat this for a specified number of cycles. Due to non-linearities in the model, I can't feasibly predict the charge/discharge times and they also change as I cycle longer.
How would I implement this in the most flexible way and allow for multiple conditions? For example, after the threshold voltage is reached, I may want to hold the battery at zero current before discharging and vice versa for the opposite direction. Using a Simulink switch block doesn't seem practical because the conditions could get complicated. Would a triggered or enabled subsystem suit my purpose or would something else work better?

Answers (1)

Guy Rouleau
Guy Rouleau on 4 Feb 2012
Based on the description, Enabled subsystem sounds appropriate. The Enabled block allows you to hold or reset states when you enable the subsystem.
If you need to handle complex conditions to enable your subsystems, Stateflow could be useful.

Categories

Find more on Schedule Model Components in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!