Skip to content
LIBRARY
Examples.AccumulatorSyntactic.md

Examples.AccumulatorSyntactic ​

An accumulator written using clock syntax directly.

This component accumulates (sums) its input over time at each clock tick. The output y[n] = y[n-1] + u[n], which is the discrete-time equivalent of integration.

Usage ​

DiscreteComponents.Examples.AccumulatorSyntactic()

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 ​

Source ​

dyad
"""
An accumulator written using clock syntax directly.

This component accumulates (sums) its input over time at each clock tick.
The output y[n] = y[n-1] + u[n], which is the discrete-time equivalent of integration.
"""
component AccumulatorSyntactic@[input clk extends Discrete]
  "Input signal to accumulate"
  u = RealInput@[clk]()
  "Accumulated output"
  y = RealOutput@[clk]()
relations
  y@clk = y@(clk-1) + u@clk
  initial y@(clk-1) = 0.0
end
Flattened Source
dyad
"""
An accumulator written using clock syntax directly.

This component accumulates (sums) its input over time at each clock tick.
The output y[n] = y[n-1] + u[n], which is the discrete-time equivalent of integration.
"""
component AccumulatorSyntactic
  "Input signal to accumulate"
  u = RealInput@[clk]()
  "Accumulated output"
  y = RealOutput@[clk]()
relations
  y@clk = y@(clk-1) + u@clk
  initial y@(clk-1) = 0.0
metadata {}
end


Test Cases ​

No test cases defined.

  • Examples

  • Experiments

  • Analyses