Conditionals and triggered subsystems in Simulink

Victor asked on 3 Feb 2012
Latest activity: Answer by Guy Rouleau on 4 Feb 2012

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?

0 comments

Products

    1 answer

    Guy Rouleau answered 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.

    0 comments

    Contact us at files@mathworks.com