AccumulatorGraphical Icon
Examples.AccumulatorGraphical
An accumulator built using block diagram components.
This component performs the same accumulation as AccumulatorSyntactic, but uses graphical blocks: UnitDelay feeds the previous output back, and Add combines it with the current input.
Usage
DiscreteComponents.Examples.AccumulatorGraphical()
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{equation} \left[ \begin{array}{c} \mathrm{connect}\left( y(t), unitdelay_{+}u(t) \right) \\ \mathrm{connect}\left( unitdelay_{+}y(t), add_{+}u1(t) \right) \\ \mathrm{connect}\left( u(t), add_{+}u2(t) \right) \\ \mathrm{connect}\left( add_{+}y(t), y(t) \right) \\ \mathtt{unitdelay.y}\left( t \right) = Shift(t, -1)\left( \mathtt{unitdelay.u}\left( t \right) \right) \\ \frac{\mathrm{d} \mathtt{unitdelay.dummy.dummy}\left( t \right)}{\mathrm{d}t} = 0 \\ \mathtt{add.y}\left( t \right) = \mathtt{add.k1} \mathtt{add.u1}\left( t \right) + \mathtt{add.k2} \mathtt{add.u2}\left( t \right) \\ \end{array} \right] \end{equation} \]
Source
"""
An accumulator built using block diagram components.
This component performs the same accumulation as AccumulatorSyntactic,
but uses graphical blocks: UnitDelay feeds the previous output back,
and Add combines it with the current input.
"""
component AccumulatorGraphical@[input clk extends Discrete]
"Input signal to accumulate"
u = RealInput@[clk]()
"Accumulated output"
y = RealOutput@[clk]()
"Delays output by one sample"
unitdelay = DiscreteComponents.UnitDelay()
"Adds current input to previous output"
add = BlockComponents.Add()
relations
connect(y, unitdelay.u)
connect(unitdelay.y, add.u1)
connect(u, add.u2)
connect(add.y, y)
end
Flattened Source
"""
An accumulator built using block diagram components.
This component performs the same accumulation as AccumulatorSyntactic,
but uses graphical blocks: UnitDelay feeds the previous output back,
and Add combines it with the current input.
"""
component AccumulatorGraphical
"Input signal to accumulate"
u = RealInput@[clk]()
"Accumulated output"
y = RealOutput@[clk]()
"Delays output by one sample"
unitdelay = DiscreteComponents.UnitDelay()
"Adds current input to previous output"
add = BlockComponents.Add()
relations
connect(y, unitdelay.u)
connect(unitdelay.y, add.u1)
connect(u, add.u2)
connect(add.y, y)
metadata {}
endTest Cases
No test cases defined.
Related
- Examples
- Experiments
- Analyses