---
url: /dyad/dev/stdlib/DiscreteComponents/components/Examples.AccumulatorSyntactic.md
description: >-
  Dyad Examples.AccumulatorSyntactic docs.  An accumulator written using clock
  syntax directly.
---

# `Examples.AccumulatorSyntactic` {#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 {#Usage}

`DiscreteComponents.Examples.AccumulatorSyntactic()`

## Connectors {#Connectors}

* `u` - This connector represents a real signal as an input to a component ([`RealInput`](/stdlib/Dyad/connectors/RealInput#RealInput))

* `y` - This connector represents a real signal as an output from a component ([`RealOutput`](/stdlib/Dyad/connectors/RealOutput#RealOutput))

## Behavior {#Behavior}

$$ \begin{align}
y\left( t \right) &= Shift(t, -1)\left( y\left( t \right) \right) + u\left( t \right)
\end{align}
$$

## Source {#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
```

```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 {#Test-Cases}

No test cases defined.

## Related {#Related}

* Examples

* Experiments

* Analyses
