JARA2i.CaseStudies.batchReactor.Sysquake

Modelica model of the batch reactor to be used in a virtual lab implemented in combination with Sysquake

Information


 

Modelica model of the batch reactor to be used in a virtual lab implemented in combination with Sysquake

Package Content

NameDescription
batchReacLiqAtoP Batch reactor model
batchReacLiqAtoPControlled Open loop system + PID controller (the liquid level inside the reactor is controlled by manipulating the liquid input flow)
JARA2i.CaseStudies.batchReactor.Sysquake.batchReacLiqAtoPOpen batchReacLiqAtoPOpen Open loop system. Input: set-point of the pump liquid flow. Output: volume of the liquid inside the reactor


JARA2i.CaseStudies.batchReactor.Sysquake.batchReacLiqAtoP

Batch reactor model

JARA2i.CaseStudies.batchReactor.Sysquake.batchReacLiqAtoP

Parameters

TypeNameDefaultDescription
IntegernComp3Component number of the liquid mixture
IntegernumChR1Number of irreversible chemical reactions
BooleanEjsfalse 
BooleanSysquaketrue 
RealmolecWeightInitial[nComp]{0.1,0.018,0.1}Molecular weight [Kg/mol]
RealdensityInitial[nComp]{1E3,1E3,1E3}Components density [Kg/m3]
RealstoichCoefInitial[numChR, nComp][-1, 0, 1]Stoich coeffs.
RealkCoefInitial[2]{4E6,-7.9E3}Reaction velocity coeffs. [{s-1,K}]
RealvesselVinitial5Initial reactor volume [m3]
RealvesselSinitial3Initial reactor section [m2]
RealheatExchAreaInitial3.3Exchanger area [m2]
RealhTSteamInitial1360Heat-transfer coeff. of the vapor [W/(m2.K)]
RealhTWaterInitial1180Heat-transfer coeff. of the water [W/(m2.K)]
RealmassLinitial[:]{0,1,0}Initial condition [M]
RealtempLinitial300Initial condition [T]
RealtempHeat400 
RealtempCool273 
RealtempSP273 
RealfractVSP[nComp]{0.5,0.5,0} 

Modelica definition

partial model batchReacLiqAtoP "Batch reactor model" 
// [1]: A, [2]: agua, [3]: P 
  
   parameter Integer nComp =    3 "Component number of the liquid mixture";
   parameter Integer numChR =   1 "Number of irreversible chemical reactions";
  
   // Type of Interactivity
   inner parameter Boolean Ejs =      false;
   inner parameter Boolean Sysquake = true;
  
  // ----------------
   // Output variables
   // ----------------
  
   Real massL[nComp];
  
   Real liqHeight;
  
   Real fluidV;
  
   Real sourceTemp;
  
   Real consumHeater;
  
   Real consumChiller;
  
   Real massLF[nComp];
  
   Real totalMassF;
  
   Real tempF;
  
   Real massLFChR[nComp];
  
   Real conversion;
  
   Real reactionRate[numChR];
  
   // ----------------------
   // Interactive parameters
   // ----------------------
  
   parameter Real molecWeightInitial[ nComp]( unit="Kg/mol") =  {0.1, 0.018, 0.1} 
    "Molecular weight";
   parameter Real densityInitial[ nComp](     unit="Kg/m3") =   {1E3, 1E3, 1E3} 
    "Components density";
  
   parameter Real stoichCoefInitial[ numChR,nComp] =     [-1, 0, 1] 
    "Stoich coeffs.";
   parameter Real kCoefInitial[ 2](          unit="{s-1,K}") =   { 4E6, -7.9E3} 
    "Reaction velocity coeffs.";
  
   parameter Real vesselVinitial(  unit="m3") = 5 "Initial reactor volume";
   parameter Real vesselSinitial(  unit="m2") = 3 "Initial reactor section";
  
   parameter Real heatExchAreaInitial(  unit="m2") =       3.3 "Exchanger area";
   parameter Real hTSteamInitial(       unit="W/(m2.K)") = 1360 
    "Heat-transfer coeff. of the vapor";
   parameter Real hTWaterInitial(       unit="W/(m2.K)") = 1180 
    "Heat-transfer coeff. of the water";
  
   parameter Real massLinitial[ :](    unit="M") =  { 0, 1, 0} 
    "Initial condition";
   parameter Real tempLinitial(        unit="T") =  300 "Initial condition";
  
  //-----------------------------
  // Parameters associated to the input variables
  //----------------------------- 
  
   parameter Real tempHeat = 400;    // sourceOfTemp
  
   parameter Real tempCool =   273;    // sourceOfTemp
  
   parameter Real tempSP= 273;      // sourceLiqCntrl
  
   parameter Real fractVSP[nComp] = {0.5, 0.5, 0};     // sourceLiqCntrl  
  
  Real tempL;
  
   // ---------------
   // Input variables
   // ---------------
  
   Real isHeater(start = 1, fixed = true);  // thermalResist, sourceOfTemp
  
   Real isChiller(start = 0);      // thermalResist, sourceOfTemp
  
   Real tempHeatv;    // sourceOfTemp
  
   Real tempCoolv;    // sourceOfTemp
  
   Real flowVSP;     // sourceLiqCntrl. Positivo: llena el deposito
  
   Real tempSPv;      // sourceLiqCntrl
  
   Real fractVSPv[nComp];     // sourceLiqCntrl
  
   Real calcConversion;     //chRAtoP  CCC
  
protected 
   parameter Real CpCoefMInitial[ nComp,7]( unit="J/(Kg*K)") = [ 4.5E3, 0, 0, 0, 0, 0, 0;
                                                          4.2E3, 0, 0, 0, 0, 0, 0;
                                                          4.5E3, 0, 0, 0, 0, 0, 0];
  
   parameter Real massEnthalpyRefInitial[nComp](  unit="J/Kg") = {167E4, 0, 0} 
    "Specific (per mass) enthalpy at reference temperature";
   parameter Real tempRefInitial(                 unit="K") =    300 
    "Reference temperature";
  
   parameter Real pmax =      1.05*3*vesselVinitial*liq.liquid.g*
                              max(densityInitial[1],max(densityInitial[2],densityInitial[3])) /
                              (0.5*vesselSinitial);
   parameter Real pcodo =     pmax / 1.05 "Source parameter";
   parameter Real pmin =         1 "Source parameter";
   parameter Real peps =         0.2 "Source parameter";
  
protected 
   JARA2i.liq.liquidCp6PrefVB liq(   nComp=nComp,CpCoefMInitial=CpCoefMInitial,
                                   vesselVolumeInitial=vesselVinitial,
      densityInitial =                                                               densityInitial,
                                   sectionInitial=vesselSinitial,
      massEnthalpyRefInitial =                                                          massEnthalpyRefInitial,
                                   tempRefInitial=tempRefInitial,
                                   massLinitial=massLinitial,tempLinitial=tempLinitial);
  
protected 
   PhysicalModel.chReacAtoP chRAtoP(       nComp=nComp,numChR=numChR,stoichCoefInitial=stoichCoefInitial,
      kCoefInitial =                                                                                    kCoefInitial,
                             molecWeightInitial=molecWeightInitial,
      densityInitial =                                                            densityInitial);
  
protected 
   JARA2i.liq.sourceVolLiqFB liqSource(  nComp=nComp,densityInitial=densityInitial,
      CpCoefMInitial =                                                                          CpCoefMInitial,
                                       pmax=pmax,pcodo=pcodo,pmin=pmin,peps=peps,
                                       massEnthalpyRefInitial=massEnthalpyRefInitial,
      tempRefInitial =                                                                              tempRefInitial);
  
protected 
   PhysicalModel.thermalResist resistTherm(   nCompI=nComp,heatExchAreaInitial=heatExchAreaInitial,
                                hTSteamInitial=hTSteamInitial, hTWaterInitial=hTWaterInitial);
  
protected 
   PhysicalModel.sourceOfTemp fluidTemp;
  
protected 
   PhysicalModel.sourceLiqCntrl sourceLiqCtrl( nComp=nComp);
  
equation 
   // ---------------
   // Input variables
   // ---------------
  
    resistTherm.isHeater = isHeater;
   fluidTemp.isHeater = isHeater;
  
    fluidTemp.isChiller = isChiller;
    resistTherm.isChiller = isChiller;
  
   tempHeatv  =   fluidTemp.tempHeat;
  
   tempCoolv  =   fluidTemp.tempCool;
  
   flowVSP   =  sourceLiqCtrl.flowVSP;
  
   tempSPv    = sourceLiqCtrl.tempSP;
  
   fractVSPv  = sourceLiqCtrl.fractVSP;
  
    chRAtoP.calcConversion = pre(calcConversion);
  
   // ----------------------------------------
   //Input variables
   // ----------------------------------------
  
    tempHeatv  =  tempHeat;
  
    tempCoolv  =   tempCool;
  
    tempSPv    = tempSP;
  
   fractVSPv  = fractVSP;
  
   // ----------------
   // Output variables
   // ----------------
  
   massL = liq.liquid.massL;
  
   tempL = liq.liquid.tempL;
  
   liqHeight = liq.liquid.liqHeight;
  
   fluidV = liq.liquid.fluidV;
  
   sourceTemp = fluidTemp.sourceTemp;
  
   consumHeater =  fluidTemp.consumHeater;
  
   consumChiller = fluidTemp.consumChiller;
  
   massLF = -liqSource.inMass.massLF;
  
   totalMassF = -liqSource.totalMassF;
  
   tempF = liqSource.tempF;
  
   massLFChR = -chRAtoP.inMass.massLF;
  
   conversion = chRAtoP.conversion;
  
   reactionRate = chRAtoP.reactionRate;
  
   // Liquid flow
   connect(   liqSource.inMass,   liq.inMassBot);
   connect(   liq.inMassBot,  chRAtoP.inMass);
   connect(   liq.inHeat,  resistTherm.inHeat);
   connect(   fluidTemp.inHeat,  resistTherm.outHeat);
   connect(   liqSource.setPointSignal,  sourceLiqCtrl.setPointSignal);
  
   // Chemical reaction
  
   // Heat flow
  
   // Control signal
  
end batchReacLiqAtoP;

JARA2i.CaseStudies.batchReactor.Sysquake.batchReacLiqAtoPControlled

Open loop system + PID controller (the liquid level inside the reactor is controlled by manipulating the liquid input flow)

JARA2i.CaseStudies.batchReactor.Sysquake.batchReacLiqAtoPControlled

Parameters

TypeNameDefaultDescription
RealTheaterOFF328 
RealTChillerON368 
RealTChillerOFF320 
RealConversionSP0.9 
RealflowVSP0.2 
RealflowVSPOffset0 
RealflowVSPStartTime0 

Modelica definition

model batchReacLiqAtoPControlled 
  "Open loop system + PID controller (the liquid level inside the reactor is controlled by manipulating the liquid input flow)" 
  parameter Real TheaterOFF = 328;
  parameter Real TChillerON = 368;
  parameter Real TChillerOFF = 320;
  parameter Real ConversionSP = 0.9;
  parameter Real flowVSP = 0.2;
  parameter Real flowVSPOffset = 0;
  parameter Real flowVSPStartTime = 0;
  batchReacLiqAtoPOpen Planta;
  Modelica.Blocks.Continuous.LimPID LimPID(
    yMax=0.01,
    k=1,
    Ti=9,
    Td=0.1);
  Modelica.Blocks.Sources.Step Step(
    height=flowVSP,
    offset=flowVSPOffset,
    startTime=flowVSPStartTime);
  
   Boolean EndSimul(  start= false) "True: the cooling process has finished";
equation 
  connect(Step.y,LimPID.u_s);
  connect(LimPID.y, Planta.flowVSPC);
  connect(Planta.fluidVolume, LimPID.u_m);
when abs(flowVSP+flowVSPOffset-Planta.open.fluidV)<0.01*abs(flowVSP+flowVSPOffset) and not (EndSimul) then
                                                                                       //Liquid level in the tank hasn't reached the SP yet   
      Planta.open.calcConversion= 1.0;
end when;
  
 when      (Planta.open.tempL>TheaterOFF) and (Planta.open.isHeater>0.5) and not (EndSimul) then
       Planta.open.isHeater = 0;
end when;
 when        ((Planta.open.tempL>TChillerON) or (Planta.open.conversion>ConversionSP))
 and ((Planta.open.isChiller<0.5)) or 
                                     (Planta.open.tempL < TChillerOFF) and (Planta.open.isChiller>0.5) then
       Planta.open.isChiller = 1.0- pre(Planta.open.isChiller);
    
  end when;
 when pre(Planta.open.isChiller)>0.5 then
     EndSimul = true;
 end when;
end batchReacLiqAtoPControlled;

JARA2i.CaseStudies.batchReactor.Sysquake.batchReacLiqAtoPOpen JARA2i.CaseStudies.batchReactor.Sysquake.batchReacLiqAtoPOpen

Open loop system. Input: set-point of the pump liquid flow. Output: volume of the liquid inside the reactor

Connectors

TypeNameDescription
output RealOutputfluidVolume 
input RealInputflowVSPC 

Modelica definition

model batchReacLiqAtoPOpen 
  "Open loop system. Input: set-point of the pump liquid flow. Output: volume of the liquid inside the reactor" 
  batchReacLiqAtoP open;
  
  Modelica.Blocks.Interfaces.RealOutput fluidVolume;
  Modelica.Blocks.Interfaces.RealInput flowVSPC;
equation 
  -open.flowVSP =flowVSPC;
  open.fluidV =fluidVolume;
end batchReacLiqAtoPOpen;

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