Skip to content
Integrator.md

Integrator

Integrates the input signal with optional gain factor.

An integrator that computes the time integral of the input signal multiplied by a gain factor. The block implements the transfer function 1/s scaled by gain k.

y(t)=t0tku(τ)dτ+x0

Outputs y = ∫k*u dt, corresponding to the transfer function \frac{1}{s}.

This component extends from SISO

Usage

BlockComponents.Integrator(x0=0, k=1.0)

Parameters:

NameDescriptionUnitsDefault value
x0Initial value of the integrator state at simulation start0
kGain factor applied to the input before integration1

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
xInternal state variable that stores the integrated value

Behavior

dx(t)dt=ku(t)y(t)=x(t)

Source

dyad
# Integrates the input signal with optional gain factor.
#
# An integrator that computes the time integral of the input signal multiplied by a gain factor.
# The block implements the transfer function 1/s scaled by gain k.
#
# ```math
# y(t) = \int_{t_0}^{t} k \cdot u(\tau) d\tau + x_0
# ```
#
# Outputs `y = ∫k*u dt`, corresponding to the transfer function `\frac{1}{s}`.
component Integrator
  extends SISO
  # Internal state variable that stores the integrated value
  variable x::Real
  # Initial value of the integrator state at simulation start
  parameter x0::Real = 0
  # Gain factor applied to the input before integration
  parameter k::Real = 1.0
relations
  initial x = x0
  der(x) = k * u
  y = x
metadata {
  "Dyad": {
    "labels": [{"label": "$(instance)", "x": 500, "y": 1100, "rot": 0}],
    "icons": {"default": "dyad://BlockComponents/Integrator.svg"}
  }
}
end
Flattened Source
dyad
# Integrates the input signal with optional gain factor.
#
# An integrator that computes the time integral of the input signal multiplied by a gain factor.
# The block implements the transfer function 1/s scaled by gain k.
#
# ```math
# y(t) = \int_{t_0}^{t} k \cdot u(\tau) d\tau + x_0
# ```
#
# Outputs `y = ∫k*u dt`, corresponding to the transfer function `\frac{1}{s}`.
component Integrator
  # Input signal port
  u = RealInput() {
    "Dyad": {
      "placement": {
        "icon": {"iconName": "input", "x1": -100, "y1": 450, "x2": 0, "y2": 550, "rot": 0},
        "diagram": {"iconName": "input", "x1": -100, "y1": 450, "x2": 0, "y2": 550, "rot": 0}
      }
    }
  }
  # Output signal port
  y = RealOutput() {
    "Dyad": {
      "placement": {
        "icon": {"iconName": "output", "x1": 1000, "y1": 450, "x2": 1100, "y2": 550, "rot": 0},
        "diagram": {"iconName": "output", "x1": 1000, "y1": 450, "x2": 1100, "y2": 550, "rot": 0}
      }
    }
  }
  # Internal state variable that stores the integrated value
  variable x::Real
  # Initial value of the integrator state at simulation start
  parameter x0::Real = 0
  # Gain factor applied to the input before integration
  parameter k::Real = 1.0
relations
  initial x = x0
  der(x) = k * u
  y = x
metadata {
  "Dyad": {
    "labels": [{"label": "$(instance)", "x": 500, "y": 1100, "rot": 0}],
    "icons": {"default": "dyad://BlockComponents/Integrator.svg"}
  }
}
end


Test Cases

No test cases defined.