我想为 DCDC 转换器编写一个非常简单的模型。出于某种原因,Dymola 告诉我“模型不是合适的”并且对于 Real 元素过度确定。
这可能是一个非常简单的问题,但我看不到!
这是我的代码:
model DCDC
extends Modelica.Electrical.Analog.Interfaces.TwoPort;
parameter Real demandedVoltage;
Modelica.Electrical.Analog.Sensors.VoltageSensor sekVolt annotation (
Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=270,
origin={80,0})));
Modelica.Electrical.Analog.Sensors.CurrentSensor currentSensor annotation (
Placement(transformation(
extent={{-10,10},{10,-10}},
rotation=270,
origin={-50,-30})));
Modelica.Electrical.Analog.Sources.SignalCurrent signalCurrent annotation (
Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=270,
origin={-50,30})));
Modelica.Electrical.Analog.Sources.ConstantVoltage constantVoltage(V=
vehicleVoltage)
annotation (Placement(transformation(
extent={{-10,10},{10,-10}},
rotation=270,
origin={50,30})));
Modelica.Electrical.Analog.Sensors.CurrentSensor currentSensor1 annotation (
Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=270,
origin={50,-30})));
Modelica.Blocks.Math.Division division
annotation (Placement(transformation(extent={{6,22},{-10,38}})));
Modelica.Blocks.Math.Product product
annotation (Placement(transformation(extent={{8,-8},{-8,8}},
rotation=270,
origin={30,8})));
Modelica.Blocks.Math.Gain gain(k=-1)
annotation (Placement(transformation(extent={{-20,22},{-36,38}})));
Modelica.Electrical.Analog.Sensors.VoltageSensor primVolt
annotation (
Placement(transformation(
extent={{-10,10},{10,-10}},
rotation=270,
origin={-80,0})));
equation
connect(currentSensor.p, signalCurrent.n) annotation (Line(
points={{-50,-20},{-50,20}},
color={0,0,255},
smooth=Smooth.None));
connect(constantVoltage.n, currentSensor1.p) annotation (Line(
points={{50,20},{50,-20}},
color={0,0,255},
smooth=Smooth.None));
connect(signalCurrent.p, p1) annotation (Line(
points={{-50,40},{-50,50},{-100,50}},
color={0,0,255},
smooth=Smooth.None));
connect(currentSensor.n, n1) annotation (Line(
points={{-50,-40},{-50,-50},{-100,-50}},
color={0,0,255},
smooth=Smooth.None));
connect(constantVoltage.p, p2) annotation (Line(
points={{50,40},{50,50},{100,50}},
color={0,0,255},
smooth=Smooth.None));
connect(currentSensor1.n, n2) annotation (Line(
points={{50,-40},{50,-50},{100,-50}},
color={0,0,255},
smooth=Smooth.None));
connect(primVolt.n, n1) annotation (Line(
points={{-80,-10},{-80,-50},{-100,-50}},
color={0,0,255},
smooth=Smooth.None));
connect(primVolt.p, p1) annotation (Line(
points={{-80,10},{-80,50},{-100,50}},
color={0,0,255},
smooth=Smooth.None));
connect(sekVolt.p, p2) annotation (Line(
points={{80,10},{80,50},{100,50}},
color={0,0,255},
smooth=Smooth.None));
connect(sekVolt.n, n2) annotation (Line(
points={{80,-10},{80,-50},{100,-50}},
color={0,0,255},
smooth=Smooth.None));
connect(gain.y, signalCurrent.i) annotation (Line(
points={{-36.8,30},{-43,30}},
color={0,0,127},
smooth=Smooth.None));
connect(division.y, gain.u) annotation (Line(
points={{-10.8,30},{-18.4,30}},
color={0,0,127},
smooth=Smooth.None));
connect(currentSensor1.i, product.u2) annotation (Line(
points={{40,-30},{25.2,-30},{25.2,-1.6}},
color={0,0,127},
smooth=Smooth.None));
connect(sekVolt.v, product.u1) annotation (Line(
points={{70,0},{62,0},{62,-10},{34.8,-10},{34.8,-1.6}},
color={0,0,127},
smooth=Smooth.None));
connect(product.y, division.u1) annotation (Line(
points={{30,16.8},{30,34.8},{7.6,34.8}},
color={0,0,127},
smooth=Smooth.None));
connect(primVolt.v, division.u2) annotation (Line(
points={{-70,0},{14,0},{14,20},{14,20},{14,25.2},{7.6,25.2}},
color={0,0,127},
smooth=Smooth.None));
annotation (
Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100,
100}}), graphics), Icon(coordinateSystem(preserveAspectRatio=false,
extent={{-100,-100},{100,100}}), graphics={
Rectangle(
extent={{-100,100},{100,-100}},
lineColor={0,0,127},
lineThickness=0.5,
fillPattern=FillPattern.Solid,
fillColor={215,215,215}),
Line(
points={{-100,100}},
color={0,0,255},
smooth=Smooth.None),
Line(
points={{-100,100},{-100,-100},{100,-100},{100,100},{-100,100}},
color={0,0,127},
thickness=0.5,
smooth=Smooth.None),
Line(
points={{-100,-100},{100,100}},
color={0,0,127},
thickness=0.5,
smooth=Smooth.None),
Text(
extent={{-60,80},{0,20}},
lineColor={0,0,0},
lineThickness=0.5,
textString="DC"),
Text(
extent={{0,-20},{60,-80}},
lineColor={0,0,0},
lineThickness=0.5,
textString="DC")}));
end DCDC;
希望有人可以在这里解决我的问题。先感谢您!
编辑:在得到答案后,我决定稍微改变一下我的模型,因为我需要转换器用于混合(能源/电力)供应。生成的转换器在以下代码中给出:
model DCDC2 "Component with two electrical ports, including current"
Real v_energy "Voltage drop over the energy port";
Real v_power "Voltage drop over the power port";
Real v_output "Voltage drop over the output port";
Real i_energy "Current flowing from pos. to neg. pin of the energy port";
Real i_power "Current flowing from pos. to neg. pin of the power port";
Real i_output "Current flowing from pos. to neg. pin of the output port";
Real p_energy;
Real p_power;
Real p_output;
parameter Real demandedVoltage;
parameter Real efficiency = 1;
Modelica.Electrical.Analog.Interfaces.PositivePin pinP_Energy
annotation (Placement(transformation(extent={{-110,50},{-90,70}})));
Modelica.Electrical.Analog.Interfaces.NegativePin pinN_Energy
annotation (Placement(transformation(extent={{-110,-70},{-90,-50}})));
Modelica.Electrical.Analog.Interfaces.PositivePin pinP_Power
annotation (Placement(transformation(extent={{90,50},{110,70}})));
Modelica.Electrical.Analog.Interfaces.NegativePin pinN_Power
annotation (Placement(transformation(extent={{90,-70},{110,-50}})));
Modelica.Electrical.Analog.Interfaces.PositivePin pinP_Output
annotation (Placement(transformation(extent={{-20,80},{20,120}})));
Modelica.Electrical.Analog.Interfaces.NegativePin pinN_Output
annotation (Placement(transformation(extent={{-20,-120},{20,-80}})));
equation
v_energy = pinP_Energy.v - pinN_Energy.v;
v_power = pinP_Power.v - pinN_Power.v;
v_output = pinP_Output.v - pinN_Output.v;
0 = pinP_Energy.i + pinN_Energy.i;
0 = pinP_Power.i + pinN_Power.i;
0 = pinP_Output.i + pinN_Output.i;
i_energy = pinP_Energy.i;
i_power = pinP_Power.i;
i_output = pinP_Output.i;
p_energy = v_energy * i_energy;
p_power = v_power * i_power;
p_output = v_output * i_output;
p_output = efficiency*(p_energy + p_power);
i_output = i_energy + i_power;
v_output = demandedVoltage;
annotation (
Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-100,- 100},{100,
100}}), graphics), Icon(coordinateSystem(preserveAspectRatio=false,
extent={{-100,-100},{100,100}}), graphics={
Rectangle(
extent={{-100,100},{100,-100}},
lineColor={0,0,127},
lineThickness=0.5,
fillPattern=FillPattern.Solid,
fillColor={215,215,215}),
Line(
points={{-100,100}},
color={0,0,255},
smooth=Smooth.None),
Line(
points={{-100,100},{-100,-100},{100,-100},{100,100},{-100,100}},
color={0,0,127},
thickness=0.5,
smooth=Smooth.None),
Text(
extent={{-68,60},{70,-66}},
lineColor={0,0,0},
textString="Hybrid
DC
Converter")}));
end DCDC2;
如果我使用两个简单的恒流源和一个恒流负载来测试转换器,我会再次遇到奇点错误。Dymola 2015 告诉我,可能存在无法确定的基础,但事实并非如此。
model test2
Modelica_EnergyStorages.Sources.Loads.BooleanConstantCurrent
booleanConstantCurrent(I=40)
annotation (Placement(transformation(extent={{46,0},{26,20}})));
Modelica.Electrical.Analog.Basic.Ground ground
annotation (Placement(transformation(extent={{-84,-40},{-64,-20}})));
Modelica.Blocks.Sources.BooleanConstant booleanConstant
annotation (Placement(transformation(extent={{66,0},{46,20}})));
Modelica.Electrical.Analog.Basic.Ground ground1
annotation (Placement(transformation(extent={{26,-86},{46,-66}})));
ElectricalEnergyStorageSystem.Components.DCDC2 dCDC2_1(efficiency=1,
demandedVoltage=15)
annotation (Placement(transformation(extent={{-44,0},{-24,20}})));
Modelica.Electrical.Analog.Sources.ConstantCurrent constantCurrent(I=5)
annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=270,
origin={-74,10})));
Modelica.Electrical.Analog.Sources.ConstantCurrent constantCurrent1(I=15)
annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=270,
origin={6,10})));
Modelica.Electrical.Analog.Basic.Ground ground2
annotation (Placement(transformation(extent={{-4,-40},{16,-20}})));
equation
connect(booleanConstantCurrent.on, booleanConstant.y) annotation (Line(
points={{45,10},{45,10}},
color={255,0,255},
smooth=Smooth.None));
connect(booleanConstantCurrent.pin_n, ground1.p) annotation (Line(
points={{36,0},{36,-66}},
color={0,0,255},
smooth=Smooth.None));
connect(dCDC2_1.pinP_Output, booleanConstantCurrent.pin_p) annotation (Line(
points={{-34,20},{-34,76},{36,76},{36,20}},
color={0,0,255},
smooth=Smooth.None));
connect(booleanConstantCurrent.pin_n, dCDC2_1.pinN_Output) annotation (Line(
points={{36,0},{36,-54},{-34,-54},{-34,0}},
color={0,0,255},
smooth=Smooth.None));
connect(constantCurrent1.p, dCDC2_1.pinP_Power) annotation (Line(
points={{6,20},{-24,20},{-24,16}},
color={0,0,255},
smooth=Smooth.None));
connect(constantCurrent1.n, dCDC2_1.pinN_Power) annotation (Line(
points={{6,0},{-24,0},{-24,4}},
color={0,0,255},
smooth=Smooth.None));
connect(constantCurrent.p, dCDC2_1.pinP_Energy) annotation (Line(
points={{-74,20},{-44,20},{-44,16}},
color={0,0,255},
smooth=Smooth.None));
connect(constantCurrent.n, dCDC2_1.pinN_Energy) annotation (Line(
points={{-74,0},{-44,0},{-44,4}},
color={0,0,255},
smooth=Smooth.None));
connect(constantCurrent1.n, ground2.p) annotation (Line(
points={{6,0},{6,-20}},
color={0,0,255},
smooth=Smooth.None));
connect(ground.p, constantCurrent.n) annotation (Line(
points={{-74,-20},{-74,0}},
color={0,0,255},
smooth=Smooth.None));
annotation (uses(
Modelica_EnergyStorages(version="3.2.1"),
Modelica(version="3.2.1"),
Buildings(version="2.0.0")), Diagram(coordinateSystem(preserveAspectRatio
=false, extent={{-100,-100},{100,100}}), graphics));
end test2;
代码产生以下模型。(恒定电流负载来自 Modelica_EnergyStorages 库)
希望你能以某种方式帮助我解决这个问题!提前致谢!