Name | Description |
---|---|
TankController | Controller for tank system |
MakeProduct | State machine defining the time instants when to fill or empty a tank |
inflow1 | Inflow connector (this is a copy from Isolde Dressler's master thesis project) |
inflow2 | Inflow connector (this is a copy from Isolde Dressler's master thesis project) |
outflow1 | Outflow connector (this is a copy from Isolde Dressler's master thesis project) |
outflow2 | Outflow connector (this is a copy from Isolde Dressler's master thesis project) |
valve | Simple valve model (this is a copy from Isolde Dressler's master thesis project) |
Tank | Simple tank model (this is a copy from Isolde Dressler's master thesis project) |
Source | Simple source model (this is a copy from Isolde Dressler's master thesis project) |
CompositeStep | State machine demonstrating a composite step (used in StateGraph.Examples.ShowCompositeStep) |
CompositeStep1 | Composite step used to demonstrate exceptions (in StateGraph.Examples.ShowExceptions) |
CompositeStep2 | Composite step used to demonstrate exceptions (in StateGraph.Examples.ShowExceptions) |
Type | Name | Default | Description |
---|---|---|---|
SetRealParameter | limit | 0.98 | Limit level of tank 1 |
SetRealParameter | waitTime | 3 | Wait time |
Type | Name | Description |
---|---|---|
input BooleanInput | start | |
input BooleanInput | stop | |
input BooleanInput | shut | |
input RealInput | level1 | |
input RealInput | level2 | |
output BooleanOutput | valve1 | |
output BooleanOutput | valve2 | |
output BooleanOutput | valve3 |
model TankController "Controller for tank system" extends StateGraph.Interfaces.PartialStateGraphIcon;parameter Temporary.SetRealParameter limit=0.98 "Limit level of tank 1"; parameter Temporary.SetRealParameter waitTime=3 "Wait time"; InitialStep s1(nIn=2); MakeProduct makeProduct(limit=limit, waitTime=waitTime); Transition T1(condition=start); Transition T2(condition=level2<0.001); Transition T3(condition=stop); Step s2(nOut=2); Transition T4(condition=start); Transition T5(condition=shut); Step emptyTanks; Transition T6(condition=level1+level2<0.001); 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=makeProduct.fillTank1.active); Modelica.Blocks.Sources.BooleanExpression setValve2(y=makeProduct.fillTank2.active or emptyTanks.active); Modelica.Blocks.Sources.BooleanExpression setValve3(y=makeProduct.emptyTank2.active or emptyTanks.active); equationconnect(s1.outPort[1], T1.inPort); connect(T1.outPort, makeProduct.inPort); connect(makeProduct.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(makeProduct.suspend[1], T3.inPort); connect(T3.outPort, s2.inPort[1]); connect(T4.outPort, makeProduct.resume[1]); connect(level1, makeProduct.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]); end TankController;
Type | Name | Default | Description |
---|---|---|---|
SetRealParameter | limit | 0.98 | Limit level of tank 1 |
SetRealParameter | waitTime | 3 | Wait time |
Exception connections | |||
Integer | nSuspend | 1 | Number of suspend ports |
Integer | nResume | 1 | Number of resume ports |
Type | Name | Description |
---|---|---|
Step_in | inPort | |
Step_out | outPort | |
CompositeStep_suspend | suspend[nSuspend] | |
CompositeStep_resume | resume[nResume] | |
input RealInput | level1 |
model MakeProduct "State machine defining the time instants when to fill or empty a tank" extends StateGraph.PartialCompositeStep;parameter StateGraph.Temporary.SetRealParameter limit=0.98 "Limit level of tank 1"; parameter StateGraph.Temporary.SetRealParameter waitTime=3 "Wait time"; Modelica.Blocks.Interfaces.RealInput level1; Step fillTank1; Transition T1(condition=level1 > limit); Step fillTank2; Transition T3(condition=level1 < 0.001); Step emptyTank2; Step wait1; Transition T2(enableTimer=true, waitTime=waitTime); Step wait2; Transition T4(enableTimer=true, waitTime=waitTime); equationconnect(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 MakeProduct;
Type | Name | Description |
---|---|---|
input VolumeFlowRate | Fi | inflow [m3/s] |
connector inflow1 "Inflow connector (this is a copy from Isolde Dressler's master thesis project)" import Units = Modelica.SIunits; input Units.VolumeFlowRate Fi "inflow";end inflow1;
Type | Name | Description |
---|---|---|
output VolumeFlowRate | Fi | inflow [m3/s] |
connector inflow2 "Inflow connector (this is a copy from Isolde Dressler's master thesis project)" import Units = Modelica.SIunits; output Units.VolumeFlowRate Fi "inflow";end inflow2;
Type | Name | Description |
---|---|---|
output VolumeFlowRate | Fo | outflow [m3/s] |
input Boolean | open | valve open |
connector outflow1 "Outflow connector (this is a copy from Isolde Dressler's master thesis project)" import Units = Modelica.SIunits; output Units.VolumeFlowRate Fo "outflow"; input Boolean open "valve open";end outflow1;
Type | Name | Description |
---|---|---|
input VolumeFlowRate | Fo | outflow [m3/s] |
output Boolean | open | valve open |
connector outflow2 "Outflow connector (this is a copy from Isolde Dressler's master thesis project)" import Units = Modelica.SIunits; input Units.VolumeFlowRate Fo "outflow"; output Boolean open "valve open";end outflow2;
Type | Name | Description |
---|---|---|
input BooleanInput | valveControl | |
inflow2 | inflow1 | |
outflow2 | outflow1 |
model valve "Simple valve model (this is a copy from Isolde Dressler's master thesis project)"Modelica.Blocks.Interfaces.BooleanInput valveControl; Modelica.StateGraph.Examples.Utilities.inflow2 inflow1; Modelica.StateGraph.Examples.Utilities.outflow2 outflow1; equation outflow1.Fo = inflow1.Fi; outflow1.open = valveControl;end valve;
Type | Name | Default | Description |
---|---|---|---|
Real | A | 1 | Ground area of tank in m^2 |
Real | a | 0.2 | Area of drain hole in m^2 |
Real | hmax | 1 | Max height of tank in m |
Type | Name | Description |
---|---|---|
output RealOutput | levelSensor | |
inflow1 | inflow1 | |
outflow1 | outflow1 |
model Tank "Simple tank model (this is a copy from Isolde Dressler's master thesis project)"Modelica.Blocks.Interfaces.RealOutput levelSensor; Modelica.StateGraph.Examples.Utilities.inflow1 inflow1; Modelica.StateGraph.Examples.Utilities.outflow1 outflow1; Real level "Tank level in % of max height"; parameter Real A=1 "Ground area of tank in m^2"; parameter Real a=0.2 "Area of drain hole in m^2"; parameter Real hmax=1 "Max height of tank in m"; constant Real g=Modelica.Constants.g_n; equation der(level) = (inflow1.Fi - outflow1.Fo)/(hmax*A); if outflow1.open then outflow1.Fo = sqrt(max(0,2*g*hmax*level))*a; else outflow1.Fo = 0; end if; levelSensor = level;end Tank;
Type | Name | Default | Description |
---|---|---|---|
Real | maxflow | 1 | maximal flow out of source |
Type | Name | Description |
---|---|---|
outflow1 | outflow1 |
model Source "Simple source model (this is a copy from Isolde Dressler's master thesis project)"Modelica.StateGraph.Examples.Utilities.outflow1 outflow1; parameter Real maxflow=1 "maximal flow out of source"; equation if outflow1.open then outflow1.Fo = maxflow; else outflow1.Fo = 0; end if;end Source;
Type | Name | Default | Description |
---|---|---|---|
Exception connections | |||
Integer | nSuspend | 1 | Number of suspend ports |
Integer | nResume | 1 | Number of resume ports |
Type | Name | Description |
---|---|---|
Step_in | inPort | |
Step_out | outPort | |
CompositeStep_suspend | suspend[nSuspend] | |
CompositeStep_resume | resume[nResume] |
model CompositeStep "State machine demonstrating a composite step (used in StateGraph.Examples.ShowCompositeStep)" extends StateGraph.PartialCompositeStep;Transition transition3(enableTimer=true, waitTime=1); Transition transition4(enableTimer=true, waitTime=1); Step step3; Step step4; Transition transition5(enableTimer=true, waitTime=2); Transition transition6(enableTimer=true, waitTime=2); Transition transition4a(enableTimer=true, waitTime=1); Step step4a; Transition transition6a(enableTimer=true, waitTime=2); Step initStep; Step exitStep; Alternative Alternative1(nBranches=3); equationconnect(transition3.outPort, step3.inPort[1]); connect(step3.outPort[1], transition5.inPort); connect(transition4.outPort, step4.inPort[1]); connect(step4.outPort[1], transition6.inPort); connect(transition4a.outPort, step4a.inPort[1]); connect(step4a.outPort[1], transition6a.inPort); connect(initStep.inPort[1], inPort); connect(exitStep.outPort[1], outPort); connect(initStep.outPort[1], Alternative1.inPort); connect(Alternative1.outPort, exitStep.inPort[1]); connect(transition3.inPort, Alternative1.split[1]); connect(transition4.inPort, Alternative1.split[2]); connect(transition4a.inPort, Alternative1.split[3]); connect(transition5.outPort, Alternative1.join[1]); connect(transition6.outPort, Alternative1.join[2]); connect(transition6a.outPort, Alternative1.join[3]); end CompositeStep;
Type | Name | Default | Description |
---|---|---|---|
Exception connections | |||
Integer | nSuspend | 1 | Number of suspend ports |
Integer | nResume | 1 | Number of resume ports |
Type | Name | Description |
---|---|---|
Step_in | inPort | |
Step_out | outPort | |
CompositeStep_suspend | suspend[nSuspend] | |
CompositeStep_resume | resume[nResume] |
model CompositeStep1 "Composite step used to demonstrate exceptions (in StateGraph.Examples.ShowExceptions)" extends PartialCompositeStep;Transition transition1( enableTimer=false, waitTime=0, condition=time > 8); Step initStep; Step exitStep; CompositeStep2 compositeStep11(waitTime=3); CompositeStep2 compositeStep12(waitTime=2); Transition transition2( condition=time > 4, enableTimer=false, waitTime=0); Transition transition3(enableTimer=false, waitTime=0); Transition transition4(enableTimer=false, waitTime=0); Alternative Alternative1; equationconnect(exitStep.outPort[1], outPort); connect(initStep.inPort[1], inPort); connect(transition1.outPort, compositeStep11.inPort); connect(transition2.outPort, compositeStep12.inPort); connect(compositeStep11.outPort, transition3.inPort); connect(compositeStep12.outPort, transition4.inPort); connect(initStep.outPort[1], Alternative1.inPort); connect(Alternative1.outPort, exitStep.inPort[1]); connect(transition1.inPort, Alternative1.split[1]); connect(transition2.inPort, Alternative1.split[2]); connect(transition3.outPort, Alternative1.join[1]); connect(transition4.outPort, Alternative1.join[2]); end CompositeStep1;
Type | Name | Default | Description |
---|---|---|---|
SetRealParameter | waitTime | 2 | waiting time in this composite step |
Exception connections | |||
Integer | nSuspend | 1 | Number of suspend ports |
Integer | nResume | 1 | Number of resume ports |
Type | Name | Description |
---|---|---|
Step_in | inPort | |
Step_out | outPort | |
CompositeStep_suspend | suspend[nSuspend] | |
CompositeStep_resume | resume[nResume] |
model CompositeStep2 "Composite step used to demonstrate exceptions (in StateGraph.Examples.ShowExceptions)" extends PartialCompositeStep;Transition transition(enableTimer=true, waitTime=waitTime); Step initStep; Step exitStep; parameter Temporary.SetRealParameter waitTime=2 "waiting time in this composite step"; equationconnect(exitStep.outPort[1], outPort); connect(initStep.inPort[1], inPort); connect(initStep.outPort[1], transition.inPort); connect(transition.outPort, exitStep.inPort[1]); end CompositeStep2;