2

我想为 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 库)

在此处输入图像描述

希望你能以某种方式帮助我解决这个问题!提前致谢!

4

1 回答 1

3

唯一的小问题是您已声明demandedVoltage但您使用vehicleVoltage. 您的模型没有其他问题。

注意:最好在问题中包含一个用于测试的最小顶级模型。

我在顶级模型中测试了您的模型,TestDCDC并在 SimulationX 3.6.5 中使用电容器作为电源和电阻器作为负载。

下图为测试模型示意图。

测试模型示意图

使用 SimulationX 获得的结果如下图所示。

在此处输入图像描述

我还检查了 SimulationX 生成的方程系统。看起来不错。

Dymola 2015 生成错误消息,指出变量比方程多两个。您应该向 Dymola 的生产者发布此模型的错误报告。请注意,Modelica 模型的符号分析非常复杂,可能会出现类似的问题。在这种情况下,工具的维护者通常会感谢错误报告。

解决方案讨论: DCDC 转换器要求电容器提供恒定的功率,P=100W电容器的初始电压为capacitor1.v.start=10 V。这给出了一个能量时间信号

W = C/2*(v.start)^2-P*time = 50Ws - 100W*time

和电容器电压信号导致

capacitor1.v = 2*sqrt(W)/C = 2V/As * sqrt(50Ws-100Ws*time)

time = 0.5s电容器是空的,电流发散。SimulationX 在 time=0.5 时正确停止并显示错误消息。

再现结果的完整模型:

model TestDCDC
    model DCDC
        extends Modelica.Electrical.Analog.Interfaces.TwoPort;
        parameter Real demandedVoltage;
        Modelica.Electrical.Analog.Sensors.VoltageSensor sekVolt annotation(Placement(transformation(
            origin={80,0},
            extent={{-10,-10},{10,10}},
            rotation=270)));
        Modelica.Electrical.Analog.Sensors.CurrentSensor currentSensor annotation(Placement(transformation(
            origin={-50,-30},
            extent={{-10,10},{10,-10}},
            rotation=270)));
        Modelica.Electrical.Analog.Sources.SignalCurrent signalCurrent annotation(Placement(transformation(
            origin={-50,30},
            extent={{-10,-10},{10,10}},
            rotation=270)));
        Modelica.Electrical.Analog.Sources.ConstantVoltage constantVoltage(V=demandedVoltage) annotation(Placement(transformation(
            origin={50,30},
            extent={{-10,10},{10,-10}},
            rotation=270)));
        Modelica.Electrical.Analog.Sensors.CurrentSensor currentSensor1 annotation(Placement(transformation(
            origin={50,-30},
            extent={{-10,-10},{10,10}},
            rotation=270)));
        Modelica.Blocks.Math.Division division annotation(Placement(transformation(extent={{6,22},{-10,38}})));
        Modelica.Blocks.Math.Product product annotation(Placement(transformation(
            origin={30,8},
            extent={{8,-8},{-8,8}},
            rotation=270)));
        Modelica.Blocks.Math.Gain gain(k=-1) annotation(Placement(transformation(extent={{-20,22},{-36,38}})));
        Modelica.Electrical.Analog.Sensors.VoltageSensor primVolt annotation(Placement(transformation(
            origin={-80,0},
            extent={{-10,10},{10,-10}},
            rotation=270)));
        equation
            connect(currentSensor.p,signalCurrent.n) annotation(Line(points={{-50,-20},{-50,-15},{-50,15},{-50,20}}));

            connect(constantVoltage.n,currentSensor1.p) annotation(Line(points={{50,20},{50,15},{50,-15},{50,-20}}));

            connect(signalCurrent.p,p1) annotation(Line(points={{-50,40},{-50,45},{-50,50},{-95,50},{-100,50}}));

            connect(currentSensor.n,n1) annotation(Line(points={{-50,-40},{-50,-45},{-50,-50},{-95,-50},{-100,-50}}));

            connect(constantVoltage.p,p2) annotation(Line(points={{50,40},{50,45},{50,50},{95,50},{100,50}}));

            connect(currentSensor1.n,n2) annotation(Line(points={{50,-40},{50,-45},{50,-50},{95,-50},{100,-50}}));

            connect(primVolt.n,n1) annotation(Line(points={{-80,-10},{-80,-15},{-80,-50},{-95,-50},{-100,-50}}));

            connect(primVolt.p,p1) annotation(Line(points={{-80,10},{-80,15},{-80,50},{-95,50},{-100,50}}));

            connect(sekVolt.p,p2) annotation(Line(points={{80,10},{80,15},{80,50},{95,50},{100,50}}));

            connect(sekVolt.n,n2) annotation(Line(points={{80,-10},{80,-15},{80,-50},{95,-50},{100,-50}}));


            connect(gain.y,signalCurrent.i) annotation(Line(
                points={{-36.7,30},{-41.7,30},{-38,30},{-43,30}},
                color={0,0,127}));

            connect(division.y,gain.u) annotation(Line(
                points={{-10.7,30},{-15.7,30},{-13.3,30},{-18.3,30}},
                color={0,0,127}));

            connect(currentSensor1.i,product.u2) annotation(Line(
                points={{40,-30},{35,-30},{25.3,-30},{25.3,-6.7},{25.3,-1.7}},
                color={0,0,127}));

            connect(sekVolt.v,product.u1) annotation(Line(
                points={{70,0},{65,0},{65,-6.7},{34.7,-6.7},{34.7,-1.7}},
                color={0,0,127}));

            connect(product.y,division.u1) annotation(Line(
                points={{30,16.7},{30,21.7},{30,34.7},{12.7,34.7},{7.7,34.7}},
                color={0,0,127}));

            connect(primVolt.v,division.u2) annotation(Line(
                points={{-70,0},{-65,0},{12.7,0},{12.7,25.3},{7.7,25.3}},
                color={0,0,127}));
        annotation(
            Icon(
                coordinateSystem(preserveAspectRatio=false),
                graphics={
                    Rectangle(
                        lineColor={0,0,127},
                        fillColor={215,215,215},
                        fillPattern=FillPattern.Solid,
                        lineThickness=0.5,
                        extent={{-100,100},{100,-100}}),
                    Line(
                        points={{-100,100}}),
                    Line(
                        points={{-100,100},{-100,-100},{100,-100},{100,100},{-100,100}},
                        color={0,0,127},
                        thickness=0.5),
                    Line(
                        points={{-100,-100},{100,100}},
                        color={0,0,127},
                        thickness=0.5),
                    Text(
                        textString="DC",
                        lineThickness=0.5,
                        extent={{-60,80},{0,20}}),
                    Text(
                        textString="DC",
                        lineThickness=0.5,
                        extent={{0,-20},{60,-80}})}),
            Diagram(coordinateSystem(preserveAspectRatio=false)));
    end DCDC;
    DCDC dcdc(demandedVoltage=10) annotation(Placement(transformation(extent={{-30,30},{-10,50}})));
    Modelica.Electrical.Analog.Basic.Ground ground1 annotation(Placement(transformation(extent={{-85,-5},{-65,15}})));
    Modelica.Electrical.Analog.Basic.Resistor resistor1(R=2) annotation(Placement(transformation(
        origin={35,40},
        extent={{-10,-10},{10,10}},
        rotation=-90)));
    Modelica.Electrical.Analog.Basic.Ground ground2 annotation(Placement(transformation(extent={{0,-5},{20,15}})));
    Modelica.Electrical.Analog.Basic.Capacitor capacitor1(
        v(
            start=10,
            fixed=true),
        C=1) annotation(Placement(transformation(
        origin={-75,40},
        extent={{-10,-10},{10,10}},
        rotation=-90)));
    equation
        connect(resistor1.p,dcdc.p2) annotation(Line(
            points={{35,50},{35,55},{15,55},{15,45},{-5,45},{-10,
            45}},
            thickness=0.0625));
        connect(resistor1.n,dcdc.n2) annotation(Line(
            points={{35,30},{35,25},{15,25},{15,35},{-5,35},{-10,
            35}},
            thickness=0.0625));
        connect(ground2.p,dcdc.n2) annotation(Line(
            points={{10,15},{10,20},{10,35},{-5,35},{-10,35}},
            thickness=0.0625));
        connect(dcdc.p1,capacitor1.p) annotation(Line(
            points={{-30,45},{-35,45},{-35,55},{-75,55},{-75,50}},
            thickness=0.0625));
        connect(dcdc.n1,capacitor1.n) annotation(Line(
            points={{-30,35},{-35,35},{-35,25},{-75,25},{-75,30}},
            thickness=0.0625));
        connect(ground1.p,capacitor1.n) annotation(Line(
            points={{-75,15},{-75,20},{-75,25},{-75,30}},
            thickness=0.0625));
end TestDCDC;
于 2015-07-10T08:04:22.680 回答