LIBRARY
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 ​
Source ​
dyad
"""
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.Math.Add()
relations
connect(y, unitdelay.u)
connect(unitdelay.y, add.u1)
connect(u, add.u2)
connect(add.y, y)
endFlattened Source
dyad
"""
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.Math.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