JARA2i.gas

Gas models

Information


 

Models of gas CV, gas mixtures TP and BC



This package contains some models of gaseous CVs, gaseous mixtures TP (e.g., gas-flow by convection and diffusion, valves, pumps, etc.) and boundary conditions (i.e., gas-flow and pressure sources).


The mixtures of gases are considered ideal and they can be composed of an arbitrary number of components.

.


Figure 1.Classes included in gas.mo.



Package Content

NameDescription
JARA2i.gas.convecGasFlowB convecGasFlowB Partial model - Convective flow of gas.
JARA2i.gas.diffSemiPerfGasBinCp6B diffSemiPerfGasBinCp6B Diffusion of an ideal, binary gas
JARA2i.gas.pipeDynGasB pipeDynGasB Gas flowing through a pipe
JARA2i.gas.pressEqGasB pressEqGasB Gas flowing through a pipe
JARA2i.gas.pumpGasB pumpGasB Partial model - Gas pump
JARA2i.gas.pumpMassGasB pumpMassGasB Gas pump. Setpoint: total mass-flow
JARA2i.gas.pumpMolGasB pumpMolGasB Gas pump. Setpoint: total molar-flow
JARA2i.gas.pumpVolGasB pumpVolGasB Gas pump. Setpoint: total volumetric-flow
JARA2i.gas.semiPerfGasCp6B semiPerfGasCp6B Homogeneous mixture of semi-perfect gases.
JARA2i.gas.semiPerfGasCp6VB semiPerfGasCp6VB Homogeneous mixture of semi-perfect gases inside a vessel.
JARA2i.gas.sourceGasFB sourceGasFB Gas-flow source
JARA2i.gas.sourceMassGasFB sourceMassGasFB Gas-flow source. Setpoint: total mass-flow, flow molar-fraction and flow temperature.
JARA2i.gas.sourceMolGasFB sourceMolGasFB Gas-flow source. Setpoint: total molar-flow, flow molar-fraction and flow temperature.
JARA2i.gas.sourcePressGasB sourcePressGasB Partial model - Pressure source. The across variables should be a funcion of time and state variables.
JARA2i.gas.sourceVolGasFB sourceVolGasFB Gas-flow source. Setpoint: total volume-flow, flow molar-fraction and flow temperature
JARA2i.gas.vesselGasB vesselGasB Vessel with a constant volume.


JARA2i.gas.convecGasFlowB JARA2i.gas.convecGasFlowB

Partial model - Convective flow of gas.

JARA2i.gas.convecGasFlowB

Information


    This class inherits from interf.gasFlow2qI.
The heat convection is modeled as a transport phenomena established between the thermal control planes of two adjacent control volumes (CVs): solid CV-gas 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 computation of the temperature and the composition of the fluid leaving a CV by convection.
This class provides an expression for the enthalpy flow in function of the molar flow of each component and the flow temperature.
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.

Parameters

TypeNameDefaultDescription
IntegernComp1Number of components
RealCpCoefN[nComp, 7] Coefficients of the molar heat capacity at constant pressure CpMol[i] = CpCoefN[i,1] + CpCoefN[i,2]*T + ... + CpCoefN[i,7]*T**6
Realeps1.E-10Small constant to avoid by-zero division
RealmolEnthalpyRef[nComp]zeros(nComp)Molar enthalpy of the components at the reference temperature [M.L2.t-2.mol-1]
RealtempRef298Reference temperature for enthalpy [T]

Connectors

TypeNameDescription
cutGasRinMolGas flow - Connector Resistive.
cutGasRoutMolGas flow - Connector Resistive.
cutHeatFCinHeatHeat flow - Connector F-C. Connector for the heat convection.

Modelica definition

partial model convecGasFlowB 
  "Partial model - Convective flow of gas." 
  
   extends interf.gasFlow2qI;
  
   parameter Real CpCoefN[nComp,7] "Coefficients of the molar heat capacity at constant pressure
                                      CpMol[i] = CpCoefN[i,1] + CpCoefN[i,2]*T + ... + CpCoefN[i,7]*T**6";
  
   parameter Real eps( unit="") = 1.E-10 
    "Small constant to avoid by-zero division";
  
   parameter Real molEnthalpyRef[nComp]( unit="M.L2.t-2.mol-1") = zeros(nComp) 
    "Molar enthalpy of the components at the reference temperature";
  
   parameter Real tempRef(   unit="T") =  298 
    "Reference temperature for enthalpy";
  
   Real totalMolF(               unit="mol.t-1") "Total molar flow";
  
   Boolean flowIsPosit( start=true) "Flow direction";
  
   Real totalMolI(     unit="mol") "Total number of mols";
   Real totalMolO(     unit="mol") "Total number of mols";
  
   Real molEnthalpy[nComp](  unit="M.L2.t-2.mol-1") 
    "Molar enthalpy of the components";
  
equation 
   // Relationship among the interface variables
   outMol.energyGF + inMol.energyGF + inHeat.heatF = 0;
   inMol.molGF = - outMol.molGF;
   inMol.molGF = inHeat.matterF;
  
   // Flow direction
   flowIsPosit = totalMolF > 0;
  
   // Flow molar-fraction
   if nComp > 1 then
      for i in 1:(nComp-1) loop
         inHeat.matterF[i] = if flowIsPosit then 
                                   totalMolF * inMol.molG[i]  / ( totalMolI + eps) else 
                                   totalMolF * outMol.molG[i] / ( totalMolO + eps);
      end for;
   end if;
  
   // Flujo molar total 
   totalMolF = sum(inHeat.matterF[i] for i in 1:nComp);
  
   // Mols 
   totalMolI = sum(inMol.molG[i]  for i in 1:nComp);
   totalMolO = sum(outMol.molG[i] for i in 1:nComp);
  
   // Flow temperature
   inHeat.tempF = if flowIsPosit then inMol.tempG else outMol.tempG;
  
   // Relationship between the molar enthalpy of the components and the temperature
   for i in 1:nComp loop
      molEnthalpy[i] = molEnthalpyRef[i] +
                       CpCoefN[i,1] *       ( inHeat.tempF    - tempRef)     +
                       CpCoefN[i,2] * 1/2 * ( inHeat.tempF^ 2 - tempRef^ 2)  +
                       CpCoefN[i,3] * 1/3 * ( inHeat.tempF^ 3 - tempRef^ 3)  +
                       CpCoefN[i,4] * 1/4 * ( inHeat.tempF^ 4 - tempRef^ 4)  +
                       CpCoefN[i,5] * 1/5 * ( inHeat.tempF^ 5 - tempRef^ 5)  +
                       CpCoefN[i,6] * 1/6 * ( inHeat.tempF^ 6 - tempRef^ 6)  +
                       CpCoefN[i,7] * 1/7 * ( inHeat.tempF^ 7 - tempRef^ 7);
   end for;
  
   // Total flow of energy
   sum(inHeat.matterF[i]*molEnthalpy[i] for i in 1:nComp) = if flowIsPosit then inMol.energyGF else -outMol.energyGF;
  
  
end convecGasFlowB;

JARA2i.gas.diffSemiPerfGasBinCp6B JARA2i.gas.diffSemiPerfGasBinCp6B

Diffusion of an ideal, binary gas

JARA2i.gas.diffSemiPerfGasBinCp6B

Information


                         This class inherits from interf.gasFlow2I.
It model the diffusion flow of an ideal binary gas between two control volumes (CVs).
The class equations have to be completed with expressions to compute the binary diffusion coefficient and the diffusion section between the two CVs.

Parameters

TypeNameDefaultDescription
IntegernComp1Number of components
RealmolEnthalpyRef[2]0Molar enthalpy at the reference temperature [M.L2.t-2.mol-1]
RealtempRef298Reference temperature [T]
RealCpCoefN[2, 7] Coefficients of the molar heat capacity at constant pressure Cp[i] = CpCoefN[i,1] + CpCoefN[i,2]*T + ... + CpCoefN[i,7]*T**6
RealdiffLength Distance between the control volumes [L]
Realeps1.E-10Small constant to avoid by-zero division
RealperfGasConst Constant of the perfect gases [M.L2.t-2.T-1]

Connectors

TypeNameDescription
cutGasRinMolGas flow - Connector Resistive
cutGasRoutMolGas flow - Connector Resistive

Modelica definition

model diffSemiPerfGasBinCp6B "Diffusion of an ideal, binary gas" 
  
   extends interf.gasFlow2I(nComp=2);
  
   parameter Real molEnthalpyRef[ 2](  unit="M.L2.t-2.mol-1") = 0 
    "Molar enthalpy at the reference temperature";
   parameter Real tempRef(             unit="T") =              298 
    "Reference temperature";
  
   parameter Real CpCoefN[ 2,7] "Coefficients of the molar heat capacity at constant pressure
                                  Cp[i] = CpCoefN[i,1] + CpCoefN[i,2]*T + ... + CpCoefN[i,7]*T**6";
  
   parameter Real diffLength(    unit="L") 
    "Distance between the control volumes";
  
   parameter Real eps(  unit="") = 1.E-10 
    "Small constant to avoid by-zero division";
  
   parameter Real perfGasConst(   unit="M.L2.t-2.T-1") 
    "Constant of the perfect gases";
  
protected 
   Real diffArea(           unit="L2") 
    "Diffusion section between the control volumes";
   Real diffCoefI(          unit="L2.t-1") "Diffusion coefficient";
   Real diffCoefO(          unit="L2.t-1") "Diffusion coefficient";
   Real gasIVolume(         unit="L3") "Volume of the gas mixture";
   Real gasOVolume(         unit="L3") "Volume of the gas mixture";
  
   Real molEnthalpyTempI[      2](  unit="M.L2.t-2.mol-1") 
    "Molar enthalpy of the flow from inMass to outMass";
   Real molEnthalpyTempO[      2](  unit="M.L2.t-2.mol-1") 
    "Molar enthalpy of the flow from outMass to inMass";
equation 
  
   // Relationship among the interface variables
   inMol.molGF = - outMol.molGF;
   inMol.energyGF + outMol.energyGF = 0;
  
   // State equation of the perfect gases
   ( inMol.pressG  + eps)  * gasIVolume = (inMol.molG[1]  + inMol.molG[2])  * perfGasConst * inMol.tempG;
   ( outMol.pressG + eps)  * gasOVolume = (outMol.molG[1] + outMol.molG[2]) * perfGasConst * outMol.tempG;
  
   // Fick law
   inMol.molGF = diffArea * ( diffCoefI * inMol.molG  / ( gasIVolume + eps)  -
                               diffCoefO * outMol.molG / ( gasOVolume + eps))     / diffLength;
  
   // Molar-enthalpy flow from inMass to outMass
   molEnthalpyTempI = molEnthalpyRef + CpCoefN * [        inMol.tempG    - tempRef;
                                                  1/2 * ( inMol.tempG^ 2 - tempRef^ 2);
                                                  1/3 * ( inMol.tempG^ 3 - tempRef^ 3);
                                                  1/4 * ( inMol.tempG^ 4 - tempRef^ 4);
                                                  1/5 * ( inMol.tempG^ 5 - tempRef^ 5);
                                                  1/6 * ( inMol.tempG^ 6 - tempRef^ 6);
                                                  1/7 * ( inMol.tempG^ 7 - tempRef^ 7)];
  
   // Molar-enthalpy flow from outMass to inMass
   molEnthalpyTempO = molEnthalpyRef + CpCoefN * [        outMol.tempG    - tempRef;
                                                  1/2 * ( outMol.tempG^ 2 - tempRef^ 2);
                                                  1/3 * ( outMol.tempG^ 3 - tempRef^ 3);
                                                  1/4 * ( outMol.tempG^ 4 - tempRef^ 4);
                                                  1/5 * ( outMol.tempG^ 5 - tempRef^ 5);
                                                  1/6 * ( outMol.tempG^ 6 - tempRef^ 6);
                                                  1/7 * ( outMol.tempG^ 7 - tempRef^ 7)];
  
   // Enthalpy flow
   inMol.energyGF = diffArea * ( diffCoefI * sum(inMol.molG[i]*molEnthalpyTempI[i] for i in 1:2) /
                   ( gasIVolume + eps)  -
                                 diffCoefO * sum(outMol.molG[i]* molEnthalpyTempO[i] for i in 1:2) /
                   ( gasOVolume + eps))   / diffLength;
  
  
end diffSemiPerfGasBinCp6B;

JARA2i.gas.pipeDynGasB JARA2i.gas.pipeDynGasB

Gas flowing through a pipe

JARA2i.gas.pipeDynGasB

Information


                 This class inherits from convecGasFlowB.
It contains the linear momentum balance applied to a gas mixture flowing through a pipe.
The gas mixture obeys the gas perfect equation.
It is assumed that the density of the gas contained in the pipe is equal to the density of the gas mixture contained in the CV from which the flow comes from.

Parameters

TypeNameDefaultDescription
IntegernComp1Number of components
RealCpCoefN[nComp, 7] Coefficients of the molar heat capacity at constant pressure CpMol[i] = CpCoefN[i,1] + CpCoefN[i,2]*T + ... + CpCoefN[i,7]*T**6
Realeps1.E-10Small constant to avoid by-zero division
RealmolEnthalpyRef[nComp]zeros(nComp)Molar enthalpy of the components at the reference temperature [M.L2.t-2.mol-1]
RealtempRef298Reference temperature for enthalpy [T]
Reallength Pipe length [L]
Realsection Pipe cross-section [L2]
RealwettedArea Wetted area of the pipe [L2]
RealperfGasConst Constant of the perfect gases [M.L2.t-2.T-1]
RealmolecWeigth[nComp] Molecular weight of the components [M.mol-1]
RealepsMomentum1Dynamic balance of linear momentum. = small value. Steady-state balance.

Connectors

TypeNameDescription
cutGasRinMolGas flow - Connector Resistive.
cutGasRoutMolGas flow - Connector Resistive.
cutHeatFCinHeatHeat flow - Connector F-C. Connector for the heat convection.
cutReceiversetPointSignalSetpoint signal

Modelica definition

model pipeDynGasB "Gas flowing through a pipe" 
  
   extends convecGasFlowB;
  
   cutsB.cutReceiver setPointSignal(  dim=1, signal={valveOpeningSP}) 
    "Setpoint signal";
  
   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 area of the pipe";
   parameter Real perfGasConst(        unit="M.L2.t-2.T-1") 
    "Constant of the perfect gases";
   parameter Real molecWeigth[nComp](  unit="M.mol-1") 
    "Molecular weight of the components";
   parameter Real epsMomentum(         unit="") =   1 "Dynamic balance of linear momentum.
                                                              = small value. Steady-state balance.";
  
protected 
   Real veloc(           unit="L.t-1") "Velocity of the flow";
   Real linMomentum(     unit="M.L.t-1") "Lineal momentum";
   Real pressForce(      unit="M.L.t-2") "Pressure-diference force";
   Real fricForce(       unit="M.L.t-2") "Friction force";
   Real gasDensity(      unit="M.L-3") "Gas density";
   Real fanning(         unit="") "Fanning's adimensional coeficient";
   Real totalMassF(      unit="M.t-1") "Total mass-flow";
   Real totalForce(      unit="M.L.t-2") "Total force";
   Real valveOpening(    unit="", min=0, max=1) "Valve opening. Bounded value";
  
equation 
   // Density of the gas flow
   gasDensity = if linMomentum > 0 then 
          sum(molecWeigth[i]*inMol.molG[i] for i in 1:nComp) * inMol.pressG /
          ( totalMolI * perfGasConst * inMol.tempG + eps) else 
          sum(molecWeigth[i]*outMol.molG[i] for i in 1:nComp) * outMol.pressG /
          ( totalMolO * perfGasConst * outMol.tempG + eps);
  
   // Pressure-difference force 
   pressForce = section * ( inMol.pressG - outMol.pressG);
  
   // Friction force
   fricForce = if linMomentum > 0 then 
                    -wettedArea * 0.5 * gasDensity * veloc^ 2 * fanning else 
                     wettedArea * 0.5 * gasDensity * veloc^ 2 * fanning;
  
   // Bounding of the valve-opening signal
   valveOpening = if valveOpeningSP > 1 then 
                       1 else 
                       if valveOpeningSP < 0 then 
                            0 else 
                            valveOpeningSP;
  
   // Linear momentum balance
   totalForce  = fricForce + valveOpening^ 2 * pressForce;
   epsMomentum * der(linMomentum) = totalForce;
  
   when linMomentum > 0 and not ( sum(inMol.molG[i]  for i in 1:nComp) > 0) or 
        linMomentum < 0 and not ( sum(outMol.molG[i] for i in 1:nComp) > 0) or 
        not valveOpeningSP > 0 then
      reinit(linMomentum,0);
   end when;
  
   linMomentum = totalMassF * length;
  
   totalMassF = sum(molecWeigth[i]*inHeat.matterF[i] for i in 1:nComp);
  
   totalMassF = section * ( gasDensity + eps)  * veloc;
  
  
end pipeDynGasB;

JARA2i.gas.pressEqGasB JARA2i.gas.pressEqGasB

Gas flowing through a pipe

JARA2i.gas.pressEqGasB

Information


                       This class inherits from convecGasFlowB. 
                       It models the condition of pressure equality between two control volumenes containing gas mixtures.

Parameters

TypeNameDefaultDescription
IntegernComp1Number of components
RealCpCoefN[nComp, 7] Coefficients of the molar heat capacity at constant pressure CpMol[i] = CpCoefN[i,1] + CpCoefN[i,2]*T + ... + CpCoefN[i,7]*T**6
Realeps1.E-10Small constant to avoid by-zero division
RealmolEnthalpyRef[nComp]zeros(nComp)Molar enthalpy of the components at the reference temperature [M.L2.t-2.mol-1]
RealtempRef298Reference temperature for enthalpy [T]
RealKprop1E3Coefficient [mol.t.L.M-1]

Connectors

TypeNameDescription
cutGasRinMolGas flow - Connector Resistive.
cutGasRoutMolGas flow - Connector Resistive.
cutHeatFCinHeatHeat flow - Connector F-C. Connector for the heat convection.

Modelica definition

model pressEqGasB "Gas flowing through a pipe" 
  
   extends convecGasFlowB;
  
   parameter Real Kprop(   unit="mol.t.L.M-1") = 1E3 "Coefficient";
  
protected 
   Real pressDif(         unit="M.L-1.t-2") "Pressure difference";
   Real relatError(       unit="") "Relative error";
  
equation 
   // Pressure difference
   // It has been arbitrary defined that the molar flow is proportional to the pressure gradient.
   pressDif = inMol.pressG - outMol.pressG;
  
   // The molar flow is proportional to the pressure difference
   totalMolF = Kprop * pressDif;
  
   // Relative error of assuming zero pressure-difference
   relatError = abs(pressDif) / ( 0.5 * ( inMol.pressG + outMol.pressG + eps));
  
  
end pressEqGasB;

JARA2i.gas.pumpGasB JARA2i.gas.pumpGasB

Partial model - Gas pump

JARA2i.gas.pumpGasB

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 gas contained in the CV from which the gas 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 gas and a minimum pressure (pmin) below which it is no possible to extract gas.
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 convecGasFlowB.

Parameters

TypeNameDefaultDescription
IntegernComp1Number of components
RealCpCoefN[nComp, 7] Coefficients of the molar heat capacity at constant pressure CpMol[i] = CpCoefN[i,1] + CpCoefN[i,2]*T + ... + CpCoefN[i,7]*T**6
Realeps1.E-10Small constant to avoid by-zero division
RealmolEnthalpyRef[nComp]zeros(nComp)Molar enthalpy of the components at the reference temperature [M.L2.t-2.mol-1]
RealtempRef298Reference temperature for 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]

Connectors

TypeNameDescription
cutGasRinMolGas flow - Connector Resistive.
cutGasRoutMolGas flow - Connector Resistive.
cutHeatFCinHeatHeat flow - Connector F-C. Connector for the heat convection.

Modelica definition

partial model pumpGasB "Partial model - Gas pump" 
  
   extends convecGasFlowB;
  
   Real totalMolFSP(    unit="mol.t-1") "Setpoint of the total molar-flow";
  
   // Parameters of the pump constitutive relation: 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;
   Real coefPressFrom;
  
equation 
   // Load pressure
   pressTo = if totalMolFSP > 0 then outMol.pressG else inMol.pressG;
  
   // Source pressure
   pressFrom = if totalMolFSP > 0 then inMol.pressG else outMol.pressG;
  
   // 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;
  
   totalMolF = coefPressTo * coefPressFrom * totalMolFSP;
  
  
end pumpGasB;

JARA2i.gas.pumpMassGasB JARA2i.gas.pumpMassGasB

Gas pump. Setpoint: total mass-flow

JARA2i.gas.pumpMassGasB

Information


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

Parameters

TypeNameDefaultDescription
IntegernComp1Number of components
RealCpCoefN[nComp, 7] Coefficients of the molar heat capacity at constant pressure CpMol[i] = CpCoefN[i,1] + CpCoefN[i,2]*T + ... + CpCoefN[i,7]*T**6
Realeps1.E-10Small constant to avoid by-zero division
RealmolEnthalpyRef[nComp]zeros(nComp)Molar enthalpy of the components at the reference temperature [M.L2.t-2.mol-1]
RealtempRef298Reference temperature for 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]
RealmolecWeigth[nComp] Molecular weigth of the components [M.moles-1]

Connectors

TypeNameDescription
cutGasRinMolGas flow - Connector Resistive.
cutGasRoutMolGas flow - Connector Resistive.
cutHeatFCinHeatHeat flow - Connector F-C. Connector for the heat convection.
cutReceiversetPointSignalSet.point signal

Modelica definition

model pumpMassGasB "Gas pump. Setpoint: total mass-flow" 
  
   extends pumpGasB;
  
   cutsB.cutReceiver setPointSignal(   dim=1, signal={totalMassFSP}) 
    "Set.point signal";
  
   Real totalMassFSP(     unit="M.t-1") "Setpoint of the total mass-flow";
  
   parameter Real molecWeigth[nComp](  unit="M.moles-1") 
    "Molecular weigth of the components";
  
equation 
   totalMolFSP = if totalMassFSP > 0 then 
                      totalMolI * totalMassFSP / ( sum(molecWeigth[i]*inMol.molG[i]  for i in 1:nComp)  + eps) else 
                      totalMolO * totalMassFSP / ( sum(molecWeigth[i]*outMol.molG[i] for i in 1:nComp)  + eps);
  
  
end pumpMassGasB;

JARA2i.gas.pumpMolGasB JARA2i.gas.pumpMolGasB

Gas pump. Setpoint: total molar-flow

JARA2i.gas.pumpMolGasB

Information


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

Parameters

TypeNameDefaultDescription
IntegernComp1Number of components
RealCpCoefN[nComp, 7] Coefficients of the molar heat capacity at constant pressure CpMol[i] = CpCoefN[i,1] + CpCoefN[i,2]*T + ... + CpCoefN[i,7]*T**6
Realeps1.E-10Small constant to avoid by-zero division
RealmolEnthalpyRef[nComp]zeros(nComp)Molar enthalpy of the components at the reference temperature [M.L2.t-2.mol-1]
RealtempRef298Reference temperature for 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]

Connectors

TypeNameDescription
cutGasRinMolGas flow - Connector Resistive.
cutGasRoutMolGas flow - Connector Resistive.
cutHeatFCinHeatHeat flow - Connector F-C. Connector for the heat convection.
cutReceiversetPointSignalSet.point signal

Modelica definition

model pumpMolGasB "Gas pump. Setpoint: total molar-flow" 
  
   extends pumpGasB;
  
   cutsB.cutReceiver setPointSignal(   dim=1, signal={totalMolFSP}) 
    "Set.point signal";
  
equation 
  
end pumpMolGasB;

JARA2i.gas.pumpVolGasB JARA2i.gas.pumpVolGasB

Gas pump. Setpoint: total volumetric-flow

JARA2i.gas.pumpVolGasB

Information


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

Parameters

TypeNameDefaultDescription
IntegernComp1Number of components
RealCpCoefN[nComp, 7] Coefficients of the molar heat capacity at constant pressure CpMol[i] = CpCoefN[i,1] + CpCoefN[i,2]*T + ... + CpCoefN[i,7]*T**6
Realeps1.E-10Small constant to avoid by-zero division
RealmolEnthalpyRef[nComp]zeros(nComp)Molar enthalpy of the components at the reference temperature [M.L2.t-2.mol-1]
RealtempRef298Reference temperature for 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]
RealperfGasConst Perfect-gas constant [M.L2.t-2.T-1]

Connectors

TypeNameDescription
cutGasRinMolGas flow - Connector Resistive.
cutGasRoutMolGas flow - Connector Resistive.
cutHeatFCinHeatHeat flow - Connector F-C. Connector for the heat convection.
cutReceiversetPointSignalSet-point signal

Modelica definition

model pumpVolGasB "Gas pump. Setpoint: total volumetric-flow" 
  
   extends pumpGasB;
  
   cutsB.cutReceiver setPointSignal(   dim=1, signal={totalVolFSP}) 
    "Set-point signal";
  
   Real totalVolFSP(    unit="L3.t-1") "Setpoint of the volumetric flow";
  
   parameter Real perfGasConst( unit="M.L2.t-2.T-1") "Perfect-gas constant";
  
equation 
   0 = if totalVolFSP > 0 then 
            inMol.pressG  * totalVolFSP - totalMolFSP * perfGasConst * ( inMol.tempG + eps) else 
            outMol.pressG * totalVolFSP - totalMolFSP * perfGasConst * ( outMol.tempG + eps);
  
  
end pumpVolGasB;

JARA2i.gas.semiPerfGasCp6B JARA2i.gas.semiPerfGasCp6B

Homogeneous mixture of semi-perfect gases.

JARA2i.gas.semiPerfGasCp6B

Information

 
Homogeneous mixture of semi-perfect gases.
It is assumed that the heat capacity at constant pressure of each component can be written as a polynomial of the temperature.
The highest polynomial degree is 6.

Parameters

TypeNameDefaultDescription
IntegernComp1Number of components
RealmolGinitial[nComp] Number of gas moles - Initial condition [mol]
RealtempGinitial Gas temperature - Initial condition [T]
RealperfGasConst Constant of the perfect gases [M.L2.t-2.T-1]
RealCpCoefN[nComp, 7] Coefficients of the molar heat capacity at constant pressure CpMol[i] = CpCoefN[i,1] + CpCoefN[i,2]*T + ... + CpCoefN[i,7]*T**6
Realeps1.E-10Small constant to avoid by-zero division
RealmolEnthalpyRef[nComp]zeros(nComp)Molar enthalpy of the components at the reference temperature [M.L2.t-2.mol-1]
RealtempRef298Reference temperature for enthalpy [T]

Connectors

TypeNameDescription
cutGasCinMolGas flow - Connector Capacitive
cutHeatMCinHeatHeat flow - Connector M-C
cutVolConstrGasconstraintVVolume constraint - Gas

Modelica definition

model semiPerfGasCp6B "Homogeneous mixture of semi-perfect gases." 
  
   extends interf.gasV1I;
  
   parameter Real molGinitial[nComp]( unit="mol") 
    "Number of gas moles - Initial condition";
   parameter Real tempGinitial(       unit="T") 
    "Gas temperature - Initial condition";
  
   parameter Real perfGasConst(       unit="M.L2.t-2.T-1") 
    "Constant of the perfect gases";
  
   parameter Real CpCoefN[nComp,7] "Coefficients of the molar heat capacity at constant pressure
                                      CpMol[i] = CpCoefN[i,1] + CpCoefN[i,2]*T + ... + CpCoefN[i,7]*T**6";
  
   parameter Real eps( unit="") = 1.E-10 
    "Small constant to avoid by-zero division";
  
   parameter Real molEnthalpyRef[nComp]( unit="M.L2.t-2.mol-1") =   zeros(nComp) 
    "Molar enthalpy of the components at the reference temperature";
  
   parameter Real tempRef(  unit="T") =   298 
    "Reference temperature for enthalpy";
  
   Real molG[     nComp](    unit="mol", start=molGinitial,  fixed=true) 
    "Number of gas moles";                                                                      //CCC
   Real tempG(               unit="K",   start=tempGinitial, fixed=true) 
    " Gas temperature";
  
   Real fluidV(                   unit="m^3") "Gas volume";
  
protected 
   Real dIntEnergy(               unit="M.L2.t-3") 
    "Derivative of the total internal energy";
   Real molIntEnergy[     nComp]( unit="M.L2.t-2.mol-1") 
    "Molar internal energy of the components";
   Real aux[     nComp];
   Real vesselV;
  
equation 
   // Variable of the volume constraint connector
   vesselV = constraintV.vcF;
  
   // Relationship among the interface variables
   inHeat.matter     = molG;
   inMol.molG        = molG;
  
   inHeat.temp       = tempG;
   inMol.tempG       = tempG;
  
   // constraintV.press = inMol.pressG;
   constraintV.vcE[3] = inMol.pressG;
  
   // Molar balance
   der(molG) = inMol.molGF;
  
   // Energy balance
   dIntEnergy = inMol.energyGF + inHeat.heatF;
  
   // The gas volume is equal to the control-volume volume
   fluidV = vesselV;
  
   // State equation of the perfect gases
   inMol.pressG * ( fluidV + eps)  = sum(inMol.molG[i] for i in 1:nComp) * perfGasConst * inMol.tempG;
  
   // Relationship between the molar internal energy and the temperature
  
   for i in 1:nComp loop
      molIntEnergy[i] = molEnthalpyRef[i] - perfGasConst * inMol.tempG +
                        CpCoefN[i,1] *       ( (inMol.tempG+eps)    - tempRef)     +
                        CpCoefN[i,2] * 1/2 * ( (inMol.tempG+eps)^ 2 - tempRef^ 2)  +
                        CpCoefN[i,3] * 1/3 * ( (inMol.tempG+eps)^ 3 - tempRef^ 3)  +
                        CpCoefN[i,4] * 1/4 * ( (inMol.tempG+eps)^ 4 - tempRef^ 4)  +
                        CpCoefN[i,5] * 1/5 * ( (inMol.tempG+eps)^ 5 - tempRef^ 5)  +
                        CpCoefN[i,6] * 1/6 * ( (inMol.tempG+eps)^ 6 - tempRef^ 6)  +
                        CpCoefN[i,7] * 1/7 * ( (inMol.tempG+eps)^ 7 - tempRef^ 7);
   end for;
  
   for i in 1:nComp loop
      aux[i] = CpCoefN[i,1]                      +
               CpCoefN[i,2] * inMol.tempG        +
               CpCoefN[i,3] * inMol.tempG^ 2     +
               CpCoefN[i,4] * inMol.tempG^ 3     +
               CpCoefN[i,5] * inMol.tempG^ 4     +
               CpCoefN[i,6] * inMol.tempG^ 5     +
               CpCoefN[i,7] * inMol.tempG^ 6     -
               perfGasConst;
   end for;
  
   dIntEnergy = sum(inMol.molGF[i]*molIntEnergy[i] for i in 1:nComp) +
                sum(( inMol.molG[i] + eps)  * aux[i] for i in 1:nComp)  * der(tempG);
  
  
end semiPerfGasCp6B;

JARA2i.gas.semiPerfGasCp6VB JARA2i.gas.semiPerfGasCp6VB

Homogeneous mixture of semi-perfect gases inside a vessel.

JARA2i.gas.semiPerfGasCp6VB

Information

Homogeneous mixture of semi-perfect gases inside a vessel.
This model is composed of the models semiPerfGasCP6B and vesselGasB.

Parameters

TypeNameDefaultDescription
IntegernComp1Number of components
RealperfGasConst Constant of the perfect gases [M.L2.t-2.T-1]
RealCpCoefN[nComp, 7] Coefficients of the molar heat capacity at constant pressure CpMol[i] = CpCoefN[i,1] + CpCoefN[i,2]*T + ... + CpCoefN[i,7]*T**6
Realeps1.E-10Small constant to avoid by-zero division
RealmolEnthalpyRef[nComp]zeros(nComp)Molar enthalpy of the components at the reference temperature [M.L2.t-2.mol-1]
RealtempRef298Reference temperature for enthalpy [T]
RealvesselVolumeInitial Vessel volume [L3]
RealmolGinitial[nComp] Initial condition [mol]
RealtempGinitial Initial condition [T]

Connectors

TypeNameDescription
cutGasCinMolGas flow - Connector Capacitive
cutHeatMCinHeatHeat flow - Connector M-C

Modelica definition

model semiPerfGasCp6VB 
  "Homogeneous mixture of semi-perfect gases inside a vessel." 
  
   extends interf.gas1I;
  
   parameter Real perfGasConst(       unit="M.L2.t-2.T-1") 
    "Constant of the perfect gases";
  
   parameter Real CpCoefN[nComp,7] "Coefficients of the molar heat capacity at constant pressure
                                      CpMol[i] = CpCoefN[i,1] + CpCoefN[i,2]*T + ... + CpCoefN[i,7]*T**6";
  
   parameter Real eps( unit="") = 1.E-10 
    "Small constant to avoid by-zero division";
  
   parameter Real molEnthalpyRef[nComp](   unit="M.L2.t-2.mol-1") =  zeros(nComp) 
    "Molar enthalpy of the components at the reference temperature";
  
   parameter Real tempRef(      unit="T") =  298 
    "Reference temperature for enthalpy";
  
   parameter Real vesselVolumeInitial( unit="L3") "Vessel volume";
  
   parameter Real molGinitial[nComp]( unit="mol") "Initial condition";
   parameter Real tempGinitial(       unit="T") "Initial condition";
  
   semiPerfGasCp6B semiPerfGas(  nComp=nComp,perfGasConst=perfGasConst,CpCoefN=CpCoefN,eps=eps,
                                 molEnthalpyRef=molEnthalpyRef,tempRef=tempRef,
                                 molGinitial=molGinitial, tempGinitial=tempGinitial);
  
   vesselGasB vessel(       vesselVolumeInitial=vesselVolumeInitial);
  
equation 
   connect(  semiPerfGas.constraintV, vessel.constraintV);
  
   connect(  semiPerfGas.inMol, inMol);
  
   connect(  semiPerfGas.inHeat, inHeat);
  
  
end semiPerfGasCp6VB;

JARA2i.gas.sourceGasFB JARA2i.gas.sourceGasFB

Gas-flow source

JARA2i.gas.sourceGasFB

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 molar fraction of each fluid component, a setpoint of the flow temperature and a setpoint of the total molar 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.


Parameters

TypeNameDefaultDescription
IntegernComp1Number of components
RealCpCoefN[nComp, 7] Coefficients of the molar heat capacity at constant pressure Cp[i] = CpCoef[i,1] + CpCoef[i,2]*T + ... + CpCoef[i,7]*T**6
RealmolEnthalpyRef[nComp]zeros(nComp)Molar enthalpy at the reference temperature [M.L2.t-2.mol-1]
RealtempRef298Reference temperature for the enthalpy [T]
Realpmax1.0E6Parameter of the source constitutive relation [M.L-1.t-2]
Realpcodo9.5E5Parameter of the source constitutive relation [M.L-1.t-2]
Realpmin1Parameter of the source constitutive relation [M.L-1.t-2]
Realpeps0.2Parameter of the source constitutive relation [M.L-1.t-2]
Realeps1.E-8Small constant to avoid by-zero division

Connectors

TypeNameDescription
cutGasRinMolGas flow - Connector Resistive

Modelica definition

model sourceGasFB "Gas-flow source" 
  
   extends interf.gasFlow1I;
  
   Real molFractSP[     nComp](   unit="") "Setpoint of the molar fraction";
   Real tempFSP(                  unit="T") "Setpoint of the flow temperature";
   Real totalMolFSP(              unit="mol.t-1") 
    "Setpoint of the total molar-flow";
  
   parameter Real CpCoefN[nComp,7] "Coefficients of the molar heat capacity at constant pressure 
                                       Cp[i] = CpCoef[i,1] + CpCoef[i,2]*T + ... + CpCoef[i,7]*T**6";
   parameter Real molEnthalpyRef[nComp]( unit="M.L2.t-2.mol-1") =  zeros(nComp) 
    "Molar enthalpy at the reference temperature";
   parameter Real tempRef( unit="T") = 298 
    "Reference temperature for the enthalpy";
  
   parameter Real pmax(    unit="M.L-1.t-2") =  1.0E6 
    "Parameter of the source constitutive relation";
   parameter Real pcodo(   unit="M.L-1.t-2") =  9.5E5 
    "Parameter of the source constitutive relation";
   parameter Real pmin(    unit="M.L-1.t-2") =     1 
    "Parameter of the source constitutive relation";
   parameter Real peps(    unit="M.L-1.t-2") =     0.2 
    "Parameter of the source constitutive relation";
  
   parameter Real eps(  unit="") = 1.E-8 
    "Small constant to avoid by-zero division";
  
   Real tempF(                 unit="T") "Flow temperature";
  
protected 
   Boolean flowIsPosit(  start = true) "Flow direction";
  
   Real totalMolF(             unit="mol.t-1") "Total molar flow";
   Real totalMol(              unit="mol") "Total mols";
   Real molFract[     nComp](  unit="") "Molar fraction";
  
   Real aux[     nComp];
  
equation 
   // Constitutive relation of the gas source
   flowIsPosit = totalMolFSP > 0;
   totalMolF  = if flowIsPosit and inMol.pressG > pmin then 
                     totalMolFSP else 
                     if flowIsPosit and inMol.pressG > peps then 
                          totalMolFSP * ( inMol.pressG - peps)  / ( pmin - peps) else 
                          if flowIsPosit then 
                               0 else 
                               if inMol.pressG < pcodo then 
                                    totalMolFSP else 
                                    if inMol.pressG < pmax then 
                                         totalMolFSP * ( pmax - inMol.pressG)  / ( pmax - pcodo) else 
                                         0;
  
   // Total mols
   totalMol = sum(inMol.molG[i] for i in 1:nComp);
  
   // Molar fraction
   molFract = inMol.molG / ( totalMol + eps);
  
   // Composition of the mass flow
   if nComp > 1 then
      for i in 1:(nComp-1) loop
         inMol.molGF[i] = if flowIsPosit then 
                               molFract[i]   * totalMolF else 
                               molFractSP[i] * totalMolF;
      end for;
   end if;
  
   // Total molar flow
   totalMolF = sum(inMol.molGF[i] for i in 1:nComp);
  
   // Flow temperature
   tempF = if flowIsPosit then inMol.tempG else tempFSP;
  
   // Enthalpy flow
   for i in 1:nComp loop
      aux[i] = molEnthalpyRef[i] +
               CpCoefN[i,1] *       ( tempF    - tempRef)    +
               CpCoefN[i,2] * 1/2 * ( tempF^ 2 - tempRef^ 2) +
               CpCoefN[i,3] * 1/3 * ( tempF^ 3 - tempRef^ 3) +
               CpCoefN[i,4] * 1/4 * ( tempF^ 4 - tempRef^ 4) +
               CpCoefN[i,5] * 1/5 * ( tempF^ 5 - tempRef^ 5) +
               CpCoefN[i,6] * 1/6 * ( tempF^ 6 - tempRef^ 6) +
               CpCoefN[i,7] * 1/7 * ( tempF^ 7 - tempRef^ 7);
   end for;
   inMol.energyGF  = sum(inMol.molGF[i] * aux[i] for i in 1:nComp);
  
  
end sourceGasFB;

JARA2i.gas.sourceMassGasFB JARA2i.gas.sourceMassGasFB

Gas-flow source. Setpoint: total mass-flow, flow molar-fraction and flow temperature.

JARA2i.gas.sourceMassGasFB

Information


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

Parameters

TypeNameDefaultDescription
IntegernComp1Number of components
RealCpCoefN[nComp, 7] Coefficients of the molar heat capacity at constant pressure Cp[i] = CpCoef[i,1] + CpCoef[i,2]*T + ... + CpCoef[i,7]*T**6
RealmolEnthalpyRef[nComp]zeros(nComp)Molar enthalpy at the reference temperature [M.L2.t-2.mol-1]
RealtempRef298Reference temperature for the enthalpy [T]
Realpmax1.0E6Parameter of the source constitutive relation [M.L-1.t-2]
Realpcodo9.5E5Parameter of the source constitutive relation [M.L-1.t-2]
Realpmin1Parameter of the source constitutive relation [M.L-1.t-2]
Realpeps0.2Parameter of the source 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
cutGasRinMolGas flow - Connector Resistive
cutReceiversetPointSignalSetpoint signals {totalMassFSP, massFractSP[:], tempFSP}

Modelica definition

model sourceMassGasFB 
  "Gas-flow source. Setpoint: total mass-flow, flow molar-fraction and flow temperature." 
  
   extends sourceGasFB;
  
   cutsB.cutReceiver setPointSignal( dim=nComp+2) 
    "Setpoint signals {totalMassFSP, massFractSP[:], tempFSP}";
  
   Real totalMassFSP(              unit="M.t-1") 
    "Setpoint of the total mass flow";
   Real massFractSP[      nComp](  unit="") "Setpoint of the mass fraction";
  
   parameter Real molecWeigth[ nComp](  unit="M.mol-1") 
    "Molecular weigth of the components";
  
protected 
   Real auxMW;
  
equation 
   setPointSignal.signal[1]           = totalMassFSP;
   setPointSignal.signal[2:(nComp+1)] = massFractSP[:];
   setPointSignal.signal[nComp+2]     = tempFSP;
  
   auxMW = sum(massFractSP[i]/molecWeigth[i] for i in 1:nComp);
   for i in 1:nComp loop
      molFractSP[i] = massFractSP[i] / ( molecWeigth[i] * auxMW);
   end for;
  
   totalMolFSP = auxMW * totalMassFSP;
  
  
end sourceMassGasFB;

JARA2i.gas.sourceMolGasFB JARA2i.gas.sourceMolGasFB

Gas-flow source. Setpoint: total molar-flow, flow molar-fraction and flow temperature.

JARA2i.gas.sourceMolGasFB

Information


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

Parameters

TypeNameDefaultDescription
IntegernComp1Number of components
RealCpCoefN[nComp, 7] Coefficients of the molar heat capacity at constant pressure Cp[i] = CpCoef[i,1] + CpCoef[i,2]*T + ... + CpCoef[i,7]*T**6
RealmolEnthalpyRef[nComp]zeros(nComp)Molar enthalpy at the reference temperature [M.L2.t-2.mol-1]
RealtempRef298Reference temperature for the enthalpy [T]
Realpmax1.0E6Parameter of the source constitutive relation [M.L-1.t-2]
Realpcodo9.5E5Parameter of the source constitutive relation [M.L-1.t-2]
Realpmin1Parameter of the source constitutive relation [M.L-1.t-2]
Realpeps0.2Parameter of the source constitutive relation [M.L-1.t-2]
Realeps1.E-8Small constant to avoid by-zero division

Connectors

TypeNameDescription
cutGasRinMolGas flow - Connector Resistive
cutReceiversetPointSignalSetpoint signals {totalMolFSP, molFractSP[:], tempFSP}

Modelica definition

model sourceMolGasFB 
  "Gas-flow source. Setpoint: total molar-flow, flow molar-fraction and flow temperature." 
  
   extends sourceGasFB;
  
   cutsB.cutReceiver setPointSignal( dim=nComp+2) 
    "Setpoint signals  {totalMolFSP, molFractSP[:], tempFSP}";
  
equation 
   setPointSignal.signal[1]           = totalMolFSP;
   setPointSignal.signal[2:(nComp+1)] = molFractSP[:];
   setPointSignal.signal[nComp+2]     = tempFSP;
  
  
end sourceMolGasFB;

JARA2i.gas.sourcePressGasB JARA2i.gas.sourcePressGasB

Partial model - Pressure source. The across variables should be a funcion of time and state variables.

JARA2i.gas.sourcePressGasB

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.gas1I.

Parameters

TypeNameDefaultDescription
IntegernComp1Number of components

Connectors

TypeNameDescription
cutGasCinMolGas flow - Connector Capacitive
cutHeatMCinHeatHeat flow - Connector M-C

Modelica definition

partial model sourcePressGasB 
  "Partial model - Pressure source. The across variables should be a funcion of time and state variables." 
  
   extends interf.gas1I;
  
equation 
   // Relationship among the interface variables
   inMol.molG   =  inHeat.matter;
   inMol.tempG  =  inHeat.temp;
  
  
end sourcePressGasB;

JARA2i.gas.sourceVolGasFB JARA2i.gas.sourceVolGasFB

Gas-flow source. Setpoint: total volume-flow, flow molar-fraction and flow temperature

JARA2i.gas.sourceVolGasFB

Information

Gas-flow source. Setpoint: total volume-flow, flow molar-fraction and flow temperature

Parameters

TypeNameDefaultDescription
IntegernComp1Number of components
RealCpCoefN[nComp, 7] Coefficients of the molar heat capacity at constant pressure Cp[i] = CpCoef[i,1] + CpCoef[i,2]*T + ... + CpCoef[i,7]*T**6
RealmolEnthalpyRef[nComp]zeros(nComp)Molar enthalpy at the reference temperature [M.L2.t-2.mol-1]
RealtempRef298Reference temperature for the enthalpy [T]
Realpmax1.0E6Parameter of the source constitutive relation [M.L-1.t-2]
Realpcodo9.5E5Parameter of the source constitutive relation [M.L-1.t-2]
Realpmin1Parameter of the source constitutive relation [M.L-1.t-2]
Realpeps0.2Parameter of the source constitutive relation [M.L-1.t-2]
Realeps1.E-8Small constant to avoid by-zero division
RealperfGasConst Constant of the perfect gases

Connectors

TypeNameDescription
cutGasRinMolGas flow - Connector Resistive
cutReceiversetPointSignalSetpoint signal: { totalVolFSP, molFractSP[:], tempFSP, pressFSP}

Modelica definition

model sourceVolGasFB 
  "Gas-flow source. Setpoint: total volume-flow, flow molar-fraction and flow temperature" 
  
   extends sourceGasFB;
  
   cutsB.cutReceiver setPointSignal(  dim=nComp+3) 
    "Setpoint signal: { totalVolFSP, molFractSP[:], tempFSP, pressFSP}";
  
   Real totalVolFSP "Setpoint of the total volume flow";
   Real pressFSP "Setpoint of the gas flow pressure";
  
   parameter Real perfGasConst "Constant of the perfect gases";
  
equation 
   setPointSignal.signal[1]           = totalVolFSP;
   setPointSignal.signal[2:(nComp+1)] = molFractSP[:];
   setPointSignal.signal[nComp+2]     = tempFSP;
   setPointSignal.signal[nComp+3]     = pressFSP;
  
   0 = if totalVolFSP > 0 then 
            inMol.pressG * totalVolFSP - totalMolFSP * perfGasConst * inMol.tempG else 
            pressFSP * totalVolFSP - totalMolFSP * perfGasConst * tempFSP;
  
  
end sourceVolGasFB;

JARA2i.gas.vesselGasB JARA2i.gas.vesselGasB

Vessel with a constant volume.

JARA2i.gas.vesselGasB

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 Recipient volume.



Parameters

TypeNameDefaultDescription
BooleanEjsfalseGlobal parameter - Runtime interactive simulation
BooleanSysquakefalseGlobal parameter - Batch interactive simulation
RealvesselVolumeInitial Vessel volume - Initial condition [L3]

Connectors

TypeNameDescription
cutVolConstrVesselconstraintVVolume constraint - Vessel.

Modelica definition

model vesselGasB "Vessel with a constant volume." 
  
  extends interf.vesselI;
  
  outer parameter Boolean Ejs=false 
    "Global parameter - Runtime interactive simulation";
  outer parameter Boolean Sysquake=false 
    "Global parameter - Batch interactive simulation";
  
  parameter Real vesselVolumeInitial(unit="L3") 
    "Vessel volume - Initial condition";
  
  Real vesselVolume(start=vesselVolumeInitial) 
    "Vessel volume - Interactive Variable";
  
equation 
  // Interactive parameter for Ejs
  if Ejs then
    der(vesselVolume) = 0;
  end if;
  
  // Sysquake
  if Sysquake then
    vesselVolume = vesselVolumeInitial;
  end if;
  
  // The vessel volume is a constant 
  // constraintV.vesselV =  vesselVolume;
  constraintV.vcE[1] = vesselVolume;
  
  
end vesselGasB;

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