- Details
-
Category: Descriptions of the functional blocks
-
Published on Tuesday, 27 May 2014 19:35
-
Written by AltonaLab
-
Hits: 2580
Block ExpressionOneIn
License: Hobby, Industrial
This block is very powerful for mathematical operations. It has a parameter Expression,which connect mathematecaly the output Y with input X. It is important the input X to be presented in expression. Examples for expression:
3.14*X
((2+X)*10)/2.5
The expression can include the existing in application functions. For example:
3*(sin(x)+log(2*x))
Some of the functions have more than one parameters. The function Equal has four parameters:
Equal(X1;X2;Res1;Res2)
It compares paramaters X1 and X2 and in case they are equal, the function will return result Res1, in other case will return Res2;
The list of existing functions is:
-
positive(X) - returns the absolute value of the argument;
-
over(X;Limit) - in case X is under Limit, the result is 0.0, else the result is X-Limit;
-
Round(X;RoundFactor) - rounds the value of X to RoundFactor sign after decimal separator;
-
Equal(X1;X2;Res1;Res2) - compares X1 and X2, if they are equal, the result is Res1, else Res2;
-
Min(X1;X2) - returns the smallest value of X1 and X2;
-
Max(X1;X2) - returns the greater value of X1 and X2;
-
IsZero(X;Res1;Res2) - if X is zero, the result is Res1, else Res2;
-
Rem(X;Y) - returns remaining of division X/Y. For example: 200.0/300.0, Remaining is 200.0;
-
acos(X) - arccosine of X;
-
asin(X) - arcsine of X;
-
atan(X) - arctangent of X;
-
cos(X) - cosine of X;
-
cosh(X) - hyperbolic cosine of X;
-
exp(X) - exponential function of X;
-
fabs(X) - absolute value of X;
-
log(X) - natural logarithm of X;
-
log10(X) - Calculate base-10 logarithm of X;
-
sin(X) - sine of X;
-
sinh(X) - hyperbolic sine of X;
-
sqrt(X) - Find square root of X;
-
tan(X) - tangent of X;
- tanh(X) - hyperbolic tangent of X;
Block's inputs:
- DoCalc - if the input is connected, the block will calculate the expression when the input becomes to high value. If the input is not connected, the block will calculate the expression many times per second. At first case the processor is less loaded;
Block's outputs:
- OnReady - when the calculation is done, the output becomes to high value;
Block ExpressionUni
License: Hobby, Industrial
In case the user needs more Expression blocks, then ExpressionUni is suitable. Every output Y1 .. Y8 has independent expression, which is presented as parameter ExpressionY1 .. ExpressionY8. The other trick here is that every output can be related with one or more inputs. For example, if parameter ExpressionY1, which correspond to output Y1 has a string X1+2*X2+sin(X3), then the output Y1 is related to inputs X1, X2, X3.
The block has parameter InOut, which opens GPIO interface and allows some inputs and outputs to be hiden. The supported mathematical functions are the same as in the block ExpressionOneIn and are described above.
Parameters:
- ExpressionY1 .. ExpressionY8 - one expression for each output;
- InOut - GPIO interface to hide and show inputs and outputs. The type of In/Out from analog to digital can't be changed;
Block's inputs:
- DoCalc - if the input is connected, the block will calculate the expression when the input becomes to high value. If the input is not connected, the block will calculate the expression many times per second. At first case the processor is less loaded;
Block's outputs:
- OnReady - when the calculation is done, the output becomes to high value;
Block AverageVal
License: Hobby, Industrial
The output Y of the block returns the average value of last few inputs X values of the block. The parameter QueueSize determines the average value of how many values of input X to be calculated. For example, if the parameter QueueSize is 3 and last 3 values of input X were: 3.0, 3.4, 3.8, then the output Y will be (3.0+3.4+3.8)/3 = 3.4.
The block is suitable for filtering signals with noise. The QueueSize can be up to 200 values.
If the input Process is connected, then passing in a high level, the current value of the inputs X will be added to the queue of values on which the block will calculate the average.
Block AverageValAngle
License: Hobby, Industrial
The block calculates the average value of an angle input. The needful calculation at this case is more complicated than of the block AverageVal. For example if we need to calculate an average value for last 10 measured values from wind direction sensor, we can do it with this block.
Block's parameters:
- Input Type - determines the type of input X : Radians, Degrees;
- QueueSize - determines the average value of how many values of input X to be calculated;
Block's inputs:
- Process - if the input is connected, then passing in a high level, the current value of the inputs X will be added to the queue of values on which the block will calculate the average.
Block Approximation
License: Hobby, Industrial
The block is suitable for converting non-linear relationship between input and output signals. Parameter Setings opens interface where to introduce the correlation table. If the user needs to convert several signals through the same table, then Number of approximations in settings interface has to be set. The example is a relation between distance and output voltage of sensor: Sharp GP2Y0A21YK0F 10-80 sm.