Gain

Description of the Gain component in Schematic Editor, which multiplies the input value by a constant.

Component Icon

Figure 1. Gain icon

Description

The Gain component multiplies an input value by a constant. The mathematical operations available are element-wise gain (y = K.*u) or matrix gain (y = K*u).

The constant for the Gain component can also be set as Tunable if changing of the constant during runtime is needed. Please refer to the Tunable components documentation for more information.

Multiplication configurations
  • Element-wise multiplication: is performed by multiplying each element of the input signal by the corresponding element in the gain matrix. Examples:
    • Scalar multiplication: The Gain value is a scalar and the input of the gain component is also a scalar. The output of gain component is a simple multiplication of these values.
      • 2 x * 3 K = 6 y

    • Element-wise multiplication: The Gain value is a scalar and the input of the Gain component is a vector of size ‘n’. The output of the Gain component is a vector of size ‘n’ where each element is a multiplication of each element of the input by the gain.
      • [ 2 ,   3 ,   5 ] x * 3 K = [ 6 ,   9 ,   15 ] y

    • Element-wise multiplication: The Gain value is a vector of size ‘n’ and the input of the Gain component is a scalar. The output of the Gain component is a vector of size ‘n’ where each element is a multiplication of the input by each element of the gain.
      • 3 x * [ 2 ,   3 ,   5 ] K = [ 6 ,   9 ,   15 ] y

    • Element-wise multiplication: The Gain value and the input of the Gain component are both vectors of size ‘n’. The output of the Gain component is a vector of size ‘n’ where each element is an element-wise multiplication of the input by the gain.
      • [2, 3, 5]x * [1, 2, 3]K=[2, 6, 15]y

  • Matrix multiplication: The input and gain are matrix-multiplied with the input as the first element. The Gain value is a matrix of length m x n and the input of the Gain component is a vector of length m. The output of the Gain component is a vector with n elements.
    • [1, 3, 2]x * 123456789K=[27, 33, 39]y

Ports

  • Input port (in)
    • Supported types: uint, int, and real.
    • Vector support: yes.
  • Output port (out)
    • Supported types: uint, int, and real.
      • Output type is inherited from the input signals.
    • Vector support: yes.
      • Vector length is calculated according to the form of the input signal and the gain of the component.

Properties

  • Gain
    • Type in the value, vector of values, or matrix of values of the gain by which to multiply the input.
  • Multiplication
    • Choose the type of operation to be performed by the component. This property can be selected as “Element-wise” or “Matrix”.
  • Tunable
    • Enables run-time tuning of the selected component. This will allow you to change values for gain during simulation without the need to recompile the model. Tunable properties are available in HIL SCADA in Model Explorer.
  • Execution rate:
    • Type in the desired signal processing execution rate. This value must be compatible with other signal processing components of the same circuit: the value must be a multiple of the fastest execution rate in the circuit. There can be up to four different execution rates, but they must all be multiple of the basic simulation timestep. To specify the execution rate, you can use either decimal (e.g. 0.001) or exponential values (e.g. 1e-3) in seconds. Alternatively, you can type in ‘inherit’ in which case the component will be assigned execution rate based on the execution rate of the components it is receiving input from.