how can I provide feedback in simulink.

while simulating battery model that I created using S2 level block ,
I have to provide the new State of Charge of a battery as input i.e feedback, and the SOCnew is dependent on the input (say SOCold)
If I connect SOCnew Directly to input, I get this error
"Algebraic state in algebraic loop containing 'untitled/SOCnew' computed at time 0 is Inf or NaN. There may be a singularity in the solution. If the model is correct, try reducing the step size (either by reducing the fixed step size or by tightening the error tolerances)."
If I provide a constant/repetitive input as initial SOC then everything works fine without error and satisfying the equations that I implemented in coding.

Answers (1)

Sabin
Sabin on 26 Jun 2025
Edited: Sabin on 26 Jun 2025
Best to break the loop with either a unit delay (discrete-time simulation) or a transfer function (continuous-time simulation) and set a valid initial condition for the feedback variable. This should fix the problem.

Asked:

on 28 Sep 2017

Edited:

on 26 Jun 2025

Community Treasure Hunt

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

Start Hunting!