eeros_architecture:control_system:available_blocks:gain
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
eeros_architecture:control_system:available_blocks:gain [2017/04/06 13:10] – created graf | eeros_architecture:control_system:available_blocks:gain [2022/04/21 13:36] (current) – [Gain] ursgraf | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Gain ====== | ====== Gain ====== | ||
- | The gain block allows to amplify an input signal. In general, the input signal is of type matrix and hence, the gain will have to be a matrix as well. The following lines show various | + | The gain block allows to amplify an input signal. In general, the input signal is of type matrix and hence, the gain will have to be a matrix as well. However, the type of the input signal and the output signal must be the same. When the gain block is disabled the output is equal to the input. When declaring a gain block you have to make sure that the gain matrix multiplied with the input type produces a result with the same type as the input type. |
- | examples. | + | |
+ | The following lines show various examples. | ||
<code cpp> | <code cpp> | ||
- | | + | Gain<Matrix< |
</ | </ | ||
- | The first template parameter denotes the input signal. The gain here is a 2x2-matrix. | + | The first template parameter denotes |
+ | <code cpp> | ||
+ | Gain< | ||
+ | </ | ||
+ | This is not allowed because the multiplication of two matrices with the first having dimensions of [2,2] and the second of [1,2] is not defined. | ||
If a '' | If a '' | ||
<code cpp> | <code cpp> | ||
- | | + | Gain< |
- | Gain< | + | Gain< |
</ | </ | ||
Another useful operation is a by multipliying an input matrix with a given gain matrix element by element. This is achieved by | Another useful operation is a by multipliying an input matrix with a given gain matrix element by element. This is achieved by | ||
<code cpp> | <code cpp> | ||
- | | + | Gain< |
</ | </ | ||
The third template parameter specifies an element-by-element multiplication. Please beware of the fact that in this case input signal and gain matrix must be of the same dimensions. | The third template parameter specifies an element-by-element multiplication. Please beware of the fact that in this case input signal and gain matrix must be of the same dimensions. | ||
+ | |||
+ | ===== Smooth Change ===== | ||
+ | The smooth change feature can be enabled with | ||
+ | <code cpp> | ||
+ | Gain< | ||
+ | gain.enableSmoothChange(true); | ||
+ | </ | ||
+ | Setting a new gain value will now cause the gain to change with small steps towards this new value. The incremental steps can be set with | ||
+ | <code cpp> | ||
+ | gain.setGainDiff(0.1); | ||
+ | </ | ||
+ | |||
+ | ===== Parabolic Gain ===== | ||
+ | For some applications, | ||
+ | <code cpp> | ||
+ | gain.setParabolicLimit(5.0); | ||
+ | gain.enableParabolicGain(); | ||
+ | </ | ||
+ | The gain curve then becomes | ||
+ | |||
+ | {{: | ||
+ | |||
+ | Within the limits of [-x .. +x] the output value will be calculated simply as | ||
+ | < | ||
+ | out = k * in; // with k being the linear gain | ||
+ | </ | ||
+ | |||
+ | When the input exceeds this limits the gain will be gradually reduced and the output becomes | ||
+ | < | ||
+ | out = k * srqt(x * (2 * in - x)); | ||
+ | </ | ||
eeros_architecture/control_system/available_blocks/gain.txt · Last modified: 2022/04/21 13:36 by ursgraf