How to connect simpowersystem generic battery block to the simscape blocks without an algebraic loop error?

4 views (last 30 days)
Hello,
I'm new to Matlab-Simulink. I cannot directly connect the generic battery block to the simelectronics blocks in the model. To achieve this, I first connected the voltage measurement block to the generic battery terminals, and then its output signal to the controlled voltage sensor block. However, the voltage I receive this way is the initial voltage value of the generic battery and does not decrease over time depending on the load. To ensure this voltage decrease, I connected a controlled current source as a load to the generic battery. I connected the signal I received from the current sensor on the Simscape side to the input of the current source. But this gave the following algebraic loop error.
Is there a different way to connect the generic battery block to the simscape blocks without getting an algebraic loop error?
Thanks for any help.
Best Regards
Block diagram 'DronePropellerMotorBattery_v5' contains 1 algebraic loop(s). To see more details about the loops use the command Simulink.BlockDiagram.getAlgebraicLoops('DronePropellerMotorBattery_v5') or the command line Simulink debugger by typing sldebug('DronePropellerMotorBattery_v5') in the MATLAB command window. To eliminate this message, set Algebraic loop to "none".
Component:Simulink | Category:Block diagram warning
Component:Simulink | Category:Model
Discontinuities detected within algebraic loop(s), may have trouble solving
Component:Simulink | Category:Model warning
Convergence problem when solving algebraic loop containing 'DronePropellerMotorBattery_v5/Solver Configuration' at time 0.0. Simulink will try to solve this loop using Simulink 3 (R11) strategy. Use feature('ModeIterationsInAlgLoops',0) to disable the strategy introduced in Simulink 4 (R12)
Component:Simulink | Category:Block warning
Solver is encountering difficulty in simulating model 'DronePropellerMotorBattery_v5' at time 1.1125369292536007e-308. Simulink will continue to simulate with warnings. Please check the model for errors.
Caused by:
  • Solver was unable to reduce the step size without violating the minimum step size value of 2.22507E-308 for 1 consecutive times at time 0. This usually may be caused by violating algebraic constraints in the differential-algebraic system or by the high stiffness of the system. Try tightening the error tolerances, and/or the tolerances for computing consistent conditions. If the problem persists, please check the system or increase the solver Number of consecutive min steps violation parameter.
Suggested Actions
Open Solver Profiler to explore such issuesOpen
Component:Simulink | Category:Block diagram warning
An error occurred during simulation and the simulation was terminated
Caused by:
  • Algebraic state in algebraic loop containing 'DronePropellerMotorBattery_v5/Voltage Measurement/do not delete this gain' computed at time 2.2250738585072014E-308 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) or tweak the initial guess of algebraic loop variable values.

Answers (1)

MULI
MULI on 6 Nov 2024
Hi Yurdakul,
I understand that you are trying to connect a SimPowerSystems battery block to Simscape components and facing an algebraic loop issue:
You can follow the below suggestions to eliminate this error:
1. Introduce a Delay
  • The algebraic loop error occurs due to direct feedback between the SimPowerSystems and Simscape domains, so breaking this loop is crucial.
  • To break the loop, consider inserting a small delay in the feedback path.
  • For instance, you can add a "Unit Delay" block on the signal between the Current Sensor and the Controlled Current Source https://www.mathworks.com/help/releases/R2024a/simulink/slref/unitdelay.html
2. Control Voltage Indirectly
For more detailed information on techniques for removing algebraic loops, you can refer to the following documentation:

Categories

Find more on Composite Components in Help Center and File Exchange

Products


Release

R2024a

Community Treasure Hunt

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

Start Hunting!