JARA2i.liq

Liquid models

Information


 

Models of liquid CV, liquid mixtures TP and BC



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.




Figure 1.Classes included in liq.mo.



Package Content

NameDescription
JARA2i.liq.circSmoothPipeDynLiqB circSmoothPipeDynLiqB Dynamic linear-momentum balance. Circular pipe with a smooth wall
JARA2i.liq.circSmoothPipeStatLiqB circSmoothPipeStatLiqB Steady-state balance of linear momentum. Circular pipe with smooth wall and full of liquid
JARA2i.liq.convecLiqFlowB convecLiqFlowB Partial model: convective flow of liquid.
JARA2i.liq.junctLiqCp6PrefB junctLiqCp6PrefB Model of the flow junction
JARA2i.liq.liquidCp6B liquidCp6B Control volume containing a liquid mixture.
JARA2i.liq.liquidCp6PrefB liquidCp6PrefB Control volume containing a liquid mixture. The pressure on the liquid surface is constant.
JARA2i.liq.liquidCp6PrefVB liquidCp6PrefVB Liquid mixture contained in a control volume in mechanical equilibrium with a gas whose properties are not modeled.
JARA2i.liq.pipeDynLiqB pipeDynLiqB Partial model - Dynamic balance of linear momentum
JARA2i.liq.pipeStatLiqB pipeStatLiqB Steady-state balance of linear momentum
JARA2i.liq.pressEqLiqB pressEqLiqB Liquid flowing through a pipe
JARA2i.liq.pumpLiqB pumpLiqB Partial model: liquid pump
JARA2i.liq.pumpMassLiqB pumpMassLiqB Liquid pump. Setpoint: mass flow
JARA2i.liq.pumpMolLiqB pumpMolLiqB Liquid pump. Setpoint: molar flow
JARA2i.liq.pumpVolLiqB pumpVolLiqB Liquid pump. Setpoint: volumetric flow
JARA2i.liq.sourceLiqFB sourceLiqFB Partial model: liquid source
JARA2i.liq.sourceMassLiqFB sourceMassLiqFB Liquid source. Setpoints: total mass, mass fraction and temperature
JARA2i.liq.sourceMolLiqFB sourceMolLiqFB Liquid source. Setpoints: total molar flow, molar fraction and temperature.
JARA2i.liq.sourcePressLiqB sourcePressLiqB Pressure source.
JARA2i.liq.sourceVolLiqFB sourceVolLiqFB Liquid source. Setpoints: total volumetric flow, volume fraction and temperature.
JARA2i.liq.vesselLiqB vesselLiqB Vessel with a constant volume.


JARA2i.liq.circSmoothPipeDynLiqB JARA2i.liq.circSmoothPipeDynLiqB

Dynamic linear-momentum balance. Circular pipe with a smooth wall

JARA2i.liq.circSmoothPipeDynLiqB

Information

This class inherits from pipeDynLiqB. 
It includes expressions to compute the value of the Fanning adimensional friction factor of a large pipe (its length L is greater than its diameter, D), of circular section an smooth inner wall.
This class has to be completed with an expression to compute the vicosity of the liquid mixture.

Table 1. Interactive variables.
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.

Parameters

TypeNameDefaultDescription
IntegernComp1Number of components
BooleanEjsfalseGlobal parameter - Runtime interactivity
BooleanSysquakefalseGlobal parameter - Batch interactivity
RealCpCoefMInitial[nComp, 7] Coefficients of the specific (per mass) heat capacity CpM[i] = CpCoefM[i,1] + CpCoefM[i,2]*T + ... + CpCoefM[i,7]*T**6
RealmassEnthalpyRefInitial[nComp]zeros(nComp)Specific (per mass) enthalpy at the reference temperature [L2.t-2]
RealtempRefInitial298Reference temperature for the enthalpy [T]
Realeps1.E-6Small constant to avoid by-zero division
Reallength Pipe length [L]
Realsection Pipe cross-section [L2]
RealwettedArea Wetted pipe surface [L2]
RealheigthI0Heigth of the input control plane [L]
RealheigthO0Heigth of the input control plane [L]
Realdensity[nComp] Density of the components [M.L-3]
Realg9.8Gravitational acceleration [L.t-2]
RealepsMomentum1Coefficient of the fluid inertia
ReallamReynolds2100Critical value of the Reynolds number
RealturReynolds2500Critical value of the Reynolds number
RealradiusPipe(section/3.141592)^0.5Pipe radius [L]

Connectors

TypeNameDescription
cutLiquidRinMassLiquid flow connector - R
cutLiquidRoutMassLiquid flow connector - R
cutHeatFCinHeatHeat flow connector -C
cutReceiversetPointSignal 

Modelica definition

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;

JARA2i.liq.circSmoothPipeStatLiqB JARA2i.liq.circSmoothPipeStatLiqB

Steady-state balance of linear momentum. Circular pipe with smooth wall and full of liquid

JARA2i.liq.circSmoothPipeStatLiqB

Information

This class inherits from pipeStatLiqB. 
It includes expressions to compute the value of the Fanning adimensional friction factor of a large pipe (its length L is greater than its diameter, D), of circular section an smooth inner wall.
This class has to be completed with an expression to compute the vicosity of the liquid mixture.

Table 1. Interactive variables.
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.

Parameters

TypeNameDefaultDescription
IntegernComp1Number of components
BooleanEjsfalseGlobal parameter - Runtime interactivity
BooleanSysquakefalseGlobal parameter - Batch interactivity
RealCpCoefMInitial[nComp, 7] Coefficients of the specific (per mass) heat capacity CpM[i] = CpCoefM[i,1] + CpCoefM[i,2]*T + ... + CpCoefM[i,7]*T**6
RealmassEnthalpyRefInitial[nComp]zeros(nComp)Specific (per mass) enthalpy at the reference temperature [L2.t-2]
RealtempRefInitial298Reference temperature for the enthalpy [T]
Realeps1.E-6Small constant to avoid by-zero division
Reallength Pipe length [L]
Realsection Pipe cross-section [L2]
RealwettedArea Wetted pipe surface [L2]
RealheigthI0Heigth of the input control plane [L]
RealheigthO0Heigth of the input control plane [L]
Realdensity[nComp] Density of the components [M.L-3]
Realg9.8Gravitational acceleration [L.t-2]
ReallamReynolds2100Critical value of the Reynolds number
RealturReynolds2500Critical value of the Reynolds number
RealradiusPipe(section/3.141592)^0.5Pipe radius [L]

Connectors

TypeNameDescription
cutLiquidRinMassLiquid flow connector - R
cutLiquidRoutMassLiquid flow connector - R
cutHeatFCinHeatHeat flow connector -C
cutReceiversetPointSignal 

Modelica definition

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;

JARA2i.liq.convecLiqFlowB JARA2i.liq.convecLiqFlowB

Partial model: convective flow of liquid.

JARA2i.liq.convecLiqFlowB

Information

Partial model: convective flow of liquid. 
    This class inherits from interf.liqFlow2qI.
The heat convection is modeled as a transport phenomena established between the thermal control planes of two adjacent control volumes (CVs): solid CV-liquid CV.
A hypothesis related to the stirred mixture approximation is to assume that the fluid going out from a CV has the same properties as the fluid contained in it.
This approximation has been applied to the calculus of the temperature and the composition of the fluid leaving a CV by convection.
The flow direction changes during the simulation as a function of the operating conditions.
In consequence, the properties of the flow established between two CPs have to be calculated from the appropriate CP at any time.

Table 1. Interactive variables.
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.

Parameters

TypeNameDefaultDescription
IntegernComp1Number of components
BooleanEjsfalseGlobal parameter - Runtime interactivity
BooleanSysquakefalseGlobal parameter - Batch interactivity
RealCpCoefMInitial[nComp, 7] Coefficients of the specific (per mass) heat capacity CpM[i] = CpCoefM[i,1] + CpCoefM[i,2]*T + ... + CpCoefM[i,7]*T**6
RealmassEnthalpyRefInitial[nComp]zeros(nComp)Specific (per mass) enthalpy at the reference temperature [L2.t-2]
RealtempRefInitial298Reference temperature for the enthalpy [T]
Realeps1.E-6Small constant to avoid by-zero division

Connectors

TypeNameDescription
cutLiquidRinMassLiquid flow connector - R
cutLiquidRoutMassLiquid flow connector - R
cutHeatFCinHeatHeat flow connector -C

Modelica definition

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;

JARA2i.liq.junctLiqCp6PrefB JARA2i.liq.junctLiqCp6PrefB

Model of the flow junction

JARA2i.liq.junctLiqCp6PrefB

Information


                       Model of the flow junction
                       

Parameters

TypeNameDefaultDescription
IntegernComp1Number of components of the liquid mixture
RealsectionInitial1Cross-section of the vessel [L2]
Realg9.8Gravitatorial acceleration [L.t-2]
Realangle1.5707963Angle with the horizontal [rad]
Realeps1.E-6Small constant to avoid by-zero division
RealCpCoefMInitial[nComp, 7] Coefficients of the specific (per mass) heat capacity CpM[i] = CpCoefM[i,1] + CpCoefM[i,2]*T + ... + CpCoefM[i,7]*T**6
RealdensityInitial[nComp] Density of the pure components [M.L-3]
RealmassEnthalpyRefInitial[nComp]zeros(nComp)Specific (per mass) enthalpy at the reference temperature [L2.t-2]
RealtempRefInitial298Reference temperature for the enthalpy [T]
RealpercentVolSmallStep0.9Proportion of the vessel volume that triggers the reduction in the integration step-size
RealcompressCoef1.E-8Numeric compressibility coefficient [L.t2.M-1]
RealpressTopRef0Pressure on the liquid surface [M.L-1.t-2]
RealvesselVolumeInitial1Vessel volume [L3]
RealmassLinitial[nComp] Initial condition [M]
RealtempLinitial Initial condition [T]

Connectors

TypeNameDescription
cutLiquidCinMassConnector for the liquid flow

Modelica definition

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;

JARA2i.liq.liquidCp6B JARA2i.liq.liquidCp6B

Control volume containing a liquid mixture.

JARA2i.liq.liquidCp6B

Information

Control volume containing a liquid mixture. 
This class models a control volume (CV) containing an ideal homogeneous mixture of liquids.
It is assumed that the heat capacity per mass unit of each component of the liquid mixture can be formulated in terms of a polynomial of the temperature.
The highest polynomial degree is 6.
This class doesn't impose any restriction in the pressure at the top part of the liquid.

Table 1. Interactive variables.
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.

Parameters

TypeNameDefaultDescription
IntegernComp1Number of components
BooleanEjsfalseGlobal parameter - Runtime interactivity
BooleanSysquakefalseGlobal parameter - Batch interactivity
RealmassLinitial[nComp] Initial condition - Mass inside the CV [M]
RealtempLinitial Initial condition - Temperature of the CV [T]
RealsectionInitial1Initial cross-section of the vessel [L2]
Realg9.8Gravitatorial acceleration [L.t-2]
Realangle1.5707963Angle with the horizontal [rad]
Realeps1.E-6Small constant to avoid by-zero division
RealCpCoefMInitial[nComp, 7] Coefficients of the specific (per mass) heat capacity CpM[i] = CpCoefM[i,1] + CpCoefM[i,2]*T + ... + CpCoefM[i,7]*T**6
RealdensityInitial[nComp] Density of the pure components [M.L-3]
RealmassEnthalpyRefInitial[nComp]zeros(nComp)Specific (per mass) enthalpy at the reference temperature [L2.t-2]
RealtempRefInitial298Reference temperature for the enthalpy [T]
RealpercentVolSmallStep0.9Proportion of the vessel volume that triggers the reduction in the integration step-size
RealcompressCoef1.E-8Numeric compressibility coefficient [L.t2.M-1]

Connectors

TypeNameDescription
cutLiquidCinMassTopConnector for the liquid flow
cutLiquidCinMassBotConnector for the liquid flow
cutHeatMCinHeatConnector for the heat flow
cutVolConstrLiqconstraintVConnector for the volume constraint - Liquid

Modelica definition

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;

JARA2i.liq.liquidCp6PrefB JARA2i.liq.liquidCp6PrefB

Control volume containing a liquid mixture. The pressure on the liquid surface is constant.

JARA2i.liq.liquidCp6PrefB

Information

Control volume containing a liquid mixture. 
This class inherits form liquidCP6B.
This class imposes that the pressure on the liquid surface is constant.

Table 1. Interactive variables.
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.

Parameters

TypeNameDefaultDescription
IntegernComp1Number of components
BooleanEjsfalseGlobal parameter - Runtime interactivity
BooleanSysquakefalseGlobal parameter - Batch interactivity
RealmassLinitial[nComp] Initial condition - Mass inside the CV [M]
RealtempLinitial Initial condition - Temperature of the CV [T]
RealsectionInitial1Initial cross-section of the vessel [L2]
Realg9.8Gravitatorial acceleration [L.t-2]
Realangle1.5707963Angle with the horizontal [rad]
Realeps1.E-6Small constant to avoid by-zero division
RealCpCoefMInitial[nComp, 7] Coefficients of the specific (per mass) heat capacity CpM[i] = CpCoefM[i,1] + CpCoefM[i,2]*T + ... + CpCoefM[i,7]*T**6
RealdensityInitial[nComp] Density of the pure components [M.L-3]
RealmassEnthalpyRefInitial[nComp]zeros(nComp)Specific (per mass) enthalpy at the reference temperature [L2.t-2]
RealtempRefInitial298Reference temperature for the enthalpy [T]
RealpercentVolSmallStep0.9Proportion of the vessel volume that triggers the reduction in the integration step-size
RealcompressCoef1.E-8Numeric compressibility coefficient [L.t2.M-1]
RealpressTopReference0Pressure on the liquid surface [M.L-1.t-2]

Connectors

TypeNameDescription
cutLiquidCinMassTopConnector for the liquid flow
cutLiquidCinMassBotConnector for the liquid flow
cutHeatMCinHeatConnector for the heat flow
cutVolConstrLiqconstraintVConnector for the volume constraint - Liquid

Modelica definition

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;

JARA2i.liq.liquidCp6PrefVB JARA2i.liq.liquidCp6PrefVB

Liquid mixture contained in a control volume in mechanical equilibrium with a gas whose properties are not modeled.

JARA2i.liq.liquidCp6PrefVB

Information

    
This class models a liquid mixture.
The liquid mixture is contained in a control volume in mechanical equilibrium with a gas whose properties are not modeled.
This class is composed of the two following classes: liquidCP6PrefB and vesselLiqB

Parameters

TypeNameDefaultDescription
IntegernComp1Number of components of the liquid mixture
RealsectionInitial1Initial cross-section of the vessel [L2]
Realg9.8Gravitatorial acceleration [L.t-2]
Realangle1.5707963Angle with the horizontal [rad]
Realeps1.E-6Small constant to avoid by-zero division
RealCpCoefMInitial[nComp, 7] Coefficients of the specific (per mass) heat capacity CpM[i] = CpCoefM[i,1] + CpCoefM[i,2]*T + ... + CpCoefM[i,7]*T**6
RealdensityInitial[nComp] Density of the pure components [M.L-3]
RealmassEnthalpyRefInitial[nComp]zeros(nComp)Specific (per mass) enthalpy at the reference temperature [L2.t-2]
RealtempRefInitial298Reference temperature for the enthalpy [T]
RealpercentVolSmallStep0.9Proportion of the vessel volume that triggers the reduction in the integration step-size
RealcompressCoef1.E-8Numeric compressibility coefficient [L.t2.M-1]
RealpressTopReference0Pressure on the liquid surface [M.L-1.t-2]
RealvesselVolumeInitial1Initial vessel volume [L3]
RealmassLinitial[nComp] Initial condition [M]
RealtempLinitial Initial condition [T]

Connectors

TypeNameDescription
cutLiquidCinMassTopConnector for the liquid flow
cutLiquidCinMassBotConnector for the liquid flow
cutHeatMCinHeatConnector for the heat flow

Modelica definition

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;

JARA2i.liq.pipeDynLiqB JARA2i.liq.pipeDynLiqB

Partial model - Dynamic balance of linear momentum

JARA2i.liq.pipeDynLiqB

Information


                 This class inherits from convecLiqFlowB.
It contains the linear momentum balance applied to a large pipe (its length is greater than its diameter), straight with a constant arbitrary section and full of liquid.
This pipe connects two control volumes (CVs). Each CV contains a liquid mixture with a well defined pressure, temperature and concentration.
It is supposed that the following three forces are exerted on the liquid mixture filling the pipe in the flow direction:
gravitatorial force (if the pipe is inclined with respect to the horizontal), the force due to the pressure difference between the two pipe ends and the force due to the friction of the fluid in movement with the inner walls of the pipe.
This class has to be completed with an expression to compute the value of the Fanning adimensional friction factor.

Table 1. Interactive variables.
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.

Parameters

TypeNameDefaultDescription
IntegernComp1Number of components
BooleanEjsfalseGlobal parameter - Runtime interactivity
BooleanSysquakefalseGlobal parameter - Batch interactivity
RealCpCoefMInitial[nComp, 7] Coefficients of the specific (per mass) heat capacity CpM[i] = CpCoefM[i,1] + CpCoefM[i,2]*T + ... + CpCoefM[i,7]*T**6
RealmassEnthalpyRefInitial[nComp]zeros(nComp)Specific (per mass) enthalpy at the reference temperature [L2.t-2]
RealtempRefInitial298Reference temperature for the enthalpy [T]
Realeps1.E-6Small constant to avoid by-zero division
Reallength Pipe length [L]
Realsection Pipe cross-section [L2]
RealwettedArea Wetted pipe surface [L2]
RealheigthI0Heigth of the input control plane [L]
RealheigthO0Heigth of the input control plane [L]
Realdensity[nComp] Density of the components [M.L-3]
Realg9.8Gravitational acceleration [L.t-2]
RealepsMomentum1Coefficient of the fluid inertia

Connectors

TypeNameDescription
cutLiquidRinMassLiquid flow connector - R
cutLiquidRoutMassLiquid flow connector - R
cutHeatFCinHeatHeat flow connector -C
cutReceiversetPointSignal 

Modelica definition

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;

JARA2i.liq.pipeStatLiqB JARA2i.liq.pipeStatLiqB

Steady-state balance of linear momentum

JARA2i.liq.pipeStatLiqB

Information


                 This class inherits from convecLiqFlowB.
It contains the steady state linear momentum balance applied to a large pipe (its length is greater than its diameter), straight with a constant arbitrary section and full of liquid.
This pipe connects two control volumes (CVs). Each CV contains a liquid mixture with a well defined pressure, temperature and concentration.
It is supposed that the following three forces are exerted on the liquid mixture filling the pipe in the flow direction:
gravitatorial force (if the pipe is inclined with respect to the horizontal), the force due to the pressure difference between the two pipe ends and the force due to the friction of the fluid in movement with the inner walls of the pipe.
This class has to be completed with an expression to compute the value of the Fanning adimensional friction factor.

Table 1. Interactive variables.
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.

Parameters

TypeNameDefaultDescription
IntegernComp1Number of components
BooleanEjsfalseGlobal parameter - Runtime interactivity
BooleanSysquakefalseGlobal parameter - Batch interactivity
RealCpCoefMInitial[nComp, 7] Coefficients of the specific (per mass) heat capacity CpM[i] = CpCoefM[i,1] + CpCoefM[i,2]*T + ... + CpCoefM[i,7]*T**6
RealmassEnthalpyRefInitial[nComp]zeros(nComp)Specific (per mass) enthalpy at the reference temperature [L2.t-2]
RealtempRefInitial298Reference temperature for the enthalpy [T]
Realeps1.E-6Small constant to avoid by-zero division
Reallength Pipe length [L]
Realsection Pipe cross-section [L2]
RealwettedArea Wetted pipe surface [L2]
RealheigthI0Heigth of the input control plane [L]
RealheigthO0Heigth of the input control plane [L]
Realdensity[nComp] Density of the components [M.L-3]
Realg9.8Gravitational acceleration [L.t-2]

Connectors

TypeNameDescription
cutLiquidRinMassLiquid flow connector - R
cutLiquidRoutMassLiquid flow connector - R
cutHeatFCinHeatHeat flow connector -C
cutReceiversetPointSignal 

Modelica definition

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;

JARA2i.liq.pressEqLiqB JARA2i.liq.pressEqLiqB

Liquid flowing through a pipe

JARA2i.liq.pressEqLiqB

Information


                       This class inherits from convecLiqFlowB. 
                       It models the condition of pressure equality between two points of two control volumenes containing liquid mixtures.

Table 1. Interactive variables.
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.

Parameters

TypeNameDefaultDescription
IntegernComp1Number of components
BooleanEjsfalseGlobal parameter - Runtime interactivity
BooleanSysquakefalseGlobal parameter - Batch interactivity
RealCpCoefMInitial[nComp, 7] Coefficients of the specific (per mass) heat capacity CpM[i] = CpCoefM[i,1] + CpCoefM[i,2]*T + ... + CpCoefM[i,7]*T**6
RealmassEnthalpyRefInitial[nComp]zeros(nComp)Specific (per mass) enthalpy at the reference temperature [L2.t-2]
RealtempRefInitial298Reference temperature for the enthalpy [T]
Realeps1.E-6Small constant to avoid by-zero division
RealKprop10Slope of the pressure difference vs the total flow [L.t]

Connectors

TypeNameDescription
cutLiquidRinMassLiquid flow connector - R
cutLiquidRoutMassLiquid flow connector - R
cutHeatFCinHeatHeat flow connector -C

Modelica definition

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;

JARA2i.liq.pumpLiqB JARA2i.liq.pumpLiqB

Partial model: liquid pump

JARA2i.liq.pumpLiqB

Information


 
                         The pump exchanges matter through two control planes (CPs). 
The flow going into one CP is equal to the flow going from the other CP. The pump imposes the magnitude and sense of the matter flow.
The stirred mixture approximation has been applied to the temperature and composition of the flow through the pump.
That is to say, the temperature and composition of the fluid flow are equal to those of the fluid contained in the CV from which the fluid flows.
It has been defined a characteristic curve for the pump.
There exists a load pressure (pmax) above which it is not possible to pump fluid and a minimum pressure (pmin) below which it is no possible to extract fluid.
A linear transition from the flow setpoint value to the zero value has been defined in order to facilitate the numeric resolution. For that purpose, pmin and pcodo pressures have been defined.
This class inherits from convecLiqFlowB.

Table 1. Interactive variables.
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.

Parameters

TypeNameDefaultDescription
IntegernComp1Number of components
BooleanEjsfalseGlobal parameter - Runtime interactivity
BooleanSysquakefalseGlobal parameter - Batch interactivity
RealCpCoefMInitial[nComp, 7] Coefficients of the specific (per mass) heat capacity CpM[i] = CpCoefM[i,1] + CpCoefM[i,2]*T + ... + CpCoefM[i,7]*T**6
RealmassEnthalpyRefInitial[nComp]zeros(nComp)Specific (per mass) enthalpy at the reference temperature [L2.t-2]
RealtempRefInitial298Reference temperature for the enthalpy [T]
Realeps1.E-6Small constant to avoid by-zero division
Realpmax Parameter of the pump constitutive relation [M.L-1.t-2]
Realpmin Parameter of the pump constitutive relation [M.L-1.t-2]
Realpcodo Parameter of the pump constitutive relation [M.L-1.t-2]
Realpeps Parameter of the pump constitutive relation [M.L-1.t-2]

Connectors

TypeNameDescription
cutLiquidRinMassLiquid flow connector - R
cutLiquidRoutMassLiquid flow connector - R
cutHeatFCinHeatHeat flow connector -C

Modelica definition

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;

JARA2i.liq.pumpMassLiqB JARA2i.liq.pumpMassLiqB

Liquid pump. Setpoint: mass flow

JARA2i.liq.pumpMassLiqB

Information


                  This class inherits from pumpLiqB.
                  It contains the connector for the information flow.
This class contains mass flow set-point.

Table 1. Interactive variables.
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.

Parameters

TypeNameDefaultDescription
IntegernComp1Number of components
BooleanEjsfalseGlobal parameter - Runtime interactivity
BooleanSysquakefalseGlobal parameter - Batch interactivity
RealCpCoefMInitial[nComp, 7] Coefficients of the specific (per mass) heat capacity CpM[i] = CpCoefM[i,1] + CpCoefM[i,2]*T + ... + CpCoefM[i,7]*T**6
RealmassEnthalpyRefInitial[nComp]zeros(nComp)Specific (per mass) enthalpy at the reference temperature [L2.t-2]
RealtempRefInitial298Reference temperature for the enthalpy [T]
Realeps1.E-6Small constant to avoid by-zero division
Realpmax Parameter of the pump constitutive relation [M.L-1.t-2]
Realpmin Parameter of the pump constitutive relation [M.L-1.t-2]
Realpcodo Parameter of the pump constitutive relation [M.L-1.t-2]
Realpeps Parameter of the pump constitutive relation [M.L-1.t-2]

Connectors

TypeNameDescription
cutLiquidRinMassLiquid flow connector - R
cutLiquidRoutMassLiquid flow connector - R
cutHeatFCinHeatHeat flow connector -C
cutReceiversetPointSignalSet.point signal

Modelica definition

model pumpMassLiqB "Liquid pump. Setpoint: mass flow" 
  
   extends pumpLiqB;
  
   cutsB.cutReceiver setPointSignal(  dim=1, signal={totalMassFSP}) 
    "Set.point signal";
  
  
end pumpMassLiqB;

JARA2i.liq.pumpMolLiqB JARA2i.liq.pumpMolLiqB

Liquid pump. Setpoint: molar flow

JARA2i.liq.pumpMolLiqB

Information


                  This class inherits from pumpLiqB.
                  It contains the connector for the information flow.
This class contains molar flow set-point.

Table 1. Interactive variables.
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.

Parameters

TypeNameDefaultDescription
IntegernComp1Number of components
BooleanEjsfalseGlobal parameter - Runtime interactivity
BooleanSysquakefalseGlobal parameter - Batch interactivity
RealCpCoefMInitial[nComp, 7] Coefficients of the specific (per mass) heat capacity CpM[i] = CpCoefM[i,1] + CpCoefM[i,2]*T + ... + CpCoefM[i,7]*T**6
RealmassEnthalpyRefInitial[nComp]zeros(nComp)Specific (per mass) enthalpy at the reference temperature [L2.t-2]
RealtempRefInitial298Reference temperature for the enthalpy [T]
Realeps1.E-6Small constant to avoid by-zero division
Realpmax Parameter of the pump constitutive relation [M.L-1.t-2]
Realpmin Parameter of the pump constitutive relation [M.L-1.t-2]
Realpcodo Parameter of the pump constitutive relation [M.L-1.t-2]
Realpeps Parameter of the pump constitutive relation [M.L-1.t-2]
RealmolecWeigthInitial[nComp] Molecular weigth of the components [M.mol-1]

Connectors

TypeNameDescription
cutLiquidRinMassLiquid flow connector - R
cutLiquidRoutMassLiquid flow connector - R
cutHeatFCinHeatHeat flow connector -C
cutReceiversetPointSignalSet.point signal

Modelica definition

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;

JARA2i.liq.pumpVolLiqB JARA2i.liq.pumpVolLiqB

Liquid pump. Setpoint: volumetric flow

JARA2i.liq.pumpVolLiqB

Information


                  This class inherits from pumpLiqB.
                  It contains the connector for the information flow.
This class contains volumetric flow set-point.

Table 1. Interactive variables.
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.

Parameters

TypeNameDefaultDescription
IntegernComp1Number of components
BooleanEjsfalseGlobal parameter - Runtime interactivity
BooleanSysquakefalseGlobal parameter - Batch interactivity
RealCpCoefMInitial[nComp, 7] Coefficients of the specific (per mass) heat capacity CpM[i] = CpCoefM[i,1] + CpCoefM[i,2]*T + ... + CpCoefM[i,7]*T**6
RealmassEnthalpyRefInitial[nComp]zeros(nComp)Specific (per mass) enthalpy at the reference temperature [L2.t-2]
RealtempRefInitial298Reference temperature for the enthalpy [T]
Realeps1.E-6Small constant to avoid by-zero division
Realpmax Parameter of the pump constitutive relation [M.L-1.t-2]
Realpmin Parameter of the pump constitutive relation [M.L-1.t-2]
Realpcodo Parameter of the pump constitutive relation [M.L-1.t-2]
Realpeps Parameter of the pump constitutive relation [M.L-1.t-2]
RealdensityInitial[nComp] Density of the components [M.L-3]

Connectors

TypeNameDescription
cutLiquidRinMassLiquid flow connector - R
cutLiquidRoutMassLiquid flow connector - R
cutHeatFCinHeatHeat flow connector -C
cutReceiversetPointSignalSet.point signal

Modelica definition

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;

JARA2i.liq.sourceLiqFB JARA2i.liq.sourceLiqFB

Partial model: liquid source

JARA2i.liq.sourceLiqFB

Information


 
                         The flow source is a system that exchange matter with its enviroment through a control plane. 
The flow source has a setpoint of the mass fraction of each fluid component, a setpoint of the flow temperature and a setpoint of the total mass flow.
The functional relationship between the flow set-point and the ''real'' flow must take into account the pressure at the liquid flow-R connector.
The source behavior is defined by its characteristic curve (Fig. 1).
The characteristic curve relates the pressure and the mass-flow at the liquid flow-R connector with the mass-flow set-point at the information receiver connector (FSP in Fig. 1).
Additionally, the flow source imposes the composition and temperature of the flow.
If the flow goes into the source, the compostion and temperature of the flow will be those that has the control volume from which the source obtains the fluid.
Figure 1.Characteristic curve of the liquid source modeled in JARA.

Table 1. Interactive variables.
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.

Parameters

TypeNameDefaultDescription
IntegernComp1Number of components
BooleanEjsfalseGlobal parameter - Runtime interactivity
BooleanSysquakefalseGlobal parameter - Batch interactivity
RealCpCoefMInitial[nComp, 7] Coefficients of the specific (per mass) heat capacity CpM[i] = CpCoefM[i,1] + CpCoefM[i,2]*T + ... + CpCoefM[i,7]*T**6
RealmassEnthalpyRefInitial[nComp]zeros(nComp)Specific (per mass) enthalpy at the reference temperature [L2.t-2]
RealtempRefInitial298Reference temperature for the enthalpy [T]
Realpmax Parameter of the pump constitutive relation [M.L-1.t-2]
Realpmin Parameter of the pump constitutive relation [M.L-1.t-2]
Realpcodo Parameter of the pump constitutive relation [M.L-1.t-2]
Realpeps Parameter of the pump constitutive relation [M.L-1.t-2]
Realeps1.E-8Small constant to avoid by-zero division

Connectors

TypeNameDescription
cutLiquidRinMassConnector for the liquid flow

Modelica definition

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;

JARA2i.liq.sourceMassLiqFB JARA2i.liq.sourceMassLiqFB

Liquid source. Setpoints: total mass, mass fraction and temperature

JARA2i.liq.sourceMassLiqFB

Information


                  This class inherits from sourceLiqFB.
                  This class contains the connector for the information flow.
This class contains the following setpoints: total mass, mass fraction and temperature.

Table 1. Interactive variables.
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.

Parameters

TypeNameDefaultDescription
IntegernComp1Number of components
BooleanEjsfalseGlobal parameter - Runtime interactivity
BooleanSysquakefalseGlobal parameter - Batch interactivity
RealCpCoefMInitial[nComp, 7] Coefficients of the specific (per mass) heat capacity CpM[i] = CpCoefM[i,1] + CpCoefM[i,2]*T + ... + CpCoefM[i,7]*T**6
RealmassEnthalpyRefInitial[nComp]zeros(nComp)Specific (per mass) enthalpy at the reference temperature [L2.t-2]
RealtempRefInitial298Reference temperature for the enthalpy [T]
Realpmax Parameter of the pump constitutive relation [M.L-1.t-2]
Realpmin Parameter of the pump constitutive relation [M.L-1.t-2]
Realpcodo Parameter of the pump constitutive relation [M.L-1.t-2]
Realpeps Parameter of the pump constitutive relation [M.L-1.t-2]
Realeps1.E-8Small constant to avoid by-zero division

Connectors

TypeNameDescription
cutLiquidRinMassConnector for the liquid flow
cutReceiversetPointSignalSet point signals

Modelica definition

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;

JARA2i.liq.sourceMolLiqFB JARA2i.liq.sourceMolLiqFB

Liquid source. Setpoints: total molar flow, molar fraction and temperature.

JARA2i.liq.sourceMolLiqFB

Information


                  This class inherits from sourceLiqFB.
                  This class contains the connector for the information flow.
This class contains the following setpoints: total molar flow, molar fraction and temperature.

Table 1. Interactive variables.
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.

Parameters

TypeNameDefaultDescription
IntegernComp1Number of components
BooleanEjsfalseGlobal parameter - Runtime interactivity
BooleanSysquakefalseGlobal parameter - Batch interactivity
RealCpCoefMInitial[nComp, 7] Coefficients of the specific (per mass) heat capacity CpM[i] = CpCoefM[i,1] + CpCoefM[i,2]*T + ... + CpCoefM[i,7]*T**6
RealmassEnthalpyRefInitial[nComp]zeros(nComp)Specific (per mass) enthalpy at the reference temperature [L2.t-2]
RealtempRefInitial298Reference temperature for the enthalpy [T]
Realpmax Parameter of the pump constitutive relation [M.L-1.t-2]
Realpmin Parameter of the pump constitutive relation [M.L-1.t-2]
Realpcodo Parameter of the pump constitutive relation [M.L-1.t-2]
Realpeps Parameter of the pump constitutive relation [M.L-1.t-2]
Realeps1.E-8Small constant to avoid by-zero division
RealmolecWeigth[nComp] Molecular weigth of the components [M.mol-1]

Connectors

TypeNameDescription
cutLiquidRinMassConnector for the liquid flow
cutReceiversetPointSignal 

Modelica definition

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;

JARA2i.liq.sourcePressLiqB JARA2i.liq.sourcePressLiqB

Pressure source.

JARA2i.liq.sourcePressLiqB

Information


 
                        The pressure source is modeled as a control volume (CV) containing an undepleted mass whose pressure, 
                        composition and matter flow
                        are independent of the flow of matter going from or into the source.
The value of the mass of each component, the pressure and the temperature contained inside the CV have to be a function only of the state variables and/or the time.
This class inherits from interf.liquid1I.

Parameters

TypeNameDefaultDescription
IntegernComp1Number of components of the liquid mixture

Connectors

TypeNameDescription
cutLiquidCinMassConnector for the liquid flow

Modelica definition

model sourcePressLiqB "Pressure source." 
  
   extends interf.liquid1I;
  
equation 
  
end sourcePressLiqB;

JARA2i.liq.sourceVolLiqFB JARA2i.liq.sourceVolLiqFB

Liquid source. Setpoints: total volumetric flow, volume fraction and temperature.

JARA2i.liq.sourceVolLiqFB

Information


                  This class inherits from sourceLiqFB.
                  This class contains the connector for the information flow.
This class contains the following setpoints: total volumetric flow, volume fraction and temperature.

Table 1. Interactive variables.
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.

Parameters

TypeNameDefaultDescription
IntegernComp1Number of components
BooleanEjsfalseGlobal parameter - Runtime interactivity
BooleanSysquakefalseGlobal parameter - Batch interactivity
RealCpCoefMInitial[nComp, 7] Coefficients of the specific (per mass) heat capacity CpM[i] = CpCoefM[i,1] + CpCoefM[i,2]*T + ... + CpCoefM[i,7]*T**6
RealmassEnthalpyRefInitial[nComp]zeros(nComp)Specific (per mass) enthalpy at the reference temperature [L2.t-2]
RealtempRefInitial298Reference temperature for the enthalpy [T]
Realpmax Parameter of the pump constitutive relation [M.L-1.t-2]
Realpmin Parameter of the pump constitutive relation [M.L-1.t-2]
Realpcodo Parameter of the pump constitutive relation [M.L-1.t-2]
Realpeps Parameter of the pump constitutive relation [M.L-1.t-2]
Realeps1.E-8Small constant to avoid by-zero division
RealdensityInitial[nComp] Density of the components [M.L-3]

Connectors

TypeNameDescription
cutLiquidRinMassConnector for the liquid flow
cutReceiversetPointSignalSetpoint signals

Modelica definition

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;

JARA2i.liq.vesselLiqB JARA2i.liq.vesselLiqB

Vessel with a constant volume.

JARA2i.liq.vesselLiqB

Information

Vessel with a constant volume. 
This class inherits from interf.vesselI.
This model includes an equation to set the vessel volume.

Table 1. Interactive variables.
vesselVolume Vessel Volume.

Parameters

TypeNameDefaultDescription
BooleanEjsfalseRun-time interactivity
BooleanSysquakefalseBatch interactivity
RealvesselVolumeInitial Vessel volume. Initial value [L3]

Connectors

TypeNameDescription
cutVolConstrVesselconstraintVVolume constraint - Vessel.

Modelica definition

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;

HTML-documentation generated by Dymola Tue Jul 24 19:08:19 2007.