Modeling heatcapacitor with dynamique pipe in Open Modelica

52 views Asked by At

I am attempting to model a system where fluid flows through a pipe with an obstacle positioned in the middle. To achieve this, I divided the pipe into two segments connected by a static pipe. Additionally, I introduced a thermal conductance term to account for the thermal impact of the obstacle.

In the 'Model Working' simulation, steady-state conditions were successfully simulated. However, upon attempting a transient simulation and integrating a heat capacitor to represent the thermal inertia of the obstacle, the model failed to converge. Compilation errors arose, and during simulation, an assertion failure with error code -1 occurred.

My questions are as follows:

  • Is there a method to accurately model the inertial effects?
  • Can a dynamic pipe with a heat capacitor be effectively modeled?
  • What measures can be taken to enhance this model?"

working model :

model test1
  import Modelica.Constants.pi;
  import Modelica.Media;
  import Modelica.Utilities.Streams;
  import Modelica.Utilities.Files;

  replaceable package Medium = Modelica.Media.Water.WaterIF97_ph constrainedby Modelica.Media.Interfaces.PartialMedium;

  inner Modelica.Fluid.System system(energyDynamics = Modelica.Fluid.Types.Dynamics.SteadyState, massDynamics = Modelica.Fluid.Types.Dynamics.SteadyState, momentumDynamics = Modelica.Fluid.Types.Dynamics.SteadyState) annotation(
    Placement(visible = true, transformation(origin = {-217, -98}, extent = {{-21, -26}, {21, 26}}, rotation = 0)));

  Modelica.Thermal.HeatTransfer.Components.ThermalConductor conductance2(G = 430.6) annotation(
    Placement(visible = true, transformation(origin = {12, -116}, extent = {{-10, -10}, {10, 10}}, rotation = 180)));

  Modelica.Thermal.HeatTransfer.Sources.FixedTemperature temp1(T(displayUnit = "degC") = 569.15) annotation(
    Placement(visible = true, transformation(origin = {282, -136}, extent = {{-10, -10}, {10, 10}}, rotation = 180)));
  Modelica.Thermal.HeatTransfer.Components.ThermalConductor conductance1(G = 544) annotation(
    Placement(visible = true, transformation(origin = {-26, -246}, extent = {{-10, -10}, {10, 10}}, rotation = 180)));
  Modelica.Thermal.HeatTransfer.Sources.FixedTemperature temp2(T = 318.15) annotation(
    Placement(visible = true, transformation(origin = {96, -246}, extent = {{-10, -10}, {10, 10}}, rotation = 180)));
  Modelica.Thermal.HeatTransfer.Components.ThermalConductor conductance3(G = 480.7) annotation(
    Placement(visible = true, transformation(origin = {-104, -114}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Pipes.DynamicPipe pipe2(redeclare package Medium = Medium, crossArea = Modelica.Constants.pi * (0.474 ^ 2 - 0.215 ^ 2), diameter = 0, energyDynamics = Modelica.Fluid.Types.Dynamics.SteadyState, isCircular = false, length = 130e-3, massDynamics = Modelica.Fluid.Types.Dynamics.SteadyState, modelStructure = Modelica.Fluid.Types.ModelStructure.a_v_b, momentumDynamics = Modelica.Fluid.Types.Dynamics.SteadyState, nNodes = 1, perimeter = Modelica.Constants.pi * (0.948 + 0.430), use_HeatTransfer = true) annotation(
    Placement(visible = true, transformation(origin = {-72, -168}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Pipes.DynamicPipe pipe1(redeclare package Medium = Medium, crossArea = Modelica.Constants.pi * (0.474 ^ 2 - 0.215 ^ 2), diameter = 0, energyDynamics = Modelica.Fluid.Types.Dynamics.SteadyState, isCircular = false, length = 130e-3, massDynamics = Modelica.Fluid.Types.Dynamics.SteadyState, modelStructure = Modelica.Fluid.Types.ModelStructure.a_v_b, momentumDynamics = Modelica.Fluid.Types.Dynamics.SteadyState, nNodes = 1, perimeter = Modelica.Constants.pi * (0.948 + 0.430), use_HeatTransfer = true) annotation(
    Placement(visible = true, transformation(origin = {-138, -168}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Sources.MassFlowSource_T source2(redeclare package Medium = Medium, m_flow = -0.32, nPorts = 1, use_T_in = true) annotation(
    Placement(visible = true, transformation(origin = {4, -168}, extent = {{10, -10}, {-10, 10}}, rotation = 0)));
  Modelica.Fluid.Sources.Boundary_pT source_1(redeclare package Medium = Medium, T = 328.15, nPorts = 1, p = 158e5) annotation(
    Placement(visible = true, transformation(origin = {-244, -168}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Pipes.StaticPipe connecter(redeclare package Medium = Medium, crossArea = Modelica.Constants.pi * (0.474 ^ 2 - 0.409 ^ 2), diameter = 0, isCircular = false, length = 12e-3, perimeter = Modelica.Constants.pi * (0.948 + 0.818)) annotation(
    Placement(visible = true, transformation(origin = {-104, -168}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Thermal.HeatTransfer.Sensors.TemperatureSensor temperatureSensor annotation(
    Placement(visible = true, transformation(origin = {66, -164}, extent = {{10, -10}, {-10, 10}}, rotation = 0)));
  Modelica.Blocks.Sources.Constant const(k = 100) annotation(
    Placement(visible = true, transformation(origin = {50, -76}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
  Modelica.Thermal.HeatTransfer.Components.Convection convection_primaire annotation(
    Placement(visible = true, transformation(origin = {50, -116}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Thermal.HeatTransfer.Components.Convection convection_ext annotation(
    Placement(visible = true, transformation(origin = {12, -246}, extent = {{-10, 10}, {10, -10}}, rotation = 0)));
  Modelica.Blocks.Sources.Constant const1(k = 200) annotation(
    Placement(visible = true, transformation(origin = {12, -280}, extent = {{10, -10}, {-10, 10}}, rotation = -90)));
equation
  connect(pipe1.port_b, connecter.port_a) annotation(
    Line(points = {{-128, -168}, {-114, -168}}, color = {0, 127, 255}));
  connect(connecter.port_b, pipe2.port_a) annotation(
    Line(points = {{-94, -168}, {-82, -168}}, color = {0, 127, 255}));
  connect(conductance2.port_b, pipe2.heatPorts[1]) annotation(
    Line(points = {{2, -116}, {-72, -116}, {-72, -164}}, color = {191, 0, 0}));
  connect(conductance1.port_b, pipe2.heatPorts[1]) annotation(
    Line(points = {{-36, -246}, {-72, -246}, {-72, -164}}, color = {191, 0, 0}));
  connect(conductance1.port_b, pipe1.heatPorts[1]) annotation(
    Line(points = {{-36, -246}, {-138, -246}, {-138, -164}}, color = {191, 0, 0}));
  connect(conductance3.port_b, pipe2.heatPorts[1]) annotation(
    Line(points = {{-94, -114}, {-72, -114}, {-72, -164}}, color = {191, 0, 0}));
  connect(conductance3.port_a, pipe1.heatPorts[1]) annotation(
    Line(points = {{-114, -114}, {-138, -114}, {-138, -164}}, color = {191, 0, 0}));
  connect(temperatureSensor.T, source2.T_in) annotation(
    Line(points = {{56, -164}, {16, -164}}, color = {0, 0, 127}));
  connect(convection_primaire.fluid, temp1.port) annotation(
    Line(points = {{60, -116}, {239, -116}, {239, -136}, {272, -136}}, color = {191, 0, 0}));
  connect(conductance2.port_a, convection_primaire.solid) annotation(
    Line(points = {{22, -116}, {40, -116}}, color = {191, 0, 0}));
  connect(const.y, convection_primaire.Gc) annotation(
    Line(points = {{50, -87}, {50, -106}}, color = {0, 0, 127}));
  connect(conductance1.port_a, convection_ext.solid) annotation(
    Line(points = {{-16, -246}, {2, -246}}, color = {191, 0, 0}));
  connect(const1.y, convection_ext.Gc) annotation(
    Line(points = {{12, -269}, {12, -256}}, color = {0, 0, 127}));
  connect(convection_ext.fluid, temp2.port) annotation(
    Line(points = {{22, -246}, {86, -246}}, color = {191, 0, 0}));
  connect(temperatureSensor.port, temp1.port) annotation(
    Line(points = {{76, -164}, {112, -164}, {112, -196}, {240, -196}, {240, -136}, {272, -136}}, color = {191, 0, 0}));
  connect(source_1.ports[1], pipe1.port_a) annotation(
    Line(points = {{-234, -168}, {-148, -168}}, color = {0, 127, 255}));
  connect(pipe2.port_b, source2.ports[1]) annotation(
    Line(points = {{-62, -168}, {-6, -168}}, color = {0, 127, 255}));
algorithm

  annotation(
    uses(Modelica(version = "3.2.3")),
    Diagram(coordinateSystem(extent = {{-1000, -500}, {1000, 500}}, initialScale = 0.1)),
    Icon(coordinateSystem(extent = {{-1000, -205}, {425, 100}})),
    version = "");
end test1;

Not working model :


model test1
  import Modelica.Constants.pi;
  import Modelica.Media;
  import Modelica.Utilities.Streams;
  import Modelica.Utilities.Files;

  replaceable package Medium = Modelica.Media.Water.WaterIF97_ph constrainedby Modelica.Media.Interfaces.PartialMedium;

  inner Modelica.Fluid.System system(energyDynamics = Modelica.Fluid.Types.Dynamics.SteadyState, massDynamics = Modelica.Fluid.Types.Dynamics.SteadyState, momentumDynamics = Modelica.Fluid.Types.Dynamics.SteadyState) annotation(
    Placement(visible = true, transformation(origin = {-217, -98}, extent = {{-21, -26}, {21, 26}}, rotation = 0)));

  Modelica.Thermal.HeatTransfer.Components.ThermalConductor conductance2(G = 430.6) annotation(
    Placement(visible = true, transformation(origin = {4, -112}, extent = {{-10, -10}, {10, 10}}, rotation = 180)));

  Modelica.Thermal.HeatTransfer.Sources.FixedTemperature temp1(T(displayUnit = "degC") = 569.15) annotation(
    Placement(visible = true, transformation(origin = {282, -136}, extent = {{-10, -10}, {10, 10}}, rotation = 180)));
  Modelica.Thermal.HeatTransfer.Components.ThermalConductor conductance1(G = 544) annotation(
    Placement(visible = true, transformation(origin = {-20, -246}, extent = {{-10, -10}, {10, 10}}, rotation = 180)));
  Modelica.Thermal.HeatTransfer.Sources.FixedTemperature temp2(T = 318.15) annotation(
    Placement(visible = true, transformation(origin = {102, -246}, extent = {{-10, -10}, {10, 10}}, rotation = 180)));
  Modelica.Thermal.HeatTransfer.Components.ThermalConductor conductance3(G = 480.7) annotation(
    Placement(visible = true, transformation(origin = {-104, -114}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Pipes.DynamicPipe pipe2(redeclare package Medium = Medium, crossArea = Modelica.Constants.pi * (0.474 ^ 2 - 0.215 ^ 2), diameter = 0, energyDynamics = Modelica.Fluid.Types.Dynamics.SteadyState, isCircular = false, length = 130e-3, massDynamics = Modelica.Fluid.Types.Dynamics.SteadyState, modelStructure = Modelica.Fluid.Types.ModelStructure.a_v_b, momentumDynamics = Modelica.Fluid.Types.Dynamics.SteadyState, nNodes = 1, perimeter = Modelica.Constants.pi * (0.948 + 0.430), use_HeatTransfer = true) annotation(
    Placement(visible = true, transformation(origin = {-72, -168}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Pipes.DynamicPipe pipe1(redeclare package Medium = Medium, crossArea = Modelica.Constants.pi * (0.474 ^ 2 - 0.215 ^ 2), diameter = 0, energyDynamics = Modelica.Fluid.Types.Dynamics.SteadyState, isCircular = false, length = 130e-3, massDynamics = Modelica.Fluid.Types.Dynamics.SteadyState, modelStructure = Modelica.Fluid.Types.ModelStructure.a_v_b, momentumDynamics = Modelica.Fluid.Types.Dynamics.SteadyState, nNodes = 1, perimeter = Modelica.Constants.pi * (0.948 + 0.430), use_HeatTransfer = true) annotation(
    Placement(visible = true, transformation(origin = {-138, -168}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Sources.MassFlowSource_T source2(redeclare package Medium = Medium, m_flow = -0.32, nPorts = 1, use_T_in = true) annotation(
    Placement(visible = true, transformation(origin = {4, -168}, extent = {{10, -10}, {-10, 10}}, rotation = 0)));
  Modelica.Fluid.Sources.Boundary_pT source_1(redeclare package Medium = Medium, T = 328.15, nPorts = 1, p = 158e5) annotation(
    Placement(visible = true, transformation(origin = {-244, -168}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Pipes.StaticPipe connecter(redeclare package Medium = Medium, crossArea = Modelica.Constants.pi * (0.474 ^ 2 - 0.409 ^ 2), diameter = 0, isCircular = false, length = 12e-3, perimeter = Modelica.Constants.pi * (0.948 + 0.818)) annotation(
    Placement(visible = true, transformation(origin = {-104, -168}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Thermal.HeatTransfer.Sensors.TemperatureSensor temperatureSensor annotation(
    Placement(visible = true, transformation(origin = {66, -164}, extent = {{10, -10}, {-10, 10}}, rotation = 0)));
  Modelica.Blocks.Sources.Constant const(k = 100) annotation(
    Placement(visible = true, transformation(origin = {142, -142}, extent = {{10, -10}, {-10, 10}}, rotation = -90)));
  Modelica.Thermal.HeatTransfer.Components.Convection convection_primaire annotation(
    Placement(visible = true, transformation(origin = {42, -112}, extent = {{-10, 10}, {10, -10}}, rotation = 0)));
  Modelica.Thermal.HeatTransfer.Components.Convection convection_ext annotation(
    Placement(visible = true, transformation(origin = {18, -246}, extent = {{-10, 10}, {10, -10}}, rotation = 0)));
  Modelica.Blocks.Sources.Constant const1(k = 200) annotation(
    Placement(visible = true, transformation(origin = {18, -280}, extent = {{10, -10}, {-10, 10}}, rotation = -90)));
  Modelica.Thermal.HeatTransfer.Components.HeatCapacitor heatCapacitor(C = 100)  annotation(
    Placement(visible = true, transformation(origin = {62, -48}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
  connect(pipe1.port_b, connecter.port_a) annotation(
    Line(points = {{-128, -168}, {-114, -168}}, color = {0, 127, 255}));
  connect(connecter.port_b, pipe2.port_a) annotation(
    Line(points = {{-94, -168}, {-82, -168}}, color = {0, 127, 255}));
  connect(conductance2.port_b, pipe2.heatPorts[1]) annotation(
    Line(points = {{-6, -112}, {-72, -112}, {-72, -164}}, color = {191, 0, 0}));
  connect(conductance1.port_b, pipe2.heatPorts[1]) annotation(
    Line(points = {{-30, -246}, {-72, -246}, {-72, -164}}, color = {191, 0, 0}));
  connect(conductance1.port_b, pipe1.heatPorts[1]) annotation(
    Line(points = {{-30, -246}, {-138, -246}, {-138, -164}}, color = {191, 0, 0}));
  connect(conductance3.port_b, pipe2.heatPorts[1]) annotation(
    Line(points = {{-94, -114}, {-72, -114}, {-72, -164}}, color = {191, 0, 0}));
  connect(conductance3.port_a, pipe1.heatPorts[1]) annotation(
    Line(points = {{-114, -114}, {-138, -114}, {-138, -164}}, color = {191, 0, 0}));
  connect(temperatureSensor.T, source2.T_in) annotation(
    Line(points = {{56, -164}, {16, -164}}, color = {0, 0, 127}));
  connect(convection_primaire.fluid, temp1.port) annotation(
    Line(points = {{52, -112}, {239, -112}, {239, -136}, {272, -136}}, color = {191, 0, 0}));
  connect(conductance2.port_a, convection_primaire.solid) annotation(
    Line(points = {{14, -112}, {32, -112}}, color = {191, 0, 0}));
  connect(const.y, convection_primaire.Gc) annotation(
    Line(points = {{142, -131}, {142, -126.5}, {42, -126.5}, {42, -122}}, color = {0, 0, 127}));
  connect(conductance1.port_a, convection_ext.solid) annotation(
    Line(points = {{-10, -246}, {8, -246}}, color = {191, 0, 0}));
  connect(const1.y, convection_ext.Gc) annotation(
    Line(points = {{18, -269}, {18, -256}}, color = {0, 0, 127}));
  connect(convection_ext.fluid, temp2.port) annotation(
    Line(points = {{28, -246}, {92, -246}}, color = {191, 0, 0}));
  connect(temperatureSensor.port, temp1.port) annotation(
    Line(points = {{76, -164}, {112, -164}, {112, -196}, {240, -196}, {240, -136}, {272, -136}}, color = {191, 0, 0}));
  connect(source_1.ports[1], pipe1.port_a) annotation(
    Line(points = {{-234, -168}, {-148, -168}}, color = {0, 127, 255}));
  connect(pipe2.port_b, source2.ports[1]) annotation(
    Line(points = {{-62, -168}, {-6, -168}}, color = {0, 127, 255}));
  connect(convection_primaire.solid, heatCapacitor.port) annotation(
    Line(points = {{32, -112}, {26, -112}, {26, -70}, {62, -70}, {62, -58}}, color = {191, 0, 0}));
algorithm

  annotation(
    uses(Modelica(version = "3.2.3")),
    Diagram(coordinateSystem(extent = {{-1000, -500}, {1000, 500}}, initialScale = 0.1)),
    Icon(coordinateSystem(extent = {{-1000, -205}, {425, 100}})),
    version = "");
end test1;

I tried connecting the heat capacitor in different positions (port b and port a of the conductance). I also attempted to change the system options (steady state, dynamic...) with no success.

0

There are 0 answers