Modelica.Fluid.Examples.ControlledTankSystem.Utilities

Information

Extends from Modelica.Icons.Package (Icon for standard packages).

Package Content

NameDescription
Modelica.Fluid.Examples.ControlledTankSystem.Utilities.TankController TankController Controller for tank system
Modelica.Fluid.Examples.ControlledTankSystem.Utilities.NormalOperation NormalOperation Normal operation of tank system (button start pressed)
Modelica.Fluid.Examples.ControlledTankSystem.Utilities.RadioButton RadioButton Button that sets its output to true when pressed and is reset when an element of 'reset' becomes true


Modelica.Fluid.Examples.ControlledTankSystem.Utilities.TankController Modelica.Fluid.Examples.ControlledTankSystem.Utilities.TankController

Controller for tank system

Modelica.Fluid.Examples.ControlledTankSystem.Utilities.TankController

Information

Extends from Modelica.StateGraph.Interfaces.PartialStateGraphIcon (Icon for a StateGraph object).

Parameters

TypeNameDefaultDescription
HeightmaxLevel Fill level of tank 1 [m]
HeightminLevel Lowest level of tank 1 and 2 [m]
TimewaitTime Wait time, between operations [s]

Connectors

TypeNameDescription
input BooleanInputstart 
input BooleanInputstop 
input BooleanInputshut 
input RealInputlevel1 
input RealInputlevel2 
output BooleanOutputvalve1 
output BooleanOutputvalve2 
output BooleanOutputvalve3 

Modelica definition

model TankController "Controller for tank system"
      extends Modelica.StateGraph.Interfaces.PartialStateGraphIcon;
  parameter SI.Height maxLevel "Fill level of tank 1";
  parameter SI.Height minLevel "Lowest level of tank 1 and 2";
  parameter SI.Time waitTime "Wait time, between operations";

  Modelica.StateGraph.InitialStep s1(nIn=2);
  Modelica.Fluid.Examples.ControlledTankSystem.Utilities.NormalOperation
    normal(
    maxLevel=maxLevel,
    minLevel=minLevel,
    waitTime=waitTime);
  Modelica.StateGraph.Transition T1(condition=start);
  Modelica.StateGraph.Transition T2(condition=level2 < minLevel);
  Modelica.StateGraph.Transition T3(condition=stop);
  Modelica.StateGraph.Step s2(nOut=2);
  Modelica.StateGraph.Transition T4(condition=start);
  Modelica.StateGraph.Transition T5(condition=shut);
  Modelica.StateGraph.Step emptyTanks;
  Modelica.StateGraph.Transition T6(condition=level1 < minLevel and level2
         < minLevel);
  Modelica.Blocks.Interfaces.BooleanInput start;
  Modelica.Blocks.Interfaces.BooleanInput stop;
  Modelica.Blocks.Interfaces.BooleanInput shut;
  Modelica.Blocks.Interfaces.RealInput level1;
  Modelica.Blocks.Interfaces.RealInput level2;
  Modelica.Blocks.Interfaces.BooleanOutput valve1;
  Modelica.Blocks.Interfaces.BooleanOutput valve2;
  Modelica.Blocks.Interfaces.BooleanOutput valve3;
  Modelica.Blocks.Sources.BooleanExpression setValve1(y=normal.fillTank1.
        active);
  Modelica.Blocks.Sources.BooleanExpression setValve2(y=normal.fillTank2.
        active or emptyTanks.active and level1 > minLevel);
  Modelica.Blocks.Sources.BooleanExpression setValve3(y=normal.emptyTank2.
        active or emptyTanks.active and level2 > minLevel);
equation 

  connect(s1.outPort[1], T1.inPort);
  connect(T1.outPort, normal.inPort);
  connect(normal.outPort, T2.inPort);
  connect(T5.outPort, emptyTanks.inPort[1]);
  connect(emptyTanks.outPort[1], T6.inPort);
  connect(setValve1.y, valve1);
  connect(setValve2.y, valve2);
  connect(setValve3.y, valve3);
  connect(normal.suspend[1], T3.inPort);
  connect(T3.outPort, s2.inPort[1]);
  connect(level1, normal.level1);
  connect(s2.outPort[1], T5.inPort);
  connect(s2.outPort[2], T4.inPort);
  connect(T2.outPort, s1.inPort[1]);
  connect(T6.outPort, s1.inPort[2]);
  connect(T4.outPort, normal.resume[1]);
end TankController;

Modelica.Fluid.Examples.ControlledTankSystem.Utilities.NormalOperation Modelica.Fluid.Examples.ControlledTankSystem.Utilities.NormalOperation

Normal operation of tank system (button start pressed)

Modelica.Fluid.Examples.ControlledTankSystem.Utilities.NormalOperation

Information

Extends from Modelica.StateGraph.PartialCompositeStep (Superclass of a subgraph, i.e., a composite step that has internally a StateGraph).

Parameters

TypeNameDefaultDescription
HeightmaxLevel Fill level of tank 1 [m]
HeightminLevel Lowest level of tank 1 and 2 [m]
TimewaitTime Wait time between operations [s]
Exception connections
IntegernSuspend1Number of suspend ports
IntegernResume1Number of resume ports

Connectors

TypeNameDescription
Step_ininPort 
Step_outoutPort 
CompositeStep_suspendsuspend[nSuspend] 
CompositeStep_resumeresume[nResume] 
input RealInputlevel1 

Modelica definition

model NormalOperation 
  "Normal operation of tank system (button start pressed)"
      extends Modelica.StateGraph.PartialCompositeStep;
  parameter SI.Height maxLevel "Fill level of tank 1";
  parameter SI.Height minLevel "Lowest level of tank 1 and 2";
  parameter SI.Time waitTime "Wait time between operations";

  Modelica.Blocks.Interfaces.RealInput level1;
  Modelica.StateGraph.Step fillTank1;
  Modelica.StateGraph.Transition T1(condition=level1 > maxLevel);
  Modelica.StateGraph.Step fillTank2;
  Modelica.StateGraph.Transition T3(condition=level1 < minLevel);
  Modelica.StateGraph.Step emptyTank2;
  Modelica.StateGraph.Step wait1;
  Modelica.StateGraph.Transition T2(enableTimer=true, waitTime=waitTime);
  Modelica.StateGraph.Step wait2;
  Modelica.StateGraph.Transition T4(enableTimer=true, waitTime=waitTime);
equation 
  connect(fillTank1.inPort[1], inPort);
  connect(fillTank1.outPort[1], T1.inPort);
  connect(fillTank2.outPort[1], T3.inPort);
  connect(emptyTank2.outPort[1], outPort);
  connect(wait1.outPort[1], T2.inPort);
  connect(T2.outPort, fillTank2.inPort[1]);
  connect(T1.outPort, wait1.inPort[1]);
  connect(wait2.outPort[1], T4.inPort);
  connect(T3.outPort, wait2.inPort[1]);
  connect(T4.outPort,emptyTank2.inPort[1]);
end NormalOperation;

Modelica.Fluid.Examples.ControlledTankSystem.Utilities.RadioButton Modelica.Fluid.Examples.ControlledTankSystem.Utilities.RadioButton

Button that sets its output to true when pressed and is reset when an element of 'reset' becomes true

Modelica.Fluid.Examples.ControlledTankSystem.Utilities.RadioButton

Parameters

TypeNameDefaultDescription
TimebuttonTimeTable[:] Time instants where button is pressend [s]
Time varying expressions
Booleanreset[:]{false}Reset button to false, if an element of reset becomes true

Connectors

TypeNameDescription
output BooleanOutputon 

Modelica definition

block RadioButton 
  "Button that sets its output to true when pressed and is reset when an element of 'reset' becomes true"

  parameter Modelica.SIunits.Time buttonTimeTable[:] 
    "Time instants where button is pressend";
  input Boolean reset[:]={false} 
    "Reset button to false, if an element of reset becomes true";

  Modelica.Blocks.Interfaces.BooleanOutput on;
protected 
  Modelica.Blocks.Sources.BooleanTable table(table=buttonTimeTable);
algorithm 
  when pre(reset) then
     on := false;
  end when;

  when change(table.y) then
     on := true;
  end when;
end RadioButton;

Automatically generated Fri Nov 12 16:30:59 2010.