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).
Name | Description |
---|---|
DoublePipeHeatExchanger | Double-pipe heat-exchanger |
![]() | Double pipe heat exchager plant. Input: mass flow of liquid water. Output: temperature of the outlet gas |
![]() | Limit the range of a signal |
![]() | PID controller with limited output, anti-windup compensation and setpoint weighting |
![]() | Controller of the gas pump. Set-points: total mass flow and temperature |
ModelInOutDoublePipeHeatExchanger | Model to be used for the plant linearization |
![]() | 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 |
![]() | Controller of the liquid pump |
![]() | Controller of the gas pump. Set-point: total mol flow |
Type | Name | Default | Description |
---|---|---|---|
Integer | nCompL | 1 | Number of components of the liquid mixture |
Integer | nCompG | 2 | Number of components of the gas mixture |
Boolean | Ejs | false | |
Boolean | Sysquake | true | |
Real | pi | 3.141593 | |
Integer | numNodes | 10 | Number of nodes for temperature calculation |
Real | perfGasConst | 8.31 | Perfect gases constant [J/(mol.K)] |
Real | densityL[nCompL] | {996} | Density of the liquid components [Kg.m-3] |
Real | CpCoefML[nCompL, 7] | [4185, 0, 0, 0, 0, 0, 0] | Heat capacity [J/(Kg.K)] |
Real | viscLiq[4] | {1,-10.547,541.69,144.53} | Viscosity coefficients [W/(m.K)] |
Real | thermCondL[2] | {0.61,0} | Thermal conductivity coefficients |
Real | CpCoefNG[nCompG, 7] | [36.83, 0, 0, 0, 0, 0, 0; 42... | Heat capacity per mol at constant pressure [J/(mol.K)] |
Real | CpCoefMG[nCompG, 7] | [837, 0, 0, 0, 0, 0, 0; 657,... | Heat capacity per mass at constant pressure [J/(Kg.K)] |
Real | viscGas[4] | {1.55E-5,0,0,1} | Viscosity [Kg/(m.s)] |
Real | thermCondG[2] | {0.014,0} | Coeff. of the thermal conductivity [W/(m.K)] |
Real | molecWeigthG[2] | {44E-3,64E-3} | Molecular weight [Kg/mol] |
Real | lenPipe | 1 | Pipe lenght [m] |
Real | pipeDiameter1 | 18.92E-3 | Inner diameter of the inside tube [m] |
Real | pipeDiameter2 | 22.22E-3 | Outer diameter of the inside tube [m] |
Real | pipeDiameter3 | 38.10E-3 | Inner diameter of the outside pipe [m] |
Real | sectionInt | (pi*(pipeDiameter1/2)^2) | [m2] |
Real | areaInt | (pi*pipeDiameter1*lenPipe/(n... | [m2] |
Real | areaExt | (pi*pipeDiameter2*lenPipe/(n... | [m2] |
Real | volElemInt | (sectionInt*lenPipe/(numNode... | [m3] |
Real | volElemGas | volElemInt | [m3] |
Real | sectionExt | (pi*((pipeDiameter3/2)^2 - (... | [m2] |
Real | volElemLiq | sectionExt*lenPipe/(numNodes... | [m3] |
Real | pmax | 1E9 | Characteristic parameters of the source and pumps |
Real | pcodo | 0.9E9 | |
Real | pmin | 2E-2 | |
Real | peps | 1E-2 | |
Integer | nElemTable | 5 | |
Real | tableTimeEndSimulation | 600 | |
Real | tableTempLiq[nElemTable, 2] | [0, 291; 100, 291; 200, 291;... | |
Real | massFractionLSP[nCompL] | {1} | Setpoint: mass fraction of the liquid |
Real | tableTotalMolFlowGas[nElemTable, 2] | [0, 0.16; 100, 0.16; 200, 0.... | |
Real | tableTempGas[nElemTable, 2] | [0, 400; 100, 400; 200, 400;... | |
Real | tableConcMolarCO2[nElemTable, 2] | [0, 0.5; 100, 0.5; 200, 0.5;... | |
Real | densityIntPipeWall | 8950 | Density of the inside-tube wall [Kg/m3] |
Real | CpIntPipeWall[7] | {383,0,0,0,0,0,0} | Heat capacity of the inside-tube wall [J/(Kg.K)] |
Real | thermalCondWall | 381 | Thermal conductivity of the inside-tube wall [W/(m.K)] |
Real | pipeWallSection | (pi*((pipeDiameter2/2)^2 - (... | |
Real | massIntPipeWall | (densityIntPipeWall*lenPipe*... | |
Real | massElemPipe | (massIntPipeWall/(numNodes -... | |
Real | thermalResistance | (lenPipe/(thermalCondWall*pi... | |
Real | STcoefLiq[4] | {0.023,0.8,0.4,0} | Sieder-Tate correlation coefficients |
Real | STcoefGas[4] | {0.023,0.8,0.3,0} | Sieder-Tate correlation coefficients |
Real | tempInitialWall[numNodes - 1] | fill(331.452, (numNodes - 1)) | Wall initial temperature [K] |
Real | tempInitialLiq[numNodes] | fill(291, numNodes) | Liquid initial temperature [K] |
Real | tempInitialGas[numNodes] | fill(331.899, numNodes) | Gas initial temperature [K] |
Real | initialLiqMassFraction[nCompL] | {1} | Initial mass-fraction of the liquid mixture components |
Real | massInitialLiq[nCompL] | volElemLiq*initialLiqMassFra... | Initial mass of liquid inside a control volume [Kg] |
Real | molFractGasInitial[nCompG] | {0.5,0.5} | Initial mol fraction of the gas components |
Real | gasPressureInitial | 5e5 | Initial pressure of the gas mixture [J.m-3] |
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;
Type | Name | Default | Description |
---|---|---|---|
Real | tempLiq | 291 | |
Real | TotalMolFlowGas | 0.16 | |
Real | tempGas | 400 | |
Real | ConcMolarCO2 | 0.5 | |
Real | lenPipe | 1 | Pipe lenght [m] |
Real | pipeDiameter1 | 18.92E-3 | Inner diameter of the inside tube [m] |
Real | pipeDiameter2 | 22.22E-3 | Outer diameter of the inside tube [m] |
Real | pipeDiameter3 | 38.10E-3 | Inner diameter of the outside pipe [m] |
Type | Name | Description |
---|---|---|
input RealInput | inPort | Connector of Real input signal |
output RealOutput | outPort | Connector of actuator output signal |
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;
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.
Type | Name | Default | Description |
---|---|---|---|
Real | uMax | 1 | Upper limits of input signals |
Real | uMin | -1 | Lower limits of input signals |
Type | Name | Description |
---|---|---|
input RealInput | u | Connector of Real input signal |
output RealOutput | y | Connector of Real output signal |
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;
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:
Type | Name | Default | Description |
---|---|---|---|
Real | k | 1 | Gain of PID block |
Time | Ti | 0.5 | Time constant of Integrator block [s] |
Time | Td | 0.1 | Time constant of Derivative block [s] |
Real | yMax | 1 | Upper limit of output |
Real | yMin | 0 | Lower limit of output |
Real | wp | 1 | Set-point weight for Proportional block (0..1) |
Real | wd | 0 | Set-point weight for Derivative block (0..1) |
Real | Ni | 0.9 | Ni*Ti is time constant of anti-windup compensation |
Real | Nd | 10 | The higher Nd, the more ideal the derivative block |
Real | y_start | 3 |
Type | Name | Description |
---|---|---|
input RealInput | u_s | Connector of setpoint input signal |
input RealInput | u_m | Connector of measurement input signal |
output RealOutput | y | Connector of actuator output signal |
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;
Controller of the gas pump
Type | Name | Default | Description |
---|---|---|---|
Integer | nComp | 1 | Number of components |
Real | massFractionSP[nComp] | Setpoint of the mass fraction | |
Real | tableTemperatureSP[:, 2] | Column 1: time. Column 2: temperature [[s;K]] |
Type | Name | Description |
---|---|---|
cutEmitter | setPointSignal | Setpoint of the temperature |
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;
Type | Name | Default | Description |
---|---|---|---|
Real | RandomInput | 1 | |
Real | AmpInit | 0.280 | |
Real | AmpFin | 0.260 | |
Real | tini | 20 | |
Real | tempLiq | 291 | |
Real | TotalMolFlowGas | 0.16 | |
Real | tempGas | 400 | |
Real | ConcMolarCO2 | 0.5 | |
Real | lenPipe | 1 | Pipe lenght [m] |
Real | pipeDiameter1 | 18.92E-3 | Inner diameter of the inside tube [m] |
Real | pipeDiameter2 | 22.22E-3 | Outer diameter of the inside tube [m] |
Real | pipeDiameter3 | 38.10E-3 | Inner diameter of the outside pipe [m] |
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;
Controller of the gas pump
Type | Name | Default | Description |
---|---|---|---|
Integer | nComp | 1 | |
Real | tableTotalMolFSP[:, 2] | Column 1: time. Column 2: total mol flow [[s;mol/s]] | |
Real | tableTemperatureSP[:, 2] | Column 1: time. Column 2: temperature [[s;K]] | |
Real | tableMolarFractionCO2[:, 2] | Column 1: time. Column 2: molar fraction of CO2 [[s; ]] | |
Real | flowDirection | 1 |
Type | Name | Description |
---|---|---|
cutEmitter | setPointSignal | Set-point of the total molar flow, mol fraction and temperature |
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;
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;
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;
Controller of the liquid pump
Type | Name | Description |
---|---|---|
cutEmitter | setPointSignal | Set-point signal |
model pumpCntrl "Controller of the liquid pump" extends JARA2i.interf.pumpMassSignalI; equation end pumpCntrl;
Controller of the gas pump
Type | Name | Default | Description |
---|---|---|---|
Real | tableTotalMolFSP[:, 2] | Column 1: time. Column 2: totalMolFSP [[s;mol/s]] |
Type | Name | Description |
---|---|---|
cutEmitter | setPointSignal | Setpoint of the total molar flow |
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;