UnitDifference UnitDifference Icon

UnitDifference

A unit difference block that computes y[n] = u[n] - u[n-1].

Clock-agnostic.

Usage

DiscreteComponents.UnitDifference(initial_condition=0)

Parameters:

NameDescriptionUnitsDefault value
initial_conditionThe initial condition of the delayed signal0

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)

Behavior

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

Source

"""
A unit difference block that computes y[n] = u[n] - u[n-1].

Clock-agnostic.
"""
component UnitDifference@[input clk extends Discrete]
  "The input signal"
  u = RealInput@[clk]() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": -50, "y1": 450, "x2": 50, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  "The difference output signal"
  y = RealOutput@[clk]() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 960, "y1": 450, "x2": 1060, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  dummy = DummyDynamics()
  "The initial condition of the delayed signal"
  parameter initial_condition::Real = 0
relations
  y = u@clk - u@(clk-1)
  initial u@(clk-1) = initial_condition
metadata {
  "Dyad": {
    "icons": {"default": "dyad://DiscreteComponents/UnitDifference.svg"},
    "doc": {"behavior": false}
  }
}
end
Flattened Source
"""
A unit difference block that computes y[n] = u[n] - u[n-1].

Clock-agnostic.
"""
component UnitDifference
  "The input signal"
  u = RealInput@[clk]() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": -50, "y1": 450, "x2": 50, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  "The difference output signal"
  y = RealOutput@[clk]() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 960, "y1": 450, "x2": 1060, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  dummy = DummyDynamics()
  "The initial condition of the delayed signal"
  parameter initial_condition::Real = 0
relations
  y = u@clk - u@(clk-1)
  initial u@(clk-1) = initial_condition
metadata {
  "Dyad": {
    "icons": {"default": "dyad://DiscreteComponents/UnitDifference.svg"},
    "doc": {"behavior": false}
  }
}
end


Test Cases

No test cases defined.