Gain (gain)
Multiplies the input by a fixed factor k.
Group: Control · Kind: {"block":"gain","kind":"control"}
When to use it
Use it to change units or scale a signal. Use Product to multiply two signals and Lookup Table for a curve.
Pins
| Pin | Domain | Meaning |
|---|---|---|
in |
signal | Signal to scale |
out |
signal | Input times k |
Common parameters
k: How much the input is multiplied (Default: 1)
Parameters
| Key | Unit | Default | Typical range | Description |
|---|---|---|---|---|
k |
— | 1 | How much the input is multiplied |
Parameter descriptions are in English in both languages.
Use for: Unit scaling · Sensor scales · Per-unit conversion
Not for: Multiplying two signals → product · Nonlinear curves → lookup
Formulas
| Formula | Equation | Source |
|---|---|---|
| Gain | out = k·in | Ogata, Modern Control Engineering, 5th ed. (2010), ch. 2 (block diagrams) |
| Gain in decibels | G = 20·log10(abs(k)) | Franklin, Powell & Emami-Naeini, Feedback Control of Dynamic Systems, 8th ed. (2019), ch. 6 |
Quick check
Inputs:
k: Gain = 10m —,ku: Input value = 400 —
Outputs:
y: Output =k*u—gdb: Gain in dB =20*log10(abs(k))—
Model logic
- The output is k times the input at every step, with no state and no dynamics, so it follows the input in the same step (direct feedthrough).
- Any finite k is accepted, including 0 and negative values, which flip the sign; an unconnected input reads 0.
- A loop made only of blocks with direct feedthrough is an algebraic loop: the build stops and names the blocks in the loop.
Model
out = k*in, with no dynamics. The block has direct feedthrough, so the output follows the input within the same step. A negative k flips the sign.
Common mistakes
- A loop made only of blocks with no delay, such as Gain, Sum and Product, stops the run. Put an Integrator, Sample Delay or Sample and Hold in the loop.
- Gain does not check units, so a factor that mixes per-unit and SI values passes without a warning. Write k as an expression such as 1/Vdc so that it follows design changes.
Problems rules: solver.control
Datasheet and sources
No datasheet applies. The value of k comes from your design, such as a unit factor, a pole-pair count or a sensor scale.
Example
Open the example with the command file.openExample and the name demo:gain.
Generated by cargo xtask reference from the usage texts and parameter specs. Do not edit by hand.