JARA2i.CaseStudies.doublePipeHeatExchanger.Sysquake

Modelica model of the heat exchanger to be used in a virtual lab implemented in combination with Sysquake

Information


 

Modelica model of the heat exchanger to be used in a virtual lab implemented in combination with Sysquake



The implementation of the heat-exchanger virtual-lab by combining Sysquake and Modelica/Dymola is discussed in (Martin, Urquia and Dormido 2005a) and (Martin, Urquia and Dormido 2005b).

References

Martin, C. and A. Urquia and S. Dormido (2005a): Modeling of Interactive Virtual Laboratories with Modelica Proceedings of the 4th International Modelica Conference, 159-168.

Martin, C. and A. Urquia and S. Dormido (2005b): Modelado Orientado a Objetos de Laboratorios Virtuales con Aplicación a la Enseñanza de Control de Procesos Químicos. Proceedings of the 1st Congreso Español de Informática (CEDI-EIWISA).


Package Content

NameDescription
DoublePipeHeatExchanger Double-pipe heat-exchanger
JARA2i.CaseStudies.doublePipeHeatExchanger.Sysquake.DoublePipeHeatExchangerOpen DoublePipeHeatExchangerOpen Double pipe heat exchager plant. Input: mass flow of liquid water. Output: temperature of the outlet gas
JARA2i.CaseStudies.doublePipeHeatExchanger.Sysquake.Limiter Limiter Limit the range of a signal
JARA2i.CaseStudies.doublePipeHeatExchanger.Sysquake.LimPID LimPID PID controller with limited output, anti-windup compensation and setpoint weighting
JARA2i.CaseStudies.doublePipeHeatExchanger.Sysquake.massSourceCntrl massSourceCntrl Controller of the gas pump. Set-points: total mass flow and temperature
ModelInOutDoublePipeHeatExchanger Model to be used for the plant linearization
JARA2i.CaseStudies.doublePipeHeatExchanger.Sysquake.molSourceCntrl molSourceCntrl Controller of the gas pump. Set-points: total mass flow, temperature and molar fraction of CO2
PIDControl Plant + PID controlling the temperature of the outlet gas by manipulating the mass flow of liquid water
PoleZeroControl Plant + compensator network controlling the temperature of the outlet gas by manipulating the mass flow of liquid water
JARA2i.CaseStudies.doublePipeHeatExchanger.Sysquake.pumpCntrl pumpCntrl Controller of the liquid pump
JARA2i.CaseStudies.doublePipeHeatExchanger.Sysquake.pumpMolCntrl pumpMolCntrl Controller of the gas pump. Set-point: total mol flow


JARA2i.CaseStudies.doublePipeHeatExchanger.Sysquake.DoublePipeHeatExchanger

Double-pipe heat-exchanger

JARA2i.CaseStudies.doublePipeHeatExchanger.Sysquake.DoublePipeHeatExchanger

Parameters

TypeNameDefaultDescription
IntegernCompL1Number of components of the liquid mixture
IntegernCompG2Number of components of the gas mixture
BooleanEjsfalse 
BooleanSysquaketrue 
Realpi3.141593 
IntegernumNodes10Number of nodes for temperature calculation
RealperfGasConst8.31Perfect gases constant [J/(mol.K)]
RealdensityL[nCompL]{996}Density of the liquid components [Kg.m-3]
RealCpCoefML[nCompL, 7][4185, 0, 0, 0, 0, 0, 0]Heat capacity [J/(Kg.K)]
RealviscLiq[4]{1,-10.547,541.69,144.53}Viscosity coefficients [W/(m.K)]
RealthermCondL[2]{0.61,0}Thermal conductivity coefficients
RealCpCoefNG[nCompG, 7][36.83, 0, 0, 0, 0, 0, 0; 42...Heat capacity per mol at constant pressure [J/(mol.K)]
RealCpCoefMG[nCompG, 7][837, 0, 0, 0, 0, 0, 0; 657,...Heat capacity per mass at constant pressure [J/(Kg.K)]
RealviscGas[4]{1.55E-5,0,0,1}Viscosity [Kg/(m.s)]
RealthermCondG[2]{0.014,0}Coeff. of the thermal conductivity [W/(m.K)]
RealmolecWeigthG[2]{44E-3,64E-3}Molecular weight [Kg/mol]
ReallenPipe1Pipe lenght [m]
RealpipeDiameter118.92E-3Inner diameter of the inside tube [m]
RealpipeDiameter222.22E-3Outer diameter of the inside tube [m]
RealpipeDiameter338.10E-3Inner diameter of the outside pipe [m]
RealsectionInt(pi*(pipeDiameter1/2)^2)[m2]
RealareaInt(pi*pipeDiameter1*lenPipe/(n...[m2]
RealareaExt(pi*pipeDiameter2*lenPipe/(n...[m2]
RealvolElemInt(sectionInt*lenPipe/(numNode...[m3]
RealvolElemGasvolElemInt[m3]
RealsectionExt(pi*((pipeDiameter3/2)^2 - (...[m2]
RealvolElemLiqsectionExt*lenPipe/(numNodes...[m3]
Realpmax1E9Characteristic parameters of the source and pumps
Realpcodo0.9E9 
Realpmin2E-2 
Realpeps1E-2 
IntegernElemTable5 
RealtableTimeEndSimulation600 
RealtableTempLiq[nElemTable, 2][0, 291; 100, 291; 200, 291;... 
RealmassFractionLSP[nCompL]{1}Setpoint: mass fraction of the liquid
RealtableTotalMolFlowGas[nElemTable, 2][0, 0.16; 100, 0.16; 200, 0.... 
RealtableTempGas[nElemTable, 2][0, 400; 100, 400; 200, 400;... 
RealtableConcMolarCO2[nElemTable, 2][0, 0.5; 100, 0.5; 200, 0.5;... 
RealdensityIntPipeWall8950Density of the inside-tube wall [Kg/m3]
RealCpIntPipeWall[7]{383,0,0,0,0,0,0}Heat capacity of the inside-tube wall [J/(Kg.K)]
RealthermalCondWall381Thermal conductivity of the inside-tube wall [W/(m.K)]
RealpipeWallSection(pi*((pipeDiameter2/2)^2 - (... 
RealmassIntPipeWall(densityIntPipeWall*lenPipe*... 
RealmassElemPipe(massIntPipeWall/(numNodes -... 
RealthermalResistance(lenPipe/(thermalCondWall*pi... 
RealSTcoefLiq[4]{0.023,0.8,0.4,0}Sieder-Tate correlation coefficients
RealSTcoefGas[4]{0.023,0.8,0.3,0}Sieder-Tate correlation coefficients
RealtempInitialWall[numNodes - 1]fill(331.452, (numNodes - 1))Wall initial temperature [K]
RealtempInitialLiq[numNodes]fill(291, numNodes)Liquid initial temperature [K]
RealtempInitialGas[numNodes]fill(331.899, numNodes)Gas initial temperature [K]
RealinitialLiqMassFraction[nCompL]{1}Initial mass-fraction of the liquid mixture components
RealmassInitialLiq[nCompL]volElemLiq*initialLiqMassFra...Initial mass of liquid inside a control volume [Kg]
RealmolFractGasInitial[nCompG]{0.5,0.5}Initial mol fraction of the gas components
RealgasPressureInitial5e5Initial pressure of the gas mixture [J.m-3]

Modelica definition

model DoublePipeHeatExchanger "Double-pipe heat-exchanger" 
  
   //  Gas.     [1]: Carbon dioxide; [2]: Sulfur dioxide 
   //  Liquid.  [1]: Water
  
    parameter Integer nCompL =     1 
    "Number of components of the liquid mixture";
    parameter Integer nCompG =     2 "Number of components of the gas mixture";
  
    // Interactivity
    inner parameter Boolean Ejs =      false;
    inner parameter Boolean Sysquake = true;
  
    parameter Real pi =            3.141593;
  
    parameter Integer numNodes =  10 
    "Number of nodes for temperature calculation";
  
    parameter Real perfGasConst( unit="J/(mol.K)") = 8.31 
    "Perfect gases constant";
  
    // Parameters of the liquid
    parameter Real densityL[nCompL](   unit="Kg.m-3") = {996} 
    "Density of the liquid components";
    parameter Real CpCoefML[nCompL,7]( unit="J/(Kg.K)") = [4185,0,0,0,0,0,0] 
    "Heat capacity";
    parameter Real viscLiq[4](         unit="W/(m.K)") =  {    1,
                                                              -10.547,
                                                              541.69,
                                                              144.53} 
    "Viscosity coefficients";
    parameter Real thermCondL[2] =       {0.61, 0} 
    "Thermal conductivity coefficients";
  
    // Parameters of the gas mixture
    parameter Real CpCoefNG[nCompG,7](  unit="J/(mol.K)") =   [36.83,0,0,0,0,0,0;
                                                               42.05,0,0,0,0,0,0] 
    "Heat capacity per mol at constant pressure";
    parameter Real CpCoefMG[nCompG,7](  unit="J/(Kg.K)") =    [837,0,0,0,0,0,0;
                                                               657,0,0,0,0,0,0] 
    "Heat capacity per mass at constant pressure";
    parameter Real viscGas[4](          unit="Kg/(m.s)") =    {1.55E-5, 0, 0, 1} 
    "Viscosity";
    parameter Real thermCondG[2](       unit="W/(m.K)") =     {0.014, 0} 
    "Coeff. of the thermal conductivity";
    parameter Real molecWeigthG[2](     unit="Kg/mol") =      {44E-3, 64E-3} 
    "Molecular weight";
  
    // Parameters of the heat exchanger
    parameter Real lenPipe(        unit="m") =  1 "Pipe lenght";
    parameter Real pipeDiameter1(  unit="m") =  18.92E-3 
    "Inner diameter of the inside tube";
    parameter Real pipeDiameter2(  unit="m") =  22.22E-3 
    "Outer diameter of the inside tube";
    parameter Real pipeDiameter3(  unit="m") =  38.10E-3 
    "Inner diameter of the outside pipe";
  
    // Gas control volumes
    parameter Real sectionInt(     unit="m2") =  ( pi * (pipeDiameter1/2)^ 2);
    parameter Real areaInt(        unit="m2") =  ( pi * pipeDiameter1 * lenPipe / (numNodes - 1));
    parameter Real areaExt(        unit="m2") =  ( pi * pipeDiameter2 * lenPipe / (numNodes - 1));
    parameter Real volElemInt(     unit="m3") =  ( sectionInt * lenPipe / (numNodes - 1));
    parameter Real volElemGas(     unit="m3") =  volElemInt;
  
    // Liquid control volumes
    parameter Real sectionExt(      unit="m2") = ( pi * ( (pipeDiameter3/2)^ 2 - (pipeDiameter2/2)^ 2));
    parameter Real volElemLiq(      unit="m3") = sectionExt * lenPipe / (numNodes - 1);
  
    // Characteristic parameters of the source and pumps
    parameter Real pmax =   1E9 
    "Characteristic parameters of the source and pumps";
    parameter Real pcodo =  0.9E9;
    parameter Real pmin =   2E-2;
    parameter Real peps =   1E-2;
  
    // Experiment parameters
    parameter Integer nElemTable = 5;
    parameter Real tableTimeEndSimulation =    600;
  
    // Input temperature of the liquid
    parameter Real tableTempLiq[nElemTable,2] =  [  0, 291;
                                                  100, 291;
                                                  200, 291;
                                                  300, 291;
                                                  600, 291];
    // Mass fraction of the liquid
    parameter Real massFractionLSP[nCompL]( unit="") =  {1} 
    "Setpoint: mass fraction of the liquid";
  
    // Molar flow of the gas
    parameter Real tableTotalMolFlowGas[nElemTable,2] =    [  0, 0.16;
                                                            100, 0.16;
                                                            200, 0.16;
                                                            300, 0.16;
                                                            600, 0.16];
  
    // Input temperature of the gas
    parameter Real tableTempGas[nElemTable,2] =   [  0, 400;
                                                   100, 400;
                                                   200, 400;
                                                   300, 400;
                                                   600, 400];
  
    // Mol fraction of CO2
    parameter Real tableConcMolarCO2[nElemTable,2] =   [  0, 0.5;
                                                        100, 0.5;
                                                        200, 0.5;
                                                        300, 0.5;
                                                        600, 0.5];
  
    // Pipe parameters
    parameter Real densityIntPipeWall(  unit="Kg/m3") = 8950 
    "Density of the inside-tube wall";
    parameter Real CpIntPipeWall[ 7](   unit="J/(Kg.K)") = {383,0,0,0,0,0,0} 
    "Heat capacity of the inside-tube wall";
    parameter Real thermalCondWall(     unit="W/(m.K)") = 381 
    "Thermal conductivity of the inside-tube wall";
  
    parameter Real pipeWallSection =     ( pi * ( (pipeDiameter2/2)^ 2 - (pipeDiameter1/2)^ 2));
    parameter Real massIntPipeWall =     ( densityIntPipeWall * lenPipe * pipeWallSection);
    parameter Real massElemPipe =        ( massIntPipeWall / (numNodes - 1));
    parameter Real thermalResistance =   ( lenPipe / ( thermalCondWall * pipeWallSection * ( numNodes - 1)));
  
    // Sieder-Tate correlation coefficients
    parameter Real STcoefLiq[ 4] = {0.023, 0.8, 0.4, 0} 
    "Sieder-Tate correlation coefficients";
    parameter Real STcoefGas[ 4] = {0.023, 0.8, 0.3, 0} 
    "Sieder-Tate correlation coefficients";
  
    // Initial temperature
    parameter Real tempInitialWall[ numNodes-1](   unit="K") =  fill(331.452,(numNodes-1)) 
    "Wall initial temperature";
    parameter Real tempInitialLiq[ numNodes](      unit="K") =  fill(291,numNodes) 
    "Liquid initial temperature";
    parameter Real tempInitialGas[ numNodes](      unit="K") =  fill(331.899,numNodes) 
    "Gas initial temperature";
  
    // Initial liquid mass
    parameter Real initialLiqMassFraction[ nCompL] = { 1} 
    "Initial mass-fraction of the liquid mixture components";
    parameter Real massInitialLiq[ nCompL](      unit="Kg") = volElemLiq * initialLiqMassFraction * diagonal(densityL) 
    "Initial mass of liquid inside a control volume";
  
    // Initial moles of the gas
    parameter Real molFractGasInitial[ nCompG]( unit="") =      { 0.5, 0.5} 
    "Initial mol fraction of the gas components";
    parameter Real gasPressureInitial(          unit="J.m-3") = 5e5 
    "Initial pressure of the gas mixture";
  
    // ----------------
    // Public variables
    // ----------------
    Real tempLiq[ numNodes](     unit="K") 
    "Temperature at the liquid control volumes";
    Real tempGas[ numNodes](     unit="K") 
    "Temperature at the gas control volumes";
    Real tempWall[ numNodes-1](  unit="K") 
    "Temperature at the wall control volumes";
  
    Real massFlowLiq[ nCompL](   unit="Kg/s") "Mass flow of the liquid";
    Real molFlowGas[ nCompG](    unit="mol/s") "Mol flow of the gas components";
  
    Real tempLiqFlowSourceL1(    unit="K") 
    "Temperature of the liquid flowing to/from SourceL1";
    Real tempLiqFlowSourceL2(    unit="K") 
    "Temperature of the liquid flowing to/from SourceL2";
  
    Real tempGasFlowSourceG1(    unit="K") 
    "Temperature of the gas flowing to/from SourceG2";
    Real tempGasFlowSourceG2(    unit="K") 
    "Temperature of the gas flowing to/from SourceG2";
  
    // -------------------
    // Controlled variable
    // -------------------
    output Real outputGasTemp;
  
    // --------------------
    // Manipulated variable
    // --------------------
    input Real totalMassFSPliquid;
  
protected 
    JARA2i.liq.liquidCp6PrefVB volCntrlLiq1(
                                 nComp=nCompL,sectionInitial=1,CpCoefMInitial=CpCoefML,
                                 tempLinitial=tempInitialLiq[1], massLinitial=massInitialLiq/2,
                                 vesselVolumeInitial=1E5,densityInitial=densityL);
    JARA2i.liq.liquidCp6PrefVB volCntrlLiq2(
                                 nComp=nCompL,sectionInitial=1,CpCoefMInitial=CpCoefML,
                                 tempLinitial=tempInitialLiq[2], massLinitial=massInitialLiq,
                                 vesselVolumeInitial=1E5,densityInitial=densityL);
    JARA2i.liq.liquidCp6PrefVB volCntrlLiq3(
                                 nComp=nCompL,sectionInitial=1,CpCoefMInitial=CpCoefML,
                                 tempLinitial=tempInitialLiq[3], massLinitial=massInitialLiq,
                                 vesselVolumeInitial=1E5,densityInitial=densityL);
    JARA2i.liq.liquidCp6PrefVB volCntrlLiq4(
                                 nComp=nCompL,sectionInitial=1,CpCoefMInitial=CpCoefML,
                                 tempLinitial=tempInitialLiq[4], massLinitial=massInitialLiq,
                                 vesselVolumeInitial=1E5,densityInitial=densityL);
    JARA2i.liq.liquidCp6PrefVB volCntrlLiq5(
                                 nComp=nCompL,sectionInitial=1,CpCoefMInitial=CpCoefML,
                                 tempLinitial=tempInitialLiq[5], massLinitial=massInitialLiq,
                                 vesselVolumeInitial=1E5,densityInitial=densityL);
    JARA2i.liq.liquidCp6PrefVB volCntrlLiq6(
                                 nComp=nCompL,sectionInitial=1,CpCoefMInitial=CpCoefML,
                                 tempLinitial=tempInitialLiq[6], massLinitial=massInitialLiq,
                                 vesselVolumeInitial=1E5,densityInitial=densityL);
    JARA2i.liq.liquidCp6PrefVB volCntrlLiq7(
                                 nComp=nCompL,sectionInitial=1,CpCoefMInitial=CpCoefML,
                                 tempLinitial=tempInitialLiq[7], massLinitial=massInitialLiq,
                                 vesselVolumeInitial=1E5,densityInitial=densityL);
    JARA2i.liq.liquidCp6PrefVB volCntrlLiq8(
                                 nComp=nCompL,sectionInitial=1,CpCoefMInitial=CpCoefML,
                                 tempLinitial=tempInitialLiq[8], massLinitial=massInitialLiq,
                                 vesselVolumeInitial=1E5,densityInitial=densityL);
    JARA2i.liq.liquidCp6PrefVB volCntrlLiq9(
                                 nComp=nCompL,sectionInitial=1,CpCoefMInitial=CpCoefML,
                                 tempLinitial=tempInitialLiq[9], massLinitial=massInitialLiq,
                                 vesselVolumeInitial=1E5,densityInitial=densityL);
    JARA2i.liq.liquidCp6PrefVB volCntrlLiq10(
                                 nComp=nCompL,sectionInitial=1,CpCoefMInitial=CpCoefML,
                                 tempLinitial=tempInitialLiq[10], massLinitial=massInitialLiq/2,
                                 vesselVolumeInitial=1E5,densityInitial=densityL);
  
    JARA2i.liq.pumpMassLiqB pumpL1( nComp=nCompL,CpCoefMInitial=CpCoefML,pmax=pmax,pmin=pmin,pcodo=pcodo,peps=peps);
    JARA2i.liq.pumpMassLiqB pumpL2( nComp=nCompL,CpCoefMInitial=CpCoefML,pmax=pmax,pmin=pmin,pcodo=pcodo,peps=peps);
    JARA2i.liq.pumpMassLiqB pumpL3( nComp=nCompL,CpCoefMInitial=CpCoefML,pmax=pmax,pmin=pmin,pcodo=pcodo,peps=peps);
    JARA2i.liq.pumpMassLiqB pumpL4(  nComp=nCompL,CpCoefMInitial=CpCoefML,pmax=pmax,pmin=pmin,pcodo=pcodo,peps=peps);
    JARA2i.liq.pumpMassLiqB pumpL5(  nComp=nCompL,CpCoefMInitial=CpCoefML,pmax=pmax,pmin=pmin,pcodo=pcodo,peps=peps);
    JARA2i.liq.pumpMassLiqB pumpL6(  nComp=nCompL,CpCoefMInitial=CpCoefML,pmax=pmax,pmin=pmin,pcodo=pcodo,peps=peps);
    JARA2i.liq.pumpMassLiqB pumpL7(  nComp=nCompL,CpCoefMInitial=CpCoefML,pmax=pmax,pmin=pmin,pcodo=pcodo,peps=peps);
    JARA2i.liq.pumpMassLiqB pumpL8(  nComp=nCompL,CpCoefMInitial=CpCoefML,pmax=pmax,pmin=pmin,pcodo=pcodo,peps=peps);
    JARA2i.liq.pumpMassLiqB pumpL9(  nComp=nCompL,CpCoefMInitial=CpCoefML,pmax=pmax,pmin=pmin,pcodo=pcodo,peps=peps);
  
    pumpCntrl pumpLCntrl;
  
    // pumpCntrl  pumpLCntrl  (event1=eventL1,event2=eventL2,massFlowSP1=massFlowLSP1,massFlowSP2=-massFlowLSP2) 
    //                        annotation(extent=[-5,-100; 5,-90]);
  
    JARA2i.liq.sourceMassLiqFB sourceL1(
                                   nComp=nCompL,CpCoefMInitial=CpCoefML,pmax=pmax,pmin=pmin,pcodo=pcodo,peps=peps);
    JARA2i.liq.sourceMassLiqFB sourceL2(
                                   nComp=nCompL,CpCoefMInitial=CpCoefML,pmax=pmax,pmin=pmin,pcodo=pcodo,peps=peps);
  
    massSourceCntrl sourceL1Cntrl(  nComp=nCompL, massFractionSP=massFractionLSP,
       tableTemperatureSP =                                                                          tableTempLiq);
    massSourceCntrl sourceL2Cntrl(  nComp=nCompL, massFractionSP=massFractionLSP,
       tableTemperatureSP =                                                                          tableTempLiq);
  
    JARA2i.gas.semiPerfGasCp6VB volCntrlGas1(      nComp=nCompG,perfGasConst=perfGasConst,CpCoefN=CpCoefNG,
                                                 tempGinitial=tempInitialGas[1],
                                                 molGinitial=0.5*molFractGasInitial*gasPressureInitial*volElemGas/(perfGasConst*tempInitialGas[1]),
                                                 vesselVolumeInitial=(0.5*volElemInt));
    JARA2i.gas.semiPerfGasCp6VB volCntrlGas2(      nComp=nCompG,perfGasConst=perfGasConst,CpCoefN=CpCoefNG,
                                                 tempGinitial=tempInitialGas[2],
                                                 molGinitial=molFractGasInitial*gasPressureInitial*volElemGas/(perfGasConst*tempInitialGas[2]),
                                                 vesselVolumeInitial=volElemInt);
    JARA2i.gas.semiPerfGasCp6VB volCntrlGas3(      nComp=nCompG,perfGasConst=perfGasConst,CpCoefN=CpCoefNG,
                                                 tempGinitial=tempInitialGas[3],
                                                 molGinitial=molFractGasInitial*gasPressureInitial*volElemGas/(perfGasConst*tempInitialGas[3]),
                                                 vesselVolumeInitial=volElemInt);
    JARA2i.gas.semiPerfGasCp6VB volCntrlGas4(      nComp=nCompG,perfGasConst=perfGasConst,CpCoefN=CpCoefNG,
                                                 tempGinitial=tempInitialGas[4],
                                                 molGinitial=molFractGasInitial*gasPressureInitial*volElemGas/(perfGasConst*tempInitialGas[4]),
                                                 vesselVolumeInitial=volElemInt);
    JARA2i.gas.semiPerfGasCp6VB volCntrlGas5(      nComp=nCompG,perfGasConst=perfGasConst,CpCoefN=CpCoefNG,
                                                 tempGinitial=tempInitialGas[5],
                                                 molGinitial=molFractGasInitial*gasPressureInitial*volElemGas/(perfGasConst*tempInitialGas[5]),
                                                 vesselVolumeInitial=volElemInt);
    JARA2i.gas.semiPerfGasCp6VB volCntrlGas6(      nComp=nCompG,perfGasConst=perfGasConst,CpCoefN=CpCoefNG,
                                                 tempGinitial=tempInitialGas[6],
                                                 molGinitial=molFractGasInitial*gasPressureInitial*volElemGas/(perfGasConst*tempInitialGas[6]),
                                                 vesselVolumeInitial=volElemInt);
    JARA2i.gas.semiPerfGasCp6VB volCntrlGas7(      nComp=nCompG,perfGasConst=perfGasConst,CpCoefN=CpCoefNG,
                                                 tempGinitial=tempInitialGas[7],
                                                 molGinitial=molFractGasInitial*gasPressureInitial*volElemGas/(perfGasConst*tempInitialGas[7]),
                                                 vesselVolumeInitial=volElemInt);
    JARA2i.gas.semiPerfGasCp6VB volCntrlGas8(      nComp=nCompG,perfGasConst=perfGasConst,CpCoefN=CpCoefNG,
                                                 tempGinitial=tempInitialGas[8],
                                                 molGinitial=molFractGasInitial*gasPressureInitial*volElemGas/(perfGasConst*tempInitialGas[8]),
                                                 vesselVolumeInitial=volElemInt);
    JARA2i.gas.semiPerfGasCp6VB volCntrlGas9(      nComp=nCompG,perfGasConst=perfGasConst,CpCoefN=CpCoefNG,
                                                 tempGinitial=tempInitialGas[9],
                                                 molGinitial=molFractGasInitial*gasPressureInitial*volElemGas/(perfGasConst*tempInitialGas[9]),
                                                 vesselVolumeInitial=volElemInt);
    JARA2i.gas.semiPerfGasCp6VB volCntrlGas10(     nComp=nCompG,perfGasConst=perfGasConst,CpCoefN=CpCoefNG,
                                                 tempGinitial=tempInitialGas[10],
                                                 molGinitial=0.5*molFractGasInitial*gasPressureInitial*volElemGas/(perfGasConst*tempInitialGas[10]),
                                                 vesselVolumeInitial=(0.5*volElemInt));
  
    JARA2i.gas.pumpMolGasB pumpG1(      nComp=nCompG,CpCoefN=CpCoefNG,pmax=pmax,pmin=pmin,pcodo=pcodo,peps=peps);
    JARA2i.gas.pumpMolGasB pumpG2(      nComp=nCompG,CpCoefN=CpCoefNG,pmax=pmax,pmin=pmin,pcodo=pcodo,peps=peps);
    JARA2i.gas.pumpMolGasB pumpG3(      nComp=nCompG,CpCoefN=CpCoefNG,pmax=pmax,pmin=pmin,pcodo=pcodo,peps=peps);
    JARA2i.gas.pumpMolGasB pumpG4(      nComp=nCompG,CpCoefN=CpCoefNG,pmax=pmax,pmin=pmin,pcodo=pcodo,peps=peps);
    JARA2i.gas.pumpMolGasB pumpG5(      nComp=nCompG,CpCoefN=CpCoefNG,pmax=pmax,pmin=pmin,pcodo=pcodo,peps=peps);
    JARA2i.gas.pumpMolGasB pumpG6(      nComp=nCompG,CpCoefN=CpCoefNG,pmax=pmax,pmin=pmin,pcodo=pcodo,peps=peps);
    JARA2i.gas.pumpMolGasB pumpG7(      nComp=nCompG,CpCoefN=CpCoefNG,pmax=pmax,pmin=pmin,pcodo=pcodo,peps=peps);
    JARA2i.gas.pumpMolGasB pumpG8(      nComp=nCompG,CpCoefN=CpCoefNG,pmax=pmax,pmin=pmin,pcodo=pcodo,peps=peps);
    JARA2i.gas.pumpMolGasB pumpG9(      nComp=nCompG,CpCoefN=CpCoefNG,pmax=pmax,pmin=pmin,pcodo=pcodo,peps=peps);
  
    pumpMolCntrl pumpGCntrl(   tableTotalMolFSP=tableTotalMolFlowGas);
  
    JARA2i.gas.sourceMolGasFB sourceG1(     nComp=nCompG,CpCoefN=CpCoefNG,pmax=pmax,pmin=pmin,pcodo=pcodo,peps=peps);
    JARA2i.gas.sourceMolGasFB sourceG2(     nComp=nCompG,CpCoefN=CpCoefNG,pmax=pmax,pmin=pmin,pcodo=pcodo,peps=peps);
  
    molSourceCntrl sourceG1Cntrl(  nComp=nCompG, flowDirection=-1,
           tableTotalMolFSP=tableTotalMolFlowGas,
                                   tableTemperatureSP=tableTempGas,
                                   tableMolarFractionCO2=tableConcMolarCO2);
  
    molSourceCntrl sourceG2Cntrl(   nComp=nCompG,
                                   tableTotalMolFSP=tableTotalMolFlowGas,
                                   tableTemperatureSP=tableTempGas,
                                   tableMolarFractionCO2=tableConcMolarCO2);
  
    JARA2i.heat.solidC6B pipeWall1(      CpCoefM=CpIntPipeWall,massInitial=massElemPipe,
       tempInitial =                                                                              tempInitialWall[1]);
    JARA2i.heat.solidC6B pipeWall2(      CpCoefM=CpIntPipeWall,massInitial=massElemPipe,
       tempInitial =                                                                              tempInitialWall[2]);
    JARA2i.heat.solidC6B pipeWall3(      CpCoefM=CpIntPipeWall,massInitial=massElemPipe,
       tempInitial =                                                                              tempInitialWall[3]);
    JARA2i.heat.solidC6B pipeWall4(      CpCoefM=CpIntPipeWall,massInitial=massElemPipe,
       tempInitial =                                                                              tempInitialWall[4]);
    JARA2i.heat.solidC6B pipeWall5(      CpCoefM=CpIntPipeWall,massInitial=massElemPipe,
       tempInitial =                                                                              tempInitialWall[5]);
    JARA2i.heat.solidC6B pipeWall6(      CpCoefM=CpIntPipeWall,massInitial=massElemPipe,
       tempInitial =                                                                              tempInitialWall[6]);
    JARA2i.heat.solidC6B pipeWall7(      CpCoefM=CpIntPipeWall,massInitial=massElemPipe,
       tempInitial =                                                                              tempInitialWall[7]);
    JARA2i.heat.solidC6B pipeWall8(      CpCoefM=CpIntPipeWall,massInitial=massElemPipe,
       tempInitial =                                                                              tempInitialWall[8]);
    JARA2i.heat.solidC6B pipeWall9(      CpCoefM=CpIntPipeWall,massInitial=massElemPipe,
       tempInitial =                                                                              tempInitialWall[9]);
  
    JARA2i.heat.RthConstB condHeat12(    RthInitial=thermalResistance);
    JARA2i.heat.RthConstB condHeat23(    RthInitial=thermalResistance);
    JARA2i.heat.RthConstB condHeat34(    RthInitial=thermalResistance);
    JARA2i.heat.RthConstB condHeat45(    RthInitial=thermalResistance);
    JARA2i.heat.RthConstB condHeat56(    RthInitial=thermalResistance);
    JARA2i.heat.RthConstB condHeat67(    RthInitial=thermalResistance);
    JARA2i.heat.RthConstB condHeat78(    RthInitial=thermalResistance);
    JARA2i.heat.RthConstB condHeat89(    RthInitial=thermalResistance);
  
    JARA2i.heat.convecSiederTateB convHeatFL1(
                                     nCompI=1,nCompO=nCompL,CpCoefM=CpCoefML,
       thermCondCoef =                                                                     thermCondL,
                                     pipeDiameterInitial=pipeDiameter2,
       pipeSectionInitial =                                                               sectionExt,STcoef=STcoefLiq,
                                     pipeSurfaceAreaInitial=areaExt,visc=viscLiq);
    JARA2i.heat.convecSiederTateB convHeatFL2(
                                     nCompI=1,nCompO=nCompL,CpCoefM=CpCoefML,
       thermCondCoef =                                                                     thermCondL,
                                     pipeDiameterInitial=pipeDiameter2,
       pipeSectionInitial =                                                               sectionExt,STcoef=STcoefLiq,
                                     pipeSurfaceAreaInitial=areaExt,visc=viscLiq);
    JARA2i.heat.convecSiederTateB convHeatFL3(
                                     nCompI=1,nCompO=nCompL,CpCoefM=CpCoefML,
       thermCondCoef =                                                                     thermCondL,
                                     pipeDiameterInitial=pipeDiameter2,
       pipeSectionInitial =                                                               sectionExt,STcoef=STcoefLiq,
                                     pipeSurfaceAreaInitial=areaExt,visc=viscLiq);
    JARA2i.heat.convecSiederTateB convHeatFL4(
                                     nCompI=1,nCompO=nCompL,CpCoefM=CpCoefML,
       thermCondCoef =                                                                     thermCondL,
                                     pipeDiameterInitial=pipeDiameter2,
       pipeSectionInitial =                                                               sectionExt,STcoef=STcoefLiq,
                                     pipeSurfaceAreaInitial=areaExt,visc=viscLiq);
    JARA2i.heat.convecSiederTateB convHeatFL5(
                                     nCompI=1,nCompO=nCompL,CpCoefM=CpCoefML,
       thermCondCoef =                                                                     thermCondL,
                                     pipeDiameterInitial=pipeDiameter2,
       pipeSectionInitial =                                                               sectionExt,STcoef=STcoefLiq,
                                     pipeSurfaceAreaInitial=areaExt,visc=viscLiq);
    JARA2i.heat.convecSiederTateB convHeatFL6(
                                     nCompI=1,nCompO=nCompL,CpCoefM=CpCoefML,
       thermCondCoef =                                                                     thermCondL,
                                     pipeDiameterInitial=pipeDiameter2,
       pipeSectionInitial =                                                               sectionExt,STcoef=STcoefLiq,
                                     pipeSurfaceAreaInitial=areaExt,visc=viscLiq);
    JARA2i.heat.convecSiederTateB convHeatFL7(
                                     nCompI=1,nCompO=nCompL,CpCoefM=CpCoefML,
       thermCondCoef =                                                                     thermCondL,
                                     pipeDiameterInitial=pipeDiameter2,
       pipeSectionInitial =                                                               sectionExt,STcoef=STcoefLiq,
                                     pipeSurfaceAreaInitial=areaExt,visc=viscLiq);
    JARA2i.heat.convecSiederTateB convHeatFL8(
                                     nCompI=1,nCompO=nCompL,CpCoefM=CpCoefML,
       thermCondCoef =                                                                     thermCondL,
                                     pipeDiameterInitial=pipeDiameter2,
       pipeSectionInitial =                                                               sectionExt,STcoef=STcoefLiq,
                                     pipeSurfaceAreaInitial=areaExt,visc=viscLiq);
    JARA2i.heat.convecSiederTateB convHeatFL9(
                                     nCompI=1,nCompO=nCompL,CpCoefM=CpCoefML,
       thermCondCoef =                                                                     thermCondL,
                                     pipeDiameterInitial=pipeDiameter2,
       pipeSectionInitial =                                                               sectionExt,STcoef=STcoefLiq,
                                     pipeSurfaceAreaInitial=areaExt,visc=viscLiq);
  
    JARA2i.heat.convecSiederTateB convHeatFG1(
                                    nCompI=1,nCompO=nCompG,CpCoefM=CpCoefMG,
       thermCondCoef =                                                                    thermCondG,
                                    pipeDiameterInitial=pipeDiameter1,
       pipeSectionInitial =                                                              sectionInt,STcoef=STcoefGas,
                                    pipeSurfaceAreaInitial=areaInt,visc=viscGas);
    JARA2i.heat.convecSiederTateB convHeatFG2(
                                    nCompI=1,nCompO=nCompG,CpCoefM=CpCoefMG,
       thermCondCoef =                                                                    thermCondG,
                                    pipeDiameterInitial=pipeDiameter1,
       pipeSectionInitial =                                                              sectionInt,STcoef=STcoefGas,
                                    pipeSurfaceAreaInitial=areaInt,visc=viscGas);
    JARA2i.heat.convecSiederTateB convHeatFG3(
                                    nCompI=1,nCompO=nCompG,CpCoefM=CpCoefMG,
       thermCondCoef =                                                                    thermCondG,
                                    pipeDiameterInitial=pipeDiameter1,
       pipeSectionInitial =                                                              sectionInt,STcoef=STcoefGas,
                                    pipeSurfaceAreaInitial=areaInt,visc=viscGas);
    JARA2i.heat.convecSiederTateB convHeatFG4(
                                    nCompI=1,nCompO=nCompG,CpCoefM=CpCoefMG,
       thermCondCoef =                                                                    thermCondG,
                                    pipeDiameterInitial=pipeDiameter1,
       pipeSectionInitial =                                                              sectionInt,STcoef=STcoefGas,
                                    pipeSurfaceAreaInitial=areaInt,visc=viscGas);
    JARA2i.heat.convecSiederTateB convHeatFG5(
                                    nCompI=1,nCompO=nCompG,CpCoefM=CpCoefMG,
       thermCondCoef =                                                                    thermCondG,
                                    pipeDiameterInitial=pipeDiameter1,
       pipeSectionInitial =                                                              sectionInt,STcoef=STcoefGas,
                                    pipeSurfaceAreaInitial=areaInt,visc=viscGas);
    JARA2i.heat.convecSiederTateB convHeatFG6(
                                    nCompI=1,nCompO=nCompG,CpCoefM=CpCoefMG,
       thermCondCoef =                                                                    thermCondG,
                                    pipeDiameterInitial=pipeDiameter1,
       pipeSectionInitial =                                                              sectionInt,STcoef=STcoefGas,
                                    pipeSurfaceAreaInitial=areaInt,visc=viscGas);
    JARA2i.heat.convecSiederTateB convHeatFG7(
                                    nCompI=1,nCompO=nCompG,CpCoefM=CpCoefMG,
       thermCondCoef =                                                                    thermCondG,
                                    pipeDiameterInitial=pipeDiameter1,
       pipeSectionInitial =                                                              sectionInt,STcoef=STcoefGas,
                                    pipeSurfaceAreaInitial=areaInt,visc=viscGas);
    JARA2i.heat.convecSiederTateB convHeatFG8(
                                    nCompI=1,nCompO=nCompG,CpCoefM=CpCoefMG,
       thermCondCoef =                                                                    thermCondG,
                                    pipeDiameterInitial=pipeDiameter1,
       pipeSectionInitial =                                                              sectionInt,STcoef=STcoefGas,
                                    pipeSurfaceAreaInitial=areaInt,visc=viscGas);
    JARA2i.heat.convecSiederTateB convHeatFG9(
                                    nCompI=1,nCompO=nCompG,CpCoefM=CpCoefMG,
       thermCondCoef =                                                                    thermCondG,
                                    pipeDiameterInitial=pipeDiameter1,
       pipeSectionInitial =                                                              sectionInt,STcoef=STcoefGas,
                                    pipeSurfaceAreaInitial=areaInt,visc=viscGas);
  
equation 
    // ----------------------------------
    // Definition of the public variables
    // ----------------------------------
  
    tempLiq[1]  = volCntrlLiq1.liquid.inHeat.temp;
    tempLiq[2]  = volCntrlLiq2.liquid.inHeat.temp;
    tempLiq[3]  = volCntrlLiq3.liquid.inHeat.temp;
    tempLiq[4]  = volCntrlLiq4.liquid.inHeat.temp;
    tempLiq[5]  = volCntrlLiq5.liquid.inHeat.temp;
    tempLiq[6]  = volCntrlLiq6.liquid.inHeat.temp;
    tempLiq[7]  = volCntrlLiq7.liquid.inHeat.temp;
    tempLiq[8]  = volCntrlLiq8.liquid.inHeat.temp;
    tempLiq[9]  = volCntrlLiq9.liquid.inHeat.temp;
    tempLiq[10] = volCntrlLiq10.liquid.inHeat.temp;
  
    tempGas[1]  = volCntrlGas1.semiPerfGas.inHeat.temp;
    tempGas[2]  = volCntrlGas2.semiPerfGas.inHeat.temp;
    tempGas[3]  = volCntrlGas3.semiPerfGas.inHeat.temp;
    tempGas[4]  = volCntrlGas4.semiPerfGas.inHeat.temp;
    tempGas[5]  = volCntrlGas5.semiPerfGas.inHeat.temp;
    tempGas[6]  = volCntrlGas6.semiPerfGas.inHeat.temp;
    tempGas[7]  = volCntrlGas7.semiPerfGas.inHeat.temp;
    tempGas[8]  = volCntrlGas8.semiPerfGas.inHeat.temp;
    tempGas[9]  = volCntrlGas9.semiPerfGas.inHeat.temp;
    tempGas[10] = volCntrlGas10.semiPerfGas.inHeat.temp;
  
    tempWall[1]  = pipeWall1.inHeat.temp;
    tempWall[2]  = pipeWall2.inHeat.temp;
    tempWall[3]  = pipeWall3.inHeat.temp;
    tempWall[4]  = pipeWall4.inHeat.temp;
    tempWall[5]  = pipeWall5.inHeat.temp;
    tempWall[6]  = pipeWall6.inHeat.temp;
    tempWall[7]  = pipeWall7.inHeat.temp;
    tempWall[8]  = pipeWall8.inHeat.temp;
    tempWall[9]  = pipeWall9.inHeat.temp;
  
    massFlowLiq  = sourceL2.inMass.massLF;
  
    molFlowGas   = sourceG2.inMol.molGF;
  
    tempLiqFlowSourceL1 = sourceL1.tempF;
    tempLiqFlowSourceL2 = sourceL2.tempF;
  
    tempGasFlowSourceG1 = sourceG2.tempF;
    tempGasFlowSourceG2 = sourceG2.tempF;
  
    // Setpoint of the liquid flow 
  
    pumpLCntrl.totalMassFSP    =  totalMassFSPliquid;
    sourceL1Cntrl.totalMassFSP = -totalMassFSPliquid;
    sourceL2Cntrl.totalMassFSP =  totalMassFSPliquid;
  
    // Controlled variable 
    outputGasTemp = if sum(molFlowGas[i] for i in 1:nCompG) > 0 then tempGasFlowSourceG2 else tempGasFlowSourceG1;
  
    // Set point signals 
  
    connect(  sourceL1Cntrl.setPointSignal, sourceL1.setPointSignal);
  
    connect(  sourceL2Cntrl.setPointSignal, sourceL2.setPointSignal);
  
    connect(  pumpLCntrl.setPointSignal,   pumpL1.setPointSignal);
  
    connect(  pumpLCntrl.setPointSignal,   pumpL2.setPointSignal);
  
    connect(  pumpLCntrl.setPointSignal,  pumpL3.setPointSignal);
  
    connect(  pumpLCntrl.setPointSignal,  pumpL4.setPointSignal);
  
    connect(  pumpLCntrl.setPointSignal,  pumpL5.setPointSignal);
  
    connect(  pumpLCntrl.setPointSignal,  pumpL6.setPointSignal);
  
    connect(  pumpLCntrl.setPointSignal,  pumpL7.setPointSignal);
  
    connect(  pumpLCntrl.setPointSignal,  pumpL8.setPointSignal);
  
    connect(  pumpLCntrl.setPointSignal,   pumpL9.setPointSignal);
  
    connect(  sourceG1Cntrl.setPointSignal,  sourceG1.setPointSignal);
  
    connect(  sourceG2Cntrl.setPointSignal,  sourceG2.setPointSignal);
  
    connect(  pumpGCntrl.setPointSignal,  pumpG1.setPointSignal);
  
    connect(  pumpGCntrl.setPointSignal,  pumpG2.setPointSignal);
  
    connect(  pumpGCntrl.setPointSignal,  pumpG3.setPointSignal);
  
    connect(  pumpGCntrl.setPointSignal,  pumpG4.setPointSignal);
  
    connect(  pumpGCntrl.setPointSignal,  pumpG5.setPointSignal);
  
    connect(  pumpGCntrl.setPointSignal,  pumpG6.setPointSignal);
  
    connect(  pumpGCntrl.setPointSignal,  pumpG7.setPointSignal);
  
    connect(  pumpGCntrl.setPointSignal,  pumpG8.setPointSignal);
  
    connect(  pumpGCntrl.setPointSignal,  pumpG9.setPointSignal);
  
    // Liquid flow 
  
    connect(  volCntrlLiq1.inMassBot,  sourceL1.inMass);
  
    connect(  volCntrlLiq1.inMassBot,  pumpL1.inMass);
  
    connect(  volCntrlLiq2.inMassBot,  pumpL1.outMass);
  
    connect(  volCntrlLiq2.inMassBot,  pumpL2.inMass);
  
    connect(  volCntrlLiq3.inMassBot,  pumpL2.outMass);
  
    connect(  volCntrlLiq3.inMassBot,  pumpL3.inMass);
  
    connect(  volCntrlLiq4.inMassBot,  pumpL3.outMass);
  
    connect(  volCntrlLiq4.inMassBot,  pumpL4.inMass);
  
    connect(  volCntrlLiq5.inMassBot,  pumpL4.outMass);
  
    connect(  volCntrlLiq5.inMassBot,  pumpL5.inMass);
  
    connect(  volCntrlLiq6.inMassBot,  pumpL5.outMass);
  
    connect(  volCntrlLiq6.inMassBot,  pumpL6.inMass);
  
    connect(  volCntrlLiq7.inMassBot,  pumpL6.outMass);
  
    connect(  volCntrlLiq7.inMassBot,  pumpL7.inMass);
  
    connect(  volCntrlLiq8.inMassBot,  pumpL7.outMass);
  
    connect(  volCntrlLiq8.inMassBot,  pumpL8.inMass);
  
    connect(  volCntrlLiq9.inMassBot,  pumpL8.outMass);
  
    connect(  volCntrlLiq9.inMassBot,  pumpL9.inMass);
  
    connect(  volCntrlLiq10.inMassBot,  pumpL9.outMass);
  
    connect(  volCntrlLiq10.inMassBot,  sourceL2.inMass);
  
    // Gas flow 
  
    connect(  volCntrlGas1.inMol,   sourceG1.inMol);
  
    connect(  volCntrlGas1.inMol,   pumpG1.inMol);
  
    connect(  volCntrlGas2.inMol,   pumpG1.outMol);
  
    connect(  volCntrlGas2.inMol,   pumpG2.inMol);
  
    connect(  volCntrlGas3.inMol,   pumpG2.outMol);
  
    connect(  volCntrlGas3.inMol,   pumpG3.inMol);
  
    connect(  volCntrlGas4.inMol,   pumpG3.outMol);
  
    connect(  volCntrlGas4.inMol,   pumpG4.inMol);
  
    connect(  volCntrlGas5.inMol,   pumpG4.outMol);
  
    connect(  volCntrlGas5.inMol,   pumpG5.inMol);
  
    connect(  volCntrlGas6.inMol,   pumpG5.outMol);
  
    connect(  volCntrlGas6.inMol,   pumpG6.inMol);
  
    connect(  volCntrlGas7.inMol,   pumpG6.outMol);
  
    connect(  volCntrlGas7.inMol,   pumpG7.inMol);
  
    connect(  volCntrlGas8.inMol,   pumpG7.outMol);
  
    connect(  volCntrlGas8.inMol,   pumpG8.inMol);
  
    connect(  volCntrlGas9.inMol,   pumpG8.outMol);
  
    connect(  volCntrlGas9.inMol,   pumpG9.inMol);
  
    connect(  volCntrlGas10.inMol,  pumpG9.outMol);
  
    connect(  volCntrlGas10.inMol,  sourceG2.inMol);
  
    // Conduction heat flow
  
    connect(  pipeWall1.inHeat,   condHeat12.inHeat);
  
    connect(  pipeWall2.inHeat,  condHeat12.outHeat);
  
    connect(  pipeWall2.inHeat,  condHeat23.inHeat);
  
    connect(  pipeWall3.inHeat,  condHeat23.outHeat);
  
    connect(  pipeWall3.inHeat,  condHeat34.inHeat);
  
    connect(  pipeWall4.inHeat,  condHeat34.outHeat);
  
    connect(  pipeWall4.inHeat,  condHeat45.inHeat);
  
    connect(  pipeWall5.inHeat,  condHeat45.outHeat);
  
    connect(  pipeWall5.inHeat,  condHeat56.inHeat);
  
    connect(  pipeWall6.inHeat,  condHeat56.outHeat);
  
    connect(  pipeWall6.inHeat,  condHeat67.inHeat);
  
    connect(  pipeWall7.inHeat,  condHeat67.outHeat);
  
    connect(  pipeWall7.inHeat,  condHeat78.inHeat);
  
    connect(  pipeWall8.inHeat,  condHeat78.outHeat);
  
    connect(  pipeWall8.inHeat,  condHeat89.inHeat);
  
    connect(  pipeWall9.inHeat,  condHeat89.outHeat);
  
    // Convection heat flow liquid - internal pipe wall 
  
    connect(  convHeatFL1.inHeat,  pipeWall1.inHeat);
  
    connect(  convHeatFL1.outHeat, pumpL1.inHeat);
  
    connect(  convHeatFL2.inHeat,  pipeWall2.inHeat);
  
    connect(  convHeatFL2.outHeat, pumpL2.inHeat);
  
    connect(  convHeatFL3.inHeat,  pipeWall3.inHeat);
  
    connect(  convHeatFL3.outHeat, pumpL3.inHeat);
  
    connect(  convHeatFL4.inHeat,  pipeWall4.inHeat);
  
    connect(  convHeatFL4.outHeat, pumpL4.inHeat);
  
    connect(  convHeatFL5.inHeat,  pipeWall5.inHeat);
  
    connect(  convHeatFL5.outHeat, pumpL5.inHeat);
  
    connect(  convHeatFL6.inHeat,  pipeWall6.inHeat);
  
    connect(  convHeatFL6.outHeat, pumpL6.inHeat);
  
    connect(  convHeatFL7.inHeat,  pipeWall7.inHeat);
  
    connect(  convHeatFL7.outHeat, pumpL7.inHeat);
  
    connect(  convHeatFL8.inHeat,  pipeWall8.inHeat);
  
    connect(  convHeatFL8.outHeat, pumpL8.inHeat);
  
    connect(  convHeatFL9.inHeat,  pipeWall9.inHeat);
  
    connect(  convHeatFL9.outHeat, pumpL9.inHeat);
  
    // Convection heat flow gas - internal pipe wall 
  
    connect(  convHeatFG1.inHeat,   pipeWall1.inHeat);
  
    connect(  convHeatFG1.outHeat,  pumpG1.inHeat);
  
    connect(  convHeatFG2.inHeat,   pipeWall2.inHeat);
  
    connect(  convHeatFG2.outHeat,  pumpG2.inHeat);
  
    connect(  convHeatFG3.inHeat,   pipeWall3.inHeat);
  
    connect(  convHeatFG3.outHeat,  pumpG3.inHeat);
  
    connect(  convHeatFG4.inHeat,   pipeWall4.inHeat);
  
    connect(  convHeatFG4.outHeat,  pumpG4.inHeat);
  
    connect(  convHeatFG5.inHeat,   pipeWall5.inHeat);
  
    connect(  convHeatFG5.outHeat,  pumpG5.inHeat);
  
    connect(  convHeatFG6.inHeat,   pipeWall6.inHeat);
  
    connect(  convHeatFG6.outHeat,  pumpG6.inHeat);
  
    connect(  convHeatFG7.inHeat,   pipeWall7.inHeat);
  
    connect(  convHeatFG7.outHeat,  pumpG7.inHeat);
  
    connect(  convHeatFG8.inHeat,   pipeWall8.inHeat);
  
    connect(  convHeatFG8.outHeat,  pumpG8.inHeat);
  
    connect(  convHeatFG9.inHeat,   pipeWall9.inHeat);
  
    connect(  convHeatFG9.outHeat,  pumpG9.inHeat);
  
end DoublePipeHeatExchanger;

JARA2i.CaseStudies.doublePipeHeatExchanger.Sysquake.DoublePipeHeatExchangerOpen JARA2i.CaseStudies.doublePipeHeatExchanger.Sysquake.DoublePipeHeatExchangerOpen

Double pipe heat exchager plant. Input: mass flow of liquid water. Output: temperature of the outlet gas

JARA2i.CaseStudies.doublePipeHeatExchanger.Sysquake.DoublePipeHeatExchangerOpen

Parameters

TypeNameDefaultDescription
RealtempLiq291 
RealTotalMolFlowGas0.16 
RealtempGas400 
RealConcMolarCO20.5 
ReallenPipe1Pipe lenght [m]
RealpipeDiameter118.92E-3Inner diameter of the inside tube [m]
RealpipeDiameter222.22E-3Outer diameter of the inside tube [m]
RealpipeDiameter338.10E-3Inner diameter of the outside pipe [m]

Connectors

TypeNameDescription
input RealInputinPortConnector of Real input signal
output RealOutputoutPortConnector of actuator output signal

Modelica definition

model DoublePipeHeatExchangerOpen 
  "Double pipe heat exchager plant. Input: mass flow of liquid water. Output: temperature of the outlet gas" 
  
 Modelica.Blocks.Interfaces.RealInput inPort "Connector of Real input signal";
 Modelica.Blocks.Interfaces.RealOutput outPort 
    "Connector of actuator output signal";
 Real systemInput;
 Real systemOutput;
 parameter Real tempLiq = 291;
 parameter Real TotalMolFlowGas = 0.16;
 parameter Real tempGas = 400;
 parameter Real ConcMolarCO2 = 0.5;
 parameter Real lenPipe(        unit="m") =  1 "Pipe lenght";
 parameter Real pipeDiameter1(  unit="m") =  18.92E-3 
    "Inner diameter of the inside tube";
 parameter Real pipeDiameter2(  unit="m") =  22.22E-3 
    "Outer diameter of the inside tube";
 parameter Real pipeDiameter3(  unit="m") =  38.10E-3 
    "Inner diameter of the outside pipe";
protected 
 parameter Real tableTempLiq[1,2]=[0,tempLiq];
 parameter Real tableTotalMolFlowGas[1,2]=[0,TotalMolFlowGas];
 parameter Real tableTempGas[1,2]=[0,tempGas];
 parameter Real tableConcMolarCO2[1,2]=[0,ConcMolarCO2];
 DoublePipeHeatExchanger Planta(nElemTable=1, tableTempLiq=tableTempLiq,
      tableTotalMolFlowGas =                                                                tableTotalMolFlowGas,
      tableTempGas =                                                                                 tableTempGas,
      tableConcMolarCO2 =                                                                                                    tableConcMolarCO2, lenPipe=lenPipe,
      pipeDiameter1 =                                                                                                    pipeDiameter1,
      pipeDiameter2 =                                                                                                    pipeDiameter2,
      pipeDiameter3 =                                                                                                    pipeDiameter3);
equation 
  systemInput =inPort;
  systemOutput =outPort;
  Planta.totalMassFSPliquid = systemInput;
  systemOutput = Planta.outputGasTemp;
end DoublePipeHeatExchangerOpen;

JARA2i.CaseStudies.doublePipeHeatExchanger.Sysquake.Limiter JARA2i.CaseStudies.doublePipeHeatExchanger.Sysquake.Limiter

Limit the range of a signal

JARA2i.CaseStudies.doublePipeHeatExchanger.Sysquake.Limiter

Information


The Limiter block passes its input signal as output signal as long as the input is within the specified upper and lower limits. If this is not the case, the corresponding limits are passed as output.


Parameters

TypeNameDefaultDescription
RealuMax1Upper limits of input signals
RealuMin-1Lower limits of input signals

Connectors

TypeNameDescription
input RealInputuConnector of Real input signal
output RealOutputyConnector of Real output signal

Modelica definition

block Limiter "Limit the range of a signal" 
  import Modelica.Blocks;
  import Modelica.SIunits;
  import Modelica.Blocks.Interfaces;
  parameter Real uMax=1 "Upper limits of input signals";
  parameter Real uMin =   -1 "Lower limits of input signals";
  extends Interfaces.SISO;
  
equation 
  y = if u > uMax then uMax else if u < uMin then uMin else u;
end Limiter;

JARA2i.CaseStudies.doublePipeHeatExchanger.Sysquake.LimPID JARA2i.CaseStudies.doublePipeHeatExchanger.Sysquake.LimPID

PID controller with limited output, anti-windup compensation and setpoint weighting

JARA2i.CaseStudies.doublePipeHeatExchanger.Sysquake.LimPID

Information


This is a PID controller incorporating several practical aspects. It is designed according to chapter 3 of the book

   K. Astroem, T. Haegglund: PID Controllers: Theory, Design, and Tuning.
                             2nd edition, 1995.

Besides the additive proportional, integral and derivative part of this controller, the following practical aspects are included:

This is an adaptation of the LimPID Modelica model included in the Standard Modelica library.

Parameters

TypeNameDefaultDescription
Realk1Gain of PID block
TimeTi0.5Time constant of Integrator block [s]
TimeTd0.1Time constant of Derivative block [s]
RealyMax1Upper limit of output
RealyMin0Lower limit of output
Realwp1Set-point weight for Proportional block (0..1)
Realwd0Set-point weight for Derivative block (0..1)
RealNi0.9Ni*Ti is time constant of anti-windup compensation
RealNd10The higher Nd, the more ideal the derivative block
Realy_start3 

Connectors

TypeNameDescription
input RealInputu_sConnector of setpoint input signal
input RealInputu_mConnector of measurement input signal
output RealOutputyConnector of actuator output signal

Modelica definition

block LimPID 
  "PID controller with limited output, anti-windup compensation and setpoint weighting" 
  
 extends Interfaces.SVcontrol;
  import Modelica.Blocks;
  import Modelica.SIunits;
  import Modelica.Blocks.Interfaces;
 parameter Real k =   1 "Gain of PID block";
 parameter SIunits.Time Ti(min=Modelica.Constants.small) = 0.5 
    "Time constant of Integrator block";
 parameter SIunits.Time Td(min=0) = 0.1 "Time constant of Derivative block";
 parameter Real yMax=1 "Upper limit of output";
 parameter Real yMin=0 "Lower limit of output";
 parameter Real wp(min=0) = 1 "Set-point weight for Proportional block (0..1)";
 parameter Real wd(min=0) = 0 "Set-point weight for Derivative block (0..1)";
 parameter Real Ni(min=100*Modelica.Constants.eps) = 0.9 
    "Ni*Ti is time constant of anti-windup compensation";
 parameter Real Nd(min=100*Modelica.Constants.eps) = 10 
    "The higher Nd, the more ideal the derivative block";
 parameter Real y_start = 3;
 Blocks.Nonlinear.Limiter limiter(uMax=scalar(yMax), uMin=scalar(yMin));
  
 Blocks.Math.Add addP(k1=wp, k2=-1);
 Blocks.Math.Add addD(k1=wd, k2=-1);
 Blocks.Math.Gain P;
 Blocks.Continuous.Integrator I(        y_start=y_start, k=scalar(1/Ti));
 Blocks.Continuous.Derivative D(T=scalar(max([Td/Nd,1.e-14])), k=scalar(Td));
 Blocks.Math.Gain gainPID(k=scalar(k));
 Blocks.Math.Add3 addPID;
 Blocks.Math.Add3 addI(k2=-1, k3=1);
 Blocks.Math.Add addSat(k2=-1);
 Blocks.Math.Gain gainTrack(k=scalar(1/(k*Ni)));
equation 
 assert(yMax >= yMin, "PID: Limits must be consistent");
 connect(u_s, addP.u1);
 connect(u_m, addP.u2);
 connect(u_s, addD.u1);
 connect(u_m, addD.u2);
 connect(u_s, addI.u1);
 connect(u_m, addI.u2);
 connect(gainTrack.y, addI.u3);
 connect(addP.y, P.u);
 connect(addD.y, D.u);
 connect(addI.y, I.u);
 connect(P.y, addPID.u1);
 connect(D.y, addPID.u2);
 connect(I.y, addPID.u3);
 connect(addPID.y, gainPID.u);
 connect(gainPID.y, addSat.u2);
 connect(addSat.y, gainTrack.u);
 connect(gainPID.y, limiter.u);
 connect(limiter.y, y);
 connect(limiter.y, addSat.u1);
end LimPID;

JARA2i.CaseStudies.doublePipeHeatExchanger.Sysquake.massSourceCntrl JARA2i.CaseStudies.doublePipeHeatExchanger.Sysquake.massSourceCntrl

Controller of the gas pump. Set-points: total mass flow and temperature

JARA2i.CaseStudies.doublePipeHeatExchanger.Sysquake.massSourceCntrl

Information

Controller of the gas pump

Parameters

TypeNameDefaultDescription
IntegernComp1Number of components
RealmassFractionSP[nComp] Setpoint of the mass fraction
RealtableTemperatureSP[:, 2] Column 1: time. Column 2: temperature [[s;K]]

Connectors

TypeNameDescription
cutEmittersetPointSignalSetpoint of the temperature

Modelica definition

model massSourceCntrl 
  "Controller of the gas pump. Set-points: total mass flow and temperature" 
  
   extends JARA2i.interf.sourceMassSignalI;
  
   parameter Real massFractionSP[ nComp](  unit="") 
    "Setpoint of the mass fraction";
  
   // Inlet temperature
   parameter Real tableTemperatureSP[:,2](    unit="[s;K]") 
    "Column 1: time. Column 2: temperature";
  
   Modelica.Blocks.Tables.CombiTable1D calcInletTemp(table=tableTemperatureSP);
  
equation 
   massFractSP   = massFractionSP;
  
  calcInletTemp.u[1]              = time;
  calcInletTemp.y[1]              = tempFSP;
  
  
end massSourceCntrl;

JARA2i.CaseStudies.doublePipeHeatExchanger.Sysquake.ModelInOutDoublePipeHeatExchanger

Model to be used for the plant linearization

Parameters

TypeNameDefaultDescription
RealRandomInput1 
RealAmpInit0.280 
RealAmpFin0.260 
Realtini20 
RealtempLiq291 
RealTotalMolFlowGas0.16 
RealtempGas400 
RealConcMolarCO20.5 
ReallenPipe1Pipe lenght [m]
RealpipeDiameter118.92E-3Inner diameter of the inside tube [m]
RealpipeDiameter222.22E-3Outer diameter of the inside tube [m]
RealpipeDiameter338.10E-3Inner diameter of the outside pipe [m]

Modelica definition

model ModelInOutDoublePipeHeatExchanger 
  "Model to be used for the plant linearization" 
 Real systemOutput;
 Real systemInput;
 parameter Real RandomInput = 1;
 parameter Real AmpInit = 0.280;
 parameter Real AmpFin = 0.260;
 parameter Real tini= 20;
 parameter Real tempLiq = 291;
 parameter Real TotalMolFlowGas = 0.16;
 parameter Real tempGas = 400;
 parameter Real ConcMolarCO2 = 0.5;
 parameter Real lenPipe(        unit="m") =  1 "Pipe lenght";
 parameter Real pipeDiameter1(  unit="m") =  18.92E-3 
    "Inner diameter of the inside tube";
 parameter Real pipeDiameter2(  unit="m") =  22.22E-3 
    "Outer diameter of the inside tube";
 parameter Real pipeDiameter3(  unit="m") =  38.10E-3 
    "Inner diameter of the outside pipe";
protected 
 parameter Real tableTempLiq[1,2]=[0,tempLiq];
 parameter Real tableTotalMolFlowGas[1,2]=[0,TotalMolFlowGas];
 parameter Real tableTempGas[1,2]=[0,tempGas];
 parameter Real tableConcMolarCO2[1,2]=[0,ConcMolarCO2];
 DoublePipeHeatExchanger Planta(nElemTable=1, tableTempLiq=tableTempLiq,
      tableTotalMolFlowGas =                                                                tableTotalMolFlowGas,
      tableTempGas =                                                                                 tableTempGas,
      tableConcMolarCO2 =                                                                                                    tableConcMolarCO2, lenPipe=lenPipe,
      pipeDiameter1 =                                                                                                    pipeDiameter1,
      pipeDiameter2 =                                                                                                    pipeDiameter2,
      pipeDiameter3 =                                                                                                    pipeDiameter3);
equation 
  
  systemInput = if (RandomInput>0.5) then (if (time<tini) then AmpInit else 
 ((AmpFin-AmpInit)/2.0*sign(Modelica.Math.sin(2*Modelica.Constants.pi*0.6*time))+(AmpFin-AmpInit)/2+AmpInit)) else (if (time<tini) then AmpInit else AmpFin);
  Planta.totalMassFSPliquid = systemInput;
  systemOutput = Planta.outputGasTemp;
  
end ModelInOutDoublePipeHeatExchanger;

JARA2i.CaseStudies.doublePipeHeatExchanger.Sysquake.molSourceCntrl JARA2i.CaseStudies.doublePipeHeatExchanger.Sysquake.molSourceCntrl

Controller of the gas pump. Set-points: total mass flow, temperature and molar fraction of CO2

JARA2i.CaseStudies.doublePipeHeatExchanger.Sysquake.molSourceCntrl

Information

Controller of the gas pump

Parameters

TypeNameDefaultDescription
IntegernComp1 
RealtableTotalMolFSP[:, 2] Column 1: time. Column 2: total mol flow [[s;mol/s]]
RealtableTemperatureSP[:, 2] Column 1: time. Column 2: temperature [[s;K]]
RealtableMolarFractionCO2[:, 2] Column 1: time. Column 2: molar fraction of CO2 [[s; ]]
RealflowDirection1 

Connectors

TypeNameDescription
cutEmittersetPointSignalSet-point of the total molar flow, mol fraction and temperature

Modelica definition

model molSourceCntrl 
  "Controller of the gas pump. Set-points: total mass flow, temperature and molar fraction of CO2" 
   extends JARA2i.interf.sourceMolSignalI;
  
   // Mol flow
   parameter Real tableTotalMolFSP[:,2](    unit="[s;mol/s]") 
    "Column 1: time. Column 2: total mol flow";
  
   // Inlet temperature
   parameter Real tableTemperatureSP[:,2](    unit="[s;K]") 
    "Column 1: time. Column 2: temperature";
  
   // Molar fraction of CO2
   parameter Real tableMolarFractionCO2[:,2](    unit="[s; ]") 
    "Column 1: time. Column 2: molar fraction of CO2";
  
   parameter Real flowDirection = 1;
  
   Modelica.Blocks.Tables.CombiTable1D calcTotalMolFlowSP(table=
        tableTotalMolFSP);
  
   Modelica.Blocks.Tables.CombiTable1D calcInletTemp(table=tableTemperatureSP);
  
   Modelica.Blocks.Tables.CombiTable1D calcMolFractionCO2(table=
        tableMolarFractionCO2);
  
equation 
   // totalMolFSP   = if time < event1 or time > event2 then molFlowSP1 else molFlowSP2;
  
  calcTotalMolFlowSP.u[1]              = time;
  calcTotalMolFlowSP.y[1]              * flowDirection = totalMolFSP;
  
   // Mol fraction of the gas components
  calcMolFractionCO2.u[1]              = time;
  calcMolFractionCO2.y[1]              = molFractSP[1];
  molFractSP[1] + molFractSP[2] = 1;
  
   // tempFSP       = inletTemp;
  calcInletTemp.u[1]              = time;
  calcInletTemp.y[1]              = tempFSP;
  
  
end molSourceCntrl;

JARA2i.CaseStudies.doublePipeHeatExchanger.Sysquake.PIDControl

Plant + PID controlling the temperature of the outlet gas by manipulating the mass flow of liquid water

JARA2i.CaseStudies.doublePipeHeatExchanger.Sysquake.PIDControl

Modelica definition

model PIDControl 
  "Plant + PID controlling  the temperature of the outlet gas by manipulating the mass flow of liquid water" 
  DoublePipeHeatExchangerOpen Planta(tempLiq=291, TotalMolFlowGas=0.16,
    tempGas=400);
  Modelica.Blocks.Sources.Pulse Pulse1(
    amplitude=1,
    offset=331.89896,
    period=100,
    startTime=100);
  LimPID limPID1(
    Ti=10,
    k=-0.5,
    y_start=0,
    wd=1,
    yMax=0.01);
equation 
  connect(Pulse1.y, limPID1.u_s);
  connect(limPID1.y, Planta.inPort);
  connect(Planta.outPort, limPID1.u_m);
end PIDControl;

JARA2i.CaseStudies.doublePipeHeatExchanger.Sysquake.PoleZeroControl

Plant + compensator network controlling the temperature of the outlet gas by manipulating the mass flow of liquid water

JARA2i.CaseStudies.doublePipeHeatExchanger.Sysquake.PoleZeroControl

Modelica definition

model PoleZeroControl 
  "Plant + compensator network controlling  the temperature of the outlet gas by manipulating the mass flow of liquid water" 
  Modelica.Blocks.Continuous.TransferFunction Controller(a={3.63e-2,1}, b={-2.72e-2,
        -1.86});
  DoublePipeHeatExchangerOpen Planta;
  Modelica.Blocks.Math.Feedback Feedback1;
  Modelica.Blocks.Nonlinear.Limiter Limiter1(uMax=0.1, uMin=0);
  Modelica.Blocks.Sources.Pulse Pulse1(
    amplitude=1,
    offset=331.89896,
    period=100,
    startTime=100);
equation 
  connect(Feedback1.y,Controller.u);
  connect(Planta.outPort,Feedback1.u2);
  connect(Controller.y,Limiter1.u);
  connect(Limiter1.y,       Planta.inPort);
  connect(Pulse1.y, Feedback1.u1);
end PoleZeroControl;

JARA2i.CaseStudies.doublePipeHeatExchanger.Sysquake.pumpCntrl JARA2i.CaseStudies.doublePipeHeatExchanger.Sysquake.pumpCntrl

Controller of the liquid pump

JARA2i.CaseStudies.doublePipeHeatExchanger.Sysquake.pumpCntrl

Information

Controller of the liquid pump

Connectors

TypeNameDescription
cutEmittersetPointSignalSet-point signal

Modelica definition

model pumpCntrl "Controller of the liquid pump" 
   extends JARA2i.interf.pumpMassSignalI;
  
equation 
  
end pumpCntrl;

JARA2i.CaseStudies.doublePipeHeatExchanger.Sysquake.pumpMolCntrl JARA2i.CaseStudies.doublePipeHeatExchanger.Sysquake.pumpMolCntrl

Controller of the gas pump. Set-point: total mol flow

Information

Controller of the gas pump

Parameters

TypeNameDefaultDescription
RealtableTotalMolFSP[:, 2] Column 1: time. Column 2: totalMolFSP [[s;mol/s]]

Connectors

TypeNameDescription
cutEmittersetPointSignalSetpoint of the total molar flow

Modelica definition

model pumpMolCntrl 
  "Controller of the gas pump. Set-point: total mol flow" 
   extends JARA2i.interf.pumpMolSignalI;
  
  parameter Real tableTotalMolFSP[:,2](   unit="[s;mol/s]") 
    "Column 1: time. Column 2: totalMolFSP";
  
  Modelica.Blocks.Tables.CombiTable1D calcTotalMolFlowSP(table=tableTotalMolFSP);
  
equation 
  calcTotalMolFlowSP.u[1]             = time;
  
  calcTotalMolFlowSP.y[1]              = totalMolFSP;
  
  
end pumpMolCntrl;

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