Functions module enables user to create custom functions that can calculate values, check conditions and do some advanced tasks like PID control. Functions can be used to:
- control physical dynamometer outputs
- trigger actions like CAN message sending or software tasks
- create mathematical channels that show new information in charts
- provide data to be exported to CAN bus
- create PID control loop
Functions can be created in SETTINGS / Functions. Functions are processed every 10ms from the top of the list. The software uses standard conversion from numbers to logical values: 0 = false, value other than 0 = true.
Shortcuts available in function list are:
- N – new function
- Enter – edit function
- Del – delete function
- Alt + Up – move function up – earlier in processing queue
- Alt + Down – move function down – later in processing queue
Generic function configuration contains:
- Name used to create dyno data channel key
- Operator that defines what the function will do
- Arguments that are used by the function – constants or data channels
- Output physical quantity of the function – to provide adequate unit conversions when the function is displayed
The whole function system works on SI units when doing calculations, so you don’t have to worry about unit conversions. You know that Force = Torque / Distance. Just select correct quantity and unit for constants and correct function output quantity (4).
In above example, load cell channel (which is internally in Nm) is divided by distance 30cm (which is converted to 0.3m for internal calculation). The result in N is internally assigned to function, but it is converted to kN for display.
Data channels (variables) can be selected with double click on the variable name field. Only variables that has selected quantity are displayed in the selection list.
Constant values are entered manually.
Example function to control on / off type fan:
The function interface should be interpreted in the following way:
We are creating a function named „Fan control” (1) which uses > greater than operator (2).
Function result (3) = variable (4) of „speed” quantity (5) and key „dyno_speed” must be greater than (7) constant (8) of „speed” quantity (9) value „10” (10) and “km/h” unit (11).
New variable channel created by the function has logic quantity (12). This quantity must be used for functions that will be used to trigger controller outputs, to be visible in selection lists.
A newly created function can be assigned to control physical output in RUN tab.
Running shell commands
Functions module can run custom shell commands. As the Linux shell is very powerful, this enables the software to interact in many ways with other applications or systems. Among the possibilities there are file creation, copying, and interaction with network devices or internet services.
The shell command is executed in background without blocking the application when the function boolean value goes from false to true.