Skip to content
LIBRARY
Examples.TankPlant.md

Examples.TankPlant ​

Tank whose outflow depends on the level, der(h) = -c*sqrt(h) + b*u, with the inflow u as input and the level as output: the linearized model depends on the operating level, which makes the tank a plant for a gain-scheduled controller (LinearMPCScheduledExample).

Usage ​

MPCComponents.Examples.TankPlant(c=0.5, b=1.0, h0=0.5)

Parameters: ​

NameDescriptionUnitsDefault value
cOutflow coefficient–0.5
bInflow gain–1.0
h0Initial level–0.5

Connectors ​

  • u - This connector represents a real signal as an input to a component (RealInput)

  • y - This connector represents a real signal as an output from a component (RealOutput)

Variables ​

NameDescriptionUnits
hLevel–

Behavior ​

Behavior of this component cannot be rendered because it includes path variables.

Source ​

dyad
"""
Tank whose outflow depends on the level, `der(h) = -c*sqrt(h) + b*u`, with the inflow `u` as input
and the level as output: the linearized model depends on the operating level, which makes the tank
a plant for a gain-scheduled controller (`LinearMPCScheduledExample`).
"""
component TankPlant
  "Inflow"
  u = RealInput() {
    "Dyad": {"placement": {"diagram": {"x1": -100, "y1": 450, "x2": 0, "y2": 550}}}
  }
  "Level"
  y = RealOutput() {
    "Dyad": {"placement": {"diagram": {"x1": 1000, "y1": 450, "x2": 1100, "y2": 550}}}
  }
  "Outflow coefficient"
  parameter c::Real = 0.5
  "Inflow gain"
  parameter b::Real = 1.0
  "Initial level"
  parameter h0::Real = 0.5
  "Level"
  variable h::Real
relations
  initial h = h0
  der(h) = -c * sqrt(max(h, 0.0)) + b * u
  y = h
metadata {
  "Dyad": {
    "icons": {"default": "dyad://MPCComponents/TankPlant.svg"},
    "doc": {"behavior": false}
  }
}
end
Flattened Source
dyad
"""
Tank whose outflow depends on the level, `der(h) = -c*sqrt(h) + b*u`, with the inflow `u` as input
and the level as output: the linearized model depends on the operating level, which makes the tank
a plant for a gain-scheduled controller (`LinearMPCScheduledExample`).
"""
component TankPlant
  "Inflow"
  u = RealInput() {
    "Dyad": {"placement": {"diagram": {"x1": -100, "y1": 450, "x2": 0, "y2": 550}}}
  }
  "Level"
  y = RealOutput() {
    "Dyad": {"placement": {"diagram": {"x1": 1000, "y1": 450, "x2": 1100, "y2": 550}}}
  }
  "Outflow coefficient"
  parameter c::Real = 0.5
  "Inflow gain"
  parameter b::Real = 1.0
  "Initial level"
  parameter h0::Real = 0.5
  "Level"
  variable h::Real
relations
  initial h = h0
  der(h) = -c * sqrt(max(h, 0.0)) + b * u
  y = h
metadata {
  "Dyad": {
    "icons": {"default": "dyad://MPCComponents/TankPlant.svg"},
    "doc": {"behavior": false}
  }
}
end


Test Cases ​

No test cases defined.

  • Examples

  • Experiments

  • Analyses