Configuration Parameter |
Selectable Option/Value |
Description |
Number of parameters |
|
Number of parameters expecting to compare |
Parameter name size (bytes) |
|
The size of the parameter name in bytes should be determined by the length of the longest name when comparing different names. For instance, when comparing "temp1" and "humidity1," the size should be 9 bytes because the parameter name "humidity1" is longer. |
Filter expression size (bytes) |
|
Filter expression size in bytes.For instance if the expression is "temp1>humidity1" the size should be 15 or larger value |
Sample time (sec) |
-1(inherited) or specify |
Specify the sample time |
INPUT Port
Port Name |
Port Type |
Date Type |
Description |
Parameter name list |
Vector |
uint8 |
Feed char vector with the parameter name list.For instance 'senor1,senor2' |
Filter expression |
Vector |
uint8 |
Feed char vector with the filter expression.'sensor1 > 20 | sensor2 < 100' |
Parameter values |
Vector |
uint8 |
Feed char vector with parameter current values. |
OUTPUT Port
Port Name |
Port Type |
Date Type |
Description |
Status |
Scalar |
Boolean |
The port provides an output that reflects the status of the filter expression. If the expression's condition is met, it outputs 1; otherwise, it outputs 0. |
When to use this block?
This block is utilized for expression evaluation. When you need to obtain a status output by assessing an expression, you can employ this block. For a more comprehensive understanding, please refer to the example demonstrations provided.
How does this block work?
When formatting the filter expression, please adhere to the specified format. Keep in mind that the operators used do not conform to C standards, so refer to the provided example expressions when defining your filter expression.
Standard C operator |
Modified operator |
Example expression |
Equal to (==) |
= |
X = Y |
Not equal to (!=) |
! |
X ! Y |
Greater than (>) |
> |
X > Y |
Less than (<) |
< |
X < Y |
Greater than or equal to (>=) |
# |
X # Y |
Less than or equal to (<=) |
@ |
X @ Y |
Logical AND (&&) |
& |
X & Y |
Logical OR (||) |
| |
X | Y |
Example for Standard C expression |
Example for Modified expression |
(X > 50) || (Y > 20) |
(X > 50) | (Y > 20) |
(X >= 50) && (Y <= 20) |
(X # 50) & (Y @ 20) |
(X != 50) && (Y == 20) |
(X ! 50) & (Y = 20) |
Demo1 file: expression_evaluator_demo1.slx
This example serves as an educational tool to demonstrate how the expression evaluator block functions. Its main objective is to facilitate a clear understanding of the process required to correctly input parameter data in order to achieve the desired result.
Full Model
Build the "demo1" file by compiling the provided demo file. Upon successful deployment of this file to the hardware, proceed to initiate the serial communication software for testing the aforementioned demo. In the software interface, choose the appropriate COM port to establish a connection for data monitoring.
After opening the serial monitor, you will notice that the status is initially set to 0 because the default parameter values do not meet the expression's condition. To test the true condition, please adjust the parameter values as follows to fulfill the expression's criteria.
To satisfy above expression, change the parameter values as below.
After that, rebuild the demo and open the serial monitor.
As illustrated above, the status has changed to 1 because the current parameter values now satisfy the filter expression condition. You can similarly test any expression of your choice and obtain the desired output.