Name | Description |
---|---|
![]() | Boiling model |
![]() | Condensation model |
![]() | Partial model - Model describing a phase change |
![]() | Boundary condition for the partial pressure of one of the component of a gas mixture |
Type | Name | Default | Description |
---|---|---|---|
Integer | nComp | 1 | Number of components |
Real | massEnthalpyLRef[nComp] | zeros(nComp) | Specific (per mass) enthalpy of the liquid components at the reference temperature [L2.t-2] |
Real | molEnthalpyGRef[nComp] | zeros(nComp) | Specific (per mol) enthalpy of the gas components at the reference temperature [M.L2.t-2.mol-1] |
Real | tempRef | 298 | Reference temperature for the enthalpy [T] |
Real | CpCoefML[nComp, 7] | Liquid components: coefficients of the specific (per mass) heat capacity Cp unit: L2.t-2.T-1 Cp[i] = CpCoef[i,1] + CpCoef[i,2]*T + ... + CpCoef[i,7]*T**6 | |
Real | CpCoefNG[nComp, 7] | Vapor components: coefficients of the specific (per mol) heat capacity at constant pressure. Cp unit: M.L2.t-2.T-1.mol-1 Cp[i] = CpCoef[i,1] + CpCoef[i,2]*T + ... + CpCoef[i,7]*T**6 | |
Real | molecWeigth[nComp] | Molecular weigth of the components [M.mol-1] | |
Real | eps | 1E-8 | Small constant to avoid by-zero division |
Real | Kprop | [M.t-1.T-1] |
Type | Name | Description |
---|---|---|
cutLiquidR | inMass | Liquid flow - Connector R. Connector for the liquid flow. |
cutGasR | outMol | Gas flow - Connector Resistive. |
model boilingB "Boiling model" extends phaseChgB; parameter Real Kprop( unit="M.t-1.T-1"); Boolean boiling( start = false, fixed=true) "True: the liquid is boiling False: the liquid is not boiling"; Boolean noBoiling( start = true, fixed=true) "True : the liquid is not boiling False: the liquid is boiling"; Real tempBoiling( unit="K") "Temperature of the boiling point"; Real compVaporBoil[ nComp] "Composition (mass fraction of each component) of the vapor flowing from the liquid, due to the boiling"; Real error( unit="T") "Difference between the liquid temperature and its boiling temperature"; equation // Boiling condition boiling = pre(noBoiling) and not inMass.tempL < tempBoiling or pre(boiling) and not ( totalMassF < - eps or not ( sum(inMass.massL[i] for i in 1:nComp) > eps)); noBoiling = pre(boiling) and ( totalMassF < - eps or not ( sum(inMass.massL[i] for i in 1:nComp) > eps)) or pre(noBoiling) and not ( not inMass.tempL < tempBoiling); // Difference between the liquid temperature and its boiling temperature error = inMass.tempL - tempBoiling; // Mass flow due to the boiling 0 = if boiling then totalMassF - Kprop * error else inMass.massLF[1]; if nComp > 1 then for i in 1:(nComp-1) loop 0 = if boiling then compVaporBoil[i] - inMass.massLF[i] / ( totalMassF + eps) else inMass.massLF[i+1]; end for; end if; // Direction of the flow flowIsPosit = true; end boilingB;
Type | Name | Default | Description |
---|---|---|---|
Integer | nComp | 1 | Number of components |
Real | massEnthalpyLRef[nComp] | zeros(nComp) | Specific (per mass) enthalpy of the liquid components at the reference temperature [L2.t-2] |
Real | molEnthalpyGRef[nComp] | zeros(nComp) | Specific (per mol) enthalpy of the gas components at the reference temperature [M.L2.t-2.mol-1] |
Real | tempRef | 298 | Reference temperature for the enthalpy [T] |
Real | CpCoefML[nComp, 7] | Liquid components: coefficients of the specific (per mass) heat capacity Cp unit: L2.t-2.T-1 Cp[i] = CpCoef[i,1] + CpCoef[i,2]*T + ... + CpCoef[i,7]*T**6 | |
Real | CpCoefNG[nComp, 7] | Vapor components: coefficients of the specific (per mol) heat capacity at constant pressure. Cp unit: M.L2.t-2.T-1.mol-1 Cp[i] = CpCoef[i,1] + CpCoef[i,2]*T + ... + CpCoef[i,7]*T**6 | |
Real | molecWeigth[nComp] | Molecular weigth of the components [M.mol-1] | |
Real | eps | 1E-8 | Small constant to avoid by-zero division |
Real | Kprop | [mol.t-1.T-1] |
Type | Name | Description |
---|---|---|
cutLiquidR | inMass | Liquid flow - Connector R. Connector for the liquid flow. |
cutGasR | outMol | Gas flow - Connector Resistive. |
model condensB "Condensation model" extends phaseChgB; parameter Real Kprop( unit="mol.t-1.T-1"); protected Boolean condens( start=false, fixed=true) "True: the liquid is condensing False: the liquid is not condensing"; Boolean noCondens( start=true, fixed=true) "True : the liquid is not condensing False: the liquid is condensing"; Real tempCondens( unit="T") "Temperature of the dew point"; Real compLiqCond[ nComp] "Composition (mass fraction of each component) of the liquid flowing from the vapor, due to the condensation"; Real error( unit="T") "Difference between the liquid temperature and its dew temperature"; equation // Condensation condens = pre(noCondens) and not outMol.tempG > tempCondens or pre(condens) and not ( totalMolF > eps or not ( sum(outMol.molG[i] for i in 1:nComp) > eps)); noCondens = pre(condens) and ( totalMolF > eps or not ( sum(outMol.molG[i] for i in 1:nComp) > eps)) or pre(noCondens) and not ( not outMol.tempG > tempCondens); // Difference between the liquid temperature and its dew temperature error = outMol.tempG - tempCondens; // Mass flow due to the condensation 0 = if condens then totalMolF - Kprop * error else outMol.molGF[1]; if nComp > 1 then for i in 1:(nComp-1) loop 0 = if condens then compLiqCond[i] - outMol.molGF[i] / ( totalMolF + eps) else outMol.molGF[i+1]; end for; end if; // Flow direction flowIsPosit = false; end condensB;
Type | Name | Default | Description |
---|---|---|---|
Integer | nComp | 1 | Number of components |
Real | massEnthalpyLRef[nComp] | zeros(nComp) | Specific (per mass) enthalpy of the liquid components at the reference temperature [L2.t-2] |
Real | molEnthalpyGRef[nComp] | zeros(nComp) | Specific (per mol) enthalpy of the gas components at the reference temperature [M.L2.t-2.mol-1] |
Real | tempRef | 298 | Reference temperature for the enthalpy [T] |
Real | CpCoefML[nComp, 7] | Liquid components: coefficients of the specific (per mass) heat capacity Cp unit: L2.t-2.T-1 Cp[i] = CpCoef[i,1] + CpCoef[i,2]*T + ... + CpCoef[i,7]*T**6 | |
Real | CpCoefNG[nComp, 7] | Vapor components: coefficients of the specific (per mol) heat capacity at constant pressure. Cp unit: M.L2.t-2.T-1.mol-1 Cp[i] = CpCoef[i,1] + CpCoef[i,2]*T + ... + CpCoef[i,7]*T**6 | |
Real | molecWeigth[nComp] | Molecular weigth of the components [M.mol-1] | |
Real | eps | 1E-8 | Small constant to avoid by-zero division |
Type | Name | Description |
---|---|---|
cutLiquidR | inMass | Liquid flow - Connector R. Connector for the liquid flow. |
cutGasR | outMol | Gas flow - Connector Resistive. |
partial model phaseChgB "Partial model - Model describing a phase change" extends JARA2i.interf.heteroFlow2I; parameter Real massEnthalpyLRef[nComp]( unit="L2.t-2") = zeros(nComp) "Specific (per mass) enthalpy of the liquid components at the reference temperature"; parameter Real molEnthalpyGRef[nComp]( unit="M.L2.t-2.mol-1") = zeros(nComp) "Specific (per mol) enthalpy of the gas components at the reference temperature"; parameter Real tempRef( unit="T") = 298 "Reference temperature for the enthalpy"; parameter Real CpCoefML[nComp,7] "Liquid components: coefficients of the specific (per mass) heat capacity Cp unit: L2.t-2.T-1 Cp[i] = CpCoef[i,1] + CpCoef[i,2]*T + ... + CpCoef[i,7]*T**6"; parameter Real CpCoefNG[nComp,7] "Vapor components: coefficients of the specific (per mol) heat capacity at constant pressure. Cp unit: M.L2.t-2.T-1.mol-1 Cp[i] = CpCoef[i,1] + CpCoef[i,2]*T + ... + CpCoef[i,7]*T**6"; parameter Real molecWeigth[nComp]( unit="M.mol-1") "Molecular weigth of the components"; parameter Real eps = 1E-8 "Small constant to avoid by-zero division"; Real totalMassF( unit="M.t-1") "Total mass-flow due to the phase change"; Real totalMolF( unit="mol.t-1") "Total molar-flow due to the phase change"; Real tempF( unit="T") "Temperature of the flow between the phases"; Real massHeatPhaseChg( unit="L2.t-2") "Change-of-phase heat per mass unit"; Real massEnthalpyL[ nComp]( unit="L2.t-2") "Specific (per mass) enthalpy of the liquid components"; Real molEnthalpyL[ nComp]( unit="M.L2.t-2.mol-1") "Molar enthalpy of the liquid components"; Real molEnthalpyG[ nComp]( unit="M.L2.t-2.mol-1") "Molar enthalpy of the vapor components"; Real massEnthalpyG[ nComp]( unit="L2.t-2") "Specific (per mass) enthalpy of the vapor components"; Boolean flowIsPosit "True: flow from liquid to vapor phase False: flow from vapor to liquid phase"; equation // Total mass flow due to the phase change. Positive: flow from liquid to vapor phase. totalMassF = sum(inMass.massLF[i] for i in 1:nComp); totalMolF = -sum(outMol.molGF[i] for i in 1:nComp); for i in 1:nComp loop molecWeigth[i] * outMol.molGF[i] + inMass.massLF[i] = 0; end for; // Relationship between the molar enthalpy and the specific (per mass) enthalpy for i in 1:nComp loop molecWeigth[i] * molEnthalpyG[i] = massEnthalpyG[i]; molecWeigth[i] * molEnthalpyL[i] = massEnthalpyL[i]; end for; // Temperature of the change-of-phase flow tempF = if flowIsPosit then inMass.tempL else outMol.tempG; // Enthalpy flow associated to the change-of-phase mass flow. Positive: flow from liquid to vapor inMass.energyLF = if flowIsPosit then -sum(outMol.molGF[i] * molEnthalpyG[i] for i in 1:nComp) else sum(inMass.massLF[i] * massEnthalpyL[i] for i in 1:nComp); outMol.energyGF + inMass.energyLF = 0; // Specific (per mass) enthalpy of the liquid components for i in 1:nComp loop massEnthalpyL[i] = massEnthalpyLRef[i] + CpCoefML[i,1] * ( tempF - tempRef) + CpCoefML[i,2] * 1/2 * ( tempF^ 2 - tempRef^ 2) + CpCoefML[i,3] * 1/3 * ( tempF^ 3 - tempRef^ 3) + CpCoefML[i,4] * 1/4 * ( tempF^ 4 - tempRef^ 4) + CpCoefML[i,5] * 1/5 * ( tempF^ 5 - tempRef^ 5) + CpCoefML[i,6] * 1/6 * ( tempF^ 6 - tempRef^ 6) + CpCoefML[i,7] * 1/7 * ( tempF^ 7 - tempRef^ 7); end for; // Molar enthalpy of the liquid components for i in 1:nComp loop molEnthalpyG[i] = molEnthalpyGRef[i] + CpCoefNG[i,1] * ( tempF - tempRef) + CpCoefNG[i,2] * 1/2 * ( tempF^ 2 - tempRef^ 2) + CpCoefNG[i,3] * 1/3 * ( tempF^ 3 - tempRef^ 3) + CpCoefNG[i,4] * 1/4 * ( tempF^ 4 - tempRef^ 4) + CpCoefNG[i,5] * 1/5 * ( tempF^ 5 - tempRef^ 5) + CpCoefNG[i,6] * 1/6 * ( tempF^ 6 - tempRef^ 6) + CpCoefNG[i,7] * 1/7 * ( tempF^ 7 - tempRef^ 7); end for; // Change-of-phase heat per mass unit // Positive: boiling of a mass unit of liquid mixture // Negative: condensation of a mass unit of the vapor mixture massHeatPhaseChg = ( -sum(outMol.molGF[i] * molEnthalpyG[i] for i in 1:nComp) - sum(inMass.massLF[i] * massEnthalpyL[i] for i in 1:nComp)) / ( totalMassF + eps); end phaseChgB;
Type | Name | Default | Description |
---|---|---|---|
Integer | evapComp | Number of the component whose vapor pressure is set | |
Integer | nComp | 1 | Number of components |
Real | molEnthalpyRef | 0 | Molar enthalpy of the component at the reference temperature [M.L2.t-2.mol-1] |
Real | tempRef | 298 | Reference temperature for the enthalpy [T] |
Real | CpCoefN[1, 7] | Coefficients of the molar heat capacity at constant pressure, of the evapComp component Cp = CpCoefN(1,1) + CpCoefN(1,2)*T + ... | |
Real | Kprop | 1E4 | Coefficient relating the molar flow of the evapComp component and the pressure difference [mol.L.t.M-1] |
Real | eps | 1E-4 | Small constant to avoid by-zero division |
Type | Name | Description |
---|---|---|
cutGasR | inMol | Gas flow - Connector Resistive |
cutReceiver | setPointSignal | Setpoint signals [vaporPressSP, tempEvapSP] |
model vapPressB "Boundary condition for the partial pressure of one of the component of a gas mixture" parameter Integer evapComp "Number of the component whose vapor pressure is set"; extends JARA2i.interf.gasFlow1I; cutsB.cutReceiver setPointSignal( dim=2, signal={vaporPressSP,tempEvapSP}) "Setpoint signals [vaporPressSP, tempEvapSP]"; Real vaporPressSP( unit="M.L-1.t-2") "Vapor-pressure setpoint for the evapComp component"; Real tempEvapSP( unit="T") "Temperature of the component flowing into the control volume"; parameter Real molEnthalpyRef( unit="M.L2.t-2.mol-1") = 0 "Molar enthalpy of the component at the reference temperature"; parameter Real tempRef( unit="T") = 298 "Reference temperature for the enthalpy"; parameter Real CpCoefN[ 1,7] "Coefficients of the molar heat capacity at constant pressure, of the evapComp component Cp = CpCoefN(1,1) + CpCoefN(1,2)*T + ..."; parameter Real Kprop( unit="mol.L.t.M-1") = 1E4 "Coefficient relating the molar flow of the evapComp component and the pressure difference"; parameter Real eps = 1E-4 "Small constant to avoid by-zero division"; protected Real pressErr( unit="M.L-1.t-2") "Difference between the parcial-pressure setpoint and its actual value"; Real vaporPress( unit="M.L-1.t-2") "Partial pressure of the evapComp component"; Real aux[nComp+2] "Dummy variables"; Real dummy1 "Dummy variable"; Real dummy2 "Dummy variable"; Real molEnthalpy( unit="M.L2.t-2.mol-1") "Molar enthalpy of the evapComp component"; Real tempF( unit="T") "Temperature of the evapComp-component flow"; Boolean flowIsPosit "Direction of the evapComp-component flow"; equation // Vapor pressure of the evapComp component vaporPress = inMol.pressG * inMol.molG[evapComp] / ( sum(inMol.molG[i] for i in 1:nComp) + eps); // Difference between the vapor-pressure setpoint and its actual value pressErr = vaporPressSP + eps - vaporPress; // Flow of the evapComp component inMol.molGF[evapComp] = - Kprop * pressErr; // The flow of all the other components is zero aux = { dummy1, inMol.molGF, dummy2}; aux[1:evapComp] = 0; aux[(evapComp+2):(nComp+2)] = 0; // Molar enthalpy of the evapComp component for i in 1:nComp loop molEnthalpy[i] = molEnthalpyRef[i] + sum( CpCoefN[i,j] * 1/j * ( tempF^ j - tempRef^ j) for j in 1:7); end for; // Enthalpy flow inMol.energyGF = inMol.molGF[evapComp] * molEnthalpy; // Flow temperture flowIsPosit = inMol.molGF[evapComp] / ( abs( inMol.molGF[evapComp]) + eps); tempF = 0.5 * ( 1 + flowIsPosit) * inMol.tempG - 0.5 * ( flowIsPosit -1) * tempEvapSP; end vapPressB;