Calculation Configuration

From SysCAD Documentation
Jump to navigation Jump to search

Navigation: User Guide -> Project Configuration (cfg File) -> Calculation Configuration

Project Configuration
(Main Page)
Model Selection General Configuration Species Configuration Species Properties Configuration Calculation Configuration Size Configuration

Related Links: Examples of Entering Calculations, Material Flow Section, ETip: User Species Calculations

This page is for SysCAD 9.3 Build 137 only. For earlier builds, please see Calculation Configuration 9.3


Edit Configuration Step 2 of 2 - Calculation Tab

Introduction

This tab page allows the user to create and organise a list of custom calculations for projects using the configuration file. The calculations are normally for streams, but will also be applicable to units with content, such as tanks in a Dynamic project.

There are two types of calculations which can be defined:

User Property Calculations

  1. The calculations are not meant to represent 'species', but rather some property of the stream, for example:
    • Ratio of H:N in the stream, or
    • Ratio of the Individual Phases Aqueous:Organic.
    • Calculated property such as pH, Viscosity, etc.
  2. These calculations will appear on the Qi/Qo/QFeed/etc tab page. These calculations will also appear on the content tab page in dynamic units with surge.
  3. If the Separate Tab tick box is checked, then the User Property Calculations will appear on a separate tab called User. This is recommended if there is a long list of calculation.
  4. When entering the conversions to be used for display, these should be as they would be seen in a stream (eg Qm for massflow). In dynamic where the property appears in the contents, SysCAD will automatically use the conversions that are not time based (eq Qm for massflow becomes M for mass).

Species Calculations

  1. These calculations are usually used to represent calculated values as 'species', for example:
    • Fe++ - which will then be available for reporting as the Ferrous 'species', or
    • U3O8 - all uranium in a stream displayed as the 'species' U3O8.
  2. The calculated value will change as the user changes from mass to volume view etc. For example:
    • If the user selects 'Mass Flow' they will see the mass flow of Fe++, or
    • If the user selects 'Species Conc' they will see the concentration of Fe++.
  3. These calculations will appear on the Sp tab page together with the stream composition. These calculations will also appear on the content composition tab page in dynamic units with surge.
  4. The order of the species calculation variables can be changed on the Edit Configuration dialog box - Species Tab.

Notes:

  1. The calculated values will be displayed in all streams in the projects.
  2. The calculated values are a function of the individual stream, i.e. you cannot use values from other streams or units in the calculation.
  3. You may display the actual formulas for the calculations on each stream page, next to the calculated value as a comment. Please see Plant Model - Views.
Add calculations here for values that will represent a 'Property' of the stream, e.g. ratio of elements, entrainment, etc.Add calculations here for 'pseudo' species, e.g. U3O8equivalent, FerricIon, etc.The user enters the expression for either a User Property or Species calculation in this window.Cfg-Custom Calculations137.png
About this image
  • When you have finished editing the calculation configuration tab, you must click on the OK button to accept all of your changes, or the Cancel button to discard all of your changes.

Custom Calculations versus Model Procedures or PGMs

Custom Calculations are much more efficient than calculations in a PGM or MP file for the following reasons:

  • The user need only define them once in the configuration file and they are immediately available in every stream view, including in QFeed, QProd and streams in unit operations;
  • There is no need to define which streams should have the calculation, as they are automatically in all streams regardless of tag changes, new models & pipes, etc. The user needs to define which streams have a calculation if they use PGMs or MPs;
  • Calculations are defined once in the configuration file and they are then available for use and display in all projects using the same configuration file.
  • Custom calculations are only performed "on demand" - i.e. the work is only done if the tag is currently displayed on the screen (e.g. access window) or referenced (e.g. controller);
  • Execution speed is faster because:
    (a) The calculations are only evaluated when needed; and
    (b) If a PGM or MP is used the calculations are evaluated every iteration and hence it is far less efficient.

General

This section describes the features of calculations which are common to both Species Calculations and User Property Calculations.

The user may add any number of calculations to the configuration file. They are displayed in SysCAD like all other tags and can then be referenced for use in controllers or reported in Excel reports.

Examples of calculations that may be used are:

  • Ratio of two species or elements,
  • Flow of particular ions, such as Ferric or Ferrous,
  • Flow of a species or elements shown as an equivalent flow of another species - e.g. NH3 shown as Nitrogen equivalent.

Adding a New Calculation to the Configuration File

  1. On the Calculations tab page, click on the appropriate Add button, depending on if a Species Calculation or User Property Calculation is required.
  2. A new calculation with a default name such as CalcXX or PropXX appears in the appropriate list. The user may click on this and type in the required calculation name. Note: Calculation names may NOT have spaces and must be unique.
  3. The actual expression for the calculation may be inserted into the 'Expression' window.
  4. The user may type the required expression, or click on the 'Terms' button and insert any of the expressions shown in the list by double clicking on the required expression or by selecting and pressing OK.
  5. When typing in the expressions manually, please ensure that terms are enclosed in square brackets.
  6. The User Property Calculations can be displayed on its own tab page if the Separate Tab tick box is checked. User can add Labels to separate out groups of tags to make them easier to read on the access window.
  7. The options for type of conversion units (Cnv Type) are different between the two types of calculations and will be explained the sections below.
  8. The check box Concealed may be used to create a calculation hidden from the user in the access window. This is useful as an intermediate result to be referenced in other calculations.
  9. The options for where the calculation will be displayed are different between the two types of calculations and will be explained the sections below.
  10. When the user has finished entering the calculation expression they can check that there are no syntax errors by clicking on the Check button. This will place a ! next to any calculations that have errors. Note: If the user does not check expressions, and then loads a project, SysCAD will check the expressions at load time and will NOT load the project if there are any errors in the calculations. The user will receive an error message in the Messages window.

For a more detailed explanation of how to enter calculations, see Examples of Entering Calculations.

Editing and Removing Calculations

To edit a previously defined calculation, select it from the list. It can be renamed by clicking on the current name and the expression can be edited in the expression window.

To remove a calculation, select the calculation in the list and press the Remove button. If this is pressed by mistake, press the cancel button at the bottom of the window and this change will not be saved.

Operators Allowed in Calculations

The main operators used in calculations are addition (+), subtraction (-), multiplication (*), division (/) and power (^).

Opening '(' and closing ')' brackets can be used when defining calculations.

Comparison operators >, >=, ==, <>, <= and < can also be used. The result of a comparison operation will be 1 (for true) or 0 (for false).

Useful Functions Allowed in Calculations

The conditional If function is very useful to perform a function based on a criteria or simply return a zero. It can also be used to prevent divide by zero and meaningless results.

Functions such as Range, Min and Max can be used to keep the terms or results of functions valid, including avoiding silly results from a divide by zero.

Mathematical functions such as Sin, Cos, Ln, Abs, etc are available.

Expressions Allowed in Calculations

Clicking on the Terms button will open a dialog box which contains a list of all available expressions, including all species in the configuration file and any previously defined calculations. Double clicking on any of these expressions will add it to the Expression window. Alternatively, the user may define a calculation by typing in the expressions.

The allowed expressions are different between the two types of calculations and will be explained fully in the sections below.

Quick links to the Expressions Tables:User Property Expressions, Species Calculation Expressions.

User Defined Constants

SysCAD allows a limited number of user defined variables (12 maximum) to be used in the custom calculations. These variables are called Project User Values (PUV) and are defined in the Plant_Model - Project Tab. These PUVs can be manipulated by the user during a project solve without having to go back to the calculation tab to adjust them. Useful for data/equation fitting. These are shown in Red highlight in the picture below.

NOTE: The Project User Values are only available in SysCAD 9.2 Build 135.15897 or later.

The standard SysCAD terms available for user calculations.The user may enter values in the Plant Model that are accessed by user calculations. These may also be set from a PGM.Text at the bottom of the window explains the term highlighted by the user.Calculations PUV.png
About this image

Other predefined variables use can manipulate are the Environment Function constants. These are defined in the Plant Model - Environment Tab.

User Property Calculations

The user may add any number of User Property Calculations to the configuration file. These calculations will be displayed at on the Qi/Qo tab of the pipe Access Window in SysCAD. They will also be shown on the Content tab of dynamic units with surge. The calculations will only change when the stream changes.

Example Calculation Returned Value Notes
Example 1:
Calculating Flow of a single compound
SteamMassflow = m:[H2O(g)] returns the mass flow of steam.
SteamVolflow = v:[H2O(g)] returns the volumetric flow of steam.
SteamMoleflow = ml:[H2O(g)] returns the mole flow of steam.
Example 2:
Calculating flow of a single
Phase Occurrence (ie: s, l, g)
TotalSolidMassflow=m:SumPhase(s) returns the mass flow of all solids Only three phase occurrences are allowed, s, l, g
If an individual phase is required, please see Example 3 below.
TotalLiquidMassflow=m:SumPhase(l) returns the mass flow of all liquids
Example 3:
Calculating flow of a single
Individual Phase (eg, slag / aq / or)
TotalAqueousMassflow=m:SumIPhase(aq) returns the mass flow of the aqueous individual phase only. NOTE: The individual phase is user defined, the individual phase description may vary.
TotalOrganicMassflow=m:SumIPhase(or) returns the mass flow of the organic individual phase only.

For a detailed explanation of how to enter a User Property Calculation, refer to Examples of Entering Calculations.

User Property Terms

Clicking on the Terms button will open a dialog box which contains a list of all available expressions, including all species in the configuration file and any previously defined calculations.

Double clicking on any of these expressions will add it to the Expression window. Alternatively, the user may define a calculation by typing in the expressions.

For convenience, the terms are grouped into five groups of terms:

  1. Mass - species terms are based on mass flow and have a prefix of m:
  2. Moles - species terms are based on molar flow and have a prefix of ml:
  3. Volume - species terms are based on volume flow and have a prefix of v:
  4. NVolume - species terms are based on normal volume flow and have a prefix of nv:
  5. Molecular Wt - the molecular weight functions for all species and all elements within the project

The first four groups of terms are almost identical except that each species term has a different prefix to indicate the basis. The following functions maybe be used:

  1. SumPhase (sum of phase occurrence - only three phase occurrences are allowed: s, l, g)
  2. SumIPhase (sum of individual phase - user defined individual phases are allowed, eg: aq, or, slag. Not available for volume calculations)
  3. SumElemPhase (sum of the specified Element in the phase occurrence - only three phase occurrences are allowed: s, l, g. Not available for volume calculations)
  4. SumElemIPhase (sum of the specified Element in the individual phase - user defined individual phases are allowed, eg: aq, or, slag. Not available for volume calculations)

Previously defined calculations are also shown for the first four groups of terms.

The group of terms displayed in the Terms dialog box is dependent on the user selecting the desired group at the bottom of the box (see dialog box below).

Standard Range and Maths functions that can be used in a calculation.Properties of the stream that can be used in a calculations, e.g Stream Temperature, Pressure, etc.Properties of the selected Species, H2O(l) (shown in top LHS), e.g. Density, Molecular Weight, Vapour Pressure, etc.Properties of the selected Species, H2O(l) (shown in top LHS), e.g. Mass Flow, Molecular Flow, Enthalpy, etc.Phase or Individual Phase Mass, Mole or Volumetric flows.Properties of the selected Element, S (shown at top centre), e.g. Molecular Weight, Mass Flow by phase, etc.Properties of the selected Element, S (shown at top centre), e.g. Molar Flow by phase or Individual phase.General constants, including user defined variables (available in Plant Model).Environmental constants, accessable from the Plant Model).The required Species - selected from a drop down list of all species in the project.The required Element - selected from a drop down list of all elements used in the project.Calculations3.png
About this image

The top line of the Terms dialog box are filters:

OPTION TYPE DESCRIPTION NOTES
Species List Box Use this box to select the required species This is used by the Species Functions group
Element List Box Use this box to select the required element This is used by the Elemental Functions group
Phase List Box Use this box to select the required phase This is used by the Stream Functions, Phase and Elemental Functions group
With T and P Tick Box select this tick box if the expression requires user defined Temperature and Pressure

The allowed expressions are shown in the User Property Expressions Table. Please refer to this table for explanation of all the available expressions and some simple expression examples.

User Property Conversions

User Property Calculations will always be displayed on the Qi/Qo tab page. The calculation will not change as a result of a change of view. The user has the ability to define the conversion type of the calculated value using the Cnv Type drop down box. The list of available conversion types will include all quantities defined in SysCAD, such as mass flow (Qm), volume flow (Qv), fractional (frac), etc. See Conversions Table for a list of available conversion types.

SysCAD assumes all calculation results are in terms of SI units. The default SI units used are displayed in brackets.

User Property Display

The User Property Calculations will all appear in a group on the Qi/Qo tab page. The order in which they will appear on the page will match the order they are displayed in the list on the Calculations tab page. The user may change the order of the calculations using the Move Up and Move Down buttons which appear next to the list.

Examples of User Property Calculations

Expression
Cnv Type
Description
Aqueous:Organic = v:SumIPhase(aq)/v:SumIPhase(o) (None) Ratio of aqueous volumetric flow to organic volumetric flow. The Cnv Type selected is None as the calculation is dimensionless.
Ferrous = m:[FeSO4(aq)] * MW(Fe)/MW(FeSO4(aq)) Qm The mass flow of ferrous ion. The Cnv Type is Qm (mass flow), so that the displayed value will have units of mass flow which can be changed.
Sulfate = (m:[Fe2[SO4]3(aq)]/MW(Fe2[SO4]3(aq)) * 3 + m:[FeSO4(aq)]/MW(FeSO4(aq)) + m:[H2SO4(aq)]/MW(H2SO4(aq))) * MW(S1O4) Qm The mass flow of sulfate ion. The Cnv Type is Qm (mass flow), so that the displayed value will have units of mass flow which can be changed.
Ferrous:Sulfate = Ferrous/Sulfate (None) The ratio of ferrous ion to sulfate ion. The Cnv Type selected is None as the calculation is dimensionless. Note: Both Ferrous and Sulfate must have been defined before using them in a calculation.
PercentSulfate = Sulfate/m:SumPhase(s,l)*100 Frac (%) The percentage of Sulfate ion in slurry (both solid and liquid phases). The Cnv Type is set to 'Frac' with a Cnv ID of %. At run time the user may change the displayed view to any of the fractional conversions allowed. Note: Sulfate must have been defined before using it in a calculation.
MolFlow_DryGas = ml:SumPhase(g) - ml:[H2O(g)] QKgMl The molar flow of dry gas. The Cnv Type is QKgMl (molar flow), so that the displayed value will have units of molar flow which can be changed.
NitrogenEquiv = m:SumElemIPhase(N,aq)*MW(N) Qm Mass flow of aqueous species containing nitrogen (ammonia) compounds displayed as the nitrogen equivalent. The Cnv Type is Qm (mass flow), so that the displayed value will have units of mass flow which can be changed.
Alumina Properties Examples More examples of the Alumina Properties replicated using Calculations

Species Calculations

The user may add any number of Species Calculations to the configuration file. These calculations will be displayed on the species flow tab of the pipe Access Window in SysCAD. They will also be shown on the Content composition tab page of dynamic units with surge. The calculations will change as the user changes from mass to volume view etc.

For example, if the user creates a calculation called Steamflow = [H2O(g)], then:

  • in the mass flow view: this will display the mass flow of steam
  • in the mass frac view: this will display the mass fraction of steam
  • in the volume flow view: this will display the volume flow of steam
  • in the volume frac view: this will display the volume fraction of steam
  • in the mole flow view: this will display the molar flow of steam
  • in the mole frac view: this will display the molar fraction of steam

For a detailed explanation of how to enter a Species Calculation, refer to Examples of Entering Calculations.

Species Terms

Clicking on the Terms button will open a dialog box which contains a list of all available expressions, including all species in the configuration file and any previously defined calculations.

Double clicking on any of these expressions will add it to the Expression window. Alternatively, the user may define a calculation by typing in the expressions.

For convenience, the terms are grouped into View terms and Molecular Weight terms.

  1. View terms include individual species flows, functions such as the ones listed below as well as other user defined calculations.
    • SumPhase (sum of phase occurrence - only three phase occurrences are allowed: s, l, g)
    • SumIPhase (sum of individual phase - user defined individual phases are allowed, eg: aq, or, slag)
    • SumElemPhase (sum of the specified Element in the phase occurrence - only three phase occurrences are allowed: s, l, g)
    • SumElemIPhase (sum of the specified Element in the individual phase - user defined individual phases are allowed, eg: aq, or, slag)
  2. Molecular Weight terms include the molecular weight functions for all species and all elements within the project.

The group of terms displayed in the Terms dialog box is dependent on the user selecting the desired group at the top of the box (see dialog box below).

Standard Range and Maths functions that can be used in a calculation.Properties of the stream that can be used in a calculations, e.g Stream Temperature, Pressure, etc.Properties of the selected Species, FeSO4(aq) (shown in top LHS), e.g. Density, Molecular Weight or Mass flow.Phase or Individual Phase flows.Molecular Weight of the selected Element, Fe (shown at top centre).Phase or Individual Phase flows of the selected Element, Fe (shown at top centre).General constants, including user defined variables (available in Plant Model).Environmental constants, accessible from the Plant Model).User defined calculations.The required Species - selected from a drop down list of all species in the project.The required Element - selected from a drop down list of all elements used in the project.Calculations2.png
About this image

The top line of the Terms dialog box are filters:

OPTION TYPE DESCRIPTION NOTES
Species List Box Use this box to select the required species This is used by the Species Functions group
Element List Box Use this box to select the required element This is used by the Elemental Functions group
Phase List Box Use this box to select the required phase This is used by the Stream Functions, Phase and Elemental Functions group
With T and P Tick Box select this tick box if the expression requires user defined Temperature and Pressure

The allowed expressions are shown in the Species Calculation Expressions table. Please refer to this table for explanation of all the available expressions.

Species Conversions

Species Calculations will always be displayed on the Species Flow tab. The user may change the view of this page between Mass Flow, Mass Fraction, Concentration, etc. The user has the ability to define the way in which the UNITS of the calculated value are displayed using the Cnv Type drop down box. The three options for Cnv Type for a Species Calculation are described in the table below. NOTE: The Cnv ID drop down will only be available if the Frac Cnv Type is chosen.

Type
Description
Example of when to use this Type
Notes
FromView The conversion type will change as the species view changes.
Eg. if Mass Flow is chosen, then conversion type will be Qm (mass flow).
[H2O(g)] The units and calculation will change with the view, mass flow, volume flow, etc.
None There will be no units for this calculation. This is used for dimensionless calculations such as a ratio of two quantities with the same conversion type. [H2SO4(aq)]/[H2O(l)] This is a dimensionless ratio, it will be a ratio of mass flows, or ratio of volume flows, etc.
Frac The calculation is a fraction of a total. The calculation result will not follow the display view, but the user may display the result as any of the units within fraction, i.e. %, Frac, ppm, etc. using the Cnv ID drop down box. [H2O(l)]/[SumPhase(l)] The result of this calculation will vary between 0 and 1 depending on how much water is present compared to other liquid species.

Species Views

Some calculations are only valid in certain views, such as a mass view. To prevent users from seeing calculations displayed which do not make sense, the user may define which view the calculation is shown in using the View drop down box. The three groups of views to choose from are Mass, Volume and Molar. Users may choose only one of these groups or any combination of the three.

The main groups of Views are explained further in the following table:

View Group
Description
Example of when to use this Group
Notes
Mass This group includes MassFlow, MassFrac and SpeciesConc. [FeSO4(aq)] * MW(Fe)/MW(FeSO4(aq)) This calculation is only valid when mass is used.
Volume This group includes VolFlow, VolFrac, NormVolFlow and NormVolFrac. [R(o)]/[H2O(l)] This dimensionless ratio may only be meaningful on a volume basis.
Molar This group includes MoleFlow and MoleFrac. 2*[Fe2[SO4]3(aq)] This calculation is only valid when moles is used.
Mass,Molar This includes all those described above for Mass and Molar [SumElemPhase(S,l)] This calculation is only valid when mass or moles is used.
Mass,Volume,Molar This includes all those described above for Mass, Volume and Molar [H2O(l)] This calculation is valid in mass, volume and molar views.

NOTE: Calculations are not shown in the following views: PartialP, PartialPFrac, ElemntFlow, ElemntFrac, ElemntConc, ElemntConc25, CompntFlow, CompntFrac, CompntConc, CompntConc25, CompntMlFlow, CompntMlFrac, CompntMlConc and CompntMlConc25.

Species Display

The Species Calculations are ordered alphabetically in the Species Calculation list. The order in which they will appear on the Species View tab page will depend on the Order chosen for the Species display in the Configuration Editor.

  • If the one of the default orders are chosen (SLG, GLS or LSG), then the user can have calculations displayed with a particular group of species using the Display With drop down box. There are four options as described in the table below:
Option
Description
All The calculation will be displayed at the bottom of the list of species.
Solid The calculation will be displayed at the bottom of the list of solid species.
Liquid The calculation will be displayed at the bottom of the list of liquid species.
Gas The calculation will be displayed at the bottom of the list of gaseous species.

Each set of calculations with the same Displayed With settings will be listed alphabetically.

  • If instead the Custom order is chosen, then the user can move the calculations to wherever they would like it to appear within the list of species on the Species Tab Page, using the Move Up and Move Down buttons.

Examples of Species Calculations

Expression
Cnv Type
View
Description
Aqueous:Organic = SumIPhase(aq)/SumIPhase(o) None Volume Ratio of aqueous volumetric flow to organic volumetric flow. The Cnv Type selected is None as the calculation is dimensionless. The View chosen is Volume since this ratio is only relevant on a volume basis.
Ferrous = [FeSO4(aq)]*MW(Fe)/MW(FeSO4(aq)) FromView Mass The mass flow of ferrous ion. The Cnv Type is FromView, so that the displayed value will change with a change of units. The View chosen is Mass since this calculation is only valid on a mass basis.
Sulfate = ([Fe2[SO4]3(aq)]/MW(Fe2[SO4]3(aq))*3 + [FeSO4(aq)]/MW(FeSO4(aq)) + [H2SO4(aq)]/MW(H2SO4(aq))) * MW(S1O4) FromView Mass The mass flow of sulfate ion. The Cnv Type is FromView, so that the displayed value will change with a change of units. The View chosen is Mass since this calculation is only valid on a mass basis.
Ferrous:Sulfate = Ferrous/Sulfate None Mass The ratio of ferrous ion to sulfate ion. The Cnv Type selected is None as the calculation is dimensionless. The View chosen is Mass since the previously defined calculations are only valid on a mass basis. Note: Both Ferrous and Sulfate must have been defined before using them in a calculation.
PercentSulfate = Sulfate/SumPhase(s,l) * 100 Frac (%) Mass The percentage of Sulfate ion in slurry (both solid and liquid phases). The Cnv Type is set to 'Frac' with a Cnv ID of %. At run time the user may change the displayed view to any of the fractional conversions allowed. The View chosen is Mass since the previously defined calculation is only valid on a mass basis. Note: Sulfate must have been defined before using it in a calculation.
DryGas = SumPhase(g)-[H2O(g)] FromView Mass,Volume,Molar The flow of dry gas. The Cnv Type is FromView, so that the displayed value will change with a change of units and/or view. The View chosen is Mass,Volume,Molar as the calculation is valid for in all views.
NitrogenEquiv = SumElemIPhase(N,aq)*MW(N) FromView Mass Mass flow of aqueous species containing nitrogen (ammonia) compounds displayed as the nitrogen equivalent. The Cnv Type is FromView, so that the displayed value will change with a change of units. The View chosen is Mass since this calculation is only valid on a mass basis.


Note: If a stream has zero flow, then all species calculation results will be set to zero.


See Size Configuration for editing the size distribution tab pages.

Calculations on Content Page for Dynamic Projects

In a dynamic project, some of the species and property calculations will be shown on the content pages of any units with surge (eg tank). Only calculations with a time based conversion (eg massflow kg/s) with a paired none time based conversion (eg mass kg) will be shown. Other calculations that are dimensionless or use other conversions (eg fractions) are excluded.

Calculations for streams (eg in pipes) are shown in the same way as they are for ProBal projects.

Calculations in Example Projects

A number of the Example Projects distributed with SysCAD contain user defined calculations. These may be helpful when setting up your own calculations:

  1. Nickel Copper Project - demonstrates the use of Species calculations. The values for the Ferric (Fe+++) and Ferrous (Fe++) ions are calculated and displayed in the species view window for every stream.
  2. Gold Project - demonstrates the use of User Property calculations. The values for Gold and Copper in the ore, and Gold and Copper on the carbon, all in ppm, are calculated and displayed on the Qo window for every stream.