Dyno2 Dynamometer Software – custom functions

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:

  1. Name used to create dyno data channel key
  2. Operator that defines what the function will do
  3. Arguments that are used by the function – constants or data channels
  4. 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.

Shell command example in function.

The shell command is executed in background without blocking the application when the function boolean value goes from false to true.

Equations

To speed up creation of a function that operates on multiple variables, the function can be defined as an equation.

Functions and operators available for use in equations:

NameArgc.Explanation
sin1sine function
cos1cosine function
tan1tangens function
asin1arcus sine function
acos1arcus cosine function
atan1arcus tangens function
sinh1hyperbolic sine function
cosh1hyperbolic cosine
tanh1hyperbolic tangens function
asinh1hyperbolic arcus sine function
acosh1hyperbolic arcus tangens function
atanh1hyperbolic arcur tangens function
log21logarithm to the base 2
log101logarithm to the base 10
log1logarithm to base e (2.71828…)
ln1logarithm to base e (2.71828…)
exp1e raised to the power of x
sqrt1square root of a value
sign1sign function -1 if x<0; 1 if x>0
rint1round to nearest integer
abs1absolute value
minvar.min of all arguments
maxvar.max of all arguments
sumvar.sum of all arguments
avgvar.mean value of all arguments
OperatorDescriptionPriority
&&logical and1
||logical or2
<=less or equal4
>=greater or equal4
!=not equal4
==equal4
>greater than4
<less than4
+addition5
subtraction5
*multiplication6
/division6
^raise x to the power of y7
OperatorDescriptionRemarks
?:if then else operatorC++ style syntax