Migrating Driver Models from Calc Engine V3 to V4
Overview
This page describes the process for migrating a model from Calc Engine v3 (referred to as CEv3 from now on) to Calc Engine v4 (referred to as CEv4 from now on). For most cases this should be a relatively straightforward task, however there are some exceptions to this, for example where features in CEv3 are no longer supported in CEv4, or the syntax has changed.
CEv3 is still available and can be kept as the engine running your CEv3 models, so migrating is optional.
All existing driver models will continue to use CEv3. Any new driver models will use CEv4.
Changing Calc Engine Version
It is recommended to do the migration in a clone of your existing model so you have a copy on hand to revert back to if required.
To change the calc engine version, open the Application Properties window. This can be done by right-clicking the model on the Application Manager and selecting Properties or by selecting the model properties gear from within the model as shown below.
In the Properties window, select the Configuration tab:
Add the following line to the configuration as per the example above, also ensuring that a comma has been added to the end of the previous line:
"CalcEngineVersion": 4
To revert back to CEv3, change the 4 in the line above to a 3 or alternatively remove the “CalcEngineVersion” line.
Node Types Removed
Some node types have been removed in CEv4. When an unsupported node from CEv3 is used, and converted to CEv4 the UI will display an error indicating the node type is no longer supported:
Monte Carlo and distribution nodes
Distribution nodes are not supported by CEv4 and have been removed. An alternative is to use the new random calculations from section Functions & Operators.
Spreadsheet Nodes
Spreadsheet Nodes/Spreadsheet Input Nodes/Spreadsheet Output Nodes are not supported by CEv4. If your CEv3 model contains Spreadsheet Nodes, you will need to replace these with other node types. If your spreadsheet nodes contain only numbers (i.e. have no formulas), consider using Asset Nodes, Numeric Nodes, Timeseries Nodes or Datasource Nodes as a replacement. If your spreadsheet nodes contain model logic (i.e. have formulas), you will need to extract that logic into calculation nodes.
Changes in Syntax
CEv4 implements a few changes in syntax to enforce a stricter standard when writing calculations. If your calculations work in CEv3 but error in CEv4, check this section for known changes in syntax in CEv4.
Function parameters need to be explicitly passed as strings
CEv3 treats any text in between commas in a function call as a string and supports the following call:
datasource([Cost Data],value,average,true,0, Item, test item)
In CEv4 this throws an invalid syntax error, and would require the user to put quotes around the parameter to succeed as per below:
datasource([Cost Data],value,average,true,0, Item, "test item")
This will happen for all non number/letter characters present in these parameters. This will mostly affect datasource calls as the filtering function is free text.
Node names in calculations cannot have leading or trailing spaces in them
CEv3 accepts node names in calculations with leading and trailing spaces.
For example, the nodes “My Value” and “My other value” could be called in a calculation as:
[ My value] + [My other value ]
In CEv4 the matching is stricter and will not accept this:
[My value] + [My other value]
Single word node names cannot be called without square brackets
In CEv3, it is possible to reference single-word node names in calculations with and without using square brackets. For example, a node called “MyValue” can be referred to as follows:
MyValue + 3
This is not supported in CEv4. Square brackets are required when referencing nodes in calculations as follows:
[MyValue] + 3
Dynamic Functions
Some of the new functions for CEv4 are dynamic, in that they dynamically build their inputs based on the connected inputs
rather than having to fix the inputs in the calculation string. This is useful for building components, or knowing there may be new nodes in the future.
Functions that support dynamic inputs will be labelled as such in the documentation. To use them, simply leave the calculation with no parameters (e.g. array()
).
The order nodes are laid out on the page matters for dynamic functions, such as node groups and arrays. When referencing nodes by index, the order the nodes are listed is determined from their positions on the driver model canvas - first by the y-axis, then by the x-axis.
Some of the special calculations (e.g. those that hold multiple values, such as arrays, component inputs or python nodes) don’t display the individual values like in calculation engine v3. These cannot be used directly in calculations and must be called upon by their helper nodes.