Calculation module in detail

After having downloaded the calculation module and you doubleclicked on the exe file (modcalc.exe), the RedMill calculator is able to access it and to activate its features.

The calculation module is accessible over the corresponding menues in the calculator. With the calculation module you can:

- define your own calculations
- request entries from the user when executing the definition
- make calculations including complex formulas
- define algorythms
- check for conditions
- read and write data from and to the calculator
- and create your program rendering your result from the definition upon execution.
- send the results back to the calculator or into MS Excel

With the calculation module you can "program" your calculations in a simple way without needing to know any program languages. Click together your calculations and call them from the menu in the calculator.

The calculator as well as the calculation module is free of advertising, and downloadable for free under the GNU General Public license.

Additional information
The calculation module serves for defining your own calculation. Normal calculation applications only provide given caclulation. In the RedMill calculation module you can define your own calculations and let the calculator execute them.

Your definitions will be stored in a definition file. The RedMill calculator (or one other application) can call the definition and execute it.

Installation
In order that the RedMill cacluclator or other applications can work with the calculation module, it must be installed first. This is done by doubleclicking the EXE-File. The installation process is communicating to the Calculator that the module is now available. In the same moment the interest rate definition and the prorata defintion will be written and made ready for execution.

Create a new definition
The most important thing with creating a new definition is the indication of the Variables in each Step. A variable is a name, under which a value can be stored. By using a variable you can calculate with values simply by using the names of the variables, regardless of their content.

In your definition you want values to be computed and to be printed out. Therefore it is important to indicate in each step, in which variable the computed value is to be stored. So the result of each computation must be stored somewhere.

User should enter something
You can state fixed values for your computation. This is however unflexible because you could have to change the definition for any other values. It is much easier to let the user enter the current value at the time when the calculation is being executed. The computation will then take place with the new values.

Pro Rata Temporis
This calculation returns the number of days between two dates which the user enters when executing the definition. Upon creating the definition you can decide which terms should be used, i.e. if you like to use the real days or the bank days. The latter means that the year has 360 days and every month 30 days. With the bank option a prorata 1.2.03 - 28.2.03 returns 30 days.

Store a value
This is exactly if you like to work with a fixed initial value (e.g. pi is 3,14)

Read Calculator value
You calculated somehting in the RedMill calculator and like to use the current calculated value in your definition (for example for a rebate calculation).

Start Algorythm
The Algorythmus is a "loop computation". Everything standing between the starting and termination-line will be carried out x times. You can state the starting point and the end point. The difference of it is the times of execution. In addition, Algorythms can be steered dynamically, e.g. if the initial value is specified by a variable changed during this computation.

Terminate algorythmus
With the "End"-line you do not terminate the algorythms itself because that is steered by the start and end point (thus number of runs of the loop). The termination-line describes however, which operations do not belong to the algorythm.
Example:
in this example 3 results with the current value will be printed out:
Var1 = 1 ForA 3 startpoint 1, endpoint 3 (Loop runned through 3 times)
Var2 = Var2 + 1 Actual Calculation (count 1 plus the value in Variable2 and store it in Variable2)
= Var2 Print (Result) Print out value in Variable 2
= EndA Loop-end

in this example only one result with the last value will be printed out:
Var1 = 1 ForA 3 startpoint 1, endpoint 3 (Loop runned through 3 times)
Var2 = Var2 + 1 Actual Calculation (count 1 plus the value in Variable2 and store it in Variable2)
= EndA Loop-end
= Var2 Print (Ergebnis) Print out value in Variable 2

Calculate something
With a calculation you can use the normal operators as +, -,/ (divided) as well as * (times), % and sqrt (root). The result must be stored in a variable. The choice of the variable is important especially in an algorythm, because the computation is done again and again.

The following example would bring the result 1, even if the loop was carried out 99 times:
Var1 = 1 ForA 3 startpoint 1, endpoint 3 (Loop runned through 3 times)
Var3 = Var2 + 1 The Variable3 stores in each case 0 + 1 as Var2 is never touched
= EndA Loop end
= Var3 print (result) print out Value in Variable2

Note for the operators SQRT and %. With the "root" and with % only the first indicated value can be changed. A Var1 = Var1 % Var1 is useless, as a percent is not an actual operator.

Enter a formula
The advantage of a formula is that you can use various calculations in one sentence without using different steps. You can define your own formula at your needs. The calculation module checks the formula when executing and allocates priorities to the operations. Operations within brackets are assigned a higher priority. The rule Multiplication/Divison before Plus/Minus is also applicated. When entering a formula you will also have more functions available as when using the option "Calculate something". With a doublecklick on the formula you can switch to advanced mode. There you can enter or modify your formula directly. Please note that between every operator or value a backslash has to be put. A formula like Var1*3% looks in the advanced mode like this: Var1\*\3\%\ .

Print out something
The best computation does not use anything, if you cannot get a print out of the result. With that command you can select upon storage of the definition whether the result should be given back into the Calculator or into MS Excel. If you want to continue to calculate with the current result, use the command "overwrite calculator value" (eventually in addition to the printout).

Overwirte Calculator value
With this instruction the value of the indicated variable will be handed over to the RedMill Calculator so you can use it to continue work and do calculations based on the returned value.

Open Condition
Perhaps you would like to examine whether a value fulfills a condition. Perhaps you have in a calculation of interest rate a higher rate starting from a certain amount. By this instruction you can examine whether the computed amount exceeds 100'000 (for example) and to increase the interest rate (stored in a variable). The instructions standing between If and EndIf are executed only if the condition applies.

Condition close
After the end point of the condition again all instructions are executed.

Change active line
Here you can modify an entered line.

Call a function script
Maybe you would like to define a calculation where a part is executed at several places in the definition. Instead of writing all the lines again and again, you can create a separate definition and store it as a function script. Then you will be able to integrate this script in your defintion. So you will only have to state at these places which function script should be executed and which values should be handed over. The functionscript itself will return the value stored in Variable 9. So at the end of your script you will have to store the value to be given back to the main definition in Var9. Note: All print out commands will be ignored in a function script.


Store definition
Your definition is stored in a file (e.g. interest.cld). You can name both, the file and also the menu option in the RedMill Calculator. If you would like to store the definition as a function script, activate the corresponding option.


Change a definition
You can call a defintion to be modified out of the RedMill calculator.

Delete definition
If you like to delete a definition, you have to the chose if you like to delete the menu only or if you also want to delete the file. If you delete the menu-entry only, the file will be left untouched and you can import it again later.


Import a defintion file
If you like to transfer a definition file to another computer or import a "deleted" definition back to work, you can tell the Calculator to show the import selection from where you can import the definition. The definitions need to be stored in the same place as the calculation module.

Use the calculation module for other applications Are you programming an application and would you like use the calculation module in your application? The calculation module is developed in a way that it can be called independently of the Calculator. If you know the interface it is very easy to exchange the instructions and results. You may use the calculation module according to the GNU General Public License (GPL) directives or also under a separate license agreement against a fee.