├── BaseClasses ├── PartialGas.mo ├── PartialGasFunction.mo ├── PartialGasFunctionPrototypes.mo ├── PartialGasFunctions.mo ├── PartialGasObjectFunction.mo ├── PartialGasObjectFunctionPrototypes.mo ├── PartialGasObjectFunctions.mo ├── PartialGas_pT.mo ├── PartialGas_ph.mo ├── PartialGas_ps.mo ├── PartialLiquid.mo ├── PartialLiquidFunction.mo ├── PartialLiquidFunctionPrototypes.mo ├── PartialLiquidFunctions.mo ├── PartialLiquidObjectFunction.mo ├── PartialLiquidObjectFunctionPrototypes.mo ├── PartialLiquidObjectFunctions.mo ├── PartialLiquid_pT.mo ├── PartialLiquid_ph.mo ├── PartialSLEMediumFunction.mo ├── PartialSolidFunction.mo ├── PartialVLEFluid.mo ├── PartialVLEFluidFunction.mo ├── PartialVLEFluidFunctionPrototypes.mo ├── PartialVLEFluidFunctions.mo ├── PartialVLEFluidObjectFunction.mo ├── PartialVLEFluidObjectFunctionPrototypes.mo ├── PartialVLEFluidObjectFunctions.mo ├── PartialVLEFluid_dT.mo ├── PartialVLEFluid_pT.mo ├── PartialVLEFluid_ph.mo ├── PartialVLEFluid_ps.mo ├── package.mo └── package.order ├── Gas.mo ├── GasFunctions.mo ├── GasObjectFunctions.mo ├── GasTypes ├── BaseGas.mo ├── FlueGasTILMedia.mo ├── MoistAirMixture.mo ├── package.mo └── package.order ├── Gas_pT.mo ├── Gas_ph.mo ├── Gas_ps.mo ├── Internals ├── AdditionalVLERecord.mo ├── BasePointer.mo ├── ClassTypes.mo ├── CriticalDataRecord.mo ├── GasConfigurations │ ├── PureComponentGas.mo │ ├── package.mo │ └── package.order ├── GasFunctions.mo ├── GasName.mo ├── GasObjectFunctions.mo ├── LiquidConfigurations │ ├── PureComponentLiquid.mo │ ├── package.mo │ └── package.order ├── LiquidFunctions.mo ├── LiquidName.mo ├── LiquidObjectFunctions.mo ├── MoistAirName.mo ├── PropertyRecord.mo ├── PropertyRecordND.mo ├── SLEMedium │ ├── InterfaceSLEMedium.mo │ ├── package.mo │ └── package.order ├── SLEMediumFunctions │ ├── density_h.mo │ ├── package.mo │ ├── package.order │ ├── quality_h.mo │ ├── specificEnthalpy_T.mo │ └── temperature_h.mo ├── SLEMediumName.mo ├── SLESaturationPropertyRecord.mo ├── SolidPropertyRecord.mo ├── TILMediaExternalObject.mo ├── TableObject.mo ├── TransportPropertyRecord.mo ├── Units.mo ├── VLEFluidConfigurations │ ├── FullyMixtureCompatible │ │ ├── VLEFluid.mo │ │ ├── VLEFluidFunctions.mo │ │ ├── VLEFluidObjectFunctions.mo │ │ ├── VLEFluid_dT.mo │ │ ├── VLEFluid_pT.mo │ │ ├── VLEFluid_ph.mo │ │ ├── VLEFluid_ps.mo │ │ ├── package.mo │ │ └── package.order │ ├── PureComponentVLEFluid.mo │ ├── package.mo │ └── package.order ├── VLEFluidFunctions.mo ├── VLEFluidName.mo ├── VLEFluidObjectFunctions.mo ├── VLERecord.mo ├── VLERecordSimple.mo ├── VLETransportPropertyRecord.mo ├── calcComputeFlags.mo ├── concatNames.mo ├── getDoubleVector.mo ├── getProperties.mo ├── getPropertiesVLE.mo ├── massFraction_mixingRatio.mo ├── package.mo ├── package.order ├── redirectModelicaFormatMessage.mo └── setDoubleVector.mo ├── Liquid.mo ├── LiquidFunctions.mo ├── LiquidObjectFunctions.mo ├── LiquidTypes ├── BaseLiquid.mo ├── TILMedia_Water.mo ├── package.mo └── package.order ├── Liquid_pT.mo ├── Liquid_ph.mo ├── Resources ├── Images │ ├── Base_Gas_Parameter_frame.PNG │ ├── Base_Liquid_Parameter_frame.PNG │ ├── Base_VLE_Parameter_frame.PNG │ ├── Icon_Gas.png │ ├── Icon_Gas_Function.png │ ├── Icon_Gas_pT.png │ ├── Icon_Gas_ph.png │ ├── Icon_Gas_ps.png │ ├── Icon_Liquid.png │ ├── Icon_Liquid_Function.png │ ├── Icon_Liquid_pT.png │ ├── Icon_Liquid_ph.png │ ├── Icon_Package_Empty.png │ ├── Icon_Package_Examples.png │ ├── Icon_Package_Gas.png │ ├── Icon_Package_HeatExchangers.png │ ├── Icon_Package_Internals.png │ ├── Icon_Package_Liquid.png │ ├── Icon_Package_OtherComponents.png │ ├── Icon_Package_VLEFluid.png │ ├── Icon_Record.png │ ├── Icon_SLE_Function.png │ ├── Icon_SLE_h.png │ ├── Icon_Solid_Function.png │ ├── Icon_Solid_T.png │ ├── Icon_UserGuide.png │ ├── Icon_VLEFluid.png │ ├── Icon_VLEFluid_Function.png │ ├── Icon_VLEFluid_dT.png │ ├── Icon_VLEFluid_pT.png │ ├── Icon_VLEFluid_ph.png │ ├── Icon_VLEFluid_ps.png │ ├── ModelIcon_Example.png │ ├── TILMedia.png │ └── infoTILMedia.png ├── Library │ ├── linux32 │ │ └── libTILMedia180ClaRa.so │ ├── linux64 │ │ └── libTILMedia180ClaRa.so │ ├── win32 │ │ ├── TILMedia180ClaRa.dll │ │ ├── TILMedia180ClaRa.lib │ │ └── libTILMedia180ClaRa.a │ └── win64 │ │ ├── TILMedia180ClaRa.dll │ │ ├── TILMedia180ClaRa.lib │ │ └── libTILMedia180ClaRa.a ├── Release Notes TILMedia.pdf └── TILMediaDataPath │ ├── WATER.DAT │ └── WATER_SPLINE.DAT ├── SLEMedium.mo ├── SLEMediumTypes ├── BaseSLEMedium.mo ├── TILMedia_AdBlue.mo ├── TILMedia_AluminumSLE.mo ├── TILMedia_CopperSLE.mo ├── TILMedia_SimpleAdBlue.mo ├── TILMedia_SimpleWater.mo ├── TILMedia_SodiumAcetate.mo ├── package.mo └── package.order ├── Scripts ├── libraryicon.png └── libraryinfo.mos ├── Solid.mo ├── SolidTypes ├── BaseSolid.mo ├── TILMedia_Aluminum.mo ├── TILMedia_Copper.mo ├── TILMedia_St35_8.mo ├── TILMedia_StainlessSteel.mo ├── TILMedia_Steel.mo ├── package.mo └── package.order ├── Testers ├── TestGas.mo ├── TestGas_mixture.mo ├── TestGas_moistAir.mo ├── TestLiquid.mo ├── TestSLEMedium.mo ├── TestSolid.mo ├── TestVLEFluid.mo ├── TestVLEFluidObjectFunctions.mo ├── package.mo └── package.order ├── UsersGuide ├── PropertyCalculation.mo ├── ReleaseNotes.mo ├── SubstanceNames.mo ├── SubstanceRecord.mo ├── package.mo └── package.order ├── VLEFluid.mo ├── VLEFluidFunctions.mo ├── VLEFluidObjectFunctions.mo ├── VLEFluidTypes ├── BaseVLEFluid.mo ├── TILMedia_GERGCO2.mo ├── TILMedia_InterpolatedWater.mo ├── TILMedia_PR_CCS_Mixture_with_Water.mo ├── TILMedia_SplineWater.mo ├── TILMedia_Water.mo ├── package.mo └── package.order ├── VLEFluid_dT.mo ├── VLEFluid_pT.mo ├── VLEFluid_ph.mo ├── VLEFluid_ps.mo ├── package.mo └── package.order /BaseClasses/PartialLiquidFunction.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.BaseClasses; 2 | partial function PartialLiquidFunction 3 | annotation (Icon(graphics={Bitmap(extent={{-100,-100},{100,100}}, 4 | imageSource= 5 | "iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAD/VJREFUeNrsnTFXG9cWhYcx2I6dBFLYRVygJileCukVaV4KpkmNUqRG/8DKL7D4BRa/IFCniKjTiOKlSRGpyCucRhR2YRcWSezYxpg3e7iTJbAE99y5d2buzN5rzUL2QhJI52Offe6d0dLp6WlA2dXSD8/X4i+t+GioI/13oG43DR96HB9TdXukbk/UMTr99pMpX33L7yUBsQJCawaIjYJ/rIMUGAXNkO8UAckLCAAQqaOVwQny1lgBA1iGMTQTvpsExJZDAIa2+rpekV/tUMEyUMCwNSMgIpdIgdisya+9nwJDdyEgi5yio45mzV8OtGN9BcuUgNQYkBiMtoJiM6AWOctuDMqAgNSrhUrdYp0MaGeWXQXLhIBUEwxMnbrxscV6z6Q9tGAxKCMCUg0wELZ7QfHrE1UT1lt6VV9nqSwgZQFj/VYYNG6rI74NtdaWg7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wGZcRO8oBu2HhOgAJLu5zcZ5ueE7/6jVwkcFsGADlRLNfWi7nwBZAaUrmq7Vm0+LvZ3dRo3gujOcq3BGD57G0PxOsu+qctcA+1U36t68w2QmQCPF3rT9mOnrgJY6rIyj5VvQOHALVLhYzK6ZQ3ilQPkQjYBKOsuHh8bIgFK+9OVysECKAZPjhMwxu4+rvtQgTHwtsZ8BmQmm6DteuDyeeAs7Xsr8XHd2zZs8Pg4bqGOk6+OnGJWuOxT35esUVlALrRdyCZbeTwftrQAlOjuSrKtpWwhHyEb2z+GT4+TXGFhC4iu9gILn8tBQNyBEilQNvJ8XjgMQDk7lpOWLK/9YAABLdNo+ja5jSMHh7ioAwXGsFL1VDVAigZlHjiAJTluneWYxu1r4kwDACYvTv4BAg6B/ysAhFqAUXlAygZKBVVpMGoDyAwoLRXmt1jbmTNGv8iz/AiI+zDfUcc6611LGNfu4qhK+CYgerC0FSibZGCu9hUUg9rWSJ0BmQEFaylt1YI1a/5yYPs5Fl8Hvq9hEBB3LRhgiWrkLHCKoYJiwiogIBJniWaAqUpmOUyBwFc6BQGx6S6ROloetWNom0YKiiFdgoDkCU0KCw4AVPR6C9YnJgqIUdXXKQiIv61ZCgyO9N+Bum3qPHCCtB0aqduTFAi2Svb1fwEGAHFC+SxyQQ8JAAAAAElFTkSuQmCC", 6 | fileName="modelica://TILMedia/Resources/Images/Icon_Liquid_Function.png")})); 7 | 8 | end PartialLiquidFunction; 9 | -------------------------------------------------------------------------------- /BaseClasses/PartialLiquidFunctions.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.BaseClasses; 2 | package PartialLiquidFunctions 3 | "Package for calculation of liquid properties with a functional call" 4 | extends TILMedia.Internals.ClassTypes.ModelPackage; 5 | 6 | replaceable partial function specificEntropy_phxi = 7 | TILMedia.BaseClasses.PartialLiquidFunctionPrototypes.specificEntropy_phxi; 8 | 9 | replaceable partial function specificEntropy_pTxi = 10 | TILMedia.BaseClasses.PartialLiquidFunctionPrototypes.specificEntropy_pTxi; 11 | 12 | 13 | replaceable partial function density_Txi = 14 | TILMedia.BaseClasses.PartialLiquidFunctionPrototypes.density_Txi; 15 | replaceable partial function specificEnthalpy_Txi = 16 | TILMedia.BaseClasses.PartialLiquidFunctionPrototypes.specificEnthalpy_Txi; 17 | replaceable partial function specificIsobaricHeatCapacity_Txi = 18 | TILMedia.BaseClasses.PartialLiquidFunctionPrototypes.specificIsobaricHeatCapacity_Txi; 19 | replaceable partial function isobaricThermalExpansionCoefficient_Txi = 20 | TILMedia.BaseClasses.PartialLiquidFunctionPrototypes.isobaricThermalExpansionCoefficient_Txi; 21 | replaceable partial function prandtlNumber_Txi = 22 | TILMedia.BaseClasses.PartialLiquidFunctionPrototypes.prandtlNumber_Txi; 23 | replaceable partial function thermalConductivity_Txi = 24 | TILMedia.BaseClasses.PartialLiquidFunctionPrototypes.thermalConductivity_Txi; 25 | replaceable partial function dynamicViscosity_Txi = 26 | TILMedia.BaseClasses.PartialLiquidFunctionPrototypes.dynamicViscosity_Txi; 27 | 28 | replaceable partial function density_hxi = 29 | TILMedia.BaseClasses.PartialLiquidFunctionPrototypes.density_hxi; 30 | replaceable partial function temperature_hxi = 31 | TILMedia.BaseClasses.PartialLiquidFunctionPrototypes.temperature_hxi; 32 | replaceable partial function specificIsobaricHeatCapacity_hxi = 33 | TILMedia.BaseClasses.PartialLiquidFunctionPrototypes.specificIsobaricHeatCapacity_hxi; 34 | replaceable partial function isobaricThermalExpansionCoefficient_hxi = 35 | TILMedia.BaseClasses.PartialLiquidFunctionPrototypes.isobaricThermalExpansionCoefficient_hxi; 36 | replaceable partial function prandtlNumber_hxi = 37 | TILMedia.BaseClasses.PartialLiquidFunctionPrototypes.prandtlNumber_hxi; 38 | replaceable partial function thermalConductivity_hxi = 39 | TILMedia.BaseClasses.PartialLiquidFunctionPrototypes.thermalConductivity_hxi; 40 | replaceable partial function dynamicViscosity_hxi = 41 | TILMedia.BaseClasses.PartialLiquidFunctionPrototypes.dynamicViscosity_hxi; 42 | 43 | end PartialLiquidFunctions; 44 | -------------------------------------------------------------------------------- /BaseClasses/PartialLiquidObjectFunction.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.BaseClasses; 2 | partial function PartialLiquidObjectFunction 3 | annotation (Icon(graphics={Bitmap(extent={{-100,-100},{100,100}}, 4 | imageSource= 5 | "iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAD/VJREFUeNrsnTFXG9cWhYcx2I6dBFLYRVygJileCukVaV4KpkmNUqRG/8DKL7D4BRa/IFCniKjTiOKlSRGpyCucRhR2YRcWSezYxpg3e7iTJbAE99y5d2buzN5rzUL2QhJI52Offe6d0dLp6WlA2dXSD8/X4i+t+GioI/13oG43DR96HB9TdXukbk/UMTr99pMpX33L7yUBsQJCawaIjYJ/rIMUGAXNkO8UAckLCAAQqaOVwQny1lgBA1iGMTQTvpsExJZDAIa2+rpekV/tUMEyUMCwNSMgIpdIgdisya+9nwJDdyEgi5yio45mzV8OtGN9BcuUgNQYkBiMtoJiM6AWOctuDMqAgNSrhUrdYp0MaGeWXQXLhIBUEwxMnbrxscV6z6Q9tGAxKCMCUg0wELZ7QfHrE1UT1lt6VV9nqSwgZQFj/VYYNG6rI74NtdaWg7XrS6LHmbx4Fx8nZ7dfvlP/fhccxrcJCgEpPRgAobV2LTmiuyvB2spScjsPjaYnwfT4NBg+PU5u4ygAnEqCUhlAVPju5ZUxNu4sBxGOGAaAACDKJAADUADN8Nnb4CA+cswovaqEee8BUWsYCN8PXDtE+95KfFxPwPBRAGXw+E18HOfhMNsqzE8JSHFwYB0Di1pOxrXN2Bk6jRtB+9OVJENUScgvgyfHwe7kdTCenrh6GoyHuz6vo3gJiGqnAIb1BT44RadxPQGjalBcBgtA2Z28ceUs+wqUCQFxD0dXZY1Vm4+7paDwtX2y2YYBlr0YFss6UtmkT0DcZQ1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MQDk7lpOWLK/9YAABLdNo+ja5jSMHh7ioAwXGsFL1VDVAigZlHjiAJTluneWYxu1r4kwDACYvTv4BAg6B/ysAhFqAUXlAygZKBVVpMGoDyAwoLRXmt1jbmTNGv8iz/AiI+zDfUcc6611LGNfu4qhK+CYgerC0FSibZGCu9hUUg9rWSJ0BmQEFaylt1YI1a/5yYPs5Fl8Hvq9hEBB3LRhgiWrkLHCKoYJiwiogIBJniWaAqUpmOUyBwFc6BQGx6S6ROloetWNom0YKiiFdgoDkCU0KCw4AVPR6C9YnJgqIUdXXKQiIv61ZCgyO9N+Bum3qPHCCtB0aqduTFAi2Svb1fwEGAHFC+SxyQQ8JAAAAAElFTkSuQmCC", 6 | fileName="modelica://TILMedia/Resources/Images/Icon_Liquid_Function.png")})); 7 | 8 | end PartialLiquidObjectFunction; 9 | -------------------------------------------------------------------------------- /BaseClasses/PartialLiquidObjectFunctions.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.BaseClasses; 2 | package PartialLiquidObjectFunctions 3 | "Package for calculation of liquid properties with a functional call, referencing existing external objects for highspeed evaluation" 4 | extends TILMedia.Internals.ClassTypes.ModelPackage; 5 | 6 | replaceable partial function specificEntropy_phxi = 7 | TILMedia.BaseClasses.PartialLiquidObjectFunctionPrototypes.specificEntropy_phxi; 8 | 9 | replaceable partial function specificEntropy_pTxi = 10 | TILMedia.BaseClasses.PartialLiquidObjectFunctionPrototypes.specificEntropy_pTxi; 11 | 12 | 13 | replaceable partial function density_Txi = 14 | TILMedia.BaseClasses.PartialLiquidObjectFunctionPrototypes.density_Txi; 15 | replaceable partial function specificEnthalpy_Txi = 16 | TILMedia.BaseClasses.PartialLiquidObjectFunctionPrototypes.specificEnthalpy_Txi; 17 | replaceable partial function specificIsobaricHeatCapacity_Txi = 18 | TILMedia.BaseClasses.PartialLiquidObjectFunctionPrototypes.specificIsobaricHeatCapacity_Txi; 19 | replaceable partial function isobaricThermalExpansionCoefficient_Txi = 20 | TILMedia.BaseClasses.PartialLiquidObjectFunctionPrototypes.isobaricThermalExpansionCoefficient_Txi; 21 | replaceable partial function prandtlNumber_Txi = 22 | TILMedia.BaseClasses.PartialLiquidObjectFunctionPrototypes.prandtlNumber_Txi; 23 | replaceable partial function thermalConductivity_Txi = 24 | TILMedia.BaseClasses.PartialLiquidObjectFunctionPrototypes.thermalConductivity_Txi; 25 | replaceable partial function dynamicViscosity_Txi = 26 | TILMedia.BaseClasses.PartialLiquidObjectFunctionPrototypes.dynamicViscosity_Txi; 27 | 28 | replaceable partial function density_hxi = 29 | TILMedia.BaseClasses.PartialLiquidObjectFunctionPrototypes.density_hxi; 30 | replaceable partial function temperature_hxi = 31 | TILMedia.BaseClasses.PartialLiquidObjectFunctionPrototypes.temperature_hxi; 32 | replaceable partial function specificIsobaricHeatCapacity_hxi = 33 | TILMedia.BaseClasses.PartialLiquidObjectFunctionPrototypes.specificIsobaricHeatCapacity_hxi; 34 | replaceable partial function isobaricThermalExpansionCoefficient_hxi = 35 | TILMedia.BaseClasses.PartialLiquidObjectFunctionPrototypes.isobaricThermalExpansionCoefficient_hxi; 36 | replaceable partial function prandtlNumber_hxi = 37 | TILMedia.BaseClasses.PartialLiquidObjectFunctionPrototypes.prandtlNumber_hxi; 38 | replaceable partial function thermalConductivity_hxi = 39 | TILMedia.BaseClasses.PartialLiquidObjectFunctionPrototypes.thermalConductivity_hxi; 40 | replaceable partial function dynamicViscosity_hxi = 41 | TILMedia.BaseClasses.PartialLiquidObjectFunctionPrototypes.dynamicViscosity_hxi; 42 | 43 | end PartialLiquidObjectFunctions; 44 | -------------------------------------------------------------------------------- /BaseClasses/package.mo: -------------------------------------------------------------------------------- 1 | within TILMedia; 2 | package BaseClasses 3 | extends TILMedia.Internals.ClassTypes.ModelPackage; 4 | 5 | annotation(Protection(access=Access.nonPackageDuplicate)); 6 | end BaseClasses; 7 | -------------------------------------------------------------------------------- /BaseClasses/package.order: -------------------------------------------------------------------------------- 1 | PartialGas 2 | PartialGas_ph 3 | PartialGas_ps 4 | PartialGas_pT 5 | PartialLiquid 6 | PartialLiquid_ph 7 | PartialLiquid_pT 8 | PartialVLEFluid 9 | PartialVLEFluid_dT 10 | PartialVLEFluid_ph 11 | PartialVLEFluid_ps 12 | PartialVLEFluid_pT 13 | PartialGasFunction 14 | PartialGasObjectFunction 15 | PartialLiquidFunction 16 | PartialLiquidObjectFunction 17 | PartialSLEMediumFunction 18 | PartialSolidFunction 19 | PartialVLEFluidFunction 20 | PartialVLEFluidObjectFunction 21 | PartialGasFunctionPrototypes 22 | PartialGasFunctions 23 | PartialGasObjectFunctionPrototypes 24 | PartialGasObjectFunctions 25 | PartialLiquidFunctionPrototypes 26 | PartialLiquidFunctions 27 | PartialLiquidObjectFunctionPrototypes 28 | PartialLiquidObjectFunctions 29 | PartialVLEFluidFunctionPrototypes 30 | PartialVLEFluidFunctions 31 | PartialVLEFluidObjectFunctionPrototypes 32 | PartialVLEFluidObjectFunctions 33 | -------------------------------------------------------------------------------- /GasTypes/BaseGas.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.GasTypes; 2 | record BaseGas "Base record for gas definitions" 3 | extends TILMedia.Internals.ClassTypes.Record; 4 | constant Boolean fixedMixingRatio 5 | "Treat medium as pseudo pure in Modelica if it is a mixture" 6 | annotation(Dialog, HideResult = true); 7 | constant Integer nc_propertyCalculation(min=1) 8 | "Number of components for fluid property calculations" 9 | annotation(Dialog, HideResult = true); 10 | final constant Integer nc=if fixedMixingRatio then 1 else nc_propertyCalculation 11 | "Number of components in Modelica models" 12 | annotation(Evaluate=true, HideResult = true); 13 | parameter TILMedia.Internals.GasName[:] gasNames = {""} 14 | "Array of gas names e.g. {\"gasName\"} for pure component" 15 | annotation(Dialog, choices); 16 | parameter Real[nc_propertyCalculation] mixingRatio_propertyCalculation = {1} 17 | "Mixing ratio for fluid property calculation (={1} for pure components)" 18 | annotation(Dialog, HideResult = true); 19 | final parameter Real[nc] defaultMixingRatio = if fixedMixingRatio then {1} else mixingRatio_propertyCalculation 20 | "Default composition for models in Modelica (={1} for pure components)" 21 | annotation(HideResult = true); 22 | final parameter Real xi_default[nc-1] = defaultMixingRatio[1:end-1]/sum(defaultMixingRatio) 23 | "Default mass fractions" 24 | annotation(HideResult = true); 25 | constant Integer condensingIndex 26 | "Index of condensing component (=0, if no condensation is desired)" 27 | annotation(HideResult = true); 28 | final parameter String concatGasName = TILMedia.Internals.concatNames(gasNames) 29 | annotation(Dialog(tab="Internals")); 30 | constant Integer ID=0 31 | "ID is used to map the selected Gas to the sim.cumulatedGasMass array item" annotation(HideResult = true); 32 | annotation (Documentation(info=" 33 |


Every gas substance model contains a substance record as replaceable parameter extending from this base gas model. The substance record contains the following parameters:

34 | 41 |

Access additional substances:

42 |

To acces the properties of an additional substance, it is possible to create a new substance reccord. For more information on the acces of additional propeties see the substance record documentation.

43 |

Furthermore it is possible to parameterize this gase base record, using a gas substance name, listed in the substance names documentation. An example how to parameterize the base gas model is shown below. However note that this is only a local configuration and therefore only accesible in the corresponding model.

44 |

45 | ")); 46 | end BaseGas; 47 | -------------------------------------------------------------------------------- /GasTypes/FlueGasTILMedia.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.GasTypes; 2 | record FlueGasTILMedia "Flue gas TILMedia (Ash,CO,CO2,SO2,N2,O2,NO,H2O,NH3,Ar)" 3 | extends TILMedia.GasTypes.BaseGas( 4 | final fixedMixingRatio=false, 5 | final nc_propertyCalculation=10, 6 | final gasNames={"TILMedia.Ash","TILMediaXTR.Carbon_Monoxide","TILMediaXTR.Carbon_Dioxide","TILMediaXTR.Sulfur_Dioxide","TILMediaXTR.Nitrogen","TILMediaXTR.Oxygen","TILMediaXTR.Nitrous_Oxide","TILMediaXTR.Water","TILMediaXTR.Ammonia","TILMediaXTR.Argon"}, 7 | final condensingIndex=8, 8 | final mixingRatio_propertyCalculation={0.001,0.001,0.001,0.001,1,0.001,0.001,0.001,0.001,0.001}); 9 | end FlueGasTILMedia; 10 | -------------------------------------------------------------------------------- /GasTypes/MoistAirMixture.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.GasTypes; 2 | record MoistAirMixture "Moist air gas mixture with a condensing component" 3 | extends TILMedia.GasTypes.BaseGas( 4 | final fixedMixingRatio=false, 5 | final nc_propertyCalculation=10, 6 | final gasNames={"TILMedia.Ash","TILMediaXTR.Carbon_Monoxide","TILMediaXTR.Carbon_Dioxide","TILMediaXTR.Sulfur_Dioxide","TILMediaXTR.Nitrogen","TILMediaXTR.Oxygen","TILMediaXTR.Nitrous_Oxide","TILMediaXTR.Water","TILMediaXTR.Ammonia","TILMediaXTR.Argon"}, 7 | final condensingIndex=8, 8 | final mixingRatio_propertyCalculation={0.0,0.0,0.00058,0.0,0.75419,0.23135,0.0,0.001,0.0,0.01288}); 9 | end MoistAirMixture; 10 | -------------------------------------------------------------------------------- /GasTypes/package.mo: -------------------------------------------------------------------------------- 1 | within TILMedia; 2 | package GasTypes "Gases and Gas Vapor mixtures, that can be used or composed in TILMedia" 3 | extends TILMedia.Internals.ClassTypes.ModelPackage; 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | annotation(Protection(access=Access.nonPackageDuplicate)); 17 | end GasTypes; 18 | -------------------------------------------------------------------------------- /GasTypes/package.order: -------------------------------------------------------------------------------- 1 | BaseGas 2 | FlueGasTILMedia 3 | MoistAirMixture 4 | -------------------------------------------------------------------------------- /Gas_pT.mo: -------------------------------------------------------------------------------- 1 | within TILMedia; 2 | model Gas_pT 3 | "Gas vapor model with p, T and xi as independent variables" 4 | extends TILMedia.BaseClasses.PartialGas_pT(gasPointer= 5 | TILMedia.Internals.TILMediaExternalObject( 6 | "Gas", 7 | gasType.concatGasName, 8 | computeFlags, 9 | gasType.mixingRatio_propertyCalculation[1:end - 1]/sum(gasType.mixingRatio_propertyCalculation), 10 | gasType.nc, 11 | gasType.condensingIndex, 12 | getInstanceName()), 13 | M_i = {TILMedia.GasObjectFunctions.molarMass_n(i-1,gasPointer) for i in 1:gasType.nc}); 14 | protected 15 | constant Real invalidValue=-1; 16 | final parameter Integer computeFlags = TILMedia.Internals.calcComputeFlags(computeTransportProperties,false,true,false,false); 17 | equation 18 | //calculate molar mass 19 | M = 1/sum(cat(1,xi,{1-sum(xi)})./M_i); 20 | //calculate molar fraction 21 | xi = x.*M_i[1:end-1]*(sum(cat(1,xi,{1-sum(xi)})./M_i)); //xi = x.*M_i/M 22 | //calculate relative humidity, water content, h1px 23 | if (gasType.condensingIndex>0 and gasType.nc>1) then 24 | if (gasType.condensingIndex==gasType.nc) then 25 | cat(1,xi_dryGas,{1-sum(xi_dryGas)})=xi*(1+humRatio); 26 | else 27 | humRatio = xi[gasType.condensingIndex]*(humRatio+1); 28 | for i in 1:gasType.nc-1 loop 29 | if (i <> gasType.condensingIndex) then 30 | xi_dryGas[if (iTestGas. 80 |

81 |
82 | ")); 83 | end Gas_pT; 84 | -------------------------------------------------------------------------------- /Gas_ph.mo: -------------------------------------------------------------------------------- 1 | within TILMedia; 2 | model Gas_ph 3 | "Gas vapor model with p, h and xi as independent variables" 4 | extends TILMedia.BaseClasses.PartialGas_ph(gasPointer= 5 | TILMedia.Internals.TILMediaExternalObject( 6 | "Gas", 7 | gasType.concatGasName, 8 | computeFlags, 9 | gasType.mixingRatio_propertyCalculation[1:end - 1]/sum(gasType.mixingRatio_propertyCalculation), 10 | gasType.nc, 11 | gasType.condensingIndex, 12 | getInstanceName()), 13 | M_i = {TILMedia.GasObjectFunctions.molarMass_n(i-1,gasPointer) for i in 1:gasType.nc}); 14 | protected 15 | constant Real invalidValue=-1; 16 | final parameter Integer computeFlags = TILMedia.Internals.calcComputeFlags(computeTransportProperties,false,true,false,false); 17 | equation 18 | //calculate molar mass 19 | M = 1/sum(cat(1,xi,{1-sum(xi)})./M_i); 20 | //calculate molar fraction 21 | xi = x.*M_i[1:end-1]*(sum(cat(1,xi,{1-sum(xi)})./M_i)); //xi = x.*M_i/M 22 | //calculate relative humidity, water content, h1px 23 | if (gasType.condensingIndex>0 and gasType.nc>1) then 24 | if (gasType.condensingIndex==gasType.nc) then 25 | cat(1,xi_dryGas,{1-sum(xi_dryGas)})=xi*(1+humRatio); 26 | else 27 | humRatio = xi[gasType.condensingIndex]*(humRatio+1); 28 | for i in 1:gasType.nc-1 loop 29 | if (i <> gasType.condensingIndex) then 30 | xi_dryGas[if (iTestGas. 85 |

86 |
87 | ")); 88 | end Gas_ph; 89 | -------------------------------------------------------------------------------- /Gas_ps.mo: -------------------------------------------------------------------------------- 1 | within TILMedia; 2 | model Gas_ps 3 | "Gas vapor model with p, s and xi as independent variables" 4 | extends TILMedia.BaseClasses.PartialGas_ps(gasPointer= 5 | TILMedia.Internals.TILMediaExternalObject( 6 | "Gas", 7 | gasType.concatGasName, 8 | computeFlags, 9 | gasType.mixingRatio_propertyCalculation[1:end - 1]/sum(gasType.mixingRatio_propertyCalculation), 10 | gasType.nc, 11 | gasType.condensingIndex, 12 | getInstanceName()), 13 | M_i = {TILMedia.GasObjectFunctions.molarMass_n(i-1,gasPointer) for i in 1:gasType.nc}); 14 | protected 15 | constant Real invalidValue=-1; 16 | final parameter Integer computeFlags = TILMedia.Internals.calcComputeFlags(computeTransportProperties,false,true,false,false); 17 | equation 18 | //calculate molar mass 19 | M = 1/sum(cat(1,xi,{1-sum(xi)})./M_i); 20 | //calculate molar fraction 21 | xi = x.*M_i[1:end-1]*(sum(cat(1,xi,{1-sum(xi)})./M_i)); //xi = x.*M_i/M 22 | //calculate relative humidity, water content, h1px 23 | if (gasType.condensingIndex>0 and gasType.nc>1) then 24 | if (gasType.condensingIndex==gasType.nc) then 25 | cat(1,xi_dryGas,{1-sum(xi_dryGas)})=xi*(1+humRatio); 26 | else 27 | humRatio = xi[gasType.condensingIndex]*(humRatio+1); 28 | for i in 1:gasType.nc-1 loop 29 | if (i <> gasType.condensingIndex) then 30 | xi_dryGas[if (iTestGas. 79 |

80 |
81 | ")); 82 | end Gas_ps; 83 | -------------------------------------------------------------------------------- /Internals/AdditionalVLERecord.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.Internals; 2 | record AdditionalVLERecord "Additional VLE property record" 3 | extends TILMedia.Internals.ClassTypes.Record; 4 | SI.SpecificHeatCapacity cp_l 5 | "Specific heat capacity cp of liquid phase"; 6 | SI.SpecificHeatCapacity cp_v 7 | "Specific heat capacity cp of vapour phase"; 8 | SI.LinearExpansionCoefficient beta_l 9 | "Isobaric expansion coefficient of liquid phase"; 10 | SI.LinearExpansionCoefficient beta_v 11 | "Isobaric expansion coefficient of vapour phase"; 12 | SI.Compressibility kappa_l 13 | "Isothermal compressibility of liquid phase"; 14 | SI.Compressibility kappa_v 15 | "Isothermal compressibility of vapour phase"; 16 | 17 | annotation (Protection(access=Access.packageDuplicate)); 18 | end AdditionalVLERecord; 19 | -------------------------------------------------------------------------------- /Internals/BasePointer.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.Internals; 2 | partial class BasePointer 3 | //extends ExternalObject; 4 | end BasePointer; 5 | -------------------------------------------------------------------------------- /Internals/CriticalDataRecord.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.Internals; 2 | record CriticalDataRecord "Critical data record" 3 | extends TILMedia.Internals.ClassTypes.Record; 4 | 5 | SI.Density d "Critical density"; 6 | SI.SpecificEnthalpy h "Critical specific enthalpy"; 7 | SI.AbsolutePressure p "Critical pressure"; 8 | SI.SpecificEntropy s "Critical specific entropy"; 9 | SI.Temperature T "Critical temperature"; 10 | annotation(defaultComponentName="crit", 11 | Protection(access=Access.packageDuplicate)); 12 | end CriticalDataRecord; 13 | -------------------------------------------------------------------------------- /Internals/GasConfigurations/package.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.Internals; 2 | package GasConfigurations 3 | extends TILMedia.Internals.ClassTypes.ModelPackage; 4 | 5 | end GasConfigurations; 6 | -------------------------------------------------------------------------------- /Internals/GasConfigurations/package.order: -------------------------------------------------------------------------------- 1 | PureComponentGas 2 | -------------------------------------------------------------------------------- /Internals/LiquidConfigurations/PureComponentLiquid.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.Internals.LiquidConfigurations; 2 | package PureComponentLiquid 3 | extends TILMedia.Internals.ClassTypes.ModelPackage; 4 | 5 | model Liquid_ph 6 | "Incompressible liquid model with p and h as independent variables" 7 | extends TILMedia.BaseClasses.PartialLiquid_ph( liquidPointer=TILMedia.Internals.TILMediaExternalObject( 8 | "Liquid", 9 | liquidType.concatLiquidName, 10 | computeFlags, 11 | liquidType.mixingRatio_propertyCalculation[1:end - 1]/sum(liquidType.mixingRatio_propertyCalculation), 12 | liquidType.nc, 13 | 0, 14 | getInstanceName())); 15 | protected 16 | constant Real invalidValue=-1; 17 | final parameter Integer computeFlags=TILMedia.Internals.calcComputeFlags( 18 | computeTransportProperties, 19 | false, 20 | true, 21 | false, 22 | false); 23 | 24 | equation 25 | (d,cp,beta) = 26 | TILMedia.Internals.LiquidObjectFunctions.PureComponentDerivatives.properties_hxi( 27 | h, 28 | xi, 29 | liquidPointer); 30 | T = 31 | TILMedia.Internals.LiquidObjectFunctions.PureComponentDerivatives.temperature_hxi( 32 | h, 33 | xi, 34 | liquidPointer); 35 | s = TILMedia.Internals.LiquidObjectFunctions.specificEntropy_pTxi( 36 | p, 37 | T, 38 | xi, 39 | liquidPointer); 40 | if computeTransportProperties then 41 | (transp.Pr, 42 | transp.lambda, 43 | transp.eta, 44 | transp.sigma) = 45 | TILMedia.Internals.LiquidObjectFunctions.PureComponentDerivatives.transportPropertyRecord_Txi( 46 | T, 47 | xi, 48 | liquidPointer); 49 | else 50 | transp = TILMedia.Internals.TransportPropertyRecord( 51 | invalidValue, 52 | invalidValue, 53 | invalidValue, 54 | invalidValue); 55 | end if; 56 | 57 | annotation ( 58 | defaultComponentName="liquid", 59 | Protection(access=Access.packageDuplicate), 60 | Documentation(info=" 61 |

62 | The liquid model is designed for incompressible liquid fluids. 63 | All thermophysical properties are calculated dependent on the specific enthalpy (h). 64 | Only the specific entropy (s) is dependent on the specific enthalpy (h) and the given pressure (p). 65 | The parameter liquidType defines the medium. 66 | All available liquids are listed in the User's Guide -> Substance Names. 67 | The interface and the way of using, is demonstrated in the Testers -> TestLiquid. 68 |

69 |
70 | ")); 71 | end Liquid_ph; 72 | 73 | model Liquid_pT 74 | "Incompressible liquid model with p and T as independent variables" 75 | extends TILMedia.BaseClasses.PartialLiquid_pT( liquidPointer=TILMedia.Internals.TILMediaExternalObject( 76 | "Liquid", 77 | liquidType.concatLiquidName, 78 | computeFlags, 79 | liquidType.mixingRatio_propertyCalculation[1:end - 1]/sum(liquidType.mixingRatio_propertyCalculation), 80 | liquidType.nc, 81 | 0, 82 | getInstanceName())); 83 | protected 84 | constant Real invalidValue=-1; 85 | final parameter Integer computeFlags=TILMedia.Internals.calcComputeFlags( 86 | computeTransportProperties, 87 | false, 88 | true, 89 | false, 90 | false); 91 | equation 92 | (d,cp,beta) = 93 | TILMedia.Internals.LiquidObjectFunctions.PureComponentDerivatives.properties_Txi( 94 | T, 95 | xi, 96 | liquidPointer); 97 | h = 98 | TILMedia.Internals.LiquidObjectFunctions.PureComponentDerivatives.specificEnthalpy_Txi( 99 | T, 100 | xi, 101 | liquidPointer); 102 | s = TILMedia.Internals.LiquidObjectFunctions.specificEntropy_pTxi( 103 | p, 104 | T, 105 | xi, 106 | liquidPointer); 107 | if computeTransportProperties then 108 | (transp.Pr, 109 | transp.lambda, 110 | transp.eta, 111 | transp.sigma) = 112 | TILMedia.Internals.LiquidObjectFunctions.PureComponentDerivatives.transportPropertyRecord_Txi( 113 | T, 114 | xi, 115 | liquidPointer); 116 | else 117 | transp = TILMedia.Internals.TransportPropertyRecord( 118 | invalidValue, 119 | invalidValue, 120 | invalidValue, 121 | invalidValue); 122 | end if; 123 | 124 | annotation ( 125 | defaultComponentName="liquid", 126 | Protection(access=Access.packageDuplicate), 127 | Documentation(info=" 128 |

129 | The liquid model is designed for incompressible liquid fluids. 130 | All thermophysical properties are calculated dependent on the temperature (T). 131 | Only the specific entropy (s) is dependent on the temperature (T) and the given pressure (p). 132 | The parameter liquidType defines the medium. 133 | All available liquids are listed in the User's Guide -> Substance Names. 134 | The interface and the way of using, is demonstrated in the Testers -> TestLiquid. 135 |

136 |
137 | ")); 138 | end Liquid_pT; 139 | end PureComponentLiquid; 140 | -------------------------------------------------------------------------------- /Internals/LiquidConfigurations/package.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.Internals; 2 | package LiquidConfigurations 3 | extends TILMedia.Internals.ClassTypes.ModelPackage; 4 | 5 | end LiquidConfigurations; 6 | -------------------------------------------------------------------------------- /Internals/LiquidConfigurations/package.order: -------------------------------------------------------------------------------- 1 | PureComponentLiquid 2 | -------------------------------------------------------------------------------- /Internals/MoistAirName.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.Internals; 2 | type MoistAirName "Moist air name" 3 | extends String; 4 | annotation(choices( 5 | choice="TILMedia.MoistAir", 6 | choice="VDI4670.MoistAir", 7 | choice="TILMediaXTR.MoistAir"), 8 | Protection(access=Access.packageDuplicate)); 9 | end MoistAirName; 10 | -------------------------------------------------------------------------------- /Internals/PropertyRecord.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.Internals; 2 | record PropertyRecord "Property record" 3 | extends TILMedia.Internals.ClassTypes.Record; 4 | SI.Density d=0 "Density"; 5 | SI.SpecificEnthalpy h=0 "Specific enthalpy"; 6 | SI.AbsolutePressure p=0 "Pressure"; 7 | SI.SpecificEntropy s=0 "Specific entropy"; 8 | SI.Temperature T=0 "Temperature"; 9 | SI.MassFraction q=0 "Steam mass fraction (quality)"; 10 | SI.SpecificHeatCapacity cp=0 "Specific isobaric heat capacity cp"; 11 | 12 | TILMedia.Internals.CriticalDataRecord crit= 13 | TILMedia.Internals.CriticalDataRecord(d=0.0,T=0.0,p=0.0,h=0.0,s=0.0) 14 | "Critical data record"; 15 | TILMedia.Internals.VLERecordSimple VLE= 16 | TILMedia.Internals.VLERecordSimple(d_l=0.0, h_l=0.0, p_l=0.0, s_l=0.0, T_l=0.0, d_v=0.0, h_v=0.0, p_v=0.0, s_v=0.0, T_v=0.0) 17 | "Saturation property record"; 18 | TILMedia.Internals.VLETransportPropertyRecord VLETransp= 19 | TILMedia.Internals.VLETransportPropertyRecord(Pr_l=0.0, Pr_v=0.0, eta_l=0.0, eta_v=0.0, lambda_l=0.0, lambda_v=0.0) 20 | "Saturation property record"; 21 | TILMedia.Internals.TransportPropertyRecord transp= 22 | TILMedia.Internals.TransportPropertyRecord(Pr=0.0,lambda=0.0,eta=0.0,sigma=0.0) 23 | "Transport property record"; 24 | 25 | annotation(defaultComponentName="properties", 26 | Protection(access=Access.packageDuplicate)); 27 | end PropertyRecord; 28 | -------------------------------------------------------------------------------- /Internals/PropertyRecordND.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.Internals; 2 | record PropertyRecordND "Property record" 3 | extends TILMedia.Internals.ClassTypes.Record; 4 | SI.Density d "Density"; 5 | SI.SpecificEnthalpy h "Specific enthalpy"; 6 | SI.AbsolutePressure p "Pressure"; 7 | SI.SpecificEntropy s "Specific entropy"; 8 | SI.Temperature T "Temperature"; 9 | SI.MassFraction q "Steam mass fraction (quality)"; 10 | SI.SpecificHeatCapacity cp "Specific isobaric heat capacity cp"; 11 | 12 | TILMedia.Internals.CriticalDataRecord crit 13 | "Critical data record"; 14 | TILMedia.Internals.VLERecordSimple VLE 15 | "Saturation property record"; 16 | TILMedia.Internals.VLETransportPropertyRecord VLETransp 17 | "Saturation property record"; 18 | TILMedia.Internals.TransportPropertyRecord transp 19 | "Transport property record"; 20 | 21 | annotation(defaultComponentName="properties", 22 | Protection(access=Access.packageDuplicate)); 23 | end PropertyRecordND; 24 | -------------------------------------------------------------------------------- /Internals/SLEMedium/InterfaceSLEMedium.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.Internals.SLEMedium; 2 | model InterfaceSLEMedium 3 | 4 | parameter TILMedia.Internals.SLEMediumName mediumName= 5 | "Water"; 6 | input SI.SpecificEnthalpy h "Specific enthalpy"; 7 | SI.Density d "Density"; 8 | input SI.AbsolutePressure p "Pressure"; 9 | SI.SpecificEntropy s "Specific entropy"; 10 | SI.Temperature T "Temperature"; 11 | SI.SpecificHeatCapacity cp "Specific heat capacity"; 12 | SI.LinearExpansionCoefficient beta 13 | "Isothermal expansion coefficient"; 14 | SI.MassFraction x "Liquid mass fraction"; 15 | TILMedia.Internals.SLESaturationPropertyRecord sat 16 | annotation (Placement( 17 | transformation(extent={{-80,20},{-60,40}}, rotation=0))); 18 | TILMedia.Internals.TransportPropertyRecord transp "Transport property record" 19 | annotation (Placement(transformation(extent={{-80,60},{-60,80}}, 20 | rotation=0))); 21 | 22 | protected 23 | SI.Temperature TS "Saturated freezing temperature"; 24 | SI.Temperature TL "Saturated melting temperature"; 25 | SI.SpecificHeatCapacity cpS; 26 | SI.SpecificHeatCapacity cpL; 27 | SI.Density dS; 28 | SI.Density dL; 29 | SI.SpecificEnthalpy meltingEnthalpy; 30 | SI.LinearExpansionCoefficient betaL; 31 | SI.LinearExpansionCoefficient betaS; 32 | SI.PrandtlNumber PrL; 33 | SI.KinematicViscosity nuL; 34 | SI.ThermalConductivity lambdaL; 35 | SI.ThermalConductivity lambdaS; 36 | 37 | final parameter SI.SpecificEnthalpy h0 = 0; 38 | 39 | Integer region; 40 | 41 | equation 42 | if mediumName == "TILMedia.SimpleWater" then 43 | TS = 273.15; 44 | TL = TS; 45 | cpL = 4.218e3; // at 273.15 K 46 | cpS = 2.1e3; // at 271.15 K 47 | dL = 999.84; // at 273.15 K 48 | dS = 916.7583; // at 273.15 K 49 | sat.ds = dS; 50 | sat.dl = dL; 51 | meltingEnthalpy = 332.5e3; 52 | PrL = 13.51; 53 | nuL = 1.793e-6; 54 | lambdaL = 561e-3; 55 | lambdaS = 2.2; 56 | betaL = -0.080; // anomaly of water 57 | betaS = 0.1e-3; 58 | elseif mediumName == "TILMedia.SimpleAdBlue" then 59 | TS = 262.15; 60 | TL = TS; 61 | cpL = 3400; 62 | cpS = 1600; 63 | dL = 1090; 64 | dS = 1030; 65 | sat.ds = dS; 66 | sat.dl = dL; 67 | meltingEnthalpy = 270e3; 68 | 69 | nuL = 1.4e-3; 70 | lambdaL = 0.57; 71 | lambdaS = 0.75; /// ?? 72 | betaL = 0; // ??? 73 | betaS = 4.0e-4; // ??? 74 | PrL = nuL*dL*cpL/lambdaL; 75 | elseif mediumName == "TILMedia.AdBlue" then // Datasheet BASF AdBlue 2008, March 30 76 | TS = 262.15; 77 | TL = TS; 78 | cpL = 1000*(8e-6 * (T - 273.15)^2 + 0.0027 * (T - 273.15) + 3.4345); 79 | cpS = 1600; 80 | dL = 1000*(-1.62819E-06*(T-273.15)^2 -0.000428345*(T-273.15) + 1.10001); 81 | dS = 1030; 82 | sat.ds = dS; 83 | sat.dl = 1000*(-1.62819E-06*(TL-273.15)^2 -0.000428345*(TL-273.15) + 1.10001); 84 | meltingEnthalpy = 270e3; 85 | nuL = 1.4e-3; // todo 86 | lambdaL = 0.57; 87 | lambdaS = 0.75; /// ?? 88 | betaL = 0; // ??? 89 | betaS = 4.0e-4; // ??? 90 | PrL = nuL*dL*cpL/lambdaL; 91 | elseif mediumName=="TILMedia.NaOAc" then 92 | TS = 331.15; // 273.15 + 58 93 | TL = TS; 94 | cpL = 3100; 95 | cpS = 2050; 96 | dL = 1280; 97 | dS = 1450; 98 | sat.ds = dS; 99 | sat.dl = dL; 100 | meltingEnthalpy = 260e3; 101 | nuL = -1; 102 | lambdaL = 0.4; 103 | lambdaS = 0.64; 104 | betaL = -1; 105 | betaS = -1; 106 | PrL = -1; 107 | else 108 | TS = -1; 109 | TL = -1; 110 | cpL = -1; 111 | cpS = -1; 112 | dL = -1; 113 | dS = -1; 114 | sat.ds = -1; 115 | sat.dl = -1; 116 | meltingEnthalpy = -1; 117 | nuL = -1; 118 | lambdaL = -1; 119 | lambdaS = -1; 120 | betaL = -1; 121 | betaS = -1; 122 | PrL = -1; 123 | end if; 124 | 125 | /*hier sind die Daten für das PCM-Material Rubitherm RT5 (Rubitherm RT2) : 126 | 127 | Schmelzpunkte: 7degC (6degC) 128 | Erstarrungspunkt: 5degC (2degC) 129 | Schmelzenthalpie: 156 kJ/kg (214 kJ/kg) 130 | Dichte fest bei -15degC: 0.86kg/l (0.86 kg/l) 131 | Dichte flüssig bei 15degC/70degC: 0.77/0.73 kg/l (0.77/0.73kg/l) 132 | Volumenausdehnung bei Phasenwechsel: 10% (10%) 133 | Volumenausdehnung außerhalb des Phasenwechsels: 0.001 1/K (0.001 1/K) 134 | spez. Wärmekapazität fest: 1.8 kJ/(kg*K) (1.8) 135 | spez. Wärmekapazität flüssig: 2.4 kJ/(kg*K) (2.4) 136 | Wärmeleitfähigkeit 0.2 W/(m*K) (0.2 W/(m*K)) 137 | kin. Viskosität bei 40degC: 2.6 mm^2/s (3.1 mm^2/s) 138 | 139 | SI.Temperature Ts "Solid temperature"; 140 | SI.Temperature Tl "Liquid temperature"; 141 | SI.Density ds "Solid density"; 142 | SI.Density dl "Liquid density"; 143 | SI.SpecificEnthalpy hs "Solid specific enthalpy"; 144 | SI.SpecificEnthalpy hl "Liquid specific enthalpy"; 145 | SI.SpecificEntropy ss "Solid specific entropy"; 146 | SI.SpecificEntropy sl "Liquid specific entropy"; 147 | 148 | */ 149 | transp.sigma = -1; 150 | 151 | sat.Ts = TS; 152 | sat.Tl = TL; 153 | 154 | sat.hs = h0; 155 | sat.hl = h0 + meltingEnthalpy; 156 | 157 | sat.ss = 0; 158 | sat.sl = 0; 159 | 160 | if h < h0 then // solid 161 | x = 0; 162 | cp = cpS; 163 | d = dS; 164 | h = cpS*(T - TS); 165 | s = 1; 166 | beta = betaS; 167 | transp.Pr = -1; 168 | transp.eta = -1; 169 | transp.lambda = lambdaS; 170 | region=-1; 171 | elseif h >= h0+meltingEnthalpy then // liquid 172 | x = 1; 173 | cp = cpL; 174 | d = dL; 175 | h = meltingEnthalpy + cpL*(T - TL); // todo calculation by solvin integral 176 | s = 1; 177 | beta = betaL; 178 | transp.Pr = PrL; 179 | transp.eta = nuL*dL; 180 | transp.lambda = lambdaL; 181 | region=1; 182 | else //SLE Area 183 | x = (h - h0)/meltingEnthalpy; 184 | cp = x*cpL + (1 - x)*cpS; 185 | d = 1/(x/dL + (1 - x)/dS); 186 | T = TL; //x*TL + (1 - x)*TS; 187 | s = 1; 188 | beta = x*betaL + (1 - x)*betaS; 189 | transp.Pr = PrL; 190 | transp.eta = -1; 191 | transp.lambda = x*lambdaL + (1 - x)*lambdaS; 192 | region=0; 193 | end if; 194 | 195 | end InterfaceSLEMedium; 196 | -------------------------------------------------------------------------------- /Internals/SLEMedium/package.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.Internals; 2 | package SLEMedium 3 | extends TILMedia.Internals.ClassTypes.ModelPackage; 4 | end SLEMedium; 5 | -------------------------------------------------------------------------------- /Internals/SLEMedium/package.order: -------------------------------------------------------------------------------- 1 | InterfaceSLEMedium 2 | -------------------------------------------------------------------------------- /Internals/SLEMediumFunctions/density_h.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.Internals.SLEMediumFunctions; 2 | function density_h 3 | extends TILMedia.BaseClasses.PartialSLEMediumFunction; 4 | input Real h; 5 | input Real stableSupercooling; 6 | input Real d_s; 7 | input Real d_l; 8 | input Real h_fusion; 9 | output Real d; 10 | protected 11 | Real q; 12 | algorithm 13 | 14 | if (h < 0) then 15 | q := 0; 16 | else 17 | q := min(1, max(0, 1 + ((h - h_fusion)/h_fusion*(1 - min(1, max(0, 18 | stableSupercooling)))))); 19 | end if; 20 | 21 | d := 1/(1/d_s + (1/d_l - 1/d_s)*q); 22 | 23 | end density_h; 24 | -------------------------------------------------------------------------------- /Internals/SLEMediumFunctions/package.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.Internals; 2 | package SLEMediumFunctions 3 | extends TILMedia.Internals.ClassTypes.ModelPackage; 4 | end SLEMediumFunctions; 5 | -------------------------------------------------------------------------------- /Internals/SLEMediumFunctions/package.order: -------------------------------------------------------------------------------- 1 | density_h 2 | quality_h 3 | specificEnthalpy_T 4 | temperature_h 5 | -------------------------------------------------------------------------------- /Internals/SLEMediumFunctions/quality_h.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.Internals.SLEMediumFunctions; 2 | function quality_h 3 | extends TILMedia.BaseClasses.PartialSLEMediumFunction; 4 | input Real h; 5 | input Real iota; 6 | input Real cp_s; 7 | input Real cp_l; 8 | input Real h_fusion; 9 | input Real T_s; 10 | input Real T_l; 11 | output Real q; 12 | algorithm 13 | q := min(1, max(max(0, iota), h/h_fusion)); 14 | end quality_h; 15 | -------------------------------------------------------------------------------- /Internals/SLEMediumFunctions/specificEnthalpy_T.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.Internals.SLEMediumFunctions; 2 | function specificEnthalpy_T 3 | extends TILMedia.BaseClasses.PartialSLEMediumFunction; 4 | input Real T; 5 | input Real iota; 6 | input Real TSupercoolingLimit; 7 | input Real cp_s; 8 | input Real cp_l; 9 | input Real h_fusion; 10 | input Real T_s; 11 | input Real T_l; 12 | output Real h; 13 | protected 14 | Real q; 15 | algorithm 16 | if (T < TSupercoolingLimit) then 17 | h := cp_s*(T - T_s); 18 | elseif T > T_l then 19 | h := cp_l*(T - T_l) + h_fusion; 20 | else 21 | if (T_l > T_s) then 22 | q := min(1, max(max(0, iota), (T - T_s)/(T_l - T_s))); 23 | else 24 | q := min(1, max(0, iota)); 25 | end if; 26 | h := (cp_l*q + cp_s*(1 - q))*(T - (T_l*q + T_s*(1 - q))) + h_fusion*q; 27 | end if; 28 | end specificEnthalpy_T; 29 | -------------------------------------------------------------------------------- /Internals/SLEMediumFunctions/temperature_h.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.Internals.SLEMediumFunctions; 2 | function temperature_h 3 | extends TILMedia.BaseClasses.PartialSLEMediumFunction; 4 | input Real h; 5 | input Real iota; 6 | input Real cp_s; 7 | input Real cp_l; 8 | input Real h_fusion; 9 | input Real T_s; 10 | input Real T_l; 11 | output Real T; 12 | protected 13 | Real q_x; 14 | Real q; 15 | algorithm 16 | q_x := h/h_fusion; 17 | // this should be q 18 | q := min(1, max(max(0, iota), q_x)); 19 | T := T_s + q*(T_l - T_s) - (q - q_x)*h_fusion/(cp_l*q + (1 - q)*cp_s); 20 | end temperature_h; 21 | -------------------------------------------------------------------------------- /Internals/SLEMediumName.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.Internals; 2 | type SLEMediumName "SLEMaterial name" 3 | extends String; 4 | 5 | annotation(choices( 6 | choice="SLEMedium.SimpleAdBlue", 7 | choice="SLEMedium.AdBlue", 8 | choice="SLEMedium.SimpleWater"), 9 | Protection(access=Access.packageDuplicate)); 10 | end SLEMediumName; 11 | -------------------------------------------------------------------------------- /Internals/SLESaturationPropertyRecord.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.Internals; 2 | record SLESaturationPropertyRecord "Solid-liquid equilibrium property record" 3 | extends TILMedia.Internals.ClassTypes.Record; 4 | SI.Temperature Ts "Solid temperature"; 5 | SI.Temperature Tl "Liquid temperature"; 6 | SI.Density ds "Solid density"; 7 | SI.Density dl "Liquid density"; 8 | SI.SpecificEnthalpy hs "Solid specific enthalpy"; 9 | SI.SpecificEnthalpy hl "Liquid specific enthalpy"; 10 | SI.SpecificEntropy ss "Solid specific entropy"; 11 | SI.SpecificEntropy sl "Liquid specific entropy"; 12 | annotation(defaultComponentName="sat", 13 | Protection(access=Access.packageDuplicate)); 14 | end SLESaturationPropertyRecord; 15 | -------------------------------------------------------------------------------- /Internals/SolidPropertyRecord.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.Internals; 2 | record SolidPropertyRecord 3 | extends TILMedia.Internals.ClassTypes.Record; 4 | 5 | SI.Density d "Density"; 6 | SI.Temperature T "Temperature"; 7 | SI.SpecificHeatCapacity cp "Heat capacity"; 8 | SI.ThermalConductivity lambda "Thermal conductivity"; 9 | 10 | annotation (Protection(access=Access.packageDuplicate)); 11 | end SolidPropertyRecord; 12 | -------------------------------------------------------------------------------- /Internals/TILMediaExternalObject.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.Internals; 2 | class TILMediaExternalObject 3 | extends ExternalObject; 4 | function constructor "get memory" 5 | input String objectType; 6 | input String mediumName; 7 | input Integer flags; 8 | input Real[:] xi; 9 | input Integer nc; 10 | input Integer condensingIndex; 11 | input String instanceName; 12 | output TILMediaExternalObject externalObject; 13 | protected 14 | Integer nc_propertyCalculation=1; 15 | external "C" externalObject = TILMedia_createExternalObject( 16 | objectType, 17 | mediumName, 18 | flags, 19 | xi, 20 | nc, 21 | condensingIndex, 22 | instanceName) annotation ( 23 | __iti_dllNoExport=true, 24 | Include=" 25 | /* uncomment for source code version 26 | #ifndef TILMEDIA_REAL_TIME 27 | #define TILMEDIA_REAL_TIME 28 | #define TILMEDIA_STATIC_LIBRARY 29 | #if defined(FMU_SOURCE_CODE_EXPORT) && defined(DYMOLA_STATIC) 30 | #include \"include/TILMediaTotal.c\" 31 | #else 32 | #include \"TILMediaTotal.c\" 33 | #endif 34 | #endif 35 | */ 36 | #ifndef TILMEDIAEXTERNALOBJECTCONSTRUCTOR 37 | #define TILMEDIAEXTERNALOBJECTCONSTRUCTOR 38 | #if defined(_JMI_GLOBAL_H) || defined(WSM_VERSION) || defined(DYMOLA_STATIC) || (defined(ITI_CRT_INCLUDE) && !defined(ITI_COMP_SIM)) 39 | void* TILMedia_createExternalObject_errorInterface(const char* objectType, const char* mixtureName, int flags, double* xi, int _nc, int condensingIndex, const char* instanceName, void* formatMessage, void* formatError, void* dymolaErrorLev); 40 | #if defined(DYMOLA_STATIC) 41 | #ifndef _WIN32 42 | #define __stdcall 43 | #endif 44 | double __stdcall TILMedia_DymosimErrorLevWrapper_externalObject(const char* message, int level) { 45 | return DymosimErrorLev(message, level); 46 | } 47 | #endif 48 | void* TILMedia_createExternalObject(const char* objectType, const char* mixtureName, int flags, double* xi, int _nc, int condensingIndex, const char* instanceName) { 49 | #if defined(DYMOLA_STATIC) 50 | return TILMedia_createExternalObject_errorInterface(objectType, mixtureName, flags, xi, _nc, condensingIndex, instanceName, (void*)ModelicaFormatMessage, (void*)ModelicaFormatError, (void*)TILMedia_DymosimErrorLevWrapper_externalObject); 51 | #else 52 | return TILMedia_createExternalObject_errorInterface(objectType, mixtureName, flags, xi, _nc, condensingIndex, instanceName, (void*)ModelicaFormatMessage, (void*)ModelicaFormatError, 0); 53 | #endif 54 | } 55 | #endif 56 | #endif 57 | ", Library="TILMedia180ClaRa"); 58 | end constructor; 59 | 60 | function destructor "free memory" 61 | input TILMediaExternalObject externalObject; 62 | external "C" TILMedia_destroyExternalObject(externalObject) annotation ( 63 | __iti_dllNoExport=true, 64 | Include="void TILMedia_destroyExternalObject(void*);", 65 | Library="TILMedia180ClaRa"); 66 | end destructor; 67 | end TILMediaExternalObject; 68 | -------------------------------------------------------------------------------- /Internals/TableObject.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.Internals; 2 | class TableObject 3 | extends ExternalObject; 4 | function constructor "get memory" 5 | input String value1; 6 | input String value2; 7 | output TableObject pointer; 8 | external "C" pointer = TILMedia_allocateTable(value1, value2) 9 | annotation(__iti_dllNoExport = true,Include=" 10 | /* uncomment for source code version 11 | #ifndef TILMEDIA_REAL_TIME 12 | #define TILMEDIA_REAL_TIME 13 | #define TILMEDIA_STATIC_LIBRARY 14 | #if defined(FMU_SOURCE_CODE_EXPORT) && defined(DYMOLA_STATIC) 15 | #include \"include/TILMediaTotal.c\" 16 | #else 17 | #include \"TILMediaTotal.c\" 18 | #endif 19 | #endif 20 | */ 21 | #ifndef TILMEDIATABLEALLOCATOR 22 | #define TILMEDIATABLEALLOCATOR 23 | #if defined(_JMI_GLOBAL_H) || defined(WSM_VERSION) || defined(DYMOLA_STATIC) || (defined(ITI_CRT_INCLUDE) && !defined(ITI_COMP_SIM)) 24 | void* TILMedia_allocateTable_errorInterface(const char* table, const char* parameters, void* formatMessage, void* formatError, void* dymolaErrorLev); 25 | #if defined(DYMOLA_STATIC) 26 | #ifndef _WIN32 27 | #define __stdcall 28 | #endif 29 | double __stdcall TILMedia_DymosimErrorLevWrapper_tableObject(const char* message, int level){ 30 | return DymosimErrorLev(message, level); 31 | }; 32 | #endif 33 | void* TILMedia_allocateTable(const char* table, const char* parameters){ 34 | #if defined(DYMOLA_STATIC) 35 | return TILMedia_allocateTable_errorInterface(table, parameters, (void*)ModelicaFormatMessage, (void*)ModelicaFormatError, (void*)TILMedia_DymosimErrorLevWrapper_tableObject); 36 | #else 37 | return TILMedia_allocateTable_errorInterface(table, parameters,(void*)ModelicaFormatMessage, (void*)ModelicaFormatError, 0); 38 | #endif 39 | } 40 | #endif 41 | #endif 42 | ", Library="TILMedia180ClaRa"); 43 | end constructor; 44 | 45 | function destructor "free memory" 46 | input TableObject pointer; 47 | external "C" TILMedia_freeTable(pointer) 48 | annotation(__iti_dllNoExport = true,Include="void TILMedia_freeTable(void*);",Library="TILMedia180ClaRa"); 49 | end destructor; 50 | 51 | annotation(Protection(access=Access.documentation)); 52 | 53 | end TableObject; 54 | -------------------------------------------------------------------------------- /Internals/TransportPropertyRecord.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.Internals; 2 | record TransportPropertyRecord "Transport property record" 3 | extends TILMedia.Internals.ClassTypes.Record; 4 | SI.PrandtlNumber Pr "Prandtl number"; 5 | SI.ThermalConductivity lambda "Thermal conductivity"; 6 | SI.DynamicViscosity eta(min=-1) "Dynamic viscosity"; 7 | SI.SurfaceTension sigma "Surface tension"; 8 | annotation(defaultComponentName="transp", 9 | Protection(access=Access.packageDuplicate)); 10 | end TransportPropertyRecord; 11 | -------------------------------------------------------------------------------- /Internals/Units.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.Internals; 2 | package Units "Unit definitions" 3 | extends TILMedia.Internals.ClassTypes.ModelPackage; 4 | type DensityDerPressure = Real(final unit="kg/(N.m)"); 5 | type DensityDerSpecificEnthalpy = Real(final unit="kg2/(m3.J)"); 6 | type DensityDerMassFraction = Real(final unit="kg/(m3)"); 7 | type RelativeHumidity = Real(final unit="", min=0, max=100); 8 | type SpecificVolumeDerPressure = Real(final unit="m3/(kg.Pa)"); 9 | type SpecificVolumeDerSpecificEnthalpy = Real(final unit="m3/J"); 10 | type SpecificVolumeDerMassFraction = Real(final unit="m3/kg"); 11 | end Units; 12 | -------------------------------------------------------------------------------- /Internals/VLEFluidConfigurations/FullyMixtureCompatible/VLEFluidFunctions.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.Internals.VLEFluidConfigurations.FullyMixtureCompatible; 2 | package VLEFluidFunctions 3 | "Package for calculation of VLEFluid properties with a functional call" 4 | extends TILMedia.VLEFluidFunctions; 5 | end VLEFluidFunctions; 6 | -------------------------------------------------------------------------------- /Internals/VLEFluidConfigurations/FullyMixtureCompatible/VLEFluidObjectFunctions.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.Internals.VLEFluidConfigurations.FullyMixtureCompatible; 2 | package VLEFluidObjectFunctions 3 | "Package for calculation of VLEFLuid properties with a functional call, referencing existing external objects for highspeed evaluation" 4 | extends TILMedia.VLEFluidObjectFunctions; 5 | 6 | redeclare replaceable function pressure_dTxi 7 | extends TILMedia.BaseClasses.PartialVLEFluidObjectFunctionPrototypes.pressure_dTxi; 8 | external "C" p = TILMedia_VLEFluidObjectFunctions_pressure_dTxi(d, T, xi, vleFluidPointer) 9 | annotation(__iti_dllNoExport = true,Include="double TILMedia_VLEFluidObjectFunctions_pressure_dTxi(double, double, double*, void*);",Library="TILMedia180ClaRa"); 10 | annotation(inverse(d=TILMedia.VLEFluidObjectFunctions.density_pTxi(p, T, xi, vleFluidPointer))); 11 | end pressure_dTxi; 12 | 13 | redeclare replaceable function specificEnthalpy_dTxi 14 | extends TILMedia.BaseClasses.PartialVLEFluidObjectFunctionPrototypes.specificEnthalpy_dTxi; 15 | external "C" h = TILMedia_VLEFluidObjectFunctions_specificEnthalpy_dTxi(d, T, xi, vleFluidPointer) 16 | annotation(__iti_dllNoExport = true,Include="double TILMedia_VLEFluidObjectFunctions_specificEnthalpy_dTxi(double, double, double*, void*);",Library="TILMedia180ClaRa"); 17 | end specificEnthalpy_dTxi; 18 | 19 | redeclare replaceable function specificEntropy_dTxi 20 | extends TILMedia.BaseClasses.PartialVLEFluidObjectFunctionPrototypes.specificEntropy_dTxi; 21 | external "C" s = TILMedia_VLEFluidObjectFunctions_specificEntropy_dTxi(d, T, xi, vleFluidPointer) 22 | annotation(__iti_dllNoExport = true,Include="double TILMedia_VLEFluidObjectFunctions_specificEntropy_dTxi(double, double, double*, void*);",Library="TILMedia180ClaRa"); 23 | end specificEntropy_dTxi; 24 | 25 | redeclare replaceable function temperature_phxi 26 | extends TILMedia.BaseClasses.PartialVLEFluidObjectFunctionPrototypes.temperature_phxi; 27 | external "C" T = TILMedia_VLEFluidObjectFunctions_temperature_phxi(p, h, xi, vleFluidPointer) 28 | annotation(__iti_dllNoExport = true,Include="double TILMedia_VLEFluidObjectFunctions_temperature_phxi(double, double, double*, void*);",Library="TILMedia180ClaRa"); 29 | annotation(inverse(h=TILMedia.VLEFluidObjectFunctions.specificEnthalpy_pTxi(p, T, xi, vleFluidPointer)),Impure=false); 30 | end temperature_phxi; 31 | 32 | redeclare replaceable function specificEntropy_phxi 33 | extends TILMedia.BaseClasses.PartialVLEFluidObjectFunctionPrototypes.specificEntropy_phxi; 34 | external "C" s = TILMedia_VLEFluidObjectFunctions_specificEntropy_phxi(p, h, xi, vleFluidPointer) 35 | annotation(__iti_dllNoExport = true,Include="double TILMedia_VLEFluidObjectFunctions_specificEntropy_phxi(double, double, double*, void*);",Library="TILMedia180ClaRa"); 36 | end specificEntropy_phxi; 37 | 38 | redeclare replaceable function density_pTxi 39 | extends TILMedia.BaseClasses.PartialVLEFluidObjectFunctionPrototypes.density_pTxi; 40 | external "C" d = TILMedia_VLEFluidObjectFunctions_density_pTxi(p, T, xi, vleFluidPointer) 41 | annotation(__iti_dllNoExport = true,Include="double TILMedia_VLEFluidObjectFunctions_density_pTxi(double, double, double*, void*);",Library="TILMedia180ClaRa"); 42 | end density_pTxi; 43 | 44 | redeclare replaceable function specificEnthalpy_pTxi 45 | extends TILMedia.BaseClasses.PartialVLEFluidObjectFunctionPrototypes.specificEnthalpy_pTxi; 46 | external "C" h = TILMedia_VLEFluidObjectFunctions_specificEnthalpy_pTxi(p, T, xi, vleFluidPointer) 47 | annotation(__iti_dllNoExport = true,Include="double TILMedia_VLEFluidObjectFunctions_specificEnthalpy_pTxi(double, double, double*, void*);",Library="TILMedia180ClaRa"); 48 | annotation(inverse(T=TILMedia.VLEFluidObjectFunctions.temperature_phxi(p, h, xi, vleFluidPointer)),Impure=false); 49 | end specificEnthalpy_pTxi; 50 | 51 | redeclare replaceable function specificEntropy_pTxi 52 | extends TILMedia.BaseClasses.PartialVLEFluidObjectFunctionPrototypes.specificEntropy_pTxi; 53 | external "C" s = TILMedia_VLEFluidObjectFunctions_specificEntropy_pTxi(p, T, xi, vleFluidPointer) 54 | annotation(__iti_dllNoExport = true,Include="double TILMedia_VLEFluidObjectFunctions_specificEntropy_pTxi(double, double, double*, void*);",Library="TILMedia180ClaRa"); 55 | annotation(inverse(T=TILMedia.VLEFluidObjectFunctions.temperature_psxi(p, s, xi, vleFluidPointer)),Impure=false); 56 | end specificEntropy_pTxi; 57 | 58 | redeclare replaceable function density_psxi 59 | extends TILMedia.BaseClasses.PartialVLEFluidObjectFunctionPrototypes.density_psxi; 60 | external "C" d = TILMedia_VLEFluidObjectFunctions_density_psxi(p, s, xi, vleFluidPointer) 61 | annotation(__iti_dllNoExport = true,Include="double TILMedia_VLEFluidObjectFunctions_density_psxi(double, double, double*, void*);",Library="TILMedia180ClaRa"); 62 | end density_psxi; 63 | 64 | redeclare replaceable function temperature_psxi 65 | extends TILMedia.BaseClasses.PartialVLEFluidObjectFunctionPrototypes.temperature_psxi; 66 | external "C" T = TILMedia_VLEFluidObjectFunctions_temperature_psxi(p, s, xi, vleFluidPointer) 67 | annotation(__iti_dllNoExport = true,Include="double TILMedia_VLEFluidObjectFunctions_temperature_psxi(double, double, double*, void*);",Library="TILMedia180ClaRa"); 68 | annotation(inverse(s=TILMedia.VLEFluidObjectFunctions.specificEntropy_pTxi(p, T, xi, vleFluidPointer)),Impure=false); 69 | end temperature_psxi; 70 | 71 | redeclare replaceable function specificEnthalpy_psxi 72 | extends TILMedia.BaseClasses.PartialVLEFluidObjectFunctionPrototypes.specificEnthalpy_psxi; 73 | external "C" h = TILMedia_VLEFluidObjectFunctions_specificEnthalpy_psxi(p, s, xi, vleFluidPointer) 74 | annotation(__iti_dllNoExport = true,Include="double TILMedia_VLEFluidObjectFunctions_specificEnthalpy_psxi(double, double, double*, void*);",Library="TILMedia180ClaRa"); 75 | annotation(inverse(s=TILMedia.VLEFluidObjectFunctions.specificEntropy_phxi(p, h, xi, vleFluidPointer)),Impure=false); 76 | end specificEnthalpy_psxi; 77 | 78 | end VLEFluidObjectFunctions; 79 | -------------------------------------------------------------------------------- /Internals/VLEFluidConfigurations/FullyMixtureCompatible/VLEFluid_dT.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.Internals.VLEFluidConfigurations.FullyMixtureCompatible; 2 | model VLEFluid_dT 3 | "Compressible fluid model with d, T and xi as independent variables" 4 | extends TILMedia.BaseClasses.PartialVLEFluid_dT(vleFluidPointer= 5 | TILMedia.Internals.TILMediaExternalObject( 6 | "VLEFluid", 7 | vleFluidType.concatVLEFluidName, 8 | computeFlags, 9 | vleFluidType.mixingRatio_propertyCalculation[1:end - 1]/sum( 10 | vleFluidType.mixingRatio_propertyCalculation), 11 | vleFluidType.nc, 12 | 0, 13 | getInstanceName()), 14 | M_i = {TILMedia.VLEFluidObjectFunctions.molarMass_n(i-1,vleFluidPointer) for i in 1:vleFluidType.nc}); 15 | protected 16 | constant Real invalidValue=-1; 17 | final parameter Integer computeFlags=TILMedia.Internals.calcComputeFlags( 18 | computeTransportProperties, 19 | interpolateTransportProperties, 20 | computeSurfaceTension, 21 | deactivateTwoPhaseRegion, 22 | deactivateDensityDerivatives); 23 | 24 | equation 25 | (crit.d,crit.h,crit.p,crit.s,crit.T) = 26 | TILMedia.Internals.VLEFluidObjectFunctions.cricondentherm_xi(xi, 27 | vleFluidPointer); 28 | //calculate molar mass 29 | M = 1/sum(cat( 30 | 1, 31 | xi, 32 | {1 - sum(xi)}) ./ M_i); 33 | //calculate mole fraction 34 | xi = x .* M_i[1:end - 1]*(sum(cat( 35 | 1, 36 | xi, 37 | {1 - sum(xi)}) ./ M_i)); 38 | //xi = x.*M_i/M 39 | 40 | //Calculate Main Properties of state 41 | h = 42 | TILMedia.Internals.VLEFluidConfigurations.FullyMixtureCompatible.VLEFluidObjectFunctions.specificEnthalpy_dTxi( 43 | d, 44 | T, 45 | xi, 46 | vleFluidPointer); 47 | p = 48 | TILMedia.Internals.VLEFluidConfigurations.FullyMixtureCompatible.VLEFluidObjectFunctions.pressure_dTxi( 49 | d, 50 | T, 51 | xi, 52 | vleFluidPointer); 53 | s = 54 | TILMedia.Internals.VLEFluidConfigurations.FullyMixtureCompatible.VLEFluidObjectFunctions.specificEntropy_dTxi( 55 | d, 56 | T, 57 | xi, 58 | vleFluidPointer); 59 | 60 | //Calculate Additional Properties of state 61 | (q,cp,cv,beta,kappa,drhodp_hxi,drhodh_pxi,drhodxi_ph,w,gamma) = 62 | TILMedia.Internals.VLEFluidObjectFunctions.additionalProperties_dTxi( 63 | d, 64 | T, 65 | xi, 66 | vleFluidPointer); 67 | 68 | //Calculate VLE Properties 69 | if (vleFluidType.nc == 1) then 70 | //VLE only depends on p or T 71 | (VLE.d_l,VLE.h_l,VLE.p_l,VLE.s_l,VLE.T_l,VLE.xi_l,VLE.d_v,VLE.h_v,VLE.p_v, 72 | VLE.s_v,VLE.T_v,VLE.xi_v) = 73 | TILMedia.Internals.VLEFluidObjectFunctions.VLEProperties_dTxi( 74 | -1, 75 | T, 76 | zeros(0), 77 | vleFluidPointer); 78 | else 79 | //VLE of a mixture also depends on density/enthalpy/entropy/temperature 80 | (VLE.d_l,VLE.h_l,VLE.p_l,VLE.s_l,VLE.T_l,VLE.xi_l,VLE.d_v,VLE.h_v,VLE.p_v, 81 | VLE.s_v,VLE.T_v,VLE.xi_v) = 82 | TILMedia.Internals.VLEFluidObjectFunctions.VLEProperties_dTxi( 83 | d, 84 | T, 85 | xi, 86 | vleFluidPointer); 87 | end if; 88 | 89 | //Calculate Transport Properties 90 | if computeTransportProperties then 91 | (transp.Pr, 92 | transp.lambda, 93 | transp.eta, 94 | transp.sigma) = 95 | TILMedia.Internals.VLEFluidObjectFunctions.transportPropertyRecord_dTxi( 96 | d, 97 | T, 98 | xi, 99 | vleFluidPointer); 100 | else 101 | transp = TILMedia.Internals.TransportPropertyRecord( 102 | invalidValue, 103 | invalidValue, 104 | invalidValue, 105 | invalidValue); 106 | end if; 107 | 108 | //compute VLE Additional Properties 109 | if computeVLEAdditionalProperties then 110 | if (vleFluidType.nc == 1) then 111 | //VLE only depends on p or T 112 | (VLEAdditional.cp_l,VLEAdditional.beta_l,VLEAdditional.kappa_l, 113 | VLEAdditional.cp_v,VLEAdditional.beta_v,VLEAdditional.kappa_v) = 114 | TILMedia.Internals.VLEFluidObjectFunctions.VLEAdditionalProperties_dTxi( 115 | -1, 116 | T, 117 | zeros(vleFluidType.nc - 1), 118 | vleFluidPointer); 119 | else 120 | //VLE of a mixture also depends on density/enthalpy/entropy/temperature 121 | (VLEAdditional.cp_l,VLEAdditional.beta_l,VLEAdditional.kappa_l, 122 | VLEAdditional.cp_v,VLEAdditional.beta_v,VLEAdditional.kappa_v) = 123 | TILMedia.Internals.VLEFluidObjectFunctions.VLEAdditionalProperties_dTxi( 124 | d, 125 | T, 126 | xi, 127 | vleFluidPointer); 128 | end if; 129 | else 130 | VLEAdditional.cp_l = invalidValue; 131 | VLEAdditional.beta_l = invalidValue; 132 | VLEAdditional.kappa_l = invalidValue; 133 | VLEAdditional.cp_v = invalidValue; 134 | VLEAdditional.beta_v = invalidValue; 135 | VLEAdditional.kappa_v = invalidValue; 136 | end if; 137 | 138 | //compute VLE Transport Properties 139 | if computeVLETransportProperties then 140 | if (vleFluidType.nc == 1) then 141 | //VLE only depends on p or T 142 | (VLETransp.Pr_l,VLETransp.Pr_v,VLETransp.lambda_l,VLETransp.lambda_v, 143 | VLETransp.eta_l,VLETransp.eta_v) = 144 | TILMedia.Internals.VLEFluidObjectFunctions.VLETransportPropertyRecord_dTxi( 145 | -1, 146 | T, 147 | zeros(0), 148 | vleFluidPointer); 149 | else 150 | //VLE of a mixture also depends on density/enthalpy/entropy/temperature 151 | (VLETransp.Pr_l,VLETransp.Pr_v,VLETransp.lambda_l,VLETransp.lambda_v, 152 | VLETransp.eta_l,VLETransp.eta_v) = 153 | TILMedia.Internals.VLEFluidObjectFunctions.VLETransportPropertyRecord_dTxi( 154 | d, 155 | T, 156 | xi, 157 | vleFluidPointer); 158 | end if; 159 | else 160 | VLETransp.Pr_l = invalidValue; 161 | VLETransp.Pr_v = invalidValue; 162 | VLETransp.lambda_l = invalidValue; 163 | VLETransp.lambda_v = invalidValue; 164 | VLETransp.eta_l = invalidValue; 165 | VLETransp.eta_v = invalidValue; 166 | end if; 167 | 168 | annotation ( 169 | defaultComponentName="vleFluid", 170 | Protection(access=Access.packageDuplicate), 171 | Documentation(info=" 172 |

173 | The VLE-fluid model VLEFluid_dT calculates the thermopyhsical property data with given inputs: density (d), temperature (T), mass fraction (xi) and the parameter vleFluidType.
174 | The interface and the way of using, is demonstrated in the Testers -> TestVLEFluid. 175 |

176 |
177 | ")); 178 | end VLEFluid_dT; 179 | -------------------------------------------------------------------------------- /Internals/VLEFluidConfigurations/FullyMixtureCompatible/VLEFluid_pT.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.Internals.VLEFluidConfigurations.FullyMixtureCompatible; 2 | model VLEFluid_pT 3 | "Compressible fluid model with p, T and xi as independent variables" 4 | extends TILMedia.BaseClasses.PartialVLEFluid_pT(vleFluidPointer= 5 | TILMedia.Internals.TILMediaExternalObject( 6 | "VLEFluid", 7 | vleFluidType.concatVLEFluidName, 8 | computeFlags, 9 | vleFluidType.mixingRatio_propertyCalculation[1:end - 1]/sum( 10 | vleFluidType.mixingRatio_propertyCalculation), 11 | vleFluidType.nc, 12 | 0, 13 | getInstanceName()), 14 | M_i = {TILMedia.VLEFluidObjectFunctions.molarMass_n(i-1,vleFluidPointer) for i in 1:vleFluidType.nc}); 15 | protected 16 | constant Real invalidValue=-1; 17 | final parameter Integer computeFlags=TILMedia.Internals.calcComputeFlags( 18 | computeTransportProperties, 19 | interpolateTransportProperties, 20 | computeSurfaceTension, 21 | deactivateTwoPhaseRegion, 22 | deactivateDensityDerivatives); 23 | 24 | equation 25 | (crit.d,crit.h,crit.p,crit.s,crit.T) = 26 | TILMedia.Internals.VLEFluidObjectFunctions.cricondenbar_xi(xi, 27 | vleFluidPointer); 28 | //calculate molar mass 29 | M = 1/sum(cat( 30 | 1, 31 | xi, 32 | {1 - sum(xi)}) ./ M_i); 33 | //calculate mole fraction 34 | xi = x .* M_i[1:end - 1]*(sum(cat( 35 | 1, 36 | xi, 37 | {1 - sum(xi)}) ./ M_i)); 38 | //xi = x.*M_i/M 39 | 40 | //Calculate Main Properties of state 41 | d = 42 | TILMedia.Internals.VLEFluidConfigurations.FullyMixtureCompatible.VLEFluidObjectFunctions.density_pTxi( 43 | p, 44 | T, 45 | xi, 46 | vleFluidPointer); 47 | h = 48 | TILMedia.Internals.VLEFluidConfigurations.FullyMixtureCompatible.VLEFluidObjectFunctions.specificEnthalpy_pTxi( 49 | p, 50 | T, 51 | xi, 52 | vleFluidPointer); 53 | s = 54 | TILMedia.Internals.VLEFluidConfigurations.FullyMixtureCompatible.VLEFluidObjectFunctions.specificEntropy_pTxi( 55 | p, 56 | T, 57 | xi, 58 | vleFluidPointer); 59 | 60 | //Calculate Additional Properties of state 61 | (q,cp,cv,beta,kappa,drhodp_hxi,drhodh_pxi,drhodxi_ph,w,gamma) = 62 | TILMedia.Internals.VLEFluidObjectFunctions.additionalProperties_phxi( 63 | p, 64 | h, 65 | xi, 66 | vleFluidPointer); 67 | 68 | //Calculate VLE Properties 69 | if (vleFluidType.nc == 1) then 70 | //VLE only depends on p or T 71 | (VLE.d_l,VLE.h_l,VLE.p_l,VLE.s_l,VLE.T_l,VLE.xi_l,VLE.d_v,VLE.h_v,VLE.p_v, 72 | VLE.s_v,VLE.T_v,VLE.xi_v) = 73 | TILMedia.Internals.VLEFluidObjectFunctions.VLEProperties_phxi( 74 | p, 75 | -1, 76 | zeros(0), 77 | vleFluidPointer); 78 | else 79 | //VLE of a mixture also depends on density/enthalpy/entropy/temperature 80 | (VLE.d_l,VLE.h_l,VLE.p_l,VLE.s_l,VLE.T_l,VLE.xi_l,VLE.d_v,VLE.h_v,VLE.p_v, 81 | VLE.s_v,VLE.T_v,VLE.xi_v) = 82 | TILMedia.Internals.VLEFluidObjectFunctions.VLEProperties_phxi( 83 | p, 84 | h, 85 | xi, 86 | vleFluidPointer); 87 | end if; 88 | 89 | //Calculate Transport Properties 90 | if computeTransportProperties then 91 | (transp.Pr, 92 | transp.lambda, 93 | transp.eta, 94 | transp.sigma) = 95 | TILMedia.Internals.VLEFluidObjectFunctions.transportPropertyRecord_phxi( 96 | p, 97 | h, 98 | xi, 99 | vleFluidPointer); 100 | else 101 | transp = TILMedia.Internals.TransportPropertyRecord( 102 | invalidValue, 103 | invalidValue, 104 | invalidValue, 105 | invalidValue); 106 | end if; 107 | 108 | //compute VLE Additional Properties 109 | if computeVLEAdditionalProperties then 110 | if (vleFluidType.nc == 1) then 111 | //VLE only depends on p or T 112 | (VLEAdditional.cp_l,VLEAdditional.beta_l,VLEAdditional.kappa_l, 113 | VLEAdditional.cp_v,VLEAdditional.beta_v,VLEAdditional.kappa_v) = 114 | TILMedia.Internals.VLEFluidObjectFunctions.VLEAdditionalProperties_phxi( 115 | p, 116 | -1, 117 | zeros(vleFluidType.nc - 1), 118 | vleFluidPointer); 119 | else 120 | //VLE of a mixture also depends on density/enthalpy/entropy/temperature 121 | (VLEAdditional.cp_l,VLEAdditional.beta_l,VLEAdditional.kappa_l, 122 | VLEAdditional.cp_v,VLEAdditional.beta_v,VLEAdditional.kappa_v) = 123 | TILMedia.Internals.VLEFluidObjectFunctions.VLEAdditionalProperties_phxi( 124 | p, 125 | h, 126 | xi, 127 | vleFluidPointer); 128 | end if; 129 | else 130 | VLEAdditional.cp_l = invalidValue; 131 | VLEAdditional.beta_l = invalidValue; 132 | VLEAdditional.kappa_l = invalidValue; 133 | VLEAdditional.cp_v = invalidValue; 134 | VLEAdditional.beta_v = invalidValue; 135 | VLEAdditional.kappa_v = invalidValue; 136 | end if; 137 | 138 | //compute VLE Transport Properties 139 | if computeVLETransportProperties then 140 | if (vleFluidType.nc == 1) then 141 | //VLE only depends on p or T 142 | (VLETransp.Pr_l,VLETransp.Pr_v,VLETransp.lambda_l,VLETransp.lambda_v, 143 | VLETransp.eta_l,VLETransp.eta_v) = 144 | TILMedia.Internals.VLEFluidObjectFunctions.VLETransportPropertyRecord_phxi( 145 | p, 146 | -1, 147 | zeros(0), 148 | vleFluidPointer); 149 | else 150 | //VLE of a mixture also depends on density/enthalpy/entropy/temperature 151 | (VLETransp.Pr_l,VLETransp.Pr_v,VLETransp.lambda_l,VLETransp.lambda_v, 152 | VLETransp.eta_l,VLETransp.eta_v) = 153 | TILMedia.Internals.VLEFluidObjectFunctions.VLETransportPropertyRecord_phxi( 154 | p, 155 | h, 156 | xi, 157 | vleFluidPointer); 158 | end if; 159 | else 160 | VLETransp.Pr_l = invalidValue; 161 | VLETransp.Pr_v = invalidValue; 162 | VLETransp.lambda_l = invalidValue; 163 | VLETransp.lambda_v = invalidValue; 164 | VLETransp.eta_l = invalidValue; 165 | VLETransp.eta_v = invalidValue; 166 | end if; 167 | 168 | annotation ( 169 | defaultComponentName="vleFluid", 170 | Protection(access=Access.packageDuplicate), 171 | Documentation(info=" 172 |

173 | The VLE-fluid model VLEFluid_pT calculates the thermopyhsical property data with given inputs: pressure (p), temperature (T), mass fraction (xi) and the parameter vleFluidType.
174 | The interface and the way of using, is demonstrated in the Testers -> TestVLEFluid. 175 |

176 |
177 | ")); 178 | end VLEFluid_pT; 179 | -------------------------------------------------------------------------------- /Internals/VLEFluidConfigurations/FullyMixtureCompatible/VLEFluid_ph.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.Internals.VLEFluidConfigurations.FullyMixtureCompatible; 2 | model VLEFluid_ph 3 | "Compressible fluid model with p, h and xi as independent variables" 4 | extends TILMedia.BaseClasses.PartialVLEFluid_ph(vleFluidPointer= 5 | TILMedia.Internals.TILMediaExternalObject( 6 | "VLEFluid", 7 | vleFluidType.concatVLEFluidName, 8 | computeFlags, 9 | vleFluidType.mixingRatio_propertyCalculation[1:end - 1]/sum( 10 | vleFluidType.mixingRatio_propertyCalculation), 11 | vleFluidType.nc, 12 | 0, 13 | getInstanceName()), 14 | M_i = {TILMedia.VLEFluidObjectFunctions.molarMass_n(i-1,vleFluidPointer) for i in 1:vleFluidType.nc}); 15 | protected 16 | constant Real invalidValue=-1; 17 | final parameter Integer computeFlags=TILMedia.Internals.calcComputeFlags( 18 | computeTransportProperties, 19 | interpolateTransportProperties, 20 | computeSurfaceTension, 21 | deactivateTwoPhaseRegion, 22 | deactivateDensityDerivatives); 23 | 24 | equation 25 | (crit.d,crit.h,crit.p,crit.s,crit.T) = 26 | TILMedia.Internals.VLEFluidObjectFunctions.cricondenbar_xi(xi, 27 | vleFluidPointer); 28 | //calculate molar mass 29 | M = 1/sum(cat( 30 | 1, 31 | xi, 32 | {1 - sum(xi)}) ./ M_i); 33 | //calculate mole fraction 34 | xi = x .* M_i[1:end - 1]*(sum(cat( 35 | 1, 36 | xi, 37 | {1 - sum(xi)}) ./ M_i)); 38 | //xi = x.*M_i/M 39 | 40 | //Calculate Main Properties of state 41 | d = 42 | TILMedia.Internals.VLEFluidConfigurations.FullyMixtureCompatible.VLEFluidObjectFunctions.density_phxi( 43 | p, 44 | h, 45 | xi, 46 | vleFluidPointer); 47 | s = 48 | TILMedia.Internals.VLEFluidConfigurations.FullyMixtureCompatible.VLEFluidObjectFunctions.specificEntropy_phxi( 49 | p, 50 | h, 51 | xi, 52 | vleFluidPointer); 53 | T = 54 | TILMedia.Internals.VLEFluidConfigurations.FullyMixtureCompatible.VLEFluidObjectFunctions.temperature_phxi( 55 | p, 56 | h, 57 | xi, 58 | vleFluidPointer); 59 | 60 | //Calculate Additional Properties of state 61 | (q,cp,cv,beta,kappa,drhodp_hxi,drhodh_pxi,drhodxi_ph,w,gamma) = 62 | TILMedia.Internals.VLEFluidObjectFunctions.additionalProperties_phxi( 63 | p, 64 | h, 65 | xi, 66 | vleFluidPointer); 67 | 68 | //Calculate VLE Properties 69 | if (vleFluidType.nc == 1) then 70 | //VLE only depends on p or T 71 | (VLE.d_l,VLE.h_l,VLE.p_l,VLE.s_l,VLE.T_l,VLE.xi_l,VLE.d_v,VLE.h_v,VLE.p_v, 72 | VLE.s_v,VLE.T_v,VLE.xi_v) = 73 | TILMedia.Internals.VLEFluidObjectFunctions.VLEProperties_phxi( 74 | p, 75 | -1, 76 | zeros(0), 77 | vleFluidPointer); 78 | else 79 | //VLE of a mixture also depends on density/enthalpy/entropy/temperature 80 | (VLE.d_l,VLE.h_l,VLE.p_l,VLE.s_l,VLE.T_l,VLE.xi_l,VLE.d_v,VLE.h_v,VLE.p_v, 81 | VLE.s_v,VLE.T_v,VLE.xi_v) = 82 | TILMedia.Internals.VLEFluidObjectFunctions.VLEProperties_phxi( 83 | p, 84 | h, 85 | xi, 86 | vleFluidPointer); 87 | end if; 88 | 89 | //Calculate Transport Properties 90 | if computeTransportProperties then 91 | (transp.Pr, 92 | transp.lambda, 93 | transp.eta, 94 | transp.sigma) = 95 | TILMedia.Internals.VLEFluidObjectFunctions.transportPropertyRecord_phxi( 96 | p, 97 | h, 98 | xi, 99 | vleFluidPointer); 100 | else 101 | transp = TILMedia.Internals.TransportPropertyRecord( 102 | invalidValue, 103 | invalidValue, 104 | invalidValue, 105 | invalidValue); 106 | end if; 107 | 108 | //compute VLE Additional Properties 109 | if computeVLEAdditionalProperties then 110 | if (vleFluidType.nc == 1) then 111 | //VLE only depends on p or T 112 | (VLEAdditional.cp_l,VLEAdditional.beta_l,VLEAdditional.kappa_l, 113 | VLEAdditional.cp_v,VLEAdditional.beta_v,VLEAdditional.kappa_v) = 114 | TILMedia.Internals.VLEFluidObjectFunctions.VLEAdditionalProperties_phxi( 115 | p, 116 | -1, 117 | zeros(vleFluidType.nc - 1), 118 | vleFluidPointer); 119 | else 120 | //VLE of a mixture also depends on density/enthalpy/entropy/temperature 121 | (VLEAdditional.cp_l,VLEAdditional.beta_l,VLEAdditional.kappa_l, 122 | VLEAdditional.cp_v,VLEAdditional.beta_v,VLEAdditional.kappa_v) = 123 | TILMedia.Internals.VLEFluidObjectFunctions.VLEAdditionalProperties_phxi( 124 | p, 125 | h, 126 | xi, 127 | vleFluidPointer); 128 | end if; 129 | else 130 | VLEAdditional.cp_l = invalidValue; 131 | VLEAdditional.beta_l = invalidValue; 132 | VLEAdditional.kappa_l = invalidValue; 133 | VLEAdditional.cp_v = invalidValue; 134 | VLEAdditional.beta_v = invalidValue; 135 | VLEAdditional.kappa_v = invalidValue; 136 | end if; 137 | 138 | //compute VLE Transport Properties 139 | if computeVLETransportProperties then 140 | if (vleFluidType.nc == 1) then 141 | //VLE only depends on p or T 142 | (VLETransp.Pr_l,VLETransp.Pr_v,VLETransp.lambda_l,VLETransp.lambda_v, 143 | VLETransp.eta_l,VLETransp.eta_v) = 144 | TILMedia.Internals.VLEFluidObjectFunctions.VLETransportPropertyRecord_phxi( 145 | p, 146 | -1, 147 | zeros(0), 148 | vleFluidPointer); 149 | else 150 | //VLE of a mixture also depends on density/enthalpy/entropy/temperature 151 | (VLETransp.Pr_l,VLETransp.Pr_v,VLETransp.lambda_l,VLETransp.lambda_v, 152 | VLETransp.eta_l,VLETransp.eta_v) = 153 | TILMedia.Internals.VLEFluidObjectFunctions.VLETransportPropertyRecord_phxi( 154 | p, 155 | h, 156 | xi, 157 | vleFluidPointer); 158 | end if; 159 | else 160 | VLETransp.Pr_l = invalidValue; 161 | VLETransp.Pr_v = invalidValue; 162 | VLETransp.lambda_l = invalidValue; 163 | VLETransp.lambda_v = invalidValue; 164 | VLETransp.eta_l = invalidValue; 165 | VLETransp.eta_v = invalidValue; 166 | end if; 167 | 168 | annotation ( 169 | defaultComponentName="vleFluid", 170 | Protection(access=Access.packageDuplicate), 171 | Documentation(info=" 172 |

173 | The VLE-fluid model VLEFluid_ph calculates the thermopyhsical property data with given inputs: pressure (p), enthalpy (h), mass fraction (xi) and the parameter vleFluidType.
174 | The interface and the way of using, is demonstrated in the Testers -> TestVLEFluid. 175 |

176 |
177 | ")); 178 | end VLEFluid_ph; 179 | -------------------------------------------------------------------------------- /Internals/VLEFluidConfigurations/FullyMixtureCompatible/VLEFluid_ps.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.Internals.VLEFluidConfigurations.FullyMixtureCompatible; 2 | model VLEFluid_ps 3 | "Compressible fluid model with p, s and xi as independent variables" 4 | extends TILMedia.BaseClasses.PartialVLEFluid_ps(vleFluidPointer= 5 | TILMedia.Internals.TILMediaExternalObject( 6 | "VLEFluid", 7 | vleFluidType.concatVLEFluidName, 8 | computeFlags, 9 | vleFluidType.mixingRatio_propertyCalculation[1:end - 1]/sum( 10 | vleFluidType.mixingRatio_propertyCalculation), 11 | vleFluidType.nc, 12 | 0, 13 | getInstanceName()), 14 | M_i = {TILMedia.VLEFluidObjectFunctions.molarMass_n(i-1,vleFluidPointer) for i in 1:vleFluidType.nc}); 15 | protected 16 | constant Real invalidValue=-1; 17 | final parameter Integer computeFlags=TILMedia.Internals.calcComputeFlags( 18 | computeTransportProperties, 19 | interpolateTransportProperties, 20 | computeSurfaceTension, 21 | deactivateTwoPhaseRegion, 22 | deactivateDensityDerivatives); 23 | 24 | equation 25 | (crit.d,crit.h,crit.p,crit.s,crit.T) = 26 | TILMedia.Internals.VLEFluidObjectFunctions.cricondenbar_xi(xi, 27 | vleFluidPointer); 28 | //calculate molar mass 29 | M = 1/sum(cat( 30 | 1, 31 | xi, 32 | {1 - sum(xi)}) ./ M_i); 33 | //calculate mole fraction 34 | xi = x .* M_i[1:end - 1]*(sum(cat( 35 | 1, 36 | xi, 37 | {1 - sum(xi)}) ./ M_i)); 38 | //xi = x.*M_i/M 39 | 40 | //Calculate Main Properties of state 41 | d = 42 | TILMedia.Internals.VLEFluidConfigurations.FullyMixtureCompatible.VLEFluidObjectFunctions.density_psxi( 43 | p, 44 | s, 45 | xi, 46 | vleFluidPointer); 47 | h = 48 | TILMedia.Internals.VLEFluidConfigurations.FullyMixtureCompatible.VLEFluidObjectFunctions.specificEnthalpy_psxi( 49 | p, 50 | s, 51 | xi, 52 | vleFluidPointer); 53 | T = 54 | TILMedia.Internals.VLEFluidConfigurations.FullyMixtureCompatible.VLEFluidObjectFunctions.temperature_psxi( 55 | p, 56 | s, 57 | xi, 58 | vleFluidPointer); 59 | 60 | //Calculate Additional Properties of state 61 | (q,cp,cv,beta,kappa,drhodp_hxi,drhodh_pxi,drhodxi_ph,w,gamma) = 62 | TILMedia.Internals.VLEFluidObjectFunctions.additionalProperties_phxi( 63 | p, 64 | h, 65 | xi, 66 | vleFluidPointer); 67 | 68 | //Calculate VLE Properties 69 | if (vleFluidType.nc == 1) then 70 | //VLE only depends on p or T 71 | (VLE.d_l,VLE.h_l,VLE.p_l,VLE.s_l,VLE.T_l,VLE.xi_l,VLE.d_v,VLE.h_v,VLE.p_v, 72 | VLE.s_v,VLE.T_v,VLE.xi_v) = 73 | TILMedia.Internals.VLEFluidObjectFunctions.VLEProperties_phxi( 74 | p, 75 | -1, 76 | zeros(0), 77 | vleFluidPointer); 78 | else 79 | //VLE of a mixture also depends on density/enthalpy/entropy/temperature 80 | (VLE.d_l,VLE.h_l,VLE.p_l,VLE.s_l,VLE.T_l,VLE.xi_l,VLE.d_v,VLE.h_v,VLE.p_v, 81 | VLE.s_v,VLE.T_v,VLE.xi_v) = 82 | TILMedia.Internals.VLEFluidObjectFunctions.VLEProperties_phxi( 83 | p, 84 | h, 85 | xi, 86 | vleFluidPointer); 87 | end if; 88 | 89 | //Calculate Transport Properties 90 | if computeTransportProperties then 91 | (transp.Pr, 92 | transp.lambda, 93 | transp.eta, 94 | transp.sigma) = 95 | TILMedia.Internals.VLEFluidObjectFunctions.transportPropertyRecord_phxi( 96 | p, 97 | h, 98 | xi, 99 | vleFluidPointer); 100 | else 101 | transp = TILMedia.Internals.TransportPropertyRecord( 102 | invalidValue, 103 | invalidValue, 104 | invalidValue, 105 | invalidValue); 106 | end if; 107 | 108 | //compute VLE Additional Properties 109 | if computeVLEAdditionalProperties then 110 | if (vleFluidType.nc == 1) then 111 | //VLE only depends on p or T 112 | (VLEAdditional.cp_l,VLEAdditional.beta_l,VLEAdditional.kappa_l, 113 | VLEAdditional.cp_v,VLEAdditional.beta_v,VLEAdditional.kappa_v) = 114 | TILMedia.Internals.VLEFluidObjectFunctions.VLEAdditionalProperties_phxi( 115 | p, 116 | -1, 117 | zeros(vleFluidType.nc - 1), 118 | vleFluidPointer); 119 | else 120 | //VLE of a mixture also depends on density/enthalpy/entropy/temperature 121 | (VLEAdditional.cp_l,VLEAdditional.beta_l,VLEAdditional.kappa_l, 122 | VLEAdditional.cp_v,VLEAdditional.beta_v,VLEAdditional.kappa_v) = 123 | TILMedia.Internals.VLEFluidObjectFunctions.VLEAdditionalProperties_phxi( 124 | p, 125 | h, 126 | xi, 127 | vleFluidPointer); 128 | end if; 129 | else 130 | VLEAdditional.cp_l = invalidValue; 131 | VLEAdditional.beta_l = invalidValue; 132 | VLEAdditional.kappa_l = invalidValue; 133 | VLEAdditional.cp_v = invalidValue; 134 | VLEAdditional.beta_v = invalidValue; 135 | VLEAdditional.kappa_v = invalidValue; 136 | end if; 137 | 138 | //compute VLE Transport Properties 139 | if computeVLETransportProperties then 140 | if (vleFluidType.nc == 1) then 141 | //VLE only depends on p or T 142 | (VLETransp.Pr_l,VLETransp.Pr_v,VLETransp.lambda_l,VLETransp.lambda_v, 143 | VLETransp.eta_l,VLETransp.eta_v) = 144 | TILMedia.Internals.VLEFluidObjectFunctions.VLETransportPropertyRecord_phxi( 145 | p, 146 | -1, 147 | zeros(0), 148 | vleFluidPointer); 149 | else 150 | //VLE of a mixture also depends on density/enthalpy/entropy/temperature 151 | (VLETransp.Pr_l,VLETransp.Pr_v,VLETransp.lambda_l,VLETransp.lambda_v, 152 | VLETransp.eta_l,VLETransp.eta_v) = 153 | TILMedia.Internals.VLEFluidObjectFunctions.VLETransportPropertyRecord_phxi( 154 | p, 155 | h, 156 | xi, 157 | vleFluidPointer); 158 | end if; 159 | else 160 | VLETransp.Pr_l = invalidValue; 161 | VLETransp.Pr_v = invalidValue; 162 | VLETransp.lambda_l = invalidValue; 163 | VLETransp.lambda_v = invalidValue; 164 | VLETransp.eta_l = invalidValue; 165 | VLETransp.eta_v = invalidValue; 166 | end if; 167 | 168 | annotation ( 169 | defaultComponentName="vleFluid", 170 | Protection(access=Access.packageDuplicate), 171 | Documentation(info=" 172 |

173 | The VLE-fluid model VLEFluid_ps calculates the thermopyhsical property data with given inputs: pressure (p), entropy (s), mass fraction (xi) and the parameter vleFluidType.
174 | The interface and the way of using, is demonstrated in the Testers -> TestVLEFluid. 175 |

176 |
177 | ")); 178 | end VLEFluid_ps; 179 | -------------------------------------------------------------------------------- /Internals/VLEFluidConfigurations/FullyMixtureCompatible/package.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.Internals.VLEFluidConfigurations; 2 | package FullyMixtureCompatible 3 | extends TILMedia.Internals.ClassTypes.ModelPackage; 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | end FullyMixtureCompatible; 12 | -------------------------------------------------------------------------------- /Internals/VLEFluidConfigurations/FullyMixtureCompatible/package.order: -------------------------------------------------------------------------------- 1 | VLEFluid 2 | VLEFluid_pT 3 | VLEFluid_ps 4 | VLEFluid_ph 5 | VLEFluid_dT 6 | VLEFluidObjectFunctions 7 | VLEFluidFunctions 8 | -------------------------------------------------------------------------------- /Internals/VLEFluidConfigurations/package.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.Internals; 2 | package VLEFluidConfigurations 3 | extends TILMedia.Internals.ClassTypes.ModelPackage; 4 | 5 | end VLEFluidConfigurations; 6 | -------------------------------------------------------------------------------- /Internals/VLEFluidConfigurations/package.order: -------------------------------------------------------------------------------- 1 | PureComponentVLEFluid 2 | FullyMixtureCompatible 3 | -------------------------------------------------------------------------------- /Internals/VLERecord.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.Internals; 2 | record VLERecord "VLE property record" 3 | extends TILMedia.Internals.ClassTypes.Record; 4 | SI.Density d_l "Density of liquid phase"; 5 | SI.Density d_v "Density of vapour phase"; 6 | SI.SpecificEnthalpy h_l "Specific enthalpy of liquid phase"; 7 | SI.SpecificEnthalpy h_v "Specific enthalpy of vapour phase"; 8 | SI.AbsolutePressure p_l "Pressure of liquid phase"; 9 | SI.AbsolutePressure p_v "Pressure of vapour phase"; 10 | SI.SpecificEntropy s_l "Specific entropy of liquid phase"; 11 | SI.SpecificEntropy s_v "Specific entropy of vapour phase"; 12 | SI.Temperature T_l "Temperature of liquid phase"; 13 | SI.Temperature T_v "Temperature of vapour phase"; 14 | SI.MassFraction[nc-1] xi_l "Mass fraction of liquid phase"; 15 | SI.MassFraction[nc-1] xi_v "Mass fraction of vapour phase"; 16 | parameter Integer nc(start=1); 17 | 18 | annotation (Protection(access=Access.packageDuplicate)); 19 | end VLERecord; 20 | -------------------------------------------------------------------------------- /Internals/VLERecordSimple.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.Internals; 2 | record VLERecordSimple "VLE property record" 3 | extends TILMedia.Internals.ClassTypes.Record; 4 | SI.Density d_l "Density of liquid phase"; 5 | SI.Density d_v "Density of vapour phase"; 6 | SI.SpecificEnthalpy h_l "Specific enthalpy of liquid phase"; 7 | SI.SpecificEnthalpy h_v "Specific enthalpy of vapour phase"; 8 | SI.AbsolutePressure p_l "Pressure of liquid phase"; 9 | SI.AbsolutePressure p_v "Pressure of vapour phase"; 10 | SI.SpecificEntropy s_l "Specific entropy of liquid phase"; 11 | SI.SpecificEntropy s_v "Specific entropy of vapour phase"; 12 | SI.Temperature T_l "Temperature of liquid phase"; 13 | SI.Temperature T_v "Temperature of vapour phase"; 14 | annotation (Protection(access=Access.packageDuplicate)); 15 | end VLERecordSimple; 16 | -------------------------------------------------------------------------------- /Internals/VLETransportPropertyRecord.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.Internals; 2 | record VLETransportPropertyRecord "Transport property record" 3 | extends TILMedia.Internals.ClassTypes.Record; 4 | SI.PrandtlNumber Pr_l "Prandtl number of liquid phase"; 5 | SI.PrandtlNumber Pr_v "Prandtl number of vapour phase"; 6 | SI.ThermalConductivity lambda_l "Thermal conductivity of liquid phase"; 7 | SI.ThermalConductivity lambda_v "Thermal conductivity of vapour phase"; 8 | SI.DynamicViscosity eta_l(min=-1) "Dynamic viscosity of liquid phase"; 9 | SI.DynamicViscosity eta_v(min=-1) "Dynamic viscosity of vapour phase"; 10 | 11 | annotation(defaultComponentName="transp", 12 | Protection(access=Access.packageDuplicate)); 13 | end VLETransportPropertyRecord; 14 | -------------------------------------------------------------------------------- /Internals/calcComputeFlags.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.Internals; 2 | function calcComputeFlags 3 | input Boolean computeTransportProperties; 4 | input Boolean interpolateTransportProperties; 5 | input Boolean computeSurfaceTension; 6 | input Boolean deactivateTwoPhaseRegion; 7 | input Boolean deactivateDensityDerivatives; 8 | output Integer flags; 9 | algorithm 10 | flags := array(1,2,4,8,16)*array(if (computeTransportProperties) then 1 else 0,if (interpolateTransportProperties) then 1 else 0,if (computeSurfaceTension) then 1 else 0,if (deactivateTwoPhaseRegion) then 1 else 0,if (deactivateDensityDerivatives) then 1 else 0); 11 | // flags := 0; 12 | /* if computeTransportProperties then 13 | flags := flags + 1; 14 | end if; 15 | if interpolateTransportProperties then 16 | flags := flags + 2; 17 | end if; 18 | if computeSurfaceTension then 19 | flags := flags + 4; 20 | end if; 21 | if deactivateTwoPhaseRegion then 22 | flags := flags + 8; 23 | end if; 24 | if deactivateDensityDerivatives then 25 | flags := flags + 16; 26 | end if; 27 | */ 28 | 29 | annotation(Inline=true); 30 | end calcComputeFlags; 31 | -------------------------------------------------------------------------------- /Internals/concatNames.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.Internals; 2 | function concatNames 3 | input String names[:]; 4 | output String concatName; 5 | algorithm 6 | concatName := ""; 7 | if (size(names, 1)>0) then 8 | concatName := names[1]; 9 | end if; 10 | 11 | for i in 2:size(names, 1) loop 12 | concatName := concatName + "|" + names[i]; 13 | end for; 14 | end concatNames; 15 | -------------------------------------------------------------------------------- /Internals/getDoubleVector.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.Internals; 2 | function getDoubleVector 3 | input TILMedia.Internals.TILMediaExternalObject cache; 4 | input Integer length; 5 | input Integer offset=0; 6 | output Real[length] values; 7 | external "C" TILMedia_getDoubleVector(offset, length, cache, values) 8 | annotation(Include="void TILMedia_getDoubleVector(int, int, void*, double*);",Library="TILMedia180ClaRa"); 9 | end getDoubleVector; 10 | -------------------------------------------------------------------------------- /Internals/getProperties.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.Internals; 2 | function getProperties 3 | input Real d, h, p, s, T, cp; 4 | input Real Pr, lambda, eta, sigma; 5 | output TILMedia.Internals.PropertyRecord properties; 6 | algorithm 7 | properties.d := d; 8 | properties.h := h; 9 | properties.p := p; 10 | properties.s := s; 11 | properties.T := T; 12 | properties.cp := cp; 13 | properties.transp := TILMedia.Internals.TransportPropertyRecord( 14 | Pr=Pr, 15 | lambda=lambda, 16 | eta=eta, 17 | sigma=sigma); 18 | end getProperties; 19 | -------------------------------------------------------------------------------- /Internals/getPropertiesVLE.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.Internals; 2 | function getPropertiesVLE 3 | input Real d; 4 | input Real h; 5 | input Real p; 6 | input Real s; 7 | input Real T; 8 | input Real cp; 9 | input Real q; 10 | input Real d_crit; 11 | input Real h_crit; 12 | input Real p_crit; 13 | input Real s_crit; 14 | input Real T_crit; 15 | input Real d_l; 16 | input Real h_l; 17 | input Real p_l; 18 | input Real s_l; 19 | input Real T_l; 20 | input Real d_v; 21 | input Real h_v; 22 | input Real p_v; 23 | input Real s_v; 24 | input Real T_v; 25 | input Real Pr; 26 | input Real lambda; 27 | input Real eta; 28 | input Real sigma; 29 | input Real Pr_l; 30 | input Real Pr_v; 31 | input Real lambda_l; 32 | input Real lambda_v; 33 | input Real eta_l; 34 | input Real eta_v; 35 | output TILMedia.Internals.PropertyRecordND properties; 36 | algorithm 37 | properties := TILMedia.Internals.PropertyRecordND( 38 | d=d, 39 | h=h, 40 | p=p, 41 | s=s, 42 | T=T, 43 | cp=cp, 44 | q=q, 45 | VLE=TILMedia.Internals.VLERecordSimple( 46 | d_l=d_l, 47 | h_l=h_l, 48 | p_l=p_l, 49 | s_l=s_l, 50 | T_l=T_l, 51 | d_v=d_v, 52 | h_v=h_v, 53 | p_v=p_v, 54 | s_v=s_v, 55 | T_v=T_v), 56 | VLETransp=TILMedia.Internals.VLETransportPropertyRecord( 57 | Pr_l=Pr_l, 58 | Pr_v=Pr_v, 59 | lambda_l=lambda_l, 60 | lambda_v=lambda_v, 61 | eta_l=eta_l, 62 | eta_v=eta_v), 63 | transp=TILMedia.Internals.TransportPropertyRecord( 64 | Pr=Pr, 65 | lambda=lambda, 66 | eta=eta, 67 | sigma=sigma), 68 | crit=TILMedia.Internals.CriticalDataRecord( 69 | d=d_crit, 70 | h=h_crit, 71 | p=p_crit, 72 | s=s_crit, 73 | T=T_crit)); 74 | end getPropertiesVLE; 75 | -------------------------------------------------------------------------------- /Internals/massFraction_mixingRatio.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.Internals; 2 | function massFraction_mixingRatio "conversion function" 3 | input Real[:] mixingRatio; 4 | output Real[size(mixingRatio, 1)-1] massFraction=mixingRatio[1:end - 1]/sum(mixingRatio); 5 | algorithm 6 | end massFraction_mixingRatio; 7 | -------------------------------------------------------------------------------- /Internals/package.mo: -------------------------------------------------------------------------------- 1 | within TILMedia; 2 | package Internals "Internal functions" 3 | 4 | 5 | annotation (Icon(graph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pGk38gUpKXiFhU7jvOYY+X7vQXWxiqTRUzP5GeKSo6m1HD4EkeelnzYtzXJYVlEGaZCjaUEGs9e/Qzvxq7a116URYVJ6ChJyNCSI7DY3GAxk8tefoV+QVdIoUVSkQZr1588Ek+5j06sAvdYgMlI5Y5JLshfTRV/unCHN+m98F4K4mK4+e/0WghxCx+qdDwZSj8i4yHFem/RivzEYo/mLly9fGv09OU/Pnz+vTQ7X09W9CrJCmL1cmNNcmhOkSVOQNspRWZBUpWnjGE0VQdoqRy2CFEjTy0WR19P8uBf7TdWmgc2ygjhYBfifmRy/hXpeOk39x6lIE8sYTRlBQl/LEbUgG6R5qqVp0RPDwKatICnIEZwgBdKoKHOMNGEIcnR0lIQcUQiSmjR658znGI2pIFJjVdzNPxo5ohWkQJrTJWlO2vC5fA1smgpSAW+rABEEaRbmnbkYo6lZkEbWciBIeWlOMwY2fQkSrRxJCrJCGGYD1CdI1HIgiLk0cmz1wGYNgoyzhlYBIkgz0vSyFg9s6qs4HRDMdHUEQZrQaI0cCFKPNK0co0lRDgRBGuRAkOCleZrFP0YzyAJaBYgg7ZXmNItvYDPYtRwIkp408nMPORAEioUJZWCz9XIgCNKU5Y+ZHL+ncG4RpN3SnGbux2iimq6OIGAjTS+rNrCZlBwIAqbLnMfZX23cV6mdHwSBVdIsRJbYFjkBAAA0z/8FGABawE/0yskF9QAAAABJRU5ErkJggg==", 7 | fileName="modelica://TILMedia/Resources/Images/Icon_Package_Internals.png")})); 8 | end Internals; 9 | -------------------------------------------------------------------------------- /Internals/package.order: -------------------------------------------------------------------------------- 1 | ClassTypes 2 | GasName 3 | LiquidName 4 | MoistAirName 5 | VLEFluidName 6 | SLEMediumName 7 | CriticalDataRecord 8 | PropertyRecord 9 | PropertyRecordND 10 | VLERecord 11 | VLERecordSimple 12 | AdditionalVLERecord 13 | VLETransportPropertyRecord 14 | SLESaturationPropertyRecord 15 | SolidPropertyRecord 16 | TransportPropertyRecord 17 | TableObject 18 | calcComputeFlags 19 | redirectModelicaFormatMessage 20 | concatNames 21 | getPropertiesVLE 22 | getProperties 23 | BasePointer 24 | TILMediaExternalObject 25 | massFraction_mixingRatio 26 | getDoubleVector 27 | setDoubleVector 28 | GasObjectFunctions 29 | GasFunctions 30 | GasConfigurations 31 | LiquidObjectFunctions 32 | LiquidFunctions 33 | LiquidConfigurations 34 | VLEFluidObjectFunctions 35 | VLEFluidFunctions 36 | VLEFluidConfigurations 37 | SLEMedium 38 | SLEMediumFunctions 39 | Units 40 | -------------------------------------------------------------------------------- /Internals/redirectModelicaFormatMessage.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.Internals; 2 | function redirectModelicaFormatMessage 3 | input Real y=0; 4 | //protected 5 | output Integer x; 6 | external "C" x = TILMedia_redirectModelicaFormatMessage_wrapper() annotation(__iti_dllNoExport = true,Library="TILMedia180ClaRa", 7 | Include=" 8 | /* uncomment for source code version 9 | #ifndef TILMEDIA_REAL_TIME 10 | #define TILMEDIA_REAL_TIME 11 | #define TILMEDIA_STATIC_LIBRARY 12 | #if defined(FMU_SOURCE_CODE_EXPORT) && defined(DYMOLA_STATIC) 13 | #include \"include/TILMediaTotal.c\" 14 | #else 15 | #include \"TILMediaTotal.c\" 16 | #endif 17 | #endif 18 | */ 19 | #ifndef TILMEDIAMODELICAFORMATMESSAGE 20 | #define TILMEDIAMODELICAFORMATMESSAGE 21 | #if defined(_JMI_GLOBAL_H) || defined(WSM_VERSION) || defined(DYMOLA_STATIC) || (defined(ITI_CRT_INCLUDE) && !defined(ITI_COMP_SIM)) 22 | int TILMedia_redirectModelicaFormatMessage(void* _str); 23 | int TILMedia_redirectModelicaFormatError(void* _str); 24 | int TILMedia_redirectDymolaErrorFunction(void* _str); 25 | #if defined(DYMOLA_STATIC) 26 | #ifndef _WIN32 27 | #define __stdcall 28 | #endif 29 | double __stdcall TILMedia_DymosimErrorLevWrapper(const char* message, int level) { 30 | return DymosimErrorLev(message, level); 31 | } 32 | #endif 33 | int TILMedia_redirectModelicaFormatMessage_wrapper(void) { 34 | TILMedia_redirectModelicaFormatMessage((void*)ModelicaFormatMessage); 35 | TILMedia_redirectModelicaFormatError((void*)ModelicaFormatError); 36 | #if defined(DYMOLA_STATIC) 37 | TILMedia_redirectDymolaErrorFunction((void*)TILMedia_DymosimErrorLevWrapper); 38 | #endif 39 | return 0; 40 | } 41 | #endif 42 | #endif 43 | "); 44 | annotation(Inline=false, LateInline=true); 45 | end redirectModelicaFormatMessage; 46 | -------------------------------------------------------------------------------- /Internals/setDoubleVector.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.Internals; 2 | function setDoubleVector 3 | input Real[length] values; 4 | input TILMedia.Internals.TILMediaExternalObject cache; 5 | input Integer length; 6 | input Integer offset=0; 7 | external "C" TILMedia_setDoubleVector(values, offset, length, cache) 8 | annotation(Include="void TILMedia_setDoubleVector(double*, int, int, void*);",Library="TILMedia180ClaRa"); 9 | end setDoubleVector; 10 | -------------------------------------------------------------------------------- /Liquid.mo: -------------------------------------------------------------------------------- 1 | within TILMedia; 2 | model Liquid "Incompressible liquid model for object and member function based evaluation" 3 | extends TILMedia.BaseClasses.PartialLiquid( 4 | liquidPointer=TILMedia.Internals.TILMediaExternalObject( 5 | "Liquid", 6 | liquidType.concatLiquidName, 7 | TILMedia.Internals.calcComputeFlags( 8 | computeTransportProperties, 9 | false, 10 | true, 11 | false, 12 | false), 13 | liquidType.mixingRatio_propertyCalculation[1:end - 1]/sum(liquidType.mixingRatio_propertyCalculation), 14 | liquidType.nc, 15 | 0, 16 | getInstanceName()), 17 | redeclare replaceable function s_phxi = 18 | TILMedia.LiquidObjectFunctions.specificEntropy_phxi, 19 | 20 | redeclare replaceable function s_pTxi = 21 | TILMedia.LiquidObjectFunctions.specificEntropy_pTxi, 22 | 23 | 24 | redeclare replaceable function d_Txi = 25 | TILMedia.LiquidObjectFunctions.density_Txi, 26 | redeclare replaceable function h_Txi = 27 | TILMedia.LiquidObjectFunctions.specificEnthalpy_Txi, 28 | redeclare replaceable function cp_Txi = 29 | TILMedia.LiquidObjectFunctions.specificIsobaricHeatCapacity_Txi, 30 | redeclare replaceable function beta_Txi = 31 | TILMedia.LiquidObjectFunctions.isobaricThermalExpansionCoefficient_Txi, 32 | redeclare replaceable function Pr_Txi = 33 | TILMedia.LiquidObjectFunctions.prandtlNumber_Txi, 34 | redeclare replaceable function lambda_Txi = 35 | TILMedia.LiquidObjectFunctions.thermalConductivity_Txi, 36 | redeclare replaceable function eta_Txi = 37 | TILMedia.LiquidObjectFunctions.dynamicViscosity_Txi, 38 | 39 | redeclare replaceable function d_hxi = 40 | TILMedia.LiquidObjectFunctions.density_hxi, 41 | redeclare replaceable function T_hxi = 42 | TILMedia.LiquidObjectFunctions.temperature_hxi, 43 | redeclare replaceable function cp_hxi = 44 | TILMedia.LiquidObjectFunctions.specificIsobaricHeatCapacity_hxi, 45 | redeclare replaceable function beta_hxi = 46 | TILMedia.LiquidObjectFunctions.isobaricThermalExpansionCoefficient_hxi, 47 | redeclare replaceable function Pr_hxi = 48 | TILMedia.LiquidObjectFunctions.prandtlNumber_hxi, 49 | redeclare replaceable function lambda_hxi = 50 | TILMedia.LiquidObjectFunctions.thermalConductivity_hxi, 51 | redeclare replaceable function eta_hxi = 52 | TILMedia.LiquidObjectFunctions.dynamicViscosity_hxi); 53 | annotation (defaultComponentName="liquid", Protection(access=Access.packageDuplicate)); 54 | end Liquid; 55 | -------------------------------------------------------------------------------- /LiquidFunctions.mo: -------------------------------------------------------------------------------- 1 | within TILMedia; 2 | package LiquidFunctions 3 | "Package for calculation of liquid properties with a functional call" 4 | extends TILMedia.BaseClasses.PartialLiquidFunctions; 5 | 6 | redeclare replaceable function 7 | extends specificEntropy_phxi 8 | algorithm 9 | s := TILMedia.Internals.LiquidFunctions.specificEntropy_phxi(p,h,xi,liquidType.concatLiquidName, liquidType.nc+TILMedia.Internals.redirectModelicaFormatMessage()); 10 | annotation (Inline=false, LateInline=true); 11 | end specificEntropy_phxi; 12 | 13 | redeclare replaceable function 14 | extends specificEntropy_pTxi 15 | algorithm 16 | s := TILMedia.Internals.LiquidFunctions.specificEntropy_pTxi(p,T,xi,liquidType.concatLiquidName, liquidType.nc+TILMedia.Internals.redirectModelicaFormatMessage()); 17 | annotation (Inline=false, LateInline=true); 18 | end specificEntropy_pTxi; 19 | 20 | 21 | redeclare replaceable function 22 | extends density_Txi 23 | algorithm 24 | d := TILMedia.Internals.LiquidFunctions.density_Txi(T,xi,liquidType.concatLiquidName, liquidType.nc+TILMedia.Internals.redirectModelicaFormatMessage()); 25 | annotation (Inline=false, LateInline=true); 26 | end density_Txi; 27 | redeclare replaceable function 28 | extends specificEnthalpy_Txi 29 | algorithm 30 | h := TILMedia.Internals.LiquidFunctions.specificEnthalpy_Txi(T,xi,liquidType.concatLiquidName, liquidType.nc+TILMedia.Internals.redirectModelicaFormatMessage()); 31 | annotation (Inline=false, LateInline=true); 32 | end specificEnthalpy_Txi; 33 | redeclare replaceable function 34 | extends specificIsobaricHeatCapacity_Txi 35 | algorithm 36 | cp := TILMedia.Internals.LiquidFunctions.specificIsobaricHeatCapacity_Txi(T,xi,liquidType.concatLiquidName, liquidType.nc+TILMedia.Internals.redirectModelicaFormatMessage()); 37 | annotation (Inline=false, LateInline=true); 38 | end specificIsobaricHeatCapacity_Txi; 39 | redeclare replaceable function 40 | extends isobaricThermalExpansionCoefficient_Txi 41 | algorithm 42 | beta := TILMedia.Internals.LiquidFunctions.isobaricThermalExpansionCoefficient_Txi(T,xi,liquidType.concatLiquidName, liquidType.nc+TILMedia.Internals.redirectModelicaFormatMessage()); 43 | annotation (Inline=false, LateInline=true); 44 | end isobaricThermalExpansionCoefficient_Txi; 45 | redeclare replaceable function 46 | extends prandtlNumber_Txi 47 | algorithm 48 | Pr := TILMedia.Internals.LiquidFunctions.prandtlNumber_Txi(T,xi,liquidType.concatLiquidName, liquidType.nc+TILMedia.Internals.redirectModelicaFormatMessage()); 49 | annotation (Inline=false, LateInline=true); 50 | end prandtlNumber_Txi; 51 | redeclare replaceable function 52 | extends thermalConductivity_Txi 53 | algorithm 54 | lambda := TILMedia.Internals.LiquidFunctions.thermalConductivity_Txi(T,xi,liquidType.concatLiquidName, liquidType.nc+TILMedia.Internals.redirectModelicaFormatMessage()); 55 | annotation (Inline=false, LateInline=true); 56 | end thermalConductivity_Txi; 57 | redeclare replaceable function 58 | extends dynamicViscosity_Txi 59 | algorithm 60 | eta := TILMedia.Internals.LiquidFunctions.dynamicViscosity_Txi(T,xi,liquidType.concatLiquidName, liquidType.nc+TILMedia.Internals.redirectModelicaFormatMessage()); 61 | annotation (Inline=false, LateInline=true); 62 | end dynamicViscosity_Txi; 63 | 64 | redeclare replaceable function 65 | extends density_hxi 66 | algorithm 67 | d := TILMedia.Internals.LiquidFunctions.density_hxi(h,xi,liquidType.concatLiquidName, liquidType.nc+TILMedia.Internals.redirectModelicaFormatMessage()); 68 | annotation (Inline=false, LateInline=true); 69 | end density_hxi; 70 | redeclare replaceable function 71 | extends temperature_hxi 72 | algorithm 73 | T := TILMedia.Internals.LiquidFunctions.temperature_hxi(h,xi,liquidType.concatLiquidName, liquidType.nc+TILMedia.Internals.redirectModelicaFormatMessage()); 74 | annotation (Inline=false, LateInline=true); 75 | end temperature_hxi; 76 | redeclare replaceable function 77 | extends specificIsobaricHeatCapacity_hxi 78 | algorithm 79 | cp := TILMedia.Internals.LiquidFunctions.specificIsobaricHeatCapacity_hxi(h,xi,liquidType.concatLiquidName, liquidType.nc+TILMedia.Internals.redirectModelicaFormatMessage()); 80 | annotation (Inline=false, LateInline=true); 81 | end specificIsobaricHeatCapacity_hxi; 82 | redeclare replaceable function 83 | extends isobaricThermalExpansionCoefficient_hxi 84 | algorithm 85 | beta := TILMedia.Internals.LiquidFunctions.isobaricThermalExpansionCoefficient_hxi(h,xi,liquidType.concatLiquidName, liquidType.nc+TILMedia.Internals.redirectModelicaFormatMessage()); 86 | annotation (Inline=false, LateInline=true); 87 | end isobaricThermalExpansionCoefficient_hxi; 88 | redeclare replaceable function 89 | extends prandtlNumber_hxi 90 | algorithm 91 | Pr := TILMedia.Internals.LiquidFunctions.prandtlNumber_hxi(h,xi,liquidType.concatLiquidName, liquidType.nc+TILMedia.Internals.redirectModelicaFormatMessage()); 92 | annotation (Inline=false, LateInline=true); 93 | end prandtlNumber_hxi; 94 | redeclare replaceable function 95 | extends thermalConductivity_hxi 96 | algorithm 97 | lambda := TILMedia.Internals.LiquidFunctions.thermalConductivity_hxi(h,xi,liquidType.concatLiquidName, liquidType.nc+TILMedia.Internals.redirectModelicaFormatMessage()); 98 | annotation (Inline=false, LateInline=true); 99 | end thermalConductivity_hxi; 100 | redeclare replaceable function 101 | extends dynamicViscosity_hxi 102 | algorithm 103 | eta := TILMedia.Internals.LiquidFunctions.dynamicViscosity_hxi(h,xi,liquidType.concatLiquidName, liquidType.nc+TILMedia.Internals.redirectModelicaFormatMessage()); 104 | annotation (Inline=false, LateInline=true); 105 | end dynamicViscosity_hxi; 106 | 107 | end LiquidFunctions; 108 | -------------------------------------------------------------------------------- /LiquidTypes/BaseLiquid.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.LiquidTypes; 2 | record BaseLiquid "Base record for liquid definitions" 3 | extends TILMedia.Internals.ClassTypes.Record; 4 | constant Boolean fixedMixingRatio 5 | "Treat medium as pseudo pure in Modelica if it is a mixture" 6 | annotation(Dialog, HideResult = true); 7 | constant Integer nc_propertyCalculation(min=1) 8 | "Number of components for fluid property calculations" 9 | annotation(Dialog, HideResult = true); 10 | final constant Integer nc=if fixedMixingRatio then 1 else nc_propertyCalculation 11 | "Number of components in Modelica models" 12 | annotation(Evaluate=true, HideResult = true); 13 | parameter TILMedia.Internals.LiquidName[:] liquidNames = {""} 14 | "Array of liquid names e.g. {\"liquidName\"} for pure component" 15 | annotation(Dialog, choices); 16 | parameter Real[nc_propertyCalculation] mixingRatio_propertyCalculation = {1} 17 | "Mixing ratio for fluid property calculation (={1} for pure components)" 18 | annotation(Dialog, HideResult = true); 19 | final parameter Real[nc] defaultMixingRatio = if fixedMixingRatio then {1} else mixingRatio_propertyCalculation 20 | "Default composition for models in Modelica (={1} for pure components)" 21 | annotation(HideResult = true); 22 | final parameter Real xi_default[nc-1] = defaultMixingRatio[1:end-1]/sum(defaultMixingRatio) 23 | "Default mass fractions" 24 | annotation(HideResult = true); 25 | final parameter String concatLiquidName=TILMedia.Internals.concatNames(liquidNames) 26 | annotation(Dialog(tab="Internals")); 27 | constant Integer ID=0 28 | "ID is used to map the selected Liquid to the sim.cumulatedLiquidMass array item" annotation(HideResult = true); 29 | annotation (Documentation(info=" 30 |


Every liquid substance model contains a substance record as replaceable parameter extending from this base liquid model. The substance record contains the following parameters:

31 |
    32 |
  • fixedMixingRatio - Boolean = true, if mixing ratio is fixed during simulation.
  • 33 |
  • nc_propertyCalculation - Integer with number of components which are calculated.
  • 34 |
  • \"substanceNames\" - liquidName 1, liquidName 2, and so on. Array which lists the substance names.
  • 35 |
  • mixingRatio_propertyCalculation - Array with the mixing ratio of all substances.
  • 36 |
37 |

Access additional substances:

38 |

To acces the properties of an additional substance, it is possible to create a new substance reccord. For more information on the acces of additional propeties see the substance record documentation.

39 |

Furthermore it is possible to parameterize this liquide base record, using a liquid substance name, listed in the substance names documentation. An example how to parameterize the base liquid model is shown below. However note that this is only a local configuration and therefore only accesible in the corresponding model.

40 |

41 | ")); 42 | end BaseLiquid; 43 | -------------------------------------------------------------------------------- /LiquidTypes/TILMedia_Water.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.LiquidTypes; 2 | record TILMedia_Water "TILMedia.Water" 3 | extends TILMedia.LiquidTypes.BaseLiquid( 4 | final fixedMixingRatio=false, 5 | final nc_propertyCalculation=1, 6 | final liquidNames={"TILMedia.Water"}, 7 | final mixingRatio_propertyCalculation={1}); 8 | end TILMedia_Water; 9 | -------------------------------------------------------------------------------- /LiquidTypes/package.mo: -------------------------------------------------------------------------------- 1 | within TILMedia; 2 | package LiquidTypes "Liquid types, that can be used in TILMedia" 3 | extends TILMedia.Internals.ClassTypes.ModelPackage; 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | annotation(Protection(access=Access.nonPackageDuplicate)); 23 | end LiquidTypes; 24 | -------------------------------------------------------------------------------- /LiquidTypes/package.order: -------------------------------------------------------------------------------- 1 | BaseLiquid 2 | TILMedia_Water 3 | -------------------------------------------------------------------------------- /Liquid_pT.mo: -------------------------------------------------------------------------------- 1 | within TILMedia; 2 | model Liquid_pT 3 | "Incompressible liquid model with p and T as independent variables" 4 | extends TILMedia.BaseClasses.PartialLiquid_pT(liquidPointer= 5 | TILMedia.Internals.TILMediaExternalObject( 6 | "Liquid", 7 | liquidType.concatLiquidName, 8 | computeFlags, 9 | liquidType.mixingRatio_propertyCalculation[1:end - 1]/sum(liquidType.mixingRatio_propertyCalculation), 10 | liquidType.nc, 11 | 0, 12 | getInstanceName())); 13 | protected 14 | constant Real invalidValue=-1; 15 | final parameter Integer computeFlags=TILMedia.Internals.calcComputeFlags( 16 | computeTransportProperties, 17 | false, 18 | true, 19 | false, 20 | false); 21 | 22 | equation 23 | (d,cp,beta) = TILMedia.Internals.LiquidObjectFunctions.properties_Txi( 24 | T, 25 | xi, 26 | liquidPointer); 27 | h = TILMedia.Internals.LiquidObjectFunctions.specificEnthalpy_Txi( 28 | T, 29 | xi, 30 | liquidPointer); 31 | s = TILMedia.Internals.LiquidObjectFunctions.specificEntropy_pTxi( 32 | p, 33 | T, 34 | xi, 35 | liquidPointer); 36 | if computeTransportProperties then 37 | (transp.Pr, 38 | transp.lambda, 39 | transp.eta, 40 | transp.sigma) = 41 | TILMedia.Internals.LiquidObjectFunctions.transportPropertyRecord_Txi( 42 | T, 43 | xi, 44 | liquidPointer); 45 | else 46 | transp = TILMedia.Internals.TransportPropertyRecord( 47 | invalidValue, 48 | invalidValue, 49 | invalidValue, 50 | invalidValue); 51 | end if; 52 | 53 | annotation ( 54 | defaultComponentName="liquid", 55 | Protection(access=Access.packageDuplicate), 56 | Documentation(info=" 57 |

58 | The liquid model is designed for incompressible liquid fluids. 59 | All thermophysical properties are calculated dependent on the temperature (T). 60 | Only the specific entropy (s) is dependent on the temperature (T) and the given pressure (p). 61 | The parameter liquidType defines the medium. 62 | All available liquids are listed in the User's Guide -> Substance Names. 63 | The interface and the way of using, is demonstrated in the Testers -> TestLiquid. 64 |

65 |
66 | ")); 67 | end Liquid_pT; 68 | -------------------------------------------------------------------------------- /Liquid_ph.mo: -------------------------------------------------------------------------------- 1 | within TILMedia; 2 | model Liquid_ph 3 | "Incompressible liquid model with p and h as independent variables" 4 | extends TILMedia.BaseClasses.PartialLiquid_ph(liquidPointer= 5 | TILMedia.Internals.TILMediaExternalObject( 6 | "Liquid", 7 | liquidType.concatLiquidName, 8 | computeFlags, 9 | liquidType.mixingRatio_propertyCalculation[1:end - 1]/sum(liquidType.mixingRatio_propertyCalculation), 10 | liquidType.nc, 11 | 0, 12 | getInstanceName())); 13 | protected 14 | constant Real invalidValue=-1; 15 | final parameter Integer computeFlags=TILMedia.Internals.calcComputeFlags( 16 | computeTransportProperties, 17 | false, 18 | true, 19 | false, 20 | false); 21 | 22 | equation 23 | (d,cp,beta) = TILMedia.Internals.LiquidObjectFunctions.properties_hxi( 24 | h, 25 | xi, 26 | liquidPointer); 27 | T = TILMedia.Internals.LiquidObjectFunctions.temperature_hxi( 28 | h, 29 | xi, 30 | liquidPointer); 31 | s = TILMedia.Internals.LiquidObjectFunctions.specificEntropy_pTxi( 32 | p, 33 | T, 34 | xi, 35 | liquidPointer); 36 | if computeTransportProperties then 37 | (transp.Pr, 38 | transp.lambda, 39 | transp.eta, 40 | transp.sigma) = 41 | TILMedia.Internals.LiquidObjectFunctions.transportPropertyRecord_Txi( 42 | T, 43 | xi, 44 | liquidPointer); 45 | else 46 | transp = TILMedia.Internals.TransportPropertyRecord( 47 | invalidValue, 48 | invalidValue, 49 | invalidValue, 50 | invalidValue); 51 | end if; 52 | 53 | annotation ( 54 | defaultComponentName="liquid", 55 | Protection(access=Access.packageDuplicate), 56 | Documentation(info=" 57 |

58 | The liquid model is designed for incompressible liquid fluids. 59 | All thermophysical properties are calculated dependent on the specific enthalpy (h). 60 | Only the specific entropy (s) is dependent on the specific enthalpy (h) and the given pressure (p). 61 | The parameter liquidType defines the medium. 62 | All available liquids are listed in the User's Guide -> Substance Names. 63 | The interface and the way of using, is demonstrated in the Testers -> TestLiquid. 64 |

65 |
66 | ")); 67 | end Liquid_ph; 68 | -------------------------------------------------------------------------------- /Resources/Images/Base_Gas_Parameter_frame.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClaRaLibrary/TILMedia/d7ba23683b2494b0d2cbe37effe74bc8ed2c42e7/Resources/Images/Base_Gas_Parameter_frame.PNG -------------------------------------------------------------------------------- /Resources/Images/Base_Liquid_Parameter_frame.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClaRaLibrary/TILMedia/d7ba23683b2494b0d2cbe37effe74bc8ed2c42e7/Resources/Images/Base_Liquid_Parameter_frame.PNG -------------------------------------------------------------------------------- /Resources/Images/Base_VLE_Parameter_frame.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClaRaLibrary/TILMedia/d7ba23683b2494b0d2cbe37effe74bc8ed2c42e7/Resources/Images/Base_VLE_Parameter_frame.PNG -------------------------------------------------------------------------------- /Resources/Images/Icon_Gas.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClaRaLibrary/TILMedia/d7ba23683b2494b0d2cbe37effe74bc8ed2c42e7/Resources/Images/Icon_Gas.png -------------------------------------------------------------------------------- /Resources/Images/Icon_Gas_Function.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClaRaLibrary/TILMedia/d7ba23683b2494b0d2cbe37effe74bc8ed2c42e7/Resources/Images/Icon_Gas_Function.png -------------------------------------------------------------------------------- /Resources/Images/Icon_Gas_pT.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClaRaLibrary/TILMedia/d7ba23683b2494b0d2cbe37effe74bc8ed2c42e7/Resources/Images/Icon_Gas_pT.png -------------------------------------------------------------------------------- /Resources/Images/Icon_Gas_ph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClaRaLibrary/TILMedia/d7ba23683b2494b0d2cbe37effe74bc8ed2c42e7/Resources/Images/Icon_Gas_ph.png -------------------------------------------------------------------------------- /Resources/Images/Icon_Gas_ps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClaRaLibrary/TILMedia/d7ba23683b2494b0d2cbe37effe74bc8ed2c42e7/Resources/Images/Icon_Gas_ps.png -------------------------------------------------------------------------------- /Resources/Images/Icon_Liquid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClaRaLibrary/TILMedia/d7ba23683b2494b0d2cbe37effe74bc8ed2c42e7/Resources/Images/Icon_Liquid.png -------------------------------------------------------------------------------- /Resources/Images/Icon_Liquid_Function.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClaRaLibrary/TILMedia/d7ba23683b2494b0d2cbe37effe74bc8ed2c42e7/Resources/Images/Icon_Liquid_Function.png -------------------------------------------------------------------------------- /Resources/Images/Icon_Liquid_pT.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClaRaLibrary/TILMedia/d7ba23683b2494b0d2cbe37effe74bc8ed2c42e7/Resources/Images/Icon_Liquid_pT.png -------------------------------------------------------------------------------- /Resources/Images/Icon_Liquid_ph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClaRaLibrary/TILMedia/d7ba23683b2494b0d2cbe37effe74bc8ed2c42e7/Resources/Images/Icon_Liquid_ph.png -------------------------------------------------------------------------------- /Resources/Images/Icon_Package_Empty.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClaRaLibrary/TILMedia/d7ba23683b2494b0d2cbe37effe74bc8ed2c42e7/Resources/Images/Icon_Package_Empty.png -------------------------------------------------------------------------------- /Resources/Images/Icon_Package_Examples.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClaRaLibrary/TILMedia/d7ba23683b2494b0d2cbe37effe74bc8ed2c42e7/Resources/Images/Icon_Package_Examples.png -------------------------------------------------------------------------------- /Resources/Images/Icon_Package_Gas.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClaRaLibrary/TILMedia/d7ba23683b2494b0d2cbe37effe74bc8ed2c42e7/Resources/Images/Icon_Package_Gas.png -------------------------------------------------------------------------------- /Resources/Images/Icon_Package_HeatExchangers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClaRaLibrary/TILMedia/d7ba23683b2494b0d2cbe37effe74bc8ed2c42e7/Resources/Images/Icon_Package_HeatExchangers.png -------------------------------------------------------------------------------- /Resources/Images/Icon_Package_Internals.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClaRaLibrary/TILMedia/d7ba23683b2494b0d2cbe37effe74bc8ed2c42e7/Resources/Images/Icon_Package_Internals.png -------------------------------------------------------------------------------- /Resources/Images/Icon_Package_Liquid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClaRaLibrary/TILMedia/d7ba23683b2494b0d2cbe37effe74bc8ed2c42e7/Resources/Images/Icon_Package_Liquid.png -------------------------------------------------------------------------------- /Resources/Images/Icon_Package_OtherComponents.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClaRaLibrary/TILMedia/d7ba23683b2494b0d2cbe37effe74bc8ed2c42e7/Resources/Images/Icon_Package_OtherComponents.png -------------------------------------------------------------------------------- /Resources/Images/Icon_Package_VLEFluid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClaRaLibrary/TILMedia/d7ba23683b2494b0d2cbe37effe74bc8ed2c42e7/Resources/Images/Icon_Package_VLEFluid.png -------------------------------------------------------------------------------- /Resources/Images/Icon_Record.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClaRaLibrary/TILMedia/d7ba23683b2494b0d2cbe37effe74bc8ed2c42e7/Resources/Images/Icon_Record.png -------------------------------------------------------------------------------- /Resources/Images/Icon_SLE_Function.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClaRaLibrary/TILMedia/d7ba23683b2494b0d2cbe37effe74bc8ed2c42e7/Resources/Images/Icon_SLE_Function.png -------------------------------------------------------------------------------- /Resources/Images/Icon_SLE_h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClaRaLibrary/TILMedia/d7ba23683b2494b0d2cbe37effe74bc8ed2c42e7/Resources/Images/Icon_SLE_h.png -------------------------------------------------------------------------------- /Resources/Images/Icon_Solid_Function.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClaRaLibrary/TILMedia/d7ba23683b2494b0d2cbe37effe74bc8ed2c42e7/Resources/Images/Icon_Solid_Function.png -------------------------------------------------------------------------------- /Resources/Images/Icon_Solid_T.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClaRaLibrary/TILMedia/d7ba23683b2494b0d2cbe37effe74bc8ed2c42e7/Resources/Images/Icon_Solid_T.png -------------------------------------------------------------------------------- /Resources/Images/Icon_UserGuide.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClaRaLibrary/TILMedia/d7ba23683b2494b0d2cbe37effe74bc8ed2c42e7/Resources/Images/Icon_UserGuide.png -------------------------------------------------------------------------------- /Resources/Images/Icon_VLEFluid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClaRaLibrary/TILMedia/d7ba23683b2494b0d2cbe37effe74bc8ed2c42e7/Resources/Images/Icon_VLEFluid.png -------------------------------------------------------------------------------- /Resources/Images/Icon_VLEFluid_Function.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClaRaLibrary/TILMedia/d7ba23683b2494b0d2cbe37effe74bc8ed2c42e7/Resources/Images/Icon_VLEFluid_Function.png -------------------------------------------------------------------------------- /Resources/Images/Icon_VLEFluid_dT.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClaRaLibrary/TILMedia/d7ba23683b2494b0d2cbe37effe74bc8ed2c42e7/Resources/Images/Icon_VLEFluid_dT.png -------------------------------------------------------------------------------- /Resources/Images/Icon_VLEFluid_pT.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClaRaLibrary/TILMedia/d7ba23683b2494b0d2cbe37effe74bc8ed2c42e7/Resources/Images/Icon_VLEFluid_pT.png -------------------------------------------------------------------------------- /Resources/Images/Icon_VLEFluid_ph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClaRaLibrary/TILMedia/d7ba23683b2494b0d2cbe37effe74bc8ed2c42e7/Resources/Images/Icon_VLEFluid_ph.png -------------------------------------------------------------------------------- /Resources/Images/Icon_VLEFluid_ps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClaRaLibrary/TILMedia/d7ba23683b2494b0d2cbe37effe74bc8ed2c42e7/Resources/Images/Icon_VLEFluid_ps.png -------------------------------------------------------------------------------- /Resources/Images/ModelIcon_Example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClaRaLibrary/TILMedia/d7ba23683b2494b0d2cbe37effe74bc8ed2c42e7/Resources/Images/ModelIcon_Example.png -------------------------------------------------------------------------------- /Resources/Images/TILMedia.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClaRaLibrary/TILMedia/d7ba23683b2494b0d2cbe37effe74bc8ed2c42e7/Resources/Images/TILMedia.png -------------------------------------------------------------------------------- /Resources/Images/infoTILMedia.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClaRaLibrary/TILMedia/d7ba23683b2494b0d2cbe37effe74bc8ed2c42e7/Resources/Images/infoTILMedia.png -------------------------------------------------------------------------------- /Resources/Library/linux32/libTILMedia180ClaRa.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClaRaLibrary/TILMedia/d7ba23683b2494b0d2cbe37effe74bc8ed2c42e7/Resources/Library/linux32/libTILMedia180ClaRa.so -------------------------------------------------------------------------------- /Resources/Library/linux64/libTILMedia180ClaRa.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClaRaLibrary/TILMedia/d7ba23683b2494b0d2cbe37effe74bc8ed2c42e7/Resources/Library/linux64/libTILMedia180ClaRa.so -------------------------------------------------------------------------------- /Resources/Library/win32/TILMedia180ClaRa.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClaRaLibrary/TILMedia/d7ba23683b2494b0d2cbe37effe74bc8ed2c42e7/Resources/Library/win32/TILMedia180ClaRa.dll -------------------------------------------------------------------------------- /Resources/Library/win32/TILMedia180ClaRa.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClaRaLibrary/TILMedia/d7ba23683b2494b0d2cbe37effe74bc8ed2c42e7/Resources/Library/win32/TILMedia180ClaRa.lib -------------------------------------------------------------------------------- /Resources/Library/win32/libTILMedia180ClaRa.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClaRaLibrary/TILMedia/d7ba23683b2494b0d2cbe37effe74bc8ed2c42e7/Resources/Library/win32/libTILMedia180ClaRa.a -------------------------------------------------------------------------------- /Resources/Library/win64/TILMedia180ClaRa.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClaRaLibrary/TILMedia/d7ba23683b2494b0d2cbe37effe74bc8ed2c42e7/Resources/Library/win64/TILMedia180ClaRa.dll -------------------------------------------------------------------------------- /Resources/Library/win64/TILMedia180ClaRa.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClaRaLibrary/TILMedia/d7ba23683b2494b0d2cbe37effe74bc8ed2c42e7/Resources/Library/win64/TILMedia180ClaRa.lib -------------------------------------------------------------------------------- /Resources/Library/win64/libTILMedia180ClaRa.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClaRaLibrary/TILMedia/d7ba23683b2494b0d2cbe37effe74bc8ed2c42e7/Resources/Library/win64/libTILMedia180ClaRa.a -------------------------------------------------------------------------------- /Resources/Release Notes TILMedia.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClaRaLibrary/TILMedia/d7ba23683b2494b0d2cbe37effe74bc8ed2c42e7/Resources/Release Notes TILMedia.pdf -------------------------------------------------------------------------------- /Resources/TILMediaDataPath/WATER.DAT: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClaRaLibrary/TILMedia/d7ba23683b2494b0d2cbe37effe74bc8ed2c42e7/Resources/TILMediaDataPath/WATER.DAT -------------------------------------------------------------------------------- /Resources/TILMediaDataPath/WATER_SPLINE.DAT: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClaRaLibrary/TILMedia/d7ba23683b2494b0d2cbe37effe74bc8ed2c42e7/Resources/TILMediaDataPath/WATER_SPLINE.DAT -------------------------------------------------------------------------------- /SLEMediumTypes/BaseSLEMedium.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.SLEMediumTypes; 2 | partial model BaseSLEMedium "Base model for solid definitions" 3 | extends TILMedia.Internals.ClassTypes.Record; 4 | input SI.Temperature T "Temperature"; 5 | parameter SI.Temperature T_s "Melting temperature"; 6 | parameter SI.Temperature T_l "Freezing temperature"; 7 | SI.Density d_s "Density of solid phase"; 8 | SI.Density d_l "Density of liquid phase"; 9 | parameter SI.SpecificHeatCapacity cp_s "Specific heat capacity cp of solid phase"; 10 | parameter SI.SpecificHeatCapacity cp_l "Specific heat capacity cp of liquid phase"; 11 | SI.ThermalConductivity lambda_l "Thermal conductivity of liquid phase"; 12 | SI.ThermalConductivity lambda_s "Thermal conductivity of solid phase"; 13 | SI.SpecificEnthalpy h_fusion; 14 | constant SI.Temperature TStableLimit = Modelica.Constants.inf 15 | "Above this temperature all cristals in the solution are dissolved. Metastable states are possible after exceeding this temperature."; 16 | constant SI.Temperature TSupercoolingLimit(min=-Modelica.Constants.inf) = -Modelica.Constants.inf 17 | "There is no metastable state below this temperature. Crystallization starts when this temperature is reached."; 18 | end BaseSLEMedium; 19 | -------------------------------------------------------------------------------- /SLEMediumTypes/TILMedia_AdBlue.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.SLEMediumTypes; 2 | model TILMedia_AdBlue "TILMedia.AdBlue" 3 | extends TILMedia.SLEMediumTypes.BaseSLEMedium( 4 | cp_l = 3434.5, 5 | cp_s = 1600, 6 | T_s = 262.15, 7 | T_l = 262.15); 8 | equation 9 | d_l = 1000*(-1.62819E-06*(T-273.15)^2 -0.000428345*(T-273.15) + 1.10001); 10 | d_s = 1030; 11 | lambda_l = 0.57; 12 | lambda_s = 0.75; 13 | h_fusion = 270e3; 14 | end TILMedia_AdBlue; 15 | -------------------------------------------------------------------------------- /SLEMediumTypes/TILMedia_AluminumSLE.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.SLEMediumTypes; 2 | model TILMedia_AluminumSLE "TILMedia.AluminumSLE" 3 | extends TILMedia.SLEMediumTypes.BaseSLEMedium( 4 | cp_l = 1180, 5 | cp_s = 940, 6 | T_s = 932.15, 7 | T_l = 932.15); 8 | equation 9 | d_l = 2391; 10 | d_s = 2700; 11 | lambda_l = 90; 12 | lambda_s = 204; 13 | h_fusion = 356e3; 14 | end TILMedia_AluminumSLE; 15 | -------------------------------------------------------------------------------- /SLEMediumTypes/TILMedia_CopperSLE.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.SLEMediumTypes; 2 | model TILMedia_CopperSLE "TILMedia.CopperSLE" 3 | extends TILMedia.SLEMediumTypes.BaseSLEMedium( 4 | cp_l = 490, 5 | cp_s = 390, 6 | T_s = 1356.15, 7 | T_l = 1356.15); 8 | equation 9 | d_l = 7998; 10 | d_s = 8960; 11 | lambda_l = 157; 12 | lambda_s = 298; 13 | h_fusion = 213e3; 14 | end TILMedia_CopperSLE; 15 | -------------------------------------------------------------------------------- /SLEMediumTypes/TILMedia_SimpleAdBlue.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.SLEMediumTypes; 2 | model TILMedia_SimpleAdBlue "TILMedia.SimpleAdBlue" 3 | extends TILMedia.SLEMediumTypes.BaseSLEMedium( 4 | cp_l = 3400, 5 | cp_s = 1600, 6 | T_s = 262.15, 7 | T_l = 262.15); 8 | equation 9 | d_l = 1090; 10 | d_s = 1030; 11 | lambda_l = 0.57; 12 | lambda_s = 0.75; 13 | h_fusion = 270e3; 14 | end TILMedia_SimpleAdBlue; 15 | -------------------------------------------------------------------------------- /SLEMediumTypes/TILMedia_SimpleWater.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.SLEMediumTypes; 2 | model TILMedia_SimpleWater "TILMedia.SimpleWater" 3 | extends TILMedia.SLEMediumTypes.BaseSLEMedium( 4 | cp_l = 4.218e3, 5 | cp_s = 2.1e3, 6 | T_s = 273.15, 7 | T_l = 273.15); 8 | // cp_l at 273.15 K 9 | // cp_v at 271.15 K 10 | equation 11 | d_l = 999.84; // at 273.15 K 12 | d_s = 916.7583; // at 273.15 K 13 | lambda_l = 561e-3; 14 | lambda_s = 2.2; 15 | h_fusion = 332.5e3; 16 | end TILMedia_SimpleWater; 17 | -------------------------------------------------------------------------------- /SLEMediumTypes/TILMedia_SodiumAcetate.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.SLEMediumTypes; 2 | model TILMedia_SodiumAcetate "TILMedia.SodiumAcetate (Trihydrate)" 3 | extends TILMedia.SLEMediumTypes.BaseSLEMedium( 4 | cp_l = 3100, 5 | cp_s = 2050, 6 | T_s = 331.15, 7 | T_l = 331.15, 8 | TStableLimit = 350, 9 | TSupercoolingLimit = 273.15-22); 10 | 11 | // Literature references: 12 | // TStableLimit 13 | // Araki, Futamura, Makino, Shibata: 14 | // "Measurements of Thermophysical Properties of Sodium Acetate Hydrate" 15 | // 1995 16 | // TSupercoolingLimit: 17 | // LinLin WEI, Kenichi OHSASA: 18 | // "Supercooling and Solidification Behavior of Phase Change Material" 19 | // 2010 20 | equation 21 | d_l = 1280; 22 | d_s = 1450; 23 | lambda_l = 0.4; 24 | lambda_s = 0.64; 25 | h_fusion = 260e3; 26 | end TILMedia_SodiumAcetate; 27 | -------------------------------------------------------------------------------- /SLEMediumTypes/package.mo: -------------------------------------------------------------------------------- 1 | within TILMedia; 2 | package SLEMediumTypes "SLE Medium types that can be used in TILMedia" 3 | extends TILMedia.Internals.ClassTypes.ModelPackage; 4 | 5 | annotation(Protection(access=Access.nonPackageDuplicate)); 6 | end SLEMediumTypes; 7 | -------------------------------------------------------------------------------- /SLEMediumTypes/package.order: -------------------------------------------------------------------------------- 1 | BaseSLEMedium 2 | TILMedia_SimpleAdBlue 3 | TILMedia_AdBlue 4 | TILMedia_SimpleWater 5 | TILMedia_SodiumAcetate 6 | TILMedia_AluminumSLE 7 | TILMedia_CopperSLE 8 | -------------------------------------------------------------------------------- /Scripts/libraryicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClaRaLibrary/TILMedia/d7ba23683b2494b0d2cbe37effe74bc8ed2c42e7/Scripts/libraryicon.png -------------------------------------------------------------------------------- /Scripts/libraryinfo.mos: -------------------------------------------------------------------------------- 1 | LibraryInfoMenuSeparator( 2 | category="libraries", 3 | pos=160); 4 | 5 | LibraryInfoMenuCommand( 6 | category = "libraries", 7 | text = "TILMedia 1.8.0 ClaRa", 8 | reference = "TILMedia", 9 | version = "1.8.0 ClaRa", 10 | isModel = true, 11 | description = "Medium properties for gases, liquids, VLEFluids, SLEMediums and solids", 12 | ModelicaVersion = "4.0.0", 13 | pos = 161); 14 | -------------------------------------------------------------------------------- /SolidTypes/BaseSolid.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.SolidTypes; 2 | partial model BaseSolid "Base model for solid definitions" 3 | constant SI.SpecificHeatCapacity cp_nominal "Specific heat capacity at standard reference point"; 4 | constant SI.ThermalConductivity lambda_nominal "Thermal conductivity at standard reference point"; 5 | constant Real nu_nominal "Poisson's ratio at standard reference point"; 6 | constant ClaRa.Basics.Units.ElasticityModule E_nominal "Elasticity module of steel at standard reference point"; 7 | constant ClaRa.Basics.Units.HeatExpansionRateLinear beta_nominal "Linear heat expansion coefficient at standard reference point"; 8 | constant SI.ShearModulus G_nominal "Shear modulus at standard reference point"; 9 | constant SI.Density d "Density"; 10 | 11 | input SI.Temperature T "Temperature"; 12 | SI.SpecificHeatCapacity cp "Heat capacity"; 13 | SI.ThermalConductivity lambda "Thermal conductivity"; 14 | Real nu "Poisson's ratio"; 15 | ClaRa.Basics.Units.ElasticityModule E "Elasticity module of steel"; 16 | ClaRa.Basics.Units.HeatExpansionRateLinear beta 17 | "Linear heat expansion coefficient"; 18 | ClaRa.Basics.Units.ShearModulus G "Shear modulus"; 19 | 20 | end BaseSolid; 21 | -------------------------------------------------------------------------------- /SolidTypes/TILMedia_Aluminum.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.SolidTypes; 2 | model TILMedia_Aluminum "TILMedia.Aluminum" 3 | extends TILMedia.SolidTypes.BaseSolid( 4 | final d = 2700.0, 5 | final cp_nominal = 920.0, 6 | final lambda_nominal = 215.0, 7 | final nu_nominal=-1, 8 | final E_nominal=-1, 9 | final G_nominal=-1, 10 | final beta_nominal=-1); 11 | equation 12 | cp=cp_nominal; 13 | lambda=lambda_nominal; 14 | nu = nu_nominal; 15 | E = E_nominal; 16 | G = G_nominal; 17 | beta = beta_nominal; 18 | end TILMedia_Aluminum; 19 | -------------------------------------------------------------------------------- /SolidTypes/TILMedia_Copper.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.SolidTypes; 2 | model TILMedia_Copper "TILMedia.Copper" 3 | extends TILMedia.SolidTypes.BaseSolid( 4 | final d = 8960.0, 5 | final cp_nominal = 380.0, 6 | final lambda_nominal = 298.0, 7 | final nu_nominal=-1, 8 | final E_nominal=-1, 9 | final G_nominal=-1, 10 | final beta_nominal=-1); 11 | equation 12 | cp=cp_nominal; 13 | lambda=lambda_nominal; 14 | nu = nu_nominal; 15 | E = E_nominal; 16 | G=G_nominal; 17 | beta = beta_nominal; 18 | end TILMedia_Copper; 19 | -------------------------------------------------------------------------------- /SolidTypes/TILMedia_St35_8.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.SolidTypes; 2 | model TILMedia_St35_8 "TILMedia.St35.8" 3 | extends TILMedia.SolidTypes.BaseSolid( 4 | final d = 7850.0, 5 | final cp_nominal = 430.0, 6 | final lambda_nominal = 57.0, 7 | final nu_nominal=-1, 8 | final E_nominal=-1, 9 | final G_nominal=-1, 10 | final beta_nominal=-1); 11 | 12 | 13 | function specificHeatCapacity 14 | input Real T; 15 | output Real cp; 16 | protected 17 | Real fi; 18 | Integer li; 19 | constant Integer n=7; 20 | final constant Real[7] TBar={293.15, 373.15, 473.15, 573.15, 673.15, 773.15, 873.15}; 21 | final constant Real[7] cpBar={430, 500, 540, 580, 620, 690, 780}; 22 | Real beta; 23 | algorithm 24 | if (TBar[1]>=T) then 25 | cp:=cpBar[1]; 26 | elseif (TBar[n]<=T) then 27 | cp:=cpBar[n]; 28 | else 29 | li:=1; 30 | while (li <= n and TBar[li]=T) then 53 | lambda:=lambdaBar[1]; 54 | elseif (TBar[n]<=T) then 55 | lambda:=lambdaBar[n]; 56 | else 57 | li:=1; 58 | while (li <= n and TBar[li] 1 10 | 11 | SI.Pressure p; 12 | SI.Temperature T; 13 | 14 | // Instance of the gas object Gas_pT that requires the pressure p and the temperature T as inputs. 15 | TILMedia.Gas_pT gas1(p=p, T=T, 16 | redeclare GasTypes.FlueGasTILMedia gasType) 17 | annotation (Placement(transformation(extent={{-20,20},{0,40}}, 18 | rotation=0))); 19 | 20 | // Instance of the gas object Gas_ps that requires the pressure p and the specific entropy s as inputs. 21 | TILMedia.Gas_ps gas2(p=p, s=gas1.s, 22 | redeclare GasTypes.FlueGasTILMedia gasType) 23 | annotation (Placement(transformation(extent={{-20,-20},{0,0}}))); 24 | 25 | // Instance of a gas object Gas_ph that requires the pressure p and the specific enthalpy h as inputs. 26 | TILMedia.Gas_ph gas3(p=p, h=gas1.h, 27 | redeclare GasTypes.FlueGasTILMedia gasType) 28 | annotation (Placement(transformation(extent={{-20,-60},{0,-40}}))); 29 | 30 | equation 31 | p = 1e5; 32 | T = 274 + 50*time; 33 | 34 | annotation (experiment(StopTime=1)); 35 | end TestGas; 36 | -------------------------------------------------------------------------------- /Testers/TestGas_mixture.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.Testers; 2 | model TestGas_mixture 3 | extends TILMedia.Internals.ClassTypes.ExampleModel; 4 | 5 | // This tester demonstrates the calculation of therodynamic properties of gas mixtures 6 | // using the gas objects Gas_ph, Gas_ps and Gas_pT. 7 | // Two examples are given, one for the predefined gasType VDIWA_MoistAir_nc3 which is composed of 3 components (see definition in TILMedia.GasTypes.VDIWA_MoistAir_nc3). 8 | // and annother for a custom mixture defined by the record MyGasMixture 9 | 10 | SI.Pressure p; 11 | SI.Temperature T; 12 | // In the gasType VDIWA_MoistAir_nc3 there are 3 components (nc=3) -> size of xi is nc-1 -> xi[2] 13 | SI.MassFraction xi[gas_pT.gasType.nc-1]; 14 | 15 | // Instance of the gas object Gas_pT that requires the pressure p, the temperature T and the mass fractions xi[i] as inputs. 16 | // The gasType is VDIWA_MoistAir_nc3 17 | TILMedia.Gas_pT 18 | gas_pT(p=p, T=T, xi=xi, 19 | redeclare GasTypes.FlueGasTILMedia gasType) 20 | annotation (Placement(transformation(extent={{-20,0}, 21 | {0,20}}))); 22 | // Instance of the gas object Gas_ph that requires the pressure p, the specific enthalpy and the mass fractions xi[i] as inputs. 23 | // The gasType is VDIWA_MoistAir_nc3 24 | TILMedia.Gas_ph 25 | gas_ph(p=p, h=gas_pT.h, xi=xi, 26 | redeclare GasTypes.FlueGasTILMedia gasType) 27 | annotation (Placement(transformation(extent={{0,0},{ 28 | 20,20}}))); 29 | 30 | // // Custom definition of an ideal gas mixture that consists of Argon, Nitrogen, Oxygen and Helium 31 | // // Note, that the condensingIndex is set to 0, i.e. there is no condensation allowed. 32 | // // In contrast, in e.g. TILMedia.GasTypes.TILMedia_MoistAir the condensingIndex is set to 1, 33 | // // i.e. the first component (water) of TILMedia_MoistAir can condensate 34 | // record MyGasMixture = TILMedia.GasTypes.BaseGas ( 35 | // final fixedMixingRatio=false, 36 | // final nc_propertyCalculation=4, 37 | // final gasNames={"VDIWA2006.Argon","VDIWA2006.Nitrogen","VDIWA2006.Oxygen","VDIWA2006.Helium"}, 38 | // final condensingIndex=0, 39 | // final mixingRatio_propertyCalculation={0.001,0.7,0.3,0.001}); 40 | // 41 | // // Instance of the gas object Gas_pT that requires the pressure p, the temperature T and the mass fractions xi[i] as inputs. 42 | // // The gasType is MyGasMixture 43 | // TILMedia.Gas_pT myGas( p=p, T=T, xi={0.02,0.6,0.3}, redeclare MyGasMixture gasType) 44 | // annotation (Placement(transformation(extent={{-18,-40}, 45 | // {2,-20}}))); 46 | equation 47 | p = 1e5; 48 | T=300+50*time; 49 | 50 | // Calculate the mass fractions xi[i] from the defaultMixingRatio of VDIWA_MoistAir_nc3 (see definition in TILMedia.GasTypes.VDIWA_MoistAir_nc3) 51 | xi=gas_pT.gasType.defaultMixingRatio[1:end-1]/sum(gas_pT.gasType.defaultMixingRatio); 52 | 53 | annotation (experiment(StopTime=1)); 54 | end TestGas_mixture; 55 | -------------------------------------------------------------------------------- /Testers/TestGas_moistAir.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.Testers; 2 | model TestGas_moistAir 3 | extends TILMedia.Internals.ClassTypes.ExampleModel; 4 | 5 | SI.Pressure p; 6 | SI.SpecificEnthalpy h; 7 | 8 | Real xi1[moistAir1.gasType.nc - 1]; 9 | // Instance of a gas object that requires the pressure p and the specific enthalpy as inputs. 10 | Gas_ph moistAir1( 11 | p=p, 12 | h=h, 13 | xi=xi1, 14 | redeclare GasTypes.MoistAirMixture gasType) 15 | annotation (Placement(transformation(extent={{-20,60},{0,80}}, 16 | rotation=0))); 17 | 18 | Real xi2[moistAir2.gasType.nc - 1]; 19 | // Instance of a gas object that requires the pressure p and the temperature T as inputs. 20 | Gas_pT moistAir2( 21 | p=p, 22 | T=moistAir1.T, 23 | xi=xi2, 24 | redeclare GasTypes.MoistAirMixture gasType) 25 | annotation (Placement(transformation(extent={{-20,20},{0,40}}, 26 | rotation=0))); 27 | equation 28 | p = 1e5; 29 | h = 1e4+time*2e4; 30 | xi1 = moistAir1.gasType.xi_default; 31 | 32 | moistAir2.xi_dryGas=moistAir1.xi_dryGas; 33 | moistAir2.phi = 90; 34 | 35 | annotation (experiment(StopTime=1)); 36 | end TestGas_moistAir; 37 | -------------------------------------------------------------------------------- /Testers/TestLiquid.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.Testers; 2 | model TestLiquid 3 | extends TILMedia.Internals.ClassTypes.ExampleModel; 4 | 5 | // This tester demonstrates the calculation of thermodynamic properties of water 6 | // using the liquid objects Liquid_pT and Liquid_ph 7 | 8 | SI.Pressure p; 9 | SI.Temperature T; 10 | 11 | // Instance of a liquid object that requires the pressure p and the temperature T as inputs. 12 | TILMedia.Liquid_pT liquid1( 13 | p=p, 14 | T=T, 15 | redeclare TILMedia.LiquidTypes.TILMedia_Water liquidType) 16 | annotation (Placement(transformation(extent={{-20,20},{0,40}}, 17 | rotation=0))); 18 | // Instance of a liquid object that requires the pressure p and the specific enthalpy h as inputs. 19 | TILMedia.Liquid_ph liquid2( 20 | p=p, 21 | h=liquid1.h, 22 | redeclare TILMedia.LiquidTypes.TILMedia_Water liquidType) 23 | annotation (Placement(transformation(extent={{-20,-20}, 24 | {0,0}}, 25 | rotation=0))); 26 | 27 | equation 28 | p = 1e5; 29 | T = 300 + 50*time; 30 | 31 | annotation (experiment(StopTime=1)); 32 | end TestLiquid; 33 | -------------------------------------------------------------------------------- /Testers/TestSLEMedium.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.Testers; 2 | model TestSLEMedium 3 | extends TILMedia.Internals.ClassTypes.ExampleModel; 4 | 5 | SI.SpecificEnthalpy h; 6 | SI.AbsolutePressure p; 7 | SI.SpecificEnthalpy hInitial = sleSodiumAcetate.specificEnthalpy_T(373,0); 8 | 9 | SLEMedium sleSodiumAcetate( 10 | p=p, h=h, iota=0, 11 | redeclare model SLEMediumType = SLEMediumTypes.TILMedia_SodiumAcetate) 12 | annotation (Placement(transformation(extent={{-20,40},{0,60}},rotation=0))); 13 | 14 | SLEMedium sleSodiumAcetateSupercooling( 15 | p=p, h=h,iota=1, 16 | redeclare model SLEMediumType = SLEMediumTypes.TILMedia_SodiumAcetate) 17 | annotation (Placement(transformation(extent={{-20,0},{0,20}},rotation=0))); 18 | 19 | SLEMedium sleSodiumAcetateNormalSupercooling( 20 | p=p, h=h, 21 | iota=min(1, max(0, (50 - time)*0.1)), 22 | redeclare model SLEMediumType = SLEMediumTypes.TILMedia_SodiumAcetate) 23 | annotation (Placement(transformation(extent={{-20,-40},{0,-20}},rotation=0))); 24 | Boolean supercooledPhaseIsUnstable; 25 | equation 26 | h = hInitial - 5e3*time; 27 | p = 1e5; 28 | if (sleSodiumAcetateSupercooling.T>sleSodiumAcetateSupercooling.TSupercoolingLimit) then 29 | supercooledPhaseIsUnstable = true; 30 | else 31 | supercooledPhaseIsUnstable = false; 32 | end if; 33 | 34 | annotation (experiment(StopTime=100)); 35 | end TestSLEMedium; 36 | -------------------------------------------------------------------------------- /Testers/TestSolid.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.Testers; 2 | model TestSolid 3 | extends TILMedia.Internals.ClassTypes.ExampleModel; 4 | 5 | // This tester demonstrates the calclation of thermodynamic properties of carbon steel (St35.8) 6 | 7 | SI.Temperature T; 8 | 9 | //Instance of a Solid object that requires the Temperature T as input 10 | Solid solid(T=T, redeclare model SolidType = 11 | TILMedia.SolidTypes.TILMedia_St35_8) 12 | annotation (Placement(transformation(extent={{-20,0},{0,20}}, 13 | rotation=0))); 14 | 15 | equation 16 | T = 273.15 + 1000*time; 17 | 18 | annotation (experiment(StopTime=1)); 19 | end TestSolid; 20 | -------------------------------------------------------------------------------- /Testers/TestVLEFluid.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.Testers; 2 | model TestVLEFluid 3 | extends TILMedia.Internals.ClassTypes.ExampleModel; 4 | 5 | // This tester demonstrates the calculation of thermodynamic properties of CO2 6 | // using the VLEFluid objects VLEFluid_ph, VLEFluid_pT, VLEFluid_ps and VLEFluid_dT 7 | 8 | SI.Density d; 9 | SI.SpecificEnthalpy h; 10 | SI.Pressure p; 11 | SI.SpecificEntropy s; 12 | SI.Temperature T; 13 | 14 | //Instance of a VLEFluid object that requires the pressure p and the specific enthalpy h as inputs 15 | VLEFluid_ph vleFluid1( 16 | p=p, 17 | h=h, 18 | computeVLEAdditionalProperties=false, 19 | computeVLETransportProperties=false, 20 | computeTransportProperties=false, 21 | redeclare VLEFluidTypes.TILMedia_GERGCO2 vleFluidType) 22 | annotation (Placement(transformation(extent={{-10,20},{10,40}}))); 23 | // Instance of a VLEFluid object that requires the pressure p and the temperature T as inputs. 24 | // Note: the input T is calculated from vleFluid1, i.e. T = vleFluid1.T (see equation below). 25 | // Since the pressure p is the same for vleFluid2 and vleFluid1, the calculation of the thermodynamic properties 26 | // from vleFluid2 and vleFluid2 yields the same results. 27 | VLEFluid_pT vleFluid2( 28 | p=p, 29 | T=T, 30 | computeVLEAdditionalProperties=false, 31 | computeVLETransportProperties=false, 32 | computeTransportProperties=false, 33 | redeclare VLEFluidTypes.TILMedia_GERGCO2 vleFluidType) 34 | annotation (Placement(transformation(extent={{-10,0},{10,20}}))); 35 | //Instance of a VLEFluid object that requires the pressure p and the specific entropy s as inputs 36 | // Note: the input s is calculated from vleFluid1, i.e. s = vleFluid1.s (see equation below). 37 | VLEFluid_ps vleFluid3( 38 | p=p, 39 | s=s, 40 | computeVLEAdditionalProperties=false, 41 | computeVLETransportProperties=false, 42 | computeTransportProperties=false, 43 | redeclare VLEFluidTypes.TILMedia_GERGCO2 vleFluidType) 44 | annotation (Placement(transformation(extent={{-10,-20},{10,0}}))); 45 | //Instance of a VLEFluid object that requires the density d and the temperature T as inputs 46 | // Note: the input d is calculated from vleFluid1, i.e. d = vleFluid1.d (see equation below). 47 | VLEFluid_dT vleFluid4( 48 | d=d, 49 | T=T, 50 | computeVLEAdditionalProperties=false, 51 | computeVLETransportProperties=false, 52 | computeTransportProperties=false, 53 | redeclare VLEFluidTypes.TILMedia_GERGCO2 vleFluidType) 54 | annotation (Placement(transformation(extent={{-10,-40},{10,-20}}))); 55 | 56 | equation 57 | p=100e5+11e5*time; 58 | h=200e3+300e3*time; 59 | 60 | T=vleFluid1.T; 61 | s=vleFluid1.s; 62 | d=vleFluid1.d; 63 | 64 | annotation (experiment(StopTime=1)); 65 | end TestVLEFluid; 66 | -------------------------------------------------------------------------------- /Testers/TestVLEFluidObjectFunctions.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.Testers; 2 | model TestVLEFluidObjectFunctions 3 | extends TILMedia.Internals.ClassTypes.ExampleModel; 4 | 5 | // This tester demonstrates the usage of the VLEFluidFunctions the VLEFluid class and the VLEFluidObjectFunctions 6 | // The VLEFluidFunctions uses external c-functions and should only be used for the calculation of start and initial values 7 | // The VLEFluid class and VLEFluidObjectFunctions uses external c-classes and 8 | // are optimized for the continuous calculation of the thermodynamic properties 9 | 10 | SI.Pressure p; 11 | SI.SpecificEnthalpy h(start = h_start, fixed=true); 12 | SI.Density d; 13 | SI.Velocity w; 14 | SI.Temperature T; 15 | SI.Temperature T1; 16 | SI.Velocity w2; 17 | 18 | SI.MassFraction xi[vleFluidType.nc-1]; 19 | 20 | // Record which defines the VLEFluid (see User's Guide -> Substance Record) 21 | parameter TILMedia.VLEFluidTypes.TILMedia_GERGCO2 vleFluidType; 22 | 23 | // Start values for the the temperature 24 | parameter SI.Temperature T_start = 273.15+20; 25 | parameter SI.Pressure p_start = 4e6; 26 | 27 | // A start value for the enthalpy can be calculated 28 | // either by using VLEFluidFuctions.specificEnthalpy_pTxi: 29 | parameter Real h_start = TILMedia.VLEFluidFunctions.specificEnthalpy_pTxi(vleFluidType, p_start, T_start); 30 | // or by using the vleFluid instance: 31 | parameter Real T_startValue = vleFluid.T_phxi(13e5, 300e3, zeros(0)); 32 | // xi does not exist for a pure substance like CO2, because the array of mass fractions has the size nc-1. 33 | // Therefore xi is set to zeros(0). 34 | 35 | // Instance of a VLEFluid object that requires the vleFluidType as input. 36 | VLEFluid vleFluid(vleFluidType=vleFluidType) 37 | annotation (Placement(transformation(extent={{-10,-12},{10,8}}))); 38 | 39 | VLEFluid vleFluid2(vleFluidType=vleFluidType) 40 | annotation (Placement(transformation(extent={{20,-12},{40,8}}))); 41 | equation 42 | p = 4e6; 43 | der(h) = -h/(1+time); 44 | 45 | // Continuous calculation of the density d and the temperature T in dependence of the pressure p and the specific enthalpy h 46 | // The vleFluid instance is using an external object with the pointer vleFluid.vleFluidPointer. 47 | // One vleFluid instance or vleFluidPointer should only be used for one continuously changing thermodynamic state, to improve the caching performance. 48 | // Due the caching of previous calculated results, these objects are very efficient in the continuous calculation of the property data. 49 | d = vleFluid.d_phxi(p, h, xi); 50 | T = vleFluid.T_phxi(p, h, xi); 51 | 52 | // The continuous calculation of the speed of sound w and the temperature T1 can also be done with VLEFluidObjectFunctions. 53 | // These functions refer to an external object with the pointer vleFluid.vleFluidPointer. 54 | w = TILMedia.VLEFluidObjectFunctions.speedOfSound_dTxi(d, T, xi, vleFluid.vleFluidPointer); 55 | T1 = TILMedia.VLEFluidObjectFunctions.temperature_phxi(p, h, xi, vleFluid.vleFluidPointer); 56 | // T1 = T 57 | // The speed of sound w2 differs to the state point and calculations before. 58 | // Therefore is a new pointer needed. 59 | w2 = TILMedia.VLEFluidObjectFunctions.speedOfSound_phxi(30e5, h_start, xi, vleFluid2.vleFluidPointer); 60 | 61 | // Equivalent calculations are possible for Gas and Liquid. 62 | 63 | annotation (experiment(StopTime=2)); 64 | end TestVLEFluidObjectFunctions; 65 | -------------------------------------------------------------------------------- /Testers/package.mo: -------------------------------------------------------------------------------- 1 | within TILMedia; 2 | package Testers "Testers for different parts of TILMedia" 3 | extends TILMedia.Internals.ClassTypes.ExamplePackage; 4 | 5 | 6 | annotation(Protection(access=Access.nonPackageDuplicate)); 7 | end Testers; 8 | -------------------------------------------------------------------------------- /Testers/package.order: -------------------------------------------------------------------------------- 1 | TestGas 2 | TestGas_mixture 3 | TestLiquid 4 | TestGas_moistAir 5 | TestVLEFluid 6 | TestSLEMedium 7 | TestSolid 8 | TestVLEFluidObjectFunctions 9 | -------------------------------------------------------------------------------- /UsersGuide/PropertyCalculation.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.UsersGuide; 2 | class PropertyCalculation "Property Calculation" 3 | extends TILMedia.Internals.ClassTypes.Information; 4 | annotation(DocumentationClass=true, 5 | Documentation(info="

6 | 7 | 8 | The calculation of thermo-physical properties with the TILMedia Modelica interface is divided in five groups: 9 |
10 |

    11 |
  • Gas - Ideal gases and mixtures with one component that can condense - gas vapor
  • 12 |
  • Liquid - Incompressible single phase fluids and mixtures
  • 13 |
  • VLEFluid - Real fluid or fluid mixture, which can be liquid, vaporous, super-critical or may have a vapor-liquid equilibrium (VLE)
  • 14 |
  • Solid - Single phase solids
  • 15 |
  • SLEMedium - can be solid, liquid or may have a solid-liquid equilibrium (SLE)
  • 16 |
17 |
18 | There are different options to calculate thermo-physical properties: 19 |
20 |
    21 |
  • object-oriented [recommended] - An external object is created and all properties are calculated at once (e.g. TestGas, TestLiquid, TestVLEFluid).
  • 22 |
  • function based [for single evaluations only] - Only one property is calculated. Useful for parameter expressions such as start values. For efficient calculation of time-varying variable use objects or object functions.
  • 23 |
  • objects with functions [for conditional/additional properties] - The classes without inputs (Gas, Liquid and VLEFluid) can be used to calculate conditional or additional properties efficiently.
  • 24 |
  • object functions [for additional properties] - Using the pointer to an existing external object additional properties can be computed efficiently.
  • 25 |
26 |
27 | The use of functions, objects with functions and object functions is shown in the example: TestVLEFluidObjectFunctions. 28 | Equivalent to the shown VLEFluid calculations are the use of Gas, Liquid and corresponding functions are possible. 29 |
30 | The object-oriented calculation is recommended. 31 | The Fluid properties are calculated with independent variables that are declared as input. 32 | Depending on which variables are known, different classes are available with a corresponding ending: 33 |
34 |
    35 |
  • _ph pressure and enthalpy
  • 36 |
  • _ps pressure and entropy
  • 37 |
  • _pT pressure and temperature
  • 38 |
  • _dT density and temperature
  • 39 |
40 |
41 | The mass fraction vector is needed additionally, if the fluid is a mixture. 42 | For more information see the models itself and the testers. 43 |
44 |
45 | ")); 46 | end PropertyCalculation; 47 | -------------------------------------------------------------------------------- /UsersGuide/ReleaseNotes.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.UsersGuide; 2 | class ReleaseNotes "Release Notes" 3 | extends TILMedia.Internals.ClassTypes.Information; 4 | annotation(DocumentationClass=true, 5 | Documentation(info=" 6 |

7 |

The TILMedia Release Notes can be found in the following PDF-file: Release Notes TILMedia.pdf

8 | ")); 9 | end ReleaseNotes; 10 | -------------------------------------------------------------------------------- /UsersGuide/SubstanceRecord.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.UsersGuide; 2 | package SubstanceRecord "Substance Record" 3 | extends TILMedia.Internals.ClassTypes.Information; 4 | class ImportRefpropMediums "Import Refprop Mediums" 5 | extends TILMedia.Internals.ClassTypes.Information; 6 | annotation (Documentation(info=" 7 |

This substance property library provides the possibility to import REFPROP fluids and mixtures. The mediums are imported by copying the FLD-file into the library data-path, usually found at: \"C:\\ProgramData\\TLK-Thermo GmbH\\TILMedia\\<version>\\Refprop\". Note that the ProgramData is a hidden Windows folder. Therefore, it might be necessary to enable the display of hidden files in the windows folder options.

8 |

To access the properties of the copied FLD-file, it is recommended to create a user-defined substance record. A new substance record is easily created by duplicating the substance record of an existing medium (e.g. \"TILMedia.VLEFluidTypes.TILMedia_R134a\"). To assign the REFPROP-medium, the VLEFluidName parameter has to be changed to \"Refprop.NameOfTheFLDFile\".

9 |

An example of a user-defined substance record is shown below:

10 |

record User_defined_substance_record \"e.g. duplicated from TILMedia.VLEFluidTypes.TILMedia_R134a\" 11 |
  extends TILMedia.VLEFluidTypes.BaseVLEFluid( 12 |
    final fixedMixingRatio=false, 13 |
    final nc_propertyCalculation=1, 14 |
    final vleFluidNames={\"Refprop.NameOfTheFLDFile\"}, 15 |
    final mixingRatio_propertyCalculation={1}); 16 |
end User_defined_substance_record;

17 |

Furthermore, it is possible to create user-defined mixtures of substances by changing the VLEFluidName to a list of substance names (e.g. {\"Refprop.PROPANE.FLD\",\"Refprop.ISOBUTAN.FLD\",\"Refprop.CO2.FLD\"}) and assigning the composition of the mixture by the mixingRatio_propertyCalculation parameter (e.g. {0.65,0.3,0.05}). It is possible to hand over the relative composition, since the mixing ratio is standardized.

18 |

For more information on the substance records see the substance record documentation.

19 | ")); 20 | end ImportRefpropMediums; 21 | annotation(DocumentationClass=true, 22 | Documentation(info=" 23 |

Every substance model contains a substance record as replaceable parameter for the object-oriented calculation of thermo-physical properties. The substance record contains the following parameters:

24 |
    25 |
  • fixedMixingRatio - Boolean = true, if mixing ratio fixed during simulation.
  • 26 |
  • nc_propertyCalculation - Integer with number of components which are calculated.
  • 27 |
  • \"substanceNames\" - gasNames, liquidNames, etc. Array which lists the substance names.
  • 28 |
  • mixingRatio_propertyCalculation - Array with the mixing ratio of all substances.
  • 29 |
  • condensingIndex - Only for gas mixtures: Integer with the index of the component that can condense.
  • 30 |
31 |

To access the properties of an additional substance, it is recommended to create a new substance record. A new substance record is easily created by duplicating the substance record of an existing medium (e.g. \"TILMedia.VLEFluidTypes.TILMedia_R134a\"). To assign the new substance, the vleFluidNames parameter has to be changed to the new substance name (e.g. \"TILMedia.TILMedia_R1233ZD\"), included in the list of available substances. In the record, the parameters listed above have to be specified, using the modifier (brackets behind the base class) of the new substance record. An example of a user-defined substance record is shown below:

32 |

Pure substance example: 33 |

record TILMedia_R1233ZDE \"TILMedia.R1233ZDE\" 34 |
  extends TILMedia.VLEFluidTypes.BaseVLEFluid( 35 |
    final fixedMixingRatio=true, 36 |
    final nc_propertyCalculation=1, 37 |
    final vleFluidNames={\"TILMedia.R1233ZDE\"}, 38 |
    final mixingRatio_propertyCalculation={1}); 39 |
end TILMedia_R1233ZDE;

40 |

Mixture example: 41 |

record TILMediaXTR_MyGasMixture \"MyGasMixture\" 42 |
  extends TILMedia.GasTypes.BaseGas( 43 |
    final fixedMixingRatio=false, 44 |
    final nc_propertyCalculation=4, 45 |
    final gasNames={\"TILMediaXTR.Water\", \"TILMediaXTR.Oxygen\", \"TILMediaXTR.Nitrogen\", \"TILMediaXTR.Carbon_Dioxide\"}, 46 |
    final condensingIndex=1, 47 |
    final mixingRatio_propertyCalculation={0.001,0.25,0.75,0.001}); 48 |
end TILMediaXTR_MyGasMixture;

49 |

The defined mixingRatio_propertyCalculation describes the default mass fractions of all components. It is possible to give other and also time varying mass fractions xi for mixtures during a simulation. This array xi contains only the independent number of mass fractions, therefore it equals the number of components nc minus one.

50 |

All available substance names are listed in the user's guide: Substance Names. On demand, it is also possible to get interpolated property data, which are faster than the TILMedia and REFPROP data.

51 | ")); 52 | end SubstanceRecord; 53 | -------------------------------------------------------------------------------- /UsersGuide/package.mo: -------------------------------------------------------------------------------- 1 | within TILMedia; 2 | package UsersGuide "User's Guide" 3 | extends TILMedia.Internals.ClassTypes.Information; 4 | 5 | 6 | annotation(DocumentationClass=true, 7 | Documentation(info="

8 | 9 | TILMedia Suite provides methods of calculation, which express thermo-physical properties of incompressible liquids, ideal gases as well as real fluids containing a vapor liquid equilibrium. 10 | In each fluid category (Gas, Liquid and VLEFluids) mixtures may be created. 11 | The mathematical equations of substance properties are optimized for stable and fast dynamic simulations of systems. 12 | You may select substance data from different sources for your calculation: 13 |
14 |

15 |
    16 |
  • Gas substances
  • 17 |
  • 18 |
      19 |
    • TLK Implementation: 20 mediums
    • 20 |
    • VDI-Guideline 4670: 9 mediums
    • 21 |
    • VDI Heat Atlas: 275 mediums
    • 22 |
    • NASA Glenn Coefficients: 2024 mediums
    • 23 |
    24 |
  • 25 |
  • Liquid substances
  • 26 |
  • 27 |
      28 |
    • TLK Implementation: 71 mediums
    • 29 |
    • International Institute of Refrigeration (IIR), Secondary Working Fluids (SWF): 21 mediums
    • 30 |
    • VDI Heat Atlas: 272 mediums
    • 31 |
    32 |
  • 33 |
  • VLEFluid substances
  • 34 |
  • 35 |
      36 |
    • TLK Implementation: 98 mediums
    • 37 |
    • External library Refprop: 279 mediums
    • 38 |
    • External library CoolProp: 123 mediums
    • 39 |
    • VDI Heat Atlas: 275 mediums
    • 40 |
    41 |
  • 42 |
43 |
44 | All available substances are listed in the User's Guide: Substance Names. 45 | On demand it is also possible to get interpolated property data, which are faster than TILMedia and REFPROP data. 46 |
47 |
48 | ")); 49 | end UsersGuide; 50 | -------------------------------------------------------------------------------- /UsersGuide/package.order: -------------------------------------------------------------------------------- 1 | PropertyCalculation 2 | SubstanceRecord 3 | SubstanceNames 4 | ReleaseNotes 5 | -------------------------------------------------------------------------------- /VLEFluid.mo: -------------------------------------------------------------------------------- 1 | within TILMedia; 2 | model VLEFluid "Compressible fluid model for object and member function based evaluation" 3 | extends TILMedia.Internals.VLEFluidConfigurations.FullyMixtureCompatible.VLEFluid( 4 | redeclare replaceable function d_pTxi = 5 | TILMedia.Internals.VLEFluidObjectFunctions.PureComponentDerivatives.density_pTxi 6 | (vleFluidPointer=vleFluidPointer), 7 | redeclare replaceable function h_pTxi = 8 | TILMedia.Internals.VLEFluidObjectFunctions.PureComponentDerivatives.specificEnthalpy_pTxi 9 | (vleFluidPointer=vleFluidPointer), 10 | redeclare replaceable function s_pTxi = 11 | TILMedia.Internals.VLEFluidObjectFunctions.PureComponentDerivatives.specificEntropy_pTxi 12 | (vleFluidPointer=vleFluidPointer), 13 | redeclare replaceable function T_phxi = 14 | TILMedia.Internals.VLEFluidObjectFunctions.PureComponentDerivatives.temperature_phxi 15 | (vleFluidPointer=vleFluidPointer), 16 | redeclare replaceable function s_phxi = 17 | TILMedia.Internals.VLEFluidObjectFunctions.PureComponentDerivatives.specificEntropy_phxi 18 | (vleFluidPointer=vleFluidPointer), 19 | redeclare replaceable function d_psxi = 20 | TILMedia.Internals.VLEFluidObjectFunctions.PureComponentDerivatives.density_psxi 21 | (vleFluidPointer=vleFluidPointer), 22 | redeclare replaceable function T_psxi = 23 | TILMedia.Internals.VLEFluidObjectFunctions.PureComponentDerivatives.temperature_psxi 24 | (vleFluidPointer=vleFluidPointer), 25 | redeclare replaceable function h_psxi = 26 | TILMedia.Internals.VLEFluidObjectFunctions.PureComponentDerivatives.specificEnthalpy_psxi 27 | (vleFluidPointer=vleFluidPointer)); 28 | equation 29 | assert(vleFluidType.nc == 1, 30 | "This TILMedia VLEFluid interface cannot handle variable concentrations"); 31 | annotation ( 32 | defaultComponentName="vleFluid", 33 | Protection(access=Access.packageDuplicate)); 34 | end VLEFluid; 35 | -------------------------------------------------------------------------------- /VLEFluidTypes/BaseVLEFluid.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.VLEFluidTypes; 2 | record BaseVLEFluid "Base record for VLEFluid definitions" 3 | extends TILMedia.Internals.ClassTypes.Record; 4 | constant Boolean fixedMixingRatio 5 | "Treat medium as pseudo pure in Modelica if it is a mixture" 6 | annotation(Dialog, HideResult = true); 7 | constant Integer nc_propertyCalculation(min=1) 8 | "Number of components for fluid property calculations" 9 | annotation(Dialog, HideResult = true); 10 | final constant Integer nc=if fixedMixingRatio then 1 else nc_propertyCalculation 11 | "Number of components in Modelica models" 12 | annotation(Evaluate=true, HideResult = true); 13 | parameter TILMedia.Internals.VLEFluidName[:] vleFluidNames = {""} 14 | "Array of VLEFluid names e.g. {\"vleFluidName\"} for pure component" 15 | annotation(Dialog, choices); 16 | parameter Real[nc_propertyCalculation] mixingRatio_propertyCalculation = {1} 17 | "Mixing ratio for fluid property calculation (={1} for pure components)" 18 | annotation(Dialog, HideResult = true); 19 | final parameter Real[nc] defaultMixingRatio = if fixedMixingRatio then {1} else mixingRatio_propertyCalculation 20 | "Default composition for models in Modelica (={1} for pure components)" 21 | annotation(HideResult = true); 22 | final parameter Real xi_default[nc-1] = defaultMixingRatio[1:end-1]/sum(defaultMixingRatio) 23 | "Default mass fractions" 24 | annotation(HideResult = true); 25 | final parameter String concatVLEFluidName=TILMedia.Internals.concatNames(vleFluidNames) 26 | annotation(Dialog(tab="Internals")); 27 | constant Integer ID=0 28 | "ID is used to map the selected VLEFluid to the sim.cumulatedVLEFluidMass array item" annotation(HideResult = true); 29 | annotation (Documentation(info=" 30 |


Every VLEFluid substance model contains a substance record as replaceable parameter extending from this base VLEFluid model. The substance record contains the following parameters:

31 |
    32 |
  • fixedMixingRatio - Boolean = true, if mixing ratio is fixed during simulation.
  • 33 |
  • nc_propertyCalculation - Integer with number of components which are calculated.
  • 34 |
  • \"substanceNames\" - VLEFluidName 1, VLEFluidName 2, and so on. Array which lists the substance names.
  • 35 |
  • mixingRatio_propertyCalculation - Array with the mixing ratio of all substances.
  • 36 |
37 |

Access additional substances:

38 |

To acces the properties of an additional substance, it is possible to create a new substance reccord. For more information on the acces of additional propeties see the substance record documentation.

39 |

Furthermore it is possible to parameterize this VLEFluide base record, using a VLEFluid substance name, listed in the substance names documentation. An example how to parameterize the base VLEFluid model is shown below. However note that this is only a local configuration and therefore only accesible in the corresponding model.

40 |

41 | ")); 42 | end BaseVLEFluid; 43 | -------------------------------------------------------------------------------- /VLEFluidTypes/TILMedia_GERGCO2.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.VLEFluidTypes; 2 | record TILMedia_GERGCO2 "TILMedia.GERGCO2" 3 | extends TILMedia.VLEFluidTypes.BaseVLEFluid( 4 | final fixedMixingRatio=true, 5 | final nc_propertyCalculation=1, 6 | final vleFluidNames={"TILMedia.GERGCO2"}, 7 | final mixingRatio_propertyCalculation={1}); 8 | end TILMedia_GERGCO2; 9 | -------------------------------------------------------------------------------- /VLEFluidTypes/TILMedia_InterpolatedWater.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.VLEFluidTypes; 2 | record TILMedia_InterpolatedWater 3 | "Water, IAPWS1995, Linear Interpolation, table based calculation (TLK Implementation)" 4 | extends TILMedia.VLEFluidTypes.BaseVLEFluid( 5 | final fixedMixingRatio=true, 6 | final nc_propertyCalculation=1, 7 | final vleFluidNames={"Interpolation.LoadLinear(filename=\"" + 8 | Modelica.Utilities.Files.loadResource( 9 | "modelica://TILMedia/Resources/TILMediaDataPath/WATER.DAT") + "\")"}, 10 | final mixingRatio_propertyCalculation={1}); 11 | end TILMedia_InterpolatedWater; 12 | -------------------------------------------------------------------------------- /VLEFluidTypes/TILMedia_PR_CCS_Mixture_with_Water.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.VLEFluidTypes; 2 | record TILMedia_PR_CCS_Mixture_with_Water 3 | "N2, CO2, O2 and Ar + Water using Peng Robinson equation of state" 4 | extends TILMedia.VLEFluidTypes.BaseVLEFluid( 5 | final fixedMixingRatio=false, 6 | final nc_propertyCalculation=5, 7 | final vleFluidNames={"VDIWA2006.Nitrogen(REF=STP)", "VDIWA2006.Carbon Dioxide", "VDIWA2006.Oxygen", "VDIWA2006.Argon", "VDIWA2006.Water"}, 8 | final mixingRatio_propertyCalculation={1.7, 96.3, 1.8, 0.05, 0.06}); 9 | end TILMedia_PR_CCS_Mixture_with_Water; 10 | -------------------------------------------------------------------------------- /VLEFluidTypes/TILMedia_SplineWater.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.VLEFluidTypes; 2 | record TILMedia_SplineWater 3 | "Water, IAPWS1995, Bicubic Spline Interpolation, table based calculation (TLK Implementation)" 4 | extends TILMedia.VLEFluidTypes.BaseVLEFluid( 5 | final fixedMixingRatio=true, 6 | final nc_propertyCalculation=1, 7 | final vleFluidNames={"Interpolation.LoadSpline(filename=\"" + 8 | Modelica.Utilities.Files.loadResource( 9 | "modelica://TILMedia/Resources/TILMediaDataPath/WATER_SPLINE.DAT") + "\")"}, 10 | final mixingRatio_propertyCalculation={1}); 11 | end TILMedia_SplineWater; 12 | -------------------------------------------------------------------------------- /VLEFluidTypes/TILMedia_Water.mo: -------------------------------------------------------------------------------- 1 | within TILMedia.VLEFluidTypes; 2 | record TILMedia_Water "TILMedia.Water" 3 | extends TILMedia.VLEFluidTypes.BaseVLEFluid( 4 | final fixedMixingRatio=true, 5 | final nc_propertyCalculation=1, 6 | final vleFluidNames={"TILMedia.Water"}, 7 | final mixingRatio_propertyCalculation={1}); 8 | end TILMedia_Water; 9 | -------------------------------------------------------------------------------- /VLEFluidTypes/package.mo: -------------------------------------------------------------------------------- 1 | within TILMedia; 2 | package VLEFluidTypes "VLEFluids and VLEFluid mixtures, that can be used or composed in TILMedia" 3 | extends TILMedia.Internals.ClassTypes.ModelPackage; 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | annotation(Protection(access=Access.nonPackageDuplicate)); 32 | end VLEFluidTypes; 33 | -------------------------------------------------------------------------------- /VLEFluidTypes/package.order: -------------------------------------------------------------------------------- 1 | BaseVLEFluid 2 | TILMedia_Water 3 | TILMedia_GERGCO2 4 | TILMedia_InterpolatedWater 5 | TILMedia_SplineWater 6 | TILMedia_PR_CCS_Mixture_with_Water 7 | -------------------------------------------------------------------------------- /VLEFluid_dT.mo: -------------------------------------------------------------------------------- 1 | within TILMedia; 2 | model VLEFluid_dT 3 | "Compressible fluid model with d, T and xi as independent variables" 4 | extends TILMedia.BaseClasses.PartialVLEFluid_dT( 5 | vleFluidPointer= 6 | TILMedia.Internals.TILMediaExternalObject( 7 | "VLEFluid", 8 | vleFluidType.concatVLEFluidName, 9 | computeFlags, 10 | vleFluidType.mixingRatio_propertyCalculation[1:end - 1]/sum( 11 | vleFluidType.mixingRatio_propertyCalculation), 12 | vleFluidType.nc, 13 | 0, 14 | getInstanceName()), 15 | M_i = {TILMedia.VLEFluidObjectFunctions.molarMass_n(i-1,vleFluidPointer) for i in 1:vleFluidType.nc}); 16 | protected 17 | constant Real invalidValue=-1; 18 | final parameter Integer computeFlags=TILMedia.Internals.calcComputeFlags( 19 | computeTransportProperties, 20 | interpolateTransportProperties, 21 | computeSurfaceTension, 22 | deactivateTwoPhaseRegion, 23 | deactivateDensityDerivatives); 24 | 25 | equation 26 | assert(vleFluidType.nc == 1, "This TILMedia VLEFluid interface cannot handle variable concentrations"); 27 | (crit.d,crit.h,crit.p,crit.s,crit.T) = 28 | TILMedia.Internals.VLEFluidObjectFunctions.cricondentherm_xi(xi, 29 | vleFluidPointer); 30 | //calculate molar mass 31 | M = M_i[1]; 32 | 33 | //Calculate Main Properties of state 34 | h = 35 | TILMedia.Internals.VLEFluidObjectFunctions.PureComponentDerivatives.specificEnthalpy_dTxi( 36 | d, 37 | T, 38 | xi, 39 | vleFluidPointer); 40 | p = 41 | TILMedia.Internals.VLEFluidObjectFunctions.PureComponentDerivatives.pressure_dTxi( 42 | d, 43 | T, 44 | xi, 45 | vleFluidPointer); 46 | s = 47 | TILMedia.Internals.VLEFluidObjectFunctions.PureComponentDerivatives.specificEntropy_dTxi( 48 | d, 49 | T, 50 | xi, 51 | vleFluidPointer); 52 | 53 | //Calculate Additional Properties of state 54 | (q,cp,cv,beta,kappa,drhodp_hxi,drhodh_pxi,drhodxi_ph,w,gamma) = 55 | TILMedia.Internals.VLEFluidObjectFunctions.additionalProperties_dTxi( 56 | d, 57 | T, 58 | xi, 59 | vleFluidPointer); 60 | 61 | //Calculate VLE Properties 62 | //VLE only depends on p or T 63 | (VLE.d_l,VLE.h_l,VLE.p_l,VLE.s_l,VLE.T_l,VLE.xi_l,VLE.d_v,VLE.h_v,VLE.p_v,VLE.s_v, 64 | VLE.T_v,VLE.xi_v) = 65 | TILMedia.Internals.VLEFluidObjectFunctions.VLEProperties_dTxi( 66 | -1, 67 | T, 68 | xi, 69 | vleFluidPointer); 70 | 71 | //Calculate Transport Properties 72 | if computeTransportProperties then 73 | (transp.Pr, 74 | transp.lambda, 75 | transp.eta, 76 | transp.sigma) = 77 | TILMedia.Internals.VLEFluidObjectFunctions.transportPropertyRecord_dTxi( 78 | d, 79 | T, 80 | xi, 81 | vleFluidPointer); 82 | else 83 | transp = TILMedia.Internals.TransportPropertyRecord( 84 | invalidValue, 85 | invalidValue, 86 | invalidValue, 87 | invalidValue); 88 | end if; 89 | 90 | //compute VLE Additional Properties 91 | if computeVLEAdditionalProperties then 92 | //VLE only depends on p or T 93 | (VLEAdditional.cp_l,VLEAdditional.beta_l,VLEAdditional.kappa_l, 94 | VLEAdditional.cp_v,VLEAdditional.beta_v,VLEAdditional.kappa_v) = 95 | TILMedia.Internals.VLEFluidObjectFunctions.VLEAdditionalProperties_dTxi( 96 | -1, 97 | T, 98 | xi, 99 | vleFluidPointer); 100 | else 101 | VLEAdditional.cp_l = invalidValue; 102 | VLEAdditional.beta_l = invalidValue; 103 | VLEAdditional.kappa_l = invalidValue; 104 | VLEAdditional.cp_v = invalidValue; 105 | VLEAdditional.beta_v = invalidValue; 106 | VLEAdditional.kappa_v = invalidValue; 107 | end if; 108 | 109 | //compute VLE Transport Properties 110 | if computeVLETransportProperties then 111 | //VLE only depends on p or T 112 | (VLETransp.Pr_l,VLETransp.Pr_v,VLETransp.lambda_l,VLETransp.lambda_v, 113 | VLETransp.eta_l,VLETransp.eta_v) = 114 | TILMedia.Internals.VLEFluidObjectFunctions.VLETransportPropertyRecord_dTxi( 115 | -1, 116 | T, 117 | xi, 118 | vleFluidPointer); 119 | else 120 | VLETransp.Pr_l = invalidValue; 121 | VLETransp.Pr_v = invalidValue; 122 | VLETransp.lambda_l = invalidValue; 123 | VLETransp.lambda_v = invalidValue; 124 | VLETransp.eta_l = invalidValue; 125 | VLETransp.eta_v = invalidValue; 126 | end if; 127 | 128 | annotation ( 129 | defaultComponentName="vleFluid", 130 | Protection(access=Access.packageDuplicate), 131 | Documentation(info=" 132 |

133 | The VLE-fluid model VLEFluid_dT calculates the thermopyhsical property data with given inputs: density (d), temperature (T), mass fraction (xi) and the parameter vleFluidType.
134 | The interface and the way of using, is demonstrated in the Testers -> TestVLEFluid. 135 |

136 |
137 | ")); 138 | end VLEFluid_dT; 139 | -------------------------------------------------------------------------------- /VLEFluid_pT.mo: -------------------------------------------------------------------------------- 1 | within TILMedia; 2 | model VLEFluid_pT 3 | "Compressible fluid model with p, T and xi as independent variables" 4 | extends TILMedia.BaseClasses.PartialVLEFluid_pT( 5 | vleFluidPointer= 6 | TILMedia.Internals.TILMediaExternalObject( 7 | "VLEFluid", 8 | vleFluidType.concatVLEFluidName, 9 | computeFlags, 10 | vleFluidType.mixingRatio_propertyCalculation[1:end - 1]/sum( 11 | vleFluidType.mixingRatio_propertyCalculation), 12 | vleFluidType.nc, 13 | 0, 14 | getInstanceName()), 15 | M_i = {TILMedia.VLEFluidObjectFunctions.molarMass_n(i-1,vleFluidPointer) for i in 1:vleFluidType.nc}); 16 | protected 17 | constant Real invalidValue=-1; 18 | final parameter Integer computeFlags=TILMedia.Internals.calcComputeFlags( 19 | computeTransportProperties, 20 | interpolateTransportProperties, 21 | computeSurfaceTension, 22 | deactivateTwoPhaseRegion, 23 | deactivateDensityDerivatives); 24 | 25 | equation 26 | assert(vleFluidType.nc == 1, "This TILMedia VLEFluid interface cannot handle variable concentrations"); 27 | (crit.d,crit.h,crit.p,crit.s,crit.T) = 28 | TILMedia.Internals.VLEFluidObjectFunctions.cricondenbar_xi(xi, 29 | vleFluidPointer); 30 | //calculate molar mass 31 | M = M_i[1]; 32 | 33 | //Calculate Main Properties of state 34 | d = 35 | TILMedia.Internals.VLEFluidObjectFunctions.PureComponentDerivatives.density_pTxi( 36 | p, 37 | T, 38 | xi, 39 | vleFluidPointer); 40 | h = 41 | TILMedia.Internals.VLEFluidObjectFunctions.PureComponentDerivatives.specificEnthalpy_pTxi( 42 | p, 43 | T, 44 | xi, 45 | vleFluidPointer); 46 | s = 47 | TILMedia.Internals.VLEFluidObjectFunctions.PureComponentDerivatives.specificEntropy_pTxi( 48 | p, 49 | T, 50 | xi, 51 | vleFluidPointer); 52 | 53 | //Calculate Additional Properties of state 54 | (q,cp,cv,beta,kappa,drhodp_hxi,drhodh_pxi,drhodxi_ph,w,gamma) = 55 | TILMedia.Internals.VLEFluidObjectFunctions.additionalProperties_phxi( 56 | p, 57 | h, 58 | xi, 59 | vleFluidPointer); 60 | 61 | //Calculate VLE Properties 62 | //VLE only depends on p or T 63 | (VLE.d_l,VLE.h_l,VLE.p_l,VLE.s_l,VLE.T_l,VLE.xi_l,VLE.d_v,VLE.h_v,VLE.p_v,VLE.s_v, 64 | VLE.T_v,VLE.xi_v) = 65 | TILMedia.Internals.VLEFluidObjectFunctions.VLEProperties_phxi( 66 | p, 67 | -1, 68 | xi, 69 | vleFluidPointer); 70 | 71 | //Calculate Transport Properties 72 | if computeTransportProperties then 73 | (transp.Pr, 74 | transp.lambda, 75 | transp.eta, 76 | transp.sigma) = 77 | TILMedia.Internals.VLEFluidObjectFunctions.transportPropertyRecord_phxi( 78 | p, 79 | h, 80 | xi, 81 | vleFluidPointer); 82 | else 83 | transp = TILMedia.Internals.TransportPropertyRecord( 84 | invalidValue, 85 | invalidValue, 86 | invalidValue, 87 | invalidValue); 88 | end if; 89 | 90 | //compute VLE Additional Properties 91 | if computeVLEAdditionalProperties then 92 | //VLE only depends on p or T 93 | (VLEAdditional.cp_l,VLEAdditional.beta_l,VLEAdditional.kappa_l, 94 | VLEAdditional.cp_v,VLEAdditional.beta_v,VLEAdditional.kappa_v) = 95 | TILMedia.Internals.VLEFluidObjectFunctions.VLEAdditionalProperties_phxi( 96 | p, 97 | -1, 98 | xi, 99 | vleFluidPointer); 100 | else 101 | VLEAdditional.cp_l = invalidValue; 102 | VLEAdditional.beta_l = invalidValue; 103 | VLEAdditional.kappa_l = invalidValue; 104 | VLEAdditional.cp_v = invalidValue; 105 | VLEAdditional.beta_v = invalidValue; 106 | VLEAdditional.kappa_v = invalidValue; 107 | end if; 108 | 109 | //compute VLE Transport Properties 110 | if computeVLETransportProperties then 111 | //VLE only depends on p or T 112 | (VLETransp.Pr_l,VLETransp.Pr_v,VLETransp.lambda_l,VLETransp.lambda_v, 113 | VLETransp.eta_l,VLETransp.eta_v) = 114 | TILMedia.Internals.VLEFluidObjectFunctions.VLETransportPropertyRecord_phxi( 115 | p, 116 | -1, 117 | xi, 118 | vleFluidPointer); 119 | else 120 | VLETransp.Pr_l = invalidValue; 121 | VLETransp.Pr_v = invalidValue; 122 | VLETransp.lambda_l = invalidValue; 123 | VLETransp.lambda_v = invalidValue; 124 | VLETransp.eta_l = invalidValue; 125 | VLETransp.eta_v = invalidValue; 126 | end if; 127 | 128 | annotation ( 129 | defaultComponentName="vleFluid", 130 | Protection(access=Access.packageDuplicate), 131 | Documentation(info=" 132 |

133 | The VLE-fluid model VLEFluid_pT calculates the thermopyhsical property data with given inputs: pressure (p), temperature (T), mass fraction (xi) and the parameter vleFluidType.
134 | The interface and the way of using, is demonstrated in the Testers -> TestVLEFluid. 135 |

136 |
137 | ")); 138 | end VLEFluid_pT; 139 | -------------------------------------------------------------------------------- /VLEFluid_ph.mo: -------------------------------------------------------------------------------- 1 | within TILMedia; 2 | model VLEFluid_ph 3 | "Compressible fluid model with p, h and xi as independent variables" 4 | extends TILMedia.BaseClasses.PartialVLEFluid_ph( 5 | vleFluidPointer= 6 | TILMedia.Internals.TILMediaExternalObject( 7 | "VLEFluid", 8 | vleFluidType.concatVLEFluidName, 9 | computeFlags, 10 | vleFluidType.mixingRatio_propertyCalculation[1:end - 1]/sum( 11 | vleFluidType.mixingRatio_propertyCalculation), 12 | vleFluidType.nc, 13 | 0, 14 | getInstanceName()), 15 | M_i = {TILMedia.VLEFluidObjectFunctions.molarMass_n(i-1,vleFluidPointer) for i in 1:vleFluidType.nc}); 16 | protected 17 | constant Real invalidValue=-1; 18 | final parameter Integer computeFlags=TILMedia.Internals.calcComputeFlags( 19 | computeTransportProperties, 20 | interpolateTransportProperties, 21 | computeSurfaceTension, 22 | deactivateTwoPhaseRegion, 23 | deactivateDensityDerivatives); 24 | 25 | equation 26 | assert(vleFluidType.nc == 1, "This TILMedia VLEFluid interface cannot handle variable concentrations"); 27 | (crit.d,crit.h,crit.p,crit.s,crit.T) = 28 | TILMedia.Internals.VLEFluidObjectFunctions.cricondenbar_xi(xi, 29 | vleFluidPointer); 30 | //calculate molar mass 31 | M = M_i[1]; 32 | 33 | //Calculate Main Properties of state 34 | d = 35 | TILMedia.Internals.VLEFluidObjectFunctions.PureComponentDerivatives.density_phxi( 36 | p, 37 | h, 38 | xi, 39 | vleFluidPointer); 40 | s = 41 | TILMedia.Internals.VLEFluidObjectFunctions.PureComponentDerivatives.specificEntropy_phxi( 42 | p, 43 | h, 44 | xi, 45 | vleFluidPointer); 46 | T = 47 | TILMedia.Internals.VLEFluidObjectFunctions.PureComponentDerivatives.temperature_phxi( 48 | p, 49 | h, 50 | xi, 51 | vleFluidPointer); 52 | 53 | //Calculate Additional Properties of state 54 | (q,cp,cv,beta,kappa,drhodp_hxi,drhodh_pxi,drhodxi_ph,w,gamma) = 55 | TILMedia.Internals.VLEFluidObjectFunctions.additionalProperties_phxi( 56 | p, 57 | h, 58 | xi, 59 | vleFluidPointer); 60 | 61 | //Calculate VLE Properties 62 | //VLE only depends on p or T 63 | (VLE.d_l,VLE.h_l,VLE.p_l,VLE.s_l,VLE.T_l,VLE.xi_l,VLE.d_v,VLE.h_v,VLE.p_v,VLE.s_v, 64 | VLE.T_v,VLE.xi_v) = 65 | TILMedia.Internals.VLEFluidObjectFunctions.VLEProperties_phxi( 66 | p, 67 | -1, 68 | xi, 69 | vleFluidPointer); 70 | 71 | //Calculate Transport Properties 72 | if computeTransportProperties then 73 | (transp.Pr, 74 | transp.lambda, 75 | transp.eta, 76 | transp.sigma) = 77 | TILMedia.Internals.VLEFluidObjectFunctions.transportPropertyRecord_phxi( 78 | p, 79 | h, 80 | xi, 81 | vleFluidPointer); 82 | else 83 | transp = TILMedia.Internals.TransportPropertyRecord( 84 | invalidValue, 85 | invalidValue, 86 | invalidValue, 87 | invalidValue); 88 | end if; 89 | 90 | //compute VLE Additional Properties 91 | if computeVLEAdditionalProperties then 92 | //VLE only depends on p or T 93 | (VLEAdditional.cp_l,VLEAdditional.beta_l,VLEAdditional.kappa_l, 94 | VLEAdditional.cp_v,VLEAdditional.beta_v,VLEAdditional.kappa_v) = 95 | TILMedia.Internals.VLEFluidObjectFunctions.VLEAdditionalProperties_phxi( 96 | p, 97 | -1, 98 | xi, 99 | vleFluidPointer); 100 | else 101 | VLEAdditional.cp_l = invalidValue; 102 | VLEAdditional.beta_l = invalidValue; 103 | VLEAdditional.kappa_l = invalidValue; 104 | VLEAdditional.cp_v = invalidValue; 105 | VLEAdditional.beta_v = invalidValue; 106 | VLEAdditional.kappa_v = invalidValue; 107 | end if; 108 | 109 | //compute VLE Transport Properties 110 | if computeVLETransportProperties then 111 | //VLE only depends on p or T 112 | (VLETransp.Pr_l,VLETransp.Pr_v,VLETransp.lambda_l,VLETransp.lambda_v, 113 | VLETransp.eta_l,VLETransp.eta_v) = 114 | TILMedia.Internals.VLEFluidObjectFunctions.VLETransportPropertyRecord_phxi( 115 | p, 116 | -1, 117 | xi, 118 | vleFluidPointer); 119 | else 120 | VLETransp.Pr_l = invalidValue; 121 | VLETransp.Pr_v = invalidValue; 122 | VLETransp.lambda_l = invalidValue; 123 | VLETransp.lambda_v = invalidValue; 124 | VLETransp.eta_l = invalidValue; 125 | VLETransp.eta_v = invalidValue; 126 | end if; 127 | 128 | annotation ( 129 | defaultComponentName="vleFluid", 130 | Protection(access=Access.packageDuplicate), 131 | Documentation(info=" 132 |

133 | The VLE-fluid model VLEFluid_ph calculates the thermopyhsical property data with given inputs: pressure (p), enthalpy (h), mass fraction (xi) and the parameter vleFluidType.
134 | The interface and the way of using, is demonstrated in the Testers -> TestVLEFluid. 135 |

136 |
137 | ")); 138 | end VLEFluid_ph; 139 | -------------------------------------------------------------------------------- /VLEFluid_ps.mo: -------------------------------------------------------------------------------- 1 | within TILMedia; 2 | model VLEFluid_ps 3 | "Compressible fluid model with p, s and xi as independent variables" 4 | extends TILMedia.BaseClasses.PartialVLEFluid_ps( 5 | vleFluidPointer= 6 | TILMedia.Internals.TILMediaExternalObject( 7 | "VLEFluid", 8 | vleFluidType.concatVLEFluidName, 9 | computeFlags, 10 | vleFluidType.mixingRatio_propertyCalculation[1:end - 1]/sum( 11 | vleFluidType.mixingRatio_propertyCalculation), 12 | vleFluidType.nc, 13 | 0, 14 | getInstanceName()), 15 | M_i = {TILMedia.VLEFluidObjectFunctions.molarMass_n(i-1,vleFluidPointer) for i in 1:vleFluidType.nc}); 16 | protected 17 | constant Real invalidValue=-1; 18 | final parameter Integer computeFlags=TILMedia.Internals.calcComputeFlags( 19 | computeTransportProperties, 20 | interpolateTransportProperties, 21 | computeSurfaceTension, 22 | deactivateTwoPhaseRegion, 23 | deactivateDensityDerivatives); 24 | 25 | equation 26 | assert(vleFluidType.nc == 1, "This TILMedia VLEFluid interface cannot handle variable concentrations"); 27 | (crit.d,crit.h,crit.p,crit.s,crit.T) = 28 | TILMedia.Internals.VLEFluidObjectFunctions.cricondenbar_xi(xi, 29 | vleFluidPointer); 30 | //calculate molar mass 31 | M = M_i[1]; 32 | 33 | //Calculate Main Properties of state 34 | d = 35 | TILMedia.Internals.VLEFluidObjectFunctions.PureComponentDerivatives.density_psxi( 36 | p, 37 | s, 38 | xi, 39 | vleFluidPointer); 40 | h = 41 | TILMedia.Internals.VLEFluidObjectFunctions.PureComponentDerivatives.specificEnthalpy_psxi( 42 | p, 43 | s, 44 | xi, 45 | vleFluidPointer); 46 | T = 47 | TILMedia.Internals.VLEFluidObjectFunctions.PureComponentDerivatives.temperature_psxi( 48 | p, 49 | s, 50 | xi, 51 | vleFluidPointer); 52 | 53 | //Calculate Additional Properties of state 54 | (q,cp,cv,beta,kappa,drhodp_hxi,drhodh_pxi,drhodxi_ph,w,gamma) = 55 | TILMedia.Internals.VLEFluidObjectFunctions.additionalProperties_phxi( 56 | p, 57 | h, 58 | xi, 59 | vleFluidPointer); 60 | 61 | //Calculate VLE Properties 62 | //VLE only depends on p or T 63 | (VLE.d_l,VLE.h_l,VLE.p_l,VLE.s_l,VLE.T_l,VLE.xi_l,VLE.d_v,VLE.h_v,VLE.p_v,VLE.s_v, 64 | VLE.T_v,VLE.xi_v) = 65 | TILMedia.Internals.VLEFluidObjectFunctions.VLEProperties_phxi( 66 | p, 67 | -1, 68 | xi, 69 | vleFluidPointer); 70 | 71 | //Calculate Transport Properties 72 | if computeTransportProperties then 73 | (transp.Pr, 74 | transp.lambda, 75 | transp.eta, 76 | transp.sigma) = 77 | TILMedia.Internals.VLEFluidObjectFunctions.transportPropertyRecord_phxi( 78 | p, 79 | h, 80 | xi, 81 | vleFluidPointer); 82 | else 83 | transp = TILMedia.Internals.TransportPropertyRecord( 84 | invalidValue, 85 | invalidValue, 86 | invalidValue, 87 | invalidValue); 88 | end if; 89 | 90 | //compute VLE Additional Properties 91 | if computeVLEAdditionalProperties then 92 | //VLE only depends on p or T 93 | (VLEAdditional.cp_l,VLEAdditional.beta_l,VLEAdditional.kappa_l, 94 | VLEAdditional.cp_v,VLEAdditional.beta_v,VLEAdditional.kappa_v) = 95 | TILMedia.Internals.VLEFluidObjectFunctions.VLEAdditionalProperties_phxi( 96 | p, 97 | -1, 98 | xi, 99 | vleFluidPointer); 100 | else 101 | VLEAdditional.cp_l = invalidValue; 102 | VLEAdditional.beta_l = invalidValue; 103 | VLEAdditional.kappa_l = invalidValue; 104 | VLEAdditional.cp_v = invalidValue; 105 | VLEAdditional.beta_v = invalidValue; 106 | VLEAdditional.kappa_v = invalidValue; 107 | end if; 108 | 109 | //compute VLE Transport Properties 110 | if computeVLETransportProperties then 111 | //VLE only depends on p or T 112 | (VLETransp.Pr_l,VLETransp.Pr_v,VLETransp.lambda_l,VLETransp.lambda_v, 113 | VLETransp.eta_l,VLETransp.eta_v) = 114 | TILMedia.Internals.VLEFluidObjectFunctions.VLETransportPropertyRecord_phxi( 115 | p, 116 | -1, 117 | xi, 118 | vleFluidPointer); 119 | else 120 | VLETransp.Pr_l = invalidValue; 121 | VLETransp.Pr_v = invalidValue; 122 | VLETransp.lambda_l = invalidValue; 123 | VLETransp.lambda_v = invalidValue; 124 | VLETransp.eta_l = invalidValue; 125 | VLETransp.eta_v = invalidValue; 126 | end if; 127 | 128 | annotation ( 129 | defaultComponentName="vleFluid", 130 | Protection(access=Access.packageDuplicate), 131 | Documentation(info=" 132 |

133 | The VLE-fluid model VLEFluid_ps calculates the thermopyhsical property data with given inputs: pressure (p), entropy (s), mass fraction (xi) and the parameter vleFluidType.
134 | The interface and the way of using, is demonstrated in the Testers -> TestVLEFluid. 135 |

136 |
137 | ")); 138 | end VLEFluid_ps; 139 | -------------------------------------------------------------------------------- /package.order: -------------------------------------------------------------------------------- 1 | UsersGuide 2 | Gas 3 | Gas_ph 4 | Gas_ps 5 | Gas_pT 6 | Liquid 7 | Liquid_ph 8 | Liquid_pT 9 | SLEMedium 10 | Solid 11 | VLEFluid 12 | VLEFluid_dT 13 | VLEFluid_ph 14 | VLEFluid_ps 15 | VLEFluid_pT 16 | BaseClasses 17 | GasFunctions 18 | GasObjectFunctions 19 | GasTypes 20 | LiquidFunctions 21 | LiquidObjectFunctions 22 | LiquidTypes 23 | SLEMediumTypes 24 | SolidTypes 25 | VLEFluidFunctions 26 | VLEFluidObjectFunctions 27 | VLEFluidTypes 28 | Internals 29 | Testers 30 | --------------------------------------------------------------------------------