1

親愛なるModelicaユーザーおよび開発者の皆様へ

Standard Modelica.Fluid ライブラリを使用して、ストレージに関する単純な熱伝達の問題をモデル化しています。単純なモデルを設定するためのいくつかの失敗した試行の後、目的に使用できるようになるまで例を変更しようとしました。

残念ながら、私が物事を修正して適応させ始めると、解決できないエラーに遭遇することがよくあります。

私のモデルは Modelica.Fluid.Examples.HeatingSystem に基づいています。私の目的は、2 つのタンク、熱交換を行う 2 つのパイプ、流体を循環させる 2 つのポンプを備えたモデルを構築することです。2 つのポンプ シェルを制御して、パイプ内の質量流量を調整し、流体を一定温度に保ちます。この流体は、タンクに保管されてさらに使用されます。私の見解では、このタスクは Modelica.Fluid ライブラリを使用した単純なものである必要があります。

まず第一に、このライブラリに適切なドキュメントがあるかどうか (私が既に使用している公式のものを除く)。表示されるエラー メッセージが大きく異なるため、ある種の FAQ などを探しています。

PI コントローラーを導入して温度を測定し、パイプ内の質量流量を制御すると、次のようなエラー メッセージが表示されることがよくあります: (以下の例と 1も参照)

Cannot reduce the DAE index and select states.
This is most likely due to non-differentiable functions.

もう 1 つのメッセージは、modelicas ホモトロフィ モードと特異なシステムの使用に関するものです。

Solving using global homotopy-method.
The following error was detected at time: 0
Error: Scalar system is always singular for pump.dp_pump = (homotopy(0.0, 0.0)-pump.W_single)/( -homotopy(1.25*pump.V_flow_single, 0.0)) = 0/-0
Error: Failed to start model.

または、次のようなものを取得します。

[...]abs(y0d) < 1E-015 or abs(y1d) < 1E-015
The following error was detected at time: 0
regFun3(): Derivatives at data points do not allow co-monotone interpolation, as both are non-zero, of opposite sign and have an absolute value larger than machine eps (y0d = -0.000690531, y1d = 0.999503). Please correct arguments.
The stack of functions is:
Modelica.Fluid.Utilities.regFun3
massFlowRate_dp_staticHead_Unique16
massFlowRate_dp_staticHead_Unique16(pipe1.flowModel.dps_fg[3], pipe1.flowModel.rhos[3], pipe1.flowModel.rhos[4], pipe1.flowModel.mus[3], pipe1.flowModel.mus[4], 0.25, pipe1.dimensions[2], 0.0, pipe1.crossAreas[2], pipe1.roughnesses[2], 0.3333333333333333*pipe1.flowModel.dp_small, 4000)
Non-linear solver will attempt to handle this problem.

ERROR: Failed to solve non-linear system using Newton solver.
To get more information: Turn on Simulation/Setup/Debug/Nonlinear solver diagnostics/Details
Solution to systems of equations not found at time = 0
   Nonlinear system of equations number = 1
   Infinity-norm of residue = 20
   Iteration is not making good progress.
   Accumulated number of residue       calc.: 1332
   Accumulated number of symbolic Jacobian calc.: 210
   Last values of solution vector:
pipe1.state_b.T = 300
   Last values of residual vector:
{ 20 }

Error: could not solve simplified initialization for homotopy method.
Error: could not solve simplified initialization for homotopy method.
Error: Failed to start model.

私はまだModelicaの初心者と呼んでいるので、この問題の解決策を探すのは「デッドポイント」に達しました。さらに、流体ライブラリのすべてのモデルを詳細に理解することは非常に困難です。誰かがエラー メッセージにコメントしたり、Modelica Fluid Lib にアクセスする方法についてアドバイスをくれたりするかもしれません。

この問題についてあらゆる種類の助けをいただければ幸いです。モデルファイルを直接実行したい場合は、問題を特定するために提供できます。

この問題の解決をサポートしていただければ幸いです。

どうもありがとう、マリウス

一例を挙げると、 1は私の現在の問題の詳細です (これが現在の私の最大の問題です)。制御された質量流量がなければ、モデルは完全に機能します。PI-Controller を導入すると、次のエラー メッセージが表示されます。

DAE インデックスを減らして状態を選択することはできません。これはおそらく微分不可能な関数によるものです。

DAE インデックスを減らして状態を選択することはできません。これはおそらく微分不可能な関数によるものです。

DAE インデックスの削減に失敗しました。

モデルは図 (コメント) に示され、コードは次のとおりです。

model HeatingSystem_modified "Simple model of a heatstorage system"
  extends Modelica.Icons.Example;
   replaceable package Medium =
      CSP.Components.Media.linearMoltenSalt
     constrainedby Modelica.Media.Interfaces.PartialMedium;

  Modelica.Fluid.Vessels.OpenTank tank(
    redeclare package Medium = Medium,
    height=2,
    level_start=1,
    massDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
    use_HeatTransfer=true,
    redeclare model HeatTransfer =
        Modelica.Fluid.Vessels.BaseClasses.HeatTransfer.IdealHeatTransfer (k=10),
    ports(each p(start=1e5)),
    T_start=Modelica.SIunits.Conversions.from_degC(20),
    portsData={Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter=0.01),
        Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter=0.01)},
    crossArea=1,
    nPorts=2) annotation (Placement(transformation(extent={{-40,64},{-20,84}},
          rotation=0)));
  Modelica.Fluid.Machines.ControlledPump pump(
    redeclare package Medium = Medium,
    N_nominal=1500,
    use_T_start=true,
    T_start=Modelica.SIunits.Conversions.from_degC(40),
    m_flow_start=0.01,
    m_flow_nominal=0.01,
    allowFlowReversal=false,
    use_m_flow_set=false,
    p_a_start=110000,
    p_b_start=130000,
    p_a_nominal=110000,
    p_b_nominal=130000,
    control_m_flow=true) annotation (Placement(transformation(extent={{20,50},{40,
            70}},     rotation=0)));
public 
  Modelica.Thermal.HeatTransfer.Sources.FixedHeatFlow burner(
    alpha=-0.5,
    Q_flow=1.6e4,
    T_ref=343.15)
    annotation (Placement(transformation(extent={{-122,-10},{-102,10}},
                                                                   rotation=0)));
  inner Modelica.Fluid.System system(
      m_flow_small=1e-4, energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyStateInitial)
                        annotation (Placement(transformation(extent={{80,80},{100,
            100}},      rotation=0)));

protected 
  Modelica.Blocks.Interfaces.RealOutput T_forward
    annotation (Placement(transformation(extent={{114,-46},{126,-34}},
                                                                     rotation=
           0)));
public 
  Modelica.Fluid.Sensors.Temperature sensor_T_cold(redeclare package Medium =
        Medium) annotation (Placement(transformation(extent={{92,-50},{112,-30}},
          rotation=0)));
  Modelica.Fluid.Sensors.Temperature sensor_T_hot(redeclare package Medium =
        Medium) annotation (Placement(transformation(extent={{-72,10},{-52,30}},
          rotation=0)));

  Modelica.Fluid.Vessels.OpenTank tank1(
    redeclare package Medium = Medium,
    height=2,
    level_start=1,
    massDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
    use_HeatTransfer=true,
    redeclare model HeatTransfer =
        Modelica.Fluid.Vessels.BaseClasses.HeatTransfer.IdealHeatTransfer (k=10),
    ports(each p(start=1e5)),
    T_start=Modelica.SIunits.Conversions.from_degC(20),
    portsData={Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter=0.01),
        Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter=0.01)},
    crossArea=1,
    nPorts=2) annotation (Placement(transformation(extent={{20,-48},{40,-28}},
          rotation=0)));
  Modelica.Fluid.Machines.ControlledPump pump1(
    redeclare package Medium = Medium,
    N_nominal=1500,
    use_T_start=true,
    T_start=Modelica.SIunits.Conversions.from_degC(40),
    m_flow_start=0.01,
    allowFlowReversal=false,
    m_flow_nominal=0.1,
    control_m_flow=true,
    p_a_start=110000,
    p_b_start=130000,
    p_a_nominal=110000,
    p_b_nominal=130000,
    use_m_flow_set=true)
                        annotation (Placement(transformation(extent={{-20,-62},{
            -40,-42}},
                     rotation=0)));
  Modelica.Fluid.Pipes.DynamicPipe radiator(
    use_T_start=true,
    redeclare package Medium = Medium,
    length=10,
    T_start=Modelica.SIunits.Conversions.from_degC(40),
    redeclare model HeatTransfer =
        Modelica.Fluid.Pipes.BaseClasses.HeatTransfer.IdealFlowHeatTransfer,
    diameter=0.01,
    nNodes=1,
    redeclare model FlowModel =
        Modelica.Fluid.Pipes.BaseClasses.FlowModels.DetailedPipeFlow,
    use_HeatTransfer=true,
    modelStructure=Modelica.Fluid.Types.ModelStructure.a_v_b,
    p_a_start=110000) annotation (Placement(transformation(extent={{10,10},{-10,
            -10}},
          rotation=90,
        origin={76,0})));
  Modelica.Thermal.HeatTransfer.Sources.FixedTemperature T_ambient(T=system.T_ambient)
    annotation (Placement(transformation(extent={{-7,-7},{7,7}},     rotation=180,
        origin={127,0})));
  Modelica.Thermal.HeatTransfer.Components.ThermalConductor wall(G=1.6e3/20)
    annotation (Placement(transformation(
        origin={102,0},
        extent={{8,-10},{-8,10}},
        rotation=180)));
  Modelica.Fluid.Pipes.DynamicPipe heater(
    redeclare package Medium = Medium,
    use_T_start=true,
    T_start=Modelica.SIunits.Conversions.from_degC(80),
    length=2,
    redeclare model HeatTransfer =
        Modelica.Fluid.Pipes.BaseClasses.HeatTransfer.IdealFlowHeatTransfer,
    diameter=0.01,
    nNodes=1,
    redeclare model FlowModel =
        Modelica.Fluid.Pipes.BaseClasses.FlowModels.DetailedPipeFlow,
    use_HeatTransfer=true,
    modelStructure=Modelica.Fluid.Types.ModelStructure.a_v_b,
    p_a_start=130000) annotation (Placement(transformation(extent={{-10,-10},{10,
            10}},
          rotation=90,
        origin={-80,0})));
  Modelica.Blocks.Sources.RealExpression realExpression(y=90)
    annotation (Placement(transformation(extent={{-72,36},{-52,56}})));
  Modelica.Blocks.Math.Add add(k1=-1, k2=+1)
    annotation (Placement(transformation(extent={{-26,16},{-6,36}})));
  Modelica.Blocks.Continuous.PI PI(
    k=2,
    T=1,
    x_start=0,
    initType=Modelica.Blocks.Types.Init.NoInit)
    annotation (Placement(transformation(extent={{2,16},{22,36}})));
equation 

  connect(radiator.heatPorts[1], wall.port_a) annotation (Line(points={{80.4,-0.1},
          {88,-0.1},{88,9.99201e-016},{94,9.99201e-016},{94,0}}, color={127,0,0}));
  connect(wall.port_b, T_ambient.port) annotation (Line(points={{110,-9.99201e-016},
          {116,-9.99201e-016},{116,0},{120,0}}, color={191,0,0}));
  connect(heater.heatPorts[1], burner.port) annotation (Line(points={{-84.4,0.1},
          {-94,0.1},{-94,0},{-102,0}}, color={127,0,0}));
  connect(pump.port_b, radiator.port_a)
    annotation (Line(points={{40,60},{76,60},{76,10}}, color={0,127,255}));
  connect(pump1.port_a, tank1.ports[1])
    annotation (Line(points={{-20,-52},{28,-52},{28,-48}}, color={0,127,255}));
  connect(pump1.port_b, heater.port_a) annotation (Line(points={{-40,-52},{-80,-52},
          {-80,-10}},           color={0,127,255}));
  connect(sensor_T_cold.T, T_forward)
    annotation (Line(points={{109,-40},{120,-40}}, color={0,0,127}));
  connect(sensor_T_hot.port, heater.port_b)
    annotation (Line(points={{-62,10},{-62,10},{-80,10}}, color={0,127,255}));
  connect(sensor_T_cold.port, radiator.port_b) annotation (Line(points={{102,-50},
          {82,-50},{82,-10},{76,-10}}, color={0,127,255}));
  connect(heater.port_b, tank.ports[1]) annotation (Line(points={{-80,10},{-80,10},
          {-80,56},{-80,60},{-32,60},{-32,64}}, color={0,127,255}));
  connect(pump.port_a, tank.ports[2]) annotation (Line(points={{20,60},{-6,60},{
          -28,60},{-28,64}}, color={0,127,255}));
  connect(add.y, PI.u)
    annotation (Line(points={{-5,26},{-5,26},{0,26}}, color={0,0,127}));
  connect(PI.y, pump1.m_flow_set) annotation (Line(points={{23,26},{30,26},{30,-20},
          {-25,-20},{-25,-43.8}}, color={0,0,127}));
  connect(sensor_T_hot.T, add.u2)
    annotation (Line(points={{-55,20},{-28,20}}, color={0,0,127}));
  connect(realExpression.y, add.u1) annotation (Line(points={{-51,46},{-46,46},{
          -46,32},{-28,32}}, color={0,0,127}));
  connect(radiator.port_b, tank1.ports[2]) annotation (Line(points={{76,-10},{76,
          -10},{76,-34},{76,-50},{76,-52},{32,-52},{32,-48}}, color={0,127,255}));
  annotation (                             Documentation(info="<html>
<p>
Simple heating system with a closed flow cycle.
After 2000s of simulation time the valve fully opens. A simple idealized control is embedded
into the respective components, so that the heating system can be regulated with the valve:
the pump controls the pressure, the burner controls the temperature.
</p>
<p>
One can investigate the temperatures and flows for different settings of <code>system.energyDynamics</code>
(see Assumptions tab of the system object).</p>
<ul>
<li>With <code>system.energyDynamics==Types.Dynamics.FixedInitial</code> the states need to find their steady values during the simulation.</li>
<li>With <code>system.energyDynamics==Types.Dynamics.SteadyStateInitial</code> (default setting) the simulation starts in steady-state.</li>
<li>With <code>system.energyDynamics==Types.Dynamics.SteadyState</code> all but one dynamic states are eliminated.
    The left state <code>tank.m</code> is to account for the closed flow cycle. It is constant as outflow and inflow are equal
    in a steady-state simulation.</li>
</ul>
<p>
Note that a closed flow cycle generally causes circular equalities for the mass flow rates and leaves the pressure undefined.
This is why the tank.massDynamics, i.e., the tank level determining the port pressure, is modified locally to Types.Dynamics.FixedInitial.
</p>
<p>
Also note that the tank is thermally isolated against its ambient. This way the temperature of the tank is also
well defined for zero flow rate in the heating system, e.g., for valveOpening.offset=0 at the beginning of a simulation.
The pipe however is assumed to be perfectly isolated.
If steady-state values shall be obtained with the valve fully closed, then a thermal
coupling between the pipe and its ambient should be defined as well.
</p>
<p>
Moreover it is worth noting that the idealized direct connection between the heater and the pipe, resulting in equal port pressures,
is treated as high-index DAE, as opposed to a nonlinear equation system for connected pressure loss correlations. A pressure loss correlation
could be additionally introduced to model the fitting between the heater and the pipe, e.g., to adapt different diameters.
</p>

<img src=\"modelica://Modelica/Resources/Images/Fluid/Examples/HeatingSystem.png\" border=\"1\"
     alt=\"HeatingSystem.png\">
</html>"), experiment(StopTime=6000),
    __Dymola_Commands(file(ensureSimulated=true)=
        "modelica://Modelica/Resources/Scripts/Dymola/Fluid/HeatingSystem/plotResults.mos" 
        "plotResults"));
end HeatingSystem_modified;
4

0 に答える 0