FIRFilter FIRFilter Icon

DiscretePrimitives.FIRFilter

FIRFilter(; name, dt=0.1, coeffs=[0.5, 0.5], _...)

A Finite Impulse Response (FIR) filter that applies a weighted sum of past input samples.

Arguments

  • name: Component name
  • dt: Sampling time interval (default: 0.1)
  • coeffs: Vector of filter coefficients (default: [0.5, 0.5])

Variables

  • u(t): Input signal
  • y(t): Filtered output signal
  • l(t): Dummy continuous state

Description

Implements the discrete-time convolution: y[k] = Σ(u[k-i] * coeffs[i+1]) for i = 0 to n-1

Usage

PrimitiveComponents.DiscretePrimitives.FIRFilter()

Parameters:

NameDescriptionUnitsDefault value
dt
n
coeffs

Connectors

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

Behavior

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

Source

"""
    FIRFilter(; name, dt=0.1, coeffs=[0.5, 0.5], _...)

A Finite Impulse Response (FIR) filter that applies a weighted sum of past input samples.

# Arguments
- `name`: Component name
- `dt`: Sampling time interval (default: 0.1)
- `coeffs`: Vector of filter coefficients (default: [0.5, 0.5])

# Variables
- `u(t)`: Input signal
- `y(t)`: Filtered output signal
- `l(t)`: Dummy continuous state

# Description
Implements the discrete-time convolution: y[k] = Σ(u[k-i] * coeffs[i+1]) for i = 0 to n-1
"""
external component FIRFilter
  y = Dyad.RealOutput() {
    "Dyad": {
      "placement": {
        "icon": {"iconName": "default", "x1": 1010, "y1": 480, "x2": 1050, "y2": 520, "rot": 0},
        "diagram": {"iconName": "default", "x1": 1010, "y1": 480, "x2": 1050, "y2": 520, "rot": 0}
      }
    }
  }
  u = Dyad.RealInput() {
    "Dyad": {
      "placement": {
        "icon": {"iconName": "default", "x1": -40, "y1": 480, "x2": 0, "y2": 520, "rot": 0},
        "diagram": {"iconName": "default", "x1": -40, "y1": 480, "x2": 0, "y2": 520, "rot": 0}
      }
    }
  }
  structural dt::Real
  structural n::Integer
  structural coeffs::Real[n]
relations
metadata {
  "Dyad": {
    "labels": [{"label": "$(instance)", "x": 500, "y": 1100, "rot": 0}],
    "icons": {"default": "dyad://PrimitiveComponents/FIRFilter.svg"},
    "doc": {"behavior": false}
  }
}
end
Flattened Source
"""
    FIRFilter(; name, dt=0.1, coeffs=[0.5, 0.5], _...)

A Finite Impulse Response (FIR) filter that applies a weighted sum of past input samples.

# Arguments
- `name`: Component name
- `dt`: Sampling time interval (default: 0.1)
- `coeffs`: Vector of filter coefficients (default: [0.5, 0.5])

# Variables
- `u(t)`: Input signal
- `y(t)`: Filtered output signal
- `l(t)`: Dummy continuous state

# Description
Implements the discrete-time convolution: y[k] = Σ(u[k-i] * coeffs[i+1]) for i = 0 to n-1
"""
external component FIRFilter
  y = Dyad.RealOutput() {
    "Dyad": {
      "placement": {
        "icon": {"iconName": "default", "x1": 1010, "y1": 480, "x2": 1050, "y2": 520, "rot": 0},
        "diagram": {"iconName": "default", "x1": 1010, "y1": 480, "x2": 1050, "y2": 520, "rot": 0}
      }
    }
  }
  u = Dyad.RealInput() {
    "Dyad": {
      "placement": {
        "icon": {"iconName": "default", "x1": -40, "y1": 480, "x2": 0, "y2": 520, "rot": 0},
        "diagram": {"iconName": "default", "x1": -40, "y1": 480, "x2": 0, "y2": 520, "rot": 0}
      }
    }
  }
  structural dt::Real
  structural n::Integer
  structural coeffs::Real[n]
relations
metadata {
  "Dyad": {
    "labels": [{"label": "$(instance)", "x": 500, "y": 1100, "rot": 0}],
    "icons": {"default": "dyad://PrimitiveComponents/FIRFilter.svg"},
    "doc": {"behavior": false}
  }
}
end


Test Cases

No test cases defined.