# mod_calc

This module provides a formula editor that allows you to enter custom calculations using defined variables.

## Basic functionality

This is the configuration window for the module, which can be opened by clicking the Calculations > Formula Editor menu item.

The "Defined Formulas" list [1] shows all currently defined formulas. When no changes have been made since the last apply, the list also displays a preview of the current calculation results, otherwise asterisks are displayed.

To add a formula, use the Add button [9]. To remove one, select it and click the Remove button [10].

After adding a formula, the destination variable [2], its description [3] and unit [4] and the calculation formula [5] can be changed. To add a variable to a formula, its name can be placed between braces (eg. "{Demo Sine}"). This can be sped up by double-clicking on the desired value in the listbox below [7]. If the entered formula is invalid, the error indicator [6] turns red. Explanations about possible errors can be found by clicking on the error indicator.

Both dot (.) and comma (,) can be used as the decimal separator.

The "Replacement on NaN" field [8] describes what value the formula should yield, in case of a formula error or if an input parameter was NaN.

## Video Tutorial

## Available functions

The formula editor supports the following functions:

Function | Description |
---|---|

abs(x) | Absolute Value Function |

acos(x) | Inverse Cosine |

acosh(x) | Inverse Hyperbolic Cosine |

asin(x) | Inverse Sine |

asinh(x) | Inverse Hyperbolic Sine |

atan(x) | Inverse Tangent |

atanh(x) | Inverse Hyperbolic Tangent |

ceil(x) | Ceiling Funtion |

cos(x) | Cosine |

cosh(x) | Hyperbolic Cosine |

cot(x) | Cotangent |

csc(x) | Cosecant |

exp(x) | Exponential Function (e^x) |

floor(x) | Floor Function |

int(x) | Round to nearest |

ln(x) | Natural Logarithm |

log(x) | Decadic Logarithm |

log2(x) | Binary Logarithm |

rand(x) | Random value between 0 and 1 (x is ignored) |

sec(x) | Secant |

sign(x) | Sign Function |

sin(x) | Sine |

sinc(x) | Sinc Function (sin(x)/x) |

sinh(x) | Hyperbolic Sine |

sqrt(x) | Square Root |

tan(x) | Tangent |

tanh(x) | Hyperbolic Tangent |