DASSL solver in OpenModelica for an exchange between exterior and phase change material - differential-equations

I want to model heat transfer between the exterior and a phase change material on OpenModelica. The system of equations obtained is a system of algebraic differential equations. I have already discretized my equations in space (according to x and y) and I use the DASSL integrator to determine the time derivatives. After verification, I get a consistent temperature (T_xy) whatever the temperatures at the following grid cells (x+1, x+2, x+3, y+1, y+2, y+3). However, the liquid fraction obtained is not the one expected. When T_xy is lower than the melting temperature of the MCP (T_fusion in Octadecanol), it should be zero. When T_xy > T_fusion, it must be equal to 1. At T_fusion, it must be between 0 and 1.
These are the models used to simulate PCM_ex_test (with the inputs T_xy = 60°C and the inputs fl_xy = 1):
model PCM_ex
// Modèles intégrant les propriétés thermophysiques des fluides caloporteurs, du MCP et des ailettes
Octadecanol PCM;
Ailettes Fin;
// Déclaration des paramètres
parameter Modelica.SIunits.Temperature T_init = 15+273.15;
//parameter Real fl_init = 0;
parameter Modelica.SIunits.Length H_MCP = 0.4;
parameter Modelica.SIunits.Length P_MCP = 0.4;
parameter Modelica.SIunits.Length L_MCP = 0.4;
parameter Modelica.SIunits.Mass M_MCP = 50;
parameter Modelica.SIunits.Volume V_MCP = M_MCP / PCM.rho_MCP;
parameter Modelica.SIunits.DimensionlessRatio ratio_a = V_MCP / (V_MCP + Fin.V_ailettes);
parameter Modelica.SIunits.CoefficientOfHeatTransfer h_ext = 10;
// Déclaration des paramètres de discrétisation
parameter Real Delta_x = 0.01;
parameter Real Delta_y = 0.01;
// Variables d'entrée
Modelica.Blocks.Interfaces.RealInput T_ext annotation(
Placement(visible = true, transformation(origin = {-52, 26}, extent = {{-12, -12}, {12, 12}}, rotation = 0), iconTransformation(origin = {-47, 33}, extent = {{-7, -7}, {7, 7}}, rotation = 0)));
Modelica.Blocks.Interfaces.RealInput T_xy_plus_3x "Maille x+3 du n,m" annotation(
Placement(visible = true, transformation(origin = {49, -35}, extent = {{-9, -9}, {9, 9}}, rotation = 180), iconTransformation(origin = {45, -35}, extent = {{5, -5}, {-5, 5}}, rotation = 0)));
Modelica.Blocks.Interfaces.RealInput T_xy_plus_2x "Maille x+2 du n,m" annotation(
Placement(visible = true, transformation(origin = {49, -25}, extent = {{9, -9}, {-9, 9}}, rotation = 0), iconTransformation(origin = {45, -25}, extent = {{5, -5}, {-5, 5}}, rotation = 0)));
Modelica.Blocks.Interfaces.RealInput T_xy_plus_1x "Maille x+1 du n,m" annotation(
Placement(visible = true, transformation(origin = {49, -15}, extent = {{9, -9}, {-9, 9}}, rotation = 0), iconTransformation(origin = {45, -15}, extent = {{5, -5}, {-5, 5}}, rotation = 0)));
Modelica.Blocks.Interfaces.RealInput fl_xy_plus_3x "Maille x+3 du n,m" annotation(
Placement(visible = true, transformation(origin = {70, -36}, extent = {{-10, -10}, {10, 10}}, rotation = 180), iconTransformation(origin = {63, -35}, extent = {{-5, -5}, {5, 5}}, rotation = 180)));
Modelica.Blocks.Interfaces.RealInput fl_xy_plus_2x "Maille x+2 du n,m" annotation(
Placement(visible = true, transformation(origin = {70, -26}, extent = {{10, -10}, {-10, 10}}, rotation = 0), iconTransformation(origin = {63, -25}, extent = {{-5, -5}, {5, 5}}, rotation = 180)));
Modelica.Blocks.Interfaces.RealInput fl_xy_plus_1x "Maille x+1 du n,m" annotation(
Placement(visible = true, transformation(origin = {70, -16}, extent = {{10, -10}, {-10, 10}}, rotation = 0), iconTransformation(origin = {63, -15}, extent = {{-5, -5}, {5, 5}}, rotation = 180)));
Modelica.Blocks.Interfaces.RealInput T_xy_plus_3y "Maille y+3 du n,m" annotation(
Placement(visible = true, transformation(origin = {31, 49}, extent = {{-9, -9}, {9, 9}}, rotation = -90), iconTransformation(origin = {33, 45}, extent = {{-5, -5}, {5, 5}}, rotation = -90)));
Modelica.Blocks.Interfaces.RealInput T_xy_plus_2y "Maille y+2 du n,m" annotation(
Placement(visible = true, transformation(origin = {21, 49}, extent = {{-9, -9}, {9, 9}}, rotation = -90), iconTransformation(origin = {23, 45}, extent = {{-5, -5}, {5, 5}}, rotation = -90)));
Modelica.Blocks.Interfaces.RealInput T_xy_plus_1y "Maille y+1 du n,m" annotation(
Placement(visible = true, transformation(origin = {11, 49}, extent = {{-9, -9}, {9, 9}}, rotation = 270), iconTransformation(origin = {13, 45}, extent = {{5, -5}, {-5, 5}}, rotation = 90)));
Modelica.Blocks.Interfaces.RealInput fl_xy_plus_3y "Maille y+3 du n,m" annotation(
Placement(visible = true, transformation(origin = {31, 67}, extent = {{-9, -9}, {9, 9}}, rotation = -90), iconTransformation(origin = {33, 63}, extent = {{-5, -5}, {5, 5}}, rotation = -90)));
Modelica.Blocks.Interfaces.RealInput fl_xy_plus_2y "Maille y+2 du n,m" annotation(
Placement(visible = true, transformation(origin = {21, 67}, extent = {{-9, -9}, {9, 9}}, rotation = -90), iconTransformation(origin = {23, 63}, extent = {{-5, -5}, {5, 5}}, rotation = -90)));
Modelica.Blocks.Interfaces.RealInput fl_xy_plus_1y "Maille y+1 du n,m" annotation(
Placement(visible = true, transformation(origin = {11, 67}, extent = {{-9, -9}, {9, 9}}, rotation = -90), iconTransformation(origin = {13, 63}, extent = {{5, 5}, {-5, -5}}, rotation = 90)));
// Constantes du modèle
Real C1, C2, C3, C4, C5;
// Déclaration des matrices (variables)
Modelica.Blocks.Interfaces.RealOutput T_xy(start = T_init) annotation(
Placement(visible = true, transformation(origin = {-12, -52}, extent = {{-12, -12}, {12, 12}}, rotation = -90), iconTransformation(origin = {-13, -47}, extent = {{-7, -7}, {7, 7}}, rotation = -90)));
Modelica.Blocks.Interfaces.RealOutput fl_xy(start = 0) annotation(
Placement(visible = true, transformation(origin = {-26, -52}, extent = {{-12, -12}, {12, 12}}, rotation = -90), iconTransformation(origin = {-29, -47}, extent = {{-7, -7}, {7, 7}}, rotation = -90)));
equation
C1 = (ratio_a * PCM.ks_MCP + (1 - ratio_a) * Fin.k_ailettes) / (2 * Delta_x);
C2 = ratio_a * (PCM.kl_MCP - PCM.ks_MCP) / (2 * Delta_x);
C3 = 4 * T_xy_plus_1x - T_xy_plus_2x;
C4 = 3 * ratio_a * (PCM.ks_MCP - PCM.kl_MCP) / 4 * ((- T_xy_plus_2x + 4 * T_xy_plus_1x - 3 * T_xy) / Delta_x^2 + (- T_xy_plus_2y + 4* T_xy_plus_1y - 3 * T_xy) / Delta_y^2) + ratio_a * (PCM.kl_MCP - PCM.ks_MCP) * ((2 * T_xy - 5 * T_xy_plus_1x + 4 * T_xy_plus_2x - T_xy_plus_3x) / Delta_x^2 + (2 * T_xy - 5 * T_xy_plus_1y + 4 * T_xy_plus_2y - T_xy_plus_3y) / Delta_y^2);
C5 = ratio_a * (PCM.ks_MCP - PCM.kl_MCP) * ((-fl_xy_plus_2x + 4 * fl_xy_plus_1x) / (2 * Delta_x) * (-T_xy_plus_2x + 4 * T_xy_plus_1x - 3 * T_xy) / (2 * Delta_x) + (-fl_xy_plus_2y + 4 * fl_xy_plus_1y) / (2 * Delta_y) * (-T_xy_plus_2y + 4 * T_xy_plus_1y - 3 * T_xy) / (2 * Delta_y)) - (ratio_a * PCM.ks_MCP + (1 - ratio_a) * Fin.k_ailettes) * ((2 * T_xy - 5 * T_xy_plus_1x + 4 * T_xy_plus_2x - T_xy_plus_3x) / Delta_x^2 + (2 * T_xy - 5 * T_xy_plus_1y + 4 * T_xy_plus_2y - T_xy_plus_3y) / Delta_y^2);
// Calcul de la fraction liquide
der(fl_xy) = (fl_xy * (C4 + PCM.rho_MCP * (PCM.cp_MCP_s - PCM.cp_MCP_l) * der(T_xy)) - C5 - PCM.rho_MCP * PCM.cp_MCP_s * der(T_xy)) / (PCM.rho_MCP * PCM.h_latent + PCM.rho_MCP * (PCM.cp_MCP_s * (PCM.T_fusion - T_xy) + PCM.cp_MCP_l * (T_xy - PCM.T_fusion)));
// Calcul de la température
T_xy = (h_ext * T_ext + C1 * C3 + C2 * C3 * fl_xy) / (h_ext + 3 * C1 + 3 * C2 * fl_xy);
annotation(
Diagram(graphics = {Rectangle(fillColor = {0, 170, 0}, fillPattern = FillPattern.Solid, extent = {{-40, 40}, {40, -40}})}),
Icon(graphics = {Rectangle(fillColor = {0, 170, 0}, fillPattern = FillPattern.Solid, extent = {{-40, 40}, {40, -40}}), Text(origin = {-1, 1}, extent = {{-13, 7}, {13, -7}}, textString = "%name")}));
end PCM_ex;
record Octadecanol
parameter Modelica.SIunits.Temperature T_fusion = 25+273.15;
//Melting temperature
parameter Modelica.SIunits.ThermalConductivity ks_MCP = 0.301;
parameter Modelica.SIunits.ThermalConductivity kl_MCP = 0.205;
parameter Modelica.SIunits.Density rho_MCP = 850;
parameter Modelica.SIunits.SpecificHeatCapacity cp_MCP_s = 1750;
parameter Modelica.SIunits.SpecificHeatCapacity cp_MCP_l = 2150;
type Heat = Real(unit = "J.kg-1");
parameter Heat h_latent = 226000;
end Octadecanol;
record Ailettes
parameter Modelica.SIunits.ThermalConductivity k_ailettes = 20;
parameter Modelica.SIunits.Volume V_ailettes = 0.2;
parameter Modelica.SIunits.Density rho_ailettes = 1200;
end Ailettes;
model PCM_ex_test
MCPBat_V8.PCM.PCM_ex pCM_ex annotation(
Placement(visible = true, transformation(origin = {0, 0}, extent = {{-50, -50}, {50, 50}}, rotation = 0)));
Modelica.Blocks.Sources.RealExpression T_ext(y = 10+273.15) annotation(
Placement(visible = true, transformation(origin = {-56, 16}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Sources.RealExpression T_xy_plus1y(y = 60+273.15) annotation(
Placement(visible = true, transformation(origin = {-14, 56}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
Modelica.Blocks.Sources.RealExpression T_xy_plus2y(y = 60+273.15) annotation(
Placement(visible = true, transformation(origin = {-4, 56}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
Modelica.Blocks.Sources.RealExpression T_xy_plus3y(y = 60+273.15) annotation(
Placement(visible = true, transformation(origin = {6, 56}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
Modelica.Blocks.Sources.RealExpression T_xy_plus3x(y = 60+273.15) annotation(
Placement(visible = true, transformation(origin = {76, -6}, extent = {{-10, -10}, {10, 10}}, rotation = 180)));
Modelica.Blocks.Sources.RealExpression T_xy_plus2x(y = 60+273.15) annotation(
Placement(visible = true, transformation(origin = {76, 4}, extent = {{-10, -10}, {10, 10}}, rotation = 180)));
Modelica.Blocks.Sources.RealExpression T_xy_plus1x(y = 60+273.15) annotation(
Placement(visible = true, transformation(origin = {76, 14}, extent = {{-10, -10}, {10, 10}}, rotation = 180)));
Modelica.Blocks.Sources.RealExpression fl_xy_plus1y(y = 1) annotation(
Placement(visible = true, transformation(origin = {18, 56}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
Modelica.Blocks.Sources.RealExpression fl_xy_plus2y(y = 1) annotation(
Placement(visible = true, transformation(origin = {28, 56}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
Modelica.Blocks.Sources.RealExpression fl_xy_plus3y(y = 1) annotation(
Placement(visible = true, transformation(origin = {38, 56}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
Modelica.Blocks.Sources.RealExpression fl_xy_plus1x(y = 1) annotation(
Placement(visible = true, transformation(origin = {76, -18}, extent = {{-10, -10}, {10, 10}}, rotation = 180)));
Modelica.Blocks.Sources.RealExpression fl_xy_plus2x(y = 1) annotation(
Placement(visible = true, transformation(origin = {76, -28}, extent = {{-10, -10}, {10, 10}}, rotation = 180)));
Modelica.Blocks.Sources.RealExpression fl_xy_plus3x(y = 1) annotation(
Placement(visible = true, transformation(origin = {76, -38}, extent = {{-10, -10}, {10, 10}}, rotation = 180)));
equation
connect(T_xy_plus1x.y, pCM_ex.T_xy_plus_1x) annotation(
Line(points = {{66, 14}, {22, 14}, {22, -8}}, color = {0, 0, 127}));
connect(T_xy_plus2x.y, pCM_ex.T_xy_plus_2x) annotation(
Line(points = {{66, 4}, {22, 4}, {22, -12}}, color = {0, 0, 127}));
connect(T_xy_plus3x.y, pCM_ex.T_xy_plus_3x) annotation(
Line(points = {{66, -6}, {22, -6}, {22, -18}}, color = {0, 0, 127}));
connect(fl_xy_plus1x.y, pCM_ex.fl_xy_plus_1x) annotation(
Line(points = {{66, -18}, {32, -18}, {32, -8}}, color = {0, 0, 127}));
connect(fl_xy_plus2x.y, pCM_ex.fl_xy_plus_2x) annotation(
Line(points = {{66, -28}, {32, -28}, {32, -12}}, color = {0, 0, 127}));
connect(fl_xy_plus3x.y, pCM_ex.fl_xy_plus_3x) annotation(
Line(points = {{66, -38}, {32, -38}, {32, -18}}, color = {0, 0, 127}));
connect(T_ext.y, pCM_ex.T_ext) annotation(
Line(points = {{-44, 16}, {-24, 16}}, color = {0, 0, 127}));
connect(T_xy_plus1y.y, pCM_ex.T_xy_plus_1y) annotation(
Line(points = {{-14, 46}, {6, 46}, {6, 22}}, color = {0, 0, 127}));
connect(T_xy_plus2y.y, pCM_ex.T_xy_plus_2y) annotation(
Line(points = {{-4, 46}, {12, 46}, {12, 22}}, color = {0, 0, 127}));
connect(T_xy_plus3y.y, pCM_ex.T_xy_plus_3y) annotation(
Line(points = {{6, 46}, {16, 46}, {16, 22}}, color = {0, 0, 127}));
connect(fl_xy_plus1y.y, pCM_ex.fl_xy_plus_1y) annotation(
Line(points = {{18, 46}, {6, 46}, {6, 32}}, color = {0, 0, 127}));
connect(fl_xy_plus2y.y, pCM_ex.fl_xy_plus_2y) annotation(
Line(points = {{28, 46}, {12, 46}, {12, 32}}, color = {0, 0, 127}));
connect(fl_xy_plus3y.y, pCM_ex.fl_xy_plus_3y) annotation(
Line(points = {{38, 45}, {16, 45}, {16, 32}}, color = {0, 0, 127}));
end PCM_ex_test;
So, I wonder if I am using the DASSL solver in OpenModelica, and the time derivatives.
If not, the other option would be to add tests to match the three cases presented above.
Can someone better explain to me how the time derivatives and the DASSL solver work in OpenModelica and give me a solution if possible.
Thanks in advance,
Have a nice day

Related

Hydraulic network works with StaticPipe but not with DynamicPipe in OpenModelica

As mentioned in the title, I'm trying to model an hydraulic network. It is working properly when I use the StaticPipe of the ModelicaStandardLibrary. However, as I'll need to introduce heat transfer later on, I tried to make the same model but using DynamicPipe instead. As it is mentioned in the documentation of the StaticPipe, it is equivalent to the DynamicPipe with SteadyState settings. As I don't consider heat transfers yet, I replaced every StaticPipe with DynamicPipe in SteadyState and I disabled the use_heattransfer option. The model is balanced, however when I launch the simulation I get the following error message and the simulation runs indefinitely. I have to cancel it.
Here is the code I use :
model Circuit_hydraulique_21_03
replaceable package Medium=Modelica.Media.Water.StandardWater constrainedby
Modelica.Media.Interfaces.PartialMedium;
Modelica.Fluid.Sources.Boundary_pT inlet(redeclare package Medium = Medium,T = 311.15, p = 4.4e5, nPorts = 1) annotation(
Placement(visible = true, transformation(origin = {-588, -2}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
//steady state definition
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 = {-588, 88}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Sources.MassFlowSource_T boundary(redeclare package Medium = Medium,T = 311.15, m_flow = -2.5, nPorts = 1) annotation(
Placement(visible = true, transformation(origin = {434, 0}, extent = {{10, -10}, {-10, 10}}, rotation = 0)));
Modelica.Fluid.Pipes.DynamicPipe entree(redeclare package Medium = Medium,diameter = 42.7e-3, length = 10, nNodes = 10, roughness = 3.2e-06, use_HeatTransfer = false) annotation(
Placement(visible = true, transformation(origin = {-558, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Fittings.AbruptAdaptor abruptAdaptor(redeclare package Medium = Medium,diameter_a = 42.7e-3, diameter_b = 32e-3) annotation(
Placement(visible = true, transformation(origin = {-534, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Pipes.DynamicPipe entree_Primary(redeclare package Medium = Medium,diameter = 32e-3, length = 185e-3, roughness = 3.2e-06, use_HeatTransfer = false) annotation(
Placement(visible = true, transformation(origin = {-508, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Fittings.AbruptAdaptor abruptAdaptor1(redeclare package Medium = Medium,diameter_a = 32e-3, diameter_b = 38e-3) annotation(
Placement(visible = true, transformation(origin = {-482, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Pipes.DynamicPipe Primary_1(redeclare package Medium = Medium,diameter = 38e-3, length = 24.532e-3, use_HeatTransfer = false) annotation(
Placement(visible = true, transformation(origin = {-456, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Pipes.DynamicPipe Primary_2(redeclare package Medium = Medium,diameter = 38e-3, length = 24.532e-3, use_HeatTransfer = false) annotation(
Placement(visible = true, transformation(origin = {-426, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Pipes.DynamicPipe Primary_3(redeclare package Medium = Medium,diameter = 38e-3, length = 24.532e-3, use_HeatTransfer = false) annotation(
Placement(visible = true, transformation(origin = {-398, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Pipes.DynamicPipe Primary_4(redeclare package Medium = Medium,diameter = 38e-3, length = 24.532e-3, use_HeatTransfer = false) annotation(
Placement(visible = true, transformation(origin = {-368, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Pipes.DynamicPipe Primary_5(redeclare package Medium = Medium,diameter = 38e-3, length = 24.532e-3, use_HeatTransfer = false) annotation(
Placement(visible = true, transformation(origin = {-338, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Pipes.DynamicPipe Primary_6(redeclare package Medium = Medium,diameter = 38e-3, length = 24.532e-3, use_HeatTransfer = false) annotation(
Placement(visible = true, transformation(origin = {-310, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Pipes.DynamicPipe Primary_7(redeclare package Medium = Medium,diameter = 38e-3, length = 24.532e-3, use_HeatTransfer = false) annotation(
Placement(visible = true, transformation(origin = {-282, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Pipes.DynamicPipe Primary_8(redeclare package Medium = Medium,diameter = 38e-3, length = 24.532e-3, use_HeatTransfer = false) annotation(
Placement(visible = true, transformation(origin = {-254, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Pipes.DynamicPipe Primary_9(redeclare package Medium = Medium,diameter = 38e-3, length = 24.532e-3, use_HeatTransfer = false) annotation(
Placement(visible = true, transformation(origin = {-226, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Pipes.DynamicPipe Primary_10(redeclare package Medium = Medium,diameter = 38e-3, length = 24.532e-3, use_HeatTransfer = false) annotation(
Placement(visible = true, transformation(origin = {-196, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Pipes.DynamicPipe Primary_12(redeclare package Medium = Medium,diameter = 38e-3, length = 24.532e-3, use_HeatTransfer = false) annotation(
Placement(visible = true, transformation(origin = {-136, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Pipes.DynamicPipe Secondary_1(redeclare package Medium = Medium,diameter = 12.8e-3, length = 15633e-3, roughness = 3.2e-06, use_HeatTransfer = false) annotation(
Placement(visible = true, transformation(origin = {-442, -34}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
Modelica.Fluid.Pipes.DynamicPipe Secondary_2(redeclare package Medium = Medium,diameter = 12.8e-3, length = 15633e-3, roughness = 3.2e-06, use_HeatTransfer = false) annotation(
Placement(visible = true, transformation(origin = {-414, -34}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
Modelica.Fluid.Pipes.DynamicPipe Secondary_3(redeclare package Medium = Medium,diameter = 12.8e-3, length = 15633e-3, roughness = 3.2e-06, use_HeatTransfer = false) annotation(
Placement(visible = true, transformation(origin = {-384, -34}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
Modelica.Fluid.Pipes.DynamicPipe Secondary_4(redeclare package Medium = Medium,diameter = 12.8e-3, length = 15633e-3, roughness = 3.2e-06, use_HeatTransfer = false) annotation(
Placement(visible = true, transformation(origin = {-354, -34}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
Modelica.Fluid.Pipes.DynamicPipe Secondary_5(redeclare package Medium = Medium,diameter = 12.8e-3, length = 15633e-3, roughness = 3.2e-06, use_HeatTransfer = false) annotation(
Placement(visible = true, transformation(origin = {-324, -34}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
Modelica.Fluid.Pipes.DynamicPipe Secondary_6(redeclare package Medium = Medium,diameter = 12.8e-3, length = 15633e-3, roughness = 3.2e-06, use_HeatTransfer = false) annotation(
Placement(visible = true, transformation(origin = {-296, -34}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
Modelica.Fluid.Pipes.DynamicPipe Secondary_7(redeclare package Medium = Medium,diameter = 12.8e-3, length = 15633e-3, roughness = 3.2e-06, use_HeatTransfer = false) annotation(
Placement(visible = true, transformation(origin = {-268, -34}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
Modelica.Fluid.Pipes.DynamicPipe Secondary_8(redeclare package Medium = Medium,diameter = 12.8e-3, length = 15633e-3, roughness = 3.2e-06, use_HeatTransfer = false) annotation(
Placement(visible = true, transformation(origin = {-242, -34}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
Modelica.Fluid.Pipes.DynamicPipe Secondary_9(redeclare package Medium = Medium,diameter = 12.8e-3, length = 15633e-3, roughness = 3.2e-06, use_HeatTransfer = false) annotation(
Placement(visible = true, transformation(origin = {-212, -34}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
Modelica.Fluid.Pipes.DynamicPipe Secondary_10(redeclare package Medium = Medium,diameter = 12.8e-3, length = 15633e-3, roughness = 3.2e-06, use_HeatTransfer = false) annotation(
Placement(visible = true, transformation(origin = {-182, -34}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
Modelica.Fluid.Pipes.DynamicPipe Secondary_11(redeclare package Medium = Medium,diameter = 12.8e-3, length = 15633e-3, roughness = 3.2e-06, use_HeatTransfer = false) annotation(
Placement(visible = true, transformation(origin = {-152, -34}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
Modelica.Fluid.Pipes.DynamicPipe Secondary_12(redeclare package Medium = Medium,diameter = 12.8e-3, length = 15633e-3, roughness = 3.2e-06, use_HeatTransfer = false) annotation(
Placement(visible = true, transformation(origin = {-120, -34}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
Modelica.Fluid.Pipes.DynamicPipe Primary_11(redeclare package Medium = Medium,diameter = 38e-3, length = 24.532e-3, use_HeatTransfer = false) annotation(
Placement(visible = true, transformation(origin = {-166, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Pipes.DynamicPipe Primary_13(redeclare package Medium = Medium,diameter = 38e-3, length = 24.532e-3, use_HeatTransfer = false) annotation(
Placement(visible = true, transformation(origin = {-94, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Pipes.DynamicPipe Primary_14(redeclare package Medium = Medium,diameter = 38e-3, length = 24.532e-3, use_HeatTransfer = false) annotation(
Placement(visible = true, transformation(origin = {-64, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Pipes.DynamicPipe Primary_15(redeclare package Medium = Medium,diameter = 38e-3, length = 24.532e-3, use_HeatTransfer = false) annotation(
Placement(visible = true, transformation(origin = {-32, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Pipes.DynamicPipe Primary_16(redeclare package Medium = Medium,diameter = 38e-3, length = 24.532e-3, use_HeatTransfer = false) annotation(
Placement(visible = true, transformation(origin = {-2, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Pipes.DynamicPipe Primary_17(redeclare package Medium = Medium,diameter = 38e-3, length = 24.532e-3, use_HeatTransfer = false) annotation(
Placement(visible = true, transformation(origin = {28, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Pipes.DynamicPipe Primary_18(redeclare package Medium = Medium,diameter = 38e-3, length = 24.532e-3, use_HeatTransfer = false) annotation(
Placement(visible = true, transformation(origin = {58, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Pipes.DynamicPipe Primary_19(redeclare package Medium = Medium,diameter = 38e-3, length = 24.532e-3, use_HeatTransfer = false) annotation(
Placement(visible = true, transformation(origin = {90, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Pipes.DynamicPipe Primary_20(redeclare package Medium = Medium,diameter = 38e-3, length = 24.532e-3, use_HeatTransfer = false) annotation(
Placement(visible = true, transformation(origin = {124, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Pipes.DynamicPipe Primary_21(redeclare package Medium = Medium,diameter = 38e-3, length = 24.532e-3, use_HeatTransfer = false) annotation(
Placement(visible = true, transformation(origin = {158, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Pipes.DynamicPipe Primary_22(redeclare package Medium = Medium,diameter = 38
e-3, length = 24.532e-3, use_HeatTransfer = false) annotation(
Placement(visible = true, transformation(origin = {192, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Pipes.DynamicPipe Primary_23(redeclare package Medium = Medium,diameter = 38e-3, length = 24.532e-3, use_HeatTransfer = false) annotation(
Placement(visible = true, transformation(origin = {224, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Pipes.DynamicPipe Primary_24(redeclare package Medium = Medium,diameter = 38e-3, length = 24.532e-3, use_HeatTransfer = false) annotation(
Placement(visible = true, transformation(origin = {258, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Fittings.AbruptAdaptor abruptAdaptor2(redeclare package Medium = Medium,diameter_a = 38e-3, diameter_b = 32e-3) annotation(
Placement(visible = true, transformation(origin = {288, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Pipes.DynamicPipe sortie_Primary(redeclare package Medium = Medium,diameter = 32e-3, length = 185e-3, roughness = 3.2e-06, use_HeatTransfer = false) annotation(
Placement(visible = true, transformation(origin = {318, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Fittings.AbruptAdaptor abruptAdaptor3(redeclare package Medium = Medium,diameter_a = 32e-3, diameter_b = 42.7e-3) annotation(
Placement(visible = true, transformation(origin = {348, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Pipes.DynamicPipe sortie(redeclare package Medium = Medium,diameter = 42.7e-3, length = 10, nNodes = 10, roughness = 3.2e-06, use_HeatTransfer = false) annotation(
Placement(visible = true, transformation(origin = {384, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
connect(entree.port_b, abruptAdaptor.port_a) annotation(
Line(points = {{-548, 0}, {-544, 0}}, color = {0, 127, 255}));
connect(entree.port_b, abruptAdaptor.port_a) annotation(
Line(points = {{-548, 0}, {-544, 0}}, color = {0, 127, 255}));
connect(abruptAdaptor.port_b, entree_Primary.port_a) annotation(
Line(points = {{-524, 0}, {-518, 0}}, color = {0, 127, 255}));
connect(entree_Primary.port_b, abruptAdaptor1.port_a) annotation(
Line(points = {{-498, 0}, {-492, 0}}, color = {0, 127, 255}));
connect(abruptAdaptor1.port_b, Primary_1.port_a) annotation(
Line(points = {{-472, 0}, {-466, 0}}, color = {0, 127, 255}));
connect(Primary_1.port_b, Primary_2.port_a) annotation(
Line(points = {{-446, 0}, {-436, 0}}, color = {0, 127, 255}));
connect(Primary_2.port_b, Primary_3.port_a) annotation(
Line(points = {{-416, 0}, {-408, 0}}, color = {0, 127, 255}));
connect(Primary_3.port_b, Primary_4.port_a) annotation(
Line(points = {{-388, 0}, {-378, 0}}, color = {0, 127, 255}));
connect(Primary_4.port_b, Primary_5.port_a) annotation(
Line(points = {{-358, 0}, {-348, 0}}, color = {0, 127, 255}));
connect(Primary_5.port_b, Primary_6.port_a) annotation(
Line(points = {{-328, 0}, {-320, 0}}, color = {0, 127, 255}));
connect(Primary_6.port_b, Primary_7.port_a) annotation(
Line(points = {{-300, 0}, {-292, 0}}, color = {0, 127, 255}));
connect(Primary_7.port_b, Primary_8.port_a) annotation(
Line(points = {{-272, 0}, {-264, 0}}, color = {0, 127, 255}));
connect(Primary_8.port_b, Primary_9.port_a) annotation(
Line(points = {{-244, 0}, {-236, 0}}, color = {0, 127, 255}));
connect(Primary_9.port_b, Primary_10.port_a) annotation(
Line(points = {{-216, 0}, {-206, 0}}, color = {0, 127, 255}));
connect(Primary_1.port_b, Secondary_1.port_a) annotation(
Line(points = {{-446, 0}, {-442, 0}, {-442, -24}, {-442, -24}}, color = {0, 127, 255}));
connect(Primary_2.port_b, Secondary_2.port_a) annotation(
Line(points = {{-416, 0}, {-414, 0}, {-414, -24}, {-414, -24}}, color = {0, 127, 255}));
connect(Primary_3.port_b, Secondary_3.port_a) annotation(
Line(points = {{-388, 0}, {-384, 0}, {-384, -24}, {-384, -24}}, color = {0, 127, 255}));
connect(Primary_4.port_b, Secondary_4.port_a) annotation(
Line(points = {{-358, 0}, {-354, 0}, {-354, -24}, {-354, -24}}, color = {0, 127, 255}));
connect(Primary_5.port_b, Secondary_5.port_a) annotation(
Line(points = {{-328, 0}, {-324, 0}, {-324, -24}, {-324, -24}}, color = {0, 127, 255}));
connect(Primary_6.port_b, Secondary_6.port_a) annotation(
Line(points = {{-300, 0}, {-296, 0}, {-296, -24}, {-296, -24}}, color = {0, 127, 255}));
connect(Primary_7.port_b, Secondary_7.port_a) annotation(
Line(points = {{-272, 0}, {-268, 0}, {-268, -24}, {-268, -24}}, color = {0, 127, 255}));
connect(Primary_8.port_b, Secondary_8.port_a) annotation(
Line(points = {{-244, 0}, {-242, 0}, {-242, -24}, {-242, -24}}, color = {0, 127, 255}));
connect(Primary_9.port_b, Secondary_9.port_a) annotation(
Line(points = {{-216, 0}, {-212, 0}, {-212, -24}}, color = {0, 127, 255}));
connect(Primary_10.port_b, Secondary_10.port_a) annotation(
Line(points = {{-186, 0}, {-182, 0}, {-182, -24}}, color = {0, 127, 255}));
connect(Primary_11.port_b, Primary_12.port_a) annotation(
Line(points = {{-156, 0}, {-146, 0}}, color = {0, 127, 255}));
connect(Primary_10.port_b, Primary_11.port_a) annotation(
Line(points = {{-186, 0}, {-176, 0}}, color = {0, 127, 255}));
connect(Primary_11.port_b, Secondary_11.port_a) annotation(
Line(points = {{-156, 0}, {-152, 0}, {-152, -24}, {-152, -24}}, color = {0, 127, 255}));
connect(Primary_12.port_b, Secondary_12.port_a) annotation(
Line(points = {{-126, 0}, {-120, 0}, {-120, -24}}, color = {0, 127, 255}));
connect(Secondary_12.port_b, Primary_13.port_a) annotation(
Line(points = {{-120, -44}, {-120, -44}, {-120, -50}, {-108, -50}, {-108, 0}, {-104, 0}, {-104, 0}}, color = {0, 127, 255}));
connect(Primary_13.port_b, Primary_14.port_a) annotation(
Line(points = {{-84, 0}, {-74, 0}, {-74, 0}, {-74, 0}}, color = {0, 127, 255}));
connect(Primary_14.port_b, Primary_15.port_a) annotation(
Line(points = {{-54, 0}, {-42, 0}, {-42, 0}, {-42, 0}, {-42, 0}}, color = {0, 127, 255}));
connect(Primary_15.port_b, Primary_16.port_a) annotation(
Line(points = {{-22, 0}, {-12, 0}, {-12, 0}, {-12, 0}}, color = {0, 127, 255}));
connect(Primary_16.port_b, Primary_17.port_a) annotation(
Line(points = {{8, 0}, {16, 0}, {16, 0}, {18, 0}, {18, 0}}, color = {0, 127, 255}));
connect(Primary_17.port_b, Primary_18.port_a) annotation(
Line(points = {{38, 0}, {46, 0}, {46, 0}, {48, 0}}, color = {0, 127, 255}));
connect(Primary_18.port_b, Primary_19.port_a) annotation(
Line(points = {{68, 0}, {80, 0}, {80, 0}, {80, 0}}, color = {0, 127, 255}));
connect(Primary_19.port_b, Primary_20.port_a) annotation(
Line(points = {{100, 0}, {110, 0}, {110, 0}, {114, 0}, {114, 0}}, color = {0, 127, 255}));
connect(Primary_20.port_b, Primary_21.port_a) annotation(
Line(points = {{134, 0}, {148, 0}, {148, 0}, {148, 0}}, color = {0, 127, 255}));
connect(Primary_21.port_b, Primary_22.port_a) annotation(
Line(points = {{168, 0}, {182, 0}, {182, 0}, {182, 0}}, color = {0, 127, 255}));
connect(Primary_22.port_b, Primary_23.port_a) annotation(
Line(points = {{202, 0}, {214, 0}, {214, 0}, {214, 0}}, color = {0, 127, 255}));
connect(Primary_23.port_b, Primary_24.port_a) annotation(
Line(points = {{234, 0}, {248, 0}, {248, 0}, {248, 0}}, color = {0, 127, 255}));
connect(Secondary_11.port_b, Primary_14.port_a) annotation(
Line(points = {{-152, -44}, {-154, -44}, {-154, -54}, {-78, -54}, {-78, 0}, {-74, 0}, {-74, 0}}, color = {0, 127, 255}));
connect(Secondary_10.port_b, Primary_15.port_a) annotation(
Line(points = {{-182, -44}, {-182, -44}, {-182, -58}, {-48, -58}, {-48, 0}, {-42, 0}, {-42, 0}}, color = {0, 127, 255}));
connect(Secondary_9.port_b, Primary_16.port_a) annotation(
Line(points = {{-212, -44}, {-212, -44}, {-212, -60}, {-12, -60}, {-12, 0}, {-12, 0}}, color = {0, 127, 255}));
connect(Secondary_8.port_b, Primary_17.port_a) annotation(
Line(points = {{-242, -44}, {-242, -44}, {-242, -62}, {18, -62}, {18, 0}, {18, 0}}, color = {0, 127, 255}));
connect(Secondary_7.port_b, Primary_18.port_a) annotation(
Line(points = {{-268, -44}, {-266, -44}, {-266, -64}, {48, -64}, {48, 0}, {48, 0}}, color = {0, 127, 255}));
connect(Secondary_6.port_b, Primary_19.port_a) annotation(
Line(points = {{-296, -44}, {-296, -44}, {-296, -70}, {80, -70}, {80, 0}, {80, 0}}, color = {0, 127, 255}));
connect(Secondary_5.port_b, Primary_20.port_a) annotation(
Line(points = {{-324, -44}, {-324, -44}, {-324, -72}, {114, -72}, {114, 0}, {114, 0}}, color = {0, 127, 255}));
connect(Secondary_4.port_b, Primary_21.port_a) annotation(
Line(points = {{-354, -44}, {-356, -44}, {-356, -74}, {146, -74}, {146, 0}, {148, 0}}, color = {0, 127, 255}));
connect(Secondary_3.port_b, Primary_22.port_a) annotation(
Line(points = {{-384, -44}, {-380, -44}, {-380, -76}, {182, -76}, {182, 0}, {182, 0}}, color = {0, 127, 255}));
connect(Secondary_2.port_b, Primary_23.port_a) annotation(
Line(points = {{-414, -44}, {-414, -44}, {-414, -82}, {212, -82}, {212, 0}, {214, 0}}, color = {0, 127, 255}));
connect(Secondary_1.port_b, Primary_24.port_a) annotation(
Line(points = {{-442, -44}, {-440, -44}, {-440, -88}, {248, -88}, {248, 0}, {248, 0}}, color = {0, 127, 255}));
connect(Primary_24.port_b, abruptAdaptor2.port_a) annotation(
Line(points = {{268, 0}, {278, 0}, {278, 0}, {278, 0}}, color = {0, 127, 255}));
connect(abruptAdaptor2.port_b, sortie_Primary.port_a) annotation(
Line(points = {{298, 0}, {308, 0}, {308, 0}, {308, 0}, {308, 0}}, color = {0, 127, 255}));
connect(sortie_Primary.port_b, abruptAdaptor3.port_a) annotation(
Line(points = {{328, 0}, {338, 0}, {338, 0}, {338, 0}}, color = {0, 127, 255}));
connect(abruptAdaptor3.port_b, sortie.port_a) annotation(
Line(points = {{358, 0}, {372, 0}, {372, 0}, {374, 0}}, color = {0, 127, 255}));
connect(sortie.port_b, boundary.ports[1]) annotation(
Line(points = {{394, 0}, {424, 0}}, color = {0, 127, 255}));
connect(inlet.ports[1], entree.port_a) annotation(
Line(points = {{-578, -2}, {-578, 0}, {-568, 0}}, color = {0, 127, 255}));
annotation(
uses(Modelica(version = "3.2.3")),
Diagram(coordinateSystem(extent = {{-600, -100}, {450, 100}}, initialScale = 0.1), graphics = {Ellipse(origin = {-119, -36}, extent = {{-1, -8}, {1, 8}}, endAngle = 360)}),
Icon(coordinateSystem(extent = {{-600, -100}, {450, 100}})),
version = "");
end Circuit_hydraulique_21_03;
Does anyone know why it's not working ?
Best regards,
Maxime

Can the MSL Heatcapacitor be used to model fluid convection?

I'm building a pipe network. In this model some of the pipes exchange heat through a wall with a mass of fluid. The mass of fluid and the outside of the wall exchange heat by convection and I can estimate the heat transfer coefficient. In order to model this mass of fluid I want to use the HeatCapitor from the MSL as it is possible to estimate its heat capacity for my model.
Here is a visual representation of this model:
The model is balanced, and after the compilation I get this error message :
Here is the code I use :
model Ciruit_hyd_bas_avec_echanges_22_03
replaceable package Medium = Modelica.Media.Water.StandardWater constrainedby Modelica.Media.Interfaces.PartialMedium;
replaceable model HeatTransfer_1 = Modelica.Fluid.Pipes.BaseClasses.HeatTransfer.LocalPipeFlowHeatTransfer;
Modelica.Fluid.Sources.Boundary_pT inlet(redeclare package Medium = Medium, T = 311.15, nPorts = 1, p = 4.4e5) annotation(
Placement(visible = true, transformation(origin = {-86, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Pipes.DynamicPipe secondary_1(redeclare package Medium = Medium, diameter = 13e-3, energyDynamics = Modelica.Fluid.Types.Dynamics.SteadyStateInitial, length = 15, massDynamics = Modelica.Fluid.Types.Dynamics.SteadyStateInitial, momentumDynamics = Modelica.Fluid.Types.Dynamics.SteadyStateInitial, nNodes = 10, roughness = 3.2e-06, use_HeatTransfer = true) annotation(
Placement(visible = true, transformation(origin = {14, 76}, extent = {{-10, 10}, {10, -10}}, rotation = 0)));
Modelica.Fluid.Pipes.DynamicPipe secondary_2(redeclare package Medium = Medium, redeclare final model HeatTransfer = HeatTransfer_1, diameter = 13e-3, energyDynamics = Modelica.Fluid.Types.Dynamics.SteadyStateInitial, length = 15, massDynamics = Modelica.Fluid.Types.Dynamics.SteadyStateInitial, momentumDynamics = Modelica.Fluid.Types.Dynamics.SteadyStateInitial, nNodes = 10, roughness = 3.2e-06, use_HeatTransfer = true) annotation(
Placement(visible = true, transformation(origin = {12, -82}, 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 = 38e-3, energyDynamics = Modelica.Fluid.Types.Dynamics.SteadyStateInitial, length = 1, massDynamics = Modelica.Fluid.Types.Dynamics.SteadyStateInitial, momentumDynamics = Modelica.Fluid.Types.Dynamics.SteadyStateInitial, p_a_start = 4.4e5, roughness = 3.2e-06) annotation(
Placement(visible = true, transformation(origin = {-56, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
inner Modelica.Fluid.System system annotation(
Placement(visible = true, transformation(origin = {-88, 88}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Examples.HeatExchanger.BaseClasses.WallConstProps wallConstProps(area_h = 0.89535390627, c_wall = 510, energyDynamics = Modelica.Fluid.Types.Dynamics.SteadyStateInitial, k_wall = 60.5, n = 10, rho_wall = 7850, s = 6e-3) annotation(
Placement(visible = true, transformation(origin = {12, -56}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Examples.HeatExchanger.BaseClasses.WallConstProps wallConstProps1(area_h = 0.89535390627, c_wall = 510, energyDynamics = Modelica.Fluid.Types.Dynamics.SteadyStateInitial, k_wall = 60.5, n = 10, rho_wall = 7850, s = 6e-3) annotation(
Placement(visible = true, transformation(origin = {12, 50}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Pipes.DynamicPipe pipe3(redeclare package Medium = Medium, diameter = 38e-3, energyDynamics = Modelica.Fluid.Types.Dynamics.SteadyStateInitial, length = 1, massDynamics = Modelica.Fluid.Types.Dynamics.SteadyStateInitial, momentumDynamics = Modelica.Fluid.Types.Dynamics.SteadyStateInitial, roughness = 3.2e-06) annotation(
Placement(visible = true, transformation(origin = {124, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Thermal.HeatTransfer.Components.HeatCapacitor heatCapacitor[10](each C = 418, each T(start = 328.15)) annotation(
Placement(visible = true, transformation(origin = {76, 0}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
Modelica.Fluid.Sources.MassFlowSource_T outlet(redeclare package Medium = Medium, T = 311.15, m_flow = -2.5, nPorts = 1) annotation(
Placement(visible = true, transformation(origin = {150, 0}, extent = {{10, -10}, {-10, 10}}, rotation = 0)));
Modelica.Thermal.HeatTransfer.Components.Convection convection[10] annotation(
Placement(visible = true, transformation(origin = {12, -30}, extent = {{-10, -10}, {10, 10}}, rotation = 90)));
Modelica.Thermal.HeatTransfer.Components.Convection convection2[10] annotation(
Placement(visible = true, transformation(origin = {12, 20}, extent = {{-10, 10}, {10, -10}}, rotation = -90)));
Modelica.Blocks.Sources.Constant const[10](each k = 60) annotation(
Placement(visible = true, transformation(origin = {-58, 20}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Sources.Constant const1[10](each k = 60) annotation(
Placement(visible = true, transformation(origin = {-56, -30}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
connect(inlet.ports[1], pipe2.port_a) annotation(
Line(points = {{-76, 0}, {-66, 0}}, color = {0, 127, 255}));
connect(pipe2.port_b, secondary_1.port_a) annotation(
Line(points = {{-46, 0}, {-22, 0}, {-22, 76}, {4, 76}}, color = {0, 127, 255}));
connect(pipe2.port_b, secondary_2.port_a) annotation(
Line(points = {{-46, 0}, {-22, 0}, {-22, -82}, {2, -82}}, color = {0, 127, 255}));
connect(secondary_1.port_b, pipe3.port_a) annotation(
Line(points = {{24, 76}, {114, 76}, {114, 0}}, color = {0, 127, 255}));
connect(secondary_2.port_b, pipe3.port_a) annotation(
Line(points = {{22, -82}, {114, -82}, {114, 0}}, color = {0, 127, 255}));
connect(pipe3.port_b, outlet.ports[1]) annotation(
Line(points = {{134, 0}, {140, 0}}, color = {0, 127, 255}));
connect(secondary_1.heatPorts, wallConstProps1.heatPort_a) annotation(
Line(points = {{14, 72}, {10, 72}, {10, 56}, {12, 56}}, color = {127, 0, 0}, thickness = 0.5));
connect(wallConstProps1.heatPort_b, convection2.solid) annotation(
Line(points = {{12, 46}, {12, 46}, {12, 30}, {12, 30}}, color = {191, 0, 0}, thickness = 0.5));
connect(const.y, convection2.Gc) annotation(
Line(points = {{-47, 20}, {2, 20}}, color = {0, 0, 127}, thickness = 0.5));
connect(const1.y, convection.Gc) annotation(
Line(points = {{-44, -30}, {0, -30}, {0, -30}, {2, -30}}, color = {0, 0, 127}, thickness = 0.5));
connect(convection.solid, wallConstProps.heatPort_a) annotation(
Line(points = {{12, -40}, {12, -40}, {12, -50}, {12, -50}}, color = {191, 0, 0}, thickness = 0.5));
connect(wallConstProps.heatPort_b, secondary_2.heatPorts) annotation(
Line(points = {{12, -60}, {12, -60}, {12, -78}, {12, -78}}, color = {191, 0, 0}, thickness = 0.5));
connect(convection2.fluid, heatCapacitor.port) annotation(
Line(points = {{12, 10}, {66, 10}, {66, 0}, {66, 0}}, color = {191, 0, 0}, thickness = 0.5));
connect(convection.fluid, heatCapacitor.port) annotation(
Line(points = {{12, -20}, {66, -20}, {66, 0}, {66, 0}}, color = {191, 0, 0}, thickness = 0.5));
annotation(
uses(Modelica(version = "3.2.3")),
Diagram(coordinateSystem(extent = {{-100, -100}, {175, 100}})),
Icon(coordinateSystem(extent = {{-100, -100}, {175, 100}})),
version = "");
end Ciruit_hyd_bas_avec_echanges_22_03;
So I wonder if it's possible to use the Heatcapacitor to model the mass of a fluid for convection or if the error is in my model?

Model of a fluid through a pipe can't run on openmodelica

I'm trying to simulate on OpenModelica, a fluid (here water) that flowh through a pipe with an inlet pressure and temperature. I want to take into account the convective exchange between the wall of the pipe and the fluid, the convective exchange between the wall, the ambient and the conductive exchange in the wall and the properties of the medium that vary in function of the temperature... The check of the model is ok but when I run the simulation I have an error.
Here is my code :
model Water_flow
replaceable package Medium=Modelica.Media.Water.StandardWater constrainedby
Modelica.Media.Interfaces.PartialMedium;
output Modelica.SIunits.MassFlowRate mass_flow_rate=abs(pipe.port_b.m_flow);
Modelica.Fluid.Sources.Boundary_pT boundary(redeclare package Medium = Medium, T = 318.45, nPorts = 1, p = 14.6e5) annotation(
Placement(visible = true, transformation(origin = {-24, -80}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Sources.Boundary_pT boundary1(redeclare package Medium = Medium, T = 328.15, nPorts = 1, p = 14e5) annotation(
Placement(visible = true, transformation(origin = {60, -80}, extent = {{-10, -10}, {10, 10}}, rotation = 180)));
Modelica.Fluid.Pipes.DynamicPipe pipe(redeclare package Medium = Medium, redeclare model HeatTransfer=Modelica.Fluid.Pipes.BaseClasses.HeatTransfer.LocalPipeFlowHeatTransfer, T_start = 318.15, allowFlowReversal = false, diameter = 13e-3, energyDynamics = Modelica.Fluid.Types.Dynamics.SteadyStateInitial, height_ab = 0, length = 15, massDynamics = Modelica.Fluid.Types.Dynamics.SteadyStateInitial, momentumDynamics = Modelica.Fluid.Types.Dynamics.SteadyStateInitial, nNodes = 5, use_HeatTransfer = true) annotation(
Placement(visible = true, transformation(origin = {18, -80}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
inner Modelica.Fluid.System system(T_ambient = 290.15, energyDynamics = Modelica.Fluid.Types.Dynamics.SteadyStateInitial, massDynamics = Modelica.Fluid.Types.Dynamics.SteadyStateInitial, momentumDynamics = Modelica.Fluid.Types.Dynamics.SteadyStateInitial) annotation(
Placement(visible = true, transformation(origin = {-84, 84}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Thermal.HeatTransfer.Components.Convection convection annotation(
Placement(visible = true, transformation(origin = {-50, -2}, extent = {{-10, -10}, {10, 10}}, rotation = 90)));
Modelica.Blocks.Sources.Constant const(k = 358) annotation(
Placement(visible = true, transformation(origin = {-88, -2}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Thermal.HeatTransfer.Sources.FixedTemperature fixedTemperature(T = 328.15) annotation(
Placement(visible = true, transformation(origin = {-50, 44}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
Modelica.Thermal.HeatTransfer.Components.Convection convection1 annotation(
Placement(visible = true, transformation(origin = {-16, -2}, extent = {{-10, -10}, {10, 10}}, rotation = 90)));
Modelica.Thermal.HeatTransfer.Sources.FixedTemperature fixedTemperature1(T = 328.15) annotation(
Placement(visible = true, transformation(origin = {-16, 44}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
Modelica.Fluid.Examples.HeatExchanger.BaseClasses.WallConstProps wallConstProps(T_start = 318.15, area_h = 0.9, c_wall = 420, dT = 283.15, energyDynamics = Modelica.Fluid.Types.Dynamics.SteadyStateInitial, k_wall = 60.5, n = 5, rho_wall = 7850, s = 6e-3) annotation(
Placement(visible = true, transformation(origin = {18, -44}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Thermal.HeatTransfer.Components.Convection convection2 annotation(
Placement(visible = true, transformation(origin = {18, -2}, extent = {{-10, -10}, {10, 10}}, rotation = 90)));
Modelica.Thermal.HeatTransfer.Sources.FixedTemperature fixedTemperature2(T = 328.15) annotation(
Placement(visible = true, transformation(origin = {18, 44}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
Modelica.Thermal.HeatTransfer.Sources.FixedTemperature fixedTemperature3(T = 328.15) annotation(
Placement(visible = true, transformation(origin = {50, 44}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
Modelica.Thermal.HeatTransfer.Sources.FixedTemperature fixedTemperature4(T = 328.15) annotation(
Placement(visible = true, transformation(origin = {82, 44}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
Modelica.Thermal.HeatTransfer.Components.Convection convection3 annotation(
Placement(visible = true, transformation(origin = {50, -2}, extent = {{-10, -10}, {10, 10}}, rotation = 90)));
Modelica.Thermal.HeatTransfer.Components.Convection convection4 annotation(
Placement(visible = true, transformation(origin = {82, -2}, extent = {{-10, -10}, {10, 10}}, rotation = 90)));
equation
connect(boundary.ports[1], pipe.port_a) annotation(
Line(points = {{-14, -80}, {8, -80}}, color = {0, 127, 255}));
connect(pipe.port_b, boundary1.ports[1]) annotation(
Line(points = {{28, -80}, {50, -80}}, color = {0, 127, 255}));
connect(const.y, convection.Gc) annotation(
Line(points = {{-77, -2}, {-60, -2}}, color = {0, 0, 127}));
connect(fixedTemperature.port, convection.fluid) annotation(
Line(points = {{-50, 34}, {-50, 8}}, color = {191, 0, 0}));
connect(fixedTemperature.port, convection.fluid) annotation(
Line(points = {{-50, 34}, {-50, 8}}, color = {191, 0, 0}));
connect(fixedTemperature1.port, convection1.fluid) annotation(
Line(points = {{-16, 34}, {-16, 8}}, color = {191, 0, 0}));
connect(const.y, convection1.Gc) annotation(
Line(points = {{-77, -2}, {-26, -2}}, color = {0, 0, 127}));
connect(convection.solid, wallConstProps.heatPort_a[1]) annotation(
Line(points = {{-50, -12}, {-50, -24}, {18, -24}, {18, -39}}, color = {191, 0, 0}));
connect(fixedTemperature2.port, convection2.fluid) annotation(
Line(points = {{18, 34}, {18, 8}}, color = {191, 0, 0}));
connect(convection2.solid, wallConstProps.heatPort_a[3]) annotation(
Line(points = {{18, -12}, {18, -39}}, color = {191, 0, 0}));
connect(const.y, convection2.Gc) annotation(
Line(points = {{-77, -2}, {8, -2}}, color = {0, 0, 127}));
connect(const.y, convection3.Gc) annotation(
Line(points = {{-76, -2}, {40, -2}, {40, -2}, {40, -2}}, color = {0, 0, 127}));
connect(const.y, convection4.Gc) annotation(
Line(points = {{-76, -2}, {72, -2}, {72, -2}, {72, -2}}, color = {0, 0, 127}));
connect(convection3.solid, wallConstProps.heatPort_a[4]) annotation(
Line(points = {{50, -12}, {50, -24}, {18, -24}, {18, -39}}, color = {191, 0, 0}));
connect(convection4.solid, wallConstProps.heatPort_a[5]) annotation(
Line(points = {{82, -12}, {82, -24}, {18, -24}, {18, -39}}, color = {191, 0, 0}));
connect(convection1.solid, wallConstProps.heatPort_a[2]) annotation(
Line(points = {{-16, -12}, {-16, -24}, {18, -24}, {18, -39}}, color = {191, 0, 0}));
connect(wallConstProps.heatPort_b, pipe.heatPorts) annotation(
Line(points = {{18, -49}, {18, -76}}, color = {191, 0, 0}, thickness = 0.5));
connect(fixedTemperature3.port, convection3.fluid) annotation(
Line(points = {{50, 34}, {50, 8}}, color = {191, 0, 0}));
connect(fixedTemperature4.port, convection4.fluid) annotation(
Line(points = {{82, 34}, {82, 34}, {82, 8}, {82, 8}}, color = {191, 0, 0}));
annotation(
uses(Modelica(version = "3.2.3")),
Diagram);
end Water_flow;
The error message is in the image.
If anyone has an idea of what's wrong with the model.
Thanks and have a great day,
Maxime
In Dymola your code runs but with a lot of warnings. Initializing the pipe pressures makes it run without warnings — for example, pipe.p_a_start=1460000 and pipe.p_b_start=1400000.
Another thing, you could declare the convective elements and fixed temperatures as an array like this:
Modelica.Thermal.HeatTransfer.Components.Convection[pipe.nNodes] convection
Modelica.Thermal.HeatTransfer.Sources.FixedTemperature[pipe.nNodes] fixedTemperature(each T = 328.15)
That will make your model easier to maintain if you choose another discretization, e.g. pipe.nNodes=10.

How to update a variable along with simulation time in modelica?

'I am not familiar with Modelica language. here is my question:
I have two Real type variables K and A, they are used to compute outputs of the model, and at each timestep I want to update K and A to recalculate the output. How can I do this?'
It is unclear what you ask, but since you seem new to Modelica I would start with the most obvious solution: just give equations for K and A, like:
model M
output Real K;
output Real A;
Real x;
equation
K=2*x;
A=Modelica.Math.sin(time);
der(x)=1-x;
end M;
At each time-step there will be new values for K and A based on these equations.
(If K and A are sampled or clocked variables it becomes more complicated.)
The model from your link https://openmodelica.org/forum/default-topic/2339-modelica-variable-behavior can be rewritten to something like that does that (except I haven't tested with OpenModelica). This indicates that you should always include code - as this was not at all clear from your description.
model TimeVarTest
Modelica.SIunits.Time timeVar(start = 0);
Modelica.SIunits.Time timeOut(start = 0);
Modelica.Blocks.Tables.CombiTable1Ds tableVar(table = [0,0;1,0.5]);
Integer state(start = 0);
algorithm
if state == 0 then
// Action
tableVar.u := time-timeVar;
// Transition
end if;
when pre(state)==0 and time - timeVar > 1 then
state := 1;
timeVar := time;
end when;
if state == 1 then
// Action
tableVar.u := 1;
// Transition
end if;
when pre(state)==1 and time - timeVar > 2 then
state := 0;
timeVar := time;
end when;
equation
timeOut = tableVar.y[1];
annotation (
experiment(StartTime = 0, StopTime = 10, Tolerance = 1e-06, Interval = 0.1));
end TimeVarTest;
The following model showcases what i wrote in my comment. Simulating inputOutput.FullModel yields the control options you might be looking for.
Tested with OpenModelica for a simulation time of 10 seconds.
EDIT: I influenced the derivative of X instead of the variable itself because most of the time you will cause event chattering or no event at all if two variables a and b influence each other discontinuously.
package inputOutput
model M1
Modelica.Blocks.Interfaces.RealInput X annotation(
Placement(visible = true, transformation(origin = {-120, 0}, extent = {{-20, -20}, {20, 20}}, rotation = 0), iconTransformation(origin = {-120, 0}, extent = {{-20, -20}, {20, 20}}, rotation = 0)));
Modelica.Blocks.Interfaces.RealOutput K annotation(
Placement(visible = true, transformation(origin = {110, 48}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {110, 48}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Interfaces.RealOutput A annotation(
Placement(visible = true, transformation(origin = {110, -50}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {110, -50}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
K = if X > 1 then 1.5 else 0.8;
A = if X > 0 then 0.5 else -0.5;
end M1;
model M2
Modelica.Blocks.Interfaces.RealInput K annotation(
Placement(visible = true, transformation(origin = {-120, 50}, extent = {{-20, -20}, {20, 20}}, rotation = 0), iconTransformation(origin = {-120, 50}, extent = {{-20, -20}, {20, 20}}, rotation = 0)));
Modelica.Blocks.Interfaces.RealOutput X(start=0) annotation(
Placement(visible = true, transformation(origin = {110, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {110, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Interfaces.RealInput A annotation(
Placement(visible = true, transformation(origin = {-120, -50}, extent = {{-20, -20}, {20, 20}}, rotation = 0), iconTransformation(origin = {-120, -50}, extent = {{-20, -20}, {20, 20}}, rotation = 0)));
equation
der(X) = A + sin(time)*K;
end M2;
model FullModel
M1 m1 annotation(
Placement(visible = true, transformation(origin = {-48, 4}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
M2 m2 annotation(
Placement(visible = true, transformation(origin = {34, 4}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
connect(m1.A, m2.A) annotation(
Line(points = {{-38, 0}, {22, 0}, {22, -2}, {24, -2}}, color = {0, 0, 127}));
connect(m2.K, m1.K) annotation(
Line(points = {{22, 10}, {-38, 10}, {-38, 8}, {-36, 8}}, color = {0, 0, 127}));
connect(m2.X, m1.X) annotation(
Line(points = {{46, 4}, {66, 4}, {66, 52}, {-74, 52}, {-74, 4}, {-60, 4}, {-60, 4}}, color = {0, 0, 127}));
end FullModel;
annotation(
uses(Modelica(version = "3.2.2")));
end inputOutput;

What is the first step in debugging this model and how?

Debugging within OpenModelica seems to grow harder and harder the more I learn about it and realize how little of experience I have.
I have been reading a lot of OpenModelica Debugging literature and most pieces only seems to scrape the surface on debugging. The most helpful piece I have read was "Tools and Methods for Analysis, Debugging, and Performance Improvement of Equation-Based Models" by Martin Sjolund, a very prominent figure within the Modelica Community. Unfortunately, I do not have the background/experience to be able to follow all of Dr. Sjlund's book.
Even the OpenModelica users guide seems to barely iterate throughout the debugging process and the rest is to figure out on the users end.
I never know what to expect after my model successfully 1. checks and 2. flattens (instantiates). The algorithmic debugger is still a mystery to me.
EDIT: Code of model I'm having issues with
model HRSG_WaterDrum_HXVersion
///Current Version: Phase State: Left to be interpreted/guessed. This can be switched back. Volume should also be explored . . . Volumes taken from Library Model are very small with respect to small mass flow rate. Current Version: V & SA = 1///
ThermoPower.Water.Drum Drum(
Cm = 4.08e6 * 1.195e-2,
DrumOrientation = 1,
Kcs = 0.01,
Ks = 100,
L = 1.455,
afd = 0.0,
gl = 300,
gv = 150,
hlstart = 203.22e3,
hvstart = 203.22e3,
lm = 19,
pstart =
100e5,
rext = 0.125,
rint = 0.115,
tauc = 5,
tauev = 15) annotation(
Placement(visible = true, transformation(origin = {-49, 3}, extent =
{{-21, -21}, {21, 21}}, rotation = 0)));
ThermoPower.Water.SinkMassFlow Blowdown annotation(
Placement(visible = true, transformation(origin = {-10, -32}, extent =
{{-10, -10}, {10, 10}}, rotation = 0)));
ThermoPower.Water.Flow1DFV2ph Downcomer(
A = 1.903e-3,
Cfnom = 0.01,
Dhyd = 0.04922,
DynamicMomentum = false,
FFtype = ThermoPower.Choices.Flow1D.FFtypes.Colebrook,
H = -15.923,
Kfc = 1,
L = 15.923,
N = 2,
dpnom = 100,
e = 6.1e-4,
hstartin = 1407.6e3,
hstartout = 1407.6e3,
omega = 0.1546,
pstart = 100e5,
wnf = 0.3,
wnom = 21.5) annotation(
Placement(visible = true, transformation(origin = {-64, -50}, extent =
{{-10, -10}, {10, 10}}, rotation = -90)));
ThermoPower.Thermal.MetalTubeFV Downcomer_Wall(
L = 15.923,
Nw = 1,
Tstart1 = 540,
TstartN = 540,
WallRes = true,
lambda = 19,
rext = 0.03015,
rhomcm = 4.08e6,
rint = 0.02461) annotation(
Placement(visible = true, transformation(origin = {-48, -50}, extent =
{{-10, -10}, {10, 10}}, rotation = 90)));
ThermoPower.Water.Header HeaderLower(
Cm = 4.08e6 * 4.51e-4,
S = 1,
Tmstart = 540,
V = 1,
gamma = 2000,
hstart = 1407.6e3,
noInitialPressure = true,
pstart = 101.18e5) annotation(
Placement(visible = true, transformation(origin = {-30, -96}, extent =
{{-10, -10}, {10, 10}}, rotation = 0)));
ThermoPower.Water.PressDrop PressureDrop(
A = 5.62e-5,
FFtype = ThermoPower.Choices.PressDrop.FFtypes.Kinetic,
K = 3,
Kfc = 2,
dpnom = 80000,
wnf = 0.1,
wnom = 21.5) annotation(
Placement(visible = true, transformation(origin = {38, -96}, extent =
{{-10, -10}, {10, 10}}, rotation = 0)));
ThermoPower.Water.Header HeaderUpper(
Cm = 4.08e6 * 4.51e-4,
FluidPhaseStart = ThermoPower.Choices.FluidPhase.FluidPhases.TwoPhases,
S = 1,
Tmstart = 311.1 + 273.15,
V = 1,
gamma = 2000,
hstart = 2724.7e3,
noInitialPressure = true,
pstart = 100.2e5) annotation(
Placement(visible = true, transformation(origin = {72, -36}, extent =
{{-10, -10}, {10, 10}}, rotation = 90)));
ThermoPower.Water.Flow1DFV2ph Pipe2Drum(
A = 5.557e-4,
Cfnom = 0.01,
Dhyd = 0.0266,
FFtype = ThermoPower.Choices.Flow1D.FFtypes.Cfnom,
H = 2.779,
HydraulicCapacitance = ThermoPower.Choices.Flow1D.HCtypes.Upstream,
L = 2.779,
N = 2,
Nt = 1,
dpnom = 17000,
e = 9.9e-4,
hstartin = 2724.7e3,
hstartout = 2724.7e3,
noInitialPressure = true,
omega = 0.0835,
pstart = 100e5,
wnf = 0.1,
wnom = 21.5) annotation(
Placement(visible = true, transformation(origin = {19, -9}, extent =
{{-11, 11}, {11, -11}}, rotation = 180)));
ThermoPower.Thermal.MetalTubeFV Pipe2Drum_Wall(
L = 2.779,
Nw = 1,
Tstart1 = 584.25,
TstartN = 584.25,
WallRes = true,
lambda = 19,
rext = 0.0167,
rhomcm = 4.08e6,
rint = 0.0133) annotation(
Placement(visible = true, transformation(origin = {19, 9}, extent = {{-11,
-11}, {11, 11}}, rotation = 180)));
ThermoPower.Water.Flow1DFV2ph Pipe2SH(
A = 3.301 - 4,
Cfnom = 0.004,
Dhyd = 0.0205,
DynamicMomentum = false,
FFtype = ThermoPower.Choices.Flow1D.FFtypes.Cfnom,
H = 0,
HydraulicCapacitance = ThermoPower.Choices.Flow1D.HCtypes.Downstream,
L = 11.48,
N = 2,
Nt = 1,
dpnom = 2000,
hstartin = 2724.7e3,
hstartout = 2724.7e3,
omega = 0.0644,
pstart = 100e5,
wnom = 0.06) annotation(
Placement(visible = true, transformation(origin = {-20, 50}, extent =
{{-10, -10}, {10, 10}}, rotation = 0)));
ThermoPower.Thermal.MetalTubeFV Pipe2SH_Wall(
L = 11.480,
Nw = 1,
Tstart1 = 584.25,
TstartN = 584.25,
WallRes = true,
lambda = 19,
rext = 0.01305,
rhomcm = 4.08e6,
rint = 0.01025) annotation(
Placement(visible = true, transformation(origin = {-20, 66}, extent =
{{-10, -10}, {10, 10}}, rotation = 180)));
ThermoPower.Water.ValveVap VaporValve(
Av = 2.7e-5,
CvData = ThermoPower.Choices.Valve.CvTypes.Av,
dpnom = 2e+06,
pnom = 95e5,
useThetaInput = true,
wnom = 2 * 0.06) annotation(
Placement(visible = true, transformation(origin = {70, 50}, extent =
{{-10, -10}, {10, 10}}, rotation = 0)));
ThermoPower.Thermal.MetalTubeFV Pipe2Valve_Wall(
L = 6.6,
Nw = 1,
Tstart1 = 633.15,
TstartN = 633.15,
WallRes = true,
lambda = 19,
rext = 0.01275,
rhomcm = 4.08e6,
rint = 0.0100) annotation(
Placement(visible = true, transformation(origin = {40, 66}, extent =
{{-10, -10}, {10, 10}}, rotation = 180)));
ThermoPower.Water.Flow1DFV2ph Pipe2Valve(
A = 3.142e-4,
Cfnom = 0.004,
Dhyd = 0.02,
DynamicMomentum = false,
FFtype = ThermoPower.Choices.Flow1D.FFtypes.Cfnom,
H = 0,
HydraulicCapacitance = ThermoPower.Choices.Flow1D.HCtypes.Upstream,
L = 6.6,
N = 2,
Nt = 1,
dpnom = 1000,
hstartin = 2962.1e3,
hstartout = 2962.1e3,
omega = 0.0628,
pstart = 96e5,
wnf = 0.1,
wnom = 0.06) annotation(
Placement(visible = true, transformation(origin = {40, 50}, extent =
{{-10, -10}, {10, 10}}, rotation = 0)));
ThermoPower.Water.SinkPressure Sink(
p0 = 95e5) annotation(
Placement(visible = true, transformation(origin = {100, 50}, extent =
{{-10, -10}, {10, 10}}, rotation = 0)));
inner ThermoPower.System system annotation(
Placement(visible = true, transformation(origin = {-90, 90}, extent =
{{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Interfaces.RealOutput DrumPressure annotation(
Placement(visible = true, transformation(origin = {110, -10}, extent =
{{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {110,
-10}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Interfaces.RealOutput DrumLevel annotation(
Placement(visible = true, transformation(origin = {110, -38}, extent =
{{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {110,
-38}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Interfaces.RealInput Valve_Opening annotation(
Placement(visible = true, transformation(origin = {90, 80}, extent = {{8,
-8}, {-8, 8}}, rotation = 0), iconTransformation(origin = {90, 80}, extent
= {{8, -8}, {-8, 8}}, rotation = 0)));
ThermoPower.PowerPlants.HRSG.Components.HE SH(
Cfnom_F = 0.01,
Cfnom_G = 0.01,
FFtype_F = ThermoPower.Choices.Flow1D.FFtypes.Cfnom,
FFtype_G = ThermoPower.Choices.Flow1D.FFtypes.Cfnom,
Kfnom_F = 0,
Kfnom_G = 0,
N_F = 2,
N_G = 2,
Tstartbar_G(displayUnit = "K") = 787.72,
dpnom_F = 100,
dpnom_G = 100,
exchSurface_F = 2.752,
exchSurface_G = 2.752,
extSurfaceTub = 5.504,
fluidNomFlowRate = 21.5,
fluidNomPressure = 1e+07,
fluidVol = 0.01376,
gasNomFlowRate = 169.755,
gasNomPressure = 101325,
gasVol = 0.01376,
lambda = 19,
metalVol = 0.01376,
pstart_F = 1e+07,
pstart_G = 101325,
rhomcm = 4.08e6,
rhonom_F(displayUnit = "kg/m3") = 997,
rhonom_G = 1) annotation(
Placement(visible = true, transformation(origin = {10, 50}, extent = {{10,
-10}, {-10, 10}}, rotation = 90)));
ThermoPower.Gas.SourceMassFlow Source_FlueGas(
redeclare package Medium = ThermoPower.Media.FlueGas,
T = 514.57 + 273.15, Xnom = {0.23, 0.02, 0.01, 0.04, 0.7},
p0 = 101325,
w0 = 167.755) annotation(
Placement(visible = true, transformation(origin = {0, 90}, extent = {{-10,
-10}, {10, 10}}, rotation = 0)));
ThermoPower.PowerPlants.HRSG.Components.HE Economizer(
Cfnom_F = 0.01,
Cfnom_G = 0.01,
FFtype_G = ThermoPower.Choices.Flow1D.FFtypes.Cfnom,
Kfnom_G = 0,
N_F = 2,
N_G = 2,
Tstartbar_G = 604.74,
dpnom_F = 100,
dpnom_G = 100,
exchSurface_F = 2.752,
exchSurface_G = 2.752,
extSurfaceTub = 5.504,
fluidNomFlowRate = 21.5,
fluidNomPressure = 1e+07,
fluidVol = 0.01376,
gasNomFlowRate = 169.755,
gasNomPressure = 101325,
gasVol = 0.01376,
lambda = 19,
metalVol = 0.01376,
pstart_F = 1e+07,
pstart_G = 101325,
rhomcm = 4.08e6,
rhonom_F(displayUnit = "kg/m3") = 997,
rhonom_G = 1) annotation(
Placement(visible = true, transformation(origin = {-132, 0}, extent =
{{-10, -10}, {10, 10}}, rotation = 90)));
ThermoPower.Water.Flow1DFV2ph Pipe2DrumFeed(
A = 3.301e-4,
Cfnom = 0.004,
Dhyd = 0.0205,
DynamicMomentum = false,
FFtype = ThermoPower.Choices.Flow1D.FFtypes.Cfnom,
FluidPhaseStart = ThermoPower.Choices.FluidPhase.FluidPhases.Liquid,
H = 0,
HydraulicCapacitance = ThermoPower.Choices.Flow1D.HCtypes.Downstream,
L = 10,
N = 2,
Nt = 1,
dpnom = 2000,
hstartin = 1407.6e3,
hstartout = 1407.6e3,
omega = 0.0644,
pstart = 100e5,
wnom = 0.06) annotation(
Placement(visible = true, transformation(origin = {-96, 0}, extent =
{{-10, -10}, {10, 10}}, rotation = 0)));
ThermoPower.Thermal.MetalTubeFV Pipe2DrumFeed_Wall(
L = 11.480,
Nw = 1,
Tstart1 = 584.25,
TstartN = 584.25,
WallRes = true,
lambda = 19,
rext = 0.01305,
rhomcm = 4.08e6,
rint = 0.01025) annotation(
Placement(visible = true, transformation(origin = {-96, 16}, extent =
{{-10, -10}, {10, 10}}, rotation = 180)));
ThermoPower.Gas.SinkPressure Sink_FlueGas(
redeclare package Medium = ThermoPower.Media.FlueGas, T = 185.25 + 273.15,
Xnom = {0.23, 0.02, 0.01, 0.04, 0.7},
p0 = 101325) annotation(
Placement(visible = true, transformation(origin = {-122, 34}, extent =
{{-10, -10}, {10, 10}}, rotation = 0)));
ThermoPower.Water.SourceMassFlow Source_Water(
T = 46.45 + 273.15,
h = 203.22e3,
p0 = 100.0e5,
use_T = true,
w0 = 21.5) annotation(
Placement(visible = true, transformation(origin = {-164, 0}, extent =
{{-10, -10}, {10, 10}}, rotation = 0)));
ThermoPower.PowerPlants.HRSG.Components.HE Risers(
Cfnom_F = 0.01,
Cfnom_G = 0.01,
Kfnom_F = 0,
Kfnom_G = 0,
N_F = 2,
N_G = 2,
Tstartbar_G(displayUnit = "K") = 760.17,
dpnom_F = 100,
dpnom_G = 100,
exchSurface_F = 2.752,
exchSurface_G = 2.752,
extSurfaceTub = 5.504,
fluidNomFlowRate = 21.5,
fluidNomPressure = 1e+07,
fluidVol = 0.01376,
gasNomFlowRate = 169.755,
gasNomPressure = 101325,
gasVol = 0.01376,
lambda = 19,
metalVol = 0.01376,
pstart_F = 1e+07,
pstart_G = 101325,
rhomcm = 4.08e6,
rhonom_F(displayUnit = "kg/m3") = 997,
rhonom_G = 1) annotation(
Placement(visible = true, transformation(origin = {72, -72}, extent =
{{-10, -10}, {10, 10}}, rotation = 180)));
equation
connect(Valve_Opening, VaporValve.theta) annotation(
Line(points = {{90, 80}, {70, 80}, {70, 58}}, color = {0, 0, 127},
thickness = 0.75));
connect(Pipe2Drum_Wall.int, Pipe2Drum.wall) annotation(
Line(points = {{19, 6}, {19, -4.3}}, color = {255, 127, 0}, thickness =
0.75));
connect(Downcomer.wall, Downcomer_Wall.int) annotation(
Line(points = {{-59, -50}, {-51, -50}}, color = {255, 127, 0}, thickness =
0.75));
connect(Pipe2Valve_Wall.int, Pipe2Valve.wall) annotation(
Line(points = {{40, 63}, {40, 55}}, color = {255, 127, 0}, thickness =
0.75));
connect(Pipe2SH_Wall.int, Pipe2SH.wall) annotation(
Line(points = {{-20, 63}, {-20, 56}}, color = {255, 127, 0}, thickness =
0.75));
connect(Pipe2DrumFeed_Wall.int, Pipe2DrumFeed.wall) annotation(
Line(points = {{-96, 13}, {-96, 6}}, color = {255, 127, 0}, thickness =
0.75));
connect(HeaderUpper.outlet, Pipe2Drum.infl) annotation(
Line(points = {{72, -26}, {72, -9.5}, {30, -9.5}, {30, -9}}, color = {0,
0, 255}, thickness = 1));
connect(Pipe2Drum.outfl, Drum.riser) annotation(
Line(points = {{8, -9}, {-33, -9}}, color = {0, 0, 255}, thickness = 1));
connect(Drum.steam, Pipe2SH.infl) annotation(
Line(points = {{-37, 18}, {-36.82, 18}, {-36.82, 49.7}, {-30.82, 49.7}},
color = {0, 0, 255}, thickness = 1));
connect(SH.gasOut, Risers.gasIn) annotation(
Line(points = {{10, 40}, {10, 40}, {10, 20}, {92, 20}, {92, -72}, {82,
-72}, {82, -72}}, color = {159, 159, 223}, thickness = 0.75));
connect(Risers.gasOut, Economizer.gasIn) annotation(
Line(points = {{62, -72}, {-132, -72}, {-132, -10}, {-132, -10}}, color =
{159, 159, 223}, thickness = 0.75));
connect(HeaderUpper.inlet, Risers.waterOut) annotation(
Line(points = {{72, -46}, {72, -46}, {72, -62}, {72, -62}}, color = {0, 0,
255}, thickness = 1));
connect(PressureDrop.outlet, Risers.waterIn) annotation(
Line(points = {{48, -96}, {72, -96}, {72, -82}, {72, -82}, {72, -82}},
color = {0, 0, 255}, thickness = 1));
connect(Economizer.gasOut, Sink_FlueGas.flange) annotation(
Line(points = {{-132, 10}, {-132, 10}, {-132, 34}, {-132, 34}}, color =
{159, 159, 223}, thickness = 0.75));
connect(Blowdown.flange, Drum.blowdown) annotation(
Line(points = {{-20, -32}, {-49, -32}, {-49, -18}}, color = {0, 0, 255},
thickness = 1));
connect(Source_Water.flange, Economizer.waterIn) annotation(
Line(points = {{-154, 0}, {-142, 0}, {-142, 0}, {-142, 0}}, color = {0, 0,
255}, thickness = 1));
connect(Economizer.waterOut, Pipe2DrumFeed.infl) annotation(
Line(points = {{-122, 0}, {-106, 0}, {-106, 0}, {-106, 0}}, color = {0, 0,
255}, thickness = 1));
connect(Pipe2DrumFeed.outfl, Drum.feedwater) annotation(
Line(points = {{-86, 0}, {-69, 0}}, color = {0, 0, 255}, thickness = 1));
connect(Drum.downcomer, Downcomer.infl) annotation(
Line(points = {{-64, -12}, {-64, -12}, {-64, -40}, {-64, -40}}, color =
{0, 0, 255}, thickness = 1));
connect(Downcomer.outfl, HeaderLower.inlet) annotation(
Line(points = {{-64, -60}, {-64, -96}, {-40, -96}}, color = {0, 0, 255},
thickness = 1));
connect(Source_FlueGas.flange, SH.gasIn) annotation(
Line(points = {{10, 90}, {10, 90}, {10, 60}, {10, 60}, {10, 60}, {10,
60}}, color = {159, 159, 223}, thickness = 0.75));
connect(Pipe2SH.outfl, SH.waterIn) annotation(
Line(points = {{-10, 50}, {0, 50}, {0, 50}, {0, 50}, {0, 50}, {0, 50}},
color = {0, 0, 255}, thickness = 1));
connect(SH.waterOut, Pipe2Valve.infl) annotation(
Line(points = {{20, 50}, {30, 50}, {30, 50}, {30, 50}}, color = {0, 0,
255}, thickness = 1));
connect(VaporValve.outlet, Sink.flange) annotation(
Line(points = {{80, 50}, {90, 50}}, color = {0, 0, 255}, thickness = 1));
connect(Pipe2Valve.outfl, VaporValve.inlet) annotation(
Line(points = {{50, 50}, {60, 50}}, color = {0, 0, 255}, thickness = 1));
connect(HeaderLower.outlet, PressureDrop.inlet) annotation(
Line(points = {{-20, -96}, {28, -96}}, color = {0, 0, 255}, thickness =
1));
DrumPressure = Drum.p;
DrumLevel = Drum.y;
annotation(
uses(ThermoPower(version = "3.1"), Modelica(version = "3.2.3")));end
HRSG_WaterDrum_HXVersion;
Running that model (at least with the version of ThermoPower I had) stops immediately with:
Error: The following error was detected at time: 0 External radius
must be greater than internal radius Failed condition:
SH.metalTube.rext > 0.01
The cause is that ThermoPower.PowerPlants.HRSG.Components.HE has:
Thermal.MetalTubeFV metalTube(
rint=fluidVol*4/exchSurface_F/2,
rext=(metalVol + fluidVol)*4/extSurfaceTub/2,
and you set extSurfaceTub twice as large as exchSurface_F for SH, Economizer, and Risers.
In general I would say the first step is asking Why are you debugging the model?
Did it fail to initialize?
Did it initialize, but then the simulation stopped at some time?
Does it run, but generate the wrong results?
Does it run and generate the right results as far as you can tell, but too slowly?
Otherwise I don't why you would debug at all.
The first step in debugging any model is then:
Look at the warnings during translation
Check that the model components are tested
Check that they are connected together in the right way and with suitable parameters
Correcting the previous errors stops the model during initialization, but there were two kinds of warnings in Dymola that indicates problems that should be corrected:
The initial conditions are not fully specified.
Dymola has selected default initial conditions.
Assuming fixed start value for the continuous states:
Economizer.fluidFlow.htilde[]
Economizer.gasFlow.Xtilde[]
Risers.fluidFlow.htilde[]
Risers.gasFlow.Xtilde[]
SH.gasFlow.p(start = SH.gasFlow.pstart)
SH.gasFlow.Xtilde[]
Conflicting start values
The start value of the variable Economizer.fluidFlow.htilde[1] being Pipe2DrumFeed.hstart[1] has been selected as a default initial condition.
However, the start value has been selected from a set of alias variables having conflicting start values of the same precedence.
1407600.0, the start value of Pipe2DrumFeed.h[1] given as Pipe2DrumFeed.hstart[1].
100000.0, the start value of Economizer.fluidFlow.htilde[1] given as Economizer.fluidFlow.hstart[2].
The iteration variable SH.fluidFlow.htilde[1] has been selected to have the guess value Pipe2Valve.hstart[1].
However, the start value has been selected from a set of alias variables having conflicting start values of the same precedence.
2962100.0, the start value of Pipe2Valve.h[1] given as Pipe2Valve.hstart[1].
100000.0, the start value of SH.fluidFlow.htilde[1] given as SH.fluidFlow.hstart[2].
The iteration variable HeaderUpper.p has been selected to have the guess value HeaderUpper.pstart.
However, the start value has been selected from a set of alias variables having conflicting start values of the same precedence.
10020000.0, the start value of HeaderUpper.p given as HeaderUpper.pstart.
10000000.0, the start value of Pipe2Drum.p given as Pipe2Drum.pstart.
The iteration variable VaporValve.w has been selected to have the guess value VaporValve.wnom.
However, the start value has been selected from a set of alias variables having conflicting start values of the same precedence.
0.12, the start value of VaporValve.inlet.m_flow given as VaporValve.wnom.
-0.12, the start value of VaporValve.outlet.m_flow given as -VaporValve.wnom.
-0.06, the start value of Pipe2Valve.outfl.m_flow given as -Pipe2Valve.wnom.