template<typename Tout = double, typename Tgain = double, bool elementWise = false>
class eeros::control::Gain< Tout, Tgain, elementWise >
A gain block is used to amplify an input signal. This is basically done by multiplying the gain with the input signal value. The following term represents the operation performed in this block.
output = gain * input
Gain is a class template with two type and one non-type template arguments. The two type template arguments specify the types which are used for the output type and the gain type when the class template is instanciated. The non-type template argument specifies if the multiplication will be done element wise in case the gain is used with matrices.
- Template Parameters
-
Tout | - output type (double - default type) |
Tgain | - gain type (double - default type) |
elementWise | - amplify element wise (false - default value) |
- Since
- v0.6
template<typename Tout = double, typename Tgain = double, bool elementWise = false>
Enables or disables a smooth change of the gain.
If enabled, run() will perform a smooth change of the gain value.
Does not enable or disable the gain. This is done by calling enable() and disable() respectively.
- Parameters
-
enable | - enables or disables a smooth change of the gain |
- See also
- run()
-
enable()
-
disable()
template<typename Tout = double, typename Tgain = double, bool elementWise = false>
Runs the amplification algorithm.
Performs the smooth change if smooth change is enabled with enableSmoothChange(bool). A smooth change of the gain is performed by adding or subtracting a gain differential specifiable by setGainDiff(Tgain).
Checks if gain is in the band in between minGain and maxGain or correct it otherwise. The correction is done by setting the maxGain or minGain to gain.
Sets the output signal value to the amplified value calculated by multiplying gain * input if the gain instance is enabled by enable().
- See also
- enableSmoothChange(bool)
-
setGainDiff(Tgain)
-
enable()
-
disable()
Implements eeros::Runnable.
template<typename Tout = double, typename Tgain = double, bool elementWise = false>
Sets the gain value if smooth change is disabled and c is in the band in between minGain and maxGain.
Sets the target gain value if smooth change is enabled and c is in the band in between minGain and maxGain.
Does not change gain or target gain value otherwise.
- Parameters
-