UnitDifference UnitDifference Icon

DiscretePrimitives.UnitDifference

UnitDifference(; name, ic = 0.0)

A unit difference component that computes the first-order difference of the input signal.

Arguments

  • name: Component name
  • ic: Initial condition for the previous input value (default: 0.0)

Variables

  • u(t): Input signal
  • y(t): Output signal (first-order difference)

Description

Implements: y[k] = u[k] - u[k-1], computing the discrete-time derivative approximation.

Usage

PrimitiveComponents.DiscretePrimitives.UnitDifference(ic)

Parameters:

NameDescriptionUnitsDefault value
ic

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

\[ \begin{align} y\left( t \right) &= u\left( t \right) - Shift(t, -1)\left( u\left( t \right) \right) \\ \frac{\mathrm{d} \mathtt{dummy.l}\left( t \right)}{\mathrm{d}t} &= 0 \end{align} \]

Source

"""
    UnitDifference(; name, ic = 0.0)

A unit difference component that computes the first-order difference of the input signal.

# Arguments
- `name`: Component name
- `ic`: Initial condition for the previous input value (default: 0.0)

# Variables
- `u(t)`: Input signal
- `y(t)`: Output signal (first-order difference)

# Description
Implements: y[k] = u[k] - u[k-1], computing the discrete-time derivative approximation.
"""
external component UnitDifference@[input clk]
  u = RealInput@[clk]() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 0, "y1": 450, "x2": 100, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  y = RealOutput@[clk]() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 900, "y1": 450, "x2": 1000, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  parameter ic::Real
relations
metadata {"Dyad": {"icons": {"default": "dyad://PrimitiveComponents/Difference.svg"}}}
end
Flattened Source
"""
    UnitDifference(; name, ic = 0.0)

A unit difference component that computes the first-order difference of the input signal.

# Arguments
- `name`: Component name
- `ic`: Initial condition for the previous input value (default: 0.0)

# Variables
- `u(t)`: Input signal
- `y(t)`: Output signal (first-order difference)

# Description
Implements: y[k] = u[k] - u[k-1], computing the discrete-time derivative approximation.
"""
external component UnitDifference
  u = RealInput@[clk]() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 0, "y1": 450, "x2": 100, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  y = RealOutput@[clk]() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 900, "y1": 450, "x2": 1000, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  parameter ic::Real
relations
metadata {"Dyad": {"icons": {"default": "dyad://PrimitiveComponents/Difference.svg"}}}
end


Test Cases

No test cases defined.