tankProcessLAB.componentsLIB

Components of the Multi-Tank Process Laboratory

Information



Components of the Multi-Tank Process Laboratory



Package Content

NameDescription
tankProcessLAB.componentsLIB.cgsUnits cgsUnits cgs units
tankProcessLAB.componentsLIB.liqFlow liqFlow Connector
tankProcessLAB.componentsLIB.tank tank Tank with one output
tankProcessLAB.componentsLIB.tank2Ouputs tank2Ouputs Tank with two outputs
tankProcessLAB.componentsLIB.pipe pipe Pipe
tankProcessLAB.componentsLIB.valve valve Valve
tankProcessLAB.componentsLIB.sink sink Sink
tankProcessLAB.componentsLIB.flowSource flowSource Flow source
tankProcessLAB.componentsLIB.pumpTwoWayValve pumpTwoWayValve Pump with two way valves


tankProcessLAB.componentsLIB.liqFlow tankProcessLAB.componentsLIB.liqFlow

Connector

tankProcessLAB.componentsLIB.liqFlow

Contents

TypeNameDescription
HeightliqHeadHead of liquid above the point [cm]
flow VolumeFlowRatevolFlowVolume flow [cm3/s]

Modelica definition

connector liqFlow "Connector" 
  cgsUnits.Height liqHead "Head of liquid above the point";
  flow cgsUnits.VolumeFlowRate volFlow "Volume flow";
end liqFlow;

tankProcessLAB.componentsLIB.tank tankProcessLAB.componentsLIB.tank

Tank with one output

tankProcessLAB.componentsLIB.tank

Parameters

TypeNameDefaultDescription
BooleanvolumeIsStatefalse 
BooleanhIsStatefalse 

Connectors

TypeNameDescription
liqFlowportBottom 
liqFlowportTop 

Modelica definition

model tank "Tank with one output" 
  liqFlow portBottom(liqHead=h);
  liqFlow portTop(liqHead=0);
  cgsUnits.Area tankSection(start=1) "Tank section";
  parameter Boolean volumeIsState=false;
  parameter Boolean hIsState=false;
  
  cgsUnits.Height alfa1(          start = 0.1);
  cgsUnits.Height alfa2(          start = 0.1);
  cgsUnits.Height beta(           start = 0.1);
  Boolean generateEvents(  start = true);
  
protected 
  constant cgsUnits.Adim PI = 3.14159265;
  cgsUnits.Height h(stateSelect=if hIsState then StateSelect.always else 
        StateSelect.never) "Liquid level inside the tank";
  cgsUnits.Height hLiq "Liquid level inside the tank";
  cgsUnits.Volume volume(stateSelect=if volumeIsState then StateSelect.always else 
              StateSelect.never) "Volume of liquid inside the tank";
  cgsUnits.Height tankRadius = sqrt( tankSection / PI);
  cgsUnits.Volume Valfa1 = 1/3*PI*alfa1*(tankRadius^2+tankRadius*beta+beta^2);
  cgsUnits.Volume Valfa2 = alfa2*PI*beta^2;
  cgsUnits.VolumeFlowRate totalFlow;
equation 
  der(volume) = if not totalFlow > 0 and not volume > 0 then 
                     0 else 
                     totalFlow;
  totalFlow   = portBottom.volFlow + portTop.volFlow;
  hLiq = min( alfa2, volume/(PI*beta^2))  +
         min( alfa1, max( 0, (volume-Valfa2)/(1/3*PI*(tankRadius^2+tankRadius*beta+beta^2))))   +
         max( 0, (volume-Valfa2-Valfa1)/(PI*tankRadius^2));
  h = if generateEvents then hLiq else noEvent(hLiq);
  der(tankSection) = 0;
  der(alfa1) = 0;
  der(alfa2) = 0;
  der(beta)  = 0;
  
end tank;

tankProcessLAB.componentsLIB.tank2Ouputs tankProcessLAB.componentsLIB.tank2Ouputs

Tank with two outputs

tankProcessLAB.componentsLIB.tank2Ouputs

Parameters

TypeNameDefaultDescription
BooleanvolumeIsStatefalse 
BooleanhIsStatefalse 

Connectors

TypeNameDescription
liqFlowportBottom 
liqFlowportTop 
liqFlowportMiddle 

Modelica definition

model tank2Ouputs "Tank with two outputs" 
  liqFlow portBottom(liqHead=h);
  liqFlow portTop(liqHead=0);
  liqFlow portMiddle(liqHead=max(0, h - hPortMiddle));
  
  cgsUnits.Area tankSection(start=1) "Tank section";
  cgsUnits.Height hPortMiddle(start=1) "Height of PortMiddle";
  
  parameter Boolean volumeIsState=false;
  parameter Boolean hIsState=false;
protected 
  cgsUnits.Height h(stateSelect=if hIsState then StateSelect.always else 
        StateSelect.never) "Liquid level inside the tank";
  cgsUnits.Volume volume(stateSelect=if volumeIsState then StateSelect.always else 
              StateSelect.never) "Volume of liquid inside the tank";
equation 
  der(volume) = portBottom.volFlow + portTop.volFlow + portMiddle.volFlow;
  volume = tankSection*h;
  der(tankSection) = 0;
  der(hPortMiddle) = 0;
end tank2Ouputs;

tankProcessLAB.componentsLIB.pipe tankProcessLAB.componentsLIB.pipe

Pipe

tankProcessLAB.componentsLIB.pipe

Parameters

TypeNameDefaultDescription
Realeps1e-10 
BooleanFIsStatefalse 
Accelerationg981Gravitatorial acceleration [cm/s2]

Connectors

TypeNameDescription
liqFlowportP 
liqFlowportN 

Modelica definition

model pipe "Pipe" 
  liqFlow portP(volFlow=F);
  liqFlow portN(volFlow=-F);
  
  parameter Real eps=1e-10;
  parameter Boolean FIsState=false;
  parameter cgsUnits.Acceleration g=981 "Gravitatorial acceleration";
  
  cgsUnits.Area a(start=1) "Cross-section of the outlet hole";
protected 
  cgsUnits.VolumeFlowRate F(stateSelect=if FIsState then StateSelect.always else 
              StateSelect.default);
  cgsUnits.Height deltah;
equation 
  F = if noEvent(deltah >= 0) then a*sqrt(2*g*deltah + eps) else -a*sqrt(-2*g*
    deltah + eps);
  deltah = max(0,portP.liqHead) - max(0,portN.liqHead);
  der(a) = 0;
end pipe;

tankProcessLAB.componentsLIB.valve tankProcessLAB.componentsLIB.valve

Valve

tankProcessLAB.componentsLIB.valve

Parameters

TypeNameDefaultDescription
Realeps1e-10 
BooleanFIsStatefalse 
Accelerationg981Gravitatorial acceleration [cm/s2]

Connectors

TypeNameDescription
liqFlowportP 
liqFlowportN 

Modelica definition

model valve "Valve" 
  liqFlow portP(volFlow=F);
  liqFlow portN(volFlow=-F);
  
  parameter Real eps=1e-10;
  parameter Boolean FIsState=false;
  parameter cgsUnits.Acceleration g=981 "Gravitatorial acceleration";
  
  cgsUnits.Adim K(start=1) "Valve state: open(1)/closed(0)";
  cgsUnits.Area S(start=1) "Cross-section of the valve";
  
protected 
  cgsUnits.VolumeFlowRate F;
  cgsUnits.Height deltah;
equation 
  F = if noEvent(deltah >= 0) then K*S*sqrt(2*g*deltah + eps) else -K*S*sqrt(-2
    *g*deltah + eps);
  deltah = portP.liqHead - portN.liqHead;
  der(K) = 0;
  der(S) = 0;
end valve;

tankProcessLAB.componentsLIB.sink tankProcessLAB.componentsLIB.sink

Sink

tankProcessLAB.componentsLIB.sink

Connectors

TypeNameDescription
liqFlowport 

Modelica definition

model sink "Sink" 
  liqFlow port(liqHead=0);
end sink;

tankProcessLAB.componentsLIB.flowSource tankProcessLAB.componentsLIB.flowSource

Flow source

tankProcessLAB.componentsLIB.flowSource

Connectors

TypeNameDescription
liqFlowport 

Modelica definition

model flowSource "Flow source" 
  liqFlow port(volFlow=-flowSetPoint);
  cgsUnits.VolumeFlowRate flowSetPoint;
equation 
  der(flowSetPoint) = 0;
end flowSource;

tankProcessLAB.componentsLIB.pumpTwoWayValve tankProcessLAB.componentsLIB.pumpTwoWayValve

Pump with two way valves

tankProcessLAB.componentsLIB.pumpTwoWayValve

Connectors

TypeNameDescription
liqFlowport1 
liqFlowport2 

Modelica definition

model pumpTwoWayValve "Pump with two way valves" 
  // Salida gamma
  liqFlow port1(volFlow=-gamma*k*v);
  // Salida 1-gamma
  liqFlow port2(volFlow=-(1 - gamma)*k*v);
  cgsUnits.Adim gamma(
    min=0,
    max=1,
    start=0.5);
  cgsUnits.Adim k(start=1);
  cgsUnits.VolumeFlowRate v(start=1);
equation 
  der(gamma) = 0;
  der(k) = 0;
  der(v) = 0;
  
end pumpTwoWayValve;

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