From 51a2568bc1e71978c2887d9167292b1a7395ee73 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Fri, 16 May 2025 17:17:21 +0200 Subject: [PATCH 001/178] #125 Initial commit for MediumImplementation in ThermoSysPro --- .../SimpleExamples/TestAirHumidity.mo | 55 -- .../Fluid/Examples/SimpleExamples/TestBend.mo | 49 -- .../SimpleExamples/TestBoilerSystem.mo | 69 -- .../TestCHPEngineBarkantineSystem.mo | 49 -- .../SimpleExamples/TestCentrifugalPump1.mo | 86 --- .../Examples/SimpleExamples/TestCheckValve.mo | 101 --- .../SimpleExamples/TestCombustionTurbine.mo | 66 -- .../Examples/SimpleExamples/TestCompressor.mo | 61 -- .../Examples/SimpleExamples/TestDiaphragm.mo | 50 -- .../TestDiffusion_DynamicOnePhaseFlowPipe.mo | 140 ---- ...TestDiffusion_DynamicPlateHeatExchanger.mo | 62 -- .../TestDiffusion_DynamicTwoPhaseFlowPipe.mo | 187 ----- .../SimpleExamples/TestDiffusion_VolumeA.mo | 71 -- .../SimpleExamples/TestDynamicCheckValve.mo | 58 -- .../SimpleExamples/TestDynamicCondenser.mo | 119 --- .../SimpleExamples/TestDynamicDrum.mo | 183 ----- .../SimpleExamples/TestDynamicDrum_CC.mo | 190 ----- ...DynamicFlueGasesMultiFluidHeatExchanger.mo | 89 --- .../TestDynamicMultiFluidHeatExchanger.mo | 85 -- ...TestDynamicMultiFluidHeatExchangerShell.mo | 87 --- .../TestDynamicOnePhaseFlowPipe.mo | 62 -- .../TestDynamicOnePhaseFlowShell.mo | 80 -- .../TestDynamicPlateHeatExchanger.mo | 89 --- .../SimpleExamples/TestDynamicReliefValve.mo | 103 --- .../TestDynamicTwoPhaseFlowPipe.mo | 120 --- .../TestDynamicTwoPhaseFlowRiser.mo | 79 -- .../SimpleExamples/TestDynamicWaterHeating.mo | 306 -------- .../TestDynamicWaterHeatingOnePipe.mo | 298 ------- ...ynamicWaterSteamMultiFluidHeatExchanger.mo | 84 -- .../TestFixedPowerHeatExchanger.mo | 53 -- .../SimpleExamples/TestFossilFuelBoiler.mo | 82 -- .../SimpleExamples/TestFresnelField.mo | 172 ----- .../SimpleExamples/TestGTCombustionChamber.mo | 83 -- .../Examples/SimpleExamples/TestGasTurbine.mo | 105 --- .../SimpleExamples/TestGenericCombustion.mo | 86 --- .../SimpleExamples/TestGenericCombustion1D.mo | 144 ---- .../SimpleExamples/TestGridFurnace.mo | 90 --- .../SimpleExamples/TestHeatPumpCompressor.mo | 53 -- .../SimpleExamples/TestIdealCheckValve.mo | 111 --- .../SimpleExamples/TestIdealSwitchValve.mo | 65 -- .../TestInternalCombustionEngine.mo | 113 --- .../TestInvSingularPressureLoss.mo | 38 - .../Examples/SimpleExamples/TestJunctions1.mo | 115 --- .../Examples/SimpleExamples/TestJunctions2.mo | 131 ---- .../Examples/SimpleExamples/TestJunctions3.mo | 121 --- .../Examples/SimpleExamples/TestJunctions4.mo | 59 -- .../SimpleExamples/TestLoopBreaker.mo | 73 -- .../SimpleExamples/TestMassFlowMultiplier.mo | 47 -- .../SimpleExamples/TestNTUWaterHeater0.mo | 105 --- .../SimpleExamples/TestPostCombustionGas.mo | 93 --- .../SimpleExamples/TestPressurizer.mo | 149 ---- .../Fluid/Examples/SimpleExamples/TestRefP.mo | 62 -- .../Examples/SimpleExamples/TestRefP1.mo | 56 -- .../Examples/SimpleExamples/TestSensors.mo | 61 -- .../TestSimpleDynamicCondenser.mo | 122 --- .../TestSimpleDynamicCondenser1.mo | 95 --- ...TestSimpleEvaporatorWaterSteamFlueGases.mo | 71 -- .../TestSimpleStaticCondenser.mo | 53 -- .../TestSingularPressureLoss.mo | 51 -- .../SimpleExamples/TestStaticAerocondenser.mo | 97 --- .../TestStaticCentrifugalPump1.mo | 52 -- .../SimpleExamples/TestStaticCondenser.mo | 123 --- .../SimpleExamples/TestStaticCondenserHEI.mo | 126 --- .../SimpleExamples/TestStaticDrum1.mo | 92 --- .../SimpleExamples/TestStaticDrum2.mo | 77 -- .../TestStaticExchangerDTorWorEff.mo | 63 -- .../SimpleExamples/TestStaticExchangerKS.mo | 53 -- .../Examples/SimpleExamples/TestStaticFan.mo | 223 ------ .../TestStaticPlateHeatExchanger.mo | 55 -- .../TestStaticWallFlueGasesExchanger.mo | 68 -- .../SimpleExamples/TestSteamDryer1.mo | 62 -- .../SimpleExamples/TestSteamDryer2.mo | 62 -- .../SimpleExamples/TestSteamEngine.mo | 51 -- .../TestSteamExtractionSplitter.mo | 61 -- .../SimpleExamples/TestStodolaTurbine1.mo | 92 --- .../SimpleExamples/TestStodolaTurbine2.mo | 53 -- .../SimpleExamples/TestSwitchValve.mo | 67 -- .../Fluid/Examples/SimpleExamples/TestTank.mo | 67 -- .../SimpleExamples/TestTankHorizontal.mo | 69 -- .../SimpleExamples/TestThreeWayValve.mo | 64 -- .../SimpleExamples/TestTwoPhaseCavity.mo | 116 --- .../TestTwoPhaseCavityOnePipe.mo | 122 --- .../SimpleExamples/TestTwoPhaseVolume.mo | 116 --- .../Examples/SimpleExamples/TestVolumeA.mo | 112 --- .../Examples/SimpleExamples/TestVolumeA1.mo | 78 -- .../Examples/SimpleExamples/TestVolumeI.mo | 111 --- .../Examples/SimpleExamples/package.order | 86 --- .../Fluid/Interfaces/Connectors/FluidInlet.mo | 17 +- .../Interfaces/Connectors/FluidOutlet.mo | 17 +- .../DryAirIdealGas/DryAirIdealGas.mo | 2 +- .../Properties/FlueGases/FlueGases_h.mo | 2 +- .../Properties/FlueGases/FlueGases_h_Ps.mo | 2 +- .../Properties/FlueGases/FlueGases_s.mo | 2 +- ThermoSysPro/Properties/FlueGases/XSat.mo | 2 +- ThermoSysPro/Properties/Fluid/Density_Ph.mo | 2 +- .../Properties/Fluid/Density_derh_Ph.mo | 2 +- .../Properties/Fluid/Density_derp_Ph.mo | 2 +- .../Properties/Fluid/DynamicViscosity_Ph.mo | 2 +- ThermoSysPro/Properties/Fluid/Prandtl_Ph.mo | 2 +- .../Properties/Fluid/Reynolds_PhvD.mo | 2 +- .../Fluid/SpecificHeatCapacityCp_PT.mo | 2 +- .../Fluid/SpecificHeatCapacityCp_Ph.mo | 2 +- .../SpecificInternalEnergy_Ph_DO_NOT_USE.mo | 2 +- .../Properties/Fluid/Temperature_Ph.mo | 2 +- .../Fluid/ThermalConductivity_Ph.mo | 2 +- .../Properties/Fluid/derDensity_derP_derh.mo | 2 +- .../Fluid/derDensity_derh_derP_derh.mo | 2 +- .../Fluid/derDynamicViscosity_derP_derh.mo | 2 +- .../derDynamicViscosity_derP_derh_old.mo | 2 +- .../Fluid/derDynamicViscosity_derT_derrho.mo | 2 +- .../Fluid/derSpecificEnthalpy_derP_derT.mo | 2 +- .../Fluid/derTemperature_derP_derh.mo | 2 +- .../Fluid/derderDensity_derderP_derderh.mo | 2 +- .../derderDensity_derh_derderP_derderh.mo | 2 +- .../derderTemperature_derderP_derderh.mo | 2 +- .../Media/PartialSubCMedium/C_BiPhase.mo | 6 + .../HomogeneousPhasesSeparation.mo | 18 + .../Media/PartialSubCMedium/noSaS.mo | 6 + .../Media/PartialSubCMedium/package.mo | 5 + .../Media/PartialSubCMedium/package.order | 6 + .../partialPhasesSeparation.mo | 64 ++ .../Media/PartialSubCMedium/partialSaS.mo | 5 + .../PartialThermoSysProMedium/package.mo | 5 + .../PartialThermoSysProMedium/package.order | 0 .../package.mo | 5 + .../package.order | 0 .../Properties/Media/WaterSteam/package.mo | 730 ++++++++++++++++++ .../Properties/Media/WaterSteam/package.order | 53 ++ ThermoSysPro/Properties/Media/package.mo | 115 +++ ThermoSysPro/Properties/Media/package.order | 4 + .../MoltenSalt/DynamicViscosity_T.mo | 2 +- .../MoltenSalt/ThermalConductivity_T.mo | 2 +- .../ThermoPropertiesFunction_T_2.mo | 2 +- .../Oil_TherminolVP1/TherminolVP1_Data.mo | 2 +- .../WaterSolution/MassFraction_eq_PT.mo | 2 +- .../WaterSolution/Pressure_eq_TX.mo | 2 +- .../Properties/WaterSteam/BaseIF97.mo | 2 +- ThermoSysPro/Properties/WaterSteam/Common.mo | 2 +- .../Properties/WaterSteam/IF97_packages.mo | 4 +- .../SimpleWater/SpecificEnthalpy_PT_der.mo | 2 +- .../SimpleWater/Water_Ph_der.mo | 2 +- ThermoSysPro/Properties/package.order | 1 + 142 files changed, 1075 insertions(+), 8213 deletions(-) delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestAirHumidity.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestBend.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestBoilerSystem.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestCHPEngineBarkantineSystem.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestCentrifugalPump1.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestCheckValve.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestCombustionTurbine.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestCompressor.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestDiaphragm.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestDiffusion_DynamicOnePhaseFlowPipe.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestDiffusion_DynamicPlateHeatExchanger.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestDiffusion_DynamicTwoPhaseFlowPipe.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestDiffusion_VolumeA.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestDynamicCheckValve.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestDynamicCondenser.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestDynamicDrum.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestDynamicDrum_CC.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestDynamicFlueGasesMultiFluidHeatExchanger.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestDynamicMultiFluidHeatExchanger.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestDynamicMultiFluidHeatExchangerShell.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestDynamicOnePhaseFlowPipe.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestDynamicOnePhaseFlowShell.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestDynamicPlateHeatExchanger.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestDynamicReliefValve.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestDynamicTwoPhaseFlowPipe.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestDynamicTwoPhaseFlowRiser.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestDynamicWaterHeating.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestDynamicWaterHeatingOnePipe.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestDynamicWaterSteamMultiFluidHeatExchanger.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestFixedPowerHeatExchanger.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestFossilFuelBoiler.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestFresnelField.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestGTCombustionChamber.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestGasTurbine.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestGenericCombustion.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestGenericCombustion1D.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestGridFurnace.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestHeatPumpCompressor.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestIdealCheckValve.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestIdealSwitchValve.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestInternalCombustionEngine.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestInvSingularPressureLoss.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestJunctions1.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestJunctions2.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestJunctions3.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestJunctions4.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestLoopBreaker.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestMassFlowMultiplier.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestNTUWaterHeater0.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestPostCombustionGas.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestPressurizer.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestRefP.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestRefP1.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestSensors.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestSimpleDynamicCondenser.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestSimpleDynamicCondenser1.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestSimpleEvaporatorWaterSteamFlueGases.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestSimpleStaticCondenser.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestSingularPressureLoss.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestStaticAerocondenser.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestStaticCentrifugalPump1.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestStaticCondenser.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestStaticCondenserHEI.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestStaticDrum1.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestStaticDrum2.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestStaticExchangerDTorWorEff.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestStaticExchangerKS.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestStaticFan.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestStaticPlateHeatExchanger.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestStaticWallFlueGasesExchanger.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestSteamDryer1.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestSteamDryer2.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestSteamEngine.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestSteamExtractionSplitter.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestStodolaTurbine1.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestStodolaTurbine2.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestSwitchValve.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestTank.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestTankHorizontal.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestThreeWayValve.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestTwoPhaseCavity.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestTwoPhaseCavityOnePipe.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestTwoPhaseVolume.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestVolumeA.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestVolumeA1.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/TestVolumeI.mo create mode 100644 ThermoSysPro/Properties/Media/PartialSubCMedium/C_BiPhase.mo create mode 100644 ThermoSysPro/Properties/Media/PartialSubCMedium/HomogeneousPhasesSeparation.mo create mode 100644 ThermoSysPro/Properties/Media/PartialSubCMedium/noSaS.mo create mode 100644 ThermoSysPro/Properties/Media/PartialSubCMedium/package.mo create mode 100644 ThermoSysPro/Properties/Media/PartialSubCMedium/package.order create mode 100644 ThermoSysPro/Properties/Media/PartialSubCMedium/partialPhasesSeparation.mo create mode 100644 ThermoSysPro/Properties/Media/PartialSubCMedium/partialSaS.mo create mode 100644 ThermoSysPro/Properties/Media/PartialThermoSysProMedium/package.mo create mode 100644 ThermoSysPro/Properties/Media/PartialThermoSysProMedium/package.order create mode 100644 ThermoSysPro/Properties/Media/PartialTwoPhaseThermoSysProMedium/package.mo create mode 100644 ThermoSysPro/Properties/Media/PartialTwoPhaseThermoSysProMedium/package.order create mode 100644 ThermoSysPro/Properties/Media/WaterSteam/package.mo create mode 100644 ThermoSysPro/Properties/Media/WaterSteam/package.order create mode 100644 ThermoSysPro/Properties/Media/package.mo create mode 100644 ThermoSysPro/Properties/Media/package.order diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestAirHumidity.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestAirHumidity.mo deleted file mode 100644 index 8798a071..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestAirHumidity.mo +++ /dev/null @@ -1,55 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestAirHumidity - - ThermoSysPro.Fluid.BoundaryConditions.AirHumidity airHumidity(hum0=0.9, - ppvap0(start=2085.0), - rho_air(start=1.14), - rho_vap(start=0.015)) - annotation (Placement(transformation(extent={{-10,0},{10,20}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss(K=1.e-5, rho(start=1.17)) - annotation (Placement(transformation(extent={{40,0},{ - 60,20}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.Sink sinkFlueGases - annotation (Placement(transformation(extent={{80,0},{100,20}},rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourceFlueGasesPQ( - option_temperature=true, - Xco2=0, - Xh2o=0.0132625, - Xo2=0.217282, - ftype=ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType.FlueGases, - P0=100000, - T0=293) annotation (Placement(transformation(extent={{-80,0},{-60,20}}, - rotation=0))); - -equation - connect(airHumidity.C2, singularPressureLoss.C1) - annotation (Line(points={{10,10},{40,10}}, color={0,0,0})); - connect(singularPressureLoss.C2, sinkFlueGases.C) - annotation (Line(points={{60,10},{80,10}}, color={0,0,0})); - connect(sourceFlueGasesPQ.C, airHumidity.C1) - annotation (Line(points={{-60,10},{-10,10}}, color={0,0,0})); - annotation (experiment(StopTime=1000), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestAirHumidity; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestBend.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestBend.mo deleted file mode 100644 index ed5108df..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestBend.mo +++ /dev/null @@ -1,49 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestBend - - ThermoSysPro.Fluid.BoundaryConditions.SourceP SourceP1 - annotation (Placement(transformation(extent={{-100,26},{-80,46}}, rotation= - 0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP SinkP1 - annotation (Placement(transformation( - extent={{60,0},{80,20}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.Bend Bend annotation (Placement( - transformation(extent={{-20,26},{0,46}}, rotation=0))); -equation - connect(Bend.C2, SinkP1.C) - annotation (Line(points={{-10,26},{-10,10},{60,10}}, color={0,0,255})); - connect(SourceP1.C, Bend.C1) - annotation (Line(points={{-80,36},{-20,36}}, color={0,0,255})); - annotation (experiment(StopTime=1000), - Window( - x=0.45, - y=0.01, - width=0.35, - height=0.49), - Diagram(coordinateSystem( - preserveAspectRatio=false, - extent={{-100,-100},{100,100}}, - grid={2,2}), graphics), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestBend; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestBoilerSystem.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestBoilerSystem.mo deleted file mode 100644 index 25ed08f0..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestBoilerSystem.mo +++ /dev/null @@ -1,69 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestBoilerSystem - import ThermoSysPro; - ThermoSysPro.Fluid.Boilers.BoilerSystem BoilerSystem( - Wloss=0, - Ke=1.e6, - Tsf=386.16) - annotation (Placement(transformation(extent={{-45,-51},{45,51}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ( - Xco2=0, - Xh2o=0.01, - Q0=27., - Xo2=0.233, - ftype=ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType.FlueGases, - T0=298.16, - option_temperature=true) - annotation (Placement(transformation(extent={{-102,-92},{-63,-55}}, - rotation=0))); - - ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP annotation (Placement(transformation( - extent={{-56,51},{-98,90}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ( - Q0=24., - h0=600e3, - P0=14000000) - annotation (Placement(transformation(extent={{105,-88},{69,-54}}, rotation= - 0))); - ThermoSysPro.Fluid.BoundaryConditions.Sink sink annotation (Placement(transformation( - extent={{70,53},{106,89}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss(K=1e-3) - annotation (Placement(transformation(extent={{60,-77},{52,-65}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss1(K=1e-3) - annotation (Placement(transformation(extent={{53,65},{61,77}}, rotation=0))); -equation - connect(singularPressureLoss1.C2, sink.C) - annotation (Line(points={{61,71},{70,71}}, color={0,0,255})); - connect(BoilerSystem.OutletWaterSteam, singularPressureLoss1.C1) annotation ( - Line(points={{38.5714,51},{38.5714,71},{53,71}}, color={0,0,0})); - connect(BoilerSystem.InletWaterSteam, singularPressureLoss.C2) annotation ( - Line(points={{38.5714,-51},{38.5714,-71},{52,-71}}, color={0,0,0})); - connect(singularPressureLoss.C1, sourcePQ.C) annotation (Line(points={{60,-71}, - {66,-71},{66,-71},{69,-71}}, color={0,0,0})); - connect(sinkP.C, BoilerSystem.OutletFlueGases) annotation (Line(points={{-56, - 70.5},{-38.5714,70.5},{-38.5714,51}}, color={0,0,0})); - connect(sourceQ.C, BoilerSystem.InletFlueGases) annotation (Line(points={{-63, - -73.5},{-38.5714,-73.5},{-38.5714,-51}}, color={0,0,0})); - annotation ( Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestBoilerSystem; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestCHPEngineBarkantineSystem.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestCHPEngineBarkantineSystem.mo deleted file mode 100644 index def6128b..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestCHPEngineBarkantineSystem.mo +++ /dev/null @@ -1,49 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestCHPEngineBarkantineSystem - - ThermoSysPro.Fluid.BoundaryConditions.SourceP SourceP1 - annotation (Placement(transformation(extent={{-100,20},{-80,40}}, rotation= - 0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP PuitsP1 - annotation (Placement(transformation( - extent={{60,20},{80,40}}, rotation=0))); - Machines.CHPEngineBarkantineSystem CHPBarkantine annotation (Placement( - transformation(extent={{-40,0},{20,60}}, rotation=0))); -equation - connect(SourceP1.C, CHPBarkantine.inletWaterSteam) annotation (Line(points={{ - -80,30},{-50,30},{-50,45},{-40,45}}, color={0,0,0})); - connect(CHPBarkantine.outletWaterSteam, PuitsP1.C) - annotation (Line(points={{20,45},{30,45},{30,30},{60,30}}, color={0,0,0})); - annotation (experiment(StopTime=1000), - Window( - x=0.45, - y=0.01, - width=0.35, - height=0.49), - Diagram(coordinateSystem( - preserveAspectRatio=false, - extent={{-100,-100},{100,100}}, - grid={2,2})), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestCHPEngineBarkantineSystem; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestCentrifugalPump1.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestCentrifugalPump1.mo deleted file mode 100644 index 7d3302cc..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestCentrifugalPump1.mo +++ /dev/null @@ -1,86 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestCentrifugalPump1 - - ThermoSysPro.Fluid.Machines.CentrifugalPump centrifugalPump( - mode_car=1, - mode_car_hn=1, - mode_car_Cr=1, - dynamic_mech_equation=false) - annotation (Placement(transformation(extent={{-20,20},{0, - 40}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(Q0=0) - annotation (Placement(transformation(extent={{-80,20},{-60,40}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.Sink sink - annotation (Placement(transformation(extent={{40,20},{60,40}}, rotation=0))); - ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Rampe rampe( - Starttime=10, - Duration=100, - Initialvalue=1400, - Finalvalue=0) annotation (Placement(transformation(extent={{-100,-20},{-80, - 0}}, rotation=0))); - ThermoSysPro.ElectroMechanics.BoundaryConditions.SourceAngularVelocity - sourceAngularVelocity annotation (Placement(transformation(extent={{-60,-20}, - {-40,0}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ1( Q0=0) - annotation (Placement(transformation(extent={{-80,-60},{-60,-40}}, rotation= - 0))); - ThermoSysPro.Fluid.Machines.CentrifugalPump centrifugalPump1( - mode_car=1, - mode_car_hn=1, - mode_car_Cr=1) annotation (Placement(transformation(extent={{-20,-60},{0, - -40}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.Sink sink1 - annotation (Placement(transformation(extent={{40,-60},{60,-40}}, rotation=0))); -equation - connect(sourcePQ.C, centrifugalPump.C1) - annotation (Line(points={{-60,30},{-20,30}}, color={0,0,255})); - connect(centrifugalPump.C2, sink.C) - annotation (Line(points={{0,30},{40,30}}, color={0,0,255})); - connect(sourceAngularVelocity.M, centrifugalPump.M) - annotation (Line(points={{-39,-10},{-10,-10},{-10,19}})); - connect(sourcePQ1.C, centrifugalPump1.C1) - annotation (Line(points={{-60,-50},{-20,-50}}, color={0,0,255})); - connect(centrifugalPump1.C2, sink1.C) - annotation (Line(points={{0,-50},{40,-50}}, color={0,0,255})); - connect(rampe.y, sourceAngularVelocity.IAngularVelocity) - annotation (Line(points={{-79,-10},{-55,-10}})); - annotation (experiment(StopTime=1000), - Diagram(graphics={ - Text( - extent={{-100,100},{-60,80}}, - lineColor={0,0,255}, - textString= - "w=1 ==> w=0"), - Text( - extent={{-100,80},{-60,60}}, - lineColor={0,0,255}, - textString= - "q=0"), - Text( - extent={{-100,60},{-60,40}}, - lineColor={0,0,255}, - textString= - "theta=0 ==> theta=-180")}), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestCentrifugalPump1; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestCheckValve.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestCheckValve.mo deleted file mode 100644 index f6c47b31..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestCheckValve.mo +++ /dev/null @@ -1,101 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestCheckValve - - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP - annotation (Placement(transformation(extent= - {{-104,20},{-84,40}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP puitsP( - P0=6e5) annotation (Placement(transformation( - extent={{84,20},{104,40}}, rotation=0))); - ThermoSysPro.Fluid.Machines.StaticCentrifugalPump staticCentrifugalPump1 - annotation (Placement(transformation(extent={{-30,60},{-10,80}}, rotation=0))); - ThermoSysPro.Fluid.Machines.StaticCentrifugalPump staticCentrifugalPump2 - annotation (Placement(transformation(extent={{-30,-20},{-10,0}}, rotation=0))); - ThermoSysPro.Fluid.Volumes.VolumeD volumeD annotation (Placement( - transformation(extent={{-50,20},{-30,40}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.CheckValve checkValve1 - annotation (Placement(transformation(extent={{10,60},{30,80}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.CheckValve checkValve2 - annotation (Placement(transformation(extent={{8,-20},{28,0}}, rotation=0))); - ThermoSysPro.Fluid.Volumes.VolumeC volumeC annotation (Placement( - transformation(extent={{30,20},{50,40}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe perteDP - annotation (Placement(transformation( - extent={{-80,20},{-60,40}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe perteDP1 - annotation (Placement(transformation( - extent={{60,20},{80,40}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP1 - annotation (Placement(transformation( - extent={{-60,-80},{-40,-60}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP puitsP1( - P0=6e5) annotation (Placement(transformation( - extent={{20,-80},{40,-60}}, rotation=0))); - ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Pulse pulse( - amplitude=6e5, - width=50, - period=100, - offset=3e5) annotation (Placement(transformation(extent={{-100,-80},{-80, - -60}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.CheckValve checkValve3 - annotation (Placement(transformation(extent={{-20,-80},{0,-60}}, rotation=0))); -equation - connect(staticCentrifugalPump1.C2, checkValve1.C1) annotation (Line(points={{-10,70}, - {9,70}}, color={0,0,255})); - connect(staticCentrifugalPump2.C2, checkValve2.C1) annotation (Line(points={{ - -10,-10},{0,-10},{0,-10},{7,-10}}, color={0,0,255})); - connect(perteDP1.C2, puitsP.C) - annotation (Line(points={{80,30},{84,30}}, color={0,0,255})); - connect(sourceP.C, perteDP.C1) - annotation (Line(points={{-84,30},{-80,30}}, color={0,0,255})); - connect(sourceP1.C, checkValve3.C1) - annotation (Line(points={{-40,-70},{-21,-70}}, color={0,0,255})); - connect(checkValve3.C2, puitsP1.C) - annotation (Line(points={{1,-70},{20,-70}}, color={0,0,255})); - connect(pulse.y, sourceP1.IPressure) annotation (Line(points={{-79,-70},{-55, - -70}})); - connect(volumeD.Cs1, staticCentrifugalPump1.C1) - annotation (Line(points={{-40,40},{-40,70},{-30,70}}, color={0,0,0})); - connect(volumeD.Cs2, staticCentrifugalPump2.C1) - annotation (Line(points={{-40,20},{-40,-10},{-30,-10}}, color={0,0,0})); - connect(checkValve1.C2, volumeC.Ce2) - annotation (Line(points={{31,70},{40,70},{40,40}}, color={0,0,0})); - connect(checkValve2.C2, volumeC.Ce3) - annotation (Line(points={{29,-10},{40,-10},{40,20}}, color={0,0,0})); - connect(volumeC.Cs, perteDP1.C1) - annotation (Line(points={{50,30},{60,30}}, color={0,0,0})); - connect(perteDP.C2, volumeD.Ce) - annotation (Line(points={{-60,30},{-50,30}}, color={0,0,0})); - annotation (experiment(StopTime=1000), - Diagram(coordinateSystem( - preserveAspectRatio=false, - extent={{-100,-100},{100,100}}, - grid={2,2})), - Window( - x=0.28, - y=0.03, - width=0.5, - height=0.6), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestCheckValve; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestCombustionTurbine.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestCombustionTurbine.mo deleted file mode 100644 index 3472fb86..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestCombustionTurbine.mo +++ /dev/null @@ -1,66 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestCombustionTurbine - parameter Real is_eff_n1(fixed=false,start=0.85) "Nominal isentropic efficiency"; - parameter Real Qred1(fixed=false,start=0.01) "Reduced mass flow rate"; - - ThermoSysPro.Fluid.Machines.CombustionTurbine CombustionTurbine( - tau_n=0.065, - is_eff_n=is_eff_n1, - Qred=Qred1, - Pe(fixed=true, start=1500000), - Ts(fixed=true, start=830)) annotation (Placement(transformation(extent={{ - -42,-42},{36,42}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceQ SourceQ1( - Xso2=0, - Q0=430, - Xco2=0.06, - Xh2o=0.06, - Xo2=0.14, - ftype=ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType.FlueGases, - T0=1500, - option_temperature=true) - annotation (Placement(transformation(extent={{-106,-10},{-86,10}}, - rotation=0))); - - ThermoSysPro.Fluid.BoundaryConditions.SinkP SinkP1(P0=1e5) - annotation (Placement(transformation( - origin={94,0}, - extent={{10,-10},{-10,10}}, - rotation=180))); - ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Constante Wc1(k=-1.8e8) - annotation (Placement(transformation(extent={{-100,-42},{-80,-22}}, - rotation=0))); -equation - connect(SourceQ1.C, CombustionTurbine.Ce) annotation (Line( - points={{-86,0},{-42,0}}, - color={0,0,0}, - thickness=1)); - connect(CombustionTurbine.Cs, SinkP1.C) annotation (Line( - points={{36,0},{84,0}}, - color={0,0,0}, - thickness=1)); - connect(Wc1.y, CombustionTurbine.CompressorPower) - annotation (Line(points={{-79,-32},{-45.9,-32},{-45.9,-16.8}})); - annotation (Diagram(graphics), Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestCombustionTurbine; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestCompressor.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestCompressor.mo deleted file mode 100644 index 79b7b6f8..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestCompressor.mo +++ /dev/null @@ -1,61 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestCompressor - parameter Real is_eff_n1(fixed=false,start=0.85) "Nominal isentropic efficiency"; - - ThermoSysPro.Fluid.Machines.Compressor Compressor( - Ps(fixed=false), - tau_n=16, - is_eff_n=is_eff_n1, - Pe(fixed=false, start=100000), - Ts(fixed=true, start=680)) annotation (Placement(transformation(extent={{ - -52,-52},{48,52}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ SourceQ1( - Xso2=0, - Xco2=0.0, - Xh2o=0.003, - Xo2=0.23, - Q0=420, - ftype=ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType.FlueGases, - P0=100000, - T0=288, - option_temperature=true) - annotation (Placement(transformation(extent={{-104,-10},{-84,10}}, - rotation=0))); - - ThermoSysPro.Fluid.BoundaryConditions.SinkP SinkP1(P0=15.8e5) - annotation (Placement(transformation( - origin={96,0}, - extent={{10,-10},{-10,10}}, - rotation=180))); -equation - connect(SourceQ1.C, Compressor.Ce) annotation (Line( - points={{-84,0},{-39.5,0}}, - color={0,0,0}, - thickness=1)); - connect(Compressor.Cs, SinkP1.C) annotation (Line( - points={{35.5,0},{86,0}}, - color={0,0,0}, - thickness=1)); - annotation (Diagram(graphics), Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestCompressor; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestDiaphragm.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestDiaphragm.mo deleted file mode 100644 index 94163735..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestDiaphragm.mo +++ /dev/null @@ -1,50 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestDiaphragm - - ThermoSysPro.Fluid.BoundaryConditions.SourceP SourceP1 - annotation (Placement(transformation(extent={{-64,-10},{-44,10}},rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP PuitsP1 - annotation (Placement(transformation( - extent={{44,-10},{64,10}},rotation=0))); - ThermoSysPro.Fluid.PressureLosses.Diaphragm Diaphragm - annotation (Placement(transformation( - extent={{-10,-10},{10,10}}, - rotation=0))); -equation - connect(Diaphragm.C2, PuitsP1.C) - annotation (Line(points={{10,0},{44,0}}, color={0,0,255})); - connect(SourceP1.C, Diaphragm.C1) - annotation (Line(points={{-44,0},{-10,0}}, color={0,0,255})); - annotation (experiment(StopTime=1000), - Window( - x=0.45, - y=0.01, - width=0.35, - height=0.49), - Diagram(coordinateSystem( - preserveAspectRatio=false, - extent={{-100,-100},{100,100}}, - grid={2,2}), graphics), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestDiaphragm; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestDiffusion_DynamicOnePhaseFlowPipe.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestDiffusion_DynamicOnePhaseFlowPipe.mo deleted file mode 100644 index f7e59a50..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestDiffusion_DynamicOnePhaseFlowPipe.mo +++ /dev/null @@ -1,140 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestDiffusion_DynamicOnePhaseFlowPipe - - HeatExchangers.DynamicOnePhaseFlowPipe - dynamicOnePhaseFlowPipe(L=20, - Q(start={5.492026593727256E-28,5.492026607285849E-28,5.492026607285849E-28, - 5.492026607285849E-28,5.492026607285849E-28,5.492026607285849E-28, - 5.492026607285849E-28,5.492026607285849E-28,5.492026607285849E-28, - 5.492026607285849E-28,5.492026607285849E-28}), - h(start={84011.8111671368,96057.08454715868,107718.52365349933, - 119295.22918923412,130792.44987567255,142215.00322033433, - 153567.34130353143,164853.6027022597,176077.65400298327, - 187243.1234252416,198353.42841254506,209411.79856705698}), - continuous_flow_reversal=true, - inertia=false, - dynamic_mass_balance=false, - advection=true, - dynamic_energy_balance=false, - diffusion=true, - P(start={99999.999999976,99999.999999978,99999.999999981,99999.999999983, - 99999.999999985,99999.999999988,99999.99999999,99999.999999992,100000, - 100000,100000,100000})) - annotation (Placement(transformation(extent={{-10,30}, - {10,50}}, rotation=0))); - BoundaryConditions.SourceP sourceP( - continuous_flow_reversal=true, - diffusion=true, - P0=100000, - T0=293.15) - annotation (Placement(transformation(extent={{-80,30},{-60,50}}, rotation=0))); - - BoundaryConditions.SinkP sinkP(diffusion=true, - T0=323.15) - annotation (Placement(transformation(extent={{30,30},{50,50}}, rotation=0))); - Thermal.BoundaryConditions.HeatSource heatSource( - option_temperature=2, - T0={1000,1100,1200,1300,1400,1500,1600,1700,1800,1900}, - W0={0,0,0,0,0,0,0,0,0,0}) - annotation (Placement(transformation(extent={{-10,70},{10,90}},rotation=0))); - Thermal.HeatTransfer.HeatExchangerWall heatExchangerWall(Ns=10, - dynamic_energy_balance=false) - annotation (Placement(transformation(extent={{-10,50},{10,70}},rotation=0))); - PressureLosses.SwitchValve switchValve(Qmin=0) - annotation (Placement(transformation(extent={{-40,36},{-20,56}}))); - InstrumentationAndControl.Blocks.Logique.Echelon echelon(startTime=1) - annotation (Placement(transformation(extent={{-74,66},{-66,74}}))); - InstrumentationAndControl.Blocks.Logique.NONL nONL - annotation (Placement(transformation(extent={{-54,66},{-46,74}}))); - HeatExchangers.DynamicOnePhaseFlowPipe - dynamicOnePhaseFlowPipe1( - L=20, - Q(start={4.9243335191367076E-05,4.924351014778949E-05,4.924351014778949E-05, - 4.924351014778949E-05,4.924351014778949E-05,4.924351014778949E-05, - 4.924351014778949E-05,4.924351014778949E-05,4.924351014778949E-05, - 4.924351014778949E-05,4.924351014778949E-05}), - h(start={84011.8111671368,95792.53373784182,107482.21110144592, - 119086.65906940492,130611.17116650468,142060.60442474802, - 153439.44619534744,164751.8668430315,176001.7618457063, - 187192.78587129858,198328.3807233511,209411.79856705698}), - continuous_flow_reversal=true, - inertia=false, - dynamic_mass_balance=false, - advection=true, - dynamic_energy_balance=false, - diffusion=true, - P(start={99999.999999976,99999.999999978,99999.999999981,99999.999999983, - 99999.999999985,99999.999999988,99999.99999999,99999.999999992,100000, - 100000,100000,100000})) - annotation (Placement(transformation(extent={{-10,-70}, - {10,-50}}, rotation=0))); - BoundaryConditions.SourceQ sourceP1( - continuous_flow_reversal=true, - diffusion=true, - Q0=0, - T0=293.15, - option_temperature=true) - annotation (Placement(transformation(extent={{-80,-70},{-60,-50}}, - rotation=0))); - BoundaryConditions.SinkP sinkP1( - diffusion=true, - T0=323.15) - annotation (Placement(transformation(extent={{30,-70},{50,-50}}, - rotation=0))); - Thermal.BoundaryConditions.HeatSource heatSource1( - option_temperature=2, - T0={1000,1100,1200,1300,1400,1500,1600,1700,1800,1900}, - W0={0,0,0,0,0,0,0,0,0,0}) - annotation (Placement(transformation(extent={{-10,-30},{10,-10}}, - rotation=0))); - Thermal.HeatTransfer.HeatExchangerWall heatExchangerWall1( - Ns=10, - dynamic_energy_balance=false) - annotation (Placement(transformation(extent={{-10,-50},{10,-30}}, - rotation=0))); -equation - connect(dynamicOnePhaseFlowPipe.C2,sinkP. C) annotation (Line(points={{10,40}, - {30,40}}, color={0,0,255})); - connect(heatSource.C,heatExchangerWall. WT2) annotation (Line(points={{0,70.2}, - {0,62}}, color={191,95,0})); - connect(sourceP.C, switchValve.C1) - annotation (Line(points={{-60,40},{-40,40}}, color={0,0,0})); - connect(switchValve.C2,dynamicOnePhaseFlowPipe. C1) - annotation (Line(points={{-20,40},{-10,40}}, color={0,0,0})); - connect(echelon.yL, nONL.uL) - annotation (Line(points={{-65.6,70},{-54.4,70}}, color={0,0,255})); - connect(nONL.yL, switchValve.Ouv) annotation (Line(points={{-45.6,70},{-30,70}, - {-30,53.2}}, color={0,0,255})); - connect(heatExchangerWall.WT1,dynamicOnePhaseFlowPipe. CTh) - annotation (Line(points={{0,58},{0,43}}, color={0,0,0})); - connect(dynamicOnePhaseFlowPipe1.C2, sinkP1.C) - annotation (Line(points={{10,-60},{30,-60}}, color={0,0,255})); - connect(heatSource1.C, heatExchangerWall1.WT2) - annotation (Line(points={{0,-29.8},{0,-38}}, color={191,95,0})); - connect(heatExchangerWall1.WT1,dynamicOnePhaseFlowPipe1. CTh) - annotation (Line(points={{0,-42},{0,-57}}, color={0,0,0})); - connect(sourceP1.C,dynamicOnePhaseFlowPipe1. C1) - annotation (Line(points={{-60,-60},{-10,-60}}, color={0,0,0})); - annotation (experiment(StopTime=10), Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestDiffusion_DynamicOnePhaseFlowPipe; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestDiffusion_DynamicPlateHeatExchanger.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestDiffusion_DynamicPlateHeatExchanger.mo deleted file mode 100644 index 84f4f856..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestDiffusion_DynamicPlateHeatExchanger.mo +++ /dev/null @@ -1,62 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestDiffusion_DynamicPlateHeatExchanger - - ThermoSysPro.Fluid.HeatExchangers.DynamicPlateHeatExchanger - echangeurAPlaques1D( - region_c=ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region.Region_1, - region_f=ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region.Region_1, - steady_state=true, - Ns=10, - dynamic_energy_balance=false, - diffusion=true, - continuous_flow_reversal=true) - annotation (Placement(transformation(extent={{-20,40},{0,60}}, rotation=0))); - - BoundaryConditions.SourcePQ sourceP( - option_temperature=true, - diffusion=true, - Q0=0, - T0=340) - annotation (Placement(transformation(extent={{-80,40},{-60,60}}, rotation=0))); - BoundaryConditions.SourcePQ sourceP1 - annotation (Placement( - transformation(extent={{-60,20},{-40,40}}, rotation=0))); - BoundaryConditions.Sink puitsP(option_temperature=true, - diffusion=true) annotation (Placement(transformation( - extent={{40,40},{60,60}}, rotation=0))); - BoundaryConditions.Sink puitsP1(diffusion=true, h0=200000) - annotation (Placement(transformation( - extent={{20,20},{40,40}}, rotation=0))); -equation - connect(sourceP.C, echangeurAPlaques1D.Ec) - annotation (Line(points={{-60,50},{-20,50}}, color={0,0,255})); - connect(sourceP1.C, echangeurAPlaques1D.Ef) annotation (Line(points={{-40,30}, - {-15,30},{-15,44}}, color={0,0,255})); - connect(echangeurAPlaques1D.Sc, puitsP.C) annotation (Line(points={{0,50},{20, - 50},{20,50},{40,50}}, color={0,0,255})); - connect(echangeurAPlaques1D.Sf, puitsP1.C) annotation (Line(points={{-5,44},{ - -6,44},{-6,30},{20,30}}, color={0,0,255})); - annotation (experiment(StopTime=1000), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestDiffusion_DynamicPlateHeatExchanger; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestDiffusion_DynamicTwoPhaseFlowPipe.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestDiffusion_DynamicTwoPhaseFlowPipe.mo deleted file mode 100644 index 6ca89991..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestDiffusion_DynamicTwoPhaseFlowPipe.mo +++ /dev/null @@ -1,187 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestDiffusion_DynamicTwoPhaseFlowPipe - - ThermoSysPro.Fluid.HeatExchangers.DynamicTwoPhaseFlowPipe - dynamicTwoPhaseFlowPipe(L=20, - Q(start={5.492026593727256E-28,5.492026607285849E-28,5.492026607285849E-28, - 5.492026607285849E-28,5.492026607285849E-28,5.492026607285849E-28, - 5.492026607285849E-28,5.492026607285849E-28,5.492026607285849E-28, - 5.492026607285849E-28,5.492026607285849E-28}), - h(start={84011.8111671368,96057.08454715868,107718.52365349933, - 119295.22918923412,130792.44987567255,142215.00322033433, - 153567.34130353143,164853.6027022597,176077.65400298327, - 187243.1234252416,198353.42841254506,209411.79856705698}), - continuous_flow_reversal=true, - inertia=false, - dynamic_mass_balance=false, - advection=true, - dynamic_energy_balance=false, - cpl2(start={4183.826265167646,4182.239614474996,4181.0130500668565, - 4180.0726819587735,4179.380584625066,4178.908955510578, - 4178.63729871947,4178.550389628282,4178.636803895239, - 4178.887855575399,4179.29683238825}), - cpv2(start={2049.2168798430116,2046.3449415228738,2043.4582034172774, - 2040.5558258112756,2037.636860922887,2034.7002308786582, - 2031.744699351002,2028.7688344361377,2025.770959168656, - 2022.7490841743909,2019.518356822069}), - kl2(start={0.5995743350581909,0.5995743350579683,0.5995743350571023, - 0.5995743350562764,0.5995743350555206,0.5995743350548642, - 0.5995743350543319,0.5995743350539415,0.5995743350536991, - 0.599574335053346,0.5995743403506435}), - kv2(start={0.024965829345847085,0.024990303852044017,0.025018417766029456, - 0.02505065954620164,0.025087620205457677,0.025130023834108832, - 0.025178770324693366,0.02523499664554269,0.025300167212669696, - 0.02537621164077076,0.0254715737844706}), - diffusion=true, - pro2(T(start={294.61264959452353,297.4461204783121,300.22404336919567, - 302.982702661547,305.7232156830587,308.44660714369365, - 311.15382285197893,313.8457405734291,316.5231787363566, - 319.18690350188376,321.8376345796106}), d(start={997.892715521068, - 997.2253707910008,996.4959923473901,995.7017938222477, - 994.8471177790162,993.9357736693299,992.9711212203756, - 991.9561376232762,990.8934721677539,989.7854910510117, - 988.6343144234495})), - P(start={99999.999999976,99999.999999978,99999.999999981,99999.999999983,99999.999999985, - 99999.999999988,99999.99999999,99999.999999992,100000,100000,100000,100000})) - annotation (Placement(transformation(extent={{-10,30}, - {10,50}}, rotation=0))); - BoundaryConditions.SourceP sourceP( - continuous_flow_reversal=true, - diffusion=true, - P0=100000, - T0=293.15) - annotation (Placement(transformation(extent={{-80,30},{-60,50}}, rotation=0))); - - BoundaryConditions.SinkP sinkP(diffusion=true, - T0=323.15) - annotation (Placement(transformation(extent={{30,30},{50,50}}, rotation=0))); - Thermal.BoundaryConditions.HeatSource heatSource( - option_temperature=2, - T0={1000,1100,1200,1300,1400,1500,1600,1700,1800,1900}, - W0={0,0,0,0,0,0,0,0,0,0}) - annotation (Placement(transformation(extent={{-10,70},{10,90}},rotation=0))); - Thermal.HeatTransfer.HeatExchangerWall heatExchangerWall(Ns=10, - dynamic_energy_balance=false) - annotation (Placement(transformation(extent={{-10,50},{10,70}},rotation=0))); - PressureLosses.SwitchValve switchValve(Qmin=0) - annotation (Placement(transformation(extent={{-40,36},{-20,56}}))); - InstrumentationAndControl.Blocks.Logique.Echelon echelon(startTime=1) - annotation (Placement(transformation(extent={{-74,66},{-66,74}}))); - InstrumentationAndControl.Blocks.Logique.NONL nONL - annotation (Placement(transformation(extent={{-54,66},{-46,74}}))); - ThermoSysPro.Fluid.HeatExchangers.DynamicTwoPhaseFlowPipe - dynamicTwoPhaseFlowPipe1( - L=20, - Q(start={4.9243335191367076E-05,4.924351014778949E-05,4.924351014778949E-05, - 4.924351014778949E-05,4.924351014778949E-05,4.924351014778949E-05, - 4.924351014778949E-05,4.924351014778949E-05,4.924351014778949E-05, - 4.924351014778949E-05,4.924351014778949E-05}), - h(start={84011.8111671368,95792.53373784182,107482.21110144592, - 119086.65906940492,130611.17116650468,142060.60442474802, - 153439.44619534744,164751.8668430315,176001.7618457063, - 187192.78587129858,198328.3807233511,209411.79856705698}), - continuous_flow_reversal=true, - inertia=false, - dynamic_mass_balance=false, - advection=true, - cpl2(start={4183.8461052314415,4182.2694439224715,4181.033777873867, - 4180.086463719214,4179.389099400846,4178.913555072556, - 4178.639109839789,4178.550383980675,4178.6358456341095, - 4178.886733579299,4179.2962820044995}), - cpv2(start={2049.2168798430116,2046.3449415228738,2043.4582034172774, - 2040.5558258112756,2037.636860922887,2034.7002308786582, - 2031.744699351002,2028.7688344361377,2025.770959168656, - 2022.7490841743909,2019.518356822069}), - kl2(start={0.5995743350581909,0.5995743350579683,0.5995743350571023, - 0.5995743350562764,0.5995743350555206,0.5995743350548642, - 0.5995743350543319,0.5995743350539415,0.5995743350536991, - 0.599574335053346,0.5995743403506435}), - kv2(start={0.024965829345847085,0.024990303852044017,0.025018417766029456, - 0.02505065954620164,0.025087620205457677,0.025130023834108832, - 0.025178770324693366,0.02523499664554269,0.025300167212669696, - 0.02537621164077076,0.0254715737844706}), - diffusion=true, - pro2(T(start={294.58103295016184,297.3862511962513,300.1708576823335, - 302.9360907339107,305.6830771234792,308.4128498965468, - 311.12636229776916,313.82449878754863,316.50808386868016, - 319.1778892498971,321.83463973606456}), d(start={997.8997091804818, - 997.2402860410343,996.5106311231898,995.7157728656836, - 994.8600940026633,993.9474377103298,992.9811922410435, - 991.9643590731059,990.8996082946633,989.7893240021328, - 988.6356418174122})), - dynamic_energy_balance=false, - P(start={99999.999999976,99999.999999978,99999.999999981,99999.999999983, - 99999.999999985,99999.999999988,99999.99999999,99999.999999992,100000, - 100000,100000,100000})) - annotation (Placement(transformation(extent={{-10,-70}, - {10,-50}}, rotation=0))); - BoundaryConditions.SourceQ sourceP1( - continuous_flow_reversal=true, - diffusion=true, - Q0=0, - T0=293.15, - option_temperature=true) - annotation (Placement(transformation(extent={{-80,-70},{-60,-50}}, - rotation=0))); - BoundaryConditions.SinkP sinkP1( - diffusion=true, - T0=323.15) - annotation (Placement(transformation(extent={{30,-70},{50,-50}}, - rotation=0))); - Thermal.BoundaryConditions.HeatSource heatSource1( - option_temperature=2, - T0={1000,1100,1200,1300,1400,1500,1600,1700,1800,1900}, - W0={0,0,0,0,0,0,0,0,0,0}) - annotation (Placement(transformation(extent={{-10,-30},{10,-10}}, - rotation=0))); - Thermal.HeatTransfer.HeatExchangerWall heatExchangerWall1( - Ns=10, - dynamic_energy_balance=false) - annotation (Placement(transformation(extent={{-10,-50},{10,-30}}, - rotation=0))); -equation - connect(dynamicTwoPhaseFlowPipe.C2,sinkP. C) annotation (Line(points={{10,40}, - {30,40}}, color={0,0,255})); - connect(heatSource.C,heatExchangerWall. WT2) annotation (Line(points={{0,70.2}, - {0,62}}, color={191,95,0})); - connect(sourceP.C, switchValve.C1) - annotation (Line(points={{-60,40},{-40,40}}, color={0,0,0})); - connect(switchValve.C2, dynamicTwoPhaseFlowPipe.C1) - annotation (Line(points={{-20,40},{-10,40}}, color={0,0,0})); - connect(echelon.yL, nONL.uL) - annotation (Line(points={{-65.6,70},{-54.4,70}}, color={0,0,255})); - connect(nONL.yL, switchValve.Ouv) annotation (Line(points={{-45.6,70},{-30,70}, - {-30,53.2}}, color={0,0,255})); - connect(heatExchangerWall.WT1, dynamicTwoPhaseFlowPipe.CTh) - annotation (Line(points={{0,58},{0,43}}, color={0,0,0})); - connect(dynamicTwoPhaseFlowPipe1.C2, sinkP1.C) - annotation (Line(points={{10,-60},{30,-60}}, color={0,0,255})); - connect(heatSource1.C, heatExchangerWall1.WT2) - annotation (Line(points={{0,-29.8},{0,-38}}, color={191,95,0})); - connect(heatExchangerWall1.WT1, dynamicTwoPhaseFlowPipe1.CTh) - annotation (Line(points={{0,-42},{0,-57}}, color={0,0,0})); - connect(sourceP1.C, dynamicTwoPhaseFlowPipe1.C1) - annotation (Line(points={{-60,-60},{-10,-60}}, color={0,0,0})); - annotation (experiment(StopTime=10), Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestDiffusion_DynamicTwoPhaseFlowPipe; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestDiffusion_VolumeA.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestDiffusion_VolumeA.mo deleted file mode 100644 index a417bca8..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestDiffusion_VolumeA.mo +++ /dev/null @@ -1,71 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestDiffusion_VolumeA - - BoundaryConditions.SourcePQ sourcePQ1( - C(h_vol_2(start=63269.22110794237)), - Q(start=0), - continuous_flow_reversal=false, - Q0=0, - ftype=ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType.WaterSteam, - option_temperature=true, - T0=293.15, - diffusion=true) - annotation (Placement(transformation(extent={{-100,-10},{-80,10}}))); - - BoundaryConditions.Sink sink1( - option_temperature=true, - T0=333.15, - diffusion=true) - annotation (Placement(transformation(extent={{80,-10},{100,10}}))); - PressureLosses.SwitchValve switchValve(Qmin=0) - annotation (Placement(transformation(extent={{-60,-4},{-40,16}}))); - InstrumentationAndControl.Blocks.Logique.Constante constante(K=true) - annotation (Placement(transformation(extent={{-80,20},{-60,40}}))); - Volumes.VolumeA volumeA( - continuous_flow_reversal=false, - diffusion=true, - dynamic_energy_balance=false, - ftype=ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType.WaterSteam) - annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); - - PressureLosses.SwitchValve switchValve1(Qmin=0, k=2000) - annotation (Placement(transformation(extent={{40,-4},{60,16}}))); - InstrumentationAndControl.Blocks.Logique.Constante constante1(K=true) - annotation (Placement(transformation(extent={{20,20},{40,40}}))); -equation - connect(constante.yL, switchValve.Ouv) - annotation (Line(points={{-59,30},{-50,30},{-50,13.2}}, color={0,0,255})); - connect(sourcePQ1.C, switchValve.C1) - annotation (Line(points={{-80,0},{-60,0}}, color={0,0,0})); - connect(volumeA.Cs1, switchValve1.C1) - annotation (Line(points={{10,0},{40,0}}, color={0,0,0})); - connect(switchValve1.C2,sink1. C) - annotation (Line(points={{60,0},{80,0}}, color={0,0,0})); - connect(constante1.yL, switchValve1.Ouv) - annotation (Line(points={{41,30},{50,30},{50,13.2}}, color={0,0,255})); - connect(switchValve.C2, volumeA.Ce1) - annotation (Line(points={{-40,0},{-10,0}}, color={0,0,0})); - annotation (Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - experiment(StopTime=12), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestDiffusion_VolumeA; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestDynamicCheckValve.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestDynamicCheckValve.mo deleted file mode 100644 index 2a6c5e8b..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestDynamicCheckValve.mo +++ /dev/null @@ -1,58 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestDynamicCheckValve - - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP1 - annotation (Placement(transformation( - extent={{-38,-10},{-18,10}},rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP puitsP1( - P0=6e5) annotation (Placement(transformation( - extent={{42,-10},{62,10}},rotation=0))); - ThermoSysPro.Fluid.PressureLosses.DynamicCheckValve checkValve(J=10) - annotation (Placement(transformation(extent={{2,-10},{22,10}},rotation=0))); - InstrumentationAndControl.Blocks.Sources.Sinusoide pulse( - period=100, - amplitude=3e5, - offset=6e5) annotation (Placement(transformation(extent={{-78,-10},{-58,10}}, - rotation=0))); -equation - connect(sourceP1.C, checkValve.C1) - annotation (Line(points={{-18,0},{2,0}}, color={0,0,255})); - connect(checkValve.C2, puitsP1.C) annotation (Line(points={{22,0},{32,0},{42, - 0}}, color={0,0,255})); - connect(sourceP1.IPressure, pulse.y) - annotation (Line(points={{-33,0},{-57,0}}, color={28,108,200})); - annotation ( - Diagram(graphics, - coordinateSystem( - preserveAspectRatio=false, - extent={{-100,-100},{100,100}}, - grid={2,2})), - Window( - x=0.28, - y=0.03, - width=0.5, - height=0.6), - experiment(StopTime=300), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestDynamicCheckValve; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestDynamicCondenser.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestDynamicCondenser.mo deleted file mode 100644 index 28f75489..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestDynamicCondenser.mo +++ /dev/null @@ -1,119 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestDynamicCondenser - ThermoSysPro.Fluid.Machines.StaticCentrifugalPump staticCentrifugalPump(Pm(displayUnit = "Pa", start= - 355000.00000015664), Q(fixed = false), hn(fixed = false, start= - 71.08245675235786), p_rho(displayUnit = "kg/m3"), rho(displayUnit = "kg/m3"), - a1(start=-88.67, fixed=false), - C2(h(start=195297.69906611618), h_vol_1(start=195297.69906611618)), - Qv(start=0.009081311621074862), - h(start=193554.9971298399), - C1(P(start=10000.0))) annotation ( - Placement(visible = true, transformation(origin={-10,-60}, extent={{10,-10}, - {-10,10}}, rotation = 0))); - ThermoSysPro.Fluid.Machines.StodolaTurbine stodolaTurbine(Pe(displayUnit = "Pa", fixed = true, start = 700000), Ps(displayUnit = "Pa", fixed = false), W_fric = 0, eta_is(fixed = false), eta_is_wet(fixed = false), rhos(displayUnit = "kg/m3", fixed = false), - xm(fixed=false, start=0.9856238368898451), - proe(x(start=1, fixed=true)), - Ce(h_vol_2(start=3128840.013040668), h(start=3128840.0130323363)), - pros(d(start=0.07018147245152216))) annotation ( - Placement(visible = true, transformation(origin={-10,60}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); - ThermoSysPro.Fluid.HeatExchangers.DynamicCondenser Condenseur( - dynamic_energy_balance=true, - Rv=20, - steady_state=false) annotation ( - Placement(visible = true, transformation(origin={40.5,-1}, extent = {{-20.5, -16}, {20.5, 16}}, rotation = 0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP puitsPCaloporteur(P0 = 1e5, T0 = 373.05, option_temperature = true) annotation ( - Placement(visible = true, transformation(origin={91,-1}, extent = {{-11, -12}, {11, 12}}, rotation = 0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourcePCaloporteur( h0 = 113e3, - option_temperature=true, - Q0=100) annotation ( - Placement(visible = true, transformation(origin={-10,-1}, extent = {{-10, -9}, {10, 9}}, rotation = 0))); - ThermoSysPro.Fluid.Volumes.VolumeATh - volumeA( - P(start=70e5), - h(start=2.e6), - dynamic_energy_balance=false) - annotation (Placement(transformation(extent={{-70,10},{-50,-10}}))); - ThermoSysPro.Thermal.BoundaryConditions.HeatSource - heatSource(W0(start={2e6}, each fixed=false), - option_temperature=2) annotation (Placement(transformation( - extent={{-10,-10},{10,10}}, - rotation=90, - origin={-88,12}))); - InstrumentationAndControl.Blocks.Tables.Table1DTemps Vapeur_GCT1(Table=[0, - 0.0001; 22,0.0001; 24,2.02; 25,100; 26,150; 28,300; 29.7,590; 30.2,600; - 30.5,590; 31,570; 35,250; 40,100; 45,15; 47,0.000001; 200,0.000001; - 1000,0.000001]) - annotation (Placement(transformation(extent={{-56,34},{-44,46}}, - rotation=0))); - BoundaryConditions.SourceQ Source_Vsup1( - h0=2759.6e3, Q0=1) - annotation ( Placement(transformation( - extent={{-40,10},{-20,30}}, rotation=0))); - PressureLosses.SingularPressureLoss - PressureLoss_VapeurIn_in4(K=1e-4, Q(fixed=false, start=0.01)) - annotation (Placement(transformation(extent={{0,10},{ - 20,30}}, rotation=0))); -equation - connect(staticCentrifugalPump.C2,volumeA. Ce2) - annotation (Line(points={{-20,-60},{-60,-60},{-60,-10}}, color={28,108,200})); - connect(volumeA.Cs2,stodolaTurbine. Ce) - annotation (Line(points={{-60,10},{-60,60},{-20.1,60}}, color={28,108,200})); - connect(heatSource.C[1],volumeA. Cth) annotation (Line(points={{-78.2,12},{-64, - 12},{-64,0},{-60,0}}, color={0,0,0})); - connect(sourcePCaloporteur.C, Condenseur.Ce1) annotation (Line(points={{0,-1},{ - 2,-1},{2,-1.16},{20,-1.16}}, color={0,0,0})); - connect(Condenseur.Ce2, puitsPCaloporteur.C) annotation (Line(points={{60.795, - -1.16},{66.3975,-1.16},{66.3975,-1},{80,-1}}, color={0,0,0})); - connect(Condenseur.C2ex, staticCentrifugalPump.C1) - annotation (Line(points={{40.5,-17},{40.5,-60},{0,-60}}, color={0,0,0})); - connect(stodolaTurbine.Cs, Condenseur.C1vap) - annotation (Line(points={{0.1,60},{40.5,60},{40.5,15}}, color={0,0,0})); - connect(Vapeur_GCT1.y, Source_Vsup1.IMassFlow) - annotation (Line(points={{-43.4,40},{-30,40},{-30,25}}, color={0,0,255})); - connect(Source_Vsup1.C, PressureLoss_VapeurIn_in4.C1) - annotation (Line(points={{-20,20},{0,20}}, color={0,0,0})); - connect(PressureLoss_VapeurIn_in4.C2, Condenseur.C2vap) annotation (Line( - points={{20,20},{32.505,20},{32.505,13.72}}, color={0,0,0})); - annotation ( - Diagram(graphics={ - Text( - extent={{-94,34},{-64,24}}, - lineColor={28,108,200}, - textString="W: free"), - Text( - extent={{-26,-38},{8,-48}}, - lineColor={28,108,200}, - textString="a1: free"), - Text( - extent={{-28,94},{8,84}}, - lineColor={28,108,200}, - textString="Pe: fixed"), - Text( - extent={{-28,84},{10,72}}, - lineColor={28,108,200}, - textString="proe.x: fixed")}), - Documentation(info=" - -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-"), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - experiment(StopTime=10000)); -end TestDynamicCondenser; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestDynamicDrum.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestDynamicDrum.mo deleted file mode 100644 index 71794c51..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestDynamicDrum.mo +++ /dev/null @@ -1,183 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestDynamicDrum - parameter Units.SI.MassFlowRate Qin(fixed=false, start=80) "Mass flow rate"; - parameter ThermoSysPro.Units.xSI.Cv CvmaxWater(fixed=false, start=670) - "Maximum CV (active if mode_caract=0)"; - parameter Real LambdaPipe(fixed=false,start=0.085) - "Friction pressure loss coefficient (active if lambda_fixed=true)"; - - Volumes.DynamicDrum Drum( - Vv(start=39), - Vertical=false, - hl(start=1454177.7248984643), - hv(start=2670002.8920646077), - xv(start=0.01), - rhol(start=670), - rhov(start=78), - zl(fixed=true, start=1.05), - wsftype=ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.WaterSteamFluidType.WaterSteam, - Cm(diff_res_1(start=8476939.240220599)), - steady_state=true, - dynamic_energy_balance=false, - P0=13000000, - diffusion=true, - P(start=13000000, fixed=true), - Pfond(start=13006991.905108), - Tp(start=590.93934457637)) - annotation (Placement(transformation(extent={{-61,18},{1, - 80}}, rotation=0))); - - PressureLosses.ControlValve feedwaterValve( - Cv(start=335), - C1( - h_vol_1(start=1400e3), - h(start=1400e3), - P(start=13300000), - Q(start=79.5)), - Q(start=79.5), - rho(start=888), - h(start=1400000), - Cvmax=CvmaxWater, - Pm(start=13100000)) - annotation (Placement(transformation(extent={{-120,76},{ - -100,96}}, rotation=0))); - PressureLosses.ControlValve steamValve( - Cvmax(fixed=true) = 50000, - Cv(start=25000), - Q(start=79.5), - rho(start=78.5), - h(start=2657930), - Pm(start=12998726.577779422)) - annotation (Placement(transformation(extent={{40,76},{60,96}}, rotation=0))); - ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Constante - ConsigneNiveauBallon(k(fixed=true) = 0.5) - annotation (Placement(transformation(extent={{-160,122},{-140,142}}, - rotation=0))); - HeatExchangers.DynamicTwoPhaseFlowPipe - TubeEcranBoucleEvaporatoire( - T0=fill(400, 10), - heb(start={10409,10268,10127,9985,9842,9698,9552,9406,9258,9111}), - advection=false, - z2=10, - simplified_dynamic_energy_balance=false, - D=0.03, - ntubes=1400, - h(start={1454177.75,1531100.8018215413,1608023.8787446183,1684946.955667695, - 1761870.032590772,1838793.109513849,1915716.186436926, - 1992639.2633600028,2069562.3402830793,2146485.4172061565, - 2223408.4941292335,1454177.75}), - L=20, - Q(start=fill(130, 11)), - dynamic_mass_balance=false, - inertia=false, - dynamic_energy_balance=false, - diffusion=true, - P(start={13032002.884172,13025908.565037,13020089.245351,13015847.070697, - 13012648.443752,13010064.118918,13007881.468256,13005979.718403, - 13004283.685995,13002743.397189,13001323.948575,13000000})) - annotation (Placement(transformation( - origin={6,-26}, - extent={{-10,10},{10,-10}}, - rotation=90))); - Thermal.BoundaryConditions.HeatSource - SourceC3( - option_temperature=2, - W0={1e7,1e7,1e7,1e7,1e7,1e7,1e7,1e7,1e7,1e7}, - T0={290,290,290,290,290,290,290,290,290,290}) - annotation (Placement(transformation( - origin={36,-26}, - extent={{-10,-10},{10,10}}, - rotation=270))); - ThermoSysPro.Thermal.HeatTransfer.HeatExchangerWall heatExchangerWall(Ns=10, L=20, - D=0.03, - ntubes=1400, - dynamic_energy_balance=false) - annotation (Placement(transformation( - origin={18,-26}, - extent={{-10,-10},{10,10}}, - rotation=90))); - PressureLosses.LumpedStraightPipe lumpedStraightPipe( - L=20, - z1=20, - Q(fixed=true, start=130), - lambda=LambdaPipe) - annotation (Placement(transformation( - origin={-66,-26}, - extent={{10,-10},{-10,10}}, - rotation=90))); - ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Constante - ConsigneNiveauBallon1(k(fixed=true) = 0.5) - annotation (Placement(transformation(extent={{0,122},{20,142}}, rotation=0))); - BoundaryConditions.SourceP sourceP(h0=1400000, - P0(fixed=true) = 13200000, - option_temperature=false) - annotation (Placement(transformation(extent={{-200,70},{-180,90}}, - rotation=0))); - BoundaryConditions.SinkQ sinkQ(Q0=75) - annotation (Placement(transformation(extent={{120,70},{140,90}}, rotation=0))); - ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Constante - SteamMassFlowRate(k=Qin) - annotation (Placement(transformation(extent={{100,122},{120,142}}, rotation= - 0))); -equation - connect(Drum.Cv,steamValve. C1) - annotation (Line(points={{1,80},{40,80}}, color={0,0,255})); - connect(feedwaterValve.C2, Drum.Ce1) - annotation (Line(points={{-100,80},{-61,80}}, color={0,0,255})); - connect(Drum.Cd, lumpedStraightPipe.C1) annotation (Line(points={{-61,18},{ - -66,18},{-66,-16}}, color={0,0,255})); - connect(heatExchangerWall.WT1, SourceC3.C) annotation (Line(points={{20,-26}, - {26.2,-26}}, color={191,95,0})); - connect(Drum.Cm, TubeEcranBoucleEvaporatoire.C2) - annotation (Line(points={{1,18},{6,18},{6,-16}})); - connect(TubeEcranBoucleEvaporatoire.CTh, heatExchangerWall.WT2) annotation (Line( - points={{9,-26},{16,-26}}, color={191,95,0})); - connect(ConsigneNiveauBallon.y,feedwaterValve. Ouv) - annotation (Line(points={{-139,132},{-110,132},{-110,97}}, smooth=Smooth.None)); - connect(sourceP.C,feedwaterValve. C1) annotation (Line( - points={{-180,80},{-120,80}}, - color={0,0,255}, - smooth=Smooth.None)); - connect(steamValve.C2, sinkQ.C) annotation (Line( - points={{60,80},{120,80}}, - color={0,0,255}, - smooth=Smooth.None)); - connect(TubeEcranBoucleEvaporatoire.C1, lumpedStraightPipe.C2) - annotation (Line(points={{6,-36},{6,-68},{-66,-68},{-66,-36}})); - connect(ConsigneNiveauBallon1.y,steamValve. Ouv) - annotation (Line(points={{21,132},{50,132},{50,97}}, smooth=Smooth.None)); - connect(SteamMassFlowRate.y, sinkQ.IMassFlow) - annotation (Line(points={{121,132},{130,132},{130,85}})); - annotation (experiment(StopTime=1000), - Window( - x=0.43, - y=0, - width=0.57, - height=0.63), - Diagram(coordinateSystem( - preserveAspectRatio=false, - extent={{-200,-100},{140,200}}, - grid={2,2})), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestDynamicDrum; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestDynamicDrum_CC.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestDynamicDrum_CC.mo deleted file mode 100644 index 72c9c76b..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestDynamicDrum_CC.mo +++ /dev/null @@ -1,190 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestDynamicDrum_CC - import ThermoSysPro; - parameter ThermoSysPro.Units.xSI.Cv CvmaxWater(fixed=false, start=670) - "Maximum CV (active if mode_caract=0)"; - parameter Real LambdaPipe(fixed=false,start=0.085) - "Friction pressure loss coefficient (active if lambda_fixed=true)"; - - ThermoSysPro.Fluid.Volumes.DynamicDrum Drum( - Vv(start=39), - Vertical=false, - hl(start=1454400), - hv(start=2.658e6), - xv(start=0.01), - rhol(start=670), - rhov(start=78), - zl(fixed=true, start=1.05), - wsftype=ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.WaterSteamFluidType.WaterSteam, - P0=13000000, - P(start=13000000, fixed=false), - Tp(start=592.6)) annotation (Placement(transformation(extent={{-61,18},{1, - 80}}, rotation=0))); - - ThermoSysPro.Fluid.PressureLosses.ControlValve FeedwaterValve( - Cv(start=335), - Q(start=79.5), - rho(start=888), - h(start=1400000), - C1( - h_vol_1(start=1400e3), - h(start=1400e3), - Q(start=79.5), - P(start=13300000)), - Cvmax=CvmaxWater, - Pm(start=13100000)) - annotation (Placement(transformation(extent={{-120,76},{ - -100,96}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.ControlValve SteamValve( - Cv(start=25000), - Q(start=79.5), - rho(start=78.5), - h(start=2657930), - Cvmax=10000, - Pm(start=12900000)) - annotation (Placement(transformation(extent={{40,76},{60,96}}, rotation=0))); - ThermoSysPro.Fluid.HeatExchangers.DynamicTwoPhaseFlowPipe - TubeEcranBoucleEvaporatoire( - T0=fill(400, 10), - heb(start={10409,10268,10127,9985,9842,9698,9552,9406,9258,9111}), - advection=false, - z2=10, - simplified_dynamic_energy_balance=false, - P(start={13007000,13006600,13006000,13005500,13005000,13004500,13004000,13003000, - 13002000,13001000,13000000,12999990}), - D=0.03, - ntubes=1400, - h(start={1400e3,1450e3,1500e3,1550e3,1600e3,1650e3,1700e3,1750e3,1800e3,1850e3, - 1900e3,1950e3}), - L=20, - Q(start=fill(130, 11))) - annotation (Placement(transformation( - origin={6,-26}, - extent={{-10,10},{10,-10}}, - rotation=90))); - ThermoSysPro.Thermal.BoundaryConditions.HeatSource SourceC3( - option_temperature=2, - W0={1e7,1e7,1e7,1e7,1e7,1e7,1e7,1e7,1e7,1e7}, - T0={290,290,290,290,290,290,290,290,290,290}) - annotation (Placement(transformation( - origin={36,-26}, - extent={{-10,-10},{10,10}}, - rotation=270))); - ThermoSysPro.Thermal.HeatTransfer.HeatExchangerWall heatExchangerWall(Ns=10, L=20, - D=0.03, - ntubes=1400) - annotation (Placement(transformation( - origin={18,-26}, - extent={{-10,-10},{10,10}}, - rotation=90))); - ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe lumpedStraightPipe( - L=20, - z1=20, - C1(P(start=130e5)), - Q(fixed=true, start=130), - lambda=LambdaPipe) - annotation (Placement(transformation( - origin={-66,-26}, - extent={{10,-10},{-10,10}}, - rotation=90))); - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceQ(h0=1400000, - option_temperature=false, - ftype=ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType.WaterSteam, - P0=13300000) - annotation (Placement(transformation(extent={{-196,70},{-176,90}}, - rotation=0))); - - ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP( - option_temperature=false, - h0=2.650e6, - P0=12700000) - annotation (Placement(transformation(extent={{115,70},{135,90}}, rotation=0))); - InstrumentationAndControl.Blocks.Sources.Constante SteamValve_O(k=0.5) - annotation (Placement(transformation(extent={{20,102},{40,121}}, rotation=0))); - InstrumentationAndControl.Blocks.Tables.Table1DTemps Steam_Pressure(Table=[0, - 128e5; 100,128e5; 110,124e5; 200,124e5; 400,128e5; 2000,128e5; 2010, - 131e5; 2090,131e5; 2300,128e5; 3000,128e5]) - annotation (Placement(transformation(extent={{96,99},{120,123}}, rotation= - 0))); - ThermoSysPro.Examples.Control.Drum_LevelControl regulation_Niveau( - add(k1=-1, k2=+1), - Ti=50, - pIsat( - ureset0=0.5, - Limiteur1(u(signal(start=0.5))), - Ti=2000)) annotation (Placement(transformation(extent={{-56,106},{-84,132}}, - rotation=0))); - InstrumentationAndControl.Blocks.Sources.Constante Level(k=1.05) annotation ( - Placement(transformation(extent={{-21,102},{-40,121}}, rotation=0))); -equation - connect(Drum.Cv, SteamValve.C1) - annotation (Line(points={{1,80},{40,80}}, color={0,0,255})); - connect(FeedwaterValve.C2, Drum.Ce1) - annotation (Line(points={{-100,80},{-61,80}}, color={0,0,255})); - connect(Drum.Cd, lumpedStraightPipe.C1) annotation (Line(points={{-61,18},{ - -66,18},{-66,-16}}, color={0,0,255})); - connect(heatExchangerWall.WT1, SourceC3.C) annotation (Line(points={{20,-26}, - {26.2,-26}}, color={191,95,0})); - connect(Drum.Cm, TubeEcranBoucleEvaporatoire.C2) - annotation (Line(points={{1,18},{6,18},{6,-16}})); - connect(TubeEcranBoucleEvaporatoire.CTh, heatExchangerWall.WT2) annotation (Line( - points={{9,-26},{16,-26}}, color={191,95,0})); - connect(sourceQ.C, FeedwaterValve.C1) annotation (Line( - points={{-176,80},{-120,80}}, - color={0,0,255}, - smooth=Smooth.None)); - connect(SteamValve.C2,sinkP. C) annotation (Line( - points={{60,80},{115,80}}, - color={0,0,255}, - smooth=Smooth.None)); - connect(TubeEcranBoucleEvaporatoire.C1, lumpedStraightPipe.C2) - annotation (Line(points={{6,-36},{6,-68},{-66,-68},{-66,-36}})); - connect(SteamValve_O.y, SteamValve.Ouv) - annotation (Line(points={{41,111.5},{50,111.5},{50,97}}, color={0,0,255})); - connect(Steam_Pressure.y, sinkP.IPressure) annotation (Line(points={{121.2, - 111},{130,111},{130,80}}, color={0,0,255})); - connect(Level.y, regulation_Niveau.ConsigneNiveauEau) annotation (Line( - points={{-40.95,111.5},{-44,111.5},{-44,111.2},{-55.3,111.2}}, - color={0,0,0}, - pattern=LinePattern.Dash)); - - connect(Drum.yLevel, regulation_Niveau.MesureNiveauEau) annotation (Line( - points={{4.1,49},{10,49},{10,130.7},{-55.3,130.7}}, - color={0,0,0}, - pattern=LinePattern.Dash)); - connect(regulation_Niveau.SortieReelle1, FeedwaterValve.Ouv) annotation (Line( - points={{-84.7,107.3},{-110,107.3},{-110,97}}, color={0,0,255})); - annotation (experiment(StopTime=3000), - Window( - x=0.43, - y=0, - width=0.57, - height=0.63), - Diagram(graphics, - coordinateSystem( - preserveAspectRatio=false, - extent={{-200,-100},{140,200}}, - grid={2,2})), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestDynamicDrum_CC; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestDynamicFlueGasesMultiFluidHeatExchanger.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestDynamicFlueGasesMultiFluidHeatExchanger.mo deleted file mode 100644 index 3bc15a51..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestDynamicFlueGasesMultiFluidHeatExchanger.mo +++ /dev/null @@ -1,89 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestDynamicFlueGasesMultiFluidHeatExchanger - - BoundaryConditions.SourceP sourceP(C(h_vol_2(start= - 71016.12237181065)), - option_temperature=true, - P0=10000000, - Q(start=190407.49090838886)) - annotation (Placement(transformation(extent={{-60,20},{-40,40}}, rotation=0))); - BoundaryConditions.SinkP sinkP(C(h_vol_1(start= - 71016.1223718086))) - annotation (Placement(transformation(extent={{20,20},{40,40}}, rotation=0))); - HeatExchangers.DynamicFlueGasesMultiFluidHeatExchanger dynamicMultiFluidHeatExchanger( - steady_state=true, - Cfg1(h_vol_2(start=1999458.3239137873)), - Cfg2(h_vol_1(start=1997835.1051783948)), - ExchangerFlueGasesMetal( - P(start={5000000.0,5000000.0,5000000.0,5000000.0,5000000.0,5000000.0}), - Q(start={2702.7912398488343,2702.7912398488343,2702.7912398488343, - 2702.7912398488343,2702.7912398488343}), - Tp(start={293.20684981473266,293.655268073503,294.1038710234491, - 294.55265602776745}), - h(start={2000000.0,1999458.375,1998916.9494222174,1998375.8765143699, - 1997835.125,100000.0}), - rho2(start={9.227614370571606,9.229671002969678,9.231727464730685, - 9.23378375498367,9.235839872860517})), - TwoPhaseFlowPipe( - P(start={10000000.0,8023904.042494878,6045867.025005122, - 4065878.0712931687,2083926.1359166082,100000.0}), - Q(start={3482.228448926616,3482.228448926616,3482.228448926616, - 3482.228448926616,3482.228448926616}), - h(start={80196.484375,80197.90894929563,80199.3305700632, - 80200.75139888813,80202.17143579095,70825.8984375})), - ExchangerWall(Tp(start={291.91912560937857,292.368260847782, - 292.81758075140095,293.26708268122}), Tp1(start={ - 290.60590026437563,291.055766680952,291.5058177362657, - 291.9560507892685})), - Ns=4, - inertia=false, - Ntubes=100, - diffusion=true, - dynamic_energy_balance=true) - annotation (Placement(transformation(extent={{-20,20},{0,40}}))); - BoundaryConditions.SourcePQ sourceP1( - ftype=ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType.FlueGases, - h0=2e6, - P0=5000000, - Q0=500, - T0=1273.15) - annotation (Placement(transformation(extent={{10,-10},{-10,10}}, rotation=90, - origin={-10,70}))); - - BoundaryConditions.Sink sinkP1 - annotation (Placement(transformation(extent={{10,-10},{-10,10}}, - rotation=90, - origin={-10,-10}))); -equation - connect(sourceP.C, dynamicMultiFluidHeatExchanger.Cws1) - annotation (Line(points={{-40,30},{-20,30}}, color={0,0,0})); - connect(dynamicMultiFluidHeatExchanger.Cws2, sinkP.C) - annotation (Line(points={{0,30},{20,30}}, color={0,0,0})); - connect(sourceP1.C, dynamicMultiFluidHeatExchanger.Cfg1) - annotation (Line(points={{-10,60},{-10,35}}, color={0,0,0})); - connect(dynamicMultiFluidHeatExchanger.Cfg2, sinkP1.C) - annotation (Line(points={{-10,25},{-10,0}}, color={0,0,0})); - annotation (experiment(StopTime=1000), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestDynamicFlueGasesMultiFluidHeatExchanger; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestDynamicMultiFluidHeatExchanger.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestDynamicMultiFluidHeatExchanger.mo deleted file mode 100644 index b4a5492d..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestDynamicMultiFluidHeatExchanger.mo +++ /dev/null @@ -1,85 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestDynamicMultiFluidHeatExchanger - - BoundaryConditions.SourceQ sourceP(C(h_vol_2(start= - 71016.12237181065)), - Q0=10, - option_temperature=true) - annotation (Placement(transformation(extent={{-60,20},{-40,40}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP(C(h_vol_1(start= - 71016.1223718086))) - annotation (Placement(transformation(extent={{20,20},{40,40}}, rotation=0))); - HeatExchangers.DynamicMultiFluidHeatExchanger dynamicMultiFluidHeatExchanger( - steady_state=true, - diffusion=true, - dynamic_energy_balance=false, - Cfg1(h_vol_2(start=71016.12237181155)), - Cfg2(h_vol_1(start=71016.12237181314)), - DynamicOnePhaseFlowPipe_1( - P(start={300000.0,260001.59713260198,220002.3957916478,180002.39588440701, - 140001.5973181204,100000.0}), - Q(start={2702.7912398488343,2702.7912398488343,2702.7912398488343, - 2702.7912398488343,2702.7912398488343}), - h(start={71016.125,71016.125,71016.12237180988,71016.1223718091,71016.125, - 70825.8984375})), - DynamicOnePhaseFlowPipe_2( - P(start={300000.0,260001.59801114563,220002.39710936273,180002.3972020214, - 140001.59819646296,100000.0}), - Q(start={3482.228448926616,3482.228448926616,3482.228448926616, - 3482.228448926616,3482.228448926616}), - Tp(start={290.0310327031831,290.04018142634584,290.0493302229013, - 290.05847909283045}), - h(start={71016.125,71016.125,71016.12237181216,71016.12237181274, - 71016.125,70825.8984375})), - ExchangerWall(Tp(start={290.03103270324897,290.0401814264445, - 290.0493302229999,290.05847909289605}), Tp1(start={ - 290.03103270331616,290.04018142654525,290.0493302231005, - 290.0584790929629})), - Ntubes=10, - Ns=4, - inertia=false) - annotation (Placement(transformation(extent={{-20,20},{0,40}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP1( - ftype=ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType.FlueGases, - P0=5000000, - T0=1273.15) - annotation (Placement(transformation(extent={{10,-10},{-10,10}}, rotation=90, - origin={-10,70}))); - - ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP1 - annotation (Placement(transformation(extent={{10,-10},{-10,10}}, - rotation=90, - origin={-10,-10}))); -equation - connect(sourceP.C, dynamicMultiFluidHeatExchanger.Cws1) - annotation (Line(points={{-40,30},{-20,30}}, color={0,0,0})); - connect(dynamicMultiFluidHeatExchanger.Cws2, sinkP.C) - annotation (Line(points={{0,30},{20,30}}, color={0,0,0})); - connect(sourceP1.C, dynamicMultiFluidHeatExchanger.Cfg1) - annotation (Line(points={{-10,60},{-10,35}}, color={0,0,0})); - connect(dynamicMultiFluidHeatExchanger.Cfg2, sinkP1.C) - annotation (Line(points={{-10,25},{-10,0}}, color={0,0,0})); - annotation (experiment(StopTime=1000), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestDynamicMultiFluidHeatExchanger; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestDynamicMultiFluidHeatExchangerShell.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestDynamicMultiFluidHeatExchangerShell.mo deleted file mode 100644 index 36781c7f..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestDynamicMultiFluidHeatExchangerShell.mo +++ /dev/null @@ -1,87 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestDynamicMultiFluidHeatExchangerShell - - BoundaryConditions.SourceQ sourceP(C(h_vol_2(start= - 71016.12237181065)), - Q0=10, - option_temperature=true) - annotation (Placement(transformation(extent={{-60,20},{-40,40}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP(C(h_vol_1(start= - 71016.1223718086))) - annotation (Placement(transformation(extent={{20,20},{40,40}}, rotation=0))); - HeatExchangers.DynamicMultiFluidHeatExchangerShell dynamicMultiFluidHeatExchangerShell( - Cfg1(h_vol_2(start=71016.12237181155)), - Cfg2(h_vol_1(start=71016.12237181314)), - DynamicOnePhaseFlowPipe( - P(start={300000.0,260001.59713260198,220002.3957916478,180002.39588440701, - 140001.5973181204,100000.0}), - Q(start={2702.7912398488343,2702.7912398488343,2702.7912398488343, - 2702.7912398488343,2702.7912398488343}), - h(start={71016.125,71016.125,71016.12237180988,71016.1223718091,71016.125, - 70825.8984375})), - dynamicOnePhaseFlowShell( - P(start={300000.0,260001.59801114563,220002.39710936273,180002.3972020214, - 140001.59819646296,100000.0}), - Q(start={3482.228448926616,3482.228448926616,3482.228448926616, - 3482.228448926616,3482.228448926616}), - Tp(start={290.0310327031831,290.04018142634584,290.0493302229013, - 290.05847909283045}), - h(start={71016.125,71016.125,71016.12237181216,71016.12237181274, - 71016.125,70825.8984375})), - ExchangerWall(Tp(start={290.03103270324897,290.0401814264445, - 290.0493302229999,290.05847909289605}), Tp1(start={ - 290.03103270331616,290.04018142654525,290.0493302231005, - 290.0584790929629})), - Ntubes=10, - Ns=4, - region=ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region.Region_1, - Dext=0.01, - inertia=false, - dynamic_energy_balance=false, - diffusion=true) - annotation (Placement(transformation(extent={{-20,20},{0,40}}))); - - BoundaryConditions.SourceP sourceP1( - ftype=ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType.FlueGases, - P0=5000000, - T0=1273.15) - annotation (Placement(transformation(extent={{10,-10},{-10,10}}, rotation=90, - origin={-10,70}))); - - ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP1 - annotation (Placement(transformation(extent={{10,-10},{-10,10}}, - rotation=90, - origin={-10,-10}))); -equation - connect(sourceP.C, dynamicMultiFluidHeatExchangerShell.Cws1) - annotation (Line(points={{-40,30},{-20,30}}, color={0,0,0})); - connect(dynamicMultiFluidHeatExchangerShell.Cws2, sinkP.C) - annotation (Line(points={{0,30},{20,30}}, color={0,0,0})); - connect(sourceP1.C, dynamicMultiFluidHeatExchangerShell.Cfg1) - annotation (Line(points={{-10,60},{-10,35}}, color={0,0,0})); - connect(dynamicMultiFluidHeatExchangerShell.Cfg2, sinkP1.C) - annotation (Line(points={{-10,25},{-10,0}}, color={0,0,0})); - annotation (experiment(StopTime=1000), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestDynamicMultiFluidHeatExchangerShell; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestDynamicOnePhaseFlowPipe.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestDynamicOnePhaseFlowPipe.mo deleted file mode 100644 index 73556af2..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestDynamicOnePhaseFlowPipe.mo +++ /dev/null @@ -1,62 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestDynamicOnePhaseFlowPipe - - ThermoSysPro.Fluid.HeatExchangers.DynamicOnePhaseFlowPipe - dynamicOnePhaseFlowPipe( - Q(start={536.5750641592207,536.5750641592207,536.5750641592207, - 536.5750641592207,536.5750641592207,536.5750641592207, - 536.5750641592207,536.5750641592207,536.5750641592207, - 536.5750641592207,536.5750641592207}), - h(start={71016.12237181116,74743.46665892199,78470.81094603281, - 82198.15523314364,85925.49952025448,89652.84380736532, - 93380.18809447614,97107.53238158698,100834.8766686978, - 104562.22095580865,108289.56524291947,70825.9016030344}), - P(start={300000,281833.41863537,263664.30473175,245492.47958308, - 227317.76827098,209139.99948382,190959.00534677,172774.621262, - 154586.68575823,136395.04034906,118199.5293995,100000})) - annotation (Placement(transformation(extent={{-20, - 20},{0,40}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP - annotation (Placement(transformation(extent={{-60,20},{-40,40}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP - annotation (Placement(transformation(extent={{20,20},{40,40}}, rotation=0))); - ThermoSysPro.Thermal.BoundaryConditions.HeatSource heatSource( - T0={1000,1100,1200,1300,1400,1500,1600,1700,1800,1900}, - option_temperature=2, - W0={2e6,2e6,2e6,2e6,2e6,2e6,2e6,2e6,2e6,2e6}) - annotation (Placement(transformation(extent={{-20,60},{0,80}}, rotation=0))); - ThermoSysPro.Thermal.HeatTransfer.HeatExchangerWall heatExchangerWall(Ns=10) - annotation (Placement(transformation(extent={{-20,40},{0,60}}, rotation=0))); -equation - connect(sourceP.C, dynamicOnePhaseFlowPipe.C1) annotation (Line(points={{-40, - 30},{-20,30}}, color={0,0,255})); - connect(dynamicOnePhaseFlowPipe.C2, sinkP.C) annotation (Line(points={{0,30}, - {20,30}}, color={0,0,255})); - connect(heatSource.C, heatExchangerWall.WT2) annotation (Line(points={{-10, - 60.2},{-10,52}}, color={191,95,0})); - connect(heatExchangerWall.WT1, dynamicOnePhaseFlowPipe.CTh) - annotation (Line(points={{-10,48},{-10,33}}, color={191,95,0})); - annotation (experiment(StopTime=1000), Diagram(graphics), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestDynamicOnePhaseFlowPipe; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestDynamicOnePhaseFlowShell.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestDynamicOnePhaseFlowShell.mo deleted file mode 100644 index b34b26b2..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestDynamicOnePhaseFlowShell.mo +++ /dev/null @@ -1,80 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestDynamicOnePhaseFlowShell - - ThermoSysPro.Fluid.HeatExchangers.DynamicOnePhaseFlowShell - dynamicOnePhaseFlowPipeShell( - Q(start={30,30,30,30,30,30,30,30,30,30,30}), - Ds=1, - ntubes=520, - L=12, - P(start={2000000,1996000,1993000,1990000,1986000,1983000,1980000,1976000, - 1973000,1965000,1955000,1950000})) annotation (Placement( - transformation(extent={{-48,-36},{48,36}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP(option_temperature=false, P0(fixed= - false) = 1900000) - annotation (Placement(transformation(extent={{74,-15},{102,15}}, - rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP( - option_temperature=false, - h0=600e3, - P0=2000000, - Q(start=500, fixed=true)) - annotation (Placement(transformation(extent={{-103,-15},{-75,15}}, - rotation=0))); - ThermoSysPro.Thermal.HeatTransfer.HeatExchangerWall heatExchangerWall( - lambda=10, - Ns=10, - cpw=460, - rhow=7900, - D=0.017, - e=0.002, - ntubes=520, - L=12) annotation (Placement(transformation(extent={{-54,30},{54,58}}, - rotation=0))); - ThermoSysPro.Thermal.BoundaryConditions.HeatSource heatSource( - option_temperature=2, - W0={-2e6,-2e6,-2e6,-2e6,-2e6,-2e6,-2e6,-2e6,-2e6,-2e6}, - T0={300,300,300,300,300,300,300,300,300,300}) - annotation (Placement(transformation(extent={{-12,76},{12,98}}, - rotation=0))); - ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Rampe rampe( - Initialvalue=20e5, - Starttime=300, - Duration=600, - Finalvalue=19.8e5) - annotation (Placement(transformation(extent={{-100,32},{ - -80,52}}, rotation=0))); -equation - connect(sourceP.C, dynamicOnePhaseFlowPipeShell.C1) - annotation (Line(points={{-75,0},{-48,0}}, color={0,0,255})); - connect(dynamicOnePhaseFlowPipeShell.C2, sinkP.C) - annotation (Line(points={{48,0},{74,0}}, color={0,0,255})); - connect(heatExchangerWall.WT1, dynamicOnePhaseFlowPipeShell.CTh) - annotation (Line(points={{0,41.2},{0,10.8}}, color={191,95,0})); - connect(heatSource.C, heatExchangerWall.WT2) annotation (Line(points={{0, - 76.22},{0,46.8}}, color={191,95,0})); - connect(rampe.y, sourceP.IPressure) - annotation (Line(points={{-79,42},{-70,42},{-70,24},{-98,24},{-98,0},{-96,0}})); - annotation (Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestDynamicOnePhaseFlowShell; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestDynamicPlateHeatExchanger.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestDynamicPlateHeatExchanger.mo deleted file mode 100644 index 42f8e5ea..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestDynamicPlateHeatExchanger.mo +++ /dev/null @@ -1,89 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestDynamicPlateHeatExchanger - - ThermoSysPro.Fluid.HeatExchangers.DynamicPlateHeatExchanger - echangeurAPlaques1D( - region_c=ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region.Region_1, - region_f=ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region.Region_1, - steady_state=true, - Ns=10, - dynamic_energy_balance=false, - diffusion=true, - continuous_flow_reversal=true) - annotation (Placement(transformation(extent={{-20,40},{0,60}}, rotation=0))); - - BoundaryConditions.SourcePQ sourceP( - option_temperature=true, - diffusion=true, - T0=340) - annotation (Placement(transformation(extent={{-80,40},{-60,60}}, rotation=0))); - BoundaryConditions.SourcePQ sourceP1 - annotation (Placement( - transformation(extent={{-60,20},{-40,40}}, rotation=0))); - BoundaryConditions.Sink puitsP(option_temperature=true, - diffusion=true) annotation (Placement(transformation( - extent={{40,40},{60,60}}, rotation=0))); - BoundaryConditions.Sink puitsP1 - annotation (Placement(transformation( - extent={{20,20},{40,40}}, rotation=0))); - HeatExchangers.StaticPlateHeatExchanger echangeurAPlaques(region_c= - ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region.Region_1, - region_f=ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region.Region_1) - annotation (Placement(transformation(extent={{-20,-40},{0,-20}}, rotation=0))); - BoundaryConditions.SourcePQ sourceP2(T0=340, - option_temperature=true) - annotation (Placement(transformation(extent={{-80,-40},{-60,-20}}, - rotation=0))); - BoundaryConditions.SourcePQ sourceP3 - annotation (Placement( - transformation(extent={{-60,-60},{-40,-40}}, - rotation=0))); - BoundaryConditions.Sink puitsP2 - annotation (Placement(transformation( - extent={{40,-40},{60,-20}}, - rotation=0))); - BoundaryConditions.Sink puitsP3 - annotation (Placement(transformation( - extent={{20,-60},{40,-40}}, - rotation=0))); -equation - connect(sourceP.C, echangeurAPlaques1D.Ec) - annotation (Line(points={{-60,50},{-20,50}}, color={0,0,255})); - connect(sourceP1.C, echangeurAPlaques1D.Ef) annotation (Line(points={{-40,30}, - {-15,30},{-15,44}}, color={0,0,255})); - connect(echangeurAPlaques1D.Sc, puitsP.C) annotation (Line(points={{0,50},{20, - 50},{20,50},{40,50}}, color={0,0,255})); - connect(echangeurAPlaques1D.Sf, puitsP1.C) annotation (Line(points={{-5,44},{ - -6,44},{-6,30},{20,30}}, color={0,0,255})); - connect(sourceP2.C, echangeurAPlaques.Ec) - annotation (Line(points={{-60,-30},{-20,-30}}, color={0,0,255})); - connect(sourceP3.C, echangeurAPlaques.Ef) - annotation (Line(points={{-40,-50},{-15,-50},{-15,-36}}, color={0,0,255})); - connect(echangeurAPlaques.Sc, puitsP2.C) annotation (Line(points={{0,-29.8},{20, - -29.8},{20,-30},{40,-30}}, color={0,0,255})); - connect(echangeurAPlaques.Sf, puitsP3.C) annotation (Line(points={{-5,-36},{-6, - -36},{-6,-50},{20,-50}}, color={0,0,255})); - annotation (experiment(StopTime=1000), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestDynamicPlateHeatExchanger; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestDynamicReliefValve.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestDynamicReliefValve.mo deleted file mode 100644 index a650c999..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestDynamicReliefValve.mo +++ /dev/null @@ -1,103 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestDynamicReliefValve - import ThermoSysPro; - parameter ThermoSysPro.Units.SI.AbsolutePressure Pinitial=18e5 - "Initial pressure"; - parameter ThermoSysPro.Units.SI.AbsolutePressure Pfinal=Pinitial - "Final pressure"; - parameter ThermoSysPro.Units.SI.AbsolutePressure Pmax=21e5 "Maximum pressure"; - - ThermoSysPro.Fluid.PressureLosses.DynamicReliefValve reliefValve( - mech_steady_state=false, - caract=[0,0; 0.1,2745; 0.2,4915; 0.3,6391; 0.4,7339; 0.5,7949; 0.6,8351; - 0.7,8625; 0.8,8818; 0.9,8958; 1,9063], - Cvmax=9063, - Q(start=0), - Pm(start=Pinitial), - Pout=sinkP.P0, - mode_caract=2, - A2=1.1*reliefValve.A1, - A1=1.3*Modelica.Constants.pi*pipe.D^2/4, - m=50, - Cd=0.44, - Popen=2000000, - z_max=0.05) - annotation (Placement(transformation(extent={{0,0},{20,20}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe pipe( - Q(start=0), - Pm(start=Pinitial), - L=2, - D=0.2) annotation (Placement(transformation(extent={{-40,-40},{-20,-20}}, - rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP - annotation (Placement(transformation(extent={{80,0},{ - 100,20}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP - annotation (Placement(transformation(extent={{-80,-40},{-60,-20}}))); - InstrumentationAndControl.Blocks.Sources.Rampe ramp1( - Duration=200, - Finalvalue=Pmax, - Initialvalue=Pinitial) - annotation (Placement(transformation(extent={{-100,40},{-80,60}}))); - InstrumentationAndControl.Blocks.Sources.Rampe ramp2( - Duration=200, - Starttime=300, - Finalvalue=Pmax - Pfinal) - annotation (Placement(transformation(extent={{-100,0},{-80,20}}))); - InstrumentationAndControl.Blocks.Math.Add add(k2=-1) - annotation (Placement(transformation(extent={{-60,20},{-40,40}}))); - ThermoSysPro.Fluid.PressureLosses.Bend bend(R0=0.2, D=pipe.D) - annotation (Placement(transformation(extent={{0,-20},{20,-40}}))); - ThermoSysPro.Fluid.PressureLosses.Diaphragm diaphragm(Ouv=1, D=0.5) - annotation (Placement(transformation(extent={{40,0},{60,20}}))); -equation - connect(sourceP.C, pipe.C1) - annotation (Line(points={{-60,-30},{-40,-30}}, color={0,0,255})); - connect(ramp1.y, add.u1) annotation (Line(points={{-79,50},{-70,50},{-70,36},{ - -61,36}}, color={0,0,255})); - connect(ramp2.y, add.u2) annotation (Line(points={{-79,10},{-70,10},{-70,24},{ - -61,24}}, color={0,0,255})); - connect(add.y, sourceP.IPressure) annotation (Line(points={{-39,30},{-20,30},{ - -20,-10},{-90,-10},{-90,-30},{-75,-30}}, - color={0,0,255})); - connect(pipe.C2, bend.C1) - annotation (Line(points={{-20,-30},{0,-30}}, color={0,0,255})); - connect(bend.C2,reliefValve. C1) - annotation (Line(points={{10,-20},{10,0.2}},color={0,0,255})); - connect(reliefValve.C2, diaphragm.C1) - annotation (Line(points={{20,10},{40,10}}, color={0,0,255})); - connect(diaphragm.C2,sinkP. C) - annotation (Line(points={{60,10},{80,10}}, color={0,0,255})); - annotation ( - Diagram(coordinateSystem( - preserveAspectRatio=false, initialScale=0.1)), - Window( - x=0.1, - y=0.08, - width=0.5, - height=0.6), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}, - coordinateSystem(preserveAspectRatio=false, initialScale=0.1)), - experiment(StopTime=600, Interval=1), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestDynamicReliefValve; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestDynamicTwoPhaseFlowPipe.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestDynamicTwoPhaseFlowPipe.mo deleted file mode 100644 index e5e3e0e4..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestDynamicTwoPhaseFlowPipe.mo +++ /dev/null @@ -1,120 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestDynamicTwoPhaseFlowPipe - - ThermoSysPro.Fluid.HeatExchangers.DynamicTwoPhaseFlowPipe - dynamicTwoPhaseFlowPipe(L=20, advection=false, - Q(start={378.2555714391421,378.2555714391421,378.2555714391421, - 378.2555714391421,378.2555714391421,378.2555714391421, - 378.2555714391421,378.2555714391421,378.2555714391421, - 378.2555714391421,378.2555714391421}), - h(start={71016.12237181116,89522.1287033792,108028.13503495205, - 126534.14136650086,145040.14769798872,163546.15402957145, - 182052.16036112772,200558.16669267463,219064.17302421754, - 237570.17935577242,256076.18568728055,70825.9016030344}), - dynamic_energy_balance=false, - diffusion=true, - P(start={300000,281934.94102069,263857.29519348,245762.87920492, - 227647.89301968,209508.84324089,191342.485106,173145.77779074, - 154915.84935981,136649.96881108,118345.52340716,100000})) - annotation (Placement(transformation(extent={{-10,30}, - {10,50}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP - annotation (Placement(transformation(extent={{-50,30},{-30,50}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP - annotation (Placement(transformation(extent={{30,30},{50,50}}, rotation=0))); - Thermal.BoundaryConditions.HeatSource heatSource( - T0={1000,1100,1200,1300,1400,1500,1600,1700,1800,1900}, - option_temperature=2, - W0={7e6,7e6,7e6,7e6,7e6,7e6,7e6,7e6,7e6,7e6}) - annotation (Placement(transformation(extent={{-10,70},{10,90}},rotation=0))); - Thermal.HeatTransfer.HeatExchangerWall heatExchangerWall(Ns=10, - dynamic_energy_balance=false) - annotation (Placement(transformation(extent={{-10,50},{10,70}},rotation=0))); - ThermoSysPro.Fluid.HeatExchangers.DynamicTwoPhaseFlowPipe dynamicTwoPhaseFlowPipe1( - L=10, - D=0.03, - dpfCorr(fixed=false, - start=0.23963336533422905)= - 1, - inertia=true, - P(start={2000000,1999571.7070274,1999140.9402168,1998707.6248919, - 1998271.6837223,1997833.0364983,1997391.5998908,1996715.822109, - 1995640.0182728,1994163.0145856,1992283.4952231,1990000})) - annotation (Placement(transformation(extent={{-40,-90}, - {40,-32}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP1( - C(Q(fixed=true, start=1)), - option_temperature=false, - h0=800e3, - P0=2000000) - annotation (Placement(transformation(extent={{-90,-70},{-70,-50}},rotation= - 0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP1( - option_temperature=false, - h0=2000e3, - P0=1990000) - annotation (Placement(transformation(extent={{70,-70},{90,-50}},rotation=0))); - Thermal.BoundaryConditions.HeatSource heatSource1( - option_temperature=2, - T0={1000,1100,1200,1300,1400,1500,1600,1700,1800,1900}, - W0={2e4,2e4,2e4,2e4,2e4,2e4,2e4,2e4,2e4,2e4}) - annotation (Placement(transformation(extent={{-10,-11},{10,9}}, rotation=0))); - Thermal.HeatTransfer.HeatExchangerWall heatExchangerWall1( Ns=10, - L=10, - lambda=10, - cpw=460, - rhow=7900, - e=0.005, - D=0.03) - annotation (Placement(transformation(extent={{-40,-70},{40,10}},rotation=0))); - InstrumentationAndControl.Blocks.Sources.Rampe rampe( - Initialvalue=20e5, - Starttime=300, - Duration=600, - Finalvalue=19.8e5) - annotation (Placement(transformation(extent={{-74,-46},{-86, - -35}}, - rotation=0))); -equation - connect(sourceP.C,dynamicTwoPhaseFlowPipe. C1) annotation (Line(points={{-30,40}, - {-10,40}}, color={0,0,255})); - connect(dynamicTwoPhaseFlowPipe.C2,sinkP. C) annotation (Line(points={{10,40}, - {30,40}}, color={0,0,255})); - connect(heatSource.C,heatExchangerWall. WT2) annotation (Line(points={{0,70.2}, - {0,62}}, color={191,95,0})); - connect(heatExchangerWall.WT1,dynamicTwoPhaseFlowPipe. CTh) - annotation (Line(points={{0,58},{0,43}}, color={191,95,0})); - connect(sourceP1.C,dynamicTwoPhaseFlowPipe1. C1) annotation (Line(points={{-70,-60}, - {-42,-60},{-42,-61},{-40,-61}}, color={0, - 0,255})); - connect(dynamicTwoPhaseFlowPipe1.C2,sinkP1. C) annotation (Line(points={{40,-61}, - {40,-60},{70,-60}}, color={0,0,255})); - connect(heatSource1.C,heatExchangerWall1. WT2) - annotation (Line(points={{0,-10.8},{0,-22}}, color={191,95,0})); - connect(heatExchangerWall1.WT1,dynamicTwoPhaseFlowPipe1. CTh) - annotation (Line(points={{0,-38},{0,-52.3}}, color={191,95,0})); - connect(rampe.y,sourceP1. IPressure) - annotation (Line(points={{-86.6,-40.5},{-92,-40.5},{-92,-60},{-85,-60}})); - annotation (experiment(StopTime=1000), Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestDynamicTwoPhaseFlowPipe; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestDynamicTwoPhaseFlowRiser.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestDynamicTwoPhaseFlowRiser.mo deleted file mode 100644 index 236edda9..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestDynamicTwoPhaseFlowRiser.mo +++ /dev/null @@ -1,79 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestDynamicTwoPhaseFlowRiser - - ThermoSysPro.Fluid.HeatExchangers.DynamicTwoPhaseFlowRiser dynamicTwoPhaseFlowRiser( - L=20, - inertia=false, - advection=false, - dynamic_energy_balance=true, - Q(start={0.7975821689256883,0.7975821689256898,0.7975821689256883, - 0.7975821689256885,0.7975821689256883,0.797582168925689, - 0.7975821689256886,0.7975821689256887,0.7975821689256888, - 0.7975821689256888,0.7975821689256886}), - h(start={71016.12237181116,196401.3226637204,196412.6067675415, - 196423.89087136256,196435.17497518365,196446.45907900474, - 196457.7431828258,196469.0272866469,196480.31139046798, - 196491.59549428907,196502.87959811013,70825.9016030344}), - diffusion=true, - P(start={300000,281879.25838975,263692.15565175,245504.87004838, - 227317.40156239,209129.75017657,190941.91587368,172753.89863649, - 154565.69844777,136377.31529027,118188.74914676,100000})) annotation ( - Placement(transformation(extent={{-10,30},{10,48}}, rotation=0))); - BoundaryConditions.SourceP sourcePQ(ftype= - ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType.WaterSteamSimple) - annotation (Placement(transformation(extent={{-50,30},{-30,50}}, rotation=0))); - BoundaryConditions.SinkP sinkP - annotation (Placement(transformation(extent={{30,30},{50,50}}, rotation=0))); - Thermal.BoundaryConditions.HeatSource heatSource( - T0={1000,1100,1200,1300,1400,1500,1600,1700,1800,1900}, - option_temperature=2, - W0={0,0,0,0.0,0.0,0.0,0.0,0.0,0.0,0.0}) - annotation (Placement(transformation(extent={{-10,80},{10,100}}, - rotation=0))); - Thermal.HeatTransfer.HeatExchangerWall heatExchangerWall(Ns=10, - dynamic_energy_balance=false) - annotation (Placement(transformation(extent={{-10,60},{10,80}},rotation=0))); - Thermal.BoundaryConditions.HeatSource heatSource1( - T0={1000,1100,1200,1300,1400,1500,1600,1700,1800,1900}, - option_temperature=2, - W0={0,0,0,0,0,0,0,0,0,0}) - annotation (Placement(transformation(extent={{-10,0},{10,-20}},rotation=0))); - Thermal.HeatTransfer.HeatExchangerWall heatExchangerWall1(Ns=10, - dynamic_energy_balance=false) - annotation (Placement(transformation(extent={{-10,20},{10,0}}, rotation=0))); -equation - connect(sourcePQ.C, dynamicTwoPhaseFlowRiser.C1) annotation (Line(points={{-30, - 40},{-20,40},{-20,39.9},{-10,39.9}}, color={0,0,255})); - connect(dynamicTwoPhaseFlowRiser.C2, sinkP.C) annotation (Line(points={{10, - 39.9},{20,39.9},{20,40},{30,40}}, color={0,0,255})); - connect(heatSource.C,heatExchangerWall. WT2) annotation (Line(points={{0,80.2}, - {0,72}}, color={191,95,0})); - connect(heatExchangerWall.WT1, dynamicTwoPhaseFlowRiser.CTh1) - annotation (Line(points={{0,68},{0,45.3}}, color={0,0,0})); - connect(dynamicTwoPhaseFlowRiser.CTh2, heatExchangerWall1.WT1) - annotation (Line(points={{0,34.5},{0,12}}, color={0,0,0})); - connect(heatExchangerWall1.WT2, heatSource1.C) - annotation (Line(points={{0,8},{0,-0.2}}, color={0,0,0})); - annotation (experiment(StopTime=1000), Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestDynamicTwoPhaseFlowRiser; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestDynamicWaterHeating.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestDynamicWaterHeating.mo deleted file mode 100644 index a185b333..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestDynamicWaterHeating.mo +++ /dev/null @@ -1,306 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestDynamicWaterHeating - parameter ThermoSysPro.Units.xSI.Cv CvmaxWater(fixed=false, start=68.5297) - "Maximum CV (active if mode_caract=0)"; - parameter Real LambdaPipe(fixed=false,start=0.003003) - "Friction pressure loss coefficient (active if lambda_fixed=true)"; - - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP( - option_temperature=false, - h0=2750.e3, - P0=40e5) - annotation (Placement(transformation(extent={{-192,110},{-150,150}}, - rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP Puit_condenseur1( - option_temperature=false, P0(fixed=true) = 10e5) - annotation (Placement(transformation(extent={{124,-202},{160,-162}}, - rotation=0))); - ThermoSysPro.Fluid.PressureLosses.ControlValve ControlValve_eau( - mode_caract=0, - Cvmax=CvmaxWater, - Q(fixed=false, start=38.0656), - Pm(start=24.771e5), - h(start=906345), - C1(h_vol_1(start=906345), h(start=906345)), - Cv(start=34.26, fixed=false)) - annotation (Placement(transformation(extent={{88,-186}, - {108,-166}}, rotation=0))); - - ThermoSysPro.Fluid.HeatExchangers.DynamicWaterHeater WaterHeating( - ec=2e-3, - Ns=10, - Rv=1.2, - Lc=2.5, - PasL=0.028, - PasT=0.024, - ntubes3=1500, - Dc=0.018, - ntubes1=400, - ntubes2=400, - L1=11, - L2=11, - L3=22, - pipe_1( - z2=0.4, - Tp(start={500,501,502,503,504,505,506,507,508,510}), - h(start={813e3,826e3,850e3,865e3,880e3,895e3,905e3,920e3,935e3,950e3, - 965e3,980e3}), - hb(start={813e3,826e3,850e3,865e3,880e3,895e3,905e3,920e3,935e3,950e3, - 965e3}), - Q(start={202.4,202.4,202.4,202.4,202.4,202.4,202.4,202.4,202.4,202.4, - 202.4}), - P(start={222.700e5,222.690e5,222.680e5,222.670e5,222.660e5,222.650e5, - 222.640e5,222.630e5,222.620e5,222.610e5,222.600e5,222.590e5})), - pipe_2( - z2=0.4, - Tp(start={510,510.4,511,511.4,512,512.4,513,513.4,514,514.4}), - h(start={965e3,980e3,995e3,1010e3,1120e3,1130e3,1040e3,1050e3,1060e3, - 1070e3,1080e3,1080e3}), - hb(start={965e3,980e3,995e3,1010e3,1120e3,1130e3,1040e3,1050e3,1060e3, - 1070e3,1080e3}), - Q(start={57.57,57.57,57.57,57.57,57.57,57.57,57.57,57.57,57.57,57.57, - 57.57}), - P(start={222.600e5,222.590e5,222.580e5,222.570e5,222.560e5,222.550e5, - 222.540e5,222.530e5,222.520e5,222.51e5,222.50e5,222.48e5})), - C2ex(P(start=3900000)), - Wall_1( - Tp(start={510,510.4,511,511.4,512,512.4,513,513.4,514,514.4}), - Tp1(start={510,510.4,511,511.4,512,512.4,513,513.4,514,514.4}), - Tp2(start={510,510.4,511,511.4,512,512.4,513,513.4,514,514.4})), - Wall_2( - Tp(start={510,510.4,511,511.4,512,512.4,513,513.4,514,514.4}), - Tp1(start={510,510.4,511,511.4,512,512.4,513,513.4,514,514.4}), - Tp2(start={510,510.4,511,511.4,512,512.4,513,513.4,514,514.4})), - Wall_3( - Tp(start={510,510.4,511,511.4,512,512.4,513,513.4,514,514.4,515,515.4,516, - 516.4,517,517.4,518,518.4,519,519.4}), - Tp1(start={510,510.4,511,511.4,512,512.4,513,513.4,514,514.4,515,515.4, - 516,516.4,517,517.4,518,518.4,519,519.4}), - Tp2(start={510,510.4,511,511.4,512,512.4,513,513.4,514,514.4,515,515.4, - 516,516.4,517,517.4,518,518.4,519,519.4})), - volumeC(h(start=1082.65e3), P(start=222.48e5)), - volumeD1(h(start=953939), P(start=222.48e5)), - volumeD(h(start=812750), P(start=222.72e5)), - WaterHeating( - steady_state=true, - Vertical=false, - step_square=true, - Kvl=1, - Klp=1500, - Kvp=1200, - Kpa=0.2, - V=70, - Mp=50000, - zl(fixed=true, start=0.5), - P(fixed=true, start=39.5e5), - Cv(Q(fixed=false, start=35), P(fixed=false, start=39.5e5)), - hv(start=1463490), - hl(start=906345), - Pfond(start=39.542e5), - Tp1(start={500,501,502,503,504,505,506,507,508,510}), - Tp2(start={510,510.4,511,511.4,512,512.4,513,513.4,514,514.4}), - Tp3(start={510,510.4,511,511.4,512,512.4,513,513.4,514,514.4,515,515.4, - 516,516.4,517,517.4,518,518.4,519,519.4}), - Tp(start=509)), - pipe_3( - z2=1, - Tp(start={510,510.4,511,511.4,512,512.4,513,513.4,514,514.4,515,515.4,516, - 516.4,517,517.4,518,518.4,519,519.4}), - h(start={813e3,826e3,850e3,865e3,880e3,895e3,905e3,920e3,935e3,950e3, - 965e3,980e3,995e3,1010e3,1120e3,1130e3,1040e3,1050e3,1060e3,1070e3, - 1080e3,1080e3}), - hb(start={813e3,826e3,850e3,865e3,880e3,895e3,905e3,920e3,935e3,950e3, - 965e3,980e3,995e3,1010e3,1120e3,1130e3,1040e3,1050e3,1060e3,1070e3, - 1080e3}), - Q(start={202.4,202.4,202.4,202.4,202.4,202.4,202.4,202.4,202.4,202.4, - 202.4,202.4,202.4,202.4,202.4,202.4,202.4,202.4,202.4,202.4,202.4}), - P(start={222.700e5,222.690e5,222.680e5,222.670e5,222.660e5,222.650e5, - 222.640e5,222.630e5,222.620e5,222.610e5,222.600e5,222.590e5, - 222.580e5,222.570e5,222.560e5,222.550e5,222.540e5,222.530e5, - 222.520e5,222.51e5,222.50e5,222.48e5})), - P0c=4000000) annotation (Placement(transformation(extent={{-58,-90},{162,96}}, - rotation=0))); - - ThermoSysPro.Fluid.BoundaryConditions.Sink Puit_condenseur2 - annotation (Placement(transformation(extent={{-150,22},{-192,66}}, - rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLossWaterIn( K=35, Q(fixed=false, - start=250), - Pm(start=227e5)) annotation (Placement(transformation(extent={{-99, - -48},{-79,-28}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLossWaterOut( K=30, Q(fixed=false, - start=250), - Pm(start=222.48e5), - C2(h_vol_1(start=1082650), h(start=1082650))) - annotation (Placement(transformation(extent={{ - -80,34},{-100,54}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP1( - option_temperature=true, - P0=220e5, - h0=900e3, - T0=482.87) - annotation (Placement(transformation(extent={{-192,-60},{-150,-16}}, - rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.RefQ refQ(Q0=53, C1(h_vol_1(start= - 1082.65e3), h(start=1082.65e3))) - annotation (Placement(transformation(extent={{-115,34},{-135,54}}, rotation= - 0))); - ThermoSysPro.InstrumentationAndControl.Blocks.Tables.Table1DTemps Debit_eauA( - Table=[0,260; 378,260; 390,238; 438,275; 507,135; 936,65; 1404,50; 1872, - 50]) annotation (Placement(transformation(extent={{-195,78},{-175, - 98}}, rotation=0))); - ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Constante Level(k=0.50) - annotation (Placement(transformation(extent={{135, - -152},{113,-130}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.IdealCheckValve checkValve(Qmin=0.5, C2(h_vol_1( - start=2750.e3), h(start=2750.e3))) - annotation (Placement(transformation(extent={{-100,122},{-84,138}}, - rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLossPurge( K=1e-3, - T(fixed=false, start=461.56), - Q(fixed=false, start=35), - Pm(start=3900000), - C2(h_vol_1(start=906340), h(start=906340))) - annotation (Placement(transformation( - origin={54,-138}, - extent={{-10,-10},{10,10}}, - rotation=270))); - ThermoSysPro.InstrumentationAndControl.Blocks.Tables.Table1DTemps - Pression_purge(Table=[0,10e5; 378,10e5; 418,7e5; 1145,3.9e5; 2000,3.9e5]) - annotation (Placement(transformation(extent={{162,-178},{182, - -158}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe PressureLoss_Steam( - Q(fixed=false, start=35), - L=10, - D=0.1, - lambda=LambdaPipe, - Pm(start=40.34e5), - C1(h_vol_1(start=2750e3), h(start=2750e3))) - annotation (Placement(transformation(extent={{-48,162}, - {30,98}}, rotation=0))); - InstrumentationAndControl.Blocks.Tables.Table1DTemps Pression_Turbine1(Table= - [0,41.19e5; 378,41.19e5; 418,21.e5; 1145,5.e5; 2000,5.e5]) - annotation (Placement(transformation(extent={{-195,160},{ - -175,180}}, rotation=0))); - InstrumentationAndControl.Blocks.Tables.Table1DTemps Pression_eauA2( - Table=[0,222.72e5; 378,222.72e5; 438,230e5; 597,217e5; 1000, - 216e5; 1533,214e5; 1863,213.5e5; 2340,213e5; 2500,213e5]) - annotation (Placement(transformation(extent={{-195,-8},{-175, - 12}}, rotation=0))); - InstrumentationAndControl.Blocks.Tables.Table1DTemps Temperature_eauA1(Table= - [0,462; 448,462; 1155,420.0; 2000,420.0]) - annotation (Placement(transformation(extent={{-196,-84},{ - -176,-64}}, rotation=0))); -equation - connect(ControlValve_eau.C2, Puit_condenseur1.C) - annotation (Line(points={{108,-182},{124,-182}}, color={0,0,255})); - connect(Puit_condenseur2.C,refQ. C2) annotation (Line( - points={{-150,44},{-135,44}}, - color={255,0,0}, - thickness=0.5)); - connect(refQ.C1, singularPressureLossWaterOut.C2) - annotation (Line( - points={{-115,44},{-100,44}}, - color={255,0,0}, - thickness=0.5)); - connect(sourceP1.C, singularPressureLossWaterIn.C1) - annotation (Line( - points={{-150,-38},{-99,-38}}, - color={0,0,255}, - thickness=0.5)); - connect(singularPressureLossWaterOut.C1, WaterHeating.Ce2) - annotation (Line( - points={{-80,44},{-64,44},{-64,43.92},{-58,43.92}}, - color={255,0,0}, - thickness=0.5)); - connect(singularPressureLossWaterIn.C2, WaterHeating.Ce1) - annotation (Line( - points={{-79,-38},{-58,-38},{-58,-38.85}}, - color={0,0,255}, - thickness=0.5)); - connect(sourceP.C, checkValve.C1) annotation (Line( - points={{-150,130},{-100,130}}, - color={127,0,0}, - thickness=1)); - connect(singularPressureLossPurge.C1, WaterHeating.C2ex) - annotation (Line(points={{54,-128},{54,-90},{52,-90}})); - connect(Pression_purge.y, Puit_condenseur1.IPressure) - annotation (Line(points={{183,-168},{196,-168},{196,-182},{151,-182}})); - connect(checkValve.C2, PressureLoss_Steam.C1) annotation (Line( - points={{-84,130},{-48,130}}, - color={127,0,0}, - thickness=1)); - connect(WaterHeating.C1vap, PressureLoss_Steam.C2) annotation (Line( - points={{52,96},{52,130},{30,130}}, - color={127,0,0}, - thickness=1)); - connect(singularPressureLossPurge.C2, ControlValve_eau.C1) annotation (Line( - points={{54,-148},{54,-182},{88,-182}}, color={0,0,255})); - connect(Pression_Turbine1.y, sourceP.IPressure) annotation (Line(points={{ - -174,170},{-174,152},{-190,152},{-190,130},{-181.5,130}})); - connect(Pression_eauA2.y, sourceP1.IPressure) annotation (Line(points={{-174, - 2},{-174,-10},{-194,-10},{-194,-38},{-181.5,-38}})); - connect(Debit_eauA.y, refQ.IMassFlow) - annotation (Line(points={{-174,88},{-125,88},{-125,55}})); - connect(Level.y, ControlValve_eau.Ouv) - annotation (Line(points={{111.9,-141},{98,-141},{98,-165}})); - connect(Temperature_eauA1.y, sourceP1.ISpecificEnthalpyOrTemperature) - annotation (Line(points={{-175,-74},{-171,-74},{-171,-49}}, color={0,0,255})); - annotation (Diagram(coordinateSystem(extent={{-200,-200},{200,200}}), - graphics={ - Text( - extent={{-124,206},{130,146}}, - lineColor={0,0,255}, - textString= - "1 Ouv et 1 Cvmax = false, Qvap et niveau=true ou P cavite"), - Text( - extent={{-74,-190},{118,-222}}, - lineColor={0,0,255}, - textString= - "COP0l_coef_h =false , T_Dp_purge=true"), - Text( - extent={{-186,-198},{-84,-212}}, - lineColor={0,0,255}, - textString= - "Qvap=true ==> Erreur"), - Text( - extent={{16,170},{130,156}}, - lineColor={0,0,255}, - textString= - "checkValve Qmin =0.5"), - Text( - extent={{-136,168},{-18,154}}, - lineColor={0,0,255}, - textString="With guess values")}), - experiment(StopTime=1000, Tolerance=1e-004), - experimentSetupOutput, - Icon(graphics={ - Rectangle( - lineColor={128,128,128}, - extent={{-220,-240},{220,240}}, - radius=25.0), - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestDynamicWaterHeating; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestDynamicWaterHeatingOnePipe.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestDynamicWaterHeatingOnePipe.mo deleted file mode 100644 index 9d9573f8..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestDynamicWaterHeatingOnePipe.mo +++ /dev/null @@ -1,298 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestDynamicWaterHeatingOnePipe - parameter ThermoSysPro.Units.xSI.Cv CvmaxWater(fixed=false, start=68.5297) - "Maximum CV (active if mode_caract=0)"; - parameter Real LambdaPipe(fixed=false,start=0.003003) - "Friction pressure loss coefficient (active if lambda_fixed=true)"; - - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP( - option_temperature=false, - h0=2750.e3, - P0=40e5) - annotation (Placement(transformation(extent={{-192,110},{-150,150}}, - rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP Puit_condenseur1( - option_temperature=false, P0(fixed=true) = 10e5) - annotation (Placement(transformation(extent={{124,-202},{160,-162}}, - rotation=0))); - ThermoSysPro.Fluid.PressureLosses.ControlValve ControlValve_eau( - mode_caract=0, - Cvmax=CvmaxWater, - Q(fixed=false, start=38.0656), - Pm(start=24.771e5), - h(start=906345), - C1(h_vol_1(start=906345), h(start=906345)), - Cv(start=34.26, fixed=false)) - annotation (Placement(transformation(extent={{88,-186}, - {108,-166}}, rotation=0))); - - ThermoSysPro.Fluid.HeatExchangers.DynamicWaterHeaterOnePipe WaterHeating( - ec=2e-3, - Ns=10, - Rv=1.2, - Lc=2.5, - PasL=0.028, - PasT=0.024, - ntubes3=1500, - Dc=0.018, - ntubes1=400, - ntubes2=400, - L1=11, - L2=11, - L3=22, - C2ex(P(start=3953920.2674434385)), - Wall_3( - Tp(start={497.4216192636609,502.69423468274414,506.9759296757205, - 510.4223715331536,513.1750788320363,515.3580718035844, - 517.0775540203194,518.4230303861297,519.4690257033071, - 520.2769753151857,520.8970764101637,521.3700027404278, - 521.7284442755915,521.9984626845046,522.2006676867453, - 522.3512258466948,522.4627164232634,522.5440949624972, - 522.5983494885799,522.6391412946117}), - Tp1(start={510,510.4,511,511.4,512,512.4,513,513.4,514,514.4,515,515.4, - 516,516.4,517,517.4,518,518.4,519,519.4}), - Tp2(start={510,510.4,511,511.4,512,512.4,513,513.4,514,514.4,515,515.4, - 516,516.4,517,517.4,518,518.4,519,519.4})), - volumeC(h(start=1083284.4675828198), P(start=22239324.06759518)), - volumeD(h(start=812750.3853612987), P(start=222.72e5)), - WaterHeating( - steady_state=true, - Vertical=false, - step_square=true, - Kvl=1, - Klp=1500, - Kvp=1200, - Kpa=0.2, - V=70, - Mp=50000, - zl(fixed=true, start=0.5), - P(fixed=true, start=39.5e5), - Cv(Q(fixed=false, start=35), P(fixed=false, start=39.5e5)), - hv(start=1431115.3931413875), - hl(start=1083784.8007690564), - Pfond(start=39.542e5), - Tp1(start={500,501,502,503,504,505,506,507,508,510}), - Tp2(start={510,510.4,511,511.4,512,512.4,513,513.4,514,514.4}), - Tp3(start={502.0668232342926,506.5603551100769,510.17517354535573, - 513.0552006761686,515.3300849797615,517.1125155075463, - 518.4982207642074,519.5672140241339,520.3855368446975, - 521.0071208743625,521.475583235511,521.8258726586643, - 522.0857355520467,522.276996946816,522.4166635499804, - 522.5178617542946,522.5906259809204,522.6416937796047, - 522.6717272169116,522.6943081560064}), - Tp(start=522.7203786935834)), - pipe_3( - z2=1, - Tp(start={492.2865845099074,498.42043682971996,503.43932965553495, - 507.5119139438755,510.7928300582301,513.4186242679523, - 515.5070797958261,517.1581940553467,518.4558696409629, - 519.4698368458761,520.2575667844292,520.866061927203, - 521.3334770960658,521.6905573412918,521.9618953291181, - 522.1670184035046,522.3213189657012,522.4362044759667, - 522.5172341741693,522.5781571584042}), - h(start={812750.375,863278.0600600096,905331.3426571415,940130.751800155, - 968769.0495620216,992209.8823638612,1011293.6430149649, - 1026746.7829727756,1039192.5095809929,1049161.7546575891, - 1057103.8294379094,1063396.4712379558,1068355.1441001317, - 1072241.5390561111,1075271.2636377309,1077620.734010462, - 1079433.2969658624,1080824.6185597836,1081886.238523024, - 1082684.3963576336,1083284.4675828198,1083284.5}), - hb(start={813e3,826e3,850e3,865e3,880e3,895e3,905e3,920e3,935e3,950e3, - 965e3,980e3,995e3,1010e3,1120e3,1130e3,1040e3,1050e3,1060e3,1070e3, - 1080e3}), - Q(start={202.4,202.4,202.4,202.4,202.4,202.4,202.4,202.4,202.4,202.4, - 202.4,202.4,202.4,202.4,202.4,202.4,202.4,202.4,202.4,202.4,202.4}), - P(start={22269346.0,22267948.39153832,22266544.294239394, - 22265134.171108145,22263718.740660597,22262298.715698708, - 22260874.773397826,22259447.536273584,22258017.56171816, - 22256585.338030815,22255151.28511641,22253715.75831186, - 22252279.054104224,22250841.416797128,22249403.045444023, - 22247964.100585815,22246524.71050402,22245084.976831134, - 22243644.979685582,22242204.783200525,22240764.436308913,22239324.0})), - P0c=4000000) annotation (Placement(transformation(extent={{-58,-90},{162,96}}, - rotation=0))); - - ThermoSysPro.Fluid.BoundaryConditions.Sink Puit_condenseur2 - annotation (Placement(transformation(extent={{-150,22},{-192,66}}, - rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLossWaterIn( K=35, Q(fixed=false, - start=250), - Pm(start=22270672.891128033)) - annotation (Placement(transformation(extent={{-99, - -48},{-79,-28}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLossWaterOut( K=30, Q(fixed=false, - start=250), - Pm(start=22238086.493105933), - C2(h_vol_1(start=1082650), h(start=1082650))) - annotation (Placement(transformation(extent={{ - -80,34},{-100,54}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP1( - option_temperature=true, - P0=220e5, - h0=900e3, - T0=482.87) - annotation (Placement(transformation(extent={{-192,-60},{-150,-16}}, - rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.RefQ refQ(Q0=53, C1(h_vol_1(start= - 1082.65e3), h(start=1082.65e3))) - annotation (Placement(transformation(extent={{-115,34},{-135,54}}, rotation= - 0))); - ThermoSysPro.InstrumentationAndControl.Blocks.Tables.Table1DTemps Debit_eauA( - Table=[0,260; 378,260; 390,238; 438,275; 507,135; 936,65; 1404,50; 1872, - 50]) annotation (Placement(transformation(extent={{-195,78},{-175, - 98}}, rotation=0))); - ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Constante Level(k=0.50) - annotation (Placement(transformation(extent={{135, - -152},{113,-130}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.IdealCheckValve checkValve(Qmin=0.5, C2(h_vol_1( - start=2750.e3), h(start=2750.e3))) - annotation (Placement(transformation(extent={{-100,122},{-84,138}}, - rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLossPurge( K=1e-3, - T(fixed=false, start=461.56), - Q(fixed=false, start=35), - Pm(start=3953920.266328794), - C2(h_vol_1(start=906340), h(start=906340))) - annotation (Placement(transformation( - origin={54,-138}, - extent={{-10,-10},{10,10}}, - rotation=270))); - ThermoSysPro.InstrumentationAndControl.Blocks.Tables.Table1DTemps - Pression_purge(Table=[0,10e5; 378,10e5; 418,7e5; 1145,3.9e5; 2000,3.9e5]) - annotation (Placement(transformation(extent={{162,-178},{182, - -158}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe PressureLoss_Steam( - Q(fixed=false, start=35), - L=10, - D=0.1, - lambda=LambdaPipe, - Pm(start=40.34e5), - C1(h_vol_1(start=2750e3), h(start=2750e3))) - annotation (Placement(transformation(extent={{-48,162}, - {30,98}}, rotation=0))); - InstrumentationAndControl.Blocks.Tables.Table1DTemps Pression_Turbine1(Table= - [0,41.19e5; 378,41.19e5; 418,21.e5; 1145,5.e5; 2000,5.e5]) - annotation (Placement(transformation(extent={{-195,160},{ - -175,180}}, rotation=0))); - InstrumentationAndControl.Blocks.Tables.Table1DTemps Pression_eauA2( - Table=[0,222.72e5; 378,222.72e5; 438,230e5; 597,217e5; 1000, - 216e5; 1533,214e5; 1863,213.5e5; 2340,213e5; 2500,213e5]) - annotation (Placement(transformation(extent={{-195,-8},{-175, - 12}}, rotation=0))); - InstrumentationAndControl.Blocks.Tables.Table1DTemps Temperature_eauA1(Table= - [0,462; 448,462; 1155,420.0; 2000,420.0]) - annotation (Placement(transformation(extent={{-196,-84},{ - -176,-64}}, rotation=0))); -equation - connect(ControlValve_eau.C2, Puit_condenseur1.C) - annotation (Line(points={{108,-182},{124,-182}}, color={0,0,255})); - connect(Puit_condenseur2.C,refQ. C2) annotation (Line( - points={{-150,44},{-135,44}}, - color={255,0,0}, - thickness=0.5)); - connect(refQ.C1, singularPressureLossWaterOut.C2) - annotation (Line( - points={{-115,44},{-100,44}}, - color={255,0,0}, - thickness=0.5)); - connect(sourceP1.C, singularPressureLossWaterIn.C1) - annotation (Line( - points={{-150,-38},{-99,-38}}, - color={0,0,255}, - thickness=0.5)); - connect(singularPressureLossWaterOut.C1, WaterHeating.Ce2) - annotation (Line( - points={{-80,44},{-64,44},{-64,43.92},{-58,43.92}}, - color={255,0,0}, - thickness=0.5)); - connect(singularPressureLossWaterIn.C2, WaterHeating.Ce1) - annotation (Line( - points={{-79,-38},{-58,-38},{-58,-38.85}}, - color={0,0,255}, - thickness=0.5)); - connect(sourceP.C, checkValve.C1) annotation (Line( - points={{-150,130},{-100,130}}, - color={127,0,0}, - thickness=1)); - connect(singularPressureLossPurge.C1, WaterHeating.C2ex) - annotation (Line(points={{54,-128},{54,-90},{52,-90}})); - connect(Pression_purge.y, Puit_condenseur1.IPressure) - annotation (Line(points={{183,-168},{196,-168},{196,-182},{151,-182}})); - connect(checkValve.C2, PressureLoss_Steam.C1) annotation (Line( - points={{-84,130},{-48,130}}, - color={127,0,0}, - thickness=1)); - connect(WaterHeating.C1vap, PressureLoss_Steam.C2) annotation (Line( - points={{52,96},{52,130},{30,130}}, - color={127,0,0}, - thickness=1)); - connect(singularPressureLossPurge.C2, ControlValve_eau.C1) annotation (Line( - points={{54,-148},{54,-182},{88,-182}}, color={0,0,255})); - connect(Pression_Turbine1.y, sourceP.IPressure) annotation (Line(points={{ - -174,170},{-174,152},{-190,152},{-190,130},{-181.5,130}})); - connect(Pression_eauA2.y, sourceP1.IPressure) annotation (Line(points={{-174, - 2},{-174,-10},{-194,-10},{-194,-38},{-181.5,-38}})); - connect(Debit_eauA.y, refQ.IMassFlow) - annotation (Line(points={{-174,88},{-125,88},{-125,55}})); - connect(Level.y, ControlValve_eau.Ouv) - annotation (Line(points={{111.9,-141},{98,-141},{98,-165}})); - connect(Temperature_eauA1.y, sourceP1.ISpecificEnthalpyOrTemperature) - annotation (Line(points={{-175,-74},{-171,-74},{-171,-49}}, color={0,0,255})); - annotation (Diagram(coordinateSystem(extent={{-200,-200},{200,200}}), - graphics={ - Text( - extent={{-124,206},{130,146}}, - lineColor={0,0,255}, - textString= - "1 Ouv et 1 Cvmax = false, Qvap et niveau=true ou P cavite"), - Text( - extent={{-74,-190},{118,-222}}, - lineColor={0,0,255}, - textString= - "COP0l_coef_h =false , T_Dp_purge=true"), - Text( - extent={{-186,-198},{-84,-212}}, - lineColor={0,0,255}, - textString= - "Qvap=true ==> Erreur"), - Text( - extent={{16,170},{130,156}}, - lineColor={0,0,255}, - textString= - "checkValve Qmin =0.5"), - Text( - extent={{-136,168},{-18,154}}, - lineColor={0,0,255}, - textString="With guess values")}), - experiment(StopTime=1000, Tolerance=1e-004), - experimentSetupOutput, - Icon(graphics={ - Rectangle( - lineColor={128,128,128}, - extent={{-220,-240},{220,240}}, - radius=25.0), - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestDynamicWaterHeatingOnePipe; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestDynamicWaterSteamMultiFluidHeatExchanger.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestDynamicWaterSteamMultiFluidHeatExchanger.mo deleted file mode 100644 index 2ec43ae6..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestDynamicWaterSteamMultiFluidHeatExchanger.mo +++ /dev/null @@ -1,84 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestDynamicWaterSteamMultiFluidHeatExchanger - - BoundaryConditions.SourceQ sourceP(C(h_vol_2(start= - 71016.12237181065)), - Q0=10, - option_temperature=true) - annotation (Placement(transformation(extent={{-60,20},{-40,40}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP(C(h_vol_1(start= - 71016.1223718086))) - annotation (Placement(transformation(extent={{20,20},{40,40}}, rotation=0))); - HeatExchangers.DynamicWaterSteamMultiFluidsHeatExchanger dynamicMultiFluidHeatExchanger( - steady_state=true, - Cfg1(h_vol_2(start=71016.12237181155)), - Cfg2(h_vol_1(start=71016.12237181314)), - ExchangerMultiFluids( - P(start={300000.0,260001.59713260198,220002.3957916478,180002.39588440701, - 140001.5973181204,100000.0}), - Q(start={2702.7912398488343,2702.7912398488343,2702.7912398488343, - 2702.7912398488343,2702.7912398488343}), - h(start={71016.125,71016.125,71016.12237180988,71016.1223718091,71016.125, - 70825.8984375})), - TwoPhaseFlowPipe( - P(start={300000.0,260001.59801114563,220002.39710936273,180002.3972020214, - 140001.59819646296,100000.0}), - Q(start={3482.228448926616,3482.228448926616,3482.228448926616, - 3482.228448926616,3482.228448926616}), - h(start={71016.125,71016.125,71016.12237181216,71016.12237181274, - 71016.125,70825.8984375})), - ExchangerWall(Tp(start={290.03103270324897,290.0401814264445, - 290.0493302229999,290.05847909289605}), Tp1(start={ - 290.03103270331616,290.04018142654525,290.0493302231005, - 290.0584790929629})), - Ntubes=10, - Ns=4, - diffusion=true, - dynamic_mass_balance=true, - dynamic_energy_balance=false, - inertia=false) - annotation (Placement(transformation(extent={{-20,20},{0,40}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP1( - ftype=ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType.FlueGases, - P0=5000000, - T0=1273.15) - annotation (Placement(transformation(extent={{10,-10},{-10,10}}, rotation=90, - origin={-10,70}))); - - ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP1 - annotation (Placement(transformation(extent={{10,-10},{-10,10}}, - rotation=90, - origin={-10,-10}))); -equation - connect(sourceP.C, dynamicMultiFluidHeatExchanger.Cws1) - annotation (Line(points={{-40,30},{-20,30}}, color={0,0,0})); - connect(dynamicMultiFluidHeatExchanger.Cws2, sinkP.C) - annotation (Line(points={{0,30},{20,30}}, color={0,0,0})); - connect(sourceP1.C, dynamicMultiFluidHeatExchanger.Cfg1) - annotation (Line(points={{-10,60},{-10,35}}, color={0,0,0})); - connect(dynamicMultiFluidHeatExchanger.Cfg2, sinkP1.C) - annotation (Line(points={{-10,25},{-10,0}}, color={0,0,0})); - annotation (experiment(StopTime=1000), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestDynamicWaterSteamMultiFluidHeatExchanger; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestFixedPowerHeatExchanger.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestFixedPowerHeatExchanger.mo deleted file mode 100644 index cb583f64..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestFixedPowerHeatExchanger.mo +++ /dev/null @@ -1,53 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestFixedPowerHeatExchanger - - ThermoSysPro.Fluid.HeatExchangers.FixedPowerHeatExchanger - plateHeatExchanger(region_c=ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region.Region_1, - region_f=ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region.Region_1, - DW=1.e6) annotation (Placement(transformation(extent={{-20,40},{0,60}}, - rotation=0))); - BoundaryConditions.SourcePQ sourceP2(T0=340, - option_temperature=true) - annotation (Placement(transformation(extent={{-60,20},{-40,40}}, rotation=0))); - BoundaryConditions.SourcePQ sourceP3(option_temperature= - true) - annotation (Placement(transformation(extent={{-60,40},{-40,60}}, rotation=0))); - BoundaryConditions.Sink puitsP2 - annotation (Placement(transformation( - extent={{20,20},{40,40}}, rotation=0))); - BoundaryConditions.Sink puitsP3 - annotation (Placement(transformation( - extent={{20,40},{40,60}}, rotation=0))); -equation - connect(sourceP3.C, plateHeatExchanger.Ef) - annotation (Line(points={{-40,50},{-20,50}}, color={0,0,0})); - connect(plateHeatExchanger.Sf, puitsP3.C) annotation (Line(points={{-0.2,50.1}, - {9.9,50.1},{9.9,50},{20,50}}, color={0,0,0})); - connect(plateHeatExchanger.Sc, puitsP2.C) annotation (Line(points={{-4.2,44}, - {-4,44},{-4,30},{20,30}}, color={0,0,0})); - connect(plateHeatExchanger.Ec, sourceP2.C) annotation (Line(points={{-15.8,44}, - {-16,44},{-16,30},{-40,30}}, color={0,0,0})); - annotation (experiment(StopTime=1000), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestFixedPowerHeatExchanger; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestFossilFuelBoiler.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestFossilFuelBoiler.mo deleted file mode 100644 index 95d64b9f..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestFossilFuelBoiler.mo +++ /dev/null @@ -1,82 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestFossilFuelBoiler - import ThermoSysPro; - ThermoSysPro.Fluid.Boilers.FossilFuelBoiler FossilFuelBoiler( - Wloss=0, - Ke=1.e6, - Tsf=386.16) - annotation (Placement(transformation(extent={{-45,-51},{45,51}}, rotation=0))); - ThermoSysPro.Fluid.Combustion.BoundaryConditions.FuelSourcePQ fuelSourcePQ( - T0=338.16, - Cp=1282, - Xh=0.24403, - Xc=0.75323, - Q0=1.45) annotation (Placement(transformation(extent={{-36,-78},{0,-41}}, - rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ( - Xco2=0, - Xh2o=0.01, - Q0=27., - Xo2=0.233, - ftype=ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType.FlueGases, - T0=298.16, - option_temperature=true) - annotation (Placement(transformation(extent={{-110,-50},{-71,-13}}, - rotation=0))); - - ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP annotation (Placement(transformation( - extent={{68,-51},{110,-12}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ( - Q0=24., - h0=600e3, - P0=14000000) - annotation (Placement(transformation(extent={{-107,14},{-71,48}}, rotation= - 0))); - ThermoSysPro.Fluid.BoundaryConditions.Sink sink annotation (Placement(transformation( - extent={{74,13},{110,49}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss(K=1e-3) - annotation (Placement(transformation(extent={{-64,25},{-56,37}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss1(K=1e-3) - annotation (Placement(transformation(extent={{57,25},{65,37}}, rotation=0))); -equation - connect(sourceQ.C, FossilFuelBoiler.Cair) annotation (Line( - points={{-71,-31.5},{-63.5,-31.5},{-63.5,-31.62},{-45,-31.62}}, - color={0,0,0}, - thickness=1)); - connect(FossilFuelBoiler.Cfg, sinkP.C) annotation (Line( - points={{45,-31.62},{62,-31.62},{62,-31.5},{68,-31.5}}, - color={0,0,0}, - thickness=1)); - connect(fuelSourcePQ.C, FossilFuelBoiler.Cfuel) annotation (Line(points={ - {0,-59.5},{0,-40.8}}, color={0,0,0})); - connect(sourcePQ.C, singularPressureLoss.C1) - annotation (Line(points={{-71,31},{-64,31}}, color={0,0,255})); - connect(singularPressureLoss.C2, FossilFuelBoiler.Cws1) annotation (Line( - points={{-56,31},{-50,31},{-50,30.6},{-45,30.6}}, color={0,0,255})); - connect(singularPressureLoss1.C2, sink.C) - annotation (Line(points={{65,31},{74,31}}, color={0,0,255})); - connect(FossilFuelBoiler.Cws2, singularPressureLoss1.C1) annotation (Line( - points={{45,30.6},{51,30.6},{51,31},{57,31}}, color={0,0,255})); - annotation ( Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestFossilFuelBoiler; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestFresnelField.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestFresnelField.mo deleted file mode 100644 index 17a20108..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestFresnelField.mo +++ /dev/null @@ -1,172 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestFresnelField - parameter Integer Nt=3 "Number of trains"; -public - ThermoSysPro.Thermal.HeatTransfer.HeatExchangerWall heatExchangerWall( - ntubes=1, - steady_state=true, - D=0.07, - e=0.004, - Ns=30, - T0=500, - lambda=20, - cpw=500, - rhow=8000, - Tp(start={628.0843201819387,627.9310075597404,627.8220175907211, - 627.7368992018166,627.6679716601412,627.6112649113921, - 627.5643995456558,627.5258238160011,627.4944728950805, - 627.4695948757801,627.4506537300122,627.4372716636091, - 627.4291939746797,627.426267226699,627.428426585461,627.4356896138493, - 627.4481553612113,627.4660085346942,627.4895290639054, - 627.5191082002851,627.5552734790091,627.5987264837852, - 627.6504001032708,627.7115474128314,627.7838847016081, - 627.8698331666657,627.9729350144038,629.4253815385038, - 633.135688507217,636.2622387488283}), - Tp1(start={610.2709965207655,610.0984334604643,609.9757644369477, - 609.8799665740102,609.8023932206363,609.7385750723525, - 609.6858335131916,609.6424216866362,609.6071408778737, - 609.5791446660139,609.5578296140685,609.5427704711935, - 609.533680491646,609.5303869740989,609.5328169418054,609.540990157294, - 609.5550181389947,609.5751088339957,609.6015773714007, - 609.6348642175905,609.6755632868924,609.7244644309128, - 609.7826179283193,609.8514345863706,609.9328467812495, - 610.0295806069864,610.1456244663702,611.7808730290952, - 615.9622431406954,619.4903247027197}), - Tp2(start={644.9596553467713,644.824579502235,644.7285482944553, - 644.6535470354397,644.592810046145,644.5428402353538, - 644.5015416419557,644.4675473586904,644.4399193877858, - 644.4179953736024,644.4013031238645,644.3895098327511, - 644.3823911261306,644.3798118348441,644.3817148399042,644.38811560583, - 644.3991013774125,644.4148348525065,644.4355626048274, - 644.4616292617266,644.4934994867675,644.531791236838, - 644.5773261834961,644.6312079828199,644.6949482231629, - 644.7706792525222,644.8615205623447,646.1407907783827, - 649.404839172216,652.1510013554424}), - L=1e4/11.46) - annotation (Placement(transformation(extent={{-40,-36},{40,-2}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceP(Q0=11, h0=1500e3) - annotation (Placement(transformation(extent={{-101,-55},{-81,-35}}, - rotation=0))); - ThermoSysPro.Fluid.HeatExchangers.DynamicTwoPhaseFlowPipe - dynamicTwoPhaseFlowPipe( - ntubes=1, - steady_state=true, - rugosrel=0.00005, - dpfCorr=1, - Ns=30, - P(start={12512365.778485337,12512269.4730028,12512159.010926897, - 12512028.619141866,12511878.28140543,12511707.984695798, - 12511517.718132183,12511307.472416837,12511077.239500606, - 12510827.012364838,12510556.784871727,12510266.551658653, - 12509956.30806284,12509626.050068311,12509275.774270097, - 12508905.477852736,12508515.15858121,12508104.814803492, - 12507674.445464557,12507224.050132478,12506753.629037917, - 12506263.183129327,12505752.714147368,12505222.224723859, - 12504671.718513375,12504101.200370008,12503510.676589508, - 12502896.415784404,12502231.48634808,12501522.52554151, - 12500776.553197166,12500000.0}), - h(start={1500000.0,1536254.1810191544,1572547.5410785251,1608868.7411348266, - 1645211.676359884,1681572.2077847784,1717947.2125321354, - 1754334.1766730088,1790730.9833788855,1827135.788296852, - 1863546.9394607474,1899962.9220483964,1936382.3178860326, - 1972803.7739566958,2009225.9764870608,2045647.6282789519, - 2082067.4276265746,2118484.0474634594,2154896.1134394333, - 2191302.179544121,2227700.6996020116,2264089.9923674623, - 2300468.196934767,2336833.213464297,2373182.6211112435, - 2409513.559261445,2445822.5467506223,2482105.1942732874, - 2518015.7979130256,2552967.680496474,2587102.355161259, - 82548.43470391157}), - D=0.07, - inertia=false, - L=1e4/11.46) annotation (Placement(transformation(extent={{-36, - -67},{36,-20}}, rotation=0))); - ThermoSysPro.Solar.Collectors.FresnelField champThermosolaireLFR_N( - Ns=30, - T(start=fill(500, 30)), - F12=0.6366, - A=1e4, - T0=303) - annotation (Placement(transformation(extent={{-40,-16},{40,72}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP( - h0=2000e3, P0=125e5) annotation (Placement(transformation(extent={{80,-54}, - {100,-34}}, rotation=0))); - ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Rampe DNI( - Starttime=100, - Initialvalue=100, - Duration=3600, - Finalvalue=900) annotation (Placement(transformation(extent={{72,39},{58,53}}, - rotation=0))); - ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Rampe Angles( - Starttime=100, - Initialvalue=45, - Finalvalue=45, - Duration=3600) annotation (Placement(transformation(extent={{-26,77},{-12, - 90}}, - rotation=0))); - ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Rampe Q( - Starttime=100, - Duration=3600, - Initialvalue=2, - Finalvalue=3) annotation (Placement(transformation(extent={{7,-6.5},{-7, - 6.5}}, rotation=90, - origin={-90,-9.5}))); - Junctions.MassFlowMultiplier massFlowMultiplier1(alpha=1/Nt) - annotation (Placement(transformation(extent={{-70,-54},{-50,-34}}))); - Junctions.MassFlowMultiplier massFlowMultiplier2(alpha=Nt) - annotation (Placement(transformation(extent={{52,-54},{72,-34}}))); -equation - connect(champThermosolaireLFR_N.P, heatExchangerWall.WT2) - annotation (Line(points={{0,1.6},{0,-15.6}}, color={191,95,0})); - connect(heatExchangerWall.WT1, dynamicTwoPhaseFlowPipe.CTh) annotation (Line( - points={{0,-22.4},{0,-36.45}}, color={191,95,0})); - connect(champThermosolaireLFR_N.SunDNI, DNI.y) - annotation (Line(points={{44,45.6},{51,45.6},{51,46},{57.3,46}})); - connect(champThermosolaireLFR_N.SunA, Angles.y) - annotation (Line(points={{36.8,58.8},{36.8,84},{28,84},{28,83.5},{-11.3, - 83.5}})); - connect(sourceP.C, massFlowMultiplier1.Ce) annotation (Line(points={{-81,-45}, - {-76.5,-45},{-76.5,-44},{-70,-44}}, color={0,0,0})); - connect(massFlowMultiplier1.Cs, dynamicTwoPhaseFlowPipe.C1) annotation (Line( - points={{-50,-44},{-44,-44},{-44,-43.5},{-36,-43.5}}, color={0,0,0})); - connect(dynamicTwoPhaseFlowPipe.C2, massFlowMultiplier2.Ce) annotation (Line( - points={{36,-43.5},{47,-43.5},{47,-44},{52,-44}}, color={0,0,0})); - connect(massFlowMultiplier2.Cs, sinkP.C) - annotation (Line(points={{72,-44},{80,-44}}, color={0,0,0})); - connect(Q.y, sourceP.IMassFlow) annotation (Line(points={{-90,-17.2},{-91, - -17.2},{-91,-40}}, color={0,0,255})); - connect(Angles.y, champThermosolaireLFR_N.SunG) annotation (Line(points={{ - -11.3,83.5},{27.2,83.5},{27.2,58.8}}, color={0,0,255})); - annotation ( - Documentation(revisions=" -

Author

- -", info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-"), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - experiment(StopTime=5000), - Diagram(graphics={Text( - extent={{-36,-64},{54,-82}}, - lineColor={28,108,200}, - textString="Fresnel field with Nt=%Nt trains")})); -end TestFresnelField; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestGTCombustionChamber.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestGTCombustionChamber.mo deleted file mode 100644 index c0db0246..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestGTCombustionChamber.mo +++ /dev/null @@ -1,83 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestGTCombustionChamber - import ThermoSysPro; - - ThermoSysPro.Fluid.BoundaryConditions.Sink Puits_Fumees2 - annotation (Placement(transformation( - origin={149,-2}, - extent={{23,-24},{-23,24}}, - rotation=180))); - ThermoSysPro.Fluid.Combustion.CombustionChambers.GTCombustionChamber GTCombustionChamber2(Cfg(P( - fixed=true, start=14.1e5)), kcham(fixed=false, start=1)) annotation ( - Placement(transformation(extent={{-67,-68},{67,64}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ2( - Q0=0, - P0=15e5, - h0=300e3) - annotation (Placement(transformation(extent={{-112,48},{-72,88}}, - rotation=0))); - ThermoSysPro.Fluid.Combustion.BoundaryConditions.FuelSourcePQ sourceCombustible2( - Hum=0, - Xo=0, - Xn=0, - Xs=0, - rho=0.838, - Xc=0.755, - Xh=0.245, - Cp=2255, - T0=410, - Q0=9.30, - LHV=47500e3) annotation (Placement(transformation(extent={{-107,-93},{-71,-57}}, - rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ Source_Fumees2( - Xso2=0, - Xco2=0.0, - Xo2=0.23, - Xh2o=0.01, - P0=15e5, - Q0=415, - T0=680, - ftype=ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType.FlueGases, - option_temperature=true) - annotation (Placement(transformation(extent={{-174,-26},{-128,22}}, - rotation=0))); - -equation - connect(GTCombustionChamber2.Cws, sourcePQ2.C) - annotation (Line(points={{-40.2,57.4},{-40.2,68},{-72,68}})); - connect(GTCombustionChamber2.Cfuel, sourceCombustible2.C) annotation (Line( - points={{0,-61.4},{0,-75},{-71,-75}}, color={0,0,0})); - connect(GTCombustionChamber2.Cfg, Puits_Fumees2.C) annotation (Line( - points={{60.3,-2},{126,-2}}, - color={0,0,0}, - thickness=1)); - connect(Source_Fumees2.C, GTCombustionChamber2.Ca) annotation (Line( - points={{-128,-2},{-60.3,-2}}, - color={0,0,0}, - thickness=1)); - annotation (Diagram(coordinateSystem( - preserveAspectRatio=false, - extent={{-200,-200},{200,200}}, - initialScale=0.1)), Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestGTCombustionChamber; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestGasTurbine.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestGasTurbine.mo deleted file mode 100644 index fc8a96bb..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestGasTurbine.mo +++ /dev/null @@ -1,105 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestGasTurbine - - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ( - P0=1.013e5, - Q0=600, - T0=29.4 + 273.16, - option_temperature=true, - Xco2=0, - Xh2o=0, - Xo2=0.20994, - Xso2=0, - ftype=ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType.FlueGases) - annotation (Placement(transformation(extent={{-70,-10},{-50,10}}))); - - BoundaryConditions.SinkP sink - annotation (Placement(transformation(extent={{60,-10},{80,10}}))); - ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Constante humidity(k=0.93) - annotation (Placement(transformation(extent={{-100,30},{-80,50}}))); - ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Rampe fuel( - Starttime=200, - Duration=800, - Initialvalue=13.507, - Finalvalue=8.756) - annotation (Placement(transformation(extent={{-40,60},{-20,80}}))); - ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Rampe air( - Starttime=200, - Duration=800, - Initialvalue=592.7, - Finalvalue=415.70) - annotation (Placement(transformation(extent={{-98,0},{-78,20}}))); - Combustion.BoundaryConditions.FuelSourcePQ fuelSourcePQ( - Q0=13.4368286133, - T0=185 + 273.16, - LHV=46989e3, - Cp=2255, - Xc=0.755, - Xh=0.245, - rho=0.838) annotation (Placement(transformation(extent={{-20,40},{0,60}}))); - BoundaryConditions.SourcePQ water(Q0=0) - annotation (Placement(transformation(extent={{-60,40},{-40,60}}))); - Machines.GasTurbine gasTurbine( - comp_tau_n=14.0178, - comp_eff_n=0.87004, - exp_tau_n=0.06458, - exp_eff_n=0.89045, - TurbQred=0.0175634, - Kcham=2.02088, - Wpth=1e6, - Compresseur( - Ps(start=1404200.0), - Te(start=302.56000000000006), - Tis(start=630.0), - Ts(start=729.0)), - TurbineAgaz(Tis(start=847.0)), - chambreCombustionTAC( - Psf(start=1310000.0), - Tea(start=729.0), - Tsf(start=1532.57)), - xAIR( - ppvap0(start=4104.0), - rho_air(start=1.0836), - rho_vap(start=0.029))) - annotation (Placement(transformation(extent={{-30,-28},{30,28}}))); -equation - connect(air.y, sourcePQ.IMassFlow) - annotation (Line(points={{-77,10},{-60,10},{-60,5}}, color={0,0,255})); - connect(humidity.y, gasTurbine.Huminide) annotation (Line(points={{-79,40},{ - -60,40},{-60,16.8},{-31.2,16.8}},color={0,0,255})); - connect(fuel.y, fuelSourcePQ.IMassFlow) - annotation (Line(points={{-19,70},{-10,70},{-10,55}}, - color={0,0,255})); - connect(sourcePQ.C, gasTurbine.Entree_air) annotation (Line(points={{-50,0},{ - -32,0},{-32,3.55271e-015},{-30,3.55271e-015}}, color={0,0,0})); - connect(fuelSourcePQ.C, gasTurbine.Entree_combustible) - annotation (Line(points={{0,50},{18,50},{18,28}}, color={0,0,0})); - connect(water.C, gasTurbine.Entree_eau_combustion) - annotation (Line(points={{-40,50},{-18,50},{-18,28}}, color={0,0,0})); - connect(gasTurbine.Sortie_fumees, sink.C) - annotation (Line(points={{30,3.55271e-015},{46,3.55271e-015},{46,0},{60,0}}, - color={0,0,0})); - annotation ( Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-"), - experiment(StopTime=1200)); -end TestGasTurbine; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestGenericCombustion.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestGenericCombustion.mo deleted file mode 100644 index b5802c7d..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestGenericCombustion.mo +++ /dev/null @@ -1,86 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestGenericCombustion - - ThermoSysPro.Fluid.Combustion.CombustionChambers.GenericCombustion genericCombustionCCS( - kcham=0.1, - Acham=275, - Xbf=0, - ImbCV=0.05, - ImbBF=0.0, - Psf(start=113275)) annotation (Placement(transformation(extent={{-32,-56},{ - 92,72}}, - rotation=0))); - ThermoSysPro.Fluid.Combustion.BoundaryConditions.FuelSourcePQ fuelSourcePQ( - Xn=0.0208, - Xashes=0.136, - Cp=1200, - rho=1100, - LHV=29245e3, - Xc=0.719, - Xh=0.0414, - Xo=0.086, - Xs=0.0044, - Vol=0.286, - Q0=57.20, - T0=358.15, - Hum=0.08) annotation (Placement(transformation(extent={{24,-95},{58,-57}}, - rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ SourcePQ_Water(Q0=0, P0=100000) - annotation (Placement(transformation(extent={{-83,-3},{-47,31}}, rotation= - 0))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourceAir( - Xso2=0, - Q0=609.29, - Xh2o=0.01, - Xo2=0.230, - Xco2=0, - P0=191000, - T0=524.89, - ftype=ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType.FlueGases, - option_temperature=true) - annotation (Placement(transformation(extent={{-54,-94},{-10,-54}}, - rotation=0))); - - ThermoSysPro.Fluid.BoundaryConditions.Sink sink annotation (Placement(transformation( - extent={{30,70},{74,112}},rotation=0))); -equation - connect(fuelSourcePQ.C, genericCombustionCCS.Cfuel) annotation (Line(points={{58,-76}, - {73.4,-76},{73.4,-49.6}}, color={0,0,0})); - connect(SourcePQ_Water.C, genericCombustionCCS.Cws) annotation (Line(points={{-47,14}, - {-36,14},{-36,14.4},{-25.8,14.4}}, color={0,0,0})); - connect(genericCombustionCCS.Ca, sourceAir.C) annotation (Line( - points={{11.4,-49.6},{11.4,-74},{-10,-74}}, - color={0,0,0}, - thickness=1)); - connect(genericCombustionCCS.Cfg, sink.C) annotation (Line( - points={{11.4,65.6},{11.4,91},{30,91}}, - color={0,0,0}, - thickness=1)); - annotation ( Documentation(revisions=" -

Author

- -", info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-"), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})})); -end TestGenericCombustion; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestGenericCombustion1D.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestGenericCombustion1D.mo deleted file mode 100644 index 3407226d..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestGenericCombustion1D.mo +++ /dev/null @@ -1,144 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestGenericCombustion1D - - parameter Integer NCEL = 7; - - ThermoSysPro.Fluid.Combustion.CombustionChambers.GenericCombustion1D genericCombustionCCS( - NCEL=7, - Qm(fixed=false), - Qsf(fixed=false), - kcham(fixed=true) = 0.1, - Acham=275, - Xbf=0, - ImbCV=0.05, - EPSPAR=0.7, - Kec=8.8, - SM={639.92,198.58,466.48,466.48,466.48,358.56,358.56}, - ImbBF=0.0, - Psf(start=113275)) annotation (Placement(transformation(extent={{-62,-56},{62, - 72}}, rotation=0))); - ThermoSysPro.Fluid.Combustion.BoundaryConditions.FuelSourcePQ fuelSourcePQ( - Xn=0.0208, - Xashes=0.136, - Cp=1200, - rho=1100, - LHV=29245e3, - Xc=0.719, - Xh=0.0414, - Xo=0.086, - Xs=0.0044, - Vol=0.286, - Q0=57.20, - T0=358.15, - Hum=0.08) annotation (Placement(transformation(extent={{-106,-43},{-72,-5}}, - rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourceAir( - Xso2=0, - Q0=609.29, - Xh2o=0.01, - Xo2=0.230, - Xco2=0, - P0=191000, - T0=524.89, - option_temperature=true, - ftype=ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType.FlueGases) - annotation (Placement(transformation(extent={{-44,-98},{0,-58}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.Sink sink annotation (Placement(transformation( - extent={{0,70},{44,112}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ SourcePQ_Water(Q0=0, P0=100000) - annotation (Placement(transformation(extent={{-107,23},{-71,57}}, rotation= - 0))); - ThermoSysPro.Fluid.HeatExchangers.DynamicTwoPhaseFlowPipe PipeWaterSteam( - Ns=7, - z2=56, - rugosrel=5e-5, - ntubes=403, - L=58, - D=0.0327, - C2(Q(fixed=false, start=486.69), P( - fixed=false, - start=1.96318e+07, - displayUnit="Pa")), - dpfCorr=3.5) - annotation (Placement(transformation( - origin={91,8}, - extent={{49,16},{-49,-16}}, - rotation=270))); - ThermoSysPro.Thermal.HeatTransfer.HeatExchangerWall paroiEcrans( - Ns=7, - lambda=40, - steady_state=true, - ntubes=403, - L=58, - D=0.0327, - e=0.001) - annotation (Placement(transformation( - origin={73,7.5}, - extent={{51.5,-15},{-51.5,15}}, - rotation=270))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkWaterSteam2( - option_temperature=false, - Q(start=486.69, fixed=true), - h0=2.5e+06, - P0(fixed=false) = 19621600) - annotation (Placement(transformation( - origin={90,90.5}, - extent={{14.5,-15},{-14.5,15}}, - rotation=270))); - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceEcrans( - h0=1.292e+06, - option_temperature=false, - P0=20112000) - annotation (Placement(transformation( - origin={91,-81}, - extent={{15,-15},{-15,15}}, - rotation=270))); -equation - connect(fuelSourcePQ.C, genericCombustionCCS.Cfuel) - annotation (Line(points={{-72,-24},{-55.8,-24}}, color={0,0,0})); - connect(genericCombustionCCS.Cfg, sink.C) annotation (Line( - points={{0,65.6},{0,91},{0,91}}, - color={0,0,0}, - thickness=1)); - connect(genericCombustionCCS.Ca, sourceAir.C) annotation (Line( - points={{0,-49.6},{0,-78}}, - color={0,0,0}, - thickness=1)); - connect(SourcePQ_Water.C, genericCombustionCCS.Cws) - annotation (Line(points={{-71,40},{-55.8,40}}, color={0,0,255})); - connect(genericCombustionCCS.Cth,paroiEcrans. WT2) annotation (Line(points={{55.8,8}, - {68,8},{68,7.5},{76,7.5}}, color={191,95,0})); - connect(paroiEcrans.WT1,PipeWaterSteam. CTh) annotation (Line(points={{70,7.5}, - {71,7.5},{71,8},{86.2,8}}, color={191,95,0})); - connect(sourceEcrans.C,PipeWaterSteam. C1) - annotation (Line(points={{91,-66},{91,-41}}, color={0,0,255})); - connect(PipeWaterSteam.C2,sinkWaterSteam2. C) annotation (Line(points={{91,57}, - {91,76},{90,76}}, color={0,0,255})); - annotation ( Documentation(revisions=" -

Author

- -", info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-"), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})})); -end TestGenericCombustion1D; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestGridFurnace.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestGridFurnace.mo deleted file mode 100644 index 082d7f17..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestGridFurnace.mo +++ /dev/null @@ -1,90 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestGridFurnace - import ThermoSysPro; - - parameter Integer NCEL = 7; - - ThermoSysPro.Fluid.Combustion.BoundaryConditions.FuelSourcePQ fuelSourcePQ( - Xn=0.0208, - Xashes=0.136, - Cp=1200, - rho=1100, - LHV=29245e3, - Xc=0.719, - Xh=0.0414, - Xo=0.086, - Xs=0.0044, - Vol=0.286, - Q0=57.20, - T0=358.15, - Hum=0.08) annotation (Placement(transformation(extent={{-106,-23},{-72,15}}, - rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourceAir( - Xso2=0, - Xh2o=0.01, - Xo2=0.230, - Xco2=0, - T0=300, - Q0=10, - P0=1.9e5, - option_temperature=true, - ftype=ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType.FlueGases) - annotation (Placement(transformation(extent={{-74,-80},{-30,-40}}, - rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.Sink sink(option_temperature=true) - annotation (Placement(transformation( - extent={{28,50},{72,92}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ SourcePQ_Water(P0=1.e5, Q0=1) - annotation (Placement(transformation(extent={{89,13},{53,47}}, rotation= - 0))); - ThermoSysPro.Fluid.Combustion.CombustionChambers.GridFurnace gridFurnace - annotation (Placement(transformation(extent={{-40,-40},{40,40}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceAir1( - Xso2=0, - Xh2o=0.01, - Xo2=0.230, - Xco2=0, - option_temperature=true, - T0=300, - Q0=10, - ftype=ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType.FlueGases) - annotation (Placement(transformation(extent={{-90,4},{-46,44}}, rotation=0))); -equation - connect(fuelSourcePQ.C, gridFurnace.Com) - annotation (Line(points={{-72,-4},{-36,-4}}, color={0,0,0})); - connect(gridFurnace.Cfg, sink.C) - annotation (Line(points={{0,36},{0,71},{28,71}}, color={0,0,0})); - connect(SourcePQ_Water.C, gridFurnace.port_eau_refroid) - annotation (Line(points={{53,30},{32,30},{32,12}}, color={0,0,0})); - connect(sourceAir1.C, gridFurnace.Ca2) - annotation (Line(points={{-46,24},{-20,24}}, color={0,0,0})); - connect(sourceAir.C, gridFurnace.Ca1) - annotation (Line(points={{-30,-60},{0,-60},{0,-36}}, color={0,0,0})); - annotation ( Documentation(revisions=" -

Author

- -", info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-"), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})})); -end TestGridFurnace; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestHeatPumpCompressor.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestHeatPumpCompressor.mo deleted file mode 100644 index b1db3c7a..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestHeatPumpCompressor.mo +++ /dev/null @@ -1,53 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestHeatPumpCompressor - ThermoSysPro.Fluid.Machines.HeatPumpCompressor Compressor( - Pe(fixed=false, start=100000), - Ts(fixed=false, start=680)) annotation (Placement(transformation(extent={{ - -52,-52},{48,52}}, rotation=0))); - BoundaryConditions.SourceQ SourceQ1( - Xso2=0, - Xco2=0.0, - Xh2o=0.003, - Xo2=0.23, - Q0=420, - ftype=ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType.C3H3F5, - h0=3.e4, - T0=288, - option_temperature=false) - annotation (Placement(transformation(extent={{-104,-10},{-84,10}}, - rotation=0))); - - ThermoSysPro.Fluid.BoundaryConditions.SinkP SinkP1(P0=1580000, - option_temperature=false) - annotation (Placement(transformation( - origin={96,0}, - extent={{10,-10},{-10,10}}, - rotation=180))); -equation - connect(SourceQ1.C, Compressor.C1) - annotation (Line(points={{-84,0},{-52,0}}, color={0,0,0})); - connect(SinkP1.C, Compressor.C2) - annotation (Line(points={{86,0},{48,0}}, color={0,0,0})); - annotation ( Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestHeatPumpCompressor; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestIdealCheckValve.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestIdealCheckValve.mo deleted file mode 100644 index 1ecc9dbf..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestIdealCheckValve.mo +++ /dev/null @@ -1,111 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestIdealCheckValve - - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP1 - annotation (Placement(transformation( - extent={{-60,-80},{-40,-60}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP puitsP1( - P0=6e5) annotation (Placement(transformation( - extent={{80,-80},{100,-60}}, rotation=0))); - ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Pulse pulse( - amplitude=6e5, - width=50, - period=100, - offset=3e5) annotation (Placement(transformation(extent={{-100,-80},{-80, - -60}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.IdealCheckValve idealCheckValve3 - annotation (Placement(transformation(extent={{10,-80},{30,-60}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe perteDP2 - annotation (Placement(transformation( - extent={{-30,-80},{-10,-60}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe perteDP3 - annotation (Placement(transformation( - extent={{50,-80},{70,-60}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP - annotation (Placement(transformation(extent= - {{-104,20},{-84,40}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP puitsP( - P0=6e5) annotation (Placement(transformation( - extent={{84,20},{104,40}}, rotation=0))); - ThermoSysPro.Fluid.Machines.StaticCentrifugalPump staticCentrifugalPump1 - annotation (Placement(transformation(extent={{-30,60},{-10,80}}, rotation=0))); - ThermoSysPro.Fluid.Machines.StaticCentrifugalPump staticCentrifugalPump2 - annotation (Placement(transformation(extent={{-30,-20},{-10,0}}, rotation=0))); - ThermoSysPro.Fluid.Volumes.VolumeD volumeD annotation (Placement( - transformation(extent={{-50,20},{-30,40}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.IdealCheckValve idealCheckValve1 - annotation (Placement(transformation(extent={{10,60},{30,80}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.IdealCheckValve idealCheckValve2 - annotation (Placement(transformation(extent={{8,-20},{28,0}}, rotation=0))); - ThermoSysPro.Fluid.Volumes.VolumeC volumeC annotation (Placement( - transformation(extent={{30,20},{50,40}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe perteDP - annotation (Placement(transformation( - extent={{-80,20},{-60,40}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe perteDP1 - annotation (Placement(transformation( - extent={{60,20},{80,40}}, rotation=0))); -equation - connect(sourceP1.C, perteDP2.C1) - annotation (Line(points={{-40,-70},{-30,-70}}, color={0,0,255})); - connect(perteDP2.C2, idealCheckValve3.C1) - annotation (Line(points={{-10,-70},{10,-70}}, color={0,0,255})); - connect(idealCheckValve3.C2, perteDP3.C1) - annotation (Line(points={{30,-70},{50,-70}}, color={0,0,255})); - connect(perteDP3.C2, puitsP1.C) - annotation (Line(points={{70,-70},{80,-70}}, color={0,0,255})); - connect(pulse.y, sourceP1.IPressure) annotation (Line(points={{-79,-70},{-55, - -70}})); - connect(staticCentrifugalPump1.C2,idealCheckValve1. C1) annotation (Line( - points={{-10,70},{-2,70},{-2,70},{10,70}}, color={0,0,255})); - connect(staticCentrifugalPump2.C2,idealCheckValve2. C1) annotation (Line( - points={{-10,-10},{0,-10},{0,-10},{8,-10}}, color={0,0,255})); - connect(perteDP1.C2,puitsP. C) - annotation (Line(points={{80,30},{84,30}}, color={0,0,255})); - connect(sourceP.C,perteDP. C1) - annotation (Line(points={{-84,30},{-80,30}}, color={0,0,255})); - connect(perteDP.C2, volumeD.Ce) - annotation (Line(points={{-60,30},{-50,30}}, color={0,0,0})); - connect(volumeD.Cs1, staticCentrifugalPump1.C1) - annotation (Line(points={{-40,40},{-40,70},{-30,70}}, color={0,0,0})); - connect(volumeD.Cs2, staticCentrifugalPump2.C1) - annotation (Line(points={{-40,20},{-40,-10},{-30,-10}}, color={0,0,0})); - connect(idealCheckValve1.C2, volumeC.Ce2) - annotation (Line(points={{30,70},{40,70},{40,40}}, color={0,0,0})); - connect(volumeC.Cs, perteDP1.C1) - annotation (Line(points={{50,30},{60,30}}, color={0,0,0})); - connect(idealCheckValve2.C2, volumeC.Ce3) - annotation (Line(points={{28,-10},{40,-10},{40,20}}, color={0,0,0})); - annotation (experiment(StopTime=1000), - Diagram(coordinateSystem( - preserveAspectRatio=false, - extent={{-100,-100},{100,100}}, - grid={2,2})), - Window( - x=0.28, - y=0.03, - width=0.5, - height=0.6), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestIdealCheckValve; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestIdealSwitchValve.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestIdealSwitchValve.mo deleted file mode 100644 index a751ce0e..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestIdealSwitchValve.mo +++ /dev/null @@ -1,65 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestIdealSwitchValve - - ThermoSysPro.Fluid.BoundaryConditions.SourceP SourceP1 - annotation (Placement(transformation(extent={{-100,20},{-80,40}}, rotation= - 0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP PuitsP1 - annotation (Placement(transformation( - extent={{60,20},{80,40}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.IdealSwitchValve SwitchValve - annotation (Placement(transformation( - extent={{-20,26},{0,46}}, rotation=0))); - ThermoSysPro.InstrumentationAndControl.Blocks.Logique.Pulse pulse( - width=10, period=20) - annotation (Placement(transformation(extent={{-60,60},{-40,80}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe perteDP2 - annotation (Placement(transformation( - extent={{-60,20},{-40,40}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe perteDP1 - annotation (Placement(transformation( - extent={{20,20},{40,40}}, rotation=0))); -equation - connect(pulse.yL, SwitchValve.Ouv) annotation (Line(points={{-39,70},{-10,70}, - {-10,43}})); - connect(SourceP1.C, perteDP2.C1) annotation (Line(points={{-80,30},{-60,30}}, - color={0,0,255})); - connect(perteDP2.C2, SwitchValve.C1) annotation (Line(points={{-40,30},{-30, - 30},{-30,30},{-20,30}}, color={0,0,255})); - connect(SwitchValve.C2, perteDP1.C1) annotation (Line(points={{0,30},{20,30}}, - color={0,0,255})); - connect(perteDP1.C2, PuitsP1.C) annotation (Line(points={{40,30},{60,30}}, - color={0,0,255})); - annotation (experiment(StopTime=100), - Window( - x=0.45, - y=0.01, - width=0.35, - height=0.49), - Diagram(coordinateSystem( - preserveAspectRatio=false, - extent={{-100,-100},{100,100}}, - grid={2,2})), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestIdealSwitchValve; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestInternalCombustionEngine.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestInternalCombustionEngine.mo deleted file mode 100644 index cb736e23..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestInternalCombustionEngine.mo +++ /dev/null @@ -1,113 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestInternalCombustionEngine - import ThermoSysPro; - - parameter Integer NCEL = 7; - - ThermoSysPro.Fluid.Combustion.BoundaryConditions.FuelSourcePQ fuelSourcePQ( - Hum=0, - Xh=0.25, - Xs=0, - Xashes=0, - Xc=0.75, - Xo=0, - Xn=0, - Q0=0.0676, - rho=0.744, - LHV=50e6, - T0(displayUnit="K") = 299, - P0=210300, - Vol=100) annotation (Placement(transformation(extent={{-106,-81},{-72,-43}}, - rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourceAir( - Xso2=0, - Xco2=0, - Xh2o=0.005, - Xo2=0.23, - Q0=1.9627, - T0=30 + 273.16, - option_temperature=true, - ftype=ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType.FlueGases, - P0=191000) - annotation (Placement(transformation(extent={{111,-79},{73,-45}},rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.Sink sink(option_temperature=true) - annotation (Placement(transformation( - extent={{0,44},{44,86}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ SourcePQ_Water( - Q0=15.3, - h0=334.41e3, - P0=410000) - annotation (Placement(transformation(extent={{-107,-19},{-71,15}},rotation= - 0))); - ThermoSysPro.Fluid.Machines.InternalCombustionEngine alternatingEngine( - mechanical_efficiency_type=2, - Rmeca_nom=0.41, - Coef_Rm_a=-5.4727e-9, - Coef_Rm_b=4.9359e-5, - Coef_Rm_c=0.30814, - Xpth=0.05, - MMg=20, - DPe=1, - RV=6.45, - Kc=1.28, - Kd=1.33, - Wmeca(start=1400e3), - Welec(start=1358e3), - Wcomb(start=3.4942e6), - exc(start=1.8), - Gamma=1.2085, - Tsf(start=1088.15)) - annotation (Placement(transformation(extent={{-44,-46},{44,42}}))); - ThermoSysPro.Fluid.BoundaryConditions.Sink Sink_Water1 annotation (Placement( - transformation(extent={{75,-19},{111,15}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss - annotation (Placement(transformation(extent={{-63,-8},{-51,4}}))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss1 - annotation (Placement(transformation(extent={{51,-9},{65,5}}))); -equation - connect(alternatingEngine.Cair, sourceAir.C) annotation (Line( - points={{0,-41.6},{0,-62},{73,-62}}, - color={0,0,0}, - thickness=1)); - connect(alternatingEngine.Cfuel, fuelSourcePQ.C) annotation (Line(points={{-30.8, - -41.6},{-30.8,-62},{-72,-62}}, color={0,0,0})); - connect(SourcePQ_Water.C, singularPressureLoss.C1) - annotation (Line(points={{-71,-2},{-63,-2}}, - color={0,0,255})); - connect(alternatingEngine.Cws1, singularPressureLoss.C2) annotation (Line( - points={{-39.6,-2},{-51,-2}}, color={0,0,255})); - connect(alternatingEngine.Cws2, singularPressureLoss1.C1) - annotation (Line(points={{39.6,-2},{48,-2},{51,-2}}, color={0,0,255})); - connect(Sink_Water1.C, singularPressureLoss1.C2) - annotation (Line(points={{75,-2},{75,-2},{65,-2}}, color={0,0,255})); - connect(alternatingEngine.Cfg, sink.C) annotation (Line( - points={{0,37.6},{0,65},{0,65}}, - color={0,0,0}, - thickness=1)); - annotation ( Documentation(revisions=" -

Author

- -", info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-"), Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})})); -end TestInternalCombustionEngine; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestInvSingularPressureLoss.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestInvSingularPressureLoss.mo deleted file mode 100644 index f889cea8..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestInvSingularPressureLoss.mo +++ /dev/null @@ -1,38 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestInvSingularPressureLoss - - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ - annotation (Placement(transformation(extent={{-80,0},{-60,20}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkQ - annotation (Placement(transformation(extent={{40,0},{60,20}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.InvSingularPressureLoss - invSingularPressureLoss annotation (Placement(transformation(extent={{-20,0}, - {0,20}}, rotation=0))); -equation - connect(sourcePQ.C, invSingularPressureLoss.C1) annotation (Line(points={{-60, - 10},{-20,10}}, color={0,0,255})); - connect(invSingularPressureLoss.C2, sinkQ.C) annotation (Line(points={{0,10}, - {40,10}}, color={0,0,255})); -annotation(experiment(StopTime=1000), Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestInvSingularPressureLoss; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestJunctions1.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestJunctions1.mo deleted file mode 100644 index 987f9475..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestJunctions1.mo +++ /dev/null @@ -1,115 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestJunctions1 - - ThermoSysPro.Fluid.Junctions.Splitter2 splitter2 - annotation (Placement(transformation(extent={{-20,40},{0,60}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceP(Q0=200) - annotation (Placement(transformation(extent={{-100,40},{-80,60}}, rotation= - 0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss annotation (Placement(transformation(extent={{-60,40}, - {-40,60}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.Sink sinkP - annotation (Placement(transformation(extent={{80,80},{100,100}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP1 - annotation (Placement(transformation(extent={{80,0},{100,20}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss1 annotation (Placement(transformation(extent={{40,80}, - {60,100}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss2 annotation (Placement(transformation(extent={{40,0},{ - 60,20}}, rotation=0))); - ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Constante constante(k= - 0.5) annotation (Placement(transformation(extent={{-40,60},{-20,80}}, - rotation=0))); - ThermoSysPro.Fluid.Junctions.Splitter3 splitter3 - annotation (Placement(transformation(extent={{-20,-60},{0,-40}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceP1(Q0=400) - annotation (Placement(transformation(extent={{-100,-60},{-80,-40}}, - rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss3 annotation (Placement(transformation(extent={{-60,-60}, - {-40,-40}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.Sink sinkP2 - annotation (Placement(transformation(extent={{80,-20},{100,0}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.Sink sinkP3 - annotation (Placement(transformation(extent={{80,-100},{100,-80}}, rotation= - 0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss4 annotation (Placement(transformation(extent={{40,-20}, - {60,0}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss5 annotation (Placement(transformation(extent={{40,-100}, - {60,-80}}, rotation=0))); - ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Constante constante1(k= - 0) annotation (Placement(transformation(extent={{-40,-40},{-20,-20}}, - rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP4 - annotation (Placement(transformation(extent={{80,-60},{100,-40}}, rotation= - 0))); - ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Constante constante2(k= - 0) annotation (Placement(transformation(extent={{-40,-80},{-20,-60}}, - rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss6 annotation (Placement(transformation(extent={{40,-60}, - {60,-40}}, - rotation=0))); -equation - connect(sourceP.C, singularPressureLoss.C1) - annotation (Line(points={{-80,50},{-60,50}}, color={0,0,255})); - connect(singularPressureLoss.C2, splitter2.Ce) - annotation (Line(points={{-40,50},{-20,50}}, color={0,0,255})); - connect(splitter2.Cs1, singularPressureLoss1.C1) annotation (Line(points={{-6, - 60},{-6,90},{40,90}}, color={0,0,255})); - connect(singularPressureLoss1.C2, sinkP.C) - annotation (Line(points={{60,90},{80,90}}, color={0,0,255})); - connect(splitter2.Cs2, singularPressureLoss2.C1) annotation (Line(points={{-6, - 40},{-6,10},{40,10}}, color={0,0,255})); - connect(singularPressureLoss2.C2, sinkP1.C) - annotation (Line(points={{60,10},{80,10}}, color={0,0,255})); - connect(constante.y, splitter2.Ialpha1) - annotation (Line(points={{-19,70},{-14,70},{-14,56},{-9,56}})); - connect(sourceP1.C, singularPressureLoss3.C1) - annotation (Line(points={{-80,-50},{-60,-50}}, color={0,0,255})); - connect(singularPressureLoss3.C2, splitter3.Ce) annotation (Line(points={{-40, - -50},{-19.8,-50}}, color={0,0,255})); - connect(splitter3.Cs1, singularPressureLoss4.C1) annotation (Line(points={{-6, - -40},{-6,-10},{40,-10}}, color={0,0,255})); - connect(singularPressureLoss4.C2, sinkP2.C) - annotation (Line(points={{60,-10},{80,-10}}, color={0,0,255})); - connect(splitter3.Cs2, singularPressureLoss5.C1) annotation (Line(points={{-6, - -60},{-6,-90},{40,-90}}, color={0,0,255})); - connect(singularPressureLoss5.C2, sinkP3.C) - annotation (Line(points={{60,-90},{80,-90}}, color={0,0,255})); - connect(constante1.y, splitter3.Ialpha1) - annotation (Line(points={{-19,-30},{-14,-30},{-14,-44},{-9,-44}})); - connect(splitter3.Ialpha2, constante2.y) - annotation (Line(points={{-9,-56},{-14,-56},{-14,-70},{-19,-70}})); - connect(splitter3.Cs3, singularPressureLoss6.C1) - annotation (Line(points={{0,-50},{40,-50}}, color={0,0,0})); - connect(singularPressureLoss6.C2, sinkP4.C) - annotation (Line(points={{60,-50},{80,-50}}, color={0,0,0})); - annotation (experiment(StopTime=10), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestJunctions1; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestJunctions2.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestJunctions2.mo deleted file mode 100644 index c7162a60..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestJunctions2.mo +++ /dev/null @@ -1,131 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestJunctions2 - - ThermoSysPro.Fluid.Junctions.Mixer2 mixer2_1 - annotation (Placement(transformation(extent={{0,60},{20,80}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss annotation (Placement(transformation(extent={{40,60},{ - 60,80}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss1 annotation (Placement(transformation(extent={{-40,80}, - {-20,100}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss2 annotation (Placement(transformation(extent={{-40,40}, - {-20,60}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.Source sourceP - annotation (Placement(transformation(extent={{-80,80},{-60,100}}, rotation= - 0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP1 - annotation (Placement(transformation(extent={{-80,40},{-60,60}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkP - annotation (Placement(transformation(extent={{80,60},{100,80}}, rotation=0))); - ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Constante constante(k=0) - annotation (Placement(transformation(extent={{-40,60},{-20,80}}, - rotation=0))); - ThermoSysPro.Fluid.Junctions.Mixer3 mixer2_2 - annotation (Placement(transformation(extent={{0,-60},{20,-40}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss3 annotation (Placement(transformation(extent={{40,-60}, - {60,-40}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss4 annotation (Placement(transformation(extent={{-40,-40}, - {-20,-20}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss5 annotation (Placement(transformation(extent={{-40,-80}, - {-20,-60}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.Source sourceP2 - annotation (Placement(transformation(extent={{-80,-40},{-60,-20}}, rotation= - 0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP3 - annotation (Placement(transformation(extent={{-80,-80},{-60,-60}}, rotation= - 0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkP1 - annotation (Placement(transformation(extent={{80,-60},{100,-40}}, rotation= - 0))); - ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Constante constante1(k= - 0.5) annotation (Placement(transformation(extent={{-40,-20},{-20,0}}, - rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ - annotation (Placement(transformation(extent={{-80,-60},{-60,-40}}, rotation= - 0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss6 annotation (Placement(transformation(extent={{-40,-60}, - {-20,-40}}, rotation=0))); - ThermoSysPro.Fluid.Junctions.MassFlowMultiplier massFlowMultiplier(alpha= - 2) annotation (Placement(transformation(extent={{0,20},{20,40}}, - rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ1 - annotation (Placement(transformation(extent={{-80,20},{-60,40}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss7 annotation (Placement(transformation(extent={{-40,20}, - {-20,40}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss8 annotation (Placement(transformation(extent={{40,20}, - {60,40}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP2 - annotation (Placement(transformation(extent={{80,20},{100,40}}, rotation=0))); -equation - connect(singularPressureLoss1.C2, mixer2_1.Ce1) annotation (Line(points={{-20, - 90},{6,90},{6,80}}, color={0,0,255})); - connect(singularPressureLoss2.C2, mixer2_1.Ce2) annotation (Line(points={{-20, - 50},{6,50},{6,60}}, color={0,0,255})); - connect(mixer2_1.Cs, singularPressureLoss.C1) - annotation (Line(points={{20,70},{40,70}}, color={0,0,255})); - connect(sourceP.C, singularPressureLoss1.C1) - annotation (Line(points={{-60,90},{-40,90}}, color={0,0,255})); - connect(sourceP1.C, singularPressureLoss2.C1) - annotation (Line(points={{-60,50},{-40,50}}, color={0,0,255})); - connect(singularPressureLoss.C2, sinkP.C) - annotation (Line(points={{60,70},{80,70}}, color={0,0,255})); - connect(constante.y, mixer2_1.Ialpha1) - annotation (Line(points={{-19,70},{-8,70},{-8,76},{3,76}})); - connect(singularPressureLoss4.C2, mixer2_2.Ce1) annotation (Line(points={{-20, - -30},{6,-30},{6,-40}}, color={0,0,255})); - connect(singularPressureLoss5.C2, mixer2_2.Ce2) annotation (Line(points={{-20, - -70},{6,-70},{6,-60}}, color={0,0,255})); - connect(mixer2_2.Cs, singularPressureLoss3.C1) - annotation (Line(points={{20,-50},{40,-50}}, color={0,0,255})); - connect(sourceP2.C, singularPressureLoss4.C1) - annotation (Line(points={{-60,-30},{-40,-30}}, color={0,0,255})); - connect(sourceP3.C, singularPressureLoss5.C1) - annotation (Line(points={{-60,-70},{-40,-70}}, color={0,0,255})); - connect(singularPressureLoss3.C2, sinkP1.C) - annotation (Line(points={{60,-50},{80,-50}}, color={0,0,255})); - connect(sourceQ.C, singularPressureLoss6.C1) - annotation (Line(points={{-60,-50},{-40,-50}}, color={0,0,255})); - connect(singularPressureLoss6.C2, mixer2_2.Ce3) annotation (Line(points={{-20,-50}, - {-10,-50},{0,-50}}, color={0,0,255})); - connect(constante1.y, mixer2_2.Ialpha1) - annotation (Line(points={{-19,-10},{-8,-10},{-8,-44},{3,-44}})); - connect(sourceQ1.C, singularPressureLoss7.C1) - annotation (Line(points={{-60,30},{-40,30}}, color={0,0,255})); - connect(singularPressureLoss7.C2, massFlowMultiplier.Ce) - annotation (Line(points={{-20,30},{0,30}}, color={0,0,255})); - connect(massFlowMultiplier.Cs, singularPressureLoss8.C1) - annotation (Line(points={{20,30},{40,30}}, color={0,0,255})); - connect(singularPressureLoss8.C2, sinkP2.C) - annotation (Line(points={{60,30},{80,30}}, color={0,0,255})); - annotation (experiment(StopTime=10), Diagram(graphics), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestJunctions2; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestJunctions3.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestJunctions3.mo deleted file mode 100644 index 7bb8c86c..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestJunctions3.mo +++ /dev/null @@ -1,121 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestJunctions3 - - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP - annotation (Placement(transformation( - extent={{-104,0},{-84,20}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP1( P0=2e5, Q(start= - 323.48244470861454)) - annotation (Placement(transformation(extent={{-104,-60},{-84,-40}}, - rotation=0))); - ThermoSysPro.Fluid.PressureLosses.ControlValve valve1( - C2(h_vol_1(start=70977.89042837733)), - Pm(start=120690.8728732298), - C1( - h_vol_1(start=71016.12237181116), - Xco2(start=4.2755644765396636E-32), - Xso2(start=2.0610804919205873E-32), - h_vol_2(start=70977.89042837733), - Xh2o(start=1.4925957069001078E-32), - Xo2(start=1.8180778675015506E-31))) - annotation (Placement(transformation(extent={{-10,6},{10,26}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.ControlValve valve2(C1(h_vol_1(start= - 70921.01678153824), - Xco2(start=7.395570986446986E-32), - Xh2o(start=1.9721522630525295E-31), - Xo2(start=1.9721522630525295E-31), - Xso2(start=6.998299036616324E-32)), - Pm(start=118970.64778985853)) - annotation (Placement(transformation(extent={{-10,-54},{10,-34}}, rotation= - 0))); - ThermoSysPro.Fluid.PressureLosses.ControlValve valve3(Q(start= - 804.6933031325926), Pm(start=108776.21727782265), - C1( - Xco2(start=3.4137108264263755E-31), - Xo2(start=1.9413373839423337E-31), - Xso2(start=1.7792131856876708E-31), - Xh2o(start=2.3303752327085554E-31))) - annotation (Placement(transformation(extent={{50,-24},{70,-4}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP puitsP2 - annotation (Placement(transformation( - extent={{82,-30},{102,-10}}, rotation=0))); - ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Rampe rampe2( - Duration=1, - Initialvalue=1, - Finalvalue=0.05) - annotation (Placement(transformation(extent={{32,20},{52,40}}, - rotation=0))); - ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Rampe rampe3( - Initialvalue=1, - Starttime=2, - Finalvalue=0.001) - annotation (Placement(transformation(extent={{-30,30},{-10,50}}, rotation=0))); - ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Rampe rampe4( - Initialvalue=1, - Starttime=1, - Finalvalue=0.001) - annotation (Placement(transformation(extent={{-30,-30},{-10,-10}}, rotation= - 0))); - ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe pipe1 - annotation (Placement(transformation(extent={{-80,0},{-60,20}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe pipe2 - annotation (Placement(transformation(extent={{-80,-60},{-60,-40}}, rotation= - 0))); - ThermoSysPro.Fluid.Junctions.Mixer8 staticVolume - annotation (Placement(transformation(extent={{-40,0},{-20,20}}, rotation=0))); - ThermoSysPro.Fluid.Junctions.Mixer8 staticVolume1 - annotation (Placement(transformation(extent={{20,-30},{40,-10}}, rotation=0))); - ThermoSysPro.Fluid.Junctions.Mixer8 staticVolume2 - annotation (Placement(transformation(extent={{-40,-60},{-20,-40}}, rotation= - 0))); -equation - connect(valve3.C2, puitsP2.C) annotation (Line(points={{70,-20},{82, - -20}}, color={0,0,255})); - connect(rampe2.y, valve3.Ouv) - annotation (Line(points={{53,30},{60,30},{60,-3}})); - connect(rampe3.y, valve1.Ouv) annotation (Line(points={{-9,40},{0,40}, - {0,27}})); - connect(rampe4.y, valve2.Ouv) annotation (Line(points={{-9,-20},{0, - -20},{0,-33}})); - connect(sourceP.C, pipe1.C1) - annotation (Line(points={{-84,10},{-80,10}}, color={0,0,255})); - connect(sourceP1.C, pipe2.C1) - annotation (Line(points={{-84,-50},{-80,-50}}, color={0,0,255})); - connect(pipe1.C2, staticVolume.Ce4) annotation (Line(points={{-60,10},{-50,10}, - {-50,14},{-40.2,14}}, color={0,0,255})); - connect(staticVolume.Cs, valve1.C1) annotation (Line(points={{-20,10},{-10,10}}, - color={0,0,255})); - connect(staticVolume1.Cs, valve3.C1) annotation (Line(points={{40,-20},{50, - -20}}, color={0,0,255})); - connect(valve1.C2, staticVolume1.Ce1) annotation (Line(points={{10,10},{33,10}, - {33,-9.8}}, color={0,0,255})); - connect(valve2.C2, staticVolume1.Ce8) annotation (Line(points={{10,-50},{33, - -50},{33,-29.9}}, color={0,0,255})); - connect(pipe2.C2, staticVolume2.Ce4) annotation (Line(points={{-60,-50},{-50, - -50},{-50,-46},{-40.2,-46}}, color={0,0,255})); - connect(staticVolume2.Cs, valve2.C1) annotation (Line(points={{-20,-50},{-10, - -50}}, color={0,0,255})); - annotation (experiment(StopTime=10), Diagram(graphics), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestJunctions3; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestJunctions4.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestJunctions4.mo deleted file mode 100644 index 510707f9..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestJunctions4.mo +++ /dev/null @@ -1,59 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestJunctions4 - - ThermoSysPro.Fluid.Junctions.DeheaterMixer2 deheaterMixer2_1(Tmax=308) - annotation (Placement(transformation(extent={{-20,20},{0,40}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss annotation (Placement(transformation(extent={{-60,20}, - {-40,40}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss1 annotation (Placement(transformation(extent={{20,20}, - {40,40}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss2 annotation (Placement(transformation(extent={{-60,-20}, - {-40,0}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkP - annotation (Placement(transformation(extent={{60,20},{80,40}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP(T0=310) - annotation (Placement(transformation(extent={{-100,20},{-80,40}}, rotation= - 0))); - ThermoSysPro.Fluid.BoundaryConditions.Source source(h0=30000) - annotation (Placement(transformation(extent={{-100,-20},{-80,0}}, rotation= - 0))); -equation - connect(singularPressureLoss.C2, deheaterMixer2_1.Ce) annotation (Line(points= - {{-40,30},{-30,30},{-30,36},{-20,36}}, color={0,0,255})); - connect(deheaterMixer2_1.Cs, singularPressureLoss1.C1) annotation (Line( - points={{0,36},{10,36},{10,30},{20,30}}, color={0,0,255})); - connect(singularPressureLoss2.C2, deheaterMixer2_1.Ce_mix) annotation (Line( - points={{-40,-10},{-9.9,-10},{-9.9,20}}, color={0,0,255})); - connect(singularPressureLoss1.C2, sinkP.C) - annotation (Line(points={{40,30},{60,30}}, color={0,0,255})); - connect(sourceP.C, singularPressureLoss.C1) - annotation (Line(points={{-80,30},{-60,30}}, color={0,0,255})); - connect(source.C, singularPressureLoss2.C1) - annotation (Line(points={{-80,-10},{-60,-10}}, color={0,0,255})); - annotation (experiment(StopTime=10), Diagram(graphics), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestJunctions4; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestLoopBreaker.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestLoopBreaker.mo deleted file mode 100644 index 813d3b01..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestLoopBreaker.mo +++ /dev/null @@ -1,73 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestLoopBreaker - - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ - annotation (Placement(transformation(extent={{-100,0},{-80,20}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss1 - annotation (Placement(transformation(extent={{-20,20},{0,40}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss2 - annotation (Placement(transformation(extent={{-20,-20},{0,0}}, rotation=0))); - ThermoSysPro.Fluid.Junctions.Splitter2 splitter2_1 annotation (Placement( - transformation(extent={{-56,0},{-36,20}}, rotation=0))); - ThermoSysPro.Fluid.Junctions.Mixer2 mixer2_1 annotation (Placement(transformation( - extent={{40,0},{60,20}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.Sink sink annotation (Placement(transformation( - extent={{80,0},{100,20}}, rotation=0))); - InstrumentationAndControl.Blocks.Sources.Constante constante(k=0.5) - annotation (Placement(transformation(extent={{-80,40},{-60,60}}, rotation=0))); - ThermoSysPro.Fluid.LoopBreakers.LoopBreakerP loopBreakerP - annotation (Placement(transformation(extent={{10,-20},{30,0}}, rotation=0))); -equation - connect(sourcePQ.C, splitter2_1.Ce) annotation (Line( - points={{-80,10},{-56,10}}, - color={0,0,255}, - smooth=Smooth.None)); - connect(splitter2_1.Cs1, singularPressureLoss1.C1) annotation (Line( - points={{-42,20},{-42,30},{-20,30}}, - color={0,0,255}, - smooth=Smooth.None)); - connect(splitter2_1.Cs2, singularPressureLoss2.C1) annotation (Line( - points={{-42,0},{-42,-10},{-20,-10}}, - color={0,0,255}, - smooth=Smooth.None)); - connect(mixer2_1.Ce1, singularPressureLoss1.C2) - annotation (Line(points={{46,20},{46,30},{0,30}}, smooth=Smooth.None)); - connect(mixer2_1.Cs, sink.C) annotation (Line( - points={{60,10},{80,10}}, - color={0,0,255}, - smooth=Smooth.None)); - connect(constante.y, splitter2_1.Ialpha1) - annotation (Line(points={{-59,50},{-52,50},{-52,16},{-45,16}}, smooth= - Smooth.None)); - connect(singularPressureLoss2.C2, loopBreakerP.C1) annotation (Line( - points={{0,-10},{10,-10}}, - color={0,0,255}, - smooth=Smooth.None)); - connect(loopBreakerP.C2, mixer2_1.Ce2) annotation (Line( - points={{30,-10},{46,-10},{46,0}}, - color={0,0,255}, - smooth=Smooth.None)); - annotation (experiment(StopTime=1000), Diagram(graphics), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestLoopBreaker; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestMassFlowMultiplier.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestMassFlowMultiplier.mo deleted file mode 100644 index 8a7fd8ea..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestMassFlowMultiplier.mo +++ /dev/null @@ -1,47 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestMassFlowMultiplier - - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ - annotation (Placement(transformation(extent={{-100,0},{-80,20}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.Sink sink - annotation (Placement(transformation(extent={{60,0},{80,20}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss annotation (Placement(transformation(extent={{-60,0},{ - -40,20}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss1 annotation (Placement(transformation(extent={{20,0},{ - 40,20}}, rotation=0))); - ThermoSysPro.Fluid.Junctions.MassFlowMultiplier massFlowMultiplier - annotation (Placement(transformation(extent={{-20,0},{0,20}}, rotation=0))); -equation - connect(sourcePQ.C, singularPressureLoss.C1) annotation (Line(points={{-80,10}, - {-60,10}}, color={0,0,255})); - connect(singularPressureLoss1.C2, sink.C) annotation (Line(points={{40,10},{ - 60,10}}, color={0,0,255})); - connect(singularPressureLoss.C2, massFlowMultiplier.Ce) annotation (Line( - points={{-40,10},{-20,10}}, color={0,0,255})); - connect(massFlowMultiplier.Cs, singularPressureLoss1.C1) annotation (Line( - points={{0,10},{20,10}}, color={0,0,255})); -annotation(experiment(StopTime=1000), Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestMassFlowMultiplier; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestNTUWaterHeater0.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestNTUWaterHeater0.mo deleted file mode 100644 index e2232d2f..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestNTUWaterHeater0.mo +++ /dev/null @@ -1,105 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestNTUWaterHeater0 - - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ Source_condenseur( - P0=80.0e5, - Q0=1780, - h0=872.0e3) - annotation (Placement(transformation(extent={{-182,-10},{-162,10}}, - rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.Sink Puit_condenseur(C(h(start= - 980281.0129225359))) - annotation (Placement(transformation(extent={{152,-10},{172,10}}, - rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP( - option_temperature=false, - P0=27.e5, - h0=2.6e6, - C(h_vol_2(start=883556.9736276601)), - Q(start=112.29047515166533)) - annotation (Placement(transformation(extent={{-182,90},{-162,110}}, - rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss2(K=1e-4, C2(P(start=7999999.633732218))) - annotation (Placement(transformation(extent={{-106, - -10},{-86,10}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss3(K=1e-4) - annotation (Placement(transformation(extent={{-106,90}, - {-86,110}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.Sink Puit_condenseur1 - annotation (Placement(transformation(extent={{152,-106},{172,-86}}, - rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss4(K=1e-4, - C1(P(start=7618062.482445708)), - rho(start=834.862478836879)) - annotation (Placement(transformation(extent={{92,-10}, - {112,10}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss5(K=1e-4, rho(start=857.3159873035071)) - annotation (Placement(transformation(extent={{34,-106}, - {54,-86}}, rotation=0))); - - ThermoSysPro.Fluid.HeatExchangers.NTUWaterHeater nTUWaterHeating( - lambdaE=102.5, - SCondDes=6314, - KCond=5024, - SPurge=656, - KPurge=1767, - HeiF(start=878162.3337936474), - HDesF(start=980281.0129225359), - Hep(start=981240.7187349163), - Ee(h_vol_2(start=880000), Q(start=1800), h(start=880000), P(start=80e5)), - Ev(h_vol_1(start=3500000), P(start=27e5)), - Ep(Q(start=10)), - Se(P(start=80e5)), - SDes(start=1E-09), - continuous_flow_reversal=true) - annotation (Placement(transformation(extent={{-44,-52}, - {64,54}}, rotation=0))); -equation - connect(Source_condenseur.C, singularPressureLoss2.C1) - annotation (Line(points={{-162,0},{-106,0}}, color={0,0,255})); - connect(sourceP.C, singularPressureLoss3.C1) - annotation (Line(points={{-162,100},{-106,100}}, - color={0,0,255})); - connect(singularPressureLoss4.C2, Puit_condenseur.C) - annotation (Line(points={{112,0},{152,0}}, color={0,0,255})); - connect(singularPressureLoss5.C2, Puit_condenseur1.C) - annotation (Line(points={{54,-96},{152,-96}}, color={0,0,255})); - connect(singularPressureLoss3.C2, nTUWaterHeating.Ev) annotation (Line(points={{-86,100}, - {42.4,100},{42.4,19.02}}, color={0,0,255})); - connect(nTUWaterHeating.Se, singularPressureLoss4.C1) - annotation (Line(points={{64,1},{68,1},{68,0},{92,0}}, - color={0,0,255})); - connect(singularPressureLoss2.C2, nTUWaterHeating.Ee) - annotation (Line(points={{-86,0},{-44,0},{-44,1}}, - color={0,0,255})); - connect(singularPressureLoss5.C1, nTUWaterHeating.Sp) - annotation (Line(points={{34,-96},{-18,-96},{-18,-16.49},{-22.4,-16.49}})); - annotation (experiment(StopTime=1000), Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-200, - -200},{200,200}})), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestNTUWaterHeater0; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestPostCombustionGas.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestPostCombustionGas.mo deleted file mode 100644 index 7eb31034..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestPostCombustionGas.mo +++ /dev/null @@ -1,93 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestPostCombustionGas - import ThermoSysPro; - - ThermoSysPro.Fluid.BoundaryConditions.Sink Puits_Fumees2 - annotation (Placement(transformation( - origin={151,-6}, - extent={{23,-24},{-23,24}}, - rotation=180))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ Source_Fumees2( - Xso2=0, - Xco2=0.0, - Xo2=0.23, - Xh2o=0.01, - P0=15e5, - Q0=415, - T0=680, - ftype=ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType.FlueGases, - option_temperature=true) - annotation (Placement(transformation(extent={{-174,-30},{-128,18}}, - rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourcePQ2( - h0=300e3, - ftype=ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType.FlueGases, - Q0=10) - annotation (Placement(transformation(extent={{-172,68},{-132,108}}, - rotation=0))); - - ThermoSysPro.Fluid.Combustion.BoundaryConditions.FuelSourcePQ sourceCombustible2( - Hum=0, - Xo=0, - Xn=0, - Xs=0, - rho=0.838, - Xc=0.755, - Xh=0.245, - Cp=2255, - T0=410, - Q0=9.30, - LHV=47500e3) annotation (Placement(transformation(extent={{-107,-109},{-71, - -73}}, - rotation=0))); - - ThermoSysPro.Fluid.Combustion.CombustionChambers.PostCombustionGas - postCombustionGas - annotation (Placement(transformation(extent={{-52,-74},{74,50}}))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss - annotation (Placement(transformation(extent={{-100,78},{-80,98}}))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss1 - annotation (Placement(transformation(extent={{-102,-16},{-82,4}}))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss2 - annotation (Placement(transformation(extent={{90,-16},{110,4}}))); -equation - connect(sourceCombustible2.C, postCombustionGas.Cfuel) annotation (Line( - points={{-71,-91},{-7.9,-91},{-7.9,-67.8}}, color={0,0,0})); - connect(sourcePQ2.C, singularPressureLoss.C1) - annotation (Line(points={{-132,88},{-100,88}}, color={0,0,0})); - connect(singularPressureLoss.C2, postCombustionGas.Ca) annotation (Line( - points={{-80,88},{-20.5,88},{-20.5,43.8}}, color={0,0,0})); - connect(Source_Fumees2.C, singularPressureLoss1.C1) - annotation (Line(points={{-128,-6},{-102,-6}}, color={0,0,0})); - connect(singularPressureLoss1.C2, postCombustionGas.Cfg1) annotation (Line( - points={{-82,-6},{-64,-6},{-64,-5.8},{-45.7,-5.8}}, color={0,0,0})); - connect(postCombustionGas.Cfg2, singularPressureLoss2.C1) annotation (Line( - points={{67.7,-5.8},{79.85,-5.8},{79.85,-6},{90,-6}}, color={0,0,0})); - connect(singularPressureLoss2.C2, Puits_Fumees2.C) - annotation (Line(points={{110,-6},{128,-6}}, color={0,0,0})); - annotation (Diagram(coordinateSystem( - preserveAspectRatio=false, - extent={{-200,-200},{200,200}}, - initialScale=0.1)), Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestPostCombustionGas; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestPressurizer.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestPressurizer.mo deleted file mode 100644 index b4b47281..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestPressurizer.mo +++ /dev/null @@ -1,149 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestPressurizer - - parameter Units.SI.Power Wch(fixed=false) = 0.29e6 - "Power released by the electrical heaters"; - parameter Real OUVfeedwaterValve( fixed=false)=0.01 - "OUV feed water valve"; - - ThermoSysPro.Fluid.PressureLosses.ControlValve FeedwaterValve( - Cv(start=100), - C1( - P(start=160e5), - h_vol_1(start=1270e3), - Q(start=0.3), - h(start=1270e3)), - Q(fixed=false, start=0.32), - Cvmax=5000) annotation (Placement(transformation(extent={{-110,130},{ - -90,150}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.ControlValve SteamValve( - Cv(start=25000), - Cvmax(fixed=true) = 5000, - Pm(start=15500000)) - annotation (Placement(transformation(extent={{58,130},{78,150}}, rotation=0))); - ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Constante OuvFeedwaterValve1(k= - OUVfeedwaterValve) - annotation (Placement(transformation(extent={{-140,176},{-120,196}}, - rotation=0))); - ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe lumpedStraightPipe( - L=1, - D=1, - z1=1, - z2=0, - C1(P(start=160e5)), - C2(P(start=160e5)), - Q(fixed=false, start=0)) - annotation (Placement(transformation( - origin={-30,-42}, - extent={{10,-10},{-10,10}}, - rotation=90))); - ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Constante OuvSteamrValve(k(fixed= - true) = 0.5) annotation (Placement(transformation(extent={{0,176},{20, - 196}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP( - option_temperature=false, - h0=1270e3, - P0=160e5) - annotation (Placement(transformation(extent={{-168,124},{-148,144}}, - rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkQ(Q0=0, h0=3e6) - annotation (Placement(transformation(extent={{106,124},{126,144}}, rotation= - 0))); - ThermoSysPro.Fluid.Volumes.Pressurizer pressurizer( - Zm=10.15, - Klv=0.5e6, - cpp=600, - hl(start=1629887.98290107), - hv(start=2596216.59571565), - Zl(start=5.5900717167325), - Yw0=60, - V=61.12, - Rp=1.27, - Ae=96.23, - Klp=1780, - Kvp=7500, - Mp=107e3, - Kpa=5.63, - Ccond=0.02, - Cevap=0.05, - Yw(start=32.92), - y(start=0.3292, fixed=true), - P0=15500000, - P(start=15500000, fixed=true), - Tp(start=617.94155291055)) annotation (Placement(transformation(extent={{-92, - -12},{32,118}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkQ1( Q0=0, h0=1600000) - annotation (Placement(transformation(extent={{-30,-76},{-10,-56}}, - rotation=0))); - ThermoSysPro.Thermal.BoundaryConditions.HeatSource SourceC1( - option_temperature=2, - T0={310}, - W0={Wch}) - annotation (Placement(transformation( - origin={-133,32}, - extent={{-17,17},{17,-17}}, - rotation=270))); - ThermoSysPro.Thermal.BoundaryConditions.HeatSource SourceC2( - T0={310}, - W0={0.286e6}, - option_temperature=1) - annotation (Placement(transformation( - origin={-133,55}, - extent={{-17,17},{17,-17}}, - rotation=270))); -equation - connect(sourceP.C, FeedwaterValve.C1) annotation (Line(points={{-148,134},{ - -110,134}}, color={0,0,255})); - connect(SteamValve.C2, sinkQ.C) annotation (Line(points={{78,134},{106,134}}, - color={0,0,255})); - connect(OuvSteamrValve.y, SteamValve.Ouv) - annotation (Line(points={{21,186},{68,186},{68,151}})); - connect(FeedwaterValve.C2, pressurizer.Cas) annotation (Line(points={{-90,134}, - {-30,134},{-30,118}}, color={0,0,255})); - connect(pressurizer.Cs, SteamValve.C1) annotation (Line(points={{32,116.7},{ - 32,134},{58,134}}, color={0,0,255})); - connect(sinkQ1.C, lumpedStraightPipe.C2) - annotation (Line(points={{-30,-66},{-30,-52}})); - connect(lumpedStraightPipe.C1, pressurizer.Cex) - annotation (Line(points={{-30,-32},{-30,-12}})); - connect(SourceC2.C[1], pressurizer.Ca) annotation (Line(points={{-116.34,55}, - {-103.17,55},{-103.17,54.3},{-85.8,54.3}}, color={191,95,0})); - connect(SourceC1.C[1], pressurizer.Cc) annotation (Line(points={{-116.34,32}, - {-73.17,32},{-73.17,32.2},{-30,32.2}}, color={191,95,0})); - connect(OuvFeedwaterValve1.y, FeedwaterValve.Ouv) annotation (Line(points={{ - -119,186},{-100,186},{-100,151}}, color={0,0,255})); - annotation ( - Window( - x=0.43, - y=0, - width=0.57, - height=0.63), - Diagram(graphics, - coordinateSystem( - preserveAspectRatio=false, - extent={{-200,-100},{140,200}}, - grid={2,2})), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-"), - experiment(StopTime=1000)); -end TestPressurizer; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestRefP.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestRefP.mo deleted file mode 100644 index fe67477b..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestRefP.mo +++ /dev/null @@ -1,62 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestRefP - - ThermoSysPro.Fluid.BoundaryConditions.RefP refP - annotation (Placement(transformation(extent={{-90,0},{-70,20}}, rotation=0))); - ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Constante constante( - k=2.e5) - annotation (Placement(transformation(extent={{-100,60},{-80,80}}, rotation= - 0))); - ThermoSysPro.Fluid.Machines.StaticCentrifugalPump pump - annotation (Placement(transformation(extent={{-30,0},{-10,20}}, rotation=0))); - ThermoSysPro.Fluid.LoopBreakers.LoopBreakerQ loopBreakerQ - annotation (Placement(transformation(extent={{0,0},{20,20}}, rotation=0))); - ThermoSysPro.Fluid.LoopBreakers.LoopBreakerH loopBreakerH - annotation (Placement(transformation(extent={{30,0},{50,20}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.RefT refT - annotation (Placement(transformation(extent={{-60,0},{-40,20}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe lumpedStraightPipe - annotation (Placement(transformation(extent={{60,0},{80,20}}, rotation=0))); - Volumes.VolumeA volumeA(dynamic_energy_balance=false) - annotation (Placement(transformation(extent={{10,-30},{-10,-10}}))); -equation - connect(refP.C2, refT.C1) annotation (Line(points={{-70,10},{-60,10}}, color= - {0,0,255})); - connect(refT.C2, pump.C1) annotation (Line(points={{-40,10},{-30,10}}, color= - {0,0,255})); - connect(constante.y, refP.IPressure) annotation (Line(points={{-79,70},{-60, - 70},{-60,34},{-80,34},{-80,21}})); - connect(pump.C2, loopBreakerQ.C1) - annotation (Line(points={{-10,10},{0,10}}, color={0,0,255})); - connect(loopBreakerQ.C2, loopBreakerH.C1) - annotation (Line(points={{20,10},{30,10}}, color={0,0,255})); - connect(loopBreakerH.C2, lumpedStraightPipe.C1) - annotation (Line(points={{50,10},{60,10}}, color={0,0,255})); - connect(lumpedStraightPipe.C2, volumeA.Ce1) annotation (Line(points={{80,10}, - {100,10},{100,-20},{10,-20}}, color={0,0,0})); - connect(volumeA.Cs1, refP.C1) annotation (Line(points={{-10,-20},{-100,-20},{ - -100,10},{-90,10}}, color={0,0,0})); - annotation (experiment(StopTime=1000), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestRefP; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestRefP1.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestRefP1.mo deleted file mode 100644 index 7a704094..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestRefP1.mo +++ /dev/null @@ -1,56 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestRefP1 - - ThermoSysPro.Fluid.BoundaryConditions.RefP refP - annotation (Placement(transformation(extent={{-70,0},{-50,20}}, rotation=0))); - ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Constante constante( - k=2.e5) - annotation (Placement(transformation(extent={{-100,60},{-80,80}}, rotation= - 0))); - ThermoSysPro.Fluid.Machines.StaticCentrifugalPump pump - annotation (Placement(transformation(extent={{0,0},{20,20}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe lumpedStraightPipe - annotation (Placement(transformation(extent={{40,0},{60,20}}, rotation=0))); - BoundaryConditions.Source source - annotation (Placement(transformation(extent={{-100,0},{-80,20}}))); - BoundaryConditions.Sink sink - annotation (Placement(transformation(extent={{80,0},{100,20}}))); - BoundaryConditions.RefQ refQ - annotation (Placement(transformation(extent={{-40,0},{-20,20}}))); -equation - connect(constante.y, refP.IPressure) annotation (Line(points={{-79,70},{-60, - 70},{-60,21}})); - connect(source.C, refP.C1) - annotation (Line(points={{-80,10},{-70,10}}, color={0,0,0})); - connect(lumpedStraightPipe.C2, sink.C) - annotation (Line(points={{60,10},{80,10}}, color={0,0,0})); - connect(pump.C2, lumpedStraightPipe.C1) - annotation (Line(points={{20,10},{40,10}}, color={0,0,0})); - connect(refP.C2, refQ.C1) - annotation (Line(points={{-50,10},{-40,10}}, color={0,0,0})); - connect(pump.C1, refQ.C2) - annotation (Line(points={{0,10},{-20,10}}, color={0,0,0})); - annotation (experiment(StopTime=1000), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestRefP1; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestSensors.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestSensors.mo deleted file mode 100644 index 520cba18..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestSensors.mo +++ /dev/null @@ -1,61 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestSensors - - ThermoSysPro.Fluid.Sensors.SensorH specificEnthalpySensor - annotation (Placement(transformation(extent={{-60,8},{-40,28}}, rotation=0))); - ThermoSysPro.Fluid.Sensors.SensorQ massFlowSensor - annotation (Placement(transformation(extent={{-20,8},{0,28}}, rotation=0))); - ThermoSysPro.Fluid.Sensors.SensorQv volumetricFlowSensor - annotation (Placement(transformation(extent={{20,8},{40,28}}, rotation=0))); - ThermoSysPro.Fluid.Sensors.SensorP pressureSensor - annotation (Placement(transformation(extent={{-60,-32},{-40,-12}}, rotation= - 0))); - ThermoSysPro.Fluid.Sensors.SensorT temperatureSensor - annotation (Placement(transformation(extent={{-20,-32},{0,-12}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP puitsP - annotation (Placement(transformation( - extent={{60,-40},{80,-20}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP - annotation (Placement(transformation( - extent={{-100,0},{-80,20}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe perteDP - annotation (Placement(transformation(extent={{20,-40},{40,-20}}, rotation=0))); -equation - connect(sourceP.C, specificEnthalpySensor.C1) - annotation (Line(points={{-80,10},{-60,10}}, color={0,0,255})); - connect(specificEnthalpySensor.C2, massFlowSensor.C1) - annotation (Line(points={{-39.8,10},{-20,10}}, color={0,0,255})); - connect(massFlowSensor.C2, volumetricFlowSensor.C1) - annotation (Line(points={{0.2,10},{20,10}}, color={0,0,255})); - connect(volumetricFlowSensor.C2, pressureSensor.C1) annotation (Line(points={ - {40.2,10},{60,10},{60,0},{-80,0},{-80,-30},{-60,-30}}, color={0,0,255})); - connect(pressureSensor.C2, temperatureSensor.C1) annotation (Line(points={{ - -39.8,-30},{-20,-30}}, color={0,0,255})); - connect(temperatureSensor.C2, perteDP.C1) - annotation (Line(points={{0.2,-30},{20,-30}}, color={0,0,255})); - connect(perteDP.C2, puitsP.C) - annotation (Line(points={{40,-30},{60,-30}}, color={0,0,255})); - annotation (experiment(StopTime=1000), Diagram(graphics), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestSensors; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestSimpleDynamicCondenser.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestSimpleDynamicCondenser.mo deleted file mode 100644 index c9877780..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestSimpleDynamicCondenser.mo +++ /dev/null @@ -1,122 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestSimpleDynamicCondenser - -parameter Real L1 = 425 "Longueur de la première chaine de capteurs"; -parameter Integer Ns1 = 80 - "Nombre de mailles de la première chaine de capteurs"; - -parameter Real L2 = 75 "Longueur de la deuxième chaine de capteurs"; -parameter Integer Ns2 = 1 "Nombre de mailles de la deuxième chaine de capteurs"; - - ThermoSysPro.Fluid.BoundaryConditions.SinkP puitsPCaloporteur( - P0=1e5, - option_temperature=false) annotation (Placement(transformation(extent={{48,30}, - {88,70}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - PerteChargeCondPompe( K=1e-6, Q(start= - 0.598447), - C1(P(start=9035.18437098087)), - rho(start=990.6632738884383)) - annotation (Placement(transformation( - origin={-90,-38}, - extent={{-10,-10},{10,10}}, - rotation=180))); - ThermoSysPro.Fluid.BoundaryConditions.SourceP SourceRechauffeurEau( - option_temperature=false, - h0=2401e3, - P0=15050) annotation (Placement(transformation(extent={{-207, - 148},{-183,170}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkQ PuitsRechauffeurEau( - h0=191812, Q0(start=192, fixed=false)) - annotation (Placement(transformation(extent={{-184, - -52},{-208,-24}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourcePCaloporteur(Q0=29804.5, h0=113e3) - annotation (Placement(transformation(extent={{-212,30}, - {-172,68}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - PerteChargeCondPompe1( K=1e-6, rho( - start=995.5397398431962)) - annotation (Placement(transformation( - origin={36,50}, - extent={{6,-10},{-6,10}}, - rotation=180))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - PerteChargeCondPompe2( K=1e-6, rho( - start=996.552939890412)) - annotation (Placement(transformation( - origin={-154,49}, - extent={{6,-10},{-6,10}}, - rotation=180))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - PerteChargeCondPompe3(K(fixed=false) = 1e-3, Q(start=192, fixed=true)) - annotation (Placement(transformation( - origin={-120,159}, - extent={{10,-10},{-10,10}}, - rotation=180))); - ThermoSysPro.Fluid.HeatExchangers.SimpleDynamicCondenser Condenseur( D=0.018, - V=1000, - A=100, - lambda=0.01, - ntubes=28700, - yNiveau(signal(fixed=false, start=1.5)), - Vf0=0.15, - Vl(start=500, fixed=true), - P(fixed=false, start=9035.18437098087), - hl(start=183576.8570917718), - hv(start=187278.68509678004), - proe(d(start=996.0593559031695))) - annotation (Placement(transformation(extent={{-118,6},{1, - 116}}, rotation=0))); -equation - - connect(sourcePCaloporteur.C, PerteChargeCondPompe2.C1) annotation (Line( - points={{-172,49},{-160,49}}, color={0,0,255})); - connect(PerteChargeCondPompe1.C2, puitsPCaloporteur.C) annotation (Line( - points={{42,50},{48,50}}, color={0,0,255})); - connect(SourceRechauffeurEau.C, PerteChargeCondPompe3.C1) annotation (Line( - points={{-183,159},{-130,159}}, color={0,0,255})); - connect(PuitsRechauffeurEau.C, PerteChargeCondPompe.C2) - annotation (Line(points={{-184,-38},{-100,-38}})); - connect(PerteChargeCondPompe2.C2, Condenseur.Cee) annotation (Line(points={{ - -148,49},{-133,49},{-133,48.9},{-118,48.9}}, color={0,0,255})); - connect(PerteChargeCondPompe.C1, Condenseur.Cl) - annotation (Line(points={{-80,-38},{-57.31,-38},{-57.31,6}})); - connect(PerteChargeCondPompe3.C2, Condenseur.Cv) annotation (Line(points={{ - -110,159},{-58.5,159},{-58.5,116}}, color={0,0,255})); - connect(PerteChargeCondPompe1.C1, Condenseur.Cse) - annotation (Line(points={{30,50},{15.5,50},{15.5,50},{1,50}})); - annotation ( - Window( - x=0.43, - y=0, - width=0.57, - height=0.63), - Diagram(coordinateSystem( - preserveAspectRatio=false, - extent={{-250,-60},{130,180}}, - grid={2,2}, - initialScale=0.1)), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-"), - experiment(StopTime=1000)); -end TestSimpleDynamicCondenser; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestSimpleDynamicCondenser1.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestSimpleDynamicCondenser1.mo deleted file mode 100644 index 2a3bb2db..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestSimpleDynamicCondenser1.mo +++ /dev/null @@ -1,95 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestSimpleDynamicCondenser1 - ThermoSysPro.Fluid.Machines.StaticCentrifugalPump staticCentrifugalPump(Pm(displayUnit = "Pa", start= - 355000.00000015664), Q(fixed = false), hn(fixed = false, start= - 71.08245675235786), p_rho(displayUnit = "kg/m3"), rho(displayUnit = "kg/m3"), - a1(start=-88.67, fixed=false), - C2(h(start=195297.69906611618), h_vol_1(start=195297.69906611618)), - Qv(start=0.009081311621074862), - h(start=193554.9971298399), - C1(P(start=10000.0))) annotation ( - Placement(visible = true, transformation(origin={-10,-60}, extent={{10,-10}, - {-10,10}}, rotation = 0))); - ThermoSysPro.Fluid.Machines.StodolaTurbine stodolaTurbine(Pe(displayUnit = "Pa", fixed = true, start = 700000), Ps(displayUnit = "Pa", fixed = false), W_fric = 0, eta_is(fixed = false), eta_is_wet(fixed = false), rhos(displayUnit = "kg/m3", fixed = false), - xm(fixed=false, start=0.9856238368898451), - proe(x(start=1, fixed=true)), - Ce(h_vol_2(start=3128840.013040668), h(start=3128840.0130323363)), - pros(d(start=0.07018147245152216))) annotation ( - Placement(visible = true, transformation(origin={-10,60}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); - ThermoSysPro.Fluid.HeatExchangers.SimpleDynamicCondenser Condenseur(A = 100, D = 0.018, - dynamic_energy_balance=true, - P(fixed=false, start=10000), - P0(displayUnit="Pa") = 1000, V = 1000, continuous_flow_reversal = true, lambda = 0.01, ntubes = 28700, rhol(displayUnit = "kg/m3"), rhom(displayUnit = "kg/m3"), rhov(displayUnit = "kg/m3"), yNiveau(signal(fixed = false, start = 1.5)), - steady_state=false, - proe(d(start=0.7468807684211932))) annotation ( - Placement(visible = true, transformation(origin={40.5,-1}, extent = {{-20.5, -16}, {20.5, 16}}, rotation = 0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP puitsPCaloporteur(P0 = 1e5, T0 = 373.05, option_temperature = true) annotation ( - Placement(visible = true, transformation(origin={85,-1}, extent = {{-11, -12}, {11, 12}}, rotation = 0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourcePCaloporteur(Q0 = 5, h0 = 113e3) annotation ( - Placement(visible = true, transformation(origin={-24,-1}, extent = {{-10, -9}, {10, 9}}, rotation = 0))); - Volumes.VolumeATh volumeA( - P(start=70e5), - h(start=2.e6), - dynamic_energy_balance=false) - annotation (Placement(transformation(extent={{-70,10},{-50,-10}}))); - Thermal.BoundaryConditions.HeatSource heatSource(W0(start={2e6}, each fixed=false), - option_temperature=2) annotation (Placement(transformation( - extent={{-10,-10},{10,10}}, - rotation=90, - origin={-88,12}))); -equation - connect(Condenseur.Cv,stodolaTurbine. Cs) annotation ( - Line(points={{40.5,15},{40.5,60},{0.1,60}}, color = {0, 0, 255})); - connect(Condenseur.Cse,puitsPCaloporteur. C) annotation ( - Line(points={{61,-4.2},{62,-4.2},{62,-1},{74,-1}}, - color = {0, 0, 255})); - connect(sourcePCaloporteur.C,Condenseur. Cee) annotation ( - Line(points={{-14,-1},{-9,-1},{-9,-4.52},{20,-4.52}}, color = {0, 0, 255})); - connect(Condenseur.Cl, staticCentrifugalPump.C1) annotation (Line(points={{40.91, - -17},{40,-17},{40,-60},{0,-60}}, color={28,108,200})); - connect(staticCentrifugalPump.C2, volumeA.Ce2) - annotation (Line(points={{-20,-60},{-60,-60},{-60,-10}}, color={28,108,200})); - connect(volumeA.Cs2, stodolaTurbine.Ce) - annotation (Line(points={{-60,10},{-60,60},{-20.1,60}}, color={28,108,200})); - connect(heatSource.C[1], volumeA.Cth) annotation (Line(points={{-78.2,12},{-64, - 12},{-64,0},{-60,0}}, color={0,0,0})); - annotation ( Diagram(graphics={ - Text( - extent={{-94,34},{-64,24}}, - lineColor={28,108,200}, - textString="W: free"), - Text( - extent={{-26,-38},{8,-48}}, - lineColor={28,108,200}, - textString="a1: free"), - Text( - extent={{-28,94},{8,84}}, - lineColor={28,108,200}, - textString="Pe: fixed"), - Text( - extent={{-28,84},{10,72}}, - lineColor={28,108,200}, - textString="proe.x: fixed")}), Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-"), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - experiment(StopTime=1000, __Dymola_Algorithm="Dassl")); -end TestSimpleDynamicCondenser1; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestSimpleEvaporatorWaterSteamFlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestSimpleEvaporatorWaterSteamFlueGases.mo deleted file mode 100644 index a2f4c5bf..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestSimpleEvaporatorWaterSteamFlueGases.mo +++ /dev/null @@ -1,71 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestSimpleEvaporatorWaterSteamFlueGases - - ThermoSysPro.Fluid.BoundaryConditions.Sink puits_Eau - annotation (Placement(transformation( - extent={{64,-17},{84,3}}, rotation=0))); - - ThermoSysPro.Fluid.HeatExchangers.SimpleEvaporatorWaterSteamFlueGases - EchangeurEfficacite(Kdpf=1, Kdpe=1) - annotation (Placement(transformation(extent={{-44,-35},{44,21}}, - rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ source_Eau( - Q0=38.92/3.6, - h0=1242080, - P0=6527000) - annotation (Placement(transformation(extent={{-84,-17},{-64,3}}, - rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ Source_Fumees( - Xso2=0, - Q0=86.7429, - Xco2=0.04725, - Xh2o=0.051874, - Xo2=0.15011, - ftype=ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType.FlueGases, - P0=101000, - T0=750.54, - option_temperature=true) - annotation (Placement(transformation(extent={{-34,45},{0,75}}, rotation=0))); - - ThermoSysPro.Fluid.BoundaryConditions.Sink Puits_Fumees - annotation (Placement(transformation( - origin={16,-70}, - extent={{16,-15},{-16,15}}, - rotation=180))); -equation - connect(Source_Fumees.C, EchangeurEfficacite.Cfg1) annotation (Line( - points={{0,60},{0,18.2}}, - color={0,0,0}, - thickness=1)); - connect(EchangeurEfficacite.Cfg2, Puits_Fumees.C) annotation (Line( - points={{0,-32.2},{0,-70},{0,-70}}, - color={0,0,0}, - thickness=1)); - connect(EchangeurEfficacite.Cws2, puits_Eau.C) annotation (Line(points={{44, - -7},{54,-7},{54,-7},{64,-7}}, color={0,0,255})); - connect(EchangeurEfficacite.Cws1, source_Eau.C) - annotation (Line(points={{-44,-7},{-54,-7},{-54,-7},{-64,-7}})); - annotation (experiment(StopTime=1000), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestSimpleEvaporatorWaterSteamFlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestSimpleStaticCondenser.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestSimpleStaticCondenser.mo deleted file mode 100644 index ef928dcd..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestSimpleStaticCondenser.mo +++ /dev/null @@ -1,53 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestSimpleStaticCondenser - - ThermoSysPro.Fluid.HeatExchangers.SimpleStaticCondenser - simpleStaticCondenser( - Ec(h(start=532983.7176868258)), - Ef(h(start=71016.12237181116)), - Qc(start=1049.6385508765125), - Qf(start=4469.84281279143), - Sf(h(start=64330.208038325145))) - annotation (Placement(transformation(extent={{-20,20}, - {0,40}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP - annotation (Placement(transformation(extent={{-60,20},{-40,40}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP1(T0=400) - annotation (Placement(transformation(extent={{-60,-20},{-40,0}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP - annotation (Placement(transformation(extent={{20,20},{40,40}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP1 - annotation (Placement(transformation(extent={{20,-20},{40,0}}, rotation=0))); -equation - connect(sourceP.C, simpleStaticCondenser.Ef) annotation (Line(points={{-40,30}, - {-20,30}}, color={0,0,255})); - connect(sourceP1.C, simpleStaticCondenser.Ec) annotation (Line(points={{-40, - -10},{-16,-10},{-16,20}}, color={0,0,255})); - connect(simpleStaticCondenser.Sf, sinkP.C) annotation (Line(points={{0,29.9}, - {10,29.9},{10,30},{20,30}}, color={0,0,255})); - connect(simpleStaticCondenser.Sc, sinkP1.C) annotation (Line(points={{-4,20}, - {-4,-10},{20,-10}}, color={0,0,255})); - annotation (experiment(StopTime=1000), Diagram(graphics), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestSimpleStaticCondenser; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestSingularPressureLoss.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestSingularPressureLoss.mo deleted file mode 100644 index f24da7e9..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestSingularPressureLoss.mo +++ /dev/null @@ -1,51 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestSingularPressureLoss - - ThermoSysPro.Fluid.BoundaryConditions.SourceP SourceP1 - annotation (Placement(transformation(extent={{-100,20},{-80,40}}, rotation= - 0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP PuitsP1 - annotation (Placement(transformation( - extent={{60,20},{80,40}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss( fluid=1) - annotation (Placement(transformation( - extent={{-20,20},{0,40}}, rotation=0))); -equation - connect(singularPressureLoss.C2, PuitsP1.C) - annotation (Line(points={{0,30},{60,30}}, color={0,0,255})); - connect(SourceP1.C, singularPressureLoss.C1) - annotation (Line(points={{-80,30},{-20,30}}, color={0,0,255})); - annotation (experiment(StopTime=1000), - Window( - x=0.45, - y=0.01, - width=0.35, - height=0.49), - Diagram(coordinateSystem( - preserveAspectRatio=false, - extent={{-100,-100},{100,100}}, - grid={2,2}), graphics), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestSingularPressureLoss; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestStaticAerocondenser.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestStaticAerocondenser.mo deleted file mode 100644 index 079db785..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestStaticAerocondenser.mo +++ /dev/null @@ -1,97 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestStaticAerocondenser - - parameter Units.SI.AbsolutePressure Pin_1=20000 - "Flow pressure at inlet 1 (sourceP)"; - parameter Units.SI.AbsolutePressure Pin_2=20000 - "Flow pressure at inlet 3 (sourceP2)"; - - BoundaryConditions.SourcePQ Source_condenseur( - Q0(fixed=true) = 4000, - h0=15e3, - option_temperature=true, - ftype=ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType.FlueGases, - P0=100000, - T0=287.15) - annotation (Placement(transformation(extent={{190,-90},{170,-70}}, - rotation=0))); - - BoundaryConditions.Sink Puit_condenseur - annotation (Placement(transformation(extent={{170,90},{190,110}}, - rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP( - option_temperature=false, - h0=2.5817e6, - C(Q(fixed=false, start=100)), - P0=Pin_1) - annotation (Placement(transformation(extent={{-100,90},{-80,110}}, - rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP2( - option_temperature=false, - h0=2.5055e6, - C(Q(fixed=false, start=1e-5)), - P0=Pin_2) annotation (Placement(transformation(extent={{-182, - -40},{-162,-20}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss1(K=10) - annotation (Placement(transformation(extent={{-120,-40}, - {-100,-20}}, - rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss3(K=10) - annotation (Placement(transformation(extent={{-38,90}, - {-18,110}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.Sink Puit_condenseur1 - annotation (Placement(transformation(extent={{-100,-90},{-120,-70}}, - rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss5(K=1e-4) - annotation (Placement(transformation(extent={{-40,-90}, - {-60,-70}},rotation=0))); - - Fluid.HeatExchangers.StaticAerocondenser staticAerocondenser - annotation (Placement(transformation(extent={{-64,-44},{66,70}}))); -equation - connect(sourceP2.C, singularPressureLoss1.C1) - annotation (Line(points={{-162,-30},{-120,-30}}, - color={0,0,255})); - connect(sourceP.C, singularPressureLoss3.C1) - annotation (Line(points={{-80,100},{-38,100}}, color={0,0,255})); - connect(singularPressureLoss1.C2, staticAerocondenser.Cw) annotation (Line( - points={{-100,-30},{-70,-30},{-70,-29.75},{-58.5833,-29.75}},color={0,0, - 0})); - connect(singularPressureLoss3.C2, staticAerocondenser.Cws1) - annotation (Line(points={{-18,100},{1,100},{1,65.25}}, color={0,0,0})); - connect(Puit_condenseur1.C, singularPressureLoss5.C2) - annotation (Line(points={{-100,-80},{-60,-80}},color={0,0,0})); - connect(singularPressureLoss5.C1, staticAerocondenser.Cws2) - annotation (Line(points={{-40,-80},{1,-80},{1,-39.25}}, color={0,0,0})); - connect(Source_condenseur.C, staticAerocondenser.Cair1) annotation (Line( - points={{170,-80},{60.5833,-80},{60.5833,-38.775}}, color={0,0,0})); - connect(Puit_condenseur.C, staticAerocondenser.Cair2) annotation (Line(points={{170,100}, - {60.5833,100},{60.5833,65.25}}, color={0,0,0})); - annotation (experiment(StopTime=1000), Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-200, - -200},{200,200}})), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestStaticAerocondenser; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestStaticCentrifugalPump1.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestStaticCentrifugalPump1.mo deleted file mode 100644 index 7f098428..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestStaticCentrifugalPump1.mo +++ /dev/null @@ -1,52 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestStaticCentrifugalPump1 - - ThermoSysPro.Fluid.Machines.StaticCentrifugalPump StaticCentrifugalPump1( - fixed_rot_or_power=2, MPower=0.15e6) - annotation (Placement(transformation(extent={{-20,20},{0,40}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP - annotation (Placement(transformation(extent={{-80,20},{-60,40}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP(P0=600000) - annotation (Placement(transformation(extent={{40,20},{60,40}}, rotation=0))); -equation - connect(sourceP.C, StaticCentrifugalPump1.C1) annotation (Line( - points={{-60,30},{-20,30}}, - color={0,0,255}, - smooth=Smooth.None)); - connect(StaticCentrifugalPump1.C2, sinkP.C) annotation (Line( - points={{0,30},{40,30}}, - color={0,0,255}, - smooth=Smooth.None)); - annotation (experiment(StopTime=1000), - Window( - x=0.32, - y=0.02, - width=0.39, - height=0.47), - Diagram(coordinateSystem( - preserveAspectRatio=false, - extent={{-100,-100},{100,100}}, - grid={2,2}), graphics), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestStaticCentrifugalPump1; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestStaticCondenser.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestStaticCondenser.mo deleted file mode 100644 index 70340b52..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestStaticCondenser.mo +++ /dev/null @@ -1,123 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestStaticCondenser - - parameter Units.SI.AbsolutePressure Pin_1(fixed=false, start=20000) - "Flow pressure at inlet 1 (sourceP)"; - parameter Units.SI.AbsolutePressure Pin_2(fixed=false, start=20000) - "Flow pressure at inlet 2 (sourceP1)"; - parameter Units.SI.AbsolutePressure Pin_3(fixed=false, start=20000) - "Flow pressure at inlet 3 (sourceP2)"; - - ThermoSysPro.Fluid.BoundaryConditions.SourceQ Source_condenseur( - h0=60e3, Q0(fixed=true) = 4000) - annotation (Placement(transformation(extent={{-180,0},{-160,20}}, - rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP Puit_condenseur - annotation (Placement(transformation(extent={{160,0},{180,20}}, - rotation=0))); - ThermoSysPro.Fluid.HeatExchangers.StaticCondenser condenseur( - CPCE=0, - KCO=100, - QC0=200, - z=5, - SCO=15e3, - Qee(start=4000, fixed=false), - Pcond(fixed=false, start=2154.77)) annotation (Placement(transformation( - extent={{-20,-16},{72,82}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP( - option_temperature=false, - h0=2.5817e6, - C(Q(fixed=true, start=100)), - P0=Pin_1) - annotation (Placement(transformation(extent={{-100,140},{-80,160}}, - rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP1( - option_temperature=false, - h0=2.5481e6, - C(Q(fixed=true, start=1e-5)), - P0=Pin_2) annotation (Placement(transformation(extent={ - {-182,80},{-162,100}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP2( - option_temperature=false, - h0=2.5055e6, - C(Q(fixed=true, start=1e-5)), - P0=Pin_3) annotation (Placement(transformation(extent= - {{-180,40},{-160,60}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss(K=10) - annotation (Placement(transformation(extent={{-100,80}, - {-80,100}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss1(K=10) - annotation (Placement(transformation(extent={{-100,40}, - {-80,60}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss2(K=1e-4) - annotation (Placement(transformation(extent={{-100,0}, - {-80,20}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss3(K=10) - annotation (Placement(transformation(extent={{-40,140}, - {-20,160}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.Sink Puit_condenseur1 - annotation (Placement(transformation(extent={{100,-100},{120,-80}}, - rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss4(K=1e-4) - annotation (Placement(transformation(extent={{100,0}, - {120,20}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss5(K=1e-4) - annotation (Placement(transformation(extent={{40,-100}, - {60,-80}}, rotation=0))); - -equation - connect(sourceP1.C, singularPressureLoss.C1) - annotation (Line(points={{-162,90},{-100,90}}, color={0,0,255})); - connect(singularPressureLoss.C2, condenseur.Cev) annotation (Line(points={{ - -80,90},{-50,90},{-50,62.89},{-20,62.89}}, color={0,0,255})); - connect(sourceP2.C, singularPressureLoss1.C1) - annotation (Line(points={{-160,50},{-100,50}}, color={0,0,255})); - connect(singularPressureLoss1.C2, condenseur.Cep) annotation (Line(points={{ - -80,50},{-52,50},{-52,42.31},{-20,42.31}}, color={0,0,255})); - connect(Source_condenseur.C, singularPressureLoss2.C1) - annotation (Line(points={{-160,10},{-100,10}}, color={0,0,255})); - connect(singularPressureLoss2.C2, condenseur.Cee) annotation (Line(points={{ - -80,10},{-52,10},{-52,3.11},{-20,3.11}}, color={0,0,255})); - connect(sourceP.C, singularPressureLoss3.C1) - annotation (Line(points={{-80,150},{-40,150}}, color={0,0,255})); - connect(singularPressureLoss3.C2, condenseur.Cvt) annotation (Line(points={{ - -20,150},{26,150},{26,82.49}}, color={0,0,255})); - connect(singularPressureLoss4.C2, Puit_condenseur.C) - annotation (Line(points={{120,10},{160,10}}, color={0,0,255})); - connect(condenseur.Cse, singularPressureLoss4.C1) annotation (Line(points={{ - 72.92,3.11},{86,3.11},{86,10},{100,10}}, color={0,0,255})); - connect(singularPressureLoss5.C2, Puit_condenseur1.C) - annotation (Line(points={{60,-90},{100,-90}}, color={0,0,255})); - connect(singularPressureLoss5.C1, condenseur.Cex) - annotation (Line(points={{40,-90},{26.46,-90},{26.46,-16}})); - annotation (experiment(StopTime=1000), Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-200, - -200},{200,200}})), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestStaticCondenser; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestStaticCondenserHEI.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestStaticCondenserHEI.mo deleted file mode 100644 index a2628b2f..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestStaticCondenserHEI.mo +++ /dev/null @@ -1,126 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestStaticCondenserHEI - - parameter Units.SI.AbsolutePressure Pin_1(fixed=false, start= - 179979.0023433965) "Flow pressure at inlet 1 (sourceP)"; - parameter Units.SI.AbsolutePressure Pin_2(fixed=false, start= - 4691.365030963762) "Flow pressure at inlet 2 (sourceP1)"; - parameter Units.SI.AbsolutePressure Pin_3(fixed=false, start= - 4691.365030911197) "Flow pressure at inlet 3 (sourceP2)"; - - ThermoSysPro.Fluid.BoundaryConditions.SourceQ Source_condenseur( - h0=60e3, Q0(fixed=true) = 4000) - annotation (Placement(transformation(extent={{-180,0},{-160,20}}, - rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP Puit_condenseur(C(h(start= - 121216.39257552983))) - annotation (Placement(transformation(extent={{160,0},{180,20}}, - rotation=0))); - ThermoSysPro.Fluid.HeatExchangers.StaticCondenserHEI condenseur( - Kf=0, - z1c=5, - Cee( - Q( start=4000, fixed=false)), - Pcond(fixed=false, start=2154.77), - DPf(start=-7.816453667652961E-26), - Wcut_off(start=116804805.25936648), - procs(d(start=9.50351941496327))) annotation (Placement(transformation( - extent={{-20,-16},{72,82}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP( - option_temperature=false, - h0=2.5817e6, - C(Q(fixed=true, start=100)), - P0=Pin_1) - annotation (Placement(transformation(extent={{-100,140},{-80,160}}, - rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP1( - option_temperature=false, - h0=2.5481e6, - C(Q(fixed=true, start=1e-5)), - P0=Pin_2) annotation (Placement(transformation(extent={ - {-182,80},{-162,100}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP2( - option_temperature=false, - h0=2.5055e6, - C(Q(fixed=true, start=1e-5)), - P0=Pin_3) annotation (Placement(transformation(extent= - {{-180,40},{-160,60}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss(K=10) - annotation (Placement(transformation(extent={{-100,80}, - {-80,100}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss1(K=10) - annotation (Placement(transformation(extent={{-100,40}, - {-80,60}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss2(K=1e-4, rho(start=999.2051327991054)) - annotation (Placement(transformation(extent={{-100,0}, - {-80,20}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss3(K=10) - annotation (Placement(transformation(extent={{-40,140}, - {-20,160}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.Sink Puit_condenseur1 - annotation (Placement(transformation(extent={{100,-100},{120,-80}}, - rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss4(K=1e-4, rho(start=995.9727926518547)) - annotation (Placement(transformation(extent={{100,0}, - {120,20}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss5(K=1e-4, rho(start=9.502298036944223)) - annotation (Placement(transformation(extent={{40,-100}, - {60,-80}}, rotation=0))); - -equation - connect(sourceP1.C, singularPressureLoss.C1) - annotation (Line(points={{-162,90},{-100,90}}, color={0,0,255})); - connect(singularPressureLoss.C2, condenseur.Cev) annotation (Line(points={{ - -80,90},{-50,90},{-50,62.89},{-20,62.89}}, color={0,0,255})); - connect(sourceP2.C, singularPressureLoss1.C1) - annotation (Line(points={{-160,50},{-100,50}}, color={0,0,255})); - connect(singularPressureLoss1.C2, condenseur.Cep) annotation (Line(points={{ - -80,50},{-52,50},{-52,42.31},{-20,42.31}}, color={0,0,255})); - connect(Source_condenseur.C, singularPressureLoss2.C1) - annotation (Line(points={{-160,10},{-100,10}}, color={0,0,255})); - connect(singularPressureLoss2.C2, condenseur.Cee) annotation (Line(points={{ - -80,10},{-52,10},{-52,3.11},{-20,3.11}}, color={0,0,255})); - connect(sourceP.C, singularPressureLoss3.C1) - annotation (Line(points={{-80,150},{-40,150}}, color={0,0,255})); - connect(singularPressureLoss3.C2, condenseur.Cvt) annotation (Line(points={{ - -20,150},{26,150},{26,82.49}}, color={0,0,255})); - connect(singularPressureLoss4.C2, Puit_condenseur.C) - annotation (Line(points={{120,10},{160,10}}, color={0,0,255})); - connect(condenseur.Cse, singularPressureLoss4.C1) annotation (Line(points={{ - 72.92,3.11},{86,3.11},{86,10},{100,10}}, color={0,0,255})); - connect(singularPressureLoss5.C2, Puit_condenseur1.C) - annotation (Line(points={{60,-90},{100,-90}}, color={0,0,255})); - connect(singularPressureLoss5.C1, condenseur.Cex) - annotation (Line(points={{40,-90},{26.46,-90},{26.46,-16}})); - annotation (experiment(StopTime=1000), Diagram(graphics, - coordinateSystem(preserveAspectRatio=false, extent={{-200, - -200},{200,200}})), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestStaticCondenserHEI; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestStaticDrum1.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestStaticDrum1.mo deleted file mode 100644 index b125b099..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestStaticDrum1.mo +++ /dev/null @@ -1,92 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestStaticDrum1 - - ThermoSysPro.Fluid.Junctions.StaticDrum StaticDrumTh1 - annotation (Placement(transformation(extent={{-54,0},{-34,20}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLossVALI1(K=1e-4) - annotation (Placement(transformation(extent={{0,-10},{20,10}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLossVALI2(K=1e-4) - annotation (Placement(transformation(extent={{-80,-50},{-60,-30}}, rotation= - 0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkP1(Q0=10) - annotation (Placement(transformation(extent={{40,-10},{60,10}}, rotation=0))); - ThermoSysPro.Fluid.Sensors.SensorT sensorT - annotation (Placement(transformation(extent={{40,-82},{60,-62}}, rotation=0))); - ThermoSysPro.Thermal.BoundaryConditions.HeatSource heatSource( - option_temperature=2, - W0={2.4e8}, - T0={290}) annotation (Placement(transformation(extent={{-80,20},{-60,40}}, - rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLossVALI3(K=1e-4) - annotation (Placement(transformation(extent={{-20,50},{0,70}}, rotation=0))); - BoundaryConditions.PlugB sinkP2 - annotation (Placement(transformation(extent={{60,50},{80,70}}, rotation=0))); - ThermoSysPro.Fluid.Sensors.SensorT sensorT1 - annotation (Placement(transformation(extent={{20,58},{40,78}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.RefP refP(P0=3e5) - annotation (Placement(transformation(extent={{-26,-90},{-6,-70}}, rotation= - 0))); - ThermoSysPro.Fluid.BoundaryConditions.RefQ refQ(Q0=100) - annotation (Placement(transformation(extent={{-56,-90},{-36,-70}}, rotation= - 0))); - BoundaryConditions.PlugA sourcePlug(C(h(fixed=true))) - annotation (Placement(transformation(extent={{-90,-90},{-70,-70}}, rotation= - 0))); - BoundaryConditions.RefXgas refXgas - annotation (Placement(transformation(extent={{8,-90},{28,-70}}))); -equation - connect(singularPressureLossVALI2.C2, StaticDrumTh1.Ce_eco) - annotation (Line( - points={{-60,-40},{-60,0.6},{-48,0.6}}, color={0,0,255})); - connect(singularPressureLossVALI1.C2, sinkP1.C) annotation (Line(points={{20, - 0},{40,0}}, color={0,0,255})); - connect(sensorT.C2, singularPressureLossVALI2.C1) annotation (Line(points={{60.2, - -80},{80,-80},{80,-60},{-80,-60},{-80,-40}}, color={0,0,255})); - connect(heatSource.C[1], StaticDrumTh1.Cth) - annotation (Line(points={{-70,20.2},{ - -70,10},{-44,10}}, color={191,95,0})); - connect(StaticDrumTh1.Cs_purg, singularPressureLossVALI1.C1) - annotation (Line( - points={{-34.6,6.6},{-19.3,6.6},{-19.3,0},{0,0}}, color={0,0,255})); - connect(StaticDrumTh1.Cs_sur, singularPressureLossVALI3.C1) - annotation (Line( - points={{-40.2,19.4},{-40.2,60},{-20,60}}, color={0,0,255})); - connect(singularPressureLossVALI3.C2, sensorT1.C1) - annotation (Line(points={{0,60},{20,60}}, color={0,0,255})); - connect(sensorT1.C2, sinkP2.C) - annotation (Line(points={{40.2,60},{60,60}}, color={0,0,255})); - connect(refQ.C2, refP.C1) annotation (Line(points={{-36,-80},{-26,-80}}, - color={0,0,255})); - connect(sourcePlug.C, refQ.C1) annotation (Line(points={{-70,-80},{-56,-80}}, - color={0,0,255})); - connect(refP.C2, refXgas.C1) - annotation (Line(points={{-6,-80},{8,-80}}, color={0,0,0})); - connect(refXgas.C2, sensorT.C1) - annotation (Line(points={{28,-80},{40,-80}}, color={0,0,0})); - annotation (experiment(StopTime=1000), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestStaticDrum1; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestStaticDrum2.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestStaticDrum2.mo deleted file mode 100644 index f235cd28..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestStaticDrum2.mo +++ /dev/null @@ -1,77 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestStaticDrum2 - - ThermoSysPro.Fluid.Junctions.StaticDrum StaticDrumTh1 - annotation (Placement(transformation(extent={{-54,0},{-34,20}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLossVALI1(K=1e-4) - annotation (Placement(transformation(extent={{0,-10},{20,10}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLossVALI2(K=1e-4) - annotation (Placement(transformation(extent={{-80,-50},{-60,-30}}, rotation= - 0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkP1(Q0=10) - annotation (Placement(transformation(extent={{40,-10},{60,10}}, rotation=0))); - ThermoSysPro.Fluid.Sensors.SensorT sensorT - annotation (Placement(transformation(extent={{-40,-82},{-20,-62}}, rotation= - 0))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(P0=100e5) - annotation (Placement(transformation(extent={{-90,-90},{-70,-70}}, rotation= - 0))); - ThermoSysPro.Thermal.BoundaryConditions.HeatSink heatSource - annotation (Placement(transformation(extent= - {{-80,20},{-60,40}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLossVALI3(K=1e-4) - annotation (Placement(transformation(extent={{-20,50},{0,70}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.Sink sinkP2 - annotation (Placement(transformation(extent={{60,50},{80,70}}, rotation=0))); - ThermoSysPro.Fluid.Sensors.SensorT sensorT1 - annotation (Placement(transformation(extent={{20,58},{40,78}}, rotation=0))); -equation - connect(singularPressureLossVALI2.C2, StaticDrumTh1.Ce_eco) - annotation (Line( - points={{-60,-40},{-48,-40},{-48,0.6}}, color={0,0,255})); - connect(singularPressureLossVALI1.C2, sinkP1.C) annotation (Line(points={{20, - 0},{40,0}}, color={0,0,255})); - connect(sensorT.C2, singularPressureLossVALI2.C1) annotation (Line(points={{ - -19.8,-80},{-10,-80},{-10,-54},{-80,-54},{-80,-40}}, color={0,0,255})); - connect(sourcePQ.C, sensorT.C1) annotation (Line(points={{-70,-80},{-40,-80}}, - color={0,0,255})); - connect(heatSource.C[1], StaticDrumTh1.Cth) - annotation (Line(points={{-70,20.2},{ - -70,10},{-44,10}}, color={191,95,0})); - connect(StaticDrumTh1.Cs_purg, singularPressureLossVALI1.C1) - annotation (Line( - points={{-34.6,6.6},{-19.3,6.6},{-19.3,0},{0,0}}, color={0,0,255})); - connect(StaticDrumTh1.Cs_sur, singularPressureLossVALI3.C1) - annotation (Line( - points={{-40.2,19.4},{-40.2,60},{-20,60}}, color={0,0,255})); - connect(singularPressureLossVALI3.C2, sensorT1.C1) - annotation (Line(points={{0,60},{20,60}}, color={0,0,255})); - connect(sensorT1.C2, sinkP2.C) - annotation (Line(points={{40.2,60},{60,60}}, color={0,0,255})); - annotation (experiment(StopTime=1000), Diagram(graphics), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestStaticDrum2; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestStaticExchangerDTorWorEff.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestStaticExchangerDTorWorEff.mo deleted file mode 100644 index a60588e8..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestStaticExchangerDTorWorEff.mo +++ /dev/null @@ -1,63 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestStaticExchangerDTorWorEff - - ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceWaterSteam_FF( - C(P(start=219.E5)), - Q0=481.07, - h0=1067.9E3) - annotation (Placement(transformation(extent={{-60,-20},{-40,0}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkWaterSteam_FF( - P0=217.68E5) - annotation (Placement(transformation(extent={{20,-20},{40,0}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceWaterSteam_FC( - C(P(start=24E5)), - Q0=23.377, - h0=3420.3E3) - annotation (Placement(transformation( - origin={-30,30}, - extent={{10,-10},{-10,10}}, - rotation=180))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkWaterSteam_FC( - P0=24.13E5) - annotation (Placement(transformation(extent={{-2,20},{20,40}}, rotation=0))); - ThermoSysPro.Fluid.HeatExchangers.StaticExchangerDTorWorEff - exchangerWaterSteamDTorWorEFF( - EffEch=1, - Kf=597.832, - Ec(P(start=23e5)), - Ef(P(start=219E5)), - exchanger_type=3) annotation (Placement(transformation(extent={{-20,-20}, - {0,0}}, rotation=0))); -equation - connect(sourceWaterSteam_FF.C, exchangerWaterSteamDTorWorEFF.Ef) - annotation (Line(points={{-40,-10},{-20,-10}}, color={0,0,255})); - connect(exchangerWaterSteamDTorWorEFF.Sf, sinkWaterSteam_FF.C) annotation (Line( - points={{0,-9.9},{10.2,-9.9},{10.2,-10},{20,-10}}, color={0,0,255})); - connect(sourceWaterSteam_FC.C, exchangerWaterSteamDTorWorEFF.Ec) annotation (Line( - points={{-20,30},{-14,30},{-14,-5.9}}, color={0,0,255})); - connect(exchangerWaterSteamDTorWorEFF.Sc, sinkWaterSteam_FC.C) annotation (Line( - points={{-6,-5.9},{-6,30},{-2,30}}, color={0,0,255})); - annotation (experiment(StopTime=1000), Diagram(graphics), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestStaticExchangerDTorWorEff; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestStaticExchangerKS.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestStaticExchangerKS.mo deleted file mode 100644 index a36c0d45..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestStaticExchangerKS.mo +++ /dev/null @@ -1,53 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestStaticExchangerKS - - ThermoSysPro.Fluid.HeatExchangers.StaticExchangerKS - plateHeatExchanger(region_c=ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region.Region_1, - region_f=ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region.Region_1) - annotation (Placement(transformation(extent={{-20,34},{20,66}}, - rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP2( - T0=340) - annotation (Placement(transformation(extent={{-80,20},{-60,40}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP3 - annotation (Placement(transformation(extent={{-80,60},{-60,80}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP puitsP2 - annotation (Placement(transformation( - extent={{60,20},{80,40}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP puitsP3 - annotation (Placement(transformation( - extent={{60,60},{80,80}}, rotation=0))); -equation - connect(sourceP2.C, plateHeatExchanger.Ec) - annotation (Line(points={{-60,30},{-40,30},{-40,45.2},{-20,45.2}}, - color={0,0,255})); - connect(sourceP3.C, plateHeatExchanger.Ef) annotation (Line(points={{-60,70}, - {-40,70},{-40,54.8},{-20,54.8}}, color={0,0,0})); - connect(plateHeatExchanger.Sc, puitsP2.C) annotation (Line(points={{20,45.2}, - {26,45.2},{26,46},{40,46},{40,30},{60,30}}, color={0,0,0})); - connect(plateHeatExchanger.Sf, puitsP3.C) annotation (Line(points={{20,54.8}, - {40,54.8},{40,70},{60,70}}, color={0,0,0})); - annotation (experiment(StopTime=1000), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestStaticExchangerKS; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestStaticFan.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestStaticFan.mo deleted file mode 100644 index 23c3c502..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestStaticFan.mo +++ /dev/null @@ -1,223 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestStaticFan - - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ Source_Fumees( - Xso2=0, - Xco2=0.0, - Xh2o=0.006, - Xo2=0.23, - Q0=4, - ftype=ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType.FlueGases, - P0=130000, - T0=300, - option_temperature=true) - annotation (Placement(transformation(extent={{-210,-24},{-164,24}}, - rotation=0))); - - ThermoSysPro.Fluid.BoundaryConditions.Sink Puits_Fumees - annotation (Placement(transformation( - origin={182,0}, - extent={{10,-10},{-10,10}}, - rotation=180))); - ThermoSysPro.Fluid.Volumes.VolumeATh dynamicExchanger(ftype= - ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType.FlueGases) - annotation (Placement(transformation(extent={{-68,50},{-48,70}}, rotation=0))); - ThermoSysPro.Thermal.BoundaryConditions.HeatSource heatSource( - option_temperature=2, W0={1e4}) - annotation (Placement(transformation(extent={{-48, - 90},{-28,110}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLossFlueGases( Q(fixed=false, start=10), K=10) - annotation (Placement(transformation(extent={ - {12,50},{32,70}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLossFlueGases1( Q(fixed=false, start= - 11), K=0.01) annotation (Placement(transformation(extent={ - {-108,50},{-88,70}}, rotation=0))); - ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Rampe rampe( - Starttime=50, - Duration=50, - Initialvalue=1e4, - Finalvalue=2e5) annotation (Placement(transformation(extent={{0,100},{-20, - 120}}, rotation=0))); - ThermoSysPro.Fluid.Machines.StaticFan staticFan( - VRotn=2700, - rm=1, - a2=0, - b1=-1.315, - b2=2.4593, - VRot=2700, - a1=-263.145, - a3=500, - Q(start=2), - Qv(start=1.4), - rho(start=1.4)) - annotation (Placement(transformation(extent={{52,50},{72,70}}, - rotation=0))); - ThermoSysPro.Fluid.PressureLosses.CheckValve - singularPressureLossFlueGases2( Q(fixed=false, start=10)) - annotation (Placement(transformation(extent={ - {92,50},{112,70}}, rotation=0))); - ThermoSysPro.Fluid.Volumes.VolumeATh dynamicExchanger1(ftype= - ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType.FlueGases) - annotation (Placement(transformation(extent={{-68,-70},{-48,-50}}, rotation= - 0))); - ThermoSysPro.Thermal.BoundaryConditions.HeatSource heatSource1( - option_temperature=2, W0={1e4}) - annotation (Placement(transformation(extent={{-48, - -90},{-28,-110}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLossFlueGases3( Q(fixed=false, start=10), K=10) - annotation (Placement(transformation(extent={ - {12,-70},{32,-50}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLossFlueGases4( Q(fixed=false, start= - 11), K=0.01) annotation (Placement(transformation(extent={ - {-108,-70},{-88,-50}}, rotation=0))); - ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Rampe rampe1( - Starttime=50, - Duration=50, - Initialvalue=1e4, - Finalvalue=2e5) annotation (Placement(transformation(extent={{0,-120},{-20, - -100}}, rotation=0))); - ThermoSysPro.Fluid.Machines.StaticFan staticFan1( - VRotn=2700, - rm=1, - b2=2.4593, - b1=-1.315, - VRot=2700, - a1=-263.145, - a2=0, - a3=500, - Q(start=2), - Qv(start=1.4), - rho(start=1.4)) - annotation (Placement(transformation(extent={{52,-70},{72,-50}}, - rotation=0))); - ThermoSysPro.Fluid.PressureLosses.CheckValve - singularPressureLossFlueGases5( Q(fixed=false, start=10)) - annotation (Placement(transformation(extent={ - {92,-70},{112,-50}}, rotation=0))); - ThermoSysPro.Fluid.Junctions.Mixer2 mixerFlueGases2_1(ftype=ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType.FlueGases) - annotation (Placement(transformation(extent={{132,-10},{152,10}}, rotation= - 0))); - ThermoSysPro.Fluid.Volumes.VolumeDTh volume2S( - dynamic_composition_balance=true, ftype=ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType.FlueGases) - annotation (Placement(transformation(extent={{-148,-10},{-128,10}}, - rotation=0))); - ThermoSysPro.Fluid.Sensors.SensorT temperatureSensor - annotation (Placement(transformation(extent={{-28,58},{-8,78}}, rotation=0))); - ThermoSysPro.Fluid.Sensors.SensorT temperatureSensor1 - annotation (Placement(transformation(extent={{-28,-62},{-8,-42}}, rotation= - 0))); - ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Rampe Qin( - Starttime=50, - Duration=50, - Initialvalue=4, - Finalvalue=1) annotation (Placement(transformation(extent={{-200,40},{ - -180,60}}, rotation=0))); -equation - connect(singularPressureLossFlueGases.C2, staticFan.C1) annotation (Line( - points={{32,60},{52,60}}, - color={0,0,0}, - thickness=1)); - connect(staticFan.C2, singularPressureLossFlueGases2.C1) annotation (Line( - points={{72,60},{91,60}}, - color={0,0,0}, - thickness=1)); - connect(singularPressureLossFlueGases3.C2, staticFan1.C1) annotation (Line( - points={{32,-60},{52,-60}}, - color={0,0,0}, - thickness=1)); - connect(staticFan1.C2, singularPressureLossFlueGases5.C1) annotation (Line( - points={{72,-60},{91,-60}}, - color={0,0,0}, - thickness=1)); - connect(singularPressureLossFlueGases2.C2, mixerFlueGases2_1.Ce1) annotation (Line( - points={{113,60},{138,60},{138,10}}, - color={0,0,0}, - thickness=1)); - connect(singularPressureLossFlueGases5.C2, mixerFlueGases2_1.Ce2) annotation (Line( - points={{113,-60},{138,-60},{138,-10}}, - color={0,0,0}, - thickness=1)); - connect(temperatureSensor1.C2, singularPressureLossFlueGases3.C1) annotation (Line( - points={{-7.8,-60},{12,-60}}, - color={0,0,0}, - thickness=1)); - connect(temperatureSensor.C2, singularPressureLossFlueGases.C1) annotation (Line( - points={{-7.8,60},{12,60}}, - color={0,0,0}, - thickness=1)); - connect(Source_Fumees.C, volume2S.Ce) annotation (Line( - points={{-164,0},{-148,0}}, - color={0,0,0}, - thickness=1)); - connect(volume2S.Cs1, singularPressureLossFlueGases1.C1) annotation (Line( - points={{-138,10},{-138,60},{-108,60}}, - color={0,0,0}, - thickness=1)); - connect(volume2S.Cs2, singularPressureLossFlueGases4.C1) annotation (Line( - points={{-138,-10},{-138,-60},{-108,-60}}, - color={0,0,0}, - thickness=1)); - connect(heatSource.C[1], dynamicExchanger.Cth) annotation (Line(points={{-38, - 90.2},{-58,60}}, color={191,95,0})); - connect(heatSource1.C[1], dynamicExchanger1.Cth) annotation (Line(points={{ - -38,-90.2},{-58,-60}}, color={191,95,0})); - connect(mixerFlueGases2_1.Cs, Puits_Fumees.C) annotation (Line( - points={{152,0},{162,0},{162,-1.20011e-015},{172,-1.20011e-015}}, - color={0,0,0}, - thickness=1)); - connect(singularPressureLossFlueGases1.C2, dynamicExchanger.Ce1) annotation (Line( - points={{-88,60},{-68,60}}, - color={0,0,0}, - thickness=1, - smooth=Smooth.None)); - connect(dynamicExchanger.Cs1, temperatureSensor.C1) annotation (Line( - points={{-48,60},{-28,60}}, - color={0,0,0}, - thickness=1, - smooth=Smooth.None)); - connect(Qin.y, Source_Fumees.IMassFlow) - annotation (Line(points={{-179,50},{-170,50},{-170,28},{-187,28},{-187,12}})); - connect(singularPressureLossFlueGases4.C2, dynamicExchanger1.Ce1) annotation ( - Line( - points={{-88,-60},{-68,-60}}, - color={0,0,0}, - thickness=1)); - connect(dynamicExchanger1.Cs1, temperatureSensor1.C1) annotation (Line( - points={{-48,-60},{-38,-60},{-28,-60}}, - color={0,0,0}, - thickness=1)); - connect(rampe.y, heatSource.ISignal) - annotation (Line(points={{-21,110},{-38,110},{-38,105}}, color={0,0,255})); - connect(rampe1.y, heatSource1.ISignal) annotation (Line(points={{-21,-110},{ - -38,-110},{-38,-105}}, color={0,0,255})); - annotation (experiment(StopTime=1000), Diagram(coordinateSystem( - preserveAspectRatio=false, - extent={{-200,-150},{200,150}}, - initialScale=0.1)), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestStaticFan; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestStaticPlateHeatExchanger.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestStaticPlateHeatExchanger.mo deleted file mode 100644 index 1deede17..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestStaticPlateHeatExchanger.mo +++ /dev/null @@ -1,55 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestStaticPlateHeatExchanger - - ThermoSysPro.Fluid.HeatExchangers.StaticPlateHeatExchanger - plateHeatExchanger(region_c=ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region.Region_1, - region_f=ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region.Region_1) - annotation (Placement(transformation(extent={{-20,44},{0,64}}, - rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP2( - T0=340) - annotation (Placement(transformation(extent={{-80,44},{-60,64}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP3 - annotation (Placement(transformation(extent={{-60,24},{-40,44}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP puitsP2 - annotation (Placement(transformation( - extent={{40,44},{60,64}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP puitsP3 - annotation (Placement(transformation( - extent={{20,24},{40,44}}, rotation=0))); -equation - connect(sourceP2.C, plateHeatExchanger.Ec) - annotation (Line(points={{-60,54},{-20,54}}, color={0,0,255})); - connect(sourceP3.C, plateHeatExchanger.Ef) - annotation (Line(points={{-40,34},{ - -15,34},{-15,48}}, color={0,0,255})); - connect(plateHeatExchanger.Sc, puitsP2.C) - annotation (Line(points={{0,54.2},{ - 20,54.2},{20,54},{40,54}}, color={0,0,255})); - connect(plateHeatExchanger.Sf, puitsP3.C) - annotation (Line(points={{-5,48},{-6, - 48},{-6,34},{20,34}}, color={0,0,255})); - annotation (experiment(StopTime=1000), Diagram(graphics), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestStaticPlateHeatExchanger; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestStaticWallFlueGasesExchanger.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestStaticWallFlueGasesExchanger.mo deleted file mode 100644 index 8f971ba9..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestStaticWallFlueGasesExchanger.mo +++ /dev/null @@ -1,68 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestStaticWallFlueGasesExchanger - - HeatExchangers.StaticWallFlueGasesExchanger - dynamicOnePhaseFlowPipe( - Q(start={536.5750641592207,536.5750641592207,536.5750641592207, - 536.5750641592207,536.5750641592207,536.5750641592207, - 536.5750641592207,536.5750641592207,536.5750641592207, - 536.5750641592207,536.5750641592207}), - h(start={71016.12237181116,74743.46665892199,78470.81094603281, - 82198.15523314364,85925.49952025448,89652.84380736532, - 93380.18809447614,97107.53238158698,100834.8766686978, - 104562.22095580865,108289.56524291947,70825.9016030344}), - p_rho=998, - P(start={300000,281833.41863537,263664.30473175,245492.47958308, - 227317.76827098,209139.99948382,190959.00534677,172774.621262, - 154586.68575823,136395.04034906,118199.5293995,100000})) - annotation (Placement(transformation(extent={{-20, - 20},{0,40}}, rotation=0))); - BoundaryConditions.SourcePQ sourceP( - option_temperature=true, - Q0=1, - ftype=ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType.FlueGases) - annotation (Placement(transformation(extent={{-60,20},{-40,40}}, rotation=0))); - BoundaryConditions.Sink sinkP - annotation (Placement(transformation(extent={{20,20},{40,40}}, rotation=0))); - ThermoSysPro.Thermal.BoundaryConditions.HeatSource heatSource( - T0={273 + 400,273 + 400,273 + 400,273 + 400,273 + 400,273 + 400,273 + 400, - 273 + 400,273 + 400,273 + 400}, - option_temperature=2, - W0={6e4,6e4,6e4,6e4,6e4,6e4,6e4,6e4,6e4,6e4}) - annotation (Placement(transformation(extent={{-20,60},{0,80}}, rotation=0))); - ThermoSysPro.Thermal.HeatTransfer.HeatExchangerWall heatExchangerWall(Ns=10, - dynamic_energy_balance=false) - annotation (Placement(transformation(extent={{-20,40},{0,60}}, rotation=0))); -equation - connect(sourceP.C, dynamicOnePhaseFlowPipe.C1) annotation (Line(points={{-40, - 30},{-20,30}}, color={0,0,255})); - connect(dynamicOnePhaseFlowPipe.C2, sinkP.C) annotation (Line(points={{0,30}, - {20,30}}, color={0,0,255})); - connect(heatSource.C, heatExchangerWall.WT2) annotation (Line(points={{-10, - 60.2},{-10,52}}, color={191,95,0})); - connect(heatExchangerWall.WT1, dynamicOnePhaseFlowPipe.CTh) - annotation (Line(points={{-10,48},{-10,33}}, color={191,95,0})); - annotation (experiment(StopTime=1000), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestStaticWallFlueGasesExchanger; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestSteamDryer1.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestSteamDryer1.mo deleted file mode 100644 index 22da154a..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestSteamDryer1.mo +++ /dev/null @@ -1,62 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestSteamDryer1 - - ThermoSysPro.Fluid.Junctions.SteamDryer steamDryer( - eta=1, - h(start=3e6), - P(start=10000000)) - annotation (Placement(transformation(extent={{-20,20},{0,40}}, - rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(h0=3000000) - annotation (Placement(transformation(extent={{-100,20},{-80,40}}, rotation= - 0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss2 annotation (Placement(transformation(extent={{-60,20}, - {-40,40}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP(P0=100e5) - annotation (Placement(transformation(extent={{60,20},{80,40}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss1 annotation (Placement(transformation(extent={{20,20}, - {40,40}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss3(K=2.e-3) - annotation (Placement(transformation(extent={{0,-20}, - {20,0}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.Sink sink - annotation (Placement(transformation(extent={{40,-20},{60,0}}, rotation=0))); -equation - connect(sourceQ.C,singularPressureLoss2. C1) annotation (Line(points={{-80,30}, - {-60,30}}, color={0,0,255})); - connect(singularPressureLoss1.C2,sinkP. C) - annotation (Line(points={{40,30},{60,30}}, color={0,0,255})); - connect(singularPressureLoss3.C2,sink. C) - annotation (Line(points={{20,-10},{40,-10}}, color={0,0,255})); - connect(singularPressureLoss2.C2, steamDryer.Cev) annotation (Line(points={{ - -40,30},{-30,30},{-30,34},{-19.9,34}}, color={0,0,255})); - connect(steamDryer.Csv, singularPressureLoss1.C1) annotation (Line(points={{ - -0.1,34},{10,34},{10,30},{20,30}}, color={0,0,255})); - connect(steamDryer.Csl, singularPressureLoss3.C1) annotation (Line(points={{ - -9.9,20},{-10,20},{-10,-10},{0,-10}}, color={0,0,255})); - annotation (experiment(StopTime=1000), Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestSteamDryer1; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestSteamDryer2.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestSteamDryer2.mo deleted file mode 100644 index 00593ee7..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestSteamDryer2.mo +++ /dev/null @@ -1,62 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestSteamDryer2 - - ThermoSysPro.Fluid.Junctions.SteamDryer steamDryer(eta=0.9, P(start= - 10000000)) annotation (Placement(transformation(extent={{-10,-8},{10, - 12}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourceQ(P0=10000000, h0= - 2400000) - annotation (Placement(transformation(extent={{-90,-4},{-70,16}}, rotation= - 0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss2 annotation (Placement(transformation(extent={{-50,-4}, - {-30,16}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.Sink sinkP - annotation (Placement(transformation(extent={{70,-4},{90,16}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss1 annotation (Placement(transformation(extent={{30,-4}, - {50,16}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss3(K=1.e-4) - annotation (Placement(transformation(extent={{30,-44}, - {50,-24}}, - rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.Sink sink - annotation (Placement(transformation(extent={{70,-44},{90,-24}}, - rotation=0))); -equation - connect(sourceQ.C,singularPressureLoss2. C1) annotation (Line(points={{-70,6}, - {-50,6}}, color={0,0,255})); - connect(singularPressureLoss1.C2,sinkP. C) - annotation (Line(points={{50,6},{70,6}}, color={0,0,255})); - connect(singularPressureLoss3.C2,sink. C) - annotation (Line(points={{50,-34},{70,-34}}, color={0,0,255})); - connect(singularPressureLoss2.C2, steamDryer.Cev) annotation (Line(points={{-30,6}, - {-20,6},{-9.9,6}}, color={0,0,255})); - connect(steamDryer.Csv, singularPressureLoss1.C1) annotation (Line(points={{9.9,6}, - {20,6},{30,6}}, color={0,0,255})); - connect(steamDryer.Csl, singularPressureLoss3.C1) annotation (Line(points={{0.1,-8}, - {0,-8},{0,-34},{30,-34}}, color={0,0,255})); - annotation (experiment(StopTime=10), Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestSteamDryer2; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestSteamEngine.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestSteamEngine.mo deleted file mode 100644 index 92d0af3c..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestSteamEngine.mo +++ /dev/null @@ -1,51 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestSteamEngine - - ThermoSysPro.Fluid.Machines.SteamEngine steamEngine1 - annotation (Placement(transformation(extent={{-60,60},{-40,80}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP puitsP(P0=100000) - annotation (Placement(transformation(extent={{-20,60},{0,80}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP( - h0=3.e6, - option_temperature=false, - P0=16e5) annotation (Placement(transformation(extent={{-100,60},{-80,80}}, - rotation=0))); -equation - connect(sourceP.C, steamEngine1.C1) - annotation (Line(points={{-80,70},{-57,70}}, color={0,0,255})); - connect(steamEngine1.C2, puitsP.C) - annotation (Line(points={{-43,70},{-31.5,70},{-31.5,70},{-20,70}}, color={0, - 0,255})); - annotation (experiment(StopTime=1000), - Window( - x=0.32, - y=0.02, - width=0.39, - height=0.47), - Diagram(coordinateSystem( - preserveAspectRatio=false, - extent={{-100,-100},{100,100}}, - grid={2,2}), graphics), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestSteamEngine; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestSteamExtractionSplitter.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestSteamExtractionSplitter.mo deleted file mode 100644 index a80faebc..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestSteamExtractionSplitter.mo +++ /dev/null @@ -1,61 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestSteamExtractionSplitter - - ThermoSysPro.Fluid.Junctions.SteamExtractionSplitter - steamExtractionSplitter(alpha=0.9) - annotation (Placement(transformation(extent={{-20, - 20},{0,40}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(h0=2600000) - annotation (Placement(transformation(extent={{-100,20},{-80,40}}, rotation= - 0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss2 annotation (Placement(transformation(extent={{-60,20}, - {-40,40}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP(P0=100e5) - annotation (Placement(transformation(extent={{60,20},{80,40}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss1 annotation (Placement(transformation(extent={{20,20}, - {40,40}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss3(K=2.e-3) - annotation (Placement(transformation(extent={{0,-20}, - {20,0}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkQ sink(Q0=10) - annotation (Placement(transformation(extent={{40,-20},{60,0}}, rotation=0))); -equation - connect(sourceQ.C, singularPressureLoss2.C1) annotation (Line(points={{-80,30}, - {-60,30}}, color={0,0,255})); - connect(singularPressureLoss2.C2, steamExtractionSplitter.Ce) annotation (Line( - points={{-40,30},{-20.3,30}}, color={0,0,255})); - connect(steamExtractionSplitter.Cs, singularPressureLoss1.C1) annotation (Line( - points={{0.3,30},{20,30}}, color={0,0,255})); - connect(steamExtractionSplitter.Cex, singularPressureLoss3.C1) annotation (Line( - points={{-6,20},{-6,-10},{0,-10}}, color={0,0,255})); - connect(singularPressureLoss1.C2, sinkP.C) - annotation (Line(points={{40,30},{60,30}}, color={0,0,255})); - connect(singularPressureLoss3.C2, sink.C) - annotation (Line(points={{20,-10},{40,-10}}, color={0,0,255})); - annotation (experiment(StopTime=1000), Diagram(graphics), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestSteamExtractionSplitter; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestStodolaTurbine1.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestStodolaTurbine1.mo deleted file mode 100644 index e1c0bdb3..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestStodolaTurbine1.mo +++ /dev/null @@ -1,92 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestStodolaTurbine1 - parameter Units.SI.AbsolutePressure PoutPump(fixed=false, start=13e5) - "Flow pressure at the outlet of the pump"; - ThermoSysPro.Fluid.Machines.StodolaTurbine stodolaTurbine(pros1(x(start= - 1)), Hrs(start=2931e3), - pros(d(start=19.715136086827403)), - Ce(h(start=3000000.0)), - proe(T(start=613.0), x(start=1.0))) - annotation (Placement(transformation(extent={{-60,60},{-40,80}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP puitsP(P0=45e5, - C(h_vol_1(start=75002))) - annotation (Placement(transformation(extent={{-20,60},{0,80}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP( - h0=3.e6, - option_temperature=false, - P0=6500000, - region=ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region.Region_2) - annotation (Placement(transformation(extent={{-100,60},{-80,80}}, - rotation=0))); - ThermoSysPro.Fluid.Machines.CentrifugalPump - DynamicCentrifugalPump1( - Q(fixed=true, start=50), - Qv(start=23.0), - Pm(start=1158163.6), - h(start=3041170.0441966015), - C1(P(start=10e5)), - C2(P(start=3.e6), h(start=3082340.088393203)), - hn(start=7119.0), - w_a(start=20.0)) - annotation (Placement(transformation(extent={{20,-40},{40,-20}}, rotation=0))); - ThermoSysPro.ElectroMechanics.Machines.Shaft Shaft1 - annotation (Placement(transformation(extent={{-20,-90},{0,-70}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP puitsP1(P0=13e5) - annotation (Placement(transformation(extent={{60,-40},{80,-20}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP1( - h0=3.e6, - option_temperature=false, - P0=1000000, - region=ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region.Region_2) - annotation (Placement(transformation(extent={{-20,-40},{0,-20}}, - rotation=0))); - InstrumentationAndControl.Blocks.Sources.Constante Pout(k=PoutPump) - annotation (Placement(transformation(extent={{56,-12},{68,0}}, rotation=0))); -equation - connect(Shaft1.C2, DynamicCentrifugalPump1.M) - annotation (Line(points={{1,-80},{30,-80},{30,-41}})); - connect(stodolaTurbine.M, Shaft1.C1) - annotation (Line(points={{-50,60},{-50,-80},{-21,-80}})); - connect(sourceP1.C, DynamicCentrifugalPump1.C1) - annotation (Line(points={{0,-30},{20,-30}}, color={0,0,255})); - connect(DynamicCentrifugalPump1.C2, puitsP1.C) annotation (Line(points={{40,-30}, - {50,-30},{50,-30},{60,-30}}, color={0,0,255})); - connect(sourceP.C, stodolaTurbine.Ce) - annotation (Line(points={{-80,70},{-60.1,70}}, color={0,0,255})); - connect(stodolaTurbine.Cs, puitsP.C) - annotation (Line(points={{-39.9,70},{-20,70}}, color={0,0,255})); - connect(Pout.y, puitsP1.IPressure) - annotation (Line(points={{68.6,-6},{88,-6},{88,-30},{75,-30}})); - annotation (experiment(StopTime=1000), - Window( - x=0.32, - y=0.02, - width=0.39, - height=0.47), - Diagram(coordinateSystem( - preserveAspectRatio=false, - extent={{-100,-100},{100,100}}, - grid={2,2}), graphics), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestStodolaTurbine1; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestStodolaTurbine2.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestStodolaTurbine2.mo deleted file mode 100644 index 79bba323..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestStodolaTurbine2.mo +++ /dev/null @@ -1,53 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestStodolaTurbine2 - - ThermoSysPro.Fluid.Machines.StodolaTurbine stodolaTurbine(Ce(h(start= - 3000000.0))) - annotation (Placement(transformation(extent={{-60,60},{-40,80}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP puitsP(P0=5000) - annotation (Placement(transformation(extent={{-20,60},{0,80}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP( - h0=3.e6, - option_temperature=false, - P0=300000, - region=ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region.Region_2) - annotation (Placement(transformation(extent={{-100,60},{-80,80}}, - rotation=0))); -equation - connect(sourceP.C, stodolaTurbine.Ce) - annotation (Line(points={{-80,70},{-60.1,70}}, color={0,0,255})); - connect(stodolaTurbine.Cs, puitsP.C) - annotation (Line(points={{-39.9,70},{-20,70}}, color={0,0,255})); - annotation (experiment(StopTime=1000), - Window( - x=0.32, - y=0.02, - width=0.39, - height=0.47), - Diagram(coordinateSystem( - preserveAspectRatio=false, - extent={{-100,-100},{100,100}}, - grid={2,2}), graphics), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestStodolaTurbine2; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestSwitchValve.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestSwitchValve.mo deleted file mode 100644 index d36a372d..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestSwitchValve.mo +++ /dev/null @@ -1,67 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestSwitchValve - - ThermoSysPro.Fluid.BoundaryConditions.SourceP SourceP1 - annotation (Placement(transformation(extent={{-100,-10},{-80,10}},rotation= - 0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP PuitsP1 - annotation (Placement(transformation( - extent={{80,-10},{100,10}}, - rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SwitchValve SwitchValve - annotation (Placement(transformation( - extent={{-10,-4},{10,16}},rotation=0))); - ThermoSysPro.InstrumentationAndControl.Blocks.Logique.Pulse pulse( - width=10, period=20) - annotation (Placement(transformation(extent={{-60,50},{-40,70}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe perteDP2 - annotation (Placement(transformation( - extent={{-60,-10},{-39,10}},rotation=0))); - ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe perteDP1 - annotation (Placement(transformation( - extent={{40,-10},{60,10}},rotation=0))); -equation - connect(pulse.yL, SwitchValve.Ouv) annotation (Line(points={{-39,60},{0,60},{ - 0,13.2}})); - connect(SourceP1.C, perteDP2.C1) - annotation (Line(points={{-80,0},{-60,0}}, color={0,0,255})); - connect(perteDP2.C2, SwitchValve.C1) annotation (Line(points={{-39,0},{-10,0}}, - color={0,0,255})); - connect(SwitchValve.C2, perteDP1.C1) annotation (Line(points={{10,0},{40,0}}, - color={0,0,255})); - connect(perteDP1.C2, PuitsP1.C) - annotation (Line(points={{60,0},{80,0}}, color={0,0,255})); - annotation (experiment(StopTime=100), - Window( - x=0.45, - y=0.01, - width=0.35, - height=0.49), - Diagram(graphics, - coordinateSystem( - preserveAspectRatio=false, - extent={{-100,-100},{100,100}}, - grid={2,2})), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestSwitchValve; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestTank.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestTank.mo deleted file mode 100644 index 75adcf07..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestTank.mo +++ /dev/null @@ -1,67 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestTank - - ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe PerteDP1(C1(P(start= - 400000.0)), Q(start=600.0)) - annotation (Placement(transformation(extent={{30,-50},{50,-30}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.ControlValve VanneReglante1(Pm(start= - 200000.0), Q(start=0.0)) - annotation (Placement(transformation(extent={{-50,2},{-30,22}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceP SourceP1 - annotation (Placement( - transformation(extent={{-90,-4},{-70,16}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP PuitsP1 - annotation (Placement(transformation( - extent={{70,-50},{90,-30}}, rotation=0))); - ThermoSysPro.Fluid.Volumes.Tank Tank1(z(fixed=false, start=5), Cs1(Q(start= - 0.0)), - steady_state=true) - annotation (Placement(transformation(extent={{-10,-10},{10,10}}, - rotation=0))); - ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Rampe Rampe1 - annotation (Placement(transformation(extent={{-90,30},{-70,50}}, rotation= - 0))); - ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe PerteDP2 - annotation (Placement(transformation(extent={{30,-4},{50,16}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP PuitsP2 - annotation (Placement(transformation( - extent={{70,-4},{90,16}}, rotation=0))); -equation - connect(PerteDP1.C2, PuitsP1.C) - annotation (Line(points={{50,-40},{70,-40}}, color={0,0,255})); - connect(SourceP1.C, VanneReglante1.C1) - annotation (Line(points={{-70,6},{-50,6}}, color={0,0,255})); - connect(Tank1.Cs2, PerteDP1.C1) annotation (Line(points={{10,-6},{20,-6},{20, - -40},{30,-40}}, color={0,0,255})); - connect(Rampe1.y, VanneReglante1.Ouv) - annotation (Line(points={{-69,40},{-40,40},{-40,23}})); - connect(VanneReglante1.C2, Tank1.Ce1) annotation (Line(points={{-30,6},{-20,6}, - {-10,6}}, color={0,0,255})); - connect(Tank1.Cs1, PerteDP2.C1) - annotation (Line(points={{10.2,6},{20,6},{30,6}}, color={0,0,255})); - connect(PerteDP2.C2, PuitsP2.C) - annotation (Line(points={{50,6},{50,6},{70,6}}, color={0,0,255})); - annotation (experiment(StopTime=20), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestTank; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestTankHorizontal.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestTankHorizontal.mo deleted file mode 100644 index 67788b89..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestTankHorizontal.mo +++ /dev/null @@ -1,69 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestTankHorizontal - - ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe PerteDP1(C1(P(start= - 400000.0)), Q(start=600.0)) - annotation (Placement(transformation(extent={{32,-20},{52,0}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.ControlValve VanneReglante1(Pm(start= - 200000.0), Q(start=0.0)) - annotation (Placement(transformation(extent={{-50,6},{-30,26}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceP SourceP1 - annotation (Placement( - transformation(extent={{-90,0},{-70,20}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP PuitsP1 - annotation (Placement(transformation( - extent={{70,-20},{90,0}}, rotation=0))); - Volumes.TankHorizontal Tank1(z(fixed=false, start=5), Cs1(Q(start= - 0.0)), - diffusion=true, - dynamic_mass_balance=true) - annotation (Placement(transformation(extent={{-20,-20},{20,20}}, - rotation=0))); - ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Rampe Rampe1 - annotation (Placement(transformation(extent={{-90,30},{-70,50}}, rotation= - 0))); - ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe PerteDP2 - annotation (Placement(transformation(extent={{32,0},{52,20}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP PuitsP2 - annotation (Placement(transformation( - extent={{70,0},{90,20}}, rotation=0))); -equation - connect(PerteDP1.C2, PuitsP1.C) - annotation (Line(points={{52,-10},{70,-10}}, color={0,0,255})); - connect(SourceP1.C, VanneReglante1.C1) - annotation (Line(points={{-70,10},{-50,10}}, color={0,0,255})); - connect(Tank1.Cs2, PerteDP1.C1) annotation (Line(points={{20,-10},{32,-10}}, - color={0,0,255})); - connect(Rampe1.y, VanneReglante1.Ouv) - annotation (Line(points={{-69,40},{-40,40},{-40,27}})); - connect(VanneReglante1.C2, Tank1.Ce1) annotation (Line(points={{-30,10},{-20, - 10}}, color={0,0,255})); - connect(Tank1.Cs1, PerteDP2.C1) - annotation (Line(points={{20.4,9.8},{20.4,10},{32,10}}, - color={0,0,255})); - connect(PerteDP2.C2, PuitsP2.C) - annotation (Line(points={{52,10},{70,10}}, color={0,0,255})); - annotation (experiment(StopTime=20), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestTankHorizontal; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestThreeWayValve.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestThreeWayValve.mo deleted file mode 100644 index f473116f..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestThreeWayValve.mo +++ /dev/null @@ -1,64 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestThreeWayValve - - ThermoSysPro.Fluid.BoundaryConditions.SourceP SourceP1 - annotation (Placement(transformation(extent={{-90,-10},{-70,10}}, rotation= - 0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP PuitsP1 - annotation (Placement(transformation( - extent={{70,-10},{90,10}},rotation=0))); - ThermoSysPro.Fluid.PressureLosses.ThreeWayValve threeWayValve( - C2(Q(start=-7.902947109890763E-33)), - C3(Q(start=2716.4138702433384)), - Valve1(Pm(start=200000.0)), - VolumeA1(h(start=71016.12237181117))) - annotation (Placement(transformation(extent={{-10,-6},{10,14}},rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP PuitsP2 - annotation (Placement(transformation( - extent={{70,-50},{90,-30}}, - rotation=0))); - ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Rampe rampe - annotation (Placement(transformation( - extent={{-50,30},{-30,50}}, rotation=0))); -equation - connect(rampe.y, threeWayValve.Ouv) - annotation (Line(points={{-29,40},{0,40},{0,15}})); - connect(SourceP1.C, threeWayValve.C1) - annotation (Line(points={{-70,0},{-10,0}}, color={0,0,0})); - connect(threeWayValve.C2, PuitsP1.C) - annotation (Line(points={{10,0},{70,0}}, color={0,0,0})); - connect(threeWayValve.C3, PuitsP2.C) - annotation (Line(points={{0,-6},{0,-40},{70,-40}}, color={0,0,0})); - annotation (experiment(StopTime=5), - Window( - x=0.45, - y=0.01, - width=0.35, - height=0.49), - Diagram(coordinateSystem( - preserveAspectRatio=false, - extent={{-100,-100},{100,100}}, - grid={2,2})), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestThreeWayValve; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestTwoPhaseCavity.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestTwoPhaseCavity.mo deleted file mode 100644 index 094b27d6..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestTwoPhaseCavity.mo +++ /dev/null @@ -1,116 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestTwoPhaseCavity - parameter ThermoSysPro.Units.xSI.Cv CvmaxWater=670 - "Maximum CV (active if mode_caract=0)"; - PressureLosses.ControlValve feedwaterValve( - Cv(start=335), - C1( - h_vol_1(start=1400e3), - h(start=1400e3), - P(start=13300000), - h_vol_2(start=1975433.4222685455)), - rho(start=888), - h(start=1400000), - Cvmax=CvmaxWater, - Q(start=10), - Pm(start=13200000.029884)) - annotation (Placement(transformation(extent={{-98,96},{-78, - 116}}, rotation=0))); - PressureLosses.ControlValve steamValve( - Cv(start=25000), - Q(start=0.0), - rho(start=78.5), - h(start=2657930), - C1(h_vol_2(start=2655313.7785675577)), - Cvmax(fixed=false), - Pm(start=12998726.577779)) - annotation (Placement(transformation(extent={{-60,136},{-40,156}}, - rotation=0))); - ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Constante - ConsigneNiveauBallon(k=0.5) - annotation (Placement(transformation(extent={{-138,120},{-118,140}}, - rotation=0))); - ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Constante - ConsigneNiveauBallon1(k=0.5) - annotation (Placement(transformation(extent={{-100,160},{-80,180}}, - rotation=0))); - BoundaryConditions.SourceP sourceP(h0=1400000, - option_temperature=false, - P0=13200000) - annotation (Placement(transformation(extent={{-138,90},{-118,110}}, - rotation=0))); - BoundaryConditions.SinkP sinkQ(P0=13200000, Q(start= - 51.00572315373906)) - annotation (Placement(transformation(extent={{0,-60},{20,-40}}, rotation=0))); - Volumes.TwoPhaseCavity twoPhaseVolume( - Vv(start=0.5, fixed=true), - diffusion=true, - dynamic_energy_balance=false, - P0=13200000, - Pfond(start=13200000)) - annotation (Placement(transformation(extent={{-60,20},{20,100}}))); - PressureLosses.LumpedStraightPipe lumpedStraightPipe annotation (Placement( - transformation( - extent={{10,-10},{-10,10}}, - rotation=90, - origin={-20,-10}))); - BoundaryConditions.SourceP sourceP1( - P0(fixed=true) = 13200000, - option_temperature=false, - h0=2600000) - annotation (Placement(transformation(extent={{-100,130},{-80,150}}, - rotation=0))); -equation - connect(ConsigneNiveauBallon.y,feedwaterValve. Ouv) - annotation (Line(points={{-117,130},{-88,130},{-88,117}}, smooth=Smooth.None)); - connect(sourceP.C,feedwaterValve. C1) annotation (Line( - points={{-118,100},{-98,100}}, - color={0,0,255}, - smooth=Smooth.None)); - connect(ConsigneNiveauBallon1.y,steamValve. Ouv) - annotation (Line(points={{-79,170},{-50,170},{-50,157}}, - smooth=Smooth.None)); - connect(lumpedStraightPipe.C2, sinkQ.C) - annotation (Line(points={{-20,-20},{-20,-50},{0,-50}}, color={0,0,0})); - connect(sourceP1.C, steamValve.C1) - annotation (Line(points={{-80,140},{-60,140}}, color={0,0,0})); - connect(twoPhaseVolume.Cl, lumpedStraightPipe.C1) annotation (Line(points={{ - -19.5556,30.6667},{-19.5556,15.3333},{-20,15.3333},{-20,0}}, color={0, - 0,0})); - connect(steamValve.C2, twoPhaseVolume.Cv) annotation (Line(points={{-40,140}, - {-19.5556,140},{-19.5556,89.3333}}, color={0,0,0})); - connect(feedwaterValve.C2, twoPhaseVolume.Ce) annotation (Line(points={{-78,100}, - {-35.5556,100},{-35.5556,89.3333}}, color={0,0,0})); - annotation (experiment(__Dymola_Algorithm="Dassl"), - Window( - x=0.43, - y=0, - width=0.57, - height=0.63), - Diagram(coordinateSystem( - preserveAspectRatio=false, - extent={{-200,-100},{140,200}}, - grid={2,2})), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestTwoPhaseCavity; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestTwoPhaseCavityOnePipe.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestTwoPhaseCavityOnePipe.mo deleted file mode 100644 index a70d61b5..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestTwoPhaseCavityOnePipe.mo +++ /dev/null @@ -1,122 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestTwoPhaseCavityOnePipe - parameter ThermoSysPro.Units.xSI.Cv CvmaxWater=670 - "Maximum CV (active if mode_caract=0)"; - PressureLosses.ControlValve feedwaterValve( - Cv(start=335), - C1( - h_vol_1(start=1400e3), - h(start=1400e3), - P(start=13300000), - h_vol_2(start=1399988.8233534198)), - rho(start=888), - h(start=1400000), - Cvmax=CvmaxWater, - Q(start=58.005768798668484), - Pm(start=13146647.912081594)) - annotation (Placement(transformation(extent={{-98,96},{-78, - 116}}, rotation=0))); - PressureLosses.ControlValve steamValve( - Cv(start=25000), - Q(start=6.303270420619601E-10), - rho(start=78.5), - h(start=2657930), - C1(h_vol_2(start=2658519.5634182408)), - Cvmax(fixed=false), - Pm(start=12998726.577779)) - annotation (Placement(transformation(extent={{-60,136},{-40,156}}, - rotation=0))); - ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Constante - ConsigneNiveauBallon(k=0.5) - annotation (Placement(transformation(extent={{-138,120},{-118,140}}, - rotation=0))); - ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Constante - ConsigneNiveauBallon1(k=0.5) - annotation (Placement(transformation(extent={{-100,160},{-80,180}}, - rotation=0))); - BoundaryConditions.SourceP sourceP(h0=1400000, - option_temperature=false, - P0=13200000) - annotation (Placement(transformation(extent={{-138,90},{-118,110}}, - rotation=0))); - BoundaryConditions.SinkP sinkQ(P0=13200000, Q(start= - 51.00572315373906)) - annotation (Placement(transformation(extent={{0,-60},{20,-40}}, rotation=0))); - Volumes.TwoPhaseCavityOnePipe - twoPhaseVolume( - Vv(start=0.5, fixed=true), - diffusion=true, - hl(start=1400000.0), - hv(start=2410000.0), - Cal_hcond=false, - dynamic_energy_balance=false, - P0=13200000, - Pfond(start=13203663.545897305), - Tp(start=583.6846968972088), - hvIn(start=2400966.7047930923)) - annotation (Placement(transformation(extent={{-60,20},{20,100}}))); - PressureLosses.LumpedStraightPipe lumpedStraightPipe annotation (Placement( - transformation( - extent={{10,-10},{-10,10}}, - rotation=90, - origin={-20,-10}))); - BoundaryConditions.SourceP sourceP1( - P0(fixed=true) = 13200000, - option_temperature=false, - h0=2600000) - annotation (Placement(transformation(extent={{-100,130},{-80,150}}, - rotation=0))); -equation - connect(ConsigneNiveauBallon.y,feedwaterValve. Ouv) - annotation (Line(points={{-117,130},{-88,130},{-88,117}}, smooth=Smooth.None)); - connect(sourceP.C,feedwaterValve. C1) annotation (Line( - points={{-118,100},{-98,100}}, - color={0,0,255}, - smooth=Smooth.None)); - connect(ConsigneNiveauBallon1.y,steamValve. Ouv) - annotation (Line(points={{-79,170},{-50,170},{-50,157}}, - smooth=Smooth.None)); - connect(lumpedStraightPipe.C2, sinkQ.C) - annotation (Line(points={{-20,-20},{-20,-50},{0,-50}}, color={0,0,0})); - connect(sourceP1.C, steamValve.C1) - annotation (Line(points={{-80,140},{-60,140}}, color={0,0,0})); - connect(twoPhaseVolume.Cl, lumpedStraightPipe.C1) annotation (Line(points={{-20, - 30.6667},{-20,15.3333},{-20,15.3333},{-20,0}}, color={0, - 0,0})); - connect(feedwaterValve.C2, twoPhaseVolume.Ce) annotation (Line(points={{-78,100}, - {-50.6286,100},{-50.6286,81.0667}}, color={0,0,0})); - connect(steamValve.C2, twoPhaseVolume.CvBP) annotation (Line(points={{-40,140}, - {-20.2286,140},{-20.2286,89.3333}}, color={0,0,0})); - annotation (experiment(__Dymola_Algorithm="Dassl"), - Window( - x=0.43, - y=0, - width=0.57, - height=0.63), - Diagram(coordinateSystem( - preserveAspectRatio=false, - extent={{-200,-100},{140,200}}, - grid={2,2})), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestTwoPhaseCavityOnePipe; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestTwoPhaseVolume.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestTwoPhaseVolume.mo deleted file mode 100644 index 15f1f896..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestTwoPhaseVolume.mo +++ /dev/null @@ -1,116 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestTwoPhaseVolume - parameter ThermoSysPro.Units.xSI.Cv CvmaxWater=670 - "Maximum CV (active if mode_caract=0)"; - PressureLosses.ControlValve feedwaterValve( - Cv(start=335), - C1( - h_vol_1(start=1400e3), - h(start=1400e3), - P(start=13300000), - h_vol_2(start=1975433.4222685455)), - rho(start=888), - h(start=1400000), - Cvmax=CvmaxWater, - Q(start=10), - Pm(start=13200000.029884)) - annotation (Placement(transformation(extent={{-120,76},{ - -100,96}}, rotation=0))); - PressureLosses.ControlValve steamValve( - Cv(start=25000), - Q(start=0.0), - rho(start=78.5), - h(start=2657930), - C1(h_vol_2(start=2655313.7785675577)), - Cvmax(fixed=false), - Pm(start=12998726.577779)) - annotation (Placement(transformation(extent={{-120,136},{-100,156}}, - rotation=0))); - ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Constante - ConsigneNiveauBallon(k=0.5) - annotation (Placement(transformation(extent={{-160,100},{-140,120}}, - rotation=0))); - ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Constante - ConsigneNiveauBallon1(k=0.5) - annotation (Placement(transformation(extent={{-160,160},{-140,180}}, - rotation=0))); - BoundaryConditions.SourceP sourceP(h0=1400000, - option_temperature=false, - P0=13200000) - annotation (Placement(transformation(extent={{-200,70},{-180,90}}, - rotation=0))); - BoundaryConditions.SinkP sinkQ(P0=13200000, Q(start= - 51.00572315373906)) - annotation (Placement(transformation(extent={{-38,-40},{-18,-20}}, - rotation=0))); - Volumes.TwoPhaseVolume twoPhaseVolume(diffusion=true, - steady_state=true, - Vv(start=0.5, fixed=true), - dynamic_energy_balance=true, - P0=13200000, - Pfond(start=13200000)) - annotation (Placement(transformation(extent={{-80,50},{-20,110}}))); - PressureLosses.LumpedStraightPipe lumpedStraightPipe annotation (Placement( - transformation( - extent={{10,-10},{-10,10}}, - rotation=90, - origin={-50,10}))); - BoundaryConditions.SourceP sourceP1( - P0(fixed=true) = 13200000, - option_temperature=false, - h0=2600000) - annotation (Placement(transformation(extent={{-200,130},{-180,150}}, - rotation=0))); -equation - connect(ConsigneNiveauBallon.y,feedwaterValve. Ouv) - annotation (Line(points={{-139,110},{-110,110},{-110,97}}, smooth=Smooth.None)); - connect(sourceP.C,feedwaterValve. C1) annotation (Line( - points={{-180,80},{-120,80}}, - color={0,0,255}, - smooth=Smooth.None)); - connect(ConsigneNiveauBallon1.y,steamValve. Ouv) - annotation (Line(points={{-139,170},{-110,170},{-110,157}}, - smooth=Smooth.None)); - connect(feedwaterValve.C2, twoPhaseVolume.Ce) - annotation (Line(points={{-100,80},{-80,80}}, color={0,0,0})); - connect(lumpedStraightPipe.C2, sinkQ.C) - annotation (Line(points={{-50,0},{-50,-30},{-38,-30}}, color={0,0,0})); - connect(sourceP1.C, steamValve.C1) - annotation (Line(points={{-180,140},{-120,140}}, color={0,0,0})); - connect(steamValve.C2, twoPhaseVolume.Cv) - annotation (Line(points={{-100,140},{-50,140},{-50,110}}, color={0,0,0})); - connect(twoPhaseVolume.Cl, lumpedStraightPipe.C1) - annotation (Line(points={{-50,50},{-50,20}}, color={0,0,0})); - annotation (experiment(__Dymola_Algorithm="Dassl"), - Window( - x=0.43, - y=0, - width=0.57, - height=0.63), - Diagram(coordinateSystem( - preserveAspectRatio=false, - extent={{-200,-100},{140,200}}, - grid={2,2})), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestTwoPhaseVolume; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestVolumeA.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestVolumeA.mo deleted file mode 100644 index e7d070a4..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestVolumeA.mo +++ /dev/null @@ -1,112 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestVolumeA - - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP1( - continuous_flow_reversal=true, - T0=288.15, - diffusion=true, - C(h_vol_2(start=63269.22110794238))) - annotation (Placement(transformation(extent={{-100,-10},{-80,10}}))); - - ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP( - Q(start=356.3142593657128), - P0=300000, - T0=369.15, - diffusion=true) - annotation (Placement(transformation(extent={{80,-10},{100,10}}))); - ThermoSysPro.Fluid.Volumes.VolumeA volumeA( - dynamic_composition_balance=false, - steady_state=true, - V=1.e-6, - Ce2(Q(start=-4.6367791499652465E-36)), - continuous_flow_reversal=true, - dynamic_mass_balance=false, - dynamic_energy_balance=false, - diffusion=true, - P(start=200002.5108577)) - annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); - - InstrumentationAndControl.Blocks.Sources.Rampe rampe( - Duration=10, - Initialvalue=1e5, - Finalvalue=5e5) - annotation (Placement(transformation(extent={{60,-40},{80,-20}}))); - ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe lumpedStraightPipe1(gamma_diff( - start=4.4340701734837724E-07)) - annotation (Placement(transformation(extent={{-70,-10},{-50,10}}))); - ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe lumpedStraightPipe3( - gamma_diff(start=4.4336099270975624E-07)) - annotation (Placement(transformation(extent={{50,-10},{70,10}}))); - ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe lumpedStraightPipe2(inertia= - false) - annotation (Placement(transformation(extent={{-70,40},{-50,60}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP2( - continuous_flow_reversal=false, - T0=288.15, - diffusion=true) - annotation (Placement(transformation(extent={{-100,40},{-80,60}}))); - - PressureLosses.ControlValve controlValve1(Pm(start=201722.05301761828)) - annotation (Placement(transformation(extent={{-40,-4},{-20,16}}))); - PressureLosses.ControlValve controlValve2(C2(Q(start=0)), Pm(start= - 250001.25542885027)) - annotation (Placement(transformation(extent={{-40,46},{-20,66}}))); - PressureLosses.ControlValve controlValve3(Pm(start=198282.96276544)) - annotation (Placement(transformation(extent={{20,-4},{40,16}}))); - InstrumentationAndControl.Blocks.Sources.Constante constante1(k=1) - annotation (Placement(transformation(extent={{-56,24},{-44,36}}))); - InstrumentationAndControl.Blocks.Sources.Constante constante2(k=0) - annotation (Placement(transformation(extent={{-56,74},{-44,86}}))); - InstrumentationAndControl.Blocks.Sources.Constante constante3 - annotation (Placement(transformation(extent={{4,22},{16,34}}))); -equation - connect(rampe.y, sinkP.IPressure) annotation (Line(points={{81,-30},{100,-30}, - {100,0},{95,0}}, color={0,0,255})); - connect(sourceP1.C, lumpedStraightPipe1.C1) - annotation (Line(points={{-80,0},{-70,0}}, color={0,0,0})); - connect(lumpedStraightPipe3.C2, sinkP.C) - annotation (Line(points={{70,0},{80,0}}, color={0,0,0})); - connect(sourceP2.C, lumpedStraightPipe2.C1) - annotation (Line(points={{-80,50},{-70,50}}, color={0,0,0})); - connect(lumpedStraightPipe1.C2, controlValve1.C1) - annotation (Line(points={{-50,0},{-40,0}}, color={0,0,0})); - connect(lumpedStraightPipe2.C2, controlValve2.C1) - annotation (Line(points={{-50,50},{-40,50}}, color={0,0,0})); - connect(controlValve2.C2, volumeA.Ce2) - annotation (Line(points={{-20,50},{0,50},{0,10}}, color={0,0,0})); - connect(volumeA.Cs1, controlValve3.C1) - annotation (Line(points={{10,0},{20,0}}, color={0,0,0})); - connect(controlValve3.C2, lumpedStraightPipe3.C1) - annotation (Line(points={{40,0},{50,0}}, color={0,0,0})); - connect(constante1.y, controlValve1.Ouv) - annotation (Line(points={{-43.4,30},{-30,30},{-30,17}}, color={0,0,255})); - connect(constante2.y, controlValve2.Ouv) - annotation (Line(points={{-43.4,80},{-30,80},{-30,67}}, color={0,0,255})); - connect(constante3.y, controlValve3.Ouv) - annotation (Line(points={{16.6,28},{30,28},{30,17}}, color={0,0,255})); - connect(volumeA.Ce1, controlValve1.C2) - annotation (Line(points={{-10,0},{-20,0}}, color={0,0,255})); - annotation (Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - experiment(StopTime=12), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestVolumeA; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestVolumeA1.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestVolumeA1.mo deleted file mode 100644 index 94c923e8..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestVolumeA1.mo +++ /dev/null @@ -1,78 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestVolumeA1 - - ThermoSysPro.Fluid.Volumes.VolumeA volumeA(ftype=ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType.FlueGases, - Ce2(Q(start=5381683.17323685)), - Cs1(Q(start=5381683.173236847)), - Cs2(Q(start=5381683.173236847)), - Xo2(start=0.22), - h(start=999999.9999999997), - dynamic_energy_balance=false) - annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss(rho(start= - 164.8075648419657)) - annotation (Placement(transformation(extent={{-60,20},{-40,40}}))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss1 - annotation (Placement(transformation(extent={{-60,-40},{-40,-20}}))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss2 - annotation (Placement(transformation(extent={{40,20},{60,40}}))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss3 - annotation (Placement(transformation(extent={{40,-40},{60,-20}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP( - ftype=ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType.FlueGases, - option_temperature=false, - h0=1e6, - P0=600e5) - annotation (Placement(transformation(extent={{-100,20},{-80,40}}))); - - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP1( - ftype=ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType.FlueGases, - T0=1000, - option_temperature=false, - h0=1e6, - P0=600e5) - annotation (Placement(transformation(extent={{-100,-40},{-80,-20}}))); - - ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP(option_temperature=false) - annotation (Placement(transformation(extent={{80,20},{100,40}}))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP1(option_temperature=false) - annotation (Placement(transformation(extent={{80,-40},{100,-20}}))); -equation - connect(singularPressureLoss.C2, volumeA.Ce2) - annotation (Line(points={{-40,30},{0,30},{0,10}}, color={0,0,0})); - connect(singularPressureLoss1.C2, volumeA.Ce1) annotation (Line(points={{-40, - -30},{-20,-30},{-20,0},{-10,0}}, color={0,0,0})); - connect(volumeA.Cs1, singularPressureLoss2.C1) annotation (Line(points={{10,0}, - {10,0},{20,0},{20,30},{40,30},{40,30}}, color={0,0,0})); - connect(volumeA.Cs2, singularPressureLoss3.C1) annotation (Line(points={{0, - -10},{0,-10},{0,-30},{40,-30},{40,-30}}, color={0,0,0})); - connect(sourceP.C, singularPressureLoss.C1) - annotation (Line(points={{-80,30},{-60,30}}, color={0,0,0})); - connect(sourceP1.C, singularPressureLoss1.C1) - annotation (Line(points={{-80,-30},{-60,-30}}, color={0,0,0})); - connect(singularPressureLoss2.C2, sinkP.C) - annotation (Line(points={{60,30},{70,30},{70,30},{80,30}}, color={0,0,0})); - connect(singularPressureLoss3.C2, sinkP1.C) annotation (Line(points={{60,-30}, - {70,-30},{70,-30},{80,-30}}, color={0,0,0})); - annotation (Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-"), Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})})); -end TestVolumeA1; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestVolumeI.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/TestVolumeI.mo deleted file mode 100644 index 8b52572c..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/TestVolumeI.mo +++ /dev/null @@ -1,111 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -model TestVolumeI - - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP1( - continuous_flow_reversal=true, - T0=288.15, - diffusion=true) - annotation (Placement(transformation(extent={{-100,-10},{-80,10}}))); - - ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP( - Q(start=356.3142593657128), - P0=300000, - T0=369.15, - diffusion=true) - annotation (Placement(transformation(extent={{80,-10},{100,10}}))); - Volumes.VolumeI volumeA( - dynamic_composition_balance=false, - steady_state=true, - V=1.e-6, - Ce2(Q(start=-1.2064107019298721E-33)), - continuous_flow_reversal=true, - dynamic_mass_balance=false, - diffusion=false, - dynamic_energy_balance=true, - P(start=200002.5108577), - h(start=63269.22110794238)) - annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); - - InstrumentationAndControl.Blocks.Sources.Rampe rampe( - Duration=10, - Initialvalue=1e5, - Finalvalue=5e5) - annotation (Placement(transformation(extent={{60,-40},{80,-20}}))); - ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe lumpedStraightPipe1(gamma_diff( - start=4.4340701734837724E-07)) - annotation (Placement(transformation(extent={{-70,-10},{-50,10}}))); - ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe lumpedStraightPipe3 - annotation (Placement(transformation(extent={{50,-10},{70,10}}))); - ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe lumpedStraightPipe2(inertia= - false) - annotation (Placement(transformation(extent={{-70,40},{-50,60}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP2( - continuous_flow_reversal=false, - T0=288.15, - diffusion=true) - annotation (Placement(transformation(extent={{-100,40},{-80,60}}))); - - PressureLosses.ControlValve controlValve1(Pm(start=201722.05301761828)) - annotation (Placement(transformation(extent={{-40,-4},{-20,16}}))); - PressureLosses.ControlValve controlValve2(C2(Q(start=0)), Pm(start= - 250001.25542885027)) - annotation (Placement(transformation(extent={{-40,46},{-20,66}}))); - PressureLosses.ControlValve controlValve3(Pm(start=198282.96276544)) - annotation (Placement(transformation(extent={{20,-4},{40,16}}))); - InstrumentationAndControl.Blocks.Sources.Constante constante1(k=1) - annotation (Placement(transformation(extent={{-56,24},{-44,36}}))); - InstrumentationAndControl.Blocks.Sources.Constante constante2(k=0) - annotation (Placement(transformation(extent={{-56,74},{-44,86}}))); - InstrumentationAndControl.Blocks.Sources.Constante constante3 - annotation (Placement(transformation(extent={{4,22},{16,34}}))); -equation - connect(rampe.y, sinkP.IPressure) annotation (Line(points={{81,-30},{100,-30}, - {100,0},{95,0}}, color={0,0,255})); - connect(sourceP1.C, lumpedStraightPipe1.C1) - annotation (Line(points={{-80,0},{-70,0}}, color={0,0,0})); - connect(lumpedStraightPipe3.C2, sinkP.C) - annotation (Line(points={{70,0},{80,0}}, color={0,0,0})); - connect(sourceP2.C, lumpedStraightPipe2.C1) - annotation (Line(points={{-80,50},{-70,50}}, color={0,0,0})); - connect(lumpedStraightPipe1.C2, controlValve1.C1) - annotation (Line(points={{-50,0},{-40,0}}, color={0,0,0})); - connect(lumpedStraightPipe2.C2, controlValve2.C1) - annotation (Line(points={{-50,50},{-40,50}}, color={0,0,0})); - connect(controlValve3.C2, lumpedStraightPipe3.C1) - annotation (Line(points={{40,0},{50,0}}, color={0,0,0})); - connect(constante1.y, controlValve1.Ouv) - annotation (Line(points={{-43.4,30},{-30,30},{-30,17}}, color={0,0,255})); - connect(constante2.y, controlValve2.Ouv) - annotation (Line(points={{-43.4,80},{-30,80},{-30,67}}, color={0,0,255})); - connect(constante3.y, controlValve3.Ouv) - annotation (Line(points={{16.6,28},{30,28},{30,17}}, color={0,0,255})); - connect(controlValve1.C2, volumeA.Ce2) - annotation (Line(points={{-20,0},{-10,0}}, color={0,0,0})); - connect(controlValve2.C2, volumeA.Ce1) annotation (Line(points={{-20,50},{-14, - 50},{-14,8},{-10,8}}, color={0,0,0})); - connect(volumeA.Cs2, controlValve3.C1) - annotation (Line(points={{10,0},{20,0}}, color={0,0,0})); - annotation (Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - experiment(StopTime=12), - Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); -end TestVolumeI; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/package.order index f1d67d76..e69de29b 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/package.order @@ -1,86 +0,0 @@ -TestAirHumidity -TestBend -TestBoilerSystem -TestCentrifugalPump1 -TestCheckValve -TestCHPEngineBarkantineSystem -TestCombustionTurbine -TestCompressor -TestDiaphragm -TestDiffusion_DynamicOnePhaseFlowPipe -TestDiffusion_DynamicPlateHeatExchanger -TestDiffusion_DynamicTwoPhaseFlowPipe -TestDiffusion_VolumeA -TestDynamicCheckValve -TestDynamicCondenser -TestDynamicDrum -TestDynamicDrum_CC -TestDynamicFlueGasesMultiFluidHeatExchanger -TestDynamicMultiFluidHeatExchanger -TestDynamicMultiFluidHeatExchangerShell -TestDynamicOnePhaseFlowPipe -TestDynamicOnePhaseFlowShell -TestDynamicPlateHeatExchanger -TestDynamicReliefValve -TestDynamicTwoPhaseFlowPipe -TestDynamicTwoPhaseFlowRiser -TestDynamicWaterHeating -TestDynamicWaterHeatingOnePipe -TestDynamicWaterSteamMultiFluidHeatExchanger -TestFixedPowerHeatExchanger -TestFossilFuelBoiler -TestFresnelField -TestGasTurbine -TestGenericCombustion -TestGenericCombustion1D -TestGridFurnace -TestGTCombustionChamber -TestHeatPumpCompressor -TestIdealCheckValve -TestIdealSwitchValve -TestInternalCombustionEngine -TestInvSingularPressureLoss -TestJunctions1 -TestJunctions2 -TestJunctions3 -TestJunctions4 -TestLoopBreaker -TestMassFlowMultiplier -TestNTUWaterHeater0 -TestPostCombustionGas -TestPressurizer -TestRefP -TestRefP1 -TestSensors -TestSimpleDynamicCondenser -TestSimpleDynamicCondenser1 -TestSimpleEvaporatorWaterSteamFlueGases -TestSimpleStaticCondenser -TestSingularPressureLoss -TestStaticAerocondenser -TestStaticCentrifugalPump1 -TestStaticCondenser -TestStaticCondenserHEI -TestStaticDrum1 -TestStaticDrum2 -TestStaticExchangerDTorWorEff -TestStaticExchangerKS -TestStaticFan -TestStaticPlateHeatExchanger -TestStaticWallFlueGasesExchanger -TestSteamDryer1 -TestSteamDryer2 -TestSteamEngine -TestSteamExtractionSplitter -TestStodolaTurbine1 -TestStodolaTurbine2 -TestSwitchValve -TestTank -TestTankHorizontal -TestThreeWayValve -TestTwoPhaseCavity -TestTwoPhaseCavityOnePipe -TestTwoPhaseVolume -TestVolumeA -TestVolumeA1 -TestVolumeI diff --git a/ThermoSysPro/Fluid/Interfaces/Connectors/FluidInlet.mo b/ThermoSysPro/Fluid/Interfaces/Connectors/FluidInlet.mo index 0b4a67c1..f88c9d63 100644 --- a/ThermoSysPro/Fluid/Interfaces/Connectors/FluidInlet.mo +++ b/ThermoSysPro/Fluid/Interfaces/Connectors/FluidInlet.mo @@ -1,5 +1,8 @@ within ThermoSysPro.Fluid.Interfaces.Connectors; connector FluidInlet "Fluid inlet connector" + replaceable package Medium = + ThermoSysPro.Properties.Media.WaterSteam constrainedby Modelica.Media.Interfaces.PartialMedium + "Medium model" annotation (choicesAllMatching=true, Dialog(group="Medium")); Units.SI.Pressure P(start=1.e5) "Fluid pressure in the control volume"; Units.SI.MassFlowRate Q(start=500) "Mass flow rate of the fluid crossing the boundary of the control volume"; @@ -9,16 +12,10 @@ connector FluidInlet "Fluid inlet connector" "Fluid specific enthalpy in the control volume 1"; Units.SI.SpecificEnthalpy h_vol_2(start=1.e5) "Fluid specific enthalpy in the control volume 2"; - input ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType ftype - "Fluid type"; - ThermoSysPro.Units.SI.MassFraction Xco2(start=0.01) - "CO2 mass fraction of the fluid crossing the boundary of the control volume"; - ThermoSysPro.Units.SI.MassFraction Xh2o - "H2O mass fraction of the fluid crossing the boundary of the control volume"; - ThermoSysPro.Units.SI.MassFraction Xo2(start=0.2) - "O2 mass fraction of the fluid crossing the boundary of the control volume"; - ThermoSysPro.Units.SI.MassFraction Xso2(start=0) - "SO2 mass fraction of the fluid crossing the boundary of the control volume"; + Medium.ExtraProperty SubC[Medium.nC] + "Properties c_i/m of the fluid crossing the boundary of the control volume"; + Medium.MassFraction Xi[Medium.nXi] + "Independent mixture mass fractions m_i/m of the fluid crossing the boundary of the control volume"; input Real diff_res_1(start=1e4) "Diffusion resistance from control volume 1"; output Real diff_res_2(start=1e4) diff --git a/ThermoSysPro/Fluid/Interfaces/Connectors/FluidOutlet.mo b/ThermoSysPro/Fluid/Interfaces/Connectors/FluidOutlet.mo index 3579500b..52c98b76 100644 --- a/ThermoSysPro/Fluid/Interfaces/Connectors/FluidOutlet.mo +++ b/ThermoSysPro/Fluid/Interfaces/Connectors/FluidOutlet.mo @@ -1,5 +1,8 @@ within ThermoSysPro.Fluid.Interfaces.Connectors; connector FluidOutlet "Fluid outlet connector" + replaceable package Medium = + ThermoSysPro.Properties.Media.WaterSteam constrainedby Modelica.Media.Interfaces.PartialMedium + "Medium model" annotation (choicesAllMatching=true, Dialog(group="Medium")); Units.SI.Pressure P(start=1.e5) "Fluid pressure in the control volume"; Units.SI.MassFlowRate Q(start=500) "Mass flow rate of the fluid crossing the boundary of the control volume"; @@ -9,16 +12,10 @@ connector FluidOutlet "Fluid outlet connector" "Fluid specific enthalpy in the control volume 1"; Units.SI.SpecificEnthalpy h_vol_2(start=1.e5) "Fluid specific enthalpy in the control volume 2"; - output ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType ftype - "Fluid type"; - ThermoSysPro.Units.SI.MassFraction Xco2(start=0.01) - "CO2 mass fraction of the fluid crossing the boundary of the control volume"; - ThermoSysPro.Units.SI.MassFraction Xh2o - "H2O mass fraction of the fluid crossing the boundary of the control volume"; - ThermoSysPro.Units.SI.MassFraction Xo2(start=0.2) - "O2 mass fraction of the fluid crossing the boundary of the control volume"; - ThermoSysPro.Units.SI.MassFraction Xso2(start=0) - "SO2 mass fraction of the fluid crossing the boundary of the control volume"; + Medium.ExtraProperty SubC[Medium.nC] + "Properties c_i/m of the fluid crossing the boundary of the control volume"; + Medium.MassFraction Xi[Medium.nXi] + "Independent mixture mass fractions m_i/m of the fluid crossing the boundary of the control volume"; output Real diff_res_1(start=1e4) "Diffusion resistance from control volume 1"; input Real diff_res_2(start=1e4) diff --git a/ThermoSysPro/Properties/DryAirIdealGas/DryAirIdealGas.mo b/ThermoSysPro/Properties/DryAirIdealGas/DryAirIdealGas.mo index b9a2d5d5..df6d9698 100644 --- a/ThermoSysPro/Properties/DryAirIdealGas/DryAirIdealGas.mo +++ b/ThermoSysPro/Properties/DryAirIdealGas/DryAirIdealGas.mo @@ -1,4 +1,4 @@ -within ThermoSysPro.Properties.DryAirIdealGas; +within ThermoSysPro.Properties.DryAirIdealGas; record DryAirIdealGas "Data for Dry Air Ideal Gas from STEPHANIE Library" // STEPHANIE Dry Air Ideal Gas // "Air Data Package - valid temperature ranges 200K - 1000K and 1000K - 6000K. Source: NASA/TP-2002-211556 Coefficients for Calculating Thermodynamic Properties" diff --git a/ThermoSysPro/Properties/FlueGases/FlueGases_h.mo b/ThermoSysPro/Properties/FlueGases/FlueGases_h.mo index ab362f41..fe208445 100644 --- a/ThermoSysPro/Properties/FlueGases/FlueGases_h.mo +++ b/ThermoSysPro/Properties/FlueGases/FlueGases_h.mo @@ -1,4 +1,4 @@ -within ThermoSysPro.Properties.FlueGases; +within ThermoSysPro.Properties.FlueGases; function FlueGases_h "Specific enthalpy" input Units.SI.AbsolutePressure PMF "Flue gases average pressure"; input Units.SI.Temperature TMF "Flue gases average temperature"; diff --git a/ThermoSysPro/Properties/FlueGases/FlueGases_h_Ps.mo b/ThermoSysPro/Properties/FlueGases/FlueGases_h_Ps.mo index 83a4f173..848f5202 100644 --- a/ThermoSysPro/Properties/FlueGases/FlueGases_h_Ps.mo +++ b/ThermoSysPro/Properties/FlueGases/FlueGases_h_Ps.mo @@ -1,4 +1,4 @@ -within ThermoSysPro.Properties.FlueGases; +within ThermoSysPro.Properties.FlueGases; function FlueGases_h_Ps "Specific enthalpy" //extends ThermoSysPro.Properties.FlueGases.unSafeForJacobian; diff --git a/ThermoSysPro/Properties/FlueGases/FlueGases_s.mo b/ThermoSysPro/Properties/FlueGases/FlueGases_s.mo index aa770442..a41aee8f 100644 --- a/ThermoSysPro/Properties/FlueGases/FlueGases_s.mo +++ b/ThermoSysPro/Properties/FlueGases/FlueGases_s.mo @@ -1,4 +1,4 @@ -within ThermoSysPro.Properties.FlueGases; +within ThermoSysPro.Properties.FlueGases; function FlueGases_s "Specific entropy" input Units.SI.AbsolutePressure PMF "Flue gases average pressure"; input Units.SI.Temperature TMF "Flue gases average temperature"; diff --git a/ThermoSysPro/Properties/FlueGases/XSat.mo b/ThermoSysPro/Properties/FlueGases/XSat.mo index 246d2fa0..21b62c16 100644 --- a/ThermoSysPro/Properties/FlueGases/XSat.mo +++ b/ThermoSysPro/Properties/FlueGases/XSat.mo @@ -1,4 +1,4 @@ -within ThermoSysPro.Properties.FlueGases; +within ThermoSysPro.Properties.FlueGases; function XSat //--------------------------------------------------------------------------- // Fonction de l'humidité absolue a saturation xs(T) diff --git a/ThermoSysPro/Properties/Fluid/Density_Ph.mo b/ThermoSysPro/Properties/Fluid/Density_Ph.mo index b2b77157..2a12405d 100644 --- a/ThermoSysPro/Properties/Fluid/Density_Ph.mo +++ b/ThermoSysPro/Properties/Fluid/Density_Ph.mo @@ -1,4 +1,4 @@ -within ThermoSysPro.Properties.Fluid; +within ThermoSysPro.Properties.Fluid; function Density_Ph "Density computation for all fluids (inputs: P, h, fluid)" input Units.SI.AbsolutePressure P "Pressure (Pa)"; diff --git a/ThermoSysPro/Properties/Fluid/Density_derh_Ph.mo b/ThermoSysPro/Properties/Fluid/Density_derh_Ph.mo index 11771944..4a316c65 100644 --- a/ThermoSysPro/Properties/Fluid/Density_derh_Ph.mo +++ b/ThermoSysPro/Properties/Fluid/Density_derh_Ph.mo @@ -1,4 +1,4 @@ -within ThermoSysPro.Properties.Fluid; +within ThermoSysPro.Properties.Fluid; function Density_derh_Ph "Density derivative w.r.t enthalpy computation for all fluids (inputs: P, h, fluid)" diff --git a/ThermoSysPro/Properties/Fluid/Density_derp_Ph.mo b/ThermoSysPro/Properties/Fluid/Density_derp_Ph.mo index b19bb8ca..c2d198ff 100644 --- a/ThermoSysPro/Properties/Fluid/Density_derp_Ph.mo +++ b/ThermoSysPro/Properties/Fluid/Density_derp_Ph.mo @@ -1,4 +1,4 @@ -within ThermoSysPro.Properties.Fluid; +within ThermoSysPro.Properties.Fluid; function Density_derp_Ph "Density derivative w.r.t pressure computation for all fluids (inputs: P, h, fluid)" diff --git a/ThermoSysPro/Properties/Fluid/DynamicViscosity_Ph.mo b/ThermoSysPro/Properties/Fluid/DynamicViscosity_Ph.mo index a4ef447c..c2184494 100644 --- a/ThermoSysPro/Properties/Fluid/DynamicViscosity_Ph.mo +++ b/ThermoSysPro/Properties/Fluid/DynamicViscosity_Ph.mo @@ -1,4 +1,4 @@ -within ThermoSysPro.Properties.Fluid; +within ThermoSysPro.Properties.Fluid; function DynamicViscosity_Ph "Dynamic Viscosity computation for all fluids (inputs: P, h, fluid)" diff --git a/ThermoSysPro/Properties/Fluid/Prandtl_Ph.mo b/ThermoSysPro/Properties/Fluid/Prandtl_Ph.mo index d43990ff..7126474f 100644 --- a/ThermoSysPro/Properties/Fluid/Prandtl_Ph.mo +++ b/ThermoSysPro/Properties/Fluid/Prandtl_Ph.mo @@ -1,4 +1,4 @@ -within ThermoSysPro.Properties.Fluid; +within ThermoSysPro.Properties.Fluid; function Prandtl_Ph "Prandtl number computation for all fluids (inputs: P, h, fluid)" diff --git a/ThermoSysPro/Properties/Fluid/Reynolds_PhvD.mo b/ThermoSysPro/Properties/Fluid/Reynolds_PhvD.mo index 28b8bb19..767f4126 100644 --- a/ThermoSysPro/Properties/Fluid/Reynolds_PhvD.mo +++ b/ThermoSysPro/Properties/Fluid/Reynolds_PhvD.mo @@ -1,4 +1,4 @@ -within ThermoSysPro.Properties.Fluid; +within ThermoSysPro.Properties.Fluid; function Reynolds_PhvD "Reynolds number computation for all fluids (inputs: P, h, fluid, v, D)" diff --git a/ThermoSysPro/Properties/Fluid/SpecificHeatCapacityCp_PT.mo b/ThermoSysPro/Properties/Fluid/SpecificHeatCapacityCp_PT.mo index c7b8766a..62998709 100644 --- a/ThermoSysPro/Properties/Fluid/SpecificHeatCapacityCp_PT.mo +++ b/ThermoSysPro/Properties/Fluid/SpecificHeatCapacityCp_PT.mo @@ -1,4 +1,4 @@ -within ThermoSysPro.Properties.Fluid; +within ThermoSysPro.Properties.Fluid; function SpecificHeatCapacityCp_PT "Specific Heat Capacity at constant P computation for all fluids (inputs: P, T, fluid)" diff --git a/ThermoSysPro/Properties/Fluid/SpecificHeatCapacityCp_Ph.mo b/ThermoSysPro/Properties/Fluid/SpecificHeatCapacityCp_Ph.mo index 456a9cfa..ff6dbf2f 100644 --- a/ThermoSysPro/Properties/Fluid/SpecificHeatCapacityCp_Ph.mo +++ b/ThermoSysPro/Properties/Fluid/SpecificHeatCapacityCp_Ph.mo @@ -1,4 +1,4 @@ -within ThermoSysPro.Properties.Fluid; +within ThermoSysPro.Properties.Fluid; function SpecificHeatCapacityCp_Ph "Specific Heat Capacity at constant P computation for all fluids (inputs: P, h, fluid)" diff --git a/ThermoSysPro/Properties/Fluid/SpecificInternalEnergy_Ph_DO_NOT_USE.mo b/ThermoSysPro/Properties/Fluid/SpecificInternalEnergy_Ph_DO_NOT_USE.mo index c75fcaf6..0c8d9f29 100644 --- a/ThermoSysPro/Properties/Fluid/SpecificInternalEnergy_Ph_DO_NOT_USE.mo +++ b/ThermoSysPro/Properties/Fluid/SpecificInternalEnergy_Ph_DO_NOT_USE.mo @@ -1,4 +1,4 @@ -within ThermoSysPro.Properties.Fluid; +within ThermoSysPro.Properties.Fluid; function SpecificInternalEnergy_Ph_DO_NOT_USE "Specific Internal Energy computation for all fluids (inputs: P, h, fluid). DO NOT USE (does not work with use-case 'DistributedVolumePartialModel'. Use u = h - P/rho instead)" diff --git a/ThermoSysPro/Properties/Fluid/Temperature_Ph.mo b/ThermoSysPro/Properties/Fluid/Temperature_Ph.mo index 1eb75751..67957b28 100644 --- a/ThermoSysPro/Properties/Fluid/Temperature_Ph.mo +++ b/ThermoSysPro/Properties/Fluid/Temperature_Ph.mo @@ -1,4 +1,4 @@ -within ThermoSysPro.Properties.Fluid; +within ThermoSysPro.Properties.Fluid; function Temperature_Ph "Temperature computation for all fluids (inputs: P, h, fluid)" diff --git a/ThermoSysPro/Properties/Fluid/ThermalConductivity_Ph.mo b/ThermoSysPro/Properties/Fluid/ThermalConductivity_Ph.mo index 2eb74379..fdefea13 100644 --- a/ThermoSysPro/Properties/Fluid/ThermalConductivity_Ph.mo +++ b/ThermoSysPro/Properties/Fluid/ThermalConductivity_Ph.mo @@ -1,4 +1,4 @@ -within ThermoSysPro.Properties.Fluid; +within ThermoSysPro.Properties.Fluid; function ThermalConductivity_Ph "Thermal Conductivity computation for all fluids (inputs: P, h, fluid)" diff --git a/ThermoSysPro/Properties/Fluid/derDensity_derP_derh.mo b/ThermoSysPro/Properties/Fluid/derDensity_derP_derh.mo index b81c30cc..13873391 100644 --- a/ThermoSysPro/Properties/Fluid/derDensity_derP_derh.mo +++ b/ThermoSysPro/Properties/Fluid/derDensity_derP_derh.mo @@ -1,4 +1,4 @@ -within ThermoSysPro.Properties.Fluid; +within ThermoSysPro.Properties.Fluid; function derDensity_derP_derh "der(Density) computation for all fluids (inputs: P, h, der(P), der(h), fluid)" diff --git a/ThermoSysPro/Properties/Fluid/derDensity_derh_derP_derh.mo b/ThermoSysPro/Properties/Fluid/derDensity_derh_derP_derh.mo index 1d1bb632..c6d2a49e 100644 --- a/ThermoSysPro/Properties/Fluid/derDensity_derh_derP_derh.mo +++ b/ThermoSysPro/Properties/Fluid/derDensity_derh_derP_derh.mo @@ -1,4 +1,4 @@ -within ThermoSysPro.Properties.Fluid; +within ThermoSysPro.Properties.Fluid; function derDensity_derh_derP_derh "der(Density derivative w.r.t enthalpy) computation for all fluids (inputs: P, h, der(P), der(h), fluid)" diff --git a/ThermoSysPro/Properties/Fluid/derDynamicViscosity_derP_derh.mo b/ThermoSysPro/Properties/Fluid/derDynamicViscosity_derP_derh.mo index 03dc4510..85def033 100644 --- a/ThermoSysPro/Properties/Fluid/derDynamicViscosity_derP_derh.mo +++ b/ThermoSysPro/Properties/Fluid/derDynamicViscosity_derP_derh.mo @@ -1,4 +1,4 @@ -within ThermoSysPro.Properties.Fluid; +within ThermoSysPro.Properties.Fluid; function derDynamicViscosity_derP_derh "Dynamic Viscosity computation for all fluids (inputs: P, h, fluid)" diff --git a/ThermoSysPro/Properties/Fluid/derDynamicViscosity_derP_derh_old.mo b/ThermoSysPro/Properties/Fluid/derDynamicViscosity_derP_derh_old.mo index 8fb979e2..6ef1228d 100644 --- a/ThermoSysPro/Properties/Fluid/derDynamicViscosity_derP_derh_old.mo +++ b/ThermoSysPro/Properties/Fluid/derDynamicViscosity_derP_derh_old.mo @@ -1,4 +1,4 @@ -within ThermoSysPro.Properties.Fluid; +within ThermoSysPro.Properties.Fluid; function derDynamicViscosity_derP_derh_old "Dynamic Viscosity computation for all fluids (inputs: P, h, fluid)" diff --git a/ThermoSysPro/Properties/Fluid/derDynamicViscosity_derT_derrho.mo b/ThermoSysPro/Properties/Fluid/derDynamicViscosity_derT_derrho.mo index fc3d1e1f..8e767e34 100644 --- a/ThermoSysPro/Properties/Fluid/derDynamicViscosity_derT_derrho.mo +++ b/ThermoSysPro/Properties/Fluid/derDynamicViscosity_derT_derrho.mo @@ -1,4 +1,4 @@ -within ThermoSysPro.Properties.Fluid; +within ThermoSysPro.Properties.Fluid; function derDynamicViscosity_derT_derrho "Dynamic Viscosity computation for all fluids" diff --git a/ThermoSysPro/Properties/Fluid/derSpecificEnthalpy_derP_derT.mo b/ThermoSysPro/Properties/Fluid/derSpecificEnthalpy_derP_derT.mo index e04c7924..f0fbb8af 100644 --- a/ThermoSysPro/Properties/Fluid/derSpecificEnthalpy_derP_derT.mo +++ b/ThermoSysPro/Properties/Fluid/derSpecificEnthalpy_derP_derT.mo @@ -1,4 +1,4 @@ -within ThermoSysPro.Properties.Fluid; +within ThermoSysPro.Properties.Fluid; function derSpecificEnthalpy_derP_derT "der(Specific enthalpy) computation for all fluids (inputs: P, h, der(P), der(T), fluid)" diff --git a/ThermoSysPro/Properties/Fluid/derTemperature_derP_derh.mo b/ThermoSysPro/Properties/Fluid/derTemperature_derP_derh.mo index 03c1dfad..5b19641a 100644 --- a/ThermoSysPro/Properties/Fluid/derTemperature_derP_derh.mo +++ b/ThermoSysPro/Properties/Fluid/derTemperature_derP_derh.mo @@ -1,4 +1,4 @@ -within ThermoSysPro.Properties.Fluid; +within ThermoSysPro.Properties.Fluid; function derTemperature_derP_derh "der(Temperature) computation for all fluids (inputs: P, h, fluid, der(P), der(h))" diff --git a/ThermoSysPro/Properties/Fluid/derderDensity_derderP_derderh.mo b/ThermoSysPro/Properties/Fluid/derderDensity_derderP_derderh.mo index 5182f596..f37df39e 100644 --- a/ThermoSysPro/Properties/Fluid/derderDensity_derderP_derderh.mo +++ b/ThermoSysPro/Properties/Fluid/derderDensity_derderP_derderh.mo @@ -1,4 +1,4 @@ -within ThermoSysPro.Properties.Fluid; +within ThermoSysPro.Properties.Fluid; function derderDensity_derderP_derderh "der(der(Density)) computation for all fluids (inputs: P, h, der(P), der(h), der(der(P)), der(der(h)), fluid)" diff --git a/ThermoSysPro/Properties/Fluid/derderDensity_derh_derderP_derderh.mo b/ThermoSysPro/Properties/Fluid/derderDensity_derh_derderP_derderh.mo index 17554e9b..53e0a91a 100644 --- a/ThermoSysPro/Properties/Fluid/derderDensity_derh_derderP_derderh.mo +++ b/ThermoSysPro/Properties/Fluid/derderDensity_derh_derderP_derderh.mo @@ -1,4 +1,4 @@ -within ThermoSysPro.Properties.Fluid; +within ThermoSysPro.Properties.Fluid; function derderDensity_derh_derderP_derderh "der(der(Density derivative w.r.t enthalpy)) computation for all fluids (inputs: P, h, der(P), der(h), der(der(P)), der(der(h)), fluid)" diff --git a/ThermoSysPro/Properties/Fluid/derderTemperature_derderP_derderh.mo b/ThermoSysPro/Properties/Fluid/derderTemperature_derderP_derderh.mo index 278bf515..efdabaca 100644 --- a/ThermoSysPro/Properties/Fluid/derderTemperature_derderP_derderh.mo +++ b/ThermoSysPro/Properties/Fluid/derderTemperature_derderP_derderh.mo @@ -1,4 +1,4 @@ -within ThermoSysPro.Properties.Fluid; +within ThermoSysPro.Properties.Fluid; function derderTemperature_derderP_derderh "der(der(Temperature)) computation for all fluids (inputs: P, h, der(P), der(h), der(der(P)), der(der(h)), fluid)" diff --git a/ThermoSysPro/Properties/Media/PartialSubCMedium/C_BiPhase.mo b/ThermoSysPro/Properties/Media/PartialSubCMedium/C_BiPhase.mo new file mode 100644 index 00000000..e117fa5c --- /dev/null +++ b/ThermoSysPro/Properties/Media/PartialSubCMedium/C_BiPhase.mo @@ -0,0 +1,6 @@ +within ThermoSysPro.Properties.Media.PartialSubCMedium; +record C_BiPhase + Real Cl[nSubC]; + Real Cg[nSubC]; + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end C_BiPhase; diff --git a/ThermoSysPro/Properties/Media/PartialSubCMedium/HomogeneousPhasesSeparation.mo b/ThermoSysPro/Properties/Media/PartialSubCMedium/HomogeneousPhasesSeparation.mo new file mode 100644 index 00000000..7aebdec9 --- /dev/null +++ b/ThermoSysPro/Properties/Media/PartialSubCMedium/HomogeneousPhasesSeparation.mo @@ -0,0 +1,18 @@ +within ThermoSysPro.Properties.Media.PartialSubCMedium; +function HomogeneousPhasesSeparation + extends partialPhasesSeparation; +// input Real x(min=0, max=1) "Title"; + +algorithm + // HomogeneousSubstance + C_record.Cl := SubC; + C_record.Cg := SubC; + +// // Non-volatile +// C_record.Cl := SubC / (1-x); +// C_record.Cg := fill(0,size(SubC,1)); + +// // Fully-volatile +// C_record.Cl := fill(0,size(SubC,1)); +// C_record.Cg := SubC / x; +end HomogeneousPhasesSeparation; diff --git a/ThermoSysPro/Properties/Media/PartialSubCMedium/noSaS.mo b/ThermoSysPro/Properties/Media/PartialSubCMedium/noSaS.mo new file mode 100644 index 00000000..e00d5bc8 --- /dev/null +++ b/ThermoSysPro/Properties/Media/PartialSubCMedium/noSaS.mo @@ -0,0 +1,6 @@ +within ThermoSysPro.Properties.Media.PartialSubCMedium; +function noSaS + extends partialSaS; +algorithm + C := fill(0,nSubC); +end noSaS; diff --git a/ThermoSysPro/Properties/Media/PartialSubCMedium/package.mo b/ThermoSysPro/Properties/Media/PartialSubCMedium/package.mo new file mode 100644 index 00000000..133f5bc5 --- /dev/null +++ b/ThermoSysPro/Properties/Media/PartialSubCMedium/package.mo @@ -0,0 +1,5 @@ +within ThermoSysPro.Properties.Media; +partial package PartialSubCMedium + constant Integer nSubC; + +end PartialSubCMedium; diff --git a/ThermoSysPro/Properties/Media/PartialSubCMedium/package.order b/ThermoSysPro/Properties/Media/PartialSubCMedium/package.order new file mode 100644 index 00000000..d5bff50f --- /dev/null +++ b/ThermoSysPro/Properties/Media/PartialSubCMedium/package.order @@ -0,0 +1,6 @@ +nSubC +partialPhasesSeparation +HomogeneousPhasesSeparation +C_BiPhase +partialSaS +noSaS diff --git a/ThermoSysPro/Properties/Media/PartialSubCMedium/partialPhasesSeparation.mo b/ThermoSysPro/Properties/Media/PartialSubCMedium/partialPhasesSeparation.mo new file mode 100644 index 00000000..4f208f63 --- /dev/null +++ b/ThermoSysPro/Properties/Media/PartialSubCMedium/partialPhasesSeparation.mo @@ -0,0 +1,64 @@ +within ThermoSysPro.Properties.Media.PartialSubCMedium; +partial function partialPhasesSeparation + input Real SubC[:] "Total Species Concentrations"; + output C_BiPhase C_record; + annotation (Icon(coordinateSystem(preserveAspectRatio=false), graphics={ + Ellipse( + extent={{-60,60},{60,-60}}, + lineColor={0,0,255}, + fillColor={28,108,200}, + fillPattern=FillPattern.Solid), + Polygon( + points={{60,0},{58,14},{54,26},{48,36},{38,46},{26,54},{14,58},{0,60}, + {0,0},{60,0}}, + fillColor={170,255,255}, + fillPattern=FillPattern.Solid, + pattern=LinePattern.None), + Polygon( + points={{-60,0},{-58,14},{-54,26},{-48,36},{-38,46},{-26,54},{-14,58}, + {0,60},{0,0},{-60,0}}, + fillColor={170,255,255}, + fillPattern=FillPattern.Solid, + pattern=LinePattern.None), + Ellipse( + extent={{-42,28},{-26,12}}, + lineColor={28,108,200}, + fillColor={28,108,200}, + fillPattern=FillPattern.Solid), + Ellipse( + extent={{-18,48},{-6,36}}, + lineColor={28,108,200}, + fillColor={28,108,200}, + fillPattern=FillPattern.Solid), + Ellipse( + extent={{-4,24},{16,4}}, + lineColor={28,108,200}, + fillColor={28,108,200}, + fillPattern=FillPattern.Solid), + Ellipse( + extent={{26,34},{42,18}}, + lineColor={28,108,200}, + fillColor={28,108,200}, + fillPattern=FillPattern.Solid), + Ellipse( + extent={{24,-12},{40,-28}}, + lineColor={28,108,200}, + fillColor={85,255,255}, + fillPattern=FillPattern.Solid), + Ellipse( + extent={{-40,-22},{-24,-38}}, + lineColor={28,108,200}, + fillColor={85,255,255}, + fillPattern=FillPattern.Solid), + Ellipse( + extent={{10,-36},{22,-48}}, + lineColor={28,108,200}, + fillColor={85,255,255}, + fillPattern=FillPattern.Solid), + Ellipse( + extent={{-20,-4},{2,-26}}, + lineColor={28,108,200}, + fillColor={85,255,255}, + fillPattern=FillPattern.Solid)}), Diagram(coordinateSystem( + preserveAspectRatio=false))); +end partialPhasesSeparation; diff --git a/ThermoSysPro/Properties/Media/PartialSubCMedium/partialSaS.mo b/ThermoSysPro/Properties/Media/PartialSubCMedium/partialSaS.mo new file mode 100644 index 00000000..69547374 --- /dev/null +++ b/ThermoSysPro/Properties/Media/PartialSubCMedium/partialSaS.mo @@ -0,0 +1,5 @@ +within ThermoSysPro.Properties.Media.PartialSubCMedium; +partial function partialSaS + input Real SubC[:] "Total Species Concentrations"; + output Real C[size(SubC,1)]; +end partialSaS; diff --git a/ThermoSysPro/Properties/Media/PartialThermoSysProMedium/package.mo b/ThermoSysPro/Properties/Media/PartialThermoSysProMedium/package.mo new file mode 100644 index 00000000..5f292163 --- /dev/null +++ b/ThermoSysPro/Properties/Media/PartialThermoSysProMedium/package.mo @@ -0,0 +1,5 @@ +within ThermoSysPro.Properties.Media; +partial package PartialThermoSysProMedium + extends Modelica.Media.Interfaces.PartialMedium; + extends PartialSubCMedium(nSubC=nC); +end PartialThermoSysProMedium; diff --git a/ThermoSysPro/Properties/Media/PartialThermoSysProMedium/package.order b/ThermoSysPro/Properties/Media/PartialThermoSysProMedium/package.order new file mode 100644 index 00000000..e69de29b diff --git a/ThermoSysPro/Properties/Media/PartialTwoPhaseThermoSysProMedium/package.mo b/ThermoSysPro/Properties/Media/PartialTwoPhaseThermoSysProMedium/package.mo new file mode 100644 index 00000000..eb2a9267 --- /dev/null +++ b/ThermoSysPro/Properties/Media/PartialTwoPhaseThermoSysProMedium/package.mo @@ -0,0 +1,5 @@ +within ThermoSysPro.Properties.Media; +partial package PartialTwoPhaseThermoSysProMedium + extends Modelica.Media.Interfaces.PartialTwoPhaseMedium; + extends PartialSubCMedium(nSubC=nC); +end PartialTwoPhaseThermoSysProMedium; diff --git a/ThermoSysPro/Properties/Media/PartialTwoPhaseThermoSysProMedium/package.order b/ThermoSysPro/Properties/Media/PartialTwoPhaseThermoSysProMedium/package.order new file mode 100644 index 00000000..e69de29b diff --git a/ThermoSysPro/Properties/Media/WaterSteam/package.mo b/ThermoSysPro/Properties/Media/WaterSteam/package.mo new file mode 100644 index 00000000..b47b1c4c --- /dev/null +++ b/ThermoSysPro/Properties/Media/WaterSteam/package.mo @@ -0,0 +1,730 @@ +within ThermoSysPro.Properties.Media; +package WaterSteam "1 - Water/steam properties library (IAPWS-IF97)" + + extends PartialTwoPhaseThermoSysProMedium( + mediumName="WaterIF97", + substanceNames={"water"}, + singleState=false, + SpecificEnthalpy(start=1.0e5, nominal=5.0e5), + Density(start=150, nominal=500), + AbsolutePressure( + start=50e5, + nominal=10e5, + min=611.657, + max=100e6), + Temperature( + start=500, + nominal=500, + min=273.15, + max=2273.15), + smoothModel=false, + onePhase=false, + fluidConstants=Modelica.Media.Water.waterConstants, + ThermoStates=Modelica.Media.Interfaces.Choices.IndependentVariables.ph); + + redeclare record extends SaturationProperties + end SaturationProperties; + + redeclare record extends ThermodynamicState "Thermodynamic state" + SpecificEnthalpy h "Specific enthalpy"; + Density d "Density"; + Temperature T "Temperature"; + AbsolutePressure p "Pressure"; + end ThermodynamicState; + constant Integer Region = 0 "IF97 region. 0:automatic"; + + redeclare replaceable model extends BaseProperties( + h(stateSelect= StateSelect.prefer), + d(stateSelect= StateSelect.default), + T(stateSelect= StateSelect.default), + p(stateSelect= StateSelect.prefer)) + "Base properties of waterBase properties (p, d, T, h, u, R_s, MM and, if applicable, X and Xi) of a medium" + Integer phase( + min=0, + max=2, + start=1, + fixed=false) "2 for two-phase, 1 for one-phase, 0 if not known"; + protected + ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro; + equation + pro = ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph(p, h, Region); + MM = fluidConstants[1].molarMass; + R_s = Modelica.Constants.R/fluidConstants[1].molarMass; + + phase = if ((h < ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.hl_p(p)) + or (h > ThermoSysPro.Properties.WaterSteam.BaseIF97.Regions.hv_p(p)) + or (p >ThermoSysPro.Properties.WaterSteam.BaseIF97.data.PCRIT)) then 1 else 2; + + sat = setSat_p(state.p); + state = setState_ph(p, h, phase); + + d=pro.d; + T=pro.T; + u = pro.u; + end BaseProperties; + + redeclare function density_ph + "Computes density as a function of pressure and specific enthalpy" + extends Modelica.Icons.Function; + input AbsolutePressure p "Pressure"; + input SpecificEnthalpy h "Specific enthalpy"; + input FixedPhase phase=0 "2 for two-phase, 1 for one-phase, 0 if not known"; + input Integer region=Region + "If 0, region is unknown, otherwise known and this input"; + output Density d "Density"; + protected + ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro; + algorithm + pro :=ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph( + p, + h, + region); + d := pro.d; + annotation (Inline=true); + end density_ph; + + redeclare function temperature_ph + "Computes temperature as a function of pressure and specific enthalpy" + extends Modelica.Icons.Function; + input AbsolutePressure p "Pressure"; + input SpecificEnthalpy h "Specific enthalpy"; + input FixedPhase phase=0 "2 for two-phase, 1 for one-phase, 0 if not known"; + input Integer region=Region + "If 0, region is unknown, otherwise known and this input"; + output Temperature T "Temperature"; + protected + ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro; + + algorithm + pro :=ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph( + p, + h, + region); + T := pro.T; + annotation (Inline=true); + end temperature_ph; + + redeclare function extends setState_phX + "Return thermodynamic state of water as function of p, h, and optional region" + input Integer region=Region + "If 0, region is unknown, otherwise known and this input"; + algorithm + state := ThermodynamicState( + d=density_ph( + p, + h, + region=Region), + T=temperature_ph( + p, + h, + region=Region), + phase=if region == 0 then 0 else if region==4 then 2 else 1, + h=h, + p=p); + annotation (Inline=true); + end setState_phX; + + redeclare function temperature_ps + "Compute temperature from pressure and specific enthalpy" + extends Modelica.Icons.Function; + input AbsolutePressure p "Pressure"; + input SpecificEntropy s "Specific entropy"; + input FixedPhase phase=0 "2 for two-phase, 1 for one-phase, 0 if not known"; + input Integer region=Region + "If 0, region is unknown, otherwise known and this input"; + output Temperature T "Temperature"; + protected + ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ps pro; + algorithm + pro :=ThermoSysPro.Properties.WaterSteam.IF97.Water_Ps( + p, + s, + region); + T := pro.T; + annotation (Inline=true); + end temperature_ps; + + redeclare function density_ps + "Computes density as a function of pressure and specific enthalpy" + extends Modelica.Icons.Function; + input AbsolutePressure p "Pressure"; + input SpecificEntropy s "Specific entropy"; + input FixedPhase phase=0 "2 for two-phase, 1 for one-phase, 0 if not known"; + input Integer region=Region + "If 0, region is unknown, otherwise known and this input"; + output Density d "Density"; + protected + ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ps pro; + algorithm + pro :=ThermoSysPro.Properties.WaterSteam.IF97.Water_Ps( + p, + s, + region); + d := pro.d; + annotation (Inline=true); + end density_ps; + + redeclare function specificEnthalpy_pT + "Computes specific enthalpy as a function of pressure and temperature" + extends Modelica.Icons.Function; + input AbsolutePressure p "Pressure"; + input Temperature T "Temperature"; + input FixedPhase phase=0 "2 for two-phase, 1 for one-phase, 0 if not known"; + input Integer region=Region + "If 0, region is unknown, otherwise known and this input"; + output SpecificEnthalpy h "Specific enthalpy"; + protected + ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_pT + pro; + algorithm + + pro := ThermoSysPro.Properties.WaterSteam.IF97_packages.IF97_wAJ.Water_PT(p, T, region); + h := pro.h; + annotation (Inline=true); + end specificEnthalpy_pT; + + redeclare function specificEnthalpy_ps + "Computes specific enthalpy as a function of pressure and temperature" + extends Modelica.Icons.Function; + input AbsolutePressure p "Pressure"; + input SpecificEntropy s "Specific entropy"; + input FixedPhase phase=0 "2 for two-phase, 1 for one-phase, 0 if not known"; + input Integer region=Region + "If 0, region is unknown, otherwise known and this input"; + output SpecificEnthalpy h "Specific enthalpy"; + protected + ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ps pro; + algorithm + pro :=ThermoSysPro.Properties.WaterSteam.IF97.Water_Ps( + p, + s, + region); + h := pro.h; + annotation (Inline=true); + end specificEnthalpy_ps; + + redeclare function density_pT + "Computes density as a function of pressure and temperature" + extends Modelica.Icons.Function; + input AbsolutePressure p "Pressure"; + input Temperature T "Temperature"; + input FixedPhase phase=0 "2 for two-phase, 1 for one-phase, 0 if not known"; + input Integer region=Region + "If 0, region is unknown, otherwise known and this input"; + output Density d "Density"; + protected + ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_pT + pro; + algorithm + + pro := ThermoSysPro.Properties.WaterSteam.IF97_packages.IF97_wAJ.Water_PT(p, T, region); + d := pro.d; + + annotation (Inline=true); + end density_pT; + + redeclare function extends dewEnthalpy "Dew curve specific enthalpy of water" + protected + ThermoSysPro.Properties.WaterSteam.Common.PropThermoSat lsat; + ThermoSysPro.Properties.WaterSteam.Common.PropThermoSat vsat; + + algorithm + (lsat,vsat):=ThermoSysPro.Properties.WaterSteam.IF97_packages.IF97_wAJ.Water_sat_P(sat.psat); + hv := vsat.h; + annotation (Inline=true); + end dewEnthalpy; + + redeclare function extends dewDensity "Dew curve specific density of water" + protected + ThermoSysPro.Properties.WaterSteam.Common.PropThermoSat lsat; + ThermoSysPro.Properties.WaterSteam.Common.PropThermoSat vsat; + algorithm + (lsat,vsat):=ThermoSysPro.Properties.WaterSteam.IF97_packages.IF97_wAJ.Water_sat_P(sat.psat); + dv := vsat.rho; + annotation (Inline=true); + end dewDensity; + + redeclare function extends setDewState + "Set the thermodynamic state on the dew line" + algorithm + state := ThermodynamicState( + phase=phase, + p=sat.psat, + T=sat.Tsat, + h=dewEnthalpy(sat), + d=dewDensity(sat)); + + annotation (Inline=true); + end setDewState; + + redeclare function extends bubbleEnthalpy + "Boiling curve specific enthalpy of water" + protected + ThermoSysPro.Properties.WaterSteam.Common.PropThermoSat lsat; + ThermoSysPro.Properties.WaterSteam.Common.PropThermoSat vsat; + + algorithm + (lsat,vsat):=ThermoSysPro.Properties.WaterSteam.IF97_packages.IF97_wAJ.Water_sat_P(sat.psat); + hl := lsat.h; + annotation (Inline=true); + end bubbleEnthalpy; + + redeclare function extends bubbleDensity + "Boiling curve specific density of water" + protected + ThermoSysPro.Properties.WaterSteam.Common.PropThermoSat lsat; + ThermoSysPro.Properties.WaterSteam.Common.PropThermoSat vsat; + + algorithm + (lsat,vsat):=ThermoSysPro.Properties.WaterSteam.IF97_packages.IF97_wAJ.Water_sat_P(sat.psat); + dl := lsat.rho; + annotation (Inline=true); + end bubbleDensity; + + redeclare function extends setBubbleState + "Set the thermodynamic state on the bubble line" + algorithm + state := ThermodynamicState( + phase=phase, + p=sat.psat, + T=sat.Tsat, + h=bubbleEnthalpy(sat), + d=bubbleDensity(sat)); + annotation (Inline=true); + end setBubbleState; + + redeclare function extends dynamicViscosity "Dynamic viscosity of water" + algorithm + + // Water/Steam /// FONCTIONNE EN DIPHASIQUE ??? + // if fluid==1 then + eta := ThermoSysPro.Properties.WaterSteam.IF97.DynamicViscosity_rhoT(rho=state.d,T=state.T); + annotation (Inline=true); + end dynamicViscosity; + + redeclare function extends thermalConductivity + "Thermal conductivity of water" + input Integer region=Region; + algorithm + lambda := ThermoSysPro.Properties.WaterSteam.IF97.ThermalConductivity_rhoT(rho=state.d,T=state.T,P=state.p,region=region); + + annotation (Inline=true); + end thermalConductivity; + + redeclare function extends surfaceTension + "Surface tension in two phase region of water" + algorithm + sigma := ThermoSysPro.Properties.WaterSteam.IF97.SurfaceTension_T(sat.Tsat); + annotation (Inline=true); + end surfaceTension; + + redeclare function extends pressure "Return pressure of ideal gas" + algorithm + p := state.p; + annotation (Inline=true); + end pressure; + + redeclare function extends temperature "Return temperature of ideal gas" + algorithm + T := state.T; + annotation (Inline=true); + end temperature; + + redeclare function extends density "Return density of ideal gas" + algorithm + d := state.d; + annotation (Inline=true); + end density; + + redeclare function extends specificEnthalpy "Return specific enthalpy" + extends Modelica.Icons.Function; + algorithm + h := state.h; + annotation (Inline=true); + end specificEnthalpy; + + redeclare function extends specificInternalEnergy + "Return specific internal energy" + extends Modelica.Icons.Function; + algorithm + u := state.h - state.p/state.d; + annotation (Inline=true); + end specificInternalEnergy; + + redeclare function extends specificEntropy "Specific entropy of water" + protected + ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro; + + algorithm + pro :=ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph( + state.p, + state.h, + Region); + s := pro.s; + + annotation (Inline=true); + end specificEntropy; + + redeclare function extends specificGibbsEnergy "Return specific Gibbs energy" + extends Modelica.Icons.Function; + algorithm + g := state.h - state.T*specificEntropy(state); + annotation (Inline=true); + end specificGibbsEnergy; + + redeclare function extends specificHelmholtzEnergy + "Return specific Helmholtz energy" + extends Modelica.Icons.Function; + algorithm + f := state.h - state.p/state.d - state.T*specificEntropy(state); + annotation (Inline=true); + end specificHelmholtzEnergy; + + redeclare function extends specificHeatCapacityCp + "Specific heat capacity at constant pressure of water" + protected + ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro; + + algorithm + pro :=ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph( + state.p, + state.h, + Region); + cp := pro.cp; + annotation (Inline=true); + end specificHeatCapacityCp; + + redeclare function extends specificHeatCapacityCv + "Specific heat capacity at constant volume of water" + algorithm + cv := Modelica.Media.Water.IF97_Utilities.cv_ph( + state.p, + state.h, + state.phase, + Region); + annotation (Inline=true); + end specificHeatCapacityCv; + + redeclare function extends velocityOfSound + "Return velocity of sound as a function of the thermodynamic state record" + algorithm + a := ThermoSysPro.Properties.WaterSteam.IF97_Utilities.AnalyticDerivatives.velocityOfSound_pT(state.p,state.T,Region); + annotation (Inline=true); + end velocityOfSound; + + redeclare function extends isentropicEnthalpy "Compute h(s,p)" + algorithm + // h_is := Modelica.Media.Water.IF97_Utilities.isentropicEnthalpy(p_downstream, specificEntropy(refState), 0); + h_is := ThermoSysPro.Properties.WaterSteam.IF97_Utilities.AnalyticDerivatives.dynamicIsentropicEnthalpy(p_downstream, specificEntropy(refState), refState.d, refState.T, refState.phase); + annotation (Inline=true); + end isentropicEnthalpy; + + redeclare function extends density_derh_p + "Density derivative by specific enthalpy" + + protected + ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro; + algorithm + pro := ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph( + state.p, + state.h, + Region); + ddhp:=pro.ddhp; + annotation (Inline=true); + end density_derh_p; + + redeclare function extends density_derp_h "Density derivative by pressure" + protected + ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro; + algorithm + pro := ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph( + state.p, + state.h, + Region); + ddph:=pro.ddph; + annotation (Inline=true); + end density_derp_h; + // redeclare function extends density_derT_p + // "Density derivative by temperature" + // algorithm + // ddTp := IF97_Utilities.ddTp(state.p, state.h, state.phase); + // end density_derT_p; + // + // redeclare function extends density_derp_T + // "Density derivative by pressure" + // algorithm + // ddpT := IF97_Utilities.ddpT(state.p, state.h, state.phase); + // end density_derp_T; + + redeclare function extends bubbleEntropy + "Boiling curve specific entropy of water" + protected + ThermoSysPro.Properties.WaterSteam.Common.PropThermoSat lsat; + ThermoSysPro.Properties.WaterSteam.Common.PropThermoSat vsat; + ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro; + + algorithm + (lsat,vsat):=ThermoSysPro.Properties.WaterSteam.IF97_packages.IF97_wAJ.Water_sat_P(sat.psat); + pro := ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph( + sat.psat, + lsat.h, + Region); + sl:=pro.s; + annotation (Inline=true); + end bubbleEntropy; + + redeclare function extends dewEntropy "Dew curve specific entropy of water" + protected + ThermoSysPro.Properties.WaterSteam.Common.PropThermoSat lsat; + ThermoSysPro.Properties.WaterSteam.Common.PropThermoSat vsat; + ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro; + + algorithm + (lsat,vsat):=ThermoSysPro.Properties.WaterSteam.IF97_packages.IF97_wAJ.Water_sat_P(sat.psat); + pro := ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph( + sat.psat, + vsat.h, + Region); + sv := pro.s; + annotation (Inline=true); + end dewEntropy; + + redeclare function extends saturationTemperature + "Saturation temperature of water" + algorithm + T := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.tsat(p); + annotation (Inline=true); + end saturationTemperature; + + redeclare function extends saturationTemperature_derp + "Derivative of saturation temperature w.r.t. pressure" + algorithm + dTp := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.dtsatofp(p); + annotation (Inline=true); + end saturationTemperature_derp; + + redeclare function extends saturationPressure "Saturation pressure of water" + algorithm + p := ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.psat(T); + annotation (Inline=true); + end saturationPressure; + + redeclare function extends dBubbleDensity_dPressure + "Bubble point density derivative" + // algorithm + // ddldp := Modelica.Media.Water.IF97_Utilities.BaseIF97.Regions.drhol_dp(sat.psat); + annotation (Inline=true); + end dBubbleDensity_dPressure; + + redeclare function extends dDewDensity_dPressure + "Dew point density derivative" + // algorithm + // ddvdp := Modelica.Media.Water.IF97_Utilities.BaseIF97.Regions.drhov_dp(sat.psat); + annotation (Inline=true); + end dDewDensity_dPressure; + + redeclare function extends dBubbleEnthalpy_dPressure + "Bubble point specific enthalpy derivative" + // algorithm + // dhldp := Modelica.Media.Water.IF97_Utilities.BaseIF97.Regions.dhl_dp(sat.psat); + annotation (Inline=true); + end dBubbleEnthalpy_dPressure; + + redeclare function extends dDewEnthalpy_dPressure + "Dew point specific enthalpy derivative" + // algorithm + // dhvdp := Modelica.Media.Water.IF97_Utilities.BaseIF97.Regions.dhv_dp(sat.psat); + annotation (Inline=true); + end dDewEnthalpy_dPressure; + + redeclare function extends setState_psX + "Return thermodynamic state of water as function of p, s, and optional region" + input Integer region=Region + "If 0, region is unknown, otherwise known and this input"; + protected + ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ps pro; + algorithm + pro :=ThermoSysPro.Properties.WaterSteam.IF97.Water_Ps( + p, + s, + region); + state := ThermodynamicState( + d=pro.d, + T=pro.T, + phase=if region == 0 then 0 else if region==4 then 2 else 1, + h=pro.h, + p=p); + annotation (Inline=true); + end setState_psX; + + redeclare function extends setState_pTX + "Return thermodynamic state of water as function of p, T, and optional region" + input Integer region=Region + "If 0, region is unknown, otherwise known and this input"; + protected + ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_pT pro; + algorithm + pro :=ThermoSysPro.Properties.WaterSteam.IF97.Water_PT( + p, + T, + region); + state := ThermodynamicState( + d=pro.d, + T=T, + phase=1, + h=pro.h, + p=p); + annotation (Inline=true); + end setState_pTX; + + redeclare function extends setSmoothState + "Return thermodynamic state so that it smoothly approximates: if x > 0 then state_a else state_b" + import Modelica.Media.Common.smoothStep; + algorithm + state := ThermodynamicState( + p=smoothStep( + x, + state_a.p, + state_b.p, + x_small), + h=smoothStep( + x, + state_a.h, + state_b.h, + x_small), + d=density_ph(smoothStep( + x, + state_a.p, + state_b.p, + x_small), smoothStep( + x, + state_a.h, + state_b.h, + x_small)), + T=temperature_ph(smoothStep( + x, + state_a.p, + state_b.p, + x_small), smoothStep( + x, + state_a.h, + state_b.h, + x_small)), + phase=0); + annotation (Inline=true); + end setSmoothState; + + redeclare function extends setState_dTX + "Return thermodynamic state of water as function of d, T, and optional region" + // input Integer region=Region + // "If 0, region is unknown, otherwise known and this input"; + // algorithm + // state := ThermodynamicState( + // d=d, + // T=T, + // phase=if region == 0 then 0 else if + // region == 4 then 2 else 1, + // h=specificEnthalpy_dT( + // d, + // T, + // region=region), + // p=pressure_dT( + // d, + // T, + // region=region)); + // annotation (Inline=true); + end setState_dTX; + + redeclare function extends specificEnthalpy_dT + "Computes specific enthalpy as a function of density and temperature" + // extends Modelica.Icons.Function; + // input Density d "Density"; + // input Temperature T "Temperature"; + // input FixedPhase phase=0 "2 for two-phase, 1 for one-phase, 0 if not known"; + // input Integer region=Region + // "If 0, region is unknown, otherwise known and this input"; + // output SpecificEnthalpy h "Specific enthalpy"; + // algorithm + // h := Modelica.Media.Water.IF97_Utilities.h_dT( + // d, + // T, + // phase, + // region); + // annotation (Inline=true); + + end specificEnthalpy_dT; + + redeclare function extends pressure_dT + "Computes pressure as a function of density and temperature" + // extends Modelica.Icons.Function; + // input Density d "Density"; + // input Temperature T "Temperature"; + // input FixedPhase phase=0 "2 for two-phase, 1 for one-phase, 0 if not known"; + // input Integer region=Region + // "If 0, region is unknown, otherwise known and this input"; + // output AbsolutePressure p "Pressure"; + // algorithm + // p := Modelica.Media.Water.IF97_Utilities.p_dT( + // d, + // T, + // phase, + // region); + // annotation (Inline=true); + + end pressure_dT; + + redeclare function extends isentropicExponent "Return isentropic exponent" + // algorithm + // gamma := if dT_explicit then Modelica.Media.Water.IF97_Utilities.isentropicExponent_dT( + // state.d, + // state.T, + // state.phase, + // Region) else if pT_explicit then Modelica.Media.Water.IF97_Utilities.isentropicExponent_pT( + // state.p, + // state.T, + // Region) else Modelica.Media.Water.IF97_Utilities.isentropicExponent_ph( + // state.p, + // state.h, + // state.phase, + // Region); + // annotation (Inline=true); + end isentropicExponent; + + redeclare function extends isothermalCompressibility + "Isothermal compressibility of water" + // algorithm + // // assert(state.phase <> 2, "Isothermal compressibility can not be computed with 2-phase inputs!"); + // kappa := if dT_explicit then Modelica.Media.Water.IF97_Utilities.kappa_dT( + // state.d, + // state.T, + // state.phase, + // Region) else if pT_explicit then Modelica.Media.Water.IF97_Utilities.kappa_pT( + // state.p, + // state.T, + // Region) else Modelica.Media.Water.IF97_Utilities.kappa_ph( + // state.p, + // state.h, + // state.phase, + // Region); + // annotation (Inline=true); + end isothermalCompressibility; + + redeclare function extends isobaricExpansionCoefficient + "Isobaric expansion coefficient of water" + // algorithm + // // assert(state.phase <> 2, "The isobaric expansion coefficient can not be computed with 2-phase inputs!"); + // beta := if dT_explicit then Modelica.Media.Water.IF97_Utilities.beta_dT( + // state.d, + // state.T, + // state.phase, + // Region) else if pT_explicit then Modelica.Media.Water.IF97_Utilities.beta_pT( + // state.p, + // state.T, + // Region) else Modelica.Media.Water.IF97_Utilities.beta_ph( + // state.p, + // state.h, + // state.phase, + // Region); + // annotation (Inline=true); + end isobaricExpansionCoefficient; +end WaterSteam; diff --git a/ThermoSysPro/Properties/Media/WaterSteam/package.order b/ThermoSysPro/Properties/Media/WaterSteam/package.order new file mode 100644 index 00000000..0b73fe30 --- /dev/null +++ b/ThermoSysPro/Properties/Media/WaterSteam/package.order @@ -0,0 +1,53 @@ +SaturationProperties +ThermodynamicState +Region +BaseProperties +density_ph +temperature_ph +setState_phX +temperature_ps +density_ps +specificEnthalpy_pT +specificEnthalpy_ps +density_pT +dewEnthalpy +dewDensity +setDewState +bubbleEnthalpy +bubbleDensity +setBubbleState +dynamicViscosity +thermalConductivity +surfaceTension +pressure +temperature +density +specificEnthalpy +specificInternalEnergy +specificEntropy +specificGibbsEnergy +specificHelmholtzEnergy +specificHeatCapacityCp +specificHeatCapacityCv +velocityOfSound +isentropicEnthalpy +density_derh_p +density_derp_h +bubbleEntropy +dewEntropy +saturationTemperature +saturationTemperature_derp +saturationPressure +dBubbleDensity_dPressure +dDewDensity_dPressure +dBubbleEnthalpy_dPressure +dDewEnthalpy_dPressure +setState_psX +setState_pTX +setSmoothState +setState_dTX +specificEnthalpy_dT +pressure_dT +isentropicExponent +isothermalCompressibility +isobaricExpansionCoefficient diff --git a/ThermoSysPro/Properties/Media/package.mo b/ThermoSysPro/Properties/Media/package.mo new file mode 100644 index 00000000..921e6fe5 --- /dev/null +++ b/ThermoSysPro/Properties/Media/package.mo @@ -0,0 +1,115 @@ +within ThermoSysPro.Properties; +package Media + annotation (Icon(graphics={ + Text( + extent={{-102,0},{24,-26}}, + lineColor={242,148,0}, + textString= + "Thermo"), + Text( + extent={{-4,8},{68,-34}}, + lineColor={46,170,220}, + textString= + "SysPro"), + Polygon( + points={{-62,2},{-58,4},{-48,8},{-32,12},{-16,14},{6,14},{26,12},{42,8},{52,2},{42,6},{28,10},{6,12},{-12,12},{-16,12},{-34,10},{-50,6},{-62,2}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-44,38},{-24,38},{-26,30},{-26,22},{-24,14},{-24,12},{-46,8},{-42,22},{-42,30},{-44,38}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-26,20},{-20,20},{-20,22},{-14,22},{-14,20},{-12,20},{-12,12},{-26,12},{-28,12},{-26,20}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-8,14},{-8,24},{-6,24},{-6,14},{-8,14}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-8,30},{-6,26}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-8,36},{-6,32}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-8,42},{-6,38}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-8,48},{-6,44}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-4,14},{-4,26},{-2,26},{-2,14},{-4,14}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-4,32},{-2,28}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-4,38},{-2,34}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-4,44},{-2,40}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-4,50},{-2,46}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-2,20},{8,20},{8,22},{10,22},{18,22},{18,12},{-4,14},{-2,20}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-62,2},{-58,4},{-48,8},{-36,10},{-18,12},{6,12},{26,10},{42,6},{52,0},{42,4},{28,8},{6,10},{-12,10},{-18,10},{-38,8},{-50,6},{-62,2}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Line( + points={{22,12},{22,14},{22,16},{24,14},{20,18}}, + color={46,170,220}, + thickness=0.5), + Line( + points={{26,12},{26,14},{26,16},{28,14},{24,18}}, + color={46,170,220}, + thickness=0.5), + Line( + points={{30,10},{30,12},{30,14},{32,12},{28,16}}, + color={46,170,220}, + thickness=0.5), + Polygon( + points={{36,8},{36,30},{34,34},{36,38},{40,38},{40,8},{36,8}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Rectangle(extent={{-100,80},{80,-100}}, lineColor={0,0,255}), + Line( + points={{-100,80},{-80,100},{100,100},{100,-80},{80,-100}}, + color={0,0,255}, + smooth=Smooth.None), + Line( + points={{80,80},{100,100}}, + color={0,0,255}, + smooth=Smooth.None)})); +end Media; diff --git a/ThermoSysPro/Properties/Media/package.order b/ThermoSysPro/Properties/Media/package.order new file mode 100644 index 00000000..e9f32b99 --- /dev/null +++ b/ThermoSysPro/Properties/Media/package.order @@ -0,0 +1,4 @@ +PartialSubCMedium +PartialThermoSysProMedium +PartialTwoPhaseThermoSysProMedium +WaterSteam diff --git a/ThermoSysPro/Properties/MoltenSalt/DynamicViscosity_T.mo b/ThermoSysPro/Properties/MoltenSalt/DynamicViscosity_T.mo index 9ffc3a67..6d167cde 100644 --- a/ThermoSysPro/Properties/MoltenSalt/DynamicViscosity_T.mo +++ b/ThermoSysPro/Properties/MoltenSalt/DynamicViscosity_T.mo @@ -1,4 +1,4 @@ -within ThermoSysPro.Properties.MoltenSalt; +within ThermoSysPro.Properties.MoltenSalt; function DynamicViscosity_T "Dynamic Viscosity computation for Salt (input T)" input Units.SI.Temperature T "Temperature (K)"; diff --git a/ThermoSysPro/Properties/MoltenSalt/ThermalConductivity_T.mo b/ThermoSysPro/Properties/MoltenSalt/ThermalConductivity_T.mo index 2adc751b..278c4a3c 100644 --- a/ThermoSysPro/Properties/MoltenSalt/ThermalConductivity_T.mo +++ b/ThermoSysPro/Properties/MoltenSalt/ThermalConductivity_T.mo @@ -1,4 +1,4 @@ -within ThermoSysPro.Properties.MoltenSalt; +within ThermoSysPro.Properties.MoltenSalt; function ThermalConductivity_T "Thermal Conductivity computation for Salt (input T)" diff --git a/ThermoSysPro/Properties/MoltenSalt/ThermoPropertiesFunction_T_2.mo b/ThermoSysPro/Properties/MoltenSalt/ThermoPropertiesFunction_T_2.mo index df9e3978..d35e8c21 100644 --- a/ThermoSysPro/Properties/MoltenSalt/ThermoPropertiesFunction_T_2.mo +++ b/ThermoSysPro/Properties/MoltenSalt/ThermoPropertiesFunction_T_2.mo @@ -1,4 +1,4 @@ -within ThermoSysPro.Properties.MoltenSalt; +within ThermoSysPro.Properties.MoltenSalt; function ThermoPropertiesFunction_T_2 "ThermoPropertiesFunction of Solt: KNO3-NaNO3 " input Units.SI.Temperature T diff --git a/ThermoSysPro/Properties/Oil_TherminolVP1/TherminolVP1_Data.mo b/ThermoSysPro/Properties/Oil_TherminolVP1/TherminolVP1_Data.mo index e63ad72c..e49a13a4 100644 --- a/ThermoSysPro/Properties/Oil_TherminolVP1/TherminolVP1_Data.mo +++ b/ThermoSysPro/Properties/Oil_TherminolVP1/TherminolVP1_Data.mo @@ -1,4 +1,4 @@ -within ThermoSysPro.Properties.Oil_TherminolVP1; +within ThermoSysPro.Properties.Oil_TherminolVP1; record TherminolVP1_Data "Data for Oil from STEPHANIE Library" // STEPHANIE TherminolVP1 diff --git a/ThermoSysPro/Properties/WaterSolution/MassFraction_eq_PT.mo b/ThermoSysPro/Properties/WaterSolution/MassFraction_eq_PT.mo index 29e697e3..40ffcb0e 100644 --- a/ThermoSysPro/Properties/WaterSolution/MassFraction_eq_PT.mo +++ b/ThermoSysPro/Properties/WaterSolution/MassFraction_eq_PT.mo @@ -1,4 +1,4 @@ -within ThermoSysPro.Properties.WaterSolution; +within ThermoSysPro.Properties.WaterSolution; function MassFraction_eq_PT "Equilibrium mass fraction of the H2O/LiBr solution as a function of T et Xh2o" input Units.SI.AbsolutePressure P "Pressure"; diff --git a/ThermoSysPro/Properties/WaterSolution/Pressure_eq_TX.mo b/ThermoSysPro/Properties/WaterSolution/Pressure_eq_TX.mo index 896332c2..263d7a1d 100644 --- a/ThermoSysPro/Properties/WaterSolution/Pressure_eq_TX.mo +++ b/ThermoSysPro/Properties/WaterSolution/Pressure_eq_TX.mo @@ -1,4 +1,4 @@ -within ThermoSysPro.Properties.WaterSolution; +within ThermoSysPro.Properties.WaterSolution; function Pressure_eq_TX "Equilibrium pressure of the H2O/LiBr solution as a funciton of T and Xh2o" input Units.SI.Temperature T "Temperature"; diff --git a/ThermoSysPro/Properties/WaterSteam/BaseIF97.mo b/ThermoSysPro/Properties/WaterSteam/BaseIF97.mo index 7e9b0de0..da9703e4 100644 --- a/ThermoSysPro/Properties/WaterSteam/BaseIF97.mo +++ b/ThermoSysPro/Properties/WaterSteam/BaseIF97.mo @@ -1,4 +1,4 @@ -within ThermoSysPro.Properties.WaterSteam; +within ThermoSysPro.Properties.WaterSteam; package BaseIF97 "Modelica Physical Property Model: the new industrial formulation IAPWS-IF97" diff --git a/ThermoSysPro/Properties/WaterSteam/Common.mo b/ThermoSysPro/Properties/WaterSteam/Common.mo index 2484169b..344df89d 100644 --- a/ThermoSysPro/Properties/WaterSteam/Common.mo +++ b/ThermoSysPro/Properties/WaterSteam/Common.mo @@ -1,4 +1,4 @@ -within ThermoSysPro.Properties.WaterSteam; +within ThermoSysPro.Properties.WaterSteam; package Common import ThermoSysPro.Units.SI; diff --git a/ThermoSysPro/Properties/WaterSteam/IF97_packages.mo b/ThermoSysPro/Properties/WaterSteam/IF97_packages.mo index db33afc2..8efbcf66 100644 --- a/ThermoSysPro/Properties/WaterSteam/IF97_packages.mo +++ b/ThermoSysPro/Properties/WaterSteam/IF97_packages.mo @@ -1,4 +1,4 @@ -within ThermoSysPro.Properties.WaterSteam; +within ThermoSysPro.Properties.WaterSteam; package IF97_packages package IF97_wAJ @@ -2975,7 +2975,7 @@ package IF97_packages end if; Util.Streams.print("end IF97_spline;",fileName); status := true; - annotation (); + annotation(); end dumpOneSpline; package Modelica_Interpolation diff --git a/ThermoSysPro/Properties/WaterSteamSimple/SimpleWater/SpecificEnthalpy_PT_der.mo b/ThermoSysPro/Properties/WaterSteamSimple/SimpleWater/SpecificEnthalpy_PT_der.mo index 95fa3ae3..741fe13a 100644 --- a/ThermoSysPro/Properties/WaterSteamSimple/SimpleWater/SpecificEnthalpy_PT_der.mo +++ b/ThermoSysPro/Properties/WaterSteamSimple/SimpleWater/SpecificEnthalpy_PT_der.mo @@ -1,4 +1,4 @@ -within ThermoSysPro.Properties.WaterSteamSimple.SimpleWater; +within ThermoSysPro.Properties.WaterSteamSimple.SimpleWater; function SpecificEnthalpy_PT_der input Units.SI.AbsolutePressure p "pressure"; input Units.SI.Temperature T "Temperature"; diff --git a/ThermoSysPro/Properties/WaterSteamSimple/SimpleWater/Water_Ph_der.mo b/ThermoSysPro/Properties/WaterSteamSimple/SimpleWater/Water_Ph_der.mo index 7a4bd342..1788ea8e 100644 --- a/ThermoSysPro/Properties/WaterSteamSimple/SimpleWater/Water_Ph_der.mo +++ b/ThermoSysPro/Properties/WaterSteamSimple/SimpleWater/Water_Ph_der.mo @@ -1,4 +1,4 @@ -within ThermoSysPro.Properties.WaterSteamSimple.SimpleWater; +within ThermoSysPro.Properties.WaterSteamSimple.SimpleWater; function Water_Ph_der "Derivative function of Water_Ph" input Units.SI.AbsolutePressure p "Pressure"; input Units.SI.SpecificEnthalpy h "Specific enthalpy"; diff --git a/ThermoSysPro/Properties/package.order b/ThermoSysPro/Properties/package.order index 46af4f53..9ac6910e 100644 --- a/ThermoSysPro/Properties/package.order +++ b/ThermoSysPro/Properties/package.order @@ -10,3 +10,4 @@ WaterSolution SolarSalt ModelicaMediaFlueGases Common +Media From 81201fc0c264fda7bb765b4720ac1ef80ae9870c Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Fri, 16 May 2025 17:30:41 +0200 Subject: [PATCH 002/178] #125 Organize architecture for Fluid/Example/SimpleExamples for new fluid examples --- .gitignore | 2 +- .../ConcentratedSolarPowerPlant_PTSC.mo | 2 +- .../CombinedCycle_Load_100_50.mo | 4 +- .../Fluid/Examples/Control/MassFlowControl.mo | 2 +- .../Examples/Control/Pump_VelocityControl.mo | 2 +- .../Examples/Control/TemperatureControl.mo | 2 +- .../SimpleExamples/Boilers/package.mo | 116 ++++++++++++++++++ .../SimpleExamples/Boilers/package.order | 0 .../BoundaryConditions/package.mo | 116 ++++++++++++++++++ .../BoundaryConditions/package.order | 0 .../SimpleExamples/Combustion/package.mo | 116 ++++++++++++++++++ .../SimpleExamples/Combustion/package.order | 0 .../SimpleExamples/Examples/package.mo | 116 ++++++++++++++++++ .../SimpleExamples/Examples/package.order | 0 .../SimpleExamples/HeatExchangers/package.mo | 116 ++++++++++++++++++ .../HeatExchangers/package.order | 0 .../SimpleExamples/Interfaces/package.order | 0 .../SimpleExamples/Junctions/package.mo | 116 ++++++++++++++++++ .../SimpleExamples/Junctions/package.order | 0 .../SimpleExamples/LoopBreakers/package.mo | 116 ++++++++++++++++++ .../SimpleExamples/LoopBreakers/package.order | 0 .../SimpleExamples/Machines/package.mo | 116 ++++++++++++++++++ .../SimpleExamples/Machines/package.order | 0 .../SimpleExamples/PressureLosses/package.mo | 116 ++++++++++++++++++ .../PressureLosses/package.order | 0 .../SimpleExamples/Sensors/package.mo | 116 ++++++++++++++++++ .../SimpleExamples/Sensors/package.order | 0 .../SimpleExamples/Volumes/package.mo | 116 ++++++++++++++++++ .../SimpleExamples/Volumes/package.order | 0 .../Fluid/Examples/SimpleExamples/package.mo | 22 +--- .../Examples/SimpleExamples/package.order | 11 ++ 31 files changed, 1300 insertions(+), 23 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Boilers/package.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Boilers/package.order create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/package.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/package.order create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Combustion/package.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Combustion/package.order create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Examples/package.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Examples/package.order create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Interfaces/package.order create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/package.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/package.order create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/LoopBreakers/package.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/LoopBreakers/package.order create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/package.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/package.order create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Sensors/package.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Sensors/package.order create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order diff --git a/.gitignore b/.gitignore index 3f0d8671..e5321807 100644 --- a/.gitignore +++ b/.gitignore @@ -16,4 +16,4 @@ status* *.mof *.c buildlog.txt - +*.bak-mo diff --git a/ThermoSysPro/Fluid/Examples/Book/PowerPlants/ConcentratedSolarPowerPlant_PTSC.mo b/ThermoSysPro/Fluid/Examples/Book/PowerPlants/ConcentratedSolarPowerPlant_PTSC.mo index 5bb5b9dc..9e28186c 100644 --- a/ThermoSysPro/Fluid/Examples/Book/PowerPlants/ConcentratedSolarPowerPlant_PTSC.mo +++ b/ThermoSysPro/Fluid/Examples/Book/PowerPlants/ConcentratedSolarPowerPlant_PTSC.mo @@ -1,4 +1,4 @@ -within ThermoSysPro.Fluid.Examples.Book.PowerPlants; +within ThermoSysPro.Fluid.Examples.Book.PowerPlants; model ConcentratedSolarPowerPlant_PTSC "Model of a concentrated solar power plant with PTSC" parameter Real L1 = 500 "Longueur de la première chaine de capteurs"; diff --git a/ThermoSysPro/Fluid/Examples/CombinedCyclePowerPlant/CombinedCycle_Load_100_50.mo b/ThermoSysPro/Fluid/Examples/CombinedCyclePowerPlant/CombinedCycle_Load_100_50.mo index ebf7222d..386da98d 100644 --- a/ThermoSysPro/Fluid/Examples/CombinedCyclePowerPlant/CombinedCycle_Load_100_50.mo +++ b/ThermoSysPro/Fluid/Examples/CombinedCyclePowerPlant/CombinedCycle_Load_100_50.mo @@ -946,8 +946,8 @@ model CombinedCycle_Load_100_50 "CCPP model to simulate a load variation from 10 extent={{20,-20},{-20,20}}, rotation=90))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP PuitsFumees(P0=1.013e5, C(h_vol_1 - (start=329093.3007791504))) + ThermoSysPro.Fluid.BoundaryConditions.SinkP PuitsFumees(P0=1.013e5, C(h_vol_1( + start=329093.3007791504))) annotation (Placement(transformation( origin={722,-50}, extent={{10,-10},{-10,10}}, diff --git a/ThermoSysPro/Fluid/Examples/Control/MassFlowControl.mo b/ThermoSysPro/Fluid/Examples/Control/MassFlowControl.mo index 39040c01..0e447c9b 100644 --- a/ThermoSysPro/Fluid/Examples/Control/MassFlowControl.mo +++ b/ThermoSysPro/Fluid/Examples/Control/MassFlowControl.mo @@ -1,4 +1,4 @@ -within ThermoSysPro.Fluid.Examples.Control; +within ThermoSysPro.Fluid.Examples.Control; model MassFlowControl "Pump_MassFlowControl" parameter Real k=1 "Gain"; parameter Real Ti=1 "Time constant (s)"; diff --git a/ThermoSysPro/Fluid/Examples/Control/Pump_VelocityControl.mo b/ThermoSysPro/Fluid/Examples/Control/Pump_VelocityControl.mo index 74066be1..4fb4d413 100644 --- a/ThermoSysPro/Fluid/Examples/Control/Pump_VelocityControl.mo +++ b/ThermoSysPro/Fluid/Examples/Control/Pump_VelocityControl.mo @@ -1,4 +1,4 @@ -within ThermoSysPro.Fluid.Examples.Control; +within ThermoSysPro.Fluid.Examples.Control; model Pump_VelocityControl "Drum level control" parameter Real k=1 "Gain"; parameter Real Ti=1 "Time constant (s)"; diff --git a/ThermoSysPro/Fluid/Examples/Control/TemperatureControl.mo b/ThermoSysPro/Fluid/Examples/Control/TemperatureControl.mo index 21ee184c..ba32fc4a 100644 --- a/ThermoSysPro/Fluid/Examples/Control/TemperatureControl.mo +++ b/ThermoSysPro/Fluid/Examples/Control/TemperatureControl.mo @@ -1,4 +1,4 @@ -within ThermoSysPro.Fluid.Examples.Control; +within ThermoSysPro.Fluid.Examples.Control; model TemperatureControl "Temperature_Control" parameter Real k=1 "Gain"; parameter Real Ti=1 "Time constant (s)"; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Boilers/package.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Boilers/package.mo new file mode 100644 index 00000000..57e2eaa8 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Boilers/package.mo @@ -0,0 +1,116 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples; +package Boilers + + annotation (Icon(graphics={ + Text( + extent={{-102,0},{24,-26}}, + lineColor={242,148,0}, + textString= + "Thermo"), + Text( + extent={{-4,8},{68,-34}}, + lineColor={46,170,220}, + textString= + "SysPro"), + Polygon( + points={{-62,2},{-58,4},{-48,8},{-32,12},{-16,14},{6,14},{26,12},{42,8},{52,2},{42,6},{28,10},{6,12},{-12,12},{-16,12},{-34,10},{-50,6},{-62,2}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-44,38},{-24,38},{-26,30},{-26,22},{-24,14},{-24,12},{-46,8},{-42,22},{-42,30},{-44,38}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-26,20},{-20,20},{-20,22},{-14,22},{-14,20},{-12,20},{-12,12},{-26,12},{-28,12},{-26,20}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-8,14},{-8,24},{-6,24},{-6,14},{-8,14}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-8,30},{-6,26}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-8,36},{-6,32}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-8,42},{-6,38}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-8,48},{-6,44}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-4,14},{-4,26},{-2,26},{-2,14},{-4,14}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-4,32},{-2,28}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-4,38},{-2,34}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-4,44},{-2,40}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-4,50},{-2,46}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-2,20},{8,20},{8,22},{10,22},{18,22},{18,12},{-4,14},{-2,20}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-62,2},{-58,4},{-48,8},{-36,10},{-18,12},{6,12},{26,10},{42,6},{52,0},{42,4},{28,8},{6,10},{-12,10},{-18,10},{-38,8},{-50,6},{-62,2}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Line( + points={{22,12},{22,14},{22,16},{24,14},{20,18}}, + color={46,170,220}, + thickness=0.5), + Line( + points={{26,12},{26,14},{26,16},{28,14},{24,18}}, + color={46,170,220}, + thickness=0.5), + Line( + points={{30,10},{30,12},{30,14},{32,12},{28,16}}, + color={46,170,220}, + thickness=0.5), + Polygon( + points={{36,8},{36,30},{34,34},{36,38},{40,38},{40,8},{36,8}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Rectangle(extent={{-100,80},{80,-100}}, lineColor={0,0,255}), + Line( + points={{-100,80},{-80,100},{100,100},{100,-80},{80,-100}}, + color={0,0,255}, + smooth=Smooth.None), + Line( + points={{80,80},{100,100}}, + color={0,0,255}, + smooth=Smooth.None)})); +end Boilers; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Boilers/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/Boilers/package.order new file mode 100644 index 00000000..e69de29b diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/package.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/package.mo new file mode 100644 index 00000000..2950299c --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/package.mo @@ -0,0 +1,116 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples; +package BoundaryConditions + + annotation (Icon(graphics={ + Text( + extent={{-102,0},{24,-26}}, + lineColor={242,148,0}, + textString= + "Thermo"), + Text( + extent={{-4,8},{68,-34}}, + lineColor={46,170,220}, + textString= + "SysPro"), + Polygon( + points={{-62,2},{-58,4},{-48,8},{-32,12},{-16,14},{6,14},{26,12},{42,8},{52,2},{42,6},{28,10},{6,12},{-12,12},{-16,12},{-34,10},{-50,6},{-62,2}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-44,38},{-24,38},{-26,30},{-26,22},{-24,14},{-24,12},{-46,8},{-42,22},{-42,30},{-44,38}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-26,20},{-20,20},{-20,22},{-14,22},{-14,20},{-12,20},{-12,12},{-26,12},{-28,12},{-26,20}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-8,14},{-8,24},{-6,24},{-6,14},{-8,14}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-8,30},{-6,26}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-8,36},{-6,32}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-8,42},{-6,38}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-8,48},{-6,44}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-4,14},{-4,26},{-2,26},{-2,14},{-4,14}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-4,32},{-2,28}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-4,38},{-2,34}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-4,44},{-2,40}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-4,50},{-2,46}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-2,20},{8,20},{8,22},{10,22},{18,22},{18,12},{-4,14},{-2,20}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-62,2},{-58,4},{-48,8},{-36,10},{-18,12},{6,12},{26,10},{42,6},{52,0},{42,4},{28,8},{6,10},{-12,10},{-18,10},{-38,8},{-50,6},{-62,2}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Line( + points={{22,12},{22,14},{22,16},{24,14},{20,18}}, + color={46,170,220}, + thickness=0.5), + Line( + points={{26,12},{26,14},{26,16},{28,14},{24,18}}, + color={46,170,220}, + thickness=0.5), + Line( + points={{30,10},{30,12},{30,14},{32,12},{28,16}}, + color={46,170,220}, + thickness=0.5), + Polygon( + points={{36,8},{36,30},{34,34},{36,38},{40,38},{40,8},{36,8}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Rectangle(extent={{-100,80},{80,-100}}, lineColor={0,0,255}), + Line( + points={{-100,80},{-80,100},{100,100},{100,-80},{80,-100}}, + color={0,0,255}, + smooth=Smooth.None), + Line( + points={{80,80},{100,100}}, + color={0,0,255}, + smooth=Smooth.None)})); +end BoundaryConditions; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/package.order new file mode 100644 index 00000000..e69de29b diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Combustion/package.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Combustion/package.mo new file mode 100644 index 00000000..38ce2164 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Combustion/package.mo @@ -0,0 +1,116 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples; +package Combustion + + annotation (Icon(graphics={ + Text( + extent={{-102,0},{24,-26}}, + lineColor={242,148,0}, + textString= + "Thermo"), + Text( + extent={{-4,8},{68,-34}}, + lineColor={46,170,220}, + textString= + "SysPro"), + Polygon( + points={{-62,2},{-58,4},{-48,8},{-32,12},{-16,14},{6,14},{26,12},{42,8},{52,2},{42,6},{28,10},{6,12},{-12,12},{-16,12},{-34,10},{-50,6},{-62,2}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-44,38},{-24,38},{-26,30},{-26,22},{-24,14},{-24,12},{-46,8},{-42,22},{-42,30},{-44,38}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-26,20},{-20,20},{-20,22},{-14,22},{-14,20},{-12,20},{-12,12},{-26,12},{-28,12},{-26,20}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-8,14},{-8,24},{-6,24},{-6,14},{-8,14}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-8,30},{-6,26}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-8,36},{-6,32}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-8,42},{-6,38}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-8,48},{-6,44}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-4,14},{-4,26},{-2,26},{-2,14},{-4,14}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-4,32},{-2,28}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-4,38},{-2,34}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-4,44},{-2,40}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-4,50},{-2,46}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-2,20},{8,20},{8,22},{10,22},{18,22},{18,12},{-4,14},{-2,20}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-62,2},{-58,4},{-48,8},{-36,10},{-18,12},{6,12},{26,10},{42,6},{52,0},{42,4},{28,8},{6,10},{-12,10},{-18,10},{-38,8},{-50,6},{-62,2}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Line( + points={{22,12},{22,14},{22,16},{24,14},{20,18}}, + color={46,170,220}, + thickness=0.5), + Line( + points={{26,12},{26,14},{26,16},{28,14},{24,18}}, + color={46,170,220}, + thickness=0.5), + Line( + points={{30,10},{30,12},{30,14},{32,12},{28,16}}, + color={46,170,220}, + thickness=0.5), + Polygon( + points={{36,8},{36,30},{34,34},{36,38},{40,38},{40,8},{36,8}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Rectangle(extent={{-100,80},{80,-100}}, lineColor={0,0,255}), + Line( + points={{-100,80},{-80,100},{100,100},{100,-80},{80,-100}}, + color={0,0,255}, + smooth=Smooth.None), + Line( + points={{80,80},{100,100}}, + color={0,0,255}, + smooth=Smooth.None)})); +end Combustion; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Combustion/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/Combustion/package.order new file mode 100644 index 00000000..e69de29b diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Examples/package.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Examples/package.mo new file mode 100644 index 00000000..d4ba3cbb --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Examples/package.mo @@ -0,0 +1,116 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples; +package Examples + + annotation (Icon(graphics={ + Text( + extent={{-102,0},{24,-26}}, + lineColor={242,148,0}, + textString= + "Thermo"), + Text( + extent={{-4,8},{68,-34}}, + lineColor={46,170,220}, + textString= + "SysPro"), + Polygon( + points={{-62,2},{-58,4},{-48,8},{-32,12},{-16,14},{6,14},{26,12},{42,8},{52,2},{42,6},{28,10},{6,12},{-12,12},{-16,12},{-34,10},{-50,6},{-62,2}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-44,38},{-24,38},{-26,30},{-26,22},{-24,14},{-24,12},{-46,8},{-42,22},{-42,30},{-44,38}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-26,20},{-20,20},{-20,22},{-14,22},{-14,20},{-12,20},{-12,12},{-26,12},{-28,12},{-26,20}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-8,14},{-8,24},{-6,24},{-6,14},{-8,14}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-8,30},{-6,26}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-8,36},{-6,32}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-8,42},{-6,38}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-8,48},{-6,44}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-4,14},{-4,26},{-2,26},{-2,14},{-4,14}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-4,32},{-2,28}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-4,38},{-2,34}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-4,44},{-2,40}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-4,50},{-2,46}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-2,20},{8,20},{8,22},{10,22},{18,22},{18,12},{-4,14},{-2,20}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-62,2},{-58,4},{-48,8},{-36,10},{-18,12},{6,12},{26,10},{42,6},{52,0},{42,4},{28,8},{6,10},{-12,10},{-18,10},{-38,8},{-50,6},{-62,2}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Line( + points={{22,12},{22,14},{22,16},{24,14},{20,18}}, + color={46,170,220}, + thickness=0.5), + Line( + points={{26,12},{26,14},{26,16},{28,14},{24,18}}, + color={46,170,220}, + thickness=0.5), + Line( + points={{30,10},{30,12},{30,14},{32,12},{28,16}}, + color={46,170,220}, + thickness=0.5), + Polygon( + points={{36,8},{36,30},{34,34},{36,38},{40,38},{40,8},{36,8}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Rectangle(extent={{-100,80},{80,-100}}, lineColor={0,0,255}), + Line( + points={{-100,80},{-80,100},{100,100},{100,-80},{80,-100}}, + color={0,0,255}, + smooth=Smooth.None), + Line( + points={{80,80},{100,100}}, + color={0,0,255}, + smooth=Smooth.None)})); +end Examples; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Examples/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/Examples/package.order new file mode 100644 index 00000000..e69de29b diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.mo new file mode 100644 index 00000000..8a9e5e13 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.mo @@ -0,0 +1,116 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples; +package HeatExchangers + + annotation (Icon(graphics={ + Text( + extent={{-102,0},{24,-26}}, + lineColor={242,148,0}, + textString= + "Thermo"), + Text( + extent={{-4,8},{68,-34}}, + lineColor={46,170,220}, + textString= + "SysPro"), + Polygon( + points={{-62,2},{-58,4},{-48,8},{-32,12},{-16,14},{6,14},{26,12},{42,8},{52,2},{42,6},{28,10},{6,12},{-12,12},{-16,12},{-34,10},{-50,6},{-62,2}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-44,38},{-24,38},{-26,30},{-26,22},{-24,14},{-24,12},{-46,8},{-42,22},{-42,30},{-44,38}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-26,20},{-20,20},{-20,22},{-14,22},{-14,20},{-12,20},{-12,12},{-26,12},{-28,12},{-26,20}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-8,14},{-8,24},{-6,24},{-6,14},{-8,14}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-8,30},{-6,26}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-8,36},{-6,32}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-8,42},{-6,38}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-8,48},{-6,44}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-4,14},{-4,26},{-2,26},{-2,14},{-4,14}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-4,32},{-2,28}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-4,38},{-2,34}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-4,44},{-2,40}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-4,50},{-2,46}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-2,20},{8,20},{8,22},{10,22},{18,22},{18,12},{-4,14},{-2,20}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-62,2},{-58,4},{-48,8},{-36,10},{-18,12},{6,12},{26,10},{42,6},{52,0},{42,4},{28,8},{6,10},{-12,10},{-18,10},{-38,8},{-50,6},{-62,2}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Line( + points={{22,12},{22,14},{22,16},{24,14},{20,18}}, + color={46,170,220}, + thickness=0.5), + Line( + points={{26,12},{26,14},{26,16},{28,14},{24,18}}, + color={46,170,220}, + thickness=0.5), + Line( + points={{30,10},{30,12},{30,14},{32,12},{28,16}}, + color={46,170,220}, + thickness=0.5), + Polygon( + points={{36,8},{36,30},{34,34},{36,38},{40,38},{40,8},{36,8}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Rectangle(extent={{-100,80},{80,-100}}, lineColor={0,0,255}), + Line( + points={{-100,80},{-80,100},{100,100},{100,-80},{80,-100}}, + color={0,0,255}, + smooth=Smooth.None), + Line( + points={{80,80},{100,100}}, + color={0,0,255}, + smooth=Smooth.None)})); +end HeatExchangers; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order new file mode 100644 index 00000000..e69de29b diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Interfaces/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/Interfaces/package.order new file mode 100644 index 00000000..e69de29b diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/package.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/package.mo new file mode 100644 index 00000000..92e0061d --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/package.mo @@ -0,0 +1,116 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples; +package Junctions + + annotation (Icon(graphics={ + Text( + extent={{-102,0},{24,-26}}, + lineColor={242,148,0}, + textString= + "Thermo"), + Text( + extent={{-4,8},{68,-34}}, + lineColor={46,170,220}, + textString= + "SysPro"), + Polygon( + points={{-62,2},{-58,4},{-48,8},{-32,12},{-16,14},{6,14},{26,12},{42,8},{52,2},{42,6},{28,10},{6,12},{-12,12},{-16,12},{-34,10},{-50,6},{-62,2}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-44,38},{-24,38},{-26,30},{-26,22},{-24,14},{-24,12},{-46,8},{-42,22},{-42,30},{-44,38}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-26,20},{-20,20},{-20,22},{-14,22},{-14,20},{-12,20},{-12,12},{-26,12},{-28,12},{-26,20}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-8,14},{-8,24},{-6,24},{-6,14},{-8,14}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-8,30},{-6,26}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-8,36},{-6,32}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-8,42},{-6,38}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-8,48},{-6,44}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-4,14},{-4,26},{-2,26},{-2,14},{-4,14}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-4,32},{-2,28}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-4,38},{-2,34}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-4,44},{-2,40}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-4,50},{-2,46}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-2,20},{8,20},{8,22},{10,22},{18,22},{18,12},{-4,14},{-2,20}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-62,2},{-58,4},{-48,8},{-36,10},{-18,12},{6,12},{26,10},{42,6},{52,0},{42,4},{28,8},{6,10},{-12,10},{-18,10},{-38,8},{-50,6},{-62,2}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Line( + points={{22,12},{22,14},{22,16},{24,14},{20,18}}, + color={46,170,220}, + thickness=0.5), + Line( + points={{26,12},{26,14},{26,16},{28,14},{24,18}}, + color={46,170,220}, + thickness=0.5), + Line( + points={{30,10},{30,12},{30,14},{32,12},{28,16}}, + color={46,170,220}, + thickness=0.5), + Polygon( + points={{36,8},{36,30},{34,34},{36,38},{40,38},{40,8},{36,8}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Rectangle(extent={{-100,80},{80,-100}}, lineColor={0,0,255}), + Line( + points={{-100,80},{-80,100},{100,100},{100,-80},{80,-100}}, + color={0,0,255}, + smooth=Smooth.None), + Line( + points={{80,80},{100,100}}, + color={0,0,255}, + smooth=Smooth.None)})); +end Junctions; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/package.order new file mode 100644 index 00000000..e69de29b diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/LoopBreakers/package.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/LoopBreakers/package.mo new file mode 100644 index 00000000..b905e02d --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/LoopBreakers/package.mo @@ -0,0 +1,116 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples; +package LoopBreakers + + annotation (Icon(graphics={ + Text( + extent={{-102,0},{24,-26}}, + lineColor={242,148,0}, + textString= + "Thermo"), + Text( + extent={{-4,8},{68,-34}}, + lineColor={46,170,220}, + textString= + "SysPro"), + Polygon( + points={{-62,2},{-58,4},{-48,8},{-32,12},{-16,14},{6,14},{26,12},{42,8},{52,2},{42,6},{28,10},{6,12},{-12,12},{-16,12},{-34,10},{-50,6},{-62,2}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-44,38},{-24,38},{-26,30},{-26,22},{-24,14},{-24,12},{-46,8},{-42,22},{-42,30},{-44,38}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-26,20},{-20,20},{-20,22},{-14,22},{-14,20},{-12,20},{-12,12},{-26,12},{-28,12},{-26,20}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-8,14},{-8,24},{-6,24},{-6,14},{-8,14}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-8,30},{-6,26}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-8,36},{-6,32}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-8,42},{-6,38}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-8,48},{-6,44}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-4,14},{-4,26},{-2,26},{-2,14},{-4,14}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-4,32},{-2,28}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-4,38},{-2,34}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-4,44},{-2,40}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-4,50},{-2,46}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-2,20},{8,20},{8,22},{10,22},{18,22},{18,12},{-4,14},{-2,20}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-62,2},{-58,4},{-48,8},{-36,10},{-18,12},{6,12},{26,10},{42,6},{52,0},{42,4},{28,8},{6,10},{-12,10},{-18,10},{-38,8},{-50,6},{-62,2}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Line( + points={{22,12},{22,14},{22,16},{24,14},{20,18}}, + color={46,170,220}, + thickness=0.5), + Line( + points={{26,12},{26,14},{26,16},{28,14},{24,18}}, + color={46,170,220}, + thickness=0.5), + Line( + points={{30,10},{30,12},{30,14},{32,12},{28,16}}, + color={46,170,220}, + thickness=0.5), + Polygon( + points={{36,8},{36,30},{34,34},{36,38},{40,38},{40,8},{36,8}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Rectangle(extent={{-100,80},{80,-100}}, lineColor={0,0,255}), + Line( + points={{-100,80},{-80,100},{100,100},{100,-80},{80,-100}}, + color={0,0,255}, + smooth=Smooth.None), + Line( + points={{80,80},{100,100}}, + color={0,0,255}, + smooth=Smooth.None)})); +end LoopBreakers; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/LoopBreakers/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/LoopBreakers/package.order new file mode 100644 index 00000000..e69de29b diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/package.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/package.mo new file mode 100644 index 00000000..5a53e2bf --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/package.mo @@ -0,0 +1,116 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples; +package Machines + + annotation (Icon(graphics={ + Text( + extent={{-102,0},{24,-26}}, + lineColor={242,148,0}, + textString= + "Thermo"), + Text( + extent={{-4,8},{68,-34}}, + lineColor={46,170,220}, + textString= + "SysPro"), + Polygon( + points={{-62,2},{-58,4},{-48,8},{-32,12},{-16,14},{6,14},{26,12},{42,8},{52,2},{42,6},{28,10},{6,12},{-12,12},{-16,12},{-34,10},{-50,6},{-62,2}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-44,38},{-24,38},{-26,30},{-26,22},{-24,14},{-24,12},{-46,8},{-42,22},{-42,30},{-44,38}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-26,20},{-20,20},{-20,22},{-14,22},{-14,20},{-12,20},{-12,12},{-26,12},{-28,12},{-26,20}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-8,14},{-8,24},{-6,24},{-6,14},{-8,14}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-8,30},{-6,26}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-8,36},{-6,32}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-8,42},{-6,38}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-8,48},{-6,44}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-4,14},{-4,26},{-2,26},{-2,14},{-4,14}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-4,32},{-2,28}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-4,38},{-2,34}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-4,44},{-2,40}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-4,50},{-2,46}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-2,20},{8,20},{8,22},{10,22},{18,22},{18,12},{-4,14},{-2,20}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-62,2},{-58,4},{-48,8},{-36,10},{-18,12},{6,12},{26,10},{42,6},{52,0},{42,4},{28,8},{6,10},{-12,10},{-18,10},{-38,8},{-50,6},{-62,2}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Line( + points={{22,12},{22,14},{22,16},{24,14},{20,18}}, + color={46,170,220}, + thickness=0.5), + Line( + points={{26,12},{26,14},{26,16},{28,14},{24,18}}, + color={46,170,220}, + thickness=0.5), + Line( + points={{30,10},{30,12},{30,14},{32,12},{28,16}}, + color={46,170,220}, + thickness=0.5), + Polygon( + points={{36,8},{36,30},{34,34},{36,38},{40,38},{40,8},{36,8}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Rectangle(extent={{-100,80},{80,-100}}, lineColor={0,0,255}), + Line( + points={{-100,80},{-80,100},{100,100},{100,-80},{80,-100}}, + color={0,0,255}, + smooth=Smooth.None), + Line( + points={{80,80},{100,100}}, + color={0,0,255}, + smooth=Smooth.None)})); +end Machines; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/package.order new file mode 100644 index 00000000..e69de29b diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.mo new file mode 100644 index 00000000..877bf752 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.mo @@ -0,0 +1,116 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples; +package PressureLosses + + annotation (Icon(graphics={ + Text( + extent={{-102,0},{24,-26}}, + lineColor={242,148,0}, + textString= + "Thermo"), + Text( + extent={{-4,8},{68,-34}}, + lineColor={46,170,220}, + textString= + "SysPro"), + Polygon( + points={{-62,2},{-58,4},{-48,8},{-32,12},{-16,14},{6,14},{26,12},{42,8},{52,2},{42,6},{28,10},{6,12},{-12,12},{-16,12},{-34,10},{-50,6},{-62,2}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-44,38},{-24,38},{-26,30},{-26,22},{-24,14},{-24,12},{-46,8},{-42,22},{-42,30},{-44,38}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-26,20},{-20,20},{-20,22},{-14,22},{-14,20},{-12,20},{-12,12},{-26,12},{-28,12},{-26,20}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-8,14},{-8,24},{-6,24},{-6,14},{-8,14}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-8,30},{-6,26}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-8,36},{-6,32}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-8,42},{-6,38}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-8,48},{-6,44}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-4,14},{-4,26},{-2,26},{-2,14},{-4,14}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-4,32},{-2,28}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-4,38},{-2,34}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-4,44},{-2,40}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-4,50},{-2,46}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-2,20},{8,20},{8,22},{10,22},{18,22},{18,12},{-4,14},{-2,20}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-62,2},{-58,4},{-48,8},{-36,10},{-18,12},{6,12},{26,10},{42,6},{52,0},{42,4},{28,8},{6,10},{-12,10},{-18,10},{-38,8},{-50,6},{-62,2}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Line( + points={{22,12},{22,14},{22,16},{24,14},{20,18}}, + color={46,170,220}, + thickness=0.5), + Line( + points={{26,12},{26,14},{26,16},{28,14},{24,18}}, + color={46,170,220}, + thickness=0.5), + Line( + points={{30,10},{30,12},{30,14},{32,12},{28,16}}, + color={46,170,220}, + thickness=0.5), + Polygon( + points={{36,8},{36,30},{34,34},{36,38},{40,38},{40,8},{36,8}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Rectangle(extent={{-100,80},{80,-100}}, lineColor={0,0,255}), + Line( + points={{-100,80},{-80,100},{100,100},{100,-80},{80,-100}}, + color={0,0,255}, + smooth=Smooth.None), + Line( + points={{80,80},{100,100}}, + color={0,0,255}, + smooth=Smooth.None)})); +end PressureLosses; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order new file mode 100644 index 00000000..e69de29b diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Sensors/package.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Sensors/package.mo new file mode 100644 index 00000000..1493b189 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Sensors/package.mo @@ -0,0 +1,116 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples; +package Sensors + + annotation (Icon(graphics={ + Text( + extent={{-102,0},{24,-26}}, + lineColor={242,148,0}, + textString= + "Thermo"), + Text( + extent={{-4,8},{68,-34}}, + lineColor={46,170,220}, + textString= + "SysPro"), + Polygon( + points={{-62,2},{-58,4},{-48,8},{-32,12},{-16,14},{6,14},{26,12},{42,8},{52,2},{42,6},{28,10},{6,12},{-12,12},{-16,12},{-34,10},{-50,6},{-62,2}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-44,38},{-24,38},{-26,30},{-26,22},{-24,14},{-24,12},{-46,8},{-42,22},{-42,30},{-44,38}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-26,20},{-20,20},{-20,22},{-14,22},{-14,20},{-12,20},{-12,12},{-26,12},{-28,12},{-26,20}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-8,14},{-8,24},{-6,24},{-6,14},{-8,14}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-8,30},{-6,26}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-8,36},{-6,32}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-8,42},{-6,38}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-8,48},{-6,44}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-4,14},{-4,26},{-2,26},{-2,14},{-4,14}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-4,32},{-2,28}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-4,38},{-2,34}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-4,44},{-2,40}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-4,50},{-2,46}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-2,20},{8,20},{8,22},{10,22},{18,22},{18,12},{-4,14},{-2,20}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-62,2},{-58,4},{-48,8},{-36,10},{-18,12},{6,12},{26,10},{42,6},{52,0},{42,4},{28,8},{6,10},{-12,10},{-18,10},{-38,8},{-50,6},{-62,2}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Line( + points={{22,12},{22,14},{22,16},{24,14},{20,18}}, + color={46,170,220}, + thickness=0.5), + Line( + points={{26,12},{26,14},{26,16},{28,14},{24,18}}, + color={46,170,220}, + thickness=0.5), + Line( + points={{30,10},{30,12},{30,14},{32,12},{28,16}}, + color={46,170,220}, + thickness=0.5), + Polygon( + points={{36,8},{36,30},{34,34},{36,38},{40,38},{40,8},{36,8}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Rectangle(extent={{-100,80},{80,-100}}, lineColor={0,0,255}), + Line( + points={{-100,80},{-80,100},{100,100},{100,-80},{80,-100}}, + color={0,0,255}, + smooth=Smooth.None), + Line( + points={{80,80},{100,100}}, + color={0,0,255}, + smooth=Smooth.None)})); +end Sensors; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Sensors/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/Sensors/package.order new file mode 100644 index 00000000..e69de29b diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.mo new file mode 100644 index 00000000..b6942729 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.mo @@ -0,0 +1,116 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples; +package Volumes + + annotation (Icon(graphics={ + Text( + extent={{-102,0},{24,-26}}, + lineColor={242,148,0}, + textString= + "Thermo"), + Text( + extent={{-4,8},{68,-34}}, + lineColor={46,170,220}, + textString= + "SysPro"), + Polygon( + points={{-62,2},{-58,4},{-48,8},{-32,12},{-16,14},{6,14},{26,12},{42,8},{52,2},{42,6},{28,10},{6,12},{-12,12},{-16,12},{-34,10},{-50,6},{-62,2}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-44,38},{-24,38},{-26,30},{-26,22},{-24,14},{-24,12},{-46,8},{-42,22},{-42,30},{-44,38}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-26,20},{-20,20},{-20,22},{-14,22},{-14,20},{-12,20},{-12,12},{-26,12},{-28,12},{-26,20}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-8,14},{-8,24},{-6,24},{-6,14},{-8,14}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-8,30},{-6,26}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-8,36},{-6,32}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-8,42},{-6,38}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-8,48},{-6,44}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-4,14},{-4,26},{-2,26},{-2,14},{-4,14}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-4,32},{-2,28}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-4,38},{-2,34}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-4,44},{-2,40}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-4,50},{-2,46}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-2,20},{8,20},{8,22},{10,22},{18,22},{18,12},{-4,14},{-2,20}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-62,2},{-58,4},{-48,8},{-36,10},{-18,12},{6,12},{26,10},{42,6},{52,0},{42,4},{28,8},{6,10},{-12,10},{-18,10},{-38,8},{-50,6},{-62,2}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Line( + points={{22,12},{22,14},{22,16},{24,14},{20,18}}, + color={46,170,220}, + thickness=0.5), + Line( + points={{26,12},{26,14},{26,16},{28,14},{24,18}}, + color={46,170,220}, + thickness=0.5), + Line( + points={{30,10},{30,12},{30,14},{32,12},{28,16}}, + color={46,170,220}, + thickness=0.5), + Polygon( + points={{36,8},{36,30},{34,34},{36,38},{40,38},{40,8},{36,8}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Rectangle(extent={{-100,80},{80,-100}}, lineColor={0,0,255}), + Line( + points={{-100,80},{-80,100},{100,100},{100,-80},{80,-100}}, + color={0,0,255}, + smooth=Smooth.None), + Line( + points={{80,80},{100,100}}, + color={0,0,255}, + smooth=Smooth.None)})); +end Volumes; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order new file mode 100644 index 00000000..e69de29b diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/package.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/package.mo index 1a2191ef..bb934deb 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/package.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/package.mo @@ -1,7 +1,6 @@ within ThermoSysPro.Fluid.Examples; package SimpleExamples - -annotation (Icon(graphics={ + annotation (Icon(graphics={ Text( extent={{-102,0},{24,-26}}, lineColor={242,148,0}, @@ -13,21 +12,17 @@ annotation (Icon(graphics={ textString= "SysPro"), Polygon( - points={{-62,2},{-58,4},{-48,8},{-32,12},{-16,14},{6,14},{26,12},{42,8}, - {52,2},{42,6},{28,10},{6,12},{-12,12},{-16,12},{-34,10},{-50,6},{ - -62,2}}, + points={{-62,2},{-58,4},{-48,8},{-32,12},{-16,14},{6,14},{26,12},{42,8},{52,2},{42,6},{28,10},{6,12},{-12,12},{-16,12},{-34,10},{-50,6},{-62,2}}, lineColor={46,170,220}, fillColor={46,170,220}, fillPattern=FillPattern.Solid), Polygon( - points={{-44,38},{-24,38},{-26,30},{-26,22},{-24,14},{-24,12},{-46,8},{ - -42,22},{-42,30},{-44,38}}, + points={{-44,38},{-24,38},{-26,30},{-26,22},{-24,14},{-24,12},{-46,8},{-42,22},{-42,30},{-44,38}}, lineColor={46,170,220}, fillColor={46,170,220}, fillPattern=FillPattern.Solid), Polygon( - points={{-26,20},{-20,20},{-20,22},{-14,22},{-14,20},{-12,20},{-12,12}, - {-26,12},{-28,12},{-26,20}}, + points={{-26,20},{-20,20},{-20,22},{-14,22},{-14,20},{-12,20},{-12,12},{-26,12},{-28,12},{-26,20}}, lineColor={46,170,220}, fillColor={46,170,220}, fillPattern=FillPattern.Solid), @@ -87,9 +82,7 @@ annotation (Icon(graphics={ fillColor={46,170,220}, fillPattern=FillPattern.Solid), Polygon( - points={{-62,2},{-58,4},{-48,8},{-36,10},{-18,12},{6,12},{26,10},{42,6}, - {52,0},{42,4},{28,8},{6,10},{-12,10},{-18,10},{-38,8},{-50,6},{-62, - 2}}, + points={{-62,2},{-58,4},{-48,8},{-36,10},{-18,12},{6,12},{26,10},{42,6},{52,0},{42,4},{28,8},{6,10},{-12,10},{-18,10},{-38,8},{-50,6},{-62,2}}, lineColor={242,148,0}, fillColor={242,148,0}, fillPattern=FillPattern.Solid), @@ -118,8 +111,5 @@ annotation (Icon(graphics={ Line( points={{80,80},{100,100}}, color={0,0,255}, - smooth=Smooth.None)}), Documentation(info=" -

Copyright © EDF 2002 - 2024

-

ThermoSysPro Version 4.1

-")); + smooth=Smooth.None)})); end SimpleExamples; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/package.order index e69de29b..37aecad4 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/package.order @@ -0,0 +1,11 @@ +Boilers +BoundaryConditions +Combustion +HeatExchangers +Junctions +LoopBreakers +Machines +PressureLosses +Sensors +Volumes +Examples From aeb77048209bd5ca4752c108e6f4422163289544 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Tue, 20 May 2025 17:21:15 +0200 Subject: [PATCH 003/178] #125 SubC name in connectors description --- .../SimpleExamples/Examples/package.mo | 116 ------------------ .../Examples/SimpleExamples/package.order | 1 - .../Fluid/Interfaces/Connectors/FluidInlet.mo | 4 +- .../Interfaces/Connectors/FluidOutlet.mo | 4 +- 4 files changed, 4 insertions(+), 121 deletions(-) delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Examples/package.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Examples/package.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Examples/package.mo deleted file mode 100644 index d4ba3cbb..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Examples/package.mo +++ /dev/null @@ -1,116 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples; -package Examples - - annotation (Icon(graphics={ - Text( - extent={{-102,0},{24,-26}}, - lineColor={242,148,0}, - textString= - "Thermo"), - Text( - extent={{-4,8},{68,-34}}, - lineColor={46,170,220}, - textString= - "SysPro"), - Polygon( - points={{-62,2},{-58,4},{-48,8},{-32,12},{-16,14},{6,14},{26,12},{42,8},{52,2},{42,6},{28,10},{6,12},{-12,12},{-16,12},{-34,10},{-50,6},{-62,2}}, - lineColor={46,170,220}, - fillColor={46,170,220}, - fillPattern=FillPattern.Solid), - Polygon( - points={{-44,38},{-24,38},{-26,30},{-26,22},{-24,14},{-24,12},{-46,8},{-42,22},{-42,30},{-44,38}}, - lineColor={46,170,220}, - fillColor={46,170,220}, - fillPattern=FillPattern.Solid), - Polygon( - points={{-26,20},{-20,20},{-20,22},{-14,22},{-14,20},{-12,20},{-12,12},{-26,12},{-28,12},{-26,20}}, - lineColor={46,170,220}, - fillColor={46,170,220}, - fillPattern=FillPattern.Solid), - Polygon( - points={{-8,14},{-8,24},{-6,24},{-6,14},{-8,14}}, - lineColor={46,170,220}, - fillColor={46,170,220}, - fillPattern=FillPattern.Solid), - Rectangle( - extent={{-8,30},{-6,26}}, - lineColor={242,148,0}, - fillColor={242,148,0}, - fillPattern=FillPattern.Solid), - Rectangle( - extent={{-8,36},{-6,32}}, - lineColor={242,148,0}, - fillColor={242,148,0}, - fillPattern=FillPattern.Solid), - Rectangle( - extent={{-8,42},{-6,38}}, - lineColor={242,148,0}, - fillColor={242,148,0}, - fillPattern=FillPattern.Solid), - Rectangle( - extent={{-8,48},{-6,44}}, - lineColor={242,148,0}, - fillColor={242,148,0}, - fillPattern=FillPattern.Solid), - Polygon( - points={{-4,14},{-4,26},{-2,26},{-2,14},{-4,14}}, - lineColor={46,170,220}, - fillColor={46,170,220}, - fillPattern=FillPattern.Solid), - Rectangle( - extent={{-4,32},{-2,28}}, - lineColor={242,148,0}, - fillColor={242,148,0}, - fillPattern=FillPattern.Solid), - Rectangle( - extent={{-4,38},{-2,34}}, - lineColor={242,148,0}, - fillColor={242,148,0}, - fillPattern=FillPattern.Solid), - Rectangle( - extent={{-4,44},{-2,40}}, - lineColor={242,148,0}, - fillColor={242,148,0}, - fillPattern=FillPattern.Solid), - Rectangle( - extent={{-4,50},{-2,46}}, - lineColor={242,148,0}, - fillColor={242,148,0}, - fillPattern=FillPattern.Solid), - Polygon( - points={{-2,20},{8,20},{8,22},{10,22},{18,22},{18,12},{-4,14},{-2,20}}, - lineColor={46,170,220}, - fillColor={46,170,220}, - fillPattern=FillPattern.Solid), - Polygon( - points={{-62,2},{-58,4},{-48,8},{-36,10},{-18,12},{6,12},{26,10},{42,6},{52,0},{42,4},{28,8},{6,10},{-12,10},{-18,10},{-38,8},{-50,6},{-62,2}}, - lineColor={242,148,0}, - fillColor={242,148,0}, - fillPattern=FillPattern.Solid), - Line( - points={{22,12},{22,14},{22,16},{24,14},{20,18}}, - color={46,170,220}, - thickness=0.5), - Line( - points={{26,12},{26,14},{26,16},{28,14},{24,18}}, - color={46,170,220}, - thickness=0.5), - Line( - points={{30,10},{30,12},{30,14},{32,12},{28,16}}, - color={46,170,220}, - thickness=0.5), - Polygon( - points={{36,8},{36,30},{34,34},{36,38},{40,38},{40,8},{36,8}}, - lineColor={46,170,220}, - fillColor={46,170,220}, - fillPattern=FillPattern.Solid), - Rectangle(extent={{-100,80},{80,-100}}, lineColor={0,0,255}), - Line( - points={{-100,80},{-80,100},{100,100},{100,-80},{80,-100}}, - color={0,0,255}, - smooth=Smooth.None), - Line( - points={{80,80},{100,100}}, - color={0,0,255}, - smooth=Smooth.None)})); -end Examples; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/package.order index 37aecad4..4d0be736 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/package.order @@ -8,4 +8,3 @@ Machines PressureLosses Sensors Volumes -Examples diff --git a/ThermoSysPro/Fluid/Interfaces/Connectors/FluidInlet.mo b/ThermoSysPro/Fluid/Interfaces/Connectors/FluidInlet.mo index f88c9d63..12cef6b9 100644 --- a/ThermoSysPro/Fluid/Interfaces/Connectors/FluidInlet.mo +++ b/ThermoSysPro/Fluid/Interfaces/Connectors/FluidInlet.mo @@ -1,7 +1,7 @@ within ThermoSysPro.Fluid.Interfaces.Connectors; connector FluidInlet "Fluid inlet connector" replaceable package Medium = - ThermoSysPro.Properties.Media.WaterSteam constrainedby Modelica.Media.Interfaces.PartialMedium + ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(group="Medium")); Units.SI.Pressure P(start=1.e5) "Fluid pressure in the control volume"; Units.SI.MassFlowRate Q(start=500) @@ -13,7 +13,7 @@ connector FluidInlet "Fluid inlet connector" Units.SI.SpecificEnthalpy h_vol_2(start=1.e5) "Fluid specific enthalpy in the control volume 2"; Medium.ExtraProperty SubC[Medium.nC] - "Properties c_i/m of the fluid crossing the boundary of the control volume"; + "Substances concentration (ppm) of the fluid crossing the boundary of the control volume"; Medium.MassFraction Xi[Medium.nXi] "Independent mixture mass fractions m_i/m of the fluid crossing the boundary of the control volume"; input Real diff_res_1(start=1e4) diff --git a/ThermoSysPro/Fluid/Interfaces/Connectors/FluidOutlet.mo b/ThermoSysPro/Fluid/Interfaces/Connectors/FluidOutlet.mo index 52c98b76..2f5dd7d3 100644 --- a/ThermoSysPro/Fluid/Interfaces/Connectors/FluidOutlet.mo +++ b/ThermoSysPro/Fluid/Interfaces/Connectors/FluidOutlet.mo @@ -1,7 +1,7 @@ within ThermoSysPro.Fluid.Interfaces.Connectors; connector FluidOutlet "Fluid outlet connector" replaceable package Medium = - ThermoSysPro.Properties.Media.WaterSteam constrainedby Modelica.Media.Interfaces.PartialMedium + ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(group="Medium")); Units.SI.Pressure P(start=1.e5) "Fluid pressure in the control volume"; Units.SI.MassFlowRate Q(start=500) @@ -13,7 +13,7 @@ connector FluidOutlet "Fluid outlet connector" Units.SI.SpecificEnthalpy h_vol_2(start=1.e5) "Fluid specific enthalpy in the control volume 2"; Medium.ExtraProperty SubC[Medium.nC] - "Properties c_i/m of the fluid crossing the boundary of the control volume"; + "Substances concentration (ppm) of the fluid crossing the boundary of the control volume"; Medium.MassFraction Xi[Medium.nXi] "Independent mixture mass fractions m_i/m of the fluid crossing the boundary of the control volume"; output Real diff_res_1(start=1e4) From 80e58c474f4b2c75e033cc606b86d74ac2050e94 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Wed, 21 May 2025 19:22:04 +0200 Subject: [PATCH 004/178] #125 Added h_offset to a FlueGases media --- .../Properties/Media/FlueGases/package.mo | 24 +++++++++++++++++++ .../Properties/Media/FlueGases/package.order | 1 + ThermoSysPro/Properties/Media/package.order | 1 + 3 files changed, 26 insertions(+) create mode 100644 ThermoSysPro/Properties/Media/FlueGases/package.mo create mode 100644 ThermoSysPro/Properties/Media/FlueGases/package.order diff --git a/ThermoSysPro/Properties/Media/FlueGases/package.mo b/ThermoSysPro/Properties/Media/FlueGases/package.mo new file mode 100644 index 00000000..98475975 --- /dev/null +++ b/ThermoSysPro/Properties/Media/FlueGases/package.mo @@ -0,0 +1,24 @@ +within ThermoSysPro.Properties.Media; +package FlueGases "Flue gases library inherited from Modelica.Media" + import Modelica.Media.Interfaces.Choices.ReferenceEnthalpy; + + extends PartialSubCMedium(nSubC=nC); + extends Modelica.Media.IdealGases.Common.MixtureGasNasa( + mediumName="MediaMonomeld", + data={Modelica.Media.IdealGases.Common.SingleGasesData.N2,Modelica.Media.IdealGases.Common.SingleGasesData.O2, + Modelica.Media.IdealGases.Common.SingleGasesData.H2O,Modelica.Media.IdealGases.Common.SingleGasesData.CO2, + Modelica.Media.IdealGases.Common.SingleGasesData.SO2}, + fluidConstants={Modelica.Media.IdealGases.Common.FluidData.N2,Modelica.Media.IdealGases.Common.FluidData.O2, + Modelica.Media.IdealGases.Common.FluidData.H2O,Modelica.Media.IdealGases.Common.FluidData.CO2, + Modelica.Media.IdealGases.Common.FluidData.SO2}, + substanceNames={"Nitrogen","Oxygen","Water","Carbondioxide","Sulfurdioxide"}, + reference_X={0.768,0.232,0.0,0.0,0.0}, + referenceChoice=ReferenceEnthalpy.UserDefined, + h_offset=hr); + + constant Units.SI.SpecificEnthalpy hr=2501569 "ThermoSysPro Water/steam reference specific enthalpy at 0.01°C"; + + annotation (Documentation(info=" + +")); +end FlueGases; diff --git a/ThermoSysPro/Properties/Media/FlueGases/package.order b/ThermoSysPro/Properties/Media/FlueGases/package.order new file mode 100644 index 00000000..fcb5e9c6 --- /dev/null +++ b/ThermoSysPro/Properties/Media/FlueGases/package.order @@ -0,0 +1 @@ +hr diff --git a/ThermoSysPro/Properties/Media/package.order b/ThermoSysPro/Properties/Media/package.order index e9f32b99..8d9e6275 100644 --- a/ThermoSysPro/Properties/Media/package.order +++ b/ThermoSysPro/Properties/Media/package.order @@ -2,3 +2,4 @@ PartialSubCMedium PartialThermoSysProMedium PartialTwoPhaseThermoSysProMedium WaterSteam +FlueGases From d6f15cbdc0edd7dec7f3542bc1add57876a1b03d Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Thu, 22 May 2025 11:32:05 +0200 Subject: [PATCH 005/178] #125 modification of h_offset to be equal to old FlueGases implementation --- ThermoSysPro/Properties/Media/FlueGases/package.mo | 3 ++- ThermoSysPro/Properties/Media/FlueGases/package.order | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ThermoSysPro/Properties/Media/FlueGases/package.mo b/ThermoSysPro/Properties/Media/FlueGases/package.mo index 98475975..11e4197f 100644 --- a/ThermoSysPro/Properties/Media/FlueGases/package.mo +++ b/ThermoSysPro/Properties/Media/FlueGases/package.mo @@ -14,9 +14,10 @@ package FlueGases "Flue gases library inherited from Modelica.Media" substanceNames={"Nitrogen","Oxygen","Water","Carbondioxide","Sulfurdioxide"}, reference_X={0.768,0.232,0.0,0.0,0.0}, referenceChoice=ReferenceEnthalpy.UserDefined, - h_offset=hr); + h_offset = hr - hr_FlueGases + Modelica.Media.IdealGases.Common.SingleGasesData.H2O.H0); constant Units.SI.SpecificEnthalpy hr=2501569 "ThermoSysPro Water/steam reference specific enthalpy at 0.01°C"; + constant Units.SI.SpecificEnthalpy hr_FlueGases=503298 "FlueGases reference specific enthalpy, computed from ThermoSysPro.Properties.ModelicaMediaFlueGases.specificEnthalpy(state0) at (0.006112 bars, 0.01°C)"; annotation (Documentation(info=" diff --git a/ThermoSysPro/Properties/Media/FlueGases/package.order b/ThermoSysPro/Properties/Media/FlueGases/package.order index fcb5e9c6..9965a189 100644 --- a/ThermoSysPro/Properties/Media/FlueGases/package.order +++ b/ThermoSysPro/Properties/Media/FlueGases/package.order @@ -1 +1,2 @@ hr +hr_FlueGases From 9a4c1d653616e81959222e5c9e9190a81e1f2e7c Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Thu, 22 May 2025 15:16:03 +0200 Subject: [PATCH 006/178] #125 SourcePQ PipePressureLoss and Sink with examples --- ThermoSysPro/Fluid/BoundaryConditions/Sink.mo | 50 +++--------- .../Fluid/BoundaryConditions/SourcePQ.mo | 79 +++++-------------- .../PressureLosses/TestPipePressureLoss.mo | 13 +++ .../TestPipePressureLoss_FlueGases.mo | 20 +++++ .../TestPipePressureLoss_Traces.mo | 14 ++++ .../PressureLosses/package.order | 3 + .../Fluid/Interfaces/Connectors/FluidInlet.mo | 2 +- .../Interfaces/Connectors/FluidOutlet.mo | 2 +- .../Fluid/PressureLosses/PipePressureLoss.mo | 29 +++---- ThermoSysPro/UsersGuide.mo | 24 ++++++ 10 files changed, 119 insertions(+), 117 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestPipePressureLoss.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestPipePressureLoss_FlueGases.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestPipePressureLoss_Traces.mo diff --git a/ThermoSysPro/Fluid/BoundaryConditions/Sink.mo b/ThermoSysPro/Fluid/BoundaryConditions/Sink.mo index dd6fc780..f2e804a2 100644 --- a/ThermoSysPro/Fluid/BoundaryConditions/Sink.mo +++ b/ThermoSysPro/Fluid/BoundaryConditions/Sink.mo @@ -1,43 +1,23 @@ within ThermoSysPro.Fluid.BoundaryConditions; model Sink "MultiFluids sink" - extends - ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidTypeVariableInterface; - extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - parameter Units.SI.Temperature T0=290 - "Source temperature (active if option_temperature=true)" - annotation (Evaluate=true, Dialog(enable=option_temperature)); - parameter Units.SI.SpecificEnthalpy h0=100000 - "Source specific enthalpy (active if option_temperature=false)" - annotation (Evaluate=true, Dialog(enable=not option_temperature)); - parameter Boolean option_temperature=false - "true:temperature fixed - false:specific enthalpy fixed"; - parameter Boolean diffusion=false - "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; - parameter IF97Region region=IF97Region.All_regions "IF97 regions (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); + extends ThermoSysPro.Fluid.Interfaces.IconColors; -protected - parameter Integer mode=Integer(region) - 1 "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + parameter Units.SI.Temperature T0=290 "Source temperature (active if option_temperature=true)" annotation (Evaluate=true, Dialog(enable=option_temperature)); + parameter Units.SI.SpecificEnthalpy h0=100000 "Source specific enthalpy (active if option_temperature=false)" annotation (Evaluate=true, Dialog(enable=not option_temperature)); + parameter Boolean option_temperature=false "true:temperature fixed - false:specific enthalpy fixed"; + parameter Boolean diffusion=false "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; public Units.SI.MassFlowRate Q "Fluid mass flow rate"; Units.SI.AbsolutePressure P "Fluid pressure"; Units.SI.SpecificEnthalpy h "Fluid specific enthalpy"; Units.SI.Temperature T "Fluid temperature"; - FluidType ftype "Fluid type"; - Integer fluid=Integer(ftype) "Fluid number"; - Real Xco2(start=0.01) - "CO2 mass fraction of the fluid crossing the boundary of the control volume"; - Real Xh2o - "H2O mass fraction of the fluid crossing the boundary of the control volume"; - Real Xo2(start=0.2) - "O2 mass fraction of the fluid crossing the boundary of the control volume"; - Real Xso2(start=0) - "SO2 mass fraction of the fluid crossing the boundary of the control volume"; + Medium.ExtraProperty SubC[Medium.nC](quantity=Medium.extraPropertiesNames, start=Medium.C_default) "Trace substances"; + Medium.MassFraction X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Mass fraction of the fluid crossing the boundary of the control volume"; - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-110,-10},{-90,10}}, rotation=0))); InstrumentationAndControl.Connectors.InputReal ISpecificEnthalpyOrTemperature "Fixed specific enthalpy or temperature according to option_temperature" @@ -54,12 +34,8 @@ equation C.diff_res_2 = 0; C.diff_on_2 = diffusion; - ftype = C.ftype; - - Xco2 = C.Xco2; - Xh2o = C.Xh2o; - Xo2 = C.Xo2; - Xso2 = C.Xso2; + X = C.Xi; + SubC = C.SubC; /* Specific enthalpy or temperature */ if (cardinality(ISpecificEnthalpyOrTemperature) == 0) then @@ -72,10 +48,10 @@ equation if option_temperature then T = ISpecificEnthalpyOrTemperature.signal; - h = ThermoSysPro.Properties.Fluid.SpecificEnthalpy_PT(P, T, fluid, mode, Xco2, Xh2o, Xo2, Xso2); + h = Medium.specificEnthalpy_pTX(p=P, T=T, X=X); else h = ISpecificEnthalpyOrTemperature.signal; - T = ThermoSysPro.Properties.Fluid.Temperature_Ph(P, h, fluid, mode, Xco2, Xh2o, Xo2, Xso2); + T = Medium.temperature_phX(p=P, h=h, X=X); end if; annotation ( diff --git a/ThermoSysPro/Fluid/BoundaryConditions/SourcePQ.mo b/ThermoSysPro/Fluid/BoundaryConditions/SourcePQ.mo index 40e3e63b..29d16491 100644 --- a/ThermoSysPro/Fluid/BoundaryConditions/SourcePQ.mo +++ b/ThermoSysPro/Fluid/BoundaryConditions/SourcePQ.mo @@ -1,53 +1,22 @@ within ThermoSysPro.Fluid.BoundaryConditions; model SourcePQ "MultiFluids source with fixed pressure and mass flow rate" - extends - ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidTypeParameterInterface; + extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; - - parameter Units.SI.AbsolutePressure P0=300000 - "Fluid pressure (active if IPressure connector is not connected)"; - parameter Units.SI.MassFlowRate Q0=100 - "Mass flow (active if IMassFlow connector is not connected)"; - parameter Units.SI.Temperature T0=290 - "Source temperature (active if option_temperature=true)" - annotation (Evaluate=true, Dialog(enable=option_temperature)); - parameter Units.SI.SpecificEnthalpy h0=100000 - "Source specific enthalpy (active if option_temperature=false)" - annotation (Evaluate=true, Dialog(enable=not option_temperature)); - parameter Boolean option_temperature=false - "true:temperature fixed - false:specific enthalpy fixed"; - parameter Boolean continuous_flow_reversal=false - "true: continuous flow reversal - false: discontinuous flow reversal"; - parameter Boolean diffusion=false - "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; - parameter IF97Region region=IF97Region.All_regions "IF97 regions (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); - - parameter ThermoSysPro.Units.SI.MassFraction Xco2= 0.01 "CO2 mass fraction" - annotation (Evaluate=true, Dialog( - enable=(ftype == FluidType.FlueGases), - tab="Fluid", - group="Composition values (active for flue gases only)")); - parameter ThermoSysPro.Units.SI.MassFraction Xh2o=if ftype == FluidType.FlueGases then 0.05 else 0 "H2O mass fraction" - annotation (Evaluate=true, Dialog( - enable=(ftype == FluidType.FlueGases), - tab="Fluid", - group="Composition values (active for flue gases only)")); - parameter ThermoSysPro.Units.SI.MassFraction Xo2= 0.22 "O2 mass fraction" - annotation (Evaluate=true, Dialog( - enable=(ftype == FluidType.FlueGases), + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + parameter Units.SI.AbsolutePressure P0=300000 "Fluid pressure (active if IPressure connector is not connected)"; + parameter Units.SI.MassFlowRate Q0=100 "Mass flow (active if IMassFlow connector is not connected)"; + parameter Units.SI.Temperature T0=290 "Source temperature (active if option_temperature=true)" annotation (Evaluate=true, Dialog(enable=option_temperature)); + parameter Units.SI.SpecificEnthalpy h0=100000 "Source specific enthalpy (active if option_temperature=false)" annotation (Evaluate=true, Dialog(enable=not option_temperature)); + parameter Medium.ExtraProperty SubC0[Medium.nC](quantity=Medium.extraPropertiesNames) = fill(0,Medium.nC) "Source trace substances" annotation (Evaluate=true, Dialog( tab="Fluid", - group="Composition values (active for flue gases only)")); - parameter ThermoSysPro.Units.SI.MassFraction Xso2= 0 "SO2 mass fraction" - annotation (Evaluate=true, Dialog( - enable=(ftype == FluidType.FlueGases), + group="Medium")); + parameter Medium.ExtraProperty X0[Medium.nX]= Medium.X_default "Source mass fraction" annotation (Dialog( tab="Fluid", - group="Composition values (active for flue gases only)")); - -protected - parameter Boolean flue_gases=(ftype == FluidType.FlueGases) "Flue gases"; - parameter Integer mode=Integer(region) - 1 "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; + group="Medium")); + parameter Boolean option_temperature=false "true:temperature fixed - false:specific enthalpy fixed"; + parameter Boolean continuous_flow_reversal=false "true: continuous flow reversal - false: discontinuous flow reversal"; + parameter Boolean diffusion=false "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; public Units.SI.MassFlowRate Q "Fluid mass flow rate"; @@ -72,7 +41,7 @@ public origin={0,-50}, extent={{10,-10},{-10,10}}, rotation=270))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{90,-10},{110,10}}, rotation=0))); equation @@ -83,19 +52,9 @@ equation C.diff_res_1 = 0; C.diff_on_1 = diffusion; - ftype = C.ftype; + C.SubC=SubC0; - if flue_gases then - C.Xco2 = Xco2; - C.Xh2o = Xh2o; - C.Xo2 = Xo2; - C.Xso2 = Xso2; - else - C.Xco2 = 0; - C.Xh2o = 0; - C.Xo2 = 0; - C.Xso2 = 0; - end if; + C.Xi = X0[1:Medium.nXi]; /* Mass flow */ if (cardinality(IMassFlow) == 0) then @@ -122,10 +81,10 @@ equation if option_temperature then T = ISpecificEnthalpyOrTemperature.signal; - h = ThermoSysPro.Properties.Fluid.SpecificEnthalpy_PT(P, T, fluid, mode, Xco2, Xh2o, Xo2, Xso2); + h = Medium.specificEnthalpy_pTX(p=P, T=T, X=X0); else h = ISpecificEnthalpyOrTemperature.signal; - T = ThermoSysPro.Properties.Fluid.Temperature_Ph(P, h, fluid, mode, Xco2, Xh2o, Xo2, Xso2); + T = Medium.temperature_phX(p=P, h=h, X=X0); end if; /* Flow reversal */ diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestPipePressureLoss.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestPipePressureLoss.mo new file mode 100644 index 00000000..59b00b69 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestPipePressureLoss.mo @@ -0,0 +1,13 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.PressureLosses; +model TestPipePressureLoss + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam; + ThermoSysPro.Fluid.PressureLosses.PipePressureLoss pipePressureLoss(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); +equation + connect(pipePressureLoss.C2, sink.C) annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(pipePressureLoss.C1, sourcePQ.C) annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestPipePressureLoss; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestPipePressureLoss_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestPipePressureLoss_FlueGases.mo new file mode 100644 index 00000000..728fb69a --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestPipePressureLoss_FlueGases.mo @@ -0,0 +1,20 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.PressureLosses; +model TestPipePressureLoss_FlueGases + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.FlueGases; + ThermoSysPro.Fluid.PressureLosses.PipePressureLoss pipePressureLoss(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink( + redeclare replaceable package Medium = Medium, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ( + redeclare replaceable package Medium = Medium, + P0=4500000, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); +equation + connect(pipePressureLoss.C2, sink.C) annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(pipePressureLoss.C1, sourcePQ.C) annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestPipePressureLoss_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestPipePressureLoss_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestPipePressureLoss_Traces.mo new file mode 100644 index 00000000..baebf5cd --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestPipePressureLoss_Traces.mo @@ -0,0 +1,14 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.PressureLosses; +model TestPipePressureLoss_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam (extraPropertiesNames={"Trace"}, C_nominal={0.1}, C_default={0.2}); + ThermoSysPro.Fluid.PressureLosses.PipePressureLoss pipePressureLoss(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare replaceable package Medium = Medium, SubC0={0.3}) + annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); +equation + connect(pipePressureLoss.C2, sink.C) annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(pipePressureLoss.C1, sourcePQ.C) annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestPipePressureLoss_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order index e69de29b..eb3436e6 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order @@ -0,0 +1,3 @@ +TestPipePressureLoss +TestPipePressureLoss_FlueGases +TestPipePressureLoss_Traces diff --git a/ThermoSysPro/Fluid/Interfaces/Connectors/FluidInlet.mo b/ThermoSysPro/Fluid/Interfaces/Connectors/FluidInlet.mo index 12cef6b9..cf97ea60 100644 --- a/ThermoSysPro/Fluid/Interfaces/Connectors/FluidInlet.mo +++ b/ThermoSysPro/Fluid/Interfaces/Connectors/FluidInlet.mo @@ -2,7 +2,7 @@ within ThermoSysPro.Fluid.Interfaces.Connectors; connector FluidInlet "Fluid inlet connector" replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium - "Medium model" annotation (choicesAllMatching=true, Dialog(group="Medium")); + "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid",group="Medium")); Units.SI.Pressure P(start=1.e5) "Fluid pressure in the control volume"; Units.SI.MassFlowRate Q(start=500) "Mass flow rate of the fluid crossing the boundary of the control volume"; diff --git a/ThermoSysPro/Fluid/Interfaces/Connectors/FluidOutlet.mo b/ThermoSysPro/Fluid/Interfaces/Connectors/FluidOutlet.mo index 2f5dd7d3..913ee8dd 100644 --- a/ThermoSysPro/Fluid/Interfaces/Connectors/FluidOutlet.mo +++ b/ThermoSysPro/Fluid/Interfaces/Connectors/FluidOutlet.mo @@ -2,7 +2,7 @@ within ThermoSysPro.Fluid.Interfaces.Connectors; connector FluidOutlet "Fluid outlet connector" replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium - "Medium model" annotation (choicesAllMatching=true, Dialog(group="Medium")); + "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid",group="Medium")); Units.SI.Pressure P(start=1.e5) "Fluid pressure in the control volume"; Units.SI.MassFlowRate Q(start=500) "Mass flow rate of the fluid crossing the boundary of the control volume"; diff --git a/ThermoSysPro/Fluid/PressureLosses/PipePressureLoss.mo b/ThermoSysPro/Fluid/PressureLosses/PipePressureLoss.mo index 6623b609..c9d337fd 100644 --- a/ThermoSysPro/Fluid/PressureLosses/PipePressureLoss.mo +++ b/ThermoSysPro/Fluid/PressureLosses/PipePressureLoss.mo @@ -1,8 +1,9 @@ within ThermoSysPro.Fluid.PressureLosses; model PipePressureLoss "Pipe generic pressure loss" - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + extends ThermoSysPro.Fluid.Interfaces.IconColors; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Real K=10 "Friction pressure loss coefficient"; parameter Units.SI.Position z1=0 "Inlet altitude"; parameter Units.SI.Position z2=0 "Outlet altitude"; @@ -10,11 +11,8 @@ model PipePressureLoss "Pipe generic pressure loss" "Diffusion conductance (active if diffusion=true in neighbouring volumes)"; parameter Units.SI.Density p_rho=0 "If > 0, fixed fluid density" annotation (Evaluate=true, Dialog(tab="Fluid", group="Fluid properties")); - parameter IF97Region region=IF97Region.All_regions "IF97 region (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); - protected constant Units.SI.Acceleration g=Modelica.Constants.g_n "Gravity constant"; - parameter Integer mode=Integer(region) - 1 "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; parameter Real eps=1.e-3 "Small number for pressure loss equation"; public @@ -26,13 +24,12 @@ public Units.SI.Temperature T(start=290) "Fluid temperature"; Units.SI.AbsolutePressure Pm(start=1.e5) "Average fluid pressure"; Units.SI.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy"; - FluidType ftype "Fluid type"; - Integer fluid=Integer(ftype) "Fluid number"; + Medium.MassFraction X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Mass fractions"; public - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-110,-10},{-90,10}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{90,-10},{110,10}}, rotation=0))); equation @@ -48,19 +45,15 @@ equation C2.diff_res_1 = C1.diff_res_1 + (if (gamma_diff > 0) then 1/gamma_diff else 0); C1.diff_res_2 = C2.diff_res_2 + (if (gamma_diff > 0) then 1/gamma_diff else 0); - C1.ftype = C2.ftype; + C1.Xi = C2.Xi; - C1.Xco2 = C2.Xco2; - C1.Xh2o = C2.Xh2o; - C1.Xo2 = C2.Xo2; - C1.Xso2 = C2.Xso2; + C1.SubC = C2.SubC; Q = C1.Q; h = C1.h; + X = C1.Xi; deltaP = C1.P - C2.P; - ftype = C1.ftype; - /* Pressure loss */ deltaPf = K*ThermoSysPro.Functions.ThermoSquare(Q, eps)/rho; deltaPg = rho*g*(z2 - z1); @@ -69,12 +62,12 @@ equation /* Fluid thermodynamic properties */ Pm = (C1.P + C2.P)/2; - T = ThermoSysPro.Properties.Fluid.Temperature_Ph(Pm, h, fluid, mode, C1.Xco2, C1.Xh2o, C1.Xo2, C1.Xso2); + T = Medium.temperature_phX(p=Pm, h=h, X=X); if (p_rho > 0) then rho = p_rho; else - rho = ThermoSysPro.Properties.Fluid.Density_Ph(Pm, h, fluid, mode, C1.Xco2, C1.Xh2o, C1.Xo2, C1.Xso2); + rho = Medium.density_phX(p=Pm, h=h, X=X); end if; annotation ( diff --git a/ThermoSysPro/UsersGuide.mo b/ThermoSysPro/UsersGuide.mo index 304dda34..380d583d 100644 --- a/ThermoSysPro/UsersGuide.mo +++ b/ThermoSysPro/UsersGuide.mo @@ -1268,6 +1268,30 @@ action. This section shall survive the termination of this License.

extent={{-12.5,-12.5},{12.5,12.5}})})); end ThermoSysProDocumentation; + + package Icons + + partial model Example + annotation (Icon(coordinateSystem(preserveAspectRatio=false), graphics={ + Rectangle( + lineColor={200,200,200}, + fillColor={248,248,248}, + fillPattern=FillPattern.HorizontalCylinder, + extent={{-100,-100},{100,100}}, + radius=25.0), + Rectangle( + lineColor={128,128,128}, + extent={{-100,-100},{100,100}}, + radius=25.0), + Polygon( + origin={8,14}, + lineColor={78,138,73}, + fillColor={78,138,73}, + pattern=LinePattern.None, + fillPattern=FillPattern.Solid, + points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), Diagram(coordinateSystem(preserveAspectRatio=false))); + end Example; + end Icons; annotation (DocumentationClass=true, Documentation(info="

Users Guide of the ThermoSysPro Library

ThermoSysPro is a library for the modelling and simulation of power plants and energy systems. It is developed with the Modelica language from the Modelica Association. It provides components in various disciplines related to the modelling of power plants and energy systems.

From a58f96fd055b013aa2d912cb5784653e64f0fd2a Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Thu, 22 May 2025 16:39:19 +0200 Subject: [PATCH 007/178] #125 SourceQ and VolumeC --- .../Fluid/BoundaryConditions/SourceQ.mo | 63 ++----- .../PressureLosses/TestVolumeC.mo | 15 ++ .../PressureLosses/TestVolumeC_FlueGases.mo | 25 +++ .../PressureLosses/TestVolumeC_Traces.mo | 17 ++ .../PressureLosses/package.order | 3 + ThermoSysPro/Fluid/Volumes/VolumeC.mo | 176 ++++++------------ 6 files changed, 130 insertions(+), 169 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestVolumeC.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestVolumeC_FlueGases.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestVolumeC_Traces.mo diff --git a/ThermoSysPro/Fluid/BoundaryConditions/SourceQ.mo b/ThermoSysPro/Fluid/BoundaryConditions/SourceQ.mo index 1443d760..6ef3492e 100644 --- a/ThermoSysPro/Fluid/BoundaryConditions/SourceQ.mo +++ b/ThermoSysPro/Fluid/BoundaryConditions/SourceQ.mo @@ -1,11 +1,9 @@ within ThermoSysPro.Fluid.BoundaryConditions; model SourceQ "Multi-fluid source with fixed mass flow rate" - extends - ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidTypeParameterInterface; + extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Units.SI.MassFlowRate Q0=100 "Mass flow (active if IMassFlow connector is not connected)"; parameter Units.SI.Temperature T0=290 @@ -20,32 +18,12 @@ model SourceQ "Multi-fluid source with fixed mass flow rate" "true: continuous flow reversal - false: discontinuous flow reversal"; parameter Boolean diffusion=false "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; - parameter IF97Region region=IF97Region.All_regions "IF97 regions (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); - - parameter ThermoSysPro.Units.SI.MassFraction Xco2= 0.01 "CO2 mass fraction" - annotation (Evaluate=true, Dialog( - enable=(ftype == FluidType.FlueGases), - tab="Fluid", - group="Composition values (active for flue gases only)")); - parameter ThermoSysPro.Units.SI.MassFraction Xh2o=if ftype == FluidType.FlueGases then 0.05 else 0 "H2O mass fraction" - annotation (Evaluate=true, Dialog( - enable=(ftype == FluidType.FlueGases), - tab="Fluid", - group="Composition values (active for flue gases only)")); - parameter ThermoSysPro.Units.SI.MassFraction Xo2= 0.22 "O2 mass fraction" - annotation (Evaluate=true, Dialog( - enable=(ftype == FluidType.FlueGases), + parameter Medium.ExtraProperty SubC0[Medium.nC](quantity=Medium.extraPropertiesNames) = fill(0,Medium.nC) "Source trace substances" annotation (Evaluate=true, Dialog( tab="Fluid", - group="Composition values (active for flue gases only)")); - parameter ThermoSysPro.Units.SI.MassFraction Xso2= 0 "SO2 mass fraction" - annotation (Evaluate=true, Dialog( - enable=(ftype == FluidType.FlueGases), + group="Medium")); + parameter Medium.ExtraProperty X0[Medium.nX]= Medium.X_default "Source mass fraction" annotation (Dialog( tab="Fluid", - group="Composition values (active for flue gases only)")); - -protected - parameter Boolean flue_gases=(ftype == FluidType.FlueGases) "Flue gases"; - parameter Integer mode=Integer(region) - 1 "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; + group="Medium")); public Units.SI.MassFlowRate Q "Fluid mass flow rate"; @@ -54,17 +32,12 @@ public Units.SI.Temperature T(start=300) "Fluid temperature"; public - ThermoSysPro.InstrumentationAndControl.Connectors.InputReal IMassFlow - "Fixed mass flow rate" - annotation (Placement(transformation( + ThermoSysPro.InstrumentationAndControl.Connectors.InputReal IMassFlow "Fixed mass flow rate" annotation (Placement(transformation( origin={0,50}, extent={{-10,-10},{10,10}}, rotation=270))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C annotation (Placement( - transformation(extent={{90,-10},{110,10}}, rotation=0))); - InstrumentationAndControl.Connectors.InputReal ISpecificEnthalpyOrTemperature - "Fixed specific enthalpy or temperature according to option_temperature" - annotation (Placement(transformation( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{90,-10},{110,10}}, rotation=0))); + InstrumentationAndControl.Connectors.InputReal ISpecificEnthalpyOrTemperature "Fixed specific enthalpy or temperature according to option_temperature" annotation (Placement(transformation( origin={0,-50}, extent={{10,-10},{-10,10}}, rotation=270))); @@ -77,19 +50,9 @@ equation C.diff_res_1 = 0; C.diff_on_1 = diffusion; - ftype = C.ftype; + C.SubC=SubC0; - if flue_gases then - C.Xco2 = Xco2; - C.Xh2o = Xh2o; - C.Xo2 = Xo2; - C.Xso2 = Xso2; - else - C.Xco2 = 0; - C.Xh2o = 0; - C.Xo2 = 0; - C.Xso2 = 0; - end if; + C.Xi = X0[1:Medium.nXi]; /* Mass flow rate */ if (cardinality(IMassFlow) == 0) then @@ -109,10 +72,10 @@ equation if option_temperature then T = ISpecificEnthalpyOrTemperature.signal; - h = ThermoSysPro.Properties.Fluid.SpecificEnthalpy_PT(P, T, fluid, mode, Xco2, Xh2o, Xo2, Xso2); + h = Medium.specificEnthalpy_pTX(p=P, T=T, X=X0); else h = ISpecificEnthalpyOrTemperature.signal; - T = ThermoSysPro.Properties.Fluid.Temperature_Ph(P, h, fluid, mode, Xco2, Xh2o, Xo2, Xso2); + T = Medium.temperature_phX(p=P, h=h, X=X0); end if; /* Flow reversal */ diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestVolumeC.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestVolumeC.mo new file mode 100644 index 00000000..32a60055 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestVolumeC.mo @@ -0,0 +1,15 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.PressureLosses; +model TestVolumeC + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam; + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.Fluid.Volumes.VolumeC volumeC(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-50,20},{-30,40}}))); +equation + connect(sourcePQ.C, volumeC.Ce1) annotation (Line(points={{-30,0},{-10,0}}, color={0,0,0})); + connect(sink.C, volumeC.Cs) annotation (Line(points={{30,0},{10,0}}, color={0,0,0})); + connect(volumeC.Ce2, sourceQ.C) annotation (Line(points={{0,10},{0,30},{-30,30}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestVolumeC; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestVolumeC_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestVolumeC_FlueGases.mo new file mode 100644 index 00000000..1b40a056 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestVolumeC_FlueGases.mo @@ -0,0 +1,25 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.PressureLosses; +model TestVolumeC_FlueGases + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.FlueGases; + ThermoSysPro.Fluid.BoundaryConditions.Sink sink( + redeclare replaceable package Medium = Medium, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ( + redeclare replaceable package Medium = Medium, + P0=4500000, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.Fluid.Volumes.VolumeC volumeC(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ( + redeclare replaceable package Medium = Medium, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{-50,20},{-30,40}}))); +equation + connect(sourcePQ.C, volumeC.Ce1) annotation (Line(points={{-30,0},{-10,0}}, color={0,0,0})); + connect(sink.C, volumeC.Cs) annotation (Line(points={{30,0},{10,0}}, color={0,0,0})); + connect(volumeC.Ce2, sourceQ.C) annotation (Line(points={{0,10},{0,30},{-30,30}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestVolumeC_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestVolumeC_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestVolumeC_Traces.mo new file mode 100644 index 00000000..c455a404 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestVolumeC_Traces.mo @@ -0,0 +1,17 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.PressureLosses; +model TestVolumeC_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam(extraPropertiesNames={"Trace"}, C_nominal={0.1}, C_default={0.2}); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare replaceable package Medium = Medium, SubC0={0.2}) + annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.Fluid.Volumes.VolumeC volumeC(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare replaceable package Medium = Medium, SubC0={0.1}) + annotation (Placement(transformation(extent={{-50,20},{-30,40}}))); +equation + connect(sourcePQ.C, volumeC.Ce1) annotation (Line(points={{-30,0},{-10,0}}, color={0,0,0})); + connect(sink.C, volumeC.Cs) annotation (Line(points={{30,0},{10,0}}, color={0,0,0})); + connect(volumeC.Ce2, sourceQ.C) annotation (Line(points={{0,10},{0,30},{-30,30}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestVolumeC_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order index eb3436e6..52916924 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order @@ -1,3 +1,6 @@ TestPipePressureLoss TestPipePressureLoss_FlueGases TestPipePressureLoss_Traces +TestVolumeC +TestVolumeC_FlueGases +TestVolumeC_Traces diff --git a/ThermoSysPro/Fluid/Volumes/VolumeC.mo b/ThermoSysPro/Fluid/Volumes/VolumeC.mo index 8f999f96..c67202f8 100644 --- a/ThermoSysPro/Fluid/Volumes/VolumeC.mo +++ b/ThermoSysPro/Fluid/Volumes/VolumeC.mo @@ -1,11 +1,10 @@ -within ThermoSysPro.Fluid.Volumes; +within ThermoSysPro.Fluid.Volumes; model VolumeC "Mixing volume with 3 inlets and 1 outlet" - extends - ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidTypeParameterInterface; + extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable function SaS = Medium.noSaS (SubC=SubC) annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Boolean dynamic_energy_balance=true "true: dynamic energy balance equation - false: static energy balance equation"; parameter Units.SI.Volume V=1 @@ -29,42 +28,17 @@ model VolumeC "Mixing volume with 3 inlets and 1 outlet" "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; parameter Units.SI.Density p_rho=0 "If > 0, fixed fluid density" annotation (Evaluate=true, Dialog(tab="Fluid", group="Fluid properties")); - parameter IF97Region region=IF97Region.All_regions "IF97 region (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); parameter Boolean dynamic_composition_balance=false - "true: dynamic fluid composition balance equation
false: static fluid composition balance equation (active for flue gases)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.FlueGases), tab="Fluid", group="Fluid properties")); - - parameter ThermoSysPro.Units.SI.MassFraction Xco20=0.0 - "Initial CO2 mass fraction" annotation (Evaluate=true, Dialog( - enable=dynamic_composition_balance, - tab="Fluid", - group= - "Initial composition values (active for flue gases only if dynamic_composition_balance=true)")); - parameter ThermoSysPro.Units.SI.MassFraction Xh2o0=if ftype == FluidType.FlueGases then 0.05 else 0 - "Initial H20 mass fraction" annotation (Evaluate=true, Dialog( - enable=dynamic_composition_balance, - tab="Fluid", - group= - "Initial composition values (active for flue gases only if dynamic_composition_balance=true)")); - parameter ThermoSysPro.Units.SI.MassFraction Xo20=0.23 - "Initial O2 mass fraction" annotation (Evaluate=true, Dialog( + "true: dynamic fluid composition balance equation
false: static fluid composition balance equation (active for flue gases)" annotation(Evaluate=true, Dialog(tab="Fluid", group="Fluid properties")); + parameter Medium.ExtraProperty X0[Medium.nX]=Medium.X_default "Initial composition values" annotation (Evaluate=true, Dialog( enable=dynamic_composition_balance, tab="Fluid", - group= - "Initial composition values (active for flue gases only if dynamic_composition_balance=true)")); - parameter ThermoSysPro.Units.SI.MassFraction Xso20=0 - "Initial SO2 mass fraction" annotation (Evaluate=true, Dialog( - enable=dynamic_composition_balance, - tab="Fluid", - group= - "Initial composition values (active for flue gases only if dynamic_composition_balance=true)")); + group="Medium")); protected - constant Units.SI.SpecificEnthalpy hr=2501569 - "Water/steam reference specific enthalpy at 0.01°C"; - parameter Boolean flue_gases=(ftype == FluidType.FlueGases) "Flue gases"; + constant Boolean isCompressible = Medium.isCompressible; parameter Units.SI.MassFlowRate gamma0=1.e-4 "Pseudo-diffusion conductance use for continuous flow reversal (active if diffusion=false and continuous_flow_reversal = true)"; - parameter Integer mode=Integer(region) - 1 "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; public Units.SI.Temperature T "Fluid temperature"; @@ -77,15 +51,12 @@ public "density derivative wrt pressure at constant specific enthalpy"; Units.SI.DerDensityByEnthalpy ddhp "density derivative wrt specific enthalpy at constant pressure"; - FluidType fluids[5] "Fluids mixing in volume"; - Units.SI.MassFlowRate BXco2 "Right hand side of the CO2 balance equation"; - Units.SI.MassFlowRate BXh2o "Right hand side of the H2O balance equation"; - Units.SI.MassFlowRate BXo2 "Right hand side of the O2 balance equation"; - Units.SI.MassFlowRate BXso2 "Right hand side of the SO2 balance equation"; - ThermoSysPro.Units.SI.MassFraction Xco2 "CO2 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xh2o "H20 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xo2 "O2 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xso2 "SO2 mass fraction"; + Units.SI.MassFlowRate BX[Medium.nXi] "Right hand side of the X balance equation"; + Medium.ExtraProperty X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Boundary trace substances"; + Medium.ExtraProperty BSubC[Medium.nC](quantity=Medium.extraPropertiesNames) "Right hand side of the trace balance equation"; + Medium.ExtraProperty SubC[Medium.nC](quantity=Medium.extraPropertiesNames, start=Medium.C_default) "Boundary trace substances"; + Medium.ExtraProperty SubCSaS[Medium.nC](quantity=Medium.extraPropertiesNames) "Trace modification in the trace balance equation"; + Medium.ThermodynamicState state; Units.SI.Power Je1 "Thermal power diffusion from inlet e1"; Units.SI.Power Je2 "Thermal power diffusion from inlet e2"; Units.SI.Power Je3 "Thermal power diffusion from inlet e3"; @@ -100,15 +71,15 @@ public Real re3 "Value of r(Q/gamma) for inlet e3"; Real rs "Value of r(Q/gamma) for outlet s"; - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce1 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce1(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-110,-10},{-90,10}}, rotation=0), iconTransformation(extent={{-110,-10},{-90,10}}))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce2 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce2(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-10,90},{10,110}}, rotation=0), iconTransformation(extent={{-10,90},{10,110}}))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{90,-10},{110,10}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce3 annotation (Placement(transformation( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce3(redeclare package Medium = Medium) annotation (Placement(transformation( extent={{-10,-110},{10,-90}}), iconTransformation(extent={{-10,-110},{ 10,-90}}))); initial equation @@ -128,19 +99,11 @@ initial equation end if; end if; - if flue_gases then - if dynamic_composition_balance then - if steady_state then - der(Xco2) = 0; - der(Xh2o) = 0; - der(Xo2) = 0; - der(Xso2) = 0; - else - Xco2 = Xco20; - Xh2o = Xh2o0; - Xo2 = Xo20; - Xso2 = Xso20; - end if; + if dynamic_composition_balance then + if steady_state then + der(X) = fill(0,Medium.nX); + else + X = X0[1:Medium.nXi]; end if; end if; @@ -150,16 +113,6 @@ equation assert(V > 0, "Volume non-positive"); end if; - /* Check that incoming fluids are compatible with fluid in volume */ - fluids[1] = ftype; - fluids[2] = Ce1.ftype; - fluids[3] = Ce2.ftype; - fluids[4] = Ce3.ftype; - fluids[5] = Cs.ftype; - - assert(ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.isCompatible(fluids), - "VolumeC: fluids mixing in volume are not compatible with each other"); - /* Unconnected connectors */ if (cardinality(Ce1) == 0) then Ce1.Q = 0; @@ -167,11 +120,8 @@ equation Ce1.h_vol_1 = 1.e5; Ce1.diff_res_1 = 0; Ce1.diff_on_1 = false; - Ce1.ftype = ftype; - Ce1.Xco2 = 0; - Ce1.Xh2o = 0; - Ce1.Xo2 = 0; - Ce1.Xso2 = 0; + Ce1.Xi = Medium.X_default[1:Medium.nXi]; + Ce1.SubC = Medium.C_default; end if; if (cardinality(Ce2) == 0) then @@ -180,11 +130,8 @@ equation Ce2.h_vol_1 = 1.e5; Ce2.diff_res_1 = 0; Ce2.diff_on_1 = false; - Ce2.ftype = ftype; - Ce2.Xco2 = 0; - Ce2.Xh2o = 0; - Ce2.Xo2 = 0; - Ce2.Xso2 = 0; + Ce2.Xi = Medium.X_default[1:Medium.nXi]; + Ce2.SubC = Medium.C_default; end if; if (cardinality(Ce3) == 0) then @@ -193,11 +140,8 @@ equation Ce3.h_vol_1 = 1.e5; Ce3.diff_res_1 = 0; Ce3.diff_on_1 = false; - Ce3.ftype = ftype; - Ce3.Xco2 = 0; - Ce3.Xh2o = 0; - Ce3.Xo2 = 0; - Ce3.Xso2 = 0; + Ce3.Xi = Medium.X_default[1:Medium.nXi]; + Ce3.SubC = Medium.C_default; end if; if (cardinality(Cs) == 0) then @@ -211,7 +155,7 @@ equation BQ = Ce1.Q + Ce2.Q + Ce3.Q - Cs.Q; if isCompressible and dynamic_energy_balance and dynamic_mass_balance then - V*(ddph*der(P) + ddhp*der(h - Xh2o*hr)) = BQ; + V*(ddph*der(P) + ddhp*der(h)) = BQ; else 0 = BQ; end if; @@ -222,13 +166,13 @@ equation P = Cs.P; /* Energy balance equation */ - BH = Ce1.Q*(Ce1.h - Ce1.Xh2o*hr) + Ce2.Q*(Ce2.h - Ce2.Xh2o*hr) + Ce3.Q*(Ce3.h - Ce3.Xh2o *hr) - Cs.Q*(Cs.h - Cs.Xh2o*hr) + J; + BH = Ce1.Q*Ce1.h + Ce2.Q*Ce2.h + Ce3.Q*Ce3.h - Cs.Q*Cs.h + J; if dynamic_energy_balance then if dynamic_mass_balance then - V*(((h - Xh2o*hr)*ddph - 1)*der(P) + ((h - Xh2o*hr)*ddhp + rho)*der(h - Xh2o*hr)) = BH; + V*((h*ddph - 1)*der(P) + (h*ddhp + rho)*der(h)) = BH; else - V*rho*der(h - Xh2o*hr) = BH; + V*rho*der(h) = BH; end if; else BH = 0; @@ -240,36 +184,28 @@ equation Cs.h_vol_1 = h; /* Fluid composition balance equations */ - BXco2 = Ce1.Xco2*Ce1.Q + Ce2.Xco2*Ce2.Q + Ce3.Xco2*Ce3.Q - Cs.Xco2*Cs.Q; - BXh2o = Ce1.Xh2o*Ce1.Q + Ce2.Xh2o*Ce2.Q + Ce3.Xh2o*Ce3.Q - Cs.Xh2o*Cs.Q; - BXo2 = Ce1.Xo2*Ce1.Q + Ce2.Xo2*Ce2.Q + Ce3.Xo2*Ce3.Q - Cs.Xo2*Cs.Q; - BXso2 = Ce1.Xso2*Ce1.Q + Ce2.Xso2*Ce2.Q + Ce3.Xso2*Ce3.Q - Cs.Xso2*Cs.Q; - - if flue_gases then - if dynamic_composition_balance then - V*rho*der(Xco2) + Xco2*BQ = BXco2; - V*rho*der(Xh2o) + Xh2o*BQ = BXh2o; - V*rho*der(Xo2) + Xo2*BQ = BXo2; - V*rho*der(Xso2) + Xso2*BQ = BXso2; - else - Xco2*BQ = BXco2; - Xh2o*BQ = BXh2o; - Xo2*BQ = BXo2; - Xso2*BQ = BXso2; - end if; + BX = Ce1.Xi*Ce1.Q + Ce2.Xi*Ce2.Q + Ce3.Xi*Ce3.Q - Cs.Xi*Cs.Q; + + if dynamic_composition_balance then + V*rho*der(X) + X*BQ = BX; + else + X*BQ = BX; + end if; + + + /* Traces composition balance equations */ + BSubC = Ce1.Q*Ce1.SubC + Ce2.Q*Ce2.SubC + Ce3.Q*Ce3.SubC - Cs.Q*Cs.SubC; + + SubCSaS = SaS(); + if dynamic_mass_balance then + V*rho*der(SubC) + SubC*BQ + V*rho*SubCSaS = BSubC; else - Xco2 = 0; - Xh2o = 0; - Xo2 = 0; - Xso2 = 0; + V*rho*SubCSaS = BSubC; end if; - Cs.ftype = ftype; + Cs.SubC = SubC; - Cs.Xco2 = Xco2; - Cs.Xh2o = Xh2o; - Cs.Xo2 = Xo2; - Cs.Xso2 = Xso2; + Cs.Xi = X; /* Flow reversal */ if continuous_flow_reversal then @@ -325,19 +261,21 @@ equation /* Fluid thermodynamic properties */ if isCompressible and dynamic_mass_balance then - ddph = ThermoSysPro.Properties.Fluid.Density_derp_Ph(P, h, fluid, mode, Xco2, Xh2o, Xo2, Xso2); - ddhp = ThermoSysPro.Properties.Fluid.Density_derh_Ph(P, h, fluid, mode, Xco2, Xh2o, Xo2, Xso2); + ddph = Medium.density_derp_h(state); + ddhp = Medium.density_derh_p(state); else ddph = 0; ddhp = 0; end if; - T = ThermoSysPro.Properties.Fluid.Temperature_Ph(P, h, fluid, mode, Xco2, Xh2o, Xo2, Xso2); + state = Medium.setState_phX(p=P, h=h, X=X); + + T = Medium.temperature(state); if (p_rho > 0) then rho = p_rho; else - rho = ThermoSysPro.Properties.Fluid.Density_Ph(P, h, fluid, mode, Xco2, Xh2o, Xo2, Xso2); + rho = Medium.density(state); end if; annotation ( From 518792661be75fea3f6798d9d5f337e81341509a Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Thu, 22 May 2025 16:39:38 +0200 Subject: [PATCH 008/178] #125 SourceQ and VolumeC --- ThermoSysPro/Properties/Media/FlueGases/package.mo | 2 +- ThermoSysPro/Properties/Media/PartialSubCMedium/package.mo | 1 + ThermoSysPro/Properties/Media/PartialSubCMedium/package.order | 1 + ThermoSysPro/Properties/Media/WaterSteam/package.mo | 1 + 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ThermoSysPro/Properties/Media/FlueGases/package.mo b/ThermoSysPro/Properties/Media/FlueGases/package.mo index 11e4197f..514261ef 100644 --- a/ThermoSysPro/Properties/Media/FlueGases/package.mo +++ b/ThermoSysPro/Properties/Media/FlueGases/package.mo @@ -2,7 +2,7 @@ within ThermoSysPro.Properties.Media; package FlueGases "Flue gases library inherited from Modelica.Media" import Modelica.Media.Interfaces.Choices.ReferenceEnthalpy; - extends PartialSubCMedium(nSubC=nC); + extends PartialSubCMedium(nSubC=nC,isCompressible=true); extends Modelica.Media.IdealGases.Common.MixtureGasNasa( mediumName="MediaMonomeld", data={Modelica.Media.IdealGases.Common.SingleGasesData.N2,Modelica.Media.IdealGases.Common.SingleGasesData.O2, diff --git a/ThermoSysPro/Properties/Media/PartialSubCMedium/package.mo b/ThermoSysPro/Properties/Media/PartialSubCMedium/package.mo index 133f5bc5..c689fdcb 100644 --- a/ThermoSysPro/Properties/Media/PartialSubCMedium/package.mo +++ b/ThermoSysPro/Properties/Media/PartialSubCMedium/package.mo @@ -1,5 +1,6 @@ within ThermoSysPro.Properties.Media; partial package PartialSubCMedium constant Integer nSubC; + constant Boolean isCompressible; end PartialSubCMedium; diff --git a/ThermoSysPro/Properties/Media/PartialSubCMedium/package.order b/ThermoSysPro/Properties/Media/PartialSubCMedium/package.order index d5bff50f..62ead749 100644 --- a/ThermoSysPro/Properties/Media/PartialSubCMedium/package.order +++ b/ThermoSysPro/Properties/Media/PartialSubCMedium/package.order @@ -1,4 +1,5 @@ nSubC +isCompressible partialPhasesSeparation HomogeneousPhasesSeparation C_BiPhase diff --git a/ThermoSysPro/Properties/Media/WaterSteam/package.mo b/ThermoSysPro/Properties/Media/WaterSteam/package.mo index b47b1c4c..12e82bc9 100644 --- a/ThermoSysPro/Properties/Media/WaterSteam/package.mo +++ b/ThermoSysPro/Properties/Media/WaterSteam/package.mo @@ -2,6 +2,7 @@ within ThermoSysPro.Properties.Media; package WaterSteam "1 - Water/steam properties library (IAPWS-IF97)" extends PartialTwoPhaseThermoSysProMedium( + isCompressible=true, mediumName="WaterIF97", substanceNames={"water"}, singleState=false, From b71ba451aaa87a75764b2336e413b7f485bf6156 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Thu, 22 May 2025 16:49:00 +0200 Subject: [PATCH 009/178] #125 VolumeC examples moved to the correct folder --- .../Fluid/Examples/SimpleExamples/PressureLosses/package.order | 3 --- .../SimpleExamples/{PressureLosses => Volumes}/TestVolumeC.mo | 2 +- .../{PressureLosses => Volumes}/TestVolumeC_FlueGases.mo | 2 +- .../{PressureLosses => Volumes}/TestVolumeC_Traces.mo | 2 +- .../Fluid/Examples/SimpleExamples/Volumes/package.order | 3 +++ 5 files changed, 6 insertions(+), 6 deletions(-) rename ThermoSysPro/Fluid/Examples/SimpleExamples/{PressureLosses => Volumes}/TestVolumeC.mo (94%) rename ThermoSysPro/Fluid/Examples/SimpleExamples/{PressureLosses => Volumes}/TestVolumeC_FlueGases.mo (95%) rename ThermoSysPro/Fluid/Examples/SimpleExamples/{PressureLosses => Volumes}/TestVolumeC_Traces.mo (95%) diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order index 52916924..eb3436e6 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order @@ -1,6 +1,3 @@ TestPipePressureLoss TestPipePressureLoss_FlueGases TestPipePressureLoss_Traces -TestVolumeC -TestVolumeC_FlueGases -TestVolumeC_Traces diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestVolumeC.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeC.mo similarity index 94% rename from ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestVolumeC.mo rename to ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeC.mo index 32a60055..31eb2b99 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestVolumeC.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeC.mo @@ -1,4 +1,4 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples.PressureLosses; +within ThermoSysPro.Fluid.Examples.SimpleExamples.Volumes; model TestVolumeC extends ThermoSysPro.UsersGuide.Icons.Example; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestVolumeC_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeC_FlueGases.mo similarity index 95% rename from ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestVolumeC_FlueGases.mo rename to ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeC_FlueGases.mo index 1b40a056..0c4f3674 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestVolumeC_FlueGases.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeC_FlueGases.mo @@ -1,4 +1,4 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples.PressureLosses; +within ThermoSysPro.Fluid.Examples.SimpleExamples.Volumes; model TestVolumeC_FlueGases extends ThermoSysPro.UsersGuide.Icons.Example; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestVolumeC_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeC_Traces.mo similarity index 95% rename from ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestVolumeC_Traces.mo rename to ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeC_Traces.mo index c455a404..457a8afe 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestVolumeC_Traces.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeC_Traces.mo @@ -1,4 +1,4 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples.PressureLosses; +within ThermoSysPro.Fluid.Examples.SimpleExamples.Volumes; model TestVolumeC_Traces extends ThermoSysPro.UsersGuide.Icons.Example; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order index e69de29b..f5870693 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order @@ -0,0 +1,3 @@ +TestVolumeC +TestVolumeC_FlueGases +TestVolumeC_Traces From 4fd0c0a1b0aef1628f1eca7d4b37c66d41ed7865 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Thu, 22 May 2025 16:55:21 +0200 Subject: [PATCH 010/178] #125 VolumeC FlueGases with startValue for OpenModelica --- .../Examples/SimpleExamples/Volumes/TestVolumeC_FlueGases.mo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeC_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeC_FlueGases.mo index 0c4f3674..fe58ef01 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeC_FlueGases.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeC_FlueGases.mo @@ -12,7 +12,7 @@ model TestVolumeC_FlueGases P0=4500000, T0=573.15, option_temperature=true) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); - ThermoSysPro.Fluid.Volumes.VolumeC volumeC(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.Volumes.VolumeC volumeC(redeclare replaceable package Medium = Medium, h(start=2.83057e6)) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ( redeclare replaceable package Medium = Medium, T0=573.15, From 408236adb6c0b799cab588235ec23a6485f8cdf0 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Thu, 22 May 2025 17:11:18 +0200 Subject: [PATCH 011/178] #125 SaS in VolumeC defined from Properties so that no Warnings --- ThermoSysPro/Fluid/Volumes/VolumeC.mo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ThermoSysPro/Fluid/Volumes/VolumeC.mo b/ThermoSysPro/Fluid/Volumes/VolumeC.mo index c67202f8..ff559ee6 100644 --- a/ThermoSysPro/Fluid/Volumes/VolumeC.mo +++ b/ThermoSysPro/Fluid/Volumes/VolumeC.mo @@ -4,7 +4,7 @@ model VolumeC "Mixing volume with 3 inlets and 1 outlet" extends ThermoSysPro.Fluid.Interfaces.IconColors; replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); - replaceable function SaS = Medium.noSaS (SubC=SubC) annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable function SaS = ThermoSysPro.Properties.Media.PartialSubCMedium.noSaS(SubC=SubC) annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Boolean dynamic_energy_balance=true "true: dynamic energy balance equation - false: static energy balance equation"; parameter Units.SI.Volume V=1 From ab9b85a7d4e7f1820645a58c6efe8d38e72e1ff4 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Fri, 23 May 2025 09:11:08 +0200 Subject: [PATCH 012/178] #125 Modified TSP version to 5.0 --- ThermoSysPro/package.mo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ThermoSysPro/package.mo b/ThermoSysPro/package.mo index 3c7dee3b..42837b37 100644 --- a/ThermoSysPro/package.mo +++ b/ThermoSysPro/package.mo @@ -126,5 +126,5 @@ annotation (

Copyright © EDF 2002 - 2024

ThermoSysPro version 4.1

"), - version="4.1"); + version="5.0"); end ThermoSysPro; From 6b678e5844e5f1d086103c28667a933ce37fb3f9 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Fri, 23 May 2025 10:12:07 +0200 Subject: [PATCH 013/178] #125 Dryer --- .../SimpleExamples/Junctions/TestDryer.mo | 16 +++ .../Junctions/TestDryer_Traces.mo | 16 +++ .../SimpleExamples/Junctions/package.order | 2 + .../PhasesSeparation.mo | 18 +++ .../WaterSteam_NonVolatileTrace/package.mo | 5 + .../WaterSteam_NonVolatileTrace/package.order | 1 + .../Examples/SimpleExamples/Media/package.mo | 116 ++++++++++++++++++ .../SimpleExamples/Media/package.order | 1 + .../Examples/SimpleExamples/package.order | 1 + ThermoSysPro/Fluid/Junctions/SteamDryer.mo | 76 +++++------- ThermoSysPro/Fluid/Volumes/VolumeC.mo | 4 +- 11 files changed, 206 insertions(+), 50 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestDryer.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestDryer_Traces.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Media/WaterSteam_NonVolatileTrace/PhasesSeparation.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Media/WaterSteam_NonVolatileTrace/package.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Media/WaterSteam_NonVolatileTrace/package.order create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Media/package.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Media/package.order diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestDryer.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestDryer.mo new file mode 100644 index 00000000..ed49127a --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestDryer.mo @@ -0,0 +1,16 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Junctions; +model TestDryer + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam; + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare replaceable package Medium = Medium, h0=2e6) + annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.Fluid.Junctions.SteamDryer steamDryer(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-14},{10,6}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink_cond(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{30,-40},{50,-20}}))); +equation + connect(sourcePQ.C, steamDryer.Cev) annotation (Line(points={{-30,0},{-9.9,0}}, color={0,0,0})); + connect(sink.C, steamDryer.Csv) annotation (Line(points={{30,0},{9.9,0}}, color={0,0,0})); + connect(steamDryer.Csl, sink_cond.C) annotation (Line(points={{0.1,-14},{0.1,-30},{30,-30}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestDryer; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestDryer_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestDryer_Traces.mo new file mode 100644 index 00000000..72b8fd1f --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestDryer_Traces.mo @@ -0,0 +1,16 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Junctions; +model TestDryer_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Fluid.Examples.SimpleExamples.Media.WaterSteam_NonVolatileTrace; + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare replaceable package Medium = Medium, h0=2e6, + SubC0={1}) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.Fluid.Junctions.SteamDryer steamDryer(redeclare replaceable package Medium = Medium, redeclare function PhasesSeparationFunction = Medium.PhasesSeparation (x=steamDryer.xe)) annotation (Placement(transformation(extent={{-10,-14},{10,6}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink_cond(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{30,-40},{50,-20}}))); +equation + connect(sourcePQ.C, steamDryer.Cev) annotation (Line(points={{-30,0},{-9.9,0}}, color={0,0,0})); + connect(sink.C, steamDryer.Csv) annotation (Line(points={{30,0},{9.9,0}}, color={0,0,0})); + connect(steamDryer.Csl, sink_cond.C) annotation (Line(points={{0.1,-14},{0.1,-30},{30,-30}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestDryer_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/package.order index e69de29b..0779eefb 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/package.order @@ -0,0 +1,2 @@ +TestDryer +TestDryer_Traces diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Media/WaterSteam_NonVolatileTrace/PhasesSeparation.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Media/WaterSteam_NonVolatileTrace/PhasesSeparation.mo new file mode 100644 index 00000000..d1d7026a --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Media/WaterSteam_NonVolatileTrace/PhasesSeparation.mo @@ -0,0 +1,18 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Media.WaterSteam_NonVolatileTrace; +function PhasesSeparation + extends partialPhasesSeparation; + input Real x(min=0, max=1) "Title"; + +algorithm + // // HomogeneousSubstance + // C_record.Cl := SubC; + // C_record.Cg := SubC; + + // Non-volatile + C_record.Cl := SubC/(1 - x); + C_record.Cg := fill(0, size(SubC, 1)); + + // // Fully-volatile + // C_record.Cl := fill(0,size(SubC,1)); + // C_record.Cg := SubC / x; +end PhasesSeparation; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Media/WaterSteam_NonVolatileTrace/package.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Media/WaterSteam_NonVolatileTrace/package.mo new file mode 100644 index 00000000..09644f8a --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Media/WaterSteam_NonVolatileTrace/package.mo @@ -0,0 +1,5 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Media; +package WaterSteam_NonVolatileTrace + extends Properties.Media.WaterSteam(extraPropertiesNames={"Trace"}, C_nominal={0.1}, C_default={0.2}); + +end WaterSteam_NonVolatileTrace; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Media/WaterSteam_NonVolatileTrace/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/Media/WaterSteam_NonVolatileTrace/package.order new file mode 100644 index 00000000..11ebc226 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Media/WaterSteam_NonVolatileTrace/package.order @@ -0,0 +1 @@ +PhasesSeparation diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Media/package.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Media/package.mo new file mode 100644 index 00000000..92af1d3a --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Media/package.mo @@ -0,0 +1,116 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples; +package Media + + annotation (Icon(graphics={ + Text( + extent={{-102,0},{24,-26}}, + lineColor={242,148,0}, + textString= + "Thermo"), + Text( + extent={{-4,8},{68,-34}}, + lineColor={46,170,220}, + textString= + "SysPro"), + Polygon( + points={{-62,2},{-58,4},{-48,8},{-32,12},{-16,14},{6,14},{26,12},{42,8},{52,2},{42,6},{28,10},{6,12},{-12,12},{-16,12},{-34,10},{-50,6},{-62,2}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-44,38},{-24,38},{-26,30},{-26,22},{-24,14},{-24,12},{-46,8},{-42,22},{-42,30},{-44,38}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-26,20},{-20,20},{-20,22},{-14,22},{-14,20},{-12,20},{-12,12},{-26,12},{-28,12},{-26,20}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-8,14},{-8,24},{-6,24},{-6,14},{-8,14}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-8,30},{-6,26}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-8,36},{-6,32}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-8,42},{-6,38}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-8,48},{-6,44}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-4,14},{-4,26},{-2,26},{-2,14},{-4,14}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-4,32},{-2,28}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-4,38},{-2,34}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-4,44},{-2,40}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-4,50},{-2,46}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-2,20},{8,20},{8,22},{10,22},{18,22},{18,12},{-4,14},{-2,20}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-62,2},{-58,4},{-48,8},{-36,10},{-18,12},{6,12},{26,10},{42,6},{52,0},{42,4},{28,8},{6,10},{-12,10},{-18,10},{-38,8},{-50,6},{-62,2}}, + lineColor={242,148,0}, + fillColor={242,148,0}, + fillPattern=FillPattern.Solid), + Line( + points={{22,12},{22,14},{22,16},{24,14},{20,18}}, + color={46,170,220}, + thickness=0.5), + Line( + points={{26,12},{26,14},{26,16},{28,14},{24,18}}, + color={46,170,220}, + thickness=0.5), + Line( + points={{30,10},{30,12},{30,14},{32,12},{28,16}}, + color={46,170,220}, + thickness=0.5), + Polygon( + points={{36,8},{36,30},{34,34},{36,38},{40,38},{40,8},{36,8}}, + lineColor={46,170,220}, + fillColor={46,170,220}, + fillPattern=FillPattern.Solid), + Rectangle(extent={{-100,80},{80,-100}}, lineColor={0,0,255}), + Line( + points={{-100,80},{-80,100},{100,100},{100,-80},{80,-100}}, + color={0,0,255}, + smooth=Smooth.None), + Line( + points={{80,80},{100,100}}, + color={0,0,255}, + smooth=Smooth.None)})); +end Media; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Media/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/Media/package.order new file mode 100644 index 00000000..cc36f421 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Media/package.order @@ -0,0 +1 @@ +WaterSteam_NonVolatileTrace diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/package.order index 4d0be736..6f19330f 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/package.order @@ -8,3 +8,4 @@ Machines PressureLosses Sensors Volumes +Media diff --git a/ThermoSysPro/Fluid/Junctions/SteamDryer.mo b/ThermoSysPro/Fluid/Junctions/SteamDryer.mo index b6956a1a..4bd0555c 100644 --- a/ThermoSysPro/Fluid/Junctions/SteamDryer.mo +++ b/ThermoSysPro/Fluid/Junctions/SteamDryer.mo @@ -1,33 +1,32 @@ within ThermoSysPro.Fluid.Junctions; model SteamDryer "Steam dryer" - extends - ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.WaterSteamFluidTypeParameterInterface; + extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialTwoPhaseThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable function SaS = ThermoSysPro.Properties.Media.PartialSubCMedium.noSaS(SubC = Cev.SubC) annotation (choicesAllMatching=true,Dialog(tab="Fluid", group="Medium")); + replaceable function PhasesSeparationFunction = ThermoSysPro.Properties.Media.PartialSubCMedium.HomogeneousPhasesSeparation(SubC = Cev.SubC) annotation (choicesAllMatching=true,Dialog(tab="Fluid", group="Medium")); parameter Real eta=1 "Steam dryer efficiency (0 <= eta <= 1)"; parameter Boolean continuous_flow_reversal=false "true: continuous flow reversal - false: discontinuous flow reversal"; parameter Boolean diffusion=false "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; - parameter IF97Region region_e=IF97Region.All_regions "IF97 region at the inlet (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); + parameter IF97Region region_e=IF97Region.All_regions "IF97 region at the inlet (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(tab="Fluid", group="Fluid properties")); protected parameter Units.SI.MassFlowRate gamma0=1.e-4 "Pseudo-diffusion conductance use for continuous flow reversal (active if diffusion=false and continuous_flow_reversal = true)"; parameter Integer mode_e=Integer(region_e) - 1 "IF97 region at the inlet. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; - parameter Integer fluid=Integer(ftype) "Fluid number"; + Medium.C_BiPhase C_record; public Units.SI.AbsolutePressure P(start=10e5) "Fluid pressure"; Units.SI.SpecificEnthalpy h(start=10e5) "Fluid specific enthalpy"; + Units.SI.Density rho(start=1.0) "Fluid density at inlet"; Real xe(start=1.0) "Vapor mass fraction at the inlet"; - FluidType fluids[4] "Fluids mixing in volume"; - ThermoSysPro.Units.SI.MassFraction Xco2 "CO2 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xh2o "H20 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xo2 "O2 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xso2 "SO2 mass fraction"; + Medium.ExtraProperty X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Fluid mass fraction"; + Medium.ExtraProperty SubCSaS[Medium.nC](quantity=Medium.extraPropertiesNames) "Trace modification in the trace balance equation"; Units.SI.Power Jev "Thermal power diffusion from inlet ev"; Units.SI.Power Jsv "Thermal power diffusion from outlet sv"; Units.SI.Power Jsl "Thermal power diffusion from outlet sl"; @@ -40,31 +39,16 @@ public Real rsl "Value of r(Q/gamma) for outlet sl"; public - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph proe - annotation (Placement(transformation(extent={{-100,80},{-80,100}}, rotation= - 0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Cev annotation (Placement( + Medium.SaturationProperties sat; + Medium.ThermodynamicState state_e; + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Cev(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-109,30},{-89,50}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Csv annotation ( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Csv(redeclare package Medium = Medium) annotation ( Placement(transformation(extent={{89,30},{109,50}}, rotation=0))); - ThermoSysPro.Properties.WaterSteam.Common.PropThermoSat lsat1 - annotation (Placement(transformation(extent={{-100,-98},{-80,-78}}, - rotation=0))); - ThermoSysPro.Properties.WaterSteam.Common.PropThermoSat vsat1 - annotation (Placement(transformation(extent={{-76,-98},{-56,-78}}, rotation= - 0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Csl annotation ( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Csl(redeclare package Medium = Medium) annotation ( Placement(transformation(extent={{-9,-110},{11,-90}}, rotation=0))); equation - /* Check that incoming fluids are compatible with fluid in volume */ - fluids[1] = ftype; - fluids[2] = Cev.ftype; - fluids[3] = Csv.ftype; - fluids[4] = Csl.ftype; - - assert(ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.isCompatible(fluids), - "SteamDryer: fluids mixing in volume are not compatible with each other"); /* Check that eta is between 0 and 1 */ assert((eta >= 0) and (eta <= 1), "SteamDryer - Parameter eta should be >= 0 and <= 1"); @@ -84,26 +68,21 @@ equation Cev.h_vol_2 = h; Csv.h_vol_1 = h; - Csl.h_vol_1 = noEvent(if (xe > 0) then lsat1.h else Cev.h); + Csl.h_vol_1 = noEvent(if (xe > 0) then Medium.bubbleEnthalpy(sat) else Cev.h); /* Fluid composition balance equations*/ - 0 = Cev.Xco2*Cev.Q - Csv.Xco2*Csv.Q - Csl.Xco2*Csl.Q; - 0 = Cev.Xh2o*Cev.Q - Csv.Xh2o*Csv.Q - Csl.Xh2o*Csl.Q; - 0 = Cev.Xo2*Cev.Q - Csv.Xo2*Csv.Q - Csl.Xo2*Csl.Q; - 0 = Cev.Xso2*Cev.Q - Csv.Xso2*Csv.Q - Csl.Xso2*Csl.Q; + Cev.Xi*Cev.Q = Csv.Xi*Csv.Q + Csl.Xi*Csl.Q; + + Csv.Xi = X; + Csl.Xi = X; - Csv.ftype = ftype; - Csl.ftype = ftype; + /* Traces composition balance equations */ + C_record = PhasesSeparationFunction(); + Csv.SubC = C_record.Cg; - Csv.Xco2 = Xco2; - Csv.Xh2o = Xh2o; - Csv.Xo2 = Xo2; - Csv.Xso2 = Xso2; + Csv.Q*Csv.SubC + Csl.Q*Csl.SubC = Cev.Q*Cev.SubC + SubCSaS * Cev.Q; - Csl.Xco2 = Xco2; - Csl.Xh2o = Xh2o; - Csl.Xo2 = Xo2; - Csl.Xso2 = Xso2; + SubCSaS = SaS(); /* Flow reversal */ if continuous_flow_reversal then @@ -152,13 +131,14 @@ equation Csl.diff_on_1 = diffusion; /* Fluid thermodynamic properties */ - proe = ThermoSysPro.Properties.Fluid.Ph(Cev.P, Cev.h, mode_e, fluid); + state_e=Medium.setState_phX(p=Cev.P, h=Cev.h, X=Cev.Xi, region=mode_e); + rho = state_e.d; /* Vapor mass fraction at the inlet */ - xe = proe.x; + xe=Medium.vapourQuality(state_e); /* Fluid thermodynamic properties at the saturation point */ - (lsat1,vsat1) = ThermoSysPro.Properties.Fluid.Water_sat_P(Cev.P, fluid); + sat = Medium.setSat_p(Cev.P); annotation ( Diagram(coordinateSystem( diff --git a/ThermoSysPro/Fluid/Volumes/VolumeC.mo b/ThermoSysPro/Fluid/Volumes/VolumeC.mo index ff559ee6..1de3a36a 100644 --- a/ThermoSysPro/Fluid/Volumes/VolumeC.mo +++ b/ThermoSysPro/Fluid/Volumes/VolumeC.mo @@ -52,9 +52,9 @@ public Units.SI.DerDensityByEnthalpy ddhp "density derivative wrt specific enthalpy at constant pressure"; Units.SI.MassFlowRate BX[Medium.nXi] "Right hand side of the X balance equation"; - Medium.ExtraProperty X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Boundary trace substances"; + Medium.ExtraProperty X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Fluid mass fraction"; Medium.ExtraProperty BSubC[Medium.nC](quantity=Medium.extraPropertiesNames) "Right hand side of the trace balance equation"; - Medium.ExtraProperty SubC[Medium.nC](quantity=Medium.extraPropertiesNames, start=Medium.C_default) "Boundary trace substances"; + Medium.ExtraProperty SubC[Medium.nC](quantity=Medium.extraPropertiesNames, start=Medium.C_default) "Fluid trace substances"; Medium.ExtraProperty SubCSaS[Medium.nC](quantity=Medium.extraPropertiesNames) "Trace modification in the trace balance equation"; Medium.ThermodynamicState state; Units.SI.Power Je1 "Thermal power diffusion from inlet e1"; From 06cb25922bf7d9cef91d921e03c8f0beea017f0e Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Fri, 23 May 2025 10:53:15 +0200 Subject: [PATCH 014/178] #125 no more replaceable in redeclaration example so that no warnings, and no partial lookup for OpenModelica --- .../Fluid/Examples/SimpleExamples/Junctions/TestDryer.mo | 2 +- .../Examples/SimpleExamples/Junctions/TestDryer_Traces.mo | 2 +- .../Fluid/Examples/SimpleExamples/Volumes/TestVolumeC.mo | 2 +- .../Examples/SimpleExamples/Volumes/TestVolumeC_FlueGases.mo | 2 +- .../Examples/SimpleExamples/Volumes/TestVolumeC_Traces.mo | 2 +- ThermoSysPro/Fluid/Junctions/SteamDryer.mo | 4 ++-- ThermoSysPro/Fluid/Volumes/VolumeC.mo | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestDryer.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestDryer.mo index ed49127a..6bb1a642 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestDryer.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestDryer.mo @@ -6,7 +6,7 @@ model TestDryer ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare replaceable package Medium = Medium, h0=2e6) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); - ThermoSysPro.Fluid.Junctions.SteamDryer steamDryer(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-14},{10,6}}))); + ThermoSysPro.Fluid.Junctions.SteamDryer steamDryer(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-10,-14},{10,6}}))); ThermoSysPro.Fluid.BoundaryConditions.Sink sink_cond(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{30,-40},{50,-20}}))); equation connect(sourcePQ.C, steamDryer.Cev) annotation (Line(points={{-30,0},{-9.9,0}}, color={0,0,0})); diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestDryer_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestDryer_Traces.mo index 72b8fd1f..a78582a8 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestDryer_Traces.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestDryer_Traces.mo @@ -6,7 +6,7 @@ model TestDryer_Traces ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare replaceable package Medium = Medium, h0=2e6, SubC0={1}) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); - ThermoSysPro.Fluid.Junctions.SteamDryer steamDryer(redeclare replaceable package Medium = Medium, redeclare function PhasesSeparationFunction = Medium.PhasesSeparation (x=steamDryer.xe)) annotation (Placement(transformation(extent={{-10,-14},{10,6}}))); + ThermoSysPro.Fluid.Junctions.SteamDryer steamDryer(redeclare package Medium = Medium, redeclare function PhasesSeparationFunction = Medium.PhasesSeparation (x=steamDryer.xe)) annotation (Placement(transformation(extent={{-10,-14},{10,6}}))); ThermoSysPro.Fluid.BoundaryConditions.Sink sink_cond(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{30,-40},{50,-20}}))); equation connect(sourcePQ.C, steamDryer.Cev) annotation (Line(points={{-30,0},{-9.9,0}}, color={0,0,0})); diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeC.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeC.mo index 31eb2b99..60ba1d38 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeC.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeC.mo @@ -5,7 +5,7 @@ model TestVolumeC replaceable package Medium = Properties.Media.WaterSteam; ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); - ThermoSysPro.Fluid.Volumes.VolumeC volumeC(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.Volumes.VolumeC volumeC(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-50,20},{-30,40}}))); equation connect(sourcePQ.C, volumeC.Ce1) annotation (Line(points={{-30,0},{-10,0}}, color={0,0,0})); diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeC_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeC_FlueGases.mo index fe58ef01..e17f46c6 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeC_FlueGases.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeC_FlueGases.mo @@ -12,7 +12,7 @@ model TestVolumeC_FlueGases P0=4500000, T0=573.15, option_temperature=true) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); - ThermoSysPro.Fluid.Volumes.VolumeC volumeC(redeclare replaceable package Medium = Medium, h(start=2.83057e6)) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.Volumes.VolumeC volumeC(redeclare package Medium = Medium, h(start=2.83057e6)) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ( redeclare replaceable package Medium = Medium, T0=573.15, diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeC_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeC_Traces.mo index 457a8afe..77037832 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeC_Traces.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeC_Traces.mo @@ -6,7 +6,7 @@ model TestVolumeC_Traces ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare replaceable package Medium = Medium, SubC0={0.2}) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); - ThermoSysPro.Fluid.Volumes.VolumeC volumeC(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.Volumes.VolumeC volumeC(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare replaceable package Medium = Medium, SubC0={0.1}) annotation (Placement(transformation(extent={{-50,20},{-30,40}}))); equation diff --git a/ThermoSysPro/Fluid/Junctions/SteamDryer.mo b/ThermoSysPro/Fluid/Junctions/SteamDryer.mo index 4bd0555c..a0363f2d 100644 --- a/ThermoSysPro/Fluid/Junctions/SteamDryer.mo +++ b/ThermoSysPro/Fluid/Junctions/SteamDryer.mo @@ -5,8 +5,8 @@ model SteamDryer "Steam dryer" import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialTwoPhaseThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); - replaceable function SaS = ThermoSysPro.Properties.Media.PartialSubCMedium.noSaS(SubC = Cev.SubC) annotation (choicesAllMatching=true,Dialog(tab="Fluid", group="Medium")); - replaceable function PhasesSeparationFunction = ThermoSysPro.Properties.Media.PartialSubCMedium.HomogeneousPhasesSeparation(SubC = Cev.SubC) annotation (choicesAllMatching=true,Dialog(tab="Fluid", group="Medium")); + replaceable function SaS = Medium.noSaS(SubC = Cev.SubC) annotation (choicesAllMatching=true,Dialog(tab="Fluid", group="Medium")); + replaceable function PhasesSeparationFunction = Medium.HomogeneousPhasesSeparation(SubC = Cev.SubC) annotation (choicesAllMatching=true,Dialog(tab="Fluid", group="Medium")); parameter Real eta=1 "Steam dryer efficiency (0 <= eta <= 1)"; parameter Boolean continuous_flow_reversal=false "true: continuous flow reversal - false: discontinuous flow reversal"; diff --git a/ThermoSysPro/Fluid/Volumes/VolumeC.mo b/ThermoSysPro/Fluid/Volumes/VolumeC.mo index 1de3a36a..5d9b59ac 100644 --- a/ThermoSysPro/Fluid/Volumes/VolumeC.mo +++ b/ThermoSysPro/Fluid/Volumes/VolumeC.mo @@ -4,7 +4,7 @@ model VolumeC "Mixing volume with 3 inlets and 1 outlet" extends ThermoSysPro.Fluid.Interfaces.IconColors; replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); - replaceable function SaS = ThermoSysPro.Properties.Media.PartialSubCMedium.noSaS(SubC=SubC) annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable function SaS = Medium.noSaS(SubC=SubC) annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Boolean dynamic_energy_balance=true "true: dynamic energy balance equation - false: static energy balance equation"; parameter Units.SI.Volume V=1 From 5f858097556a9062e583e6519007e83b0ed3be89 Mon Sep 17 00:00:00 2001 From: VESCOVI Guilherme Date: Fri, 23 May 2025 11:51:43 +0200 Subject: [PATCH 015/178] #125 SingularPressureLoss --- .../TestSingularPressureLoss.mo | 22 ++++++++++++++ .../TestSingularPressureLoss_Traces.mo | 22 ++++++++++++++ ...stSingularPressureLoss_Traces_FlueGases.mo | 24 +++++++++++++++ .../PressureLosses/package.order | 3 ++ .../PressureLosses/SingularPressureLoss.mo | 30 +++++++++---------- 5 files changed, 85 insertions(+), 16 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestSingularPressureLoss.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestSingularPressureLoss_Traces.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestSingularPressureLoss_Traces_FlueGases.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestSingularPressureLoss.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestSingularPressureLoss.mo new file mode 100644 index 00000000..2b78a5a7 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestSingularPressureLoss.mo @@ -0,0 +1,22 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.PressureLosses; +model TestSingularPressureLoss + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam; + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss( + redeclare replaceable package Medium = Medium) + annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package + Medium = Medium) + annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare + replaceable package Medium = Medium) + annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); +equation + connect(singularPressureLoss.C2, sink.C) + annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(singularPressureLoss.C1, sourcePQ.C) + annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( + coordinateSystem(preserveAspectRatio=false))); +end TestSingularPressureLoss; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestSingularPressureLoss_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestSingularPressureLoss_Traces.mo new file mode 100644 index 00000000..c67d6dd3 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestSingularPressureLoss_Traces.mo @@ -0,0 +1,22 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.PressureLosses; +model TestSingularPressureLoss_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam(extraPropertiesNames={"Trace1", "Trace2", "Trace3"}, C_nominal={0.1, 0.2, 0.3}, C_default={0.2, 0.3, 0.4}); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss( + redeclare replaceable package Medium = Medium) + annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package + Medium = Medium) + annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare + replaceable package Medium = Medium, SubC0={10,20,30}) + annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); +equation + connect(singularPressureLoss.C2, sink.C) + annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(singularPressureLoss.C1, sourcePQ.C) + annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( + coordinateSystem(preserveAspectRatio=false))); +end TestSingularPressureLoss_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestSingularPressureLoss_Traces_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestSingularPressureLoss_Traces_FlueGases.mo new file mode 100644 index 00000000..a13b12e3 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestSingularPressureLoss_Traces_FlueGases.mo @@ -0,0 +1,24 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.PressureLosses; +model TestSingularPressureLoss_Traces_FlueGases + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.FlueGases(extraPropertiesNames={"Trace1", "Trace2", "Trace3"}, C_nominal={0.1, 0.2, 0.3}, C_default={0.2, 0.3, 0.4}); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss( + redeclare replaceable package Medium = Medium) + annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package + Medium = Medium, option_temperature=true) + annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare + replaceable package Medium = Medium, SubC0={10,20,30}, + X0={0.1,0.2,0.3,0.2,0.2}, + option_temperature=true) + annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); +equation + connect(singularPressureLoss.C2, sink.C) + annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(singularPressureLoss.C1, sourcePQ.C) + annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( + coordinateSystem(preserveAspectRatio=false))); +end TestSingularPressureLoss_Traces_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order index eb3436e6..21b7a582 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order @@ -1,3 +1,6 @@ TestPipePressureLoss TestPipePressureLoss_FlueGases TestPipePressureLoss_Traces +TestSingularPressureLoss +TestSingularPressureLoss_Traces +TestSingularPressureLoss_Traces_FlueGases diff --git a/ThermoSysPro/Fluid/PressureLosses/SingularPressureLoss.mo b/ThermoSysPro/Fluid/PressureLosses/SingularPressureLoss.mo index e055743c..c9f6a9b7 100644 --- a/ThermoSysPro/Fluid/PressureLosses/SingularPressureLoss.mo +++ b/ThermoSysPro/Fluid/PressureLosses/SingularPressureLoss.mo @@ -1,17 +1,15 @@ within ThermoSysPro.Fluid.PressureLosses; model SingularPressureLoss "Singular pressure loss" - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Real K=1.e-4 "Pressure loss coefficient"; parameter Units.SI.MassFlowRate gamma_diff=1e-4 "Diffusion conductance (active if diffusion=true in neighbouring volumes)"; parameter Units.SI.Density p_rho=0 "If > 0, fixed fluid density" annotation (Evaluate=true, Dialog(tab="Fluid", group="Fluid properties")); - parameter IF97Region region=IF97Region.All_regions "IF97 region (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); protected - parameter Integer mode=Integer(region) - 1 "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; parameter Real eps=1.e-3 "Small number for pressure loss equation"; public @@ -21,13 +19,14 @@ public Units.SI.Temperature T(start=290) "Fluid temperature"; Units.SI.AbsolutePressure Pm(start=1.e5) "Average fluid pressure"; Units.SI.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy"; - FluidType ftype "Fluid type"; - Integer fluid=Integer(ftype) "Fluid number"; + Medium.MassFraction X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Mass fractions"; + - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-110,-10},{-90,10}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{90,-10},{110,10}}, rotation=0))); + equation C1.Q = C2.Q; @@ -42,18 +41,17 @@ equation C2.diff_res_1 = C1.diff_res_1 + (if (gamma_diff > 0) then 1/gamma_diff else 0); C1.diff_res_2 = C2.diff_res_2 + (if (gamma_diff > 0) then 1/gamma_diff else 0); - C1.ftype = C2.ftype; + C1.Xi = C2.Xi; + + X = C1.Xi; + - C1.Xco2 = C2.Xco2; - C1.Xh2o = C2.Xh2o; - C1.Xo2 = C2.Xo2; - C1.Xso2 = C2.Xso2; + C1.SubC = C2.SubC; Q = C1.Q; h = C1.h; deltaP = C1.P - C2.P; - ftype = C1.ftype; /* Pressure loss */ deltaP = K*ThermoSysPro.Functions.ThermoSquare(Q, eps)/rho; @@ -61,12 +59,12 @@ equation /* Fluid thermodynamic properties */ Pm = (C1.P + C2.P)/2; - T = ThermoSysPro.Properties.Fluid.Temperature_Ph(Pm, h, fluid, mode, C1.Xco2, C1.Xh2o, C1.Xo2, C1.Xso2); + T = Medium.temperature_phX(p=Pm, h=h, X=X); if (p_rho > 0) then rho = p_rho; else - rho = ThermoSysPro.Properties.Fluid.Density_Ph(Pm, h, fluid, mode, C1.Xco2, C1.Xh2o, C1.Xo2, C1.Xso2); + rho = Medium.density_phX(p=Pm, h=h, X=X); end if; annotation ( From 0ebe873bcb9c6dc06080da1aaa9b8ccce76eeade Mon Sep 17 00:00:00 2001 From: VESCOVI Guilherme Date: Fri, 23 May 2025 13:15:44 +0200 Subject: [PATCH 016/178] #125-SingularPressureLoss added color extend for OM compatibility --- ThermoSysPro/Fluid/PressureLosses/SingularPressureLoss.mo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ThermoSysPro/Fluid/PressureLosses/SingularPressureLoss.mo b/ThermoSysPro/Fluid/PressureLosses/SingularPressureLoss.mo index c9f6a9b7..583f3511 100644 --- a/ThermoSysPro/Fluid/PressureLosses/SingularPressureLoss.mo +++ b/ThermoSysPro/Fluid/PressureLosses/SingularPressureLoss.mo @@ -1,6 +1,6 @@ within ThermoSysPro.Fluid.PressureLosses; model SingularPressureLoss "Singular pressure loss" - +extends ThermoSysPro.Fluid.Interfaces.IconColors; replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Real K=1.e-4 "Pressure loss coefficient"; From f8be2834afcc4776561074fbd47b110cf7dc57ff Mon Sep 17 00:00:00 2001 From: HOCINE-RASTIC Sarah Date: Wed, 28 May 2025 12:05:15 +0200 Subject: [PATCH 017/178] #125 VolumeA --- .../SimpleExamples/Volumes/TestVolumeA.mo | 19 ++ .../Volumes/TestVolumeA_FlueGases.mo | 26 +++ .../Volumes/TestVolumeA_Traces.mo | 26 +++ .../SimpleExamples/Volumes/package.order | 3 + ThermoSysPro/Fluid/Volumes/VolumeA.mo | 178 ++++++------------ 5 files changed, 133 insertions(+), 119 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeA.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeA_FlueGases.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeA_Traces.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeA.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeA.mo new file mode 100644 index 00000000..13e231d2 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeA.mo @@ -0,0 +1,19 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Volumes; +model TestVolumeA + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam; + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package + Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare + replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.Fluid.Volumes.VolumeA volumeA(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare replaceable + package Medium = Medium) annotation (Placement(transformation(extent={{-50,20},{-30,40}}))); +equation + connect(sourcePQ.C,volumeA. Ce1) annotation (Line(points={{-30,0},{-10,0}}, color={0,0,0})); + connect(volumeA.Ce2, sourceQ.C) annotation (Line(points={{0,10},{0,30},{-30,30}}, color={0,0,0})); + connect(volumeA.Cs1, sink.C) + annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestVolumeA; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeA_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeA_FlueGases.mo new file mode 100644 index 00000000..fe764acd --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeA_FlueGases.mo @@ -0,0 +1,26 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Volumes; +model TestVolumeA_FlueGases + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.FlueGases; + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package + Medium = Medium, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare + replaceable package Medium = Medium, + P0=4500000, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.Fluid.Volumes.VolumeA volumeA(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare replaceable + package Medium = Medium, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{-50,20},{-30,40}}))); +equation + connect(sourcePQ.C,volumeA. Ce1) annotation (Line(points={{-30,0},{-10,0}}, color={0,0,0})); + connect(volumeA.Ce2, sourceQ.C) annotation (Line(points={{0,10},{0,30},{-30,30}}, color={0,0,0})); + connect(volumeA.Cs1, sink.C) + annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestVolumeA_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeA_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeA_Traces.mo new file mode 100644 index 00000000..35f5de29 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeA_Traces.mo @@ -0,0 +1,26 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Volumes; +model TestVolumeA_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam (extraPropertiesNames={"Trace"}, C_nominal={0.1}, C_default={0.2}); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package + Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare + replaceable package Medium = Medium, + Q0=100, + SubC0={0.5}) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.Fluid.Volumes.VolumeA volumeA(redeclare package Medium = Medium, + V=1, + dynamic_mass_balance=false) annotation (Placement(transformation(extent={{-10,-10}, + {10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare replaceable + package Medium = Medium, + SubC0={0.2}) annotation (Placement(transformation(extent={{-50,20},{-30,40}}))); +equation + connect(sourcePQ.C,volumeA. Ce1) annotation (Line(points={{-30,0},{-10,0}}, color={0,0,0})); + connect(volumeA.Ce2, sourceQ.C) annotation (Line(points={{0,10},{0,30},{-30, + 30}}, color={0,0,0})); + connect(volumeA.Cs1, sink.C) + annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestVolumeA_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order index f5870693..f71ca450 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order @@ -1,3 +1,6 @@ TestVolumeC TestVolumeC_FlueGases TestVolumeC_Traces +TestVolumeA +TestVolumeA_FlueGases +TestVolumeA_Traces diff --git a/ThermoSysPro/Fluid/Volumes/VolumeA.mo b/ThermoSysPro/Fluid/Volumes/VolumeA.mo index 4677b61e..fad042ec 100644 --- a/ThermoSysPro/Fluid/Volumes/VolumeA.mo +++ b/ThermoSysPro/Fluid/Volumes/VolumeA.mo @@ -1,10 +1,10 @@ -within ThermoSysPro.Fluid.Volumes; +within ThermoSysPro.Fluid.Volumes; model VolumeA "Mixing volume with 2 inlets and 2 outlets" - extends - ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidTypeParameterInterface; + extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable function SaS = Medium.noSaS(SubC=SubC) annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Boolean dynamic_energy_balance=true "true: dynamic energy balance equation - false: static energy balance equation"; @@ -29,42 +29,19 @@ model VolumeA "Mixing volume with 2 inlets and 2 outlets" "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; parameter Units.SI.Density p_rho=0 "If > 0, fixed fluid density" annotation (Evaluate=true, Dialog(tab="Fluid", group="Fluid properties")); - parameter IF97Region region=IF97Region.All_regions "IF97 region (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); + parameter Boolean dynamic_composition_balance=false "true: dynamic fluid composition balance equation
false: static fluid composition balance equation (active for flue gases)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.FlueGases), tab="Fluid", group="Fluid properties")); - parameter ThermoSysPro.Units.SI.MassFraction Xco20=0.0 - "Initial CO2 mass fraction" annotation (Evaluate=true, Dialog( + parameter Medium.ExtraProperty X0[Medium.nX]=Medium.X_default "Initial composition values" annotation (Evaluate=true, Dialog( enable=dynamic_composition_balance, tab="Fluid", - group= - "Initial composition values (active for flue gases only if dynamic_composition_balance=true)")); - parameter ThermoSysPro.Units.SI.MassFraction Xh2o0=if ftype == FluidType.FlueGases then 0.05 else 0 - "Initial H20 mass fraction" annotation (Evaluate=true, Dialog( - enable=dynamic_composition_balance, - tab="Fluid", - group= - "Initial composition values (active for flue gases only if dynamic_composition_balance=true)")); - parameter ThermoSysPro.Units.SI.MassFraction Xo20=0.23 - "Initial O2 mass fraction" annotation (Evaluate=true, Dialog( - enable=dynamic_composition_balance, - tab="Fluid", - group= - "Initial composition values (active for flue gases only if dynamic_composition_balance=true)")); - parameter ThermoSysPro.Units.SI.MassFraction Xso20=0 - "Initial SO2 mass fraction" annotation (Evaluate=true, Dialog( - enable=dynamic_composition_balance, - tab="Fluid", - group= - "Initial composition values (active for flue gases only if dynamic_composition_balance=true)")); + group="Medium")); protected - constant Units.SI.SpecificEnthalpy hr=2501569 - "Water/steam reference specific enthalpy at 0.01°C"; - parameter Boolean flue_gases=(ftype == FluidType.FlueGases) "Flue gases"; - parameter Units.SI.MassFlowRate gamma0=1.e-4 + constant Boolean isCompressible = Medium.isCompressible; + parameter Units.SI.MassFlowRate gamma0=1.e-4 "Pseudo-diffusion conductance use for continuous flow reversal (active if diffusion=false and continuous_flow_reversal = true)"; - parameter Integer mode=Integer(region) - 1 "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; public Units.SI.Temperature T "Fluid temperature"; @@ -77,15 +54,12 @@ public "density derivative wrt pressure at constant specific enthalpy"; Units.SI.DerDensityByEnthalpy ddhp "density derivative wrt specific enthalpy at constant pressure"; - FluidType fluids[5] "Fluids mixing in volume"; - Units.SI.MassFlowRate BXco2 "Right hand side of the CO2 balance equation"; - Units.SI.MassFlowRate BXh2o "Right hand side of the H2O balance equation"; - Units.SI.MassFlowRate BXo2 "Right hand side of the O2 balance equation"; - Units.SI.MassFlowRate BXso2 "Right hand side of the SO2 balance equation"; - ThermoSysPro.Units.SI.MassFraction Xco2 "CO2 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xh2o "H20 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xo2 "O2 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xso2 "SO2 mass fraction"; + Units.SI.MassFlowRate BX[Medium.nXi] "Right hand side of the X balance equation"; + Medium.ExtraProperty X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Fluid mass fraction"; + Medium.ExtraProperty BSubC[Medium.nC](quantity=Medium.extraPropertiesNames) "Right hand side of the trace balance equation"; + Medium.ExtraProperty SubC[Medium.nC](quantity=Medium.extraPropertiesNames, start=Medium.C_default) "Fluid trace substances"; + Medium.ExtraProperty SubCSaS[Medium.nC](quantity=Medium.extraPropertiesNames) "Trace modification in the trace balance equation"; + Medium.ThermodynamicState state; Units.SI.Power Je1 "Thermal power diffusion from inlet e1"; Units.SI.Power Je2 "Thermal power diffusion from inlet e2"; Units.SI.Power Js1 "Thermal power diffusion from outlet s1"; @@ -101,14 +75,14 @@ public Real rs2 "Value of r(Q/gamma) for outlet s2"; public - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce1 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce1( redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-110,-10},{-90,10}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce2 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce2( redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-10,90},{10,110}}, rotation=0), iconTransformation(extent={{-10,90},{10,110}}))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs1 annotation ( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs1( redeclare package Medium = Medium) annotation ( Placement(transformation(extent={{90,-10},{110,10}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs2 annotation ( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs2( redeclare package Medium = Medium) annotation ( Placement(transformation(extent={{-10,-110},{10,-90}}, rotation=0))); initial equation if dynamic_energy_balance and dynamic_mass_balance then @@ -127,19 +101,11 @@ initial equation end if; end if; - if flue_gases then - if dynamic_composition_balance then - if steady_state then - der(Xco2) = 0; - der(Xh2o) = 0; - der(Xo2) = 0; - der(Xso2) = 0; - else - Xco2 = Xco20; - Xh2o = Xh2o0; - Xo2 = Xo20; - Xso2 = Xso20; - end if; + if dynamic_composition_balance then + if steady_state then + der(X) = fill(0,Medium.nX); + else + X = X0[1:Medium.nXi]; end if; end if; @@ -149,16 +115,6 @@ equation assert(V > 0, "Volume non-positive"); end if; - /* Check that incoming fluids are compatible with fluid in volume */ - fluids[1] = ftype; - fluids[2] = Ce1.ftype; - fluids[3] = Ce2.ftype; - fluids[4] = Cs1.ftype; - fluids[5] = Cs2.ftype; - - assert(ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.isCompatible(fluids), - "VolumeA: fluids mixing in volume are not compatible with each other"); - /* Unconnected connectors */ if (cardinality(Ce1) == 0) then Ce1.Q = 0; @@ -166,11 +122,8 @@ equation Ce1.h_vol_1 = 1.e5; Ce1.diff_res_1 = 0; Ce1.diff_on_1 = false; - Ce1.ftype = ftype; - Ce1.Xco2 = 0; - Ce1.Xh2o = 0; - Ce1.Xo2 = 0; - Ce1.Xso2 = 0; + Ce1.Xi = Medium.X_default[1:Medium.nXi]; + Ce1.SubC = Medium.C_default; end if; if (cardinality(Ce2) == 0) then @@ -179,11 +132,8 @@ equation Ce2.h_vol_1 = 1.e5; Ce2.diff_res_1 = 0; Ce2.diff_on_1 = false; - Ce2.ftype = ftype; - Ce2.Xco2 = 0; - Ce2.Xh2o = 0; - Ce2.Xo2 = 0; - Ce2.Xso2 = 0; + Ce2.Xi = Medium.X_default[1:Medium.nXi]; + Ce2.SubC = Medium.C_default; end if; if (cardinality(Cs1) == 0) then @@ -204,7 +154,7 @@ equation BQ = Ce1.Q + Ce2.Q - Cs1.Q - Cs2.Q; if isCompressible and dynamic_energy_balance and dynamic_mass_balance then - V*(ddph*der(P) + ddhp*der(h - Xh2o*hr)) = BQ; + V*(ddph*der(P) + ddhp*der(h)) = BQ; else 0 = BQ; end if; @@ -215,13 +165,13 @@ equation P = Cs2.P; /* Energy balance equation */ - BH = Ce1.Q*(Ce1.h - Ce1.Xh2o*hr) + Ce2.Q*(Ce2.h - Ce2.Xh2o*hr) - Cs1.Q*(Cs1.h - Cs1.Xh2o*hr) - Cs2.Q*(Cs2.h - Cs2.Xh2o*hr) + J; + BH = Ce1.Q*Ce1.h + Ce2.Q*Ce2.h - Cs1.Q*Cs1.h - Cs2.Q*Cs2.h + J; if dynamic_energy_balance then if dynamic_mass_balance then - V*(((h - Xh2o*hr)*ddph - 1)*der(P) + ((h - Xh2o*hr)*ddhp + rho)*der(h - Xh2o*hr)) = BH; + V*((h*ddph - 1)*der(P) + (h*ddhp + rho)*der(h)) = BH; else - V*rho*der(h - Xh2o*hr) = BH; + V*rho*der(h) = BH; end if; else BH = 0; @@ -233,42 +183,30 @@ equation Cs2.h_vol_1 = h; /* Fluid composition balance equations */ - BXco2 = Ce1.Xco2*Ce1.Q + Ce2.Xco2*Ce2.Q - Cs1.Xco2*Cs1.Q - Cs2.Xco2*Cs2.Q; - BXh2o = Ce1.Xh2o*Ce1.Q + Ce2.Xh2o*Ce2.Q - Cs1.Xh2o*Cs1.Q - Cs2.Xh2o*Cs2.Q; - BXo2 = Ce1.Xo2*Ce1.Q + Ce2.Xo2*Ce2.Q - Cs1.Xo2*Cs1.Q - Cs2.Xo2*Cs2.Q; - BXso2 = Ce1.Xso2*Ce1.Q + Ce2.Xso2*Ce2.Q - Cs1.Xso2*Cs1.Q - Cs2.Xso2*Cs2.Q; - - if flue_gases then - if dynamic_composition_balance then - V*rho*der(Xco2) + Xco2*BQ = BXco2; - V*rho*der(Xh2o) + Xh2o*BQ = BXh2o; - V*rho*der(Xo2) + Xo2*BQ = BXo2; - V*rho*der(Xso2) + Xso2*BQ = BXso2; - else - Xco2*BQ = BXco2; - Xh2o*BQ = BXh2o; - Xo2*BQ = BXo2; - Xso2*BQ = BXso2; - end if; + BX = Ce1.Xi*Ce1.Q + Ce2.Xi*Ce2.Q - Cs1.Xi*Cs1.Q - Cs2.Xi*Cs2.Q; + + if dynamic_composition_balance then + V*rho*der(X) + X*BQ = BX; else - Xco2 = 0; - Xh2o = 0; - Xo2 = 0; - Xso2 = 0; + X*BQ = BX; end if; - Cs1.ftype = ftype; - Cs2.ftype = ftype; + Cs1.Xi = X; - Cs1.Xco2 = Xco2; - Cs1.Xh2o = Xh2o; - Cs1.Xo2 = Xo2; - Cs1.Xso2 = Xso2; + Cs2.Xi = X; - Cs2.Xco2 = Xco2; - Cs2.Xh2o = Xh2o; - Cs2.Xo2 = Xo2; - Cs2.Xso2 = Xso2; + /* Traces composition balance equations */ + BSubC = Ce1.Q*Ce1.SubC + Ce2.Q*Ce2.SubC - Cs1.Q*Cs1.SubC - Cs2.Q*Cs2.SubC; + + SubCSaS = SaS(); + if dynamic_mass_balance then + V*rho*der(SubC) + SubC*BQ + V*rho*SubCSaS = BSubC; + else + V*rho*SubCSaS = BSubC; + end if; + + Cs1.SubC = SubC; + Cs2.SubC = SubC; /* Flow reversal */ if continuous_flow_reversal then @@ -325,20 +263,22 @@ equation Cs2.diff_on_1 = diffusion; /* Fluid thermodynamic properties */ - if isCompressible and dynamic_mass_balance then - ddph = ThermoSysPro.Properties.Fluid.Density_derp_Ph(P, h, fluid, mode, Xco2, Xh2o, Xo2, Xso2); - ddhp = ThermoSysPro.Properties.Fluid.Density_derh_Ph(P, h, fluid, mode, Xco2, Xh2o, Xo2, Xso2); + if isCompressible and dynamic_mass_balance then + ddph = Medium.density_derp_h(state); + ddhp = Medium.density_derh_p(state); else ddph = 0; ddhp = 0; end if; - T = ThermoSysPro.Properties.Fluid.Temperature_Ph(P, h, fluid, mode, Xco2, Xh2o, Xo2, Xso2); + state = Medium.setState_phX(p=P, h=h, X=X); + + T = Medium.temperature(state); if (p_rho > 0) then rho = p_rho; else - rho = ThermoSysPro.Properties.Fluid.Density_Ph(P, h, fluid, mode, Xco2, Xh2o, Xo2, Xso2); + rho = Medium.density(state); end if; annotation ( From 1145b4e5281d5930f7c673ca33ca1da87b96395b Mon Sep 17 00:00:00 2001 From: VESCOVI Guilherme Date: Thu, 5 Jun 2025 15:30:04 +0200 Subject: [PATCH 018/178] #125 StodolaTurbine --- .../Machines/TestStodolaTurbine.mo | 22 +++++++ .../SimpleExamples/Machines/package.order | 1 + ThermoSysPro/Fluid/Machines/StodolaTurbine.mo | 59 ++++++++----------- 3 files changed, 48 insertions(+), 34 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStodolaTurbine.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStodolaTurbine.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStodolaTurbine.mo new file mode 100644 index 00000000..4d29ef69 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStodolaTurbine.mo @@ -0,0 +1,22 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Machines; +model TestStodolaTurbine + extends ThermoSysPro.UsersGuide.Icons.Example; + + ThermoSysPro.Fluid.Machines.StodolaTurbine stodolaTurbine(Cst=400000) + annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ( + P0=4500000, + Q0=1800, + T0=573.15, + option_temperature=true) + annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink + annotation (Placement(transformation(extent={{26,-10},{46,10}}))); +equation + connect(sourcePQ.C, stodolaTurbine.Ce) + annotation (Line(points={{-30,0},{-10.1,0}}, color={0,0,0})); + connect(stodolaTurbine.Cs, sink.C) + annotation (Line(points={{10.1,0},{26,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( + coordinateSystem(preserveAspectRatio=false))); +end TestStodolaTurbine; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/package.order index e69de29b..4bf87c1a 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/package.order @@ -0,0 +1 @@ +TestStodolaTurbine diff --git a/ThermoSysPro/Fluid/Machines/StodolaTurbine.mo b/ThermoSysPro/Fluid/Machines/StodolaTurbine.mo index 486fc51b..0d8405f8 100644 --- a/ThermoSysPro/Fluid/Machines/StodolaTurbine.mo +++ b/ThermoSysPro/Fluid/Machines/StodolaTurbine.mo @@ -1,6 +1,8 @@ within ThermoSysPro.Fluid.Machines; model StodolaTurbine "Multistage turbine group using Stodola's ellipse" - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; +extends ThermoSysPro.Fluid.Interfaces.IconColors; + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; parameter Real Cst=1.e7 "Stodola's ellipse coefficient"; @@ -27,6 +29,7 @@ model StodolaTurbine "Multistage turbine group using Stodola's ellipse" parameter IF97Region region_s=IF97Region.All_regions "IF97 region after expansion (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); parameter IF97Region region_ps=IF97Region.All_regions "IF97 region after isentropic expansion (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); + protected parameter Integer mode_e=Integer(region_e) - 1 "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; parameter Integer mode_s=Integer(region_s) - 1 "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; @@ -52,23 +55,17 @@ public Units.SI.Velocity Vs "Fluid velocity at the outlet"; Units.SI.Density rhos(start=200) "Fluid density at the outlet"; Real xm(start=1.0,min=0) "Average vapor mass fraction"; - FluidType ftype "Fluid type"; - Integer fluid=Integer(ftype) "Fluid number"; + Medium.MassFraction X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Mass fractions"; public - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph proe - annotation (Placement(transformation(extent={{-100,80},{-80,100}}, rotation= - 0))); - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pros - annotation (Placement(transformation(extent={{-60,80},{-40,100}}, rotation= - 0))); - Interfaces.Connectors.FluidInlet Ce annotation (Placement(transformation( + Medium.ThermodynamicState state_e; + Medium.ThermodynamicState state_s1; + Medium.ThermodynamicState state_s; + Medium.ThermodynamicState state_ps; + Interfaces.Connectors.FluidInlet Ce(redeclare package Medium = Medium) annotation (Placement(transformation( extent={{-111,-10},{-91,10}}, rotation=0))); - Interfaces.Connectors.FluidOutlet Cs annotation (Placement(transformation( + Interfaces.Connectors.FluidOutlet Cs(redeclare package Medium = Medium) annotation (Placement(transformation( extent={{91,-10},{111,10}}, rotation=0))); - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ps props - annotation (Placement(transformation(extent={{-100,-100},{-80,-80}}, - rotation=0))); ThermoSysPro.ElectroMechanics.Connectors.MechanichalTorque M annotation (Placement(transformation( origin={0,-100}, @@ -79,11 +76,7 @@ public origin={110,-90}, extent={{10,-10},{-10,10}}, rotation=180))); - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pros1 - annotation (Placement(transformation(extent={{-20,80},{0,100}}, rotation=0))); equation - /* Check that the fluid type is water/steam */ - assert((ftype == FluidType.WaterSteam) or (ftype == FluidType.WaterSteamSimple), "StodolaTurbine: the fluid type must be water/steam"); if (cardinality(M) == 0) then M.Ctr = 0; @@ -103,18 +96,16 @@ equation Cs.diff_res_1 = Ce.diff_res_1 + (if (gamma_diff > 0) then 1/gamma_diff else 0); Ce.diff_res_2 = Cs.diff_res_2 + (if (gamma_diff > 0) then 1/gamma_diff else 0); - Ce.ftype = Cs.ftype; - Ce.Xco2 = Cs.Xco2; - Ce.Xh2o = Cs.Xh2o; - Ce.Xo2 = Cs.Xo2; - Ce.Xso2 = Cs.Xso2; + /* Fluid composition balance equations*/ + Ce.Xi = Cs.Xi; + X = Ce.Xi; + Q = Ce.Q; Pe = Ce.P; Ps = Cs.P; - ftype = Ce.ftype; /* Isentropic efficiency */ eta_is = if (Q < Qmax) then (max(eta_is_min,(a*(Q/Qmax)^2 + b*(Q/Qmax) + c))) else eta_is_nom; @@ -124,14 +115,14 @@ equation if noEvent((Pe > pcrit) or (Te > Tcrit)) then xm = 1; else - xm = (proe.x + pros1.x)/2.0; + xm = (Medium.vapourQuality(state_e) + Medium.vapourQuality(state_s1))/2.0; end if; /* Stodola's ellipse law */ if noEvent((Pe > pcrit) or (Te > Tcrit)) then Q = sqrt((Pe^2 - Ps^2)/(Cst*Te)); else - Q = sqrt((Pe^2 - Ps^2)/(Cst*Te*proe.x)); + Q = sqrt((Pe^2 - Ps^2)/(Cst*Te*Medium.vapourQuality(state_e))); end if; /* Fluid specific enthalpy after the expansion */ @@ -146,22 +137,22 @@ equation MechPower.signal = W; /* Fluid thermodynamic properties before the expansion */ - proe = ThermoSysPro.Properties.Fluid.Ph(Pe, Ce.h, mode_e, fluid); + state_e=Medium.setState_phX(p=Pe, h=Ce.h, X=Ce.Xi, region=mode_e); - Te = proe.T; + Te = state_e.T; /* Fluid thermodynamic properties after the expansion */ - pros1 = ThermoSysPro.Properties.Fluid.Ph(Ps, Hrs, mode_s, fluid); + state_s1 = Medium.setState_phX(p=Ps, h=Hrs, X=Cs.Xi, region=mode_s); // X=Cs.Xi ????????????????? Hrs.Xi ?? /* Fluid thermodynamic properties at the outlet of the nozzle */ - pros = ThermoSysPro.Properties.Fluid.Ph(Ps, Cs.h, mode_s, fluid); + state_s = Medium.setState_phX(p=Ps, h=Cs.h, X=Cs.Xi, region=mode_s); - Ts = pros.T; - rhos = pros.d; + Ts = state_s.T; + rhos = state_s.d; /* Fluid thermodynamic properties after the isentropic expansion */ - props = ThermoSysPro.Properties.Fluid.Ps(Ps, proe.s, mode_ps, fluid); - His = props.h; + state_ps = Medium.setState_psX(p=Ps, s=Medium.specificEntropy(state_e), X=Cs.Xi, region=mode_ps); // X=Cs.Xi ????????????????????? + His = state_ps.h; annotation ( Diagram(coordinateSystem( From ee4063ca622bcf4d04279ce47613f5f15b5d4df2 Mon Sep 17 00:00:00 2001 From: VESCOVI Guilherme Date: Thu, 5 Jun 2025 15:58:54 +0200 Subject: [PATCH 019/178] #125 SourceP --- .../Fluid/BoundaryConditions/SourceP.mo | 65 +++++-------------- 1 file changed, 18 insertions(+), 47 deletions(-) diff --git a/ThermoSysPro/Fluid/BoundaryConditions/SourceP.mo b/ThermoSysPro/Fluid/BoundaryConditions/SourceP.mo index a9a3641d..8156d294 100644 --- a/ThermoSysPro/Fluid/BoundaryConditions/SourceP.mo +++ b/ThermoSysPro/Fluid/BoundaryConditions/SourceP.mo @@ -1,10 +1,9 @@ within ThermoSysPro.Fluid.BoundaryConditions; model SourceP "Multi-fluid source with fixed pressure" - extends - ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidTypeParameterInterface; + extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Units.SI.AbsolutePressure P0=300000 "Source pressure"; parameter Units.SI.Temperature T0=290 @@ -19,32 +18,13 @@ model SourceP "Multi-fluid source with fixed pressure" "true: continuous flow reversal - false: discontinuous flow reversal"; parameter Boolean diffusion=false "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; - parameter IF97Region region=IF97Region.All_regions "IF97 region (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); - parameter ThermoSysPro.Units.SI.MassFraction Xco2=0.01 "CO2 mass fraction" - annotation (Evaluate=true, Dialog( - enable=(ftype == FluidType.FlueGases), - tab="Fluid", - group="Composition values (active for flue gases only)")); - parameter ThermoSysPro.Units.SI.MassFraction Xh2o=if ftype == FluidType.FlueGases then 0.05 else 0 "H2O mass fraction" - annotation (Evaluate=true, Dialog( - enable=(ftype == FluidType.FlueGases), - tab="Fluid", - group="Composition values (active for flue gases only)")); - parameter ThermoSysPro.Units.SI.MassFraction Xo2=0.22 "O2 mass fraction" - annotation (Evaluate=true, Dialog( - enable=(ftype == FluidType.FlueGases), + parameter Medium.ExtraProperty SubC0[Medium.nC](quantity=Medium.extraPropertiesNames) = fill(0,Medium.nC) "Source trace substances" annotation (Evaluate=true, Dialog( tab="Fluid", - group="Composition values (active for flue gases only)")); - parameter ThermoSysPro.Units.SI.MassFraction Xso2=0 "SO2 mass fraction" - annotation (Evaluate=true, Dialog( - enable=(ftype == FluidType.FlueGases), + group="Medium")); + parameter Medium.ExtraProperty X0[Medium.nX]= Medium.X_default "Source mass fraction" annotation (Dialog( tab="Fluid", - group="Composition values (active for flue gases only)")); - -protected - parameter Boolean flue_gases=(ftype == FluidType.FlueGases) "Flue gases"; - parameter Integer mode=Integer(region) - 1 "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; + group="Medium")); public Units.SI.MassFlowRate Q "Fluid mass flow rate"; @@ -53,12 +33,12 @@ public Units.SI.Temperature T(start=300) "Fluid temperature"; ThermoSysPro.InstrumentationAndControl.Connectors.InputReal IPressure - "Fixed pressure" - annotation (Placement(transformation(extent={{-60,-10},{-40,10}}, rotation= - 0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C annotation (Placement( - transformation(extent={{90,-10},{110,10}}, rotation=0))); - InstrumentationAndControl.Connectors.InputReal ISpecificEnthalpyOrTemperature + "Fixed pressure" annotation (Placement(transformation(extent={{-60,-10},{-40, + 10}}, rotation=0))); + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C(redeclare package + Medium = Medium) annotation (Placement(transformation(extent={{90,-10},{110, + 10}}, rotation=0))); + InstrumentationAndControl.Connectors.InputReal ISpecificEnthalpyOrTemperature "Fixed specific enthalpy or temperature according to option_temperature" annotation (Placement(transformation( origin={0,-50}, @@ -73,19 +53,10 @@ equation C.diff_res_1 = 0; C.diff_on_1 = diffusion; - C.ftype = ftype; + C.SubC=SubC0; + + C.Xi = X0[1:Medium.nXi]; - if flue_gases then - C.Xco2 = Xco2; - C.Xh2o = Xh2o; - C.Xo2 = Xo2; - C.Xso2 = Xso2; - else - C.Xco2 = 0; - C.Xh2o = 0; - C.Xo2 = 0; - C.Xso2 = 0; - end if; if (cardinality(IPressure) == 0) then IPressure.signal = P0; @@ -104,10 +75,10 @@ equation if option_temperature then T = ISpecificEnthalpyOrTemperature.signal; - h = ThermoSysPro.Properties.Fluid.SpecificEnthalpy_PT(P, T, fluid, mode, Xco2, Xh2o, Xo2, Xso2); + h = Medium.specificEnthalpy_pTX(p=P, T=T, X=X0); else h = ISpecificEnthalpyOrTemperature.signal; - T = ThermoSysPro.Properties.Fluid.Temperature_Ph(P, h, fluid, mode, Xco2, Xh2o, Xo2, Xso2); + T = Medium.temperature_phX(p=P, h=h, X=X0); end if; /* Flow reversal */ From dcd8c526c4f1551209893c88ba126a6d69edfc0a Mon Sep 17 00:00:00 2001 From: VESCOVI Guilherme Date: Thu, 5 Jun 2025 16:26:57 +0200 Subject: [PATCH 020/178] #125 SinkQ --- .../Fluid/BoundaryConditions/SinkQ.mo | 45 +++++++------------ 1 file changed, 15 insertions(+), 30 deletions(-) diff --git a/ThermoSysPro/Fluid/BoundaryConditions/SinkQ.mo b/ThermoSysPro/Fluid/BoundaryConditions/SinkQ.mo index a9a8fc5f..a484d188 100644 --- a/ThermoSysPro/Fluid/BoundaryConditions/SinkQ.mo +++ b/ThermoSysPro/Fluid/BoundaryConditions/SinkQ.mo @@ -1,9 +1,9 @@ within ThermoSysPro.Fluid.BoundaryConditions; model SinkQ "Multi-fluids sink with fixed mass flow rate" + extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Units.SI.MassFlowRate Q0=100 "Mass flow (active if IMassFlow connector is not connected)"; parameter Units.SI.Temperature T0=290 @@ -16,39 +16,27 @@ model SinkQ "Multi-fluids sink with fixed mass flow rate" "true:temperature fixed - false:specific enthalpy fixed"; parameter Boolean diffusion=false "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; - parameter IF97Region region=IF97Region.All_regions "IF97 regions (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); - -protected - parameter Integer mode=Integer(region) - 1 "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; + parameter Medium.ExtraProperty SubC0[Medium.nC](quantity=Medium.extraPropertiesNames) = fill(0,Medium.nC) "Source trace substances" annotation (Evaluate=true, Dialog( + tab="Fluid", + group="Medium")); + parameter Medium.ExtraProperty X0[Medium.nX]= Medium.X_default "Source mass fraction" annotation (Dialog( + tab="Fluid", + group="Medium")); public Units.SI.MassFlowRate Q "Fluid mass flow rate"; Units.SI.AbsolutePressure P "Fluid pressure"; Units.SI.SpecificEnthalpy h "Fluid specific enthalpy"; Units.SI.Temperature T "Fluid temperature"; - FluidType ftype "Fluid type"; - Integer fluid=Integer(ftype) "Fluid number"; - Real Xco2(start=0.01) - "CO2 mass fraction of the fluid crossing the boundary of the control volume"; - Real Xh2o - "H2O mass fraction of the fluid crossing the boundary of the control volume"; - Real Xo2(start=0.2) - "O2 mass fraction of the fluid crossing the boundary of the control volume"; - Real Xso2(start=0) - "SO2 mass fraction of the fluid crossing the boundary of the control volume"; public - ThermoSysPro.InstrumentationAndControl.Connectors.InputReal IMassFlow - "Fixed mass flow rate" - annotation (Placement(transformation( + ThermoSysPro.InstrumentationAndControl.Connectors.InputReal IMassFlow "Fixed mass flow rate" annotation (Placement(transformation( origin={0,50}, extent={{-10,-10},{10,10}}, rotation=270))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-110,-10},{-90,10}}, rotation=0))); - InstrumentationAndControl.Connectors.InputReal ISpecificEnthalpyOrTemperature - "Fixed specific enthalpy or temperature according to option_temperature" - annotation (Placement(transformation( + InstrumentationAndControl.Connectors.InputReal ISpecificEnthalpyOrTemperature "Fixed specific enthalpy or temperature according to option_temperature" annotation (Placement(transformation( origin={0,-50}, extent={{10,-10},{-10,10}}, rotation=270))); @@ -61,12 +49,9 @@ equation C.diff_res_2 = 0; C.diff_on_2 = diffusion; - ftype = C.ftype; + C.SubC=SubC0; - Xco2 = C.Xco2; - Xh2o = C.Xh2o; - Xo2 = C.Xo2; - Xso2 = C.Xso2; + C.Xi = X0[1:Medium.nXi]; /* Mass flow */ if (cardinality(IMassFlow) == 0) then @@ -86,10 +71,10 @@ equation if option_temperature then T = ISpecificEnthalpyOrTemperature.signal; - h = ThermoSysPro.Properties.Fluid.SpecificEnthalpy_PT(P, T, fluid, mode, Xco2, Xh2o, Xo2, Xso2); + h = Medium.specificEnthalpy_pTX(p=P, T=T, X=X0); else h = ISpecificEnthalpyOrTemperature.signal; - T = ThermoSysPro.Properties.Fluid.Temperature_Ph(P, h, fluid, mode, Xco2, Xh2o, Xo2, Xso2); + T = Medium.temperature_phX(p=P, h=h, X=X0); end if; annotation ( From a61aa089f513b2667b310e294eb58073cbac09e4 Mon Sep 17 00:00:00 2001 From: VESCOVI Guilherme Date: Thu, 5 Jun 2025 16:32:29 +0200 Subject: [PATCH 021/178] #125 SinQ correction --- .../Fluid/BoundaryConditions/SinkQ.mo | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/ThermoSysPro/Fluid/BoundaryConditions/SinkQ.mo b/ThermoSysPro/Fluid/BoundaryConditions/SinkQ.mo index a484d188..fc18d9f9 100644 --- a/ThermoSysPro/Fluid/BoundaryConditions/SinkQ.mo +++ b/ThermoSysPro/Fluid/BoundaryConditions/SinkQ.mo @@ -16,18 +16,16 @@ model SinkQ "Multi-fluids sink with fixed mass flow rate" "true:temperature fixed - false:specific enthalpy fixed"; parameter Boolean diffusion=false "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; - parameter Medium.ExtraProperty SubC0[Medium.nC](quantity=Medium.extraPropertiesNames) = fill(0,Medium.nC) "Source trace substances" annotation (Evaluate=true, Dialog( - tab="Fluid", - group="Medium")); - parameter Medium.ExtraProperty X0[Medium.nX]= Medium.X_default "Source mass fraction" annotation (Dialog( - tab="Fluid", - group="Medium")); + public Units.SI.MassFlowRate Q "Fluid mass flow rate"; Units.SI.AbsolutePressure P "Fluid pressure"; Units.SI.SpecificEnthalpy h "Fluid specific enthalpy"; Units.SI.Temperature T "Fluid temperature"; + Medium.ExtraProperty SubC[Medium.nC](quantity=Medium.extraPropertiesNames, start=Medium.C_default) "Trace substances"; + Medium.MassFraction X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Mass fraction of the fluid crossing the boundary of the control volume"; + public ThermoSysPro.InstrumentationAndControl.Connectors.InputReal IMassFlow "Fixed mass flow rate" annotation (Placement(transformation( @@ -49,9 +47,10 @@ equation C.diff_res_2 = 0; C.diff_on_2 = diffusion; - C.SubC=SubC0; + X = C.Xi; + SubC = C.SubC; + - C.Xi = X0[1:Medium.nXi]; /* Mass flow */ if (cardinality(IMassFlow) == 0) then @@ -71,10 +70,10 @@ equation if option_temperature then T = ISpecificEnthalpyOrTemperature.signal; - h = Medium.specificEnthalpy_pTX(p=P, T=T, X=X0); + h = Medium.specificEnthalpy_pTX(p=P, T=T, X=X); else h = ISpecificEnthalpyOrTemperature.signal; - T = Medium.temperature_phX(p=P, h=h, X=X0); + T = Medium.temperature_phX(p=P, h=h, X=X); end if; annotation ( From 2e5559d7737c8ba9d2fd593337f4cdc0342f7c29 Mon Sep 17 00:00:00 2001 From: VESCOVI Guilherme Date: Thu, 5 Jun 2025 16:47:33 +0200 Subject: [PATCH 022/178] #125 StodolaTurbine added SubC --- ThermoSysPro/Fluid/Machines/StodolaTurbine.mo | 1 + 1 file changed, 1 insertion(+) diff --git a/ThermoSysPro/Fluid/Machines/StodolaTurbine.mo b/ThermoSysPro/Fluid/Machines/StodolaTurbine.mo index 0d8405f8..63e6186b 100644 --- a/ThermoSysPro/Fluid/Machines/StodolaTurbine.mo +++ b/ThermoSysPro/Fluid/Machines/StodolaTurbine.mo @@ -101,6 +101,7 @@ equation Ce.Xi = Cs.Xi; X = Ce.Xi; + Ce.SubC = Cs.SubC; Q = Ce.Q; Pe = Ce.P; From 533944ab31eeaaf052df771cf13f3814f41baf3a Mon Sep 17 00:00:00 2001 From: VESCOVI Guilherme Date: Thu, 5 Jun 2025 17:05:05 +0200 Subject: [PATCH 023/178] #125 SinkP --- .../Fluid/BoundaryConditions/SinkP.mo | 36 ++++++------------- 1 file changed, 10 insertions(+), 26 deletions(-) diff --git a/ThermoSysPro/Fluid/BoundaryConditions/SinkP.mo b/ThermoSysPro/Fluid/BoundaryConditions/SinkP.mo index 5a7507e2..69898d68 100644 --- a/ThermoSysPro/Fluid/BoundaryConditions/SinkP.mo +++ b/ThermoSysPro/Fluid/BoundaryConditions/SinkP.mo @@ -1,11 +1,9 @@ within ThermoSysPro.Fluid.BoundaryConditions; model SinkP "Multi-fluid sink with fixed pressure" - extends - ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidTypeVariableInterface; + extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Units.SI.AbsolutePressure P0=100000 "Sink pressure"; parameter Units.SI.Temperature T0=290 "Source temperature (active if option_temperature=true)" @@ -17,26 +15,16 @@ model SinkP "Multi-fluid sink with fixed pressure" "true:temperature fixed - false:specific enthalpy fixed"; parameter Boolean diffusion=false "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; - parameter IF97Region region=IF97Region.All_regions "IF97 regions (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); + Medium.ExtraProperty SubC[Medium.nC](quantity=Medium.extraPropertiesNames, start=Medium.C_default) "Trace substances"; + Medium.MassFraction X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Mass fraction of the fluid crossing the boundary of the control volume"; -protected - parameter Integer mode=Integer(region) - 1 "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; public Units.SI.MassFlowRate Q "Fluid mass flow rate"; Units.SI.AbsolutePressure P "Fluid pressure"; Units.SI.SpecificEnthalpy h "Fluid specific enthalpy"; Units.SI.Temperature T "Fluid temperature"; - FluidType ftype "Fluid type"; - Integer fluid=Integer(ftype) "Fluid number"; - ThermoSysPro.Units.SI.MassFraction Xco2(start=0.01) - "CO2 mass fraction of the fluid crossing the boundary of the control volume"; - ThermoSysPro.Units.SI.MassFraction Xh2o - "H2O mass fraction of the fluid crossing the boundary of the control volume"; - ThermoSysPro.Units.SI.MassFraction Xo2(start=0.2) - "O2 mass fraction of the fluid crossing the boundary of the control volume"; - ThermoSysPro.Units.SI.MassFraction Xso2(start=0) - "SO2 mass fraction of the fluid crossing the boundary of the control volume"; + public ThermoSysPro.InstrumentationAndControl.Connectors.InputReal IPressure "Fixed pressure" @@ -44,7 +32,7 @@ public origin={50,0}, extent={{-10,-10},{10,10}}, rotation=180))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-110,-10},{-90,10}}, rotation=0))); InstrumentationAndControl.Connectors.InputReal ISpecificEnthalpyOrTemperature "Fixed specific enthalpy or temperature according to option_temperature" @@ -61,12 +49,8 @@ equation C.diff_res_2 = 0; C.diff_on_2 = diffusion; - ftype = C.ftype; - - Xco2 = C.Xco2; - Xh2o = C.Xh2o; - Xo2 = C.Xo2; - Xso2 = C.Xso2; + X = C.Xi; + SubC = C.SubC; if (cardinality(IPressure) == 0) then IPressure.signal = P0; @@ -85,10 +69,10 @@ equation if option_temperature then T = ISpecificEnthalpyOrTemperature.signal; - h = ThermoSysPro.Properties.Fluid.SpecificEnthalpy_PT(P, T, fluid, mode, Xco2, Xh2o, Xo2, Xso2); + h = Medium.specificEnthalpy_pTX(p=P, T=T, X=X); else h = ISpecificEnthalpyOrTemperature.signal; - T = ThermoSysPro.Properties.Fluid.Temperature_Ph(P, h, fluid, mode, Xco2, Xh2o, Xo2, Xso2); + T = Medium.temperature_phX(p=P, h=h, X=X); end if; annotation ( From 3b5140dade765783b10d2e48c870f74701c799d4 Mon Sep 17 00:00:00 2001 From: VESCOVI Guilherme Date: Thu, 5 Jun 2025 17:18:24 +0200 Subject: [PATCH 024/178] #125 SinkPQ --- .../Fluid/BoundaryConditions/SinkPQ.mo | 67 ++++++------------- 1 file changed, 20 insertions(+), 47 deletions(-) diff --git a/ThermoSysPro/Fluid/BoundaryConditions/SinkPQ.mo b/ThermoSysPro/Fluid/BoundaryConditions/SinkPQ.mo index 8b874a0a..070d0124 100644 --- a/ThermoSysPro/Fluid/BoundaryConditions/SinkPQ.mo +++ b/ThermoSysPro/Fluid/BoundaryConditions/SinkPQ.mo @@ -1,61 +1,38 @@ within ThermoSysPro.Fluid.BoundaryConditions; model SinkPQ "MultiFluids sink with fixed pressure and mass flow rate" - extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - parameter Units.SI.AbsolutePressure P0=100000 - "Fluid pressure (active if IPressure connector is not connected)"; - parameter Units.SI.MassFlowRate Q0=100 - "Mass flow (active if IMassFlow connector is not connected)"; - parameter Units.SI.Temperature T0=290 - "Source temperature (active if option_temperature=true)" - annotation (Evaluate=true, Dialog(enable=option_temperature)); - parameter Units.SI.SpecificEnthalpy h0=100000 - "Source specific enthalpy (active if option_temperature=false)" - annotation (Evaluate=true, Dialog(enable=not option_temperature)); - parameter Boolean option_temperature=false - "true:temperature fixed - false:specific enthalpy fixed"; - parameter Boolean diffusion=false - "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; - parameter IF97Region region=IF97Region.All_regions "IF97 regions (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); + extends ThermoSysPro.Fluid.Interfaces.IconColors; -protected - parameter Integer mode=Integer(region) - 1 "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", + group="Medium")); + parameter Units.SI.AbsolutePressure P0=100000 "Fluid pressure (active if IPressure connector is not connected)"; + parameter Units.SI.MassFlowRate Q0=100 "Mass flow (active if IMassFlow connector is not connected)"; + parameter Units.SI.Temperature T0=290 "Source temperature (active if option_temperature=true)" annotation (Evaluate=true, Dialog(enable=option_temperature)); + parameter Units.SI.SpecificEnthalpy h0=100000 "Source specific enthalpy (active if option_temperature=false)" annotation (Evaluate=true, Dialog(enable=not option_temperature)); + parameter Boolean option_temperature=false "true:temperature fixed - false:specific enthalpy fixed"; + parameter Boolean diffusion=false "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; public Units.SI.MassFlowRate Q "Fluid mass flow rate"; Units.SI.AbsolutePressure P "Fluid pressure"; Units.SI.SpecificEnthalpy h "Fluid specific enthalpy"; Units.SI.Temperature T "Fluid temperature"; - FluidType ftype "Fluid type"; - Integer fluid=Integer(ftype) "Fluid number"; - Real Xco2(start=0.01) - "CO2 mass fraction of the fluid crossing the boundary of the control volume"; - Real Xh2o - "H2O mass fraction of the fluid crossing the boundary of the control volume"; - Real Xo2(start=0.2) - "O2 mass fraction of the fluid crossing the boundary of the control volume"; - Real Xso2(start=0) - "SO2 mass fraction of the fluid crossing the boundary of the control volume"; + Medium.ExtraProperty SubC[Medium.nC](quantity=Medium.extraPropertiesNames, start=Medium.C_default) "Trace substances"; + Medium.MassFraction X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Mass fraction of the fluid crossing the boundary of the control volume"; + public - ThermoSysPro.InstrumentationAndControl.Connectors.InputReal IMassFlow - "Fixed mass flow rate" - annotation (Placement(transformation( + ThermoSysPro.InstrumentationAndControl.Connectors.InputReal IMassFlow "Fixed mass flow rate" annotation (Placement(transformation( origin={0,50}, extent={{-10,-10},{10,10}}, rotation=270))); - ThermoSysPro.InstrumentationAndControl.Connectors.InputReal IPressure - "Fixed pressure" - annotation (Placement(transformation( + ThermoSysPro.InstrumentationAndControl.Connectors.InputReal IPressure "Fixed pressure" annotation (Placement(transformation( origin={50,0}, extent={{-10,-10},{10,10}}, rotation=180))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-110,-10},{-90,10}}, rotation=0))); - InstrumentationAndControl.Connectors.InputReal ISpecificEnthalpyOrTemperature - "Fixed specific enthalpy or temperature according to option_temperature" + InstrumentationAndControl.Connectors.InputReal ISpecificEnthalpyOrTemperature "Fixed specific enthalpy or temperature according to option_temperature" annotation (Placement(transformation( origin={0,-50}, extent={{10,-10},{-10,10}}, @@ -69,12 +46,8 @@ equation C.diff_res_2 = 0; C.diff_on_2 = diffusion; - ftype = C.ftype; - - Xco2 = C.Xco2; - Xh2o = C.Xh2o; - Xo2 = C.Xo2; - Xso2 = C.Xso2; + X = C.Xi; + SubC = C.SubC; /* Mass flow */ if (cardinality(IMassFlow) == 0) then @@ -101,10 +74,10 @@ equation if option_temperature then T = ISpecificEnthalpyOrTemperature.signal; - h = ThermoSysPro.Properties.Fluid.SpecificEnthalpy_PT(P, T, fluid, mode, Xco2, Xh2o, Xo2, Xso2); + h = Medium.specificEnthalpy_pTX(p=P, T=T, X=X); else h = ISpecificEnthalpyOrTemperature.signal; - T = ThermoSysPro.Properties.Fluid.Temperature_Ph(P, h, fluid, mode, Xco2, Xh2o, Xo2, Xso2); + T = Medium.temperature_phX(p=P, h=h, X=X); end if; annotation ( From 00551385f42eff89b31f2d864bb0aad8246f19d0 Mon Sep 17 00:00:00 2001 From: VESCOVI Guilherme Date: Thu, 5 Jun 2025 17:35:35 +0200 Subject: [PATCH 025/178] #125 Source --- .../Fluid/BoundaryConditions/Source.mo | 71 +++++-------------- 1 file changed, 16 insertions(+), 55 deletions(-) diff --git a/ThermoSysPro/Fluid/BoundaryConditions/Source.mo b/ThermoSysPro/Fluid/BoundaryConditions/Source.mo index b28eb04f..16a1eea2 100644 --- a/ThermoSysPro/Fluid/BoundaryConditions/Source.mo +++ b/ThermoSysPro/Fluid/BoundaryConditions/Source.mo @@ -1,49 +1,20 @@ within ThermoSysPro.Fluid.BoundaryConditions; model Source "MultiFluids Source" - extends - ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidTypeParameterInterface; - extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; - parameter Units.SI.Temperature T0=290 - "Source temperature (active if option_temperature=true)" - annotation (Evaluate=true, Dialog(enable=option_temperature)); - parameter Units.SI.SpecificEnthalpy h0=100000 - "Source specific enthalpy (active if option_temperature=false)" - annotation (Evaluate=true, Dialog(enable=not option_temperature)); - parameter Boolean option_temperature=false - "true:temperature fixed - false:specific enthalpy fixed"; - parameter Boolean continuous_flow_reversal=false - "true: continuous flow reversal - false: discontinuous flow reversal"; - parameter Boolean diffusion=false - "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; - parameter IF97Region region=IF97Region.All_regions "IF97 regions (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); + extends ThermoSysPro.Fluid.Interfaces.IconColors; - parameter ThermoSysPro.Units.SI.MassFraction Xco2= 0.01 "CO2 mass fraction" - annotation (Evaluate=true, Dialog( - enable=(ftype == FluidType.FlueGases), - tab="Fluid", - group="Composition values (active for flue gases only)")); - parameter ThermoSysPro.Units.SI.MassFraction Xh2o=if ftype == FluidType.FlueGases then 0.05 else 0 "H2O mass fraction" - annotation (Evaluate=true, Dialog( - enable=(ftype == FluidType.FlueGases), - tab="Fluid", - group="Composition values (active for flue gases only)")); - parameter ThermoSysPro.Units.SI.MassFraction Xo2= 0.22 "O2 mass fraction" - annotation (Evaluate=true, Dialog( - enable=(ftype == FluidType.FlueGases), + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + parameter Units.SI.Temperature T0=290 "Source temperature (active if option_temperature=true)" annotation (Evaluate=true, Dialog(enable=option_temperature)); + parameter Units.SI.SpecificEnthalpy h0=100000 "Source specific enthalpy (active if option_temperature=false)" annotation (Evaluate=true, Dialog(enable=not option_temperature)); + parameter Boolean option_temperature=false "true:temperature fixed - false:specific enthalpy fixed"; + parameter Boolean continuous_flow_reversal=false "true: continuous flow reversal - false: discontinuous flow reversal"; + parameter Boolean diffusion=false "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; + parameter Medium.ExtraProperty SubC0[Medium.nC](quantity=Medium.extraPropertiesNames) = fill(0,Medium.nC) "Source trace substances" annotation (Evaluate=true, Dialog( tab="Fluid", - group="Composition values (active for flue gases only)")); - parameter ThermoSysPro.Units.SI.MassFraction Xso2= 0 "SO2 mass fraction" - annotation (Evaluate=true, Dialog( - enable=(ftype == FluidType.FlueGases), + group="Medium")); + parameter Medium.ExtraProperty X0[Medium.nX]= Medium.X_default "Source mass fraction" annotation (Dialog( tab="Fluid", - group="Composition values (active for flue gases only)")); - -protected - parameter Boolean flue_gases=(ftype == FluidType.FlueGases) "Flue gases"; - parameter Integer mode=Integer(region) - 1 "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; + group="Medium")); public Units.SI.MassFlowRate Q "Fluid mass flow rate"; @@ -51,7 +22,7 @@ public Units.SI.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy"; Units.SI.Temperature T(start=300) "Fluid temperature"; - Interfaces.Connectors.FluidOutlet C annotation (Placement(transformation( + Interfaces.Connectors.FluidOutlet C(redeclare package Medium = Medium) annotation (Placement(transformation( extent={{90,-10},{110,10}}, rotation=0))); InstrumentationAndControl.Connectors.InputReal ISpecificEnthalpyOrTemperature "Fixed specific enthalpy or temperature according to option_temperature" @@ -68,19 +39,9 @@ equation C.diff_res_1 = 0; C.diff_on_1 = diffusion; - ftype = C.ftype; + C.SubC=SubC0; - if flue_gases then - C.Xco2 = Xco2; - C.Xh2o = Xh2o; - C.Xo2 = Xo2; - C.Xso2 = Xso2; - else - C.Xco2 = 0; - C.Xh2o = 0; - C.Xo2 = 0; - C.Xso2 = 0; - end if; + C.Xi = X0[1:Medium.nXi]; /* Specific enthalpy or temperature */ if (cardinality(ISpecificEnthalpyOrTemperature) == 0) then @@ -93,10 +54,10 @@ equation if option_temperature then T = ISpecificEnthalpyOrTemperature.signal; - h = ThermoSysPro.Properties.Fluid.SpecificEnthalpy_PT(P, T, fluid, mode, Xco2, Xh2o, Xo2, Xso2); + h = Medium.specificEnthalpy_pTX(p=P, T=T, X=X0); else h = ISpecificEnthalpyOrTemperature.signal; - T = ThermoSysPro.Properties.Fluid.Temperature_Ph(P, h, fluid, mode, Xco2, Xh2o, Xo2, Xso2); + T = Medium.temperature_phX(p=P, h=h, X=X0); end if; /* Flow reversal */ From 2b30c3c0c38a033e9969dca890abd017dbd7fb4a Mon Sep 17 00:00:00 2001 From: VESCOVI Guilherme Date: Wed, 11 Jun 2025 10:55:53 +0200 Subject: [PATCH 026/178] #125 StodolaTurbine corrected example and added traces example --- .../Machines/TestStodolaTurbine.mo | 20 ++++++++---- .../Machines/TestStodolaTurbine_Traces.mo | 31 +++++++++++++++++++ .../SimpleExamples/Machines/package.order | 1 + 3 files changed, 46 insertions(+), 6 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStodolaTurbine_Traces.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStodolaTurbine.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStodolaTurbine.mo index 4d29ef69..b549ea80 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStodolaTurbine.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStodolaTurbine.mo @@ -2,15 +2,23 @@ within ThermoSysPro.Fluid.Examples.SimpleExamples.Machines; model TestStodolaTurbine extends ThermoSysPro.UsersGuide.Icons.Example; - ThermoSysPro.Fluid.Machines.StodolaTurbine stodolaTurbine(Cst=400000) +replaceable package Medium = Properties.Media.WaterSteam; + + ThermoSysPro.Fluid.Machines.StodolaTurbine stodolaTurbine( + redeclare replaceable package Medium = Medium, + Cst=4100, + Ps(start=5000), + rhos(start=1.22)) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ( - P0=4500000, - Q0=1800, - T0=573.15, - option_temperature=true) + redeclare replaceable package Medium = Medium, + P0=300000, + Q0=200, + h0=3e6, + option_temperature=false) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.Sink sink + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package + Medium = Medium) annotation (Placement(transformation(extent={{26,-10},{46,10}}))); equation connect(sourcePQ.C, stodolaTurbine.Ce) diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStodolaTurbine_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStodolaTurbine_Traces.mo new file mode 100644 index 00000000..adcb506f --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStodolaTurbine_Traces.mo @@ -0,0 +1,31 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Machines; +model TestStodolaTurbine_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + +replaceable package Medium = Properties.Media.WaterSteam(extraPropertiesNames={"Trace1", "Trace2", "Trace3", "Trace4"}, C_nominal={0.1, 0.2, 0.3, 0.4}, C_default={0.2, 0.3, 0.4, 0.5}); + + ThermoSysPro.Fluid.Machines.StodolaTurbine stodolaTurbine( + redeclare replaceable package Medium = Medium, + Cst=4100, + Ps(start=5000), + rhos(start=1.22)) + annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ( + redeclare replaceable package Medium = Medium, + P0=300000, + Q0=200, + h0=3e6, + SubC0={40,50,60,70}, + option_temperature=false) + annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package + Medium = Medium) + annotation (Placement(transformation(extent={{26,-10},{46,10}}))); +equation + connect(sourcePQ.C, stodolaTurbine.Ce) + annotation (Line(points={{-30,0},{-10.1,0}}, color={0,0,0})); + connect(stodolaTurbine.Cs, sink.C) + annotation (Line(points={{10.1,0},{26,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( + coordinateSystem(preserveAspectRatio=false))); +end TestStodolaTurbine_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/package.order index 4bf87c1a..7733024e 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/package.order @@ -1 +1,2 @@ TestStodolaTurbine +TestStodolaTurbine_Traces From f53c3f5d82df5fb21f52fcc70f810db3ea1cd6ac Mon Sep 17 00:00:00 2001 From: VESCOVI Guilherme Date: Wed, 11 Jun 2025 12:08:36 +0200 Subject: [PATCH 027/178] #125 ControlValve --- .../PressureLosses/TestControlValve.mo | 29 ++++++++++++++++ .../PressureLosses/TestControlValve_Traces.mo | 30 ++++++++++++++++ .../TestControlValve_Traces_FlueGases.mo | 34 +++++++++++++++++++ .../PressureLosses/package.order | 3 ++ .../Fluid/PressureLosses/ControlValve.mo | 26 +++++++------- 5 files changed, 109 insertions(+), 13 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestControlValve.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestControlValve_Traces.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestControlValve_Traces_FlueGases.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestControlValve.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestControlValve.mo new file mode 100644 index 00000000..28e578c2 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestControlValve.mo @@ -0,0 +1,29 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.PressureLosses; +model TestControlValve + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam; + + ThermoSysPro.Fluid.PressureLosses.ControlValve controlValve( + redeclare replaceable package Medium = Medium, caract=[0,0; 0.5,3000; 0.75, + 7000; 1,8000]) + annotation (Placement(transformation(extent={{-10,-4},{10,16}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package + Medium = Medium) + annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare + replaceable package Medium = Medium, Q0=2580) + annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + InstrumentationAndControl.Blocks.Tables.Table1DTemps Constante1(Table=[0,0.9; + 5,0.9; 15,0.5; 25,0.5; 50,0.2; 100,0.2]) + annotation (Placement(transformation(extent={{-30,34},{-10,54}}, rotation=0))); +equation + connect(controlValve.C2, sink.C) + annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(controlValve.C1, sourcePQ.C) + annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); + connect(Constante1.y, controlValve.Ouv) + annotation (Line(points={{-9,44},{0,44},{0,17}}, color={0,0,255})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( + coordinateSystem(preserveAspectRatio=false))); +end TestControlValve; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestControlValve_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestControlValve_Traces.mo new file mode 100644 index 00000000..f79d0787 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestControlValve_Traces.mo @@ -0,0 +1,30 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.PressureLosses; +model TestControlValve_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam(extraPropertiesNames={"Trace1", "Trace2"}, C_nominal={0.1, 2}, C_default={0.2, 5}); + + ThermoSysPro.Fluid.PressureLosses.ControlValve controlValve( + redeclare replaceable package Medium = Medium, caract=[0,0; 0.5,3000; 0.75, + 7000; 1,8000]) + annotation (Placement(transformation(extent={{-10,-4},{10,16}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package + Medium = Medium) + annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare + replaceable package Medium = Medium, + SubC0={10,20}, Q0=2580) + annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + InstrumentationAndControl.Blocks.Tables.Table1DTemps Constante1(Table=[0,0.9; + 5,0.9; 15,0.5; 25,0.5; 50,0.2; 100,0.2]) + annotation (Placement(transformation(extent={{-30,34},{-10,54}}, rotation=0))); +equation + connect(controlValve.C2, sink.C) + annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(controlValve.C1, sourcePQ.C) + annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); + connect(Constante1.y, controlValve.Ouv) + annotation (Line(points={{-9,44},{0,44},{0,17}}, color={0,0,255})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( + coordinateSystem(preserveAspectRatio=false))); +end TestControlValve_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestControlValve_Traces_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestControlValve_Traces_FlueGases.mo new file mode 100644 index 00000000..1e2d861d --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestControlValve_Traces_FlueGases.mo @@ -0,0 +1,34 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.PressureLosses; +model TestControlValve_Traces_FlueGases + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.FlueGases(extraPropertiesNames={"Trace1", "Trace2"}, C_nominal={0.1, 2}, C_default={0.2, 5}); + + ThermoSysPro.Fluid.PressureLosses.ControlValve controlValve( + redeclare replaceable package Medium = Medium, + Cvmax=50000, caract=[0,0; 0.5,3000; 0.75, + 7000; 1,8000], + Pm(start=200000)) + annotation (Placement(transformation(extent={{-10,-4},{10,16}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package + Medium = Medium, h0=2538785.2) + annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare + replaceable package Medium = Medium, + h0=2538785.2, + SubC0={10,20}, X0={0.1,0.2,0.3,0.2,0.2}, + Q0=8) + annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + InstrumentationAndControl.Blocks.Tables.Table1DTemps Constante1(Table=[0,0.9; + 5,0.9; 15,0.5; 25,0.5; 50,0.2; 100,0.2]) + annotation (Placement(transformation(extent={{-30,34},{-10,54}}, rotation=0))); +equation + connect(controlValve.C2, sink.C) + annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(controlValve.C1, sourcePQ.C) + annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); + connect(Constante1.y, controlValve.Ouv) + annotation (Line(points={{-9,44},{0,44},{0,17}}, color={0,0,255})); + annotation (experiment(StopTime=80), Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( + coordinateSystem(preserveAspectRatio=false))); +end TestControlValve_Traces_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order index 21b7a582..e89506ae 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order @@ -4,3 +4,6 @@ TestPipePressureLoss_Traces TestSingularPressureLoss TestSingularPressureLoss_Traces TestSingularPressureLoss_Traces_FlueGases +TestControlValve +TestControlValve_Traces +TestControlValve_Traces_FlueGases diff --git a/ThermoSysPro/Fluid/PressureLosses/ControlValve.mo b/ThermoSysPro/Fluid/PressureLosses/ControlValve.mo index 503d318e..64511ae9 100644 --- a/ThermoSysPro/Fluid/PressureLosses/ControlValve.mo +++ b/ThermoSysPro/Fluid/PressureLosses/ControlValve.mo @@ -1,6 +1,7 @@ within ThermoSysPro.Fluid.PressureLosses; model ControlValve "Control valve" - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; +extends ThermoSysPro.Fluid.Interfaces.IconColors; + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; parameter ThermoSysPro.Units.xSI.Cv Cvmax=8005.42 @@ -32,8 +33,7 @@ public Units.SI.Temperature T(start=290) "Fluid temperature"; Units.SI.AbsolutePressure Pm(start=1.e5) "Fluid average pressure"; Units.SI.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy"; - FluidType ftype "Fluid type"; - Integer fluid=Integer(ftype) "Fluid number"; + Medium.MassFraction X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Mass fractions"; public ThermoSysPro.InstrumentationAndControl.Connectors.InputReal Ouv @@ -41,9 +41,9 @@ public origin={0,110}, extent={{-10,-10},{10,10}}, rotation=270))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-110,-70},{-90,-50}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{90,-70},{110,-50}}, rotation=0))); equation @@ -59,18 +59,18 @@ equation C2.diff_res_1 = C1.diff_res_1 + (if (gamma_diff > 0) then 1/gamma_diff else 0); C1.diff_res_2 = C2.diff_res_2 + (if (gamma_diff > 0) then 1/gamma_diff else 0); - C1.ftype = C2.ftype; + C1.Xi = C2.Xi; - C1.Xco2 = C2.Xco2; - C1.Xh2o = C2.Xh2o; - C1.Xo2 = C2.Xo2; - C1.Xso2 = C2.Xso2; + X = C1.Xi; + + + C1.SubC = C2.SubC; Q = C1.Q; h = C1.h; deltaP = C1.P - C2.P; - ftype = C1.ftype; + /* Pressure loss */ if (option_rho_water == 1) then @@ -99,12 +99,12 @@ equation /* Fluid thermodynamic properties */ Pm = (C1.P + C2.P)/2; - T = ThermoSysPro.Properties.Fluid.Temperature_Ph(Pm, h, fluid, mode, C1.Xco2, C1.Xh2o, C1.Xo2, C1.Xso2); + T = Medium.temperature_phX(p=Pm, h=h, X=X); if (p_rho > 0) then rho = p_rho; else - rho = ThermoSysPro.Properties.Fluid.Density_Ph(Pm, h, fluid, mode, C1.Xco2, C1.Xh2o, C1.Xo2, C1.Xso2); + rho = Medium.density_phX(p=Pm, h=h, X=X); end if; annotation ( Icon(coordinateSystem( From cc7127fc9ccb6c4ece3fafcd59d29de34a0c6045 Mon Sep 17 00:00:00 2001 From: VESCOVI Guilherme Date: Fri, 13 Jun 2025 16:49:07 +0200 Subject: [PATCH 028/178] #125 RefT --- ThermoSysPro/Fluid/BoundaryConditions/RefT.mo | 32 +++++++---------- .../BoundaryConditions/TestRefT.mo | 33 +++++++++++++++++ .../BoundaryConditions/TestRefT_Traces.mo | 35 +++++++++++++++++++ .../BoundaryConditions/package.order | 2 ++ 4 files changed, 83 insertions(+), 19 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefT.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefT_Traces.mo diff --git a/ThermoSysPro/Fluid/BoundaryConditions/RefT.mo b/ThermoSysPro/Fluid/BoundaryConditions/RefT.mo index a5795521..7aeecfc4 100644 --- a/ThermoSysPro/Fluid/BoundaryConditions/RefT.mo +++ b/ThermoSysPro/Fluid/BoundaryConditions/RefT.mo @@ -1,28 +1,24 @@ within ThermoSysPro.Fluid.BoundaryConditions; model RefT "Fixed temperature reference" extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); - parameter Units.SI.Temperature T0=290 "Fixed fluid temperature"; - parameter IF97Region region=IF97Region.All_regions "IF97 region (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); -protected - parameter Integer mode=Integer(region) - 1 "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; + parameter Units.SI.Temperature T0=290 "Fixed fluid temperature"; public Units.SI.MassFlowRate Q "Fluid mass flow rate"; Units.SI.AbsolutePressure P "Fluid pressure"; Units.SI.SpecificEnthalpy h "Fluid specific enthalpy"; - FluidType ftype "Fluid type"; - Integer fluid=Integer(ftype) "Fluid number"; + Medium.MassFraction X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Mass fractions"; + - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1 annotation (Placement( + + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-110,-10},{-90,10}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{90,-10},{110,10}}, rotation=0))); - ThermoSysPro.InstrumentationAndControl.Connectors.InputReal ITemperature - annotation (Placement(transformation( + ThermoSysPro.InstrumentationAndControl.Connectors.InputReal ITemperature annotation (Placement(transformation( origin={0,110}, extent={{-10,-10},{10,10}}, rotation=270))); @@ -45,21 +41,19 @@ equation C2.diff_res_1 = C1.diff_res_1; C1.diff_res_2 = C2.diff_res_2; - C1.ftype = C2.ftype; + C1.Xi = C2.Xi; + + X = C1.Xi; - C1.Xco2 = C2.Xco2; - C1.Xh2o = C2.Xh2o; - C1.Xo2 = C2.Xo2; - C1.Xso2 = C2.Xso2; + C1.SubC = C2.SubC; Q = C1.Q; P = C1.P; h = C1.h; - ftype = C1.ftype; /* Computation of the fluid specific enthalpy */ - h = ThermoSysPro.Properties.Fluid.SpecificEnthalpy_PT(P, ITemperature.signal, fluid, mode, C1.Xco2, C1.Xh2o, C1.Xo2, C1.Xso2); + h = Medium.specificEnthalpy_pTX(p=P, T=ITemperature.signal, X=X); annotation ( Diagram(coordinateSystem( diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefT.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefT.mo new file mode 100644 index 00000000..8e00782c --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefT.mo @@ -0,0 +1,33 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.BoundaryConditions; +model TestRefT + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam; + + + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare package Medium = + Medium) + annotation (Placement(transformation(extent={{66,-10},{86,10}}))); + ThermoSysPro.Fluid.PressureLosses.PipePressureLoss pipePressureLoss( + redeclare package Medium = Medium) + annotation (Placement(transformation(extent={{32,-10},{52,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.RefT refT(redeclare package Medium = + Medium) + annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare package + Medium = Medium, h0=2600e3) + annotation (Placement(transformation(extent={{-66,-10},{-46,10}}))); + InstrumentationAndControl.Blocks.Sources.Constante constante(k=120 + 273.15) + annotation (Placement(transformation(extent={{-30,38},{-10,58}}))); +equation + connect(sink.C, pipePressureLoss.C2) + annotation (Line(points={{66,0},{52,0}}, color={0,0,0})); + connect(refT.C2, pipePressureLoss.C1) + annotation (Line(points={{10,0},{32,0}}, color={0,0,0})); + connect(sourceQ.C, refT.C1) + annotation (Line(points={{-46,0},{-10,0}}, color={0,0,0})); + connect(constante.y, refT.ITemperature) + annotation (Line(points={{-9,48},{0,48},{0,11}}, color={0,0,255})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( + coordinateSystem(preserveAspectRatio=false))); +end TestRefT; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefT_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefT_Traces.mo new file mode 100644 index 00000000..061c7084 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefT_Traces.mo @@ -0,0 +1,35 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.BoundaryConditions; +model TestRefT_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam(extraPropertiesNames={"Trace1", "Trace2", "Trace3"}, C_nominal={0.1, 0.2, 0.3}, C_default={0.2, 0.3, 0.4}); + + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package + Medium = + Medium) + annotation (Placement(transformation(extent={{66,-10},{86,10}}))); + ThermoSysPro.Fluid.PressureLosses.PipePressureLoss pipePressureLoss( + redeclare replaceable package Medium = Medium) + annotation (Placement(transformation(extent={{32,-10},{52,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.RefT refT(redeclare replaceable package + Medium = + Medium) + annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare replaceable + package + Medium = Medium, h0=2600e3, SubC0={10,20,30}) + annotation (Placement(transformation(extent={{-66,-10},{-46,10}}))); + InstrumentationAndControl.Blocks.Sources.Constante constante(k=120 + 273.15) + annotation (Placement(transformation(extent={{-30,38},{-10,58}}))); +equation + connect(sink.C, pipePressureLoss.C2) + annotation (Line(points={{66,0},{52,0}}, color={0,0,0})); + connect(refT.C2, pipePressureLoss.C1) + annotation (Line(points={{10,0},{32,0}}, color={0,0,0})); + connect(sourceQ.C, refT.C1) + annotation (Line(points={{-46,0},{-10,0}}, color={0,0,0})); + connect(constante.y, refT.ITemperature) + annotation (Line(points={{-9,48},{0,48},{0,11}}, color={0,0,255})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( + coordinateSystem(preserveAspectRatio=false))); +end TestRefT_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/package.order index e69de29b..0f8ee6d3 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/package.order @@ -0,0 +1,2 @@ +TestRefT +TestRefT_Traces From adb13a68eb52f3bc9e29a5821e0688ef8c9f4940 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Mon, 16 Jun 2025 11:08:38 +0200 Subject: [PATCH 029/178] #125 TwoPhase medium for StodaTurbine, constrainedby medium to subC medium --- ThermoSysPro/Fluid/BoundaryConditions/Sink.mo | 2 +- .../Fluid/BoundaryConditions/SourcePQ.mo | 2 +- .../Fluid/BoundaryConditions/SourceQ.mo | 2 +- .../Machines/TestStodolaTurbine.mo | 3 +-- ThermoSysPro/Fluid/Machines/StodolaTurbine.mo | 22 +++++++++---------- .../Fluid/PressureLosses/PipePressureLoss.mo | 2 +- .../PressureLosses/SingularPressureLoss.mo | 2 +- ThermoSysPro/Fluid/Volumes/VolumeC.mo | 2 +- 8 files changed, 18 insertions(+), 19 deletions(-) diff --git a/ThermoSysPro/Fluid/BoundaryConditions/Sink.mo b/ThermoSysPro/Fluid/BoundaryConditions/Sink.mo index f2e804a2..6fbe1d79 100644 --- a/ThermoSysPro/Fluid/BoundaryConditions/Sink.mo +++ b/ThermoSysPro/Fluid/BoundaryConditions/Sink.mo @@ -3,7 +3,7 @@ model Sink "MultiFluids sink" extends ThermoSysPro.Fluid.Interfaces.IconColors; - replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Units.SI.Temperature T0=290 "Source temperature (active if option_temperature=true)" annotation (Evaluate=true, Dialog(enable=option_temperature)); parameter Units.SI.SpecificEnthalpy h0=100000 "Source specific enthalpy (active if option_temperature=false)" annotation (Evaluate=true, Dialog(enable=not option_temperature)); parameter Boolean option_temperature=false "true:temperature fixed - false:specific enthalpy fixed"; diff --git a/ThermoSysPro/Fluid/BoundaryConditions/SourcePQ.mo b/ThermoSysPro/Fluid/BoundaryConditions/SourcePQ.mo index 29d16491..3edfecd1 100644 --- a/ThermoSysPro/Fluid/BoundaryConditions/SourcePQ.mo +++ b/ThermoSysPro/Fluid/BoundaryConditions/SourcePQ.mo @@ -3,7 +3,7 @@ model SourcePQ "MultiFluids source with fixed pressure and mass flow rate" extends ThermoSysPro.Fluid.Interfaces.IconColors; - replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Units.SI.AbsolutePressure P0=300000 "Fluid pressure (active if IPressure connector is not connected)"; parameter Units.SI.MassFlowRate Q0=100 "Mass flow (active if IMassFlow connector is not connected)"; parameter Units.SI.Temperature T0=290 "Source temperature (active if option_temperature=true)" annotation (Evaluate=true, Dialog(enable=option_temperature)); diff --git a/ThermoSysPro/Fluid/BoundaryConditions/SourceQ.mo b/ThermoSysPro/Fluid/BoundaryConditions/SourceQ.mo index 6ef3492e..668bdaaf 100644 --- a/ThermoSysPro/Fluid/BoundaryConditions/SourceQ.mo +++ b/ThermoSysPro/Fluid/BoundaryConditions/SourceQ.mo @@ -3,7 +3,7 @@ model SourceQ "Multi-fluid source with fixed mass flow rate" extends ThermoSysPro.Fluid.Interfaces.IconColors; - replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Units.SI.MassFlowRate Q0=100 "Mass flow (active if IMassFlow connector is not connected)"; parameter Units.SI.Temperature T0=290 diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStodolaTurbine.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStodolaTurbine.mo index b549ea80..ac7159d2 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStodolaTurbine.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStodolaTurbine.mo @@ -17,8 +17,7 @@ replaceable package Medium = Properties.Media.WaterSteam; h0=3e6, option_temperature=false) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package - Medium = Medium) + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{26,-10},{46,10}}))); equation connect(sourcePQ.C, stodolaTurbine.Ce) diff --git a/ThermoSysPro/Fluid/Machines/StodolaTurbine.mo b/ThermoSysPro/Fluid/Machines/StodolaTurbine.mo index 63e6186b..7173773a 100644 --- a/ThermoSysPro/Fluid/Machines/StodolaTurbine.mo +++ b/ThermoSysPro/Fluid/Machines/StodolaTurbine.mo @@ -1,7 +1,7 @@ within ThermoSysPro.Fluid.Machines; model StodolaTurbine "Multistage turbine group using Stodola's ellipse" extends ThermoSysPro.Fluid.Interfaces.IconColors; - replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialTwoPhaseThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; @@ -25,15 +25,15 @@ extends ThermoSysPro.Fluid.Interfaces.IconColors; "Constant coefficient of the isentropic efficiency characteristics eta_is=f(Q/Qmax)"; parameter Units.SI.MassFlowRate gamma_diff=1e-4 "Diffusion conductance (active if diffusion=true in neighbouring volumes)"; - parameter IF97Region region_e=IF97Region.All_regions "IF97 region before expansion (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); - parameter IF97Region region_s=IF97Region.All_regions "IF97 region after expansion (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); - parameter IF97Region region_ps=IF97Region.All_regions "IF97 region after isentropic expansion (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); + parameter IF97Region region_e=IF97Region.All_regions "IF97 region before expansion (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(tab="Fluid", group="Fluid properties")); + parameter IF97Region region_s=IF97Region.All_regions "IF97 region after expansion (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(tab="Fluid", group="Fluid properties")); + parameter IF97Region region_ps=IF97Region.All_regions "IF97 region after isentropic expansion (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(tab="Fluid", group="Fluid properties")); protected - parameter Integer mode_e=Integer(region_e) - 1 "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; - parameter Integer mode_s=Integer(region_s) - 1 "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; - parameter Integer mode_ps=Integer(region_ps) - 1 "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; + Integer phase_e=if Integer(region_e) == 0 then 0 else if Integer(region_e)==4 then 2 else 1; + Integer phase_s=if Integer(region_s) == 0 then 0 else if Integer(region_s)==4 then 2 else 1; + Integer phase_ps=if Integer(region_ps) == 0 then 0 else if Integer(region_ps)==4 then 2 else 1; parameter Units.SI.AbsolutePressure pcrit=ThermoSysPro.Properties.WaterSteam.BaseIF97.data.PCRIT "Critical pressure"; parameter Units.SI.Temperature Tcrit=ThermoSysPro.Properties.WaterSteam.BaseIF97.data.TCRIT @@ -138,21 +138,21 @@ equation MechPower.signal = W; /* Fluid thermodynamic properties before the expansion */ - state_e=Medium.setState_phX(p=Pe, h=Ce.h, X=Ce.Xi, region=mode_e); + state_e=Medium.setState_phX(p=Pe, h=Ce.h, phase=phase_e); Te = state_e.T; /* Fluid thermodynamic properties after the expansion */ - state_s1 = Medium.setState_phX(p=Ps, h=Hrs, X=Cs.Xi, region=mode_s); // X=Cs.Xi ????????????????? Hrs.Xi ?? + state_s1 = Medium.setState_phX(p=Ps, h=Hrs, phase=phase_s); /* Fluid thermodynamic properties at the outlet of the nozzle */ - state_s = Medium.setState_phX(p=Ps, h=Cs.h, X=Cs.Xi, region=mode_s); + state_s = Medium.setState_phX(p=Ps, h=Cs.h, phase=phase_s); Ts = state_s.T; rhos = state_s.d; /* Fluid thermodynamic properties after the isentropic expansion */ - state_ps = Medium.setState_psX(p=Ps, s=Medium.specificEntropy(state_e), X=Cs.Xi, region=mode_ps); // X=Cs.Xi ????????????????????? + state_ps = Medium.setState_ps(p=Ps, s=Medium.specificEntropy(state_e), phase=phase_ps); His = state_ps.h; annotation ( diff --git a/ThermoSysPro/Fluid/PressureLosses/PipePressureLoss.mo b/ThermoSysPro/Fluid/PressureLosses/PipePressureLoss.mo index c9d337fd..d3c77c64 100644 --- a/ThermoSysPro/Fluid/PressureLosses/PipePressureLoss.mo +++ b/ThermoSysPro/Fluid/PressureLosses/PipePressureLoss.mo @@ -3,7 +3,7 @@ model PipePressureLoss "Pipe generic pressure loss" extends ThermoSysPro.Fluid.Interfaces.IconColors; - replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Real K=10 "Friction pressure loss coefficient"; parameter Units.SI.Position z1=0 "Inlet altitude"; parameter Units.SI.Position z2=0 "Outlet altitude"; diff --git a/ThermoSysPro/Fluid/PressureLosses/SingularPressureLoss.mo b/ThermoSysPro/Fluid/PressureLosses/SingularPressureLoss.mo index 583f3511..5145c405 100644 --- a/ThermoSysPro/Fluid/PressureLosses/SingularPressureLoss.mo +++ b/ThermoSysPro/Fluid/PressureLosses/SingularPressureLoss.mo @@ -1,7 +1,7 @@ within ThermoSysPro.Fluid.PressureLosses; model SingularPressureLoss "Singular pressure loss" extends ThermoSysPro.Fluid.Interfaces.IconColors; - replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Real K=1.e-4 "Pressure loss coefficient"; parameter Units.SI.MassFlowRate gamma_diff=1e-4 diff --git a/ThermoSysPro/Fluid/Volumes/VolumeC.mo b/ThermoSysPro/Fluid/Volumes/VolumeC.mo index 5d9b59ac..3dd055f2 100644 --- a/ThermoSysPro/Fluid/Volumes/VolumeC.mo +++ b/ThermoSysPro/Fluid/Volumes/VolumeC.mo @@ -3,7 +3,7 @@ model VolumeC "Mixing volume with 3 inlets and 1 outlet" extends ThermoSysPro.Fluid.Interfaces.IconColors; - replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); replaceable function SaS = Medium.noSaS(SubC=SubC) annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Boolean dynamic_energy_balance=true "true: dynamic energy balance equation - false: static energy balance equation"; From 35afdf7eaab83a72a2bbeb766b1c2c7b89a12004 Mon Sep 17 00:00:00 2001 From: VESCOVI Guilherme Date: Mon, 16 Jun 2025 11:15:46 +0200 Subject: [PATCH 030/178] #125 RefQ --- ThermoSysPro/Fluid/BoundaryConditions/RefQ.mo | 17 ++++++---- .../BoundaryConditions/TestRefQ.mo | 34 +++++++++++++++++++ .../BoundaryConditions/TestRefQ_Traces.mo | 33 ++++++++++++++++++ .../TestRefQ_Traces_FlueGases.mo | 34 +++++++++++++++++++ .../BoundaryConditions/package.order | 3 ++ 5 files changed, 114 insertions(+), 7 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefQ.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefQ_Traces.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefQ_Traces_FlueGases.mo diff --git a/ThermoSysPro/Fluid/BoundaryConditions/RefQ.mo b/ThermoSysPro/Fluid/BoundaryConditions/RefQ.mo index aaf16710..71610bac 100644 --- a/ThermoSysPro/Fluid/BoundaryConditions/RefQ.mo +++ b/ThermoSysPro/Fluid/BoundaryConditions/RefQ.mo @@ -1,16 +1,20 @@ within ThermoSysPro.Fluid.BoundaryConditions; model RefQ "Fixed mass flow reference" extends ThermoSysPro.Fluid.Interfaces.IconColors; + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + + parameter Units.SI.MassFlowRate Q0=10 "Fixed fluid mass flow"; public Units.SI.MassFlowRate Q "Fluid mass flow rate"; Units.SI.AbsolutePressure P "Fluid pressure"; Units.SI.SpecificEnthalpy h "Fluid specific enthalpy"; + Medium.MassFraction X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Mass fractions"; - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-110,-10},{-90,10}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{90,-10},{110,10}}, rotation=0))); ThermoSysPro.InstrumentationAndControl.Connectors.InputReal IMassFlow annotation (Placement(transformation( @@ -36,12 +40,11 @@ equation C2.diff_res_1 = C1.diff_res_1; C1.diff_res_2 = C2.diff_res_2; - C1.ftype = C2.ftype; + C1.Xi = C2.Xi; + + X = C1.Xi; - C1.Xco2 = C2.Xco2; - C1.Xh2o = C2.Xh2o; - C1.Xo2 = C2.Xo2; - C1.Xso2 = C2.Xso2; + C1.SubC = C2.SubC; Q = C1.Q; P = C1.P; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefQ.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefQ.mo new file mode 100644 index 00000000..63865b8f --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefQ.mo @@ -0,0 +1,34 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.BoundaryConditions; +model TestRefQ + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam; + + + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare package Medium = + Medium) + annotation (Placement(transformation(extent={{66,-10},{86,10}}))); + ThermoSysPro.Fluid.PressureLosses.PipePressureLoss pipePressureLoss( + redeclare package Medium = Medium) + annotation (Placement(transformation(extent={{32,-10},{52,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.RefQ refQ(redeclare package Medium = + Medium) + annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP(redeclare package + Medium = Medium, h0=2600e3, + option_temperature=false) + annotation (Placement(transformation(extent={{-66,-10},{-46,10}}))); + InstrumentationAndControl.Blocks.Sources.Constante constante(k=110) + annotation (Placement(transformation(extent={{-30,38},{-10,58}}))); +equation + connect(sink.C, pipePressureLoss.C2) + annotation (Line(points={{66,0},{52,0}}, color={0,0,0})); + connect(refQ.C2, pipePressureLoss.C1) + annotation (Line(points={{10,0},{32,0}}, color={0,0,0})); + connect(sourceP.C,refQ. C1) + annotation (Line(points={{-46,0},{-10,0}}, color={0,0,0})); + connect(constante.y, refQ.IMassFlow) + annotation (Line(points={{-9,48},{0,48},{0,11}}, color={0,0,255})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( + coordinateSystem(preserveAspectRatio=false))); +end TestRefQ; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefQ_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefQ_Traces.mo new file mode 100644 index 00000000..4cda43cc --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefQ_Traces.mo @@ -0,0 +1,33 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.BoundaryConditions; +model TestRefQ_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam(extraPropertiesNames={"Trace1", "Trace2", "Trace3"}, C_nominal={0.1, 0.2, 0.3}, C_default={0.2, 0.3, 0.4}); + + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare package Medium = + Medium) + annotation (Placement(transformation(extent={{66,-10},{86,10}}))); + ThermoSysPro.Fluid.PressureLosses.PipePressureLoss pipePressureLoss( + redeclare package Medium = Medium) + annotation (Placement(transformation(extent={{32,-10},{52,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.RefQ refQ(redeclare package Medium = + Medium) + annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP(redeclare package + Medium = Medium, h0=2600e3,SubC0={10,20,30}, + option_temperature=false) + annotation (Placement(transformation(extent={{-66,-10},{-46,10}}))); + InstrumentationAndControl.Blocks.Sources.Constante constante(k=110) + annotation (Placement(transformation(extent={{-30,38},{-10,58}}))); +equation + connect(sink.C, pipePressureLoss.C2) + annotation (Line(points={{66,0},{52,0}}, color={0,0,0})); + connect(refQ.C2, pipePressureLoss.C1) + annotation (Line(points={{10,0},{32,0}}, color={0,0,0})); + connect(sourceP.C,refQ. C1) + annotation (Line(points={{-46,0},{-10,0}}, color={0,0,0})); + connect(constante.y, refQ.IMassFlow) + annotation (Line(points={{-9,48},{0,48},{0,11}}, color={0,0,255})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( + coordinateSystem(preserveAspectRatio=false))); +end TestRefQ_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefQ_Traces_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefQ_Traces_FlueGases.mo new file mode 100644 index 00000000..3babe41f --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefQ_Traces_FlueGases.mo @@ -0,0 +1,34 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.BoundaryConditions; +model TestRefQ_Traces_FlueGases + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.FlueGases(extraPropertiesNames={"Trace1", "Trace2", "Trace3"}, C_nominal={0.1, 0.2, 0.3}, C_default={0.2, 0.3, 0.4}); + + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare package Medium = + Medium, h0=2600e3) + annotation (Placement(transformation(extent={{66,-10},{86,10}}))); + ThermoSysPro.Fluid.PressureLosses.PipePressureLoss pipePressureLoss( + redeclare package Medium = Medium) + annotation (Placement(transformation(extent={{32,-10},{52,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.RefQ refQ(redeclare package Medium = + Medium) + annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP(redeclare package + Medium = Medium, + P0=2000000, h0=2600e3,SubC0={10,20,30}, X0={0.1,0.2,0.3,0.2,0.2}, + option_temperature=false) + annotation (Placement(transformation(extent={{-66,-10},{-46,10}}))); + InstrumentationAndControl.Blocks.Sources.Constante constante(k=110) + annotation (Placement(transformation(extent={{-30,38},{-10,58}}))); +equation + connect(sink.C, pipePressureLoss.C2) + annotation (Line(points={{66,0},{52,0}}, color={0,0,0})); + connect(refQ.C2, pipePressureLoss.C1) + annotation (Line(points={{10,0},{32,0}}, color={0,0,0})); + connect(sourceP.C,refQ. C1) + annotation (Line(points={{-46,0},{-10,0}}, color={0,0,0})); + connect(constante.y, refQ.IMassFlow) + annotation (Line(points={{-9,48},{0,48},{0,11}}, color={0,0,255})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( + coordinateSystem(preserveAspectRatio=false))); +end TestRefQ_Traces_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/package.order index e69de29b..d52b6fae 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/package.order @@ -0,0 +1,3 @@ +TestRefQ +TestRefQ_Traces +TestRefQ_Traces_FlueGases From 6f01879bfbab5edf610d8c386a86516fc0b97929 Mon Sep 17 00:00:00 2001 From: MAZURIE Baptiste Date: Mon, 16 Jun 2025 11:26:08 +0200 Subject: [PATCH 031/178] #125 changed constrainedby medium --- ThermoSysPro/Fluid/BoundaryConditions/SinkP.mo | 2 +- ThermoSysPro/Fluid/BoundaryConditions/SinkPQ.mo | 2 +- ThermoSysPro/Fluid/BoundaryConditions/SinkQ.mo | 2 +- ThermoSysPro/Fluid/BoundaryConditions/Source.mo | 2 +- ThermoSysPro/Fluid/BoundaryConditions/SourceP.mo | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ThermoSysPro/Fluid/BoundaryConditions/SinkP.mo b/ThermoSysPro/Fluid/BoundaryConditions/SinkP.mo index 69898d68..b8b243b9 100644 --- a/ThermoSysPro/Fluid/BoundaryConditions/SinkP.mo +++ b/ThermoSysPro/Fluid/BoundaryConditions/SinkP.mo @@ -3,7 +3,7 @@ model SinkP "Multi-fluid sink with fixed pressure" extends ThermoSysPro.Fluid.Interfaces.IconColors; - replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Units.SI.AbsolutePressure P0=100000 "Sink pressure"; parameter Units.SI.Temperature T0=290 "Source temperature (active if option_temperature=true)" diff --git a/ThermoSysPro/Fluid/BoundaryConditions/SinkPQ.mo b/ThermoSysPro/Fluid/BoundaryConditions/SinkPQ.mo index 070d0124..278db1c1 100644 --- a/ThermoSysPro/Fluid/BoundaryConditions/SinkPQ.mo +++ b/ThermoSysPro/Fluid/BoundaryConditions/SinkPQ.mo @@ -3,7 +3,7 @@ model SinkPQ "MultiFluids sink with fixed pressure and mass flow rate" extends ThermoSysPro.Fluid.Interfaces.IconColors; - replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Units.SI.AbsolutePressure P0=100000 "Fluid pressure (active if IPressure connector is not connected)"; parameter Units.SI.MassFlowRate Q0=100 "Mass flow (active if IMassFlow connector is not connected)"; diff --git a/ThermoSysPro/Fluid/BoundaryConditions/SinkQ.mo b/ThermoSysPro/Fluid/BoundaryConditions/SinkQ.mo index fc18d9f9..95c2cc38 100644 --- a/ThermoSysPro/Fluid/BoundaryConditions/SinkQ.mo +++ b/ThermoSysPro/Fluid/BoundaryConditions/SinkQ.mo @@ -3,7 +3,7 @@ model SinkQ "Multi-fluids sink with fixed mass flow rate" extends ThermoSysPro.Fluid.Interfaces.IconColors; - replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Units.SI.MassFlowRate Q0=100 "Mass flow (active if IMassFlow connector is not connected)"; parameter Units.SI.Temperature T0=290 diff --git a/ThermoSysPro/Fluid/BoundaryConditions/Source.mo b/ThermoSysPro/Fluid/BoundaryConditions/Source.mo index 16a1eea2..8369e9eb 100644 --- a/ThermoSysPro/Fluid/BoundaryConditions/Source.mo +++ b/ThermoSysPro/Fluid/BoundaryConditions/Source.mo @@ -3,7 +3,7 @@ model Source "MultiFluids Source" extends ThermoSysPro.Fluid.Interfaces.IconColors; - replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Units.SI.Temperature T0=290 "Source temperature (active if option_temperature=true)" annotation (Evaluate=true, Dialog(enable=option_temperature)); parameter Units.SI.SpecificEnthalpy h0=100000 "Source specific enthalpy (active if option_temperature=false)" annotation (Evaluate=true, Dialog(enable=not option_temperature)); parameter Boolean option_temperature=false "true:temperature fixed - false:specific enthalpy fixed"; diff --git a/ThermoSysPro/Fluid/BoundaryConditions/SourceP.mo b/ThermoSysPro/Fluid/BoundaryConditions/SourceP.mo index 8156d294..27a26da6 100644 --- a/ThermoSysPro/Fluid/BoundaryConditions/SourceP.mo +++ b/ThermoSysPro/Fluid/BoundaryConditions/SourceP.mo @@ -3,7 +3,7 @@ model SourceP "Multi-fluid source with fixed pressure" extends ThermoSysPro.Fluid.Interfaces.IconColors; - replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Units.SI.AbsolutePressure P0=300000 "Source pressure"; parameter Units.SI.Temperature T0=290 From 474b69527ae6eaf4fa81a088e4be8e84789513da Mon Sep 17 00:00:00 2001 From: MAZURIE Baptiste Date: Mon, 16 Jun 2025 11:29:26 +0200 Subject: [PATCH 032/178] #125 Edit VolumeA to change the constrainedby medium --- ThermoSysPro/Fluid/Volumes/VolumeA.mo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ThermoSysPro/Fluid/Volumes/VolumeA.mo b/ThermoSysPro/Fluid/Volumes/VolumeA.mo index fad042ec..6437f404 100644 --- a/ThermoSysPro/Fluid/Volumes/VolumeA.mo +++ b/ThermoSysPro/Fluid/Volumes/VolumeA.mo @@ -3,7 +3,7 @@ model VolumeA "Mixing volume with 2 inlets and 2 outlets" extends ThermoSysPro.Fluid.Interfaces.IconColors; - replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); replaceable function SaS = Medium.noSaS(SubC=SubC) annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Boolean dynamic_energy_balance=true From 6a169be17102568b2827eff79c27818411420c40 Mon Sep 17 00:00:00 2001 From: MAZURIE Baptiste Date: Mon, 16 Jun 2025 11:33:32 +0200 Subject: [PATCH 033/178] #125 ControlValve changed constrainedby medium --- ThermoSysPro/Fluid/PressureLosses/ControlValve.mo | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ThermoSysPro/Fluid/PressureLosses/ControlValve.mo b/ThermoSysPro/Fluid/PressureLosses/ControlValve.mo index 64511ae9..a4df200d 100644 --- a/ThermoSysPro/Fluid/PressureLosses/ControlValve.mo +++ b/ThermoSysPro/Fluid/PressureLosses/ControlValve.mo @@ -1,7 +1,7 @@ -within ThermoSysPro.Fluid.PressureLosses; +within ThermoSysPro.Fluid.PressureLosses; model ControlValve "Control valve" extends ThermoSysPro.Fluid.Interfaces.IconColors; - replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; parameter ThermoSysPro.Units.xSI.Cv Cvmax=8005.42 From dea30059a07e82de4dd04e8b4cfcf767c2c85186 Mon Sep 17 00:00:00 2001 From: VESCOVI Guilherme Date: Mon, 16 Jun 2025 13:46:20 +0200 Subject: [PATCH 034/178] #125 RefQ - Removed useless X declaration and equation --- ThermoSysPro/Fluid/BoundaryConditions/RefQ.mo | 3 --- 1 file changed, 3 deletions(-) diff --git a/ThermoSysPro/Fluid/BoundaryConditions/RefQ.mo b/ThermoSysPro/Fluid/BoundaryConditions/RefQ.mo index 71610bac..f6414019 100644 --- a/ThermoSysPro/Fluid/BoundaryConditions/RefQ.mo +++ b/ThermoSysPro/Fluid/BoundaryConditions/RefQ.mo @@ -10,7 +10,6 @@ public Units.SI.MassFlowRate Q "Fluid mass flow rate"; Units.SI.AbsolutePressure P "Fluid pressure"; Units.SI.SpecificEnthalpy h "Fluid specific enthalpy"; - Medium.MassFraction X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Mass fractions"; ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-110,-10},{-90,10}}, rotation=0))); @@ -42,8 +41,6 @@ equation C1.Xi = C2.Xi; - X = C1.Xi; - C1.SubC = C2.SubC; Q = C1.Q; From caa3baf8d1e24233a62c169958cfa33ef7a23127 Mon Sep 17 00:00:00 2001 From: VESCOVI Guilherme Date: Mon, 16 Jun 2025 14:16:37 +0200 Subject: [PATCH 035/178] #125 RefP --- ThermoSysPro/Fluid/BoundaryConditions/RefP.mo | 14 +++--- .../BoundaryConditions/TestRefP.mo | 36 +++++++++++++++ .../BoundaryConditions/TestRefP_Traces.mo | 34 ++++++++++++++ .../TestRefP_Traces_FlueGases.mo | 46 +++++++++++++++++++ .../BoundaryConditions/package.order | 3 ++ 5 files changed, 126 insertions(+), 7 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefP.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefP_Traces.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefP_Traces_FlueGases.mo diff --git a/ThermoSysPro/Fluid/BoundaryConditions/RefP.mo b/ThermoSysPro/Fluid/BoundaryConditions/RefP.mo index 7edad80f..2e4128c5 100644 --- a/ThermoSysPro/Fluid/BoundaryConditions/RefP.mo +++ b/ThermoSysPro/Fluid/BoundaryConditions/RefP.mo @@ -1,6 +1,8 @@ within ThermoSysPro.Fluid.BoundaryConditions; model RefP "Fixed pressure reference" extends ThermoSysPro.Fluid.Interfaces.IconColors; + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + parameter Units.SI.AbsolutePressure P0=1.e5 "Fixed fluid pressure"; public @@ -8,9 +10,9 @@ public Units.SI.AbsolutePressure P "Fluid pressure"; Units.SI.SpecificEnthalpy h "Fluid specific enthalpy"; - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-110,-10},{-90,10}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{90,-10},{110,10}}, rotation=0))); ThermoSysPro.InstrumentationAndControl.Connectors.InputReal IPressure annotation (Placement(transformation( @@ -36,12 +38,10 @@ equation C2.diff_res_1 = C1.diff_res_1; C1.diff_res_2 = C2.diff_res_2; - C1.ftype = C2.ftype; - C1.Xco2 = C2.Xco2; - C1.Xh2o = C2.Xh2o; - C1.Xo2 = C2.Xo2; - C1.Xso2 = C2.Xso2; + C1.Xi = C2.Xi; + + C1.SubC = C2.SubC; Q = C1.Q; P = C1.P; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefP.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefP.mo new file mode 100644 index 00000000..60f4b2b6 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefP.mo @@ -0,0 +1,36 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.BoundaryConditions; +model TestRefP + extends ThermoSysPro.UsersGuide.Icons.Example; + replaceable package Medium = Properties.Media.WaterSteam; + + + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare package Medium = + Medium, h0=633e3) + annotation (Placement(transformation(extent={{66,-10},{86,10}}))); + ThermoSysPro.Fluid.PressureLosses.PipePressureLoss pipePressureLoss( + redeclare package Medium = Medium) + annotation (Placement(transformation(extent={{32,-10},{52,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.RefP refP(redeclare package Medium = + Medium) + annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare package + Medium = Medium, + T0=423.15, + option_temperature=true) + annotation (Placement(transformation(extent={{-66,-10},{-46,10}}))); + InstrumentationAndControl.Blocks.Sources.Constante constante(k=20e5) + annotation (Placement(transformation(extent={{-30,38},{-10,58}}))); +equation + connect(sink.C, pipePressureLoss.C2) + annotation (Line(points={{66,0},{52,0}}, color={0,0,0})); + connect(refP.C2, pipePressureLoss.C1) + annotation (Line(points={{10,0},{32,0}}, color={0,0,0})); + connect(sourceQ.C,refP. C1) + annotation (Line(points={{-46,0},{-10,0}}, color={0,0,0})); + + + connect(constante.y, refP.IPressure) + annotation (Line(points={{-9,48},{0,48},{0,11}}, color={0,0,255})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( + coordinateSystem(preserveAspectRatio=false))); +end TestRefP; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefP_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefP_Traces.mo new file mode 100644 index 00000000..1f0736bb --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefP_Traces.mo @@ -0,0 +1,34 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.BoundaryConditions; +model TestRefP_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + replaceable package Medium = Properties.Media.WaterSteam(extraPropertiesNames={"Trace1", "Trace2", "Trace3"}, C_nominal={0.1, 0.2, 0.3}, C_default={0.2, 0.3, 0.4}); + + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare package Medium = + Medium, h0=633e3) + annotation (Placement(transformation(extent={{66,-10},{86,10}}))); + ThermoSysPro.Fluid.PressureLosses.PipePressureLoss pipePressureLoss( + redeclare package Medium = Medium) + annotation (Placement(transformation(extent={{32,-10},{52,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.RefP refP(redeclare package Medium = + Medium) + annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare package + Medium = Medium, + T0=423.15, + option_temperature=true, SubC0={10,20,30}) + annotation (Placement(transformation(extent={{-66,-10},{-46,10}}))); + InstrumentationAndControl.Blocks.Sources.Constante constante(k=20e5) + annotation (Placement(transformation(extent={{-30,38},{-10,58}}))); +equation + connect(sink.C, pipePressureLoss.C2) + annotation (Line(points={{66,0},{52,0}}, color={0,0,0})); + connect(refP.C2, pipePressureLoss.C1) + annotation (Line(points={{10,0},{32,0}}, color={0,0,0})); + connect(sourceQ.C,refP. C1) + annotation (Line(points={{-46,0},{-10,0}}, color={0,0,0})); + + connect(constante.y, refP.IPressure) + annotation (Line(points={{-9,48},{0,48},{0,11}}, color={0,0,255})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( + coordinateSystem(preserveAspectRatio=false))); +end TestRefP_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefP_Traces_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefP_Traces_FlueGases.mo new file mode 100644 index 00000000..9aea64c1 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefP_Traces_FlueGases.mo @@ -0,0 +1,46 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.BoundaryConditions; +model TestRefP_Traces_FlueGases + extends ThermoSysPro.UsersGuide.Icons.Example; + replaceable package Medium = ThermoSysPro.Properties.Media.FlueGases(extraPropertiesNames={"Trace1", "Trace2", "Trace3"}, C_nominal={0.1, 0.2, 0.3}, C_default={0.2, 0.3, 0.4}); + + ThermoSysPro.Fluid.BoundaryConditions.Sink sinkP( + redeclare package Medium = + Medium, + T0=453.15, + h0=633193.1, + option_temperature=true) + annotation (Placement(transformation(extent={{66,-10},{86,10}}))); + ThermoSysPro.Fluid.PressureLosses.PipePressureLoss pipePressureLoss( + redeclare package Medium = Medium) + annotation (Placement(transformation(extent={{32,-10},{52,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.RefP refP(redeclare package Medium = + Medium) + annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare package + Medium = Medium, + Q0=50, + T0=473.15, + h0=633193.1, + option_temperature=true, SubC0={10,20,30}, X0={0.1,0.2,0.3,0.2,0.2}, + T(start=423.15)) + annotation (Placement(transformation(extent={{-66,-10},{-46,10}}))); + InstrumentationAndControl.Blocks.Sources.Constante constante(k=20e5) + annotation (Placement(transformation(extent={{-30,38},{-10,58}}))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss( + redeclare package Medium = Medium) + annotation (Placement(transformation(extent={{-38,-10},{-18,10}}))); +equation + connect(sinkP.C, pipePressureLoss.C2) + annotation (Line(points={{66,0},{52,0}}, color={0,0,0})); + connect(refP.C2, pipePressureLoss.C1) + annotation (Line(points={{10,0},{32,0}}, color={0,0,0})); + + connect(constante.y, refP.IPressure) + annotation (Line(points={{-9,48},{0,48},{0,11}}, color={0,0,255})); + connect(sourceQ.C, singularPressureLoss.C1) + annotation (Line(points={{-46,0},{-38,0}}, color={0,0,0})); + connect(singularPressureLoss.C2, refP.C1) + annotation (Line(points={{-18,0},{-10,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( + coordinateSystem(preserveAspectRatio=false))); +end TestRefP_Traces_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/package.order index e69de29b..e1e8d15c 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/package.order @@ -0,0 +1,3 @@ +TestRefP +TestRefP_Traces +TestRefP_Traces_FlueGases From c61aacbafd14a908b32f308516c25b806a850daf Mon Sep 17 00:00:00 2001 From: VESCOVI Guilherme Date: Mon, 16 Jun 2025 17:50:22 +0200 Subject: [PATCH 036/178] #125-LumpedStraightPipe --- .../PressureLosses/TestLumpedStraightPipe.mo | 24 ++++++++++++ .../TestLumpedStraightPipe_Traces.mo | 24 ++++++++++++ .../PressureLosses/package.order | 2 + .../PressureLosses/LumpedStraightPipe.mo | 39 +++++++++++-------- 4 files changed, 72 insertions(+), 17 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestLumpedStraightPipe.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestLumpedStraightPipe_Traces.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestLumpedStraightPipe.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestLumpedStraightPipe.mo new file mode 100644 index 00000000..9174faa2 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestLumpedStraightPipe.mo @@ -0,0 +1,24 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.PressureLosses; +model TestLumpedStraightPipe + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam; + + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare + replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-52,-10}, + {-32,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package + Medium = Medium) annotation (Placement(transformation(extent={{28,-10}, + {48,10}}))); + ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe lumpedStraightPipe(redeclare + replaceable package + Medium = Medium) + annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); +equation + connect(sourcePQ.C, lumpedStraightPipe.C1) + annotation (Line(points={{-32,0},{-10,0}}, color={0,0,0})); + connect(sink.C, lumpedStraightPipe.C2) + annotation (Line(points={{28,0},{10,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( + coordinateSystem(preserveAspectRatio=false))); +end TestLumpedStraightPipe; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestLumpedStraightPipe_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestLumpedStraightPipe_Traces.mo new file mode 100644 index 00000000..f782a09b --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestLumpedStraightPipe_Traces.mo @@ -0,0 +1,24 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.PressureLosses; +model TestLumpedStraightPipe_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam(extraPropertiesNames={"Trace"}, C_nominal={0.1}, C_default={0.2}); + + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare + replaceable package Medium = Medium, SubC0={0.3}) annotation (Placement(transformation(extent={{-52,-10}, + {-32,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package + Medium = Medium) annotation (Placement(transformation(extent={{28,-10}, + {48,10}}))); + ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe lumpedStraightPipe(redeclare + replaceable package Medium = + Medium) + annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); +equation + connect(sourcePQ.C, lumpedStraightPipe.C1) + annotation (Line(points={{-32,0},{-10,0}}, color={0,0,0})); + connect(sink.C, lumpedStraightPipe.C2) + annotation (Line(points={{28,0},{10,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( + coordinateSystem(preserveAspectRatio=false))); +end TestLumpedStraightPipe_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order index e89506ae..8be16eb5 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order @@ -7,3 +7,5 @@ TestSingularPressureLoss_Traces_FlueGases TestControlValve TestControlValve_Traces TestControlValve_Traces_FlueGases +TestLumpedStraightPipe +TestLumpedStraightPipe_Traces diff --git a/ThermoSysPro/Fluid/PressureLosses/LumpedStraightPipe.mo b/ThermoSysPro/Fluid/PressureLosses/LumpedStraightPipe.mo index fb8f7fb1..f6b38ab1 100644 --- a/ThermoSysPro/Fluid/PressureLosses/LumpedStraightPipe.mo +++ b/ThermoSysPro/Fluid/PressureLosses/LumpedStraightPipe.mo @@ -1,7 +1,10 @@ within ThermoSysPro.Fluid.PressureLosses; model LumpedStraightPipe "Lumped straight pipe (circular duct)" extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + + + import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; parameter Units.SI.Length L=10. "Pipe length"; @@ -19,7 +22,7 @@ model LumpedStraightPipe "Lumped straight pipe (circular duct)" "true: momentum balance equation with inertia - false: without inertia"; parameter Units.SI.Density p_rho=0 "If > 0, fixed fluid density" annotation (Evaluate=true, Dialog(tab="Fluid", group="Fluid properties")); - parameter IF97Region region=IF97Region.All_regions "IF97 region (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); + parameter IF97Region region=IF97Region.All_regions "IF97 region (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(tab="Fluid", group="Fluid properties")); protected constant Units.SI.Acceleration g=Modelica.Constants.g_n "Gravity constant"; @@ -47,13 +50,15 @@ public Units.SI.SpecificHeatCapacity cp(start=4200) "Fluid specific heat capacity"; Units.SI.ThermalConductivity k(start=0.05) "Fluid thermal conductivity"; Units.SI.MassFlowRate gamma_diff(start=1.e-4) "Diffusion conductance"; - FluidType ftype "Fluid type"; - Integer fluid=Integer(ftype) "Fluid number"; + Medium.MassFraction X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Mass fractions"; + + public - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1 annotation (Placement( + Medium.ThermodynamicState state; + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-110,-10},{-90,10}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{90,-10},{110,10}}, rotation=0))); initial equation if inertia then @@ -74,18 +79,15 @@ equation C2.diff_res_1 = C1.diff_res_1 + 1/gamma_diff; C1.diff_res_2 = C2.diff_res_2 + 1/gamma_diff; - C1.ftype = C2.ftype; - C1.Xco2 = C2.Xco2; - C1.Xh2o = C2.Xh2o; - C1.Xo2 = C2.Xo2; - C1.Xso2 = C2.Xso2; + C1.Xi = C2.Xi; + C1.SubC = C2.SubC; + X = C1.Xi; Q = C1.Q; h = C1.h; deltaP = C1.P - C2.P; - ftype = C1.ftype; /* Diffusion resistance */ gamma_diff = A*k/cp/L; @@ -118,16 +120,19 @@ equation /* Fluid thermodynamic properties */ Pm = (C1.P + C2.P)/2; + state=Medium.setState_phX(p=Pm, h=h, X=X, region=mode); + if (p_rho > 0) then rho = p_rho; else - rho = ThermoSysPro.Properties.Fluid.Density_Ph(Pm, h, fluid, mode, C1.Xco2, C1.Xh2o, C1.Xo2, C1.Xso2); + rho = state.d; end if; - T = ThermoSysPro.Properties.Fluid.Temperature_Ph(Pm, h, fluid, mode, C1.Xco2, C1.Xh2o, C1.Xo2, C1.Xso2); - mu = ThermoSysPro.Properties.Fluid.DynamicViscosity_Ph(Pm, h, fluid, mode, C1.Xco2, C1.Xh2o, C1.Xo2, C1.Xso2); - k = ThermoSysPro.Properties.Fluid.ThermalConductivity_Ph(Pm, h, fluid, mode, C1.Xco2, C1.Xh2o,C1.Xo2, C1.Xso2); - cp = ThermoSysPro.Properties.Fluid.SpecificHeatCapacityCp_Ph(Pm, h, fluid, mode, C1.Xco2, C1.Xh2o, C1.Xo2, C1.Xso2); + + T = state.T; + mu = Medium.dynamicViscosity(state); + k = Medium.thermalConductivity(state); + cp = Medium.specificHeatCapacityCp(state); annotation ( Diagram(coordinateSystem( From 0d49afd1d1c3b55e9046559042965a1cbb8899af Mon Sep 17 00:00:00 2001 From: LAMBLOT Simon Date: Thu, 19 Jun 2025 10:39:03 +0200 Subject: [PATCH 037/178] staticcentrifugalpump --- .../Machines/TestStaticCentrifugalPump.mo | 20 ++++++ .../TestStaticCentrifugalPump_FlueGases.mo | 26 ++++++++ .../TestStaticCentrifugalPump_Traces.mo | 26 ++++++++ .../SimpleExamples/Machines/package.order | 3 + .../Fluid/Machines/StaticCentrifugalPump.mo | 64 +++++++++---------- 5 files changed, 107 insertions(+), 32 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStaticCentrifugalPump.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStaticCentrifugalPump_FlueGases.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStaticCentrifugalPump_Traces.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStaticCentrifugalPump.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStaticCentrifugalPump.mo new file mode 100644 index 00000000..5da05aac --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStaticCentrifugalPump.mo @@ -0,0 +1,20 @@ +within ; +model TestStaticCentrifugalPump + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; + StaticCentrifugalPump staticCentrifugalPump( + redeclare + replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package + Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare + replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); +equation + connect(staticCentrifugalPump.C2, sink.C) + annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(staticCentrifugalPump.C1, sourcePQ.C) + annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), + uses(ThermoSysPro(version="5.0"))); +end TestStaticCentrifugalPump; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStaticCentrifugalPump_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStaticCentrifugalPump_FlueGases.mo new file mode 100644 index 00000000..3d38a722 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStaticCentrifugalPump_FlueGases.mo @@ -0,0 +1,26 @@ +within ; +model TestStaticCentrifugalPump_FlueGases + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.FlueGases; + StaticCentrifugalPump staticCentrifugalPump( + redeclare + replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-6,-10}, + {14,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink( + redeclare replaceable package Medium = Medium, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ( + redeclare replaceable package Medium = Medium, + P0=4500000, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); +equation + connect(staticCentrifugalPump.C2, sink.C) + annotation (Line(points={{14,0},{30,0}}, color={0,0,0})); + connect(staticCentrifugalPump.C1, sourcePQ.C) + annotation (Line(points={{-6,0},{-30,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), + uses(ThermoSysPro(version="5.0"))); +end TestStaticCentrifugalPump_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStaticCentrifugalPump_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStaticCentrifugalPump_Traces.mo new file mode 100644 index 00000000..26d98475 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStaticCentrifugalPump_Traces.mo @@ -0,0 +1,26 @@ +within ; +model TestStaticCentrifugalPump_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam ( + extraPropertiesNames={"Trace"}, + C_nominal={0.1}, + C_default={0.2}); + StaticCentrifugalPump staticCentrifugalPump( + redeclare + replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10}, + {10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package + Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare + replaceable package Medium = Medium, SubC0={0.3}) + annotation (Placement(transformation(extent={{-52,-10}, + {-32,10}}))); +equation + connect(staticCentrifugalPump.C2, sink.C) + annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(staticCentrifugalPump.C1, sourcePQ.C) + annotation (Line(points={{-10,0},{-32,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), + uses(ThermoSysPro(version="5.0"))); +end TestStaticCentrifugalPump_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/package.order index e69de29b..243a92a6 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/package.order @@ -0,0 +1,3 @@ +TestStaticCentrifugalPump +TestStaticCentrifugalPump_FlueGases +TestStaticCentrifugalPump_Traces \ No newline at end of file diff --git a/ThermoSysPro/Fluid/Machines/StaticCentrifugalPump.mo b/ThermoSysPro/Fluid/Machines/StaticCentrifugalPump.mo index 98dd3a47..6a8ad300 100644 --- a/ThermoSysPro/Fluid/Machines/StaticCentrifugalPump.mo +++ b/ThermoSysPro/Fluid/Machines/StaticCentrifugalPump.mo @@ -1,11 +1,11 @@ -within ThermoSysPro.Fluid.Machines; +within ; model StaticCentrifugalPump "Static centrifugal pump" - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby + ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter ThermoSysPro.Units.nonSI.AngularVelocity_rpm VRot=1400 "Fixed rotational speed (active if fixed_rot_or_power=1 and rpm_or_mpower connector not connected)"; - parameter Units.SI.Power MPower=0.1e6 + parameter ThermoSysPro.Units.SI.Power MPower=0.1e6 "Fixed mechanical power (active if fixed_rot_or_power=2 and rpm_or_mpower connector not connected)"; parameter ThermoSysPro.Units.nonSI.AngularVelocity_rpm VRotn=1400 "Nominal rotational speed"; @@ -15,11 +15,10 @@ model StaticCentrifugalPump "Static centrifugal pump" "1: fixed rotational speed - 2: fixed mechanical power"; parameter Boolean adiabatic_compression=false "true: compression at constant enthalpy - false: compression with varying enthalpy"; - parameter Units.SI.MassFlowRate gamma_diff=1e-4 + parameter ThermoSysPro.Units.SI.MassFlowRate gamma_diff=1e-4 "Diffusion conductance (active if diffusion=true in neighbouring volumes)"; - parameter Units.SI.Density p_rho=0 "If > 0, fixed fluid density" + parameter ThermoSysPro.Units.SI.Density p_rho=0 "If > 0, fixed fluid density" annotation (Evaluate=true, Dialog(tab="Fluid", group="Fluid properties")); - parameter IF97Region region=IF97Region.All_regions "IF97 region (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); parameter Real a1=-88.67 "x^2 coef. of the pump characteristics hn = f(vol_flow) (s2/m5)"; @@ -36,33 +35,36 @@ model StaticCentrifugalPump "Static centrifugal pump" "Constant coef. of the pump efficiency characteristics rh = f(vol_flow) (s.u.)"; protected - constant Units.SI.Acceleration g=Modelica.Constants.g_n "Gravity constant"; - parameter Integer mode=Integer(region) - 1 "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; + constant ThermoSysPro.Units.SI.Acceleration g=Modelica.Constants.g_n + "Gravity constant"; parameter Real eps=1.e-6 "Small number"; parameter Real rhmin=0.20 "Minimum efficiency to avoid zero crossings"; public Real rh "Hydraulic efficiency"; - Units.SI.Height hn(start=10) "Pump head"; + ThermoSysPro.Units.SI.Height hn(start=10) "Pump head"; Real R(start=VRot/VRotn) "Reduced rotational speed"; - Units.SI.MassFlowRate Q(start=500) "Mass flow rate"; - Units.SI.VolumeFlowRate Qv(start=0.5) "Volume flow rate"; - Units.SI.Power Wh "Hydraulic power"; - Units.SI.Power Wm "Mechanical power"; + ThermoSysPro.Units.SI.MassFlowRate Q(start=500) "Mass flow rate"; + ThermoSysPro.Units.SI.VolumeFlowRate Qv(start=0.5) "Volume flow rate"; + ThermoSysPro.Units.SI.Power Wh "Hydraulic power"; + ThermoSysPro.Units.SI.Power Wm "Mechanical power"; ThermoSysPro.Units.nonSI.AngularVelocity_rpm Vr "Rotational speed"; - Units.SI.Density rho(start=998) "Fluid density"; + ThermoSysPro.Units.SI.Density rho(start=998) "Fluid density"; ThermoSysPro.Units.SI.PressureDifference deltaP "Pressure variation between the outlet and the inlet"; - Units.SI.SpecificEnthalpy deltaH + ThermoSysPro.Units.SI.SpecificEnthalpy deltaH "Specific enthalpy variation between the outlet and the inlet"; - Units.SI.AbsolutePressure Pm(start=1.e5) "Fluid average pressure"; - Units.SI.SpecificEnthalpy h(start=100000) "Fluid average specific enthalpy"; - FluidType ftype "Fluid type"; - Integer fluid=Integer(ftype) "Fluid number"; - - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1 annotation (Placement( + ThermoSysPro.Units.SI.AbsolutePressure Pm(start=1.e5) + "Fluid average pressure"; + ThermoSysPro.Units.SI.SpecificEnthalpy h(start=100000) + "Fluid average specific enthalpy"; + Medium.MassFraction X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Mass fractions"; + + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1(redeclare package + Medium = Medium) annotation (Placement( transformation(extent={{-110,-10},{-90,10}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2(redeclare package + Medium = Medium) annotation (Placement( transformation(extent={{90,-10},{110,10}}, rotation=0))); ThermoSysPro.InstrumentationAndControl.Connectors.InputReal rpm_or_mpower annotation (Placement(transformation( @@ -91,12 +93,11 @@ equation C2.diff_res_1 = C1.diff_res_1 + (if (gamma_diff > 0) then 1/gamma_diff else 0); C1.diff_res_2 = C2.diff_res_2 + (if (gamma_diff > 0) then 1/gamma_diff else 0); - C1.ftype = C2.ftype; + C1.Xi = C2.Xi; + + X = C1.Xi; - C1.Xco2 = C2.Xco2; - C1.Xh2o = C2.Xh2o; - C1.Xo2 = C2.Xo2; - C1.Xso2 = C2.Xso2; + C1.SubC = C2.SubC; Q = C1.Q; deltaP = C2.P - C1.P; @@ -105,8 +106,6 @@ equation deltaP = rho*g*hn; Q = Qv*rho; - ftype = C1.ftype; - /* Fixed rotational speed or fixed mechanical power */ if (fixed_rot_or_power == 1) then Vr = rpm_or_mpower.signal; @@ -143,7 +142,7 @@ equation if (p_rho > 0) then rho = p_rho; else - rho = ThermoSysPro.Properties.Fluid.Density_Ph(Pm,h,fluid,mode,C1.Xco2, C1.Xh2o, C1.Xo2, C1.Xso2); + rho = Medium.density_phX(p=Pm, h=h, X=X); end if; annotation ( Diagram(coordinateSystem( @@ -187,5 +186,6 @@ equation
  • Baligh El Hefni
  • "), - DymolaStoredErrors); + DymolaStoredErrors, + uses(ThermoSysPro(version="5.0"), Modelica(version="4.0.0"))); end StaticCentrifugalPump; From 046a559f6d6eb9f66a5fb6c0db98cd2a9415e466 Mon Sep 17 00:00:00 2001 From: LAMBLOT Simon Date: Thu, 19 Jun 2025 10:51:41 +0200 Subject: [PATCH 038/178] VolumeB --- .../SimpleExamples/Volumes/TestVolumeB.mo | 26 ++ .../Volumes/TestVolumeB_FlueGases.mo | 33 +++ .../Volumes/TestVolumeB_Traces.mo | 35 +++ .../SimpleExamples/Volumes/package.order | 3 + ThermoSysPro/Fluid/Volumes/VolumeB.mo | 228 +++++++----------- 5 files changed, 185 insertions(+), 140 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeB.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeB_FlueGases.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeB_Traces.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeB.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeB.mo new file mode 100644 index 00000000..ef023186 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeB.mo @@ -0,0 +1,26 @@ +within ; +model TestVolumeB + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package + Medium = Medium) annotation (Placement(transformation(extent={{20,28}, + {40,48}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare + replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + VolumeB volumeB(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare replaceable + package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10}, + {10,10}}, + rotation=180, + origin={42,0}))); +equation + connect(sourcePQ.C,volumeB. Ce1) annotation (Line(points={{-30,0},{-10,0}}, color={0,0,0})); + connect(volumeB.Ce2, sourceQ.C) annotation (Line(points={{10,0},{21,0},{21, + 7.21645e-16},{32,7.21645e-16}}, color={0,0,0})); + connect(volumeB.Cs1, sink.C) + annotation (Line(points={{0,10},{0,38},{20,38}}, + color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), + uses(ThermoSysPro(version="5.0"))); +end TestVolumeB; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeB_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeB_FlueGases.mo new file mode 100644 index 00000000..36c5da1e --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeB_FlueGases.mo @@ -0,0 +1,33 @@ +within ; +model TestVolumeB_FlueGases + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.FlueGases; + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package + Medium = Medium, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{26,16}, + {46,36}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare + replaceable package Medium = Medium, + P0=4500000, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + VolumeB volumeB(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare replaceable + package Medium = Medium, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{-10,-10}, + {10,10}}, + rotation=180, + origin={40,0}))); +equation + connect(sourcePQ.C,volumeB. Ce1) annotation (Line(points={{-30,0},{-10,0}}, color={0,0,0})); + connect(volumeB.Ce2, sourceQ.C) annotation (Line(points={{10,0},{23,0},{23, + 7.21645e-16},{30,7.21645e-16}}, color={0,0,0})); + connect(volumeB.Cs1, sink.C) + annotation (Line(points={{0,10},{0,26},{26,26}}, + color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), + uses(ThermoSysPro(version="5.0"))); +end TestVolumeB_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeB_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeB_Traces.mo new file mode 100644 index 00000000..5e6e9e9e --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeB_Traces.mo @@ -0,0 +1,35 @@ +within ; +model TestVolumeB_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam ( + extraPropertiesNames={"Trace"}, + C_nominal={0.1}, + C_default={0.2}); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package + Medium = Medium) annotation (Placement(transformation(extent={{20,20}, + {40,40}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare + replaceable package Medium = Medium, + Q0=100, + SubC0={0.5}) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + VolumeB volumeB(redeclare package Medium = Medium, + V=1, + dynamic_mass_balance=false) annotation (Placement(transformation(extent={{-10,-10}, + {10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare replaceable + package Medium = Medium, + SubC0={0.2}) annotation (Placement(transformation(extent={{-10,-10}, + {10,10}}, + rotation=180, + origin={40,0}))); +equation + connect(sourcePQ.C,volumeB. Ce1) annotation (Line(points={{-30,0},{-10,0}}, color={0,0,0})); + connect(volumeB.Ce2, sourceQ.C) annotation (Line(points={{10,0},{24,0},{24, + 7.21645e-16},{30,7.21645e-16}}, color={0,0,0})); + connect(volumeB.Cs1, sink.C) + annotation (Line(points={{0,10},{0,30},{20,30}}, + color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), + uses(ThermoSysPro(version="5.0"))); +end TestVolumeB_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order index f71ca450..acb69536 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order @@ -4,3 +4,6 @@ TestVolumeC_Traces TestVolumeA TestVolumeA_FlueGases TestVolumeA_Traces +TestVolumeB +TestVolumeB_FlueGases +TestVolumeB_Traces \ No newline at end of file diff --git a/ThermoSysPro/Fluid/Volumes/VolumeB.mo b/ThermoSysPro/Fluid/Volumes/VolumeB.mo index 43daa6e0..e59027d0 100644 --- a/ThermoSysPro/Fluid/Volumes/VolumeB.mo +++ b/ThermoSysPro/Fluid/Volumes/VolumeB.mo @@ -1,25 +1,25 @@ -within ThermoSysPro.Fluid.Volumes; +within ; model VolumeB "Mixing volume with 2 inlets and 2 outlets" - extends - ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidTypeParameterInterface; + extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable function SaS = Medium.noSaS(SubC=SubC) annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Boolean dynamic_energy_balance=true "true: dynamic energy balance equation - false: static energy balance equation"; - parameter Units.SI.Volume V=1 + parameter ThermoSysPro.Units.SI.Volume V=1 "Volume (active if dynamic_energy_balance=true)" annotation (Evaluate=true, Dialog(enable=dynamic_energy_balance)); parameter Boolean dynamic_mass_balance=false "true: dynamic mass balance equation - false: static mass balance equation (active if the fluid is compressible and if dynamic_energy_balance=true)" annotation(Evaluate=true, Dialog(enable=isCompressible and dynamic_energy_balance)); parameter Boolean steady_state=true "true: start from steady state - false: start from (P0, h0) (active if dynamic_energy_balance=true)" annotation(Evaluate=true, Dialog(enable=dynamic_energy_balance)); - parameter Units.SI.AbsolutePressure P0=1e5 + parameter ThermoSysPro.Units.SI.AbsolutePressure P0=1e5 "Initial fluid pressure (active if the fluid is compressible, and if dynamic_energy_balance=true and dynamic_mass_balance=true and steady_state=false)" annotation (Evaluate=true, Dialog(enable=isCompressible and dynamic_energy_balance and dynamic_mass_balance and not steady_state)); - parameter Units.SI.SpecificEnthalpy h0=1e5 + parameter ThermoSysPro.Units.SI.SpecificEnthalpy h0=1e5 "Initial fluid specific enthalpy (active if dynamic_energy_balance=true and steady_state=false)" annotation (Evaluate=true, Dialog(enable=dynamic_energy_balance and not steady_state)); @@ -27,89 +27,70 @@ model VolumeB "Mixing volume with 2 inlets and 2 outlets" "true: continuous flow reversal - false: discontinuous flow reversal"; parameter Boolean diffusion=false "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; - parameter Units.SI.Density p_rho=0 "If > 0, fixed fluid density" + parameter ThermoSysPro.Units.SI.Density p_rho=0 "If > 0, fixed fluid density" annotation (Evaluate=true, Dialog(tab="Fluid", group="Fluid properties")); - parameter IF97Region region=IF97Region.All_regions "IF97 region (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); + parameter Boolean dynamic_composition_balance=false "true: dynamic fluid composition balance equation
    false: static fluid composition balance equation (active for flue gases)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.FlueGases), tab="Fluid", group="Fluid properties")); - parameter ThermoSysPro.Units.SI.MassFraction Xco20=0.0 - "Initial CO2 mass fraction" annotation (Evaluate=true, Dialog( + parameter Medium.ExtraProperty X0[Medium.nX]=Medium.X_default "Initial composition values" annotation (Evaluate=true, Dialog( enable=dynamic_composition_balance, tab="Fluid", - group= - "Initial composition values (active for flue gases only if dynamic_composition_balance=true)")); - parameter ThermoSysPro.Units.SI.MassFraction Xh2o0=if ftype == FluidType.FlueGases then 0.05 else 0 - "Initial H20 mass fraction" annotation (Evaluate=true, Dialog( - enable=dynamic_composition_balance, - tab="Fluid", - group= - "Initial composition values (active for flue gases only if dynamic_composition_balance=true)")); - parameter ThermoSysPro.Units.SI.MassFraction Xo20=0.23 - "Initial O2 mass fraction" annotation (Evaluate=true, Dialog( - enable=dynamic_composition_balance, - tab="Fluid", - group= - "Initial composition values (active for flue gases only if dynamic_composition_balance=true)")); - parameter ThermoSysPro.Units.SI.MassFraction Xso20=0 - "Initial SO2 mass fraction" annotation (Evaluate=true, Dialog( - enable=dynamic_composition_balance, - tab="Fluid", - group= - "Initial composition values (active for flue gases only if dynamic_composition_balance=true)")); + group="Medium")); protected - constant Units.SI.SpecificEnthalpy hr=2501569 - "Water/steam reference specific enthalpy at 0.01°C"; - parameter Boolean flue_gases=(ftype == FluidType.FlueGases) "Flue gases"; - parameter Units.SI.MassFlowRate gamma0=1.e-4 + constant Boolean isCompressible = Medium.isCompressible; + parameter ThermoSysPro.Units.SI.MassFlowRate gamma0=1.e-4 "Pseudo-diffusion conductance use for continuous flow reversal (active if diffusion=false and continuous_flow_reversal = true)"; - parameter Integer mode=Integer(region) - 1 "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; public - Units.SI.Temperature T "Fluid temperature"; - Units.SI.AbsolutePressure P(start=1.e5) "Fluid pressure"; - Units.SI.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy"; - Units.SI.Density rho(start=998) "Fluid density"; - Units.SI.MassFlowRate BQ "Right hand side of the mass balance equation"; - Units.SI.Power BH "Right hand side of the energy balance equation"; - Units.SI.DerDensityByPressure ddph + ThermoSysPro.Units.SI.Temperature T "Fluid temperature"; + ThermoSysPro.Units.SI.AbsolutePressure P(start=1.e5) "Fluid pressure"; + ThermoSysPro.Units.SI.SpecificEnthalpy h(start=100000) + "Fluid specific enthalpy"; + ThermoSysPro.Units.SI.Density rho(start=998) "Fluid density"; + ThermoSysPro.Units.SI.MassFlowRate BQ + "Right hand side of the mass balance equation"; + ThermoSysPro.Units.SI.Power BH + "Right hand side of the energy balance equation"; + ThermoSysPro.Units.SI.DerDensityByPressure ddph "density derivative wrt pressure at constant specific enthalpy"; - Units.SI.DerDensityByEnthalpy ddhp + ThermoSysPro.Units.SI.DerDensityByEnthalpy ddhp "density derivative wrt specific enthalpy at constant pressure"; - FluidType fluids[5] "Fluids mixing in volume"; - Units.SI.MassFlowRate BXco2 "Right hand side of the CO2 balance equation"; - Units.SI.MassFlowRate BXh2o "Right hand side of the H2O balance equation"; - Units.SI.MassFlowRate BXo2 "Right hand side of the O2 balance equation"; - Units.SI.MassFlowRate BXso2 "Right hand side of the SO2 balance equation"; - ThermoSysPro.Units.SI.MassFraction Xco2 "CO2 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xh2o "H20 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xo2 "O2 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xso2 "SO2 mass fraction"; - Units.SI.Power Je1 "Thermal power diffusion from inlet e1"; - Units.SI.Power Je2 "Thermal power diffusion from inlet e2"; - Units.SI.Power Js1 "Thermal power diffusion from outlet s1"; - Units.SI.Power Js2 "Thermal power diffusion from outlet s2"; - Units.SI.Power J "Total thermal power diffusion"; - Units.SI.MassFlowRate gamma_e1 "Diffusion conductance for inlet e1"; - Units.SI.MassFlowRate gamma_e2 "Diffusion conductance for inlet e2"; - Units.SI.MassFlowRate gamma_s1 "Diffusion conductance for outlet s1"; - Units.SI.MassFlowRate gamma_s2 "Diffusion conductance for outlet s2"; + ThermoSysPro.Units.SI.MassFlowRate BX[Medium.nXi] "Right hand side of the X balance equation"; + Medium.ExtraProperty X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Fluid mass fraction"; + Medium.ExtraProperty BSubC[Medium.nC](quantity=Medium.extraPropertiesNames) "Right hand side of the trace balance equation"; + Medium.ExtraProperty SubC[Medium.nC](quantity=Medium.extraPropertiesNames, start=Medium.C_default) "Fluid trace substances"; + Medium.ExtraProperty SubCSaS[Medium.nC](quantity=Medium.extraPropertiesNames) "Trace modification in the trace balance equation"; + Medium.ThermodynamicState state; + ThermoSysPro.Units.SI.Power Je1 "Thermal power diffusion from inlet e1"; + ThermoSysPro.Units.SI.Power Je2 "Thermal power diffusion from inlet e2"; + ThermoSysPro.Units.SI.Power Js1 "Thermal power diffusion from outlet s1"; + ThermoSysPro.Units.SI.Power Js2 "Thermal power diffusion from outlet s2"; + ThermoSysPro.Units.SI.Power J "Total thermal power diffusion"; + ThermoSysPro.Units.SI.MassFlowRate gamma_e1 + "Diffusion conductance for inlet e1"; + ThermoSysPro.Units.SI.MassFlowRate gamma_e2 + "Diffusion conductance for inlet e2"; + ThermoSysPro.Units.SI.MassFlowRate gamma_s1 + "Diffusion conductance for outlet s1"; + ThermoSysPro.Units.SI.MassFlowRate gamma_s2 + "Diffusion conductance for outlet s2"; Real re1 "Value of r(Q/gamma) for inlet e1"; Real re2 "Value of r(Q/gamma) for inlet e2"; Real rs1 "Value of r(Q/gamma) for outlet s1"; Real rs2 "Value of r(Q/gamma) for outlet s2"; public - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce1 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce1( redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-110,-10},{-90,10}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce2 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce2( redeclare package Medium = Medium) annotation (Placement( transformation(extent={{90,-10},{110,10}}, rotation=0), iconTransformation(extent={{90,-10},{110,10}}))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs1 annotation ( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs1( redeclare package Medium = Medium) annotation ( Placement(transformation(extent={{-10,90},{10,110}}, rotation=0), iconTransformation(extent={{-10,90},{10,110}}))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs2 annotation ( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs2( redeclare package Medium = Medium) annotation ( Placement(transformation(extent={{-10,-110},{10,-90}}, rotation=0))); initial equation if dynamic_energy_balance and dynamic_mass_balance then @@ -128,19 +109,11 @@ initial equation end if; end if; - if flue_gases then - if dynamic_composition_balance then - if steady_state then - der(Xco2) = 0; - der(Xh2o) = 0; - der(Xo2) = 0; - der(Xso2) = 0; - else - Xco2 = Xco20; - Xh2o = Xh2o0; - Xo2 = Xo20; - Xso2 = Xso20; - end if; + if dynamic_composition_balance then + if steady_state then + der(X) = fill(0,Medium.nX); + else + X = X0[1:Medium.nXi]; end if; end if; @@ -150,16 +123,6 @@ equation assert(V > 0, "Volume non-positive"); end if; - /* Check that incoming fluids are compatible with fluid in volume */ - fluids[1] = ftype; - fluids[2] = Ce1.ftype; - fluids[3] = Ce2.ftype; - fluids[4] = Cs1.ftype; - fluids[5] = Cs2.ftype; - - assert(ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.isCompatible(fluids), - "VolumeB: fluids mixing in volume are not compatible with each other"); - /* Unconnected connectors */ if (cardinality(Ce1) == 0) then Ce1.Q = 0; @@ -167,11 +130,8 @@ equation Ce1.h_vol_1 = 1.e5; Ce1.diff_res_1 = 0; Ce1.diff_on_1 = false; - Ce1.ftype = ftype; - Ce1.Xco2 = 0; - Ce1.Xh2o = 0; - Ce1.Xo2 = 0; - Ce1.Xso2 = 0; + Ce1.Xi = Medium.X_default[1:Medium.nXi]; + Ce1.SubC = Medium.C_default; end if; if (cardinality(Ce2) == 0) then @@ -180,11 +140,8 @@ equation Ce2.h_vol_1 = 1.e5; Ce2.diff_res_1 = 0; Ce2.diff_on_1 = false; - Ce2.ftype = ftype; - Ce2.Xco2 = 0; - Ce2.Xh2o = 0; - Ce2.Xo2 = 0; - Ce2.Xso2 = 0; + Ce2.Xi = Medium.X_default[1:Medium.nXi]; + Ce2.SubC = Medium.C_default; end if; if (cardinality(Cs1) == 0) then @@ -205,7 +162,7 @@ equation BQ = Ce1.Q + Ce2.Q - Cs1.Q - Cs2.Q; if isCompressible and dynamic_energy_balance and dynamic_mass_balance then - V*(ddph*der(P) + ddhp*der(h - Xh2o*hr)) = BQ; + V*(ddph*der(P) + ddhp*der(h)) = BQ; else 0 = BQ; end if; @@ -216,13 +173,13 @@ equation P = Cs2.P; /* Energy balance equation */ - BH = Ce1.Q*(Ce1.h - Ce1.Xh2o*hr) + Ce2.Q*(Ce2.h - Ce2.Xh2o*hr) - Cs1.Q*(Cs1.h - Cs1.Xh2o*hr) - Cs2.Q*(Cs2.h - Cs2.Xh2o*hr) + J; + BH = Ce1.Q*Ce1.h + Ce2.Q*Ce2.h - Cs1.Q*Cs1.h - Cs2.Q*Cs2.h + J; if dynamic_energy_balance then if dynamic_mass_balance then - V*(((h - Xh2o*hr)*ddph - 1)*der(P) + ((h - Xh2o*hr)*ddhp + rho)*der(h - Xh2o*hr)) = BH; + V*((h*ddph - 1)*der(P) + (h*ddhp + rho)*der(h)) = BH; else - V*rho*der(h - Xh2o*hr) = BH; + V*rho*der(h) = BH; end if; else BH = 0; @@ -234,42 +191,30 @@ equation Cs2.h_vol_1 = h; /* Fluid composition balance equations */ - BXco2 = Ce1.Xco2*Ce1.Q + Ce2.Xco2*Ce2.Q - Cs1.Xco2*Cs1.Q - Cs2.Xco2*Cs2.Q; - BXh2o = Ce1.Xh2o*Ce1.Q + Ce2.Xh2o*Ce2.Q - Cs1.Xh2o*Cs1.Q - Cs2.Xh2o*Cs2.Q; - BXo2 = Ce1.Xo2*Ce1.Q + Ce2.Xo2*Ce2.Q - Cs1.Xo2*Cs1.Q - Cs2.Xo2*Cs2.Q; - BXso2 = Ce1.Xso2*Ce1.Q + Ce2.Xso2*Ce2.Q - Cs1.Xso2*Cs1.Q - Cs2.Xso2*Cs2.Q; - - if flue_gases then - if dynamic_composition_balance then - V*rho*der(Xco2) + Xco2*BQ = BXco2; - V*rho*der(Xh2o) + Xh2o*BQ = BXh2o; - V*rho*der(Xo2) + Xo2*BQ = BXo2; - V*rho*der(Xso2) + Xso2*BQ = BXso2; - else - Xco2*BQ = BXco2; - Xh2o*BQ = BXh2o; - Xo2*BQ = BXo2; - Xso2*BQ = BXso2; - end if; + BX = Ce1.Xi*Ce1.Q + Ce2.Xi*Ce2.Q - Cs1.Xi*Cs1.Q - Cs2.Xi*Cs2.Q; + + if dynamic_composition_balance then + V*rho*der(X) + X*BQ = BX; else - Xco2 = 0; - Xh2o = 0; - Xo2 = 0; - Xso2 = 0; + X*BQ = BX; end if; - Cs1.ftype = ftype; - Cs2.ftype = ftype; + Cs1.Xi = X; - Cs1.Xco2 = Xco2; - Cs1.Xh2o = Xh2o; - Cs1.Xo2 = Xo2; - Cs1.Xso2 = Xso2; + Cs2.Xi = X; - Cs2.Xco2 = Xco2; - Cs2.Xh2o = Xh2o; - Cs2.Xo2 = Xo2; - Cs2.Xso2 = Xso2; + /* Traces composition balance equations */ + BSubC = Ce1.Q*Ce1.SubC + Ce2.Q*Ce2.SubC - Cs1.Q*Cs1.SubC - Cs2.Q*Cs2.SubC; + + SubCSaS = SaS(); + if dynamic_mass_balance then + V*rho*der(SubC) + SubC*BQ + V*rho*SubCSaS = BSubC; + else + V*rho*SubCSaS = BSubC; + end if; + + Cs1.SubC = SubC; + Cs2.SubC = SubC; /* Flow reversal */ if continuous_flow_reversal then @@ -327,19 +272,21 @@ equation /* Fluid thermodynamic properties */ if isCompressible and dynamic_mass_balance then - ddph = ThermoSysPro.Properties.Fluid.Density_derp_Ph(P, h, fluid, mode, Xco2, Xh2o, Xo2, Xso2); - ddhp = ThermoSysPro.Properties.Fluid.Density_derh_Ph(P, h, fluid, mode, Xco2, Xh2o, Xo2, Xso2); + ddph = Medium.density_derp_h(state); + ddhp = Medium.density_derh_p(state); else ddph = 0; ddhp = 0; end if; - T = ThermoSysPro.Properties.Fluid.Temperature_Ph(P, h, fluid, mode, Xco2, Xh2o, Xo2, Xso2); + state = Medium.setState_phX(p=P, h=h, X=X); + + T = Medium.temperature(state); if (p_rho > 0) then rho = p_rho; else - rho = ThermoSysPro.Properties.Fluid.Density_Ph(P, h, fluid, mode, Xco2, Xh2o, Xo2, Xso2); + rho = Medium.density(state); end if; annotation ( @@ -395,5 +342,6 @@ equation
  • Daniel Bouskela
  • Baligh El Hefni
  • -")); +"), + uses(ThermoSysPro(version="5.0"))); end VolumeB; From 07ddfe0c125efcb05aa4255f0c4d83c5046817bc Mon Sep 17 00:00:00 2001 From: LAMBLOT Simon Date: Thu, 19 Jun 2025 10:57:41 +0200 Subject: [PATCH 039/178] VolumeD --- .../SimpleExamples/Volumes/TestVolumeD.mo | 25 ++ .../Volumes/TestVolumeD_FlueGases.mo | 34 +++ .../Volumes/TestVolumeD_Traces.mo | 35 +++ .../SimpleExamples/Volumes/package.order | 3 + ThermoSysPro/Fluid/Volumes/VolumeD.mo | 228 +++++++----------- 5 files changed, 184 insertions(+), 141 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeD.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeD_FlueGases.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeD_Traces.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeD.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeD.mo new file mode 100644 index 00000000..998e93ea --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeD.mo @@ -0,0 +1,25 @@ +within ; +model TestVolumeD + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package + Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + VolumeD volumeD(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ( + redeclare replaceable + package Medium = Medium) annotation (Placement(transformation(extent={{-52,-10}, + {-32,10}}))); + SinkQ sinkQ(redeclare replaceable + package Medium = Medium) annotation (Placement(transformation(extent={{12,22}, + {32,42}}))); +equation + connect(sourcePQ.C, volumeD.Ce) + annotation (Line(points={{-32,0},{-10,0}}, color={0,0,0})); + connect(volumeD.Cs3, sink.C) + annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(volumeD.Cs1, sinkQ.C) + annotation (Line(points={{0,10},{0,32},{12,32}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), + uses(ThermoSysPro(version="5.0"))); +end TestVolumeD; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeD_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeD_FlueGases.mo new file mode 100644 index 00000000..ac73a552 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeD_FlueGases.mo @@ -0,0 +1,34 @@ +within ; +model TestVolumeD_FlueGases + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.FlueGases; + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package + Medium = Medium, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{26,16}, + {46,36}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare + replaceable package Medium = Medium, + P0=4500000, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + VolumeD volumeD(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + SinkQ sinkQ( redeclare replaceable + package Medium = Medium, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{-10,-10}, + {10,10}}, + rotation=0, + origin={40,0}))); +equation + connect(volumeD.Cs1, sink.C) + annotation (Line(points={{0,10},{0,26},{26,26}}, + color={0,0,0})); + connect(sourcePQ.C, volumeD.Ce) + annotation (Line(points={{-30,0},{-10,0}}, color={0,0,0})); + connect(volumeD.Cs3, sinkQ.C) + annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), + uses(ThermoSysPro(version="5.0"))); +end TestVolumeD_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeD_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeD_Traces.mo new file mode 100644 index 00000000..818c28dd --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeD_Traces.mo @@ -0,0 +1,35 @@ +within ; +model TestVolumeD_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam ( + extraPropertiesNames={"Trace"}, + C_nominal={0.1}, + C_default={0.2}); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package + Medium = Medium) annotation (Placement(transformation(extent={{20,20}, + {40,40}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare + replaceable package Medium = Medium, + Q0=100, + SubC0={0.5}) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + VolumeD volumeD(redeclare package Medium = Medium, + V=1, + dynamic_mass_balance=false) annotation (Placement(transformation(extent={{-12,-10}, + {8,10}}))); + SinkQ sinkQ( redeclare replaceable + package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10}, + {10,10}}, + rotation=0, + origin={40,0}))); +equation + connect(volumeD.Cs1, sink.C) + annotation (Line(points={{-2,10},{-2,30},{20,30}}, + color={0,0,0})); + connect(sourcePQ.C, volumeD.Ce) + annotation (Line(points={{-30,0},{-12,0}}, color={0,0,0})); + connect(volumeD.Cs3, sinkQ.C) + annotation (Line(points={{8,0},{30,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), + uses(ThermoSysPro(version="5.0"))); +end TestVolumeD_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order index f71ca450..54e962b7 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order @@ -4,3 +4,6 @@ TestVolumeC_Traces TestVolumeA TestVolumeA_FlueGases TestVolumeA_Traces +TestVolumeD +TestVolumeD_FlueGases +TestVolumeD_Traces \ No newline at end of file diff --git a/ThermoSysPro/Fluid/Volumes/VolumeD.mo b/ThermoSysPro/Fluid/Volumes/VolumeD.mo index 181bd9be..5433f455 100644 --- a/ThermoSysPro/Fluid/Volumes/VolumeD.mo +++ b/ThermoSysPro/Fluid/Volumes/VolumeD.mo @@ -1,25 +1,25 @@ -within ThermoSysPro.Fluid.Volumes; +within ; model VolumeD "Mixing volume with 1 inlet and 3 outlets" - extends - ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidTypeParameterInterface; + extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable function SaS = Medium.noSaS(SubC=SubC) annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Boolean dynamic_energy_balance=true "true: dynamic energy balance equation - false: static energy balance equation"; - parameter Units.SI.Volume V=1 + parameter ThermoSysPro.Units.SI.Volume V=1 "Volume (active if dynamic_energy_balance=true)" annotation (Evaluate=true, Dialog(enable=dynamic_energy_balance)); parameter Boolean dynamic_mass_balance=false "true: dynamic mass balance equation - false: static mass balance equation (active if the fluid is compressible and if dynamic_energy_balance=true)" annotation(Evaluate=true, Dialog(enable=isCompressible and dynamic_energy_balance)); parameter Boolean steady_state=true "true: start from steady state - false: start from (P0, h0) (active if dynamic_energy_balance=true)" annotation(Evaluate=true, Dialog(enable=dynamic_energy_balance)); - parameter Units.SI.AbsolutePressure P0=1e5 + parameter ThermoSysPro.Units.SI.AbsolutePressure P0=1e5 "Initial fluid pressure (active if the fluid is compressible, and if dynamic_energy_balance=true and dynamic_mass_balance=true and steady_state=false)" annotation (Evaluate=true, Dialog(enable=isCompressible and dynamic_energy_balance and dynamic_mass_balance and not steady_state)); - parameter Units.SI.SpecificEnthalpy h0=1e5 + parameter ThermoSysPro.Units.SI.SpecificEnthalpy h0=1e5 "Initial fluid specific enthalpy (active if dynamic_energy_balance=true and steady_state=false)" annotation (Evaluate=true, Dialog(enable=dynamic_energy_balance and not steady_state)); @@ -27,87 +27,67 @@ model VolumeD "Mixing volume with 1 inlet and 3 outlets" "true: continuous flow reversal - false: discontinuous flow reversal"; parameter Boolean diffusion=false "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; - parameter Units.SI.Density p_rho=0 "If > 0, fixed fluid density" + parameter ThermoSysPro.Units.SI.Density p_rho=0 "If > 0, fixed fluid density" annotation (Evaluate=true, Dialog(tab="Fluid", group="Fluid properties")); - parameter IF97Region region=IF97Region.All_regions "IF97 region (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); parameter Boolean dynamic_composition_balance=false "true: dynamic fluid composition balance equation
    false: static fluid composition balance equation (active for flue gases)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.FlueGases), tab="Fluid", group="Fluid properties")); - - parameter ThermoSysPro.Units.SI.MassFraction Xco20=0.0 - "Initial CO2 mass fraction" annotation (Evaluate=true, Dialog( + parameter Medium.ExtraProperty X0[Medium.nX]=Medium.X_default "Initial composition values" annotation (Evaluate=true, Dialog( enable=dynamic_composition_balance, tab="Fluid", - group= - "Initial composition values (active for flue gases only if dynamic_composition_balance=true)")); - parameter ThermoSysPro.Units.SI.MassFraction Xh2o0=if ftype == FluidType.FlueGases then 0.05 else 0 - "Initial H20 mass fraction" annotation (Evaluate=true, Dialog( - enable=dynamic_composition_balance, - tab="Fluid", - group= - "Initial composition values (active for flue gases only if dynamic_composition_balance=true)")); - parameter ThermoSysPro.Units.SI.MassFraction Xo20=0.23 - "Initial O2 mass fraction" annotation (Evaluate=true, Dialog( - enable=dynamic_composition_balance, - tab="Fluid", - group= - "Initial composition values (active for flue gases only if dynamic_composition_balance=true)")); - parameter ThermoSysPro.Units.SI.MassFraction Xso20=0 - "Initial SO2 mass fraction" annotation (Evaluate=true, Dialog( - enable=dynamic_composition_balance, - tab="Fluid", - group= - "Initial composition values (active for flue gases only if dynamic_composition_balance=true)")); + group="Medium")); + protected - constant Units.SI.SpecificEnthalpy hr=2501569 - "Water/steam reference specific enthalpy at 0.01°C"; - parameter Boolean flue_gases=(ftype == FluidType.FlueGases) "Flue gases"; - parameter Units.SI.MassFlowRate gamma0=1.e-4 + constant Boolean isCompressible = Medium.isCompressible; + parameter ThermoSysPro.Units.SI.MassFlowRate gamma0=1.e-4 "Pseudo-diffusion conductance use for continuous flow reversal (active if diffusion=false and continuous_flow_reversal = true)"; - parameter Integer mode=Integer(region) - 1 "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; public - Units.SI.Temperature T "Fluid temperature"; - Units.SI.AbsolutePressure P(start=1.e5) "Fluid pressure"; - Units.SI.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy"; - Units.SI.Density rho(start=998) "Fluid density"; - Units.SI.MassFlowRate BQ "Right hand side of the mass balance equation"; - Units.SI.Power BH "Right hand side of the energy balance equation"; - Units.SI.DerDensityByPressure ddph + ThermoSysPro.Units.SI.Temperature T "Fluid temperature"; + ThermoSysPro.Units.SI.AbsolutePressure P(start=1.e5) "Fluid pressure"; + ThermoSysPro.Units.SI.SpecificEnthalpy h(start=100000) + "Fluid specific enthalpy"; + ThermoSysPro.Units.SI.Density rho(start=998) "Fluid density"; + ThermoSysPro.Units.SI.MassFlowRate BQ + "Right hand side of the mass balance equation"; + ThermoSysPro.Units.SI.Power BH + "Right hand side of the energy balance equation"; + ThermoSysPro.Units.SI.DerDensityByPressure ddph "density derivative wrt pressure at constant specific enthalpy"; - Units.SI.DerDensityByEnthalpy ddhp + ThermoSysPro.Units.SI.DerDensityByEnthalpy ddhp "density derivative wrt specific enthalpy at constant pressure"; - FluidType fluids[5] "Fluids mixing in volume"; - Units.SI.MassFlowRate BXco2 "Right hand side of the CO2 balance equation"; - Units.SI.MassFlowRate BXh2o "Right hand side of the H2O balance equation"; - Units.SI.MassFlowRate BXo2 "Right hand side of the O2 balance equation"; - Units.SI.MassFlowRate BXso2 "Right hand side of the SO2 balance equation"; - ThermoSysPro.Units.SI.MassFraction Xco2 "CO2 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xh2o "H20 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xo2 "O2 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xso2 "SO2 mass fraction"; - Units.SI.Power Je "Thermal power diffusion from inlet e"; - Units.SI.Power Js1 "Thermal power diffusion from outlet s1"; - Units.SI.Power Js2 "Thermal power diffusion from outlet s2"; - Units.SI.Power Js3 "Thermal power diffusion from outlet s3"; - Units.SI.Power J "Total thermal power diffusion"; - Units.SI.MassFlowRate gamma_e "Diffusion conductance for inlet e"; - Units.SI.MassFlowRate gamma_s1 "Diffusion conductance for outlet s1"; - Units.SI.MassFlowRate gamma_s2 "Diffusion conductance for outlet s2"; - Units.SI.MassFlowRate gamma_s3 "Diffusion conductance for outlet s3"; + ThermoSysPro.Units.SI.MassFlowRate BX[Medium.nXi] "Right hand side of the X balance equation"; + Medium.ExtraProperty X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Fluid mass fraction"; + Medium.ExtraProperty BSubC[Medium.nC](quantity=Medium.extraPropertiesNames) "Right hand side of the trace balance equation"; + Medium.ExtraProperty SubC[Medium.nC](quantity=Medium.extraPropertiesNames, start=Medium.C_default) "Fluid trace substances"; + Medium.ExtraProperty SubCSaS[Medium.nC](quantity=Medium.extraPropertiesNames) "Trace modification in the trace balance equation"; + Medium.ThermodynamicState state; + ThermoSysPro.Units.SI.Power Je "Thermal power diffusion from inlet e"; + ThermoSysPro.Units.SI.Power Js1 "Thermal power diffusion from outlet s1"; + ThermoSysPro.Units.SI.Power Js2 "Thermal power diffusion from outlet s2"; + ThermoSysPro.Units.SI.Power Js3 "Thermal power diffusion from outlet s3"; + ThermoSysPro.Units.SI.Power J "Total thermal power diffusion"; + ThermoSysPro.Units.SI.MassFlowRate gamma_e + "Diffusion conductance for inlet e"; + ThermoSysPro.Units.SI.MassFlowRate gamma_s1 + "Diffusion conductance for outlet s1"; + ThermoSysPro.Units.SI.MassFlowRate gamma_s2 + "Diffusion conductance for outlet s2"; + ThermoSysPro.Units.SI.MassFlowRate gamma_s3 + "Diffusion conductance for outlet s3"; Real re "Value of r(Q/gamma) for inlet e"; Real rs1 "Value of r(Q/gamma) for outlet s1"; Real rs2 "Value of r(Q/gamma) for outlet s2"; Real rs3 "Value of r(Q/gamma) for outlet s3"; public - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-110,-10},{-90,10}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs1 annotation ( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs1(redeclare package Medium = Medium) annotation ( Placement(transformation(extent={{-10,90},{10,110}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs2 annotation ( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs2(redeclare package Medium = Medium) annotation ( Placement(transformation(extent={{-10,-110},{10,-90}}, rotation=0))); - Interfaces.Connectors.FluidOutlet Cs3 + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs3(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{90,-10},{110,10}}))); initial equation if dynamic_energy_balance and dynamic_mass_balance then @@ -126,19 +106,11 @@ initial equation end if; end if; - if flue_gases then - if dynamic_composition_balance then - if steady_state then - der(Xco2) = 0; - der(Xh2o) = 0; - der(Xo2) = 0; - der(Xso2) = 0; - else - Xco2 = Xco20; - Xh2o = Xh2o0; - Xo2 = Xo20; - Xso2 = Xso20; - end if; + if dynamic_composition_balance then + if steady_state then + der(X) = fill(0,Medium.nX); + else + X = X0[1:Medium.nXi]; end if; end if; @@ -148,16 +120,6 @@ equation assert(V > 0, "Volume non-positive"); end if; - /* Check that incoming fluids are compatible with fluid in volume */ - fluids[1] = ftype; - fluids[2] = Ce.ftype; - fluids[3] = Cs1.ftype; - fluids[4] = Cs2.ftype; - fluids[5] = Cs3.ftype; - - assert(ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.isCompatible(fluids), - "VolumeD: fluids mixing in volume are not compatible with each other"); - /* Unconnected connectors */ if (cardinality(Ce) == 0) then Ce.Q = 0; @@ -165,11 +127,8 @@ equation Ce.h_vol_1 = 1.e5; Ce.diff_res_1 = 0; Ce.diff_on_1 = false; - Ce.ftype = ftype; - Ce.Xco2 = 0; - Ce.Xh2o = 0; - Ce.Xo2 = 0; - Ce.Xso2 = 0; + Ce.Xi = Medium.X_default[1:Medium.nXi]; + Ce.SubC = Medium.C_default; end if; if (cardinality(Cs1) == 0) then @@ -197,7 +156,7 @@ equation BQ = Ce.Q - Cs1.Q - Cs2.Q - Cs3.Q; if isCompressible and dynamic_energy_balance and dynamic_mass_balance then - V*(ddph*der(P) + ddhp*der(h - Xh2o*hr)) = BQ; + V*(ddph*der(P) + ddhp*der(h)) = BQ; else 0 = BQ; end if; @@ -208,13 +167,13 @@ equation P = Cs3.P; /* Energy balance equation */ - BH = Ce.Q*(Ce.h - Ce.Xh2o*hr) - Cs1.Q*(Cs1.h - Cs1.Xh2o*hr) - Cs2.Q*(Cs2.h - Cs2.Xh2o*hr) - Cs3.Q*(Cs3.h - Cs3.Xh2o*hr) + J; + BH = Ce.Q*Ce.h - Cs1.Q*Cs1.h - Cs2.Q*Cs2.h - Cs3.Q*Cs3.h + J; if dynamic_energy_balance then if dynamic_mass_balance then - V*(((h - Xh2o*hr)*ddph - 1)*der(P) + ((h - Xh2o*hr)*ddhp + rho)*der(h - Xh2o*hr)) = BH; + V*((h*ddph - 1)*der(P) + (h*ddhp + rho)*der(h)) = BH; else - V*rho*der(h - Xh2o*hr) = BH; + V*rho*der(h) = BH; end if; else BH = 0; @@ -226,48 +185,32 @@ equation Cs3.h_vol_1 = h; /* Fluid composition balance equations */ - BXco2 = Ce.Xco2*Ce.Q - Cs1.Xco2*Cs1.Q - Cs2.Xco2*Cs2.Q - Cs3.Xco2*Cs3.Q; - BXh2o = Ce.Xh2o*Ce.Q - Cs1.Xh2o*Cs1.Q - Cs2.Xh2o*Cs2.Q - Cs3.Xh2o*Cs3.Q; - BXo2 = Ce.Xo2*Ce.Q - Cs1.Xo2*Cs1.Q - Cs2.Xo2*Cs2.Q - Cs3.Xo2*Cs3.Q; - BXso2 = Ce.Xso2*Ce.Q - Cs1.Xso2*Cs1.Q - Cs2.Xso2*Cs2.Q - Cs3.Xso2*Cs3.Q; - - if flue_gases then - if dynamic_composition_balance then - V*rho*der(Xco2) + Xco2*BQ = BXco2; - V*rho*der(Xh2o) + Xh2o*BQ = BXh2o; - V*rho*der(Xo2) + Xo2*BQ = BXo2; - V*rho*der(Xso2) + Xso2*BQ = BXso2; - else - Xco2*BQ = BXco2; - Xh2o*BQ = BXh2o; - Xo2*BQ = BXo2; - Xso2*BQ = BXso2; - end if; + BX = Ce.Xi*Ce.Q - Cs1.Xi*Cs1.Q - Cs2.Xi*Cs2.Q - Cs3.Xi*Cs3.Q; + + if dynamic_composition_balance then + V*rho*der(X) + X*BQ = BX; else - Xco2 = 0; - Xh2o = 0; - Xo2 = 0; - Xso2 = 0; + X*BQ = BX; end if; - Cs1.ftype = ftype; - Cs2.ftype = ftype; - Cs3.ftype = ftype; - Cs1.Xco2 = Xco2; - Cs1.Xh2o = Xh2o; - Cs1.Xo2 = Xo2; - Cs1.Xso2 = Xso2; + /* Traces composition balance equations */ + BSubC = Ce.Q*Ce.SubC - Cs1.Q*Cs1.SubC - Cs2.Q*Cs2.SubC - Cs3.Q*Cs3.SubC; - Cs2.Xco2 = Xco2; - Cs2.Xh2o = Xh2o; - Cs2.Xo2 = Xo2; - Cs2.Xso2 = Xso2; + SubCSaS = SaS(); + if dynamic_mass_balance then + V*rho*der(SubC) + SubC*BQ + V*rho*SubCSaS = BSubC; + else + V*rho*SubCSaS = BSubC; + end if; - Cs3.Xco2 = Xco2; - Cs3.Xh2o = Xh2o; - Cs3.Xo2 = Xo2; - Cs3.Xso2 = Xso2; + Cs1.SubC = SubC; + Cs2.SubC = SubC; + Cs3.SubC = SubC; + + Cs1.Xi = X; + Cs2.Xi = X; + Cs3.Xi = X; /* Flow reversal */ if continuous_flow_reversal then @@ -327,19 +270,21 @@ equation /* Fluid thermodynamic properties */ if isCompressible and dynamic_mass_balance then - ddph = ThermoSysPro.Properties.Fluid.Density_derp_Ph(P, h, fluid, mode, Xco2, Xh2o, Xo2, Xso2); - ddhp = ThermoSysPro.Properties.Fluid.Density_derh_Ph(P, h, fluid, mode, Xco2, Xh2o, Xo2, Xso2); + ddph = Medium.density_derp_h(state); + ddhp = Medium.density_derh_p(state); else ddph = 0; ddhp = 0; end if; - T = ThermoSysPro.Properties.Fluid.Temperature_Ph(P, h, fluid, mode, Xco2, Xh2o, Xo2, Xso2); + state = Medium.setState_phX(p=P, h=h, X=X); + + T = Medium.temperature(state); if (p_rho > 0) then rho = p_rho; else - rho = ThermoSysPro.Properties.Fluid.Density_Ph(P, h, fluid, mode, Xco2, Xh2o, Xo2, Xso2); + rho = Medium.density(state); end if; annotation ( @@ -395,5 +340,6 @@ equation
  • Daniel Bouskela
  • Baligh El Hefni
  • -")); +"), + uses(ThermoSysPro(version="5.0"))); end VolumeD; From 1eed3e04415229c99515b48dd37045403a27d2b5 Mon Sep 17 00:00:00 2001 From: LAMBLOT Simon Date: Thu, 19 Jun 2025 11:26:48 +0200 Subject: [PATCH 040/178] VolumeI --- .../SimpleExamples/Volumes/TestVolumeI.mo | 30 ++ .../Volumes/TestVolumeI_FlueGases.mo | 40 +++ .../Volumes/TestVolumeI_Traces.mo | 42 +++ .../SimpleExamples/Volumes/package.order | 3 + ThermoSysPro/Fluid/Volumes/VolumeI.mo | 302 +++++++----------- 5 files changed, 233 insertions(+), 184 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeI.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeI_FlueGases.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeI_Traces.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeI.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeI.mo new file mode 100644 index 00000000..1ebbb7b2 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeI.mo @@ -0,0 +1,30 @@ +within ; +model TestVolumeI + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package + Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + VolumeI volumeI(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ( + redeclare replaceable + package Medium = Medium) annotation (Placement(transformation(extent={{-52,-10}, + {-32,10}}))); + SinkQ sinkQ(redeclare replaceable + package Medium = Medium) annotation (Placement(transformation(extent={{12,22}, + {32,42}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare replaceable + package Medium = Medium) annotation (Placement(transformation(extent={{-50,10}, + {-30,30}}))); +equation + connect(volumeI.Cs3, sink.C) + annotation (Line(points={{10,-8},{20,-8},{20,0},{30,0}}, color={0,0,0})); + connect(volumeI.Cs1, sinkQ.C) + annotation (Line(points={{10,8},{10,32},{12,32}}, color={0,0,0})); + connect(sourcePQ.C, volumeI.Ce2) + annotation (Line(points={{-32,0},{-10,0}}, color={0,0,0})); + connect(sourceQ.C, volumeI.Ce1) + annotation (Line(points={{-30,20},{-10,20},{-10,8}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), + uses(ThermoSysPro(version="5.0"))); +end TestVolumeI; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeI_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeI_FlueGases.mo new file mode 100644 index 00000000..5e31755e --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeI_FlueGases.mo @@ -0,0 +1,40 @@ +within ; +model TestVolumeI_FlueGases + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.FlueGases; + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package + Medium = Medium, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{26,-18}, + {46,2}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare + replaceable package Medium = Medium, + P0=4500000, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + VolumeI volumeI(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare replaceable + package Medium = Medium, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{-10,-10}, + {10,10}}, + rotation=0, + origin={-40,20}))); + SinkQ sinkQ( + redeclare replaceable package Medium = Medium, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{22,18}, + {42,38}}))); +equation + connect(sourcePQ.C, volumeI.Ce2) + annotation (Line(points={{-30,0},{-10,0}}, color={0,0,0})); + connect(sourceQ.C, volumeI.Ce1) + annotation (Line(points={{-30,20},{-10,20},{-10,8}}, color={0,0,0})); + connect(sinkQ.C, volumeI.Cs1) + annotation (Line(points={{22,28},{10,28},{10,8}}, color={0,0,0})); + connect(volumeI.Cs3, sink.C) + annotation (Line(points={{10,-8},{26,-8}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), + uses(ThermoSysPro(version="5.0"))); +end TestVolumeI_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeI_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeI_Traces.mo new file mode 100644 index 00000000..1b8840c3 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeI_Traces.mo @@ -0,0 +1,42 @@ +within ; +model TestVolumeI_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam ( + extraPropertiesNames={"Trace"}, + C_nominal={0.1}, + C_default={0.2}); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package + Medium = Medium) annotation (Placement(transformation(extent={{20,20}, + {40,40}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare + replaceable package Medium = Medium, + Q0=100, + SubC0={0.5}) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + VolumeI volumeI(redeclare package Medium = Medium, + V=1, + dynamic_mass_balance=false) annotation (Placement(transformation(extent={{-12,-10}, + {8,10}}))); + SinkQ sinkQ( redeclare replaceable + package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10}, + {10,10}}, + rotation=0, + origin={40,0}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ( + redeclare replaceable package Medium = Medium, + Q0=100, + SubC0={0.5}) annotation (Placement(transformation(extent={{-56,18}, + {-36,38}}))); +equation + connect(volumeI.Cs1, sink.C) + annotation (Line(points={{8,8},{8,30},{20,30}}, + color={0,0,0})); + connect(volumeI.Cs3, sinkQ.C) + annotation (Line(points={{8,-8},{20,-8},{20,0},{30,0}}, color={0,0,0})); + connect(sourcePQ.C, volumeI.Ce2) + annotation (Line(points={{-30,0},{-12,0}}, color={0,0,0})); + connect(sourceQ.C, volumeI.Ce1) + annotation (Line(points={{-36,28},{-12,28},{-12,8}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), + uses(ThermoSysPro(version="5.0"))); +end TestVolumeI_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order index f71ca450..866bee95 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order @@ -4,3 +4,6 @@ TestVolumeC_Traces TestVolumeA TestVolumeA_FlueGases TestVolumeA_Traces +TestVolumeI +TestVolumeI_FlueGases +TestVolumeI_Traces \ No newline at end of file diff --git a/ThermoSysPro/Fluid/Volumes/VolumeI.mo b/ThermoSysPro/Fluid/Volumes/VolumeI.mo index 496d42db..acd70650 100644 --- a/ThermoSysPro/Fluid/Volumes/VolumeI.mo +++ b/ThermoSysPro/Fluid/Volumes/VolumeI.mo @@ -1,25 +1,24 @@ -within ThermoSysPro.Fluid.Volumes; +within ; model VolumeI "Mixing volume with 4 inlets and 4 outlets" - extends - ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidTypeParameterInterface; + extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable function SaS = Medium.noSaS(SubC=SubC) annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Boolean dynamic_energy_balance=true "true: dynamic energy balance equation - false: static energy balance equation"; - parameter Units.SI.Volume V=1 + parameter ThermoSysPro.Units.SI.Volume V=1 "Volume (active if dynamic_energy_balance=true)" annotation (Evaluate=true, Dialog(enable=dynamic_energy_balance)); parameter Boolean dynamic_mass_balance=false "true: dynamic mass balance equation - false: static mass balance equation (active if the fluid is compressible and if dynamic_energy_balance=true)" annotation(Evaluate=true, Dialog(enable=isCompressible and dynamic_energy_balance)); parameter Boolean steady_state=true "true: start from steady state - false: start from (P0, h0) (active if dynamic_energy_balance=true)" annotation(Evaluate=true, Dialog(enable=dynamic_energy_balance)); - parameter Units.SI.AbsolutePressure P0=1e5 + parameter ThermoSysPro.Units.SI.AbsolutePressure P0=1e5 "Initial fluid pressure (active if the fluid is compressible, and if dynamic_energy_balance=true and dynamic_mass_balance=true and steady_state=false)" annotation (Evaluate=true, Dialog(enable=isCompressible and dynamic_energy_balance and dynamic_mass_balance and not steady_state)); - parameter Units.SI.SpecificEnthalpy h0=1e5 + parameter ThermoSysPro.Units.SI.SpecificEnthalpy h0=1e5 "Initial fluid specific enthalpy (active if dynamic_energy_balance=true and steady_state=false)" annotation (Evaluate=true, Dialog(enable=dynamic_energy_balance and not steady_state)); @@ -27,82 +26,67 @@ model VolumeI "Mixing volume with 4 inlets and 4 outlets" "true: continuous flow reversal - false: discontinuous flow reversal"; parameter Boolean diffusion=false "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; - parameter Units.SI.Density p_rho=0 "If > 0, fixed fluid density" + parameter ThermoSysPro.Units.SI.Density p_rho=0 "If > 0, fixed fluid density" annotation (Evaluate=true, Dialog(tab="Fluid", group="Fluid properties")); - parameter IF97Region region=IF97Region.All_regions "IF97 region (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); parameter Boolean dynamic_composition_balance=false "true: dynamic fluid composition balance equation
    false: static fluid composition balance equation (active for flue gases)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.FlueGases), tab="Fluid", group="Fluid properties")); - - parameter ThermoSysPro.Units.SI.MassFraction Xco20=0.0 - "Initial CO2 mass fraction" annotation (Evaluate=true, Dialog( - enable=dynamic_composition_balance, - tab="Fluid", - group= - "Initial composition values (active for flue gases only if dynamic_composition_balance=true)")); - parameter ThermoSysPro.Units.SI.MassFraction Xh2o0=if ftype == FluidType.FlueGases then 0.05 else 0 - "Initial H20 mass fraction" annotation (Evaluate=true, Dialog( - enable=dynamic_composition_balance, - tab="Fluid", - group= - "Initial composition values (active for flue gases only if dynamic_composition_balance=true)")); - parameter ThermoSysPro.Units.SI.MassFraction Xo20=0.23 - "Initial O2 mass fraction" annotation (Evaluate=true, Dialog( - enable=dynamic_composition_balance, - tab="Fluid", - group= - "Initial composition values (active for flue gases only if dynamic_composition_balance=true)")); - parameter ThermoSysPro.Units.SI.MassFraction Xso20=0 - "Initial SO2 mass fraction" annotation (Evaluate=true, Dialog( + parameter Medium.ExtraProperty X0[Medium.nX]=Medium.X_default "Initial composition values" annotation (Evaluate=true, Dialog( enable=dynamic_composition_balance, tab="Fluid", - group= - "Initial composition values (active for flue gases only if dynamic_composition_balance=true)")); + group="Medium")); + + protected - constant Units.SI.SpecificEnthalpy hr=2501569 - "Water/steam reference specific enthalpy at 0.01°C"; - parameter Boolean flue_gases=(ftype == FluidType.FlueGases) "Flue gases"; - parameter Units.SI.MassFlowRate gamma0=1.e-4 + constant Boolean isCompressible = Medium.isCompressible; + parameter ThermoSysPro.Units.SI.MassFlowRate gamma0=1.e-4 "Pseudo-diffusion conductance use for continuous flow reversal (active if diffusion=false and continuous_flow_reversal = true)"; - parameter Integer mode=Integer(region) - 1 "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; public - Units.SI.Temperature T "Fluid temperature"; - Units.SI.AbsolutePressure P(start=1.e5) "Fluid pressure"; - Units.SI.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy"; - Units.SI.Density rho(start=998) "Fluid density"; - Units.SI.MassFlowRate BQ "Right hand side of the mass balance equation"; - Units.SI.Power BH "Right hand side of the energy balance equation"; - Units.SI.DerDensityByPressure ddph + ThermoSysPro.Units.SI.Temperature T "Fluid temperature"; + ThermoSysPro.Units.SI.AbsolutePressure P(start=1.e5) "Fluid pressure"; + ThermoSysPro.Units.SI.SpecificEnthalpy h(start=100000) + "Fluid specific enthalpy"; + ThermoSysPro.Units.SI.Density rho(start=998) "Fluid density"; + ThermoSysPro.Units.SI.MassFlowRate BQ + "Right hand side of the mass balance equation"; + ThermoSysPro.Units.SI.Power BH + "Right hand side of the energy balance equation"; + ThermoSysPro.Units.SI.DerDensityByPressure ddph "density derivative wrt pressure at constant specific enthalpy"; - Units.SI.DerDensityByEnthalpy ddhp + ThermoSysPro.Units.SI.DerDensityByEnthalpy ddhp "density derivative wrt specific enthalpy at constant pressure"; - FluidType fluids[9] "Fluids mixing in volume"; - Units.SI.MassFlowRate BXco2 "Right hand side of the CO2 balance equation"; - Units.SI.MassFlowRate BXh2o "Right hand side of the H2O balance equation"; - Units.SI.MassFlowRate BXo2 "Right hand side of the O2 balance equation"; - Units.SI.MassFlowRate BXso2 "Right hand side of the SO2 balance equation"; - ThermoSysPro.Units.SI.MassFraction Xco2 "CO2 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xh2o "H20 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xo2 "O2 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xso2 "SO2 mass fraction"; - Units.SI.Power Je1 "Thermal power diffusion from inlet e1"; - Units.SI.Power Je2 "Thermal power diffusion from inlet e2"; - Units.SI.Power Je3 "Thermal power diffusion from inlet e3"; - Units.SI.Power Je4 "Thermal power diffusion from inlet e4"; - Units.SI.Power Js1 "Thermal power diffusion from outlet s1"; - Units.SI.Power Js2 "Thermal power diffusion from outlet s2"; - Units.SI.Power Js3 "Thermal power diffusion from outlet s3"; - Units.SI.Power Js4 "Thermal power diffusion from outlet s4"; - Units.SI.Power J "Total thermal power diffusion"; - Units.SI.MassFlowRate gamma_e1 "Diffusion conductance for inlet e1"; - Units.SI.MassFlowRate gamma_e2 "Diffusion conductance for inlet e2"; - Units.SI.MassFlowRate gamma_e3 "Diffusion conductance for inlet e3"; - Units.SI.MassFlowRate gamma_e4 "Diffusion conductance for inlet e4"; - Units.SI.MassFlowRate gamma_s1 "Diffusion conductance for outlet s1"; - Units.SI.MassFlowRate gamma_s2 "Diffusion conductance for outlet s2"; - Units.SI.MassFlowRate gamma_s3 "Diffusion conductance for outlet s3"; - Units.SI.MassFlowRate gamma_s4 "Diffusion conductance for outlet s4"; + ThermoSysPro.Units.SI.MassFlowRate BX[Medium.nXi] "Right hand side of the X balance equation"; + Medium.ExtraProperty X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Fluid mass fraction"; + Medium.ExtraProperty BSubC[Medium.nC](quantity=Medium.extraPropertiesNames) "Right hand side of the trace balance equation"; + Medium.ExtraProperty SubC[Medium.nC](quantity=Medium.extraPropertiesNames, start=Medium.C_default) "Fluid trace substances"; + Medium.ExtraProperty SubCSaS[Medium.nC](quantity=Medium.extraPropertiesNames) "Trace modification in the trace balance equation"; + Medium.ThermodynamicState state; + ThermoSysPro.Units.SI.Power Je1 "Thermal power diffusion from inlet e1"; + ThermoSysPro.Units.SI.Power Je2 "Thermal power diffusion from inlet e2"; + ThermoSysPro.Units.SI.Power Je3 "Thermal power diffusion from inlet e3"; + ThermoSysPro.Units.SI.Power Je4 "Thermal power diffusion from inlet e4"; + ThermoSysPro.Units.SI.Power Js1 "Thermal power diffusion from outlet s1"; + ThermoSysPro.Units.SI.Power Js2 "Thermal power diffusion from outlet s2"; + ThermoSysPro.Units.SI.Power Js3 "Thermal power diffusion from outlet s3"; + ThermoSysPro.Units.SI.Power Js4 "Thermal power diffusion from outlet s4"; + ThermoSysPro.Units.SI.Power J "Total thermal power diffusion"; + ThermoSysPro.Units.SI.MassFlowRate gamma_e1 + "Diffusion conductance for inlet e1"; + ThermoSysPro.Units.SI.MassFlowRate gamma_e2 + "Diffusion conductance for inlet e2"; + ThermoSysPro.Units.SI.MassFlowRate gamma_e3 + "Diffusion conductance for inlet e3"; + ThermoSysPro.Units.SI.MassFlowRate gamma_e4 + "Diffusion conductance for inlet e4"; + ThermoSysPro.Units.SI.MassFlowRate gamma_s1 + "Diffusion conductance for outlet s1"; + ThermoSysPro.Units.SI.MassFlowRate gamma_s2 + "Diffusion conductance for outlet s2"; + ThermoSysPro.Units.SI.MassFlowRate gamma_s3 + "Diffusion conductance for outlet s3"; + ThermoSysPro.Units.SI.MassFlowRate gamma_s4 + "Diffusion conductance for outlet s4"; Real re1 "Value of r(Q/gamma) for inlet e1"; Real re2 "Value of r(Q/gamma) for inlet e2"; Real re3 "Value of r(Q/gamma) for inlet e3"; @@ -113,30 +97,31 @@ public Real rs4 "Value of r(Q/gamma) for outlet s4"; public - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce1 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce1(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-110,70},{-90,90}}, rotation=0), iconTransformation(extent={{-110,70},{-90,90}}))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce2 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce2(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-110,-10},{-90,10}}, rotation=0), iconTransformation(extent={{-110,-10},{-90,10}}))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs1 annotation ( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs1(redeclare package Medium = Medium) annotation ( Placement(transformation(extent={{90,70},{110,90}}, rotation=0), iconTransformation(extent={{90,70},{110,90}}))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs2 annotation ( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs2(redeclare package Medium = Medium) annotation ( Placement(transformation(extent={{90,-10},{110,10}}, rotation=0), iconTransformation(extent={{90,-10},{110,10}}))); - Interfaces.Connectors.FluidInlet Ce3 annotation (Placement(transformation( - extent={{-110,-90},{-90,-70}}), iconTransformation(extent={{-110,-90}, - {-90,-70}}))); - Interfaces.Connectors.FluidInlet Ce4 annotation (Placement(transformation( - extent={{-10,-110},{10,-90}}), iconTransformation(extent={{-10,-110},{ - 10,-90}}))); - Interfaces.Connectors.FluidOutlet Cs3 annotation (Placement(transformation( - extent={{90,-90},{110,-70}}), iconTransformation(extent={{90,-90},{110, - -70}}))); - Interfaces.Connectors.FluidOutlet Cs4 annotation (Placement(transformation( - extent={{-10,90},{10,110}}), iconTransformation(extent={{-10,90},{10,110}}))); + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce3(redeclare package Medium = Medium) annotation (Placement( + transformation(extent={{-110,-90},{-90,-70}}), iconTransformation( + extent={{-110,-90},{-90,-70}}))); + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce4(redeclare package Medium = Medium) annotation (Placement( + transformation(extent={{-10,-110},{10,-90}}), iconTransformation(extent= + {{-10,-110},{10,-90}}))); + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs3(redeclare package Medium = Medium) annotation ( + Placement(transformation(extent={{90,-90},{110,-70}}), iconTransformation( + extent={{90,-90},{110,-70}}))); + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs4(redeclare package Medium = Medium) annotation ( + Placement(transformation(extent={{-10,90},{10,110}}), iconTransformation( + extent={{-10,90},{10,110}}))); initial equation if dynamic_energy_balance and dynamic_mass_balance then if steady_state then @@ -154,19 +139,11 @@ initial equation end if; end if; - if flue_gases then - if dynamic_composition_balance then - if steady_state then - der(Xco2) = 0; - der(Xh2o) = 0; - der(Xo2) = 0; - der(Xso2) = 0; - else - Xco2 = Xco20; - Xh2o = Xh2o0; - Xo2 = Xo20; - Xso2 = Xso20; - end if; + if dynamic_composition_balance then + if steady_state then + der(X) = fill(0,Medium.nX); + else + X = X0[1:Medium.nXi]; end if; end if; @@ -176,20 +153,6 @@ equation assert(V > 0, "Volume non-positive"); end if; - /* Check that incoming fluids are compatible with fluid in volume */ - fluids[1] = ftype; - fluids[2] = Ce1.ftype; - fluids[3] = Ce2.ftype; - fluids[4] = Ce3.ftype; - fluids[5] = Ce4.ftype; - fluids[6] = Cs1.ftype; - fluids[7] = Cs2.ftype; - fluids[8] = Cs3.ftype; - fluids[9] = Cs4.ftype; - - assert(ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.isCompatible(fluids), - "VolumeI: fluids mixing in volume are not compatible with each other"); - /* Unconnected connectors */ if (cardinality(Ce1) == 0) then Ce1.Q = 0; @@ -197,11 +160,8 @@ equation Ce1.h_vol_1 = 1.e5; Ce1.diff_res_1 = 0; Ce1.diff_on_1 = false; - Ce1.ftype = ftype; - Ce1.Xco2 = 0; - Ce1.Xh2o = 0; - Ce1.Xo2 = 0; - Ce1.Xso2 = 0; + Ce1.Xi = Medium.X_default[1:Medium.nXi]; + Ce1.SubC = Medium.C_default; end if; if (cardinality(Ce2) == 0) then @@ -210,11 +170,8 @@ equation Ce2.h_vol_1 = 1.e5; Ce2.diff_res_1 = 0; Ce2.diff_on_1 = false; - Ce2.ftype = ftype; - Ce2.Xco2 = 0; - Ce2.Xh2o = 0; - Ce2.Xo2 = 0; - Ce2.Xso2 = 0; + Ce2.Xi = Medium.X_default[1:Medium.nXi]; + Ce2.SubC = Medium.C_default; end if; if (cardinality(Ce3) == 0) then @@ -223,11 +180,8 @@ equation Ce3.h_vol_1 = 1.e5; Ce3.diff_res_1 = 0; Ce3.diff_on_1 = false; - Ce3.ftype = ftype; - Ce3.Xco2 = 0; - Ce3.Xh2o = 0; - Ce3.Xo2 = 0; - Ce3.Xso2 = 0; + Ce3.Xi = Medium.X_default[1:Medium.nXi]; + Ce3.SubC = Medium.C_default; end if; if (cardinality(Ce4) == 0) then @@ -236,11 +190,8 @@ equation Ce4.h_vol_1 = 1.e5; Ce4.diff_res_1 = 0; Ce4.diff_on_1 = false; - Ce4.ftype = ftype; - Ce4.Xco2 = 0; - Ce4.Xh2o = 0; - Ce4.Xo2 = 0; - Ce4.Xso2 = 0; + Ce4.Xi = Medium.X_default[1:Medium.nXi]; + Ce4.SubC = Medium.C_default; end if; if (cardinality(Cs1) == 0) then @@ -275,7 +226,7 @@ equation BQ = Ce1.Q + Ce2.Q + Ce3.Q + Ce4.Q - Cs1.Q - Cs2.Q - Cs3.Q - Cs4.Q; if isCompressible and dynamic_energy_balance and dynamic_mass_balance then - V*(ddph*der(P) + ddhp*der(h - Xh2o*hr)) = BQ; + V*(ddph*der(P) + ddhp*der(h)) = BQ; else 0 = BQ; end if; @@ -290,13 +241,13 @@ equation P = Cs4.P; /* Energy balance equation */ - BH = Ce1.Q*(Ce1.h - Ce1.Xh2o*hr) + Ce2.Q*(Ce2.h - Ce2.Xh2o*hr) + Ce3.Q*(Ce3.h - Ce3.Xh2o*hr) + Ce4.Q*(Ce4.h - Ce4.Xh2o*hr) - Cs1.Q*(Cs1.h - Cs1.Xh2o*hr) - Cs2.Q*(Cs2.h - Cs2.Xh2o*hr) - Cs3.Q*(Cs3.h - Cs3.Xh2o*hr) - Cs4.Q*(Cs4.h - Cs4.Xh2o*hr) + J; + BH = Ce1.Q*Ce1.h + Ce2.Q*Ce2.h + Ce3.Q*Ce3.h + Ce4.Q*Ce4.h - Cs1.Q*Cs1.h - Cs2.Q*Cs2.h - Cs3.Q*Cs3.h - Cs4.Q*Cs4.h + J; if dynamic_energy_balance then if dynamic_mass_balance then - V*(((h - Xh2o*hr)*ddph - 1)*der(P) + ((h - Xh2o*hr)*ddhp + rho)*der(h - Xh2o*hr)) = BH; + V*((h*ddph - 1)*der(P) + (h*ddhp + rho)*der(h)) = BH; else - V*rho*der(h - Xh2o*hr) = BH; + V*rho*der(h) = BH; end if; else BH = 0; @@ -312,54 +263,34 @@ equation Cs4.h_vol_1 = h; /* Fluid composition balance equations */ - BXco2 = Ce1.Xco2*Ce1.Q + Ce2.Xco2*Ce2.Q + Ce3.Xco2*Ce3.Q + Ce4.Xco2*Ce4.Q - Cs1.Xco2*Cs1.Q - Cs2.Xco2*Cs2.Q - Cs3.Xco2*Cs3.Q - Cs4.Xco2*Cs4.Q; - BXh2o = Ce1.Xh2o*Ce1.Q + Ce2.Xh2o*Ce2.Q + Ce3.Xh2o*Ce3.Q + Ce4.Xh2o*Ce4.Q - Cs1.Xh2o*Cs1.Q - Cs2.Xh2o*Cs2.Q - Cs3.Xh2o*Cs3.Q - Cs4.Xh2o*Cs4.Q; - BXo2 = Ce1.Xo2*Ce1.Q + Ce2.Xo2*Ce2.Q + Ce3.Xo2*Ce3.Q + Ce4.Xo2*Ce4.Q - Cs1.Xo2*Cs1.Q - Cs2.Xo2*Cs2.Q - Cs3.Xo2*Cs3.Q - Cs4.Xo2*Cs4.Q; - BXso2 = Ce1.Xso2*Ce1.Q + Ce2.Xso2*Ce2.Q + Ce3.Xso2*Ce3.Q + Ce4.Xso2*Ce4.Q - Cs1.Xso2*Cs1.Q - Cs2.Xso2*Cs2.Q - Cs3.Xso2*Cs3.Q - Cs4.Xso2*Cs4.Q; - - if flue_gases then - if dynamic_composition_balance then - V*rho*der(Xco2) + Xco2*BQ = BXco2; - V*rho*der(Xh2o) + Xh2o*BQ = BXh2o; - V*rho*der(Xo2) + Xo2*BQ = BXo2; - V*rho*der(Xso2) + Xso2*BQ = BXso2; - else - Xco2*BQ = BXco2; - Xh2o*BQ = BXh2o; - Xo2*BQ = BXo2; - Xso2*BQ = BXso2; - end if; + BX = Ce1.Xi*Ce1.Q + Ce2.Xi*Ce2.Q + Ce3.Xi*Ce3.Q + Ce4.Xi*Ce4.Q - Cs1.Xi*Cs1.Q - Cs2.Xi*Cs2.Q - Cs3.Xi*Cs3.Q - Cs4.Xi*Cs4.Q; + + if dynamic_composition_balance then + V*rho*der(X) + X*BQ = BX; else - Xco2 = 0; - Xh2o = 0; - Xo2 = 0; - Xso2 = 0; + X*BQ = BX; end if; - Cs1.ftype = ftype; - Cs2.ftype = ftype; - Cs3.ftype = ftype; - Cs4.ftype = ftype; + /* Traces composition balance equations */ + BSubC = Ce1.Q*Ce1.SubC + Ce2.Q*Ce2.SubC + Ce3.Q*Ce3.SubC + Ce4.Q*Ce4.SubC - Cs1.Q*Cs1.SubC - Cs2.Q*Cs2.SubC - Cs3.Q*Cs3.SubC - Cs4.Q*Cs4.SubC; - Cs1.Xco2 = Xco2; - Cs1.Xh2o = Xh2o; - Cs1.Xo2 = Xo2; - Cs1.Xso2 = Xso2; + SubCSaS = SaS(); + if dynamic_mass_balance then + V*rho*der(SubC) + SubC*BQ + V*rho*SubCSaS = BSubC; + else + V*rho*SubCSaS = BSubC; + end if; - Cs2.Xco2 = Xco2; - Cs2.Xh2o = Xh2o; - Cs2.Xo2 = Xo2; - Cs2.Xso2 = Xso2; + Cs1.SubC = SubC; + Cs2.SubC = SubC; + Cs3.SubC = SubC; + Cs4.SubC = SubC; - Cs3.Xco2 = Xco2; - Cs3.Xh2o = Xh2o; - Cs3.Xo2 = Xo2; - Cs3.Xso2 = Xso2; + Cs1.Xi = X; + Cs2.Xi = X; + Cs3.Xi = X; + Cs4.Xi = X; - Cs4.Xco2 = Xco2; - Cs4.Xh2o = Xh2o; - Cs4.Xo2 = Xo2; - Cs4.Xso2 = Xso2; /* Flow reversal */ if continuous_flow_reversal then @@ -453,19 +384,21 @@ equation /* Fluid thermodynamic properties */ if isCompressible and dynamic_mass_balance then - ddph = ThermoSysPro.Properties.Fluid.Density_derp_Ph(P, h, fluid, mode, Xco2, Xh2o, Xo2, Xso2); - ddhp = ThermoSysPro.Properties.Fluid.Density_derh_Ph(P, h, fluid, mode, Xco2, Xh2o, Xo2, Xso2); + ddph = Medium.density_derp_h(state); + ddhp = Medium.density_derh_p(state); else ddph = 0; ddhp = 0; end if; - T = ThermoSysPro.Properties.Fluid.Temperature_Ph(P, h, fluid, mode, Xco2, Xh2o, Xo2, Xso2); + state = Medium.setState_phX(p=P, h=h, X=X); + + T = Medium.temperature(state); if (p_rho > 0) then rho = p_rho; else - rho = ThermoSysPro.Properties.Fluid.Density_Ph(P, h, fluid, mode, Xco2, Xh2o, Xo2, Xso2); + rho = Medium.density(state); end if; annotation ( @@ -557,5 +490,6 @@ equation
  • Daniel Bouskela
  • Baligh El Hefni
  • -")); +"), + uses(ThermoSysPro(version="5.0"))); end VolumeI; From 97fd5470dbafc866a690244e2d5aba5d3344b302 Mon Sep 17 00:00:00 2001 From: LAMBLOT Simon Date: Thu, 19 Jun 2025 11:41:28 +0200 Subject: [PATCH 041/178] Bend --- .../SimpleExamples/PressureLosses/TestBend.mo | 25 ++++++++ .../PressureLosses/TestBend_FlueGases.mo | 27 ++++++++ .../PressureLosses/TestBend_Traces.mo | 29 +++++++++ .../PressureLosses/package.order | 3 + ThermoSysPro/Fluid/PressureLosses/Bend.mo | 61 +++++++++---------- 5 files changed, 113 insertions(+), 32 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestBend.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestBend_FlueGases.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestBend_Traces.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestBend.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestBend.mo new file mode 100644 index 00000000..b6202084 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestBend.mo @@ -0,0 +1,25 @@ +within ; +model TestBend + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; + Bend bend( + redeclare replaceable package Medium = Medium) + annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package + Medium = Medium) + annotation (Placement(transformation(extent={{-10,-10},{10,10}}, + rotation=270, + origin={0,-40}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare + replaceable package Medium = Medium) + annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); +equation + connect(bend.C2, sink.C) annotation (Line(points={{0,-10},{0,-22},{ + 1.77636e-15,-22},{1.77636e-15,-30}}, color={0,0,0})); + connect(bend.C1, sourcePQ.C) + annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( + coordinateSystem(preserveAspectRatio=false)), + uses(ThermoSysPro(version="5.0"))); +end TestBend; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestBend_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestBend_FlueGases.mo new file mode 100644 index 00000000..3b8b4911 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestBend_FlueGases.mo @@ -0,0 +1,27 @@ +within ; +model TestBend_FlueGases + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.FlueGases; + Bend bend( redeclare + replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink( + redeclare replaceable package Medium = Medium, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{-10,-10}, + {10,10}}, + rotation=270, + origin={0,-40}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ( + redeclare replaceable package Medium = Medium, + P0=4500000, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); +equation + connect(bend.C2, sink.C) annotation (Line(points={{0,-10},{0,-30},{ + 1.77636e-15,-30}}, color={0,0,0})); + connect(bend.C1, sourcePQ.C) + annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), + uses(ThermoSysPro(version="5.0"))); +end TestBend_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestBend_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestBend_Traces.mo new file mode 100644 index 00000000..472395e5 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestBend_Traces.mo @@ -0,0 +1,29 @@ +within ; +model TestBend_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam ( + extraPropertiesNames={"Trace1"}, + C_nominal={0.1}, + C_default={0.2}); + Bend bend(redeclare + replaceable package Medium = + Medium) + annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package + Medium = Medium) + annotation (Placement(transformation(extent={{-10,-10},{10,10}}, + rotation=270, + origin={0,-40}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare + replaceable package Medium = Medium, SubC0={0.3}) + annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); +equation + connect(bend.C2, sink.C) annotation (Line(points={{0,-10},{0,-23},{1.77636e-15, + -23},{1.77636e-15,-30}}, color={0,0,0})); + connect(bend.C1, sourcePQ.C) + annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( + coordinateSystem(preserveAspectRatio=false)), + uses(ThermoSysPro(version="5.0"))); +end TestBend_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order index e89506ae..45cdceb3 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order @@ -7,3 +7,6 @@ TestSingularPressureLoss_Traces_FlueGases TestControlValve TestControlValve_Traces TestControlValve_Traces_FlueGases +TestBend_FlueGases +TestBend_Traces +TestBend \ No newline at end of file diff --git a/ThermoSysPro/Fluid/PressureLosses/Bend.mo b/ThermoSysPro/Fluid/PressureLosses/Bend.mo index 63df39db..ae391d93 100644 --- a/ThermoSysPro/Fluid/PressureLosses/Bend.mo +++ b/ThermoSysPro/Fluid/PressureLosses/Bend.mo @@ -1,25 +1,22 @@ -within ThermoSysPro.Fluid.PressureLosses; +within ; model Bend "Bend" - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); - parameter Units.SI.Diameter D=0.2 "Pipe diameter"; - parameter Units.SI.Radius R0=0.2 "Pipe radius"; + parameter ThermoSysPro.Units.SI.Diameter D=0.2 "Pipe diameter"; + parameter ThermoSysPro.Units.SI.Radius R0=0.2 "Pipe radius"; parameter ThermoSysPro.Units.nonSI.Angle_deg delta=90 "Pipe angle"; parameter Real rugosrel=0 "Pipe roughness"; parameter Boolean K_A1_Tabule=true "true: A1 is computed using linear interpolation - false: A1 is computed using correlation formula"; parameter Boolean K_B1_Tabule=true "true: B1 is computed using linear interpolation - false: B1 is computed using correlation formula"; - parameter Units.SI.MassFlowRate gamma_diff=1e-4 + parameter ThermoSysPro.Units.SI.MassFlowRate gamma_diff=1e-4 "Diffusion conductance (active if diffusion=true in neighbouring volumes)"; - parameter Units.SI.Density p_rho=0 "If > 0, fixed fluid density" + parameter ThermoSysPro.Units.SI.Density p_rho=0 "If > 0, fixed fluid density" annotation (Evaluate=true, Dialog(tab="Fluid", group="Fluid properties")); - parameter IF97Region region=IF97Region.All_regions "IF97 region (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); protected constant Real pi=Modelica.Constants.pi "pi"; - parameter Integer mode=Integer(region) - 1 "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; parameter Real eps=1.e-3 "Small number for pressure loss equation"; public @@ -28,20 +25,20 @@ public Real khif "Friction pressure loss coefficient"; Real kdelta "Roughness factor for the singular pressure loss"; ThermoSysPro.Units.SI.PressureDifference deltaP "Presure loss"; - Units.SI.MassFlowRate Q "Mass flow rate"; - Units.SI.ReynoldsNumber Re "Reynolds number"; - Units.SI.ReynoldsNumber Relim "Limit Reynolds number"; + ThermoSysPro.Units.SI.MassFlowRate Q "Mass flow rate"; + ThermoSysPro.Units.SI.ReynoldsNumber Re "Reynolds number"; + ThermoSysPro.Units.SI.ReynoldsNumber Relim "Limit Reynolds number"; Real yA1 "Output of table A1"; Real yB1 "Output of table B1"; Real yC1 "Output of table C1"; Real lambda "Friction pressure loss coefficient"; - Units.SI.Density rho "Fluid density"; - Units.SI.DynamicViscosity mu "Fluid dynamic viscosity"; - Units.SI.Temperature T "Fluid temperature"; - Units.SI.AbsolutePressure Pm "Fluid average pressure"; - Units.SI.SpecificEnthalpy h "Fluid specific enthalpy"; - FluidType ftype "Fluid type"; - Integer fluid=Integer(ftype) "Fluid number"; + ThermoSysPro.Units.SI.Density rho "Fluid density"; + ThermoSysPro.Units.SI.DynamicViscosity mu "Fluid dynamic viscosity"; + ThermoSysPro.Units.SI.Temperature T "Fluid temperature"; + ThermoSysPro.Units.SI.AbsolutePressure Pm "Fluid average pressure"; + ThermoSysPro.Units.SI.SpecificEnthalpy h "Fluid specific enthalpy"; + Medium.MassFraction X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Mass fractions"; + Medium.ThermodynamicState state; public ThermoSysPro.InstrumentationAndControl.Blocks.Tables.Table1D TA1( @@ -54,9 +51,9 @@ public 8, 0.07; 10, 0.07; 15, 0.06; 20, 0.05; 25, 0.05; 30, 0.04; 35, 0.04; 40, 0.03; 45, 0.03; 50, 0.03]) annotation (Placement(transformation(extent= {{20,80},{40,100}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-110,-10},{-90,10}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-10,-110},{10,-90}}, rotation=0))); equation @@ -72,19 +69,17 @@ equation C2.diff_res_1 = C1.diff_res_1 + (if (gamma_diff > 0) then 1/gamma_diff else 0); C1.diff_res_2 = C2.diff_res_2 + (if (gamma_diff > 0) then 1/gamma_diff else 0); - C1.ftype = C2.ftype; + C1.Xi = C2.Xi; - C1.Xco2 = C2.Xco2; - C1.Xh2o = C2.Xh2o; - C1.Xo2 = C2.Xo2; - C1.Xso2 = C2.Xso2; + X = C1.Xi; + + + C1.SubC = C2.SubC; Q = C1.Q; h = C1.h; C1.P - C2.P = deltaP; - ftype = C1.ftype; - /* Pressure loss */ deltaP = 8*khi*ThermoSysPro.Functions.ThermoSquare(Q, eps)/(pi^2*D^4*rho); @@ -135,15 +130,16 @@ equation /* Fluid thermodynamic properties */ Pm = (C1.P + C2.P)/2; - T = ThermoSysPro.Properties.Fluid.Temperature_Ph(Pm, h, fluid, mode, C1.Xco2, C1.Xh2o, C1.Xo2, C1.Xso2); + T = Medium.temperature_phX(p=Pm, h=h, X=X); if (p_rho > 0) then rho = p_rho; else - rho = ThermoSysPro.Properties.Fluid.Density_Ph(Pm, h, fluid,mode, C1.Xco2, C1.Xh2o, C1.Xo2, C1.Xso2); + rho = Medium.density_phX(p=Pm, h=h, X=X); end if; - mu = ThermoSysPro.Properties.Fluid.DynamicViscosity_Ph(Pm, h, fluid, mode, C1.Xco2, C1.Xh2o, C1.Xo2, C1.Xso2); + state=Medium.setState_phX(p=Pm, h=h, X=X); + mu = Medium.dynamicViscosity(state); annotation ( Diagram(coordinateSystem( @@ -226,5 +222,6 @@ equation
  • Daniel Bouskela
  • Baligh El Hefni
  • -")); +"), + uses(ThermoSysPro(version="5.0"), Modelica(version="4.0.0"))); end Bend; From dc8e84985eda447a3fad73e6f3ce02dfd6ef5a99 Mon Sep 17 00:00:00 2001 From: LAMBLOT Simon Date: Thu, 19 Jun 2025 14:07:25 +0200 Subject: [PATCH 042/178] CheckValve --- .../PressureLosses/TestCheckValve.mo | 25 +++++++++ .../TestCheckValve_FlueGases.mo | 27 ++++++++++ .../PressureLosses/TestCheckValve_Traces.mo | 30 +++++++++++ .../PressureLosses/package.order | 3 ++ .../Fluid/PressureLosses/CheckValve.mo | 54 +++++++++---------- 5 files changed, 111 insertions(+), 28 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestCheckValve.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestCheckValve_FlueGases.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestCheckValve_Traces.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestCheckValve.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestCheckValve.mo new file mode 100644 index 00000000..e544c359 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestCheckValve.mo @@ -0,0 +1,25 @@ +within ; +model TestCheckValve + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; + CheckValve checkValve( + redeclare replaceable package Medium = Medium) + annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package + Medium = Medium) + annotation (Placement(transformation(extent={{-10,-10},{10,10}}, + rotation=0, + origin={40,0}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare + replaceable package Medium = Medium) + annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); +equation + connect(checkValve.C2, sink.C) + annotation (Line(points={{11,0},{30,0}}, color={0,0,0})); + connect(checkValve.C1, sourcePQ.C) + annotation (Line(points={{-11,0},{-30,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( + coordinateSystem(preserveAspectRatio=false)), + uses(ThermoSysPro(version="5.0"))); +end TestCheckValve; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestCheckValve_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestCheckValve_FlueGases.mo new file mode 100644 index 00000000..6efa2a46 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestCheckValve_FlueGases.mo @@ -0,0 +1,27 @@ +within ; +model TestCheckValve_FlueGases + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.FlueGases; + CheckValve checkValve( redeclare + replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink( + redeclare replaceable package Medium = Medium, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{-10,-10}, + {10,10}}, + rotation=0, + origin={40,0}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ( + redeclare replaceable package Medium = Medium, + P0=4500000, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); +equation + connect(checkValve.C2, sink.C) + annotation (Line(points={{11,0},{30,0}}, color={0,0,0})); + connect(checkValve.C1, sourcePQ.C) + annotation (Line(points={{-11,0},{-30,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), + uses(ThermoSysPro(version="5.0"))); +end TestCheckValve_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestCheckValve_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestCheckValve_Traces.mo new file mode 100644 index 00000000..b69800a3 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestCheckValve_Traces.mo @@ -0,0 +1,30 @@ +within ; +model TestCheckValve_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam ( + extraPropertiesNames={"Trace1"}, + C_nominal={0.1}, + C_default={0.2}); + CheckValve checkValve( + redeclare + replaceable package Medium = + Medium) + annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package + Medium = Medium) + annotation (Placement(transformation(extent={{-10,-10},{10,10}}, + rotation=0, + origin={40,0}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare + replaceable package Medium = Medium, SubC0={0.3}) + annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); +equation + connect(checkValve.C2, sink.C) + annotation (Line(points={{11,0},{30,0}}, color={0,0,0})); + connect(checkValve.C1, sourcePQ.C) + annotation (Line(points={{-11,0},{-30,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( + coordinateSystem(preserveAspectRatio=false)), + uses(ThermoSysPro(version="5.0"))); +end TestCheckValve_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order index e89506ae..35fc069f 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order @@ -7,3 +7,6 @@ TestSingularPressureLoss_Traces_FlueGases TestControlValve TestControlValve_Traces TestControlValve_Traces_FlueGases +TestCheckValve_FlueGases +TestCheckValve_Traces +TestCheckValve \ No newline at end of file diff --git a/ThermoSysPro/Fluid/PressureLosses/CheckValve.mo b/ThermoSysPro/Fluid/PressureLosses/CheckValve.mo index 1cd3ad57..0add4436 100644 --- a/ThermoSysPro/Fluid/PressureLosses/CheckValve.mo +++ b/ThermoSysPro/Fluid/PressureLosses/CheckValve.mo @@ -1,7 +1,6 @@ -within ThermoSysPro.Fluid.PressureLosses; +within ; model CheckValve "Check valve" - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter ThermoSysPro.Units.SI.PressureDifference dPOuvert=10 "Pressure difference when the valve opens"; @@ -9,34 +8,34 @@ model CheckValve "Check valve" "Pressure difference when the valve closes"; parameter ThermoSysPro.Units.xSI.PressureLossCoefficient k=1000 "Pressure loss coefficient"; - parameter Units.SI.MassFlowRate Qmin=1.e-6 + parameter ThermoSysPro.Units.SI.MassFlowRate Qmin=1.e-6 "Mass flow when the valve is closed"; - parameter Units.SI.MassFlowRate gamma_diff=1e-4 + parameter ThermoSysPro.Units.SI.MassFlowRate gamma_diff=1e-4 "Diffusion conductance (active if diffusion=true in neighbouring volumes)"; - parameter Units.SI.Density p_rho=0 "If > 0, fixed fluid density" + parameter ThermoSysPro.Units.SI.Density p_rho=0 "If > 0, fixed fluid density" annotation (Evaluate=true, Dialog(tab="Fluid", group="Fluid properties")); - parameter IF97Region region=IF97Region.All_regions "IF97 region (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); protected - parameter Integer mode=Integer(region) - 1 "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; parameter Real eps=1.e-3 "Small number for pressure loss equation"; public Boolean ouvert(start=true, fixed=true) "Valve state"; discrete Boolean touvert(start=false, fixed=true); discrete Boolean tferme(start=false, fixed=true); - Units.SI.MassFlowRate Q(start=500) "Mass flow rate"; + ThermoSysPro.Units.SI.MassFlowRate Q(start=500) "Mass flow rate"; ThermoSysPro.Units.SI.PressureDifference deltaP "Singular pressure loss"; - Units.SI.Density rho(start=998) "Fluid density"; - Units.SI.Temperature T(start=290) "Fluid temperature"; - Units.SI.AbsolutePressure Pm(start=1.e5) "Fluid average pressure"; - Units.SI.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy"; - FluidType ftype "Fluid type"; - Integer fluid=Integer(ftype) "Fluid number"; - - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1 annotation (Placement( + ThermoSysPro.Units.SI.Density rho(start=998) "Fluid density"; + ThermoSysPro.Units.SI.Temperature T(start=290) "Fluid temperature"; + ThermoSysPro.Units.SI.AbsolutePressure Pm(start=1.e5) + "Fluid average pressure"; + ThermoSysPro.Units.SI.SpecificEnthalpy h(start=100000) + "Fluid specific enthalpy"; + Medium.MassFraction X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Mass fractions"; + + + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-120,-10},{-100,10}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{100,-10},{120,10}}, rotation=0))); equation @@ -52,19 +51,17 @@ equation C2.diff_res_1 = C1.diff_res_1 + (if (gamma_diff > 0) then 1/gamma_diff else 0); C1.diff_res_2 = C2.diff_res_2 + (if (gamma_diff > 0) then 1/gamma_diff else 0); - C1.ftype = C2.ftype; + C1.Xi = C2.Xi; + + X = C1.Xi; - C1.Xco2 = C2.Xco2; - C1.Xh2o = C2.Xh2o; - C1.Xo2 = C2.Xo2; - C1.Xso2 = C2.Xso2; + + C1.SubC = C2.SubC; Q = C1.Q; h = C1.h; deltaP = C1.P - C2.P; - ftype = C1.ftype; - /* Pressure loss */ if ouvert then deltaP - k*ThermoSysPro.Functions.ThermoSquare(Q, eps)/2/rho = 0; @@ -82,12 +79,12 @@ equation /* Fluid thermodynamic properties */ Pm = (C1.P + C2.P)/2; - T = ThermoSysPro.Properties.Fluid.Temperature_Ph(Pm, h, fluid, mode, C1.Xco2, C1.Xh2o, C1.Xo2, C1.Xso2); + T = Medium.temperature_phX(p=Pm, h=h, X=X); if (p_rho > 0) then rho = p_rho; else - rho = ThermoSysPro.Properties.Fluid.Density_Ph(Pm, h, fluid, mode, C1.Xco2, C1.Xh2o, C1.Xo2, C1.Xso2); + rho = Medium.density_phX(p=Pm, h=h, X=X); end if; annotation ( Diagram(coordinateSystem( @@ -136,5 +133,6 @@ equation
  • Daniel Bouskela
  • "), - DymolaStoredErrors); + DymolaStoredErrors, + uses(ThermoSysPro(version="5.0"))); end CheckValve; From 52b91e87a7bec6334d39c66a56001ba163a1a8fc Mon Sep 17 00:00:00 2001 From: LAMBLOT Simon Date: Thu, 19 Jun 2025 14:13:57 +0200 Subject: [PATCH 043/178] Diaphragm --- .../PressureLosses/TestDiaphragm.mo | 19 ++++++ .../PressureLosses/TestDiaphragm_FlueGases.mo | 24 ++++++++ .../PressureLosses/TestDiaphragm_Traces.mo | 23 ++++++++ .../PressureLosses/package.order | 3 + .../Fluid/PressureLosses/Diaphragm.mo | 59 +++++++++---------- 5 files changed, 97 insertions(+), 31 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDiaphragm.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDiaphragm_FlueGases.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDiaphragm_Traces.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDiaphragm.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDiaphragm.mo new file mode 100644 index 00000000..7210150b --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDiaphragm.mo @@ -0,0 +1,19 @@ +within ; +model TestDiaphragm + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; + Diaphragm diaphragm( redeclare + replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package + Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare + replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); +equation + connect(diaphragm.C2, sink.C) + annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(diaphragm.C1, sourcePQ.C) + annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), + uses(ThermoSysPro(version="5.0"))); +end TestDiaphragm; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDiaphragm_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDiaphragm_FlueGases.mo new file mode 100644 index 00000000..3f8b5717 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDiaphragm_FlueGases.mo @@ -0,0 +1,24 @@ +within ; +model TestDiaphragm_FlueGases + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.FlueGases; + Diaphragm diaphragm( redeclare + replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink( + redeclare replaceable package Medium = Medium, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ( + redeclare replaceable package Medium = Medium, + P0=4500000, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); +equation + connect(diaphragm.C2, sink.C) + annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(diaphragm.C1, sourcePQ.C) + annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), + uses(ThermoSysPro(version="5.0"))); +end TestDiaphragm_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDiaphragm_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDiaphragm_Traces.mo new file mode 100644 index 00000000..28493bad --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDiaphragm_Traces.mo @@ -0,0 +1,23 @@ +within ; +model TestDiaphragm_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam ( + extraPropertiesNames={"Trace"}, + C_nominal={0.1}, + C_default={0.2}); + Diaphragm diaphragm( redeclare + replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package + Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare + replaceable package Medium = Medium, SubC0={0.3}) + annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); +equation + connect(diaphragm.C2, sink.C) + annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(diaphragm.C1, sourcePQ.C) + annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), + uses(ThermoSysPro(version="5.0"))); +end TestDiaphragm_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order index e89506ae..7734b975 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order @@ -7,3 +7,6 @@ TestSingularPressureLoss_Traces_FlueGases TestControlValve TestControlValve_Traces TestControlValve_Traces_FlueGases +TestDiaphragm_FlueGases +TestDiaphragm_Traces +TestDiaphragm \ No newline at end of file diff --git a/ThermoSysPro/Fluid/PressureLosses/Diaphragm.mo b/ThermoSysPro/Fluid/PressureLosses/Diaphragm.mo index c5562c1a..98ae7b33 100644 --- a/ThermoSysPro/Fluid/PressureLosses/Diaphragm.mo +++ b/ThermoSysPro/Fluid/PressureLosses/Diaphragm.mo @@ -1,39 +1,36 @@ -within ThermoSysPro.Fluid.PressureLosses; +within ; model Diaphragm "Diaphragm" - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Real Ouv=0.5 "Diaphragm aperture"; - parameter Units.SI.Diameter D=0.2 "Diaphragm diameter"; - parameter Units.SI.MassFlowRate gamma_diff=1e-4 + parameter ThermoSysPro.Units.SI.Diameter D=0.2 "Diaphragm diameter"; + parameter ThermoSysPro.Units.SI.MassFlowRate gamma_diff=1e-4 "Diffusion conductance (active if diffusion=true in neighbouring volumes)"; - parameter Units.SI.Density p_rho=0 "If > 0, fixed fluid density" + parameter ThermoSysPro.Units.SI.Density p_rho=0 "If > 0, fixed fluid density" annotation (Evaluate=true, Dialog(tab="Fluid", group="Fluid properties")); - parameter IF97Region region=IF97Region.All_regions "IF97 region (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); protected constant Real pi=Modelica.Constants.pi "pi"; - parameter Integer mode=Integer(region) - 1 "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; parameter Real eps=1.e-3 "Small number for pressure loss equation"; public Real khi "Hydraulic pressure loss coefficient"; ThermoSysPro.Units.SI.PressureDifference deltaP "Pressure loss"; - Units.SI.MassFlowRate Q "Mass flow rate"; - Units.SI.ReynoldsNumber Re "Reynolds number"; - Units.SI.ReynoldsNumber Relim "Limit Reynolds number"; - Units.SI.Density rho "Fluid density"; - Units.SI.DynamicViscosity mu "Fluid dynamic viscosity"; - Units.SI.Temperature T "Fluid temperature"; - Units.SI.AbsolutePressure Pm "Fluid average pressure"; - Units.SI.SpecificEnthalpy h "Fluid specific enthalpy"; - FluidType ftype "Fluid type"; - Integer fluid=Integer(ftype) "Fluid number"; + ThermoSysPro.Units.SI.MassFlowRate Q "Mass flow rate"; + ThermoSysPro.Units.SI.ReynoldsNumber Re "Reynolds number"; + ThermoSysPro.Units.SI.ReynoldsNumber Relim "Limit Reynolds number"; + ThermoSysPro.Units.SI.Density rho "Fluid density"; + ThermoSysPro.Units.SI.DynamicViscosity mu "Fluid dynamic viscosity"; + ThermoSysPro.Units.SI.Temperature T "Fluid temperature"; + ThermoSysPro.Units.SI.AbsolutePressure Pm "Fluid average pressure"; + ThermoSysPro.Units.SI.SpecificEnthalpy h "Fluid specific enthalpy"; + Medium.MassFraction X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Mass fractions"; + Medium.ThermodynamicState state; public - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-110,-10},{-90,10}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{90,-10},{110,10}}, rotation=0))); equation @@ -49,19 +46,17 @@ equation C2.diff_res_1 = C1.diff_res_1 + (if (gamma_diff > 0) then 1/gamma_diff else 0); C1.diff_res_2 = C2.diff_res_2 + (if (gamma_diff > 0) then 1/gamma_diff else 0); - C1.ftype = C2.ftype; + C1.Xi = C2.Xi; - C1.Xco2 = C2.Xco2; - C1.Xh2o = C2.Xh2o; - C1.Xo2 = C2.Xo2; - C1.Xso2 = C2.Xso2; + X = C1.Xi; + + + C1.SubC = C2.SubC; Q = C1.Q; h = C1.h; C1.P - C2.P = deltaP; - ftype = C1.ftype; - /* Pressure loss */ deltaP = 8*khi*ThermoSysPro.Functions.ThermoSquare(Q, eps)/(pi^2*D^4*rho); @@ -77,15 +72,16 @@ equation /* Fluid thermodynamic properties */ Pm = (C1.P + C2.P)/2; - T = ThermoSysPro.Properties.Fluid.Temperature_Ph(Pm, h, fluid, mode, C1.Xco2, C1.Xh2o, C1.Xo2, C1.Xso2); + T = Medium.temperature_phX(p=Pm, h=h, X=X); if (p_rho > 0) then rho = p_rho; else - rho = ThermoSysPro.Properties.Fluid.Density_Ph(Pm, h, fluid, mode, C1.Xco2, C1.Xh2o, C1.Xo2, C1.Xso2); + rho = Medium.density_phX(p=Pm, h=h, X=X); end if; - mu = ThermoSysPro.Properties.Fluid.DynamicViscosity_Ph(Pm, h, fluid, mode, C1.Xco2, C1.Xh2o, C1.Xo2, C1.Xso2); + state=Medium.setState_phX(p=Pm, h=h, X=X); + mu = Medium.dynamicViscosity(state); annotation ( Diagram(coordinateSystem( preserveAspectRatio=false, @@ -142,5 +138,6 @@ equation
    • Daniel Bouskela
    -")); +"), + uses(ThermoSysPro(version="5.0"), Modelica(version="4.0.0"))); end Diaphragm; From f4f77c636def8b885297e6c0346f87e61931781a Mon Sep 17 00:00:00 2001 From: LAMBLOT Simon Date: Thu, 19 Jun 2025 14:23:37 +0200 Subject: [PATCH 044/178] DynamicCheckValve --- .../PressureLosses/TestDynamicCheckValve.mo | 20 +++++ .../TestDynamicCheckValve_FlueGases.mo | 25 ++++++ .../TestDynamicCheckValve_Traces.mo | 24 ++++++ .../PressureLosses/package.order | 3 + .../Fluid/PressureLosses/DynamicCheckValve.mo | 83 ++++++++++--------- 5 files changed, 114 insertions(+), 41 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDynamicCheckValve.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDynamicCheckValve_FlueGases.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDynamicCheckValve_Traces.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDynamicCheckValve.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDynamicCheckValve.mo new file mode 100644 index 00000000..9ae856f0 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDynamicCheckValve.mo @@ -0,0 +1,20 @@ +within ; +model TestDynamicCheckValve + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; + DynamicCheckValve dynamicCheckValve( + redeclare + replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package + Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare + replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); +equation + connect(dynamicCheckValve.C2, sink.C) + annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(dynamicCheckValve.C1, sourcePQ.C) + annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), + uses(ThermoSysPro(version="5.0"))); +end TestDynamicCheckValve; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDynamicCheckValve_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDynamicCheckValve_FlueGases.mo new file mode 100644 index 00000000..969a2303 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDynamicCheckValve_FlueGases.mo @@ -0,0 +1,25 @@ +within ; +model TestDynamicCheckValve_FlueGases + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.FlueGases; + DynamicCheckValve dynamicCheckValve( + redeclare + replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink( + redeclare replaceable package Medium = Medium, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ( + redeclare replaceable package Medium = Medium, + P0=4500000, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); +equation + connect(dynamicCheckValve.C2, sink.C) + annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(dynamicCheckValve.C1, sourcePQ.C) + annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), + uses(ThermoSysPro(version="5.0"))); +end TestDynamicCheckValve_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDynamicCheckValve_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDynamicCheckValve_Traces.mo new file mode 100644 index 00000000..e004f96b --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDynamicCheckValve_Traces.mo @@ -0,0 +1,24 @@ +within ; +model TestDynamicCheckValve_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam ( + extraPropertiesNames={"Trace"}, + C_nominal={0.1}, + C_default={0.2}); + DynamicCheckValve dynamicCheckValve( + redeclare + replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package + Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare + replaceable package Medium = Medium, SubC0={0.3}) + annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); +equation + connect(dynamicCheckValve.C2, sink.C) + annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(dynamicCheckValve.C1, sourcePQ.C) + annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), + uses(ThermoSysPro(version="5.0"))); +end TestDynamicCheckValve_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order index e89506ae..b6c50db3 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order @@ -7,3 +7,6 @@ TestSingularPressureLoss_Traces_FlueGases TestControlValve TestControlValve_Traces TestControlValve_Traces_FlueGases +TestDynamicCheckValve_FlueGases +TestDynamicCheckValve_Traces +TestDynamicCheckValve \ No newline at end of file diff --git a/ThermoSysPro/Fluid/PressureLosses/DynamicCheckValve.mo b/ThermoSysPro/Fluid/PressureLosses/DynamicCheckValve.mo index e149fdb8..8bfa927e 100644 --- a/ThermoSysPro/Fluid/PressureLosses/DynamicCheckValve.mo +++ b/ThermoSysPro/Fluid/PressureLosses/DynamicCheckValve.mo @@ -1,61 +1,63 @@ -within ThermoSysPro.Fluid.PressureLosses; +within ; model DynamicCheckValve "Dynamic check valve" - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter ThermoSysPro.Units.xSI.Cv Cvmax=8005.42 "Maximum CV"; parameter Real caract[:, 2]=[0, 0; 1, Cvmax] "Position vs. Cv characteristics (active if mode_caract=1)"; - parameter Units.SI.MomentOfInertia J=1 "Flap moment of inertia"; + parameter ThermoSysPro.Units.SI.MomentOfInertia J=1 "Flap moment of inertia"; parameter Real Kf1=0 "Flap friction law coefficient #1"; parameter Real Kf2=100 "Flap friction law coefficient #2"; parameter Real n=5 "Flap friction law exponent"; - parameter Units.SI.Mass m=1 "Flap mass"; - parameter Units.SI.Area A=1 "Flap hydraulic area"; + parameter ThermoSysPro.Units.SI.Mass m=1 "Flap mass"; + parameter ThermoSysPro.Units.SI.Area A=1 "Flap hydraulic area"; parameter Integer mode_caract=0 "0:linear characteristics - 1:characteristics is given by caract[]" annotation(Evaluate=true); parameter Integer option_interpolation=1 "1: linear interpolation - 2: spline interpolation (active if mode_caract=1)" annotation(Evaluate=true, Dialog(enable=(mode_caract == 1))); parameter Boolean mech_steady_state=true "true: start from mechanical steady state - false: start from 0"; parameter Real Ouv0=0 "Initial valve position, between 0 and 1. 0:valve closed - 1: valve open (active if mech_steady_state=false)" annotation(Evaluate=true, Dialog(enable=not mech_steady_state)); - parameter Units.SI.MassFlowRate gamma_diff=1e-4 + parameter ThermoSysPro.Units.SI.MassFlowRate gamma_diff=1e-4 "Diffusion conductance (active if diffusion=true in neighbouring volumes)"; - parameter Units.SI.Density p_rho=0 "If > 0, fixed fluid density" + parameter ThermoSysPro.Units.SI.Density p_rho=0 "If > 0, fixed fluid density" annotation (Evaluate=true, Dialog(tab="Fluid", group="Fluid properties")); - parameter IF97Region region=IF97Region.All_regions "IF97 region (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); protected constant Real pi=Modelica.Constants.pi "pi"; - parameter Units.SI.Acceleration g=Modelica.Constants.g_n "Gravity constant"; - parameter Integer mode=Integer(region) - 1 "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; + parameter ThermoSysPro.Units.SI.Acceleration g=Modelica.Constants.g_n + "Gravity constant"; parameter Real eps=1.e-3 "Small number for pressure loss equation"; - parameter Units.SI.Radius r=sqrt(A/pi) "Flap radius"; - parameter Units.SI.Angle theta_min=0 "Minimum flap aperture angle"; - parameter Units.SI.Angle theta_max=pi/2 "Maximum flap aperture angle"; - parameter Units.SI.Angle theta_m=(theta_min + theta_max)/2; - FluidType ftype "Fluid type"; - Integer fluid=Integer(ftype) "Fluid number"; + parameter ThermoSysPro.Units.SI.Radius r=sqrt(A/pi) "Flap radius"; + parameter ThermoSysPro.Units.SI.Angle theta_min=0 + "Minimum flap aperture angle"; + parameter ThermoSysPro.Units.SI.Angle theta_max=pi/2 + "Maximum flap aperture angle"; + parameter ThermoSysPro.Units.SI.Angle theta_m=(theta_min + theta_max)/2; public Boolean libre(start=true) "Indicator whether the flap is free to move in both directions"; - Units.SI.Torque Cp "Gravity torque"; - Units.SI.Torque Cf "Friction torque"; - Units.SI.Torque Ch "Hydraulic torque"; - Units.SI.Torque Ct "Total torque"; - Units.SI.Angle theta(start=theta_m) "Flap aperture angle"; - Units.SI.AngularVelocity omega "Flap angular speed"; - Units.SI.AngularAcceleration a "Flap angular acceleration"; + ThermoSysPro.Units.SI.Torque Cp "Gravity torque"; + ThermoSysPro.Units.SI.Torque Cf "Friction torque"; + ThermoSysPro.Units.SI.Torque Ch "Hydraulic torque"; + ThermoSysPro.Units.SI.Torque Ct "Total torque"; + ThermoSysPro.Units.SI.Angle theta(start=theta_m) "Flap aperture angle"; + ThermoSysPro.Units.SI.AngularVelocity omega "Flap angular speed"; + ThermoSysPro.Units.SI.AngularAcceleration a "Flap angular acceleration"; Real Ouv "Valve position"; ThermoSysPro.Units.xSI.Cv Cv(start=Cvmax) "Cv"; - Units.SI.MassFlowRate Q(start=500) "Mass flow rate"; + ThermoSysPro.Units.SI.MassFlowRate Q(start=500) "Mass flow rate"; ThermoSysPro.Units.SI.PressureDifference deltaP "Singular pressure loss"; - Units.SI.Density rho(start=998) "Fluid density"; - Units.SI.Temperature T(start=290) "Fluid temperature"; - Units.SI.AbsolutePressure Pm(start=1.e5) "Fluid average pressrue"; - Units.SI.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy"; + ThermoSysPro.Units.SI.Density rho(start=998) "Fluid density"; + ThermoSysPro.Units.SI.Temperature T(start=290) "Fluid temperature"; + ThermoSysPro.Units.SI.AbsolutePressure Pm(start=1.e5) + "Fluid average pressrue"; + ThermoSysPro.Units.SI.SpecificEnthalpy h(start=100000) + "Fluid specific enthalpy"; + Medium.MassFraction X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Mass fractions"; + public - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-110,-10},{-90,10}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{90,-10},{110,10}}, rotation=0))); initial equation if mech_steady_state then @@ -81,19 +83,17 @@ equation C2.diff_res_1 = C1.diff_res_1 + (if (gamma_diff > 0) then 1/gamma_diff else 0); C1.diff_res_2 = C2.diff_res_2 + (if (gamma_diff > 0) then 1/gamma_diff else 0); - C1.ftype = C2.ftype; + C1.Xi = C2.Xi; + + X = C1.Xi; - C1.Xco2 = C2.Xco2; - C1.Xh2o = C2.Xh2o; - C1.Xo2 = C2.Xo2; - C1.Xso2 = C2.Xso2; + + C1.SubC = C2.SubC; Q = C1.Q; h = C1.h; deltaP = C1.P - C2.P; - ftype = C1.ftype; - /* Flap angle */ Ouv = 1 - cos(theta); @@ -141,12 +141,12 @@ equation /* Fluid thermodynamic properties */ Pm = (C1.P + C2.P)/2; - T = ThermoSysPro.Properties.Fluid.Temperature_Ph(Pm, h, fluid, mode, C1.Xco2, C1.Xh2o, C1.Xo2, C1.Xso2); + T = Medium.temperature_phX(p=Pm, h=h, X=X); if (p_rho > 0) then rho = p_rho; else - rho = ThermoSysPro.Properties.Fluid.Density_Ph(Pm, h, fluid, mode, C1.Xco2, C1.Xh2o, C1.Xo2, C1.Xso2); + rho = Medium.density_phX(p=Pm, h=h, X=X); end if; annotation ( Icon(coordinateSystem( @@ -198,5 +198,6 @@ equation
    • Daniel Bouskela
    -")); +"), + uses(ThermoSysPro(version="5.0"), Modelica(version="4.0.0"))); end DynamicCheckValve; From 353b7c866b39f649dfb721321e7b694f62dc46dd Mon Sep 17 00:00:00 2001 From: LAMBLOT Simon Date: Thu, 19 Jun 2025 14:28:30 +0200 Subject: [PATCH 045/178] IdealCheckValve --- .../PressureLosses/TestIdealCheckValve.mo | 19 +++++++++++ .../TestIdealCheckValve_FlueGases.mo | 24 ++++++++++++++ .../TestIdealCheckValve_Traces.mo | 23 +++++++++++++ .../PressureLosses/package.order | 3 ++ .../Fluid/PressureLosses/IdealCheckValve.mo | 32 ++++++++++--------- 5 files changed, 86 insertions(+), 15 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestIdealCheckValve.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestIdealCheckValve_FlueGases.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestIdealCheckValve_Traces.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestIdealCheckValve.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestIdealCheckValve.mo new file mode 100644 index 00000000..1d537646 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestIdealCheckValve.mo @@ -0,0 +1,19 @@ +within ; +model TestIdealCheckValve + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; + IdealCheckValve idealCheckValve( redeclare + replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package + Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare + replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); +equation + connect(idealCheckValve.C2, sink.C) + annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(idealCheckValve.C1, sourcePQ.C) + annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), + uses(ThermoSysPro(version="5.0"))); +end TestIdealCheckValve; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestIdealCheckValve_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestIdealCheckValve_FlueGases.mo new file mode 100644 index 00000000..b7d4d979 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestIdealCheckValve_FlueGases.mo @@ -0,0 +1,24 @@ +within ; +model TestIdealCheckValve_FlueGases + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.FlueGases; + IdealCheckValve idealCheckValve( redeclare + replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink( + redeclare replaceable package Medium = Medium, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ( + redeclare replaceable package Medium = Medium, + P0=4500000, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); +equation + connect(idealCheckValve.C2, sink.C) + annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(idealCheckValve.C1, sourcePQ.C) + annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), + uses(ThermoSysPro(version="5.0"))); +end TestIdealCheckValve_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestIdealCheckValve_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestIdealCheckValve_Traces.mo new file mode 100644 index 00000000..62621af3 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestIdealCheckValve_Traces.mo @@ -0,0 +1,23 @@ +within ; +model TestIdealCheckValve_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam ( + extraPropertiesNames={"Trace"}, + C_nominal={0.1}, + C_default={0.2}); + IdealCheckValve idealCheckValve( redeclare + replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package + Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare + replaceable package Medium = Medium, SubC0={0.3}) + annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); +equation + connect(idealCheckValve.C2, sink.C) + annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(idealCheckValve.C1, sourcePQ.C) + annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), + uses(ThermoSysPro(version="5.0"))); +end TestIdealCheckValve_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order index e89506ae..1de9231e 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order @@ -7,3 +7,6 @@ TestSingularPressureLoss_Traces_FlueGases TestControlValve TestControlValve_Traces TestControlValve_Traces_FlueGases +TestIdealCheckValve_FlueGases +TestIdealCheckValve_Traces +TestIdealCheckValve \ No newline at end of file diff --git a/ThermoSysPro/Fluid/PressureLosses/IdealCheckValve.mo b/ThermoSysPro/Fluid/PressureLosses/IdealCheckValve.mo index 136da561..c8dccfb9 100644 --- a/ThermoSysPro/Fluid/PressureLosses/IdealCheckValve.mo +++ b/ThermoSysPro/Fluid/PressureLosses/IdealCheckValve.mo @@ -1,27 +1,28 @@ -within ThermoSysPro.Fluid.PressureLosses; +within ; model IdealCheckValve "Ideal check valve" - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter ThermoSysPro.Units.SI.PressureDifference dPOuvert=0.01 "Pressure difference when the valve opens"; - parameter Units.SI.MassFlowRate Qmin=1.e-6 + parameter ThermoSysPro.Units.SI.MassFlowRate Qmin=1.e-6 "Mass flow trhough the valve when the valve is closed"; - parameter Units.SI.MassFlowRate gamma_diff=1e-4 + parameter ThermoSysPro.Units.SI.MassFlowRate gamma_diff=1e-4 "Diffusion conductance (active if diffusion=true in neighbouring volumes)"; public Boolean ouvert(start=true, fixed=true) "Valve state"; discrete Boolean touvert(start=false, fixed=true); discrete Boolean tferme(start=false, fixed=true); - Units.SI.MassFlowRate Q "Mass flow rate"; - Units.SI.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy"; + ThermoSysPro.Units.SI.MassFlowRate Q "Mass flow rate"; + ThermoSysPro.Units.SI.SpecificEnthalpy h(start=100000) + "Fluid specific enthalpy"; ThermoSysPro.Units.SI.PressureDifference deltaP "Pressure difference between the inlet and the outlet"; + Medium.MassFraction X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Mass fractions"; - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{90,-10},{110,10}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-110,-10},{-90,10}}, rotation=0))); equation @@ -37,12 +38,12 @@ equation C2.diff_res_1 = C1.diff_res_1 + (if (gamma_diff > 0) then 1/gamma_diff else 0); C1.diff_res_2 = C2.diff_res_2 + (if (gamma_diff > 0) then 1/gamma_diff else 0); - C1.ftype = C2.ftype; + C1.Xi = C2.Xi; - C1.Xco2 = C2.Xco2; - C1.Xh2o = C2.Xh2o; - C1.Xo2 = C2.Xo2; - C1.Xso2 = C2.Xso2; + X = C1.Xi; + + + C1.SubC = C2.SubC; Q = C1.Q; h = C1.h; @@ -112,5 +113,6 @@ equation
  • Daniel Bouskela
  • Baligh El Hefni
  • -")); +"), + uses(ThermoSysPro(version="5.0"))); end IdealCheckValve; From b290da4e2c1af98b7edbea38afa502b8232b8f37 Mon Sep 17 00:00:00 2001 From: LAMBLOT Simon Date: Thu, 19 Jun 2025 14:39:15 +0200 Subject: [PATCH 046/178] IdealSwitchValve --- .../PressureLosses/TestIdealSwitchValve.mo | 24 ++++++++++++ .../TestIdealSwitchValve_FlueGases.mo | 29 ++++++++++++++ .../TestIdealSwitchValve_Traces.mo | 28 ++++++++++++++ .../PressureLosses/package.order | 3 ++ .../Fluid/PressureLosses/IdealSwitchValve.mo | 38 ++++++++++--------- 5 files changed, 104 insertions(+), 18 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestIdealSwitchValve.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestIdealSwitchValve_FlueGases.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestIdealSwitchValve_Traces.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestIdealSwitchValve.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestIdealSwitchValve.mo new file mode 100644 index 00000000..10539b7b --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestIdealSwitchValve.mo @@ -0,0 +1,24 @@ +within ; +model TestIdealSwitchValve + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; + IdealSwitchValve idealSwitchValve(redeclare + replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-4}, + {10,16}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package + Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare + replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.InstrumentationAndControl.Blocks.Logique.Constante constante + annotation (Placement(transformation(extent={{-40,30},{-20,50}}))); +equation + connect(idealSwitchValve.C2, sink.C) + annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(idealSwitchValve.C1, sourcePQ.C) + annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); + connect(constante.yL, idealSwitchValve.Ouv) + annotation (Line(points={{-19,40},{0,40},{0,13}}, color={0,0,255})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), + uses(ThermoSysPro(version="5.0"))); +end TestIdealSwitchValve; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestIdealSwitchValve_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestIdealSwitchValve_FlueGases.mo new file mode 100644 index 00000000..1a20b88d --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestIdealSwitchValve_FlueGases.mo @@ -0,0 +1,29 @@ +within ; +model TestIdealSwitchValve_FlueGases + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.FlueGases; + IdealSwitchValve idealSwitchValve(redeclare + replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-4}, + {10,16}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink( + redeclare replaceable package Medium = Medium, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ( + redeclare replaceable package Medium = Medium, + P0=4500000, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.InstrumentationAndControl.Blocks.Logique.Constante constante + annotation (Placement(transformation(extent={{-40,30},{-20,50}}))); +equation + connect(idealSwitchValve.C2, sink.C) + annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(idealSwitchValve.C1, sourcePQ.C) + annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); + connect(constante.yL, idealSwitchValve.Ouv) + annotation (Line(points={{-19,40},{0,40},{0,13}}, color={0,0,255})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), + uses(ThermoSysPro(version="5.0"))); +end TestIdealSwitchValve_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestIdealSwitchValve_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestIdealSwitchValve_Traces.mo new file mode 100644 index 00000000..bf8f48b6 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestIdealSwitchValve_Traces.mo @@ -0,0 +1,28 @@ +within ; +model TestIdealSwitchValve_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam ( + extraPropertiesNames={"Trace"}, + C_nominal={0.1}, + C_default={0.2}); + IdealSwitchValve idealSwitchValve(redeclare + replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-4}, + {10,16}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package + Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare + replaceable package Medium = Medium, SubC0={0.3}) + annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.InstrumentationAndControl.Blocks.Logique.Constante constante + annotation (Placement(transformation(extent={{-40,30},{-20,50}}))); +equation + connect(idealSwitchValve.C2, sink.C) + annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(idealSwitchValve.C1, sourcePQ.C) + annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); + connect(constante.yL, idealSwitchValve.Ouv) + annotation (Line(points={{-19,40},{0,40},{0,13}}, color={0,0,255})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), + uses(ThermoSysPro(version="5.0"))); +end TestIdealSwitchValve_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order index e89506ae..6211fe31 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order @@ -7,3 +7,6 @@ TestSingularPressureLoss_Traces_FlueGases TestControlValve TestControlValve_Traces TestControlValve_Traces_FlueGases +TestIdealSwitchValve_FlueGases +TestIdealSwitchValve_Traces +TestIdealSwitchValve \ No newline at end of file diff --git a/ThermoSysPro/Fluid/PressureLosses/IdealSwitchValve.mo b/ThermoSysPro/Fluid/PressureLosses/IdealSwitchValve.mo index bc72ca5c..cc91b89c 100644 --- a/ThermoSysPro/Fluid/PressureLosses/IdealSwitchValve.mo +++ b/ThermoSysPro/Fluid/PressureLosses/IdealSwitchValve.mo @@ -1,29 +1,30 @@ -within ThermoSysPro.Fluid.PressureLosses; +within ; model IdealSwitchValve "Ideal switch valve" - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); - parameter Units.SI.MassFlowRate Qmin=1.e-6 + parameter ThermoSysPro.Units.SI.MassFlowRate Qmin=1.e-6 "Mass flow when the valve is closed"; - parameter Units.SI.MassFlowRate gamma_diff=1e-4 + parameter ThermoSysPro.Units.SI.MassFlowRate gamma_diff=1e-4 "Diffusion conductance (active if diffusion=true in neighbouring volumes)"; public - Units.SI.MassFlowRate Q "Mass flow rate"; - Units.SI.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy"; + ThermoSysPro.Units.SI.MassFlowRate Q "Mass flow rate"; + ThermoSysPro.Units.SI.SpecificEnthalpy h(start=100000) + "Fluid specific enthalpy"; ThermoSysPro.Units.SI.PressureDifference deltaP "Pressure difference between the inlet and the outlet"; + Medium.MassFraction X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Mass fractions"; public ThermoSysPro.InstrumentationAndControl.Connectors.InputLogical Ouv annotation (Placement(transformation( origin={0,70}, extent={{-10,-10},{10,10}}, rotation=270))); - Interfaces.Connectors.FluidInlet C1 annotation (Placement(transformation( - extent={{-110,-70},{-90,-50}}, rotation=0), iconTransformation(extent= - {{-110,-70},{-90,-50}}))); - Interfaces.Connectors.FluidOutlet C2 annotation (Placement(transformation( - extent={{90,-70},{110,-50}}, rotation=0))); + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1(redeclare package Medium = Medium) annotation (Placement( + transformation(extent={{-110,-70},{-90,-50}}, rotation=0), + iconTransformation(extent={{-110,-70},{-90,-50}}))); + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2(redeclare package Medium = Medium) annotation (Placement( + transformation(extent={{90,-70},{110,-50}}, rotation=0))); equation C1.Q = C2.Q; @@ -38,12 +39,12 @@ equation C2.diff_res_1 = C1.diff_res_1 + (if (gamma_diff > 0) then 1/gamma_diff else 0); C1.diff_res_2 = C2.diff_res_2 + (if (gamma_diff > 0) then 1/gamma_diff else 0); - C1.ftype = C2.ftype; + C1.Xi = C2.Xi; - C1.Xco2 = C2.Xco2; - C1.Xh2o = C2.Xh2o; - C1.Xo2 = C2.Xo2; - C1.Xso2 = C2.Xso2; + X = C1.Xi; + + + C1.SubC = C2.SubC; Q = C1.Q; h = C1.h; @@ -112,5 +113,6 @@ equation
    • Daniel Bouskela
    -")); +"), + uses(ThermoSysPro(version="5.0"))); end IdealSwitchValve; From eff4e768c9738e45afe8eade1a9356f4c0459986 Mon Sep 17 00:00:00 2001 From: LAMBLOT Simon Date: Thu, 19 Jun 2025 14:45:06 +0200 Subject: [PATCH 047/178] SwitchValve --- .../PressureLosses/TestSwitchValve.mo | 24 ++++++++ .../TestSwitchValve_FlueGases.mo | 29 ++++++++++ .../PressureLosses/TestSwitchValve_Traces.mo | 28 +++++++++ .../PressureLosses/package.order | 3 + .../Fluid/PressureLosses/SwitchValve.mo | 58 +++++++++---------- 5 files changed, 112 insertions(+), 30 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestSwitchValve.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestSwitchValve_FlueGases.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestSwitchValve_Traces.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestSwitchValve.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestSwitchValve.mo new file mode 100644 index 00000000..ff63f24c --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestSwitchValve.mo @@ -0,0 +1,24 @@ +within ; +model TestSwitchValve + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; + SwitchValve switchValve( redeclare + replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-4}, + {10,16}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package + Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare + replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.InstrumentationAndControl.Blocks.Logique.Constante constante + annotation (Placement(transformation(extent={{-78,32},{-58,52}}))); +equation + connect(switchValve.C2, sink.C) + annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(switchValve.C1, sourcePQ.C) + annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); + connect(constante.yL, switchValve.Ouv) + annotation (Line(points={{-57,42},{0,42},{0,13.2}}, color={0,0,255})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), + uses(ThermoSysPro(version="5.0"))); +end TestSwitchValve; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestSwitchValve_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestSwitchValve_FlueGases.mo new file mode 100644 index 00000000..e5ef26f4 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestSwitchValve_FlueGases.mo @@ -0,0 +1,29 @@ +within ; +model TestSwitchValve_FlueGases + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.FlueGases; + SwitchValve switchValve( redeclare + replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-4}, + {10,16}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink( + redeclare replaceable package Medium = Medium, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ( + redeclare replaceable package Medium = Medium, + P0=4500000, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.InstrumentationAndControl.Blocks.Logique.Constante constante + annotation (Placement(transformation(extent={{-42,30},{-22,50}}))); +equation + connect(switchValve.C2, sink.C) + annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(switchValve.C1, sourcePQ.C) + annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); + connect(constante.yL, switchValve.Ouv) + annotation (Line(points={{-21,40},{0,40},{0,13.2}}, color={0,0,255})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), + uses(ThermoSysPro(version="5.0"))); +end TestSwitchValve_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestSwitchValve_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestSwitchValve_Traces.mo new file mode 100644 index 00000000..964ac1b3 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestSwitchValve_Traces.mo @@ -0,0 +1,28 @@ +within ; +model TestSwitchValve_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam ( + extraPropertiesNames={"Trace"}, + C_nominal={0.1}, + C_default={0.2}); + SwitchValve switchValve( redeclare + replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-4}, + {10,16}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package + Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare + replaceable package Medium = Medium, SubC0={0.3}) + annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.InstrumentationAndControl.Blocks.Logique.Constante constante + annotation (Placement(transformation(extent={{-40,30},{-20,50}}))); +equation + connect(switchValve.C2, sink.C) + annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(switchValve.C1, sourcePQ.C) + annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); + connect(constante.yL, switchValve.Ouv) + annotation (Line(points={{-19,40},{0,40},{0,13.2}}, color={0,0,255})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), + uses(ThermoSysPro(version="5.0"))); +end TestSwitchValve_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order index e89506ae..2d04c15f 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order @@ -7,3 +7,6 @@ TestSingularPressureLoss_Traces_FlueGases TestControlValve TestControlValve_Traces TestControlValve_Traces_FlueGases +TestSwitchValve_FlueGases +TestSwitchValve_Traces +TestSwitchValve \ No newline at end of file diff --git a/ThermoSysPro/Fluid/PressureLosses/SwitchValve.mo b/ThermoSysPro/Fluid/PressureLosses/SwitchValve.mo index 4b0a8924..df541f53 100644 --- a/ThermoSysPro/Fluid/PressureLosses/SwitchValve.mo +++ b/ThermoSysPro/Fluid/PressureLosses/SwitchValve.mo @@ -1,31 +1,30 @@ -within ThermoSysPro.Fluid.PressureLosses; +within ; model SwitchValve "Switch valve" - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter ThermoSysPro.Units.xSI.PressureLossCoefficient k=1000 "Pressure loss coefficient"; - parameter Units.SI.MassFlowRate Qmin=1.e-6 + parameter ThermoSysPro.Units.SI.MassFlowRate Qmin=1.e-6 "Mass flow when the valve is closed"; - parameter Units.SI.MassFlowRate gamma_diff=1e-4 + parameter ThermoSysPro.Units.SI.MassFlowRate gamma_diff=1e-4 "Diffusion conductance (active if diffusion=true in neighbouring volumes)"; - parameter Units.SI.Density p_rho=0 "If > 0, fixed fluid density" + parameter ThermoSysPro.Units.SI.Density p_rho=0 "If > 0, fixed fluid density" annotation (Evaluate=true, Dialog(tab="Fluid", group="Fluid properties")); - parameter IF97Region region=IF97Region.All_regions "IF97 region (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); protected - parameter Integer mode=Integer(region) - 1 "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; parameter Real eps=1.e-3 "Small number for pressure loss equation"; public - Units.SI.MassFlowRate Q(start=100) "Mass flow rate"; + ThermoSysPro.Units.SI.MassFlowRate Q(start=100) "Mass flow rate"; ThermoSysPro.Units.SI.PressureDifference deltaP "Singular pressure loss"; - Units.SI.Density rho(start=998) "Fluid density"; - Units.SI.Temperature T(start=290) "Fluid temperature"; - Units.SI.AbsolutePressure Pm(start=1.e5) "Fluid average pressure"; - Units.SI.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy"; - FluidType ftype "Fluid type"; - Integer fluid=Integer(ftype) "Fluid number"; + ThermoSysPro.Units.SI.Density rho(start=998) "Fluid density"; + ThermoSysPro.Units.SI.Temperature T(start=290) "Fluid temperature"; + ThermoSysPro.Units.SI.AbsolutePressure Pm(start=1.e5) + "Fluid average pressure"; + ThermoSysPro.Units.SI.SpecificEnthalpy h(start=100000) + "Fluid specific enthalpy"; + Medium.MassFraction X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Mass fractions"; + public ThermoSysPro.InstrumentationAndControl.Connectors.InputLogical Ouv @@ -33,11 +32,11 @@ public origin={0,72}, extent={{-10,-10},{10,10}}, rotation=270))); - Interfaces.Connectors.FluidInlet C1 annotation (Placement(transformation( - extent={{-110,-70},{-90,-50}}, rotation=0))); - Interfaces.Connectors.FluidOutlet C2 annotation (Placement(transformation( - extent={{90,-70},{110,-50}}, rotation=0), iconTransformation(extent={ - {90,-70},{110,-50}}))); + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1(redeclare package Medium = Medium) annotation (Placement( + transformation(extent={{-110,-70},{-90,-50}}, rotation=0))); + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2(redeclare package Medium = Medium) annotation (Placement( + transformation(extent={{90,-70},{110,-50}}, rotation=0), + iconTransformation(extent={{90,-70},{110,-50}}))); equation C1.Q = C2.Q; @@ -52,19 +51,17 @@ equation C2.diff_res_1 = C1.diff_res_1 + (if (gamma_diff > 0) then 1/gamma_diff else 0); C1.diff_res_2 = C2.diff_res_2 + (if (gamma_diff > 0) then 1/gamma_diff else 0); - C1.ftype = C2.ftype; + C1.Xi = C2.Xi; + + X = C1.Xi; - C1.Xco2 = C2.Xco2; - C1.Xh2o = C2.Xh2o; - C1.Xo2 = C2.Xo2; - C1.Xso2 = C2.Xso2; + + C1.SubC = C2.SubC; Q = C1.Q; h = C1.h; deltaP = C1.P - C2.P; - ftype = C1.ftype; - /* Pressure loss */ if Ouv.signal then deltaP - k*ThermoSysPro.Functions.ThermoSquare(Q, eps)/2/rho = 0; @@ -75,12 +72,12 @@ equation /* Fluid thermodynamic properties */ Pm = (C1.P + C2.P)/2; - T = ThermoSysPro.Properties.Fluid.Temperature_Ph(Pm, h, fluid, mode, C1.Xco2, C1.Xh2o, C1.Xo2, C1.Xso2); + T = Medium.temperature_phX(p=Pm, h=h, X=X); if (p_rho > 0) then rho = p_rho; else - rho = ThermoSysPro.Properties.Fluid.Density_Ph(Pm, h, fluid, mode, C1.Xco2, C1.Xh2o, C1.Xo2, C1.Xso2); + rho = Medium.density_phX(p=Pm, h=h, X=X); end if; annotation ( @@ -137,5 +134,6 @@ equation
    • Daniel Bouskela
    -")); +"), + uses(ThermoSysPro(version="5.0"))); end SwitchValve; From 42bfdf6b12713cc33384c159a4617e3129dc5f56 Mon Sep 17 00:00:00 2001 From: LAMBLOT Simon Date: Thu, 19 Jun 2025 16:37:12 +0200 Subject: [PATCH 048/178] DynamicReliefValve --- .../PressureLosses/TestDynamicReliefValve.mo | 24 +++++ .../TestDynamicReliefValve_FlueGases.mo | 28 +++++ .../TestDynamicReliefValve_Traces.mo | 27 +++++ .../PressureLosses/package.order | 3 + .../PressureLosses/DynamicReliefValve.mo | 102 +++++++++--------- 5 files changed, 134 insertions(+), 50 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDynamicReliefValve.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDynamicReliefValve_FlueGases.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDynamicReliefValve_Traces.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDynamicReliefValve.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDynamicReliefValve.mo new file mode 100644 index 00000000..e312d05f --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDynamicReliefValve.mo @@ -0,0 +1,24 @@ +within ; +model TestDynamicReliefValve + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; + DynamicReliefValve dynamicReliefValve( + redeclare + replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10}, + {10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package + Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare + replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10}, + {10,10}}, + rotation=90, + origin={0,-40}))); +equation + connect(dynamicReliefValve.C2, sink.C) + annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(dynamicReliefValve.C1, sourcePQ.C) annotation (Line(points={{0,-9.8}, + {0,-19.9},{5.55112e-16,-19.9},{5.55112e-16,-30}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), + uses(ThermoSysPro(version="5.0"))); +end TestDynamicReliefValve; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDynamicReliefValve_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDynamicReliefValve_FlueGases.mo new file mode 100644 index 00000000..52c9fea9 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDynamicReliefValve_FlueGases.mo @@ -0,0 +1,28 @@ +within ; +model TestDynamicReliefValve_FlueGases + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.FlueGases; + DynamicReliefValve dynamicReliefValve( + redeclare + replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink( + redeclare replaceable package Medium = Medium, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ( + redeclare replaceable package Medium = Medium, + P0=350000, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{-10,-10}, + {10,10}}, + rotation=90, + origin={0,-40}))); +equation + connect(dynamicReliefValve.C2, sink.C) + annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(dynamicReliefValve.C1, sourcePQ.C) annotation (Line(points={{0,-9.8}, + {4.44089e-16,-9.8},{4.44089e-16,-30}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), + uses(ThermoSysPro(version="5.0"))); +end TestDynamicReliefValve_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDynamicReliefValve_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDynamicReliefValve_Traces.mo new file mode 100644 index 00000000..a2f9410b --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDynamicReliefValve_Traces.mo @@ -0,0 +1,27 @@ +within ; +model TestDynamicReliefValve_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam ( + extraPropertiesNames={"Trace"}, + C_nominal={0.1}, + C_default={0.2}); + DynamicReliefValve dynamicReliefValve( + redeclare + replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package + Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare + replaceable package Medium = Medium, SubC0={0.3}) + annotation (Placement(transformation(extent={{-10,-10}, + {10,10}}, + rotation=90, + origin={0,-40}))); +equation + connect(dynamicReliefValve.C2, sink.C) + annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(dynamicReliefValve.C1, sourcePQ.C) annotation (Line(points={{0,-9.8}, + {0,-19.9},{5.55112e-16,-19.9},{5.55112e-16,-30}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), + uses(ThermoSysPro(version="5.0"))); +end TestDynamicReliefValve_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order index e89506ae..03fce0b6 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order @@ -7,3 +7,6 @@ TestSingularPressureLoss_Traces_FlueGases TestControlValve TestControlValve_Traces TestControlValve_Traces_FlueGases +TestDynamicReliefValve_FlueGases +TestDynamicReliefValve_Traces +TestDynamicReliefValve \ No newline at end of file diff --git a/ThermoSysPro/Fluid/PressureLosses/DynamicReliefValve.mo b/ThermoSysPro/Fluid/PressureLosses/DynamicReliefValve.mo index 76f9bf60..5e4fd4e0 100644 --- a/ThermoSysPro/Fluid/PressureLosses/DynamicReliefValve.mo +++ b/ThermoSysPro/Fluid/PressureLosses/DynamicReliefValve.mo @@ -1,20 +1,22 @@ -within ThermoSysPro.Fluid.PressureLosses; +within ; model DynamicReliefValve "Dynamic relief valve" - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); - parameter Units.SI.AbsolutePressure Popen=3e5 "Pressure that opens the valve"; - parameter Units.SI.AbsolutePressure Pout=1e5 + parameter ThermoSysPro.Units.SI.AbsolutePressure Popen=3e5 + "Pressure that opens the valve"; + parameter ThermoSysPro.Units.SI.AbsolutePressure Pout=1e5 "Pressure at the valve outlet (for sizing)"; parameter ThermoSysPro.Units.xSI.Cv Cvmax=8005.42 "Maximum Cv"; parameter Real caract[:, 2]=[0, 0; 1, Cvmax] "Position vs. Cv characteristics (active if mode_caract=1)"; - parameter Units.SI.Area A1=0.1 "Hydraulic area upstream the clapper"; - parameter Units.SI.Area A2=0.125 "Hydraulic area downstream the clapper"; - parameter Units.SI.Area clapper_area[:,2]=[0,A1; 0.01,A2; 1,A2] + parameter ThermoSysPro.Units.SI.Area A1=0.1 + "Hydraulic area upstream the clapper"; + parameter ThermoSysPro.Units.SI.Area A2=0.125 + "Hydraulic area downstream the clapper"; + parameter ThermoSysPro.Units.SI.Area clapper_area[:,2]=[0,A1; 0.01,A2; 1,A2] "Clapper area as a function of the clapper elevation"; parameter Real D=1 "Damping"; - parameter Units.SI.Mass m=1 "Valve mass"; - parameter Units.SI.Length z_max=0.1 "Maximum clapper elevation"; + parameter ThermoSysPro.Units.SI.Mass m=1 "Valve mass"; + parameter ThermoSysPro.Units.SI.Length z_max=0.1 "Maximum clapper elevation"; parameter Real Ke=62500 "Valve spring stiffness"; parameter Real Cd=0 "Drag coefficient of the clapper"; parameter Integer mode_caract=0 @@ -22,56 +24,56 @@ model DynamicReliefValve "Dynamic relief valve" parameter Integer option_interpolation=1 "1: linear interpolation - 2: spline interpolation (active if mode_caract=1)" annotation(Evaluate=true, Dialog(enable=(mode_caract == 1))); parameter Boolean mech_steady_state=true "true: start from mechanical steady state - false: start from 0" annotation(Evaluate=true); - parameter Units.SI.Length z0=0 + parameter ThermoSysPro.Units.SI.Length z0=0 "Initial clapper elevation, between 0 and z_max. 0:valve closed - z_max: valve fully open (active if mech_steady_state=false)" annotation (Evaluate=true, Dialog(enable=not mech_steady_state)); - parameter Units.SI.MassFlowRate gamma_diff=1e-4 + parameter ThermoSysPro.Units.SI.MassFlowRate gamma_diff=1e-4 "Diffusion conductance (active if diffusion=true in neighbouring volumes)"; - parameter Units.SI.Density p_rho=0 "If > 0, fixed fluid density" + parameter ThermoSysPro.Units.SI.Density p_rho=0 "If > 0, fixed fluid density" annotation (Evaluate=true, Dialog(tab="Fluid", group="Fluid properties")); - parameter IF97Region region=IF97Region.All_regions "IF97 region (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); protected - constant Units.SI.Acceleration g=Modelica.Constants.g_n "Gravity constant"; + constant ThermoSysPro.Units.SI.Acceleration g=Modelica.Constants.g_n + "Gravity constant"; constant Real pi=Modelica.Constants.pi "pi"; - constant Units.SI.Density rho60F=998.98 "Water density at 60°F"; + constant ThermoSysPro.Units.SI.Density rho60F=998.98 "Water density at 60°F"; constant Real K=1.733e12 "Valve constant"; - parameter Integer mode=Integer(region) - 1 "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; parameter Real eps=1.e-0 "Small number for pressure loss equation"; - parameter Units.SI.Length z_min=0 "Minimum clapper elevation"; - FluidType ftype "Fluid type"; - Integer fluid=Integer(ftype) "Fluid number"; + parameter ThermoSysPro.Units.SI.Length z_min=0 "Minimum clapper elevation"; public Boolean clapper_is_free(start=true) "true if clapper is free to move in both directions, false otherwise"; - Units.SI.Force Fp "Gravity force"; - Units.SI.Force Fr "Spring force"; - Units.SI.Force Fd "Damping force"; - Units.SI.Force Fh "Hydraulic force"; - Units.SI.Force Fdyn "Dynamic pressure force"; - Units.SI.Force Ft "Total force"; - Units.SI.Length z(start=z_min) "Clapper elevation"; - Units.SI.Velocity v=der(z) "Clapper velocity"; - Units.SI.Acceleration a=der(v) "Clapper acceleration"; + ThermoSysPro.Units.SI.Force Fp "Gravity force"; + ThermoSysPro.Units.SI.Force Fr "Spring force"; + ThermoSysPro.Units.SI.Force Fd "Damping force"; + ThermoSysPro.Units.SI.Force Fh "Hydraulic force"; + ThermoSysPro.Units.SI.Force Fdyn "Dynamic pressure force"; + ThermoSysPro.Units.SI.Force Ft "Total force"; + ThermoSysPro.Units.SI.Length z(start=z_min) "Clapper elevation"; + ThermoSysPro.Units.SI.Velocity v=der(z) "Clapper velocity"; + ThermoSysPro.Units.SI.Acceleration a=der(v) "Clapper acceleration"; Real Ouv "Valve position"; - Units.SI.Area A "Hydraulic area upstream the clapper"; - Units.SI.Force Fr_min "Spring force when valve is closed"; + ThermoSysPro.Units.SI.Area A "Hydraulic area upstream the clapper"; + ThermoSysPro.Units.SI.Force Fr_min "Spring force when valve is closed"; ThermoSysPro.Units.xSI.Cv Cv "Cv"; - Units.SI.MassFlowRate Q(start=500) "Mass flow rate"; + ThermoSysPro.Units.SI.MassFlowRate Q(start=500) "Mass flow rate"; ThermoSysPro.Units.SI.PressureDifference deltaP "Singular pressure loss"; - Units.SI.Density rho(start=998) "Fluid density"; - Units.SI.Temperature T(start=290) "Fluid temperature"; - Units.SI.AbsolutePressure Pm(start=1.e5) "Fluid average pressure"; - Units.SI.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy"; - Units.SI.AbsolutePressure Pdyn "Dynamic pressure on the clapper"; - Units.SI.Velocity vh "Fluid velocity through the valve"; - Units.SI.Energy Wdyn "Dissipated fluid kinetic energy"; + ThermoSysPro.Units.SI.Density rho(start=998) "Fluid density"; + ThermoSysPro.Units.SI.Temperature T(start=290) "Fluid temperature"; + ThermoSysPro.Units.SI.AbsolutePressure Pm(start=1.e5) + "Fluid average pressure"; + ThermoSysPro.Units.SI.SpecificEnthalpy h(start=100000) + "Fluid specific enthalpy"; + ThermoSysPro.Units.SI.AbsolutePressure Pdyn "Dynamic pressure on the clapper"; + ThermoSysPro.Units.SI.Velocity vh "Fluid velocity through the valve"; + ThermoSysPro.Units.SI.Energy Wdyn "Dissipated fluid kinetic energy"; Real Re=rho*(vh - v)*sqrt(4*A/pi)/ThermoSysPro.Properties.WaterSteam.IF97.DynamicViscosity_rhoT(rho, T) "Clapper Reynolds"; + Medium.MassFraction X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Mass fractions"; public - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-10,-108},{10,-88}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{90,-10},{110,10}}, rotation=0), iconTransformation(extent={{90,-10},{110,10}}))); initial equation @@ -98,18 +100,17 @@ equation C2.diff_res_1 = C1.diff_res_1 + (if (gamma_diff > 0) then 1/gamma_diff else 0); C1.diff_res_2 = C2.diff_res_2 + (if (gamma_diff > 0) then 1/gamma_diff else 0); - C1.ftype = C2.ftype; + C1.Xi = C2.Xi; - C1.Xco2 = C2.Xco2; - C1.Xh2o = C2.Xh2o; - C1.Xo2 = C2.Xo2; - C1.Xso2 = C2.Xso2; + X = C1.Xi; + + + C1.SubC = C2.SubC; Q = C1.Q; h = C1.h; deltaP = C1.P - C2.P; - ftype = C1.ftype; /* Hydraulic area upstream the clapper. It varies as a function of the valve elevation between A1 (valve closed) and A2 (valve open) with a hysteresis */ @@ -174,12 +175,12 @@ equation /* Fluid thermodynamic properties */ Pm = (C1.P + C2.P)/2; - T = ThermoSysPro.Properties.Fluid.Temperature_Ph(Pm, h, fluid, mode, C1.Xco2, C1.Xh2o, C1.Xo2, C1.Xso2); + T = Medium.temperature_phX(p=Pm, h=h, X=X); if (p_rho > 0) then rho = p_rho; else - rho = ThermoSysPro.Properties.Fluid.Density_Ph(Pm, h, fluid, mode, C1.Xco2, C1.Xh2o, C1.Xo2, C1.Xso2); + rho = Medium.density_phX(p=Pm, h=h, X=X); end if; annotation ( Icon(coordinateSystem( @@ -233,5 +234,6 @@ equation
    • Daniel Bouskela
    -")); +"), + uses(ThermoSysPro(version="5.0"), Modelica(version="4.0.0"))); end DynamicReliefValve; From e9e327e5baabee2f89670335dc3bcebfddd8b5de Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Fri, 20 Jun 2025 10:35:10 +0200 Subject: [PATCH 049/178] #125 VolumeB reviewed --- .../SimpleExamples/Volumes/TestVolumeB.mo | 28 +++----- .../Volumes/TestVolumeB_FlueGases.mo | 37 +++++------ .../Volumes/TestVolumeB_Traces.mo | 36 ++++------- .../SimpleExamples/Volumes/package.order | 2 +- ThermoSysPro/Fluid/Volumes/VolumeB.mo | 64 ++++++++----------- 5 files changed, 68 insertions(+), 99 deletions(-) diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeB.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeB.mo index ef023186..70a46a81 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeB.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeB.mo @@ -1,26 +1,18 @@ -within ; +within ThermoSysPro.Fluid.Examples.SimpleExamples.Volumes; model TestVolumeB extends ThermoSysPro.UsersGuide.Icons.Example; replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; - ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package - Medium = Medium) annotation (Placement(transformation(extent={{20,28}, - {40,48}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare - replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); - VolumeB volumeB(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare replaceable - package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10}, - {10,10}}, + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{20,28},{40,48}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.Fluid.Volumes.VolumeB volumeB(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare replaceable package Medium = Medium) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, rotation=180, origin={42,0}))); equation - connect(sourcePQ.C,volumeB. Ce1) annotation (Line(points={{-30,0},{-10,0}}, color={0,0,0})); - connect(volumeB.Ce2, sourceQ.C) annotation (Line(points={{10,0},{21,0},{21, - 7.21645e-16},{32,7.21645e-16}}, color={0,0,0})); - connect(volumeB.Cs1, sink.C) - annotation (Line(points={{0,10},{0,38},{20,38}}, - color={0,0,0})); - annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), - uses(ThermoSysPro(version="5.0"))); + connect(sourcePQ.C, volumeB.Ce1) annotation (Line(points={{-30,0},{-10,0}}, color={0,0,0})); + connect(volumeB.Ce2, sourceQ.C) annotation (Line(points={{10,0},{21,0},{21,7.21645e-16},{32,7.21645e-16}}, color={0,0,0})); + connect(volumeB.Cs1, sink.C) annotation (Line(points={{0,10},{0,38},{20,38}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestVolumeB; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeB_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeB_FlueGases.mo index 36c5da1e..ceda5fee 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeB_FlueGases.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeB_FlueGases.mo @@ -1,33 +1,28 @@ -within ; +within ThermoSysPro.Fluid.Examples.SimpleExamples.Volumes; model TestVolumeB_FlueGases extends ThermoSysPro.UsersGuide.Icons.Example; replaceable package Medium = ThermoSysPro.Properties.Media.FlueGases; - ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package - Medium = Medium, + ThermoSysPro.Fluid.BoundaryConditions.Sink sink( + redeclare replaceable package Medium = Medium, T0=573.15, - option_temperature=true) annotation (Placement(transformation(extent={{26,16}, - {46,36}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare - replaceable package Medium = Medium, + option_temperature=true) annotation (Placement(transformation(extent={{26,16},{46,36}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ( + redeclare replaceable package Medium = Medium, P0=4500000, T0=573.15, - option_temperature=true) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); - VolumeB volumeB(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare replaceable - package Medium = Medium, + option_temperature=true) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.Fluid.Volumes.VolumeB volumeB(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ( + redeclare replaceable package Medium = Medium, T0=573.15, - option_temperature=true) annotation (Placement(transformation(extent={{-10,-10}, - {10,10}}, + option_temperature=true) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, rotation=180, origin={40,0}))); equation - connect(sourcePQ.C,volumeB. Ce1) annotation (Line(points={{-30,0},{-10,0}}, color={0,0,0})); - connect(volumeB.Ce2, sourceQ.C) annotation (Line(points={{10,0},{23,0},{23, - 7.21645e-16},{30,7.21645e-16}}, color={0,0,0})); - connect(volumeB.Cs1, sink.C) - annotation (Line(points={{0,10},{0,26},{26,26}}, - color={0,0,0})); - annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), - uses(ThermoSysPro(version="5.0"))); + connect(sourcePQ.C, volumeB.Ce1) annotation (Line(points={{-30,0},{-10,0}}, color={0,0,0})); + connect(volumeB.Ce2, sourceQ.C) annotation (Line(points={{10,0},{23,0},{23,7.21645e-16},{30,7.21645e-16}}, color={0,0,0})); + connect(volumeB.Cs1, sink.C) annotation (Line(points={{0,10},{0,26},{26,26}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestVolumeB_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeB_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeB_Traces.mo index 5e6e9e9e..1622f1d4 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeB_Traces.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeB_Traces.mo @@ -1,4 +1,4 @@ -within ; +within ThermoSysPro.Fluid.Examples.SimpleExamples.Volumes; model TestVolumeB_Traces extends ThermoSysPro.UsersGuide.Icons.Example; @@ -6,30 +6,22 @@ model TestVolumeB_Traces extraPropertiesNames={"Trace"}, C_nominal={0.1}, C_default={0.2}); - ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package - Medium = Medium) annotation (Placement(transformation(extent={{20,20}, - {40,40}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare - replaceable package Medium = Medium, + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{20,20},{40,40}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ( + redeclare replaceable package Medium = Medium, Q0=100, - SubC0={0.5}) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); - VolumeB volumeB(redeclare package Medium = Medium, + SubC0={0.5}) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.Fluid.Volumes.VolumeB volumeB( + redeclare package Medium = Medium, V=1, - dynamic_mass_balance=false) annotation (Placement(transformation(extent={{-10,-10}, - {10,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare replaceable - package Medium = Medium, - SubC0={0.2}) annotation (Placement(transformation(extent={{-10,-10}, - {10,10}}, + dynamic_mass_balance=false) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare replaceable package Medium = Medium, SubC0={0.2}) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, rotation=180, origin={40,0}))); equation - connect(sourcePQ.C,volumeB. Ce1) annotation (Line(points={{-30,0},{-10,0}}, color={0,0,0})); - connect(volumeB.Ce2, sourceQ.C) annotation (Line(points={{10,0},{24,0},{24, - 7.21645e-16},{30,7.21645e-16}}, color={0,0,0})); - connect(volumeB.Cs1, sink.C) - annotation (Line(points={{0,10},{0,30},{20,30}}, - color={0,0,0})); - annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), - uses(ThermoSysPro(version="5.0"))); + connect(sourcePQ.C, volumeB.Ce1) annotation (Line(points={{-30,0},{-10,0}}, color={0,0,0})); + connect(volumeB.Ce2, sourceQ.C) annotation (Line(points={{10,0},{24,0},{24,7.21645e-16},{30,7.21645e-16}}, color={0,0,0})); + connect(volumeB.Cs1, sink.C) annotation (Line(points={{0,10},{0,30},{20,30}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestVolumeB_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order index acb69536..dc5b4044 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order @@ -6,4 +6,4 @@ TestVolumeA_FlueGases TestVolumeA_Traces TestVolumeB TestVolumeB_FlueGases -TestVolumeB_Traces \ No newline at end of file +TestVolumeB_Traces diff --git a/ThermoSysPro/Fluid/Volumes/VolumeB.mo b/ThermoSysPro/Fluid/Volumes/VolumeB.mo index e59027d0..43aecbf6 100644 --- a/ThermoSysPro/Fluid/Volumes/VolumeB.mo +++ b/ThermoSysPro/Fluid/Volumes/VolumeB.mo @@ -1,25 +1,25 @@ -within ; +within ThermoSysPro.Fluid.Volumes; model VolumeB "Mixing volume with 2 inlets and 2 outlets" extends ThermoSysPro.Fluid.Interfaces.IconColors; - replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); replaceable function SaS = Medium.noSaS(SubC=SubC) annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Boolean dynamic_energy_balance=true "true: dynamic energy balance equation - false: static energy balance equation"; - parameter ThermoSysPro.Units.SI.Volume V=1 + parameter Units.SI.Volume V=1 "Volume (active if dynamic_energy_balance=true)" annotation (Evaluate=true, Dialog(enable=dynamic_energy_balance)); parameter Boolean dynamic_mass_balance=false "true: dynamic mass balance equation - false: static mass balance equation (active if the fluid is compressible and if dynamic_energy_balance=true)" annotation(Evaluate=true, Dialog(enable=isCompressible and dynamic_energy_balance)); parameter Boolean steady_state=true "true: start from steady state - false: start from (P0, h0) (active if dynamic_energy_balance=true)" annotation(Evaluate=true, Dialog(enable=dynamic_energy_balance)); - parameter ThermoSysPro.Units.SI.AbsolutePressure P0=1e5 + parameter Units.SI.AbsolutePressure P0=1e5 "Initial fluid pressure (active if the fluid is compressible, and if dynamic_energy_balance=true and dynamic_mass_balance=true and steady_state=false)" annotation (Evaluate=true, Dialog(enable=isCompressible and dynamic_energy_balance and dynamic_mass_balance and not steady_state)); - parameter ThermoSysPro.Units.SI.SpecificEnthalpy h0=1e5 + parameter Units.SI.SpecificEnthalpy h0=1e5 "Initial fluid specific enthalpy (active if dynamic_energy_balance=true and steady_state=false)" annotation (Evaluate=true, Dialog(enable=dynamic_energy_balance and not steady_state)); @@ -27,11 +27,11 @@ model VolumeB "Mixing volume with 2 inlets and 2 outlets" "true: continuous flow reversal - false: discontinuous flow reversal"; parameter Boolean diffusion=false "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; - parameter ThermoSysPro.Units.SI.Density p_rho=0 "If > 0, fixed fluid density" + parameter Units.SI.Density p_rho=0 "If > 0, fixed fluid density" annotation (Evaluate=true, Dialog(tab="Fluid", group="Fluid properties")); parameter Boolean dynamic_composition_balance=false - "true: dynamic fluid composition balance equation
    false: static fluid composition balance equation (active for flue gases)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.FlueGases), tab="Fluid", group="Fluid properties")); + "true: dynamic fluid composition balance equation
    false: static fluid composition balance equation (active for flue gases)" annotation(Evaluate=true, Dialog(tab="Fluid", group="Fluid properties")); parameter Medium.ExtraProperty X0[Medium.nX]=Medium.X_default "Initial composition values" annotation (Evaluate=true, Dialog( enable=dynamic_composition_balance, @@ -40,42 +40,33 @@ model VolumeB "Mixing volume with 2 inlets and 2 outlets" protected constant Boolean isCompressible = Medium.isCompressible; - parameter ThermoSysPro.Units.SI.MassFlowRate gamma0=1.e-4 + parameter Units.SI.MassFlowRate gamma0=1.e-4 "Pseudo-diffusion conductance use for continuous flow reversal (active if diffusion=false and continuous_flow_reversal = true)"; public - ThermoSysPro.Units.SI.Temperature T "Fluid temperature"; - ThermoSysPro.Units.SI.AbsolutePressure P(start=1.e5) "Fluid pressure"; - ThermoSysPro.Units.SI.SpecificEnthalpy h(start=100000) - "Fluid specific enthalpy"; - ThermoSysPro.Units.SI.Density rho(start=998) "Fluid density"; - ThermoSysPro.Units.SI.MassFlowRate BQ - "Right hand side of the mass balance equation"; - ThermoSysPro.Units.SI.Power BH - "Right hand side of the energy balance equation"; - ThermoSysPro.Units.SI.DerDensityByPressure ddph - "density derivative wrt pressure at constant specific enthalpy"; - ThermoSysPro.Units.SI.DerDensityByEnthalpy ddhp - "density derivative wrt specific enthalpy at constant pressure"; - ThermoSysPro.Units.SI.MassFlowRate BX[Medium.nXi] "Right hand side of the X balance equation"; + Units.SI.Temperature T "Fluid temperature"; + Units.SI.AbsolutePressure P(start=1.e5) "Fluid pressure"; + Units.SI.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy"; + Units.SI.Density rho(start=998) "Fluid density"; + Units.SI.MassFlowRate BQ "Right hand side of the mass balance equation"; + Units.SI.Power BH "Right hand side of the energy balance equation"; + Units.SI.DerDensityByPressure ddph "density derivative wrt pressure at constant specific enthalpy"; + Units.SI.DerDensityByEnthalpy ddhp "density derivative wrt specific enthalpy at constant pressure"; + Units.SI.MassFlowRate BX[Medium.nXi] "Right hand side of the X balance equation"; Medium.ExtraProperty X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Fluid mass fraction"; Medium.ExtraProperty BSubC[Medium.nC](quantity=Medium.extraPropertiesNames) "Right hand side of the trace balance equation"; Medium.ExtraProperty SubC[Medium.nC](quantity=Medium.extraPropertiesNames, start=Medium.C_default) "Fluid trace substances"; Medium.ExtraProperty SubCSaS[Medium.nC](quantity=Medium.extraPropertiesNames) "Trace modification in the trace balance equation"; Medium.ThermodynamicState state; - ThermoSysPro.Units.SI.Power Je1 "Thermal power diffusion from inlet e1"; - ThermoSysPro.Units.SI.Power Je2 "Thermal power diffusion from inlet e2"; - ThermoSysPro.Units.SI.Power Js1 "Thermal power diffusion from outlet s1"; - ThermoSysPro.Units.SI.Power Js2 "Thermal power diffusion from outlet s2"; - ThermoSysPro.Units.SI.Power J "Total thermal power diffusion"; - ThermoSysPro.Units.SI.MassFlowRate gamma_e1 - "Diffusion conductance for inlet e1"; - ThermoSysPro.Units.SI.MassFlowRate gamma_e2 - "Diffusion conductance for inlet e2"; - ThermoSysPro.Units.SI.MassFlowRate gamma_s1 - "Diffusion conductance for outlet s1"; - ThermoSysPro.Units.SI.MassFlowRate gamma_s2 - "Diffusion conductance for outlet s2"; + Units.SI.Power Je1 "Thermal power diffusion from inlet e1"; + Units.SI.Power Je2 "Thermal power diffusion from inlet e2"; + Units.SI.Power Js1 "Thermal power diffusion from outlet s1"; + Units.SI.Power Js2 "Thermal power diffusion from outlet s2"; + Units.SI.Power J "Total thermal power diffusion"; + Units.SI.MassFlowRate gamma_e1 "Diffusion conductance for inlet e1"; + Units.SI.MassFlowRate gamma_e2 "Diffusion conductance for inlet e2"; + Units.SI.MassFlowRate gamma_s1 "Diffusion conductance for outlet s1"; + Units.SI.MassFlowRate gamma_s2 "Diffusion conductance for outlet s2"; Real re1 "Value of r(Q/gamma) for inlet e1"; Real re2 "Value of r(Q/gamma) for inlet e2"; Real rs1 "Value of r(Q/gamma) for outlet s1"; @@ -342,6 +333,5 @@ equation
  • Daniel Bouskela
  • Baligh El Hefni
  • -"), - uses(ThermoSysPro(version="5.0"))); +")); end VolumeB; From 2d31b7006fbb739089d398f9388ec5e3b08a4a58 Mon Sep 17 00:00:00 2001 From: LAMBLOT Simon Date: Fri, 20 Jun 2025 10:52:10 +0200 Subject: [PATCH 050/178] corrections --- .../Machines/TestStaticCentrifugalPump.mo | 7 ++- .../TestStaticCentrifugalPump_FlueGases.mo | 7 ++- .../TestStaticCentrifugalPump_Traces.mo | 7 ++- .../Fluid/Machines/StaticCentrifugalPump.mo | 43 +++++++++---------- 4 files changed, 30 insertions(+), 34 deletions(-) diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStaticCentrifugalPump.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStaticCentrifugalPump.mo index 5da05aac..eaf3a569 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStaticCentrifugalPump.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStaticCentrifugalPump.mo @@ -1,9 +1,9 @@ -within ; +within ThermoSysPro.Fluid.Examples.SimpleExamples.Machines; model TestStaticCentrifugalPump extends ThermoSysPro.UsersGuide.Icons.Example; replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; - StaticCentrifugalPump staticCentrifugalPump( + ThermoSysPro.Fluid.Machines.StaticCentrifugalPump staticCentrifugalPump( redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package @@ -15,6 +15,5 @@ equation annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); connect(staticCentrifugalPump.C1, sourcePQ.C) annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); - annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), - uses(ThermoSysPro(version="5.0"))); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestStaticCentrifugalPump; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStaticCentrifugalPump_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStaticCentrifugalPump_FlueGases.mo index 3d38a722..d461da0e 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStaticCentrifugalPump_FlueGases.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStaticCentrifugalPump_FlueGases.mo @@ -1,9 +1,9 @@ -within ; +within ThermoSysPro.Fluid.Examples.SimpleExamples.Machines; model TestStaticCentrifugalPump_FlueGases extends ThermoSysPro.UsersGuide.Icons.Example; replaceable package Medium = ThermoSysPro.Properties.Media.FlueGases; - StaticCentrifugalPump staticCentrifugalPump( + ThermoSysPro.Fluid.Machines.StaticCentrifugalPump staticCentrifugalPump( redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-6,-10}, {14,10}}))); @@ -21,6 +21,5 @@ equation annotation (Line(points={{14,0},{30,0}}, color={0,0,0})); connect(staticCentrifugalPump.C1, sourcePQ.C) annotation (Line(points={{-6,0},{-30,0}}, color={0,0,0})); - annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), - uses(ThermoSysPro(version="5.0"))); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestStaticCentrifugalPump_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStaticCentrifugalPump_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStaticCentrifugalPump_Traces.mo index 26d98475..2f92f154 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStaticCentrifugalPump_Traces.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStaticCentrifugalPump_Traces.mo @@ -1,4 +1,4 @@ -within ; +within ThermoSysPro.Fluid.Examples.SimpleExamples.Machines; model TestStaticCentrifugalPump_Traces extends ThermoSysPro.UsersGuide.Icons.Example; @@ -6,7 +6,7 @@ model TestStaticCentrifugalPump_Traces extraPropertiesNames={"Trace"}, C_nominal={0.1}, C_default={0.2}); - StaticCentrifugalPump staticCentrifugalPump( + ThermoSysPro.Fluid.Machines.StaticCentrifugalPump staticCentrifugalPump( redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10}, {10,10}}))); @@ -21,6 +21,5 @@ equation annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); connect(staticCentrifugalPump.C1, sourcePQ.C) annotation (Line(points={{-10,0},{-32,0}}, color={0,0,0})); - annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), - uses(ThermoSysPro(version="5.0"))); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestStaticCentrifugalPump_Traces; diff --git a/ThermoSysPro/Fluid/Machines/StaticCentrifugalPump.mo b/ThermoSysPro/Fluid/Machines/StaticCentrifugalPump.mo index 6a8ad300..0506ea69 100644 --- a/ThermoSysPro/Fluid/Machines/StaticCentrifugalPump.mo +++ b/ThermoSysPro/Fluid/Machines/StaticCentrifugalPump.mo @@ -1,13 +1,13 @@ -within ; +within ThermoSysPro.Fluid.Machines; model StaticCentrifugalPump "Static centrifugal pump" - replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby - ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby + ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); - parameter ThermoSysPro.Units.nonSI.AngularVelocity_rpm VRot=1400 + parameter Units.nonSI.AngularVelocity_rpm VRot=1400 "Fixed rotational speed (active if fixed_rot_or_power=1 and rpm_or_mpower connector not connected)"; - parameter ThermoSysPro.Units.SI.Power MPower=0.1e6 + parameter Units.SI.Power MPower=0.1e6 "Fixed mechanical power (active if fixed_rot_or_power=2 and rpm_or_mpower connector not connected)"; - parameter ThermoSysPro.Units.nonSI.AngularVelocity_rpm VRotn=1400 + parameter Units.nonSI.AngularVelocity_rpm VRotn=1400 "Nominal rotational speed"; parameter Real rm=0.85 "Product of the pump mechanical and electrical efficiencies"; @@ -15,9 +15,9 @@ model StaticCentrifugalPump "Static centrifugal pump" "1: fixed rotational speed - 2: fixed mechanical power"; parameter Boolean adiabatic_compression=false "true: compression at constant enthalpy - false: compression with varying enthalpy"; - parameter ThermoSysPro.Units.SI.MassFlowRate gamma_diff=1e-4 + parameter Units.SI.MassFlowRate gamma_diff=1e-4 "Diffusion conductance (active if diffusion=true in neighbouring volumes)"; - parameter ThermoSysPro.Units.SI.Density p_rho=0 "If > 0, fixed fluid density" + parameter Units.SI.Density p_rho=0 "If > 0, fixed fluid density" annotation (Evaluate=true, Dialog(tab="Fluid", group="Fluid properties")); parameter Real a1=-88.67 @@ -35,28 +35,28 @@ model StaticCentrifugalPump "Static centrifugal pump" "Constant coef. of the pump efficiency characteristics rh = f(vol_flow) (s.u.)"; protected - constant ThermoSysPro.Units.SI.Acceleration g=Modelica.Constants.g_n + constant Units.SI.Acceleration g=Modelica.Constants.g_n "Gravity constant"; parameter Real eps=1.e-6 "Small number"; parameter Real rhmin=0.20 "Minimum efficiency to avoid zero crossings"; public Real rh "Hydraulic efficiency"; - ThermoSysPro.Units.SI.Height hn(start=10) "Pump head"; + Units.SI.Height hn(start=10) "Pump head"; Real R(start=VRot/VRotn) "Reduced rotational speed"; - ThermoSysPro.Units.SI.MassFlowRate Q(start=500) "Mass flow rate"; - ThermoSysPro.Units.SI.VolumeFlowRate Qv(start=0.5) "Volume flow rate"; - ThermoSysPro.Units.SI.Power Wh "Hydraulic power"; - ThermoSysPro.Units.SI.Power Wm "Mechanical power"; - ThermoSysPro.Units.nonSI.AngularVelocity_rpm Vr "Rotational speed"; - ThermoSysPro.Units.SI.Density rho(start=998) "Fluid density"; - ThermoSysPro.Units.SI.PressureDifference deltaP + Units.SI.MassFlowRate Q(start=500) "Mass flow rate"; + Units.SI.VolumeFlowRate Qv(start=0.5) "Volume flow rate"; + Units.SI.Power Wh "Hydraulic power"; + Units.SI.Power Wm "Mechanical power"; + Units.nonSI.AngularVelocity_rpm Vr "Rotational speed"; + Units.SI.Density rho(start=998) "Fluid density"; + Units.SI.PressureDifference deltaP "Pressure variation between the outlet and the inlet"; - ThermoSysPro.Units.SI.SpecificEnthalpy deltaH + Units.SI.SpecificEnthalpy deltaH "Specific enthalpy variation between the outlet and the inlet"; - ThermoSysPro.Units.SI.AbsolutePressure Pm(start=1.e5) + Units.SI.AbsolutePressure Pm(start=1.e5) "Fluid average pressure"; - ThermoSysPro.Units.SI.SpecificEnthalpy h(start=100000) + Units.SI.SpecificEnthalpy h(start=100000) "Fluid average specific enthalpy"; Medium.MassFraction X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Mass fractions"; @@ -186,6 +186,5 @@ equation
  • Baligh El Hefni
  • "), - DymolaStoredErrors, - uses(ThermoSysPro(version="5.0"), Modelica(version="4.0.0"))); + DymolaStoredErrors); end StaticCentrifugalPump; From f03e25488fe9ba31b482f1bb012d135f3219a610 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Fri, 20 Jun 2025 11:06:16 +0200 Subject: [PATCH 051/178] #125 VolumeD reviewed + startValues for FlueGases examples --- .../Volumes/TestVolumeA_FlueGases.mo | 2 +- .../Volumes/TestVolumeB_FlueGases.mo | 2 +- .../SimpleExamples/Volumes/TestVolumeD.mo | 28 +++------ .../Volumes/TestVolumeD_FlueGases.mo | 38 +++++------- .../Volumes/TestVolumeD_Traces.mo | 36 +++++------ ThermoSysPro/Fluid/Volumes/VolumeD.mo | 62 ++++++++----------- 6 files changed, 68 insertions(+), 100 deletions(-) diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeA_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeA_FlueGases.mo index fe764acd..a154a30d 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeA_FlueGases.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeA_FlueGases.mo @@ -12,7 +12,7 @@ model TestVolumeA_FlueGases P0=4500000, T0=573.15, option_temperature=true) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); - ThermoSysPro.Fluid.Volumes.VolumeA volumeA(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.Volumes.VolumeA volumeA(redeclare package Medium = Medium,h(start=2.83057e6)) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare replaceable package Medium = Medium, T0=573.15, diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeB_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeB_FlueGases.mo index ceda5fee..034bfd84 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeB_FlueGases.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeB_FlueGases.mo @@ -12,7 +12,7 @@ model TestVolumeB_FlueGases P0=4500000, T0=573.15, option_temperature=true) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); - ThermoSysPro.Fluid.Volumes.VolumeB volumeB(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.Volumes.VolumeB volumeB(redeclare package Medium = Medium,h(start=2.83057e6)) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ( redeclare replaceable package Medium = Medium, T0=573.15, diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeD.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeD.mo index 998e93ea..141159c5 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeD.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeD.mo @@ -1,25 +1,15 @@ -within ; +within ThermoSysPro.Fluid.Examples.SimpleExamples.Volumes; model TestVolumeD extends ThermoSysPro.UsersGuide.Icons.Example; replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; - ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package - Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); - VolumeD volumeD(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ( - redeclare replaceable - package Medium = Medium) annotation (Placement(transformation(extent={{-52,-10}, - {-32,10}}))); - SinkQ sinkQ(redeclare replaceable - package Medium = Medium) annotation (Placement(transformation(extent={{12,22}, - {32,42}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.Volumes.VolumeD volumeD(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-52,-10},{-32,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkQ(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{12,22},{32,42}}))); equation - connect(sourcePQ.C, volumeD.Ce) - annotation (Line(points={{-32,0},{-10,0}}, color={0,0,0})); - connect(volumeD.Cs3, sink.C) - annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); - connect(volumeD.Cs1, sinkQ.C) - annotation (Line(points={{0,10},{0,32},{12,32}}, color={0,0,0})); - annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), - uses(ThermoSysPro(version="5.0"))); + connect(sourcePQ.C, volumeD.Ce) annotation (Line(points={{-32,0},{-10,0}}, color={0,0,0})); + connect(volumeD.Cs3, sink.C) annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(volumeD.Cs1, sinkQ.C) annotation (Line(points={{0,10},{0,32},{12,32}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestVolumeD; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeD_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeD_FlueGases.mo index ac73a552..aad09e10 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeD_FlueGases.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeD_FlueGases.mo @@ -1,34 +1,28 @@ -within ; +within ThermoSysPro.Fluid.Examples.SimpleExamples.Volumes; model TestVolumeD_FlueGases extends ThermoSysPro.UsersGuide.Icons.Example; replaceable package Medium = ThermoSysPro.Properties.Media.FlueGases; - ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package - Medium = Medium, + ThermoSysPro.Fluid.BoundaryConditions.Sink sink( + redeclare replaceable package Medium = Medium, T0=573.15, - option_temperature=true) annotation (Placement(transformation(extent={{26,16}, - {46,36}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare - replaceable package Medium = Medium, + option_temperature=true) annotation (Placement(transformation(extent={{26,16},{46,36}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ( + redeclare replaceable package Medium = Medium, P0=4500000, T0=573.15, - option_temperature=true) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); - VolumeD volumeD(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); - SinkQ sinkQ( redeclare replaceable - package Medium = Medium, + option_temperature=true) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.Fluid.Volumes.VolumeD volumeD(redeclare package Medium = Medium,h(start=2.83057e6)) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkQ( + redeclare replaceable package Medium = Medium, T0=573.15, - option_temperature=true) annotation (Placement(transformation(extent={{-10,-10}, - {10,10}}, + option_temperature=true) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, rotation=0, origin={40,0}))); equation - connect(volumeD.Cs1, sink.C) - annotation (Line(points={{0,10},{0,26},{26,26}}, - color={0,0,0})); - connect(sourcePQ.C, volumeD.Ce) - annotation (Line(points={{-30,0},{-10,0}}, color={0,0,0})); - connect(volumeD.Cs3, sinkQ.C) - annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); - annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), - uses(ThermoSysPro(version="5.0"))); + connect(volumeD.Cs1, sink.C) annotation (Line(points={{0,10},{0,26},{26,26}}, color={0,0,0})); + connect(sourcePQ.C, volumeD.Ce) annotation (Line(points={{-30,0},{-10,0}}, color={0,0,0})); + connect(volumeD.Cs3, sinkQ.C) annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestVolumeD_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeD_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeD_Traces.mo index 818c28dd..767e33ce 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeD_Traces.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeD_Traces.mo @@ -1,4 +1,4 @@ -within ; +within ThermoSysPro.Fluid.Examples.SimpleExamples.Volumes; model TestVolumeD_Traces extends ThermoSysPro.UsersGuide.Icons.Example; @@ -6,30 +6,22 @@ model TestVolumeD_Traces extraPropertiesNames={"Trace"}, C_nominal={0.1}, C_default={0.2}); - ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package - Medium = Medium) annotation (Placement(transformation(extent={{20,20}, - {40,40}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare - replaceable package Medium = Medium, + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{20,20},{40,40}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ( + redeclare replaceable package Medium = Medium, Q0=100, - SubC0={0.5}) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); - VolumeD volumeD(redeclare package Medium = Medium, + SubC0={0.5}) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.Fluid.Volumes.VolumeD volumeD( + redeclare package Medium = Medium, V=1, - dynamic_mass_balance=false) annotation (Placement(transformation(extent={{-12,-10}, - {8,10}}))); - SinkQ sinkQ( redeclare replaceable - package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10}, - {10,10}}, + dynamic_mass_balance=false) annotation (Placement(transformation(extent={{-12,-10},{8,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkQ(redeclare replaceable package Medium = Medium) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, rotation=0, origin={40,0}))); equation - connect(volumeD.Cs1, sink.C) - annotation (Line(points={{-2,10},{-2,30},{20,30}}, - color={0,0,0})); - connect(sourcePQ.C, volumeD.Ce) - annotation (Line(points={{-30,0},{-12,0}}, color={0,0,0})); - connect(volumeD.Cs3, sinkQ.C) - annotation (Line(points={{8,0},{30,0}}, color={0,0,0})); - annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), - uses(ThermoSysPro(version="5.0"))); + connect(volumeD.Cs1, sink.C) annotation (Line(points={{-2,10},{-2,30},{20,30}}, color={0,0,0})); + connect(sourcePQ.C, volumeD.Ce) annotation (Line(points={{-30,0},{-12,0}}, color={0,0,0})); + connect(volumeD.Cs3, sinkQ.C) annotation (Line(points={{8,0},{30,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestVolumeD_Traces; diff --git a/ThermoSysPro/Fluid/Volumes/VolumeD.mo b/ThermoSysPro/Fluid/Volumes/VolumeD.mo index 5433f455..97569fd9 100644 --- a/ThermoSysPro/Fluid/Volumes/VolumeD.mo +++ b/ThermoSysPro/Fluid/Volumes/VolumeD.mo @@ -1,25 +1,25 @@ -within ; +within ThermoSysPro.Fluid.Volumes; model VolumeD "Mixing volume with 1 inlet and 3 outlets" extends ThermoSysPro.Fluid.Interfaces.IconColors; - replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); replaceable function SaS = Medium.noSaS(SubC=SubC) annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Boolean dynamic_energy_balance=true "true: dynamic energy balance equation - false: static energy balance equation"; - parameter ThermoSysPro.Units.SI.Volume V=1 + parameter Units.SI.Volume V=1 "Volume (active if dynamic_energy_balance=true)" annotation (Evaluate=true, Dialog(enable=dynamic_energy_balance)); parameter Boolean dynamic_mass_balance=false "true: dynamic mass balance equation - false: static mass balance equation (active if the fluid is compressible and if dynamic_energy_balance=true)" annotation(Evaluate=true, Dialog(enable=isCompressible and dynamic_energy_balance)); parameter Boolean steady_state=true "true: start from steady state - false: start from (P0, h0) (active if dynamic_energy_balance=true)" annotation(Evaluate=true, Dialog(enable=dynamic_energy_balance)); - parameter ThermoSysPro.Units.SI.AbsolutePressure P0=1e5 + parameter Units.SI.AbsolutePressure P0=1e5 "Initial fluid pressure (active if the fluid is compressible, and if dynamic_energy_balance=true and dynamic_mass_balance=true and steady_state=false)" annotation (Evaluate=true, Dialog(enable=isCompressible and dynamic_energy_balance and dynamic_mass_balance and not steady_state)); - parameter ThermoSysPro.Units.SI.SpecificEnthalpy h0=1e5 + parameter Units.SI.SpecificEnthalpy h0=1e5 "Initial fluid specific enthalpy (active if dynamic_energy_balance=true and steady_state=false)" annotation (Evaluate=true, Dialog(enable=dynamic_energy_balance and not steady_state)); @@ -27,10 +27,10 @@ model VolumeD "Mixing volume with 1 inlet and 3 outlets" "true: continuous flow reversal - false: discontinuous flow reversal"; parameter Boolean diffusion=false "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; - parameter ThermoSysPro.Units.SI.Density p_rho=0 "If > 0, fixed fluid density" + parameter Units.SI.Density p_rho=0 "If > 0, fixed fluid density" annotation (Evaluate=true, Dialog(tab="Fluid", group="Fluid properties")); parameter Boolean dynamic_composition_balance=false - "true: dynamic fluid composition balance equation
    false: static fluid composition balance equation (active for flue gases)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.FlueGases), tab="Fluid", group="Fluid properties")); + "true: dynamic fluid composition balance equation
    false: static fluid composition balance equation (active for flue gases)" annotation(Evaluate=true, Dialog(tab="Fluid", group="Fluid properties")); parameter Medium.ExtraProperty X0[Medium.nX]=Medium.X_default "Initial composition values" annotation (Evaluate=true, Dialog( enable=dynamic_composition_balance, tab="Fluid", @@ -39,42 +39,35 @@ model VolumeD "Mixing volume with 1 inlet and 3 outlets" protected constant Boolean isCompressible = Medium.isCompressible; - parameter ThermoSysPro.Units.SI.MassFlowRate gamma0=1.e-4 + parameter Units.SI.MassFlowRate gamma0=1.e-4 "Pseudo-diffusion conductance use for continuous flow reversal (active if diffusion=false and continuous_flow_reversal = true)"; public - ThermoSysPro.Units.SI.Temperature T "Fluid temperature"; - ThermoSysPro.Units.SI.AbsolutePressure P(start=1.e5) "Fluid pressure"; - ThermoSysPro.Units.SI.SpecificEnthalpy h(start=100000) - "Fluid specific enthalpy"; - ThermoSysPro.Units.SI.Density rho(start=998) "Fluid density"; - ThermoSysPro.Units.SI.MassFlowRate BQ - "Right hand side of the mass balance equation"; - ThermoSysPro.Units.SI.Power BH - "Right hand side of the energy balance equation"; - ThermoSysPro.Units.SI.DerDensityByPressure ddph + Units.SI.Temperature T "Fluid temperature"; + Units.SI.AbsolutePressure P(start=1.e5) "Fluid pressure"; + Units.SI.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy"; + Units.SI.Density rho(start=998) "Fluid density"; + Units.SI.MassFlowRate BQ "Right hand side of the mass balance equation"; + Units.SI.Power BH "Right hand side of the energy balance equation"; + Units.SI.DerDensityByPressure ddph "density derivative wrt pressure at constant specific enthalpy"; - ThermoSysPro.Units.SI.DerDensityByEnthalpy ddhp + Units.SI.DerDensityByEnthalpy ddhp "density derivative wrt specific enthalpy at constant pressure"; - ThermoSysPro.Units.SI.MassFlowRate BX[Medium.nXi] "Right hand side of the X balance equation"; + Units.SI.MassFlowRate BX[Medium.nXi] "Right hand side of the X balance equation"; Medium.ExtraProperty X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Fluid mass fraction"; Medium.ExtraProperty BSubC[Medium.nC](quantity=Medium.extraPropertiesNames) "Right hand side of the trace balance equation"; Medium.ExtraProperty SubC[Medium.nC](quantity=Medium.extraPropertiesNames, start=Medium.C_default) "Fluid trace substances"; Medium.ExtraProperty SubCSaS[Medium.nC](quantity=Medium.extraPropertiesNames) "Trace modification in the trace balance equation"; Medium.ThermodynamicState state; - ThermoSysPro.Units.SI.Power Je "Thermal power diffusion from inlet e"; - ThermoSysPro.Units.SI.Power Js1 "Thermal power diffusion from outlet s1"; - ThermoSysPro.Units.SI.Power Js2 "Thermal power diffusion from outlet s2"; - ThermoSysPro.Units.SI.Power Js3 "Thermal power diffusion from outlet s3"; - ThermoSysPro.Units.SI.Power J "Total thermal power diffusion"; - ThermoSysPro.Units.SI.MassFlowRate gamma_e - "Diffusion conductance for inlet e"; - ThermoSysPro.Units.SI.MassFlowRate gamma_s1 - "Diffusion conductance for outlet s1"; - ThermoSysPro.Units.SI.MassFlowRate gamma_s2 - "Diffusion conductance for outlet s2"; - ThermoSysPro.Units.SI.MassFlowRate gamma_s3 - "Diffusion conductance for outlet s3"; + Units.SI.Power Je "Thermal power diffusion from inlet e"; + Units.SI.Power Js1 "Thermal power diffusion from outlet s1"; + Units.SI.Power Js2 "Thermal power diffusion from outlet s2"; + Units.SI.Power Js3 "Thermal power diffusion from outlet s3"; + Units.SI.Power J "Total thermal power diffusion"; + Units.SI.MassFlowRate gamma_e "Diffusion conductance for inlet e"; + Units.SI.MassFlowRate gamma_s1 "Diffusion conductance for outlet s1"; + Units.SI.MassFlowRate gamma_s2 "Diffusion conductance for outlet s2"; + Units.SI.MassFlowRate gamma_s3 "Diffusion conductance for outlet s3"; Real re "Value of r(Q/gamma) for inlet e"; Real rs1 "Value of r(Q/gamma) for outlet s1"; Real rs2 "Value of r(Q/gamma) for outlet s2"; @@ -340,6 +333,5 @@ equation
  • Daniel Bouskela
  • Baligh El Hefni
  • -"), - uses(ThermoSysPro(version="5.0"))); +")); end VolumeD; From f6a02971e17778d2fb90d644e63f929d6f68e703 Mon Sep 17 00:00:00 2001 From: LAMBLOT Simon Date: Fri, 20 Jun 2025 11:12:55 +0200 Subject: [PATCH 052/178] corrections --- .../SimpleExamples/Volumes/TestVolumeI.mo | 12 +--- .../Volumes/TestVolumeI_FlueGases.mo | 14 +--- .../Volumes/TestVolumeI_Traces.mo | 14 +--- ThermoSysPro/Fluid/Volumes/VolumeI.mo | 69 +++++++++---------- 4 files changed, 43 insertions(+), 66 deletions(-) diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeI.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeI.mo index 1ebbb7b2..36c1c6c2 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeI.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeI.mo @@ -1,30 +1,24 @@ -within ; +within ThermoSysPro.Fluid.Examples.SimpleExamples.Volumes; model TestVolumeI extends ThermoSysPro.UsersGuide.Icons.Example; replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); - VolumeI volumeI(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.Volumes.VolumeI volumeI(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ( redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-52,-10}, {-32,10}}))); - SinkQ sinkQ(redeclare replaceable - package Medium = Medium) annotation (Placement(transformation(extent={{12,22}, - {32,42}}))); ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-50,10}, {-30,30}}))); equation connect(volumeI.Cs3, sink.C) annotation (Line(points={{10,-8},{20,-8},{20,0},{30,0}}, color={0,0,0})); - connect(volumeI.Cs1, sinkQ.C) - annotation (Line(points={{10,8},{10,32},{12,32}}, color={0,0,0})); connect(sourcePQ.C, volumeI.Ce2) annotation (Line(points={{-32,0},{-10,0}}, color={0,0,0})); connect(sourceQ.C, volumeI.Ce1) annotation (Line(points={{-30,20},{-10,20},{-10,8}}, color={0,0,0})); - annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), - uses(ThermoSysPro(version="5.0"))); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestVolumeI; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeI_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeI_FlueGases.mo index 5e31755e..e27d1d74 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeI_FlueGases.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeI_FlueGases.mo @@ -1,4 +1,4 @@ -within ; +within ThermoSysPro.Fluid.Examples.SimpleExamples.Volumes; model TestVolumeI_FlueGases extends ThermoSysPro.UsersGuide.Icons.Example; @@ -13,7 +13,7 @@ model TestVolumeI_FlueGases P0=4500000, T0=573.15, option_temperature=true) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); - VolumeI volumeI(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.Volumes.VolumeI volumeI(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare replaceable package Medium = Medium, T0=573.15, @@ -21,20 +21,12 @@ model TestVolumeI_FlueGases {10,10}}, rotation=0, origin={-40,20}))); - SinkQ sinkQ( - redeclare replaceable package Medium = Medium, - T0=573.15, - option_temperature=true) annotation (Placement(transformation(extent={{22,18}, - {42,38}}))); equation connect(sourcePQ.C, volumeI.Ce2) annotation (Line(points={{-30,0},{-10,0}}, color={0,0,0})); connect(sourceQ.C, volumeI.Ce1) annotation (Line(points={{-30,20},{-10,20},{-10,8}}, color={0,0,0})); - connect(sinkQ.C, volumeI.Cs1) - annotation (Line(points={{22,28},{10,28},{10,8}}, color={0,0,0})); connect(volumeI.Cs3, sink.C) annotation (Line(points={{10,-8},{26,-8}}, color={0,0,0})); - annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), - uses(ThermoSysPro(version="5.0"))); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestVolumeI_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeI_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeI_Traces.mo index 1b8840c3..b2402807 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeI_Traces.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeI_Traces.mo @@ -1,4 +1,4 @@ -within ; +within ThermoSysPro.Fluid.Examples.SimpleExamples.Volumes; model TestVolumeI_Traces extends ThermoSysPro.UsersGuide.Icons.Example; @@ -13,15 +13,10 @@ model TestVolumeI_Traces replaceable package Medium = Medium, Q0=100, SubC0={0.5}) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); - VolumeI volumeI(redeclare package Medium = Medium, + ThermoSysPro.Fluid.Volumes.VolumeI volumeI(redeclare package Medium = Medium, V=1, dynamic_mass_balance=false) annotation (Placement(transformation(extent={{-12,-10}, {8,10}}))); - SinkQ sinkQ( redeclare replaceable - package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10}, - {10,10}}, - rotation=0, - origin={40,0}))); ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ( redeclare replaceable package Medium = Medium, Q0=100, @@ -31,12 +26,9 @@ equation connect(volumeI.Cs1, sink.C) annotation (Line(points={{8,8},{8,30},{20,30}}, color={0,0,0})); - connect(volumeI.Cs3, sinkQ.C) - annotation (Line(points={{8,-8},{20,-8},{20,0},{30,0}}, color={0,0,0})); connect(sourcePQ.C, volumeI.Ce2) annotation (Line(points={{-30,0},{-12,0}}, color={0,0,0})); connect(sourceQ.C, volumeI.Ce1) annotation (Line(points={{-36,28},{-12,28},{-12,8}}, color={0,0,0})); - annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), - uses(ThermoSysPro(version="5.0"))); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestVolumeI_Traces; diff --git a/ThermoSysPro/Fluid/Volumes/VolumeI.mo b/ThermoSysPro/Fluid/Volumes/VolumeI.mo index acd70650..05901a4a 100644 --- a/ThermoSysPro/Fluid/Volumes/VolumeI.mo +++ b/ThermoSysPro/Fluid/Volumes/VolumeI.mo @@ -1,24 +1,24 @@ -within ; +within ThermoSysPro.Fluid.Volumes; model VolumeI "Mixing volume with 4 inlets and 4 outlets" extends ThermoSysPro.Fluid.Interfaces.IconColors; - replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); replaceable function SaS = Medium.noSaS(SubC=SubC) annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Boolean dynamic_energy_balance=true "true: dynamic energy balance equation - false: static energy balance equation"; - parameter ThermoSysPro.Units.SI.Volume V=1 + parameter Units.SI.Volume V=1 "Volume (active if dynamic_energy_balance=true)" annotation (Evaluate=true, Dialog(enable=dynamic_energy_balance)); parameter Boolean dynamic_mass_balance=false "true: dynamic mass balance equation - false: static mass balance equation (active if the fluid is compressible and if dynamic_energy_balance=true)" annotation(Evaluate=true, Dialog(enable=isCompressible and dynamic_energy_balance)); parameter Boolean steady_state=true "true: start from steady state - false: start from (P0, h0) (active if dynamic_energy_balance=true)" annotation(Evaluate=true, Dialog(enable=dynamic_energy_balance)); - parameter ThermoSysPro.Units.SI.AbsolutePressure P0=1e5 + parameter Units.SI.AbsolutePressure P0=1e5 "Initial fluid pressure (active if the fluid is compressible, and if dynamic_energy_balance=true and dynamic_mass_balance=true and steady_state=false)" annotation (Evaluate=true, Dialog(enable=isCompressible and dynamic_energy_balance and dynamic_mass_balance and not steady_state)); - parameter ThermoSysPro.Units.SI.SpecificEnthalpy h0=1e5 + parameter Units.SI.SpecificEnthalpy h0=1e5 "Initial fluid specific enthalpy (active if dynamic_energy_balance=true and steady_state=false)" annotation (Evaluate=true, Dialog(enable=dynamic_energy_balance and not steady_state)); @@ -26,7 +26,7 @@ model VolumeI "Mixing volume with 4 inlets and 4 outlets" "true: continuous flow reversal - false: discontinuous flow reversal"; parameter Boolean diffusion=false "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; - parameter ThermoSysPro.Units.SI.Density p_rho=0 "If > 0, fixed fluid density" + parameter Units.SI.Density p_rho=0 "If > 0, fixed fluid density" annotation (Evaluate=true, Dialog(tab="Fluid", group="Fluid properties")); parameter Boolean dynamic_composition_balance=false "true: dynamic fluid composition balance equation
    false: static fluid composition balance equation (active for flue gases)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.FlueGases), tab="Fluid", group="Fluid properties")); @@ -39,53 +39,53 @@ model VolumeI "Mixing volume with 4 inlets and 4 outlets" protected constant Boolean isCompressible = Medium.isCompressible; - parameter ThermoSysPro.Units.SI.MassFlowRate gamma0=1.e-4 + parameter Units.SI.MassFlowRate gamma0=1.e-4 "Pseudo-diffusion conductance use for continuous flow reversal (active if diffusion=false and continuous_flow_reversal = true)"; public - ThermoSysPro.Units.SI.Temperature T "Fluid temperature"; - ThermoSysPro.Units.SI.AbsolutePressure P(start=1.e5) "Fluid pressure"; - ThermoSysPro.Units.SI.SpecificEnthalpy h(start=100000) + Units.SI.Temperature T "Fluid temperature"; + Units.SI.AbsolutePressure P(start=1.e5) "Fluid pressure"; + Units.SI.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy"; - ThermoSysPro.Units.SI.Density rho(start=998) "Fluid density"; - ThermoSysPro.Units.SI.MassFlowRate BQ + Units.SI.Density rho(start=998) "Fluid density"; + Units.SI.MassFlowRate BQ "Right hand side of the mass balance equation"; - ThermoSysPro.Units.SI.Power BH + Units.SI.Power BH "Right hand side of the energy balance equation"; - ThermoSysPro.Units.SI.DerDensityByPressure ddph + Units.SI.DerDensityByPressure ddph "density derivative wrt pressure at constant specific enthalpy"; - ThermoSysPro.Units.SI.DerDensityByEnthalpy ddhp + Units.SI.DerDensityByEnthalpy ddhp "density derivative wrt specific enthalpy at constant pressure"; - ThermoSysPro.Units.SI.MassFlowRate BX[Medium.nXi] "Right hand side of the X balance equation"; + Units.SI.MassFlowRate BX[Medium.nXi] "Right hand side of the X balance equation"; Medium.ExtraProperty X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Fluid mass fraction"; Medium.ExtraProperty BSubC[Medium.nC](quantity=Medium.extraPropertiesNames) "Right hand side of the trace balance equation"; Medium.ExtraProperty SubC[Medium.nC](quantity=Medium.extraPropertiesNames, start=Medium.C_default) "Fluid trace substances"; Medium.ExtraProperty SubCSaS[Medium.nC](quantity=Medium.extraPropertiesNames) "Trace modification in the trace balance equation"; Medium.ThermodynamicState state; - ThermoSysPro.Units.SI.Power Je1 "Thermal power diffusion from inlet e1"; - ThermoSysPro.Units.SI.Power Je2 "Thermal power diffusion from inlet e2"; - ThermoSysPro.Units.SI.Power Je3 "Thermal power diffusion from inlet e3"; - ThermoSysPro.Units.SI.Power Je4 "Thermal power diffusion from inlet e4"; - ThermoSysPro.Units.SI.Power Js1 "Thermal power diffusion from outlet s1"; - ThermoSysPro.Units.SI.Power Js2 "Thermal power diffusion from outlet s2"; - ThermoSysPro.Units.SI.Power Js3 "Thermal power diffusion from outlet s3"; - ThermoSysPro.Units.SI.Power Js4 "Thermal power diffusion from outlet s4"; - ThermoSysPro.Units.SI.Power J "Total thermal power diffusion"; - ThermoSysPro.Units.SI.MassFlowRate gamma_e1 + Units.SI.Power Je1 "Thermal power diffusion from inlet e1"; + Units.SI.Power Je2 "Thermal power diffusion from inlet e2"; + Units.SI.Power Je3 "Thermal power diffusion from inlet e3"; + Units.SI.Power Je4 "Thermal power diffusion from inlet e4"; + Units.SI.Power Js1 "Thermal power diffusion from outlet s1"; + Units.SI.Power Js2 "Thermal power diffusion from outlet s2"; + Units.SI.Power Js3 "Thermal power diffusion from outlet s3"; + Units.SI.Power Js4 "Thermal power diffusion from outlet s4"; + Units.SI.Power J "Total thermal power diffusion"; + Units.SI.MassFlowRate gamma_e1 "Diffusion conductance for inlet e1"; - ThermoSysPro.Units.SI.MassFlowRate gamma_e2 + Units.SI.MassFlowRate gamma_e2 "Diffusion conductance for inlet e2"; - ThermoSysPro.Units.SI.MassFlowRate gamma_e3 + Units.SI.MassFlowRate gamma_e3 "Diffusion conductance for inlet e3"; - ThermoSysPro.Units.SI.MassFlowRate gamma_e4 + Units.SI.MassFlowRate gamma_e4 "Diffusion conductance for inlet e4"; - ThermoSysPro.Units.SI.MassFlowRate gamma_s1 + Units.SI.MassFlowRate gamma_s1 "Diffusion conductance for outlet s1"; - ThermoSysPro.Units.SI.MassFlowRate gamma_s2 + Units.SI.MassFlowRate gamma_s2 "Diffusion conductance for outlet s2"; - ThermoSysPro.Units.SI.MassFlowRate gamma_s3 + Units.SI.MassFlowRate gamma_s3 "Diffusion conductance for outlet s3"; - ThermoSysPro.Units.SI.MassFlowRate gamma_s4 + Units.SI.MassFlowRate gamma_s4 "Diffusion conductance for outlet s4"; Real re1 "Value of r(Q/gamma) for inlet e1"; Real re2 "Value of r(Q/gamma) for inlet e2"; @@ -490,6 +490,5 @@ equation
  • Daniel Bouskela
  • Baligh El Hefni
  • -"), - uses(ThermoSysPro(version="5.0"))); +")); end VolumeI; From 74bebfaa867262cad44844617f6af987740ff6b5 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Fri, 20 Jun 2025 11:14:42 +0200 Subject: [PATCH 053/178] #125 Bend reviewed --- .../SimpleExamples/PressureLosses/TestBend.mo | 25 ++++++------------ .../PressureLosses/TestBend_FlueGases.mo | 18 +++++-------- .../PressureLosses/TestBend_Traces.mo | 26 ++++++------------- .../PressureLosses/package.order | 2 +- ThermoSysPro/Fluid/PressureLosses/Bend.mo | 14 +++++----- 5 files changed, 32 insertions(+), 53 deletions(-) diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestBend.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestBend.mo index b6202084..4609b989 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestBend.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestBend.mo @@ -1,25 +1,16 @@ -within ; +within ThermoSysPro.Fluid.Examples.SimpleExamples.PressureLosses; model TestBend extends ThermoSysPro.UsersGuide.Icons.Example; replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; - Bend bend( - redeclare replaceable package Medium = Medium) - annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package - Medium = Medium) - annotation (Placement(transformation(extent={{-10,-10},{10,10}}, + ThermoSysPro.Fluid.PressureLosses.Bend bend(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package Medium = Medium) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, rotation=270, origin={0,-40}))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare - replaceable package Medium = Medium) - annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); equation - connect(bend.C2, sink.C) annotation (Line(points={{0,-10},{0,-22},{ - 1.77636e-15,-22},{1.77636e-15,-30}}, color={0,0,0})); - connect(bend.C1, sourcePQ.C) - annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); - annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( - coordinateSystem(preserveAspectRatio=false)), - uses(ThermoSysPro(version="5.0"))); + connect(bend.C2, sink.C) annotation (Line(points={{0,-10},{0,-22},{1.77636e-15,-22},{1.77636e-15,-30}}, color={0,0,0})); + connect(bend.C1, sourcePQ.C) annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestBend; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestBend_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestBend_FlueGases.mo index 3b8b4911..dbb61f49 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestBend_FlueGases.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestBend_FlueGases.mo @@ -1,15 +1,14 @@ -within ; +within ThermoSysPro.Fluid.Examples.SimpleExamples.PressureLosses; model TestBend_FlueGases extends ThermoSysPro.UsersGuide.Icons.Example; replaceable package Medium = ThermoSysPro.Properties.Media.FlueGases; - Bend bend( redeclare - replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.PressureLosses.Bend bend(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); ThermoSysPro.Fluid.BoundaryConditions.Sink sink( redeclare replaceable package Medium = Medium, T0=573.15, - option_temperature=true) annotation (Placement(transformation(extent={{-10,-10}, - {10,10}}, + option_temperature=true) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, rotation=270, origin={0,-40}))); ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ( @@ -18,10 +17,7 @@ model TestBend_FlueGases T0=573.15, option_temperature=true) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); equation - connect(bend.C2, sink.C) annotation (Line(points={{0,-10},{0,-30},{ - 1.77636e-15,-30}}, color={0,0,0})); - connect(bend.C1, sourcePQ.C) - annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); - annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), - uses(ThermoSysPro(version="5.0"))); + connect(bend.C2, sink.C) annotation (Line(points={{0,-10},{0,-30},{1.77636e-15,-30}}, color={0,0,0})); + connect(bend.C1, sourcePQ.C) annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestBend_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestBend_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestBend_Traces.mo index 472395e5..419b6238 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestBend_Traces.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestBend_Traces.mo @@ -1,4 +1,4 @@ -within ; +within ThermoSysPro.Fluid.Examples.SimpleExamples.PressureLosses; model TestBend_Traces extends ThermoSysPro.UsersGuide.Icons.Example; @@ -6,24 +6,14 @@ model TestBend_Traces extraPropertiesNames={"Trace1"}, C_nominal={0.1}, C_default={0.2}); - Bend bend(redeclare - replaceable package Medium = - Medium) - annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package - Medium = Medium) - annotation (Placement(transformation(extent={{-10,-10},{10,10}}, + ThermoSysPro.Fluid.PressureLosses.Bend bend(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package Medium = Medium) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, rotation=270, origin={0,-40}))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare - replaceable package Medium = Medium, SubC0={0.3}) - annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare replaceable package Medium = Medium, SubC0={0.3}) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); equation - connect(bend.C2, sink.C) annotation (Line(points={{0,-10},{0,-23},{1.77636e-15, - -23},{1.77636e-15,-30}}, color={0,0,0})); - connect(bend.C1, sourcePQ.C) - annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); - annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( - coordinateSystem(preserveAspectRatio=false)), - uses(ThermoSysPro(version="5.0"))); + connect(bend.C2, sink.C) annotation (Line(points={{0,-10},{0,-23},{1.77636e-15,-23},{1.77636e-15,-30}}, color={0,0,0})); + connect(bend.C1, sourcePQ.C) annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestBend_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order index 45cdceb3..cf7de367 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order @@ -7,6 +7,6 @@ TestSingularPressureLoss_Traces_FlueGases TestControlValve TestControlValve_Traces TestControlValve_Traces_FlueGases +TestBend TestBend_FlueGases TestBend_Traces -TestBend \ No newline at end of file diff --git a/ThermoSysPro/Fluid/PressureLosses/Bend.mo b/ThermoSysPro/Fluid/PressureLosses/Bend.mo index ae391d93..b6103fc3 100644 --- a/ThermoSysPro/Fluid/PressureLosses/Bend.mo +++ b/ThermoSysPro/Fluid/PressureLosses/Bend.mo @@ -1,6 +1,9 @@ -within ; +within ThermoSysPro.Fluid.PressureLosses; model Bend "Bend" - replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + + extends ThermoSysPro.Fluid.Interfaces.IconColors; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter ThermoSysPro.Units.SI.Diameter D=0.2 "Pipe diameter"; parameter ThermoSysPro.Units.SI.Radius R0=0.2 "Pipe radius"; @@ -130,12 +133,12 @@ equation /* Fluid thermodynamic properties */ Pm = (C1.P + C2.P)/2; - T = Medium.temperature_phX(p=Pm, h=h, X=X); + T = Medium.temperature(state); if (p_rho > 0) then rho = p_rho; else - rho = Medium.density_phX(p=Pm, h=h, X=X); + rho = Medium.density(state); end if; state=Medium.setState_phX(p=Pm, h=h, X=X); @@ -222,6 +225,5 @@ equation
  • Daniel Bouskela
  • Baligh El Hefni
  • -"), - uses(ThermoSysPro(version="5.0"), Modelica(version="4.0.0"))); +")); end Bend; From e2e46ed9c5134a71fa6d418879391808dd1f4fc1 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Fri, 20 Jun 2025 11:22:20 +0200 Subject: [PATCH 054/178] #125 Bend units modified --- ThermoSysPro/Fluid/PressureLosses/Bend.mo | 28 +++++++++++------------ 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/ThermoSysPro/Fluid/PressureLosses/Bend.mo b/ThermoSysPro/Fluid/PressureLosses/Bend.mo index b6103fc3..c1b5c962 100644 --- a/ThermoSysPro/Fluid/PressureLosses/Bend.mo +++ b/ThermoSysPro/Fluid/PressureLosses/Bend.mo @@ -5,17 +5,17 @@ model Bend "Bend" replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); - parameter ThermoSysPro.Units.SI.Diameter D=0.2 "Pipe diameter"; - parameter ThermoSysPro.Units.SI.Radius R0=0.2 "Pipe radius"; - parameter ThermoSysPro.Units.nonSI.Angle_deg delta=90 "Pipe angle"; + parameter Units.SI.Diameter D=0.2 "Pipe diameter"; + parameter Units.SI.Radius R0=0.2 "Pipe radius"; + parameter Units.nonSI.Angle_deg delta=90 "Pipe angle"; parameter Real rugosrel=0 "Pipe roughness"; parameter Boolean K_A1_Tabule=true "true: A1 is computed using linear interpolation - false: A1 is computed using correlation formula"; parameter Boolean K_B1_Tabule=true "true: B1 is computed using linear interpolation - false: B1 is computed using correlation formula"; - parameter ThermoSysPro.Units.SI.MassFlowRate gamma_diff=1e-4 + parameter Units.SI.MassFlowRate gamma_diff=1e-4 "Diffusion conductance (active if diffusion=true in neighbouring volumes)"; - parameter ThermoSysPro.Units.SI.Density p_rho=0 "If > 0, fixed fluid density" + parameter Units.SI.Density p_rho=0 "If > 0, fixed fluid density" annotation (Evaluate=true, Dialog(tab="Fluid", group="Fluid properties")); protected @@ -27,19 +27,19 @@ public Real khim "Singular pressure loss coefficient"; Real khif "Friction pressure loss coefficient"; Real kdelta "Roughness factor for the singular pressure loss"; - ThermoSysPro.Units.SI.PressureDifference deltaP "Presure loss"; - ThermoSysPro.Units.SI.MassFlowRate Q "Mass flow rate"; - ThermoSysPro.Units.SI.ReynoldsNumber Re "Reynolds number"; - ThermoSysPro.Units.SI.ReynoldsNumber Relim "Limit Reynolds number"; + Units.SI.PressureDifference deltaP "Presure loss"; + Units.SI.MassFlowRate Q "Mass flow rate"; + Units.SI.ReynoldsNumber Re "Reynolds number"; + Units.SI.ReynoldsNumber Relim "Limit Reynolds number"; Real yA1 "Output of table A1"; Real yB1 "Output of table B1"; Real yC1 "Output of table C1"; Real lambda "Friction pressure loss coefficient"; - ThermoSysPro.Units.SI.Density rho "Fluid density"; - ThermoSysPro.Units.SI.DynamicViscosity mu "Fluid dynamic viscosity"; - ThermoSysPro.Units.SI.Temperature T "Fluid temperature"; - ThermoSysPro.Units.SI.AbsolutePressure Pm "Fluid average pressure"; - ThermoSysPro.Units.SI.SpecificEnthalpy h "Fluid specific enthalpy"; + Units.SI.Density rho "Fluid density"; + Units.SI.DynamicViscosity mu "Fluid dynamic viscosity"; + Units.SI.Temperature T "Fluid temperature"; + Units.SI.AbsolutePressure Pm "Fluid average pressure"; + Units.SI.SpecificEnthalpy h "Fluid specific enthalpy"; Medium.MassFraction X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Mass fractions"; Medium.ThermodynamicState state; From 8b060a3525ee289af6ab8046aeb3628579a9910c Mon Sep 17 00:00:00 2001 From: LAMBLOT Simon Date: Fri, 20 Jun 2025 11:23:39 +0200 Subject: [PATCH 055/178] corrections --- .../PressureLosses/TestCheckValve.mo | 7 ++--- .../TestCheckValve_FlueGases.mo | 7 ++--- .../PressureLosses/TestCheckValve_Traces.mo | 7 ++--- .../Fluid/PressureLosses/CheckValve.mo | 31 +++++++++---------- 4 files changed, 24 insertions(+), 28 deletions(-) diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestCheckValve.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestCheckValve.mo index e544c359..86242b26 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestCheckValve.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestCheckValve.mo @@ -1,9 +1,9 @@ -within ; +within ThermoSysPro.Fluid.Examples.SimpleExamples.PressureLosses; model TestCheckValve extends ThermoSysPro.UsersGuide.Icons.Example; replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; - CheckValve checkValve( + ThermoSysPro.Fluid.PressureLosses.CheckValve checkValve( redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package @@ -20,6 +20,5 @@ equation connect(checkValve.C1, sourcePQ.C) annotation (Line(points={{-11,0},{-30,0}}, color={0,0,0})); annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( - coordinateSystem(preserveAspectRatio=false)), - uses(ThermoSysPro(version="5.0"))); + coordinateSystem(preserveAspectRatio=false))); end TestCheckValve; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestCheckValve_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestCheckValve_FlueGases.mo index 6efa2a46..0058fa76 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestCheckValve_FlueGases.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestCheckValve_FlueGases.mo @@ -1,9 +1,9 @@ -within ; +within ThermoSysPro.Fluid.Examples.SimpleExamples.PressureLosses; model TestCheckValve_FlueGases extends ThermoSysPro.UsersGuide.Icons.Example; replaceable package Medium = ThermoSysPro.Properties.Media.FlueGases; - CheckValve checkValve( redeclare + ThermoSysPro.Fluid.PressureLosses.CheckValve checkValve( redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); ThermoSysPro.Fluid.BoundaryConditions.Sink sink( redeclare replaceable package Medium = Medium, @@ -22,6 +22,5 @@ equation annotation (Line(points={{11,0},{30,0}}, color={0,0,0})); connect(checkValve.C1, sourcePQ.C) annotation (Line(points={{-11,0},{-30,0}}, color={0,0,0})); - annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), - uses(ThermoSysPro(version="5.0"))); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestCheckValve_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestCheckValve_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestCheckValve_Traces.mo index b69800a3..03db4bd5 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestCheckValve_Traces.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestCheckValve_Traces.mo @@ -1,4 +1,4 @@ -within ; +within ThermoSysPro.Fluid.Examples.SimpleExamples.PressureLosses; model TestCheckValve_Traces extends ThermoSysPro.UsersGuide.Icons.Example; @@ -6,7 +6,7 @@ model TestCheckValve_Traces extraPropertiesNames={"Trace1"}, C_nominal={0.1}, C_default={0.2}); - CheckValve checkValve( + ThermoSysPro.Fluid.PressureLosses.CheckValve checkValve( redeclare replaceable package Medium = Medium) @@ -25,6 +25,5 @@ equation connect(checkValve.C1, sourcePQ.C) annotation (Line(points={{-11,0},{-30,0}}, color={0,0,0})); annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( - coordinateSystem(preserveAspectRatio=false)), - uses(ThermoSysPro(version="5.0"))); + coordinateSystem(preserveAspectRatio=false))); end TestCheckValve_Traces; diff --git a/ThermoSysPro/Fluid/PressureLosses/CheckValve.mo b/ThermoSysPro/Fluid/PressureLosses/CheckValve.mo index 0add4436..49640464 100644 --- a/ThermoSysPro/Fluid/PressureLosses/CheckValve.mo +++ b/ThermoSysPro/Fluid/PressureLosses/CheckValve.mo @@ -1,18 +1,18 @@ -within ; +within ThermoSysPro.Fluid.PressureLosses; model CheckValve "Check valve" - replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); - parameter ThermoSysPro.Units.SI.PressureDifference dPOuvert=10 + parameter Units.SI.PressureDifference dPOuvert=10 "Pressure difference when the valve opens"; - parameter ThermoSysPro.Units.SI.PressureDifference dPFerme=0 + parameter Units.SI.PressureDifference dPFerme=0 "Pressure difference when the valve closes"; - parameter ThermoSysPro.Units.xSI.PressureLossCoefficient k=1000 + parameter Units.xSI.PressureLossCoefficient k=1000 "Pressure loss coefficient"; - parameter ThermoSysPro.Units.SI.MassFlowRate Qmin=1.e-6 + parameter Units.SI.MassFlowRate Qmin=1.e-6 "Mass flow when the valve is closed"; - parameter ThermoSysPro.Units.SI.MassFlowRate gamma_diff=1e-4 + parameter Units.SI.MassFlowRate gamma_diff=1e-4 "Diffusion conductance (active if diffusion=true in neighbouring volumes)"; - parameter ThermoSysPro.Units.SI.Density p_rho=0 "If > 0, fixed fluid density" + parameter Units.SI.Density p_rho=0 "If > 0, fixed fluid density" annotation (Evaluate=true, Dialog(tab="Fluid", group="Fluid properties")); protected @@ -22,13 +22,13 @@ public Boolean ouvert(start=true, fixed=true) "Valve state"; discrete Boolean touvert(start=false, fixed=true); discrete Boolean tferme(start=false, fixed=true); - ThermoSysPro.Units.SI.MassFlowRate Q(start=500) "Mass flow rate"; - ThermoSysPro.Units.SI.PressureDifference deltaP "Singular pressure loss"; - ThermoSysPro.Units.SI.Density rho(start=998) "Fluid density"; - ThermoSysPro.Units.SI.Temperature T(start=290) "Fluid temperature"; - ThermoSysPro.Units.SI.AbsolutePressure Pm(start=1.e5) + Units.SI.MassFlowRate Q(start=500) "Mass flow rate"; + Units.SI.PressureDifference deltaP "Singular pressure loss"; + Units.SI.Density rho(start=998) "Fluid density"; + Units.SI.Temperature T(start=290) "Fluid temperature"; + Units.SI.AbsolutePressure Pm(start=1.e5) "Fluid average pressure"; - ThermoSysPro.Units.SI.SpecificEnthalpy h(start=100000) + Units.SI.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy"; Medium.MassFraction X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Mass fractions"; @@ -133,6 +133,5 @@ equation
  • Daniel Bouskela
  • "), - DymolaStoredErrors, - uses(ThermoSysPro(version="5.0"))); + DymolaStoredErrors); end CheckValve; From 2aea315d622ab9c2b417feacfcbcc39c5c009392 Mon Sep 17 00:00:00 2001 From: LAMBLOT Simon Date: Fri, 20 Jun 2025 11:31:21 +0200 Subject: [PATCH 056/178] dernieres corrections --- ThermoSysPro/Fluid/Volumes/VolumeI.mo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ThermoSysPro/Fluid/Volumes/VolumeI.mo b/ThermoSysPro/Fluid/Volumes/VolumeI.mo index 05901a4a..8335e4e8 100644 --- a/ThermoSysPro/Fluid/Volumes/VolumeI.mo +++ b/ThermoSysPro/Fluid/Volumes/VolumeI.mo @@ -29,7 +29,7 @@ model VolumeI "Mixing volume with 4 inlets and 4 outlets" parameter Units.SI.Density p_rho=0 "If > 0, fixed fluid density" annotation (Evaluate=true, Dialog(tab="Fluid", group="Fluid properties")); parameter Boolean dynamic_composition_balance=false - "true: dynamic fluid composition balance equation
    false: static fluid composition balance equation (active for flue gases)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.FlueGases), tab="Fluid", group="Fluid properties")); + "true: dynamic fluid composition balance equation
    false: static fluid composition balance equation (active for flue gases)" annotation(Evaluate=true, Dialog(tab="Fluid", group="Fluid properties")); parameter Medium.ExtraProperty X0[Medium.nX]=Medium.X_default "Initial composition values" annotation (Evaluate=true, Dialog( enable=dynamic_composition_balance, tab="Fluid", From 734be47eed3620c53f85921868af1c37a3b31f1a Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Fri, 20 Jun 2025 11:40:06 +0200 Subject: [PATCH 057/178] #125 Diaphragm reviewed --- .../PressureLosses/TestDiaphragm.mo | 20 ++++-------- .../PressureLosses/TestDiaphragm_FlueGases.mo | 14 +++----- .../PressureLosses/TestDiaphragm_Traces.mo | 21 ++++-------- .../Fluid/PressureLosses/Diaphragm.mo | 32 +++++++++---------- 4 files changed, 35 insertions(+), 52 deletions(-) diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDiaphragm.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDiaphragm.mo index 7210150b..b063b2f6 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDiaphragm.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDiaphragm.mo @@ -1,19 +1,13 @@ -within ; +within ThermoSysPro.Fluid.Examples.SimpleExamples.PressureLosses; model TestDiaphragm extends ThermoSysPro.UsersGuide.Icons.Example; replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; - Diaphragm diaphragm( redeclare - replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package - Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare - replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.Fluid.PressureLosses.Diaphragm diaphragm(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); equation - connect(diaphragm.C2, sink.C) - annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); - connect(diaphragm.C1, sourcePQ.C) - annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); - annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), - uses(ThermoSysPro(version="5.0"))); + connect(diaphragm.C2, sink.C) annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(diaphragm.C1, sourcePQ.C) annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestDiaphragm; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDiaphragm_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDiaphragm_FlueGases.mo index 3f8b5717..c0891318 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDiaphragm_FlueGases.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDiaphragm_FlueGases.mo @@ -1,10 +1,9 @@ -within ; +within ThermoSysPro.Fluid.Examples.SimpleExamples.PressureLosses; model TestDiaphragm_FlueGases extends ThermoSysPro.UsersGuide.Icons.Example; replaceable package Medium = ThermoSysPro.Properties.Media.FlueGases; - Diaphragm diaphragm( redeclare - replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.PressureLosses.Diaphragm diaphragm(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); ThermoSysPro.Fluid.BoundaryConditions.Sink sink( redeclare replaceable package Medium = Medium, T0=573.15, @@ -15,10 +14,7 @@ model TestDiaphragm_FlueGases T0=573.15, option_temperature=true) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); equation - connect(diaphragm.C2, sink.C) - annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); - connect(diaphragm.C1, sourcePQ.C) - annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); - annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), - uses(ThermoSysPro(version="5.0"))); + connect(diaphragm.C2, sink.C) annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(diaphragm.C1, sourcePQ.C) annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestDiaphragm_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDiaphragm_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDiaphragm_Traces.mo index 28493bad..f5acc6d4 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDiaphragm_Traces.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDiaphragm_Traces.mo @@ -1,4 +1,4 @@ -within ; +within ThermoSysPro.Fluid.Examples.SimpleExamples.PressureLosses; model TestDiaphragm_Traces extends ThermoSysPro.UsersGuide.Icons.Example; @@ -6,18 +6,11 @@ model TestDiaphragm_Traces extraPropertiesNames={"Trace"}, C_nominal={0.1}, C_default={0.2}); - Diaphragm diaphragm( redeclare - replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package - Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare - replaceable package Medium = Medium, SubC0={0.3}) - annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.Fluid.PressureLosses.Diaphragm diaphragm(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare replaceable package Medium = Medium, SubC0={0.3}) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); equation - connect(diaphragm.C2, sink.C) - annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); - connect(diaphragm.C1, sourcePQ.C) - annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); - annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), - uses(ThermoSysPro(version="5.0"))); + connect(diaphragm.C2, sink.C) annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(diaphragm.C1, sourcePQ.C) annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestDiaphragm_Traces; diff --git a/ThermoSysPro/Fluid/PressureLosses/Diaphragm.mo b/ThermoSysPro/Fluid/PressureLosses/Diaphragm.mo index 98ae7b33..1445aed5 100644 --- a/ThermoSysPro/Fluid/PressureLosses/Diaphragm.mo +++ b/ThermoSysPro/Fluid/PressureLosses/Diaphragm.mo @@ -1,12 +1,12 @@ -within ; +within ThermoSysPro.Fluid.PressureLosses; model Diaphragm "Diaphragm" - replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Real Ouv=0.5 "Diaphragm aperture"; - parameter ThermoSysPro.Units.SI.Diameter D=0.2 "Diaphragm diameter"; - parameter ThermoSysPro.Units.SI.MassFlowRate gamma_diff=1e-4 + parameter Units.SI.Diameter D=0.2 "Diaphragm diameter"; + parameter Units.SI.MassFlowRate gamma_diff=1e-4 "Diffusion conductance (active if diffusion=true in neighbouring volumes)"; - parameter ThermoSysPro.Units.SI.Density p_rho=0 "If > 0, fixed fluid density" + parameter Units.SI.Density p_rho=0 "If > 0, fixed fluid density" annotation (Evaluate=true, Dialog(tab="Fluid", group="Fluid properties")); protected @@ -15,15 +15,15 @@ protected public Real khi "Hydraulic pressure loss coefficient"; - ThermoSysPro.Units.SI.PressureDifference deltaP "Pressure loss"; - ThermoSysPro.Units.SI.MassFlowRate Q "Mass flow rate"; - ThermoSysPro.Units.SI.ReynoldsNumber Re "Reynolds number"; - ThermoSysPro.Units.SI.ReynoldsNumber Relim "Limit Reynolds number"; - ThermoSysPro.Units.SI.Density rho "Fluid density"; - ThermoSysPro.Units.SI.DynamicViscosity mu "Fluid dynamic viscosity"; - ThermoSysPro.Units.SI.Temperature T "Fluid temperature"; - ThermoSysPro.Units.SI.AbsolutePressure Pm "Fluid average pressure"; - ThermoSysPro.Units.SI.SpecificEnthalpy h "Fluid specific enthalpy"; + Units.SI.PressureDifference deltaP "Pressure loss"; + Units.SI.MassFlowRate Q "Mass flow rate"; + Units.SI.ReynoldsNumber Re "Reynolds number"; + Units.SI.ReynoldsNumber Relim "Limit Reynolds number"; + Units.SI.Density rho "Fluid density"; + Units.SI.DynamicViscosity mu "Fluid dynamic viscosity"; + Units.SI.Temperature T "Fluid temperature"; + Units.SI.AbsolutePressure Pm "Fluid average pressure"; + Units.SI.SpecificEnthalpy h "Fluid specific enthalpy"; Medium.MassFraction X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Mass fractions"; Medium.ThermodynamicState state; @@ -72,12 +72,12 @@ equation /* Fluid thermodynamic properties */ Pm = (C1.P + C2.P)/2; - T = Medium.temperature_phX(p=Pm, h=h, X=X); + T = Medium.temperature(state); if (p_rho > 0) then rho = p_rho; else - rho = Medium.density_phX(p=Pm, h=h, X=X); + rho = Medium.density(state); end if; state=Medium.setState_phX(p=Pm, h=h, X=X); From 40176082eda3c83f5e7c79e08141f566aa422db5 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Fri, 20 Jun 2025 11:41:34 +0200 Subject: [PATCH 058/178] #125 Diaphragm reviewed, annotation --- ThermoSysPro/Fluid/PressureLosses/Diaphragm.mo | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ThermoSysPro/Fluid/PressureLosses/Diaphragm.mo b/ThermoSysPro/Fluid/PressureLosses/Diaphragm.mo index 1445aed5..da5f2eac 100644 --- a/ThermoSysPro/Fluid/PressureLosses/Diaphragm.mo +++ b/ThermoSysPro/Fluid/PressureLosses/Diaphragm.mo @@ -138,6 +138,5 @@ equation
    • Daniel Bouskela
    -"), - uses(ThermoSysPro(version="5.0"), Modelica(version="4.0.0"))); +")); end Diaphragm; From 523e3066fcfe86dfc2b2ec218cbcc9d021acfcbf Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Fri, 20 Jun 2025 11:48:23 +0200 Subject: [PATCH 059/178] #125 IdealCheckValve reviewed --- .../PressureLosses/TestIdealCheckValve.mo | 20 ++++++--------- .../TestIdealCheckValve_FlueGases.mo | 14 ++++------- .../TestIdealCheckValve_Traces.mo | 21 ++++++---------- .../PressureLosses/package.order | 2 +- .../Fluid/PressureLosses/IdealCheckValve.mo | 25 ++++++++----------- 5 files changed, 31 insertions(+), 51 deletions(-) diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestIdealCheckValve.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestIdealCheckValve.mo index 1d537646..3d97044e 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestIdealCheckValve.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestIdealCheckValve.mo @@ -1,19 +1,13 @@ -within ; +within ThermoSysPro.Fluid.Examples.SimpleExamples.PressureLosses; model TestIdealCheckValve extends ThermoSysPro.UsersGuide.Icons.Example; replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; - IdealCheckValve idealCheckValve( redeclare - replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package - Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare - replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.Fluid.PressureLosses.IdealCheckValve idealCheckValve(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); equation - connect(idealCheckValve.C2, sink.C) - annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); - connect(idealCheckValve.C1, sourcePQ.C) - annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); - annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), - uses(ThermoSysPro(version="5.0"))); + connect(idealCheckValve.C2, sink.C) annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(idealCheckValve.C1, sourcePQ.C) annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestIdealCheckValve; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestIdealCheckValve_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestIdealCheckValve_FlueGases.mo index b7d4d979..5a01613a 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestIdealCheckValve_FlueGases.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestIdealCheckValve_FlueGases.mo @@ -1,10 +1,9 @@ -within ; +within ThermoSysPro.Fluid.Examples.SimpleExamples.PressureLosses; model TestIdealCheckValve_FlueGases extends ThermoSysPro.UsersGuide.Icons.Example; replaceable package Medium = ThermoSysPro.Properties.Media.FlueGases; - IdealCheckValve idealCheckValve( redeclare - replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.PressureLosses.IdealCheckValve idealCheckValve(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); ThermoSysPro.Fluid.BoundaryConditions.Sink sink( redeclare replaceable package Medium = Medium, T0=573.15, @@ -15,10 +14,7 @@ model TestIdealCheckValve_FlueGases T0=573.15, option_temperature=true) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); equation - connect(idealCheckValve.C2, sink.C) - annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); - connect(idealCheckValve.C1, sourcePQ.C) - annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); - annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), - uses(ThermoSysPro(version="5.0"))); + connect(idealCheckValve.C2, sink.C) annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(idealCheckValve.C1, sourcePQ.C) annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestIdealCheckValve_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestIdealCheckValve_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestIdealCheckValve_Traces.mo index 62621af3..51cccd09 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestIdealCheckValve_Traces.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestIdealCheckValve_Traces.mo @@ -1,4 +1,4 @@ -within ; +within ThermoSysPro.Fluid.Examples.SimpleExamples.PressureLosses; model TestIdealCheckValve_Traces extends ThermoSysPro.UsersGuide.Icons.Example; @@ -6,18 +6,11 @@ model TestIdealCheckValve_Traces extraPropertiesNames={"Trace"}, C_nominal={0.1}, C_default={0.2}); - IdealCheckValve idealCheckValve( redeclare - replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package - Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare - replaceable package Medium = Medium, SubC0={0.3}) - annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.Fluid.PressureLosses.IdealCheckValve idealCheckValve(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare replaceable package Medium = Medium, SubC0={0.3}) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); equation - connect(idealCheckValve.C2, sink.C) - annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); - connect(idealCheckValve.C1, sourcePQ.C) - annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); - annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), - uses(ThermoSysPro(version="5.0"))); + connect(idealCheckValve.C2, sink.C) annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(idealCheckValve.C1, sourcePQ.C) annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestIdealCheckValve_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order index e3218bf8..7fae05e7 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order @@ -7,9 +7,9 @@ TestSingularPressureLoss_Traces_FlueGases TestControlValve TestControlValve_Traces TestControlValve_Traces_FlueGases +TestIdealCheckValve TestIdealCheckValve_FlueGases TestIdealCheckValve_Traces -TestIdealCheckValve TestDiaphragm TestDiaphragm_FlueGases TestDiaphragm_Traces diff --git a/ThermoSysPro/Fluid/PressureLosses/IdealCheckValve.mo b/ThermoSysPro/Fluid/PressureLosses/IdealCheckValve.mo index c8dccfb9..69c2af26 100644 --- a/ThermoSysPro/Fluid/PressureLosses/IdealCheckValve.mo +++ b/ThermoSysPro/Fluid/PressureLosses/IdealCheckValve.mo @@ -1,24 +1,25 @@ -within ; +within ThermoSysPro.Fluid.PressureLosses; model IdealCheckValve "Ideal check valve" - replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + extends ThermoSysPro.Fluid.Interfaces.IconColors; - parameter ThermoSysPro.Units.SI.PressureDifference dPOuvert=0.01 + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + + parameter Units.SI.PressureDifference dPOuvert=0.01 "Pressure difference when the valve opens"; - parameter ThermoSysPro.Units.SI.MassFlowRate Qmin=1.e-6 + parameter Units.SI.MassFlowRate Qmin=1.e-6 "Mass flow trhough the valve when the valve is closed"; - parameter ThermoSysPro.Units.SI.MassFlowRate gamma_diff=1e-4 + parameter Units.SI.MassFlowRate gamma_diff=1e-4 "Diffusion conductance (active if diffusion=true in neighbouring volumes)"; public Boolean ouvert(start=true, fixed=true) "Valve state"; discrete Boolean touvert(start=false, fixed=true); discrete Boolean tferme(start=false, fixed=true); - ThermoSysPro.Units.SI.MassFlowRate Q "Mass flow rate"; - ThermoSysPro.Units.SI.SpecificEnthalpy h(start=100000) + Units.SI.MassFlowRate Q "Mass flow rate"; + Units.SI.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy"; - ThermoSysPro.Units.SI.PressureDifference deltaP + Units.SI.PressureDifference deltaP "Pressure difference between the inlet and the outlet"; - Medium.MassFraction X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Mass fractions"; ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{90,-10},{110,10}}, rotation=0))); @@ -40,9 +41,6 @@ equation C1.Xi = C2.Xi; - X = C1.Xi; - - C1.SubC = C2.SubC; Q = C1.Q; @@ -113,6 +111,5 @@ equation
  • Daniel Bouskela
  • Baligh El Hefni
  • -"), - uses(ThermoSysPro(version="5.0"))); +")); end IdealCheckValve; From dc02c5f78b8db42ed9c660dc15f3ad3706ca1f73 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Fri, 20 Jun 2025 13:21:23 +0200 Subject: [PATCH 060/178] #125 DynamicReliefValve reviewed --- .../PressureLosses/TestDynamicReliefValve.mo | 27 +++---- .../TestDynamicReliefValve_FlueGases.mo | 19 ++--- .../TestDynamicReliefValve_Traces.mo | 27 +++---- .../PressureLosses/DynamicReliefValve.mo | 77 +++++++++---------- 4 files changed, 67 insertions(+), 83 deletions(-) diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDynamicReliefValve.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDynamicReliefValve.mo index e312d05f..8c9e763f 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDynamicReliefValve.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDynamicReliefValve.mo @@ -1,24 +1,19 @@ -within ; +within ThermoSysPro.Fluid.Examples.SimpleExamples.PressureLosses; model TestDynamicReliefValve extends ThermoSysPro.UsersGuide.Icons.Example; replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; - DynamicReliefValve dynamicReliefValve( - redeclare - replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10}, - {10,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package - Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare - replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10}, - {10,10}}, + ThermoSysPro.Fluid.PressureLosses.DynamicReliefValve dynamicReliefValve( + redeclare replaceable package Medium = Medium, + vh(start=0.91), + z(start=0.00389)) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare replaceable package Medium = Medium) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, rotation=90, origin={0,-40}))); equation - connect(dynamicReliefValve.C2, sink.C) - annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); - connect(dynamicReliefValve.C1, sourcePQ.C) annotation (Line(points={{0,-9.8}, - {0,-19.9},{5.55112e-16,-19.9},{5.55112e-16,-30}}, color={0,0,0})); - annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), - uses(ThermoSysPro(version="5.0"))); + connect(dynamicReliefValve.C2, sink.C) annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(dynamicReliefValve.C1, sourcePQ.C) annotation (Line(points={{0,-9.8},{0,-19.9},{5.55112e-16,-19.9},{5.55112e-16,-30}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestDynamicReliefValve; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDynamicReliefValve_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDynamicReliefValve_FlueGases.mo index 52c9fea9..da900f05 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDynamicReliefValve_FlueGases.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDynamicReliefValve_FlueGases.mo @@ -1,11 +1,9 @@ -within ; +within ThermoSysPro.Fluid.Examples.SimpleExamples.PressureLosses; model TestDynamicReliefValve_FlueGases extends ThermoSysPro.UsersGuide.Icons.Example; replaceable package Medium = ThermoSysPro.Properties.Media.FlueGases; - DynamicReliefValve dynamicReliefValve( - redeclare - replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.PressureLosses.DynamicReliefValve dynamicReliefValve(redeclare replaceable package Medium = Medium, vh(start=232)) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); ThermoSysPro.Fluid.BoundaryConditions.Sink sink( redeclare replaceable package Medium = Medium, T0=573.15, @@ -14,15 +12,12 @@ model TestDynamicReliefValve_FlueGases redeclare replaceable package Medium = Medium, P0=350000, T0=573.15, - option_temperature=true) annotation (Placement(transformation(extent={{-10,-10}, - {10,10}}, + option_temperature=true) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, rotation=90, origin={0,-40}))); equation - connect(dynamicReliefValve.C2, sink.C) - annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); - connect(dynamicReliefValve.C1, sourcePQ.C) annotation (Line(points={{0,-9.8}, - {4.44089e-16,-9.8},{4.44089e-16,-30}}, color={0,0,0})); - annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), - uses(ThermoSysPro(version="5.0"))); + connect(dynamicReliefValve.C2, sink.C) annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(dynamicReliefValve.C1, sourcePQ.C) annotation (Line(points={{0,-9.8},{4.44089e-16,-9.8},{4.44089e-16,-30}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestDynamicReliefValve_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDynamicReliefValve_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDynamicReliefValve_Traces.mo index a2f9410b..94c22056 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDynamicReliefValve_Traces.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDynamicReliefValve_Traces.mo @@ -1,4 +1,4 @@ -within ; +within ThermoSysPro.Fluid.Examples.SimpleExamples.PressureLosses; model TestDynamicReliefValve_Traces extends ThermoSysPro.UsersGuide.Icons.Example; @@ -6,22 +6,17 @@ model TestDynamicReliefValve_Traces extraPropertiesNames={"Trace"}, C_nominal={0.1}, C_default={0.2}); - DynamicReliefValve dynamicReliefValve( - redeclare - replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package - Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare - replaceable package Medium = Medium, SubC0={0.3}) - annotation (Placement(transformation(extent={{-10,-10}, - {10,10}}, + ThermoSysPro.Fluid.PressureLosses.DynamicReliefValve dynamicReliefValve( + redeclare replaceable package Medium = Medium, + vh(start=0.91), + z(start=0.00389)) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare replaceable package Medium = Medium, SubC0={0.3}) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, rotation=90, origin={0,-40}))); equation - connect(dynamicReliefValve.C2, sink.C) - annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); - connect(dynamicReliefValve.C1, sourcePQ.C) annotation (Line(points={{0,-9.8}, - {0,-19.9},{5.55112e-16,-19.9},{5.55112e-16,-30}}, color={0,0,0})); - annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), - uses(ThermoSysPro(version="5.0"))); + connect(dynamicReliefValve.C2, sink.C) annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(dynamicReliefValve.C1, sourcePQ.C) annotation (Line(points={{0,-9.8},{0,-19.9},{5.55112e-16,-19.9},{5.55112e-16,-30}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestDynamicReliefValve_Traces; diff --git a/ThermoSysPro/Fluid/PressureLosses/DynamicReliefValve.mo b/ThermoSysPro/Fluid/PressureLosses/DynamicReliefValve.mo index 5e4fd4e0..cac9ed40 100644 --- a/ThermoSysPro/Fluid/PressureLosses/DynamicReliefValve.mo +++ b/ThermoSysPro/Fluid/PressureLosses/DynamicReliefValve.mo @@ -1,22 +1,22 @@ -within ; +within ThermoSysPro.Fluid.PressureLosses; model DynamicReliefValve "Dynamic relief valve" - replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); - parameter ThermoSysPro.Units.SI.AbsolutePressure Popen=3e5 + parameter Units.SI.AbsolutePressure Popen=3e5 "Pressure that opens the valve"; - parameter ThermoSysPro.Units.SI.AbsolutePressure Pout=1e5 + parameter Units.SI.AbsolutePressure Pout=1e5 "Pressure at the valve outlet (for sizing)"; - parameter ThermoSysPro.Units.xSI.Cv Cvmax=8005.42 "Maximum Cv"; + parameter Units.xSI.Cv Cvmax=8005.42 "Maximum Cv"; parameter Real caract[:, 2]=[0, 0; 1, Cvmax] "Position vs. Cv characteristics (active if mode_caract=1)"; - parameter ThermoSysPro.Units.SI.Area A1=0.1 + parameter Units.SI.Area A1=0.1 "Hydraulic area upstream the clapper"; - parameter ThermoSysPro.Units.SI.Area A2=0.125 + parameter Units.SI.Area A2=0.125 "Hydraulic area downstream the clapper"; - parameter ThermoSysPro.Units.SI.Area clapper_area[:,2]=[0,A1; 0.01,A2; 1,A2] + parameter Units.SI.Area clapper_area[:,2]=[0,A1; 0.01,A2; 1,A2] "Clapper area as a function of the clapper elevation"; parameter Real D=1 "Damping"; - parameter ThermoSysPro.Units.SI.Mass m=1 "Valve mass"; - parameter ThermoSysPro.Units.SI.Length z_max=0.1 "Maximum clapper elevation"; + parameter Units.SI.Mass m=1 "Valve mass"; + parameter Units.SI.Length z_max=0.1 "Maximum clapper elevation"; parameter Real Ke=62500 "Valve spring stiffness"; parameter Real Cd=0 "Drag coefficient of the clapper"; parameter Integer mode_caract=0 @@ -24,49 +24,49 @@ model DynamicReliefValve "Dynamic relief valve" parameter Integer option_interpolation=1 "1: linear interpolation - 2: spline interpolation (active if mode_caract=1)" annotation(Evaluate=true, Dialog(enable=(mode_caract == 1))); parameter Boolean mech_steady_state=true "true: start from mechanical steady state - false: start from 0" annotation(Evaluate=true); - parameter ThermoSysPro.Units.SI.Length z0=0 + parameter Units.SI.Length z0=0 "Initial clapper elevation, between 0 and z_max. 0:valve closed - z_max: valve fully open (active if mech_steady_state=false)" annotation (Evaluate=true, Dialog(enable=not mech_steady_state)); - parameter ThermoSysPro.Units.SI.MassFlowRate gamma_diff=1e-4 + parameter Units.SI.MassFlowRate gamma_diff=1e-4 "Diffusion conductance (active if diffusion=true in neighbouring volumes)"; - parameter ThermoSysPro.Units.SI.Density p_rho=0 "If > 0, fixed fluid density" + parameter Units.SI.Density p_rho=0 "If > 0, fixed fluid density" annotation (Evaluate=true, Dialog(tab="Fluid", group="Fluid properties")); protected - constant ThermoSysPro.Units.SI.Acceleration g=Modelica.Constants.g_n + constant Units.SI.Acceleration g=Modelica.Constants.g_n "Gravity constant"; constant Real pi=Modelica.Constants.pi "pi"; - constant ThermoSysPro.Units.SI.Density rho60F=998.98 "Water density at 60°F"; + constant Units.SI.Density rho60F=998.98 "Water density at 60°F"; constant Real K=1.733e12 "Valve constant"; parameter Real eps=1.e-0 "Small number for pressure loss equation"; - parameter ThermoSysPro.Units.SI.Length z_min=0 "Minimum clapper elevation"; + parameter Units.SI.Length z_min=0 "Minimum clapper elevation"; public Boolean clapper_is_free(start=true) "true if clapper is free to move in both directions, false otherwise"; - ThermoSysPro.Units.SI.Force Fp "Gravity force"; - ThermoSysPro.Units.SI.Force Fr "Spring force"; - ThermoSysPro.Units.SI.Force Fd "Damping force"; - ThermoSysPro.Units.SI.Force Fh "Hydraulic force"; - ThermoSysPro.Units.SI.Force Fdyn "Dynamic pressure force"; - ThermoSysPro.Units.SI.Force Ft "Total force"; - ThermoSysPro.Units.SI.Length z(start=z_min) "Clapper elevation"; - ThermoSysPro.Units.SI.Velocity v=der(z) "Clapper velocity"; - ThermoSysPro.Units.SI.Acceleration a=der(v) "Clapper acceleration"; + Units.SI.Force Fp "Gravity force"; + Units.SI.Force Fr "Spring force"; + Units.SI.Force Fd "Damping force"; + Units.SI.Force Fh "Hydraulic force"; + Units.SI.Force Fdyn "Dynamic pressure force"; + Units.SI.Force Ft "Total force"; + Units.SI.Length z(start=z_min) "Clapper elevation"; + Units.SI.Velocity v=der(z) "Clapper velocity"; + Units.SI.Acceleration a=der(v) "Clapper acceleration"; Real Ouv "Valve position"; - ThermoSysPro.Units.SI.Area A "Hydraulic area upstream the clapper"; - ThermoSysPro.Units.SI.Force Fr_min "Spring force when valve is closed"; - ThermoSysPro.Units.xSI.Cv Cv "Cv"; - ThermoSysPro.Units.SI.MassFlowRate Q(start=500) "Mass flow rate"; - ThermoSysPro.Units.SI.PressureDifference deltaP "Singular pressure loss"; - ThermoSysPro.Units.SI.Density rho(start=998) "Fluid density"; - ThermoSysPro.Units.SI.Temperature T(start=290) "Fluid temperature"; - ThermoSysPro.Units.SI.AbsolutePressure Pm(start=1.e5) + Units.SI.Area A "Hydraulic area upstream the clapper"; + Units.SI.Force Fr_min "Spring force when valve is closed"; + Units.xSI.Cv Cv "Cv"; + Units.SI.MassFlowRate Q(start=500) "Mass flow rate"; + Units.SI.PressureDifference deltaP "Singular pressure loss"; + Units.SI.Density rho(start=998) "Fluid density"; + Units.SI.Temperature T(start=290) "Fluid temperature"; + Units.SI.AbsolutePressure Pm(start=1.e5) "Fluid average pressure"; - ThermoSysPro.Units.SI.SpecificEnthalpy h(start=100000) + Units.SI.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy"; - ThermoSysPro.Units.SI.AbsolutePressure Pdyn "Dynamic pressure on the clapper"; - ThermoSysPro.Units.SI.Velocity vh "Fluid velocity through the valve"; - ThermoSysPro.Units.SI.Energy Wdyn "Dissipated fluid kinetic energy"; + Units.SI.AbsolutePressure Pdyn "Dynamic pressure on the clapper"; + Units.SI.Velocity vh "Fluid velocity through the valve"; + Units.SI.Energy Wdyn "Dissipated fluid kinetic energy"; Real Re=rho*(vh - v)*sqrt(4*A/pi)/ThermoSysPro.Properties.WaterSteam.IF97.DynamicViscosity_rhoT(rho, T) "Clapper Reynolds"; Medium.MassFraction X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Mass fractions"; @@ -234,6 +234,5 @@ equation
    • Daniel Bouskela
    -"), - uses(ThermoSysPro(version="5.0"), Modelica(version="4.0.0"))); +")); end DynamicReliefValve; From 8a91b6f81628ab31ebe1f3198cc54d993d190467 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Fri, 20 Jun 2025 13:29:00 +0200 Subject: [PATCH 061/178] #125 SwitchValve reviewed --- .../PressureLosses/TestSwitchValve.mo | 27 ++++++----------- .../TestSwitchValve_FlueGases.mo | 21 +++++--------- .../PressureLosses/TestSwitchValve_Traces.mo | 28 ++++++------------ .../Fluid/PressureLosses/SwitchValve.mo | 29 ++++++++++--------- 4 files changed, 40 insertions(+), 65 deletions(-) diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestSwitchValve.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestSwitchValve.mo index ff63f24c..448ce7a7 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestSwitchValve.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestSwitchValve.mo @@ -1,24 +1,15 @@ -within ; +within ThermoSysPro.Fluid.Examples.SimpleExamples.PressureLosses; model TestSwitchValve extends ThermoSysPro.UsersGuide.Icons.Example; replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; - SwitchValve switchValve( redeclare - replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-4}, - {10,16}}))); - ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package - Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare - replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); - ThermoSysPro.InstrumentationAndControl.Blocks.Logique.Constante constante - annotation (Placement(transformation(extent={{-78,32},{-58,52}}))); + ThermoSysPro.Fluid.PressureLosses.SwitchValve switchValve(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-4},{10,16}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.InstrumentationAndControl.Blocks.Logique.Constante constante annotation (Placement(transformation(extent={{-78,32},{-58,52}}))); equation - connect(switchValve.C2, sink.C) - annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); - connect(switchValve.C1, sourcePQ.C) - annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); - connect(constante.yL, switchValve.Ouv) - annotation (Line(points={{-57,42},{0,42},{0,13.2}}, color={0,0,255})); - annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), - uses(ThermoSysPro(version="5.0"))); + connect(switchValve.C2, sink.C) annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(switchValve.C1, sourcePQ.C) annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); + connect(constante.yL, switchValve.Ouv) annotation (Line(points={{-57,42},{0,42},{0,13.2}}, color={0,0,255})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestSwitchValve; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestSwitchValve_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestSwitchValve_FlueGases.mo index e5ef26f4..16b7d843 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestSwitchValve_FlueGases.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestSwitchValve_FlueGases.mo @@ -1,11 +1,9 @@ -within ; +within ThermoSysPro.Fluid.Examples.SimpleExamples.PressureLosses; model TestSwitchValve_FlueGases extends ThermoSysPro.UsersGuide.Icons.Example; replaceable package Medium = ThermoSysPro.Properties.Media.FlueGases; - SwitchValve switchValve( redeclare - replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-4}, - {10,16}}))); + ThermoSysPro.Fluid.PressureLosses.SwitchValve switchValve(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-4},{10,16}}))); ThermoSysPro.Fluid.BoundaryConditions.Sink sink( redeclare replaceable package Medium = Medium, T0=573.15, @@ -15,15 +13,10 @@ model TestSwitchValve_FlueGases P0=4500000, T0=573.15, option_temperature=true) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); - ThermoSysPro.InstrumentationAndControl.Blocks.Logique.Constante constante - annotation (Placement(transformation(extent={{-42,30},{-22,50}}))); + ThermoSysPro.InstrumentationAndControl.Blocks.Logique.Constante constante annotation (Placement(transformation(extent={{-42,30},{-22,50}}))); equation - connect(switchValve.C2, sink.C) - annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); - connect(switchValve.C1, sourcePQ.C) - annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); - connect(constante.yL, switchValve.Ouv) - annotation (Line(points={{-21,40},{0,40},{0,13.2}}, color={0,0,255})); - annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), - uses(ThermoSysPro(version="5.0"))); + connect(switchValve.C2, sink.C) annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(switchValve.C1, sourcePQ.C) annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); + connect(constante.yL, switchValve.Ouv) annotation (Line(points={{-21,40},{0,40},{0,13.2}}, color={0,0,255})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestSwitchValve_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestSwitchValve_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestSwitchValve_Traces.mo index 964ac1b3..5238d3ce 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestSwitchValve_Traces.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestSwitchValve_Traces.mo @@ -1,4 +1,4 @@ -within ; +within ThermoSysPro.Fluid.Examples.SimpleExamples.PressureLosses; model TestSwitchValve_Traces extends ThermoSysPro.UsersGuide.Icons.Example; @@ -6,23 +6,13 @@ model TestSwitchValve_Traces extraPropertiesNames={"Trace"}, C_nominal={0.1}, C_default={0.2}); - SwitchValve switchValve( redeclare - replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-4}, - {10,16}}))); - ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package - Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare - replaceable package Medium = Medium, SubC0={0.3}) - annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); - ThermoSysPro.InstrumentationAndControl.Blocks.Logique.Constante constante - annotation (Placement(transformation(extent={{-40,30},{-20,50}}))); + ThermoSysPro.Fluid.PressureLosses.SwitchValve switchValve(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-4},{10,16}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare replaceable package Medium = Medium, SubC0={0.3}) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.InstrumentationAndControl.Blocks.Logique.Constante constante annotation (Placement(transformation(extent={{-40,30},{-20,50}}))); equation - connect(switchValve.C2, sink.C) - annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); - connect(switchValve.C1, sourcePQ.C) - annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); - connect(constante.yL, switchValve.Ouv) - annotation (Line(points={{-19,40},{0,40},{0,13.2}}, color={0,0,255})); - annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), - uses(ThermoSysPro(version="5.0"))); + connect(switchValve.C2, sink.C) annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(switchValve.C1, sourcePQ.C) annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); + connect(constante.yL, switchValve.Ouv) annotation (Line(points={{-19,40},{0,40},{0,13.2}}, color={0,0,255})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestSwitchValve_Traces; diff --git a/ThermoSysPro/Fluid/PressureLosses/SwitchValve.mo b/ThermoSysPro/Fluid/PressureLosses/SwitchValve.mo index df541f53..e4cdd416 100644 --- a/ThermoSysPro/Fluid/PressureLosses/SwitchValve.mo +++ b/ThermoSysPro/Fluid/PressureLosses/SwitchValve.mo @@ -1,27 +1,29 @@ -within ; +within ThermoSysPro.Fluid.PressureLosses; model SwitchValve "Switch valve" - replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + extends ThermoSysPro.Fluid.Interfaces.IconColors; - parameter ThermoSysPro.Units.xSI.PressureLossCoefficient k=1000 + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + + parameter Units.xSI.PressureLossCoefficient k=1000 "Pressure loss coefficient"; - parameter ThermoSysPro.Units.SI.MassFlowRate Qmin=1.e-6 + parameter Units.SI.MassFlowRate Qmin=1.e-6 "Mass flow when the valve is closed"; - parameter ThermoSysPro.Units.SI.MassFlowRate gamma_diff=1e-4 + parameter Units.SI.MassFlowRate gamma_diff=1e-4 "Diffusion conductance (active if diffusion=true in neighbouring volumes)"; - parameter ThermoSysPro.Units.SI.Density p_rho=0 "If > 0, fixed fluid density" + parameter Units.SI.Density p_rho=0 "If > 0, fixed fluid density" annotation (Evaluate=true, Dialog(tab="Fluid", group="Fluid properties")); protected parameter Real eps=1.e-3 "Small number for pressure loss equation"; public - ThermoSysPro.Units.SI.MassFlowRate Q(start=100) "Mass flow rate"; - ThermoSysPro.Units.SI.PressureDifference deltaP "Singular pressure loss"; - ThermoSysPro.Units.SI.Density rho(start=998) "Fluid density"; - ThermoSysPro.Units.SI.Temperature T(start=290) "Fluid temperature"; - ThermoSysPro.Units.SI.AbsolutePressure Pm(start=1.e5) + Units.SI.MassFlowRate Q(start=100) "Mass flow rate"; + Units.SI.PressureDifference deltaP "Singular pressure loss"; + Units.SI.Density rho(start=998) "Fluid density"; + Units.SI.Temperature T(start=290) "Fluid temperature"; + Units.SI.AbsolutePressure Pm(start=1.e5) "Fluid average pressure"; - ThermoSysPro.Units.SI.SpecificEnthalpy h(start=100000) + Units.SI.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy"; Medium.MassFraction X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Mass fractions"; @@ -134,6 +136,5 @@ equation
    • Daniel Bouskela
    -"), - uses(ThermoSysPro(version="5.0"))); +")); end SwitchValve; From 053e17bcbf729641d5fd463f725db3b92ff4d75c Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Fri, 20 Jun 2025 13:55:06 +0200 Subject: [PATCH 062/178] #125 IdealSwitchValve reviewed --- .../PressureLosses/TestIdealSwitchValve.mo | 27 ++++++------------ .../TestIdealSwitchValve_FlueGases.mo | 21 +++++--------- .../TestIdealSwitchValve_Traces.mo | 28 ++++++------------- .../Fluid/PressureLosses/IdealSwitchValve.mo | 20 ++++++------- 4 files changed, 35 insertions(+), 61 deletions(-) diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestIdealSwitchValve.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestIdealSwitchValve.mo index 10539b7b..90644316 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestIdealSwitchValve.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestIdealSwitchValve.mo @@ -1,24 +1,15 @@ -within ; +within ThermoSysPro.Fluid.Examples.SimpleExamples.PressureLosses; model TestIdealSwitchValve extends ThermoSysPro.UsersGuide.Icons.Example; replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; - IdealSwitchValve idealSwitchValve(redeclare - replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-4}, - {10,16}}))); - ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package - Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare - replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); - ThermoSysPro.InstrumentationAndControl.Blocks.Logique.Constante constante - annotation (Placement(transformation(extent={{-40,30},{-20,50}}))); + ThermoSysPro.Fluid.PressureLosses.IdealSwitchValve idealSwitchValve(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-4},{10,16}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.InstrumentationAndControl.Blocks.Logique.Constante constante annotation (Placement(transformation(extent={{-40,30},{-20,50}}))); equation - connect(idealSwitchValve.C2, sink.C) - annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); - connect(idealSwitchValve.C1, sourcePQ.C) - annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); - connect(constante.yL, idealSwitchValve.Ouv) - annotation (Line(points={{-19,40},{0,40},{0,13}}, color={0,0,255})); - annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), - uses(ThermoSysPro(version="5.0"))); + connect(idealSwitchValve.C2, sink.C) annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(idealSwitchValve.C1, sourcePQ.C) annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); + connect(constante.yL, idealSwitchValve.Ouv) annotation (Line(points={{-19,40},{0,40},{0,13}}, color={0,0,255})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestIdealSwitchValve; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestIdealSwitchValve_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestIdealSwitchValve_FlueGases.mo index 1a20b88d..f722152a 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestIdealSwitchValve_FlueGases.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestIdealSwitchValve_FlueGases.mo @@ -1,11 +1,9 @@ -within ; +within ThermoSysPro.Fluid.Examples.SimpleExamples.PressureLosses; model TestIdealSwitchValve_FlueGases extends ThermoSysPro.UsersGuide.Icons.Example; replaceable package Medium = ThermoSysPro.Properties.Media.FlueGases; - IdealSwitchValve idealSwitchValve(redeclare - replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-4}, - {10,16}}))); + ThermoSysPro.Fluid.PressureLosses.IdealSwitchValve idealSwitchValve(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-4},{10,16}}))); ThermoSysPro.Fluid.BoundaryConditions.Sink sink( redeclare replaceable package Medium = Medium, T0=573.15, @@ -15,15 +13,10 @@ model TestIdealSwitchValve_FlueGases P0=4500000, T0=573.15, option_temperature=true) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); - ThermoSysPro.InstrumentationAndControl.Blocks.Logique.Constante constante - annotation (Placement(transformation(extent={{-40,30},{-20,50}}))); + ThermoSysPro.InstrumentationAndControl.Blocks.Logique.Constante constante annotation (Placement(transformation(extent={{-40,30},{-20,50}}))); equation - connect(idealSwitchValve.C2, sink.C) - annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); - connect(idealSwitchValve.C1, sourcePQ.C) - annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); - connect(constante.yL, idealSwitchValve.Ouv) - annotation (Line(points={{-19,40},{0,40},{0,13}}, color={0,0,255})); - annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), - uses(ThermoSysPro(version="5.0"))); + connect(idealSwitchValve.C2, sink.C) annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(idealSwitchValve.C1, sourcePQ.C) annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); + connect(constante.yL, idealSwitchValve.Ouv) annotation (Line(points={{-19,40},{0,40},{0,13}}, color={0,0,255})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestIdealSwitchValve_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestIdealSwitchValve_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestIdealSwitchValve_Traces.mo index bf8f48b6..a9e66005 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestIdealSwitchValve_Traces.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestIdealSwitchValve_Traces.mo @@ -1,4 +1,4 @@ -within ; +within ThermoSysPro.Fluid.Examples.SimpleExamples.PressureLosses; model TestIdealSwitchValve_Traces extends ThermoSysPro.UsersGuide.Icons.Example; @@ -6,23 +6,13 @@ model TestIdealSwitchValve_Traces extraPropertiesNames={"Trace"}, C_nominal={0.1}, C_default={0.2}); - IdealSwitchValve idealSwitchValve(redeclare - replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-4}, - {10,16}}))); - ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package - Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare - replaceable package Medium = Medium, SubC0={0.3}) - annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); - ThermoSysPro.InstrumentationAndControl.Blocks.Logique.Constante constante - annotation (Placement(transformation(extent={{-40,30},{-20,50}}))); + ThermoSysPro.Fluid.PressureLosses.IdealSwitchValve idealSwitchValve(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-4},{10,16}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare replaceable package Medium = Medium, SubC0={0.3}) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.InstrumentationAndControl.Blocks.Logique.Constante constante annotation (Placement(transformation(extent={{-40,30},{-20,50}}))); equation - connect(idealSwitchValve.C2, sink.C) - annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); - connect(idealSwitchValve.C1, sourcePQ.C) - annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); - connect(constante.yL, idealSwitchValve.Ouv) - annotation (Line(points={{-19,40},{0,40},{0,13}}, color={0,0,255})); - annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), - uses(ThermoSysPro(version="5.0"))); + connect(idealSwitchValve.C2, sink.C) annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(idealSwitchValve.C1, sourcePQ.C) annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); + connect(constante.yL, idealSwitchValve.Ouv) annotation (Line(points={{-19,40},{0,40},{0,13}}, color={0,0,255})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestIdealSwitchValve_Traces; diff --git a/ThermoSysPro/Fluid/PressureLosses/IdealSwitchValve.mo b/ThermoSysPro/Fluid/PressureLosses/IdealSwitchValve.mo index cc91b89c..935044d8 100644 --- a/ThermoSysPro/Fluid/PressureLosses/IdealSwitchValve.mo +++ b/ThermoSysPro/Fluid/PressureLosses/IdealSwitchValve.mo @@ -1,17 +1,19 @@ -within ; +within ThermoSysPro.Fluid.PressureLosses; model IdealSwitchValve "Ideal switch valve" - replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + extends ThermoSysPro.Fluid.Interfaces.IconColors; - parameter ThermoSysPro.Units.SI.MassFlowRate Qmin=1.e-6 + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + + parameter Units.SI.MassFlowRate Qmin=1.e-6 "Mass flow when the valve is closed"; - parameter ThermoSysPro.Units.SI.MassFlowRate gamma_diff=1e-4 + parameter Units.SI.MassFlowRate gamma_diff=1e-4 "Diffusion conductance (active if diffusion=true in neighbouring volumes)"; public - ThermoSysPro.Units.SI.MassFlowRate Q "Mass flow rate"; - ThermoSysPro.Units.SI.SpecificEnthalpy h(start=100000) + Units.SI.MassFlowRate Q "Mass flow rate"; + Units.SI.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy"; - ThermoSysPro.Units.SI.PressureDifference deltaP + Units.SI.PressureDifference deltaP "Pressure difference between the inlet and the outlet"; Medium.MassFraction X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Mass fractions"; public @@ -43,7 +45,6 @@ equation X = C1.Xi; - C1.SubC = C2.SubC; Q = C1.Q; @@ -113,6 +114,5 @@ equation
    • Daniel Bouskela
    -"), - uses(ThermoSysPro(version="5.0"))); +")); end IdealSwitchValve; From 6ab1bb299f9ae7cc9a444a9064b1fe1448b2a37c Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Fri, 20 Jun 2025 14:01:21 +0200 Subject: [PATCH 063/178] #125 DynamicCheckValve reviewed --- .../PressureLosses/TestDynamicCheckValve.mo | 21 +++---- .../TestDynamicCheckValve_FlueGases.mo | 15 ++--- .../TestDynamicCheckValve_Traces.mo | 22 +++---- .../Fluid/PressureLosses/DynamicCheckValve.mo | 58 +++++++++---------- 4 files changed, 47 insertions(+), 69 deletions(-) diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDynamicCheckValve.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDynamicCheckValve.mo index 9ae856f0..03404bbb 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDynamicCheckValve.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDynamicCheckValve.mo @@ -1,20 +1,13 @@ -within ; +within ThermoSysPro.Fluid.Examples.SimpleExamples.PressureLosses; model TestDynamicCheckValve extends ThermoSysPro.UsersGuide.Icons.Example; replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; - DynamicCheckValve dynamicCheckValve( - redeclare - replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package - Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare - replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.Fluid.PressureLosses.DynamicCheckValve dynamicCheckValve(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); equation - connect(dynamicCheckValve.C2, sink.C) - annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); - connect(dynamicCheckValve.C1, sourcePQ.C) - annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); - annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), - uses(ThermoSysPro(version="5.0"))); + connect(dynamicCheckValve.C2, sink.C) annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(dynamicCheckValve.C1, sourcePQ.C) annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestDynamicCheckValve; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDynamicCheckValve_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDynamicCheckValve_FlueGases.mo index 969a2303..3e1b001a 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDynamicCheckValve_FlueGases.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDynamicCheckValve_FlueGases.mo @@ -1,11 +1,9 @@ -within ; +within ThermoSysPro.Fluid.Examples.SimpleExamples.PressureLosses; model TestDynamicCheckValve_FlueGases extends ThermoSysPro.UsersGuide.Icons.Example; replaceable package Medium = ThermoSysPro.Properties.Media.FlueGases; - DynamicCheckValve dynamicCheckValve( - redeclare - replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.PressureLosses.DynamicCheckValve dynamicCheckValve(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); ThermoSysPro.Fluid.BoundaryConditions.Sink sink( redeclare replaceable package Medium = Medium, T0=573.15, @@ -16,10 +14,7 @@ model TestDynamicCheckValve_FlueGases T0=573.15, option_temperature=true) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); equation - connect(dynamicCheckValve.C2, sink.C) - annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); - connect(dynamicCheckValve.C1, sourcePQ.C) - annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); - annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), - uses(ThermoSysPro(version="5.0"))); + connect(dynamicCheckValve.C2, sink.C) annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(dynamicCheckValve.C1, sourcePQ.C) annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestDynamicCheckValve_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDynamicCheckValve_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDynamicCheckValve_Traces.mo index e004f96b..ea171e73 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDynamicCheckValve_Traces.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestDynamicCheckValve_Traces.mo @@ -1,4 +1,4 @@ -within ; +within ThermoSysPro.Fluid.Examples.SimpleExamples.PressureLosses; model TestDynamicCheckValve_Traces extends ThermoSysPro.UsersGuide.Icons.Example; @@ -6,19 +6,11 @@ model TestDynamicCheckValve_Traces extraPropertiesNames={"Trace"}, C_nominal={0.1}, C_default={0.2}); - DynamicCheckValve dynamicCheckValve( - redeclare - replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package - Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare - replaceable package Medium = Medium, SubC0={0.3}) - annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.Fluid.PressureLosses.DynamicCheckValve dynamicCheckValve(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare replaceable package Medium = Medium, SubC0={0.3}) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); equation - connect(dynamicCheckValve.C2, sink.C) - annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); - connect(dynamicCheckValve.C1, sourcePQ.C) - annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); - annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), - uses(ThermoSysPro(version="5.0"))); + connect(dynamicCheckValve.C2, sink.C) annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(dynamicCheckValve.C1, sourcePQ.C) annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestDynamicCheckValve_Traces; diff --git a/ThermoSysPro/Fluid/PressureLosses/DynamicCheckValve.mo b/ThermoSysPro/Fluid/PressureLosses/DynamicCheckValve.mo index 8bfa927e..5be3ade9 100644 --- a/ThermoSysPro/Fluid/PressureLosses/DynamicCheckValve.mo +++ b/ThermoSysPro/Fluid/PressureLosses/DynamicCheckValve.mo @@ -1,56 +1,56 @@ -within ; +within ThermoSysPro.Fluid.PressureLosses; model DynamicCheckValve "Dynamic check valve" - replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); - parameter ThermoSysPro.Units.xSI.Cv Cvmax=8005.42 "Maximum CV"; + parameter Units.xSI.Cv Cvmax=8005.42 "Maximum CV"; parameter Real caract[:, 2]=[0, 0; 1, Cvmax] "Position vs. Cv characteristics (active if mode_caract=1)"; - parameter ThermoSysPro.Units.SI.MomentOfInertia J=1 "Flap moment of inertia"; + parameter Units.SI.MomentOfInertia J=1 "Flap moment of inertia"; parameter Real Kf1=0 "Flap friction law coefficient #1"; parameter Real Kf2=100 "Flap friction law coefficient #2"; parameter Real n=5 "Flap friction law exponent"; - parameter ThermoSysPro.Units.SI.Mass m=1 "Flap mass"; - parameter ThermoSysPro.Units.SI.Area A=1 "Flap hydraulic area"; + parameter Units.SI.Mass m=1 "Flap mass"; + parameter Units.SI.Area A=1 "Flap hydraulic area"; parameter Integer mode_caract=0 "0:linear characteristics - 1:characteristics is given by caract[]" annotation(Evaluate=true); parameter Integer option_interpolation=1 "1: linear interpolation - 2: spline interpolation (active if mode_caract=1)" annotation(Evaluate=true, Dialog(enable=(mode_caract == 1))); parameter Boolean mech_steady_state=true "true: start from mechanical steady state - false: start from 0"; parameter Real Ouv0=0 "Initial valve position, between 0 and 1. 0:valve closed - 1: valve open (active if mech_steady_state=false)" annotation(Evaluate=true, Dialog(enable=not mech_steady_state)); - parameter ThermoSysPro.Units.SI.MassFlowRate gamma_diff=1e-4 + parameter Units.SI.MassFlowRate gamma_diff=1e-4 "Diffusion conductance (active if diffusion=true in neighbouring volumes)"; - parameter ThermoSysPro.Units.SI.Density p_rho=0 "If > 0, fixed fluid density" + parameter Units.SI.Density p_rho=0 "If > 0, fixed fluid density" annotation (Evaluate=true, Dialog(tab="Fluid", group="Fluid properties")); protected constant Real pi=Modelica.Constants.pi "pi"; - parameter ThermoSysPro.Units.SI.Acceleration g=Modelica.Constants.g_n + parameter Units.SI.Acceleration g=Modelica.Constants.g_n "Gravity constant"; parameter Real eps=1.e-3 "Small number for pressure loss equation"; - parameter ThermoSysPro.Units.SI.Radius r=sqrt(A/pi) "Flap radius"; - parameter ThermoSysPro.Units.SI.Angle theta_min=0 + parameter Units.SI.Radius r=sqrt(A/pi) "Flap radius"; + parameter Units.SI.Angle theta_min=0 "Minimum flap aperture angle"; - parameter ThermoSysPro.Units.SI.Angle theta_max=pi/2 + parameter Units.SI.Angle theta_max=pi/2 "Maximum flap aperture angle"; - parameter ThermoSysPro.Units.SI.Angle theta_m=(theta_min + theta_max)/2; + parameter Units.SI.Angle theta_m=(theta_min + theta_max)/2; public Boolean libre(start=true) "Indicator whether the flap is free to move in both directions"; - ThermoSysPro.Units.SI.Torque Cp "Gravity torque"; - ThermoSysPro.Units.SI.Torque Cf "Friction torque"; - ThermoSysPro.Units.SI.Torque Ch "Hydraulic torque"; - ThermoSysPro.Units.SI.Torque Ct "Total torque"; - ThermoSysPro.Units.SI.Angle theta(start=theta_m) "Flap aperture angle"; - ThermoSysPro.Units.SI.AngularVelocity omega "Flap angular speed"; - ThermoSysPro.Units.SI.AngularAcceleration a "Flap angular acceleration"; + Units.SI.Torque Cp "Gravity torque"; + Units.SI.Torque Cf "Friction torque"; + Units.SI.Torque Ch "Hydraulic torque"; + Units.SI.Torque Ct "Total torque"; + Units.SI.Angle theta(start=theta_m) "Flap aperture angle"; + Units.SI.AngularVelocity omega "Flap angular speed"; + Units.SI.AngularAcceleration a "Flap angular acceleration"; Real Ouv "Valve position"; - ThermoSysPro.Units.xSI.Cv Cv(start=Cvmax) "Cv"; - ThermoSysPro.Units.SI.MassFlowRate Q(start=500) "Mass flow rate"; - ThermoSysPro.Units.SI.PressureDifference deltaP "Singular pressure loss"; - ThermoSysPro.Units.SI.Density rho(start=998) "Fluid density"; - ThermoSysPro.Units.SI.Temperature T(start=290) "Fluid temperature"; - ThermoSysPro.Units.SI.AbsolutePressure Pm(start=1.e5) + Units.xSI.Cv Cv(start=Cvmax) "Cv"; + Units.SI.MassFlowRate Q(start=500) "Mass flow rate"; + Units.SI.PressureDifference deltaP "Singular pressure loss"; + Units.SI.Density rho(start=998) "Fluid density"; + Units.SI.Temperature T(start=290) "Fluid temperature"; + Units.SI.AbsolutePressure Pm(start=1.e5) "Fluid average pressrue"; - ThermoSysPro.Units.SI.SpecificEnthalpy h(start=100000) + Units.SI.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy"; Medium.MassFraction X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Mass fractions"; @@ -87,7 +87,6 @@ equation X = C1.Xi; - C1.SubC = C2.SubC; Q = C1.Q; @@ -198,6 +197,5 @@ equation
    • Daniel Bouskela
    -"), - uses(ThermoSysPro(version="5.0"), Modelica(version="4.0.0"))); +")); end DynamicCheckValve; From ab78acb66b43c374c20db5eca4666a35992f4f31 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Fri, 20 Jun 2025 14:09:09 +0200 Subject: [PATCH 064/178] #125 CheckValve reviewed --- .../PressureLosses/TestCheckValve.mo | 22 ++++++----------- .../TestCheckValve_FlueGases.mo | 13 ++++------ .../PressureLosses/TestCheckValve_Traces.mo | 24 ++++++------------- .../Fluid/PressureLosses/CheckValve.mo | 7 +++--- 4 files changed, 22 insertions(+), 44 deletions(-) diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestCheckValve.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestCheckValve.mo index 86242b26..84c3160b 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestCheckValve.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestCheckValve.mo @@ -3,22 +3,14 @@ model TestCheckValve extends ThermoSysPro.UsersGuide.Icons.Example; replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; - ThermoSysPro.Fluid.PressureLosses.CheckValve checkValve( - redeclare replaceable package Medium = Medium) - annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package - Medium = Medium) - annotation (Placement(transformation(extent={{-10,-10},{10,10}}, + ThermoSysPro.Fluid.PressureLosses.CheckValve checkValve(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package Medium = Medium) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, rotation=0, origin={40,0}))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare - replaceable package Medium = Medium) - annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); equation - connect(checkValve.C2, sink.C) - annotation (Line(points={{11,0},{30,0}}, color={0,0,0})); - connect(checkValve.C1, sourcePQ.C) - annotation (Line(points={{-11,0},{-30,0}}, color={0,0,0})); - annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( - coordinateSystem(preserveAspectRatio=false))); + connect(checkValve.C2, sink.C) annotation (Line(points={{11,0},{30,0}}, color={0,0,0})); + connect(checkValve.C1, sourcePQ.C) annotation (Line(points={{-11,0},{-30,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestCheckValve; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestCheckValve_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestCheckValve_FlueGases.mo index 0058fa76..ee165db7 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestCheckValve_FlueGases.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestCheckValve_FlueGases.mo @@ -3,13 +3,12 @@ model TestCheckValve_FlueGases extends ThermoSysPro.UsersGuide.Icons.Example; replaceable package Medium = ThermoSysPro.Properties.Media.FlueGases; - ThermoSysPro.Fluid.PressureLosses.CheckValve checkValve( redeclare - replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.PressureLosses.CheckValve checkValve(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); ThermoSysPro.Fluid.BoundaryConditions.Sink sink( redeclare replaceable package Medium = Medium, T0=573.15, - option_temperature=true) annotation (Placement(transformation(extent={{-10,-10}, - {10,10}}, + option_temperature=true) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, rotation=0, origin={40,0}))); ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ( @@ -18,9 +17,7 @@ model TestCheckValve_FlueGases T0=573.15, option_temperature=true) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); equation - connect(checkValve.C2, sink.C) - annotation (Line(points={{11,0},{30,0}}, color={0,0,0})); - connect(checkValve.C1, sourcePQ.C) - annotation (Line(points={{-11,0},{-30,0}}, color={0,0,0})); + connect(checkValve.C2, sink.C) annotation (Line(points={{11,0},{30,0}}, color={0,0,0})); + connect(checkValve.C1, sourcePQ.C) annotation (Line(points={{-11,0},{-30,0}}, color={0,0,0})); annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestCheckValve_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestCheckValve_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestCheckValve_Traces.mo index 03db4bd5..0c99f89c 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestCheckValve_Traces.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestCheckValve_Traces.mo @@ -6,24 +6,14 @@ model TestCheckValve_Traces extraPropertiesNames={"Trace1"}, C_nominal={0.1}, C_default={0.2}); - ThermoSysPro.Fluid.PressureLosses.CheckValve checkValve( - redeclare - replaceable package Medium = - Medium) - annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package - Medium = Medium) - annotation (Placement(transformation(extent={{-10,-10},{10,10}}, + ThermoSysPro.Fluid.PressureLosses.CheckValve checkValve(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package Medium = Medium) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, rotation=0, origin={40,0}))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare - replaceable package Medium = Medium, SubC0={0.3}) - annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare replaceable package Medium = Medium, SubC0={0.3}) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); equation - connect(checkValve.C2, sink.C) - annotation (Line(points={{11,0},{30,0}}, color={0,0,0})); - connect(checkValve.C1, sourcePQ.C) - annotation (Line(points={{-11,0},{-30,0}}, color={0,0,0})); - annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( - coordinateSystem(preserveAspectRatio=false))); + connect(checkValve.C2, sink.C) annotation (Line(points={{11,0},{30,0}}, color={0,0,0})); + connect(checkValve.C1, sourcePQ.C) annotation (Line(points={{-11,0},{-30,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestCheckValve_Traces; diff --git a/ThermoSysPro/Fluid/PressureLosses/CheckValve.mo b/ThermoSysPro/Fluid/PressureLosses/CheckValve.mo index 49640464..8c04953c 100644 --- a/ThermoSysPro/Fluid/PressureLosses/CheckValve.mo +++ b/ThermoSysPro/Fluid/PressureLosses/CheckValve.mo @@ -1,5 +1,7 @@ within ThermoSysPro.Fluid.PressureLosses; model CheckValve "Check valve" + extends ThermoSysPro.Fluid.Interfaces.IconColors; + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Units.SI.PressureDifference dPOuvert=10 @@ -32,7 +34,6 @@ public "Fluid specific enthalpy"; Medium.MassFraction X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Mass fractions"; - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-120,-10},{-100,10}}, rotation=0))); ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2(redeclare package Medium = Medium) annotation (Placement( @@ -55,7 +56,6 @@ equation X = C1.Xi; - C1.SubC = C2.SubC; Q = C1.Q; @@ -132,6 +132,5 @@ equation
    • Daniel Bouskela
    -"), - DymolaStoredErrors); +")); end CheckValve; From b9af0181cfcfbaa4186ae0084f6e1bd1d4c328b8 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Fri, 20 Jun 2025 14:17:27 +0200 Subject: [PATCH 065/178] #125 VolumeI reviewed --- .../SimpleExamples/Volumes/TestVolumeI.mo | 21 ++++-------- .../Volumes/TestVolumeI_FlueGases.mo | 32 ++++++++----------- .../Volumes/TestVolumeI_Traces.mo | 31 +++++++----------- ThermoSysPro/Fluid/Volumes/VolumeI.mo | 26 +++++---------- 4 files changed, 40 insertions(+), 70 deletions(-) diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeI.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeI.mo index 36c1c6c2..4ffc4874 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeI.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeI.mo @@ -3,22 +3,13 @@ model TestVolumeI extends ThermoSysPro.UsersGuide.Icons.Example; replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; - ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package - Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); ThermoSysPro.Fluid.Volumes.VolumeI volumeI(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ( - redeclare replaceable - package Medium = Medium) annotation (Placement(transformation(extent={{-52,-10}, - {-32,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare replaceable - package Medium = Medium) annotation (Placement(transformation(extent={{-50,10}, - {-30,30}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-52,-10},{-32,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-50,10},{-30,30}}))); equation - connect(volumeI.Cs3, sink.C) - annotation (Line(points={{10,-8},{20,-8},{20,0},{30,0}}, color={0,0,0})); - connect(sourcePQ.C, volumeI.Ce2) - annotation (Line(points={{-32,0},{-10,0}}, color={0,0,0})); - connect(sourceQ.C, volumeI.Ce1) - annotation (Line(points={{-30,20},{-10,20},{-10,8}}, color={0,0,0})); + connect(volumeI.Cs3, sink.C) annotation (Line(points={{10,-8},{20,-8},{20,0},{30,0}}, color={0,0,0})); + connect(sourcePQ.C, volumeI.Ce2) annotation (Line(points={{-32,0},{-10,0}}, color={0,0,0})); + connect(sourceQ.C, volumeI.Ce1) annotation (Line(points={{-30,20},{-10,20},{-10,8}}, color={0,0,0})); annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestVolumeI; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeI_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeI_FlueGases.mo index e27d1d74..b8b11661 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeI_FlueGases.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeI_FlueGases.mo @@ -3,30 +3,26 @@ model TestVolumeI_FlueGases extends ThermoSysPro.UsersGuide.Icons.Example; replaceable package Medium = ThermoSysPro.Properties.Media.FlueGases; - ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package - Medium = Medium, + ThermoSysPro.Fluid.BoundaryConditions.Sink sink( + redeclare replaceable package Medium = Medium, T0=573.15, - option_temperature=true) annotation (Placement(transformation(extent={{26,-18}, - {46,2}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare - replaceable package Medium = Medium, + option_temperature=true) annotation (Placement(transformation(extent={{26,-18},{46,2}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ( + redeclare replaceable package Medium = Medium, P0=4500000, T0=573.15, - option_temperature=true) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); - ThermoSysPro.Fluid.Volumes.VolumeI volumeI(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare replaceable - package Medium = Medium, + option_temperature=true) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.Fluid.Volumes.VolumeI volumeI(redeclare package Medium = Medium, h(start=2.83057e6)) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ( + redeclare replaceable package Medium = Medium, T0=573.15, - option_temperature=true) annotation (Placement(transformation(extent={{-10,-10}, - {10,10}}, + option_temperature=true) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, rotation=0, origin={-40,20}))); equation - connect(sourcePQ.C, volumeI.Ce2) - annotation (Line(points={{-30,0},{-10,0}}, color={0,0,0})); - connect(sourceQ.C, volumeI.Ce1) - annotation (Line(points={{-30,20},{-10,20},{-10,8}}, color={0,0,0})); - connect(volumeI.Cs3, sink.C) - annotation (Line(points={{10,-8},{26,-8}}, color={0,0,0})); + connect(sourcePQ.C, volumeI.Ce2) annotation (Line(points={{-30,0},{-10,0}}, color={0,0,0})); + connect(sourceQ.C, volumeI.Ce1) annotation (Line(points={{-30,20},{-10,20},{-10,8}}, color={0,0,0})); + connect(volumeI.Cs3, sink.C) annotation (Line(points={{10,-8},{26,-8}}, color={0,0,0})); annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestVolumeI_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeI_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeI_Traces.mo index b2402807..3ee353d0 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeI_Traces.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeI_Traces.mo @@ -6,29 +6,22 @@ model TestVolumeI_Traces extraPropertiesNames={"Trace"}, C_nominal={0.1}, C_default={0.2}); - ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package - Medium = Medium) annotation (Placement(transformation(extent={{20,20}, - {40,40}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare - replaceable package Medium = Medium, + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{20,20},{40,40}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ( + redeclare replaceable package Medium = Medium, Q0=100, - SubC0={0.5}) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); - ThermoSysPro.Fluid.Volumes.VolumeI volumeI(redeclare package Medium = Medium, + SubC0={0.5}) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.Fluid.Volumes.VolumeI volumeI( + redeclare package Medium = Medium, V=1, - dynamic_mass_balance=false) annotation (Placement(transformation(extent={{-12,-10}, - {8,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ( + dynamic_mass_balance=false) annotation (Placement(transformation(extent={{-12,-10},{8,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ( redeclare replaceable package Medium = Medium, Q0=100, - SubC0={0.5}) annotation (Placement(transformation(extent={{-56,18}, - {-36,38}}))); + SubC0={0.5}) annotation (Placement(transformation(extent={{-56,18},{-36,38}}))); equation - connect(volumeI.Cs1, sink.C) - annotation (Line(points={{8,8},{8,30},{20,30}}, - color={0,0,0})); - connect(sourcePQ.C, volumeI.Ce2) - annotation (Line(points={{-30,0},{-12,0}}, color={0,0,0})); - connect(sourceQ.C, volumeI.Ce1) - annotation (Line(points={{-36,28},{-12,28},{-12,8}}, color={0,0,0})); + connect(volumeI.Cs1, sink.C) annotation (Line(points={{8,8},{8,30},{20,30}}, color={0,0,0})); + connect(sourcePQ.C, volumeI.Ce2) annotation (Line(points={{-30,0},{-12,0}}, color={0,0,0})); + connect(sourceQ.C, volumeI.Ce1) annotation (Line(points={{-36,28},{-12,28},{-12,8}}, color={0,0,0})); annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestVolumeI_Traces; diff --git a/ThermoSysPro/Fluid/Volumes/VolumeI.mo b/ThermoSysPro/Fluid/Volumes/VolumeI.mo index 8335e4e8..91d03dbf 100644 --- a/ThermoSysPro/Fluid/Volumes/VolumeI.mo +++ b/ThermoSysPro/Fluid/Volumes/VolumeI.mo @@ -35,8 +35,6 @@ model VolumeI "Mixing volume with 4 inlets and 4 outlets" tab="Fluid", group="Medium")); - - protected constant Boolean isCompressible = Medium.isCompressible; parameter Units.SI.MassFlowRate gamma0=1.e-4 @@ -71,22 +69,14 @@ public Units.SI.Power Js3 "Thermal power diffusion from outlet s3"; Units.SI.Power Js4 "Thermal power diffusion from outlet s4"; Units.SI.Power J "Total thermal power diffusion"; - Units.SI.MassFlowRate gamma_e1 - "Diffusion conductance for inlet e1"; - Units.SI.MassFlowRate gamma_e2 - "Diffusion conductance for inlet e2"; - Units.SI.MassFlowRate gamma_e3 - "Diffusion conductance for inlet e3"; - Units.SI.MassFlowRate gamma_e4 - "Diffusion conductance for inlet e4"; - Units.SI.MassFlowRate gamma_s1 - "Diffusion conductance for outlet s1"; - Units.SI.MassFlowRate gamma_s2 - "Diffusion conductance for outlet s2"; - Units.SI.MassFlowRate gamma_s3 - "Diffusion conductance for outlet s3"; - Units.SI.MassFlowRate gamma_s4 - "Diffusion conductance for outlet s4"; + Units.SI.MassFlowRate gamma_e1 "Diffusion conductance for inlet e1"; + Units.SI.MassFlowRate gamma_e2 "Diffusion conductance for inlet e2"; + Units.SI.MassFlowRate gamma_e3 "Diffusion conductance for inlet e3"; + Units.SI.MassFlowRate gamma_e4 "Diffusion conductance for inlet e4"; + Units.SI.MassFlowRate gamma_s1 "Diffusion conductance for outlet s1"; + Units.SI.MassFlowRate gamma_s2 "Diffusion conductance for outlet s2"; + Units.SI.MassFlowRate gamma_s3 "Diffusion conductance for outlet s3"; + Units.SI.MassFlowRate gamma_s4 "Diffusion conductance for outlet s4"; Real re1 "Value of r(Q/gamma) for inlet e1"; Real re2 "Value of r(Q/gamma) for inlet e2"; Real re3 "Value of r(Q/gamma) for inlet e3"; From d6b87efe1462c3be384df3e5feaf7d0f453833ec Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Fri, 20 Jun 2025 14:38:36 +0200 Subject: [PATCH 066/178] #125 StaticCentrifugalPump reviewed --- .../Machines/TestStaticCentrifugalPump.mo | 16 +++++----------- .../TestStaticCentrifugalPump_FlueGases.mo | 11 +++-------- .../TestStaticCentrifugalPump_Traces.mo | 19 +++++-------------- .../Fluid/Machines/StaticCentrifugalPump.mo | 8 ++++---- 4 files changed, 17 insertions(+), 37 deletions(-) diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStaticCentrifugalPump.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStaticCentrifugalPump.mo index eaf3a569..123ab095 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStaticCentrifugalPump.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStaticCentrifugalPump.mo @@ -3,17 +3,11 @@ model TestStaticCentrifugalPump extends ThermoSysPro.UsersGuide.Icons.Example; replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; - ThermoSysPro.Fluid.Machines.StaticCentrifugalPump staticCentrifugalPump( - redeclare - replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package - Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare - replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.Fluid.Machines.StaticCentrifugalPump staticCentrifugalPump(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); equation - connect(staticCentrifugalPump.C2, sink.C) - annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); - connect(staticCentrifugalPump.C1, sourcePQ.C) - annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); + connect(staticCentrifugalPump.C2, sink.C) annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(staticCentrifugalPump.C1, sourcePQ.C) annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestStaticCentrifugalPump; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStaticCentrifugalPump_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStaticCentrifugalPump_FlueGases.mo index d461da0e..3e2e9e02 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStaticCentrifugalPump_FlueGases.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStaticCentrifugalPump_FlueGases.mo @@ -3,10 +3,7 @@ model TestStaticCentrifugalPump_FlueGases extends ThermoSysPro.UsersGuide.Icons.Example; replaceable package Medium = ThermoSysPro.Properties.Media.FlueGases; - ThermoSysPro.Fluid.Machines.StaticCentrifugalPump staticCentrifugalPump( - redeclare - replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-6,-10}, - {14,10}}))); + ThermoSysPro.Fluid.Machines.StaticCentrifugalPump staticCentrifugalPump(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-6,-10},{14,10}}))); ThermoSysPro.Fluid.BoundaryConditions.Sink sink( redeclare replaceable package Medium = Medium, T0=573.15, @@ -17,9 +14,7 @@ model TestStaticCentrifugalPump_FlueGases T0=573.15, option_temperature=true) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); equation - connect(staticCentrifugalPump.C2, sink.C) - annotation (Line(points={{14,0},{30,0}}, color={0,0,0})); - connect(staticCentrifugalPump.C1, sourcePQ.C) - annotation (Line(points={{-6,0},{-30,0}}, color={0,0,0})); + connect(staticCentrifugalPump.C2, sink.C) annotation (Line(points={{14,0},{30,0}}, color={0,0,0})); + connect(staticCentrifugalPump.C1, sourcePQ.C) annotation (Line(points={{-6,0},{-30,0}}, color={0,0,0})); annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestStaticCentrifugalPump_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStaticCentrifugalPump_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStaticCentrifugalPump_Traces.mo index 2f92f154..9cc25305 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStaticCentrifugalPump_Traces.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStaticCentrifugalPump_Traces.mo @@ -6,20 +6,11 @@ model TestStaticCentrifugalPump_Traces extraPropertiesNames={"Trace"}, C_nominal={0.1}, C_default={0.2}); - ThermoSysPro.Fluid.Machines.StaticCentrifugalPump staticCentrifugalPump( - redeclare - replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10}, - {10,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package - Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare - replaceable package Medium = Medium, SubC0={0.3}) - annotation (Placement(transformation(extent={{-52,-10}, - {-32,10}}))); + ThermoSysPro.Fluid.Machines.StaticCentrifugalPump staticCentrifugalPump(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare replaceable package Medium = Medium, SubC0={0.3}) annotation (Placement(transformation(extent={{-52,-10},{-32,10}}))); equation - connect(staticCentrifugalPump.C2, sink.C) - annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); - connect(staticCentrifugalPump.C1, sourcePQ.C) - annotation (Line(points={{-10,0},{-32,0}}, color={0,0,0})); + connect(staticCentrifugalPump.C2, sink.C) annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(staticCentrifugalPump.C1, sourcePQ.C) annotation (Line(points={{-10,0},{-32,0}}, color={0,0,0})); annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestStaticCentrifugalPump_Traces; diff --git a/ThermoSysPro/Fluid/Machines/StaticCentrifugalPump.mo b/ThermoSysPro/Fluid/Machines/StaticCentrifugalPump.mo index 0506ea69..34e1803e 100644 --- a/ThermoSysPro/Fluid/Machines/StaticCentrifugalPump.mo +++ b/ThermoSysPro/Fluid/Machines/StaticCentrifugalPump.mo @@ -1,7 +1,8 @@ within ThermoSysPro.Fluid.Machines; model StaticCentrifugalPump "Static centrifugal pump" - replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby - ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + extends ThermoSysPro.Fluid.Interfaces.IconColors; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Units.nonSI.AngularVelocity_rpm VRot=1400 "Fixed rotational speed (active if fixed_rot_or_power=1 and rpm_or_mpower connector not connected)"; @@ -185,6 +186,5 @@ equation
  • Daniel Bouskela
  • Baligh El Hefni
  • -"), - DymolaStoredErrors); +")); end StaticCentrifugalPump; From 62a177665346e3293a4cafc3c2cc450cfe93c273 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Fri, 20 Jun 2025 16:58:15 +0200 Subject: [PATCH 067/178] #125 OnePhaseFlowPipe --- .../TestDynamicOnePhaseFlowPipe.mo | 28 ++++++++ .../TestDynamicOnePhaseFlowPipe_FlueGases.mo | 39 +++++++++++ .../TestDynamicOnePhaseFlowPipe_Traces.mo | 31 +++++++++ .../HeatExchangers/package.order | 3 + .../HeatExchangers/DynamicOnePhaseFlowPipe.mo | 65 +++++++++---------- .../Properties/Media/FlueGases/package.mo | 49 ++++++++++++++ .../Properties/Media/FlueGases/package.order | 2 + 7 files changed, 181 insertions(+), 36 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicOnePhaseFlowPipe.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicOnePhaseFlowPipe_FlueGases.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicOnePhaseFlowPipe_Traces.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicOnePhaseFlowPipe.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicOnePhaseFlowPipe.mo new file mode 100644 index 00000000..d682e934 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicOnePhaseFlowPipe.mo @@ -0,0 +1,28 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; +model TestDynamicOnePhaseFlowPipe + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam; + + ThermoSysPro.Fluid.HeatExchangers.DynamicOnePhaseFlowPipe dynamicOnePhaseFlowPipe( + redeclare package Medium = Medium, + Q(start={536.5750641592207,536.5750641592207,536.5750641592207,536.5750641592207,536.5750641592207,536.5750641592207,536.5750641592207,536.5750641592207,536.5750641592207,536.5750641592207,536.5750641592207}), + h(start={71016.12237181116,74743.46665892199,78470.81094603281,82198.15523314364,85925.49952025448,89652.84380736532,93380.18809447614,97107.53238158698,100834.8766686978,104562.22095580865,108289.56524291947,70825.9016030344}), + P(start={300000,281833.41863537,263664.30473175,245492.47958308,227317.76827098,209139.99948382,190959.00534677,172774.621262,154586.68575823,136395.04034906,118199.5293995,100000})) annotation (Placement(transformation(extent={{-10,-10},{10,10}},rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-50,-10},{-30,10}},rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}},rotation=0))); + ThermoSysPro.Thermal.BoundaryConditions.HeatSource heatSource( + T0={1000,1100,1200,1300,1400,1500,1600,1700,1800,1900}, + option_temperature=2, + W0={2e6,2e6,2e6,2e6,2e6,2e6,2e6,2e6,2e6,2e6}) annotation (Placement(transformation(extent={{-10,30},{10,50}}, rotation=0))); + ThermoSysPro.Thermal.HeatTransfer.HeatExchangerWall heatExchangerWall(Ns=10) annotation (Placement(transformation(extent={{-10,10},{10,30}},rotation=0))); +equation + connect(sourceP.C, dynamicOnePhaseFlowPipe.C1) annotation (Line(points={{-30,0},{-10,0}}, color={0,0,255})); + connect(dynamicOnePhaseFlowPipe.C2, sinkP.C) annotation (Line(points={{10,0},{30,0}}, color={0,0,255})); + connect(heatSource.C, heatExchangerWall.WT2) annotation (Line(points={{0,30.2},{0,22}}, color={191,95,0})); + connect(heatExchangerWall.WT1, dynamicOnePhaseFlowPipe.CTh) annotation (Line(points={{0,18},{0,3}}, color={191,95,0})); + annotation ( + experiment(StopTime=1000), + Icon(coordinateSystem(preserveAspectRatio=false)), + Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestDynamicOnePhaseFlowPipe; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicOnePhaseFlowPipe_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicOnePhaseFlowPipe_FlueGases.mo new file mode 100644 index 00000000..56268e48 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicOnePhaseFlowPipe_FlueGases.mo @@ -0,0 +1,39 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; +model TestDynamicOnePhaseFlowPipe_FlueGases + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.FlueGases ( + extraPropertiesNames={"Trace1","Trace2","Trace3"}, + C_nominal={0.1,0.2,0.3}, + C_default={0.2,0.3,0.4}); + + ThermoSysPro.Fluid.HeatExchangers.DynamicOnePhaseFlowPipe dynamicOnePhaseFlowPipe( + redeclare package Medium = Medium, + Ns=1, + Q(start={34.51316334625123,34.51316334625123}), + h(start={3077096.0822837264,3135044.986588299,3077096.0822837264}), + P(start={45e5,44.75e5,44.5e5}, displayUnit="bar")) annotation (Placement(transformation(extent={{-10,-10},{10,10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP( + redeclare package Medium = Medium, + P0=4500000, + T0=573.15, + X0={0,0,1,0,0}) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP( + redeclare package Medium = Medium, + P0=4450000, + T0=573.15) annotation (Placement(transformation(extent={{30,-10},{50,10}}, rotation=0))); + ThermoSysPro.Thermal.BoundaryConditions.HeatSource heatSource( + T0={1000.005}, + option_temperature=2, + W0={2e6}) annotation (Placement(transformation(extent={{-10,30},{10,50}}, rotation=0))); + ThermoSysPro.Thermal.HeatTransfer.HeatExchangerWall heatExchangerWall(Ns=1) annotation (Placement(transformation(extent={{-10,10},{10,30}}, rotation=0))); +equation + connect(sourceP.C, dynamicOnePhaseFlowPipe.C1) annotation (Line(points={{-30,0},{-10,0}}, color={0,0,255})); + connect(dynamicOnePhaseFlowPipe.C2, sinkP.C) annotation (Line(points={{10,0},{30,0}}, color={0,0,255})); + connect(heatSource.C, heatExchangerWall.WT2) annotation (Line(points={{0,30.2},{0,22}}, color={191,95,0})); + connect(heatExchangerWall.WT1, dynamicOnePhaseFlowPipe.CTh) annotation (Line(points={{0,18},{0,3}}, color={191,95,0})); + annotation ( + experiment(StopTime=1000), + Icon(coordinateSystem(preserveAspectRatio=false)), + Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestDynamicOnePhaseFlowPipe_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicOnePhaseFlowPipe_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicOnePhaseFlowPipe_Traces.mo new file mode 100644 index 00000000..09c998b9 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicOnePhaseFlowPipe_Traces.mo @@ -0,0 +1,31 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; +model TestDynamicOnePhaseFlowPipe_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam ( + extraPropertiesNames={"Trace1","Trace2","Trace3"}, + C_nominal={0.1,0.2,0.3}, + C_default={0.2,0.3,0.4}); + + ThermoSysPro.Fluid.HeatExchangers.DynamicOnePhaseFlowPipe dynamicOnePhaseFlowPipe( + redeclare package Medium = Medium, + Q(start={536.5750641592207,536.5750641592207,536.5750641592207,536.5750641592207,536.5750641592207,536.5750641592207,536.5750641592207,536.5750641592207,536.5750641592207,536.5750641592207,536.5750641592207}), + h(start={71016.12237181116,74743.46665892199,78470.81094603281,82198.15523314364,85925.49952025448,89652.84380736532,93380.18809447614,97107.53238158698,100834.8766686978,104562.22095580865,108289.56524291947,70825.9016030344}), + P(start={300000,281833.41863537,263664.30473175,245492.47958308,227317.76827098,209139.99948382,190959.00534677,172774.621262,154586.68575823,136395.04034906,118199.5293995,100000})) annotation (Placement(transformation(extent={{-10,-10},{10,10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}, rotation=0))); + ThermoSysPro.Thermal.BoundaryConditions.HeatSource heatSource( + T0={1000,1100,1200,1300,1400,1500,1600,1700,1800,1900}, + option_temperature=2, + W0={2e6,2e6,2e6,2e6,2e6,2e6,2e6,2e6,2e6,2e6}) annotation (Placement(transformation(extent={{-10,30},{10,50}}, rotation=0))); + ThermoSysPro.Thermal.HeatTransfer.HeatExchangerWall heatExchangerWall(Ns=10) annotation (Placement(transformation(extent={{-10,10},{10,30}}, rotation=0))); +equation + connect(sourceP.C, dynamicOnePhaseFlowPipe.C1) annotation (Line(points={{-30,0},{-10,0}}, color={0,0,255})); + connect(dynamicOnePhaseFlowPipe.C2, sinkP.C) annotation (Line(points={{10,0},{30,0}}, color={0,0,255})); + connect(heatSource.C, heatExchangerWall.WT2) annotation (Line(points={{0,30.2},{0,22}}, color={191,95,0})); + connect(heatExchangerWall.WT1, dynamicOnePhaseFlowPipe.CTh) annotation (Line(points={{0,18},{0,3}}, color={191,95,0})); + annotation ( + experiment(StopTime=1000), + Icon(coordinateSystem(preserveAspectRatio=false)), + Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestDynamicOnePhaseFlowPipe_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order index e69de29b..2cd052a4 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order @@ -0,0 +1,3 @@ +TestDynamicOnePhaseFlowPipe +TestDynamicOnePhaseFlowPipe_Traces +TestDynamicOnePhaseFlowPipe_FlueGases diff --git a/ThermoSysPro/Fluid/HeatExchangers/DynamicOnePhaseFlowPipe.mo b/ThermoSysPro/Fluid/HeatExchangers/DynamicOnePhaseFlowPipe.mo index 56cc2ce2..5451ccc9 100644 --- a/ThermoSysPro/Fluid/HeatExchangers/DynamicOnePhaseFlowPipe.mo +++ b/ThermoSysPro/Fluid/HeatExchangers/DynamicOnePhaseFlowPipe.mo @@ -1,9 +1,10 @@ -within ThermoSysPro.Fluid.HeatExchangers; +within ThermoSysPro.Fluid.HeatExchangers; model DynamicOnePhaseFlowPipe "Dynamic one-phase flow pipe" extends ThermoSysPro.Fluid.Interfaces.IconColors; import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Units.SI.Length L=10. "Pipe length"; parameter Units.SI.Diameter D=0.2 "Internal pipe diameter"; parameter Real rugosrel=0.0007 "Pipe relative roughness"; @@ -122,12 +123,9 @@ public "Friction pressure loss coefficient in node i"; Units.SI.DerDensityByPressure ddph[N - 1] "Density derivative wrt. pressure"; Units.SI.DerDensityByEnthalpy ddhp[N - 1] "Density derivative srt. enthalpy"; - FluidType ftype "Fluid type"; - Integer fluid=Integer(ftype) "Fluid number"; - ThermoSysPro.Units.SI.MassFraction Xco2 "CO2 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xh2o "H2O mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xo2 "O2 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xso2 "SO2 mass fraction"; + Medium.ThermodynamicState state1[N - 1]; + Medium.ThermodynamicState state2[N]; + Medium.MassFraction X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Mass fractions"; Real diff_res[N] "Diffusion resistance in hydraulic node i"; Real diff_res_t "Total diffusion resistance in the pipe"; Real diff_res_e[N - 1] "Diffusion resistance at inlet of thermal node i"; @@ -147,9 +145,9 @@ public Real rs[N - 1] "Value of r(Q/gamma) for outlet of thermal node i"; public - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-110,-10},{-90,10}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{90,-10},{110,10}}, rotation=0))); ThermoSysPro.Thermal.Connectors.ThermalPort CTh[Ns] annotation (Placement(transformation(extent={{-10,20},{10,40}}, rotation=0))); @@ -162,7 +160,7 @@ initial equation else if option_temperature then for i in 2:N loop - h[i] = ThermoSysPro.Properties.Fluid.SpecificEnthalpy_PT(P0, T0[i-1], fluid, mode, Xco2, Xh2o, Xo2, Xso2); + h[i] = Medium.specificEnthalpy_pTX(P0, T0[i-1], X); end for; else for i in 2:N loop @@ -212,19 +210,11 @@ equation C2.diff_res_1 = C1.diff_res_1 + diff_res_t; C1.diff_res_2 = C2.diff_res_2 + diff_res_t; - C1.ftype = C2.ftype; + C1.SubC = C2.SubC; - C1.Xco2 = C2.Xco2; - C1.Xh2o = C2.Xh2o; - C1.Xo2 = C2.Xo2; - C1.Xso2 = C2.Xso2; + C1.Xi = C2.Xi; - ftype = C1.ftype; - - Xco2 = C1.Xco2; - Xh2o = C1.Xh2o; - Xo2 = C1.Xo2; - Xso2 = C1.Xso2; + X = C1.Xi; /* Mass and energy balance equations (thermal nodes) */ for i in 1:N - 1 loop @@ -318,14 +308,15 @@ equation end if; /* Fluid thermodynamic properties */ - ddph[i] = ThermoSysPro.Properties.Fluid.Density_derp_Ph(P[i + 1], h[i + 1], fluid, mode, Xco2, Xh2o, Xo2, Xso2); - ddhp[i] = ThermoSysPro.Properties.Fluid.Density_derh_Ph(P[i + 1], h[i + 1], fluid, mode, Xco2, Xh2o, Xo2, Xso2); - - rho1[i] = ThermoSysPro.Properties.Fluid.Density_Ph(P[i + 1], h[i + 1], fluid, mode, Xco2, Xh2o, Xo2, Xso2); - T1[i] = ThermoSysPro.Properties.Fluid.Temperature_Ph(P[i + 1], h[i + 1], fluid, mode, Xco2, Xh2o, Xo2, Xso2); - cp1[i] = ThermoSysPro.Properties.Fluid.SpecificHeatCapacityCp_Ph(P[i + 1], h[i + 1], fluid, mode, Xco2, Xh2o, Xo2, Xso2); - mu1[i] = ThermoSysPro.Properties.Fluid.DynamicViscosity_Ph(P[i + 1], h[i + 1], fluid, mode, Xco2, Xh2o, Xo2, Xso2); - k1[i] = ThermoSysPro.Properties.Fluid.ThermalConductivity_Ph(P[i + 1], h[i + 1], fluid, mode, Xco2, Xh2o, Xo2, Xso2); + state1[i] = Medium.setState_phX(p=P[i + 1], h=h[i + 1], X=X); + ddph[i] = Medium.density_derp_h(state1[i]); + ddhp[i] = Medium.density_derh_p(state1[i]); + + rho1[i] = Medium.density(state1[i]); + T1[i] = Medium.temperature(state1[i]); + cp1[i] = Medium.specificHeatCapacityCp(state1[i]); + mu1[i] = Medium.dynamicViscosity(state1[i]); + k1[i] = Medium.thermalConductivity(state1[i]); end for; /* Momentum balance equations (hydraulic nodes) */ @@ -359,11 +350,13 @@ equation gamma[i] = if diffusion then 1/diff_res[i] else gamma0; /* Fluid thermodynamic properties */ - rho2[i] = ThermoSysPro.Properties.Fluid.Density_Ph((P[i] + P[i + 1])/2, hb[i], fluid, mode, Xco2, Xh2o, Xo2, Xso2); - T2[i] = ThermoSysPro.Properties.Fluid.Temperature_Ph((P[i] + P[i + 1])/2, hb[i], fluid, mode, Xco2, Xh2o, Xo2, Xso2); - cp2[i] = ThermoSysPro.Properties.Fluid.SpecificHeatCapacityCp_Ph((P[i] + P[i + 1])/2, hb[i], fluid, mode, Xco2, Xh2o, Xo2, Xso2); - mu2[i] = ThermoSysPro.Properties.Fluid.DynamicViscosity_Ph((P[i] + P[i + 1])/2, hb[i], fluid, mode, Xco2, Xh2o, Xo2, Xso2); - k2[i] = ThermoSysPro.Properties.Fluid.ThermalConductivity_Ph((P[i] + P[i + 1])/2, hb[i], fluid, mode, Xco2, Xh2o, Xo2, Xso2); + state2[i] = Medium.setState_phX(p=(P[i] + P[i + 1])/2, h=hb[i], X=X); + + rho2[i] = Medium.density(state2[i]); + T2[i] = Medium.temperature(state2[i]); + cp2[i] = Medium.specificHeatCapacityCp(state2[i]); + mu2[i] = Medium.dynamicViscosity(state2[i]); + k2[i] = Medium.thermalConductivity(state2[i]); end for; /* Fluid densities at the boundaries of the nodes */ @@ -371,8 +364,8 @@ equation rhoc[i] = rho1[i - 1]; end for; - rhoc[1] = ThermoSysPro.Properties.Fluid.Density_Ph(P[1],h[1], fluid, mode, Xco2, Xh2o, Xo2, Xso2); - rhoc[N + 1] = ThermoSysPro.Properties.Fluid.Density_Ph((P[N + 1]), h[N + 1], fluid, mode, Xco2, Xh2o, Xo2, Xso2); + rhoc[1] = Medium.density_phX(p=P[1],h=h[1],X=X); + rhoc[N + 1] = Medium.density_phX(p=P[N + 1],h=h[N + 1],X=X); W1t = sum(dW1); diff --git a/ThermoSysPro/Properties/Media/FlueGases/package.mo b/ThermoSysPro/Properties/Media/FlueGases/package.mo index 514261ef..5deca97c 100644 --- a/ThermoSysPro/Properties/Media/FlueGases/package.mo +++ b/ThermoSysPro/Properties/Media/FlueGases/package.mo @@ -19,6 +19,55 @@ package FlueGases "Flue gases library inherited from Modelica.Media" constant Units.SI.SpecificEnthalpy hr=2501569 "ThermoSysPro Water/steam reference specific enthalpy at 0.01°C"; constant Units.SI.SpecificEnthalpy hr_FlueGases=503298 "FlueGases reference specific enthalpy, computed from ThermoSysPro.Properties.ModelicaMediaFlueGases.specificEnthalpy(state0) at (0.006112 bars, 0.01°C)"; + redeclare function extends density_derh_p "Density derivative by specific enthalpy" + + protected + Units.SI.SpecificEntropy s "Flue gases specific entropy"; + Units.SI.Density rho "Flue gaases density"; + Units.SI.SpecificHeatCapacity cp "Specific heat capacity"; + Units.SI.SpecificHeatCapacity R "gas constant"; + Units.SI.DerDensityByEnthalpy drhodh + "Derivative of the density wrt. the specific enthalpy at constant pressure"; + + algorithm + s := ThermoSysPro.Properties.ModelicaMediaFlueGases.specificEntropy(state); + rho := ThermoSysPro.Properties.ModelicaMediaFlueGases.density(state); + cp := ThermoSysPro.Properties.ModelicaMediaFlueGases.specificHeatCapacityCp(state); + R := ThermoSysPro.Properties.ModelicaMediaFlueGases.gasConstant(state); + + drhodh := -rho*rho*R/(state.p*cp); + ddhp := drhodh; + + annotation ( + smoothOrder=2, + Icon(graphics), + Documentation(info=" +

    Copyright © EDF 2002 - 2010

    + + +

    ThermoSysPro Version 2.0

    + +")); + + end density_derh_p; + + redeclare function extends density_derp_h "Density derivative by pressure" + protected + Units.SI.SpecificEntropy s "Flue gases specific entropy"; + Units.SI.Density rho "Flue gaases density"; + Units.SI.SpecificHeatCapacity cp "Specific heat capacity"; + Units.SI.SpecificHeatCapacity R "gas constant"; + Units.SI.DerDensityByPressure drhodp "Derivative of the density wrt. the pressure at constant specific enthalpy"; + algorithm + s := ThermoSysPro.Properties.ModelicaMediaFlueGases.specificEntropy(state); + rho := ThermoSysPro.Properties.ModelicaMediaFlueGases.density(state); + cp := ThermoSysPro.Properties.ModelicaMediaFlueGases.specificHeatCapacityCp(state); + R := ThermoSysPro.Properties.ModelicaMediaFlueGases.gasConstant(state); + + drhodp := (rho*rho*R)/(state.p*cp)*(1/rho + state.T/state.p*(cp - R)); + ddph := drhodp; + annotation (Inline=true); + end density_derp_h; annotation (Documentation(info=" ")); diff --git a/ThermoSysPro/Properties/Media/FlueGases/package.order b/ThermoSysPro/Properties/Media/FlueGases/package.order index 9965a189..24c2001d 100644 --- a/ThermoSysPro/Properties/Media/FlueGases/package.order +++ b/ThermoSysPro/Properties/Media/FlueGases/package.order @@ -1,2 +1,4 @@ hr hr_FlueGases +density_derh_p +density_derp_h From ba39415e35a1dc6ef5f977341374b2ef16e49ef9 Mon Sep 17 00:00:00 2001 From: LAMBLOT Simon Date: Mon, 23 Jun 2025 10:32:27 +0200 Subject: [PATCH 068/178] VolumeATh --- .../SimpleExamples/Volumes/TestVolumeATh.mo | 23 +++ .../Volumes/TestVolumeATh_FlueGases.mo | 30 +++ .../Volumes/TestVolumeATh_Traces.mo | 29 +++ .../SimpleExamples/Volumes/package.order | 3 + ThermoSysPro/Fluid/Volumes/VolumeATh.mo | 174 ++++++------------ 5 files changed, 141 insertions(+), 118 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeATh.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeATh_FlueGases.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeATh_Traces.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeATh.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeATh.mo new file mode 100644 index 00000000..7fb15da1 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeATh.mo @@ -0,0 +1,23 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Volumes; +model TestVolumeATh + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam; + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package + Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare + replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.Fluid.Volumes.VolumeATh + volumeATh( + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare replaceable + package Medium = Medium) annotation (Placement(transformation(extent={{-50,20},{-30,40}}))); +equation + connect(sourcePQ.C, volumeATh.Ce1) + annotation (Line(points={{-30,0},{-10,0}}, color={0,0,0})); + connect(volumeATh.Ce2, sourceQ.C) + annotation (Line(points={{0,10},{0,30},{-30,30}}, color={0,0,0})); + connect(volumeATh.Cs1, sink.C) + annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestVolumeATh; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeATh_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeATh_FlueGases.mo new file mode 100644 index 00000000..804c4ea4 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeATh_FlueGases.mo @@ -0,0 +1,30 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Volumes; +model TestVolumeATh_FlueGases + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.FlueGases; + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package + Medium = Medium, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare + replaceable package Medium = Medium, + P0=4500000, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.Fluid.Volumes.VolumeATh + volumeATh( + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare replaceable + package Medium = Medium, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{-50,20},{-30,40}}))); +equation + connect(sourcePQ.C, volumeATh.Ce1) + annotation (Line(points={{-30,0},{-10,0}}, color={0,0,0})); + connect(volumeATh.Ce2, sourceQ.C) + annotation (Line(points={{0,10},{0,30},{-30,30}}, color={0,0,0})); + connect(volumeATh.Cs1, sink.C) + annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestVolumeATh_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeATh_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeATh_Traces.mo new file mode 100644 index 00000000..ea380925 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeATh_Traces.mo @@ -0,0 +1,29 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Volumes; +model TestVolumeATh_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam (extraPropertiesNames={"Trace"}, C_nominal={0.1}, C_default={0.2}); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package + Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare + replaceable package Medium = Medium, + Q0=100, + SubC0={0.5}) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.Fluid.Volumes.VolumeATh + volumeATh( + redeclare package Medium = Medium, + V=1, + dynamic_mass_balance=false) annotation (Placement(transformation(extent={{-10,-10}, + {10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare replaceable + package Medium = Medium, + SubC0={0.2}) annotation (Placement(transformation(extent={{-50,20},{-30,40}}))); +equation + connect(sourcePQ.C, volumeATh.Ce1) + annotation (Line(points={{-30,0},{-10,0}}, color={0,0,0})); + connect(volumeATh.Ce2, sourceQ.C) + annotation (Line(points={{0,10},{0,30},{-30,30}}, color={0,0,0})); + connect(volumeATh.Cs1, sink.C) + annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestVolumeATh_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order index 2437a0f0..6f328c14 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order @@ -13,3 +13,6 @@ TestVolumeB_Traces TestVolumeI TestVolumeI_FlueGases TestVolumeI_Traces +TestVolumeATh +TestVolumeATh_Traces +TestVolumeATh_FlueGases \ No newline at end of file diff --git a/ThermoSysPro/Fluid/Volumes/VolumeATh.mo b/ThermoSysPro/Fluid/Volumes/VolumeATh.mo index 87eb77cc..e703a0ee 100644 --- a/ThermoSysPro/Fluid/Volumes/VolumeATh.mo +++ b/ThermoSysPro/Fluid/Volumes/VolumeATh.mo @@ -1,10 +1,9 @@ -within ThermoSysPro.Fluid.Volumes; +within ThermoSysPro.Fluid.Volumes; model VolumeATh "Mixing volume with 2 inlets, 2 outlets and 1 thermal input" - extends - ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidTypeParameterInterface; + extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable function SaS = Medium.noSaS(SubC=SubC) annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Boolean dynamic_energy_balance=true "true: dynamic energy balance equation - false: static energy balance equation"; @@ -29,42 +28,18 @@ model VolumeATh "Mixing volume with 2 inlets, 2 outlets and 1 thermal input" "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; parameter Units.SI.Density p_rho=0 "If > 0, fixed fluid density" annotation (Evaluate=true, Dialog(tab="Fluid", group="Fluid properties")); - parameter IF97Region region=IF97Region.All_regions "IF97 region (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); parameter Boolean dynamic_composition_balance=false - "true: dynamic fluid composition balance equation
    false: static fluid composition balance equation (active for flue gases)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.FlueGases), tab="Fluid", group="Fluid properties")); + "true: dynamic fluid composition balance equation
    false: static fluid composition balance equation (active for flue gases)" annotation(Evaluate=true, Dialog(tab="Fluid", group="Fluid properties")); - parameter ThermoSysPro.Units.SI.MassFraction Xco20=0.0 - "Initial CO2 mass fraction" annotation (Evaluate=true, Dialog( - enable=dynamic_composition_balance, - tab="Fluid", - group= - "Initial composition values (active for flue gases only if dynamic_composition_balance=true)")); - parameter ThermoSysPro.Units.SI.MassFraction Xh2o0=if ftype == FluidType.FlueGases then 0.05 else 0 - "Initial H20 mass fraction" annotation (Evaluate=true, Dialog( - enable=dynamic_composition_balance, - tab="Fluid", - group= - "Initial composition values (active for flue gases only if dynamic_composition_balance=true)")); - parameter ThermoSysPro.Units.SI.MassFraction Xo20=0.23 - "Initial O2 mass fraction" annotation (Evaluate=true, Dialog( + parameter Medium.ExtraProperty X0[Medium.nX]=Medium.X_default "Initial composition values" annotation (Evaluate=true, Dialog( enable=dynamic_composition_balance, tab="Fluid", - group= - "Initial composition values (active for flue gases only if dynamic_composition_balance=true)")); - parameter ThermoSysPro.Units.SI.MassFraction Xso20=0 - "Initial SO2 mass fraction" annotation (Evaluate=true, Dialog( - enable=dynamic_composition_balance, - tab="Fluid", - group= - "Initial composition values (active for flue gases only if dynamic_composition_balance=true)")); + group="Medium")); protected - constant Units.SI.SpecificEnthalpy hr=2501569 - "Water/steam reference specific enthalpy at 0.01°C"; - parameter Boolean flue_gases=(ftype == FluidType.FlueGases) "Flue gases"; + constant Boolean isCompressible = Medium.isCompressible; parameter Units.SI.MassFlowRate gamma0=1.e-4 "Pseudo-diffusion conductance use for continuous flow reversal (active if diffusion=false and continuous_flow_reversal = true)"; - parameter Integer mode=Integer(region) - 1 "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; public Units.SI.Temperature T "Fluid temperature"; @@ -77,15 +52,12 @@ public "density derivative wrt pressure at constant specific enthalpy"; Units.SI.DerDensityByEnthalpy ddhp "density derivative wrt specific enthalpy at constant pressure"; - FluidType fluids[5] "Fluids mixing in volume"; - Units.SI.MassFlowRate BXco2 "Right hand side of the CO2 balance equation"; - Units.SI.MassFlowRate BXh2o "Right hand side of the H2O balance equation"; - Units.SI.MassFlowRate BXo2 "Right hand side of the O2 balance equation"; - Units.SI.MassFlowRate BXso2 "Right hand side of the SO2 balance equation"; - ThermoSysPro.Units.SI.MassFraction Xco2 "CO2 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xh2o "H20 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xo2 "O2 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xso2 "SO2 mass fraction"; + Units.SI.MassFlowRate BX[Medium.nXi] "Right hand side of the X balance equation"; + Medium.ExtraProperty X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Fluid mass fraction"; + Medium.ExtraProperty BSubC[Medium.nC](quantity=Medium.extraPropertiesNames) "Right hand side of the trace balance equation"; + Medium.ExtraProperty SubC[Medium.nC](quantity=Medium.extraPropertiesNames, start=Medium.C_default) "Fluid trace substances"; + Medium.ExtraProperty SubCSaS[Medium.nC](quantity=Medium.extraPropertiesNames) "Trace modification in the trace balance equation"; + Medium.ThermodynamicState state; Units.SI.Power Je1 "Thermal power diffusion from inlet e1"; Units.SI.Power Je2 "Thermal power diffusion from inlet e2"; Units.SI.Power Js1 "Thermal power diffusion from outlet s1"; @@ -101,14 +73,14 @@ public Real rs2 "Value of r(Q/gamma) for outlet s2"; public - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce1 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce1( redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-110,-10},{-90,10}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce2 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce2( redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-10,90},{10,110}}, rotation=0), iconTransformation(extent={{-10,90},{10,110}}))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs1 annotation ( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs1( redeclare package Medium = Medium) annotation ( Placement(transformation(extent={{90,-10},{110,10}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs2 annotation ( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs2( redeclare package Medium = Medium) annotation ( Placement(transformation(extent={{-10,-110},{10,-90}}, rotation=0))); public Thermal.Connectors.ThermalPort Cth @@ -131,19 +103,11 @@ initial equation end if; end if; - if flue_gases then - if dynamic_composition_balance then - if steady_state then - der(Xco2) = 0; - der(Xh2o) = 0; - der(Xo2) = 0; - der(Xso2) = 0; - else - Xco2 = Xco20; - Xh2o = Xh2o0; - Xo2 = Xo20; - Xso2 = Xso20; - end if; + if dynamic_composition_balance then + if steady_state then + der(X) = fill(0,Medium.nX); + else + X = X0[1:Medium.nXi]; end if; end if; @@ -153,16 +117,6 @@ equation assert(V > 0, "Volume non-positive"); end if; - /* Check that incoming fluids are compatible with fluid in volume */ - fluids[1] = ftype; - fluids[2] = Ce1.ftype; - fluids[3] = Ce2.ftype; - fluids[4] = Cs1.ftype; - fluids[5] = Cs2.ftype; - - assert(ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.isCompatible(fluids), - "VolumeAth: fluids mixing in volume are not compatible with each other"); - /* Unconnected connectors */ if (cardinality(Ce1) == 0) then Ce1.Q = 0; @@ -170,11 +124,8 @@ equation Ce1.h_vol_1 = 1.e5; Ce1.diff_res_1 = 0; Ce1.diff_on_1 = false; - Ce1.ftype = ftype; - Ce1.Xco2 = 0; - Ce1.Xh2o = 0; - Ce1.Xo2 = 0; - Ce1.Xso2 = 0; + Ce1.Xi = Medium.X_default[1:Medium.nXi]; + Ce1.SubC = Medium.C_default; end if; if (cardinality(Ce2) == 0) then @@ -183,11 +134,8 @@ equation Ce2.h_vol_1 = 1.e5; Ce2.diff_res_1 = 0; Ce2.diff_on_1 = false; - Ce2.ftype = ftype; - Ce2.Xco2 = 0; - Ce2.Xh2o = 0; - Ce2.Xo2 = 0; - Ce2.Xso2 = 0; + Ce1.Xi = Medium.X_default[1:Medium.nXi]; + Ce1.SubC = Medium.C_default; end if; if (cardinality(Cs1) == 0) then @@ -208,7 +156,7 @@ equation BQ = Ce1.Q + Ce2.Q - Cs1.Q - Cs2.Q; if isCompressible and dynamic_energy_balance and dynamic_mass_balance then - V*(ddph*der(P) + ddhp*der(h - Xh2o*hr)) = BQ; + V*(ddph*der(P) + ddhp*der(h)) = BQ; else 0 = BQ; end if; @@ -219,13 +167,13 @@ equation P = Cs2.P; /* Energy balance equation */ - BH = Ce1.Q*(Ce1.h - Ce1.Xh2o*hr) + Ce2.Q*(Ce2.h - Ce2.Xh2o*hr) - Cs1.Q*(Cs1.h - Cs1.Xh2o*hr) - Cs2.Q*(Cs2.h - Cs2.Xh2o*hr) + Cth.W + J; + BH = Ce1.Q*Ce1.h + Ce2.Q*Ce2.h - Cs1.Q*Cs1.h - Cs2.Q*Cs2.h + Cth.W + J; if dynamic_energy_balance then if dynamic_mass_balance then - V*(((h - Xh2o*hr)*ddph - 1)*der(P) + ((h - Xh2o*hr)*ddhp + rho)*der(h - Xh2o*hr)) = BH; + V*((h*ddph - 1)*der(P) + (h*ddhp + rho)*der(h)) = BH; else - V*rho*der(h - Xh2o*hr) = BH; + V*rho*der(h) = BH; end if; else BH = 0; @@ -237,42 +185,30 @@ equation Cs2.h_vol_1 = h; /* Fluid composition balance equations */ - BXco2 = Ce1.Xco2*Ce1.Q + Ce2.Xco2*Ce2.Q - Cs1.Xco2*Cs1.Q - Cs2.Xco2*Cs2.Q; - BXh2o = Ce1.Xh2o*Ce1.Q + Ce2.Xh2o*Ce2.Q - Cs1.Xh2o*Cs1.Q - Cs2.Xh2o*Cs2.Q; - BXo2 = Ce1.Xo2*Ce1.Q + Ce2.Xo2*Ce2.Q - Cs1.Xo2*Cs1.Q - Cs2.Xo2*Cs2.Q; - BXso2 = Ce1.Xso2*Ce1.Q + Ce2.Xso2*Ce2.Q - Cs1.Xso2*Cs1.Q - Cs2.Xso2*Cs2.Q; - - if flue_gases then - if dynamic_composition_balance then - V*rho*der(Xco2) + Xco2*BQ = BXco2; - V*rho*der(Xh2o) + Xh2o*BQ = BXh2o; - V*rho*der(Xo2) + Xo2*BQ = BXo2; - V*rho*der(Xso2) + Xso2*BQ = BXso2; - else - Xco2*BQ = BXco2; - Xh2o*BQ = BXh2o; - Xo2*BQ = BXo2; - Xso2*BQ = BXso2; - end if; + BX = Ce1.Xi*Ce1.Q + Ce2.Xi*Ce2.Q - Cs1.Xi*Cs1.Q - Cs2.Xi*Cs2.Q; + + if dynamic_composition_balance then + V*rho*der(X) + X*BQ = BX; else - Xco2 = 0; - Xh2o = 0; - Xo2 = 0; - Xso2 = 0; + X*BQ = BX; end if; - Cs1.ftype = ftype; - Cs2.ftype = ftype; + Cs1.Xi = X; - Cs1.Xco2 = Xco2; - Cs1.Xh2o = Xh2o; - Cs1.Xo2 = Xo2; - Cs1.Xso2 = Xso2; + Cs2.Xi = X; - Cs2.Xco2 = Xco2; - Cs2.Xh2o = Xh2o; - Cs2.Xo2 = Xo2; - Cs2.Xso2 = Xso2; + /* Traces composition balance equations */ + BSubC = Ce1.Q*Ce1.SubC + Ce2.Q*Ce2.SubC - Cs1.Q*Cs1.SubC - Cs2.Q*Cs2.SubC; + + SubCSaS = SaS(); + if dynamic_mass_balance then + V*rho*der(SubC) + SubC*BQ + V*rho*SubCSaS = BSubC; + else + V*rho*SubCSaS = BSubC; + end if; + + Cs1.SubC = SubC; + Cs2.SubC = SubC; /* Flow reversal */ if continuous_flow_reversal then @@ -330,21 +266,23 @@ equation /* Fluid thermodynamic properties */ if isCompressible and dynamic_mass_balance then - ddph = ThermoSysPro.Properties.Fluid.Density_derp_Ph(P, h, fluid, mode, Xco2, Xh2o, Xo2, Xso2); - ddhp = ThermoSysPro.Properties.Fluid.Density_derh_Ph(P, h, fluid, mode, Xco2, Xh2o, Xo2, Xso2); + ddph = Medium.density_derp_h(state); + ddhp = Medium.density_derh_p(state); else ddph = 0; ddhp = 0; end if; - T = ThermoSysPro.Properties.Fluid.Temperature_Ph(P, h, fluid, mode, Xco2, Xh2o, Xo2, Xso2); + state = Medium.setState_phX(p=P, h=h, X=X); + + T = Medium.temperature(state); Cth.T = T; if (p_rho > 0) then rho = p_rho; else - rho = ThermoSysPro.Properties.Fluid.Density_Ph(P, h, fluid, mode, Xco2, Xh2o, Xo2, Xso2); + rho = Medium.density(state); end if; annotation ( From 11a76582aae77eedc6deeae3daa75c356ab2618b Mon Sep 17 00:00:00 2001 From: LAMBLOT Simon Date: Mon, 23 Jun 2025 11:07:10 +0200 Subject: [PATCH 069/178] VolumeBTh --- .../SimpleExamples/Volumes/TestVolumeBTh.mo | 29 +++ .../Volumes/TestVolumeBTh_FlueGases.mo | 36 ++++ .../Volumes/TestVolumeBTh_Traces.mo | 35 ++++ .../SimpleExamples/Volumes/package.order | 3 + ThermoSysPro/Fluid/Volumes/VolumeBTh.mo | 174 ++++++------------ 5 files changed, 159 insertions(+), 118 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeBTh.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeBTh_FlueGases.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeBTh_Traces.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeBTh.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeBTh.mo new file mode 100644 index 00000000..866c9264 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeBTh.mo @@ -0,0 +1,29 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Volumes; +model TestVolumeBTh + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam; + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package + Medium = Medium) annotation (Placement(transformation(extent={{-10,-10}, + {10,10}}, + rotation=90, + origin={0,38}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare + replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.Fluid.Volumes.VolumeBTh + volumeBTh( + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare replaceable + package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10}, + {10,10}}, + rotation=180, + origin={42,0}))); +equation + connect(sourcePQ.C, volumeBTh.Ce1) + annotation (Line(points={{-30,0},{-10,0}}, color={0,0,0})); + connect(volumeBTh.Ce2, sourceQ.C) annotation (Line(points={{10,0},{21,0},{21, + 7.21645e-16},{32,7.21645e-16}}, color={0,0,0})); + connect(volumeBTh.Cs1, sink.C) annotation (Line(points={{0,10},{0,19},{ + -5.55112e-16,19},{-5.55112e-16,28}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestVolumeBTh; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeBTh_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeBTh_FlueGases.mo new file mode 100644 index 00000000..d48a565e --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeBTh_FlueGases.mo @@ -0,0 +1,36 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Volumes; +model TestVolumeBTh_FlueGases + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.FlueGases; + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package + Medium = Medium, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{-10,-10}, + {10,10}}, + rotation=90, + origin={0,40}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare + replaceable package Medium = Medium, + P0=4500000, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.Fluid.Volumes.VolumeBTh + volumeBTh( + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare replaceable + package Medium = Medium, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{-10,-10}, + {10,10}}, + rotation=180, + origin={40,0}))); +equation + connect(sourcePQ.C, volumeBTh.Ce1) + annotation (Line(points={{-30,0},{-10,0}}, color={0,0,0})); + connect(volumeBTh.Ce2, sourceQ.C) annotation (Line(points={{10,0},{25,0},{25, + 6.66134e-16},{30,6.66134e-16}}, color={0,0,0})); + connect(volumeBTh.Cs1, sink.C) annotation (Line(points={{0,10},{0,20},{ + -5.55112e-16,20},{-5.55112e-16,30}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestVolumeBTh_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeBTh_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeBTh_Traces.mo new file mode 100644 index 00000000..370c3b6c --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeBTh_Traces.mo @@ -0,0 +1,35 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Volumes; +model TestVolumeBTh_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam (extraPropertiesNames={"Trace"}, C_nominal={0.1}, C_default={0.2}); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package + Medium = Medium) annotation (Placement(transformation(extent={{-10,-10}, + {10,10}}, + rotation=90, + origin={0,36}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare + replaceable package Medium = Medium, + Q0=100, + SubC0={0.5}) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.Fluid.Volumes.VolumeBTh + volumeBTh( + redeclare package Medium = Medium, + V=1, + dynamic_mass_balance=false) annotation (Placement(transformation(extent={{-10,-10}, + {10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare replaceable + package Medium = Medium, + SubC0={0.2}) annotation (Placement(transformation(extent={{-10,-10}, + {10,10}}, + rotation=180, + origin={38,0}))); +equation + connect(sourcePQ.C, volumeBTh.Ce1) + annotation (Line(points={{-30,0},{-10,0}}, color={0,0,0})); + connect(volumeBTh.Ce2, sourceQ.C) annotation (Line(points={{10,0},{19,0},{19, + 7.21645e-16},{28,7.21645e-16}}, color={0,0,0})); + connect(volumeBTh.Cs1, sink.C) + annotation (Line(points={{0,10},{0,26},{-6.66134e-16,26}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestVolumeBTh_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order index 2437a0f0..32d66d74 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order @@ -13,3 +13,6 @@ TestVolumeB_Traces TestVolumeI TestVolumeI_FlueGases TestVolumeI_Traces +TestVolumeBTh +TestVolumeBTh_FlueGases +TestVolumeBTh_Traces \ No newline at end of file diff --git a/ThermoSysPro/Fluid/Volumes/VolumeBTh.mo b/ThermoSysPro/Fluid/Volumes/VolumeBTh.mo index 39abb217..6c7ed0f2 100644 --- a/ThermoSysPro/Fluid/Volumes/VolumeBTh.mo +++ b/ThermoSysPro/Fluid/Volumes/VolumeBTh.mo @@ -1,10 +1,9 @@ -within ThermoSysPro.Fluid.Volumes; +within ThermoSysPro.Fluid.Volumes; model VolumeBTh "Mixing volume with 2 inlets, 2 outlets and 1 thermal input" - extends - ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidTypeParameterInterface; + extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable function SaS = Medium.noSaS(SubC=SubC) annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Boolean dynamic_energy_balance=true "true: dynamic energy balance equation - false: static energy balance equation"; @@ -29,42 +28,18 @@ model VolumeBTh "Mixing volume with 2 inlets, 2 outlets and 1 thermal input" "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; parameter Units.SI.Density p_rho=0 "If > 0, fixed fluid density" annotation (Evaluate=true, Dialog(tab="Fluid", group="Fluid properties")); - parameter IF97Region region=IF97Region.All_regions "IF97 region (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); parameter Boolean dynamic_composition_balance=false - "true: dynamic fluid composition balance equation
    false: static fluid composition balance equation (active for flue gases)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.FlueGases), tab="Fluid", group="Fluid properties")); + "true: dynamic fluid composition balance equation
    false: static fluid composition balance equation (active for flue gases)" annotation(Evaluate=true, Dialog(tab="Fluid", group="Fluid properties")); - parameter ThermoSysPro.Units.SI.MassFraction Xco20=0.0 - "Initial CO2 mass fraction" annotation (Evaluate=true, Dialog( - enable=dynamic_composition_balance, - tab="Fluid", - group= - "Initial composition values (active for flue gases only if dynamic_composition_balance=true)")); - parameter ThermoSysPro.Units.SI.MassFraction Xh2o0=if ftype == FluidType.FlueGases then 0.05 else 0 - "Initial H20 mass fraction" annotation (Evaluate=true, Dialog( - enable=dynamic_composition_balance, - tab="Fluid", - group= - "Initial composition values (active for flue gases only if dynamic_composition_balance=true)")); - parameter ThermoSysPro.Units.SI.MassFraction Xo20=0.23 - "Initial O2 mass fraction" annotation (Evaluate=true, Dialog( + parameter Medium.ExtraProperty X0[Medium.nX]=Medium.X_default "Initial composition values" annotation (Evaluate=true, Dialog( enable=dynamic_composition_balance, tab="Fluid", - group= - "Initial composition values (active for flue gases only if dynamic_composition_balance=true)")); - parameter ThermoSysPro.Units.SI.MassFraction Xso20=0 - "Initial SO2 mass fraction" annotation (Evaluate=true, Dialog( - enable=dynamic_composition_balance, - tab="Fluid", - group= - "Initial composition values (active for flue gases only if dynamic_composition_balance=true)")); + group="Medium")); protected - constant Units.SI.SpecificEnthalpy hr=2501569 - "Water/steam reference specific enthalpy at 0.01°C"; - parameter Boolean flue_gases=(ftype == FluidType.FlueGases) "Flue gases"; + constant Boolean isCompressible = Medium.isCompressible; parameter Units.SI.MassFlowRate gamma0=1.e-4 "Pseudo-diffusion conductance use for continuous flow reversal (active if diffusion=false and continuous_flow_reversal = true)"; - parameter Integer mode=Integer(region) - 1 "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; public Units.SI.Temperature T "Fluid temperature"; @@ -77,15 +52,12 @@ public "density derivative wrt pressure at constant specific enthalpy"; Units.SI.DerDensityByEnthalpy ddhp "density derivative wrt specific enthalpy at constant pressure"; - FluidType fluids[5] "Fluids mixing in volume"; - Units.SI.MassFlowRate BXco2 "Right hand side of the CO2 balance equation"; - Units.SI.MassFlowRate BXh2o "Right hand side of the H2O balance equation"; - Units.SI.MassFlowRate BXo2 "Right hand side of the O2 balance equation"; - Units.SI.MassFlowRate BXso2 "Right hand side of the SO2 balance equation"; - ThermoSysPro.Units.SI.MassFraction Xco2 "CO2 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xh2o "H20 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xo2 "O2 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xso2 "SO2 mass fraction"; + Units.SI.MassFlowRate BX[Medium.nXi] "Right hand side of the X balance equation"; + Medium.ExtraProperty X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Fluid mass fraction"; + Medium.ExtraProperty BSubC[Medium.nC](quantity=Medium.extraPropertiesNames) "Right hand side of the trace balance equation"; + Medium.ExtraProperty SubC[Medium.nC](quantity=Medium.extraPropertiesNames, start=Medium.C_default) "Fluid trace substances"; + Medium.ExtraProperty SubCSaS[Medium.nC](quantity=Medium.extraPropertiesNames) "Trace modification in the trace balance equation"; + Medium.ThermodynamicState state; Units.SI.Power Je1 "Thermal power diffusion from inlet e1"; Units.SI.Power Je2 "Thermal power diffusion from inlet e2"; Units.SI.Power Js1 "Thermal power diffusion from outlet s1"; @@ -101,14 +73,14 @@ public Real rs2 "Value of r(Q/gamma) for outlet s2"; public - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce1 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce1( redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-110,-10},{-90,10}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce2 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce2( redeclare package Medium = Medium) annotation (Placement( transformation(extent={{90,-10},{110,10}}, rotation=0), iconTransformation(extent={{90,-10},{110,10}}))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs1 annotation ( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs1( redeclare package Medium = Medium) annotation ( Placement(transformation(extent={{-10,90},{10,110}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs2 annotation ( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs2( redeclare package Medium = Medium) annotation ( Placement(transformation(extent={{-10,-110},{10,-90}}, rotation=0))); public Thermal.Connectors.ThermalPort Cth @@ -131,19 +103,11 @@ initial equation end if; end if; - if flue_gases then - if dynamic_composition_balance then - if steady_state then - der(Xco2) = 0; - der(Xh2o) = 0; - der(Xo2) = 0; - der(Xso2) = 0; - else - Xco2 = Xco20; - Xh2o = Xh2o0; - Xo2 = Xo20; - Xso2 = Xso20; - end if; + if dynamic_composition_balance then + if steady_state then + der(X) = fill(0,Medium.nX); + else + X = X0[1:Medium.nXi]; end if; end if; @@ -153,16 +117,6 @@ equation assert(V > 0, "Volume non-positive"); end if; - /* Check that incoming fluids are compatible with fluid in volume */ - fluids[1] = ftype; - fluids[2] = Ce1.ftype; - fluids[3] = Ce2.ftype; - fluids[4] = Cs1.ftype; - fluids[5] = Cs2.ftype; - - assert(ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.isCompatible(fluids), - "VolumeBth: fluids mixing in volume are not compatible with each other"); - /* Unconnected connectors */ if (cardinality(Ce1) == 0) then Ce1.Q = 0; @@ -170,11 +124,8 @@ equation Ce1.h_vol_1 = 1.e5; Ce1.diff_res_1 = 0; Ce1.diff_on_1 = false; - Ce1.ftype = ftype; - Ce1.Xco2 = 0; - Ce1.Xh2o = 0; - Ce1.Xo2 = 0; - Ce1.Xso2 = 0; + Ce1.Xi = Medium.X_default[1:Medium.nXi]; + Ce1.SubC = Medium.C_default; end if; if (cardinality(Ce2) == 0) then @@ -183,11 +134,8 @@ equation Ce2.h_vol_1 = 1.e5; Ce2.diff_res_1 = 0; Ce2.diff_on_1 = false; - Ce2.ftype = ftype; - Ce2.Xco2 = 0; - Ce2.Xh2o = 0; - Ce2.Xo2 = 0; - Ce2.Xso2 = 0; + Ce1.Xi = Medium.X_default[1:Medium.nXi]; + Ce1.SubC = Medium.C_default; end if; if (cardinality(Cs1) == 0) then @@ -208,7 +156,7 @@ equation BQ = Ce1.Q + Ce2.Q - Cs1.Q - Cs2.Q; if isCompressible and dynamic_energy_balance and dynamic_mass_balance then - V*(ddph*der(P) + ddhp*der(h - Xh2o*hr)) = BQ; + V*(ddph*der(P) + ddhp*der(h)) = BQ; else 0 = BQ; end if; @@ -219,13 +167,13 @@ equation P = Cs2.P; /* Energy balance equation */ - BH = Ce1.Q*(Ce1.h - Ce1.Xh2o*hr) + Ce2.Q*(Ce2.h - Ce2.Xh2o*hr) - Cs1.Q*(Cs1.h - Cs1.Xh2o*hr) - Cs2.Q*(Cs2.h - Cs2.Xh2o*hr) + Cth.W + J; + BH = Ce1.Q*Ce1.h + Ce2.Q*Ce2.h - Cs1.Q*Cs1.h - Cs2.Q*Cs2.h + Cth.W + J; if dynamic_energy_balance then if dynamic_mass_balance then - V*(((h - Xh2o*hr)*ddph - 1)*der(P) + ((h - Xh2o*hr)*ddhp + rho)*der(h - Xh2o*hr)) = BH; + V*((h*ddph - 1)*der(P) + (h*ddhp + rho)*der(h)) = BH; else - V*rho*der(h - Xh2o*hr) = BH; + V*rho*der(h) = BH; end if; else BH = 0; @@ -237,42 +185,30 @@ equation Cs2.h_vol_1 = h; /* Fluid composition balance equations */ - BXco2 = Ce1.Xco2*Ce1.Q + Ce2.Xco2*Ce2.Q - Cs1.Xco2*Cs1.Q - Cs2.Xco2*Cs2.Q; - BXh2o = Ce1.Xh2o*Ce1.Q + Ce2.Xh2o*Ce2.Q - Cs1.Xh2o*Cs1.Q - Cs2.Xh2o*Cs2.Q; - BXo2 = Ce1.Xo2*Ce1.Q + Ce2.Xo2*Ce2.Q - Cs1.Xo2*Cs1.Q - Cs2.Xo2*Cs2.Q; - BXso2 = Ce1.Xso2*Ce1.Q + Ce2.Xso2*Ce2.Q - Cs1.Xso2*Cs1.Q - Cs2.Xso2*Cs2.Q; - - if flue_gases then - if dynamic_composition_balance then - V*rho*der(Xco2) + Xco2*BQ = BXco2; - V*rho*der(Xh2o) + Xh2o*BQ = BXh2o; - V*rho*der(Xo2) + Xo2*BQ = BXo2; - V*rho*der(Xso2) + Xso2*BQ = BXso2; - else - Xco2*BQ = BXco2; - Xh2o*BQ = BXh2o; - Xo2*BQ = BXo2; - Xso2*BQ = BXso2; - end if; + BX = Ce1.Xi*Ce1.Q + Ce2.Xi*Ce2.Q - Cs1.Xi*Cs1.Q - Cs2.Xi*Cs2.Q; + + if dynamic_composition_balance then + V*rho*der(X) + X*BQ = BX; else - Xco2 = 0; - Xh2o = 0; - Xo2 = 0; - Xso2 = 0; + X*BQ = BX; end if; - Cs1.ftype = ftype; - Cs2.ftype = ftype; + Cs1.Xi = X; - Cs1.Xco2 = Xco2; - Cs1.Xh2o = Xh2o; - Cs1.Xo2 = Xo2; - Cs1.Xso2 = Xso2; + Cs2.Xi = X; - Cs2.Xco2 = Xco2; - Cs2.Xh2o = Xh2o; - Cs2.Xo2 = Xo2; - Cs2.Xso2 = Xso2; + /* Traces composition balance equations */ + BSubC = Ce1.Q*Ce1.SubC + Ce2.Q*Ce2.SubC - Cs1.Q*Cs1.SubC - Cs2.Q*Cs2.SubC; + + SubCSaS = SaS(); + if dynamic_mass_balance then + V*rho*der(SubC) + SubC*BQ + V*rho*SubCSaS = BSubC; + else + V*rho*SubCSaS = BSubC; + end if; + + Cs1.SubC = SubC; + Cs2.SubC = SubC; /* Flow reversal */ if continuous_flow_reversal then @@ -330,21 +266,23 @@ equation /* Fluid thermodynamic properties */ if isCompressible and dynamic_mass_balance then - ddph = ThermoSysPro.Properties.Fluid.Density_derp_Ph(P, h, fluid, mode, Xco2, Xh2o, Xo2, Xso2); - ddhp = ThermoSysPro.Properties.Fluid.Density_derh_Ph(P, h, fluid, mode, Xco2, Xh2o, Xo2, Xso2); + ddph = Medium.density_derp_h(state); + ddhp = Medium.density_derh_p(state); else ddph = 0; ddhp = 0; end if; - T = ThermoSysPro.Properties.Fluid.Temperature_Ph(P, h, fluid, mode, Xco2, Xh2o, Xo2, Xso2); + state = Medium.setState_phX(p=P, h=h, X=X); + + T = Medium.temperature(state); Cth.T = T; if (p_rho > 0) then rho = p_rho; else - rho = ThermoSysPro.Properties.Fluid.Density_Ph(P, h, fluid, mode, Xco2, Xh2o, Xo2, Xso2); + rho = Medium.density(state); end if; annotation ( From f6fd3324eb247d2350ed53fabf1a24658e2ac17c Mon Sep 17 00:00:00 2001 From: LAMBLOT Simon Date: Mon, 23 Jun 2025 11:35:53 +0200 Subject: [PATCH 070/178] VolumeCTh --- .../SimpleExamples/Volumes/TestVolumeCTh.mo | 23 +++ .../Volumes/TestVolumeCTh_FlueGases.mo | 30 +++ .../Volumes/TestVolumeCTh_Traces.mo | 25 +++ .../SimpleExamples/Volumes/package.order | 3 + ThermoSysPro/Fluid/Volumes/VolumeCTh.mo | 176 ++++++------------ 5 files changed, 138 insertions(+), 119 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeCTh.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeCTh_FlueGases.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeCTh_Traces.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeCTh.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeCTh.mo new file mode 100644 index 00000000..3dd55013 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeCTh.mo @@ -0,0 +1,23 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Volumes; +model TestVolumeCTh + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam; + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package + Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare + replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.Fluid.Volumes.VolumeCTh + volumeCTh( + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare replaceable + package Medium = Medium) annotation (Placement(transformation(extent={{-50,20},{-30,40}}))); +equation + connect(sourcePQ.C, volumeCTh.Ce1) + annotation (Line(points={{-30,0},{-10,0}}, color={0,0,0})); + connect(sink.C, volumeCTh.Cs) + annotation (Line(points={{30,0},{10,0}}, color={0,0,0})); + connect(volumeCTh.Ce2, sourceQ.C) + annotation (Line(points={{0,10},{0,30},{-30,30}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestVolumeCTh; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeCTh_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeCTh_FlueGases.mo new file mode 100644 index 00000000..2d2b65e5 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeCTh_FlueGases.mo @@ -0,0 +1,30 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Volumes; +model TestVolumeCTh_FlueGases + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.FlueGases; + ThermoSysPro.Fluid.BoundaryConditions.Sink sink( + redeclare replaceable package Medium = Medium, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ( + redeclare replaceable package Medium = Medium, + P0=4500000, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.Fluid.Volumes.VolumeCTh + volumeCTh( + redeclare package Medium = Medium, h(start=2.83057e6)) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ( + redeclare replaceable package Medium = Medium, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{-50,20},{-30,40}}))); +equation + connect(sourcePQ.C, volumeCTh.Ce1) + annotation (Line(points={{-30,0},{-10,0}}, color={0,0,0})); + connect(sink.C, volumeCTh.Cs) + annotation (Line(points={{30,0},{10,0}}, color={0,0,0})); + connect(volumeCTh.Ce2, sourceQ.C) + annotation (Line(points={{0,10},{0,30},{-30,30}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestVolumeCTh_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeCTh_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeCTh_Traces.mo new file mode 100644 index 00000000..a6b7f274 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeCTh_Traces.mo @@ -0,0 +1,25 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Volumes; +model TestVolumeCTh_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam(extraPropertiesNames={"Trace"}, C_nominal={0.1}, C_default={0.2}); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package + Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare + replaceable package Medium = Medium, SubC0={0.2}) + annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.Fluid.Volumes.VolumeCTh + volumeCTh( + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare replaceable + package Medium = Medium, SubC0={0.1}) + annotation (Placement(transformation(extent={{-50,20},{-30,40}}))); +equation + connect(sourcePQ.C, volumeCTh.Ce1) + annotation (Line(points={{-30,0},{-10,0}}, color={0,0,0})); + connect(sink.C, volumeCTh.Cs) + annotation (Line(points={{30,0},{10,0}}, color={0,0,0})); + connect(volumeCTh.Ce2, sourceQ.C) + annotation (Line(points={{0,10},{0,30},{-30,30}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestVolumeCTh_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order index 2437a0f0..cdf8a9a3 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order @@ -13,3 +13,6 @@ TestVolumeB_Traces TestVolumeI TestVolumeI_FlueGases TestVolumeI_Traces +TestVolumeCTh +TestVolumeCTh_FlueGases +TestVolumeCTh_Traces \ No newline at end of file diff --git a/ThermoSysPro/Fluid/Volumes/VolumeCTh.mo b/ThermoSysPro/Fluid/Volumes/VolumeCTh.mo index 335ddb1a..46867e0b 100644 --- a/ThermoSysPro/Fluid/Volumes/VolumeCTh.mo +++ b/ThermoSysPro/Fluid/Volumes/VolumeCTh.mo @@ -1,10 +1,9 @@ -within ThermoSysPro.Fluid.Volumes; +within ThermoSysPro.Fluid.Volumes; model VolumeCTh "Mixing volume with 3 inlets, 1 outlet and 1 thermal input" - extends - ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidTypeParameterInterface; + extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable function SaS = Medium.noSaS(SubC=SubC) annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Boolean dynamic_energy_balance=true "true: dynamic energy balance equation - false: static energy balance equation"; @@ -29,42 +28,17 @@ model VolumeCTh "Mixing volume with 3 inlets, 1 outlet and 1 thermal input" "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; parameter Units.SI.Density p_rho=0 "If > 0, fixed fluid density" annotation (Evaluate=true, Dialog(tab="Fluid", group="Fluid properties")); - parameter IF97Region region=IF97Region.All_regions "IF97 region (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); parameter Boolean dynamic_composition_balance=false - "true: dynamic fluid composition balance equation
    false: static fluid composition balance equation (active for flue gases)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.FlueGases), tab="Fluid", group="Fluid properties")); - - parameter ThermoSysPro.Units.SI.MassFraction Xco20=0.0 - "Initial CO2 mass fraction" annotation (Evaluate=true, Dialog( - enable=dynamic_composition_balance, - tab="Fluid", - group= - "Initial composition values (active for flue gases only if dynamic_composition_balance=true)")); - parameter ThermoSysPro.Units.SI.MassFraction Xh2o0=if ftype == FluidType.FlueGases then 0.05 else 0 - "Initial H20 mass fraction" annotation (Evaluate=true, Dialog( - enable=dynamic_composition_balance, - tab="Fluid", - group= - "Initial composition values (active for flue gases only if dynamic_composition_balance=true)")); - parameter ThermoSysPro.Units.SI.MassFraction Xo20=0.23 - "Initial O2 mass fraction" annotation (Evaluate=true, Dialog( + "true: dynamic fluid composition balance equation
    false: static fluid composition balance equation (active for flue gases)" annotation(Evaluate=true, Dialog(tab="Fluid", group="Fluid properties")); + parameter Medium.ExtraProperty X0[Medium.nX]=Medium.X_default "Initial composition values" annotation (Evaluate=true, Dialog( enable=dynamic_composition_balance, tab="Fluid", - group= - "Initial composition values (active for flue gases only if dynamic_composition_balance=true)")); - parameter ThermoSysPro.Units.SI.MassFraction Xso20=0 - "Initial SO2 mass fraction" annotation (Evaluate=true, Dialog( - enable=dynamic_composition_balance, - tab="Fluid", - group= - "Initial composition values (active for flue gases only if dynamic_composition_balance=true)")); + group="Medium")); protected - constant Units.SI.SpecificEnthalpy hr=2501569 - "Water/steam reference specific enthalpy at 0.01°C"; - parameter Boolean flue_gases=(ftype == FluidType.FlueGases) "Flue gases"; + constant Boolean isCompressible = Medium.isCompressible; parameter Units.SI.MassFlowRate gamma0=1.e-4 "Pseudo-diffusion conductance use for continuous flow reversal (active if diffusion=false and continuous_flow_reversal = true)"; - parameter Integer mode=Integer(region) - 1 "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; public Units.SI.Temperature T "Fluid temperature"; @@ -77,15 +51,12 @@ public "density derivative wrt pressure at constant specific enthalpy"; Units.SI.DerDensityByEnthalpy ddhp "density derivative wrt specific enthalpy at constant pressure"; - FluidType fluids[5] "Fluids mixing in volume"; - Units.SI.MassFlowRate BXco2 "Right hand side of the CO2 balance equation"; - Units.SI.MassFlowRate BXh2o "Right hand side of the H2O balance equation"; - Units.SI.MassFlowRate BXo2 "Right hand side of the O2 balance equation"; - Units.SI.MassFlowRate BXso2 "Right hand side of the SO2 balance equation"; - ThermoSysPro.Units.SI.MassFraction Xco2 "CO2 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xh2o "H20 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xo2 "O2 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xso2 "SO2 mass fraction"; + Units.SI.MassFlowRate BX[Medium.nXi] "Right hand side of the X balance equation"; + Medium.ExtraProperty X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Fluid mass fraction"; + Medium.ExtraProperty BSubC[Medium.nC](quantity=Medium.extraPropertiesNames) "Right hand side of the trace balance equation"; + Medium.ExtraProperty SubC[Medium.nC](quantity=Medium.extraPropertiesNames, start=Medium.C_default) "Fluid trace substances"; + Medium.ExtraProperty SubCSaS[Medium.nC](quantity=Medium.extraPropertiesNames) "Trace modification in the trace balance equation"; + Medium.ThermodynamicState state; Units.SI.Power Je1 "Thermal power diffusion from inlet e1"; Units.SI.Power Je2 "Thermal power diffusion from inlet e2"; Units.SI.Power Je3 "Thermal power diffusion from inlet e3"; @@ -100,15 +71,15 @@ public Real re3 "Value of r(Q/gamma) for inlet e3"; Real rs "Value of r(Q/gamma) for outlet s"; - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce1 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce1(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-110,-10},{-90,10}}, rotation=0), iconTransformation(extent={{-110,-10},{-90,10}}))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce2 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce2(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-10,90},{10,110}}, rotation=0), iconTransformation(extent={{-10,90},{10,110}}))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{90,-10},{110,10}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce3 annotation (Placement(transformation( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce3(redeclare package Medium = Medium) annotation (Placement(transformation( extent={{-10,-110},{10,-90}}), iconTransformation(extent={{-10,-110},{ 10,-90}}))); public @@ -132,19 +103,11 @@ initial equation end if; end if; - if flue_gases then - if dynamic_composition_balance then - if steady_state then - der(Xco2) = 0; - der(Xh2o) = 0; - der(Xo2) = 0; - der(Xso2) = 0; - else - Xco2 = Xco20; - Xh2o = Xh2o0; - Xo2 = Xo20; - Xso2 = Xso20; - end if; + if dynamic_composition_balance then + if steady_state then + der(X) = fill(0,Medium.nX); + else + X = X0[1:Medium.nXi]; end if; end if; @@ -154,16 +117,6 @@ equation assert(V > 0, "Volume non-positive"); end if; - /* Check that incoming fluids are compatible with fluid in volume */ - fluids[1] = ftype; - fluids[2] = Ce1.ftype; - fluids[3] = Ce2.ftype; - fluids[4] = Ce3.ftype; - fluids[5] = Cs.ftype; - - assert(ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.isCompatible(fluids), - "VolumeCTh: fluids mixing in volume are not compatible with each other"); - /* Unconnected connectors */ if (cardinality(Ce1) == 0) then Ce1.Q = 0; @@ -171,11 +124,8 @@ equation Ce1.h_vol_1 = 1.e5; Ce1.diff_res_1 = 0; Ce1.diff_on_1 = false; - Ce1.ftype = ftype; - Ce1.Xco2 = 0; - Ce1.Xh2o = 0; - Ce1.Xo2 = 0; - Ce1.Xso2 = 0; + Ce1.Xi = Medium.X_default[1:Medium.nXi]; + Ce1.SubC = Medium.C_default; end if; if (cardinality(Ce2) == 0) then @@ -184,11 +134,8 @@ equation Ce2.h_vol_1 = 1.e5; Ce2.diff_res_1 = 0; Ce2.diff_on_1 = false; - Ce2.ftype = ftype; - Ce2.Xco2 = 0; - Ce2.Xh2o = 0; - Ce2.Xo2 = 0; - Ce2.Xso2 = 0; + Ce1.Xi = Medium.X_default[1:Medium.nXi]; + Ce1.SubC = Medium.C_default; end if; if (cardinality(Ce3) == 0) then @@ -197,11 +144,8 @@ equation Ce3.h_vol_1 = 1.e5; Ce3.diff_res_1 = 0; Ce3.diff_on_1 = false; - Ce3.ftype = ftype; - Ce3.Xco2 = 0; - Ce3.Xh2o = 0; - Ce3.Xo2 = 0; - Ce3.Xso2 = 0; + Ce3.Xi = Medium.X_default[1:Medium.nXi]; + Ce3.SubC = Medium.C_default; end if; if (cardinality(Cs) == 0) then @@ -215,7 +159,7 @@ equation BQ = Ce1.Q + Ce2.Q + Ce3.Q - Cs.Q; if isCompressible and dynamic_energy_balance and dynamic_mass_balance then - V*(ddph*der(P) + ddhp*der(h - Xh2o*hr)) = BQ; + V*(ddph*der(P) + ddhp*der(h)) = BQ; else 0 = BQ; end if; @@ -226,13 +170,13 @@ equation P = Cs.P; /* Energy balance equation */ - BH = Ce1.Q*(Ce1.h - Ce1.Xh2o*hr) + Ce2.Q*(Ce2.h - Ce2.Xh2o*hr) + Ce3.Q*(Ce3.h - Ce3.Xh2o *hr) - Cs.Q*(Cs.h - Cs.Xh2o*hr) + Cth.W + J; + BH = Ce1.Q*Ce1.h + Ce2.Q*Ce2.h + Ce3.Q*Ce3.h - Cs.Q*Cs.h + Cth.W + J; if dynamic_energy_balance then if dynamic_mass_balance then - V*(((h - Xh2o*hr)*ddph - 1)*der(P) + ((h - Xh2o*hr)*ddhp + rho)*der(h - Xh2o*hr)) = BH; + V*((h*ddph - 1)*der(P) + (h*ddhp + rho)*der(h)) = BH; else - V*rho*der(h - Xh2o*hr) = BH; + V*rho*der(h) = BH; end if; else BH = 0; @@ -244,36 +188,28 @@ equation Cs.h_vol_1 = h; /* Fluid composition balance equations */ - BXco2 = Ce1.Xco2*Ce1.Q + Ce2.Xco2*Ce2.Q + Ce3.Xco2*Ce3.Q - Cs.Xco2*Cs.Q; - BXh2o = Ce1.Xh2o*Ce1.Q + Ce2.Xh2o*Ce2.Q + Ce3.Xh2o*Ce3.Q - Cs.Xh2o*Cs.Q; - BXo2 = Ce1.Xo2*Ce1.Q + Ce2.Xo2*Ce2.Q + Ce3.Xo2*Ce3.Q - Cs.Xo2*Cs.Q; - BXso2 = Ce1.Xso2*Ce1.Q + Ce2.Xso2*Ce2.Q + Ce3.Xso2*Ce3.Q - Cs.Xso2*Cs.Q; - - if flue_gases then - if dynamic_composition_balance then - V*rho*der(Xco2) + Xco2*BQ = BXco2; - V*rho*der(Xh2o) + Xh2o*BQ = BXh2o; - V*rho*der(Xo2) + Xo2*BQ = BXo2; - V*rho*der(Xso2) + Xso2*BQ = BXso2; - else - Xco2*BQ = BXco2; - Xh2o*BQ = BXh2o; - Xo2*BQ = BXo2; - Xso2*BQ = BXso2; - end if; + BX = Ce1.Xi*Ce1.Q + Ce2.Xi*Ce2.Q + Ce3.Xi*Ce3.Q - Cs.Xi*Cs.Q; + + if dynamic_composition_balance then + V*rho*der(X) + X*BQ = BX; + else + X*BQ = BX; + end if; + + + /* Traces composition balance equations */ + BSubC = Ce1.Q*Ce1.SubC + Ce2.Q*Ce2.SubC + Ce3.Q*Ce3.SubC - Cs.Q*Cs.SubC; + + SubCSaS = SaS(); + if dynamic_mass_balance then + V*rho*der(SubC) + SubC*BQ + V*rho*SubCSaS = BSubC; else - Xco2 = 0; - Xh2o = 0; - Xo2 = 0; - Xso2 = 0; + V*rho*SubCSaS = BSubC; end if; - Cs.ftype = ftype; + Cs.SubC = SubC; - Cs.Xco2 = Xco2; - Cs.Xh2o = Xh2o; - Cs.Xo2 = Xo2; - Cs.Xso2 = Xso2; + Cs.Xi = X; /* Flow reversal */ if continuous_flow_reversal then @@ -329,21 +265,23 @@ equation /* Fluid thermodynamic properties */ if isCompressible and dynamic_mass_balance then - ddph = ThermoSysPro.Properties.Fluid.Density_derp_Ph(P, h, fluid, mode, Xco2, Xh2o, Xo2, Xso2); - ddhp = ThermoSysPro.Properties.Fluid.Density_derh_Ph(P, h, fluid, mode, Xco2, Xh2o, Xo2, Xso2); + ddph = Medium.density_derp_h(state); + ddhp = Medium.density_derh_p(state); else ddph = 0; ddhp = 0; end if; - T = ThermoSysPro.Properties.Fluid.Temperature_Ph(P, h, fluid, mode, Xco2, Xh2o, Xo2, Xso2); + state = Medium.setState_phX(p=P, h=h, X=X); + + T = Medium.temperature(state); Cth.T = T; if (p_rho > 0) then rho = p_rho; else - rho = ThermoSysPro.Properties.Fluid.Density_Ph(P, h, fluid, mode, Xco2, Xh2o, Xo2, Xso2); + rho = Medium.density(state); end if; annotation ( From 2e97e326482a507a86b08e71ab57489fd5852f33 Mon Sep 17 00:00:00 2001 From: LAMBLOT Simon Date: Mon, 23 Jun 2025 14:44:56 +0200 Subject: [PATCH 071/178] VolumeDTh --- .../SimpleExamples/Volumes/TestVolumeDTh.mo | 27 +++ .../Volumes/TestVolumeDTh_FlueGases.mo | 34 ++++ .../Volumes/TestVolumeDTh_Traces.mo | 35 ++++ .../SimpleExamples/Volumes/package.order | 3 + ThermoSysPro/Fluid/Volumes/VolumeDTh.mo | 173 ++++++------------ 5 files changed, 153 insertions(+), 119 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeDTh.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeDTh_FlueGases.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeDTh_Traces.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeDTh.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeDTh.mo new file mode 100644 index 00000000..ce8714ea --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeDTh.mo @@ -0,0 +1,27 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Volumes; +model TestVolumeDTh + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package + Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.Volumes.VolumeDTh + volumeDTh( + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ( + redeclare replaceable + package Medium = Medium) annotation (Placement(transformation(extent={{-52,-10}, + {-32,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkQ( + redeclare replaceable + package Medium = Medium) annotation (Placement(transformation(extent={{12,22}, + {32,42}}))); +equation + connect(sourcePQ.C, volumeDTh.Ce) + annotation (Line(points={{-32,0},{-10,0}}, color={0,0,0})); + connect(volumeDTh.Cs3, sink.C) + annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(volumeDTh.Cs1, sinkQ.C) + annotation (Line(points={{0,10},{0,32},{12,32}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestVolumeDTh; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeDTh_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeDTh_FlueGases.mo new file mode 100644 index 00000000..2085ae1b --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeDTh_FlueGases.mo @@ -0,0 +1,34 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Volumes; +model TestVolumeDTh_FlueGases + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.FlueGases; + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package + Medium = Medium, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{26,16}, + {46,36}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare + replaceable package Medium = Medium, + P0=4500000, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.Fluid.Volumes.VolumeDTh + volumeDTh( + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkQ( redeclare replaceable + package Medium = Medium, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{-10,-10}, + {10,10}}, + rotation=0, + origin={40,0}))); +equation + connect(volumeDTh.Cs1, sink.C) + annotation (Line(points={{0,10},{0,26},{26,26}}, color={0,0,0})); + connect(sourcePQ.C, volumeDTh.Ce) + annotation (Line(points={{-30,0},{-10,0}}, color={0,0,0})); + connect(volumeDTh.Cs3, sinkQ.C) + annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestVolumeDTh_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeDTh_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeDTh_Traces.mo new file mode 100644 index 00000000..5a61dd4e --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeDTh_Traces.mo @@ -0,0 +1,35 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Volumes; +model TestVolumeDTh_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam ( + extraPropertiesNames={"Trace"}, + C_nominal={0.1}, + C_default={0.2}); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package + Medium = Medium) annotation (Placement(transformation(extent={{20,20}, + {40,40}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare + replaceable package Medium = Medium, + Q0=100, + SubC0={0.5}) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.Fluid.Volumes.VolumeDTh + volumeDTh( + redeclare package Medium = Medium, + V=1, + dynamic_mass_balance=false) annotation (Placement(transformation(extent={{-12,-10}, + {8,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkQ( redeclare replaceable + package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10}, + {10,10}}, + rotation=0, + origin={40,0}))); +equation + connect(volumeDTh.Cs1, sink.C) + annotation (Line(points={{-2,10},{-2,30},{20,30}}, color={0,0,0})); + connect(sourcePQ.C, volumeDTh.Ce) + annotation (Line(points={{-30,0},{-12,0}}, color={0,0,0})); + connect(volumeDTh.Cs3, sinkQ.C) + annotation (Line(points={{8,0},{30,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestVolumeDTh_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order index 2437a0f0..fc6a33ae 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order @@ -13,3 +13,6 @@ TestVolumeB_Traces TestVolumeI TestVolumeI_FlueGases TestVolumeI_Traces +TestVolumeDTh +TestVolumeDTh_FlueGases +TestVolumeDTh_Traces \ No newline at end of file diff --git a/ThermoSysPro/Fluid/Volumes/VolumeDTh.mo b/ThermoSysPro/Fluid/Volumes/VolumeDTh.mo index c8a846a8..39210ed0 100644 --- a/ThermoSysPro/Fluid/Volumes/VolumeDTh.mo +++ b/ThermoSysPro/Fluid/Volumes/VolumeDTh.mo @@ -1,10 +1,9 @@ -within ThermoSysPro.Fluid.Volumes; +within ThermoSysPro.Fluid.Volumes; model VolumeDTh "Mixing volume with 1 inlet, 3 outlets and 1 thermal input" - extends - ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidTypeParameterInterface; + extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable function SaS = Medium.noSaS(SubC=SubC) annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Boolean dynamic_energy_balance=true "true: dynamic energy balance equation - false: static energy balance equation"; @@ -29,42 +28,17 @@ model VolumeDTh "Mixing volume with 1 inlet, 3 outlets and 1 thermal input" "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; parameter Units.SI.Density p_rho=0 "If > 0, fixed fluid density" annotation (Evaluate=true, Dialog(tab="Fluid", group="Fluid properties")); - parameter IF97Region region=IF97Region.All_regions "IF97 region (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); parameter Boolean dynamic_composition_balance=false - "true: dynamic fluid composition balance equation
    false: static fluid composition balance equation (active for flue gases)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.FlueGases), tab="Fluid", group="Fluid properties")); - - parameter ThermoSysPro.Units.SI.MassFraction Xco20=0.0 - "Initial CO2 mass fraction" annotation (Evaluate=true, Dialog( + "true: dynamic fluid composition balance equation
    false: static fluid composition balance equation (active for flue gases)" annotation(Evaluate=true, Dialog(tab="Fluid", group="Fluid properties")); + parameter Medium.ExtraProperty X0[Medium.nX]=Medium.X_default "Initial composition values" annotation (Evaluate=true, Dialog( enable=dynamic_composition_balance, tab="Fluid", - group= - "Initial composition values (active for flue gases only if dynamic_composition_balance=true)")); - parameter ThermoSysPro.Units.SI.MassFraction Xh2o0=if ftype == FluidType.FlueGases then 0.05 else 0 - "Initial H20 mass fraction" annotation (Evaluate=true, Dialog( - enable=dynamic_composition_balance, - tab="Fluid", - group= - "Initial composition values (active for flue gases only if dynamic_composition_balance=true)")); - parameter ThermoSysPro.Units.SI.MassFraction Xo20=0.23 - "Initial O2 mass fraction" annotation (Evaluate=true, Dialog( - enable=dynamic_composition_balance, - tab="Fluid", - group= - "Initial composition values (active for flue gases only if dynamic_composition_balance=true)")); - parameter ThermoSysPro.Units.SI.MassFraction Xso20=0 - "Initial SO2 mass fraction" annotation (Evaluate=true, Dialog( - enable=dynamic_composition_balance, - tab="Fluid", - group= - "Initial composition values (active for flue gases only if dynamic_composition_balance=true)")); + group="Medium")); protected - constant Units.SI.SpecificEnthalpy hr=2501569 - "Water/steam reference specific enthalpy at 0.01°C"; - parameter Boolean flue_gases=(ftype == FluidType.FlueGases) "Flue gases"; + constant Boolean isCompressible = Medium.isCompressible; parameter Units.SI.MassFlowRate gamma0=1.e-4 "Pseudo-diffusion conductance use for continuous flow reversal (active if diffusion=false and continuous_flow_reversal = true)"; - parameter Integer mode=Integer(region) - 1 "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; public Units.SI.Temperature T "Fluid temperature"; @@ -77,15 +51,12 @@ public "density derivative wrt pressure at constant specific enthalpy"; Units.SI.DerDensityByEnthalpy ddhp "density derivative wrt specific enthalpy at constant pressure"; - FluidType fluids[5] "Fluids mixing in volume"; - Units.SI.MassFlowRate BXco2 "Right hand side of the CO2 balance equation"; - Units.SI.MassFlowRate BXh2o "Right hand side of the H2O balance equation"; - Units.SI.MassFlowRate BXo2 "Right hand side of the O2 balance equation"; - Units.SI.MassFlowRate BXso2 "Right hand side of the SO2 balance equation"; - ThermoSysPro.Units.SI.MassFraction Xco2 "CO2 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xh2o "H20 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xo2 "O2 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xso2 "SO2 mass fraction"; + Units.SI.MassFlowRate BX[Medium.nXi] "Right hand side of the X balance equation"; + Medium.ExtraProperty X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Fluid mass fraction"; + Medium.ExtraProperty BSubC[Medium.nC](quantity=Medium.extraPropertiesNames) "Right hand side of the trace balance equation"; + Medium.ExtraProperty SubC[Medium.nC](quantity=Medium.extraPropertiesNames, start=Medium.C_default) "Fluid trace substances"; + Medium.ExtraProperty SubCSaS[Medium.nC](quantity=Medium.extraPropertiesNames) "Trace modification in the trace balance equation"; + Medium.ThermodynamicState state; Units.SI.Power Je "Thermal power diffusion from inlet e"; Units.SI.Power Js1 "Thermal power diffusion from outlet s1"; Units.SI.Power Js2 "Thermal power diffusion from outlet s2"; @@ -101,13 +72,13 @@ public Real rs3 "Value of r(Q/gamma) for outlet s3"; public - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-110,-10},{-90,10}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs1 annotation ( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs1(redeclare package Medium = Medium) annotation ( Placement(transformation(extent={{-10,90},{10,110}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs2 annotation ( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs2(redeclare package Medium = Medium) annotation ( Placement(transformation(extent={{-10,-110},{10,-90}}, rotation=0))); - Interfaces.Connectors.FluidOutlet Cs3 + Interfaces.Connectors.FluidOutlet Cs3(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{90,-10},{110,10}}))); Thermal.Connectors.ThermalPort Cth annotation (Placement(transformation( @@ -129,19 +100,11 @@ initial equation end if; end if; - if flue_gases then - if dynamic_composition_balance then - if steady_state then - der(Xco2) = 0; - der(Xh2o) = 0; - der(Xo2) = 0; - der(Xso2) = 0; - else - Xco2 = Xco20; - Xh2o = Xh2o0; - Xo2 = Xo20; - Xso2 = Xso20; - end if; + if dynamic_composition_balance then + if steady_state then + der(X) = fill(0,Medium.nX); + else + X = X0[1:Medium.nXi]; end if; end if; @@ -151,16 +114,6 @@ equation assert(V > 0, "Volume non-positive"); end if; - /* Check that incoming fluids are compatible with fluid in volume */ - fluids[1] = ftype; - fluids[2] = Ce.ftype; - fluids[3] = Cs1.ftype; - fluids[4] = Cs2.ftype; - fluids[5] = Cs3.ftype; - - assert(ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.isCompatible(fluids), - "VolumeDTh: fluids mixing in volume are not compatible with each other"); - /* Unconnected connectors */ if (cardinality(Ce) == 0) then Ce.Q = 0; @@ -168,11 +121,8 @@ equation Ce.h_vol_1 = 1.e5; Ce.diff_res_1 = 0; Ce.diff_on_1 = false; - Ce.ftype = ftype; - Ce.Xco2 = 0; - Ce.Xh2o = 0; - Ce.Xo2 = 0; - Ce.Xso2 = 0; + Ce.Xi = Medium.X_default[1:Medium.nXi]; + Ce.SubC = Medium.C_default; end if; if (cardinality(Cs1) == 0) then @@ -200,7 +150,7 @@ equation BQ = Ce.Q - Cs1.Q - Cs2.Q - Cs3.Q; if isCompressible and dynamic_energy_balance and dynamic_mass_balance then - V*(ddph*der(P) + ddhp*der(h - Xh2o*hr)) = BQ; + V*(ddph*der(P) + ddhp*der(h)) = BQ; else 0 = BQ; end if; @@ -211,13 +161,13 @@ equation P = Cs3.P; /* Energy balance equation */ - BH = Ce.Q*(Ce.h - Ce.Xh2o*hr) - Cs1.Q*(Cs1.h - Cs1.Xh2o*hr) - Cs2.Q*(Cs2.h - Cs2.Xh2o*hr) - Cs3.Q*(Cs3.h - Cs3.Xh2o*hr) + Cth.W + J; + BH = Ce.Q*Ce.h - Cs1.Q*Cs1.h - Cs2.Q*Cs2.h - Cs3.Q*Cs3.h + Cth.W + J; if dynamic_energy_balance then if dynamic_mass_balance then - V*(((h - Xh2o*hr)*ddph - 1)*der(P) + ((h - Xh2o*hr)*ddhp + rho)*der(h - Xh2o*hr)) = BH; + V*((h*ddph - 1)*der(P) + (h*ddhp + rho)*der(h)) = BH; else - V*rho*der(h - Xh2o*hr) = BH; + V*rho*der(h) = BH; end if; else BH = 0; @@ -229,48 +179,31 @@ equation Cs3.h_vol_1 = h; /* Fluid composition balance equations */ - BXco2 = Ce.Xco2*Ce.Q - Cs1.Xco2*Cs1.Q - Cs2.Xco2*Cs2.Q - Cs3.Xco2*Cs3.Q; - BXh2o = Ce.Xh2o*Ce.Q - Cs1.Xh2o*Cs1.Q - Cs2.Xh2o*Cs2.Q - Cs3.Xh2o*Cs3.Q; - BXo2 = Ce.Xo2*Ce.Q - Cs1.Xo2*Cs1.Q - Cs2.Xo2*Cs2.Q - Cs3.Xo2*Cs3.Q; - BXso2 = Ce.Xso2*Ce.Q - Cs1.Xso2*Cs1.Q - Cs2.Xso2*Cs2.Q - Cs3.Xso2*Cs3.Q; - - if flue_gases then - if dynamic_composition_balance then - V*rho*der(Xco2) + Xco2*BQ = BXco2; - V*rho*der(Xh2o) + Xh2o*BQ = BXh2o; - V*rho*der(Xo2) + Xo2*BQ = BXo2; - V*rho*der(Xso2) + Xso2*BQ = BXso2; - else - Xco2*BQ = BXco2; - Xh2o*BQ = BXh2o; - Xo2*BQ = BXo2; - Xso2*BQ = BXso2; - end if; + BX = Ce.Xi*Ce.Q - Cs1.Xi*Cs1.Q - Cs2.Xi*Cs2.Q - Cs3.Xi*Cs3.Q; + + if dynamic_composition_balance then + V*rho*der(X) + X*BQ = BX; else - Xco2 = 0; - Xh2o = 0; - Xo2 = 0; - Xso2 = 0; + X*BQ = BX; end if; - Cs1.ftype = ftype; - Cs2.ftype = ftype; - Cs3.ftype = ftype; + /* Traces composition balance equations */ + BSubC = Ce.Q*Ce.SubC - Cs1.Q*Cs1.SubC - Cs2.Q*Cs2.SubC - Cs3.Q*Cs3.SubC; - Cs1.Xco2 = Xco2; - Cs1.Xh2o = Xh2o; - Cs1.Xo2 = Xo2; - Cs1.Xso2 = Xso2; + SubCSaS = SaS(); + if dynamic_mass_balance then + V*rho*der(SubC) + SubC*BQ + V*rho*SubCSaS = BSubC; + else + V*rho*SubCSaS = BSubC; + end if; - Cs2.Xco2 = Xco2; - Cs2.Xh2o = Xh2o; - Cs2.Xo2 = Xo2; - Cs2.Xso2 = Xso2; + Cs1.SubC = SubC; + Cs2.SubC = SubC; + Cs3.SubC = SubC; - Cs3.Xco2 = Xco2; - Cs3.Xh2o = Xh2o; - Cs3.Xo2 = Xo2; - Cs3.Xso2 = Xso2; + Cs1.Xi = X; + Cs2.Xi = X; + Cs3.Xi = X; /* Flow reversal */ if continuous_flow_reversal then @@ -330,21 +263,23 @@ equation /* Fluid thermodynamic properties */ if isCompressible and dynamic_mass_balance then - ddph = ThermoSysPro.Properties.Fluid.Density_derp_Ph(P, h, fluid, mode, Xco2, Xh2o, Xo2, Xso2); - ddhp = ThermoSysPro.Properties.Fluid.Density_derh_Ph(P, h, fluid, mode, Xco2, Xh2o, Xo2, Xso2); + ddph = Medium.density_derp_h(state); + ddhp = Medium.density_derh_p(state); else ddph = 0; ddhp = 0; end if; - T = ThermoSysPro.Properties.Fluid.Temperature_Ph(P, h, fluid, mode, Xco2, Xh2o, Xo2, Xso2); + state = Medium.setState_phX(p=P, h=h, X=X); + + T = Medium.temperature(state); Cth.T = T; if (p_rho > 0) then rho = p_rho; else - rho = ThermoSysPro.Properties.Fluid.Density_Ph(P, h, fluid, mode, Xco2, Xh2o, Xo2, Xso2); + rho = Medium.density(state); end if; annotation ( From 17bcff9d50840723b1c13a758d190a432ee939c1 Mon Sep 17 00:00:00 2001 From: LAMBLOT Simon Date: Mon, 23 Jun 2025 15:29:02 +0200 Subject: [PATCH 072/178] VolumeITh --- .../SimpleExamples/Volumes/TestVolumeITh.mo | 26 +++ .../Volumes/TestVolumeITh_FlueGases.mo | 34 +++ .../Volumes/TestVolumeITh_Traces.mo | 35 +++ .../SimpleExamples/Volumes/package.order | 3 + ThermoSysPro/Fluid/Volumes/VolumeITh.mo | 214 ++++++------------ 5 files changed, 165 insertions(+), 147 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeITh.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeITh_FlueGases.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeITh_Traces.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeITh.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeITh.mo new file mode 100644 index 00000000..86bd3bb8 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeITh.mo @@ -0,0 +1,26 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Volumes; +model TestVolumeITh + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package + Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.Volumes.VolumeITh + volumeITh( + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ( + redeclare replaceable + package Medium = Medium) annotation (Placement(transformation(extent={{-52,-10}, + {-32,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare replaceable + package Medium = Medium) annotation (Placement(transformation(extent={{-50,10}, + {-30,30}}))); +equation + connect(volumeITh.Cs3, sink.C) + annotation (Line(points={{10,-8},{20,-8},{20,0},{30,0}}, color={0,0,0})); + connect(sourcePQ.C, volumeITh.Ce2) + annotation (Line(points={{-32,0},{-10,0}}, color={0,0,0})); + connect(sourceQ.C, volumeITh.Ce1) + annotation (Line(points={{-30,20},{-10,20},{-10,8}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestVolumeITh; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeITh_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeITh_FlueGases.mo new file mode 100644 index 00000000..9979e040 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeITh_FlueGases.mo @@ -0,0 +1,34 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Volumes; +model TestVolumeITh_FlueGases + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.FlueGases; + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package + Medium = Medium, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{26,-18}, + {46,2}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare + replaceable package Medium = Medium, + P0=4500000, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.Fluid.Volumes.VolumeITh + volumeITh( + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare replaceable + package Medium = Medium, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{-10,-10}, + {10,10}}, + rotation=0, + origin={-40,20}))); +equation + connect(sourcePQ.C, volumeITh.Ce2) + annotation (Line(points={{-30,0},{-10,0}}, color={0,0,0})); + connect(sourceQ.C, volumeITh.Ce1) + annotation (Line(points={{-30,20},{-10,20},{-10,8}}, color={0,0,0})); + connect(volumeITh.Cs3, sink.C) + annotation (Line(points={{10,-8},{26,-8}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestVolumeITh_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeITh_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeITh_Traces.mo new file mode 100644 index 00000000..446cf493 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeITh_Traces.mo @@ -0,0 +1,35 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Volumes; +model TestVolumeITh_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam ( + extraPropertiesNames={"Trace"}, + C_nominal={0.1}, + C_default={0.2}); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package + Medium = Medium) annotation (Placement(transformation(extent={{20,20}, + {40,40}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare + replaceable package Medium = Medium, + Q0=100, + SubC0={0.5}) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.Fluid.Volumes.VolumeITh + volumeITh( + redeclare package Medium = Medium, + V=1, + dynamic_mass_balance=false) annotation (Placement(transformation(extent={{-12,-10}, + {8,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ( + redeclare replaceable package Medium = Medium, + Q0=100, + SubC0={0.5}) annotation (Placement(transformation(extent={{-56,18}, + {-36,38}}))); +equation + connect(volumeITh.Cs1, sink.C) + annotation (Line(points={{8,8},{8,30},{20,30}}, color={0,0,0})); + connect(sourcePQ.C, volumeITh.Ce2) + annotation (Line(points={{-30,0},{-12,0}}, color={0,0,0})); + connect(sourceQ.C, volumeITh.Ce1) + annotation (Line(points={{-36,28},{-12,28},{-12,8}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestVolumeITh_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order index 2437a0f0..a9d0a7ac 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order @@ -13,3 +13,6 @@ TestVolumeB_Traces TestVolumeI TestVolumeI_FlueGases TestVolumeI_Traces +TestVolumeITh +TestVolumeITh_FlueGases +TestVolumeITh_Traces \ No newline at end of file diff --git a/ThermoSysPro/Fluid/Volumes/VolumeITh.mo b/ThermoSysPro/Fluid/Volumes/VolumeITh.mo index 9f6c8292..af41005f 100644 --- a/ThermoSysPro/Fluid/Volumes/VolumeITh.mo +++ b/ThermoSysPro/Fluid/Volumes/VolumeITh.mo @@ -1,10 +1,9 @@ -within ThermoSysPro.Fluid.Volumes; +within ThermoSysPro.Fluid.Volumes; model VolumeITh "Mixing volume with 4 inlets, 4 outlets and 1 thermal input" - extends - ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidTypeParameterInterface; + extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable function SaS = Medium.noSaS(SubC=SubC) annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Boolean dynamic_energy_balance=true "true: dynamic energy balance equation - false: static energy balance equation"; @@ -29,42 +28,18 @@ model VolumeITh "Mixing volume with 4 inlets, 4 outlets and 1 thermal input" "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; parameter Units.SI.Density p_rho=0 "If > 0, fixed fluid density" annotation (Evaluate=true, Dialog(tab="Fluid", group="Fluid properties")); - parameter IF97Region region=IF97Region.All_regions "IF97 region (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); parameter Boolean dynamic_composition_balance=false - "true: dynamic fluid composition balance equation
    false: static fluid composition balance equation (active for flue gases)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.FlueGases), tab="Fluid", group="Fluid properties")); - - parameter ThermoSysPro.Units.SI.MassFraction Xco20=0.0 - "Initial CO2 mass fraction" annotation (Evaluate=true, Dialog( - enable=dynamic_composition_balance, - tab="Fluid", - group= - "Initial composition values (active for flue gases only if dynamic_composition_balance=true)")); - parameter ThermoSysPro.Units.SI.MassFraction Xh2o0=if ftype == FluidType.FlueGases then 0.05 else 0 - "Initial H20 mass fraction" annotation (Evaluate=true, Dialog( - enable=dynamic_composition_balance, - tab="Fluid", - group= - "Initial composition values (active for flue gases only if dynamic_composition_balance=true)")); - parameter ThermoSysPro.Units.SI.MassFraction Xo20=0.23 - "Initial O2 mass fraction" annotation (Evaluate=true, Dialog( - enable=dynamic_composition_balance, - tab="Fluid", - group= - "Initial composition values (active for flue gases only if dynamic_composition_balance=true)")); - parameter ThermoSysPro.Units.SI.MassFraction Xso20=0 - "Initial SO2 mass fraction" annotation (Evaluate=true, Dialog( + "true: dynamic fluid composition balance equation
    false: static fluid composition balance equation (active for flue gases)" annotation(Evaluate=true, Dialog(tab="Fluid", group="Fluid properties")); + parameter Medium.ExtraProperty X0[Medium.nX]=Medium.X_default "Initial composition values" annotation (Evaluate=true, Dialog( enable=dynamic_composition_balance, tab="Fluid", - group= - "Initial composition values (active for flue gases only if dynamic_composition_balance=true)")); + group="Medium")); + protected - constant Units.SI.SpecificEnthalpy hr=2501569 - "Water/steam reference specific enthalpy at 0.01°C"; - parameter Boolean flue_gases=(ftype == FluidType.FlueGases) "Flue gases"; + constant Boolean isCompressible = Medium.isCompressible; parameter Units.SI.MassFlowRate gamma0=1.e-4 "Pseudo-diffusion conductance use for continuous flow reversal (active if diffusion=false and continuous_flow_reversal = true)"; - parameter Integer mode=Integer(region) - 1 "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; public Units.SI.Temperature T "Fluid temperature"; @@ -77,15 +52,12 @@ public "density derivative wrt pressure at constant specific enthalpy"; Units.SI.DerDensityByEnthalpy ddhp "density derivative wrt specific enthalpy at constant pressure"; - FluidType fluids[9] "Fluids mixing in volume"; - Units.SI.MassFlowRate BXco2 "Right hand side of the CO2 balance equation"; - Units.SI.MassFlowRate BXh2o "Right hand side of the H2O balance equation"; - Units.SI.MassFlowRate BXo2 "Right hand side of the O2 balance equation"; - Units.SI.MassFlowRate BXso2 "Right hand side of the SO2 balance equation"; - ThermoSysPro.Units.SI.MassFraction Xco2 "CO2 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xh2o "H20 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xo2 "O2 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xso2 "SO2 mass fraction"; + Units.SI.MassFlowRate BX[Medium.nXi] "Right hand side of the X balance equation"; + Medium.ExtraProperty X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Fluid mass fraction"; + Medium.ExtraProperty BSubC[Medium.nC](quantity=Medium.extraPropertiesNames) "Right hand side of the trace balance equation"; + Medium.ExtraProperty SubC[Medium.nC](quantity=Medium.extraPropertiesNames, start=Medium.C_default) "Fluid trace substances"; + Medium.ExtraProperty SubCSaS[Medium.nC](quantity=Medium.extraPropertiesNames) "Trace modification in the trace balance equation"; + Medium.ThermodynamicState state; Units.SI.Power Je1 "Thermal power diffusion from inlet e1"; Units.SI.Power Je2 "Thermal power diffusion from inlet e2"; Units.SI.Power Je3 "Thermal power diffusion from inlet e3"; @@ -113,29 +85,29 @@ public Real rs4 "Value of r(Q/gamma) for outlet s4"; public - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce1 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce1(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-110,70},{-90,90}}, rotation=0), iconTransformation(extent={{-110,70},{-90,90}}))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce2 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce2(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-110,-10},{-90,10}}, rotation=0), iconTransformation(extent={{-110,-10},{-90,10}}))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs1 annotation ( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs1(redeclare package Medium = Medium) annotation ( Placement(transformation(extent={{90,70},{110,90}}, rotation=0), iconTransformation(extent={{90,70},{110,90}}))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs2 annotation ( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs2(redeclare package Medium = Medium) annotation ( Placement(transformation(extent={{90,-10},{110,10}}, rotation=0), iconTransformation(extent={{90,-10},{110,10}}))); - Interfaces.Connectors.FluidInlet Ce3 annotation (Placement(transformation( + Interfaces.Connectors.FluidInlet Ce3(redeclare package Medium = Medium) annotation (Placement(transformation( extent={{-110,-90},{-90,-70}}), iconTransformation(extent={{-110,-90}, {-90,-70}}))); - Interfaces.Connectors.FluidInlet Ce4 annotation (Placement(transformation( + Interfaces.Connectors.FluidInlet Ce4(redeclare package Medium = Medium) annotation (Placement(transformation( extent={{-10,-110},{10,-90}}), iconTransformation(extent={{-10,-110},{ 10,-90}}))); - Interfaces.Connectors.FluidOutlet Cs3 annotation (Placement(transformation( + Interfaces.Connectors.FluidOutlet Cs3(redeclare package Medium = Medium) annotation (Placement(transformation( extent={{90,-90},{110,-70}}), iconTransformation(extent={{90,-90},{110, -70}}))); - Interfaces.Connectors.FluidOutlet Cs4 annotation (Placement(transformation( + Interfaces.Connectors.FluidOutlet Cs4(redeclare package Medium = Medium) annotation (Placement(transformation( extent={{-10,90},{10,110}}), iconTransformation(extent={{-10,90},{10,110}}))); Thermal.Connectors.ThermalPort Cth annotation (Placement(transformation(extent={{-10, @@ -157,19 +129,11 @@ initial equation end if; end if; - if flue_gases then - if dynamic_composition_balance then - if steady_state then - der(Xco2) = 0; - der(Xh2o) = 0; - der(Xo2) = 0; - der(Xso2) = 0; - else - Xco2 = Xco20; - Xh2o = Xh2o0; - Xo2 = Xo20; - Xso2 = Xso20; - end if; + if dynamic_composition_balance then + if steady_state then + der(X) = fill(0,Medium.nX); + else + X = X0[1:Medium.nXi]; end if; end if; @@ -179,20 +143,6 @@ equation assert(V > 0, "Volume non-positive"); end if; - /* Check that incoming fluids are compatible with fluid in volume */ - fluids[1] = ftype; - fluids[2] = Ce1.ftype; - fluids[3] = Ce2.ftype; - fluids[4] = Ce3.ftype; - fluids[5] = Ce4.ftype; - fluids[6] = Cs1.ftype; - fluids[7] = Cs2.ftype; - fluids[8] = Cs3.ftype; - fluids[9] = Cs4.ftype; - - assert(ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.isCompatible(fluids), - "VolumeITh: fluids mixing in volume are not compatible with each other"); - /* Unconnected connectors */ if (cardinality(Ce1) == 0) then Ce1.Q = 0; @@ -200,11 +150,8 @@ equation Ce1.h_vol_1 = 1.e5; Ce1.diff_res_1 = 0; Ce1.diff_on_1 = false; - Ce1.ftype = ftype; - Ce1.Xco2 = 0; - Ce1.Xh2o = 0; - Ce1.Xo2 = 0; - Ce1.Xso2 = 0; + Ce1.Xi = Medium.X_default[1:Medium.nXi]; + Ce1.SubC = Medium.C_default; end if; if (cardinality(Ce2) == 0) then @@ -213,11 +160,8 @@ equation Ce2.h_vol_1 = 1.e5; Ce2.diff_res_1 = 0; Ce2.diff_on_1 = false; - Ce2.ftype = ftype; - Ce2.Xco2 = 0; - Ce2.Xh2o = 0; - Ce2.Xo2 = 0; - Ce2.Xso2 = 0; + Ce2.Xi = Medium.X_default[1:Medium.nXi]; + Ce2.SubC = Medium.C_default; end if; if (cardinality(Ce3) == 0) then @@ -226,11 +170,8 @@ equation Ce3.h_vol_1 = 1.e5; Ce3.diff_res_1 = 0; Ce3.diff_on_1 = false; - Ce3.ftype = ftype; - Ce3.Xco2 = 0; - Ce3.Xh2o = 0; - Ce3.Xo2 = 0; - Ce3.Xso2 = 0; + Ce3.Xi = Medium.X_default[1:Medium.nXi]; + Ce3.SubC = Medium.C_default; end if; if (cardinality(Ce4) == 0) then @@ -239,11 +180,8 @@ equation Ce4.h_vol_1 = 1.e5; Ce4.diff_res_1 = 0; Ce4.diff_on_1 = false; - Ce4.ftype = ftype; - Ce4.Xco2 = 0; - Ce4.Xh2o = 0; - Ce4.Xo2 = 0; - Ce4.Xso2 = 0; + Ce4.Xi = Medium.X_default[1:Medium.nXi]; + Ce4.SubC = Medium.C_default; end if; if (cardinality(Cs1) == 0) then @@ -278,7 +216,7 @@ equation BQ = Ce1.Q + Ce2.Q + Ce3.Q + Ce4.Q - Cs1.Q - Cs2.Q - Cs3.Q - Cs4.Q; if isCompressible and dynamic_energy_balance and dynamic_mass_balance then - V*(ddph*der(P) + ddhp*der(h - Xh2o*hr)) = BQ; + V*(ddph*der(P) + ddhp*der(h)) = BQ; else 0 = BQ; end if; @@ -293,13 +231,13 @@ equation P = Cs4.P; /* Energy balance equation */ - BH = Ce1.Q*(Ce1.h - Ce1.Xh2o*hr) + Ce2.Q*(Ce2.h - Ce2.Xh2o*hr) + Ce3.Q*(Ce3.h - Ce3.Xh2o*hr) + Ce4.Q*(Ce4.h - Ce4.Xh2o*hr) - Cs1.Q*(Cs1.h - Cs1.Xh2o*hr) - Cs2.Q*(Cs2.h - Cs2.Xh2o*hr) - Cs3.Q*(Cs3.h - Cs3.Xh2o*hr) - Cs4.Q*(Cs4.h - Cs4.Xh2o*hr) + Cth.W + J; + BH = Ce1.Q*Ce1.h + Ce2.Q*Ce2.h + Ce3.Q*Ce3.h + Ce4.Q*Ce4.h - Cs1.Q*Cs1.h - Cs2.Q*Cs2.h - Cs3.Q*Cs3.h - Cs4.Q*Cs4.h + Cth.W + J; if dynamic_energy_balance then if dynamic_mass_balance then - V*(((h - Xh2o*hr)*ddph - 1)*der(P) + ((h - Xh2o*hr)*ddhp + rho)*der(h - Xh2o*hr)) = BH; + V*((h*ddph - 1)*der(P) + (h*ddhp + rho)*der(h)) = BH; else - V*rho*der(h - Xh2o*hr) = BH; + V*rho*der(h) = BH; end if; else BH = 0; @@ -315,54 +253,34 @@ equation Cs4.h_vol_1 = h; /* Fluid composition balance equations */ - BXco2 = Ce1.Xco2*Ce1.Q + Ce2.Xco2*Ce2.Q + Ce3.Xco2*Ce3.Q + Ce4.Xco2*Ce4.Q - Cs1.Xco2*Cs1.Q - Cs2.Xco2*Cs2.Q - Cs3.Xco2*Cs3.Q - Cs4.Xco2*Cs4.Q; - BXh2o = Ce1.Xh2o*Ce1.Q + Ce2.Xh2o*Ce2.Q + Ce3.Xh2o*Ce3.Q + Ce4.Xh2o*Ce4.Q - Cs1.Xh2o*Cs1.Q - Cs2.Xh2o*Cs2.Q - Cs3.Xh2o*Cs3.Q - Cs4.Xh2o*Cs4.Q; - BXo2 = Ce1.Xo2*Ce1.Q + Ce2.Xo2*Ce2.Q + Ce3.Xo2*Ce3.Q + Ce4.Xo2*Ce4.Q - Cs1.Xo2*Cs1.Q - Cs2.Xo2*Cs2.Q - Cs3.Xo2*Cs3.Q - Cs4.Xo2*Cs4.Q; - BXso2 = Ce1.Xso2*Ce1.Q + Ce2.Xso2*Ce2.Q + Ce3.Xso2*Ce3.Q + Ce4.Xso2*Ce4.Q - Cs1.Xso2*Cs1.Q - Cs2.Xso2*Cs2.Q - Cs3.Xso2*Cs3.Q - Cs4.Xso2*Cs4.Q; - - if flue_gases then - if dynamic_composition_balance then - V*rho*der(Xco2) + Xco2*BQ = BXco2; - V*rho*der(Xh2o) + Xh2o*BQ = BXh2o; - V*rho*der(Xo2) + Xo2*BQ = BXo2; - V*rho*der(Xso2) + Xso2*BQ = BXso2; - else - Xco2*BQ = BXco2; - Xh2o*BQ = BXh2o; - Xo2*BQ = BXo2; - Xso2*BQ = BXso2; - end if; + BX = Ce1.Xi*Ce1.Q + Ce2.Xi*Ce2.Q + Ce3.Xi*Ce3.Q + Ce4.Xi*Ce4.Q - Cs1.Xi*Cs1.Q - Cs2.Xi*Cs2.Q - Cs3.Xi*Cs3.Q - Cs4.Xi*Cs4.Q; + + if dynamic_composition_balance then + V*rho*der(X) + X*BQ = BX; else - Xco2 = 0; - Xh2o = 0; - Xo2 = 0; - Xso2 = 0; + X*BQ = BX; end if; - Cs1.ftype = ftype; - Cs2.ftype = ftype; - Cs3.ftype = ftype; - Cs4.ftype = ftype; + /* Traces composition balance equations */ + BSubC = Ce1.Q*Ce1.SubC + Ce2.Q*Ce2.SubC + Ce3.Q*Ce3.SubC + Ce4.Q*Ce4.SubC - Cs1.Q*Cs1.SubC - Cs2.Q*Cs2.SubC - Cs3.Q*Cs3.SubC - Cs4.Q*Cs4.SubC; - Cs1.Xco2 = Xco2; - Cs1.Xh2o = Xh2o; - Cs1.Xo2 = Xo2; - Cs1.Xso2 = Xso2; + SubCSaS = SaS(); + if dynamic_mass_balance then + V*rho*der(SubC) + SubC*BQ + V*rho*SubCSaS = BSubC; + else + V*rho*SubCSaS = BSubC; + end if; - Cs2.Xco2 = Xco2; - Cs2.Xh2o = Xh2o; - Cs2.Xo2 = Xo2; - Cs2.Xso2 = Xso2; + Cs1.SubC = SubC; + Cs2.SubC = SubC; + Cs3.SubC = SubC; + Cs4.SubC = SubC; - Cs3.Xco2 = Xco2; - Cs3.Xh2o = Xh2o; - Cs3.Xo2 = Xo2; - Cs3.Xso2 = Xso2; + Cs1.Xi = X; + Cs2.Xi = X; + Cs3.Xi = X; + Cs4.Xi = X; - Cs4.Xco2 = Xco2; - Cs4.Xh2o = Xh2o; - Cs4.Xo2 = Xo2; - Cs4.Xso2 = Xso2; /* Flow reversal */ if continuous_flow_reversal then @@ -456,21 +374,23 @@ equation /* Fluid thermodynamic properties */ if isCompressible and dynamic_mass_balance then - ddph = ThermoSysPro.Properties.Fluid.Density_derp_Ph(P, h, fluid, mode, Xco2, Xh2o, Xo2, Xso2); - ddhp = ThermoSysPro.Properties.Fluid.Density_derh_Ph(P, h, fluid, mode, Xco2, Xh2o, Xo2, Xso2); + ddph = Medium.density_derp_h(state); + ddhp = Medium.density_derh_p(state); else ddph = 0; ddhp = 0; end if; - T = ThermoSysPro.Properties.Fluid.Temperature_Ph(P, h, fluid, mode, Xco2, Xh2o, Xo2, Xso2); + state = Medium.setState_phX(p=P, h=h, X=X); + + T = Medium.temperature(state); Cth.T = T; if (p_rho > 0) then rho = p_rho; else - rho = ThermoSysPro.Properties.Fluid.Density_Ph(P, h, fluid, mode, Xco2, Xh2o, Xo2, Xso2); + rho = Medium.density(state); end if; annotation ( From c742d552482058221d1b471549861f4b15eec91e Mon Sep 17 00:00:00 2001 From: LAMBLOT Simon Date: Mon, 23 Jun 2025 15:33:45 +0200 Subject: [PATCH 073/178] corrections --- ThermoSysPro/Fluid/Volumes/VolumeCTh.mo | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ThermoSysPro/Fluid/Volumes/VolumeCTh.mo b/ThermoSysPro/Fluid/Volumes/VolumeCTh.mo index 46867e0b..40381358 100644 --- a/ThermoSysPro/Fluid/Volumes/VolumeCTh.mo +++ b/ThermoSysPro/Fluid/Volumes/VolumeCTh.mo @@ -134,8 +134,8 @@ equation Ce2.h_vol_1 = 1.e5; Ce2.diff_res_1 = 0; Ce2.diff_on_1 = false; - Ce1.Xi = Medium.X_default[1:Medium.nXi]; - Ce1.SubC = Medium.C_default; + Ce2.Xi = Medium.X_default[1:Medium.nXi]; + Ce2.SubC = Medium.C_default; end if; if (cardinality(Ce3) == 0) then From 6e5a97b47a0636033cd8a022935c4a83f6dd65b9 Mon Sep 17 00:00:00 2001 From: LAMBLOT Simon Date: Mon, 23 Jun 2025 15:35:18 +0200 Subject: [PATCH 074/178] corrections --- ThermoSysPro/Fluid/Volumes/VolumeBTh.mo | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ThermoSysPro/Fluid/Volumes/VolumeBTh.mo b/ThermoSysPro/Fluid/Volumes/VolumeBTh.mo index 6c7ed0f2..b0658336 100644 --- a/ThermoSysPro/Fluid/Volumes/VolumeBTh.mo +++ b/ThermoSysPro/Fluid/Volumes/VolumeBTh.mo @@ -134,8 +134,8 @@ equation Ce2.h_vol_1 = 1.e5; Ce2.diff_res_1 = 0; Ce2.diff_on_1 = false; - Ce1.Xi = Medium.X_default[1:Medium.nXi]; - Ce1.SubC = Medium.C_default; + Ce2.Xi = Medium.X_default[1:Medium.nXi]; + Ce2.SubC = Medium.C_default; end if; if (cardinality(Cs1) == 0) then From 14625a96499152f19562b8c474c065ab44108edb Mon Sep 17 00:00:00 2001 From: LAMBLOT Simon Date: Mon, 23 Jun 2025 15:36:32 +0200 Subject: [PATCH 075/178] corrections --- ThermoSysPro/Fluid/Volumes/VolumeATh.mo | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ThermoSysPro/Fluid/Volumes/VolumeATh.mo b/ThermoSysPro/Fluid/Volumes/VolumeATh.mo index e703a0ee..f453a3e5 100644 --- a/ThermoSysPro/Fluid/Volumes/VolumeATh.mo +++ b/ThermoSysPro/Fluid/Volumes/VolumeATh.mo @@ -134,8 +134,8 @@ equation Ce2.h_vol_1 = 1.e5; Ce2.diff_res_1 = 0; Ce2.diff_on_1 = false; - Ce1.Xi = Medium.X_default[1:Medium.nXi]; - Ce1.SubC = Medium.C_default; + Ce2.Xi = Medium.X_default[1:Medium.nXi]; + Ce2.SubC = Medium.C_default; end if; if (cardinality(Cs1) == 0) then From 75c9f9ff91e015b093491662a99c7edd1505c0c5 Mon Sep 17 00:00:00 2001 From: LAMBLOT Simon Date: Tue, 24 Jun 2025 11:44:24 +0200 Subject: [PATCH 076/178] CentrifugalPump --- .../Machines/TestCentrifugalPump.mo | 19 ++++++++++++++ .../Machines/TestCentrifugalPump_FlueGases.mo | 24 ++++++++++++++++++ .../Machines/TestCentrifugalPump_Traces.mo | 24 ++++++++++++++++++ .../SimpleExamples/Machines/package.order | 5 +++- .../Fluid/Machines/CentrifugalPump.mo | 25 +++++++------------ 5 files changed, 80 insertions(+), 17 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestCentrifugalPump.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestCentrifugalPump_FlueGases.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestCentrifugalPump_Traces.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestCentrifugalPump.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestCentrifugalPump.mo new file mode 100644 index 00000000..c9b51c33 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestCentrifugalPump.mo @@ -0,0 +1,19 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Machines; +model TestCentrifugalPump + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; + ThermoSysPro.Fluid.Machines.CentrifugalPump centrifugalPump( redeclare + replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10}, + {10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package + Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare + replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); +equation + connect(centrifugalPump.C2, sink.C) + annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(centrifugalPump.C1, sourcePQ.C) + annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestCentrifugalPump; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestCentrifugalPump_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestCentrifugalPump_FlueGases.mo new file mode 100644 index 00000000..2ffecfaa --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestCentrifugalPump_FlueGases.mo @@ -0,0 +1,24 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Machines; +model TestCentrifugalPump_FlueGases + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.FlueGases; + ThermoSysPro.Fluid.Machines.CentrifugalPump centrifugalPump( redeclare + replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-6,-10}, + {14,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink( + redeclare replaceable package Medium = Medium, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ( + redeclare replaceable package Medium = Medium, + P0=4500000, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); +equation + connect(centrifugalPump.C2, sink.C) + annotation (Line(points={{14,0},{30,0}}, color={0,0,0})); + connect(centrifugalPump.C1, sourcePQ.C) + annotation (Line(points={{-6,0},{-30,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestCentrifugalPump_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestCentrifugalPump_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestCentrifugalPump_Traces.mo new file mode 100644 index 00000000..d8f87653 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestCentrifugalPump_Traces.mo @@ -0,0 +1,24 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Machines; +model TestCentrifugalPump_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam ( + extraPropertiesNames={"Trace"}, + C_nominal={0.1}, + C_default={0.2}); + ThermoSysPro.Fluid.Machines.CentrifugalPump centrifugalPump( redeclare + replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10}, + {10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package + Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare + replaceable package Medium = Medium, SubC0={0.3}) + annotation (Placement(transformation(extent={{-52,-10}, + {-32,10}}))); +equation + connect(centrifugalPump.C2, sink.C) + annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(centrifugalPump.C1, sourcePQ.C) + annotation (Line(points={{-10,0},{-32,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestCentrifugalPump_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/package.order index 243a92a6..e43cd82f 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/package.order @@ -1,3 +1,6 @@ TestStaticCentrifugalPump TestStaticCentrifugalPump_FlueGases -TestStaticCentrifugalPump_Traces \ No newline at end of file +TestStaticCentrifugalPump_Traces +TestCentrifugalPump +TestCentrifugalPump_FlueGases +TestCentrifugalPump_Traces \ No newline at end of file diff --git a/ThermoSysPro/Fluid/Machines/CentrifugalPump.mo b/ThermoSysPro/Fluid/Machines/CentrifugalPump.mo index c8543d12..68693e41 100644 --- a/ThermoSysPro/Fluid/Machines/CentrifugalPump.mo +++ b/ThermoSysPro/Fluid/Machines/CentrifugalPump.mo @@ -1,7 +1,6 @@ within ThermoSysPro.Fluid.Machines; model CentrifugalPump "Centrifugal pump" - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter ThermoSysPro.Units.nonSI.AngularVelocity_rpm N=1400 "Pump angular velocity in rpm (active if input M is not connected)"; @@ -19,7 +18,6 @@ model CentrifugalPump "Centrifugal pump" "Diffusion conductance (active if diffusion=true in neighbouring volumes)"; parameter Units.SI.Density p_rho=0 "If > 0, fixed fluid density" annotation (Evaluate=true, Dialog(tab="Fluid", group="Fluid properties")); - parameter IF97Region region=IF97Region.All_regions "IF97 region (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); parameter Integer mode_car=2 "1:nominal values and coef. c given by parameters - 2:nominal values and coef. c computed from semi-parabolic characteristics"; @@ -68,7 +66,6 @@ model CentrifugalPump "Centrifugal pump" protected constant Units.SI.Acceleration g=Modelica.Constants.g_n "Gravity constant"; constant Real pi=Modelica.Constants.pi "pi"; - parameter Integer mode=Integer(region) - 1 "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; parameter Units.SI.AngularVelocity w_a_min=1.e-4 "Small angular velocity"; parameter Units.SI.VolumeFlowRate Qv_a_min=1.e-4 "Small volume flow rate"; parameter Real rh_min=0.05 "Minimum efficiency"; @@ -114,12 +111,11 @@ public Real beta=hn_coef[2] "Coef. beta of the characteristics for hn"; Real gamma=rh_coef[1] "Coef. gamma of the characteristics for rh"; Real delta=rh_coef[2] "Coef. delta of the characteristics for rh"; - FluidType ftype "Fluid type"; - Integer fluid=Integer(ftype) "Fluid number"; + Medium.MassFraction X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Mass fractions"; - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-110,-10},{-90,10}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{90,-10},{110,10}}, rotation=0))); ElectroMechanics.Connectors.MechanichalTorque M annotation (Placement(transformation( @@ -152,12 +148,11 @@ equation C2.diff_res_1 = C1.diff_res_1 + (if (gamma_diff > 0) then 1/gamma_diff else 0); C1.diff_res_2 = C2.diff_res_2 + (if (gamma_diff > 0) then 1/gamma_diff else 0); - C1.ftype = C2.ftype; + C1.Xi = C2.Xi; - C1.Xco2 = C2.Xco2; - C1.Xh2o = C2.Xh2o; - C1.Xo2 = C2.Xo2; - C1.Xso2 = C2.Xso2; + X = C1.Xi; + + C1.SubC = C2.SubC; Q = C1.Q; deltaP = C2.P - C1.P; @@ -166,8 +161,6 @@ equation deltaP = rho*g*hn; Q = Qv*rho; - ftype = C1.ftype; - /* Energy balance equation */ if dynamic_energy_balance then V*rho*der(h) = -Q*deltaH + Wr; @@ -285,7 +278,7 @@ equation if (p_rho > 0) then rho = p_rho; else - rho = ThermoSysPro.Properties.Fluid.Density_Ph(Pm,h,fluid,mode,C1.Xco2, C1.Xh2o, C1.Xo2, C1.Xso2); + rho = Medium.density_phX(p=Pm, h=h, X=X); end if; annotation ( Diagram(coordinateSystem( From 8102b726341811b1862b18e78f2427b1a5a1b61a Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Tue, 24 Jun 2025 15:36:49 +0200 Subject: [PATCH 077/178] #125 VolumeAth with heatSource, not working with OM1.25 --- .../SimpleExamples/Volumes/TestVolumeATh.mo | 24 +++++------ .../Volumes/TestVolumeATh_FlueGases.mo | 40 ++++++++++--------- .../Volumes/TestVolumeATh_Traces.mo | 37 ++++++++--------- .../SimpleExamples/Volumes/package.order | 2 +- ThermoSysPro/Fluid/Volumes/VolumeATh.mo | 1 - 5 files changed, 48 insertions(+), 56 deletions(-) diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeATh.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeATh.mo index 7fb15da1..6b2789bd 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeATh.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeATh.mo @@ -3,21 +3,15 @@ model TestVolumeATh extends ThermoSysPro.UsersGuide.Icons.Example; replaceable package Medium = Properties.Media.WaterSteam; - ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package - Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare - replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); - ThermoSysPro.Fluid.Volumes.VolumeATh - volumeATh( - redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare replaceable - package Medium = Medium) annotation (Placement(transformation(extent={{-50,20},{-30,40}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.Fluid.Volumes.VolumeATh volumeATh(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-50,20},{-30,40}}))); + Thermal.BoundaryConditions.HeatSource heatSource annotation (Placement(transformation(extent={{-10,-22},{10,-42}}))); equation - connect(sourcePQ.C, volumeATh.Ce1) - annotation (Line(points={{-30,0},{-10,0}}, color={0,0,0})); - connect(volumeATh.Ce2, sourceQ.C) - annotation (Line(points={{0,10},{0,30},{-30,30}}, color={0,0,0})); - connect(volumeATh.Cs1, sink.C) - annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(sourcePQ.C, volumeATh.Ce1) annotation (Line(points={{-30,0},{-10,0}}, color={0,0,0})); + connect(volumeATh.Ce2, sourceQ.C) annotation (Line(points={{0,10},{0,30},{-30,30}}, color={0,0,0})); + connect(volumeATh.Cs1, sink.C) annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(heatSource.C[1], volumeATh.Cth) annotation (Line(points={{0,-22.2},{0,0}}, color={0,0,0})); annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestVolumeATh; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeATh_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeATh_FlueGases.mo index 804c4ea4..2f1a9e64 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeATh_FlueGases.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeATh_FlueGases.mo @@ -3,28 +3,30 @@ model TestVolumeATh_FlueGases extends ThermoSysPro.UsersGuide.Icons.Example; replaceable package Medium = Properties.Media.FlueGases; - ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package - Medium = Medium, + ThermoSysPro.Fluid.BoundaryConditions.Sink sink( + redeclare replaceable package Medium = Medium, T0=573.15, - option_temperature=true) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare - replaceable package Medium = Medium, + option_temperature=true) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ( + redeclare replaceable package Medium = Medium, P0=4500000, T0=573.15, - option_temperature=true) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); - ThermoSysPro.Fluid.Volumes.VolumeATh - volumeATh( - redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare replaceable - package Medium = Medium, + option_temperature=true) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.Fluid.Volumes.VolumeATh volumeATh(redeclare package Medium = Medium, h(start=2.83057e6)) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ( + redeclare replaceable package Medium = Medium, T0=573.15, - option_temperature=true) annotation (Placement(transformation(extent={{-50,20},{-30,40}}))); + option_temperature=true) annotation (Placement(transformation(extent={{-50,20},{-30,40}}))); + Thermal.BoundaryConditions.HeatSource heatSource(T0 = {573.15}) annotation( + Placement(transformation(extent = {{-10, -20}, {10, -40}}))); equation - connect(sourcePQ.C, volumeATh.Ce1) - annotation (Line(points={{-30,0},{-10,0}}, color={0,0,0})); - connect(volumeATh.Ce2, sourceQ.C) - annotation (Line(points={{0,10},{0,30},{-30,30}}, color={0,0,0})); - connect(volumeATh.Cs1, sink.C) - annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(sourcePQ.C, volumeATh.Ce1) annotation( + Line(points = {{-30, 0}, {-10, 0}}, color = {0, 0, 0})); + connect(volumeATh.Ce2, sourceQ.C) annotation( + Line(points = {{0, 10}, {0, 30}, {-30, 30}}, color = {0, 0, 0})); + connect(volumeATh.Cs1, sink.C) annotation( + Line(points = {{10, 0}, {30, 0}}, color = {0, 0, 0})); + connect(volumeATh.Cth, heatSource.C[1]) annotation( + Line(points = {{0, 0}, {0, -20.2}}, color = {0, 0, 0})); annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); -end TestVolumeATh_FlueGases; +end TestVolumeATh_FlueGases; \ No newline at end of file diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeATh_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeATh_Traces.mo index ea380925..ecbf2734 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeATh_Traces.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeATh_Traces.mo @@ -2,28 +2,25 @@ within ThermoSysPro.Fluid.Examples.SimpleExamples.Volumes; model TestVolumeATh_Traces extends ThermoSysPro.UsersGuide.Icons.Example; - replaceable package Medium = Properties.Media.WaterSteam (extraPropertiesNames={"Trace"}, C_nominal={0.1}, C_default={0.2}); - ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package - Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare - replaceable package Medium = Medium, + replaceable package Medium = Properties.Media.WaterSteam ( + extraPropertiesNames={"Trace"}, + C_nominal={0.1}, + C_default={0.2}); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ( + redeclare replaceable package Medium = Medium, Q0=100, - SubC0={0.5}) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); - ThermoSysPro.Fluid.Volumes.VolumeATh - volumeATh( - redeclare package Medium = Medium, + SubC0={0.5}) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.Fluid.Volumes.VolumeATh volumeATh( + redeclare package Medium = Medium, V=1, - dynamic_mass_balance=false) annotation (Placement(transformation(extent={{-10,-10}, - {10,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare replaceable - package Medium = Medium, - SubC0={0.2}) annotation (Placement(transformation(extent={{-50,20},{-30,40}}))); + dynamic_mass_balance=false) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare replaceable package Medium = Medium, SubC0={0.2}) annotation (Placement(transformation(extent={{-50,20},{-30,40}}))); + Thermal.BoundaryConditions.HeatSource heatSource annotation (Placement(transformation(extent={{-10,-20},{10,-40}}))); equation - connect(sourcePQ.C, volumeATh.Ce1) - annotation (Line(points={{-30,0},{-10,0}}, color={0,0,0})); - connect(volumeATh.Ce2, sourceQ.C) - annotation (Line(points={{0,10},{0,30},{-30,30}}, color={0,0,0})); - connect(volumeATh.Cs1, sink.C) - annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(sourcePQ.C, volumeATh.Ce1) annotation (Line(points={{-30,0},{-10,0}}, color={0,0,0})); + connect(volumeATh.Ce2, sourceQ.C) annotation (Line(points={{0,10},{0,30},{-30,30}}, color={0,0,0})); + connect(volumeATh.Cs1, sink.C) annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(volumeATh.Cth, heatSource.C[1]) annotation (Line(points={{0,0},{0,-20.2}}, color={0,0,0})); annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestVolumeATh_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order index 6f328c14..aca36855 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order @@ -15,4 +15,4 @@ TestVolumeI_FlueGases TestVolumeI_Traces TestVolumeATh TestVolumeATh_Traces -TestVolumeATh_FlueGases \ No newline at end of file +TestVolumeATh_FlueGases diff --git a/ThermoSysPro/Fluid/Volumes/VolumeATh.mo b/ThermoSysPro/Fluid/Volumes/VolumeATh.mo index f453a3e5..f482ebd3 100644 --- a/ThermoSysPro/Fluid/Volumes/VolumeATh.mo +++ b/ThermoSysPro/Fluid/Volumes/VolumeATh.mo @@ -194,7 +194,6 @@ equation end if; Cs1.Xi = X; - Cs2.Xi = X; /* Traces composition balance equations */ From 8e00bd47ace758119a8c1e2f5764cab8459e2adb Mon Sep 17 00:00:00 2001 From: LAMBLOT Simon Date: Tue, 24 Jun 2025 16:39:51 +0200 Subject: [PATCH 078/178] examples with heat source --- .../SimpleExamples/Volumes/TestVolumeBTh.mo | 28 +++++++++++-------- .../Volumes/TestVolumeBTh_FlueGases.mo | 7 ++++- .../Volumes/TestVolumeBTh_Traces.mo | 4 +++ 3 files changed, 27 insertions(+), 12 deletions(-) diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeBTh.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeBTh.mo index 866c9264..40e46e26 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeBTh.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeBTh.mo @@ -4,26 +4,32 @@ model TestVolumeBTh replaceable package Medium = Properties.Media.WaterSteam; ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package - Medium = Medium) annotation (Placement(transformation(extent={{-10,-10}, - {10,10}}, + Medium = Medium) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, rotation=90, origin={0,38}))); ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare - replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); - ThermoSysPro.Fluid.Volumes.VolumeBTh - volumeBTh( - redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + replaceable package Medium = Medium) + annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.Fluid.Volumes.VolumeBTh volumeBTh(redeclare package Medium = + Medium) + annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare replaceable - package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10}, - {10,10}}, + package Medium = Medium) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, rotation=180, origin={42,0}))); + Thermal.BoundaryConditions.HeatSource heatSource + annotation (Placement(transformation(extent={{-10,-22},{10,-42}}))); equation connect(sourcePQ.C, volumeBTh.Ce1) annotation (Line(points={{-30,0},{-10,0}}, color={0,0,0})); connect(volumeBTh.Ce2, sourceQ.C) annotation (Line(points={{10,0},{21,0},{21, 7.21645e-16},{32,7.21645e-16}}, color={0,0,0})); - connect(volumeBTh.Cs1, sink.C) annotation (Line(points={{0,10},{0,19},{ - -5.55112e-16,19},{-5.55112e-16,28}}, color={0,0,0})); - annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); + connect(volumeBTh.Cs1, sink.C) annotation (Line(points={{0,10},{0,19},{-5.55112e-16, + 19},{-5.55112e-16,28}}, color={0,0,0})); + connect(heatSource.C[1], volumeBTh.Cth) + annotation (Line(points={{0,-22.2},{0,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( + coordinateSystem(preserveAspectRatio=false))); end TestVolumeBTh; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeBTh_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeBTh_FlueGases.mo index d48a565e..16d799e5 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeBTh_FlueGases.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeBTh_FlueGases.mo @@ -17,7 +17,8 @@ model TestVolumeBTh_FlueGases option_temperature=true) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); ThermoSysPro.Fluid.Volumes.VolumeBTh volumeBTh( - redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + redeclare package Medium = Medium, h( + start=2.83057e6)) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare replaceable package Medium = Medium, T0=573.15, @@ -25,6 +26,8 @@ model TestVolumeBTh_FlueGases {10,10}}, rotation=180, origin={40,0}))); + Thermal.BoundaryConditions.HeatSource heatSource(T0={573.15}) annotation ( + Placement(transformation(extent={{-10,-22},{10,-42}}))); equation connect(sourcePQ.C, volumeBTh.Ce1) annotation (Line(points={{-30,0},{-10,0}}, color={0,0,0})); @@ -32,5 +35,7 @@ equation 6.66134e-16},{30,6.66134e-16}}, color={0,0,0})); connect(volumeBTh.Cs1, sink.C) annotation (Line(points={{0,10},{0,20},{ -5.55112e-16,20},{-5.55112e-16,30}}, color={0,0,0})); + connect(heatSource.C[1], volumeBTh.Cth) + annotation (Line(points={{0,-22.2},{0,0}}, color={0,0,0})); annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestVolumeBTh_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeBTh_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeBTh_Traces.mo index 370c3b6c..0a686479 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeBTh_Traces.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeBTh_Traces.mo @@ -24,6 +24,8 @@ model TestVolumeBTh_Traces {10,10}}, rotation=180, origin={38,0}))); + Thermal.BoundaryConditions.HeatSource heatSource annotation (Placement(transformation(extent={{-10,-22}, + {10,-42}}))); equation connect(sourcePQ.C, volumeBTh.Ce1) annotation (Line(points={{-30,0},{-10,0}}, color={0,0,0})); @@ -31,5 +33,7 @@ equation 7.21645e-16},{28,7.21645e-16}}, color={0,0,0})); connect(volumeBTh.Cs1, sink.C) annotation (Line(points={{0,10},{0,26},{-6.66134e-16,26}}, color={0,0,0})); + connect(heatSource.C[1], volumeBTh.Cth) + annotation (Line(points={{0,-22.2},{0,0}}, color={0,0,0})); annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestVolumeBTh_Traces; From 8196f42f9d07adecca48bfb227094de044b52cba Mon Sep 17 00:00:00 2001 From: LAMBLOT Simon Date: Tue, 24 Jun 2025 16:44:03 +0200 Subject: [PATCH 079/178] Examples with heat source --- .../Fluid/Examples/SimpleExamples/Volumes/TestVolumeCTh.mo | 4 ++++ .../SimpleExamples/Volumes/TestVolumeCTh_FlueGases.mo | 4 ++++ .../Examples/SimpleExamples/Volumes/TestVolumeCTh_Traces.mo | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeCTh.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeCTh.mo index 3dd55013..5c3cbd0d 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeCTh.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeCTh.mo @@ -12,6 +12,8 @@ model TestVolumeCTh redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-50,20},{-30,40}}))); + Thermal.BoundaryConditions.HeatSource heatSource annotation (Placement(transformation(extent={{-10,-26}, + {10,-46}}))); equation connect(sourcePQ.C, volumeCTh.Ce1) annotation (Line(points={{-30,0},{-10,0}}, color={0,0,0})); @@ -19,5 +21,7 @@ equation annotation (Line(points={{30,0},{10,0}}, color={0,0,0})); connect(volumeCTh.Ce2, sourceQ.C) annotation (Line(points={{0,10},{0,30},{-30,30}}, color={0,0,0})); + connect(heatSource.C[1], volumeCTh.Cth) + annotation (Line(points={{0,-26.2},{0,0}}, color={0,0,0})); annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestVolumeCTh; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeCTh_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeCTh_FlueGases.mo index 2d2b65e5..b36afc50 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeCTh_FlueGases.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeCTh_FlueGases.mo @@ -19,6 +19,8 @@ model TestVolumeCTh_FlueGases redeclare replaceable package Medium = Medium, T0=573.15, option_temperature=true) annotation (Placement(transformation(extent={{-50,20},{-30,40}}))); + Thermal.BoundaryConditions.HeatSource heatSource(T0={573.15}) annotation ( + Placement(transformation(extent={{-10,-24},{10,-44}}))); equation connect(sourcePQ.C, volumeCTh.Ce1) annotation (Line(points={{-30,0},{-10,0}}, color={0,0,0})); @@ -26,5 +28,7 @@ equation annotation (Line(points={{30,0},{10,0}}, color={0,0,0})); connect(volumeCTh.Ce2, sourceQ.C) annotation (Line(points={{0,10},{0,30},{-30,30}}, color={0,0,0})); + connect(heatSource.C[1], volumeCTh.Cth) + annotation (Line(points={{0,-24.2},{0,0}}, color={0,0,0})); annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestVolumeCTh_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeCTh_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeCTh_Traces.mo index a6b7f274..3e3dbece 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeCTh_Traces.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeCTh_Traces.mo @@ -14,6 +14,8 @@ model TestVolumeCTh_Traces ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare replaceable package Medium = Medium, SubC0={0.1}) annotation (Placement(transformation(extent={{-50,20},{-30,40}}))); + Thermal.BoundaryConditions.HeatSource heatSource annotation (Placement(transformation(extent={{-10,-22}, + {10,-42}}))); equation connect(sourcePQ.C, volumeCTh.Ce1) annotation (Line(points={{-30,0},{-10,0}}, color={0,0,0})); @@ -21,5 +23,7 @@ equation annotation (Line(points={{30,0},{10,0}}, color={0,0,0})); connect(volumeCTh.Ce2, sourceQ.C) annotation (Line(points={{0,10},{0,30},{-30,30}}, color={0,0,0})); + connect(heatSource.C[1], volumeCTh.Cth) + annotation (Line(points={{0,-22.2},{0,0}}, color={0,0,0})); annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestVolumeCTh_Traces; From bc3bab0b82cc7799a2e56fc328ecead4f3bf8f10 Mon Sep 17 00:00:00 2001 From: LAMBLOT Simon Date: Wed, 25 Jun 2025 09:13:13 +0200 Subject: [PATCH 080/178] Examples with heat source --- .../SimpleExamples/Volumes/TestVolumeDTh.mo | 30 +++++++++------- .../Volumes/TestVolumeDTh_FlueGases.mo | 36 +++++++++++-------- .../Volumes/TestVolumeDTh_Traces.mo | 33 +++++++++-------- 3 files changed, 57 insertions(+), 42 deletions(-) diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeDTh.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeDTh.mo index ce8714ea..9acf1edc 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeDTh.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeDTh.mo @@ -4,18 +4,19 @@ model TestVolumeDTh replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package - Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); - ThermoSysPro.Fluid.Volumes.VolumeDTh - volumeDTh( - redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ( - redeclare replaceable - package Medium = Medium) annotation (Placement(transformation(extent={{-52,-10}, - {-32,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkQ( - redeclare replaceable - package Medium = Medium) annotation (Placement(transformation(extent={{12,22}, - {32,42}}))); + Medium = Medium) + annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.Volumes.VolumeDTh volumeDTh(redeclare package Medium = + Medium) + annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare + replaceable package Medium = Medium) + annotation (Placement(transformation(extent={{-52,-10},{-32,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkQ(redeclare replaceable + package Medium = Medium) + annotation (Placement(transformation(extent={{12,22},{32,42}}))); + Thermal.BoundaryConditions.HeatSource heatSource + annotation (Placement(transformation(extent={{-10,-28},{10,-48}}))); equation connect(sourcePQ.C, volumeDTh.Ce) annotation (Line(points={{-32,0},{-10,0}}, color={0,0,0})); @@ -23,5 +24,8 @@ equation annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); connect(volumeDTh.Cs1, sinkQ.C) annotation (Line(points={{0,10},{0,32},{12,32}}, color={0,0,0})); - annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); + connect(heatSource.C[1], volumeDTh.Cth) + annotation (Line(points={{0,-28.2},{0,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( + coordinateSystem(preserveAspectRatio=false))); end TestVolumeDTh; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeDTh_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeDTh_FlueGases.mo index 2085ae1b..62a34f9d 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeDTh_FlueGases.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeDTh_FlueGases.mo @@ -3,26 +3,29 @@ model TestVolumeDTh_FlueGases extends ThermoSysPro.UsersGuide.Icons.Example; replaceable package Medium = ThermoSysPro.Properties.Media.FlueGases; - ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package - Medium = Medium, + ThermoSysPro.Fluid.BoundaryConditions.Sink sink( + redeclare replaceable package Medium = Medium, T0=573.15, - option_temperature=true) annotation (Placement(transformation(extent={{26,16}, - {46,36}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare - replaceable package Medium = Medium, + option_temperature=true) + annotation (Placement(transformation(extent={{26,16},{46,36}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ( + redeclare replaceable package Medium = Medium, P0=4500000, T0=573.15, - option_temperature=true) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); - ThermoSysPro.Fluid.Volumes.VolumeDTh - volumeDTh( - redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkQ( redeclare replaceable - package Medium = Medium, + option_temperature=true) + annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.Fluid.Volumes.VolumeDTh volumeDTh(redeclare package Medium = + Medium, h(start=2.83057e6)) + annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkQ( + redeclare replaceable package Medium = Medium, T0=573.15, - option_temperature=true) annotation (Placement(transformation(extent={{-10,-10}, - {10,10}}, + option_temperature=true) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, rotation=0, origin={40,0}))); + Thermal.BoundaryConditions.HeatSource heatSource(T0={573.15}) + annotation (Placement(transformation(extent={{-10,-28},{10,-48}}))); equation connect(volumeDTh.Cs1, sink.C) annotation (Line(points={{0,10},{0,26},{26,26}}, color={0,0,0})); @@ -30,5 +33,8 @@ equation annotation (Line(points={{-30,0},{-10,0}}, color={0,0,0})); connect(volumeDTh.Cs3, sinkQ.C) annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); - annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); + connect(heatSource.C[1], volumeDTh.Cth) + annotation (Line(points={{0,-28.2},{0,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( + coordinateSystem(preserveAspectRatio=false))); end TestVolumeDTh_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeDTh_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeDTh_Traces.mo index 5a61dd4e..2ab2cf68 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeDTh_Traces.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeDTh_Traces.mo @@ -7,23 +7,25 @@ model TestVolumeDTh_Traces C_nominal={0.1}, C_default={0.2}); ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package - Medium = Medium) annotation (Placement(transformation(extent={{20,20}, - {40,40}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare - replaceable package Medium = Medium, + Medium = Medium) + annotation (Placement(transformation(extent={{20,20},{40,40}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ( + redeclare replaceable package Medium = Medium, Q0=100, - SubC0={0.5}) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); - ThermoSysPro.Fluid.Volumes.VolumeDTh - volumeDTh( - redeclare package Medium = Medium, + SubC0={0.5}) + annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.Fluid.Volumes.VolumeDTh volumeDTh( + redeclare package Medium = Medium, V=1, - dynamic_mass_balance=false) annotation (Placement(transformation(extent={{-12,-10}, - {8,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkQ( redeclare replaceable - package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10}, - {10,10}}, + dynamic_mass_balance=false) + annotation (Placement(transformation(extent={{-12,-10},{8,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkQ(redeclare replaceable + package Medium = Medium) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, rotation=0, origin={40,0}))); + Thermal.BoundaryConditions.HeatSource heatSource + annotation (Placement(transformation(extent={{-12,-28},{8,-48}}))); equation connect(volumeDTh.Cs1, sink.C) annotation (Line(points={{-2,10},{-2,30},{20,30}}, color={0,0,0})); @@ -31,5 +33,8 @@ equation annotation (Line(points={{-30,0},{-12,0}}, color={0,0,0})); connect(volumeDTh.Cs3, sinkQ.C) annotation (Line(points={{8,0},{30,0}}, color={0,0,0})); - annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); + connect(heatSource.C[1], volumeDTh.Cth) + annotation (Line(points={{-2,-28.2},{-2,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( + coordinateSystem(preserveAspectRatio=false))); end TestVolumeDTh_Traces; From 5270e5ce6e55bb8dc7491b60dc1fda34863bda20 Mon Sep 17 00:00:00 2001 From: LAMBLOT Simon Date: Wed, 25 Jun 2025 09:18:19 +0200 Subject: [PATCH 081/178] Examples with heat source --- .../SimpleExamples/Volumes/TestVolumeITh.mo | 27 ++++++++------ .../Volumes/TestVolumeITh_FlueGases.mo | 36 +++++++++++-------- .../Volumes/TestVolumeITh_Traces.mo | 33 +++++++++-------- 3 files changed, 56 insertions(+), 40 deletions(-) diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeITh.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeITh.mo index 86bd3bb8..66cffddc 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeITh.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeITh.mo @@ -4,17 +4,19 @@ model TestVolumeITh replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package - Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); - ThermoSysPro.Fluid.Volumes.VolumeITh - volumeITh( - redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ( - redeclare replaceable - package Medium = Medium) annotation (Placement(transformation(extent={{-52,-10}, - {-32,10}}))); + Medium = Medium) + annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.Volumes.VolumeITh volumeITh(redeclare package Medium = + Medium) + annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare + replaceable package Medium = Medium) + annotation (Placement(transformation(extent={{-52,-10},{-32,10}}))); ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare replaceable - package Medium = Medium) annotation (Placement(transformation(extent={{-50,10}, - {-30,30}}))); + package Medium = Medium) + annotation (Placement(transformation(extent={{-50,10},{-30,30}}))); + Thermal.BoundaryConditions.HeatSource heatSource + annotation (Placement(transformation(extent={{-10,-24},{10,-44}}))); equation connect(volumeITh.Cs3, sink.C) annotation (Line(points={{10,-8},{20,-8},{20,0},{30,0}}, color={0,0,0})); @@ -22,5 +24,8 @@ equation annotation (Line(points={{-32,0},{-10,0}}, color={0,0,0})); connect(sourceQ.C, volumeITh.Ce1) annotation (Line(points={{-30,20},{-10,20},{-10,8}}, color={0,0,0})); - annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); + connect(heatSource.C[1], volumeITh.Cth) + annotation (Line(points={{0,-24.2},{0,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( + coordinateSystem(preserveAspectRatio=false))); end TestVolumeITh; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeITh_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeITh_FlueGases.mo index 9979e040..bcdea0f4 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeITh_FlueGases.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeITh_FlueGases.mo @@ -3,26 +3,29 @@ model TestVolumeITh_FlueGases extends ThermoSysPro.UsersGuide.Icons.Example; replaceable package Medium = ThermoSysPro.Properties.Media.FlueGases; - ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package - Medium = Medium, + ThermoSysPro.Fluid.BoundaryConditions.Sink sink( + redeclare replaceable package Medium = Medium, T0=573.15, - option_temperature=true) annotation (Placement(transformation(extent={{26,-18}, - {46,2}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare - replaceable package Medium = Medium, + option_temperature=true) + annotation (Placement(transformation(extent={{26,-18},{46,2}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ( + redeclare replaceable package Medium = Medium, P0=4500000, T0=573.15, - option_temperature=true) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); - ThermoSysPro.Fluid.Volumes.VolumeITh - volumeITh( - redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare replaceable - package Medium = Medium, + option_temperature=true) + annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.Fluid.Volumes.VolumeITh volumeITh(redeclare package Medium = + Medium, h(start=2.83057e6)) + annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ( + redeclare replaceable package Medium = Medium, T0=573.15, - option_temperature=true) annotation (Placement(transformation(extent={{-10,-10}, - {10,10}}, + option_temperature=true) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, rotation=0, origin={-40,20}))); + Thermal.BoundaryConditions.HeatSource heatSource(T0={573.15}) + annotation (Placement(transformation(extent={{-10,-26},{10,-46}}))); equation connect(sourcePQ.C, volumeITh.Ce2) annotation (Line(points={{-30,0},{-10,0}}, color={0,0,0})); @@ -30,5 +33,8 @@ equation annotation (Line(points={{-30,20},{-10,20},{-10,8}}, color={0,0,0})); connect(volumeITh.Cs3, sink.C) annotation (Line(points={{10,-8},{26,-8}}, color={0,0,0})); - annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); + connect(heatSource.C[1], volumeITh.Cth) + annotation (Line(points={{0,-26.2},{0,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( + coordinateSystem(preserveAspectRatio=false))); end TestVolumeITh_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeITh_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeITh_Traces.mo index 446cf493..fed3dd5c 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeITh_Traces.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeITh_Traces.mo @@ -7,23 +7,25 @@ model TestVolumeITh_Traces C_nominal={0.1}, C_default={0.2}); ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package - Medium = Medium) annotation (Placement(transformation(extent={{20,20}, - {40,40}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare - replaceable package Medium = Medium, + Medium = Medium) + annotation (Placement(transformation(extent={{20,20},{40,40}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ( + redeclare replaceable package Medium = Medium, Q0=100, - SubC0={0.5}) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); - ThermoSysPro.Fluid.Volumes.VolumeITh - volumeITh( - redeclare package Medium = Medium, + SubC0={0.5}) + annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.Fluid.Volumes.VolumeITh volumeITh( + redeclare package Medium = Medium, V=1, - dynamic_mass_balance=false) annotation (Placement(transformation(extent={{-12,-10}, - {8,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ( + dynamic_mass_balance=false) + annotation (Placement(transformation(extent={{-12,-10},{8,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ( redeclare replaceable package Medium = Medium, Q0=100, - SubC0={0.5}) annotation (Placement(transformation(extent={{-56,18}, - {-36,38}}))); + SubC0={0.5}) + annotation (Placement(transformation(extent={{-56,18},{-36,38}}))); + Thermal.BoundaryConditions.HeatSource heatSource + annotation (Placement(transformation(extent={{-12,-28},{8,-48}}))); equation connect(volumeITh.Cs1, sink.C) annotation (Line(points={{8,8},{8,30},{20,30}}, color={0,0,0})); @@ -31,5 +33,8 @@ equation annotation (Line(points={{-30,0},{-12,0}}, color={0,0,0})); connect(sourceQ.C, volumeITh.Ce1) annotation (Line(points={{-36,28},{-12,28},{-12,8}}, color={0,0,0})); - annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); + connect(heatSource.C[1], volumeITh.Cth) + annotation (Line(points={{-2,-28.2},{-2,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( + coordinateSystem(preserveAspectRatio=false))); end TestVolumeITh_Traces; From 7339f1031bfa799c69d6da56ae390c43e1e7a486 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Fri, 27 Jun 2025 11:55:24 +0200 Subject: [PATCH 082/178] #125 no more IF97 annotation --- .../TestDynamicOnePhaseFlowPipe_FlueGases.mo | 13 ++++++++----- .../TestDynamicOnePhaseFlowPipe_Traces.mo | 2 +- .../Fluid/HeatExchangers/DynamicOnePhaseFlowPipe.mo | 2 -- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicOnePhaseFlowPipe_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicOnePhaseFlowPipe_FlueGases.mo index 56268e48..29f0ce1b 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicOnePhaseFlowPipe_FlueGases.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicOnePhaseFlowPipe_FlueGases.mo @@ -10,9 +10,12 @@ model TestDynamicOnePhaseFlowPipe_FlueGases ThermoSysPro.Fluid.HeatExchangers.DynamicOnePhaseFlowPipe dynamicOnePhaseFlowPipe( redeclare package Medium = Medium, Ns=1, - Q(start={34.51316334625123,34.51316334625123}), + Q(start=fill(36, dynamicOnePhaseFlowPipe.Ns + 1)), h(start={3077096.0822837264,3135044.986588299,3077096.0822837264}), - P(start={45e5,44.75e5,44.5e5}, displayUnit="bar")) annotation (Placement(transformation(extent={{-10,-10},{10,10}}, rotation=0))); + P(start=linspace( + 45, + 44.5, + dynamicOnePhaseFlowPipe.Ns + 2))) annotation (Placement(transformation(extent={{-10,-10},{10,10}}, rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP( redeclare package Medium = Medium, P0=4500000, @@ -23,10 +26,10 @@ model TestDynamicOnePhaseFlowPipe_FlueGases P0=4450000, T0=573.15) annotation (Placement(transformation(extent={{30,-10},{50,10}}, rotation=0))); ThermoSysPro.Thermal.BoundaryConditions.HeatSource heatSource( - T0={1000.005}, + T0=fill(726.855, dynamicOnePhaseFlowPipe.Ns), option_temperature=2, - W0={2e6}) annotation (Placement(transformation(extent={{-10,30},{10,50}}, rotation=0))); - ThermoSysPro.Thermal.HeatTransfer.HeatExchangerWall heatExchangerWall(Ns=1) annotation (Placement(transformation(extent={{-10,10},{10,30}}, rotation=0))); + W0=fill(2e6/dynamicOnePhaseFlowPipe.Ns, dynamicOnePhaseFlowPipe.Ns)) annotation (Placement(transformation(extent={{-10,30},{10,50}}, rotation=0))); + ThermoSysPro.Thermal.HeatTransfer.HeatExchangerWall heatExchangerWall(Ns=dynamicOnePhaseFlowPipe.Ns) annotation (Placement(transformation(extent={{-10,10},{10,30}}, rotation=0))); equation connect(sourceP.C, dynamicOnePhaseFlowPipe.C1) annotation (Line(points={{-30,0},{-10,0}}, color={0,0,255})); connect(dynamicOnePhaseFlowPipe.C2, sinkP.C) annotation (Line(points={{10,0},{30,0}}, color={0,0,255})); diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicOnePhaseFlowPipe_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicOnePhaseFlowPipe_Traces.mo index 09c998b9..84ca3da5 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicOnePhaseFlowPipe_Traces.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicOnePhaseFlowPipe_Traces.mo @@ -12,7 +12,7 @@ model TestDynamicOnePhaseFlowPipe_Traces Q(start={536.5750641592207,536.5750641592207,536.5750641592207,536.5750641592207,536.5750641592207,536.5750641592207,536.5750641592207,536.5750641592207,536.5750641592207,536.5750641592207,536.5750641592207}), h(start={71016.12237181116,74743.46665892199,78470.81094603281,82198.15523314364,85925.49952025448,89652.84380736532,93380.18809447614,97107.53238158698,100834.8766686978,104562.22095580865,108289.56524291947,70825.9016030344}), P(start={300000,281833.41863537,263664.30473175,245492.47958308,227317.76827098,209139.99948382,190959.00534677,172774.621262,154586.68575823,136395.04034906,118199.5293995,100000})) annotation (Placement(transformation(extent={{-10,-10},{10,10}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP(redeclare package Medium = Medium, SubC0={0.1,0.2,0.3}) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}, rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}, rotation=0))); ThermoSysPro.Thermal.BoundaryConditions.HeatSource heatSource( T0={1000,1100,1200,1300,1400,1500,1600,1700,1800,1900}, diff --git a/ThermoSysPro/Fluid/HeatExchangers/DynamicOnePhaseFlowPipe.mo b/ThermoSysPro/Fluid/HeatExchangers/DynamicOnePhaseFlowPipe.mo index 5451ccc9..f17e6fc0 100644 --- a/ThermoSysPro/Fluid/HeatExchangers/DynamicOnePhaseFlowPipe.mo +++ b/ThermoSysPro/Fluid/HeatExchangers/DynamicOnePhaseFlowPipe.mo @@ -44,12 +44,10 @@ model DynamicOnePhaseFlowPipe "Dynamic one-phase flow pipe" "true: continuous flow reversal - false: discontinuous flow reversal"; parameter Boolean diffusion=false "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; - parameter IF97Region region=IF97Region.All_regions "IF97 region (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); protected constant Units.SI.Acceleration g=Modelica.Constants.g_n "Gravity constant"; constant Real pi=Modelica.Constants.pi "pi"; - parameter Integer mode=Integer(region) - 1 "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; parameter Integer N=Ns + 1 "Number of hydraulic nodes (= number of thermal nodes + 1)"; parameter Units.SI.Area A=ntubes*pi*D^2/4 "Internal cross sectional pipe area"; From 900f9c49a1d2735d323b6580e4cba5b517270123 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Fri, 27 Jun 2025 12:18:54 +0200 Subject: [PATCH 083/178] #125 VolumeBth --- .../SimpleExamples/Volumes/TestVolumeBTh.mo | 32 +++++-------- .../Volumes/TestVolumeBTh_FlueGases.mo | 42 +++++++---------- .../Volumes/TestVolumeBTh_Traces.mo | 45 ++++++++----------- 3 files changed, 46 insertions(+), 73 deletions(-) diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeBTh.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeBTh.mo index 40e46e26..927f3cd4 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeBTh.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeBTh.mo @@ -3,33 +3,21 @@ model TestVolumeBTh extends ThermoSysPro.UsersGuide.Icons.Example; replaceable package Medium = Properties.Media.WaterSteam; - ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package - Medium = Medium) annotation (Placement(transformation( + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package Medium = Medium) annotation (Placement(transformation( extent={{-10,-10},{10,10}}, rotation=90, origin={0,38}))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare - replaceable package Medium = Medium) - annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); - ThermoSysPro.Fluid.Volumes.VolumeBTh volumeBTh(redeclare package Medium = - Medium) - annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare replaceable - package Medium = Medium) annotation (Placement(transformation( + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.Fluid.Volumes.VolumeBTh volumeBTh(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare replaceable package Medium = Medium) annotation (Placement(transformation( extent={{-10,-10},{10,10}}, rotation=180, origin={42,0}))); - Thermal.BoundaryConditions.HeatSource heatSource - annotation (Placement(transformation(extent={{-10,-22},{10,-42}}))); + Thermal.BoundaryConditions.HeatSource heatSource annotation (Placement(transformation(extent={{-10,-22},{10,-42}}))); equation - connect(sourcePQ.C, volumeBTh.Ce1) - annotation (Line(points={{-30,0},{-10,0}}, color={0,0,0})); - connect(volumeBTh.Ce2, sourceQ.C) annotation (Line(points={{10,0},{21,0},{21, - 7.21645e-16},{32,7.21645e-16}}, color={0,0,0})); - connect(volumeBTh.Cs1, sink.C) annotation (Line(points={{0,10},{0,19},{-5.55112e-16, - 19},{-5.55112e-16,28}}, color={0,0,0})); - connect(heatSource.C[1], volumeBTh.Cth) - annotation (Line(points={{0,-22.2},{0,0}}, color={0,0,0})); - annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( - coordinateSystem(preserveAspectRatio=false))); + connect(sourcePQ.C, volumeBTh.Ce1) annotation (Line(points={{-30,0},{-10,0}}, color={0,0,0})); + connect(volumeBTh.Ce2, sourceQ.C) annotation (Line(points={{10,0},{21,0},{21,7.21645e-16},{32,7.21645e-16}}, color={0,0,0})); + connect(volumeBTh.Cs1, sink.C) annotation (Line(points={{0,10},{0,19},{-5.55112e-16,19},{-5.55112e-16,28}}, color={0,0,0})); + connect(heatSource.C[1], volumeBTh.Cth) annotation (Line(points={{0,-22.2},{0,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestVolumeBTh; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeBTh_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeBTh_FlueGases.mo index 16d799e5..ae9b8890 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeBTh_FlueGases.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeBTh_FlueGases.mo @@ -3,39 +3,31 @@ model TestVolumeBTh_FlueGases extends ThermoSysPro.UsersGuide.Icons.Example; replaceable package Medium = Properties.Media.FlueGases; - ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package - Medium = Medium, + ThermoSysPro.Fluid.BoundaryConditions.Sink sink( + redeclare replaceable package Medium = Medium, T0=573.15, - option_temperature=true) annotation (Placement(transformation(extent={{-10,-10}, - {10,10}}, + option_temperature=true) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, rotation=90, origin={0,40}))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare - replaceable package Medium = Medium, + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ( + redeclare replaceable package Medium = Medium, P0=4500000, T0=573.15, - option_temperature=true) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); - ThermoSysPro.Fluid.Volumes.VolumeBTh - volumeBTh( - redeclare package Medium = Medium, h( - start=2.83057e6)) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare replaceable - package Medium = Medium, + option_temperature=true) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.Fluid.Volumes.VolumeBTh volumeBTh(redeclare package Medium = Medium, h(start=2.83057e6)) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ( + redeclare replaceable package Medium = Medium, T0=573.15, - option_temperature=true) annotation (Placement(transformation(extent={{-10,-10}, - {10,10}}, + option_temperature=true) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, rotation=180, origin={40,0}))); - Thermal.BoundaryConditions.HeatSource heatSource(T0={573.15}) annotation ( - Placement(transformation(extent={{-10,-22},{10,-42}}))); + Thermal.BoundaryConditions.HeatSource heatSource(T0={573.15}) annotation (Placement(transformation(extent={{-10,-22},{10,-42}}))); equation - connect(sourcePQ.C, volumeBTh.Ce1) - annotation (Line(points={{-30,0},{-10,0}}, color={0,0,0})); - connect(volumeBTh.Ce2, sourceQ.C) annotation (Line(points={{10,0},{25,0},{25, - 6.66134e-16},{30,6.66134e-16}}, color={0,0,0})); - connect(volumeBTh.Cs1, sink.C) annotation (Line(points={{0,10},{0,20},{ - -5.55112e-16,20},{-5.55112e-16,30}}, color={0,0,0})); - connect(heatSource.C[1], volumeBTh.Cth) - annotation (Line(points={{0,-22.2},{0,0}}, color={0,0,0})); + connect(sourcePQ.C, volumeBTh.Ce1) annotation (Line(points={{-30,0},{-10,0}}, color={0,0,0})); + connect(volumeBTh.Ce2, sourceQ.C) annotation (Line(points={{10,0},{25,0},{25,6.66134e-16},{30,6.66134e-16}}, color={0,0,0})); + connect(volumeBTh.Cs1, sink.C) annotation (Line(points={{0,10},{0,20},{-5.55112e-16,20},{-5.55112e-16,30}}, color={0,0,0})); + connect(heatSource.C[1], volumeBTh.Cth) annotation (Line(points={{0,-22.2},{0,0}}, color={0,0,0})); annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestVolumeBTh_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeBTh_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeBTh_Traces.mo index 0a686479..23543d62 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeBTh_Traces.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeBTh_Traces.mo @@ -2,38 +2,31 @@ within ThermoSysPro.Fluid.Examples.SimpleExamples.Volumes; model TestVolumeBTh_Traces extends ThermoSysPro.UsersGuide.Icons.Example; - replaceable package Medium = Properties.Media.WaterSteam (extraPropertiesNames={"Trace"}, C_nominal={0.1}, C_default={0.2}); - ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package - Medium = Medium) annotation (Placement(transformation(extent={{-10,-10}, - {10,10}}, + replaceable package Medium = Properties.Media.WaterSteam ( + extraPropertiesNames={"Trace"}, + C_nominal={0.1}, + C_default={0.2}); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package Medium = Medium) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, rotation=90, origin={0,36}))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare - replaceable package Medium = Medium, + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ( + redeclare replaceable package Medium = Medium, Q0=100, - SubC0={0.5}) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); - ThermoSysPro.Fluid.Volumes.VolumeBTh - volumeBTh( - redeclare package Medium = Medium, + SubC0={0.5}) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.Fluid.Volumes.VolumeBTh volumeBTh( + redeclare package Medium = Medium, V=1, - dynamic_mass_balance=false) annotation (Placement(transformation(extent={{-10,-10}, - {10,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare replaceable - package Medium = Medium, - SubC0={0.2}) annotation (Placement(transformation(extent={{-10,-10}, - {10,10}}, + dynamic_mass_balance=false) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare replaceable package Medium = Medium, SubC0={0.2}) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, rotation=180, origin={38,0}))); - Thermal.BoundaryConditions.HeatSource heatSource annotation (Placement(transformation(extent={{-10,-22}, - {10,-42}}))); + Thermal.BoundaryConditions.HeatSource heatSource annotation (Placement(transformation(extent={{-10,-22},{10,-42}}))); equation - connect(sourcePQ.C, volumeBTh.Ce1) - annotation (Line(points={{-30,0},{-10,0}}, color={0,0,0})); - connect(volumeBTh.Ce2, sourceQ.C) annotation (Line(points={{10,0},{19,0},{19, - 7.21645e-16},{28,7.21645e-16}}, color={0,0,0})); - connect(volumeBTh.Cs1, sink.C) - annotation (Line(points={{0,10},{0,26},{-6.66134e-16,26}}, color={0,0,0})); - connect(heatSource.C[1], volumeBTh.Cth) - annotation (Line(points={{0,-22.2},{0,0}}, color={0,0,0})); + connect(sourcePQ.C, volumeBTh.Ce1) annotation (Line(points={{-30,0},{-10,0}}, color={0,0,0})); + connect(volumeBTh.Ce2, sourceQ.C) annotation (Line(points={{10,0},{19,0},{19,7.21645e-16},{28,7.21645e-16}}, color={0,0,0})); + connect(volumeBTh.Cs1, sink.C) annotation (Line(points={{0,10},{0,26},{-6.66134e-16,26}}, color={0,0,0})); + connect(heatSource.C[1], volumeBTh.Cth) annotation (Line(points={{0,-22.2},{0,0}}, color={0,0,0})); annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestVolumeBTh_Traces; From dde0c82cf5132e7bc5752e350c5f5f158f34581c Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Fri, 27 Jun 2025 14:22:51 +0200 Subject: [PATCH 084/178] #125 IF97 imports --- ThermoSysPro/Fluid/HeatExchangers/DynamicOnePhaseFlowPipe.mo | 2 -- 1 file changed, 2 deletions(-) diff --git a/ThermoSysPro/Fluid/HeatExchangers/DynamicOnePhaseFlowPipe.mo b/ThermoSysPro/Fluid/HeatExchangers/DynamicOnePhaseFlowPipe.mo index f17e6fc0..17a39810 100644 --- a/ThermoSysPro/Fluid/HeatExchangers/DynamicOnePhaseFlowPipe.mo +++ b/ThermoSysPro/Fluid/HeatExchangers/DynamicOnePhaseFlowPipe.mo @@ -1,8 +1,6 @@ within ThermoSysPro.Fluid.HeatExchangers; model DynamicOnePhaseFlowPipe "Dynamic one-phase flow pipe" extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Units.SI.Length L=10. "Pipe length"; From 4c05a6169be12968c38fcad4fc4b28f6fd367850 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Fri, 27 Jun 2025 15:08:30 +0200 Subject: [PATCH 085/178] #125 VolumeCth reviewed --- .../SimpleExamples/Volumes/TestVolumeCTh.mo | 28 +++++---------- .../Volumes/TestVolumeCTh_FlueGases.mo | 19 ++++------ .../Volumes/TestVolumeCTh_Traces.mo | 35 +++++++------------ 3 files changed, 28 insertions(+), 54 deletions(-) diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeCTh.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeCTh.mo index 5c3cbd0d..ff030840 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeCTh.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeCTh.mo @@ -3,25 +3,15 @@ model TestVolumeCTh extends ThermoSysPro.UsersGuide.Icons.Example; replaceable package Medium = Properties.Media.WaterSteam; - ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package - Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare - replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); - ThermoSysPro.Fluid.Volumes.VolumeCTh - volumeCTh( - redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare replaceable - package Medium = Medium) annotation (Placement(transformation(extent={{-50,20},{-30,40}}))); - Thermal.BoundaryConditions.HeatSource heatSource annotation (Placement(transformation(extent={{-10,-26}, - {10,-46}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.Fluid.Volumes.VolumeCTh volumeCTh(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-50,20},{-30,40}}))); + Thermal.BoundaryConditions.HeatSource heatSource annotation (Placement(transformation(extent={{-10,-26},{10,-46}}))); equation - connect(sourcePQ.C, volumeCTh.Ce1) - annotation (Line(points={{-30,0},{-10,0}}, color={0,0,0})); - connect(sink.C, volumeCTh.Cs) - annotation (Line(points={{30,0},{10,0}}, color={0,0,0})); - connect(volumeCTh.Ce2, sourceQ.C) - annotation (Line(points={{0,10},{0,30},{-30,30}}, color={0,0,0})); - connect(heatSource.C[1], volumeCTh.Cth) - annotation (Line(points={{0,-26.2},{0,0}}, color={0,0,0})); + connect(sourcePQ.C, volumeCTh.Ce1) annotation (Line(points={{-30,0},{-10,0}}, color={0,0,0})); + connect(sink.C, volumeCTh.Cs) annotation (Line(points={{30,0},{10,0}}, color={0,0,0})); + connect(volumeCTh.Ce2, sourceQ.C) annotation (Line(points={{0,10},{0,30},{-30,30}}, color={0,0,0})); + connect(heatSource.C[1], volumeCTh.Cth) annotation (Line(points={{0,-26.2},{0,0}}, color={0,0,0})); annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestVolumeCTh; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeCTh_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeCTh_FlueGases.mo index b36afc50..224fc061 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeCTh_FlueGases.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeCTh_FlueGases.mo @@ -12,23 +12,16 @@ model TestVolumeCTh_FlueGases P0=4500000, T0=573.15, option_temperature=true) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); - ThermoSysPro.Fluid.Volumes.VolumeCTh - volumeCTh( - redeclare package Medium = Medium, h(start=2.83057e6)) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.Volumes.VolumeCTh volumeCTh(redeclare package Medium = Medium, h(start=2.83057e6)) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ( redeclare replaceable package Medium = Medium, T0=573.15, option_temperature=true) annotation (Placement(transformation(extent={{-50,20},{-30,40}}))); - Thermal.BoundaryConditions.HeatSource heatSource(T0={573.15}) annotation ( - Placement(transformation(extent={{-10,-24},{10,-44}}))); + Thermal.BoundaryConditions.HeatSource heatSource(T0={573.15}) annotation (Placement(transformation(extent={{-10,-24},{10,-44}}))); equation - connect(sourcePQ.C, volumeCTh.Ce1) - annotation (Line(points={{-30,0},{-10,0}}, color={0,0,0})); - connect(sink.C, volumeCTh.Cs) - annotation (Line(points={{30,0},{10,0}}, color={0,0,0})); - connect(volumeCTh.Ce2, sourceQ.C) - annotation (Line(points={{0,10},{0,30},{-30,30}}, color={0,0,0})); - connect(heatSource.C[1], volumeCTh.Cth) - annotation (Line(points={{0,-24.2},{0,0}}, color={0,0,0})); + connect(sourcePQ.C, volumeCTh.Ce1) annotation (Line(points={{-30,0},{-10,0}}, color={0,0,0})); + connect(sink.C, volumeCTh.Cs) annotation (Line(points={{30,0},{10,0}}, color={0,0,0})); + connect(volumeCTh.Ce2, sourceQ.C) annotation (Line(points={{0,10},{0,30},{-30,30}}, color={0,0,0})); + connect(heatSource.C[1], volumeCTh.Cth) annotation (Line(points={{0,-24.2},{0,0}}, color={0,0,0})); annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestVolumeCTh_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeCTh_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeCTh_Traces.mo index 3e3dbece..7b584788 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeCTh_Traces.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeCTh_Traces.mo @@ -2,28 +2,19 @@ within ThermoSysPro.Fluid.Examples.SimpleExamples.Volumes; model TestVolumeCTh_Traces extends ThermoSysPro.UsersGuide.Icons.Example; - replaceable package Medium = Properties.Media.WaterSteam(extraPropertiesNames={"Trace"}, C_nominal={0.1}, C_default={0.2}); - ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package - Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare - replaceable package Medium = Medium, SubC0={0.2}) - annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); - ThermoSysPro.Fluid.Volumes.VolumeCTh - volumeCTh( - redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare replaceable - package Medium = Medium, SubC0={0.1}) - annotation (Placement(transformation(extent={{-50,20},{-30,40}}))); - Thermal.BoundaryConditions.HeatSource heatSource annotation (Placement(transformation(extent={{-10,-22}, - {10,-42}}))); + replaceable package Medium = Properties.Media.WaterSteam ( + extraPropertiesNames={"Trace"}, + C_nominal={0.1}, + C_default={0.2}); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare replaceable package Medium = Medium, SubC0={0.2}) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.Fluid.Volumes.VolumeCTh volumeCTh(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare replaceable package Medium = Medium, SubC0={0.1}) annotation (Placement(transformation(extent={{-50,20},{-30,40}}))); + Thermal.BoundaryConditions.HeatSource heatSource annotation (Placement(transformation(extent={{-10,-22},{10,-42}}))); equation - connect(sourcePQ.C, volumeCTh.Ce1) - annotation (Line(points={{-30,0},{-10,0}}, color={0,0,0})); - connect(sink.C, volumeCTh.Cs) - annotation (Line(points={{30,0},{10,0}}, color={0,0,0})); - connect(volumeCTh.Ce2, sourceQ.C) - annotation (Line(points={{0,10},{0,30},{-30,30}}, color={0,0,0})); - connect(heatSource.C[1], volumeCTh.Cth) - annotation (Line(points={{0,-22.2},{0,0}}, color={0,0,0})); + connect(sourcePQ.C, volumeCTh.Ce1) annotation (Line(points={{-30,0},{-10,0}}, color={0,0,0})); + connect(sink.C, volumeCTh.Cs) annotation (Line(points={{30,0},{10,0}}, color={0,0,0})); + connect(volumeCTh.Ce2, sourceQ.C) annotation (Line(points={{0,10},{0,30},{-30,30}}, color={0,0,0})); + connect(heatSource.C[1], volumeCTh.Cth) annotation (Line(points={{0,-22.2},{0,0}}, color={0,0,0})); annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestVolumeCTh_Traces; From 79ec2fba930da6d558d1f2422d55e0b8cc98108f Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Fri, 27 Jun 2025 15:13:36 +0200 Subject: [PATCH 086/178] #125 VolumeDth reviewed --- .../SimpleExamples/Volumes/TestVolumeDTh.mo | 35 ++++++------------- .../Volumes/TestVolumeDTh_FlueGases.mo | 29 ++++++--------- .../Volumes/TestVolumeDTh_Traces.mo | 32 ++++++----------- 3 files changed, 32 insertions(+), 64 deletions(-) diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeDTh.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeDTh.mo index 9acf1edc..7f9fc507 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeDTh.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeDTh.mo @@ -3,29 +3,16 @@ model TestVolumeDTh extends ThermoSysPro.UsersGuide.Icons.Example; replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; - ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package - Medium = Medium) - annotation (Placement(transformation(extent={{30,-10},{50,10}}))); - ThermoSysPro.Fluid.Volumes.VolumeDTh volumeDTh(redeclare package Medium = - Medium) - annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare - replaceable package Medium = Medium) - annotation (Placement(transformation(extent={{-52,-10},{-32,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkQ(redeclare replaceable - package Medium = Medium) - annotation (Placement(transformation(extent={{12,22},{32,42}}))); - Thermal.BoundaryConditions.HeatSource heatSource - annotation (Placement(transformation(extent={{-10,-28},{10,-48}}))); + + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.Volumes.VolumeDTh volumeDTh(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-52,-10},{-32,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkQ(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{12,22},{32,42}}))); + Thermal.BoundaryConditions.HeatSource heatSource annotation (Placement(transformation(extent={{-10,-28},{10,-48}}))); equation - connect(sourcePQ.C, volumeDTh.Ce) - annotation (Line(points={{-32,0},{-10,0}}, color={0,0,0})); - connect(volumeDTh.Cs3, sink.C) - annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); - connect(volumeDTh.Cs1, sinkQ.C) - annotation (Line(points={{0,10},{0,32},{12,32}}, color={0,0,0})); - connect(heatSource.C[1], volumeDTh.Cth) - annotation (Line(points={{0,-28.2},{0,0}}, color={0,0,0})); - annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( - coordinateSystem(preserveAspectRatio=false))); + connect(sourcePQ.C, volumeDTh.Ce) annotation (Line(points={{-32,0},{-10,0}}, color={0,0,0})); + connect(volumeDTh.Cs3, sink.C) annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(volumeDTh.Cs1, sinkQ.C) annotation (Line(points={{0,10},{0,32},{12,32}}, color={0,0,0})); + connect(heatSource.C[1], volumeDTh.Cth) annotation (Line(points={{0,-28.2},{0,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestVolumeDTh; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeDTh_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeDTh_FlueGases.mo index 62a34f9d..25920676 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeDTh_FlueGases.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeDTh_FlueGases.mo @@ -3,20 +3,17 @@ model TestVolumeDTh_FlueGases extends ThermoSysPro.UsersGuide.Icons.Example; replaceable package Medium = ThermoSysPro.Properties.Media.FlueGases; + ThermoSysPro.Fluid.BoundaryConditions.Sink sink( redeclare replaceable package Medium = Medium, T0=573.15, - option_temperature=true) - annotation (Placement(transformation(extent={{26,16},{46,36}}))); + option_temperature=true) annotation (Placement(transformation(extent={{26,16},{46,36}}))); ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ( redeclare replaceable package Medium = Medium, P0=4500000, T0=573.15, - option_temperature=true) - annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); - ThermoSysPro.Fluid.Volumes.VolumeDTh volumeDTh(redeclare package Medium = - Medium, h(start=2.83057e6)) - annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + option_temperature=true) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.Fluid.Volumes.VolumeDTh volumeDTh(redeclare package Medium = Medium, h(start=2.83057e6)) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkQ( redeclare replaceable package Medium = Medium, T0=573.15, @@ -24,17 +21,11 @@ model TestVolumeDTh_FlueGases extent={{-10,-10},{10,10}}, rotation=0, origin={40,0}))); - Thermal.BoundaryConditions.HeatSource heatSource(T0={573.15}) - annotation (Placement(transformation(extent={{-10,-28},{10,-48}}))); + Thermal.BoundaryConditions.HeatSource heatSource(T0={573.15}) annotation (Placement(transformation(extent={{-10,-28},{10,-48}}))); equation - connect(volumeDTh.Cs1, sink.C) - annotation (Line(points={{0,10},{0,26},{26,26}}, color={0,0,0})); - connect(sourcePQ.C, volumeDTh.Ce) - annotation (Line(points={{-30,0},{-10,0}}, color={0,0,0})); - connect(volumeDTh.Cs3, sinkQ.C) - annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); - connect(heatSource.C[1], volumeDTh.Cth) - annotation (Line(points={{0,-28.2},{0,0}}, color={0,0,0})); - annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( - coordinateSystem(preserveAspectRatio=false))); + connect(volumeDTh.Cs1, sink.C) annotation (Line(points={{0,10},{0,26},{26,26}}, color={0,0,0})); + connect(sourcePQ.C, volumeDTh.Ce) annotation (Line(points={{-30,0},{-10,0}}, color={0,0,0})); + connect(volumeDTh.Cs3, sinkQ.C) annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(heatSource.C[1], volumeDTh.Cth) annotation (Line(points={{0,-28.2},{0,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestVolumeDTh_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeDTh_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeDTh_Traces.mo index 2ab2cf68..bd6a3ae9 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeDTh_Traces.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeDTh_Traces.mo @@ -6,35 +6,25 @@ model TestVolumeDTh_Traces extraPropertiesNames={"Trace"}, C_nominal={0.1}, C_default={0.2}); - ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package - Medium = Medium) - annotation (Placement(transformation(extent={{20,20},{40,40}}))); + + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{20,20},{40,40}}))); ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ( redeclare replaceable package Medium = Medium, Q0=100, - SubC0={0.5}) - annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + SubC0={0.5}) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); ThermoSysPro.Fluid.Volumes.VolumeDTh volumeDTh( redeclare package Medium = Medium, V=1, - dynamic_mass_balance=false) - annotation (Placement(transformation(extent={{-12,-10},{8,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkQ(redeclare replaceable - package Medium = Medium) annotation (Placement(transformation( + dynamic_mass_balance=false) annotation (Placement(transformation(extent={{-12,-10},{8,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkQ(redeclare replaceable package Medium = Medium) annotation (Placement(transformation( extent={{-10,-10},{10,10}}, rotation=0, origin={40,0}))); - Thermal.BoundaryConditions.HeatSource heatSource - annotation (Placement(transformation(extent={{-12,-28},{8,-48}}))); + Thermal.BoundaryConditions.HeatSource heatSource annotation (Placement(transformation(extent={{-12,-28},{8,-48}}))); equation - connect(volumeDTh.Cs1, sink.C) - annotation (Line(points={{-2,10},{-2,30},{20,30}}, color={0,0,0})); - connect(sourcePQ.C, volumeDTh.Ce) - annotation (Line(points={{-30,0},{-12,0}}, color={0,0,0})); - connect(volumeDTh.Cs3, sinkQ.C) - annotation (Line(points={{8,0},{30,0}}, color={0,0,0})); - connect(heatSource.C[1], volumeDTh.Cth) - annotation (Line(points={{-2,-28.2},{-2,0}}, color={0,0,0})); - annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( - coordinateSystem(preserveAspectRatio=false))); + connect(volumeDTh.Cs1, sink.C) annotation (Line(points={{-2,10},{-2,30},{20,30}}, color={0,0,0})); + connect(sourcePQ.C, volumeDTh.Ce) annotation (Line(points={{-30,0},{-12,0}}, color={0,0,0})); + connect(volumeDTh.Cs3, sinkQ.C) annotation (Line(points={{8,0},{30,0}}, color={0,0,0})); + connect(heatSource.C[1], volumeDTh.Cth) annotation (Line(points={{-2,-28.2},{-2,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestVolumeDTh_Traces; From 6976352412c9e73ba828caca3349cee41894bf87 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Fri, 27 Jun 2025 15:19:15 +0200 Subject: [PATCH 087/178] #125 VolumeIth reviewed --- .../SimpleExamples/Volumes/TestVolumeITh.mo | 35 ++++++------------- .../Volumes/TestVolumeITh_FlueGases.mo | 29 ++++++--------- .../Volumes/TestVolumeITh_Traces.mo | 32 ++++++----------- 3 files changed, 32 insertions(+), 64 deletions(-) diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeITh.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeITh.mo index 66cffddc..7bb2b515 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeITh.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeITh.mo @@ -3,29 +3,16 @@ model TestVolumeITh extends ThermoSysPro.UsersGuide.Icons.Example; replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; - ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package - Medium = Medium) - annotation (Placement(transformation(extent={{30,-10},{50,10}}))); - ThermoSysPro.Fluid.Volumes.VolumeITh volumeITh(redeclare package Medium = - Medium) - annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare - replaceable package Medium = Medium) - annotation (Placement(transformation(extent={{-52,-10},{-32,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare replaceable - package Medium = Medium) - annotation (Placement(transformation(extent={{-50,10},{-30,30}}))); - Thermal.BoundaryConditions.HeatSource heatSource - annotation (Placement(transformation(extent={{-10,-24},{10,-44}}))); + + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.Volumes.VolumeITh volumeITh(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-52,-10},{-32,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-50,10},{-30,30}}))); + Thermal.BoundaryConditions.HeatSource heatSource annotation (Placement(transformation(extent={{-10,-24},{10,-44}}))); equation - connect(volumeITh.Cs3, sink.C) - annotation (Line(points={{10,-8},{20,-8},{20,0},{30,0}}, color={0,0,0})); - connect(sourcePQ.C, volumeITh.Ce2) - annotation (Line(points={{-32,0},{-10,0}}, color={0,0,0})); - connect(sourceQ.C, volumeITh.Ce1) - annotation (Line(points={{-30,20},{-10,20},{-10,8}}, color={0,0,0})); - connect(heatSource.C[1], volumeITh.Cth) - annotation (Line(points={{0,-24.2},{0,0}}, color={0,0,0})); - annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( - coordinateSystem(preserveAspectRatio=false))); + connect(volumeITh.Cs3, sink.C) annotation (Line(points={{10,-8},{20,-8},{20,0},{30,0}}, color={0,0,0})); + connect(sourcePQ.C, volumeITh.Ce2) annotation (Line(points={{-32,0},{-10,0}}, color={0,0,0})); + connect(sourceQ.C, volumeITh.Ce1) annotation (Line(points={{-30,20},{-10,20},{-10,8}}, color={0,0,0})); + connect(heatSource.C[1], volumeITh.Cth) annotation (Line(points={{0,-24.2},{0,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestVolumeITh; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeITh_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeITh_FlueGases.mo index bcdea0f4..dd23d458 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeITh_FlueGases.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeITh_FlueGases.mo @@ -3,20 +3,17 @@ model TestVolumeITh_FlueGases extends ThermoSysPro.UsersGuide.Icons.Example; replaceable package Medium = ThermoSysPro.Properties.Media.FlueGases; + ThermoSysPro.Fluid.BoundaryConditions.Sink sink( redeclare replaceable package Medium = Medium, T0=573.15, - option_temperature=true) - annotation (Placement(transformation(extent={{26,-18},{46,2}}))); + option_temperature=true) annotation (Placement(transformation(extent={{26,-18},{46,2}}))); ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ( redeclare replaceable package Medium = Medium, P0=4500000, T0=573.15, - option_temperature=true) - annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); - ThermoSysPro.Fluid.Volumes.VolumeITh volumeITh(redeclare package Medium = - Medium, h(start=2.83057e6)) - annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + option_temperature=true) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.Fluid.Volumes.VolumeITh volumeITh(redeclare package Medium = Medium, h(start=2.83057e6)) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ( redeclare replaceable package Medium = Medium, T0=573.15, @@ -24,17 +21,11 @@ model TestVolumeITh_FlueGases extent={{-10,-10},{10,10}}, rotation=0, origin={-40,20}))); - Thermal.BoundaryConditions.HeatSource heatSource(T0={573.15}) - annotation (Placement(transformation(extent={{-10,-26},{10,-46}}))); + Thermal.BoundaryConditions.HeatSource heatSource(T0={573.15}) annotation (Placement(transformation(extent={{-10,-26},{10,-46}}))); equation - connect(sourcePQ.C, volumeITh.Ce2) - annotation (Line(points={{-30,0},{-10,0}}, color={0,0,0})); - connect(sourceQ.C, volumeITh.Ce1) - annotation (Line(points={{-30,20},{-10,20},{-10,8}}, color={0,0,0})); - connect(volumeITh.Cs3, sink.C) - annotation (Line(points={{10,-8},{26,-8}}, color={0,0,0})); - connect(heatSource.C[1], volumeITh.Cth) - annotation (Line(points={{0,-26.2},{0,0}}, color={0,0,0})); - annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( - coordinateSystem(preserveAspectRatio=false))); + connect(sourcePQ.C, volumeITh.Ce2) annotation (Line(points={{-30,0},{-10,0}}, color={0,0,0})); + connect(sourceQ.C, volumeITh.Ce1) annotation (Line(points={{-30,20},{-10,20},{-10,8}}, color={0,0,0})); + connect(volumeITh.Cs3, sink.C) annotation (Line(points={{10,-8},{26,-8}}, color={0,0,0})); + connect(heatSource.C[1], volumeITh.Cth) annotation (Line(points={{0,-26.2},{0,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestVolumeITh_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeITh_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeITh_Traces.mo index fed3dd5c..9b182a61 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeITh_Traces.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestVolumeITh_Traces.mo @@ -6,35 +6,25 @@ model TestVolumeITh_Traces extraPropertiesNames={"Trace"}, C_nominal={0.1}, C_default={0.2}); - ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package - Medium = Medium) - annotation (Placement(transformation(extent={{20,20},{40,40}}))); + + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{20,20},{40,40}}))); ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ( redeclare replaceable package Medium = Medium, Q0=100, - SubC0={0.5}) - annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + SubC0={0.5}) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); ThermoSysPro.Fluid.Volumes.VolumeITh volumeITh( redeclare package Medium = Medium, V=1, - dynamic_mass_balance=false) - annotation (Placement(transformation(extent={{-12,-10},{8,10}}))); + dynamic_mass_balance=false) annotation (Placement(transformation(extent={{-12,-10},{8,10}}))); ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ( redeclare replaceable package Medium = Medium, Q0=100, - SubC0={0.5}) - annotation (Placement(transformation(extent={{-56,18},{-36,38}}))); - Thermal.BoundaryConditions.HeatSource heatSource - annotation (Placement(transformation(extent={{-12,-28},{8,-48}}))); + SubC0={0.5}) annotation (Placement(transformation(extent={{-56,18},{-36,38}}))); + Thermal.BoundaryConditions.HeatSource heatSource annotation (Placement(transformation(extent={{-12,-28},{8,-48}}))); equation - connect(volumeITh.Cs1, sink.C) - annotation (Line(points={{8,8},{8,30},{20,30}}, color={0,0,0})); - connect(sourcePQ.C, volumeITh.Ce2) - annotation (Line(points={{-30,0},{-12,0}}, color={0,0,0})); - connect(sourceQ.C, volumeITh.Ce1) - annotation (Line(points={{-36,28},{-12,28},{-12,8}}, color={0,0,0})); - connect(heatSource.C[1], volumeITh.Cth) - annotation (Line(points={{-2,-28.2},{-2,0}}, color={0,0,0})); - annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( - coordinateSystem(preserveAspectRatio=false))); + connect(volumeITh.Cs1, sink.C) annotation (Line(points={{8,8},{8,30},{20,30}}, color={0,0,0})); + connect(sourcePQ.C, volumeITh.Ce2) annotation (Line(points={{-30,0},{-12,0}}, color={0,0,0})); + connect(sourceQ.C, volumeITh.Ce1) annotation (Line(points={{-36,28},{-12,28},{-12,8}}, color={0,0,0})); + connect(heatSource.C[1], volumeITh.Cth) annotation (Line(points={{-2,-28.2},{-2,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestVolumeITh_Traces; From 7d6286134d918d59e869b35e5cb17b4a3ca236af Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Fri, 27 Jun 2025 15:26:42 +0200 Subject: [PATCH 088/178] #125 CentrifugalPump reviewed --- .../Machines/TestCentrifugalPump.mo | 16 +++++----------- .../Machines/TestCentrifugalPump_FlueGases.mo | 10 +++------- .../Machines/TestCentrifugalPump_Traces.mo | 18 +++++------------- ThermoSysPro/Fluid/Machines/CentrifugalPump.mo | 5 +++-- 4 files changed, 16 insertions(+), 33 deletions(-) diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestCentrifugalPump.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestCentrifugalPump.mo index c9b51c33..b306260b 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestCentrifugalPump.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestCentrifugalPump.mo @@ -3,17 +3,11 @@ model TestCentrifugalPump extends ThermoSysPro.UsersGuide.Icons.Example; replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; - ThermoSysPro.Fluid.Machines.CentrifugalPump centrifugalPump( redeclare - replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10}, - {10,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package - Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare - replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + ThermoSysPro.Fluid.Machines.CentrifugalPump centrifugalPump(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); equation - connect(centrifugalPump.C2, sink.C) - annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); - connect(centrifugalPump.C1, sourcePQ.C) - annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); + connect(centrifugalPump.C2, sink.C) annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(centrifugalPump.C1, sourcePQ.C) annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestCentrifugalPump; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestCentrifugalPump_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestCentrifugalPump_FlueGases.mo index 2ffecfaa..9fdeb876 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestCentrifugalPump_FlueGases.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestCentrifugalPump_FlueGases.mo @@ -3,9 +3,7 @@ model TestCentrifugalPump_FlueGases extends ThermoSysPro.UsersGuide.Icons.Example; replaceable package Medium = ThermoSysPro.Properties.Media.FlueGases; - ThermoSysPro.Fluid.Machines.CentrifugalPump centrifugalPump( redeclare - replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-6,-10}, - {14,10}}))); + ThermoSysPro.Fluid.Machines.CentrifugalPump centrifugalPump(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-6,-10},{14,10}}))); ThermoSysPro.Fluid.BoundaryConditions.Sink sink( redeclare replaceable package Medium = Medium, T0=573.15, @@ -16,9 +14,7 @@ model TestCentrifugalPump_FlueGases T0=573.15, option_temperature=true) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); equation - connect(centrifugalPump.C2, sink.C) - annotation (Line(points={{14,0},{30,0}}, color={0,0,0})); - connect(centrifugalPump.C1, sourcePQ.C) - annotation (Line(points={{-6,0},{-30,0}}, color={0,0,0})); + connect(centrifugalPump.C2, sink.C) annotation (Line(points={{14,0},{30,0}}, color={0,0,0})); + connect(centrifugalPump.C1, sourcePQ.C) annotation (Line(points={{-6,0},{-30,0}}, color={0,0,0})); annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestCentrifugalPump_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestCentrifugalPump_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestCentrifugalPump_Traces.mo index d8f87653..8387f4d8 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestCentrifugalPump_Traces.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestCentrifugalPump_Traces.mo @@ -6,19 +6,11 @@ model TestCentrifugalPump_Traces extraPropertiesNames={"Trace"}, C_nominal={0.1}, C_default={0.2}); - ThermoSysPro.Fluid.Machines.CentrifugalPump centrifugalPump( redeclare - replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10}, - {10,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package - Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare - replaceable package Medium = Medium, SubC0={0.3}) - annotation (Placement(transformation(extent={{-52,-10}, - {-32,10}}))); + ThermoSysPro.Fluid.Machines.CentrifugalPump centrifugalPump(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare replaceable package Medium = Medium, SubC0={0.3}) annotation (Placement(transformation(extent={{-52,-10},{-32,10}}))); equation - connect(centrifugalPump.C2, sink.C) - annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); - connect(centrifugalPump.C1, sourcePQ.C) - annotation (Line(points={{-10,0},{-32,0}}, color={0,0,0})); + connect(centrifugalPump.C2, sink.C) annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(centrifugalPump.C1, sourcePQ.C) annotation (Line(points={{-10,0},{-32,0}}, color={0,0,0})); annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestCentrifugalPump_Traces; diff --git a/ThermoSysPro/Fluid/Machines/CentrifugalPump.mo b/ThermoSysPro/Fluid/Machines/CentrifugalPump.mo index 68693e41..2ee234f5 100644 --- a/ThermoSysPro/Fluid/Machines/CentrifugalPump.mo +++ b/ThermoSysPro/Fluid/Machines/CentrifugalPump.mo @@ -1,5 +1,7 @@ within ThermoSysPro.Fluid.Machines; model CentrifugalPump "Centrifugal pump" + extends ThermoSysPro.Fluid.Interfaces.IconColors; + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter ThermoSysPro.Units.nonSI.AngularVelocity_rpm N=1400 @@ -322,6 +324,5 @@ equation
  • Daniel Bouskela
  • Baligh El Hefni
  • -"), - DymolaStoredErrors); +")); end CentrifugalPump; From 9168f58de0c5b3f35dc42781fe7a09847a8ba3a0 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Wed, 2 Jul 2025 10:43:26 +0200 Subject: [PATCH 089/178] #125 StodolaTurbine no X in setStates --- ThermoSysPro/Fluid/Machines/StodolaTurbine.mo | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ThermoSysPro/Fluid/Machines/StodolaTurbine.mo b/ThermoSysPro/Fluid/Machines/StodolaTurbine.mo index 7173773a..d27c4b51 100644 --- a/ThermoSysPro/Fluid/Machines/StodolaTurbine.mo +++ b/ThermoSysPro/Fluid/Machines/StodolaTurbine.mo @@ -138,15 +138,15 @@ equation MechPower.signal = W; /* Fluid thermodynamic properties before the expansion */ - state_e=Medium.setState_phX(p=Pe, h=Ce.h, phase=phase_e); + state_e=Medium.setState_ph(p=Pe, h=Ce.h, phase=phase_e); Te = state_e.T; /* Fluid thermodynamic properties after the expansion */ - state_s1 = Medium.setState_phX(p=Ps, h=Hrs, phase=phase_s); + state_s1 = Medium.setState_ph(p=Ps, h=Hrs, phase=phase_s); /* Fluid thermodynamic properties at the outlet of the nozzle */ - state_s = Medium.setState_phX(p=Ps, h=Cs.h, phase=phase_s); + state_s = Medium.setState_ph(p=Ps, h=Cs.h, phase=phase_s); Ts = state_s.T; rhos = state_s.d; From 9790eeba770487237e262245245374c42740c136 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Wed, 2 Jul 2025 11:53:24 +0200 Subject: [PATCH 090/178] #125 no more X declaration in StodolaTurbine --- ThermoSysPro/Fluid/Machines/StodolaTurbine.mo | 2 -- 1 file changed, 2 deletions(-) diff --git a/ThermoSysPro/Fluid/Machines/StodolaTurbine.mo b/ThermoSysPro/Fluid/Machines/StodolaTurbine.mo index d27c4b51..83348bfc 100644 --- a/ThermoSysPro/Fluid/Machines/StodolaTurbine.mo +++ b/ThermoSysPro/Fluid/Machines/StodolaTurbine.mo @@ -55,7 +55,6 @@ public Units.SI.Velocity Vs "Fluid velocity at the outlet"; Units.SI.Density rhos(start=200) "Fluid density at the outlet"; Real xm(start=1.0,min=0) "Average vapor mass fraction"; - Medium.MassFraction X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Mass fractions"; public Medium.ThermodynamicState state_e; @@ -99,7 +98,6 @@ equation /* Fluid composition balance equations*/ Ce.Xi = Cs.Xi; - X = Ce.Xi; Ce.SubC = Cs.SubC; From 37c773ea3653ba8385141ed8a067f7d85d80a410 Mon Sep 17 00:00:00 2001 From: VESCOVI Guilherme Date: Wed, 2 Jul 2025 12:17:49 +0200 Subject: [PATCH 091/178] Removed X balance equation --- ThermoSysPro/Fluid/Machines/StodolaTurbine.mo | 3 --- 1 file changed, 3 deletions(-) diff --git a/ThermoSysPro/Fluid/Machines/StodolaTurbine.mo b/ThermoSysPro/Fluid/Machines/StodolaTurbine.mo index 83348bfc..b9e93725 100644 --- a/ThermoSysPro/Fluid/Machines/StodolaTurbine.mo +++ b/ThermoSysPro/Fluid/Machines/StodolaTurbine.mo @@ -96,9 +96,6 @@ equation Ce.diff_res_2 = Cs.diff_res_2 + (if (gamma_diff > 0) then 1/gamma_diff else 0); - /* Fluid composition balance equations*/ - Ce.Xi = Cs.Xi; - Ce.SubC = Cs.SubC; Q = Ce.Q; From b5dea3f9b27da19a9b139acd81e92f61fdb330be Mon Sep 17 00:00:00 2001 From: VESCOVI Guilherme Date: Wed, 2 Jul 2025 13:20:32 +0200 Subject: [PATCH 092/178] Included X balance equation for completeness (undid last commit) --- ThermoSysPro/Fluid/Machines/StodolaTurbine.mo | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ThermoSysPro/Fluid/Machines/StodolaTurbine.mo b/ThermoSysPro/Fluid/Machines/StodolaTurbine.mo index b9e93725..fc9b6cb4 100644 --- a/ThermoSysPro/Fluid/Machines/StodolaTurbine.mo +++ b/ThermoSysPro/Fluid/Machines/StodolaTurbine.mo @@ -95,6 +95,9 @@ equation Cs.diff_res_1 = Ce.diff_res_1 + (if (gamma_diff > 0) then 1/gamma_diff else 0); Ce.diff_res_2 = Cs.diff_res_2 + (if (gamma_diff > 0) then 1/gamma_diff else 0); + /* Fluid composition balance equations*/ + Ce.Xi = Cs.Xi; + Ce.SubC = Cs.SubC; From 00673bb9a44894614817e62505f3c3b4726d8e2e Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Wed, 2 Jul 2025 15:51:07 +0200 Subject: [PATCH 093/178] #125 Tank --- .../TestTank_withPipePressureLosses.mo | 61 ++++++ .../SimpleExamples/Volumes/package.order | 1 + ThermoSysPro/Fluid/Volumes/Tank.mo | 205 ++++++------------ 3 files changed, 130 insertions(+), 137 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestTank_withPipePressureLosses.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestTank_withPipePressureLosses.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestTank_withPipePressureLosses.mo new file mode 100644 index 00000000..24010d0b --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestTank_withPipePressureLosses.mo @@ -0,0 +1,61 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Volumes; +model TestTank_withPipePressureLosses + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; + ThermoSysPro.Fluid.PressureLosses.PipePressureLoss PerteDP1( + redeclare package Medium = Medium, + K=1.5, + Q(start=5282.482640023983), + rho(start=997.40780979054, displayUnit="g/cm3")) annotation (Placement(transformation(extent={{30,-50},{50,-30}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.ControlValve VanneReglante1( + redeclare package Medium = Medium, + Pm(start=21741.77302868171, displayUnit="bar"), + Q(start=-1.3278998585228342E-31)) annotation (Placement(transformation(extent={{-50,2},{-30,22}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP SourceP1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-90,-4},{-70,16}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP PuitsP1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{70,-50},{90,-30}}, rotation=0))); + ThermoSysPro.Fluid.Volumes.Tank Tank1( + redeclare package Medium = Medium, + z(fixed=false, start=5), + Cs1(Q(start=1.2116903504194741E-27)), + Cs2(P(start=3.2e5)), + rho(start=997.4119292829444, displayUnit="g/cm3")) annotation (Placement(transformation(extent={{-10,-10},{10,10}}, rotation=0))); + ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Rampe Rampe1 annotation (Placement(transformation(extent={{-90,30},{-70,50}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.PipePressureLoss PerteDP2( + redeclare package Medium = Medium, + K=1.5, + rho(start=997.33695032119, displayUnit="g/cm3")) annotation (Placement(transformation(extent={{30,-4},{50,16}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP PuitsP2(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{70,-4},{90,16}}, rotation=0))); +equation + connect(PerteDP1.C2, PuitsP1.C) annotation (Line(points={{50,-40},{70,-40}}, color={0,0,255})); + connect(SourceP1.C, VanneReglante1.C1) annotation (Line(points={{-70,6},{-50,6}}, color={0,0,255})); + connect(Tank1.Cs2, PerteDP1.C1) annotation (Line(points={{10,-6},{20,-6},{20,-40},{30,-40}}, color={0,0,255})); + connect(Rampe1.y, VanneReglante1.Ouv) annotation (Line(points={{-69,40},{-40,40},{-40,23}})); + connect(VanneReglante1.C2, Tank1.Ce1) annotation (Line(points={{-30,6},{-20,6},{-10,6}}, color={0,0,255})); + connect(Tank1.Cs1, PerteDP2.C1) annotation (Line(points={{10.2,6},{20,6},{30,6}}, color={0,0,255})); + connect(PerteDP2.C2, PuitsP2.C) annotation (Line(points={{50,6},{50,6},{70,6}}, color={0,0,255})); + annotation ( + experiment(StopTime=20), + Icon(graphics={ + Rectangle( + lineColor={200,200,200}, + fillColor={248,248,248}, + fillPattern=FillPattern.HorizontalCylinder, + extent={{-100.0,-100.0},{100.0,100.0}}, + radius=25.0), + Rectangle( + lineColor={128,128,128}, + extent={{-100.0,-100.0},{100.0,100.0}}, + radius=25.0), + Polygon( + origin={8.0,14.0}, + lineColor={78,138,73}, + fillColor={78,138,73}, + pattern=LinePattern.None, + fillPattern=FillPattern.Solid, + points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), + Documentation(info=" +

    Copyright © EDF 2002 - 2024

    +

    ThermoSysPro Version 4.1 +")); +end TestTank_withPipePressureLosses; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order index 20c87bb5..a5fe85b1 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order @@ -28,3 +28,4 @@ TestVolumeDTh_Traces TestVolumeITh TestVolumeITh_FlueGases TestVolumeITh_Traces +TestTank_withPipePressureLosses diff --git a/ThermoSysPro/Fluid/Volumes/Tank.mo b/ThermoSysPro/Fluid/Volumes/Tank.mo index ee44c999..8f318a1f 100644 --- a/ThermoSysPro/Fluid/Volumes/Tank.mo +++ b/ThermoSysPro/Fluid/Volumes/Tank.mo @@ -1,13 +1,11 @@ -within ThermoSysPro.Fluid.Volumes; +within ThermoSysPro.Fluid.Volumes; model Tank "Open vertical tank" - extends - ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidTypeParameterInterface; + extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; - parameter Units.SI.AbsolutePressure Patm=1.013e5 - "Pressure above the fluid level"; + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable function SaS = Medium.noSaS (SubC=SubC) annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + parameter Units.SI.AbsolutePressure Patm=1.013e5 "Pressure above the fluid level"; parameter Units.SI.Area A=1 "Tank cross sectional area"; parameter Units.SI.Position ze1=40 "Altitude of inlet 1"; parameter Units.SI.Position ze2=de2/2 "Altitude of inlet 2"; @@ -24,7 +22,7 @@ model Tank "Open vertical tank" parameter Boolean dynamic_energy_balance=true "true: dynamic energy balance equation - false: static energy balance equation"; parameter Boolean dynamic_mass_balance=false - "true: dynamic mass balance equation - false: static mass balance equation (active if the fluid is compressible and if dynamic_energy_balance=true)" annotation(Evaluate=true, Dialog(enable=isCompressible and dynamic_energy_balance)); + "true: dynamic mass balance equation - false: static mass balance equation (active if the fluid is compressible and if dynamic_energy_balance=true)" annotation(Evaluate=true, Dialog(enable=Medium.isCompressible and dynamic_energy_balance)); parameter Boolean steady_state=false "true: start from steady state - false: start from (P0, h0) (active if dynamic_energy_balance=true)" annotation(Evaluate=true, Dialog(enable=dynamic_energy_balance)); parameter Units.SI.SpecificEnthalpy h0=1.e5 @@ -42,46 +40,22 @@ model Tank "Open vertical tank" "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; parameter Units.SI.Density p_rho=0 "If > 0, fixed fluid density" annotation (Evaluate=true, Dialog(tab="Fluid", group="Fluid properties")); - parameter IF97Region region=IF97Region.All_regions "IF97 region (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); parameter Boolean dynamic_composition_balance=false - "true: dynamic fluid composition balance equation
    false: static fluid composition balance equation (active for flue gases)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.FlueGases), tab="Fluid", group="Fluid properties")); + "true: dynamic fluid composition balance equation
    false: static fluid composition balance equation (active for flue gases)" annotation(Evaluate=true, Dialog(tab="Fluid", group="Fluid properties")); - parameter ThermoSysPro.Units.SI.MassFraction Xco20=0.0 - "Initial CO2 mass fraction" annotation (Evaluate=true, Dialog( - enable=dynamic_composition_balance, - tab="Fluid", - group= - "Initial composition values (active for flue gases only if dynamic_composition_balance=true)")); - parameter ThermoSysPro.Units.SI.MassFraction Xh2o0=if ftype == FluidType.FlueGases then 0.05 else 0 - "Initial H20 mass fraction" annotation (Evaluate=true, Dialog( - enable=dynamic_composition_balance, - tab="Fluid", - group= - "Initial composition values (active for flue gases only if dynamic_composition_balance=true)")); - parameter ThermoSysPro.Units.SI.MassFraction Xo20=0.23 - "Initial O2 mass fraction" annotation (Evaluate=true, Dialog( - enable=dynamic_composition_balance, - tab="Fluid", - group= - "Initial composition values (active for flue gases only if dynamic_composition_balance=true)")); - parameter ThermoSysPro.Units.SI.MassFraction Xso20=0 - "Initial SO2 mass fraction" annotation (Evaluate=true, Dialog( + parameter Medium.ExtraProperty X0[Medium.nX]=Medium.X_default "Initial composition values" annotation (Evaluate=true, Dialog( enable=dynamic_composition_balance, tab="Fluid", - group= - "Initial composition values (active for flue gases only if dynamic_composition_balance=true)")); + group="Medium")); + protected - constant Units.SI.SpecificEnthalpy hr=2501569 - "Water/steam reference specific enthalpy at 0.01°C"; constant Units.SI.Acceleration g=Modelica.Constants.g_n "Gravity constant"; parameter Real eps=1.e-0 "Small number for the square function"; parameter Units.SI.Position zmin=1.e-6 "Minimum fluid level"; parameter Real pi=Modelica.Constants.pi; - parameter Boolean flue_gases=(ftype == FluidType.FlueGases) "Flue gases"; parameter Units.SI.MassFlowRate gamma0=1.e-4 "Pseudo-diffusion conductance use for continuous flow reversal (active if diffusion=false and continuous_flow_reversal = true)"; - parameter Integer mode=Integer(region) - 1 "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; public Units.SI.Position z "Fluid level"; @@ -91,6 +65,10 @@ public Units.SI.Density rho(start=998) "Fluid density"; Units.SI.MassFlowRate BQ "Right hand side of the mass balance equation"; Units.SI.Power BH "Right hand side of the energy balance equation"; + Medium.ExtraProperty BSubC[Medium.nC](quantity=Medium.extraPropertiesNames) "Right hand side of the trace balance equation"; + Medium.ExtraProperty SubC[Medium.nC](quantity=Medium.extraPropertiesNames, start=Medium.C_default) "Fluid trace substances"; + Medium.ExtraProperty SubCSaS[Medium.nC](quantity=Medium.extraPropertiesNames) "Trace modification in the trace balance equation"; + Medium.ThermodynamicState state; ThermoSysPro.Units.SI.PressureDifference deltaP_e1 "Presure loss for e1"; ThermoSysPro.Units.SI.PressureDifference deltaP_e2 "Presure loss for e2"; ThermoSysPro.Units.SI.PressureDifference deltaP_s1 "Presure loss for s1"; @@ -105,15 +83,8 @@ public Units.SI.Angle theta_s2; Units.SI.DerDensityByPressure ddph "density derivative by pressure"; Units.SI.DerDensityByEnthalpy ddhp "density derivative by enthalpy"; - FluidType fluids[5] "Fluids mixing in volume"; - Units.SI.MassFlowRate BXco2 "Right hand side of the CO2 balance equation"; - Units.SI.MassFlowRate BXh2o "Right hand side of the H2O balance equation"; - Units.SI.MassFlowRate BXo2 "Right hand side of the O2 balance equation"; - Units.SI.MassFlowRate BXso2 "Right hand side of the SO2 balance equation"; - ThermoSysPro.Units.SI.MassFraction Xco2 "CO2 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xh2o "H20 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xo2 "O2 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xso2 "SO2 mass fraction"; + Units.SI.MassFlowRate BX[Medium.nXi] "Right hand side of the X balance equation"; + Medium.ExtraProperty X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Fluid mass fraction"; Units.SI.Power Je1 "Thermal power diffusion from inlet e1"; Units.SI.Power Je2 "Thermal power diffusion from inlet e2"; Units.SI.Power Js1 "Thermal power diffusion from outlet s1"; @@ -132,16 +103,16 @@ public ThermoSysPro.InstrumentationAndControl.Connectors.OutputReal yLevel "Water level" annotation (Placement(transformation( extent={{100,10},{120,30}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce1 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce1(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-110,50},{-90,70}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs2 annotation ( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs2(redeclare package Medium = Medium) annotation ( Placement(transformation(extent={{90,-70},{110,-50}}, rotation=0))); ThermoSysPro.Thermal.Connectors.ThermalPort Cth annotation (Placement(transformation( extent={{-10,-10},{10,10}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce2 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce2(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-110,-70},{-90,-50}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs1 annotation ( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs1(redeclare package Medium = Medium) annotation ( Placement(transformation(extent={{92,50},{112,70}}, rotation=0))); initial equation if dynamic_energy_balance then @@ -158,19 +129,11 @@ initial equation z = z0; end if; - if flue_gases then - if dynamic_composition_balance then - if steady_state then - der(Xco2) = 0; - der(Xh2o) = 0; - der(Xo2) = 0; - der(Xso2) = 0; - else - Xco2 = Xco20; - Xh2o = Xh2o0; - Xo2 = Xo20; - Xso2 = Xso20; - end if; + if dynamic_composition_balance then + if steady_state then + der(X) = fill(0, Medium.nX); + else + X = X0[1:Medium.nXi]; end if; end if; @@ -180,27 +143,14 @@ equation assert(A > 0, "Cross-sectional area is non-positive"); end if; - /* Check that incoming fluids are compatible with fluid in volume */ - fluids[1] = ftype; - fluids[2] = Ce1.ftype; - fluids[3] = Ce2.ftype; - fluids[4] = Cs1.ftype; - fluids[5] = Cs2.ftype; - - assert(ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.isCompatible(fluids), - "Tank: fluids mixing in volume are not compatible with each other"); - if (cardinality(Ce1) == 0) then Ce1.Q = 0; Ce1.h = 1.e5; Ce1.h_vol_1 = 1.e5; Ce1.diff_res_1 = 0; Ce1.diff_on_1 = false; - Ce1.ftype = ftype; - Ce1.Xco2 = 0; - Ce1.Xh2o = 0; - Ce1.Xo2 = 0; - Ce1.Xso2 = 0; + Ce1.Xi = Medium.X_default[1:Medium.nXi]; + Ce1.SubC = Medium.C_default; end if; if (cardinality(Ce2) == 0) then @@ -209,11 +159,8 @@ equation Ce2.h_vol_1 = 1.e5; Ce2.diff_res_1 = 0; Ce2.diff_on_1 = false; - Ce2.ftype = ftype; - Ce2.Xco2 = 0; - Ce2.Xh2o = 0; - Ce2.Xo2 = 0; - Ce2.Xso2 = 0; + Ce2.Xi = Medium.X_default[1:Medium.nXi]; + Ce2.SubC = Medium.C_default; end if; if (cardinality(Cs1) == 0) then @@ -233,8 +180,8 @@ equation /* Mass balance equation */ BQ = Ce1.Q + Ce2.Q - Cs1.Q - Cs2.Q; - if isCompressible and dynamic_energy_balance and dynamic_mass_balance then - A*(ddph*der(P) + ddhp*der(h - Xh2o*hr))*z + A*rho*der(z) = BQ; + if Medium.isCompressible and dynamic_energy_balance and dynamic_mass_balance then + A*(ddph*der(P) + ddhp*der(h))*z + A*rho*der(z) = BQ; else A*rho*der(z) = BQ; end if; @@ -272,17 +219,17 @@ equation deltaP_s2*omega_s2^2 = ks2*ThermoSysPro.Functions.ThermoSquare(Cs2.Q, eps)/2/rho; /* Energy balance equation */ - BH = Ce1.Q*((Ce1.h - Ce1.Xh2o*hr) - (h - Xh2o*hr)) + Ce2.Q*((Ce2.h - Ce2.Xh2o*hr) - (h - Xh2o*hr)) - Cs1.Q*((Cs1.h - Cs1.Xh2o*hr) - (h - Xh2o*hr)) - Cs2.Q*((Cs2.h - Cs2.Xh2o*hr) - (h - Xh2o*hr)) + Cth.W + J; + BH = Ce1.Q*((Ce1.h - h)) + Ce2.Q*((Ce2.h - h)) - Cs1.Q*((Cs1.h - h)) - Cs2.Q*((Cs2.h - h)) + Cth.W + J; if dynamic_energy_balance then if z > zmin then if dynamic_mass_balance then - A*z*((P/rho*ddph - 1)*der(P) + (P/rho*ddhp + rho)*der(h - Xh2o*hr)) = BH; + A*z*((P/rho*ddph - 1)*der(P) + (P/rho*ddhp + rho)*der(h)) = BH; else - A*z*rho*der(h - Xh2o*hr) = BH; + A*z*rho*der(h) = BH; end if; else - der(h - Xh2o*hr) = 0; + der(h) = 0; end if; else BH = 0; @@ -299,42 +246,29 @@ equation yLevel.signal = z; /* Fluid composition balance equations */ - BXco2 = Ce1.Xco2*Ce1.Q + Ce2.Xco2*Ce2.Q - Cs1.Xco2*Cs1.Q - Cs2.Xco2*Cs2.Q; - BXh2o = Ce1.Xh2o*Ce1.Q + Ce2.Xh2o*Ce2.Q - Cs1.Xh2o*Cs1.Q - Cs2.Xh2o*Cs2.Q; - BXo2 = Ce1.Xo2*Ce1.Q + Ce2.Xo2*Ce2.Q - Cs1.Xo2*Cs1.Q - Cs2.Xo2*Cs2.Q; - BXso2 = Ce1.Xso2*Ce1.Q + Ce2.Xso2*Ce2.Q - Cs1.Xso2*Cs1.Q - Cs2.Xso2*Cs2.Q; - - if flue_gases then - if dynamic_composition_balance then - A*z*rho*der(Xco2) + Xco2*BQ = BXco2; - A*z*rho*der(Xh2o) + Xh2o*BQ = BXh2o; - A*z*rho*der(Xo2) + Xo2*BQ = BXo2; - A*z*rho*der(Xso2) + Xso2*BQ = BXso2; - else - Xco2*BQ = BXco2; - Xh2o*BQ = BXh2o; - Xo2*BQ = BXo2; - Xso2*BQ = BXso2; - end if; + BX = Ce1.Xi*Ce1.Q + Ce2.Xi*Ce2.Q - Cs1.Xi*Cs1.Q - Cs2.Xi*Cs2.Q; + + if dynamic_composition_balance then + A*z*rho*der(X) + X*BQ = BX; else - Xco2 = 0; - Xh2o = 0; - Xo2 = 0; - Xso2 = 0; + X*BQ = BX; end if; - Cs1.ftype = ftype; - Cs2.ftype = ftype; + Cs1.Xi = X; + Cs2.Xi = X; - Cs1.Xco2 = Xco2; - Cs1.Xh2o = Xh2o; - Cs1.Xo2 = Xo2; - Cs1.Xso2 = Xso2; + /* Traces composition balance equations */ + BSubC = Ce1.Q*Ce1.SubC + Ce2.Q*Ce2.SubC - Cs1.Q*Cs1.SubC - Cs2.Q*Cs2.SubC; - Cs2.Xco2 = Xco2; - Cs2.Xh2o = Xh2o; - Cs2.Xo2 = Xo2; - Cs2.Xso2 = Xso2; + SubCSaS = SaS(); + if dynamic_mass_balance then + A*z*rho*der(SubC) + SubC*BQ + A*z*rho*SubCSaS = BSubC; + else + A*z*rho*SubCSaS = BSubC; + end if; + + Cs1.SubC = SubC; + Cs2.SubC = SubC; /* Flow reversal */ if continuous_flow_reversal then @@ -393,42 +327,40 @@ equation /* Fluid thermodynamic properties */ P = Patm + rho*g*z/2; - T = ThermoSysPro.Properties.Fluid.Temperature_Ph(P, h, fluid, mode, Cs1.Xco2, Cs1.Xh2o, Cs1.Xo2, Cs1.Xso2); + state = Medium.setState_phX( + p=P, + h=h, + X=X); + + T = Medium.temperature(state); if (p_rho > 0) then rho = p_rho; else - rho = ThermoSysPro.Properties.Fluid.Density_Ph(P, h, fluid,mode, Cs1.Xco2, Cs1.Xh2o, Cs1.Xo2, Cs1.Xso2); + rho = Medium.density(state); end if; if dynamic_mass_balance then - ddph = ThermoSysPro.Properties.Fluid.Density_derp_Ph(P, h, fluid,mode, Cs1.Xco2, Cs1.Xh2o, Cs1.Xo2, Cs1.Xso2); - ddhp = ThermoSysPro.Properties.Fluid.Density_derh_Ph(P, h, fluid,mode, Cs1.Xco2, Cs1.Xh2o, Cs1.Xo2, Cs1.Xso2); + ddph = Medium.density_derp_h(state); + ddhp = Medium.density_derh_p(state); else ddph = 0; ddhp = 0; end if; + annotation ( Icon(coordinateSystem( preserveAspectRatio=false, extent={{-100,-100},{100,100}}, - grid={2,2}), graphics={ Rectangle(extent={{-100,100},{100,20}}), - Rectangle( + grid={2,2}), graphics={Rectangle(extent={{-100,100},{100,20}}), Rectangle( extent={{-100,20},{100,-100}}, lineColor={0,0,0}, - fillPattern=DynamicSelect(FillPattern.Solid, - if dynamic_mass_balance and dynamic_energy_balance then FillPattern.VerticalCylinder - else FillPattern.Solid), - fillColor= DynamicSelect({85,170,255}, - if dynamic_energy_balance then fill_color_dynamic - else if diffusion then fill_color_singular - else fill_color_static))}), + fillPattern=DynamicSelect(FillPattern.Solid, if dynamic_mass_balance and dynamic_energy_balance then FillPattern.VerticalCylinder else FillPattern.Solid), + fillColor=DynamicSelect({85,170,255}, if dynamic_energy_balance then fill_color_dynamic else if diffusion then fill_color_singular else fill_color_static))}), Diagram(coordinateSystem( preserveAspectRatio=false, extent={{-100,-100},{100,100}}, - grid={2,2}), graphics={Rectangle(extent={{-100,100},{100,20}}, - lineColor={28,108,200}), - Rectangle( + grid={2,2}), graphics={Rectangle(extent={{-100,100},{100,20}}, lineColor={28,108,200}), Rectangle( extent={{-100,20},{100,-100}}, lineColor={0,0,0}, fillPattern=FillPattern.Solid, @@ -442,8 +374,7 @@ equation

    Copyright © EDF 2002 - 2024

    ThermoSysPro Version 4.1

    This component model is documented in Sect. 14.5 of the ThermoSysPro book. -", - revisions=" +", revisions="

    Author

    • Daniel Bouskela
    • From a86b257bd2855c72a0ddd7f9a1ecbc2b8a2094e6 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Wed, 2 Jul 2025 16:21:02 +0200 Subject: [PATCH 094/178] #125 Tank with traces example Open an issue regarding the possibility to add a subC0 in tanks and volumes --- .../TestTank_Traces_withPipePressureLosses.mo | 66 +++++++++++++++++++ .../SimpleExamples/Volumes/package.order | 1 + 2 files changed, 67 insertions(+) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestTank_Traces_withPipePressureLosses.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestTank_Traces_withPipePressureLosses.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestTank_Traces_withPipePressureLosses.mo new file mode 100644 index 00000000..0107dd5f --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestTank_Traces_withPipePressureLosses.mo @@ -0,0 +1,66 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Volumes; +model TestTank_Traces_withPipePressureLosses + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam ( + extraPropertiesNames={"Trace"}, + C_nominal={0.1}, + C_default={0.2}); + ThermoSysPro.Fluid.PressureLosses.PipePressureLoss PerteDP1( + redeclare package Medium = Medium, + K=1.5, + Q(start=5282.482640023983), + rho(start=997.40780979054, displayUnit="g/cm3")) annotation (Placement(transformation(extent={{30,-50},{50,-30}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.ControlValve VanneReglante1( + redeclare package Medium = Medium, + Pm(start=21741.77302868171, displayUnit="bar"), + Q(start=-1.3278998585228342E-31)) annotation (Placement(transformation(extent={{-50,2},{-30,22}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP SourceP1(redeclare package Medium = Medium, SubC0={0.3}) + annotation (Placement(transformation(extent={{-90,-4},{-70,16}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP PuitsP1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{70,-50},{90,-30}}, rotation=0))); + ThermoSysPro.Fluid.Volumes.Tank Tank1( + redeclare package Medium = Medium, + SubC(start={0.9}), + z(fixed=false, start=5), + Cs1(Q(start=1.2116903504194741E-27)), + Cs2(P(start=3.2e5)), + rho(start=997.4119292829444, displayUnit="g/cm3")) annotation (Placement(transformation(extent={{-10,-10},{10,10}}, rotation=0))); + ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Rampe Rampe1 annotation (Placement(transformation(extent={{-90,30},{-70,50}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.PipePressureLoss PerteDP2( + redeclare package Medium = Medium, + K=1.5, + rho(start=997.33695032119, displayUnit="g/cm3")) annotation (Placement(transformation(extent={{30,-4},{50,16}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP PuitsP2(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{70,-4},{90,16}}, rotation=0))); +equation + connect(PerteDP1.C2, PuitsP1.C) annotation (Line(points={{50,-40},{70,-40}}, color={0,0,255})); + connect(SourceP1.C, VanneReglante1.C1) annotation (Line(points={{-70,6},{-50,6}}, color={0,0,255})); + connect(Tank1.Cs2, PerteDP1.C1) annotation (Line(points={{10,-6},{20,-6},{20,-40},{30,-40}}, color={0,0,255})); + connect(Rampe1.y, VanneReglante1.Ouv) annotation (Line(points={{-69,40},{-40,40},{-40,23}})); + connect(VanneReglante1.C2, Tank1.Ce1) annotation (Line(points={{-30,6},{-20,6},{-10,6}}, color={0,0,255})); + connect(Tank1.Cs1, PerteDP2.C1) annotation (Line(points={{10.2,6},{20,6},{30,6}}, color={0,0,255})); + connect(PerteDP2.C2, PuitsP2.C) annotation (Line(points={{50,6},{50,6},{70,6}}, color={0,0,255})); + annotation ( + experiment(StopTime=20), + Icon(graphics={ + Rectangle( + lineColor={200,200,200}, + fillColor={248,248,248}, + fillPattern=FillPattern.HorizontalCylinder, + extent={{-100.0,-100.0},{100.0,100.0}}, + radius=25.0), + Rectangle( + lineColor={128,128,128}, + extent={{-100.0,-100.0},{100.0,100.0}}, + radius=25.0), + Polygon( + origin={8.0,14.0}, + lineColor={78,138,73}, + fillColor={78,138,73}, + pattern=LinePattern.None, + fillPattern=FillPattern.Solid, + points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), + Documentation(info=" +

      Copyright © EDF 2002 - 2024

      +

      ThermoSysPro Version 4.1 +")); +end TestTank_Traces_withPipePressureLosses; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order index a5fe85b1..ef3c194c 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order @@ -29,3 +29,4 @@ TestVolumeITh TestVolumeITh_FlueGases TestVolumeITh_Traces TestTank_withPipePressureLosses +TestTank_Traces_withPipePressureLosses From 20bd0f14c045d87130433a17c4a4f3cddb60d3bb Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Thu, 3 Jul 2025 11:25:58 +0200 Subject: [PATCH 095/178] #125 Sensors --- .../SimpleExamples/Sensors/TestSensors.mo | 25 ++++++ .../Sensors/TestSensors_FlueGases.mo | 30 +++++++ .../Sensors/TestSensors_Traces.mo | 29 +++++++ .../SimpleExamples/Sensors/package.order | 3 + ThermoSysPro/Fluid/Sensors/SensorH.mo | 13 ++- ThermoSysPro/Fluid/Sensors/SensorP.mo | 13 ++- ThermoSysPro/Fluid/Sensors/SensorQ.mo | 13 ++- ThermoSysPro/Fluid/Sensors/SensorQv.mo | 23 ++---- ThermoSysPro/Fluid/Sensors/SensorSubC.mo | 81 +++++++++++++++++++ ThermoSysPro/Fluid/Sensors/SensorT.mo | 25 +++--- ThermoSysPro/Fluid/Sensors/SensorX.mo | 81 +++++++++++++++++++ ThermoSysPro/Fluid/Sensors/package.order | 2 + 12 files changed, 285 insertions(+), 53 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Sensors/TestSensors.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Sensors/TestSensors_FlueGases.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Sensors/TestSensors_Traces.mo create mode 100644 ThermoSysPro/Fluid/Sensors/SensorSubC.mo create mode 100644 ThermoSysPro/Fluid/Sensors/SensorX.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Sensors/TestSensors.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Sensors/TestSensors.mo new file mode 100644 index 00000000..c0f0702e --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Sensors/TestSensors.mo @@ -0,0 +1,25 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Sensors; +model TestSensors + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam; + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{86,-10},{106,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-106,-10},{-86,10}}))); + ThermoSysPro.Fluid.Sensors.SensorP sensorP(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-82,-2},{-62,18}}))); + ThermoSysPro.Fluid.Sensors.SensorQ sensorQ(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-58,-2},{-38,18}}))); + ThermoSysPro.Fluid.Sensors.SensorQv sensorQv(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-34,-2},{-14,18}}))); + ThermoSysPro.Fluid.Sensors.SensorH sensorH(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-2},{10,18}}))); + ThermoSysPro.Fluid.Sensors.SensorT sensorT(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{14,-2},{34,18}}))); + ThermoSysPro.Fluid.Sensors.SensorSubC sensorSubC(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{38,-2},{58,18}}))); + ThermoSysPro.Fluid.Sensors.SensorX sensorX(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{62,-2},{82,18}}))); +equation + connect(sensorP.C1, sourcePQ.C) annotation (Line(points={{-82,0},{-86,0}}, color={0,0,0})); + connect(sensorP.C2, sensorQ.C1) annotation (Line(points={{-61.8,0},{-58,0}}, color={0,0,0})); + connect(sensorQ.C2, sensorQv.C1) annotation (Line(points={{-37.8,0},{-34,0}}, color={0,0,0})); + connect(sensorQv.C2, sensorH.C1) annotation (Line(points={{-13.8,0},{-10,0}}, color={0,0,0})); + connect(sensorH.C2, sensorT.C1) annotation (Line(points={{10.2,0},{14,0}}, color={0,0,0})); + connect(sensorT.C2, sensorSubC.C1) annotation (Line(points={{34.2,0},{38,0}}, color={0,0,0})); + connect(sensorSubC.C2, sensorX.C1) annotation (Line(points={{58.2,0},{62,0}}, color={0,0,0})); + connect(sensorX.C2, sink.C) annotation (Line(points={{82.2,0},{86,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestSensors; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Sensors/TestSensors_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Sensors/TestSensors_FlueGases.mo new file mode 100644 index 00000000..2a5805a4 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Sensors/TestSensors_FlueGases.mo @@ -0,0 +1,30 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Sensors; +model TestSensors_FlueGases + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.FlueGases; + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package Medium = Medium, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{86,-10},{106,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare replaceable package Medium = Medium, + P0=4500000, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{-106,-10},{-86,10}}))); + ThermoSysPro.Fluid.Sensors.SensorP sensorP(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-82,-2},{-62,18}}))); + ThermoSysPro.Fluid.Sensors.SensorQ sensorQ(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-58,-2},{-38,18}}))); + ThermoSysPro.Fluid.Sensors.SensorQv sensorQv(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-34,-2},{-14,18}}))); + ThermoSysPro.Fluid.Sensors.SensorH sensorH(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-2},{10,18}}))); + ThermoSysPro.Fluid.Sensors.SensorT sensorT(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{14,-2},{34,18}}))); + ThermoSysPro.Fluid.Sensors.SensorSubC sensorSubC(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{38,-2},{58,18}}))); + ThermoSysPro.Fluid.Sensors.SensorX sensorX(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{62,-2},{82,18}}))); +equation + connect(sensorP.C1, sourcePQ.C) annotation (Line(points={{-82,0},{-86,0}}, color={0,0,0})); + connect(sensorP.C2, sensorQ.C1) annotation (Line(points={{-61.8,0},{-58,0}}, color={0,0,0})); + connect(sensorQ.C2, sensorQv.C1) annotation (Line(points={{-37.8,0},{-34,0}}, color={0,0,0})); + connect(sensorQv.C2, sensorH.C1) annotation (Line(points={{-13.8,0},{-10,0}}, color={0,0,0})); + connect(sensorH.C2, sensorT.C1) annotation (Line(points={{10.2,0},{14,0}}, color={0,0,0})); + connect(sensorT.C2, sensorSubC.C1) annotation (Line(points={{34.2,0},{38,0}}, color={0,0,0})); + connect(sensorSubC.C2, sensorX.C1) annotation (Line(points={{58.2,0},{62,0}}, color={0,0,0})); + connect(sensorX.C2, sink.C) annotation (Line(points={{82.2,0},{86,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestSensors_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Sensors/TestSensors_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Sensors/TestSensors_Traces.mo new file mode 100644 index 00000000..c163eb70 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Sensors/TestSensors_Traces.mo @@ -0,0 +1,29 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Sensors; +model TestSensors_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam ( + extraPropertiesNames={"Trace1"}, + C_nominal={0.1}, + C_default={0.2}); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{86,-10},{106,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare replaceable package Medium = Medium, SubC0={0.2}) + annotation (Placement(transformation(extent={{-106,-10},{-86,10}}))); + ThermoSysPro.Fluid.Sensors.SensorP sensorP(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-82,-2},{-62,18}}))); + ThermoSysPro.Fluid.Sensors.SensorQ sensorQ(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-58,-2},{-38,18}}))); + ThermoSysPro.Fluid.Sensors.SensorQv sensorQv(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-34,-2},{-14,18}}))); + ThermoSysPro.Fluid.Sensors.SensorH sensorH(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-2},{10,18}}))); + ThermoSysPro.Fluid.Sensors.SensorT sensorT(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{14,-2},{34,18}}))); + ThermoSysPro.Fluid.Sensors.SensorSubC sensorSubC(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{38,-2},{58,18}}))); + ThermoSysPro.Fluid.Sensors.SensorX sensorX(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{62,-2},{82,18}}))); +equation + connect(sensorP.C1, sourcePQ.C) annotation (Line(points={{-82,0},{-86,0}}, color={0,0,0})); + connect(sensorP.C2, sensorQ.C1) annotation (Line(points={{-61.8,0},{-58,0}}, color={0,0,0})); + connect(sensorQ.C2, sensorQv.C1) annotation (Line(points={{-37.8,0},{-34,0}}, color={0,0,0})); + connect(sensorQv.C2, sensorH.C1) annotation (Line(points={{-13.8,0},{-10,0}}, color={0,0,0})); + connect(sensorH.C2, sensorT.C1) annotation (Line(points={{10.2,0},{14,0}}, color={0,0,0})); + connect(sensorT.C2, sensorSubC.C1) annotation (Line(points={{34.2,0},{38,0}}, color={0,0,0})); + connect(sensorSubC.C2, sensorX.C1) annotation (Line(points={{58.2,0},{62,0}}, color={0,0,0})); + connect(sensorX.C2, sink.C) annotation (Line(points={{82.2,0},{86,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestSensors_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Sensors/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/Sensors/package.order index e69de29b..89cbb72b 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Sensors/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Sensors/package.order @@ -0,0 +1,3 @@ +TestSensors +TestSensors_FlueGases +TestSensors_Traces diff --git a/ThermoSysPro/Fluid/Sensors/SensorH.mo b/ThermoSysPro/Fluid/Sensors/SensorH.mo index d6fcfd4b..92c53c8f 100644 --- a/ThermoSysPro/Fluid/Sensors/SensorH.mo +++ b/ThermoSysPro/Fluid/Sensors/SensorH.mo @@ -1,15 +1,17 @@ within ThermoSysPro.Fluid.Sensors; model SensorH "Specific enthalpy sensor" + extends ThermoSysPro.Fluid.Interfaces.IconColors; + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); public ThermoSysPro.InstrumentationAndControl.Connectors.OutputReal Measure annotation (Placement(transformation( origin={0,102}, extent={{-10,-10},{10,10}}, rotation=90))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-110,-90},{-90,-70}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{92,-90},{112,-70}}, rotation=0))); equation @@ -26,12 +28,9 @@ equation C2.diff_res_1 = C1.diff_res_1; C1.diff_res_2 = C2.diff_res_2; - C1.ftype = C2.ftype; + C1.Xi = C2.Xi; - C1.Xco2 = C2.Xco2; - C1.Xh2o = C2.Xh2o; - C1.Xo2 = C2.Xo2; - C1.Xso2 = C2.Xso2; + C1.SubC = C2.SubC; /* Sensor signal */ Measure.signal = C1.h; diff --git a/ThermoSysPro/Fluid/Sensors/SensorP.mo b/ThermoSysPro/Fluid/Sensors/SensorP.mo index a173f50b..531cd540 100644 --- a/ThermoSysPro/Fluid/Sensors/SensorP.mo +++ b/ThermoSysPro/Fluid/Sensors/SensorP.mo @@ -1,15 +1,17 @@ within ThermoSysPro.Fluid.Sensors; model SensorP "Pressure sensor" + extends ThermoSysPro.Fluid.Interfaces.IconColors; + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); public ThermoSysPro.InstrumentationAndControl.Connectors.OutputReal Measure annotation (Placement(transformation( origin={0,102}, extent={{-10,-10},{10,10}}, rotation=90))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-110,-90},{-90,-70}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{92,-90},{112,-70}}, rotation=0))); equation @@ -26,12 +28,9 @@ equation C2.diff_res_1 = C1.diff_res_1; C1.diff_res_2 = C2.diff_res_2; - C1.ftype = C2.ftype; + C1.Xi = C2.Xi; - C1.Xco2 = C2.Xco2; - C1.Xh2o = C2.Xh2o; - C1.Xo2 = C2.Xo2; - C1.Xso2 = C2.Xso2; + C1.SubC = C2.SubC; /* Sensor signal */ Measure.signal = C1.P; diff --git a/ThermoSysPro/Fluid/Sensors/SensorQ.mo b/ThermoSysPro/Fluid/Sensors/SensorQ.mo index 2867db77..9deb22a2 100644 --- a/ThermoSysPro/Fluid/Sensors/SensorQ.mo +++ b/ThermoSysPro/Fluid/Sensors/SensorQ.mo @@ -1,15 +1,17 @@ within ThermoSysPro.Fluid.Sensors; model SensorQ "Mass flow sensor" + extends ThermoSysPro.Fluid.Interfaces.IconColors; + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); public ThermoSysPro.InstrumentationAndControl.Connectors.OutputReal Measure annotation (Placement(transformation( origin={0,102}, extent={{-10,-10},{10,10}}, rotation=90))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-110,-90},{-90,-70}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{92,-90},{112,-70}}, rotation=0))); equation @@ -26,12 +28,9 @@ equation C2.diff_res_1 = C1.diff_res_1; C1.diff_res_2 = C2.diff_res_2; - C1.ftype = C2.ftype; + C1.Xi = C2.Xi; - C1.Xco2 = C2.Xco2; - C1.Xh2o = C2.Xh2o; - C1.Xo2 = C2.Xo2; - C1.Xso2 = C2.Xso2; + C1.SubC = C2.SubC; /* Sensor signal */ Measure.signal = C1.Q; diff --git a/ThermoSysPro/Fluid/Sensors/SensorQv.mo b/ThermoSysPro/Fluid/Sensors/SensorQv.mo index 1f039216..2c9b2e9a 100644 --- a/ThermoSysPro/Fluid/Sensors/SensorQv.mo +++ b/ThermoSysPro/Fluid/Sensors/SensorQv.mo @@ -1,14 +1,12 @@ within ThermoSysPro.Fluid.Sensors; model SensorQv "Volumetric flow sensor" - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + extends ThermoSysPro.Fluid.Interfaces.IconColors; + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Integer output_unit=1 "Sensor outpu unit - 1: m3/h, other: m3/s"; - parameter IF97Region region=IF97Region.All_regions "IF97 region (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); protected constant Real pi=Modelica.Constants.pi "pi"; - parameter Integer mode=Integer(region) - 1 "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; Units.SI.Time facteur=if (output_unit == 1) then 3600 else 1 "Unit factor"; public @@ -17,8 +15,6 @@ public Units.SI.AbsolutePressure Pm "Fluid average pressure"; Units.SI.SpecificEnthalpy h "Fluid specific enthalpy"; Units.SI.Density rho(start=998) "Fluid density"; - FluidType ftype "Fluid type"; - Integer fluid=Integer(ftype) "Fluid number"; public ThermoSysPro.InstrumentationAndControl.Connectors.OutputReal Measure @@ -26,9 +22,9 @@ public origin={0,102}, extent={{-10,-10},{10,10}}, rotation=90))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-110,-90},{-90,-70}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{92,-90},{112,-70}}, rotation=0))); equation @@ -45,17 +41,12 @@ equation C2.diff_res_1 = C1.diff_res_1; C1.diff_res_2 = C2.diff_res_2; - C1.ftype = C2.ftype; + C1.Xi = C2.Xi; - C1.Xco2 = C2.Xco2; - C1.Xh2o = C2.Xh2o; - C1.Xo2 = C2.Xo2; - C1.Xso2 = C2.Xso2; + C1.SubC = C2.SubC; Q = C1.Q; - ftype = C1.ftype; - /* Sensor signal */ Qv = Q/rho; Measure.signal = Qv*facteur; @@ -63,7 +54,7 @@ equation /* Fluid thermodynamic properties */ Pm = (C1.P + C2.P)/2; h = C1.h; - rho = ThermoSysPro.Properties.Fluid.Density_Ph(C1.P,h,fluid,mode,C1.Xco2, C1.Xh2o, C1.Xo2, C1.Xso2); + rho = Medium.density_phX(p=Pm, h=h, X=C1.Xi); annotation ( Icon(coordinateSystem( diff --git a/ThermoSysPro/Fluid/Sensors/SensorSubC.mo b/ThermoSysPro/Fluid/Sensors/SensorSubC.mo new file mode 100644 index 00000000..8f4b21fe --- /dev/null +++ b/ThermoSysPro/Fluid/Sensors/SensorSubC.mo @@ -0,0 +1,81 @@ +within ThermoSysPro.Fluid.Sensors; +model SensorSubC "SubC sensor" + extends ThermoSysPro.Fluid.Interfaces.IconColors; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); +public + ThermoSysPro.InstrumentationAndControl.Connectors.OutputReal[Medium.nC] Measure + annotation (Placement(transformation( + origin={0,102}, + extent={{-10,-10},{10,10}}, + rotation=90))); + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1(redeclare package Medium = Medium) annotation (Placement( + transformation(extent={{-110,-90},{-90,-70}}, rotation=0))); + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2(redeclare package Medium = Medium) annotation (Placement( + transformation(extent={{92,-90},{112,-70}}, rotation=0))); +equation + + C1.P = C2.P; + C1.Q = C2.Q; + C1.h = C2.h; + + C1.h_vol_1 = C2.h_vol_1; + C1.h_vol_2 = C2.h_vol_2; + + C2.diff_on_1 = C1.diff_on_1; + C1.diff_on_2 = C2.diff_on_2; + + C2.diff_res_1 = C1.diff_res_1; + C1.diff_res_2 = C2.diff_res_2; + + C1.Xi = C2.Xi; + + C1.SubC = C2.SubC; + + /* Sensor signal */ + Measure.signal = C1.SubC; + + annotation ( + Icon(coordinateSystem( + preserveAspectRatio=false, + extent={{-100,-100},{100,100}}, + grid={2,2}), graphics={ + Ellipse( + extent={{-60,92},{60,-28}}, + lineColor={0,0,0}, + fillPattern=FillPattern.Solid, + fillColor=DynamicSelect({127,255,0}, fill_color_singular)), + Line(points={{0,-28},{0,-80}}), + Line(points={{-98,-80},{102,-80}}), + Text(extent={{-60,60},{60,0}}, textString= + "C")}), + Window( + x=0.62, + y=0.25, + width=0.35, + height=0.49), + Diagram(coordinateSystem( + preserveAspectRatio=false, + extent={{-100,-100},{100,100}}, + grid={2,2}), graphics={ + Ellipse( + extent={{-60,92},{60,-28}}, + lineColor={0,0,0}, + fillPattern=FillPattern.Solid, + fillColor={0,255,0}), + Line(points={{0,-28},{0,-80}}), + Line(points={{-98,-80},{102,-80}}), + Text(extent={{-60,60},{60,0}}, textString= + "C")}), + Documentation(info=" +

      Copyright © EDF 2002 - 2024

      +

      ThermoSysPro Version 4.1

      +", + revisions=" +

      Authors

      +
        +
      • Daniel Bouskela
      • +
      • Baligh El Hefni
      • +
      +")); +end SensorSubC; diff --git a/ThermoSysPro/Fluid/Sensors/SensorT.mo b/ThermoSysPro/Fluid/Sensors/SensorT.mo index 5c4d341d..e9ec13d9 100644 --- a/ThermoSysPro/Fluid/Sensors/SensorT.mo +++ b/ThermoSysPro/Fluid/Sensors/SensorT.mo @@ -1,14 +1,12 @@ within ThermoSysPro.Fluid.Sensors; model SensorT "Temperature sensor" - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + extends ThermoSysPro.Fluid.Interfaces.IconColors; + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Integer output_unit=1 "Sensor outpu unit - 1: m3/h, other: m3/s"; - parameter IF97Region region=IF97Region.All_regions "IF97 region (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); protected constant Real pi=Modelica.Constants.pi "pi"; - parameter Integer mode=Integer(region) - 1 "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; parameter Units.SI.MassFlowRate Qeps=1.e-3 "Minimum mass flow rate for continuous flow reversal"; @@ -17,8 +15,7 @@ public Units.SI.Temperature T "Fluid temperature"; Units.SI.AbsolutePressure P "Fluid average pressure"; Units.SI.SpecificEnthalpy h "Fluid specific enthalpy"; - FluidType ftype "Fluid type"; - Integer fluid=Integer(ftype) "Fluid number"; + Medium.MassFraction X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Mass fractions"; public ThermoSysPro.InstrumentationAndControl.Connectors.OutputReal Measure @@ -29,9 +26,9 @@ public extent={{-10,-10},{10,10}}, rotation=90, origin={0,102}))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-110,-90},{-90,-70}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{92,-90},{112,-70}}, rotation=0))); equation @@ -48,16 +45,12 @@ equation C2.diff_res_1 = C1.diff_res_1; C1.diff_res_2 = C2.diff_res_2; - C1.ftype = C2.ftype; + C1.Xi = C2.Xi; - C1.Xco2 = C2.Xco2; - C1.Xh2o = C2.Xh2o; - C1.Xo2 = C2.Xo2; - C1.Xso2 = C2.Xso2; + C1.SubC = C2.SubC; Q = C1.Q; - - ftype = C1.ftype; + X = C1.Xi; /* Sensor signal */ Measure.signal = T; @@ -66,7 +59,7 @@ equation P = (C1.P + C2.P)/2; h = (C1.h + C2.h)/2; - T = ThermoSysPro.Properties.Fluid.Temperature_Ph(P, h,fluid,mode,C1.Xco2, C1.Xh2o, C1.Xo2, C1.Xso2); + T = Medium.temperature_phX(p=P, h=h, X=X); annotation ( Diagram(coordinateSystem( diff --git a/ThermoSysPro/Fluid/Sensors/SensorX.mo b/ThermoSysPro/Fluid/Sensors/SensorX.mo new file mode 100644 index 00000000..a6a72209 --- /dev/null +++ b/ThermoSysPro/Fluid/Sensors/SensorX.mo @@ -0,0 +1,81 @@ +within ThermoSysPro.Fluid.Sensors; +model SensorX "X sensor" + extends ThermoSysPro.Fluid.Interfaces.IconColors; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); +public + ThermoSysPro.InstrumentationAndControl.Connectors.OutputReal[Medium.nXi] Measure + annotation (Placement(transformation( + origin={0,102}, + extent={{-10,-10},{10,10}}, + rotation=90))); + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1(redeclare package Medium = Medium) annotation (Placement( + transformation(extent={{-110,-90},{-90,-70}}, rotation=0))); + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2(redeclare package Medium = Medium) annotation (Placement( + transformation(extent={{92,-90},{112,-70}}, rotation=0))); +equation + + C1.P = C2.P; + C1.Q = C2.Q; + C1.h = C2.h; + + C1.h_vol_1 = C2.h_vol_1; + C1.h_vol_2 = C2.h_vol_2; + + C2.diff_on_1 = C1.diff_on_1; + C1.diff_on_2 = C2.diff_on_2; + + C2.diff_res_1 = C1.diff_res_1; + C1.diff_res_2 = C2.diff_res_2; + + C1.Xi = C2.Xi; + + C1.SubC = C2.SubC; + + /* Sensor signal */ + Measure.signal = C1.Xi; + + annotation ( + Icon(coordinateSystem( + preserveAspectRatio=false, + extent={{-100,-100},{100,100}}, + grid={2,2}), graphics={ + Ellipse( + extent={{-60,92},{60,-28}}, + lineColor={0,0,0}, + fillPattern=FillPattern.Solid, + fillColor=DynamicSelect({127,255,0}, fill_color_singular)), + Line(points={{0,-28},{0,-80}}), + Line(points={{-98,-80},{102,-80}}), + Text(extent={{-60,60},{60,0}}, textString= + "X")}), + Window( + x=0.62, + y=0.25, + width=0.35, + height=0.49), + Diagram(coordinateSystem( + preserveAspectRatio=false, + extent={{-100,-100},{100,100}}, + grid={2,2}), graphics={ + Ellipse( + extent={{-60,92},{60,-28}}, + lineColor={0,0,0}, + fillPattern=FillPattern.Solid, + fillColor={0,255,0}), + Line(points={{0,-28},{0,-80}}), + Line(points={{-98,-80},{102,-80}}), + Text(extent={{-60,60},{60,0}}, textString= + "X")}), + Documentation(info=" +

      Copyright © EDF 2002 - 2024

      +

      ThermoSysPro Version 4.1

      +", + revisions=" +

      Authors

      +
        +
      • Daniel Bouskela
      • +
      • Baligh El Hefni
      • +
      +")); +end SensorX; diff --git a/ThermoSysPro/Fluid/Sensors/package.order b/ThermoSysPro/Fluid/Sensors/package.order index f2873124..eefb8c73 100644 --- a/ThermoSysPro/Fluid/Sensors/package.order +++ b/ThermoSysPro/Fluid/Sensors/package.order @@ -3,3 +3,5 @@ SensorQ SensorQv SensorH SensorT +SensorSubC +SensorX From 50bb2e0eb1f028ab36f7671c2497571b5885cd19 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Thu, 3 Jul 2025 11:49:36 +0200 Subject: [PATCH 096/178] #125 SensorT without X redeclaration --- ThermoSysPro/Fluid/Sensors/SensorT.mo | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/ThermoSysPro/Fluid/Sensors/SensorT.mo b/ThermoSysPro/Fluid/Sensors/SensorT.mo index e9ec13d9..307551eb 100644 --- a/ThermoSysPro/Fluid/Sensors/SensorT.mo +++ b/ThermoSysPro/Fluid/Sensors/SensorT.mo @@ -15,7 +15,6 @@ public Units.SI.Temperature T "Fluid temperature"; Units.SI.AbsolutePressure P "Fluid average pressure"; Units.SI.SpecificEnthalpy h "Fluid specific enthalpy"; - Medium.MassFraction X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Mass fractions"; public ThermoSysPro.InstrumentationAndControl.Connectors.OutputReal Measure @@ -50,7 +49,6 @@ equation C1.SubC = C2.SubC; Q = C1.Q; - X = C1.Xi; /* Sensor signal */ Measure.signal = T; @@ -59,7 +57,7 @@ equation P = (C1.P + C2.P)/2; h = (C1.h + C2.h)/2; - T = Medium.temperature_phX(p=P, h=h, X=X); + T = Medium.temperature_phX(p=P, h=h, X=C1.Xi); annotation ( Diagram(coordinateSystem( From 9b2d7a9fb7a1fe1ab3724354b6626792ad8e434e Mon Sep 17 00:00:00 2001 From: VESCOVI Guilherme Date: Thu, 3 Jul 2025 15:13:45 +0200 Subject: [PATCH 097/178] Simplified sensor T et Qv : removed unused variables, transformed facteur into parameter instead of variable --- ThermoSysPro/Fluid/Sensors/SensorQv.mo | 9 ++------- ThermoSysPro/Fluid/Sensors/SensorT.mo | 16 +--------------- 2 files changed, 3 insertions(+), 22 deletions(-) diff --git a/ThermoSysPro/Fluid/Sensors/SensorQv.mo b/ThermoSysPro/Fluid/Sensors/SensorQv.mo index 2c9b2e9a..83b43337 100644 --- a/ThermoSysPro/Fluid/Sensors/SensorQv.mo +++ b/ThermoSysPro/Fluid/Sensors/SensorQv.mo @@ -6,14 +6,11 @@ model SensorQv "Volumetric flow sensor" parameter Integer output_unit=1 "Sensor outpu unit - 1: m3/h, other: m3/s"; protected - constant Real pi=Modelica.Constants.pi "pi"; - Units.SI.Time facteur=if (output_unit == 1) then 3600 else 1 "Unit factor"; + parameter Units.SI.Time facteur=if (output_unit == 1) then 3600 else 1 "Unit factor"; public Units.SI.MassFlowRate Q(start=500) "Mass flow rate"; Units.SI.VolumeFlowRate Qv(start=0.5) "Volume flow rate"; - Units.SI.AbsolutePressure Pm "Fluid average pressure"; - Units.SI.SpecificEnthalpy h "Fluid specific enthalpy"; Units.SI.Density rho(start=998) "Fluid density"; public @@ -52,9 +49,7 @@ equation Measure.signal = Qv*facteur; /* Fluid thermodynamic properties */ - Pm = (C1.P + C2.P)/2; - h = C1.h; - rho = Medium.density_phX(p=Pm, h=h, X=C1.Xi); + rho = Medium.density_phX(p=C1.P, h=C1.h, X=C1.Xi); annotation ( Icon(coordinateSystem( diff --git a/ThermoSysPro/Fluid/Sensors/SensorT.mo b/ThermoSysPro/Fluid/Sensors/SensorT.mo index 307551eb..2a6d4746 100644 --- a/ThermoSysPro/Fluid/Sensors/SensorT.mo +++ b/ThermoSysPro/Fluid/Sensors/SensorT.mo @@ -3,18 +3,9 @@ model SensorT "Temperature sensor" extends ThermoSysPro.Fluid.Interfaces.IconColors; replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); - parameter Integer output_unit=1 "Sensor outpu unit - 1: m3/h, other: m3/s"; - -protected - constant Real pi=Modelica.Constants.pi "pi"; - parameter Units.SI.MassFlowRate Qeps=1.e-3 - "Minimum mass flow rate for continuous flow reversal"; public - Units.SI.MassFlowRate Q(start=500) "Mass flow rate"; Units.SI.Temperature T "Fluid temperature"; - Units.SI.AbsolutePressure P "Fluid average pressure"; - Units.SI.SpecificEnthalpy h "Fluid specific enthalpy"; public ThermoSysPro.InstrumentationAndControl.Connectors.OutputReal Measure @@ -48,16 +39,11 @@ equation C1.SubC = C2.SubC; - Q = C1.Q; - /* Sensor signal */ Measure.signal = T; /* Fluid thermodynamic properties */ - P = (C1.P + C2.P)/2; - h = (C1.h + C2.h)/2; - - T = Medium.temperature_phX(p=P, h=h, X=C1.Xi); + T = Medium.temperature_phX(p=C1.P, h=C1.h, X=C1.Xi); annotation ( Diagram(coordinateSystem( From 2544d6371c625b70110830bb64b3b716ee38cb99 Mon Sep 17 00:00:00 2001 From: VESCOVI Guilherme Date: Fri, 13 Jun 2025 16:49:07 +0200 Subject: [PATCH 098/178] rebase conflict #125 RefT --- ThermoSysPro/Fluid/BoundaryConditions/RefT.mo | 32 +++++++---------- .../BoundaryConditions/TestRefT.mo | 33 +++++++++++++++++ .../BoundaryConditions/TestRefT_Traces.mo | 35 +++++++++++++++++++ .../BoundaryConditions/package.order | 3 ++ 4 files changed, 84 insertions(+), 19 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefT.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefT_Traces.mo diff --git a/ThermoSysPro/Fluid/BoundaryConditions/RefT.mo b/ThermoSysPro/Fluid/BoundaryConditions/RefT.mo index a5795521..7aeecfc4 100644 --- a/ThermoSysPro/Fluid/BoundaryConditions/RefT.mo +++ b/ThermoSysPro/Fluid/BoundaryConditions/RefT.mo @@ -1,28 +1,24 @@ within ThermoSysPro.Fluid.BoundaryConditions; model RefT "Fixed temperature reference" extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); - parameter Units.SI.Temperature T0=290 "Fixed fluid temperature"; - parameter IF97Region region=IF97Region.All_regions "IF97 region (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); -protected - parameter Integer mode=Integer(region) - 1 "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; + parameter Units.SI.Temperature T0=290 "Fixed fluid temperature"; public Units.SI.MassFlowRate Q "Fluid mass flow rate"; Units.SI.AbsolutePressure P "Fluid pressure"; Units.SI.SpecificEnthalpy h "Fluid specific enthalpy"; - FluidType ftype "Fluid type"; - Integer fluid=Integer(ftype) "Fluid number"; + Medium.MassFraction X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Mass fractions"; + - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1 annotation (Placement( + + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-110,-10},{-90,10}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{90,-10},{110,10}}, rotation=0))); - ThermoSysPro.InstrumentationAndControl.Connectors.InputReal ITemperature - annotation (Placement(transformation( + ThermoSysPro.InstrumentationAndControl.Connectors.InputReal ITemperature annotation (Placement(transformation( origin={0,110}, extent={{-10,-10},{10,10}}, rotation=270))); @@ -45,21 +41,19 @@ equation C2.diff_res_1 = C1.diff_res_1; C1.diff_res_2 = C2.diff_res_2; - C1.ftype = C2.ftype; + C1.Xi = C2.Xi; + + X = C1.Xi; - C1.Xco2 = C2.Xco2; - C1.Xh2o = C2.Xh2o; - C1.Xo2 = C2.Xo2; - C1.Xso2 = C2.Xso2; + C1.SubC = C2.SubC; Q = C1.Q; P = C1.P; h = C1.h; - ftype = C1.ftype; /* Computation of the fluid specific enthalpy */ - h = ThermoSysPro.Properties.Fluid.SpecificEnthalpy_PT(P, ITemperature.signal, fluid, mode, C1.Xco2, C1.Xh2o, C1.Xo2, C1.Xso2); + h = Medium.specificEnthalpy_pTX(p=P, T=ITemperature.signal, X=X); annotation ( Diagram(coordinateSystem( diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefT.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefT.mo new file mode 100644 index 00000000..8e00782c --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefT.mo @@ -0,0 +1,33 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.BoundaryConditions; +model TestRefT + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam; + + + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare package Medium = + Medium) + annotation (Placement(transformation(extent={{66,-10},{86,10}}))); + ThermoSysPro.Fluid.PressureLosses.PipePressureLoss pipePressureLoss( + redeclare package Medium = Medium) + annotation (Placement(transformation(extent={{32,-10},{52,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.RefT refT(redeclare package Medium = + Medium) + annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare package + Medium = Medium, h0=2600e3) + annotation (Placement(transformation(extent={{-66,-10},{-46,10}}))); + InstrumentationAndControl.Blocks.Sources.Constante constante(k=120 + 273.15) + annotation (Placement(transformation(extent={{-30,38},{-10,58}}))); +equation + connect(sink.C, pipePressureLoss.C2) + annotation (Line(points={{66,0},{52,0}}, color={0,0,0})); + connect(refT.C2, pipePressureLoss.C1) + annotation (Line(points={{10,0},{32,0}}, color={0,0,0})); + connect(sourceQ.C, refT.C1) + annotation (Line(points={{-46,0},{-10,0}}, color={0,0,0})); + connect(constante.y, refT.ITemperature) + annotation (Line(points={{-9,48},{0,48},{0,11}}, color={0,0,255})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( + coordinateSystem(preserveAspectRatio=false))); +end TestRefT; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefT_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefT_Traces.mo new file mode 100644 index 00000000..061c7084 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefT_Traces.mo @@ -0,0 +1,35 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.BoundaryConditions; +model TestRefT_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam(extraPropertiesNames={"Trace1", "Trace2", "Trace3"}, C_nominal={0.1, 0.2, 0.3}, C_default={0.2, 0.3, 0.4}); + + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package + Medium = + Medium) + annotation (Placement(transformation(extent={{66,-10},{86,10}}))); + ThermoSysPro.Fluid.PressureLosses.PipePressureLoss pipePressureLoss( + redeclare replaceable package Medium = Medium) + annotation (Placement(transformation(extent={{32,-10},{52,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.RefT refT(redeclare replaceable package + Medium = + Medium) + annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare replaceable + package + Medium = Medium, h0=2600e3, SubC0={10,20,30}) + annotation (Placement(transformation(extent={{-66,-10},{-46,10}}))); + InstrumentationAndControl.Blocks.Sources.Constante constante(k=120 + 273.15) + annotation (Placement(transformation(extent={{-30,38},{-10,58}}))); +equation + connect(sink.C, pipePressureLoss.C2) + annotation (Line(points={{66,0},{52,0}}, color={0,0,0})); + connect(refT.C2, pipePressureLoss.C1) + annotation (Line(points={{10,0},{32,0}}, color={0,0,0})); + connect(sourceQ.C, refT.C1) + annotation (Line(points={{-46,0},{-10,0}}, color={0,0,0})); + connect(constante.y, refT.ITemperature) + annotation (Line(points={{-9,48},{0,48},{0,11}}, color={0,0,255})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( + coordinateSystem(preserveAspectRatio=false))); +end TestRefT_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/package.order index c11cd786..8be81470 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/package.order @@ -4,3 +4,6 @@ TestRefQ_Traces_FlueGases TestRefP TestRefP_Traces TestRefP_Traces_FlueGases +TestRefT +TestRefT_Traces + From a5a447924a0209774c0144bd2825ee0b589e5a34 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Thu, 3 Jul 2025 15:39:13 +0200 Subject: [PATCH 099/178] #125 Splitter2 and Mixer2 --- .../SimpleExamples/Junctions/TestMixer2.mo | 26 +++++++++ .../Junctions/TestMixer2_FlueGases.mo | 36 +++++++++++++ .../Junctions/TestMixer2_Traces.mo | 29 ++++++++++ .../SimpleExamples/Junctions/TestSplitter2.mo | 26 +++++++++ .../Junctions/TestSplitter2_FlueGases.mo | 41 ++++++++++++++ .../Junctions/TestSplitter2_Traces.mo | 30 +++++++++++ .../SimpleExamples/Junctions/package.order | 6 +++ ThermoSysPro/Fluid/Junctions/Mixer2.mo | 45 ++++------------ ThermoSysPro/Fluid/Junctions/Splitter2.mo | 54 +++++-------------- 9 files changed, 217 insertions(+), 76 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMixer2.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMixer2_FlueGases.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMixer2_Traces.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestSplitter2.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestSplitter2_FlueGases.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestSplitter2_Traces.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMixer2.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMixer2.mo new file mode 100644 index 00000000..1c642156 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMixer2.mo @@ -0,0 +1,26 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Junctions; +model TestMixer2 + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam; + ThermoSysPro.Fluid.Junctions.Mixer2 mixer2_1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-6,-10},{14,10}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{34,-10},{54,10}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-46,10},{-26,30}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss2(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-46,-30},{-26,-10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.Source sourceP(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-86,10},{-66,30}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-86,-30},{-66,-10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkP(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{74,-10},{94,10}}, rotation=0))); + InstrumentationAndControl.Blocks.Sources.Constante constante(k=0) annotation (Placement(transformation(extent={{-46,-10},{-26,10}}, rotation=0))); +equation + connect(singularPressureLoss1.C2, mixer2_1.Ce1) annotation (Line(points={{-26,20},{0,20},{0,10}}, color={0,0,255})); + connect(singularPressureLoss2.C2, mixer2_1.Ce2) annotation (Line(points={{-26,-20},{0,-20},{0,-10}}, color={0,0,255})); + connect(mixer2_1.Cs, singularPressureLoss.C1) annotation (Line(points={{14,0},{34,0}}, color={0,0,255})); + connect(sourceP.C, singularPressureLoss1.C1) annotation (Line(points={{-66,20},{-46,20}}, color={0,0,255})); + connect(sourceP1.C, singularPressureLoss2.C1) annotation (Line(points={{-66,-20},{-46,-20}}, color={0,0,255})); + connect(singularPressureLoss.C2, sinkP.C) annotation (Line(points={{54,0},{74,0}}, color={0,0,255})); + connect(constante.y, mixer2_1.Ialpha1) annotation (Line(points={{-25,0},{-14,0},{-14,6},{-3,6}})); + annotation (experiment(StopTime=10), Documentation(info=" +

      Copyright © EDF 2002 - 2024

      +

      ThermoSysPro Version 4.1 +")); +end TestMixer2; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMixer2_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMixer2_FlueGases.mo new file mode 100644 index 00000000..51231454 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMixer2_FlueGases.mo @@ -0,0 +1,36 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Junctions; +model TestMixer2_FlueGases + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.FlueGases ( + extraPropertiesNames={"Trace"}, + C_nominal={0.1}, + C_default={0.2}); + ThermoSysPro.Fluid.Junctions.Mixer2 mixer2_1(redeclare package Medium = Medium, h(start=2.83057e6)) + annotation (Placement(transformation(extent={{-6,-10},{14,10}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{34,-10},{54,10}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-46,10},{-26,30}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss2(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-46,-30},{-26,-10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.Source sourceP(redeclare package Medium = Medium, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{-86,10},{-66,30}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP1(redeclare package Medium = Medium, + P0=4500000, + T0=573.15) annotation (Placement(transformation(extent={{-86,-30},{-66,-10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkP(redeclare package Medium = Medium, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{74,-10},{94,10}}, rotation=0))); + InstrumentationAndControl.Blocks.Sources.Constante constante(k=0) annotation (Placement(transformation(extent={{-46,-10},{-26,10}}, rotation=0))); +equation + connect(singularPressureLoss1.C2, mixer2_1.Ce1) annotation (Line(points={{-26,20},{0,20},{0,10}}, color={0,0,255})); + connect(singularPressureLoss2.C2, mixer2_1.Ce2) annotation (Line(points={{-26,-20},{0,-20},{0,-10}}, color={0,0,255})); + connect(mixer2_1.Cs, singularPressureLoss.C1) annotation (Line(points={{14,0},{34,0}}, color={0,0,255})); + connect(sourceP.C, singularPressureLoss1.C1) annotation (Line(points={{-66,20},{-46,20}}, color={0,0,255})); + connect(sourceP1.C, singularPressureLoss2.C1) annotation (Line(points={{-66,-20},{-46,-20}}, color={0,0,255})); + connect(singularPressureLoss.C2, sinkP.C) annotation (Line(points={{54,0},{74,0}}, color={0,0,255})); + connect(constante.y, mixer2_1.Ialpha1) annotation (Line(points={{-25,0},{-14,0},{-14,6},{-3,6}})); + annotation (experiment(StopTime=10), Documentation(info=" +

      Copyright © EDF 2002 - 2024

      +

      ThermoSysPro Version 4.1 +")); +end TestMixer2_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMixer2_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMixer2_Traces.mo new file mode 100644 index 00000000..7aabeb2c --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMixer2_Traces.mo @@ -0,0 +1,29 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Junctions; +model TestMixer2_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam ( + extraPropertiesNames={"Trace"}, + C_nominal={0.1}, + C_default={0.2}); + ThermoSysPro.Fluid.Junctions.Mixer2 mixer2_1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-6,-10},{14,10}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{34,-10},{54,10}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-46,10},{-26,30}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss2(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-46,-30},{-26,-10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.Source sourceP(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-86,10},{-66,30}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-86,-30},{-66,-10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkP(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{74,-10},{94,10}}, rotation=0))); + InstrumentationAndControl.Blocks.Sources.Constante constante(k=0) annotation (Placement(transformation(extent={{-46,-10},{-26,10}}, rotation=0))); +equation + connect(singularPressureLoss1.C2, mixer2_1.Ce1) annotation (Line(points={{-26,20},{0,20},{0,10}}, color={0,0,255})); + connect(singularPressureLoss2.C2, mixer2_1.Ce2) annotation (Line(points={{-26,-20},{0,-20},{0,-10}}, color={0,0,255})); + connect(mixer2_1.Cs, singularPressureLoss.C1) annotation (Line(points={{14,0},{34,0}}, color={0,0,255})); + connect(sourceP.C, singularPressureLoss1.C1) annotation (Line(points={{-66,20},{-46,20}}, color={0,0,255})); + connect(sourceP1.C, singularPressureLoss2.C1) annotation (Line(points={{-66,-20},{-46,-20}}, color={0,0,255})); + connect(singularPressureLoss.C2, sinkP.C) annotation (Line(points={{54,0},{74,0}}, color={0,0,255})); + connect(constante.y, mixer2_1.Ialpha1) annotation (Line(points={{-25,0},{-14,0},{-14,6},{-3,6}})); + annotation (experiment(StopTime=10), Documentation(info=" +

      Copyright © EDF 2002 - 2024

      +

      ThermoSysPro Version 4.1 +")); +end TestMixer2_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestSplitter2.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestSplitter2.mo new file mode 100644 index 00000000..7558ca29 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestSplitter2.mo @@ -0,0 +1,26 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Junctions; +model TestSplitter2 + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam; + ThermoSysPro.Fluid.Junctions.Splitter2 splitter2(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-20,-10},{0,10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceP(redeclare replaceable package Medium = Medium, Q0=200) annotation (Placement(transformation(extent={{-100,-10},{-80,10}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-60,-10},{-40,10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sinkP(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{80,30},{100,50}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP1(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{80,-50},{100,-30}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss1(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{40,30},{60,50}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss2(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{40,-50},{60,-30}}, rotation=0))); + ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Constante constante(k=0.2) annotation (Placement(transformation(extent={{-40,10},{-20,30}}, rotation=0))); +equation + connect(sourceP.C, singularPressureLoss.C1) annotation (Line(points={{-80,0},{-60,0}}, color={0,0,255})); + connect(singularPressureLoss.C2, splitter2.Ce) annotation (Line(points={{-40,0},{-20,0}}, color={0,0,255})); + connect(splitter2.Cs1, singularPressureLoss1.C1) annotation (Line(points={{-6,10},{-6,40},{40,40}}, color={0,0,255})); + connect(singularPressureLoss1.C2, sinkP.C) annotation (Line(points={{60,40},{80,40}}, color={0,0,255})); + connect(splitter2.Cs2, singularPressureLoss2.C1) annotation (Line(points={{-6,-10},{-6,-40},{40,-40}}, color={0,0,255})); + connect(singularPressureLoss2.C2, sinkP1.C) annotation (Line(points={{60,-40},{80,-40}}, color={0,0,255})); + connect(constante.y, splitter2.Ialpha1) annotation (Line(points={{-19,20},{-14,20},{-14,6},{-9,6}})); + annotation (experiment(StopTime=10), Documentation(info=" +

      Copyright © EDF 2002 - 2024

      +

      ThermoSysPro Version 4.1 +")); +end TestSplitter2; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestSplitter2_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestSplitter2_FlueGases.mo new file mode 100644 index 00000000..9443b946 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestSplitter2_FlueGases.mo @@ -0,0 +1,41 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Junctions; +model TestSplitter2_FlueGases + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.FlueGases ( + extraPropertiesNames={"Trace"}, + C_nominal={0.1}, + C_default={0.2}); + ThermoSysPro.Fluid.Junctions.Splitter2 splitter2(redeclare replaceable package Medium = Medium, h(start=2.83057e6)) annotation (Placement(transformation(extent={{-20,-10},{0,10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceP( + redeclare replaceable package Medium = Medium, + Q0=200, + T0=573.15, + option_temperature=true, + SubC0={3}) annotation (Placement(transformation(extent={{-100,-10},{-80,10}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-60,-10},{-40,10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sinkP( + redeclare replaceable package Medium = Medium, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{80,30},{100,50}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP1( + redeclare replaceable package Medium = Medium, + P0=4500000, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{80,-50},{100,-30}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss1(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{40,30},{60,50}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss2(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{40,-50},{60,-30}}, rotation=0))); + ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Constante constante(k=0.2) annotation (Placement(transformation(extent={{-40,10},{-20,30}}, rotation=0))); +equation + connect(sourceP.C, singularPressureLoss.C1) annotation (Line(points={{-80,0},{-60,0}}, color={0,0,255})); + connect(singularPressureLoss.C2, splitter2.Ce) annotation (Line(points={{-40,0},{-20,0}}, color={0,0,255})); + connect(splitter2.Cs1, singularPressureLoss1.C1) annotation (Line(points={{-6,10},{-6,40},{40,40}}, color={0,0,255})); + connect(singularPressureLoss1.C2, sinkP.C) annotation (Line(points={{60,40},{80,40}}, color={0,0,255})); + connect(splitter2.Cs2, singularPressureLoss2.C1) annotation (Line(points={{-6,-10},{-6,-40},{40,-40}}, color={0,0,255})); + connect(singularPressureLoss2.C2, sinkP1.C) annotation (Line(points={{60,-40},{80,-40}}, color={0,0,255})); + connect(constante.y, splitter2.Ialpha1) annotation (Line(points={{-19,20},{-14,20},{-14,6},{-9,6}})); + annotation (experiment(StopTime=10), Documentation(info=" +

      Copyright © EDF 2002 - 2024

      +

      ThermoSysPro Version 4.1 +")); +end TestSplitter2_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestSplitter2_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestSplitter2_Traces.mo new file mode 100644 index 00000000..84f56024 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestSplitter2_Traces.mo @@ -0,0 +1,30 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Junctions; +model TestSplitter2_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam ( + extraPropertiesNames={"Trace"}, + C_nominal={0.1}, + C_default={0.2}); + ThermoSysPro.Fluid.Junctions.Splitter2 splitter2(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-20,-10},{0,10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceP(redeclare replaceable package Medium = Medium, Q0=200, + SubC0={3}) annotation (Placement(transformation(extent={{-100,-10},{-80,10}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-60,-10},{-40,10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sinkP(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{80,30},{100,50}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP1(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{80,-50},{100,-30}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss1(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{40,30},{60,50}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss2(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{40,-50},{60,-30}}, rotation=0))); + ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Constante constante(k=0.2) annotation (Placement(transformation(extent={{-40,10},{-20,30}}, rotation=0))); +equation + connect(sourceP.C, singularPressureLoss.C1) annotation (Line(points={{-80,0},{-60,0}}, color={0,0,255})); + connect(singularPressureLoss.C2, splitter2.Ce) annotation (Line(points={{-40,0},{-20,0}}, color={0,0,255})); + connect(splitter2.Cs1, singularPressureLoss1.C1) annotation (Line(points={{-6,10},{-6,40},{40,40}}, color={0,0,255})); + connect(singularPressureLoss1.C2, sinkP.C) annotation (Line(points={{60,40},{80,40}}, color={0,0,255})); + connect(splitter2.Cs2, singularPressureLoss2.C1) annotation (Line(points={{-6,-10},{-6,-40},{40,-40}}, color={0,0,255})); + connect(singularPressureLoss2.C2, sinkP1.C) annotation (Line(points={{60,-40},{80,-40}}, color={0,0,255})); + connect(constante.y, splitter2.Ialpha1) annotation (Line(points={{-19,20},{-14,20},{-14,6},{-9,6}})); + annotation (experiment(StopTime=10), Documentation(info=" +

      Copyright © EDF 2002 - 2024

      +

      ThermoSysPro Version 4.1 +")); +end TestSplitter2_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/package.order index 0779eefb..08496374 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/package.order @@ -1,2 +1,8 @@ TestDryer TestDryer_Traces +TestSplitter2 +TestSplitter2_Traces +TestSplitter2_FlueGases +TestMixer2 +TestMixer2_Traces +TestMixer2_FlueGases diff --git a/ThermoSysPro/Fluid/Junctions/Mixer2.mo b/ThermoSysPro/Fluid/Junctions/Mixer2.mo index 206eeb5f..caeea6c0 100644 --- a/ThermoSysPro/Fluid/Junctions/Mixer2.mo +++ b/ThermoSysPro/Fluid/Junctions/Mixer2.mo @@ -1,32 +1,22 @@ within ThermoSysPro.Fluid.Junctions; model Mixer2 "Mixer with two inlets" - extends - ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidTypeParameterInterface; extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; - + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Boolean continuous_flow_reversal=false "true: continuous flow reversal - false: discontinuous flow reversal"; parameter Boolean diffusion=false "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; - parameter IF97Region region=IF97Region.All_regions "IF97 region (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); protected parameter Units.SI.MassFlowRate gamma0=1.e-4 "Pseudo-diffusion conductance use for continuous flow reversal (active if diffusion=false and continuous_flow_reversal = true)"; - parameter Integer mode=Integer(region) - 1 "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; public Real alpha1 "Extraction coefficient for inlet 1 (<=1)"; Units.SI.AbsolutePressure P(start=10e5) "Fluid pressure"; Units.SI.SpecificEnthalpy h(start=10e5) "Fluid specific enthalpy"; Units.SI.Temperature T "Fluid temperature"; - FluidType fluids[4] "Fluids mixing in volume"; - ThermoSysPro.Units.SI.MassFraction Xco2 "CO2 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xh2o "H20 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xo2 "O2 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xso2 "SO2 mass fraction"; + Medium.MassFraction X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Mass fractions"; Units.SI.Power Je1 "Thermal power diffusion from inlet e1"; Units.SI.Power Je2 "Thermal power diffusion from inlet e2"; Units.SI.Power Js "Thermal power diffusion from outlet s"; @@ -39,12 +29,11 @@ public Real rs "Value of r(Q/gamma) for outlet s"; public - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce2 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce2(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-50,-110},{-30,-90}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{90,-10},{110,10}}, rotation=0))); -public - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce1 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce1(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-50,90},{-30,110}}, rotation=0))); InstrumentationAndControl.Connectors.InputReal Ialpha1 "Extraction coefficient for inlet 1 (<=1)" @@ -53,15 +42,6 @@ public annotation (Placement(transformation(extent={{-20,50},{0,70}}, rotation=0))); equation - /* Check that incoming fluids are compatible with fluid in volume */ - fluids[1] = ftype; - fluids[2] = Ce1.ftype; - fluids[3] = Ce2.ftype; - fluids[4] = Cs.ftype; - - assert(ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.isCompatible(fluids), - "Mixer2: fluids mixing in volume are not compatible with each other"); - /* Unconnected connectors */ if (cardinality(Ialpha1) == 0) then Ialpha1.signal = 0.5; @@ -82,17 +62,12 @@ equation Cs.h_vol_1 = h; /* Fluid composition balance equations */ - 0 = Ce1.Xco2*Ce1.Q + Ce2.Xco2*Ce2.Q - Cs.Xco2*Cs.Q; - 0 = Ce1.Xh2o*Ce1.Q + Ce2.Xh2o*Ce2.Q - Cs.Xh2o*Cs.Q; - 0 = Ce1.Xo2*Ce1.Q + Ce2.Xo2*Ce2.Q - Cs.Xo2*Cs.Q; - 0 = Ce1.Xso2*Ce1.Q + Ce2.Xso2*Ce2.Q - Cs.Xso2*Cs.Q; + fill(0,Medium.nXi) = Ce1.Xi*Ce1.Q + Ce2.Xi*Ce2.Q - Cs.Xi*Cs.Q; - Cs.ftype = ftype; + Cs.Xi = X; - Cs.Xco2 = Xco2; - Cs.Xh2o = Xh2o; - Cs.Xo2 = Xo2; - Cs.Xso2 = Xso2; + /* Traces composition balance equations */ + Ce1.Q*Ce1.SubC + Ce2.Q*Ce2.SubC = Cs.Q*Cs.SubC; /* Mass flow at the outlet */ if (cardinality(Ialpha1) <> 0) then @@ -147,7 +122,7 @@ equation Cs.diff_on_1 = diffusion; /* Fluid thermodynamic properties */ - T = ThermoSysPro.Properties.Fluid.Temperature_Ph(P, h, fluid, mode, Xco2, Xh2o, Xo2, Xso2); + T = Medium.temperature_phX(p=P, h=h, X=X); annotation ( Diagram(coordinateSystem( diff --git a/ThermoSysPro/Fluid/Junctions/Splitter2.mo b/ThermoSysPro/Fluid/Junctions/Splitter2.mo index 94e4a836..6fb76fa9 100644 --- a/ThermoSysPro/Fluid/Junctions/Splitter2.mo +++ b/ThermoSysPro/Fluid/Junctions/Splitter2.mo @@ -1,32 +1,22 @@ within ThermoSysPro.Fluid.Junctions; model Splitter2 "Splitter with two outlets" - extends - ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidTypeParameterInterface; extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; - + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Boolean continuous_flow_reversal=false "true: continuous flow reversal - false: discontinuous flow reversal"; parameter Boolean diffusion=false "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; - parameter IF97Region region=IF97Region.All_regions "IF97 region (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); protected parameter Units.SI.MassFlowRate gamma0=1.e-4 "Pseudo-diffusion conductance use for continuous flow reversal (active if diffusion=false and continuous_flow_reversal = true)"; - parameter Integer mode=Integer(region) - 1 "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; public Real alpha1 "Extraction coefficient for outlet 1 (<=1)"; Units.SI.AbsolutePressure P(start=10e5) "Fluid pressure"; Units.SI.SpecificEnthalpy h(start=10e5) "Fluid specific enthalpy"; Units.SI.Temperature T "Fluid temperature"; - FluidType fluids[4] "Fluids mixing in volume"; - ThermoSysPro.Units.SI.MassFraction Xco2 "CO2 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xh2o "H20 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xo2 "O2 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xso2 "SO2 mass fraction"; + Medium.MassFraction X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Mass fractions"; Units.SI.Power Je "Thermal power diffusion from inlet e"; Units.SI.Power Js1 "Thermal power diffusion from outlet s1"; Units.SI.Power Js2 "Thermal power diffusion from outlet s2"; @@ -39,11 +29,11 @@ public Real rs2 "Value of r(Q/gamma) for outlet s2"; public - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-110,-10},{-90,10}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs1 annotation ( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs1(redeclare package Medium = Medium) annotation ( Placement(transformation(extent={{30,90},{50,110}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs2 annotation ( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs2(redeclare package Medium = Medium) annotation ( Placement(transformation(extent={{30,-110},{50,-90}}, rotation=0))); InstrumentationAndControl.Connectors.InputReal Ialpha1 "Extraction coefficient for outlet 1 (<=1)" @@ -52,15 +42,6 @@ public annotation (Placement(transformation(extent={{60,50},{80,70}}, rotation=0))); equation - /* Check that incoming fluids are compatible with fluid in volume */ - fluids[1] = ftype; - fluids[2] = Ce.ftype; - fluids[3] = Cs1.ftype; - fluids[4] = Cs2.ftype; - - assert(ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.isCompatible(fluids), - "Splitter2: fluids mixing in volume are not compatible with each other"); - /* Unconnected connectors */ if (cardinality(Ialpha1) == 0) then Ialpha1.signal = 0.5; @@ -81,23 +62,15 @@ equation Cs2.h_vol_1 = h; /* Fluid composition balance equations */ - 0 = Ce.Xco2*Ce.Q - Cs1.Xco2*Cs1.Q - Cs2.Xco2*Cs2.Q; - 0 = Ce.Xh2o*Ce.Q - Cs1.Xh2o*Cs1.Q - Cs2.Xh2o*Cs2.Q; - 0 = Ce.Xo2*Ce.Q - Cs1.Xo2*Cs1.Q - Cs2.Xo2*Cs2.Q; - 0 = Ce.Xso2*Ce.Q - Cs1.Xso2*Cs1.Q - Cs2.Xso2*Cs2.Q; + fill(0,Medium.nXi) = Ce.Xi*Ce.Q - Cs1.Xi*Cs1.Q - Cs2.Xi*Cs2.Q; - Cs1.ftype = ftype; - Cs2.ftype = ftype; + Cs1.Xi = X; + Cs2.Xi = X; - Cs1.Xco2 = Xco2; - Cs1.Xh2o = Xh2o; - Cs1.Xo2 = Xo2; - Cs1.Xso2 = Xso2; + /* Traces composition balance equations */ + Cs1.Q*Cs1.SubC + Cs2.Q*Cs2.SubC = Ce.Q*Ce.SubC; - Cs2.Xco2 = Xco2; - Cs2.Xh2o = Xh2o; - Cs2.Xo2 = Xo2; - Cs2.Xso2 = Xso2; + Cs2.SubC = Cs1.SubC; /* Mass flow at outlet 1 */ if (cardinality(Ialpha1) <> 0) then @@ -154,7 +127,7 @@ equation Cs2.diff_on_1 = diffusion; /* Fluid thermodynamic properties */ - T = ThermoSysPro.Properties.Fluid.Temperature_Ph(P, h, fluid, mode, Xco2, Xh2o, Xo2, Xso2); + T = Medium.temperature_phX(p=P, h=h, X=X); annotation ( Diagram(coordinateSystem( @@ -203,6 +176,5 @@ equation

    • Baligh El Hefni
    • Daniel Bouskela
    -"), - DymolaStoredErrors); +")); end Splitter2; From 21d55fd63c13bec4e5acf73e1fa24eb23a32470a Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Thu, 3 Jul 2025 15:39:50 +0200 Subject: [PATCH 100/178] #125 LoopBreakers, P has its examples --- .../LoopBreakers/TestLoopBreakerP.mo | 43 +++++++++++ .../TestLoopBreakerP_FlueGases.mo | 50 +++++++++++++ .../LoopBreakers/TestLoopBreakerP_Traces.mo | 43 +++++++++++ .../LoopBreakers/TestLoopBreakerQH.mo | 26 +++++++ .../SimpleExamples/LoopBreakers/package.order | 4 ++ .../Fluid/LoopBreakers/LoopBreakerH.mo | 12 ++-- .../Fluid/LoopBreakers/LoopBreakerP.mo | 12 ++-- .../Fluid/LoopBreakers/LoopBreakerQ.mo | 12 ++-- .../Fluid/LoopBreakers/LoopBreakerSubC.mo | 72 +++++++++++++++++++ .../Fluid/LoopBreakers/LoopBreakerXgas.mo | 7 +- ThermoSysPro/Fluid/LoopBreakers/package.order | 1 + 11 files changed, 258 insertions(+), 24 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/LoopBreakers/TestLoopBreakerP.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/LoopBreakers/TestLoopBreakerP_FlueGases.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/LoopBreakers/TestLoopBreakerP_Traces.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/LoopBreakers/TestLoopBreakerQH.mo create mode 100644 ThermoSysPro/Fluid/LoopBreakers/LoopBreakerSubC.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/LoopBreakers/TestLoopBreakerP.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/LoopBreakers/TestLoopBreakerP.mo new file mode 100644 index 00000000..76c078a7 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/LoopBreakers/TestLoopBreakerP.mo @@ -0,0 +1,43 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.LoopBreakers; +model TestLoopBreakerP + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam; + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-100,0},{-80,20}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss1(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-20,20},{0,40}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss2(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-20,-20},{0,0}}, rotation=0))); + ThermoSysPro.Fluid.Junctions.Splitter2 splitter2_1(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-56,0},{-36,20}}, rotation=0))); + ThermoSysPro.Fluid.Junctions.Mixer2 mixer2_1(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{40,0},{60,20}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{80,0},{100,20}}, rotation=0))); + InstrumentationAndControl.Blocks.Sources.Constante constante(k=0.5) annotation (Placement(transformation(extent={{-80,40},{-60,60}}, rotation=0))); + ThermoSysPro.Fluid.LoopBreakers.LoopBreakerP loopBreakerP(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{10,-20},{30,0}}, rotation=0))); +equation + connect(sourcePQ.C, splitter2_1.Ce) annotation (Line( + points={{-80,10},{-56,10}}, + color={0,0,255}, + smooth=Smooth.None)); + connect(splitter2_1.Cs1, singularPressureLoss1.C1) annotation (Line( + points={{-42,20},{-42,30},{-20,30}}, + color={0,0,255}, + smooth=Smooth.None)); + connect(splitter2_1.Cs2, singularPressureLoss2.C1) annotation (Line( + points={{-42,0},{-42,-10},{-20,-10}}, + color={0,0,255}, + smooth=Smooth.None)); + connect(mixer2_1.Ce1, singularPressureLoss1.C2) annotation (Line(points={{46,20},{46,30},{0,30}}, smooth=Smooth.None)); + connect(mixer2_1.Cs, sink.C) annotation (Line( + points={{60,10},{80,10}}, + color={0,0,255}, + smooth=Smooth.None)); + connect(constante.y, splitter2_1.Ialpha1) annotation (Line(points={{-59,50},{-52,50},{-52,16},{-45,16}}, smooth=Smooth.None)); + connect(singularPressureLoss2.C2, loopBreakerP.C1) annotation (Line( + points={{0,-10},{10,-10}}, + color={0,0,255}, + smooth=Smooth.None)); + connect(loopBreakerP.C2, mixer2_1.Ce2) annotation (Line( + points={{30,-10},{46,-10},{46,0}}, + color={0,0,255}, + smooth=Smooth.None)); + + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestLoopBreakerP; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/LoopBreakers/TestLoopBreakerP_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/LoopBreakers/TestLoopBreakerP_FlueGases.mo new file mode 100644 index 00000000..23e929e3 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/LoopBreakers/TestLoopBreakerP_FlueGases.mo @@ -0,0 +1,50 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.LoopBreakers; +model TestLoopBreakerP_FlueGases + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.FlueGases (extraPropertiesNames={"Trace"}, C_nominal={0.1}, C_default={0.2}); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare replaceable package Medium = Medium, + P0=4500000, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{-100,0},{-80,20}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss1(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-20,20},{0,40}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss2(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-20,-20},{0,0}}, rotation=0))); + ThermoSysPro.Fluid.Junctions.Splitter2 splitter2_1(redeclare replaceable package Medium = Medium, h(start=2.83057e6)) + annotation (Placement(transformation(extent={{-56,0},{-36,20}}, rotation=0))); + ThermoSysPro.Fluid.Junctions.Mixer2 mixer2_1(redeclare replaceable package Medium = Medium, h(start=2.83057e6)) + annotation (Placement(transformation(extent={{40,0},{60,20}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package Medium = Medium, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{80,0},{100,20}}, rotation=0))); + InstrumentationAndControl.Blocks.Sources.Constante constante(k=0.5) annotation (Placement(transformation(extent={{-80,40},{-60,60}}, rotation=0))); + ThermoSysPro.Fluid.LoopBreakers.LoopBreakerP loopBreakerP(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{10,-20},{30,0}}, rotation=0))); +equation + connect(sourcePQ.C, splitter2_1.Ce) annotation (Line( + points={{-80,10},{-56,10}}, + color={0,0,255}, + smooth=Smooth.None)); + connect(splitter2_1.Cs1, singularPressureLoss1.C1) annotation (Line( + points={{-42,20},{-42,30},{-20,30}}, + color={0,0,255}, + smooth=Smooth.None)); + connect(splitter2_1.Cs2, singularPressureLoss2.C1) annotation (Line( + points={{-42,0},{-42,-10},{-20,-10}}, + color={0,0,255}, + smooth=Smooth.None)); + connect(mixer2_1.Ce1, singularPressureLoss1.C2) annotation (Line(points={{46,20},{46,30},{0,30}}, smooth=Smooth.None)); + connect(mixer2_1.Cs, sink.C) annotation (Line( + points={{60,10},{80,10}}, + color={0,0,255}, + smooth=Smooth.None)); + connect(constante.y, splitter2_1.Ialpha1) annotation (Line(points={{-59,50},{-52,50},{-52,16},{-45,16}}, smooth=Smooth.None)); + connect(singularPressureLoss2.C2, loopBreakerP.C1) annotation (Line( + points={{0,-10},{10,-10}}, + color={0,0,255}, + smooth=Smooth.None)); + connect(loopBreakerP.C2, mixer2_1.Ce2) annotation (Line( + points={{30,-10},{46,-10},{46,0}}, + color={0,0,255}, + smooth=Smooth.None)); + + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestLoopBreakerP_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/LoopBreakers/TestLoopBreakerP_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/LoopBreakers/TestLoopBreakerP_Traces.mo new file mode 100644 index 00000000..e81b1cbf --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/LoopBreakers/TestLoopBreakerP_Traces.mo @@ -0,0 +1,43 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.LoopBreakers; +model TestLoopBreakerP_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam (extraPropertiesNames={"Trace"}, C_nominal={0.1}, C_default={0.2}); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-100,0},{-80,20}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss1(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-20,20},{0,40}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss2(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-20,-20},{0,0}}, rotation=0))); + ThermoSysPro.Fluid.Junctions.Splitter2 splitter2_1(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-56,0},{-36,20}}, rotation=0))); + ThermoSysPro.Fluid.Junctions.Mixer2 mixer2_1(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{40,0},{60,20}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{80,0},{100,20}}, rotation=0))); + InstrumentationAndControl.Blocks.Sources.Constante constante(k=0.5) annotation (Placement(transformation(extent={{-80,40},{-60,60}}, rotation=0))); + ThermoSysPro.Fluid.LoopBreakers.LoopBreakerP loopBreakerP(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{10,-20},{30,0}}, rotation=0))); +equation + connect(sourcePQ.C, splitter2_1.Ce) annotation (Line( + points={{-80,10},{-56,10}}, + color={0,0,255}, + smooth=Smooth.None)); + connect(splitter2_1.Cs1, singularPressureLoss1.C1) annotation (Line( + points={{-42,20},{-42,30},{-20,30}}, + color={0,0,255}, + smooth=Smooth.None)); + connect(splitter2_1.Cs2, singularPressureLoss2.C1) annotation (Line( + points={{-42,0},{-42,-10},{-20,-10}}, + color={0,0,255}, + smooth=Smooth.None)); + connect(mixer2_1.Ce1, singularPressureLoss1.C2) annotation (Line(points={{46,20},{46,30},{0,30}}, smooth=Smooth.None)); + connect(mixer2_1.Cs, sink.C) annotation (Line( + points={{60,10},{80,10}}, + color={0,0,255}, + smooth=Smooth.None)); + connect(constante.y, splitter2_1.Ialpha1) annotation (Line(points={{-59,50},{-52,50},{-52,16},{-45,16}}, smooth=Smooth.None)); + connect(singularPressureLoss2.C2, loopBreakerP.C1) annotation (Line( + points={{0,-10},{10,-10}}, + color={0,0,255}, + smooth=Smooth.None)); + connect(loopBreakerP.C2, mixer2_1.Ce2) annotation (Line( + points={{30,-10},{46,-10},{46,0}}, + color={0,0,255}, + smooth=Smooth.None)); + + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestLoopBreakerP_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/LoopBreakers/TestLoopBreakerQH.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/LoopBreakers/TestLoopBreakerQH.mo new file mode 100644 index 00000000..0e65f1ec --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/LoopBreakers/TestLoopBreakerQH.mo @@ -0,0 +1,26 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.LoopBreakers; +model TestLoopBreakerQH + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam; + + ThermoSysPro.Fluid.BoundaryConditions.RefP refP(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-90,0},{-70,20}}, rotation=0))); + ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Constante constante(k=2.e5) annotation (Placement(transformation(extent={{-100,60},{-80,80}}, rotation=0))); + ThermoSysPro.Fluid.Machines.StaticCentrifugalPump pump(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-30,0},{-10,20}}, rotation=0))); + ThermoSysPro.Fluid.LoopBreakers.LoopBreakerQ loopBreakerQ(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{0,0},{20,20}}, rotation=0))); + ThermoSysPro.Fluid.LoopBreakers.LoopBreakerH loopBreakerH(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{30,0},{50,20}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.RefT refT(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-60,0},{-40,20}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe lumpedStraightPipe(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{60,0},{80,20}}, rotation=0))); + ThermoSysPro.Fluid.Volumes.VolumeA volumeA(redeclare package Medium = Medium, dynamic_energy_balance=false) annotation (Placement(transformation(extent={{10,-30},{-10,-10}}))); +equation + connect(refP.C2, refT.C1) annotation (Line(points={{-70,10},{-60,10}}, color={0,0,255})); + connect(refT.C2, pump.C1) annotation (Line(points={{-40,10},{-30,10}}, color={0,0,255})); + connect(constante.y, refP.IPressure) annotation (Line(points={{-79,70},{-60,70},{-60,34},{-80,34},{-80,21}})); + connect(pump.C2, loopBreakerQ.C1) annotation (Line(points={{-10,10},{0,10}}, color={0,0,255})); + connect(loopBreakerQ.C2, loopBreakerH.C1) annotation (Line(points={{20,10},{30,10}}, color={0,0,255})); + connect(loopBreakerH.C2, lumpedStraightPipe.C1) annotation (Line(points={{50,10},{60,10}}, color={0,0,255})); + connect(lumpedStraightPipe.C2, volumeA.Ce1) annotation (Line(points={{80,10},{100,10},{100,-20},{10,-20}}, color={0,0,0})); + connect(volumeA.Cs1, refP.C1) annotation (Line(points={{-10,-20},{-100,-20},{-100,10},{-90,10}}, color={0,0,0})); + + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestLoopBreakerQH; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/LoopBreakers/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/LoopBreakers/package.order index e69de29b..244c2ab3 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/LoopBreakers/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/LoopBreakers/package.order @@ -0,0 +1,4 @@ +TestLoopBreakerP +TestLoopBreakerP_Traces +TestLoopBreakerP_FlueGases +TestLoopBreakerQH diff --git a/ThermoSysPro/Fluid/LoopBreakers/LoopBreakerH.mo b/ThermoSysPro/Fluid/LoopBreakers/LoopBreakerH.mo index f52a5c93..2f2cb39f 100644 --- a/ThermoSysPro/Fluid/LoopBreakers/LoopBreakerH.mo +++ b/ThermoSysPro/Fluid/LoopBreakers/LoopBreakerH.mo @@ -1,10 +1,11 @@ within ThermoSysPro.Fluid.LoopBreakers; model LoopBreakerH "Specific enthalpy loop breaker" + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); public - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-110,-10},{-90,10}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{90,-10},{110,10}}, rotation=0))); equation @@ -20,12 +21,9 @@ equation C2.diff_res_1 = C1.diff_res_1; C1.diff_res_2 = C2.diff_res_2; - C1.ftype = C2.ftype; + C1.Xi = C2.Xi; - C1.Xco2 = C2.Xco2; - C1.Xh2o = C2.Xh2o; - C1.Xo2 = C2.Xo2; - C1.Xso2 = C2.Xso2; + C1.SubC = C2.SubC; annotation ( Diagram(coordinateSystem( diff --git a/ThermoSysPro/Fluid/LoopBreakers/LoopBreakerP.mo b/ThermoSysPro/Fluid/LoopBreakers/LoopBreakerP.mo index 48f3d3f7..acdd0a52 100644 --- a/ThermoSysPro/Fluid/LoopBreakers/LoopBreakerP.mo +++ b/ThermoSysPro/Fluid/LoopBreakers/LoopBreakerP.mo @@ -1,10 +1,11 @@ within ThermoSysPro.Fluid.LoopBreakers; model LoopBreakerP "Pressure loop breaker" +replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); public - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-110,-10},{-90,10}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{90,-10},{110,10}}, rotation=0))); equation @@ -20,12 +21,9 @@ equation C2.diff_res_1 = C1.diff_res_1; C1.diff_res_2 = C2.diff_res_2; - C1.ftype = C2.ftype; + C1.Xi = C2.Xi; - C1.Xco2 = C2.Xco2; - C1.Xh2o = C2.Xh2o; - C1.Xo2 = C2.Xo2; - C1.Xso2 = C2.Xso2; + C1.SubC = C2.SubC; annotation ( Diagram(coordinateSystem( diff --git a/ThermoSysPro/Fluid/LoopBreakers/LoopBreakerQ.mo b/ThermoSysPro/Fluid/LoopBreakers/LoopBreakerQ.mo index 8b6bd98a..d2323c44 100644 --- a/ThermoSysPro/Fluid/LoopBreakers/LoopBreakerQ.mo +++ b/ThermoSysPro/Fluid/LoopBreakers/LoopBreakerQ.mo @@ -1,10 +1,11 @@ within ThermoSysPro.Fluid.LoopBreakers; model LoopBreakerQ "Mass flow loop breaker" + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); public - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-110,-10},{-90,10}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{90,-10},{110,10}}, rotation=0))); equation @@ -20,12 +21,9 @@ equation C2.diff_res_1 = C1.diff_res_1; C1.diff_res_2 = C2.diff_res_2; - C1.ftype = C2.ftype; + C1.Xi = C2.Xi; - C1.Xco2 = C2.Xco2; - C1.Xh2o = C2.Xh2o; - C1.Xo2 = C2.Xo2; - C1.Xso2 = C2.Xso2; + C1.SubC = C2.SubC; annotation ( Diagram(coordinateSystem( diff --git a/ThermoSysPro/Fluid/LoopBreakers/LoopBreakerSubC.mo b/ThermoSysPro/Fluid/LoopBreakers/LoopBreakerSubC.mo new file mode 100644 index 00000000..8925bb1a --- /dev/null +++ b/ThermoSysPro/Fluid/LoopBreakers/LoopBreakerSubC.mo @@ -0,0 +1,72 @@ +within ThermoSysPro.Fluid.LoopBreakers; +model LoopBreakerSubC "Fluid Traces loop breaker" + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); +public + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1(redeclare package Medium = Medium) annotation (Placement( + transformation(extent={{-110,-10},{-90,10}}, rotation=0))); + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2(redeclare package Medium = Medium) annotation (Placement( + transformation(extent={{90,-10},{110,10}}, rotation=0))); +equation + + C1.Q = C2.Q; + C1.P = C2.P; + C1.h = C2.h; + + C1.h_vol_1 = C2.h_vol_1; + C1.h_vol_2 = C2.h_vol_2; + + C2.diff_on_1 = C1.diff_on_1; + C1.diff_on_2 = C2.diff_on_2; + + C2.diff_res_1 = C1.diff_res_1; + C1.diff_res_2 = C2.diff_res_2; + + C1.Xi = C2.Xi; + + annotation ( + Diagram(coordinateSystem( + preserveAspectRatio=false, + extent={{-100,-100},{100,100}}, + grid={2,2}), graphics={ + Polygon( + points={{0,100},{100,0},{0,-100},{-100,0},{0,100}}, + lineColor={0,0,0}, + fillPattern=FillPattern.Sphere, + fillColor={255,255,0}), + Text( + extent={{-38,38},{42,-42}}, + lineColor={0,0,255}, + textString="C"), + Line(points={{0,100},{0,-100}}, color={0,0,255})}), + Icon(coordinateSystem( + preserveAspectRatio=false, + extent={{-100,-100},{100,100}}, + grid={2,2}), graphics={ + Polygon( + points={{0,100},{100,0},{0,-100},{-100,0},{0,100}}, + lineColor={0,0,0}, + fillPattern=FillPattern.Sphere, + fillColor={255,255,0}), + Text( + extent={{-40,38},{40,-42}}, + lineColor={0,0,255}, + textString="C"), + Line(points={{0,100},{0,-100}}, color={0,0,255})}), + Window( + x=0.33, + y=0.09, + width=0.71, + height=0.88), + Documentation(info=" +

    Copyright © EDF 2002 - 2024

    +

    ThermoSysPro Version 4.1

    +", + revisions=" +

    Authors

    +
      +
    • Baligh El Hefni
    • +
    • Daniel Bouskela
    • +
    +")); +end LoopBreakerSubC; diff --git a/ThermoSysPro/Fluid/LoopBreakers/LoopBreakerXgas.mo b/ThermoSysPro/Fluid/LoopBreakers/LoopBreakerXgas.mo index 38227283..f423b285 100644 --- a/ThermoSysPro/Fluid/LoopBreakers/LoopBreakerXgas.mo +++ b/ThermoSysPro/Fluid/LoopBreakers/LoopBreakerXgas.mo @@ -1,10 +1,11 @@ within ThermoSysPro.Fluid.LoopBreakers; model LoopBreakerXgas "Fluid composition loop breaker" + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); public - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-110,-10},{-90,10}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{90,-10},{110,10}}, rotation=0))); equation @@ -21,7 +22,7 @@ equation C2.diff_res_1 = C1.diff_res_1; C1.diff_res_2 = C2.diff_res_2; - C1.ftype = C2.ftype; + C1.SubC = C2.SubC; annotation ( Diagram(coordinateSystem( diff --git a/ThermoSysPro/Fluid/LoopBreakers/package.order b/ThermoSysPro/Fluid/LoopBreakers/package.order index 4b729fa7..82432aa5 100644 --- a/ThermoSysPro/Fluid/LoopBreakers/package.order +++ b/ThermoSysPro/Fluid/LoopBreakers/package.order @@ -2,3 +2,4 @@ LoopBreakerH LoopBreakerP LoopBreakerQ LoopBreakerXgas +LoopBreakerSubC From 5cd46a00b673f0df01c03f208ebaa308f14498d1 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Thu, 3 Jul 2025 16:40:57 +0200 Subject: [PATCH 101/178] #125 Refs and LoopBreakers --- .../Fluid/BoundaryConditions/RefSubC.mo | 95 +++++++++++++++++ .../Fluid/BoundaryConditions/RefXgas.mo | 100 ++---------------- .../Fluid/BoundaryConditions/package.order | 1 + .../TestRefP_Traces_FlueGases.mo | 46 -------- .../BoundaryConditions/TestRefSubC_Traces.mo | 29 +++++ .../BoundaryConditions/TestRefT.mo | 41 +++---- .../BoundaryConditions/TestRefT_Traces.mo | 35 ------ .../BoundaryConditions/TestRefX_FlueGases.mo | 28 +++++ .../BoundaryConditions/package.order | 5 +- .../LoopBreakers/TestLoopBreakerQH.mo | 4 +- .../TestLoopBreakerSubC_Traces.mo | 29 +++++ .../TestLoopBreakerX_FlueGases.mo | 28 +++++ .../SimpleExamples/LoopBreakers/package.order | 2 + 13 files changed, 241 insertions(+), 202 deletions(-) create mode 100644 ThermoSysPro/Fluid/BoundaryConditions/RefSubC.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefP_Traces_FlueGases.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefSubC_Traces.mo delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefT_Traces.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefX_FlueGases.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/LoopBreakers/TestLoopBreakerSubC_Traces.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/LoopBreakers/TestLoopBreakerX_FlueGases.mo diff --git a/ThermoSysPro/Fluid/BoundaryConditions/RefSubC.mo b/ThermoSysPro/Fluid/BoundaryConditions/RefSubC.mo new file mode 100644 index 00000000..98cef4fa --- /dev/null +++ b/ThermoSysPro/Fluid/BoundaryConditions/RefSubC.mo @@ -0,0 +1,95 @@ +within ThermoSysPro.Fluid.BoundaryConditions; +model RefSubC "Fixed SubC reference" + extends ThermoSysPro.Fluid.Interfaces.IconColors; + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + + parameter Medium.ExtraProperty SubC0[Medium.nC](quantity=Medium.extraPropertiesNames) = fill(0,Medium.nC) "Source trace substances" annotation (Evaluate=true, Dialog( + tab="Fluid", + group="Medium")); + + +public + + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1(redeclare package Medium = Medium) annotation (Placement( + transformation(extent={{-110,-10},{-90,10}}, rotation=0))); + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2(redeclare package Medium = Medium) annotation (Placement( + transformation(extent={{90,-10},{110,10}}, rotation=0))); + +equation + C1.Q = C2.Q; + C1.P = C2.P; + C1.h = C2.h; + + C1.h_vol_1 = C2.h_vol_1; + C1.h_vol_2 = C2.h_vol_2; + + C2.diff_on_1 = C1.diff_on_1; + C1.diff_on_2 = C2.diff_on_2; + + C2.diff_res_1 = C1.diff_res_1; + C1.diff_res_2 = C2.diff_res_2; + + C1.Xi = C2.Xi; + + C1.SubC = C2.SubC; + C1.SubC = SubC0; + + + annotation ( + Diagram(coordinateSystem( + preserveAspectRatio=false, + extent={{-100,-100},{100,100}}, + grid={2,2}), graphics={ + Ellipse( + extent={{-40,40},{40,-40}}, + lineColor={0,0,0}, + fillPattern=FillPattern.Solid, + fillColor={128,255,0}), + Line(points={{0,100},{0,40}}, color={0,0,255}), + Line(points={{20,60},{0,40},{-20,60}}, color={0,0,255}), + Line(points={{-90,0},{-40,0}}, color={0,0,255}), + Line(points={{40,0},{90,0}}, color={0,0,255}), + Text( + extent={{-28,30},{28,-26}}, + lineColor={0,0,255}, + fillColor={128,255,0}, + fillPattern=FillPattern.Solid, + textString= + "C")}), + Icon(coordinateSystem( + preserveAspectRatio=false, + extent={{-100,-100},{100,100}}, + grid={2,2}), graphics={ + Line(points={{0,100},{0,40}}, color={0,0,255}), + Line(points={{20,60},{0,40},{-20,60}}, color={0,0,255}), + Line(points={{-90,0},{-40,0}}, color={0,0,255}), + Line(points={{40,0},{90,0}}, color={0,0,255}), + Ellipse( + extent={{-40,40},{40,-40}}, + lineColor= {0,0,255}, + fillPattern=FillPattern.Solid, + fillColor= DynamicSelect({127,255,0}, fill_color_singular)), + Text( + extent={{-28,30},{28,-26}}, + lineColor={0,0,255}, + fillColor={128,255,0}, + fillPattern=FillPattern.Solid, + textString= + "C")}), + Window( + x=0.06, + y=0.08, + width=0.82, + height=0.65), + Documentation(info=" +

    Copyright © EDF 2002 - 2024

    +

    ThermoSysPro Version 4.1

    +", + revisions=" +

    Authors

    +
      +
    • Baligh El Hefni
    • +
    • Daniel Bouskela
    • +
    +")); +end RefSubC; diff --git a/ThermoSysPro/Fluid/BoundaryConditions/RefXgas.mo b/ThermoSysPro/Fluid/BoundaryConditions/RefXgas.mo index f7a9d6ad..b05ec942 100644 --- a/ThermoSysPro/Fluid/BoundaryConditions/RefXgas.mo +++ b/ThermoSysPro/Fluid/BoundaryConditions/RefXgas.mo @@ -2,57 +2,17 @@ within ThermoSysPro.Fluid.BoundaryConditions; model RefXgas "Fixed gas composition" extends ThermoSysPro.Fluid.Interfaces.IconColors; - parameter Real Xco2=0.05 "CO2 mass fraction at the outlet"; - parameter Real Xh2o=0.01 "H2O mass fraction at the outlet"; - parameter Real Xo2=0.1 "O2 mass fraction at the outlet"; - parameter Real Xso2=0 "SO2 mas fraction at the outlet"; - + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + parameter Medium.ExtraProperty X0[Medium.nXi] = Medium.X_default[1:Medium.nXi] "Source mass fraction" annotation (Dialog( + tab="Fluid", + group="Medium")); public - Units.SI.MassFlowRate Q "Fluid mass flow rate"; - Units.SI.AbsolutePressure P "Pressure"; - Units.SI.SpecificEnthalpy h "Fluid specific enthalpy"; - - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-110,-10},{-90,10}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{90,-10},{110,10}}, rotation=0))); - InstrumentationAndControl.Connectors.InputReal IXco2 annotation (Placement( - transformation( - origin={-90,110}, - extent={{-10,-10},{10,10}}, - rotation=270))); - InstrumentationAndControl.Connectors.InputReal IXh2o annotation (Placement( - transformation( - origin={-30,110}, - extent={{-10,-10},{10,10}}, - rotation=270))); - InstrumentationAndControl.Connectors.InputReal IXo2 annotation (Placement( - transformation( - origin={30,110}, - extent={{-10,-10},{10,10}}, - rotation=270))); - InstrumentationAndControl.Connectors.InputReal IXso2 annotation (Placement( - transformation( - origin={90,110}, - extent={{-10,-10},{10,10}}, - rotation=270))); equation - if (cardinality(IXco2) == 0) then - IXco2.signal = Xco2; - end if; - - if (cardinality(IXh2o) == 0) then - IXh2o.signal = Xh2o; - end if; - - if (cardinality(IXo2) == 0) then - IXo2.signal = Xo2; - end if; - - if (cardinality(IXso2) == 0) then - IXso2.signal = Xso2; - end if; C1.Q = C2.Q; C1.P = C2.P; @@ -67,21 +27,10 @@ equation C2.diff_res_1 = C1.diff_res_1; C1.diff_res_2 = C2.diff_res_2; - C1.ftype = C2.ftype; - - C1.Xco2 = C2.Xco2; - C1.Xh2o = C2.Xh2o; - C1.Xo2 = C2.Xo2; - C1.Xso2 = C2.Xso2; + C1.Xi = C2.Xi; + C1.SubC = C2.SubC; - Q = C1.Q; - P = C1.P; - h = C1.h; - - C1.Xco2 = Xco2; - C1.Xso2 = Xso2; - C1.Xh2o = Xh2o; - C1.Xo2 = Xo2; + C1.Xi = X0; annotation ( Diagram(coordinateSystem( @@ -121,36 +70,7 @@ equation fillPattern=FillPattern.Solid, textString="X"), Line(points={{0,100},{0,40}}, color={0,0,255}), - Line(points={{20,60},{0,40},{-20,60}}, color={0,0,255}), - Rectangle( - extent={{-100,100},{100,90}}, - lineColor={28,108,200}, - fillColor={28,108,200}, - fillPattern=FillPattern.Solid), - Text( - extent={{-100,90},{-80,80}}, - lineColor={28,108,200}, - fillColor={28,108,200}, - fillPattern=FillPattern.None, - textString="CO2"), - Text( - extent={{-40,90},{-20,80}}, - lineColor={28,108,200}, - fillColor={28,108,200}, - fillPattern=FillPattern.None, - textString="H2O"), - Text( - extent={{20,90},{40,80}}, - lineColor={28,108,200}, - fillColor={28,108,200}, - fillPattern=FillPattern.None, - textString="O2"), - Text( - extent={{80,90},{100,80}}, - lineColor={28,108,200}, - fillColor={28,108,200}, - fillPattern=FillPattern.None, - textString="SO2")}), + Line(points={{20,60},{0,40},{-20,60}}, color={0,0,255})}), Window( x=0.06, y=0.08, diff --git a/ThermoSysPro/Fluid/BoundaryConditions/package.order b/ThermoSysPro/Fluid/BoundaryConditions/package.order index 6583266e..fe404a50 100644 --- a/ThermoSysPro/Fluid/BoundaryConditions/package.order +++ b/ThermoSysPro/Fluid/BoundaryConditions/package.order @@ -6,6 +6,7 @@ RefQ RefH RefT RefXgas +RefSubC SourceP SourceQ SourcePQ diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefP_Traces_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefP_Traces_FlueGases.mo deleted file mode 100644 index 9aea64c1..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefP_Traces_FlueGases.mo +++ /dev/null @@ -1,46 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples.BoundaryConditions; -model TestRefP_Traces_FlueGases - extends ThermoSysPro.UsersGuide.Icons.Example; - replaceable package Medium = ThermoSysPro.Properties.Media.FlueGases(extraPropertiesNames={"Trace1", "Trace2", "Trace3"}, C_nominal={0.1, 0.2, 0.3}, C_default={0.2, 0.3, 0.4}); - - ThermoSysPro.Fluid.BoundaryConditions.Sink sinkP( - redeclare package Medium = - Medium, - T0=453.15, - h0=633193.1, - option_temperature=true) - annotation (Placement(transformation(extent={{66,-10},{86,10}}))); - ThermoSysPro.Fluid.PressureLosses.PipePressureLoss pipePressureLoss( - redeclare package Medium = Medium) - annotation (Placement(transformation(extent={{32,-10},{52,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.RefP refP(redeclare package Medium = - Medium) - annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare package - Medium = Medium, - Q0=50, - T0=473.15, - h0=633193.1, - option_temperature=true, SubC0={10,20,30}, X0={0.1,0.2,0.3,0.2,0.2}, - T(start=423.15)) - annotation (Placement(transformation(extent={{-66,-10},{-46,10}}))); - InstrumentationAndControl.Blocks.Sources.Constante constante(k=20e5) - annotation (Placement(transformation(extent={{-30,38},{-10,58}}))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss( - redeclare package Medium = Medium) - annotation (Placement(transformation(extent={{-38,-10},{-18,10}}))); -equation - connect(sinkP.C, pipePressureLoss.C2) - annotation (Line(points={{66,0},{52,0}}, color={0,0,0})); - connect(refP.C2, pipePressureLoss.C1) - annotation (Line(points={{10,0},{32,0}}, color={0,0,0})); - - connect(constante.y, refP.IPressure) - annotation (Line(points={{-9,48},{0,48},{0,11}}, color={0,0,255})); - connect(sourceQ.C, singularPressureLoss.C1) - annotation (Line(points={{-46,0},{-38,0}}, color={0,0,0})); - connect(singularPressureLoss.C2, refP.C1) - annotation (Line(points={{-18,0},{-10,0}}, color={0,0,0})); - annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( - coordinateSystem(preserveAspectRatio=false))); -end TestRefP_Traces_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefSubC_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefSubC_Traces.mo new file mode 100644 index 00000000..a4200c97 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefSubC_Traces.mo @@ -0,0 +1,29 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.BoundaryConditions; +model TestRefSubC_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam(extraPropertiesNames={"Trace"}, C_nominal={0.1}, C_default={0.2}); + + ThermoSysPro.Fluid.BoundaryConditions.RefP refP(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-90,0},{-70,20}}, rotation=0))); + ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Constante constante(k=2.e5) annotation (Placement(transformation(extent={{-100,60},{-80,80}}, rotation=0))); + ThermoSysPro.Fluid.Machines.StaticCentrifugalPump pump(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-30,0},{-10,20}}, rotation=0))); + ThermoSysPro.Fluid.LoopBreakers.LoopBreakerQ loopBreakerQ(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{0,0},{20,20}}, rotation=0))); + ThermoSysPro.Fluid.LoopBreakers.LoopBreakerH loopBreakerH(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{30,0},{50,20}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.RefT refT(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-60,0},{-40,20}}, rotation=0))); + ThermoSysPro.Fluid.Volumes.VolumeA volumeA(redeclare package Medium = Medium, dynamic_energy_balance=false) annotation (Placement(transformation(extent={{10,-30},{-10,-10}}))); + ThermoSysPro.Fluid.BoundaryConditions.RefSubC refSubC(redeclare package Medium = Medium, SubC0={0.3}) + annotation (Placement(transformation(extent={{90,-30},{70,-10}}))); + ThermoSysPro.Fluid.LoopBreakers.LoopBreakerSubC loopBreakerSubC(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{60,-30},{40,-10}}))); +equation + connect(refP.C2, refT.C1) annotation (Line(points={{-70,10},{-60,10}}, color={0,0,255})); + connect(refT.C2, pump.C1) annotation (Line(points={{-40,10},{-30,10}}, color={0,0,255})); + connect(constante.y, refP.IPressure) annotation (Line(points={{-79,70},{-60,70},{-60,34},{-80,34},{-80,21}})); + connect(pump.C2, loopBreakerQ.C1) annotation (Line(points={{-10,10},{0,10}}, color={0,0,255})); + connect(loopBreakerQ.C2, loopBreakerH.C1) annotation (Line(points={{20,10},{30,10}}, color={0,0,255})); + connect(volumeA.Cs1, refP.C1) annotation (Line(points={{-10,-20},{-100,-20},{-100,10},{-90,10}}, color={0,0,0})); + + connect(volumeA.Ce1, loopBreakerSubC.C2) annotation (Line(points={{10,-20},{40,-20}}, color={0,0,0})); + connect(loopBreakerSubC.C1, refSubC.C2) annotation (Line(points={{60,-20},{70,-20}}, color={0,0,0})); + connect(loopBreakerH.C2, refSubC.C1) annotation (Line(points={{50,10},{100,10},{100,-20},{90,-20}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestRefSubC_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefT.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefT.mo index 8e00782c..b1530cbe 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefT.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefT.mo @@ -4,30 +4,21 @@ model TestRefT replaceable package Medium = Properties.Media.WaterSteam; - - ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare package Medium = - Medium) - annotation (Placement(transformation(extent={{66,-10},{86,10}}))); - ThermoSysPro.Fluid.PressureLosses.PipePressureLoss pipePressureLoss( - redeclare package Medium = Medium) - annotation (Placement(transformation(extent={{32,-10},{52,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.RefT refT(redeclare package Medium = - Medium) - annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare package - Medium = Medium, h0=2600e3) - annotation (Placement(transformation(extent={{-66,-10},{-46,10}}))); - InstrumentationAndControl.Blocks.Sources.Constante constante(k=120 + 273.15) - annotation (Placement(transformation(extent={{-30,38},{-10,58}}))); + ThermoSysPro.Fluid.BoundaryConditions.RefP refP(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-90,0},{-70,20}}, rotation=0))); + ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Constante constante(k=2.e5) annotation (Placement(transformation(extent={{-100,60},{-80,80}}, rotation=0))); + ThermoSysPro.Fluid.Machines.StaticCentrifugalPump pump(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-30,0},{-10,20}}, rotation=0))); + ThermoSysPro.Fluid.LoopBreakers.LoopBreakerQ loopBreakerQ(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{0,0},{20,20}}, rotation=0))); + ThermoSysPro.Fluid.LoopBreakers.LoopBreakerH loopBreakerH(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{30,0},{50,20}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.RefT refT(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-60,0},{-40,20}}, rotation=0))); + ThermoSysPro.Fluid.Volumes.VolumeA volumeA(redeclare package Medium = Medium, dynamic_energy_balance=false) annotation (Placement(transformation(extent={{10,-30},{-10,-10}}))); equation - connect(sink.C, pipePressureLoss.C2) - annotation (Line(points={{66,0},{52,0}}, color={0,0,0})); - connect(refT.C2, pipePressureLoss.C1) - annotation (Line(points={{10,0},{32,0}}, color={0,0,0})); - connect(sourceQ.C, refT.C1) - annotation (Line(points={{-46,0},{-10,0}}, color={0,0,0})); - connect(constante.y, refT.ITemperature) - annotation (Line(points={{-9,48},{0,48},{0,11}}, color={0,0,255})); - annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( - coordinateSystem(preserveAspectRatio=false))); + connect(refP.C2, refT.C1) annotation (Line(points={{-70,10},{-60,10}}, color={0,0,255})); + connect(refT.C2, pump.C1) annotation (Line(points={{-40,10},{-30,10}}, color={0,0,255})); + connect(constante.y, refP.IPressure) annotation (Line(points={{-79,70},{-60,70},{-60,34},{-80,34},{-80,21}})); + connect(pump.C2, loopBreakerQ.C1) annotation (Line(points={{-10,10},{0,10}}, color={0,0,255})); + connect(loopBreakerQ.C2, loopBreakerH.C1) annotation (Line(points={{20,10},{30,10}}, color={0,0,255})); + connect(volumeA.Cs1, refP.C1) annotation (Line(points={{-10,-20},{-100,-20},{-100,10},{-90,10}}, color={0,0,0})); + + connect(volumeA.Ce1, loopBreakerH.C2) annotation (Line(points={{10,-20},{100,-20},{100,10},{50,10}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestRefT; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefT_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefT_Traces.mo deleted file mode 100644 index 061c7084..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefT_Traces.mo +++ /dev/null @@ -1,35 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples.BoundaryConditions; -model TestRefT_Traces - extends ThermoSysPro.UsersGuide.Icons.Example; - - replaceable package Medium = Properties.Media.WaterSteam(extraPropertiesNames={"Trace1", "Trace2", "Trace3"}, C_nominal={0.1, 0.2, 0.3}, C_default={0.2, 0.3, 0.4}); - - ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package - Medium = - Medium) - annotation (Placement(transformation(extent={{66,-10},{86,10}}))); - ThermoSysPro.Fluid.PressureLosses.PipePressureLoss pipePressureLoss( - redeclare replaceable package Medium = Medium) - annotation (Placement(transformation(extent={{32,-10},{52,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.RefT refT(redeclare replaceable package - Medium = - Medium) - annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare replaceable - package - Medium = Medium, h0=2600e3, SubC0={10,20,30}) - annotation (Placement(transformation(extent={{-66,-10},{-46,10}}))); - InstrumentationAndControl.Blocks.Sources.Constante constante(k=120 + 273.15) - annotation (Placement(transformation(extent={{-30,38},{-10,58}}))); -equation - connect(sink.C, pipePressureLoss.C2) - annotation (Line(points={{66,0},{52,0}}, color={0,0,0})); - connect(refT.C2, pipePressureLoss.C1) - annotation (Line(points={{10,0},{32,0}}, color={0,0,0})); - connect(sourceQ.C, refT.C1) - annotation (Line(points={{-46,0},{-10,0}}, color={0,0,0})); - connect(constante.y, refT.ITemperature) - annotation (Line(points={{-9,48},{0,48},{0,11}}, color={0,0,255})); - annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( - coordinateSystem(preserveAspectRatio=false))); -end TestRefT_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefX_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefX_FlueGases.mo new file mode 100644 index 00000000..33881c78 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefX_FlueGases.mo @@ -0,0 +1,28 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.BoundaryConditions; +model TestRefX_FlueGases + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.FlueGases; + + ThermoSysPro.Fluid.BoundaryConditions.RefP refP(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-90,0},{-70,20}}, rotation=0))); + ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Constante constante(k=2.e5) annotation (Placement(transformation(extent={{-100,60},{-80,80}}, rotation=0))); + ThermoSysPro.Fluid.Machines.StaticCentrifugalPump pump(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-30,0},{-10,20}}, rotation=0))); + ThermoSysPro.Fluid.LoopBreakers.LoopBreakerQ loopBreakerQ(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{0,0},{20,20}}, rotation=0))); + ThermoSysPro.Fluid.LoopBreakers.LoopBreakerH loopBreakerH(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{30,0},{50,20}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.RefT refT(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-60,0},{-40,20}}, rotation=0))); + ThermoSysPro.Fluid.Volumes.VolumeA volumeA(redeclare package Medium = Medium, dynamic_energy_balance=false) annotation (Placement(transformation(extent={{10,-30},{-10,-10}}))); + ThermoSysPro.Fluid.BoundaryConditions.RefXgas refXgas(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{62,0},{82,20}}))); + ThermoSysPro.Fluid.LoopBreakers.LoopBreakerXgas loopBreakerXgas(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{64,-30},{44,-10}}))); +equation + connect(refP.C2, refT.C1) annotation (Line(points={{-70,10},{-60,10}}, color={0,0,255})); + connect(refT.C2, pump.C1) annotation (Line(points={{-40,10},{-30,10}}, color={0,0,255})); + connect(constante.y, refP.IPressure) annotation (Line(points={{-79,70},{-60,70},{-60,34},{-80,34},{-80,21}})); + connect(pump.C2, loopBreakerQ.C1) annotation (Line(points={{-10,10},{0,10}}, color={0,0,255})); + connect(loopBreakerQ.C2, loopBreakerH.C1) annotation (Line(points={{20,10},{30,10}}, color={0,0,255})); + connect(volumeA.Cs1, refP.C1) annotation (Line(points={{-10,-20},{-100,-20},{-100,10},{-90,10}}, color={0,0,0})); + + connect(refXgas.C1, loopBreakerH.C2) annotation (Line(points={{62,10},{50,10}}, color={0,0,0})); + connect(volumeA.Ce1, loopBreakerXgas.C2) annotation (Line(points={{10,-20},{44,-20}}, color={0,0,0})); + connect(loopBreakerXgas.C1, refXgas.C2) annotation (Line(points={{64,-20},{100,-20},{100,10},{82,10}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestRefX_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/package.order index 8be81470..873455cd 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/package.order @@ -3,7 +3,6 @@ TestRefQ_Traces TestRefQ_Traces_FlueGases TestRefP TestRefP_Traces -TestRefP_Traces_FlueGases TestRefT -TestRefT_Traces - +TestRefSubC_Traces +TestRefX_FlueGases diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/LoopBreakers/TestLoopBreakerQH.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/LoopBreakers/TestLoopBreakerQH.mo index 0e65f1ec..c6bf70b7 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/LoopBreakers/TestLoopBreakerQH.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/LoopBreakers/TestLoopBreakerQH.mo @@ -10,7 +10,6 @@ model TestLoopBreakerQH ThermoSysPro.Fluid.LoopBreakers.LoopBreakerQ loopBreakerQ(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{0,0},{20,20}}, rotation=0))); ThermoSysPro.Fluid.LoopBreakers.LoopBreakerH loopBreakerH(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{30,0},{50,20}}, rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.RefT refT(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-60,0},{-40,20}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe lumpedStraightPipe(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{60,0},{80,20}}, rotation=0))); ThermoSysPro.Fluid.Volumes.VolumeA volumeA(redeclare package Medium = Medium, dynamic_energy_balance=false) annotation (Placement(transformation(extent={{10,-30},{-10,-10}}))); equation connect(refP.C2, refT.C1) annotation (Line(points={{-70,10},{-60,10}}, color={0,0,255})); @@ -18,9 +17,8 @@ equation connect(constante.y, refP.IPressure) annotation (Line(points={{-79,70},{-60,70},{-60,34},{-80,34},{-80,21}})); connect(pump.C2, loopBreakerQ.C1) annotation (Line(points={{-10,10},{0,10}}, color={0,0,255})); connect(loopBreakerQ.C2, loopBreakerH.C1) annotation (Line(points={{20,10},{30,10}}, color={0,0,255})); - connect(loopBreakerH.C2, lumpedStraightPipe.C1) annotation (Line(points={{50,10},{60,10}}, color={0,0,255})); - connect(lumpedStraightPipe.C2, volumeA.Ce1) annotation (Line(points={{80,10},{100,10},{100,-20},{10,-20}}, color={0,0,0})); connect(volumeA.Cs1, refP.C1) annotation (Line(points={{-10,-20},{-100,-20},{-100,10},{-90,10}}, color={0,0,0})); + connect(volumeA.Ce1, loopBreakerH.C2) annotation (Line(points={{10,-20},{100,-20},{100,10},{50,10}}, color={0,0,0})); annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestLoopBreakerQH; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/LoopBreakers/TestLoopBreakerSubC_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/LoopBreakers/TestLoopBreakerSubC_Traces.mo new file mode 100644 index 00000000..9661a3bf --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/LoopBreakers/TestLoopBreakerSubC_Traces.mo @@ -0,0 +1,29 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.LoopBreakers; +model TestLoopBreakerSubC_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam(extraPropertiesNames={"Trace"}, C_nominal={0.1}, C_default={0.2}); + + ThermoSysPro.Fluid.BoundaryConditions.RefP refP(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-90,0},{-70,20}}, rotation=0))); + ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Constante constante(k=2.e5) annotation (Placement(transformation(extent={{-100,60},{-80,80}}, rotation=0))); + ThermoSysPro.Fluid.Machines.StaticCentrifugalPump pump(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-30,0},{-10,20}}, rotation=0))); + ThermoSysPro.Fluid.LoopBreakers.LoopBreakerQ loopBreakerQ(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{0,0},{20,20}}, rotation=0))); + ThermoSysPro.Fluid.LoopBreakers.LoopBreakerH loopBreakerH(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{30,0},{50,20}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.RefT refT(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-60,0},{-40,20}}, rotation=0))); + ThermoSysPro.Fluid.Volumes.VolumeA volumeA(redeclare package Medium = Medium, dynamic_energy_balance=false) annotation (Placement(transformation(extent={{10,-30},{-10,-10}}))); + ThermoSysPro.Fluid.BoundaryConditions.RefSubC refSubC(redeclare package Medium = Medium, SubC0={0.3}) + annotation (Placement(transformation(extent={{90,-30},{70,-10}}))); + ThermoSysPro.Fluid.LoopBreakers.LoopBreakerSubC loopBreakerSubC(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{60,-30},{40,-10}}))); +equation + connect(refP.C2, refT.C1) annotation (Line(points={{-70,10},{-60,10}}, color={0,0,255})); + connect(refT.C2, pump.C1) annotation (Line(points={{-40,10},{-30,10}}, color={0,0,255})); + connect(constante.y, refP.IPressure) annotation (Line(points={{-79,70},{-60,70},{-60,34},{-80,34},{-80,21}})); + connect(pump.C2, loopBreakerQ.C1) annotation (Line(points={{-10,10},{0,10}}, color={0,0,255})); + connect(loopBreakerQ.C2, loopBreakerH.C1) annotation (Line(points={{20,10},{30,10}}, color={0,0,255})); + connect(volumeA.Cs1, refP.C1) annotation (Line(points={{-10,-20},{-100,-20},{-100,10},{-90,10}}, color={0,0,0})); + + connect(volumeA.Ce1, loopBreakerSubC.C2) annotation (Line(points={{10,-20},{40,-20}}, color={0,0,0})); + connect(loopBreakerSubC.C1, refSubC.C2) annotation (Line(points={{60,-20},{70,-20}}, color={0,0,0})); + connect(loopBreakerH.C2, refSubC.C1) annotation (Line(points={{50,10},{100,10},{100,-20},{90,-20}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestLoopBreakerSubC_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/LoopBreakers/TestLoopBreakerX_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/LoopBreakers/TestLoopBreakerX_FlueGases.mo new file mode 100644 index 00000000..c30188a1 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/LoopBreakers/TestLoopBreakerX_FlueGases.mo @@ -0,0 +1,28 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.LoopBreakers; +model TestLoopBreakerX_FlueGases + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.FlueGases; + + ThermoSysPro.Fluid.BoundaryConditions.RefP refP(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-90,0},{-70,20}}, rotation=0))); + ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Constante constante(k=2.e5) annotation (Placement(transformation(extent={{-100,60},{-80,80}}, rotation=0))); + ThermoSysPro.Fluid.Machines.StaticCentrifugalPump pump(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-30,0},{-10,20}}, rotation=0))); + ThermoSysPro.Fluid.LoopBreakers.LoopBreakerQ loopBreakerQ(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{0,0},{20,20}}, rotation=0))); + ThermoSysPro.Fluid.LoopBreakers.LoopBreakerH loopBreakerH(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{30,0},{50,20}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.RefT refT(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-60,0},{-40,20}}, rotation=0))); + ThermoSysPro.Fluid.Volumes.VolumeA volumeA(redeclare package Medium = Medium, dynamic_energy_balance=false) annotation (Placement(transformation(extent={{10,-30},{-10,-10}}))); + ThermoSysPro.Fluid.BoundaryConditions.RefXgas refXgas(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{62,0},{82,20}}))); + ThermoSysPro.Fluid.LoopBreakers.LoopBreakerXgas loopBreakerXgas(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{64,-30},{44,-10}}))); +equation + connect(refP.C2, refT.C1) annotation (Line(points={{-70,10},{-60,10}}, color={0,0,255})); + connect(refT.C2, pump.C1) annotation (Line(points={{-40,10},{-30,10}}, color={0,0,255})); + connect(constante.y, refP.IPressure) annotation (Line(points={{-79,70},{-60,70},{-60,34},{-80,34},{-80,21}})); + connect(pump.C2, loopBreakerQ.C1) annotation (Line(points={{-10,10},{0,10}}, color={0,0,255})); + connect(loopBreakerQ.C2, loopBreakerH.C1) annotation (Line(points={{20,10},{30,10}}, color={0,0,255})); + connect(volumeA.Cs1, refP.C1) annotation (Line(points={{-10,-20},{-100,-20},{-100,10},{-90,10}}, color={0,0,0})); + + connect(refXgas.C1, loopBreakerH.C2) annotation (Line(points={{62,10},{50,10}}, color={0,0,0})); + connect(volumeA.Ce1, loopBreakerXgas.C2) annotation (Line(points={{10,-20},{44,-20}}, color={0,0,0})); + connect(loopBreakerXgas.C1, refXgas.C2) annotation (Line(points={{64,-20},{100,-20},{100,10},{82,10}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestLoopBreakerX_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/LoopBreakers/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/LoopBreakers/package.order index 244c2ab3..0b1ec3d4 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/LoopBreakers/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/LoopBreakers/package.order @@ -2,3 +2,5 @@ TestLoopBreakerP TestLoopBreakerP_Traces TestLoopBreakerP_FlueGases TestLoopBreakerQH +TestLoopBreakerSubC_Traces +TestLoopBreakerX_FlueGases From 3c5cfc83d04f2b4b2646f536297a4762a5e94604 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Thu, 3 Jul 2025 18:07:02 +0200 Subject: [PATCH 102/178] #125 An example from RefP had disappeared --- .../TestRefP_Traces_FlueGases.mo | 46 +++++++++++++++++++ .../BoundaryConditions/package.order | 1 + 2 files changed, 47 insertions(+) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefP_Traces_FlueGases.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefP_Traces_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefP_Traces_FlueGases.mo new file mode 100644 index 00000000..9aea64c1 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefP_Traces_FlueGases.mo @@ -0,0 +1,46 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.BoundaryConditions; +model TestRefP_Traces_FlueGases + extends ThermoSysPro.UsersGuide.Icons.Example; + replaceable package Medium = ThermoSysPro.Properties.Media.FlueGases(extraPropertiesNames={"Trace1", "Trace2", "Trace3"}, C_nominal={0.1, 0.2, 0.3}, C_default={0.2, 0.3, 0.4}); + + ThermoSysPro.Fluid.BoundaryConditions.Sink sinkP( + redeclare package Medium = + Medium, + T0=453.15, + h0=633193.1, + option_temperature=true) + annotation (Placement(transformation(extent={{66,-10},{86,10}}))); + ThermoSysPro.Fluid.PressureLosses.PipePressureLoss pipePressureLoss( + redeclare package Medium = Medium) + annotation (Placement(transformation(extent={{32,-10},{52,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.RefP refP(redeclare package Medium = + Medium) + annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare package + Medium = Medium, + Q0=50, + T0=473.15, + h0=633193.1, + option_temperature=true, SubC0={10,20,30}, X0={0.1,0.2,0.3,0.2,0.2}, + T(start=423.15)) + annotation (Placement(transformation(extent={{-66,-10},{-46,10}}))); + InstrumentationAndControl.Blocks.Sources.Constante constante(k=20e5) + annotation (Placement(transformation(extent={{-30,38},{-10,58}}))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss( + redeclare package Medium = Medium) + annotation (Placement(transformation(extent={{-38,-10},{-18,10}}))); +equation + connect(sinkP.C, pipePressureLoss.C2) + annotation (Line(points={{66,0},{52,0}}, color={0,0,0})); + connect(refP.C2, pipePressureLoss.C1) + annotation (Line(points={{10,0},{32,0}}, color={0,0,0})); + + connect(constante.y, refP.IPressure) + annotation (Line(points={{-9,48},{0,48},{0,11}}, color={0,0,255})); + connect(sourceQ.C, singularPressureLoss.C1) + annotation (Line(points={{-46,0},{-38,0}}, color={0,0,0})); + connect(singularPressureLoss.C2, refP.C1) + annotation (Line(points={{-18,0},{-10,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( + coordinateSystem(preserveAspectRatio=false))); +end TestRefP_Traces_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/package.order index 873455cd..3e1250f4 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/package.order @@ -3,6 +3,7 @@ TestRefQ_Traces TestRefQ_Traces_FlueGases TestRefP TestRefP_Traces +TestRefP_Traces_FlueGases TestRefT TestRefSubC_Traces TestRefX_FlueGases From fa6f8d529b8e6660b6ad2108708ebc777d5782e9 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Fri, 4 Jul 2025 15:27:10 +0200 Subject: [PATCH 103/178] #125 LumpedStraightPipe for FlueGases --- .../TestLumpedStraightPipe_FlueGases.mo | 20 +++++++++++++++++++ .../PressureLosses/package.order | 3 ++- .../PressureLosses/LumpedStraightPipe.mo | 4 ++-- 3 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestLumpedStraightPipe_FlueGases.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestLumpedStraightPipe_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestLumpedStraightPipe_FlueGases.mo new file mode 100644 index 00000000..887abd3c --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestLumpedStraightPipe_FlueGases.mo @@ -0,0 +1,20 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.PressureLosses; +model TestLumpedStraightPipe_FlueGases + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.FlueGases; + ThermoSysPro.Fluid.PressureLosses.PipePressureLoss pipePressureLoss(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink( + redeclare replaceable package Medium = Medium, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ( + redeclare replaceable package Medium = Medium, + P0=4500000, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); +equation + connect(pipePressureLoss.C2, sink.C) annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(pipePressureLoss.C1, sourcePQ.C) annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestLumpedStraightPipe_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order index 752739f0..0b9b7187 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order @@ -9,6 +9,7 @@ TestControlValve_Traces TestControlValve_Traces_FlueGases TestLumpedStraightPipe TestLumpedStraightPipe_Traces +TestLumpedStraightPipe_FlueGases TestDynamicReliefValve TestDynamicReliefValve_FlueGases TestDynamicReliefValve_Traces @@ -32,4 +33,4 @@ TestDynamicCheckValve_FlueGases TestDynamicCheckValve_Traces TestCheckValve TestCheckValve_FlueGases -TestCheckValve_Traces \ No newline at end of file +TestCheckValve_Traces diff --git a/ThermoSysPro/Fluid/PressureLosses/LumpedStraightPipe.mo b/ThermoSysPro/Fluid/PressureLosses/LumpedStraightPipe.mo index f6b38ab1..fd4d20c3 100644 --- a/ThermoSysPro/Fluid/PressureLosses/LumpedStraightPipe.mo +++ b/ThermoSysPro/Fluid/PressureLosses/LumpedStraightPipe.mo @@ -120,12 +120,12 @@ equation /* Fluid thermodynamic properties */ Pm = (C1.P + C2.P)/2; - state=Medium.setState_phX(p=Pm, h=h, X=X, region=mode); + state=Medium.setState_phX(p=Pm, h=h, X=X); if (p_rho > 0) then rho = p_rho; else - rho = state.d; + rho = Medium.density(state); end if; From 78c4152a73a501d1061d8b2ac99ee058a775d06a Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Fri, 4 Jul 2025 15:30:11 +0200 Subject: [PATCH 104/178] #125 LumpedStraightPipe no more region --- .../PressureLosses/TestLumpedStraightPipe_FlueGases.mo | 8 +++++--- ThermoSysPro/Fluid/PressureLosses/LumpedStraightPipe.mo | 6 +----- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestLumpedStraightPipe_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestLumpedStraightPipe_FlueGases.mo index 887abd3c..ef77553f 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestLumpedStraightPipe_FlueGases.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestLumpedStraightPipe_FlueGases.mo @@ -3,7 +3,9 @@ model TestLumpedStraightPipe_FlueGases extends ThermoSysPro.UsersGuide.Icons.Example; replaceable package Medium = Properties.Media.FlueGases; - ThermoSysPro.Fluid.PressureLosses.PipePressureLoss pipePressureLoss(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe + lumpedStraightPipe( + redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); ThermoSysPro.Fluid.BoundaryConditions.Sink sink( redeclare replaceable package Medium = Medium, T0=573.15, @@ -14,7 +16,7 @@ model TestLumpedStraightPipe_FlueGases T0=573.15, option_temperature=true) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); equation - connect(pipePressureLoss.C2, sink.C) annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); - connect(pipePressureLoss.C1, sourcePQ.C) annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); + connect(lumpedStraightPipe.C2, sink.C) annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(lumpedStraightPipe.C1, sourcePQ.C) annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestLumpedStraightPipe_FlueGases; diff --git a/ThermoSysPro/Fluid/PressureLosses/LumpedStraightPipe.mo b/ThermoSysPro/Fluid/PressureLosses/LumpedStraightPipe.mo index fd4d20c3..bef2fd57 100644 --- a/ThermoSysPro/Fluid/PressureLosses/LumpedStraightPipe.mo +++ b/ThermoSysPro/Fluid/PressureLosses/LumpedStraightPipe.mo @@ -1,11 +1,9 @@ within ThermoSysPro.Fluid.PressureLosses; model LumpedStraightPipe "Lumped straight pipe (circular duct)" extends ThermoSysPro.Fluid.Interfaces.IconColors; - replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); - + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; parameter Units.SI.Length L=10. "Pipe length"; parameter Units.SI.Diameter D=0.2 "Pipe internal hydraulic diameter"; @@ -22,12 +20,10 @@ model LumpedStraightPipe "Lumped straight pipe (circular duct)" "true: momentum balance equation with inertia - false: without inertia"; parameter Units.SI.Density p_rho=0 "If > 0, fixed fluid density" annotation (Evaluate=true, Dialog(tab="Fluid", group="Fluid properties")); - parameter IF97Region region=IF97Region.All_regions "IF97 region (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(tab="Fluid", group="Fluid properties")); protected constant Units.SI.Acceleration g=Modelica.Constants.g_n "Gravity constant"; constant Real pi=Modelica.Constants.pi "pi"; - parameter Integer mode=Integer(region) - 1 "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; parameter Real eps=1.e-3 "Small number for pressure loss equation"; parameter Units.SI.Area A=ntubes*pi*D^2/4 "Pipe cross-sectional area (circular duct is assumed)"; From 0360cc060f70da4d9f84785f17d4c9afd97239ca Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Sun, 6 Jul 2025 20:45:50 +0200 Subject: [PATCH 105/178] #125 DeheaterMixer2 --- .../Junctions/TestDeheaterMixer2.mo | 46 ++++++++++++++++ .../Junctions/TestDeheaterMixer2_FlueGases.mo | 53 +++++++++++++++++++ .../Junctions/TestDeheaterMixer2_Traces.mo | 48 +++++++++++++++++ .../SimpleExamples/Junctions/package.order | 3 ++ .../Fluid/Junctions/DeheaterMixer2.mo | 49 ++++------------- 5 files changed, 159 insertions(+), 40 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestDeheaterMixer2.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestDeheaterMixer2_FlueGases.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestDeheaterMixer2_Traces.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestDeheaterMixer2.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestDeheaterMixer2.mo new file mode 100644 index 00000000..8e92ed16 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestDeheaterMixer2.mo @@ -0,0 +1,46 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Junctions; +model TestDeheaterMixer2 + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam; + ThermoSysPro.Fluid.Junctions.DeheaterMixer2 deheaterMixer2_1(redeclare package Medium = Medium, Tmax=308) annotation (Placement(transformation(extent={{-10,-16},{10,4}},rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-50,-10},{-30,10}},rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}},rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss2(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-50,-50},{-30,-30}}, + rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkP(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{70,-10},{90,10}},rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP(redeclare package Medium = Medium, T0=310) annotation (Placement(transformation(extent={{-90,-10},{-70,10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.Source source(redeclare package Medium = Medium, h0=30000) annotation (Placement(transformation(extent={{-90,-50},{-70,-30}},rotation=0))); +equation + connect(singularPressureLoss.C2, deheaterMixer2_1.Ce) annotation (Line(points={{-30,0},{-10,0}}, color={0,0,255})); + connect(deheaterMixer2_1.Cs, singularPressureLoss1.C1) annotation (Line(points={{10,0},{30,0}}, color={0,0,255})); + connect(singularPressureLoss2.C2, deheaterMixer2_1.Ce_mix) annotation (Line(points={{-30,-40},{0.1,-40},{0.1,-16}}, color={0,0,255})); + connect(singularPressureLoss1.C2, sinkP.C) annotation (Line(points={{50,0},{70,0}}, color={0,0,255})); + connect(sourceP.C, singularPressureLoss.C1) annotation (Line(points={{-70,0},{-50,0}}, color={0,0,255})); + connect(source.C, singularPressureLoss2.C1) annotation (Line(points={{-70,-40},{-50,-40}}, color={0,0,255})); + annotation ( + experiment(StopTime=10), + Diagram(graphics), + Icon(graphics={ + Rectangle( + lineColor={200,200,200}, + fillColor={248,248,248}, + fillPattern=FillPattern.HorizontalCylinder, + extent={{-100.0,-100.0},{100.0,100.0}}, + radius=25.0), + Rectangle( + lineColor={128,128,128}, + extent={{-100.0,-100.0},{100.0,100.0}}, + radius=25.0), + Polygon( + origin={8.0,14.0}, + lineColor={78,138,73}, + fillColor={78,138,73}, + pattern=LinePattern.None, + fillPattern=FillPattern.Solid, + points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), + Documentation(info=" +

    Copyright © EDF 2002 - 2024

    +

    ThermoSysPro Version 4.1 +")); +end TestDeheaterMixer2; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestDeheaterMixer2_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestDeheaterMixer2_FlueGases.mo new file mode 100644 index 00000000..47bc0115 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestDeheaterMixer2_FlueGases.mo @@ -0,0 +1,53 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Junctions; +model TestDeheaterMixer2_FlueGases + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.FlueGases; + ThermoSysPro.Fluid.Junctions.DeheaterMixer2 deheaterMixer2_1(redeclare package Medium = Medium, + Tmax=308, + h(start=2.83057e6)) annotation (Placement(transformation(extent={{-10,-16},{10,4}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss2(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-50,-50},{-30,-30}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkP(redeclare package Medium = Medium, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{70,-10},{90,10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP(redeclare package Medium = Medium, + P0=4500000, + T0=573.15) annotation (Placement(transformation(extent={{-90,-10},{-70,10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.Source source(redeclare package Medium = Medium, + h0=2.5e6, + option_temperature=false) annotation (Placement(transformation(extent={{-90,-50},{-70,-30}}, rotation=0))); +equation + connect(singularPressureLoss.C2, deheaterMixer2_1.Ce) annotation (Line(points={{-30,0},{-10,0}}, color={0,0,255})); + connect(deheaterMixer2_1.Cs, singularPressureLoss1.C1) annotation (Line(points={{10,0},{30,0}}, color={0,0,255})); + connect(singularPressureLoss2.C2, deheaterMixer2_1.Ce_mix) annotation (Line(points={{-30,-40},{0.1,-40},{0.1,-16}}, color={0,0,255})); + connect(singularPressureLoss1.C2, sinkP.C) annotation (Line(points={{50,0},{70,0}}, color={0,0,255})); + connect(sourceP.C, singularPressureLoss.C1) annotation (Line(points={{-70,0},{-50,0}}, color={0,0,255})); + connect(source.C, singularPressureLoss2.C1) annotation (Line(points={{-70,-40},{-50,-40}}, color={0,0,255})); + annotation ( + experiment(StopTime=10), + Diagram(graphics), + Icon(graphics={ + Rectangle( + lineColor={200,200,200}, + fillColor={248,248,248}, + fillPattern=FillPattern.HorizontalCylinder, + extent={{-100.0,-100.0},{100.0,100.0}}, + radius=25.0), + Rectangle( + lineColor={128,128,128}, + extent={{-100.0,-100.0},{100.0,100.0}}, + radius=25.0), + Polygon( + origin={8.0,14.0}, + lineColor={78,138,73}, + fillColor={78,138,73}, + pattern=LinePattern.None, + fillPattern=FillPattern.Solid, + points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), + Documentation(info=" +

    Copyright © EDF 2002 - 2024

    +

    ThermoSysPro Version 4.1 +")); +end TestDeheaterMixer2_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestDeheaterMixer2_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestDeheaterMixer2_Traces.mo new file mode 100644 index 00000000..bb783883 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestDeheaterMixer2_Traces.mo @@ -0,0 +1,48 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Junctions; +model TestDeheaterMixer2_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam ( + extraPropertiesNames={"Trace"}, + C_nominal={0.1}, + C_default={0.2}); + ThermoSysPro.Fluid.Junctions.DeheaterMixer2 deheaterMixer2_1(redeclare package Medium = Medium, Tmax=308) annotation (Placement(transformation(extent={{-10,-16},{10,4}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss2(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-50,-50},{-30,-30}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkP(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{70,-10},{90,10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP(redeclare package Medium = Medium, T0=310) annotation (Placement(transformation(extent={{-90,-10},{-70,10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.Source source(redeclare package Medium = Medium, h0=30000) annotation (Placement(transformation(extent={{-90,-50},{-70,-30}}, rotation=0))); +equation + connect(singularPressureLoss.C2, deheaterMixer2_1.Ce) annotation (Line(points={{-30,0},{-10,0}}, color={0,0,255})); + connect(deheaterMixer2_1.Cs, singularPressureLoss1.C1) annotation (Line(points={{10,0},{30,0}}, color={0,0,255})); + connect(singularPressureLoss2.C2, deheaterMixer2_1.Ce_mix) annotation (Line(points={{-30,-40},{0.1,-40},{0.1,-16}}, color={0,0,255})); + connect(singularPressureLoss1.C2, sinkP.C) annotation (Line(points={{50,0},{70,0}}, color={0,0,255})); + connect(sourceP.C, singularPressureLoss.C1) annotation (Line(points={{-70,0},{-50,0}}, color={0,0,255})); + connect(source.C, singularPressureLoss2.C1) annotation (Line(points={{-70,-40},{-50,-40}}, color={0,0,255})); + annotation ( + experiment(StopTime=10), + Diagram(graphics), + Icon(graphics={ + Rectangle( + lineColor={200,200,200}, + fillColor={248,248,248}, + fillPattern=FillPattern.HorizontalCylinder, + extent={{-100.0,-100.0},{100.0,100.0}}, + radius=25.0), + Rectangle( + lineColor={128,128,128}, + extent={{-100.0,-100.0},{100.0,100.0}}, + radius=25.0), + Polygon( + origin={8.0,14.0}, + lineColor={78,138,73}, + fillColor={78,138,73}, + pattern=LinePattern.None, + fillPattern=FillPattern.Solid, + points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), + Documentation(info=" +

    Copyright © EDF 2002 - 2024

    +

    ThermoSysPro Version 4.1 +")); +end TestDeheaterMixer2_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/package.order index 08496374..4c06f9fa 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/package.order @@ -6,3 +6,6 @@ TestSplitter2_FlueGases TestMixer2 TestMixer2_Traces TestMixer2_FlueGases +TestDeheaterMixer2 +TestDeheaterMixer2_Traces +TestDeheaterMixer2_FlueGases diff --git a/ThermoSysPro/Fluid/Junctions/DeheaterMixer2.mo b/ThermoSysPro/Fluid/Junctions/DeheaterMixer2.mo index ce58b140..aabce226 100644 --- a/ThermoSysPro/Fluid/Junctions/DeheaterMixer2.mo +++ b/ThermoSysPro/Fluid/Junctions/DeheaterMixer2.mo @@ -1,33 +1,22 @@ within ThermoSysPro.Fluid.Junctions; model DeheaterMixer2 - extends - ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidTypeParameterInterface; extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; - + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Units.SI.Temperature Tmax=700 "Maximum fluid temperature"; parameter Boolean continuous_flow_reversal=false "true: continuous flow reversal - false: discontinuous flow reversal"; parameter Boolean diffusion=false "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; - parameter IF97Region region=IF97Region.All_regions "IF97 region (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); protected parameter Units.SI.MassFlowRate gamma0=1.e-4 "Pseudo-diffusion conductance use for continuous flow reversal (active if diffusion=false and continuous_flow_reversal = true)"; - parameter Integer mode=Integer(region) - 1 "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; public Units.SI.AbsolutePressure P(start=50e5) "Fluid pressure"; Units.SI.SpecificEnthalpy h(start=10e5) "Fluid specific enthalpy"; Units.SI.Temperature T(start=700) "Fluid temperature"; Units.SI.SpecificEnthalpy hmax(start=10e5) "Maximum fluid specific enthalpy"; - FluidType fluids[4] "Fluids mixing in volume"; - ThermoSysPro.Units.SI.MassFraction Xco2 "CO2 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xh2o "H20 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xo2 "O2 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xso2 "SO2 mass fraction"; Units.SI.Power Je "Thermal power diffusion from inlet e"; Units.SI.Power Je_mix "Thermal power diffusion from inlet e_mix"; Units.SI.Power Js "Thermal power diffusion from outlet s"; @@ -40,24 +29,11 @@ public Real rs "Value of r(Q/gamma) for outlet s"; public - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce_mix annotation ( - Placement(transformation(extent={{-9,-110},{11,-90}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs annotation (Placement( - transformation(extent={{90,50},{110,70}}, rotation=0))); -public - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce annotation (Placement( - transformation(extent={{-110,50},{-90,70}}, rotation=0))); + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce_mix(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-9,-110},{11,-90}}, rotation=0))); + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{90,50},{110,70}}, rotation=0))); + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-110,50},{-90,70}}, rotation=0))); equation - /* Check that incoming fluids are compatible with fluid in volume */ - fluids[1] = ftype; - fluids[2] = Ce.ftype; - fluids[3] = Ce_mix.ftype; - fluids[4] = Cs.ftype; - - assert(ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.isCompatible(fluids), - "DeheaterMixer2: fluids mixing in volume are not compatible with each other"); - /* Mass balance equation */ 0 = Ce.Q + Ce_mix.Q - Cs.Q; @@ -80,17 +56,10 @@ equation end if; /* Fluid composition balance equations */ - 0 = Ce.Xco2*Ce.Q + Ce_mix.Xco2*Ce_mix.Q - Cs.Xco2*Cs.Q; - 0 = Ce.Xh2o*Ce.Q + Ce_mix.Xh2o*Ce_mix.Q - Cs.Xh2o*Cs.Q; - 0 = Ce.Xo2*Ce.Q + Ce_mix.Xo2*Ce_mix.Q - Cs.Xo2*Cs.Q; - 0 = Ce.Xso2*Ce.Q + Ce_mix.Xso2*Ce_mix.Q - Cs.Xso2*Cs.Q; - - Cs.ftype = ftype; + Cs.Xi*Cs.Q = Ce.Xi*Ce.Q + Ce_mix.Xi*Ce_mix.Q; - Cs.Xco2 = Xco2; - Cs.Xh2o = Xh2o; - Cs.Xo2 = Xo2; - Cs.Xso2 = Xso2; + /* Traces composition balance equations */ + Cs.SubC*Cs.Q = Ce.SubC*Ce.Q + Ce_mix.SubC*Ce_mix.Q; /* Flow reversal */ if continuous_flow_reversal then @@ -137,9 +106,9 @@ equation Cs.diff_on_1 = diffusion; /* Fluid thermodynamic properties */ - T = ThermoSysPro.Properties.Fluid.Temperature_Ph(P, h, fluid, mode, Cs.Xco2, Cs.Xh2o, Cs.Xo2, Cs.Xso2); + T = Medium.temperature_phX(P, h, Cs.Xi); - hmax = ThermoSysPro.Properties.Fluid.SpecificEnthalpy_PT(P, Tmax, fluid, mode, Cs.Xco2, Cs.Xh2o, Cs.Xo2, Cs.Xso2); + hmax = Medium.specificEnthalpy_pTX(P, Tmax, Cs.Xi); annotation ( Diagram(coordinateSystem( From 385e69ba0bb0ca162e59ca8529f0a066bab5f612 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Sun, 6 Jul 2025 20:59:13 +0200 Subject: [PATCH 106/178] #125 MassFlowMultiplier --- .../Junctions/TestMassFlowMultiplier.mo | 40 +++++++++++++++ .../TestMassFlowMultiplier_FlueGases.mo | 51 +++++++++++++++++++ .../TestMassFlowMultiplier_Traces.mo | 43 ++++++++++++++++ .../SimpleExamples/Junctions/package.order | 3 ++ .../Fluid/Junctions/MassFlowMultiplier.mo | 42 +++------------ 5 files changed, 144 insertions(+), 35 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMassFlowMultiplier.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMassFlowMultiplier_FlueGases.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMassFlowMultiplier_Traces.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMassFlowMultiplier.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMassFlowMultiplier.mo new file mode 100644 index 00000000..ac220531 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMassFlowMultiplier.mo @@ -0,0 +1,40 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Junctions; +model TestMassFlowMultiplier + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam; + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-90,-10},{-70,10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{70,-10},{90,10}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}, rotation=0))); + ThermoSysPro.Fluid.Junctions.MassFlowMultiplier massFlowMultiplier(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}, rotation=0))); +equation + connect(sourcePQ.C, singularPressureLoss.C1) annotation (Line(points={{-70,0},{-50,0}}, color={0,0,255})); + connect(singularPressureLoss1.C2, sink.C) annotation (Line(points={{50,0},{70,0}}, color={0,0,255})); + connect(singularPressureLoss.C2, massFlowMultiplier.Ce) annotation (Line(points={{-30,0},{-10,0}}, color={0,0,255})); + connect(massFlowMultiplier.Cs, singularPressureLoss1.C1) annotation (Line(points={{10,0},{30,0}}, color={0,0,255})); + annotation ( + experiment(StopTime=1000), + Icon(graphics={ + Rectangle( + lineColor={200,200,200}, + fillColor={248,248,248}, + fillPattern=FillPattern.HorizontalCylinder, + extent={{-100.0,-100.0},{100.0,100.0}}, + radius=25.0), + Rectangle( + lineColor={128,128,128}, + extent={{-100.0,-100.0},{100.0,100.0}}, + radius=25.0), + Polygon( + origin={8.0,14.0}, + lineColor={78,138,73}, + fillColor={78,138,73}, + pattern=LinePattern.None, + fillPattern=FillPattern.Solid, + points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), + Documentation(info=" +

    Copyright © EDF 2002 - 2024

    +

    ThermoSysPro Version 4.1 +")); +end TestMassFlowMultiplier; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMassFlowMultiplier_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMassFlowMultiplier_FlueGases.mo new file mode 100644 index 00000000..789689ec --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMassFlowMultiplier_FlueGases.mo @@ -0,0 +1,51 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Junctions; +model TestMassFlowMultiplier_FlueGases + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.FlueGases ( + extraPropertiesNames={"Trace"}, + C_nominal={0.1}, + C_default={0.2}); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ( + redeclare package Medium = Medium, + P0=4500000, + T0=573.15, + option_temperature=true, + C(h_vol_2(start=2830566))) annotation (Placement(transformation(extent={{-90,-10},{-70,10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink( + redeclare package Medium = Medium, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{70,-10},{90,10}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss(redeclare package Medium = Medium, rho(start=27, displayUnit="kg/m3")) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss1(redeclare package Medium = Medium, rho(displayUnit="kg/m3", start=27)) annotation (Placement(transformation(extent={{30,-10},{50,10}}, rotation=0))); + ThermoSysPro.Fluid.Junctions.MassFlowMultiplier massFlowMultiplier(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}, rotation=0))); +equation + connect(sourcePQ.C, singularPressureLoss.C1) annotation (Line(points={{-70,0},{-50,0}}, color={0,0,255})); + connect(singularPressureLoss1.C2, sink.C) annotation (Line(points={{50,0},{70,0}}, color={0,0,255})); + connect(singularPressureLoss.C2, massFlowMultiplier.Ce) annotation (Line(points={{-30,0},{-10,0}}, color={0,0,255})); + connect(massFlowMultiplier.Cs, singularPressureLoss1.C1) annotation (Line(points={{10,0},{30,0}}, color={0,0,255})); + annotation ( + experiment(StopTime=1000), + Icon(graphics={ + Rectangle( + lineColor={200,200,200}, + fillColor={248,248,248}, + fillPattern=FillPattern.HorizontalCylinder, + extent={{-100.0,-100.0},{100.0,100.0}}, + radius=25.0), + Rectangle( + lineColor={128,128,128}, + extent={{-100.0,-100.0},{100.0,100.0}}, + radius=25.0), + Polygon( + origin={8.0,14.0}, + lineColor={78,138,73}, + fillColor={78,138,73}, + pattern=LinePattern.None, + fillPattern=FillPattern.Solid, + points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), + Documentation(info=" +

    Copyright © EDF 2002 - 2024

    +

    ThermoSysPro Version 4.1 +")); +end TestMassFlowMultiplier_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMassFlowMultiplier_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMassFlowMultiplier_Traces.mo new file mode 100644 index 00000000..623e1b0e --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMassFlowMultiplier_Traces.mo @@ -0,0 +1,43 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Junctions; +model TestMassFlowMultiplier_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam ( + extraPropertiesNames={"Trace"}, + C_nominal={0.1}, + C_default={0.2}); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-90,-10},{-70,10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{70,-10},{90,10}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}, rotation=0))); + ThermoSysPro.Fluid.Junctions.MassFlowMultiplier massFlowMultiplier(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}, rotation=0))); +equation + connect(sourcePQ.C, singularPressureLoss.C1) annotation (Line(points={{-70,0},{-50,0}}, color={0,0,255})); + connect(singularPressureLoss1.C2, sink.C) annotation (Line(points={{50,0},{70,0}}, color={0,0,255})); + connect(singularPressureLoss.C2, massFlowMultiplier.Ce) annotation (Line(points={{-30,0},{-10,0}}, color={0,0,255})); + connect(massFlowMultiplier.Cs, singularPressureLoss1.C1) annotation (Line(points={{10,0},{30,0}}, color={0,0,255})); + annotation ( + experiment(StopTime=1000), + Icon(graphics={ + Rectangle( + lineColor={200,200,200}, + fillColor={248,248,248}, + fillPattern=FillPattern.HorizontalCylinder, + extent={{-100.0,-100.0},{100.0,100.0}}, + radius=25.0), + Rectangle( + lineColor={128,128,128}, + extent={{-100.0,-100.0},{100.0,100.0}}, + radius=25.0), + Polygon( + origin={8.0,14.0}, + lineColor={78,138,73}, + fillColor={78,138,73}, + pattern=LinePattern.None, + fillPattern=FillPattern.Solid, + points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), + Documentation(info=" +

    Copyright © EDF 2002 - 2024

    +

    ThermoSysPro Version 4.1 +")); +end TestMassFlowMultiplier_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/package.order index 4c06f9fa..78c3b431 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/package.order @@ -9,3 +9,6 @@ TestMixer2_FlueGases TestDeheaterMixer2 TestDeheaterMixer2_Traces TestDeheaterMixer2_FlueGases +TestMassFlowMultiplier +TestMassFlowMultiplier_Traces +TestMassFlowMultiplier_FlueGases diff --git a/ThermoSysPro/Fluid/Junctions/MassFlowMultiplier.mo b/ThermoSysPro/Fluid/Junctions/MassFlowMultiplier.mo index a15f17b6..d130ffb3 100644 --- a/ThermoSysPro/Fluid/Junctions/MassFlowMultiplier.mo +++ b/ThermoSysPro/Fluid/Junctions/MassFlowMultiplier.mo @@ -1,11 +1,7 @@ within ThermoSysPro.Fluid.Junctions; model MassFlowMultiplier "Mass flow multipliier" - extends - ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidTypeParameterInterface; extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; - + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Real alpha=2 "Flow multiplier"; parameter Boolean continuous_flow_reversal=false "true: continuous flow reversal - false: discontinuous flow reversal"; @@ -13,24 +9,16 @@ model MassFlowMultiplier "Mass flow multipliier" "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; parameter Units.SI.Density p_rho=0 "If > 0, fixed fluid density" annotation (Evaluate=true, Dialog(tab="Fluid", group="Fluid properties")); - parameter IF97Region region=IF97Region.All_regions "IF97 region (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); protected - parameter Boolean flue_gases=(ftype == FluidType.FlueGases) "Flue gases"; parameter Units.SI.MassFlowRate gamma0=1.e-4 "Pseudo-diffusion conductance use for continuous flow reversal (active if diffusion=false and continuous_flow_reversal = true)"; - parameter Integer mode=Integer(region) - 1 "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; public Units.SI.AbsolutePressure P(start=10e5) "Fluid pressure"; Units.SI.SpecificEnthalpy h(start=10e5) "Fluid specific enthalpy"; Units.SI.Temperature T "Fluid temperature"; Units.SI.Density rho(start=998) "Fluid density"; - FluidType fluids[3] "Fluids mixing in volume"; - ThermoSysPro.Units.SI.MassFraction Xco2 "CO2 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xh2o "H20 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xo2 "O2 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xso2 "SO2 mass fraction"; Units.SI.Power Je "Thermal power diffusion from inlet e"; Units.SI.Power Js "Thermal power diffusion from outlet s"; Units.SI.Power J "Total thermal power diffusion"; @@ -40,20 +28,12 @@ public Real rs "Value of r(Q/gamma) for outlet s"; public - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-110,-10},{-90,10}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{90,-10},{110,10}}, rotation=0))); equation - /* Check that incoming fluids are compatible with fluid in volume */ - fluids[1] = ftype; - fluids[2] = Ce.ftype; - fluids[3] = Cs.ftype; - - assert(ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.isCompatible(fluids), - "MassFlowMultiplier: fluids mixing in volume are not compatible with each other"); - /* Mass balance equation */ 0 = alpha*Ce.Q - Cs.Q; @@ -67,17 +47,9 @@ equation Cs.h_vol_1 = h; /* Fluid composition */ - 0 = Ce.Xco2*alpha*Ce.Q - Cs.Xco2*Cs.Q; - 0 = Ce.Xh2o*alpha*Ce.Q - Cs.Xh2o*Cs.Q; - 0 = Ce.Xo2*alpha*Ce.Q - Cs.Xo2*Cs.Q; - 0 = Ce.Xso2*alpha*Ce.Q - Cs.Xso2*Cs.Q; - - Cs.ftype = ftype; + Ce.Xi*alpha*Ce.Q = Cs.Xi*Cs.Q; - Cs.Xco2 = Xco2; - Cs.Xh2o = Xh2o; - Cs.Xo2 = Xo2; - Cs.Xso2 = Xso2; + Ce.SubC*alpha*Ce.Q = Cs.SubC*Cs.Q; /* Flow reversal */ if continuous_flow_reversal then @@ -116,12 +88,12 @@ equation Cs.diff_on_1 = diffusion; /* Fluid thermodynamic properties */ - T = ThermoSysPro.Properties.Fluid.Temperature_Ph(P, h, fluid, mode, Cs.Xco2, Cs.Xh2o, Cs.Xo2, Cs.Xso2); + T = Medium.temperature_phX(P, h, Cs.Xi); if (p_rho > 0) then rho = p_rho; else - rho = ThermoSysPro.Properties.Fluid.Density_Ph(P,h,fluid,mode, Cs.Xco2, Cs.Xh2o, Cs.Xo2, Cs.Xso2); + rho = Medium.density_phX(P,h,Cs.Xi); end if; annotation ( From 39c9990c120757beee612a361b13a3b8d0b9791f Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Sun, 6 Jul 2025 21:16:13 +0200 Subject: [PATCH 107/178] #125 Mixer3 --- .../SimpleExamples/Junctions/TestMixer3.mo | 31 +++++++++ .../Junctions/TestMixer3_FlueGases.mo | 35 ++++++++++ .../Junctions/TestMixer3_Traces.mo | 33 +++++++++ .../SimpleExamples/Junctions/package.order | 3 + ThermoSysPro/Fluid/Junctions/Mixer3.mo | 67 ++++--------------- 5 files changed, 115 insertions(+), 54 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMixer3.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMixer3_FlueGases.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMixer3_Traces.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMixer3.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMixer3.mo new file mode 100644 index 00000000..7161949d --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMixer3.mo @@ -0,0 +1,31 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Junctions; +model TestMixer3 + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam; + ThermoSysPro.Fluid.Junctions.Mixer3 mixer3_1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-6,-10},{14,10}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{34,-10},{54,10}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-46,10},{-26,30}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss2(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-46,-30},{-26,-10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.Source sourceP(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-86,10},{-66,30}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-86,-30},{-66,-10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkP(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{74,-10},{94,10}}, rotation=0))); + InstrumentationAndControl.Blocks.Sources.Constante constante(k=0) annotation (Placement(transformation(extent={{-54,52},{-34,72}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss3(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-46,-10},{-26,10}},rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare package Medium = Medium) + annotation (Placement(transformation(extent={{-86,-10},{-66,10}},rotation=0))); +equation + connect(singularPressureLoss1.C2,mixer3_1. Ce1) annotation (Line(points={{-26,20},{0,20},{0,10}}, color={0,0,255})); + connect(singularPressureLoss2.C2,mixer3_1. Ce2) annotation (Line(points={{-26,-20},{0,-20},{0,-10}}, color={0,0,255})); + connect(mixer3_1.Cs, singularPressureLoss.C1) annotation (Line(points={{14,0},{34,0}}, color={0,0,255})); + connect(sourceP.C, singularPressureLoss1.C1) annotation (Line(points={{-66,20},{-46,20}}, color={0,0,255})); + connect(sourceP1.C, singularPressureLoss2.C1) annotation (Line(points={{-66,-20},{-46,-20}}, color={0,0,255})); + connect(singularPressureLoss.C2, sinkP.C) annotation (Line(points={{54,0},{74,0}}, color={0,0,255})); + connect(constante.y,mixer3_1. Ialpha1) annotation (Line(points={{-33,62},{-16,62},{-16,6},{-3,6}})); + connect(sourceQ.C, singularPressureLoss3.C1) annotation (Line(points={{-66,0},{-46,0}}, color={0,0,255})); + connect(singularPressureLoss3.C2, mixer3_1.Ce3) annotation (Line(points={{-26,0},{-6,0}}, color={0,0,0})); + annotation (experiment(StopTime=10), Documentation(info=" +

    Copyright © EDF 2002 - 2024

    +

    ThermoSysPro Version 4.1 +")); +end TestMixer3; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMixer3_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMixer3_FlueGases.mo new file mode 100644 index 00000000..ed8b978e --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMixer3_FlueGases.mo @@ -0,0 +1,35 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Junctions; +model TestMixer3_FlueGases + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.FlueGases; + ThermoSysPro.Fluid.Junctions.Mixer3 mixer3_1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-6,-10},{14,10}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{34,-10},{54,10}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-46,10},{-26,30}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss2(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-46,-30},{-26,-10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.Source sourceP(redeclare package Medium = Medium, h0=2830566) + annotation (Placement(transformation(extent={{-86,10},{-66,30}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP1(redeclare package Medium = Medium, + P0=4500000, + T0=573.15) annotation (Placement(transformation(extent={{-86,-30},{-66,-10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkP(redeclare package Medium = Medium, h0=2830566) + annotation (Placement(transformation(extent={{74,-10},{94,10}}, rotation=0))); + InstrumentationAndControl.Blocks.Sources.Constante constante(k=0) annotation (Placement(transformation(extent={{-54,52},{-34,72}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss3(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-46,-10},{-26,10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare package Medium = Medium, h0=2830566) + annotation (Placement(transformation(extent={{-86,-10},{-66,10}}, rotation=0))); +equation + connect(singularPressureLoss1.C2, mixer3_1.Ce1) annotation (Line(points={{-26,20},{0,20},{0,10}}, color={0,0,255})); + connect(singularPressureLoss2.C2, mixer3_1.Ce2) annotation (Line(points={{-26,-20},{0,-20},{0,-10}}, color={0,0,255})); + connect(mixer3_1.Cs, singularPressureLoss.C1) annotation (Line(points={{14,0},{34,0}}, color={0,0,255})); + connect(sourceP.C, singularPressureLoss1.C1) annotation (Line(points={{-66,20},{-46,20}}, color={0,0,255})); + connect(sourceP1.C, singularPressureLoss2.C1) annotation (Line(points={{-66,-20},{-46,-20}}, color={0,0,255})); + connect(singularPressureLoss.C2, sinkP.C) annotation (Line(points={{54,0},{74,0}}, color={0,0,255})); + connect(constante.y, mixer3_1.Ialpha1) annotation (Line(points={{-33,62},{-16,62},{-16,6},{-3,6}})); + connect(sourceQ.C, singularPressureLoss3.C1) annotation (Line(points={{-66,0},{-46,0}}, color={0,0,255})); + connect(singularPressureLoss3.C2, mixer3_1.Ce3) annotation (Line(points={{-26,0},{-6,0}}, color={0,0,0})); + annotation (experiment(StopTime=10), Documentation(info=" +

    Copyright © EDF 2002 - 2024

    +

    ThermoSysPro Version 4.1 +")); +end TestMixer3_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMixer3_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMixer3_Traces.mo new file mode 100644 index 00000000..e0839bec --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMixer3_Traces.mo @@ -0,0 +1,33 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Junctions; +model TestMixer3_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam ( + extraPropertiesNames={"Trace"}, + C_nominal={0.1}, + C_default={0.2}); + ThermoSysPro.Fluid.Junctions.Mixer3 mixer3_1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-6,-10},{14,10}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{34,-10},{54,10}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-46,10},{-26,30}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss2(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-46,-30},{-26,-10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.Source sourceP(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-86,10},{-66,30}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-86,-30},{-66,-10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkP(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{74,-10},{94,10}}, rotation=0))); + InstrumentationAndControl.Blocks.Sources.Constante constante(k=0) annotation (Placement(transformation(extent={{-54,52},{-34,72}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss3(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-46,-10},{-26,10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-86,-10},{-66,10}}, rotation=0))); +equation + connect(singularPressureLoss1.C2, mixer3_1.Ce1) annotation (Line(points={{-26,20},{0,20},{0,10}}, color={0,0,255})); + connect(singularPressureLoss2.C2, mixer3_1.Ce2) annotation (Line(points={{-26,-20},{0,-20},{0,-10}}, color={0,0,255})); + connect(mixer3_1.Cs, singularPressureLoss.C1) annotation (Line(points={{14,0},{34,0}}, color={0,0,255})); + connect(sourceP.C, singularPressureLoss1.C1) annotation (Line(points={{-66,20},{-46,20}}, color={0,0,255})); + connect(sourceP1.C, singularPressureLoss2.C1) annotation (Line(points={{-66,-20},{-46,-20}}, color={0,0,255})); + connect(singularPressureLoss.C2, sinkP.C) annotation (Line(points={{54,0},{74,0}}, color={0,0,255})); + connect(constante.y, mixer3_1.Ialpha1) annotation (Line(points={{-33,62},{-16,62},{-16,6},{-3,6}})); + connect(sourceQ.C, singularPressureLoss3.C1) annotation (Line(points={{-66,0},{-46,0}}, color={0,0,255})); + connect(singularPressureLoss3.C2, mixer3_1.Ce3) annotation (Line(points={{-26,0},{-6,0}}, color={0,0,0})); + annotation (experiment(StopTime=10), Documentation(info=" +

    Copyright © EDF 2002 - 2024

    +

    ThermoSysPro Version 4.1 +")); +end TestMixer3_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/package.order index 78c3b431..82e8d065 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/package.order @@ -12,3 +12,6 @@ TestDeheaterMixer2_FlueGases TestMassFlowMultiplier TestMassFlowMultiplier_Traces TestMassFlowMultiplier_FlueGases +TestMixer3 +TestMixer3_Traces +TestMixer3_FlueGases diff --git a/ThermoSysPro/Fluid/Junctions/Mixer3.mo b/ThermoSysPro/Fluid/Junctions/Mixer3.mo index cc6dde0c..185dbf65 100644 --- a/ThermoSysPro/Fluid/Junctions/Mixer3.mo +++ b/ThermoSysPro/Fluid/Junctions/Mixer3.mo @@ -1,21 +1,15 @@ within ThermoSysPro.Fluid.Junctions; model Mixer3 "Mixer with three inlets" - extends - ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidTypeParameterInterface; extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; - + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Boolean continuous_flow_reversal=false "true: continuous flow reversal - false: discontinuous flow reversal"; parameter Boolean diffusion=false "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; - parameter IF97Region region=IF97Region.All_regions "IF97 region (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); protected parameter Units.SI.MassFlowRate gamma0=1.e-4 "Pseudo-diffusion conductance use for continuous flow reversal (active if diffusion=false and continuous_flow_reversal = true)"; - parameter Integer mode=Integer(region) - 1 "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; public Real alpha1 "Extraction coefficient for inlet 1 (<=1)"; @@ -23,11 +17,6 @@ public Units.SI.AbsolutePressure P(start=10e5) "Fluid pressure"; Units.SI.SpecificEnthalpy h(start=10e5) "Fluid specific enthalpy"; Units.SI.Temperature T "Fluid temperature"; - FluidType fluids[5] "Fluids mixing in volume"; - ThermoSysPro.Units.SI.MassFraction Xco2 "CO2 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xh2o "H20 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xo2 "O2 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xso2 "SO2 mass fraction"; Units.SI.Power Je1 "Thermal power diffusion from inlet e1"; Units.SI.Power Je2 "Thermal power diffusion from inlet e2"; Units.SI.Power Je3 "Thermal power diffusion from inlet e3"; @@ -43,39 +32,16 @@ public Real rs "Value of r(Q/gamma) for outlet s"; public - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce2 annotation (Placement( - transformation(extent={{-50,-110},{-30,-90}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs annotation (Placement( - transformation(extent={{90,-10},{110,10}}, rotation=0))); -public - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce1 annotation (Placement( - transformation(extent={{-50,90},{-30,110}}, rotation=0))); - InstrumentationAndControl.Connectors.InputReal Ialpha1 - "Extraction coefficient for inlet 1 (<=1)" - annotation (Placement(transformation(extent={{-80,50},{-60,70}}, rotation=0))); - InstrumentationAndControl.Connectors.OutputReal Oalpha1 - annotation (Placement(transformation(extent={{-20,50},{0,70}}, rotation=0))); -public - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce3 annotation (Placement( - transformation(extent={{-110,-10},{-90,10}}, rotation=0))); - InstrumentationAndControl.Connectors.InputReal Ialpha2 - "Extraction coefficient for inlet 2 (<=1)" - annotation (Placement(transformation(extent={{-80,-70},{-60,-50}}, rotation= - 0))); - InstrumentationAndControl.Connectors.OutputReal Oalpha2 - annotation (Placement(transformation(extent={{-20,-70},{0,-50}}, rotation=0))); + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce2(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-50,-110},{-30,-90}}, rotation=0))); + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{90,-10},{110,10}}, rotation=0))); + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-50,90},{-30,110}}, rotation=0))); + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce3(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-110,-10},{-90,10}}, rotation=0))); + InstrumentationAndControl.Connectors.InputReal Ialpha1 "Extraction coefficient for inlet 1 (<=1)" annotation (Placement(transformation(extent={{-80,50},{-60,70}}, rotation=0))); + InstrumentationAndControl.Connectors.OutputReal Oalpha1 annotation (Placement(transformation(extent={{-20,50},{0,70}}, rotation=0))); + InstrumentationAndControl.Connectors.InputReal Ialpha2 "Extraction coefficient for inlet 2 (<=1)" annotation (Placement(transformation(extent={{-80,-70},{-60,-50}}, rotation=0))); + InstrumentationAndControl.Connectors.OutputReal Oalpha2 annotation (Placement(transformation(extent={{-20,-70},{0,-50}}, rotation=0))); equation - /* Check that incoming fluids are compatible with fluid in volume */ - fluids[1] = ftype; - fluids[2] = Ce1.ftype; - fluids[3] = Ce2.ftype; - fluids[4] = Ce3.ftype; - fluids[5] = Cs.ftype; - - assert(ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.isCompatible(fluids), - "Mixer3: fluids mixing in volume are not compatible with each other"); - /* Unconnected connectors */ if (cardinality(Ialpha1) == 0) then Ialpha1.signal = 0.3; @@ -89,6 +55,7 @@ equation 0 = Ce1.Q + Ce2.Q + Ce3.Q - Cs.Q; P = Ce1.P; + P = Ce2.P; P = Ce3.P; P = Cs.P; @@ -117,17 +84,9 @@ equation Oalpha2.signal = alpha2; /* Fluid composition balance equations */ - 0 = Ce1.Xco2*Ce1.Q + Ce2.Xco2*Ce2.Q + Ce3.Xco2*Ce3.Q - Cs.Xco2*Cs.Q; - 0 = Ce1.Xh2o*Ce1.Q + Ce2.Xh2o*Ce2.Q + Ce3.Xh2o*Ce3.Q - Cs.Xh2o*Cs.Q; - 0 = Ce1.Xo2*Ce1.Q + Ce2.Xo2*Ce2.Q + Ce3.Xo2*Ce3.Q - Cs.Xo2*Cs.Q; - 0 = Ce1.Xso2*Ce1.Q + Ce2.Xso2*Ce2.Q + Ce3.Xso2*Ce3.Q - Cs.Xso2*Cs.Q; - - Cs.ftype = ftype; + Cs.Xi*Cs.Q = Ce1.Xi*Ce1.Q + Ce2.Xi*Ce2.Q + Ce3.Xi*Ce3.Q; - Cs.Xco2 = Xco2; - Cs.Xh2o = Xh2o; - Cs.Xo2 = Xo2; - Cs.Xso2 = Xso2; + Cs.SubC*Cs.Q = Ce1.SubC*Ce1.Q + Ce2.SubC*Ce2.Q + Ce3.SubC*Ce3.Q; /* Flow reversal */ if continuous_flow_reversal then @@ -182,7 +141,7 @@ equation Cs.diff_on_1 = diffusion; /* Fluid thermodynamic properties */ - T = ThermoSysPro.Properties.Fluid.Temperature_Ph(P, h, fluid, mode, Cs.Xco2, Cs.Xh2o, Cs.Xo2, Cs.Xso2); + T = Medium.temperature_phX(P, h, Cs.Xi); annotation ( Diagram(coordinateSystem( From aa7ca91ce9df4030a71b9aa434829339ecce9f0d Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Sun, 6 Jul 2025 21:25:14 +0200 Subject: [PATCH 108/178] #125 Mixer3 --- .../SimpleExamples/Junctions/TestMixer8.mo | 81 ++++++++++++ .../SimpleExamples/Junctions/package.order | 1 + ThermoSysPro/Fluid/Junctions/Mixer8.mo | 117 +++++------------- 3 files changed, 111 insertions(+), 88 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMixer8.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMixer8.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMixer8.mo new file mode 100644 index 00000000..82b21610 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMixer8.mo @@ -0,0 +1,81 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Junctions; +model TestMixer8 + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam; + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-104,0},{-84,20}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP1( + redeclare package Medium = Medium, + P0=2e5, + Q(start=323.48244470861454)) annotation (Placement(transformation(extent={{-104,-60},{-84,-40}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.ControlValve valve1( + redeclare package Medium = Medium, + C1(h_vol_2(start=71016.12237181116)), + C2(h_vol_2(start=70977.89042837733)), + Pm(start=120690.8728732298)) annotation (Placement(transformation(extent={{-10,6},{10,26}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.ControlValve valve2( + redeclare package Medium = Medium, + C1(h_vol_2(start=70921.01678153824)), + Pm(start=118970.64778985853)) annotation (Placement(transformation(extent={{-10,-54},{10,-34}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.ControlValve valve3( + redeclare package Medium = Medium, + Q(start=804.6933031325926), + Pm(start=108776.21727782265)) annotation (Placement(transformation(extent={{50,-24},{70,-4}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP puitsP2(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{82,-30},{102,-10}}, rotation=0))); + ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Rampe rampe2( + Duration=1, + Initialvalue=1, + Finalvalue=0.05) annotation (Placement(transformation(extent={{32,20},{52,40}}, rotation=0))); + ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Rampe rampe3( + Initialvalue=1, + Starttime=2, + Finalvalue=0.001) annotation (Placement(transformation(extent={{-30,30},{-10,50}}, rotation=0))); + ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Rampe rampe4( + Initialvalue=1, + Starttime=1, + Finalvalue=0.001) annotation (Placement(transformation(extent={{-30,-30},{-10,-10}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe pipe1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-80,0},{-60,20}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe pipe2(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-80,-60},{-60,-40}}, rotation=0))); + ThermoSysPro.Fluid.Junctions.Mixer8 staticVolume(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-40,0},{-20,20}}, rotation=0))); + ThermoSysPro.Fluid.Junctions.Mixer8 staticVolume1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{20,-30},{40,-10}}, rotation=0))); + ThermoSysPro.Fluid.Junctions.Mixer8 staticVolume2(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-40,-60},{-20,-40}}, rotation=0))); +equation + connect(valve3.C2, puitsP2.C) annotation (Line(points={{70,-20},{82,-20}}, color={0,0,255})); + connect(rampe2.y, valve3.Ouv) annotation (Line(points={{53,30},{60,30},{60,-3}})); + connect(rampe3.y, valve1.Ouv) annotation (Line(points={{-9,40},{0,40},{0,27}})); + connect(rampe4.y, valve2.Ouv) annotation (Line(points={{-9,-20},{0,-20},{0,-33}})); + connect(sourceP.C, pipe1.C1) annotation (Line(points={{-84,10},{-80,10}}, color={0,0,255})); + connect(sourceP1.C, pipe2.C1) annotation (Line(points={{-84,-50},{-80,-50}}, color={0,0,255})); + connect(pipe1.C2, staticVolume.Ce4) annotation (Line(points={{-60,10},{-50,10},{-50,14},{-40.2,14}}, color={0,0,255})); + connect(staticVolume.Cs, valve1.C1) annotation (Line(points={{-20,10},{-10,10}}, color={0,0,255})); + connect(staticVolume1.Cs, valve3.C1) annotation (Line(points={{40,-20},{50,-20}}, color={0,0,255})); + connect(valve1.C2, staticVolume1.Ce1) annotation (Line(points={{10,10},{33,10},{33,-9.8}}, color={0,0,255})); + connect(valve2.C2, staticVolume1.Ce8) annotation (Line(points={{10,-50},{33,-50},{33,-29.9}}, color={0,0,255})); + connect(pipe2.C2, staticVolume2.Ce4) annotation (Line(points={{-60,-50},{-50,-50},{-50,-46},{-40.2,-46}}, color={0,0,255})); + connect(staticVolume2.Cs, valve2.C1) annotation (Line(points={{-20,-50},{-10,-50}}, color={0,0,255})); + annotation ( + experiment(StopTime=10), + Diagram(graphics), + Icon(graphics={ + Rectangle( + lineColor={200,200,200}, + fillColor={248,248,248}, + fillPattern=FillPattern.HorizontalCylinder, + extent={{-100.0,-100.0},{100.0,100.0}}, + radius=25.0), + Rectangle( + lineColor={128,128,128}, + extent={{-100.0,-100.0},{100.0,100.0}}, + radius=25.0), + Polygon( + origin={8.0,14.0}, + lineColor={78,138,73}, + fillColor={78,138,73}, + pattern=LinePattern.None, + fillPattern=FillPattern.Solid, + points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), + Documentation(info=" +

    Copyright © EDF 2002 - 2024

    +

    ThermoSysPro Version 4.1 +")); +end TestMixer8; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/package.order index 82e8d065..b1e34f40 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/package.order @@ -15,3 +15,4 @@ TestMassFlowMultiplier_FlueGases TestMixer3 TestMixer3_Traces TestMixer3_FlueGases +TestMixer8 diff --git a/ThermoSysPro/Fluid/Junctions/Mixer8.mo b/ThermoSysPro/Fluid/Junctions/Mixer8.mo index 43ddc361..dbb347e6 100644 --- a/ThermoSysPro/Fluid/Junctions/Mixer8.mo +++ b/ThermoSysPro/Fluid/Junctions/Mixer8.mo @@ -1,31 +1,19 @@ within ThermoSysPro.Fluid.Junctions; model Mixer8 "Mixer with eight inlets" - extends - ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidTypeParameterInterface; extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; - + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Boolean continuous_flow_reversal=false "true: continuous flow reversal - false: discontinuous flow reversal"; parameter Boolean diffusion=false "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; - parameter IF97Region region=IF97Region.All_regions "IF97 region (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); - protected parameter Units.SI.MassFlowRate gamma0=1.e-4 "Pseudo-diffusion conductance use for continuous flow reversal (active if diffusion=false and continuous_flow_reversal = true)"; - parameter Integer mode=Integer(region) - 1 "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; public Units.SI.AbsolutePressure P(start=10e5) "Fluid pressure"; Units.SI.SpecificEnthalpy h(start=10e5) "Fluid specific enthalpy"; Units.SI.Temperature T "Fluid temperature"; - FluidType fluids[10] "Fluids mixing in volume"; - ThermoSysPro.Units.SI.MassFraction Xco2 "CO2 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xh2o "H20 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xo2 "O2 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xso2 "SO2 mass fraction"; Units.SI.Power Je1 "Thermal power diffusion from inlet e1"; Units.SI.Power Je2 "Thermal power diffusion from inlet e2"; Units.SI.Power Je3 "Thermal power diffusion from inlet e3"; @@ -56,47 +44,32 @@ public Real rs "Value of r(Q/gamma) for outlet s"; - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce5 annotation (layer= + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce5(redeclare package Medium = Medium) annotation (layer= "icon", Placement(transformation(extent={{-110,-50},{-90,-30}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce6 annotation (layer= + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce6(redeclare package Medium = Medium) annotation (layer= "icon", Placement(transformation(extent={{-112,-109},{-92,-89}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce7 annotation (layer= + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce7(redeclare package Medium = Medium) annotation (layer= "icon", Placement(transformation(extent={{-40,-109},{-20,-89}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce3 annotation (layer= + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce3(redeclare package Medium = Medium) annotation (layer= "icon", Placement(transformation(extent={{-112,90},{-92,110}}, rotation= 0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce2 annotation (layer= + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce2(redeclare package Medium = Medium) annotation (layer= "icon", Placement(transformation(extent={{-40,90},{-20,110}}, rotation= 0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce1 annotation (layer= + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce1(redeclare package Medium = Medium) annotation (layer= "icon", Placement(transformation(extent={{20,92},{40,112}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs annotation (layer= + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs(redeclare package Medium = Medium) annotation (layer= "icon", Placement(transformation(extent={{90,-10},{110,10}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce8 annotation (layer= + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce8(redeclare package Medium = Medium) annotation (layer= "icon", Placement(transformation(extent={{20,-109},{40,-89}}, rotation= 0))); - - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce4 annotation (layer= + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce4(redeclare package Medium = Medium) annotation (layer= "icon", Placement(transformation(extent={{-112,30},{-92,50}}, rotation= 0))); equation - /* Check that incoming fluids are compatible with fluid in volume */ - fluids[1] = ftype; - fluids[2] = Ce1.ftype; - fluids[3] = Ce2.ftype; - fluids[4] = Ce3.ftype; - fluids[5] = Ce4.ftype; - fluids[6] = Ce5.ftype; - fluids[7] = Ce6.ftype; - fluids[8] = Ce7.ftype; - fluids[9] = Ce8.ftype; - fluids[10] = Cs.ftype; - - assert(ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.isCompatible(fluids), - "Mixer8: fluids mixing in volume are not compatible with each other"); /* Unconnected connectors */ if (cardinality(Ce1) == 0) then @@ -105,11 +78,8 @@ equation Ce1.h_vol_1 = 1.e5; Ce1.diff_res_1 = 0; Ce1.diff_on_1 = false; - Ce1.ftype = ftype; - Ce1.Xco2 = 0; - Ce1.Xh2o = 0; - Ce1.Xo2 = 0; - Ce1.Xso2 = 0; + Ce1.Xi = Medium.X_default[1:Medium.nXi]; + Ce1.SubC = Medium.C_default; end if; if (cardinality(Ce2) == 0) then @@ -118,11 +88,8 @@ equation Ce2.h_vol_1 = 1.e5; Ce2.diff_res_1 = 0; Ce2.diff_on_1 = false; - Ce2.ftype = ftype; - Ce2.Xco2 = 0; - Ce2.Xh2o = 0; - Ce2.Xo2 = 0; - Ce2.Xso2 = 0; + Ce2.Xi = Medium.X_default[1:Medium.nXi]; + Ce2.SubC = Medium.C_default; end if; if (cardinality(Ce3) == 0) then @@ -131,11 +98,8 @@ equation Ce3.h_vol_1 = 1.e5; Ce3.diff_res_1 = 0; Ce3.diff_on_1 = false; - Ce3.ftype = ftype; - Ce3.Xco2 = 0; - Ce3.Xh2o = 0; - Ce3.Xo2 = 0; - Ce3.Xso2 = 0; + Ce3.Xi = Medium.X_default[1:Medium.nXi]; + Ce3.SubC = Medium.C_default; end if; if (cardinality(Ce4) == 0) then @@ -144,11 +108,8 @@ equation Ce4.h_vol_1 = 1.e5; Ce4.diff_res_1 = 0; Ce4.diff_on_1 = false; - Ce4.ftype = ftype; - Ce4.Xco2 = 0; - Ce4.Xh2o = 0; - Ce4.Xo2 = 0; - Ce4.Xso2 = 0; + Ce4.Xi = Medium.X_default[1:Medium.nXi]; + Ce4.SubC = Medium.C_default; end if; if (cardinality(Ce5) == 0) then @@ -157,11 +118,8 @@ equation Ce5.h_vol_1 = 1.e5; Ce5.diff_res_1 = 0; Ce5.diff_on_1 = false; - Ce5.ftype = ftype; - Ce5.Xco2 = 0; - Ce5.Xh2o = 0; - Ce5.Xo2 = 0; - Ce5.Xso2 = 0; + Ce5.Xi = Medium.X_default[1:Medium.nXi]; + Ce5.SubC = Medium.C_default; end if; if (cardinality(Ce6) == 0) then @@ -170,11 +128,8 @@ equation Ce6.h_vol_1 = 1.e5; Ce6.diff_res_1 = 0; Ce6.diff_on_1 = false; - Ce6.ftype = ftype; - Ce6.Xco2 = 0; - Ce6.Xh2o = 0; - Ce6.Xo2 = 0; - Ce6.Xso2 = 0; + Ce6.Xi = Medium.X_default[1:Medium.nXi]; + Ce6.SubC = Medium.C_default; end if; if (cardinality(Ce7) == 0) then @@ -183,11 +138,8 @@ equation Ce7.h_vol_1 = 1.e5; Ce7.diff_res_1 = 0; Ce7.diff_on_1 = false; - Ce7.ftype = ftype; - Ce7.Xco2 = 0; - Ce7.Xh2o = 0; - Ce7.Xo2 = 0; - Ce7.Xso2 = 0; + Ce7.Xi = Medium.X_default[1:Medium.nXi]; + Ce7.SubC = Medium.C_default; end if; if (cardinality(Ce8) == 0) then @@ -196,11 +148,8 @@ equation Ce8.h_vol_1 = 1.e5; Ce8.diff_res_1 = 0; Ce8.diff_on_1 = false; - Ce8.ftype = ftype; - Ce8.Xco2 = 0; - Ce8.Xh2o = 0; - Ce8.Xo2 = 0; - Ce8.Xso2 = 0; + Ce8.Xi = Medium.X_default[1:Medium.nXi]; + Ce8.SubC = Medium.C_default; end if; if (cardinality(Cs) == 0) then @@ -237,17 +186,9 @@ equation Cs.h_vol_1 = h; /* Fluid composition balance equations */ - 0 = Ce1.Xco2*Ce1.Q + Ce2.Xco2*Ce2.Q + Ce3.Xco2*Ce3.Q + Ce4.Xco2*Ce4.Q + Ce5.Xco2*Ce5.Q + Ce6.Xco2*Ce6.Q + Ce7.Xco2*Ce7.Q + Ce8.Xco2*Ce8.Q - Cs.Xco2*Cs.Q; - 0 = Ce1.Xh2o*Ce1.Q + Ce2.Xh2o*Ce2.Q + Ce3.Xh2o*Ce3.Q + Ce4.Xh2o*Ce4.Q + Ce5.Xh2o*Ce5.Q + Ce6.Xh2o*Ce6.Q + Ce7.Xh2o*Ce7.Q + Ce8.Xh2o*Ce8.Q - Cs.Xh2o*Cs.Q; - 0 = Ce1.Xo2*Ce1.Q + Ce2.Xo2*Ce2.Q + Ce3.Xo2*Ce3.Q + Ce4.Xo2*Ce4.Q + Ce5.Xo2*Ce5.Q + Ce6.Xo2*Ce6.Q + Ce7.Xo2*Ce7.Q + Ce8.Xo2*Ce8.Q - Cs.Xo2*Cs.Q; - 0 = Ce1.Xso2*Ce1.Q + Ce2.Xso2*Ce2.Q + Ce3.Xso2*Ce3.Q + Ce4.Xso2*Ce4.Q + Ce5.Xso2*Ce5.Q + Ce6.Xso2*Ce6.Q + Ce7.Xso2*Ce7.Q + Ce8.Xso2*Ce8.Q - Cs.Xso2*Cs.Q; - - Cs.ftype = ftype; + Cs.Xi*Cs.Q = Ce1.Xi*Ce1.Q + Ce2.Xi*Ce2.Q + Ce3.Xi*Ce3.Q + Ce4.Xi*Ce4.Q + Ce5.Xi*Ce5.Q + Ce6.Xi*Ce6.Q + Ce7.Xi*Ce7.Q + Ce8.Xi*Ce8.Q; - Cs.Xco2 = Xco2; - Cs.Xh2o = Xh2o; - Cs.Xo2 = Xo2; - Cs.Xso2 = Xso2; + Cs.SubC*Cs.Q = Ce1.SubC*Ce1.Q + Ce2.SubC*Ce2.Q + Ce3.SubC*Ce3.Q + Ce4.SubC*Ce4.Q + Ce5.SubC*Ce5.Q + Ce6.SubC*Ce6.Q + Ce7.SubC*Ce7.Q + Ce8.SubC*Ce8.Q; /* Flow reversal */ if continuous_flow_reversal then @@ -342,7 +283,7 @@ equation Cs.diff_on_1 = diffusion; /* Fluid thermodynamic properties */ - T = ThermoSysPro.Properties.Fluid.Temperature_Ph(P, h, fluid, mode, Cs.Xco2, Cs.Xh2o, Cs.Xo2, Cs.Xso2); + T = Medium.temperature_phX(P, h, Cs.Xi); annotation ( Diagram(coordinateSystem( From a2d4f6e7503dbec04af3229b9c5f19e20fe321b1 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Sun, 6 Jul 2025 21:30:25 +0200 Subject: [PATCH 109/178] #125 Mixer8's examples --- .../SimpleExamples/Junctions/TestMixer8.mo | 21 +++-- .../Junctions/TestMixer8_Traces.mo | 87 +++++++++++++++++++ .../SimpleExamples/Junctions/package.order | 1 + 3 files changed, 100 insertions(+), 9 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMixer8_Traces.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMixer8.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMixer8.mo index 82b21610..b653f8bb 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMixer8.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMixer8.mo @@ -3,24 +3,27 @@ model TestMixer8 extends ThermoSysPro.UsersGuide.Icons.Example; replaceable package Medium = Properties.Media.WaterSteam; - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-104,0},{-84,20}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP( + redeclare package Medium = Medium, + C(h_vol_2(start=71016.12237181116)), + Q(start=1659.0367844064706)) annotation (Placement(transformation(extent={{-104,0},{-84,20}}, rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP1( redeclare package Medium = Medium, P0=2e5, - Q(start=323.48244470861454)) annotation (Placement(transformation(extent={{-104,-60},{-84,-40}}, rotation=0))); + Q(start=240.90950915749266)) annotation (Placement(transformation(extent={{-104,-60},{-84,-40}}, rotation=0))); ThermoSysPro.Fluid.PressureLosses.ControlValve valve1( redeclare package Medium = Medium, - C1(h_vol_2(start=71016.12237181116)), - C2(h_vol_2(start=70977.89042837733)), + C1(h_vol_2(start=71004.06316721764)), + C2(h_vol_1(start=70977.89042837733)), Pm(start=120690.8728732298)) annotation (Placement(transformation(extent={{-10,6},{10,26}}, rotation=0))); ThermoSysPro.Fluid.PressureLosses.ControlValve valve2( redeclare package Medium = Medium, - C1(h_vol_2(start=70921.01678153824)), + C1(h_vol_1(start=70921.01678153824)), Pm(start=118970.64778985853)) annotation (Placement(transformation(extent={{-10,-54},{10,-34}}, rotation=0))); ThermoSysPro.Fluid.PressureLosses.ControlValve valve3( redeclare package Medium = Medium, - Q(start=804.6933031325926), - Pm(start=108776.21727782265)) annotation (Placement(transformation(extent={{50,-24},{70,-4}}, rotation=0))); + Q(start=1899.9462935639633), + Pm(start=148922.95104974302, displayUnit="bar")) annotation (Placement(transformation(extent={{50,-24},{70,-4}}, rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.SinkP puitsP2(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{82,-30},{102,-10}}, rotation=0))); ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Rampe rampe2( Duration=1, @@ -34,8 +37,8 @@ model TestMixer8 Initialvalue=1, Starttime=1, Finalvalue=0.001) annotation (Placement(transformation(extent={{-30,-30},{-10,-10}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe pipe1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-80,0},{-60,20}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe pipe2(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-80,-60},{-60,-40}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.PipePressureLoss pipe1(redeclare package Medium = Medium, Pm(start=286222.6050714449, displayUnit="bar")) annotation (Placement(transformation(extent={{-80,0},{-60,20}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.PipePressureLoss pipe2(redeclare package Medium = Medium, Pm(start=199709.4772494724, displayUnit="bar")) annotation (Placement(transformation(extent={{-80,-60},{-60,-40}}, rotation=0))); ThermoSysPro.Fluid.Junctions.Mixer8 staticVolume(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-40,0},{-20,20}}, rotation=0))); ThermoSysPro.Fluid.Junctions.Mixer8 staticVolume1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{20,-30},{40,-10}}, rotation=0))); ThermoSysPro.Fluid.Junctions.Mixer8 staticVolume2(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-40,-60},{-20,-40}}, rotation=0))); diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMixer8_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMixer8_Traces.mo new file mode 100644 index 00000000..c4016de3 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMixer8_Traces.mo @@ -0,0 +1,87 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Junctions; +model TestMixer8_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam ( + extraPropertiesNames={"Trace"}, + C_nominal={0.1}, + C_default={0.2}); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP( + redeclare package Medium = Medium, + C(h_vol_2(start=71016.12237181116)), + Q(start=1659.0367844064706)) annotation (Placement(transformation(extent={{-104,0},{-84,20}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP1( + redeclare package Medium = Medium, + P0=2e5, + Q(start=240.90950915749266)) annotation (Placement(transformation(extent={{-104,-60},{-84,-40}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.ControlValve valve1( + redeclare package Medium = Medium, + C1(h_vol_2(start=71004.06316721764)), + C2(h_vol_1(start=70977.89042837733)), + Pm(start=120690.8728732298)) annotation (Placement(transformation(extent={{-10,6},{10,26}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.ControlValve valve2( + redeclare package Medium = Medium, + C1(h_vol_1(start=70921.01678153824)), + Pm(start=118970.64778985853)) annotation (Placement(transformation(extent={{-10,-54},{10,-34}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.ControlValve valve3( + redeclare package Medium = Medium, + Q(start=1899.9462935639633), + Pm(start=148922.95104974302, displayUnit="bar")) annotation (Placement(transformation(extent={{50,-24},{70,-4}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP puitsP2(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{82,-30},{102,-10}}, rotation=0))); + ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Rampe rampe2( + Duration=1, + Initialvalue=1, + Finalvalue=0.05) annotation (Placement(transformation(extent={{32,20},{52,40}}, rotation=0))); + ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Rampe rampe3( + Initialvalue=1, + Starttime=2, + Finalvalue=0.001) annotation (Placement(transformation(extent={{-30,30},{-10,50}}, rotation=0))); + ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Rampe rampe4( + Initialvalue=1, + Starttime=1, + Finalvalue=0.001) annotation (Placement(transformation(extent={{-30,-30},{-10,-10}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.PipePressureLoss pipe1(redeclare package Medium = Medium, Pm(start=286222.6050714449, displayUnit="bar")) annotation (Placement(transformation(extent={{-80,0},{-60,20}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.PipePressureLoss pipe2(redeclare package Medium = Medium, Pm(start=199709.4772494724, displayUnit="bar")) annotation (Placement(transformation(extent={{-80,-60},{-60,-40}}, rotation=0))); + ThermoSysPro.Fluid.Junctions.Mixer8 staticVolume(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-40,0},{-20,20}}, rotation=0))); + ThermoSysPro.Fluid.Junctions.Mixer8 staticVolume1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{20,-30},{40,-10}}, rotation=0))); + ThermoSysPro.Fluid.Junctions.Mixer8 staticVolume2(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-40,-60},{-20,-40}}, rotation=0))); +equation + connect(valve3.C2, puitsP2.C) annotation (Line(points={{70,-20},{82,-20}}, color={0,0,255})); + connect(rampe2.y, valve3.Ouv) annotation (Line(points={{53,30},{60,30},{60,-3}})); + connect(rampe3.y, valve1.Ouv) annotation (Line(points={{-9,40},{0,40},{0,27}})); + connect(rampe4.y, valve2.Ouv) annotation (Line(points={{-9,-20},{0,-20},{0,-33}})); + connect(sourceP.C, pipe1.C1) annotation (Line(points={{-84,10},{-80,10}}, color={0,0,255})); + connect(sourceP1.C, pipe2.C1) annotation (Line(points={{-84,-50},{-80,-50}}, color={0,0,255})); + connect(pipe1.C2, staticVolume.Ce4) annotation (Line(points={{-60,10},{-50,10},{-50,14},{-40.2,14}}, color={0,0,255})); + connect(staticVolume.Cs, valve1.C1) annotation (Line(points={{-20,10},{-10,10}}, color={0,0,255})); + connect(staticVolume1.Cs, valve3.C1) annotation (Line(points={{40,-20},{50,-20}}, color={0,0,255})); + connect(valve1.C2, staticVolume1.Ce1) annotation (Line(points={{10,10},{33,10},{33,-9.8}}, color={0,0,255})); + connect(valve2.C2, staticVolume1.Ce8) annotation (Line(points={{10,-50},{33,-50},{33,-29.9}}, color={0,0,255})); + connect(pipe2.C2, staticVolume2.Ce4) annotation (Line(points={{-60,-50},{-50,-50},{-50,-46},{-40.2,-46}}, color={0,0,255})); + connect(staticVolume2.Cs, valve2.C1) annotation (Line(points={{-20,-50},{-10,-50}}, color={0,0,255})); + annotation ( + experiment(StopTime=10), + Diagram(graphics), + Icon(graphics={ + Rectangle( + lineColor={200,200,200}, + fillColor={248,248,248}, + fillPattern=FillPattern.HorizontalCylinder, + extent={{-100.0,-100.0},{100.0,100.0}}, + radius=25.0), + Rectangle( + lineColor={128,128,128}, + extent={{-100.0,-100.0},{100.0,100.0}}, + radius=25.0), + Polygon( + origin={8.0,14.0}, + lineColor={78,138,73}, + fillColor={78,138,73}, + pattern=LinePattern.None, + fillPattern=FillPattern.Solid, + points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), + Documentation(info=" +

    Copyright © EDF 2002 - 2024

    +

    ThermoSysPro Version 4.1 +")); +end TestMixer8_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/package.order index b1e34f40..8e271344 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/package.order @@ -16,3 +16,4 @@ TestMixer3 TestMixer3_Traces TestMixer3_FlueGases TestMixer8 +TestMixer8_Traces From 8ba766f94f26995ebc63207898f0c788ebd1be87 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Mon, 7 Jul 2025 09:59:53 +0200 Subject: [PATCH 110/178] #125 Splitter3 --- .../SimpleExamples/Junctions/TestSplitter3.mo | 35 ++++++++ .../Junctions/TestSplitter3_FlueGases.mo | 41 ++++++++++ .../Junctions/TestSplitter3_Traces.mo | 38 +++++++++ .../SimpleExamples/Junctions/package.order | 3 + ThermoSysPro/Fluid/Junctions/Splitter3.mo | 80 ++++--------------- 5 files changed, 134 insertions(+), 63 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestSplitter3.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestSplitter3_FlueGases.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestSplitter3_Traces.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestSplitter3.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestSplitter3.mo new file mode 100644 index 00000000..4fec417a --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestSplitter3.mo @@ -0,0 +1,35 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Junctions; +model TestSplitter3 + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam; + ThermoSysPro.Fluid.Junctions.Splitter3 splitter3(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-16,-10},{4,10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceP1(redeclare package Medium = Medium, Q0=100) annotation (Placement(transformation(extent={{-96,-10},{-76,10}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss3(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-56,-10},{-36,10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sinkP2(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{84,30},{104,50}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sinkP3(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{84,-50},{104,-30}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss4(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{44,30},{64,50}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss5(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{44,-50},{64,-30}}, rotation=0))); + ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Constante constante1(k=0) annotation (Placement(transformation(extent={{-36,10},{-16,30}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP4(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{84,-10},{104,10}}, rotation=0))); + ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Constante constante2(k=0) annotation (Placement(transformation(extent={{-36,-30},{-16,-10}}, rotation=0))); +equation + connect(sourceP1.C, singularPressureLoss3.C1) annotation (Line(points={{-76,0},{-56,0}}, color={0,0,255})); + connect(singularPressureLoss3.C2, splitter3.Ce) annotation (Line(points={{-36,0},{-15.8,0}}, color={0,0,255})); + connect(splitter3.Cs1, singularPressureLoss4.C1) annotation (Line(points={{-2,10},{-2,40},{44,40}}, color={0,0,255})); + connect(singularPressureLoss4.C2, sinkP2.C) annotation (Line(points={{64,40},{84,40}}, color={0,0,255})); + connect(splitter3.Cs2, singularPressureLoss5.C1) annotation (Line(points={{-2,-10},{-2,-40},{44,-40}}, color={0,0,255})); + connect(singularPressureLoss5.C2, sinkP3.C) annotation (Line(points={{64,-40},{84,-40}}, color={0,0,255})); + connect(constante1.y, splitter3.Ialpha1) annotation (Line(points={{-15,20},{-10,20},{-10,6},{-5,6}})); + connect(splitter3.Cs3, sinkP4.C) annotation (Line(points={{4,0},{84,0}}, color={0,0,255})); + connect(splitter3.Ialpha2, constante2.y) annotation (Line(points={{-5,-6},{-10,-6},{-10,-20},{-15,-20}})); + annotation ( + experiment(StopTime=10), + Diagram(graphics), + Documentation(info=" +

    Copyright © EDF 2002 - 2024

    +

    ThermoSysPro Version 4.1

    +

    This model is documented in Sect. 14.8.5 of the ThermoSysPro book. +

    The results reported in the ThermoSysPro book were computed using Dymola. +")); +end TestSplitter3; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestSplitter3_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestSplitter3_FlueGases.mo new file mode 100644 index 00000000..0f66835f --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestSplitter3_FlueGases.mo @@ -0,0 +1,41 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Junctions; +model TestSplitter3_FlueGases + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.FlueGases; + ThermoSysPro.Fluid.Junctions.Splitter3 splitter3(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-16,-10},{4,10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceP1(redeclare package Medium = Medium, Q0=100, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{-96,-10},{-76,10}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss3(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-56,-10},{-36,10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sinkP2(redeclare package Medium = Medium, h0=2830566) + annotation (Placement(transformation(extent={{84,30},{104,50}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sinkP3(redeclare package Medium = Medium, h0=2830566) + annotation (Placement(transformation(extent={{84,-50},{104,-30}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss4(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{44,30},{64,50}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss5(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{44,-50},{64,-30}}, rotation=0))); + ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Constante constante1(k=0) annotation (Placement(transformation(extent={{-36,10},{-16,30}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP4(redeclare package Medium = Medium, + P0=4500000, + T0=573.15) annotation (Placement(transformation(extent={{84,-10},{104,10}}, rotation=0))); + ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Constante constante2(k=0) annotation (Placement(transformation(extent={{-36,-30},{-16,-10}}, rotation=0))); +equation + connect(sourceP1.C, singularPressureLoss3.C1) annotation (Line(points={{-76,0},{-56,0}}, color={0,0,255})); + connect(singularPressureLoss3.C2, splitter3.Ce) annotation (Line(points={{-36,0},{-15.8,0}}, color={0,0,255})); + connect(splitter3.Cs1, singularPressureLoss4.C1) annotation (Line(points={{-2,10},{-2,40},{44,40}}, color={0,0,255})); + connect(singularPressureLoss4.C2, sinkP2.C) annotation (Line(points={{64,40},{84,40}}, color={0,0,255})); + connect(splitter3.Cs2, singularPressureLoss5.C1) annotation (Line(points={{-2,-10},{-2,-40},{44,-40}}, color={0,0,255})); + connect(singularPressureLoss5.C2, sinkP3.C) annotation (Line(points={{64,-40},{84,-40}}, color={0,0,255})); + connect(constante1.y, splitter3.Ialpha1) annotation (Line(points={{-15,20},{-10,20},{-10,6},{-5,6}})); + connect(splitter3.Cs3, sinkP4.C) annotation (Line(points={{4,0},{84,0}}, color={0,0,255})); + connect(splitter3.Ialpha2, constante2.y) annotation (Line(points={{-5,-6},{-10,-6},{-10,-20},{-15,-20}})); + annotation ( + experiment(StopTime=10), + Diagram(graphics), + Documentation(info=" +

    Copyright © EDF 2002 - 2024

    +

    ThermoSysPro Version 4.1

    +

    This model is documented in Sect. 14.8.5 of the ThermoSysPro book. +

    The results reported in the ThermoSysPro book were computed using Dymola. +")); +end TestSplitter3_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestSplitter3_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestSplitter3_Traces.mo new file mode 100644 index 00000000..3da13371 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestSplitter3_Traces.mo @@ -0,0 +1,38 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Junctions; +model TestSplitter3_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam( + extraPropertiesNames={"Trace"}, + C_nominal={0.1}, + C_default={0.2}); + ThermoSysPro.Fluid.Junctions.Splitter3 splitter3(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-16,-10},{4,10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceP1(redeclare package Medium = Medium, Q0=100) annotation (Placement(transformation(extent={{-96,-10},{-76,10}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss3(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-56,-10},{-36,10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sinkP2(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{84,30},{104,50}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sinkP3(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{84,-50},{104,-30}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss4(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{44,30},{64,50}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss5(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{44,-50},{64,-30}}, rotation=0))); + ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Constante constante1(k=0) annotation (Placement(transformation(extent={{-36,10},{-16,30}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP4(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{84,-10},{104,10}}, rotation=0))); + ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Constante constante2(k=0) annotation (Placement(transformation(extent={{-36,-30},{-16,-10}}, rotation=0))); +equation + connect(sourceP1.C, singularPressureLoss3.C1) annotation (Line(points={{-76,0},{-56,0}}, color={0,0,255})); + connect(singularPressureLoss3.C2, splitter3.Ce) annotation (Line(points={{-36,0},{-15.8,0}}, color={0,0,255})); + connect(splitter3.Cs1, singularPressureLoss4.C1) annotation (Line(points={{-2,10},{-2,40},{44,40}}, color={0,0,255})); + connect(singularPressureLoss4.C2, sinkP2.C) annotation (Line(points={{64,40},{84,40}}, color={0,0,255})); + connect(splitter3.Cs2, singularPressureLoss5.C1) annotation (Line(points={{-2,-10},{-2,-40},{44,-40}}, color={0,0,255})); + connect(singularPressureLoss5.C2, sinkP3.C) annotation (Line(points={{64,-40},{84,-40}}, color={0,0,255})); + connect(constante1.y, splitter3.Ialpha1) annotation (Line(points={{-15,20},{-10,20},{-10,6},{-5,6}})); + connect(splitter3.Cs3, sinkP4.C) annotation (Line(points={{4,0},{84,0}}, color={0,0,255})); + connect(splitter3.Ialpha2, constante2.y) annotation (Line(points={{-5,-6},{-10,-6},{-10,-20},{-15,-20}})); + annotation ( + experiment(StopTime=10), + Diagram(graphics), + Documentation(info=" +

    Copyright © EDF 2002 - 2024

    +

    ThermoSysPro Version 4.1

    +

    This model is documented in Sect. 14.8.5 of the ThermoSysPro book. +

    The results reported in the ThermoSysPro book were computed using Dymola. +")); +end TestSplitter3_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/package.order index 8e271344..45759fd4 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/package.order @@ -17,3 +17,6 @@ TestMixer3_Traces TestMixer3_FlueGases TestMixer8 TestMixer8_Traces +TestSplitter3 +TestSplitter3_Traces +TestSplitter3_FlueGases diff --git a/ThermoSysPro/Fluid/Junctions/Splitter3.mo b/ThermoSysPro/Fluid/Junctions/Splitter3.mo index 92009b08..69463ee9 100644 --- a/ThermoSysPro/Fluid/Junctions/Splitter3.mo +++ b/ThermoSysPro/Fluid/Junctions/Splitter3.mo @@ -1,21 +1,15 @@ within ThermoSysPro.Fluid.Junctions; model Splitter3 "Splitter with three outlets" - extends - ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidTypeParameterInterface; extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; - + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Boolean continuous_flow_reversal=false "true: continuous flow reversal - false: discontinuous flow reversal"; parameter Boolean diffusion=false "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; - parameter IF97Region region=IF97Region.All_regions "IF97 region (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); protected parameter Units.SI.MassFlowRate gamma0=1.e-4 "Pseudo-diffusion conductance use for continuous flow reversal (active if diffusion=false and continuous_flow_reversal = true)"; - parameter Integer mode=Integer(region) - 1 "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; public Real alpha1 "Extraction coefficient for outlet 1 (<=1)"; @@ -23,11 +17,6 @@ public Units.SI.AbsolutePressure P(start=10e5) "Fluid pressure"; Units.SI.SpecificEnthalpy h(start=10e5) "Fluid specific enthalpy"; Units.SI.Temperature T "Fluid temperature"; - FluidType fluids[5] "Fluids mixing in volume"; - ThermoSysPro.Units.SI.MassFraction Xco2 "CO2 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xh2o "H20 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xo2 "O2 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xso2 "SO2 mass fraction"; Units.SI.Power Je "Thermal power diffusion from inlet e"; Units.SI.Power Js1 "Thermal power diffusion from outlet s1"; Units.SI.Power Js2 "Thermal power diffusion from outlet s2"; @@ -43,36 +32,16 @@ public Real rs3 "Value of r(Q/gamma) for outlet s3"; public - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce annotation (Placement( - transformation(extent={{-108,-10},{-88,10}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs3 annotation ( - Placement(transformation(extent={{90,-10},{110,10}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs1 annotation ( - Placement(transformation(extent={{30,90},{50,110}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs2 annotation ( - Placement(transformation(extent={{30,-110},{50,-90}}, rotation=0))); - InstrumentationAndControl.Connectors.InputReal Ialpha1 - "Extraction coefficient for outlet 1 (<=1)" - annotation (Placement(transformation(extent={{0,50},{20,70}}, rotation=0))); - InstrumentationAndControl.Connectors.InputReal Ialpha2 - "Extraction coefficient for outlet 2 (<=1)" - annotation (Placement(transformation(extent={{0,-70},{20,-50}}, rotation=0))); - InstrumentationAndControl.Connectors.OutputReal Oalpha1 - annotation (Placement(transformation(extent={{60,50},{80,70}}, rotation=0))); - InstrumentationAndControl.Connectors.OutputReal Oalpha2 - annotation (Placement(transformation(extent={{60,-70},{80,-50}}, rotation=0))); + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-108,-10},{-88,10}}, rotation=0))); + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs3(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{90,-10},{110,10}}, rotation=0))); + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{30,90},{50,110}}, rotation=0))); + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs2(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{30,-110},{50,-90}}, rotation=0))); + InstrumentationAndControl.Connectors.InputReal Ialpha1 "Extraction coefficient for outlet 1 (<=1)" annotation (Placement(transformation(extent={{0,50},{20,70}}, rotation=0))); + InstrumentationAndControl.Connectors.InputReal Ialpha2 "Extraction coefficient for outlet 2 (<=1)" annotation (Placement(transformation(extent={{0,-70},{20,-50}}, rotation=0))); + InstrumentationAndControl.Connectors.OutputReal Oalpha1 annotation (Placement(transformation(extent={{60,50},{80,70}}, rotation=0))); + InstrumentationAndControl.Connectors.OutputReal Oalpha2 annotation (Placement(transformation(extent={{60,-70},{80,-50}}, rotation=0))); equation - /* Check that incoming fluids are compatible with fluid in volume */ - fluids[1] = ftype; - fluids[2] = Ce.ftype; - fluids[3] = Cs1.ftype; - fluids[4] = Cs2.ftype; - fluids[5] = Cs3.ftype; - - assert(ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.isCompatible(fluids), - "Splitter3: fluids mixing in volume are not compatible with each other"); - /* Unconnected connectors */ if (cardinality(Ialpha1) == 0) then Ialpha1.signal = 0.3; @@ -114,29 +83,14 @@ equation Oalpha2.signal = alpha2; /* Fluid composition balance equations */ - 0 = Ce.Xco2*Ce.Q - Cs1.Xco2*Cs1.Q - Cs2.Xco2*Cs2.Q - Cs3.Xco2*Cs3.Q; - 0 = Ce.Xh2o*Ce.Q - Cs1.Xh2o*Cs1.Q - Cs2.Xh2o*Cs2.Q - Cs3.Xh2o*Cs3.Q; - 0 = Ce.Xo2*Ce.Q - Cs1.Xo2*Cs1.Q - Cs2.Xo2*Cs2.Q - Cs3.Xo2*Cs3.Q; - 0 = Ce.Xso2*Ce.Q - Cs1.Xso2*Cs1.Q - Cs2.Xso2*Cs2.Q - Cs3.Xso2*Cs3.Q; - - Cs1.ftype = ftype; - Cs2.ftype = ftype; - Cs3.ftype = ftype; - - Cs1.Xco2 = Xco2; - Cs1.Xh2o = Xh2o; - Cs1.Xo2 = Xo2; - Cs1.Xso2 = Xso2; - - Cs2.Xco2 = Xco2; - Cs2.Xh2o = Xh2o; - Cs2.Xo2 = Xo2; - Cs2.Xso2 = Xso2; + Ce.Xi*Ce.Q = Cs1.Xi*Cs1.Q + Cs2.Xi*Cs2.Q + Cs3.Xi*Cs3.Q; + Cs1.Xi = Cs2.Xi; + Cs1.Xi = Cs3.Xi; - Cs3.Xco2 = Xco2; - Cs3.Xh2o = Xh2o; - Cs3.Xo2 = Xo2; - Cs3.Xso2 = Xso2; + /* Traces composition balance equations */ + Ce.SubC*Ce.Q = Cs1.SubC*Cs1.Q + Cs2.SubC*Cs2.Q + Cs3.SubC*Cs3.Q; + Cs1.SubC = Cs2.SubC; + Cs1.SubC = Cs3.SubC; /* Flow reversal */ if continuous_flow_reversal then @@ -195,7 +149,7 @@ equation Cs3.diff_on_1 = diffusion; /* Fluid thermodynamic properties */ - T = ThermoSysPro.Properties.Fluid.Temperature_Ph(P, h, fluid, mode, Ce.Xco2, Ce.Xh2o, Ce.Xo2, Ce.Xso2); + T = Medium.temperature_phX(P, h, Ce.Xi); annotation ( Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{ 100,100}}), graphics={ From 21b74bd08d2deff747e2da0f2508e588902b6d58 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Mon, 7 Jul 2025 10:58:02 +0200 Subject: [PATCH 111/178] #125 constrainedby package for Refs --- .../Fluid/BoundaryConditions/PlugA.mo | 9 ++------ .../Fluid/BoundaryConditions/PlugB.mo | 21 ++++++------------- ThermoSysPro/Fluid/BoundaryConditions/RefP.mo | 2 +- ThermoSysPro/Fluid/BoundaryConditions/RefQ.mo | 2 +- .../Fluid/BoundaryConditions/RefSubC.mo | 2 +- ThermoSysPro/Fluid/BoundaryConditions/RefT.mo | 2 +- 6 files changed, 12 insertions(+), 26 deletions(-) diff --git a/ThermoSysPro/Fluid/BoundaryConditions/PlugA.mo b/ThermoSysPro/Fluid/BoundaryConditions/PlugA.mo index ef826aa9..426c50b4 100644 --- a/ThermoSysPro/Fluid/BoundaryConditions/PlugA.mo +++ b/ThermoSysPro/Fluid/BoundaryConditions/PlugA.mo @@ -1,10 +1,7 @@ within ThermoSysPro.Fluid.BoundaryConditions; model PlugA "Plug" - extends - ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidTypeParameterInterface; extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Boolean continuous_flow_reversal=false "true: continuous flow reversal - false: discontinuous flow reversal"; parameter Boolean diffusion=false @@ -16,7 +13,7 @@ public Units.SI.SpecificEnthalpy h(start=100000) "Fluid specific enthalpy"; - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{90,-10},{110,10}}, rotation=0))); equation @@ -27,8 +24,6 @@ equation C.diff_res_1 = 0; C.diff_on_1 = diffusion; - ftype = C.ftype; - /* Flow reversal */ if continuous_flow_reversal then C.h = ThermoSysPro.Functions.SmoothCond(C.Q*C.diff_res_2, C.h_vol_1, C.h_vol_2, 1); diff --git a/ThermoSysPro/Fluid/BoundaryConditions/PlugB.mo b/ThermoSysPro/Fluid/BoundaryConditions/PlugB.mo index d49ca0de..66fd6803 100644 --- a/ThermoSysPro/Fluid/BoundaryConditions/PlugB.mo +++ b/ThermoSysPro/Fluid/BoundaryConditions/PlugB.mo @@ -1,23 +1,17 @@ within ThermoSysPro.Fluid.BoundaryConditions; model PlugB "Plug" - extends - ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidTypeVariableInterface; extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Boolean diffusion=false "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; public Units.SI.MassFlowRate Q "Fluid mass flow rate"; Units.SI.AbsolutePressure P "Fluid pressure"; Units.SI.SpecificEnthalpy h "Fluid specific enthalpy"; - FluidType ftype "Fluid type"; - Real Xco2(start=0.01) "CO2 mass fraction of the fluid crossing the boundary of the control volume"; - Real Xh2o "H2O mass fraction of the fluid crossing the boundary of the control volume"; - Real Xo2(start=0.2) "O2 mass fraction of the fluid crossing the boundary of the control volume"; - Real Xso2(start=0) "SO2 mass fraction of the fluid crossing the boundary of the control volume"; + Medium.MassFraction X[Medium.nXi] "Fluid mass fraction"; + Medium.ExtraProperty SubC[Medium.nC] "Fluid trace substances"; - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-110,-10},{-90,10}}, rotation=0))); equation @@ -29,12 +23,9 @@ equation C.diff_res_2 = 0; C.diff_on_2 = diffusion; - ftype = C.ftype; + SubC = C.SubC; - Xco2 = C.Xco2; - Xh2o = C.Xh2o; - Xo2 = C.Xo2; - Xso2 = C.Xso2; + X = C.Xi; annotation ( Diagram(coordinateSystem( diff --git a/ThermoSysPro/Fluid/BoundaryConditions/RefP.mo b/ThermoSysPro/Fluid/BoundaryConditions/RefP.mo index 2e4128c5..636b8c97 100644 --- a/ThermoSysPro/Fluid/BoundaryConditions/RefP.mo +++ b/ThermoSysPro/Fluid/BoundaryConditions/RefP.mo @@ -1,7 +1,7 @@ within ThermoSysPro.Fluid.BoundaryConditions; model RefP "Fixed pressure reference" extends ThermoSysPro.Fluid.Interfaces.IconColors; - replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Units.SI.AbsolutePressure P0=1.e5 "Fixed fluid pressure"; diff --git a/ThermoSysPro/Fluid/BoundaryConditions/RefQ.mo b/ThermoSysPro/Fluid/BoundaryConditions/RefQ.mo index f6414019..24f40bee 100644 --- a/ThermoSysPro/Fluid/BoundaryConditions/RefQ.mo +++ b/ThermoSysPro/Fluid/BoundaryConditions/RefQ.mo @@ -1,7 +1,7 @@ within ThermoSysPro.Fluid.BoundaryConditions; model RefQ "Fixed mass flow reference" extends ThermoSysPro.Fluid.Interfaces.IconColors; - replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Units.SI.MassFlowRate Q0=10 "Fixed fluid mass flow"; diff --git a/ThermoSysPro/Fluid/BoundaryConditions/RefSubC.mo b/ThermoSysPro/Fluid/BoundaryConditions/RefSubC.mo index 98cef4fa..fb3d1752 100644 --- a/ThermoSysPro/Fluid/BoundaryConditions/RefSubC.mo +++ b/ThermoSysPro/Fluid/BoundaryConditions/RefSubC.mo @@ -1,7 +1,7 @@ within ThermoSysPro.Fluid.BoundaryConditions; model RefSubC "Fixed SubC reference" extends ThermoSysPro.Fluid.Interfaces.IconColors; - replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Medium.ExtraProperty SubC0[Medium.nC](quantity=Medium.extraPropertiesNames) = fill(0,Medium.nC) "Source trace substances" annotation (Evaluate=true, Dialog( tab="Fluid", diff --git a/ThermoSysPro/Fluid/BoundaryConditions/RefT.mo b/ThermoSysPro/Fluid/BoundaryConditions/RefT.mo index 7aeecfc4..59dbaa1c 100644 --- a/ThermoSysPro/Fluid/BoundaryConditions/RefT.mo +++ b/ThermoSysPro/Fluid/BoundaryConditions/RefT.mo @@ -1,7 +1,7 @@ within ThermoSysPro.Fluid.BoundaryConditions; model RefT "Fixed temperature reference" extends ThermoSysPro.Fluid.Interfaces.IconColors; - replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Units.SI.Temperature T0=290 "Fixed fluid temperature"; From d76135051af21b2df7408c9f461456a7eb765eb7 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Mon, 7 Jul 2025 10:58:22 +0200 Subject: [PATCH 112/178] #125 StaticDrum --- .../Fluid/BoundaryConditions/RefXgas.mo | 2 +- .../Junctions/TestStaticDrum.mo | 28 ++++ .../Junctions/TestStaticDrum_Plug.mo | 53 +++++++ .../Junctions/TestStaticDrum_Plug_Traces.mo | 56 ++++++++ .../Junctions/TestStaticDrum_Traces.mo | 29 ++++ .../SimpleExamples/Junctions/package.order | 4 + ThermoSysPro/Fluid/Junctions/StaticDrum.mo | 131 ++++++------------ 7 files changed, 211 insertions(+), 92 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestStaticDrum.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestStaticDrum_Plug.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestStaticDrum_Plug_Traces.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestStaticDrum_Traces.mo diff --git a/ThermoSysPro/Fluid/BoundaryConditions/RefXgas.mo b/ThermoSysPro/Fluid/BoundaryConditions/RefXgas.mo index b05ec942..58c289f5 100644 --- a/ThermoSysPro/Fluid/BoundaryConditions/RefXgas.mo +++ b/ThermoSysPro/Fluid/BoundaryConditions/RefXgas.mo @@ -2,7 +2,7 @@ within ThermoSysPro.Fluid.BoundaryConditions; model RefXgas "Fixed gas composition" extends ThermoSysPro.Fluid.Interfaces.IconColors; - replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Medium.ExtraProperty X0[Medium.nXi] = Medium.X_default[1:Medium.nXi] "Source mass fraction" annotation (Dialog( tab="Fluid", group="Medium")); diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestStaticDrum.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestStaticDrum.mo new file mode 100644 index 00000000..2714cbae --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestStaticDrum.mo @@ -0,0 +1,28 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Junctions; +model TestStaticDrum + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam; + ThermoSysPro.Fluid.Junctions.StaticDrum StaticDrumTh1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-54,0},{-34,20}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLossVALI1(redeclare package Medium = Medium, K=1e-4) annotation (Placement(transformation(extent={{0,-10},{20,10}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLossVALI2(redeclare package Medium = Medium, K=1e-4) annotation (Placement(transformation(extent={{-80,-50},{-60,-30}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkP1(redeclare package Medium = Medium, Q0=10) annotation (Placement(transformation(extent={{40,-10},{60,10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare package Medium = Medium, P0=100e5) annotation (Placement(transformation(extent={{-90,-90},{-70,-70}}, rotation=0))); + ThermoSysPro.Thermal.BoundaryConditions.HeatSink heatSource annotation (Placement(transformation(extent={{-80,20},{-60,40}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLossVALI3(redeclare package Medium = Medium, K=1e-4) annotation (Placement(transformation(extent={{-20,50},{0,70}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sinkP2(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{60,50},{80,70}}, rotation=0))); +equation + connect(singularPressureLossVALI2.C2, StaticDrumTh1.Ce_eco) annotation (Line(points={{-60,-40},{-48,-40},{-48,0.6}}, color={0,0,255})); + connect(singularPressureLossVALI1.C2, sinkP1.C) annotation (Line(points={{20,0},{40,0}}, color={0,0,255})); + connect(heatSource.C[1], StaticDrumTh1.Cth) annotation (Line(points={{-70,20.2},{-70,10},{-44,10}}, color={191,95,0})); + connect(StaticDrumTh1.Cs_purg, singularPressureLossVALI1.C1) annotation (Line(points={{-34.6,6.6},{-19.3,6.6},{-19.3,0},{0,0}}, color={0,0,255})); + connect(StaticDrumTh1.Cs_sur, singularPressureLossVALI3.C1) annotation (Line(points={{-40.2,19.4},{-40.2,60},{-20,60}}, color={0,0,255})); + connect(sourcePQ.C, singularPressureLossVALI2.C1) annotation (Line(points={{-70,-80},{-66,-80},{-66,-54},{-84,-54},{-84,-40},{-80,-40}}, color={0,0,0})); + connect(singularPressureLossVALI3.C2, sinkP2.C) annotation (Line(points={{0,60},{60,60}}, color={0,0,0})); + annotation ( + experiment(StopTime=1000), + Documentation(info=" +

    Copyright © EDF 2002 - 2024

    +

    ThermoSysPro Version 4.1 +")); +end TestStaticDrum; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestStaticDrum_Plug.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestStaticDrum_Plug.mo new file mode 100644 index 00000000..ad146428 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestStaticDrum_Plug.mo @@ -0,0 +1,53 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Junctions; +model TestStaticDrum_Plug + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam; + ThermoSysPro.Fluid.Junctions.StaticDrum StaticDrumTh1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-54,0},{-34,20}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLossVALI1(redeclare package Medium = Medium, K=1e-4) annotation (Placement(transformation(extent={{0,-10},{20,10}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLossVALI2(redeclare package Medium = Medium, K=1e-4) annotation (Placement(transformation(extent={{-80,-50},{-60,-30}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkP1(redeclare package Medium = Medium, Q0=10) annotation (Placement(transformation(extent={{40,-10},{60,10}}, rotation=0))); + ThermoSysPro.Thermal.BoundaryConditions.HeatSource heatSource( + option_temperature=2, + W0={2.4e8}, + T0={290}) annotation (Placement(transformation(extent={{-80,20},{-60,40}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLossVALI3(redeclare package Medium = Medium, K=1e-4) annotation (Placement(transformation(extent={{-20,50},{0,70}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sinkP2(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{60,50},{80,70}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.RefP refP(redeclare package Medium = Medium, P0=3e5) annotation (Placement(transformation(extent={{-26,-90},{-6,-70}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.RefQ refQ(redeclare package Medium = Medium, Q0=100) annotation (Placement(transformation(extent={{-56,-90},{-36,-70}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.PlugA sourcePlug(redeclare package Medium = Medium, C(h(fixed=true))) annotation (Placement(transformation(extent={{-90,-90},{-70,-70}}, rotation=0))); +equation + connect(singularPressureLossVALI2.C2, StaticDrumTh1.Ce_eco) annotation (Line(points={{-60,-40},{-60,0.6},{-48,0.6}}, color={0,0,255})); + connect(singularPressureLossVALI1.C2, sinkP1.C) annotation (Line(points={{20,0},{40,0}}, color={0,0,255})); + connect(heatSource.C[1], StaticDrumTh1.Cth) annotation (Line(points={{-70,20.2},{-70,10},{-44,10}}, color={191,95,0})); + connect(StaticDrumTh1.Cs_purg, singularPressureLossVALI1.C1) annotation (Line(points={{-34.6,6.6},{-19.3,6.6},{-19.3,0},{0,0}}, color={0,0,255})); + connect(StaticDrumTh1.Cs_sur, singularPressureLossVALI3.C1) annotation (Line(points={{-40.2,19.4},{-40.2,60},{-20,60}}, color={0,0,255})); + connect(refQ.C2, refP.C1) annotation (Line(points={{-36,-80},{-26,-80}}, color={0,0,255})); + connect(sourcePlug.C, refQ.C1) annotation (Line(points={{-70,-80},{-56,-80}}, color={0,0,255})); + connect(refP.C2, singularPressureLossVALI2.C1) annotation (Line(points={{-6,-80},{-2,-80},{-2,-56},{-84,-56},{-84,-40},{-80,-40}}, color={0,0,0})); + connect(singularPressureLossVALI3.C2, sinkP2.C) annotation (Line(points={{0,60},{60,60}}, color={0,0,0})); + annotation ( + experiment(StopTime=1000), + Icon(graphics={ + Rectangle( + lineColor={200,200,200}, + fillColor={248,248,248}, + fillPattern=FillPattern.HorizontalCylinder, + extent={{-100.0,-100.0},{100.0,100.0}}, + radius=25.0), + Rectangle( + lineColor={128,128,128}, + extent={{-100.0,-100.0},{100.0,100.0}}, + radius=25.0), + Polygon( + origin={8.0,14.0}, + lineColor={78,138,73}, + fillColor={78,138,73}, + pattern=LinePattern.None, + fillPattern=FillPattern.Solid, + points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), + Documentation(info=" +

    Copyright © EDF 2002 - 2024

    +

    ThermoSysPro Version 4.1 +")); +end TestStaticDrum_Plug; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestStaticDrum_Plug_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestStaticDrum_Plug_Traces.mo new file mode 100644 index 00000000..5da9e6d3 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestStaticDrum_Plug_Traces.mo @@ -0,0 +1,56 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Junctions; +model TestStaticDrum_Plug_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam ( + extraPropertiesNames={"Trace"}, + C_nominal={0.1}, + C_default={0.2}); + ThermoSysPro.Fluid.Junctions.StaticDrum StaticDrumTh1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-54,0},{-34,20}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLossVALI1(redeclare package Medium = Medium, K=1e-4) annotation (Placement(transformation(extent={{0,-10},{20,10}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLossVALI2(redeclare package Medium = Medium, K=1e-4) annotation (Placement(transformation(extent={{-80,-50},{-60,-30}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkP1(redeclare package Medium = Medium, Q0=10) annotation (Placement(transformation(extent={{40,-10},{60,10}}, rotation=0))); + ThermoSysPro.Thermal.BoundaryConditions.HeatSource heatSource( + option_temperature=2, + W0={2.4e8}, + T0={290}) annotation (Placement(transformation(extent={{-80,20},{-60,40}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLossVALI3(redeclare package Medium = Medium, K=1e-4) annotation (Placement(transformation(extent={{-20,50},{0,70}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sinkP2(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{60,50},{80,70}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.RefP refP(redeclare package Medium = Medium, P0=3e5) annotation (Placement(transformation(extent={{-26,-90},{-6,-70}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.RefQ refQ(redeclare package Medium = Medium, Q0=100) annotation (Placement(transformation(extent={{-56,-90},{-36,-70}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.PlugA sourcePlug(redeclare package Medium = Medium, C(h(fixed=true))) annotation (Placement(transformation(extent={{-90,-90},{-70,-70}}, rotation=0))); +equation + connect(singularPressureLossVALI2.C2, StaticDrumTh1.Ce_eco) annotation (Line(points={{-60,-40},{-60,0.6},{-48,0.6}}, color={0,0,255})); + connect(singularPressureLossVALI1.C2, sinkP1.C) annotation (Line(points={{20,0},{40,0}}, color={0,0,255})); + connect(heatSource.C[1], StaticDrumTh1.Cth) annotation (Line(points={{-70,20.2},{-70,10},{-44,10}}, color={191,95,0})); + connect(StaticDrumTh1.Cs_purg, singularPressureLossVALI1.C1) annotation (Line(points={{-34.6,6.6},{-19.3,6.6},{-19.3,0},{0,0}}, color={0,0,255})); + connect(StaticDrumTh1.Cs_sur, singularPressureLossVALI3.C1) annotation (Line(points={{-40.2,19.4},{-40.2,60},{-20,60}}, color={0,0,255})); + connect(refQ.C2, refP.C1) annotation (Line(points={{-36,-80},{-26,-80}}, color={0,0,255})); + connect(sourcePlug.C, refQ.C1) annotation (Line(points={{-70,-80},{-56,-80}}, color={0,0,255})); + connect(refP.C2, singularPressureLossVALI2.C1) annotation (Line(points={{-6,-80},{-2,-80},{-2,-56},{-84,-56},{-84,-40},{-80,-40}}, color={0,0,0})); + connect(singularPressureLossVALI3.C2, sinkP2.C) annotation (Line(points={{0,60},{60,60}}, color={0,0,0})); + annotation ( + experiment(StopTime=1000), + Icon(graphics={ + Rectangle( + lineColor={200,200,200}, + fillColor={248,248,248}, + fillPattern=FillPattern.HorizontalCylinder, + extent={{-100.0,-100.0},{100.0,100.0}}, + radius=25.0), + Rectangle( + lineColor={128,128,128}, + extent={{-100.0,-100.0},{100.0,100.0}}, + radius=25.0), + Polygon( + origin={8.0,14.0}, + lineColor={78,138,73}, + fillColor={78,138,73}, + pattern=LinePattern.None, + fillPattern=FillPattern.Solid, + points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), + Documentation(info=" +

    Copyright © EDF 2002 - 2024

    +

    ThermoSysPro Version 4.1 +")); +end TestStaticDrum_Plug_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestStaticDrum_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestStaticDrum_Traces.mo new file mode 100644 index 00000000..10270d0f --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestStaticDrum_Traces.mo @@ -0,0 +1,29 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Junctions; +model TestStaticDrum_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam ( + extraPropertiesNames={"Trace"}, + C_nominal={0.1}, + C_default={0.2}); + ThermoSysPro.Fluid.Junctions.StaticDrum StaticDrumTh1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-54,0},{-34,20}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLossVALI1(redeclare package Medium = Medium, K=1e-4) annotation (Placement(transformation(extent={{0,-10},{20,10}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLossVALI2(redeclare package Medium = Medium, K=1e-4) annotation (Placement(transformation(extent={{-80,-50},{-60,-30}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkP1(redeclare package Medium = Medium, Q0=10) annotation (Placement(transformation(extent={{40,-10},{60,10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare package Medium = Medium, P0=100e5) annotation (Placement(transformation(extent={{-90,-90},{-70,-70}}, rotation=0))); + ThermoSysPro.Thermal.BoundaryConditions.HeatSink heatSource annotation (Placement(transformation(extent={{-80,20},{-60,40}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLossVALI3(redeclare package Medium = Medium, K=1e-4) annotation (Placement(transformation(extent={{-20,50},{0,70}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sinkP2(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{60,50},{80,70}}, rotation=0))); +equation + connect(singularPressureLossVALI2.C2, StaticDrumTh1.Ce_eco) annotation (Line(points={{-60,-40},{-48,-40},{-48,0.6}}, color={0,0,255})); + connect(singularPressureLossVALI1.C2, sinkP1.C) annotation (Line(points={{20,0},{40,0}}, color={0,0,255})); + connect(heatSource.C[1], StaticDrumTh1.Cth) annotation (Line(points={{-70,20.2},{-70,10},{-44,10}}, color={191,95,0})); + connect(StaticDrumTh1.Cs_purg, singularPressureLossVALI1.C1) annotation (Line(points={{-34.6,6.6},{-19.3,6.6},{-19.3,0},{0,0}}, color={0,0,255})); + connect(StaticDrumTh1.Cs_sur, singularPressureLossVALI3.C1) annotation (Line(points={{-40.2,19.4},{-40.2,60},{-20,60}}, color={0,0,255})); + connect(sourcePQ.C, singularPressureLossVALI2.C1) annotation (Line(points={{-70,-80},{-66,-80},{-66,-54},{-84,-54},{-84,-40},{-80,-40}}, color={0,0,0})); + connect(singularPressureLossVALI3.C2, sinkP2.C) annotation (Line(points={{0,60},{60,60}}, color={0,0,0})); + annotation (experiment(StopTime=1000), Documentation(info=" +

    Copyright © EDF 2002 - 2024

    +

    ThermoSysPro Version 4.1 +")); +end TestStaticDrum_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/package.order index 45759fd4..712a41f9 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/package.order @@ -20,3 +20,7 @@ TestMixer8_Traces TestSplitter3 TestSplitter3_Traces TestSplitter3_FlueGases +TestStaticDrum +TestStaticDrum_Traces +TestStaticDrum_Plug +TestStaticDrum_Plug_Traces diff --git a/ThermoSysPro/Fluid/Junctions/StaticDrum.mo b/ThermoSysPro/Fluid/Junctions/StaticDrum.mo index 8290aaf5..d2fcb382 100644 --- a/ThermoSysPro/Fluid/Junctions/StaticDrum.mo +++ b/ThermoSysPro/Fluid/Junctions/StaticDrum.mo @@ -1,11 +1,7 @@ -within ThermoSysPro.Fluid.Junctions; +within ThermoSysPro.Fluid.Junctions; model StaticDrum "Static drum" - extends - ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.WaterSteamFluidTypeParameterInterface; extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; - + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialTwoPhaseThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Real x=1 "Vapor separation efficiency at the outlet"; parameter Boolean continuous_flow_reversal=false "true: continuous flow reversal - false: discontinuous flow reversal"; @@ -17,18 +13,14 @@ protected "Water/steam reference specific enthalpy at 0.01°C"; parameter Units.SI.MassFlowRate gamma0=1.e-4 "Pseudo-diffusion conductance use for continuous flow reversal (active if diffusion=false and continuous_flow_reversal = true)"; - parameter Integer fluid=Integer(ftype) "Fluid number"; public Units.SI.Temperature T "Fluid temperature"; Units.SI.AbsolutePressure P(start=10.e5) "Fluid pressure"; Units.SI.SpecificEnthalpy hl(start=100000) "Liquid phase specific enthalpy"; Units.SI.SpecificEnthalpy hv(start=2800000) "Gas phase specific enthalpy"; - FluidType fluids[9] "Fluids mixing in volume"; - ThermoSysPro.Units.SI.MassFraction Xco2 "CO2 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xh2o "H20 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xo2 "O2 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xso2 "SO2 mass fraction"; + Medium.MassFraction X[Medium.nXi] "Fluid mass fraction"; + Medium.ExtraProperty SubC[Medium.nC] "Fluid trace substances"; Units.SI.Power Je_steam "Thermal power diffusion from inlet e_steam"; Units.SI.Power Je_sup "Thermal power diffusion from inlet e_sup"; Units.SI.Power Je_eva "Thermal power diffusion from inlet e_eva"; @@ -56,43 +48,27 @@ public Real rs_sur "Value of r(Q/gamma) for outlet s_sur"; public - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce_eva annotation ( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce_eva(redeclare package Medium = Medium) annotation ( Placement(transformation(extent={{-104,-44},{-84,-24}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce_eco annotation ( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce_eco(redeclare package Medium = Medium) annotation ( Placement(transformation(extent={{-50,-104},{-30,-84}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs_sup annotation ( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs_sup(redeclare package Medium = Medium) annotation ( Placement(transformation(extent={{84,24},{104,44}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs_eva annotation ( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs_eva(redeclare package Medium = Medium) annotation ( Placement(transformation(extent={{30,-104},{50,-84}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs_sur annotation ( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs_sur(redeclare package Medium = Medium) annotation ( Placement(transformation(extent={{28,84},{48,104}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs_purg annotation ( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs_purg(redeclare package Medium = Medium) annotation ( Placement(transformation(extent={{84,-44},{104,-24}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce_steam annotation ( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce_steam(redeclare package Medium = Medium) annotation ( Placement(transformation(extent={{-48,84},{-28,104}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce_sup annotation ( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce_sup(redeclare package Medium = Medium) annotation ( Placement(transformation(extent={{-104,26},{-84,46}}, rotation=0))); - ThermoSysPro.Properties.WaterSteam.Common.PropThermoSat lsat - annotation (Placement(transformation(extent={{-104,66},{-78,98}}, rotation= - 0))); - ThermoSysPro.Properties.WaterSteam.Common.PropThermoSat vsat - annotation (Placement(transformation(extent={{72,68},{100,100}}, rotation=0))); Thermal.Connectors.ThermalPort Cth annotation (Placement(transformation( extent={{-10,-10},{10,10}}, rotation=0))); -equation - /* Check that incoming fluids are compatible with fluid in volume */ - fluids[1] = ftype; - fluids[2] = Ce_steam.ftype; - fluids[3] = Ce_sup.ftype; - fluids[4] = Ce_eva.ftype; - fluids[5] = Ce_eco.ftype; - fluids[6] = Cs_eva.ftype; - fluids[7] = Cs_purg.ftype; - fluids[8] = Cs_sup.ftype; - fluids[9] = Cs_sur.ftype; - - assert(ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.isCompatible(fluids), "StaticDrum: fluids mixing in volume are not compatible with each other"); + Medium.SaturationProperties sat; +equation /* Unconnected connectors */ /* Steam input */ @@ -102,11 +78,8 @@ equation Ce_steam.h_vol_1 = 1.e5; Ce_steam.diff_res_1 = 0; Ce_steam.diff_on_1 = false; - Ce_steam.ftype = ftype; - Ce_steam.Xco2 = 0; - Ce_steam.Xh2o = 0; - Ce_steam.Xo2 = 0; - Ce_steam.Xso2 = 0; + Ce_steam.Xi = Medium.X_default[1:Medium.nXi]; + Ce_steam.SubC = Medium.C_default; end if; /* Extra input */ @@ -116,11 +89,8 @@ equation Ce_sup.h_vol_1 = 1.e5; Ce_sup.diff_res_1 = 0; Ce_sup.diff_on_1 = false; - Ce_sup.ftype = ftype; - Ce_sup.Xco2 = 0; - Ce_sup.Xh2o = 0; - Ce_sup.Xo2 = 0; - Ce_sup.Xso2 = 0; + Ce_sup.Xi = Medium.X_default[1:Medium.nXi]; + Ce_sup.SubC = Medium.C_default; end if; /* Input from evaporator */ @@ -130,11 +100,8 @@ equation Ce_eva.h_vol_1 = 1.e5; Ce_eva.diff_res_1 = 0; Ce_eva.diff_on_1 = false; - Ce_eva.ftype = ftype; - Ce_eva.Xco2 = 0; - Ce_eva.Xh2o = 0; - Ce_eva.Xo2 = 0; - Ce_eva.Xso2 = 0; + Ce_eva.Xi = Medium.X_default[1:Medium.nXi]; + Ce_eva.SubC = Medium.C_default; end if; /* Input from the economizer */ @@ -144,11 +111,8 @@ equation Ce_eco.h_vol_1 = 1.e5; Ce_eco.diff_res_1 = 0; Ce_eco.diff_on_1 = false; - Ce_eco.ftype = ftype; - Ce_eco.Xco2 = 0; - Ce_eco.Xh2o = 0; - Ce_eco.Xo2 = 0; - Ce_eco.Xso2 = 0; + Ce_eco.Xi = Medium.X_default[1:Medium.nXi]; + Ce_eco.SubC = Medium.C_default; end if; /* Output to the evaporator */ @@ -210,35 +174,20 @@ equation Cs_sur.h_vol_1 = (1 - x)*hl + x*hv; /* Fluid composition balance equations */ - 0 = Ce_steam.Xco2*Ce_steam.Q + Ce_sup.Xco2*Ce_sup.Q + Ce_eva.Xco2*Ce_eva.Q + Ce_eco.Xco2*Ce_eco.Q - Cs_sur.Xco2*Cs_sur.Q - Cs_sup.Xco2*Cs_sup.Q - Cs_purg.Xco2*Cs_purg.Q - Cs_eva.Xco2*Cs_eva.Q; - 0 = Ce_steam.Xh2o*Ce_steam.Q + Ce_sup.Xh2o*Ce_sup.Q + Ce_eva.Xh2o*Ce_eva.Q + Ce_eco.Xh2o*Ce_eco.Q - Cs_sur.Xh2o*Cs_sur.Q - Cs_sup.Xh2o*Cs_sup.Q - Cs_purg.Xh2o*Cs_purg.Q - Cs_eva.Xh2o*Cs_eva.Q; - 0 = Ce_steam.Xo2*Ce_steam.Q + Ce_sup.Xo2*Ce_sup.Q + Ce_eva.Xo2*Ce_eva.Q + Ce_eco.Xo2*Ce_eco.Q - Cs_sur.Xo2*Cs_sur.Q - Cs_sup.Xo2*Cs_sup.Q - Cs_purg.Xo2*Cs_purg.Q - Cs_eva.Xo2*Cs_eva.Q; - 0 = Ce_steam.Xso2*Ce_steam.Q + Ce_sup.Xso2*Ce_sup.Q + Ce_eva.Xso2*Ce_eva.Q + Ce_eco.Xso2*Ce_eco.Q - Cs_sur.Xso2*Cs_sur.Q - Cs_sup.Xso2*Cs_sup.Q - Cs_purg.Xso2*Cs_purg.Q - Cs_eva.Xso2*Cs_eva.Q; - - Cs_eva.ftype = ftype; - Cs_purg.ftype = ftype; - Cs_sup.ftype = ftype; - Cs_sur.ftype = ftype; - - Xco2 = Cs_eva.Xco2; - Xh2o = Cs_eva.Xh2o; - Xo2 = Cs_eva.Xo2; - Xso2 = Cs_eva.Xso2; - - Xco2 = Cs_purg.Xco2; - Xh2o = Cs_purg.Xh2o; - Xo2 = Cs_purg.Xo2; - Xso2 = Cs_purg.Xso2; - - Xco2 = Cs_sup.Xco2; - Xh2o = Cs_sup.Xh2o; - Xo2 = Cs_sup.Xo2; - Xso2 = Cs_sup.Xso2; - - Xco2 = Cs_sur.Xco2; - Xh2o = Cs_sur.Xh2o; - Xo2 = Cs_sur.Xo2; - Xso2 = Cs_sur.Xso2; + fill(0,Medium.nXi) = Ce_steam.Xi*Ce_steam.Q + Ce_sup.Xi*Ce_sup.Q + Ce_eva.Xi*Ce_eva.Q + Ce_eco.Xi*Ce_eco.Q - Cs_sur.Xi*Cs_sur.Q - Cs_sup.Xi*Cs_sup.Q - Cs_purg.Xi*Cs_purg.Q - Cs_eva.Xi*Cs_eva.Q; + + X = Cs_eva.Xi; + X = Cs_purg.Xi; + X = Cs_sup.Xi; + X = Cs_sur.Xi; + + /* Traces composition balance equations */ + fill(0, Medium.nC) = Ce_steam.SubC*Ce_steam.Q + Ce_sup.SubC*Ce_sup.Q + Ce_eva.SubC*Ce_eva.Q + Ce_eco.SubC*Ce_eco.Q - Cs_sur.SubC*Cs_sur.Q - Cs_sup.SubC*Cs_sup.Q - Cs_purg.SubC*Cs_purg.Q - Cs_eva.SubC*Cs_eva.Q; + + SubC = Cs_eva.SubC; + SubC = Cs_purg.SubC; + SubC = Cs_sup.SubC; + SubC = Cs_sur.SubC; /* Flow reversal */ if continuous_flow_reversal then @@ -331,11 +280,11 @@ equation Cs_sur.diff_on_1 = diffusion; /* Fluid thermodynamic properties */ - (lsat,vsat) = ThermoSysPro.Properties.Fluid.Water_sat_P(P, fluid); + sat = Medium.setSat_p(P); - hl = lsat.h; - hv = vsat.h; - T = lsat.T; + hl = Medium.bubbleEnthalpy(sat); + hv = Medium.dewEnthalpy(sat); + T = sat.Tsat; Cth.T = T; From a68699e8e0f57a0aa7ecbc23a495c3006c5c262f Mon Sep 17 00:00:00 2001 From: VESCOVI Guilherme Date: Mon, 7 Jul 2025 14:11:11 +0200 Subject: [PATCH 113/178] Modified some values in examples --- .../SimpleExamples/Junctions/TestMixer2.mo | 12 +++++++---- .../Junctions/TestMixer2_FlueGases.mo | 12 +++++++---- .../Junctions/TestMixer2_Traces.mo | 17 ++++++++++------ .../TestLoopBreakerP_FlueGases.mo | 20 ++++++++++++------- .../LoopBreakers/TestLoopBreakerP_Traces.mo | 18 +++++++++++------ 5 files changed, 52 insertions(+), 27 deletions(-) diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMixer2.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMixer2.mo index 1c642156..03a1bcd1 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMixer2.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMixer2.mo @@ -4,13 +4,17 @@ model TestMixer2 replaceable package Medium = Properties.Media.WaterSteam; ThermoSysPro.Fluid.Junctions.Mixer2 mixer2_1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-6,-10},{14,10}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{34,-10},{54,10}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-46,10},{-26,30}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss2(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-46,-30},{-26,-10}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss(redeclare + package Medium = Medium) annotation (Placement(transformation(extent={{34,-10},{54,10}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss1(redeclare + package Medium = Medium) annotation (Placement(transformation(extent={{-46,10},{-26,30}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss2(redeclare + package Medium = Medium) annotation (Placement(transformation(extent={{-46,-30},{-26,-10}}, rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.Source sourceP(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-86,10},{-66,30}}, rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-86,-30},{-66,-10}}, rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkP(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{74,-10},{94,10}}, rotation=0))); - InstrumentationAndControl.Blocks.Sources.Constante constante(k=0) annotation (Placement(transformation(extent={{-46,-10},{-26,10}}, rotation=0))); + InstrumentationAndControl.Blocks.Sources.Constante constante(k=0.3) + annotation (Placement(transformation(extent={{-46,-10},{-26,10}}, rotation=0))); equation connect(singularPressureLoss1.C2, mixer2_1.Ce1) annotation (Line(points={{-26,20},{0,20},{0,10}}, color={0,0,255})); connect(singularPressureLoss2.C2, mixer2_1.Ce2) annotation (Line(points={{-26,-20},{0,-20},{0,-10}}, color={0,0,255})); diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMixer2_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMixer2_FlueGases.mo index 51231454..6cf34b74 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMixer2_FlueGases.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMixer2_FlueGases.mo @@ -8,9 +8,12 @@ model TestMixer2_FlueGases C_default={0.2}); ThermoSysPro.Fluid.Junctions.Mixer2 mixer2_1(redeclare package Medium = Medium, h(start=2.83057e6)) annotation (Placement(transformation(extent={{-6,-10},{14,10}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{34,-10},{54,10}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-46,10},{-26,30}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss2(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-46,-30},{-26,-10}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss(redeclare + package Medium = Medium) annotation (Placement(transformation(extent={{34,-10},{54,10}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss1(redeclare + package Medium = Medium) annotation (Placement(transformation(extent={{-46,10},{-26,30}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss2(redeclare + package Medium = Medium) annotation (Placement(transformation(extent={{-46,-30},{-26,-10}}, rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.Source sourceP(redeclare package Medium = Medium, T0=573.15, option_temperature=true) annotation (Placement(transformation(extent={{-86,10},{-66,30}}, rotation=0))); @@ -20,7 +23,8 @@ model TestMixer2_FlueGases ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkP(redeclare package Medium = Medium, T0=573.15, option_temperature=true) annotation (Placement(transformation(extent={{74,-10},{94,10}}, rotation=0))); - InstrumentationAndControl.Blocks.Sources.Constante constante(k=0) annotation (Placement(transformation(extent={{-46,-10},{-26,10}}, rotation=0))); + InstrumentationAndControl.Blocks.Sources.Constante constante(k=0.3) + annotation (Placement(transformation(extent={{-46,-10},{-26,10}}, rotation=0))); equation connect(singularPressureLoss1.C2, mixer2_1.Ce1) annotation (Line(points={{-26,20},{0,20},{0,10}}, color={0,0,255})); connect(singularPressureLoss2.C2, mixer2_1.Ce2) annotation (Line(points={{-26,-20},{0,-20},{0,-10}}, color={0,0,255})); diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMixer2_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMixer2_Traces.mo index 7aabeb2c..d9c40f25 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMixer2_Traces.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMixer2_Traces.mo @@ -7,13 +7,18 @@ model TestMixer2_Traces C_nominal={0.1}, C_default={0.2}); ThermoSysPro.Fluid.Junctions.Mixer2 mixer2_1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-6,-10},{14,10}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{34,-10},{54,10}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-46,10},{-26,30}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss2(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-46,-30},{-26,-10}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.Source sourceP(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-86,10},{-66,30}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-86,-30},{-66,-10}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss(redeclare + package Medium = Medium) annotation (Placement(transformation(extent={{34,-10},{54,10}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss1(redeclare + package Medium = Medium) annotation (Placement(transformation(extent={{-46,10},{-26,30}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss2(redeclare + package Medium = Medium) annotation (Placement(transformation(extent={{-46,-30},{-26,-10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.Source sourceP(redeclare package Medium = Medium, SubC0={10}) annotation (Placement(transformation(extent={{-86,10},{-66,30}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP1(redeclare package + Medium = Medium, SubC0={20}) annotation (Placement(transformation(extent={{-86,-30},{-66,-10}}, rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkP(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{74,-10},{94,10}}, rotation=0))); - InstrumentationAndControl.Blocks.Sources.Constante constante(k=0) annotation (Placement(transformation(extent={{-46,-10},{-26,10}}, rotation=0))); + InstrumentationAndControl.Blocks.Sources.Constante constante(k=0.3) + annotation (Placement(transformation(extent={{-46,-10},{-26,10}}, rotation=0))); equation connect(singularPressureLoss1.C2, mixer2_1.Ce1) annotation (Line(points={{-26,20},{0,20},{0,10}}, color={0,0,255})); connect(singularPressureLoss2.C2, mixer2_1.Ce2) annotation (Line(points={{-26,-20},{0,-20},{0,-10}}, color={0,0,255})); diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/LoopBreakers/TestLoopBreakerP_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/LoopBreakers/TestLoopBreakerP_FlueGases.mo index 23e929e3..f4d82256 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/LoopBreakers/TestLoopBreakerP_FlueGases.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/LoopBreakers/TestLoopBreakerP_FlueGases.mo @@ -3,21 +3,27 @@ model TestLoopBreakerP_FlueGases extends ThermoSysPro.UsersGuide.Icons.Example; replaceable package Medium = Properties.Media.FlueGases (extraPropertiesNames={"Trace"}, C_nominal={0.1}, C_default={0.2}); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare replaceable package Medium = Medium, + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare + replaceable package Medium = Medium, P0=4500000, T0=573.15, - option_temperature=true) annotation (Placement(transformation(extent={{-100,0},{-80,20}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss1(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-20,20},{0,40}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss2(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-20,-20},{0,0}}, rotation=0))); - ThermoSysPro.Fluid.Junctions.Splitter2 splitter2_1(redeclare replaceable package Medium = Medium, h(start=2.83057e6)) + option_temperature=true, SubC0={3}) annotation (Placement(transformation(extent={{-100,0},{-80,20}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss1(redeclare + replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-20,20},{0,40}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss2(redeclare + replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-20,-20},{0,0}}, rotation=0))); + ThermoSysPro.Fluid.Junctions.Splitter2 splitter2_1(redeclare replaceable + package Medium = Medium, h(start=2.83057e6)) annotation (Placement(transformation(extent={{-56,0},{-36,20}}, rotation=0))); ThermoSysPro.Fluid.Junctions.Mixer2 mixer2_1(redeclare replaceable package Medium = Medium, h(start=2.83057e6)) annotation (Placement(transformation(extent={{40,0},{60,20}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package Medium = Medium, + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package + Medium = Medium, T0=573.15, option_temperature=true) annotation (Placement(transformation(extent={{80,0},{100,20}}, rotation=0))); InstrumentationAndControl.Blocks.Sources.Constante constante(k=0.5) annotation (Placement(transformation(extent={{-80,40},{-60,60}}, rotation=0))); - ThermoSysPro.Fluid.LoopBreakers.LoopBreakerP loopBreakerP(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{10,-20},{30,0}}, rotation=0))); + ThermoSysPro.Fluid.LoopBreakers.LoopBreakerP loopBreakerP(redeclare + replaceable package Medium = Medium) annotation (Placement(transformation(extent={{10,-20},{30,0}}, rotation=0))); equation connect(sourcePQ.C, splitter2_1.Ce) annotation (Line( points={{-80,10},{-56,10}}, diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/LoopBreakers/TestLoopBreakerP_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/LoopBreakers/TestLoopBreakerP_Traces.mo index e81b1cbf..63f4c425 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/LoopBreakers/TestLoopBreakerP_Traces.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/LoopBreakers/TestLoopBreakerP_Traces.mo @@ -3,14 +3,20 @@ model TestLoopBreakerP_Traces extends ThermoSysPro.UsersGuide.Icons.Example; replaceable package Medium = Properties.Media.WaterSteam (extraPropertiesNames={"Trace"}, C_nominal={0.1}, C_default={0.2}); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-100,0},{-80,20}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss1(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-20,20},{0,40}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss2(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-20,-20},{0,0}}, rotation=0))); - ThermoSysPro.Fluid.Junctions.Splitter2 splitter2_1(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-56,0},{-36,20}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare + replaceable package Medium = Medium, SubC0={3}) annotation (Placement(transformation(extent={{-100,0},{-80,20}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss1(redeclare + replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-20,20},{0,40}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss2(redeclare + replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-20,-20},{0,0}}, rotation=0))); + ThermoSysPro.Fluid.Junctions.Splitter2 splitter2_1(redeclare replaceable + package Medium = Medium) annotation (Placement(transformation(extent={{-56,0},{-36,20}}, rotation=0))); ThermoSysPro.Fluid.Junctions.Mixer2 mixer2_1(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{40,0},{60,20}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{80,0},{100,20}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package + Medium = Medium) annotation (Placement(transformation(extent={{80,0},{100,20}}, rotation=0))); InstrumentationAndControl.Blocks.Sources.Constante constante(k=0.5) annotation (Placement(transformation(extent={{-80,40},{-60,60}}, rotation=0))); - ThermoSysPro.Fluid.LoopBreakers.LoopBreakerP loopBreakerP(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{10,-20},{30,0}}, rotation=0))); + ThermoSysPro.Fluid.LoopBreakers.LoopBreakerP loopBreakerP(redeclare + replaceable package Medium = Medium) annotation (Placement(transformation(extent={{10,-20},{30,0}}, rotation=0))); equation connect(sourcePQ.C, splitter2_1.Ce) annotation (Line( points={{-80,10},{-56,10}}, From 57d9731ea3b90fd5f05ea4567e29520ae0fac052 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Mon, 7 Jul 2025 15:22:33 +0200 Subject: [PATCH 114/178] #125 Reformat --- .../SimpleExamples/Junctions/TestMixer2.mo | 12 +++---- .../Junctions/TestMixer2_FlueGases.mo | 30 ++++++++-------- .../Junctions/TestMixer2_Traces.mo | 15 +++----- .../TestLoopBreakerP_FlueGases.mo | 34 +++++++++---------- .../LoopBreakers/TestLoopBreakerP_Traces.mo | 23 ++++++------- 5 files changed, 49 insertions(+), 65 deletions(-) diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMixer2.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMixer2.mo index 03a1bcd1..88646025 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMixer2.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMixer2.mo @@ -4,17 +4,13 @@ model TestMixer2 replaceable package Medium = Properties.Media.WaterSteam; ThermoSysPro.Fluid.Junctions.Mixer2 mixer2_1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-6,-10},{14,10}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss(redeclare - package Medium = Medium) annotation (Placement(transformation(extent={{34,-10},{54,10}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss1(redeclare - package Medium = Medium) annotation (Placement(transformation(extent={{-46,10},{-26,30}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss2(redeclare - package Medium = Medium) annotation (Placement(transformation(extent={{-46,-30},{-26,-10}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{34,-10},{54,10}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-46,10},{-26,30}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss2(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-46,-30},{-26,-10}}, rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.Source sourceP(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-86,10},{-66,30}}, rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-86,-30},{-66,-10}}, rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkP(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{74,-10},{94,10}}, rotation=0))); - InstrumentationAndControl.Blocks.Sources.Constante constante(k=0.3) - annotation (Placement(transformation(extent={{-46,-10},{-26,10}}, rotation=0))); + InstrumentationAndControl.Blocks.Sources.Constante constante(k=0.3) annotation (Placement(transformation(extent={{-46,-10},{-26,10}}, rotation=0))); equation connect(singularPressureLoss1.C2, mixer2_1.Ce1) annotation (Line(points={{-26,20},{0,20},{0,10}}, color={0,0,255})); connect(singularPressureLoss2.C2, mixer2_1.Ce2) annotation (Line(points={{-26,-20},{0,-20},{0,-10}}, color={0,0,255})); diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMixer2_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMixer2_FlueGases.mo index 6cf34b74..a89f075e 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMixer2_FlueGases.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMixer2_FlueGases.mo @@ -6,25 +6,23 @@ model TestMixer2_FlueGases extraPropertiesNames={"Trace"}, C_nominal={0.1}, C_default={0.2}); - ThermoSysPro.Fluid.Junctions.Mixer2 mixer2_1(redeclare package Medium = Medium, h(start=2.83057e6)) - annotation (Placement(transformation(extent={{-6,-10},{14,10}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss(redeclare - package Medium = Medium) annotation (Placement(transformation(extent={{34,-10},{54,10}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss1(redeclare - package Medium = Medium) annotation (Placement(transformation(extent={{-46,10},{-26,30}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss2(redeclare - package Medium = Medium) annotation (Placement(transformation(extent={{-46,-30},{-26,-10}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.Source sourceP(redeclare package Medium = Medium, + ThermoSysPro.Fluid.Junctions.Mixer2 mixer2_1(redeclare package Medium = Medium, h(start=2.83057e6)) annotation (Placement(transformation(extent={{-6,-10},{14,10}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{34,-10},{54,10}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-46,10},{-26,30}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss2(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-46,-30},{-26,-10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.Source sourceP( + redeclare package Medium = Medium, T0=573.15, - option_temperature=true) annotation (Placement(transformation(extent={{-86,10},{-66,30}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP1(redeclare package Medium = Medium, + option_temperature=true) annotation (Placement(transformation(extent={{-86,10},{-66,30}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP1( + redeclare package Medium = Medium, P0=4500000, - T0=573.15) annotation (Placement(transformation(extent={{-86,-30},{-66,-10}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkP(redeclare package Medium = Medium, + T0=573.15) annotation (Placement(transformation(extent={{-86,-30},{-66,-10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkP( + redeclare package Medium = Medium, T0=573.15, - option_temperature=true) annotation (Placement(transformation(extent={{74,-10},{94,10}}, rotation=0))); - InstrumentationAndControl.Blocks.Sources.Constante constante(k=0.3) - annotation (Placement(transformation(extent={{-46,-10},{-26,10}}, rotation=0))); + option_temperature=true) annotation (Placement(transformation(extent={{74,-10},{94,10}}, rotation=0))); + InstrumentationAndControl.Blocks.Sources.Constante constante(k=0.3) annotation (Placement(transformation(extent={{-46,-10},{-26,10}}, rotation=0))); equation connect(singularPressureLoss1.C2, mixer2_1.Ce1) annotation (Line(points={{-26,20},{0,20},{0,10}}, color={0,0,255})); connect(singularPressureLoss2.C2, mixer2_1.Ce2) annotation (Line(points={{-26,-20},{0,-20},{0,-10}}, color={0,0,255})); diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMixer2_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMixer2_Traces.mo index d9c40f25..108d702f 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMixer2_Traces.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestMixer2_Traces.mo @@ -7,18 +7,13 @@ model TestMixer2_Traces C_nominal={0.1}, C_default={0.2}); ThermoSysPro.Fluid.Junctions.Mixer2 mixer2_1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-6,-10},{14,10}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss(redeclare - package Medium = Medium) annotation (Placement(transformation(extent={{34,-10},{54,10}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss1(redeclare - package Medium = Medium) annotation (Placement(transformation(extent={{-46,10},{-26,30}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss2(redeclare - package Medium = Medium) annotation (Placement(transformation(extent={{-46,-30},{-26,-10}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{34,-10},{54,10}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-46,10},{-26,30}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss2(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-46,-30},{-26,-10}}, rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.Source sourceP(redeclare package Medium = Medium, SubC0={10}) annotation (Placement(transformation(extent={{-86,10},{-66,30}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP1(redeclare package - Medium = Medium, SubC0={20}) annotation (Placement(transformation(extent={{-86,-30},{-66,-10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP1(redeclare package Medium = Medium, SubC0={20}) annotation (Placement(transformation(extent={{-86,-30},{-66,-10}}, rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkP(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{74,-10},{94,10}}, rotation=0))); - InstrumentationAndControl.Blocks.Sources.Constante constante(k=0.3) - annotation (Placement(transformation(extent={{-46,-10},{-26,10}}, rotation=0))); + InstrumentationAndControl.Blocks.Sources.Constante constante(k=0.3) annotation (Placement(transformation(extent={{-46,-10},{-26,10}}, rotation=0))); equation connect(singularPressureLoss1.C2, mixer2_1.Ce1) annotation (Line(points={{-26,20},{0,20},{0,10}}, color={0,0,255})); connect(singularPressureLoss2.C2, mixer2_1.Ce2) annotation (Line(points={{-26,-20},{0,-20},{0,-10}}, color={0,0,255})); diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/LoopBreakers/TestLoopBreakerP_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/LoopBreakers/TestLoopBreakerP_FlueGases.mo index f4d82256..33e8eb00 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/LoopBreakers/TestLoopBreakerP_FlueGases.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/LoopBreakers/TestLoopBreakerP_FlueGases.mo @@ -2,28 +2,26 @@ within ThermoSysPro.Fluid.Examples.SimpleExamples.LoopBreakers; model TestLoopBreakerP_FlueGases extends ThermoSysPro.UsersGuide.Icons.Example; - replaceable package Medium = Properties.Media.FlueGases (extraPropertiesNames={"Trace"}, C_nominal={0.1}, C_default={0.2}); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare - replaceable package Medium = Medium, + replaceable package Medium = Properties.Media.FlueGases ( + extraPropertiesNames={"Trace"}, + C_nominal={0.1}, + C_default={0.2}); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ( + redeclare replaceable package Medium = Medium, P0=4500000, T0=573.15, - option_temperature=true, SubC0={3}) annotation (Placement(transformation(extent={{-100,0},{-80,20}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss1(redeclare - replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-20,20},{0,40}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss2(redeclare - replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-20,-20},{0,0}}, rotation=0))); - ThermoSysPro.Fluid.Junctions.Splitter2 splitter2_1(redeclare replaceable - package Medium = Medium, h(start=2.83057e6)) - annotation (Placement(transformation(extent={{-56,0},{-36,20}}, rotation=0))); - ThermoSysPro.Fluid.Junctions.Mixer2 mixer2_1(redeclare replaceable package Medium = Medium, h(start=2.83057e6)) - annotation (Placement(transformation(extent={{40,0},{60,20}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package - Medium = Medium, + option_temperature=true, + SubC0={3}) annotation (Placement(transformation(extent={{-100,0},{-80,20}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss1(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-20,20},{0,40}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss2(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-20,-20},{0,0}}, rotation=0))); + ThermoSysPro.Fluid.Junctions.Splitter2 splitter2_1(redeclare replaceable package Medium = Medium, h(start=2.83057e6)) annotation (Placement(transformation(extent={{-56,0},{-36,20}}, rotation=0))); + ThermoSysPro.Fluid.Junctions.Mixer2 mixer2_1(redeclare replaceable package Medium = Medium, h(start=2.83057e6)) annotation (Placement(transformation(extent={{40,0},{60,20}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink( + redeclare replaceable package Medium = Medium, T0=573.15, - option_temperature=true) annotation (Placement(transformation(extent={{80,0},{100,20}}, rotation=0))); + option_temperature=true) annotation (Placement(transformation(extent={{80,0},{100,20}}, rotation=0))); InstrumentationAndControl.Blocks.Sources.Constante constante(k=0.5) annotation (Placement(transformation(extent={{-80,40},{-60,60}}, rotation=0))); - ThermoSysPro.Fluid.LoopBreakers.LoopBreakerP loopBreakerP(redeclare - replaceable package Medium = Medium) annotation (Placement(transformation(extent={{10,-20},{30,0}}, rotation=0))); + ThermoSysPro.Fluid.LoopBreakers.LoopBreakerP loopBreakerP(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{10,-20},{30,0}}, rotation=0))); equation connect(sourcePQ.C, splitter2_1.Ce) annotation (Line( points={{-80,10},{-56,10}}, diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/LoopBreakers/TestLoopBreakerP_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/LoopBreakers/TestLoopBreakerP_Traces.mo index 63f4c425..3a67cdb0 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/LoopBreakers/TestLoopBreakerP_Traces.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/LoopBreakers/TestLoopBreakerP_Traces.mo @@ -2,21 +2,18 @@ within ThermoSysPro.Fluid.Examples.SimpleExamples.LoopBreakers; model TestLoopBreakerP_Traces extends ThermoSysPro.UsersGuide.Icons.Example; - replaceable package Medium = Properties.Media.WaterSteam (extraPropertiesNames={"Trace"}, C_nominal={0.1}, C_default={0.2}); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare - replaceable package Medium = Medium, SubC0={3}) annotation (Placement(transformation(extent={{-100,0},{-80,20}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss1(redeclare - replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-20,20},{0,40}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss2(redeclare - replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-20,-20},{0,0}}, rotation=0))); - ThermoSysPro.Fluid.Junctions.Splitter2 splitter2_1(redeclare replaceable - package Medium = Medium) annotation (Placement(transformation(extent={{-56,0},{-36,20}}, rotation=0))); + replaceable package Medium = Properties.Media.WaterSteam ( + extraPropertiesNames={"Trace"}, + C_nominal={0.1}, + C_default={0.2}); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare replaceable package Medium = Medium, SubC0={3}) annotation (Placement(transformation(extent={{-100,0},{-80,20}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss1(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-20,20},{0,40}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss2(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-20,-20},{0,0}}, rotation=0))); + ThermoSysPro.Fluid.Junctions.Splitter2 splitter2_1(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-56,0},{-36,20}}, rotation=0))); ThermoSysPro.Fluid.Junctions.Mixer2 mixer2_1(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{40,0},{60,20}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package - Medium = Medium) annotation (Placement(transformation(extent={{80,0},{100,20}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{80,0},{100,20}}, rotation=0))); InstrumentationAndControl.Blocks.Sources.Constante constante(k=0.5) annotation (Placement(transformation(extent={{-80,40},{-60,60}}, rotation=0))); - ThermoSysPro.Fluid.LoopBreakers.LoopBreakerP loopBreakerP(redeclare - replaceable package Medium = Medium) annotation (Placement(transformation(extent={{10,-20},{30,0}}, rotation=0))); + ThermoSysPro.Fluid.LoopBreakers.LoopBreakerP loopBreakerP(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{10,-20},{30,0}}, rotation=0))); equation connect(sourcePQ.C, splitter2_1.Ce) annotation (Line( points={{-80,10},{-56,10}}, From b432fc3bf3f1bd496edd790adc0b2f3ea159ac4a Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Thu, 7 May 2026 15:08:10 +0200 Subject: [PATCH 115/178] #125 StaticExchangerKS --- .../HeatExchangers/TestStaticExchangerKS.mo | 28 ++++++++ .../TestStaticExchangerKS_Traces.mo | 34 ++++++++++ .../HeatExchangers/package.order | 2 + .../Fluid/HeatExchangers/StaticExchangerKS.mo | 68 ++++++++----------- 4 files changed, 92 insertions(+), 40 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticExchangerKS.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticExchangerKS_Traces.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticExchangerKS.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticExchangerKS.mo new file mode 100644 index 00000000..19074313 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticExchangerKS.mo @@ -0,0 +1,28 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; +model TestStaticExchangerKS + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam; + + ThermoSysPro.Fluid.HeatExchangers.StaticExchangerKS staticExchangerKS( + redeclare package Medium_c = Medium, + redeclare package Medium_f = Medium, + K=100, + S=10, + exchanger_conf=1) annotation (Placement(transformation(extent={{-20,44},{0,64}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourcePc( + redeclare package Medium = Medium, + T0=340) annotation (Placement(transformation(extent={{-80,44},{-60,64}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourcePf(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-60,24},{-40,44}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkPc(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{40,44},{60,64}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkPf(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{20,24},{40,44}}, rotation=0))); +equation + connect(sourcePc.C, staticExchangerKS.Ec) annotation (Line(points={{-60,54},{-20,54},{-20,51}}, color={0,0,255})); + connect(sourcePf.C, staticExchangerKS.Ef) annotation (Line(points={{-40,34},{-20,34},{-20,57}}, color={0,0,255})); + connect(staticExchangerKS.Sc, sinkPc.C) annotation (Line(points={{0,51},{20,51},{20,54},{40,54}}, color={0,0,255})); + connect(staticExchangerKS.Sf, sinkPf.C) annotation (Line(points={{0,57},{6,57},{6,34},{20,34}}, color={0,0,255})); + annotation ( + experiment(StopTime=1000), + Icon(coordinateSystem(preserveAspectRatio=false)), + Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestStaticExchangerKS; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticExchangerKS_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticExchangerKS_Traces.mo new file mode 100644 index 00000000..be41268e --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticExchangerKS_Traces.mo @@ -0,0 +1,34 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; +model TestStaticExchangerKS_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam ( + extraPropertiesNames={"Trace1","Trace2","Trace3"}, + C_nominal={0.1,0.2,0.3}, + C_default={0.2,0.3,0.4}); + + ThermoSysPro.Fluid.HeatExchangers.StaticExchangerKS staticExchangerKS( + redeclare package Medium_c = Medium, + redeclare package Medium_f = Medium, + K=100, + S=10, + exchanger_conf=1) annotation (Placement(transformation(extent={{-20,44},{0,64}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourcePc( + redeclare package Medium = Medium, + T0=340, + SubC0={0.1,0.2,0.3}) annotation (Placement(transformation(extent={{-80,44},{-60,64}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourcePf( + redeclare package Medium = Medium, + SubC0={0.4,0.5,0.6}) annotation (Placement(transformation(extent={{-60,24},{-40,44}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkPc(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{40,44},{60,64}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkPf(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{20,24},{40,44}}, rotation=0))); +equation + connect(sourcePc.C, staticExchangerKS.Ec) annotation (Line(points={{-60,54},{-20,54},{-20,51}}, color={0,0,255})); + connect(sourcePf.C, staticExchangerKS.Ef) annotation (Line(points={{-40,34},{-20,34},{-20,57}}, color={0,0,255})); + connect(staticExchangerKS.Sc, sinkPc.C) annotation (Line(points={{0,51},{20,51},{20,54},{40,54}}, color={0,0,255})); + connect(staticExchangerKS.Sf, sinkPf.C) annotation (Line(points={{0,57},{6,57},{6,34},{20,34}}, color={0,0,255})); + annotation ( + experiment(StopTime=1000), + Icon(coordinateSystem(preserveAspectRatio=false)), + Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestStaticExchangerKS_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order index 2cd052a4..5fde87f5 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order @@ -1,3 +1,5 @@ TestDynamicOnePhaseFlowPipe TestDynamicOnePhaseFlowPipe_Traces TestDynamicOnePhaseFlowPipe_FlueGases +TestStaticExchangerKS +TestStaticExchangerKS_Traces diff --git a/ThermoSysPro/Fluid/HeatExchangers/StaticExchangerKS.mo b/ThermoSysPro/Fluid/HeatExchangers/StaticExchangerKS.mo index 6dc0f49e..9854ece7 100644 --- a/ThermoSysPro/Fluid/HeatExchangers/StaticExchangerKS.mo +++ b/ThermoSysPro/Fluid/HeatExchangers/StaticExchangerKS.mo @@ -1,9 +1,9 @@ within ThermoSysPro.Fluid.HeatExchangers; model StaticExchangerKS "Static heat exchanger with fixed K and S (Coefficient of heat transfer and Heat exchanger surface)" extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + replaceable package Medium_c = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model for the hot fluid" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable package Medium_f = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model for the cold fluid" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Units.SI.CoefficientOfHeatTransfer K=100 "Global heat exchange coefficient"; parameter Units.SI.Area S=10 "Heat exchange surface"; @@ -20,13 +20,9 @@ model StaticExchangerKS "Static heat exchanger with fixed K and S (Coefficient o parameter Units.SI.Density p_rhof=0 "If > 0, fixed fluid density for the cold fluid" annotation (Evaluate=true, Dialog(tab="Fluid", group="Fluid properties")); - parameter IF97Region region_c=IF97Region.All_regions "IF97 region for the hot fluid (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); - parameter IF97Region region_f=IF97Region.All_regions "IF97 region for the cold fluid (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); protected constant Units.SI.Acceleration g=Modelica.Constants.g_n "Gravity constant"; - parameter Integer mode_c=Integer(region_c) - 1 "IF97 region for the hot fluid. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; - parameter Integer mode_f=Integer(region_f) - 1 "IF97 region for the cold fluid. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; parameter Real eps=1.e-0 "Small number for pressure loss equation"; public @@ -49,22 +45,22 @@ public Units.SI.Density rhof(start=998) "Cold fluid density"; Units.SI.MassFlowRate Qc(start=100) "Mass flow rate of the hot fluid"; Units.SI.MassFlowRate Qf(start=100) "Mass flow rate of the cold fluid"; + Medium_c.MassFraction Xc[Medium_c.nXi](start=Medium_c.X_default[1:Medium_c.nXi]) "Mass fractions of the hot fluid"; + Medium_f.MassFraction Xf[Medium_f.nXi](start=Medium_f.X_default[1:Medium_f.nXi]) "Mass fractions of the cold fluid"; + Medium_c.ThermodynamicState state_c "Thermodynamic state of the hot fluid"; + Medium_f.ThermodynamicState state_f "Thermodynamic state of the cold fluid"; Real Kcor "Corrective term for the global heat exchange coefficient"; - FluidType ftype_c "Fluid type for the hot fluid"; - Integer fluid_c=Integer(ftype_c) "Fluid number for the hot fluid"; - FluidType ftype_f "Fluid type for the cold fluid"; - Integer fluid_f=Integer(ftype_f) "Fluid number for the cold fluid"; - Interfaces.Connectors.FluidOutlet Sc annotation (Placement(transformation( + Interfaces.Connectors.FluidOutlet Sc(redeclare package Medium = Medium_c) annotation (Placement(transformation( extent={{90,-40},{110,-20}}, rotation=0), iconTransformation(extent={ {90,-40},{110,-20}}))); - Interfaces.Connectors.FluidInlet Ec annotation (Placement(transformation( + Interfaces.Connectors.FluidInlet Ec(redeclare package Medium = Medium_c) annotation (Placement(transformation( extent={{-110,-40},{-90,-20}}, rotation=0), iconTransformation(extent= {{-110,-40},{-90,-20}}))); - Interfaces.Connectors.FluidInlet Ef annotation (Placement(transformation( + Interfaces.Connectors.FluidInlet Ef(redeclare package Medium = Medium_f) annotation (Placement(transformation( extent={{-110,20},{-90,40}}, rotation=0), iconTransformation(extent={ {-110,20},{-90,40}}))); - Interfaces.Connectors.FluidOutlet Sf annotation (Placement(transformation( + Interfaces.Connectors.FluidOutlet Sf(redeclare package Medium = Medium_f) annotation (Placement(transformation( extent={{90,20},{110,40}}, rotation=0), iconTransformation(extent={{ 90,20},{110,40}}))); InstrumentationAndControl.Connectors.InputReal Kcorr "K_correction" @@ -92,14 +88,8 @@ equation Sc.diff_res_1 = Ec.diff_res_1 + 1/gamma_diff_c; Ec.diff_res_2 = Sc.diff_res_2 + 1/gamma_diff_c; - Ec.ftype = Sc.ftype; - - Ec.Xco2 = Sc.Xco2; - Ec.Xh2o = Sc.Xh2o; - Ec.Xo2 = Sc.Xo2; - Ec.Xso2 = Sc.Xso2; - - ftype_c = Ec.ftype; + Ec.Xi = Sc.Xi; + Ec.SubC = Sc.SubC; Ef.Q = Sf.Q; @@ -112,17 +102,13 @@ equation Sf.diff_res_1 = Ef.diff_res_1 + 1/gamma_diff_f; Ef.diff_res_2 = Sf.diff_res_2 + 1/gamma_diff_f; - Ef.ftype = Sf.ftype; - - Ef.Xco2 = Sf.Xco2; - Ef.Xh2o = Sf.Xh2o; - Ef.Xo2 = Sf.Xo2; - Ef.Xso2 = Sf.Xso2; - - ftype_f = Ef.ftype; + Ef.Xi = Sf.Xi; + Ef.SubC = Sf.SubC; Qc = Ec.Q; Qf = Ef.Q; + Xc = Ec.Xi; + Xf = Ef.Xi; /* Presure losses */ Ec.P - Sc.P = Kc*ThermoSysPro.Functions.ThermoSquare(Qc, eps)/rhoc; @@ -149,30 +135,32 @@ equation W = Qc*(Ec.h-Sc.h); W = Qf*(Sf.h - Ef.h); - /* Fluid specific enthalpy at the inlet */ - Tef = ThermoSysPro.Properties.Fluid.Temperature_Ph(Ef.P, Ef.h, fluid_f, 0, Ef.Xco2, Ef.Xh2o, Ef.Xo2, Ef.Xso2); - Tsf = ThermoSysPro.Properties.Fluid.Temperature_Ph(Sf.P, Sf.h, fluid_f, 0, Ef.Xco2, Ef.Xh2o, Ef.Xo2, Ef.Xso2); + /* Cold fluid temperatures */ + Tef = Medium_f.temperature_phX(p=Ef.P, h=Ef.h, X=Xf); + Tsf = Medium_f.temperature_phX(p=Sf.P, h=Sf.h, X=Xf); - /* Fluid specific enthalpy at the outlet */ - Tec = ThermoSysPro.Properties.Fluid.Temperature_Ph(Ec.P, Ec.h, fluid_c, 0, Ec.Xco2, Ec.Xh2o, Ec.Xo2, Ec.Xso2); - Tsc = ThermoSysPro.Properties.Fluid.Temperature_Ph(Sc.P, Sc.h, fluid_c, 0, Ec.Xco2, Ec.Xh2o, Ec.Xo2, Ec.Xso2); + /* Hot fluid temperatures */ + Tec = Medium_c.temperature_phX(p=Ec.P, h=Ec.h, X=Xc); + Tsc = Medium_c.temperature_phX(p=Sc.P, h=Sc.h, X=Xc); /* Specific heat capacities */ - Cpf = ThermoSysPro.Properties.Fluid.SpecificHeatCapacityCp_Ph(Ef.P, Ef.h, fluid_f, 0, Ef.Xco2, Ef.Xh2o, Ef.Xo2, Ef.Xso2); - Cpc = ThermoSysPro.Properties.Fluid.SpecificHeatCapacityCp_Ph(Ec.P, Ec.h, fluid_c, 0, Ec.Xco2, Ec.Xh2o, Ec.Xo2, Ec.Xso2); + state_f = Medium_f.setState_phX(p=Ef.P, h=Ef.h, X=Xf); + state_c = Medium_c.setState_phX(p=Ec.P, h=Ec.h, X=Xc); + Cpf = Medium_f.specificHeatCapacityCp(state_f); + Cpc = Medium_c.specificHeatCapacityCp(state_c); /* Hot fluid density */ if (p_rhoc > 0) then rhoc = p_rhoc; else - rhoc = ThermoSysPro.Properties.Fluid.Density_Ph((Ec.P + Sc.P)/2,(Ec.h + Sc.h)/2, fluid_c, 0, Ec.Xco2, Ec.Xh2o, Ec.Xo2, Ec.Xso2); + rhoc = Medium_c.density_phX(p=(Ec.P + Sc.P)/2, h=(Ec.h + Sc.h)/2, X=Xc); end if; /* Cold fluid density */ if (p_rhof > 0) then rhof = p_rhof; else - rhof = ThermoSysPro.Properties.Fluid.Density_Ph((Ef.P+Sf.P)/2,(Ef.h + Sf.h)/2, fluid_f, 0, Ef.Xco2, Ef.Xh2o, Ef.Xo2, Ef.Xso2); + rhof = Medium_f.density_phX(p=(Ef.P + Sf.P)/2, h=(Ef.h + Sf.h)/2, X=Xf); end if; annotation ( From d767a9ee104180468f203065a947c26a31db270c Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Thu, 7 May 2026 15:37:19 +0200 Subject: [PATCH 116/178] #125 StaticPlateHeatExchanger --- .../TestStaticPlateHeatExchanger.mo | 38 ++++++ .../TestStaticPlateHeatExchanger_FlueGases.mo | 57 +++++++++ .../TestStaticPlateHeatExchanger_Traces.mo | 44 +++++++ .../HeatExchangers/package.order | 3 + .../StaticPlateHeatExchanger.mo | 115 +++++++----------- .../Properties/Media/WaterSteam/package.mo | 4 +- 6 files changed, 187 insertions(+), 74 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticPlateHeatExchanger.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticPlateHeatExchanger_FlueGases.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticPlateHeatExchanger_Traces.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticPlateHeatExchanger.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticPlateHeatExchanger.mo new file mode 100644 index 00000000..ac3044f3 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticPlateHeatExchanger.mo @@ -0,0 +1,38 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; +model TestStaticPlateHeatExchanger + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam; + + ThermoSysPro.Fluid.HeatExchangers.StaticPlateHeatExchanger staticPlateHeatExchanger( + redeclare package Medium_c = Medium, + redeclare package Medium_f = Medium, + Sp=2, + Ec(P(start=300000), h(start=280e3)), + Sc(P(start=100000), h(start=250e3), Q(start=1000)), + Ef(P(start=300000), h(start=70e3), Q(start=1000)), + Sf(P(start=100000), h(start=200e3)), + Tec(start=340), + Tsc(start=330), + Tef(start=290), + Tsf(start=320), + Tmc(start=335), + Tmf(start=305), + Hmc(start=270e3), + Hmf(start=140e3)) annotation (Placement(transformation(extent={{-10,30},{10,50}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourcePc( + redeclare package Medium = Medium, + T0=340) annotation (Placement(transformation(extent={{-70,30},{-50,50}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourcePf(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-50,10},{-30,30}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkPc(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{50,30},{70,50}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkPf(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{30,10},{50,30}}, rotation=0))); +equation + connect(sourcePc.C, staticPlateHeatExchanger.Ec) annotation (Line(points={{-50,40},{-10,40}}, color={0,0,255})); + connect(sourcePf.C, staticPlateHeatExchanger.Ef) annotation (Line(points={{-30,20},{-5,20},{-5,34}}, color={0,0,255})); + connect(staticPlateHeatExchanger.Sc, sinkPc.C) annotation (Line(points={{10,40},{30,40},{50,40}}, color={0,0,255})); + connect(staticPlateHeatExchanger.Sf, sinkPf.C) annotation (Line(points={{5,34},{4,34},{4,20},{30,20}}, color={0,0,255})); + annotation ( + experiment(StopTime=1000), + Icon(coordinateSystem(preserveAspectRatio=false)), + Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestStaticPlateHeatExchanger; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticPlateHeatExchanger_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticPlateHeatExchanger_FlueGases.mo new file mode 100644 index 00000000..b94ad1bd --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticPlateHeatExchanger_FlueGases.mo @@ -0,0 +1,57 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; +model TestStaticPlateHeatExchanger_FlueGases + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium_c = Properties.Media.FlueGases; + replaceable package Medium_f = Properties.Media.FlueGases; + + ThermoSysPro.Fluid.HeatExchangers.StaticPlateHeatExchanger staticPlateHeatExchanger( + redeclare package Medium_c = Medium_c, + redeclare package Medium_f = Medium_f, + Sp=2, + heat_exchange_correlation=0, + pressure_loss_correlation=0, + p_hc=100, + p_hf=100, + p_Kc=1e-4, + p_Kf=1e-4, + Ec(P(start=4500000), h(start=2879115.64844), Xi(start={0.1,0.2,0.3,0.2,0.2})), + Sc(P(start=4450000), h(start=2879115.64844), Q(start=117275.047014), Xi(start={0.1,0.2,0.3,0.2,0.2})), + Ef(P(start=300000), h(start=2879115.64844), Q(start=49585.430645), Xi(start={0.1,0.2,0.3,0.2,0.2})), + Sf(P(start=100000), h(start=2879115.64844), Xi(start={0.1,0.2,0.3,0.2,0.2})), + Tec(start=573.15), + Tsc(start=573.15), + Tef(start=573.15), + Tsf(start=573.15), + Tmc(start=573.15), + Tmf(start=573.15), + Hmc(start=2879115.64844), + Hmf(start=2879115.64844)) annotation (Placement(transformation(extent={{-10,30},{10,50}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourcePc( + redeclare package Medium = Medium_c, + P0=4500000, + T0=573.15, + X0={0.1,0.2,0.3,0.2,0.2}) annotation (Placement(transformation(extent={{-70,30},{-50,50}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourcePf( + redeclare package Medium = Medium_f, + P0=300000, + T0=573.15, + X0={0.1,0.2,0.3,0.2,0.2}) annotation (Placement(transformation(extent={{-50,10},{-30,30}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkPc( + redeclare package Medium = Medium_c, + P0=4450000, + T0=573.15) annotation (Placement(transformation(extent={{50,30},{70,50}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkPf( + redeclare package Medium = Medium_f, + P0=100000, + T0=573.15) annotation (Placement(transformation(extent={{30,10},{50,30}}, rotation=0))); +equation + connect(sourcePc.C, staticPlateHeatExchanger.Ec) annotation (Line(points={{-50,40},{-10,40}}, color={0,0,255})); + connect(sourcePf.C, staticPlateHeatExchanger.Ef) annotation (Line(points={{-30,20},{-5,20},{-5,34}}, color={0,0,255})); + connect(staticPlateHeatExchanger.Sc, sinkPc.C) annotation (Line(points={{10,40},{30,40},{50,40}}, color={0,0,255})); + connect(staticPlateHeatExchanger.Sf, sinkPf.C) annotation (Line(points={{5,34},{4,34},{4,20},{30,20}}, color={0,0,255})); + annotation ( + experiment(StopTime=1000), + Icon(coordinateSystem(preserveAspectRatio=false)), + Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestStaticPlateHeatExchanger_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticPlateHeatExchanger_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticPlateHeatExchanger_Traces.mo new file mode 100644 index 00000000..32cd71d4 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticPlateHeatExchanger_Traces.mo @@ -0,0 +1,44 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; +model TestStaticPlateHeatExchanger_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam ( + extraPropertiesNames={"Trace1","Trace2","Trace3"}, + C_nominal={0.1,0.2,0.3}, + C_default={0.2,0.3,0.4}); + + ThermoSysPro.Fluid.HeatExchangers.StaticPlateHeatExchanger staticPlateHeatExchanger( + redeclare package Medium_c = Medium, + redeclare package Medium_f = Medium, + Sp=2, + Ec(P(start=300000), h(start=280e3)), + Sc(P(start=100000), h(start=250e3), Q(start=1000)), + Ef(P(start=300000), h(start=70e3), Q(start=1000)), + Sf(P(start=100000), h(start=200e3)), + Tec(start=340), + Tsc(start=330), + Tef(start=290), + Tsf(start=320), + Tmc(start=335), + Tmf(start=305), + Hmc(start=270e3), + Hmf(start=140e3)) annotation (Placement(transformation(extent={{-10,30},{10,50}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourcePc( + redeclare package Medium = Medium, + T0=340, + SubC0={0.1,0.2,0.3}) annotation (Placement(transformation(extent={{-70,30},{-50,50}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourcePf( + redeclare package Medium = Medium, + SubC0={0.4,0.5,0.6}) annotation (Placement(transformation(extent={{-50,10},{-30,30}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkPc(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{50,30},{70,50}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkPf(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{30,10},{50,30}}, rotation=0))); +equation + connect(sourcePc.C, staticPlateHeatExchanger.Ec) annotation (Line(points={{-50,40},{-10,40}}, color={0,0,255})); + connect(sourcePf.C, staticPlateHeatExchanger.Ef) annotation (Line(points={{-30,20},{-5,20},{-5,34}}, color={0,0,255})); + connect(staticPlateHeatExchanger.Sc, sinkPc.C) annotation (Line(points={{10,40},{30,40},{50,40}}, color={0,0,255})); + connect(staticPlateHeatExchanger.Sf, sinkPf.C) annotation (Line(points={{5,34},{4,34},{4,20},{30,20}}, color={0,0,255})); + annotation ( + experiment(StopTime=1000), + Icon(coordinateSystem(preserveAspectRatio=false)), + Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestStaticPlateHeatExchanger_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order index 5fde87f5..7ac2d229 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order @@ -3,3 +3,6 @@ TestDynamicOnePhaseFlowPipe_Traces TestDynamicOnePhaseFlowPipe_FlueGases TestStaticExchangerKS TestStaticExchangerKS_Traces +TestStaticPlateHeatExchanger +TestStaticPlateHeatExchanger_Traces +TestStaticPlateHeatExchanger_FlueGases diff --git a/ThermoSysPro/Fluid/HeatExchangers/StaticPlateHeatExchanger.mo b/ThermoSysPro/Fluid/HeatExchangers/StaticPlateHeatExchanger.mo index 4b15b7d3..578799c8 100644 --- a/ThermoSysPro/Fluid/HeatExchangers/StaticPlateHeatExchanger.mo +++ b/ThermoSysPro/Fluid/HeatExchangers/StaticPlateHeatExchanger.mo @@ -1,9 +1,9 @@ within ThermoSysPro.Fluid.HeatExchangers; model StaticPlateHeatExchanger "Static plate heat exchanger" extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + replaceable package Medium_c = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model for the hot fluid" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable package Medium_f = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model for the cold fluid" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Units.SI.ThermalConductivity lambdam=15.0 "Metal thermal conductivity"; parameter Units.SI.CoefficientOfHeatTransfer p_hc=6000 @@ -29,12 +29,6 @@ model StaticPlateHeatExchanger "Static plate heat exchanger" parameter Units.SI.Density p_rhof=0 "If > 0, fixed fluid density for the cold fluid" annotation (Evaluate=true, Dialog(tab="Fluid", group="Fluid properties")); - parameter IF97Region region_c=IF97Region.All_regions "IF97 region for the hot fluid (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); - parameter IF97Region region_f=IF97Region.All_regions "IF97 region for the cold fluid (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); - -protected - parameter Integer mode_c=Integer(region_c) - 1 "IF97 region for the hot fluid. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; - parameter Integer mode_f=Integer(region_f) - 1 "IF97 region for the cold fluid. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; public Units.SI.Power W "Thermal power exchanged between the two sides"; @@ -82,37 +76,24 @@ public "Hot fluid average specific enthalpy"; Units.SI.SpecificEnthalpy Hmf(start=100000) "Cold fluid average specific enthalpy"; - FluidType ftype_c "Fluid type for the hot fluid"; - Integer fluid_c=Integer(ftype_c) "Fluid number for the hot fluid"; - FluidType ftype_f "Fluid type for the cold fluid"; - Integer fluid_f=Integer(ftype_f) "Fluid number for the cold fluid"; + Medium_c.MassFraction Xc[Medium_c.nXi](start=Medium_c.X_default[1:Medium_c.nXi]) "Mass fractions of the hot fluid"; + Medium_f.MassFraction Xf[Medium_f.nXi](start=Medium_f.X_default[1:Medium_f.nXi]) "Mass fractions of the cold fluid"; + Medium_c.ThermodynamicState state_c "Average thermodynamic state of the hot fluid"; + Medium_f.ThermodynamicState state_f "Average thermodynamic state of the cold fluid"; + Medium_c.ThermodynamicState state_ce "Thermodynamic state of the hot fluid at the inlet"; + Medium_c.ThermodynamicState state_cs "Thermodynamic state of the hot fluid at the outlet"; + Medium_f.ThermodynamicState state_fe "Thermodynamic state of the cold fluid at the inlet"; + Medium_f.ThermodynamicState state_fs "Thermodynamic state of the cold fluid at the outlet"; public - Interfaces.Connectors.FluidInlet Ec annotation (Placement(transformation( + Interfaces.Connectors.FluidInlet Ec(redeclare package Medium = Medium_c) annotation (Placement(transformation( extent={{-110,-10},{-90,10}}, rotation=0))); - Interfaces.Connectors.FluidInlet Ef annotation (Placement(transformation( + Interfaces.Connectors.FluidInlet Ef(redeclare package Medium = Medium_f) annotation (Placement(transformation( extent={{-60,-70},{-40,-50}}, rotation=0))); - Interfaces.Connectors.FluidOutlet Sf annotation (Placement(transformation( + Interfaces.Connectors.FluidOutlet Sf(redeclare package Medium = Medium_f) annotation (Placement(transformation( extent={{40,-70},{60,-50}}, rotation=0))); - Interfaces.Connectors.FluidOutlet Sc annotation (Placement(transformation( + Interfaces.Connectors.FluidOutlet Sc(redeclare package Medium = Medium_c) annotation (Placement(transformation( extent={{90,-8},{110,12}}, rotation=0))); - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph proce - annotation (Placement(transformation(extent={{-60,80},{-40,100}}, rotation= - 0))); - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph procs - annotation (Placement(transformation(extent={{-20,80},{0,100}}, rotation=0))); - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph profe - annotation (Placement(transformation(extent={{-60,-100},{-40,-80}}, - rotation=0))); - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph profs - annotation (Placement(transformation(extent={{-20,-100},{0,-80}}, rotation= - 0))); - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph proc - annotation (Placement(transformation(extent={{-100,80},{-80,100}}, rotation= - 0))); - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph prof - annotation (Placement(transformation(extent={{-100,-100},{-80,-80}}, - rotation=0))); equation /* Mass flow rates */ @@ -127,14 +108,8 @@ equation Sc.diff_res_1 = Ec.diff_res_1 + 1/gamma_diff_c; Ec.diff_res_2 = Sc.diff_res_2 + 1/gamma_diff_c; - Ec.ftype = Sc.ftype; - - Ec.Xco2 = Sc.Xco2; - Ec.Xh2o = Sc.Xh2o; - Ec.Xo2 = Sc.Xo2; - Ec.Xso2 = Sc.Xso2; - - ftype_c = Ec.ftype; + Ec.Xi = Sc.Xi; + Ec.SubC = Sc.SubC; Ef.Q = Sf.Q; @@ -147,17 +122,13 @@ equation Sf.diff_res_1 = Ef.diff_res_1 + 1/gamma_diff_f; Ef.diff_res_2 = Sf.diff_res_2 + 1/gamma_diff_f; - Ef.ftype = Sf.ftype; - - Ef.Xco2 = Sf.Xco2; - Ef.Xh2o = Sf.Xh2o; - Ef.Xo2 = Sf.Xo2; - Ef.Xso2 = Sf.Xso2; - - ftype_f = Ef.ftype; + Ef.Xi = Sf.Xi; + Ef.SubC = Sf.SubC; Qc = Ec.Q; Qf = Ef.Q; + Xc = Ec.Xi; + Xf = Ef.Xi; /* Pressures */ Sc.P = if Qc > 0 then Ec.P - DPc else Ec.P + DPc; @@ -168,13 +139,13 @@ equation W = K*S*DTm; if (abs(Qc) > 1.e-3) then - W = Qc*proc.cp*(Tec - Tsc); + W = Qc*Medium_c.specificHeatCapacityCp(state_c)*(Tec - Tsc); else Tec = Tsc; end if; if (abs(Qf) > 1.e-3) then - W = Qf*prof.cp*(Tsf - Tef); + W = Qf*Medium_f.specificHeatCapacityCp(state_f)*(Tsf - Tef); else Tef = Tsf; end if; @@ -214,8 +185,8 @@ equation hc = p_hc; hf = p_hf; elseif (heat_exchange_correlation == 1) then - hc = noEvent(if (qmc < 1.e-3) then 0 else 11.245*qmc^0.8*abs(muc*proc.cp/lambdac)^0.4*lambdac); - hf = noEvent(if (qmf < 1.e-3) then 0 else 11.245*qmf^0.8*abs(muf*prof.cp/lambdaf)^0.4*lambdaf); + hc = noEvent(if (qmc < 1.e-3) then 0 else 11.245*qmc^0.8*abs(muc*Medium_c.specificHeatCapacityCp(state_c)/lambdac)^0.4*lambdac); + hf = noEvent(if (qmf < 1.e-3) then 0 else 11.245*qmf^0.8*abs(muf*Medium_f.specificHeatCapacityCp(state_f)/lambdaf)^0.4*lambdaf); else hc = 0; hf = 0; @@ -245,41 +216,41 @@ equation Hmc = (Ec.h + Sc.h)/2; Hmf = (Ef.h + Sf.h)/2; - proc = ThermoSysPro.Properties.Fluid.Ph(Pmc, Hmc, mode_c, fluid_c); - prof = ThermoSysPro.Properties.Fluid.Ph(Pmf, Hmf, mode_f, fluid_f); + state_c = Medium_c.setState_phX(p=Pmc, h=Hmc, X=Xc); + state_f = Medium_f.setState_phX(p=Pmf, h=Hmf, X=Xf); - Tmc = proc.T; - Tmf = prof.T; + Tmc = Medium_c.temperature(state_c); + Tmf = Medium_f.temperature(state_f); if (p_rhoc > 0) then rhoc = p_rhoc; else - rhoc = proc.d; + rhoc = Medium_c.density(state_c); end if; if (p_rhof > 0) then rhof = p_rhof; else - rhof = prof.d; + rhof = Medium_f.density(state_f); end if; - muc = ThermoSysPro.Properties.Fluid.DynamicViscosity_rhoT(rhoc, Tmc, fluid_c); - muf = ThermoSysPro.Properties.Fluid.DynamicViscosity_rhoT(rhof, Tmf, fluid_f); + muc = Medium_c.dynamicViscosity(state_c); + muf = Medium_f.dynamicViscosity(state_f); - lambdac = ThermoSysPro.Properties.Fluid.ThermalConductivity_rhoT(rhoc, Tmc, Pmc, 0, fluid_c); - lambdaf = ThermoSysPro.Properties.Fluid.ThermalConductivity_rhoT(rhof, Tmf, Pmf, 0, fluid_f); + lambdac = Medium_c.thermalConductivity(state_c); + lambdaf = Medium_f.thermalConductivity(state_f); - /* Calcul des températures en entrée et en sortie de l'échangeur */ - proce = ThermoSysPro.Properties.Fluid.Ph(Ec.P, Ec.h, mode_c, fluid_c); - procs = ThermoSysPro.Properties.Fluid.Ph(Sc.P, Sc.h, mode_c, fluid_f); + /* Fluid temperatures at the inlet and outlet of the exchanger */ + state_ce = Medium_c.setState_phX(p=Ec.P, h=Ec.h, X=Xc); + state_cs = Medium_c.setState_phX(p=Sc.P, h=Sc.h, X=Xc); - profe = ThermoSysPro.Properties.Fluid.Ph(Ef.P, Ef.h, mode_f, fluid_c); - profs = ThermoSysPro.Properties.Fluid.Ph(Sf.P, Sf.h, mode_f, fluid_f); + state_fe = Medium_f.setState_phX(p=Ef.P, h=Ef.h, X=Xf); + state_fs = Medium_f.setState_phX(p=Sf.P, h=Sf.h, X=Xf); - Tec = proce.T; - Tsc = procs.T; - Tef = profe.T; - Tsf = profs.T; + Tec = Medium_c.temperature(state_ce); + Tsc = Medium_c.temperature(state_cs); + Tef = Medium_f.temperature(state_fe); + Tsf = Medium_f.temperature(state_fs); annotation ( Icon(coordinateSystem( diff --git a/ThermoSysPro/Properties/Media/WaterSteam/package.mo b/ThermoSysPro/Properties/Media/WaterSteam/package.mo index 12e82bc9..31a51406 100644 --- a/ThermoSysPro/Properties/Media/WaterSteam/package.mo +++ b/ThermoSysPro/Properties/Media/WaterSteam/package.mo @@ -114,11 +114,11 @@ package WaterSteam "1 - Water/steam properties library (IAPWS-IF97)" d=density_ph( p, h, - region=Region), + region=region), T=temperature_ph( p, h, - region=Region), + region=region), phase=if region == 0 then 0 else if region==4 then 2 else 1, h=h, p=p); From 5c83340ee535ac2c65c8aeeca6fed2ed4b7ddd79 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Thu, 7 May 2026 16:02:59 +0200 Subject: [PATCH 117/178] #125 SimpleDynamicCondenser --- .../TestSimpleDynamicCondenser.mo | 65 +++++++++ .../TestSimpleDynamicCondenser_Traces.mo | 70 +++++++++ .../HeatExchangers/package.order | 2 + .../HeatExchangers/SimpleDynamicCondenser.mo | 134 +++++++----------- 4 files changed, 189 insertions(+), 82 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestSimpleDynamicCondenser.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestSimpleDynamicCondenser_Traces.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestSimpleDynamicCondenser.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestSimpleDynamicCondenser.mo new file mode 100644 index 00000000..4b33034f --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestSimpleDynamicCondenser.mo @@ -0,0 +1,65 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; +model TestSimpleDynamicCondenser + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; + + ThermoSysPro.Fluid.BoundaryConditions.SinkP puitsPCaloporteur( + redeclare package Medium = Medium, + P0=1e5, + option_temperature=false) annotation (Placement(transformation(extent={{48,30},{88,70}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss PerteChargeCondPompe( + redeclare package Medium = Medium, + K=1e-6, + Q(start=0.598447)) annotation (Placement(transformation(origin={-90,-38}, extent={{-10,-10},{10,10}}, rotation=180))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP SourceRechauffeurEau( + redeclare package Medium = Medium, + option_temperature=false, + h0=2401e3, + P0=15050) annotation (Placement(transformation(extent={{-207,148},{-183,170}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkQ PuitsRechauffeurEau( + redeclare package Medium = Medium, + h0=191812, + Q0=192) annotation (Placement(transformation(extent={{-184,-52},{-208,-24}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourcePCaloporteur( + redeclare package Medium = Medium, + Q0=29804.5, + h0=113e3) annotation (Placement(transformation(extent={{-212,30},{-172,68}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss PerteChargeCondPompe1( + redeclare package Medium = Medium, + K=1e-6) annotation (Placement(transformation(origin={36,50}, extent={{6,-10},{-6,10}}, rotation=180))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss PerteChargeCondPompe2( + redeclare package Medium = Medium, + K=1e-6) annotation (Placement(transformation(origin={-154,49}, extent={{6,-10},{-6,10}}, rotation=180))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss PerteChargeCondPompe3( + redeclare package Medium = Medium, + K(fixed=false)=1e-3, + Q(start=192, fixed=true)) + annotation (Placement(transformation(origin={-120,159}, extent={{10,-10},{-10,10}}, rotation=180))); + ThermoSysPro.Fluid.HeatExchangers.SimpleDynamicCondenser Condenseur( + redeclare package Medium = Medium, + redeclare package Medium_Cooling = Medium, + D=0.018, + V=1000, + A=100, + lambda=0.01, + ntubes=28700, + continuous_flow_reversal=true, + yNiveau(signal(fixed=false, start=1.5)), + Vf0=0.15, + steady_state=false, + P(fixed=false, start=10000)) annotation (Placement(transformation(extent={{-118,6},{1,116}}, rotation=0))); +equation + connect(sourcePCaloporteur.C, PerteChargeCondPompe2.C1) annotation (Line(points={{-172,49},{-160,49}}, color={0,0,255})); + connect(PerteChargeCondPompe1.C2, puitsPCaloporteur.C) annotation (Line(points={{42,50},{48,50}}, color={0,0,255})); + connect(SourceRechauffeurEau.C, PerteChargeCondPompe3.C1) annotation (Line(points={{-183,159},{-130,159}}, color={0,0,255})); + connect(PuitsRechauffeurEau.C, PerteChargeCondPompe.C2) annotation (Line(points={{-184,-38},{-100,-38}})); + connect(PerteChargeCondPompe2.C2, Condenseur.Cee) annotation (Line(points={{-148,49},{-133,49},{-133,48.9},{-118,48.9}}, color={0,0,255})); + connect(PerteChargeCondPompe.C1, Condenseur.Cl) annotation (Line(points={{-80,-38},{-57.31,-38},{-57.31,6}})); + connect(PerteChargeCondPompe3.C2, Condenseur.Cv) annotation (Line(points={{-110,159},{-58.5,159},{-58.5,116}}, color={0,0,255})); + connect(PerteChargeCondPompe1.C1, Condenseur.Cse) annotation (Line(points={{30,50},{15.5,50},{15.5,50},{1,50}})); + annotation ( + experiment(StopTime=1000), + Icon(coordinateSystem(preserveAspectRatio=false)), + Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-250,-60},{130,180}}))); +end TestSimpleDynamicCondenser; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestSimpleDynamicCondenser_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestSimpleDynamicCondenser_Traces.mo new file mode 100644 index 00000000..8846a345 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestSimpleDynamicCondenser_Traces.mo @@ -0,0 +1,70 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; +model TestSimpleDynamicCondenser_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam( + extraPropertiesNames={"Trace1", "Trace2"}, + C_nominal={0.1, 2}, + C_default={0.2, 5}); + + ThermoSysPro.Fluid.BoundaryConditions.SinkP puitsPCaloporteur( + redeclare package Medium = Medium, + P0=1e5, + option_temperature=false) annotation (Placement(transformation(extent={{48,30},{88,70}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss PerteChargeCondPompe( + redeclare package Medium = Medium, + K=1e-6, + Q(start=0.598447)) annotation (Placement(transformation(origin={-90,-38}, extent={{-10,-10},{10,10}}, rotation=180))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP SourceRechauffeurEau( + redeclare package Medium = Medium, + option_temperature=false, + h0=2401e3, + P0=15050, + SubC0={10,20}) annotation (Placement(transformation(extent={{-207,148},{-183,170}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkQ PuitsRechauffeurEau( + redeclare package Medium = Medium, + h0=191812, + Q0=192) annotation (Placement(transformation(extent={{-184,-52},{-208,-24}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourcePCaloporteur( + redeclare package Medium = Medium, + Q0=29804.5, + h0=113e3, + SubC0={10,20}) annotation (Placement(transformation(extent={{-212,30},{-172,68}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss PerteChargeCondPompe1( + redeclare package Medium = Medium, + K=1e-6) annotation (Placement(transformation(origin={36,50}, extent={{6,-10},{-6,10}}, rotation=180))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss PerteChargeCondPompe2( + redeclare package Medium = Medium, + K=1e-6) annotation (Placement(transformation(origin={-154,49}, extent={{6,-10},{-6,10}}, rotation=180))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss PerteChargeCondPompe3( + redeclare package Medium = Medium, + K(fixed=false)=1e-3, + Q(start=192, fixed=true)) + annotation (Placement(transformation(origin={-120,159}, extent={{10,-10},{-10,10}}, rotation=180))); + ThermoSysPro.Fluid.HeatExchangers.SimpleDynamicCondenser Condenseur( + redeclare package Medium = Medium, + redeclare package Medium_Cooling = Medium, + D=0.018, + V=1000, + A=100, + lambda=0.01, + ntubes=28700, + continuous_flow_reversal=true, + yNiveau(signal(fixed=false, start=1.5)), + Vf0=0.15, + steady_state=false, + P(fixed=false, start=10000)) annotation (Placement(transformation(extent={{-118,6},{1,116}}, rotation=0))); +equation + connect(sourcePCaloporteur.C, PerteChargeCondPompe2.C1) annotation (Line(points={{-172,49},{-160,49}}, color={0,0,255})); + connect(PerteChargeCondPompe1.C2, puitsPCaloporteur.C) annotation (Line(points={{42,50},{48,50}}, color={0,0,255})); + connect(SourceRechauffeurEau.C, PerteChargeCondPompe3.C1) annotation (Line(points={{-183,159},{-130,159}}, color={0,0,255})); + connect(PuitsRechauffeurEau.C, PerteChargeCondPompe.C2) annotation (Line(points={{-184,-38},{-100,-38}})); + connect(PerteChargeCondPompe2.C2, Condenseur.Cee) annotation (Line(points={{-148,49},{-133,49},{-133,48.9},{-118,48.9}}, color={0,0,255})); + connect(PerteChargeCondPompe.C1, Condenseur.Cl) annotation (Line(points={{-80,-38},{-57.31,-38},{-57.31,6}})); + connect(PerteChargeCondPompe3.C2, Condenseur.Cv) annotation (Line(points={{-110,159},{-58.5,159},{-58.5,116}}, color={0,0,255})); + connect(PerteChargeCondPompe1.C1, Condenseur.Cse) annotation (Line(points={{30,50},{15.5,50},{15.5,50},{1,50}})); + annotation ( + experiment(StopTime=1000), + Icon(coordinateSystem(preserveAspectRatio=false)), + Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-250,-60},{130,180}}))); +end TestSimpleDynamicCondenser_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order index 7ac2d229..62b11eb0 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order @@ -6,3 +6,5 @@ TestStaticExchangerKS_Traces TestStaticPlateHeatExchanger TestStaticPlateHeatExchanger_Traces TestStaticPlateHeatExchanger_FlueGases +TestSimpleDynamicCondenser +TestSimpleDynamicCondenser_Traces diff --git a/ThermoSysPro/Fluid/HeatExchangers/SimpleDynamicCondenser.mo b/ThermoSysPro/Fluid/HeatExchangers/SimpleDynamicCondenser.mo index 43bf0d62..809e9dac 100644 --- a/ThermoSysPro/Fluid/HeatExchangers/SimpleDynamicCondenser.mo +++ b/ThermoSysPro/Fluid/HeatExchangers/SimpleDynamicCondenser.mo @@ -1,10 +1,9 @@ within ThermoSysPro.Fluid.HeatExchangers; model SimpleDynamicCondenser "Simple dynamic condenser" - extends - ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.WaterSteamFluidTypeParameterInterface; extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.WaterSteam "Medium model for the condenser cavity" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable package Medium_Cooling = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.WaterSteam "Medium model for the cooling pipes" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Units.SI.Volume V=1 "Cavity volume"; parameter Units.SI.Area A=1 "Cavity cross-sectional area"; @@ -35,13 +34,10 @@ model SimpleDynamicCondenser "Simple dynamic condenser" steady_state)); parameter Boolean continuous_flow_reversal=false "true: continuous flow reversal - false: discontinuous flow reversal"; parameter Boolean diffusion=false "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; - parameter IF97Region region=IF97Region.All_regions "IF97 region for the pipes (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); protected constant Units.SI.Acceleration g=Modelica.Constants.g_n "Gravity constant"; constant Real pi=Modelica.Constants.pi "pi"; - parameter Integer fluid_c=Integer(ftype) "Fluid number in the cavity"; - parameter Integer mode=Integer(region) - 1 "IF97 region for the pipes. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; parameter Units.SI.MassFlowRate gamma0=1.e-4 "Pseudo-diffusion conductance use for continuous flow reversal (active if diffusion=false and continuous_flow_reversal = true)"; parameter Real eps=1.e-0 "Small number for pressure loss equation"; @@ -102,37 +98,25 @@ public Real rl "Value of r(Q/gamma) for outlet Cl"; Units.SI.MassFlowRate gamma_diff(start=1.e-4) "Diffusion conductance in the pipes"; - FluidType ftype_p "Fluid type in the pipes"; - Integer fluid_p=Integer(ftype_p) "Fluid number in the pipes"; - - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph prol - "Propriétés de l'eau dans le ballon" annotation (Placement(transformation( - extent={{-100,80},{-80,100}}, rotation=0))); - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph prov - "Propriétés de la vapeur dans le ballon" annotation (Placement( - transformation(extent={{80,80},{100,100}}, rotation=0))); - ThermoSysPro.Properties.WaterSteam.Common.PropThermoSat lsat - annotation (Placement(transformation(extent={{-30,40},{-10,60}}, rotation=0))); - ThermoSysPro.Properties.WaterSteam.Common.PropThermoSat vsat - annotation (Placement(transformation( - extent={{10,40},{30,60}}, rotation=0))); - Interfaces.Connectors.FluidInlet Cv annotation (Placement(transformation( + Medium.MassFraction X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Mass fractions in the condenser cavity"; + Medium_Cooling.MassFraction Xp[Medium_Cooling.nXi](start=Medium_Cooling.X_default[1:Medium_Cooling.nXi]) "Mass fractions in the cooling pipes"; + Medium.ThermodynamicState state_l "Liquid phase thermodynamic state in the cavity"; + Medium.ThermodynamicState state_v "Vapor phase thermodynamic state in the cavity"; + Medium.ThermodynamicState state_d "Outlet liquid thermodynamic state"; + Medium_Cooling.ThermodynamicState state_e "Average cooling pipe thermodynamic state"; + Medium.SaturationProperties sat "Saturation properties in the cavity"; + + Interfaces.Connectors.FluidInlet Cv(redeclare package Medium = Medium) annotation (Placement(transformation( extent={{-10,90},{10,110}}, rotation=0))); - Interfaces.Connectors.FluidOutlet Cl annotation (Placement(transformation( + Interfaces.Connectors.FluidOutlet Cl(redeclare package Medium = Medium) annotation (Placement(transformation( extent={{-8,-110},{12,-90}}, rotation=0))); ThermoSysPro.InstrumentationAndControl.Connectors.OutputReal yNiveau annotation (Placement( transformation(extent={{100,-82},{120,-62}}, rotation=0))); public - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph prod - annotation (Placement(transformation(extent={{-60,20},{-40,40}}, rotation=0))); -public - Interfaces.Connectors.FluidInlet Cee annotation (Placement(transformation( + Interfaces.Connectors.FluidInlet Cee(redeclare package Medium = Medium_Cooling) annotation (Placement(transformation( extent={{-110,-32},{-90,-12}}, rotation=0))); - Interfaces.Connectors.FluidOutlet Cse annotation (Placement(transformation( + Interfaces.Connectors.FluidOutlet Cse(redeclare package Medium = Medium_Cooling) annotation (Placement(transformation( extent={{90,-30},{110,-10}}, rotation=0))); - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph proe - "Propriétés de l'eau " annotation (Placement( - transformation(extent={{40,20},{60,40}}, rotation=0))); initial equation if dynamic_energy_balance then if steady_state then @@ -141,8 +125,8 @@ initial equation der(Vl) = 0; der(P) = 0; else - hl = lsat.h; - hv = vsat.h; + hl = Medium.bubbleEnthalpy(Medium.setSat_p(P0)); + hv = Medium.dewEnthalpy(Medium.setSat_p(P0)); Vl = Vf0*V; P = P0; end if; @@ -150,9 +134,6 @@ initial equation equation - /* Check that the fluid type for the cooling pipe is water/steam */ - assert((ftype_p == FluidType.WaterSteam) or (ftype_p == FluidType.WaterSteamSimple), "SimpleDynamicCondenser: the fluid type for the cooling pipe must be water/steam"); - /* Unconnected connectors */ if (cardinality(Cv) == 0) then Cv.Q = 0; @@ -160,11 +141,8 @@ equation Cv.h_vol_1 = 1.e5; Cv.diff_res_1 = 0; Cv.diff_on_1 = false; - Cv.ftype = ftype; - Cv.Xco2 = 0; - Cv.Xh2o = 0; - Cv.Xo2 = 0; - Cv.Xso2 = 0; + Cv.Xi = Medium.X_default[1:Medium.nXi]; + Cv.SubC = fill(0, Medium.nC); end if; if (cardinality(Cee) == 0) then @@ -173,11 +151,8 @@ equation Cee.h_vol_1 = 1.e5; Cee.diff_res_1 = 0; Cee.diff_on_1 = false; - Cee.ftype = ftype; - Cee.Xco2 = 0; - Cee.Xh2o = 0; - Cee.Xo2 = 0; - Cee.Xso2 = 0; + Cee.Xi = Medium_Cooling.X_default[1:Medium_Cooling.nXi]; + Cee.SubC = fill(0, Medium_Cooling.nC); end if; if (cardinality(Cl) == 0) then @@ -185,6 +160,8 @@ equation Cl.h_vol_2 = 1.e5; Cl.diff_res_2 = 0; Cl.diff_on_2 = false; + Cl.Xi = Medium.X_default[1:Medium.nXi]; + Cl.SubC = fill(0, Medium.nC); end if; if (cardinality(Cse) == 0) then @@ -192,6 +169,8 @@ equation Cse.h_vol_2 = 1.e5; Cse.diff_res_2 = 0; Cse.diff_on_2 = false; + Cse.Xi = Medium_Cooling.X_default[1:Medium_Cooling.nXi]; + Cse.SubC = fill(0, Medium_Cooling.nC); end if; /* Drum volume */ @@ -201,13 +180,13 @@ equation yNiveau.signal = Vl/A; /* Pressure at the bottom of the condenser */ - Pfond = if gravity_pressure then P + prod.d*g*Vl/A else P; + Pfond = if gravity_pressure then P + Medium.density(state_d)*g*Vl/A else P; /* Liquid phase mass balance equation in the cavity */ BQl = -Cl.Q + Qcond - Qevap; if dynamic_energy_balance then - rhol*der(Vl) + Vl*(prol.ddph*der(P) + prol.ddhp*der(hl)) = BQl; + rhol*der(Vl) + Vl*(Medium.density_derp_h(state_l)*der(P) + Medium.density_derh_p(state_l)*der(hl)) = BQl; else 0 = BQl; end if; @@ -216,7 +195,7 @@ equation BQv = Cv.Q + Qevap - Qcond; if dynamic_energy_balance then - rhov*der(Vv) + Vv*(prov.ddph*der(P) + prov.ddhp*der(hv)) = BQv; + rhov*der(Vv) + Vv*(Medium.density_derp_h(state_v)*der(P) + Medium.density_derh_p(state_v)*der(hv)) = BQv; else 0 = BQv; end if; @@ -229,19 +208,19 @@ equation Cl.P = Pfond; /* Liquid phase energy balance equation in the cavity */ - BHl = -Cl.Q*(Cl.h - (hl - P/rhol)) + Qcond*(lsat.h - (hl - P/rhol)) - Qevap*(vsat.h - (hl - P/rhol)) + Wvl + Jt_l; + BHl = -Cl.Q*(Cl.h - (hl - P/rhol)) + Qcond*(Medium.bubbleEnthalpy(sat) - (hl - P/rhol)) - Qevap*(Medium.dewEnthalpy(sat) - (hl - P/rhol)) + Wvl + Jt_l; if dynamic_energy_balance then - Vl*((P/rhol*prol.ddph - 1)*der(P) + (P/rhol*prol.ddhp + rhol)*der(hl)) = BHl; + Vl*((P/rhol*Medium.density_derp_h(state_l) - 1)*der(P) + (P/rhol*Medium.density_derh_p(state_l) + rhol)*der(hl)) = BHl; else 0 = BHl; end if; /* Vapor phase energy balance equation in the cavity */ - BHv = Cv.Q*(Cv.h - (hv - P/rhov)) + Qevap*(vsat.h - (hv - P/rhov)) - Qcond*(lsat.h - (hv - P/rhov)) - Wvl + Wout + Jt_v; + BHv = Cv.Q*(Cv.h - (hv - P/rhov)) + Qevap*(Medium.dewEnthalpy(sat) - (hv - P/rhov)) - Qcond*(Medium.bubbleEnthalpy(sat) - (hv - P/rhov)) - Wvl + Wout + Jt_v; if dynamic_energy_balance then - Vv*((P/rhov*prov.ddph - 1)*der(P) + (P/rhov*prov.ddhp + rhov)*der(hv)) = BHv; + Vv*((P/rhov*Medium.density_derp_h(state_v) - 1)*der(P) + (P/rhov*Medium.density_derh_p(state_v) + rhov)*der(hv)) = BHv; else 0 = BHv; end if; @@ -257,12 +236,9 @@ equation Wout = -Cee.Q*(Cse.h - Cee.h); /* Fluid composition in the cavity (no balance equations) */ - Cl.ftype = ftype; - - Cl.Xco2 = 0; - Cl.Xh2o = 0; - Cl.Xo2 = 0; - Cl.Xso2 = 0; + Cv.Xi = Cl.Xi; + Cv.SubC = Cl.SubC; + X = Cv.Xi; /* Pipes inlet and outlet */ Cee.Q = Cse.Q; @@ -276,14 +252,9 @@ equation Cse.diff_res_1 = Cee.diff_res_1 + 1/gamma_diff; Cee.diff_res_2 = Cse.diff_res_2 + 1/gamma_diff; - Cee.ftype = Cse.ftype; - - Cee.Xco2 = Cse.Xco2; - Cee.Xh2o = Cse.Xh2o; - Cee.Xo2 = Cse.Xo2; - Cee.Xso2 = Cse.Xso2; - - ftype_p = Cee.ftype; + Cee.Xi = Cse.Xi; + Cee.SubC = Cse.SubC; + Xp = Cee.Xi; Q = Cee.Q; deltaP = Cee.P - Cse.P; @@ -339,25 +310,24 @@ equation Pm = (Cee.P + Cse.P)/2; hm = (Cee.h + Cse.h)/2; - prol = ThermoSysPro.Properties.Fluid.Ph(P, hl,0, fluid_c); - prov = ThermoSysPro.Properties.Fluid.Ph(P, hv,0, fluid_c); - prod = ThermoSysPro.Properties.Fluid.Ph(Pfond, Cl.h, 0, fluid_c); - proe = ThermoSysPro.Properties.Fluid.Ph(Pm, hm, mode, fluid_p); - - (lsat,vsat) = ThermoSysPro.Properties.Fluid.Water_sat_P(P, fluid_c); + sat = Medium.setSat_p(P); + state_l = Medium.setState_phX(p=P, h=hl, X=X); + state_v = Medium.setState_phX(p=P, h=hv, X=X); + state_d = Medium.setState_phX(p=Pfond, h=Cl.h, X=X); + state_e = Medium_Cooling.setState_phX(p=Pm, h=hm, X=Xp); - rhom = proe.d; + rhom = Medium_Cooling.density(state_e); - Tl = prol.T; - rhol = prol.d; - xl = prol.x; + Tl = Medium.temperature(state_l); + rhol = Medium.density(state_l); + xl = (hl - Medium.bubbleEnthalpy(sat))/(Medium.dewEnthalpy(sat) - Medium.bubbleEnthalpy(sat)); - Tv = prov.T; - rhov = prov.d; - xv = prov.x; + Tv = Medium.temperature(state_v); + rhov = Medium.density(state_v); + xv = (hv - Medium.bubbleEnthalpy(sat))/(Medium.dewEnthalpy(sat) - Medium.bubbleEnthalpy(sat)); - k = ThermoSysPro.Properties.Fluid.ThermalConductivity_Ph(Pm, hm, fluid_p, mode, Cee.Xco2, Cee.Xh2o,Cee.Xo2, Cee.Xso2); - cp = ThermoSysPro.Properties.Fluid.SpecificHeatCapacityCp_Ph(Pm, hm, fluid_p, mode, Cee.Xco2, Cee.Xh2o, Cee.Xo2, Cee.Xso2); + k = Medium_Cooling.thermalConductivity(state_e); + cp = Medium_Cooling.specificHeatCapacityCp(state_e); annotation ( Diagram(coordinateSystem( From 498735b22286ae4d9a09fdf2243be7d07355f623 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Thu, 7 May 2026 16:11:00 +0200 Subject: [PATCH 118/178] #125 SimpleStaticCondenser --- .../TestSimpleStaticCondenser.mo | 33 ++++++ .../TestSimpleStaticCondenser_Traces.mo | 38 ++++++ .../HeatExchangers/package.order | 2 + .../HeatExchangers/SimpleDynamicCondenser.mo | 4 +- .../HeatExchangers/SimpleStaticCondenser.mo | 109 ++++++------------ 5 files changed, 111 insertions(+), 75 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestSimpleStaticCondenser.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestSimpleStaticCondenser_Traces.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestSimpleStaticCondenser.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestSimpleStaticCondenser.mo new file mode 100644 index 00000000..be8ea3fb --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestSimpleStaticCondenser.mo @@ -0,0 +1,33 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; +model TestSimpleStaticCondenser + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; + + ThermoSysPro.Fluid.HeatExchangers.SimpleStaticCondenser simpleStaticCondenser( + redeclare package Medium = Medium, + redeclare package Medium_Cooling = Medium, + Ec(h(start=532983.7176868258)), + Ef(h(start=71016.12237181116)), + Qc(start=1049.6385508765125), + Qf(start=4469.84281279143), + Sf(h(start=64330.208038325145))) annotation (Placement(transformation(extent={{-20,20},{0,40}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP( + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-60,20},{-40,40}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP1( + redeclare package Medium = Medium, + T0=400) annotation (Placement(transformation(extent={{-60,-20},{-40,0}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP( + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{20,20},{40,40}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP1( + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{20,-20},{40,0}}, rotation=0))); +equation + connect(sourceP.C, simpleStaticCondenser.Ef) annotation (Line(points={{-40,30},{-20,30}}, color={0,0,255})); + connect(sourceP1.C, simpleStaticCondenser.Ec) annotation (Line(points={{-40,-10},{-16,-10},{-16,20}}, color={0,0,255})); + connect(simpleStaticCondenser.Sf, sinkP.C) annotation (Line(points={{0,29.9},{10,29.9},{10,30},{20,30}}, color={0,0,255})); + connect(simpleStaticCondenser.Sc, sinkP1.C) annotation (Line(points={{-4,20},{-4,-10},{20,-10}}, color={0,0,255})); + annotation ( + experiment(StopTime=1000), + Icon(coordinateSystem(preserveAspectRatio=false)), + Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestSimpleStaticCondenser; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestSimpleStaticCondenser_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestSimpleStaticCondenser_Traces.mo new file mode 100644 index 00000000..b18f22c4 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestSimpleStaticCondenser_Traces.mo @@ -0,0 +1,38 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; +model TestSimpleStaticCondenser_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam( + extraPropertiesNames={"Trace1", "Trace2"}, + C_nominal={0.1, 2}, + C_default={0.2, 5}); + + ThermoSysPro.Fluid.HeatExchangers.SimpleStaticCondenser simpleStaticCondenser( + redeclare package Medium = Medium, + redeclare package Medium_Cooling = Medium, + Ec(h(start=532983.7176868258), SubC(start={10,20})), + Ef(h(start=71016.12237181116), SubC(start={10,20})), + Qc(start=1049.6385508765125), + Qf(start=4469.84281279143), + Sf(h(start=64330.208038325145), SubC(start={10,20}))) annotation (Placement(transformation(extent={{-20,20},{0,40}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP( + redeclare package Medium = Medium, + SubC0={10,20}) annotation (Placement(transformation(extent={{-60,20},{-40,40}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP1( + redeclare package Medium = Medium, + T0=400, + SubC0={10,20}) annotation (Placement(transformation(extent={{-60,-20},{-40,0}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP( + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{20,20},{40,40}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP1( + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{20,-20},{40,0}}, rotation=0))); +equation + connect(sourceP.C, simpleStaticCondenser.Ef) annotation (Line(points={{-40,30},{-20,30}}, color={0,0,255})); + connect(sourceP1.C, simpleStaticCondenser.Ec) annotation (Line(points={{-40,-10},{-16,-10},{-16,20}}, color={0,0,255})); + connect(simpleStaticCondenser.Sf, sinkP.C) annotation (Line(points={{0,29.9},{10,29.9},{10,30},{20,30}}, color={0,0,255})); + connect(simpleStaticCondenser.Sc, sinkP1.C) annotation (Line(points={{-4,20},{-4,-10},{20,-10}}, color={0,0,255})); + annotation ( + experiment(StopTime=1000), + Icon(coordinateSystem(preserveAspectRatio=false)), + Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestSimpleStaticCondenser_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order index 62b11eb0..20b41532 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order @@ -8,3 +8,5 @@ TestStaticPlateHeatExchanger_Traces TestStaticPlateHeatExchanger_FlueGases TestSimpleDynamicCondenser TestSimpleDynamicCondenser_Traces +TestSimpleStaticCondenser +TestSimpleStaticCondenser_Traces diff --git a/ThermoSysPro/Fluid/HeatExchangers/SimpleDynamicCondenser.mo b/ThermoSysPro/Fluid/HeatExchangers/SimpleDynamicCondenser.mo index 809e9dac..e535bea9 100644 --- a/ThermoSysPro/Fluid/HeatExchangers/SimpleDynamicCondenser.mo +++ b/ThermoSysPro/Fluid/HeatExchangers/SimpleDynamicCondenser.mo @@ -2,8 +2,8 @@ model SimpleDynamicCondenser "Simple dynamic condenser" extends ThermoSysPro.Fluid.Interfaces.IconColors; - replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.WaterSteam "Medium model for the condenser cavity" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); - replaceable package Medium_Cooling = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.WaterSteam "Medium model for the cooling pipes" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialTwoPhaseThermoSysProMedium "Medium model for the condenser cavity" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable package Medium_Cooling = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialTwoPhaseThermoSysProMedium "Medium model for the cooling pipes" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Units.SI.Volume V=1 "Cavity volume"; parameter Units.SI.Area A=1 "Cavity cross-sectional area"; diff --git a/ThermoSysPro/Fluid/HeatExchangers/SimpleStaticCondenser.mo b/ThermoSysPro/Fluid/HeatExchangers/SimpleStaticCondenser.mo index 8f8210f0..28800a03 100644 --- a/ThermoSysPro/Fluid/HeatExchangers/SimpleStaticCondenser.mo +++ b/ThermoSysPro/Fluid/HeatExchangers/SimpleStaticCondenser.mo @@ -1,8 +1,9 @@ within ThermoSysPro.Fluid.HeatExchangers; model SimpleStaticCondenser "Simple static condenser" extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialTwoPhaseThermoSysProMedium "Medium model for the condensing side" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable package Medium_Cooling = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialTwoPhaseThermoSysProMedium "Medium model for the cooling side" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Real Kc=10 "Friction pressure loss coefficient for the hot side"; parameter Real Kf=10 "Friction pressure loss coefficient for the cold side"; @@ -18,15 +19,8 @@ model SimpleStaticCondenser "Simple static condenser" "Diffusion conductance for the hot fluid (active if diffusion=true in neighbouring volumes)"; parameter Units.SI.MassFlowRate gamma_diff_f=1e-4 "Diffusion conductance for the cold fluid (active if diffusion=true in neighbouring volumes)"; - parameter IF97Region region_c=IF97Region.All_regions "IF97 region for the hot fluid (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); - parameter IF97Region region_cs=IF97Region.All_regions "IF97 region of the water at the outlet of the hot side (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); - parameter IF97Region region_f=IF97Region.All_regions "IF97 region for the cold fluid (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); - protected constant Units.SI.Acceleration g=Modelica.Constants.g_n "Gravity constant"; - parameter Integer mode_c=Integer(region_c) - 1 "IF97 region for the hot fluid. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; - parameter Integer mode_cs=Integer(region_cs) - 1 "IF97 region of the water at the outlet of the hot side. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; - parameter Integer mode_f=Integer(region_f) - 1 "IF97 region for the cold fluid. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; parameter Real eps=1.e-0 "Small number for pressure loss equation"; public @@ -56,47 +50,27 @@ public Units.SI.Density rhof(start=998) "Density of the fluid in the cold side"; Units.SI.MassFlowRate Qc(start=100) "Hot fluid mass flow rate"; Units.SI.MassFlowRate Qf(start=100) "Cold fluid mass flow rate"; - FluidType ftype_c "Fluid type for the hot fluid"; - Integer fluid_c=Integer(ftype_c) "Fluid number for the hot fluid"; - FluidType ftype_f "Fluid type for the cold fluid"; - Integer fluid_f=Integer(ftype_f) "Fluid number for the cold fluid"; + Medium.MassFraction Xc[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Mass fractions in the condensing side"; + Medium_Cooling.MassFraction Xf[Medium_Cooling.nXi](start=Medium_Cooling.X_default[1:Medium_Cooling.nXi]) "Mass fractions in the cooling side"; + Medium.ThermodynamicState state_ce "Thermodynamic state at the condensing-side inlet"; + Medium.ThermodynamicState state_cs "Thermodynamic state at the condensing-side outlet"; + Medium.ThermodynamicState state_mc "Average thermodynamic state in the condensing side"; + Medium_Cooling.ThermodynamicState state_fe "Thermodynamic state at the cooling-side inlet"; + Medium_Cooling.ThermodynamicState state_fs "Thermodynamic state at the cooling-side outlet"; + Medium_Cooling.ThermodynamicState state_mf "Average thermodynamic state in the cooling side"; + Medium.SaturationProperties sat_c "Saturation properties at the condensing-side inlet pressure"; public - Interfaces.Connectors.FluidInlet Ec annotation (Placement(transformation( + Interfaces.Connectors.FluidInlet Ec(redeclare package Medium = Medium) annotation (Placement(transformation( extent={{-70,-110},{-50,-90}}, rotation=0))); - Interfaces.Connectors.FluidInlet Ef annotation (Placement(transformation( + Interfaces.Connectors.FluidInlet Ef(redeclare package Medium = Medium_Cooling) annotation (Placement(transformation( extent={{-110,-10},{-90,10}}, rotation=0))); - Interfaces.Connectors.FluidOutlet Sf annotation (Placement(transformation( + Interfaces.Connectors.FluidOutlet Sf(redeclare package Medium = Medium_Cooling) annotation (Placement(transformation( extent={{90,-11},{110,9}}, rotation=0))); - Interfaces.Connectors.FluidOutlet Sc annotation (Placement(transformation( + Interfaces.Connectors.FluidOutlet Sc(redeclare package Medium = Medium) annotation (Placement(transformation( extent={{50,-110},{70,-90}}, rotation=0))); - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph proce - annotation (Placement(transformation(extent={{-100,-100},{-80,-80}}, - rotation=0))); - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph procs - annotation (Placement(transformation(extent={{80,-100},{100,-80}}, rotation= - 0))); - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph profe - annotation (Placement(transformation(extent={{-100,80},{-80,100}}, rotation= - 0))); - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph promf - annotation (Placement(transformation(extent={{-20,80},{0,100}}, rotation=0))); - ThermoSysPro.Properties.WaterSteam.Common.PropThermoSat lsat - annotation (Placement(transformation(extent={{80,80},{100,100}}, rotation=0))); - ThermoSysPro.Properties.WaterSteam.Common.PropThermoSat vsat - annotation (Placement(transformation( - extent={{40,80},{60,100}}, rotation=0))); - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph promc - annotation (Placement(transformation(extent={{0,-100},{20,-80}}, rotation=0))); - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph profs - annotation (Placement(transformation(extent={{-60,80},{-40,100}}, rotation= - 0))); equation - /* Check that the fluid type for both sides is water/steam */ - assert((ftype_c == FluidType.WaterSteam) or (ftype_c == FluidType.WaterSteamSimple), "SimpleStaticCondenser: the fluid type must be water/steam for the hot side"); - assert((ftype_f == FluidType.WaterSteam) or (ftype_f == FluidType.WaterSteamSimple), "SimpleStaticCondenser: the fluid type must be water/steam for the cold side"); - /* Mass flow rates */ Ec.Q = Sc.Q; @@ -109,14 +83,8 @@ equation Sc.diff_res_1 = Ec.diff_res_1 + 1/gamma_diff_c; Ec.diff_res_2 = Sc.diff_res_2 + 1/gamma_diff_c; - Ec.ftype = Sc.ftype; - - Ec.Xco2 = Sc.Xco2; - Ec.Xh2o = Sc.Xh2o; - Ec.Xo2 = Sc.Xo2; - Ec.Xso2 = Sc.Xso2; - - ftype_c = Ec.ftype; + Ec.Xi = Sc.Xi; + Ec.SubC = Sc.SubC; Ef.Q = Sf.Q; @@ -129,20 +97,16 @@ equation Sf.diff_res_1 = Ef.diff_res_1 + 1/gamma_diff_f; Ef.diff_res_2 = Sf.diff_res_2 + 1/gamma_diff_f; - Ef.ftype = Sf.ftype; - - Ef.Xco2 = Sf.Xco2; - Ef.Xh2o = Sf.Xh2o; - Ef.Xo2 = Sf.Xo2; - Ef.Xso2 = Sf.Xso2; - - ftype_f = Ef.ftype; + Ef.Xi = Sf.Xi; + Ef.SubC = Sf.SubC; Qc = Ec.Q; Qf = Ef.Q; + Xc = Ec.Xi; + Xf = Ef.Xi; /* The fluid specific enthalpy at the outlet of the hot side is assumed to be at the saturation point */ - Sc.h = lsat.h; + Sc.h = Medium.bubbleEnthalpy(sat_c); /* Power exchanged between the two sides */ W = Qf*(Sf.h - Ef.h); @@ -163,33 +127,32 @@ equation DPf = DPff + DPgf; /* Fluid thermodynamic properties at the hot side */ - proce = ThermoSysPro.Properties.Fluid.Ph(Ec.P, Ec.h, mode_c, fluid_c); - procs = ThermoSysPro.Properties.Fluid.Ph(Sc.P, Sc.h, mode_cs, fluid_c); - promc = ThermoSysPro.Properties.Fluid.Ph((Ec.P + Sc.P)/2, (Ec.h + Sc.h)/2, mode_c, fluid_c); - - Tec = proce.T; - Tsc = procs.T; + sat_c = Medium.setSat_p(Ec.P); + state_ce = Medium.setState_phX(p=Ec.P, h=Ec.h, X=Xc); + state_cs = Medium.setState_phX(p=Sc.P, h=Sc.h, X=Xc); + state_mc = Medium.setState_phX(p=(Ec.P + Sc.P)/2, h=(Ec.h + Sc.h)/2, X=Xc); - (lsat,vsat) = ThermoSysPro.Properties.Fluid.Water_sat_P(Ec.P, fluid_c); + Tec = Medium.temperature(state_ce); + Tsc = Medium.temperature(state_cs); if (p_rhoc > 0) then rhoc = p_rhoc; else - rhoc = promc.d; + rhoc = Medium.density(state_mc); end if; /* Fluid thermodynamic properties at the cold side */ - profe = ThermoSysPro.Properties.Fluid.Ph(Ef.P, Ef.h, mode_f, fluid_f); - profs = ThermoSysPro.Properties.Fluid.Ph(Sf.P, Sf.h, mode_f, fluid_f); - promf = ThermoSysPro.Properties.Fluid.Ph((Ef.P + Sf.P)/2, (Ef.h + Sf.h)/2, mode_f, fluid_f); + state_fe = Medium_Cooling.setState_phX(p=Ef.P, h=Ef.h, X=Xf); + state_fs = Medium_Cooling.setState_phX(p=Sf.P, h=Sf.h, X=Xf); + state_mf = Medium_Cooling.setState_phX(p=(Ef.P + Sf.P)/2, h=(Ef.h + Sf.h)/2, X=Xf); - Tef = profe.T; - Tsf = profs.T; + Tef = Medium_Cooling.temperature(state_fe); + Tsf = Medium_Cooling.temperature(state_fs); if (p_rhof > 0) then rhof = p_rhof; else - rhof = promf.d; + rhof = Medium_Cooling.density(state_mf); end if; annotation ( From 700ccd57db6484abf27234c5e74a7f67ec7caf77 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Thu, 7 May 2026 16:25:07 +0200 Subject: [PATCH 119/178] #125 StaticCondenser --- .../HeatExchangers/TestStaticCondenser.mo | 89 +++++++++++++ .../TestStaticCondenser_Traces.mo | 14 ++ .../HeatExchangers/package.order | 2 + .../Fluid/HeatExchangers/StaticCondenser.mo | 122 ++++++------------ 4 files changed, 142 insertions(+), 85 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticCondenser.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticCondenser_Traces.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticCondenser.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticCondenser.mo new file mode 100644 index 00000000..3dfd512a --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticCondenser.mo @@ -0,0 +1,89 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; +model TestStaticCondenser + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; + + parameter Units.SI.AbsolutePressure Pin_1(fixed=false, start=20000) + "Flow pressure at inlet 1"; + parameter Units.SI.AbsolutePressure Pin_2(fixed=false, start=20000) + "Flow pressure at inlet 2"; + parameter Units.SI.AbsolutePressure Pin_3(fixed=false, start=20000) + "Flow pressure at inlet 3"; + + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceCooling( + redeclare package Medium = Medium, + h0=60e3, + Q0(fixed=true)=4000) annotation (Placement(transformation(extent={{-180,0},{-160,20}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkCooling( + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{160,0},{180,20}}, rotation=0))); + ThermoSysPro.Fluid.HeatExchangers.StaticCondenser condenseur( + redeclare package Medium = Medium, + redeclare package Medium_Cooling = Medium, + CPCE=0, + KCO=100, + QC0=200, + z=5, + SCO=15e3, + Qee(start=4000, fixed=false), + Pcond(fixed=false, start=2154.77)) annotation (Placement(transformation(extent={{-20,-16},{72,82}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP( + redeclare package Medium = Medium, + option_temperature=false, + P0=Pin_1, + h0=2.5817e6, + C(Q(fixed=true, start=100))) annotation (Placement(transformation(extent={{-100,140},{-80,160}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP1( + redeclare package Medium = Medium, + option_temperature=false, + P0=Pin_2, + h0=2.5481e6, + C(Q(fixed=true, start=1e-5))) annotation (Placement(transformation(extent={{-182,80},{-162,100}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP2( + redeclare package Medium = Medium, + option_temperature=false, + P0=Pin_3, + h0=2.5055e6, + C(Q(fixed=true, start=1e-5))) annotation (Placement(transformation(extent={{-180,40},{-160,60}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss( + redeclare package Medium = Medium, + K=10) annotation (Placement(transformation(extent={{-100,80},{-80,100}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss1( + redeclare package Medium = Medium, + K=10) annotation (Placement(transformation(extent={{-100,40},{-80,60}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss2( + redeclare package Medium = Medium, + K=1e-4) annotation (Placement(transformation(extent={{-100,0},{-80,20}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss3( + redeclare package Medium = Medium, + K=10) annotation (Placement(transformation(extent={{-40,140},{-20,160}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sinkEx( + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{100,-100},{120,-80}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss4( + redeclare package Medium = Medium, + K=1e-4) annotation (Placement(transformation(extent={{100,0},{120,20}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss5( + redeclare package Medium = Medium, + K=1e-4) annotation (Placement(transformation(extent={{40,-100},{60,-80}}, rotation=0))); +equation + connect(sourceP1.C, singularPressureLoss.C1) + annotation (Line(points={{-162,90},{-100,90}}, color={0,0,255})); + connect(singularPressureLoss.C2, condenseur.Cev) annotation (Line(points={{-80,90},{-50,90},{-50,62.89},{-20,62.89}}, color={0,0,255})); + connect(sourceP2.C, singularPressureLoss1.C1) + annotation (Line(points={{-160,50},{-100,50}}, color={0,0,255})); + connect(singularPressureLoss1.C2, condenseur.Cep) annotation (Line(points={{-80,50},{-52,50},{-52,42.31},{-20,42.31}}, color={0,0,255})); + connect(sourceCooling.C, singularPressureLoss2.C1) + annotation (Line(points={{-160,10},{-100,10}}, color={0,0,255})); + connect(singularPressureLoss2.C2, condenseur.Cee) annotation (Line(points={{-80,10},{-52,10},{-52,3.11},{-20,3.11}}, color={0,0,255})); + connect(sourceP.C, singularPressureLoss3.C1) + annotation (Line(points={{-80,150},{-40,150}}, color={0,0,255})); + connect(singularPressureLoss3.C2, condenseur.Cvt) annotation (Line(points={{-20,150},{26,150},{26,82.49}}, color={0,0,255})); + connect(singularPressureLoss4.C2, sinkCooling.C) + annotation (Line(points={{120,10},{160,10}}, color={0,0,255})); + connect(condenseur.Cse, singularPressureLoss4.C1) annotation (Line(points={{72.92,3.11},{86,3.11},{86,10},{100,10}}, color={0,0,255})); + connect(singularPressureLoss5.C2, sinkEx.C) + annotation (Line(points={{60,-90},{100,-90}}, color={0,0,255})); + connect(singularPressureLoss5.C1, condenseur.Cex) + annotation (Line(points={{40,-90},{26.46,-90},{26.46,-16.98}}, color={0,0,255})); + annotation (experiment(StopTime=1000), Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestStaticCondenser; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticCondenser_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticCondenser_Traces.mo new file mode 100644 index 00000000..b235af11 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticCondenser_Traces.mo @@ -0,0 +1,14 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; +model TestStaticCondenser_Traces + extends TestStaticCondenser( + redeclare package Medium = ThermoSysPro.Properties.Media.WaterSteam( + extraPropertiesNames={"Trace1", "Trace2"}, + C_nominal={0.1, 2}, + C_default={0.2, 5}), + sourceP(SubC0={10,20}), + sourceP1(SubC0={10,20}), + sourceP2(SubC0={10,20}), + sourceCooling(SubC0={10,20}), + condenseur(Cvt(SubC(start={10,20})), Cev(SubC(start={10,20})), Cep(SubC(start={10,20})), Cee(SubC(start={10,20})))); + annotation (experiment(StopTime=1000), Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestStaticCondenser_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order index 20b41532..27280e72 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order @@ -10,3 +10,5 @@ TestSimpleDynamicCondenser TestSimpleDynamicCondenser_Traces TestSimpleStaticCondenser TestSimpleStaticCondenser_Traces +TestStaticCondenser +TestStaticCondenser_Traces diff --git a/ThermoSysPro/Fluid/HeatExchangers/StaticCondenser.mo b/ThermoSysPro/Fluid/HeatExchangers/StaticCondenser.mo index c7986653..b8a6630e 100644 --- a/ThermoSysPro/Fluid/HeatExchangers/StaticCondenser.mo +++ b/ThermoSysPro/Fluid/HeatExchangers/StaticCondenser.mo @@ -1,10 +1,9 @@ within ThermoSysPro.Fluid.HeatExchangers; model StaticCondenser "Static condenser" - extends - ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.WaterSteamFluidTypeParameterInterface; extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialTwoPhaseThermoSysProMedium "Medium model for the condensing side" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable package Medium_Cooling = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model for the cooling side" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Units.SI.Area SCO=10000 "Heat exchange surface"; parameter Real CPCE=0.02 "Pressure loss coefficient for the water side (Pa.s²/(kg.m**3))"; @@ -19,16 +18,9 @@ model StaticCondenser "Static condenser" "Air diffusion conductance (active if diffusion=true in neighbouring volumes)"; parameter Boolean continuous_flow_reversal=false "true: continuous flow reversal - false: discontinuous flow reversal"; parameter Boolean diffusion=false "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; - parameter IF97Region region_ee=IF97Region.All_regions "IF97 region at the water inlet (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); - parameter IF97Region region_se=IF97Region.All_regions "IF97 region at the water outlet (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); - parameter IF97Region region_ex=IF97Region.All_regions "IF97 region at the extraction point (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); protected constant Units.SI.Acceleration g=Modelica.Constants.g_n "Gravity constant"; - parameter Integer fluid=Integer(ftype) "Water fluid number"; - parameter Integer mode_ee=Integer(region_ee) - 1 "IF97 region at the water inlet. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; - parameter Integer mode_se=Integer(region_se) - 1 "IF97 region at the water outlet. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; - parameter Integer mode_ex=Integer(region_ex) - 1 "IF97 region at the extraction point. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; parameter Units.SI.MassFlowRate gamma0=1.e-4 "Pseudo-diffusion conductance use for continuous flow reversal (active if diffusion=false and continuous_flow_reversal = true)"; parameter Real eps=1.e-0 "Small number for pressure loss equation"; @@ -79,7 +71,6 @@ public Units.SI.SpecificEnthalpy Hml(start=250000) "Extraction water average specific enthalpy"; Units.SI.Power W "Heat power released to the cold source"; - FluidType fluids[5] "Fluids mixing in volume"; Units.SI.Power Jvt "Thermal power diffusion from inlet Cvt"; Units.SI.Power Jev "Thermal power diffusion from inlet Cev"; Units.SI.Power Jep "Thermal power diffusion from inlet Cep"; @@ -93,60 +84,34 @@ public Real rev "Value of r(Q/gamma) for inlet Cev"; Real rep "Value of r(Q/gamma) for inlet Cep"; Real rex "Value of r(Q/gamma) for outlet Cex"; - FluidType ftype_p "Cooling pipe fluid type"; - Integer fluid_p=Integer(ftype_p) "Cooling pipe fluid number"; + Medium.MassFraction X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Mass fractions in the condenser cavity"; + Medium.ExtraProperty SubC[Medium.nC](start=Medium.C_default) "Trace substance concentrations in the condenser cavity"; + Medium_Cooling.MassFraction X_Cooling[Medium_Cooling.nXi](start=Medium_Cooling.X_default[1:Medium_Cooling.nXi]) "Mass fractions in the cooling pipe"; + Medium.ThermodynamicState state_ex "Thermodynamic state at the extraction point"; + Medium_Cooling.ThermodynamicState state_ee "Thermodynamic state at the cooling water inlet"; + Medium_Cooling.ThermodynamicState state_se "Thermodynamic state at the cooling water outlet"; + Medium.SaturationProperties sat "Saturation properties inside the condenser"; public - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Cee "Cooling water inlet" + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Cee(redeclare package Medium = Medium_Cooling) "Cooling water inlet" annotation (Placement(transformation(extent={{-112,-72},{-88,-50}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cse + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cse(redeclare package Medium = Medium_Cooling) "Cooling water outlet" annotation (Placement(transformation(extent={{90,-72}, {114,-50}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cex "Extraction water" + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cex(redeclare package Medium = Medium) "Extraction water" annotation (Placement(transformation(extent={{-12,-112},{14,-88}}, rotation= 0), iconTransformation(extent={{-12,-112},{14,-88}}))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Cvt "Turbine outlet" + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Cvt(redeclare package Medium = Medium) "Turbine outlet" annotation (Placement(transformation(extent={{-13,88},{13,114}}, rotation=0))); - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph proex - "Propriétés de l'eau" - annotation (Placement(transformation(extent={{60,80},{80,100}}, rotation=0))); -public - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph proee - "Propriétés de l'eau" - annotation (Placement(transformation(extent={{20,80},{40,100}}, rotation=0))); -public - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph prose - "Propriétés de l'eau" - annotation (Placement(transformation(extent={{80,-100},{100,-80}}, rotation= - 0))); - ThermoSysPro.Properties.WaterSteam.Common.PropThermoSat lsat1 - annotation (Placement(transformation(extent={{-100,80},{-80,100}}, rotation= - 0))); - ThermoSysPro.Properties.WaterSteam.Common.PropThermoSat vsat1 - annotation (Placement(transformation(extent={{-60,80},{-40,100}}, rotation= - 0))); public - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Cep "Drain inlet" + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Cep(redeclare package Medium = Medium) "Drain inlet" annotation (Placement(transformation(extent={{-112,8},{-88,30}}, rotation=0))); public - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Cev "Vapor inlet" + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Cev(redeclare package Medium = Medium) "Vapor inlet" annotation (Placement(transformation(extent={{-112,50},{-88,72}}, rotation= 0))); equation - - /* Check that incoming fluids are compatible with fluid in volume */ - fluids[1] = ftype; - fluids[2] = Cvt.ftype; - fluids[3] = Cev.ftype; - fluids[4] = Cep.ftype; - fluids[5] = Cex.ftype; - - assert(ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.isCompatible(fluids), "StaticCondenser: fluids mixing in condenser volume are not compatible with each other"); - - /* Check that the fluid type for the cooling pipe is water/steam */ - assert((ftype_p == FluidType.WaterSteam) or (ftype_p == FluidType.WaterSteamSimple), "StaticCondenser: the fluid type for the cooling pipe must be water/steam"); - /* Unconnected connectors */ if (cardinality(Cev) == 0) then Cev.Q = 0; @@ -154,11 +119,8 @@ equation Cev.h_vol_1 = 1.e5; Cev.diff_res_1 = 0; Cev.diff_on_1 = false; - Cev.ftype = ftype; - Cev.Xco2 = 0; - Cev.Xh2o = 0; - Cev.Xo2 = 0; - Cev.Xso2 = 0; + Cev.Xi = Medium.X_default[1:Medium.nXi]; + Cev.SubC = Medium.C_default; end if; if (cardinality(Cep) == 0) then @@ -167,11 +129,8 @@ equation Cep.h_vol_1 = 1.e5; Cep.diff_res_1 = 0; Cep.diff_on_1 = false; - Cep.ftype = ftype; - Cep.Xco2 = 0; - Cep.Xh2o = 0; - Cep.Xo2 = 0; - Cep.Xso2 = 0; + Cep.Xi = Medium.X_default[1:Medium.nXi]; + Cep.SubC = Medium.C_default; end if; // Water/steam cavity @@ -227,12 +186,10 @@ equation 0 = Tsat - Tse - (Tsat - Tee)*exp(XKCO*SCO*((Tee - Tse)/W)); /* Fluid composition in the cavity (no balance equations) */ - Cex.ftype = ftype; - - Cex.Xco2 = 0; - Cex.Xh2o = 0; - Cex.Xo2 = 0; - Cex.Xso2 = 0; + X = Cvt.Xi; + SubC = Cvt.SubC; + Cex.Xi = X; + Cex.SubC = SubC; /* Flow reversal */ if continuous_flow_reversal then @@ -301,17 +258,12 @@ equation Cse.diff_res_1 = Cee.diff_res_1 + 1/gamma_diff; Cee.diff_res_2 = Cse.diff_res_2 + 1/gamma_diff; - Cee.ftype = Cse.ftype; - - Cee.Xco2 = Cse.Xco2; - Cee.Xh2o = Cse.Xh2o; - Cee.Xo2 = Cse.Xo2; - Cee.Xso2 = Cse.Xso2; - - ftype_p = Cee.ftype; + Cee.Xi = Cse.Xi; + Cee.SubC = Cse.SubC; Qee = Cee.Q; Qse = Cse.Q; + X_Cooling = Cee.Xi; Pee = Cee.P; Pse = Cse.P; @@ -326,23 +278,23 @@ equation W = Qee*(Hse - Hee); /* Fluid thermodynamic properties */ - proee = ThermoSysPro.Properties.Fluid.Ph(Pee, Hee, mode_ee, fluid_p); - proex = ThermoSysPro.Properties.Fluid.Ph(Pex, Hex, mode_ex, fluid); - prose = ThermoSysPro.Properties.Fluid.Ph(Pse, Hse, mode_se, fluid_p); + state_ee = Medium_Cooling.setState_phX(p=Pee, h=Hee, X=X_Cooling); + state_ex = Medium.setState_phX(p=Pex, h=Hex, X=X); + state_se = Medium_Cooling.setState_phX(p=Pse, h=Hse, X=X_Cooling); - rho_ee = proee.d; - rho_ex = proex.d; + rho_ee = Medium_Cooling.density(state_ee); + rho_ex = Medium.density(state_ex); - Tee = proee.T; - Tse = prose.T; + Tee = Medium_Cooling.temperature(state_ee); + Tse = Medium_Cooling.temperature(state_se); /* Vapor pressure inside the condenser */ - Pcond = ThermoSysPro.Properties.Fluid.P_sat(Tsat, fluid); + Pcond = Medium.saturationPressure(Tsat); /* Fluid thermodynamic properties at the saturation point */ - (lsat1,vsat1) = ThermoSysPro.Properties.Fluid.Water_sat_P(Pcond, fluid); + sat = Medium.setSat_p(Pcond); - Hsate = lsat1.h; + Hsate = Medium.bubbleEnthalpy(sat); annotation ( Diagram(coordinateSystem( From b69755e2339591ca65cc95aff347c7c33b440d13 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Thu, 7 May 2026 16:31:06 +0200 Subject: [PATCH 120/178] #125 StaticCondenserHEI --- .../HeatExchangers/TestStaticCondenserHEI.mo | 88 +++++++++++ .../TestStaticCondenserHEI_Traces.mo | 14 ++ .../HeatExchangers/package.order | 2 + .../HeatExchangers/StaticCondenserHEI.mo | 148 ++++++------------ 4 files changed, 152 insertions(+), 100 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticCondenserHEI.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticCondenserHEI_Traces.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticCondenserHEI.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticCondenserHEI.mo new file mode 100644 index 00000000..2fc01b2a --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticCondenserHEI.mo @@ -0,0 +1,88 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; +model TestStaticCondenserHEI + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; + + parameter Units.SI.AbsolutePressure Pin_1(fixed=false, start=20000) + "Flow pressure at inlet 1"; + parameter Units.SI.AbsolutePressure Pin_2(fixed=false, start=20000) + "Flow pressure at inlet 2"; + parameter Units.SI.AbsolutePressure Pin_3(fixed=false, start=20000) + "Flow pressure at inlet 3"; + + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceCooling( + redeclare package Medium = Medium, + h0=60e3, + Q0(fixed=true)=4000) annotation (Placement(transformation(extent={{-180,0},{-160,20}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkCooling( + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{160,0},{180,20}}, rotation=0))); + ThermoSysPro.Fluid.HeatExchangers.StaticCondenserHEI condenseur( + redeclare package Medium = Medium, + redeclare package Medium_Cooling = Medium, + Kf=0, + z1c=0, + z2c=5, + Qc(start=100), + Qf(start=4000), + Pcond(fixed=false, start=2154.77)) annotation (Placement(transformation(extent={{-20,-16},{72,82}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP( + redeclare package Medium = Medium, + option_temperature=false, + P0=Pin_1, + h0=2.5817e6, + C(Q(fixed=true, start=100))) annotation (Placement(transformation(extent={{-100,140},{-80,160}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP1( + redeclare package Medium = Medium, + option_temperature=false, + P0=Pin_2, + h0=2.5481e6, + C(Q(fixed=true, start=1e-5))) annotation (Placement(transformation(extent={{-182,80},{-162,100}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP2( + redeclare package Medium = Medium, + option_temperature=false, + P0=Pin_3, + h0=2.5055e6, + C(Q(fixed=true, start=1e-5))) annotation (Placement(transformation(extent={{-180,40},{-160,60}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss( + redeclare package Medium = Medium, + K=10) annotation (Placement(transformation(extent={{-100,80},{-80,100}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss1( + redeclare package Medium = Medium, + K=10) annotation (Placement(transformation(extent={{-100,40},{-80,60}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss2( + redeclare package Medium = Medium, + K=1e-4) annotation (Placement(transformation(extent={{-100,0},{-80,20}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss3( + redeclare package Medium = Medium, + K=10) annotation (Placement(transformation(extent={{-40,140},{-20,160}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sinkEx( + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{100,-100},{120,-80}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss4( + redeclare package Medium = Medium, + K=1e-4) annotation (Placement(transformation(extent={{100,0},{120,20}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss5( + redeclare package Medium = Medium, + K=1e-4) annotation (Placement(transformation(extent={{40,-100},{60,-80}}, rotation=0))); +equation + connect(sourceP1.C, singularPressureLoss.C1) + annotation (Line(points={{-162,90},{-100,90}}, color={0,0,255})); + connect(singularPressureLoss.C2, condenseur.Cev) annotation (Line(points={{-80,90},{-50,90},{-50,62.89},{-20,62.89}}, color={0,0,255})); + connect(sourceP2.C, singularPressureLoss1.C1) + annotation (Line(points={{-160,50},{-100,50}}, color={0,0,255})); + connect(singularPressureLoss1.C2, condenseur.Cep) annotation (Line(points={{-80,50},{-52,50},{-52,42.31},{-20,42.31}}, color={0,0,255})); + connect(sourceCooling.C, singularPressureLoss2.C1) + annotation (Line(points={{-160,10},{-100,10}}, color={0,0,255})); + connect(singularPressureLoss2.C2, condenseur.Cee) annotation (Line(points={{-80,10},{-52,10},{-52,3.11},{-20,3.11}}, color={0,0,255})); + connect(sourceP.C, singularPressureLoss3.C1) + annotation (Line(points={{-80,150},{-40,150}}, color={0,0,255})); + connect(singularPressureLoss3.C2, condenseur.Cvt) annotation (Line(points={{-20,150},{26,150},{26,82.49}}, color={0,0,255})); + connect(singularPressureLoss4.C2, sinkCooling.C) + annotation (Line(points={{120,10},{160,10}}, color={0,0,255})); + connect(condenseur.Cse, singularPressureLoss4.C1) annotation (Line(points={{72.92,3.11},{86,3.11},{86,10},{100,10}}, color={0,0,255})); + connect(singularPressureLoss5.C2, sinkEx.C) + annotation (Line(points={{60,-90},{100,-90}}, color={0,0,255})); + connect(singularPressureLoss5.C1, condenseur.Cex) + annotation (Line(points={{40,-90},{26.46,-90},{26.46,-16.98}}, color={0,0,255})); + annotation (experiment(StopTime=1000), Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestStaticCondenserHEI; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticCondenserHEI_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticCondenserHEI_Traces.mo new file mode 100644 index 00000000..adacd0a4 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticCondenserHEI_Traces.mo @@ -0,0 +1,14 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; +model TestStaticCondenserHEI_Traces + extends TestStaticCondenserHEI( + redeclare package Medium = ThermoSysPro.Properties.Media.WaterSteam( + extraPropertiesNames={"Trace1", "Trace2"}, + C_nominal={0.1, 2}, + C_default={0.2, 5}), + sourceP(SubC0={10,20}), + sourceP1(SubC0={10,20}), + sourceP2(SubC0={10,20}), + sourceCooling(SubC0={10,20}), + condenseur(Cvt(SubC(start={10,20})), Cev(SubC(start={10,20})), Cep(SubC(start={10,20})), Cee(SubC(start={10,20})))); + annotation (experiment(StopTime=1000), Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestStaticCondenserHEI_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order index 27280e72..74fb80f4 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order @@ -12,3 +12,5 @@ TestSimpleStaticCondenser TestSimpleStaticCondenser_Traces TestStaticCondenser TestStaticCondenser_Traces +TestStaticCondenserHEI +TestStaticCondenserHEI_Traces diff --git a/ThermoSysPro/Fluid/HeatExchangers/StaticCondenserHEI.mo b/ThermoSysPro/Fluid/HeatExchangers/StaticCondenserHEI.mo index 0380ebca..789972c3 100644 --- a/ThermoSysPro/Fluid/HeatExchangers/StaticCondenserHEI.mo +++ b/ThermoSysPro/Fluid/HeatExchangers/StaticCondenserHEI.mo @@ -1,10 +1,9 @@ within ThermoSysPro.Fluid.HeatExchangers; model StaticCondenserHEI "HEI static condenser" - extends - ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.WaterSteamFluidTypeParameterInterface; extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialTwoPhaseThermoSysProMedium "Medium model for the condensing side" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable package Medium_Cooling = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model for the cooling side" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Real Kf=0 "Friction pressure loss coefficient for the cold side"; parameter Units.SI.Position z1c=0 "Hot inlet altitude"; @@ -72,17 +71,10 @@ model StaticCondenserHEI "HEI static condenser" "Air diffusion conductance (active if diffusion=true in neighbouring volumes)"; parameter Boolean continuous_flow_reversal=false "true: continuous flow reversal - false: discontinuous flow reversal"; parameter Boolean diffusion=false "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; - parameter IF97Region region_c=IF97Region.All_regions "IF97 region for the hot side (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); - parameter IF97Region region_cs=IF97Region.All_regions "IF97 region at the outlet of the hot side (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); - parameter IF97Region region_f=IF97Region.All_regions "IF97 region for the cold side (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); protected constant Units.SI.Acceleration g=Modelica.Constants.g_n "Gravity constant"; constant Real pi=Modelica.Constants.pi "pi"; - parameter Integer fluid=Integer(ftype) "Water fluid number"; - parameter Integer mode_c=Integer(region_c) - 1 "IF97 region for the hot side. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; - parameter Integer mode_cs=Integer(region_cs) - 1 "IF97 region at the outlet of the hot side. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; - parameter Integer mode_f=Integer(region_f) - 1 "IF97 region for the cold side. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; parameter Units.SI.MassFlowRate gamma0=1.e-4 "Pseudo-diffusion conductance use for continuous flow reversal (active if diffusion=false and continuous_flow_reversal = true)"; parameter Real eps=1.e-0 "Small number for pressure loss equation"; @@ -150,7 +142,6 @@ public "Extraction water average specific enthalpy"; Units.SI.SpecificEnthalpy Hex(start=100000) "Drain specific enthalpy at the outlet"; - FluidType fluids[5] "Fluids mixing in volume"; Units.SI.Power Jvt "Thermal power diffusion from inlet Cvt"; Units.SI.Power Jev "Thermal power diffusion from inlet Cev"; Units.SI.Power Jep "Thermal power diffusion from inlet Cep"; @@ -164,67 +155,37 @@ public Real rev "Value of r(Q/gamma) for inlet Cev"; Real rep "Value of r(Q/gamma) for inlet Cep"; Real rex "Value of r(Q/gamma) for outlet Cex"; - FluidType ftype_p "Cooling pipe fluid type"; - Integer fluid_p=Integer(ftype_p) "Cooling pipe fluid number"; + Medium.MassFraction X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Mass fractions in the condenser cavity"; + Medium.ExtraProperty SubC[Medium.nC](start=Medium.C_default) "Trace substance concentrations in the condenser cavity"; + Medium_Cooling.MassFraction X_Cooling[Medium_Cooling.nXi](start=Medium_Cooling.X_default[1:Medium_Cooling.nXi]) "Mass fractions in the cooling pipe"; + Medium.ThermodynamicState state_ce "Thermodynamic state at the condensing-side inlet average enthalpy"; + Medium.ThermodynamicState state_cs "Thermodynamic state at the extraction outlet"; + Medium_Cooling.ThermodynamicState state_fe "Thermodynamic state at the cooling water inlet"; + Medium_Cooling.ThermodynamicState state_fs "Thermodynamic state at the cooling water outlet"; + Medium_Cooling.ThermodynamicState state_mf "Average thermodynamic state of the cooling water"; + Medium.SaturationProperties sat "Saturation properties inside the condenser"; public - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Cee "Cooling water inlet" + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Cee(redeclare package Medium = Medium_Cooling) "Cooling water inlet" annotation (Placement(transformation(extent={{-112,-72},{-88,-50}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cse + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cse(redeclare package Medium = Medium_Cooling) "Cooling water outlet" annotation (Placement(transformation(extent={{90,-72}, {114,-50}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cex "Extraction water" + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cex(redeclare package Medium = Medium) "Extraction water" annotation (Placement(transformation(extent={{-12,-112},{14,-88}}, rotation= 0), iconTransformation(extent={{-12,-112},{14,-88}}))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Cvt "Turbine outlet" + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Cvt(redeclare package Medium = Medium) "Turbine outlet" annotation (Placement(transformation(extent={{-13,88},{13,114}}, rotation=0), iconTransformation(extent={{-13,88},{13,114}}))); - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph profs - "Proprietes eau" - annotation (Placement(transformation(extent={{50,80},{70,100}}, rotation=0))); -public - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph profe - "Proprietes eau" - annotation (Placement(transformation(extent={{20,80},{40,100}}, rotation=0))); -public - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph proce - "Proprietes eau" - annotation (Placement(transformation(extent={{-100,-100},{-80,-80}}, - rotation=0))); - ThermoSysPro.Properties.WaterSteam.Common.PropThermoSat lsat - annotation (Placement(transformation(extent={{-100,80},{-80,100}}, rotation= - 0))); - ThermoSysPro.Properties.WaterSteam.Common.PropThermoSat vsat - annotation (Placement(transformation(extent={{-60,80},{-40,100}}, rotation= - 0))); public - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Cep "Drain inlet" + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Cep(redeclare package Medium = Medium) "Drain inlet" annotation (Placement(transformation(extent={{-112,8},{-88,30}}, rotation=0))); public - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Cev "Vapor inlet" + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Cev(redeclare package Medium = Medium) "Vapor inlet" annotation (Placement(transformation(extent={{-112,50},{-88,72}}, rotation= 0))); -public - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph procs - "Proprietes eau" - annotation (Placement(transformation(extent={{80,-100},{100,-80}}, rotation= - 0))); - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph promf - "Proprietes eau" - annotation (Placement(transformation(extent={{80,80},{100,100}}, rotation=0))); equation - - /* Check that incoming fluids are compatible with fluid in volume */ - fluids[1] = ftype; - fluids[2] = Cvt.ftype; - fluids[3] = Cev.ftype; - fluids[4] = Cep.ftype; - fluids[5] = Cex.ftype; - - /* Check that the fluid type for the cooling pipe is water/steam */ - assert((ftype_p == FluidType.WaterSteam) or (ftype_p == FluidType.WaterSteamSimple), "StaticCondenserHEI: the fluid type for the cooling pipe must be water/steam"); - /* Unconnected connectors */ if (cardinality(Cev) == 0) then Cev.Q = 0; @@ -232,11 +193,8 @@ equation Cev.h_vol_1 = 1.e5; Cev.diff_res_1 = 0; Cev.diff_on_1 = false; - Cev.ftype = ftype; - Cev.Xco2 = 0; - Cev.Xh2o = 0; - Cev.Xo2 = 0; - Cev.Xso2 = 0; + Cev.Xi = Medium.X_default[1:Medium.nXi]; + Cev.SubC = Medium.C_default; end if; if (cardinality(Cep) == 0) then @@ -245,11 +203,8 @@ equation Cep.h_vol_1 = 1.e5; Cep.diff_res_1 = 0; Cep.diff_on_1 = false; - Cep.ftype = ftype; - Cep.Xco2 = 0; - Cep.Xh2o = 0; - Cep.Xo2 = 0; - Cep.Xso2 = 0; + Cep.Xi = Medium.X_default[1:Medium.nXi]; + Cep.SubC = Medium.C_default; end if; // Water/steam cavity @@ -273,7 +228,7 @@ equation // 0 = Cvt.Q*(Cvt.h - lsat.h) + Cev.Q*(Cev.h - lsat.h) + Cep.Q*(Cep.h - lsat.h) - W; /* Extraction water average specific enthalpy */ - Hml = lsat.h; + Hml = Medium.bubbleEnthalpy(sat); // Hml = (lsat.h + Hex)/2; Cvt.h_vol_2 = Hml; @@ -290,18 +245,16 @@ equation // Cex.h_vol_1 = Hex; /* Extraction water specific enthalpy */ - Hex = noEvent(if (rho_ex > 0) then lsat.h + ((Cex.P - Pcond)/rho_ex) else lsat.h); + Hex = noEvent(if (rho_ex > 0) then Medium.bubbleEnthalpy(sat) + ((Cex.P - Pcond)/rho_ex) else Medium.bubbleEnthalpy(sat)); /* Gravity pressure losses in the hot side */ DPgc = rho_ex*g*(z2c - z1c); /* Fluid composition in the cavity (no balance equations) */ - Cex.ftype = ftype; - - Cex.Xco2 = 0; - Cex.Xh2o = 0; - Cex.Xo2 = 0; - Cex.Xso2 = 0; + X = Cvt.Xi; + SubC = Cvt.SubC; + Cex.Xi = X; + Cex.SubC = SubC; /* Flow reversal */ if continuous_flow_reversal then @@ -370,16 +323,11 @@ equation Cse.diff_res_1 = Cee.diff_res_1 + 1/gamma_diff; Cee.diff_res_2 = Cse.diff_res_2 + 1/gamma_diff; - Cee.ftype = Cse.ftype; - - Cee.Xco2 = Cse.Xco2; - Cee.Xh2o = Cse.Xh2o; - Cee.Xo2 = Cse.Xo2; - Cee.Xso2 = Cse.Xso2; - - ftype_p = Cee.ftype; + Cee.Xi = Cse.Xi; + Cee.SubC = Cse.SubC; Qf = Cee.Q; + X_Cooling = Cee.Xi; /* Pressure losses in the cold side */ Cee.P - Cse.P = DPf; @@ -392,33 +340,33 @@ equation W = Qf*(Cse.h - Cee.h); /* Fluid thermodynamic properties of the hot side */ - proce = ThermoSysPro.Properties.Fluid.Ph(Cvt.P, Hmv, mode_c, fluid); - procs = ThermoSysPro.Properties.Fluid.Ph(Cex.P, Cex.h, mode_cs, fluid); - //procs = ThermoSysPro.Properties.Fluid.Ph(Pcond + Cex.P)/2, (lsat.h + Cex.h)/2, modecs); + state_ce = Medium.setState_phX(p=Cvt.P, h=Hmv, X=X); + state_cs = Medium.setState_phX(p=Cex.P, h=Cex.h, X=X); + // state_cs could alternatively use an average pressure and enthalpy between saturation and extraction outlet. - Tec = proce.T; - Tsc = procs.T; + Tec = Medium.temperature(state_ce); + Tsc = Medium.temperature(state_cs); - (lsat,vsat) = ThermoSysPro.Properties.Fluid.Water_sat_P(Pcond, fluid); + sat = Medium.setSat_p(Pcond); if (p_rhoc > 0) then rho_ex = p_rhoc; else - rho_ex = procs.d; + rho_ex = Medium.density(state_cs); end if; /* Fluid thermodynamic properties of the cold side */ - profe = ThermoSysPro.Properties.Fluid.Ph(Cee.P, Cee.h, mode_f, fluid_p); - profs = ThermoSysPro.Properties.Fluid.Ph(Cse.P, Cse.h, mode_f, fluid_p); - promf = ThermoSysPro.Properties.Fluid.Ph((Cee.P + Cse.P)/2, (Cee.h + Cse.h)/2, mode_f, fluid_p); + state_fe = Medium_Cooling.setState_phX(p=Cee.P, h=Cee.h, X=X_Cooling); + state_fs = Medium_Cooling.setState_phX(p=Cse.P, h=Cse.h, X=X_Cooling); + state_mf = Medium_Cooling.setState_phX(p=(Cee.P + Cse.P)/2, h=(Cee.h + Cse.h)/2, X=X_Cooling); - Tef = profe.T; - Tsf = profs.T; + Tef = Medium_Cooling.temperature(state_fe); + Tsf = Medium_Cooling.temperature(state_fs); if (p_rhof > 0) then rhof = p_rhof; else - rhof = promf.d; + rhof = Medium_Cooling.density(state_mf); end if; /* Calculation of the heat exchange surface */ @@ -461,19 +409,19 @@ equation U = Ucorr*U1*FM*FC*Fw; /* Calculation of the average specific heat capacity of the cold water */ - Cpmf = promf.cp; + Cpmf = Medium_Cooling.specificHeatCapacityCp(state_mf); /* Calculation of the expected HEI saturation temperature */ Tsat_att = Tef + (W/(Qf*Cpmf))*(1/(1 - Modelica.Math.exp(-(U*S_ech)/(Qf*Cpmf)))); /* Calculation of expected HEI saturation pressure */ - Psat_att = ThermoSysPro.Properties.Fluid.P_sat(Tsat_att, fluid); + Psat_att = Medium.saturationPressure(Tsat_att); /* Calculation of the HEI pressure cut-off */ Pcut_off = (5.752433E-04*(Tef-273.15)^3 + 1.735162E-02*(Tef-273.15)^2 + 8.052739E-02*(Tef-273.15) + 2.109159E+01)*100; /* Calculation of the HEI saturation temperature at pressure cut-off */ - Tcut_off = ThermoSysPro.Properties.Fluid.T_sat(Pcut_off, fluid); + Tcut_off = Medium.saturationTemperature(Pcut_off); /* Calculation of HEI zero-load pressure */ Pzero_load = (5.008000E-04*(Tef - 273.15)^3 + 2.039549E-02*(Tef - 273.15)^2 + 2.277566E-01*(Tef - 273.15) + 1.027824E+01)*100; @@ -489,7 +437,7 @@ equation end if; /* Calculation of the expected HEI corrected saturation pressure */ - Tsat = ThermoSysPro.Properties.Fluid.T_sat(Pcond, fluid); + Tsat = Medium.saturationTemperature(Pcond); /* Calculation of the Terminal Temperature Difference */ TTD = Tsat - Tsf; From 15a6faaecf284d693efcb0b5d5bf2c28dec4accd Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Thu, 7 May 2026 16:37:07 +0200 Subject: [PATCH 121/178] #125 FixedPowerHeatExchanger but examples not working right now need to see if there were examples with the old fluid library --- .../TestFixedPowerHeatExchanger.mo | 40 ++++++++++ .../TestFixedPowerHeatExchanger_Traces.mo | 45 +++++++++++ .../HeatExchangers/package.order | 2 + .../HeatExchangers/FixedPowerHeatExchanger.mo | 78 +++++++------------ 4 files changed, 114 insertions(+), 51 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestFixedPowerHeatExchanger.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestFixedPowerHeatExchanger_Traces.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestFixedPowerHeatExchanger.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestFixedPowerHeatExchanger.mo new file mode 100644 index 00000000..36776aa2 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestFixedPowerHeatExchanger.mo @@ -0,0 +1,40 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; +model TestFixedPowerHeatExchanger + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam; + + ThermoSysPro.Fluid.HeatExchangers.FixedPowerHeatExchanger fixedPowerHeatExchanger( + redeclare package Medium_c = Medium, + redeclare package Medium_f = Medium, + DW=1e5, + DPc=1, + DPf=1) annotation (Placement(transformation(extent={{-20,44},{0,64}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourcePc( + redeclare package Medium = Medium, + T0=340) annotation (Placement(transformation(extent={{-80,44},{-60,64}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourcePf( + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-60,24},{-40,44}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkPc( + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{40,44},{60,64}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkPf( + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{20,24},{40,44}}, rotation=0))); + ThermoSysPro.Fluid.Volumes.VolumeD volumePc( + redeclare package Medium = Medium, + V=1, + steady_state=false, + h0=2.8e5) annotation (Placement(transformation(extent={{10,44},{30,64}}, rotation=0))); + ThermoSysPro.Fluid.Volumes.VolumeD volumePf( + redeclare package Medium = Medium, + V=1, + steady_state=false, + h0=7e4) annotation (Placement(transformation(extent={{-10,24},{10,44}}, rotation=0))); +equation + connect(sourcePc.C, fixedPowerHeatExchanger.Ec) annotation (Line(points={{-60,54},{-20,54},{-20,48}}, color={0,0,255})); + connect(sourcePf.C, fixedPowerHeatExchanger.Ef) annotation (Line(points={{-40,34},{-20,34},{-20,57}}, color={0,0,255})); + connect(fixedPowerHeatExchanger.Sc, volumePc.Ce) annotation (Line(points={{0,48},{8,48},{8,54},{10,54}}, color={0,0,255})); + connect(volumePc.Cs3, sinkPc.C) annotation (Line(points={{30,54},{40,54}}, color={0,0,255})); + connect(fixedPowerHeatExchanger.Sf, volumePf.Ce) annotation (Line(points={{0,57},{6,57},{6,34},{-10,34}}, color={0,0,255})); + connect(volumePf.Cs3, sinkPf.C) annotation (Line(points={{10,34},{20,34}}, color={0,0,255})); + annotation (experiment(StopTime=1000), Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestFixedPowerHeatExchanger; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestFixedPowerHeatExchanger_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestFixedPowerHeatExchanger_Traces.mo new file mode 100644 index 00000000..27ccee15 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestFixedPowerHeatExchanger_Traces.mo @@ -0,0 +1,45 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; +model TestFixedPowerHeatExchanger_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam( + extraPropertiesNames={"Trace1", "Trace2", "Trace3"}, + C_nominal={0.1, 0.2, 0.3}, + C_default={0.2, 0.3, 0.4}); + + ThermoSysPro.Fluid.HeatExchangers.FixedPowerHeatExchanger fixedPowerHeatExchanger( + redeclare package Medium_c = Medium, + redeclare package Medium_f = Medium, + DW=1e5, + DPc=1, + DPf=1) annotation (Placement(transformation(extent={{-20,44},{0,64}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourcePc( + redeclare package Medium = Medium, + T0=340, + SubC0={0.1,0.2,0.3}) annotation (Placement(transformation(extent={{-80,44},{-60,64}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourcePf( + redeclare package Medium = Medium, + SubC0={0.4,0.5,0.6}) annotation (Placement(transformation(extent={{-60,24},{-40,44}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkPc( + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{40,44},{60,64}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkPf( + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{20,24},{40,44}}, rotation=0))); + ThermoSysPro.Fluid.Volumes.VolumeD volumePc( + redeclare package Medium = Medium, + V=1, + steady_state=false, + h0=2.8e5) annotation (Placement(transformation(extent={{10,44},{30,64}}, rotation=0))); + ThermoSysPro.Fluid.Volumes.VolumeD volumePf( + redeclare package Medium = Medium, + V=1, + steady_state=false, + h0=7e4) annotation (Placement(transformation(extent={{-10,24},{10,44}}, rotation=0))); +equation + connect(sourcePc.C, fixedPowerHeatExchanger.Ec) annotation (Line(points={{-60,54},{-20,54},{-20,48}}, color={0,0,255})); + connect(sourcePf.C, fixedPowerHeatExchanger.Ef) annotation (Line(points={{-40,34},{-20,34},{-20,57}}, color={0,0,255})); + connect(fixedPowerHeatExchanger.Sc, volumePc.Ce) annotation (Line(points={{0,48},{8,48},{8,54},{10,54}}, color={0,0,255})); + connect(volumePc.Cs3, sinkPc.C) annotation (Line(points={{30,54},{40,54}}, color={0,0,255})); + connect(fixedPowerHeatExchanger.Sf, volumePf.Ce) annotation (Line(points={{0,57},{6,57},{6,34},{-10,34}}, color={0,0,255})); + connect(volumePf.Cs3, sinkPf.C) annotation (Line(points={{10,34},{20,34}}, color={0,0,255})); + annotation (experiment(StopTime=1000), Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestFixedPowerHeatExchanger_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order index 74fb80f4..34baa843 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order @@ -1,6 +1,8 @@ TestDynamicOnePhaseFlowPipe TestDynamicOnePhaseFlowPipe_Traces TestDynamicOnePhaseFlowPipe_FlueGases +TestFixedPowerHeatExchanger +TestFixedPowerHeatExchanger_Traces TestStaticExchangerKS TestStaticExchangerKS_Traces TestStaticPlateHeatExchanger diff --git a/ThermoSysPro/Fluid/HeatExchangers/FixedPowerHeatExchanger.mo b/ThermoSysPro/Fluid/HeatExchangers/FixedPowerHeatExchanger.mo index 1ad2ba65..0732ed7b 100644 --- a/ThermoSysPro/Fluid/HeatExchangers/FixedPowerHeatExchanger.mo +++ b/ThermoSysPro/Fluid/HeatExchangers/FixedPowerHeatExchanger.mo @@ -1,8 +1,9 @@ within ThermoSysPro.Fluid.HeatExchangers; model FixedPowerHeatExchanger "Heat exchanger with fixed delta power" extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + + replaceable package Medium_c = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model for the hot fluid" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable package Medium_f = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model for the cold fluid" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Units.SI.Power DW=0 "Power exchanged between the hot and the cold fluid"; @@ -12,12 +13,6 @@ model FixedPowerHeatExchanger "Heat exchanger with fixed delta power" "Diffusion conductance for the hot fluid (active if diffusion=true in neighbouring volumes)"; parameter Units.SI.MassFlowRate gamma_diff_f=1e-4 "Diffusion conductance for the cold fluid (active if diffusion=true in neighbouring volumes)"; - parameter IF97Region region_c=IF97Region.All_regions "IF97 region for the hot fluid (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); - parameter IF97Region region_f=IF97Region.All_regions "IF97 region for the cold fluid (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); - -protected - parameter Integer mode_c=Integer(region_c) - 1 "IF97 region for the hot fluid. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; - parameter Integer mode_f=Integer(region_f) - 1 "IF97 region for the cold fluid. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; public Units.SI.Temperature Tec "Fluid temperature at the inlet of the hot side"; @@ -26,31 +21,22 @@ public Units.SI.Temperature Tsf "Fluid temperature at the outlet of the cold side"; Units.SI.MassFlowRate Qc(start=100) "Hot fluid mass flow rate"; Units.SI.MassFlowRate Qf(start=100) "Cold fluid mass flow rate"; - FluidType ftype_c "Fluid type for the hot fluid"; - Integer fluid_c=Integer(ftype_c) "Fluid number for the hot fluid"; - FluidType ftype_f "Fluid type for the cold fluid"; - Integer fluid_f=Integer(ftype_f) "Fluid number for the cold fluid"; + Medium_c.MassFraction Xc[Medium_c.nXi](start=Medium_c.X_default[1:Medium_c.nXi]) "Mass fractions of the hot fluid"; + Medium_f.MassFraction Xf[Medium_f.nXi](start=Medium_f.X_default[1:Medium_f.nXi]) "Mass fractions of the cold fluid"; + Medium_c.ThermodynamicState state_ce "Thermodynamic state of the hot fluid at the inlet"; + Medium_c.ThermodynamicState state_cs "Thermodynamic state of the hot fluid at the outlet"; + Medium_f.ThermodynamicState state_fe "Thermodynamic state of the cold fluid at the inlet"; + Medium_f.ThermodynamicState state_fs "Thermodynamic state of the cold fluid at the outlet"; public - Interfaces.Connectors.FluidInlet Ec annotation (Placement(transformation( + Interfaces.Connectors.FluidInlet Ec(redeclare package Medium = Medium_c) annotation (Placement(transformation( extent={{-68,-70},{-48,-50}}, rotation=0))); - Interfaces.Connectors.FluidInlet Ef annotation (Placement(transformation( + Interfaces.Connectors.FluidInlet Ef(redeclare package Medium = Medium_f) annotation (Placement(transformation( extent={{-110,-10},{-90,10}}, rotation=0))); - Interfaces.Connectors.FluidOutlet Sf annotation (Placement(transformation( + Interfaces.Connectors.FluidOutlet Sf(redeclare package Medium = Medium_f) annotation (Placement(transformation( extent={{88,-9},{108,11}}, rotation=0))); - Interfaces.Connectors.FluidOutlet Sc annotation (Placement(transformation( + Interfaces.Connectors.FluidOutlet Sc(redeclare package Medium = Medium_c) annotation (Placement(transformation( extent={{48,-70},{68,-50}}, rotation=0))); - - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph proce - annotation (Placement(transformation(extent={{-20,80},{0,100}}, rotation=0))); - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph procs - annotation (Placement(transformation(extent={{20,80},{40,100}}, rotation=0))); - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph profe - annotation (Placement(transformation(extent={{-100,80},{-80,100}}, rotation= - 0))); - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph profs - annotation (Placement(transformation(extent={{-60,80},{-40,100}}, rotation= - 0))); equation /* Mass flow rates */ @@ -65,14 +51,8 @@ equation Sc.diff_res_1 = Ec.diff_res_1 + 1/gamma_diff_c; Ec.diff_res_2 = Sc.diff_res_2 + 1/gamma_diff_c; - Ec.ftype = Sc.ftype; - - Ec.Xco2 = Sc.Xco2; - Ec.Xh2o = Sc.Xh2o; - Ec.Xo2 = Sc.Xo2; - Ec.Xso2 = Sc.Xso2; - - ftype_c = Ec.ftype; + Ec.Xi = Sc.Xi; + Ec.SubC = Sc.SubC; Ef.Q = Sf.Q; @@ -85,17 +65,13 @@ equation Sf.diff_res_1 = Ef.diff_res_1 + 1/gamma_diff_f; Ef.diff_res_2 = Sf.diff_res_2 + 1/gamma_diff_f; - Ef.ftype = Sf.ftype; - - Ef.Xco2 = Sf.Xco2; - Ef.Xh2o = Sf.Xh2o; - Ef.Xo2 = Sf.Xo2; - Ef.Xso2 = Sf.Xso2; - - ftype_f = Ef.ftype; + Ef.Xi = Sf.Xi; + Ef.SubC = Sf.SubC; Qc = Ec.Q; Qf = Ef.Q; + Xc = Ec.Xi; + Xf = Ef.Xi; /* Power exchanged between the hot and cold fluid */ DW = Qf*(Sf.h - Ef.h); @@ -106,18 +82,18 @@ equation Sf.P = if (Qf > 0) then Ef.P - DPf*Ef.P/100 else Ef.P + DPf*Ef.P/100; /* Fluid thermodynamic properties for the hot fluid */ - proce = ThermoSysPro.Properties.Fluid.Ph(Ec.P, Ec.h, mode_c, fluid_c); - procs = ThermoSysPro.Properties.Fluid.Ph(Sc.P, Sc.h, mode_c, fluid_c); + state_ce = Medium_c.setState_phX(p=Ec.P, h=Ec.h, X=Xc); + state_cs = Medium_c.setState_phX(p=Sc.P, h=Sc.h, X=Xc); - Tec = proce.T; - Tsc = procs.T; + Tec = Medium_c.temperature(state_ce); + Tsc = Medium_c.temperature(state_cs); /* Fluid thermodynamic properties for the cold fluid */ - profe = ThermoSysPro.Properties.Fluid.Ph(Ef.P, Ef.h, mode_f, fluid_f); - profs = ThermoSysPro.Properties.Fluid.Ph(Sf.P, Sf.h, mode_f, fluid_f); + state_fe = Medium_f.setState_phX(p=Ef.P, h=Ef.h, X=Xf); + state_fs = Medium_f.setState_phX(p=Sf.P, h=Sf.h, X=Xf); - Tef = profe.T; - Tsf = profs.T; + Tef = Medium_f.temperature(state_fe); + Tsf = Medium_f.temperature(state_fs); annotation ( Icon(coordinateSystem( From 723d7fce2d2006389b47e65c9ca9108f4362a2eb Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Thu, 7 May 2026 17:12:47 +0200 Subject: [PATCH 122/178] #125 NTUWaterHeater --- .../HeatExchangers/TestNTUWaterHeater.mo | 73 ++++++ .../TestNTUWaterHeater_FlueGases.mo | 83 +++++++ .../TestNTUWaterHeater_Traces.mo | 85 +++++++ .../HeatExchangers/package.order | 3 + .../Fluid/HeatExchangers/NTUWaterHeater.mo | 234 +++++++----------- 5 files changed, 329 insertions(+), 149 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestNTUWaterHeater.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestNTUWaterHeater_FlueGases.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestNTUWaterHeater_Traces.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestNTUWaterHeater.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestNTUWaterHeater.mo new file mode 100644 index 00000000..f0eea4e3 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestNTUWaterHeater.mo @@ -0,0 +1,73 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; +model TestNTUWaterHeater + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium_e = Properties.Media.WaterSteam; + replaceable package Medium_c = Properties.Media.WaterSteam; + + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ Water_inlet1( + redeclare package Medium = Medium_e, + Q0=1788.90, + h0=760.83e3, + P0=8270000) annotation (Placement(transformation(extent={{-174,-16},{-154,4}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.Sink Puit_condenseur2( + redeclare package Medium = Medium_e) annotation (Placement(transformation(extent={{137,-16},{157,4}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP Steam_inlet1( + redeclare package Medium = Medium_c, + option_temperature=false, + P0=17.49e5, + h0=2432.50e3) annotation (Placement(transformation(extent={{-174,84},{-154,104}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss6( + redeclare package Medium = Medium_e, + K=1e-4) annotation (Placement(transformation(extent={{-111,-16},{-91,4}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss7( + redeclare package Medium = Medium_c, + K=1e-4) annotation (Placement(transformation(extent={{-110,84},{-90,104}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.Sink Puit_condenseur3( + redeclare package Medium = Medium_c) annotation (Placement(transformation(extent={{136,-75},{156,-55}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss8( + redeclare package Medium = Medium_e, + K=1e-4) annotation (Placement(transformation(extent={{75,-16},{95,4}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss9( + redeclare package Medium = Medium_c, + K=1e-4) annotation (Placement(transformation(extent={{75,-75},{95,-55}}, rotation=0))); + ThermoSysPro.Fluid.HeatExchangers.NTUWaterHeater nTUWaterHeating1( + redeclare package Medium_e = Medium_e, + redeclare package Medium_c = Medium_c, + HeiF(start=900000), + HDesF(start=900000), + Hep(start=500000), + SCondDes=5752, + Ee( + P(start=82e5), + h_vol_2(start=760000), + Q(start=1790), + h(start=780000)), + Ep(Q(start=118)), + Ev(P(start=27.22e5), h_vol_2(start=2430000)), + KCond=5024, + KPurge=1767, + Sp(h_vol_1(start=780.13e3), h(fixed=true, start=780.13e3)), + lambdaE=67.1, + SPurge=1458, + Se(h(fixed=true, start=872.08e3), P(start=80.19e5, fixed=true))) annotation (Placement(transformation(extent={{-66,-77},{50,65}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss10( + redeclare package Medium = Medium_c, + K=1e-4) annotation (Placement(transformation(extent={{-110,35},{-90,55}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ Drain_inlet1( + redeclare package Medium = Medium_c, + Q0=118.02, + h0=889.89e3) annotation (Placement(transformation(extent={{-174,35},{-154,55}}, rotation=0))); +equation + connect(Water_inlet1.C, singularPressureLoss6.C1) annotation (Line(points={{-154,-6},{-111,-6}}, color={0,0,255})); + connect(Steam_inlet1.C, singularPressureLoss7.C1) annotation (Line(points={{-154,94},{-110,94}}, color={0,0,255})); + connect(singularPressureLoss8.C2, Puit_condenseur2.C) annotation (Line(points={{95,-6},{137,-6}}, color={0,0,255})); + connect(singularPressureLoss9.C2, Puit_condenseur3.C) annotation (Line(points={{95,-65},{136,-65}}, color={0,0,255})); + connect(singularPressureLoss7.C2, nTUWaterHeating1.Ev) annotation (Line(points={{-90,94},{26.8,94},{26.8,18.14}}, color={0,0,255})); + connect(nTUWaterHeating1.Se, singularPressureLoss8.C1) annotation (Line(points={{50,-6},{75,-6}}, color={0,0,255})); + connect(singularPressureLoss9.C1, nTUWaterHeating1.Sp) annotation (Line(points={{75,-65},{-44,-65},{-44,-29.43},{-42.8,-29.43}}, color={0,0,255})); + connect(singularPressureLoss6.C2, nTUWaterHeating1.Ee) annotation (Line(points={{-91,-6},{-66,-6}}, color={0,0,255})); + connect(Drain_inlet1.C, singularPressureLoss10.C1) annotation (Line(points={{-154,45},{-110,45}}, color={0,0,255})); + connect(singularPressureLoss10.C2, nTUWaterHeating1.Ep) annotation (Line(points={{-90,45},{-42.8,45},{-42.8,18.14}}, color={0,0,255})); + annotation (experiment(StopTime=1000), Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-200,-200},{200,200}}))); +end TestNTUWaterHeater; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestNTUWaterHeater_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestNTUWaterHeater_FlueGases.mo new file mode 100644 index 00000000..c4b542b3 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestNTUWaterHeater_FlueGases.mo @@ -0,0 +1,83 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; +model TestNTUWaterHeater_FlueGases + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium_e = Properties.Media.FlueGases; + replaceable package Medium_c = Properties.Media.WaterSteam; + + parameter Medium_e.MassFraction X0[Medium_e.nX]={0.1,0.2,0.3,0.2,0.2}; + + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ Water_inlet1( + redeclare package Medium = Medium_e, + Q0=1788.90, + P0=8270000, + option_temperature=true, + T0=573.15, + X0=X0) annotation (Placement(transformation(extent={{-174,-16},{-154,4}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.Sink Puit_condenseur2( + redeclare package Medium = Medium_e, + option_temperature=true, + T0=573.15) annotation (Placement(transformation(extent={{137,-16},{157,4}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP Steam_inlet1( + redeclare package Medium = Medium_c, + option_temperature=false, + P0=17.49e5, + h0=2432.50e3) annotation (Placement(transformation(extent={{-174,84},{-154,104}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss6( + redeclare package Medium = Medium_e, + K=1e-4) annotation (Placement(transformation(extent={{-111,-16},{-91,4}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss7( + redeclare package Medium = Medium_c, + K=1e-4) annotation (Placement(transformation(extent={{-110,84},{-90,104}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.Sink Puit_condenseur3( + redeclare package Medium = Medium_c) annotation (Placement(transformation(extent={{136,-75},{156,-55}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss8( + redeclare package Medium = Medium_e, + K=1e-4) annotation (Placement(transformation(extent={{75,-16},{95,4}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss9( + redeclare package Medium = Medium_c, + K=1e-4) annotation (Placement(transformation(extent={{75,-75},{95,-55}}, rotation=0))); + ThermoSysPro.Fluid.HeatExchangers.NTUWaterHeater nTUWaterHeating1( + redeclare package Medium_e = Medium_e, + redeclare package Medium_c = Medium_c, + HeiF(start=2879115.64844), + HDesF(start=2879115.64844), + Hep(start=500000), + SCondDes=5752, + Ee( + P(start=82e5), + h_vol_2(start=2879115.64844), + Q(start=1790), + h(start=2879115.64844), + Xi(start={0.1,0.2,0.3,0.2,0.2})), + Ep(Q(start=118)), + Ev(P(start=27.22e5), h_vol_2(start=2430000)), + KCond=5024, + KPurge=1767, + Sp(h_vol_1(start=780.13e3), h(fixed=true, start=780.13e3)), + lambdaE=67.1, + SPurge=1458, + Se( + h(fixed=true, start=2879115.64844), + P(start=80.19e5, fixed=true), + Xi(start={0.1,0.2,0.3,0.2,0.2}))) annotation (Placement(transformation(extent={{-66,-77},{50,65}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss10( + redeclare package Medium = Medium_c, + K=1e-4) annotation (Placement(transformation(extent={{-110,35},{-90,55}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ Drain_inlet1( + redeclare package Medium = Medium_c, + Q0=118.02, + h0=889.89e3) annotation (Placement(transformation(extent={{-174,35},{-154,55}}, rotation=0))); +equation + connect(Water_inlet1.C, singularPressureLoss6.C1) annotation (Line(points={{-154,-6},{-111,-6}}, color={0,0,255})); + connect(Steam_inlet1.C, singularPressureLoss7.C1) annotation (Line(points={{-154,94},{-110,94}}, color={0,0,255})); + connect(singularPressureLoss8.C2, Puit_condenseur2.C) annotation (Line(points={{95,-6},{137,-6}}, color={0,0,255})); + connect(singularPressureLoss9.C2, Puit_condenseur3.C) annotation (Line(points={{95,-65},{136,-65}}, color={0,0,255})); + connect(singularPressureLoss7.C2, nTUWaterHeating1.Ev) annotation (Line(points={{-90,94},{26.8,94},{26.8,18.14}}, color={0,0,255})); + connect(nTUWaterHeating1.Se, singularPressureLoss8.C1) annotation (Line(points={{50,-6},{75,-6}}, color={0,0,255})); + connect(singularPressureLoss9.C1, nTUWaterHeating1.Sp) annotation (Line(points={{75,-65},{-44,-65},{-44,-29.43},{-42.8,-29.43}}, color={0,0,255})); + connect(singularPressureLoss6.C2, nTUWaterHeating1.Ee) annotation (Line(points={{-91,-6},{-66,-6}}, color={0,0,255})); + connect(Drain_inlet1.C, singularPressureLoss10.C1) annotation (Line(points={{-154,45},{-110,45}}, color={0,0,255})); + connect(singularPressureLoss10.C2, nTUWaterHeating1.Ep) annotation (Line(points={{-90,45},{-42.8,45},{-42.8,18.14}}, color={0,0,255})); + annotation (experiment(StopTime=1000), Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-200,-200},{200,200}}))); +end TestNTUWaterHeater_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestNTUWaterHeater_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestNTUWaterHeater_Traces.mo new file mode 100644 index 00000000..a79a6470 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestNTUWaterHeater_Traces.mo @@ -0,0 +1,85 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; +model TestNTUWaterHeater_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium_e = Properties.Media.WaterSteam( + extraPropertiesNames={"Trace1","Trace2","Trace3"}, + C_nominal={0.1,0.2,0.3}, + C_default={0.2,0.3,0.4}); + replaceable package Medium_c = Properties.Media.WaterSteam( + extraPropertiesNames={"Trace4","Trace5","Trace6"}, + C_nominal={0.3,0.4,0.5}, + C_default={0.4,0.5,0.6}); + + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ Water_inlet1( + redeclare package Medium = Medium_e, + Q0=1788.90, + h0=760.83e3, + P0=8270000, + SubC0={0.4,0.5,0.6}) + annotation (Placement(transformation(extent={{-174,-16},{-154,4}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.Sink Puit_condenseur2( + redeclare package Medium = Medium_e) annotation (Placement(transformation(extent={{137,-16},{157,4}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP Steam_inlet1( + redeclare package Medium = Medium_c, + option_temperature=false, + P0=1749000, + h0=2432.50e3, + SubC0={0.4,0.5,0.6}) + annotation (Placement(transformation(extent={{-174,84},{-154,104}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss6( + redeclare package Medium = Medium_e, + K=1e-4) annotation (Placement(transformation(extent={{-111,-16},{-91,4}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss7( + redeclare package Medium = Medium_c, + K=1e-4) annotation (Placement(transformation(extent={{-110,84},{-90,104}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.Sink Puit_condenseur3( + redeclare package Medium = Medium_c) annotation (Placement(transformation(extent={{136,-75},{156,-55}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss8( + redeclare package Medium = Medium_e, + K=1e-4) annotation (Placement(transformation(extent={{75,-16},{95,4}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss9( + redeclare package Medium = Medium_c, + K=1e-4) annotation (Placement(transformation(extent={{75,-75},{95,-55}}, rotation=0))); + ThermoSysPro.Fluid.HeatExchangers.NTUWaterHeater nTUWaterHeating1( + redeclare package Medium_e = Medium_e, + redeclare package Medium_c = Medium_c, + HeiF(start=900000), + HDesF(start=900000), + Hep(start=500000), + SCondDes=5752, + Ee( + P(start=82e5), + h_vol_2(start=760000), + Q(start=1790), + h(start=780000)), + Ep(Q(start=118)), + Ev(P(start=27.22e5), h_vol_2(start=2430000)), + KCond=5024, + KPurge=1767, + Sp(h_vol_1(start=780.13e3), h(fixed=true, start=780.13e3)), + lambdaE=67.1, + SPurge=1458, + Se(h(fixed=true, start=872.08e3), P(start=80.19e5, fixed=true))) annotation (Placement(transformation(extent={{-66,-77},{50,65}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss10( + redeclare package Medium = Medium_c, + K=1e-4) annotation (Placement(transformation(extent={{-110,35},{-90,55}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ Drain_inlet1( + redeclare package Medium = Medium_c, + Q0=118.02, + h0=889.89e3, + SubC0={0.5,0.6,0.7}) + annotation (Placement(transformation(extent={{-174,35},{-154,55}}, rotation=0))); +equation + connect(Water_inlet1.C, singularPressureLoss6.C1) annotation (Line(points={{-154,-6},{-111,-6}}, color={0,0,255})); + connect(Steam_inlet1.C, singularPressureLoss7.C1) annotation (Line(points={{-154,94},{-110,94}}, color={0,0,255})); + connect(singularPressureLoss8.C2, Puit_condenseur2.C) annotation (Line(points={{95,-6},{137,-6}}, color={0,0,255})); + connect(singularPressureLoss9.C2, Puit_condenseur3.C) annotation (Line(points={{95,-65},{136,-65}}, color={0,0,255})); + connect(singularPressureLoss7.C2, nTUWaterHeating1.Ev) annotation (Line(points={{-90,94},{26.8,94},{26.8,18.14}}, color={0,0,255})); + connect(nTUWaterHeating1.Se, singularPressureLoss8.C1) annotation (Line(points={{50,-6},{75,-6}}, color={0,0,255})); + connect(singularPressureLoss9.C1, nTUWaterHeating1.Sp) annotation (Line(points={{75,-65},{-44,-65},{-44,-29.43},{-42.8,-29.43}}, color={0,0,255})); + connect(singularPressureLoss6.C2, nTUWaterHeating1.Ee) annotation (Line(points={{-91,-6},{-66,-6}}, color={0,0,255})); + connect(Drain_inlet1.C, singularPressureLoss10.C1) annotation (Line(points={{-154,45},{-110,45}}, color={0,0,255})); + connect(singularPressureLoss10.C2, nTUWaterHeating1.Ep) annotation (Line(points={{-90,45},{-42.8,45},{-42.8,18.14}}, color={0,0,255})); + annotation (experiment(StopTime=1000), Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-200,-200},{200,200}}))); +end TestNTUWaterHeater_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order index 34baa843..c0f22855 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order @@ -8,6 +8,9 @@ TestStaticExchangerKS_Traces TestStaticPlateHeatExchanger TestStaticPlateHeatExchanger_Traces TestStaticPlateHeatExchanger_FlueGases +TestNTUWaterHeater +TestNTUWaterHeater_Traces +TestNTUWaterHeater_FlueGases TestSimpleDynamicCondenser TestSimpleDynamicCondenser_Traces TestSimpleStaticCondenser diff --git a/ThermoSysPro/Fluid/HeatExchangers/NTUWaterHeater.mo b/ThermoSysPro/Fluid/HeatExchangers/NTUWaterHeater.mo index dc5082df..6105d18c 100644 --- a/ThermoSysPro/Fluid/HeatExchangers/NTUWaterHeater.mo +++ b/ThermoSysPro/Fluid/HeatExchangers/NTUWaterHeater.mo @@ -1,10 +1,9 @@ within ThermoSysPro.Fluid.HeatExchangers; model NTUWaterHeater "NTU water heater" - extends - ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.WaterSteamFluidTypeParameterInterface; extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + + replaceable package Medium_e = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model for the water side" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable package Medium_c = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialTwoPhaseThermoSysProMedium "Medium model for the condensing side" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Real lambdaE=0 "Pressure loss coefficient on the water side"; parameter Units.SI.Area SCondDes=3000 @@ -18,23 +17,8 @@ model NTUWaterHeater "NTU water heater" "Diffusion conductance for the water side (active if diffusion=true in neighbouring volumes)"; parameter Boolean continuous_flow_reversal=false "true: continuous flow reversal - false: discontinuous flow reversal"; parameter Boolean diffusion=false "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; - parameter IF97Region region_eeF=IF97Region.All_regions "IF97 region at the inlet of the water side (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); - parameter IF97Region region_seF=IF97Region.All_regions "IF97 region at the outlet of the water side (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); - parameter IF97Region region_evC=IF97Region.All_regions "IF97 region at the inlet of the vapor side (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); - parameter IF97Region region_mF=IF97Region.All_regions "IF97 region in the drain (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); - parameter IF97Region region_epC=IF97Region.All_regions "IF97 region at the inlet of the drain (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); - parameter IF97Region region_spC=IF97Region.All_regions "IF97 region at the outlet of the drain (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); - parameter IF97Region region_flash=IF97Region.All_regions "IF97 region in the flash zone of the drain (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); protected - parameter Integer fluid=Integer(ftype) "Fluid number"; - parameter Integer mode_eeF=Integer(region_eeF) "IF97 region at the inlet of the water side. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; - parameter Integer mode_seF=Integer(region_seF) "IF97 region at the outlet of the water side. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; - parameter Integer mode_evC=Integer(region_evC) "IF97 region at the inlet of the vapor side. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; - parameter Integer mode_mF=Integer(region_mF) "IF97 region in the drain. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; - parameter Integer mode_epC=Integer(region_epC) "IF97 region at the inlet of the drain. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; - parameter Integer mode_spC=Integer(region_spC) "IF97 region at the outlet of the drain. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; - parameter Integer mode_flash=Integer(region_flash) "IF97 region in the flash zone of the drain. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; parameter Units.SI.MassFlowRate gamma0=1.e-4 "Pseudo-diffusion conductance use for continuous flow reversal (active if diffusion=false and continuous_flow_reversal = true)"; parameter Real eps=1.e-3 "Small number for pressure loss equation"; @@ -63,13 +47,9 @@ public Units.SI.SpecificEnthalpy Hep(start=3e5) "Mixing specific enthalpy of the drain and the condensate"; Units.SI.Density rho(start=1e3, min=0) "Average water density"; - FluidType fluids[4] "Fluids mixing in volume"; - FluidType ftype_e "Fluid type for the water side"; - Integer fluid_e=Integer(ftype_e) "Fluid number for the water side"; - ThermoSysPro.Units.SI.MassFraction Xco2 "CO2 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xh2o "H20 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xo2 "O2 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xso2 "SO2 mass fraction"; + Medium_e.MassFraction Xe[Medium_e.nXi](start=Medium_e.X_default[1:Medium_e.nXi]) "Mass fractions on the water side"; + Medium_c.MassFraction Xc[Medium_c.nXi](start=Medium_c.X_default[1:Medium_c.nXi]) "Mass fractions in the condensing volume"; + Medium_c.ExtraProperty SubCc[Medium_c.nC](quantity=Medium_c.extraPropertiesNames, start=Medium_c.C_default) "Trace substances in the condensing volume"; Units.SI.Power Jep "Thermal power diffusion from the inlet of the drain"; Units.SI.Power Jev "Thermal power diffusion from the inlet of the vapor side"; Units.SI.Power Jsp "Thermal power diffusion from the outlet of the drain"; @@ -84,90 +64,46 @@ public Real rev "Value of r(Q/gamma) for inlet for the inlet of the vapor side"; Real rsp "Value of r(Q/gamma) for the outlet of the drain"; - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph proeeF - "Water inlet fluid properties (4F)" - annotation (Placement(transformation(extent={{-100,-100},{-80,-80}}, - rotation=0))); - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph proseF - "Water outlet fluid properties (1F)" - annotation (Placement(transformation(extent={{-70,-100},{-50,-80}}, - rotation=0))); - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph prospC - "Drain outlet fluid properties (4C)" - annotation (Placement(transformation(extent={{-100,80},{-80,100}}, rotation= - 0))); - Interfaces.Connectors.FluidInlet Ee "Water inlet" + Medium_e.ThermodynamicState state_eeF "Water inlet fluid state (4F)"; + Medium_e.ThermodynamicState state_seF "Water outlet fluid state (1F)"; + Medium_c.ThermodynamicState state_spC "Drain outlet fluid state (4C)"; + Interfaces.Connectors.FluidInlet Ee(redeclare package Medium = Medium_e) "Water inlet" annotation (Placement(transformation(extent={{-90,-10},{-110,10}}, rotation= 0))); - Interfaces.Connectors.FluidOutlet Se "Water outlet" annotation (Placement( + Interfaces.Connectors.FluidOutlet Se(redeclare package Medium = Medium_e) "Water outlet" annotation (Placement( transformation(extent={{110,-10},{90,10}}, rotation=0))); - Interfaces.Connectors.FluidInlet Ep "Drain inlet" + Interfaces.Connectors.FluidInlet Ep(redeclare package Medium = Medium_c) "Drain inlet" annotation (Placement(transformation(extent={{-50,24},{-70,44}}, rotation=0))); - Interfaces.Connectors.FluidOutlet Sp "Drain outlet" annotation (Placement( + Interfaces.Connectors.FluidOutlet Sp(redeclare package Medium = Medium_c) "Drain outlet" annotation (Placement( transformation(extent={{-50,-43},{-70,-23}}, rotation=0))); - Interfaces.Connectors.FluidInlet Ev "Vapor inlet" + Interfaces.Connectors.FluidInlet Ev(redeclare package Medium = Medium_c) "Vapor inlet" annotation (Placement(transformation(extent={{70,24},{50,44}}, rotation=0), iconTransformation(extent={{70,24},{50,44}}))); - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph proevC - "Vapor inlet fluid properties (1C)" - annotation (Placement(transformation(extent={{-70,80},{-50,100}}, rotation= - 0))); - ThermoSysPro.Properties.WaterSteam.Common.PropThermoSat lsatC - "Saturation conditions for the liquid phase" - annotation (Placement(transformation(extent={{10,40},{30,60}}, rotation=0))); - ThermoSysPro.Properties.WaterSteam.Common.PropThermoSat vsatC - "Saturation conditions for the vapor phase" - annotation (Placement(transformation(extent={{-30,40},{-10,60}}, rotation=0))); - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph promeF - "Average water fluid properties (between 4F and 3F)" - annotation (Placement(transformation(extent={{-40,-100},{-20,-80}}, - rotation=0))); - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph prodesmC - "Deheating average fluid properties (between 1C and 2C)" - annotation (Placement(transformation(extent={{50,80},{70,100}}, rotation=0))); - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph promcF - "Average deheating fluid properties (between 3F and 2F)" - annotation (Placement(transformation(extent={{50,-100},{70,-80}}, rotation= - 0))); - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph prodesF - "Deheating inlet fluid properties (2F)" - annotation (Placement(transformation(extent={{-10,-100},{10,-80}}, rotation= - 0))); - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph prodesmF - "Average deheating fluid properties (between 2F and 1F)" - annotation (Placement(transformation(extent={{20,-100},{40,-80}}, rotation= - 0))); - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph prosp - "Drain outlet fluid properties before cooling (near 3C)" - annotation (Placement(transformation(extent={{-40,80},{-20,100}}, rotation= - 0))); - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph prompC - "Average fluid properties in the drain (between 3C and 4C)" - annotation (Placement(transformation(extent={{20,80},{40,100}}, rotation=0))); - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph prompF - "Average water fluid properties (between 4F and 3F)" - annotation (Placement(transformation(extent={{-100,-60},{-80,-40}}, - rotation=0))); - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph proecF - "Water fluid properties (3F)" - annotation (Placement(transformation(extent={{80,-100},{100,-80}}, rotation= - 0))); - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph flashepC - "Flash fluid properties (near 4C)" - annotation (Placement(transformation(extent={{80,80},{100,100}}, rotation=0))); + Medium_c.ThermodynamicState state_evC "Vapor inlet fluid state (1C)"; + Medium_c.SaturationProperties satC "Saturation conditions at the vapor inlet pressure"; + Medium_c.ThermodynamicState state_lsatC "Saturated liquid state"; + Medium_c.ThermodynamicState state_vsatC "Saturated vapor state"; + Medium_e.ThermodynamicState state_meF "Average water fluid state (between 4F and 3F)"; + Medium_c.ThermodynamicState state_desmC "Deheating average fluid state (between 1C and 2C)"; + Medium_e.ThermodynamicState state_mcF "Average deheating fluid state (between 3F and 2F)"; + Medium_e.ThermodynamicState state_desF "Deheating inlet fluid state (2F)"; + Medium_e.ThermodynamicState state_desmF "Average deheating fluid state (between 2F and 1F)"; + Medium_c.ThermodynamicState state_sp "Drain outlet fluid state before cooling (near 3C)"; + Medium_c.ThermodynamicState state_mpC "Average fluid state in the drain (between 3C and 4C)"; + Medium_e.ThermodynamicState state_mpF "Average water fluid state (between 4F and 3F)"; + Medium_e.ThermodynamicState state_ecF "Water fluid state (3F)"; + Units.SI.SpecificHeatCapacity cp_desmC; + Units.SI.SpecificHeatCapacity cp_mcF; + Units.SI.SpecificHeatCapacity cp_desmF; + Units.SI.SpecificHeatCapacity cp_mpC; + Units.SI.SpecificHeatCapacity cp_mpF; + Units.SI.Temperature T_evC; + Units.SI.Temperature T_desF; + Units.SI.Temperature T_sp; + Units.SI.Temperature T_eeF; + Real x_flashepC "Steam mass fraction in the flash state"; equation - /* Check that incoming fluids are compatible with fluid in volume */ - fluids[1] = ftype; - fluids[2] = Ev.ftype; - fluids[3] = Ep.ftype; - fluids[4] = Sp.ftype; - - assert(ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.isCompatible(fluids), "NTUWaterHeater: fluids mixing in water heater volume are not compatible with each other"); - - /* Check that the fluid type is water/steam for the water side */ - assert((ftype_e == FluidType.WaterSteam) or (ftype_e == FluidType.WaterSteamSimple), "NTUWaterHeater: the fluid type for the water side must be water/steam"); - /* Unconnected connectors */ if cardinality(Ep) == 0 then Ep.Q = 0; @@ -175,11 +111,8 @@ equation Ep.h_vol_1 = 1.e5; Ep.diff_res_1 = 0; Ep.diff_on_1 = false; - Ep.ftype = ftype; - Ep.Xco2 = 0; - Ep.Xh2o = 0; - Ep.Xo2 = 0; - Ep.Xso2 = 0; + Ep.Xi = Medium_c.X_default[1:Medium_c.nXi]; + Ep.SubC = fill(0, Medium_c.nC); end if; // Cooling pipe @@ -196,14 +129,10 @@ equation Se.diff_res_1 = Ee.diff_res_1 + 1/gamma_diff_e; Ee.diff_res_2 = Se.diff_res_2 + 1/gamma_diff_e; - Ee.ftype = Se.ftype; + Ee.Xi = Se.Xi; + Ee.SubC = Se.SubC; - Ee.Xco2 = Se.Xco2; - Ee.Xh2o = Se.Xh2o; - Ee.Xo2 = Se.Xo2; - Ee.Xso2 = Se.Xso2; - - ftype_e = Ee.ftype; + Xe = Ee.Xi; /* Pressure loss equation in the water pipe */ Ee.P - Se.P = lambdaE*ThermoSysPro.Functions.ThermoSquare(Ee.Q, eps)/rho; @@ -237,7 +166,7 @@ equation if (HsatvC < Ev.h) then 0 = Ev.Q*(Ev.h - HsatvC) - Ee.Q*(Se.h - HDesF) + J/3; Wdes = Ee.Q*(Se.h - HDesF); - Wdes = noEvent(min(Ev.Q*prodesmC.cp, Ee.Q*prodesmF.cp)*ThermoSysPro.Correlations.Thermal.WBHeatExchangerEfficiency(Ev.Q, Ee.Q, prodesmC.cp, prodesmF.cp, KCond/2, SDes, 1)*(proevC.T - prodesF.T)); + Wdes = noEvent(min(Ev.Q*cp_desmC, Ee.Q*cp_desmF)*ThermoSysPro.Correlations.Thermal.WBHeatExchangerEfficiency(Ev.Q, Ee.Q, cp_desmC, cp_desmF, KCond/2, SDes, 1)*(T_evC - T_desF)); /* If deheating is absent */ else Wdes = 1e-9; @@ -256,20 +185,20 @@ equation end if; Wcond = Ee.Q*(HDesF - HeiF); - Wcond = Ee.Q*promcF.cp*ThermoSysPro.Correlations.Thermal.WBHeatExchangerEfficiency(Ev.Q, Ee.Q, 1.e20, promcF.cp, KCond, (SCondDes - SDes), 0.5)*(TsatC - TeiF); + Wcond = Ee.Q*cp_mcF*ThermoSysPro.Correlations.Thermal.WBHeatExchangerEfficiency(Ev.Q, Ee.Q, 1.e20, cp_mcF, KCond, (SCondDes - SDes), 0.5)*(TsatC - TeiF); // Flash zone //----------- /* Heat power in case of partial vaporization in the drain */ - if (flashepC.x > 0) then + if (x_flashepC > 0) then Wflash = Ep.Q*(Ep.h - HsateC); else Wflash = 0; end if; /* Condition for partial vaporisation in the drain (flash) */ - if (flashepC.x > 0) then + if (x_flashepC > 0) then Hep = HsateC; else Sp.Q*Hep = HsateC*Ev.Q + Ep.h*Ep.Q; @@ -282,27 +211,21 @@ equation if noEvent(SPurge > 0) then 0 = Sp.Q*(Hep - Sp.h) - Ee.Q*(HeiF - Ee.h) + J/3; Wpurge = Ee.Q*(HeiF - Ee.h); - Wpurge = noEvent(min(Sp.Q*prompC.cp, Ee.Q*prompF.cp)*ThermoSysPro.Correlations.Thermal.WBHeatExchangerEfficiency(Sp.Q, Ee.Q, prompC.cp, prompF.cp, KPurge, SPurge, 0)*(prosp.T - proeeF.T)); - TeiF = proecF.T; + Wpurge = noEvent(min(Sp.Q*cp_mpC, Ee.Q*cp_mpF)*ThermoSysPro.Correlations.Thermal.WBHeatExchangerEfficiency(Sp.Q, Ee.Q, cp_mpC, cp_mpF, KPurge, SPurge, 0)*(T_sp - T_eeF)); + TeiF = Medium_e.temperature(state_ecF); else HeiF = Ee.h; Wpurge = 0; Hep = Sp.h; - TeiF = proeeF.T; + TeiF = T_eeF; end if; /* Fluid composition balance equations */ - 0 = Ep.Xco2*Ep.Q + Ev.Xco2*Ev.Q - Sp.Xco2*Sp.Q; - 0 = Ep.Xh2o*Ep.Q + Ev.Xh2o*Ev.Q - Sp.Xh2o*Sp.Q; - 0 = Ep.Xo2*Ep.Q + Ev.Xo2*Ev.Q - Sp.Xo2*Sp.Q; - 0 = Ep.Xso2*Ep.Q + Ev.Xso2*Ev.Q - Sp.Xso2*Sp.Q; - - Sp.ftype = ftype; + zeros(Medium_c.nXi) = Ep.Xi*Ep.Q + Ev.Xi*Ev.Q - Sp.Xi*Sp.Q; + zeros(Medium_c.nC) = Ep.SubC*Ep.Q + Ev.SubC*Ev.Q - Sp.SubC*Sp.Q; - Sp.Xco2 = Xco2; - Sp.Xh2o = Xh2o; - Sp.Xo2 = Xo2; - Sp.Xso2 = Xso2; + Xc = Sp.Xi; + SubCc = Sp.SubC; /* Flow reversal */ if continuous_flow_reversal then @@ -349,30 +272,43 @@ equation Sp.diff_on_1 = diffusion; /* Fluid thermodynamic properties */ - proeeF = ThermoSysPro.Properties.Fluid.Ph(Ee.P, Ee.h, mode_eeF, fluid_e); - proseF = ThermoSysPro.Properties.Fluid.Ph(Se.P, Se.h, mode_seF, fluid_e); - promeF = ThermoSysPro.Properties.Fluid.Ph((Ee.P + Se.P)/2,(Ee.h + Se.h)/2, mode_eeF, fluid_e); - proevC = ThermoSysPro.Properties.Fluid.Ph(Ev.P, Ev.h, mode_evC, fluid); - prospC = ThermoSysPro.Properties.Fluid.Ph(Sp.P, Sp.h, mode_spC, fluid); - prosp = ThermoSysPro.Properties.Fluid.Ph(Ev.P, Hep, mode_spC, fluid); - prodesF = ThermoSysPro.Properties.Fluid.Ph(Se.P, HDesF, mode_seF, fluid_e); - prompC = ThermoSysPro.Properties.Fluid.Ph(Ev.P, (Hep + Sp.h)/2, mode_spC, fluid); - prodesmC = ThermoSysPro.Properties.Fluid.Ph(Ev.P, (vsatC.h + Ev.h)/2, mode_evC, fluid); - prompF = ThermoSysPro.Properties.Fluid.Ph(Ee.P, (Ee.h + HeiF)/2, mode_eeF, fluid_e); - promcF = ThermoSysPro.Properties.Fluid.Ph((Ee.P + Se.P)/2, (HeiF + HDesF)/2, mode_mF, fluid_e); - prodesmF = ThermoSysPro.Properties.Fluid.Ph(Se.P, (HDesF + Se.h)/2, mode_seF, fluid_e); - proecF = ThermoSysPro.Properties.Fluid.Ph(Ee.P, HeiF, mode_eeF, fluid_e); - flashepC = ThermoSysPro.Properties.Fluid.Ph(Ev.P, Ep.h, mode_flash, fluid); + state_eeF = Medium_e.setState_phX(p=Ee.P, h=Ee.h, X=Xe); + state_seF = Medium_e.setState_phX(p=Se.P, h=Se.h, X=Xe); + state_meF = Medium_e.setState_phX(p=(Ee.P + Se.P)/2, h=(Ee.h + Se.h)/2, X=Xe); + state_evC = Medium_c.setState_phX(p=Ev.P, h=Ev.h, X=Ev.Xi); + state_spC = Medium_c.setState_phX(p=Sp.P, h=Sp.h, X=Xc); + state_sp = Medium_c.setState_phX(p=Ev.P, h=Hep, X=Xc); + state_desF = Medium_e.setState_phX(p=Se.P, h=HDesF, X=Xe); + state_mpC = Medium_c.setState_phX(p=Ev.P, h=(Hep + Sp.h)/2, X=Xc); + state_desmC = Medium_c.setState_phX(p=Ev.P, h=(HsatvC + Ev.h)/2, X=Ev.Xi); + state_mpF = Medium_e.setState_phX(p=Ee.P, h=(Ee.h + HeiF)/2, X=Xe); + state_mcF = Medium_e.setState_phX(p=(Ee.P + Se.P)/2, h=(HeiF + HDesF)/2, X=Xe); + state_desmF = Medium_e.setState_phX(p=Se.P, h=(HDesF + Se.h)/2, X=Xe); + state_ecF = Medium_e.setState_phX(p=Ee.P, h=HeiF, X=Xe); + cp_desmC = Medium_c.specificHeatCapacityCp(state_desmC); + cp_mcF = Medium_e.specificHeatCapacityCp(state_mcF); + cp_desmF = Medium_e.specificHeatCapacityCp(state_desmF); + cp_mpC = Medium_c.specificHeatCapacityCp(state_mpC); + cp_mpF = Medium_e.specificHeatCapacityCp(state_mpF); + + T_evC = Medium_c.temperature(state_evC); + T_desF = Medium_e.temperature(state_desF); + T_sp = Medium_c.temperature(state_sp); + T_eeF = Medium_e.temperature(state_eeF); + + x_flashepC = noEvent(if (Ep.h <= HsateC) then 0 else if (Ep.h >= HsatvC) then 1 else (Ep.h - HsateC)/(HsatvC - HsateC)); /* Fluid density */ - rho = promeF.d; + rho = Medium_e.density(state_meF); /* Saturation point at the vapor inlet pressure */ - (lsatC, vsatC) = ThermoSysPro.Properties.Fluid.Water_sat_P(Ev.P, fluid); + satC = Medium_c.setSat_p(Ev.P); + state_lsatC = Medium_c.setBubbleState(satC); + state_vsatC = Medium_c.setDewState(satC); - TsatC = lsatC.T; - HsateC = lsatC.h; - HsatvC = vsatC.h; + TsatC = Medium_c.saturationTemperature(Ev.P); + HsateC = Medium_c.specificEnthalpy(state_lsatC); + HsatvC = Medium_c.specificEnthalpy(state_vsatC); annotation ( Icon(coordinateSystem( From 952bcf8b293417a6b2bb798ab4ab835d4f1e5d0a Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Fri, 8 May 2026 09:26:18 +0200 Subject: [PATCH 123/178] #125 StaticExchangerDTorWorEff --- .../TestStaticExchangerDTorWorEff.mo | 37 +++++++++ ...TestStaticExchangerDTorWorEff_FlueGases.mo | 51 ++++++++++++ .../TestStaticExchangerDTorWorEff_Traces.mo | 42 ++++++++++ .../HeatExchangers/package.order | 3 + .../StaticExchangerDTorWorEff.mo | 79 +++++++++---------- 5 files changed, 170 insertions(+), 42 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticExchangerDTorWorEff.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticExchangerDTorWorEff_FlueGases.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticExchangerDTorWorEff_Traces.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticExchangerDTorWorEff.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticExchangerDTorWorEff.mo new file mode 100644 index 00000000..e054d592 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticExchangerDTorWorEff.mo @@ -0,0 +1,37 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; +model TestStaticExchangerDTorWorEff + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam; + + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceWaterSteam_FF( + redeclare package Medium = Medium, + C(P(start=219e5)), + Q0=481.07, + h0=1067.9e3) annotation (Placement(transformation(extent={{-60,-20},{-40,0}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkWaterSteam_FF( + redeclare package Medium = Medium, + P0=217.68e5) annotation (Placement(transformation(extent={{20,-20},{40,0}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceWaterSteam_FC( + redeclare package Medium = Medium, + C(P(start=24e5)), + Q0=23.377, + h0=3420.3e3) annotation (Placement(transformation(origin={-30,30}, extent={{10,-10},{-10,10}}, rotation=180))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkWaterSteam_FC( + redeclare package Medium = Medium, + P0=24.13e5) annotation (Placement(transformation(extent={{-2,20},{20,40}}, rotation=0))); + ThermoSysPro.Fluid.HeatExchangers.StaticExchangerDTorWorEff exchangerWaterSteamDTorWorEFF( + redeclare package Medium_c = Medium, + redeclare package Medium_f = Medium, + EffEch=1, + Kf=597.832, + Ec(P(start=23e5)), + Ef(P(start=219e5)), + exchanger_type=3) annotation (Placement(transformation(extent={{-20,-20},{0,0}}, rotation=0))); +equation + connect(sourceWaterSteam_FF.C, exchangerWaterSteamDTorWorEFF.Ef) annotation (Line(points={{-40,-10},{-20,-10}}, color={0,0,255})); + connect(exchangerWaterSteamDTorWorEFF.Sf, sinkWaterSteam_FF.C) annotation (Line(points={{0,-9.9},{10.2,-9.9},{10.2,-10},{20,-10}}, color={0,0,255})); + connect(sourceWaterSteam_FC.C, exchangerWaterSteamDTorWorEFF.Ec) annotation (Line(points={{-20,30},{-14,30},{-14,-5.9}}, color={0,0,255})); + connect(exchangerWaterSteamDTorWorEFF.Sc, sinkWaterSteam_FC.C) annotation (Line(points={{-6,-5.9},{-6,30},{-2,30}}, color={0,0,255})); + annotation (experiment(StopTime=1000), Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestStaticExchangerDTorWorEff; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticExchangerDTorWorEff_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticExchangerDTorWorEff_FlueGases.mo new file mode 100644 index 00000000..b41a7281 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticExchangerDTorWorEff_FlueGases.mo @@ -0,0 +1,51 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; +model TestStaticExchangerDTorWorEff_FlueGases + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.FlueGases; + parameter Medium.MassFraction X0[Medium.nX]={0.1,0.2,0.3,0.2,0.2}; + + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceFlueGases_FF( + redeclare package Medium = Medium, + C(P(start=4500000), Xi(start={0.1,0.2,0.3,0.2,0.2})), + Q0=481.07, + option_temperature=true, + T0=573.15, + X0=X0) annotation (Placement(transformation(extent={{-60,-20},{-40,0}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkFlueGases_FF( + redeclare package Medium = Medium, + P0=4450000, + T0=573.15) annotation (Placement(transformation(extent={{20,-20},{40,0}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceFlueGases_FC( + redeclare package Medium = Medium, + C(P(start=300000), Xi(start={0.1,0.2,0.3,0.2,0.2})), + Q0=23.377, + option_temperature=true, + T0=673.15, + X0=X0) annotation (Placement(transformation(origin={-30,30}, extent={{10,-10},{-10,10}}, rotation=180))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkFlueGases_FC( + redeclare package Medium = Medium, + P0=100000, + T0=573.15) annotation (Placement(transformation(extent={{-2,20},{20,40}}, rotation=0))); + ThermoSysPro.Fluid.HeatExchangers.StaticExchangerDTorWorEff exchangerFlueGasesDTorWorEFF( + redeclare package Medium_c = Medium, + redeclare package Medium_f = Medium, + EffEch=0.8, + Kc=1e-4, + Kf=1e-4, + Ec(P(start=300000), h(start=3379115.64844), Xi(start={0.1,0.2,0.3,0.2,0.2})), + Sc(P(start=100000), h(start=3200000), Xi(start={0.1,0.2,0.3,0.2,0.2})), + Ef(P(start=4500000), h(start=2879115.64844), Xi(start={0.1,0.2,0.3,0.2,0.2})), + Sf(P(start=4450000), h(start=3000000), Xi(start={0.1,0.2,0.3,0.2,0.2})), + Tec(start=673.15), + Tsc(start=640), + Tef(start=573.15), + Tsf(start=600), + exchanger_type=3) annotation (Placement(transformation(extent={{-20,-20},{0,0}}, rotation=0))); +equation + connect(sourceFlueGases_FF.C, exchangerFlueGasesDTorWorEFF.Ef) annotation (Line(points={{-40,-10},{-20,-10}}, color={0,0,255})); + connect(exchangerFlueGasesDTorWorEFF.Sf, sinkFlueGases_FF.C) annotation (Line(points={{0,-9.9},{10.2,-9.9},{10.2,-10},{20,-10}}, color={0,0,255})); + connect(sourceFlueGases_FC.C, exchangerFlueGasesDTorWorEFF.Ec) annotation (Line(points={{-20,30},{-14,30},{-14,-5.9}}, color={0,0,255})); + connect(exchangerFlueGasesDTorWorEFF.Sc, sinkFlueGases_FC.C) annotation (Line(points={{-6,-5.9},{-6,30},{-2,30}}, color={0,0,255})); + annotation (experiment(StopTime=1000), Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestStaticExchangerDTorWorEff_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticExchangerDTorWorEff_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticExchangerDTorWorEff_Traces.mo new file mode 100644 index 00000000..b39a7964 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticExchangerDTorWorEff_Traces.mo @@ -0,0 +1,42 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; +model TestStaticExchangerDTorWorEff_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam( + extraPropertiesNames={"Trace1","Trace2","Trace3"}, + C_nominal={0.1,0.2,0.3}, + C_default={0.2,0.3,0.4}); + + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceWaterSteam_FF( + redeclare package Medium = Medium, + C(P(start=219e5)), + Q0=481.07, + h0=1067.9e3, + SubC0={0.1,0.2,0.3}) annotation (Placement(transformation(extent={{-60,-20},{-40,0}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkWaterSteam_FF( + redeclare package Medium = Medium, + P0=217.68e5) annotation (Placement(transformation(extent={{20,-20},{40,0}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceWaterSteam_FC( + redeclare package Medium = Medium, + C(P(start=24e5)), + Q0=23.377, + h0=3420.3e3, + SubC0={0.4,0.5,0.6}) annotation (Placement(transformation(origin={-30,30}, extent={{10,-10},{-10,10}}, rotation=180))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkWaterSteam_FC( + redeclare package Medium = Medium, + P0=24.13e5) annotation (Placement(transformation(extent={{-2,20},{20,40}}, rotation=0))); + ThermoSysPro.Fluid.HeatExchangers.StaticExchangerDTorWorEff exchangerWaterSteamDTorWorEFF( + redeclare package Medium_c = Medium, + redeclare package Medium_f = Medium, + EffEch=1, + Kf=597.832, + Ec(P(start=23e5)), + Ef(P(start=219e5)), + exchanger_type=3) annotation (Placement(transformation(extent={{-20,-20},{0,0}}, rotation=0))); +equation + connect(sourceWaterSteam_FF.C, exchangerWaterSteamDTorWorEFF.Ef) annotation (Line(points={{-40,-10},{-20,-10}}, color={0,0,255})); + connect(exchangerWaterSteamDTorWorEFF.Sf, sinkWaterSteam_FF.C) annotation (Line(points={{0,-9.9},{10.2,-9.9},{10.2,-10},{20,-10}}, color={0,0,255})); + connect(sourceWaterSteam_FC.C, exchangerWaterSteamDTorWorEFF.Ec) annotation (Line(points={{-20,30},{-14,30},{-14,-5.9}}, color={0,0,255})); + connect(exchangerWaterSteamDTorWorEFF.Sc, sinkWaterSteam_FC.C) annotation (Line(points={{-6,-5.9},{-6,30},{-2,30}}, color={0,0,255})); + annotation (experiment(StopTime=1000), Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestStaticExchangerDTorWorEff_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order index c0f22855..6c476968 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order @@ -5,6 +5,9 @@ TestFixedPowerHeatExchanger TestFixedPowerHeatExchanger_Traces TestStaticExchangerKS TestStaticExchangerKS_Traces +TestStaticExchangerDTorWorEff +TestStaticExchangerDTorWorEff_Traces +TestStaticExchangerDTorWorEff_FlueGases TestStaticPlateHeatExchanger TestStaticPlateHeatExchanger_Traces TestStaticPlateHeatExchanger_FlueGases diff --git a/ThermoSysPro/Fluid/HeatExchangers/StaticExchangerDTorWorEff.mo b/ThermoSysPro/Fluid/HeatExchangers/StaticExchangerDTorWorEff.mo index 412b35e6..51548bd1 100644 --- a/ThermoSysPro/Fluid/HeatExchangers/StaticExchangerDTorWorEff.mo +++ b/ThermoSysPro/Fluid/HeatExchangers/StaticExchangerDTorWorEff.mo @@ -1,8 +1,9 @@ within ThermoSysPro.Fluid.HeatExchangers; model StaticExchangerDTorWorEff "Static heat exchanger with fixed delta temperature, delta power or efficiency" extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + + replaceable package Medium_c = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model for the hot fluid" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable package Medium_f = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model for the cold fluid" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Integer exchanger_type=1 "Exchanger type - 1: delta temperature is fixed - 2: delta power is fixed - 3: efficiency is fixed"; parameter ThermoSysPro.Units.SI.TemperatureDifference DTfroid=0 @@ -24,15 +25,9 @@ model StaticExchangerDTorWorEff "Static heat exchanger with fixed delta temperat "If > 0, fixed fluid density for the hot fluid"; parameter Units.SI.Density p_rhof=0 "If > 0, fixed fluid density for the cold fluid"; - parameter IF97Region region_c=IF97Region.All_regions "IF97 region for the hot fluid (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); - parameter IF97Region region_cs=IF97Region.All_regions "IF97 region of the water at the outlet of the hot side (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); - parameter IF97Region region_f=IF97Region.All_regions "IF97 region for the cold fluid (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); protected constant Units.SI.Acceleration g=Modelica.Constants.g_n "Gravity constant"; - parameter Integer mode_c=Integer(region_c) - 1 "IF97 region for the hot fluid. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; - parameter Integer mode_cs=Integer(region_cs) - 1 "IF97 region of the water at the outlet of the hot side. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; - parameter Integer mode_f=Integer(region_f) - 1 "IF97 region for the cold fluid. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; parameter Real eps=1.e-0 "Small number for pressure loss equation"; public @@ -64,19 +59,23 @@ public Units.SI.SpecificHeatCapacity Cpc "Specific heat capacity of the hot fluid"; Units.SI.MassFlowRate Qc(start=100) "Hot fluid mass flow rate"; Units.SI.MassFlowRate Qf(start=100) "Cold fluid mass flow rate"; - FluidType ftype_c "Fluid type for the hot fluid"; - Integer fluid_c=Integer(ftype_c) "Fluid number for the hot fluid"; - FluidType ftype_f "Fluid type for the cold fluid"; - Integer fluid_f=Integer(ftype_f) "Fluid number for the cold fluid"; + Medium_c.MassFraction Xc[Medium_c.nXi](start=Medium_c.X_default[1:Medium_c.nXi]) "Mass fractions of the hot fluid"; + Medium_f.MassFraction Xf[Medium_f.nXi](start=Medium_f.X_default[1:Medium_f.nXi]) "Mass fractions of the cold fluid"; + Medium_c.ThermodynamicState state_ce "Thermodynamic state of the hot fluid at the inlet"; + Medium_c.ThermodynamicState state_cs "Thermodynamic state of the hot fluid at the outlet"; + Medium_c.ThermodynamicState state_cm "Average thermodynamic state of the hot fluid"; + Medium_f.ThermodynamicState state_fe "Thermodynamic state of the cold fluid at the inlet"; + Medium_f.ThermodynamicState state_fs "Thermodynamic state of the cold fluid at the outlet"; + Medium_f.ThermodynamicState state_fm "Average thermodynamic state of the cold fluid"; public - Interfaces.Connectors.FluidInlet Ec "Hot inlet" annotation (Placement( + Interfaces.Connectors.FluidInlet Ec(redeclare package Medium = Medium_c) "Hot inlet" annotation (Placement( transformation(extent={{-50,31},{-30,51}}, rotation=0))); - Interfaces.Connectors.FluidInlet Ef "Cold inlet" annotation (Placement( + Interfaces.Connectors.FluidInlet Ef(redeclare package Medium = Medium_f) "Cold inlet" annotation (Placement( transformation(extent={{-110,-10},{-90,10}}, rotation=0))); - Interfaces.Connectors.FluidOutlet Sf "Cold outlet" annotation (Placement( + Interfaces.Connectors.FluidOutlet Sf(redeclare package Medium = Medium_f) "Cold outlet" annotation (Placement( transformation(extent={{90,-9},{110,11}}, rotation=0))); - Interfaces.Connectors.FluidOutlet Sc "Hot outlet" annotation (Placement( + Interfaces.Connectors.FluidOutlet Sc(redeclare package Medium = Medium_c) "Hot outlet" annotation (Placement( transformation(extent={{30,31},{50,51}}, rotation=0))); equation @@ -92,14 +91,8 @@ equation Sc.diff_res_1 = Ec.diff_res_1 + 1/gamma_diff_c; Ec.diff_res_2 = Sc.diff_res_2 + 1/gamma_diff_c; - Ec.ftype = Sc.ftype; - - Ec.Xco2 = Sc.Xco2; - Ec.Xh2o = Sc.Xh2o; - Ec.Xo2 = Sc.Xo2; - Ec.Xso2 = Sc.Xso2; - - ftype_c = Ec.ftype; + Ec.Xi = Sc.Xi; + Ec.SubC = Sc.SubC; Ef.Q = Sf.Q; @@ -112,34 +105,30 @@ equation Sf.diff_res_1 = Ef.diff_res_1 + 1/gamma_diff_f; Ef.diff_res_2 = Sf.diff_res_2 + 1/gamma_diff_f; - Ef.ftype = Sf.ftype; - - Ef.Xco2 = Sf.Xco2; - Ef.Xh2o = Sf.Xh2o; - Ef.Xo2 = Sf.Xo2; - Ef.Xso2 = Sf.Xso2; - - ftype_f = Ef.ftype; + Ef.Xi = Sf.Xi; + Ef.SubC = Sf.SubC; Qc = Ec.Q; Qf = Ef.Q; + Xc = Ec.Xi; + Xf = Ef.Xi; /* Power exchanged between the hot and cold fluids */ if (exchanger_type == 1) then W = Qf*(Sf.h - Ef.h); W = Qc*(Ec.h - Sc.h); - Sf.h = ThermoSysPro.Properties.Fluid.SpecificEnthalpy_PT(Sf.P, Tsf, fluid_f, mode_f, Ef.Xco2, Ef.Xh2o, Ef.Xo2, Ef.Xso2); + Sf.h = Medium_f.specificEnthalpy_pTX(p=Sf.P, T=Tsf, X=Xf); Tsf = Tef + DTfroid; elseif (exchanger_type == 2) then W = Qf*(Sf.h - Ef.h); DW = Qf*(Sf.h - Ef.h); DW = Qc*(Ec.h - Sc.h); - Tsf = ThermoSysPro.Properties.Fluid.Temperature_Ph(Sf.P, Sf.h, fluid_f, mode_f, Ef.Xco2, Ef.Xh2o, Ef.Xo2, Ef.Xso2); + Tsf = Medium_f.temperature(state_fs); elseif (exchanger_type == 3) then W = noEvent(min(Qc*Cpc, Qf*Cpf)*EffEch*(Tec - Tef)); Sf.h = Ef.h + W/Qf; Sc.h = Ec.h - W/Qc; - Tsf = ThermoSysPro.Properties.Fluid.Temperature_Ph(Sf.P, Sf.h, fluid_f, mode_f, Ef.Xco2, Ef.Xh2o, Ef.Xo2, Ef.Xso2); + Tsf = Medium_f.temperature(state_fs); else assert(false, "StaticWaterWaterExchangerDTorWorEff: invalid option"); end if; @@ -159,29 +148,35 @@ equation DPf = DPff + DPgf; /* Hot fluid Temperature at the inlet and at the outlet */ - Tec = ThermoSysPro.Properties.Fluid.Temperature_Ph(Ec.P, Ec.h, fluid_c, mode_c, Ec.Xco2, Ec.Xh2o, Ec.Xo2, Ec.Xso2); - Tsc = ThermoSysPro.Properties.Fluid.Temperature_Ph(Sc.P, Sc.h, fluid_c, mode_cs, Ec.Xco2, Ec.Xh2o, Ec.Xo2, Ec.Xso2); + state_ce = Medium_c.setState_phX(p=Ec.P, h=Ec.h, X=Xc); + state_cs = Medium_c.setState_phX(p=Sc.P, h=Sc.h, X=Xc); + state_cm = Medium_c.setState_phX(p=(Ec.P + Sc.P)/2, h=(Ec.h + Sc.h)/2, X=Xc); + Tec = Medium_c.temperature(state_ce); + Tsc = Medium_c.temperature(state_cs); /* Hot fluid density */ if (p_rhoc > 0) then rhoc = p_rhoc; else - rhoc = ThermoSysPro.Properties.Fluid.Density_Ph((Ec.P + Sc.P)/2,(Ec.h + Sc.h)/2, fluid_c, mode_c, Ec.Xco2, Ec.Xh2o, Ec.Xo2, Ec.Xso2); + rhoc = Medium_c.density(state_cm); end if; /* Cold fluid Temperature at the inlet */ - Tef = ThermoSysPro.Properties.Fluid.Temperature_Ph(Ef.P, Ef.h, fluid_f, mode_f, Ef.Xco2, Ef.Xh2o, Ef.Xo2, Ef.Xso2); + state_fe = Medium_f.setState_phX(p=Ef.P, h=Ef.h, X=Xf); + state_fs = Medium_f.setState_phX(p=Sf.P, h=Sf.h, X=Xf); + state_fm = Medium_f.setState_phX(p=(Ef.P + Sf.P)/2, h=(Ef.h + Sf.h)/2, X=Xf); + Tef = Medium_f.temperature(state_fe); /* Cold fluid density */ if (p_rhof > 0) then rhof = p_rhof; else - rhof = ThermoSysPro.Properties.Fluid.Density_Ph((Ef.P + Sf.P)/2,(Ef.h + Sf.h)/2, fluid_f, mode_f, Ef.Xco2, Ef.Xh2o, Ef.Xo2, Ef.Xso2); + rhof = Medium_f.density(state_fm); end if; /* Average specific heat capacities */ - Cpf = ThermoSysPro.Properties.Fluid.SpecificHeatCapacityCp_Ph(Ef.P, Ef.h, fluid_f, mode_f, Ef.Xco2, Ef.Xh2o, Ef.Xo2, Ef.Xso2); - Cpc = ThermoSysPro.Properties.Fluid.SpecificHeatCapacityCp_Ph(Ec.P, Ec.h, fluid_c, mode_c, Ec.Xco2, Ec.Xh2o, Ec.Xo2, Ec.Xso2); + Cpf = Medium_f.specificHeatCapacityCp(state_fe); + Cpc = Medium_c.specificHeatCapacityCp(state_ce); annotation ( Icon(coordinateSystem( From 668435b7e0e96c1a13656d530fda885ae47b3d0b Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Fri, 8 May 2026 10:01:56 +0200 Subject: [PATCH 124/178] #125 StaticWallFlueGasesExchanger --- ...ticWallFlueGasesExchanger_CustomMixture.mo | 54 ++++++++++++++ ...tStaticWallFlueGasesExchanger_FlueGases.mo | 39 ++++++++++ ...TestStaticWallFlueGasesExchanger_Traces.mo | 53 ++++++++++++++ .../HeatExchangers/package.order | 3 + .../StaticWallFlueGasesExchanger.mo | 72 ++++++++----------- ThermoSysPro/Properties/Media/Functions.mo | 17 +++++ ThermoSysPro/Properties/Media/package.order | 1 + 7 files changed, 195 insertions(+), 44 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticWallFlueGasesExchanger_CustomMixture.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticWallFlueGasesExchanger_FlueGases.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticWallFlueGasesExchanger_Traces.mo create mode 100644 ThermoSysPro/Properties/Media/Functions.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticWallFlueGasesExchanger_CustomMixture.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticWallFlueGasesExchanger_CustomMixture.mo new file mode 100644 index 00000000..85a1472e --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticWallFlueGasesExchanger_CustomMixture.mo @@ -0,0 +1,54 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; +model TestStaticWallFlueGasesExchanger_CustomMixture + extends ThermoSysPro.UsersGuide.Icons.Example; + + package Medium + extends ThermoSysPro.Properties.Media.PartialSubCMedium(nSubC=nC, isCompressible=true); + extends Modelica.Media.IdealGases.Common.MixtureGasNasa( + mediumName="CustomCombustionGas", + data={Modelica.Media.IdealGases.Common.SingleGasesData.CO2, + Modelica.Media.IdealGases.Common.SingleGasesData.H2O, + Modelica.Media.IdealGases.Common.SingleGasesData.O2, + Modelica.Media.IdealGases.Common.SingleGasesData.N2}, + fluidConstants={Modelica.Media.IdealGases.Common.FluidData.CO2, + Modelica.Media.IdealGases.Common.FluidData.H2O, + Modelica.Media.IdealGases.Common.FluidData.O2, + Modelica.Media.IdealGases.Common.FluidData.N2}, + substanceNames={"CO2","H2O","O2","N2"}, + reference_X={0.12,0.08,0.05,0.75}); + end Medium; + + parameter Integer Ns=3; + parameter Medium.MassFraction X0[Medium.nX]={0.12,0.08,0.05,0.75}; + + ThermoSysPro.Fluid.HeatExchangers.StaticWallFlueGasesExchanger exchanger( + redeclare package Medium = Medium, + Ns=Ns, + DPc=1e-4, + Tp0=500, + C1(P(start=4500000), h(start=700000), Q(start=10), Xi(start={0.12,0.08,0.05,0.75})), + C2(P(start=4450000), h(start=650000), Q(start=10), Xi(start={0.12,0.08,0.05,0.75})), + h(start=fill(700000, Ns + 2)), + hb(start=fill(700000, Ns + 1)), + T1(start=fill(650, Ns)), + T2(start=fill(650, Ns + 1))) annotation (Placement(transformation(extent={{-10,-10},{10,10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ source( + redeclare package Medium = Medium, + P0=4500000, + Q0=10, + option_temperature=true, + T0=650, + X0=X0) annotation (Placement(transformation(extent={{-70,-10},{-50,10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink( + redeclare package Medium = Medium, + option_temperature=false, + h0=650000) annotation (Placement(transformation(extent={{50,-10},{70,10}}, rotation=0))); + ThermoSysPro.Thermal.BoundaryConditions.HeatSource wall( + T0=fill(500, Ns), + option_temperature=1) annotation (Placement(transformation(extent={{-10,50},{10,70}}, rotation=0))); +equation + connect(source.C, exchanger.C1) annotation (Line(points={{-50,0},{-10,0}}, color={0,0,255})); + connect(exchanger.C2, sink.C) annotation (Line(points={{10,0},{50,0}}, color={0,0,255})); + connect(wall.C, exchanger.CTh) annotation (Line(points={{0,50.2},{0,3}}, color={255,127,0})); + annotation (experiment(StopTime=1000), Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestStaticWallFlueGasesExchanger_CustomMixture; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticWallFlueGasesExchanger_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticWallFlueGasesExchanger_FlueGases.mo new file mode 100644 index 00000000..0982b5b9 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticWallFlueGasesExchanger_FlueGases.mo @@ -0,0 +1,39 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; +model TestStaticWallFlueGasesExchanger_FlueGases + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.FlueGases; + parameter Integer Ns=3; + parameter Medium.MassFraction X0[Medium.nX]={0.1,0.2,0.3,0.2,0.2}; + + ThermoSysPro.Fluid.HeatExchangers.StaticWallFlueGasesExchanger exchanger( + redeclare package Medium = Medium, + Ns=Ns, + DPc=1e-4, + Tp0=500, + C1(P(start=4500000), h(start=2879115.64844), Q(start=10), Xi(start={0.1,0.2,0.3,0.2,0.2})), + C2(P(start=4450000), h(start=2820000), Q(start=10), Xi(start={0.1,0.2,0.3,0.2,0.2})), + h(start=fill(2879115.64844, Ns + 2)), + hb(start=fill(2879115.64844, Ns + 1)), + T1(start=fill(573.15, Ns)), + T2(start=fill(573.15, Ns + 1))) annotation (Placement(transformation(extent={{-10,-10},{10,10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ source( + redeclare package Medium = Medium, + P0=4500000, + Q0=10, + option_temperature=true, + T0=573.15, + X0=X0) annotation (Placement(transformation(extent={{-70,-10},{-50,10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink( + redeclare package Medium = Medium, + option_temperature=false, + h0=2820000) annotation (Placement(transformation(extent={{50,-10},{70,10}}, rotation=0))); + ThermoSysPro.Thermal.BoundaryConditions.HeatSource wall( + T0=fill(500, Ns), + option_temperature=1) annotation (Placement(transformation(extent={{-10,50},{10,70}}, rotation=0))); +equation + connect(source.C, exchanger.C1) annotation (Line(points={{-50,0},{-10,0}}, color={0,0,255})); + connect(exchanger.C2, sink.C) annotation (Line(points={{10,0},{50,0}}, color={0,0,255})); + connect(wall.C, exchanger.CTh) annotation (Line(points={{0,50.2},{0,3}}, color={255,127,0})); + annotation (experiment(StopTime=1000), Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestStaticWallFlueGasesExchanger_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticWallFlueGasesExchanger_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticWallFlueGasesExchanger_Traces.mo new file mode 100644 index 00000000..264cba4b --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticWallFlueGasesExchanger_Traces.mo @@ -0,0 +1,53 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; +model TestStaticWallFlueGasesExchanger_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.FlueGases( + extraPropertiesNames={"Trace1","Trace2","Trace3"}, + C_nominal={0.1,0.2,0.3}, + C_default={0.2,0.3,0.4}); + parameter Integer Ns=3; + parameter Medium.MassFraction X0[Medium.nX]={0.1,0.2,0.3,0.2,0.2}; + + ThermoSysPro.Fluid.HeatExchangers.StaticWallFlueGasesExchanger exchanger( + redeclare package Medium = Medium, + Ns=Ns, + DPc=1e-4, + Tp0=500, + C1( + P(start=4500000), + h(start=2879115.64844), + Q(start=10), + Xi(start={0.1,0.2,0.3,0.2,0.2}), + SubC(start={0.1,0.2,0.3})), + C2( + P(start=4450000), + h(start=2820000), + Q(start=10), + Xi(start={0.1,0.2,0.3,0.2,0.2}), + SubC(start={0.1,0.2,0.3})), + h(start=fill(2879115.64844, Ns + 2)), + hb(start=fill(2879115.64844, Ns + 1)), + T1(start=fill(573.15, Ns)), + T2(start=fill(573.15, Ns + 1))) annotation (Placement(transformation(extent={{-10,-10},{10,10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ source( + redeclare package Medium = Medium, + P0=4500000, + Q0=10, + option_temperature=true, + T0=573.15, + X0=X0, + SubC0={0.1,0.2,0.3}) annotation (Placement(transformation(extent={{-70,-10},{-50,10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink( + redeclare package Medium = Medium, + option_temperature=false, + h0=2820000) annotation (Placement(transformation(extent={{50,-10},{70,10}}, rotation=0))); + ThermoSysPro.Thermal.BoundaryConditions.HeatSource wall( + T0=fill(500, Ns), + option_temperature=1) annotation (Placement(transformation(extent={{-10,50},{10,70}}, rotation=0))); +equation + connect(source.C, exchanger.C1) annotation (Line(points={{-50,0},{-10,0}}, color={0,0,255})); + connect(exchanger.C2, sink.C) annotation (Line(points={{10,0},{50,0}}, color={0,0,255})); + connect(wall.C, exchanger.CTh) annotation (Line(points={{0,50.2},{0,3}}, color={255,127,0})); + annotation (experiment(StopTime=1000), Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestStaticWallFlueGasesExchanger_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order index 6c476968..937eb150 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order @@ -8,6 +8,9 @@ TestStaticExchangerKS_Traces TestStaticExchangerDTorWorEff TestStaticExchangerDTorWorEff_Traces TestStaticExchangerDTorWorEff_FlueGases +TestStaticWallFlueGasesExchanger_FlueGases +TestStaticWallFlueGasesExchanger_Traces +TestStaticWallFlueGasesExchanger_CustomMixture TestStaticPlateHeatExchanger TestStaticPlateHeatExchanger_Traces TestStaticPlateHeatExchanger_FlueGases diff --git a/ThermoSysPro/Fluid/HeatExchangers/StaticWallFlueGasesExchanger.mo b/ThermoSysPro/Fluid/HeatExchangers/StaticWallFlueGasesExchanger.mo index 40765bd4..491d03af 100644 --- a/ThermoSysPro/Fluid/HeatExchangers/StaticWallFlueGasesExchanger.mo +++ b/ThermoSysPro/Fluid/HeatExchangers/StaticWallFlueGasesExchanger.mo @@ -1,8 +1,8 @@ within ThermoSysPro.Fluid.HeatExchangers; model StaticWallFlueGasesExchanger "Static wall - flue gases exchanger" extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + + replaceable package Medium = ThermoSysPro.Properties.Media.FlueGases constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Mixture gas medium" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Integer Ns=10 "Number of segments"; parameter Integer NbTub=100 "Number of pipes"; @@ -30,11 +30,6 @@ model StaticWallFlueGasesExchanger "Static wall - flue gases exchanger" parameter Boolean diffusion=false "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; protected - constant Real Mco2=44.009 "CO2 molar mass"; - constant Real Mh2o=18.0148 "H2O molar mass"; - constant Real Mo2=31.998 "O2 molar mass"; - constant Real Mn2=28.014 "N2 molar mass"; - constant Real Mso2=64.063 "SO2 molar mass"; constant Real pi=Modelica.Constants.pi; constant Units.SI.Acceleration g=Modelica.Constants.g_n "Gravity constant"; parameter Integer N=Ns + 1 "Number of hydraulic nodes (= number of thermal nodes + 1)"; @@ -49,6 +44,8 @@ protected parameter Units.SI.Length Perb=Surf_ext/Ls "Geometrical parameter"; parameter Units.SI.CoefficientOfHeatTransfer Kdef=50 "Heat exchange coefficient in case of zero flow"; + parameter Integer iH2O=ThermoSysPro.Properties.Media.Functions.findSubstanceIndex(Medium.substanceNames, {"H2O", "Water", "water"}) "Index of water vapor in the medium composition"; + parameter Integer iCO2=ThermoSysPro.Properties.Media.Functions.findSubstanceIndex(Medium.substanceNames, {"CO2", "Carbondioxide", "Carbon dioxide", "carbondioxide"}) "Index of carbon dioxide in the medium composition"; parameter Units.SI.MassFlowRate gamma0=1.e-4 "Pseudo-diffusion conductance use for continuous flow reversal (active if diffusion=false and continuous_flow_reversal=true)"; parameter Real eps=1.e-1 "Small number for the computation of the pressure losses"; @@ -74,14 +71,8 @@ public "H2O partial pressure in thermal node i"; ThermoSysPro.Units.SI.MassFraction Xh2o "H2O mass fraction"; ThermoSysPro.Units.SI.MassFraction Xco2 "CO2 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xo2 "O2 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xso2 "SO2 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xn2 "N2 mass fraction"; ThermoSysPro.Units.SI.MassFraction Xvh2o "H2O volume fraction"; ThermoSysPro.Units.SI.MassFraction Xvco2 "CO2 volume fraction"; - ThermoSysPro.Units.SI.MassFraction Xvo2 "O2 volume fraction"; - ThermoSysPro.Units.SI.MassFraction Xvn2 "N2 volume fraction"; - ThermoSysPro.Units.SI.MassFraction Xvso2 "SO2 volume fraction"; Units.SI.CoefficientOfHeatTransfer K(start=0) "Total heat exchange coefficient"; Units.SI.CoefficientOfHeatTransfer Kc(start=0) @@ -99,8 +90,9 @@ public - 1)) "Temperature difference between the fluid and the wall"; Units.SI.Temperature TFilm[N - 1] "Film temperature"; Real Mmt "Total flue gases molar mass"; - FluidType ftype "Fluid type"; - Integer fluid=Integer(ftype) "Fluid number"; + parameter Units.SI.MolarMass MM[Medium.nX]={Medium.fluidConstants[j].molarMass for j in 1:Medium.nX} "Component molar masses"; + Medium.ThermodynamicState state1[N - 1] "Thermodynamic state in thermal node i"; + Medium.ThermodynamicState state2[N] "Thermodynamic state in hydraulic node i"; Real diff_res[N] "Diffusion resistance in hydraulic node i"; Real diff_res_t "Total diffusion resistance in the pipe"; Real diff_res_e[N - 1] "Diffusion resistance at inlet of thermal node i"; @@ -120,20 +112,21 @@ public Real rs[N - 1] "Value of r(Q/gamma) for outlet of thermal node i"; public - Interfaces.Connectors.FluidInlet C1 annotation (Placement(transformation( + Interfaces.Connectors.FluidInlet C1(redeclare package Medium = Medium) annotation (Placement(transformation( extent={{-110,-10},{-90,10}}, rotation=0))); ThermoSysPro.Thermal.Connectors.ThermalPort CTh[Ns] annotation (Placement(transformation(extent={{-10,20},{10,40}}, rotation=0))); - Interfaces.Connectors.FluidOutlet C2 annotation (Placement(transformation( + Interfaces.Connectors.FluidOutlet C2(redeclare package Medium = Medium) annotation (Placement(transformation( extent={{90,-10},{110,10}}, rotation=0))); equation - /* Check that the fluid type is flue gases */ - assert(ftype == FluidType.FlueGases, "StaticWallFlueGasesExchanger: the fluid type must be flue gases"); + assert(Medium.nX > 1, "StaticWallFlueGasesExchanger: Medium must be a gas mixture"); + assert(iH2O > 0, "StaticWallFlueGasesExchanger: Medium.substanceNames must contain H2O/Water for radiative heat transfer"); + assert(iCO2 > 0, "StaticWallFlueGasesExchanger: Medium.substanceNames must contain CO2/Carbondioxide for radiative heat transfer"); /* Wall boundary */ CTh.W = -dW1; - CTh.T = Tp; + Tp = CTh.T; /* Pipe boundaries */ P[1] = C1.P; @@ -157,30 +150,18 @@ equation C2.diff_res_1 = C1.diff_res_1 + diff_res_t; C1.diff_res_2 = C2.diff_res_2 + diff_res_t; - C1.ftype = C2.ftype; - - C1.Xco2 = C2.Xco2; - C1.Xh2o = C2.Xh2o; - C1.Xo2 = C2.Xo2; - C1.Xso2 = C2.Xso2; + C1.Xi = C2.Xi; + C1.SubC = C2.SubC; - ftype = C1.ftype; - - Xh2o = C1.Xh2o; - Xco2 = C1.Xco2; - Xo2 = C1.Xo2; - Xso2 = C1.Xso2; - Xn2 = 1 - C1.Xco2 - C1.Xh2o - C1.Xo2 - C1.Xso2; + Xh2o = C1.Xi[iH2O]; + Xco2 = C1.Xi[iCO2]; /* Volume fractions */ - Xvco2 = (Xco2/Mco2)/(Xco2/Mco2 + Xh2o/Mh2o + Xo2/Mo2 + Xn2/Mn2 + Xso2/Mso2); - Xvh2o = (Xh2o/Mh2o)/(Xco2/Mco2 + Xh2o/Mh2o + Xo2/Mo2 + Xn2/Mn2 + Xso2/Mso2); - Xvo2 = (Xo2/Mo2)/(Xco2/Mco2 + Xh2o/Mh2o + Xo2/Mo2 + Xn2/Mn2 + Xso2/Mso2); - Xvn2 = (Xn2/Mn2)/(Xco2/Mco2 + Xh2o/Mh2o + Xo2/Mo2 + Xn2/Mn2 + Xso2/Mso2); - Xvso2 = (Xso2/Mso2)/(Xco2/Mco2 + Xh2o/Mh2o + Xo2/Mo2 + Xn2/Mn2 + Xso2/Mso2); + Xvco2 = Xco2/MM[iCO2]/sum({C1.Xi[k]/MM[k] for k in 1:Medium.nX}); + Xvh2o = Xh2o/MM[iH2O]/sum({C1.Xi[k]/MM[k] for k in 1:Medium.nX}); /* Total molar mass */ - Mmt = Xvco2*Mco2 + Xvh2o*Mh2o + Xvo2*Mo2 + Xvn2*Mn2 + Xvso2*Mso2; + Mmt = sum({C1.Xi[k]/MM[k] for k in 1:Medium.nX})^(-1); /* Mass and energy balance equations (thermal nodes) */ for i in 1:N - 1 loop @@ -194,8 +175,8 @@ equation deltaT[i] = T1[i] - Tp[i]; /* Partial gas pressures */ - Ph2o[i] = P[i + 1]*Xh2o*Mmt/Mh2o; - Pco2[i] = P[i + 1]*Xco2*Mmt/Mco2; + Ph2o[i] = P[i + 1]*Xvh2o; + Pco2[i] = P[i + 1]*Xvco2; if (abs(Q[i]) >= Qmin) then /* Convective heat exchange coefficient */ @@ -267,7 +248,8 @@ equation J[i] = Je[i] + Js[i]; /* Fluid thermodynamic properties */ - T1[i] = ThermoSysPro.Properties.Fluid.Temperature_Ph(P[i + 1], h[i + 1], fluid, 0, Xco2, Xh2o, Xo2, Xso2); + state1[i] = Medium.setState_phX(p=P[i + 1], h=h[i + 1], X=C1.Xi); + T1[i] = Medium.temperature(state1[i]); end for; /* Momentum balance equations (hydraulic nodes) */ @@ -280,13 +262,15 @@ equation gamma[i] = if diffusion then 1/diff_res[i] else gamma0; /* Fluid thermodynamic properties */ + state2[i] = Medium.setState_phX(p=(P[i] + P[i + 1])/2, h=hb[i], X=C1.Xi); + if (p_rho > 0) then rho2[i] = p_rho; else - rho2[i] = ThermoSysPro.Properties.Fluid.Density_Ph((P[i] + P[i + 1])/2, hb[i], fluid, 0, Xco2, Xh2o, Xo2, Xso2); + rho2[i] = Medium.density(state2[i]); end if; - T2[i] = ThermoSysPro.Properties.Fluid.Temperature_Ph((P[i] + P[i + 1])/2, hb[i], fluid, 0, Xco2, Xh2o, Xo2, Xso2); + T2[i] = Medium.temperature(state2[i]); end for; /* Total heat exchange coefficient ??? */ diff --git a/ThermoSysPro/Properties/Media/Functions.mo b/ThermoSysPro/Properties/Media/Functions.mo new file mode 100644 index 00000000..602383ba --- /dev/null +++ b/ThermoSysPro/Properties/Media/Functions.mo @@ -0,0 +1,17 @@ +within ThermoSysPro.Properties.Media; +package Functions + function findSubstanceIndex + input String substanceNames[:]; + input String aliases[:]; + output Integer index; + algorithm + index := 0; + for i in 1:size(substanceNames, 1) loop + for j in 1:size(aliases, 1) loop + if substanceNames[i] == aliases[j] then + index := i; + end if; + end for; + end for; + end findSubstanceIndex; +end Functions; diff --git a/ThermoSysPro/Properties/Media/package.order b/ThermoSysPro/Properties/Media/package.order index 8d9e6275..bb249bcc 100644 --- a/ThermoSysPro/Properties/Media/package.order +++ b/ThermoSysPro/Properties/Media/package.order @@ -1,5 +1,6 @@ PartialSubCMedium PartialThermoSysProMedium PartialTwoPhaseThermoSysProMedium +Functions WaterSteam FlueGases From 555cb0e0cec86bdd80588beb24adaf44bcdd68ae Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Mon, 11 May 2026 11:27:50 +0200 Subject: [PATCH 125/178] #125 DynamicPlateHeatExchanger but issues with examples --- .../TestDynamicPlateHeatExchanger.mo | 61 ++++++++ .../TestDynamicPlateHeatExchangerW.mo | 48 +++++++ ...TestDynamicPlateHeatExchanger_FlueGases.mo | 59 ++++++++ .../TestDynamicPlateHeatExchanger_Traces.mo | 59 ++++++++ .../HeatExchangers/package.order | 4 + .../DynamicPlateHeatExchanger.mo | 134 ++++++++---------- 6 files changed, 291 insertions(+), 74 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicPlateHeatExchanger.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicPlateHeatExchangerW.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicPlateHeatExchanger_FlueGases.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicPlateHeatExchanger_Traces.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicPlateHeatExchanger.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicPlateHeatExchanger.mo new file mode 100644 index 00000000..48836bb0 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicPlateHeatExchanger.mo @@ -0,0 +1,61 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; +model TestDynamicPlateHeatExchanger + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam; + + ThermoSysPro.Fluid.HeatExchangers.DynamicPlateHeatExchanger dynamicPlateHeatExchanger( + redeclare package Medium_c = Medium, + redeclare package Medium_f = Medium, + Ns=5, + Sp=2, + dynamic_energy_balance=false, + heat_exchange_correlation=0, + pressure_loss_correlation=0, + p_Kc=1e-4, + p_Kf=1e-4, + state_f2(p(each start=3e5)), + Ec( + P(start=300000), + Q(fixed=true, start=1036), + h(start=280050)), + Sc(P(start=100000), h(start=275103), Q(start=1000)), + Ef(P(start=300000), h(start=280104), Q(start=1000)), + Sf(P(start=100000), h(start=280076)), + Pc(start=fill(3e5, 5+2)), + Pf(start=fill(3e5, 5+2)), + Qf(start=fill(1000, 5+1)), + hc(start={280050,280050,280052,280040,280303,275103,275103}), + hf(start={280076,280104,280154,279724,289301,280000,280000}), + hbc(start={280050,280050,280052,280040,280303,275103}), + hbf(start={280076,280104,280154,279724,289301,280000})) annotation (Placement(transformation(extent={{-10,30},{10,50}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourcePc( + redeclare package Medium = Medium, + P0=300000, + option_temperature=false, + h0=280050) annotation (Placement(transformation(extent={{-70,30},{-50,50}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourcePf( + redeclare package Medium = Medium, + P0=300000, + option_temperature=false, + h0=280104) annotation (Placement(transformation(extent={{-50,10},{-30,30}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkPc( + redeclare package Medium = Medium, + P0(fixed=false) = 100000, + option_temperature=false, + h0=275103) annotation (Placement(transformation(extent={{50,30},{70,50}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkPf( + redeclare package Medium = Medium, + P0=100000, + option_temperature=false, + h0=280076) annotation (Placement(transformation(extent={{30,10},{50,30}}, rotation=0))); +equation + connect(sourcePc.C, dynamicPlateHeatExchanger.Ec) annotation (Line(points={{-50,40},{-10,40}}, color={0,0,255})); + connect(sourcePf.C, dynamicPlateHeatExchanger.Ef) annotation (Line(points={{-30,20},{-5,20},{-5,34}}, color={0,0,255})); + connect(dynamicPlateHeatExchanger.Sc, sinkPc.C) annotation (Line(points={{10,40},{30,40},{50,40}}, color={0,0,255})); + connect(dynamicPlateHeatExchanger.Sf, sinkPf.C) annotation (Line(points={{5,34},{4,34},{4,20},{30,20}}, color={0,0,255})); + annotation ( + experiment(StopTime=1000), + Icon(coordinateSystem(preserveAspectRatio=false)), + Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestDynamicPlateHeatExchanger; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicPlateHeatExchangerW.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicPlateHeatExchangerW.mo new file mode 100644 index 00000000..abbd9039 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicPlateHeatExchangerW.mo @@ -0,0 +1,48 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; +model TestDynamicPlateHeatExchangerW + + replaceable package Medium = Properties.Media.WaterSteam; + ThermoSysPro.Fluid.HeatExchangers.DynamicPlateHeatExchanger echangeurAPlaques1D1( + redeclare package Medium_c = Medium, + redeclare package Medium_f = Medium, + Ns=5, + Sc(Q(fixed=true, start=1036))) annotation (Placement(transformation(extent={{-14,6},{6,26}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP2(redeclare package Medium = Medium, T0=340) annotation (Placement(transformation(extent={{-74,6},{-54,26}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP3(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-54,-14},{-34,6}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP puitsP2(redeclare package Medium = Medium, P0(fixed=false) = 100000) annotation (Placement(transformation(extent={{46,6},{66,26}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP puitsP3(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{26,-14},{46,6}}, rotation=0))); +equation + connect(sourceP2.C, echangeurAPlaques1D1.Ec) annotation (Line(points={{-54,16},{-14,16}}, color={0,0,255})); + connect(sourceP3.C, echangeurAPlaques1D1.Ef) annotation (Line(points={{-34,-4},{-9,-4},{-9,10}}, color={0,0,255})); + connect(echangeurAPlaques1D1.Sc, puitsP2.C) annotation (Line(points={{6,16},{46,16}}, color={0,0,255})); + connect(echangeurAPlaques1D1.Sf, puitsP3.C) annotation (Line(points={{1,10},{0,10},{0,-4},{26,-4}}, color={0,0,255})); + annotation ( + Diagram(graphics={Text( + extent={{72,24},{92,6}}, + lineColor={0,0,255}, + textString="Qc=true")}), + Icon(graphics={ + Rectangle( + lineColor={200,200,200}, + fillColor={248,248,248}, + fillPattern=FillPattern.HorizontalCylinder, + extent={{-100.0,-100.0},{100.0,100.0}}, + radius=25.0), + Rectangle( + lineColor={128,128,128}, + extent={{-100.0,-100.0},{100.0,100.0}}, + radius=25.0), + Polygon( + origin={8.0,14.0}, + lineColor={78,138,73}, + fillColor={78,138,73}, + pattern=LinePattern.None, + fillPattern=FillPattern.Solid, + points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), + Documentation(info=" +

    Copyright © EDF 2002 - 2024

    +

    ThermoSysPro Version 4.1

    +

    This model is documented in Sect. 9.6.1.5 of the ThermoSysPro book. +

    The results reported in the ThermoSysPro book were computed using Dymola. +")); +end TestDynamicPlateHeatExchangerW; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicPlateHeatExchanger_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicPlateHeatExchanger_FlueGases.mo new file mode 100644 index 00000000..06417c77 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicPlateHeatExchanger_FlueGases.mo @@ -0,0 +1,59 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; +model TestDynamicPlateHeatExchanger_FlueGases + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium_c = Properties.Media.FlueGases; + replaceable package Medium_f = Properties.Media.FlueGases; + + ThermoSysPro.Fluid.HeatExchangers.DynamicPlateHeatExchanger dynamicPlateHeatExchanger( + redeclare package Medium_c = Medium_c, + redeclare package Medium_f = Medium_f, + Ns=5, + Sp=2, + dynamic_energy_balance=false, + heat_exchange_correlation=0, + pressure_loss_correlation=0, + p_hc=100, + p_hf=100, + p_Kc=1e-4, + p_Kf=1e-4, + Ec(P(start=4500000), h(start=2879115.64844), Xi(start={0.1,0.2,0.3,0.2,0.2})), + Sc(P(start=4450000), h(start=2879115.64844), Q(start=117275.047014), Xi(start={0.1,0.2,0.3,0.2,0.2})), + Ef(P(start=300000), h(start=2879115.64844), Q(start=49585.430645), Xi(start={0.1,0.2,0.3,0.2,0.2})), + Sf(P(start=100000), h(start=2879115.64844), Xi(start={0.1,0.2,0.3,0.2,0.2})), + hc(start=fill(2879115.64844, 7)), + hf(start=fill(2879115.64844, 7)), + hbc(start=fill(2879115.64844, 6)), + hbf(start=fill(2879115.64844, 6)), + Tc1(start=fill(573.15, 5)), + Tf1(start=fill(573.15, 5)), + Tc2(start=fill(573.15, 6)), + Tf2(start=fill(573.15, 6))) annotation (Placement(transformation(extent={{-10,30},{10,50}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourcePc( + redeclare package Medium = Medium_c, + P0=4500000, + T0=573.15, + X0={0.1,0.2,0.3,0.2,0.2}) annotation (Placement(transformation(extent={{-70,30},{-50,50}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourcePf( + redeclare package Medium = Medium_f, + P0=300000, + T0=573.15, + X0={0.1,0.2,0.3,0.2,0.2}) annotation (Placement(transformation(extent={{-50,10},{-30,30}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkPc( + redeclare package Medium = Medium_c, + P0=4450000, + T0=573.15) annotation (Placement(transformation(extent={{50,30},{70,50}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkPf( + redeclare package Medium = Medium_f, + P0=100000, + T0=573.15) annotation (Placement(transformation(extent={{30,10},{50,30}}, rotation=0))); +equation + connect(sourcePc.C, dynamicPlateHeatExchanger.Ec) annotation (Line(points={{-50,40},{-10,40}}, color={0,0,255})); + connect(sourcePf.C, dynamicPlateHeatExchanger.Ef) annotation (Line(points={{-30,20},{-5,20},{-5,34}}, color={0,0,255})); + connect(dynamicPlateHeatExchanger.Sc, sinkPc.C) annotation (Line(points={{10,40},{30,40},{50,40}}, color={0,0,255})); + connect(dynamicPlateHeatExchanger.Sf, sinkPf.C) annotation (Line(points={{5,34},{4,34},{4,20},{30,20}}, color={0,0,255})); + annotation ( + experiment(StopTime=1000), + Icon(coordinateSystem(preserveAspectRatio=false)), + Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestDynamicPlateHeatExchanger_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicPlateHeatExchanger_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicPlateHeatExchanger_Traces.mo new file mode 100644 index 00000000..bfc63f33 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicPlateHeatExchanger_Traces.mo @@ -0,0 +1,59 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; +model TestDynamicPlateHeatExchanger_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam ( + extraPropertiesNames={"Trace1","Trace2","Trace3"}, + C_nominal={0.1,0.2,0.3}, + C_default={0.2,0.3,0.4}); + + ThermoSysPro.Fluid.HeatExchangers.DynamicPlateHeatExchanger dynamicPlateHeatExchanger( + redeclare package Medium_c = Medium, + redeclare package Medium_f = Medium, + Ns=5, + Sp=2, + dynamic_energy_balance=false, + heat_exchange_correlation=0, + pressure_loss_correlation=0, + p_Kc=1e-4, + p_Kf=1e-4, + Ec(P(start=300000), h(start=280050)), + Sc(P(start=100000), h(start=275103), Q(start=1000)), + Ef(P(start=300000), h(start=280104), Q(start=1000)), + Sf(P(start=100000), h(start=280076)), + hc(start={280050,280050,280052,280040,280303,275103,275103}), + hf(start={280076,280104,280154,279724,289301,280000,280000}), + hbc(start={280050,280050,280052,280040,280303,275103}), + hbf(start={280076,280104,280154,279724,289301,280000})) annotation (Placement(transformation(extent={{-10,30},{10,50}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourcePc( + redeclare package Medium = Medium, + P0=300000, + option_temperature=false, + h0=280050, + SubC0={0.1,0.2,0.3}) annotation (Placement(transformation(extent={{-70,30},{-50,50}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourcePf( + redeclare package Medium = Medium, + P0=300000, + option_temperature=false, + h0=280104, + SubC0={0.4,0.5,0.6}) annotation (Placement(transformation(extent={{-50,10},{-30,30}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkPc( + redeclare package Medium = Medium, + P0=100000, + option_temperature=false, + h0=275103) annotation (Placement(transformation(extent={{50,30},{70,50}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkPf( + redeclare package Medium = Medium, + P0=100000, + option_temperature=false, + h0=280076) annotation (Placement(transformation(extent={{30,10},{50,30}}, rotation=0))); +equation + connect(sourcePc.C, dynamicPlateHeatExchanger.Ec) annotation (Line(points={{-50,40},{-10,40}}, color={0,0,255})); + connect(sourcePf.C, dynamicPlateHeatExchanger.Ef) annotation (Line(points={{-30,20},{-5,20},{-5,34}}, color={0,0,255})); + connect(dynamicPlateHeatExchanger.Sc, sinkPc.C) annotation (Line(points={{10,40},{30,40},{50,40}}, color={0,0,255})); + connect(dynamicPlateHeatExchanger.Sf, sinkPf.C) annotation (Line(points={{5,34},{4,34},{4,20},{30,20}}, color={0,0,255})); + annotation ( + experiment(StopTime=1000), + Icon(coordinateSystem(preserveAspectRatio=false)), + Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestDynamicPlateHeatExchanger_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order index 937eb150..c35c0985 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order @@ -14,6 +14,9 @@ TestStaticWallFlueGasesExchanger_CustomMixture TestStaticPlateHeatExchanger TestStaticPlateHeatExchanger_Traces TestStaticPlateHeatExchanger_FlueGases +TestDynamicPlateHeatExchanger +TestDynamicPlateHeatExchanger_Traces +TestDynamicPlateHeatExchanger_FlueGases TestNTUWaterHeater TestNTUWaterHeater_Traces TestNTUWaterHeater_FlueGases @@ -25,3 +28,4 @@ TestStaticCondenser TestStaticCondenser_Traces TestStaticCondenserHEI TestStaticCondenserHEI_Traces +TestDynamicPlateHeatExchangerW diff --git a/ThermoSysPro/Fluid/HeatExchangers/DynamicPlateHeatExchanger.mo b/ThermoSysPro/Fluid/HeatExchangers/DynamicPlateHeatExchanger.mo index de113766..04b48756 100644 --- a/ThermoSysPro/Fluid/HeatExchangers/DynamicPlateHeatExchanger.mo +++ b/ThermoSysPro/Fluid/HeatExchangers/DynamicPlateHeatExchanger.mo @@ -1,8 +1,9 @@ within ThermoSysPro.Fluid.HeatExchangers; model DynamicPlateHeatExchanger "Dynamic plate heat exchanger" extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + + replaceable package Medium_c = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model for the hot fluid" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable package Medium_f = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model for the cold fluid" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Units.SI.ThermalConductivity lambdam=15.0 "Metal thermal conductivity"; @@ -63,14 +64,10 @@ model DynamicPlateHeatExchanger "Dynamic plate heat exchanger" parameter Units.SI.Density p_rhof=0 "If > 0, fixed fluid density for the cold fluid" annotation (Evaluate=true, Dialog(tab="Fluid", group="Fluid properties")); - parameter IF97Region region_c=IF97Region.All_regions "Hot fluid IF97 region (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype_c==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); - parameter IF97Region region_f=IF97Region.All_regions "Cold fluid IF97 region (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype_f==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); protected constant Units.SI.Acceleration g=Modelica.Constants.g_n "Gravity constant"; constant Real pi=Modelica.Constants.pi "pi"; - parameter Integer mode_c=Integer(region_c) - 1 "Hot fluid IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; - parameter Integer mode_f=Integer(region_f) - 1 "Cold fluid IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; parameter Integer N=Ns + 1 "Number of hydraulic nodes (= number of thermal nodes + 1)"; parameter Units.SI.Area Ac=1 "Internal cross sectional pipe area for the hot fluid"; @@ -174,18 +171,16 @@ public Units.SI.Temperature Tsc "Fluid temperature at the hot outlet"; Units.SI.Temperature Tef "Fluid temperature at the cold inlet"; Units.SI.Temperature Tsf "Fluid temperature at the cold outlet"; - FluidType ftype_c "Hot fluid type"; - FluidType ftype_f "Cold fluid type"; - Integer fluid_c=Integer(ftype_c) "Hot fluid number"; - Integer fluid_f=Integer(ftype_f) "Cold fluid number"; - ThermoSysPro.Units.SI.MassFraction Xco2_c "Hot fluid CO2 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xco2_f "Cold fluid CO2 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xh2o_c "Hot fluid H2O mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xh2o_f "Cold fluid H2O mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xo2_c "Hot fluid O2 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xo2_f "Cold fluid O2 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xso2_c "Hot fluid SO2 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xso2_f "Cold fluid SO2 mass fraction"; + Medium_c.MassFraction Xc[Medium_c.nXi](start=Medium_c.X_default[1:Medium_c.nXi]) "Mass fractions of the hot fluid"; + Medium_f.MassFraction Xf[Medium_f.nXi](start=Medium_f.X_default[1:Medium_f.nXi]) "Mass fractions of the cold fluid"; + Medium_c.ThermodynamicState state_c1[N - 1] "Hot fluid thermodynamic state in thermal node i"; + Medium_f.ThermodynamicState state_f1[N - 1] "Cold fluid thermodynamic state in thermal node i"; + Medium_c.ThermodynamicState state_c2[N] "Hot fluid thermodynamic state in hydraulic node i"; + Medium_f.ThermodynamicState state_f2[N] "Cold fluid thermodynamic state in hydraulic node i"; + Medium_c.ThermodynamicState state_ce "Thermodynamic state of the hot fluid at the inlet"; + Medium_c.ThermodynamicState state_cs "Thermodynamic state of the hot fluid at the outlet"; + Medium_f.ThermodynamicState state_fe "Thermodynamic state of the cold fluid at the inlet"; + Medium_f.ThermodynamicState state_fs "Thermodynamic state of the cold fluid at the outlet"; Real diff_res_c[N] "Diffusion resistance in hydraulic node i for the hot fluid"; Real diff_res_f[N] "Diffusion resistance in hydraulic node i for the cold fluid"; Real diff_res_t_c "Total diffusion resistance in the pipe for the hot fluid"; @@ -224,13 +219,13 @@ public Real rs_f[N - 1] "Value of r(Q/gamma) for outlet of thermal node i for the cold fluid"; public - Interfaces.Connectors.FluidInlet Ec annotation (Placement(transformation( + Interfaces.Connectors.FluidInlet Ec(redeclare package Medium = Medium_c) annotation (Placement(transformation( extent={{-110,-10},{-90,10}}, rotation=0))); - Interfaces.Connectors.FluidInlet Ef annotation (Placement(transformation( + Interfaces.Connectors.FluidInlet Ef(redeclare package Medium = Medium_f) annotation (Placement(transformation( extent={{-60,-70},{-40,-50}}, rotation=0))); - Interfaces.Connectors.FluidOutlet Sf annotation (Placement(transformation( + Interfaces.Connectors.FluidOutlet Sf(redeclare package Medium = Medium_f) annotation (Placement(transformation( extent={{40,-70},{60,-50}}, rotation=0))); - Interfaces.Connectors.FluidOutlet Sc annotation (Placement(transformation( + Interfaces.Connectors.FluidOutlet Sc(redeclare package Medium = Medium_c) annotation (Placement(transformation( extent={{90,-10},{110,10}}, rotation=0))); initial equation if dynamic_energy_balance then @@ -242,8 +237,8 @@ initial equation else if option_temperature then for i in 2:N loop - hc[i] = ThermoSysPro.Properties.Fluid.SpecificEnthalpy_PT(Pc0, Tc0[i - 1], fluid_c, mode_c, Xco2_c, Xh2o_c, Xo2_c, Xso2_c); - hf[i] = ThermoSysPro.Properties.Fluid.SpecificEnthalpy_PT(Pf0, Tf0[i - 1], fluid_f, mode_f, Xco2_f, Xh2o_f, Xo2_f, Xso2_f); + hc[i] = Medium_c.specificEnthalpy(Medium_c.setState_pTX(p=Pc0, T=Tc0[i - 1], X=Medium_c.X_default)); + hf[i] = Medium_f.specificEnthalpy(Medium_f.setState_pTX(p=Pf0, T=Tf0[i - 1], X=Medium_f.X_default)); end for; else for i in 2:N loop @@ -299,31 +294,14 @@ equation Sf.diff_res_1 = Ef.diff_res_1 + diff_res_t_f; Ef.diff_res_2 = Sf.diff_res_2 + diff_res_t_f; - Ec.ftype = Sc.ftype; - Sf.ftype = Ef.ftype; - - Ec.Xco2 = Sc.Xco2; - Ec.Xh2o = Sc.Xh2o; - Ec.Xo2 = Sc.Xo2; - Ec.Xso2 = Sc.Xso2; - - Sf.Xco2 = Ef.Xco2; - Sf.Xh2o = Ef.Xh2o; - Sf.Xo2 = Ef.Xo2; - Sf.Xso2 = Ef.Xso2; + Ec.Xi = Sc.Xi; + Ec.SubC = Sc.SubC; - ftype_c = Ec.ftype; - ftype_f = Sf.ftype; + Sf.Xi = Ef.Xi; + Sf.SubC = Ef.SubC; - Xco2_c = Ec.Xco2; - Xh2o_c = Ec.Xh2o; - Xo2_c = Ec.Xo2; - Xso2_c = Ec.Xso2; - - Xco2_f = Sf.Xco2; - Xh2o_f = Sf.Xh2o; - Xo2_f = Sf.Xo2; - Xso2_f = Sf.Xso2; + Xc = Ec.Xi; + Xf = Ef.Xi; /* Exchange area for the plate exchanger */ dS = (nbp - 2)*Sp/(N - 1); @@ -457,26 +435,28 @@ equation if (p_rhoc > 0) then rhoc1[i] = p_rhoc; else - rhoc1[i] = ThermoSysPro.Properties.Fluid.Density_Ph(Pc[i + 1], hc[i + 1], fluid_c, mode_c, Xco2_c, Xh2o_c, Xo2_c, Xso2_c); + rhoc1[i] = Medium_c.density(state_c1[i]); end if; - Tc1[i] = ThermoSysPro.Properties.Fluid.Temperature_Ph(Pc[i + 1], hc[i + 1], fluid_c, mode_c, Xco2_c, Xh2o_c, Xo2_c, Xso2_c); - cpc1[i] = ThermoSysPro.Properties.Fluid.SpecificHeatCapacityCp_Ph(Pc[i + 1], hc[i + 1], fluid_c, mode_c, Xco2_c, Xh2o_c, Xo2_c, Xso2_c); - muc1[i] = ThermoSysPro.Properties.Fluid.DynamicViscosity_Ph(Pc[i + 1], hc[i + 1], fluid_c, mode_c, Xco2_c, Xh2o_c, Xo2_c, Xso2_c); - kc1[i] = ThermoSysPro.Properties.Fluid.ThermalConductivity_Ph(Pc[i + 1], hc[i + 1], fluid_c, mode_c, Xco2_c, Xh2o_c, Xo2_c, Xso2_c); - lambdac1[i] = ThermoSysPro.Properties.Fluid.ThermalConductivity_rhoT(rhoc1[i], Tc1[i], Pc[i + 1], 0, fluid_c); + state_c1[i] = Medium_c.setState_phX(p=Pc[i + 1], h=hc[i + 1], X=Xc); + Tc1[i] = Medium_c.temperature(state_c1[i]); + cpc1[i] = Medium_c.specificHeatCapacityCp(state_c1[i]); + muc1[i] = Medium_c.dynamicViscosity(state_c1[i]); + kc1[i] = Medium_c.thermalConductivity(state_c1[i]); + lambdac1[i] = Medium_c.thermalConductivity(state_c1[i]); if (p_rhof > 0) then rhof1[i] = p_rhof; else - rhof1[i] = ThermoSysPro.Properties.Fluid.Density_Ph(Pf[i + 1], hf[i + 1], fluid_f, mode_f, Xco2_f, Xh2o_f, Xo2_f, Xso2_f); + rhof1[i] = Medium_f.density(state_f1[i]); end if; - Tf1[i] = ThermoSysPro.Properties.Fluid.Temperature_Ph(Pf[i + 1], hf[i + 1], fluid_f, mode_f, Xco2_f, Xh2o_f, Xo2_f, Xso2_f); - cpf1[i] = ThermoSysPro.Properties.Fluid.SpecificHeatCapacityCp_Ph(Pf[i + 1], hf[i + 1], fluid_f, mode_f, Xco2_f, Xh2o_f, Xo2_f, Xso2_f); - muf1[i] = ThermoSysPro.Properties.Fluid.DynamicViscosity_Ph(Pf[i + 1], hf[i + 1], fluid_f, mode_f, Xco2_f, Xh2o_f, Xo2_f, Xso2_f); - kf1[i] = ThermoSysPro.Properties.Fluid.ThermalConductivity_Ph(Pf[i + 1], hf[i + 1], fluid_f, mode_f, Xco2_f, Xh2o_f, Xo2_f, Xso2_f); - lambdaf1[i] = ThermoSysPro.Properties.Fluid.ThermalConductivity_rhoT(rhof1[i], Tf1[i], Pf[i + 1], 0, fluid_f); + state_f1[i] = Medium_f.setState_phX(p=Pf[i + 1], h=hf[i + 1], X=Xf); + Tf1[i] = Medium_f.temperature(state_f1[i]); + cpf1[i] = Medium_f.specificHeatCapacityCp(state_f1[i]); + muf1[i] = Medium_f.dynamicViscosity(state_f1[i]); + kf1[i] = Medium_f.thermalConductivity(state_f1[i]); + lambdaf1[i] = Medium_f.thermalConductivity(state_f1[i]); end for; /* Pressure losses correlations */ @@ -517,32 +497,38 @@ equation if (p_rhoc > 0) then rhoc2[i] = p_rhoc; else - rhoc2[i] = ThermoSysPro.Properties.Fluid.Density_Ph((Pc[i] + Pc[i + 1])/2, hbc[i], fluid_c, mode_c, Xco2_c, Xh2o_c, Xo2_c, Xso2_c); + rhoc2[i] = Medium_c.density(state_c2[i]); end if; - Tc2[i] = ThermoSysPro.Properties.Fluid.Temperature_Ph((Pc[i] + Pc[i + 1])/2, hbc[i], fluid_c, mode_c, Xco2_c, Xh2o_c, Xo2_c, Xso2_c); - cpc2[i] = ThermoSysPro.Properties.Fluid.SpecificHeatCapacityCp_Ph((Pc[i] + Pc[i + 1])/2, hbc[i], fluid_c, mode_c, Xco2_c, Xh2o_c, Xo2_c, Xso2_c); - muc2[i] = ThermoSysPro.Properties.Fluid.DynamicViscosity_Ph((Pc[i] + Pc[i + 1])/2, hbc[i], fluid_c, mode_c, Xco2_c, Xh2o_c, Xo2_c, Xso2_c); - kc2[i] = ThermoSysPro.Properties.Fluid.ThermalConductivity_Ph((Pc[i] + Pc[i + 1])/2, hbc[i], fluid_c, mode_c, Xco2_c, Xh2o_c, Xo2_c, Xso2_c); + state_c2[i] = Medium_c.setState_phX(p=(Pc[i] + Pc[i + 1])/2, h=hbc[i], X=Xc); + Tc2[i] = Medium_c.temperature(state_c2[i]); + cpc2[i] = Medium_c.specificHeatCapacityCp(state_c2[i]); + muc2[i] = Medium_c.dynamicViscosity(state_c2[i]); + kc2[i] = Medium_c.thermalConductivity(state_c2[i]); if (p_rhof > 0) then rhof2[i] = p_rhof; else - rhof2[i] = ThermoSysPro.Properties.Fluid.Density_Ph((Pf[i] + Pf[i + 1])/2, hbf[i], fluid_f, mode_f, Xco2_f, Xh2o_f, Xo2_f, Xso2_f); + rhof2[i] = Medium_f.density(state_f2[i]); end if; - Tf2[i] = ThermoSysPro.Properties.Fluid.Temperature_Ph((Pf[i] + Pf[i + 1])/2, hbf[i], fluid_f, mode_f, Xco2_f, Xh2o_f, Xo2_f, Xso2_f); - cpf2[i] = ThermoSysPro.Properties.Fluid.SpecificHeatCapacityCp_Ph((Pf[i] + Pf[i + 1])/2, hbf[i], fluid_f, mode_f, Xco2_f, Xh2o_f, Xo2_f, Xso2_f); - muf2[i] = ThermoSysPro.Properties.Fluid.DynamicViscosity_Ph((Pf[i] + Pf[i + 1])/2, hbf[i], fluid_f, mode_f, Xco2_f, Xh2o_f, Xo2_f, Xso2_f); - kf2[i] = ThermoSysPro.Properties.Fluid.ThermalConductivity_Ph((Pf[i] + Pf[i + 1])/2, hbf[i], fluid_f, mode_f, Xco2_f, Xh2o_f, Xo2_f, Xso2_f); + state_f2[i] = Medium_f.setState_phX(p=(Pf[i] + Pf[i + 1])/2, h=hbf[i], X=Xf); + Tf2[i] = Medium_f.temperature(state_f2[i]); + cpf2[i] = Medium_f.specificHeatCapacityCp(state_f2[i]); + muf2[i] = Medium_f.dynamicViscosity(state_f2[i]); + kf2[i] = Medium_f.thermalConductivity(state_f2[i]); end for; /* Calcul des températures en entrée et en sortie de l'échangeur */ - Tec = ThermoSysPro.Properties.Fluid.Temperature_Ph(Ec.P, Ec.h, fluid_c, mode_c, Xco2_c, Xh2o_c, Xo2_c, Xso2_c); - Tsc = ThermoSysPro.Properties.Fluid.Temperature_Ph(Sc.P, Sc.h, fluid_c, mode_c, Xco2_c, Xh2o_c, Xo2_c, Xso2_c); - - Tef = ThermoSysPro.Properties.Fluid.Temperature_Ph(Ef.P, Ef.h, fluid_f, mode_f, Xco2_f, Xh2o_f, Xo2_f, Xso2_f); - Tsf = ThermoSysPro.Properties.Fluid.Temperature_Ph(Sf.P, Sf.h, fluid_f, mode_f, Xco2_f, Xh2o_f, Xo2_f, Xso2_f); + state_ce = Medium_c.setState_phX(p=Ec.P, h=Ec.h, X=Xc); + state_cs = Medium_c.setState_phX(p=Sc.P, h=Sc.h, X=Xc); + Tec = Medium_c.temperature(state_ce); + Tsc = Medium_c.temperature(state_cs); + + state_fe = Medium_f.setState_phX(p=Ef.P, h=Ef.h, X=Xf); + state_fs = Medium_f.setState_phX(p=Sf.P, h=Sf.h, X=Xf); + Tef = Medium_f.temperature(state_fe); + Tsf = Medium_f.temperature(state_fs); /* Total fluid diffusion resistance */ diff_res_t_c = sum(diff_res_c); From cbb6f73cc29c0dba4a9aecac68146c328214f158 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Mon, 11 May 2026 14:10:23 +0200 Subject: [PATCH 126/178] #125 volatile example media --- .../PhasesSeparation.mo | 18 ++++++++++++++++++ .../WaterSteam_FullyVolatileTrace/package.mo | 5 +++++ .../package.order | 1 + .../SimpleExamples/Media/package.order | 1 + 4 files changed, 25 insertions(+) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Media/WaterSteam_FullyVolatileTrace/PhasesSeparation.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Media/WaterSteam_FullyVolatileTrace/package.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Media/WaterSteam_FullyVolatileTrace/package.order diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Media/WaterSteam_FullyVolatileTrace/PhasesSeparation.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Media/WaterSteam_FullyVolatileTrace/PhasesSeparation.mo new file mode 100644 index 00000000..988c4877 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Media/WaterSteam_FullyVolatileTrace/PhasesSeparation.mo @@ -0,0 +1,18 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Media.WaterSteam_FullyVolatileTrace; +function PhasesSeparation + extends partialPhasesSeparation; + input Real x(min=0, max=1) "Title"; + +algorithm + // // HomogeneousSubstance + // C_record.Cl := SubC; + // C_record.Cg := SubC; + + // // Non-volatile + // C_record.Cl := SubC/(1 - x); + // C_record.Cg := fill(0, size(SubC, 1)); + +// Fully-volatile +C_record.Cl := fill(0,size(SubC,1)); +C_record.Cg := SubC / x; +end PhasesSeparation; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Media/WaterSteam_FullyVolatileTrace/package.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Media/WaterSteam_FullyVolatileTrace/package.mo new file mode 100644 index 00000000..fabdb6d5 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Media/WaterSteam_FullyVolatileTrace/package.mo @@ -0,0 +1,5 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Media; +package WaterSteam_FullyVolatileTrace + extends Properties.Media.WaterSteam(extraPropertiesNames={"Trace"}, C_nominal={0.1}, C_default={0.2}); + +end WaterSteam_FullyVolatileTrace; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Media/WaterSteam_FullyVolatileTrace/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/Media/WaterSteam_FullyVolatileTrace/package.order new file mode 100644 index 00000000..11ebc226 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Media/WaterSteam_FullyVolatileTrace/package.order @@ -0,0 +1 @@ +PhasesSeparation diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Media/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/Media/package.order index cc36f421..ddcc39f2 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Media/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Media/package.order @@ -1 +1,2 @@ WaterSteam_NonVolatileTrace +WaterSteam_FullyVolatileTrace From b13b19c631712ce8df4e145b32179b8664185187 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Mon, 11 May 2026 16:09:52 +0200 Subject: [PATCH 127/178] #125 SimpleDynamicCondenser SubC balance but example strange --- .../TestSimpleDynamicCondenser_Traces.mo | 12 +++--- .../HeatExchangers/SimpleDynamicCondenser.mo | 43 ++++++++++++++++++- 2 files changed, 46 insertions(+), 9 deletions(-) diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestSimpleDynamicCondenser_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestSimpleDynamicCondenser_Traces.mo index 8846a345..4f669ff2 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestSimpleDynamicCondenser_Traces.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestSimpleDynamicCondenser_Traces.mo @@ -2,10 +2,7 @@ within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; model TestSimpleDynamicCondenser_Traces extends ThermoSysPro.UsersGuide.Icons.Example; - replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam( - extraPropertiesNames={"Trace1", "Trace2"}, - C_nominal={0.1, 2}, - C_default={0.2, 5}); + replaceable package Medium = ThermoSysPro.Fluid.Examples.SimpleExamples.Media.WaterSteam_FullyVolatileTrace; ThermoSysPro.Fluid.BoundaryConditions.SinkP puitsPCaloporteur( redeclare package Medium = Medium, @@ -20,7 +17,7 @@ model TestSimpleDynamicCondenser_Traces option_temperature=false, h0=2401e3, P0=15050, - SubC0={10,20}) annotation (Placement(transformation(extent={{-207,148},{-183,170}}, rotation=0))); + SubC0={10}) annotation (Placement(transformation(extent={{-207,148},{-183,170}}, rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.SinkQ PuitsRechauffeurEau( redeclare package Medium = Medium, h0=191812, @@ -29,7 +26,7 @@ model TestSimpleDynamicCondenser_Traces redeclare package Medium = Medium, Q0=29804.5, h0=113e3, - SubC0={10,20}) annotation (Placement(transformation(extent={{-212,30},{-172,68}}, rotation=0))); + SubC0={10}) annotation (Placement(transformation(extent={{-212,30},{-172,68}}, rotation=0))); ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss PerteChargeCondPompe1( redeclare package Medium = Medium, K=1e-6) annotation (Placement(transformation(origin={36,50}, extent={{6,-10},{-6,10}}, rotation=180))); @@ -39,11 +36,12 @@ model TestSimpleDynamicCondenser_Traces ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss PerteChargeCondPompe3( redeclare package Medium = Medium, K(fixed=false)=1e-3, - Q(start=192, fixed=true)) + Q(fixed=true,start=192)) annotation (Placement(transformation(origin={-120,159}, extent={{10,-10},{-10,10}}, rotation=180))); ThermoSysPro.Fluid.HeatExchangers.SimpleDynamicCondenser Condenseur( redeclare package Medium = Medium, redeclare package Medium_Cooling = Medium, + redeclare function PhasesSeparationFunction = Medium.PhasesSeparation(x=Condenseur.xv), D=0.018, V=1000, A=100, diff --git a/ThermoSysPro/Fluid/HeatExchangers/SimpleDynamicCondenser.mo b/ThermoSysPro/Fluid/HeatExchangers/SimpleDynamicCondenser.mo index e535bea9..8861ebeb 100644 --- a/ThermoSysPro/Fluid/HeatExchangers/SimpleDynamicCondenser.mo +++ b/ThermoSysPro/Fluid/HeatExchangers/SimpleDynamicCondenser.mo @@ -1,9 +1,11 @@ -within ThermoSysPro.Fluid.HeatExchangers; +within ThermoSysPro.Fluid.HeatExchangers; model SimpleDynamicCondenser "Simple dynamic condenser" extends ThermoSysPro.Fluid.Interfaces.IconColors; replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialTwoPhaseThermoSysProMedium "Medium model for the condenser cavity" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); replaceable package Medium_Cooling = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialTwoPhaseThermoSysProMedium "Medium model for the cooling pipes" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable function SaS = Medium.noSaS(SubC = SubCv) annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable function PhasesSeparationFunction = Medium.HomogeneousPhasesSeparation(SubC = Cv.SubC) annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Units.SI.Volume V=1 "Cavity volume"; parameter Units.SI.Area A=1 "Cavity cross-sectional area"; @@ -32,6 +34,14 @@ model SimpleDynamicCondenser "Simple dynamic condenser" "Fluid initial pressure (active if dynamic_energy_balance=true and steady_state=false)" annotation (Evaluate=true, Dialog(enable=dynamic_energy_balance and not steady_state)); + parameter Medium.ExtraProperty SubCl0[Medium.nC](quantity=Medium.extraPropertiesNames)=Medium.C_default + "Initial liquid phase trace substances (active if dynamic_energy_balance=true and steady_state=false)" + annotation (Evaluate=true, Dialog(enable=dynamic_energy_balance and not + steady_state)); + parameter Medium.ExtraProperty SubCv0[Medium.nC](quantity=Medium.extraPropertiesNames)=Medium.C_default + "Initial vapor phase trace substances (active if dynamic_energy_balance=true and steady_state=false)" + annotation (Evaluate=true, Dialog(enable=dynamic_energy_balance and not + steady_state)); parameter Boolean continuous_flow_reversal=false "true: continuous flow reversal - false: discontinuous flow reversal"; parameter Boolean diffusion=false "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; @@ -74,6 +84,11 @@ public "Right hand side of the mass balance equation of the liquid phase in the cavity"; Units.SI.MassFlowRate BQv "Right hand side of the mass balance equation of the gas phase in the cavity"; + Medium.ExtraProperty BSubCl[Medium.nC](quantity=Medium.extraPropertiesNames) + "Right hand side of the trace balance equation of the liquid phase in the cavity"; + Medium.ExtraProperty BSubCv[Medium.nC](quantity=Medium.extraPropertiesNames) + "Right hand side of the trace balance equation of the vapor phase in the cavity"; + Medium.C_BiPhase C_record; Units.SI.Power BHl "Right hand side of the energy balance equation of the liquid phase in the cavity"; Units.SI.Power BHv @@ -99,6 +114,9 @@ public Units.SI.MassFlowRate gamma_diff(start=1.e-4) "Diffusion conductance in the pipes"; Medium.MassFraction X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Mass fractions in the condenser cavity"; + Medium.ExtraProperty SubCl[Medium.nC](quantity=Medium.extraPropertiesNames, start=Medium.C_default) "Liquid phase trace substances in the cavity"; + Medium.ExtraProperty SubCv[Medium.nC](quantity=Medium.extraPropertiesNames, start=Medium.C_default) "Vapor phase trace substances in the cavity"; + Medium.ExtraProperty SubCSaS[Medium.nC](quantity=Medium.extraPropertiesNames) "Trace modification in the trace balance equation"; Medium_Cooling.MassFraction Xp[Medium_Cooling.nXi](start=Medium_Cooling.X_default[1:Medium_Cooling.nXi]) "Mass fractions in the cooling pipes"; Medium.ThermodynamicState state_l "Liquid phase thermodynamic state in the cavity"; Medium.ThermodynamicState state_v "Vapor phase thermodynamic state in the cavity"; @@ -124,11 +142,15 @@ initial equation der(hv) = 0; der(Vl) = 0; der(P) = 0; + der(SubCl) = fill(0, Medium.nC); + der(SubCv) = fill(0, Medium.nC); else hl = Medium.bubbleEnthalpy(Medium.setSat_p(P0)); hv = Medium.dewEnthalpy(Medium.setSat_p(P0)); Vl = Vf0*V; P = P0; + SubCl = SubCl0; + SubCv = SubCv0; end if; end if; @@ -237,9 +259,26 @@ equation /* Fluid composition in the cavity (no balance equations) */ Cv.Xi = Cl.Xi; - Cv.SubC = Cl.SubC; X = Cv.Xi; + /* Traces composition balance equations */ + C_record = PhasesSeparationFunction(); + + SubCSaS = SaS(); + + BSubCl = Qcond*C_record.Cl - Qevap*SubCl - Cl.Q*Cl.SubC; + BSubCv = Cv.Q*Cv.SubC + Qevap*SubCl - Qcond*C_record.Cg; + + if dynamic_energy_balance then + Vl*rhol*der(SubCl) + SubCl*BQl = BSubCl; + Vv*rhov*der(SubCv) + SubCv*BQv + Vv*rhov*SubCSaS = BSubCv; + else + SubCl*BQl = BSubCl; + SubCv*BQv + Vv*rhov*SubCSaS = BSubCv; + end if; + + Cl.SubC = SubCl; + /* Pipes inlet and outlet */ Cee.Q = Cse.Q; From 3e4c3f03b600efdf71f52b591ba314bfbbf19665 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Tue, 12 May 2026 08:53:00 +0200 Subject: [PATCH 128/178] #125 DynamicDrum --- .../SimpleExamples/Volumes/TestDynamicDrum.mo | 34 +++ .../Volumes/TestDynamicDrum_Traces.mo | 37 +++ .../SimpleExamples/Volumes/package.order | 2 + ThermoSysPro/Fluid/Volumes/DynamicDrum.mo | 210 +++++++++--------- 4 files changed, 175 insertions(+), 108 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestDynamicDrum.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestDynamicDrum_Traces.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestDynamicDrum.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestDynamicDrum.mo new file mode 100644 index 00000000..653e56e1 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestDynamicDrum.mo @@ -0,0 +1,34 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Volumes; +model TestDynamicDrum + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; + + ThermoSysPro.Fluid.Volumes.DynamicDrum drum( + redeclare package Medium = Medium, + Vertical=false, + steady_state=false, + Vv(start=39), + hl(start=1454400), + hv(start=2.658e6), + xv(start=0.01), + rhol(start=670), + rhov(start=78), + P0=13000000, + P(start=13000000, fixed=true), + Tp(start=592.6), + zl(start=1.05)) annotation (Placement(transformation(extent={{-20,-20},{40,40}}, rotation=0))); + + ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkQ(redeclare replaceable package Medium = Medium, Q0=1) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=0, + origin={80,-20}))); +equation + + connect(drum.Cs, sinkQ.C) annotation (Line(points={{40,-2},{64,-2},{64,-20},{70,-20}}, color={0,0,0})); + annotation ( + experiment(StopTime=1000), + Icon(coordinateSystem(preserveAspectRatio=false)), + Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-120,-100},{120,80}}))); +end TestDynamicDrum; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestDynamicDrum_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestDynamicDrum_Traces.mo new file mode 100644 index 00000000..2b29f22e --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestDynamicDrum_Traces.mo @@ -0,0 +1,37 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Volumes; +model TestDynamicDrum_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Fluid.Examples.SimpleExamples.Media.WaterSteam_FullyVolatileTrace; + + ThermoSysPro.Fluid.Volumes.DynamicDrum drum( + redeclare package Medium = Medium, + redeclare function PhasesSeparationFunction = Medium.PhasesSeparation(x=drum.xv), + Vertical=false, + steady_state=false, + Vv(start=39), + hl(start=1454400), + hv(start=2.658e6), + xv(start=0.01), + rhol(start=670), + rhov(start=78), + P0=13000000, + P(start=13000000, fixed=true), + Tp(start=592.6), + zl(start=1.05), + SubCl0={0}, + SubCv0={10}) annotation (Placement(transformation(extent={{-20,-20},{40,40}}, rotation=0))); + + ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkQ(redeclare replaceable package Medium = Medium, Q0=1) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=0, + origin={80,-20}))); +equation + + connect(drum.Cs, sinkQ.C) annotation (Line(points={{40,-2},{64,-2},{64,-20},{70,-20}}, color={0,0,0})); + annotation ( + experiment(StopTime=1000), + Icon(coordinateSystem(preserveAspectRatio=false)), + Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-120,-100},{120,80}}))); +end TestDynamicDrum_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order index ef3c194c..ea2c1932 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order @@ -30,3 +30,5 @@ TestVolumeITh_FlueGases TestVolumeITh_Traces TestTank_withPipePressureLosses TestTank_Traces_withPipePressureLosses +TestDynamicDrum +TestDynamicDrum_Traces diff --git a/ThermoSysPro/Fluid/Volumes/DynamicDrum.mo b/ThermoSysPro/Fluid/Volumes/DynamicDrum.mo index 333287f5..452b8862 100644 --- a/ThermoSysPro/Fluid/Volumes/DynamicDrum.mo +++ b/ThermoSysPro/Fluid/Volumes/DynamicDrum.mo @@ -1,9 +1,9 @@ -within ThermoSysPro.Fluid.Volumes; +within ThermoSysPro.Fluid.Volumes; model DynamicDrum "Dynamic drum" - extends - ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.WaterSteamFluidTypeParameterInterface; extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialTwoPhaseThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable function SaS = Medium.noSaS(SubC = SubCv) annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable function PhasesSeparationFunction = Medium.HomogeneousPhasesSeparation(SubC = Cv.SubC) annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Boolean Vertical=true "true: vertical cylinder - false: horizontal cylinder"; @@ -38,15 +38,21 @@ model DynamicDrum "Dynamic drum" parameter Boolean continuous_flow_reversal=false "true: continuous flow reversal - false: discontinuous flow reversal"; parameter Boolean diffusion=false "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; + parameter Medium.ExtraProperty SubCl0[Medium.nC](quantity=Medium.extraPropertiesNames)=Medium.C_default + "Initial liquid phase trace substances" + annotation (Evaluate=true, Dialog(enable=dynamic_energy_balance and not steady_state)); + parameter Medium.ExtraProperty SubCv0[Medium.nC](quantity=Medium.extraPropertiesNames)=Medium.C_default + "Initial vapor phase trace substances" + annotation (Evaluate=true, Dialog(enable=dynamic_energy_balance and not steady_state)); protected constant Real pi=Modelica.Constants.pi "pi"; constant Units.SI.Acceleration g=Modelica.Constants.g_n "Gravity constant"; - parameter Integer fluid=Integer(ftype) "Fluid number"; parameter Units.SI.Volume V=pi*R^2*L "Drum volume"; parameter Units.SI.MassFlowRate gamma0=1.e-4 "Pseudo-diffusion conductance use for continuous flow reversal (active if diffusion=false and continuous_flow_reversal = true)"; parameter Units.SI.Volume Vmin=1.e-6; + Medium.C_BiPhase C_record; public Units.SI.AbsolutePressure P "Fluid average pressure"; @@ -90,7 +96,6 @@ public Units.SI.Angle theta "Angle"; Units.SI.Area Avl(start=1.0) "Heat exchange surface between the liquid and gas phases"; - FluidType fluids[8] "Fluids mixing in volume"; Units.SI.Power Je1 "Thermal power diffusion from inlet Ce1"; Units.SI.Power Je2 "Thermal power diffusion from inlet Ce2"; Units.SI.Power Je3 "Thermal power diffusion from inlet Ce3"; @@ -114,30 +119,36 @@ public Real rd "Value of r(Q/gamma) for outlet Cd"; Real rs "Value of r(Q/gamma) for outlet Cs"; Real rv "Value of r(Q/gamma) for outlet Cv"; - - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph prol - "Propri鴩s de l'eau dans le ballon" annotation (Placement(transformation( - extent={{-60,40},{-20,80}}, rotation=0))); - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph prov - "Propri鴩s de la vapeur dans le ballon" annotation (Placement( - transformation(extent={{0,40},{40,80}}, rotation=0))); + Medium.ExtraProperty BSubCl[Medium.nC](quantity=Medium.extraPropertiesNames) + "Right hand side of the trace balance equation of the liquid phase"; + Medium.ExtraProperty BSubCv[Medium.nC](quantity=Medium.extraPropertiesNames) + "Right hand side of the trace balance equation of the vapor phase"; + Medium.ExtraProperty SubCl[Medium.nC](quantity=Medium.extraPropertiesNames, start=Medium.C_default) + "Liquid phase trace substances"; + Medium.ExtraProperty SubCv[Medium.nC](quantity=Medium.extraPropertiesNames, start=Medium.C_default) + "Vapor phase trace substances"; + Medium.ExtraProperty SubCSaS[Medium.nC](quantity=Medium.extraPropertiesNames) + "Trace modification in the trace balance equation"; + + Medium.ThermodynamicState prol "Liquid state in the drum"; + Medium.ThermodynamicState prov "Vapor state in the drum"; + Medium.ThermodynamicState prom "Evaporation loop state"; + Medium.ThermodynamicState prod "Downcomer outlet state"; + Medium.SaturationProperties sat "Saturation properties at drum pressure"; + Units.SI.SpecificEnthalpy hlsat "Bubble enthalpy at drum pressure"; + Units.SI.SpecificEnthalpy hvsat "Dew enthalpy at drum pressure"; + Real ddphl "Liquid density derivative wrt. pressure at constant enthalpy"; + Real ddhpl "Liquid density derivative wrt. enthalpy at constant pressure"; + Real ddphv "Vapor density derivative wrt. pressure at constant enthalpy"; + Real ddhpv "Vapor density derivative wrt. enthalpy at constant pressure"; public - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph prom - annotation (Placement(transformation(extent={{-60,-20},{-20,20}}, rotation= - 0))); - ThermoSysPro.Properties.WaterSteam.Common.PropThermoSat lsat - annotation (Placement(transformation(extent={{-60,-80},{-20,-40}}, rotation= - 0))); - ThermoSysPro.Properties.WaterSteam.Common.PropThermoSat vsat - annotation (Placement(transformation( - extent={{0,-80},{40,-40}}, rotation=0))); - Interfaces.Connectors.FluidInlet Ce1 "Feedwater input 1" annotation ( + Interfaces.Connectors.FluidInlet Ce1(redeclare package Medium = Medium) "Feedwater input 1" annotation ( Placement(transformation(extent={{-110,90},{-90,110}}, rotation=0))); - Interfaces.Connectors.FluidInlet Cm "Evaporation loop outlet" annotation ( + Interfaces.Connectors.FluidInlet Cm(redeclare package Medium = Medium) "Evaporation loop outlet" annotation ( Placement(transformation(extent={{90,-110},{110,-90}}, rotation=0))); - Interfaces.Connectors.FluidOutlet Cd "Evaporation loop inlet" annotation ( + Interfaces.Connectors.FluidOutlet Cd(redeclare package Medium = Medium) "Evaporation loop inlet" annotation ( Placement(transformation(extent={{-110,-110},{-90,-90}}, rotation=0))); - Interfaces.Connectors.FluidOutlet Cv "Steam outlet" annotation (Placement( + Interfaces.Connectors.FluidOutlet Cv(redeclare package Medium = Medium) "Steam outlet" annotation (Placement( transformation(extent={{90,90},{110,110}}, rotation=0))); ThermoSysPro.InstrumentationAndControl.Connectors.OutputReal yLevel "Water level " @@ -150,14 +161,12 @@ public annotation (Placement(transformation(extent={{-10,90}, {10,110}}, rotation=0))); public - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph prod - annotation (Placement(transformation(extent={{0,-20},{40,20}}, rotation=0))); - Interfaces.Connectors.FluidInlet Ce2 "Feedwater input 2" annotation ( + Interfaces.Connectors.FluidInlet Ce2(redeclare package Medium = Medium) "Feedwater input 2" annotation ( Placement(transformation(extent={{-110,30},{-90,50}}, rotation=0), iconTransformation(extent={{-110,30},{-90,50}}))); - Interfaces.Connectors.FluidInlet Ce3 "Feedwater input 3" annotation ( + Interfaces.Connectors.FluidInlet Ce3(redeclare package Medium = Medium) "Feedwater input 3" annotation ( Placement(transformation(extent={{-110,-50},{-90,-30}}, rotation=0))); - Interfaces.Connectors.FluidOutlet Cs "Water outlet" annotation (Placement( + Interfaces.Connectors.FluidOutlet Cs(redeclare package Medium = Medium) "Water outlet" annotation (Placement( transformation(extent={{90,-50},{110,-30}}, rotation=0))); initial equation if dynamic_energy_balance then @@ -167,29 +176,20 @@ initial equation der(hv) = 0; der(Vl) = 0; der(Tp) = 0; + der(SubCl) = fill(0, Medium.nC); + der(SubCv) = fill(0, Medium.nC); else P = P0; - hl = lsat.h; - hv = vsat.h; + hl = hlsat; + hv = hvsat; Vl = Vf0*V; der(Tp) = 0; + SubCl = SubCl0; + SubCv = SubCv0; end if; end if; equation - /* Check that incoming fluids are compatible with fluid in volume */ - fluids[1] = ftype; - fluids[2] = Ce1.ftype; - fluids[3] = Ce2.ftype; - fluids[4] = Ce3.ftype; - fluids[5] = Cm.ftype; - fluids[6] = Cd.ftype; - fluids[7] = Cs.ftype; - fluids[8] = Cv.ftype; - - assert(ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.isCompatible(fluids), - "DynamicDrum: fluids mixing in volume are not compatible with each other"); - /* Unconnected connectors */ if (cardinality(Ce1) == 0) then Ce1.Q = 0; @@ -197,11 +197,7 @@ equation Ce1.h_vol_1 = 1.e5; Ce1.diff_res_1 = 0; Ce1.diff_on_1 = false; - Ce1.ftype = ftype; - Ce1.Xco2 = 0; - Ce1.Xh2o = 0; - Ce1.Xo2 = 0; - Ce1.Xso2 = 0; + Ce1.SubC = Medium.C_default; end if; if (cardinality(Ce2) == 0) then @@ -210,11 +206,7 @@ equation Ce2.h_vol_1 = 1.e5; Ce2.diff_res_1 = 0; Ce2.diff_on_1 = false; - Ce2.ftype = ftype; - Ce2.Xco2 = 0; - Ce2.Xh2o = 0; - Ce2.Xo2 = 0; - Ce2.Xso2 = 0; + Ce2.SubC = Medium.C_default; end if; if (cardinality(Ce3) == 0) then @@ -223,11 +215,7 @@ equation Ce3.h_vol_1 = 1.e5; Ce3.diff_res_1 = 0; Ce3.diff_on_1 = false; - Ce3.ftype = ftype; - Ce3.Xco2 = 0; - Ce3.Xh2o = 0; - Ce3.Xo2 = 0; - Ce3.Xso2 = 0; + Ce3.SubC = Medium.C_default; end if; if (cardinality(Cm) == 0) then @@ -236,11 +224,7 @@ equation Cm.h_vol_1 = 1.e5; Cm.diff_res_1 = 0; Cm.diff_on_1 = false; - Cm.ftype = ftype; - Cm.Xco2 = 0; - Cm.Xh2o = 0; - Cm.Xo2 = 0; - Cm.Xso2 = 0; + Cm.SubC = Medium.C_default; end if; if (cardinality(Cd) == 0) then @@ -291,13 +275,13 @@ equation Ape = Alp + Avp; /* Pressure at the bottom of the drum */ - Pfond = P + prod.d*g*zl; + Pfond = P + Medium.density(prod)*g*zl; /* Liquid phase mass balance equation */ BQl = Ce1.Q + Ce2.Q + Ce3.Q - Cd.Q - Cs.Q + (1 - xmv)*Cm.Q + Qcond - Qevap; if dynamic_energy_balance then - rhol*der(Vl) + Vl*(prol.ddph*der(P) + prol.ddhp*der(hl)) = BQl; + rhol*der(Vl) + Vl*(ddphl*der(P) + ddhpl*der(hl)) = BQl; else 0 = BQl; end if; @@ -306,7 +290,7 @@ equation BQv = xmv*Cm.Q - Cv.Q + Qevap - Qcond; if dynamic_energy_balance then - rhov*der(Vv) + Vv*(prov.ddph*der(P) + prov.ddhp*der(hv)) = BQv; + rhov*der(Vv) + Vv*(ddphv*der(P) + ddhpv*der(hv)) = BQv; else 0 = BQv; end if; @@ -326,22 +310,22 @@ equation /* Liquid phase energy balance equation */ BHl = Ce1.Q*(Ce1.h - (hl - P/rhol)) + Ce2.Q*(Ce2.h - (hl - P/rhol)) + Ce3.Q*(Ce3.h - (hl - P/rhol)) - Cd.Q*(Cd.h - (hl - P/rhol)) - Cs.Q*(Cs.h - (hl - P/rhol)) - + (1 - xmv)*Cm.Q*((if (xmv > 0) then lsat.h else Cm.h) - (hl - P/rhol)) - + Qcond*(lsat.h - (hl - P/rhol)) - Qevap*(vsat.h - (hl - P/rhol)) + Wlv - Wpl + Cth.W + Jt_l; + + (1 - xmv)*Cm.Q*((if (xmv > 0) then hlsat else Cm.h) - (hl - P/rhol)) + + Qcond*(hlsat - (hl - P/rhol)) - Qevap*(hvsat - (hl - P/rhol)) + Wlv - Wpl + Cth.W + Jt_l; if dynamic_energy_balance then - Vl*((P/rhol*prol.ddph - 1)*der(P) + (P/rhol*prol.ddhp + rhol)*der(hl)) = BHl; + Vl*((P/rhol*ddphl - 1)*der(P) + (P/rhol*ddhpl + rhol)*der(hl)) = BHl; else 0 = BHl; end if; /* Gas phase energy balance equation */ - BHv = xmv*Cm.Q*((if (xmv < 1) then vsat.h else Cm.h) - (hv - P/rhov)) - - Cv.Q*(Cv.h - (hv - P/rhov)) + Qevap*(vsat.h - (hv - P/rhov)) - Qcond*(lsat.h - (hv - P/rhov)) + BHv = xmv*Cm.Q*((if (xmv < 1) then hvsat else Cm.h) - (hv - P/rhov)) + - Cv.Q*(Cv.h - (hv - P/rhov)) + Qevap*(hvsat - (hv - P/rhov)) - Qcond*(hlsat - (hv - P/rhov)) - Wlv - Wpv + Jt_v; if dynamic_energy_balance then - Vv*((P/rhov*prov.ddph - 1)*der(P) + (P/rhov*prov.ddhp + rhov)*der(hv)) = BHv; + Vv*((P/rhov*ddphv - 1)*der(P) + (P/rhov*ddhpv + rhov)*der(hv)) = BHv; else 0 = BHv; end if; @@ -350,7 +334,7 @@ equation Ce2.h_vol_2 = hl; Ce3.h_vol_2 = hl; Cm.h_vol_2 = hl; - Cd.h_vol_1 = noEvent(min(lsat.h, hl)); + Cd.h_vol_1 = noEvent(min(hlsat, hl)); Cs.h_vol_1 = hl; Cv.h_vol_1 = hv; @@ -373,23 +357,26 @@ equation /* Heat exchange between the wall and the outside */ Wpa = Kpa*Ape*(Ta - Tp); - /* Fluid composition (no balance equations) */ - Cd.ftype = ftype; - Cs.ftype = ftype; - Cv.ftype = ftype; - - Cd.Xco2 = 0; - Cd.Xh2o = 0; - Cd.Xo2 = 0; - Cd.Xso2 = 0; - Cs.Xco2 = 0; - Cs.Xh2o = 0; - Cs.Xo2 = 0; - Cs.Xso2 = 0; - Cv.Xco2 = 0; - Cv.Xh2o = 0; - Cv.Xo2 = 0; - Cv.Xso2 = 0; + /* Traces composition balance equations */ + C_record = PhasesSeparationFunction(); + SubCSaS = SaS(); + + BSubCl = Ce1.Q*Ce1.SubC + Ce2.Q*Ce2.SubC + Ce3.Q*Ce3.SubC + - Cd.Q*Cd.SubC - Cs.Q*Cs.SubC + (1 - xmv)*Cm.Q*Cm.SubC + + Qcond*C_record.Cl - Qevap*SubCl; + BSubCv = xmv*Cm.Q*Cm.SubC - Cv.Q*Cv.SubC + Qevap*SubCl - Qcond*C_record.Cg; + + if dynamic_energy_balance then + rhol*Vl*der(SubCl) + SubCl*BQl = BSubCl; + rhov*Vv*der(SubCv) + SubCv*BQv + rhov*Vv*SubCSaS = BSubCv; + else + SubCl*BQl = BSubCl; + SubCv*BQv + rhov*Vv*SubCSaS = BSubCv; + end if; + + Cd.SubC = SubCl; + Cs.SubC = SubCl; + Cv.SubC = SubCv; /* Flow reversal */ if continuous_flow_reversal then @@ -473,21 +460,28 @@ equation Cv.diff_on_1 = diffusion; /* Fluid thermodynamic properties */ - prol = ThermoSysPro.Properties.Fluid.Ph(P, hl, 0, fluid); - prov = ThermoSysPro.Properties.Fluid.Ph(P, hv, 0, fluid); - prod = ThermoSysPro.Properties.Fluid.Ph(Pfond, Cd.h, 0, fluid); - prom = ThermoSysPro.Properties.Fluid.Ph(P, Cm.h, 0, fluid); - (lsat,vsat) = ThermoSysPro.Properties.Fluid.Water_sat_P(P, fluid); - - Tl = prol.T; - rhol = prol.d; - xl = prol.x; - - Tv = prov.T; - rhov = prov.d; - xv = prov.x; - - xmv = if noEvent(Cm.Q > 0) then prom.x else 0; + prol = Medium.setState_phX(p=P, h=hl, X=Medium.reference_X); + prov = Medium.setState_phX(p=P, h=hv, X=Medium.reference_X); + prod = Medium.setState_phX(p=Pfond, h=Cd.h, X=Medium.reference_X); + prom = Medium.setState_phX(p=P, h=Cm.h, X=Medium.reference_X); + sat = Medium.setSat_p(P); + hlsat = Medium.bubbleEnthalpy(sat); + hvsat = Medium.dewEnthalpy(sat); + + ddphl = Medium.density_derp_h(prol); + ddhpl = Medium.density_derh_p(prol); + ddphv = Medium.density_derp_h(prov); + ddhpv = Medium.density_derh_p(prov); + + Tl = Medium.temperature(prol); + rhol = Medium.density(prol); + xl = noEvent(max(0, min(1, (hl - hlsat)/(hvsat - hlsat)))); + + Tv = Medium.temperature(prov); + rhov = Medium.density(prov); + xv = noEvent(max(0, min(1, (hv - hlsat)/(hvsat - hlsat)))); + + xmv = if noEvent(Cm.Q > 0) then noEvent(max(0, min(1, (Cm.h - hlsat)/(hvsat - hlsat)))) else 0; Cth.T = Tl; Cex.T = Ta; From 796d8b01a1f613d80b9b63d57b95dd3d9af3ab91 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Tue, 12 May 2026 09:09:29 +0200 Subject: [PATCH 129/178] #125 TwoPhaseVolume --- .../Volumes/TestTwoPhaseVolume.mo | 31 ++++ .../Volumes/TestTwoPhaseVolume_Traces.mo | 35 ++++ .../SimpleExamples/Volumes/package.order | 2 + ThermoSysPro/Fluid/Volumes/DynamicDrum.mo | 34 ++-- ThermoSysPro/Fluid/Volumes/TwoPhaseVolume.mo | 153 ++++++++++-------- 5 files changed, 169 insertions(+), 86 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestTwoPhaseVolume.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestTwoPhaseVolume_Traces.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestTwoPhaseVolume.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestTwoPhaseVolume.mo new file mode 100644 index 00000000..1279de8f --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestTwoPhaseVolume.mo @@ -0,0 +1,31 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Volumes; +model TestTwoPhaseVolume + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; + ThermoSysPro.Fluid.Volumes.TwoPhaseVolume volume( + steady_state=false, + P0=13000000, + P(start=13000000, fixed=true), + hl(start=1454400), + hv(start=2.658e6), + xv(start=0.01), + rhol(start=670), + rhov(start=78), + V=80, + A=20, + Vf0=0.5, + redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-20,-20},{40,40}}, rotation=0))); + + ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkQ(redeclare replaceable package Medium = Medium, Q0=1) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=0, + origin={30,-40}))); +equation + connect(sinkQ.C, volume.Cl) annotation (Line(points={{20,-40},{10,-40},{10,-20}}, color={0,0,0})); + annotation ( + experiment(StopTime=1000), + Icon(coordinateSystem(preserveAspectRatio=false)), + Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-120,-100},{120,80}}))); +end TestTwoPhaseVolume; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestTwoPhaseVolume_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestTwoPhaseVolume_Traces.mo new file mode 100644 index 00000000..b3ab2755 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestTwoPhaseVolume_Traces.mo @@ -0,0 +1,35 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Volumes; +model TestTwoPhaseVolume_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Fluid.Examples.SimpleExamples.Media.WaterSteam_FullyVolatileTrace; + + ThermoSysPro.Fluid.Volumes.TwoPhaseVolume volume( + redeclare package Medium = Medium, + redeclare function PhasesSeparationFunction = Medium.PhasesSeparation(x=volume.xv), + steady_state=false, + P0=13000000, + P(start=13000000, fixed=true), + hl(start=1454400), + hv(start=2.658e6), + xv(start=0.01), + rhol(start=670), + rhov(start=78), + V=80, + A=20, + Vf0=0.5, + SubCl0={0}, + SubCv0={10}) annotation (Placement(transformation(extent={{-20,-20},{40,40}}, rotation=0))); + + ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkQ(redeclare replaceable package Medium = Medium, Q0=1) + annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=0, + origin={30,-40}))); +equation + connect(sinkQ.C, volume.Cl) annotation (Line(points={{20,-40},{10,-40},{10,-20}}, color={0,0,0})); + annotation ( + experiment(StopTime=1000), + Icon(coordinateSystem(preserveAspectRatio=false)), + Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-120,-100},{120,80}}))); +end TestTwoPhaseVolume_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order index ea2c1932..3fee47d4 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order @@ -32,3 +32,5 @@ TestTank_withPipePressureLosses TestTank_Traces_withPipePressureLosses TestDynamicDrum TestDynamicDrum_Traces +TestTwoPhaseVolume +TestTwoPhaseVolume_Traces diff --git a/ThermoSysPro/Fluid/Volumes/DynamicDrum.mo b/ThermoSysPro/Fluid/Volumes/DynamicDrum.mo index 452b8862..69138fb8 100644 --- a/ThermoSysPro/Fluid/Volumes/DynamicDrum.mo +++ b/ThermoSysPro/Fluid/Volumes/DynamicDrum.mo @@ -130,10 +130,10 @@ public Medium.ExtraProperty SubCSaS[Medium.nC](quantity=Medium.extraPropertiesNames) "Trace modification in the trace balance equation"; - Medium.ThermodynamicState prol "Liquid state in the drum"; - Medium.ThermodynamicState prov "Vapor state in the drum"; - Medium.ThermodynamicState prom "Evaporation loop state"; - Medium.ThermodynamicState prod "Downcomer outlet state"; + Medium.ThermodynamicState state_l "Liquid state in the drum"; + Medium.ThermodynamicState state_v "Vapor state in the drum"; + Medium.ThermodynamicState state_m "Evaporation loop state"; + Medium.ThermodynamicState state_out_l "Downcomer outlet state"; Medium.SaturationProperties sat "Saturation properties at drum pressure"; Units.SI.SpecificEnthalpy hlsat "Bubble enthalpy at drum pressure"; Units.SI.SpecificEnthalpy hvsat "Dew enthalpy at drum pressure"; @@ -275,7 +275,7 @@ equation Ape = Alp + Avp; /* Pressure at the bottom of the drum */ - Pfond = P + Medium.density(prod)*g*zl; + Pfond = P + Medium.density(state_out_l)*g*zl; /* Liquid phase mass balance equation */ BQl = Ce1.Q + Ce2.Q + Ce3.Q - Cd.Q - Cs.Q + (1 - xmv)*Cm.Q + Qcond - Qevap; @@ -460,25 +460,25 @@ equation Cv.diff_on_1 = diffusion; /* Fluid thermodynamic properties */ - prol = Medium.setState_phX(p=P, h=hl, X=Medium.reference_X); - prov = Medium.setState_phX(p=P, h=hv, X=Medium.reference_X); - prod = Medium.setState_phX(p=Pfond, h=Cd.h, X=Medium.reference_X); - prom = Medium.setState_phX(p=P, h=Cm.h, X=Medium.reference_X); + state_l = Medium.setState_phX(p=P, h=hl, X=Medium.reference_X); + state_v = Medium.setState_phX(p=P, h=hv, X=Medium.reference_X); + state_out_l = Medium.setState_phX(p=Pfond, h=Cd.h, X=Medium.reference_X); + state_m = Medium.setState_phX(p=P, h=Cm.h, X=Medium.reference_X); sat = Medium.setSat_p(P); hlsat = Medium.bubbleEnthalpy(sat); hvsat = Medium.dewEnthalpy(sat); - ddphl = Medium.density_derp_h(prol); - ddhpl = Medium.density_derh_p(prol); - ddphv = Medium.density_derp_h(prov); - ddhpv = Medium.density_derh_p(prov); + ddphl = Medium.density_derp_h(state_l); + ddhpl = Medium.density_derh_p(state_l); + ddphv = Medium.density_derp_h(state_v); + ddhpv = Medium.density_derh_p(state_v); - Tl = Medium.temperature(prol); - rhol = Medium.density(prol); + Tl = Medium.temperature(state_l); + rhol = Medium.density(state_l); xl = noEvent(max(0, min(1, (hl - hlsat)/(hvsat - hlsat)))); - Tv = Medium.temperature(prov); - rhov = Medium.density(prov); + Tv = Medium.temperature(state_v); + rhov = Medium.density(state_v); xv = noEvent(max(0, min(1, (hv - hlsat)/(hvsat - hlsat)))); xmv = if noEvent(Cm.Q > 0) then noEvent(max(0, min(1, (Cm.h - hlsat)/(hvsat - hlsat)))) else 0; diff --git a/ThermoSysPro/Fluid/Volumes/TwoPhaseVolume.mo b/ThermoSysPro/Fluid/Volumes/TwoPhaseVolume.mo index 714c9950..683b6b8b 100644 --- a/ThermoSysPro/Fluid/Volumes/TwoPhaseVolume.mo +++ b/ThermoSysPro/Fluid/Volumes/TwoPhaseVolume.mo @@ -3,7 +3,9 @@ model TwoPhaseVolume "TwoPhaseVolume" extends ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.WaterSteamFluidTypeParameterInterface; extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialTwoPhaseThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable function SaS = Medium.noSaS(SubC = SubCv) annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable function PhasesSeparationFunction = Medium.HomogeneousPhasesSeparation(SubC = Cv.SubC) annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Units.SI.Volume V=1 "Cavity volume"; parameter Units.SI.Area A=1 "Cavity cross-sectional area"; @@ -29,12 +31,18 @@ model TwoPhaseVolume "TwoPhaseVolume" parameter Boolean continuous_flow_reversal=false "true: continuous flow reversal - false: discontinuous flow reversal"; parameter Boolean diffusion=false "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; + parameter Medium.ExtraProperty SubCl0[Medium.nC](quantity=Medium.extraPropertiesNames)=Medium.C_default + "Initial liquid phase trace substances" + annotation (Evaluate=true, Dialog(enable=dynamic_energy_balance and not steady_state)); + parameter Medium.ExtraProperty SubCv0[Medium.nC](quantity=Medium.extraPropertiesNames)=Medium.C_default + "Initial vapor phase trace substances" + annotation (Evaluate=true, Dialog(enable=dynamic_energy_balance and not steady_state)); protected constant Units.SI.Acceleration g=Modelica.Constants.g_n "Gravity constant"; - parameter Integer fluid=Integer(ftype) "Fluid number"; parameter Units.SI.MassFlowRate gamma0=1.e-4 "Pseudo-diffusion conductance use for continuous flow reversal (active if diffusion=false and continuous_flow_reversal = true)"; + Medium.C_BiPhase C_record; public Units.SI.AbsolutePressure P "Fluid average pressure"; @@ -63,7 +71,6 @@ public "Evaporation mass flow rate from the liquid phase"; Units.SI.Power Wvl "Thermal power exchanged from the gas phase to the liquid phase"; - FluidType fluids[4] "Fluids mixing in volume"; Units.SI.Power Je "Thermal power diffusion from inlet Ce"; Units.SI.Power Jv "Thermal power diffusion from inlet Cv"; Units.SI.Power Jl "Thermal power diffusion from outlet Cl"; @@ -76,21 +83,29 @@ public Real rv "Value of r(Q/gamma) for inlet Cv"; Real rl "Value of r(Q/gamma) for outlet Cl"; - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph prol - "Propri鴩s de l'eau dans le ballon" annotation (Placement(transformation( - extent={{-60,40},{-20,80}}, rotation=0))); - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph prov - "Propri鴩s de la vapeur dans le ballon" annotation (Placement( - transformation(extent={{0,40},{40,80}}, rotation=0))); - ThermoSysPro.Properties.WaterSteam.Common.PropThermoSat lsat - annotation (Placement(transformation(extent={{-60,-80},{-20,-40}}, rotation= - 0))); - ThermoSysPro.Properties.WaterSteam.Common.PropThermoSat vsat - annotation (Placement(transformation( - extent={{0,-80},{40,-40}}, rotation=0))); - Interfaces.Connectors.FluidInlet Cv "Steam input" annotation (Placement( + Medium.ExtraProperty BSubCl[Medium.nC](quantity=Medium.extraPropertiesNames) + "Right hand side of the trace balance equation of the liquid phase"; + Medium.ExtraProperty BSubCv[Medium.nC](quantity=Medium.extraPropertiesNames) + "Right hand side of the trace balance equation of the vapor phase"; + Medium.ExtraProperty SubCl[Medium.nC](quantity=Medium.extraPropertiesNames, start=Medium.C_default) + "Liquid phase trace substances"; + Medium.ExtraProperty SubCv[Medium.nC](quantity=Medium.extraPropertiesNames, start=Medium.C_default) + "Vapor phase trace substances"; + Medium.ExtraProperty SubCSaS[Medium.nC](quantity=Medium.extraPropertiesNames) + "Trace modification in the trace balance equation"; + Medium.ThermodynamicState state_l "Liquid state in the volume"; + Medium.ThermodynamicState state_v "Vapor state in the volume"; + Medium.ThermodynamicState state_out_l "Liquid outlet state"; + Medium.SaturationProperties sat "Saturation properties at volume pressure"; + Units.SI.SpecificEnthalpy hlsat "Bubble enthalpy at volume pressure"; + Units.SI.SpecificEnthalpy hvsat "Dew enthalpy at volume pressure"; + Real ddphl "Liquid density derivative wrt. pressure at constant enthalpy"; + Real ddhpl "Liquid density derivative wrt. enthalpy at constant pressure"; + Real ddphv "Vapor density derivative wrt. pressure at constant enthalpy"; + Real ddhpv "Vapor density derivative wrt. enthalpy at constant pressure"; + Interfaces.Connectors.FluidInlet Cv(redeclare package Medium = Medium) "Steam input" annotation (Placement( transformation(extent={{-10,90},{10,110}}, rotation=0))); - Interfaces.Connectors.FluidOutlet Cl "Water output" annotation (Placement( + Interfaces.Connectors.FluidOutlet Cl(redeclare package Medium = Medium) "Water output" annotation (Placement( transformation(extent={{-10,-110},{10,-90}}, rotation=0))); ThermoSysPro.Thermal.Connectors.ThermalPort Cth annotation (Placement(transformation( @@ -99,10 +114,7 @@ public "Water level" annotation (Placement(transformation( extent={{100,-10},{120,10}}, rotation=0))); public - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph prod - annotation (Placement(transformation(extent={{-60,-20},{-20,20}}, rotation= - 0))); - Interfaces.Connectors.FluidInlet Ce "Water input" annotation (Placement( + Interfaces.Connectors.FluidInlet Ce(redeclare package Medium = Medium) "Water input" annotation (Placement( transformation(extent={{-110,-10},{-90,10}}, rotation=0))); initial equation if dynamic_energy_balance then @@ -111,24 +123,19 @@ initial equation der(hl) = 0; der(hv) = 0; der(Vl) = 0; + der(SubCl) = fill(0, Medium.nC); + der(SubCv) = fill(0, Medium.nC); else P = P0; - hl = lsat.h; - hv = vsat.h; + hl = hlsat; + hv = hvsat; Vl = Vf0*V; + SubCl = SubCl0; + SubCv = SubCv0; end if; end if; equation - /* Check that incoming fluids are compatible with fluid in volume */ - fluids[1] = ftype; - fluids[2] = Ce.ftype; - fluids[3] = Cv.ftype; - fluids[4] = Cl.ftype; - - assert(ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.isCompatible(fluids), - "TwoPhaseVolume: fluids mixing in volume are not compatible with each other"); - /* Unconnected connectors */ if (cardinality(Ce) == 0) then Ce.Q = 0; @@ -136,11 +143,7 @@ equation Ce.h_vol_1 = 1.e5; Ce.diff_res_1 = 0; Ce.diff_on_1 = false; - Ce.ftype = ftype; - Ce.Xco2 = 0; - Ce.Xh2o = 0; - Ce.Xo2 = 0; - Ce.Xso2 = 0; + Ce.SubC = Medium.C_default; end if; if (cardinality(Cv) == 0) then @@ -149,11 +152,7 @@ equation Cv.h_vol_1 = 1.e5; Cv.diff_res_1 = 0; Cv.diff_on_1 = false; - Cv.ftype = ftype; - Cv.Xco2 = 0; - Cv.Xh2o = 0; - Cv.Xo2 = 0; - Cv.Xso2 = 0; + Cv.SubC = Medium.C_default; end if; if (cardinality(Cl) == 0) then @@ -168,13 +167,13 @@ equation V = Vl + Vv; /* Pressure at the bottom of the cavity */ - Pfond = P + prod.d*g*Vl/A; + Pfond = P + Medium.density(state_out_l)*g*Vl/A; /* Liquid phase mass balance equation */ BQl = -Cl.Q + Qcond - Qevap + Ce.Q; if dynamic_energy_balance then - rhol*der(Vl) + Vl*(prol.ddph*der(P) + prol.ddhp*der(hl)) = BQl; + rhol*der(Vl) + Vl*(ddphl*der(P) + ddhpl*der(hl)) = BQl; else 0 = BQl; end if; @@ -183,33 +182,33 @@ equation BQv = Cv.Q + Qevap - Qcond; if dynamic_energy_balance then - rhov*der(Vv) + Vv*(prov.ddph*der(P) + prov.ddhp*der(hv)) = BQv; + rhov*der(Vv) + Vv*(ddphv*der(P) + ddhpv*der(hv)) = BQv; else 0 = BQv; end if; /* Condensation and evaporation mass flow rates */ - Qcond = if (xv < Xvo) then Ccond*rhov*Vv*(Xvo - xv) else 0; - Qevap = if (xl > Xlo) then Cevap*rhol*Vl*(xl - Xlo) else 0; + Qcond = if noEvent(xv < Xvo) then Ccond*rhov*Vv*(Xvo - xv) else 0; + Qevap = if noEvent(xl > Xlo) then Cevap*rhol*Vl*(xl - Xlo) else 0; Ce.P = P; Cv.P = P; Cl.P = Pfond; /* Liquid phase energy balance equation */ - BHl = -Cl.Q*(Cl.h - (hl - P/rhol)) + Qcond*(lsat.h - (hl - P/rhol)) - Qevap*(vsat.h - (hl - P/rhol)) + Ce.Q*(Ce.h - (hl - P/rhol)) + Wvl + Jt_l; + BHl = -Cl.Q*(Cl.h - (hl - P/rhol)) + Qcond*(hlsat - (hl - P/rhol)) - Qevap*(hvsat - (hl - P/rhol)) + Ce.Q*(Ce.h - (hl - P/rhol)) + Wvl + Jt_l; if dynamic_energy_balance then - Vl*((P/rhol*prol.ddph - 1)*der(P) + (P/rhol*prol.ddhp + rhol)*der(hl)) = BHl; + Vl*((P/rhol*ddphl - 1)*der(P) + (P/rhol*ddhpl + rhol)*der(hl)) = BHl; else 0 = BHl; end if; /* Gas phase energy balance equation */ - BHv = Cv.Q*(Cv.h - (hv - P/rhov)) + Qevap*(vsat.h - (hv - P/rhov)) - Qcond*(lsat.h - (hv - P/rhov)) - Wvl + Cth.W + Jt_v; + BHv = Cv.Q*(Cv.h - (hv - P/rhov)) + Qevap*(hvsat - (hv - P/rhov)) - Qcond*(hlsat - (hv - P/rhov)) - Wvl + Cth.W + Jt_v; if dynamic_energy_balance then - Vv*((P/rhov*prov.ddph - 1)*der(P) + (P/rhov*prov.ddhp + rhov)*der(hv)) = BHv; + Vv*((P/rhov*ddphv - 1)*der(P) + (P/rhov*ddhpv + rhov)*der(hv)) = BHv; else 0 = BHv; end if; @@ -224,13 +223,22 @@ equation /* Water leval */ yLevel.signal = Vl/A; - /* Fluid composition (no balance equations) */ - Cl.ftype = ftype; + /* Traces composition balance equations */ + C_record = PhasesSeparationFunction(); + SubCSaS = SaS(); + + BSubCl = Ce.Q*Ce.SubC - Cl.Q*Cl.SubC + Qcond*C_record.Cl - Qevap*SubCl; + BSubCv = Cv.Q*Cv.SubC + Qevap*SubCl - Qcond*C_record.Cg; + + if dynamic_energy_balance then + rhol*Vl*der(SubCl) + SubCl*BQl = BSubCl; + rhov*Vv*der(SubCv) + SubCv*BQv + rhov*Vv*SubCSaS = BSubCv; + else + SubCl*BQl = BSubCl; + SubCv*BQv + rhov*Vv*SubCSaS = BSubCv; + end if; - Cl.Xco2 = 0; - Cl.Xh2o = 0; - Cl.Xo2 = 0; - Cl.Xso2 = 0; + Cl.SubC = SubCl; /* Flow reversal */ if continuous_flow_reversal then @@ -278,18 +286,25 @@ equation Cl.diff_on_1 = diffusion; /* Fluid thermodynamic properties */ - prol = ThermoSysPro.Properties.Fluid.Ph((P + Pfond)/2, hl, 0,fluid); - prov = ThermoSysPro.Properties.Fluid.Ph(P, hv, 0,fluid); - prod = ThermoSysPro.Properties.Fluid.Ph(Pfond, Cl.h, 0,fluid); - (lsat,vsat) = ThermoSysPro.Properties.Fluid.Water_sat_P(P,fluid); - - Tl = prol.T; - rhol = prol.d; - xl = prol.x; - - Tv = prov.T; - rhov = prov.d; - xv = prov.x; + state_l = Medium.setState_phX(p=(P + Pfond)/2, h=hl, X=Medium.reference_X); + state_v = Medium.setState_phX(p=P, h=hv, X=Medium.reference_X); + state_out_l = Medium.setState_phX(p=Pfond, h=Cl.h, X=Medium.reference_X); + sat = Medium.setSat_p(P); + hlsat = Medium.bubbleEnthalpy(sat); + hvsat = Medium.dewEnthalpy(sat); + + ddphl = Medium.density_derp_h(state_l); + ddhpl = Medium.density_derh_p(state_l); + ddphv = Medium.density_derp_h(state_v); + ddhpv = Medium.density_derh_p(state_v); + + Tl = Medium.temperature(state_l); + rhol = Medium.density(state_l); + xl = noEvent(max(0, min(1, (hl - hlsat)/(hvsat - hlsat)))); + + Tv = Medium.temperature(state_v); + rhov = Medium.density(state_v); + xv = noEvent(max(0, min(1, (hv - hlsat)/(hvsat - hlsat)))); Cth.T = Tv; From 8eaea3803770b074996652dbbf5d94489a19c268 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Tue, 12 May 2026 09:22:08 +0200 Subject: [PATCH 130/178] #125 DynamicOnePhaseFlowShell --- .../TestDynamicOnePhaseFlowShell.mo | 28 ++++++++ .../TestDynamicOnePhaseFlowShell_FlueGases.mo | 42 ++++++++++++ .../TestDynamicOnePhaseFlowShell_Traces.mo | 31 +++++++++ .../HeatExchangers/package.order | 3 + .../DynamicOnePhaseFlowShell.mo | 66 ++++++++----------- 5 files changed, 132 insertions(+), 38 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicOnePhaseFlowShell.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicOnePhaseFlowShell_FlueGases.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicOnePhaseFlowShell_Traces.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicOnePhaseFlowShell.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicOnePhaseFlowShell.mo new file mode 100644 index 00000000..0c70d9a9 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicOnePhaseFlowShell.mo @@ -0,0 +1,28 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; +model TestDynamicOnePhaseFlowShell + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam; + + ThermoSysPro.Fluid.HeatExchangers.DynamicOnePhaseFlowShell dynamicOnePhaseFlowShell( + redeclare package Medium = Medium, + Q(start={536.5750641592207,536.5750641592207,536.5750641592207,536.5750641592207,536.5750641592207,536.5750641592207,536.5750641592207,536.5750641592207,536.5750641592207,536.5750641592207,536.5750641592207}), + h(start={71016.12237181116,74743.46665892199,78470.81094603281,82198.15523314364,85925.49952025448,89652.84380736532,93380.18809447614,97107.53238158698,100834.8766686978,104562.22095580865,108289.56524291947,70825.9016030344}), + P(start={300000,281833.41863537,263664.30473175,245492.47958308,227317.76827098,209139.99948382,190959.00534677,172774.621262,154586.68575823,136395.04034906,118199.5293995,100000})) annotation (Placement(transformation(extent={{-10,-10},{10,10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}, rotation=0))); + ThermoSysPro.Thermal.BoundaryConditions.HeatSource heatSource( + T0={1000,1100,1200,1300,1400,1500,1600,1700,1800,1900}, + option_temperature=2, + W0={2e6,2e6,2e6,2e6,2e6,2e6,2e6,2e6,2e6,2e6}) annotation (Placement(transformation(extent={{-10,30},{10,50}}, rotation=0))); + ThermoSysPro.Thermal.HeatTransfer.HeatExchangerWall heatExchangerWall(Ns=10) annotation (Placement(transformation(extent={{-10,10},{10,30}}, rotation=0))); +equation + connect(sourceP.C, dynamicOnePhaseFlowShell.C1) annotation (Line(points={{-30,0},{-10,0}}, color={0,0,255})); + connect(dynamicOnePhaseFlowShell.C2, sinkP.C) annotation (Line(points={{10,0},{30,0}}, color={0,0,255})); + connect(heatSource.C, heatExchangerWall.WT2) annotation (Line(points={{0,30.2},{0,22}}, color={191,95,0})); + connect(heatExchangerWall.WT1, dynamicOnePhaseFlowShell.CTh) annotation (Line(points={{0,18},{0,3}}, color={191,95,0})); + annotation ( + experiment(StopTime=1000), + Icon(coordinateSystem(preserveAspectRatio=false)), + Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestDynamicOnePhaseFlowShell; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicOnePhaseFlowShell_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicOnePhaseFlowShell_FlueGases.mo new file mode 100644 index 00000000..7bcd5cfc --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicOnePhaseFlowShell_FlueGases.mo @@ -0,0 +1,42 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; +model TestDynamicOnePhaseFlowShell_FlueGases + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.FlueGases( + extraPropertiesNames={"Trace1","Trace2","Trace3"}, + C_nominal={0.1,0.2,0.3}, + C_default={0.2,0.3,0.4}); + + ThermoSysPro.Fluid.HeatExchangers.DynamicOnePhaseFlowShell dynamicOnePhaseFlowShell( + redeclare package Medium = Medium, + Ns=1, + Q(start=fill(36, dynamicOnePhaseFlowShell.Ns + 1)), + h(start={3077096.0822837264,3135044.986588299,3077096.0822837264}), + P(start=linspace( + 45, + 44.5, + dynamicOnePhaseFlowShell.Ns + 2))) annotation (Placement(transformation(extent={{-10,-10},{10,10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP( + redeclare package Medium = Medium, + P0=4500000, + T0=573.15, + X0={0,0,1,0,0}) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP( + redeclare package Medium = Medium, + P0=4450000, + T0=573.15) annotation (Placement(transformation(extent={{30,-10},{50,10}}, rotation=0))); + ThermoSysPro.Thermal.BoundaryConditions.HeatSource heatSource( + T0=fill(726.855, dynamicOnePhaseFlowShell.Ns), + option_temperature=2, + W0=fill(2e6/dynamicOnePhaseFlowShell.Ns, dynamicOnePhaseFlowShell.Ns)) annotation (Placement(transformation(extent={{-10,30},{10,50}}, rotation=0))); + ThermoSysPro.Thermal.HeatTransfer.HeatExchangerWall heatExchangerWall(Ns=dynamicOnePhaseFlowShell.Ns) annotation (Placement(transformation(extent={{-10,10},{10,30}}, rotation=0))); +equation + connect(sourceP.C, dynamicOnePhaseFlowShell.C1) annotation (Line(points={{-30,0},{-10,0}}, color={0,0,255})); + connect(dynamicOnePhaseFlowShell.C2, sinkP.C) annotation (Line(points={{10,0},{30,0}}, color={0,0,255})); + connect(heatSource.C, heatExchangerWall.WT2) annotation (Line(points={{0,30.2},{0,22}}, color={191,95,0})); + connect(heatExchangerWall.WT1, dynamicOnePhaseFlowShell.CTh) annotation (Line(points={{0,18},{0,3}}, color={191,95,0})); + annotation ( + experiment(StopTime=1000), + Icon(coordinateSystem(preserveAspectRatio=false)), + Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestDynamicOnePhaseFlowShell_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicOnePhaseFlowShell_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicOnePhaseFlowShell_Traces.mo new file mode 100644 index 00000000..52a41273 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicOnePhaseFlowShell_Traces.mo @@ -0,0 +1,31 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; +model TestDynamicOnePhaseFlowShell_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam( + extraPropertiesNames={"Trace1","Trace2","Trace3"}, + C_nominal={0.1,0.2,0.3}, + C_default={0.2,0.3,0.4}); + + ThermoSysPro.Fluid.HeatExchangers.DynamicOnePhaseFlowShell dynamicOnePhaseFlowShell( + redeclare package Medium = Medium, + Q(start={536.5750641592207,536.5750641592207,536.5750641592207,536.5750641592207,536.5750641592207,536.5750641592207,536.5750641592207,536.5750641592207,536.5750641592207,536.5750641592207,536.5750641592207}), + h(start={71016.12237181116,74743.46665892199,78470.81094603281,82198.15523314364,85925.49952025448,89652.84380736532,93380.18809447614,97107.53238158698,100834.8766686978,104562.22095580865,108289.56524291947,70825.9016030344}), + P(start={300000,281833.41863537,263664.30473175,245492.47958308,227317.76827098,209139.99948382,190959.00534677,172774.621262,154586.68575823,136395.04034906,118199.5293995,100000})) annotation (Placement(transformation(extent={{-10,-10},{10,10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP(redeclare package Medium = Medium, SubC0={0.1,0.2,0.3}) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{30,-10},{50,10}}, rotation=0))); + ThermoSysPro.Thermal.BoundaryConditions.HeatSource heatSource( + T0={1000,1100,1200,1300,1400,1500,1600,1700,1800,1900}, + option_temperature=2, + W0={2e6,2e6,2e6,2e6,2e6,2e6,2e6,2e6,2e6,2e6}) annotation (Placement(transformation(extent={{-10,30},{10,50}}, rotation=0))); + ThermoSysPro.Thermal.HeatTransfer.HeatExchangerWall heatExchangerWall(Ns=10) annotation (Placement(transformation(extent={{-10,10},{10,30}}, rotation=0))); +equation + connect(sourceP.C, dynamicOnePhaseFlowShell.C1) annotation (Line(points={{-30,0},{-10,0}}, color={0,0,255})); + connect(dynamicOnePhaseFlowShell.C2, sinkP.C) annotation (Line(points={{10,0},{30,0}}, color={0,0,255})); + connect(heatSource.C, heatExchangerWall.WT2) annotation (Line(points={{0,30.2},{0,22}}, color={191,95,0})); + connect(heatExchangerWall.WT1, dynamicOnePhaseFlowShell.CTh) annotation (Line(points={{0,18},{0,3}}, color={191,95,0})); + annotation ( + experiment(StopTime=1000), + Icon(coordinateSystem(preserveAspectRatio=false)), + Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestDynamicOnePhaseFlowShell_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order index c35c0985..5fedf48f 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order @@ -1,6 +1,9 @@ TestDynamicOnePhaseFlowPipe TestDynamicOnePhaseFlowPipe_Traces TestDynamicOnePhaseFlowPipe_FlueGases +TestDynamicOnePhaseFlowShell +TestDynamicOnePhaseFlowShell_Traces +TestDynamicOnePhaseFlowShell_FlueGases TestFixedPowerHeatExchanger TestFixedPowerHeatExchanger_Traces TestStaticExchangerKS diff --git a/ThermoSysPro/Fluid/HeatExchangers/DynamicOnePhaseFlowShell.mo b/ThermoSysPro/Fluid/HeatExchangers/DynamicOnePhaseFlowShell.mo index a5aff1ce..9586a99a 100644 --- a/ThermoSysPro/Fluid/HeatExchangers/DynamicOnePhaseFlowShell.mo +++ b/ThermoSysPro/Fluid/HeatExchangers/DynamicOnePhaseFlowShell.mo @@ -1,8 +1,8 @@ within ThermoSysPro.Fluid.HeatExchangers; model DynamicOnePhaseFlowShell "Dynamic one-phase flow shell" extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Integer option_arrangement = 1 "1:triangle - 2: square"; parameter Units.SI.Length L=12 "Shell length"; @@ -31,12 +31,10 @@ model DynamicOnePhaseFlowShell "Dynamic one-phase flow shell" parameter Boolean option_temperature=true "true: initial temperature is fixed - false: initial specific enthalpy is fixed (active if steady_state=false)" annotation(Evaluate=true, Dialog(enable=not steady_state)); parameter Boolean continuous_flow_reversal=false "true: continuous flow reversal - false: discontinuous flow reversal"; parameter Boolean diffusion=false "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; - parameter IF97Region region=IF97Region.All_regions "IF97 region (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); protected constant Units.SI.Acceleration g=Modelica.Constants.g_n "Gravity constant"; constant Real pi=Modelica.Constants.pi "pi"; - parameter Integer mode=Integer(region) - 1 "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; parameter Integer Nb = integer(floor(L/B)); parameter Units.SI.Distance dt=dc - De "Distance between two tubes"; parameter Integer N=Ns + 1 "Number of hydraulic nodes (= number of thermal nodes + 1)"; @@ -116,12 +114,9 @@ public "Friction pressure loss coefficient in node i"; Units.SI.DerDensityByPressure ddph[N - 1] "Density derivative wrt. pressure"; Units.SI.DerDensityByEnthalpy ddhp[N - 1] "Density derivative wrt. enthalpy"; - FluidType ftype "Fluid type"; - Integer fluid=Integer(ftype) "Fluid number"; - ThermoSysPro.Units.SI.MassFraction Xco2 "CO2 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xh2o "H2O mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xo2 "O2 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xso2 "SO2 mass fraction"; + Medium.ThermodynamicState state1[N - 1]; + Medium.ThermodynamicState state2[N]; + Medium.MassFraction X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Mass fractions"; Real diff_res[N] "Diffusion resistance in hydraulic node i"; Real diff_res_t "Total diffusion resistance in the pipe"; Real diff_res_e[N - 1] "Diffusion resistance at inlet of thermal node i"; @@ -141,9 +136,9 @@ public Real rs[N - 1] "Value of r(Q/gamma) for outlet of thermal node i"; public - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-110,-10},{-90,10}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{90,-10},{110,10}}, rotation=0))); ThermoSysPro.Thermal.Connectors.ThermalPort CTh[Ns] annotation (Placement(transformation(extent={{-10,20},{10,40}}, rotation=0))); @@ -156,7 +151,7 @@ initial equation else if option_temperature then for i in 2:N loop - h[i] = ThermoSysPro.Properties.Fluid.SpecificEnthalpy_PT(P[i], T0[i - 1], fluid, mode, Xco2, Xh2o, Xo2, Xso2); + h[i] = Medium.specificEnthalpy_pTX(P[i], T0[i - 1], X); end for; else for i in 2:N loop @@ -209,19 +204,11 @@ equation C2.diff_res_1 = C1.diff_res_1 + diff_res_t; C1.diff_res_2 = C2.diff_res_2 + diff_res_t; - C1.ftype = C2.ftype; - - C1.Xco2 = C2.Xco2; - C1.Xh2o = C2.Xh2o; - C1.Xo2 = C2.Xo2; - C1.Xso2 = C2.Xso2; + C1.SubC = C2.SubC; - ftype = C1.ftype; + C1.Xi = C2.Xi; - Xco2 = C1.Xco2; - Xh2o = C1.Xh2o; - Xo2 = C1.Xo2; - Xso2 = C1.Xso2; + X = C1.Xi; /* Mass and energy balance equations (thermal nodes) */ for i in 1:N - 1 loop @@ -310,15 +297,16 @@ equation end if; /* Fluid thermodynamic properties */ - ddph[i] = ThermoSysPro.Properties.Fluid.Density_derp_Ph(P[i + 1], h[i + 1], fluid, mode, Xco2, Xh2o, Xo2, Xso2); - ddhp[i] = ThermoSysPro.Properties.Fluid.Density_derh_Ph(P[i + 1], h[i + 1], fluid, mode, Xco2, Xh2o, Xo2, Xso2); + state1[i] = Medium.setState_phX(p=P[i + 1], h=h[i + 1], X=X); + ddph[i] = Medium.density_derp_h(state1[i]); + ddhp[i] = Medium.density_derh_p(state1[i]); - rho1[i] = ThermoSysPro.Properties.Fluid.Density_Ph(P[i + 1], h[i + 1], fluid, mode, Xco2, Xh2o, Xo2, Xso2); - T1[i] = ThermoSysPro.Properties.Fluid.Temperature_Ph(P[i + 1], h[i + 1], fluid, mode, Xco2, Xh2o, Xo2, Xso2); - cp1[i] = ThermoSysPro.Properties.Fluid.SpecificHeatCapacityCp_Ph(P[i + 1], h[i + 1], fluid, mode, Xco2, Xh2o, Xo2, Xso2); + rho1[i] = Medium.density(state1[i]); + T1[i] = Medium.temperature(state1[i]); + cp1[i] = Medium.specificHeatCapacityCp(state1[i]); - mu1[i] = ThermoSysPro.Properties.Fluid.DynamicViscosity_Ph(P[i + 1], h[i + 1], fluid, mode, Xco2, Xh2o, Xo2, Xso2); - k1[i] = ThermoSysPro.Properties.Fluid.ThermalConductivity_Ph(P[i + 1], h[i + 1], fluid, mode, Xco2, Xh2o, Xo2, Xso2); + mu1[i] = Medium.dynamicViscosity(state1[i]); + k1[i] = Medium.thermalConductivity(state1[i]); end for; /* Momentum balance equations (hydraulic nodes) */ @@ -350,11 +338,13 @@ equation gamma[i] = if diffusion then 1/diff_res[i] else gamma0; /* Fluid thermodynamic properties */ - rho2[i] = ThermoSysPro.Properties.Fluid.Density_Ph((P[i] + P[i + 1])/2, hb[i], fluid, mode, Xco2, Xh2o, Xo2, Xso2); - T2[i] = ThermoSysPro.Properties.Fluid.Temperature_Ph((P[i] + P[i + 1])/2,hb[i], fluid, mode, Xco2, Xh2o, Xo2, Xso2); - cp2[i] = ThermoSysPro.Properties.Fluid.SpecificHeatCapacityCp_Ph((P[i] + P[i + 1])/2, hb[i], fluid, mode, Xco2, Xh2o, Xo2, Xso2); - mu2[i] = ThermoSysPro.Properties.Fluid.DynamicViscosity_Ph((P[i] + P[i + 1])/2, hb[i], fluid, mode, Xco2, Xh2o, Xo2, Xso2); - k2[i] = ThermoSysPro.Properties.Fluid.ThermalConductivity_Ph((P[i] + P[i + 1])/2, hb[i], fluid, mode, Xco2, Xh2o, Xo2, Xso2); + state2[i] = Medium.setState_phX(p=(P[i] + P[i + 1])/2, h=hb[i], X=X); + + rho2[i] = Medium.density(state2[i]); + T2[i] = Medium.temperature(state2[i]); + cp2[i] = Medium.specificHeatCapacityCp(state2[i]); + mu2[i] = Medium.dynamicViscosity(state2[i]); + k2[i] = Medium.thermalConductivity(state2[i]); end for; /* Fluid densities at the boundaries of the nodes */ @@ -362,8 +352,8 @@ equation rhoc[i] = rho1[i - 1]; end for; - rhoc[1] = ThermoSysPro.Properties.Fluid.Density_Ph(P[1], h[1], fluid, mode, Xco2, Xh2o, Xo2, Xso2); - rhoc[N + 1] = ThermoSysPro.Properties.Fluid.Density_Ph((P[N + 1]), h[N + 1], fluid, mode, Xco2, Xh2o, Xo2, Xso2); + rhoc[1] = Medium.density(Medium.setState_phX(p=P[1], h=h[1], X=X)); + rhoc[N + 1] = Medium.density(Medium.setState_phX(p=P[N + 1], h=h[N + 1], X=X)); W1t = sum(dW1); From cf9355b957c272e268e36ccbc332789be25ec4f1 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Tue, 12 May 2026 09:56:34 +0200 Subject: [PATCH 131/178] #125 Pressurizer --- .../SimpleExamples/Volumes/TestPressurizer.mo | 123 +++++++++++++++++ .../Volumes/TestPressurizer_Traces.mo | 126 ++++++++++++++++++ .../SimpleExamples/Volumes/package.order | 2 + ThermoSysPro/Fluid/Volumes/Pressurizer.mo | 125 +++++++++-------- 4 files changed, 319 insertions(+), 57 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestPressurizer.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestPressurizer_Traces.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestPressurizer.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestPressurizer.mo new file mode 100644 index 00000000..ca7ac920 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestPressurizer.mo @@ -0,0 +1,123 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Volumes; +model TestPressurizer + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; + + parameter Units.SI.Power Wch(fixed=true) = 0.29e6 "Power released by the electrical heaters"; + parameter Real OUVfeedwaterValve(fixed=true) = 0.01 "Position of the feedwater valve"; + + ThermoSysPro.Fluid.Volumes.Pressurizer pressurizer( + redeclare package Medium = Medium, + Zm=10.15, + Klv=0.5e6, + cpp=600, + hl(start=1629887.98290107), + hv(start=2596216.59571565), + Zl(start=5.5900717167325), + Yw0=32.92, + steady_state=false, + V=61.12, + Rp=1.27, + Ae=96.23, + Klp=1780, + Kvp=7500, + Mp=107e3, + Kpa=5.63, + Ccond=0.02, + Cevap=0.05, + Yw(start=32.92), + y(start=0.3292), + P0=15500000, + P(start=15500000), + Tp(start=617.94155291055)) + annotation (Placement(transformation(extent={{-20,-20},{40,40}}, rotation=0))); + + ThermoSysPro.Fluid.PressureLosses.ControlValve FeedwaterValve_Spray( + Cv(start=100), + C1( + P(start=160e5), + h_vol_2(start=1270e3), + Q(start=0.3), + h(start=1270e3)), + Q(fixed=false, start=0.32), + Cvmax=5000, + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-80,36},{-60,56}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP( + option_temperature=false, + h0=1270e3, + P0=16000000, + redeclare package Medium = Medium) + annotation (Placement(transformation(extent={{-138,30},{-118,50}}, rotation=0))); + InstrumentationAndControl.Blocks.Tables.Table1DTemps FeedwaterValveSpray(Table=[0,OUVfeedwaterValve; 200,OUVfeedwaterValve; 250,OUVfeedwaterValve + 0.005; 300,OUVfeedwaterValve + 0.005; 400,0; 1000,0]) annotation (Placement(transformation(extent={{-104,60},{-78,86}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.ControlValve SteamValve( + Cv(start=25000), + Cvmax(fixed=true) = 5000, + Pm(start=15500000), + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{88,36},{108,56}}, rotation=0))); + InstrumentationAndControl.Blocks.Sources.Constante SteamrValve_O(k(fixed=true) = 0.5) annotation (Placement(transformation(extent={{30,62},{50,82}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkQ( + Q0=0, + h0=3e6, + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{136,30},{156,50}}, rotation=0))); + Thermal.BoundaryConditions.HeatSource SourceC1( + option_temperature=2, + T0={310}, + W0={1e5}) annotation (Placement(transformation( + origin={-67,-12}, + extent={{-17,17},{17,-17}}, + rotation=270))); + Thermal.BoundaryConditions.HeatSource SourceC2( + T0={310}, + W0={0.286e6}, + option_temperature=1) annotation (Placement(transformation( + origin={-67,11}, + extent={{-17,17},{17,-17}}, + rotation=270))); + InstrumentationAndControl.Blocks.Tables.Table1DTemps ElectricalHeaters(Table=[0,Wch; 100,Wch; 110,Wch; 120,Wch; 300,Wch; 1200,Wch; 1400,Wch*7.75; 1600,Wch*7.75; 1900,Wch; 3000,Wch]) annotation (Placement(transformation(extent={{-109,-25},{-83,1}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.PipePressureLoss lumpedStraightPipe( + z1=1, + z2=0, + C1(P(start=160e5), redeclare package Medium = Medium), + C2(P(start=160e5), redeclare package Medium = Medium), + Q(fixed=false, start=0)) annotation (Placement(transformation( + origin={10,-44}, + extent={{10,-10},{-10,10}}, + rotation=90))); + ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkQ1( + Q0=0, + h0=1600000, + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{12,-78},{32,-58}}, rotation=0))); + ThermoSysPro.Examples.Control.Drum_LevelControl regulation_Niveau( + Ti=50, + add(k1=+1, k2=-1), + minval=-100, + pIsat( + Limiteur1(u(signal(start=0.001))), + ureset0=0.0, + maxval=100, + Ti=2000)) annotation (Placement(transformation(extent={{94,-54},{66,-28}}, rotation=0))); + InstrumentationAndControl.Blocks.Sources.Constante Level_y100(k=32.92) annotation (Placement(transformation(extent={{129,-58},{110,-39}}, rotation=0))); +equation + connect(FeedwaterValveSpray.y, FeedwaterValve_Spray.Ouv) annotation (Line(points={{-76.7,73},{-70,73},{-70,57}}, color={0,0,255})); + connect(SteamrValve_O.y, SteamValve.Ouv) annotation (Line(points={{51,72},{98,72},{98,57}})); + connect(pressurizer.Cs, SteamValve.C1) annotation (Line(points={{40,39.4},{64,39.4},{64,40},{88,40}}, color={0,0,0})); + connect(sinkQ.C, SteamValve.C2) annotation (Line(points={{136,40},{108,40}}, color={0,0,0})); + connect(sourceP.C, FeedwaterValve_Spray.C1) annotation (Line(points={{-118,40},{-80,40}}, color={0,0,0})); + connect(FeedwaterValve_Spray.C2, pressurizer.Cas) annotation (Line(points={{-60,40},{-24,40},{-24,48},{10,48},{10,40}}, color={0,0,0})); + connect(SourceC2.C[1], pressurizer.Ca) annotation (Line(points={{-50.34,11},{-33.67,11},{-33.67,10.6},{-17,10.6}}, color={191,95,0})); + connect(SourceC1.C[1], pressurizer.Cc) annotation (Line(points={{-50.34,-12},{10,-12},{10,0.4}}, color={191,95,0})); + connect(ElectricalHeaters.y, SourceC1.ISignal) annotation (Line(points={{-81.7,-12},{-75.5,-12}}, color={0,0,255})); + connect(Level_y100.y, regulation_Niveau.ConsigneNiveauEau) annotation (Line( + points={{109.05,-48.5},{106,-48.5},{106,-48.8},{94.7,-48.8}}, + color={0,0,0}, + pattern=LinePattern.Dash)); + connect(regulation_Niveau.SortieReelle1, sinkQ1.IMassFlow) annotation (Line(points={{65.3,-52.7},{22,-52.7},{22,-63}}, color={0,0,255})); + connect(pressurizer.yLevel, regulation_Niveau.MesureNiveauEau) annotation (Line(points={{37,10},{100,10},{100,-29.3},{94.7,-29.3}}, color={0,0,255})); + connect(pressurizer.Cex, lumpedStraightPipe.C1) annotation (Line(points={{10,-20},{10,-34}}, color={0,0,0})); + connect(lumpedStraightPipe.C2, sinkQ1.C) annotation (Line(points={{10,-54},{10,-68},{12,-68}}, color={0,0,0})); + annotation ( + experiment(StopTime=1000), + Icon(coordinateSystem(preserveAspectRatio=false)), + Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-120,-100},{120,80}}))); +end TestPressurizer; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestPressurizer_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestPressurizer_Traces.mo new file mode 100644 index 00000000..7c770e2a --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestPressurizer_Traces.mo @@ -0,0 +1,126 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Volumes; +model TestPressurizer_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Fluid.Examples.SimpleExamples.Media.WaterSteam_FullyVolatileTrace; + + parameter Units.SI.Power Wch(fixed=true) = 0.29e6 "Power released by the electrical heaters"; + parameter Real OUVfeedwaterValve(fixed=true) = 0.01 "Position of the feedwater valve"; + + ThermoSysPro.Fluid.Volumes.Pressurizer pressurizer( + redeclare package Medium = Medium, + redeclare function PhasesSeparationFunction = Medium.PhasesSeparation (x=1), + Zm=10.15, + Klv=0.5e6, + cpp=600, + hl(start=1629887.98290107), + hv(start=2596216.59571565), + Zl(start=5.5900717167325), + Yw0=32.92, + steady_state=false, + V=61.12, + Rp=1.27, + Ae=96.23, + Klp=1780, + Kvp=7500, + Mp=107e3, + Kpa=5.63, + Ccond=0.02, + Cevap=0.05, + Yw(start=32.92), + y(start=0.3292), + P0=15500000, + P(start=15500000), + Tp(start=617.94155291055), + SubCl0={0}, + SubCv0={10}) + annotation (Placement(transformation(extent={{-20,-20},{40,40}}, rotation=0))); + + ThermoSysPro.Fluid.PressureLosses.ControlValve FeedwaterValve_Spray( + Cv(start=100), + C1( + P(start=160e5), + h_vol_2(start=1270e3), + Q(start=0.3), + h(start=1270e3)), + Q(fixed=false, start=0.32), + Cvmax=5000, + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-80,36},{-60,56}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP( + option_temperature=false, + h0=1270e3, + P0=16000000, + redeclare package Medium = Medium, + SubC0={10}) annotation (Placement(transformation(extent={{-138,30},{-118,50}}, rotation=0))); + InstrumentationAndControl.Blocks.Tables.Table1DTemps FeedwaterValveSpray(Table=[0,OUVfeedwaterValve; 200,OUVfeedwaterValve; 250,OUVfeedwaterValve + 0.005; 300,OUVfeedwaterValve + 0.005; 400,0; 1000,0]) annotation (Placement(transformation(extent={{-104,60},{-78,86}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.ControlValve SteamValve( + Cv(start=25000), + Cvmax(fixed=true) = 5000, + Pm(start=15500000), + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{88,36},{108,56}}, rotation=0))); + InstrumentationAndControl.Blocks.Sources.Constante SteamrValve_O(k(fixed=true) = 0.5) annotation (Placement(transformation(extent={{30,62},{50,82}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkQ( + Q0=0, + h0=3e6, + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{136,30},{156,50}}, rotation=0))); + Thermal.BoundaryConditions.HeatSource SourceC1( + option_temperature=2, + T0={310}, + W0={1e5}) annotation (Placement(transformation( + origin={-67,-12}, + extent={{-17,17},{17,-17}}, + rotation=270))); + Thermal.BoundaryConditions.HeatSource SourceC2( + T0={310}, + W0={0.286e6}, + option_temperature=1) annotation (Placement(transformation( + origin={-67,11}, + extent={{-17,17},{17,-17}}, + rotation=270))); + InstrumentationAndControl.Blocks.Tables.Table1DTemps ElectricalHeaters(Table=[0,Wch; 100,Wch; 110,Wch; 120,Wch; 300,Wch; 1200,Wch; 1400,Wch*7.75; 1600,Wch*7.75; 1900,Wch; 3000,Wch]) annotation (Placement(transformation(extent={{-109,-25},{-83,1}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.PipePressureLoss lumpedStraightPipe( + z1=1, + z2=0, + C1(P(start=160e5), redeclare package Medium = Medium), + C2(P(start=160e5), redeclare package Medium = Medium), + Q(fixed=false, start=0)) annotation (Placement(transformation( + origin={10,-44}, + extent={{10,-10},{-10,10}}, + rotation=90))); + ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkQ1( + Q0=0, + h0=1600000, + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{12,-78},{32,-58}}, rotation=0))); + ThermoSysPro.Examples.Control.Drum_LevelControl regulation_Niveau( + Ti=50, + add(k1=+1, k2=-1), + minval=-100, + pIsat( + Limiteur1(u(signal(start=0.001))), + ureset0=0.0, + maxval=100, + Ti=2000)) annotation (Placement(transformation(extent={{94,-54},{66,-28}}, rotation=0))); + InstrumentationAndControl.Blocks.Sources.Constante Level_y100(k=32.92) annotation (Placement(transformation(extent={{129,-58},{110,-39}}, rotation=0))); +equation + connect(FeedwaterValveSpray.y, FeedwaterValve_Spray.Ouv) annotation (Line(points={{-76.7,73},{-70,73},{-70,57}}, color={0,0,255})); + connect(SteamrValve_O.y, SteamValve.Ouv) annotation (Line(points={{51,72},{98,72},{98,57}})); + connect(pressurizer.Cs, SteamValve.C1) annotation (Line(points={{40,39.4},{64,39.4},{64,40},{88,40}}, color={0,0,0})); + connect(sinkQ.C, SteamValve.C2) annotation (Line(points={{136,40},{108,40}}, color={0,0,0})); + connect(sourceP.C, FeedwaterValve_Spray.C1) annotation (Line(points={{-118,40},{-80,40}}, color={0,0,0})); + connect(FeedwaterValve_Spray.C2, pressurizer.Cas) annotation (Line(points={{-60,40},{-24,40},{-24,48},{10,48},{10,40}}, color={0,0,0})); + connect(SourceC2.C[1], pressurizer.Ca) annotation (Line(points={{-50.34,11},{-33.67,11},{-33.67,10.6},{-17,10.6}}, color={191,95,0})); + connect(SourceC1.C[1], pressurizer.Cc) annotation (Line(points={{-50.34,-12},{10,-12},{10,0.4}}, color={191,95,0})); + connect(ElectricalHeaters.y, SourceC1.ISignal) annotation (Line(points={{-81.7,-12},{-75.5,-12}}, color={0,0,255})); + connect(Level_y100.y, regulation_Niveau.ConsigneNiveauEau) annotation (Line( + points={{109.05,-48.5},{106,-48.5},{106,-48.8},{94.7,-48.8}}, + color={0,0,0}, + pattern=LinePattern.Dash)); + connect(regulation_Niveau.SortieReelle1, sinkQ1.IMassFlow) annotation (Line(points={{65.3,-52.7},{22,-52.7},{22,-63}}, color={0,0,255})); + connect(pressurizer.yLevel, regulation_Niveau.MesureNiveauEau) annotation (Line(points={{37,10},{100,10},{100,-29.3},{94.7,-29.3}}, color={0,0,255})); + connect(pressurizer.Cex, lumpedStraightPipe.C1) annotation (Line(points={{10,-20},{10,-34}}, color={0,0,0})); + connect(lumpedStraightPipe.C2, sinkQ1.C) annotation (Line(points={{10,-54},{10,-68},{12,-68}}, color={0,0,0})); + annotation ( + experiment(StopTime=1000), + Icon(coordinateSystem(preserveAspectRatio=false)), + Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-120,-100},{120,80}}))); +end TestPressurizer_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order index 3fee47d4..4e146b27 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order @@ -34,3 +34,5 @@ TestDynamicDrum TestDynamicDrum_Traces TestTwoPhaseVolume TestTwoPhaseVolume_Traces +TestPressurizer +TestPressurizer_Traces diff --git a/ThermoSysPro/Fluid/Volumes/Pressurizer.mo b/ThermoSysPro/Fluid/Volumes/Pressurizer.mo index 31ce1a40..2f34884f 100644 --- a/ThermoSysPro/Fluid/Volumes/Pressurizer.mo +++ b/ThermoSysPro/Fluid/Volumes/Pressurizer.mo @@ -1,9 +1,9 @@ within ThermoSysPro.Fluid.Volumes; model Pressurizer "Pressurizer" - extends - ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.WaterSteamFluidTypeParameterInterface; extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialTwoPhaseThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable function SaS = Medium.noSaS(SubC = SubCv) annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable function PhasesSeparationFunction = Medium.HomogeneousPhasesSeparation(SubC = Cs.SubC) annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Units.SI.Volume V=61.1 "Pressurizer volume"; parameter Units.SI.Radius Rp=1.265 "Pressurizer cross-sectional radius"; @@ -33,14 +33,20 @@ model Pressurizer "Pressurizer" parameter Boolean continuous_flow_reversal=false "true: continuous flow reversal - false: discontinuous flow reversal"; parameter Boolean diffusion=false "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; + parameter Medium.ExtraProperty SubCl0[Medium.nC](quantity=Medium.extraPropertiesNames)=Medium.C_default + "Initial liquid phase trace substances" + annotation (Evaluate=true, Dialog(enable=dynamic_energy_balance and not steady_state)); + parameter Medium.ExtraProperty SubCv0[Medium.nC](quantity=Medium.extraPropertiesNames)=Medium.C_default + "Initial vapor phase trace substances" + annotation (Evaluate=true, Dialog(enable=dynamic_energy_balance and not steady_state)); protected constant Real pi=Modelica.Constants.pi "Pi"; constant Units.SI.Acceleration g=Modelica.Constants.g_n "Gravity constant"; - parameter Integer fluid=Integer(ftype) "Fluid number"; parameter Units.SI.MassFlowRate gamma0=1.e-4 "Pseudo-diffusion conductance use for continuous flow reversal (active if diffusion=false and continuous_flow_reversal = true)"; parameter Units.SI.Area Ap=pi*Rp*Rp "Pressurizer cross-sectional area"; + Medium.C_BiPhase C_record; public Units.SI.Area Slpin "Exchange surface between the liquid and the wall"; @@ -81,7 +87,6 @@ public "Evaporation mass flow rate from the liquid phase"; Units.SI.Density rhol(start=996) "Liquid phase density"; Units.SI.Density rhov(start=1.5) "Vapor phase density"; - FluidType fluids[4] "Fluids mixing in volume"; Units.SI.Power Jas "Thermal power diffusion from inlet Cas"; Units.SI.Power Jex "Thermal power diffusion from outlet Cex"; Units.SI.Power Js "Thermal power diffusion from outlet Cs"; @@ -93,10 +98,27 @@ public Real ras "Value of r(Q/gamma) for inlet Cas"; Real rex "Value of r(Q/gamma) for outlet Cex"; Real rs "Value of r(Q/gamma) for outlet Cs"; - - Interfaces.Connectors.FluidInlet Cas "Water input" annotation (Placement( + Medium.ExtraProperty BSubCl[Medium.nC](quantity=Medium.extraPropertiesNames) + "Right hand side of the trace balance equation of the liquid phase"; + Medium.ExtraProperty BSubCv[Medium.nC](quantity=Medium.extraPropertiesNames) + "Right hand side of the trace balance equation of the vapor phase"; + Medium.ExtraProperty SubCl[Medium.nC](quantity=Medium.extraPropertiesNames, start=Medium.C_default) + "Liquid phase trace substances"; + Medium.ExtraProperty SubCv[Medium.nC](quantity=Medium.extraPropertiesNames, start=Medium.C_default) + "Vapor phase trace substances"; + Medium.ExtraProperty SubCSaS[Medium.nC](quantity=Medium.extraPropertiesNames) + "Trace modification in the trace balance equation"; + Medium.ThermodynamicState state_l "Liquid state in the pressurizer"; + Medium.ThermodynamicState state_v "Vapor state in the pressurizer"; + Medium.SaturationProperties sat "Saturation properties at pressurizer pressure"; + Real ddphl "Liquid density derivative wrt. pressure at constant enthalpy"; + Real ddhpl "Liquid density derivative wrt. enthalpy at constant pressure"; + Real ddphv "Vapor density derivative wrt. pressure at constant enthalpy"; + Real ddhpv "Vapor density derivative wrt. enthalpy at constant pressure"; + + Interfaces.Connectors.FluidInlet Cas(redeclare package Medium = Medium) "Water input" annotation (Placement( transformation(extent={{-8,92},{8,108}}, rotation=0))); - Interfaces.Connectors.FluidOutlet Cs "Steam output" annotation (Placement( + Interfaces.Connectors.FluidOutlet Cs(redeclare package Medium = Medium) "Steam output" annotation (Placement( transformation(extent={{92,90},{108,106}}, rotation=0))); ThermoSysPro.Thermal.Connectors.ThermalPort Ca "Thermal input to the wall" annotation (Placement(transformation(extent={{-100,-8},{-80,12}}, rotation= @@ -109,19 +131,8 @@ public ThermoSysPro.InstrumentationAndControl.Connectors.OutputReal yLevel "Water level" annotation (Placement(transformation(extent={{80,-10},{100,10}}, rotation=0))); - Interfaces.Connectors.FluidOutlet Cex "Water output" annotation (Placement( + Interfaces.Connectors.FluidOutlet Cex(redeclare package Medium = Medium) "Water output" annotation (Placement( transformation(extent={{-8,-108},{8,-92}}, rotation=0))); - Properties.WaterSteam.Common.ThermoProperties_ph prov - "Propri鴩s de la vapeur dans le ballon" annotation (Placement( - transformation(extent={{16,44},{56,84}}, rotation=0))); - Properties.WaterSteam.Common.ThermoProperties_ph prol - "Propri鴩s de l'eau dans le ballon" annotation (Placement(transformation( - extent={{-54,44},{-14,84}}, rotation=0))); - Properties.WaterSteam.Common.PropThermoSat lsat - annotation (Placement(transformation(extent={{-54,4},{-14,44}}, rotation=0))); - Properties.WaterSteam.Common.PropThermoSat vsat - annotation (Placement(transformation( - extent={{16,4},{56,44}}, rotation=0))); initial equation if dynamic_energy_balance then if steady_state then @@ -130,25 +141,20 @@ initial equation der(hv) = 0; der(y) = 0; der(Tp) = 0; + der(SubCl) = fill(0, Medium.nC); + der(SubCv) = fill(0, Medium.nC); else P = P0; hl = hls; hv = hvs; Yw = Yw0; der(Tp) = 0; + SubCl = SubCl0; + SubCv = SubCv0; end if; end if; equation - /* Check that incoming fluids are compatible with fluid in volume */ - fluids[1] = ftype; - fluids[2] = Cas.ftype; - fluids[3] = Cex.ftype; - fluids[4] = Cs.ftype; - - assert(ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.isCompatible(fluids), - "Pressurizer: fluids mixing in volume are not compatible with each other"); - /* Unconnected connectors */ if (cardinality(Cas) == 0) then Cas.Q = 0; @@ -156,11 +162,7 @@ equation Cas.h_vol_1 = 1.e5; Cas.diff_res_1 = 0; Cas.diff_on_1 = false; - Cas.ftype = ftype; - Cas.Xco2 = 0; - Cas.Xh2o = 0; - Cas.Xo2 = 0; - Cas.Xso2 = 0; + Cas.SubC = Medium.C_default; end if; if (cardinality(Cex) == 0) then @@ -200,7 +202,7 @@ equation BQl = Cas.Q - Cex.Q + Qcond - Qevap; if dynamic_energy_balance then - rhol*Ap*Zm*der(y) + Vl*prol.ddph*der(P) + Vl*prol.ddhp*der(hl) = BQl; + rhol*Ap*Zm*der(y) + Vl*ddphl*der(P) + Vl*ddhpl*der(hl) = BQl; else 0 = BQl; end if; @@ -209,7 +211,7 @@ equation BQv = Qevap - Cs.Q - Qcond; if dynamic_energy_balance then - -rhov*Ap*Zm*der(y) + Vv*prov.ddph*der(P) + Vv*prov.ddhp*der(hv) = BQv; + -rhov*Ap*Zm*der(y) + Vv*ddphv*der(P) + Vv*ddhpv*der(hv) = BQv; else 0 = BQv; end if; @@ -263,19 +265,23 @@ equation /* Heat exchange between the wall and the outside */ Wpa = Kpa*Ae*(Ta - Tp); - /* Fluid composition (no balance equations) */ - Cex.ftype = ftype; - Cs.ftype = ftype; + /* Traces composition balance equations */ + C_record = PhasesSeparationFunction(); + SubCSaS = SaS(); + + BSubCl = Cas.Q*Cas.SubC - Cex.Q*Cex.SubC + Qcond*C_record.Cl - Qevap*SubCl; + BSubCv = Qevap*SubCl - Cs.Q*Cs.SubC - Qcond*C_record.Cg; - Cs.Xco2 = 0; - Cs.Xh2o = 0; - Cs.Xo2 = 0; - Cs.Xso2 = 0; + if dynamic_energy_balance then + rhol*Vl*der(SubCl) + SubCl*BQl = BSubCl; + rhov*Vv*der(SubCv) + SubCv*BQv + rhov*Vv*SubCSaS = BSubCv; + else + SubCl*BQl = BSubCl; + SubCv*BQv + rhov*Vv*SubCSaS = BSubCv; + end if; - Cex.Xco2 = 0; - Cex.Xh2o = 0; - Cex.Xo2 = 0; - Cex.Xso2 = 0; + Cex.SubC = SubCl; + Cs.SubC = SubCv; /* Flow reversal */ if continuous_flow_reversal then @@ -325,16 +331,21 @@ equation Cs.diff_on_1 = diffusion; /* Fluid thermodynamic properties */ - prol = ThermoSysPro.Properties.Fluid.Ph(P, hl,0,fluid); - prov = ThermoSysPro.Properties.Fluid.Ph(P, hv,0,fluid); - (lsat,vsat) = ThermoSysPro.Properties.Fluid.Water_sat_P(P,fluid); - - Tl = prol.T; - Tv = prov.T; - rhol = prol.d; - rhov = prov.d; - hls = lsat.h; - hvs = vsat.h; + state_l = Medium.setState_phX(p=P, h=hl, X=Medium.reference_X); + state_v = Medium.setState_phX(p=P, h=hv, X=Medium.reference_X); + sat = Medium.setSat_p(P); + + ddphl = Medium.density_derp_h(state_l); + ddhpl = Medium.density_derh_p(state_l); + ddphv = Medium.density_derp_h(state_v); + ddhpv = Medium.density_derh_p(state_v); + + Tl = Medium.temperature(state_l); + Tv = Medium.temperature(state_v); + rhol = Medium.density(state_l); + rhov = Medium.density(state_v); + hls = Medium.bubbleEnthalpy(sat); + hvs = Medium.dewEnthalpy(sat); annotation (Icon(graphics={ Line( From ef086020463215442c089cc3031fc39606e6b186 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Tue, 12 May 2026 10:14:03 +0200 Subject: [PATCH 132/178] #125 TankHorizontal --- ...orizontal_Traces_withPipePressureLosses.mo | 65 +++++++ ...stTankHorizontal_withPipePressureLosses.mo | 61 ++++++ .../SimpleExamples/Volumes/package.order | 2 + ThermoSysPro/Fluid/Volumes/TankHorizontal.mo | 178 ++++++------------ 4 files changed, 186 insertions(+), 120 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestTankHorizontal_Traces_withPipePressureLosses.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestTankHorizontal_withPipePressureLosses.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestTankHorizontal_Traces_withPipePressureLosses.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestTankHorizontal_Traces_withPipePressureLosses.mo new file mode 100644 index 00000000..4c6c1f47 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestTankHorizontal_Traces_withPipePressureLosses.mo @@ -0,0 +1,65 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Volumes; +model TestTankHorizontal_Traces_withPipePressureLosses + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam ( + extraPropertiesNames={"Trace"}, + C_nominal={0.1}, + C_default={0.2}); + ThermoSysPro.Fluid.PressureLosses.PipePressureLoss PerteDP1( + redeclare package Medium = Medium, + K=1.5, + Q(start=5282.482640023983), + rho(start=997.40780979054, displayUnit="g/cm3")) annotation (Placement(transformation(extent={{30,-50},{50,-30}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.ControlValve VanneReglante1( + redeclare package Medium = Medium, + Pm(start=21741.77302868171, displayUnit="bar"), + Q(start=-1.3278998585228342E-31)) annotation (Placement(transformation(extent={{-50,2},{-30,22}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP SourceP1(redeclare package Medium = Medium, SubC0={0.3}) annotation (Placement(transformation(extent={{-90,-4},{-70,16}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP PuitsP1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{70,-50},{90,-30}}, rotation=0))); + ThermoSysPro.Fluid.Volumes.TankHorizontal Tank1( + redeclare package Medium = Medium, + SubC(start={0.9}), + z(fixed=false, start=1), + Cs1(Q(start=1.2116903504194741E-27)), + Cs2(P(start=3.2e5)), + rho(start=997.4119292829444, displayUnit="g/cm3")) annotation (Placement(transformation(extent={{-10,-10},{10,10}}, rotation=0))); + ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Rampe Rampe1 annotation (Placement(transformation(extent={{-90,30},{-70,50}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.PipePressureLoss PerteDP2( + redeclare package Medium = Medium, + K=1.5, + rho(start=997.33695032119, displayUnit="g/cm3")) annotation (Placement(transformation(extent={{30,-4},{50,16}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP PuitsP2(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{70,-4},{90,16}}, rotation=0))); +equation + connect(PerteDP1.C2, PuitsP1.C) annotation (Line(points={{50,-40},{70,-40}}, color={0,0,255})); + connect(SourceP1.C, VanneReglante1.C1) annotation (Line(points={{-70,6},{-50,6}}, color={0,0,255})); + connect(Tank1.Cs2, PerteDP1.C1) annotation (Line(points={{10,-5},{20,-5},{20,-40},{30,-40}}, color={0,0,255})); + connect(Rampe1.y, VanneReglante1.Ouv) annotation (Line(points={{-69,40},{-40,40},{-40,23}})); + connect(VanneReglante1.C2, Tank1.Ce1) annotation (Line(points={{-30,6},{-20,6},{-20,5},{-10,5}}, color={0,0,255})); + connect(Tank1.Cs1, PerteDP2.C1) annotation (Line(points={{10.2,4.9},{20,4.9},{20,6},{30,6}}, color={0,0,255})); + connect(PerteDP2.C2, PuitsP2.C) annotation (Line(points={{50,6},{70,6}}, color={0,0,255})); + annotation ( + experiment(StopTime=20), + Icon(graphics={ + Rectangle( + lineColor={200,200,200}, + fillColor={248,248,248}, + fillPattern=FillPattern.HorizontalCylinder, + extent={{-100.0,-100.0},{100.0,100.0}}, + radius=25.0), + Rectangle( + lineColor={128,128,128}, + extent={{-100.0,-100.0},{100.0,100.0}}, + radius=25.0), + Polygon( + origin={8.0,14.0}, + lineColor={78,138,73}, + fillColor={78,138,73}, + pattern=LinePattern.None, + fillPattern=FillPattern.Solid, + points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), + Documentation(info=" +

    Copyright © EDF 2002 - 2024

    +

    ThermoSysPro Version 4.1 +")); +end TestTankHorizontal_Traces_withPipePressureLosses; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestTankHorizontal_withPipePressureLosses.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestTankHorizontal_withPipePressureLosses.mo new file mode 100644 index 00000000..b8ff2542 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestTankHorizontal_withPipePressureLosses.mo @@ -0,0 +1,61 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Volumes; +model TestTankHorizontal_withPipePressureLosses + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; + ThermoSysPro.Fluid.PressureLosses.PipePressureLoss PerteDP1( + redeclare package Medium = Medium, + K=1.5, + Q(start=5282.482640023983), + rho(start=997.40780979054, displayUnit="g/cm3")) annotation (Placement(transformation(extent={{30,-50},{50,-30}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.ControlValve VanneReglante1( + redeclare package Medium = Medium, + Pm(start=21741.77302868171, displayUnit="bar"), + Q(start=-1.3278998585228342E-31)) annotation (Placement(transformation(extent={{-50,2},{-30,22}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP SourceP1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-90,-4},{-70,16}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP PuitsP1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{70,-50},{90,-30}}, rotation=0))); + ThermoSysPro.Fluid.Volumes.TankHorizontal Tank1( + redeclare package Medium = Medium, + z(fixed=false, start=1), + Cs1(Q(start=1.2116903504194741E-27)), + Cs2(P(start=3.2e5)), + rho(start=997.4119292829444, displayUnit="g/cm3")) annotation (Placement(transformation(extent={{-10,-10},{10,10}}, rotation=0))); + ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Rampe Rampe1 annotation (Placement(transformation(extent={{-90,30},{-70,50}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.PipePressureLoss PerteDP2( + redeclare package Medium = Medium, + K=1.5, + rho(start=997.33695032119, displayUnit="g/cm3")) annotation (Placement(transformation(extent={{30,-4},{50,16}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP PuitsP2(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{70,-4},{90,16}}, rotation=0))); +equation + connect(PerteDP1.C2, PuitsP1.C) annotation (Line(points={{50,-40},{70,-40}}, color={0,0,255})); + connect(SourceP1.C, VanneReglante1.C1) annotation (Line(points={{-70,6},{-50,6}}, color={0,0,255})); + connect(Tank1.Cs2, PerteDP1.C1) annotation (Line(points={{10,-5},{20,-5},{20,-40},{30,-40}}, color={0,0,255})); + connect(Rampe1.y, VanneReglante1.Ouv) annotation (Line(points={{-69,40},{-40,40},{-40,23}})); + connect(VanneReglante1.C2, Tank1.Ce1) annotation (Line(points={{-30,6},{-20,6},{-20,5},{-10,5}}, color={0,0,255})); + connect(Tank1.Cs1, PerteDP2.C1) annotation (Line(points={{10.2,4.9},{20,4.9},{20,6},{30,6}}, color={0,0,255})); + connect(PerteDP2.C2, PuitsP2.C) annotation (Line(points={{50,6},{70,6}}, color={0,0,255})); + annotation ( + experiment(StopTime=20), + Icon(graphics={ + Rectangle( + lineColor={200,200,200}, + fillColor={248,248,248}, + fillPattern=FillPattern.HorizontalCylinder, + extent={{-100.0,-100.0},{100.0,100.0}}, + radius=25.0), + Rectangle( + lineColor={128,128,128}, + extent={{-100.0,-100.0},{100.0,100.0}}, + radius=25.0), + Polygon( + origin={8.0,14.0}, + lineColor={78,138,73}, + fillColor={78,138,73}, + pattern=LinePattern.None, + fillPattern=FillPattern.Solid, + points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), + Documentation(info=" +

    Copyright © EDF 2002 - 2024

    +

    ThermoSysPro Version 4.1 +")); +end TestTankHorizontal_withPipePressureLosses; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order index 4e146b27..c1f884cb 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order @@ -30,6 +30,8 @@ TestVolumeITh_FlueGases TestVolumeITh_Traces TestTank_withPipePressureLosses TestTank_Traces_withPipePressureLosses +TestTankHorizontal_withPipePressureLosses +TestTankHorizontal_Traces_withPipePressureLosses TestDynamicDrum TestDynamicDrum_Traces TestTwoPhaseVolume diff --git a/ThermoSysPro/Fluid/Volumes/TankHorizontal.mo b/ThermoSysPro/Fluid/Volumes/TankHorizontal.mo index 04608f26..f434cea1 100644 --- a/ThermoSysPro/Fluid/Volumes/TankHorizontal.mo +++ b/ThermoSysPro/Fluid/Volumes/TankHorizontal.mo @@ -1,10 +1,8 @@ within ThermoSysPro.Fluid.Volumes; model TankHorizontal "Open horizontal tank" - extends - ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidTypeParameterInterface; extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable function SaS = Medium.noSaS(SubC=SubC) annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Units.SI.AbsolutePressure Patm=1.013e5 "Pressure above the fluid level"; @@ -25,7 +23,7 @@ model TankHorizontal "Open horizontal tank" parameter Boolean dynamic_energy_balance=true "true: dynamic energy balance equation - false: static energy balance equation"; parameter Boolean dynamic_mass_balance=false - "true: dynamic mass balance equation - false: static mass balance equation (active if the fluid is compressible and if dynamic_energy_balance=true)" annotation(Evaluate=true, Dialog(enable=isCompressible and dynamic_energy_balance)); + "true: dynamic mass balance equation - false: static mass balance equation (active if the fluid is compressible and if dynamic_energy_balance=true)" annotation(Evaluate=true, Dialog(enable=Medium.isCompressible and dynamic_energy_balance)); parameter Boolean steady_state=false "true: start from steady state - false: start from (P0, h0) (active if dynamic_energy_balance=true)" annotation(Evaluate=true, Dialog(enable=dynamic_energy_balance)); parameter Units.SI.SpecificEnthalpy h0=1.e5 @@ -43,47 +41,22 @@ model TankHorizontal "Open horizontal tank" "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; parameter Units.SI.Density p_rho=0 "If > 0, fixed fluid density" annotation (Evaluate=true, Dialog(tab="Fluid", group="Fluid properties")); - parameter IF97Region region=IF97Region.All_regions "IF97 region (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); parameter Boolean dynamic_composition_balance=false - "true: dynamic fluid composition balance equation
    false: static fluid composition balance equation (active for flue gases)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.FlueGases), tab="Fluid", group="Fluid properties")); + "true: dynamic fluid composition balance equation
    false: static fluid composition balance equation" annotation(Evaluate=true, Dialog(tab="Fluid", group="Fluid properties")); - parameter ThermoSysPro.Units.SI.MassFraction Xco20=0.0 - "Initial CO2 mass fraction" annotation (Evaluate=true, Dialog( + parameter Medium.ExtraProperty X0[Medium.nX]=Medium.X_default "Initial composition values" annotation (Evaluate=true, Dialog( enable=dynamic_composition_balance, tab="Fluid", - group= - "Initial composition values (active for flue gases only if dynamic_composition_balance=true)")); - parameter ThermoSysPro.Units.SI.MassFraction Xh2o0=if ftype == FluidType.FlueGases then 0.05 else 0 - "Initial H20 mass fraction" annotation (Evaluate=true, Dialog( - enable=dynamic_composition_balance, - tab="Fluid", - group= - "Initial composition values (active for flue gases only if dynamic_composition_balance=true)")); - parameter ThermoSysPro.Units.SI.MassFraction Xo20=0.23 - "Initial O2 mass fraction" annotation (Evaluate=true, Dialog( - enable=dynamic_composition_balance, - tab="Fluid", - group= - "Initial composition values (active for flue gases only if dynamic_composition_balance=true)")); - parameter ThermoSysPro.Units.SI.MassFraction Xso20=0 - "Initial SO2 mass fraction" annotation (Evaluate=true, Dialog( - enable=dynamic_composition_balance, - tab="Fluid", - group= - "Initial composition values (active for flue gases only if dynamic_composition_balance=true)")); + group="Medium")); protected - constant Units.SI.SpecificEnthalpy hr=2501569 - "Water/steam reference specific enthalpy at 0.01°C"; constant Real pi=Modelica.Constants.pi "pi"; parameter Units.SI.Acceleration g=Modelica.Constants.g_n "Gravity constant"; parameter Units.SI.Thickness e=0.25 "Inlet/outlet thickness"; parameter Real eps=1.e-0 "Small number for ths square function"; parameter Units.SI.Position zmin=1.e-6 "Minimum fluid level"; - parameter Boolean flue_gases=(ftype == FluidType.FlueGases) "Flue gases"; parameter Units.SI.MassFlowRate gamma0=1.e-4 "Pseudo-diffusion conductance use for continuous flow reversal (active if diffusion=false and continuous_flow_reversal = true)"; - parameter Integer mode=Integer(region) - 1 "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; public Units.SI.Position z "Fluid level"; @@ -106,15 +79,12 @@ public Real Os2; Units.SI.DerDensityByPressure ddph "density derivative by pressure"; Units.SI.DerDensityByEnthalpy ddhp "density derivative by enthalpy"; - FluidType fluids[5] "Fluids mixing in volume"; - Units.SI.MassFlowRate BXco2 "Right hand side of the CO2 balance equation"; - Units.SI.MassFlowRate BXh2o "Right hand side of the H2O balance equation"; - Units.SI.MassFlowRate BXo2 "Right hand side of the O2 balance equation"; - Units.SI.MassFlowRate BXso2 "Right hand side of the SO2 balance equation"; - ThermoSysPro.Units.SI.MassFraction Xco2 "CO2 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xh2o "H20 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xo2 "O2 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xso2 "SO2 mass fraction"; + Medium.ExtraProperty BSubC[Medium.nC](quantity=Medium.extraPropertiesNames) "Right hand side of the trace balance equation"; + Medium.ExtraProperty SubC[Medium.nC](quantity=Medium.extraPropertiesNames, start=Medium.C_default) "Fluid trace substances"; + Medium.ExtraProperty SubCSaS[Medium.nC](quantity=Medium.extraPropertiesNames) "Trace modification in the trace balance equation"; + Medium.ThermodynamicState state; + Units.SI.MassFlowRate BX[Medium.nXi] "Right hand side of the X balance equation"; + Medium.ExtraProperty X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Fluid mass fraction"; Units.SI.Power Je1 "Thermal power diffusion from inlet e1"; Units.SI.Power Je2 "Thermal power diffusion from inlet e2"; Units.SI.Power Js1 "Thermal power diffusion from outlet s1"; @@ -133,16 +103,16 @@ public ThermoSysPro.InstrumentationAndControl.Connectors.OutputReal yLevel "Water level" annotation (Placement(transformation( extent={{102,-9},{122,11}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce1 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce1(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-110,40},{-90,60}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs2 annotation ( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs2(redeclare package Medium = Medium) annotation ( Placement(transformation(extent={{90,-60},{110,-40}}, rotation=0))); ThermoSysPro.Thermal.Connectors.ThermalPort Cth annotation (Placement(transformation( extent={{-10,-10},{10,10}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce2 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce2(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-110,-60},{-90,-40}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs1 annotation ( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs1(redeclare package Medium = Medium) annotation ( Placement(transformation(extent={{92,39},{112,59}}, rotation=0))); initial equation if dynamic_energy_balance then @@ -159,44 +129,23 @@ initial equation z = z0; end if; - if flue_gases then - if dynamic_composition_balance then - if steady_state then - der(Xco2) = 0; - der(Xh2o) = 0; - der(Xo2) = 0; - der(Xso2) = 0; - else - Xco2 = Xco20; - Xh2o = Xh2o0; - Xo2 = Xo20; - Xso2 = Xso20; - end if; + if dynamic_composition_balance then + if steady_state then + der(X) = fill(0, Medium.nX); + else + X = X0[1:Medium.nXi]; end if; end if; equation - /* Check that incoming fluids are compatible with fluid in volume */ - fluids[1] = ftype; - fluids[2] = Ce1.ftype; - fluids[3] = Ce2.ftype; - fluids[4] = Cs1.ftype; - fluids[5] = Cs2.ftype; - - assert(ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.isCompatible(fluids), - "TankHorizontal: fluids mixing in volume are not compatible with each other"); - if (cardinality(Ce1) == 0) then Ce1.Q = 0; Ce1.h = 1.e5; Ce1.h_vol_1 = 1.e5; Ce1.diff_res_1 = 0; Ce1.diff_on_1 = false; - Ce1.ftype = ftype; - Ce1.Xco2 = 0; - Ce1.Xh2o = 0; - Ce1.Xo2 = 0; - Ce1.Xso2 = 0; + Ce1.Xi = Medium.X_default[1:Medium.nXi]; + Ce1.SubC = Medium.C_default; end if; if (cardinality(Ce2) == 0) then @@ -205,11 +154,8 @@ equation Ce2.h_vol_1 = 1.e5; Ce2.diff_res_1 = 0; Ce2.diff_on_1 = false; - Ce2.ftype = ftype; - Ce2.Xco2 = 0; - Ce2.Xh2o = 0; - Ce2.Xo2 = 0; - Ce2.Xso2 = 0; + Ce2.Xi = Medium.X_default[1:Medium.nXi]; + Ce2.SubC = Medium.C_default; end if; if (cardinality(Cs1) == 0) then @@ -240,8 +186,8 @@ equation /* Mass balance equation */ BQ = Ce1.Q + Ce2.Q - Cs1.Q - Cs2.Q; - if isCompressible and dynamic_energy_balance and dynamic_mass_balance then - A*(ddph*der(P) + ddhp*der(h - Xh2o*hr))*z + A*rho*der(z) = BQ; + if Medium.isCompressible and dynamic_energy_balance and dynamic_mass_balance then + A*(ddph*der(P) + ddhp*der(h))*z + A*rho*der(z) = BQ; else A*rho*der(z) = BQ; end if; @@ -280,17 +226,17 @@ equation end if; /* Energy balance equation */ - BH = Ce1.Q*((Ce1.h - Ce1.Xh2o*hr) - (h - Xh2o*hr)) + Ce2.Q*((Ce2.h - Ce2.Xh2o*hr) - (h - Xh2o*hr)) - Cs1.Q*((Cs1.h - Cs1.Xh2o*hr) - (h - Xh2o*hr)) - Cs2.Q*((Cs2.h - Cs2.Xh2o*hr) - (h - Xh2o*hr)) + Cth.W + J; + BH = Ce1.Q*(Ce1.h - h) + Ce2.Q*(Ce2.h - h) - Cs1.Q*(Cs1.h - h) - Cs2.Q*(Cs2.h - h) + Cth.W + J; if dynamic_energy_balance then if z > zmin then if dynamic_mass_balance then - A*z*((P/rho*ddph - 1)*der(P) + (P/rho*ddhp + rho)*der(h - Xh2o*hr)) = BH; + A*z*((P/rho*ddph - 1)*der(P) + (P/rho*ddhp + rho)*der(h)) = BH; else - A*z*rho*der(h - Xh2o*hr) = BH; + A*z*rho*der(h) = BH; end if; else - der(h - Xh2o*hr) = 0; + der(h) = 0; end if; else BH = 0; @@ -307,42 +253,29 @@ equation yLevel.signal = z; /* Fluid composition balance equations */ - BXco2 = Ce1.Xco2*Ce1.Q + Ce2.Xco2*Ce2.Q - Cs1.Xco2*Cs1.Q - Cs2.Xco2*Cs2.Q; - BXh2o = Ce1.Xh2o*Ce1.Q + Ce2.Xh2o*Ce2.Q - Cs1.Xh2o*Cs1.Q - Cs2.Xh2o*Cs2.Q; - BXo2 = Ce1.Xo2*Ce1.Q + Ce2.Xo2*Ce2.Q - Cs1.Xo2*Cs1.Q - Cs2.Xo2*Cs2.Q; - BXso2 = Ce1.Xso2*Ce1.Q + Ce2.Xso2*Ce2.Q - Cs1.Xso2*Cs1.Q - Cs2.Xso2*Cs2.Q; - - if flue_gases then - if dynamic_composition_balance then - A*z*rho*der(Xco2) + Xco2*BQ = BXco2; - A*z*rho*der(Xh2o) + Xh2o*BQ = BXh2o; - A*z*rho*der(Xo2) + Xo2*BQ = BXo2; - A*z*rho*der(Xso2) + Xso2*BQ = BXso2; - else - Xco2*BQ = BXco2; - Xh2o*BQ = BXh2o; - Xo2*BQ = BXo2; - Xso2*BQ = BXso2; - end if; + BX = Ce1.Xi*Ce1.Q + Ce2.Xi*Ce2.Q - Cs1.Xi*Cs1.Q - Cs2.Xi*Cs2.Q; + + if dynamic_composition_balance then + A*z*rho*der(X) + X*BQ = BX; else - Xco2 = 0; - Xh2o = 0; - Xo2 = 0; - Xso2 = 0; + X*BQ = BX; end if; - Cs1.ftype = ftype; - Cs2.ftype = ftype; + Cs1.Xi = X; + Cs2.Xi = X; - Cs1.Xco2 = Xco2; - Cs1.Xh2o = Xh2o; - Cs1.Xo2 = Xo2; - Cs1.Xso2 = Xso2; + /* Traces composition balance equations */ + BSubC = Ce1.Q*Ce1.SubC + Ce2.Q*Ce2.SubC - Cs1.Q*Cs1.SubC - Cs2.Q*Cs2.SubC; - Cs2.Xco2 = Xco2; - Cs2.Xh2o = Xh2o; - Cs2.Xo2 = Xo2; - Cs2.Xso2 = Xso2; + SubCSaS = SaS(); + if dynamic_mass_balance then + A*z*rho*der(SubC) + SubC*BQ + A*z*rho*SubCSaS = BSubC; + else + A*z*rho*SubCSaS = BSubC; + end if; + + Cs1.SubC = SubC; + Cs2.SubC = SubC; /* Flow reversal */ if continuous_flow_reversal then @@ -401,17 +334,22 @@ equation /* Fluid thermodynamic properties */ P = Patm + rho*g*z/2; - T = ThermoSysPro.Properties.Fluid.Temperature_Ph(P,h,fluid,mode,Cs1.Xco2, Cs1.Xh2o, Cs1.Xo2, Cs1.Xso2); + state = Medium.setState_phX( + p=P, + h=h, + X=X); + + T = Medium.temperature(state); if (p_rho > 0) then rho = p_rho; else - rho = ThermoSysPro.Properties.Fluid.Density_Ph(P,h,fluid,mode,Cs1.Xco2, Cs1.Xh2o, Cs1.Xo2, Cs1.Xso2); + rho = Medium.density(state); end if; if dynamic_mass_balance then - ddph = ThermoSysPro.Properties.Fluid.Density_derp_Ph(P, h, fluid,mode, Cs1.Xco2, Cs1.Xh2o, Cs1.Xo2, Cs1.Xso2); - ddhp = ThermoSysPro.Properties.Fluid.Density_derh_Ph(P, h, fluid,mode, Cs1.Xco2, Cs1.Xh2o, Cs1.Xo2, Cs1.Xso2); + ddph = Medium.density_derp_h(state); + ddhp = Medium.density_derh_p(state); else ddph = 0; ddhp = 0; From e894218980c5d4b99fca70081721f72d609dccdb Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Tue, 12 May 2026 10:56:26 +0200 Subject: [PATCH 133/178] #125 Example fixed for SimpleDynamicCondenser --- .../TestSimpleDynamicCondenser.mo | 147 +++++++++++++----- .../TestSimpleDynamicCondenser_Traces.mo | 68 +------- 2 files changed, 108 insertions(+), 107 deletions(-) diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestSimpleDynamicCondenser.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestSimpleDynamicCondenser.mo index 4b33034f..95d05b29 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestSimpleDynamicCondenser.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestSimpleDynamicCondenser.mo @@ -3,63 +3,124 @@ model TestSimpleDynamicCondenser extends ThermoSysPro.UsersGuide.Icons.Example; replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; - - ThermoSysPro.Fluid.BoundaryConditions.SinkP puitsPCaloporteur( - redeclare package Medium = Medium, - P0=1e5, - option_temperature=false) annotation (Placement(transformation(extent={{48,30},{88,70}}, rotation=0))); ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss PerteChargeCondPompe( redeclare package Medium = Medium, K=1e-6, - Q(start=0.598447)) annotation (Placement(transformation(origin={-90,-38}, extent={{-10,-10},{10,10}}, rotation=180))); - ThermoSysPro.Fluid.BoundaryConditions.SourceP SourceRechauffeurEau( - redeclare package Medium = Medium, - option_temperature=false, - h0=2401e3, - P0=15050) annotation (Placement(transformation(extent={{-207,148},{-183,170}}, rotation=0))); + Q(start=234.2), + rho(start=994.7163, displayUnit="g/cm3"), + C1(P(start=33724.215, displayUnit="bar"))) annotation (Placement(transformation( + origin={-8,-80}, + extent={{-10,-10},{10,10}}, + rotation=180))); ThermoSysPro.Fluid.BoundaryConditions.SinkQ PuitsRechauffeurEau( redeclare package Medium = Medium, - h0=191812, - Q0=192) annotation (Placement(transformation(extent={{-184,-52},{-208,-24}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourcePCaloporteur( - redeclare package Medium = Medium, - Q0=29804.5, - h0=113e3) annotation (Placement(transformation(extent={{-212,30},{-172,68}}, rotation=0))); + Q0=234.2, + h0=137.9e3) annotation (Placement(transformation(extent={{-58,-90},{-78,-70}}, rotation=0))); ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss PerteChargeCondPompe1( redeclare package Medium = Medium, - K=1e-6) annotation (Placement(transformation(origin={36,50}, extent={{6,-10},{-6,10}}, rotation=180))); + K=1e-6, + rho(start=995.2436, displayUnit="g/cm3")) annotation (Placement(transformation( + origin={94,-30}, + extent={{10,-10},{-10,10}}, + rotation=180))); ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss PerteChargeCondPompe2( redeclare package Medium = Medium, - K=1e-6) annotation (Placement(transformation(origin={-154,49}, extent={{6,-10},{-6,10}}, rotation=180))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss PerteChargeCondPompe3( - redeclare package Medium = Medium, - K(fixed=false)=1e-3, - Q(start=192, fixed=true)) - annotation (Placement(transformation(origin={-120,159}, extent={{10,-10},{-10,10}}, rotation=180))); + K=1e-6, + rho(start=998.6793, displayUnit="g/cm3")) annotation (Placement(transformation( + origin={-22,-30}, + extent={{10,-10},{-10,10}}, + rotation=180))); ThermoSysPro.Fluid.HeatExchangers.SimpleDynamicCondenser Condenseur( redeclare package Medium = Medium, redeclare package Medium_Cooling = Medium, D=0.018, - V=1000, - A=100, + V=26.592685799971978, + A=1.0140805624113665, lambda=0.01, - ntubes=28700, - continuous_flow_reversal=true, + ntubes=30000, + gravity_pressure=true, + steady_state=true, + P0=5010, yNiveau(signal(fixed=false, start=1.5)), - Vf0=0.15, - steady_state=false, - P(fixed=false, start=10000)) annotation (Placement(transformation(extent={{-118,6},{1,116}}, rotation=0))); + Vf0=0.10, + P(start=4999.0117, + displayUnit="bar"), + rhom(displayUnit="g/cm3", start=997.1903), + xv(start=4.3733834E-09), + Vv(start=23.606508), + xl(start=-3.5873317E-08)) + annotation (Placement(transformation(extent={{14,-46},{70,-6}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP source_retourCondensats( + redeclare package Medium = Medium, + P0=25560, + h0=160.7e3, + option_temperature=false, + T(start=311.52)) annotation (Placement(transformation(extent={{-60,70},{-40,90}}))); + ThermoSysPro.Fluid.Volumes.VolumeC volumeC(redeclare package Medium = Medium, h(start=1861385.9)) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=-90, + origin={42,40}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP source_autre( + redeclare package Medium = Medium, + P0=82050, + h0=394.5e3, + option_temperature=false, + T(start=367.32)) annotation (Placement(transformation(extent={{-60,30},{-40,50}}))); + ThermoSysPro.Fluid.PressureLosses.PipePressureLoss PdC_chaudCond_out(redeclare package Medium = Medium, K=1e-5) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=-90, + origin={42,14}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ source_vapLP( + redeclare package Medium = Medium, + Q0=194.355 - 9.231 - 9.766 - 9.418, + h0=2624.5e3, + option_temperature=false) annotation (Placement(transformation(extent={{-60,110},{-40,130}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ( + redeclare package Medium = Medium, + Q0=7006, + T0=290.68, + h0=113e3, + option_temperature=true) annotation (Placement(transformation(extent={{-72,-40},{-52,-20}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP puitsPCaloporteur( + redeclare package Medium = Medium, + T0=302.74, + option_temperature=true) annotation (Placement(transformation(extent={{128,-40},{148,-20}}, rotation=0))); + ThermoSysPro.Fluid.Machines.StodolaTurbine LP4( + redeclare package Medium = Medium, + Cst( + fixed=false, + start=92.838486) = 8000, + eta_is_nom(fixed=false) = 0.8, + Ce(P(fixed=true, start=30000)), + Cs(P(fixed=false, start=5010), h(fixed=true, start=2560.8e3))) annotation (Placement(transformation(extent={{20,110},{40,130}}))); + ThermoSysPro.Fluid.PressureLosses.ControlValve controlValve_autre( + redeclare package Medium = Medium, + Cvmax(fixed=false) = 8000, + Q(fixed=true, start=0.1199), + C2(P(start=5010, fixed=false))) annotation (Placement(transformation(extent={{-20,36},{0,56}}))); + ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Constante constante2 annotation (Placement(transformation(extent={{-28,56},{-20,64}}))); + ThermoSysPro.Fluid.PressureLosses.ControlValve controlValve_retourCondensats( + redeclare package Medium = Medium, + Cvmax(fixed=false) = 8000, + C2(P(start=5010, fixed=false))) annotation (Placement(transformation(extent={{-20,76},{0,96}}))); + ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Constante constante1 annotation (Placement(transformation(extent={{-28,96},{-20,104}}))); equation - connect(sourcePCaloporteur.C, PerteChargeCondPompe2.C1) annotation (Line(points={{-172,49},{-160,49}}, color={0,0,255})); - connect(PerteChargeCondPompe1.C2, puitsPCaloporteur.C) annotation (Line(points={{42,50},{48,50}}, color={0,0,255})); - connect(SourceRechauffeurEau.C, PerteChargeCondPompe3.C1) annotation (Line(points={{-183,159},{-130,159}}, color={0,0,255})); - connect(PuitsRechauffeurEau.C, PerteChargeCondPompe.C2) annotation (Line(points={{-184,-38},{-100,-38}})); - connect(PerteChargeCondPompe2.C2, Condenseur.Cee) annotation (Line(points={{-148,49},{-133,49},{-133,48.9},{-118,48.9}}, color={0,0,255})); - connect(PerteChargeCondPompe.C1, Condenseur.Cl) annotation (Line(points={{-80,-38},{-57.31,-38},{-57.31,6}})); - connect(PerteChargeCondPompe3.C2, Condenseur.Cv) annotation (Line(points={{-110,159},{-58.5,159},{-58.5,116}}, color={0,0,255})); - connect(PerteChargeCondPompe1.C1, Condenseur.Cse) annotation (Line(points={{30,50},{15.5,50},{15.5,50},{1,50}})); - annotation ( - experiment(StopTime=1000), - Icon(coordinateSystem(preserveAspectRatio=false)), - Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-250,-60},{130,180}}))); + connect(PerteChargeCondPompe2.C2, Condenseur.Cee) annotation (Line(points={{-12,-30},{4,-30},{4,-30.4},{14,-30.4}}, color={0,0,0})); + connect(PerteChargeCondPompe.C1, Condenseur.Cl) annotation (Line(points={{2,-80},{42.56,-80},{42.56,-46}})); + connect(PerteChargeCondPompe1.C1, Condenseur.Cse) annotation (Line(points={{84,-30},{70,-30}})); + connect(PdC_chaudCond_out.C1, volumeC.Cs) annotation (Line(points={{42,24},{42,30}}, color={0,0,0})); + connect(PdC_chaudCond_out.C2, Condenseur.Cv) annotation (Line(points={{42,4},{42,-6}}, color={0,0,0})); + connect(sourceQ.C, PerteChargeCondPompe2.C1) annotation (Line(points={{-52,-30},{-32,-30}}, color={0,0,0})); + connect(PerteChargeCondPompe1.C2, puitsPCaloporteur.C) annotation (Line(points={{104,-30},{128,-30}}, color={0,0,0})); + connect(LP4.Ce, source_vapLP.C) annotation (Line(points={{19.9,120},{-40,120}}, color={0,0,0})); + connect(LP4.Cs, volumeC.Ce2) annotation (Line(points={{40.1,120},{58,120},{58,40},{52,40}}, color={0,0,0})); + connect(source_autre.C, controlValve_autre.C1) annotation (Line(points={{-40,40},{-20,40}}, color={0,0,0})); + connect(controlValve_autre.C2, volumeC.Ce3) annotation (Line(points={{0,40},{32,40}}, color={0,0,0})); + connect(controlValve_autre.Ouv, constante2.y) annotation (Line(points={{-10,57},{-10,60},{-19.6,60}}, color={0,0,255})); + connect(source_retourCondensats.C, controlValve_retourCondensats.C1) annotation (Line(points={{-40,80},{-20,80}}, color={0,0,0})); + connect(controlValve_retourCondensats.C2, volumeC.Ce1) annotation (Line(points={{0,80},{42,80},{42,50}}, color={0,0,0})); + connect(constante1.y, controlValve_retourCondensats.Ouv) annotation (Line(points={{-19.6,100},{-10,100},{-10,97}}, color={0,0,255})); + connect(PuitsRechauffeurEau.C, PerteChargeCondPompe.C2) annotation (Line(points={{-58,-80},{-18,-80}}, color={0,0,0})); + + annotation (experiment(StopTime=1000), Icon(coordinateSystem(preserveAspectRatio=false))); end TestSimpleDynamicCondenser; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestSimpleDynamicCondenser_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestSimpleDynamicCondenser_Traces.mo index 4f669ff2..b974b142 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestSimpleDynamicCondenser_Traces.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestSimpleDynamicCondenser_Traces.mo @@ -1,68 +1,8 @@ within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; model TestSimpleDynamicCondenser_Traces - extends ThermoSysPro.UsersGuide.Icons.Example; + extends ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers.TestSimpleDynamicCondenser( + redeclare package Medium = ThermoSysPro.Fluid.Examples.SimpleExamples.Media.WaterSteam_FullyVolatileTrace, + Condenseur(redeclare function PhasesSeparationFunction = Medium.PhasesSeparation (x=Condenseur.xv)) - replaceable package Medium = ThermoSysPro.Fluid.Examples.SimpleExamples.Media.WaterSteam_FullyVolatileTrace; - - ThermoSysPro.Fluid.BoundaryConditions.SinkP puitsPCaloporteur( - redeclare package Medium = Medium, - P0=1e5, - option_temperature=false) annotation (Placement(transformation(extent={{48,30},{88,70}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss PerteChargeCondPompe( - redeclare package Medium = Medium, - K=1e-6, - Q(start=0.598447)) annotation (Placement(transformation(origin={-90,-38}, extent={{-10,-10},{10,10}}, rotation=180))); - ThermoSysPro.Fluid.BoundaryConditions.SourceP SourceRechauffeurEau( - redeclare package Medium = Medium, - option_temperature=false, - h0=2401e3, - P0=15050, - SubC0={10}) annotation (Placement(transformation(extent={{-207,148},{-183,170}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkQ PuitsRechauffeurEau( - redeclare package Medium = Medium, - h0=191812, - Q0=192) annotation (Placement(transformation(extent={{-184,-52},{-208,-24}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourcePCaloporteur( - redeclare package Medium = Medium, - Q0=29804.5, - h0=113e3, - SubC0={10}) annotation (Placement(transformation(extent={{-212,30},{-172,68}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss PerteChargeCondPompe1( - redeclare package Medium = Medium, - K=1e-6) annotation (Placement(transformation(origin={36,50}, extent={{6,-10},{-6,10}}, rotation=180))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss PerteChargeCondPompe2( - redeclare package Medium = Medium, - K=1e-6) annotation (Placement(transformation(origin={-154,49}, extent={{6,-10},{-6,10}}, rotation=180))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss PerteChargeCondPompe3( - redeclare package Medium = Medium, - K(fixed=false)=1e-3, - Q(fixed=true,start=192)) - annotation (Placement(transformation(origin={-120,159}, extent={{10,-10},{-10,10}}, rotation=180))); - ThermoSysPro.Fluid.HeatExchangers.SimpleDynamicCondenser Condenseur( - redeclare package Medium = Medium, - redeclare package Medium_Cooling = Medium, - redeclare function PhasesSeparationFunction = Medium.PhasesSeparation(x=Condenseur.xv), - D=0.018, - V=1000, - A=100, - lambda=0.01, - ntubes=28700, - continuous_flow_reversal=true, - yNiveau(signal(fixed=false, start=1.5)), - Vf0=0.15, - steady_state=false, - P(fixed=false, start=10000)) annotation (Placement(transformation(extent={{-118,6},{1,116}}, rotation=0))); -equation - connect(sourcePCaloporteur.C, PerteChargeCondPompe2.C1) annotation (Line(points={{-172,49},{-160,49}}, color={0,0,255})); - connect(PerteChargeCondPompe1.C2, puitsPCaloporteur.C) annotation (Line(points={{42,50},{48,50}}, color={0,0,255})); - connect(SourceRechauffeurEau.C, PerteChargeCondPompe3.C1) annotation (Line(points={{-183,159},{-130,159}}, color={0,0,255})); - connect(PuitsRechauffeurEau.C, PerteChargeCondPompe.C2) annotation (Line(points={{-184,-38},{-100,-38}})); - connect(PerteChargeCondPompe2.C2, Condenseur.Cee) annotation (Line(points={{-148,49},{-133,49},{-133,48.9},{-118,48.9}}, color={0,0,255})); - connect(PerteChargeCondPompe.C1, Condenseur.Cl) annotation (Line(points={{-80,-38},{-57.31,-38},{-57.31,6}})); - connect(PerteChargeCondPompe3.C2, Condenseur.Cv) annotation (Line(points={{-110,159},{-58.5,159},{-58.5,116}}, color={0,0,255})); - connect(PerteChargeCondPompe1.C1, Condenseur.Cse) annotation (Line(points={{30,50},{15.5,50},{15.5,50},{1,50}})); - annotation ( - experiment(StopTime=1000), - Icon(coordinateSystem(preserveAspectRatio=false)), - Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-250,-60},{130,180}}))); +) annotation (experiment(StopTime=1000), Icon(coordinateSystem(preserveAspectRatio=false))); end TestSimpleDynamicCondenser_Traces; From 55c45f516223a20526b53acb55380dcfa41a5a6e Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Tue, 12 May 2026 11:16:24 +0200 Subject: [PATCH 134/178] #125 SimpleEvaporatorWaterSteamFlueGases --- ...TestSimpleEvaporatorWaterSteamFlueGases.mo | 47 +++++++++ ...pleEvaporatorWaterSteamFlueGases_Traces.mo | 48 ++++++++++ .../HeatExchangers/package.order | 2 + .../SimpleEvaporatorWaterSteamFlueGases.mo | 96 ++++++++----------- 4 files changed, 136 insertions(+), 57 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestSimpleEvaporatorWaterSteamFlueGases.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestSimpleEvaporatorWaterSteamFlueGases_Traces.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestSimpleEvaporatorWaterSteamFlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestSimpleEvaporatorWaterSteamFlueGases.mo new file mode 100644 index 00000000..9ba63f1a --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestSimpleEvaporatorWaterSteamFlueGases.mo @@ -0,0 +1,47 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; +model TestSimpleEvaporatorWaterSteamFlueGases + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; + replaceable package Medium_FlueGases = ThermoSysPro.Properties.Media.FlueGases; + + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceWater( + redeclare package Medium = Medium, + Q0=10, + C(P(start=2000000)), + h0=300000, + option_temperature=false) annotation (Placement(transformation(extent={{-80,-10},{-60,10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkSteam( + redeclare package Medium = Medium, + P0=1900000) annotation (Placement(transformation(extent={{60,-10},{80,10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceFlueGases( + redeclare package Medium = Medium_FlueGases, + Q0=50, + C(P(start=300000)), + T0=900, + option_temperature=true, + X0={0.75,0.1,0.1,0.03,0.02}) annotation (Placement(transformation(extent={{-10,70},{10,50}}, rotation=-90, + origin={-60,30}))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkFlueGases( + redeclare package Medium = Medium_FlueGases, + P0=250000) annotation (Placement(transformation(extent={{-10,-70},{10,-50}}, rotation=-90, + origin={60,-30}))); + ThermoSysPro.Fluid.HeatExchangers.SimpleEvaporatorWaterSteamFlueGases evaporator( + redeclare package Medium = Medium, + redeclare package Medium_FlueGases = Medium_FlueGases, + Kdpf=0.02, + Kdpe=0.02, + Cws1(P(start=2000000), h(start=300000)), + Cws2(P(start=1900000), h(start=2800000)), + Cfg1(P(start=300000), h(start=1000000), Xi(start={0.75,0.1,0.1,0.03,0.02})), + Cfg2(P(start=250000), h(start=500000), Xi(start={0.75,0.1,0.1,0.03,0.02}))) annotation (Placement(transformation(extent={{-10,-10},{10,10}}, rotation=0))); +equation + connect(sourceWater.C, evaporator.Cws1) annotation (Line(points={{-60,0},{-10,0}}, color={0,0,255})); + connect(evaporator.Cws2, sinkSteam.C) annotation (Line(points={{10,0},{60,0}}, color={0,0,255})); + connect(sourceFlueGases.C, evaporator.Cfg1) annotation (Line(points={{0,20},{0,9}}, color={0,0,255})); + connect(evaporator.Cfg2, sinkFlueGases.C) annotation (Line(points={{0,-9},{0,-20}}, color={0,0,255})); + annotation ( + experiment(StopTime=1000), + Icon(coordinateSystem(preserveAspectRatio=false)), + Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestSimpleEvaporatorWaterSteamFlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestSimpleEvaporatorWaterSteamFlueGases_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestSimpleEvaporatorWaterSteamFlueGases_Traces.mo new file mode 100644 index 00000000..ce5c9c42 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestSimpleEvaporatorWaterSteamFlueGases_Traces.mo @@ -0,0 +1,48 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; +model TestSimpleEvaporatorWaterSteamFlueGases_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Fluid.Examples.SimpleExamples.Media.WaterSteam_FullyVolatileTrace; + replaceable package Medium_FlueGases = ThermoSysPro.Properties.Media.FlueGases( + extraPropertiesNames={"Trace"}, + C_nominal={0.1}, + C_default={0.2}); + + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceWater( + redeclare package Medium = Medium, + Q0=10, + C(P(start=2000000), SubC(start={0.1})), + h0=300000, + option_temperature=false, + SubC0={0.1}) annotation (Placement(transformation(extent={{-80,-10},{-60,10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkSteam(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{60,-10},{80,10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceFlueGases( + redeclare package Medium = Medium_FlueGases, + Q0=50, + C(P(start=300000), SubC(start={0.3})), + T0=900, + option_temperature=true, + X0={0.75,0.1,0.1,0.03,0.02}, + SubC0={0.3}) annotation (Placement(transformation(extent={{-10,70},{10,50}}, rotation=-90, + origin={-60,30}))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkFlueGases(redeclare package Medium = Medium_FlueGases) annotation (Placement(transformation(extent={{-10,-70},{10,-50}}, rotation=-90, + origin={60,-30}))); + ThermoSysPro.Fluid.HeatExchangers.SimpleEvaporatorWaterSteamFlueGases evaporator( + redeclare package Medium = Medium, + redeclare package Medium_FlueGases = Medium_FlueGases, + Kdpf=0.02, + Kdpe=0.02, + Cws1(P(start=2000000), h(start=300000), SubC(start={0.1})), + Cws2(P(start=1900000), h(start=2800000), SubC(start={0.1})), + Cfg1(P(start=300000), h(start=1000000), Xi(start={0.75,0.1,0.1,0.03,0.02}), SubC(start={0.3})), + Cfg2(P(start=250000), h(start=500000), Xi(start={0.75,0.1,0.1,0.03,0.02}), SubC(start={0.3}))) annotation (Placement(transformation(extent={{-10,-10},{10,10}}, rotation=0))); +equation + connect(sourceWater.C, evaporator.Cws1) annotation (Line(points={{-60,0},{-10,0}}, color={0,0,255})); + connect(evaporator.Cws2, sinkSteam.C) annotation (Line(points={{10,0},{60,0}}, color={0,0,255})); + connect(sourceFlueGases.C, evaporator.Cfg1) annotation (Line(points={{0,20},{0,9}}, color={0,0,255})); + connect(evaporator.Cfg2, sinkFlueGases.C) annotation (Line(points={{0,-9},{0,-20}}, color={0,0,255})); + annotation ( + experiment(StopTime=1000), + Icon(coordinateSystem(preserveAspectRatio=false)), + Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestSimpleEvaporatorWaterSteamFlueGases_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order index 5fedf48f..87d02d37 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order @@ -25,6 +25,8 @@ TestNTUWaterHeater_Traces TestNTUWaterHeater_FlueGases TestSimpleDynamicCondenser TestSimpleDynamicCondenser_Traces +TestSimpleEvaporatorWaterSteamFlueGases +TestSimpleEvaporatorWaterSteamFlueGases_Traces TestSimpleStaticCondenser TestSimpleStaticCondenser_Traces TestStaticCondenser diff --git a/ThermoSysPro/Fluid/HeatExchangers/SimpleEvaporatorWaterSteamFlueGases.mo b/ThermoSysPro/Fluid/HeatExchangers/SimpleEvaporatorWaterSteamFlueGases.mo index 12091190..01274522 100644 --- a/ThermoSysPro/Fluid/HeatExchangers/SimpleEvaporatorWaterSteamFlueGases.mo +++ b/ThermoSysPro/Fluid/HeatExchangers/SimpleEvaporatorWaterSteamFlueGases.mo @@ -1,8 +1,9 @@ within ThermoSysPro.Fluid.HeatExchangers; model SimpleEvaporatorWaterSteamFlueGases "Simple water/steam - flue gases evaporator" extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialTwoPhaseThermoSysProMedium "Medium model for the water/steam side" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable package Medium_FlueGases = ThermoSysPro.Properties.Media.FlueGases constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model for the flue gases side" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Real Kdpf=10 "Flue gases pressure drop coefficient"; parameter Real Kdpe=10 "Water/steam pressure drop coefficient"; @@ -10,10 +11,8 @@ model SimpleEvaporatorWaterSteamFlueGases "Simple water/steam - flue gases evapo "Diffusion conductance for the water/steam side (active if diffusion=true in neighbouring volumes)"; parameter Units.SI.MassFlowRate gamma_diff_fg=1e-4 "Diffusion conductance for the flue gases side (active if diffusion=true in neighbouring volumes)"; - parameter IF97Region region=IF97Region.All_regions "IF97 region for the water/steam side (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); protected - parameter Integer mode=Integer(region) - 1 "IF97 region for the water/steam side. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; parameter Real eps=1.e-0 "Small number for pressure loss equation"; public @@ -39,37 +38,26 @@ public Units.SI.Density rhof(start=0.9) "Flue gases density"; Units.SI.Density rhoe(start=700) "Water density"; Units.SI.Power W(start=1e8) "Power exchanged"; - FluidType ftype_ws "Fluid type for the water/steam side"; - Integer fluid_ws=Integer(ftype_ws) "Fluid number for the water/steam side"; - FluidType ftype_fg "Fluid type for the flue gases side"; - Integer fluid_fg=Integer(ftype_fg) "Fluid number for the flue gases side"; - - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cws2 annotation ( + Medium.MassFraction Xws[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Water/steam mass fractions"; + Medium_FlueGases.MassFraction Xfg[Medium_FlueGases.nXi](start=Medium_FlueGases.X_default[1:Medium_FlueGases.nXi]) "Flue gases mass fractions"; + Medium.ExtraProperty SubCws[Medium.nC](quantity=Medium.extraPropertiesNames, start=Medium.C_default) "Water/steam trace substances"; + Medium_FlueGases.ExtraProperty SubCfg[Medium_FlueGases.nC](quantity=Medium_FlueGases.extraPropertiesNames, start=Medium_FlueGases.C_default) "Flue gases trace substances"; + Medium.ThermodynamicState state_ws_in "Water/steam inlet thermodynamic state"; + Medium.ThermodynamicState state_ws_out "Water/steam outlet thermodynamic state"; + Medium.ThermodynamicState state_ws_m "Water/steam average thermodynamic state"; + Medium.SaturationProperties sat_ws "Water/steam saturation properties at the outlet pressure"; + Medium_FlueGases.ThermodynamicState state_fg_in "Flue gases inlet thermodynamic state"; + Medium_FlueGases.ThermodynamicState state_fg_out "Flue gases outlet thermodynamic state"; + + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cws2(redeclare package Medium = Medium) annotation ( Placement(transformation(extent={{90,-10},{110,10}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Cws1 annotation ( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Cws1(redeclare package Medium = Medium) annotation ( Placement(transformation(extent={{-110,-10},{-90,10}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Cfg1 annotation ( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Cfg1(redeclare package Medium = Medium_FlueGases) annotation ( Placement(transformation(extent={{-10,80},{10,100}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cfg2 annotation ( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cfg2(redeclare package Medium = Medium_FlueGases) annotation ( Placement(transformation(extent={{-10,-100},{10,-80}}, rotation=0))); - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph proee - annotation (Placement(transformation(extent={{-100,80},{-80,100}}, rotation= - 0))); - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph proes - annotation (Placement(transformation(extent={{-52,80},{-32,100}}, rotation= - 0))); - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph proem - annotation (Placement(transformation(extent={{-76,80},{-56,100}}, rotation= - 0))); - ThermoSysPro.Properties.WaterSteam.Common.PropThermoSat vsat - annotation (Placement(transformation( - extent={{80,80},{100,100}}, rotation=0))); - ThermoSysPro.Properties.WaterSteam.Common.PropThermoSat lsat - annotation (Placement(transformation(extent={{58,80},{78,100}}, rotation=0))); equation - /* Check that the fluid type for the water/steam side is water/steam */ - assert((ftype_ws == FluidType.WaterSteam) or (ftype_ws == FluidType.WaterSteamSimple), "SimpleEvaporatorWaterSteamFlueGases: the fluid type must be water/steam for the water/steam side"); - /* Flue gases inlet */ Pef = Cfg1.P; Hef = Cfg1.h; @@ -89,14 +77,10 @@ equation Cfg2.diff_res_1 = Cfg1.diff_res_1 + 1/gamma_diff_fg; Cfg1.diff_res_2 = Cfg2.diff_res_2 + 1/gamma_diff_fg; - Cfg1.ftype = Cfg2.ftype; - - Cfg2.Xco2 = Cfg1.Xco2; - Cfg2.Xh2o = Cfg1.Xh2o; - Cfg2.Xo2 = Cfg1.Xo2; - Cfg2.Xso2 = Cfg1.Xso2; - - ftype_fg = Cfg1.ftype; + Cfg1.Xi = Cfg2.Xi; + Xfg = Cfg1.Xi; + Cfg1.SubC = Cfg2.SubC; + SubCfg = Cfg1.SubC; /* Water inlet */ Pee = Cws1.P; @@ -117,14 +101,10 @@ equation Cws2.diff_res_1 = Cws1.diff_res_1 + 1/gamma_diff_ws; Cws1.diff_res_2 = Cws2.diff_res_2 + 1/gamma_diff_ws; - Cws1.ftype = Cws2.ftype; - - Cws2.Xco2 = Cws1.Xco2; - Cws2.Xh2o = Cws1.Xh2o; - Cws2.Xo2 = Cws1.Xo2; - Cws2.Xso2 = Cws1.Xso2; - - ftype_ws = Cws1.ftype; + Cws1.Xi = Cws2.Xi; + Xws = Cws1.Xi; + Cws1.SubC = Cws2.SubC; + SubCws = Cws1.SubC; /* Pressure losses */ Pef = Psf + Kdpf*ThermoSysPro.Functions.ThermoSquare(Qf, eps)/rhof; @@ -135,26 +115,28 @@ equation W = Qe*(Hse - Hee); /* Flue gases specific enthalpy at the inlet */ - Tef = ThermoSysPro.Properties.Fluid.Temperature_Ph(Pef, Hef, fluid_fg, 0, Cfg1.Xco2, Cfg1.Xh2o, Cfg1.Xo2, Cfg1.Xso2); + state_fg_in = Medium_FlueGases.setState_phX(p=Pef, h=Hef, X=Xfg); + Tef = Medium_FlueGases.temperature(state_fg_in); /* Flue gases specific enthalpy at the outlet */ - Tsf = ThermoSysPro.Properties.Fluid.Temperature_Ph(Psf, Hsf, fluid_fg, 0, Cfg1.Xco2, Cfg1.Xh2o, Cfg1.Xo2, Cfg1.Xso2); + state_fg_out = Medium_FlueGases.setState_phX(p=Psf, h=Hsf, X=Xfg); + Tsf = Medium_FlueGases.temperature(state_fg_out); /* Flue gases density */ - rhof = ThermoSysPro.Properties.Fluid.Density_Ph(Pef, Hef, fluid_fg, 0, Cfg1.Xco2, Cfg1.Xh2o, Cfg1.Xo2, Cfg1.Xso2); + rhof = Medium_FlueGases.density(state_fg_in); /* Water/steam thermodynamic properties */ - proee = ThermoSysPro.Properties.Fluid.Ph(Pee, Hee, mode, fluid_ws); - Tee = proee.T; + state_ws_in = Medium.setState_phX(p=Pee, h=Hee, X=Xws); + Tee = Medium.temperature(state_ws_in); - proem = ThermoSysPro.Properties.Fluid.Ph((Pee + Pse)/2, (Hee + Hse)/2, mode, fluid_ws); - rhoe = proem.d; + state_ws_m = Medium.setState_phX(p=(Pee + Pse)/2, h=(Hee + Hse)/2, X=Xws); + rhoe = Medium.density(state_ws_m); - proes = ThermoSysPro.Properties.Fluid.Ph(Pse, Hse, mode, fluid_ws); - Tse = proes.T; + state_ws_out = Medium.setState_phX(p=Pse, h=Hse, X=Xws); + Tse = Medium.temperature(state_ws_out); - (lsat,vsat) = ThermoSysPro.Properties.Fluid.Water_sat_P(Pse, fluid_ws); - Hse = vsat.h; + sat_ws = Medium.setSat_p(Pse); + Hse = Medium.dewEnthalpy(sat_ws); annotation (Diagram(graphics={ Rectangle( From 2796e7fcd2649ffe843d4eb0b30c79b13b7190ba Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Tue, 12 May 2026 11:38:47 +0200 Subject: [PATCH 135/178] #125 DynamicTwoPhaseFlowPipe --- .../TestDynamicTwoPhaseFlowPipe.mo | 43 +++++ .../TestDynamicTwoPhaseFlowPipe_Traces.mo | 46 +++++ .../HeatExchangers/package.order | 2 + .../HeatExchangers/DynamicTwoPhaseFlowPipe.mo | 162 +++++++----------- 4 files changed, 155 insertions(+), 98 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicTwoPhaseFlowPipe.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicTwoPhaseFlowPipe_Traces.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicTwoPhaseFlowPipe.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicTwoPhaseFlowPipe.mo new file mode 100644 index 00000000..9a62daa1 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicTwoPhaseFlowPipe.mo @@ -0,0 +1,43 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; +model TestDynamicTwoPhaseFlowPipe + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; + + ThermoSysPro.Fluid.HeatExchangers.DynamicTwoPhaseFlowPipe dynamicTwoPhaseFlowPipe( + redeclare package Medium = Medium, + L=10, + D=0.03, + dpfCorr(fixed=false, start=0.2396333653343408)=1, + P(start={2000000,1999571.7070274,1999140.9402168,1998707.6248919,1998271.6837223,1997833.0364983,1997391.5998908,1996715.822109,1995640.0182728,1994163.0145856,1992283.4952231,1990000})) + annotation (Placement(transformation(extent={{-40,-48},{40,10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP( + redeclare package Medium = Medium, + C(Q(start=1)), + option_temperature=false, + h0=800e3, + P0=2000000) annotation (Placement(transformation(extent={{-90,-28},{-70,-8}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP( + redeclare package Medium = Medium, + option_temperature=false, + h0=2000e3, + P0=19.9e5) annotation (Placement(transformation(extent={{70,-28},{90,-8}}, rotation=0))); + ThermoSysPro.Thermal.BoundaryConditions.HeatSource heatSource( + option_temperature=2, + T0={1000,1100,1200,1300,1400,1500,1600,1700,1800,1900}, + W0={2e4,2e4,2e4,2e4,2e4,2e4,2e4,2e4,2e4,2e4}) annotation (Placement(transformation(extent={{-10,31},{10,51}}, rotation=0))); + ThermoSysPro.Thermal.HeatTransfer.HeatExchangerWall heatExchangerWall( + Ns=10, + L=10, + lambda=10, + cpw=460, + rhow=7900, + e=0.005, + D=0.03) annotation (Placement(transformation(extent={{-40,-28},{40,52}}, rotation=0))); +equation + connect(sourceP.C, dynamicTwoPhaseFlowPipe.C1) annotation (Line(points={{-70,-18},{-42,-18},{-42,-19},{-40,-19}}, color={0,0,255})); + connect(dynamicTwoPhaseFlowPipe.C2, sinkP.C) annotation (Line(points={{40,-19},{70,-18}}, color={0,0,255})); + connect(heatSource.C, heatExchangerWall.WT2) annotation (Line(points={{0,31.2},{0,20}}, color={191,95,0})); + connect(heatExchangerWall.WT1, dynamicTwoPhaseFlowPipe.CTh) annotation (Line(points={{0,4},{0,-10.3}}, color={191,95,0})); + annotation (experiment(StopTime=1500), Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestDynamicTwoPhaseFlowPipe; \ No newline at end of file diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicTwoPhaseFlowPipe_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicTwoPhaseFlowPipe_Traces.mo new file mode 100644 index 00000000..1fdfc005 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicTwoPhaseFlowPipe_Traces.mo @@ -0,0 +1,46 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; +model TestDynamicTwoPhaseFlowPipe_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Fluid.Examples.SimpleExamples.Media.WaterSteam_FullyVolatileTrace; + + ThermoSysPro.Fluid.HeatExchangers.DynamicTwoPhaseFlowPipe dynamicTwoPhaseFlowPipe( + redeclare package Medium = Medium, + L=10, + D=0.03, + C1(SubC(start={0.1})), + C2(SubC(start={0.1})), + dpfCorr(fixed=false, start=0.2396333653343408)=1, + P(start={2000000,1999571.7070274,1999140.9402168,1998707.6248919,1998271.6837223,1997833.0364983,1997391.5998908,1996715.822109,1995640.0182728,1994163.0145856,1992283.4952231,1990000})) + annotation (Placement(transformation(extent={{-40,-48},{40,10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP( + redeclare package Medium = Medium, + C(Q(start=1), SubC(start={0.1})), + option_temperature=false, + h0=800e3, + P0=2000000, + SubC0={0.1}) annotation (Placement(transformation(extent={{-90,-28},{-70,-8}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP( + redeclare package Medium = Medium, + option_temperature=false, + h0=2000e3, + P0=19.9e5) annotation (Placement(transformation(extent={{70,-28},{90,-8}}, rotation=0))); + ThermoSysPro.Thermal.BoundaryConditions.HeatSource heatSource( + option_temperature=2, + T0={1000,1100,1200,1300,1400,1500,1600,1700,1800,1900}, + W0={2e4,2e4,2e4,2e4,2e4,2e4,2e4,2e4,2e4,2e4}) annotation (Placement(transformation(extent={{-10,31},{10,51}}, rotation=0))); + ThermoSysPro.Thermal.HeatTransfer.HeatExchangerWall heatExchangerWall( + Ns=10, + L=10, + lambda=10, + cpw=460, + rhow=7900, + e=0.005, + D=0.03) annotation (Placement(transformation(extent={{-40,-28},{40,52}}, rotation=0))); +equation + connect(sourceP.C, dynamicTwoPhaseFlowPipe.C1) annotation (Line(points={{-70,-18},{-42,-18},{-42,-19},{-40,-19}}, color={0,0,255})); + connect(dynamicTwoPhaseFlowPipe.C2, sinkP.C) annotation (Line(points={{40,-19},{70,-18}}, color={0,0,255})); + connect(heatSource.C, heatExchangerWall.WT2) annotation (Line(points={{0,31.2},{0,20}}, color={191,95,0})); + connect(heatExchangerWall.WT1, dynamicTwoPhaseFlowPipe.CTh) annotation (Line(points={{0,4},{0,-10.3}}, color={191,95,0})); + annotation (experiment(StopTime=1500), Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestDynamicTwoPhaseFlowPipe_Traces; \ No newline at end of file diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order index 87d02d37..2f5576ca 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order @@ -1,6 +1,8 @@ TestDynamicOnePhaseFlowPipe TestDynamicOnePhaseFlowPipe_Traces TestDynamicOnePhaseFlowPipe_FlueGases +TestDynamicTwoPhaseFlowPipe +TestDynamicTwoPhaseFlowPipe_Traces TestDynamicOnePhaseFlowShell TestDynamicOnePhaseFlowShell_Traces TestDynamicOnePhaseFlowShell_FlueGases diff --git a/ThermoSysPro/Fluid/HeatExchangers/DynamicTwoPhaseFlowPipe.mo b/ThermoSysPro/Fluid/HeatExchangers/DynamicTwoPhaseFlowPipe.mo index 796c3ef6..6b445671 100644 --- a/ThermoSysPro/Fluid/HeatExchangers/DynamicTwoPhaseFlowPipe.mo +++ b/ThermoSysPro/Fluid/HeatExchangers/DynamicTwoPhaseFlowPipe.mo @@ -1,8 +1,8 @@ within ThermoSysPro.Fluid.HeatExchangers; model DynamicTwoPhaseFlowPipe "Dynamic two-phase flow pipe" extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Units.SI.Length L=10. "Pipe length"; parameter Units.SI.Diameter D=0.2 "Internal pipe diameter"; @@ -41,12 +41,10 @@ model DynamicTwoPhaseFlowPipe "Dynamic two-phase flow pipe" "true: continuous flow reversal - false: discontinuous flow reversal"; parameter Boolean diffusion=false "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; - parameter IF97Region region=IF97Region.All_regions "IF97 region (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); protected constant Units.SI.Acceleration g=Modelica.Constants.g_n "Gravity constant"; constant Real pi=Modelica.Constants.pi "pi"; - parameter Integer mode=Integer(region) - 1 "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; parameter Integer N=Ns + 1 "Number of hydraulic nodes (= number of thermal nodes + 1)"; parameter Units.SI.Area A=ntubes*pi*D^2/4 @@ -57,12 +55,9 @@ protected parameter Units.SI.Area dSi=pi*Di*dx1 "Internal heat exchange area for a node"; parameter Real Mmol=18.015 "Water molar mass"; - parameter Units.SI.AbsolutePressure pcrit=ThermoSysPro.Properties.WaterSteam.BaseIF97.data.PCRIT - "Critical pressure"; - parameter Units.SI.Temperature Tcrit=ThermoSysPro.Properties.WaterSteam.BaseIF97.data.TCRIT - "Critical temperature"; - parameter Units.SI.AbsolutePressure ptriple=ThermoSysPro.Properties.WaterSteam.BaseIF97.triple.ptriple - "Triple point pressure"; + parameter Units.SI.AbsolutePressure pcrit=Medium.fluidConstants[1].criticalPressure "Critical pressure"; + parameter Units.SI.Temperature Tcrit=Medium.fluidConstants[1].criticalTemperature "Critical temperature"; + parameter Units.SI.AbsolutePressure ptriple=Medium.fluidConstants[1].triplePointPressure "Triple point pressure"; parameter Real xb1=0.0002 "Min value for vapor mass fraction"; parameter Real xb2=0.85 "Max value for vapor mass fraction"; parameter Units.SI.MassFlowRate gamma0=1.e-4 @@ -183,12 +178,14 @@ public Real lambdav[N](start=fill(0.03, N), nominal=fill(0.03, N)) "Friction pressure loss coefficient in node i for the vapor)"; Real filo[N] "Pressure loss coefficient for two-phase flow"; - FluidType ftype "Fluid type"; - Integer fluid=Integer(ftype) "Fluid number"; - ThermoSysPro.Units.SI.MassFraction Xco2 "CO2 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xh2o "H2O mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xo2 "O2 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xso2 "SO2 mass fraction"; + Units.SI.DerDensityByPressure ddph[N - 1] "Density derivative wrt. pressure"; + Units.SI.DerDensityByEnthalpy ddhp[N - 1] "Density derivative wrt. enthalpy"; + Medium.ThermodynamicState state1[N - 1]; + Medium.ThermodynamicState state2[N]; + Medium.ThermodynamicState state_c[2]; + Medium.SaturationProperties sat1[N - 1]; + Medium.SaturationProperties sat2[N]; + Medium.MassFraction X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Mass fractions"; Real diff_res_l[N] "Diffusion resistance in hydraulic node i for the liquid"; Real diff_res_v[N] "Diffusion resistance in hydraulic node i for the vapor"; Real diff_res[N] "Total diffusion resistance in hydraulic node i"; @@ -209,32 +206,12 @@ public Real re[N - 1] "Value of r(Q/gamma) for inlet of thermal node i"; Real rs[N - 1] "Value of r(Q/gamma) for outlet of thermal node i"; - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro1[N - 1] - annotation (Placement(transformation(extent={{-100,80},{-80,100}}, rotation= - 0))); - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph proc[2] - annotation (Placement(transformation(extent={{-20,80},{0,100}}, rotation=0))); - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro2[N] - annotation (Placement(transformation(extent={{-60,80},{-40,100}}, rotation= - 0))); - ThermoSysPro.Properties.WaterSteam.Common.PropThermoSat vsat2[N] - annotation (Placement(transformation(extent={{80,-100},{100,-80}}, rotation= - 0))); - ThermoSysPro.Properties.WaterSteam.Common.PropThermoSat lsat2[N] - annotation (Placement(transformation(extent={{40,-100},{60,-80}}, rotation= - 0))); - ThermoSysPro.Properties.WaterSteam.Common.PropThermoSat vsat1[N - 1] - annotation (Placement(transformation(extent={{-60,-100},{-40,-80}}, - rotation=0))); - ThermoSysPro.Properties.WaterSteam.Common.PropThermoSat lsat1[N - 1] - annotation (Placement(transformation(extent={{-100,-100},{-80,-80}}, - rotation=0))); public - Interfaces.Connectors.FluidInlet C1 annotation (Placement(transformation( + Interfaces.Connectors.FluidInlet C1(redeclare package Medium = Medium) annotation (Placement(transformation( extent={{-110,-10},{-90,10}}, rotation=0))); ThermoSysPro.Thermal.Connectors.ThermalPort CTh[Ns] annotation (Placement(transformation(extent={{-10,20},{10,40}}, rotation=0))); - Interfaces.Connectors.FluidOutlet C2 annotation (Placement(transformation( + Interfaces.Connectors.FluidOutlet C2(redeclare package Medium = Medium) annotation (Placement(transformation( extent={{90,-10},{110,10}}, rotation=0))); initial equation if dynamic_energy_balance then @@ -245,7 +222,7 @@ initial equation else if option_temperature then for i in 2:N loop - h[i] = ThermoSysPro.Properties.Fluid.SpecificEnthalpy_PT(Pb[i], T0[i - 1], fluid, mode, Xco2, Xh2o, Xo2, Xso2); + h[i] = Medium.specificEnthalpy_pTX(Pb[i], T0[i - 1], X); end for; else for i in 2:N loop @@ -269,9 +246,6 @@ initial equation equation - /* Check that the fluid type is water/steam */ - assert((ftype == FluidType.WaterSteam) or (ftype == FluidType.WaterSteamSimple), "DynamicTwoPhaseFlowPipe: the fluid type must be water/steam"); - /* Wall temperature */ Tp1 = CTh.T; CTh.W = dW1; @@ -301,19 +275,9 @@ equation C2.diff_res_1 = C1.diff_res_1 + diff_res_t; C1.diff_res_2 = C2.diff_res_2 + diff_res_t; - C1.ftype = C2.ftype; - - C1.Xco2 = C2.Xco2; - C1.Xh2o = C2.Xh2o; - C1.Xo2 = C2.Xo2; - C1.Xso2 = C2.Xso2; - - ftype = C1.ftype; - - Xco2 = C1.Xco2; - Xh2o = C1.Xh2o; - Xo2 = C1.Xo2; - Xso2 = C1.Xso2; + C1.Xi = C2.Xi; + X = C1.Xi; + C1.SubC = C2.SubC; /* Mass and energy balance equations (thermal nodes) */ for i in 1:N - 1 loop @@ -321,7 +285,7 @@ equation BQ[i] = Q[i] - Q[i + 1]; if dynamic_energy_balance and dynamic_mass_balance then - A*(pro1[i].ddph*der(P[i + 1]) + pro1[i].ddhp*der(h[i + 1]))*dx1 = BQ[i]; + A*(ddph[i]*der(P[i + 1]) + ddhp[i]*der(h[i + 1]))*dx1 = BQ[i]; else 0 = BQ[i]; end if; @@ -334,7 +298,7 @@ equation if simplified_dynamic_energy_balance then A*(-der(P[i + 1]) + rho1[i]*der(h[i + 1]))*dx1 = BH[i]; else - A*((h[i + 1]*pro1[i].ddph - 1)*der(P[i + 1]) + (h[i + 1]*pro1[i].ddhp + rho1[i])*der(h[i + 1]))*dx1 = BH[i]; + A*((h[i + 1]*ddph[i] - 1)*der(P[i + 1]) + (h[i + 1]*ddhp[i] + rho1[i])*der(h[i + 1]))*dx1 = BH[i]; end if; else A*rho1[i]*der(h[i + 1])*dx1 = BH[i]; @@ -421,37 +385,39 @@ equation end if; /* Fluid thermodynamic properties */ - pro1[i] = ThermoSysPro.Properties.Fluid.Ph(P[i + 1], h[i + 1], mode, fluid); + state1[i] = Medium.setState_phX(P[i + 1], h[i + 1], X); - rho1[i] = pro1[i].d; - T1[i] = pro1[i].T; - xv1[i] = if noEvent((P[i+1] > pcrit) or (T1[i] > Tcrit)) then 1 else pro1[i].x; + rho1[i] = Medium.density(state1[i]); + T1[i] = Medium.temperature(state1[i]); + xv1[i] = if noEvent((P[i+1] > pcrit) or (T1[i] > Tcrit)) then 1 else Medium.vapourQuality(state1[i]); + ddph[i] = Medium.density_derp_h(state1[i]); + ddhp[i] = Medium.density_derh_p(state1[i]); - (lsat1[i],vsat1[i]) = ThermoSysPro.Properties.Fluid.Water_sat_P(P[i + 1], fluid); + sat1[i] = Medium.setSat_p(P[i + 1]); if noEvent((P[i+1] > pcrit) or (T1[i] > Tcrit)) then xbs[i] = 0; xbi[i] = 1; - rhol1[i] = pro1[i].d; - rhov1[i] = pro1[i].d; - cpl1[i] = pro1[i].cp; - cpv1[i] = pro1[i].cp; + rhol1[i] = rho1[i]; + rhov1[i] = rho1[i]; + cpl1[i] = Medium.specificHeatCapacityCp(state1[i]); + cpv1[i] = Medium.specificHeatCapacityCp(state1[i]); lv[i] = 1; else - xbs[i] = min(pro1[i].x, 0.90); - xbi[i] = max(pro1[i].x, 0.10); - rhol1[i] = max(pro1[i].d, lsat1[i].rho); - rhov1[i] = min(pro1[i].d, vsat1[i].rho); - cpl1[i] = if noEvent(xv1[i] <= 0.0) then pro1[i].cp else lsat1[i].cp; - cpv1[i] = if noEvent(xv1[i] >= 1.0) then pro1[i].cp else vsat1[i].cp; - lv[i] = vsat1[i].h - lsat1[i].h; + xbs[i] = min(xv1[i], 0.90); + xbi[i] = max(xv1[i], 0.10); + rhol1[i] = max(rho1[i], Medium.bubbleDensity(sat1[i])); + rhov1[i] = min(rho1[i], Medium.dewDensity(sat1[i])); + cpl1[i] = if noEvent(xv1[i] <= 0.0) then Medium.specificHeatCapacityCp(state1[i]) else Medium.specificHeatCapacityCp(Medium.setBubbleState(sat1[i])); + cpv1[i] = if noEvent(xv1[i] >= 1.0) then Medium.specificHeatCapacityCp(state1[i]) else Medium.specificHeatCapacityCp(Medium.setDewState(sat1[i])); + lv[i] = Medium.dewEnthalpy(sat1[i]) - Medium.bubbleEnthalpy(sat1[i]); end if; - mul1[i] = ThermoSysPro.Properties.Fluid.DynamicViscosity_rhoT(rhol1[i], T1[i], fluid); - muv1[i] = ThermoSysPro.Properties.Fluid.DynamicViscosity_rhoT(rhov1[i], T1[i], fluid); + mul1[i] = Medium.dynamicViscosity(Medium.setBubbleState(sat1[i])); + muv1[i] = Medium.dynamicViscosity(Medium.setDewState(sat1[i])); - kl1[i] = ThermoSysPro.Properties.Fluid.ThermalConductivity_rhoT(rhol1[i], T1[i], P[i + 1], mode, fluid); - kv1[i] = ThermoSysPro.Properties.Fluid.ThermalConductivity_rhoT(rhov1[i], T1[i], P[i + 1], mode, fluid); + kl1[i] = Medium.thermalConductivity(Medium.setBubbleState(sat1[i])); + kv1[i] = Medium.thermalConductivity(Medium.setDewState(sat1[i])); Pb[i + 1] = max(min(P[i + 1], pcrit - 1), ptriple); end for; @@ -506,31 +472,31 @@ equation gamma[i] = if diffusion then 1/diff_res[i] else gamma0; /* Fluid thermodynamic properties */ - pro2[i] = ThermoSysPro.Properties.Fluid.Ph((P[i] + P[i + 1])/2, hb[i], mode, fluid); + state2[i] = Medium.setState_phX((P[i] + P[i + 1])/2, hb[i], X); - rho2[i] = pro2[i].d; - xv2[i] = if noEvent(((P[i] + P[i + 1])/2 > pcrit) or (T2[i] > Tcrit)) then 1 else pro2[i].x; - T2[i] = pro2[i].T; + rho2[i] = Medium.density(state2[i]); + xv2[i] = if noEvent(((P[i] + P[i + 1])/2 > pcrit) or (T2[i] > Tcrit)) then 1 else Medium.vapourQuality(state2[i]); + T2[i] = Medium.temperature(state2[i]); - (lsat2[i],vsat2[i]) = ThermoSysPro.Properties.Fluid.Water_sat_P((P[i] + P[i + 1])/2, fluid); + sat2[i] = Medium.setSat_p((P[i] + P[i + 1])/2); if noEvent((P[i+1] > pcrit) or (T2[i] > Tcrit)) then - rhol2[i] = pro2[i].d; - rhov2[i] = pro2[i].d; - cpl2[i] = pro2[i].cp; - cpv2[i] = pro2[i].cp; + rhol2[i] = rho2[i]; + rhov2[i] = rho2[i]; + cpl2[i] = Medium.specificHeatCapacityCp(state2[i]); + cpv2[i] = Medium.specificHeatCapacityCp(state2[i]); else - rhol2[i] = max(pro2[i].d, lsat2[i].rho); - rhov2[i] = min(pro2[i].d, vsat2[i].rho); - cpl2[i] = if noEvent(xv2[i] <= 0.0) then pro2[i].cp else lsat2[i].cp; - cpv2[i] = if noEvent(xv2[i] >= 1.0) then pro2[i].cp else vsat2[i].cp; + rhol2[i] = max(rho2[i], Medium.bubbleDensity(sat2[i])); + rhov2[i] = min(rho2[i], Medium.dewDensity(sat2[i])); + cpl2[i] = if noEvent(xv2[i] <= 0.0) then Medium.specificHeatCapacityCp(state2[i]) else Medium.specificHeatCapacityCp(Medium.setBubbleState(sat2[i])); + cpv2[i] = if noEvent(xv2[i] >= 1.0) then Medium.specificHeatCapacityCp(state2[i]) else Medium.specificHeatCapacityCp(Medium.setDewState(sat2[i])); end if; - mul2[i] = ThermoSysPro.Properties.Fluid.DynamicViscosity_rhoT(rhol2[i], T2[i], fluid); - muv2[i] = ThermoSysPro.Properties.Fluid.DynamicViscosity_rhoT(rhov2[i], T2[i], fluid); + mul2[i] = Medium.dynamicViscosity(Medium.setBubbleState(sat2[i])); + muv2[i] = Medium.dynamicViscosity(Medium.setDewState(sat2[i])); - kl2[i] = ThermoSysPro.Properties.Fluid.ThermalConductivity_rhoT(rhol2[i], T2[i], (P[i] + P[i + 1])/2, mode, fluid); - kv2[i] = ThermoSysPro.Properties.Fluid.ThermalConductivity_rhoT(rhov2[i], T2[i], (P[i] + P[i + 1])/2, mode, fluid); + kl2[i] = Medium.thermalConductivity(Medium.setBubbleState(sat2[i])); + kv2[i] = Medium.thermalConductivity(Medium.setDewState(sat2[i])); end for; /* Fluid densities at the boundaries of the nodes */ @@ -538,11 +504,11 @@ equation rhoc[i] = rho1[i - 1]; end for; - proc[1] = ThermoSysPro.Properties.Fluid.Ph(P[1], h[1], mode, fluid); - proc[2] = ThermoSysPro.Properties.Fluid.Ph(P[N + 1], h[N + 1], mode, fluid); + state_c[1] = Medium.setState_phX(P[1], h[1], X); + state_c[2] = Medium.setState_phX(P[N + 1], h[N + 1], X); - rhoc[1] = proc[1].d; - rhoc[N + 1] = proc[2].d; + rhoc[1] = Medium.density(state_c[1]); + rhoc[N + 1] = Medium.density(state_c[2]); W1t = sum(dW1); From bdcb80a0ffa3fcb921e44d9686822cd7d6d743f3 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Tue, 12 May 2026 14:02:18 +0200 Subject: [PATCH 136/178] #125 DynamicTwoPhaseFlowRiser --- .../TestDynamicTwoPhaseFlowRiser.mo | 41 +++++ .../TestDynamicTwoPhaseFlowRiser_Traces.mo | 44 +++++ .../HeatExchangers/package.order | 2 + .../DynamicTwoPhaseFlowRiser.mo | 154 +++++++----------- 4 files changed, 147 insertions(+), 94 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicTwoPhaseFlowRiser.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicTwoPhaseFlowRiser_Traces.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicTwoPhaseFlowRiser.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicTwoPhaseFlowRiser.mo new file mode 100644 index 00000000..b3e20adc --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicTwoPhaseFlowRiser.mo @@ -0,0 +1,41 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; +model TestDynamicTwoPhaseFlowRiser + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; + + ThermoSysPro.Fluid.HeatExchangers.DynamicTwoPhaseFlowRiser dynamicTwoPhaseFlowRiser( + redeclare package Medium = Medium, + L=10, + D=0.03, + inertia=false, + Ns=1, + steady_state=false, + option_temperature=false, + h0={800e3}) annotation (Placement(transformation(extent={{-40,-48},{40,10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP( + redeclare package Medium = Medium, + C(Q(start=1)), + option_temperature=false, + h0=800e3, + P0=2000000) annotation (Placement(transformation(extent={{-90,-28},{-70,-8}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP( + redeclare package Medium = Medium, + option_temperature=false, + h0=2000e3, + P0=19.9e5) annotation (Placement(transformation(extent={{70,-28},{90,-8}}, rotation=0))); + ThermoSysPro.Thermal.BoundaryConditions.HeatSource heatSource1( + option_temperature=2, + T0={1000}, + W0={2e4}) annotation (Placement(transformation(extent={{-10,31},{10,51}}, rotation=0))); + ThermoSysPro.Thermal.BoundaryConditions.HeatSource heatSource2( + option_temperature=2, + T0={1000}, + W0={2e4}) annotation (Placement(transformation(extent={{-10,-70},{10,-50}}, rotation=0))); +equation + connect(sourceP.C, dynamicTwoPhaseFlowRiser.C1) annotation (Line(points={{-70,-18},{-42,-18},{-42,-19},{-40,-19}}, color={0,0,255})); + connect(dynamicTwoPhaseFlowRiser.C2, sinkP.C) annotation (Line(points={{40,-19},{70,-18}}, color={0,0,255})); + connect(heatSource1.C, dynamicTwoPhaseFlowRiser.CTh1) annotation (Line(points={{0,31.2},{0,-7.7}}, color={191,95,0})); + connect(heatSource2.C, dynamicTwoPhaseFlowRiser.CTh2) annotation (Line(points={{0,-50},{0,-33.5}}, color={191,95,0})); + annotation (experiment(StopTime=1000), Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestDynamicTwoPhaseFlowRiser; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicTwoPhaseFlowRiser_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicTwoPhaseFlowRiser_Traces.mo new file mode 100644 index 00000000..777fc36f --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicTwoPhaseFlowRiser_Traces.mo @@ -0,0 +1,44 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; +model TestDynamicTwoPhaseFlowRiser_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Fluid.Examples.SimpleExamples.Media.WaterSteam_FullyVolatileTrace; + + ThermoSysPro.Fluid.HeatExchangers.DynamicTwoPhaseFlowRiser dynamicTwoPhaseFlowRiser( + redeclare package Medium = Medium, + L=10, + D=0.03, + inertia=false, + Ns=1, + steady_state=false, + option_temperature=false, + h0={800e3}, + C1(SubC(start={0.1})), + C2(SubC(start={0.1}))) annotation (Placement(transformation(extent={{-40,-48},{40,10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP( + redeclare package Medium = Medium, + C(Q(start=1), SubC(start={0.1})), + option_temperature=false, + h0=800e3, + P0=2000000, + SubC0={0.1}) annotation (Placement(transformation(extent={{-90,-28},{-70,-8}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP( + redeclare package Medium = Medium, + option_temperature=false, + h0=2000e3, + P0=19.9e5) annotation (Placement(transformation(extent={{70,-28},{90,-8}}, rotation=0))); + ThermoSysPro.Thermal.BoundaryConditions.HeatSource heatSource1( + option_temperature=2, + T0={1000}, + W0={2e4}) annotation (Placement(transformation(extent={{-10,31},{10,51}}, rotation=0))); + ThermoSysPro.Thermal.BoundaryConditions.HeatSource heatSource2( + option_temperature=2, + T0={1000}, + W0={2e4}) annotation (Placement(transformation(extent={{-10,-70},{10,-50}}, rotation=0))); +equation + connect(sourceP.C, dynamicTwoPhaseFlowRiser.C1) annotation (Line(points={{-70,-18},{-42,-18},{-42,-19},{-40,-19}}, color={0,0,255})); + connect(dynamicTwoPhaseFlowRiser.C2, sinkP.C) annotation (Line(points={{40,-19},{70,-18}}, color={0,0,255})); + connect(heatSource1.C, dynamicTwoPhaseFlowRiser.CTh1) annotation (Line(points={{0,31.2},{0,-7.7}}, color={191,95,0})); + connect(heatSource2.C, dynamicTwoPhaseFlowRiser.CTh2) annotation (Line(points={{0,-50},{0,-33.5}}, color={191,95,0})); + annotation (experiment(StopTime=1000), Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestDynamicTwoPhaseFlowRiser_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order index 2f5576ca..4cbbe684 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order @@ -3,6 +3,8 @@ TestDynamicOnePhaseFlowPipe_Traces TestDynamicOnePhaseFlowPipe_FlueGases TestDynamicTwoPhaseFlowPipe TestDynamicTwoPhaseFlowPipe_Traces +TestDynamicTwoPhaseFlowRiser +TestDynamicTwoPhaseFlowRiser_Traces TestDynamicOnePhaseFlowShell TestDynamicOnePhaseFlowShell_Traces TestDynamicOnePhaseFlowShell_FlueGases diff --git a/ThermoSysPro/Fluid/HeatExchangers/DynamicTwoPhaseFlowRiser.mo b/ThermoSysPro/Fluid/HeatExchangers/DynamicTwoPhaseFlowRiser.mo index 050ef5ac..fc575000 100644 --- a/ThermoSysPro/Fluid/HeatExchangers/DynamicTwoPhaseFlowRiser.mo +++ b/ThermoSysPro/Fluid/HeatExchangers/DynamicTwoPhaseFlowRiser.mo @@ -1,8 +1,8 @@ within ThermoSysPro.Fluid.HeatExchangers; model DynamicTwoPhaseFlowRiser "Dynamic two-phase flow riser" extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Units.SI.Length L=10. "Pipe length"; parameter Units.SI.Diameter D=0.02 "Hydraulic diameter"; @@ -41,12 +41,10 @@ model DynamicTwoPhaseFlowRiser "Dynamic two-phase flow riser" "true: continuous flow reversal - false: discontinuous flow reversal"; parameter Boolean diffusion=false "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; - parameter IF97Region region=IF97Region.All_regions "IF97 region (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); protected constant Units.SI.Acceleration g=Modelica.Constants.g_n "Gravity constant"; constant Real pi=Modelica.Constants.pi "pi"; - parameter Integer mode=Integer(region) - 1 "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; parameter Integer N=Ns + 1 "Number of hydraulic nodes (= number of thermal nodes + 1)"; parameter Units.SI.Area A=ntubes*pi*D^2/4 @@ -57,12 +55,9 @@ protected parameter Units.SI.Area dSi=pi*Di*dx1 "Internal heat exchange area for a node"; parameter Real Mmol=18.015 "Water molar mass"; - parameter Units.SI.AbsolutePressure pcrit=ThermoSysPro.Properties.WaterSteam.BaseIF97.data.PCRIT - "Critical pressure"; - parameter Units.SI.Temperature Tcrit=ThermoSysPro.Properties.WaterSteam.BaseIF97.data.TCRIT - "Critical temperature"; - parameter Units.SI.AbsolutePressure ptriple=ThermoSysPro.Properties.WaterSteam.BaseIF97.triple.ptriple - "Triple point pressure"; + parameter Units.SI.AbsolutePressure pcrit=Medium.fluidConstants[1].criticalPressure "Critical pressure"; + parameter Units.SI.Temperature Tcrit=Medium.fluidConstants[1].criticalTemperature "Critical temperature"; + parameter Units.SI.AbsolutePressure ptriple=Medium.fluidConstants[1].triplePointPressure "Triple point pressure"; parameter Real xb1=0.0002 "Min value for vapor mass fraction"; parameter Real xb2=0.85 "Max value for vapor mass fraction"; parameter Units.SI.MassFlowRate gamma0=1.e-4 @@ -193,12 +188,14 @@ public Real lambdav[N](start=fill(0.03, N), nominal=fill(0.03, N)) "Friction pressure loss coefficient in node i for the vapor)"; Real filo[N] "Pressure loss coefficient for two-phase flow"; - FluidType ftype "Fluid type"; - Integer fluid=Integer(ftype) "Fluid number"; - ThermoSysPro.Units.SI.MassFraction Xco2 "CO2 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xh2o "H2O mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xo2 "O2 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xso2 "SO2 mass fraction"; + Units.SI.DerDensityByPressure ddph[N - 1] "Density derivative wrt. pressure"; + Units.SI.DerDensityByEnthalpy ddhp[N - 1] "Density derivative wrt. enthalpy"; + Medium.ThermodynamicState state1[N - 1]; + Medium.ThermodynamicState state2[N]; + Medium.ThermodynamicState state_c[2]; + Medium.SaturationProperties sat1[N - 1]; + Medium.SaturationProperties sat2[N]; + Medium.MassFraction X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Mass fractions"; Real diff_res_l[N] "Diffusion resistance in hydraulic node i for the liquid"; Real diff_res_v[N] "Diffusion resistance in hydraulic node i for the vapor"; Real diff_res[N] "Total diffusion resistance in hydraulic node i"; @@ -219,32 +216,12 @@ public Real re[N - 1] "Value of r(Q/gamma) for inlet of thermal node i"; Real rs[N - 1] "Value of r(Q/gamma) for outlet of thermal node i"; - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro1[N - 1] - annotation (Placement(transformation(extent={{-100,80},{-80,100}}, rotation= - 0))); - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph proc[2] - annotation (Placement(transformation(extent={{80,80},{100,100}}, rotation=0))); - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro2[N] - annotation (Placement(transformation(extent={{-60,80},{-40,100}}, rotation= - 0))); - ThermoSysPro.Properties.WaterSteam.Common.PropThermoSat vsat2[N] - annotation (Placement(transformation(extent={{80,-100},{100,-80}}, rotation= - 0))); - ThermoSysPro.Properties.WaterSteam.Common.PropThermoSat lsat2[N] - annotation (Placement(transformation(extent={{40,-100},{60,-80}}, rotation= - 0))); - ThermoSysPro.Properties.WaterSteam.Common.PropThermoSat vsat1[N - 1] - annotation (Placement(transformation(extent={{-60,-100},{-40,-80}}, - rotation=0))); - ThermoSysPro.Properties.WaterSteam.Common.PropThermoSat lsat1[N - 1] - annotation (Placement(transformation(extent={{-100,-100},{-80,-80}}, - rotation=0))); public - Interfaces.Connectors.FluidInlet C1 annotation (Placement(transformation( + Interfaces.Connectors.FluidInlet C1(redeclare package Medium = Medium) annotation (Placement(transformation( extent={{-110,0},{-90,20}}, rotation=0))); ThermoSysPro.Thermal.Connectors.ThermalPort CTh1[Ns] annotation (Placement(transformation(extent={{-10,60},{10,80}}, rotation=0))); - Interfaces.Connectors.FluidOutlet C2 annotation (Placement(transformation( + Interfaces.Connectors.FluidOutlet C2(redeclare package Medium = Medium) annotation (Placement(transformation( extent={{90,0},{110,20}}, rotation=0))); ThermoSysPro.Thermal.Connectors.ThermalPort CTh2[Ns] annotation (Placement(transformation(extent={{-10,-60},{10,-40}}, rotation= @@ -259,7 +236,7 @@ initial equation else if option_temperature then for i in 2:N loop - h[i] = ThermoSysPro.Properties.Fluid.SpecificEnthalpy_PT(Pb[i], T0[i - 1],fluid, mode, Xco2, Xh2o, Xo2, Xso2); + h[i] = Medium.specificEnthalpy_pTX(Pb[i], T0[i - 1], X); end for; else for i in 2:N loop @@ -283,9 +260,6 @@ initial equation equation - /* Check that the fluid type is water/steam */ - assert((ftype == FluidType.WaterSteam) or (ftype == FluidType.WaterSteamSimple), "DynamicTwoPhaseFlowRiser: the fluid type must be water/steam"); - /* Wall temperature */ Tp1 = CTh1.T; CTh1.W = dW1; @@ -318,19 +292,9 @@ equation C2.diff_res_1 = C1.diff_res_1 + diff_res_t; C1.diff_res_2 = C2.diff_res_2 + diff_res_t; - C1.ftype = C2.ftype; - - C1.Xco2 = C2.Xco2; - C1.Xh2o = C2.Xh2o; - C1.Xo2 = C2.Xo2; - C1.Xso2 = C2.Xso2; - - ftype = C1.ftype; - - Xco2 = C1.Xco2; - Xh2o = C1.Xh2o; - Xo2 = C1.Xo2; - Xso2 = C1.Xso2; + C1.Xi = C2.Xi; + X = C1.Xi; + C1.SubC = C2.SubC; /* Mass and energy balance equations (thermal nodes) */ for i in 1:N - 1 loop @@ -338,7 +302,7 @@ equation /* Mass balance equation */ if dynamic_energy_balance and dynamic_mass_balance then - A*(pro1[i].ddph*der(P[i + 1]) + pro1[i].ddhp*der(h[i + 1]))*dx1 = BQ[i]; + A*(ddph[i]*der(P[i + 1]) + ddhp[i]*der(h[i + 1]))*dx1 = BQ[i]; else 0 = BQ[i]; end if; @@ -351,7 +315,7 @@ equation if simplified_dynamic_energy_balance then A*(-der(P[i + 1]) + rho1[i]*der(h[i + 1]))*dx1 = BH[i]; else - A*((h[i + 1]*pro1[i].ddph - 1)*der(P[i + 1]) + (h[i + 1]*pro1[i].ddhp + rho1[i])*der(h[i + 1]))*dx1 = BH[i]; + A*((h[i + 1]*ddph[i] - 1)*der(P[i + 1]) + (h[i + 1]*ddhp[i] + rho1[i])*der(h[i + 1]))*dx1 = BH[i]; end if; else A*rho1[i]*der(h[i + 1])*dx1 = BH[i]; @@ -447,37 +411,39 @@ equation end if; /* Fluid thermodynamic properties */ - pro1[i] = ThermoSysPro.Properties.Fluid.Ph(P[i + 1], h[i + 1], mode, fluid); + state1[i] = Medium.setState_phX(P[i + 1], h[i + 1], X); - rho1[i] = pro1[i].d; - T1[i] = pro1[i].T; - xv1[i] = if noEvent((P[i+1] > pcrit) or (T1[i] > Tcrit)) then 1 else pro1[i].x; + rho1[i] = Medium.density(state1[i]); + T1[i] = Medium.temperature(state1[i]); + xv1[i] = if noEvent((P[i+1] > pcrit) or (T1[i] > Tcrit)) then 1 else Medium.vapourQuality(state1[i]); + ddph[i] = Medium.density_derp_h(state1[i]); + ddhp[i] = Medium.density_derh_p(state1[i]); - (lsat1[i],vsat1[i]) = ThermoSysPro.Properties.Fluid.Water_sat_P(P[i + 1], fluid); + sat1[i] = Medium.setSat_p(P[i + 1]); if noEvent((P[i+1] > pcrit) or (T1[i] > Tcrit)) then xbs[i] = 0; xbi[i] = 1; - rhol1[i] = pro1[i].d; - rhov1[i] = pro1[i].d; - cpl1[i] = pro1[i].cp; - cpv1[i] = pro1[i].cp; + rhol1[i] = rho1[i]; + rhov1[i] = rho1[i]; + cpl1[i] = Medium.specificHeatCapacityCp(state1[i]); + cpv1[i] = Medium.specificHeatCapacityCp(state1[i]); lv[i] = 1; else - xbs[i] = min(pro1[i].x, 0.90); - xbi[i] = max(pro1[i].x, 0.10); - rhol1[i] = max(pro1[i].d, lsat1[i].rho); - rhov1[i] = min(pro1[i].d, vsat1[i].rho); - cpl1[i] = if noEvent(xv1[i] <= 0.0) then pro1[i].cp else lsat1[i].cp; - cpv1[i] = if noEvent(xv1[i] >= 1.0) then pro1[i].cp else vsat1[i].cp; - lv[i] = vsat1[i].h - lsat1[i].h; + xbs[i] = min(xv1[i], 0.90); + xbi[i] = max(xv1[i], 0.10); + rhol1[i] = max(rho1[i], Medium.bubbleDensity(sat1[i])); + rhov1[i] = min(rho1[i], Medium.dewDensity(sat1[i])); + cpl1[i] = if noEvent(xv1[i] <= 0.0) then Medium.specificHeatCapacityCp(state1[i]) else Medium.specificHeatCapacityCp(Medium.setBubbleState(sat1[i])); + cpv1[i] = if noEvent(xv1[i] >= 1.0) then Medium.specificHeatCapacityCp(state1[i]) else Medium.specificHeatCapacityCp(Medium.setDewState(sat1[i])); + lv[i] = Medium.dewEnthalpy(sat1[i]) - Medium.bubbleEnthalpy(sat1[i]); end if; - mul1[i] = ThermoSysPro.Properties.Fluid.DynamicViscosity_rhoT(rhol1[i], T1[i], fluid); - muv1[i] = ThermoSysPro.Properties.Fluid.DynamicViscosity_rhoT(rhov1[i], T1[i], fluid); + mul1[i] = Medium.dynamicViscosity(Medium.setBubbleState(sat1[i])); + muv1[i] = Medium.dynamicViscosity(Medium.setDewState(sat1[i])); - kl1[i] = ThermoSysPro.Properties.Fluid.ThermalConductivity_rhoT(rhol1[i], T1[i], P[i + 1], mode, fluid); - kv1[i] = ThermoSysPro.Properties.Fluid.ThermalConductivity_rhoT(rhov1[i], T1[i], P[i + 1], mode, fluid); + kl1[i] = Medium.thermalConductivity(Medium.setBubbleState(sat1[i])); + kv1[i] = Medium.thermalConductivity(Medium.setDewState(sat1[i])); Pb[i + 1] = max(min(P[i + 1], pcrit - 1), ptriple); end for; @@ -532,25 +498,25 @@ equation gamma[i] = if diffusion then 1/diff_res[i] else gamma0; /* Fluid thermodynamic properties */ - pro2[i] = ThermoSysPro.Properties.Fluid.Ph((P[i] + P[i + 1])/2, hb[i],mode,fluid); + state2[i] = Medium.setState_phX((P[i] + P[i + 1])/2, hb[i], X); - rho2[i] = pro2[i].d; - xv2[i] = if noEvent(((P[i] + P[i + 1])/2 > pcrit) or (T2[i] > Tcrit)) then 1 else pro2[i].x; - T2[i] = pro2[i].T; + rho2[i] = Medium.density(state2[i]); + xv2[i] = if noEvent(((P[i] + P[i + 1])/2 > pcrit) or (T2[i] > Tcrit)) then 1 else Medium.vapourQuality(state2[i]); + T2[i] = Medium.temperature(state2[i]); - (lsat2[i],vsat2[i]) = ThermoSysPro.Properties.Fluid.Water_sat_P((P[i] + P[i + 1])/2, fluid); + sat2[i] = Medium.setSat_p((P[i] + P[i + 1])/2); - rhol2[i] = if noEvent((P[i+1] > pcrit) or (T2[i] > Tcrit)) then pro2[i].d else max(pro2[i].d, lsat2[i].rho); - rhov2[i] = if noEvent((P[i+1] > pcrit) or (T2[i] > Tcrit)) then pro2[i].d else min(pro2[i].d, vsat2[i].rho); + rhol2[i] = if noEvent((P[i+1] > pcrit) or (T2[i] > Tcrit)) then rho2[i] else max(rho2[i], Medium.bubbleDensity(sat2[i])); + rhov2[i] = if noEvent((P[i+1] > pcrit) or (T2[i] > Tcrit)) then rho2[i] else min(rho2[i], Medium.dewDensity(sat2[i])); - cpl2[i] = if noEvent((P[i+1] > pcrit) or (T2[i] > Tcrit)) then pro2[i].cp else (if noEvent(xv2[i] <= 0.0) then pro2[i].cp else lsat2[i].cp); - cpv2[i] = if noEvent((P[i+1] > pcrit) or (T2[i] > Tcrit)) then pro2[i].cp else (if noEvent(xv2[i] >= 1.0) then pro2[i].cp else vsat2[i].cp); + cpl2[i] = if noEvent((P[i+1] > pcrit) or (T2[i] > Tcrit)) then Medium.specificHeatCapacityCp(state2[i]) else (if noEvent(xv2[i] <= 0.0) then Medium.specificHeatCapacityCp(state2[i]) else Medium.specificHeatCapacityCp(Medium.setBubbleState(sat2[i]))); + cpv2[i] = if noEvent((P[i+1] > pcrit) or (T2[i] > Tcrit)) then Medium.specificHeatCapacityCp(state2[i]) else (if noEvent(xv2[i] >= 1.0) then Medium.specificHeatCapacityCp(state2[i]) else Medium.specificHeatCapacityCp(Medium.setDewState(sat2[i]))); - mul2[i] = ThermoSysPro.Properties.Fluid.DynamicViscosity_rhoT(rhol2[i], T2[i],fluid); - muv2[i] = ThermoSysPro.Properties.Fluid.DynamicViscosity_rhoT(rhov2[i], T2[i],fluid); + mul2[i] = Medium.dynamicViscosity(Medium.setBubbleState(sat2[i])); + muv2[i] = Medium.dynamicViscosity(Medium.setDewState(sat2[i])); - kl2[i] = ThermoSysPro.Properties.Fluid.ThermalConductivity_rhoT(rhol2[i], T2[i], (P[i] + P[i + 1])/2, mode, fluid); - kv2[i] = ThermoSysPro.Properties.Fluid.ThermalConductivity_rhoT(rhov2[i], T2[i], (P[i] + P[i + 1])/2, mode, fluid); + kl2[i] = Medium.thermalConductivity(Medium.setBubbleState(sat2[i])); + kv2[i] = Medium.thermalConductivity(Medium.setDewState(sat2[i])); end for; /* Fluid densities at the boundaries of the nodes */ @@ -558,11 +524,11 @@ equation rhoc[i] = rho1[i - 1]; end for; - proc[1] = ThermoSysPro.Properties.Fluid.Ph(P[1], h[1], mode, fluid); - proc[2] = ThermoSysPro.Properties.Fluid.Ph(P[N + 1], h[N + 1], mode, fluid); + state_c[1] = Medium.setState_phX(P[1], h[1], X); + state_c[2] = Medium.setState_phX(P[N + 1], h[N + 1], X); - rhoc[1] = proc[1].d; - rhoc[N + 1] = proc[2].d; + rhoc[1] = Medium.density(state_c[1]); + rhoc[N + 1] = Medium.density(state_c[2]); W1t = sum(dW1); From 5979baaecf8581e1662603c0a33e514dc0ee130b Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Tue, 12 May 2026 14:02:53 +0200 Subject: [PATCH 137/178] #125 DynamicTwoPhaseFlowRiser --- .../Fluid/HeatExchangers/DynamicTwoPhaseFlowRiser.mo | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ThermoSysPro/Fluid/HeatExchangers/DynamicTwoPhaseFlowRiser.mo b/ThermoSysPro/Fluid/HeatExchangers/DynamicTwoPhaseFlowRiser.mo index fc575000..d95d7279 100644 --- a/ThermoSysPro/Fluid/HeatExchangers/DynamicTwoPhaseFlowRiser.mo +++ b/ThermoSysPro/Fluid/HeatExchangers/DynamicTwoPhaseFlowRiser.mo @@ -55,9 +55,12 @@ protected parameter Units.SI.Area dSi=pi*Di*dx1 "Internal heat exchange area for a node"; parameter Real Mmol=18.015 "Water molar mass"; - parameter Units.SI.AbsolutePressure pcrit=Medium.fluidConstants[1].criticalPressure "Critical pressure"; - parameter Units.SI.Temperature Tcrit=Medium.fluidConstants[1].criticalTemperature "Critical temperature"; - parameter Units.SI.AbsolutePressure ptriple=Medium.fluidConstants[1].triplePointPressure "Triple point pressure"; + parameter Units.SI.AbsolutePressure pcrit=ThermoSysPro.Properties.WaterSteam.BaseIF97.data.PCRIT + "Critical pressure"; + parameter Units.SI.Temperature Tcrit=ThermoSysPro.Properties.WaterSteam.BaseIF97.data.TCRIT + "Critical temperature"; + parameter Units.SI.AbsolutePressure ptriple=ThermoSysPro.Properties.WaterSteam.BaseIF97.triple.ptriple + "Triple point pressure"; parameter Real xb1=0.0002 "Min value for vapor mass fraction"; parameter Real xb2=0.85 "Max value for vapor mass fraction"; parameter Units.SI.MassFlowRate gamma0=1.e-4 From a5bf4e82cb7a98b95e85949cb44d94eb9c2e7b15 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Tue, 12 May 2026 14:23:58 +0200 Subject: [PATCH 138/178] #125 TwoPhaseCavity --- .../Volumes/TestTwoPhaseCavity.mo | 60 +++++ .../Volumes/TestTwoPhaseCavity_Traces.mo | 65 ++++++ .../SimpleExamples/Volumes/package.order | 2 + ThermoSysPro/Fluid/Volumes/TwoPhaseCavity.mo | 221 ++++++++++-------- 4 files changed, 245 insertions(+), 103 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestTwoPhaseCavity.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestTwoPhaseCavity_Traces.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestTwoPhaseCavity.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestTwoPhaseCavity.mo new file mode 100644 index 00000000..59e389cc --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestTwoPhaseCavity.mo @@ -0,0 +1,60 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Volumes; +model TestTwoPhaseCavity + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; + + ThermoSysPro.Fluid.Volumes.TwoPhaseCavity cavity( + redeclare package Medium = Medium, + steady_state=false, + P0=13000000, + P(start=13000000, fixed=true), + hl(start=1454400), + hv(start=2.658e6), + xv(start=0.01), + rhol(start=670), + rhov(start=78), + Ns=1, + Vf0=0.5, + Cal_hconv=false) annotation (Placement(transformation(extent={{-20,-20},{40,40}}, rotation=0))); + + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceWater( + redeclare package Medium = Medium, + Q0=1, + h0=1454400) annotation (Placement(transformation(extent={{-90,20},{-70,40}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceSteam( + redeclare package Medium = Medium, + Q0=1, + h0=2.8e6) annotation (Placement(transformation(extent={{-60,50},{-40,70}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkWater( + redeclare package Medium = Medium, + Q0=2) annotation (Placement(transformation(extent={{-90,-60},{-70,-40}}, rotation=0))); + + ThermoSysPro.Thermal.BoundaryConditions.HeatSource heatSource1( + option_temperature=2, + W0={1e5}) annotation (Placement(transformation(extent={{60,-70},{80,-50}}, rotation=0))); + ThermoSysPro.Thermal.BoundaryConditions.HeatSource heatSource2( + option_temperature=2, + W0={1e5}) annotation (Placement(transformation(extent={{70,0},{90,20}}, rotation=0))); + ThermoSysPro.Thermal.BoundaryConditions.HeatSource heatSource3a( + T0={293.15,293.15}, + option_temperature=2, + W0={1e5,1e5}) + annotation (Placement(transformation(extent={{70,50},{90,70}}, rotation=0))); +equation + cavity.Cth3[3:2*cavity.Ns].W = fill(0, 2*cavity.Ns - 2); + connect(sourceWater.C, cavity.Ce) annotation (Line(points={{-70,30},{-40,30},{-40,32},{-1.66667,32}}, + color={0,0,0})); + connect(sourceSteam.C, cavity.Cv) annotation (Line(points={{-40,60},{10.3333,60},{10.3333,32}}, + color={0,0,0})); + connect(cavity.Cl, sinkWater.C) annotation (Line(points={{10.3333,-12},{10.3333,-50},{-90,-50}}, + color={0,0,0})); + connect(heatSource1.C, cavity.Cth1) annotation (Line(points={{70,-69.8},{20,-69.8},{20,-5.3},{10.1667,-5.3}},color={255,0,0})); + connect(heatSource2.C, cavity.Cth2) annotation (Line(points={{80,0.2},{42,0.2},{42,25.1},{10.1667,25.1}}, + color={255,0,0})); + connect(cavity.Cth3, heatSource3a.C) annotation (Line(points={{10.1667,10.6},{58,10.6},{58,50.2},{80,50.2}}, color={255,0,0})); + annotation ( + experiment(StopTime=1000), + Icon(coordinateSystem(preserveAspectRatio=false)), + Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-120,-100},{120,80}}))); +end TestTwoPhaseCavity; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestTwoPhaseCavity_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestTwoPhaseCavity_Traces.mo new file mode 100644 index 00000000..c526b9af --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestTwoPhaseCavity_Traces.mo @@ -0,0 +1,65 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Volumes; +model TestTwoPhaseCavity_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Fluid.Examples.SimpleExamples.Media.WaterSteam_FullyVolatileTrace; + + ThermoSysPro.Fluid.Volumes.TwoPhaseCavity cavity( + redeclare package Medium = Medium, + redeclare function PhasesSeparationFunction = Medium.PhasesSeparation(x=cavity.xv), + steady_state=false, + P0=13000000, + P(start=13000000, fixed=true), + hl(start=1454400), + hv(start=2.658e6), + xv(start=0.01), + rhol(start=670), + rhov(start=78), + Ns=1, + Vf0=0.5, + Cal_hconv=false, + SubCl0={0}, + SubCv0={0}) annotation (Placement(transformation(extent={{-20,-20},{40,40}}, rotation=0))); + + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceWater( + redeclare package Medium = Medium, + Q0=1, + h0=1454400, + SubC0={0}) annotation (Placement(transformation(extent={{-90,20},{-70,40}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceSteam( + redeclare package Medium = Medium, + Q0=1, + h0=2.8e6, + SubC0={10}) annotation (Placement(transformation(extent={{-60,50},{-40,70}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkWater( + redeclare package Medium = Medium, + Q0=2) annotation (Placement(transformation(extent={{-90,-60},{-70,-40}}, rotation=0))); + + ThermoSysPro.Thermal.BoundaryConditions.HeatSource heatSource1( + option_temperature=2, + W0={1e5}) annotation (Placement(transformation(extent={{60,-70},{80,-50}}, rotation=0))); + ThermoSysPro.Thermal.BoundaryConditions.HeatSource heatSource2( + option_temperature=2, + W0={1e5}) annotation (Placement(transformation(extent={{70,0},{90,20}}, rotation=0))); + Thermal.BoundaryConditions.HeatSource heatSource3a( + T0={293.15,293.15}, + option_temperature=2, + W0={1e5,1e5}) + annotation (Placement(transformation(extent={{68,56},{88,76}}, rotation=0))); +equation + cavity.Cth3[3:2*cavity.Ns].W = fill(0, 2*cavity.Ns - 2); + connect(sourceWater.C, cavity.Ce) annotation (Line(points={{-70,30},{-40,30},{-40,32},{-1.66667,32}}, + color={0,0,0})); + connect(sourceSteam.C, cavity.Cv) annotation (Line(points={{-40,60},{10.3333,60},{10.3333,32}}, + color={0,0,0})); + connect(cavity.Cl, sinkWater.C) annotation (Line(points={{10.3333,-12},{10.3333,-50},{-90,-50}}, + color={0,0,0})); + connect(heatSource1.C, cavity.Cth1) annotation (Line(points={{70,-69.8},{20,-69.8},{20,-5.3},{10.1667,-5.3}},color={255,0,0})); + connect(heatSource2.C, cavity.Cth2) annotation (Line(points={{80,0.2},{42,0.2},{42,25.1},{10.1667,25.1}}, + color={255,0,0})); + connect(cavity.Cth3, heatSource3a.C) annotation (Line(points={{10.1667,10.6},{64,10.6},{64,52},{78,52},{78,56.2}}, color={255,0,0})); + annotation ( + experiment(StopTime=1000), + Icon(coordinateSystem(preserveAspectRatio=false)), + Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-120,-100},{120,80}}))); +end TestTwoPhaseCavity_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order index c1f884cb..1949b3fe 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order @@ -36,5 +36,7 @@ TestDynamicDrum TestDynamicDrum_Traces TestTwoPhaseVolume TestTwoPhaseVolume_Traces +TestTwoPhaseCavity +TestTwoPhaseCavity_Traces TestPressurizer TestPressurizer_Traces diff --git a/ThermoSysPro/Fluid/Volumes/TwoPhaseCavity.mo b/ThermoSysPro/Fluid/Volumes/TwoPhaseCavity.mo index 7c08789e..bf560520 100644 --- a/ThermoSysPro/Fluid/Volumes/TwoPhaseCavity.mo +++ b/ThermoSysPro/Fluid/Volumes/TwoPhaseCavity.mo @@ -1,9 +1,9 @@ within ThermoSysPro.Fluid.Volumes; model TwoPhaseCavity "TwoPhaseCavity for one shell pass " - extends - ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.WaterSteamFluidTypeParameterInterface; extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialTwoPhaseThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable function SaS = Medium.noSaS(SubC = SubCv) annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable function PhasesSeparationFunction = Medium.HomogeneousPhasesSeparation(SubC = Cv.SubC) annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Boolean Vertical=true "true: vertical cylinder - false: horizontal cylinder"; parameter Units.SI.Radius R=1.05 "Radius of the Cavity cross-sectional area"; @@ -63,16 +63,22 @@ model TwoPhaseCavity "TwoPhaseCavity for one shell pass " parameter Boolean continuous_flow_reversal=false "true: continuous flow reversal - false: discontinuous flow reversal"; parameter Boolean diffusion=false "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; + parameter Medium.ExtraProperty SubCl0[Medium.nC](quantity=Medium.extraPropertiesNames)=Medium.C_default + "Initial liquid phase trace substances" + annotation (Evaluate=true, Dialog(enable=dynamic_energy_balance and not steady_state)); + parameter Medium.ExtraProperty SubCv0[Medium.nC](quantity=Medium.extraPropertiesNames)=Medium.C_default + "Initial vapor phase trace substances" + annotation (Evaluate=true, Dialog(enable=dynamic_energy_balance and not steady_state)); protected constant Units.SI.Acceleration g=Modelica.Constants.g_n "Gravity constant"; constant Real pi=Modelica.Constants.pi; parameter Integer Ns3=2*Ns "Number of segments for half pipes"; - parameter Integer fluid=Integer(ftype) "Fluid number"; parameter Units.SI.CoefficientOfHeatTransfer h4=1 "Heat exchange coefficient"; parameter Units.SI.Area S4=1 "Heat exchange surface"; parameter Units.SI.MassFlowRate gamma0=1.e-4 "Pseudo-diffusion conductance use for continuous flow reversal (active if diffusion=false and continuous_flow_reversal = true)"; + Medium.C_BiPhase C_record; public Units.SI.Length L(start=15) "Cavity length"; @@ -154,7 +160,6 @@ public "Heat transfer coefficient between the liquid and the cooling pipes zone 1"; Units.SI.Diameter DH(start=0.02) "hydraulic diameter"; Real EE[Ns](start=fill(1, Ns)); - FluidType fluids[4] "Fluids mixing in volume"; Units.SI.Power Je "Thermal power diffusion from inlet Ce"; Units.SI.Power Jv "Thermal power diffusion from inlet Cv"; Units.SI.Power Jl "Thermal power diffusion from outlet Cl"; @@ -166,23 +171,37 @@ public Real re "Value of r(Q/gamma) for inlet Ce"; Real rv "Value of r(Q/gamma) for inlet Cv"; Real rl "Value of r(Q/gamma) for outlet Cl"; - - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph prol - "Propri鴩s de l'eau dans le ballon" annotation (Placement(transformation( - extent={{-250,70},{-210,110}}, rotation=0))); - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph prov - "Propri鴩s de la vapeur dans le ballon" annotation (Placement( - transformation(extent={{60,70},{100,110}}, rotation=0))); - ThermoSysPro.Properties.WaterSteam.Common.PropThermoSat lsat - annotation (Placement(transformation(extent={{-250,-200},{-210,-160}}, - rotation=0))); - ThermoSysPro.Properties.WaterSteam.Common.PropThermoSat vsat - annotation (Placement(transformation( - extent={{58,-200},{98,-160}}, rotation=0))); - Interfaces.Connectors.FluidInlet Cv "Steam input" annotation (Placement( + Medium.ExtraProperty BSubCl[Medium.nC](quantity=Medium.extraPropertiesNames) + "Right hand side of the trace balance equation of the liquid phase"; + Medium.ExtraProperty BSubCv[Medium.nC](quantity=Medium.extraPropertiesNames) + "Right hand side of the trace balance equation of the vapor phase"; + Medium.ExtraProperty SubCl[Medium.nC](quantity=Medium.extraPropertiesNames, start=Medium.C_default) + "Liquid phase trace substances"; + Medium.ExtraProperty SubCv[Medium.nC](quantity=Medium.extraPropertiesNames, start=Medium.C_default) + "Vapor phase trace substances"; + Medium.ExtraProperty SubCSaS[Medium.nC](quantity=Medium.extraPropertiesNames) + "Trace modification in the trace balance equation"; + + Medium.ThermodynamicState state_l "Liquid state in the cavity"; + Medium.ThermodynamicState state_v "Vapor state in the cavity"; + Medium.ThermodynamicState state_in_l "Water inlet state"; + Medium.ThermodynamicState state_out_l "Water outlet state"; + Medium.SaturationProperties sat "Saturation properties at cavity pressure"; + Medium.SaturationProperties sat_wall "Saturation properties for wall heat transfer correlations"; + Units.SI.SpecificEnthalpy hlsat "Bubble enthalpy at cavity pressure"; + Units.SI.SpecificEnthalpy hvsat "Dew enthalpy at cavity pressure"; + Units.SI.Density rholsat "Bubble density at cavity pressure"; + Units.SI.Density rhovsat "Dew density at cavity pressure"; + Units.SI.Temperature Tsat "Saturation temperature at cavity pressure"; + Real ddphl "Liquid density derivative wrt. pressure at constant enthalpy"; + Real ddhpl "Liquid density derivative wrt. enthalpy at constant pressure"; + Real ddphv "Vapor density derivative wrt. pressure at constant enthalpy"; + Real ddhpv "Vapor density derivative wrt. enthalpy at constant pressure"; + + Interfaces.Connectors.FluidInlet Cv(redeclare package Medium = Medium) "Steam input" annotation (Placement( transformation(extent={{-88,50},{-68,70}}, rotation=0), iconTransformation(extent={{-88,50},{-68,70}}))); - Interfaces.Connectors.FluidOutlet Cl "Water output" annotation (Placement( + Interfaces.Connectors.FluidOutlet Cl(redeclare package Medium = Medium) "Water output" annotation (Placement( transformation(extent={{-88,-170},{-68,-150}}, rotation=0), iconTransformation(extent={{-88,-170},{-68,-150}}))); ThermoSysPro.Thermal.Connectors.ThermalPort Cth3[Ns3] @@ -194,10 +213,7 @@ public extent={{88,-109},{108,-89}}, rotation=0), iconTransformation(extent={ {88,-109},{108,-89}}))); public - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph prod - annotation (Placement(transformation(extent={{-250,-20},{-210,20}}, - rotation=0))); - Interfaces.Connectors.FluidInlet Ce "Water input" annotation (Placement( + Interfaces.Connectors.FluidInlet Ce(redeclare package Medium = Medium) "Water input" annotation (Placement( transformation(extent={{-160,50},{-140,70}}, rotation=0))); ThermoSysPro.Thermal.Connectors.ThermalPort Cth1[Ns] annotation (Placement(transformation( @@ -208,13 +224,6 @@ public extent={{-85,19},{-73,32}}, rotation=0), iconTransformation(extent={{ -85,19},{-73,32}}))); -public - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph proe - annotation (Placement(transformation(extent={{-250,-110},{-210,-70}}, - rotation=0))); - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph provIn - "Propri鴩s de la vapeur dans le ballon" annotation (Placement( - transformation(extent={{12,70},{52,110}}, rotation=0))); initial equation if dynamic_energy_balance then if steady_state then @@ -223,25 +232,20 @@ initial equation der(Vl) = 0; der(P) = 0; der(Tp) = 0; + der(SubCl) = fill(0, Medium.nC); + der(SubCv) = fill(0, Medium.nC); else - hl = lsat.h; - hv = vsat.h; + hl = hlsat; + hv = hvsat; Vl = Vf0*V; P = P0; der(Tp) = 0; + SubCl = SubCl0; + SubCv = SubCv0; end if; end if; equation - /* Check that incoming fluids are compatible with fluid in volume */ - fluids[1] = ftype; - fluids[2] = Ce.ftype; - fluids[3] = Cv.ftype; - fluids[4] = Cl.ftype; - - assert(ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.isCompatible(fluids), - "TwoPhaseCavity: fluids mixing in volume are not compatible with each other"); - /* Unconnected connectors */ if (cardinality(Ce) == 0) then Ce.Q = 0; @@ -249,11 +253,7 @@ equation Ce.h_vol_1 = 1.e5; Ce.diff_res_1 = 0; Ce.diff_on_1 = false; - Ce.ftype = ftype; - Ce.Xco2 = 0; - Ce.Xh2o = 0; - Ce.Xo2 = 0; - Ce.Xso2 = 0; + Ce.SubC = Medium.C_default; end if; if (cardinality(Cv) == 0) then @@ -262,11 +262,7 @@ equation Cv.h_vol_1 = 1.e5; Cv.diff_res_1 = 0; Cv.diff_on_1 = false; - Cv.ftype = ftype; - Cv.Xco2 = 0; - Cv.Xh2o = 0; - Cv.Xo2 = 0; - Cv.Xso2 = 0; + Cv.SubC = Medium.C_default; end if; if (cardinality(Cl) == 0) then @@ -322,22 +318,22 @@ equation Ape = Alp + Avp; /* Pressure at the bottom of the cavity */ - Pfond = P + prod.d*g*zl; + Pfond = P + Medium.density(state_out_l)*g*zl; /* Liquid phase mass balance equation */ - BQl = -Cl.Q + Qcond - Qevap + (1 - proe.x)*Ce.Q; + BQl = -Cl.Q + Qcond - Qevap + (1 - Medium.vapourQuality(state_in_l))*Ce.Q; if dynamic_energy_balance then - rhol*der(Vl) + Vl*(prol.ddph*der(P) + prol.ddhp*der(hl)) = BQl; + rhol*der(Vl) + Vl*(ddphl*der(P) + ddhpl*der(hl)) = BQl; else 0 = BQl; end if; /* Vapor phase mass balance equation */ - BQv = Cv.Q + Qevap - Qcond + proe.x*Ce.Q; + BQv = Cv.Q + Qevap - Qcond + Medium.vapourQuality(state_in_l)*Ce.Q; if dynamic_energy_balance then - rhov*der(Vv) + Vv*(prov.ddph*der(P) + prov.ddhp*der(hv)) = BQv; + rhov*der(Vv) + Vv*(ddphv*der(P) + ddhpv*der(hv)) = BQv; else 0 = BQv; end if; @@ -347,19 +343,19 @@ equation Cl.P = Pfond; /* Liquid phase energy balance equation */ - BHl = -Cl.Q*(Cl.h - (hl - P/rhol)) + Qcond*(lsat.h - (hl - P/rhol)) - Qevap*(vsat.h - (hl - P/rhol)) + (1 - proe.x)*Ce.Q*((if (proe.x > 0) then lsat.h else Ce.h) - (hl - P/rhol)) - Wpl + Wvl + W1t + Jt_l; + BHl = -Cl.Q*(Cl.h - (hl - P/rhol)) + Qcond*(hlsat - (hl - P/rhol)) - Qevap*(hvsat - (hl - P/rhol)) + (1 - Medium.vapourQuality(state_in_l))*Ce.Q*((if (Medium.vapourQuality(state_in_l) > 0) then hlsat else Ce.h) - (hl - P/rhol)) - Wpl + Wvl + W1t + Jt_l; if dynamic_energy_balance then - Vl*((P/rhol*prol.ddph - 1)*der(P) + (P/rhol*prol.ddhp + rhol)*der(hl)) = BHl; + Vl*((P/rhol*ddphl - 1)*der(P) + (P/rhol*ddhpl + rhol)*der(hl)) = BHl; else 0 = BHl; end if; /* Gas phase energy balance equation */ - BHv = Cv.Q*(Cv.h - (hv - P/rhov)) + Qevap*(vsat.h - (hv - P/rhov)) - Qcond*(lsat.h - (hv - P/rhov)) + proe.x*Ce.Q*((if (proe.x < 1) then vsat.h else Ce.h) - (hv - P/rhov)) - Wvl - Wpv + W2t + W3t + Jt_v; + BHv = Cv.Q*(Cv.h - (hv - P/rhov)) + Qevap*(hvsat - (hv - P/rhov)) - Qcond*(hlsat - (hv - P/rhov)) + Medium.vapourQuality(state_in_l)*Ce.Q*((if (Medium.vapourQuality(state_in_l) < 1) then hvsat else Ce.h) - (hv - P/rhov)) - Wvl - Wpv + W2t + W3t + Jt_v; if dynamic_energy_balance then - Vv*((P/rhov*prov.ddph - 1)*der(P) + (P/rhov*prov.ddhp + rhov)*der(hv)) = BHv; + Vv*((P/rhov*ddphv - 1)*der(P) + (P/rhov*ddhpv + rhov)*der(hv)) = BHv; else 0 = BHv; end if; @@ -402,12 +398,12 @@ equation QS = Cl.Q /(DIc*Lc*(PasL - Dext)/PasL); Rel = noEvent( abs(QS*DH/mul)); - Prl = mul*prol.cp/kl; + Prl = mul*Medium.specificHeatCapacityCp(state_l)/kl; assert(PasL - Dext > 0, "Error Data for TwoPhaseCavity model (PasL - Dext)<= 0 "); for i in 1:Ns loop - mult[i] = ThermoSysPro.Properties.Fluid.DynamicViscosity_rhoT(rhol, Tp1[i], fluid); + mult[i] = Medium.dynamicViscosity(Medium.setState_pTX(p=P, T=Tp1[i], X=Medium.reference_X)); EE[i]= max((PasT/Dext - 1/2/((((PasL/Dext)^2 + (PasT/Dext/2)^2)^0.5/Dext) - 1)), 1); @@ -420,14 +416,14 @@ equation end if; if Cal_hconv then - /* Heat transfer coefficient of vapeur*/ - if Vertical then - // Frank P. & David P. Fundamentals of Heat Transfer For (PasL/Dext)= 1.4 - hcond2[i] = COPv*noEvent(min(1.13*(max((g*lsat.rho*(lsat.rho - vsat.rho)*kl^3*(vsat.h - lsat.h))/(max(L2, 1)*mul*abs(lsat.T - Tp2[i] + 1e-6)), 2.225e15))^0.25, 20000)); - else - // Nusselt corelation - hcond2[i] = COPv*noEvent(min(0.728*(max((g*lsat.rho*(lsat.rho - vsat.rho)*kl^3*(vsat.h - lsat.h))/(NbTubV*mul*Dext*abs(lsat.T - Tp2[i] + 1e-6)), 2.225e15))^0.25, 20000)); - end if; + /* Heat transfer coefficient of vapeur*/ + if Vertical then + // Frank P. & David P. Fundamentals of Heat Transfer For (PasL/Dext)= 1.4 + hcond2[i] = COPv*noEvent(min(1.13*(max((g*rholsat*(rholsat - rhovsat)*kl^3*(hvsat - hlsat))/(max(L2, 1)*mul*abs(Tsat - Tp2[i] + 1e-6)), 2.225e15))^0.25, 20000)); + else + // Nusselt corelation + hcond2[i] = COPv*noEvent(min(0.728*(max((g*rholsat*(rholsat - rhovsat)*kl^3*(hvsat - hlsat))/(NbTubV*mul*Dext*abs(Tsat - Tp2[i] + 1e-6)), 2.225e15))^0.25, 20000)); + end if; else hcond2[i] = COPv*hcond; end if; @@ -449,14 +445,14 @@ equation for i in 1:Ns3 loop if Cal_hconv then - /* Heat transfer coefficient of vapeur*/ - if Vertical then - // Frank P. & David P. Fundamentals of Heat Transfer For vertical plate - hcond3[i] = COPv*noEvent(min( 1.13*(max((g*lsat.rho*(lsat.rho - vsat.rho)*kl^3*(vsat.h - lsat.h))/(max(L3,1)*mul*abs(lsat.T - Tp3[i] + 1e-6)), 2.225e15))^0.25, 20000)); - else - // Nusselt corelation - hcond3[i] = COPv*noEvent(min(0.728*(max((g*lsat.rho*(lsat.rho - vsat.rho)*kl^3*(vsat.h - lsat.h))/(NbTubV*mul*Dext*abs(lsat.T - Tp3[i] + 1e-6)), 2.225e15))^0.25, 20000)); - end if; + /* Heat transfer coefficient of vapeur*/ + if Vertical then + // Frank P. & David P. Fundamentals of Heat Transfer For vertical plate + hcond3[i] = COPv*noEvent(min( 1.13*(max((g*rholsat*(rholsat - rhovsat)*kl^3*(hvsat - hlsat))/(max(L3,1)*mul*abs(Tsat - Tp3[i] + 1e-6)), 2.225e15))^0.25, 20000)); + else + // Nusselt corelation + hcond3[i] = COPv*noEvent(min(0.728*(max((g*rholsat*(rholsat - rhovsat)*kl^3*(hvsat - hlsat))/(NbTubV*mul*Dext*abs(Tsat - Tp3[i] + 1e-6)), 2.225e15))^0.25, 20000)); + end if; else hcond3[i] = COPv*hcond; end if; @@ -474,15 +470,24 @@ equation W3t = sum(dW3); /* Total power exchanged for Deheating*/ - W4t = noEvent(if (Cv.h > vsat.h) then -Cv.Q*(Cv.h - vsat.h) else -0.0001); + W4t = noEvent(if (Cv.h > hvsat) then -Cv.Q*(Cv.h - hvsat) else -0.0001); - /* Fluid composition (no balance equations) */ - Cl.ftype = ftype; + /* Traces composition balance equations */ + C_record = PhasesSeparationFunction(); + SubCSaS = SaS(); + + BSubCl = (1 - Medium.vapourQuality(state_in_l))*Ce.Q*Ce.SubC - Cl.Q*Cl.SubC + Qcond*C_record.Cl - Qevap*SubCl; + BSubCv = Cv.Q*Cv.SubC + Medium.vapourQuality(state_in_l)*Ce.Q*Ce.SubC + Qevap*SubCl - Qcond*C_record.Cg; + + if dynamic_energy_balance then + rhol*Vl*der(SubCl) + SubCl*BQl = BSubCl; + rhov*Vv*der(SubCv) + SubCv*BQv + rhov*Vv*SubCSaS = BSubCv; + else + SubCl*BQl = BSubCl; + SubCv*BQv + rhov*Vv*SubCSaS = BSubCv; + end if; - Cl.Xco2 = 0; - Cl.Xh2o = 0; - Cl.Xo2 = 0; - Cl.Xso2 = 0; + Cl.SubC = SubCl; /* Flow reversal */ if continuous_flow_reversal then @@ -530,23 +535,33 @@ equation Cl.diff_on_1 = diffusion; /* Fluid thermodynamic properties */ - proe = ThermoSysPro.Properties.Fluid.Ph(P, Ce.h, 0, fluid); - prol = ThermoSysPro.Properties.Fluid.Ph((P + Pfond)/2, hl, 0, fluid); - provIn = ThermoSysPro.Properties.Fluid.Ph(P, Cv.h, 0, fluid); - prov = ThermoSysPro.Properties.Fluid.Ph(P, hv, 0, fluid); - prod = ThermoSysPro.Properties.Fluid.Ph(Pfond, Cl.h, 0, fluid); - (lsat,vsat) = ThermoSysPro.Properties.Fluid.Water_sat_P(P, fluid); - - Tl = prol.T; - rhol = prol.d; - xl = prol.x; - - Tv = prov.T; - rhov = prov.d; - xv = prov.x; - - mul = ThermoSysPro.Properties.Fluid.DynamicViscosity_rhoT(rhol, Tl, fluid); - kl = noEvent(ThermoSysPro.Properties.Fluid.ThermalConductivity_rhoT(rhol, Tl, P, 0, fluid)); + state_in_l = Medium.setState_phX(p=P, h=Ce.h, X=Medium.reference_X); + state_l = Medium.setState_phX(p=(P + Pfond)/2, h=hl, X=Medium.reference_X); + state_v = Medium.setState_phX(p=P, h=hv, X=Medium.reference_X); + state_out_l = Medium.setState_phX(p=Pfond, h=Cl.h, X=Medium.reference_X); + sat = Medium.setSat_p(P); + sat_wall = Medium.setSat_p(P); + hlsat = Medium.bubbleEnthalpy(sat); + hvsat = Medium.dewEnthalpy(sat); + rholsat = Medium.bubbleDensity(sat_wall); + rhovsat = Medium.dewDensity(sat_wall); + Tsat = Medium.saturationTemperature(P); + + ddphl = Medium.density_derp_h(state_l); + ddhpl = Medium.density_derh_p(state_l); + ddphv = Medium.density_derp_h(state_v); + ddhpv = Medium.density_derh_p(state_v); + + Tl = Medium.temperature(state_l); + rhol = Medium.density(state_l); + xl = noEvent(max(0, min(1, (hl - hlsat)/(hvsat - hlsat)))); + + Tv = Medium.temperature(state_v); + rhov = Medium.density(state_v); + xv = noEvent(max(0, min(1, (hv - hlsat)/(hvsat - hlsat)))); + + mul = Medium.dynamicViscosity(state_l); + kl = noEvent(Medium.thermalConductivity(state_l)); annotation ( Diagram(coordinateSystem( From 49c0e867b16932fde5fc4fc2e5858d3017c0f861 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Tue, 12 May 2026 14:38:11 +0200 Subject: [PATCH 139/178] #125 TwoPhaseCavityOnePipe --- .../Volumes/TestTwoPhaseCavityOnePipe.mo | 57 +++++ .../TestTwoPhaseCavityOnePipe_Traces.mo | 63 ++++++ .../SimpleExamples/Volumes/package.order | 2 + .../Fluid/Volumes/TwoPhaseCavityOnePipe.mo | 212 +++++++++--------- 4 files changed, 230 insertions(+), 104 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestTwoPhaseCavityOnePipe.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestTwoPhaseCavityOnePipe_Traces.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestTwoPhaseCavityOnePipe.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestTwoPhaseCavityOnePipe.mo new file mode 100644 index 00000000..b435abf8 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestTwoPhaseCavityOnePipe.mo @@ -0,0 +1,57 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Volumes; +model TestTwoPhaseCavityOnePipe + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; + + ThermoSysPro.Fluid.Volumes.TwoPhaseCavityOnePipe cavity( + redeclare package Medium = Medium, + steady_state=false, + P0=13000000, + P(start=13000000, fixed=true), + hl(start=1454400), + hv(start=2.658e6), + hvIn(start=2.8e6), + xv(start=0.01), + rhol(start=670), + rhov(start=78), + Ns=2, + Vf0=0.5, + Cal_hcond=false) annotation (Placement(transformation(extent={{-20,-20},{40,40}}, rotation=0))); + + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceWater( + redeclare package Medium = Medium, + Q0=1, + h0=1454400) annotation (Placement(transformation(extent={{-100,0},{-80,20}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceSteamBP( + redeclare package Medium = Medium, + Q0=1, + h0=2.8e6) annotation (Placement(transformation(extent={{-80,50},{-60,70}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceSteamGCT( + redeclare package Medium = Medium, + Q0=1, + h0=2.8e6) annotation (Placement(transformation(extent={{-110,50},{-90,70}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkWater( + redeclare package Medium = Medium, + Q0=3) annotation (Placement(transformation(extent={{-90,-60},{-70,-40}}, rotation=0))); + + ThermoSysPro.Thermal.BoundaryConditions.HeatSource heatSource( + T0={293.15, 293.15}, + option_temperature=2, + W0={1e5, 1e5}) annotation (Placement(transformation(extent={{70,30},{90,50}}, rotation=0))); +equation + connect(sourceWater.C, cavity.Ce) annotation (Line(points={{-80,10},{-26,10},{-26,25.8},{-12.971,25.8}}, + color={0,0,0})); + connect(sourceSteamBP.C, cavity.CvBP) annotation (Line(points={{-60,60},{9.82857,60},{9.82857,32}}, + color={0,0,0})); + connect(sourceSteamGCT.C, cavity.CvGCT) annotation (Line(points={{-90,60},{-84,60},{-84,46},{-2.857,46},{-2.857,32}}, + color={0,0,0})); + connect(cavity.Cl, sinkWater.C) annotation (Line(points={{10,-12},{10,-34},{-94,-34},{-94,-50},{-90,-50}}, + color={0,0,0})); + connect(cavity.Cth3, heatSource.C) annotation (Line(points={{9.82857,21.2},{50,21.2},{50,30.2},{80,30.2}}, + color={255,0,0})); + annotation ( + experiment(StopTime=1000), + Icon(coordinateSystem(preserveAspectRatio=false)), + Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-120,-100},{120,80}}))); +end TestTwoPhaseCavityOnePipe; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestTwoPhaseCavityOnePipe_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestTwoPhaseCavityOnePipe_Traces.mo new file mode 100644 index 00000000..a08ab52e --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestTwoPhaseCavityOnePipe_Traces.mo @@ -0,0 +1,63 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Volumes; +model TestTwoPhaseCavityOnePipe_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Fluid.Examples.SimpleExamples.Media.WaterSteam_FullyVolatileTrace; + + ThermoSysPro.Fluid.Volumes.TwoPhaseCavityOnePipe cavity( + redeclare package Medium = Medium, + redeclare function PhasesSeparationFunction = Medium.PhasesSeparation(x=cavity.xv), + steady_state=false, + P0=13000000, + P(start=13000000, fixed=true), + hl(start=1454400), + hv(start=2.658e6), + hvIn(start=2.8e6), + xv(start=0.01), + rhol(start=670), + rhov(start=78), + Ns=2, + Vf0=0.5, + Cal_hcond=false, + SubCl0={1}, + SubCv0={10}) annotation (Placement(transformation(extent={{-20,-20},{40,40}}, rotation=0))); + + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceWater( + redeclare package Medium = Medium, + Q0=1, + h0=1454400, + SubC0={1}) annotation (Placement(transformation(extent={{-100,0},{-80,20}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceSteamBP( + redeclare package Medium = Medium, + Q0=1, + h0=2.8e6, + SubC0={10}) annotation (Placement(transformation(extent={{-80,50},{-60,70}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceSteamGCT( + redeclare package Medium = Medium, + Q0=1, + h0=2.8e6, + SubC0={10}) annotation (Placement(transformation(extent={{-110,50},{-90,70}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkWater( + redeclare package Medium = Medium, + Q0=0) annotation (Placement(transformation(extent={{-90,-60},{-70,-40}}, rotation=0))); + + ThermoSysPro.Thermal.BoundaryConditions.HeatSource heatSource( + T0={293.15, 293.15}, + option_temperature=2, + W0={1e5, 1e5}) annotation (Placement(transformation(extent={{70,30},{90,50}}, rotation=0))); +equation + connect(sourceWater.C, cavity.Ce) annotation (Line(points={{-80,10},{-26,10},{-26,25.8},{-12.971,25.8}}, + color={0,0,0})); + connect(sourceSteamBP.C, cavity.CvBP) annotation (Line(points={{-60,60},{9.82857,60},{9.82857,32}}, + color={0,0,0})); + connect(sourceSteamGCT.C, cavity.CvGCT) annotation (Line(points={{-90,60},{-84,60},{-84,46},{-2.857,46},{-2.857,32}}, + color={0,0,0})); + connect(cavity.Cl, sinkWater.C) annotation (Line(points={{10,-12},{10,-34},{-94,-34},{-94,-50},{-90,-50}}, + color={0,0,0})); + connect(cavity.Cth3, heatSource.C) annotation (Line(points={{9.82857,21.2},{50,21.2},{50,30.2},{80,30.2}}, + color={255,0,0})); + annotation ( + experiment(StopTime=1000), + Icon(coordinateSystem(preserveAspectRatio=false)), + Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-120,-100},{120,80}}))); +end TestTwoPhaseCavityOnePipe_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order index 1949b3fe..f8cc92cc 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/package.order @@ -38,5 +38,7 @@ TestTwoPhaseVolume TestTwoPhaseVolume_Traces TestTwoPhaseCavity TestTwoPhaseCavity_Traces +TestTwoPhaseCavityOnePipe +TestTwoPhaseCavityOnePipe_Traces TestPressurizer TestPressurizer_Traces diff --git a/ThermoSysPro/Fluid/Volumes/TwoPhaseCavityOnePipe.mo b/ThermoSysPro/Fluid/Volumes/TwoPhaseCavityOnePipe.mo index fa24d18e..6be384a6 100644 --- a/ThermoSysPro/Fluid/Volumes/TwoPhaseCavityOnePipe.mo +++ b/ThermoSysPro/Fluid/Volumes/TwoPhaseCavityOnePipe.mo @@ -1,9 +1,9 @@ within ThermoSysPro.Fluid.Volumes; model TwoPhaseCavityOnePipe "TwoPhaseCavity for one shell pass " - extends - ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.WaterSteamFluidTypeParameterInterface; extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialTwoPhaseThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable function SaS = Medium.noSaS(SubC = SubCv) annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable function PhasesSeparationFunction = Medium.HomogeneousPhasesSeparation(SubC = CvBP.SubC) annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Boolean Vertical=true "true: vertical cylinder - false: horizontal cylinder"; parameter Units.SI.Radius R=1.05 "Radius of the Cavity cross-sectional area"; @@ -41,13 +41,19 @@ model TwoPhaseCavityOnePipe "TwoPhaseCavity for one shell pass " steady_state)); parameter Boolean continuous_flow_reversal=false "true: continuous flow reversal - false: discontinuous flow reversal"; parameter Boolean diffusion=false "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; + parameter Medium.ExtraProperty SubCl0[Medium.nC](quantity=Medium.extraPropertiesNames)=Medium.C_default + "Initial liquid phase trace substances" + annotation (Evaluate=true, Dialog(enable=dynamic_energy_balance and not steady_state)); + parameter Medium.ExtraProperty SubCv0[Medium.nC](quantity=Medium.extraPropertiesNames)=Medium.C_default + "Initial vapor phase trace substances" + annotation (Evaluate=true, Dialog(enable=dynamic_energy_balance and not steady_state)); protected constant Units.SI.Acceleration g=Modelica.Constants.g_n "Gravity constant"; constant Real pi=Modelica.Constants.pi; - parameter Integer fluid=Integer(ftype) "Fluid number"; parameter Units.SI.MassFlowRate gamma0=1.e-4 "Pseudo-diffusion conductance use for continuous flow reversal (active if diffusion=false and continuous_flow_reversal = true)"; + Medium.C_BiPhase C_record; public Units.SI.Pressure P(start=10000) "Fluid average pressure"; @@ -113,7 +119,6 @@ public "Heat exchange coefficient between the liquid phase and the wall"; Units.SI.CoefficientOfHeatTransfer Kvp(start=10) "Heat exchange coefficient between the gas phase and the wall"; - FluidType fluids[5] "Fluids mixing in volume"; Units.SI.Power Je "Thermal power diffusion from inlet Ce"; Units.SI.Power JvGCT "Thermal power diffusion from inlet CvGCT"; Units.SI.Power JvBP "Thermal power diffusion from inlet CvBP"; @@ -128,22 +133,33 @@ public Real rvGCT "Value of r(Q/gamma) for inlet CvGCT"; Real rvBP "Value of r(Q/gamma) for inlet CvBP"; Real rl "Value of r(Q/gamma) for outlet Cl"; - - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph prol - "Propri鴩s de l'eau dans le ballon" annotation (Placement(transformation( - extent={{-250,70},{-210,110}}, rotation=0))); - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph prov - "Propri鴩s de la vapeur dans le ballon" annotation (Placement( - transformation(extent={{60,70},{100,110}}, rotation=0))); - ThermoSysPro.Properties.WaterSteam.Common.PropThermoSat lsat - annotation (Placement(transformation(extent={{-250,-200},{-210,-160}}, - rotation=0))); - ThermoSysPro.Properties.WaterSteam.Common.PropThermoSat vsat - annotation (Placement(transformation( - extent={{58,-200},{98,-160}}, rotation=0))); - Interfaces.Connectors.FluidInlet CvBP "Steam input" annotation (Placement( + Medium.ExtraProperty BSubCl[Medium.nC](quantity=Medium.extraPropertiesNames) + "Right hand side of the trace balance equation of the liquid phase"; + Medium.ExtraProperty BSubCv[Medium.nC](quantity=Medium.extraPropertiesNames) + "Right hand side of the trace balance equation of the vapor phase"; + Medium.ExtraProperty SubCl[Medium.nC](quantity=Medium.extraPropertiesNames, start=Medium.C_default) + "Liquid phase trace substances"; + Medium.ExtraProperty SubCv[Medium.nC](quantity=Medium.extraPropertiesNames, start=Medium.C_default) + "Vapor phase trace substances"; + Medium.ExtraProperty SubCSaS[Medium.nC](quantity=Medium.extraPropertiesNames) + "Trace modification in the trace balance equation"; + + Medium.ThermodynamicState state_l "Liquid state in the cavity"; + Medium.ThermodynamicState state_v "Vapor state in the cavity"; + Medium.ThermodynamicState state_in_l "Water inlet state"; + Medium.ThermodynamicState state_in_v "Average vapor inlet state"; + Medium.ThermodynamicState state_out_l "Water outlet state"; + Medium.SaturationProperties sat "Saturation properties at cavity pressure"; + Units.SI.SpecificEnthalpy hlsat "Bubble enthalpy at cavity pressure"; + Units.SI.SpecificEnthalpy hvsat "Dew enthalpy at cavity pressure"; + Real ddphl "Liquid density derivative wrt. pressure at constant enthalpy"; + Real ddhpl "Liquid density derivative wrt. enthalpy at constant pressure"; + Real ddphv "Vapor density derivative wrt. pressure at constant enthalpy"; + Real ddhpv "Vapor density derivative wrt. enthalpy at constant pressure"; + + Interfaces.Connectors.FluidInlet CvBP(redeclare package Medium = Medium) "Steam input" annotation (Placement( transformation(extent={{-86,50},{-66,70}}, rotation=0))); - Interfaces.Connectors.FluidOutlet Cl "Water output" annotation (Placement( + Interfaces.Connectors.FluidOutlet Cl(redeclare package Medium = Medium) "Water output" annotation (Placement( transformation(extent={{-85,-170},{-65,-150}}, rotation=0))); ThermoSysPro.Thermal.Connectors.ThermalPort Cth3[Ns] annotation (Placement(transformation( @@ -152,18 +168,9 @@ public "Water level" annotation (Placement(transformation( extent={{88,-107},{108,-87}}, rotation=0))); public - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph prod - annotation (Placement(transformation(extent={{-250,-16},{-210,24}}, - rotation=0))); - Interfaces.Connectors.FluidInlet Ce "Water input" annotation (Placement( + Interfaces.Connectors.FluidInlet Ce(redeclare package Medium = Medium) "Water input" annotation (Placement( transformation(extent={{-219,19},{-199,39}}, rotation=0))); - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph proe - "Propri鴩s de l'eau dans le ballon" annotation (Placement(transformation( - extent={{-250,-106},{-210,-66}}, rotation=0))); - Properties.WaterSteam.Common.ThermoProperties_ph provIn - "Propri鴩s de la vapeur dans le ballon" annotation (Placement( - transformation(extent={{0,70},{40,110}}, rotation=0))); - Interfaces.Connectors.FluidInlet CvGCT "Steam input" annotation (Placement( + Interfaces.Connectors.FluidInlet CvGCT(redeclare package Medium = Medium) "Steam input" annotation (Placement( transformation(extent={{-160,50},{-140,70}}, rotation=0))); initial equation if dynamic_energy_balance then @@ -175,27 +182,21 @@ initial equation der(P) = 0; der(Tp) = 0; der(hvIn) = 0; + der(SubCl) = fill(0, Medium.nC); + der(SubCv) = fill(0, Medium.nC); else - hl = lsat.h; - hv = vsat.h; + hl = hlsat; + hv = hvsat; Vl = Vf0*V; P = P0; Tp = 320; hvIn = hv; + SubCl = SubCl0; + SubCv = SubCv0; end if; end if; equation - /* Check that incoming fluids are compatible with fluid in volume */ - fluids[1] = ftype; - fluids[2] = Ce.ftype; - fluids[3] = CvGCT.ftype; - fluids[4] = CvBP.ftype; - fluids[5] = Cl.ftype; - - assert(ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.isCompatible(fluids), - "TwoPhaseCavityOnePipe: fluids mixing in volume are not compatible with each other"); - /* Unconnected connectors */ if (cardinality(Ce) == 0) then Ce.Q = 0; @@ -203,11 +204,7 @@ equation Ce.h_vol_1 = 1.e5; Ce.diff_res_1 = 0; Ce.diff_on_1 = false; - Ce.ftype = ftype; - Ce.Xco2 = 0; - Ce.Xh2o = 0; - Ce.Xo2 = 0; - Ce.Xso2 = 0; + Ce.SubC = Medium.C_default; end if; if (cardinality(CvGCT) == 0) then @@ -216,11 +213,7 @@ equation CvGCT.h_vol_1 = 1.e5; CvGCT.diff_res_1 = 0; CvGCT.diff_on_1 = false; - CvGCT.ftype = ftype; - CvGCT.Xco2 = 0; - CvGCT.Xh2o = 0; - CvGCT.Xo2 = 0; - CvGCT.Xso2 = 0; + CvGCT.SubC = Medium.C_default; end if; if (cardinality(CvBP) == 0) then @@ -229,11 +222,7 @@ equation CvBP.h_vol_1 = 1.e5; CvBP.diff_res_1 = 0; CvBP.diff_on_1 = false; - CvBP.ftype = ftype; - CvBP.Xco2 = 0; - CvBP.Xh2o = 0; - CvBP.Xo2 = 0; - CvBP.Xso2 = 0; + CvBP.SubC = Medium.C_default; end if; if (cardinality(Cl) == 0) then @@ -274,22 +263,22 @@ equation Ape = Alp + Avp; /* Pressure at the bottom of the cavity */ - Pfond = P + prod.d*g*zl; + Pfond = P + Medium.density(state_out_l)*g*zl; /* Liquid phase mass balance equation */ - BQl = -Cl.Q + Qcond + QcondS + (1 - proe.x)*Ce.Q; + BQl = -Cl.Q + Qcond + QcondS + (1 - Medium.vapourQuality(state_in_l))*Ce.Q; if dynamic_energy_balance then - rhol*der(Vl) + Vl*(prol.ddph*der(P) + prol.ddhp*der(hl)) = BQl; + rhol*der(Vl) + Vl*(ddphl*der(P) + ddhpl*der(hl)) = BQl; else 0 = BQl; end if; /* Vapor phase mass balance equation */ - BQv = CvBP.Q + CvGCT.Q - Qcond - QcondS + proe.x*Ce.Q; + BQv = CvBP.Q + CvGCT.Q - Qcond - QcondS + Medium.vapourQuality(state_in_l)*Ce.Q; if dynamic_energy_balance then - rhov*der(Vv) + Vv*(prov.ddph*der(P) + prov.ddhp*der(hv)) = BQv; + rhov*der(Vv) + Vv*(ddphv*der(P) + ddhpv*der(hv)) = BQv; else 0 = BQv; end if; @@ -300,19 +289,19 @@ equation Ce.P = P; /* Liquid phase energy balance equation */ - BHl = -Cl.Q*(Cl.h - (hl - P/rhol)) + (Qcond + QcondS)*(lsat.h - (hl - P/rhol)) + (1 - proe.x)*Ce.Q*((if (proe.x > 0) then lsat.h else Ce.h) - (hl - P/rhol)) - Wlp + Wvl + Jt_l; + BHl = -Cl.Q*(Cl.h - (hl - P/rhol)) + (Qcond + QcondS)*(hlsat - (hl - P/rhol)) + (1 - Medium.vapourQuality(state_in_l))*Ce.Q*((if (Medium.vapourQuality(state_in_l) > 0) then hlsat else Ce.h) - (hl - P/rhol)) - Wlp + Wvl + Jt_l; if dynamic_energy_balance then - Vl*((P/rhol*prol.ddph - 1)*der(P) + (P/rhol*prol.ddhp + rhol)*der(hl)) = BHl; + Vl*((P/rhol*ddphl - 1)*der(P) + (P/rhol*ddhpl + rhol)*der(hl)) = BHl; else 0 = BHl; end if; /* Gas phase energy balance equation */ - BHv = CvBP.Q*(CvBP.h - (hv - P/rhov)) + CvGCT.Q*(CvGCT.h - (hv - P/rhov)) - (Qcond + QcondS)*(lsat.h - (hv - P/rhov)) + proe.x*Ce.Q*((if (proe.x < 1) then vsat.h else Ce.h) - (hv - P/rhov)) - Wvl - Wvp + Wt + Jt_v; + BHv = CvBP.Q*(CvBP.h - (hv - P/rhov)) + CvGCT.Q*(CvGCT.h - (hv - P/rhov)) - (Qcond + QcondS)*(hlsat - (hv - P/rhov)) + Medium.vapourQuality(state_in_l)*Ce.Q*((if (Medium.vapourQuality(state_in_l) < 1) then hvsat else Ce.h) - (hv - P/rhov)) - Wvl - Wvp + Wt + Jt_v; if dynamic_energy_balance then - Vv*((P/rhov*prov.ddph - 1)*der(P) + (P/rhov*prov.ddhp + rhov)*der(hv)) = BHv; + Vv*((P/rhov*ddphv - 1)*der(P) + (P/rhov*ddhpv + rhov)*der(hv)) = BHv; else 0 = BHv; end if; @@ -324,25 +313,34 @@ equation /* Condensation mass flow rates */ // Only the power used to condensate steam - Qcond = (-Wt + Wt2 + noEvent(max(Wvl, 0)) + Wvp)/(vsat.h - lsat.h); + Qcond = (-Wt + Wt2 + noEvent(max(Wvl, 0)) + Wvp)/(hvsat - hlsat); - QcondS = (1 - provIn.x)*(CvBP.Q + CvGCT.Q); + QcondS = (1 - Medium.vapourQuality(state_in_v))*(CvBP.Q + CvGCT.Q); /* Steam average specific enthalpy input cavity */ // 0 = noEvent(hvIn*(max(CvBP.Q, 1e-10) + max(CvGCT.Q, 1e-10)) - max(CvBP.Q, 1e-10)*CvBP.h - max(CvGCT.Q, 1e-10)*CvGCT.h); if dynamic_energy_balance then - 0.1*provIn.d*der(hvIn) = CvBP.Q*(CvBP.h - (hvIn - P/rhov)) + CvGCT.Q*(CvGCT.h - (hvIn - P/rhov)); + 0.1*Medium.density(state_in_v)*der(hvIn) = CvBP.Q*(CvBP.h - (hvIn - P/rhov)) + CvGCT.Q*(CvGCT.h - (hvIn - P/rhov)); else 0 = hvIn*(CvBP.Q + CvGCT.Q) - CvBP.Q*CvBP.h - CvGCT.Q*CvGCT.h; end if; - /* Fluid composition (no balance equations) */ - Cl.ftype = ftype; + /* Traces composition balance equations */ + C_record = PhasesSeparationFunction(); + SubCSaS = SaS(); + + BSubCl = (1 - Medium.vapourQuality(state_in_l))*Ce.Q*Ce.SubC - Cl.Q*Cl.SubC + (Qcond + QcondS)*C_record.Cl; + BSubCv = CvBP.Q*CvBP.SubC + CvGCT.Q*CvGCT.SubC + Medium.vapourQuality(state_in_l)*Ce.Q*Ce.SubC - (Qcond + QcondS)*C_record.Cg; + + if dynamic_energy_balance then + rhol*Vl*der(SubCl) + SubCl*BQl = BSubCl; + rhov*Vv*der(SubCv) + SubCv*BQv + rhov*Vv*SubCSaS = BSubCv; + else + SubCl*BQl = BSubCl; + SubCv*BQv + rhov*Vv*SubCSaS = BSubCv; + end if; - Cl.Xco2 = 0; - Cl.Xh2o = 0; - Cl.Xo2 = 0; - Cl.Xso2 = 0; + Cl.SubC = SubCl; /* Flow reversal */ if continuous_flow_reversal then @@ -398,41 +396,47 @@ equation Cl.diff_on_1 = diffusion; /* Fluid thermodynamic properties*/ - proe = ThermoSysPro.Properties.Fluid.Ph(P, Ce.h, 0, fluid); - prol = ThermoSysPro.Properties.Fluid.Ph((P+Pfond)/2, hl, 0, fluid); - - provIn = ThermoSysPro.Properties.Fluid.Ph(P, hvIn, 0, fluid); - prov = ThermoSysPro.Properties.Fluid.Ph(P, hv, 0, fluid); - prod = ThermoSysPro.Properties.Fluid.Ph(Pfond, Cl.h, 0, fluid); - (lsat,vsat) = ThermoSysPro.Properties.Fluid.Water_sat_P(P,fluid); - - Tl = prol.T; - rhol = prol.d; - xl = prol.x; - - Tv = prov.T; - rhov = prov.d; - xv = prov.x; - - muv = ThermoSysPro.Properties.Fluid.DynamicViscosity_rhoT(provIn.d, provIn.T, fluid); - mul = ThermoSysPro.Properties.Fluid.DynamicViscosity_rhoT(rhol, Tl, fluid); - kl = noEvent(ThermoSysPro.Properties.Fluid.ThermalConductivity_rhoT(rhol, Tl, P, 0, fluid)); - kv = noEvent(ThermoSysPro.Properties.Fluid.ThermalConductivity_rhoT(provIn.d, provIn.T, P, 0,fluid)); + state_in_l = Medium.setState_phX(p=P, h=Ce.h, X=Medium.reference_X); + state_l = Medium.setState_phX(p=(P + Pfond)/2, h=hl, X=Medium.reference_X); + state_in_v = Medium.setState_phX(p=P, h=hvIn, X=Medium.reference_X); + state_v = Medium.setState_phX(p=P, h=hv, X=Medium.reference_X); + state_out_l = Medium.setState_phX(p=Pfond, h=Cl.h, X=Medium.reference_X); + sat = Medium.setSat_p(P); + hlsat = Medium.bubbleEnthalpy(sat); + hvsat = Medium.dewEnthalpy(sat); + + ddphl = Medium.density_derp_h(state_l); + ddhpl = Medium.density_derh_p(state_l); + ddphv = Medium.density_derp_h(state_v); + ddhpv = Medium.density_derh_p(state_v); + + Tl = Medium.temperature(state_l); + rhol = Medium.density(state_l); + xl = noEvent(max(0, min(1, (hl - hlsat)/(hvsat - hlsat)))); + + Tv = Medium.temperature(state_v); + rhov = Medium.density(state_v); + xv = noEvent(max(0, min(1, (hv - hlsat)/(hvsat - hlsat)))); + + muv = Medium.dynamicViscosity(state_in_v); + mul = Medium.dynamicViscosity(state_l); + kl = noEvent(Medium.thermalConductivity(state_l)); + kv = noEvent(Medium.thermalConductivity(state_in_v)); /* Heat transfer coefficient between liquid and wall*/ /* SACADURA, Von Karman equation*/ Rel = noEvent(abs(Cl.Q*zl/(pi*R^2*mul))); - Klp = 0.037*kl*Rel^0.8*(mul*prol.cp/kl)^0.3333/zl; + Klp = 0.037*kl*Rel^0.8*(mul*Medium.specificHeatCapacityCp(state_l)/kl)^0.3333/zl; /* Heat transfer coefficient between steam and wall*/ - Rev = noEvent(abs((CvBP.Q + CvGCT.Q + proe.x*Ce.Q)*(L - zl)/(pi*R^2*muv))); - Revl = noEvent(abs((CvBP.Q + CvGCT.Q + proe.x*Ce.Q)*(2*R)/(pi*R^2*muv))); + Rev = noEvent(abs((CvBP.Q + CvGCT.Q + Medium.vapourQuality(state_in_l)*Ce.Q)*(L - zl)/(pi*R^2*muv))); + Revl = noEvent(abs((CvBP.Q + CvGCT.Q + Medium.vapourQuality(state_in_l)*Ce.Q)*(2*R)/(pi*R^2*muv))); - Kvp = 0.037*kv*Rev^0.8*(muv*prov.cp/kv)^0.3333/(L - zl); + Kvp = 0.037*kv*Rev^0.8*(muv*Medium.specificHeatCapacityCp(state_v)/kv)^0.3333/(L - zl); /* Heat transfer coefficient between steam and liquid */ - Kvl = 0.105*kv*Revl^0.68*(muv*prov.cp/kv)^0.33333*(L/2/R)^(-0.103)/(2*R); + Kvl = 0.105*kv*Revl^0.68*(muv*Medium.specificHeatCapacityCp(state_v)/kv)^0.33333*(L/2/R)^(-0.103)/(2*R); /* Thermal power losses*/ /* Energy balance equation at the wall */ @@ -459,8 +463,8 @@ equation if Cal_hcond then // Nusselt corelation hcond3[i] = ThermoSysPro.Functions.SmoothCond(Tv - Tp1[i], - COP*0.728*((g*rhol*(rhol - rhov)*kl^3*(vsat.h - lsat.h))/(NbTubV*mul*Dext*ThermoSysPro.Functions.SmoothMax((Tv-Tp1[i]), 0.1)))^0.25, - COP*0.728*((g*rhol*(rhol - rhov)*kl^3*(vsat.h -lsat.h))/(NbTubV*mul*Dext*0.1))^0.25); + COP*0.728*((g*rhol*(rhol - rhov)*kl^3*(hvsat - hlsat))/(NbTubV*mul*Dext*ThermoSysPro.Functions.SmoothMax((Tv-Tp1[i]), 0.1)))^0.25, + COP*0.728*((g*rhol*(rhol - rhov)*kl^3*(hvsat - hlsat))/(NbTubV*mul*Dext*0.1))^0.25); else hcond3[i] = hcond; end if; @@ -473,7 +477,7 @@ equation /* Total power exchanged for deheating*/ /* This equation is not valid for mass flow rate in the pipes = 0 */ - Wt2 = noEvent(if (hvIn > vsat.h) then -(CvBP.Q + CvGCT.Q)*(hvIn - vsat.h) else 0); + Wt2 = noEvent(if (hvIn > hvsat) then -(CvBP.Q + CvGCT.Q)*(hvIn - hvsat) else 0); annotation ( Diagram(coordinateSystem( From d1073aad7f8c1c67df2aa1dbd1dcb0c64d4f383e Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Tue, 12 May 2026 14:56:08 +0200 Subject: [PATCH 140/178] #125 modified StaticDrum for subC balance --- .../Junctions/TestStaticDrum_Plug_Traces.mo | 11 ++++--- .../Junctions/TestStaticDrum_Traces.mo | 13 ++++---- .../PhasesSeparation.mo | 2 +- ThermoSysPro/Fluid/Junctions/StaticDrum.mo | 30 +++++++++++++++---- 4 files changed, 37 insertions(+), 19 deletions(-) diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestStaticDrum_Plug_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestStaticDrum_Plug_Traces.mo index 5da9e6d3..b8cd3e1d 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestStaticDrum_Plug_Traces.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestStaticDrum_Plug_Traces.mo @@ -2,11 +2,10 @@ within ThermoSysPro.Fluid.Examples.SimpleExamples.Junctions; model TestStaticDrum_Plug_Traces extends ThermoSysPro.UsersGuide.Icons.Example; - replaceable package Medium = Properties.Media.WaterSteam ( - extraPropertiesNames={"Trace"}, - C_nominal={0.1}, - C_default={0.2}); - ThermoSysPro.Fluid.Junctions.StaticDrum StaticDrumTh1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-54,0},{-34,20}}, rotation=0))); + replaceable package Medium = ThermoSysPro.Fluid.Examples.SimpleExamples.Media.WaterSteam_NonVolatileTrace; + ThermoSysPro.Fluid.Junctions.StaticDrum StaticDrumTh1( + redeclare package Medium = Medium, + redeclare function PhasesSeparationFunction = Medium.PhasesSeparation(x=StaticDrumTh1.x)) annotation (Placement(transformation(extent={{-54,0},{-34,20}}, rotation=0))); ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLossVALI1(redeclare package Medium = Medium, K=1e-4) annotation (Placement(transformation(extent={{0,-10},{20,10}}, rotation=0))); ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLossVALI2(redeclare package Medium = Medium, K=1e-4) annotation (Placement(transformation(extent={{-80,-50},{-60,-30}}, rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkP1(redeclare package Medium = Medium, Q0=10) annotation (Placement(transformation(extent={{40,-10},{60,10}}, rotation=0))); @@ -18,7 +17,7 @@ model TestStaticDrum_Plug_Traces ThermoSysPro.Fluid.BoundaryConditions.Sink sinkP2(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{60,50},{80,70}}, rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.RefP refP(redeclare package Medium = Medium, P0=3e5) annotation (Placement(transformation(extent={{-26,-90},{-6,-70}}, rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.RefQ refQ(redeclare package Medium = Medium, Q0=100) annotation (Placement(transformation(extent={{-56,-90},{-36,-70}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.PlugA sourcePlug(redeclare package Medium = Medium, C(h(fixed=true))) annotation (Placement(transformation(extent={{-90,-90},{-70,-70}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.PlugA sourcePlug(redeclare package Medium = Medium, C(h(fixed=false), SubC={10})) annotation (Placement(transformation(extent={{-90,-90},{-70,-70}}, rotation=0))); equation connect(singularPressureLossVALI2.C2, StaticDrumTh1.Ce_eco) annotation (Line(points={{-60,-40},{-60,0.6},{-48,0.6}}, color={0,0,255})); connect(singularPressureLossVALI1.C2, sinkP1.C) annotation (Line(points={{20,0},{40,0}}, color={0,0,255})); diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestStaticDrum_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestStaticDrum_Traces.mo index 10270d0f..3d5d4c78 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestStaticDrum_Traces.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestStaticDrum_Traces.mo @@ -2,15 +2,16 @@ within ThermoSysPro.Fluid.Examples.SimpleExamples.Junctions; model TestStaticDrum_Traces extends ThermoSysPro.UsersGuide.Icons.Example; - replaceable package Medium = Properties.Media.WaterSteam ( - extraPropertiesNames={"Trace"}, - C_nominal={0.1}, - C_default={0.2}); - ThermoSysPro.Fluid.Junctions.StaticDrum StaticDrumTh1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-54,0},{-34,20}}, rotation=0))); + replaceable package Medium = ThermoSysPro.Fluid.Examples.SimpleExamples.Media.WaterSteam_NonVolatileTrace; + ThermoSysPro.Fluid.Junctions.StaticDrum StaticDrumTh1( + redeclare package Medium = Medium, + redeclare function PhasesSeparationFunction = Medium.PhasesSeparation(x=StaticDrumTh1.x)) annotation (Placement(transformation(extent={{-54,0},{-34,20}}, rotation=0))); ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLossVALI1(redeclare package Medium = Medium, K=1e-4) annotation (Placement(transformation(extent={{0,-10},{20,10}}, rotation=0))); ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLossVALI2(redeclare package Medium = Medium, K=1e-4) annotation (Placement(transformation(extent={{-80,-50},{-60,-30}}, rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkP1(redeclare package Medium = Medium, Q0=10) annotation (Placement(transformation(extent={{40,-10},{60,10}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare package Medium = Medium, P0=100e5) annotation (Placement(transformation(extent={{-90,-90},{-70,-70}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare package Medium = Medium, + P0=10000000, + SubC0={10}) annotation (Placement(transformation(extent={{-90,-90},{-70,-70}}, rotation=0))); ThermoSysPro.Thermal.BoundaryConditions.HeatSink heatSource annotation (Placement(transformation(extent={{-80,20},{-60,40}}, rotation=0))); ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLossVALI3(redeclare package Medium = Medium, K=1e-4) annotation (Placement(transformation(extent={{-20,50},{0,70}}, rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.Sink sinkP2(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{60,50},{80,70}}, rotation=0))); diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Media/WaterSteam_NonVolatileTrace/PhasesSeparation.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Media/WaterSteam_NonVolatileTrace/PhasesSeparation.mo index d1d7026a..b9c1251f 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Media/WaterSteam_NonVolatileTrace/PhasesSeparation.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Media/WaterSteam_NonVolatileTrace/PhasesSeparation.mo @@ -9,7 +9,7 @@ algorithm // C_record.Cg := SubC; // Non-volatile - C_record.Cl := SubC/(1 - x); + C_record.Cl := SubC/max(1 - x, Modelica.Constants.eps); C_record.Cg := fill(0, size(SubC, 1)); // // Fully-volatile diff --git a/ThermoSysPro/Fluid/Junctions/StaticDrum.mo b/ThermoSysPro/Fluid/Junctions/StaticDrum.mo index d2fcb382..1158844a 100644 --- a/ThermoSysPro/Fluid/Junctions/StaticDrum.mo +++ b/ThermoSysPro/Fluid/Junctions/StaticDrum.mo @@ -2,6 +2,7 @@ within ThermoSysPro.Fluid.Junctions; model StaticDrum "Static drum" extends ThermoSysPro.Fluid.Interfaces.IconColors; replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialTwoPhaseThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable function PhasesSeparationFunction = Medium.HomogeneousPhasesSeparation(SubC = Ce_steam.SubC) annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Real x=1 "Vapor separation efficiency at the outlet"; parameter Boolean continuous_flow_reversal=false "true: continuous flow reversal - false: discontinuous flow reversal"; @@ -20,7 +21,10 @@ public Units.SI.SpecificEnthalpy hl(start=100000) "Liquid phase specific enthalpy"; Units.SI.SpecificEnthalpy hv(start=2800000) "Gas phase specific enthalpy"; Medium.MassFraction X[Medium.nXi] "Fluid mass fraction"; - Medium.ExtraProperty SubC[Medium.nC] "Fluid trace substances"; + Medium.ExtraProperty SubCl[Medium.nC](quantity=Medium.extraPropertiesNames) "Liquid phase trace substances"; + Medium.ExtraProperty SubCv[Medium.nC](quantity=Medium.extraPropertiesNames) "Vapor phase trace substances"; + Medium.ExtraProperty SubCs_sur[Medium.nC](quantity=Medium.extraPropertiesNames) "Trace substances at the steam/reheater outlet"; + Medium.C_BiPhase C_record; Units.SI.Power Je_steam "Thermal power diffusion from inlet e_steam"; Units.SI.Power Je_sup "Thermal power diffusion from inlet e_sup"; Units.SI.Power Je_eva "Thermal power diffusion from inlet e_eva"; @@ -68,6 +72,10 @@ public extent={{-10,-10},{10,10}}, rotation=0))); Medium.SaturationProperties sat; + Medium.ThermodynamicState state_e_steam "Steam inlet state"; + Medium.ThermodynamicState state_e_sup "Extra inlet state"; + Medium.ThermodynamicState state_e_eva "Evaporator inlet state"; + Medium.ThermodynamicState state_e_eco "Economizer inlet state"; equation /* Unconnected connectors */ @@ -182,12 +190,18 @@ equation X = Cs_sur.Xi; /* Traces composition balance equations */ - fill(0, Medium.nC) = Ce_steam.SubC*Ce_steam.Q + Ce_sup.SubC*Ce_sup.Q + Ce_eva.SubC*Ce_eva.Q + Ce_eco.SubC*Ce_eco.Q - Cs_sur.SubC*Cs_sur.Q - Cs_sup.SubC*Cs_sup.Q - Cs_purg.SubC*Cs_purg.Q - Cs_eva.SubC*Cs_eva.Q; + C_record = PhasesSeparationFunction(); - SubC = Cs_eva.SubC; - SubC = Cs_purg.SubC; - SubC = Cs_sup.SubC; - SubC = Cs_sur.SubC; + fill(0, Medium.nC) = (1 - Medium.vapourQuality(state_e_steam))*Ce_steam.Q*Ce_steam.SubC + (1 - Medium.vapourQuality(state_e_sup))*Ce_sup.Q*Ce_sup.SubC + (1 - Medium.vapourQuality(state_e_eva))*Ce_eva.Q*Ce_eva.SubC + (1 - Medium.vapourQuality(state_e_eco))*Ce_eco.Q*Ce_eco.SubC - Cs_eva.Q*Cs_eva.SubC - Cs_purg.Q*Cs_purg.SubC - Cs_sup.Q*Cs_sup.SubC + Medium.vapourQuality(state_e_steam)*Ce_steam.Q*C_record.Cl + Medium.vapourQuality(state_e_sup)*Ce_sup.Q*C_record.Cl + Medium.vapourQuality(state_e_eva)*Ce_eva.Q*C_record.Cl + Medium.vapourQuality(state_e_eco)*Ce_eco.Q*C_record.Cl - (1 - x)*Cs_sur.Q*SubCl; + + fill(0, Medium.nC) = Medium.vapourQuality(state_e_steam)*Ce_steam.Q*C_record.Cg + Medium.vapourQuality(state_e_sup)*Ce_sup.Q*C_record.Cg + Medium.vapourQuality(state_e_eva)*Ce_eva.Q*C_record.Cg + Medium.vapourQuality(state_e_eco)*Ce_eco.Q*C_record.Cg - x*Cs_sur.Q*SubCv; + + SubCs_sur = (1 - x)*SubCl + x*SubCv; + + Cs_eva.SubC = SubCl; + Cs_purg.SubC = SubCl; + Cs_sup.SubC = SubCl; + Cs_sur.SubC = SubCs_sur; /* Flow reversal */ if continuous_flow_reversal then @@ -280,6 +294,10 @@ equation Cs_sur.diff_on_1 = diffusion; /* Fluid thermodynamic properties */ + state_e_steam = Medium.setState_phX(p=P, h=Ce_steam.h, X=Medium.reference_X); + state_e_sup = Medium.setState_phX(p=P, h=Ce_sup.h, X=Medium.reference_X); + state_e_eva = Medium.setState_phX(p=P, h=Ce_eva.h, X=Medium.reference_X); + state_e_eco = Medium.setState_phX(p=P, h=Ce_eco.h, X=Medium.reference_X); sat = Medium.setSat_p(P); hl = Medium.bubbleEnthalpy(sat); From 8cc4569b7bee7a8b1ff5db0a92f80681580cba85 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Tue, 12 May 2026 16:11:40 +0200 Subject: [PATCH 141/178] #125 InvSingularPressureLoss and LumpedStraightPipe --- .../TestInvSingularPressureLoss.mo | 17 ++++++++++ .../TestInvSingularPressureLoss_FlueGases.mo | 22 ++++++++++++ .../TestInvSingularPressureLoss_Traces.mo | 18 ++++++++++ .../PressureLosses/TestLumpedStraightPipe.mo | 18 ++++++++++ .../TestLumpedStraightPipe_FlueGases.mo | 23 +++++++++++++ .../TestLumpedStraightPipe_Traces.mo | 19 +++++++++++ .../PressureLosses/package.order | 6 ++++ .../PressureLosses/InvSingularPressureLoss.mo | 26 +++++--------- .../PressureLosses/LumpedStraightPipe.mo | 34 ++++++++----------- 9 files changed, 146 insertions(+), 37 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestInvSingularPressureLoss.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestInvSingularPressureLoss_FlueGases.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestInvSingularPressureLoss_Traces.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestLumpedStraightPipe.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestLumpedStraightPipe_FlueGases.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestLumpedStraightPipe_Traces.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestInvSingularPressureLoss.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestInvSingularPressureLoss.mo new file mode 100644 index 00000000..61534adc --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestInvSingularPressureLoss.mo @@ -0,0 +1,17 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.PressureLosses; +model TestInvSingularPressureLoss + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam; + ThermoSysPro.Fluid.PressureLosses.InvSingularPressureLoss invSingularPressureLoss( + redeclare replaceable package Medium = Medium) + annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP(redeclare replaceable package Medium = Medium) + annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare replaceable package Medium = Medium) + annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); +equation + connect(invSingularPressureLoss.C2, sinkP.C) annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(invSingularPressureLoss.C1, sourcePQ.C) annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestInvSingularPressureLoss; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestInvSingularPressureLoss_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestInvSingularPressureLoss_FlueGases.mo new file mode 100644 index 00000000..9fcc68d7 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestInvSingularPressureLoss_FlueGases.mo @@ -0,0 +1,22 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.PressureLosses; +model TestInvSingularPressureLoss_FlueGases + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.FlueGases; + ThermoSysPro.Fluid.PressureLosses.InvSingularPressureLoss invSingularPressureLoss( + redeclare replaceable package Medium = Medium) + annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP( + redeclare replaceable package Medium = Medium, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ( + redeclare replaceable package Medium = Medium, + P0=4500000, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); +equation + connect(invSingularPressureLoss.C2, sinkP.C) annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(invSingularPressureLoss.C1, sourcePQ.C) annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestInvSingularPressureLoss_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestInvSingularPressureLoss_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestInvSingularPressureLoss_Traces.mo new file mode 100644 index 00000000..b041dcab --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestInvSingularPressureLoss_Traces.mo @@ -0,0 +1,18 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.PressureLosses; +model TestInvSingularPressureLoss_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam(extraPropertiesNames={"Trace1", "Trace2", "Trace3"}, C_nominal={0.1, 0.2, 0.3}, C_default={0.2, 0.3, 0.4}); + ThermoSysPro.Fluid.PressureLosses.InvSingularPressureLoss invSingularPressureLoss( + redeclare replaceable package Medium = Medium) + annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP(redeclare replaceable package Medium = Medium) + annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ( + redeclare replaceable package Medium = Medium, + SubC0={10,20,30}) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); +equation + connect(invSingularPressureLoss.C2, sinkP.C) annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(invSingularPressureLoss.C1, sourcePQ.C) annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestInvSingularPressureLoss_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestLumpedStraightPipe.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestLumpedStraightPipe.mo new file mode 100644 index 00000000..8ee42b80 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestLumpedStraightPipe.mo @@ -0,0 +1,18 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.PressureLosses; +model TestLumpedStraightPipe + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam; + ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe lumpedStraightPipe( + redeclare replaceable package Medium = Medium, + L=10, + D=0.2) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package Medium = Medium) + annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare replaceable package Medium = Medium) + annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); +equation + connect(lumpedStraightPipe.C2, sink.C) annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(lumpedStraightPipe.C1, sourcePQ.C) annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestLumpedStraightPipe; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestLumpedStraightPipe_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestLumpedStraightPipe_FlueGases.mo new file mode 100644 index 00000000..623c5fdc --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestLumpedStraightPipe_FlueGases.mo @@ -0,0 +1,23 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.PressureLosses; +model TestLumpedStraightPipe_FlueGases + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.FlueGases; + ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe lumpedStraightPipe( + redeclare replaceable package Medium = Medium, + L=10, + D=0.2) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink( + redeclare replaceable package Medium = Medium, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ( + redeclare replaceable package Medium = Medium, + P0=4500000, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); +equation + connect(lumpedStraightPipe.C2, sink.C) annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(lumpedStraightPipe.C1, sourcePQ.C) annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestLumpedStraightPipe_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestLumpedStraightPipe_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestLumpedStraightPipe_Traces.mo new file mode 100644 index 00000000..52c96120 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestLumpedStraightPipe_Traces.mo @@ -0,0 +1,19 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.PressureLosses; +model TestLumpedStraightPipe_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam(extraPropertiesNames={"Trace1", "Trace2", "Trace3"}, C_nominal={0.1, 0.2, 0.3}, C_default={0.2, 0.3, 0.4}); + ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe lumpedStraightPipe( + redeclare replaceable package Medium = Medium, + L=10, + D=0.2) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package Medium = Medium) + annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ( + redeclare replaceable package Medium = Medium, + SubC0={10,20,30}) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); +equation + connect(lumpedStraightPipe.C2, sink.C) annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + connect(lumpedStraightPipe.C1, sourcePQ.C) annotation (Line(points={{-10,0},{-30,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestLumpedStraightPipe_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order index dff4b5f9..81d4ca5e 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order @@ -4,6 +4,12 @@ TestPipePressureLoss_Traces TestSingularPressureLoss TestSingularPressureLoss_Traces TestSingularPressureLoss_Traces_FlueGases +TestLumpedStraightPipe +TestLumpedStraightPipe_FlueGases +TestLumpedStraightPipe_Traces +TestInvSingularPressureLoss +TestInvSingularPressureLoss_FlueGases +TestInvSingularPressureLoss_Traces TestControlValve TestControlValve_Traces TestControlValve_Traces_FlueGases diff --git a/ThermoSysPro/Fluid/PressureLosses/InvSingularPressureLoss.mo b/ThermoSysPro/Fluid/PressureLosses/InvSingularPressureLoss.mo index e20f2e35..90c5695c 100644 --- a/ThermoSysPro/Fluid/PressureLosses/InvSingularPressureLoss.mo +++ b/ThermoSysPro/Fluid/PressureLosses/InvSingularPressureLoss.mo @@ -1,16 +1,13 @@ within ThermoSysPro.Fluid.PressureLosses; model InvSingularPressureLoss "Inverse singular pressure loss" - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Units.SI.MassFlowRate gamma_diff=1e-4 "Diffusion conductance (active if diffusion=true in neighbouring volumes)"; parameter Units.SI.Density p_rho=0 "If > 0, fixed fluid density" annotation (Evaluate=true, Dialog(tab="Fluid", group="Fluid properties")); - parameter IF97Region region=IF97Region.All_regions "IF97 region (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); protected - parameter Integer mode=Integer(region) - 1 "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; parameter Real eps=1.e-3 "Small number for pressure loss equation"; constant Real pi=Modelica.Constants.pi "pi"; parameter Units.SI.MassFlowRate Qeps=1.e-3 "Small mass flow rate"; @@ -23,13 +20,12 @@ public Units.SI.Temperature T(start=290) "Fluid temperature"; Units.SI.Density rho(start=998) "Fluid density"; Units.SI.AbsolutePressure Pm(start=1.e5) "Average fluid pressure"; - FluidType ftype "Fluid type"; - Integer fluid=Integer(ftype) "Fluid number"; + Medium.MassFraction X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Mass fractions"; public - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-110,-10},{-90,10}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{90,-10},{110,10}}, rotation=0))); equation @@ -45,31 +41,27 @@ equation C2.diff_res_1 = C1.diff_res_1 + (if (gamma_diff > 0) then 1/gamma_diff else 0); C1.diff_res_2 = C2.diff_res_2 + (if (gamma_diff > 0) then 1/gamma_diff else 0); - C1.ftype = C2.ftype; + C1.Xi = C2.Xi; + X = C1.Xi; - C1.Xco2 = C2.Xco2; - C1.Xh2o = C2.Xh2o; - C1.Xo2 = C2.Xo2; - C1.Xso2 = C2.Xso2; + C1.SubC = C2.SubC; Q = C1.Q; h = C1.h; deltaP = C1.P - C2.P; - ftype = C1.ftype; - /* Pressure loss */ deltaP = if noEvent(abs(Q) < Qeps) then 1.e-10 else K*ThermoSysPro.Functions.ThermoSquare(Q, eps)/rho; /* Fluid thermodynamic properties */ Pm = (C1.P + C2.P)/2; - T = ThermoSysPro.Properties.Fluid.Temperature_Ph(Pm, h, fluid, mode, C1.Xco2, C1.Xh2o, C1.Xo2, C1.Xso2); + T = Medium.temperature_phX(p=Pm, h=h, X=X); if (p_rho > 0) then rho = p_rho; else - rho = ThermoSysPro.Properties.Fluid.Density_Ph(Pm, h, fluid, mode, C1.Xco2, C1.Xh2o, C1.Xo2, C1.Xso2); + rho = Medium.density_phX(p=Pm, h=h, X=X); end if; annotation ( diff --git a/ThermoSysPro/Fluid/PressureLosses/LumpedStraightPipe.mo b/ThermoSysPro/Fluid/PressureLosses/LumpedStraightPipe.mo index fb8f7fb1..54439c4d 100644 --- a/ThermoSysPro/Fluid/PressureLosses/LumpedStraightPipe.mo +++ b/ThermoSysPro/Fluid/PressureLosses/LumpedStraightPipe.mo @@ -1,8 +1,7 @@ within ThermoSysPro.Fluid.PressureLosses; model LumpedStraightPipe "Lumped straight pipe (circular duct)" extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Units.SI.Length L=10. "Pipe length"; parameter Units.SI.Diameter D=0.2 "Pipe internal hydraulic diameter"; @@ -19,12 +18,10 @@ model LumpedStraightPipe "Lumped straight pipe (circular duct)" "true: momentum balance equation with inertia - false: without inertia"; parameter Units.SI.Density p_rho=0 "If > 0, fixed fluid density" annotation (Evaluate=true, Dialog(tab="Fluid", group="Fluid properties")); - parameter IF97Region region=IF97Region.All_regions "IF97 region (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); protected constant Units.SI.Acceleration g=Modelica.Constants.g_n "Gravity constant"; constant Real pi=Modelica.Constants.pi "pi"; - parameter Integer mode=Integer(region) - 1 "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; parameter Real eps=1.e-3 "Small number for pressure loss equation"; parameter Units.SI.Area A=ntubes*pi*D^2/4 "Pipe cross-sectional area (circular duct is assumed)"; @@ -47,13 +44,13 @@ public Units.SI.SpecificHeatCapacity cp(start=4200) "Fluid specific heat capacity"; Units.SI.ThermalConductivity k(start=0.05) "Fluid thermal conductivity"; Units.SI.MassFlowRate gamma_diff(start=1.e-4) "Diffusion conductance"; - FluidType ftype "Fluid type"; - Integer fluid=Integer(ftype) "Fluid number"; + Medium.MassFraction X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Mass fractions"; + Medium.ThermodynamicState state "Fluid thermodynamic state"; public - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-110,-10},{-90,10}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{90,-10},{110,10}}, rotation=0))); initial equation if inertia then @@ -74,19 +71,15 @@ equation C2.diff_res_1 = C1.diff_res_1 + 1/gamma_diff; C1.diff_res_2 = C2.diff_res_2 + 1/gamma_diff; - C1.ftype = C2.ftype; + C1.Xi = C2.Xi; + X = C1.Xi; - C1.Xco2 = C2.Xco2; - C1.Xh2o = C2.Xh2o; - C1.Xo2 = C2.Xo2; - C1.Xso2 = C2.Xso2; + C1.SubC = C2.SubC; Q = C1.Q; h = C1.h; deltaP = C1.P - C2.P; - ftype = C1.ftype; - /* Diffusion resistance */ gamma_diff = A*k/cp/L; @@ -117,17 +110,18 @@ equation /* Fluid thermodynamic properties */ Pm = (C1.P + C2.P)/2; + state = Medium.setState_phX(p=Pm, h=h, X=X); if (p_rho > 0) then rho = p_rho; else - rho = ThermoSysPro.Properties.Fluid.Density_Ph(Pm, h, fluid, mode, C1.Xco2, C1.Xh2o, C1.Xo2, C1.Xso2); + rho = Medium.density(state); end if; - T = ThermoSysPro.Properties.Fluid.Temperature_Ph(Pm, h, fluid, mode, C1.Xco2, C1.Xh2o, C1.Xo2, C1.Xso2); - mu = ThermoSysPro.Properties.Fluid.DynamicViscosity_Ph(Pm, h, fluid, mode, C1.Xco2, C1.Xh2o, C1.Xo2, C1.Xso2); - k = ThermoSysPro.Properties.Fluid.ThermalConductivity_Ph(Pm, h, fluid, mode, C1.Xco2, C1.Xh2o,C1.Xo2, C1.Xso2); - cp = ThermoSysPro.Properties.Fluid.SpecificHeatCapacityCp_Ph(Pm, h, fluid, mode, C1.Xco2, C1.Xh2o, C1.Xo2, C1.Xso2); + T = Medium.temperature(state); + mu = Medium.dynamicViscosity(state); + k = Medium.thermalConductivity(state); + cp = Medium.specificHeatCapacityCp(state); annotation ( Diagram(coordinateSystem( From ba1afafc65dc5bd8f178f016c13b46fafb267b38 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Tue, 12 May 2026 16:43:12 +0200 Subject: [PATCH 142/178] #125 StaticAerocondenser, example not working yet --- .../HeatExchangers/TestStaticAerocondenser.mo | 84 +++++ .../TestStaticAerocondenser_TSP.mo | 96 ++++++ .../HeatExchangers/package.order | 2 + .../HeatExchangers/StaticAerocondenser.mo | 317 +++--------------- 4 files changed, 221 insertions(+), 278 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticAerocondenser.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticAerocondenser_TSP.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticAerocondenser.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticAerocondenser.mo new file mode 100644 index 00000000..cc15ced7 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticAerocondenser.mo @@ -0,0 +1,84 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; +model TestStaticAerocondenser + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; + replaceable package Medium_Air = ThermoSysPro.Properties.Media.FlueGases; + + model SourceH + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium; + parameter Units.SI.MassFlowRate Q0=1; + parameter Units.SI.SpecificEnthalpy h0=1e5; + parameter Medium.MassFraction X0[Medium.nXi]=Medium.X_default[1:Medium.nXi]; + parameter Medium.ExtraProperty SubC0[Medium.nC]=Medium.C_default; + parameter Boolean fix_h_vol_2=false; + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C(redeclare package Medium = Medium); + equation + C.Q = Q0; + C.h = h0; + C.h_vol_1 = h0; + if fix_h_vol_2 then + C.h_vol_2 = h0; + end if; + C.diff_res_1 = 0; + C.diff_on_1 = false; + C.Xi = X0; + C.SubC = SubC0; + end SourceH; + + model SinkDiff + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium; + parameter Boolean fix_h_vol_2=false; + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C(redeclare package Medium = Medium); + equation + if fix_h_vol_2 then + C.h_vol_2 = C.h; + end if; + C.diff_res_2 = 0; + C.diff_on_2 = false; + end SinkDiff; + + model SinkPOnly + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium; + parameter Units.SI.AbsolutePressure P0=1e5; + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C(redeclare package Medium = Medium); + equation + C.P = P0; + C.diff_res_2 = 0; + C.diff_on_2 = false; + end SinkPOnly; + + ThermoSysPro.Fluid.HeatExchangers.StaticAerocondenser staticAerocondenser( + redeclare package Medium = Medium, + redeclare package Medium_Air = Medium_Air, + Se=10000, + z=0.5, + use_Cw=true, + Ka=1) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + SourceH steamSource( + redeclare package Medium = Medium, + Q0=100, + h0=2600000) annotation (Placement(transformation(extent={{-10,50},{10,70}}, rotation=-90, + origin={4,22}))); + SourceH drainSource( + redeclare package Medium = Medium, + Q0=1, + h0=370000) annotation (Placement(transformation(extent={{-70,-40},{-50,-20}}, rotation=0))); + SinkDiff condensateSink(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-10,-70},{10,-50}}, rotation=-90))); + SourceH airSource( + redeclare package Medium = Medium_Air, + fix_h_vol_2=true, + Q0=1400, + h0=Medium_Air.specificEnthalpy_pTX(p=100000, T=293.15, X=Medium_Air.X_default)) annotation (Placement(transformation(extent={{60,-10},{40,10}}, rotation=0))); + SinkPOnly airSink( + redeclare package Medium = Medium_Air, + P0=100000) annotation (Placement(transformation(extent={{40,50},{60,70}}, rotation=90))); +equation + staticAerocondenser.Cws2.h_vol_2 = staticAerocondenser.Cws2.h; + connect(steamSource.C, staticAerocondenser.Cws1) annotation (Line(points={{0,50},{0,9.16667}}, color={0,0,0})); + connect(drainSource.C, staticAerocondenser.Cw) annotation (Line(points={{-50,-30},{-9.16667,-7.5}}, color={0,0,0})); + connect(staticAerocondenser.Cws2, condensateSink.C) annotation (Line(points={{0,-9.16667},{0,-50}}, color={0,0,0})); + connect(airSource.C, staticAerocondenser.Cair1) annotation (Line(points={{40,0},{9.16667,-9.08333}}, color={0,0,0})); + connect(staticAerocondenser.Cair2, airSink.C) annotation (Line(points={{9.16667,9.16667},{50,50}}, color={0,0,0})); + annotation (experiment(StopTime=1000), Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestStaticAerocondenser; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticAerocondenser_TSP.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticAerocondenser_TSP.mo new file mode 100644 index 00000000..538ad522 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticAerocondenser_TSP.mo @@ -0,0 +1,96 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; +model TestStaticAerocondenser_TSP + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; + replaceable package Medium_Air = ThermoSysPro.Properties.Media.FlueGases; + + model SourceH + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium; + parameter Units.SI.MassFlowRate Q0=1; + parameter Units.SI.SpecificEnthalpy h0=1e5; + parameter Medium.MassFraction X0[Medium.nXi]=Medium.X_default[1:Medium.nXi]; + parameter Medium.ExtraProperty SubC0[Medium.nC]=Medium.C_default; + parameter Boolean fix_h_vol_2=false; + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C(redeclare package Medium = Medium); + equation + C.Q = Q0; + C.h = h0; + C.h_vol_1 = h0; + if fix_h_vol_2 then + C.h_vol_2 = h0; + end if; + C.diff_res_1 = 0; + C.diff_on_1 = false; + C.Xi = X0; + C.SubC = SubC0; + end SourceH; + + model SinkDiff + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium; + parameter Boolean fix_h_vol_2=false; + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C(redeclare package Medium = Medium); + equation + if fix_h_vol_2 then + C.h_vol_2 = C.h; + end if; + C.diff_res_2 = 0; + C.diff_on_2 = false; + end SinkDiff; + + model SinkPOnly + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium; + parameter Units.SI.AbsolutePressure P0=1e5; + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C(redeclare package Medium = Medium); + equation + C.P = P0; + C.diff_res_2 = 0; + C.diff_on_2 = false; + end SinkPOnly; + + ThermoSysPro.Fluid.HeatExchangers.StaticAerocondenser staticAerocondenser( + redeclare package Medium = Medium, + redeclare package Medium_Air = Medium_Air, + Se=10000, + z=0.5, + use_Cw=true, + Ka=1) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + SourceH airSource( + redeclare package Medium = Medium_Air, + fix_h_vol_2=true, + Q0=1400, + h0=Medium_Air.specificEnthalpy_pTX( + p=100000, + T=293.15, + X=Medium_Air.X_default)) annotation (Placement(transformation(extent={{60,-10},{40,10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ drainSource( + redeclare package Medium = Medium, + Q0=1, + T0=340, + h0=370000) annotation (Placement(transformation(extent={{-70,-62},{-50,-42}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ steamSource1( + redeclare package Medium = Medium, + Q0=100, + T0=340, + h0=2600000) annotation (Placement(transformation(extent={{-44,68},{-24,88}}, rotation=0))); + SinkDiff condensateSink(redeclare package Medium = Medium) annotation (Placement(transformation( + extent={{-10,-70},{10,-50}}, + rotation=-90, + origin={100,-34}))); + SinkPOnly airSink(redeclare package Medium = Medium_Air, P0=100000) annotation (Placement(transformation( + extent={{40,50},{60,70}}, + rotation=90, + origin={92,-10}))); +equation + staticAerocondenser.Cws2.h_vol_2 = staticAerocondenser.Cws2.h; + + connect(airSource.C, staticAerocondenser.Cair1) annotation (Line(points={{40,0},{9.16667,-9.08333}}, color={0,0,0})); + connect(drainSource.C, staticAerocondenser.Cw) annotation (Line(points={{-50,-52},{-16,-52},{-16,-7.5},{-9.16667,-7.5}}, color={0,0,0})); + connect(staticAerocondenser.Cws1, steamSource1.C) annotation (Line(points={{0,9.16667},{0,78},{-24,78}}, color={0,0,0})); + connect(staticAerocondenser.Cws2, condensateSink.C) annotation (Line(points={{0,-9.16667},{0,-36},{24,-36},{24,-76}}, color={0,0,0})); + connect(staticAerocondenser.Cair2, airSink.C) annotation (Line(points={{9.16667,9.16667},{142,40}}, color={0,0,0})); + annotation ( + experiment(StopTime=1000), + Icon(coordinateSystem(preserveAspectRatio=false)), + Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestStaticAerocondenser_TSP; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order index 4cbbe684..707e0f75 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order @@ -37,4 +37,6 @@ TestStaticCondenser TestStaticCondenser_Traces TestStaticCondenserHEI TestStaticCondenserHEI_Traces +TestStaticAerocondenser TestDynamicPlateHeatExchangerW +TestStaticAerocondenser_TSP diff --git a/ThermoSysPro/Fluid/HeatExchangers/StaticAerocondenser.mo b/ThermoSysPro/Fluid/HeatExchangers/StaticAerocondenser.mo index 40d08f2a..c48369ab 100644 --- a/ThermoSysPro/Fluid/HeatExchangers/StaticAerocondenser.mo +++ b/ThermoSysPro/Fluid/HeatExchangers/StaticAerocondenser.mo @@ -1,35 +1,27 @@ within ThermoSysPro.Fluid.HeatExchangers; model StaticAerocondenser "Static aerocondenser" - extends - ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.WaterSteamFluidTypeParameterInterface; extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialTwoPhaseThermoSysProMedium "Medium model for the condensing side" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable package Medium_Air = ThermoSysPro.Properties.Media.FlueGases constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model for the air side" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Units.SI.CoefficientOfHeatTransfer Uref=50 "Reference heat transfer coefficient between the air and the condenser external wall"; parameter Real UCOR=1. "Heat transfer corrective coefficient"; parameter Units.SI.Area Se=1.e4 "Condenser external wall area"; parameter Units.SI.Height z=0 "Water level in the condenser"; - parameter Real K=0.02 "Pressure loss coefficient for the water/steam pipe (Pa.s²/(kg.m**3))"; - parameter Real Ka=0.00 "Pressure loss coefficient for the air (Pa.s²/(kg.m**3))"; + parameter Real K=0.02 "Pressure loss coefficient for the water/steam pipe (Pa.s2/(kg.m3))"; + parameter Real Ka=0.00 "Pressure loss coefficient for the air (Pa.s2/(kg.m3))"; parameter Units.SI.MassFlowRate gamma_diff=1e-4 "Air diffusion conductance (active if diffusion=true in neighbouring volumes)"; parameter Boolean continuous_flow_reversal=false "true: continuous flow reversal - false: discontinuous flow reversal"; parameter Boolean diffusion=false "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; - parameter IF97Region region_e=IF97Region.All_regions "IF97 region at the inlet (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); - parameter IF97Region region_s=IF97Region.All_regions "IF97 region at the outlet (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); + parameter Boolean use_Cw=false "true: enable drain inlet Cw" annotation(Evaluate=true, Dialog(tab="General", group="Optional connectors")); protected constant Units.SI.Acceleration g=Modelica.Constants.g_n "Gravity constant"; - constant Real pi=Modelica.Constants.pi "pi"; - parameter Integer fluid_w=Integer(ftype) "Water fluid number"; - parameter Integer mode_e=Integer(region_e) - 1 "IF97 region at the inlet. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; - parameter Integer mode_s=Integer(region_s) - 1 "IF97 region at the outlet. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; parameter Units.SI.MassFlowRate gamma0=1.e-4 "Pseudo-diffusion conductance use for continuous flow reversal (active if diffusion=false and continuous_flow_reversal = true)"; - parameter Units.SI.MassFlowRate Qeps=1.e-3 - "Small mass flow rate for continuous flow reversal"; public Units.SI.SpecificEnthalpy he(start=370000) @@ -63,7 +55,6 @@ public Units.SI.Density rho_e(start=998) "Water density at the outlet of the condenser"; Units.SI.Density rho_a(start=1) "Air density"; - FluidType fluids[4] "Fluids mixing in volume"; Units.SI.Power Jws1 "Thermal power diffusion from inlet Cws1"; Units.SI.Power Jw "Thermal power diffusion from inlet Cw"; Units.SI.Power Jws2 "Thermal power diffusion from outlet Cws2"; @@ -74,48 +65,34 @@ public Real rws1 "Value of r(Q/gamma) for inlet Cws1"; Real rw "Value of r(Q/gamma) for inlet Cw"; Real rws2 "Value of r(Q/gamma) for outlet Cws1"; - FluidType ftype_a "Air fluid type"; - Integer fluid_a=Integer(ftype_a) "Air fluid number"; + Medium.MassFraction X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Mass fractions in the condenser cavity"; + Medium.ExtraProperty SubC[Medium.nC](start=Medium.C_default) "Trace substance concentrations in the condenser cavity"; + Medium_Air.MassFraction X_Air[Medium_Air.nXi](start=Medium_Air.X_default[1:Medium_Air.nXi]) "Air mass fractions"; + Medium.SaturationProperties sat "Saturation properties inside the condenser"; public - Interfaces.Connectors.FluidInlet Cws1 annotation (Placement(transformation( + Interfaces.Connectors.FluidInlet Cws1(redeclare package Medium = Medium) annotation (Placement(transformation( extent={{-10,100},{10,120}}, rotation=0))); - Interfaces.Connectors.FluidOutlet Cws2 annotation (Placement(transformation( + Interfaces.Connectors.FluidOutlet Cws2(redeclare package Medium = Medium) annotation (Placement(transformation( extent={{-10,-120},{10,-100}}, rotation=0))); - Interfaces.Connectors.FluidInlet Cair1 annotation (Placement(transformation( + Interfaces.Connectors.FluidInlet Cair1(redeclare package Medium = Medium_Air) annotation (Placement(transformation( extent={{100,-119},{120,-99}}, rotation=0))); - Interfaces.Connectors.FluidOutlet Cair2 annotation (Placement(transformation( + Interfaces.Connectors.FluidOutlet Cair2(redeclare package Medium = Medium_Air) annotation (Placement(transformation( extent={{100,100},{120,120}}, rotation=0))); public - Interfaces.Connectors.FluidInlet Cw annotation (Placement(transformation( + Interfaces.Connectors.FluidInlet Cw(redeclare package Medium = Medium) annotation (Placement(transformation( extent={{-120,-100},{-100,-80}}, rotation=0), iconTransformation( extent={{-120,-100},{-100,-80}}))); - Properties.WaterSteam.Common.ThermoProperties_ph proe "Water properties" - annotation (Placement(transformation(extent={{80,80},{100,100}}, rotation=0))); - Properties.WaterSteam.Common.PropThermoSat lsat annotation (Placement( - transformation(extent={{-100,80},{-80,100}}, rotation=0))); equation - - /* Check that incoming fluids are compatible with fluid in volume */ - fluids[1] = ftype; - fluids[2] = Cws1.ftype; - fluids[3] = Cw.ftype; - fluids[4] = Cws2.ftype; - - assert(ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.isCompatible(fluids), "StaticAerocondenser: fluids mixing in condenser volume are not compatible with each other"); - /* Unconnected connectors */ - if (cardinality(Cw) == 0) then + if not use_Cw then Cw.Q = 0; Cw.h = 1.e5; Cw.h_vol_1 = 1.e5; Cw.diff_res_1 = 0; Cw.diff_on_1 = false; - Cw.ftype = ftype; - Cw.Xco2 = 0; - Cw.Xh2o = 0; - Cw.Xo2 = 0; - Cw.Xso2 = 0; + Cw.Xi = Medium.X_default[1:Medium.nXi]; + Cw.SubC = Medium.C_default; end if; /* Pressure at the bottom of the condenser*/ @@ -132,23 +109,16 @@ equation /* Water/steam energy balance equation */ 0 = (Cws1.h - he)*Cws1.Q + (Cw.h - he)*Cw.Q - (Cws2.h - he)*Cws2.Q - W + J; - // if noEvent(Qa > 0) then - // (has - hae)*Qa - ((Cws1.h - he)*Q + (Cw.h - he)*Cw.Q) = 0; - // else - // (has - hae)*1.e-6 - ((Cws1.h - he)*Q + (Cw.h - he)*Cw.Q) = 0; - // end if; Cws1.h_vol_2 = he; Cw.h_vol_2 = he; Cws2.h_vol_1 = he; /* Fluid composition in the cavity (no balance equations) */ - Cws2.ftype = ftype; - - Cws2.Xco2 = 0; - Cws2.Xh2o = 0; - Cws2.Xo2 = 0; - Cws2.Xso2 = 0; + X = Cws1.Xi; + SubC = Cws1.SubC; + Cws2.Xi = X; + Cws2.SubC = SubC; /* Air inlet and outlet */ Cair1.Q = Cair2.Q; @@ -162,14 +132,9 @@ equation Cair2.diff_res_1 = Cair1.diff_res_1 + 1/gamma_diff; Cair1.diff_res_2 = Cair2.diff_res_2 + 1/gamma_diff; - Cair1.ftype = Cair2.ftype; - - Cair1.Xco2 = Cair2.Xco2; - Cair1.Xh2o = Cair2.Xh2o; - Cair1.Xo2 = Cair2.Xo2; - Cair1.Xso2 = Cair2.Xso2; - - ftype_a = Cair1.ftype; + Cair1.Xi = Cair2.Xi; + Cair1.SubC = Cair2.SubC; + X_Air = Cair1.Xi; Qa = Cair1.Q; Pae = Cair1.P; @@ -242,152 +207,26 @@ equation Tcond = ((Tas + Tae*(Ef - 1.0))/Ef); /* Condensation pressure */ - Pcond = ThermoSysPro.Properties.Fluid.P_sat(Tcond, fluid_w); + Pcond = Medium.saturationPressure(Tcond); /* Water/steam thermodynamic properties */ - proe = ThermoSysPro.Properties.Fluid.Ph((Pfond + Pcond)/2, he, mode_s, fluid_w); - rho_e = proe.d; + rho_e = Medium.density_phX(p=(Pfond + Pcond)/2, h=he, X=X); /* Water specific enthalpy at the saturation point with pressure Pcond */ - lsat = ThermoSysPro.Properties.Fluid.Water_sat_P(Pcond, fluid_w); - he = lsat.h; + sat = Medium.setSat_p(Pcond); + he = Medium.bubbleEnthalpy(sat); /* Air thermodynamic properties */ - hae = ThermoSysPro.Properties.Fluid.SpecificEnthalpy_PT(Pae, Tae, fluid_a, 0, Cair1.Xco2, Cair1.Xh2o, Cair1.Xo2, Cair1.Xso2); - has = ThermoSysPro.Properties.Fluid.SpecificEnthalpy_PT(Pas, Tas, fluid_a, 0, Cair1.Xco2, Cair1.Xh2o, Cair1.Xo2, Cair1.Xso2); - rho_a = ThermoSysPro.Properties.Fluid.Density_Ph(Pae, hae, fluid_a, 0, Cair1.Xco2, Cair1.Xh2o, Cair1.Xo2, Cair1.Xso2); - cp_a = ThermoSysPro.Properties.FlueGases.FlueGases_cp((Pae + Pas)/2, (Tae + Tas)/2, Cair1.Xco2, Cair1.Xh2o, Cair1.Xo2, Cair1.Xso2); - //cp_a = ThermoSysPro.Properties.Fluid.SpecificHeatCapacityCp_PT((Pae + Pas)/2, (Tae + Tas)/2, fluid_a, 0, Cair1.Xco2, Cair1.Xh2o, Cair1.Xo2, Cair1.Xso2); + Tae = Medium_Air.temperature_phX(p=Pae, h=hae, X=X_Air); + has = Medium_Air.specificEnthalpy_pTX(p=Pas, T=Tas, X=X_Air); + rho_a = Medium_Air.density_phX(p=Pae, h=hae, X=X_Air); + cp_a = Medium_Air.specificHeatCapacityCp(Medium_Air.setState_pTX(p=(Pae + Pas)/2, T=(Tae + Tas)/2, X=X_Air)); annotation ( Diagram(coordinateSystem( preserveAspectRatio=false, extent={{-120,-120},{120,120}}, - grid={2,2}), graphics={ - Text( - extent={{86,112},{98,102}}, - lineColor={0,0,0}, - lineThickness=1, - fillPattern=FillPattern.Sphere, - fillColor={191,0,0}, - textString= - "Air"), - Text( - extent={{82,-106},{94,-116}}, - lineColor={0,0,0}, - lineThickness=1, - fillPattern=FillPattern.Sphere, - fillColor={191,0,0}, - textString= - "Air"), - Text( - extent={{-36,-112},{-12,-120}}, - lineColor={0,0,0}, - lineThickness=1, - fillPattern=FillPattern.Sphere, - fillColor={191,0,0}, - textString= - "Water"), - Text( - extent={{-38,114},{-12,106}}, - lineColor={0,0,0}, - lineThickness=1, - fillPattern=FillPattern.Sphere, - fillColor={191,0,0}, - textString= - "Steam"), - Polygon( - points={{100,-62},{0,100},{0,100},{-100,-62},{100,-62}}, - lineColor={28,108,200}, - fillColor={0,255,0}, - fillPattern=FillPattern.Solid), - Polygon( - points={{89,40},{79,20},{99,20},{89,40}}, - lineColor={0,0,0}, - lineThickness=0.5, - fillPattern=FillPattern.Sphere, - fillColor={191,0,0}), - Line( - points={{89,20},{89,4}}, - color={0,0,0}, - thickness=1), - Ellipse( - extent={{-20,100},{20,60}}, - lineColor={0,0,0}, - fillPattern=FillPattern.HorizontalCylinder, - fillColor={255,0,0}), - Ellipse( - extent={{60,-39},{100,-79}}, - lineColor={0,0,0}, - fillPattern=FillPattern.HorizontalCylinder, - fillColor={0,128,255}), - Ellipse( - extent={{-100,-39},{-60,-79}}, - lineColor={0,0,0}, - fillPattern=FillPattern.HorizontalCylinder, - fillColor={0,128,255}), - Polygon( - points={{-28,30},{-36,34},{-16,68},{-8,64},{-28,30}}, - lineColor={0,0,0}, - fillPattern=FillPattern.VerticalCylinder, - fillColor={255,0,0}), - Polygon( - points={{-49,-6},{-57,-2},{-36,34},{-28,30},{-49,-6}}, - lineColor={255,128,0}, - fillColor={255,128,0}, - fillPattern=FillPattern.Solid), - Polygon( - points={{-71,-44},{-79,-40},{-57,-2},{-49,-6},{-71,-44}}, - lineColor={0,128,255}, - fillColor={0,128,255}, - fillPattern=FillPattern.Solid), - Polygon( - points={{38,33},{30,29},{9,64},{16,69},{38,33}}, - lineColor={0,0,0}, - fillPattern=FillPattern.VerticalCylinder, - fillColor={255,0,0}), - Polygon( - points={{60,-6},{52,-10},{30,29},{38,33},{60,-6}}, - lineColor={0,0,0}, - fillPattern=FillPattern.VerticalCylinder, - fillColor={255,128,0}), - Polygon( - points={{80,-40},{70,-42},{52,-10},{60,-6},{80,-40}}, - lineColor={0,0,0}, - fillPattern=FillPattern.VerticalCylinder, - fillColor={0,128,255}), - Polygon( - points={{-5,-48},{55,-38},{55,-58},{-5,-48},{-5,-48}}, - lineColor={28,108,200}, - fillColor={0,0,0}, - fillPattern=FillPattern.Solid), - Polygon( - points={{5,-48},{-55,-58},{-55,-38},{5,-48},{5,-48}}, - lineColor={28,108,200}, - fillColor={0,0,0}, - fillPattern=FillPattern.Solid), - Ellipse( - extent={{-100,-79},{-80,-100}}, - lineColor={0,0,0}, - fillPattern=FillPattern.HorizontalCylinder, - fillColor={0,255,255}), - Ellipse( - extent={{80,-79},{100,-100}}, - lineColor={0,0,0}, - fillPattern=FillPattern.HorizontalCylinder, - fillColor={0,255,255}), - Rectangle( - extent={{-89,-79},{90,-100}}, - lineColor={0,0,0}, - fillPattern=FillPattern.HorizontalCylinder, - fillColor={0,255,255}), - Text( - extent={{-38,22},{36,-38}}, - lineColor={0,0,0}, - fillPattern=FillPattern.HorizontalCylinder, - fillColor={255,255,0}, - textString= - "Volume")}), + grid={2,2})), Icon(coordinateSystem( preserveAspectRatio=false, extent={{-120,-120},{120,120}}, @@ -395,80 +234,18 @@ equation Polygon( points={{100,-62},{0,100},{0,100},{-100,-62},{100,-62}}, lineColor={0,255,0}, - fillColor= DynamicSelect({85,170,255}, - if diffusion then fill_color_singular - else fill_color_static), + fillColor=DynamicSelect({85,170,255}, if diffusion then fill_color_singular else fill_color_static), fillPattern=FillPattern.Solid, lineThickness=0), Line( - points={{110,20},{110,-8}}, - color={0,0,0}, - thickness=0), + points={{110,-99},{110,104}}, + color={28,108,200}, + thickness=1), Ellipse( extent={{-20,100},{20,60}}, lineColor={0,0,0}, fillPattern=FillPattern.HorizontalCylinder, fillColor={255,0,0}), - Ellipse( - extent={{60,-39},{100,-79}}, - lineColor={0,0,0}, - fillPattern=FillPattern.HorizontalCylinder, - fillColor={0,128,255}), - Ellipse( - extent={{-100,-39},{-60,-79}}, - lineColor={0,0,0}, - fillPattern=FillPattern.HorizontalCylinder, - fillColor={0,128,255}), - Polygon( - points={{-28,30},{-36,34},{-16,68},{-8,64},{-28,30}}, - lineColor={0,0,0}, - fillPattern=FillPattern.VerticalCylinder, - fillColor={255,0,0}), - Polygon( - points={{-49,-6},{-57,-2},{-36,34},{-28,30},{-49,-6}}, - lineColor={255,128,0}, - fillColor={255,128,0}, - fillPattern=FillPattern.Solid), - Polygon( - points={{-71,-44},{-79,-40},{-57,-2},{-49,-6},{-71,-44}}, - lineColor={0,128,255}, - fillColor={0,128,255}, - fillPattern=FillPattern.Solid), - Polygon( - points={{38,33},{30,29},{9,64},{16,69},{38,33}}, - lineColor={0,0,0}, - fillPattern=FillPattern.VerticalCylinder, - fillColor={255,0,0}), - Polygon( - points={{60,-6},{52,-10},{30,29},{38,33},{60,-6}}, - lineColor={0,0,0}, - fillPattern=FillPattern.VerticalCylinder, - fillColor={255,128,0}), - Polygon( - points={{80,-40},{70,-42},{52,-10},{60,-6},{80,-40}}, - lineColor={0,0,0}, - fillPattern=FillPattern.VerticalCylinder, - fillColor={0,128,255}), - Polygon( - points={{-5,-48},{55,-38},{55,-58},{-5,-48},{-5,-48}}, - lineColor={28,108,200}, - fillColor={0,0,0}, - fillPattern=FillPattern.Solid), - Polygon( - points={{5,-48},{-55,-58},{-55,-38},{5,-48},{5,-48}}, - lineColor={28,108,200}, - fillColor={0,0,0}, - fillPattern=FillPattern.Solid), - Ellipse( - extent={{80,-79},{100,-100}}, - lineColor={0,0,0}, - fillPattern=FillPattern.HorizontalCylinder, - fillColor={0,255,255}), - Ellipse( - extent={{-100,-79},{-80,-100}}, - lineColor={0,0,0}, - fillPattern=FillPattern.HorizontalCylinder, - fillColor={0,255,255}), Rectangle( extent={{-89,-79},{90,-100}}, lineColor={0,0,0}, @@ -477,31 +254,15 @@ equation Text( extent={{20,120},{54,100}}, lineColor={238,46,47}, - fillColor={255,213,170}, - fillPattern=FillPattern.Solid, textString="Steam inlet"), Text( extent={{126,116},{154,100}}, lineColor={0,0,255}, - fillColor={255,213,170}, - fillPattern=FillPattern.Solid, textString="Air outlet"), Text( extent={{126,-104},{150,-116}}, lineColor={0,0,255}, - fillColor={255,213,170}, - fillPattern=FillPattern.Solid, - textString="Air inlet"), - Line( - points={{110,-99},{110,104}}, - color={28,108,200}, - thickness=1), - Polygon( - points={{110,12},{100,-8},{120,-8},{110,12}}, - lineColor={0,0,0}, - lineThickness=0, - fillPattern=FillPattern.Sphere, - fillColor={191,0,0})}), + textString="Air inlet")}), Window( x=0.09, y=0.08, From c3bced51eeb100d49c9c7badd86e3b4fc42c0111 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Tue, 12 May 2026 16:47:58 +0200 Subject: [PATCH 143/178] #125 StaticAerocondenser, example not working yet --- .../HeatExchangers/StaticAerocondenser.mo | 214 +++++++++++++++++- 1 file changed, 208 insertions(+), 6 deletions(-) diff --git a/ThermoSysPro/Fluid/HeatExchangers/StaticAerocondenser.mo b/ThermoSysPro/Fluid/HeatExchangers/StaticAerocondenser.mo index c48369ab..2d8f867c 100644 --- a/ThermoSysPro/Fluid/HeatExchangers/StaticAerocondenser.mo +++ b/ThermoSysPro/Fluid/HeatExchangers/StaticAerocondenser.mo @@ -226,7 +226,131 @@ equation Diagram(coordinateSystem( preserveAspectRatio=false, extent={{-120,-120},{120,120}}, - grid={2,2})), + grid={2,2}), graphics={ + Text( + extent={{86,112},{98,102}}, + lineColor={0,0,0}, + lineThickness=1, + fillPattern=FillPattern.Sphere, + fillColor={191,0,0}, + textString= + "Air"), + Text( + extent={{82,-106},{94,-116}}, + lineColor={0,0,0}, + lineThickness=1, + fillPattern=FillPattern.Sphere, + fillColor={191,0,0}, + textString= + "Air"), + Text( + extent={{-36,-112},{-12,-120}}, + lineColor={0,0,0}, + lineThickness=1, + fillPattern=FillPattern.Sphere, + fillColor={191,0,0}, + textString= + "Water"), + Text( + extent={{-38,114},{-12,106}}, + lineColor={0,0,0}, + lineThickness=1, + fillPattern=FillPattern.Sphere, + fillColor={191,0,0}, + textString= + "Steam"), + Polygon( + points={{100,-62},{0,100},{0,100},{-100,-62},{100,-62}}, + lineColor={28,108,200}, + fillColor={0,255,0}, + fillPattern=FillPattern.Solid), + Polygon( + points={{89,40},{79,20},{99,20},{89,40}}, + lineColor={0,0,0}, + lineThickness=0.5, + fillPattern=FillPattern.Sphere, + fillColor={191,0,0}), + Line( + points={{89,20},{89,4}}, + color={0,0,0}, + thickness=1), + Ellipse( + extent={{-20,100},{20,60}}, + lineColor={0,0,0}, + fillPattern=FillPattern.HorizontalCylinder, + fillColor={255,0,0}), + Ellipse( + extent={{60,-39},{100,-79}}, + lineColor={0,0,0}, + fillPattern=FillPattern.HorizontalCylinder, + fillColor={0,128,255}), + Ellipse( + extent={{-100,-39},{-60,-79}}, + lineColor={0,0,0}, + fillPattern=FillPattern.HorizontalCylinder, + fillColor={0,128,255}), + Polygon( + points={{-28,30},{-36,34},{-16,68},{-8,64},{-28,30}}, + lineColor={0,0,0}, + fillPattern=FillPattern.VerticalCylinder, + fillColor={255,0,0}), + Polygon( + points={{-49,-6},{-57,-2},{-36,34},{-28,30},{-49,-6}}, + lineColor={255,128,0}, + fillColor={255,128,0}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-71,-44},{-79,-40},{-57,-2},{-49,-6},{-71,-44}}, + lineColor={0,128,255}, + fillColor={0,128,255}, + fillPattern=FillPattern.Solid), + Polygon( + points={{38,33},{30,29},{9,64},{16,69},{38,33}}, + lineColor={0,0,0}, + fillPattern=FillPattern.VerticalCylinder, + fillColor={255,0,0}), + Polygon( + points={{60,-6},{52,-10},{30,29},{38,33},{60,-6}}, + lineColor={0,0,0}, + fillPattern=FillPattern.VerticalCylinder, + fillColor={255,128,0}), + Polygon( + points={{80,-40},{70,-42},{52,-10},{60,-6},{80,-40}}, + lineColor={0,0,0}, + fillPattern=FillPattern.VerticalCylinder, + fillColor={0,128,255}), + Polygon( + points={{-5,-48},{55,-38},{55,-58},{-5,-48},{-5,-48}}, + lineColor={28,108,200}, + fillColor={0,0,0}, + fillPattern=FillPattern.Solid), + Polygon( + points={{5,-48},{-55,-58},{-55,-38},{5,-48},{5,-48}}, + lineColor={28,108,200}, + fillColor={0,0,0}, + fillPattern=FillPattern.Solid), + Ellipse( + extent={{-100,-79},{-80,-100}}, + lineColor={0,0,0}, + fillPattern=FillPattern.HorizontalCylinder, + fillColor={0,255,255}), + Ellipse( + extent={{80,-79},{100,-100}}, + lineColor={0,0,0}, + fillPattern=FillPattern.HorizontalCylinder, + fillColor={0,255,255}), + Rectangle( + extent={{-89,-79},{90,-100}}, + lineColor={0,0,0}, + fillPattern=FillPattern.HorizontalCylinder, + fillColor={0,255,255}), + Text( + extent={{-38,22},{36,-38}}, + lineColor={0,0,0}, + fillPattern=FillPattern.HorizontalCylinder, + fillColor={255,255,0}, + textString= + "Volume")}), Icon(coordinateSystem( preserveAspectRatio=false, extent={{-120,-120},{120,120}}, @@ -234,18 +358,80 @@ equation Polygon( points={{100,-62},{0,100},{0,100},{-100,-62},{100,-62}}, lineColor={0,255,0}, - fillColor=DynamicSelect({85,170,255}, if diffusion then fill_color_singular else fill_color_static), + fillColor= DynamicSelect({85,170,255}, + if diffusion then fill_color_singular + else fill_color_static), fillPattern=FillPattern.Solid, lineThickness=0), Line( - points={{110,-99},{110,104}}, - color={28,108,200}, - thickness=1), + points={{110,20},{110,-8}}, + color={0,0,0}, + thickness=0), Ellipse( extent={{-20,100},{20,60}}, lineColor={0,0,0}, fillPattern=FillPattern.HorizontalCylinder, fillColor={255,0,0}), + Ellipse( + extent={{60,-39},{100,-79}}, + lineColor={0,0,0}, + fillPattern=FillPattern.HorizontalCylinder, + fillColor={0,128,255}), + Ellipse( + extent={{-100,-39},{-60,-79}}, + lineColor={0,0,0}, + fillPattern=FillPattern.HorizontalCylinder, + fillColor={0,128,255}), + Polygon( + points={{-28,30},{-36,34},{-16,68},{-8,64},{-28,30}}, + lineColor={0,0,0}, + fillPattern=FillPattern.VerticalCylinder, + fillColor={255,0,0}), + Polygon( + points={{-49,-6},{-57,-2},{-36,34},{-28,30},{-49,-6}}, + lineColor={255,128,0}, + fillColor={255,128,0}, + fillPattern=FillPattern.Solid), + Polygon( + points={{-71,-44},{-79,-40},{-57,-2},{-49,-6},{-71,-44}}, + lineColor={0,128,255}, + fillColor={0,128,255}, + fillPattern=FillPattern.Solid), + Polygon( + points={{38,33},{30,29},{9,64},{16,69},{38,33}}, + lineColor={0,0,0}, + fillPattern=FillPattern.VerticalCylinder, + fillColor={255,0,0}), + Polygon( + points={{60,-6},{52,-10},{30,29},{38,33},{60,-6}}, + lineColor={0,0,0}, + fillPattern=FillPattern.VerticalCylinder, + fillColor={255,128,0}), + Polygon( + points={{80,-40},{70,-42},{52,-10},{60,-6},{80,-40}}, + lineColor={0,0,0}, + fillPattern=FillPattern.VerticalCylinder, + fillColor={0,128,255}), + Polygon( + points={{-5,-48},{55,-38},{55,-58},{-5,-48},{-5,-48}}, + lineColor={28,108,200}, + fillColor={0,0,0}, + fillPattern=FillPattern.Solid), + Polygon( + points={{5,-48},{-55,-58},{-55,-38},{5,-48},{5,-48}}, + lineColor={28,108,200}, + fillColor={0,0,0}, + fillPattern=FillPattern.Solid), + Ellipse( + extent={{80,-79},{100,-100}}, + lineColor={0,0,0}, + fillPattern=FillPattern.HorizontalCylinder, + fillColor={0,255,255}), + Ellipse( + extent={{-100,-79},{-80,-100}}, + lineColor={0,0,0}, + fillPattern=FillPattern.HorizontalCylinder, + fillColor={0,255,255}), Rectangle( extent={{-89,-79},{90,-100}}, lineColor={0,0,0}, @@ -254,15 +440,31 @@ equation Text( extent={{20,120},{54,100}}, lineColor={238,46,47}, + fillColor={255,213,170}, + fillPattern=FillPattern.Solid, textString="Steam inlet"), Text( extent={{126,116},{154,100}}, lineColor={0,0,255}, + fillColor={255,213,170}, + fillPattern=FillPattern.Solid, textString="Air outlet"), Text( extent={{126,-104},{150,-116}}, lineColor={0,0,255}, - textString="Air inlet")}), + fillColor={255,213,170}, + fillPattern=FillPattern.Solid, + textString="Air inlet"), + Line( + points={{110,-99},{110,104}}, + color={28,108,200}, + thickness=1), + Polygon( + points={{110,12},{100,-8},{120,-8},{110,12}}, + lineColor={0,0,0}, + lineThickness=0, + fillPattern=FillPattern.Sphere, + fillColor={191,0,0})}), Window( x=0.09, y=0.08, From 6aac26508342680b0c5f46aa5f269b0530528fd4 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Wed, 13 May 2026 14:08:59 +0200 Subject: [PATCH 144/178] #125 StaticAerocondenser with working example --- .../HeatExchangers/TestStaticAerocondenser.mo | 101 +++++++----------- .../TestStaticAerocondenser_TSP.mo | 96 ----------------- .../HeatExchangers/package.order | 3 +- .../HeatExchangers/StaticAerocondenser.mo | 68 +++++++++++- 4 files changed, 104 insertions(+), 164 deletions(-) delete mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticAerocondenser_TSP.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticAerocondenser.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticAerocondenser.mo index cc15ced7..3194641a 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticAerocondenser.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticAerocondenser.mo @@ -5,49 +5,6 @@ model TestStaticAerocondenser replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; replaceable package Medium_Air = ThermoSysPro.Properties.Media.FlueGases; - model SourceH - replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium; - parameter Units.SI.MassFlowRate Q0=1; - parameter Units.SI.SpecificEnthalpy h0=1e5; - parameter Medium.MassFraction X0[Medium.nXi]=Medium.X_default[1:Medium.nXi]; - parameter Medium.ExtraProperty SubC0[Medium.nC]=Medium.C_default; - parameter Boolean fix_h_vol_2=false; - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C(redeclare package Medium = Medium); - equation - C.Q = Q0; - C.h = h0; - C.h_vol_1 = h0; - if fix_h_vol_2 then - C.h_vol_2 = h0; - end if; - C.diff_res_1 = 0; - C.diff_on_1 = false; - C.Xi = X0; - C.SubC = SubC0; - end SourceH; - - model SinkDiff - replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium; - parameter Boolean fix_h_vol_2=false; - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C(redeclare package Medium = Medium); - equation - if fix_h_vol_2 then - C.h_vol_2 = C.h; - end if; - C.diff_res_2 = 0; - C.diff_on_2 = false; - end SinkDiff; - - model SinkPOnly - replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium; - parameter Units.SI.AbsolutePressure P0=1e5; - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C(redeclare package Medium = Medium); - equation - C.P = P0; - C.diff_res_2 = 0; - C.diff_on_2 = false; - end SinkPOnly; - ThermoSysPro.Fluid.HeatExchangers.StaticAerocondenser staticAerocondenser( redeclare package Medium = Medium, redeclare package Medium_Air = Medium_Air, @@ -55,30 +12,46 @@ model TestStaticAerocondenser z=0.5, use_Cw=true, Ka=1) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); - SourceH steamSource( + ThermoSysPro.Fluid.BoundaryConditions.SourceQ airSource( + redeclare package Medium = Medium_Air, + Q0=1400, + h0=Medium_Air.specificEnthalpy_pTX( + p=100000, + T=293.15, + X=Medium_Air.X_default)) annotation (Placement(transformation(extent={{40,-30},{20,-10}},rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ drainSource( + redeclare package Medium = Medium, + Q0=1, + T0=340, + h0=370000) annotation (Placement(transformation(extent={{-40,-20},{-20,0}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ steamSource1( redeclare package Medium = Medium, Q0=100, - h0=2600000) annotation (Placement(transformation(extent={{-10,50},{10,70}}, rotation=-90, - origin={4,22}))); - SourceH drainSource( + T0=340, + h0=2600000) annotation (Placement(transformation(extent={{-40,10},{-20,30}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.Sink condensateSink( redeclare package Medium = Medium, - Q0=1, - h0=370000) annotation (Placement(transformation(extent={{-70,-40},{-50,-20}}, rotation=0))); - SinkDiff condensateSink(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-10,-70},{10,-50}}, rotation=-90))); - SourceH airSource( - redeclare package Medium = Medium_Air, - fix_h_vol_2=true, - Q0=1400, - h0=Medium_Air.specificEnthalpy_pTX(p=100000, T=293.15, X=Medium_Air.X_default)) annotation (Placement(transformation(extent={{60,-10},{40,10}}, rotation=0))); - SinkPOnly airSink( + h0=370000) annotation (Placement(transformation( + extent={{-10,-70},{10,-50}}, + rotation=-90, + origin={60,-50}))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP airSink( redeclare package Medium = Medium_Air, - P0=100000) annotation (Placement(transformation(extent={{40,50},{60,70}}, rotation=90))); + P0=100000, + T0=293.15) annotation (Placement(transformation( + extent={{40,50},{60,70}}, + rotation=90, + origin={80,-20}))); equation - staticAerocondenser.Cws2.h_vol_2 = staticAerocondenser.Cws2.h; - connect(steamSource.C, staticAerocondenser.Cws1) annotation (Line(points={{0,50},{0,9.16667}}, color={0,0,0})); - connect(drainSource.C, staticAerocondenser.Cw) annotation (Line(points={{-50,-30},{-9.16667,-7.5}}, color={0,0,0})); - connect(staticAerocondenser.Cws2, condensateSink.C) annotation (Line(points={{0,-9.16667},{0,-50}}, color={0,0,0})); - connect(airSource.C, staticAerocondenser.Cair1) annotation (Line(points={{40,0},{9.16667,-9.08333}}, color={0,0,0})); - connect(staticAerocondenser.Cair2, airSink.C) annotation (Line(points={{9.16667,9.16667},{50,50}}, color={0,0,0})); - annotation (experiment(StopTime=1000), Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); + connect(airSource.C, staticAerocondenser.Cair1) annotation (Line(points={{20,-20},{9.16667,-20},{9.16667,-9.08333}}, + color={0,0,0})); + connect(drainSource.C, staticAerocondenser.Cw) annotation (Line(points={{-20,-10},{-14,-10},{-14,-7.5},{-9.16667,-7.5}}, color={0,0,0})); + connect(staticAerocondenser.Cws1, steamSource1.C) annotation (Line(points={{0,9.16667},{0,20},{-20,20}}, color={0,0,0})); + connect(staticAerocondenser.Cws2, condensateSink.C) annotation (Line(points={{0,-9.16667},{0,-40}}, color={0,0,0})); + connect(staticAerocondenser.Cair2, airSink.C) annotation (Line(points={{9.16667,9.16667},{20,9.16667},{20,20}}, + color={0,0,0})); + annotation ( + experiment(StopTime=1000), + Icon(coordinateSystem(preserveAspectRatio=false)), + Diagram(coordinateSystem(preserveAspectRatio=false))); end TestStaticAerocondenser; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticAerocondenser_TSP.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticAerocondenser_TSP.mo deleted file mode 100644 index 538ad522..00000000 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestStaticAerocondenser_TSP.mo +++ /dev/null @@ -1,96 +0,0 @@ -within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; -model TestStaticAerocondenser_TSP - extends ThermoSysPro.UsersGuide.Icons.Example; - - replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; - replaceable package Medium_Air = ThermoSysPro.Properties.Media.FlueGases; - - model SourceH - replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium; - parameter Units.SI.MassFlowRate Q0=1; - parameter Units.SI.SpecificEnthalpy h0=1e5; - parameter Medium.MassFraction X0[Medium.nXi]=Medium.X_default[1:Medium.nXi]; - parameter Medium.ExtraProperty SubC0[Medium.nC]=Medium.C_default; - parameter Boolean fix_h_vol_2=false; - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C(redeclare package Medium = Medium); - equation - C.Q = Q0; - C.h = h0; - C.h_vol_1 = h0; - if fix_h_vol_2 then - C.h_vol_2 = h0; - end if; - C.diff_res_1 = 0; - C.diff_on_1 = false; - C.Xi = X0; - C.SubC = SubC0; - end SourceH; - - model SinkDiff - replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium; - parameter Boolean fix_h_vol_2=false; - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C(redeclare package Medium = Medium); - equation - if fix_h_vol_2 then - C.h_vol_2 = C.h; - end if; - C.diff_res_2 = 0; - C.diff_on_2 = false; - end SinkDiff; - - model SinkPOnly - replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium; - parameter Units.SI.AbsolutePressure P0=1e5; - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C(redeclare package Medium = Medium); - equation - C.P = P0; - C.diff_res_2 = 0; - C.diff_on_2 = false; - end SinkPOnly; - - ThermoSysPro.Fluid.HeatExchangers.StaticAerocondenser staticAerocondenser( - redeclare package Medium = Medium, - redeclare package Medium_Air = Medium_Air, - Se=10000, - z=0.5, - use_Cw=true, - Ka=1) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); - SourceH airSource( - redeclare package Medium = Medium_Air, - fix_h_vol_2=true, - Q0=1400, - h0=Medium_Air.specificEnthalpy_pTX( - p=100000, - T=293.15, - X=Medium_Air.X_default)) annotation (Placement(transformation(extent={{60,-10},{40,10}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceQ drainSource( - redeclare package Medium = Medium, - Q0=1, - T0=340, - h0=370000) annotation (Placement(transformation(extent={{-70,-62},{-50,-42}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceQ steamSource1( - redeclare package Medium = Medium, - Q0=100, - T0=340, - h0=2600000) annotation (Placement(transformation(extent={{-44,68},{-24,88}}, rotation=0))); - SinkDiff condensateSink(redeclare package Medium = Medium) annotation (Placement(transformation( - extent={{-10,-70},{10,-50}}, - rotation=-90, - origin={100,-34}))); - SinkPOnly airSink(redeclare package Medium = Medium_Air, P0=100000) annotation (Placement(transformation( - extent={{40,50},{60,70}}, - rotation=90, - origin={92,-10}))); -equation - staticAerocondenser.Cws2.h_vol_2 = staticAerocondenser.Cws2.h; - - connect(airSource.C, staticAerocondenser.Cair1) annotation (Line(points={{40,0},{9.16667,-9.08333}}, color={0,0,0})); - connect(drainSource.C, staticAerocondenser.Cw) annotation (Line(points={{-50,-52},{-16,-52},{-16,-7.5},{-9.16667,-7.5}}, color={0,0,0})); - connect(staticAerocondenser.Cws1, steamSource1.C) annotation (Line(points={{0,9.16667},{0,78},{-24,78}}, color={0,0,0})); - connect(staticAerocondenser.Cws2, condensateSink.C) annotation (Line(points={{0,-9.16667},{0,-36},{24,-36},{24,-76}}, color={0,0,0})); - connect(staticAerocondenser.Cair2, airSink.C) annotation (Line(points={{9.16667,9.16667},{142,40}}, color={0,0,0})); - annotation ( - experiment(StopTime=1000), - Icon(coordinateSystem(preserveAspectRatio=false)), - Diagram(coordinateSystem(preserveAspectRatio=false))); -end TestStaticAerocondenser_TSP; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order index 707e0f75..cb2aed89 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order @@ -37,6 +37,5 @@ TestStaticCondenser TestStaticCondenser_Traces TestStaticCondenserHEI TestStaticCondenserHEI_Traces -TestStaticAerocondenser TestDynamicPlateHeatExchangerW -TestStaticAerocondenser_TSP +TestStaticAerocondenser diff --git a/ThermoSysPro/Fluid/HeatExchangers/StaticAerocondenser.mo b/ThermoSysPro/Fluid/HeatExchangers/StaticAerocondenser.mo index 2d8f867c..6b9ec23d 100644 --- a/ThermoSysPro/Fluid/HeatExchangers/StaticAerocondenser.mo +++ b/ThermoSysPro/Fluid/HeatExchangers/StaticAerocondenser.mo @@ -471,8 +471,72 @@ equation width=0.76, height=0.76), Documentation(info=" -

    Copyright © EDF 2002 - 2024

    -

    ThermoSysPro Version 4.1

    +

    # StaticAerocondenser

    + +

    +Static model of an air-cooled condenser. A water/steam flow is condensed at the +condensation pressure and the released heat is transferred to a cooling-air flow. +An optional drain inlet Cw can be enabled with use_Cw=true. +

    + +

    ## Main hypotheses

    +
      +
    • The model is static: no mass or energy storage is represented.
    • +
    • The condensing side is assumed to be at a single condensation pressure Pcond.
    • +
    • The liquid outlet enthalpy he is the saturated liquid enthalpy at Pcond.
    • +
    • The pressure at the bottom of the condenser includes the hydrostatic head: Pfond = Pcond + rho_e*g*z.
    • +
    • The air side is single phase and exchanges heat with the condensing side through an NTU-effectiveness law.
    • +
    • The air pressure loss is quadratic: deltaP = Ka*Qa*abs(Qa)/rho_a.
    • +
    • The water/steam pressure loss is represented through the imposed relation between Pcond, Pfond, and the connected ports.
    • +
    • Fluid composition and trace substances are transported without internal accumulation or phase-separation model.
    • +
    + +

    ## Connectors

    +
      +
    • Cws1: steam inlet on the condensing side.
    • +
    • Cws2: condensate outlet on the condensing side.
    • +
    • Cw: optional drain inlet on the condensing side; disabled internally when use_Cw=false.
    • +
    • Cair1: cooling-air inlet.
    • +
    • Cair2: cooling-air outlet.
    • +
    + +

    ## Main equations

    +
      +
    • Water/steam mass balance: 0 = Cws1.Q + Cw.Q - Cws2.Q.
    • +
    • Water/steam energy balance: 0 = (Cws1.h - he)*Cws1.Q + (Cw.h - he)*Cw.Q - (Cws2.h - he)*Cws2.Q - W + J.
    • +
    • Air heat power: W = Qa*(has - hae).
    • +
    • Air-side NTU: Nut = Se*U/(Qa*cp_a) when Qa*cp_a > 0.
    • +
    • Two-phase effectiveness: Ef = 1 - exp(-Nut).
    • +
    • Condensation temperature: Tcond = (Tas + Tae*(Ef - 1))/Ef.
    • +
    • Condensation pressure: Pcond = Medium.saturationPressure(Tcond).
    • +
    + +

    ## Media and transported quantities

    +
      +
    • Medium is the condensing-side medium and must provide two-phase saturation properties.
    • +
    • Medium_Air is the air-side medium and is evaluated with the generic Medium API.
    • +
    • Condensing-side mass fractions are taken from Cws1.Xi and propagated to Cws2.Xi.
    • +
    • Air-side mass fractions are propagated between Cair1 and Cair2.
    • +
    • Trace substances are passed through directly; no source/sink or separation term is added in this component.
    • +
    + +

    ## Heat-transfer law

    +

    +The reference heat-transfer coefficient Uref is corrected by +UCOR and by an empirical dependency on the inlet air temperature: +

    +

    U = UCOR*Uref*(-2e-4*(Tae - 273.16)^2 + 0.0187*(Tae - 273.16) + 0.5007)

    + +

    ## Limitations

    +
      +
    • The model is intended for steady-state or quasi-steady network calculations.
    • +
    • It does not represent condenser metal thermal inertia, air-side distributed effects, fan behavior, or detailed tube geometry.
    • +
    • The optional drain inlet is mixed algebraically with the steam inlet before condensation.
    • +
    • Reverse-flow behavior is handled with the connector enthalpy variables and the continuous_flow_reversal option.
    • +
    + +

    Copyright © EDF 2002 - 2024

    +

    ThermoSysPro Version 4.1

    ", revisions="

    Author

    From 3d9a3c1d7a3208c0c9b93ea771d86c4f6a3dd1ab Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Wed, 13 May 2026 14:48:48 +0200 Subject: [PATCH 145/178] #125 ThreeWayValve --- .../PressureLosses/TestThreeWayValve.mo | 50 +++++++++++++++++ .../TestThreeWayValve_FlueGases.mo | 54 +++++++++++++++++++ .../TestThreeWayValve_Traces.mo | 52 ++++++++++++++++++ .../PressureLosses/package.order | 3 ++ .../Fluid/PressureLosses/ThreeWayValve.mo | 52 ++++++------------ 5 files changed, 174 insertions(+), 37 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestThreeWayValve.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestThreeWayValve_FlueGases.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestThreeWayValve_Traces.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestThreeWayValve.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestThreeWayValve.mo new file mode 100644 index 00000000..5d93f85f --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestThreeWayValve.mo @@ -0,0 +1,50 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.PressureLosses; +model TestThreeWayValve + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam; + + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP( + redeclare replaceable package Medium = Medium, + P0=300000, + h0=100000, + option_temperature=false) + annotation (Placement(transformation(extent={{-90,-10},{-70,10}}))); + ThermoSysPro.Fluid.PressureLosses.ThreeWayValve threeWayValve( + redeclare replaceable package Medium = Medium, + C2(Q(start=0)), + C3(Q(start=2000)), + Valve1(Pm(start=200000)), + VolumeA1(h(start=100000))) + annotation (Placement(transformation(extent={{-10,-6},{10,14}}))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP1( + redeclare replaceable package Medium = Medium, + P0=100000, + h0=100000, + option_temperature=false) + annotation (Placement(transformation(extent={{70,-10},{90,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP2( + redeclare replaceable package Medium = Medium, + P0=100000, + h0=100000, + option_temperature=false) + annotation (Placement(transformation(extent={{70,-50},{90,-30}}))); + ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Rampe ramp( + Starttime=1, + Duration=2, + Initialvalue=0.2, + Finalvalue=0.8) + annotation (Placement(transformation(extent={{-50,30},{-30,50}}))); +equation + connect(sourceP.C, threeWayValve.C1) + annotation (Line(points={{-70,0},{-10,0}}, color={0,0,255})); + connect(threeWayValve.C2, sinkP1.C) + annotation (Line(points={{10,0},{70,0}}, color={255,0,0})); + connect(threeWayValve.C3, sinkP2.C) + annotation (Line(points={{0,-6},{0,-40},{70,-40}}, color={255,0,0})); + connect(ramp.y, threeWayValve.Ouv) + annotation (Line(points={{-29,40},{0,40},{0,15}}, color={0,0,255})); + annotation (experiment(StopTime=5), + Icon(coordinateSystem(preserveAspectRatio=false)), + Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestThreeWayValve; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestThreeWayValve_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestThreeWayValve_FlueGases.mo new file mode 100644 index 00000000..9aac55bb --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestThreeWayValve_FlueGases.mo @@ -0,0 +1,54 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.PressureLosses; +model TestThreeWayValve_FlueGases + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.FlueGases; + + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP( + redeclare replaceable package Medium = Medium, + P0=450000, + T0=573.15, + option_temperature=true, + X0={0.1,0.2,0.3,0.2,0.2}) + annotation (Placement(transformation(extent={{-90,-10},{-70,10}}))); + ThermoSysPro.Fluid.PressureLosses.ThreeWayValve threeWayValve( + redeclare replaceable package Medium = Medium, + Cvmax1=50000, + Cvmax2=50000, + C2(Q(start=0)), + C3(Q(start=20)), + Valve1(Pm(start=200000)), + Valve2(Pm(start=200000)), + VolumeA1(h(start=2800000))) + annotation (Placement(transformation(extent={{-10,-6},{10,14}}))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP1( + redeclare replaceable package Medium = Medium, + P0=100000, + T0=573.15, + option_temperature=true) + annotation (Placement(transformation(extent={{70,-10},{90,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP2( + redeclare replaceable package Medium = Medium, + P0=100000, + T0=573.15, + option_temperature=true) + annotation (Placement(transformation(extent={{70,-50},{90,-30}}))); + ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Rampe ramp( + Starttime=1, + Duration=2, + Initialvalue=0.2, + Finalvalue=0.8) + annotation (Placement(transformation(extent={{-50,30},{-30,50}}))); +equation + connect(sourceP.C, threeWayValve.C1) + annotation (Line(points={{-70,0},{-10,0}}, color={0,0,255})); + connect(threeWayValve.C2, sinkP1.C) + annotation (Line(points={{10,0},{70,0}}, color={255,0,0})); + connect(threeWayValve.C3, sinkP2.C) + annotation (Line(points={{0,-6},{0,-40},{70,-40}}, color={255,0,0})); + connect(ramp.y, threeWayValve.Ouv) + annotation (Line(points={{-29,40},{0,40},{0,15}}, color={0,0,255})); + annotation (experiment(StopTime=5), + Icon(coordinateSystem(preserveAspectRatio=false)), + Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestThreeWayValve_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestThreeWayValve_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestThreeWayValve_Traces.mo new file mode 100644 index 00000000..50a9e55f --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/TestThreeWayValve_Traces.mo @@ -0,0 +1,52 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.PressureLosses; +model TestThreeWayValve_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = + ThermoSysPro.Fluid.Examples.SimpleExamples.Media.WaterSteam_FullyVolatileTrace; + + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP( + redeclare replaceable package Medium = Medium, + P0=300000, + h0=100000, + option_temperature=false, + SubC0={10}) + annotation (Placement(transformation(extent={{-90,-10},{-70,10}}))); + ThermoSysPro.Fluid.PressureLosses.ThreeWayValve threeWayValve( + redeclare replaceable package Medium = Medium, + C2(Q(start=0)), + C3(Q(start=2000)), + Valve1(Pm(start=200000)), + VolumeA1(h(start=100000))) + annotation (Placement(transformation(extent={{-10,-6},{10,14}}))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP1( + redeclare replaceable package Medium = Medium, + P0=100000, + h0=100000, + option_temperature=false) + annotation (Placement(transformation(extent={{70,-10},{90,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP2( + redeclare replaceable package Medium = Medium, + P0=100000, + h0=100000, + option_temperature=false) + annotation (Placement(transformation(extent={{70,-50},{90,-30}}))); + ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Rampe ramp( + Starttime=1, + Duration=2, + Initialvalue=0.2, + Finalvalue=0.8) + annotation (Placement(transformation(extent={{-50,30},{-30,50}}))); +equation + connect(sourceP.C, threeWayValve.C1) + annotation (Line(points={{-70,0},{-10,0}}, color={0,0,255})); + connect(threeWayValve.C2, sinkP1.C) + annotation (Line(points={{10,0},{70,0}}, color={255,0,0})); + connect(threeWayValve.C3, sinkP2.C) + annotation (Line(points={{0,-6},{0,-40},{70,-40}}, color={255,0,0})); + connect(ramp.y, threeWayValve.Ouv) + annotation (Line(points={{-29,40},{0,40},{0,15}}, color={0,0,255})); + annotation (experiment(StopTime=5), + Icon(coordinateSystem(preserveAspectRatio=false)), + Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestThreeWayValve_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order index 81d4ca5e..6c71b9c9 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/PressureLosses/package.order @@ -13,6 +13,9 @@ TestInvSingularPressureLoss_Traces TestControlValve TestControlValve_Traces TestControlValve_Traces_FlueGases +TestThreeWayValve +TestThreeWayValve_FlueGases +TestThreeWayValve_Traces TestDynamicReliefValve TestDynamicReliefValve_FlueGases TestDynamicReliefValve_Traces diff --git a/ThermoSysPro/Fluid/PressureLosses/ThreeWayValve.mo b/ThermoSysPro/Fluid/PressureLosses/ThreeWayValve.mo index 530b1576..b56b06ba 100644 --- a/ThermoSysPro/Fluid/PressureLosses/ThreeWayValve.mo +++ b/ThermoSysPro/Fluid/PressureLosses/ThreeWayValve.mo @@ -1,11 +1,10 @@ within ThermoSysPro.Fluid.PressureLosses; model ThreeWayValve "Three way valve" - extends - ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidTypeParameterInterface; extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + parameter ThermoSysPro.Units.xSI.Cv Cvmax1=8005.42 "Valve 1 max CV"; parameter ThermoSysPro.Units.xSI.Cv Cvmax2=8005.42 "Valve 2 max CV"; parameter Real caract1[:, 2]=[0, 0; 1, Cvmax1] @@ -29,45 +28,27 @@ model ThreeWayValve "Three way valve" "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; parameter Units.SI.Density p_rho=0 "If > 0, fixed fluid density" annotation (Evaluate=true, Dialog(tab="Fluid", group="Fluid properties")); - parameter IF97Region region=IF97Region.All_regions "IF97 region (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); + parameter IF97Region region=IF97Region.All_regions "IF97 region (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(tab="Fluid", group="Fluid properties")); parameter Boolean dynamic_composition_balance=false - "true: dynamic fluid composition balance equation
    false: static fluid composition balance equation (active for flue gases)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.FlueGases), tab="Fluid", group="Fluid properties")); + "true: dynamic fluid composition balance equation
    false: static fluid composition balance equation" annotation(Evaluate=true, Dialog(tab="Fluid", group="Fluid properties")); - parameter ThermoSysPro.Units.SI.MassFraction Xco20=0.0 - "Initial CO2 mass fraction" annotation (Evaluate=true, Dialog( - enable=dynamic_composition_balance, - tab="Fluid", - group= - "Initial composition values (active for flue gases only if dynamic_composition_balance=true)")); - parameter ThermoSysPro.Units.SI.MassFraction Xh2o0=if ftype == FluidType.FlueGases then 0.05 else 0 - "Initial H20 mass fraction" annotation (Evaluate=true, Dialog( - enable=dynamic_composition_balance, - tab="Fluid", - group= - "Initial composition values (active for flue gases only if dynamic_composition_balance=true)")); - parameter ThermoSysPro.Units.SI.MassFraction Xo20=0.23 - "Initial O2 mass fraction" annotation (Evaluate=true, Dialog( - enable=dynamic_composition_balance, - tab="Fluid", - group= - "Initial composition values (active for flue gases only if dynamic_composition_balance=true)")); - parameter ThermoSysPro.Units.SI.MassFraction Xso20=0 - "Initial SO2 mass fraction" annotation (Evaluate=true, Dialog( + parameter Medium.ExtraProperty X0[Medium.nX]=Medium.X_default + "Initial composition values" annotation (Evaluate=true, Dialog( enable=dynamic_composition_balance, tab="Fluid", - group= - "Initial composition values (active for flue gases only if dynamic_composition_balance=true)")); + group="Medium")); ThermoSysPro.InstrumentationAndControl.Connectors.InputReal Ouv annotation (Placement(transformation( origin={0,110}, extent={{-10,-10},{10,10}}, rotation=270))); - Interfaces.Connectors.FluidInlet C1 annotation (layer="icon", Placement( + Interfaces.Connectors.FluidInlet C1(redeclare package Medium = Medium) annotation (layer="icon", Placement( transformation(extent={{-110,-50},{-90,-30}}, rotation=0))); - Interfaces.Connectors.FluidOutlet C2 annotation (layer="icon", Placement( + Interfaces.Connectors.FluidOutlet C2(redeclare package Medium = Medium) annotation (layer="icon", Placement( transformation(extent={{90,-50},{110,-30}}, rotation=0))); ThermoSysPro.Fluid.PressureLosses.ControlValve Valve1( + redeclare package Medium = Medium, Cvmax=Cvmax1, caract=caract1, mode_caract=mode_caract1, @@ -78,9 +59,10 @@ model ThreeWayValve "Three way valve" origin={-6,-50}, extent={{10,-10},{-10,10}}, rotation=90))); - Interfaces.Connectors.FluidOutlet C3 annotation (Placement(transformation( + Interfaces.Connectors.FluidOutlet C3(redeclare package Medium = Medium) annotation (Placement(transformation( extent={{-10,-110},{10,-90}}, rotation=0))); ThermoSysPro.Fluid.PressureLosses.ControlValve Valve2( + redeclare package Medium = Medium, Cvmax=Cvmax2, caract=caract2, mode_caract=mode_caract2, @@ -95,20 +77,16 @@ model ThreeWayValve "Three way valve" ThermoSysPro.InstrumentationAndControl.Blocks.Math.Add Add1(k2=-1) annotation (Placement(transformation( extent={{-40,40},{-20,60}}, rotation=0))); Volumes.VolumeA VolumeA1( + redeclare package Medium = Medium, V=V, p_rho=p_rho, dynamic_energy_balance=dynamic_energy_balance, diffusion=diffusion, continuous_flow_reversal=continuous_flow_reversal, - ftype=ftype, - region=region, dynamic_composition_balance=dynamic_composition_balance, - Xco20=Xco20, - Xh2o0=Xh2o0, - Xo20=Xo20, - Xso20=Xso20) annotation (Placement(transformation(extent={{-10, + X0=X0) annotation (Placement(transformation(extent={{-10, -10},{10,10}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.PipePressureLoss PerteDP1(K=0, region=region, gamma_diff=gamma_diff) + ThermoSysPro.Fluid.PressureLosses.PipePressureLoss PerteDP1(redeclare package Medium = Medium, K=0, gamma_diff=gamma_diff) annotation (Placement(transformation(extent={{-60,-10},{-40,10}}, rotation= 0))); equation From 02de5c96388c93dc3dab43e4dd7a124631338ab3 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Mon, 18 May 2026 09:52:36 +0200 Subject: [PATCH 146/178] #125 HeatExchangers with examples What is done: Migrated the HeatExchangers assembly components to replaceable media. Added/redeclared media through internal components/connectors. Added the requested example files under ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers. Updated package.order. Migrated SensorP because the steam generator assemblies needed medium-aware connectors. What currently simulates with omc: TestDynamicMultiFluidHeatExchanger TestDynamicMultiFluidHeatExchanger_Traces TestDynamicWaterSteamMultiFluidsHeatExchanger TestDynamicWaterSteamMultiFluidsHeatExchanger_Traces TestDynamicCondenser TestDynamicCondenser_Traces TestSteamGenerator_1SG TestSteamGenerator_1SG_Traces Still failing in omc simulation: Flue-gases examples for the generic wrappers: temperature_phX/root-bracketing failures in FlueGases. TestDynamicFlueGasesMultiFluidHeatExchanger: still tied to the same FlueGases initialization issue. TestDynamicWaterHeater / OnePipe: initialization nonlinear systems fail. TestSteamGenerator_4SG / _Traces: nonlinear initialization fails even after switching to the 1SG-style boundary values. --- .../HeatExchangers/TestDynamicCondenser.mo | 31 +++++++++++++ .../TestDynamicCondenser_Traces.mo | 7 +++ ...DynamicFlueGasesMultiFluidHeatExchanger.mo | 26 +++++++++++ ...FlueGasesMultiFluidHeatExchanger_Traces.mo | 8 ++++ .../TestDynamicMultiFluidHeatExchanger.mo | 24 ++++++++++ ...TestDynamicMultiFluidHeatExchangerShell.mo | 24 ++++++++++ ...cMultiFluidHeatExchangerShell_FlueGases.mo | 11 +++++ ...amicMultiFluidHeatExchangerShell_Traces.mo | 8 ++++ ...ynamicMultiFluidHeatExchanger_FlueGases.mo | 11 +++++ ...stDynamicMultiFluidHeatExchanger_Traces.mo | 8 ++++ .../HeatExchangers/TestDynamicWaterHeater.mo | 32 ++++++++++++++ .../TestDynamicWaterHeaterOnePipe.mo | 30 +++++++++++++ .../TestDynamicWaterHeaterOnePipe_Traces.mo | 7 +++ .../TestDynamicWaterHeater_Traces.mo | 7 +++ ...namicWaterSteamMultiFluidsHeatExchanger.mo | 24 ++++++++++ ...terSteamMultiFluidsHeatExchanger_Traces.mo | 8 ++++ .../HeatExchangers/TestSteamGenerator_1SG.mo | 24 ++++++++++ .../TestSteamGenerator_1SG_Traces.mo | 7 +++ .../HeatExchangers/TestSteamGenerator_4SG.mo | 24 ++++++++++ .../TestSteamGenerator_4SG_Traces.mo | 7 +++ .../HeatExchangers/package.order | 22 +++++++++- .../Fluid/HeatExchangers/DynamicCondenser.mo | 35 +++++++-------- ...DynamicFlueGasesMultiFluidHeatExchanger.mo | 16 ++++--- .../DynamicMultiFluidHeatExchanger.mo | 18 ++++---- .../DynamicMultiFluidHeatExchangerShell.mo | 22 +++++----- .../HeatExchangers/DynamicWaterHeater.mo | 44 +++++++++---------- .../DynamicWaterHeaterOnePipe.mo | 38 ++++++++-------- ...namicWaterSteamMultiFluidsHeatExchanger.mo | 16 ++++--- .../HeatExchangers/SteamGenerator_1SG.mo | 38 +++++++++------- .../HeatExchangers/SteamGenerator_4SG.mo | 41 +++++++++-------- ThermoSysPro/Fluid/Sensors/SensorP.mo | 14 +++--- 31 files changed, 493 insertions(+), 139 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicCondenser.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicCondenser_Traces.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicFlueGasesMultiFluidHeatExchanger.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicFlueGasesMultiFluidHeatExchanger_Traces.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicMultiFluidHeatExchanger.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicMultiFluidHeatExchangerShell.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicMultiFluidHeatExchangerShell_FlueGases.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicMultiFluidHeatExchangerShell_Traces.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicMultiFluidHeatExchanger_FlueGases.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicMultiFluidHeatExchanger_Traces.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicWaterHeater.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicWaterHeaterOnePipe.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicWaterHeaterOnePipe_Traces.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicWaterHeater_Traces.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicWaterSteamMultiFluidsHeatExchanger.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicWaterSteamMultiFluidsHeatExchanger_Traces.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestSteamGenerator_1SG.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestSteamGenerator_1SG_Traces.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestSteamGenerator_4SG.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestSteamGenerator_4SG_Traces.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicCondenser.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicCondenser.mo new file mode 100644 index 00000000..94c9e846 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicCondenser.mo @@ -0,0 +1,31 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; +model TestDynamicCondenser + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam; + replaceable package Medium_Cooling = Properties.Media.WaterSteam; + + ThermoSysPro.Fluid.HeatExchangers.DynamicCondenser condenser( + redeclare package Medium = Medium, + redeclare package Medium_Cooling = Medium_Cooling, + Ns=3, + ntubest=1000, + ntubesV=50, + dynamic_energy_balance=false, + dynamic_mass_balance=false, + inertia=false) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ vaporSource(redeclare package Medium = Medium, Q0=10, h0=2.7e6, option_temperature=false) annotation (Placement(transformation(extent={{-10,50},{10,70}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ extraVaporSource(redeclare package Medium = Medium, Q0=1e-4, h0=2.7e6, option_temperature=false) annotation (Placement(transformation(extent={{-70,50},{-50,70}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ extraWaterSource(redeclare package Medium = Medium, Q0=1e-4, h0=1e5, option_temperature=false) annotation (Placement(transformation(extent={{-70,20},{-50,40}}))); + ThermoSysPro.Fluid.BoundaryConditions.SinkQ condensateSink(redeclare package Medium = Medium, Q0=10.0002, h0=1e5, option_temperature=false) annotation (Placement(transformation(extent={{-10,-70},{10,-50}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ coolingSource(redeclare package Medium = Medium_Cooling, Q0=100, h0=1e5, option_temperature=false) annotation (Placement(transformation(extent={{-70,-20},{-50,0}}))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP coolingSink(redeclare package Medium = Medium_Cooling, P0=100000, h0=1e5, option_temperature=false) annotation (Placement(transformation(extent={{50,-20},{70,0}}))); +equation + connect(vaporSource.C, condenser.C1vap) annotation (Line(points={{10,60},{0,60},{0,10}}, color={0,0,255})); + connect(extraVaporSource.C, condenser.C2vap) annotation (Line(points={{-50,60},{-3.9,60},{-3.9,9.2}}, color={0,0,255})); + connect(extraWaterSource.C, condenser.C1) annotation (Line(points={{-50,30},{-8.1,30},{-8.1,7.5}}, color={0,0,255})); + connect(condenser.C2ex, condensateSink.C) annotation (Line(points={{0,-10},{0,-50}}, color={0,0,255})); + connect(coolingSource.C, condenser.Ce1) annotation (Line(points={{-50,-10},{-10,-10},{-10,-0.1}}, color={0,0,255})); + connect(condenser.Ce2, coolingSink.C) annotation (Line(points={{9.9,-0.1},{30,-0.1},{30,-10},{50,-10}}, color={0,0,255})); + annotation (experiment(StopTime=1), Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestDynamicCondenser; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicCondenser_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicCondenser_Traces.mo new file mode 100644 index 00000000..0a600512 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicCondenser_Traces.mo @@ -0,0 +1,7 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; +model TestDynamicCondenser_Traces + extends TestDynamicCondenser( + redeclare package Medium = Properties.Media.WaterSteam, + redeclare package Medium_Cooling = ThermoSysPro.Fluid.Examples.SimpleExamples.Media.WaterSteam_FullyVolatileTrace, + coolingSource(SubC0={10})); +end TestDynamicCondenser_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicFlueGasesMultiFluidHeatExchanger.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicFlueGasesMultiFluidHeatExchanger.mo new file mode 100644 index 00000000..fd5ab781 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicFlueGasesMultiFluidHeatExchanger.mo @@ -0,0 +1,26 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; +model TestDynamicFlueGasesMultiFluidHeatExchanger + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam; + replaceable package Medium_FlueGases = Properties.Media.FlueGases; + + ThermoSysPro.Fluid.HeatExchangers.DynamicFlueGasesMultiFluidHeatExchanger exchanger( + redeclare package Medium = Medium, + redeclare package Medium_FlueGases = Medium_FlueGases, + h0=fill(1.2e6, 1), + option_temperature=false, + dynamic_energy_balance=false, + dynamic_mass_balance=false, + inertia=false) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceFg(redeclare package Medium = Medium_FlueGases, Q0=10, T0=573.15, option_temperature=true, X0={0.1,0.2,0.3,0.2,0.2}) annotation (Placement(transformation(extent={{-10,50},{10,70}}))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkFg(redeclare package Medium = Medium_FlueGases, P0=100000, T0=573.15, option_temperature=true) annotation (Placement(transformation(extent={{-10,-70},{10,-50}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceWs(redeclare package Medium = Medium, P0=300000, h0=1.2e6, option_temperature=false) annotation (Placement(transformation(extent={{-70,-10},{-50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkWs(redeclare package Medium = Medium, P0=100000, h0=1.2e6, option_temperature=false) annotation (Placement(transformation(extent={{50,-10},{70,10}}))); +equation + connect(sourceFg.C, exchanger.Cfg1) annotation (Line(points={{10,60},{20,60},{20,5},{0,5}}, color={0,0,255})); + connect(exchanger.Cfg2, sinkFg.C) annotation (Line(points={{0,-5},{0,-50}}, color={0,0,255})); + connect(sourceWs.C, exchanger.Cws1) annotation (Line(points={{-50,0},{-10,0}}, color={0,0,255})); + connect(exchanger.Cws2, sinkWs.C) annotation (Line(points={{10,0},{50,0}}, color={0,0,255})); + annotation (experiment(StopTime=1), Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestDynamicFlueGasesMultiFluidHeatExchanger; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicFlueGasesMultiFluidHeatExchanger_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicFlueGasesMultiFluidHeatExchanger_Traces.mo new file mode 100644 index 00000000..39a421d8 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicFlueGasesMultiFluidHeatExchanger_Traces.mo @@ -0,0 +1,8 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; +model TestDynamicFlueGasesMultiFluidHeatExchanger_Traces + extends TestDynamicFlueGasesMultiFluidHeatExchanger( + redeclare package Medium = ThermoSysPro.Fluid.Examples.SimpleExamples.Media.WaterSteam_FullyVolatileTrace, + redeclare package Medium_FlueGases = Properties.Media.FlueGases(extraPropertiesNames={"Trace1"}, C_nominal={0.1}, C_default={0.2}), + sourceFg(SubC0={30}), + sourceWs(SubC0={10})); +end TestDynamicFlueGasesMultiFluidHeatExchanger_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicMultiFluidHeatExchanger.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicMultiFluidHeatExchanger.mo new file mode 100644 index 00000000..d0b36344 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicMultiFluidHeatExchanger.mo @@ -0,0 +1,24 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; +model TestDynamicMultiFluidHeatExchanger + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium_1 = Properties.Media.WaterSteam; + replaceable package Medium_2 = Properties.Media.WaterSteam; + + ThermoSysPro.Fluid.HeatExchangers.DynamicMultiFluidHeatExchanger exchanger( + redeclare package Medium_1 = Medium_1, + redeclare package Medium_2 = Medium_2, + dynamic_energy_balance=false, + dynamic_mass_balance=false, + inertia=false) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP source1(redeclare package Medium = Medium_1, P0=300000, h0=280000, option_temperature=false) annotation (Placement(transformation(extent={{-70,-30},{-50,-10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sink1(redeclare package Medium = Medium_1, P0=100000, h0=280000, option_temperature=false) annotation (Placement(transformation(extent={{50,-30},{70,-10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP source2(redeclare package Medium = Medium_2, P0=300000, h0=320000, option_temperature=false) annotation (Placement(transformation(extent={{-10,50},{10,70}}))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sink2(redeclare package Medium = Medium_2, P0=100000, h0=310000, option_temperature=false) annotation (Placement(transformation(extent={{-10,-70},{10,-50}}))); +equation + connect(source1.C, exchanger.Cws1) annotation (Line(points={{-50,-20},{-30,-20},{-30,0},{-10,0}}, color={0,0,255})); + connect(exchanger.Cws2, sink1.C) annotation (Line(points={{10,0},{30,0},{30,-20},{50,-20}}, color={0,0,255})); + connect(source2.C, exchanger.Cfg1) annotation (Line(points={{10,60},{20,60},{20,5},{0,5}}, color={0,0,255})); + connect(exchanger.Cfg2, sink2.C) annotation (Line(points={{0,-5},{0,-50}}, color={0,0,255})); + annotation (experiment(StopTime=1), Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestDynamicMultiFluidHeatExchanger; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicMultiFluidHeatExchangerShell.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicMultiFluidHeatExchangerShell.mo new file mode 100644 index 00000000..ec2729ec --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicMultiFluidHeatExchangerShell.mo @@ -0,0 +1,24 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; +model TestDynamicMultiFluidHeatExchangerShell + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium_shell = Properties.Media.WaterSteam; + replaceable package Medium_pipe = Properties.Media.WaterSteam; + + ThermoSysPro.Fluid.HeatExchangers.DynamicMultiFluidHeatExchangerShell exchanger( + redeclare package Medium_shell = Medium_shell, + redeclare package Medium_pipe = Medium_pipe, + dynamic_energy_balance=false, + dynamic_mass_balance=false, + inertia=false) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourcePipe(redeclare package Medium = Medium_pipe, P0=300000, h0=280000, option_temperature=false) annotation (Placement(transformation(extent={{-70,-10},{-50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkPipe(redeclare package Medium = Medium_pipe, P0=100000, h0=280000, option_temperature=false) annotation (Placement(transformation(extent={{50,-10},{70,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceShell(redeclare package Medium = Medium_shell, P0=300000, h0=320000, option_temperature=false) annotation (Placement(transformation(extent={{-10,50},{10,70}}))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkShell(redeclare package Medium = Medium_shell, P0=100000, h0=310000, option_temperature=false) annotation (Placement(transformation(extent={{-10,-70},{10,-50}}))); +equation + connect(sourcePipe.C, exchanger.Cws1) annotation (Line(points={{-50,0},{-10,0}}, color={0,0,255})); + connect(exchanger.Cws2, sinkPipe.C) annotation (Line(points={{10,0},{50,0}}, color={0,0,255})); + connect(sourceShell.C, exchanger.Cfg1) annotation (Line(points={{10,60},{20,60},{20,5},{0,5}}, color={0,0,255})); + connect(exchanger.Cfg2, sinkShell.C) annotation (Line(points={{0,-5},{0,-50}}, color={0,0,255})); + annotation (experiment(StopTime=1), Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestDynamicMultiFluidHeatExchangerShell; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicMultiFluidHeatExchangerShell_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicMultiFluidHeatExchangerShell_FlueGases.mo new file mode 100644 index 00000000..ae54a033 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicMultiFluidHeatExchangerShell_FlueGases.mo @@ -0,0 +1,11 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; +model TestDynamicMultiFluidHeatExchangerShell_FlueGases + extends TestDynamicMultiFluidHeatExchangerShell( + redeclare package Medium_shell = Properties.Media.FlueGases, + redeclare package Medium_pipe = Properties.Media.FlueGases, + exchanger(P0=450000, h0=fill(3e6, 1), option_temperature=false), + sourceShell(P0=450000, h0=3e6, option_temperature=false, X0={0.1,0.2,0.3,0.2,0.2}), + sinkShell(P0=100000, h0=3e6, option_temperature=false), + sourcePipe(P0=450000, h0=3e6, option_temperature=false, X0={0.1,0.2,0.3,0.2,0.2}), + sinkPipe(P0=100000, h0=3e6, option_temperature=false)); +end TestDynamicMultiFluidHeatExchangerShell_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicMultiFluidHeatExchangerShell_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicMultiFluidHeatExchangerShell_Traces.mo new file mode 100644 index 00000000..0f698216 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicMultiFluidHeatExchangerShell_Traces.mo @@ -0,0 +1,8 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; +model TestDynamicMultiFluidHeatExchangerShell_Traces + extends TestDynamicMultiFluidHeatExchangerShell( + redeclare package Medium_shell = ThermoSysPro.Fluid.Examples.SimpleExamples.Media.WaterSteam_FullyVolatileTrace, + redeclare package Medium_pipe = ThermoSysPro.Fluid.Examples.SimpleExamples.Media.WaterSteam_FullyVolatileTrace, + sourcePipe(SubC0={10}), + sourceShell(SubC0={20})); +end TestDynamicMultiFluidHeatExchangerShell_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicMultiFluidHeatExchanger_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicMultiFluidHeatExchanger_FlueGases.mo new file mode 100644 index 00000000..0a8a7d9a --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicMultiFluidHeatExchanger_FlueGases.mo @@ -0,0 +1,11 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; +model TestDynamicMultiFluidHeatExchanger_FlueGases + extends TestDynamicMultiFluidHeatExchanger( + redeclare package Medium_1 = Properties.Media.FlueGases, + redeclare package Medium_2 = Properties.Media.FlueGases, + exchanger(P0=450000, h0=fill(3e6, 1), option_temperature=false), + source1(P0=450000, h0=3e6, option_temperature=false, X0={0.1,0.2,0.3,0.2,0.2}), + sink1(P0=100000, h0=3e6, option_temperature=false), + source2(P0=450000, h0=3e6, option_temperature=false, X0={0.1,0.2,0.3,0.2,0.2}), + sink2(P0=100000, h0=3e6, option_temperature=false)); +end TestDynamicMultiFluidHeatExchanger_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicMultiFluidHeatExchanger_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicMultiFluidHeatExchanger_Traces.mo new file mode 100644 index 00000000..268cc90a --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicMultiFluidHeatExchanger_Traces.mo @@ -0,0 +1,8 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; +model TestDynamicMultiFluidHeatExchanger_Traces + extends TestDynamicMultiFluidHeatExchanger( + redeclare package Medium_1 = ThermoSysPro.Fluid.Examples.SimpleExamples.Media.WaterSteam_FullyVolatileTrace, + redeclare package Medium_2 = ThermoSysPro.Fluid.Examples.SimpleExamples.Media.WaterSteam_FullyVolatileTrace, + source1(SubC0={10}), + source2(SubC0={20})); +end TestDynamicMultiFluidHeatExchanger_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicWaterHeater.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicWaterHeater.mo new file mode 100644 index 00000000..6569c47c --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicWaterHeater.mo @@ -0,0 +1,32 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; +model TestDynamicWaterHeater + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam; + replaceable package Medium_Cooling = Properties.Media.WaterSteam; + + ThermoSysPro.Fluid.HeatExchangers.DynamicWaterHeater waterHeater( + redeclare package Medium = Medium, + redeclare package Medium_Cooling = Medium_Cooling, + dynamic_energy_balance=true, + dynamic_mass_balance=true, + steady_state=false, + P0c=2200000, + Vf0=0.43, + pipe_1(h0=fill(9e5, 10), P0=6900000), + pipe_2(h0=fill(1.0e6, 10), P0=6900000), + pipe_3(h0=fill(9e5, 20), P0=6900000), + inertia=false) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ steamSource(redeclare package Medium = Medium, Q0=10, h0=2.7e6, option_temperature=false) annotation (Placement(transformation(extent={{-10,50},{10,70}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ extraSource(redeclare package Medium = Medium, Q0=1e-4, h0=1e5, option_temperature=false) annotation (Placement(transformation(extent={{-70,50},{-50,70}}))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP condensateSink(redeclare package Medium = Medium, P0=100000, h0=1e5, option_temperature=false) annotation (Placement(transformation(extent={{-10,-70},{10,-50}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ coolingSource(redeclare package Medium = Medium_Cooling, Q0=100, h0=1e5, option_temperature=false) annotation (Placement(transformation(extent={{-70,-50},{-50,-30}}))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP coolingSink(redeclare package Medium = Medium_Cooling, P0=100000, h0=1e5, option_temperature=false) annotation (Placement(transformation(extent={{-70,10},{-50,30}}))); +equation + connect(steamSource.C, waterHeater.C1vap) annotation (Line(points={{10,60},{0,60},{0,10}}, color={0,0,255})); + connect(extraSource.C, waterHeater.C1) annotation (Line(points={{-50,60},{-6.4,60},{-6.4,9.2}}, color={0,0,255})); + connect(waterHeater.C2ex, condensateSink.C) annotation (Line(points={{0,-10},{0,-50}}, color={0,0,255})); + connect(coolingSource.C, waterHeater.Ce1) annotation (Line(points={{-50,-40},{-30,-40},{-30,-4.5},{-10,-4.5}}, color={0,0,255})); + connect(waterHeater.Ce2, coolingSink.C) annotation (Line(points={{-10,4.4},{-30,4.4},{-30,20},{-50,20}}, color={0,0,255})); + annotation (experiment(StopTime=1), Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestDynamicWaterHeater; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicWaterHeaterOnePipe.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicWaterHeaterOnePipe.mo new file mode 100644 index 00000000..88c9f980 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicWaterHeaterOnePipe.mo @@ -0,0 +1,30 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; +model TestDynamicWaterHeaterOnePipe + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam; + replaceable package Medium_Cooling = Properties.Media.WaterSteam; + + ThermoSysPro.Fluid.HeatExchangers.DynamicWaterHeaterOnePipe waterHeater( + redeclare package Medium = Medium, + redeclare package Medium_Cooling = Medium_Cooling, + dynamic_energy_balance=true, + dynamic_mass_balance=true, + steady_state=false, + P0c=2200000, + Vf0=0.43, + pipe_3(h0=fill(9e5, 20), P0=6900000), + inertia=false) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ steamSource(redeclare package Medium = Medium, Q0=10, h0=2.7e6, option_temperature=false) annotation (Placement(transformation(extent={{-10,50},{10,70}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ extraSource(redeclare package Medium = Medium, Q0=1e-4, h0=1e5, option_temperature=false) annotation (Placement(transformation(extent={{-70,50},{-50,70}}))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP condensateSink(redeclare package Medium = Medium, P0=100000, h0=1e5, option_temperature=false) annotation (Placement(transformation(extent={{-10,-70},{10,-50}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ coolingSource(redeclare package Medium = Medium_Cooling, Q0=100, h0=1e5, option_temperature=false) annotation (Placement(transformation(extent={{-70,-50},{-50,-30}}))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP coolingSink(redeclare package Medium = Medium_Cooling, P0=100000, h0=1e5, option_temperature=false) annotation (Placement(transformation(extent={{-70,10},{-50,30}}))); +equation + connect(steamSource.C, waterHeater.C1vap) annotation (Line(points={{10,60},{0,60},{0,10}}, color={0,0,255})); + connect(extraSource.C, waterHeater.C1) annotation (Line(points={{-50,60},{-6.4,60},{-6.4,9.2}}, color={0,0,255})); + connect(waterHeater.C2ex, condensateSink.C) annotation (Line(points={{0,-10},{0,-50}}, color={0,0,255})); + connect(coolingSource.C, waterHeater.Ce1) annotation (Line(points={{-50,-40},{-30,-40},{-30,-4.5},{-10,-4.5}}, color={0,0,255})); + connect(waterHeater.Ce2, coolingSink.C) annotation (Line(points={{-10,4.4},{-30,4.4},{-30,20},{-50,20}}, color={0,0,255})); + annotation (experiment(StopTime=1), Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestDynamicWaterHeaterOnePipe; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicWaterHeaterOnePipe_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicWaterHeaterOnePipe_Traces.mo new file mode 100644 index 00000000..62c252c9 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicWaterHeaterOnePipe_Traces.mo @@ -0,0 +1,7 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; +model TestDynamicWaterHeaterOnePipe_Traces + extends TestDynamicWaterHeaterOnePipe( + redeclare package Medium = Properties.Media.WaterSteam, + redeclare package Medium_Cooling = ThermoSysPro.Fluid.Examples.SimpleExamples.Media.WaterSteam_FullyVolatileTrace, + coolingSource(SubC0={10})); +end TestDynamicWaterHeaterOnePipe_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicWaterHeater_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicWaterHeater_Traces.mo new file mode 100644 index 00000000..ec38847c --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicWaterHeater_Traces.mo @@ -0,0 +1,7 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; +model TestDynamicWaterHeater_Traces + extends TestDynamicWaterHeater( + redeclare package Medium = Properties.Media.WaterSteam, + redeclare package Medium_Cooling = ThermoSysPro.Fluid.Examples.SimpleExamples.Media.WaterSteam_FullyVolatileTrace, + coolingSource(SubC0={10})); +end TestDynamicWaterHeater_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicWaterSteamMultiFluidsHeatExchanger.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicWaterSteamMultiFluidsHeatExchanger.mo new file mode 100644 index 00000000..42c72368 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicWaterSteamMultiFluidsHeatExchanger.mo @@ -0,0 +1,24 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; +model TestDynamicWaterSteamMultiFluidsHeatExchanger + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium_1 = Properties.Media.WaterSteam; + replaceable package Medium_2 = Properties.Media.WaterSteam; + + ThermoSysPro.Fluid.HeatExchangers.DynamicWaterSteamMultiFluidsHeatExchanger exchanger( + redeclare package Medium_1 = Medium_1, + redeclare package Medium_2 = Medium_2, + dynamic_energy_balance=false, + dynamic_mass_balance=false, + inertia=false) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP source1(redeclare package Medium = Medium_1, P0=300000, h0=280000, option_temperature=false) annotation (Placement(transformation(extent={{-10,50},{10,70}}))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sink1(redeclare package Medium = Medium_1, P0=100000, h0=280000, option_temperature=false) annotation (Placement(transformation(extent={{-10,-70},{10,-50}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP source2(redeclare package Medium = Medium_2, P0=300000, h0=1.2e6, option_temperature=false) annotation (Placement(transformation(extent={{-70,-10},{-50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sink2(redeclare package Medium = Medium_2, P0=100000, h0=1.2e6, option_temperature=false) annotation (Placement(transformation(extent={{50,-10},{70,10}}))); +equation + connect(source1.C, exchanger.Cfg1) annotation (Line(points={{10,60},{20,60},{20,5},{0,5}}, color={0,0,255})); + connect(exchanger.Cfg2, sink1.C) annotation (Line(points={{0,-5},{0,-50}}, color={0,0,255})); + connect(source2.C, exchanger.Cws1) annotation (Line(points={{-50,0},{-10,0}}, color={0,0,255})); + connect(exchanger.Cws2, sink2.C) annotation (Line(points={{10,0},{50,0}}, color={0,0,255})); + annotation (experiment(StopTime=1), Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestDynamicWaterSteamMultiFluidsHeatExchanger; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicWaterSteamMultiFluidsHeatExchanger_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicWaterSteamMultiFluidsHeatExchanger_Traces.mo new file mode 100644 index 00000000..ab12229d --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicWaterSteamMultiFluidsHeatExchanger_Traces.mo @@ -0,0 +1,8 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; +model TestDynamicWaterSteamMultiFluidsHeatExchanger_Traces + extends TestDynamicWaterSteamMultiFluidsHeatExchanger( + redeclare package Medium_1 = ThermoSysPro.Fluid.Examples.SimpleExamples.Media.WaterSteam_FullyVolatileTrace, + redeclare package Medium_2 = ThermoSysPro.Fluid.Examples.SimpleExamples.Media.WaterSteam_FullyVolatileTrace, + source1(SubC0={10}), + source2(SubC0={20})); +end TestDynamicWaterSteamMultiFluidsHeatExchanger_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestSteamGenerator_1SG.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestSteamGenerator_1SG.mo new file mode 100644 index 00000000..569af238 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestSteamGenerator_1SG.mo @@ -0,0 +1,24 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; +model TestSteamGenerator_1SG + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam; + replaceable package Medium_Primary = Properties.Media.WaterSteam; + + ThermoSysPro.Fluid.HeatExchangers.SteamGenerator_1SG steamGenerator( + redeclare package Medium = Medium, + redeclare package Medium_Primary = Medium_Primary, + dynamic_energy_balance=false, + dynamic_mass_balance=false, + inertia=false) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ feedwater(redeclare package Medium = Medium, Q0=531.242, h0=991272, option_temperature=false) annotation (Placement(transformation(extent={{50,30},{70,50}}))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP steamSink(redeclare package Medium = Medium, P0=6600000, h0=2.77257e6, option_temperature=false) annotation (Placement(transformation(extent={{-10,50},{10,70}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ primaryInlet(redeclare package Medium = Medium_Primary, Q0=4756, h0=1.47084e6, option_temperature=false) annotation (Placement(transformation(extent={{-70,-70},{-50,-50}}))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP primaryOutlet(redeclare package Medium = Medium_Primary, P0=15450000, h0=1.27187e6, option_temperature=false) annotation (Placement(transformation(extent={{50,-70},{70,-50}}))); +equation + connect(feedwater.C, steamGenerator.fluidInlet) annotation (Line(points={{70,40},{52,40},{52,7.46667},{3.46667,7.46667}}, color={0,0,255})); + connect(steamGenerator.fluidOutletI, steamSink.C) annotation (Line(points={{0,9.93333},{0,50}}, color={0,0,255})); + connect(primaryInlet.C, steamGenerator.fluidInlet1) annotation (Line(points={{-50,-60},{-3.06667,-60},{-3.06667,-8.13333}}, color={0,0,255})); + connect(steamGenerator.fluidOutletI1, primaryOutlet.C) annotation (Line(points={{3.06667,-8.13333},{3.06667,-60},{50,-60}}, color={0,0,255})); + annotation (experiment(StopTime=1), Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestSteamGenerator_1SG; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestSteamGenerator_1SG_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestSteamGenerator_1SG_Traces.mo new file mode 100644 index 00000000..dd461219 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestSteamGenerator_1SG_Traces.mo @@ -0,0 +1,7 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; +model TestSteamGenerator_1SG_Traces + extends TestSteamGenerator_1SG( + redeclare package Medium = Properties.Media.WaterSteam, + redeclare package Medium_Primary = ThermoSysPro.Fluid.Examples.SimpleExamples.Media.WaterSteam_FullyVolatileTrace, + primaryInlet(SubC0={10})); +end TestSteamGenerator_1SG_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestSteamGenerator_4SG.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestSteamGenerator_4SG.mo new file mode 100644 index 00000000..1d436e20 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestSteamGenerator_4SG.mo @@ -0,0 +1,24 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; +model TestSteamGenerator_4SG + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam; + replaceable package Medium_Primary = Properties.Media.WaterSteam; + + ThermoSysPro.Fluid.HeatExchangers.SteamGenerator_4SG steamGenerator( + redeclare package Medium = Medium, + redeclare package Medium_Primary = Medium_Primary, + dynamic_energy_balance=false, + dynamic_mass_balance=false, + inertia=false) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ feedwater(redeclare package Medium = Medium, Q0=531.242, h0=991272, option_temperature=false) annotation (Placement(transformation(extent={{50,30},{70,50}}))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP steamSink(redeclare package Medium = Medium, P0=6600000, h0=2.77257e6, option_temperature=false) annotation (Placement(transformation(extent={{-10,50},{10,70}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ primaryInlet(redeclare package Medium = Medium_Primary, Q0=4756, h0=1.47084e6, option_temperature=false) annotation (Placement(transformation(extent={{-70,-70},{-50,-50}}))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP primaryOutlet(redeclare package Medium = Medium_Primary, P0=15450000, h0=1.27187e6, option_temperature=false) annotation (Placement(transformation(extent={{50,-70},{70,-50}}))); +equation + connect(feedwater.C, steamGenerator.fluidInlet) annotation (Line(points={{70,40},{52,40},{52,7.46667},{3.46667,7.46667}}, color={0,0,255})); + connect(steamGenerator.fluidOutletI, steamSink.C) annotation (Line(points={{0,9.93333},{0,50}}, color={0,0,255})); + connect(primaryInlet.C, steamGenerator.fluidInlet1) annotation (Line(points={{-50,-60},{-3.06667,-60},{-3.06667,-8.13333}}, color={0,0,255})); + connect(steamGenerator.fluidOutletI1, primaryOutlet.C) annotation (Line(points={{3.06667,-8.13333},{3.06667,-60},{50,-60}}, color={0,0,255})); + annotation (experiment(StopTime=1), Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestSteamGenerator_4SG; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestSteamGenerator_4SG_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestSteamGenerator_4SG_Traces.mo new file mode 100644 index 00000000..2b9eb78f --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestSteamGenerator_4SG_Traces.mo @@ -0,0 +1,7 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; +model TestSteamGenerator_4SG_Traces + extends TestSteamGenerator_4SG( + redeclare package Medium = Properties.Media.WaterSteam, + redeclare package Medium_Primary = ThermoSysPro.Fluid.Examples.SimpleExamples.Media.WaterSteam_FullyVolatileTrace, + primaryInlet(SubC0={10})); +end TestSteamGenerator_4SG_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order index cb2aed89..a33c9fb7 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/package.order @@ -24,6 +24,7 @@ TestStaticPlateHeatExchanger_FlueGases TestDynamicPlateHeatExchanger TestDynamicPlateHeatExchanger_Traces TestDynamicPlateHeatExchanger_FlueGases +TestDynamicPlateHeatExchangerW TestNTUWaterHeater TestNTUWaterHeater_Traces TestNTUWaterHeater_FlueGases @@ -37,5 +38,24 @@ TestStaticCondenser TestStaticCondenser_Traces TestStaticCondenserHEI TestStaticCondenserHEI_Traces -TestDynamicPlateHeatExchangerW TestStaticAerocondenser +TestDynamicCondenser +TestDynamicCondenser_Traces +TestDynamicFlueGasesMultiFluidHeatExchanger +TestDynamicFlueGasesMultiFluidHeatExchanger_Traces +TestDynamicMultiFluidHeatExchanger +TestDynamicMultiFluidHeatExchanger_FlueGases +TestDynamicMultiFluidHeatExchanger_Traces +TestDynamicMultiFluidHeatExchangerShell +TestDynamicMultiFluidHeatExchangerShell_FlueGases +TestDynamicMultiFluidHeatExchangerShell_Traces +TestDynamicWaterHeater +TestDynamicWaterHeater_Traces +TestDynamicWaterHeaterOnePipe +TestDynamicWaterHeaterOnePipe_Traces +TestDynamicWaterSteamMultiFluidsHeatExchanger +TestDynamicWaterSteamMultiFluidsHeatExchanger_Traces +TestSteamGenerator_1SG +TestSteamGenerator_1SG_Traces +TestSteamGenerator_4SG +TestSteamGenerator_4SG_Traces diff --git a/ThermoSysPro/Fluid/HeatExchangers/DynamicCondenser.mo b/ThermoSysPro/Fluid/HeatExchangers/DynamicCondenser.mo index 78f20d96..4615b798 100644 --- a/ThermoSysPro/Fluid/HeatExchangers/DynamicCondenser.mo +++ b/ThermoSysPro/Fluid/HeatExchangers/DynamicCondenser.mo @@ -1,9 +1,9 @@ within ThermoSysPro.Fluid.HeatExchangers; model DynamicCondenser "Dynamic condenser" - extends - ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.WaterSteamFluidTypeParameterInterface; extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialTwoPhaseThermoSysProMedium "Medium model for the condensing cavity" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable package Medium_Cooling = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model for the cooling pipes" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Units.SI.Radius Rv=1.0 "Radius of the Cavity cross-sectional area"; parameter Units.SI.Length Lv=15 "Cavity length"; @@ -45,6 +45,7 @@ model DynamicCondenser "Dynamic condenser" parameter Boolean diffusion=false "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; Volumes.TwoPhaseCavityOnePipe DynamicCondenser( + redeclare package Medium = Medium, Vf0=Vf0, P0=P0c, Ns=Ns, @@ -56,7 +57,6 @@ model DynamicCondenser "Dynamic condenser" R=Rv, L=Lv, Vertical=true, - wsftype=wsftype, dynamic_energy_balance=dynamic_energy_balance, steady_state=steady_state, continuous_flow_reversal=continuous_flow_reversal, @@ -64,6 +64,7 @@ model DynamicCondenser "Dynamic condenser" annotation ( Placement(transformation(extent={{-100,-100}, {100,100}}, rotation=0))); DynamicOnePhaseFlowPipe pipe_3( + redeclare package Medium = Medium_Cooling, D=Dc, L=L2, ntubes=ntubest, @@ -80,20 +81,20 @@ model DynamicCondenser "Dynamic condenser" T0=T0, h0=h0) annotation (Placement(transformation(extent={{-58,-20},{54,18}}, rotation=0))); - Interfaces.Connectors.FluidInlet C1vap "Vapor inlet" annotation (Placement( + Interfaces.Connectors.FluidInlet C1vap(redeclare package Medium = Medium) "Vapor inlet" annotation (Placement( transformation(extent={{-10,90},{10,110}}, rotation=0))); - Interfaces.Connectors.FluidOutlet C2ex "Condensed water extraction outlet" + Interfaces.Connectors.FluidOutlet C2ex(redeclare package Medium = Medium) "Condensed water extraction outlet" annotation (Placement(transformation(extent={{-10,-110},{10,-90}}, rotation= 0))); - Interfaces.Connectors.FluidInlet Ce1 "Cooling water inlet" annotation ( + Interfaces.Connectors.FluidInlet Ce1(redeclare package Medium = Medium_Cooling) "Cooling water inlet" annotation ( Placement(transformation(extent={{-110,-11},{-90,9}}, rotation=0))); - Interfaces.Connectors.FluidOutlet Ce2 "Cooling water outlet" annotation ( + Interfaces.Connectors.FluidOutlet Ce2(redeclare package Medium = Medium_Cooling) "Cooling water outlet" annotation ( Placement(transformation(extent={{89,-11},{109,9}}, rotation=0))); ThermoSysPro.InstrumentationAndControl.Connectors.OutputReal sortieReelle annotation (Placement(transformation(extent={{98,-62},{118,-42}}, rotation= 0))); - Interfaces.Connectors.FluidInlet C1 "Extra water inlet" annotation ( + Interfaces.Connectors.FluidInlet C1(redeclare package Medium = Medium) "Extra water inlet" annotation ( Placement(transformation(extent={{-91,65},{-71,85}}, rotation=0), iconTransformation(extent={{-91,65},{-71,85}}))); Thermal.HeatTransfer.HeatExchangerWall Wall_3( @@ -108,7 +109,7 @@ model DynamicCondenser "Dynamic condenser" dynamic_energy_balance=dynamic_energy_balance, steady_state=steady_state) annotation (Placement(transformation(extent={{-58,-4},{54,40}}, rotation=0))); - Interfaces.Connectors.FluidInlet C2vap "Vapor inlet" annotation (Placement( + Interfaces.Connectors.FluidInlet C2vap(redeclare package Medium = Medium) "Vapor inlet" annotation (Placement( transformation(extent={{-49,82},{-29,102}}, rotation=0), iconTransformation(extent={{-49,82},{-29,102}}))); equation @@ -119,11 +120,8 @@ equation C1.h_vol_1 = 1.e5; C1.diff_res_1 = 0; C1.diff_on_1 = false; - C1.ftype = ftype; - C1.Xco2 = 0; - C1.Xh2o = 0; - C1.Xo2 = 0; - C1.Xso2 = 0; + C1.Xi = Medium.X_default[1:Medium.nXi]; + C1.SubC = Medium.C_default; end if; if (cardinality(C2vap) == 1) then @@ -132,11 +130,8 @@ equation C2vap.h_vol_1 = 1.e5; C2vap.diff_res_1 = 0; C2vap.diff_on_1 = false; - C2vap.ftype = ftype; - C2vap.Xco2 = 0; - C2vap.Xh2o = 0; - C2vap.Xo2 = 0; - C2vap.Xso2 = 0; + C2vap.Xi = Medium.X_default[1:Medium.nXi]; + C2vap.SubC = Medium.C_default; end if; connect(DynamicCondenser.Cl, C2ex) diff --git a/ThermoSysPro/Fluid/HeatExchangers/DynamicFlueGasesMultiFluidHeatExchanger.mo b/ThermoSysPro/Fluid/HeatExchangers/DynamicFlueGasesMultiFluidHeatExchanger.mo index fd87f70f..75b5109b 100644 --- a/ThermoSysPro/Fluid/HeatExchangers/DynamicFlueGasesMultiFluidHeatExchanger.mo +++ b/ThermoSysPro/Fluid/HeatExchangers/DynamicFlueGasesMultiFluidHeatExchanger.mo @@ -1,8 +1,9 @@ within ThermoSysPro.Fluid.HeatExchangers; model DynamicFlueGasesMultiFluidHeatExchanger "Dynamic flue gases - water/steam heat exchanger" extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model for the water/steam side" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable package Medium_FlueGases = ThermoSysPro.Properties.Media.FlueGases constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model for the flue gases side" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Units.SI.Length L=1 "Exchanger length"; parameter Units.SI.Position z1=0 "Exchanger inlet altitude"; @@ -35,10 +36,10 @@ model DynamicFlueGasesMultiFluidHeatExchanger "Dynamic flue gases - water/steam parameter Boolean option_temperature=true "true: initial temperature is fixed - false: initial specific enthalpy is fixed (active if steady_state=false)" annotation(Evaluate=true, Dialog(enable=not steady_state)); parameter Boolean continuous_flow_reversal=false "true: continuous flow reversal - false: discontinuous flow reversal"; parameter Boolean diffusion=false "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; - parameter IF97Region region=IF97Region.All_regions "IF97 region (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); StaticWallFlueGasesExchanger ExchangerFlueGasesMetal( + redeclare package Medium = Medium_FlueGases, Dext=0.022, Ns=Ns, NbTub=Ntubes, @@ -60,6 +61,7 @@ model DynamicFlueGasesMultiFluidHeatExchanger "Dynamic flue gases - water/steam T0=T0[1]) annotation (Placement(transformation( extent={{-10,-10},{10,10}}, rotation=0))); Fluid.HeatExchangers.DynamicTwoPhaseFlowPipe TwoPhaseFlowPipe( + redeclare package Medium = Medium, L=L, D=Dint, ntubes=Ntubes, @@ -79,13 +81,13 @@ model DynamicFlueGasesMultiFluidHeatExchanger "Dynamic flue gases - water/steam h0=h0) annotation (Placement(transformation(extent={{-10,-30},{10,-10}}, rotation= 0))); - Interfaces.Connectors.FluidInlet Cfg1 annotation (Placement(transformation( + Interfaces.Connectors.FluidInlet Cfg1(redeclare package Medium = Medium_FlueGases) annotation (Placement(transformation( extent={{-10,40},{10,60}}, rotation=0))); - Interfaces.Connectors.FluidOutlet Cfg2 annotation (Placement(transformation( + Interfaces.Connectors.FluidOutlet Cfg2(redeclare package Medium = Medium_FlueGases) annotation (Placement(transformation( extent={{-10,-60},{10,-40}}, rotation=0))); - Interfaces.Connectors.FluidInlet Cws1 annotation (Placement(transformation( + Interfaces.Connectors.FluidInlet Cws1(redeclare package Medium = Medium) annotation (Placement(transformation( extent={{-110,-10},{-90,10}}, rotation=0))); - Interfaces.Connectors.FluidOutlet Cws2 annotation (Placement(transformation( + Interfaces.Connectors.FluidOutlet Cws2(redeclare package Medium = Medium) annotation (Placement(transformation( extent={{90,-10},{110,10}}, rotation=0))); equation connect(Cws2, TwoPhaseFlowPipe.C2) diff --git a/ThermoSysPro/Fluid/HeatExchangers/DynamicMultiFluidHeatExchanger.mo b/ThermoSysPro/Fluid/HeatExchangers/DynamicMultiFluidHeatExchanger.mo index 524ae21b..fe49ab75 100644 --- a/ThermoSysPro/Fluid/HeatExchangers/DynamicMultiFluidHeatExchanger.mo +++ b/ThermoSysPro/Fluid/HeatExchangers/DynamicMultiFluidHeatExchanger.mo @@ -1,8 +1,9 @@ within ThermoSysPro.Fluid.HeatExchangers; model DynamicMultiFluidHeatExchanger "Dynamic one-phase heat exchanger" extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + + replaceable package Medium_1 = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model for fluid 1" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable package Medium_2 = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model for fluid 2" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Units.SI.Length L=1 "Exchanger length"; parameter Units.SI.Position z1=0 "Exchanger inlet altitude"; @@ -51,9 +52,9 @@ model DynamicMultiFluidHeatExchanger "Dynamic one-phase heat exchanger" "true: continuous flow reversal - false: discontinuous flow reversal"; parameter Boolean diffusion=false "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; - parameter IF97Region region=IF97Region.All_regions "IF97 region (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); DynamicOnePhaseFlowPipe DynamicOnePhaseFlowPipe_2( + redeclare package Medium = Medium_2, Ns=Ns, L=L, ntubes=Ntubes, @@ -68,7 +69,6 @@ model DynamicMultiFluidHeatExchanger "Dynamic one-phase heat exchanger" option_temperature=option_temperature, diffusion=diffusion, simplified_dynamic_energy_balance=simplified_dynamic_energy_balance, - region=region, P0=P0, z1=z1, z2=z2, @@ -90,6 +90,7 @@ model DynamicMultiFluidHeatExchanger "Dynamic one-phase heat exchanger" lambda=lambda) annotation (Placement(transformation( extent={{-10,-10},{10,10}}, rotation=0))); Fluid.HeatExchangers.DynamicOnePhaseFlowPipe DynamicOnePhaseFlowPipe_1( + redeclare package Medium = Medium_1, ntubes=Ntubes, Ns=Ns, T0=T0, @@ -103,7 +104,6 @@ model DynamicMultiFluidHeatExchanger "Dynamic one-phase heat exchanger" option_temperature=option_temperature, continuous_flow_reversal=continuous_flow_reversal, diffusion=diffusion, - region=region, P0=P0, L=L, D=Dint, @@ -111,13 +111,13 @@ model DynamicMultiFluidHeatExchanger "Dynamic one-phase heat exchanger" z1=z1, z2=z2) annotation (Placement(transformation(extent={{-10,-30},{10,-10}}, rotation=0))); - Interfaces.Connectors.FluidInlet Cfg1 annotation (Placement(transformation( + Interfaces.Connectors.FluidInlet Cfg1(redeclare package Medium = Medium_2) annotation (Placement(transformation( extent={{-10,40},{10,60}}, rotation=0))); - Interfaces.Connectors.FluidOutlet Cfg2 annotation (Placement(transformation( + Interfaces.Connectors.FluidOutlet Cfg2(redeclare package Medium = Medium_2) annotation (Placement(transformation( extent={{-10,-60},{10,-40}}, rotation=0))); - Interfaces.Connectors.FluidInlet Cws1 annotation ( + Interfaces.Connectors.FluidInlet Cws1(redeclare package Medium = Medium_1) annotation ( Placement(transformation(extent={{-110,-10},{-90,10}}, rotation=0))); - Interfaces.Connectors.FluidOutlet Cws2 annotation ( + Interfaces.Connectors.FluidOutlet Cws2(redeclare package Medium = Medium_1) annotation ( Placement(transformation(extent={{90,-10},{110,10}}, rotation=0))); equation connect(Cws2, DynamicOnePhaseFlowPipe_1.C2) annotation (Line( diff --git a/ThermoSysPro/Fluid/HeatExchangers/DynamicMultiFluidHeatExchangerShell.mo b/ThermoSysPro/Fluid/HeatExchangers/DynamicMultiFluidHeatExchangerShell.mo index 22151929..3d06449f 100644 --- a/ThermoSysPro/Fluid/HeatExchangers/DynamicMultiFluidHeatExchangerShell.mo +++ b/ThermoSysPro/Fluid/HeatExchangers/DynamicMultiFluidHeatExchangerShell.mo @@ -1,8 +1,9 @@ within ThermoSysPro.Fluid.HeatExchangers; model DynamicMultiFluidHeatExchangerShell "Dynamic one-phase heat exchanger" extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + + replaceable package Medium_shell = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model for shell-side fluid" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable package Medium_pipe = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model for pipe-side fluid" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Units.SI.Length L=1 "Exchanger length"; parameter Units.SI.Position z1=0 "Exchanger inlet altitude"; @@ -41,10 +42,10 @@ model DynamicMultiFluidHeatExchangerShell "Dynamic one-phase heat exchanger" "true: continuous flow reversal - false: discontinuous flow reversal"; parameter Boolean diffusion=false "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; - parameter IF97Region region=IF97Region.All_regions "IF97 region (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); ThermoSysPro.Fluid.HeatExchangers.DynamicOnePhaseFlowShell dynamicOnePhaseFlowShell( + redeclare package Medium = Medium_shell, Ns=Ns, L=L, ntubes=Ntubes, @@ -59,8 +60,7 @@ model DynamicMultiFluidHeatExchangerShell "Dynamic one-phase heat exchanger" advection=advection, diffusion=diffusion, T0=T0, - h0=h0, - region=region) + h0=h0) annotation (Placement(transformation(extent={{-10,30},{10,10}}, rotation=0))); ThermoSysPro.Thermal.HeatTransfer.HeatExchangerWall ExchangerWall( @@ -72,6 +72,7 @@ model DynamicMultiFluidHeatExchangerShell "Dynamic one-phase heat exchanger" steady_state=steady_state) annotation (Placement(transformation( extent={{-10,-10},{10,10}}, rotation=0))); Fluid.HeatExchangers.DynamicOnePhaseFlowPipe DynamicOnePhaseFlowPipe( + redeclare package Medium = Medium_pipe, L=L, D=Dint, ntubes=Ntubes, @@ -89,17 +90,16 @@ model DynamicMultiFluidHeatExchangerShell "Dynamic one-phase heat exchanger" dynamic_mass_balance=dynamic_mass_balance, T0=T0, h0=h0, - P0=P0, - region=region) + P0=P0) annotation (Placement(transformation(extent={{-10,-30},{10,-10}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Cfg1 annotation ( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Cfg1(redeclare package Medium = Medium_shell) annotation ( Placement(transformation(extent={{-10,40},{10,60}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cfg2 annotation ( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cfg2(redeclare package Medium = Medium_shell) annotation ( Placement(transformation(extent={{-10,-60},{10,-40}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Cws1 annotation ( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Cws1(redeclare package Medium = Medium_pipe) annotation ( Placement(transformation(extent={{-110,-10},{-90,10}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cws2 annotation ( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cws2(redeclare package Medium = Medium_pipe) annotation ( Placement(transformation(extent={{90,-10},{110,10}}, rotation=0))); equation connect(Cws2, DynamicOnePhaseFlowPipe.C2) annotation (Line( diff --git a/ThermoSysPro/Fluid/HeatExchangers/DynamicWaterHeater.mo b/ThermoSysPro/Fluid/HeatExchangers/DynamicWaterHeater.mo index db36e781..c078ba6a 100644 --- a/ThermoSysPro/Fluid/HeatExchangers/DynamicWaterHeater.mo +++ b/ThermoSysPro/Fluid/HeatExchangers/DynamicWaterHeater.mo @@ -1,9 +1,9 @@ within ThermoSysPro.Fluid.HeatExchangers; model DynamicWaterHeater "Dynamic water heater" - extends - ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.WaterSteamFluidTypeParameterInterface; extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialTwoPhaseThermoSysProMedium "Medium model for the water/steam cavity" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable package Medium_Cooling = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model for the cooling pipes" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); //parameter Modelica.SIunits.Volume Vc=4510 "Cavity total volume"; //parameter Modelica.SIunits.Area Ac=200 "Cavity cross-sectional area"; @@ -39,7 +39,7 @@ model DynamicWaterHeater "Dynamic water heater" parameter Boolean inertia=true "true: momentum balance equation with inertia - false: without inertia"; parameter Boolean advection=true "true: momentum balance equation with advection terme - false: without advection terme"; parameter Boolean dynamic_energy_balance=true "true: dynamic energy balance equation - false: static energy balance equation"; - parameter Boolean dynamic_mass_balance=true "true: dynamic mass balance equation - false: static mass balance equation (active if the fluid is compressible and if dynamic_energy_balance=true)" annotation(Evaluate=true, Dialog(enable=isCompressible and dynamic_energy_balance)); + parameter Boolean dynamic_mass_balance=true "true: dynamic mass balance equation - false: static mass balance equation (active if the fluid is compressible and if dynamic_energy_balance=true)" annotation(Evaluate=true, Dialog(enable=Medium_Cooling.isCompressible and dynamic_energy_balance)); parameter Boolean simplified_dynamic_energy_balance=true "true: simplified dynamic energy balance equation - false: full dynamic energy balance equation (active if dynamic_energy_balance=true and dynamic_mass_balance=true)" annotation(Evaluate=true, Dialog(enable=dynamic_energy_balance and dynamic_mass_balance)); parameter Boolean steady_state=true "true: start from steady state - false: start from (P0c, Vf0) (active if dynamic_energy_balance=true)" annotation(Evaluate=true, Dialog(enable=dynamic_energy_balance)); parameter Real Vf0=0.66 "Fraction of initial water volume in the drum (active if dynamic_energy_balance=true and steady_state=false)" annotation(Evaluate=true, Dialog(enable=dynamic_energy_balance and not steady_state)); @@ -51,6 +51,7 @@ model DynamicWaterHeater "Dynamic water heater" parameter Boolean diffusion=false "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; Volumes.TwoPhaseCavity WaterHeating( + redeclare package Medium = Medium, Vf0=Vf0, P0=P0c, Ns=Ns, @@ -73,11 +74,11 @@ model DynamicWaterHeater "Dynamic water heater" steady_state=steady_state, Cal_hconv=true, continuous_flow_reversal=continuous_flow_reversal, - diffusion=diffusion, - wsftype=wsftype) + diffusion=diffusion) annotation ( Placement(transformation(extent={{-100, -100},{100,100}}, rotation=0))); ThermoSysPro.Fluid.HeatExchangers.DynamicOnePhaseFlowPipe pipe_3( + redeclare package Medium = Medium_Cooling, option_temperature=false, D=Dc, Ns=Ns*2, @@ -95,20 +96,20 @@ model DynamicWaterHeater "Dynamic water heater" simplified_dynamic_energy_balance=simplified_dynamic_energy_balance, advection=advection) annotation (Placement(transformation(extent={{-35,-34},{60,0}}, rotation=0))); - Interfaces.Connectors.FluidInlet C1vap "Vapor inlet" annotation (Placement( + Interfaces.Connectors.FluidInlet C1vap(redeclare package Medium = Medium) "Vapor inlet" annotation (Placement( transformation(extent={{-10,90},{10,110}}, rotation=0))); - Interfaces.Connectors.FluidOutlet C2ex "Condensed water extraction outlet" + Interfaces.Connectors.FluidOutlet C2ex(redeclare package Medium = Medium) "Condensed water extraction outlet" annotation (Placement(transformation(extent={{-10,-110},{10,-90}}, rotation= 0))); - Interfaces.Connectors.FluidInlet Ce1 "Cooling water inlet" annotation ( + Interfaces.Connectors.FluidInlet Ce1(redeclare package Medium = Medium_Cooling) "Cooling water inlet" annotation ( Placement(transformation(extent={{-110,-55},{-90,-35}}, rotation=0))); - Interfaces.Connectors.FluidOutlet Ce2 "Cooling water outlet" annotation ( + Interfaces.Connectors.FluidOutlet Ce2(redeclare package Medium = Medium_Cooling) "Cooling water outlet" annotation ( Placement(transformation(extent={{-110,34},{-90,54}}, rotation=0))); ThermoSysPro.InstrumentationAndControl.Connectors.OutputReal sortieReelle annotation (Placement(transformation(extent={{92,-86},{112,-66}}, rotation= 0))); - Interfaces.Connectors.FluidInlet C1 "Extra water inlet" annotation ( + Interfaces.Connectors.FluidInlet C1(redeclare package Medium = Medium) "Extra water inlet" annotation ( Placement(transformation(extent={{-74,82},{-54,102}}, rotation=0))); Thermal.HeatTransfer.HeatExchangerWall Wall_3( D=Dc, @@ -123,6 +124,7 @@ model DynamicWaterHeater "Dynamic water heater" steady_state=steady_state) annotation (Placement(transformation(extent={{-34,-24},{60,24}}, rotation=0))); ThermoSysPro.Fluid.HeatExchangers.DynamicOnePhaseFlowPipe pipe_1( + redeclare package Medium = Medium_Cooling, option_temperature=false, D=Dc, Ns=Ns, @@ -155,6 +157,7 @@ model DynamicWaterHeater "Dynamic water heater" annotation (Placement(transformation(extent={{-35,-69},{59,-21}}, rotation= 0))); ThermoSysPro.Fluid.HeatExchangers.DynamicOnePhaseFlowPipe pipe_2( + redeclare package Medium = Medium_Cooling, option_temperature=false, D=Dc, Ns=Ns, @@ -186,30 +189,30 @@ model DynamicWaterHeater "Dynamic water heater" steady_state=steady_state) annotation (Placement(transformation(extent={{-35,21},{59,69}}, rotation=0))); Volumes.VolumeC volumeC( + redeclare package Medium = Medium_Cooling, h0=890e3, dynamic_energy_balance=dynamic_energy_balance, steady_state=steady_state, diffusion=diffusion, dynamic_mass_balance=dynamic_mass_balance, - continuous_flow_reversal=continuous_flow_reversal, - ftype=ftype) annotation (Placement(transformation(extent={{ + continuous_flow_reversal=continuous_flow_reversal) annotation (Placement(transformation(extent={{ -56,35},{-74,53}}, rotation=0))); Volumes.VolumeD volumeD( + redeclare package Medium = Medium_Cooling, h0=790e3, dynamic_energy_balance=dynamic_energy_balance, steady_state=steady_state, diffusion=diffusion, dynamic_mass_balance=dynamic_mass_balance, - continuous_flow_reversal=continuous_flow_reversal, - ftype=ftype) annotation (Placement(transformation(extent={{-74,-54},{-56, + continuous_flow_reversal=continuous_flow_reversal) annotation (Placement(transformation(extent={{-74,-54},{-56, -36}}, rotation=0))); Volumes.VolumeD volumeD1( + redeclare package Medium = Medium_Cooling, h0=850e3, dynamic_energy_balance=dynamic_energy_balance, steady_state=steady_state, diffusion=diffusion, - dynamic_mass_balance=dynamic_mass_balance, - ftype=ftype) annotation (Placement(transformation( + dynamic_mass_balance=dynamic_mass_balance) annotation (Placement(transformation( origin={75,-33}, extent={{-9,-9},{9,9}}, rotation=90))); @@ -221,11 +224,8 @@ equation C1.h_vol_1 = 1.e5; C1.diff_res_1 = 0; C1.diff_on_1 = false; - C1.ftype = ftype; - C1.Xco2 = 0; - C1.Xh2o = 0; - C1.Xo2 = 0; - C1.Xso2 = 0; + C1.Xi = Medium.X_default[1:Medium.nXi]; + C1.SubC = Medium.C_default; end if; connect(C1vap, WaterHeating.Cv) diff --git a/ThermoSysPro/Fluid/HeatExchangers/DynamicWaterHeaterOnePipe.mo b/ThermoSysPro/Fluid/HeatExchangers/DynamicWaterHeaterOnePipe.mo index 85cf51ee..983d6f73 100644 --- a/ThermoSysPro/Fluid/HeatExchangers/DynamicWaterHeaterOnePipe.mo +++ b/ThermoSysPro/Fluid/HeatExchangers/DynamicWaterHeaterOnePipe.mo @@ -1,9 +1,9 @@ within ThermoSysPro.Fluid.HeatExchangers; model DynamicWaterHeaterOnePipe "Dynamic water heater" - extends - ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.WaterSteamFluidTypeParameterInterface; extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialTwoPhaseThermoSysProMedium "Medium model for the water/steam cavity" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable package Medium_Cooling = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model for the cooling pipe" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); //parameter Modelica.SIunits.Volume Vc=4510 "Cavity total volume"; //parameter Modelica.SIunits.Area Ac=200 "Cavity cross-sectional area"; @@ -39,7 +39,7 @@ model DynamicWaterHeaterOnePipe "Dynamic water heater" parameter Boolean inertia=true "true: momentum balance equation with inertia - false: without inertia"; parameter Boolean advection=true "true: momentum balance equation with advection terme - false: without advection terme"; parameter Boolean dynamic_energy_balance=true "true: dynamic energy balance equation - false: static energy balance equation"; - parameter Boolean dynamic_mass_balance=true "true: dynamic mass balance equation - false: static mass balance equation (active if the fluid is compressible and if dynamic_energy_balance=true)" annotation(Evaluate=true, Dialog(enable=isCompressible and dynamic_energy_balance)); + parameter Boolean dynamic_mass_balance=true "true: dynamic mass balance equation - false: static mass balance equation (active if the fluid is compressible and if dynamic_energy_balance=true)" annotation(Evaluate=true, Dialog(enable=Medium_Cooling.isCompressible and dynamic_energy_balance)); parameter Boolean simplified_dynamic_energy_balance=true "true: simplified dynamic energy balance equation - false: full dynamic energy balance equation (active if dynamic_energy_balance=true and dynamic_mass_balance=true)" annotation(Evaluate=true, Dialog(enable=dynamic_energy_balance and dynamic_mass_balance)); parameter Boolean steady_state=true "true: start from steady state - false: start from (Vf0, P0c, T0 or h0) (active if dynamic_energy_balance=true)" annotation(Evaluate=true, Dialog(enable=dynamic_energy_balance)); parameter Real Vf0=0.66 "Fraction of initial water volume in the drum (active if dynamic_energy_balance=true and steady_state=false)" annotation(Evaluate=true, Dialog(enable=dynamic_energy_balance and not steady_state)); @@ -60,6 +60,7 @@ model DynamicWaterHeaterOnePipe "Dynamic water heater" parameter Boolean diffusion=false "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; Volumes.TwoPhaseCavity WaterHeating( + redeclare package Medium = Medium, Vf0=Vf0, P0=P0c, Ns=Ns, @@ -81,11 +82,11 @@ model DynamicWaterHeaterOnePipe "Dynamic water heater" dynamic_energy_balance=dynamic_energy_balance, steady_state=steady_state, continuous_flow_reversal=continuous_flow_reversal, - diffusion=diffusion, - wsftype=wsftype) + diffusion=diffusion) annotation ( Placement(transformation(extent={{-100, -100},{100,100}}, rotation=0))); ThermoSysPro.Fluid.HeatExchangers.DynamicOnePhaseFlowPipe pipe_3( + redeclare package Medium = Medium_Cooling, D=Dc, Ns=Ns*2, dpfCorr=DpfCorr, @@ -105,20 +106,20 @@ model DynamicWaterHeaterOnePipe "Dynamic water heater" option_temperature=option_temperature, P0=P0c) annotation (Placement(transformation(extent={{-35,-34},{60,0}}, rotation=0))); - Interfaces.Connectors.FluidInlet C1vap "Vapor inlet" annotation (Placement( + Interfaces.Connectors.FluidInlet C1vap(redeclare package Medium = Medium) "Vapor inlet" annotation (Placement( transformation(extent={{-10,90},{10,110}}, rotation=0))); - Interfaces.Connectors.FluidOutlet C2ex "Condensed water extraction outlet" + Interfaces.Connectors.FluidOutlet C2ex(redeclare package Medium = Medium) "Condensed water extraction outlet" annotation (Placement(transformation(extent={{-10,-110},{10,-90}}, rotation= 0))); - Interfaces.Connectors.FluidInlet Ce1 "Cooling water inlet" annotation ( + Interfaces.Connectors.FluidInlet Ce1(redeclare package Medium = Medium_Cooling) "Cooling water inlet" annotation ( Placement(transformation(extent={{-110,-55},{-90,-35}}, rotation=0))); - Interfaces.Connectors.FluidOutlet Ce2 "Cooling water outlet" annotation ( + Interfaces.Connectors.FluidOutlet Ce2(redeclare package Medium = Medium_Cooling) "Cooling water outlet" annotation ( Placement(transformation(extent={{-110,34},{-90,54}}, rotation=0))); ThermoSysPro.InstrumentationAndControl.Connectors.OutputReal sortieReelle annotation (Placement(transformation(extent={{92,-86},{112,-66}}, rotation= 0))); - Interfaces.Connectors.FluidInlet C1 "Extra water inlet" annotation ( + Interfaces.Connectors.FluidInlet C1(redeclare package Medium = Medium) "Extra water inlet" annotation ( Placement(transformation(extent={{-74,82},{-54,102}}, rotation=0))); Thermal.HeatTransfer.HeatExchangerWall Wall_3( D=Dc, @@ -134,22 +135,22 @@ model DynamicWaterHeaterOnePipe "Dynamic water heater" annotation (Placement(transformation(extent={{-34,-24},{60,24}}, rotation=0))); Volumes.VolumeD volumeD( + redeclare package Medium = Medium_Cooling, h0=790e3, dynamic_energy_balance=dynamic_energy_balance, steady_state=steady_state, diffusion=diffusion, dynamic_mass_balance=dynamic_mass_balance, - continuous_flow_reversal=continuous_flow_reversal, - ftype=ftype) annotation (Placement(transformation(extent={{-72,-54},{-54,-36}}, + continuous_flow_reversal=continuous_flow_reversal) annotation (Placement(transformation(extent={{-72,-54},{-54,-36}}, rotation=0))); Volumes.VolumeC volumeC( + redeclare package Medium = Medium_Cooling, h0=890e3, dynamic_energy_balance=dynamic_energy_balance, dynamic_mass_balance=dynamic_mass_balance, steady_state=steady_state, diffusion=diffusion, - continuous_flow_reversal=continuous_flow_reversal, - ftype=ftype) annotation (Placement(transformation(extent={{-52,35}, + continuous_flow_reversal=continuous_flow_reversal) annotation (Placement(transformation(extent={{-52,35}, {-70,53}}, rotation=0))); equation if (cardinality(C1) == 1) then @@ -158,11 +159,8 @@ equation C1.h_vol_1 = 1.e5; C1.diff_res_1 = 0; C1.diff_on_1 = false; - C1.ftype = ftype; - C1.Xco2 = 0; - C1.Xh2o = 0; - C1.Xo2 = 0; - C1.Xso2 = 0; + C1.Xi = Medium.X_default[1:Medium.nXi]; + C1.SubC = Medium.C_default; end if; connect(C1vap, WaterHeating.Cv) diff --git a/ThermoSysPro/Fluid/HeatExchangers/DynamicWaterSteamMultiFluidsHeatExchanger.mo b/ThermoSysPro/Fluid/HeatExchangers/DynamicWaterSteamMultiFluidsHeatExchanger.mo index 2492a6bb..fce224ee 100644 --- a/ThermoSysPro/Fluid/HeatExchangers/DynamicWaterSteamMultiFluidsHeatExchanger.mo +++ b/ThermoSysPro/Fluid/HeatExchangers/DynamicWaterSteamMultiFluidsHeatExchanger.mo @@ -1,8 +1,9 @@ within ThermoSysPro.Fluid.HeatExchangers; model DynamicWaterSteamMultiFluidsHeatExchanger "Dynamic water/steam heat exchanger" extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + + replaceable package Medium_1 = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model for the one-phase side" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable package Medium_2 = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model for the water/steam side" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Units.SI.Length L=1 "Exchanger length"; parameter Units.SI.Position z1=0 "Exchanger inlet altitude"; @@ -41,9 +42,9 @@ model DynamicWaterSteamMultiFluidsHeatExchanger "Dynamic water/steam heat exchan "true: continuous flow reversal - false: discontinuous flow reversal"; parameter Boolean diffusion=false "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; - parameter IF97Region region=IF97Region.All_regions "IF97 region (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); Fluid.HeatExchangers.DynamicOnePhaseFlowPipe ExchangerMultiFluids( + redeclare package Medium = Medium_1, Ns=Ns, L=L, ntubes=Ntubes, @@ -71,6 +72,7 @@ model DynamicWaterSteamMultiFluidsHeatExchanger "Dynamic water/steam heat exchan T0=T0[1]) annotation (Placement(transformation( extent={{-10,-10},{10,10}}, rotation=0))); Fluid.HeatExchangers.DynamicTwoPhaseFlowPipe TwoPhaseFlowPipe( + redeclare package Medium = Medium_2, L=L, D=Dint, ntubes=Ntubes, @@ -90,13 +92,13 @@ model DynamicWaterSteamMultiFluidsHeatExchanger "Dynamic water/steam heat exchan continuous_flow_reversal=continuous_flow_reversal) annotation (Placement(transformation(extent={{-10,-30},{10,-10}}, rotation= 0))); - Interfaces.Connectors.FluidInlet Cfg1 annotation (Placement(transformation( + Interfaces.Connectors.FluidInlet Cfg1(redeclare package Medium = Medium_1) annotation (Placement(transformation( extent={{-10,40},{10,60}}, rotation=0))); - Interfaces.Connectors.FluidOutlet Cfg2 annotation (Placement(transformation( + Interfaces.Connectors.FluidOutlet Cfg2(redeclare package Medium = Medium_1) annotation (Placement(transformation( extent={{-10,-60},{10,-40}}, rotation=0))); - Interfaces.Connectors.FluidInlet Cws1 annotation (Placement(transformation( + Interfaces.Connectors.FluidInlet Cws1(redeclare package Medium = Medium_2) annotation (Placement(transformation( extent={{-110,-10},{-90,10}}, rotation=0))); - Interfaces.Connectors.FluidOutlet Cws2 annotation (Placement(transformation( + Interfaces.Connectors.FluidOutlet Cws2(redeclare package Medium = Medium_2) annotation (Placement(transformation( extent={{90,-10},{110,10}}, rotation=0))); equation connect(Cws2, TwoPhaseFlowPipe.C2) diff --git a/ThermoSysPro/Fluid/HeatExchangers/SteamGenerator_1SG.mo b/ThermoSysPro/Fluid/HeatExchangers/SteamGenerator_1SG.mo index d7f788fb..a44a2548 100644 --- a/ThermoSysPro/Fluid/HeatExchangers/SteamGenerator_1SG.mo +++ b/ThermoSysPro/Fluid/HeatExchangers/SteamGenerator_1SG.mo @@ -1,10 +1,9 @@ within ThermoSysPro.Fluid.HeatExchangers; model SteamGenerator_1SG "Single steam generator" - extends - ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.WaterSteamFluidTypeParameterInterface; extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialTwoPhaseThermoSysProMedium "Medium model for the secondary water/steam side" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable package Medium_Primary = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model for the primary side" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Real H0_Mix_AlimDomeGV=1194812.89980521; parameter Boolean inertia=false @@ -33,6 +32,7 @@ model SteamGenerator_1SG "Single steam generator" public ThermoSysPro.Fluid.HeatExchangers.DynamicOnePhaseFlowPipe UtubeHotLeg( + redeclare package Medium = Medium_Primary, L=10.848, D=0.01687, z2=10.848, @@ -60,6 +60,7 @@ public rotation=270))); ThermoSysPro.Fluid.HeatExchangers.DynamicOnePhaseFlowPipe UtubeColdtLeg( + redeclare package Medium = Medium_Primary, L=10.848, D=0.01687, h(start={1326153.46646787,1310848.36111251,1299218.76228131, @@ -87,6 +88,7 @@ public rotation=90))); ThermoSysPro.Fluid.Volumes.DynamicDrum DomeGV( + redeclare package Medium = Medium, hl(start=1257382.15477056), hv(start=2771260.46625813), cpp=500, @@ -100,12 +102,12 @@ public continuous_flow_reversal=continuous_flow_reversal, diffusion=diffusion, Vf0=Vf0, - P0=P0, - wsftype=wsftype) + P0=P0) annotation (Placement(transformation(extent={{-22,64},{22,107}}, rotation=0))); protected ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe DPSeparateurCyclone( + redeclare package Medium = Medium, L=1, D=0.95886, lambda=0.03, @@ -116,6 +118,7 @@ protected rotation=90))); public ThermoSysPro.Fluid.Volumes.VolumeC MixAlimDomeGV( + redeclare package Medium = Medium, h0=H0_Mix_AlimDomeGV, h(start=1194851.37111438), V=0.01, @@ -123,39 +126,40 @@ public steady_state=steady_state, dynamic_mass_balance=dynamic_mass_balance, continuous_flow_reversal=continuous_flow_reversal, - diffusion=diffusion, - ftype=ftype) " " + diffusion=diffusion) " " annotation (Placement(transformation( origin={94,63}, extent={{-8,-8},{8,8}}, rotation=270))); ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss DPnulle_AlimDwnc( + redeclare package Medium = Medium, K=1e-4) annotation (Placement(transformation( origin={94,88}, extent={{-6,-7},{6,7}}, rotation=270))); ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss DPnulle_DomeDwnc( + redeclare package Medium = Medium, p_rho=0, C2(P(start=6829391.22090726), Q(fixed=false, start=6643)), K=0.172144) annotation (Placement(transformation(extent={{53,53}, {63,73}}, rotation=0))); public - ThermoSysPro.Fluid.Sensors.SensorP CapteurPAlim + ThermoSysPro.Fluid.Sensors.SensorP CapteurPAlim(redeclare package Medium = Medium) annotation (Placement(transformation( origin={99,26}, extent={{-6,-6},{6,6}}, rotation=270))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet fluidOutletI + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet fluidOutletI(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-10,139},{10,159}}, rotation= 0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet fluidInlet annotation ( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet fluidInlet(redeclare package Medium = Medium) annotation ( Placement(transformation(extent={{42,102},{62,122}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet fluidInlet1 annotation ( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet fluidInlet1(redeclare package Medium = Medium_Primary) annotation ( Placement(transformation(extent={{-56,-132},{-36,-112}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet fluidOutletI1 + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet fluidOutletI1(redeclare package Medium = Medium_Primary) annotation (Placement(transformation(extent={{36,-132},{56,-112}}, rotation= 0))); ThermoSysPro.InstrumentationAndControl.Connectors.OutputReal outputReal @@ -163,6 +167,7 @@ public 0))); public ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe DownComerGV( + redeclare package Medium = Medium, p_rho=0, h(start=1194851.3), z1=10.8, @@ -217,6 +222,7 @@ public rotation=270))); ThermoSysPro.Fluid.HeatExchangers.DynamicTwoPhaseFlowRiser RiserGV( + redeclare package Medium = Medium, Ns=5, h(start={1194851.37008144,1260885.3160958,1364323.64228458,1450411.24087846, 1525552.01981793,1595519.78942018,1595519.78863864}), @@ -247,24 +253,24 @@ public rotation=90))); ThermoSysPro.Fluid.Volumes.VolumeC volumeA( + redeclare package Medium = Medium, h0=1185.2e3, dynamic_energy_balance=dynamic_energy_balance, steady_state=steady_state, dynamic_mass_balance=dynamic_mass_balance, continuous_flow_reversal=continuous_flow_reversal, diffusion=diffusion, - ftype=ftype, P0=6849350) annotation (Placement(transformation( origin={1,-90}, extent={{-10,-10},{10,10}}, rotation=90))); ThermoSysPro.Fluid.Volumes.VolumeC volumeA1( + redeclare package Medium = Medium, dynamic_energy_balance=dynamic_energy_balance, steady_state=steady_state, dynamic_mass_balance=dynamic_mass_balance, continuous_flow_reversal=continuous_flow_reversal, - diffusion=diffusion, - ftype=ftype) annotation ( + diffusion=diffusion) annotation ( Placement(transformation( origin={0,18}, extent={{-10,-10},{10,10}}, diff --git a/ThermoSysPro/Fluid/HeatExchangers/SteamGenerator_4SG.mo b/ThermoSysPro/Fluid/HeatExchangers/SteamGenerator_4SG.mo index 73f41820..7a19f642 100644 --- a/ThermoSysPro/Fluid/HeatExchangers/SteamGenerator_4SG.mo +++ b/ThermoSysPro/Fluid/HeatExchangers/SteamGenerator_4SG.mo @@ -1,10 +1,9 @@ within ThermoSysPro.Fluid.HeatExchangers; model SteamGenerator_4SG "Single steam generator equivalent to four steam generators" - extends - ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.WaterSteamFluidTypeParameterInterface; extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialTwoPhaseThermoSysProMedium "Medium model for the secondary water/steam side" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable package Medium_Primary = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model for the primary side" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Real H0_Mix_AlimDomeGV=1194812.89980521; parameter Boolean inertia=false @@ -33,6 +32,7 @@ model SteamGenerator_4SG "Single steam generator equivalent to four steam genera public ThermoSysPro.Fluid.HeatExchangers.DynamicOnePhaseFlowPipe UtubeHotLeg( + redeclare package Medium = Medium_Primary, L=10.848, D=0.01687, z2=10.848, @@ -60,6 +60,7 @@ public rotation=270))); ThermoSysPro.Fluid.HeatExchangers.DynamicOnePhaseFlowPipe UtubeColdtLeg( + redeclare package Medium = Medium_Primary, L=10.848, D=0.01687, z1=10.848, @@ -87,6 +88,7 @@ public rotation=90))); ThermoSysPro.Fluid.Volumes.DynamicDrum DomeGV( + redeclare package Medium = Medium, hl(start=1257382.15477056), hv(start=2771260.46625813), Mp=32000, @@ -100,11 +102,11 @@ public Vf0=Vf0, P0=P0, continuous_flow_reversal=continuous_flow_reversal, - diffusion=diffusion, - wsftype=wsftype) annotation (Placement(transformation(extent={{ + diffusion=diffusion) annotation (Placement(transformation(extent={{ -22,64},{22,107}}, rotation=0))); protected ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe DPSeparateurCyclone( + redeclare package Medium = Medium, L=1, D=0.95886, lambda=0.03, @@ -115,6 +117,7 @@ protected rotation=90))); public ThermoSysPro.Fluid.Volumes.VolumeC MixAlimDomeGV( + redeclare package Medium = Medium, h0=H0_Mix_AlimDomeGV, h(start=1194851.37111438), V=0.01, @@ -122,19 +125,19 @@ public dynamic_mass_balance=dynamic_mass_balance, steady_state=steady_state, continuous_flow_reversal=continuous_flow_reversal, - diffusion=diffusion, - ftype=ftype) " " + diffusion=diffusion) " " annotation (Placement(transformation( origin={94,63}, extent={{-8,-8},{8,8}}, rotation=270))); ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss DPnulle_AlimDwnc( - K=1e-4, rho(start=839)) + redeclare package Medium = Medium, K=1e-4, rho(start=839)) annotation (Placement(transformation( origin={94,88}, extent={{-6,-7},{6,7}}, rotation=270))); ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss DPnulle_DomeDwnc( + redeclare package Medium = Medium, p_rho=0, C2(P(start=6829391.22090726), Q(fixed=false, start=6643)), K=0.172144, @@ -142,20 +145,20 @@ public {{53,53},{63,73}}, rotation=0))); public - ThermoSysPro.Fluid.Sensors.SensorP CapteurPAlim + ThermoSysPro.Fluid.Sensors.SensorP CapteurPAlim(redeclare package Medium = Medium) annotation (Placement(transformation( origin={99,26}, extent={{-6,-6},{6,6}}, rotation=270))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet fluidOutletI + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet fluidOutletI(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-10,139},{10,159}}, rotation= 0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet fluidInlet annotation ( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet fluidInlet(redeclare package Medium = Medium) annotation ( Placement(transformation(extent={{42,102},{62,122}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet fluidInlet1 annotation ( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet fluidInlet1(redeclare package Medium = Medium_Primary) annotation ( Placement(transformation(extent={{-56,-132},{-36,-112}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet fluidOutletI1 + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet fluidOutletI1(redeclare package Medium = Medium_Primary) annotation (Placement(transformation(extent={{36,-132},{56,-112}}, rotation= 0))); ThermoSysPro.InstrumentationAndControl.Connectors.OutputReal outputReal @@ -163,6 +166,7 @@ public 0))); public ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe DownComerGV( + redeclare package Medium = Medium, p_rho=0, h(start=1194851.3), z1=10.8, @@ -218,6 +222,7 @@ public rotation=270))); ThermoSysPro.Fluid.HeatExchangers.DynamicTwoPhaseFlowRiser RiserGV( + redeclare package Medium = Medium, Ns=5, Q(start={8600,8600,8600,8600,8600,8600}), h(start={1194851.37008144,1260885.3160958,1364323.64228458,1450411.24087846, @@ -246,26 +251,26 @@ public rotation=90))); ThermoSysPro.Fluid.Volumes.VolumeC volumeA( + redeclare package Medium = Medium, h0=1185.2e3, dynamic_energy_balance=dynamic_energy_balance, dynamic_mass_balance=dynamic_mass_balance, - ftype=ftype, P0=6849350) annotation (Placement(transformation( origin={0.5,-92}, extent={{-8,-8.5},{8,8.5}}, rotation=90))); ThermoSysPro.Fluid.Volumes.VolumeC volumeA1( + redeclare package Medium = Medium, dynamic_energy_balance=dynamic_energy_balance, dynamic_mass_balance=dynamic_mass_balance, steady_state=steady_state, continuous_flow_reversal=continuous_flow_reversal, - diffusion=diffusion, - ftype=ftype) annotation ( + diffusion=diffusion) annotation ( Placement(transformation( origin={-0.5,17}, extent={{-9,-9.5},{9,9.5}}, rotation=90))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss DPnulle_Vapeur(K= + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss DPnulle_Vapeur(redeclare package Medium = Medium, K= 1e-4, Q(start=2113)) annotation (Placement(transformation( origin={-0.5,124}, diff --git a/ThermoSysPro/Fluid/Sensors/SensorP.mo b/ThermoSysPro/Fluid/Sensors/SensorP.mo index a173f50b..bbac2f0c 100644 --- a/ThermoSysPro/Fluid/Sensors/SensorP.mo +++ b/ThermoSysPro/Fluid/Sensors/SensorP.mo @@ -1,15 +1,17 @@ within ThermoSysPro.Fluid.Sensors; model SensorP "Pressure sensor" + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + public ThermoSysPro.InstrumentationAndControl.Connectors.OutputReal Measure annotation (Placement(transformation( origin={0,102}, extent={{-10,-10},{10,10}}, rotation=90))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-110,-90},{-90,-70}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{92,-90},{112,-70}}, rotation=0))); equation @@ -26,12 +28,8 @@ equation C2.diff_res_1 = C1.diff_res_1; C1.diff_res_2 = C2.diff_res_2; - C1.ftype = C2.ftype; - - C1.Xco2 = C2.Xco2; - C1.Xh2o = C2.Xh2o; - C1.Xo2 = C2.Xo2; - C1.Xso2 = C2.Xso2; + C1.Xi = C2.Xi; + C1.SubC = C2.SubC; /* Sensor signal */ Measure.signal = C1.P; From 3e39bd49ecbf0d18e5d679058a98a92cd1e94822 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Thu, 3 Jul 2025 11:25:58 +0200 Subject: [PATCH 147/178] 125 Sensors --- .../SimpleExamples/Sensors/TestSensors.mo | 25 ++++++ .../Sensors/TestSensors_FlueGases.mo | 30 +++++++ .../Sensors/TestSensors_Traces.mo | 29 +++++++ .../SimpleExamples/Sensors/package.order | 3 + ThermoSysPro/Fluid/Sensors/SensorH.mo | 13 ++- ThermoSysPro/Fluid/Sensors/SensorP.mo | 2 +- ThermoSysPro/Fluid/Sensors/SensorQ.mo | 13 ++- ThermoSysPro/Fluid/Sensors/SensorQv.mo | 23 ++---- ThermoSysPro/Fluid/Sensors/SensorSubC.mo | 81 +++++++++++++++++++ ThermoSysPro/Fluid/Sensors/SensorT.mo | 25 +++--- ThermoSysPro/Fluid/Sensors/SensorX.mo | 81 +++++++++++++++++++ ThermoSysPro/Fluid/Sensors/package.order | 2 + 12 files changed, 280 insertions(+), 47 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Sensors/TestSensors.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Sensors/TestSensors_FlueGases.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Sensors/TestSensors_Traces.mo create mode 100644 ThermoSysPro/Fluid/Sensors/SensorSubC.mo create mode 100644 ThermoSysPro/Fluid/Sensors/SensorX.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Sensors/TestSensors.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Sensors/TestSensors.mo new file mode 100644 index 00000000..c0f0702e --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Sensors/TestSensors.mo @@ -0,0 +1,25 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Sensors; +model TestSensors + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam; + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{86,-10},{106,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-106,-10},{-86,10}}))); + ThermoSysPro.Fluid.Sensors.SensorP sensorP(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-82,-2},{-62,18}}))); + ThermoSysPro.Fluid.Sensors.SensorQ sensorQ(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-58,-2},{-38,18}}))); + ThermoSysPro.Fluid.Sensors.SensorQv sensorQv(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-34,-2},{-14,18}}))); + ThermoSysPro.Fluid.Sensors.SensorH sensorH(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-2},{10,18}}))); + ThermoSysPro.Fluid.Sensors.SensorT sensorT(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{14,-2},{34,18}}))); + ThermoSysPro.Fluid.Sensors.SensorSubC sensorSubC(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{38,-2},{58,18}}))); + ThermoSysPro.Fluid.Sensors.SensorX sensorX(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{62,-2},{82,18}}))); +equation + connect(sensorP.C1, sourcePQ.C) annotation (Line(points={{-82,0},{-86,0}}, color={0,0,0})); + connect(sensorP.C2, sensorQ.C1) annotation (Line(points={{-61.8,0},{-58,0}}, color={0,0,0})); + connect(sensorQ.C2, sensorQv.C1) annotation (Line(points={{-37.8,0},{-34,0}}, color={0,0,0})); + connect(sensorQv.C2, sensorH.C1) annotation (Line(points={{-13.8,0},{-10,0}}, color={0,0,0})); + connect(sensorH.C2, sensorT.C1) annotation (Line(points={{10.2,0},{14,0}}, color={0,0,0})); + connect(sensorT.C2, sensorSubC.C1) annotation (Line(points={{34.2,0},{38,0}}, color={0,0,0})); + connect(sensorSubC.C2, sensorX.C1) annotation (Line(points={{58.2,0},{62,0}}, color={0,0,0})); + connect(sensorX.C2, sink.C) annotation (Line(points={{82.2,0},{86,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestSensors; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Sensors/TestSensors_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Sensors/TestSensors_FlueGases.mo new file mode 100644 index 00000000..2a5805a4 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Sensors/TestSensors_FlueGases.mo @@ -0,0 +1,30 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Sensors; +model TestSensors_FlueGases + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.FlueGases; + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package Medium = Medium, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{86,-10},{106,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare replaceable package Medium = Medium, + P0=4500000, + T0=573.15, + option_temperature=true) annotation (Placement(transformation(extent={{-106,-10},{-86,10}}))); + ThermoSysPro.Fluid.Sensors.SensorP sensorP(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-82,-2},{-62,18}}))); + ThermoSysPro.Fluid.Sensors.SensorQ sensorQ(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-58,-2},{-38,18}}))); + ThermoSysPro.Fluid.Sensors.SensorQv sensorQv(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-34,-2},{-14,18}}))); + ThermoSysPro.Fluid.Sensors.SensorH sensorH(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-2},{10,18}}))); + ThermoSysPro.Fluid.Sensors.SensorT sensorT(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{14,-2},{34,18}}))); + ThermoSysPro.Fluid.Sensors.SensorSubC sensorSubC(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{38,-2},{58,18}}))); + ThermoSysPro.Fluid.Sensors.SensorX sensorX(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{62,-2},{82,18}}))); +equation + connect(sensorP.C1, sourcePQ.C) annotation (Line(points={{-82,0},{-86,0}}, color={0,0,0})); + connect(sensorP.C2, sensorQ.C1) annotation (Line(points={{-61.8,0},{-58,0}}, color={0,0,0})); + connect(sensorQ.C2, sensorQv.C1) annotation (Line(points={{-37.8,0},{-34,0}}, color={0,0,0})); + connect(sensorQv.C2, sensorH.C1) annotation (Line(points={{-13.8,0},{-10,0}}, color={0,0,0})); + connect(sensorH.C2, sensorT.C1) annotation (Line(points={{10.2,0},{14,0}}, color={0,0,0})); + connect(sensorT.C2, sensorSubC.C1) annotation (Line(points={{34.2,0},{38,0}}, color={0,0,0})); + connect(sensorSubC.C2, sensorX.C1) annotation (Line(points={{58.2,0},{62,0}}, color={0,0,0})); + connect(sensorX.C2, sink.C) annotation (Line(points={{82.2,0},{86,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestSensors_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Sensors/TestSensors_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Sensors/TestSensors_Traces.mo new file mode 100644 index 00000000..c163eb70 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Sensors/TestSensors_Traces.mo @@ -0,0 +1,29 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Sensors; +model TestSensors_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam ( + extraPropertiesNames={"Trace1"}, + C_nominal={0.1}, + C_default={0.2}); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{86,-10},{106,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(redeclare replaceable package Medium = Medium, SubC0={0.2}) + annotation (Placement(transformation(extent={{-106,-10},{-86,10}}))); + ThermoSysPro.Fluid.Sensors.SensorP sensorP(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-82,-2},{-62,18}}))); + ThermoSysPro.Fluid.Sensors.SensorQ sensorQ(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-58,-2},{-38,18}}))); + ThermoSysPro.Fluid.Sensors.SensorQv sensorQv(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-34,-2},{-14,18}}))); + ThermoSysPro.Fluid.Sensors.SensorH sensorH(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{-10,-2},{10,18}}))); + ThermoSysPro.Fluid.Sensors.SensorT sensorT(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{14,-2},{34,18}}))); + ThermoSysPro.Fluid.Sensors.SensorSubC sensorSubC(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{38,-2},{58,18}}))); + ThermoSysPro.Fluid.Sensors.SensorX sensorX(redeclare replaceable package Medium = Medium) annotation (Placement(transformation(extent={{62,-2},{82,18}}))); +equation + connect(sensorP.C1, sourcePQ.C) annotation (Line(points={{-82,0},{-86,0}}, color={0,0,0})); + connect(sensorP.C2, sensorQ.C1) annotation (Line(points={{-61.8,0},{-58,0}}, color={0,0,0})); + connect(sensorQ.C2, sensorQv.C1) annotation (Line(points={{-37.8,0},{-34,0}}, color={0,0,0})); + connect(sensorQv.C2, sensorH.C1) annotation (Line(points={{-13.8,0},{-10,0}}, color={0,0,0})); + connect(sensorH.C2, sensorT.C1) annotation (Line(points={{10.2,0},{14,0}}, color={0,0,0})); + connect(sensorT.C2, sensorSubC.C1) annotation (Line(points={{34.2,0},{38,0}}, color={0,0,0})); + connect(sensorSubC.C2, sensorX.C1) annotation (Line(points={{58.2,0},{62,0}}, color={0,0,0})); + connect(sensorX.C2, sink.C) annotation (Line(points={{82.2,0},{86,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end TestSensors_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Sensors/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/Sensors/package.order index e69de29b..89cbb72b 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Sensors/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Sensors/package.order @@ -0,0 +1,3 @@ +TestSensors +TestSensors_FlueGases +TestSensors_Traces diff --git a/ThermoSysPro/Fluid/Sensors/SensorH.mo b/ThermoSysPro/Fluid/Sensors/SensorH.mo index d6fcfd4b..92c53c8f 100644 --- a/ThermoSysPro/Fluid/Sensors/SensorH.mo +++ b/ThermoSysPro/Fluid/Sensors/SensorH.mo @@ -1,15 +1,17 @@ within ThermoSysPro.Fluid.Sensors; model SensorH "Specific enthalpy sensor" + extends ThermoSysPro.Fluid.Interfaces.IconColors; + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); public ThermoSysPro.InstrumentationAndControl.Connectors.OutputReal Measure annotation (Placement(transformation( origin={0,102}, extent={{-10,-10},{10,10}}, rotation=90))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-110,-90},{-90,-70}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{92,-90},{112,-70}}, rotation=0))); equation @@ -26,12 +28,9 @@ equation C2.diff_res_1 = C1.diff_res_1; C1.diff_res_2 = C2.diff_res_2; - C1.ftype = C2.ftype; + C1.Xi = C2.Xi; - C1.Xco2 = C2.Xco2; - C1.Xh2o = C2.Xh2o; - C1.Xo2 = C2.Xo2; - C1.Xso2 = C2.Xso2; + C1.SubC = C2.SubC; /* Sensor signal */ Measure.signal = C1.h; diff --git a/ThermoSysPro/Fluid/Sensors/SensorP.mo b/ThermoSysPro/Fluid/Sensors/SensorP.mo index bbac2f0c..2ff4edba 100644 --- a/ThermoSysPro/Fluid/Sensors/SensorP.mo +++ b/ThermoSysPro/Fluid/Sensors/SensorP.mo @@ -1,8 +1,8 @@ within ThermoSysPro.Fluid.Sensors; model SensorP "Pressure sensor" + extends ThermoSysPro.Fluid.Interfaces.IconColors; replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); - public ThermoSysPro.InstrumentationAndControl.Connectors.OutputReal Measure annotation (Placement(transformation( diff --git a/ThermoSysPro/Fluid/Sensors/SensorQ.mo b/ThermoSysPro/Fluid/Sensors/SensorQ.mo index 2867db77..9deb22a2 100644 --- a/ThermoSysPro/Fluid/Sensors/SensorQ.mo +++ b/ThermoSysPro/Fluid/Sensors/SensorQ.mo @@ -1,15 +1,17 @@ within ThermoSysPro.Fluid.Sensors; model SensorQ "Mass flow sensor" + extends ThermoSysPro.Fluid.Interfaces.IconColors; + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); public ThermoSysPro.InstrumentationAndControl.Connectors.OutputReal Measure annotation (Placement(transformation( origin={0,102}, extent={{-10,-10},{10,10}}, rotation=90))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-110,-90},{-90,-70}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{92,-90},{112,-70}}, rotation=0))); equation @@ -26,12 +28,9 @@ equation C2.diff_res_1 = C1.diff_res_1; C1.diff_res_2 = C2.diff_res_2; - C1.ftype = C2.ftype; + C1.Xi = C2.Xi; - C1.Xco2 = C2.Xco2; - C1.Xh2o = C2.Xh2o; - C1.Xo2 = C2.Xo2; - C1.Xso2 = C2.Xso2; + C1.SubC = C2.SubC; /* Sensor signal */ Measure.signal = C1.Q; diff --git a/ThermoSysPro/Fluid/Sensors/SensorQv.mo b/ThermoSysPro/Fluid/Sensors/SensorQv.mo index 1f039216..2c9b2e9a 100644 --- a/ThermoSysPro/Fluid/Sensors/SensorQv.mo +++ b/ThermoSysPro/Fluid/Sensors/SensorQv.mo @@ -1,14 +1,12 @@ within ThermoSysPro.Fluid.Sensors; model SensorQv "Volumetric flow sensor" - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + extends ThermoSysPro.Fluid.Interfaces.IconColors; + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Integer output_unit=1 "Sensor outpu unit - 1: m3/h, other: m3/s"; - parameter IF97Region region=IF97Region.All_regions "IF97 region (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); protected constant Real pi=Modelica.Constants.pi "pi"; - parameter Integer mode=Integer(region) - 1 "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; Units.SI.Time facteur=if (output_unit == 1) then 3600 else 1 "Unit factor"; public @@ -17,8 +15,6 @@ public Units.SI.AbsolutePressure Pm "Fluid average pressure"; Units.SI.SpecificEnthalpy h "Fluid specific enthalpy"; Units.SI.Density rho(start=998) "Fluid density"; - FluidType ftype "Fluid type"; - Integer fluid=Integer(ftype) "Fluid number"; public ThermoSysPro.InstrumentationAndControl.Connectors.OutputReal Measure @@ -26,9 +22,9 @@ public origin={0,102}, extent={{-10,-10},{10,10}}, rotation=90))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-110,-90},{-90,-70}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{92,-90},{112,-70}}, rotation=0))); equation @@ -45,17 +41,12 @@ equation C2.diff_res_1 = C1.diff_res_1; C1.diff_res_2 = C2.diff_res_2; - C1.ftype = C2.ftype; + C1.Xi = C2.Xi; - C1.Xco2 = C2.Xco2; - C1.Xh2o = C2.Xh2o; - C1.Xo2 = C2.Xo2; - C1.Xso2 = C2.Xso2; + C1.SubC = C2.SubC; Q = C1.Q; - ftype = C1.ftype; - /* Sensor signal */ Qv = Q/rho; Measure.signal = Qv*facteur; @@ -63,7 +54,7 @@ equation /* Fluid thermodynamic properties */ Pm = (C1.P + C2.P)/2; h = C1.h; - rho = ThermoSysPro.Properties.Fluid.Density_Ph(C1.P,h,fluid,mode,C1.Xco2, C1.Xh2o, C1.Xo2, C1.Xso2); + rho = Medium.density_phX(p=Pm, h=h, X=C1.Xi); annotation ( Icon(coordinateSystem( diff --git a/ThermoSysPro/Fluid/Sensors/SensorSubC.mo b/ThermoSysPro/Fluid/Sensors/SensorSubC.mo new file mode 100644 index 00000000..8f4b21fe --- /dev/null +++ b/ThermoSysPro/Fluid/Sensors/SensorSubC.mo @@ -0,0 +1,81 @@ +within ThermoSysPro.Fluid.Sensors; +model SensorSubC "SubC sensor" + extends ThermoSysPro.Fluid.Interfaces.IconColors; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); +public + ThermoSysPro.InstrumentationAndControl.Connectors.OutputReal[Medium.nC] Measure + annotation (Placement(transformation( + origin={0,102}, + extent={{-10,-10},{10,10}}, + rotation=90))); + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1(redeclare package Medium = Medium) annotation (Placement( + transformation(extent={{-110,-90},{-90,-70}}, rotation=0))); + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2(redeclare package Medium = Medium) annotation (Placement( + transformation(extent={{92,-90},{112,-70}}, rotation=0))); +equation + + C1.P = C2.P; + C1.Q = C2.Q; + C1.h = C2.h; + + C1.h_vol_1 = C2.h_vol_1; + C1.h_vol_2 = C2.h_vol_2; + + C2.diff_on_1 = C1.diff_on_1; + C1.diff_on_2 = C2.diff_on_2; + + C2.diff_res_1 = C1.diff_res_1; + C1.diff_res_2 = C2.diff_res_2; + + C1.Xi = C2.Xi; + + C1.SubC = C2.SubC; + + /* Sensor signal */ + Measure.signal = C1.SubC; + + annotation ( + Icon(coordinateSystem( + preserveAspectRatio=false, + extent={{-100,-100},{100,100}}, + grid={2,2}), graphics={ + Ellipse( + extent={{-60,92},{60,-28}}, + lineColor={0,0,0}, + fillPattern=FillPattern.Solid, + fillColor=DynamicSelect({127,255,0}, fill_color_singular)), + Line(points={{0,-28},{0,-80}}), + Line(points={{-98,-80},{102,-80}}), + Text(extent={{-60,60},{60,0}}, textString= + "C")}), + Window( + x=0.62, + y=0.25, + width=0.35, + height=0.49), + Diagram(coordinateSystem( + preserveAspectRatio=false, + extent={{-100,-100},{100,100}}, + grid={2,2}), graphics={ + Ellipse( + extent={{-60,92},{60,-28}}, + lineColor={0,0,0}, + fillPattern=FillPattern.Solid, + fillColor={0,255,0}), + Line(points={{0,-28},{0,-80}}), + Line(points={{-98,-80},{102,-80}}), + Text(extent={{-60,60},{60,0}}, textString= + "C")}), + Documentation(info=" +

    Copyright © EDF 2002 - 2024

    +

    ThermoSysPro Version 4.1

    +", + revisions=" +

    Authors

    +
      +
    • Daniel Bouskela
    • +
    • Baligh El Hefni
    • +
    +")); +end SensorSubC; diff --git a/ThermoSysPro/Fluid/Sensors/SensorT.mo b/ThermoSysPro/Fluid/Sensors/SensorT.mo index 5c4d341d..e9ec13d9 100644 --- a/ThermoSysPro/Fluid/Sensors/SensorT.mo +++ b/ThermoSysPro/Fluid/Sensors/SensorT.mo @@ -1,14 +1,12 @@ within ThermoSysPro.Fluid.Sensors; model SensorT "Temperature sensor" - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + extends ThermoSysPro.Fluid.Interfaces.IconColors; + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Integer output_unit=1 "Sensor outpu unit - 1: m3/h, other: m3/s"; - parameter IF97Region region=IF97Region.All_regions "IF97 region (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); protected constant Real pi=Modelica.Constants.pi "pi"; - parameter Integer mode=Integer(region) - 1 "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; parameter Units.SI.MassFlowRate Qeps=1.e-3 "Minimum mass flow rate for continuous flow reversal"; @@ -17,8 +15,7 @@ public Units.SI.Temperature T "Fluid temperature"; Units.SI.AbsolutePressure P "Fluid average pressure"; Units.SI.SpecificEnthalpy h "Fluid specific enthalpy"; - FluidType ftype "Fluid type"; - Integer fluid=Integer(ftype) "Fluid number"; + Medium.MassFraction X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Mass fractions"; public ThermoSysPro.InstrumentationAndControl.Connectors.OutputReal Measure @@ -29,9 +26,9 @@ public extent={{-10,-10},{10,10}}, rotation=90, origin={0,102}))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-110,-90},{-90,-70}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{92,-90},{112,-70}}, rotation=0))); equation @@ -48,16 +45,12 @@ equation C2.diff_res_1 = C1.diff_res_1; C1.diff_res_2 = C2.diff_res_2; - C1.ftype = C2.ftype; + C1.Xi = C2.Xi; - C1.Xco2 = C2.Xco2; - C1.Xh2o = C2.Xh2o; - C1.Xo2 = C2.Xo2; - C1.Xso2 = C2.Xso2; + C1.SubC = C2.SubC; Q = C1.Q; - - ftype = C1.ftype; + X = C1.Xi; /* Sensor signal */ Measure.signal = T; @@ -66,7 +59,7 @@ equation P = (C1.P + C2.P)/2; h = (C1.h + C2.h)/2; - T = ThermoSysPro.Properties.Fluid.Temperature_Ph(P, h,fluid,mode,C1.Xco2, C1.Xh2o, C1.Xo2, C1.Xso2); + T = Medium.temperature_phX(p=P, h=h, X=X); annotation ( Diagram(coordinateSystem( diff --git a/ThermoSysPro/Fluid/Sensors/SensorX.mo b/ThermoSysPro/Fluid/Sensors/SensorX.mo new file mode 100644 index 00000000..a6a72209 --- /dev/null +++ b/ThermoSysPro/Fluid/Sensors/SensorX.mo @@ -0,0 +1,81 @@ +within ThermoSysPro.Fluid.Sensors; +model SensorX "X sensor" + extends ThermoSysPro.Fluid.Interfaces.IconColors; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); +public + ThermoSysPro.InstrumentationAndControl.Connectors.OutputReal[Medium.nXi] Measure + annotation (Placement(transformation( + origin={0,102}, + extent={{-10,-10},{10,10}}, + rotation=90))); + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1(redeclare package Medium = Medium) annotation (Placement( + transformation(extent={{-110,-90},{-90,-70}}, rotation=0))); + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2(redeclare package Medium = Medium) annotation (Placement( + transformation(extent={{92,-90},{112,-70}}, rotation=0))); +equation + + C1.P = C2.P; + C1.Q = C2.Q; + C1.h = C2.h; + + C1.h_vol_1 = C2.h_vol_1; + C1.h_vol_2 = C2.h_vol_2; + + C2.diff_on_1 = C1.diff_on_1; + C1.diff_on_2 = C2.diff_on_2; + + C2.diff_res_1 = C1.diff_res_1; + C1.diff_res_2 = C2.diff_res_2; + + C1.Xi = C2.Xi; + + C1.SubC = C2.SubC; + + /* Sensor signal */ + Measure.signal = C1.Xi; + + annotation ( + Icon(coordinateSystem( + preserveAspectRatio=false, + extent={{-100,-100},{100,100}}, + grid={2,2}), graphics={ + Ellipse( + extent={{-60,92},{60,-28}}, + lineColor={0,0,0}, + fillPattern=FillPattern.Solid, + fillColor=DynamicSelect({127,255,0}, fill_color_singular)), + Line(points={{0,-28},{0,-80}}), + Line(points={{-98,-80},{102,-80}}), + Text(extent={{-60,60},{60,0}}, textString= + "X")}), + Window( + x=0.62, + y=0.25, + width=0.35, + height=0.49), + Diagram(coordinateSystem( + preserveAspectRatio=false, + extent={{-100,-100},{100,100}}, + grid={2,2}), graphics={ + Ellipse( + extent={{-60,92},{60,-28}}, + lineColor={0,0,0}, + fillPattern=FillPattern.Solid, + fillColor={0,255,0}), + Line(points={{0,-28},{0,-80}}), + Line(points={{-98,-80},{102,-80}}), + Text(extent={{-60,60},{60,0}}, textString= + "X")}), + Documentation(info=" +

    Copyright © EDF 2002 - 2024

    +

    ThermoSysPro Version 4.1

    +", + revisions=" +

    Authors

    +
      +
    • Daniel Bouskela
    • +
    • Baligh El Hefni
    • +
    +")); +end SensorX; diff --git a/ThermoSysPro/Fluid/Sensors/package.order b/ThermoSysPro/Fluid/Sensors/package.order index f2873124..eefb8c73 100644 --- a/ThermoSysPro/Fluid/Sensors/package.order +++ b/ThermoSysPro/Fluid/Sensors/package.order @@ -3,3 +3,5 @@ SensorQ SensorQv SensorH SensorT +SensorSubC +SensorX From 452e3052abeeac5dd2959e7b293b1945c8305adf Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Thu, 3 Jul 2025 11:49:36 +0200 Subject: [PATCH 148/178] #125 SensorT without X redeclaration --- ThermoSysPro/Fluid/Sensors/SensorT.mo | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/ThermoSysPro/Fluid/Sensors/SensorT.mo b/ThermoSysPro/Fluid/Sensors/SensorT.mo index e9ec13d9..307551eb 100644 --- a/ThermoSysPro/Fluid/Sensors/SensorT.mo +++ b/ThermoSysPro/Fluid/Sensors/SensorT.mo @@ -15,7 +15,6 @@ public Units.SI.Temperature T "Fluid temperature"; Units.SI.AbsolutePressure P "Fluid average pressure"; Units.SI.SpecificEnthalpy h "Fluid specific enthalpy"; - Medium.MassFraction X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Mass fractions"; public ThermoSysPro.InstrumentationAndControl.Connectors.OutputReal Measure @@ -50,7 +49,6 @@ equation C1.SubC = C2.SubC; Q = C1.Q; - X = C1.Xi; /* Sensor signal */ Measure.signal = T; @@ -59,7 +57,7 @@ equation P = (C1.P + C2.P)/2; h = (C1.h + C2.h)/2; - T = Medium.temperature_phX(p=P, h=h, X=X); + T = Medium.temperature_phX(p=P, h=h, X=C1.Xi); annotation ( Diagram(coordinateSystem( From 4666d38d5a5aa9f55b8be8cdb839301a7286cee9 Mon Sep 17 00:00:00 2001 From: VESCOVI Guilherme Date: Thu, 3 Jul 2025 15:13:45 +0200 Subject: [PATCH 149/178] Simplified sensor T et Qv : removed unused variables, transformed facteur into parameter instead of variable --- ThermoSysPro/Fluid/Sensors/SensorQv.mo | 9 ++------- ThermoSysPro/Fluid/Sensors/SensorT.mo | 16 +--------------- 2 files changed, 3 insertions(+), 22 deletions(-) diff --git a/ThermoSysPro/Fluid/Sensors/SensorQv.mo b/ThermoSysPro/Fluid/Sensors/SensorQv.mo index 2c9b2e9a..83b43337 100644 --- a/ThermoSysPro/Fluid/Sensors/SensorQv.mo +++ b/ThermoSysPro/Fluid/Sensors/SensorQv.mo @@ -6,14 +6,11 @@ model SensorQv "Volumetric flow sensor" parameter Integer output_unit=1 "Sensor outpu unit - 1: m3/h, other: m3/s"; protected - constant Real pi=Modelica.Constants.pi "pi"; - Units.SI.Time facteur=if (output_unit == 1) then 3600 else 1 "Unit factor"; + parameter Units.SI.Time facteur=if (output_unit == 1) then 3600 else 1 "Unit factor"; public Units.SI.MassFlowRate Q(start=500) "Mass flow rate"; Units.SI.VolumeFlowRate Qv(start=0.5) "Volume flow rate"; - Units.SI.AbsolutePressure Pm "Fluid average pressure"; - Units.SI.SpecificEnthalpy h "Fluid specific enthalpy"; Units.SI.Density rho(start=998) "Fluid density"; public @@ -52,9 +49,7 @@ equation Measure.signal = Qv*facteur; /* Fluid thermodynamic properties */ - Pm = (C1.P + C2.P)/2; - h = C1.h; - rho = Medium.density_phX(p=Pm, h=h, X=C1.Xi); + rho = Medium.density_phX(p=C1.P, h=C1.h, X=C1.Xi); annotation ( Icon(coordinateSystem( diff --git a/ThermoSysPro/Fluid/Sensors/SensorT.mo b/ThermoSysPro/Fluid/Sensors/SensorT.mo index 307551eb..2a6d4746 100644 --- a/ThermoSysPro/Fluid/Sensors/SensorT.mo +++ b/ThermoSysPro/Fluid/Sensors/SensorT.mo @@ -3,18 +3,9 @@ model SensorT "Temperature sensor" extends ThermoSysPro.Fluid.Interfaces.IconColors; replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); - parameter Integer output_unit=1 "Sensor outpu unit - 1: m3/h, other: m3/s"; - -protected - constant Real pi=Modelica.Constants.pi "pi"; - parameter Units.SI.MassFlowRate Qeps=1.e-3 - "Minimum mass flow rate for continuous flow reversal"; public - Units.SI.MassFlowRate Q(start=500) "Mass flow rate"; Units.SI.Temperature T "Fluid temperature"; - Units.SI.AbsolutePressure P "Fluid average pressure"; - Units.SI.SpecificEnthalpy h "Fluid specific enthalpy"; public ThermoSysPro.InstrumentationAndControl.Connectors.OutputReal Measure @@ -48,16 +39,11 @@ equation C1.SubC = C2.SubC; - Q = C1.Q; - /* Sensor signal */ Measure.signal = T; /* Fluid thermodynamic properties */ - P = (C1.P + C2.P)/2; - h = (C1.h + C2.h)/2; - - T = Medium.temperature_phX(p=P, h=h, X=C1.Xi); + T = Medium.temperature_phX(p=C1.P, h=C1.h, X=C1.Xi); annotation ( Diagram(coordinateSystem( From 2d7a532349ab42a53636886b479b09a3fd5cffac Mon Sep 17 00:00:00 2001 From: VESCOVI Guilherme Date: Mon, 16 Jun 2025 17:50:22 +0200 Subject: [PATCH 150/178] conflict #125-LumpedStraightPipe --- ThermoSysPro/Fluid/PressureLosses/LumpedStraightPipe.mo | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ThermoSysPro/Fluid/PressureLosses/LumpedStraightPipe.mo b/ThermoSysPro/Fluid/PressureLosses/LumpedStraightPipe.mo index 54439c4d..014b462a 100644 --- a/ThermoSysPro/Fluid/PressureLosses/LumpedStraightPipe.mo +++ b/ThermoSysPro/Fluid/PressureLosses/LumpedStraightPipe.mo @@ -112,6 +112,8 @@ equation Pm = (C1.P + C2.P)/2; state = Medium.setState_phX(p=Pm, h=h, X=X); + state=Medium.setState_phX(p=Pm, h=h, X=X, region=mode); + if (p_rho > 0) then rho = p_rho; else From 977c98bb8adad56eabfa1e74ce62f5b58d9401b4 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Fri, 4 Jul 2025 15:27:10 +0200 Subject: [PATCH 151/178] 125 LumpedStraightPipe for FlueGases --- ThermoSysPro/Fluid/PressureLosses/LumpedStraightPipe.mo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ThermoSysPro/Fluid/PressureLosses/LumpedStraightPipe.mo b/ThermoSysPro/Fluid/PressureLosses/LumpedStraightPipe.mo index 014b462a..3bb6f579 100644 --- a/ThermoSysPro/Fluid/PressureLosses/LumpedStraightPipe.mo +++ b/ThermoSysPro/Fluid/PressureLosses/LumpedStraightPipe.mo @@ -112,7 +112,7 @@ equation Pm = (C1.P + C2.P)/2; state = Medium.setState_phX(p=Pm, h=h, X=X); - state=Medium.setState_phX(p=Pm, h=h, X=X, region=mode); + state=Medium.setState_phX(p=Pm, h=h, X=X); if (p_rho > 0) then rho = p_rho; From 09fbe1f19de7ecd03f2d82ecfcc06a3b6e6f9ec2 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Fri, 4 Jul 2025 20:23:19 +0200 Subject: [PATCH 152/178] #125 CombustionTurbine --- .../Machines/TestCombustionTurbine.mo | 46 +++++++++++++++++ .../Machines/TestCombustionTurbine_Traces.mo | 50 +++++++++++++++++++ .../SimpleExamples/Machines/package.order | 2 + .../Fluid/Machines/CombustionTurbine.mo | 45 ++++++----------- 4 files changed, 114 insertions(+), 29 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestCombustionTurbine.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestCombustionTurbine_Traces.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestCombustionTurbine.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestCombustionTurbine.mo new file mode 100644 index 00000000..6812d7bb --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestCombustionTurbine.mo @@ -0,0 +1,46 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Machines; +model TestCombustionTurbine + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.FlueGases; + parameter Real is_eff_n1(fixed=false, start=0.85) "Nominal isentropic efficiency"; + parameter Real Qred1(fixed=false, start=0.01) "Reduced mass flow rate"; + + Fluid.Machines.CombustionTurbine CombustionTurbine( + redeclare package Medium = Medium, + tau_n=0.065, + is_eff_n=is_eff_n1, + Qred=Qred1, + Pe(fixed=true, start=1500000), + Ts(fixed=true, start=830), + Hs(start=769796.2+Medium.h_offset)) annotation (Placement(transformation(extent={{-42,-42},{36,42}}, rotation=0))); + Fluid.BoundaryConditions.SourceQ SourceQ1( + redeclare package Medium = Medium, + option_temperature=true, + X0={1-0.14-0.06-0.06,0.14,0.06,0.06,0}, + Q0=430, + T0=1500) annotation (Placement(transformation(extent={{-106,-10},{-86,10}}, rotation=0))); + Fluid.BoundaryConditions.SinkP SinkP1(redeclare package Medium = Medium, + P0=100000, + T0=830) annotation (Placement(transformation( + origin={94,0}, + extent={{10,-10},{-10,10}}, + rotation=180))); + InstrumentationAndControl.Blocks.Sources.Constante Wc1(k=-1.8e8) annotation (Placement(transformation(extent={{-100,-42},{-80,-22}}, rotation=0))); +equation + connect(SourceQ1.C, CombustionTurbine.Ce) annotation (Line( + points={{-86,0},{-42,0}}, + color={0,0,0}, + thickness=1)); + connect(CombustionTurbine.Cs, SinkP1.C) annotation (Line( + points={{36,0},{84,0}}, + color={0,0,0}, + thickness=1)); + connect(Wc1.y, CombustionTurbine.CompressorPower) annotation (Line(points={{-79,-32},{-45.9,-32},{-45.9,-16.8}})); + annotation (Diagram(graphics), Documentation(info=" +

    Copyright © EDF 2002 - 2024

    +

    ThermoSysPro Version 4.1

    +

    This model is documented in Sect. 11.4.5 of the ThermoSysPro book. +

    The results reported in the ThermoSysPro book were computed using Dymola. +")); +end TestCombustionTurbine; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestCombustionTurbine_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestCombustionTurbine_Traces.mo new file mode 100644 index 00000000..6dac368b --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestCombustionTurbine_Traces.mo @@ -0,0 +1,50 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Machines; +model TestCombustionTurbine_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.FlueGases ( + extraPropertiesNames={"Trace"}, + C_nominal={0.1}, + C_default={0.2}); + parameter Real is_eff_n1(fixed=false, start=0.85) "Nominal isentropic efficiency"; + parameter Real Qred1(fixed=false, start=0.01) "Reduced mass flow rate"; + + Fluid.Machines.CombustionTurbine CombustionTurbine( + redeclare package Medium = Medium, + tau_n=0.065, + is_eff_n=is_eff_n1, + Qred=Qred1, + Pe(fixed=true, start=1500000), + Ts(fixed=true, start=830), + Hs(start=769796.2 + Medium.h_offset)) annotation (Placement(transformation(extent={{-42,-42},{36,42}}, rotation=0))); + Fluid.BoundaryConditions.SourceQ SourceQ1( + redeclare package Medium = Medium, + option_temperature=true, + X0={1 - 0.14 - 0.06 - 0.06,0.14,0.06,0.06,0}, + Q0=430, + T0=1500) annotation (Placement(transformation(extent={{-106,-10},{-86,10}}, rotation=0))); + Fluid.BoundaryConditions.SinkP SinkP1( + redeclare package Medium = Medium, + P0=100000, + T0=830) annotation (Placement(transformation( + origin={94,0}, + extent={{10,-10},{-10,10}}, + rotation=180))); + InstrumentationAndControl.Blocks.Sources.Constante Wc1(k=-1.8e8) annotation (Placement(transformation(extent={{-100,-42},{-80,-22}}, rotation=0))); +equation + connect(SourceQ1.C, CombustionTurbine.Ce) annotation (Line( + points={{-86,0},{-42,0}}, + color={0,0,0}, + thickness=1)); + connect(CombustionTurbine.Cs, SinkP1.C) annotation (Line( + points={{36,0},{84,0}}, + color={0,0,0}, + thickness=1)); + connect(Wc1.y, CombustionTurbine.CompressorPower) annotation (Line(points={{-79,-32},{-45.9,-32},{-45.9,-16.8}})); + annotation (Diagram(graphics), Documentation(info=" +

    Copyright © EDF 2002 - 2024

    +

    ThermoSysPro Version 4.1

    +

    This model is documented in Sect. 11.4.5 of the ThermoSysPro book. +

    The results reported in the ThermoSysPro book were computed using Dymola. +")); +end TestCombustionTurbine_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/package.order index 693aa900..5a733a68 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/package.order @@ -6,3 +6,5 @@ TestStaticCentrifugalPump_Traces TestCentrifugalPump TestCentrifugalPump_FlueGases TestCentrifugalPump_Traces +TestCombustionTurbine +TestCombustionTurbine_Traces diff --git a/ThermoSysPro/Fluid/Machines/CombustionTurbine.mo b/ThermoSysPro/Fluid/Machines/CombustionTurbine.mo index d521b5ea..76cf21e6 100644 --- a/ThermoSysPro/Fluid/Machines/CombustionTurbine.mo +++ b/ThermoSysPro/Fluid/Machines/CombustionTurbine.mo @@ -1,7 +1,8 @@ within ThermoSysPro.Fluid.Machines; model CombustionTurbine "Combustion turbine" - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; + extends ThermoSysPro.Fluid.Interfaces.IconColors; + replaceable package Medium = ThermoSysPro.Properties.Media.FlueGases constrainedby Modelica.Media.Interfaces.PartialMixtureMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Real A3=0 "X^3 coefficient of the efficiency curve"; parameter Real A2=-0.04778 "X^2 coefficient of the efficiency curve"; parameter Real A1=0.09555 "X^1 coefficient of the efficiency curve"; @@ -33,25 +34,15 @@ public Units.SI.SpecificEnthalpy His(start=6e5) "Flue gases specific enthalpy after the isentropic expansion"; Units.SI.SpecificEntropy Se "Flue gases specific entropy at the inlet"; - FluidType ftype "Fluid type"; - Integer fluid=Integer(ftype) "Fluid number"; public - Interfaces.Connectors.FluidInlet Ce annotation (Placement(transformation( - extent={{-110,-10},{-90,10}}, rotation=0))); - Interfaces.Connectors.FluidOutlet Cs annotation (Placement(transformation( - extent={{90,-10},{110,10}}, rotation=0))); -public - ThermoSysPro.InstrumentationAndControl.Connectors.InputReal CompressorPower - annotation (Placement(transformation(extent={{-120,-50},{-100,-30}}, - rotation=0))); -public - ThermoSysPro.InstrumentationAndControl.Connectors.OutputReal MechPower - annotation (Placement(transformation(extent={{100,-100},{120,-80}}, - rotation=0))); + Interfaces.Connectors.FluidInlet Ce(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-110,-10},{-90,10}}, rotation=0))); + Interfaces.Connectors.FluidOutlet Cs(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{90,-10},{110,10}}, rotation=0))); + ThermoSysPro.InstrumentationAndControl.Connectors.InputReal CompressorPower annotation (Placement(transformation(extent={{-120,-50},{-100,-30}}, rotation=0))); + ThermoSysPro.InstrumentationAndControl.Connectors.OutputReal MechPower annotation (Placement(transformation(extent={{100,-100},{120,-80}}, rotation=0))); + + Medium.ThermodynamicState state_e; equation - /* Check that the fluid type is flue gases */ - assert(ftype == FluidType.FlueGases, "CombustionTurbine: the fluid type must be flue gases"); Ce.Q = Cs.Q; @@ -64,12 +55,9 @@ equation Cs.diff_res_1 = Ce.diff_res_1 + (if (gamma_diff > 0) then 1/gamma_diff else 0); Ce.diff_res_2 = Cs.diff_res_2 + (if (gamma_diff > 0) then 1/gamma_diff else 0); - Ce.ftype = Cs.ftype; + Ce.SubC = Cs.SubC; - Ce.Xco2 = Cs.Xco2; - Ce.Xh2o = Cs.Xh2o; - Ce.Xo2 = Cs.Xo2; - Ce.Xso2 = Cs.Xso2; + Ce.Xi = Cs.Xi; Q = Ce.Q; @@ -79,8 +67,6 @@ equation He = Ce.h; Hs = Cs.h; - ftype = Ce.ftype; - /* Input compressor power (negative value) */ Wcp = CompressorPower.signal; @@ -104,20 +90,21 @@ equation MechPower.signal = Wmech; /* Temperature at the inlet */ - Te = ThermoSysPro.Properties.Fluid.Temperature_Ph(Pe, He, fluid, 0, Ce.Xco2, Ce.Xh2o, Ce.Xo2, Ce.Xso2); + state_e = Medium.setState_phX(Pe,He,Ce.Xi); + Te=Medium.temperature(state_e); /* Specific entropy at the inlet */ - Se = ThermoSysPro.Properties.FlueGases.FlueGases_s(Pe, Te, Ce.Xco2, Ce.Xh2o, Ce.Xo2, Ce.Xso2); + Se = Medium.specificEntropy(state_e); /* Specific enthalpy after the isentropic expansion */ - Se = ThermoSysPro.Properties.FlueGases.FlueGases_s(Ps, Tis, Ce.Xco2, Ce.Xh2o, Ce.Xo2, Ce.Xso2); - His = ThermoSysPro.Properties.FlueGases.FlueGases_h(Ps, Tis, Ce.Xco2, Ce.Xh2o, Ce.Xo2, Ce.Xso2); + Tis=Medium.temperature(Medium.setState_psX(Ps,Se,Ce.Xi)); + His = Medium.specificEnthalpy_pTX(Ps,Tis,Ce.Xi); /* Specific enthalpy at the outlet */ Hs = is_eff*(His - He) + He; /* Temperature at the outlet */ - Ts = ThermoSysPro.Properties.Fluid.Temperature_Ph(Ps, Hs, fluid, 0, Ce.Xco2, Ce.Xh2o, Ce.Xo2, Ce.Xso2); + Ts = Medium.temperature_phX(Ps,Hs,Ce.Xi); annotation ( Diagram(coordinateSystem( From d40a6104758d910427567c59f1440a0d5e2486c5 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Fri, 4 Jul 2025 20:37:10 +0200 Subject: [PATCH 153/178] #125 Compressor --- .../SimpleExamples/Machines/TestCompressor.mo | 40 ++++++++++++++++ .../Machines/TestCompressor_Traces.mo | 43 +++++++++++++++++ .../SimpleExamples/Machines/package.order | 2 + ThermoSysPro/Fluid/Machines/Compressor.mo | 48 ++++++++----------- 4 files changed, 104 insertions(+), 29 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestCompressor.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestCompressor_Traces.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestCompressor.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestCompressor.mo new file mode 100644 index 00000000..345c316c --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestCompressor.mo @@ -0,0 +1,40 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Machines; +model TestCompressor + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.FlueGases; + parameter Real is_eff_n1(fixed=false, start=0.85) "Nominal isentropic efficiency"; + + ThermoSysPro.Fluid.Machines.Compressor Compressor( + redeclare package Medium = Medium, + Ps(fixed=false), + tau_n=16, + is_eff_n=is_eff_n1, + Pe(fixed=false, start=100000), + Ts(fixed=true, start=680)) annotation (Placement(transformation(extent={{-52,-52},{48,52}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ SourceQ1( + redeclare package Medium = Medium, + X0={1 - 0.003 - 0.23,0.23,0.003,0,0}, + Q0=420, + P0=100000, + T0=288, + option_temperature=true) annotation (Placement(transformation(extent={{-104,-10},{-84,10}}, rotation=0))); + + ThermoSysPro.Fluid.BoundaryConditions.SinkP SinkP1(redeclare package Medium = Medium, P0=15.8e5) annotation (Placement(transformation( + origin={96,0}, + extent={{10,-10},{-10,10}}, + rotation=180))); +equation + connect(SourceQ1.C, Compressor.Ce) annotation (Line( + points={{-84,0},{-39.5,0}}, + color={0,0,0}, + thickness=1)); + connect(Compressor.Cs, SinkP1.C) annotation (Line( + points={{35.5,0},{86,0}}, + color={0,0,0}, + thickness=1)); + annotation (Diagram(graphics), Documentation(info=" +

    Copyright © EDF 2002 - 2021

    +

    ThermoSysPro Version 4.0

    +")); +end TestCompressor; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestCompressor_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestCompressor_Traces.mo new file mode 100644 index 00000000..e2792641 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestCompressor_Traces.mo @@ -0,0 +1,43 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Machines; +model TestCompressor_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.FlueGases ( + extraPropertiesNames={"Trace"}, + C_nominal={0.1}, + C_default={0.2}); + parameter Real is_eff_n1(fixed=false, start=0.85) "Nominal isentropic efficiency"; + + ThermoSysPro.Fluid.Machines.Compressor Compressor( + redeclare package Medium = Medium, + Ps(fixed=false), + tau_n=16, + is_eff_n=is_eff_n1, + Pe(fixed=false, start=100000), + Ts(fixed=true, start=680)) annotation (Placement(transformation(extent={{-52,-52},{48,52}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ SourceQ1( + redeclare package Medium = Medium, + X0={1 - 0.003 - 0.23,0.23,0.003,0,0}, + Q0=420, + P0=100000, + T0=288, + option_temperature=true) annotation (Placement(transformation(extent={{-104,-10},{-84,10}}, rotation=0))); + + ThermoSysPro.Fluid.BoundaryConditions.SinkP SinkP1(redeclare package Medium = Medium, P0=15.8e5) annotation (Placement(transformation( + origin={96,0}, + extent={{10,-10},{-10,10}}, + rotation=180))); +equation + connect(SourceQ1.C, Compressor.Ce) annotation (Line( + points={{-84,0},{-39.5,0}}, + color={0,0,0}, + thickness=1)); + connect(Compressor.Cs, SinkP1.C) annotation (Line( + points={{35.5,0},{86,0}}, + color={0,0,0}, + thickness=1)); + annotation (Diagram(graphics), Documentation(info=" +

    Copyright © EDF 2002 - 2021

    +

    ThermoSysPro Version 4.0

    +")); +end TestCompressor_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/package.order index 5a733a68..22dae67a 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/package.order @@ -8,3 +8,5 @@ TestCentrifugalPump_FlueGases TestCentrifugalPump_Traces TestCombustionTurbine TestCombustionTurbine_Traces +TestCompressor +TestCompressor_Traces diff --git a/ThermoSysPro/Fluid/Machines/Compressor.mo b/ThermoSysPro/Fluid/Machines/Compressor.mo index ffcd288c..485a23cc 100644 --- a/ThermoSysPro/Fluid/Machines/Compressor.mo +++ b/ThermoSysPro/Fluid/Machines/Compressor.mo @@ -1,7 +1,8 @@ within ThermoSysPro.Fluid.Machines; model Compressor "Gas compressor" - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; + extends ThermoSysPro.Fluid.Interfaces.IconColors; + replaceable package Medium = ThermoSysPro.Properties.Media.FlueGases constrainedby Modelica.Media.Interfaces.PartialMixtureMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Integer mass_flow_rate_comp=1 "Ways for computing the mass flow rate - 1: Q = rho*Qv - 2: Q = rho*f(T)"; parameter Units.SI.Temperature Tmax=284.16 "Air transition temperature between f1 = a*x + b and f2 = c*x + d for the computation of Q (active if mass_flow_rate_comp == 2)"; @@ -43,22 +44,15 @@ public "Air specific enthalpy after the isentropic compression"; Units.SI.SpecificEntropy Se "Air specific entropy at the inlet"; Units.SI.Density rho_e(start=1) "Air density at the inlet"; - FluidType ftype "Fluid type"; - Integer fluid=Integer(ftype) "Fluid number"; public - Interfaces.Connectors.FluidInlet Ce annotation (Placement(transformation( - extent={{-100,-10},{-80,10}}, rotation=0))); - Interfaces.Connectors.FluidOutlet Cs annotation (Placement(transformation( - extent={{80,-10},{100,10}}, rotation=0))); -public - ThermoSysPro.InstrumentationAndControl.Connectors.OutputReal Power - annotation (Placement(transformation(extent={{80,-40},{100,-20}}, rotation= - 0))); -equation - /* Check that the fluid type is flue gases */ - assert(ftype == FluidType.FlueGases, "Compressor: the fluid type must be flue gases"); + Interfaces.Connectors.FluidInlet Ce(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-100,-10},{-80,10}}, rotation=0))); + Interfaces.Connectors.FluidOutlet Cs(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{80,-10},{100,10}}, rotation=0))); + ThermoSysPro.InstrumentationAndControl.Connectors.OutputReal Power annotation (Placement(transformation(extent={{80,-40},{100,-20}}, rotation=0))); + Medium.ThermodynamicState state_e; + Medium.ThermodynamicState state_s; +equation Ce.Q = Cs.Q; Ce.h_vol_1 = Cs.h_vol_1; @@ -70,12 +64,9 @@ equation Cs.diff_res_1 = Ce.diff_res_1 + (if (gamma_diff > 0) then 1/gamma_diff else 0); Ce.diff_res_2 = Cs.diff_res_2 + (if (gamma_diff > 0) then 1/gamma_diff else 0); - Ce.ftype = Cs.ftype; + Ce.SubC = Cs.SubC; - Ce.Xco2 = Cs.Xco2; - Ce.Xh2o = Cs.Xh2o; - Ce.Xo2 = Cs.Xo2; - Ce.Xso2 = Cs.Xso2; + Ce.Xi = Cs.Xi; Q = Ce.Q; @@ -85,8 +76,6 @@ equation He = Ce.h; Hs = Cs.h; - ftype = Ce.ftype; - /* Compression rate */ tau = Ps/Pe; @@ -107,18 +96,19 @@ equation /* Specific enthalpy at the inlet */ //Te = ThermoSysPro.Properties.Fluid.Temperature_Ph(Pe, He, fluid, 0, Ce.Xco2, Ce.Xh2o, Ce.Xo2, Ce.Xso2); // Call implicitly to avoid function that cannot be differentiated. - He = ThermoSysPro.Properties.FlueGases.FlueGases_h(Pe, Te, Ce.Xco2, Ce.Xh2o, Ce.Xo2, Ce.Xso2); - + state_e = Medium.setState_pTX(Pe,Te,Ce.Xi); + He = Medium.specificEnthalpy_pTX(Pe,Te,Ce.Xi); /* Specific entropy at the inlet */ - Se = ThermoSysPro.Properties.FlueGases.FlueGases_s(Pe, Te, Ce.Xco2, Ce.Xh2o, Ce.Xo2, Ce.Xso2); + Se = Medium.specificEntropy(state_e); /* Specific enthalpy after the isentropic compression */ - Se = ThermoSysPro.Properties.FlueGases.FlueGases_s(Ps, Tis, Ce.Xco2, Ce.Xh2o, Ce.Xo2, Ce.Xso2); - His = ThermoSysPro.Properties.FlueGases.FlueGases_h(Ps, Tis, Ce.Xco2, Ce.Xh2o, Ce.Xo2, Ce.Xso2); + state_s= Medium.setState_psX(Ps,Se,Ce.Xi); + Tis = Medium.temperature(state_s); + His = Medium.specificEnthalpy(state_s); /* Fluid density at the inlet */ //rho_e = ThermoSysPro.Properties.Fluid.Density_Ph(Pe, He, fluid, 0, Ce.Xco2, Ce.Xh2o, Ce.Xo2, Ce.Xso2); - rho_e = ThermoSysPro.Properties.FlueGases.FlueGases_rho(Pe, Te, Ce.Xco2, Ce.Xh2o, Ce.Xo2, Ce.Xso2); + rho_e = Medium.density(state_e); /* Specific enthalpy at the outlet */ Hs = (His - He + is_eff*He)/is_eff; @@ -126,9 +116,9 @@ equation /* Temperature at the outlet */ // Ts = ThermoSysPro.Properties.Fluid.Temperature_Ph(Ps, Hs, fluid, 0, Ce.Xco2, Ce.Xh2o, Ce.Xo2, Ce.Xso2); // Call implicitly to avoid function that cannot be differentiated. - Hs = ThermoSysPro.Properties.FlueGases.FlueGases_h(Ps, Ts, Ce.Xco2, Ce.Xh2o, Ce.Xo2, Ce.Xso2); - + Hs= Medium.specificEnthalpy_pTX(Ps,Ts,Ce.Xi); annotation ( + Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-120,-100},{ 120,100}}), graphics={Polygon( points={{-80,80},{-80,-80},{80,-40},{80,40},{-80,80}}, From fed0621b2b226a587dff8fc265beebe296577db7 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Fri, 4 Jul 2025 21:33:09 +0200 Subject: [PATCH 154/178] conflict #125 AirHumidity --- .../Fluid/BoundaryConditions/AirHumidity.mo | 45 +++++--------- .../BoundaryConditions/TestAirHumidity.mo | 56 ++++++++++++++++++ .../TestAirHumidity_Traces.mo | 59 +++++++++++++++++++ .../BoundaryConditions/package.order | 2 + .../Properties/FlueGases/getSubstanceIndex.mo | 16 +++++ .../Properties/FlueGases/package.order | 1 + 6 files changed, 148 insertions(+), 31 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestAirHumidity.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestAirHumidity_Traces.mo create mode 100644 ThermoSysPro/Properties/FlueGases/getSubstanceIndex.mo diff --git a/ThermoSysPro/Fluid/BoundaryConditions/AirHumidity.mo b/ThermoSysPro/Fluid/BoundaryConditions/AirHumidity.mo index a90a1049..6da2c852 100644 --- a/ThermoSysPro/Fluid/BoundaryConditions/AirHumidity.mo +++ b/ThermoSysPro/Fluid/BoundaryConditions/AirHumidity.mo @@ -1,19 +1,12 @@ within ThermoSysPro.Fluid.BoundaryConditions; model AirHumidity "Air humidity" extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + replaceable package Medium = ThermoSysPro.Properties.Media.FlueGases constrainedby Modelica.Media.Interfaces.PartialMixtureMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Real hum0=0.5 "Air humidiy"; parameter Units.SI.Temperature T0=290 "Fixed fluid temperature"; - parameter IF97Region region=IF97Region.All_regions "IF97 region (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); - -protected - parameter Integer mode=Integer(region) - 1 "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; public - FluidType ftype "Fluid type"; - Integer fluid=Integer(ftype) "Fluid number"; Units.SI.AbsolutePressure ppvap0(start=1e4) "Intermediate vapor partial pressure"; Units.SI.Density rho_vap0(start=200) "Intermediate H2O density"; @@ -28,16 +21,13 @@ public Units.SI.AbsolutePressure ppair "Air partial pressure"; Real hum "Air relative humidity"; Real Xo2as(start=0.2) "O2 mass fraction in dry air"; - Real Xco2 "CO2 mass fraction at the outlet"; Real Xh2o "H2O mass fraction at the outlet"; - Real Xo2 "O2 mass fraction at the outlet"; - Real Xso2 "SO2 mas fraction at the outlet"; public ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_pT pro annotation (Placement(transformation(extent={{-100,80},{-80,100}}, rotation= 0))); - Interfaces.Connectors.FluidInlet C1 annotation (Placement(transformation( + Interfaces.Connectors.FluidInlet C1(redeclare package Medium=Medium) annotation (Placement(transformation( extent={{-110,-10},{-90,10}}, rotation=0))); ThermoSysPro.InstrumentationAndControl.Connectors.InputReal humidity "Air humidity" @@ -45,12 +35,9 @@ public origin={0,110}, extent={{-10,-10},{10,10}}, rotation=270))); - Interfaces.Connectors.FluidOutlet C2 annotation (Placement(transformation( + Interfaces.Connectors.FluidOutlet C2(redeclare package Medium=Medium) annotation (Placement(transformation( extent={{90,-10},{110,10}}, rotation=0))); equation - /* The fluid type must be flue gases */ - assert(ftype == FluidType.FlueGases, "AirHumidity: the fluid type must be flue gases"); - if (cardinality(humidity) == 0) then humidity.signal = hum0; end if; @@ -70,30 +57,26 @@ equation C2.diff_res_1 = C1.diff_res_1; C1.diff_res_2 = C2.diff_res_2; - C1.ftype = C2.ftype; + C1.SubC = C2.SubC; P = C1.P; Q = C1.Q; h = C1.h; - ftype = C1.ftype; - /* O2 mass fraction at the inlet */ - Xo2as = C1.Xo2; + Xo2as = C1.Xi[Properties.FlueGases.getSubstanceIndex("Oxygen",Medium.substanceNames)]; /* Temperature at the outlet */ - T = ThermoSysPro.Properties.FlueGases.FlueGases_T(P, h, Xco2, Xh2o, Xo2as, Xso2); +// T = ThermoSysPro.Properties.FlueGases.FlueGases_T(P, h, 0, Xh2o, Xo2as, 0); + T = Medium.temperature_phX(P,h, C2.Xi); /* Flue gas composition at the outlet. The sole constituents for air are O2 and N2 */ - Xco2 = 0; - Xso2 = 0; + C2.Xi[Properties.FlueGases.getSubstanceIndex("Sulfurdioxide",Medium.substanceNames)] = 0; + C2.Xi[Properties.FlueGases.getSubstanceIndex("Carbondioxide",Medium.substanceNames)] = 0; Xh2o = rho_vap/(rho_vap + rho_air); - Xo2 = Xo2as*(1 - Xh2o); - - C2.Xco2 = Xco2; - C2.Xso2 = Xso2; - C2.Xh2o = Xh2o; - C2.Xo2 = Xo2; + C2.Xi[Properties.FlueGases.getSubstanceIndex("Water",Medium.substanceNames)] = Xh2o; + C2.Xi[Properties.FlueGases.getSubstanceIndex("Oxygen",Medium.substanceNames)] = Xo2as*(1 - Xh2o); + C2.Xi[Properties.FlueGases.getSubstanceIndex("Nitrogen",Medium.substanceNames)] = 1- Xo2as*(1 - Xh2o) - Xh2o; /* Vapor partial pressure */ ppvap = psvap*hum; @@ -106,14 +89,14 @@ equation psvap = ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.psat(T); /* H2O density */ - pro = ThermoSysPro.Properties.WaterSteam.IF97.Water_PT(ppvap, T, mode); + pro = ThermoSysPro.Properties.WaterSteam.IF97.Water_PT(ppvap, T, 0); rho_vap0 = pro.d; 0 = if (ppvap < 0.061080e-4) then rho_vap - (rho_vap0*ppvap/ppvap0) else rho_vap - rho_vap0; /* Air density */ - rho_air = ThermoSysPro.Properties.FlueGases.FlueGases_rho(ppair, T, Xco2, Xh2o, Xo2as, Xso2); + rho_air = ThermoSysPro.Properties.FlueGases.FlueGases_rho(ppair, T, 0, Xh2o, Xo2as, 0); annotation (Diagram(graphics={ Ellipse( diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestAirHumidity.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestAirHumidity.mo new file mode 100644 index 00000000..3bd41c98 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestAirHumidity.mo @@ -0,0 +1,56 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.BoundaryConditions; +model TestAirHumidity + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.FlueGases; + ThermoSysPro.Fluid.BoundaryConditions.AirHumidity airHumidity( + redeclare package Medium = Medium, + hum0=0.9, + T0=293, + ppvap0(start=2085), + rho_air(start=1.14), + rho_vap(start=0.015)) annotation (Placement(transformation(extent={{-10,0},{10,20}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss( + redeclare package Medium = Medium, + K=1.e-5, + rho(start=1.17)) annotation (Placement(transformation(extent={{40,0},{60,20}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sinkFlueGases(redeclare package Medium = Medium, + T0=293, + h0=53484, + option_temperature=true) annotation (Placement(transformation(extent={{80,0},{100,20}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourceFlueGasesPQ( + redeclare package Medium = Medium, + option_temperature=true, + X0={1 - 0.0132625 - 0.217282,0.217282,0.0132625,0,0}, + P0=100000, + T0=293) annotation (Placement(transformation(extent={{-80,0},{-60,20}}, rotation=0))); + +equation + connect(airHumidity.C2, singularPressureLoss.C1) annotation (Line(points={{10,10},{40,10}}, color={0,0,0})); + connect(singularPressureLoss.C2, sinkFlueGases.C) annotation (Line(points={{60,10},{80,10}}, color={0,0,0})); + connect(sourceFlueGasesPQ.C, airHumidity.C1) annotation (Line(points={{-60,10},{-10,10}}, color={0,0,0})); + annotation ( + experiment(StopTime=1000), + Icon(graphics={ + Rectangle( + lineColor={200,200,200}, + fillColor={248,248,248}, + fillPattern=FillPattern.HorizontalCylinder, + extent={{-100.0,-100.0},{100.0,100.0}}, + radius=25.0), + Rectangle( + lineColor={128,128,128}, + extent={{-100.0,-100.0},{100.0,100.0}}, + radius=25.0), + Polygon( + origin={8.0,14.0}, + lineColor={78,138,73}, + fillColor={78,138,73}, + pattern=LinePattern.None, + fillPattern=FillPattern.Solid, + points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), + Documentation(info=" +

    Copyright © EDF 2002 - 2021

    +

    ThermoSysPro Version 4.0

    +")); +end TestAirHumidity; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestAirHumidity_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestAirHumidity_Traces.mo new file mode 100644 index 00000000..6f7a9783 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestAirHumidity_Traces.mo @@ -0,0 +1,59 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.BoundaryConditions; +model TestAirHumidity_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.FlueGases( + extraPropertiesNames={"Trace"}, + C_nominal={0.1}, + C_default={0.2}); + ThermoSysPro.Fluid.BoundaryConditions.AirHumidity airHumidity( + redeclare package Medium = Medium, + hum0=0.9, + T0=293, + ppvap0(start=2085), + rho_air(start=1.14), + rho_vap(start=0.015)) annotation (Placement(transformation(extent={{-10,0},{10,20}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss( + redeclare package Medium = Medium, + K=1.e-5, + rho(start=1.17)) annotation (Placement(transformation(extent={{40,0},{60,20}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sinkFlueGases(redeclare package Medium = Medium, + T0=293, + h0=53484, + option_temperature=true) annotation (Placement(transformation(extent={{80,0},{100,20}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourceFlueGasesPQ( + redeclare package Medium = Medium, + option_temperature=true, + X0={1 - 0.0132625 - 0.217282,0.217282,0.0132625,0,0}, + P0=100000, + T0=293) annotation (Placement(transformation(extent={{-80,0},{-60,20}}, rotation=0))); + +equation + connect(airHumidity.C2, singularPressureLoss.C1) annotation (Line(points={{10,10},{40,10}}, color={0,0,0})); + connect(singularPressureLoss.C2, sinkFlueGases.C) annotation (Line(points={{60,10},{80,10}}, color={0,0,0})); + connect(sourceFlueGasesPQ.C, airHumidity.C1) annotation (Line(points={{-60,10},{-10,10}}, color={0,0,0})); + annotation ( + experiment(StopTime=1000), + Icon(graphics={ + Rectangle( + lineColor={200,200,200}, + fillColor={248,248,248}, + fillPattern=FillPattern.HorizontalCylinder, + extent={{-100.0,-100.0},{100.0,100.0}}, + radius=25.0), + Rectangle( + lineColor={128,128,128}, + extent={{-100.0,-100.0},{100.0,100.0}}, + radius=25.0), + Polygon( + origin={8.0,14.0}, + lineColor={78,138,73}, + fillColor={78,138,73}, + pattern=LinePattern.None, + fillPattern=FillPattern.Solid, + points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), + Documentation(info=" +

    Copyright © EDF 2002 - 2021

    +

    ThermoSysPro Version 4.0

    +")); +end TestAirHumidity_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/package.order index 3e1250f4..d731fabb 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/package.order @@ -7,3 +7,5 @@ TestRefP_Traces_FlueGases TestRefT TestRefSubC_Traces TestRefX_FlueGases +TestAirHumidity +TestAirHumidity_Traces diff --git a/ThermoSysPro/Properties/FlueGases/getSubstanceIndex.mo b/ThermoSysPro/Properties/FlueGases/getSubstanceIndex.mo new file mode 100644 index 00000000..15a53b20 --- /dev/null +++ b/ThermoSysPro/Properties/FlueGases/getSubstanceIndex.mo @@ -0,0 +1,16 @@ +within ThermoSysPro.Properties.FlueGases; +function getSubstanceIndex + input String substanceName; + input String substanceNames[:]; + output Integer index; +algorithm + index := 0; + for i in 1:size(substanceNames, 1) loop + if substanceNames[i] == substanceName then + index := i; + return; + end if; + end for; + assert(false, "Substance name " + substanceName + " not found in the list."); + +end getSubstanceIndex; diff --git a/ThermoSysPro/Properties/FlueGases/package.order b/ThermoSysPro/Properties/FlueGases/package.order index 13a21699..3e99d6f8 100644 --- a/ThermoSysPro/Properties/FlueGases/package.order +++ b/ThermoSysPro/Properties/FlueGases/package.order @@ -16,3 +16,4 @@ FlueGases_T FlueGases_Xtot unsafeForJacobian XSat +getSubstanceIndex From 0e3bfa660d4f39c72ccdcf0a659fc93c692218a7 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Fri, 4 Jul 2025 21:51:54 +0200 Subject: [PATCH 155/178] #125 Fan without example --- .../SimpleExamples/Machines/TestStaticFan.mo | 186 ++++++++++++++++++ .../SimpleExamples/Machines/package.order | 1 + ThermoSysPro/Fluid/Machines/StaticFan.mo | 28 +-- 3 files changed, 197 insertions(+), 18 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStaticFan.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStaticFan.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStaticFan.mo new file mode 100644 index 00000000..68f1d3b1 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStaticFan.mo @@ -0,0 +1,186 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Machines; +model TestStaticFan + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.FlueGases; + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ Source_Fumees( + redeclare package Medium = Medium, + Xso2=0, + Xco2=0.0, + Xh2o=0.006, + Xo2=0.23, + Q0=4, + ftype=ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType.FlueGases, + P0=130000, + T0=300, + option_temperature=true) annotation (Placement(transformation(extent={{-210,-24},{-164,24}}, rotation=0))); + + ThermoSysPro.Fluid.BoundaryConditions.Sink Puits_Fumees(redeclare package Medium = Medium) annotation (Placement(transformation( + origin={182,0}, + extent={{10,-10},{-10,10}}, + rotation=180))); + ThermoSysPro.Fluid.Volumes.VolumeATh dynamicExchanger(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-68,50},{-48,70}}, rotation=0))); + ThermoSysPro.Thermal.BoundaryConditions.HeatSource heatSource( + redeclare package Medium = Medium, + option_temperature=2, + W0={1e4}) annotation (Placement(transformation(extent={{-48,90},{-28,110}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLossFlueGases( + redeclare package Medium = Medium, + Q(fixed=false, start=10), + K=10) annotation (Placement(transformation(extent={{12,50},{32,70}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLossFlueGases1( + redeclare package Medium = Medium, + Q(fixed=false, start=11), + K=0.01) annotation (Placement(transformation(extent={{-108,50},{-88,70}}, rotation=0))); + ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Rampe rampe( + Starttime=50, + Duration=50, + Initialvalue=1e4, + Finalvalue=2e5) annotation (Placement(transformation(extent={{0,100},{-20,120}}, rotation=0))); + ThermoSysPro.Fluid.Machines.StaticFan staticFan( + redeclare package Medium = Medium, + VRotn=2700, + rm=1, + a2=0, + b1=-1.315, + b2=2.4593, + VRot=2700, + a1=-263.145, + a3=500, + Q(start=2), + Qv(start=1.4), + rho(start=1.4)) annotation (Placement(transformation(extent={{52,50},{72,70}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.CheckValve singularPressureLossFlueGases2(redeclare package Medium = Medium,Q(fixed=false, start=10)) annotation (Placement(transformation(extent={{92,50},{112,70}}, rotation=0))); + ThermoSysPro.Fluid.Volumes.VolumeATh dynamicExchanger1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-68,-70},{-48,-50}}, rotation=0))); + ThermoSysPro.Thermal.BoundaryConditions.HeatSource heatSource1(option_temperature=2, W0={1e4}) annotation (Placement(transformation(extent={{-48,-90},{-28,-110}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLossFlueGases3(redeclare package Medium = Medium,Q(fixed=false, start=10), K=10) annotation (Placement(transformation(extent={{12,-70},{32,-50}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLossFlueGases4(redeclare package Medium = Medium,Q(fixed=false, start=11), K=0.01) annotation (Placement(transformation(extent={{-108,-70},{-88,-50}}, rotation=0))); + ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Rampe rampe1( + Starttime=50, + Duration=50, + Initialvalue=1e4, + Finalvalue=2e5) annotation (Placement(transformation(extent={{0,-120},{-20,-100}}, rotation=0))); + ThermoSysPro.Fluid.Machines.StaticFan staticFan1( + redeclare package Medium = Medium, + VRotn=2700, + rm=1, + b2=2.4593, + b1=-1.315, + VRot=2700, + a1=-263.145, + a2=0, + a3=500, + Q(start=2), + Qv(start=1.4), + rho(start=1.4)) annotation (Placement(transformation(extent={{52,-70},{72,-50}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.CheckValve singularPressureLossFlueGases5(redeclare package Medium = Medium,Q(fixed=false, start=10)) annotation (Placement(transformation(extent={{92,-70},{112,-50}}, rotation=0))); + ThermoSysPro.Fluid.Junctions.Mixer2 mixerFlueGases2_1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{132,-10},{152,10}}, rotation=0))); + ThermoSysPro.Fluid.Volumes.VolumeDTh volume2S(redeclare package Medium = Medium,dynamic_composition_balance=true) annotation (Placement(transformation(extent={{-148,-10},{-128,10}}, rotation=0))); + ThermoSysPro.Fluid.Sensors.SensorT temperatureSensor(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-28,58},{-8,78}}, rotation=0))); + ThermoSysPro.Fluid.Sensors.SensorT temperatureSensor1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-28,-62},{-8,-42}}, rotation=0))); + ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Rampe Qin( + Starttime=50, + Duration=50, + Initialvalue=4, + Finalvalue=1) annotation (Placement(transformation(extent={{-200,40},{-180,60}}, rotation=0))); +equation + connect(singularPressureLossFlueGases.C2, staticFan.C1) annotation (Line( + points={{32,60},{52,60}}, + color={0,0,0}, + thickness=1)); + connect(staticFan.C2, singularPressureLossFlueGases2.C1) annotation (Line( + points={{72,60},{91,60}}, + color={0,0,0}, + thickness=1)); + connect(singularPressureLossFlueGases3.C2, staticFan1.C1) annotation (Line( + points={{32,-60},{52,-60}}, + color={0,0,0}, + thickness=1)); + connect(staticFan1.C2, singularPressureLossFlueGases5.C1) annotation (Line( + points={{72,-60},{91,-60}}, + color={0,0,0}, + thickness=1)); + connect(singularPressureLossFlueGases2.C2, mixerFlueGases2_1.Ce1) annotation (Line( + points={{113,60},{138,60},{138,10}}, + color={0,0,0}, + thickness=1)); + connect(singularPressureLossFlueGases5.C2, mixerFlueGases2_1.Ce2) annotation (Line( + points={{113,-60},{138,-60},{138,-10}}, + color={0,0,0}, + thickness=1)); + connect(temperatureSensor1.C2, singularPressureLossFlueGases3.C1) annotation (Line( + points={{-7.8,-60},{12,-60}}, + color={0,0,0}, + thickness=1)); + connect(temperatureSensor.C2, singularPressureLossFlueGases.C1) annotation (Line( + points={{-7.8,60},{12,60}}, + color={0,0,0}, + thickness=1)); + connect(Source_Fumees.C, volume2S.Ce) annotation (Line( + points={{-164,0},{-148,0}}, + color={0,0,0}, + thickness=1)); + connect(volume2S.Cs1, singularPressureLossFlueGases1.C1) annotation (Line( + points={{-138,10},{-138,60},{-108,60}}, + color={0,0,0}, + thickness=1)); + connect(volume2S.Cs2, singularPressureLossFlueGases4.C1) annotation (Line( + points={{-138,-10},{-138,-60},{-108,-60}}, + color={0,0,0}, + thickness=1)); + connect(heatSource.C[1], dynamicExchanger.Cth) annotation (Line(points={{-38,90.2},{-58,60}}, color={191,95,0})); + connect(heatSource1.C[1], dynamicExchanger1.Cth) annotation (Line(points={{-38,-90.2},{-58,-60}}, color={191,95,0})); + connect(mixerFlueGases2_1.Cs, Puits_Fumees.C) annotation (Line( + points={{152,0},{162,0},{162,-1.20011e-015},{172,-1.20011e-015}}, + color={0,0,0}, + thickness=1)); + connect(singularPressureLossFlueGases1.C2, dynamicExchanger.Ce1) annotation (Line( + points={{-88,60},{-68,60}}, + color={0,0,0}, + thickness=1, + smooth=Smooth.None)); + connect(dynamicExchanger.Cs1, temperatureSensor.C1) annotation (Line( + points={{-48,60},{-28,60}}, + color={0,0,0}, + thickness=1, + smooth=Smooth.None)); + connect(Qin.y, Source_Fumees.IMassFlow) annotation (Line(points={{-179,50},{-170,50},{-170,28},{-187,28},{-187,12}})); + connect(singularPressureLossFlueGases4.C2, dynamicExchanger1.Ce1) annotation (Line( + points={{-88,-60},{-68,-60}}, + color={0,0,0}, + thickness=1)); + connect(dynamicExchanger1.Cs1, temperatureSensor1.C1) annotation (Line( + points={{-48,-60},{-38,-60},{-28,-60}}, + color={0,0,0}, + thickness=1)); + connect(rampe.y, heatSource.ISignal) annotation (Line(points={{-21,110},{-38,110},{-38,105}}, color={0,0,255})); + connect(rampe1.y, heatSource1.ISignal) annotation (Line(points={{-21,-110},{-38,-110},{-38,-105}}, color={0,0,255})); + annotation ( + experiment(StopTime=1000), + Diagram(coordinateSystem( + preserveAspectRatio=false, + extent={{-200,-150},{200,150}}, + initialScale=0.1)), + Icon(graphics={ + Rectangle( + lineColor={200,200,200}, + fillColor={248,248,248}, + fillPattern=FillPattern.HorizontalCylinder, + extent={{-100.0,-100.0},{100.0,100.0}}, + radius=25.0), + Rectangle( + lineColor={128,128,128}, + extent={{-100.0,-100.0},{100.0,100.0}}, + radius=25.0), + Polygon( + origin={8.0,14.0}, + lineColor={78,138,73}, + fillColor={78,138,73}, + pattern=LinePattern.None, + fillPattern=FillPattern.Solid, + points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), + Documentation(info=" +

    Copyright © EDF 2002 - 2021

    +

    ThermoSysPro Version 4.0

    +")); +end TestStaticFan; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/package.order index 22dae67a..1ecdd94e 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/package.order @@ -10,3 +10,4 @@ TestCombustionTurbine TestCombustionTurbine_Traces TestCompressor TestCompressor_Traces +TestStaticFan diff --git a/ThermoSysPro/Fluid/Machines/StaticFan.mo b/ThermoSysPro/Fluid/Machines/StaticFan.mo index 066b16b6..65871d0e 100644 --- a/ThermoSysPro/Fluid/Machines/StaticFan.mo +++ b/ThermoSysPro/Fluid/Machines/StaticFan.mo @@ -1,6 +1,8 @@ within ThermoSysPro.Fluid.Machines; model StaticFan "Static fan" - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; + extends ThermoSysPro.Fluid.Interfaces.IconColors; + + replaceable package Medium = ThermoSysPro.Properties.Media.FlueGases constrainedby Modelica.Media.Interfaces.PartialMixtureMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter ThermoSysPro.Units.nonSI.AngularVelocity_rpm VRot=1400 "Rotational speed"; @@ -42,8 +44,6 @@ public Units.SI.AbsolutePressure P(start=1.e5) "Fluid average pressure"; Units.SI.SpecificEnthalpy h(start=100000) "Fluid average specific enthalpy"; Units.SI.Temperature T(start=500) "Fluid temperature"; - FluidType ftype "Fluid type"; - Integer fluid=Integer(ftype) "Fluid number"; public ThermoSysPro.InstrumentationAndControl.Connectors.InputLogical commandeFan @@ -51,9 +51,9 @@ public origin={0,110}, extent={{-10,-10},{10,10}}, rotation=270))); - Interfaces.Connectors.FluidInlet C1 annotation (Placement(transformation( + Interfaces.Connectors.FluidInlet C1(redeclare package Medium = Medium) annotation (Placement(transformation( extent={{-110,-10},{-90,10}}, rotation=0))); - Interfaces.Connectors.FluidOutlet C2 annotation (Placement(transformation( + Interfaces.Connectors.FluidOutlet C2(redeclare package Medium = Medium) annotation (Placement(transformation( extent={{90,-10},{110,10}}, rotation=0))); ThermoSysPro.InstrumentationAndControl.Connectors.InputReal VRotation annotation (Placement(transformation( @@ -61,8 +61,6 @@ public extent={{-10,-10},{10,10}}, rotation=90))); equation - /* Check that the fluid type is flue gases */ - assert(ftype == FluidType.FlueGases, "StaticFan: the fluid type must be flue gases"); if (cardinality(commandeFan) == 0) then commandeFan.signal = true; @@ -83,14 +81,9 @@ equation C2.diff_res_1 = C1.diff_res_1 + (if (gamma_diff > 0) then 1/gamma_diff else 0); C1.diff_res_2 = C2.diff_res_2 + (if (gamma_diff > 0) then 1/gamma_diff else 0); - C1.ftype = C2.ftype; - - C1.Xco2 = C2.Xco2; - C1.Xh2o = C2.Xh2o; - C1.Xo2 = C2.Xo2; - C1.Xso2 = C2.Xso2; + C1.SubC = C2.SubC; - ftype = C1.ftype; + C1.Xi = C2.Xi; Q = C1.Q; Q = Qv*rho; @@ -124,12 +117,12 @@ equation h = (C2.h + C1.h)/2; // Temperature - h = ThermoSysPro.Properties.FlueGases.FlueGases_h(P, T, C2.Xco2, C2.Xh2o, C2.Xo2, C2.Xso2); + h = Medium.specificEnthalpy_pTX(P, T, C2.Xi); if (p_rho > 0) then rho = p_rho; else - rho = ThermoSysPro.Properties.FlueGases.FlueGases_rho(P, T, C2.Xco2, C2.Xh2o, C2.Xo2, C2.Xso2); + rho = Medium.density_pTX(P, T, C2.Xi); end if; annotation ( Diagram(coordinateSystem( @@ -177,6 +170,5 @@ equation
  • Daniel Bouskela
  • Baligh El Hefni
  • -"), - DymolaStoredErrors); +")); end StaticFan; From 28424fe595a26208bbf82b8bd9f485ebeac87557 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Fri, 4 Jul 2025 22:02:35 +0200 Subject: [PATCH 156/178] #125 example for StaticFan but no init, need to try implicit declaration for the problematic variable --- .../Examples/SimpleExamples/Machines/TestStaticFan.mo | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStaticFan.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStaticFan.mo index 68f1d3b1..724f4f1b 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStaticFan.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStaticFan.mo @@ -5,12 +5,8 @@ model TestStaticFan replaceable package Medium = ThermoSysPro.Properties.Media.FlueGases; ThermoSysPro.Fluid.BoundaryConditions.SourcePQ Source_Fumees( redeclare package Medium = Medium, - Xso2=0, - Xco2=0.0, - Xh2o=0.006, - Xo2=0.23, + X0={1-0.006-0.23,0.23,0.006,0,0}, Q0=4, - ftype=ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType.FlueGases, P0=130000, T0=300, option_temperature=true) annotation (Placement(transformation(extent={{-210,-24},{-164,24}}, rotation=0))); @@ -21,7 +17,6 @@ model TestStaticFan rotation=180))); ThermoSysPro.Fluid.Volumes.VolumeATh dynamicExchanger(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-68,50},{-48,70}}, rotation=0))); ThermoSysPro.Thermal.BoundaryConditions.HeatSource heatSource( - redeclare package Medium = Medium, option_temperature=2, W0={1e4}) annotation (Placement(transformation(extent={{-48,90},{-28,110}}, rotation=0))); ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLossFlueGases( From 66cb4692ebe37478cc7e753ea6b3d4405af524ca Mon Sep 17 00:00:00 2001 From: VESCOVI Guilherme Date: Mon, 16 Jun 2025 17:50:22 +0200 Subject: [PATCH 157/178] 125-LumpedStraightPipe --- ThermoSysPro/Fluid/PressureLosses/LumpedStraightPipe.mo | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ThermoSysPro/Fluid/PressureLosses/LumpedStraightPipe.mo b/ThermoSysPro/Fluid/PressureLosses/LumpedStraightPipe.mo index 3bb6f579..25cb7a21 100644 --- a/ThermoSysPro/Fluid/PressureLosses/LumpedStraightPipe.mo +++ b/ThermoSysPro/Fluid/PressureLosses/LumpedStraightPipe.mo @@ -114,6 +114,8 @@ equation state=Medium.setState_phX(p=Pm, h=h, X=X); + state=Medium.setState_phX(p=Pm, h=h, X=X, region=mode); + if (p_rho > 0) then rho = p_rho; else From 5debdb06a5646ac16c698b22b16d558514029feb Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Fri, 4 Jul 2025 15:27:10 +0200 Subject: [PATCH 158/178] 125 LumpedStraightPipe for FlueGases --- ThermoSysPro/Fluid/PressureLosses/LumpedStraightPipe.mo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ThermoSysPro/Fluid/PressureLosses/LumpedStraightPipe.mo b/ThermoSysPro/Fluid/PressureLosses/LumpedStraightPipe.mo index 25cb7a21..c03f52e9 100644 --- a/ThermoSysPro/Fluid/PressureLosses/LumpedStraightPipe.mo +++ b/ThermoSysPro/Fluid/PressureLosses/LumpedStraightPipe.mo @@ -114,7 +114,7 @@ equation state=Medium.setState_phX(p=Pm, h=h, X=X); - state=Medium.setState_phX(p=Pm, h=h, X=X, region=mode); + state=Medium.setState_phX(p=Pm, h=h, X=X); if (p_rho > 0) then rho = p_rho; From a3cf6be50ac0e275ef66cc0e3342c9613238524b Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Sun, 6 Jul 2025 19:33:26 +0200 Subject: [PATCH 159/178] #125 Easier Fan example --- .../SimpleExamples/Machines/TestStaticFan.mo | 178 ++---------------- .../Machines/TestStaticFan_Traces.mo | 46 +++++ .../SimpleExamples/Machines/package.order | 1 + 3 files changed, 66 insertions(+), 159 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStaticFan_Traces.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStaticFan.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStaticFan.mo index 724f4f1b..d1bc4845 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStaticFan.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStaticFan.mo @@ -3,37 +3,9 @@ model TestStaticFan extends ThermoSysPro.UsersGuide.Icons.Example; replaceable package Medium = ThermoSysPro.Properties.Media.FlueGases; - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ Source_Fumees( - redeclare package Medium = Medium, - X0={1-0.006-0.23,0.23,0.006,0,0}, - Q0=4, - P0=130000, - T0=300, - option_temperature=true) annotation (Placement(transformation(extent={{-210,-24},{-164,24}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.Sink Puits_Fumees(redeclare package Medium = Medium) annotation (Placement(transformation( - origin={182,0}, - extent={{10,-10},{-10,10}}, - rotation=180))); - ThermoSysPro.Fluid.Volumes.VolumeATh dynamicExchanger(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-68,50},{-48,70}}, rotation=0))); - ThermoSysPro.Thermal.BoundaryConditions.HeatSource heatSource( - option_temperature=2, - W0={1e4}) annotation (Placement(transformation(extent={{-48,90},{-28,110}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLossFlueGases( + ThermoSysPro.Fluid.Machines.StaticFan Compressor( redeclare package Medium = Medium, - Q(fixed=false, start=10), - K=10) annotation (Placement(transformation(extent={{12,50},{32,70}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLossFlueGases1( - redeclare package Medium = Medium, - Q(fixed=false, start=11), - K=0.01) annotation (Placement(transformation(extent={{-108,50},{-88,70}}, rotation=0))); - ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Rampe rampe( - Starttime=50, - Duration=50, - Initialvalue=1e4, - Finalvalue=2e5) annotation (Placement(transformation(extent={{0,100},{-20,120}}, rotation=0))); - ThermoSysPro.Fluid.Machines.StaticFan staticFan( - redeclare package Medium = Medium, VRotn=2700, rm=1, a2=0, @@ -44,137 +16,25 @@ model TestStaticFan a3=500, Q(start=2), Qv(start=1.4), - rho(start=1.4)) annotation (Placement(transformation(extent={{52,50},{72,70}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.CheckValve singularPressureLossFlueGases2(redeclare package Medium = Medium,Q(fixed=false, start=10)) annotation (Placement(transformation(extent={{92,50},{112,70}}, rotation=0))); - ThermoSysPro.Fluid.Volumes.VolumeATh dynamicExchanger1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-68,-70},{-48,-50}}, rotation=0))); - ThermoSysPro.Thermal.BoundaryConditions.HeatSource heatSource1(option_temperature=2, W0={1e4}) annotation (Placement(transformation(extent={{-48,-90},{-28,-110}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLossFlueGases3(redeclare package Medium = Medium,Q(fixed=false, start=10), K=10) annotation (Placement(transformation(extent={{12,-70},{32,-50}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLossFlueGases4(redeclare package Medium = Medium,Q(fixed=false, start=11), K=0.01) annotation (Placement(transformation(extent={{-108,-70},{-88,-50}}, rotation=0))); - ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Rampe rampe1( - Starttime=50, - Duration=50, - Initialvalue=1e4, - Finalvalue=2e5) annotation (Placement(transformation(extent={{0,-120},{-20,-100}}, rotation=0))); - ThermoSysPro.Fluid.Machines.StaticFan staticFan1( - redeclare package Medium = Medium, - VRotn=2700, - rm=1, - b2=2.4593, - b1=-1.315, - VRot=2700, - a1=-263.145, - a2=0, - a3=500, - Q(start=2), - Qv(start=1.4), - rho(start=1.4)) annotation (Placement(transformation(extent={{52,-70},{72,-50}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.CheckValve singularPressureLossFlueGases5(redeclare package Medium = Medium,Q(fixed=false, start=10)) annotation (Placement(transformation(extent={{92,-70},{112,-50}}, rotation=0))); - ThermoSysPro.Fluid.Junctions.Mixer2 mixerFlueGases2_1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{132,-10},{152,10}}, rotation=0))); - ThermoSysPro.Fluid.Volumes.VolumeDTh volume2S(redeclare package Medium = Medium,dynamic_composition_balance=true) annotation (Placement(transformation(extent={{-148,-10},{-128,10}}, rotation=0))); - ThermoSysPro.Fluid.Sensors.SensorT temperatureSensor(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-28,58},{-8,78}}, rotation=0))); - ThermoSysPro.Fluid.Sensors.SensorT temperatureSensor1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-28,-62},{-8,-42}}, rotation=0))); - ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Rampe Qin( - Starttime=50, - Duration=50, - Initialvalue=4, - Finalvalue=1) annotation (Placement(transformation(extent={{-200,40},{-180,60}}, rotation=0))); + rho(start=1.4)) annotation (Placement(transformation(extent={{-10,-10},{10,10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ SourceQ1( + redeclare package Medium = Medium, + X0={1-0.006-0.23,0.23,0.006,0,0}, + Q0=4, + P0=130000, + T0=300, + option_temperature=true) annotation (Placement(transformation(extent={{-60,-10},{-40,10}}, rotation=0))); + + ThermoSysPro.Fluid.BoundaryConditions.Sink SinkP1(redeclare package Medium = Medium, + T0=300, + option_temperature=true) annotation (Placement(transformation( + origin={50,0}, + extent={{10,-10},{-10,10}}, + rotation=180))); equation - connect(singularPressureLossFlueGases.C2, staticFan.C1) annotation (Line( - points={{32,60},{52,60}}, - color={0,0,0}, - thickness=1)); - connect(staticFan.C2, singularPressureLossFlueGases2.C1) annotation (Line( - points={{72,60},{91,60}}, - color={0,0,0}, - thickness=1)); - connect(singularPressureLossFlueGases3.C2, staticFan1.C1) annotation (Line( - points={{32,-60},{52,-60}}, - color={0,0,0}, - thickness=1)); - connect(staticFan1.C2, singularPressureLossFlueGases5.C1) annotation (Line( - points={{72,-60},{91,-60}}, - color={0,0,0}, - thickness=1)); - connect(singularPressureLossFlueGases2.C2, mixerFlueGases2_1.Ce1) annotation (Line( - points={{113,60},{138,60},{138,10}}, - color={0,0,0}, - thickness=1)); - connect(singularPressureLossFlueGases5.C2, mixerFlueGases2_1.Ce2) annotation (Line( - points={{113,-60},{138,-60},{138,-10}}, - color={0,0,0}, - thickness=1)); - connect(temperatureSensor1.C2, singularPressureLossFlueGases3.C1) annotation (Line( - points={{-7.8,-60},{12,-60}}, - color={0,0,0}, - thickness=1)); - connect(temperatureSensor.C2, singularPressureLossFlueGases.C1) annotation (Line( - points={{-7.8,60},{12,60}}, - color={0,0,0}, - thickness=1)); - connect(Source_Fumees.C, volume2S.Ce) annotation (Line( - points={{-164,0},{-148,0}}, - color={0,0,0}, - thickness=1)); - connect(volume2S.Cs1, singularPressureLossFlueGases1.C1) annotation (Line( - points={{-138,10},{-138,60},{-108,60}}, - color={0,0,0}, - thickness=1)); - connect(volume2S.Cs2, singularPressureLossFlueGases4.C1) annotation (Line( - points={{-138,-10},{-138,-60},{-108,-60}}, - color={0,0,0}, - thickness=1)); - connect(heatSource.C[1], dynamicExchanger.Cth) annotation (Line(points={{-38,90.2},{-58,60}}, color={191,95,0})); - connect(heatSource1.C[1], dynamicExchanger1.Cth) annotation (Line(points={{-38,-90.2},{-58,-60}}, color={191,95,0})); - connect(mixerFlueGases2_1.Cs, Puits_Fumees.C) annotation (Line( - points={{152,0},{162,0},{162,-1.20011e-015},{172,-1.20011e-015}}, - color={0,0,0}, - thickness=1)); - connect(singularPressureLossFlueGases1.C2, dynamicExchanger.Ce1) annotation (Line( - points={{-88,60},{-68,60}}, - color={0,0,0}, - thickness=1, - smooth=Smooth.None)); - connect(dynamicExchanger.Cs1, temperatureSensor.C1) annotation (Line( - points={{-48,60},{-28,60}}, - color={0,0,0}, - thickness=1, - smooth=Smooth.None)); - connect(Qin.y, Source_Fumees.IMassFlow) annotation (Line(points={{-179,50},{-170,50},{-170,28},{-187,28},{-187,12}})); - connect(singularPressureLossFlueGases4.C2, dynamicExchanger1.Ce1) annotation (Line( - points={{-88,-60},{-68,-60}}, - color={0,0,0}, - thickness=1)); - connect(dynamicExchanger1.Cs1, temperatureSensor1.C1) annotation (Line( - points={{-48,-60},{-38,-60},{-28,-60}}, - color={0,0,0}, - thickness=1)); - connect(rampe.y, heatSource.ISignal) annotation (Line(points={{-21,110},{-38,110},{-38,105}}, color={0,0,255})); - connect(rampe1.y, heatSource1.ISignal) annotation (Line(points={{-21,-110},{-38,-110},{-38,-105}}, color={0,0,255})); - annotation ( - experiment(StopTime=1000), - Diagram(coordinateSystem( - preserveAspectRatio=false, - extent={{-200,-150},{200,150}}, - initialScale=0.1)), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), - Documentation(info=" + connect(Compressor.C2, SinkP1.C) annotation (Line(points={{10,0},{40,0}}, color={0,0,0})); + connect(Compressor.C1, SourceQ1.C) annotation (Line(points={{-10,0},{-40,0}}, color={0,0,0})); + annotation ( Documentation(info="

    Copyright © EDF 2002 - 2021

    ThermoSysPro Version 4.0

    ")); diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStaticFan_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStaticFan_Traces.mo new file mode 100644 index 00000000..acf05608 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestStaticFan_Traces.mo @@ -0,0 +1,46 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Machines; +model TestStaticFan_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.FlueGases ( + extraPropertiesNames={"Trace"}, + C_nominal={0.1}, + C_default={0.2}); + + ThermoSysPro.Fluid.Machines.StaticFan Compressor( + redeclare package Medium = Medium, + VRotn=2700, + rm=1, + a2=0, + b1=-1.315, + b2=2.4593, + VRot=2700, + a1=-263.145, + a3=500, + Q(start=2), + Qv(start=1.4), + rho(start=1.4)) annotation (Placement(transformation(extent={{-10,-10},{10,10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ SourceQ1( + redeclare package Medium = Medium, + SubC0={0.5}, + X0={1 - 0.006 - 0.23,0.23,0.006,0,0}, + Q0=4, + P0=130000, + T0=300, + option_temperature=true) annotation (Placement(transformation(extent={{-60,-10},{-40,10}}, rotation=0))); + + ThermoSysPro.Fluid.BoundaryConditions.Sink SinkP1( + redeclare package Medium = Medium, + T0=300, + option_temperature=true) annotation (Placement(transformation( + origin={50,0}, + extent={{10,-10},{-10,10}}, + rotation=180))); +equation + connect(Compressor.C2, SinkP1.C) annotation (Line(points={{10,0},{40,0}}, color={0,0,0})); + connect(Compressor.C1, SourceQ1.C) annotation (Line(points={{-10,0},{-40,0}}, color={0,0,0})); + annotation (Documentation(info=" +

    Copyright © EDF 2002 - 2021

    +

    ThermoSysPro Version 4.0

    +")); +end TestStaticFan_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/package.order index 1ecdd94e..cff52f3b 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/package.order @@ -11,3 +11,4 @@ TestCombustionTurbine_Traces TestCompressor TestCompressor_Traces TestStaticFan +TestStaticFan_Traces From 80101581830e0deefeaa1480b0d14bccee4ecb99 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Sun, 6 Jul 2025 19:53:05 +0200 Subject: [PATCH 160/178] #125 SteamEngine --- .../Machines/TestSteamEngine.mo | 49 +++++++++++++++ .../Machines/TestSteamEngine_Traces.mo | 52 ++++++++++++++++ .../SimpleExamples/Machines/package.order | 2 + ThermoSysPro/Fluid/Machines/SteamEngine.mo | 59 ++++++++----------- 4 files changed, 127 insertions(+), 35 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestSteamEngine.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestSteamEngine_Traces.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestSteamEngine.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestSteamEngine.mo new file mode 100644 index 00000000..aeb4b91b --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestSteamEngine.mo @@ -0,0 +1,49 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Machines; +model TestSteamEngine + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; + ThermoSysPro.Fluid.Machines.SteamEngine steamEngine1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP puitsP(redeclare package Medium = Medium, P0=100000) annotation (Placement(transformation(extent={{30,-10},{50,10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP( + redeclare package Medium = Medium, + h0=3.e6, + option_temperature=false, + P0=1600000) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}, rotation=0))); +equation + connect(sourceP.C, steamEngine1.C1) annotation (Line(points={{-30,0},{-7,0}}, color={0,0,255})); + connect(steamEngine1.C2, puitsP.C) annotation (Line(points={{7,0},{30,0}}, color={0,0,255})); + annotation ( + experiment(StopTime=1000), + Window( + x=0.32, + y=0.02, + width=0.39, + height=0.47), + Diagram(coordinateSystem( + preserveAspectRatio=false, + extent={{-100,-100},{100,100}}, + grid={2,2}), graphics), + Icon(graphics={ + Rectangle( + lineColor={200,200,200}, + fillColor={248,248,248}, + fillPattern=FillPattern.HorizontalCylinder, + extent={{-100.0,-100.0},{100.0,100.0}}, + radius=25.0), + Rectangle( + lineColor={128,128,128}, + extent={{-100.0,-100.0},{100.0,100.0}}, + radius=25.0), + Polygon( + origin={8.0,14.0}, + lineColor={78,138,73}, + fillColor={78,138,73}, + pattern=LinePattern.None, + fillPattern=FillPattern.Solid, + points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), + Documentation(info=" +

    Copyright © EDF 2002 - 2024

    +

    ThermoSysPro Version 4.1 +")); +end TestSteamEngine; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestSteamEngine_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestSteamEngine_Traces.mo new file mode 100644 index 00000000..647c4ef3 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestSteamEngine_Traces.mo @@ -0,0 +1,52 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Machines; +model TestSteamEngine_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam ( + extraPropertiesNames={"Trace"}, + C_nominal={0.1}, + C_default={0.2}); + ThermoSysPro.Fluid.Machines.SteamEngine steamEngine1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP puitsP(redeclare package Medium = Medium, P0=100000) annotation (Placement(transformation(extent={{30,-10},{50,10}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP( + redeclare package Medium = Medium, + h0=3.e6, + option_temperature=false, + P0=1600000) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}, rotation=0))); +equation + connect(sourceP.C, steamEngine1.C1) annotation (Line(points={{-30,0},{-7,0}}, color={0,0,255})); + connect(steamEngine1.C2, puitsP.C) annotation (Line(points={{7,0},{30,0}}, color={0,0,255})); + annotation ( + experiment(StopTime=1000), + Window( + x=0.32, + y=0.02, + width=0.39, + height=0.47), + Diagram(coordinateSystem( + preserveAspectRatio=false, + extent={{-100,-100},{100,100}}, + grid={2,2}), graphics), + Icon(graphics={ + Rectangle( + lineColor={200,200,200}, + fillColor={248,248,248}, + fillPattern=FillPattern.HorizontalCylinder, + extent={{-100.0,-100.0},{100.0,100.0}}, + radius=25.0), + Rectangle( + lineColor={128,128,128}, + extent={{-100.0,-100.0},{100.0,100.0}}, + radius=25.0), + Polygon( + origin={8.0,14.0}, + lineColor={78,138,73}, + fillColor={78,138,73}, + pattern=LinePattern.None, + fillPattern=FillPattern.Solid, + points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), + Documentation(info=" +

    Copyright © EDF 2002 - 2024

    +

    ThermoSysPro Version 4.1 +")); +end TestSteamEngine_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/package.order index cff52f3b..91f27a61 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/package.order @@ -12,3 +12,5 @@ TestCompressor TestCompressor_Traces TestStaticFan TestStaticFan_Traces +TestSteamEngine +TestSteamEngine_Traces diff --git a/ThermoSysPro/Fluid/Machines/SteamEngine.mo b/ThermoSysPro/Fluid/Machines/SteamEngine.mo index ca363d38..0c94597b 100644 --- a/ThermoSysPro/Fluid/Machines/SteamEngine.mo +++ b/ThermoSysPro/Fluid/Machines/SteamEngine.mo @@ -1,5 +1,8 @@ within ThermoSysPro.Fluid.Machines; model SteamEngine "Steam engine" + extends ThermoSysPro.Fluid.Interfaces.IconColors; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialTwoPhaseThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; @@ -10,13 +13,14 @@ model SteamEngine "Steam engine" parameter Integer option_interpolation=1 "1: linear interpolation - 2: spline interpolation"; parameter Units.SI.MassFlowRate gamma_diff=1e-4 "Diffusion conductance (active if diffusion=true in neighbouring volumes)"; - parameter IF97Region region_e=IF97Region.All_regions "Inlet IF97 region (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); - parameter IF97Region region_s=IF97Region.All_regions "Outlet IF97 region (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); + parameter IF97Region region_e=IF97Region.All_regions "Inlet IF97 region (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(tab="Fluid", group="Fluid properties")); + parameter IF97Region region_s=IF97Region.All_regions "Outlet IF97 region (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(tab="Fluid", group="Fluid properties")); protected constant Units.SI.Acceleration g=Modelica.Constants.g_n "Gravity constant"; - parameter Integer mode_e=Integer(region_e) - 1 "Inlet IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; - parameter Integer mode_s=Integer(region_s) - 1 "Outlet IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; + + Integer phase_e=if Integer(region_e) == 0 then 0 else if Integer(region_e)==4 then 2 else 1; + Integer phase_s=if Integer(region_s) == 0 then 0 else if Integer(region_s)==4 then 2 else 1; public Units.SI.Power W "Power produced by the engine"; @@ -29,26 +33,17 @@ public Units.SI.Temperature Te "Temperature at the inlet"; Units.SI.Temperature Ts "Temperature at the outlet"; Real xm(start=1.0,min=0) "Average vapor mass fraction (n.u.)"; - FluidType ftype "Fluid type"; - Integer fluid=Integer(ftype) "Fluid number"; + + + Medium.ThermodynamicState state_e; + Medium.ThermodynamicState state_s; + Medium.ThermodynamicState state_ps; public - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph proe - annotation (Placement(transformation(extent={{-80,80},{-60,100}}, rotation= - 0))); - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pros - annotation (Placement(transformation(extent={{60,80},{80,100}}, rotation=0))); - Interfaces.Connectors.FluidInlet C1 annotation (Placement(transformation( - extent={{-80,-10},{-60,10}}, rotation=0))); - Interfaces.Connectors.FluidOutlet C2 annotation (Placement(transformation( - extent={{60,-10},{80,10}}, rotation=0))); - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ps props - annotation (Placement(transformation(extent={{-80,40},{-60,60}}, rotation=0))); + Interfaces.Connectors.FluidInlet C1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-80,-10},{-60,10}}, rotation=0))); + Interfaces.Connectors.FluidOutlet C2(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{60,-10},{80,10}}, rotation=0))); equation - /* Check that the fluid type is water/steam */ - assert((ftype == FluidType.WaterSteam) or (ftype == FluidType.WaterSteamSimple), "SteamEngine: the fluid type must be water/steam"); - C1.Q = C2.Q; C1.h_vol_1 = C2.h_vol_1; @@ -60,22 +55,16 @@ equation C2.diff_res_1 = C1.diff_res_1 + (if (gamma_diff > 0) then 1/gamma_diff else 0); C1.diff_res_2 = C2.diff_res_2 + (if (gamma_diff > 0) then 1/gamma_diff else 0); - C1.ftype = C2.ftype; - - C1.Xco2 = C2.Xco2; - C1.Xh2o = C2.Xh2o; - C1.Xo2 = C2.Xo2; - C1.Xso2 = C2.Xso2; + C1.SubC = C2.SubC; + C1.Xi = C2.Xi; Q = C1.Q; Pe = C1.P; Ps = C2.P; deltaP = Pe - Ps; - ftype = C1.ftype; - /* Average vapor mass fraction during the expansion */ - xm = (proe.x + pros.x)/2.0; + xm = (Medium.vapourQuality(state_e) + Medium.vapourQuality(state_s)) /2.0; /* Mass flow */ if (option_interpolation == 1) then @@ -93,16 +82,16 @@ equation W = Q*eta_stato*(C1.h - C2.h)*(1 - W_frot/100); /* Fluid thermodynamic properties before the expansion */ - proe = ThermoSysPro.Properties.Fluid.Ph(Pe, C1.h, mode_e,fluid); - Te = proe.T; + state_e = Medium.setState_ph(Pe,C1.h, phase=phase_e); + Te=Medium.temperature(state_e); /* Fluid thermodynamic properties after the expansion */ - pros = ThermoSysPro.Properties.Fluid.Ph(Ps, C2.h, mode_s,fluid); - Ts = pros.T; + state_s = Medium.setState_ph(Ps, C2.h, phase=phase_s); + Ts=Medium.temperature(state_s); /* Fluid thermodynamic properties after the isentropic expansion */ - props = ThermoSysPro.Properties.Fluid.Ps(Ps, proe.s, mode_s,fluid); - His = props.h; + state_ps = Medium.setState_ps(Ps, Medium.specificEntropy(state_e), phase=phase_s); + His=Medium.specificEnthalpy(state_ps); annotation ( Diagram(coordinateSystem( From 495dad4c32b76c309f1872e474c6d9a7d6c6e22c Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Sun, 6 Jul 2025 20:15:45 +0200 Subject: [PATCH 161/178] 125 SteamExtractionSplitter and small fixes on SteamEngines examples --- .../Junctions/TestSteamExtractionSplitter.mo | 27 ++++++ .../TestSteamExtractionSplitter_Traces.mo | 27 ++++++ .../SimpleExamples/Junctions/package.order | 2 + .../Machines/TestSteamEngine.mo | 18 ---- .../Machines/TestSteamEngine_Traces.mo | 21 +---- .../Junctions/SteamExtractionSplitter.mo | 88 +++++++------------ ThermoSysPro/Fluid/Machines/SteamEngine.mo | 1 - 7 files changed, 91 insertions(+), 93 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestSteamExtractionSplitter.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestSteamExtractionSplitter_Traces.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestSteamExtractionSplitter.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestSteamExtractionSplitter.mo new file mode 100644 index 00000000..bb39c918 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestSteamExtractionSplitter.mo @@ -0,0 +1,27 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Junctions; +model TestSteamExtractionSplitter + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam; + ThermoSysPro.Fluid.Junctions.SteamExtractionSplitter steamExtractionSplitter(redeclare package Medium = Medium, alpha=0.9) annotation (Placement(transformation(extent={{-20,20},{0,40}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare package Medium = Medium, h0=2600000) annotation (Placement(transformation(extent={{-100,20},{-80,40}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss2(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-60,20},{-40,40}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP(redeclare package Medium = Medium, P0=100e5) annotation (Placement(transformation(extent={{60,20},{80,40}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{20,20},{40,40}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss3(redeclare package Medium = Medium, K=2.e-3) annotation (Placement(transformation(extent={{0,-20},{20,0}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkQ sink(redeclare package Medium = Medium, Q0=10) annotation (Placement(transformation(extent={{40,-20},{60,0}}, rotation=0))); +equation + connect(sourceQ.C, singularPressureLoss2.C1) annotation (Line(points={{-80,30},{-60,30}}, color={0,0,255})); + connect(singularPressureLoss2.C2, steamExtractionSplitter.Ce) annotation (Line(points={{-40,30},{-20.3,30}}, color={0,0,255})); + connect(steamExtractionSplitter.Cs, singularPressureLoss1.C1) annotation (Line(points={{0.3,30},{20,30}}, color={0,0,255})); + connect(steamExtractionSplitter.Cex, singularPressureLoss3.C1) annotation (Line(points={{-6,20},{-6,-10},{0,-10}}, color={0,0,255})); + connect(singularPressureLoss1.C2, sinkP.C) annotation (Line(points={{40,30},{60,30}}, color={0,0,255})); + connect(singularPressureLoss3.C2, sink.C) annotation (Line(points={{20,-10},{40,-10}}, color={0,0,255})); + annotation ( + experiment(StopTime=1000), + Diagram(graphics), + Documentation(info=" +

    Copyright © EDF 2002 - 2024

    +

    ThermoSysPro Version 4.1 +")); +end TestSteamExtractionSplitter; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestSteamExtractionSplitter_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestSteamExtractionSplitter_Traces.mo new file mode 100644 index 00000000..83e5941e --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestSteamExtractionSplitter_Traces.mo @@ -0,0 +1,27 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Junctions; +model TestSteamExtractionSplitter_Traces + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Fluid.Examples.SimpleExamples.Media.WaterSteam_NonVolatileTrace; + ThermoSysPro.Fluid.Junctions.SteamExtractionSplitter steamExtractionSplitter(redeclare package Medium = Medium, alpha=0.9, redeclare function PhasesSeparationFunction = Medium.PhasesSeparation (x=steamExtractionSplitter.xe)) annotation (Placement(transformation(extent={{-20,20},{0,40}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ(redeclare package Medium = Medium, h0=2600000) annotation (Placement(transformation(extent={{-100,20},{-80,40}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss2(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-60,20},{-40,40}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP(redeclare package Medium = Medium, P0=100e5) annotation (Placement(transformation(extent={{60,20},{80,40}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{20,20},{40,40}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss3(redeclare package Medium = Medium, K=2.e-3) annotation (Placement(transformation(extent={{0,-20},{20,0}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkQ sink(redeclare package Medium = Medium, Q0=10) annotation (Placement(transformation(extent={{40,-20},{60,0}}, rotation=0))); +equation + connect(sourceQ.C, singularPressureLoss2.C1) annotation (Line(points={{-80,30},{-60,30}}, color={0,0,255})); + connect(singularPressureLoss2.C2, steamExtractionSplitter.Ce) annotation (Line(points={{-40,30},{-20.3,30}}, color={0,0,255})); + connect(steamExtractionSplitter.Cs, singularPressureLoss1.C1) annotation (Line(points={{0.3,30},{20,30}}, color={0,0,255})); + connect(steamExtractionSplitter.Cex, singularPressureLoss3.C1) annotation (Line(points={{-6,20},{-6,-10},{0,-10}}, color={0,0,255})); + connect(singularPressureLoss1.C2, sinkP.C) annotation (Line(points={{40,30},{60,30}}, color={0,0,255})); + connect(singularPressureLoss3.C2, sink.C) annotation (Line(points={{20,-10},{40,-10}}, color={0,0,255})); + annotation ( + experiment(StopTime=1000), + Diagram(graphics), + Documentation(info=" +

    Copyright © EDF 2002 - 2024

    +

    ThermoSysPro Version 4.1 +")); +end TestSteamExtractionSplitter_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/package.order index 712a41f9..f44cdf65 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/package.order @@ -24,3 +24,5 @@ TestStaticDrum TestStaticDrum_Traces TestStaticDrum_Plug TestStaticDrum_Plug_Traces +TestSteamExtractionSplitter +TestSteamExtractionSplitter_Traces diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestSteamEngine.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestSteamEngine.mo index aeb4b91b..6fd8484e 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestSteamEngine.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestSteamEngine.mo @@ -24,24 +24,6 @@ equation preserveAspectRatio=false, extent={{-100,-100},{100,100}}, grid={2,2}), graphics), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), Documentation(info="

    Copyright © EDF 2002 - 2024

    ThermoSysPro Version 4.1 diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestSteamEngine_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestSteamEngine_Traces.mo index 647c4ef3..20f0d47c 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestSteamEngine_Traces.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestSteamEngine_Traces.mo @@ -12,7 +12,8 @@ model TestSteamEngine_Traces redeclare package Medium = Medium, h0=3.e6, option_temperature=false, - P0=1600000) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}, rotation=0))); + P0=1600000, + SubC0={0.5}) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}, rotation=0))); equation connect(sourceP.C, steamEngine1.C1) annotation (Line(points={{-30,0},{-7,0}}, color={0,0,255})); connect(steamEngine1.C2, puitsP.C) annotation (Line(points={{7,0},{30,0}}, color={0,0,255})); @@ -27,24 +28,6 @@ equation preserveAspectRatio=false, extent={{-100,-100},{100,100}}, grid={2,2}), graphics), - Icon(graphics={ - Rectangle( - lineColor={200,200,200}, - fillColor={248,248,248}, - fillPattern=FillPattern.HorizontalCylinder, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Rectangle( - lineColor={128,128,128}, - extent={{-100.0,-100.0},{100.0,100.0}}, - radius=25.0), - Polygon( - origin={8.0,14.0}, - lineColor={78,138,73}, - fillColor={78,138,73}, - pattern=LinePattern.None, - fillPattern=FillPattern.Solid, - points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), Documentation(info="

    Copyright © EDF 2002 - 2024

    ThermoSysPro Version 4.1 diff --git a/ThermoSysPro/Fluid/Junctions/SteamExtractionSplitter.mo b/ThermoSysPro/Fluid/Junctions/SteamExtractionSplitter.mo index 7b449566..8d732139 100644 --- a/ThermoSysPro/Fluid/Junctions/SteamExtractionSplitter.mo +++ b/ThermoSysPro/Fluid/Junctions/SteamExtractionSplitter.mo @@ -1,9 +1,10 @@ within ThermoSysPro.Fluid.Junctions; model SteamExtractionSplitter "Splitter for steam extraction" - extends - ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.WaterSteamFluidTypeParameterInterface; extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialTwoPhaseThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable function SaS = Medium.noSaS(SubC = Ce.SubC) annotation (choicesAllMatching=true,Dialog(tab="Fluid", group="Medium")); + replaceable function PhasesSeparationFunction = Medium.HomogeneousPhasesSeparation(SubC = Ce.SubC) annotation (choicesAllMatching=true,Dialog(tab="Fluid", group="Medium")); import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; parameter Real alpha = 1 @@ -12,23 +13,21 @@ model SteamExtractionSplitter "Splitter for steam extraction" "true: continuous flow reversal - false: discontinuous flow reversal"; parameter Boolean diffusion=false "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; - parameter IF97Region region_e=IF97Region.All_regions "IF97 region at the inlet (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); + parameter IF97Region region_e=IF97Region.All_regions "IF97 region at the inlet (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(tab="Fluid", group="Fluid properties")); protected parameter Units.SI.MassFlowRate gamma0=1.e-4 "Pseudo-diffusion conductance use for continuous flow reversal (active if diffusion=false and continuous_flow_reversal = true)"; parameter Integer mode_e=Integer(region_e) - 1 "IF97 region at the inlet. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; - parameter Integer fluid=Integer(ftype) "Fluid number"; + Medium.C_BiPhase C_record; public Real x_ex(start=0.99) "Vapor mass fraction at the extraction outlet"; Units.SI.AbsolutePressure P(start=10e5) "Fluid pressure"; Units.SI.SpecificEnthalpy h(start=10e5) "Fluid specific enthalpy"; - FluidType fluids[4] "Fluids mixing in volume"; - ThermoSysPro.Units.SI.MassFraction Xco2 "CO2 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xh2o "H20 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xo2 "O2 mass fraction"; - ThermoSysPro.Units.SI.MassFraction Xso2 "SO2 mass fraction"; + Real xe(start=1.0) "Vapor mass fraction at the inlet"; + Medium.ExtraProperty X[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Fluid mass fraction"; + Medium.ExtraProperty SubCSaS[Medium.nC](quantity=Medium.extraPropertiesNames) "Trace modification in the trace balance equation"; Units.SI.Power Je "Thermal power diffusion from inlet e"; Units.SI.Power Js "Thermal power diffusion from outlet s"; Units.SI.Power Jex "Thermal power diffusion from outlet ex"; @@ -40,32 +39,15 @@ public Real rs "Value of r(Q/gamma) for outlet s"; Real rex "Value of r(Q/gamma) for outlet ex"; -public - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph proe - annotation (Placement(transformation(extent={{-100,80},{-80,100}}, rotation= - 0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce annotation (Placement( - transformation(extent={{-113,-10},{-93,10}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs annotation (Placement( - transformation(extent={{93,-10},{113,10}}, rotation=0))); - ThermoSysPro.Properties.WaterSteam.Common.PropThermoSat lsat - annotation (Placement(transformation(extent={{-60,80},{-40,100}}, rotation= - 0))); - ThermoSysPro.Properties.WaterSteam.Common.PropThermoSat vsat - annotation (Placement(transformation(extent={{-20,80},{0,100}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cex "Extraction outlet" - annotation (Placement(transformation(extent={{30,-110},{50,-90}}, rotation= - 0))); -equation - /* Check that incoming fluids are compatible with fluid in volume */ - fluids[1] = ftype; - fluids[2] = Ce.ftype; - fluids[3] = Cs.ftype; - fluids[4] = Cex.ftype; + Medium.SaturationProperties sat; + Medium.ThermodynamicState state_e; - assert(ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.isCompatible(fluids), - "SteamExtractionSplitter: fluids mixing in volume are not compatible with each other"); +public + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ce(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-113,-10},{-93,10}}, rotation=0))); + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cs(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{93,-10},{113,10}}, rotation=0))); + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cex(redeclare package Medium = Medium) "Extraction outlet" annotation (Placement(transformation(extent={{30,-110},{50,-90}}, rotation=0))); +equation /* Mass balance equation */ 0 = Ce.Q - Cs.Q - Cex.Q; @@ -78,26 +60,21 @@ equation Ce.h_vol_2 = h; Cs.h_vol_1 = h; - Cex.h_vol_1 = if noEvent(x_ex < 1) then (1 - x_ex)*lsat.h + x_ex*vsat.h else h; + Cex.h_vol_1 = if noEvent(x_ex < 1) then (1 - x_ex)*Medium.bubbleEnthalpy(sat)+ x_ex*Medium.dewEnthalpy(sat) else h; - /* Fluid composition */ - 0 = Ce.Xco2*Ce.Q - Cs.Xco2*Cs.Q - Cex.Xco2*Cex.Q; - 0 = Ce.Xh2o*Ce.Q - Cs.Xh2o*Cs.Q - Cex.Xh2o*Cex.Q; - 0 = Ce.Xo2*Ce.Q - Cs.Xo2*Cs.Q - Cex.Xo2*Cex.Q; - 0 = Ce.Xso2*Ce.Q - Cs.Xso2*Cs.Q - Cex.Xso2*Cex.Q; + /* Traces composition balance equations */ + C_record = PhasesSeparationFunction(); + Cs.SubC = C_record.Cg; - Cs.ftype = ftype; - Cex.ftype = ftype; + Cs.Q*Cs.SubC + Cex.Q*Cex.SubC = Ce.Q*Ce.SubC + SubCSaS * Ce.Q; - Cs.Xco2 = Xco2; - Cs.Xh2o = Xh2o; - Cs.Xo2 = Xo2; - Cs.Xso2 = Xso2; + SubCSaS = SaS(); - Cex.Xco2 = Xco2; - Cex.Xh2o = Xh2o; - Cex.Xo2 = Xo2; - Cex.Xso2 = Xso2; + /* Fluid composition */ + Ce.Xi*Ce.Q = Cs.Xi*Cs.Q + Cex.Xi*Cex.Q; + + Cs.Xi = X; + Cex.Xi = X; /* Flow reversal */ if continuous_flow_reversal then @@ -146,13 +123,14 @@ equation Cex.diff_on_1 = diffusion; /* Fluid thermodynamic properties at the inlet */ - proe = ThermoSysPro.Properties.Fluid.Ph(P, Ce.h, mode_e,fluid); - - /* Fluid thermodynamic properties at the saturation point */ - (lsat,vsat) = ThermoSysPro.Properties.Fluid.Water_sat_P(P,fluid); + state_e=Medium.setState_phX(p=P, h=Ce.h, X=Ce.Xi, region=mode_e); + xe = Medium.vapourQuality(state_e); /* Vapor mass fraction at the extraction outlet */ - x_ex = alpha*proe.x; + x_ex = alpha*xe; + + /* Fluid thermodynamic properties at the saturation point */ + sat = Medium.setSat_p(P); annotation ( Diagram(coordinateSystem( diff --git a/ThermoSysPro/Fluid/Machines/SteamEngine.mo b/ThermoSysPro/Fluid/Machines/SteamEngine.mo index 0c94597b..ce1d094d 100644 --- a/ThermoSysPro/Fluid/Machines/SteamEngine.mo +++ b/ThermoSysPro/Fluid/Machines/SteamEngine.mo @@ -3,7 +3,6 @@ model SteamEngine "Steam engine" extends ThermoSysPro.Fluid.Interfaces.IconColors; replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialTwoPhaseThermoSysProMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; parameter Real caract[:, 2]=[0, 0; 15e5, 20.0] "Engine charateristics Q=f(deltaP)"; From f9dbeed41b40d738fd79da5f74dd46c4edbe8e64 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Tue, 19 May 2026 09:18:08 +0200 Subject: [PATCH 162/178] #125 LumpedStraightPipe fixed after rebase --- ThermoSysPro/Fluid/PressureLosses/LumpedStraightPipe.mo | 4 ---- 1 file changed, 4 deletions(-) diff --git a/ThermoSysPro/Fluid/PressureLosses/LumpedStraightPipe.mo b/ThermoSysPro/Fluid/PressureLosses/LumpedStraightPipe.mo index c03f52e9..54439c4d 100644 --- a/ThermoSysPro/Fluid/PressureLosses/LumpedStraightPipe.mo +++ b/ThermoSysPro/Fluid/PressureLosses/LumpedStraightPipe.mo @@ -112,10 +112,6 @@ equation Pm = (C1.P + C2.P)/2; state = Medium.setState_phX(p=Pm, h=h, X=X); - state=Medium.setState_phX(p=Pm, h=h, X=X); - - state=Medium.setState_phX(p=Pm, h=h, X=X); - if (p_rho > 0) then rho = p_rho; else From 11b37781445988a3ff13a2a1154743f2d61c90d4 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Tue, 19 May 2026 10:06:24 +0200 Subject: [PATCH 163/178] #125 Boilers subpackage --- ThermoSysPro/Fluid/Boilers/BoilerSystem.mo | 18 +-- .../Fluid/Boilers/FossilFuelBoiler.mo | 109 +++++++++--------- .../Boilers/TestBoilerSystem.mo | 60 ++++++++++ .../Boilers/TestFossilFuelBoiler.mo | 77 +++++++++++++ .../SimpleExamples/Boilers/package.order | 2 + 5 files changed, 205 insertions(+), 61 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Boilers/TestBoilerSystem.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Boilers/TestFossilFuelBoiler.mo diff --git a/ThermoSysPro/Fluid/Boilers/BoilerSystem.mo b/ThermoSysPro/Fluid/Boilers/BoilerSystem.mo index 713891a7..6d76624d 100644 --- a/ThermoSysPro/Fluid/Boilers/BoilerSystem.mo +++ b/ThermoSysPro/Fluid/Boilers/BoilerSystem.mo @@ -1,10 +1,9 @@ within ThermoSysPro.Fluid.Boilers; model BoilerSystem "Boiler" - extends - ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FlueGasesFluidTypeParameterInterface; extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model for the water/steam side" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable package Medium_FlueGases = ThermoSysPro.Properties.Media.FlueGases constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model for the flue gases side" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Units.SI.Temperature Tsf=423.16 "Flue gases temperature at the outlet"; @@ -19,7 +18,6 @@ model BoilerSystem "Boiler" "Diffusion conductance for the water/steam side (active if diffusion=true in neighbouring volumes)"; parameter Boolean continuous_flow_reversal=false "true: continuous flow reversal - false: discontinuous flow reversal"; parameter Boolean diffusion=false "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; - parameter IF97Region region=IF97Region.All_regions "IF97 region (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); ThermoSysPro.Fluid.Combustion.BoundaryConditions.FuelSourcePQ Fuel( Xashes=0.011, @@ -36,6 +34,8 @@ model BoilerSystem "Boiler" annotation (Placement(transformation(extent={{-56,-10},{-36,10}}, rotation= 0))); ThermoSysPro.Fluid.Boilers.FossilFuelBoiler Boiler( + redeclare package Medium = Medium, + redeclare package Medium_FlueGases = Medium_FlueGases, Qsf(start=45.8744, fixed=false), Pee(fixed=false), Qe(fixed=false, start=6), @@ -59,15 +59,15 @@ model BoilerSystem "Boiler" origin={-10,0}, extent={{20,-20},{-20,20}}, rotation=270))); - Interfaces.Connectors.FluidInlet InletWaterSteam "Water inlet" annotation ( + Interfaces.Connectors.FluidInlet InletWaterSteam(redeclare package Medium = Medium) "Water inlet" annotation ( Placement(transformation(extent={{40,-110},{60,-90}}, rotation=0))); - Interfaces.Connectors.FluidOutlet OutletWaterSteam "Water/steam outlet" + Interfaces.Connectors.FluidOutlet OutletWaterSteam(redeclare package Medium = Medium) "Water/steam outlet" annotation (Placement(transformation(extent={{40,90},{60,110}}, rotation=0))); - Interfaces.Connectors.FluidOutlet OutletFlueGases "Flue gases outlet" + Interfaces.Connectors.FluidOutlet OutletFlueGases(redeclare package Medium = Medium_FlueGases) "Flue gases outlet" annotation (Placement( transformation(extent={{-80,90},{-60,110}}, rotation=0), iconTransformation(extent={{-80,90},{-60,110}}))); - Interfaces.Connectors.FluidInlet InletFlueGases "Flue gases inlet" + Interfaces.Connectors.FluidInlet InletFlueGases(redeclare package Medium = Medium_FlueGases) "Flue gases inlet" annotation (Placement( transformation(extent={{-80,-110},{-60,-90}}, rotation=0))); equation diff --git a/ThermoSysPro/Fluid/Boilers/FossilFuelBoiler.mo b/ThermoSysPro/Fluid/Boilers/FossilFuelBoiler.mo index 7642f228..17959c3d 100644 --- a/ThermoSysPro/Fluid/Boilers/FossilFuelBoiler.mo +++ b/ThermoSysPro/Fluid/Boilers/FossilFuelBoiler.mo @@ -1,10 +1,9 @@ within ThermoSysPro.Fluid.Boilers; model FossilFuelBoiler "Fossil fuel boiler" - extends - ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FlueGasesFluidTypeParameterInterface; extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model for the water/steam side" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable package Medium_FlueGases = ThermoSysPro.Properties.Media.FlueGases constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model for the flue gases side" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Units.SI.Temperature Tsf=400 "Flue gases temperature at the outlet"; parameter Integer Boiler_efficiency_type = 1 "1: Taking into account LHV only - 2: Using the total incoming power"; @@ -18,7 +17,6 @@ model FossilFuelBoiler "Fossil fuel boiler" "Diffusion conductance for the water/steam side (active if diffusion=true in neighbouring volumes)"; parameter Boolean continuous_flow_reversal=false "true: continuous flow reversal - false: discontinuous flow reversal"; parameter Boolean diffusion=false "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; - parameter IF97Region region=IF97Region.All_regions "IF97 region (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); protected constant Real amC=12.01115 "Carbon atomic mass"; @@ -29,7 +27,11 @@ protected constant Real amH2O = 2*amH + amO "H2O molecular mass"; constant Real amSO2 = amS + 2*amO "SO2 molecular mass"; constant Real teps=1e-6 "Small number"; - parameter Integer mode=Integer(region) - 1 "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; + parameter Integer iN2=ThermoSysPro.Properties.Media.Functions.findSubstanceIndex(Medium_FlueGases.substanceNames, {"N2", "Nitrogen", "nitrogen"}) "Index of nitrogen in the flue gases composition"; + parameter Integer iO2=ThermoSysPro.Properties.Media.Functions.findSubstanceIndex(Medium_FlueGases.substanceNames, {"O2", "Oxygen", "oxygen"}) "Index of oxygen in the flue gases composition"; + parameter Integer iH2O=ThermoSysPro.Properties.Media.Functions.findSubstanceIndex(Medium_FlueGases.substanceNames, {"H2O", "Water", "water"}) "Index of water vapor in the flue gases composition"; + parameter Integer iCO2=ThermoSysPro.Properties.Media.Functions.findSubstanceIndex(Medium_FlueGases.substanceNames, {"CO2", "Carbondioxide", "Carbon dioxide", "carbondioxide"}) "Index of carbon dioxide in the flue gases composition"; + parameter Integer iSO2=ThermoSysPro.Properties.Media.Functions.findSubstanceIndex(Medium_FlueGases.substanceNames, {"SO2", "Sulfurdioxide", "Sulfur dioxide", "sulfurdioxide"}) "Index of sulfur dioxide in the flue gases composition"; parameter Units.SI.MassFlowRate gamma0=1.e-4 "Pseudo-diffusion conductance use for continuous flow reversal (active if diffusion=false and continuous_flow_reversal = true)"; parameter Real eps=1.e-0 "Small number for pressure loss equation"; @@ -98,7 +100,6 @@ public Real exc(start=1) "Air combustion ratio"; Real exc_air(start=0.1) "Pertcentage of air in excess"; - FluidType fluids[2] "Fluids mixing in volume"; Units.SI.SpecificEnthalpy h(start=10e5) "Flue gases specific enthalpy"; Units.SI.Power Jair "Thermal power diffusion from inlet Cair"; Units.SI.Power Jfg "Thermal power diffusion from outlet Cfg"; @@ -107,44 +108,43 @@ public Units.SI.MassFlowRate gamma_fg "Diffusion conductance for outlet Cfg"; Real rair "Value of r(Q/gamma) for inlet Cair"; Real rfg "Value of r(Q/gamma) for outlet Cfg"; - FluidType ftype_ws "Water/steam fluid type"; - Integer fluid_ws=Integer(ftype_ws) "Water/steam fluid number"; + Medium.MassFraction Xws[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Water/steam mass fractions"; + Medium_FlueGases.MassFraction Xea[Medium_FlueGases.nX](start=Medium_FlueGases.X_default) "Air inlet mass fractions"; + Medium_FlueGases.MassFraction Xsf[Medium_FlueGases.nX](start=Medium_FlueGases.X_default) "Flue gases outlet mass fractions"; + Medium.ExtraProperty SubCws[Medium.nC](quantity=Medium.extraPropertiesNames, start=Medium.C_default) "Water/steam trace substances"; + Medium_FlueGases.ExtraProperty SubCfg[Medium_FlueGases.nC](quantity=Medium_FlueGases.extraPropertiesNames, start=Medium_FlueGases.C_default) "Flue gases trace substances"; + Medium.ThermodynamicState state_ws_m "Water/steam average thermodynamic state"; + Medium.ThermodynamicState state_ws_out "Water/steam outlet thermodynamic state"; + Medium_FlueGases.ThermodynamicState state_air_in "Air inlet thermodynamic state"; + Medium_FlueGases.ThermodynamicState state_fg_comb "Flue gases thermodynamic state after combustion"; + Medium_FlueGases.ThermodynamicState state_fg_out "Flue gases outlet thermodynamic state"; + Medium_FlueGases.ThermodynamicState state_fg_m "Flue gases average thermodynamic state"; public Interfaces.Connectors.FuelInlet Cfuel "Fuel inlet" annotation (Placement(transformation(extent={{-10,-90},{10,-70}}, rotation= 0))); - Interfaces.Connectors.FluidInlet Cair "Air inlet" + Interfaces.Connectors.FluidInlet Cair(redeclare package Medium = Medium_FlueGases) "Air inlet" annotation (Placement(transformation( extent={{-110,-72},{-90,-52}}, rotation=0))); - Interfaces.Connectors.FluidOutlet Cfg "Flue gases outlet" + Interfaces.Connectors.FluidOutlet Cfg(redeclare package Medium = Medium_FlueGases) "Flue gases outlet" annotation (Placement(transformation( extent={{90,-72},{110,-52}}, rotation=0))); public - Interfaces.Connectors.FluidInlet Cws1 "Water inlet" + Interfaces.Connectors.FluidInlet Cws1(redeclare package Medium = Medium) "Water inlet" annotation (Placement(transformation( extent={{-110,50},{-90,70}}, rotation=0))); - Interfaces.Connectors.FluidOutlet Cws2 "Water/steam outlet" + Interfaces.Connectors.FluidOutlet Cws2(redeclare package Medium = Medium) "Water/steam outlet" annotation (Placement(transformation( extent={{90,50},{110,70}}, rotation=0))); - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pros - annotation (Placement(transformation(extent={{-100,84},{-80,104}}, rotation= - 0))); - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph prom - annotation (Placement(transformation(extent={{80,84},{100,104}}, rotation=0))); equation - /* Check that incoming fluids are compatible with fluid in volume */ - fluids[1] = ftype; - fluids[2] = Cair.ftype; - - assert(ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.isCompatible(fluids), "InternalCombustionEngine: fluids mixing in volume are not compatible with each other"); + assert(Medium_FlueGases.nX > 1, "FossilFuelBoiler: Medium_FlueGases must be a gas mixture"); + assert(iN2 > 0 and iO2 > 0 and iH2O > 0 and iCO2 > 0 and iSO2 > 0, "FossilFuelBoiler: Medium_FlueGases.substanceNames must contain nitrogen, oxygen, water, carbon dioxide and sulfur dioxide"); // ---------------- // Water/steam side - assert((ftype_ws == FluidType.WaterSteam) or (ftype_ws == FluidType.WaterSteamSimple), "InternalCombustionEngine: the fluid type for the water/steam side must be water/steam"); - Cws1.Q = Cws2.Q; Cws1.h_vol_1 = Cws2.h_vol_1; @@ -156,14 +156,10 @@ equation Cws2.diff_res_1 = Cws1.diff_res_1 + (if (gamma_diff_ws > 0) then 1/gamma_diff_ws else 0); Cws1.diff_res_2 = Cws2.diff_res_2 + (if (gamma_diff_ws > 0) then 1/gamma_diff_ws else 0); - Cws1.ftype = Cws2.ftype; - - Cws1.Xco2 = Cws2.Xco2; - Cws1.Xh2o = Cws2.Xh2o; - Cws1.Xo2 = Cws2.Xo2; - Cws1.Xso2 = Cws2.Xso2; - - ftype_ws = Cws1.ftype; + Cws1.Xi = Cws2.Xi; + Xws = Cws1.Xi; + Cws1.SubC = Cws2.SubC; + SubCws = Cws1.SubC; Qe = Cws1.Q; @@ -191,10 +187,14 @@ equation Pea = Cair.P; Hea = Cair.h; - XeaCO2 = Cair.Xco2; - XeaH2O = Cair.Xh2o; - XeaO2 = Cair.Xo2; - XeaSO2 = Cair.Xso2; + Xea[1:Medium_FlueGases.nXi] = Cair.Xi; + if Medium_FlueGases.nXi < Medium_FlueGases.nX then + Xea[Medium_FlueGases.nX] = 1 - sum(Cair.Xi); + end if; + XeaCO2 = Xea[iCO2]; + XeaH2O = Xea[iH2O]; + XeaO2 = Xea[iO2]; + XeaSO2 = Xea[iSO2]; /* Flue gases outlet */ Qsf = Cfg.Q; @@ -237,12 +237,14 @@ equation 0 = Qea*XeaO2c - Qcomb*amO*(2*XCcomb/amC + 0.5*XHcomb/amH + 2*XScomb/amS) + Qcomb*XOcomb - Qsf*XsfO2; 0 = Qcomb*XScomb*amSO2/amS + Qea*XeaSO2 - Qsf*XsfSO2; - Cfg.ftype = ftype; - - Cfg.Xco2 = XsfCO2; - Cfg.Xh2o = XsfH2O; - Cfg.Xo2 = XsfO2; - Cfg.Xso2 = XsfSO2; + Xsf[iN2] = 1 - XsfCO2 - XsfH2O - XsfO2 - XsfSO2; + Xsf[iO2] = XsfO2; + Xsf[iH2O] = XsfH2O; + Xsf[iCO2] = XsfCO2; + Xsf[iSO2] = XsfSO2; + Cfg.Xi = Xsf[1:Medium_FlueGases.nXi]; + Qsf*Cfg.SubC = Qea*Cair.SubC; + SubCfg = Cfg.SubC; /* Combustion air ratio */ exc = Qea*(1 - XeaH2O) / ((Qcomb*amO*(2*XCcomb/amC + 0.5*XHcomb/amH + 2*XScomb/amS - XOcomb/amO)) / (XeaO2c/(1 - XeaH2O))); @@ -291,17 +293,20 @@ equation Cfg.diff_on_1 = diffusion; /* Air specific enthalpy at the inlet */ - Hea = ThermoSysPro.Properties.FlueGases.FlueGases_h(Pea, Tea, XeaCO2, XeaH2O, XeaO2c, XeaSO2); + state_air_in = Medium_FlueGases.setState_phX(p=Pea, h=Hea, X=Xea); + Tea = Medium_FlueGases.temperature(state_air_in); /* Flue gases tempretaure after combustion */ - // Changed from FlueGases_T to FlueGases_h to provide a differentiable function - Hf = ThermoSysPro.Properties.FlueGases.FlueGases_h(Pea, Tf, XsfCO2, XsfH2O, XsfO2, XsfSO2); + Hf = Medium_FlueGases.specificEnthalpy_pTX(p=Pea, T=Tf, X=Xsf); + state_fg_comb = Medium_FlueGases.setState_phX(p=Pea, h=Hf, X=Xsf); /* Flue gases specific enthalpy at the outlet */ - Hsf = ThermoSysPro.Properties.FlueGases.FlueGases_h(Psf, Tsf, XsfCO2, XsfH2O, XsfO2, XsfSO2); + Hsf = Medium_FlueGases.specificEnthalpy_pTX(p=Psf, T=Tsf, X=Xsf); + state_fg_out = Medium_FlueGases.setState_phX(p=Psf, h=Hsf, X=Xsf); /* Flue gases density */ - rhof = ThermoSysPro.Properties.FlueGases.FlueGases_rho(Pea, (Tea + Tf)/2, XsfCO2, XsfH2O, XsfO2, XsfSO2); + state_fg_m = Medium_FlueGases.setState_pTX(p=Pea, T=(Tea + Tf)/2, X=Xsf); + rhof = Medium_FlueGases.density(state_fg_m); 0 = if (XeaO2 > teps) then (XeaO2c - XeaO2) else (XeaO2c - teps); @@ -311,11 +316,11 @@ equation Hrfum = 2501.569e3*XsfH2O; /* Water/steam thermodynamic properties */ - prom = ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph((Pee + Pse)/2, (Hee + Hse)/2, mode); - rhoe = prom.d; + state_ws_m = Medium.setState_phX(p=(Pee + Pse)/2, h=(Hee + Hse)/2, X=Xws); + rhoe = Medium.density(state_ws_m); - pros = ThermoSysPro.Properties.WaterSteam.IF97.Water_Ph(Pse, Hse, mode); - Tse = pros.T; + state_ws_out = Medium.setState_phX(p=Pse, h=Hse, X=Xws); + Tse = Medium.temperature(state_ws_out); annotation ( Icon(graphics={ Rectangle( diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Boilers/TestBoilerSystem.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Boilers/TestBoilerSystem.mo new file mode 100644 index 00000000..bede404b --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Boilers/TestBoilerSystem.mo @@ -0,0 +1,60 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Boilers; +model TestBoilerSystem + extends ThermoSysPro.UsersGuide.Icons.Example; + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; + replaceable package Medium_FlueGases = ThermoSysPro.Properties.Media.FlueGases; + + ThermoSysPro.Fluid.Boilers.BoilerSystem boilerSystem( + redeclare package Medium = Medium, + redeclare package Medium_FlueGases = Medium_FlueGases, + Wloss=0, + Ke=1.e6, + Tsf=386.16) + annotation (Placement(transformation(extent={{-28,-40},{28,40}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceFlueGases( + redeclare package Medium = Medium_FlueGases, + Q0=27, + T0=298.16, + option_temperature=true, + X0={0.757,0.233,0.01,0,0}) + annotation (Placement(transformation(extent={{-84,-58},{-48,-22}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkFlueGases( + redeclare package Medium = Medium_FlueGases, + P0=100000, + T0=386.16, + option_temperature=true) + annotation (Placement(transformation(extent={{-34,74},{2,110}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourceWaterSteam( + redeclare package Medium = Medium, + P0=140e5, + Q0=24, + h0=600e3) + annotation (Placement(transformation(extent={{54,-80},{90,-44}}, rotation=180, + origin={132,-126}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sinkWaterSteam(redeclare package Medium = Medium) + annotation (Placement(transformation(extent={{54,44},{90,80}}, rotation=180, + origin={90,148}))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss inletPressureLoss( + redeclare package Medium = Medium, + K=1e-3, + rho(start=932.96)) + annotation (Placement(transformation(extent={{34,-66},{42,-58}}, rotation=90, + origin={-38,-94}))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss outletPressureLoss( + redeclare package Medium = Medium, + K=1e-3, + rho(start=29.77)) + annotation (Placement(transformation(extent={{34,58},{42,66}}, rotation=90, + origin={112,14}))); +equation + connect(sourceFlueGases.C, boilerSystem.InletFlueGases) annotation (Line(points={{-48,-40},{-24,-40}}, color={0,0,0})); + connect(boilerSystem.OutletFlueGases, sinkFlueGases.C) annotation (Line(points={{-24,40},{-40,40},{-40,92},{-34,92}}, color={0,0,0})); + connect(sourceWaterSteam.C, inletPressureLoss.C1) annotation (Line(points={{42,-64},{24,-64},{24,-60}}, + color={0,0,255})); + connect(inletPressureLoss.C2, boilerSystem.InletWaterSteam) annotation (Line(points={{24,-52},{24,-40}}, color={0,0,255})); + connect(boilerSystem.OutletWaterSteam, outletPressureLoss.C1) annotation (Line(points={{24,40},{48,40},{48,44},{50,44},{50,48}}, + color={0,0,255})); + connect(outletPressureLoss.C2, sinkWaterSteam.C) annotation (Line(points={{50,56},{50,86},{36,86}}, + color={0,0,255})); + annotation (experiment(StopTime=1)); +end TestBoilerSystem; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Boilers/TestFossilFuelBoiler.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Boilers/TestFossilFuelBoiler.mo new file mode 100644 index 00000000..c9928e94 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Boilers/TestFossilFuelBoiler.mo @@ -0,0 +1,77 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Boilers; +model TestFossilFuelBoiler + extends ThermoSysPro.UsersGuide.Icons.Example; + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; + replaceable package Medium_FlueGases = ThermoSysPro.Properties.Media.FlueGases; + + ThermoSysPro.Fluid.Boilers.FossilFuelBoiler fossilFuelBoiler( + redeclare package Medium = Medium, + redeclare package Medium_FlueGases = Medium_FlueGases, + Wloss=0, + Ke=1.e6, + Tsf=386.16, + Tea(start=298.16), + Tf(start=2138.32), + deltaPe(start=4028755.6), + rhof(start=0.2733)) + annotation (Placement(transformation(extent={{-45,-51},{45,51}}, rotation=0))); + ThermoSysPro.Fluid.Combustion.BoundaryConditions.FuelSourcePQ fuelSourcePQ( + Xashes=0.011, + rho=1000, + Hum=0.50, + Xc=0.2479, + Xh=0.0297, + Xo=0.2088, + Xn=0.0017, + Xs=0.0003, + LHV=1.5e7, + Q0=0.0407331, + T0=294.45) + annotation (Placement(transformation(extent={{-36,-78},{0,-41}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceFlueGases( + redeclare package Medium = Medium_FlueGases, + Q0=27, + T0=298.16, + option_temperature=true, + X0={0.757,0.233,0.01,0,0}) + annotation (Placement(transformation(extent={{-110,-50},{-71,-13}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkFlueGases( + redeclare package Medium = Medium_FlueGases, + P0=100000, + T0=386.16, + option_temperature=true) + annotation (Placement(transformation(extent={{68,-51},{110,-12}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourceWaterSteam( + redeclare package Medium = Medium, + P0=140e5, + Q0=24, + h0=600e3) + annotation (Placement(transformation(extent={{-107,14},{-71,48}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sinkWaterSteam(redeclare package Medium = Medium) + annotation (Placement(transformation(extent={{74,13},{110,49}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss inletPressureLoss( + redeclare package Medium = Medium, + K=1e-3, + rho(start=932.96)) + annotation (Placement(transformation(extent={{-64,25},{-56,37}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss outletPressureLoss( + redeclare package Medium = Medium, + K=1e-3, + rho(start=29.77)) + annotation (Placement(transformation(extent={{57,25},{65,37}}, rotation=0))); +equation + connect(sourceFlueGases.C, fossilFuelBoiler.Cair) annotation (Line( + points={{-71,-31.5},{-63.5,-31.5},{-63.5,-31.62},{-45,-31.62}}, + color={0,0,0}, + thickness=1)); + connect(fossilFuelBoiler.Cfg, sinkFlueGases.C) annotation (Line( + points={{45,-31.62},{62,-31.62},{62,-31.5},{68,-31.5}}, + color={0,0,0}, + thickness=1)); + connect(fuelSourcePQ.C, fossilFuelBoiler.Cfuel) annotation (Line(points={{0,-59.5},{0,-40.8}}, color={0,0,0})); + connect(sourceWaterSteam.C, inletPressureLoss.C1) annotation (Line(points={{-71,31},{-64,31}}, color={0,0,255})); + connect(inletPressureLoss.C2, fossilFuelBoiler.Cws1) annotation (Line(points={{-56,31},{-50,31},{-50,30.6},{-45,30.6}}, color={0,0,255})); + connect(fossilFuelBoiler.Cws2, outletPressureLoss.C1) annotation (Line(points={{45,30.6},{51,30.6},{51,31},{57,31}}, color={0,0,255})); + connect(outletPressureLoss.C2, sinkWaterSteam.C) annotation (Line(points={{65,31},{74,31}}, color={0,0,255})); + annotation (experiment(StopTime=1)); +end TestFossilFuelBoiler; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Boilers/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/Boilers/package.order index e69de29b..5d6f590f 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Boilers/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Boilers/package.order @@ -0,0 +1,2 @@ +TestFossilFuelBoiler +TestBoilerSystem From 2040b69e3473287d7269adb43654f9e8f6bc332a Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Tue, 19 May 2026 13:15:56 +0200 Subject: [PATCH 164/178] #125 Combustion chambers with examples --- .../CombustionChambers/GTCombustionChamber.mo | 90 ++++++++------ .../CombustionChambers/GenericCombustion.mo | 81 ++++++------ .../CombustionChambers/GenericCombustion1D.mo | 81 ++++++------ .../CombustionChambers/GridFurnace.mo | 88 ++++++++------ .../CombustionChambers/PostCombustionGas.mo | 72 ++++++----- .../Combustion/TestGTCombustionChamber.mo | 49 ++++++++ .../Combustion/TestGenericCombustion.mo | 49 ++++++++ .../Combustion/TestGenericCombustion1D.mo | 27 ++++ .../TestGenericCombustion1DWithPipe.mo | 115 ++++++++++++++++++ .../Combustion/TestGridFurnace.mo | 73 +++++++++++ .../Combustion/TestPostCombustionGas.mo | 67 ++++++++++ .../SimpleExamples/Combustion/package.order | 6 + .../TestFixedPowerHeatExchanger.mo | 38 ++---- .../TestFixedPowerHeatExchanger_Traces.mo | 50 ++------ 14 files changed, 638 insertions(+), 248 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Combustion/TestGTCombustionChamber.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Combustion/TestGenericCombustion.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Combustion/TestGenericCombustion1D.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Combustion/TestGenericCombustion1DWithPipe.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Combustion/TestGridFurnace.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Combustion/TestPostCombustionGas.mo diff --git a/ThermoSysPro/Fluid/Combustion/CombustionChambers/GTCombustionChamber.mo b/ThermoSysPro/Fluid/Combustion/CombustionChambers/GTCombustionChamber.mo index 62a05a60..7cca4a70 100644 --- a/ThermoSysPro/Fluid/Combustion/CombustionChambers/GTCombustionChamber.mo +++ b/ThermoSysPro/Fluid/Combustion/CombustionChambers/GTCombustionChamber.mo @@ -1,10 +1,9 @@ within ThermoSysPro.Fluid.Combustion.CombustionChambers; model GTCombustionChamber "Gas turbine combustion chamber" - extends - ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FlueGasesFluidTypeParameterInterface; extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model for the water/steam side" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable package Medium_FlueGases = ThermoSysPro.Properties.Media.FlueGases constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model for the flue gases side" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Real kcham=1 "Pressure loss coefficient in the combustion chamber"; parameter Units.SI.Area Acham=1 "Average cross-sectional area of the combustion chamber"; @@ -28,6 +27,11 @@ protected constant Real amCO2 = amC + 2*amO "CO2 molecular mass"; constant Real amH2O = 2*amH + amO "H2O molecular mass"; constant Real amSO2 = amS + 2*amO "SO2 molecular mass"; + parameter Integer iN2=ThermoSysPro.Properties.Media.Functions.findSubstanceIndex(Medium_FlueGases.substanceNames, {"N2", "Nitrogen", "nitrogen"}) "Index of nitrogen in the flue gases composition"; + parameter Integer iO2=ThermoSysPro.Properties.Media.Functions.findSubstanceIndex(Medium_FlueGases.substanceNames, {"O2", "Oxygen", "oxygen"}) "Index of oxygen in the flue gases composition"; + parameter Integer iH2O=ThermoSysPro.Properties.Media.Functions.findSubstanceIndex(Medium_FlueGases.substanceNames, {"H2O", "Water", "water"}) "Index of water vapor in the flue gases composition"; + parameter Integer iCO2=ThermoSysPro.Properties.Media.Functions.findSubstanceIndex(Medium_FlueGases.substanceNames, {"CO2", "Carbondioxide", "Carbon dioxide", "carbondioxide"}) "Index of carbon dioxide in the flue gases composition"; + parameter Integer iSO2=ThermoSysPro.Properties.Media.Functions.findSubstanceIndex(Medium_FlueGases.substanceNames, {"SO2", "Sulfurdioxide", "Sulfur dioxide", "sulfurdioxide"}) "Index of sulfur dioxide in the flue gases composition"; parameter Units.SI.MassFlowRate gamma0=1.e-4 "Pseudo-diffusion conductance use for continuous flow reversal (active if diffusion=false and continuous_flow_reversal = true)"; @@ -84,7 +88,6 @@ public Units.SI.Area Achamc(start=1) "Intermediate variable for the computation of the average corss-section aera of the combusion chamber"; Real XeaO2c(start=0.2) "Intermediate variable for the computation of the O2 mass fraction"; Units.SI.SpecificEnthalpy h(start=10e5) "Fluid specific enthalpy"; - FluidType fluids[3] "Fluids mixing in volume"; Units.SI.Power Ja "Thermal power diffusion from inlet Ca"; Units.SI.Power Jws "Thermal power diffusion from inlet Cws"; Units.SI.Power Jfg "Thermal power diffusion from outlet Cfg"; @@ -95,30 +98,31 @@ public Real ra "Value of r(Q/gamma) for inlet Ca"; Real rws "Value of r(Q/gamma) for inlet Cws"; Real rfg "Value of r(Q/gamma) for outlet Cfg"; - FluidType ftype_ws "Water/steam fluid type"; - Integer fluid_ws=Integer(ftype_ws) "Water/steam fluid number"; + Medium.MassFraction Xws[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Water/steam mass fractions"; + Medium_FlueGases.MassFraction Xea[Medium_FlueGases.nX](start=Medium_FlueGases.X_default) "Air inlet mass fractions"; + Medium_FlueGases.MassFraction Xsf[Medium_FlueGases.nX](start=Medium_FlueGases.X_default) "Flue gases outlet mass fractions"; + Medium.ExtraProperty SubCws[Medium.nC](quantity=Medium.extraPropertiesNames, start=Medium.C_default) "Water/steam trace substances"; + Medium_FlueGases.ExtraProperty SubCfg[Medium_FlueGases.nC](quantity=Medium_FlueGases.extraPropertiesNames, start=Medium_FlueGases.C_default) "Flue gases trace substances"; + Medium_FlueGases.ThermodynamicState state_air_in "Air inlet thermodynamic state"; + Medium_FlueGases.ThermodynamicState state_fg_out "Flue gases outlet thermodynamic state"; + Medium_FlueGases.ThermodynamicState state_atom_in "Atomisation compressor inlet state"; public ThermoSysPro.Fluid.Interfaces.Connectors.FuelInlet Cfuel "Fuel inlet" annotation (Placement(transformation(extent={{-10,-100},{10,-80}}, rotation= 0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ca "Air inlet" + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ca(redeclare package Medium = Medium_FlueGases) "Air inlet" annotation (Placement(transformation(extent={{-100,-10},{-80,10}}, rotation= 0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cfg "Flue gases outlet" + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cfg(redeclare package Medium = Medium_FlueGases) "Flue gases outlet" annotation (Placement(transformation(extent={{80,-10},{100,10}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Cws "Water/steam inlet" + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Cws(redeclare package Medium = Medium) "Water/steam inlet" annotation (Placement(transformation(extent={{-70,80},{-50,100}}, rotation= 0))); equation - /* Check that incoming fluids are compatible with fluid in volume */ - fluids[1] = ftype; - fluids[2] = Ca.ftype; - fluids[3] = Cfg.ftype; - - assert(ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.isCompatible(fluids), - "GenericCombustion1D: fluids mixing in volume are not compatible with each other"); + assert(Medium_FlueGases.nX > 1, "GTCombustionChamber: Medium_FlueGases must be a gas mixture"); + assert(iN2 > 0 and iO2 > 0 and iH2O > 0 and iCO2 > 0 and iSO2 > 0, "GTCombustionChamber: Medium_FlueGases.substanceNames must contain nitrogen, oxygen, water, carbon dioxide and sulfur dioxide"); /* Fuel inlet */ Qfuel = Cfuel.Q; @@ -131,36 +135,33 @@ equation Cpfuel = Cfuel.cp; /* Water inlet */ - assert((ftype_ws == FluidType.WaterSteam) or (ftype_ws == FluidType.WaterSteamSimple), "GenericCombustion: the fluid type for the water/steam inlet must be water/steam"); - Cws.diff_res_2 = 0; Cws.diff_on_2 = diffusion; - ftype_ws = Cws.ftype; - Qews = Cws.Q; Hews = Cws.h; + Xws = Cws.Xi; + SubCws = Cws.SubC; /* Air inlet */ Qea = Ca.Q; Pea = Ca.P; Hea = Ca.h; - XeaCO2 = Ca.Xco2; - XeaH2O = Ca.Xh2o; - XeaO2 = Ca.Xo2; - XeaSO2 = Ca.Xso2; + Xea[1:Medium_FlueGases.nXi] = Ca.Xi; + if Medium_FlueGases.nXi < Medium_FlueGases.nX then + Xea[Medium_FlueGases.nX] = 1 - sum(Ca.Xi); + end if; + XeaCO2 = Xea[iCO2]; + XeaH2O = Xea[iH2O]; + XeaO2 = Xea[iO2]; + XeaSO2 = Xea[iSO2]; /* Flue gases outlet */ Qsf = Cfg.Q; Psf = Cfg.P; Hsf = Cfg.h; - XsfCO2 = Cfg.Xco2; - XsfH2O = Cfg.Xh2o; - XsfO2 = Cfg.Xo2; - XsfSO2 = Cfg.Xso2; - /* Mass balance equation */ 0 = Qea + Qews + Qfuel - Qsf; @@ -191,8 +192,6 @@ equation Ca.h_vol_2 = h; Cfg.h_vol_1 = h; - Cfg.ftype = ftype; - /* No flow reversal */ Cfg.h = Cfg.h_vol_1; @@ -233,11 +232,13 @@ equation /* Specific enthalpy and entropy at the inlet of the atomisation compressor */ if air_atomisation then - Hecpat = ThermoSysPro.Properties.FlueGases.FlueGases_h(Pecpat, Tecpat, XeaCO2, XeaH2O, XeaO2c, XeaSO2); - Secpat = ThermoSysPro.Properties.FlueGases.FlueGases_s(Pecpat, Tecpat, XeaCO2, XeaH2O, XeaO2c, XeaSO2); - Hiscpat = ThermoSysPro.Properties.FlueGases.FlueGases_h_Ps(Pscpat, Secpat, XeaCO2, XeaH2O, XeaO2c, XeaSO2); + Hecpat = Medium_FlueGases.specificEnthalpy_pTX(p=Pecpat, T=Tecpat, X=Xea); + state_atom_in = Medium_FlueGases.setState_pTX(p=Pecpat, T=Tecpat, X=Xea); + Secpat = Medium_FlueGases.specificEntropy(state_atom_in); + Hiscpat = Medium_FlueGases.isentropicEnthalpy(p_downstream=Pscpat, refState=state_atom_in); else Hecpat = 60000; + state_atom_in = Medium_FlueGases.setState_pTX(p=Pecpat, T=Tecpat, X=Xea); Secpat = -2000; Hiscpat = 60000; end if; @@ -249,17 +250,19 @@ equation Hrfg = 2501.569e3*XsfH2O; /* Air specific enthalpy at the inlet */ - Hea = ThermoSysPro.Properties.FlueGases.FlueGases_h(Pea, Tea, XeaCO2, XeaH2O, XeaO2c, XeaSO2); + Hea = Medium_FlueGases.specificEnthalpy_pTX(p=Pea, T=Tea, X=Xea); + state_air_in = Medium_FlueGases.setState_pTX(p=Pea, T=Tea, X=Xea); /* Flue gases specific enthalpy at the outlet */ - Hsf = ThermoSysPro.Properties.FlueGases.FlueGases_h(Psf, Tsf, XsfCO2, XsfH2O, XsfO2, XsfSO2); + Hsf = Medium_FlueGases.specificEnthalpy_pTX(p=Psf, T=Tsf, X=Xsf); + state_fg_out = Medium_FlueGases.setState_pTX(p=Psf, T=Tsf, X=Xsf); /* Air density at the inlet */ - rhoea = ThermoSysPro.Properties.FlueGases.FlueGases_rho(Pea, Tea, XeaCO2, XeaH2O, XeaO2c, XeaSO2); + rhoea = Medium_FlueGases.density(state_air_in); Vea = if (rhoea > 0.001) then 1/rhoea else 1/1.1; /* Flue gases density at the outlet */ - rhosf = ThermoSysPro.Properties.FlueGases.FlueGases_rho(Psf, Tsf, XsfCO2, XsfH2O, XsfO2, XsfSO2); + rhosf = Medium_FlueGases.density(state_fg_out); Vsf = if (rhosf > 0.001) then 1/rhosf else 1/0.1; 0 = if (eta_is > eps_a) then (eta_isc - eta_is) else (eta_isc - eps_a); @@ -278,6 +281,15 @@ equation /* SO2 flue gases mass fraction */ XsfSO2*(Qea + Qews + Qfuel) = (Qea*XeaSO2) + (Qfuel*XSfuel*amSO2/amS); + Xsf[iN2] = 1 - XsfCO2 - XsfH2O - XsfO2 - XsfSO2; + Xsf[iO2] = XsfO2; + Xsf[iH2O] = XsfH2O; + Xsf[iCO2] = XsfCO2; + Xsf[iSO2] = XsfSO2; + Cfg.Xi = Xsf[1:Medium_FlueGases.nXi]; + Cfg.SubC = Ca.SubC; + SubCfg = Cfg.SubC; + /* Fuel thermal power */ Wfuel = Qfuel*LHVfuel; diff --git a/ThermoSysPro/Fluid/Combustion/CombustionChambers/GenericCombustion.mo b/ThermoSysPro/Fluid/Combustion/CombustionChambers/GenericCombustion.mo index 461c5b93..bd708dd3 100644 --- a/ThermoSysPro/Fluid/Combustion/CombustionChambers/GenericCombustion.mo +++ b/ThermoSysPro/Fluid/Combustion/CombustionChambers/GenericCombustion.mo @@ -1,10 +1,9 @@ within ThermoSysPro.Fluid.Combustion.CombustionChambers; model GenericCombustion "Generic combustion chamber" - extends - ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FlueGasesFluidTypeParameterInterface; extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model for the water/steam side" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable package Medium_FlueGases = ThermoSysPro.Properties.Media.FlueGases constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model for the flue gases side" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter ThermoSysPro.Units.xSI.PressureLossCoefficient kcham=1 "Pressure loss coefficient in the combustion chamber"; parameter Units.SI.Area Acham=1 "Average corss-sectional area of the combusiton chamber"; @@ -25,6 +24,11 @@ protected constant Real amCO2=amC + 2*amO "CO2 molecular mass"; constant Real amH2O=2*amH + amO "H2O molecular mass"; constant Real amSO2=amS + 2*amO "SO2 molecular mass"; + parameter Integer iN2=ThermoSysPro.Properties.Media.Functions.findSubstanceIndex(Medium_FlueGases.substanceNames, {"N2", "Nitrogen", "nitrogen"}) "Index of nitrogen in the flue gases composition"; + parameter Integer iO2=ThermoSysPro.Properties.Media.Functions.findSubstanceIndex(Medium_FlueGases.substanceNames, {"O2", "Oxygen", "oxygen"}) "Index of oxygen in the flue gases composition"; + parameter Integer iH2O=ThermoSysPro.Properties.Media.Functions.findSubstanceIndex(Medium_FlueGases.substanceNames, {"H2O", "Water", "water"}) "Index of water vapor in the flue gases composition"; + parameter Integer iCO2=ThermoSysPro.Properties.Media.Functions.findSubstanceIndex(Medium_FlueGases.substanceNames, {"CO2", "Carbondioxide", "Carbon dioxide", "carbondioxide"}) "Index of carbon dioxide in the flue gases composition"; + parameter Integer iSO2=ThermoSysPro.Properties.Media.Functions.findSubstanceIndex(Medium_FlueGases.substanceNames, {"SO2", "Sulfurdioxide", "Sulfur dioxide", "sulfurdioxide"}) "Index of sulfur dioxide in the flue gases composition"; parameter Units.SI.MassFlowRate gamma0=1.e-4 "Pseudo-diffusion conductance use for continuous flow reversal (active if diffusion=false and continuous_flow_reversal = true)"; @@ -82,7 +86,6 @@ public Real Vccbm(start=0.001) "Average volume mass in the combustion chamber"; Units.SI.Velocity v(start=100) "Flue gases reference velocity in the combusiton chamber"; Units.SI.SpecificEnthalpy h(start=10e5) "Fluid specific enthalpy"; - FluidType fluids[3] "Fluids mixing in volume"; Units.SI.Power Ja "Thermal power diffusion from inlet Ca"; Units.SI.Power Jws "Thermal power diffusion from inlet Cws"; Units.SI.Power Jfg "Thermal power diffusion from outlet Cfg"; @@ -93,30 +96,30 @@ public Real ra "Value of r(Q/gamma) for inlet Ca"; Real rws "Value of r(Q/gamma) for inlet Cws"; Real rfg "Value of r(Q/gamma) for outlet Cfg"; - FluidType ftype_ws "Water/steam fluid type"; - Integer fluid_ws=Integer(ftype_ws) "Water/steam fluid number"; + Medium.MassFraction Xws[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Water/steam mass fractions"; + Medium_FlueGases.MassFraction Xea[Medium_FlueGases.nX](start=Medium_FlueGases.X_default) "Air inlet mass fractions"; + Medium_FlueGases.MassFraction Xsf[Medium_FlueGases.nX](start=Medium_FlueGases.X_default) "Flue gases outlet mass fractions"; + Medium.ExtraProperty SubCws[Medium.nC](quantity=Medium.extraPropertiesNames, start=Medium.C_default) "Water/steam trace substances"; + Medium_FlueGases.ExtraProperty SubCfg[Medium_FlueGases.nC](quantity=Medium_FlueGases.extraPropertiesNames, start=Medium_FlueGases.C_default) "Flue gases trace substances"; + Medium_FlueGases.ThermodynamicState state_air_in "Air inlet thermodynamic state"; + Medium_FlueGases.ThermodynamicState state_fg_out "Flue gases outlet thermodynamic state"; public ThermoSysPro.Fluid.Interfaces.Connectors.FuelInlet Cfuel "Fuel inlet" annotation (Placement(transformation(extent={{60,-100},{80,-80}}, rotation= 0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ca "Air inlet" + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ca(redeclare package Medium = Medium_FlueGases) "Air inlet" annotation (Placement(transformation(extent={{-40,-100},{-20,-80}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cfg "Flue gases outlet" + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cfg(redeclare package Medium = Medium_FlueGases) "Flue gases outlet" annotation (Placement(transformation(extent={{-40,80},{-20,100}}, rotation= 0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Cws "Water/steam inlet" + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Cws(redeclare package Medium = Medium) "Water/steam inlet" annotation (Placement(transformation(extent={{-100,0},{-80,20}}, rotation=0))); equation - /* Check that incoming fluids are compatible with fluid in volume */ - fluids[1] = ftype; - fluids[2] = Ca.ftype; - fluids[3] = Cfg.ftype; - - assert(ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.isCompatible(fluids), - "GenericCombustion1D: fluids mixing in volume are not compatible with each other"); + assert(Medium_FlueGases.nX > 1, "GenericCombustion: Medium_FlueGases must be a gas mixture"); + assert(iN2 > 0 and iO2 > 0 and iH2O > 0 and iCO2 > 0 and iSO2 > 0, "GenericCombustion: Medium_FlueGases.substanceNames must contain nitrogen, oxygen, water, carbon dioxide and sulfur dioxide"); /* Fuel inlet */ Qfuel = Cfuel.Q; @@ -133,36 +136,33 @@ equation Cpfuel = Cfuel.cp; /* Water inlet */ - assert((ftype_ws == FluidType.WaterSteam) or (ftype_ws == FluidType.WaterSteamSimple), "GenericCombustion: the fluid type for the water/steam inlet must be water/steam"); - Cws.diff_res_2 = 0; Cws.diff_on_2 = diffusion; - ftype_ws = Cws.ftype; - Qews = Cws.Q; Hews = Cws.h; + Xws = Cws.Xi; + SubCws = Cws.SubC; /* Air inlet */ Qea = Ca.Q; Pea = Ca.P; Hea = Ca.h; - XeaCO2 = Ca.Xco2; - XeaH2O = Ca.Xh2o; - XeaO2 = Ca.Xo2; - XeaSO2 = Ca.Xso2; + Xea[1:Medium_FlueGases.nXi] = Ca.Xi; + if Medium_FlueGases.nXi < Medium_FlueGases.nX then + Xea[Medium_FlueGases.nX] = 1 - sum(Ca.Xi); + end if; + XeaCO2 = Xea[iCO2]; + XeaH2O = Xea[iH2O]; + XeaO2 = Xea[iO2]; + XeaSO2 = Xea[iSO2]; /* Flue gases outlet */ Qsf = Cfg.Q; Psf = Cfg.P; Hsf = Cfg.h; - XsfCO2 = Cfg.Xco2; - XsfH2O = Cfg.Xh2o; - XsfO2 = Cfg.Xo2; - XsfSO2 = Cfg.Xso2; - /* Mass balance equation */ 0 = Qea + Qews + Qfuel*(1 - XCDfuel) - Qcv*ImbCV - Qbf*ImbBF - Qsf; @@ -181,8 +181,6 @@ equation Ca.h_vol_2 = h; Cfg.h_vol_1 = h; - Cfg.ftype = ftype; - /* No flow reversal */ Cfg.h = Cfg.h_vol_1; @@ -229,17 +227,19 @@ equation Hrcd = 0; /* Air specific enthalpy at the inlet */ - Hea = ThermoSysPro.Properties.FlueGases.FlueGases_h(Pea, Tea, XeaCO2, XeaH2O, XeaO2, XeaSO2); + Hea = Medium_FlueGases.specificEnthalpy_pTX(p=Pea, T=Tea, X=Xea); + state_air_in = Medium_FlueGases.setState_pTX(p=Pea, T=Tea, X=Xea); /* Flue gases specific enthalpy at the outlet */ - Hsf = ThermoSysPro.Properties.FlueGases.FlueGases_h(Psf, Tsf, XsfCO2, XsfH2O, XsfO2, XsfSO2); + Hsf = Medium_FlueGases.specificEnthalpy_pTX(p=Psf, T=Tsf, X=Xsf); + state_fg_out = Medium_FlueGases.setState_pTX(p=Psf, T=Tsf, X=Xsf); /* Air density at the inlet */ - rhoea = ThermoSysPro.Properties.FlueGases.FlueGases_rho(Pea, Tea, XeaCO2, XeaH2O, XeaO2, XeaSO2); + rhoea = Medium_FlueGases.density(state_air_in); Vea = if (rhoea > 0.001) then 1/rhoea else 1/1.1; /* Flue gases density at the outlet */ - rhosf = ThermoSysPro.Properties.FlueGases.FlueGases_rho(Psf, Tsf, XsfCO2, XsfH2O, XsfO2, XsfSO2); + rhosf = Medium_FlueGases.density(state_fg_out); Vsf = if (rhosf > 0.001) then 1/rhosf else 1/0.1; /* CO2 flue gases mass fraction */ @@ -254,6 +254,15 @@ equation /* SO2 flue gases mass fraction */ XsfSO2*Qsf = (Qea*XeaSO2) + (Qfuel*XSfuel*amSO2/amS); + Xsf[iN2] = 1 - XsfCO2 - XsfH2O - XsfO2 - XsfSO2; + Xsf[iO2] = XsfO2; + Xsf[iH2O] = XsfH2O; + Xsf[iCO2] = XsfCO2; + Xsf[iSO2] = XsfSO2; + Cfg.Xi = Xsf[1:Medium_FlueGases.nXi]; + Cfg.SubC = Ca.SubC; + SubCfg = Cfg.SubC; + /* Fuel thermal power */ HHVfuel = LHVfuel + 224.3e5*XHfuel + 25.1e5*Xwfuel; Wfuel = Qfuel*HHVfuel; diff --git a/ThermoSysPro/Fluid/Combustion/CombustionChambers/GenericCombustion1D.mo b/ThermoSysPro/Fluid/Combustion/CombustionChambers/GenericCombustion1D.mo index 1e4270db..5643856c 100644 --- a/ThermoSysPro/Fluid/Combustion/CombustionChambers/GenericCombustion1D.mo +++ b/ThermoSysPro/Fluid/Combustion/CombustionChambers/GenericCombustion1D.mo @@ -1,10 +1,9 @@ within ThermoSysPro.Fluid.Combustion.CombustionChambers; model GenericCombustion1D "Generic combustion chamber 1D" - extends - ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FlueGasesFluidTypeParameterInterface; extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model for the water/steam side" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable package Medium_FlueGases = ThermoSysPro.Properties.Media.FlueGases constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model for the flue gases side" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Integer NCEL = 7; parameter Units.SI.Area Acham=1 "Average cross-sectional area of the combustion chamber"; @@ -34,6 +33,11 @@ protected constant Real amCO2 = amC + 2*amO "CO2 molecular mass"; constant Real amH2O = 2*amH + amO "H2O molecular mass"; constant Real amSO2 = amS + 2*amO "SO2 molecular mass"; + parameter Integer iN2=ThermoSysPro.Properties.Media.Functions.findSubstanceIndex(Medium_FlueGases.substanceNames, {"N2", "Nitrogen", "nitrogen"}) "Index of nitrogen in the flue gases composition"; + parameter Integer iO2=ThermoSysPro.Properties.Media.Functions.findSubstanceIndex(Medium_FlueGases.substanceNames, {"O2", "Oxygen", "oxygen"}) "Index of oxygen in the flue gases composition"; + parameter Integer iH2O=ThermoSysPro.Properties.Media.Functions.findSubstanceIndex(Medium_FlueGases.substanceNames, {"H2O", "Water", "water"}) "Index of water vapor in the flue gases composition"; + parameter Integer iCO2=ThermoSysPro.Properties.Media.Functions.findSubstanceIndex(Medium_FlueGases.substanceNames, {"CO2", "Carbondioxide", "Carbon dioxide", "carbondioxide"}) "Index of carbon dioxide in the flue gases composition"; + parameter Integer iSO2=ThermoSysPro.Properties.Media.Functions.findSubstanceIndex(Medium_FlueGases.substanceNames, {"SO2", "Sulfurdioxide", "Sulfur dioxide", "sulfurdioxide"}) "Index of sulfur dioxide in the flue gases composition"; parameter Units.SI.MassFlowRate gamma0=1.e-4 "Pseudo-diffusion conductance use for continuous flow reversal (active if diffusion=false and continuous_flow_reversal = true)"; @@ -93,7 +97,6 @@ public Units.SI.Power Ws[NCEL](start=fill(10e6, NCEL)) "Power delivered to each segment"; Units.SI.Power Wst(start=50.e6) "Total power exchanged on all segment"; Units.SI.SpecificEnthalpy h(start=10e5) "Fluid specific enthalpy"; - FluidType fluids[3] "Fluids mixing in volume"; Units.SI.Power Ja "Thermal power diffusion from inlet Ca"; Units.SI.Power Jws "Thermal power diffusion from inlet Cws"; Units.SI.Power Jfg "Thermal power diffusion from outlet Cfg"; @@ -104,32 +107,32 @@ public Real ra "Value of r(Q/gamma) for inlet Ca"; Real rws "Value of r(Q/gamma) for inlet Cws"; Real rfg "Value of r(Q/gamma) for outlet Cfg"; - FluidType ftype_ws "Water/steam fluid type"; - Integer fluid_ws=Integer(ftype_ws) "Water/steam fluid number"; + Medium.MassFraction Xws[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Water/steam mass fractions"; + Medium_FlueGases.MassFraction Xea[Medium_FlueGases.nX](start=Medium_FlueGases.X_default) "Air inlet mass fractions"; + Medium_FlueGases.MassFraction Xsf[Medium_FlueGases.nX](start=Medium_FlueGases.X_default) "Flue gases outlet mass fractions"; + Medium.ExtraProperty SubCws[Medium.nC](quantity=Medium.extraPropertiesNames, start=Medium.C_default) "Water/steam trace substances"; + Medium_FlueGases.ExtraProperty SubCfg[Medium_FlueGases.nC](quantity=Medium_FlueGases.extraPropertiesNames, start=Medium_FlueGases.C_default) "Flue gases trace substances"; + Medium_FlueGases.ThermodynamicState state_air_in "Air inlet thermodynamic state"; + Medium_FlueGases.ThermodynamicState state_fg_out "Flue gases outlet thermodynamic state"; public ThermoSysPro.Fluid.Interfaces.Connectors.FuelInlet Cfuel "Fuel inlet" annotation (Placement(transformation(extent={{-100,-60},{-80,-40}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ca "Air inlet" + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ca(redeclare package Medium = Medium_FlueGases) "Air inlet" annotation (Placement(transformation(extent={{-10,-100},{10,-80}}, rotation= 0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cfg "Flue gases outlet" + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cfg(redeclare package Medium = Medium_FlueGases) "Flue gases outlet" annotation (Placement(transformation(extent={{-10,80},{10,100}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Cws "Water/steam inlet" + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Cws(redeclare package Medium = Medium) "Water/steam inlet" annotation (Placement(transformation(extent={{-100,40},{-80,60}}, rotation= 0))); Thermal.Connectors.ThermalPort Cth[NCEL] "Thermal W T" annotation (Placement(transformation(extent={{80,-10},{100,10}}, rotation=0))); equation - /* Check that incoming fluids are compatible with fluid in volume */ - fluids[1] = ftype; - fluids[2] = Ca.ftype; - fluids[3] = Cfg.ftype; - - assert(ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.isCompatible(fluids), - "GenericCombustion1D: fluids mixing in volume are not compatible with each other"); + assert(Medium_FlueGases.nX > 1, "GenericCombustion1D: Medium_FlueGases must be a gas mixture"); + assert(iN2 > 0 and iO2 > 0 and iH2O > 0 and iCO2 > 0 and iSO2 > 0, "GenericCombustion1D: Medium_FlueGases.substanceNames must contain nitrogen, oxygen, water, carbon dioxide and sulfur dioxide"); /* Heat transfer */ Cth.W = -Ws; @@ -148,36 +151,33 @@ equation Cpfuel = Cfuel.cp; /* Water inlet */ - assert((ftype_ws == FluidType.WaterSteam) or (ftype_ws == FluidType.WaterSteamSimple), "GenericCombustion: the fluid type for the water/steam inlet must be water/steam"); - Cws.diff_res_2 = 0; Cws.diff_on_2 = diffusion; - ftype_ws = Cws.ftype; - Qews = Cws.Q; Hews = Cws.h; + Xws = Cws.Xi; + SubCws = Cws.SubC; /* Air inlet */ Qea = Ca.Q; Pea = Ca.P; Hea = Ca.h; - XeaCO2 = Ca.Xco2; - XeaH2O = Ca.Xh2o; - XeaO2 = Ca.Xo2; - XeaSO2 = Ca.Xso2; + Xea[1:Medium_FlueGases.nXi] = Ca.Xi; + if Medium_FlueGases.nXi < Medium_FlueGases.nX then + Xea[Medium_FlueGases.nX] = 1 - sum(Ca.Xi); + end if; + XeaCO2 = Xea[iCO2]; + XeaH2O = Xea[iH2O]; + XeaO2 = Xea[iO2]; + XeaSO2 = Xea[iSO2]; /* Flue gases outlet */ Qsf = Cfg.Q; Psf = Cfg.P; Hsf = Cfg.h; - XsfCO2 = Cfg.Xco2; - XsfH2O = Cfg.Xh2o; - XsfO2 = Cfg.Xo2; - XsfSO2 = Cfg.Xso2; - /* Mass balance equation */ 0 = Qea + Qews + Qfuel*(1 - XCDfuel) - Qcv*ImbCV - Qbf*ImbBF - Qsf; @@ -196,8 +196,6 @@ equation Ca.h_vol_2 = h; Cfg.h_vol_1 = h; - Cfg.ftype = ftype; - /* No flow reversal */ Cfg.h = Cfg.h_vol_1; @@ -244,17 +242,19 @@ equation Hrcd = 0; /* Air specific enthalpy at the inlet */ - Hea = ThermoSysPro.Properties.FlueGases.FlueGases_h(Pea, Tea, XeaCO2, XeaH2O, XeaO2, XeaSO2); + Hea = Medium_FlueGases.specificEnthalpy_pTX(p=Pea, T=Tea, X=Xea); + state_air_in = Medium_FlueGases.setState_pTX(p=Pea, T=Tea, X=Xea); /* Flue gases specific enthalpy at the outlet */ - Hsf = ThermoSysPro.Properties.FlueGases.FlueGases_h(Psf, Tsf, XsfCO2, XsfH2O, XsfO2, XsfSO2); + Hsf = Medium_FlueGases.specificEnthalpy_pTX(p=Psf, T=Tsf, X=Xsf); + state_fg_out = Medium_FlueGases.setState_pTX(p=Psf, T=Tsf, X=Xsf); /* Air density at the inlet */ - rhoea = ThermoSysPro.Properties.FlueGases.FlueGases_rho(Pea, Tea, XeaCO2, XeaH2O, XeaO2, XeaSO2); + rhoea = Medium_FlueGases.density(state_air_in); Vea = if (rhoea >0.001) then 1/rhoea else 1/1.1; /* Flue gases density at the outlet */ - rhosf = ThermoSysPro.Properties.FlueGases.FlueGases_rho(Psf, Tsf, XsfCO2, XsfH2O, XsfO2, XsfSO2); + rhosf = Medium_FlueGases.density(state_fg_out); Vsf = if (rhosf >0.001) then 1/rhosf else 1/0.1; /* CO2 flue gases mass fraction */ @@ -270,6 +270,15 @@ equation /* SO2 flue gases mass fraction */ XsfSO2*Qsf = (Qea*XeaSO2) + (Qfuel*XSfuel*amSO2/amS); + Xsf[iN2] = 1 - XsfCO2 - XsfH2O - XsfO2 - XsfSO2; + Xsf[iO2] = XsfO2; + Xsf[iH2O] = XsfH2O; + Xsf[iCO2] = XsfCO2; + Xsf[iSO2] = XsfSO2; + Cfg.Xi = Xsf[1:Medium_FlueGases.nXi]; + Cfg.SubC = Ca.SubC; + SubCfg = Cfg.SubC; + /* LHV conversion from dryer to crude*/ LHVfuel = -2510000.0*Xwfuel + LHVfuel_D*(1-Xwfuel); diff --git a/ThermoSysPro/Fluid/Combustion/CombustionChambers/GridFurnace.mo b/ThermoSysPro/Fluid/Combustion/CombustionChambers/GridFurnace.mo index a13c091a..b08bb7d4 100644 --- a/ThermoSysPro/Fluid/Combustion/CombustionChambers/GridFurnace.mo +++ b/ThermoSysPro/Fluid/Combustion/CombustionChambers/GridFurnace.mo @@ -1,10 +1,9 @@ within ThermoSysPro.Fluid.Combustion.CombustionChambers; model GridFurnace "Combustion furnace" - extends - ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FlueGasesFluidTypeParameterInterface; extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model for the water/steam side" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable package Medium_FlueGases = ThermoSysPro.Properties.Media.FlueGases constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model for the flue gases side" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Real X2eap=0.1 "Primary air fraction in zone 2"; parameter Real X3eap=0.1 "Primary air fraction in zone 3"; @@ -44,6 +43,11 @@ protected constant Units.SI.SpecificEnthalpy HfH2Ol=15.883300e6 "H2Ol formation enthalpy"; constant Units.SI.SpecificHeatCapacity Cp3g=1100 "Average flue gases specific heat capacity at T3g"; parameter Integer mode=0 "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; + parameter Integer iN2=ThermoSysPro.Properties.Media.Functions.findSubstanceIndex(Medium_FlueGases.substanceNames, {"N2", "Nitrogen", "nitrogen"}) "Index of nitrogen in the flue gases composition"; + parameter Integer iO2=ThermoSysPro.Properties.Media.Functions.findSubstanceIndex(Medium_FlueGases.substanceNames, {"O2", "Oxygen", "oxygen"}) "Index of oxygen in the flue gases composition"; + parameter Integer iH2O=ThermoSysPro.Properties.Media.Functions.findSubstanceIndex(Medium_FlueGases.substanceNames, {"H2O", "Water", "water"}) "Index of water vapor in the flue gases composition"; + parameter Integer iCO2=ThermoSysPro.Properties.Media.Functions.findSubstanceIndex(Medium_FlueGases.substanceNames, {"CO2", "Carbondioxide", "Carbon dioxide", "carbondioxide"}) "Index of carbon dioxide in the flue gases composition"; + parameter Integer iSO2=ThermoSysPro.Properties.Media.Functions.findSubstanceIndex(Medium_FlueGases.substanceNames, {"SO2", "Sulfurdioxide", "Sulfur dioxide", "sulfurdioxide"}) "Index of sulfur dioxide in the flue gases composition"; parameter Boolean diffusion=false "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; parameter Units.SI.MassFlowRate gamma0=1.e-4 "Pseudo-diffusion conductance use for continuous flow reversal (active if diffusion=false and continuous_flow_reversal = true)"; @@ -264,17 +268,20 @@ public Real FVN0(start=0.1) "Ashes normal volume fraction for the computation of FVN"; Units.SI.SpecificEnthalpy Hsf(start=50e4) "Flue gases specific enthalpy at the outlet"; Units.SI.SpecificEnthalpy h(start=10e5) "Fluid specific enthalpy"; - FluidType fluids[4] "Fluids mixing in volume"; - FluidType ftype_ws "Water/steam fluid type"; - Integer fluid_ws=Integer(ftype_ws) "Water/steam fluid number"; + Medium.MassFraction Xws[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Water/steam mass fractions"; + Medium_FlueGases.MassFraction Xeap[Medium_FlueGases.nX](start=Medium_FlueGases.X_default) "Primary air mass fractions"; + Medium_FlueGases.MassFraction Xeas[Medium_FlueGases.nX](start=Medium_FlueGases.X_default) "Secondary air mass fractions"; + Medium_FlueGases.MassFraction Xsf[Medium_FlueGases.nX](start=Medium_FlueGases.X_default) "Flue gases outlet mass fractions"; + Medium.ExtraProperty SubCws[Medium.nC](quantity=Medium.extraPropertiesNames, start=Medium.C_default) "Water/steam trace substances"; + Medium_FlueGases.ExtraProperty SubCfg[Medium_FlueGases.nC](quantity=Medium_FlueGases.extraPropertiesNames, start=Medium_FlueGases.C_default) "Flue gases trace substances"; public - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ca2 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ca2(redeclare package Medium = Medium_FlueGases) annotation (Placement( transformation(extent={{-60,50},{-40,70}}, rotation=0))); ThermoSysPro.Fluid.Interfaces.Connectors.FuelInlet Com annotation (Placement(transformation(extent={{-100,-20},{-80,0}}, rotation= 0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet port_eau_refroid + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet port_eau_refroid(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{70,20},{90,40}}, rotation=0))); ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_pT pro1 annotation (Placement(transformation(extent={{-100,80},{-80,100}}, rotation= @@ -292,20 +299,14 @@ public annotation (Placement(transformation(extent={{-60,80},{-40,100}}, rotation= 0))); public - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ca1 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ca1(redeclare package Medium = Medium_FlueGases) annotation (Placement( transformation(extent={{-10,-100},{10,-80}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cfg "Flue gases outlet" + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cfg(redeclare package Medium = Medium_FlueGases) "Flue gases outlet" annotation (Placement(transformation(extent={{-10,80},{10,100}}, rotation=0))); equation - /* Check that incoming fluids are compatible with fluid in volume */ - fluids[1] = ftype; - fluids[2] = Ca1.ftype; - fluids[3] = Ca2.ftype; - fluids[4] = Cfg.ftype; - - assert(ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.isCompatible(fluids), - "GenericCombustion1D: fluids mixing in volume are not compatible with each other"); + assert(Medium_FlueGases.nX > 1, "GridFurnace: Medium_FlueGases must be a gas mixture"); + assert(iN2 > 0 and iO2 > 0 and iH2O > 0 and iCO2 > 0 and iSO2 > 0, "GridFurnace: Medium_FlueGases.substanceNames must contain nitrogen, oxygen, water, carbon dioxide and sulfur dioxide"); /* Mixing specific enthalpy */ port_eau_refroid.h_vol_2 = h; @@ -313,8 +314,6 @@ equation Ca2.h_vol_2 = h; Cfg.h_vol_1 = h; - Cfg.ftype = ftype; - /* No flow reversal */ Cfg.h = Cfg.h_vol_1; @@ -340,15 +339,13 @@ equation Cpom = Com.cp; /* Cooling water inlet */ - assert((ftype_ws == FluidType.WaterSteam) or (ftype_ws == FluidType.WaterSteamSimple), "GridFurnace: the fluid type for the water/steam inlet must be water/steam"); - port_eau_refroid.diff_res_2 = 0; port_eau_refroid.diff_on_2 = diffusion; - ftype_ws = port_eau_refroid.ftype; - Qerefo = port_eau_refroid.Q; Herefo = port_eau_refroid.h; + Xws = port_eau_refroid.Xi; + SubCws = port_eau_refroid.SubC; /* Primary air inlet */ Qeap = Ca1.Q; @@ -356,11 +353,15 @@ equation Peap = Psf; Heap = Ca1.h; - XeapCO2 = Ca1.Xco2; - XeapH2O = Ca1.Xh2o; - XeapO2 = Ca1.Xo2; - XeapSO2 = Ca1.Xso2; - XeapN2 = 1 - Ca1.Xco2 - Ca1.Xh2o - Ca1.Xo2 - Ca1.Xso2; + Xeap[1:Medium_FlueGases.nXi] = Ca1.Xi; + if Medium_FlueGases.nXi < Medium_FlueGases.nX then + Xeap[Medium_FlueGases.nX] = 1 - sum(Ca1.Xi); + end if; + XeapCO2 = Xeap[iCO2]; + XeapH2O = Xeap[iH2O]; + XeapO2 = Xeap[iO2]; + XeapSO2 = Xeap[iSO2]; + XeapN2 = Xeap[iN2]; /* Secondary air inlet */ Qeas = Ca2.Q; @@ -368,22 +369,21 @@ equation Peas = Psf; Heas = Ca2.h; - XeasCO2 = Ca2.Xco2; - XeasH2O = Ca2.Xh2o; - XeasO2 = Ca2.Xo2; - XeasSO2 = Ca2.Xso2; - XeasN2 = 1 - Ca2.Xco2 - Ca2.Xh2o - Ca2.Xo2 - Ca2.Xso2; + Xeas[1:Medium_FlueGases.nXi] = Ca2.Xi; + if Medium_FlueGases.nXi < Medium_FlueGases.nX then + Xeas[Medium_FlueGases.nX] = 1 - sum(Ca2.Xi); + end if; + XeasCO2 = Xeas[iCO2]; + XeasH2O = Xeas[iH2O]; + XeasO2 = Xeas[iO2]; + XeasSO2 = Xeas[iSO2]; + XeasN2 = Xeas[iN2]; /* Flue gases outlet */ Qsf = Cfg.Q; Hsf = Cfg.h; Psf = Cfg.P; - XsfCO2 = Cfg.Xco2; - XsfH2O = Cfg.Xh2o; - XsfO2 = Cfg.Xo2; - XsfSO2 = Cfg.Xso2; - /* Primary air mass flow rates */ X1eap = 1 - X2eap - X3eap; Q1eap = Qeap*X1eap; @@ -747,6 +747,14 @@ end if; XsfHF = Q5eHF/Qsf; XsfCEND = Q5ecend/Qsf; XsfN2 = 1 - (XsfCO2 + XsfH2O + XsfO2 + XsfSO2); + Xsf[iN2] = XsfN2; + Xsf[iO2] = XsfO2; + Xsf[iH2O] = XsfH2O; + Xsf[iCO2] = XsfCO2; + Xsf[iSO2] = XsfSO2; + Cfg.Xi = Xsf[1:Medium_FlueGases.nXi]; + Cfg.SubC = Ca1.SubC; + SubCfg = Cfg.SubC; /* Power accumulated by the flue gases in zone 5 */ P5a = Qeasm*Heasm; diff --git a/ThermoSysPro/Fluid/Combustion/CombustionChambers/PostCombustionGas.mo b/ThermoSysPro/Fluid/Combustion/CombustionChambers/PostCombustionGas.mo index 40503f14..d93c61a9 100644 --- a/ThermoSysPro/Fluid/Combustion/CombustionChambers/PostCombustionGas.mo +++ b/ThermoSysPro/Fluid/Combustion/CombustionChambers/PostCombustionGas.mo @@ -1,24 +1,26 @@ within ThermoSysPro.Fluid.Combustion.CombustionChambers; model PostCombustionGas "Post-combustion" - extends - ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FlueGasesFluidTypeParameterInterface; extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + + replaceable package Medium_FlueGases = ThermoSysPro.Properties.Media.FlueGases constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model for the flue gases side" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Real XClfuel=0 "Chloride mass fraction in fuel"; parameter Real XFfuel=0 "Fluoride mass fraction in fuel"; parameter Real Xrad=0 "Fraction of radiated power"; parameter Boolean continuous_flow_reversal=false "true: continuous flow reversal - false: discontinuous flow reversal"; parameter Boolean diffusion=false "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; - parameter IF97Region region=IF97Region.All_regions "IF97 region (active for IF97 water/steam only)" annotation(Evaluate=true, Dialog(enable=(ftype==FluidType.WaterSteam), tab="Fluid", group="Fluid properties")); protected constant Real HfCO2=3.275e+07 "CO2 formation specific enthalpy"; constant Real HfCO=9.201e+06 "CO formation specific enthalpy"; constant Real HfH2O=2.418e+08 "H2O steam formation specific enthalpy"; constant Units.SI.SpecificEnthalpy H0v=2501551.43 "Vaporisation specific enthalpy at 0°C"; - parameter Integer mode=Integer(region) - 1 "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; + parameter Integer mode=0 "IF97 region. 1:liquid - 2:steam - 4:saturation line - 0:automatic"; + parameter Integer iN2=ThermoSysPro.Properties.Media.Functions.findSubstanceIndex(Medium_FlueGases.substanceNames, {"N2", "Nitrogen", "nitrogen"}) "Index of nitrogen in the flue gases composition"; + parameter Integer iO2=ThermoSysPro.Properties.Media.Functions.findSubstanceIndex(Medium_FlueGases.substanceNames, {"O2", "Oxygen", "oxygen"}) "Index of oxygen in the flue gases composition"; + parameter Integer iH2O=ThermoSysPro.Properties.Media.Functions.findSubstanceIndex(Medium_FlueGases.substanceNames, {"H2O", "Water", "water"}) "Index of water vapor in the flue gases composition"; + parameter Integer iCO2=ThermoSysPro.Properties.Media.Functions.findSubstanceIndex(Medium_FlueGases.substanceNames, {"CO2", "Carbondioxide", "Carbon dioxide", "carbondioxide"}) "Index of carbon dioxide in the flue gases composition"; + parameter Integer iSO2=ThermoSysPro.Properties.Media.Functions.findSubstanceIndex(Medium_FlueGases.substanceNames, {"SO2", "Sulfurdioxide", "Sulfur dioxide", "sulfurdioxide"}) "Index of sulfur dioxide in the flue gases composition"; parameter Units.SI.MassFlowRate gamma0=1.e-4 "Pseudo-diffusion conductance use for continuous flow reversal (active if diffusion=false and continuous_flow_reversal = true)"; public @@ -132,7 +134,6 @@ public Units.SI.SpecificEnthalpy Hsf(start=50e4) "Flue gases specific enthalpy at the outlet"; Real Keq0(start=0.1) "Intermediate variable for the compuation of Keq"; Real delta(start=0.1) "Intermediate variable to compute the progress of stage 4"; - FluidType fluids[4] "Fluids mixing in volume"; Units.SI.SpecificEnthalpy h(start=10e5) "Fluid mixture specific enthalpy"; Units.SI.Power Ja "Thermal power diffusion from inlet Ca"; Units.SI.Power Jfg1 "Thermal power diffusion from inlet Cfg1"; @@ -144,14 +145,17 @@ public Real ra "Value of r(Q/gamma) for inlet Ca"; Real rfg1 "Value of r(Q/gamma) for inlet Cfg1"; Real rfg2 "Value of r(Q/gamma) for outlet Cfg2"; + Medium_FlueGases.MassFraction Xea[Medium_FlueGases.nX](start=Medium_FlueGases.X_default) "Air inlet mass fractions"; + Medium_FlueGases.MassFraction Xef[Medium_FlueGases.nX](start=Medium_FlueGases.X_default) "Flue gases inlet mass fractions"; + Medium_FlueGases.MassFraction Xsf[Medium_FlueGases.nX](start=Medium_FlueGases.X_default) "Flue gases outlet mass fractions"; public - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ca "Air inlet" + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ca(redeclare package Medium = Medium_FlueGases) "Air inlet" annotation (Placement(transformation(extent={{-60,80},{-40,100}}, rotation= 0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cfg2 "Flue gases outlet" + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cfg2(redeclare package Medium = Medium_FlueGases) "Flue gases outlet" annotation (Placement(transformation(extent={{80,0},{100,20}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Cfg1 "Flue gases inlet" + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Cfg1(redeclare package Medium = Medium_FlueGases) "Flue gases inlet" annotation (Placement(transformation(extent={{-100,0},{-80,20}}, rotation=0))); ThermoSysPro.Fluid.Interfaces.Connectors.FuelInlet Cfuel "Fuel inlet" annotation (Placement(transformation(extent={{-40,-100},{-20,-80}}, @@ -161,14 +165,8 @@ public 0))); equation - /* Check that incoming fluids are compatible with fluid in volume */ - fluids[1] = ftype; - fluids[2] = Ca.ftype; - fluids[3] = Cfg1.ftype; - fluids[4] = Cfg2.ftype; - - assert(ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.isCompatible(fluids), - "PostCombustionGas: fluids mixing in volume are not compatible with each other"); + assert(Medium_FlueGases.nX > 1, "PostCombustionGas: Medium_FlueGases must be a gas mixture"); + assert(iN2 > 0 and iO2 > 0 and iH2O > 0 and iCO2 > 0 and iSO2 > 0, "PostCombustionGas: Medium_FlueGases.substanceNames must contain nitrogen, oxygen, water, carbon dioxide and sulfur dioxide"); /* Fuel inlet */ Qec = Cfuel.Q; @@ -188,31 +186,34 @@ equation Pea = 1.01e+5; Hea = Ca.h; - XeaCO2 = Ca.Xco2; - XeaH2O = Ca.Xh2o; - XeaO2 = Ca.Xo2; - XeaSO2 = Ca.Xso2; + Xea[1:Medium_FlueGases.nXi] = Ca.Xi; + if Medium_FlueGases.nXi < Medium_FlueGases.nX then + Xea[Medium_FlueGases.nX] = 1 - sum(Ca.Xi); + end if; + XeaCO2 = Xea[iCO2]; + XeaH2O = Xea[iH2O]; + XeaO2 = Xea[iO2]; + XeaSO2 = Xea[iSO2]; /* Flue gases inlet */ Qef = Cfg1.Q; Hef = Cfg1.h; Cfg1.P = Cfg2.P; - XefCO2 = Cfg1.Xco2; - XefH2O = Cfg1.Xh2o; - XefO2 = Cfg1.Xo2; - XefSO2 = Cfg1.Xso2; + Xef[1:Medium_FlueGases.nXi] = Cfg1.Xi; + if Medium_FlueGases.nXi < Medium_FlueGases.nX then + Xef[Medium_FlueGases.nX] = 1 - sum(Cfg1.Xi); + end if; + XefCO2 = Xef[iCO2]; + XefH2O = Xef[iH2O]; + XefO2 = Xef[iO2]; + XefSO2 = Xef[iSO2]; /* Flue gases outlet */ Qsf = Cfg2.Q; Hsf = Cfg2.h; Psf = Cfg2.P; - XsfCO2 = Cfg2.Xco2; - XsfH2O = Cfg2.Xh2o; - XsfO2 = Cfg2.Xo2; - XsfSO2 = Cfg2.Xso2; - // 1st zone : Mixing air - flue gases - water in fuel // -------------------------------------------------- @@ -235,8 +236,6 @@ equation Cfg1.h_vol_2 = h; Cfg2.h_vol_1 = h; - Cfg2.ftype = ftype; - /* Mixture composition */ XmelO2 = (XefO2*Qef + XeaO2*Qea)/Qmel; XmelCO2 = (XefCO2*Qef)/Qmel; @@ -482,6 +481,13 @@ equation XsfCO2 = Q24CO2/Qsf; XsfC = XsfCO2 + XsfCO; XsfN2 = 1 - (XsfO2 + XsfSO2 + XsfH2O + XsfCO2 + XsfCO); + Xsf[iN2] = 1 - XsfO2 - XsfH2O - XsfCO2 - XsfSO2; + Xsf[iO2] = XsfO2; + Xsf[iH2O] = XsfH2O; + Xsf[iCO2] = XsfCO2; + Xsf[iSO2] = XsfSO2; + Cfg2.Xi = Xsf[1:Medium_FlueGases.nXi]; + Cfg2.SubC = Cfg1.SubC; /* Power accumukated by the gases in zone 2 */ P2t = ((Q24H2O - (Qmel*XmelH2O))*H0v + Qmel*Hmel + Q1ec*Hfuel + P2g)*(1 - Xrad); diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Combustion/TestGTCombustionChamber.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Combustion/TestGTCombustionChamber.mo new file mode 100644 index 00000000..0a2ca23b --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Combustion/TestGTCombustionChamber.mo @@ -0,0 +1,49 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Combustion; +model TestGTCombustionChamber + extends ThermoSysPro.UsersGuide.Icons.Example; + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; + replaceable package Medium_FlueGases = ThermoSysPro.Properties.Media.FlueGases; + + ThermoSysPro.Fluid.Combustion.CombustionChambers.GTCombustionChamber combustionChamber( + redeclare package Medium = Medium, + redeclare package Medium_FlueGases = Medium_FlueGases) + annotation (Placement(transformation(extent={{-40,-40},{40,40}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourceWaterSteam( + redeclare package Medium = Medium, + Q0=0, + P0=15e5, + h0=300e3) + annotation (Placement(transformation(extent={{-100,50},{-60,90}}, rotation=0))); + ThermoSysPro.Fluid.Combustion.BoundaryConditions.FuelSourcePQ sourceFuel( + Hum=0, + Xo=0, + Xn=0, + Xs=0, + rho=0.838, + Xc=0.755, + Xh=0.245, + Cp=2255, + T0=410, + Q0=9.30, + LHV=47500e3) + annotation (Placement(transformation(extent={{-100,-90},{-60,-50}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourceAir( + redeclare package Medium = Medium_FlueGases, + P0=15e5, + Q0=415, + T0=680, + option_temperature=true, + X0={0.76,0.23,0.01,0,0}) + annotation (Placement(transformation(extent={{-120,-20},{-80,20}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sinkFlueGases( + redeclare package Medium = Medium_FlueGases, + T0=1200, + option_temperature=true) + annotation (Placement(transformation(extent={{80,-20},{120,20}}, rotation=0))); +equation + connect(sourceWaterSteam.C, combustionChamber.Cws) annotation (Line(points={{-60,70},{-24,70},{-24,36}}, color={0,0,255})); + connect(sourceFuel.C, combustionChamber.Cfuel) annotation (Line(points={{-60,-70},{0,-70},{0,-36}}, color={0,0,0})); + connect(sourceAir.C, combustionChamber.Ca) annotation (Line(points={{-80,0},{-36,0}}, color={0,0,0})); + connect(combustionChamber.Cfg, sinkFlueGases.C) annotation (Line(points={{36,0},{80,0}}, color={0,0,0})); + annotation (experiment(StopTime=1)); +end TestGTCombustionChamber; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Combustion/TestGenericCombustion.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Combustion/TestGenericCombustion.mo new file mode 100644 index 00000000..353493ee --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Combustion/TestGenericCombustion.mo @@ -0,0 +1,49 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Combustion; +model TestGenericCombustion + extends ThermoSysPro.UsersGuide.Icons.Example; + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; + replaceable package Medium_FlueGases = ThermoSysPro.Properties.Media.FlueGases; + + ThermoSysPro.Fluid.Combustion.CombustionChambers.GenericCombustion combustionChamber( + redeclare package Medium = Medium, + redeclare package Medium_FlueGases = Medium_FlueGases) + annotation (Placement(transformation(extent={{-40,-40},{40,40}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourceWaterSteam( + redeclare package Medium = Medium, + Q0=0, + P0=15e5, + h0=300e3) + annotation (Placement(transformation(extent={{-120,10},{-80,50}}, rotation=0))); + ThermoSysPro.Fluid.Combustion.BoundaryConditions.FuelSourcePQ sourceFuel( + Hum=0, + Xo=0, + Xn=0, + Xs=0, + rho=0.838, + Xc=0.755, + Xh=0.245, + Cp=2255, + T0=410, + Q0=9.30, + LHV=47500e3) + annotation (Placement(transformation(extent={{30,-100},{70,-60}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourceAir( + redeclare package Medium = Medium_FlueGases, + P0=15e5, + Q0=415, + T0=680, + option_temperature=true, + X0={0.76,0.23,0.01,0,0}) + annotation (Placement(transformation(extent={{-40,-100},{0,-60}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sinkFlueGases( + redeclare package Medium = Medium_FlueGases, + T0=1200, + option_temperature=true) + annotation (Placement(transformation(extent={{-20,80},{20,120}}, rotation=0))); +equation + connect(sourceWaterSteam.C, combustionChamber.Cws) annotation (Line(points={{-80,30},{-70,30},{-70,4},{-36,4}}, color={0,0,255})); + connect(sourceFuel.C, combustionChamber.Cfuel) annotation (Line(points={{70,-80},{28,-80},{28,-36}}, color={0,0,0})); + connect(sourceAir.C, combustionChamber.Ca) annotation (Line(points={{0,-80},{-12,-80},{-12,-36}}, color={0,0,0})); + connect(combustionChamber.Cfg, sinkFlueGases.C) annotation (Line(points={{-12,36},{-12,100},{-20,100}}, color={0,0,0})); + annotation (experiment(StopTime=1)); +end TestGenericCombustion; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Combustion/TestGenericCombustion1D.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Combustion/TestGenericCombustion1D.mo new file mode 100644 index 00000000..dab35fd7 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Combustion/TestGenericCombustion1D.mo @@ -0,0 +1,27 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Combustion; +model TestGenericCombustion1D + extends ThermoSysPro.UsersGuide.Icons.Example; + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; + replaceable package Medium_FlueGases = ThermoSysPro.Properties.Media.FlueGases; + ThermoSysPro.Fluid.Combustion.CombustionChambers.GenericCombustion1D combustionChamber(redeclare package Medium = Medium, redeclare package Medium_FlueGases = Medium_FlueGases, NCEL = 7, Qm(fixed = false), Qsf(fixed = false), kcham(fixed = true) = 0.1, Acham = 275, Xbf = 0, ImbCV = 0.05, EPSPAR = 0.7, Kec = 8.8, SM = {639.92, 198.58, 466.48, 466.48, 466.48, 358.56, 358.56}, ImbBF = 0.0, Psf(start = 113275)) annotation( + Placement(transformation(origin = {-4, 10}, extent = {{-40, -40}, {40, 40}}))); + ThermoSysPro.Fluid.Combustion.BoundaryConditions.FuelSourcePQ sourceFuel(Xn = 0.0208, Xashes = 0.136, Cp = 1200, rho = 1100, LHV = 29245e3, Xc = 0.719, Xh = 0.0414, Xo = 0.086, Xs = 0.0044, Vol = 0.286, Q0 = 57.20, T0 = 358.15, Hum = 0.08) annotation( + Placement(transformation(extent = {{-100, -30}, {-60, 10}}, rotation = 0))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourceAir(redeclare package Medium = Medium_FlueGases, Q0 = 609.29, P0 = 191000, T0 = 524.89, option_temperature = true, X0 = {0.76, 0.23, 0.01, 0, 0}) annotation( + Placement(transformation(origin = {-80, -74}, extent = {{-20, -100}, {20, -60}}, rotation = 90))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourceWaterSteam(redeclare package Medium = Medium, Q0 = 0, P0 = 100000) annotation( + Placement(transformation(extent = {{-100, 30}, {-60, 70}}, rotation = 0))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sinkFlueGases(redeclare package Medium = Medium_FlueGases, T0 = 1200, option_temperature = true) annotation( + Placement(transformation(origin = {24, -18}, extent = {{-20, 80}, {20, 120}}))); +equation + connect(sourceFuel.C, combustionChamber.Cfuel) annotation( + Line(points = {{-60, -10}, {-40, -10}})); + connect(sourceAir.C, combustionChamber.Ca) annotation( + Line(points = {{0, -54}, {0, -45}, {-4, -45}, {-4, -26}})); + connect(sourceWaterSteam.C, combustionChamber.Cws) annotation( + Line(points = {{-60, 50}, {-60, 32}, {-40, 32}, {-40, 30}}, color = {0, 0, 255})); + connect(combustionChamber.Cfg, sinkFlueGases.C) annotation( + Line(points = {{-4, 46}, {-4, 63}, {4, 63}, {4, 82}})); + annotation( + experiment(StopTime = 1)); +end TestGenericCombustion1D; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Combustion/TestGenericCombustion1DWithPipe.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Combustion/TestGenericCombustion1DWithPipe.mo new file mode 100644 index 00000000..f9d75047 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Combustion/TestGenericCombustion1DWithPipe.mo @@ -0,0 +1,115 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Combustion; +model TestGenericCombustion1DWithPipe + extends ThermoSysPro.UsersGuide.Icons.Example; + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; + replaceable package Medium_FlueGases = ThermoSysPro.Properties.Media.FlueGases; + + ThermoSysPro.Fluid.Combustion.CombustionChambers.GenericCombustion1D combustionChamber( + redeclare package Medium = Medium, + redeclare package Medium_FlueGases = Medium_FlueGases, + NCEL=7, + Qm(fixed=false), + Qsf(fixed=false), + kcham(fixed=true)=0.1, + Acham=275, + Xbf=0, + ImbCV=0.05, + EPSPAR=0.7, + Kec=8.8, + SM={639.92,198.58,466.48,466.48,466.48,358.56,358.56}, + ImbBF=0.0, + Psf(start=113275)) + annotation (Placement(transformation(extent={{-62,-56},{62,72}}, rotation=0))); + ThermoSysPro.Fluid.Combustion.BoundaryConditions.FuelSourcePQ sourceFuel( + Xn=0.0208, + Xashes=0.136, + Cp=1200, + rho=1100, + LHV=29245e3, + Xc=0.719, + Xh=0.0414, + Xo=0.086, + Xs=0.0044, + Vol=0.286, + Q0=57.20, + T0=358.15, + Hum=0.08) + annotation (Placement(transformation(extent={{-106,-43},{-72,-5}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourceAir( + redeclare package Medium = Medium_FlueGases, + Q0=609.29, + P0=191000, + T0=524.89, + option_temperature=true, + X0={0.76,0.23,0.01,0,0}) + annotation (Placement(transformation(extent={{-44,-98},{0,-58}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourceWaterSteam( + redeclare package Medium = Medium, + Q0=0, + P0=100000) + annotation (Placement(transformation(extent={{-107,23},{-71,57}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sinkFlueGases( + redeclare package Medium = Medium_FlueGases, + T0=1200, + option_temperature=true) + annotation (Placement(transformation(extent={{0,70},{44,112}}, rotation=0))); + ThermoSysPro.Fluid.HeatExchangers.DynamicTwoPhaseFlowPipe pipeWaterSteam( + redeclare package Medium = Medium, + Ns=7, + inertia=false, + dynamic_energy_balance=false, + z2=56, + rugosrel=5e-5, + ntubes=403, + L=58, + D=0.0327, + P(start=fill(2.0e7, 9)), + Q(start=fill(486.69, 8)), + h(start=fill(1.8e6, 9)), + C2(Q(fixed=false, start=486.69), P(fixed=false, start=1.96318e7, displayUnit="Pa")), + dpfCorr=3.5) + annotation (Placement(transformation(origin={91,8}, extent={{49,16},{-49,-16}}, rotation=270))); + ThermoSysPro.Thermal.HeatTransfer.HeatExchangerWall wall( + Ns=7, + dynamic_energy_balance=false, + Tp1(start=fill(500, 7)), + Tp2(start=fill(400, 7)), + lambda=40, + steady_state=true, + ntubes=403, + L=58, + D=0.0327, + e=0.001) + annotation (Placement(transformation(origin={73,7.5}, extent={{51.5,-15},{-51.5,15}}, rotation=270))); + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourcePipe( + redeclare package Medium = Medium, + h0=1.292e6, + option_temperature=false, + P0=20112000) + annotation (Placement(transformation(origin={91,-81}, extent={{15,-15},{-15,15}}, rotation=270))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkPipe( + redeclare package Medium = Medium, + option_temperature=false, + Q(start=486.69), + h0=2.5e6, + P0=19621600) + annotation (Placement(transformation(origin={90,90.5}, extent={{14.5,-15},{-14.5,15}}, rotation=270))); +equation + connect(sourceFuel.C, combustionChamber.Cfuel) + annotation (Line(points={{-72,-24},{-55.8,-24}}, color={0,0,0})); + connect(combustionChamber.Cfg, sinkFlueGases.C) + annotation (Line(points={{0,65.6},{0,91}}, color={0,0,0})); + connect(sourceAir.C, combustionChamber.Ca) + annotation (Line(points={{0,-78},{0,-49.6}}, color={0,0,0})); + connect(sourceWaterSteam.C, combustionChamber.Cws) + annotation (Line(points={{-71,40},{-55.8,40}}, color={0,0,255})); + connect(combustionChamber.Cth, wall.WT2) + annotation (Line(points={{55.8,8},{68,8},{68,7.5},{76,7.5}}, color={191,95,0})); + connect(wall.WT1, pipeWaterSteam.CTh) + annotation (Line(points={{70,7.5},{71,7.5},{71,8},{86.2,8}}, color={191,95,0})); + connect(sourcePipe.C, pipeWaterSteam.C1) + annotation (Line(points={{91,-66},{91,-41}}, color={0,0,255})); + connect(pipeWaterSteam.C2, sinkPipe.C) + annotation (Line(points={{91,57},{91,76},{90,76}}, color={0,0,255})); + annotation (experiment(StopTime=1)); +end TestGenericCombustion1DWithPipe; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Combustion/TestGridFurnace.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Combustion/TestGridFurnace.mo new file mode 100644 index 00000000..f7dcf2e6 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Combustion/TestGridFurnace.mo @@ -0,0 +1,73 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Combustion; +model TestGridFurnace + extends ThermoSysPro.UsersGuide.Icons.Example; + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; + replaceable package Medium_FlueGases = ThermoSysPro.Properties.Media.FlueGases; + + ThermoSysPro.Fluid.Combustion.BoundaryConditions.FuelSourcePQ fuelSource( + Xn=0.0208, + Xashes=0.136, + Cp=1200, + rho=1100, + LHV=29245e3, + Xc=0.719, + Xh=0.0414, + Xo=0.086, + Xs=0.0044, + Vol=0.286, + Q0=57.20, + T0=358.15, + Hum=0.08) + annotation (Placement(transformation(extent={{-106,-23},{-72,15}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePrimaryAir( + redeclare package Medium = Medium_FlueGases, + T0=300, + Q0=10, + P0=1.9e5, + option_temperature=true, + X0={0.76,0.23,0.01,0,0}) + annotation (Placement(transformation(extent={{-74,-80},{-30,-40}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sinkFlueGases( + redeclare package Medium = Medium_FlueGases, + T0=1200, + option_temperature=true) + annotation (Placement(transformation(extent={{28,50},{72,92}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourceCoolingWater( + redeclare package Medium = Medium, + P0=1.e5, + Q0=1) + annotation (Placement(transformation(extent={{89,13},{53,47}}, rotation=0))); + ThermoSysPro.Fluid.Combustion.CombustionChambers.GridFurnace gridFurnace( + redeclare package Medium = Medium, + redeclare package Medium_FlueGases = Medium_FlueGases, + Q5eH2O(start=27.562088697651173), + Q5eN2(start=18.629997579210396), + Q5sCO(start=16.083169558220888), + Q5sCO2(start=-23.220946069965017), + Q5sO2(start=-1.7763568394002505E-15), + T2(start=4353.611752483582), + Teap(start=2396.269823464287, displayUnit="degC"), + Teas(start=2396.269823464287, displayUnit="degC"), + Teasm(start=2419.8632089574135, displayUnit="degC"), + Tsf(start=1964.2922985959055), Hsf(start = 4575373),Qeasm(start=14.733687)) + annotation (Placement(transformation(extent={{-40,-40},{40,40}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceSecondaryAir( + redeclare package Medium = Medium_FlueGases, + option_temperature=true, + T0=300, + Q0=10, + X0={0.76,0.23,0.01,0,0}) + annotation (Placement(transformation(extent={{-90,4},{-46,44}}, rotation=0))); +equation + connect(fuelSource.C, gridFurnace.Com) + annotation (Line(points={{-72,-4},{-36,-4}}, color={0,0,0})); + connect(gridFurnace.Cfg, sinkFlueGases.C) + annotation (Line(points={{0,36},{0,71},{28,71}}, color={0,0,0})); + connect(sourceCoolingWater.C, gridFurnace.port_eau_refroid) + annotation (Line(points={{53,30},{32,30},{32,12}}, color={0,0,255})); + connect(sourceSecondaryAir.C, gridFurnace.Ca2) + annotation (Line(points={{-46,24},{-20,24}}, color={0,0,0})); + connect(sourcePrimaryAir.C, gridFurnace.Ca1) + annotation (Line(points={{-30,-60},{0,-60},{0,-36}}, color={0,0,0})); + annotation (experiment(StopTime=1)); +end TestGridFurnace; \ No newline at end of file diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Combustion/TestPostCombustionGas.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Combustion/TestPostCombustionGas.mo new file mode 100644 index 00000000..7b9a15fe --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Combustion/TestPostCombustionGas.mo @@ -0,0 +1,67 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Combustion; +model TestPostCombustionGas + extends ThermoSysPro.UsersGuide.Icons.Example; + replaceable package Medium_FlueGases = ThermoSysPro.Properties.Media.FlueGases; + + ThermoSysPro.Fluid.BoundaryConditions.Sink sinkFlueGases( + redeclare package Medium = Medium_FlueGases, + T0=1200, + option_temperature=true) + annotation (Placement(transformation(origin={151,-6}, extent={{23,-24},{-23,24}}, rotation=180))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourceFlueGases( + redeclare package Medium = Medium_FlueGases, + P0=15e5, + Q0=415, + T0=680, + option_temperature=true, + X0={0.76,0.23,0.01,0,0}) + annotation (Placement(transformation(extent={{-174,-30},{-128,18}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceAir( + redeclare package Medium = Medium_FlueGases, + T0=680, + option_temperature=true, + Q0=10, + X0={0.76,0.23,0.01,0,0}) + annotation (Placement(transformation(extent={{-172,68},{-132,108}}, rotation=0))); + ThermoSysPro.Fluid.Combustion.BoundaryConditions.FuelSourcePQ sourceFuel( + Hum=0, + Xo=0, + Xn=0, + Xs=0, + rho=0.838, + Xc=0.755, + Xh=0.245, + Cp=2255, + T0=410, + Q0=9.30, + LHV=47500e3) + annotation (Placement(transformation(extent={{-107,-109},{-71,-73}}, rotation=0))); + ThermoSysPro.Fluid.Combustion.CombustionChambers.PostCombustionGas postCombustionGas( + redeclare package Medium_FlueGases = Medium_FlueGases, Psf(start = 1.5e6), Tmel(start = 2427.85 + 273.15), h(start = 4026550)) + annotation (Placement(transformation(extent={{-52,-74},{74,50}}))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss airPressureLoss( + redeclare package Medium = Medium_FlueGases) + annotation (Placement(transformation(extent={{-100,78},{-80,98}}))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss inletPressureLoss( + redeclare package Medium = Medium_FlueGases) + annotation (Placement(transformation(extent={{-102,-16},{-82,4}}))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss outletPressureLoss( + redeclare package Medium = Medium_FlueGases) + annotation (Placement(transformation(extent={{90,-16},{110,4}}))); +equation + connect(sourceFuel.C, postCombustionGas.Cfuel) + annotation (Line(points={{-71,-91},{-7.9,-91},{-7.9,-67.8}}, color={0,0,0})); + connect(sourceAir.C, airPressureLoss.C1) + annotation (Line(points={{-132,88},{-100,88}}, color={0,0,0})); + connect(airPressureLoss.C2, postCombustionGas.Ca) + annotation (Line(points={{-80,88},{-20.5,88},{-20.5,43.8}}, color={0,0,0})); + connect(sourceFlueGases.C, inletPressureLoss.C1) + annotation (Line(points={{-128,-6},{-102,-6}}, color={0,0,0})); + connect(inletPressureLoss.C2, postCombustionGas.Cfg1) + annotation (Line(points={{-82,-6},{-64,-6},{-64,-5.8},{-45.7,-5.8}}, color={0,0,0})); + connect(postCombustionGas.Cfg2, outletPressureLoss.C1) + annotation (Line(points={{67.7,-5.8},{79.85,-5.8},{79.85,-6},{90,-6}}, color={0,0,0})); + connect(outletPressureLoss.C2, sinkFlueGases.C) + annotation (Line(points={{110,-6},{128,-6}}, color={0,0,0})); + annotation (experiment(StopTime=1)); +end TestPostCombustionGas; \ No newline at end of file diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Combustion/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/Combustion/package.order index e69de29b..a7bc0903 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Combustion/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Combustion/package.order @@ -0,0 +1,6 @@ +TestGTCombustionChamber +TestGenericCombustion +TestGenericCombustion1D +TestGenericCombustion1DWithPipe +TestPostCombustionGas +TestGridFurnace diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestFixedPowerHeatExchanger.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestFixedPowerHeatExchanger.mo index 36776aa2..79aa47c2 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestFixedPowerHeatExchanger.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestFixedPowerHeatExchanger.mo @@ -7,34 +7,22 @@ model TestFixedPowerHeatExchanger ThermoSysPro.Fluid.HeatExchangers.FixedPowerHeatExchanger fixedPowerHeatExchanger( redeclare package Medium_c = Medium, redeclare package Medium_f = Medium, - DW=1e5, - DPc=1, - DPf=1) annotation (Placement(transformation(extent={{-20,44},{0,64}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourcePc( + DW=1e6) + annotation (Placement(transformation(extent={{-20,44},{0,64}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ( redeclare package Medium = Medium, - T0=340) annotation (Placement(transformation(extent={{-80,44},{-60,64}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourcePf( - redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-60,24},{-40,44}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkPc( + T0=340) annotation (Placement(transformation(extent={{-70,22},{-50,42}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ1( + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-58,44},{-38,64}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sinkPc( redeclare package Medium = Medium) annotation (Placement(transformation(extent={{40,44},{60,64}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkPf( + ThermoSysPro.Fluid.BoundaryConditions.Sink sinkPf( redeclare package Medium = Medium) annotation (Placement(transformation(extent={{20,24},{40,44}}, rotation=0))); - ThermoSysPro.Fluid.Volumes.VolumeD volumePc( - redeclare package Medium = Medium, - V=1, - steady_state=false, - h0=2.8e5) annotation (Placement(transformation(extent={{10,44},{30,64}}, rotation=0))); - ThermoSysPro.Fluid.Volumes.VolumeD volumePf( - redeclare package Medium = Medium, - V=1, - steady_state=false, - h0=7e4) annotation (Placement(transformation(extent={{-10,24},{10,44}}, rotation=0))); equation - connect(sourcePc.C, fixedPowerHeatExchanger.Ec) annotation (Line(points={{-60,54},{-20,54},{-20,48}}, color={0,0,255})); - connect(sourcePf.C, fixedPowerHeatExchanger.Ef) annotation (Line(points={{-40,34},{-20,34},{-20,57}}, color={0,0,255})); - connect(fixedPowerHeatExchanger.Sc, volumePc.Ce) annotation (Line(points={{0,48},{8,48},{8,54},{10,54}}, color={0,0,255})); - connect(volumePc.Cs3, sinkPc.C) annotation (Line(points={{30,54},{40,54}}, color={0,0,255})); - connect(fixedPowerHeatExchanger.Sf, volumePf.Ce) annotation (Line(points={{0,57},{6,57},{6,34},{-10,34}}, color={0,0,255})); - connect(volumePf.Cs3, sinkPf.C) annotation (Line(points={{10,34},{20,34}}, color={0,0,255})); + connect(sourcePQ.C, fixedPowerHeatExchanger.Ec) annotation (Line(points={{-50,32},{-16,32},{-16,48},{-15.8,48}}, + color={0,0,255})); + connect(sourcePQ1.C, fixedPowerHeatExchanger.Ef) annotation (Line(points={{-38,54},{-20,54}}, color={0,0,255})); + connect(fixedPowerHeatExchanger.Sc, sinkPf.C) annotation (Line(points={{-4.2,48},{-4.2,34},{20,34}}, color={0,0,0})); + connect(fixedPowerHeatExchanger.Sf, sinkPc.C) annotation (Line(points={{-0.2,54.1},{19.9,54.1},{19.9,54},{40,54}}, color={0,0,0})); annotation (experiment(StopTime=1000), Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestFixedPowerHeatExchanger; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestFixedPowerHeatExchanger_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestFixedPowerHeatExchanger_Traces.mo index 27ccee15..84d2f19c 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestFixedPowerHeatExchanger_Traces.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestFixedPowerHeatExchanger_Traces.mo @@ -1,45 +1,17 @@ within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; model TestFixedPowerHeatExchanger_Traces extends ThermoSysPro.UsersGuide.Icons.Example; + extends TestFixedPowerHeatExchanger( + redeclare replaceable package Medium = Properties.Media.WaterSteam ( + extraPropertiesNames={"Trace1"}, + C_nominal={0.1}, + C_default={0.2}), + sourcePQ1(SubC0={1}), + sourcePQ(SubC0={2})); - replaceable package Medium = Properties.Media.WaterSteam( - extraPropertiesNames={"Trace1", "Trace2", "Trace3"}, - C_nominal={0.1, 0.2, 0.3}, - C_default={0.2, 0.3, 0.4}); - ThermoSysPro.Fluid.HeatExchangers.FixedPowerHeatExchanger fixedPowerHeatExchanger( - redeclare package Medium_c = Medium, - redeclare package Medium_f = Medium, - DW=1e5, - DPc=1, - DPf=1) annotation (Placement(transformation(extent={{-20,44},{0,64}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourcePc( - redeclare package Medium = Medium, - T0=340, - SubC0={0.1,0.2,0.3}) annotation (Placement(transformation(extent={{-80,44},{-60,64}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourcePf( - redeclare package Medium = Medium, - SubC0={0.4,0.5,0.6}) annotation (Placement(transformation(extent={{-60,24},{-40,44}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkPc( - redeclare package Medium = Medium) annotation (Placement(transformation(extent={{40,44},{60,64}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkPf( - redeclare package Medium = Medium) annotation (Placement(transformation(extent={{20,24},{40,44}}, rotation=0))); - ThermoSysPro.Fluid.Volumes.VolumeD volumePc( - redeclare package Medium = Medium, - V=1, - steady_state=false, - h0=2.8e5) annotation (Placement(transformation(extent={{10,44},{30,64}}, rotation=0))); - ThermoSysPro.Fluid.Volumes.VolumeD volumePf( - redeclare package Medium = Medium, - V=1, - steady_state=false, - h0=7e4) annotation (Placement(transformation(extent={{-10,24},{10,44}}, rotation=0))); -equation - connect(sourcePc.C, fixedPowerHeatExchanger.Ec) annotation (Line(points={{-60,54},{-20,54},{-20,48}}, color={0,0,255})); - connect(sourcePf.C, fixedPowerHeatExchanger.Ef) annotation (Line(points={{-40,34},{-20,34},{-20,57}}, color={0,0,255})); - connect(fixedPowerHeatExchanger.Sc, volumePc.Ce) annotation (Line(points={{0,48},{8,48},{8,54},{10,54}}, color={0,0,255})); - connect(volumePc.Cs3, sinkPc.C) annotation (Line(points={{30,54},{40,54}}, color={0,0,255})); - connect(fixedPowerHeatExchanger.Sf, volumePf.Ce) annotation (Line(points={{0,57},{6,57},{6,34},{-10,34}}, color={0,0,255})); - connect(volumePf.Cs3, sinkPf.C) annotation (Line(points={{10,34},{20,34}}, color={0,0,255})); - annotation (experiment(StopTime=1000), Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); + annotation ( + experiment(StopTime=1000), + Icon(coordinateSystem(preserveAspectRatio=false)), + Diagram(coordinateSystem(preserveAspectRatio=false))); end TestFixedPowerHeatExchanger_Traces; From 8462ec8641bee2bf6d15d863f3ab752dc564d236 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Tue, 19 May 2026 13:52:43 +0200 Subject: [PATCH 165/178] #125 GridFurnace and PostCombustionGas dont use pro anymore but ThermodynamicStates --- .../CombustionChambers/GridFurnace.mo | 64 +++++++++++-------- .../CombustionChambers/PostCombustionGas.mo | 12 ++-- 2 files changed, 43 insertions(+), 33 deletions(-) diff --git a/ThermoSysPro/Fluid/Combustion/CombustionChambers/GridFurnace.mo b/ThermoSysPro/Fluid/Combustion/CombustionChambers/GridFurnace.mo index b08bb7d4..80ebb760 100644 --- a/ThermoSysPro/Fluid/Combustion/CombustionChambers/GridFurnace.mo +++ b/ThermoSysPro/Fluid/Combustion/CombustionChambers/GridFurnace.mo @@ -274,6 +274,11 @@ public Medium_FlueGases.MassFraction Xsf[Medium_FlueGases.nX](start=Medium_FlueGases.X_default) "Flue gases outlet mass fractions"; Medium.ExtraProperty SubCws[Medium.nC](quantity=Medium.extraPropertiesNames, start=Medium.C_default) "Water/steam trace substances"; Medium_FlueGases.ExtraProperty SubCfg[Medium_FlueGases.nC](quantity=Medium_FlueGases.extraPropertiesNames, start=Medium_FlueGases.C_default) "Flue gases trace substances"; + Medium.ThermodynamicState state_biomass_water "Water in biomass thermodynamic state"; + Medium.ThermodynamicState state_biomass_water_sat_v "Saturated vapor state of water in biomass"; + Medium.ThermodynamicState state_biomass_water_sat_l "Saturated liquid state of water in biomass"; + Medium.ThermodynamicState state_dried_water "Water vapor state after drying"; + Medium.ThermodynamicState state_water_seal_vapor "Water seal vapor state"; public ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ca2(redeclare package Medium = Medium_FlueGases) annotation (Placement( @@ -283,21 +288,6 @@ public 0))); ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet port_eau_refroid(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{70,20},{90,40}}, rotation=0))); - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_pT pro1 - annotation (Placement(transformation(extent={{-100,80},{-80,100}}, rotation= - 0))); - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_pT pro2 - annotation (Placement(transformation(extent={{-100,60},{-80,80}}, rotation= - 0))); - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_pT pro3 - annotation (Placement(transformation(extent={{-100,40},{-80,60}}, rotation= - 0))); - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_pT pro4 - annotation (Placement(transformation(extent={{-100,20},{-80,40}}, rotation= - 0))); - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_pT pro5 - annotation (Placement(transformation(extent={{-60,80},{-40,100}}, rotation= - 0))); public ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ca1(redeclare package Medium = Medium_FlueGases) annotation (Placement( transformation(extent={{-10,-100},{10,-80}}, rotation=0))); @@ -439,21 +429,33 @@ equation end if; /* Specific enthalpy of the water in the biomass */ - pro1 = ThermoSysPro.Properties.WaterSteam.IF97.Water_PT(Peap, Teom, mode); - Heauom = pro1.h; + state_biomass_water = Medium.setState_pTX( + p=Peap, + T=Teom, + region=mode); + Heauom = Medium.specificEnthalpy(state_biomass_water); /* Water phase transition energy at Teom */ Psateom = ThermoSysPro.Properties.WaterSteam.BaseIF97.Basic.psat(Teom); - pro2 = ThermoSysPro.Properties.WaterSteam.IF97.Water_PT(Psateom, Teom, 2); - Hvteom = pro2.h; - pro3 = ThermoSysPro.Properties.WaterSteam.IF97.Water_PT(Psateom, Teom, 1); - Hlteom = pro3.h; + state_biomass_water_sat_v = Medium.setState_pTX( + p=Psateom, + T=Teom, + region=2); + Hvteom = Medium.specificEnthalpy(state_biomass_water_sat_v); + state_biomass_water_sat_l = Medium.setState_pTX( + p=Psateom, + T=Teom, + region=1); + Hlteom = Medium.specificEnthalpy(state_biomass_water_sat_l); Hvapteom = Hvteom - Hlteom; /* Specific enthalpy of the water in the biomass */ - pro4 = ThermoSysPro.Properties.WaterSteam.IF97.Water_PT(Psf, T1sfm, 0); - Hs1vom = pro4.h; + state_dried_water = Medium.setState_pTX( + p=Psf, + T=T1sfm, + region=0); + Hs1vom = Medium.specificEnthalpy(state_dried_water); /* Specific enthalpy of the biomass at Teom */ Heom = Cpom*(Teom - 273.15); @@ -663,9 +665,12 @@ end if; P4m = Q4eom*CpMACHs4*((T3o - 273.15) - (T4o - 273.15)); P4h = Q4eom*X4H2O*Cp4liq*((T4o - 273.15) - (T4er - 273.15)); Q4v = rendje*(P4m - P4h)/(Cp4liq*(373.15 - (T4er - 273.15)) + Hvapo); - pro5 = ThermoSysPro.Properties.WaterSteam.IF97.Water_PT(Peap, 373.15, 2); - H4 = pro5.h; - P4v = Q4v*pro5.h; + state_water_seal_vapor = Medium.setState_pTX( + p=Peap, + T=373.15, + region=2); + H4 = Medium.specificEnthalpy(state_water_seal_vapor); + P4v = Q4v*Medium.specificEnthalpy(state_water_seal_vapor); else T4o = 273.15; TsMACH = T3o; @@ -675,8 +680,11 @@ end if; P4m = 0; P4h = 0; Q4v = 0; - pro5 = ThermoSysPro.Properties.WaterSteam.IF97.Water_PT(Peap, 373.15, 2); - H4 = pro5.h; + state_water_seal_vapor = Medium.setState_pTX( + p=Peap, + T=373.15, + region=2); + H4 = Medium.specificEnthalpy(state_water_seal_vapor); P4v = 0; end if; diff --git a/ThermoSysPro/Fluid/Combustion/CombustionChambers/PostCombustionGas.mo b/ThermoSysPro/Fluid/Combustion/CombustionChambers/PostCombustionGas.mo index d93c61a9..1a2ccd8b 100644 --- a/ThermoSysPro/Fluid/Combustion/CombustionChambers/PostCombustionGas.mo +++ b/ThermoSysPro/Fluid/Combustion/CombustionChambers/PostCombustionGas.mo @@ -2,6 +2,7 @@ model PostCombustionGas "Post-combustion" extends ThermoSysPro.Fluid.Interfaces.IconColors; + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model for the water/steam properties" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); replaceable package Medium_FlueGases = ThermoSysPro.Properties.Media.FlueGases constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model for the flue gases side" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Real XClfuel=0 "Chloride mass fraction in fuel"; @@ -148,6 +149,7 @@ public Medium_FlueGases.MassFraction Xea[Medium_FlueGases.nX](start=Medium_FlueGases.X_default) "Air inlet mass fractions"; Medium_FlueGases.MassFraction Xef[Medium_FlueGases.nX](start=Medium_FlueGases.X_default) "Flue gases inlet mass fractions"; Medium_FlueGases.MassFraction Xsf[Medium_FlueGases.nX](start=Medium_FlueGases.X_default) "Flue gases outlet mass fractions"; + Medium.ThermodynamicState state_fuel_water "Water in fuel thermodynamic state"; public ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Ca(redeclare package Medium = Medium_FlueGases) "Air inlet" @@ -160,9 +162,6 @@ public ThermoSysPro.Fluid.Interfaces.Connectors.FuelInlet Cfuel "Fuel inlet" annotation (Placement(transformation(extent={{-40,-100},{-20,-80}}, rotation=0))); - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_pT pro1 - annotation (Placement(transformation(extent={{-100,80},{-80,100}}, rotation= - 0))); equation assert(Medium_FlueGases.nX > 1, "PostCombustionGas: Medium_FlueGases must be a gas mixture"); @@ -295,8 +294,11 @@ equation // - - /* Specific enthalpy of the water in fuel */ - pro1 = ThermoSysPro.Properties.WaterSteam.IF97.Water_PT(Pea, Tec, mode); - Hwfuel = pro1.h; + state_fuel_water = Medium.setState_pTX( + p=Pea, + T=Tec, + region=mode); + Hwfuel = Medium.specificEnthalpy(state_fuel_water); /* Fuel specific enthalpy */ Hfuel = Cpfuel*(Tec - 273.16); From d40a32a07e7b0ab3d6eea57422e0edc4857eb178 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Tue, 19 May 2026 14:07:04 +0200 Subject: [PATCH 166/178] #125 RefH with examples --- ThermoSysPro/Fluid/BoundaryConditions/RefH.mo | 13 ++-- .../BoundaryConditions/TestRefH.mo | 63 +++++++++++++++++++ .../BoundaryConditions/TestRefH_Traces.mo | 17 +++++ .../TestRefH_Traces_FlueGases.mo | 19 ++++++ .../BoundaryConditions/package.order | 3 + 5 files changed, 108 insertions(+), 7 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefH.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefH_Traces.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefH_Traces_FlueGases.mo diff --git a/ThermoSysPro/Fluid/BoundaryConditions/RefH.mo b/ThermoSysPro/Fluid/BoundaryConditions/RefH.mo index 9e1a3b52..673561dc 100644 --- a/ThermoSysPro/Fluid/BoundaryConditions/RefH.mo +++ b/ThermoSysPro/Fluid/BoundaryConditions/RefH.mo @@ -1,6 +1,8 @@ within ThermoSysPro.Fluid.BoundaryConditions; model RefH "Fixed specific enthalpy reference" extends ThermoSysPro.Fluid.Interfaces.IconColors; + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + parameter Units.SI.SpecificEnthalpy h0=1.e5 "Fixed fluid specific enthalpy"; public @@ -8,9 +10,9 @@ public Units.SI.AbsolutePressure P "Fluid pressure"; Units.SI.SpecificEnthalpy h "Fluid specific enthalpy"; - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet C1(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-110,-10},{-90,10}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2 annotation (Placement( + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet C2(redeclare package Medium = Medium) annotation (Placement( transformation(extent={{90,-10},{110,10}}, rotation=0))); ThermoSysPro.InstrumentationAndControl.Connectors.InputReal ISpecificEnthalpy annotation (Placement(transformation( @@ -36,12 +38,9 @@ equation C2.diff_res_1 = C1.diff_res_1; C1.diff_res_2 = C2.diff_res_2; - C1.ftype = C2.ftype; + C1.Xi = C2.Xi; - C1.Xco2 = C2.Xco2; - C1.Xh2o = C2.Xh2o; - C1.Xo2 = C2.Xo2; - C1.Xso2 = C2.Xso2; + C1.SubC = C2.SubC; Q = C1.Q; P = C1.P; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefH.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefH.mo new file mode 100644 index 00000000..860e2926 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefH.mo @@ -0,0 +1,63 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.BoundaryConditions; +model TestRefH + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = Properties.Media.WaterSteam; + + ThermoSysPro.Fluid.BoundaryConditions.RefP refP( + redeclare package Medium = Medium, + P0=2000000) + annotation (Placement(transformation(extent={{-90,-10},{-70,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.RefQ refQ( + redeclare package Medium = Medium, + Q0=110) + annotation (Placement(transformation(extent={{92,-10},{112,10}}))); + ThermoSysPro.Fluid.PressureLosses.PipePressureLoss pipePressureLoss( + redeclare package Medium = Medium) + annotation (Placement(transformation(extent={{126,-10},{146,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.RefH refH( + redeclare package Medium = Medium, + h0=2600e3) + annotation (Placement(transformation(extent={{-40,-10},{-20,10}}))); + ThermoSysPro.Fluid.Volumes.VolumeA volumeA( + redeclare package Medium = Medium, + h0=2600e3, + dynamic_energy_balance=false) + annotation (Placement(transformation(extent={{20,-50},{0,-30}}))); + InstrumentationAndControl.Blocks.Sources.Constante enthalpy(k=2600e3) + annotation (Placement(transformation(extent={{-58,38},{-38,58}}))); + InstrumentationAndControl.Blocks.Sources.Constante pressure(k=2000000) + annotation (Placement(transformation(extent={{-110,38},{-90,58}}))); + InstrumentationAndControl.Blocks.Sources.Constante massFlow(k=110) + annotation (Placement(transformation(extent={{2,38},{22,58}}))); + ThermoSysPro.Fluid.LoopBreakers.LoopBreakerH loopBreakerH(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-10,-10},{10,10}}, + rotation=0))); + ThermoSysPro.Fluid.LoopBreakers.LoopBreakerQ loopBreakerQ(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{18,-10},{38,10}}, + rotation=0))); + ThermoSysPro.Fluid.LoopBreakers.LoopBreakerP loopBreakerP(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{46,-10},{66,10}}, + rotation=0))); +equation + connect(refP.C2, refH.C1) + annotation (Line(points={{-70,0},{-40,0}}, color={0,0,0})); + connect(refQ.C2, pipePressureLoss.C1) + annotation (Line(points={{112,0},{126,0}}, + color={0,0,0})); + connect(pipePressureLoss.C2, volumeA.Ce1) + annotation (Line(points={{146,0},{150,0},{150,-40},{20,-40}}, + color={0,0,0})); + connect(volumeA.Cs1, refP.C1) + annotation (Line(points={{0,-40},{-102,-40},{-102,0},{-90,0}}, color={0,0,0})); + connect(enthalpy.y, refH.ISpecificEnthalpy) + annotation (Line(points={{-37,48},{-30,48},{-30,11}}, color={0,0,255})); + connect(pressure.y, refP.IPressure) + annotation (Line(points={{-89,48},{-80,48},{-80,11}}, color={0,0,255})); + connect(massFlow.y, refQ.IMassFlow) + annotation (Line(points={{23,48},{102,48},{102,11}}, + color={0,0,255})); + connect(refH.C2, loopBreakerH.C1) annotation (Line(points={{-20,0},{-10,0}}, color={0,0,0})); + connect(loopBreakerH.C2, loopBreakerQ.C1) annotation (Line(points={{10,0},{18,0}}, color={0,0,0})); + connect(loopBreakerQ.C2, loopBreakerP.C1) annotation (Line(points={{38,0},{46,0}}, color={0,0,0})); + connect(loopBreakerP.C2, refQ.C1) annotation (Line(points={{66,0},{92,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( + coordinateSystem(preserveAspectRatio=false))); +end TestRefH; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefH_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefH_Traces.mo new file mode 100644 index 00000000..cc1aebed --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefH_Traces.mo @@ -0,0 +1,17 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.BoundaryConditions; +model TestRefH_Traces + extends TestRefH( + redeclare package Medium = Properties.Media.WaterSteam( + extraPropertiesNames={"Trace"}, + C_nominal={0.1}, + C_default={0.2}), + volumeA( + dynamic_energy_balance=true, + dynamic_mass_balance=true, + steady_state=false, + P0=2000000, + h0=2600e3)); + + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( + coordinateSystem(preserveAspectRatio=false))); +end TestRefH_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefH_Traces_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefH_Traces_FlueGases.mo new file mode 100644 index 00000000..72e57825 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/TestRefH_Traces_FlueGases.mo @@ -0,0 +1,19 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.BoundaryConditions; +model TestRefH_Traces_FlueGases + extends TestRefH( + redeclare package Medium = ThermoSysPro.Properties.Media.FlueGases( + extraPropertiesNames={"Trace1", "Trace2", "Trace3"}, + C_nominal={0.1,0.2,0.3}, + C_default={0.2,0.3,0.4}), + volumeA( + dynamic_energy_balance=true, + dynamic_mass_balance=true, + dynamic_composition_balance=true, + steady_state=true, + P0=2000000, + h0=2600e3, + X0={0.1,0.2,0.3,0.2,0.2})); + + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( + coordinateSystem(preserveAspectRatio=false))); +end TestRefH_Traces_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/package.order index d731fabb..1cb5ba44 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/BoundaryConditions/package.order @@ -1,6 +1,9 @@ TestRefQ TestRefQ_Traces TestRefQ_Traces_FlueGases +TestRefH +TestRefH_Traces +TestRefH_Traces_FlueGases TestRefP TestRefP_Traces TestRefP_Traces_FlueGases From 3455d6c4245136af7155f214c8e24b547dba1637 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Tue, 19 May 2026 14:19:52 +0200 Subject: [PATCH 167/178] #125 CHPEngineBarkantineSystem and InternalCombustionEngine --- .../Machines/TestCHPEngineBarkantineSystem.mo | 57 ++++++++++++ .../Machines/TestInternalCombustionEngine.mo | 93 +++++++++++++++++++ .../SimpleExamples/Machines/package.order | 2 + .../Machines/CHPEngineBarkantineSystem.mo | 50 +++++++--- .../Machines/InternalCombustionEngine.mo | 75 ++++++++------- 5 files changed, 227 insertions(+), 50 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestCHPEngineBarkantineSystem.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestInternalCombustionEngine.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestCHPEngineBarkantineSystem.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestCHPEngineBarkantineSystem.mo new file mode 100644 index 00000000..4b0c3637 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestCHPEngineBarkantineSystem.mo @@ -0,0 +1,57 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Machines; +model TestCHPEngineBarkantineSystem + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; + replaceable package Medium_FlueGases = ThermoSysPro.Properties.Media.FlueGases; + + ThermoSysPro.Fluid.BoundaryConditions.SourceP SourceP1( + redeclare package Medium = Medium, + P0=300000, + h0=293e3, + option_temperature=false) + annotation (Placement(transformation(extent={{-100,20},{-80,40}}, rotation= + 0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP PuitsP1( + redeclare package Medium = Medium, + P0=100000, + T0=360) + annotation (Placement(transformation(extent={{60,20},{80,40}}, rotation=0))); + ThermoSysPro.Fluid.Machines.CHPEngineBarkantineSystem CHPBarkantine( + redeclare package Medium = Medium, + redeclare package Medium_FlueGases = Medium_FlueGases) + annotation (Placement(transformation(extent={{-40,0},{20,60}}, rotation=0))); +equation + connect(SourceP1.C, CHPBarkantine.inletWaterSteam) annotation (Line(points={{ + -80,30},{-50,30},{-50,45},{-40,45}}, color={0,0,0})); + connect(CHPBarkantine.outletWaterSteam, PuitsP1.C) + annotation (Line(points={{20,45},{30,45},{30,30},{60,30}}, color={0,0,0})); + annotation ( + experiment(StopTime=1000), + Diagram(coordinateSystem( + preserveAspectRatio=false, + extent={{-100,-100},{100,100}}, + grid={2,2})), + Icon(graphics={ + Rectangle( + lineColor={200,200,200}, + fillColor={248,248,248}, + fillPattern=FillPattern.HorizontalCylinder, + extent={{-100.0,-100.0},{100.0,100.0}}, + radius=25.0), + Rectangle( + lineColor={128,128,128}, + extent={{-100.0,-100.0},{100.0,100.0}}, + radius=25.0), + Polygon( + origin={8.0,14.0}, + lineColor={78,138,73}, + fillColor={78,138,73}, + pattern=LinePattern.None, + fillPattern=FillPattern.Solid, + points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), + Documentation(info=" +

    Copyright © EDF 2002 - 2024

    +

    ThermoSysPro Version 4.1

    +")); +end TestCHPEngineBarkantineSystem; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestInternalCombustionEngine.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestInternalCombustionEngine.mo new file mode 100644 index 00000000..3a722f76 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestInternalCombustionEngine.mo @@ -0,0 +1,93 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Machines; +model TestInternalCombustionEngine + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; + replaceable package Medium_FlueGases = ThermoSysPro.Properties.Media.FlueGases; + + ThermoSysPro.Fluid.Combustion.BoundaryConditions.FuelSourcePQ fuelSourcePQ( + Hum=0, + Xh=0.25, + Xs=0, + Xashes=0, + Xc=0.75, + Xo=0, + Xn=0, + Q0=0.0676, + rho=0.744, + LHV=50e6, + T0(displayUnit="K") = 299, + P0=210300, + Vol=1) + annotation (Placement(transformation(extent={{-106,-81},{-72,-43}}, + rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourceAir( + redeclare package Medium = Medium_FlueGases, + Q0=1.9627, + T0=30 + 273.16, + option_temperature=true, + X0={0.765,0.23,0.005,0,0}, + P0=191000) + annotation (Placement(transformation(extent={{111,-79},{73,-45}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sink( + redeclare package Medium = Medium_FlueGases, + option_temperature=true) + annotation (Placement(transformation(extent={{0,44},{44,86}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourceWater( + redeclare package Medium = Medium, + Q0=15.3, + h0=334.41e3, + P0=410000) + annotation (Placement(transformation(extent={{-107,-19},{-71,15}}, rotation=0))); + ThermoSysPro.Fluid.Machines.InternalCombustionEngine internalCombustionEngine( + redeclare package Medium = Medium, + redeclare package Medium_FlueGases = Medium_FlueGases, + mechanical_efficiency_type=2, + Rmeca_nom=0.41, + Coef_Rm_a=-5.4727e-9, + Coef_Rm_b=4.9359e-5, + Coef_Rm_c=0.30814, + Xpth=0.05, + MMg=20, + DPe=1, + RV=6.45, + Kc=1.28, + Kd=1.33, + Wmeca(start=1400e3), + Welec(start=1358e3), + Wcomb(start=3.4942e6), + exc(start=1.8), + Gamma=1.2085, + Tsf(start=1088.15)) + annotation (Placement(transformation(extent={{-44,-46},{44,42}}))); + ThermoSysPro.Fluid.BoundaryConditions.Sink sinkWater(redeclare package Medium = + Medium) + annotation (Placement(transformation(extent={{75,-19},{111,15}}, rotation=0))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss waterPressureLossIn( + redeclare package Medium = Medium) + annotation (Placement(transformation(extent={{-63,-8},{-51,4}}))); + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss waterPressureLossOut( + redeclare package Medium = Medium) + annotation (Placement(transformation(extent={{51,-9},{65,5}}))); +equation + connect(internalCombustionEngine.Cair, sourceAir.C) annotation (Line( + points={{0,-41.6},{0,-62},{73,-62}}, + color={0,0,0}, + thickness=1)); + connect(internalCombustionEngine.Cfuel, fuelSourcePQ.C) annotation (Line( + points={{-30.8,-41.6},{-30.8,-62},{-72,-62}}, color={0,0,0})); + connect(sourceWater.C, waterPressureLossIn.C1) + annotation (Line(points={{-71,-2},{-63,-2}}, color={0,0,255})); + connect(internalCombustionEngine.Cws1, waterPressureLossIn.C2) annotation ( + Line(points={{-39.6,-2},{-51,-2}}, color={0,0,255})); + connect(internalCombustionEngine.Cws2, waterPressureLossOut.C1) + annotation (Line(points={{39.6,-2},{48,-2},{51,-2}}, color={0,0,255})); + connect(sinkWater.C, waterPressureLossOut.C2) + annotation (Line(points={{75,-2},{65,-2}}, color={0,0,255})); + connect(internalCombustionEngine.Cfg, sink.C) annotation (Line( + points={{0,37.6},{0,65}}, + color={0,0,0}, + thickness=1)); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( + coordinateSystem(preserveAspectRatio=false))); +end TestInternalCombustionEngine; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/package.order index 91f27a61..45bab71a 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/package.order @@ -8,6 +8,8 @@ TestCentrifugalPump_FlueGases TestCentrifugalPump_Traces TestCombustionTurbine TestCombustionTurbine_Traces +TestInternalCombustionEngine +TestCHPEngineBarkantineSystem TestCompressor TestCompressor_Traces TestStaticFan diff --git a/ThermoSysPro/Fluid/Machines/CHPEngineBarkantineSystem.mo b/ThermoSysPro/Fluid/Machines/CHPEngineBarkantineSystem.mo index d85c728e..d33e1844 100644 --- a/ThermoSysPro/Fluid/Machines/CHPEngineBarkantineSystem.mo +++ b/ThermoSysPro/Fluid/Machines/CHPEngineBarkantineSystem.mo @@ -1,5 +1,8 @@ within ThermoSysPro.Fluid.Machines; model CHPEngineBarkantineSystem + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model for the water/steam side" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable package Medium_FlueGases = ThermoSysPro.Properties.Media.FlueGases constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model for the flue gases side" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + parameter Units.SI.Temperature Tair=300 "Inlet air temperature"; parameter Real RechFumEff=0.73 "Flue gases heater efficiency"; parameter Real RechWaterEff=0.9 "Water heater efficiency"; @@ -27,11 +30,14 @@ model CHPEngineBarkantineSystem Vol=1) annotation (Placement(transformation(extent={{62,-26},{38,-2}}, rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.SourcePQ WaterSource( + redeclare package Medium = Medium, h0=293e3, Q0=11.8, P0=300000) annotation (Placement(transformation(extent={{62,-46},{40,-24}}, rotation=0))); ThermoSysPro.Fluid.Machines.InternalCombustionEngine Engine( + redeclare package Medium = Medium, + redeclare package Medium_FlueGases = Medium_FlueGases, DPe=1, MMg=20, Kd=1.33, @@ -50,25 +56,37 @@ model CHPEngineBarkantineSystem rotation=90))); ThermoSysPro.Fluid.HeatExchangers.StaticExchangerDTorWorEff ExchangerWaterWater( + redeclare package Medium_c = Medium, + redeclare package Medium_f = Medium, EffEch=RechWaterEff, exchanger_type=3, Kf=50) annotation (Placement(transformation( origin={0,-66}, extent={{14,14},{-14,-14}}, rotation=270))); - ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe PDC1(L=0.0001) + ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe PDC1( + redeclare package Medium = Medium, + L=0.0001) annotation (Placement(transformation( origin={-60,-10}, extent={{10,-10},{-10,10}}, rotation=90))); - ThermoSysPro.Fluid.BoundaryConditions.Sink WaterSteamSink annotation ( + ThermoSysPro.Fluid.BoundaryConditions.Sink WaterSteamSink( + redeclare package Medium = Medium, + option_temperature=true, + T0=320) annotation ( Placement(transformation(extent={{-22,-72},{-44,-48}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe PDC2(L=0.0001) + ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe PDC2( + redeclare package Medium = Medium, + L=0.0001) annotation (Placement(transformation( origin={-80,-10}, extent={{10,-10},{-10,10}}, rotation=270))); ThermoSysPro.Fluid.HeatExchangers.StaticExchangerDTorWorEff - ExchangerWaterFlueGases( EffEch=RechFumEff, + ExchangerWaterFlueGases( + redeclare package Medium_c = Medium_FlueGases, + redeclare package Medium_f = Medium, + EffEch=RechFumEff, exchanger_type=3, Kf=50, DTfroid=283.15, @@ -77,24 +95,28 @@ model CHPEngineBarkantineSystem origin={0,68}, extent={{-14,-14},{14,14}}, rotation=90))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss silencieux(K=20) + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss silencieux( + redeclare package Medium = Medium_FlueGases, + K=20) annotation (Placement(transformation( origin={-39,16}, extent={{10,-9},{-10,9}}, rotation=270))); - Interfaces.Connectors.FluidOutlet outletWaterSteam annotation (Placement( + Interfaces.Connectors.FluidOutlet outletWaterSteam(redeclare package Medium = + Medium) annotation (Placement( transformation(extent={{180,80},{220,120}}, rotation=0))); - Interfaces.Connectors.FluidInlet inletWaterSteam annotation (Placement( + Interfaces.Connectors.FluidInlet inletWaterSteam(redeclare package Medium = + Medium) annotation (Placement( transformation(extent={{-220,80},{-180,120}}, rotation=0))); - BoundaryConditions.Sink FlueGasesSink annotation (Placement(transformation( - extent={{-56,86},{-80,110}}, rotation=0))); + BoundaryConditions.Sink FlueGasesSink( + redeclare package Medium = Medium_FlueGases, + option_temperature=true, + T0=400) annotation (Placement(transformation(extent={{-56,86},{-80,110}}, + rotation=0))); BoundaryConditions.SourcePQ AirSource( - Xco2=0, - Xh2o=0.005, - Xo2=0.23, - Xso2=0, + redeclare package Medium = Medium_FlueGases, + X0={0.765,0.23,0.005,0,0}, h0=40000, - ftype=ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType.FlueGases, option_temperature=true, P0=160000) annotation (Placement(transformation(extent={{64,2},{40,26}}, rotation=0))); diff --git a/ThermoSysPro/Fluid/Machines/InternalCombustionEngine.mo b/ThermoSysPro/Fluid/Machines/InternalCombustionEngine.mo index ec4904c5..fc4ec8ca 100644 --- a/ThermoSysPro/Fluid/Machines/InternalCombustionEngine.mo +++ b/ThermoSysPro/Fluid/Machines/InternalCombustionEngine.mo @@ -1,10 +1,9 @@ within ThermoSysPro.Fluid.Machines; model InternalCombustionEngine "Internal combustion engine with electrical output" - extends - ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FlueGasesFluidTypeParameterInterface; extends ThermoSysPro.Fluid.Interfaces.IconColors; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model for the water/steam side" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable package Medium_FlueGases = ThermoSysPro.Properties.Media.FlueGases constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model for the flue gases side" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Integer mechanical_efficiency_type=1 "1: fixed nominal efficiency - 2: Linear efficiency using Coef_Rm_a, Coef_Rm_b and Coef_Rm_c - 3: Beau de Rochas cycle efficiency"; parameter Real Rmeca_nom=0.40 "Fixed nominal mechanical efficiency (active if mechanical_efficiency_type=1)"; @@ -36,6 +35,11 @@ protected constant Real amCO2=amC+2*amO "CO2 molecular mass"; constant Real amH2O=2*amH+amO "H2O molecular mass"; constant Real amSO2=amS+2*amO "SO2 molecular mass"; + parameter Integer iN2=ThermoSysPro.Properties.Media.Functions.findSubstanceIndex(Medium_FlueGases.substanceNames, {"N2", "Nitrogen", "nitrogen"}) "Index of nitrogen in the flue gases composition"; + parameter Integer iO2=ThermoSysPro.Properties.Media.Functions.findSubstanceIndex(Medium_FlueGases.substanceNames, {"O2", "Oxygen", "oxygen"}) "Index of oxygen in the flue gases composition"; + parameter Integer iH2O=ThermoSysPro.Properties.Media.Functions.findSubstanceIndex(Medium_FlueGases.substanceNames, {"H2O", "Water", "water"}) "Index of water vapor in the flue gases composition"; + parameter Integer iCO2=ThermoSysPro.Properties.Media.Functions.findSubstanceIndex(Medium_FlueGases.substanceNames, {"CO2", "Carbondioxide", "Carbon dioxide", "carbondioxide"}) "Index of carbon dioxide in the flue gases composition"; + parameter Integer iSO2=ThermoSysPro.Properties.Media.Functions.findSubstanceIndex(Medium_FlueGases.substanceNames, {"SO2", "Sulfurdioxide", "Sulfur dioxide", "sulfurdioxide"}) "Index of sulfur dioxide in the flue gases composition"; parameter Units.SI.MassFlowRate gamma0=1.e-4 "Pseudo-diffusion conductance use for continuous flow reversal (active if diffusion=false and continuous_flow_reversal = true)"; @@ -109,7 +113,6 @@ public "Water specific enthalpy at the outlet"; Real MMairgaz(start=30) "Air/gas mixture molecular mass (g/mol)"; Real MMfumees(start=30) "Flue gases molecular mass (g/mol)"; - FluidType fluids[2] "Fluids mixing in volume"; Units.SI.SpecificEnthalpy h(start=10e5) "Flue gases specific enthalpy"; Units.SI.Power Jair "Thermal power diffusion from inlet Cair"; Units.SI.Power Jfg "Thermal power diffusion from outlet Cfg"; @@ -118,38 +121,36 @@ public Units.SI.MassFlowRate gamma_fg "Diffusion conductance for outlet Cfg"; Real rair "Value of r(Q/gamma) for inlet Cair"; Real rfg "Value of r(Q/gamma) for outlet Cfg"; - FluidType ftype_ws "Water/steam fluid type"; - Integer fluid_ws=Integer(ftype_ws) "Water/steam fluid number"; + Medium.MassFraction Xws[Medium.nXi](start=Medium.X_default[1:Medium.nXi]) "Water/steam mass fractions"; + Medium_FlueGases.MassFraction Xea[Medium_FlueGases.nX](start=Medium_FlueGases.X_default) "Air inlet mass fractions"; + Medium_FlueGases.MassFraction Xsf[Medium_FlueGases.nX](start=Medium_FlueGases.X_default) "Flue gases outlet mass fractions"; + Medium.ExtraProperty SubCws[Medium.nC](quantity=Medium.extraPropertiesNames, start=Medium.C_default) "Water/steam trace substances"; + Medium_FlueGases.ExtraProperty SubCfg[Medium_FlueGases.nC](quantity=Medium_FlueGases.extraPropertiesNames, start=Medium_FlueGases.C_default) "Flue gases trace substances"; public ThermoSysPro.Fluid.Interfaces.Connectors.FuelInlet Cfuel "Fuel inlet" annotation (Placement(transformation(extent={{-80,-100},{-60,-80}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Cair "Air inlet" + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Cair(redeclare package Medium = Medium_FlueGases) "Air inlet" annotation ( Placement(transformation(extent={{-10,-100},{10,-80}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cfg "Flue gases outlet" + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cfg(redeclare package Medium = Medium_FlueGases) "Flue gases outlet" annotation ( Placement(transformation(extent={{-10,80},{10,100}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Cws1 "Water inlet" + ThermoSysPro.Fluid.Interfaces.Connectors.FluidInlet Cws1(redeclare package Medium = Medium) "Water inlet" annotation ( Placement(transformation(extent={{-100,-10},{-80,10}}, rotation=0))); - ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cws2 + ThermoSysPro.Fluid.Interfaces.Connectors.FluidOutlet Cws2(redeclare package Medium = Medium) "Water/steam outlet" annotation ( Placement(transformation(extent={{80,-10},{100,10}}, rotation=0))); equation - /* Check that incoming fluids are compatible with fluid in volume */ - fluids[1] = ftype; - fluids[2] = Cair.ftype; - - assert(ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.isCompatible(fluids), "InternalCombustionEngine: fluids mixing in volume are not compatible with each other"); + assert(Medium_FlueGases.nX > 1, "InternalCombustionEngine: Medium_FlueGases must be a gas mixture"); + assert(iN2 > 0 and iO2 > 0 and iH2O > 0 and iCO2 > 0 and iSO2 > 0, "InternalCombustionEngine: Medium_FlueGases.substanceNames must contain nitrogen, oxygen, water, carbon dioxide and sulfur dioxide"); // ---------------- // Water/steam side - assert((ftype_ws == FluidType.WaterSteam) or (ftype_ws == FluidType.WaterSteamSimple), "InternalCombustionEngine: the fluid type for the water/steam side must be water/steam"); - Cws1.Q = Cws2.Q; Cws1.h_vol_1 = Cws2.h_vol_1; @@ -161,14 +162,10 @@ equation Cws2.diff_res_1 = Cws1.diff_res_1 + (if (gamma_diff_ws > 0) then 1/gamma_diff_ws else 0); Cws1.diff_res_2 = Cws2.diff_res_2 + (if (gamma_diff_ws > 0) then 1/gamma_diff_ws else 0); - Cws1.ftype = Cws2.ftype; - - Cws1.Xco2 = Cws2.Xco2; - Cws1.Xh2o = Cws2.Xh2o; - Cws1.Xo2 = Cws2.Xo2; - Cws1.Xso2 = Cws2.Xso2; - - ftype_ws = Cws1.ftype; + Cws1.Xi = Cws2.Xi; + Cws1.SubC = Cws2.SubC; + Xws = Cws1.Xi; + SubCws = Cws1.SubC; Qe = Cws1.Q; Hev = Cws1.h; @@ -194,10 +191,14 @@ equation Pea = Cair.P; Hea = Cair.h; /***/ - XeaCO2 = Cair.Xco2; - XeaH2O = Cair.Xh2o; - XeaO2 = Cair.Xo2; - XeaSO2 = Cair.Xso2; + Xea[1:Medium_FlueGases.nXi] = Cair.Xi; + if Medium_FlueGases.nXi < Medium_FlueGases.nX then + Xea[Medium_FlueGases.nX] = 1 - sum(Cair.Xi); + end if; + XeaCO2 = Xea[iCO2]; + XeaH2O = Xea[iH2O]; + XeaO2 = Xea[iO2]; + XeaSO2 = Xea[iSO2]; /* Flue gases outlet */ Qsf = Cfg.Q; @@ -229,12 +230,14 @@ equation 0 = Qea*XeaO2 - Qcomb*amO*(2*XCcomb/amC + 0.5*XHcomb/amH + 2*XScomb/amS) + Qcomb*XOcomb - XsfO2*Qsf; 0 = Qcomb*XScomb*amSO2/amS + Qea*XeaSO2 - XsfSO2*Qsf; - Cfg.ftype = ftype; - - Cfg.Xco2 = XsfCO2; - Cfg.Xh2o = XsfH2O; - Cfg.Xo2 = XsfO2; - Cfg.Xso2 = XsfSO2; + Xsf[iN2] = 1 - XsfCO2 - XsfH2O - XsfO2 - XsfSO2; + Xsf[iO2] = XsfO2; + Xsf[iH2O] = XsfH2O; + Xsf[iCO2] = XsfCO2; + Xsf[iSO2] = XsfSO2; + Cfg.Xi = Xsf[1:Medium_FlueGases.nXi]; + Cfg.SubC = Cair.SubC; + SubCfg = Cfg.SubC; /* No flow reversal */ Cfg.h = Cfg.h_vol_1; From 257ce97433140aedc4acb1192a1e30f49ec218d3 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Tue, 19 May 2026 14:28:43 +0200 Subject: [PATCH 168/178] #125 GasTurbine --- .../SimpleExamples/Machines/TestGasTurbine.mo | 120 ++++++++++++++++++ .../SimpleExamples/Machines/package.order | 1 + ThermoSysPro/Fluid/Machines/GasTurbine.mo | 19 ++- 3 files changed, 136 insertions(+), 4 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestGasTurbine.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestGasTurbine.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestGasTurbine.mo new file mode 100644 index 00000000..1d20227f --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestGasTurbine.mo @@ -0,0 +1,120 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Machines; +model TestGasTurbine + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; + replaceable package Medium_FlueGases = ThermoSysPro.Properties.Media.FlueGases; + + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ( + redeclare package Medium = Medium_FlueGases, + P0=1.013e5, + Q0=600, + T0=29.4 + 273.16, + option_temperature=true, + X0={1 - 0.20994,0.20994,0,0,0}) + annotation (Placement(transformation(extent={{-70,-10},{-50,10}}))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sink( + redeclare package Medium = Medium_FlueGases) + annotation (Placement(transformation(extent={{60,-10},{80,10}}))); + ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Constante humidity(k=0.93) + annotation (Placement(transformation(extent={{-100,30},{-80,50}}))); + ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Rampe fuel( + Starttime=200, + Duration=800, + Initialvalue=13.507, + Finalvalue=8.756) + annotation (Placement(transformation(extent={{-40,60},{-20,80}}))); + ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Rampe air( + Starttime=200, + Duration=800, + Initialvalue=592.7, + Finalvalue=415.70) + annotation (Placement(transformation(extent={{-98,0},{-78,20}}))); + ThermoSysPro.Fluid.Combustion.BoundaryConditions.FuelSourcePQ fuelSourcePQ( + Q0=13.4368286133, + T0=185 + 273.16, + LHV=46989e3, + Cp=2255, + Xc=0.755, + Xh=0.245, + rho=0.838) + annotation (Placement(transformation(extent={{-20,40},{0,60}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ water( + redeclare package Medium = Medium, + Q0=0) + annotation (Placement(transformation(extent={{-60,40},{-40,60}}))); + ThermoSysPro.Fluid.Machines.GasTurbine gasTurbine( + redeclare package Medium = Medium, + redeclare package Medium_FlueGases = Medium_FlueGases, + comp_tau_n=14.0178, + comp_eff_n=0.87004, + exp_tau_n=0.06458, + exp_eff_n=0.89045, + TurbQred=0.0175634, + Kcham=2.02088, + Wpth=1e6, + Compresseur( + Ps(start=1404200.0), + He(start=2.5525e6), + Hs(start=3.008e6), + His(start=2.95e6), + Te(start=302.56000000000006), + Tis(start=630.0), + Ts(start=729.0)), + TurbineAgaz( + He(start=4.0e6), + Hs(start=3.24e6), + His(start=3.1e6), + Tis(start=847.0)), + chambreCombustionTAC( + Psf(start=1310000.0), + Tea(start=729.0), + Hsf(start=4.0e6), + Tsf(start=1532.57)), + xAIR( + T(start=302.56000000000006), + ppvap0(start=4104.0), + rho_air(start=1.0836), + rho_vap(start=0.029))) + annotation (Placement(transformation(extent={{-30,-28},{30,28}}))); +equation + connect(air.y, sourcePQ.IMassFlow) + annotation (Line(points={{-77,10},{-60,10},{-60,5}}, color={0,0,255})); + connect(humidity.y, gasTurbine.Huminide) annotation (Line(points={{-79,40},{ + -60,40},{-60,16.8},{-31.2,16.8}},color={0,0,255})); + connect(fuel.y, fuelSourcePQ.IMassFlow) + annotation (Line(points={{-19,70},{-10,70},{-10,55}}, + color={0,0,255})); + connect(sourcePQ.C, gasTurbine.Entree_air) annotation (Line(points={{-50,0},{ + -32,0},{-32,3.55271e-015},{-30,3.55271e-015}}, color={0,0,0})); + connect(fuelSourcePQ.C, gasTurbine.Entree_combustible) + annotation (Line(points={{0,50},{18,50},{18,28}}, color={0,0,0})); + connect(water.C, gasTurbine.Entree_eau_combustion) + annotation (Line(points={{-40,50},{-18,50},{-18,28}}, color={0,0,0})); + connect(gasTurbine.Sortie_fumees, sink.C) + annotation (Line(points={{30,3.55271e-015},{46,3.55271e-015},{46,0},{60,0}}, + color={0,0,0})); + annotation (Icon(graphics={ + Rectangle( + lineColor={200,200,200}, + fillColor={248,248,248}, + fillPattern=FillPattern.HorizontalCylinder, + extent={{-100.0,-100.0},{100.0,100.0}}, + radius=25.0), + Rectangle( + lineColor={128,128,128}, + extent={{-100.0,-100.0},{100.0,100.0}}, + radius=25.0), + Polygon( + origin={8.0,14.0}, + lineColor={78,138,73}, + fillColor={78,138,73}, + pattern=LinePattern.None, + fillPattern=FillPattern.Solid, + points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), + Documentation(info=" +

    Copyright © EDF 2002 - 2024

    +

    ThermoSysPro Version 4.1

    +"), + experiment(StopTime=1200)); +end TestGasTurbine; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/package.order index 45bab71a..e900b238 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/package.order @@ -8,6 +8,7 @@ TestCentrifugalPump_FlueGases TestCentrifugalPump_Traces TestCombustionTurbine TestCombustionTurbine_Traces +TestGasTurbine TestInternalCombustionEngine TestCHPEngineBarkantineSystem TestCompressor diff --git a/ThermoSysPro/Fluid/Machines/GasTurbine.mo b/ThermoSysPro/Fluid/Machines/GasTurbine.mo index 25231cb2..195b6d16 100644 --- a/ThermoSysPro/Fluid/Machines/GasTurbine.mo +++ b/ThermoSysPro/Fluid/Machines/GasTurbine.mo @@ -1,5 +1,8 @@ within ThermoSysPro.Fluid.Machines; model GasTurbine "Combustion turbine for CICO and Barilla plants" + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model for the water/steam side" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + replaceable package Medium_FlueGases = ThermoSysPro.Properties.Media.FlueGases constrainedby ThermoSysPro.Properties.Media.PartialSubCMedium "Medium model for the flue gases side" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); + parameter Real comp_tau_n=15 "Nominal compression nominal rate"; parameter Real comp_eff_n=0.9 "Compressor nominal efficiency"; parameter Real A0=0.1725914; @@ -16,12 +19,14 @@ model GasTurbine "Combustion turbine for CICO and Barilla plants" parameter Real Kcham=1 "Chamber pressure loss coefficient"; parameter Units.SI.Power Wpth=1e5 "Combustion chamber thermal losses"; - ThermoSysPro.Fluid.BoundaryConditions.AirHumidity xAIR + ThermoSysPro.Fluid.BoundaryConditions.AirHumidity xAIR( + redeclare package Medium = Medium_FlueGases) annotation (Placement(transformation( origin={-84,30}, extent={{-10,-10},{10,10}}, rotation=270))); ThermoSysPro.Fluid.Machines.Compressor Compresseur( + redeclare package Medium = Medium_FlueGases, A4=A4, A3=A3, A2=A2, @@ -31,6 +36,8 @@ model GasTurbine "Combustion turbine for CICO and Barilla plants" is_eff_n=comp_eff_n) annotation (Placement(transformation( extent={{-82,-28},{-32,28}}, rotation=0))); ThermoSysPro.Fluid.Combustion.CombustionChambers.GTCombustionChamber chambreCombustionTAC( + redeclare package Medium = Medium, + redeclare package Medium_FlueGases = Medium_FlueGases, Acham=1, eta_comb=1, kcham=Kcham, @@ -42,6 +49,7 @@ model GasTurbine "Combustion turbine for CICO and Barilla plants" Tsf(start=1495)) annotation (Placement(transformation(extent={{-25,31},{ 25,83}}, rotation=0))); ThermoSysPro.Fluid.Machines.CombustionTurbine TurbineAgaz( + redeclare package Medium = Medium_FlueGases, Te(start=1495), Pe(start=13.2e5), A2=B2, @@ -54,11 +62,14 @@ model GasTurbine "Combustion turbine for CICO and Barilla plants" Ts(start=894.518, fixed=false)) annotation (Placement(transformation(extent= {{47,-22},{79,22}}, rotation=0))); - Interfaces.Connectors.FluidInlet Entree_air annotation (Placement( + Interfaces.Connectors.FluidInlet Entree_air(redeclare package Medium = + Medium_FlueGases) annotation (Placement( transformation(extent={{-104,-4},{-96,4}}, rotation=0))); - Interfaces.Connectors.FluidOutlet Sortie_fumees annotation (Placement( + Interfaces.Connectors.FluidOutlet Sortie_fumees(redeclare package Medium = + Medium_FlueGases) annotation (Placement( transformation(extent={{96,-4},{104,4}}, rotation=0))); - Interfaces.Connectors.FluidInlet Entree_eau_combustion annotation (Placement( + Interfaces.Connectors.FluidInlet Entree_eau_combustion(redeclare package + Medium = Medium) annotation (Placement( transformation(extent={{-64,96},{-56,104}}, rotation=0))); Interfaces.Connectors.FuelInlet Entree_combustible annotation (Placement(transformation(extent={{56,96},{64,104}}, rotation=0))); From bed2e266f3aaa1b5681ce9546060fc44c249fd49 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Tue, 19 May 2026 14:43:58 +0200 Subject: [PATCH 169/178] #125 C3H3F5 media --- .../Properties/Media/C3H3F5/package.mo | 609 ++++++++++++++++++ .../Properties/Media/C3H3F5/package.order | 59 ++ ThermoSysPro/Properties/Media/package.order | 1 + 3 files changed, 669 insertions(+) create mode 100644 ThermoSysPro/Properties/Media/C3H3F5/package.mo create mode 100644 ThermoSysPro/Properties/Media/C3H3F5/package.order diff --git a/ThermoSysPro/Properties/Media/C3H3F5/package.mo b/ThermoSysPro/Properties/Media/C3H3F5/package.mo new file mode 100644 index 00000000..a4fbfc64 --- /dev/null +++ b/ThermoSysPro/Properties/Media/C3H3F5/package.mo @@ -0,0 +1,609 @@ +within ThermoSysPro.Properties.Media; +package C3H3F5 "C3H3F5 medium using the legacy ThermoSysPro property functions" + + extends PartialTwoPhaseThermoSysProMedium( + isCompressible=true, + mediumName="C3H3F5", + substanceNames={"C3H3F5"}, + singleState=false, + SpecificEnthalpy(start=3.0e5, nominal=3.0e5, min=h_min, max=h_max), + Density(start=1000, nominal=1000), + AbsolutePressure(start=10e5, nominal=10e5, min=p_min, max=p_crit), + Temperature(start=300, nominal=300), + smoothModel=false, + onePhase=false, + fluidConstants={c3h3f5Constants}, + ThermoStates=Modelica.Media.Interfaces.Choices.IndependentVariables.ph); + + constant AbsolutePressure p_min=1 "Lower pressure bound of the legacy fit"; + constant AbsolutePressure p_crit=3640000 "Critical pressure used by the legacy fit"; + constant SpecificEnthalpy h_min=100000 "Lower enthalpy bound of the legacy fit"; + constant SpecificEnthalpy h_max=640000 "Upper enthalpy bound of the legacy fit"; + constant Temperature T_min=200 "Lower temperature search bound"; + constant Temperature T_max=6000 "Upper temperature search bound"; + + constant FluidConstants c3h3f5Constants( + iupacName="C3H3F5", + casRegistryNumber="", + chemicalFormula="C3H3F5", + structureFormula="", + molarMass=0.134047); + + redeclare record extends SaturationProperties + end SaturationProperties; + + redeclare record extends ThermodynamicState "Thermodynamic state" + SpecificEnthalpy h "Specific enthalpy"; + Density d "Density"; + Temperature T "Temperature"; + AbsolutePressure p "Pressure"; + end ThermodynamicState; + +protected + function saturationTemperature_p + input AbsolutePressure p "Pressure"; + output Temperature T "Saturation temperature"; + protected + AbsolutePressure Pcalc; + algorithm + if p > p_crit then + Pcalc := p_crit/100000; + elseif p <= 0 then + Pcalc := 1/100000; + else + Pcalc := p/100000; + end if; + + T := -0.0000033655*Pcalc^6 + 0.0004044854*Pcalc^5 - 0.0190328128*Pcalc^4 + + 0.4443722095*Pcalc^3 - 5.4337547883*Pcalc^2 + + 36.7572359309*Pcalc + 246.4280421048; + annotation (Inline=true); + end saturationTemperature_p; + + function temperatureResidual_h + extends Modelica.Math.Nonlinear.Interfaces.partialScalarFunction; + input AbsolutePressure p "Pressure"; + input Temperature T "Temperature"; + protected + ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro; + algorithm + pro := ThermoSysPro.Properties.C3H3F5.C3H3F5_Ph(p, u); + y := pro.T - T; + end temperatureResidual_h; + + function saturationPressureResidual_p + extends Modelica.Math.Nonlinear.Interfaces.partialScalarFunction; + input Temperature T "Saturation temperature"; + algorithm + y := saturationTemperature_p(u) - T; + end saturationPressureResidual_p; + +public + redeclare replaceable model extends BaseProperties( + h(stateSelect=StateSelect.prefer), + d(stateSelect=StateSelect.default), + T(stateSelect=StateSelect.default), + p(stateSelect=StateSelect.prefer)) + "Base properties of C3H3F5" + Integer phase( + min=0, + max=2, + start=1, + fixed=false) "2 for two-phase, 1 for one-phase, 0 if not known"; + protected + ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro; + equation + pro = ThermoSysPro.Properties.C3H3F5.C3H3F5_Ph(p, h); + MM = fluidConstants[1].molarMass; + R_s = Modelica.Constants.R/fluidConstants[1].molarMass; + + phase = if pro.x > 0 and pro.x < 1 then 2 else 1; + sat = setSat_p(p); + state = ThermodynamicState( + p=p, + h=h, + T=pro.T, + d=pro.d, + phase=phase); + + T = pro.T; + d = pro.d; + u = h - p/d; + end BaseProperties; + + redeclare function density_ph + "Computes density as a function of pressure and specific enthalpy" + extends Modelica.Icons.Function; + input AbsolutePressure p "Pressure"; + input SpecificEnthalpy h "Specific enthalpy"; + input FixedPhase phase=0 "2 for two-phase, 1 for one-phase, 0 if not known"; + output Density d "Density"; + protected + ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro; + algorithm + pro := ThermoSysPro.Properties.C3H3F5.C3H3F5_Ph(p, h); + d := pro.d; + annotation (Inline=true); + end density_ph; + + redeclare function temperature_ph + "Computes temperature as a function of pressure and specific enthalpy" + extends Modelica.Icons.Function; + input AbsolutePressure p "Pressure"; + input SpecificEnthalpy h "Specific enthalpy"; + input FixedPhase phase=0 "2 for two-phase, 1 for one-phase, 0 if not known"; + output Temperature T "Temperature"; + protected + ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro; + algorithm + pro := ThermoSysPro.Properties.C3H3F5.C3H3F5_Ph(p, h); + T := pro.T; + annotation (Inline=true); + end temperature_ph; + + redeclare function extends setState_phX + "Return thermodynamic state as function of p and h" + protected + ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro; + algorithm + pro := ThermoSysPro.Properties.C3H3F5.C3H3F5_Ph(p, h); + state := ThermodynamicState( + p=p, + h=h, + T=pro.T, + d=pro.d, + phase=if pro.x > 0 and pro.x < 1 then 2 else 1); + annotation (Inline=true); + end setState_phX; + + redeclare function extends setState_psX + "Return thermodynamic state as function of p and s" + protected + ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ps pro; + algorithm + pro := ThermoSysPro.Properties.C3H3F5.C3H3F5_Ps(p, s); + state := ThermodynamicState( + p=p, + h=pro.h, + T=pro.T, + d=pro.d, + phase=if pro.x > 0 and pro.x < 1 then 2 else 1); + annotation (Inline=true); + end setState_psX; + + redeclare function specificEnthalpy_pT + "Compute specific enthalpy from p and T by inverting the legacy C3H3F5_Ph fit" + extends Modelica.Icons.Function; + input AbsolutePressure p "Pressure"; + input Temperature T "Temperature"; + input FixedPhase phase=0 "2 for two-phase, 1 for one-phase, 0 if not known"; + output SpecificEnthalpy h "Specific enthalpy"; + protected + Temperature Tlow; + Temperature Thigh; + ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph proLow; + ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph proHigh; + algorithm + proLow := ThermoSysPro.Properties.C3H3F5.C3H3F5_Ph(p, h_min); + proHigh := ThermoSysPro.Properties.C3H3F5.C3H3F5_Ph(p, h_max); + Tlow := proLow.T; + Thigh := proHigh.T; + + if T <= Tlow then + h := h_min; + elseif T >= Thigh then + h := h_max; + else + h := Modelica.Math.Nonlinear.solveOneNonlinearEquation( + function temperatureResidual_h(p=p, T=T), + h_min, + h_max); + end if; + end specificEnthalpy_pT; + + redeclare function specificEnthalpy_pTX + "Return specific enthalpy from pressure and temperature" + extends Modelica.Icons.Function; + input AbsolutePressure p "Pressure"; + input Temperature T "Temperature"; + input MassFraction X[:] "Mass fractions"; + input FixedPhase phase=0 + "2 for two-phase, 1 for one-phase, 0 if not known"; + output SpecificEnthalpy h "Specific enthalpy at p, T, X"; + algorithm + h := specificEnthalpy_pT(p, T, phase); + annotation (Inline=true); + end specificEnthalpy_pTX; + + redeclare function density_pT + "Computes density as a function of pressure and temperature" + extends Modelica.Icons.Function; + input AbsolutePressure p "Pressure"; + input Temperature T "Temperature"; + input FixedPhase phase=0 "2 for two-phase, 1 for one-phase, 0 if not known"; + output Density d "Density"; + algorithm + d := density_ph(p, specificEnthalpy_pT(p, T, phase), phase); + annotation (Inline=true); + end density_pT; + + redeclare function extends setState_pTX + "Return thermodynamic state as function of p and T" + protected + SpecificEnthalpy h; + ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro; + algorithm + h := specificEnthalpy_pT(p, T, phase); + pro := ThermoSysPro.Properties.C3H3F5.C3H3F5_Ph(p, h); + state := ThermodynamicState( + p=p, + h=h, + T=pro.T, + d=pro.d, + phase=if pro.x > 0 and pro.x < 1 then 2 else 1); + annotation (Inline=true); + end setState_pTX; + + redeclare function extends setState_dTX + "Return thermodynamic state as function of d and T" + algorithm + assert(false, "C3H3F5: setState_dTX is not available in the legacy ThermoSysPro implementation"); + state := ThermodynamicState( + p=p_min, + h=h_min, + T=T, + d=d, + phase=phase); + end setState_dTX; + + redeclare function extends setSmoothState + "Return a smooth thermodynamic state" + import Modelica.Media.Common.smoothStep; + algorithm + state := ThermodynamicState( + p=smoothStep(x, state_a.p, state_b.p, x_small), + h=smoothStep(x, state_a.h, state_b.h, x_small), + T=temperature_ph( + smoothStep(x, state_a.p, state_b.p, x_small), + smoothStep(x, state_a.h, state_b.h, x_small)), + d=density_ph( + smoothStep(x, state_a.p, state_b.p, x_small), + smoothStep(x, state_a.h, state_b.h, x_small)), + phase=0); + annotation (Inline=true); + end setSmoothState; + + redeclare function temperature_ps + "Compute temperature from pressure and specific entropy" + extends Modelica.Icons.Function; + input AbsolutePressure p "Pressure"; + input SpecificEntropy s "Specific entropy"; + input FixedPhase phase=0 "2 for two-phase, 1 for one-phase, 0 if not known"; + output Temperature T "Temperature"; + protected + ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ps pro; + algorithm + pro := ThermoSysPro.Properties.C3H3F5.C3H3F5_Ps(p, s); + T := pro.T; + annotation (Inline=true); + end temperature_ps; + + redeclare function density_ps + "Computes density as a function of pressure and specific entropy" + extends Modelica.Icons.Function; + input AbsolutePressure p "Pressure"; + input SpecificEntropy s "Specific entropy"; + input FixedPhase phase=0 "2 for two-phase, 1 for one-phase, 0 if not known"; + output Density d "Density"; + protected + ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ps pro; + algorithm + pro := ThermoSysPro.Properties.C3H3F5.C3H3F5_Ps(p, s); + d := pro.d; + annotation (Inline=true); + end density_ps; + + redeclare function extends pressure "Return pressure" + algorithm + p := state.p; + annotation (Inline=true); + end pressure; + + redeclare function extends temperature "Return temperature" + algorithm + T := state.T; + annotation (Inline=true); + end temperature; + + redeclare function extends density "Return density" + algorithm + d := state.d; + annotation (Inline=true); + end density; + + redeclare function extends specificEnthalpy "Return specific enthalpy" + algorithm + h := state.h; + annotation (Inline=true); + end specificEnthalpy; + + redeclare function extends specificInternalEnergy + "Return specific internal energy" + algorithm + u := state.h - state.p/state.d; + annotation (Inline=true); + end specificInternalEnergy; + + redeclare function extends specificEntropy "Specific entropy" + protected + ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro; + algorithm + pro := ThermoSysPro.Properties.C3H3F5.C3H3F5_Ph(state.p, state.h); + s := pro.s; + annotation (Inline=true); + end specificEntropy; + + redeclare function extends specificGibbsEnergy "Return specific Gibbs energy" + algorithm + g := state.h - state.T*specificEntropy(state); + annotation (Inline=true); + end specificGibbsEnergy; + + redeclare function extends specificHelmholtzEnergy + "Return specific Helmholtz energy" + algorithm + f := state.h - state.p/state.d - state.T*specificEntropy(state); + annotation (Inline=true); + end specificHelmholtzEnergy; + + redeclare function extends specificHeatCapacityCp + "Approximate specific heat capacity at constant pressure" + protected + constant Temperature dT=0.1; + algorithm + cp := (specificEnthalpy_pT(state.p, state.T + dT) - specificEnthalpy_pT(state.p, state.T - dT))/(2*dT); + annotation (Inline=true); + end specificHeatCapacityCp; + + redeclare function extends specificHeatCapacityCv + "Approximate specific heat capacity at constant volume" + algorithm + cv := specificHeatCapacityCp(state); + annotation (Inline=true); + end specificHeatCapacityCv; + + redeclare function extends velocityOfSound + "Velocity of sound is not available in the legacy C3H3F5 implementation" + algorithm + assert(false, "C3H3F5: velocityOfSound is not available in the legacy ThermoSysPro implementation"); + a := 0; + end velocityOfSound; + + redeclare function extends isentropicEnthalpy "Compute h(s,p)" + protected + ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ps pro; + algorithm + pro := ThermoSysPro.Properties.C3H3F5.C3H3F5_Ps(p_downstream, specificEntropy(refState)); + h_is := pro.h; + annotation (Inline=true); + end isentropicEnthalpy; + + redeclare function extends dynamicViscosity + "Dynamic viscosity is not available in the legacy C3H3F5 implementation" + algorithm + assert(false, "C3H3F5: dynamicViscosity is not available in the legacy ThermoSysPro implementation"); + eta := 0; + end dynamicViscosity; + + redeclare function extends thermalConductivity + "Thermal conductivity is not available in the legacy C3H3F5 implementation" + algorithm + assert(false, "C3H3F5: thermalConductivity is not available in the legacy ThermoSysPro implementation"); + lambda := 0; + end thermalConductivity; + + redeclare function extends surfaceTension + "Surface tension is not available in the legacy C3H3F5 implementation" + algorithm + assert(false, "C3H3F5: surfaceTension is not available in the legacy ThermoSysPro implementation"); + sigma := 0; + end surfaceTension; + + redeclare function extends saturationTemperature + "Saturation temperature" + algorithm + T := saturationTemperature_p(p); + annotation (Inline=true); + end saturationTemperature; + + redeclare function extends saturationTemperature_derp + "Derivative of saturation temperature w.r.t. pressure" + protected + constant AbsolutePressure dp=1; + algorithm + dTp := (saturationTemperature_p(p + dp) - saturationTemperature_p(p - dp))/(2*dp); + annotation (Inline=true); + end saturationTemperature_derp; + + redeclare function extends saturationPressure + "Saturation pressure" + protected + Temperature Tlow; + Temperature Thigh; + algorithm + Tlow := saturationTemperature_p(p_min); + Thigh := saturationTemperature_p(p_crit); + + if T <= Tlow then + p := p_min; + elseif T >= Thigh then + p := p_crit; + else + p := Modelica.Math.Nonlinear.solveOneNonlinearEquation( + function saturationPressureResidual_p(T=T), + p_min, + p_crit); + end if; + end saturationPressure; + + redeclare function setSat_p + "Return saturation properties from pressure" + extends Modelica.Icons.Function; + input AbsolutePressure p "Pressure"; + output SaturationProperties sat "Saturation property record"; + algorithm + sat := SaturationProperties( + psat=p, + Tsat=saturationTemperature_p(p)); + annotation (Inline=true); + end setSat_p; + + redeclare function setSat_T + "Return saturation properties from temperature" + extends Modelica.Icons.Function; + input Temperature T "Temperature"; + output SaturationProperties sat "Saturation property record"; + algorithm + sat := SaturationProperties( + psat=saturationPressure(T), + Tsat=T); + annotation (Inline=true); + end setSat_T; + + redeclare function extends bubbleEnthalpy + "Boiling curve specific enthalpy" + protected + AbsolutePressure Pcalc; + algorithm + Pcalc := max(p_min, min(p_crit, sat.psat))/100000; + hl := 1000*(-0.0000039275*Pcalc^6 + 0.0004780040*Pcalc^5 + - 0.0227439765*Pcalc^4 + 0.5370471515*Pcalc^3 + - 6.6496487588*Pcalc^2 + 46.8685173786*Pcalc + + 166.7823742593); + annotation (Inline=true); + end bubbleEnthalpy; + + redeclare function extends dewEnthalpy + "Dew curve specific enthalpy" + protected + AbsolutePressure Pcalc; + algorithm + Pcalc := max(p_min, min(p_crit, sat.psat))/100000; + hv := 1000*(-0.00000274*Pcalc^6 + 0.00032217*Pcalc^5 + - 0.01489673*Pcalc^4 + 0.34258030*Pcalc^3 + - 4.15381744*Pcalc^2 + 27.64876596*Pcalc + + 385.22149853); + annotation (Inline=true); + end dewEnthalpy; + + redeclare function extends bubbleDensity + "Boiling curve density" + protected + AbsolutePressure Pcalc; + algorithm + Pcalc := max(p_min, min(p_crit, sat.psat))/100000; + dl := 0.0000057803*Pcalc^6 - 0.0007528646*Pcalc^5 + + 0.0377373800*Pcalc^4 - 0.9314090824*Pcalc^3 + + 11.9184348938*Pcalc^2 - 89.9582798898*Pcalc + + 1467.5902188299; + annotation (Inline=true); + end bubbleDensity; + + redeclare function extends dewDensity + "Dew curve density" + protected + AbsolutePressure Pcalc; + algorithm + Pcalc := max(p_min, min(p_crit, sat.psat))/100000; + dv := 0.00000207*Pcalc^6 - 0.00019163*Pcalc^5 + + 0.00675913*Pcalc^4 - 0.10924667*Pcalc^3 + + 0.84661954*Pcalc^2 + 2.83415571*Pcalc + + 2.12959146; + annotation (Inline=true); + end dewDensity; + + redeclare function extends bubbleEntropy + "Boiling curve specific entropy" + protected + ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro; + algorithm + pro := ThermoSysPro.Properties.C3H3F5.C3H3F5_Ph(sat.psat, bubbleEnthalpy(sat)); + sl := pro.s; + annotation (Inline=true); + end bubbleEntropy; + + redeclare function extends dewEntropy + "Dew curve specific entropy" + protected + ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro; + algorithm + pro := ThermoSysPro.Properties.C3H3F5.C3H3F5_Ph(sat.psat, dewEnthalpy(sat)); + sv := pro.s; + annotation (Inline=true); + end dewEntropy; + + redeclare function extends setBubbleState + "Set the thermodynamic state on the bubble line" + algorithm + state := setState_phX(sat.psat, bubbleEnthalpy(sat), fill(0, 0), phase); + annotation (Inline=true); + end setBubbleState; + + redeclare function extends setDewState + "Set the thermodynamic state on the dew line" + algorithm + state := setState_phX(sat.psat, dewEnthalpy(sat), fill(0, 0), phase); + annotation (Inline=true); + end setDewState; + + redeclare function extends dBubbleDensity_dPressure + "Bubble point density derivative" + algorithm + ddldp := 0; + annotation (Inline=true); + end dBubbleDensity_dPressure; + + redeclare function extends dDewDensity_dPressure + "Dew point density derivative" + algorithm + ddvdp := 0; + annotation (Inline=true); + end dDewDensity_dPressure; + + redeclare function extends dBubbleEnthalpy_dPressure + "Bubble point specific enthalpy derivative" + algorithm + dhldp := 0; + annotation (Inline=true); + end dBubbleEnthalpy_dPressure; + + redeclare function extends dDewEnthalpy_dPressure + "Dew point specific enthalpy derivative" + algorithm + dhvdp := 0; + annotation (Inline=true); + end dDewEnthalpy_dPressure; + + redeclare function extends density_derh_p + "Density derivative by specific enthalpy" + protected + constant SpecificEnthalpy dh=1; + algorithm + ddhp := (density_ph(state.p, state.h + dh) - density_ph(state.p, state.h - dh))/(2*dh); + annotation (Inline=true); + end density_derh_p; + + redeclare function extends density_derp_h + "Density derivative by pressure" + protected + constant AbsolutePressure dp=1; + algorithm + ddph := (density_ph(state.p + dp, state.h) - density_ph(state.p - dp, state.h))/(2*dp); + annotation (Inline=true); + end density_derp_h; + + annotation (Documentation(info=" +

    Copyright © EDF 2002 - 2024

    +

    ThermoSysPro Version 4.1

    +")); +end C3H3F5; diff --git a/ThermoSysPro/Properties/Media/C3H3F5/package.order b/ThermoSysPro/Properties/Media/C3H3F5/package.order new file mode 100644 index 00000000..5018ecc8 --- /dev/null +++ b/ThermoSysPro/Properties/Media/C3H3F5/package.order @@ -0,0 +1,59 @@ +p_min +p_crit +h_min +h_max +T_min +T_max +c3h3f5Constants +SaturationProperties +ThermodynamicState +saturationTemperature_p +temperatureResidual_h +saturationPressureResidual_p +BaseProperties +density_ph +temperature_ph +setState_phX +setState_psX +specificEnthalpy_pT +specificEnthalpy_pTX +density_pT +setState_pTX +setState_dTX +setSmoothState +temperature_ps +density_ps +pressure +temperature +density +specificEnthalpy +specificInternalEnergy +specificEntropy +specificGibbsEnergy +specificHelmholtzEnergy +specificHeatCapacityCp +specificHeatCapacityCv +velocityOfSound +isentropicEnthalpy +dynamicViscosity +thermalConductivity +surfaceTension +saturationTemperature +saturationTemperature_derp +saturationPressure +setSat_p +setSat_T +bubbleEnthalpy +dewEnthalpy +bubbleDensity +dewDensity +bubbleEntropy +dewEntropy +setBubbleState +setDewState +dBubbleDensity_dPressure +dDewDensity_dPressure +dBubbleEnthalpy_dPressure +dDewEnthalpy_dPressure +density_derh_p +density_derp_h diff --git a/ThermoSysPro/Properties/Media/package.order b/ThermoSysPro/Properties/Media/package.order index bb249bcc..5d7b2ae9 100644 --- a/ThermoSysPro/Properties/Media/package.order +++ b/ThermoSysPro/Properties/Media/package.order @@ -4,3 +4,4 @@ PartialTwoPhaseThermoSysProMedium Functions WaterSteam FlueGases +C3H3F5 From 62b54a403addc3e947383cdad9f0e2b01924b491 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Tue, 19 May 2026 14:44:24 +0200 Subject: [PATCH 170/178] #125 HeatPumpCompressor with C3H3F5 --- .../Machines/TestHeatPumpCompressor.mo | 55 +++++++++++++++++++ .../SimpleExamples/Machines/package.order | 1 + .../Fluid/Machines/HeatPumpCompressor.mo | 29 +++------- ThermoSysPro/Properties/C3H3F5/C3H3F5_Ph.mo | 6 ++ 4 files changed, 71 insertions(+), 20 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestHeatPumpCompressor.mo diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestHeatPumpCompressor.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestHeatPumpCompressor.mo new file mode 100644 index 00000000..d4210dc3 --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/TestHeatPumpCompressor.mo @@ -0,0 +1,55 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Machines; +model TestHeatPumpCompressor + extends ThermoSysPro.UsersGuide.Icons.Example; + + replaceable package Medium = ThermoSysPro.Properties.Media.C3H3F5; + + ThermoSysPro.Fluid.Machines.HeatPumpCompressor Compressor( + redeclare package Medium = Medium, + Pe(fixed=false, start=100000), + Ts(fixed=false, start=680)) + annotation (Placement(transformation(extent={{-52,-52},{48,52}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ SourceQ1( + redeclare package Medium = Medium, + Q0=420, + h0=3.e5, + T0=288, + option_temperature=false) + annotation (Placement(transformation(extent={{-104,-10},{-84,10}}, + rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP SinkP1( + redeclare package Medium = Medium, + P0=1580000, + option_temperature=false) + annotation (Placement(transformation( + origin={96,0}, + extent={{10,-10},{-10,10}}, + rotation=180))); +equation + connect(SourceQ1.C, Compressor.C1) + annotation (Line(points={{-84,0},{-52,0}}, color={0,0,0})); + connect(SinkP1.C, Compressor.C2) + annotation (Line(points={{86,0},{48,0}}, color={0,0,0})); + annotation (Icon(graphics={ + Rectangle( + lineColor={200,200,200}, + fillColor={248,248,248}, + fillPattern=FillPattern.HorizontalCylinder, + extent={{-100.0,-100.0},{100.0,100.0}}, + radius=25.0), + Rectangle( + lineColor={128,128,128}, + extent={{-100.0,-100.0},{100.0,100.0}}, + radius=25.0), + Polygon( + origin={8.0,14.0}, + lineColor={78,138,73}, + fillColor={78,138,73}, + pattern=LinePattern.None, + fillPattern=FillPattern.Solid, + points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), + Documentation(info=" +

    Copyright © EDF 2002 - 2024

    +

    ThermoSysPro Version 4.1

    +")); +end TestHeatPumpCompressor; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/package.order index e900b238..a20912f4 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Machines/package.order @@ -9,6 +9,7 @@ TestCentrifugalPump_Traces TestCombustionTurbine TestCombustionTurbine_Traces TestGasTurbine +TestHeatPumpCompressor TestInternalCombustionEngine TestCHPEngineBarkantineSystem TestCompressor diff --git a/ThermoSysPro/Fluid/Machines/HeatPumpCompressor.mo b/ThermoSysPro/Fluid/Machines/HeatPumpCompressor.mo index 12505323..85622e51 100644 --- a/ThermoSysPro/Fluid/Machines/HeatPumpCompressor.mo +++ b/ThermoSysPro/Fluid/Machines/HeatPumpCompressor.mo @@ -1,7 +1,7 @@ within ThermoSysPro.Fluid.Machines; model HeatPumpCompressor "Heat pump compressor " - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType; - import ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region; + replaceable package Medium = ThermoSysPro.Properties.Media.C3H3F5 constrainedby ThermoSysPro.Properties.Media.PartialTwoPhaseThermoSysProMedium + "Medium model" annotation (choicesAllMatching=true, Dialog(tab="Fluid", group="Medium")); parameter Real pi=10.0 "Compression factor (Ps/Pe)"; parameter Real eta=0.85 "Isentropic efficiency"; @@ -20,12 +20,10 @@ public Units.SI.Temperature Te "Inlet temperature"; Units.SI.Temperature Ts "Outlet temperature"; Real xm(start=1.0) "Average vapor mass fraction"; - FluidType ftype "Fluid type"; - Integer fluid=Integer(ftype) "Fluid number"; - Interfaces.Connectors.FluidInlet C1 annotation (Placement(transformation( + Interfaces.Connectors.FluidInlet C1(redeclare package Medium = Medium) annotation (Placement(transformation( extent={{-110,-10},{-90,10}}, rotation=0))); - Interfaces.Connectors.FluidOutlet C2 annotation (Placement(transformation( + Interfaces.Connectors.FluidOutlet C2(redeclare package Medium = Medium) annotation (Placement(transformation( extent={{90,-10},{110,10}}, rotation=0))); public ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph proe @@ -38,9 +36,6 @@ public rotation=0))); equation - /* Check that the fluid type is C3H3F5 */ - assert(ftype == FluidType.C3H3F5, "HeatPumpCompressor: the fluid type must be C3H3F5"); - C1.Q = C2.Q; C1.h_vol_1 = C2.h_vol_1; @@ -52,19 +47,13 @@ equation C2.diff_res_1 = C1.diff_res_1 + (if (gamma_diff > 0) then 1/gamma_diff else 0); C1.diff_res_2 = C2.diff_res_2 + (if (gamma_diff > 0) then 1/gamma_diff else 0); - C1.ftype = C2.ftype; - - C1.Xco2 = C2.Xco2; - C1.Xh2o = C2.Xh2o; - C1.Xo2 = C2.Xo2; - C1.Xso2 = C2.Xso2; + C1.SubC = C2.SubC; + C1.Xi = C2.Xi; Q = C1.Q; Pe = C1.P; Ps = C2.P; - ftype = C1.ftype; - /* Mechnical power delivered to the compressor */ W = Q*(C2.h - C1.h) / (1 - W_fric/100); @@ -78,15 +67,15 @@ equation His - C1.h = max(xm, 0.01)*eta*(C2.h - C1.h); /* Fluid thermodynamic properties before the compression */ - proe = ThermoSysPro.Properties.Fluid.Ph(Pe, C1.h, 0, fluid); + proe = ThermoSysPro.Properties.C3H3F5.C3H3F5_Ph(Pe, C1.h); Te = proe.T; /* Fluid thermodynamic properties after the compression */ - pros = ThermoSysPro.Properties.Fluid.Ph(Ps, C2.h, 0, fluid); + pros = ThermoSysPro.Properties.C3H3F5.C3H3F5_Ph(Ps, C2.h); Ts = pros.T; /* Fluid thermodynamic properties after the identropic compression */ - props = ThermoSysPro.Properties.Fluid.Ps(Ps, proe.s, 0, fluid); + props = ThermoSysPro.Properties.C3H3F5.C3H3F5_Ps(Ps, proe.s); His = props.h; annotation ( diff --git a/ThermoSysPro/Properties/C3H3F5/C3H3F5_Ph.mo b/ThermoSysPro/Properties/C3H3F5/C3H3F5_Ph.mo index b5604d5c..fe52301e 100644 --- a/ThermoSysPro/Properties/C3H3F5/C3H3F5_Ph.mo +++ b/ThermoSysPro/Properties/C3H3F5/C3H3F5_Ph.mo @@ -119,6 +119,12 @@ algorithm pro.s := ssatV; end if; end if; + pro.u := h - P/pro.d; + pro.cp := 1000; + pro.ddhp := 0; + pro.ddph := 0; + pro.duph := 0; + pro.duhp := 1; annotation ( smoothOrder = 2, Documentation(info=" From 24ceb03a234a2011e5cb2b04a9d1868804811234 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Tue, 19 May 2026 20:16:37 +0200 Subject: [PATCH 171/178] #125 modif C3H3F5 so that closer to old implementation, and Oil Medium --- .../SimpleExamples/Media/TestC3H3F5.mo | 41 +++ .../SimpleExamples/Media/package.order | 1 + .../Fluid/Machines/HeatPumpCompressor.mo | 26 +- ThermoSysPro/Properties/C3H3F5/C3H3F5_Ph.mo | 6 - .../Properties/Media/C3H3F5/package.mo | 8 +- .../Media/Oil_TherminolVP1/package.mo | 233 ++++++++++++++++++ .../Media/Oil_TherminolVP1/package.order | 28 +++ ThermoSysPro/Properties/Media/package.order | 1 + 8 files changed, 317 insertions(+), 27 deletions(-) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Media/TestC3H3F5.mo create mode 100644 ThermoSysPro/Properties/Media/Oil_TherminolVP1/package.mo create mode 100644 ThermoSysPro/Properties/Media/Oil_TherminolVP1/package.order diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Media/TestC3H3F5.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Media/TestC3H3F5.mo new file mode 100644 index 00000000..bb2e9ecf --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Media/TestC3H3F5.mo @@ -0,0 +1,41 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Media; +model TestC3H3F5 + extends ThermoSysPro.UsersGuide.Icons.Example; + + package Medium = ThermoSysPro.Properties.Media.C3H3F5; + + parameter Units.SI.AbsolutePressure p = 1e5; + parameter Units.SI.SpecificEnthalpy h = 3e5; + parameter Units.SI.SpecificEntropy s = 1.5e3; + parameter Medium.ThermodynamicState state_ph = Medium.setState_phX(p, h, {1}); + parameter Medium.ThermodynamicState state_ps = Medium.setState_psX(p, s, {1}); + parameter ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph legacy_ph = + ThermoSysPro.Properties.C3H3F5.C3H3F5_Ph(p, h); + parameter ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ps legacy_ps = + ThermoSysPro.Properties.C3H3F5.C3H3F5_Ps(p, s); + parameter Real eps = 1e-6; +equation + assert(abs(Medium.temperature(state_ph) - legacy_ph.T) < eps, + "C3H3F5 medium temperature_ph differs from legacy C3H3F5_Ph"); + assert(abs(Medium.density(state_ph) - legacy_ph.d) < eps, + "C3H3F5 medium density_ph differs from legacy C3H3F5_Ph"); + assert(abs(Medium.specificEntropy(state_ph) - legacy_ph.s) < eps, + "C3H3F5 medium specificEntropy differs from legacy C3H3F5_Ph"); + assert(abs(Medium.vapourQuality(state_ph) - legacy_ph.x) < 1e-4, + "C3H3F5 medium vapourQuality differs from legacy C3H3F5_Ph"); + + assert(abs(Medium.temperature(state_ps) - legacy_ps.T) < eps, + "C3H3F5 medium temperature_ps differs from legacy C3H3F5_Ps"); + assert(abs(Medium.density(state_ps) - legacy_ps.d) < eps, + "C3H3F5 medium density_ps differs from legacy C3H3F5_Ps"); + assert(abs(Medium.specificEnthalpy(state_ps) - legacy_ps.h) < eps, + "C3H3F5 medium specificEnthalpy_ps differs from legacy C3H3F5_Ps"); + + assert(abs(Medium.specificInternalEnergy(state_ph) - (h - p/legacy_ph.d)) < eps, + "C3H3F5 medium internal energy does not match legacy Fluid assumption u=h-p/d"); + assert(abs(Medium.density_derh_p(state_ph) + 1e6) < eps, + "C3H3F5 medium density_derh_p does not match legacy Fluid assumption"); + assert(abs(Medium.density_derp_h(state_ph) - 1e-8) < eps, + "C3H3F5 medium density_derp_h does not match legacy Fluid assumption"); + annotation (experiment(StopTime=1)); +end TestC3H3F5; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Media/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/Media/package.order index ddcc39f2..b3e51986 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Media/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Media/package.order @@ -1,2 +1,3 @@ WaterSteam_NonVolatileTrace WaterSteam_FullyVolatileTrace +TestC3H3F5 diff --git a/ThermoSysPro/Fluid/Machines/HeatPumpCompressor.mo b/ThermoSysPro/Fluid/Machines/HeatPumpCompressor.mo index 85622e51..1f43daea 100644 --- a/ThermoSysPro/Fluid/Machines/HeatPumpCompressor.mo +++ b/ThermoSysPro/Fluid/Machines/HeatPumpCompressor.mo @@ -26,14 +26,10 @@ public Interfaces.Connectors.FluidOutlet C2(redeclare package Medium = Medium) annotation (Placement(transformation( extent={{90,-10},{110,10}}, rotation=0))); public - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph proe - annotation (Placement(transformation(extent={{-100,80},{-80,100}}, rotation= - 0))); - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pros - annotation (Placement(transformation(extent={{80,80},{100,100}}, rotation=0))); - ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ps props - annotation (Placement(transformation(extent={{-100,-100},{-80,-80}}, - rotation=0))); + Medium.ThermodynamicState state_e "Fluid thermodynamic state before the compression"; + Medium.ThermodynamicState state_s "Fluid thermodynamic state after the compression"; + Medium.ThermodynamicState state_is + "Fluid thermodynamic state after the isentropic compression"; equation C1.Q = C2.Q; @@ -61,22 +57,22 @@ equation pi = Ps/Pe; /* Average vapor mass fraction */ - xm = (proe.x + pros.x)/2.0; + xm = (Medium.vapourQuality(state_e) + Medium.vapourQuality(state_s))/2.0; /* Compression efficiency */ His - C1.h = max(xm, 0.01)*eta*(C2.h - C1.h); /* Fluid thermodynamic properties before the compression */ - proe = ThermoSysPro.Properties.C3H3F5.C3H3F5_Ph(Pe, C1.h); - Te = proe.T; + state_e = Medium.setState_phX(Pe, C1.h, C1.Xi); + Te = Medium.temperature(state_e); /* Fluid thermodynamic properties after the compression */ - pros = ThermoSysPro.Properties.C3H3F5.C3H3F5_Ph(Ps, C2.h); - Ts = pros.T; + state_s = Medium.setState_phX(Ps, C2.h, C2.Xi); + Ts = Medium.temperature(state_s); /* Fluid thermodynamic properties after the identropic compression */ - props = ThermoSysPro.Properties.C3H3F5.C3H3F5_Ps(Ps, proe.s); - His = props.h; + state_is = Medium.setState_psX(Ps, Medium.specificEntropy(state_e), C1.Xi); + His = Medium.specificEnthalpy(state_is); annotation ( Diagram(coordinateSystem( diff --git a/ThermoSysPro/Properties/C3H3F5/C3H3F5_Ph.mo b/ThermoSysPro/Properties/C3H3F5/C3H3F5_Ph.mo index fe52301e..b5604d5c 100644 --- a/ThermoSysPro/Properties/C3H3F5/C3H3F5_Ph.mo +++ b/ThermoSysPro/Properties/C3H3F5/C3H3F5_Ph.mo @@ -119,12 +119,6 @@ algorithm pro.s := ssatV; end if; end if; - pro.u := h - P/pro.d; - pro.cp := 1000; - pro.ddhp := 0; - pro.ddph := 0; - pro.duph := 0; - pro.duhp := 1; annotation ( smoothOrder = 2, Documentation(info=" diff --git a/ThermoSysPro/Properties/Media/C3H3F5/package.mo b/ThermoSysPro/Properties/Media/C3H3F5/package.mo index a4fbfc64..1f4cef83 100644 --- a/ThermoSysPro/Properties/Media/C3H3F5/package.mo +++ b/ThermoSysPro/Properties/Media/C3H3F5/package.mo @@ -586,19 +586,15 @@ public redeclare function extends density_derh_p "Density derivative by specific enthalpy" - protected - constant SpecificEnthalpy dh=1; algorithm - ddhp := (density_ph(state.p, state.h + dh) - density_ph(state.p, state.h - dh))/(2*dh); + ddhp := -1e6; annotation (Inline=true); end density_derh_p; redeclare function extends density_derp_h "Density derivative by pressure" - protected - constant AbsolutePressure dp=1; algorithm - ddph := (density_ph(state.p + dp, state.h) - density_ph(state.p - dp, state.h))/(2*dp); + ddph := 1e-8; annotation (Inline=true); end density_derp_h; diff --git a/ThermoSysPro/Properties/Media/Oil_TherminolVP1/package.mo b/ThermoSysPro/Properties/Media/Oil_TherminolVP1/package.mo new file mode 100644 index 00000000..0266eca6 --- /dev/null +++ b/ThermoSysPro/Properties/Media/Oil_TherminolVP1/package.mo @@ -0,0 +1,233 @@ +within ThermoSysPro.Properties.Media; +package Oil_TherminolVP1 "Therminol VP1 oil medium using the legacy ThermoSysPro property functions" + + extends PartialThermoSysProMedium( + isCompressible=false, + mediumName="Oil_TherminolVP1", + substanceNames={"Oil_TherminolVP1"}, + singleState=false, + SpecificEnthalpy(start=3.0e5, nominal=3.0e5), + Density(start=900, nominal=900), + AbsolutePressure(start=1e5, nominal=1e5), + Temperature(start=400, nominal=400), + ThermoStates=Modelica.Media.Interfaces.Choices.IndependentVariables.ph); + + constant FluidConstants oilConstants( + iupacName="Therminol VP1", + casRegistryNumber="", + chemicalFormula="", + structureFormula="", + molarMass=0.166); + constant FluidConstants fluidConstants[1]={oilConstants}; + + redeclare record extends ThermodynamicState "Thermodynamic state" + SpecificEnthalpy h "Specific enthalpy"; + Density d "Density"; + Temperature T "Temperature"; + AbsolutePressure p "Pressure"; + end ThermodynamicState; + + redeclare replaceable model extends BaseProperties( + h(stateSelect=StateSelect.prefer), + d(stateSelect=StateSelect.default), + T(stateSelect=StateSelect.default), + p(stateSelect=StateSelect.prefer)) + "Base properties of Therminol VP1" + equation + T = ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_h(h); + d = ThermoSysPro.Properties.Oil_TherminolVP1.Density_T(T); + u = h - p/d; + MM = fluidConstants[1].molarMass; + R_s = 0; + state = ThermodynamicState(p=p, h=h, T=T, d=d); + end BaseProperties; + + redeclare function extends setState_phX + "Return thermodynamic state from p and h" + algorithm + state := ThermodynamicState( + p=p, + h=h, + T=ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_h(h), + d=ThermoSysPro.Properties.Oil_TherminolVP1.Density_T(ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_h(h))); + annotation (Inline=true); + end setState_phX; + + redeclare function extends setState_pTX + "Return thermodynamic state from p and T" + protected + SpecificEnthalpy h; + algorithm + h := ThermoSysPro.Properties.Oil_TherminolVP1.Enthalpy_T(T); + state := ThermodynamicState( + p=p, + h=h, + T=T, + d=ThermoSysPro.Properties.Oil_TherminolVP1.Density_T(T)); + annotation (Inline=true); + end setState_pTX; + + redeclare function extends setState_psX + "Return thermodynamic state from p and s" + algorithm + assert(false, "Oil_TherminolVP1: setState_psX is not available in the legacy ThermoSysPro implementation"); + state := ThermodynamicState(p=p, h=0, T=0, d=0); + end setState_psX; + + redeclare function extends setState_dTX + "Return thermodynamic state from d and T" + algorithm + state := ThermodynamicState( + p=reference_p, + h=ThermoSysPro.Properties.Oil_TherminolVP1.Enthalpy_T(T), + T=T, + d=d); + annotation (Inline=true); + end setState_dTX; + + redeclare function extends setSmoothState + import Modelica.Media.Common.smoothStep; + algorithm + state := ThermodynamicState( + p=smoothStep(x, state_a.p, state_b.p, x_small), + h=smoothStep(x, state_a.h, state_b.h, x_small), + T=ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_h(smoothStep(x, state_a.h, state_b.h, x_small)), + d=ThermoSysPro.Properties.Oil_TherminolVP1.Density_T(ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_h(smoothStep(x, state_a.h, state_b.h, x_small)))); + annotation (Inline=true); + end setSmoothState; + + redeclare function extends pressure + algorithm + p := state.p; + annotation (Inline=true); + end pressure; + + redeclare function extends temperature + algorithm + T := state.T; + annotation (Inline=true); + end temperature; + + redeclare function extends density + algorithm + d := state.d; + annotation (Inline=true); + end density; + + redeclare function extends specificEnthalpy + algorithm + h := state.h; + annotation (Inline=true); + end specificEnthalpy; + + redeclare function extends specificInternalEnergy + algorithm + u := state.h - state.p/state.d; + annotation (Inline=true); + end specificInternalEnergy; + + redeclare function extends specificEntropy + algorithm + assert(false, "Oil_TherminolVP1: specificEntropy is not available in the legacy ThermoSysPro implementation"); + s := 0; + end specificEntropy; + + redeclare function extends specificGibbsEnergy + algorithm + g := state.h - state.T*specificEntropy(state); + end specificGibbsEnergy; + + redeclare function extends specificHelmholtzEnergy + algorithm + f := state.h - state.p/state.d - state.T*specificEntropy(state); + end specificHelmholtzEnergy; + + redeclare function extends specificHeatCapacityCp + algorithm + cp := ThermoSysPro.Properties.Oil_TherminolVP1.SpecificHeatCp_T(state.T); + annotation (Inline=true); + end specificHeatCapacityCp; + + redeclare function extends specificHeatCapacityCv + algorithm + cv := specificHeatCapacityCp(state); + annotation (Inline=true); + end specificHeatCapacityCv; + + redeclare function extends dynamicViscosity + algorithm + eta := ThermoSysPro.Properties.Oil_TherminolVP1.DynamicViscosity_T(state.T); + annotation (Inline=true); + end dynamicViscosity; + + redeclare function extends thermalConductivity + algorithm + lambda := ThermoSysPro.Properties.Oil_TherminolVP1.ThermalConductivity_T(state.T); + annotation (Inline=true); + end thermalConductivity; + + redeclare function extends velocityOfSound + algorithm + assert(false, "Oil_TherminolVP1: velocityOfSound is not available in the legacy ThermoSysPro implementation"); + a := 0; + end velocityOfSound; + + redeclare function extends isentropicEnthalpy + algorithm + assert(false, "Oil_TherminolVP1: isentropicEnthalpy is not available in the legacy ThermoSysPro implementation"); + h_is := refState.h; + end isentropicEnthalpy; + + redeclare function specificEnthalpy_pTX + extends Modelica.Icons.Function; + input AbsolutePressure p "Pressure"; + input Temperature T "Temperature"; + input MassFraction X[:] "Mass fractions"; + output SpecificEnthalpy h "Specific enthalpy"; + algorithm + h := ThermoSysPro.Properties.Oil_TherminolVP1.Enthalpy_T(T); + annotation (Inline=true); + end specificEnthalpy_pTX; + + redeclare function temperature_phX + extends Modelica.Icons.Function; + input AbsolutePressure p "Pressure"; + input SpecificEnthalpy h "Specific enthalpy"; + input MassFraction X[:] "Mass fractions"; + output Temperature T "Temperature"; + algorithm + T := ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_h(h); + annotation (Inline=true); + end temperature_phX; + + redeclare function density_phX + extends Modelica.Icons.Function; + input AbsolutePressure p "Pressure"; + input SpecificEnthalpy h "Specific enthalpy"; + input MassFraction X[:] "Mass fractions"; + output Density d "Density"; + algorithm + d := ThermoSysPro.Properties.Oil_TherminolVP1.Density_T(ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_h(h)); + annotation (Inline=true); + end density_phX; + + redeclare function extends density_derh_p + protected + SpecificEnthalpy delta_h=0.01*state.h; + algorithm + ddhp := (ThermoSysPro.Properties.Oil_TherminolVP1.Density_T(ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_h(state.h + delta_h)) + - ThermoSysPro.Properties.Oil_TherminolVP1.Density_T(ThermoSysPro.Properties.Oil_TherminolVP1.Temperature_h(state.h - delta_h)))/(2*delta_h); + annotation (Inline=true); + end density_derh_p; + + redeclare function extends density_derp_h + algorithm + ddph := 1e-8; + annotation (Inline=true); + end density_derp_h; + + annotation (Documentation(info=" +

    Copyright © EDF 2002 - 2024

    +

    ThermoSysPro Version 4.1

    +")); +end Oil_TherminolVP1; diff --git a/ThermoSysPro/Properties/Media/Oil_TherminolVP1/package.order b/ThermoSysPro/Properties/Media/Oil_TherminolVP1/package.order new file mode 100644 index 00000000..9bf6eaa0 --- /dev/null +++ b/ThermoSysPro/Properties/Media/Oil_TherminolVP1/package.order @@ -0,0 +1,28 @@ +oilConstants +fluidConstants +ThermodynamicState +BaseProperties +setState_phX +setState_pTX +setState_psX +setState_dTX +setSmoothState +pressure +temperature +density +specificEnthalpy +specificInternalEnergy +specificEntropy +specificGibbsEnergy +specificHelmholtzEnergy +specificHeatCapacityCp +specificHeatCapacityCv +dynamicViscosity +thermalConductivity +velocityOfSound +isentropicEnthalpy +specificEnthalpy_pTX +temperature_phX +density_phX +density_derh_p +density_derp_h diff --git a/ThermoSysPro/Properties/Media/package.order b/ThermoSysPro/Properties/Media/package.order index 5d7b2ae9..8966d666 100644 --- a/ThermoSysPro/Properties/Media/package.order +++ b/ThermoSysPro/Properties/Media/package.order @@ -5,3 +5,4 @@ Functions WaterSteam FlueGases C3H3F5 +Oil_TherminolVP1 From 6a365f0b2e72e31afb1fb96c99b8bd9512025e38 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Tue, 19 May 2026 22:39:24 +0200 Subject: [PATCH 172/178] #125 WaterSteamSimple MoltenSalt and DryAirIdealGas --- .../Media/TestDryAirIdealGas.mo | 32 ++ .../SimpleExamples/Media/TestMoltenSalt.mo | 32 ++ .../Media/TestWaterSteamSimple.mo | 35 ++ .../SimpleExamples/Media/package.order | 3 + .../Media/DryAirIdealGas/package.mo | 254 ++++++++++ .../Media/DryAirIdealGas/package.order | 29 ++ .../Properties/Media/MoltenSalt/package.mo | 249 ++++++++++ .../Properties/Media/MoltenSalt/package.order | 28 ++ .../Media/WaterSteamSimple/package.mo | 466 ++++++++++++++++++ .../Media/WaterSteamSimple/package.order | 48 ++ ThermoSysPro/Properties/Media/package.order | 3 + 11 files changed, 1179 insertions(+) create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Media/TestDryAirIdealGas.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Media/TestMoltenSalt.mo create mode 100644 ThermoSysPro/Fluid/Examples/SimpleExamples/Media/TestWaterSteamSimple.mo create mode 100644 ThermoSysPro/Properties/Media/DryAirIdealGas/package.mo create mode 100644 ThermoSysPro/Properties/Media/DryAirIdealGas/package.order create mode 100644 ThermoSysPro/Properties/Media/MoltenSalt/package.mo create mode 100644 ThermoSysPro/Properties/Media/MoltenSalt/package.order create mode 100644 ThermoSysPro/Properties/Media/WaterSteamSimple/package.mo create mode 100644 ThermoSysPro/Properties/Media/WaterSteamSimple/package.order diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Media/TestDryAirIdealGas.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Media/TestDryAirIdealGas.mo new file mode 100644 index 00000000..6335caae --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Media/TestDryAirIdealGas.mo @@ -0,0 +1,32 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Media; +model TestDryAirIdealGas + extends ThermoSysPro.UsersGuide.Icons.Example; + + package Medium = ThermoSysPro.Properties.Media.DryAirIdealGas; + + parameter Units.SI.AbsolutePressure p = 1e5; + parameter Units.SI.Temperature T = 300; + parameter Units.SI.SpecificEnthalpy h = + ThermoSysPro.Properties.Fluid.SpecificEnthalpy_PT(p, T, 6, 0, 0, 0, 0, 0); + parameter Medium.ThermodynamicState state = Medium.setState_phX(p, h, {1}); + parameter ThermoSysPro.Properties.DryAirIdealGas.DryAirIdealGas data; + parameter Real eps = 1e-6; +equation + assert(abs(Medium.temperature(state) - + ThermoSysPro.Properties.Fluid.Temperature_Ph(p, h, 6, 0, 0, 0, 0, 0)) < eps, + "DryAirIdealGas medium temperature differs from legacy Fluid wrapper"); + assert(abs(Medium.density(state) - + ThermoSysPro.Properties.Fluid.Density_Ph(p, h, 6, 0, 0, 0, 0, 0)) < eps, + "DryAirIdealGas medium density differs from legacy Fluid wrapper"); + assert(abs(Medium.specificEnthalpy_pTX(p, T, {1}) - h) < eps, + "DryAirIdealGas medium specificEnthalpy_pTX differs from legacy Fluid wrapper"); + assert(abs(Medium.specificInternalEnergy(state) - (h - data.specificGasConstant*Medium.temperature(state))) < eps, + "DryAirIdealGas medium internal energy differs from legacy Fluid assumption"); + assert(abs(Medium.density_derh_p(state) - + ThermoSysPro.Properties.Fluid.Density_derh_Ph(p, h, 6, 0, 0, 0, 0, 0)) < eps, + "DryAirIdealGas medium density_derh_p differs from legacy Fluid wrapper"); + assert(abs(Medium.density_derp_h(state) - + ThermoSysPro.Properties.Fluid.Density_derp_Ph(p, h, 6, 0, 0, 0, 0, 0)) < eps, + "DryAirIdealGas medium density_derp_h differs from legacy Fluid wrapper"); + annotation (experiment(StopTime=1)); +end TestDryAirIdealGas; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Media/TestMoltenSalt.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Media/TestMoltenSalt.mo new file mode 100644 index 00000000..c6a355da --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Media/TestMoltenSalt.mo @@ -0,0 +1,32 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Media; +model TestMoltenSalt + extends ThermoSysPro.UsersGuide.Icons.Example; + + package Medium = ThermoSysPro.Properties.Media.MoltenSalt; + + parameter Units.SI.AbsolutePressure p = 1e5; + parameter Units.SI.Temperature T = 600; + parameter Units.SI.SpecificEnthalpy h = + ThermoSysPro.Properties.Fluid.SpecificEnthalpy_PT(p, T, 4, 0, 0, 0, 0, 0); + parameter Medium.ThermodynamicState state = Medium.setState_phX(p, h, {1}); + parameter Real eps = 1e-6; +equation + assert(abs(Medium.temperature(state) - + ThermoSysPro.Properties.Fluid.Temperature_Ph(p, h, 4, 0, 0, 0, 0, 0)) < eps, + "MoltenSalt medium temperature differs from legacy Fluid wrapper"); + assert(abs(Medium.density(state) - + ThermoSysPro.Properties.Fluid.Density_Ph(p, h, 4, 0, 0, 0, 0, 0)) < eps, + "MoltenSalt medium density differs from legacy Fluid wrapper"); + assert(abs(Medium.specificEnthalpy_pTX(p, T, {1}) - h) < eps, + "MoltenSalt medium specificEnthalpy_pTX differs from legacy Fluid wrapper"); + assert(abs(Medium.specificInternalEnergy(state) - + ThermoSysPro.Properties.Fluid.SpecificInternalEnergy_Ph_DO_NOT_USE(p, h, 4, 0, 0, 0, 0, 0)) < eps, + "MoltenSalt medium internal energy differs from legacy Fluid assumption"); + assert(abs(Medium.density_derh_p(state) - + ThermoSysPro.Properties.Fluid.Density_derh_Ph(p, h, 4, 0, 0, 0, 0, 0)) < eps, + "MoltenSalt medium density_derh_p differs from legacy Fluid wrapper"); + assert(abs(Medium.density_derp_h(state) - + ThermoSysPro.Properties.Fluid.Density_derp_Ph(p, h, 4, 0, 0, 0, 0, 0)) < eps, + "MoltenSalt medium density_derp_h differs from legacy Fluid wrapper"); + annotation (experiment(StopTime=1)); +end TestMoltenSalt; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Media/TestWaterSteamSimple.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Media/TestWaterSteamSimple.mo new file mode 100644 index 00000000..d20ae3ca --- /dev/null +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Media/TestWaterSteamSimple.mo @@ -0,0 +1,35 @@ +within ThermoSysPro.Fluid.Examples.SimpleExamples.Media; +model TestWaterSteamSimple + extends ThermoSysPro.UsersGuide.Icons.Example; + + package Medium = ThermoSysPro.Properties.Media.WaterSteamSimple; + + parameter Units.SI.AbsolutePressure p = 1e5; + parameter Units.SI.SpecificEnthalpy h = 3e5; + parameter Units.SI.SpecificEntropy s = 1000; + parameter Medium.ThermodynamicState state_ph = Medium.setState_phX(p, h, {1}); + parameter Medium.ThermodynamicState state_ps = Medium.setState_psX(p, s, {1}); + parameter ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph legacy_ph = + ThermoSysPro.Properties.WaterSteamSimple.SimpleWater.Water_Ph(p, h, 0); + parameter ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ps legacy_ps = + ThermoSysPro.Properties.WaterSteamSimple.SimpleWater.Water_Ps(p, s, 0); + parameter Real eps = 1e-6; +equation + assert(abs(Medium.temperature(state_ph) - legacy_ph.T) < eps, + "WaterSteamSimple medium temperature_ph differs from legacy SimpleWater"); + assert(abs(Medium.density(state_ph) - legacy_ph.d) < eps, + "WaterSteamSimple medium density_ph differs from legacy SimpleWater"); + assert(abs(Medium.specificEntropy(state_ph) - legacy_ph.s) < eps, + "WaterSteamSimple medium entropy differs from legacy SimpleWater"); + assert(abs(Medium.temperature(state_ps) - legacy_ps.T) < eps, + "WaterSteamSimple medium temperature_ps differs from legacy SimpleWater"); + assert(abs(Medium.density(state_ps) - legacy_ps.d) < eps, + "WaterSteamSimple medium density_ps differs from legacy SimpleWater"); + assert(abs(Medium.specificEnthalpy(state_ps) - legacy_ps.h) < eps, + "WaterSteamSimple medium enthalpy_ps differs from legacy SimpleWater"); + assert(abs(Medium.density_derh_p(state_ph) - legacy_ph.ddhp) < eps, + "WaterSteamSimple medium density_derh_p differs from legacy SimpleWater"); + assert(abs(Medium.density_derp_h(state_ph) - legacy_ph.ddph) < eps, + "WaterSteamSimple medium density_derp_h differs from legacy SimpleWater"); + annotation (experiment(StopTime=1)); +end TestWaterSteamSimple; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Media/package.order b/ThermoSysPro/Fluid/Examples/SimpleExamples/Media/package.order index b3e51986..66036803 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Media/package.order +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Media/package.order @@ -1,3 +1,6 @@ WaterSteam_NonVolatileTrace WaterSteam_FullyVolatileTrace TestC3H3F5 +TestMoltenSalt +TestDryAirIdealGas +TestWaterSteamSimple diff --git a/ThermoSysPro/Properties/Media/DryAirIdealGas/package.mo b/ThermoSysPro/Properties/Media/DryAirIdealGas/package.mo new file mode 100644 index 00000000..8b0cc9af --- /dev/null +++ b/ThermoSysPro/Properties/Media/DryAirIdealGas/package.mo @@ -0,0 +1,254 @@ +within ThermoSysPro.Properties.Media; +package DryAirIdealGas "Dry air ideal gas medium using the legacy ThermoSysPro property functions" + + extends PartialThermoSysProMedium( + isCompressible=true, + mediumName="DryAirIdealGas", + substanceNames={"DryAirIdealGas"}, + singleState=false, + SpecificEnthalpy(start=3e5, nominal=3e5), + Density(start=1, nominal=1), + AbsolutePressure(start=1e5, nominal=1e5), + Temperature(start=300, nominal=300), + ThermoStates=Modelica.Media.Interfaces.Choices.IndependentVariables.ph); + + constant ThermoSysPro.Properties.DryAirIdealGas.DryAirIdealGas data; + constant FluidConstants dryAirConstants( + iupacName="Dry air", + casRegistryNumber="", + chemicalFormula="", + structureFormula="", + molarMass=data.molarMass); + constant FluidConstants fluidConstants[1]={dryAirConstants}; + + redeclare record extends ThermodynamicState + SpecificEnthalpy h; + Density d; + Temperature T; + AbsolutePressure p; + end ThermodynamicState; + + redeclare replaceable model extends BaseProperties( + h(stateSelect=StateSelect.prefer), + d(stateSelect=StateSelect.default), + T(stateSelect=StateSelect.default), + p(stateSelect=StateSelect.prefer)) + equation + T = ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(h); + d = ThermoSysPro.Properties.DryAirIdealGas.Density_PT(P=p, T=T); + u = h - data.specificGasConstant*T; + MM = fluidConstants[1].molarMass; + R_s = data.specificGasConstant; + state = ThermodynamicState( + p=p, + h=h, + T=T, + d=d); + end BaseProperties; + + redeclare function extends setState_phX + protected + Temperature T; + algorithm + T := ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(h); + state := ThermodynamicState( + p=p, + h=h, + T=T, + d=ThermoSysPro.Properties.DryAirIdealGas.Density_PT(P=p, T=T)); + annotation (Inline=true); + end setState_phX; + + redeclare function extends setState_pTX + protected + SpecificEnthalpy h; + algorithm + h := ThermoSysPro.Properties.DryAirIdealGas.SpecificEnthalpy_T(T); + state := ThermodynamicState( + p=p, + h=h, + T=T, + d=ThermoSysPro.Properties.DryAirIdealGas.Density_PT(P=p, T=T)); + annotation (Inline=true); + end setState_pTX; + + redeclare function extends setState_psX + algorithm + assert(false, "DryAirIdealGas: setState_psX is not available in the legacy ThermoSysPro implementation"); + state := ThermodynamicState( + p=p, + h=0, + T=0, + d=0); + end setState_psX; + + redeclare function extends setState_dTX + algorithm + state := ThermodynamicState( + p=d*data.specificGasConstant*T, + h=ThermoSysPro.Properties.DryAirIdealGas.SpecificEnthalpy_T(T), + T=T, + d=d); + annotation (Inline=true); + end setState_dTX; + + redeclare function extends setSmoothState + import Modelica.Media.Common.smoothStep; + protected + SpecificEnthalpy h; + AbsolutePressure p; + Temperature T; + algorithm + h := smoothStep( + x, + state_a.h, + state_b.h, + x_small); + p := smoothStep( + x, + state_a.p, + state_b.p, + x_small); + T := ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(h); + state := ThermodynamicState( + p=p, + h=h, + T=T, + d=ThermoSysPro.Properties.DryAirIdealGas.Density_PT(P=p, T=T)); + annotation (Inline=true); + end setSmoothState; + + redeclare function extends pressure + algorithm + p := state.p; + annotation (Inline=true); + end pressure; + + redeclare function extends temperature + algorithm + T := state.T; + annotation (Inline=true); + end temperature; + + redeclare function extends density + algorithm + d := state.d; + annotation (Inline=true); + end density; + + redeclare function extends specificEnthalpy + algorithm + h := state.h; + annotation (Inline=true); + end specificEnthalpy; + + redeclare function extends specificInternalEnergy + algorithm + u := state.h - data.specificGasConstant*state.T; + annotation (Inline=true); + end specificInternalEnergy; + + redeclare function extends specificEntropy + algorithm + assert(false, "DryAirIdealGas: specificEntropy is not available in the legacy ThermoSysPro implementation"); + s := 0; + end specificEntropy; + + redeclare function extends specificGibbsEnergy + algorithm + g := state.h - state.T*specificEntropy(state); + end specificGibbsEnergy; + + redeclare function extends specificHelmholtzEnergy + algorithm + f := state.h - data.specificGasConstant*state.T - state.T*specificEntropy(state); + end specificHelmholtzEnergy; + + redeclare function extends specificHeatCapacityCp + algorithm + cp := ThermoSysPro.Properties.DryAirIdealGas.SpecificHeatCp_T(state.T); + annotation (Inline=true); + end specificHeatCapacityCp; + + redeclare function extends specificHeatCapacityCv + algorithm + cv := specificHeatCapacityCp(state) - data.specificGasConstant; + annotation (Inline=true); + end specificHeatCapacityCv; + + redeclare function extends dynamicViscosity + algorithm + eta := ThermoSysPro.Properties.DryAirIdealGas.DynamicViscosity_Trho(T=state.T, rho=state.d); + annotation (Inline=true); + end dynamicViscosity; + + redeclare function extends thermalConductivity + algorithm + lambda := ThermoSysPro.Properties.DryAirIdealGas.ThermalConductivity_Trho(T=state.T, rho=state.d); + annotation (Inline=true); + end thermalConductivity; + + redeclare function extends velocityOfSound + algorithm + a := sqrt(specificHeatCapacityCp(state)/specificHeatCapacityCv(state)*data.specificGasConstant*state.T); + annotation (Inline=true); + end velocityOfSound; + + redeclare function extends isentropicEnthalpy + algorithm + assert(false, "DryAirIdealGas: isentropicEnthalpy is not available in the legacy ThermoSysPro implementation"); + h_is := refState.h; + end isentropicEnthalpy; + + redeclare function specificEnthalpy_pTX + extends Modelica.Icons.Function; + input AbsolutePressure p; + input Temperature T; + input MassFraction X[:]; + output SpecificEnthalpy h; + algorithm + h := ThermoSysPro.Properties.DryAirIdealGas.SpecificEnthalpy_T(T); + annotation (Inline=true); + end specificEnthalpy_pTX; + + redeclare function temperature_phX + extends Modelica.Icons.Function; + input AbsolutePressure p; + input SpecificEnthalpy h; + input MassFraction X[:]; + output Temperature T; + algorithm + T := ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(h); + annotation (Inline=true); + end temperature_phX; + + redeclare function density_phX + extends Modelica.Icons.Function; + input AbsolutePressure p; + input SpecificEnthalpy h; + input MassFraction X[:]; + output Density d; + protected + Temperature T; + algorithm + T := ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(h); + d := ThermoSysPro.Properties.DryAirIdealGas.Density_PT(P=p, T=T); + annotation (Inline=true); + end density_phX; + + redeclare function extends density_derh_p + protected + SpecificEnthalpy delta_h=0.01*state.h; + algorithm + ddhp := (ThermoSysPro.Properties.DryAirIdealGas.Density_PT(P=state.p, T=ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(state.h + delta_h)) - ThermoSysPro.Properties.DryAirIdealGas.Density_PT(P=state.p, T=ThermoSysPro.Properties.DryAirIdealGas.Temperature_h(state.h - delta_h)))/(2*delta_h); + annotation (Inline=true); + end density_derh_p; + + redeclare function extends density_derp_h + protected + AbsolutePressure delta_P=0.0001*state.p; + algorithm + ddph := (ThermoSysPro.Properties.DryAirIdealGas.Density_PT(P=state.p + delta_P, T=state.T) - ThermoSysPro.Properties.DryAirIdealGas.Density_PT(P=state.p - delta_P, T=state.T))/(2*delta_P); + annotation (Inline=true); + end density_derp_h; +end DryAirIdealGas; diff --git a/ThermoSysPro/Properties/Media/DryAirIdealGas/package.order b/ThermoSysPro/Properties/Media/DryAirIdealGas/package.order new file mode 100644 index 00000000..79f7605f --- /dev/null +++ b/ThermoSysPro/Properties/Media/DryAirIdealGas/package.order @@ -0,0 +1,29 @@ +data +dryAirConstants +fluidConstants +ThermodynamicState +BaseProperties +setState_phX +setState_pTX +setState_psX +setState_dTX +setSmoothState +pressure +temperature +density +specificEnthalpy +specificInternalEnergy +specificEntropy +specificGibbsEnergy +specificHelmholtzEnergy +specificHeatCapacityCp +specificHeatCapacityCv +dynamicViscosity +thermalConductivity +velocityOfSound +isentropicEnthalpy +specificEnthalpy_pTX +temperature_phX +density_phX +density_derh_p +density_derp_h diff --git a/ThermoSysPro/Properties/Media/MoltenSalt/package.mo b/ThermoSysPro/Properties/Media/MoltenSalt/package.mo new file mode 100644 index 00000000..a200e9c5 --- /dev/null +++ b/ThermoSysPro/Properties/Media/MoltenSalt/package.mo @@ -0,0 +1,249 @@ +within ThermoSysPro.Properties.Media; +package MoltenSalt "Molten salt medium using the legacy ThermoSysPro property functions" + + extends PartialThermoSysProMedium( + isCompressible=false, + mediumName="MoltenSalt", + substanceNames={"MoltenSalt"}, + singleState=false, + SpecificEnthalpy(start=3e5, nominal=3e5), + Density(start=1800, nominal=1800), + AbsolutePressure(start=1e5, nominal=1e5), + Temperature(start=600, nominal=600), + ThermoStates=Modelica.Media.Interfaces.Choices.IndependentVariables.ph); + + constant FluidConstants saltConstants( + iupacName="Molten salt", + casRegistryNumber="", + chemicalFormula="", + structureFormula="", + molarMass=0.1); + constant FluidConstants fluidConstants[1]={saltConstants}; + + redeclare record extends ThermodynamicState + SpecificEnthalpy h; + Density d; + Temperature T; + AbsolutePressure p; + end ThermodynamicState; + + redeclare replaceable model extends BaseProperties( + h(stateSelect=StateSelect.prefer), + d(stateSelect=StateSelect.default), + T(stateSelect=StateSelect.default), + p(stateSelect=StateSelect.prefer)) + equation + T = ThermoSysPro.Properties.MoltenSalt.Temperature_h(h); + d = ThermoSysPro.Properties.MoltenSalt.Density_T(T); + u = h - p/d; + MM = fluidConstants[1].molarMass; + R_s = 0; + state = ThermodynamicState( + p=p, + h=h, + T=T, + d=d); + end BaseProperties; + + redeclare function extends setState_phX + protected + Temperature T; + algorithm + T := ThermoSysPro.Properties.MoltenSalt.Temperature_h(h); + state := ThermodynamicState( + p=p, + h=h, + T=T, + d=ThermoSysPro.Properties.MoltenSalt.Density_T(T)); + annotation (Inline=true); + end setState_phX; + + redeclare function extends setState_pTX + protected + SpecificEnthalpy h; + algorithm + h := ThermoSysPro.Properties.MoltenSalt.SpecificEnthalpy_T(T); + state := ThermodynamicState( + p=p, + h=h, + T=T, + d=ThermoSysPro.Properties.MoltenSalt.Density_T(T)); + annotation (Inline=true); + end setState_pTX; + + redeclare function extends setState_psX + algorithm + assert(false, "MoltenSalt: setState_psX is not available in the legacy ThermoSysPro implementation"); + state := ThermodynamicState( + p=p, + h=0, + T=0, + d=0); + end setState_psX; + + redeclare function extends setState_dTX + algorithm + state := ThermodynamicState( + p=reference_p, + h=ThermoSysPro.Properties.MoltenSalt.SpecificEnthalpy_T(T), + T=T, + d=d); + annotation (Inline=true); + end setState_dTX; + + redeclare function extends setSmoothState + import Modelica.Media.Common.smoothStep; + protected + SpecificEnthalpy h; + Temperature T; + algorithm + h := smoothStep( + x, + state_a.h, + state_b.h, + x_small); + T := ThermoSysPro.Properties.MoltenSalt.Temperature_h(h); + state := ThermodynamicState( + p=smoothStep( + x, + state_a.p, + state_b.p, + x_small), + h=h, + T=T, + d=ThermoSysPro.Properties.MoltenSalt.Density_T(T)); + annotation (Inline=true); + end setSmoothState; + + redeclare function extends pressure + algorithm + p := state.p; + annotation (Inline=true); + end pressure; + + redeclare function extends temperature + algorithm + T := state.T; + annotation (Inline=true); + end temperature; + + redeclare function extends density + algorithm + d := state.d; + annotation (Inline=true); + end density; + + redeclare function extends specificEnthalpy + algorithm + h := state.h; + annotation (Inline=true); + end specificEnthalpy; + + redeclare function extends specificInternalEnergy + algorithm + u := state.h - state.p/state.d; + annotation (Inline=true); + end specificInternalEnergy; + + redeclare function extends specificEntropy + algorithm + assert(false, "MoltenSalt: specificEntropy is not available in the legacy ThermoSysPro implementation"); + s := 0; + end specificEntropy; + + redeclare function extends specificGibbsEnergy + algorithm + g := state.h - state.T*specificEntropy(state); + end specificGibbsEnergy; + + redeclare function extends specificHelmholtzEnergy + algorithm + f := state.h - state.p/state.d - state.T*specificEntropy(state); + end specificHelmholtzEnergy; + + redeclare function extends specificHeatCapacityCp + algorithm + cp := ThermoSysPro.Properties.MoltenSalt.SpecificHeatCapacityCp_T(state.T); + annotation (Inline=true); + end specificHeatCapacityCp; + + redeclare function extends specificHeatCapacityCv + algorithm + cv := specificHeatCapacityCp(state); + annotation (Inline=true); + end specificHeatCapacityCv; + + redeclare function extends dynamicViscosity + algorithm + eta := ThermoSysPro.Properties.MoltenSalt.DynamicViscosity_T(state.T); + annotation (Inline=true); + end dynamicViscosity; + + redeclare function extends thermalConductivity + algorithm + lambda := ThermoSysPro.Properties.MoltenSalt.ThermalConductivity_T(state.T); + annotation (Inline=true); + end thermalConductivity; + + redeclare function extends velocityOfSound + algorithm + assert(false, "MoltenSalt: velocityOfSound is not available in the legacy ThermoSysPro implementation"); + a := 0; + end velocityOfSound; + + redeclare function extends isentropicEnthalpy + algorithm + assert(false, "MoltenSalt: isentropicEnthalpy is not available in the legacy ThermoSysPro implementation"); + h_is := refState.h; + end isentropicEnthalpy; + + redeclare function specificEnthalpy_pTX + extends Modelica.Icons.Function; + input AbsolutePressure p; + input Temperature T; + input MassFraction X[:]; + output SpecificEnthalpy h; + algorithm + h := ThermoSysPro.Properties.MoltenSalt.SpecificEnthalpy_T(T); + annotation (Inline=true); + end specificEnthalpy_pTX; + + redeclare function temperature_phX + extends Modelica.Icons.Function; + input AbsolutePressure p; + input SpecificEnthalpy h; + input MassFraction X[:]; + output Temperature T; + algorithm + T := ThermoSysPro.Properties.MoltenSalt.Temperature_h(h); + annotation (Inline=true); + end temperature_phX; + + redeclare function density_phX + extends Modelica.Icons.Function; + input AbsolutePressure p; + input SpecificEnthalpy h; + input MassFraction X[:]; + output Density d; + protected + Temperature T; + algorithm + T := ThermoSysPro.Properties.MoltenSalt.Temperature_h(h); + d := ThermoSysPro.Properties.MoltenSalt.Density_T(T); + annotation (Inline=true); + end density_phX; + + redeclare function extends density_derh_p + protected + SpecificEnthalpy delta_h=0.01*state.h; + algorithm + ddhp := (ThermoSysPro.Properties.MoltenSalt.Density_T(ThermoSysPro.Properties.MoltenSalt.Temperature_h(state.h + delta_h)) - ThermoSysPro.Properties.MoltenSalt.Density_T(ThermoSysPro.Properties.MoltenSalt.Temperature_h(state.h - delta_h)))/(2*delta_h); + annotation (Inline=true); + end density_derh_p; + + redeclare function extends density_derp_h + algorithm + ddph := 1e-8; + annotation (Inline=true); + end density_derp_h; +end MoltenSalt; diff --git a/ThermoSysPro/Properties/Media/MoltenSalt/package.order b/ThermoSysPro/Properties/Media/MoltenSalt/package.order new file mode 100644 index 00000000..6167fc42 --- /dev/null +++ b/ThermoSysPro/Properties/Media/MoltenSalt/package.order @@ -0,0 +1,28 @@ +saltConstants +fluidConstants +ThermodynamicState +BaseProperties +setState_phX +setState_pTX +setState_psX +setState_dTX +setSmoothState +pressure +temperature +density +specificEnthalpy +specificInternalEnergy +specificEntropy +specificGibbsEnergy +specificHelmholtzEnergy +specificHeatCapacityCp +specificHeatCapacityCv +dynamicViscosity +thermalConductivity +velocityOfSound +isentropicEnthalpy +specificEnthalpy_pTX +temperature_phX +density_phX +density_derh_p +density_derp_h diff --git a/ThermoSysPro/Properties/Media/WaterSteamSimple/package.mo b/ThermoSysPro/Properties/Media/WaterSteamSimple/package.mo new file mode 100644 index 00000000..e33895ae --- /dev/null +++ b/ThermoSysPro/Properties/Media/WaterSteamSimple/package.mo @@ -0,0 +1,466 @@ +within ThermoSysPro.Properties.Media; +package WaterSteamSimple "Simple water/steam medium using the legacy ThermoSysPro property functions" + + extends PartialTwoPhaseThermoSysProMedium( + isCompressible=true, + mediumName="WaterSteamSimple", + substanceNames={"water"}, + singleState=false, + SpecificEnthalpy(start=1e5, nominal=5e5), + Density(start=150, nominal=500), + AbsolutePressure( + start=50e5, + nominal=10e5, + min=611.657, + max=100e6), + Temperature( + start=500, + nominal=500, + min=273.15, + max=2273.15), + smoothModel=false, + onePhase=false, + fluidConstants=Modelica.Media.Water.waterConstants, + ThermoStates=Modelica.Media.Interfaces.Choices.IndependentVariables.ph); + + constant Integer Region=0 "Simple water region. 0: automatic"; + + redeclare record extends SaturationProperties + end SaturationProperties; + + redeclare record extends ThermodynamicState + SpecificEnthalpy h; + Density d; + Temperature T; + AbsolutePressure p; + end ThermodynamicState; + + redeclare replaceable model extends BaseProperties( + h(stateSelect=StateSelect.prefer), + d(stateSelect=StateSelect.default), + T(stateSelect=StateSelect.default), + p(stateSelect=StateSelect.prefer)) + Integer phase( + min=0, + max=2, + start=1, + fixed=false); + protected + ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro; + equation + pro = ThermoSysPro.Properties.WaterSteamSimple.SimpleWater.Water_Ph(p, h, Region); + MM = fluidConstants[1].molarMass; + R_s = Modelica.Constants.R/fluidConstants[1].molarMass; + phase = if pro.x > 0 and pro.x < 1 then 2 else 1; + sat = setSat_p(p); + state = ThermodynamicState( + p=p, + h=h, + T=pro.T, + d=pro.d, + phase=phase); + T = pro.T; + d = pro.d; + u = pro.u; + end BaseProperties; + + redeclare function density_ph + extends Modelica.Icons.Function; + input AbsolutePressure p; + input SpecificEnthalpy h; + input FixedPhase phase=0; + output Density d; + protected + ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro; + algorithm + pro := ThermoSysPro.Properties.WaterSteamSimple.SimpleWater.Water_Ph(p, h, Region); + d := pro.d; + annotation (Inline=true); + end density_ph; + + redeclare function temperature_ph + extends Modelica.Icons.Function; + input AbsolutePressure p; + input SpecificEnthalpy h; + input FixedPhase phase=0; + output Temperature T; + protected + ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro; + algorithm + pro := ThermoSysPro.Properties.WaterSteamSimple.SimpleWater.Water_Ph(p, h, Region); + T := pro.T; + annotation (Inline=true); + end temperature_ph; + + redeclare function extends setState_phX + protected + ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro; + algorithm + pro := ThermoSysPro.Properties.WaterSteamSimple.SimpleWater.Water_Ph(p, h, Region); + state := ThermodynamicState( + p=p, + h=h, + T=pro.T, + d=pro.d, + phase=if pro.x > 0 and pro.x < 1 then 2 else 1); + annotation (Inline=true); + end setState_phX; + + redeclare function extends setState_psX + protected + ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ps pro; + algorithm + pro := ThermoSysPro.Properties.WaterSteamSimple.SimpleWater.Water_Ps(p, s, Region); + state := ThermodynamicState( + p=p, + h=pro.h, + T=pro.T, + d=pro.d, + phase=if pro.x > 0 and pro.x < 1 then 2 else 1); + annotation (Inline=true); + end setState_psX; + + redeclare function extends setState_pTX + protected + SpecificEnthalpy h; + ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro; + algorithm + h := ThermoSysPro.Properties.WaterSteamSimple.SimpleWater.SpecificEnthalpy_PT(p, T, Region); + pro := ThermoSysPro.Properties.WaterSteamSimple.SimpleWater.Water_Ph(p, h, Region); + state := ThermodynamicState( + p=p, + h=h, + T=pro.T, + d=pro.d, + phase=if pro.x > 0 and pro.x < 1 then 2 else 1); + annotation (Inline=true); + end setState_pTX; + + redeclare function extends setState_dTX + algorithm + assert(false, "WaterSteamSimple: setState_dTX is not available in the legacy ThermoSysPro implementation"); + state := ThermodynamicState( + p=reference_p, + h=0, + T=T, + d=d, + phase=phase); + end setState_dTX; + + redeclare function extends setSmoothState + import Modelica.Media.Common.smoothStep; + algorithm + state := setState_phX( + smoothStep( + x, + state_a.p, + state_b.p, + x_small), + smoothStep( + x, + state_a.h, + state_b.h, + x_small), + fill(0, 0)); + annotation (Inline=true); + end setSmoothState; + + redeclare function specificEnthalpy_pTX + extends Modelica.Icons.Function; + input AbsolutePressure p; + input Temperature T; + input MassFraction X[:]; + input FixedPhase phase=0; + output SpecificEnthalpy h; + algorithm + h := ThermoSysPro.Properties.WaterSteamSimple.SimpleWater.SpecificEnthalpy_PT(p, T, Region); + annotation (Inline=true); + end specificEnthalpy_pTX; + + redeclare function temperature_phX + extends Modelica.Icons.Function; + input AbsolutePressure p; + input SpecificEnthalpy h; + input MassFraction X[:]; + input FixedPhase phase=0; + output Temperature T; + algorithm + T := temperature_ph(p, h, phase); + annotation (Inline=true); + end temperature_phX; + + redeclare function density_phX + extends Modelica.Icons.Function; + input AbsolutePressure p; + input SpecificEnthalpy h; + input MassFraction X[:]; + input FixedPhase phase=0; + output Density d; + algorithm + d := density_ph(p, h, phase); + annotation (Inline=true); + end density_phX; + + redeclare function extends pressure + algorithm + p := state.p; + annotation (Inline=true); + end pressure; + + redeclare function extends temperature + algorithm + T := state.T; + annotation (Inline=true); + end temperature; + + redeclare function extends density + algorithm + d := state.d; + annotation (Inline=true); + end density; + + redeclare function extends specificEnthalpy + algorithm + h := state.h; + annotation (Inline=true); + end specificEnthalpy; + + redeclare function extends specificInternalEnergy + algorithm + u := state.h - state.p/state.d; + annotation (Inline=true); + end specificInternalEnergy; + + redeclare function extends specificEntropy + protected + ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro; + algorithm + pro := ThermoSysPro.Properties.WaterSteamSimple.SimpleWater.Water_Ph( + state.p, + state.h, + Region); + s := pro.s; + annotation (Inline=true); + end specificEntropy; + + redeclare function extends specificGibbsEnergy + algorithm + g := state.h - state.T*specificEntropy(state); + annotation (Inline=true); + end specificGibbsEnergy; + + redeclare function extends specificHelmholtzEnergy + algorithm + f := state.h - state.p/state.d - state.T*specificEntropy(state); + annotation (Inline=true); + end specificHelmholtzEnergy; + + redeclare function extends specificHeatCapacityCp + protected + ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro; + algorithm + pro := ThermoSysPro.Properties.WaterSteamSimple.SimpleWater.Water_Ph( + state.p, + state.h, + Region); + cp := pro.cp; + annotation (Inline=true); + end specificHeatCapacityCp; + + redeclare function extends specificHeatCapacityCv + algorithm + cv := specificHeatCapacityCp(state); + annotation (Inline=true); + end specificHeatCapacityCv; + + redeclare function extends dynamicViscosity + algorithm + eta := ThermoSysPro.Properties.WaterSteamSimple.SimpleWater.DynamicViscosity_rhoT(rho=state.d, T=state.T); + annotation (Inline=true); + end dynamicViscosity; + + redeclare function extends thermalConductivity + algorithm + lambda := ThermoSysPro.Properties.WaterSteamSimple.SimpleWater.ThermalConductivity_rhoT(rho=state.d, T=state.T); + annotation (Inline=true); + end thermalConductivity; + + redeclare function extends surfaceTension + algorithm + sigma := ThermoSysPro.Properties.WaterSteamSimple.SimpleWater.SurfaceTension_T(sat.Tsat); + annotation (Inline=true); + end surfaceTension; + + redeclare function extends velocityOfSound + algorithm + assert(false, "WaterSteamSimple: velocityOfSound is not available in the legacy ThermoSysPro implementation"); + a := 0; + end velocityOfSound; + + redeclare function extends isentropicEnthalpy + algorithm + h_is := specificEnthalpy( + setState_psX(p_downstream, specificEntropy(refState), fill(0, 0))); + annotation (Inline=true); + end isentropicEnthalpy; + + redeclare function extends saturationTemperature + algorithm + T := ThermoSysPro.Properties.WaterSteamSimple.Temperature.Tsat_P(p); + annotation (Inline=true); + end saturationTemperature; + + redeclare function extends saturationTemperature_derp + algorithm + dTp := ThermoSysPro.Properties.WaterSteamSimple.Temperature.dTsatp_P(p); + annotation (Inline=true); + end saturationTemperature_derp; + + redeclare function extends saturationPressure + algorithm + p := ThermoSysPro.Properties.WaterSteamSimple.SimpleWater.Pressure_sat_hl(0); + annotation (Inline=true); + end saturationPressure; + + redeclare function setSat_p + extends Modelica.Icons.Function; + input AbsolutePressure p; + output SaturationProperties sat; + protected + ThermoSysPro.Properties.WaterSteam.Common.PropThermoSat lsat; + ThermoSysPro.Properties.WaterSteam.Common.PropThermoSat vsat; + algorithm + (lsat,vsat) := ThermoSysPro.Properties.WaterSteamSimple.SimpleWater.Water_sat_P(p); + sat := SaturationProperties(psat=p, Tsat=lsat.T); + annotation (Inline=true); + end setSat_p; + + redeclare function setSat_T + extends Modelica.Icons.Function; + input Temperature T; + output SaturationProperties sat; + algorithm + assert(false, "WaterSteamSimple: setSat_T is not available in the legacy ThermoSysPro implementation"); + sat := SaturationProperties(psat=0, Tsat=T); + end setSat_T; + + redeclare function extends bubbleEnthalpy + protected + ThermoSysPro.Properties.WaterSteam.Common.PropThermoSat lsat; + ThermoSysPro.Properties.WaterSteam.Common.PropThermoSat vsat; + algorithm + (lsat,vsat) := ThermoSysPro.Properties.WaterSteamSimple.SimpleWater.Water_sat_P(sat.psat); + hl := lsat.h; + annotation (Inline=true); + end bubbleEnthalpy; + + redeclare function extends dewEnthalpy + protected + ThermoSysPro.Properties.WaterSteam.Common.PropThermoSat lsat; + ThermoSysPro.Properties.WaterSteam.Common.PropThermoSat vsat; + algorithm + (lsat,vsat) := ThermoSysPro.Properties.WaterSteamSimple.SimpleWater.Water_sat_P(sat.psat); + hv := vsat.h; + annotation (Inline=true); + end dewEnthalpy; + + redeclare function extends bubbleDensity + algorithm + dl := density_ph(sat.psat, bubbleEnthalpy(sat)); + annotation (Inline=true); + end bubbleDensity; + + redeclare function extends dewDensity + algorithm + dv := density_ph(sat.psat, dewEnthalpy(sat)); + annotation (Inline=true); + end dewDensity; + + redeclare function extends bubbleEntropy + algorithm + sl := specificEntropy( + setState_phX( + sat.psat, + bubbleEnthalpy(sat), + fill(0, 0))); + annotation (Inline=true); + end bubbleEntropy; + + redeclare function extends dewEntropy + algorithm + sv := specificEntropy( + setState_phX( + sat.psat, + dewEnthalpy(sat), + fill(0, 0))); + annotation (Inline=true); + end dewEntropy; + + redeclare function extends setBubbleState + algorithm + state := setState_phX( + sat.psat, + bubbleEnthalpy(sat), + fill(0, 0), + phase); + annotation (Inline=true); + end setBubbleState; + + redeclare function extends setDewState + algorithm + state := setState_phX( + sat.psat, + dewEnthalpy(sat), + fill(0, 0), + phase); + annotation (Inline=true); + end setDewState; + + redeclare function extends dBubbleDensity_dPressure + algorithm + ddldp := 0; + annotation (Inline=true); + end dBubbleDensity_dPressure; + + redeclare function extends dDewDensity_dPressure + algorithm + ddvdp := 0; + annotation (Inline=true); + end dDewDensity_dPressure; + + redeclare function extends dBubbleEnthalpy_dPressure + algorithm + dhldp := 0; + annotation (Inline=true); + end dBubbleEnthalpy_dPressure; + + redeclare function extends dDewEnthalpy_dPressure + algorithm + dhvdp := 0; + annotation (Inline=true); + end dDewEnthalpy_dPressure; + + redeclare function extends density_derh_p + protected + ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro; + algorithm + pro := ThermoSysPro.Properties.WaterSteamSimple.SimpleWater.Water_Ph( + state.p, + state.h, + Region); + ddhp := pro.ddhp; + annotation (Inline=true); + end density_derh_p; + + redeclare function extends density_derp_h + protected + ThermoSysPro.Properties.WaterSteam.Common.ThermoProperties_ph pro; + algorithm + pro := ThermoSysPro.Properties.WaterSteamSimple.SimpleWater.Water_Ph( + state.p, + state.h, + Region); + ddph := pro.ddph; + annotation (Inline=true); + end density_derp_h; +end WaterSteamSimple; diff --git a/ThermoSysPro/Properties/Media/WaterSteamSimple/package.order b/ThermoSysPro/Properties/Media/WaterSteamSimple/package.order new file mode 100644 index 00000000..24365266 --- /dev/null +++ b/ThermoSysPro/Properties/Media/WaterSteamSimple/package.order @@ -0,0 +1,48 @@ +Region +SaturationProperties +ThermodynamicState +BaseProperties +density_ph +temperature_ph +setState_phX +setState_psX +setState_pTX +setState_dTX +setSmoothState +specificEnthalpy_pTX +temperature_phX +density_phX +pressure +temperature +density +specificEnthalpy +specificInternalEnergy +specificEntropy +specificGibbsEnergy +specificHelmholtzEnergy +specificHeatCapacityCp +specificHeatCapacityCv +dynamicViscosity +thermalConductivity +surfaceTension +velocityOfSound +isentropicEnthalpy +saturationTemperature +saturationTemperature_derp +saturationPressure +setSat_p +setSat_T +bubbleEnthalpy +dewEnthalpy +bubbleDensity +dewDensity +bubbleEntropy +dewEntropy +setBubbleState +setDewState +dBubbleDensity_dPressure +dDewDensity_dPressure +dBubbleEnthalpy_dPressure +dDewEnthalpy_dPressure +density_derh_p +density_derp_h diff --git a/ThermoSysPro/Properties/Media/package.order b/ThermoSysPro/Properties/Media/package.order index 8966d666..ded20b5d 100644 --- a/ThermoSysPro/Properties/Media/package.order +++ b/ThermoSysPro/Properties/Media/package.order @@ -6,3 +6,6 @@ WaterSteam FlueGases C3H3F5 Oil_TherminolVP1 +MoltenSalt +DryAirIdealGas +WaterSteamSimple From ca2825b516687e903498be0d19e1ddea9565e12a Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Tue, 19 May 2026 23:14:47 +0200 Subject: [PATCH 173/178] #125 ThermoSysPro.Fluid.Examples.Book.SimpleExamples except HX --- .../Boiler/TestFossilFuelBoiler.mo | 46 +++++++++++++------ .../TestCentrifugalPump/Scenario_1.mo | 9 +++- .../TestCentrifugalPump/Scenario_2.mo | 12 +++-- .../TestCentrifugalPump/Scenario_3.mo | 10 +++- .../TestCentrifugalPump/Scenario_4.mo | 6 ++- .../TestStaticCentrifugalPump.mo | 12 +++-- .../TestGTCombustionChamber.mo | 20 ++++---- .../TestGenericCombustion1D.mo | 38 +++++++++++---- .../GasTurbine/TestCombustionTurbine.mo | 19 ++++---- .../GasTurbine/TestCompressor.mo | 15 +++--- .../TestInternalCombustionEngine.mo | 28 +++++++---- .../SimpleExamples/PressureLoss/TestBend.mo | 10 ++-- .../PressureLoss/TestCheckValve.mo | 8 +++- .../PressureLoss/TestControlValve.mo | 11 +++-- .../PressureLoss/TestDiaphragm.mo | 10 ++-- .../PressureLoss/TestDynamicCheckValve.mo | 9 +++- .../PressureLoss/TestDynamicReliefValve.mo | 17 +++++-- .../PressureLoss/TestLumpedStraightPipe.mo | 10 +++- .../PressureLoss/TestPipePressureLoss.mo | 10 ++-- .../PressureLoss/TestSwitchValve.mo | 16 +++++-- .../PressureLoss/TestThreeWayValve.mo | 11 +++-- .../SolarCollector/TestFresnelField.mo | 8 +++- .../SteamTurbine/TestStodolaTurbine.mo | 10 +++- .../SimpleExamples/Volume/TestDynamicDrum.mo | 9 ++++ .../Book/SimpleExamples/Volume/TestMixer3.mo | 24 ++++++---- .../SimpleExamples/Volume/TestPressurizer.mo | 28 +++++++---- .../SimpleExamples/Volume/TestSplitter3.mo | 23 ++++++---- .../SimpleExamples/Volume/TestStaticDrum3.mo | 33 +++++++++---- .../SimpleExamples/Volume/TestSteamDryer.mo | 23 +++++++--- .../Book/SimpleExamples/Volume/TestTank.mo | 23 +++++++--- .../SimpleExamples/Volume/TestVolumeATh.mo | 15 ++++-- 31 files changed, 372 insertions(+), 151 deletions(-) diff --git a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/Boiler/TestFossilFuelBoiler.mo b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/Boiler/TestFossilFuelBoiler.mo index 1b70289b..118548ed 100644 --- a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/Boiler/TestFossilFuelBoiler.mo +++ b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/Boiler/TestFossilFuelBoiler.mo @@ -1,6 +1,11 @@ within ThermoSysPro.Fluid.Examples.Book.SimpleExamples.Boiler; model TestFossilFuelBoiler + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; + replaceable package Medium_FlueGases = ThermoSysPro.Properties.Media.FlueGases; + ThermoSysPro.Fluid.Boilers.FossilFuelBoiler FossilFuelBoiler( + redeclare package Medium = Medium, + redeclare package Medium_FlueGases = Medium_FlueGases, Wloss=0, Ke=1.e6, Tsf=386.16, @@ -10,37 +15,50 @@ model TestFossilFuelBoiler rhof(start=0.2733355904203506)) annotation (Placement(transformation(extent={{-45,-51},{45,51}}, rotation=0))); ThermoSysPro.Fluid.Combustion.BoundaryConditions.FuelSourcePQ fuelSourcePQ( - T0=338.16, - Cp=1282, - Xh=0.24403, - Xc=0.75323, - Q0=1.45) annotation (Placement(transformation(extent={{-36,-78},{0,-41}}, + Xashes=0.011, + rho=1000, + Hum=0.50, + Xc=0.2479, + Xh=0.0297, + Xo=0.2088, + Xn=0.0017, + Xs=0.0003, + LHV=1.5e7, + Q0=0.0407331, + T0=294.45) annotation (Placement(transformation(extent={{-36,-78},{0,-41}}, rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ( - Xco2=0, - Xh2o=0.01, + redeclare package Medium = Medium_FlueGases, Q0=27., T0=298.16, - Xo2=0.233, - ftype=ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType.FlueGases, - option_temperature=true) + option_temperature=true, + X0={0.757,0.233,0.01,0,0}) annotation (Placement(transformation(extent={{-110,-50},{-71,-13}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP annotation (Placement(transformation( + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP( + redeclare package Medium = Medium_FlueGases, + P0=100000, + T0=386.16, + option_temperature=true) annotation (Placement(transformation( extent={{68,-51},{110,-12}}, rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ( + redeclare package Medium = Medium, P0=140e5, Q0=24., h0=600e3) annotation (Placement(transformation(extent={{-107,14},{-71,48}}, rotation= 0))); - ThermoSysPro.Fluid.BoundaryConditions.Sink sink annotation (Placement(transformation( + ThermoSysPro.Fluid.BoundaryConditions.Sink sink(redeclare package Medium = Medium) annotation (Placement(transformation( extent={{74,13},{110,49}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss(K=1e-3, rho( + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss( + redeclare package Medium = Medium, + K=1e-3, rho( start=932.9612394321883)) annotation (Placement(transformation(extent={{-64,25},{-56,37}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss1(K=1e-3, rho( + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss1( + redeclare package Medium = Medium, + K=1e-3, rho( start=29.766102492862515)) annotation (Placement(transformation(extent={{57,25},{65,37}}, rotation=0))); equation diff --git a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/CentrifugalPump/TestCentrifugalPump/Scenario_1.mo b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/CentrifugalPump/TestCentrifugalPump/Scenario_1.mo index 9aec12bb..811f5307 100644 --- a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/CentrifugalPump/TestCentrifugalPump/Scenario_1.mo +++ b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/CentrifugalPump/TestCentrifugalPump/Scenario_1.mo @@ -1,16 +1,21 @@ within ThermoSysPro.Fluid.Examples.Book.SimpleExamples.CentrifugalPump.TestCentrifugalPump; model Scenario_1 + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; ThermoSysPro.Fluid.Machines.CentrifugalPump centrifugalPump( + redeclare package Medium = Medium, mode_car=1, mode_car_hn=1, mode_car_Cr=1, dynamic_mech_equation=false) annotation (Placement(transformation(extent={{-20,20},{0, 40}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(Q0=0) + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ( + redeclare package Medium = Medium, + Q0=0) annotation (Placement(transformation(extent={{-80,20},{-60,40}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.Sink sink + ThermoSysPro.Fluid.BoundaryConditions.Sink sink( + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{40,20},{60,40}}, rotation=0))); ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Rampe rampe( Starttime=10, diff --git a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/CentrifugalPump/TestCentrifugalPump/Scenario_2.mo b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/CentrifugalPump/TestCentrifugalPump/Scenario_2.mo index 54dfa881..29617eea 100644 --- a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/CentrifugalPump/TestCentrifugalPump/Scenario_2.mo +++ b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/CentrifugalPump/TestCentrifugalPump/Scenario_2.mo @@ -1,13 +1,19 @@ within ThermoSysPro.Fluid.Examples.Book.SimpleExamples.CentrifugalPump.TestCentrifugalPump; model Scenario_2 + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; - ThermoSysPro.Fluid.Machines.CentrifugalPump centrifugalPump(mode_car_hn= + ThermoSysPro.Fluid.Machines.CentrifugalPump centrifugalPump( + redeclare package Medium = Medium, + mode_car_hn= 1, mode_car_Cr=1, mode_car=1) annotation (Placement(transformation(extent={{-20,20},{0, 40}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ(Q0=100) + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ( + redeclare package Medium = Medium, + Q0=100) annotation (Placement(transformation(extent={{-80,20},{-60,40}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.Sink sink + ThermoSysPro.Fluid.BoundaryConditions.Sink sink( + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{40,20},{60,40}}, rotation=0))); ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Rampe rampe( Starttime=10, diff --git a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/CentrifugalPump/TestCentrifugalPump/Scenario_3.mo b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/CentrifugalPump/TestCentrifugalPump/Scenario_3.mo index 78d7ef17..4c0dc39b 100644 --- a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/CentrifugalPump/TestCentrifugalPump/Scenario_3.mo +++ b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/CentrifugalPump/TestCentrifugalPump/Scenario_3.mo @@ -1,7 +1,9 @@ within ThermoSysPro.Fluid.Examples.Book.SimpleExamples.CentrifugalPump.TestCentrifugalPump; model Scenario_3 + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; ThermoSysPro.Fluid.Machines.CentrifugalPump centrifugalPump( + redeclare package Medium = Medium, hn_nom_p=10, mode_car=1, V=0.01, @@ -9,9 +11,12 @@ model Scenario_3 mode_car_Cr=1, mode_car_hn=1) annotation (Placement(transformation(extent={{-20,20},{0,40}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP(P0=300000) + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP( + redeclare package Medium = Medium, + P0=300000) annotation (Placement(transformation(extent={{-60,20},{-40,40}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP( + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{60,20},{80,40}}, rotation=0))); ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Rampe rampe2( Duration=100, @@ -20,6 +25,7 @@ model Scenario_3 Initialvalue=400000) annotation (Placement( transformation(extent={{0,60},{20,80}}, rotation=0))); ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe lumpedStraightPipe( + redeclare package Medium = Medium, lambda=0, inertia=true) annotation (Placement(transformation(extent={{20,20},{40,40}}, rotation=0))); diff --git a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/CentrifugalPump/TestCentrifugalPump/Scenario_4.mo b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/CentrifugalPump/TestCentrifugalPump/Scenario_4.mo index b3ceaf57..9ab55f34 100644 --- a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/CentrifugalPump/TestCentrifugalPump/Scenario_4.mo +++ b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/CentrifugalPump/TestCentrifugalPump/Scenario_4.mo @@ -1,7 +1,9 @@ within ThermoSysPro.Fluid.Examples.Book.SimpleExamples.CentrifugalPump.TestCentrifugalPump; model Scenario_4 + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; ThermoSysPro.Fluid.Machines.CentrifugalPump centrifugalPump( + redeclare package Medium = Medium, J=5.685, dynamic_mech_equation=true, hn_coef={-165.23,774.95}, @@ -15,11 +17,13 @@ model Scenario_4 Qv(start=0.010949905982587188)) annotation (Placement(transformation(extent={{20,20},{40,40}}, rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourceP( + redeclare package Medium = Medium, Q0=10, h0=650e3, P0=100000) annotation (Placement(transformation(extent={{-20,20},{0,40}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.Sink sinkP + ThermoSysPro.Fluid.BoundaryConditions.Sink sinkP( + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{60,20},{80,40}}, rotation=0))); ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Rampe rampe3( Duration=1000, diff --git a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/CentrifugalPump/TestStaticCentrifugalPump.mo b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/CentrifugalPump/TestStaticCentrifugalPump.mo index 97a0d98d..4c942bc1 100644 --- a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/CentrifugalPump/TestStaticCentrifugalPump.mo +++ b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/CentrifugalPump/TestStaticCentrifugalPump.mo @@ -1,13 +1,19 @@ within ThermoSysPro.Fluid.Examples.Book.SimpleExamples.CentrifugalPump; model TestStaticCentrifugalPump + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; - ThermoSysPro.Fluid.Machines.StaticCentrifugalPump StaticCentrifugalPump1 + ThermoSysPro.Fluid.Machines.StaticCentrifugalPump StaticCentrifugalPump1( + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-10,-50},{-30,-30}}, rotation=0))); - ThermoSysPro.Fluid.Volumes.Tank Bache1(ze2=10, zs2=10) + ThermoSysPro.Fluid.Volumes.Tank Bache1( + redeclare package Medium = Medium, + ze2=10, + zs2=10) annotation (Placement(transformation(extent={{-30,10},{-10,30}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.ControlValve VanneReglante1 + ThermoSysPro.Fluid.PressureLosses.ControlValve VanneReglante1( + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{30,10},{50,30}}, rotation=0))); ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Constante Constante1(k=0.5) annotation (Placement( transformation(extent={{-10,50},{10,70}}, diff --git a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/CombustionChamber/TestGTCombustionChamber.mo b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/CombustionChamber/TestGTCombustionChamber.mo index f5da7e46..24ddff22 100644 --- a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/CombustionChamber/TestGTCombustionChamber.mo +++ b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/CombustionChamber/TestGTCombustionChamber.mo @@ -1,15 +1,22 @@ within ThermoSysPro.Fluid.Examples.Book.SimpleExamples.CombustionChamber; model TestGTCombustionChamber + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; + replaceable package Medium_FlueGases = ThermoSysPro.Properties.Media.FlueGases; - ThermoSysPro.Fluid.BoundaryConditions.Sink Puits_Fumees2 + ThermoSysPro.Fluid.BoundaryConditions.Sink Puits_Fumees2( + redeclare package Medium = Medium_FlueGases, + T0=1200, + option_temperature=true) annotation (Placement(transformation( origin={149,-2}, extent={{23,-24},{-23,24}}, rotation=180))); - ThermoSysPro.Fluid.Combustion.CombustionChambers.GTCombustionChamber GTCombustionChamber2(Cfg(P( - fixed=true, start=14.1e5)), kcham(fixed=false, start=1)) annotation ( + ThermoSysPro.Fluid.Combustion.CombustionChambers.GTCombustionChamber GTCombustionChamber2( + redeclare package Medium = Medium, + redeclare package Medium_FlueGases = Medium_FlueGases) annotation ( Placement(transformation(extent={{-67,-68},{67,64}}, rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ2( + redeclare package Medium = Medium, Q0=0, P0=15e5, h0=300e3) @@ -29,15 +36,12 @@ model TestGTCombustionChamber LHV=47500e3) annotation (Placement(transformation(extent={{-107,-93},{-71,-57}}, rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.SourcePQ Source_Fumees2( - Xso2=0, - Xco2=0.0, - Xo2=0.23, - Xh2o=0.01, + redeclare package Medium = Medium_FlueGases, P0=15e5, Q0=415, T0=680, option_temperature=true, - ftype=ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType.FlueGases) + X0={0.76,0.23,0.01,0,0}) annotation (Placement(transformation(extent={{-174,-26},{-128,22}}, rotation=0))); equation diff --git a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/CombustionChamber/TestGenericCombustion1D.mo b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/CombustionChamber/TestGenericCombustion1D.mo index b789a7f1..df6fa0d8 100644 --- a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/CombustionChamber/TestGenericCombustion1D.mo +++ b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/CombustionChamber/TestGenericCombustion1D.mo @@ -1,7 +1,11 @@ within ThermoSysPro.Fluid.Examples.Book.SimpleExamples.CombustionChamber; model TestGenericCombustion1D "TestGenericCombustion1D" + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; + replaceable package Medium_FlueGases = ThermoSysPro.Properties.Media.FlueGases; ThermoSysPro.Fluid.Combustion.CombustionChambers.GenericCombustion1D genericCombustionCCS( + redeclare package Medium = Medium, + redeclare package Medium_FlueGases = Medium_FlueGases, NCEL=7, Qm(fixed=false), Qsf(fixed=false), @@ -31,29 +35,38 @@ model TestGenericCombustion1D "TestGenericCombustion1D" Hum=0.08) annotation (Placement(transformation(extent={{-106,-43},{-72,-5}}, rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourceAir( - Xso2=0, + redeclare package Medium = Medium_FlueGases, Q0=609.29, - Xh2o=0.01, - Xo2=0.230, - Xco2=0, P0=191000, T0=524.89, - ftype=ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType.FlueGases, - option_temperature=true) + option_temperature=true, + X0={0.76,0.23,0.01,0,0}) annotation (Placement(transformation(extent={{-44,-98},{0,-58}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.Sink sink annotation (Placement(transformation( + ThermoSysPro.Fluid.BoundaryConditions.Sink sink( + redeclare package Medium = Medium_FlueGases, + T0=1200, + option_temperature=true) annotation (Placement(transformation( extent={{0,70},{44,112}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ SourcePQ_Water(Q0=0, P0=100000) + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ SourcePQ_Water( + redeclare package Medium = Medium, + Q0=0, + P0=100000) annotation (Placement(transformation(extent={{-107,23},{-71,57}}, rotation= 0))); ThermoSysPro.Fluid.HeatExchangers.DynamicTwoPhaseFlowPipe PipeWaterSteam( + redeclare package Medium = Medium, Ns=7, + inertia=false, + dynamic_energy_balance=false, z2=56, rugosrel=5e-5, ntubes=403, L=58, D=0.0327, + P(start=fill(2.0e7, 9)), + Q(start=fill(486.69, 8)), + h(start=fill(1.8e6, 9)), C2(Q(fixed=false, start=486.69), P( fixed=false, start=1.96318e+07, @@ -65,6 +78,9 @@ model TestGenericCombustion1D "TestGenericCombustion1D" rotation=270))); ThermoSysPro.Thermal.HeatTransfer.HeatExchangerWall paroiEcrans( Ns=7, + dynamic_energy_balance=false, + Tp1(start=fill(500, 7)), + Tp2(start=fill(400, 7)), lambda=40, steady_state=true, ntubes=403, @@ -76,15 +92,17 @@ model TestGenericCombustion1D "TestGenericCombustion1D" extent={{51.5,-15},{-51.5,15}}, rotation=270))); ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkWaterSteam2( + redeclare package Medium = Medium, option_temperature=false, - Q(start=486.69, fixed=true), + Q(start=486.69), h0=2.5e+06, - P0(fixed=false) = 19621600) + P0=19621600) annotation (Placement(transformation( origin={90,90.5}, extent={{14.5,-15},{-14.5,15}}, rotation=270))); ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceEcrans( + redeclare package Medium = Medium, h0=1.292e+06, option_temperature=false, P0=20112000) diff --git a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/GasTurbine/TestCombustionTurbine.mo b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/GasTurbine/TestCombustionTurbine.mo index 4d4b1e64..0e4be423 100644 --- a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/GasTurbine/TestCombustionTurbine.mo +++ b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/GasTurbine/TestCombustionTurbine.mo @@ -1,28 +1,31 @@ within ThermoSysPro.Fluid.Examples.Book.SimpleExamples.GasTurbine; model TestCombustionTurbine + replaceable package Medium = ThermoSysPro.Properties.Media.FlueGases; parameter Real is_eff_n1(fixed=false,start=0.85) "Nominal isentropic efficiency"; parameter Real Qred1(fixed=false,start=0.01) "Reduced mass flow rate"; ThermoSysPro.Fluid.Machines.CombustionTurbine CombustionTurbine( + redeclare package Medium = Medium, tau_n=0.065, is_eff_n=is_eff_n1, Qred=Qred1, Pe(fixed=true, start=1500000), - Ts(fixed=true, start=830)) annotation (Placement(transformation(extent={{ + Ts(fixed=true, start=830), + Hs(start=769796.2 + Medium.h_offset)) annotation (Placement(transformation(extent={{ -42,-42},{36,42}}, rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.SourceQ SourceQ1( - Xso2=0, + redeclare package Medium = Medium, Q0=430, - Xco2=0.06, - Xh2o=0.06, - Xo2=0.14, T0=1500, - ftype=ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType.FlueGases, - option_temperature=true) + option_temperature=true, + X0={1 - 0.14 - 0.06 - 0.06,0.14,0.06,0.06,0}) annotation (Placement(transformation(extent={{-106,-10},{-86,10}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP SinkP1(P0=1e5) + ThermoSysPro.Fluid.BoundaryConditions.SinkP SinkP1( + redeclare package Medium = Medium, + P0=1e5, + T0=830) annotation (Placement(transformation( origin={94,0}, extent={{10,-10},{-10,10}}, diff --git a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/GasTurbine/TestCompressor.mo b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/GasTurbine/TestCompressor.mo index 718d4bc1..e9de00fd 100644 --- a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/GasTurbine/TestCompressor.mo +++ b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/GasTurbine/TestCompressor.mo @@ -1,8 +1,10 @@ within ThermoSysPro.Fluid.Examples.Book.SimpleExamples.GasTurbine; model TestCompressor + replaceable package Medium = ThermoSysPro.Properties.Media.FlueGases; parameter Real is_eff_n1(fixed=false,start=0.85) "Nominal isentropic efficiency"; ThermoSysPro.Fluid.Machines.Compressor Compressor( + redeclare package Medium = Medium, Ps(fixed=false), tau_n=16, is_eff_n=is_eff_n1, @@ -10,19 +12,18 @@ model TestCompressor Ts(fixed=true, start=680)) annotation (Placement(transformation(extent={{ -52,-52},{48,52}}, rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.SourcePQ SourceQ1( - Xso2=0, + redeclare package Medium = Medium, T0=288, - Xco2=0.0, - Xh2o=0.003, - Xo2=0.23, P0=1e5, Q0=420, - ftype=ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType.FlueGases, - option_temperature=true) + option_temperature=true, + X0={1 - 0.003 - 0.23,0.23,0.003,0,0}) annotation (Placement(transformation(extent={{-104,-10},{-84,10}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP SinkP1(P0=15.8e5) + ThermoSysPro.Fluid.BoundaryConditions.SinkP SinkP1( + redeclare package Medium = Medium, + P0=15.8e5) annotation (Placement(transformation( origin={96,0}, extent={{10,-10},{-10,10}}, diff --git a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/InternalCombustionEngine/TestInternalCombustionEngine.mo b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/InternalCombustionEngine/TestInternalCombustionEngine.mo index 2a51e641..7cdd2733 100644 --- a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/InternalCombustionEngine/TestInternalCombustionEngine.mo +++ b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/InternalCombustionEngine/TestInternalCombustionEngine.mo @@ -1,5 +1,8 @@ within ThermoSysPro.Fluid.Examples.Book.SimpleExamples.InternalCombustionEngine; model TestInternalCombustionEngine + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; + replaceable package Medium_FlueGases = ThermoSysPro.Properties.Media.FlueGases; + parameter Integer NCEL = 7; Combustion.BoundaryConditions.FuelSourcePQ fuelSourcePQ( @@ -15,29 +18,31 @@ model TestInternalCombustionEngine LHV=50e6, T0(displayUnit="K") = 299, P0=210300, - Vol=100) annotation (Placement(transformation(extent={{-106,-81},{-72,-43}}, + Vol=1) annotation (Placement(transformation(extent={{-106,-81},{-72,-43}}, rotation=0))); BoundaryConditions.SourcePQ sourceAir( - Xso2=0, - Xco2=0, - Xh2o=0.005, - Xo2=0.23, + redeclare package Medium = Medium_FlueGases, Q0=1.9627, T0=30 + 273.16, option_temperature=true, - ftype=ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.FluidType.FlueGases, + X0={0.765,0.23,0.005,0,0}, P0=191000) annotation (Placement(transformation(extent={{111,-79},{73,-45}},rotation=0))); - BoundaryConditions.Sink sink(option_temperature=true) + BoundaryConditions.Sink sink( + redeclare package Medium = Medium_FlueGases, + option_temperature=true) annotation (Placement(transformation( extent={{0,44},{44,86}}, rotation=0))); BoundaryConditions.SourcePQ SourcePQ_Water( + redeclare package Medium = Medium, Q0=15.3, h0=334.41e3, P0=410000) annotation (Placement(transformation(extent={{-107,-19},{-71,15}},rotation= 0))); Machines.InternalCombustionEngine alternatingEngine( + redeclare package Medium = Medium, + redeclare package Medium_FlueGases = Medium_FlueGases, mechanical_efficiency_type=2, Rmeca_nom=0.41, Coef_Rm_a=-5.4727e-9, @@ -56,11 +61,14 @@ model TestInternalCombustionEngine Gamma=1.2085, Tsf(start=1088.15)) annotation (Placement(transformation(extent={{-44,-46},{44,42}}))); - BoundaryConditions.Sink Sink_Water1 annotation (Placement( + BoundaryConditions.Sink Sink_Water1(redeclare package Medium = + Medium) annotation (Placement( transformation(extent={{75,-19},{111,15}}, rotation=0))); - PressureLosses.SingularPressureLoss singularPressureLoss + PressureLosses.SingularPressureLoss singularPressureLoss( + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-63,-8},{-51,4}}))); - PressureLosses.SingularPressureLoss singularPressureLoss1 + PressureLosses.SingularPressureLoss singularPressureLoss1( + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{51,-9},{65,5}}))); equation connect(alternatingEngine.Cair,sourceAir. C) annotation (Line( diff --git a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/PressureLoss/TestBend.mo b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/PressureLoss/TestBend.mo index ccabc713..aeee300b 100644 --- a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/PressureLoss/TestBend.mo +++ b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/PressureLoss/TestBend.mo @@ -1,14 +1,18 @@ within ThermoSysPro.Fluid.Examples.Book.SimpleExamples.PressureLoss; model TestBend + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; - ThermoSysPro.Fluid.BoundaryConditions.SourceP SourceP1 + ThermoSysPro.Fluid.BoundaryConditions.SourceP SourceP1( + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-62,-6},{-42,14}}, rotation= 0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP SinkP1 + ThermoSysPro.Fluid.BoundaryConditions.SinkP SinkP1( + redeclare package Medium = Medium) annotation (Placement(transformation( extent={{41,-34},{61,-14}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.Bend Bend annotation (Placement( + ThermoSysPro.Fluid.PressureLosses.Bend Bend( + redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-8,-6},{12,14}}, rotation=0))); equation connect(Bend.C2, SinkP1.C) diff --git a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/PressureLoss/TestCheckValve.mo b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/PressureLoss/TestCheckValve.mo index 8920f780..8d1bd13a 100644 --- a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/PressureLoss/TestCheckValve.mo +++ b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/PressureLoss/TestCheckValve.mo @@ -1,10 +1,13 @@ within ThermoSysPro.Fluid.Examples.Book.SimpleExamples.PressureLoss; model TestCheckValve + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP1 + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP1( + redeclare package Medium = Medium) annotation (Placement(transformation( extent={{-40,-10},{-20,10}}, rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.SinkP puitsP1( + redeclare package Medium = Medium, P0=6e5) annotation (Placement(transformation( extent={{40,-10},{60,10}}, rotation=0))); ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Pulse pulse( @@ -13,7 +16,8 @@ model TestCheckValve period=100, offset=3e5) annotation (Placement(transformation(extent={{-80,-10},{-60,10}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.CheckValve checkValve3 + ThermoSysPro.Fluid.PressureLosses.CheckValve checkValve3( + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{0,-10},{20,10}}, rotation=0))); equation connect(sourceP1.C, checkValve3.C1) diff --git a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/PressureLoss/TestControlValve.mo b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/PressureLoss/TestControlValve.mo index 61789a1e..b2220c51 100644 --- a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/PressureLoss/TestControlValve.mo +++ b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/PressureLoss/TestControlValve.mo @@ -1,13 +1,18 @@ within ThermoSysPro.Fluid.Examples.Book.SimpleExamples.PressureLoss; model TestControlValve + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; - ThermoSysPro.Fluid.BoundaryConditions.SourceP SourceP1 + ThermoSysPro.Fluid.BoundaryConditions.SourceP SourceP1( + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-64,-10},{-44,10}}, rotation= 0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP PuitsP1 + ThermoSysPro.Fluid.BoundaryConditions.SinkP PuitsP1( + redeclare package Medium = Medium) annotation (Placement(transformation( extent={{44,-10},{64,10}},rotation=0))); - ThermoSysPro.Fluid.PressureLosses.ControlValve ControlValve(mode_caract=1, caract=[ + ThermoSysPro.Fluid.PressureLosses.ControlValve ControlValve( + redeclare package Medium = Medium, + mode_caract=1, caract=[ 0,0; 0.5,3000; 0.75,7000; 1,8000]) annotation (Placement(transformation( extent={{-10,-4},{10,16}},rotation=0))); diff --git a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/PressureLoss/TestDiaphragm.mo b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/PressureLoss/TestDiaphragm.mo index b01b951c..ee64a04c 100644 --- a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/PressureLoss/TestDiaphragm.mo +++ b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/PressureLoss/TestDiaphragm.mo @@ -1,12 +1,16 @@ within ThermoSysPro.Fluid.Examples.Book.SimpleExamples.PressureLoss; model TestDiaphragm + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; - ThermoSysPro.Fluid.BoundaryConditions.SourceP SourceP1 + ThermoSysPro.Fluid.BoundaryConditions.SourceP SourceP1( + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-64,-10},{-44,10}},rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP PuitsP1 + ThermoSysPro.Fluid.BoundaryConditions.SinkP PuitsP1( + redeclare package Medium = Medium) annotation (Placement(transformation( extent={{44,-10},{64,10}},rotation=0))); - ThermoSysPro.Fluid.PressureLosses.Diaphragm Diaphragm + ThermoSysPro.Fluid.PressureLosses.Diaphragm Diaphragm( + redeclare package Medium = Medium) annotation (Placement(transformation( extent={{-10,-10},{10,10}}, rotation=0))); diff --git a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/PressureLoss/TestDynamicCheckValve.mo b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/PressureLoss/TestDynamicCheckValve.mo index 7ff1999b..0fb26b6a 100644 --- a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/PressureLoss/TestDynamicCheckValve.mo +++ b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/PressureLoss/TestDynamicCheckValve.mo @@ -1,13 +1,18 @@ within ThermoSysPro.Fluid.Examples.Book.SimpleExamples.PressureLoss; model TestDynamicCheckValve + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP1 + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP1( + redeclare package Medium = Medium) annotation (Placement(transformation( extent={{-38,-10},{-18,10}},rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.SinkP puitsP1( + redeclare package Medium = Medium, P0=6e5) annotation (Placement(transformation( extent={{42,-10},{62,10}},rotation=0))); - ThermoSysPro.Fluid.PressureLosses.DynamicCheckValve checkValve(J=10) + ThermoSysPro.Fluid.PressureLosses.DynamicCheckValve checkValve( + redeclare package Medium = Medium, + J=10) annotation (Placement(transformation(extent={{2,-10},{22,10}},rotation=0))); InstrumentationAndControl.Blocks.Sources.Sinusoide pulse( period=100, diff --git a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/PressureLoss/TestDynamicReliefValve.mo b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/PressureLoss/TestDynamicReliefValve.mo index bf4bdf35..bd3cba73 100644 --- a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/PressureLoss/TestDynamicReliefValve.mo +++ b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/PressureLoss/TestDynamicReliefValve.mo @@ -1,7 +1,9 @@ within ThermoSysPro.Fluid.Examples.Book.SimpleExamples.PressureLoss; model TestDynamicReliefValve + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; ThermoSysPro.Fluid.PressureLosses.DynamicReliefValve ReliefValve( + redeclare package Medium = Medium, mech_steady_state=false, caract=[0,0; 0.1,2745; 0.2,4915; 0.3,6391; 0.4,7339; 0.5,7949; 0.6,8351; 0.7,8625; 0.8,8818; 0.9,8958; 1,9063], @@ -15,23 +17,30 @@ model TestDynamicReliefValve Q(start=1.4404060369658185E-32)) annotation (Placement(transformation(extent={{0,20},{20,40}}, rotation=0))); ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe Pipe2( + redeclare package Medium = Medium, Pm(start=199283), Q(start=1335.993983016864)) annotation (Placement(transformation( extent={{40,-20},{60,0}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP Sink2 + ThermoSysPro.Fluid.BoundaryConditions.SinkP Sink2( + redeclare package Medium = Medium) annotation (Placement(transformation(extent= {{80,-20},{100,0}}, rotation=0))); ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe Pipe1( + redeclare package Medium = Medium, D=0.4, Pm(start=1478795.1075221882)) annotation (Placement(transformation( extent={{-40,-20},{-20,0}}, rotation=0))); - ThermoSysPro.Fluid.Volumes.VolumeD VolumeD1(P(start=298566), h(start= + ThermoSysPro.Fluid.Volumes.VolumeD VolumeD1( + redeclare package Medium = Medium, + P(start=298566), h(start= 72156.6431966866)) annotation (Placement(transformation( extent={{0,-20},{20,0}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP Sink1 + ThermoSysPro.Fluid.BoundaryConditions.SinkP Sink1( + redeclare package Medium = Medium) annotation (Placement(transformation(extent= {{40,20},{60,40}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP( + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-80,-20},{-60,0}}))); InstrumentationAndControl.Blocks.Sources.Rampe ramp( Duration=200, diff --git a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/PressureLoss/TestLumpedStraightPipe.mo b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/PressureLoss/TestLumpedStraightPipe.mo index 4a798a1b..cbfcbdb1 100644 --- a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/PressureLoss/TestLumpedStraightPipe.mo +++ b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/PressureLoss/TestLumpedStraightPipe.mo @@ -1,11 +1,17 @@ within ThermoSysPro.Fluid.Examples.Book.SimpleExamples.PressureLoss; model TestLumpedStraightPipe + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; - ThermoSysPro.Fluid.Volumes.Tank tank1(h0=2e5) annotation (Placement( + ThermoSysPro.Fluid.Volumes.Tank tank1( + redeclare package Medium = Medium, + h0=2e5) annotation (Placement( transformation(extent={{-50,16},{-30,36}}, rotation=0))); - ThermoSysPro.Fluid.Volumes.Tank tank2(z0=10) annotation (Placement( + ThermoSysPro.Fluid.Volumes.Tank tank2( + redeclare package Medium = Medium, + z0=10) annotation (Placement( transformation(extent={{30,16},{50,36}}, rotation=0))); ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe lumpedStraightPipe( + redeclare package Medium = Medium, inertia=true, lambda=0.012, lambda_fixed=true) annotation (Placement(transformation(extent={{-10,-24},{ diff --git a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/PressureLoss/TestPipePressureLoss.mo b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/PressureLoss/TestPipePressureLoss.mo index 7bb8be22..acf9db0f 100644 --- a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/PressureLoss/TestPipePressureLoss.mo +++ b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/PressureLoss/TestPipePressureLoss.mo @@ -1,13 +1,17 @@ within ThermoSysPro.Fluid.Examples.Book.SimpleExamples.PressureLoss; model TestPipePressureLoss + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; - ThermoSysPro.Fluid.BoundaryConditions.SourceP SourceP1 + ThermoSysPro.Fluid.BoundaryConditions.SourceP SourceP1( + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-85,-10},{-65,10}}, rotation= 0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP PuitsP1 + ThermoSysPro.Fluid.BoundaryConditions.SinkP PuitsP1( + redeclare package Medium = Medium) annotation (Placement(transformation( extent={{64,-10},{84,10}},rotation=0))); - ThermoSysPro.Fluid.PressureLosses.PipePressureLoss pipePressureLoss + ThermoSysPro.Fluid.PressureLosses.PipePressureLoss pipePressureLoss( + redeclare package Medium = Medium) annotation (Placement(transformation( extent={{-40,-53},{38,53}}, rotation=0))); diff --git a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/PressureLoss/TestSwitchValve.mo b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/PressureLoss/TestSwitchValve.mo index fac6f896..7cbf5fa4 100644 --- a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/PressureLoss/TestSwitchValve.mo +++ b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/PressureLoss/TestSwitchValve.mo @@ -1,22 +1,28 @@ within ThermoSysPro.Fluid.Examples.Book.SimpleExamples.PressureLoss; model TestSwitchValve + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; - ThermoSysPro.Fluid.BoundaryConditions.SourceP SourceP1 + ThermoSysPro.Fluid.BoundaryConditions.SourceP SourceP1( + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-90,-10},{-70,10}}, rotation= 0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP PuitsP1 + ThermoSysPro.Fluid.BoundaryConditions.SinkP PuitsP1( + redeclare package Medium = Medium) annotation (Placement(transformation( extent={{70,-10},{90,10}},rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SwitchValve SwitchValve + ThermoSysPro.Fluid.PressureLosses.SwitchValve SwitchValve( + redeclare package Medium = Medium) annotation (Placement(transformation( extent={{-18,-9},{18,37}},rotation=0))); ThermoSysPro.InstrumentationAndControl.Blocks.Logique.Pulse pulse( width=10, period=20) annotation (Placement(transformation(extent={{-50,31},{-30,51}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe perteDP2 + ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe perteDP2( + redeclare package Medium = Medium) annotation (Placement(transformation( extent={{-55,-10},{-35,10}},rotation=0))); - ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe perteDP1 + ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe perteDP1( + redeclare package Medium = Medium) annotation (Placement(transformation( extent={{34,-10},{54,10}},rotation=0))); equation diff --git a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/PressureLoss/TestThreeWayValve.mo b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/PressureLoss/TestThreeWayValve.mo index 95a0db81..3f791282 100644 --- a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/PressureLoss/TestThreeWayValve.mo +++ b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/PressureLoss/TestThreeWayValve.mo @@ -1,19 +1,24 @@ within ThermoSysPro.Fluid.Examples.Book.SimpleExamples.PressureLoss; model TestThreeWayValve + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; - ThermoSysPro.Fluid.BoundaryConditions.SourceP SourceP1 + ThermoSysPro.Fluid.BoundaryConditions.SourceP SourceP1( + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-90,-10},{-70,10}}, rotation= 0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP PuitsP1 + ThermoSysPro.Fluid.BoundaryConditions.SinkP PuitsP1( + redeclare package Medium = Medium) annotation (Placement(transformation( extent={{70,-10},{90,10}},rotation=0))); ThermoSysPro.Fluid.PressureLosses.ThreeWayValve threeWayValve( + redeclare package Medium = Medium, C2(Q(start=-7.902947109890763E-33)), C3(Q(start=2716.4138702433384)), Valve1(Pm(start=200000.0)), VolumeA1(h(start=71016.12237181117))) annotation (Placement(transformation(extent={{-10,-6},{10,14}},rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP PuitsP2 + ThermoSysPro.Fluid.BoundaryConditions.SinkP PuitsP2( + redeclare package Medium = Medium) annotation (Placement(transformation( extent={{70,-50},{90,-30}}, rotation=0))); diff --git a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/SolarCollector/TestFresnelField.mo b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/SolarCollector/TestFresnelField.mo index 35fa5758..718bcf15 100644 --- a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/SolarCollector/TestFresnelField.mo +++ b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/SolarCollector/TestFresnelField.mo @@ -1,5 +1,6 @@ within ThermoSysPro.Fluid.Examples.Book.SimpleExamples.SolarCollector; model TestFresnelField + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; public ThermoSysPro.Thermal.HeatTransfer.HeatExchangerWall heatExchangerWall( @@ -46,6 +47,7 @@ public annotation (Placement(transformation(extent={{-40,-36},{40,-2}}, rotation=0))); ThermoSysPro.Fluid.HeatExchangers.DynamicTwoPhaseFlowPipe dynamicTwoPhaseFlowPipe( + redeclare package Medium = Medium, ntubes=1, steady_state=true, rugosrel=0.00005, @@ -85,9 +87,13 @@ public T0=303) annotation (Placement(transformation(extent={{-40,-16},{40,72}}, rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP( + redeclare package Medium = Medium, h0=2000e3, P0=125e5) annotation (Placement(transformation(extent={ {48,-54},{68,-34}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceP(Q0=11, h0=1500e3) + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceP( + redeclare package Medium = Medium, + Q0=11, + h0=1500e3) annotation (Placement(transformation(extent={{-69,-53},{-49,-33}}, rotation=0))); ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Rampe DNI( diff --git a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/SteamTurbine/TestStodolaTurbine.mo b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/SteamTurbine/TestStodolaTurbine.mo index 94d1c2ad..b56693ef 100644 --- a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/SteamTurbine/TestStodolaTurbine.mo +++ b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/SteamTurbine/TestStodolaTurbine.mo @@ -1,12 +1,18 @@ within ThermoSysPro.Fluid.Examples.Book.SimpleExamples.SteamTurbine; model TestStodolaTurbine + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; - ThermoSysPro.Fluid.Machines.StodolaTurbine stodolaTurbine(Cst=2e6, + ThermoSysPro.Fluid.Machines.StodolaTurbine stodolaTurbine( + redeclare package Medium = Medium, + Cst=2e6, eta_is_nom=0.94) annotation (Placement(transformation(extent={{-10,-10},{10,10}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP puitsP(P0=10000000) + ThermoSysPro.Fluid.BoundaryConditions.SinkP puitsP( + redeclare package Medium = Medium, + P0=10000000) annotation (Placement(transformation(extent={{30,-10},{50,10}},rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP( + redeclare package Medium = Medium, option_temperature=false, P0=27000000, h0=3475.e3) diff --git a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/Volume/TestDynamicDrum.mo b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/Volume/TestDynamicDrum.mo index 7977bd97..bdd5cc5f 100644 --- a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/Volume/TestDynamicDrum.mo +++ b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/Volume/TestDynamicDrum.mo @@ -1,11 +1,14 @@ within ThermoSysPro.Fluid.Examples.Book.SimpleExamples.Volume; model TestDynamicDrum + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; + parameter ThermoSysPro.Units.xSI.Cv CvmaxWater(fixed=false, start=670) "Maximum CV (active if mode_caract=0)"; parameter Real LambdaPipe(fixed=false,start=0.085) "Friction pressure loss coefficient (active if lambda_fixed=true)"; ThermoSysPro.Fluid.Volumes.DynamicDrum Drum( + redeclare package Medium = Medium, Vv(start=39), Vertical=false, hl(start=1454400), @@ -19,6 +22,7 @@ model TestDynamicDrum Tp(start=592.6)) annotation (Placement(transformation(extent={{-61,16},{1, 78}}, rotation=0))); ThermoSysPro.Fluid.PressureLosses.ControlValve FeedwaterValve( + redeclare package Medium = Medium, Cv(start=335), Q(start=79.5), rho(start=888), @@ -33,6 +37,7 @@ model TestDynamicDrum annotation (Placement(transformation(extent={{-120,74},{ -100,94}}, rotation=0))); ThermoSysPro.Fluid.PressureLosses.ControlValve SteamValve( + redeclare package Medium = Medium, Cv(start=25000), Q(start=79.5), rho(start=78.5), @@ -42,6 +47,7 @@ model TestDynamicDrum annotation (Placement(transformation(extent={{40,74},{60,94}}, rotation=0))); ThermoSysPro.Fluid.HeatExchangers.DynamicTwoPhaseFlowPipe TubeEcranBoucleEvaporatoire( + redeclare package Medium = Medium, T0=fill(400, 10), heb(start={10409,10268,10127,9985,9842,9698,9552,9406,9258,9111}), advection=false, @@ -75,6 +81,7 @@ model TestDynamicDrum extent={{-10,-10},{10,10}}, rotation=90))); ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe lumpedStraightPipe( + redeclare package Medium = Medium, L=20, z1=20, C1(P(start=130e5)), @@ -85,11 +92,13 @@ model TestDynamicDrum extent={{10,-10},{-10,10}}, rotation=90))); ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceQ(h0=1400000, + redeclare package Medium = Medium, option_temperature=false, P0=13300000) annotation (Placement(transformation(extent={{-196,68},{-176,88}}, rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP( + redeclare package Medium = Medium, option_temperature=false, h0=2.650e6, P0=12700000) diff --git a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/Volume/TestMixer3.mo b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/Volume/TestMixer3.mo index 3d90a867..b32f607f 100644 --- a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/Volume/TestMixer3.mo +++ b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/Volume/TestMixer3.mo @@ -1,34 +1,40 @@ within ThermoSysPro.Fluid.Examples.Book.SimpleExamples.Volume; model TestMixer3 + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; - ThermoSysPro.Fluid.Junctions.Mixer3 mixer2_2 + ThermoSysPro.Fluid.Junctions.Mixer3 mixer2_2( + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-6,-10},{14,10}}, rotation=0))); ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss3 annotation (Placement(transformation(extent={{34,-10}, + singularPressureLoss3(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{34,-10}, {54,10}}, rotation=0))); ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss4 annotation (Placement(transformation(extent={{-46,10}, + singularPressureLoss4(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-46,10}, {-26,30}}, rotation=0))); ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss5 annotation (Placement(transformation(extent={{-46,-30}, + singularPressureLoss5(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-46,-30}, {-26,-10}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.Source sourceP2 + ThermoSysPro.Fluid.BoundaryConditions.Source sourceP2( + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-86,10},{-66,30}}, rotation= 0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP3 + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP3( + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-86,-30},{-66,-10}}, rotation= 0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkP1 + ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkP1( + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{74,-10},{94,10}}, rotation= 0))); ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Constante constante1(k= 0.5) annotation (Placement(transformation(extent={{-46,30},{-26,50}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ( + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-86,-10},{-66,10}}, rotation= 0))); ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss6 annotation (Placement(transformation(extent={{-46,-10}, + singularPressureLoss6(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-46,-10}, {-26,10}}, rotation=0))); equation connect(singularPressureLoss4.C2, mixer2_2.Ce1) annotation (Line(points={{-26,20}, diff --git a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/Volume/TestPressurizer.mo b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/Volume/TestPressurizer.mo index 76d25762..ba1629c7 100644 --- a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/Volume/TestPressurizer.mo +++ b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/Volume/TestPressurizer.mo @@ -1,12 +1,14 @@ within ThermoSysPro.Fluid.Examples.Book.SimpleExamples.Volume; model TestPressurizer + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; - parameter Units.SI.Power Wch(fixed=false) = 0.29e6 + parameter Units.SI.Power Wch(fixed=true) = 0.29e6 "Power released by the electrical heaters"; - parameter Real OUVfeedwaterValve( fixed=false)=0.01 + parameter Real OUVfeedwaterValve( fixed=true)=0.01 "Position of the feedwater valve"; ThermoSysPro.Fluid.PressureLosses.ControlValve FeedwaterValve_Spray( + redeclare package Medium = Medium, Cv(start=100), C1( P(start=160e5), @@ -17,11 +19,13 @@ model TestPressurizer Cvmax=5000) annotation (Placement(transformation(extent={{-110,130},{-90, 150}}, rotation=0))); ThermoSysPro.Fluid.PressureLosses.ControlValve SteamValve( + redeclare package Medium = Medium, Cv(start=25000), Cvmax(fixed=true) = 5000, Pm(start=15500000)) annotation (Placement(transformation(extent={{58,130},{78,150}}, rotation=0))); ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe lumpedStraightPipe( + redeclare package Medium = Medium, L=1, D=1, z1=1, @@ -37,23 +41,28 @@ model TestPressurizer true) = 0.5) annotation (Placement(transformation(extent={{0,156},{20, 176}}, rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP( + redeclare package Medium = Medium, option_temperature=false, h0=1270e3, P0=16000000) annotation (Placement(transformation(extent={{-168,124},{-148,144}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkQ(Q0=0, h0=3e6) + ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkQ( + redeclare package Medium = Medium, + Q0=0, + h0=3e6) annotation (Placement(transformation(extent={{106,124},{126,144}}, rotation= 0))); ThermoSysPro.Fluid.Volumes.Pressurizer pressurizer( + redeclare package Medium = Medium, Zm=10.15, Klv=0.5e6, cpp=600, hl(start=1629887.98290107), hv(start=2596216.59571565), Zl(start=5.5900717167325), - Yw0=60, - steady_state=true, + Yw0=32.92, + steady_state=false, V=61.12, Rp=1.27, Ae=96.23, @@ -64,12 +73,15 @@ model TestPressurizer Ccond=0.02, Cevap=0.05, Yw(start=32.92), - y(start=0.3292, fixed=true), + y(start=0.3292), P0=15500000, - P(start=15500000, fixed=true), + P(start=15500000), Tp(start=617.94155291055)) annotation (Placement(transformation(extent={{-92, -12},{32,118}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkQ1( Q0=0, h0=1600000) + ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkQ1( + redeclare package Medium = Medium, + Q0=0, + h0=1600000) annotation (Placement(transformation(extent={{-30,-76},{-10,-56}}, rotation=0))); ThermoSysPro.Thermal.BoundaryConditions.HeatSource SourceC1( diff --git a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/Volume/TestSplitter3.mo b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/Volume/TestSplitter3.mo index eed8f5a9..c9da836e 100644 --- a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/Volume/TestSplitter3.mo +++ b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/Volume/TestSplitter3.mo @@ -1,30 +1,37 @@ within ThermoSysPro.Fluid.Examples.Book.SimpleExamples.Volume; model TestSplitter3 + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; - ThermoSysPro.Fluid.Junctions.Splitter3 splitter3 + ThermoSysPro.Fluid.Junctions.Splitter3 splitter3( + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-16,-10},{4,10}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceP1(Q0=100, + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceP1( + redeclare package Medium = Medium, + Q0=100, option_temperature=true) annotation (Placement(transformation(extent={{-96,-10},{-76,10}}, rotation=0))); ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss3 annotation (Placement(transformation(extent={{-56,-10}, + singularPressureLoss3(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-56,-10}, {-36,10}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.Sink sinkP2 + ThermoSysPro.Fluid.BoundaryConditions.Sink sinkP2( + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{84,30},{104,50}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.Sink sinkP3 + ThermoSysPro.Fluid.BoundaryConditions.Sink sinkP3( + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{84,-50},{104,-30}}, rotation= 0))); ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss4 annotation (Placement(transformation(extent={{44,30}, + singularPressureLoss4(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{44,30}, {64,50}},rotation=0))); ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss5 annotation (Placement(transformation(extent={{44,-50}, + singularPressureLoss5(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{44,-50}, {64,-30}}, rotation=0))); ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Constante constante1(k= 0) annotation (Placement(transformation(extent={{-36,10},{-16,30}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP4 + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP4( + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{84,-10},{104,10}}, rotation= 0))); ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Constante constante2(k= diff --git a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/Volume/TestStaticDrum3.mo b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/Volume/TestStaticDrum3.mo index e1378a5e..6eb37c0f 100644 --- a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/Volume/TestStaticDrum3.mo +++ b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/Volume/TestStaticDrum3.mo @@ -1,17 +1,26 @@ within ThermoSysPro.Fluid.Examples.Book.SimpleExamples.Volume; model TestStaticDrum3 + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; - ThermoSysPro.Fluid.Junctions.StaticDrum StaticDrumTh1 + ThermoSysPro.Fluid.Junctions.StaticDrum StaticDrumTh1( + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-30,1},{20,51}}, rotation=0))); ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLossVALI1(K=1e-4) + singularPressureLossVALI1( + redeclare package Medium = Medium, + K=1e-4) annotation (Placement(transformation(extent={{38,7},{58,27}}, rotation=0))); ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLossVALI2(K=1e-4) + singularPressureLossVALI2( + redeclare package Medium = Medium, + K=1e-4) annotation (Placement(transformation(extent={{-58,-8},{-38,12}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkQ(Q0=10) + ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkQ( + redeclare package Medium = Medium, + Q0=10) annotation (Placement(transformation(extent={{74,7},{94,27}}, rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourcePQ( + redeclare package Medium = Medium, Q0=100, h0=1400e3, P0=10000000) @@ -22,11 +31,16 @@ model TestStaticDrum3 extent={{-10,-10},{10,10}}, rotation=90))); ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLossVALI3(K=1e-4) + singularPressureLossVALI3( + redeclare package Medium = Medium, + K=1e-4) annotation (Placement(transformation(extent={{38,52},{58,72}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.Sink sink + ThermoSysPro.Fluid.BoundaryConditions.Sink sink( + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{74,52},{94,72}}, rotation=0))); ThermoSysPro.Fluid.HeatExchangers.DynamicTwoPhaseFlowPipe dynamicTwoPhaseFlowPipe( + redeclare package Medium = Medium, + inertia=false, z1=0, rugosrel=0.0001, D=0.05, @@ -37,16 +51,19 @@ model TestStaticDrum3 extent={{13.5,11.5},{-13.5,-11.5}}, rotation=270))); ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe lumpedStraightPipe( + redeclare package Medium = Medium, lambda(fixed=false) = 0.03, D=0.05, ntubes=10, L=10, z1=10, - Q(fixed=true, start=30)) annotation (Placement(transformation( + Q(fixed=false, start=30)) annotation (Placement(transformation( origin={20,-45}, extent={{-14,-12},{14,12}}, rotation=270))); - ThermoSysPro.Fluid.Volumes.VolumeA volumeA annotation (Placement(transformation( + ThermoSysPro.Fluid.Volumes.VolumeA volumeA( + redeclare package Medium = Medium, + steady_state=false) annotation (Placement(transformation( extent={{1,-72},{-9,-62}}, rotation=0))); ThermoSysPro.Thermal.BoundaryConditions.HeatSource heatSource1( option_temperature=2, diff --git a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/Volume/TestSteamDryer.mo b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/Volume/TestSteamDryer.mo index 5dd37429..a9d8b92a 100644 --- a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/Volume/TestSteamDryer.mo +++ b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/Volume/TestSteamDryer.mo @@ -1,27 +1,36 @@ within ThermoSysPro.Fluid.Examples.Book.SimpleExamples.Volume; model TestSteamDryer + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; - ThermoSysPro.Fluid.Junctions.SteamDryer steamDryer(eta=0.9, P(start= + ThermoSysPro.Fluid.Junctions.SteamDryer steamDryer( + redeclare package Medium = Medium, + eta=0.9, P(start= 10000000)) annotation (Placement(transformation(extent={{-10,-8},{10, 12}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourceQ(P0=10000000, h0= + ThermoSysPro.Fluid.BoundaryConditions.SourcePQ sourceQ( + redeclare package Medium = Medium, + P0=10000000, h0= 2400000) annotation (Placement(transformation(extent={{-90,-4},{-70,16}}, rotation= 0))); ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss2 annotation (Placement(transformation(extent={{-50,-4}, + singularPressureLoss2(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-50,-4}, {-30,16}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.Sink sinkP + ThermoSysPro.Fluid.BoundaryConditions.Sink sinkP( + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{70,-4},{90,16}}, rotation=0))); ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss1 annotation (Placement(transformation(extent={{30,-4}, + singularPressureLoss1(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{30,-4}, {50,16}}, rotation=0))); ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss3(K=1.e-4) + singularPressureLoss3( + redeclare package Medium = Medium, + K=1.e-4) annotation (Placement(transformation(extent={{30,-44}, {50,-24}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.Sink sink + ThermoSysPro.Fluid.BoundaryConditions.Sink sink( + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{70,-44},{90,-24}}, rotation=0))); equation diff --git a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/Volume/TestTank.mo b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/Volume/TestTank.mo index 96318f98..bb83a52b 100644 --- a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/Volume/TestTank.mo +++ b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/Volume/TestTank.mo @@ -1,25 +1,34 @@ within ThermoSysPro.Fluid.Examples.Book.SimpleExamples.Volume; model TestTank + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; - ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe PerteDP1 + ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe PerteDP1( + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{30,-50},{50,-30}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.ControlValve VanneReglante1 + ThermoSysPro.Fluid.PressureLosses.ControlValve VanneReglante1( + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-50,2},{-30,22}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceP SourceP1 + ThermoSysPro.Fluid.BoundaryConditions.SourceP SourceP1( + redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-90,-4},{-70,16}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP PuitsP1 + ThermoSysPro.Fluid.BoundaryConditions.SinkP PuitsP1( + redeclare package Medium = Medium) annotation (Placement(transformation( extent={{70,-50},{90,-30}}, rotation=0))); - ThermoSysPro.Fluid.Volumes.Tank Tank1(z(fixed=false, start=5)) + ThermoSysPro.Fluid.Volumes.Tank Tank1( + redeclare package Medium = Medium, + z(fixed=false, start=5)) annotation (Placement(transformation(extent={{-10,-10},{10,10}}, rotation=0))); ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Rampe Rampe1 annotation (Placement(transformation(extent={{-90,30},{-70,50}}, rotation= 0))); - ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe PerteDP2 + ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe PerteDP2( + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{30,-4},{50,16}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP PuitsP2 + ThermoSysPro.Fluid.BoundaryConditions.SinkP PuitsP2( + redeclare package Medium = Medium) annotation (Placement(transformation( extent={{70,-4},{90,16}}, rotation=0))); equation diff --git a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/Volume/TestVolumeATh.mo b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/Volume/TestVolumeATh.mo index ab93fe88..f61040f7 100644 --- a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/Volume/TestVolumeATh.mo +++ b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/Volume/TestVolumeATh.mo @@ -1,7 +1,9 @@ within ThermoSysPro.Fluid.Examples.Book.SimpleExamples.Volume; model TestVolumeATh + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; ThermoSysPro.Fluid.Volumes.VolumeATh volumeATh( + redeclare package Medium = Medium, h0=1.2e5, V=1, P0=300000, @@ -9,28 +11,35 @@ model TestVolumeATh annotation (Placement(transformation(extent={{-15,21},{15,-9}}, rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.SinkP sink( + redeclare package Medium = Medium, T0=320, option_temperature=false, h0=200000) annotation (Placement(transformation(extent={{64,-4},{84,16}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.ControlValve controlValve1(Cvmax=80) + ThermoSysPro.Fluid.PressureLosses.ControlValve controlValve1( + redeclare package Medium = Medium, + Cvmax=80) annotation (Placement(transformation(extent={{-47,-58},{-27,-38}}, rotation= 0))); ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Rampe Rampe(Finalvalue= 0, Initialvalue=1) annotation (Placement(transformation( extent={{-89,-38},{-73,-22}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.ControlValve controlValve2 + ThermoSysPro.Fluid.PressureLosses.ControlValve controlValve2( + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{28,2},{48,22}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceQ( + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-83,-6},{-59,18}}, rotation=0))); ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Constante Constant annotation (Placement(transformation( extent={{10,18},{26,34}}, rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP2( + redeclare package Medium = Medium, option_temperature=false) annotation (Placement(transformation(extent={{-79,-64},{-59,-44}}, rotation= 0))); ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe lumpedStraightPipe1( + redeclare package Medium = Medium, L=0.1, D=1) annotation (Placement(transformation(extent={{-47,-4},{-27,16}}, rotation=0))); ThermoSysPro.InstrumentationAndControl.Blocks.Tables.Table1DTemps Table1DTemps(Table=[0,10; From 3155c90120bb1ee8fb80514d5118b4a2fae43191 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Wed, 20 May 2026 11:36:24 +0200 Subject: [PATCH 174/178] #125 ThermoSysPro.Fluid.Examples.Book.SimpleExample.HX but not all working --- .../DynamicWaterHeater/Islanding.mo | 33 ++++++++++++--- .../DynamicWaterHeater/NegativeFlow.mo | 33 ++++++++++++--- .../DynamicWaterHeater/ZeroFlow.mo | 33 ++++++++++++--- .../HeatExchanger/TestDynamicCondenser.mo | 23 +++++++++-- .../TestDynamicOnePhaseFlowShell.mo | 12 ++++-- .../TestDynamicPlateHeatExchanger.mo | 20 +++++---- .../TestDynamicTwoPhaseFlowPipe.mo | 11 +++-- .../HeatExchanger/TestNTUWaterHeater.mo | 37 ++++++++++++----- .../TestSimpleDynamicCondenser.mo | 27 +++++++++--- .../HeatExchanger/TestStaticCondenser.mo | 40 ++++++++++++++---- .../TestStaticPlateHeatExchanger.mo | 41 +++++++++++++------ 11 files changed, 238 insertions(+), 72 deletions(-) diff --git a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/HeatExchanger/DynamicWaterHeater/Islanding.mo b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/HeatExchanger/DynamicWaterHeater/Islanding.mo index 8437f2af..7f414a7e 100644 --- a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/HeatExchanger/DynamicWaterHeater/Islanding.mo +++ b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/HeatExchanger/DynamicWaterHeater/Islanding.mo @@ -1,17 +1,21 @@ within ThermoSysPro.Fluid.Examples.Book.SimpleExamples.HeatExchanger.DynamicWaterHeater; model Islanding + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP( + redeclare package Medium = Medium, option_temperature=false, P0=22.733e5, h0=2650.6e3) annotation (Placement(transformation(extent={{-192,110},{-150,150}}, rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.SinkP Puit_condenseur1( + redeclare package Medium = Medium, option_temperature=false, P0(fixed=true) = 10e5) annotation (Placement(transformation(extent={{124,-202},{160,-162}}, rotation=0))); ThermoSysPro.Fluid.PressureLosses.ControlValve ControlValve_eau( + redeclare package Medium = Medium, Q(fixed=false, start=56), Cvmax(fixed=false) = 354.534, mode_caract=0, @@ -21,6 +25,8 @@ model Islanding {108,-166}}, rotation=0))); ThermoSysPro.Fluid.HeatExchangers.DynamicWaterHeater WaterHeating( + redeclare package Medium = Medium, + redeclare package Medium_Cooling = Medium, Dc=0.016, Lc=2.56, PasL=0.027, @@ -129,15 +135,22 @@ model Islanding annotation (Placement(transformation(extent={{-58,-90},{162,96}}, rotation= 0))); - ThermoSysPro.Fluid.BoundaryConditions.Sink Puit_condenseur2(h0=940.000e3) + ThermoSysPro.Fluid.BoundaryConditions.Sink Puit_condenseur2( + redeclare package Medium = Medium, + h0=940.000e3) annotation (Placement(transformation(extent={{-150,22},{-192,66}}, rotation=0))); ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLossWaterIn(Q(fixed=false, start=650), K=35) + singularPressureLossWaterIn( + redeclare package Medium = Medium, + Q(fixed=false, start=650), + K=35) annotation (Placement(transformation(extent={{-99,-48}, {-79,-28}}, rotation=0))); ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLossWaterOut(Q(fixed=false, start=650), K=30, + singularPressureLossWaterOut( + redeclare package Medium = Medium, + Q(fixed=false, start=650), K=30, C2(h_vol_1(start=927700), h(start=927700))) annotation (Placement(transformation(extent={{-80,34}, {-100,54}}, rotation=0))); @@ -151,13 +164,16 @@ model Islanding annotation (Placement(transformation(extent={{-196,-88},{ -176,-68}}, rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP1( + redeclare package Medium = Medium, P0=71.29e5, h0=772.09e3, T0=454.46, option_temperature=true) annotation (Placement(transformation(extent={{-192,-60},{-150,-16}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.RefQ refQ(Q0=53) + ThermoSysPro.Fluid.BoundaryConditions.RefQ refQ( + redeclare package Medium = Medium, + Q0=53) annotation (Placement(transformation(extent={{-115,34},{-135,54}}, rotation= 0))); ThermoSysPro.InstrumentationAndControl.Blocks.Tables.Table1DTemps Debit_eauA( @@ -176,11 +192,15 @@ model Islanding ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Constante Level(k=0.43) annotation (Placement(transformation(extent={{191, -140},{169,-118}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.IdealCheckValve checkValve(C2(h_vol_1(start=2600e3), h(start=2600e3))) + ThermoSysPro.Fluid.PressureLosses.IdealCheckValve checkValve( + redeclare package Medium = Medium, + C2(h_vol_1(start=2600e3), h(start=2600e3))) annotation (Placement(transformation(extent={{-100,122},{-84,138}}, rotation=0))); ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLossPurge(Q(fixed=false, start=56), K=1e-3, + singularPressureLossPurge( + redeclare package Medium = Medium, + Q(fixed=false, start=56), K=1e-3, T(fixed=true, start=461.56), Pm(start=2220000)) annotation (Placement(transformation( origin={54,-138}, @@ -191,6 +211,7 @@ model Islanding annotation (Placement(transformation(extent={{162,-178},{182, -158}}, rotation=0))); ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe PressureLoss_Steam( + redeclare package Medium = Medium, Q(fixed=false, start=650), lambda(fixed=false) = 0.03, L=48.72, diff --git a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/HeatExchanger/DynamicWaterHeater/NegativeFlow.mo b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/HeatExchanger/DynamicWaterHeater/NegativeFlow.mo index d73dc9a6..f8c679ca 100644 --- a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/HeatExchanger/DynamicWaterHeater/NegativeFlow.mo +++ b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/HeatExchanger/DynamicWaterHeater/NegativeFlow.mo @@ -1,17 +1,21 @@ within ThermoSysPro.Fluid.Examples.Book.SimpleExamples.HeatExchanger.DynamicWaterHeater; model NegativeFlow + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP( + redeclare package Medium = Medium, option_temperature=false, P0=22.733e5, h0=2650.6e3) annotation (Placement(transformation(extent={{-192,110},{-150,150}}, rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.SinkP Puit_condenseur1( + redeclare package Medium = Medium, option_temperature=false, P0(fixed=true) = 10e5) annotation (Placement(transformation(extent={{124,-202},{160,-162}}, rotation=0))); ThermoSysPro.Fluid.PressureLosses.ControlValve ControlValve_eau( + redeclare package Medium = Medium, Q(fixed=false, start=56), Cvmax(fixed=false) = 354.534, mode_caract=0, @@ -21,6 +25,8 @@ model NegativeFlow {108,-166}}, rotation=0))); ThermoSysPro.Fluid.HeatExchangers.DynamicWaterHeater WaterHeating( + redeclare package Medium = Medium, + redeclare package Medium_Cooling = Medium, Dc=0.016, Lc=2.56, PasL=0.027, @@ -130,15 +136,22 @@ model NegativeFlow annotation (Placement(transformation(extent={{-58,-90},{162,96}}, rotation= 0))); - ThermoSysPro.Fluid.BoundaryConditions.Sink Puit_condenseur2(h0=940.000e3) + ThermoSysPro.Fluid.BoundaryConditions.Sink Puit_condenseur2( + redeclare package Medium = Medium, + h0=940.000e3) annotation (Placement(transformation(extent={{-150,22},{-192,66}}, rotation=0))); ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLossWaterIn(Q(fixed=false, start=650), K=35) + singularPressureLossWaterIn( + redeclare package Medium = Medium, + Q(fixed=false, start=650), + K=35) annotation (Placement(transformation(extent={{-99,-48}, {-79,-28}}, rotation=0))); ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLossWaterOut(Q(fixed=false, start=650), K=30, + singularPressureLossWaterOut( + redeclare package Medium = Medium, + Q(fixed=false, start=650), K=30, C2(h_vol_1(start=927700), h(start=927700))) annotation (Placement(transformation(extent={{-80,34}, {-100,54}}, rotation=0))); @@ -151,13 +164,16 @@ model NegativeFlow annotation (Placement(transformation(extent={{-196,-88},{ -176,-68}}, rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP1( + redeclare package Medium = Medium, P0=71.29e5, h0=772.09e3, T0=454.46, option_temperature=true) annotation (Placement(transformation(extent={{-192,-60},{-150,-16}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.RefQ refQ(Q0=53) + ThermoSysPro.Fluid.BoundaryConditions.RefQ refQ( + redeclare package Medium = Medium, + Q0=53) annotation (Placement(transformation(extent={{-115,34},{-135,54}}, rotation= 0))); ThermoSysPro.InstrumentationAndControl.Blocks.Tables.Table1DTemps Debit_eauA(Table=[0, @@ -175,11 +191,15 @@ model NegativeFlow ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Constante Level(k=0.43) annotation (Placement(transformation(extent={{191, -140},{169,-118}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.IdealCheckValve checkValve(C2(h_vol_1(start=2600e3), h(start=2600e3))) + ThermoSysPro.Fluid.PressureLosses.IdealCheckValve checkValve( + redeclare package Medium = Medium, + C2(h_vol_1(start=2600e3), h(start=2600e3))) annotation (Placement(transformation(extent={{-100,122},{-84,138}}, rotation=0))); ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLossPurge(Q(fixed=false, start=56), K=1e-3, + singularPressureLossPurge( + redeclare package Medium = Medium, + Q(fixed=false, start=56), K=1e-3, T(fixed=true, start=461.56), Pm(start=2220000)) annotation (Placement(transformation( origin={54,-138}, @@ -190,6 +210,7 @@ model NegativeFlow annotation (Placement(transformation(extent={{162,-178},{182, -158}}, rotation=0))); ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe PressureLoss_Steam( + redeclare package Medium = Medium, Q(fixed=false, start=650), lambda(fixed=false) = 0.03, L=48.72, diff --git a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/HeatExchanger/DynamicWaterHeater/ZeroFlow.mo b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/HeatExchanger/DynamicWaterHeater/ZeroFlow.mo index bcd3c1cb..f7e45860 100644 --- a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/HeatExchanger/DynamicWaterHeater/ZeroFlow.mo +++ b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/HeatExchanger/DynamicWaterHeater/ZeroFlow.mo @@ -1,17 +1,21 @@ within ThermoSysPro.Fluid.Examples.Book.SimpleExamples.HeatExchanger.DynamicWaterHeater; model ZeroFlow + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP( + redeclare package Medium = Medium, option_temperature=false, P0=22.733e5, h0=2650.6e3) annotation (Placement(transformation(extent={{-192,110},{-150,150}}, rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.SinkP Puit_condenseur1( + redeclare package Medium = Medium, option_temperature=false, P0(fixed=true) = 10e5) annotation (Placement(transformation(extent={{124,-202},{160,-162}}, rotation=0))); ThermoSysPro.Fluid.PressureLosses.ControlValve ControlValve_eau( + redeclare package Medium = Medium, Q(fixed=false, start=56), Cvmax(fixed=false) = 354.534, mode_caract=0, @@ -21,6 +25,8 @@ model ZeroFlow {108,-166}}, rotation=0))); ThermoSysPro.Fluid.HeatExchangers.DynamicWaterHeater WaterHeating( + redeclare package Medium = Medium, + redeclare package Medium_Cooling = Medium, Dc=0.016, Lc=2.56, PasL=0.027, @@ -130,15 +136,22 @@ model ZeroFlow annotation (Placement(transformation(extent={{-58,-90},{162,96}}, rotation= 0))); - ThermoSysPro.Fluid.BoundaryConditions.Sink Puit_condenseur2(h0=940.000e3) + ThermoSysPro.Fluid.BoundaryConditions.Sink Puit_condenseur2( + redeclare package Medium = Medium, + h0=940.000e3) annotation (Placement(transformation(extent={{-150,22},{-192,66}}, rotation=0))); ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLossWaterIn(Q(fixed=false, start=650), K=35) + singularPressureLossWaterIn( + redeclare package Medium = Medium, + Q(fixed=false, start=650), + K=35) annotation (Placement(transformation(extent={{-99,-48}, {-79,-28}}, rotation=0))); ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLossWaterOut(Q(fixed=false, start=650), K=30, + singularPressureLossWaterOut( + redeclare package Medium = Medium, + Q(fixed=false, start=650), K=30, C2(h_vol_1(start=927700), h(start=927700))) annotation (Placement(transformation(extent={{-80,34}, {-100,54}}, rotation=0))); @@ -151,13 +164,16 @@ model ZeroFlow annotation (Placement(transformation(extent={{-196,-88},{ -176,-68}}, rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP1( + redeclare package Medium = Medium, P0=71.29e5, h0=772.09e3, T0=454.46, option_temperature=true) annotation (Placement(transformation(extent={{-192,-16},{-150,-60}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.RefQ refQ(Q0=53) + ThermoSysPro.Fluid.BoundaryConditions.RefQ refQ( + redeclare package Medium = Medium, + Q0=53) annotation (Placement(transformation(extent={{-115,34},{-135,54}}, rotation= 0))); ThermoSysPro.InstrumentationAndControl.Blocks.Tables.Table1DTemps Debit_eauA(Table=[0, @@ -175,11 +191,15 @@ model ZeroFlow ThermoSysPro.InstrumentationAndControl.Blocks.Sources.Constante Level(k=0.43) annotation (Placement(transformation(extent={{191, -140},{169,-118}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.IdealCheckValve checkValve(C2(h_vol_1(start=2600e3), h(start=2600e3))) + ThermoSysPro.Fluid.PressureLosses.IdealCheckValve checkValve( + redeclare package Medium = Medium, + C2(h_vol_1(start=2600e3), h(start=2600e3))) annotation (Placement(transformation(extent={{-100,122},{-84,138}}, rotation=0))); ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLossPurge(Q(fixed=false, start=56), K=1e-3, + singularPressureLossPurge( + redeclare package Medium = Medium, + Q(fixed=false, start=56), K=1e-3, T(fixed=true, start=461.56), Pm(start=2220000)) annotation (Placement(transformation( origin={54,-138}, @@ -190,6 +210,7 @@ model ZeroFlow annotation (Placement(transformation(extent={{162,-178},{182, -158}}, rotation=0))); ThermoSysPro.Fluid.PressureLosses.LumpedStraightPipe PressureLoss_Steam( + redeclare package Medium = Medium, Q(fixed=false, start=650), lambda(fixed=false) = 0.03, L=48.72, diff --git a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/HeatExchanger/TestDynamicCondenser.mo b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/HeatExchanger/TestDynamicCondenser.mo index 7af4cbff..ac435324 100644 --- a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/HeatExchanger/TestDynamicCondenser.mo +++ b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/HeatExchanger/TestDynamicCondenser.mo @@ -1,5 +1,6 @@ within ThermoSysPro.Fluid.Examples.Book.SimpleExamples.HeatExchanger; model TestDynamicCondenser + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; parameter Real COP1( fixed=false,start=0.7) "Corrective terme for heat exchange coefficient or Fouling coefficient"; @@ -8,18 +9,25 @@ model TestDynamicCondenser //parameter Modelica.SIunits.Position z=1.05 "Liquid level in Cavity"; ThermoSysPro.Fluid.BoundaryConditions.SourceQ Source_Eau( + redeclare package Medium = Medium, h0=50000, Q0=19000) annotation (Placement(transformation(extent={{-191,-27},{-133,29}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceQ Source_vapeur(Q0=310, h0= + ThermoSysPro.Fluid.BoundaryConditions.SourceQ Source_vapeur( + redeclare package Medium = Medium, + Q0=310, h0= 2400e3) annotation (Placement(transformation(extent={{-192,144},{-134,200}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkQ Puit_condenseur1(Q0=310) + ThermoSysPro.Fluid.BoundaryConditions.SinkQ Puit_condenseur1( + redeclare package Medium = Medium, + Q0=310) annotation (Placement(transformation(extent={{151,-187},{213,-133}}, rotation=0))); ThermoSysPro.Fluid.HeatExchangers.DynamicCondenser DynamicCondenser( + redeclare package Medium = Medium, + redeclare package Medium_Cooling = Medium, Dc=0.016, ec=0.5e-3, ntubest=52176, @@ -57,17 +65,20 @@ model TestDynamicCondenser annotation (Placement(transformation(extent={{-47,-52},{71,64}}, rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.SinkP Puit_Eau( + redeclare package Medium = Medium, option_temperature=false, P0=100000) annotation (Placement(transformation(extent={{181,-8},{201,12}}, rotation=0))); ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss PressureLoss_VapeurIn( + redeclare package Medium = Medium, Q(start=900), K=1e-4, Pm(start=10000)) annotation (Placement(transformation(extent={{-100, 162},{-80,182}}, rotation=0))); ThermoSysPro.Fluid.PressureLosses.ControlValve Valve_ext( + redeclare package Medium = Medium, Q(fixed=false, start=927), C1(P(start=10000), Q(start=927)), Cvmax=15000, @@ -77,10 +88,14 @@ model TestDynamicCondenser annotation (Placement(transformation(extent={{113, -123},{91,-101}}, rotation=0))); ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - PressureLoss_VapeurIn_in4(K=1e-4, Q(fixed=false, start=0.01)) + PressureLoss_VapeurIn_in4( + redeclare package Medium = Medium, + K=1e-4, + Q(fixed=false, start=0.01)) annotation (Placement(transformation(extent={{-102,83}, {-82,102}}, rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.SourceQ Source_Vsup1(Q0=0.00001, + redeclare package Medium = Medium, h0=2759.6e3) annotation ( Placement(transformation( extent={{-191,65},{-134,119}}, rotation=0))); @@ -91,10 +106,12 @@ model TestDynamicCondenser rotation=0))); ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss PressureLoss_EauOut( + redeclare package Medium = Medium, K=1e-4, Q(start=20000)) annotation (Placement(transformation(extent={{112,-8}, {132,12}}, rotation=0))); ThermoSysPro.Fluid.PressureLosses.IdealCheckValve PressureLoss_VapeurIn1( + redeclare package Medium = Medium, Q(start=1000)) annotation (Placement(transformation( origin={12,96}, extent={{-6,-9},{6,9}}, diff --git a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/HeatExchanger/TestDynamicOnePhaseFlowShell.mo b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/HeatExchanger/TestDynamicOnePhaseFlowShell.mo index 33544c3a..b394a089 100644 --- a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/HeatExchanger/TestDynamicOnePhaseFlowShell.mo +++ b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/HeatExchanger/TestDynamicOnePhaseFlowShell.mo @@ -1,8 +1,11 @@ within ThermoSysPro.Fluid.Examples.Book.SimpleExamples.HeatExchanger; model TestDynamicOnePhaseFlowShell + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; ThermoSysPro.Fluid.HeatExchangers.DynamicOnePhaseFlowShell dynamicOnePhaseFlowPipeShell( + redeclare package Medium = Medium, + inertia=false, Q(start={30,30,30,30,30,30,30,30,30,30,30}), Ds=1, ntubes=520, @@ -10,14 +13,17 @@ model TestDynamicOnePhaseFlowShell P(start={2000000,1996000,1993000,1990000,1986000,1983000,1980000,1976000, 1973000,1965000,1955000,1950000})) annotation (Placement( transformation(extent={{-48,-36},{48,36}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP(option_temperature=false, P0(fixed= - false) = 1900000) + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP( + redeclare package Medium = Medium, + option_temperature=false, + P0=1900000) annotation (Placement(transformation(extent={{74,-15},{102,15}}, rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP( + redeclare package Medium = Medium, option_temperature=false, h0=600e3, - Q(start=500, fixed=true), + Q(start=500, fixed=false), P0=2000000) annotation (Placement(transformation(extent={{-103,-15},{-75,15}}, rotation=0))); diff --git a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/HeatExchanger/TestDynamicPlateHeatExchanger.mo b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/HeatExchanger/TestDynamicPlateHeatExchanger.mo index 5989c56d..87475594 100644 --- a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/HeatExchanger/TestDynamicPlateHeatExchanger.mo +++ b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/HeatExchanger/TestDynamicPlateHeatExchanger.mo @@ -1,12 +1,13 @@ within ThermoSysPro.Fluid.Examples.Book.SimpleExamples.HeatExchanger; model TestDynamicPlateHeatExchanger + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; ThermoSysPro.Fluid.HeatExchangers.DynamicPlateHeatExchanger echangeurAPlaques1D1( + redeclare package Medium_c = Medium, + redeclare package Medium_f = Medium, Ns=5, Sc(Q(fixed=true, start=1036)), - region_c=ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region.Region_1, - region_f=ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region.Region_1, Qc(start={39464.19306563736,39464.19140625,39464.19140625,39464.19140625,39464.19140625, 39464.19140625}), hc(start={280049.6746505721,280050.4252984669,280051.8112565058,280040.0015809256, @@ -24,19 +25,22 @@ model TestDynamicPlateHeatExchanger annotation (Placement(transformation(extent={{-14,6},{6,26}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP2(T0=340, region= - ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region.Region_1) + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP2( + redeclare package Medium = Medium, + T0=340) annotation (Placement(transformation(extent={{-74,6},{-54,26}}, rotation= 0))); - BoundaryConditions.SourceP sourcePQ(region=ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region.Region_1, + BoundaryConditions.SourceP sourcePQ( + redeclare package Medium = Medium, Q(start=1084)) annotation (Placement( transformation(extent={{-54,-14},{-34,6}}, rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.SinkP puitsP2(P0(fixed=false)= - 100000, region= - ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region.Region_1) + 100000, + redeclare package Medium = Medium) annotation (Placement(transformation( extent={{46,6},{66,26}}, rotation=0))); - BoundaryConditions.SinkP puitsP3(region=ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region.Region_1) + BoundaryConditions.SinkP puitsP3( + redeclare package Medium = Medium) annotation (Placement(transformation( extent={{26,-14},{46,6}}, rotation=0))); equation diff --git a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/HeatExchanger/TestDynamicTwoPhaseFlowPipe.mo b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/HeatExchanger/TestDynamicTwoPhaseFlowPipe.mo index 3e63b726..962b6345 100644 --- a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/HeatExchanger/TestDynamicTwoPhaseFlowPipe.mo +++ b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/HeatExchanger/TestDynamicTwoPhaseFlowPipe.mo @@ -1,12 +1,13 @@ within ThermoSysPro.Fluid.Examples.Book.SimpleExamples.HeatExchanger; model TestDynamicTwoPhaseFlowPipe + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; ThermoSysPro.Fluid.HeatExchangers.DynamicTwoPhaseFlowPipe dynamicTwoPhaseFlowPipe1( + redeclare package Medium = Medium, + inertia=false, L=10, D=0.03, - dpfCorr(fixed=false, - start=0.2396333653343408)= - 1, + dpfCorr=1, P(start={2000000.0,1999571.707027408,1999140.94021676,1998707.6248918818, 1998271.6837222823,1997833.0364982954,1997391.599890757, 1996715.8221090273,1995640.018272837,1994163.014585635, @@ -14,13 +15,15 @@ model TestDynamicTwoPhaseFlowPipe annotation (Placement(transformation(extent={{-40,-48}, {40,10}}, rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP1( - C(Q(fixed=true, start=1)), + redeclare package Medium = Medium, + C(Q(fixed=false, start=1)), option_temperature=false, h0=800e3, P0=2000000) annotation (Placement(transformation(extent={{-90,-28},{-70,-8}}, rotation= 0))); ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkP1( + redeclare package Medium = Medium, option_temperature=false, h0=2000e3, P0=19.9e5) diff --git a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/HeatExchanger/TestNTUWaterHeater.mo b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/HeatExchanger/TestNTUWaterHeater.mo index 8053f0e9..aef644a1 100644 --- a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/HeatExchanger/TestNTUWaterHeater.mo +++ b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/HeatExchanger/TestNTUWaterHeater.mo @@ -1,41 +1,56 @@ within ThermoSysPro.Fluid.Examples.Book.SimpleExamples.HeatExchanger; model TestNTUWaterHeater + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; ThermoSysPro.Fluid.BoundaryConditions.SourcePQ Water_inlet1( + redeclare package Medium = Medium, Q0=1788.90, h0=760.83e3, P0=8270000) annotation (Placement(transformation(extent={{-174,-16},{-154,4}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.Sink Puit_condenseur2 + ThermoSysPro.Fluid.BoundaryConditions.Sink Puit_condenseur2( + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{137,-16},{157,4}}, rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.SourceP Steam_inlet1( + redeclare package Medium = Medium, option_temperature=false, P0=17.49e5, h0=2432.50e3) annotation (Placement(transformation(extent={{-174,84},{-154,104}}, rotation=0))); ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss6(K=1e-4) + singularPressureLoss6( + redeclare package Medium = Medium, + K=1e-4) annotation (Placement(transformation(extent={{-111, -16},{-91,4}}, rotation=0))); ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss7(K=1e-4) + singularPressureLoss7( + redeclare package Medium = Medium, + K=1e-4) annotation (Placement(transformation(extent={{-110,84}, {-90,104}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.Sink Puit_condenseur3 + ThermoSysPro.Fluid.BoundaryConditions.Sink Puit_condenseur3( + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{136,-75},{156,-55}}, rotation=0))); ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss8(K=1e-4) + singularPressureLoss8( + redeclare package Medium = Medium, + K=1e-4) annotation (Placement(transformation(extent={{75,-16}, {95,4}}, rotation=0))); ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss9(K=1e-4) + singularPressureLoss9( + redeclare package Medium = Medium, + K=1e-4) annotation (Placement(transformation(extent={{75,-75}, {95,-55}}, rotation=0))); ThermoSysPro.Fluid.HeatExchangers.NTUWaterHeater nTUWaterHeating1( + redeclare package Medium_e = Medium, + redeclare package Medium_c = Medium, HeiF(start=900000), HDesF(start=900000), Hep(start=500000), @@ -47,20 +62,22 @@ model TestNTUWaterHeater h(start=780000)), Ep(Q(start=118)), Ev(P(start=27.22e5), h_vol_2(start=2430000)), - KCond(fixed=false) = 5024, - KPurge(fixed=false) = 1767, + KCond=5024, + KPurge=1767, Sp(h_vol_1(start=780.13e3), h(fixed=true, start=780.13e3)), - lambdaE(fixed=false) = 67.1, + lambdaE=67.1, SPurge=1458, Se(h(fixed=true, start=872.08e3), P(start=80.19e5, fixed=true))) annotation (Placement(transformation(extent={{-66,-77},{ 50,65}}, rotation=0))); ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss10( - K=1e-4) + redeclare package Medium = Medium, + K=1e-4) annotation (Placement(transformation(extent={{-110,35}, {-90,55}}, rotation=0))); BoundaryConditions.SourceQ Drain_inlet1( + redeclare package Medium = Medium, Q0=118.02, h0=889.89e3) annotation (Placement(transformation(extent={{-174,35},{-154,55}}, diff --git a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/HeatExchanger/TestSimpleDynamicCondenser.mo b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/HeatExchanger/TestSimpleDynamicCondenser.mo index 6612b1c9..c4e9292c 100644 --- a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/HeatExchanger/TestSimpleDynamicCondenser.mo +++ b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/HeatExchanger/TestSimpleDynamicCondenser.mo @@ -1,5 +1,6 @@ within ThermoSysPro.Fluid.Examples.Book.SimpleExamples.HeatExchanger; model TestSimpleDynamicCondenser + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; parameter Real L1 = 425 "First sensor chain length"; parameter Integer Ns1 = 80 "Number of cells in the first sensor chain"; @@ -8,47 +9,63 @@ parameter Real L2 = 75 "Second sensor chain length"; parameter Integer Ns2 = 1 "Number of cells in the second sensor chain"; ThermoSysPro.Fluid.BoundaryConditions.SinkP puitsPCaloporteur( + redeclare package Medium = Medium, P0=1e5, option_temperature=false) annotation (Placement(transformation(extent={{48,30}, {88,70}}, rotation=0))); ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - PerteChargeCondPompe( K=1e-6, Q(start= + PerteChargeCondPompe( + redeclare package Medium = Medium, + K=1e-6, Q(start= 0.598447)) annotation (Placement(transformation( origin={-90,-38}, extent={{-10,-10},{10,10}}, rotation=180))); ThermoSysPro.Fluid.BoundaryConditions.SourceP SourceRechauffeurEau( + redeclare package Medium = Medium, option_temperature=false, h0=2401e3, P0=15050) annotation (Placement(transformation(extent={{-207, 148},{-183,170}}, rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.SinkQ PuitsRechauffeurEau( + redeclare package Medium = Medium, h0=191812, Q0=192) annotation (Placement(transformation(extent={{-184, -52},{-208,-24}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourcePCaloporteur(Q0=29804.5, h0=113e3) + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourcePCaloporteur( + redeclare package Medium = Medium, + Q0=29804.5, h0=113e3) annotation (Placement(transformation(extent={{-212,30}, {-172,68}}, rotation=0))); ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - PerteChargeCondPompe1( K=1e-6) + PerteChargeCondPompe1( + redeclare package Medium = Medium, + K=1e-6) annotation (Placement(transformation( origin={36,50}, extent={{6,-10},{-6,10}}, rotation=180))); ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - PerteChargeCondPompe2( K=1e-6) + PerteChargeCondPompe2( + redeclare package Medium = Medium, + K=1e-6) annotation (Placement(transformation( origin={-154,49}, extent={{6,-10},{-6,10}}, rotation=180))); ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - PerteChargeCondPompe3(K(fixed=false) = 1e-3, Q(start=192, fixed=true)) + PerteChargeCondPompe3( + redeclare package Medium = Medium, + K=1e-3, + Q(start=192, fixed=false)) annotation (Placement(transformation( origin={-120,159}, extent={{10,-10},{-10,10}}, rotation=180))); ThermoSysPro.Fluid.HeatExchangers.SimpleDynamicCondenser Condenseur( D=0.018, + redeclare package Medium = Medium, + redeclare package Medium_Cooling = Medium, V=1000, A=100, lambda=0.01, diff --git a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/HeatExchanger/TestStaticCondenser.mo b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/HeatExchanger/TestStaticCondenser.mo index 8f6287be..a46ecb3a 100644 --- a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/HeatExchanger/TestStaticCondenser.mo +++ b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/HeatExchanger/TestStaticCondenser.mo @@ -1,5 +1,6 @@ within ThermoSysPro.Fluid.Examples.Book.SimpleExamples.HeatExchanger; model TestStaticCondenser + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; parameter Units.SI.AbsolutePressure Pin_1(fixed=false, start=20000) "Flow pressure at inlet 1 (sourceP)"; @@ -8,10 +9,13 @@ model TestStaticCondenser parameter Units.SI.AbsolutePressure Pin_3(fixed=false, start=20000) "Flow pressure at inlet 3 (sourceP2)"; - ThermoSysPro.Fluid.BoundaryConditions.SinkP Puit_condenseur(P0(fixed=false) = 100000) + ThermoSysPro.Fluid.BoundaryConditions.SinkP Puit_condenseur( + redeclare package Medium = Medium, + P0=100000) annotation (Placement(transformation(extent={{158,-15},{178,5}}, rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP( + redeclare package Medium = Medium, option_temperature=false, P0=Pin_1, C(Q(fixed=true, start=832.66)), @@ -19,42 +23,57 @@ model TestStaticCondenser annotation (Placement(transformation(extent={{-100,140},{-80,160}}, rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP1( + redeclare package Medium = Medium, option_temperature=false, h0=2.5481e6, C(Q(fixed=true, start=1e-5)), P0=Pin_2) annotation (Placement(transformation(extent={ {-182,80},{-162,100}}, rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP2( + redeclare package Medium = Medium, option_temperature=false, h0=2.5055e6, C(Q(fixed=true, start=1e-5)), P0=Pin_3) annotation (Placement(transformation(extent= {{-180,40},{-160,60}}, rotation=0))); ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss(K=10) + singularPressureLoss( + redeclare package Medium = Medium, + K=10) annotation (Placement(transformation(extent={{-100,80}, {-80,100}}, rotation=0))); ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss1(K=10) + singularPressureLoss1( + redeclare package Medium = Medium, + K=10) annotation (Placement(transformation(extent={{-100,40}, {-80,60}}, rotation=0))); ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss3(K=10) + singularPressureLoss3( + redeclare package Medium = Medium, + K=10) annotation (Placement(transformation(extent={{-40,140}, {-20,160}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.Sink Puit_condenseur1 + ThermoSysPro.Fluid.BoundaryConditions.Sink Puit_condenseur1( + redeclare package Medium = Medium) annotation (Placement(transformation(extent={{100,-100},{120,-80}}, rotation=0))); ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss4(K=1e-4) + singularPressureLoss4( + redeclare package Medium = Medium, + K=1e-4) annotation (Placement(transformation(extent={{98,-15}, {118,5}}, rotation=0))); ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss - singularPressureLoss5(K=1e-4) + singularPressureLoss5( + redeclare package Medium = Medium, + K=1e-4) annotation (Placement(transformation(extent={{40,-100}, {60,-80}}, rotation=0))); ThermoSysPro.Fluid.HeatExchangers.StaticCondenser condenseur( + redeclare package Medium = Medium, + redeclare package Medium_Cooling = Medium, SCO=47786, z=0, CPCE=0, @@ -62,12 +81,15 @@ model TestStaticCondenser QC0=37700) annotation (Placement(transformation( extent={{-24,-24},{68,74}}, rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.SourceQ Source_condenseur( + redeclare package Medium = Medium, h0=60e3, - C(P(fixed=true, start=328800)), + C(P(fixed=false, start=328800)), Q0(fixed=true) = 42261) annotation (Placement(transformation(extent={{-189,-25},{-146,15}}, rotation=0))); - ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss2(K=1e-3) + ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLoss2( + redeclare package Medium = Medium, + K=1e-3) annotation (Placement(transformation(extent={{-101, -15},{-81,5}}, rotation=0))); diff --git a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/HeatExchanger/TestStaticPlateHeatExchanger.mo b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/HeatExchanger/TestStaticPlateHeatExchanger.mo index e6afa9c7..b57a86bb 100644 --- a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/HeatExchanger/TestStaticPlateHeatExchanger.mo +++ b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/HeatExchanger/TestStaticPlateHeatExchanger.mo @@ -1,42 +1,59 @@ within ThermoSysPro.Fluid.Examples.Book.SimpleExamples.HeatExchanger; model TestStaticPlateHeatExchanger + replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; ThermoSysPro.Fluid.HeatExchangers.StaticPlateHeatExchanger echangeurAPlaques1( + redeclare package Medium_c = Medium, + redeclare package Medium_f = Medium, Sp=2, Sc(Q(fixed=true, start=1036.78)), - region_c=ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region.Region_1, - region_f=ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region.Region_1) + Hmc(start=220524.0), + Hmf(start=127690.0), + Qf(start=1000.0)) annotation (Placement(transformation(extent={{-10,30},{10,50}}, rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP2( + redeclare package Medium = Medium, T0=340) annotation (Placement(transformation(extent={{-70,30},{-50,50}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP3 + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP3( + redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-50,10},{-30,30}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP puitsP2(P0(fixed=false)= + ThermoSysPro.Fluid.BoundaryConditions.SinkP puitsP2( + redeclare package Medium = Medium, + P0(fixed=false)= 100000) annotation (Placement(transformation( extent={{50,30},{70,50}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP puitsP3 + ThermoSysPro.Fluid.BoundaryConditions.SinkP puitsP3( + redeclare package Medium = Medium) annotation (Placement(transformation( extent={{30,10},{50,30}}, rotation=0))); - ThermoSysPro.Fluid.HeatExchangers.StaticPlateHeatExchanger echangeurAPlaques(region_c= - ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region.Region_1, - region_f=ThermoSysPro.Fluid.Interfaces.PropertyInterfaces.IF97Region.Region_1) - annotation (Placement(transformation(extent={{-10,-34},{10,-14}}, + ThermoSysPro.Fluid.HeatExchangers.StaticPlateHeatExchanger echangeurAPlaques( + redeclare package Medium_c = Medium, + redeclare package Medium_f = Medium, + Sp=2, + Hmc(start=220524.0), + Hmf(start=127690.0), + Qc(start=1000.0), + Qf(start=1000.0)) annotation (Placement(transformation(extent={{-10,-34},{10,-14}}, rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP6( + redeclare package Medium = Medium, T0=340) annotation (Placement(transformation(extent={{-70,-34},{-50,-14}}, rotation= 0))); - ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP7 + ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP7( + redeclare package Medium = Medium) annotation (Placement( transformation(extent={{-50,-54},{-30,-34}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP puitsP6 + ThermoSysPro.Fluid.BoundaryConditions.SinkP puitsP6( + redeclare package Medium = Medium) annotation (Placement(transformation( extent={{50,-34},{70,-14}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP puitsP7 + ThermoSysPro.Fluid.BoundaryConditions.SinkP puitsP7( + redeclare package Medium = Medium) annotation (Placement(transformation( extent={{30,-54},{50,-34}}, rotation=0))); equation From bbf765c3f065b2939601ce1509487c3cba3428ce Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Fri, 22 May 2026 10:49:47 +0200 Subject: [PATCH 175/178] #125 HX exemples inside SimpleExamples --- .../HeatExchangers/TestDynamicCondenser.mo | 31 ++++++++++++++++--- ...DynamicFlueGasesMultiFluidHeatExchanger.mo | 5 +-- ...TestDynamicMultiFluidHeatExchangerShell.mo | 5 ++- ...cMultiFluidHeatExchangerShell_FlueGases.mo | 15 ++++++--- ...ynamicMultiFluidHeatExchanger_FlueGases.mo | 15 ++++++--- .../TestDynamicTwoPhaseFlowPipe.mo | 2 +- .../TestDynamicTwoPhaseFlowPipe_Traces.mo | 2 +- .../HeatExchangers/TestDynamicWaterHeater.mo | 18 +++++++---- .../TestDynamicWaterHeaterOnePipe.mo | 17 ++++++---- ...namicWaterSteamMultiFluidsHeatExchanger.mo | 3 +- .../TestSimpleDynamicCondenser_Traces.mo | 4 +-- .../HeatExchangers/TestSteamGenerator_1SG.mo | 30 +++++++++++++++++- .../HeatExchangers/TestSteamGenerator_4SG.mo | 9 ++++-- 13 files changed, 117 insertions(+), 39 deletions(-) diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicCondenser.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicCondenser.mo index 94c9e846..3568f0c4 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicCondenser.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicCondenser.mo @@ -11,20 +11,41 @@ model TestDynamicCondenser Ns=3, ntubest=1000, ntubesV=50, + C1vap(P(start=66004), h_vol_2(start=353999)), + C2vap(P(start=66004), h_vol_2(start=353999)), + C1(P(start=66004)), + C2ex(P(start=47631), h(start=370191)), + DynamicCondenser( + P(start=66004), + Pfond(start=47631), + hv(start=353999), + hl(start=370191), + Tp(start=357.683), + Tp1(start={351.781,354.987,356.535}), + CvBP(P(start=66004), h_vol_2(start=353999)), + CvGCT(P(start=66004), h_vol_2(start=353999)), + Cl(P(start=47631))), + Wall_3(Tp2(start={351.781,354.987,356.535})), + pipe_3( + P(start={107635,105730,103825,101915,100000}), + mu2(start=fill(9.14034e-4, 4)), + rho2(start=fill(997.34, 4))), + sortieReelle(signal(start=-97.6173)), dynamic_energy_balance=false, dynamic_mass_balance=false, inertia=false) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourceQ vaporSource(redeclare package Medium = Medium, Q0=10, h0=2.7e6, option_temperature=false) annotation (Placement(transformation(extent={{-10,50},{10,70}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourceQ extraVaporSource(redeclare package Medium = Medium, Q0=1e-4, h0=2.7e6, option_temperature=false) annotation (Placement(transformation(extent={{-70,50},{-50,70}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourceQ extraWaterSource(redeclare package Medium = Medium, Q0=1e-4, h0=1e5, option_temperature=false) annotation (Placement(transformation(extent={{-70,20},{-50,40}}))); - ThermoSysPro.Fluid.BoundaryConditions.SinkQ condensateSink(redeclare package Medium = Medium, Q0=10.0002, h0=1e5, option_temperature=false) annotation (Placement(transformation(extent={{-10,-70},{10,-50}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ vaporSource(redeclare package Medium = Medium, Q0=10, h0=2.7e6, option_temperature=false, C(P(start=66004), h_vol_2(start=353999))) annotation (Placement(transformation(extent={{-10,50},{10,70}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ extraVaporSource(redeclare package Medium = Medium, Q0=1e-4, h0=2.7e6, option_temperature=false, C(P(start=66004), h_vol_2(start=353999))) annotation (Placement(transformation(extent={{-70,50},{-50,70}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ extraWaterSource(redeclare package Medium = Medium, Q0=1e-4, h0=1e5, option_temperature=false, C(P(start=66004))) annotation (Placement(transformation(extent={{-70,20},{-50,40}}))); + ThermoSysPro.Fluid.BoundaryConditions.SinkQ condensateSink(redeclare package Medium = Medium, Q0=10.0002, h0=1e5, option_temperature=false, C(P(start=47631), h(start=370191))) annotation (Placement(transformation(extent={{-10,-70},{10,-50}}))); ThermoSysPro.Fluid.BoundaryConditions.SourceQ coolingSource(redeclare package Medium = Medium_Cooling, Q0=100, h0=1e5, option_temperature=false) annotation (Placement(transformation(extent={{-70,-20},{-50,0}}))); ThermoSysPro.Fluid.BoundaryConditions.SinkP coolingSink(redeclare package Medium = Medium_Cooling, P0=100000, h0=1e5, option_temperature=false) annotation (Placement(transformation(extent={{50,-20},{70,0}}))); equation connect(vaporSource.C, condenser.C1vap) annotation (Line(points={{10,60},{0,60},{0,10}}, color={0,0,255})); connect(extraVaporSource.C, condenser.C2vap) annotation (Line(points={{-50,60},{-3.9,60},{-3.9,9.2}}, color={0,0,255})); connect(extraWaterSource.C, condenser.C1) annotation (Line(points={{-50,30},{-8.1,30},{-8.1,7.5}}, color={0,0,255})); - connect(condenser.C2ex, condensateSink.C) annotation (Line(points={{0,-10},{0,-50}}, color={0,0,255})); + connect(condenser.C2ex, condensateSink.C) annotation (Line(points={{0,-10},{0,-36},{0,-60},{-10,-60}}, + color={0,0,255})); connect(coolingSource.C, condenser.Ce1) annotation (Line(points={{-50,-10},{-10,-10},{-10,-0.1}}, color={0,0,255})); connect(condenser.Ce2, coolingSink.C) annotation (Line(points={{9.9,-0.1},{30,-0.1},{30,-10},{50,-10}}, color={0,0,255})); annotation (experiment(StopTime=1), Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicFlueGasesMultiFluidHeatExchanger.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicFlueGasesMultiFluidHeatExchanger.mo index fd5ab781..4345686d 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicFlueGasesMultiFluidHeatExchanger.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicFlueGasesMultiFluidHeatExchanger.mo @@ -10,11 +10,12 @@ model TestDynamicFlueGasesMultiFluidHeatExchanger redeclare package Medium_FlueGases = Medium_FlueGases, h0=fill(1.2e6, 1), option_temperature=false, + ExchangerFlueGasesMetal(h(start=fill(3e6, 3)), hb(start=fill(3e6, 2))), dynamic_energy_balance=false, dynamic_mass_balance=false, inertia=false) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceFg(redeclare package Medium = Medium_FlueGases, Q0=10, T0=573.15, option_temperature=true, X0={0.1,0.2,0.3,0.2,0.2}) annotation (Placement(transformation(extent={{-10,50},{10,70}}))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkFg(redeclare package Medium = Medium_FlueGases, P0=100000, T0=573.15, option_temperature=true) annotation (Placement(transformation(extent={{-10,-70},{10,-50}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ sourceFg(redeclare package Medium = Medium_FlueGases, Q0=10, h0=3e6, option_temperature=false, X0={0.1,0.2,0.3,0.2,0.2}, C(h(start=3e6), h_vol_1(start=3e6))) annotation (Placement(transformation(extent={{-10,50},{10,70}}))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkFg(redeclare package Medium = Medium_FlueGases, P0=100000, h0=3e6, option_temperature=false, C(h(start=3e6), h_vol_2(start=3e6))) annotation (Placement(transformation(extent={{-10,-70},{10,-50}}))); ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceWs(redeclare package Medium = Medium, P0=300000, h0=1.2e6, option_temperature=false) annotation (Placement(transformation(extent={{-70,-10},{-50,10}}))); ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkWs(redeclare package Medium = Medium, P0=100000, h0=1.2e6, option_temperature=false) annotation (Placement(transformation(extent={{50,-10},{70,10}}))); equation diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicMultiFluidHeatExchangerShell.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicMultiFluidHeatExchangerShell.mo index ec2729ec..7699ef1f 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicMultiFluidHeatExchangerShell.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicMultiFluidHeatExchangerShell.mo @@ -8,6 +8,8 @@ model TestDynamicMultiFluidHeatExchangerShell ThermoSysPro.Fluid.HeatExchangers.DynamicMultiFluidHeatExchangerShell exchanger( redeclare package Medium_shell = Medium_shell, redeclare package Medium_pipe = Medium_pipe, + Dint=0.016, + Dext=0.019, dynamic_energy_balance=false, dynamic_mass_balance=false, inertia=false) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); @@ -19,6 +21,7 @@ equation connect(sourcePipe.C, exchanger.Cws1) annotation (Line(points={{-50,0},{-10,0}}, color={0,0,255})); connect(exchanger.Cws2, sinkPipe.C) annotation (Line(points={{10,0},{50,0}}, color={0,0,255})); connect(sourceShell.C, exchanger.Cfg1) annotation (Line(points={{10,60},{20,60},{20,5},{0,5}}, color={0,0,255})); - connect(exchanger.Cfg2, sinkShell.C) annotation (Line(points={{0,-5},{0,-50}}, color={0,0,255})); + connect(exchanger.Cfg2, sinkShell.C) annotation (Line(points={{0,-5},{0,-32},{0,-60},{-10,-60}}, + color={0,0,255})); annotation (experiment(StopTime=1), Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestDynamicMultiFluidHeatExchangerShell; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicMultiFluidHeatExchangerShell_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicMultiFluidHeatExchangerShell_FlueGases.mo index ae54a033..7df2c666 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicMultiFluidHeatExchangerShell_FlueGases.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicMultiFluidHeatExchangerShell_FlueGases.mo @@ -3,9 +3,14 @@ model TestDynamicMultiFluidHeatExchangerShell_FlueGases extends TestDynamicMultiFluidHeatExchangerShell( redeclare package Medium_shell = Properties.Media.FlueGases, redeclare package Medium_pipe = Properties.Media.FlueGases, - exchanger(P0=450000, h0=fill(3e6, 1), option_temperature=false), - sourceShell(P0=450000, h0=3e6, option_temperature=false, X0={0.1,0.2,0.3,0.2,0.2}), - sinkShell(P0=100000, h0=3e6, option_temperature=false), - sourcePipe(P0=450000, h0=3e6, option_temperature=false, X0={0.1,0.2,0.3,0.2,0.2}), - sinkPipe(P0=100000, h0=3e6, option_temperature=false)); + exchanger( + P0=450000, + h0=fill(3e6, 1), + option_temperature=false, + dynamicOnePhaseFlowShell(h(start=fill(3e6, 3)), hb(start=fill(3e6, 2))), + DynamicOnePhaseFlowPipe(h(start=fill(3e6, 3)), hb(start=fill(3e6, 2)))), + sourceShell(P0=450000, h0=3e6, option_temperature=false, X0={0.1,0.2,0.3,0.2,0.2}, C(h(start=3e6), h_vol_1(start=3e6))), + sinkShell(P0=100000, h0=3e6, option_temperature=false, C(h(start=3e6), h_vol_2(start=3e6))), + sourcePipe(P0=450000, h0=3e6, option_temperature=false, X0={0.1,0.2,0.3,0.2,0.2}, C(h(start=3e6), h_vol_1(start=3e6))), + sinkPipe(P0=100000, h0=3e6, option_temperature=false, C(h(start=3e6), h_vol_2(start=3e6)))); end TestDynamicMultiFluidHeatExchangerShell_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicMultiFluidHeatExchanger_FlueGases.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicMultiFluidHeatExchanger_FlueGases.mo index 0a8a7d9a..a794ed00 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicMultiFluidHeatExchanger_FlueGases.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicMultiFluidHeatExchanger_FlueGases.mo @@ -3,9 +3,14 @@ model TestDynamicMultiFluidHeatExchanger_FlueGases extends TestDynamicMultiFluidHeatExchanger( redeclare package Medium_1 = Properties.Media.FlueGases, redeclare package Medium_2 = Properties.Media.FlueGases, - exchanger(P0=450000, h0=fill(3e6, 1), option_temperature=false), - source1(P0=450000, h0=3e6, option_temperature=false, X0={0.1,0.2,0.3,0.2,0.2}), - sink1(P0=100000, h0=3e6, option_temperature=false), - source2(P0=450000, h0=3e6, option_temperature=false, X0={0.1,0.2,0.3,0.2,0.2}), - sink2(P0=100000, h0=3e6, option_temperature=false)); + exchanger( + P0=450000, + h0=fill(3e6, 1), + option_temperature=false, + DynamicOnePhaseFlowPipe_1(h(start=fill(3e6, 3)), hb(start=fill(3e6, 2))), + DynamicOnePhaseFlowPipe_2(h(start=fill(3e6, 3)), hb(start=fill(3e6, 2)))), + source1(P0=450000, h0=3e6, option_temperature=false, X0={0.1,0.2,0.3,0.2,0.2}, C(h(start=3e6), h_vol_1(start=3e6))), + sink1(P0=100000, h0=3e6, option_temperature=false, C(h(start=3e6), h_vol_2(start=3e6))), + source2(P0=450000, h0=3e6, option_temperature=false, X0={0.1,0.2,0.3,0.2,0.2}, C(h(start=3e6), h_vol_1(start=3e6))), + sink2(P0=100000, h0=3e6, option_temperature=false, C(h(start=3e6), h_vol_2(start=3e6)))); end TestDynamicMultiFluidHeatExchanger_FlueGases; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicTwoPhaseFlowPipe.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicTwoPhaseFlowPipe.mo index 9a62daa1..e17466f4 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicTwoPhaseFlowPipe.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicTwoPhaseFlowPipe.mo @@ -40,4 +40,4 @@ equation connect(heatSource.C, heatExchangerWall.WT2) annotation (Line(points={{0,31.2},{0,20}}, color={191,95,0})); connect(heatExchangerWall.WT1, dynamicTwoPhaseFlowPipe.CTh) annotation (Line(points={{0,4},{0,-10.3}}, color={191,95,0})); annotation (experiment(StopTime=1500), Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); -end TestDynamicTwoPhaseFlowPipe; \ No newline at end of file +end TestDynamicTwoPhaseFlowPipe; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicTwoPhaseFlowPipe_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicTwoPhaseFlowPipe_Traces.mo index 1fdfc005..f5decb40 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicTwoPhaseFlowPipe_Traces.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicTwoPhaseFlowPipe_Traces.mo @@ -43,4 +43,4 @@ equation connect(heatSource.C, heatExchangerWall.WT2) annotation (Line(points={{0,31.2},{0,20}}, color={191,95,0})); connect(heatExchangerWall.WT1, dynamicTwoPhaseFlowPipe.CTh) annotation (Line(points={{0,4},{0,-10.3}}, color={191,95,0})); annotation (experiment(StopTime=1500), Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); -end TestDynamicTwoPhaseFlowPipe_Traces; \ No newline at end of file +end TestDynamicTwoPhaseFlowPipe_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicWaterHeater.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicWaterHeater.mo index 6569c47c..5aab623f 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicWaterHeater.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicWaterHeater.mo @@ -10,23 +10,29 @@ model TestDynamicWaterHeater redeclare package Medium_Cooling = Medium_Cooling, dynamic_energy_balance=true, dynamic_mass_balance=true, - steady_state=false, P0c=2200000, Vf0=0.43, pipe_1(h0=fill(9e5, 10), P0=6900000), pipe_2(h0=fill(1.0e6, 10), P0=6900000), pipe_3(h0=fill(9e5, 20), P0=6900000), - inertia=false) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + inertia=false, + volumeC(P0=6900000, P(start=6900000)), + volumeD1(P0=6900000, P(start=6900000)), + volumeD(P0=6900000, P(start=6900000))) + annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); ThermoSysPro.Fluid.BoundaryConditions.SourceQ steamSource(redeclare package Medium = Medium, Q0=10, h0=2.7e6, option_temperature=false) annotation (Placement(transformation(extent={{-10,50},{10,70}}))); ThermoSysPro.Fluid.BoundaryConditions.SourceQ extraSource(redeclare package Medium = Medium, Q0=1e-4, h0=1e5, option_temperature=false) annotation (Placement(transformation(extent={{-70,50},{-50,70}}))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP condensateSink(redeclare package Medium = Medium, P0=100000, h0=1e5, option_temperature=false) annotation (Placement(transformation(extent={{-10,-70},{10,-50}}))); + ThermoSysPro.Fluid.BoundaryConditions.SinkQ condensateSink(redeclare package Medium = Medium, + Q0=10 + 1e-4, h0=1e5, option_temperature=false) annotation (Placement(transformation(extent={{-10,-70},{10,-50}}))); ThermoSysPro.Fluid.BoundaryConditions.SourceQ coolingSource(redeclare package Medium = Medium_Cooling, Q0=100, h0=1e5, option_temperature=false) annotation (Placement(transformation(extent={{-70,-50},{-50,-30}}))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP coolingSink(redeclare package Medium = Medium_Cooling, P0=100000, h0=1e5, option_temperature=false) annotation (Placement(transformation(extent={{-70,10},{-50,30}}))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP coolingSink(redeclare package Medium = Medium_Cooling, + P0=6900000, h0=1e5, option_temperature=false) annotation (Placement(transformation(extent={{-70,10},{-50,30}}))); equation connect(steamSource.C, waterHeater.C1vap) annotation (Line(points={{10,60},{0,60},{0,10}}, color={0,0,255})); connect(extraSource.C, waterHeater.C1) annotation (Line(points={{-50,60},{-6.4,60},{-6.4,9.2}}, color={0,0,255})); - connect(waterHeater.C2ex, condensateSink.C) annotation (Line(points={{0,-10},{0,-50}}, color={0,0,255})); + connect(waterHeater.C2ex, condensateSink.C) annotation (Line(points={{0,-10},{0,-36},{0,-60},{-10,-60}}, + color={0,0,255})); connect(coolingSource.C, waterHeater.Ce1) annotation (Line(points={{-50,-40},{-30,-40},{-30,-4.5},{-10,-4.5}}, color={0,0,255})); - connect(waterHeater.Ce2, coolingSink.C) annotation (Line(points={{-10,4.4},{-30,4.4},{-30,20},{-50,20}}, color={0,0,255})); + connect(waterHeater.Ce2, coolingSink.C) annotation (Line(points={{-10,4.4},{-30,4.4},{-30,20},{-70,20}}, color={0,0,255})); annotation (experiment(StopTime=1), Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestDynamicWaterHeater; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicWaterHeaterOnePipe.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicWaterHeaterOnePipe.mo index 88c9f980..1593241d 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicWaterHeaterOnePipe.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicWaterHeaterOnePipe.mo @@ -10,21 +10,26 @@ model TestDynamicWaterHeaterOnePipe redeclare package Medium_Cooling = Medium_Cooling, dynamic_energy_balance=true, dynamic_mass_balance=true, - steady_state=false, P0c=2200000, Vf0=0.43, pipe_3(h0=fill(9e5, 20), P0=6900000), - inertia=false) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + inertia=false, + volumeC(P0=6900000, P(start=6900000)), + volumeD(P0=6900000, P(start=6900000))) + annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); ThermoSysPro.Fluid.BoundaryConditions.SourceQ steamSource(redeclare package Medium = Medium, Q0=10, h0=2.7e6, option_temperature=false) annotation (Placement(transformation(extent={{-10,50},{10,70}}))); ThermoSysPro.Fluid.BoundaryConditions.SourceQ extraSource(redeclare package Medium = Medium, Q0=1e-4, h0=1e5, option_temperature=false) annotation (Placement(transformation(extent={{-70,50},{-50,70}}))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP condensateSink(redeclare package Medium = Medium, P0=100000, h0=1e5, option_temperature=false) annotation (Placement(transformation(extent={{-10,-70},{10,-50}}))); + ThermoSysPro.Fluid.BoundaryConditions.SinkQ condensateSink(redeclare package Medium = Medium, + Q0=10 + 1e-4, h0=1e5, option_temperature=false) annotation (Placement(transformation(extent={{-10,-70},{10,-50}}))); ThermoSysPro.Fluid.BoundaryConditions.SourceQ coolingSource(redeclare package Medium = Medium_Cooling, Q0=100, h0=1e5, option_temperature=false) annotation (Placement(transformation(extent={{-70,-50},{-50,-30}}))); - ThermoSysPro.Fluid.BoundaryConditions.SinkP coolingSink(redeclare package Medium = Medium_Cooling, P0=100000, h0=1e5, option_temperature=false) annotation (Placement(transformation(extent={{-70,10},{-50,30}}))); + ThermoSysPro.Fluid.BoundaryConditions.SinkP coolingSink(redeclare package Medium = Medium_Cooling, + P0=6900000, h0=1e5, option_temperature=false) annotation (Placement(transformation(extent={{-70,10},{-50,30}}))); equation connect(steamSource.C, waterHeater.C1vap) annotation (Line(points={{10,60},{0,60},{0,10}}, color={0,0,255})); connect(extraSource.C, waterHeater.C1) annotation (Line(points={{-50,60},{-6.4,60},{-6.4,9.2}}, color={0,0,255})); - connect(waterHeater.C2ex, condensateSink.C) annotation (Line(points={{0,-10},{0,-50}}, color={0,0,255})); + connect(waterHeater.C2ex, condensateSink.C) annotation (Line(points={{0,-10},{0,-36},{0,-60},{-10,-60}}, + color={0,0,255})); connect(coolingSource.C, waterHeater.Ce1) annotation (Line(points={{-50,-40},{-30,-40},{-30,-4.5},{-10,-4.5}}, color={0,0,255})); - connect(waterHeater.Ce2, coolingSink.C) annotation (Line(points={{-10,4.4},{-30,4.4},{-30,20},{-50,20}}, color={0,0,255})); + connect(waterHeater.Ce2, coolingSink.C) annotation (Line(points={{-10,4.4},{-30,4.4},{-30,20},{-70,20}}, color={0,0,255})); annotation (experiment(StopTime=1), Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestDynamicWaterHeaterOnePipe; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicWaterSteamMultiFluidsHeatExchanger.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicWaterSteamMultiFluidsHeatExchanger.mo index 42c72368..163d83df 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicWaterSteamMultiFluidsHeatExchanger.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicWaterSteamMultiFluidsHeatExchanger.mo @@ -17,7 +17,8 @@ model TestDynamicWaterSteamMultiFluidsHeatExchanger ThermoSysPro.Fluid.BoundaryConditions.SinkP sink2(redeclare package Medium = Medium_2, P0=100000, h0=1.2e6, option_temperature=false) annotation (Placement(transformation(extent={{50,-10},{70,10}}))); equation connect(source1.C, exchanger.Cfg1) annotation (Line(points={{10,60},{20,60},{20,5},{0,5}}, color={0,0,255})); - connect(exchanger.Cfg2, sink1.C) annotation (Line(points={{0,-5},{0,-50}}, color={0,0,255})); + connect(exchanger.Cfg2, sink1.C) annotation (Line(points={{0,-5},{0,-32},{0,-60},{-10,-60}}, + color={0,0,255})); connect(source2.C, exchanger.Cws1) annotation (Line(points={{-50,0},{-10,0}}, color={0,0,255})); connect(exchanger.Cws2, sink2.C) annotation (Line(points={{10,0},{50,0}}, color={0,0,255})); annotation (experiment(StopTime=1), Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestSimpleDynamicCondenser_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestSimpleDynamicCondenser_Traces.mo index b974b142..97ebc8ef 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestSimpleDynamicCondenser_Traces.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestSimpleDynamicCondenser_Traces.mo @@ -2,7 +2,7 @@ within ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers; model TestSimpleDynamicCondenser_Traces extends ThermoSysPro.Fluid.Examples.SimpleExamples.HeatExchangers.TestSimpleDynamicCondenser( redeclare package Medium = ThermoSysPro.Fluid.Examples.SimpleExamples.Media.WaterSteam_FullyVolatileTrace, - Condenseur(redeclare function PhasesSeparationFunction = Medium.PhasesSeparation (x=Condenseur.xv)) - + Condenseur(redeclare function PhasesSeparationFunction = Medium.PhasesSeparation (x=Condenseur.xv) +) ) annotation (experiment(StopTime=1000), Icon(coordinateSystem(preserveAspectRatio=false))); end TestSimpleDynamicCondenser_Traces; diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestSteamGenerator_1SG.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestSteamGenerator_1SG.mo index 569af238..850ef506 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestSteamGenerator_1SG.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestSteamGenerator_1SG.mo @@ -8,6 +8,33 @@ model TestSteamGenerator_1SG ThermoSysPro.Fluid.HeatExchangers.SteamGenerator_1SG steamGenerator( redeclare package Medium = Medium, redeclare package Medium_Primary = Medium_Primary, + DomeGV( + Cm(h_vol_1(start=1467382.1491761294), + Q(start=3682.6323348377664)), + hl(start=1239103.1618852438), + Tp(start=1085.1630860204652, displayUnit="degC"), + Pfond(start=6537896.329041586, displayUnit="bar")), + DownComerGV(C2(P(start=6652618.15111204, displayUnit="bar"))), + fluidInlet(h_vol_2(start=1203352.0170161917)), + fluidInlet1(P(start=15603447.190394623, displayUnit="bar")), + fluidOutletI(h_vol_1(start=2.82156e6)), + fluidOutletI1(h(start=1266398.0525517925)), + MixAlimDomeGV(P(start=6597719.510802327, displayUnit="bar"), + Cs(h_vol_2(start=1203352.0170161917))), + outputReal(signal(start=-6.329123415280561)), + RiserGV( + h(start={1.20335e6,1.28046e6,1.34313e6,1.39379e6,1.43460e6,1.46738e6,1.46738e6}), + P(start={6.65262e6,6.63846e6,6.62828e6,6.62094e6,6.61445e6,6.60826e6,6.53790e6}), + Tp1(start={556.156,555.899,555.700,555.537,555.398}), + Tp2(start={557.644,557.097,556.655,556.295,555.999}), + state1(h(start={1280461.0750118925,1343134.833335842,1393794.5882590986,1434595.9090880589,1467382.1491761294}), p(start={6638456.595608159,6628277.414901627,6620936.90876653,6614447.789782153,6608263.233348276}, each displayUnit="bar"))), + UtubeColdtLeg( + P(start={1.54474e7,1.54475e7,1.54477e7,1.54482e7,1.54487e7,1.54493e7,1.54500e7}), + Tp(start={565.892673062783,563.7423137333859,562.0024887705413,560.5974122265403,559.4633025748175}, each displayUnit="degC")), + UtubeHotLeg( + P(start={1.56034e7,1.55774e7,1.55514e7,1.55254e7,1.54994e7,1.54734e7,1.54474e7}), + Tp(start={586.895939774836,580.9426855874689,575.9677586513063,571.864684816329,568.5110695637635}, each displayUnit="degC")), + DPnulle_AlimDwnc(rho(start=830.6664450130019, displayUnit="g/cm3")), dynamic_energy_balance=false, dynamic_mass_balance=false, inertia=false) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); @@ -17,7 +44,8 @@ model TestSteamGenerator_1SG ThermoSysPro.Fluid.BoundaryConditions.SinkP primaryOutlet(redeclare package Medium = Medium_Primary, P0=15450000, h0=1.27187e6, option_temperature=false) annotation (Placement(transformation(extent={{50,-70},{70,-50}}))); equation connect(feedwater.C, steamGenerator.fluidInlet) annotation (Line(points={{70,40},{52,40},{52,7.46667},{3.46667,7.46667}}, color={0,0,255})); - connect(steamGenerator.fluidOutletI, steamSink.C) annotation (Line(points={{0,9.93333},{0,50}}, color={0,0,255})); + connect(steamGenerator.fluidOutletI, steamSink.C) annotation (Line(points={{0,9.93333},{0,34},{0,60},{-10,60}}, + color={0,0,255})); connect(primaryInlet.C, steamGenerator.fluidInlet1) annotation (Line(points={{-50,-60},{-3.06667,-60},{-3.06667,-8.13333}}, color={0,0,255})); connect(steamGenerator.fluidOutletI1, primaryOutlet.C) annotation (Line(points={{3.06667,-8.13333},{3.06667,-60},{50,-60}}, color={0,0,255})); annotation (experiment(StopTime=1), Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestSteamGenerator_4SG.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestSteamGenerator_4SG.mo index 1d436e20..823a3933 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestSteamGenerator_4SG.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestSteamGenerator_4SG.mo @@ -11,13 +11,16 @@ model TestSteamGenerator_4SG dynamic_energy_balance=false, dynamic_mass_balance=false, inertia=false) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourceQ feedwater(redeclare package Medium = Medium, Q0=531.242, h0=991272, option_temperature=false) annotation (Placement(transformation(extent={{50,30},{70,50}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ feedwater(redeclare package Medium = Medium, + Q0=4*531.242, h0=991272, option_temperature=false) annotation (Placement(transformation(extent={{50,30},{70,50}}))); ThermoSysPro.Fluid.BoundaryConditions.SinkP steamSink(redeclare package Medium = Medium, P0=6600000, h0=2.77257e6, option_temperature=false) annotation (Placement(transformation(extent={{-10,50},{10,70}}))); - ThermoSysPro.Fluid.BoundaryConditions.SourceQ primaryInlet(redeclare package Medium = Medium_Primary, Q0=4756, h0=1.47084e6, option_temperature=false) annotation (Placement(transformation(extent={{-70,-70},{-50,-50}}))); + ThermoSysPro.Fluid.BoundaryConditions.SourceQ primaryInlet(redeclare package Medium = Medium_Primary, + Q0=4*4756, h0=1.47084e6, option_temperature=false) annotation (Placement(transformation(extent={{-70,-70},{-50,-50}}))); ThermoSysPro.Fluid.BoundaryConditions.SinkP primaryOutlet(redeclare package Medium = Medium_Primary, P0=15450000, h0=1.27187e6, option_temperature=false) annotation (Placement(transformation(extent={{50,-70},{70,-50}}))); equation connect(feedwater.C, steamGenerator.fluidInlet) annotation (Line(points={{70,40},{52,40},{52,7.46667},{3.46667,7.46667}}, color={0,0,255})); - connect(steamGenerator.fluidOutletI, steamSink.C) annotation (Line(points={{0,9.93333},{0,50}}, color={0,0,255})); + connect(steamGenerator.fluidOutletI, steamSink.C) annotation (Line(points={{0,9.93333},{0,34},{0,60},{-10,60}}, + color={0,0,255})); connect(primaryInlet.C, steamGenerator.fluidInlet1) annotation (Line(points={{-50,-60},{-3.06667,-60},{-3.06667,-8.13333}}, color={0,0,255})); connect(steamGenerator.fluidOutletI1, primaryOutlet.C) annotation (Line(points={{3.06667,-8.13333},{3.06667,-60},{50,-60}}, color={0,0,255})); annotation (experiment(StopTime=1), Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); From 631e4afda73fa6c3b658c7ecf9617197d516f5ca Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Mon, 8 Jun 2026 17:48:15 +0200 Subject: [PATCH 176/178] #125 issue with the rebase --- ThermoSysPro/Fluid/PressureLosses/LumpedStraightPipe.mo | 2 -- 1 file changed, 2 deletions(-) diff --git a/ThermoSysPro/Fluid/PressureLosses/LumpedStraightPipe.mo b/ThermoSysPro/Fluid/PressureLosses/LumpedStraightPipe.mo index 3bb6f579..54439c4d 100644 --- a/ThermoSysPro/Fluid/PressureLosses/LumpedStraightPipe.mo +++ b/ThermoSysPro/Fluid/PressureLosses/LumpedStraightPipe.mo @@ -112,8 +112,6 @@ equation Pm = (C1.P + C2.P)/2; state = Medium.setState_phX(p=Pm, h=h, X=X); - state=Medium.setState_phX(p=Pm, h=h, X=X); - if (p_rho > 0) then rho = p_rho; else From 0455263df6330588feb2283022fab57365e14992 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Tue, 9 Jun 2026 09:47:30 +0200 Subject: [PATCH 177/178] #125 changed some init for examples --- .../TestDynamicTwoPhaseFlowPipe.mo | 11 ++++---- .../SimpleExamples/Volume/TestStaticDrum3.mo | 13 +++++++--- .../TestGenericCombustion1DWithPipe.mo | 26 +++++++------------ .../TestDynamicTwoPhaseFlowPipe.mo | 6 ++--- .../TestDynamicTwoPhaseFlowPipe_Traces.mo | 2 +- .../TestTwoPhaseCavityOnePipe_Traces.mo | 4 +-- 6 files changed, 30 insertions(+), 32 deletions(-) diff --git a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/HeatExchanger/TestDynamicTwoPhaseFlowPipe.mo b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/HeatExchanger/TestDynamicTwoPhaseFlowPipe.mo index 962b6345..3fe20f25 100644 --- a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/HeatExchanger/TestDynamicTwoPhaseFlowPipe.mo +++ b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/HeatExchanger/TestDynamicTwoPhaseFlowPipe.mo @@ -7,16 +7,15 @@ model TestDynamicTwoPhaseFlowPipe inertia=false, L=10, D=0.03, - dpfCorr=1, - P(start={2000000.0,1999571.707027408,1999140.94021676,1998707.6248918818, - 1998271.6837222823,1997833.0364982954,1997391.599890757, - 1996715.8221090273,1995640.018272837,1994163.014585635, - 1992283.4952231126,1990000.0})) + dpfCorr( + fixed=false, + start=0.2396333653343408) = 1, + P(start={2000000,1999571.7070274,1999140.9402168,1998707.6248919,1998271.6837223,1997833.0364983,1997391.5998908,1996715.822109,1995640.0182728,1994163.0145856,1992283.4952231,1990000})) annotation (Placement(transformation(extent={{-40,-48}, {40,10}}, rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP1( redeclare package Medium = Medium, - C(Q(fixed=false, start=1)), + C(Q(fixed=true, start=1)), option_temperature=false, h0=800e3, P0=2000000) diff --git a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/Volume/TestStaticDrum3.mo b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/Volume/TestStaticDrum3.mo index 6eb37c0f..3cb722f2 100644 --- a/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/Volume/TestStaticDrum3.mo +++ b/ThermoSysPro/Fluid/Examples/Book/SimpleExamples/Volume/TestStaticDrum3.mo @@ -8,12 +8,14 @@ model TestStaticDrum3 ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLossVALI1( redeclare package Medium = Medium, - K=1e-4) + K=1e-4, + rho(start=688.4113, displayUnit="g/cm3")) annotation (Placement(transformation(extent={{38,7},{58,27}}, rotation=0))); ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLossVALI2( redeclare package Medium = Medium, - K=1e-4) + K=1e-4, + rho(start=691.7364, displayUnit="g/cm3")) annotation (Placement(transformation(extent={{-58,-8},{-38,12}}, rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkQ( redeclare package Medium = Medium, @@ -33,7 +35,8 @@ model TestStaticDrum3 ThermoSysPro.Fluid.PressureLosses.SingularPressureLoss singularPressureLossVALI3( redeclare package Medium = Medium, - K=1e-4) + K=1e-4, + rho(start=55.45212, displayUnit="g/cm3")) annotation (Placement(transformation(extent={{38,52},{58,72}}, rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.Sink sink( redeclare package Medium = Medium) @@ -46,7 +49,9 @@ model TestStaticDrum3 D=0.05, ntubes=10, L=10, - z2=10) annotation (Placement(transformation( + z2=10, + P(start={10053832.0,10046967.0,10041924.0,10037550.0,10033392.0,10029237.0,10024966.0,10020505.0,10015807.0,10010839.0,10005576.0,10000000.0}, each displayUnit="bar")) + annotation (Placement(transformation( origin={-28.5,-45.5}, extent={{13.5,11.5},{-13.5,-11.5}}, rotation=270))); diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Combustion/TestGenericCombustion1DWithPipe.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Combustion/TestGenericCombustion1DWithPipe.mo index f9d75047..80cede49 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Combustion/TestGenericCombustion1DWithPipe.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Combustion/TestGenericCombustion1DWithPipe.mo @@ -4,13 +4,13 @@ model TestGenericCombustion1DWithPipe replaceable package Medium = ThermoSysPro.Properties.Media.WaterSteam; replaceable package Medium_FlueGases = ThermoSysPro.Properties.Media.FlueGases; - ThermoSysPro.Fluid.Combustion.CombustionChambers.GenericCombustion1D combustionChamber( + ThermoSysPro.Fluid.Combustion.CombustionChambers.GenericCombustion1D genericCombustionCCS( redeclare package Medium = Medium, redeclare package Medium_FlueGases = Medium_FlueGases, NCEL=7, Qm(fixed=false), Qsf(fixed=false), - kcham(fixed=true)=0.1, + kcham(fixed=true) = 0.1, Acham=275, Xbf=0, ImbCV=0.05, @@ -18,8 +18,7 @@ model TestGenericCombustion1DWithPipe Kec=8.8, SM={639.92,198.58,466.48,466.48,466.48,358.56,358.56}, ImbBF=0.0, - Psf(start=113275)) - annotation (Placement(transformation(extent={{-62,-56},{62,72}}, rotation=0))); + Psf(start=113275)) annotation (Placement(transformation(extent={{-62,-56},{62,72}}, rotation=0))); ThermoSysPro.Fluid.Combustion.BoundaryConditions.FuelSourcePQ sourceFuel( Xn=0.0208, Xashes=0.136, @@ -90,21 +89,16 @@ model TestGenericCombustion1DWithPipe ThermoSysPro.Fluid.BoundaryConditions.SinkP sinkPipe( redeclare package Medium = Medium, option_temperature=false, - Q(start=486.69), + Q(start=486.69, fixed=true), h0=2.5e6, - P0=19621600) + P0(fixed=false) = 19621600) annotation (Placement(transformation(origin={90,90.5}, extent={{14.5,-15},{-14.5,15}}, rotation=270))); equation - connect(sourceFuel.C, combustionChamber.Cfuel) - annotation (Line(points={{-72,-24},{-55.8,-24}}, color={0,0,0})); - connect(combustionChamber.Cfg, sinkFlueGases.C) - annotation (Line(points={{0,65.6},{0,91}}, color={0,0,0})); - connect(sourceAir.C, combustionChamber.Ca) - annotation (Line(points={{0,-78},{0,-49.6}}, color={0,0,0})); - connect(sourceWaterSteam.C, combustionChamber.Cws) - annotation (Line(points={{-71,40},{-55.8,40}}, color={0,0,255})); - connect(combustionChamber.Cth, wall.WT2) - annotation (Line(points={{55.8,8},{68,8},{68,7.5},{76,7.5}}, color={191,95,0})); + connect(sourceFuel.C, genericCombustionCCS.Cfuel) annotation (Line(points={{-72,-24},{-55.8,-24}}, color={0,0,0})); + connect(genericCombustionCCS.Cfg, sinkFlueGases.C) annotation (Line(points={{0,65.6},{0,91}}, color={0,0,0})); + connect(sourceAir.C, genericCombustionCCS.Ca) annotation (Line(points={{0,-78},{0,-49.6}}, color={0,0,0})); + connect(sourceWaterSteam.C, genericCombustionCCS.Cws) annotation (Line(points={{-71,40},{-55.8,40}}, color={0,0,255})); + connect(genericCombustionCCS.Cth, wall.WT2) annotation (Line(points={{55.8,8},{68,8},{68,7.5},{76,7.5}}, color={191,95,0})); connect(wall.WT1, pipeWaterSteam.CTh) annotation (Line(points={{70,7.5},{71,7.5},{71,8},{86.2,8}}, color={191,95,0})); connect(sourcePipe.C, pipeWaterSteam.C1) diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicTwoPhaseFlowPipe.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicTwoPhaseFlowPipe.mo index e17466f4..986a0e6b 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicTwoPhaseFlowPipe.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicTwoPhaseFlowPipe.mo @@ -13,7 +13,7 @@ model TestDynamicTwoPhaseFlowPipe annotation (Placement(transformation(extent={{-40,-48},{40,10}}, rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP( redeclare package Medium = Medium, - C(Q(start=1)), + C(Q(start=1, fixed=true)), option_temperature=false, h0=800e3, P0=2000000) annotation (Placement(transformation(extent={{-90,-28},{-70,-8}}, rotation=0))); @@ -21,7 +21,7 @@ model TestDynamicTwoPhaseFlowPipe redeclare package Medium = Medium, option_temperature=false, h0=2000e3, - P0=19.9e5) annotation (Placement(transformation(extent={{70,-28},{90,-8}}, rotation=0))); + P0=19.9e5) annotation (Placement(transformation(extent={{68,-28},{88,-8}}, rotation=0))); ThermoSysPro.Thermal.BoundaryConditions.HeatSource heatSource( option_temperature=2, T0={1000,1100,1200,1300,1400,1500,1600,1700,1800,1900}, @@ -36,7 +36,7 @@ model TestDynamicTwoPhaseFlowPipe D=0.03) annotation (Placement(transformation(extent={{-40,-28},{40,52}}, rotation=0))); equation connect(sourceP.C, dynamicTwoPhaseFlowPipe.C1) annotation (Line(points={{-70,-18},{-42,-18},{-42,-19},{-40,-19}}, color={0,0,255})); - connect(dynamicTwoPhaseFlowPipe.C2, sinkP.C) annotation (Line(points={{40,-19},{70,-18}}, color={0,0,255})); + connect(dynamicTwoPhaseFlowPipe.C2, sinkP.C) annotation (Line(points={{40,-19},{68,-18}}, color={0,0,255})); connect(heatSource.C, heatExchangerWall.WT2) annotation (Line(points={{0,31.2},{0,20}}, color={191,95,0})); connect(heatExchangerWall.WT1, dynamicTwoPhaseFlowPipe.CTh) annotation (Line(points={{0,4},{0,-10.3}}, color={191,95,0})); annotation (experiment(StopTime=1500), Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicTwoPhaseFlowPipe_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicTwoPhaseFlowPipe_Traces.mo index f5decb40..178c5f8c 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicTwoPhaseFlowPipe_Traces.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/HeatExchangers/TestDynamicTwoPhaseFlowPipe_Traces.mo @@ -15,7 +15,7 @@ model TestDynamicTwoPhaseFlowPipe_Traces annotation (Placement(transformation(extent={{-40,-48},{40,10}}, rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.SourceP sourceP( redeclare package Medium = Medium, - C(Q(start=1), SubC(start={0.1})), + C(Q(start=1, fixed=true), SubC(start={0.1})), option_temperature=false, h0=800e3, P0=2000000, diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestTwoPhaseCavityOnePipe_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestTwoPhaseCavityOnePipe_Traces.mo index a08ab52e..7a5465cd 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestTwoPhaseCavityOnePipe_Traces.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Volumes/TestTwoPhaseCavityOnePipe_Traces.mo @@ -38,8 +38,8 @@ model TestTwoPhaseCavityOnePipe_Traces h0=2.8e6, SubC0={10}) annotation (Placement(transformation(extent={{-110,50},{-90,70}}, rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.SinkQ sinkWater( - redeclare package Medium = Medium, - Q0=0) annotation (Placement(transformation(extent={{-90,-60},{-70,-40}}, rotation=0))); + redeclare package Medium = Medium, Q0=3) + annotation (Placement(transformation(extent={{-90,-60},{-70,-40}}, rotation=0))); ThermoSysPro.Thermal.BoundaryConditions.HeatSource heatSource( T0={293.15, 293.15}, From 791b649fef700cd11b1243693025081b6713af30 Mon Sep 17 00:00:00 2001 From: Baptiste MAZURIE Date: Fri, 24 Jul 2026 15:17:59 +0200 Subject: [PATCH 178/178] #125 added subC0 to PlugA for example --- ThermoSysPro/Fluid/BoundaryConditions/PlugA.mo | 5 +++++ .../SimpleExamples/Junctions/TestStaticDrum_Plug_Traces.mo | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ThermoSysPro/Fluid/BoundaryConditions/PlugA.mo b/ThermoSysPro/Fluid/BoundaryConditions/PlugA.mo index 426c50b4..0b3995f0 100644 --- a/ThermoSysPro/Fluid/BoundaryConditions/PlugA.mo +++ b/ThermoSysPro/Fluid/BoundaryConditions/PlugA.mo @@ -6,6 +6,9 @@ model PlugA "Plug" "true: continuous flow reversal - false: discontinuous flow reversal"; parameter Boolean diffusion=false "true: energy balance equation with diffusion - false: energy balance equation without diffusion"; + parameter Medium.ExtraProperty SubC0[Medium.nC](quantity=Medium.extraPropertiesNames) = fill(0,Medium.nC) "Source trace substances" annotation (Evaluate=true, Dialog( + tab="Fluid", + group="Medium")); public Units.SI.MassFlowRate Q "Fluid mass flow rate"; @@ -24,6 +27,8 @@ equation C.diff_res_1 = 0; C.diff_on_1 = diffusion; + C.SubC = SubC0; + /* Flow reversal */ if continuous_flow_reversal then C.h = ThermoSysPro.Functions.SmoothCond(C.Q*C.diff_res_2, C.h_vol_1, C.h_vol_2, 1); diff --git a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestStaticDrum_Plug_Traces.mo b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestStaticDrum_Plug_Traces.mo index b8cd3e1d..3d031a88 100644 --- a/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestStaticDrum_Plug_Traces.mo +++ b/ThermoSysPro/Fluid/Examples/SimpleExamples/Junctions/TestStaticDrum_Plug_Traces.mo @@ -17,7 +17,10 @@ model TestStaticDrum_Plug_Traces ThermoSysPro.Fluid.BoundaryConditions.Sink sinkP2(redeclare package Medium = Medium) annotation (Placement(transformation(extent={{60,50},{80,70}}, rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.RefP refP(redeclare package Medium = Medium, P0=3e5) annotation (Placement(transformation(extent={{-26,-90},{-6,-70}}, rotation=0))); ThermoSysPro.Fluid.BoundaryConditions.RefQ refQ(redeclare package Medium = Medium, Q0=100) annotation (Placement(transformation(extent={{-56,-90},{-36,-70}}, rotation=0))); - ThermoSysPro.Fluid.BoundaryConditions.PlugA sourcePlug(redeclare package Medium = Medium, C(h(fixed=false), SubC={10})) annotation (Placement(transformation(extent={{-90,-90},{-70,-70}}, rotation=0))); + ThermoSysPro.Fluid.BoundaryConditions.PlugA sourcePlug( + redeclare package Medium = Medium, + SubC0={10}, + C(h(fixed=false))) annotation (Placement(transformation(extent={{-90,-90},{-70,-70}}, rotation=0))); equation connect(singularPressureLossVALI2.C2, StaticDrumTh1.Ce_eco) annotation (Line(points={{-60,-40},{-60,0.6},{-48,0.6}}, color={0,0,255})); connect(singularPressureLossVALI1.C2, sinkP1.C) annotation (Line(points={{20,0},{40,0}}, color={0,0,255}));