Expressions
Last updated
Last updated
In nSCADA you can write expressions in javascript. Unlike scripts, expressions can take parameters from the environment in which they are used. Environments they are used;
Variable Expression,
Variable Logs,
Alarms,
Alarm Group On-Off-Ack Actions,
Animation Elements,
Expressions are not project dependent. Expressions you write can be used in all projects.
Variable expression is executed during the read, scan of a variable's communication channel. The expression you add to a variable is executed based on the scan period of the Device and Frame to which the Variable is connected.
Variables passed to Expression;
initialValue (Number)
self (object)
As shown in Figure 2, a custom Expression is written in a Variable. In the Expression definition above, we mentioned that you can get parameters from the environment where the Expressions are executed. When you examine the javascript code written in the example in Figure 2, you will see a variable named "initialValue". The variable "initialValue" is a variable that can only be used in Variable, sent to Expression by the inSCADA platform. This variable contains the value of the corresponding Variable.
If you examine the javascript code in Figure 2, it is provided that if the corresponding variable value is less than 10, it will be 1 and if it is greater than or equal will be 0.
Variable Expression is a very powerful and useful feature. In traditional methods, you need to create virtual Variables / Tag for more complex and different calculations of raw data read from devices, then write scripts and process and copy the raw value from Variables / Tags where you read the raw value. However, inSCADA does not allow you to fill your project with untraceable content for such operations. It offers you a more powerful and useful Variable Expression method.
Below are different examples of variable expressions.
Expressions written in variable logs allow the variable value to be saved to the database during the scan period when the result is true.
Below are examples of expression that can be used in variable log.