Skip to content
LIBRARY
Examples.DoubleIntegratorExamplePlant.md

Examples.DoubleIntegratorExamplePlant ​

Double-integrator plant used by the examples with several parallel closed loops (force in, position out), with an additive load disturbance at its input, together with the sampling plumbing one loop of the example needs — a zero-order hold on the incoming control, a sampler on the position and the periodic clock (0.1 s) that drives the discrete-time controller connected to it.

Usage ​

MPCComponents.Examples.DoubleIntegratorExamplePlant()

Connectors ​

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

  • d - 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)

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

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

Behavior ​

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

Source ​

dyad
"""
Double-integrator plant used by the examples with several parallel closed loops (force in,
position out), with an
additive load disturbance at its input, together with the sampling plumbing one loop of the
example needs — a zero-order hold on the incoming control, a sampler on the position and the
periodic clock (0.1 s) that drives the discrete-time controller connected to it.
"""
component DoubleIntegratorExamplePlant
  "Control input (clocked); held by the internal zero-order hold"
  u = RealInput() {
    "Dyad": {
      "placement": {"diagram": {"x1": -100, "y1": 450, "x2": 0, "y2": 550, "rot": 0}}
    }
  }
  "Load disturbance added to the held control at the plant input"
  d = RealInput() {
    "Dyad": {
      "placement": {"diagram": {"x1": 550, "y1": -100, "x2": 450, "y2": 0, "rot": 270}}
    }
  }
  "Position (continuous)"
  y = RealOutput() {
    "Dyad": {
      "placement": {"diagram": {"x1": 1000, "y1": 200, "x2": 1100, "y2": 300, "rot": 0}}
    }
  }
  "Sampled position (clocked by the internal clock); connect to the controller measurement input"
  ym = RealOutput() {
    "Dyad": {
      "placement": {"diagram": {"x1": 1000, "y1": 450, "x2": 1100, "y2": 550, "rot": 0}}
    }
  }
  "The held control acting on the plant (continuous)"
  uh = RealOutput() {
    "Dyad": {
      "placement": {"diagram": {"x1": 1000, "y1": 700, "x2": 1100, "y2": 800, "rot": 0}}
    }
  }
  clock = DiscreteComponents.PeriodicClock(dt = 0.1) {
    "Dyad": {"placement": {"diagram": {"x1": 900, "x2": 800, "y1": 450, "y2": 550}}}
  }
  zoh = DiscreteComponents.ZeroOrderHold() {
    "Dyad": {"placement": {"diagram": {"x1": 100, "x2": 200, "y1": 450, "y2": 550}}}
  }
  dadd = BlockComponents.Math.Add() {
    "Dyad": {"placement": {"diagram": {"x1": 300, "x2": 400, "y1": 520, "y2": 420}}}
  }
  vel = BlockComponents.Continuous.Integrator() {
    "Dyad": {"placement": {"diagram": {"x1": 480, "x2": 580, "y1": 420, "y2": 520}}}
  }
  pos = BlockComponents.Continuous.Integrator() {
    "Dyad": {"placement": {"diagram": {"x1": 640, "x2": 740, "y1": 420, "y2": 520}}}
  }
  s = DiscreteComponents.Sampler() {
    "Dyad": {"placement": {"diagram": {"x1": 800, "x2": 900, "y1": 560, "y2": 660}}}
  }
relations
  connect(u, zoh.u) {}
  connect(zoh.y, dadd.u1, uh) {
    "Dyad": {
      "edges": [
        {"S": 1, "M": [], "E": -1},
        {"S": -1, "M": [], "E": 2},
        {"S": 3, "M": [{"x": 270, "y": 750}], "E": -1}
      ],
      "junctions": [{"x": 270, "y": 500}],
      "path": {}
    }
  }
  connect(d, dadd.u2) {
    "Dyad": {
      "edges": [
        {
          "S": 1,
          "M": [{"x": 500, "y": 120}, {"x": 260, "y": 120}, {"x": 260, "y": 440}],
          "E": 2
        }
      ],
      "path": {}
    }
  }
  connect(dadd.y, vel.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "path": {}}}
  connect(vel.y, pos.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "path": {}}}
  connect(pos.y, s.u, y) {
    "Dyad": {
      "edges": [
        {"S": 1, "M": [], "E": -1},
        {"S": -1, "M": [{"x": 770, "y": 470}, {"x": 770, "y": 610}], "E": 2},
        {"S": 3, "M": [{"x": 770, "y": 250}], "E": -1}
      ],
      "junctions": [{"x": 770, "y": 470}],
      "path": {}
    }
  }
  connect(s.y, ym, clock.y) {
    "Dyad": {
      "edges": [
        {"S": 1, "M": [], "E": -1},
        {"S": -1, "M": [{"x": 1010, "y": 610}, {"x": 1010, "y": 500}], "E": 2},
        {"S": 3, "M": [{"x": 960, "y": 500}], "E": -1}
      ],
      "junctions": [{"x": 960, "y": 610}],
      "path": {}
    }
  }
metadata {
  "Dyad": {
    "icons": {"default": "dyad://MPCComponents/DoubleIntegratorExamplePlant.svg"},
    "doc": {"behavior": false}
  }
}
end
Flattened Source
dyad
"""
Double-integrator plant used by the examples with several parallel closed loops (force in,
position out), with an
additive load disturbance at its input, together with the sampling plumbing one loop of the
example needs — a zero-order hold on the incoming control, a sampler on the position and the
periodic clock (0.1 s) that drives the discrete-time controller connected to it.
"""
component DoubleIntegratorExamplePlant
  "Control input (clocked); held by the internal zero-order hold"
  u = RealInput() {
    "Dyad": {
      "placement": {"diagram": {"x1": -100, "y1": 450, "x2": 0, "y2": 550, "rot": 0}}
    }
  }
  "Load disturbance added to the held control at the plant input"
  d = RealInput() {
    "Dyad": {
      "placement": {"diagram": {"x1": 550, "y1": -100, "x2": 450, "y2": 0, "rot": 270}}
    }
  }
  "Position (continuous)"
  y = RealOutput() {
    "Dyad": {
      "placement": {"diagram": {"x1": 1000, "y1": 200, "x2": 1100, "y2": 300, "rot": 0}}
    }
  }
  "Sampled position (clocked by the internal clock); connect to the controller measurement input"
  ym = RealOutput() {
    "Dyad": {
      "placement": {"diagram": {"x1": 1000, "y1": 450, "x2": 1100, "y2": 550, "rot": 0}}
    }
  }
  "The held control acting on the plant (continuous)"
  uh = RealOutput() {
    "Dyad": {
      "placement": {"diagram": {"x1": 1000, "y1": 700, "x2": 1100, "y2": 800, "rot": 0}}
    }
  }
  clock = DiscreteComponents.PeriodicClock(dt = 0.1) {
    "Dyad": {"placement": {"diagram": {"x1": 900, "x2": 800, "y1": 450, "y2": 550}}}
  }
  zoh = DiscreteComponents.ZeroOrderHold() {
    "Dyad": {"placement": {"diagram": {"x1": 100, "x2": 200, "y1": 450, "y2": 550}}}
  }
  dadd = BlockComponents.Math.Add() {
    "Dyad": {"placement": {"diagram": {"x1": 300, "x2": 400, "y1": 520, "y2": 420}}}
  }
  vel = BlockComponents.Continuous.Integrator() {
    "Dyad": {"placement": {"diagram": {"x1": 480, "x2": 580, "y1": 420, "y2": 520}}}
  }
  pos = BlockComponents.Continuous.Integrator() {
    "Dyad": {"placement": {"diagram": {"x1": 640, "x2": 740, "y1": 420, "y2": 520}}}
  }
  s = DiscreteComponents.Sampler() {
    "Dyad": {"placement": {"diagram": {"x1": 800, "x2": 900, "y1": 560, "y2": 660}}}
  }
relations
  connect(u, zoh.u) {}
  connect(zoh.y, dadd.u1, uh) {
    "Dyad": {
      "edges": [
        {"S": 1, "M": [], "E": -1},
        {"S": -1, "M": [], "E": 2},
        {"S": 3, "M": [{"x": 270, "y": 750}], "E": -1}
      ],
      "junctions": [{"x": 270, "y": 500}],
      "path": {}
    }
  }
  connect(d, dadd.u2) {
    "Dyad": {
      "edges": [
        {
          "S": 1,
          "M": [{"x": 500, "y": 120}, {"x": 260, "y": 120}, {"x": 260, "y": 440}],
          "E": 2
        }
      ],
      "path": {}
    }
  }
  connect(dadd.y, vel.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "path": {}}}
  connect(vel.y, pos.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "path": {}}}
  connect(pos.y, s.u, y) {
    "Dyad": {
      "edges": [
        {"S": 1, "M": [], "E": -1},
        {"S": -1, "M": [{"x": 770, "y": 470}, {"x": 770, "y": 610}], "E": 2},
        {"S": 3, "M": [{"x": 770, "y": 250}], "E": -1}
      ],
      "junctions": [{"x": 770, "y": 470}],
      "path": {}
    }
  }
  connect(s.y, ym, clock.y) {
    "Dyad": {
      "edges": [
        {"S": 1, "M": [], "E": -1},
        {"S": -1, "M": [{"x": 1010, "y": 610}, {"x": 1010, "y": 500}], "E": 2},
        {"S": 3, "M": [{"x": 960, "y": 500}], "E": -1}
      ],
      "junctions": [{"x": 960, "y": 610}],
      "path": {}
    }
  }
metadata {
  "Dyad": {
    "icons": {"default": "dyad://MPCComponents/DoubleIntegratorExamplePlant.svg"},
    "doc": {"behavior": false}
  }
}
end


Test Cases ​

No test cases defined.

  • Examples

  • Experiments

  • Analyses