Modelica_StateGraph2.Examples.Applications.ControlledTanks

Control system to fill and empty a two tank system

Package Content

NameDescription
Modelica_StateGraph2.Examples.Applications.ControlledTanks.ControlledTanks1 ControlledTanks1  
Modelica_StateGraph2.Examples.Applications.ControlledTanks.ControlledTanks2 ControlledTanks2  
Modelica_StateGraph2.Examples.Applications.ControlledTanks.Internal Internal Utility components for the examples


Modelica_StateGraph2.Examples.Applications.ControlledTanks.ControlledTanks1 Modelica_StateGraph2.Examples.Applications.ControlledTanks.ControlledTanks1

Modelica_StateGraph2.Examples.Applications.ControlledTanks.ControlledTanks1

Information


With this example the controller of a tank filling/emptying system is demonstrated. This example is from Dressler (2004), see Literature which in turn is based on an example model from Karl Erk Arzen of JGraphCharts.

The basic operation is to fill and empty the two tanks:

  1. Valve 1 is opened and tank 1 is filled.
  2. When tank 1 reaches its fill level limit, valve 1 is closed.
  3. After a waiting time, valve 2 is opened and the fluid flows from tank 1 into tank 2.
  4. When tank 1 is empty, valve 2 is closed.
  5. After a waiting time, valve 3 is opened and the fluid flows out of tank 2
  6. When tank 2 is empty, valve 3 is closed

The above "normal" operation can be influenced by three buttons:

The tank controller has some safeguards to prevent the tanks to overflow even if there are errors in the control system:

The default simulation time is 900 s. The result can be animated. For this, set in Dymola in the command window: "animationSpeed(speed = 50)".

Extends from Internal.PartialControlledTank.

Modelica definition

model ControlledTanks1
  extends Internal.PartialControlledTank;
  Internal.TankController1 tankController(
  limit1=0.9*tank1.height,
  limit2=0.9*tank2.height,
  waitTime=50,
  minLevel=0.01);

  Modelica_StateGraph2.Blocks.Interactive.RadioButtonSource start(
                                                    reset={stop.on,shut.on},
    buttonTimeTable={20,280});
  Modelica_StateGraph2.Blocks.Interactive.RadioButtonSource stop(
                                                   reset={start.on,shut.on},
    buttonTimeTable={220,650});
  Modelica_StateGraph2.Blocks.Interactive.RadioButtonSource shut(
                                                   reset={start.on,stop.on},
    buttonTimeTable={700});
  Modelica.Blocks.Sources.RealExpression level1(y=tank1.level);
  Modelica.Blocks.Sources.RealExpression level2(y=tank2.level);
equation 

connect(level1.y, tankController.level1);
connect(level2.y, tankController.level2);
connect(tankController.valve1, valve1.open);
connect(tankController.valve2, valve2.open);
connect(tankController.valve3, valve3.open);
connect(start.on, tankController.start);
connect(stop.on, tankController.stop);
connect(shut.on, tankController.shut);
end ControlledTanks1;

Modelica_StateGraph2.Examples.Applications.ControlledTanks.ControlledTanks2 Modelica_StateGraph2.Examples.Applications.ControlledTanks.ControlledTanks2

Modelica_StateGraph2.Examples.Applications.ControlledTanks.ControlledTanks2

Information


This is the same model as "ControlledTanks1". The only difference is how the tank controller is implemented:

Extends from Internal.PartialControlledTank.

Modelica definition

model ControlledTanks2
  extends Internal.PartialControlledTank;
  Modelica_StateGraph2.Blocks.Interactive.RadioButtonSource start(
                                                    reset={stop.on,shut.on},
    buttonTimeTable={20,280});
  Modelica_StateGraph2.Blocks.Interactive.RadioButtonSource stop(
                                                   reset={start.on,shut.on},
    buttonTimeTable={220,650});
  Modelica_StateGraph2.Blocks.Interactive.RadioButtonSource shut(
                                                   reset={start.on,stop.on},
    buttonTimeTable={700});
protected 
  Internal.SignalBus bus;
public 
  Internal.TankController2 tankController(
  limit1=0.9*tank1.height,
  limit2=0.9*tank2.height,
  minLevel=0.01,
  waitTime=50);
  Modelica.Blocks.Sources.RealExpression level1(y=tank1.level);
  Modelica.Blocks.Sources.RealExpression level2(y=tank2.level);
equation 
  connect(level1.y, bus.level1);

  connect(level2.y, bus.level2);
connect(shut.on, bus.shut);
connect(stop.on, bus.stop);
connect(start.on, bus.start);
connect(valve1.open, bus.valve1);
connect(valve2.open, bus.valve2);
connect(valve3.open, bus.valve3);

connect(tankController.bus, bus);
end ControlledTanks2;

Automatically generated Fri Nov 12 17:26:50 2010.