Skip to content
LIBRARY
Examples.ACADOSPendulumPlant.md

Examples.ACADOSPendulumPlant ​

Damped pendulum driven by a torque, the plant of the ACADOSMPC examples:

The angle and the angular velocity are outputs.

Usage ​

MPCComponents.Examples.ACADOSPendulumPlant(g=9.81, l=1.0, c=0.1, m=1.0, theta0=0.0, omega0=0.0)

Parameters: ​

NameDescriptionUnitsDefault value
gGravitational acceleration–9.81
lLength–1.0
cDamping coefficient–0.1
mMass–1.0
theta0Initial angle–0.0
omega0Initial angular velocity–0.0

Connectors ​

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

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

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

Variables ​

NameDescriptionUnits
thAngle–
omAngular velocity–

Behavior ​

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

Source ​

dyad
"""
Damped pendulum driven by a torque, the plant of the `ACADOSMPC` examples:

```math
\\ddot\\theta = -\\frac{g}{l} \\sin\\theta - c \\dot\\theta + \\frac{\\tau}{m l^2}
```

The angle and the angular velocity are outputs.
"""
component ACADOSPendulumPlant
  "Torque"
  tau = RealInput() {"Dyad": {"placement": {"icon": {"x1": -100, "y1": 450, "x2": 0, "y2": 550}}}}
  "Angle"
  theta = RealOutput() {
    "Dyad": {"placement": {"icon": {"x1": 1000, "y1": 300, "x2": 1100, "y2": 400}}}
  }
  "Angular velocity"
  omega = RealOutput() {
    "Dyad": {"placement": {"icon": {"x1": 1000, "y1": 600, "x2": 1100, "y2": 700}}}
  }
  "Gravitational acceleration"
  parameter g::Real = 9.81
  "Length"
  parameter l::Real = 1.0
  "Damping coefficient"
  parameter c::Real = 0.1
  "Mass"
  parameter m::Real = 1.0
  "Initial angle"
  parameter theta0::Real = 0.0
  "Initial angular velocity"
  parameter omega0::Real = 0.0
  "Angle"
  variable th::Real
  "Angular velocity"
  variable om::Real
relations
  initial th = theta0
  initial om = omega0
  der(th) = om
  der(om) = -(g / l) * sin(th) - c * om + tau / (m * l ^ 2)
  theta = th
  omega = om
metadata {
  "Dyad": {
    "icons": {"default": "dyad://MPCComponents/ACADOSPendulumPlant.svg"},
    "doc": {"behavior": false}
  }
}
end
Flattened Source
dyad
"""
Damped pendulum driven by a torque, the plant of the `ACADOSMPC` examples:

```math
\\ddot\\theta = -\\frac{g}{l} \\sin\\theta - c \\dot\\theta + \\frac{\\tau}{m l^2}
```

The angle and the angular velocity are outputs.
"""
component ACADOSPendulumPlant
  "Torque"
  tau = RealInput() {"Dyad": {"placement": {"icon": {"x1": -100, "y1": 450, "x2": 0, "y2": 550}}}}
  "Angle"
  theta = RealOutput() {
    "Dyad": {"placement": {"icon": {"x1": 1000, "y1": 300, "x2": 1100, "y2": 400}}}
  }
  "Angular velocity"
  omega = RealOutput() {
    "Dyad": {"placement": {"icon": {"x1": 1000, "y1": 600, "x2": 1100, "y2": 700}}}
  }
  "Gravitational acceleration"
  parameter g::Real = 9.81
  "Length"
  parameter l::Real = 1.0
  "Damping coefficient"
  parameter c::Real = 0.1
  "Mass"
  parameter m::Real = 1.0
  "Initial angle"
  parameter theta0::Real = 0.0
  "Initial angular velocity"
  parameter omega0::Real = 0.0
  "Angle"
  variable th::Real
  "Angular velocity"
  variable om::Real
relations
  initial th = theta0
  initial om = omega0
  der(th) = om
  der(om) = -(g / l) * sin(th) - c * om + tau / (m * l ^ 2)
  theta = th
  omega = om
metadata {
  "Dyad": {
    "icons": {"default": "dyad://MPCComponents/ACADOSPendulumPlant.svg"},
    "doc": {"behavior": false}
  }
}
end


Test Cases ​

No test cases defined.

  • Examples

  • Experiments

  • Analyses