- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Error(s) simulating DC/DC boost...
Error(s) simulating DC/DC boost converter
Error(s) simulating DC/DC boost converter
Hi,
I am fairly new to Modelica and I am stuck on a error that I can't make sense of. I am trying to implement a very simple behavioral model of a DC/DC boost converter. It simply needs to do two things, step up the voltage while keeping Pin = Pout and regulate the output voltage to keep below a setpoint of the input current. In other words if the input current is above a certain limit the output voltage will need to drop.
I should also mention that the simulation works fine if I don't include the PID block in the converter, but then the behavior of the model is not complete.
I am sure I must be missing something so any help would be greatly appreciated!
Following are the two files I am using:
DC/DC boost converter
Code:
model DCConv7
extends Modelica.Electrical.Analog.Interfaces.TwoPort;
parameter Real Pmax;
parameter Real Vref;
parameter Real Imax;
Modelica.Blocks.Continuous.LimPID PID(yMax = Vref, Ti = 0.0001, Td = 0, y_start = Vref, k = 10, xi_start = Vref);
equation
i1 = v2 * i2 / v1;
PID.u_s = Imax;
PID.u_m = i1;
v2 = PID.y;
annotation(Icon(coordinateSystem(extent = {{-100,-100},{100,100}}, preserveAspectRatio = false, initialScale = 0.1, grid = {2,2}), graphics = {Rectangle(lineColor = {255,255,255}, fillColor = {255,255,255}, fillPattern = FillPattern.Solid, extent = {{-72,-60},{-33,60}}),Line(points = {{-90,50},{-32,50}}),Line(points = {{-90,-50},{-32,-50}}),Rectangle(lineColor = {255,255,255}, fillColor = {255,255,255}, fillPattern = FillPattern.Solid, extent = {{33,-60},{72,60}}),Line(points = {{32,50},{90,50}}),Line(points = {{32,-50},{90,-50}}),Text(lineColor = {0,0,255}, extent = {{-100,10},{-80,-10}}, textString = "1"),Text(lineColor = {0,0,255}, extent = {{80,10},{100,-10}}, textString = "2"),Text(lineColor = {0,0,255}, extent = {{-146,115},{154,75}}, textString = "%name")}), Diagram(coordinateSystem(extent = {{-100,-100},{100,100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {2,2}), graphics = {Text(lineColor = {0,0,255}, extent = {{0,10},{100,-10}}, textString = "2=secondary")}));
end DCConv7;
Test harness:
Code:
model TestDC
Modelica.Electrical.Analog.Sources.ConstantVoltage constantvoltage1(V = 10);
Modelica.Electrical.Analog.Basic.Resistor resistor1(R = 2000);
Modelica.Electrical.Analog.Basic.Ground ground1;
Modelica.Electrical.Analog.Basic.Capacitor capacitor1(C = 0.001, v(start = 100));
/*DCConv1 dcdc(Pout = 80, Vout = 100, Vinmin = 1, Vinmax = 50, eff = 1);*/
DCConv7 dcdc(Pmax = 80, Vref = 100, Imax = 2000);
Modelica.Blocks.Sources.Pulse pulse(startTime = 0.5, amplitude = 1, period = 0.01, width = 50);
Modelica.Electrical.Analog.Ideal.ControlledIdealClosingSwitch switch;
Modelica.Electrical.Analog.Sources.SignalVoltage swDrv;
Modelica.Electrical.Analog.Sensors.PowerSensor Pin;
/*Modelica.Electrical.Analog.Sensors.PowerSensor Pout;*/
equation
connect(capacitor1.n,ground1.p);
connect(resistor1.n,ground1.p);
connect(constantvoltage1.n,ground1.p);
connect(constantvoltage1.p,Pin.pc);
connect(constantvoltage1.p,Pin.pv);
connect(Pin.nv,ground1.p);
connect(dcdc.p1,Pin.nc);
connect(dcdc.n1,ground1.p);
connect(dcdc.p2,capacitor1.p);
connect(dcdc.n2,ground1.p);
connect(dcdc.p2,switch.p);
connect(switch.n,resistor1.p);
connect(switch.control,swDrv.p);
connect(swDrv.n,ground1.p);
connect(swDrv.v,pulse.y);
annotation(Icon(coordinateSystem(extent = {{-100,-100},{100,100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {2,2})), Diagram(coordinateSystem(extent = {{-100,-100},{100,100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {2,2})), experiment(StartTime = 0, StopTime = 1, Tolerance = 0.000001));
end TestDC;
Using the default simulation parameters I am getting the following error:
Code:
LOG_NLS | warning | Error solving nonlinear system Nonlinear function (residualFunc59, size 1) at time 0.002
LOG_NLS | warning | Error solving nonlinear system Nonlinear function (residualFunc59, size 1) at time 0.002
stdout | info | model terminate | non-linear system solver failed. | Simulation terminated at time 0.002
LOG_STATS | info | ### STATISTICS ###
LOG_STATS | info | timer
| | | | | 0.00136495s [ 0.2%] pre-initialization
| | | | | 0.00048028s [ 0.1%] initialization
| | | | | 0.552368s [ 99.1%] steps
| | | | | 0.00139648s [ 0.3%] creating output-file
| | | | | 1.83313e-006s [ 0.0%] event-handling
| | | | | 1.02655e-005s [ 0.0%] overhead
| | | | | 0.00176347s [ 0.3%] simulation
| | | | | 0.557385s [100.0%] total
LOG_STATS | info | events
| | | | | 0 state events
| | | | | 0 time events
LOG_STATS | info | solver
| | | | | 113 steps taken
| | | | | 139 calls of functionODE
| | | | | 23 evaluations of jacobian
| | | | | 3 error test failures
| | | | | 0 convergence test failures
LOG_STATS | info | ### END STATISTICS ###
Process crashed
Simulation process exited with code -2
If I modify equation i1 = -v2 * i2 / v1 to i1 = v2 * i2 / (v1+0.000001)
Code:
DASSL-- AT T (=R1) AND STEPSIZE H (=R2) THE
In above, R1 = .2456570990108E-03 R2 = .6624589961672E-18
DASSL-- CORRECTOR FAILED TO CONVERGE REPEATEDLY
DASSL-- OR WITH ABS(H)=HMIN
stdout | warning | The corrector could not converge.
stdout | warning | can't continue. time = 0.000246
stdout | info | model terminate | Integrator failed. | Simulation terminated at time 0.000245657
LOG_STATS | info | ### STATISTICS ###
LOG_STATS | info | timer
| | | | | 0.00144011s [ 13.5%] pre-initialization
| | | | | 0.00056717s [ 5.3%] initialization
| | | | | 0.0056684s [ 53.0%] steps
| | | | | 0.00142397s [ 13.3%] creating output-file
| | | | | 1.09988e-006s [ 0.0%] event-handling
| | | | | 7.69914e-006s [ 0.1%] overhead
| | | | | 0.00157869s [ 14.8%] simulation
| | | | | 0.0106871s [100.0%] total
LOG_STATS | info | events
| | | | | 0 state events
| | | | | 0 time events
LOG_STATS | info | solver
| | | | | 0 steps taken
| | | | | 0 calls of functionODE
| | | | | 0 evaluations of jacobian
| | | | | 0 error test failures
| | | | | 0 convergence test failures
LOG_STATS | info | ### END STATISTICS ###
Process crashed
Simulation process exited with code -8
- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Error(s) simulating DC/DC boost...