TestFIRFilter TestFIRFilter Icon

TestFIRFilter

Usage

PrimitiveComponents.TestFIRFilter()

Variables

NameDescriptionUnits
x

Behavior

\[ \begin{equation} \left[ \begin{array}{c} \frac{\mathrm{d} x\left( t \right)}{\mathrm{d}t} = 0 \\ \mathrm{connect}\left( sin_{+}y(t), fir_{+}u(t) \right) \\ \mathtt{fir.y}\left( t \right) = \mathtt{fir.c1} \mathtt{fir.u}\left( t \right) + \mathtt{fir.c2} Shift(t, -1)\left( \mathtt{fir.u}\left( t \right) \right) + \mathtt{fir.c3} Shift(t, -2)\left( \mathtt{fir.u}\left( t \right) \right) \\ \frac{\mathrm{d} \mathtt{fir.l}\left( t \right)}{\mathrm{d}t} = 0 \\ \mathtt{sin.y}\left( t \right) = \mathtt{sin.offset} + \mathtt{sin.amplitude} ifelse\left( t \geq \mathtt{sin.start\_time}, \sin\left( \mathtt{sin.phase} + 6.2832 \mathtt{sin.frequency} \left( - \mathtt{sin.start\_time} + t \right) \right), \sin\left( \mathtt{sin.phase} \right) \right) \\ \end{array} \right] \end{equation} \]

Source

test component TestFIRFilter
  fir = PrimitiveComponents.DiscretePrimitives.FIRFilter(dt = 0.1, n = 3, coeffs = [0.2, 0.5, 0.3]) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 230, "y1": 140, "x2": 330, "y2": 240, "rot": 0}
      }
    }
  }
  sin = BlockComponents.Sine(start_time = 1.0, offset = 0.0, amplitude = 10, frequency = 0.1, phase = 0.0) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 30, "y1": 140, "x2": 130, "y2": 240, "rot": 0}
      }
    }
  }
  variable x::Real
relations
  initial x = 0.0
  der(x) = 0.0
  connect(sin.y, fir.u) {"Dyad": {"edges": [{"S": 1, "E": 2, "M": []}]}}
end
Flattened Source
test component TestFIRFilter
  fir = PrimitiveComponents.DiscretePrimitives.FIRFilter(dt = 0.1, n = 3, coeffs = [0.2, 0.5, 0.3]) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 230, "y1": 140, "x2": 330, "y2": 240, "rot": 0}
      }
    }
  }
  sin = BlockComponents.Sine(start_time = 1.0, offset = 0.0, amplitude = 10, frequency = 0.1, phase = 0.0) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 30, "y1": 140, "x2": 130, "y2": 240, "rot": 0}
      }
    }
  }
  variable x::Real
relations
  initial x = 0.0
  der(x) = 0.0
  connect(sin.y, fir.u) {"Dyad": {"edges": [{"S": 1, "E": 2, "M": []}]}}
metadata {}
end


Test Cases

No test cases defined.