Constant
ShippingconstantEmit fixed value as source node
Signature
Outputs
valueScalar|Signal
Parameters
| Key | Type | Default | Notes |
|---|---|---|---|
value | float | 0.0 | |
unit | text | V | |
output_type | enum | scalar | one of: scalar, signal |
sample_rate | float | 1000.0Hz | |
duration | float | 1.0s |
Description
Constant is a pure source node: it takes no input and emits a fixed value on its single value output port. It is the canonical way to inject a literal into a graph — a bias, a setpoint, a reference level, a threshold, or a scaling factor that another node reads.
The output_type parameter selects the emitted shape. In scalar mode the node produces a single dimensionless-indexed number carrying the configured value. In signal mode it materializes a uniformly sampled constant time series: every sample equals value, sampled at sample_rate (Hz) for duration (s), yielding samples with a proper time base. Use signal mode when a downstream node requires a sampled stream (e.g. to add a DC offset to a generator output or to drive a filter warm-up).
The unit parameter attaches a physical unit label (default V) to the emitted quantity, so the constant participates correctly in Captyse's dimensional algebra: multiplying a constant in A by a signal in Ω yields a result in V, and a dimensionally inconsistent addition is rejected at wiring time. A constant is a certain quantity — its uncertainty is exactly — so it propagates through downstream operations without contributing variance.
Constant is stateless. Its output depends solely on its parameters, never on time step, history, or block boundaries; identical parameters always yield identical output.
Mathematics
Examples
Scalar reference level
Set output_type = scalar, value = 2.5, unit = V. The node emits the single quantity with zero uncertainty. Wire it into a comparator threshold input to build a fixed-level detector, or into a math_operator to bias another stream.
Constant DC signal for warm-up
Set output_type = signal, value = 1.0, unit = V, sample_rate = 1000, duration = 0.5. This yields a 500-sample flat waveform:
t: 0.000 0.001 0.002 ... 0.499 (s)
y: 1.000 1.000 1.000 ... 1.000 (V)Add it to a signal_generator output to shift the entire waveform up by exactly 1 V.
Applications
- Injecting a fixed bias, DC offset, or setpoint into a control or signal chain.
- Supplying reference/threshold levels to comparators, clippers, or Schmitt triggers.
- Providing dimensioned physical constants (e.g. a shunt resistance in Ω, a gain in dimensionless units) for unit-checked arithmetic.
- Generating a flat calibration or warm-up signal to prime stateful nodes such as filters or delays.
Neat
Because a constant carries exactly $\sigma = 0$, it acts as a variance-neutral element in uncertainty propagation: scaling a measured signal by a constant multiplies its sigma, but adds none of its own.
The `unit` label makes the node a lightweight way to introduce dimensioned literals — the same numeric `value` behaves entirely differently in the dimensional algebra depending on whether its unit is `V`, `A`, or dimensionless.
Known issues
In `signal` mode the sample count is $N = \lfloor f_s \cdot T \rfloor$; non-integer products truncate, so a duration that is not an exact multiple of the sample period yields slightly fewer samples than the nominal $f_s \cdot T$.
A very large `sample_rate` combined with a long `duration` allocates $N$ samples eagerly and can be memory-intensive, even though every element is identical.