1

次のように作成しているタンクのモデルがあります。

model Tank "Simple model of a tank"
  parameter Real volume=1 "tank volume (m^3)";
    parameter Integer num_ports=1 "Number of ports";
    parameter Real static_pressure=1 "Internal Tank Pressure";
    parameter Real initial_level = 0;
    Stream[num_ports] ports "Stream Connectors";
    Real level "Level in % 0-100";
    protected
    Real vol "Volume of medium in the tank";
    Real pressure(start=static_pressure) "Pressure inside the tank";

  initial equation
    level = initial_level;

    /* Pressure */
    equation
      pressure = vol * 0.01;  // Add correct factor here to get from volume to pressure change (based on height and head)
      for i in 1:num_ports loop
        ports[i].pressure = static_pressure + pressure;
      end for;

    /* Volume Flow */
    equation
      der(vol) = sum(ports.m_flow);  // Add density factor to get form mass flow to Volume Flow
      level = vol * 100 / volume;

  end Tank;

レベルが <=0 の場合、タンクが負の値のフローを許可しないようにするにはどうすればよいですか (どのポートにも流体が流出することはありませんが、流体は引き続き入ることができます)。些細なことを見逃しているように感じますが、方程式が多すぎない方法を見つけることができないようです (過剰決定システム)。

ありがとう

4

1 に答える 1

1

when 方程式を試すことができます。

when level < 0 then
  reinit(level, 0)
end when;
于 2015-03-13T17:58:02.433 に答える