User Tools

Site Tools


eeros_architecture:control_system:available_blocks:gain

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
eeros_architecture:control_system:available_blocks:gain [2021/11/01 11:21] ursgrafeeros_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<Vector2, Matrix<2,2>> g1({1,2.5,-1,-0.5});+Gain<Matrix<2,1>, Matrix<2,2>> g1({1,2.5,-1,-0.5});  // result will be of type Matrix<2,1>
 </code> </code>
-The first template parameter denotes the input signal. The gain here is a 2x2-matrix. +The first template parameter denotes the type of the input and output signal. The second template parameter is the type of the gain, which here is a 2x2-matrix. 
 +<code cpp> 
 +Gain<Matrix<1,2>, Matrix<2,2>> g1({1,2.5,-1,-0.5});  // not allowed 
 +</code> 
 +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 ''Gain'' block is declared with a single value each element of the input vector is multiplied with this value. If a ''Gain'' block is declared with a single value each element of the input vector is multiplied with this value.
 <code cpp> <code cpp>
Line 29: Line 33:
 gain.setGainDiff(0.1); gain.setGainDiff(0.1);
 </code> </code>
 +
 +===== Parabolic Gain =====
 +For some applications, the gain should decrease when the input values exceed a certain limit. You can configure and switch on such a parabolic behavior with
 +<code cpp>
 +gain.setParabolicLimit(5.0);
 +gain.enableParabolicGain();
 +</code>
 +The gain curve then becomes
 +
 +{{:eeros_architecture:control_system:available_blocks:gainrootcurve.png?400|}}
 +
 +Within the limits of [-x .. +x] the output value will be calculated simply as 
 +<code>
 +out = k * in; // with k being the linear gain
 +</code>
 +
 +When the input exceeds this limits the gain will be gradually reduced and the output becomes
 +<code>
 +out = k * srqt(x * (2 * in - x));
 +</code> 
  
eeros_architecture/control_system/available_blocks/gain.1635762062.txt.gz · Last modified: 2021/11/01 11:21 by ursgraf