0

I'm trying to model an hydraulic network which exchange heat with two mass of fluid in OpenModelica. I have two models:

the first one: enter image description here and the second one: enter image description here

The difference between the two is that in the first model the heat exchange is modeled with only one heatcapacitor (representing the mass of fluid) and in the second model a part of the network is exchanging with a mass of fluid and the second part of the network is exchanging with another mass of fluid.

The first model is running perfectly but when I try to simulate the second one (the checking and compilation is ok) I get the following error message:

enter image description here

I don't understand what can cause an issue here and I need to use two mass of fluid for my heat transfer.

Here is the code of simplified example of what I would like to do. This model is not running :

model Circuit_hydraulique01_04

replaceable package Medium=Modelica.Media.Water.StandardWater constrainedby
    Modelica.Media.Interfaces.PartialMedium;
    
    replaceable model HeatTransfer_1 = Modelica.Fluid.Pipes.BaseClasses.HeatTransfer.LocalPipeFlowHeatTransfer;

  Modelica.Fluid.Pipes.StaticPipe pipe(redeclare package Medium = Medium, diameter = 32e-3, length = 1, p_a_start = 4.4e5)  annotation(
    Placement(visible = true, transformation(origin = {-50, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Sources.Boundary_pT boundary(redeclare package Medium = Medium,T = 311.15, nPorts = 1, p = 4.4e5)  annotation(
    Placement(visible = true, transformation(origin = {-84, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Pipes.DynamicPipe pipe1(redeclare package Medium = Medium, redeclare final model HeatTransfer = HeatTransfer_1, T_start = 311.15,diameter = 12.8e-3, energyDynamics = Modelica.Fluid.Types.Dynamics.SteadyState, length = 15, massDynamics = Modelica.Fluid.Types.Dynamics.SteadyState, momentumDynamics = Modelica.Fluid.Types.Dynamics.SteadyState, nNodes = 10, use_HeatTransfer = true)  annotation(
    Placement(visible = true, transformation(origin = {2, 102}, extent = {{-10, 10}, {10, -10}}, rotation = 0)));
  Modelica.Fluid.Pipes.DynamicPipe pipe2(redeclare package Medium = Medium, redeclare final model HeatTransfer = HeatTransfer_1, T_start = 311.15,diameter = 12.8e-3, energyDynamics = Modelica.Fluid.Types.Dynamics.SteadyState, length = 15, massDynamics = Modelica.Fluid.Types.Dynamics.SteadyState, momentumDynamics = Modelica.Fluid.Types.Dynamics.SteadyState, nNodes = 10, use_HeatTransfer = true)  annotation(
    Placement(visible = true, transformation(origin = {2, -96}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  inner Modelica.Fluid.System system annotation(
    Placement(visible = true, transformation(origin = {-78, 110}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Pipes.StaticPipe pipe3(redeclare package Medium = Medium, diameter = 32e-3, length = 1)  annotation(
    Placement(visible = true, transformation(origin = {52, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Examples.HeatExchanger.BaseClasses.WallConstProps wallConstProps(area_h = 0.895, c_wall = 510, energyDynamics = Modelica.Fluid.Types.Dynamics.SteadyStateInitial, k_wall = 60.5, n = 10, rho_wall = 7850, s = 3e-3)  annotation(
    Placement(visible = true, transformation(origin = {2, -72}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Examples.HeatExchanger.BaseClasses.WallConstProps wallConstProps1(area_h = 0.895, c_wall = 510, energyDynamics = Modelica.Fluid.Types.Dynamics.SteadyStateInitial, k_wall = 60.5, n = 10, rho_wall = 7850, s = 3e-3)  annotation(
    Placement(visible = true, transformation(origin = {2, 80}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Thermal.HeatTransfer.Components.Convection convection[10] annotation(
    Placement(visible = true, transformation(origin = {2, 60}, extent = {{-10, 10}, {10, -10}}, rotation = -90)));
  Modelica.Thermal.HeatTransfer.Components.Convection convection1[10] annotation(
    Placement(visible = true, transformation(origin = {2, -48}, extent = {{10, 10}, {-10, -10}}, rotation = -90)));
  Modelica.Thermal.HeatTransfer.Components.ThermalCollector thermalCollector(m = 10)  annotation(
    Placement(visible = true, transformation(origin = {2, 38}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Thermal.HeatTransfer.Components.ThermalCollector thermalCollector1(m = 10) annotation(
    Placement(visible = true, transformation(origin = {2, -22}, extent = {{-10, 10}, {10, -10}}, rotation = 0)));
  Modelica.Blocks.Sources.Constant const[10](each k = 179)  annotation(
    Placement(visible = true, transformation(origin = {-78, -48}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Blocks.Sources.Constant const1[10](each k = 179)  annotation(
    Placement(visible = true, transformation(origin = {-74, 60}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Sources.MassFlowSource_T boundary1(redeclare package Medium = Medium,T = 311.15, m_flow = -2.5, nPorts = 1)  annotation(
    Placement(visible = true, transformation(origin = {88, 0}, extent = {{10, -10}, {-10, 10}}, rotation = 0)));
  Modelica.Thermal.HeatTransfer.Components.HeatCapacitor heatCapacitor1(C = 4180, T(start = 328.15)) annotation(
    Placement(visible = true, transformation(origin = {24, 24}, extent = {{-10, 10}, {10, -10}}, rotation = 90)));
  Modelica.Thermal.HeatTransfer.Components.HeatCapacitor heatCapacitor(C = 4180, T(start = 328.15)) annotation(
    Placement(visible = true, transformation(origin = {24, -2}, extent = {{-10, 10}, {10, -10}}, rotation = 90)));
equation
  connect(boundary.ports[1], pipe.port_a) annotation(
    Line(points = {{-74, 0}, {-60, 0}}, color = {0, 127, 255}));
  connect(pipe.port_b, pipe2.port_a) annotation(
    Line(points = {{-40, 0}, {-40, -96}, {-8, -96}}, color = {0, 127, 255}));
  connect(pipe2.port_b, pipe3.port_a) annotation(
    Line(points = {{12, -96}, {42, -96}, {42, 0}}, color = {0, 127, 255}));
  connect(convection1.solid, wallConstProps.heatPort_a) annotation(
    Line(points = {{2, -58}, {2, -67}}, color = {191, 0, 0}, thickness = 0.5));
  connect(thermalCollector1.port_a, convection1.fluid) annotation(
    Line(points = {{2, -32}, {2, -38}}, color = {191, 0, 0}, thickness = 0.5));
  connect(convection.fluid, thermalCollector.port_a) annotation(
    Line(points = {{2, 50}, {2, 48}}, color = {191, 0, 0}, thickness = 0.5));
  connect(wallConstProps1.heatPort_b, convection.solid) annotation(
    Line(points = {{2, 75}, {2, 70}}, color = {191, 0, 0}, thickness = 0.5));
  connect(const1.y, convection.Gc) annotation(
    Line(points = {{-63, 60}, {-8, 60}}, color = {0, 0, 127}, thickness = 0.5));
  connect(const.y, convection1.Gc) annotation(
    Line(points = {{-67, -48}, {-8, -48}}, color = {0, 0, 127}, thickness = 0.5));
  connect(pipe.port_b, pipe1.port_a) annotation(
    Line(points = {{-40, 0}, {-40, 102}, {-8, 102}}, color = {0, 127, 255}));
  connect(pipe1.port_b, pipe3.port_a) annotation(
    Line(points = {{12, 102}, {42, 102}, {42, 0}}, color = {0, 127, 255}));
  connect(wallConstProps.heatPort_b, pipe2.heatPorts) annotation(
    Line(points = {{2, -77}, {2, -92}}, color = {191, 0, 0}, thickness = 0.5));
  connect(pipe1.heatPorts, wallConstProps1.heatPort_a) annotation(
    Line(points = {{2, 98}, {2, 85}}, color = {127, 0, 0}, thickness = 0.5));
  connect(pipe3.port_b, boundary1.ports[1]) annotation(
    Line(points = {{62, 0}, {78, 0}, {78, 0}, {78, 0}}, color = {0, 127, 255}));
  connect(thermalCollector1.port_b, heatCapacitor.port) annotation(
    Line(points = {{2, -12}, {2, -12}, {2, -2}, {14, -2}, {14, -2}}, color = {191, 0, 0}));
  connect(thermalCollector.port_b, heatCapacitor1.port) annotation(
    Line(points = {{2, 28}, {2, 28}, {2, 24}, {14, 24}, {14, 24}}, color = {191, 0, 0}));
  annotation(
    uses(Modelica(version = "3.2.3")),
    Diagram(coordinateSystem(extent = {{-100, -125}, {100, 125}})),
    Icon(coordinateSystem(extent = {{-100, -125}, {100, 125}})),
    version = "");
end Circuit_hydraulique01_04;

And I get the following error message which is different :

enter image description here

Does anyone know what's the issue in the example, that might solve the issue for the more complex model ?

maxime3359
  • 75
  • 6
  • Are you sure that the second heat capacitor is the only difference? With the screenshots its hard to give help. The best would be if you try to create a minimal example and provide the code. – marco Apr 01 '22 at 15:27
  • @marco i'll add an answer to my question with an example, thanks – maxime3359 Apr 04 '22 at 06:52
  • Please don't use answers for that. Edit your question instead. – marco Apr 04 '22 at 07:20

0 Answers0