Related
I would like to model an hydraulic network where I use the Modelica.Fluid.Fittings.SimpleGenericOrifice as a seal so I can impose the pressure loss of a pipe. Using the formula in the documentation, I can calculate the zeta coefficient of the orifice.
Here is a simplified example, here I try to impose a pressure loss of 50 bar inside my pipe1. Because the pressure should be equal at the port, I assume that it should work :
However I don't have any pressure loss in the pipe and in the orifice.
Does anyone know how to make this work ?
Here is the code of the example
model Joints_HD
replaceable package Medium=Modelica.Media.Water.StandardWater constrainedby
Modelica.Media.Interfaces.PartialMedium;
Modelica.Fluid.Pipes.StaticPipe pipe(redeclare package Medium = Medium,diameter = 0.15, length = 1) annotation(
Placement(visible = true, transformation(origin = {-38, 10}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
inner Modelica.Fluid.System system annotation(
Placement(visible = true, transformation(origin = {-70, 42}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Sources.Boundary_pT boundary(redeclare package Medium = Medium,T = 328.15, p = 157e5, nPorts = 1) annotation(
Placement(visible = true, transformation(origin = {-66, 10}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Sources.MassFlowSource_T boundary1(redeclare package Medium = Medium,T = 328.15, m_flow = -0.17, nPorts = 1) annotation(
Placement(visible = true, transformation(origin = {72, 10}, extent = {{10, -10}, {-10, 10}}, rotation = 0)));
Modelica.Fluid.Pipes.StaticPipe pipe2(redeclare package Medium = Medium,diameter = 0.15, length = 1) annotation(
Placement(visible = true, transformation(origin = {44, 10}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Fittings.SimpleGenericOrifice orifice(redeclare package Medium = Medium,diameter = 0.15, dp_nominal = 5e+06, m_flow_nominal = 2.34e-9, use_zeta = false) annotation(
Placement(visible = true, transformation(origin = {2, 10}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Pipes.StaticPipe pipe1(redeclare package Medium = Medium, diameter = 0.15, length = 1) annotation(
Placement(visible = true, transformation(origin = {2, -18}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
connect(boundary.ports[1], pipe.port_a) annotation(
Line(points = {{-56, 10}, {-48, 10}}, color = {0, 127, 255}));
connect(pipe.port_b, orifice.port_a) annotation(
Line(points = {{-28, 10}, {-8, 10}}, color = {0, 127, 255}));
connect(pipe2.port_b, boundary1.ports[1]) annotation(
Line(points = {{54, 10}, {62, 10}}, color = {0, 127, 255}));
connect(orifice.port_b, pipe2.port_a) annotation(
Line(points = {{12, 10}, {34, 10}}, color = {0, 127, 255}));
connect(pipe.port_b, pipe1.port_a) annotation(
Line(points = {{-28, 10}, {-20, 10}, {-20, -18}, {-8, -18}}, color = {0, 127, 255}));
connect(pipe1.port_b, pipe2.port_a) annotation(
Line(points = {{12, -18}, {26, -18}, {26, 10}, {34, 10}}, color = {0, 127, 255}));
annotation(
uses(Modelica(version = "3.2.3")));
end Joints_HD;
Best regards,
Maxime
pipe1 has "wrong" dimensions (diameter, length, roughness etc.) since it only creates a very small pressure drop.
To verify that the rest of the model is okay — and that you can have a pressure drop of 50 bar over pipe1 at the flow set in boundary1 (0.17 kg/s) — temporarilly change pipe1.FlowModel to NominalTurbulentPipeFlow with m_flow_nominal=0.17 and dp_nominal=50 bar.
Subsequently, switch the flow model back to the default (detailed) model and adjust the pipe geometry.
By the way, you should provide a value for orifice.zeta even though it is not used.
The documentation of the Modelica.Fluid.Vessels.ClosedVolume says that IdealHeatTransfer is considered by default. I'd like to use ConstantFlowHeatTransfer instead. I declare it in the Text View. However, doing so leads to an unbalanced model : 939 equations and 943 variables.
Here is the model :
And here is the code used :
model Closed_volume_test
replaceable package Medium=Modelica.Media.Water.ConstantPropertyLiquidWater constrainedby Modelica.Media.Interfaces.PartialMedium;
replaceable model HeatTransfer_1 = Modelica.Fluid.Pipes.BaseClasses.HeatTransfer.ConstantFlowHeatTransfer(alpha0=1800);
replaceable model HeatTransfer_2 = Modelica.Fluid.Pipes.BaseClasses.HeatTransfer.ConstantFlowHeatTransfer(alpha0=8000);
Modelica.Fluid.Vessels.ClosedVolume volume(redeclare package Medium = Medium, redeclare final model HeatTransfer = HeatTransfer_1, V = 20, energyDynamics = Modelica.Fluid.Types.Dynamics.SteadyState, massDynamics = Modelica.Fluid.Types.Dynamics.SteadyState, nPorts= 2, use_HeatTransfer = true, use_portsData = false) annotation(
Placement(visible = true, transformation(origin = {0, -36}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Pipes.StaticPipe pipe(redeclare package Medium = Medium,diameter = 0.15, length = 1) annotation(
Placement(visible = true, transformation(origin = {26, -54}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Sources.MassFlowSource_T boundary1(redeclare package Medium = Medium, T = 328.15, m_flow = 1,nPorts = 1) annotation(
Placement(visible = true, transformation(origin = {-56, -54}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Sources.Boundary_pT boundary(redeclare package Medium = Medium,T = 328.15, nPorts = 1, p = 1e5) annotation(
Placement(visible = true, transformation(origin = {56, -54}, extent = {{10, -10}, {-10, 10}}, rotation = 0)));
inner Modelica.Fluid.System system annotation(
Placement(visible = true, transformation(origin = {-88, 32}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Pipes.StaticPipe pipe1(redeclare package Medium = Medium,diameter = 0.15, length = 1) annotation(
Placement(visible = true, transformation(origin = {-26, -54}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Pipes.DynamicPipe pipe2(redeclare package Medium = Medium, redeclare final model HeatTransfer = HeatTransfer_2, diameter = 38e-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 = {0, 28}, extent = {{-10, 10}, {10, -10}}, rotation = 0)));
Modelica.Fluid.Sources.Boundary_pT boundary2(redeclare package Medium = Medium,T = 311.15, nPorts = 1, p = 14.6e5) annotation(
Placement(visible = true, transformation(origin = {-36, 28}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Sources.MassFlowSource_T boundary3(redeclare package Medium = Medium,m_flow = -0.25, nPorts = 1) annotation(
Placement(visible = true, transformation(origin = {36, 28}, extent = {{10, -10}, {-10, 10}}, rotation = 0)));
Modelica.Fluid.Examples.HeatExchanger.BaseClasses.WallConstProps wallConstProps(area_h = 0.89, c_wall = 510, energyDynamics = Modelica.Fluid.Types.Dynamics.SteadyState, k_wall = 60.5, n = 10, rho_wall = 7850, s = 3e-3) annotation(
Placement(visible = true, transformation(origin = {0, 8}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Thermal.HeatTransfer.Components.ThermalCollector thermalCollector(m = 10) annotation(
Placement(visible = true, transformation(origin = {0, -10}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
connect(boundary1.ports[1], pipe1.port_a) annotation(
Line(points = {{-46, -54}, {-36, -54}}, color = {0, 127, 255}));
connect(pipe.port_b, boundary.ports[1]) annotation(
Line(points = {{36, -54}, {46, -54}}, color = {0, 127, 255}));
connect(volume.ports[1], pipe1.port_b) annotation(
Line(points = {{0, -46}, {-16, -46}, {-16, -54}}, color = {0, 127, 255}));
connect(volume.ports[2], pipe.port_a) annotation(
Line(points = {{0, -46}, {16, -46}, {16, -54}}, color = {0, 127, 255}));
connect(boundary2.ports[1], pipe2.port_a) annotation(
Line(points = {{-26, 28}, {-10, 28}}, color = {0, 127, 255}));
connect(pipe2.port_b, boundary3.ports[1]) annotation(
Line(points = {{10, 28}, {26, 28}}, color = {0, 127, 255}));
connect(pipe2.heatPorts, wallConstProps.heatPort_a) annotation(
Line(points = {{0, 24}, {0, 13}}, color = {127, 0, 0}, thickness = 0.5));
connect(wallConstProps.heatPort_b, thermalCollector.port_a) annotation(
Line(points = {{0, 3}, {0, 0}}, color = {191, 0, 0}, thickness = 0.5));
connect(thermalCollector.port_b, volume.heatPort) annotation(
Line(points = {{0, -20}, {-10, -20}, {-10, -36}}, color = {191, 0, 0}));
annotation(
uses(Modelica(version = "3.2.3")));
end Closed_volume_test;
Is it possible to use another model for the heat transfer for the ClosedVolume ? If so, does anyone know how can I solve this problem?
Best regards
Maxime
ConstantFlowHeatTransfer is inherited from PartialFlowHeatTransfer which uses quantities such as length and nParallel which are not defined (and have no meaning) in the volume model. This is why you cannot use it.
ClosedVolume uses heat transfer models that inherit from PartialVesselHeatTransfer. You can build your own heat transfer model based on this.
If you need to consider the convective heat transfer in the "lower" medium of your model you could replace pipe, pipe1 and volume with a DynamicPipe model (with modelStructure=a_v_b and nNodes=1).
I'm trying to use the integerChange block from the Modelica Standard library
It doesn't seem to work however. What am i doing wrong? I would have expected a spike at each change,but i get a constant "false". I'm using OpenModelica 1.17
Here is the simple model
model integerChangeTest
Modelica.Blocks.Math.IntegerChange integerChange annotation(
Placement(visible = true, transformation(origin = {26, 24}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Math.RealToInteger realToInteger annotation(
Placement(visible = true, transformation(origin = {-6, 24}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Sources.Sine sine(amplitude = 5, freqHz = 5) annotation(
Placement(visible = true, transformation(origin = {-48, 26}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
connect(realToInteger.y, integerChange.u) annotation(
Line(points = {{5, 24}, {13, 24}}, color = {255, 127, 0}));
connect(sine.y, realToInteger.u) annotation(
Line(points = {{-37, 26}, {-19, 26}, {-19, 24}}, color = {0, 0, 127}));
annotation(
uses(Modelica(version = "3.2.3")));
end integerChangeTest;
The block works, but plotting change(x) is complicated in many Modelica tools.
The reason is that at an event there are a number of intermediate values, and to avoid plotting too many values one common solution is to just store the first and last; that also simplifies the implementation since it avoids a callback for storing values during the event iteration. Unfortunately change is only true in intermediate values during event iterations - and thus plotting it becomes meaningless.
I don't know if OpenModelica has some special mode for including them as well.
If you want to see that it changes you can use the code in the comment or graphically add not+OnDelay
model integerChangeTest
Modelica.Blocks.Math.IntegerChange integerChange annotation (
Placement(visible = true, transformation(origin = {26, 24}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Math.RealToInteger realToInteger annotation (
Placement(visible = true, transformation(origin = {-6, 24}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Sources.Sine sine(amplitude = 5, freqHz = 5) annotation (
Placement(visible = true, transformation(origin = {-48, 26}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Logical.Not not1
annotation (Placement(transformation(extent={{46,14},{66,34}})));
Modelica.Blocks.MathBoolean.OnDelay onDelay(delayTime=1e-3)
annotation (Placement(transformation(extent={{82,20},{90,28}})));
equation
connect(realToInteger.y, integerChange.u) annotation (
Line(points={{5,24},{14,24}}, color = {255, 127, 0}));
connect(sine.y, realToInteger.u) annotation (
Line(points={{-37,26},{-18,26},{-18,24}}, color = {0, 0, 127}));
connect(integerChange.y, not1.u)
annotation (Line(points={{37,24},{44,24}}, color={255,0,255}));
connect(onDelay.u, not1.y)
annotation (Line(points={{80.4,24},{67,24}}, color={255,0,255}));
annotation (
uses(Modelica(version="3.2.2")));
end integerChangeTest;
I'm currently working on building a heat recovery steam generator and have just started building from the ThermoPower Library and connected an evaporator to the economizer.
When trying to simulate, an error occurs within the OMEdit Simulator:
division by zero at time 0, (a=-458389.9207317767) / (b=0), where divisor b expression is: 8.75988806777792 * Economizer.metalTube.Am * Economizer.metalTube.rhomcm * /Real/(Economizer.metalTube.Nt)
How exactly do I trouble shoot this error if I cannot define or locate the needed variables that are causing b=0?
Please let me know what you think about this. Your time and energy is greatly appreciated.
I'm not the best at debugging my models but I have an idea and I have some confusion trouble shooting this. My initial confusion was to verify which variable resulted in b=0. However, upon inspection I noticed how the variable Economizer.metalTube.Nt, Economizer.metalTube.Am did not exist within my the economizer class. I knew it had to be rooted into my class through extensions and partial classes and tried to define these "missing" variables in the text view of my economizer model, but this simply resulted in an error saying:
[1] 11:46:14 Translation Error
[ThermoPower_HRSG_Econ_Evap: 68:3-92:112]: Variable Economizer: In modifier (Nt = 3), class or component Nt not found in .
If you have any advice and/or recommendations please leave a comment below!
///UPDATE: Moving forward after what I've learned from others and implementing their suggestions.///
After reading what you and others have said about my issue on OpenModelica I have come to a better understanding of the situation. However, I am still confused as to what is the best way to move forward to debug my model.
So my "Economizer" model, or a heat exchanger located in ThermoPower.Examples.RankineCycles.Models.HE, was having the error associated with the divisor "b=0".
When debugging, the error hyperlinked me to the package "thermal" which pointed me towards the line of code that is being flagged:
(L/Nw*Nt)*rhomcm*Am*der(Tvol) = int.Q + ext.Q "Energy balance";
This line of code is also being used in the Economizer HE class (ThermoPower.Examples.RankineCycles.Models.HE). Here in the HE.mo, the same flagged line of code from the thermal package that is causing the error is also located here. What's making my model cause the divider "b=0" are the variables: L, Nw, Nt, Am and Tvol. These variables are not defined/found in the model I am using when defining system parameters.
What's confusing for me as a OpenModelica user is that those variables just mentioned above (L, Nw, Nt, Am and Tvol) are coded/defined in the ThermoPower.Examples.RankineCycles.Models.HE text view of the component, but when I try to define/add them into my Economizer.mo belonging to the ThermoPower.Examples.RankineCycles.Models.HE class, errors are triggered claiming:
[ThermoPower_HRSG_Econ_Evap: 69:3-94:112]: Variable Economizer: In modifier
(Nt = 1), class or component Nt not found in
<ThermoPower.Examples.RankineCycle.Models.HE$Economizer>.
Essentially, the errors causing the divider "b=0" are located in the base class of the economizer I am using. However, due to the absence or in-ability to define these needed variables within my Economizer.mo model, the equation:
(L/Nw*Nt)*rhomcm*Am*der(Tvol) = int.Q + ext.Q "Energy balance";
Is now being violated. How do I fix this issue properly?
///UPDATE: CODE PROVIDED BELOW///
model ThermoPower_HRSG_Econ_Evap
ThermoPower.Gas.SourceMassFlow Source_FlueGas(
redeclare package Medium = ThermoPower.Media.FlueGas,
T = 331.59 + 273.15,
p0 = 101325,
w0 = 169.755) annotation(
Placement(visible = true, transformation(origin = {-92, 30}, extent =
{{-10, -10}, {10, 10}}, rotation = 0)));
ThermoPower.Water.SourceMassFlow Source_Steam(
T = 46.45 + 273.15,
h = 203.22e3,
p0 = 80e5,
use_T = true,
w0 = 21.5) annotation(
Placement(visible = true, transformation(origin = {-10, 90}, extent =
{{-10, -10}, {10, 10}}, rotation = 0)));
ThermoPower.Water.SensT sensT_WaterIn_Econ annotation(
Placement(visible = true, transformation(origin = {4, 60}, extent = {{-10,
-10}, {10, 10}}, rotation = -90)));
ThermoPower.Water.SensT sensT_WaterOut_Econ annotation(
Placement(visible = true, transformation(origin = {4, 0}, extent = {{-10,
-10}, {10, 10}}, rotation = -90)));
ThermoPower.Gas.SensT sensT_ExhaustIn_Econ(
redeclare package Medium = ThermoPower.Media.FlueGas) annotation(
Placement(visible = true, transformation(origin = {-50, 34}, extent =
{{-10, -10}, {10, 10}}, rotation = 0)));
ThermoPower.Gas.SensT sensT_ExhaustOut_Econ(
redeclare package Medium = ThermoPower.Media.FlueGas) annotation(
Placement(visible = true, transformation(origin = {50, 34}, 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)));
ThermoPower.Gas.SinkPressure Sink_FlueGas(
redeclare package Medium = ThermoPower.Media.FlueGas,
p0 = 101325) annotation(
Placement(visible = true, transformation(origin = {94, -70}, extent =
{{-10, -10}, {10, 10}}, rotation = 0)));
ThermoPower.Water.SinkPressure Sink_Steam(
p0 = 80e5) annotation(
Placement(visible = true, transformation(origin = {10, -90}, extent =
{{-10, -10}, {10, 10}}, rotation = 0)));
ThermoPower.Examples.HRB.Models.Evaporator Evaporator(
cm = 480,
exchSurface = 2.752,
fluidNomFlowRate = 21.5,
fluidNomPressure = 8e+06,
fluidVol = 0.01376,
gamma = 85,
gasNomFlowRate = 169.755,
gasNomPressure = 101325,
gasVol = 0.01376,
metalVol = 0.01376,
rhom(displayUnit = "kg/m3") = 8055,
rhonom_G = 1) annotation(
Placement(visible = true, transformation(origin = {0, -50}, extent =
{{-10, -10}, {10, 10}}, rotation = 0)));
ThermoPower.Gas.SensT sensT_ExhaustOut_Evap(
redeclare package Medium = ThermoPower.Media.FlueGas) annotation(
Placement(visible = true, transformation(origin = {50, -66}, extent =
{{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Continuous.FirstOrder VoidFractionSensor annotation(
Placement(visible = true, transformation(origin = {53, -43}, extent =
{{-5, -5}, {5, 5}}, rotation = 0)));
Modelica.Blocks.Interfaces.RealOutput VoidFraction annotation(
Placement(visible = true, transformation(origin = {110, -42}, extent =
{{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {110,
-42}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
ThermoPower.Examples.RankineCycle.Models.HE Economizer(
FFtype_G = ThermoPower.Choices.Flow1D.FFtypes.OpPoint,
FluidPhaseStart = ThermoPower.Choices.FluidPhase.FluidPhases.Liquid,
N_F = 6,
N_G = 6,
Tstart_G = 604.74,
Tstart_M = 573.15, counterCurrent = true,
exchSurface_F = 2.752,
exchSurface_G = 2.752,
extSurfaceTub = 5.504,
fluidNomFlowRate = 21.5,
fluidNomPressure = 8e+06,
fluidVol = 0.01376,
gamma_F = 3000,
gamma_G = 30,
gasNomFlowRate = 169.755,
gasNomPressure = 101325,
gasVol = 0.01376,
lambda = 19.8,
metalVol = 0.01376,
rhomcm = 8055 * 480,
rhonom_F(displayUnit = "kg/m3") = 997,
rhonom_G = 1) annotation(
Placement(visible = true, transformation(origin = {0, 30}, extent = {{-10,
-10}, {10, 10}}, rotation = 0)));
equation
connect(Economizer.gasOut, sensT_ExhaustOut_Econ.inlet) annotation(
Line(points = {{10, 30}, {44, 30}, {44, 30}, {44, 30}}, color = {159, 159,
223}));
connect(sensT_ExhaustIn_Econ.outlet, Economizer.gasIn) annotation(
Line(points = {{-44, 30}, {-10, 30}, {-10, 30}, {-10, 30}}, color = {159,
159, 223}));
connect(Economizer.waterOut, sensT_WaterOut_Econ.inlet) annotation(
Line(points = {{0, 20}, {0, 20}, {0, 6}, {0, 6}}, color = {0, 0, 255}));
connect(sensT_WaterIn_Econ.outlet, Economizer.waterIn) annotation(
Line(points = {{0, 54}, {0, 54}, {0, 40}, {0, 40}}, color = {0, 0, 255}));
connect(VoidFractionSensor.y, VoidFraction) annotation(
Line(points = {{58, -42}, {104, -42}, {104, -42}, {110, -42}}, color = {0,
0, 127}));
connect(Evaporator.voidFraction, VoidFractionSensor.u) annotation(
Line(points = {{10, -44}, {46, -44}, {46, -42}, {46, -42}}, color = {0, 0,
127}));
connect(sensT_ExhaustOut_Evap.outlet, Sink_FlueGas.flange) annotation(
Line(points = {{56, -70}, {70, -70}, {70, -70}, {84, -70}, {84, -70}, {84,
-70}}, color = {159, 159, 223}));
connect(Evaporator.gasOut, sensT_ExhaustOut_Evap.inlet) annotation(
Line(points = {{10, -50}, {26, -50}, {26, -70}, {44, -70}}, color = {159,
159, 223}));
connect(sensT_ExhaustOut_Econ.outlet, Evaporator.gasIn) annotation(
Line(points = {{56, 30}, {68, 30}, {68, -20}, {-50, -20}, {-50, -20},
{-70, -20}, {-70, -50}, {-10, -50}, {-10, -50}}, color = {159, 159,
223}));
connect(sensT_WaterOut_Econ.outlet, Evaporator.waterIn) annotation(
Line(points = {{0, -6}, {0, -40}}, color = {0, 0, 255}));
connect(Evaporator.waterOut, Sink_Steam.flange) annotation(
Line(points = {{0, -60}, {0, -90}}, color = {0, 0, 255}));
connect(Source_FlueGas.flange, sensT_ExhaustIn_Econ.inlet) annotation(
Line(points = {{-82, 30}, {-56, 30}}, color = {159, 159, 223}));
connect(Source_Steam.flange, sensT_WaterIn_Econ.inlet) annotation(
Line(points = {{0, 90}, {0, 66}}, color = {0, 0, 255}));
annotation(
uses(ThermoPower(version = "3.1"), Modelica(version = "3.2.3")));end
ThermoPower_HRSG_Econ_Evap;
This is one of the most common errors I receive when working with OpenModelica Software.
I already understand how this error is usually triggered, when system parameters are conflicting and disagree with one another.
I've already tried omitting system parameters that I've deemed not an necessity to my system however nothing seems to fix the error.
My system is already very simple to begin with. Currently, I'm working on a sub-assembly verification process in order to correctly build a working Rankine Power model. The sub assembly focuses on a (1) of (2) heat exchangers that would be used in a dual HX system incorporating a reheat process inbetween the High Pressure and Low Pressure turbines.
This sub assembly is trying to describe water coming from a pump at a condensed liquid state where it will travel through a heat exchanger "super heater" where it will change the state from a compressed liquid to a superheated vapor. This vapor will then be fed into the High Pressure turbine and return into a Pressure Sink.
I've already completed a hand calculated thermodynamic analysis of my system and know outlet temperatures and enthalpies. However, these outlet parameters are some of which I chose to remove for I felt I would let the system solve for them instead of telling it what it should calculate. Removing these values to solve the error did not work as well.
If you have any thoughts, advice or considerations please let me know! Below I've posted the code to what I have been working on. Thanks again!
CODE:
model HX_Pump_2_Superheater_2_HPTurbine
//Heat Exchanger - Steam entering HX (compressed liquid) --> Steam exiting
HX (super heated vapor)//
//Steam Turbine - High Pressure Turbine and is (1) of (2) in series with one
another. Exit pressure should be intermediate pressure level before being
reheated and directed towards Low Pressure Turbine//
ThermoPower.PowerPlants.HRSG.Components.HE HX(
FluidPhaseStart = ThermoPower.Choices.FluidPhase.FluidPhases.Liquid,
Tstartbar_G (displayUnit = "K") = 787.87,
dpnom_F(displayUnit = "Pa") = 0,
dpnom_G = 0,
exchSurface_F = 4.739,
exchSurface_G = 4.739,
extSurfaceTub = 9.479,
fluidNomFlowRate = 26.397,
fluidNomPressure = 8e+06,
fluidVol = 0.0296,
gasNomFlowRate = 169.755,
gasNomPressure = 101325,
gasVol = 0.0296,
lambda = 20,
metalVol = 5,
pstart_F = 8e+06,
pstart_G = 101325,
rhomcm = 1,
rhonom_F(displayUnit = "kg/m3") = 0.6,
rhonom_G(displayUnit = "kg/m3") = 0.33) annotation(
Placement(visible = true, transformation(origin = {-1.9984e-15, 14}, extent
= {{-20, -20}, {20, 20}}, rotation = 0)));
ThermoPower.Gas.SinkPressure sinkPressure1(
redeclare package Medium = ThermoPower.Media.FlueGas,
T = 106.86 + 273,
p0 = 101325) annotation(
Placement(visible = true, transformation(origin = {92, 14}, extent = {{-10,
-10}, {10, 10}}, rotation = 0)));
ThermoPower.Gas.SensT sensT1(
redeclare package Medium = ThermoPower.Media.FlueGas,
allowFlowReversal = false) annotation(
Placement(visible = true, transformation(origin = {-50, 18}, extent = {{-10,
-10}, {10, 10}}, rotation = 0)));
ThermoPower.Gas.SensT sensT2(
redeclare package Medium = ThermoPower.Media.FlueGas,
allowFlowReversal = false) annotation(
Placement(visible = true, transformation(origin = {50, 18}, extent = {{-10,
-10}, {10, 10}}, rotation = 0)));
ThermoPower.Water.SinkPressure sinkPressure2(
redeclare package Medium = ThermoPower.Water.StandardWater,
T = 165 + 273,
h = 2536.2092e5,
p0 = 7.0e5) annotation(
Placement(visible = true, transformation(origin = {92, -60}, extent = {{-10,
-10}, {10, 10}}, rotation = 0)));
ThermoPower.Water.SensT sensT3(
redeclare package Medium = ThermoPower.Water.StandardWater) annotation(
Placement(visible = true, transformation(origin = {4, 64}, extent = {{-10,
-10}, {10, 10}}, rotation = -90)));
ThermoPower.Water.SensT sensT4(
redeclare package Medium = ThermoPower.Water.StandardWater,
allowFlowReversal = false) annotation(
Placement(visible = true, transformation(origin = {4, -32}, extent = {{-10,
-10}, {10, 10}}, rotation = -90)));
inner ThermoPower.System system annotation(
Placement(visible = true, transformation(origin = {-90, 90}, extent = {{-10,
-10}, {10, 10}}, rotation = 0)));
ThermoPower.Gas.SourceMassFlow sourceMassFlow1(
redeclare package Medium = ThermoPower.Media.FlueGas,
T = 514 + 273,
p0 = 101325,
w0 = 169.755) annotation(
Placement(visible = true, transformation(origin = {-90, 14}, extent = {{-10,
-10}, {10, 10}}, rotation = 0)));
ThermoPower.Water.SourceMassFlow sourceMassFlow2(
redeclare package Medium = ThermoPower.Water.StandardWater,
T = 42.88 + 273,
h = 183.1e3,
p0 = 80e5,
use_T = true,
w0 = 26.397) annotation(
Placement(visible = true, transformation(origin = {2, 92}, extent = {{-10,
-10}, {10, 10}}, rotation = -90)));
ThermoPower.Water.SteamTurbineStodola steamTurbineStodola1(
Kt = 0.01328,
PRstart = 11.43,
explicitIsentropicEnthalpy = false,
pnom = 80.0e5,
pout(fixed = false),
w(fixed = false),
wnom = 26.397,
wstart = 26.397) annotation(
Placement(visible = true, transformation(origin = {12, -72}, extent = {{-14,
-14}, {14, 14}}, rotation = 0)));
equation
connect(sensT2.outlet, sinkPressure1.flange) annotation(
Line(points = {{56, 14}, {82, 14}}, color = {159, 159, 223}));
connect(steamTurbineStodola1.outlet, sinkPressure2.flange) annotation(
Line(points = {{24, -60}, {82, -60}, {82, -60}, {82, -60}}, color = {0, 0,
255}));
connect(sensT4.outlet, steamTurbineStodola1.inlet) annotation(
Line(points = {{0, -38}, {0, -38}, {0, -60}, {0, -60}}, color = {0, 0,
255}));
connect(HX.waterOut, sensT4.inlet) annotation(
Line(points = {{0, -6}, {0, -26}}, color = {0, 0, 255}));
connect(sourceMassFlow1.flange, sensT1.inlet) annotation(
Line(points = {{-80, 14}, {-56, 14}}, color = {159, 159, 223}));
connect(sensT3.outlet, HX.waterIn) annotation(
Line(points = {{0, 58}, {0, 58}, {0, 34}, {0, 34}}, color = {0, 0, 255}));
connect(sourceMassFlow2.flange, sensT3.inlet) annotation(
Line(points = {{0, 82}, {0, 70}}, color = {0, 0, 255}));
connect(HX.gasOut, sensT2.inlet) annotation(
Line(points = {{20, 14}, {44, 14}, {44, 14}, {44, 14}}, color = {159, 159,
223}));
connect(sensT1.outlet, HX.gasIn) annotation(
Line(points = {{-44, 14}, {-20, 14}, {-20, 14}, {-20, 14}}, color = {159,
159, 223}));
annotation(
uses(ThermoPower(version = "3.1"), Modelica(version = "3.2.3")));end
HX_Pump_2_Superheater_2_HPTurbine;
The error message in Dymola says:
The model HX_Pump_2_Superheater_2_HPTurbine is structurally singular.
The problem is structurally singular for the element type Real.
The number of scalar Real unknown elements are 93. The number of
scalar Real equation elements are 93.
The following variables are considered as unknowns, but are not
appearing in the equations. steamTurbineStodola1.phi
Part of the problem for Real elements is overdetermined. There are 1
scalar equations too many in the set:
...
The important part is that steamTurbineStodola1.phi does not appear in the equations. That is the angle of turbine shaft, and it indicates that the turbine-shaft is just "free floating".
Adding an inertia and connecting it to the shaft avoids that problem:
public
Modelica.Mechanics.Rotational.Components.Inertia inertia
annotation (Placement(transformation(extent={{28,-82},{48,-62}})));
equation
connect(steamTurbineStodola1.shaft_b, inertia.flange_a)
annotation (Line(points={{20.96,-72},{28,-72}}, color={0,0,0}));
but then there are other issues related to low pressure etc.
Obviously adding just an inertia with default inertia isn't the correct model - but I believe it indicates what to do.