DIAdem Help

Creating a Calculation Script with Debug Option

  • Updated2024-09-12
  • 2 minute(s) read

Creating a Calculation Script with Debug Option

Use calculations to create and to execute templates for recurring, user-defined formulas.

In these formulas you connect inputs that reference values, variables, or channels and store the results in outputs that reference variables or channels. You only can define single-line formulas. To define a multi-line specification, switch to the Extended mode and enter the calculation script instead of a formula. The easiest way to create and to test a calculation script is in the script editor in DIAdem SCRIPT.

To create a calculation that contains a multi-line calculation script complete the following steps:

Note  For this example, delete all the data in the Data Portal and load the data file Example.tdm from the user folder.
  1. Select DIAdem ANALYSIS.

  2. Click Calculation Manager on the toolbar.

  3. Click New to delete the current calculation set.

  4. Click Add Calculation to create a new calculation.

  5. Enter the name of the calculation, for example, Distance relative, in the subdialog box.

  6. Click Add Input in the Inputs area to create an input for the calculation.

  7. Enter t as the Name , select Channel as the Data Type, and select the channel [1]/Time as the Reference.

  8. Click Add Input in the Inputs area to create an input for the calculation.

  9. Enter t as the Name , select Channel as the Data Type, and select the channel [1]/Speed as the Reference.

  10. Click Add Output in the Outputs area to create an output for the calculation.

  11. Enter Srel as the Name , select Channel as the Data Type, and enter the channel [1]/Distance relative as the Reference.

  12. Click Extended to switch the calculation into the extended mode.

  13. Click Execute so that DIAdem creates the inputs and the outputs.

  14. Click Copy script to the clipboard to edit the calculation script.

  15. Click OK to close the dialog boxes.

  16. Select DIAdem SCRIPT.

  17. Click New File on the toolbar.

  18. Add the contents of the clipboard to the script editor.

  19. Enter the Calculation script which calculates the integral of the speed between Calculation Script Begin and Calculation Script End:

    VBScriptPython

     

    Call ChnIntegrate(t, V, Srel)
    Call ChnUnitConvert(Srel, Srel, "mm")
  20. Click Run Script or Debug Script on the toolbar to test the script or to debug the script.

  21. Select the rows between Calculation Script Begin and Calculation Script End and paste these rows with <Ctrl C> to the clipboard:

  22. Select DIAdem ANALYSIS.

  23. Click Calculation Manager on the toolbar.

  24. Click Edit Calculation.

  25. Click Extended to switch the calculation into the extended mode.

  26. Insert the contents of the clipboard with <Ctrl V> into the Calculation Script.

  27. Click Execute to start the calculation.

  28. Click OK to close the dialog boxes.