Create calculations
- Last UpdatedAug 11, 2025
- 6 minute read
To create a calculation from the Constraints and Alerts page:
-
From the Manage Group of the Home ribbon tab, click the Add button. This will open the Create New Calculation dialog box.
-
Enter a Name for the calculation.
-
(Optional) Choose a Type for the calculation. See Calculation types for more information.
-
(Optional) Select the unit of measure of the calculation result. First choose the appropriate UoM Category, then choose the UoM itself.
Tip: If you do not enter a unit of measure, when you write the calculation formula Plan will alert you that the final UoM is incorrect, and allow you to set it based on the result of your calculation.
-
Click the
button to choose one or more variables to use in your calculation. See for more
details. Based on the variable type you choose from the menu, a different dialog box
opens, allowing you to define all the parameters of the variable.
-
Once all the variables are defined, write the formula defining the calculation result in the Formula text area. If there are any errors in the definition, such as misspelled or unknown variable names, the expression parser highlights the potential errors.
Tip: See Writing Formulae for more information on the correct syntax and available operators for writing formulae.
If the calculation result is not compatible with the unit of measure you have selected for the calculation, or if you have not selected a unit of measure, a warning appears at the bottom of the window. A button under the UoM drop-down menu allows you to set the calculation unit of measure to a compatible value.
-
(Optional) Open the Constraints tab and enter any of the following:
-
Either a minimum and/or maximum Constraint value that the calculation results cannot exceed, or a Fixed value that the calculation result must meet.
-
A minimum and/or maximum value that results in a Warning being generated if the calculation result exceeds the allowed range.
-
A minimum and/or maximum value that results in an Error being generated if the calculation result exceeds the allowed range.
Note that you can also enter these values in the Constraints and Alerts page, after you have added the calculation.
-
-
(Optional) Enter a description for the calculation in the Description tab. As with the constraints, you can also do so in the Constraints and Alerts page, after you have added the calculation.
-
Click OK. This will add the calculation to the table in the Constraints and Alerts page.

Add multiple variables
Select Add multiple variables to easily add multiple variables of the same type, without having to exit the dialog window.

When you select the option, the OK and Cancel button change to Add and Close. Click Add whenever you want to add a new variable based on the current settings. Click Close to leave the dialog box once you have finished adding variables.
Variable names and symbols
When creating a variable, you may enter a Name and Description in the corresponding text fields of the Variable Editor dialog box. You must also enter a Symbol, which is the label that will identify the variable in your formula. Variable symbols must follow stricter rules than names and descriptions:
-
Symbols are case sensitive. Unit_Capacity and unit_capacity are different symbols representing different variables.
-
Symbols cannot contain spaces. Unit Capacity is not a valid symbol. Either use underscores for spaces, or use CamelCase for names: Unit_Capacity or UnitCapacity.
-
Symbols must start with a letter, not a number, but can have numbers anywhere else within their names. 2Unit_Capacity is not valid, but Unit2_Capacity is valid.
-
Symbols cannot contain special characters or mathematic operators, including *, \, /, +, -, =, <, >, [, ], (, ), @, &, !, ?, ", '.
Symbols can only contain characters from the standard ASCII character set. Characters such as à, ç or ß are not supported.
Duplicate calculations using copy and paste
You can quickly duplicate your calculations by copy and pasting them into the cells on the Constraints and Alerts page. Note that when pasting formulae:
-
The formula variable names must exactly match the variable names already registered for the calculation. You cannot add new calculation variables when pasting.
-
The pasted formula is not validated at paste-time, which means it is possible to enter invalid formulae. When the model is then optimized, an error will be generated if the formula cannot be parsed.
Avoid division by zero
Where possible, rewrite your calculations in a form which can never have zero in the denominator.
For example, imagine a constraint limiting the total cracked feed to a distillate hydrotreater to less than 25%. This could be expressed as:
-
flow cracked feed/total flow <= 0.25
Since it is possible for the total flow of the unit to be zero, this calculation could become infinite, which may disrupt the optimization. Instead, it is better to rewrite the equation as:
-
flow cracked feed - 0.25 * total flow <= 0
Avoid property calculations in blend index space
Imagine you have the constraint:
-
CDU Feed Viscosity @ 100°C < 5 cSt
As viscosity is a non-linear blending property, it typically has a blend rule associated with it. As a result, this equation is internally converted into its correct form by wrapping the calculation terms in the necessary blend index, which adds extra structure into the optimization.
Where possible, avoid calculations of this form during optimization. Calculations may still be present, but deactivated and will be evaluated during post-optimization simulation (but obviously not constrained).
Where calculations of the above form are used, Plan automatically converts all the terms into their blend index equivalents rather than wrapping the formula, hence:
-
CDU Feed Viscosity @ 100°C < 5 cSt
becomes:
-
CDU Feed Viscosity @ 100°C < 19.2 refutas
where refutas is the blend index unit for viscosity. This means the property value is obtained in blend index space automatically, and the constraint terms are converted into their blend index space equivalent values, and used during optimization. The final solution results are still reported in engineering space.
Test your calculations
After entering a calculation, it is recommended to optimize your plant model, and review the solution to check the calculation value seems sensible. This can be achieved by either:
-
entering no constraints and running the model
-
entering constraints, but deactivating the calculation so it is not used for optimization, and then running the model.
It is advised to check the calculation solution seems correct and has the right order of magnitude. To do this, open the calculation and review the variable values to ensure each component variable has a sensible value.
Note: It may not be necessary to test structural calculations. Structural calculations are constraints which control model behavior rather than constraining the solution. For example, you may have an operating parameter for an hydrotreater based on the percentage cracked feed, and you may constrain this to be equal to the percentage of cracked feed via a calculation. This is a structural calculation, as it controls the process model behavior and removing it would not lead to a fair and valid solution. For structural calculations, check the formulation carefully after entering and inspect the solution marginal value to check for any errors.
After optimization completes within the Calculation Editor, the value of each variable in the final solution is shown in the selected unit of measure. This can be used to help understand the calculation solution value, and potentially debug the model and marginal value.
