Gains

Gain functions allow you to map values from a source node variable into values for a different variable in a target node. This allows generic communciation between any two nodes in AnimatLab. This is the method use to allow the physics engine and the neural engines to communicate, and it also allows neural models in different plug-in modules to communicate. This means that biomechanical variables like muscle length can be converted into neural variables like injected current, or vice versa. There are currently three types of gains that you can use in AnimatLab. Gains are not limited to being used in adapters, but that is primarily where you will find them. As with everything in AnimatLab, you can add new gain types if you need them, and share them with other people. The three gains are shown below. They are polynomial, sigmoidal, and normal curves. Each one has different parameters specific to that item.

Polynomial Gain

Figure 1. Polynomial gain dialog.
This gain has 4 parameters that are the coefficients of cubic equation 1. Set these parameters for equations up to a cubic. If you need a linear or quadratic then simply let the coefficients for the other parameters be zero.

(1)
A
Coefficient of the cubic term.
Default value: 0
Acceptable range: Any Value

B
Coefficient of the quadratic term.
Default value: 0
Acceptable range: Any Value

C
Coefficient of the linear term.
Default value: 1
Acceptable range: Any Value

d
Coefficient of the constant term.
Default value: 0
Acceptable range: Any Value

Sigmoidal Gain

Figure 2. Sigmoidal gain dialog.
The sigmoid function for this gain is shown above, and the equation that produces this curve is shown below.

(2)
Amplitude (B)
Determines the maximum height of the curve.
Default value: 0.5
Acceptable range: Any Value

Steepness (C)
Determines how fast the curve goes from its minimum to its maximum value. To make the curve go up faster increase this value.
Default value: 25
Acceptable range: Any Value

X Offset (A)
Determines how far over the mid-point of the curve is shifted on the X axis.
Default value: 0.5
Acceptable range: Any Value

Y Offset (D)
Determines how far off the Y axis the curve is shifted.
Default value: 0
Acceptable range: Any Value

Bell (Normal) Gain

Figure 2. Normal gain dialog.
The bell function for this gain is shown above, and the equation that produces this curve is shown below.

(2)
Amplitude (B)
Determines the maximum height of the curve.
Default value: 0.5
Acceptable range: Any Value

Width (C)
Determines the width of the bell shape. This parameter is a little tricky because the larger the value the smaller the width. In order to increase the width you need to decrease this value.
Default value: 25
Acceptable range: Any Value

X Offset (A)
Determines how far over the mid-point of the curve is shifted on the X axis.
Default value: 0.5
Acceptable range: Any Value

Y Offset (D)
Determines how far off the Y axis the curve is shifted.
Default value: 0
Acceptable range: Any Value

Gain Limits

All gains also have a limit properties. These specify the x and y range over which the functions are defined, and they define the area that will be graphed in the dialog. If you know that your input or output value should never exceed a give range then you can use this to ensure that if for some reason a value gets passed in that is outside this range that it will be limited to the maximum or minimum output values. The upper and lower limits are the minimum and maximum input values for which this function is defined. The upper and lower outputs are the minimum and maximum output values that can be returned. If limits are turned on and an input value is received that is lower than the lower limit then the output value will be set to the lower output value regardless of what the value would be if it was computed using the gain equation. These limits can be turned on or off. They are off by default. If they are off then the output values are always determined by the value returned by the equation.

Gain limits also allow you to control the graph area in the gain dialog. Even if the limits are disabled you can still change the upper and lower limits to change the range of the x axis, and the upper and lower outputs to change the range of the y axis. If the function is not centered so you can easily view it this gives you the ability to make it clearer.

Lower Limit
The minimum x, or input, value acceptable for this function if limits are enabled.
Default value: -100
Acceptable range: Any Value

Lower Output
The minimum y, or output, value acceptable for this function if limits are enabled.
Default value: -100
Acceptable range: Any Value

Upper Limit
The maximum x, or input, value acceptable for this function if limits are enabled.
Default value: 100
Acceptable range: Any Value

Upper Output
The maximum y, or output, value acceptable for this function if limits are enabled.
Default value: 100
Acceptable range: Any Value