This package contains some models of liquid control volumes (CVs), liquid mixtures TP (e.g., liquid-flow by convection, valves, pumps, etc.) and boundary conditions (i.e., liquid-flow and pressure sources).
The mixtures of liquids are considered ideal and they can be composed of an arbitrary number of components.
Name | Description |
---|---|
![]() | Dynamic linear-momentum balance. Circular pipe with a smooth wall |
![]() | Steady-state balance of linear momentum. Circular pipe with smooth wall and full of liquid |
![]() | Partial model: convective flow of liquid. |
![]() | Model of the flow junction |
![]() | Control volume containing a liquid mixture. |
![]() | Control volume containing a liquid mixture. The pressure on the liquid surface is constant. |
![]() | Liquid mixture contained in a control volume in mechanical equilibrium with a gas whose properties are not modeled. |
![]() | Partial model - Dynamic balance of linear momentum |
![]() | Steady-state balance of linear momentum |
![]() | Liquid flowing through a pipe |
![]() | Partial model: liquid pump |
![]() | Liquid pump. Setpoint: mass flow |
![]() | Liquid pump. Setpoint: molar flow |
![]() | Liquid pump. Setpoint: volumetric flow |
![]() | Partial model: liquid source |
![]() | Liquid source. Setpoints: total mass, mass fraction and temperature |
![]() | Liquid source. Setpoints: total molar flow, molar fraction and temperature. |
![]() | Pressure source. |
![]() | Liquid source. Setpoints: total volumetric flow, volume fraction and temperature. |
![]() | Vessel with a constant volume. |
CpCoefM[nComp,7] | Coefficients of the specific (per mass) heat capacity CpM[i] = CpCoefM[i,1] + CpCoefM[i,2]*T + ... + CpCoefM[i,7]*T**6. |
massEnthalpyRef[nComp] | Specific (per mass) enthalpy at the reference temperature. |
tempRef | Reference temperature for the enthalpy. |
Type | Name | Default | Description |
---|---|---|---|
Integer | nComp | 1 | Number of components |
Boolean | Ejs | false | Global parameter - Runtime interactivity |
Boolean | Sysquake | false | Global parameter - Batch interactivity |
Real | CpCoefMInitial[nComp, 7] | Coefficients of the specific (per mass) heat capacity CpM[i] = CpCoefM[i,1] + CpCoefM[i,2]*T + ... + CpCoefM[i,7]*T**6 | |
Real | massEnthalpyRefInitial[nComp] | zeros(nComp) | Specific (per mass) enthalpy at the reference temperature [L2.t-2] |
Real | tempRefInitial | 298 | Reference temperature for the enthalpy [T] |
Real | eps | 1.E-6 | Small constant to avoid by-zero division |
Real | length | Pipe length [L] | |
Real | section | Pipe cross-section [L2] | |
Real | wettedArea | Wetted pipe surface [L2] | |
Real | heigthI | 0 | Heigth of the input control plane [L] |
Real | heigthO | 0 | Heigth of the input control plane [L] |
Real | density[nComp] | Density of the components [M.L-3] | |
Real | g | 9.8 | Gravitational acceleration [L.t-2] |
Real | epsMomentum | 1 | Coefficient of the fluid inertia |
Real | lamReynolds | 2100 | Critical value of the Reynolds number |
Real | turReynolds | 2500 | Critical value of the Reynolds number |
Real | radiusPipe | (section/3.141592)^0.5 | Pipe radius [L] |
Type | Name | Description |
---|---|---|
cutLiquidR | inMass | Liquid flow connector - R |
cutLiquidR | outMass | Liquid flow connector - R |
cutHeatFC | inHeat | Heat flow connector -C |
cutReceiver | setPointSignal |
model circSmoothPipeDynLiqB "Dynamic linear-momentum balance. Circular pipe with a smooth wall" extends pipeDynLiqB; parameter Real lamReynolds( unit="") = 2100 "Critical value of the Reynolds number"; parameter Real turReynolds( unit="") = 2500 "Critical value of the Reynolds number"; parameter Real radiusPipe( unit="L") = ( section / 3.141592)^ 0.5 "Pipe radius"; protected Real viscosity( unit="M.L-1.t-1") "Viscosity of the liquid mixture"; Real reynolds( unit="") "Reynolds number"; Boolean laminar( start = true) "True: while laminar regime"; Boolean turbulent( start = false) "True: while turbulent regime"; equation // Reynolds number reynolds = 2 * radiusPipe * ( abs(veloc) + eps) * fluidDensity / ( viscosity + eps); // Flow regime laminar = reynolds < lamReynolds; turbulent = reynolds > turReynolds; // Fanning friction factor. Blasius equation for the turbulent regime fanning = if laminar then 16 / ( abs(reynolds) + eps) else if turbulent then 0.0791 / ( abs(reynolds)^ 0.25 + eps) else ( 16 / lamReynolds - 0.0791 / turReynolds^ 0.25) / ( lamReynolds - turReynolds) * reynolds + ( 0.0791 / turReynolds^ 0.25 * lamReynolds - 16 / lamReynolds * turReynolds) / ( lamReynolds - turReynolds); end circSmoothPipeDynLiqB;
CpCoefM[nComp,7] | Coefficients of the specific (per mass) heat capacity CpM[i] = CpCoefM[i,1] + CpCoefM[i,2]*T + ... + CpCoefM[i,7]*T**6. |
massEnthalpyRef[nComp] | Specific (per mass) enthalpy at the reference temperature. |
tempRef | Reference temperature for the enthalpy. |
Type | Name | Default | Description |
---|---|---|---|
Integer | nComp | 1 | Number of components |
Boolean | Ejs | false | Global parameter - Runtime interactivity |
Boolean | Sysquake | false | Global parameter - Batch interactivity |
Real | CpCoefMInitial[nComp, 7] | Coefficients of the specific (per mass) heat capacity CpM[i] = CpCoefM[i,1] + CpCoefM[i,2]*T + ... + CpCoefM[i,7]*T**6 | |
Real | massEnthalpyRefInitial[nComp] | zeros(nComp) | Specific (per mass) enthalpy at the reference temperature [L2.t-2] |
Real | tempRefInitial | 298 | Reference temperature for the enthalpy [T] |
Real | eps | 1.E-6 | Small constant to avoid by-zero division |
Real | length | Pipe length [L] | |
Real | section | Pipe cross-section [L2] | |
Real | wettedArea | Wetted pipe surface [L2] | |
Real | heigthI | 0 | Heigth of the input control plane [L] |
Real | heigthO | 0 | Heigth of the input control plane [L] |
Real | density[nComp] | Density of the components [M.L-3] | |
Real | g | 9.8 | Gravitational acceleration [L.t-2] |
Real | lamReynolds | 2100 | Critical value of the Reynolds number |
Real | turReynolds | 2500 | Critical value of the Reynolds number |
Real | radiusPipe | (section/3.141592)^0.5 | Pipe radius [L] |
Type | Name | Description |
---|---|---|
cutLiquidR | inMass | Liquid flow connector - R |
cutLiquidR | outMass | Liquid flow connector - R |
cutHeatFC | inHeat | Heat flow connector -C |
cutReceiver | setPointSignal |
model circSmoothPipeStatLiqB "Steady-state balance of linear momentum. Circular pipe with smooth wall and full of liquid" extends pipeStatLiqB; parameter Real lamReynolds( unit="") = 2100 "Critical value of the Reynolds number"; parameter Real turReynolds( unit="") = 2500 "Critical value of the Reynolds number"; parameter Real radiusPipe( unit="L") = ( section / 3.141592)^ 0.5 "Pipe radius"; protected Real viscosity( unit="M.L-1.t-1") "Viscosity of the liquid mixture"; Real reynolds( unit="") "Reynolds number"; Boolean laminar( start = true) "True: while laminar regime"; Boolean turbulent( start = false) "True: while turbulent regime"; equation // Reynolds number reynolds = 2 * radiusPipe * ( abs(veloc) + eps) * fluidDensity / ( viscosity + eps); // Flow regime laminar = reynolds < lamReynolds; turbulent = reynolds > turReynolds; // Fanning adimensional factor. Blasius equation for turbulent flow fanning = if laminar then 16 / ( abs(reynolds) + eps) else if turbulent then 0.0791 / ( abs(reynolds)^ 0.25 + eps) else ( 16 / lamReynolds - 0.0791 / turReynolds^ 0.25) / ( lamReynolds - turReynolds) * reynolds + ( 0.0791 / turReynolds^ 0.25 * lamReynolds - 16 / lamReynolds * turReynolds) / ( lamReynolds - turReynolds); end circSmoothPipeStatLiqB;
CpCoefM[nComp,7] | Coefficients of the specific (per mass) heat capacity CpM[i] = CpCoefM[i,1] + CpCoefM[i,2]*T + ... + CpCoefM[i,7]*T**6. |
massEnthalpyRef[nComp] | Specific (per mass) enthalpy at the reference temperature. |
tempRef | Reference temperature for the enthalpy. |
Type | Name | Default | Description |
---|---|---|---|
Integer | nComp | 1 | Number of components |
Boolean | Ejs | false | Global parameter - Runtime interactivity |
Boolean | Sysquake | false | Global parameter - Batch interactivity |
Real | CpCoefMInitial[nComp, 7] | Coefficients of the specific (per mass) heat capacity CpM[i] = CpCoefM[i,1] + CpCoefM[i,2]*T + ... + CpCoefM[i,7]*T**6 | |
Real | massEnthalpyRefInitial[nComp] | zeros(nComp) | Specific (per mass) enthalpy at the reference temperature [L2.t-2] |
Real | tempRefInitial | 298 | Reference temperature for the enthalpy [T] |
Real | eps | 1.E-6 | Small constant to avoid by-zero division |
Type | Name | Description |
---|---|---|
cutLiquidR | inMass | Liquid flow connector - R |
cutLiquidR | outMass | Liquid flow connector - R |
cutHeatFC | inHeat | Heat flow connector -C |
partial model convecLiqFlowB "Partial model: convective flow of liquid." extends interf.liqFlow2qI; // Interactivity outer parameter Boolean Ejs = false "Global parameter - Runtime interactivity"; outer parameter Boolean Sysquake = false "Global parameter - Batch interactivity"; parameter Real CpCoefMInitial[nComp,7] "Coefficients of the specific (per mass) heat capacity CpM[i] = CpCoefM[i,1] + CpCoefM[i,2]*T + ... + CpCoefM[i,7]*T**6"; parameter Real massEnthalpyRefInitial[nComp]( unit="L2.t-2") = zeros(nComp) "Specific (per mass) enthalpy at the reference temperature"; parameter Real tempRefInitial( unit="T") = 298 "Reference temperature for the enthalpy"; parameter Real eps( unit="") = 1.E-6 "Small constant to avoid by-zero division"; // Interactive variables Real CpCoefM[nComp,7]( start=CpCoefMInitial) "Coefficients of the specific (per mass) heat capacity CpM[i] = CpCoefM[i,1] + CpCoefM[i,2]*T + ... + CpCoefM[i,7]*T**6"; Real massEnthalpyRef[nComp]( unit="L2.t-2",start=massEnthalpyRefInitial) "Specific (per mass) enthalpy at the reference temperature"; Real tempRef( unit="T",start=tempRefInitial) "Reference temperature for the enthalpy"; protected Real totalMassF( unit="M.t-1") "Total mass flow"; Boolean flowIsPosit( start=true) "Flow direction"; Real totalMassI( unit="M") "Total mass"; Real totalMassO( unit="M") "Total mass"; Real massEnthalpy[ nComp]( unit="L2.t-2") "Specific (per mass) enthalpy of each component"; equation // Ejs if Ejs then for i in 1:nComp loop for j in 1:7 loop der(CpCoefM[i,j]) = 0; end for; end for; for i in 1:nComp loop der(massEnthalpyRef[i]) = 0; end for; der(tempRef) = 0; end if; // Sysquake if Sysquake then CpCoefM = CpCoefMInitial; massEnthalpyRef = massEnthalpyRefInitial; tempRef = tempRefInitial; end if; // Relationship among the interface variables for i in 1:nComp loop inMass.massLF[i] + outMass.massLF[i] = 0; end for; inMass.massLF = inHeat.matterF; outMass.energyLF + inMass.energyLF + inHeat.heatF = 0; // Mass flow direction flowIsPosit = totalMassF > 0; // Total mass totalMassI = sum(inMass.massL[i] for i in 1:nComp); totalMassO = sum(outMass.massL[i] for i in 1:nComp); // Flow composition if nComp > 1 then for i in 1:(nComp-1) loop inHeat.matterF[i] = if flowIsPosit then totalMassF * inMass.massL[i] / ( totalMassI + eps) else totalMassF * outMass.massL[i] / ( totalMassO + eps); end for; end if; // Total mass flow totalMassF = sum(inHeat.matterF[i] for i in 1:nComp); // Flow temperature inHeat.tempF = if flowIsPosit then inMass.tempL else outMass.tempL; // Molar internal energy as a function of the temperature for i in 1:nComp loop massEnthalpy[i] = massEnthalpyRef[i] + CpCoefM[i,1] * ( inHeat.tempF - tempRef) + CpCoefM[i,2] * 1/2 * ( inHeat.tempF^ 2 - tempRef^ 2) + CpCoefM[i,3] * 1/3 * ( inHeat.tempF^ 3 - tempRef^ 3) + CpCoefM[i,4] * 1/4 * ( inHeat.tempF^ 4 - tempRef^ 4) + CpCoefM[i,5] * 1/5 * ( inHeat.tempF^ 5 - tempRef^ 5) + CpCoefM[i,6] * 1/6 * ( inHeat.tempF^ 6 - tempRef^ 6) + CpCoefM[i,7] * 1/7 * ( inHeat.tempF^ 7 - tempRef^ 7); end for; // Energy flow sum(inHeat.matterF[i] * massEnthalpy[i] for i in 1:nComp) = if flowIsPosit then inMass.energyLF else -outMass.energyLF; end convecLiqFlowB;
Type | Name | Default | Description |
---|---|---|---|
Integer | nComp | 1 | Number of components of the liquid mixture |
Real | sectionInitial | 1 | Cross-section of the vessel [L2] |
Real | g | 9.8 | Gravitatorial acceleration [L.t-2] |
Real | angle | 1.5707963 | Angle with the horizontal [rad] |
Real | eps | 1.E-6 | Small constant to avoid by-zero division |
Real | CpCoefMInitial[nComp, 7] | Coefficients of the specific (per mass) heat capacity CpM[i] = CpCoefM[i,1] + CpCoefM[i,2]*T + ... + CpCoefM[i,7]*T**6 | |
Real | densityInitial[nComp] | Density of the pure components [M.L-3] | |
Real | massEnthalpyRefInitial[nComp] | zeros(nComp) | Specific (per mass) enthalpy at the reference temperature [L2.t-2] |
Real | tempRefInitial | 298 | Reference temperature for the enthalpy [T] |
Real | percentVolSmallStep | 0.9 | Proportion of the vessel volume that triggers the reduction in the integration step-size |
Real | compressCoef | 1.E-8 | Numeric compressibility coefficient [L.t2.M-1] |
Real | pressTopRef | 0 | Pressure on the liquid surface [M.L-1.t-2] |
Real | vesselVolumeInitial | 1 | Vessel volume [L3] |
Real | massLinitial[nComp] | Initial condition [M] | |
Real | tempLinitial | Initial condition [T] |
Type | Name | Description |
---|---|---|
cutLiquidC | inMass | Connector for the liquid flow |
model junctLiqCp6PrefB "Model of the flow junction" extends interf.liquid1I; parameter Real sectionInitial( unit="L2") = 1 "Cross-section of the vessel"; parameter Real g( unit="L.t-2") = 9.8 "Gravitatorial acceleration"; parameter Real angle( unit="rad") = 1.5707963 "Angle with the horizontal"; parameter Real eps( unit="") = 1.E-6 "Small constant to avoid by-zero division"; parameter Real CpCoefMInitial[nComp,7] "Coefficients of the specific (per mass) heat capacity CpM[i] = CpCoefM[i,1] + CpCoefM[i,2]*T + ... + CpCoefM[i,7]*T**6"; parameter Real densityInitial[nComp]( unit="M.L-3") "Density of the pure components"; parameter Real massEnthalpyRefInitial[nComp]( unit="L2.t-2") = zeros(nComp) "Specific (per mass) enthalpy at the reference temperature"; parameter Real tempRefInitial( unit="T") = 298 "Reference temperature for the enthalpy"; parameter Real percentVolSmallStep( unit="") = 0.9 "Proportion of the vessel volume that triggers the reduction in the integration step-size"; parameter Real compressCoef( unit="L.t2.M-1") = 1.E-8 "Numeric compressibility coefficient"; parameter Real pressTopRef( unit="M.L-1.t-2") = 0 "Pressure on the liquid surface"; parameter Real vesselVolumeInitial( unit="L3") = 1 "Vessel volume"; parameter Real massLinitial[ nComp]( unit="M") "Initial condition"; parameter Real tempLinitial( unit="T") "Initial condition"; liquidCp6PrefB liquid( nComp=nComp,sectionInitial=sectionInitial,g=g,angle=angle,eps=eps, CpCoefMInitial=CpCoefMInitial,tempRefInitial=tempRefInitial, massEnthalpyRefInitial=massEnthalpyRefInitial, densityInitial = densityInitial, compressCoef=compressCoef,percentVolSmallStep=percentVolSmallStep, pressTopReference=pressTopRef, massLinitial=massLinitial, tempLinitial=tempLinitial); vesselLiqB vessel( vesselVolumeInitial=vesselVolumeInitial); equation connect( liquid.constraintV, vessel.constraintV); connect( liquid.inMassBot, inMass); end junctLiqCp6PrefB;
section | Cross-section of the vessel. |
density[nComp] | Density of the pure components. |
massEnthalpyRef[nComp] | Specific (per mass) enthalpy at the reference temperature. |
tempRef | Reference temperature for the enthalpy. |
CpCoefM[nComp,7] | Coefficients of the specific (per mass) heat capacity CpM[i] = CpCoefM[i,1] + CpCoefM[i,2]*T + ... + CpCoefM[i,7]*T**6. |
Type | Name | Default | Description |
---|---|---|---|
Integer | nComp | 1 | Number of components |
Boolean | Ejs | false | Global parameter - Runtime interactivity |
Boolean | Sysquake | false | Global parameter - Batch interactivity |
Real | massLinitial[nComp] | Initial condition - Mass inside the CV [M] | |
Real | tempLinitial | Initial condition - Temperature of the CV [T] | |
Real | sectionInitial | 1 | Initial cross-section of the vessel [L2] |
Real | g | 9.8 | Gravitatorial acceleration [L.t-2] |
Real | angle | 1.5707963 | Angle with the horizontal [rad] |
Real | eps | 1.E-6 | Small constant to avoid by-zero division |
Real | CpCoefMInitial[nComp, 7] | Coefficients of the specific (per mass) heat capacity CpM[i] = CpCoefM[i,1] + CpCoefM[i,2]*T + ... + CpCoefM[i,7]*T**6 | |
Real | densityInitial[nComp] | Density of the pure components [M.L-3] | |
Real | massEnthalpyRefInitial[nComp] | zeros(nComp) | Specific (per mass) enthalpy at the reference temperature [L2.t-2] |
Real | tempRefInitial | 298 | Reference temperature for the enthalpy [T] |
Real | percentVolSmallStep | 0.9 | Proportion of the vessel volume that triggers the reduction in the integration step-size |
Real | compressCoef | 1.E-8 | Numeric compressibility coefficient [L.t2.M-1] |
Type | Name | Description |
---|---|---|
cutLiquidC | inMassTop | Connector for the liquid flow |
cutLiquidC | inMassBot | Connector for the liquid flow |
cutHeatMC | inHeat | Connector for the heat flow |
cutVolConstrLiq | constraintV | Connector for the volume constraint - Liquid |
model liquidCp6B "Control volume containing a liquid mixture." extends interf.liquidV2I; // Interactivity outer parameter Boolean Ejs = false "Global parameter - Runtime interactivity"; outer parameter Boolean Sysquake = false "Global parameter - Batch interactivity"; parameter Real massLinitial[ nComp]( unit="M") "Initial condition - Mass inside the CV"; parameter Real tempLinitial( unit="T") "Initial condition - Temperature of the CV"; parameter Real sectionInitial( unit="L2") = 1 "Initial cross-section of the vessel"; parameter Real g( unit="L.t-2") = 9.8 "Gravitatorial acceleration"; parameter Real angle( unit="rad") = 1.5707963 "Angle with the horizontal"; parameter Real eps( unit="") = 1.E-6 "Small constant to avoid by-zero division"; parameter Real CpCoefMInitial[nComp,7] "Coefficients of the specific (per mass) heat capacity CpM[i] = CpCoefM[i,1] + CpCoefM[i,2]*T + ... + CpCoefM[i,7]*T**6"; parameter Real densityInitial[nComp]( unit="M.L-3") "Density of the pure components"; parameter Real massEnthalpyRefInitial[nComp]( unit="L2.t-2") = zeros(nComp) "Specific (per mass) enthalpy at the reference temperature"; parameter Real tempRefInitial( unit="T") = 298 "Reference temperature for the enthalpy"; parameter Real percentVolSmallStep( unit="") = 0.9 "Proportion of the vessel volume that triggers the reduction in the integration step-size"; parameter Real compressCoef( unit="L.t2.M-1")= 1.E-8 "Numeric compressibility coefficient"; Real massL[nComp]( unit="M", start=massLinitial, fixed=true) "Liquid mass inside the CV"; Real tempL( unit="K", start=tempLinitial, fixed=true) "Water temperature"; Real section( unit="L2", start=sectionInitial) "Cross-section of the vessel"; Real CpCoefM[nComp,7]( start=CpCoefMInitial) "Coefficients of the specific (per mass) heat capacity CpM[i] = CpCoefM[i,1] + CpCoefM[i,2]*T + ... + CpCoefM[i,7]*T**6"; Real density[nComp]( unit="M.L-3", start=densityInitial) "Density of the pure components"; Real massEnthalpyRef[nComp]( unit="L2.t-2", start=massEnthalpyRefInitial) "Specific (per mass) enthalpy at the reference temperature"; Real tempRef( unit="T", start=tempRefInitial) "Reference temperature for the enthalpy"; Real liqHeight( unit="L") "Liquid level"; Real fluidV( unit="L3") "Liquid volume"; Boolean isFull( start=false) "Is the vessel full of liquid?"; protected Real dEnthalpy( unit="M.L2.t-3") "Derivative of the total enthalpy"; Real massEnthalpy[ nComp]( unit="L2.t-2") "Specific (per mass) enthalpy of each component"; Real fluidVun( unit="L3") "Fluid volume (unbounded)"; Real parcFluidV[ nComp]( unit="L3") "Volume of each component"; Real dummyFrec( start=0, fixed=true) "Dummy variable"; Boolean integStepIsSmall( start=false, fixed=true) "Control of the integration step-size"; Real timeScale( unit="T", start=1) "Control of the integration step-size"; Real aux[ nComp]; Real vesselV "Vessel volume"; Real pressTopRef "Pressure at the liquid surface"; equation // Ejs if Ejs then der(section) = 0; for i in 1:nComp loop der(density[i]) = 0; der(massEnthalpyRef[i]) = 0; end for; der(tempRef) = 0; for i in 1:nComp loop for j in 1:7 loop der(CpCoefM[i,j]) = 0; end for; end for; end if; // Sysquake if Sysquake then section = sectionInitial; density = densityInitial; massEnthalpyRef = massEnthalpyRefInitial; tempRef = tempRefInitial; CpCoefM = CpCoefMInitial; end if; // Variables of the volume constraint connector vesselV = constraintV.vcE[1]; pressTopRef = constraintV.vcE[3]; fluidV = constraintV.vcF; // Relationship among the interface variables inMassTop.massL = massL; inMassBot.massL = massL; inHeat.matter = massL; inMassTop.tempL = tempL; inMassBot.tempL = tempL; inHeat.temp = tempL; // Mass balance der(massL) = inMassTop.massLF + inMassBot.massLF; // Energy balance dEnthalpy = inMassBot.energyLF + inMassTop.energyLF + inHeat.heatF; // Specific (per mass) internal energy of each component for i in 1:nComp loop massEnthalpy[i] = massEnthalpyRef[i] + CpCoefM[i,1] * ( ( inHeat.temp + eps) - tempRef) + CpCoefM[i,2] * 1/2 * ( ( inHeat.temp + eps)^ 2 - tempRef^ 2) + CpCoefM[i,3] * 1/3 * ( ( inHeat.temp + eps)^ 3 - tempRef^ 3) + CpCoefM[i,4] * 1/4 * ( ( inHeat.temp + eps)^ 4 - tempRef^ 4) + CpCoefM[i,5] * 1/5 * ( ( inHeat.temp + eps)^ 5 - tempRef^ 5) + CpCoefM[i,6] * 1/6 * ( ( inHeat.temp + eps)^ 6 - tempRef^ 6) + CpCoefM[i,7] * 1/7 * ( ( inHeat.temp + eps)^ 7 - tempRef^ 7); end for; for i in 1:nComp loop aux[i] = CpCoefM[i,1] + CpCoefM[i,2] * inHeat.temp + CpCoefM[i,3] * inHeat.temp^ 2 + CpCoefM[i,4] * inHeat.temp^ 3 + CpCoefM[i,5] * inHeat.temp^ 4 + CpCoefM[i,6] * inHeat.temp^ 5 + CpCoefM[i,7] * inHeat.temp^ 6; end for; dEnthalpy = sum((inMassTop.massLF[i] + inMassBot.massLF[i]) * massEnthalpy[i] for i in 1:nComp) + sum((inHeat.matter[i] + eps) * aux[i] for i in 1:nComp) * der(tempL); // Volume of each component. Total volume for i in 1:nComp loop parcFluidV[i] * density[i] = inHeat.matter[i]; end for; fluidVun = sum(parcFluidV[i] for i in 1:nComp); fluidV = if isFull then vesselV else fluidVun; // Liquid heigth liqHeight = fluidV / section; // Is the control volume full of liquid? isFull = fluidVun > vesselV; // The integration step-size is reduced when the liquid volume is close to the vessel volume when pre(integStepIsSmall) and fluidVun < percentVolSmallStep * vesselV or not pre(integStepIsSmall) and not fluidVun < percentVolSmallStep * vesselV then timeScale = if pre(integStepIsSmall) and fluidVun < percentVolSmallStep * vesselV then 1 else compressCoef; integStepIsSmall = not pre(integStepIsSmall); end when; der(dummyFrec) = sin(time / timeScale); // Pressure at the liquid bottom inMassBot.pressL = g * sum(inHeat.matter[i] for i in 1:nComp) * sin(angle) / section + inMassTop.pressL; // Pressure at the liquid surface (upper part of the liquid) inMassTop.pressL = if isFull then ( fluidVun / vesselV - 1) / compressCoef else pressTopRef; end liquidCp6B;
section | Cross-section of the vessel. |
density[nComp] | Density of the pure components. |
massEnthalpyRef[nComp] | Specific (per mass) enthalpy at the reference temperature. |
tempRef | Reference temperature for the enthalpy. |
CpCoefM[nComp,7] | Coefficients of the specific (per mass) heat capacity CpM[i] = CpCoefM[i,1] + CpCoefM[i,2]*T + ... + CpCoefM[i,7]*T**6. |
Type | Name | Default | Description |
---|---|---|---|
Integer | nComp | 1 | Number of components |
Boolean | Ejs | false | Global parameter - Runtime interactivity |
Boolean | Sysquake | false | Global parameter - Batch interactivity |
Real | massLinitial[nComp] | Initial condition - Mass inside the CV [M] | |
Real | tempLinitial | Initial condition - Temperature of the CV [T] | |
Real | sectionInitial | 1 | Initial cross-section of the vessel [L2] |
Real | g | 9.8 | Gravitatorial acceleration [L.t-2] |
Real | angle | 1.5707963 | Angle with the horizontal [rad] |
Real | eps | 1.E-6 | Small constant to avoid by-zero division |
Real | CpCoefMInitial[nComp, 7] | Coefficients of the specific (per mass) heat capacity CpM[i] = CpCoefM[i,1] + CpCoefM[i,2]*T + ... + CpCoefM[i,7]*T**6 | |
Real | densityInitial[nComp] | Density of the pure components [M.L-3] | |
Real | massEnthalpyRefInitial[nComp] | zeros(nComp) | Specific (per mass) enthalpy at the reference temperature [L2.t-2] |
Real | tempRefInitial | 298 | Reference temperature for the enthalpy [T] |
Real | percentVolSmallStep | 0.9 | Proportion of the vessel volume that triggers the reduction in the integration step-size |
Real | compressCoef | 1.E-8 | Numeric compressibility coefficient [L.t2.M-1] |
Real | pressTopReference | 0 | Pressure on the liquid surface [M.L-1.t-2] |
Type | Name | Description |
---|---|---|
cutLiquidC | inMassTop | Connector for the liquid flow |
cutLiquidC | inMassBot | Connector for the liquid flow |
cutHeatMC | inHeat | Connector for the heat flow |
cutVolConstrLiq | constraintV | Connector for the volume constraint - Liquid |
model liquidCp6PrefB "Control volume containing a liquid mixture. The pressure on the liquid surface is constant." extends liquidCp6B; parameter Real pressTopReference( unit="M.L-1.t-2") = 0 "Pressure on the liquid surface"; equation pressTopRef = pressTopReference; end liquidCp6PrefB;
This class models a liquid mixture.
Type | Name | Default | Description |
---|---|---|---|
Integer | nComp | 1 | Number of components of the liquid mixture |
Real | sectionInitial | 1 | Initial cross-section of the vessel [L2] |
Real | g | 9.8 | Gravitatorial acceleration [L.t-2] |
Real | angle | 1.5707963 | Angle with the horizontal [rad] |
Real | eps | 1.E-6 | Small constant to avoid by-zero division |
Real | CpCoefMInitial[nComp, 7] | Coefficients of the specific (per mass) heat capacity CpM[i] = CpCoefM[i,1] + CpCoefM[i,2]*T + ... + CpCoefM[i,7]*T**6 | |
Real | densityInitial[nComp] | Density of the pure components [M.L-3] | |
Real | massEnthalpyRefInitial[nComp] | zeros(nComp) | Specific (per mass) enthalpy at the reference temperature [L2.t-2] |
Real | tempRefInitial | 298 | Reference temperature for the enthalpy [T] |
Real | percentVolSmallStep | 0.9 | Proportion of the vessel volume that triggers the reduction in the integration step-size |
Real | compressCoef | 1.E-8 | Numeric compressibility coefficient [L.t2.M-1] |
Real | pressTopReference | 0 | Pressure on the liquid surface [M.L-1.t-2] |
Real | vesselVolumeInitial | 1 | Initial vessel volume [L3] |
Real | massLinitial[nComp] | Initial condition [M] | |
Real | tempLinitial | Initial condition [T] |
Type | Name | Description |
---|---|---|
cutLiquidC | inMassTop | Connector for the liquid flow |
cutLiquidC | inMassBot | Connector for the liquid flow |
cutHeatMC | inHeat | Connector for the heat flow |
model liquidCp6PrefVB "Liquid mixture contained in a control volume in mechanical equilibrium with a gas whose properties are not modeled." extends interf.liquid2I; parameter Real sectionInitial( unit="L2") = 1 "Initial cross-section of the vessel"; parameter Real g( unit="L.t-2") = 9.8 "Gravitatorial acceleration"; parameter Real angle( unit="rad") = 1.5707963 "Angle with the horizontal"; parameter Real eps( unit="") = 1.E-6 "Small constant to avoid by-zero division"; parameter Real CpCoefMInitial[nComp,7] "Coefficients of the specific (per mass) heat capacity CpM[i] = CpCoefM[i,1] + CpCoefM[i,2]*T + ... + CpCoefM[i,7]*T**6"; parameter Real densityInitial[nComp]( unit="M.L-3") "Density of the pure components"; parameter Real massEnthalpyRefInitial[nComp]( unit="L2.t-2") = zeros(nComp) "Specific (per mass) enthalpy at the reference temperature"; parameter Real tempRefInitial( unit="T") = 298 "Reference temperature for the enthalpy"; parameter Real percentVolSmallStep( unit="") = 0.9 "Proportion of the vessel volume that triggers the reduction in the integration step-size"; parameter Real compressCoef( unit="L.t2.M-1") = 1.E-8 "Numeric compressibility coefficient"; parameter Real pressTopReference( unit="M.L-1.t-2") = 0 "Pressure on the liquid surface"; parameter Real vesselVolumeInitial( unit="L3") = 1 "Initial vessel volume"; parameter Real massLinitial[ nComp]( unit="M") "Initial condition"; parameter Real tempLinitial( unit="T") "Initial condition"; liquidCp6PrefB liquid( nComp=nComp,sectionInitial=sectionInitial,g=g,angle=angle,eps=eps, CpCoefMInitial=CpCoefMInitial, tempRefInitial=tempRefInitial, massEnthalpyRefInitial=massEnthalpyRefInitial, densityInitial = densityInitial, compressCoef=compressCoef,percentVolSmallStep=percentVolSmallStep, pressTopReference=pressTopReference, massLinitial=massLinitial, tempLinitial=tempLinitial); vesselLiqB vessel( vesselVolumeInitial=vesselVolumeInitial); equation connect( liquid.constraintV, vessel.constraintV); connect( liquid.inMassTop, inMassTop); connect( liquid.inMassBot, inMassBot); connect( liquid.inHeat, inHeat); end liquidCp6PrefVB;
CpCoefM[nComp,7] | Coefficients of the specific (per mass) heat capacity CpM[i] = CpCoefM[i,1] + CpCoefM[i,2]*T + ... + CpCoefM[i,7]*T**6. |
massEnthalpyRef[nComp] | Specific (per mass) enthalpy at the reference temperature. |
tempRef | Reference temperature for the enthalpy. |
Type | Name | Default | Description |
---|---|---|---|
Integer | nComp | 1 | Number of components |
Boolean | Ejs | false | Global parameter - Runtime interactivity |
Boolean | Sysquake | false | Global parameter - Batch interactivity |
Real | CpCoefMInitial[nComp, 7] | Coefficients of the specific (per mass) heat capacity CpM[i] = CpCoefM[i,1] + CpCoefM[i,2]*T + ... + CpCoefM[i,7]*T**6 | |
Real | massEnthalpyRefInitial[nComp] | zeros(nComp) | Specific (per mass) enthalpy at the reference temperature [L2.t-2] |
Real | tempRefInitial | 298 | Reference temperature for the enthalpy [T] |
Real | eps | 1.E-6 | Small constant to avoid by-zero division |
Real | length | Pipe length [L] | |
Real | section | Pipe cross-section [L2] | |
Real | wettedArea | Wetted pipe surface [L2] | |
Real | heigthI | 0 | Heigth of the input control plane [L] |
Real | heigthO | 0 | Heigth of the input control plane [L] |
Real | density[nComp] | Density of the components [M.L-3] | |
Real | g | 9.8 | Gravitational acceleration [L.t-2] |
Real | epsMomentum | 1 | Coefficient of the fluid inertia |
Type | Name | Description |
---|---|---|
cutLiquidR | inMass | Liquid flow connector - R |
cutLiquidR | outMass | Liquid flow connector - R |
cutHeatFC | inHeat | Heat flow connector -C |
cutReceiver | setPointSignal |
partial model pipeDynLiqB "Partial model - Dynamic balance of linear momentum" extends convecLiqFlowB; Real valveOpeningSP( unit="") "Setpoint of the valve opening"; parameter Real length( unit="L") "Pipe length"; parameter Real section( unit="L2") "Pipe cross-section"; parameter Real wettedArea( unit="L2") "Wetted pipe surface"; parameter Real heigthI( unit="L") = 0 "Heigth of the input control plane"; parameter Real heigthO( unit="L") = 0 "Heigth of the input control plane"; parameter Real density[ nComp]( unit="M.L-3") "Density of the components"; parameter Real g( unit="L.t-2") = 9.8 "Gravitational acceleration"; parameter Real epsMomentum( unit="") = 1 "Coefficient of the fluid inertia"; cutsB.cutReceiver setPointSignal( dim=1, signal={valveOpeningSP}); protected Real veloc( unit="L.t-1") "Flow velocity"; Real linMomentum( unit="M.L.t-1") "Lineal momentum"; Real fricForce( unit="M.L.t-2") "Force of friction"; Real pressForce( unit="M.L.t-2") "Force due to the pressure difference"; Real gravForce( unit="M.L.t-2") "Gravitational force"; Real totalForce( unit="M.L.t-2") "Total force"; Real fluidDensity( unit="M.L-3") "Fluid density"; Real fanning( unit="") "Fanning adimensional factor"; Real parcFluidV[ nComp]( unit="L3") "Volume of each component"; Real fluidVolume( unit="L3") "Total volume"; Real massFullPipe( unit="M") "Mass inside the full pipe"; Real massLiqPipe( unit="M") "Liquid mass inside the pipe"; Real totalMassI( unit="M") "Total mass at connector inMass"; Real totalMassO( unit="M") "Total mass at connector outMass"; Real valveOpening( unit="") "Bounded valve opening"; equation // Parcial volume of each component for i in 1:nComp loop parcFluidV[i] * density[i] = if linMomentum>0 then inMass.massL[i] else outMass.massL[i]; end for; // Fluid volume fluidVolume = sum(parcFluidV[i] for i in 1:nComp); // Total mass at connectors totalMassI = sum(inMass.massL[i] for i in 1:nComp); totalMassO = sum(outMass.massL[i] for i in 1:nComp); // Fluid density fluidDensity = if linMomentum > 0 then totalMassI / ( fluidVolume + eps) else totalMassO / ( fluidVolume + eps); // Force due to the pressure difference pressForce = section * ( inMass.pressL - outMass.pressL); // Gravitational force gravForce = massLiqPipe * g * ( heigthI - heigthO) / length; massFullPipe = fluidDensity * section * length; massLiqPipe = if heigthI > heigthO and totalMassI > massFullPipe or heigthO > heigthI and totalMassO > massFullPipe then massFullPipe else if heigthI > heigthO then totalMassI else totalMassO; // Friction force fricForce = if linMomentum > 0 then -wettedArea * 0.5 * fluidDensity * veloc^ 2 * fanning else wettedArea * 0.5 * fluidDensity * veloc^ 2 * fanning; // Bounding of the valve opening valveOpening = if valveOpeningSP > 1 then 1 else if valveOpeningSP < 0 then 0 else valveOpeningSP; // Linear momentum balance totalForce = fricForce + valveOpening^ 2 * ( pressForce + gravForce); epsMomentum * der(linMomentum) = totalForce; when linMomentum > 0 and not ( sum(inMass.massL[i] for i in 1:nComp) > 0) or linMomentum < 0 and not ( sum(outMass.massL[i] for i in 1:nComp) > 0) or not valveOpeningSP > 0 then reinit(linMomentum, 0); end when; linMomentum = totalMassF * length; totalMassF = section * ( fluidDensity + eps) * veloc; end pipeDynLiqB;
CpCoefM[nComp,7] | Coefficients of the specific (per mass) heat capacity CpM[i] = CpCoefM[i,1] + CpCoefM[i,2]*T + ... + CpCoefM[i,7]*T**6. |
massEnthalpyRef[nComp] | Specific (per mass) enthalpy at the reference temperature. |
tempRef | Reference temperature for the enthalpy. |
Type | Name | Default | Description |
---|---|---|---|
Integer | nComp | 1 | Number of components |
Boolean | Ejs | false | Global parameter - Runtime interactivity |
Boolean | Sysquake | false | Global parameter - Batch interactivity |
Real | CpCoefMInitial[nComp, 7] | Coefficients of the specific (per mass) heat capacity CpM[i] = CpCoefM[i,1] + CpCoefM[i,2]*T + ... + CpCoefM[i,7]*T**6 | |
Real | massEnthalpyRefInitial[nComp] | zeros(nComp) | Specific (per mass) enthalpy at the reference temperature [L2.t-2] |
Real | tempRefInitial | 298 | Reference temperature for the enthalpy [T] |
Real | eps | 1.E-6 | Small constant to avoid by-zero division |
Real | length | Pipe length [L] | |
Real | section | Pipe cross-section [L2] | |
Real | wettedArea | Wetted pipe surface [L2] | |
Real | heigthI | 0 | Heigth of the input control plane [L] |
Real | heigthO | 0 | Heigth of the input control plane [L] |
Real | density[nComp] | Density of the components [M.L-3] | |
Real | g | 9.8 | Gravitational acceleration [L.t-2] |
Type | Name | Description |
---|---|---|
cutLiquidR | inMass | Liquid flow connector - R |
cutLiquidR | outMass | Liquid flow connector - R |
cutHeatFC | inHeat | Heat flow connector -C |
cutReceiver | setPointSignal |
model pipeStatLiqB "Steady-state balance of linear momentum" extends convecLiqFlowB; Real valveOpeningSP "Setpoint of the valve opening"; cutsB.cutReceiver setPointSignal( dim=1, signal={valveOpeningSP}); parameter Real length( unit="L") "Pipe length"; parameter Real section( unit="L2") "Pipe cross-section"; parameter Real wettedArea( unit="L2") "Wetted pipe surface"; parameter Real heigthI( unit="L") = 0 "Heigth of the input control plane"; parameter Real heigthO( unit="L") = 0 "Heigth of the input control plane"; parameter Real density[ nComp]( unit="M.L-3") "Density of the components"; parameter Real g( unit="L.t-2") = 9.8 "Gravitational acceleration"; protected Real veloc( unit="L.t-1", start=0) "Flow velocity"; Real absTotalMassF( unit="M.t-1") "Absolute value of the total mass flow"; Real pressForce( unit="M.L.t-2") "Force due to the pressure difference"; Real gravForce( unit="M.L.t-2") "Gravitational force"; Real fluidDensity( unit="M.L-3") "Fluid density"; Real fanning( unit="") "Fanning adimensional factor"; Real parcFluidV[ nComp]( unit="L3") "Volume of each component"; Real massFullPipe( unit="M") "Mass inside the full pipe"; Real massLiqPipe( unit="M") "Liquid mass inside the pipe"; Real totalVolume( unit="L3") "Total volume"; Real totalMassI( unit="M") "Total mass at connector inMass"; Real totalMassO( unit="M") "Total mass at connector outMass"; Real valveOpening( unit="") "Bounded valve opening"; Boolean isPosit( start = true) "Flow direction"; equation // Density of the liquid mixture for i in 1:nComp loop parcFluidV[i] * density[i] = if isPosit then inMass.massL[i] else outMass.massL[i]; end for; // Total volume totalVolume = sum(parcFluidV[i] for i in 1:nComp); // Total mass totalMassI = sum(inMass.massL[i] for i in 1:nComp); totalMassO = sum(outMass.massL[i] for i in 1:nComp); fluidDensity = if isPosit then totalMassI / ( totalVolume + eps) else totalMassO / ( totalVolume + eps); // Force due to the pressure difference pressForce = section * ( inMass.pressL - outMass.pressL); // Gravitational force gravForce = massLiqPipe * g * ( heigthI - heigthO) / length; massFullPipe = fluidDensity * section * length; massLiqPipe = if heigthI > heigthO and totalMassI > massFullPipe or heigthO > heigthI and totalMassO > massFullPipe then massFullPipe else if heigthI > heigthO then totalMassI else totalMassO; // Flow direction new(isPosit) = not pressForce + gravForce < 0; // Control signal bounding valveOpening = if valveOpeningSP > 1 then 1 else if valveOpeningSP < 0 then 0 else valveOpeningSP; // Linear momentum balance absTotalMassF = valveOpening * section * sqrt(2 * fluidDensity / ( wettedArea * fanning + eps)) * sqrt( abs( pressForce + gravForce)); totalMassF * ( abs( pressForce + gravForce) + eps) = ( pressForce + gravForce) * ( absTotalMassF + eps); // Fluid velocity totalMassF = section * ( fluidDensity + eps) * veloc + residue( veloc); end pipeStatLiqB;
CpCoefM[nComp,7] | Coefficients of the specific (per mass) heat capacity CpM[i] = CpCoefM[i,1] + CpCoefM[i,2]*T + ... + CpCoefM[i,7]*T**6. |
massEnthalpyRef[nComp] | Specific (per mass) enthalpy at the reference temperature. |
tempRef | Reference temperature for the enthalpy. |
Type | Name | Default | Description |
---|---|---|---|
Integer | nComp | 1 | Number of components |
Boolean | Ejs | false | Global parameter - Runtime interactivity |
Boolean | Sysquake | false | Global parameter - Batch interactivity |
Real | CpCoefMInitial[nComp, 7] | Coefficients of the specific (per mass) heat capacity CpM[i] = CpCoefM[i,1] + CpCoefM[i,2]*T + ... + CpCoefM[i,7]*T**6 | |
Real | massEnthalpyRefInitial[nComp] | zeros(nComp) | Specific (per mass) enthalpy at the reference temperature [L2.t-2] |
Real | tempRefInitial | 298 | Reference temperature for the enthalpy [T] |
Real | eps | 1.E-6 | Small constant to avoid by-zero division |
Real | Kprop | 10 | Slope of the pressure difference vs the total flow [L.t] |
Type | Name | Description |
---|---|---|
cutLiquidR | inMass | Liquid flow connector - R |
cutLiquidR | outMass | Liquid flow connector - R |
cutHeatFC | inHeat | Heat flow connector -C |
model pressEqLiqB "Liquid flowing through a pipe" extends convecLiqFlowB; parameter Real Kprop( unit="L.t") = 10 "Slope of the pressure difference vs the total flow"; protected Real pressDif( unit="M.L-1.t-2") "Difference of pressures"; Real relatError "Relative error made assuming that the pressures are equal"; equation // Difference of pressures // It has been arbitrary defined that the flow is proportional to the pressure gradient. pressDif = inMass.pressL - outMass.pressL; // Tne total flow is proportional to the pressure difference totalMassF = Kprop * pressDif; // Relative error of assuming that the two pressures are equal relatError = abs(pressDif) / ( 0.5 * ( inMass.pressL + outMass.pressL + eps)); end pressEqLiqB;
CpCoefM[nComp,7] | Coefficients of the specific (per mass) heat capacity CpM[i] = CpCoefM[i,1] + CpCoefM[i,2]*T + ... + CpCoefM[i,7]*T**6. |
massEnthalpyRef[nComp] | Specific (per mass) enthalpy at the reference temperature. |
tempRef | Reference temperature for the enthalpy. |
Type | Name | Default | Description |
---|---|---|---|
Integer | nComp | 1 | Number of components |
Boolean | Ejs | false | Global parameter - Runtime interactivity |
Boolean | Sysquake | false | Global parameter - Batch interactivity |
Real | CpCoefMInitial[nComp, 7] | Coefficients of the specific (per mass) heat capacity CpM[i] = CpCoefM[i,1] + CpCoefM[i,2]*T + ... + CpCoefM[i,7]*T**6 | |
Real | massEnthalpyRefInitial[nComp] | zeros(nComp) | Specific (per mass) enthalpy at the reference temperature [L2.t-2] |
Real | tempRefInitial | 298 | Reference temperature for the enthalpy [T] |
Real | eps | 1.E-6 | Small constant to avoid by-zero division |
Real | pmax | Parameter of the pump constitutive relation [M.L-1.t-2] | |
Real | pmin | Parameter of the pump constitutive relation [M.L-1.t-2] | |
Real | pcodo | Parameter of the pump constitutive relation [M.L-1.t-2] | |
Real | peps | Parameter of the pump constitutive relation [M.L-1.t-2] |
Type | Name | Description |
---|---|---|
cutLiquidR | inMass | Liquid flow connector - R |
cutLiquidR | outMass | Liquid flow connector - R |
cutHeatFC | inHeat | Heat flow connector -C |
partial model pumpLiqB "Partial model: liquid pump" extends convecLiqFlowB; Real totalMassFSP( unit="M.t-1") "Setpoint of the total mass flow"; // pmax > pcodo , pmin > peps parameter Real pmax( unit="M.L-1.t-2") "Parameter of the pump constitutive relation"; parameter Real pmin( unit="M.L-1.t-2") "Parameter of the pump constitutive relation"; parameter Real pcodo( unit="M.L-1.t-2") "Parameter of the pump constitutive relation"; parameter Real peps( unit="M.L-1.t-2") "Parameter of the pump constitutive relation"; protected Real pressTo( unit="M.L-1.t-2") "Load pressure"; Real pressFrom( unit="M.L-1.t-2") "Source pressure"; Real coefPressTo "Dummy variable"; Real coefPressFrom "Dummy variable"; equation // Load pressure pressTo = if totalMassFSP > 0 then outMass.pressL else inMass.pressL; // Load pressure pressFrom = if totalMassFSP > 0 then inMass.pressL else outMass.pressL; // Constitutive relation of the pump coefPressTo = if pressTo < pcodo then 1 else if pressTo < pmax then (pmax-pressTo) / (pmax-pcodo) else 0; coefPressFrom = if pressFrom > pmin then 1 else if pressFrom > peps then ( pressFrom - peps) / ( pmin - peps) else 0; totalMassF = coefPressTo * coefPressFrom * totalMassFSP; end pumpLiqB;
CpCoefM[nComp,7] | Coefficients of the specific (per mass) heat capacity CpM[i] = CpCoefM[i,1] + CpCoefM[i,2]*T + ... + CpCoefM[i,7]*T**6. |
massEnthalpyRef[nComp] | Specific (per mass) enthalpy at the reference temperature. |
tempRef | Reference temperature for the enthalpy. |
Type | Name | Default | Description |
---|---|---|---|
Integer | nComp | 1 | Number of components |
Boolean | Ejs | false | Global parameter - Runtime interactivity |
Boolean | Sysquake | false | Global parameter - Batch interactivity |
Real | CpCoefMInitial[nComp, 7] | Coefficients of the specific (per mass) heat capacity CpM[i] = CpCoefM[i,1] + CpCoefM[i,2]*T + ... + CpCoefM[i,7]*T**6 | |
Real | massEnthalpyRefInitial[nComp] | zeros(nComp) | Specific (per mass) enthalpy at the reference temperature [L2.t-2] |
Real | tempRefInitial | 298 | Reference temperature for the enthalpy [T] |
Real | eps | 1.E-6 | Small constant to avoid by-zero division |
Real | pmax | Parameter of the pump constitutive relation [M.L-1.t-2] | |
Real | pmin | Parameter of the pump constitutive relation [M.L-1.t-2] | |
Real | pcodo | Parameter of the pump constitutive relation [M.L-1.t-2] | |
Real | peps | Parameter of the pump constitutive relation [M.L-1.t-2] |
Type | Name | Description |
---|---|---|
cutLiquidR | inMass | Liquid flow connector - R |
cutLiquidR | outMass | Liquid flow connector - R |
cutHeatFC | inHeat | Heat flow connector -C |
cutReceiver | setPointSignal | Set.point signal |
model pumpMassLiqB "Liquid pump. Setpoint: mass flow" extends pumpLiqB; cutsB.cutReceiver setPointSignal( dim=1, signal={totalMassFSP}) "Set.point signal"; end pumpMassLiqB;
CpCoefM[nComp,7] | Coefficients of the specific (per mass) heat capacity CpM[i] = CpCoefM[i,1] + CpCoefM[i,2]*T + ... + CpCoefM[i,7]*T**6. |
massEnthalpyRef[nComp] | Specific (per mass) enthalpy at the reference temperature. |
tempRef | Reference temperature for the enthalpy. |
molecWeigth[nComp] | Molecular weight of the components. |
Type | Name | Default | Description |
---|---|---|---|
Integer | nComp | 1 | Number of components |
Boolean | Ejs | false | Global parameter - Runtime interactivity |
Boolean | Sysquake | false | Global parameter - Batch interactivity |
Real | CpCoefMInitial[nComp, 7] | Coefficients of the specific (per mass) heat capacity CpM[i] = CpCoefM[i,1] + CpCoefM[i,2]*T + ... + CpCoefM[i,7]*T**6 | |
Real | massEnthalpyRefInitial[nComp] | zeros(nComp) | Specific (per mass) enthalpy at the reference temperature [L2.t-2] |
Real | tempRefInitial | 298 | Reference temperature for the enthalpy [T] |
Real | eps | 1.E-6 | Small constant to avoid by-zero division |
Real | pmax | Parameter of the pump constitutive relation [M.L-1.t-2] | |
Real | pmin | Parameter of the pump constitutive relation [M.L-1.t-2] | |
Real | pcodo | Parameter of the pump constitutive relation [M.L-1.t-2] | |
Real | peps | Parameter of the pump constitutive relation [M.L-1.t-2] | |
Real | molecWeigthInitial[nComp] | Molecular weigth of the components [M.mol-1] |
Type | Name | Description |
---|---|---|
cutLiquidR | inMass | Liquid flow connector - R |
cutLiquidR | outMass | Liquid flow connector - R |
cutHeatFC | inHeat | Heat flow connector -C |
cutReceiver | setPointSignal | Set.point signal |
model pumpMolLiqB "Liquid pump. Setpoint: molar flow" extends pumpLiqB; Real totalMolFSP( unit="mol.t-1") "Setpoint of the total molar flow"; parameter Real molecWeigthInitial[nComp]( unit="M.mol-1") "Molecular weigth of the components"; cutsB.cutReceiver setPointSignal( dim=1, signal={totalMolFSP}) "Set.point signal"; // Interactive variables Real molecWeigth[nComp]( unit="M.mol-1",start=molecWeigthInitial) "Molecular weigth of the components"; protected Real molI[ nComp]( unit="mol") "Mol number of each component"; Real molO[ nComp]( unit="mol") "Mol number of each component"; Real totalMolI( unit="mol"); Real totalMolO( unit="mol"); Real totalMassI( unit="M"); Real totalMassO( unit="M"); equation // Ejs if Ejs then for i in 1:nComp loop der(molecWeigth[i]) = 0; end for; end if; // Sysquake if Sysquake then molecWeigth = molecWeigthInitial; end if; for i in 1:nComp loop inMass.massL[i] = molecWeigth[i] * molI[i]; outMass.massL[i] = molecWeigth[i] * molO[i]; end for; totalMolI = sum(molI[i] for i in 1:nComp); totalMolO = sum(molO[i] for i in 1:nComp); totalMassI = sum(inMass.massL[i] for i in 1:nComp); totalMassO = sum(outMass.massL[i] for i in 1:nComp); totalMassFSP = if totalMolFSP > 0 then totalMassI * totalMolFSP / (totalMolI + eps) else totalMassO * totalMolFSP / (totalMolO + eps); end pumpMolLiqB;
CpCoefM[nComp,7] | Coefficients of the specific (per mass) heat capacity CpM[i] = CpCoefM[i,1] + CpCoefM[i,2]*T + ... + CpCoefM[i,7]*T**6. |
massEnthalpyRef[nComp] | Specific (per mass) enthalpy at the reference temperature. |
tempRef | Reference temperature for the enthalpy. |
density[nComp] | Density of the components. |
Type | Name | Default | Description |
---|---|---|---|
Integer | nComp | 1 | Number of components |
Boolean | Ejs | false | Global parameter - Runtime interactivity |
Boolean | Sysquake | false | Global parameter - Batch interactivity |
Real | CpCoefMInitial[nComp, 7] | Coefficients of the specific (per mass) heat capacity CpM[i] = CpCoefM[i,1] + CpCoefM[i,2]*T + ... + CpCoefM[i,7]*T**6 | |
Real | massEnthalpyRefInitial[nComp] | zeros(nComp) | Specific (per mass) enthalpy at the reference temperature [L2.t-2] |
Real | tempRefInitial | 298 | Reference temperature for the enthalpy [T] |
Real | eps | 1.E-6 | Small constant to avoid by-zero division |
Real | pmax | Parameter of the pump constitutive relation [M.L-1.t-2] | |
Real | pmin | Parameter of the pump constitutive relation [M.L-1.t-2] | |
Real | pcodo | Parameter of the pump constitutive relation [M.L-1.t-2] | |
Real | peps | Parameter of the pump constitutive relation [M.L-1.t-2] | |
Real | densityInitial[nComp] | Density of the components [M.L-3] |
Type | Name | Description |
---|---|---|
cutLiquidR | inMass | Liquid flow connector - R |
cutLiquidR | outMass | Liquid flow connector - R |
cutHeatFC | inHeat | Heat flow connector -C |
cutReceiver | setPointSignal | Set.point signal |
model pumpVolLiqB "Liquid pump. Setpoint: volumetric flow" extends pumpLiqB; Real totalVolFSP( unit="L3.t-1") "Setpoint of the total volumetric flow"; parameter Real densityInitial[nComp]( unit="M.L-3") "Density of the components"; cutsB.cutReceiver setPointSignal( dim=1, signal={totalVolFSP}) "Set.point signal"; // Interactive variables Real density[nComp]( unit="M.L-3",start=densityInitial) "Density of the components"; protected Real mixDensity( unit="M.L-3") "Density of the mixture"; Real massFract[ nComp] "Mass fraction of the flow"; equation // Ejs if Ejs then for i in 1:nComp loop der(density[i]) = 0; end for; end if; // Sysquake if Sysquake then density = densityInitial; end if; totalMassFSP = totalVolFSP * mixDensity; mixDensity = 1 / ( sum( massFract[i] / density[i] for i in 1:nComp)); massFract = if totalVolFSP > 0 then inMass.massL / ( sum(inMass.massL[i] for i in 1:nComp) + eps) else outMass.massL / ( sum(outMass.massL[i] for i in 1:nComp) + eps); end pumpVolLiqB;
CpCoefM[nComp,7] | Coefficients of the specific (per mass) heat capacity CpM[i] = CpCoefM[i,1] + CpCoefM[i,2]*T + ... + CpCoefM[i,7]*T**6. |
massEnthalpyRef[nComp] | Specific (per mass) enthalpy at the reference temperature. |
tempRef | Reference temperature for the enthalpy. |
Type | Name | Default | Description |
---|---|---|---|
Integer | nComp | 1 | Number of components |
Boolean | Ejs | false | Global parameter - Runtime interactivity |
Boolean | Sysquake | false | Global parameter - Batch interactivity |
Real | CpCoefMInitial[nComp, 7] | Coefficients of the specific (per mass) heat capacity CpM[i] = CpCoefM[i,1] + CpCoefM[i,2]*T + ... + CpCoefM[i,7]*T**6 | |
Real | massEnthalpyRefInitial[nComp] | zeros(nComp) | Specific (per mass) enthalpy at the reference temperature [L2.t-2] |
Real | tempRefInitial | 298 | Reference temperature for the enthalpy [T] |
Real | pmax | Parameter of the pump constitutive relation [M.L-1.t-2] | |
Real | pmin | Parameter of the pump constitutive relation [M.L-1.t-2] | |
Real | pcodo | Parameter of the pump constitutive relation [M.L-1.t-2] | |
Real | peps | Parameter of the pump constitutive relation [M.L-1.t-2] | |
Real | eps | 1.E-8 | Small constant to avoid by-zero division |
Type | Name | Description |
---|---|---|
cutLiquidR | inMass | Connector for the liquid flow |
partial model sourceLiqFB "Partial model: liquid source" extends interf.liqFlow1I; // Interactivity outer parameter Boolean Ejs = false "Global parameter - Runtime interactivity"; outer parameter Boolean Sysquake = false "Global parameter - Batch interactivity"; Real massFractSP[ nComp]( unit="") "Setpoint of the mass fraction"; Real tempFSP( unit="T") "Setpoint of the flow temperature"; Real totalMassFSP( unit="M*t**-1") "Setpoint of the total mass flow"; parameter Real CpCoefMInitial[nComp,7] "Coefficients of the specific (per mass) heat capacity CpM[i] = CpCoefM[i,1] + CpCoefM[i,2]*T + ... + CpCoefM[i,7]*T**6"; parameter Real massEnthalpyRefInitial[nComp]( unit="L2.t-2") = zeros(nComp) "Specific (per mass) enthalpy at the reference temperature"; parameter Real tempRefInitial( unit="T") = 298 "Reference temperature for the enthalpy"; // pmax > pcodo , pmin > peps parameter Real pmax( unit="M.L-1.t-2") "Parameter of the pump constitutive relation"; parameter Real pmin( unit="M.L-1.t-2") "Parameter of the pump constitutive relation"; parameter Real pcodo( unit="M.L-1.t-2") "Parameter of the pump constitutive relation"; parameter Real peps( unit="M.L-1.t-2") "Parameter of the pump constitutive relation"; parameter Real eps = 1.E-8 "Small constant to avoid by-zero division"; Real totalMassF( unit="M*t**-1") "Total mass flow"; Real tempF( unit="T") "Flow temperature"; // Interactive variables Real CpCoefM[nComp,7]( start=CpCoefMInitial) "Coefficients of the specific (per mass) heat capacity CpM[i] = CpCoefM[i,1] + CpCoefM[i,2]*T + ... + CpCoefM[i,7]*T**6"; Real massEnthalpyRef[nComp]( unit="L2.t-2",start=massEnthalpyRefInitial) "Specific (per mass) enthalpy at the reference temperature"; Real tempRef( unit="T",start=tempRefInitial) "Reference temperature for the enthalpy"; protected Boolean flowIsPosit( start = true) "Flow direction"; Real totalMass( unit="M") "Total mass"; Real aux[ nComp]; equation // Ejs if Ejs then for i in 1:nComp loop for j in 1:7 loop der(CpCoefM[i,j]) = 0; end for; end for; for i in 1:nComp loop der(massEnthalpyRef[i]) = 0; end for; der(tempRef) = 0; end if; // Sysquake if Sysquake then CpCoefM = CpCoefMInitial; massEnthalpyRef = massEnthalpyRefInitial; tempRef = tempRefInitial; end if; // Constitutive relation of the source flowIsPosit = totalMassFSP > 0; totalMassF = if flowIsPosit and totalMass < 1e-5 then 0 else if flowIsPosit and inMass.pressL > pmin then totalMassFSP else if flowIsPosit and inMass.pressL > peps then totalMassFSP * ( inMass.pressL - peps) / ( pmin - peps) else if flowIsPosit then 0 else if inMass.pressL < pcodo then totalMassFSP else if inMass.pressL < pmax then totalMassFSP * ( pmax - inMass.pressL) / ( pmax - pcodo) else 0; // Total mass totalMass = sum(inMass.massL[i] for i in 1:nComp); // Flow of each component if nComp > 1 then for i in 1:(nComp-1) loop inMass.massLF[i] = if flowIsPosit then inMass.massL[i] * totalMassF / ( totalMass + eps) else massFractSP[i] * totalMassF; end for; end if; totalMassF = sum(inMass.massLF[i] for i in 1:nComp); // Flow temperature tempF = if flowIsPosit then inMass.tempL else tempFSP; // Enthalpy flow for i in 1:nComp loop aux[i] = CpCoefM[i,1] * ( tempF - tempRef) + CpCoefM[i,2] * 1/2 * ( tempF^ 2 - tempRef^ 2) + CpCoefM[i,3] * 1/3 * ( tempF^ 3 - tempRef^ 3) + CpCoefM[i,4] * 1/4 * ( tempF^ 4 - tempRef^ 4) + CpCoefM[i,5] * 1/5 * ( tempF^ 5 - tempRef^ 5) + CpCoefM[i,6] * 1/6 * ( tempF^ 6 - tempRef^ 6) + CpCoefM[i,7] * 1/7 * ( tempF^ 7 - tempRef^ 7); end for; inMass.energyLF = sum(inMass.massLF[i] * ( massEnthalpyRef[i] + aux[i]) for i in 1:nComp); end sourceLiqFB;
CpCoefM[nComp,7] | Coefficients of the specific (per mass) heat capacity CpM[i] = CpCoefM[i,1] + CpCoefM[i,2]*T + ... + CpCoefM[i,7]*T**6. |
massEnthalpyRef[nComp] | Specific (per mass) enthalpy at the reference temperature. |
tempRef | Reference temperature for the enthalpy. |
Type | Name | Default | Description |
---|---|---|---|
Integer | nComp | 1 | Number of components |
Boolean | Ejs | false | Global parameter - Runtime interactivity |
Boolean | Sysquake | false | Global parameter - Batch interactivity |
Real | CpCoefMInitial[nComp, 7] | Coefficients of the specific (per mass) heat capacity CpM[i] = CpCoefM[i,1] + CpCoefM[i,2]*T + ... + CpCoefM[i,7]*T**6 | |
Real | massEnthalpyRefInitial[nComp] | zeros(nComp) | Specific (per mass) enthalpy at the reference temperature [L2.t-2] |
Real | tempRefInitial | 298 | Reference temperature for the enthalpy [T] |
Real | pmax | Parameter of the pump constitutive relation [M.L-1.t-2] | |
Real | pmin | Parameter of the pump constitutive relation [M.L-1.t-2] | |
Real | pcodo | Parameter of the pump constitutive relation [M.L-1.t-2] | |
Real | peps | Parameter of the pump constitutive relation [M.L-1.t-2] | |
Real | eps | 1.E-8 | Small constant to avoid by-zero division |
Type | Name | Description |
---|---|---|
cutLiquidR | inMass | Connector for the liquid flow |
cutReceiver | setPointSignal | Set point signals |
model sourceMassLiqFB "Liquid source. Setpoints: total mass, mass fraction and temperature" extends sourceLiqFB; cutsB.cutReceiver setPointSignal( dim=nComp+2) "Set point signals"; equation setPointSignal.signal[1] = totalMassFSP; setPointSignal.signal[2:(nComp+1)] = massFractSP; setPointSignal.signal[nComp+2] = tempFSP; end sourceMassLiqFB;
CpCoefM[nComp,7] | Coefficients of the specific (per mass) heat capacity CpM[i] = CpCoefM[i,1] + CpCoefM[i,2]*T + ... + CpCoefM[i,7]*T**6. |
massEnthalpyRef[nComp] | Specific (per mass) enthalpy at the reference temperature. |
tempRef | Reference temperature for the enthalpy. |
Type | Name | Default | Description |
---|---|---|---|
Integer | nComp | 1 | Number of components |
Boolean | Ejs | false | Global parameter - Runtime interactivity |
Boolean | Sysquake | false | Global parameter - Batch interactivity |
Real | CpCoefMInitial[nComp, 7] | Coefficients of the specific (per mass) heat capacity CpM[i] = CpCoefM[i,1] + CpCoefM[i,2]*T + ... + CpCoefM[i,7]*T**6 | |
Real | massEnthalpyRefInitial[nComp] | zeros(nComp) | Specific (per mass) enthalpy at the reference temperature [L2.t-2] |
Real | tempRefInitial | 298 | Reference temperature for the enthalpy [T] |
Real | pmax | Parameter of the pump constitutive relation [M.L-1.t-2] | |
Real | pmin | Parameter of the pump constitutive relation [M.L-1.t-2] | |
Real | pcodo | Parameter of the pump constitutive relation [M.L-1.t-2] | |
Real | peps | Parameter of the pump constitutive relation [M.L-1.t-2] | |
Real | eps | 1.E-8 | Small constant to avoid by-zero division |
Real | molecWeigth[nComp] | Molecular weigth of the components [M.mol-1] |
Type | Name | Description |
---|---|---|
cutLiquidR | inMass | Connector for the liquid flow |
cutReceiver | setPointSignal |
model sourceMolLiqFB "Liquid source. Setpoints: total molar flow, molar fraction and temperature." extends sourceLiqFB; Real totalMolFSP( unit="M.t-1") "Setpoint of the total molar flow"; Real molFractSP[ nComp]( unit="") "Setpoint of the molar fraction"; parameter Real molecWeigth[ nComp]( unit="M.mol-1") "Molecular weigth of the components"; cutsB.cutReceiver setPointSignal( dim=nComp+2); protected Real auxCal "Auxiliary variable"; equation setPointSignal.signal[1] = totalMolFSP; setPointSignal.signal[2:(nComp+1)] = molFractSP; setPointSignal.signal[nComp+2] = tempFSP; auxCal = sum(molecWeigth[i] * molFractSP[i] for i in 1:nComp); for i in 1:nComp loop massFractSP[i] = molecWeigth[i] * molFractSP[i] / auxCal; end for; totalMassFSP = auxCal * totalMolFSP; end sourceMolLiqFB;
Type | Name | Default | Description |
---|---|---|---|
Integer | nComp | 1 | Number of components of the liquid mixture |
Type | Name | Description |
---|---|---|
cutLiquidC | inMass | Connector for the liquid flow |
model sourcePressLiqB "Pressure source." extends interf.liquid1I; equation end sourcePressLiqB;
CpCoefM[nComp,7] | Coefficients of the specific (per mass) heat capacity CpM[i] = CpCoefM[i,1] + CpCoefM[i,2]*T + ... + CpCoefM[i,7]*T**6. |
massEnthalpyRef[nComp] | Specific (per mass) enthalpy at the reference temperature. |
tempRef | Reference temperature for the enthalpy. |
Type | Name | Default | Description |
---|---|---|---|
Integer | nComp | 1 | Number of components |
Boolean | Ejs | false | Global parameter - Runtime interactivity |
Boolean | Sysquake | false | Global parameter - Batch interactivity |
Real | CpCoefMInitial[nComp, 7] | Coefficients of the specific (per mass) heat capacity CpM[i] = CpCoefM[i,1] + CpCoefM[i,2]*T + ... + CpCoefM[i,7]*T**6 | |
Real | massEnthalpyRefInitial[nComp] | zeros(nComp) | Specific (per mass) enthalpy at the reference temperature [L2.t-2] |
Real | tempRefInitial | 298 | Reference temperature for the enthalpy [T] |
Real | pmax | Parameter of the pump constitutive relation [M.L-1.t-2] | |
Real | pmin | Parameter of the pump constitutive relation [M.L-1.t-2] | |
Real | pcodo | Parameter of the pump constitutive relation [M.L-1.t-2] | |
Real | peps | Parameter of the pump constitutive relation [M.L-1.t-2] | |
Real | eps | 1.E-8 | Small constant to avoid by-zero division |
Real | densityInitial[nComp] | Density of the components [M.L-3] |
Type | Name | Description |
---|---|---|
cutLiquidR | inMass | Connector for the liquid flow |
cutReceiver | setPointSignal | Setpoint signals |
model sourceVolLiqFB "Liquid source. Setpoints: total volumetric flow, volume fraction and temperature." extends sourceLiqFB; Real volFractSP[ nComp]( unit="") "Setpoint of the volume fraction"; Real totalVolFSP( unit="L3.t-1") "Setpoint of the total volumetric flow"; parameter Real densityInitial[nComp]( unit="M.L-3") "Density of the components"; cutsB.cutReceiver setPointSignal( dim=nComp+2) "Setpoint signals"; // Interactive variables Real density[nComp]( unit="M.L-3",start=densityInitial) "Density of the components"; protected Real mixDensity( unit="M.L-3") "Density of the mixture"; Real auxCal "Auxiliary variable"; equation // Ejs if Ejs then for i in 1:nComp loop der(density[i]) = 0; end for; end if; // Sysquake if Sysquake then density = densityInitial; end if; setPointSignal.signal[1] = totalVolFSP; setPointSignal.signal[2:(nComp+1)] = volFractSP; setPointSignal.signal[nComp+2] = tempFSP; auxCal = sum(volFractSP[i] * density[i] for i in 1:nComp); for i in 1:nComp loop massFractSP[i] = volFractSP[i] * density[i] / auxCal; end for; totalMassFSP = totalVolFSP * mixDensity; mixDensity = 1 / ( sum(massFractSP[i] / density[i] for i in 1:nComp)); end sourceVolLiqFB;
vesselVolume | Vessel Volume. |
Type | Name | Default | Description |
---|---|---|---|
Boolean | Ejs | false | Run-time interactivity |
Boolean | Sysquake | false | Batch interactivity |
Real | vesselVolumeInitial | Vessel volume. Initial value [L3] |
Type | Name | Description |
---|---|---|
cutVolConstrVessel | constraintV | Volume constraint - Vessel. |
model vesselLiqB "Vessel with a constant volume." extends interf.vesselI; // Interactivity outer parameter Boolean Ejs = false "Run-time interactivity"; outer parameter Boolean Sysquake = false "Batch interactivity"; parameter Real vesselVolumeInitial( unit="L3") "Vessel volume. Initial value"; Real vesselVolume( unit="L3", start=vesselVolumeInitial) "Vessel volume"; equation // Ejs if Ejs then der(vesselVolume) = 0; end if; // Sysquake if Sysquake then vesselVolume = vesselVolumeInitial; end if; // The vessel volume is constant // constraintV.vesselV = vesselVolume; constraintV.vcE[1] = vesselVolume; end vesselLiqB;