Professional Documents
Culture Documents
Tutorial METSIM HATCH
Tutorial METSIM HATCH
Tutorial METSIM HATCH
Page 1 of 50
1. Introduction ......................................................................................................................... 2
1.1 Capabilities and Limitations .......................................................................................... 2
1.2 Uses of METSIM .......................................................................................................... 3
1.3 Installation .................................................................................................................... 3
1.4 Need More Help? ......................................................................................................... 3
2. Navigating METSIM for Windows ....................................................................................... 4
2.1 Streams ........................................................................................................................ 5
2.2 Unit Operations............................................................................................................. 7
2.3 Controllers .................................................................................................................... 9
2.3.1 Feedback Controllers ........................................................................................... 9
2.3.2 Feed forward controllers .................................................................................... 11
2.3.3 Flowrate Controllers ........................................................................................... 11
2.3.4 Percent Controllers ............................................................................................ 12
2.3.5 Instrument .......................................................................................................... 13
3. Icons Description .............................................................................................................. 14
3.1 General Commands ................................................................................................... 14
3.2 Flowsheet movements ................................................................................................ 15
3.3 Flowsheet item commands ......................................................................................... 15
3.4 Tool Commands ......................................................................................................... 17
3.5 Navigate and Calculate............................................................................................... 18
3.6 Others ........................................................................................................................ 19
4. APL (A Programming Language) ..................................................................................... 19
4.1 Mathematical Expressions in APL .............................................................................. 19
4.2 APL Symbols .............................................................................................................. 19
4.3 Value Functions .......................................................................................................... 22
5. User Objects ...................................................................................................................... 22
6. Heat Balance...................................................................................................................... 24
7. Extracting information from METSIM............................................................................... 25
7.1 Display ....................................................................................................................... 25
7.1.1 Creating Reports ................................................................................................ 25
7.1.2 Generating reports ............................................................................................. 26
7.2 Dynamic Data Exchange ............................................................................................ 26
7.2.1 Uses 27
7.2.2 Steps ................................................................................................................. 27
7.2.3 Use imported values .......................................................................................... 32
7.2.4 Vectors and Matrices ......................................................................................... 33
7.2.5 Automatic DDE .................................................................................................. 33
7.3 Screen Outputs........................................................................................................... 34
8. Converging a Model .......................................................................................................... 37
8.1 Convergence Window................................................................................................. 37
8.2 Tolerances.................................................................................................................. 38
8.3 Debugging .................................................................................................................. 39
c:\documents and settings\rafael\mis documentos\tutorial metsim hatch.docx TEXT-P.DOT, 00/01
ISO 9001-94
Page 2 of 50
1. Introduction
Currently, METSIM is one of the preferred packages for process simulation throughout the
various echelons of HATCH.
METSIM is sold by PROWARE in various modules, depending on the needs of the users. In
Australia, the basic module (mass balance) and the energy balance module are mostly used.
Other modules available include:
For these notes, only the mass and energy balance modules will be covered.
Has an extensive component database, steam tables and heat of formation data;
Interface to other network software;
Does not predict chemical reactions, kinetics or thermodynamic equilibrium;
A METSIM model is a good location for storing process information about a plant‟s
operation. Generally, METSIM is used for
1.3 Installation
From Windows Explorer, open the Win folder of the METSIM CD and run “Install.exe”.
METSIM must be installed in the folder c:\metsim, otherwise it will not run. After installing
METSIM, start the application. You will be prompted to enter the license number that
corresponds to this version and your location (normally printed on the case of the installation
disk). Ensure that there are no typos otherwise you will have the demo version permanently
on your machine and will have to reinstall the software. To run the program, click on the
Windows Start menu, select Program Files, then METSIM.
Note that multiple versions of METSIM can be installed on the same computer, but they
cannot share the same c:\metsim folder. The only way around this is to rename the
METSIM folder depending on the version to be used. For example, if one has version 11.03
and desires to have also version 12.06 on her computer, she can rename the c:\metsim
folder to c:\metsim 11.03 while the 12.06 version is installed. If the folder is not renamed,
then version 12.06 would replace the old version 11.03.
Your screen resolution should be at 1024 by 768 pixels to be able to best view the METSIM
window.
If you plan to work on a large model, you may find it impossible to save it. It is likely that
there is insufficient APL workspace allocated in your computer. To avoid this from the start, it
is recommended to do the following immediately after installing METSIM. The METSIM
default size of APL workspace is set in the METSIM.INI or configuration file located in the
windows folder of the c: drive root directory. To open the file, open windows explorer, go to
the computer c: drive, open the windows folder, open file METSIM configuration file. The first
line reads Wssize = 32M. Set the Wssize for a 128 Meg machine to 72M, for a 160 Meg
machine set to 96M, etc.
METSIM (http://members.ozemail.com.au/~ozmetsim/)
Mr. John T. Bartlett metsim@primenet.com
Users in Australia:
To open METSIM once it has been installed, simply click on the Start menu, select
Programs, then METSIM. When METSIM is first opened, the screen will look like Figure
1.4-1. There are a number of drop down menus at the top to select from and a number of
icons at the top and to the right. Each icon serves a different purpose which will be
discussed in later sections. Note that by moving the mouse over each icon, you can see the
name of the icon and generally that is sufficient to give an idea as to the icon‟s purpose.
Take care when clicking on the Save Model icon, it is a shortcut and will not allow you to
save your model with a new name. It is best to use the Files menu instead and Save As…
to save using a new name. It is advised to frequently save your model before performing
major runs.
If you wish to rename a METSIM file, it is best to open the file and Save As another
name. If you take a shortcut through Windows explorer to change the name, it will
appear to change the file name, but when you open METSIM and save the file, it will
save it as its original name, thus potentially losing information you wanted to keep
in your original file.
As most METSIM modellers often end-up working on an existing model, learning to navigate
around one is the best place to start learning about METSIM.
Open the file named Navigate.sfw and save it with a different name, say Navigate1.sfw.
You may find that the text fonts are very large immediately after you first install METSIM. It is
possible to reduce these by clicking on Setup, then Select Fonts. Change the font sizes
from there. A font size of 16 for GRAPHICS SMALL font and a font size of 24 for GRAPHICS
MEDIUM and GRAPHICS LARGE should be adequate. It is not necessary to change the
PRINTER fonts.
Note that the flowsheet displayed on the screen uses various colours to represent different
things. For example, unit operations (the blocks) are yellow, some streams are blue, some
are green, etc. METSIM uses default colours to represent items. In this instance, blue
streams are mainly aqueous streams, green ones are mainly gas streams, etc. Default
colours can be changed via the Setup menu, then Select Object Colors. For now, lets
leave them as they are.
Now to have a look at the various objects on the flowsheet and to get a start in
understanding some of the icons and menu items in METSIM.
2.1 Streams
First click on the Edit Object Data icon ( ), then on the number of the stream to edit, for
now stream 10;
Components
Mass flowrates
Elements
The stream phase is displayed by colour on the flowsheet. For mixed streams, it defaults
to the majority phase.
The Time entry is most likely for dynamic modelling. It is not active when the dynamic
function is turned off;
There are some very useful features to know about in this stream window. For example:
When entering flowrates for a slurry stream, you can start at making a guess for the
aqueous and for the solid phase mass flows. METSIM will then report the % solids
(which is in fact shown as a weight fraction) associated with your guesses. You can then
change the % solids entry directly and METSIM will correct the aqueous phase mass
flow accordingly. This done, you can then change the total flow entry that METSIM
calculated, and it will change all phase flowrates while keeping the % solids the same.
Changing a component‟s weight fraction will automatically change its mole fraction or
concentration, depending on the phase you are looking at. Any component content
change also automatically updates the element values.
Elemental compositions can be also changed to suit assays, however if more than one
component contains the particular element, for example in this case sulphur, then
METSIM can return an error, unable to update all the sulphur containing components.
The buttons ate the top allow you to see the content of the phases they represent. SI for
solid inorganic, LO for liquid organic, and so forth.
METSIM does not differentiate between input and calculated values and thus will
not indicate to the user which are input and which are calculated by METSIM.
Unit operations represent actual process steps or functions. There are several basic unit
operations and many more specialised ones. This example model uses the more basic units.
These are described in detail in Appendix 5 and it is recommended to review this section to
understand how these units function. Some tips are discussed here:
Click on the Edit Object Data icon ( ) and click on the number of the unit operation to
edit, for example, unit operation 9;
The first tab displayed shows generic information about the unit operation. This is very
similar for all types of unit operations. It generally contains:
EX: switch to turn on/off the unit operation during convergence. This can be useful
when debugging a model.
UC: unit operation code. It is advised not to change this. If it is desired to change the
unit operation type, it is best to add a new unit operation and reconnect the streams
to it instead. Each unit operation type has its own three-letter code.
EN: Unit equipment number. This is not a required field but can be useful when
someone new picks-up a model.
OP: Unit operation number. This number is sequential and defines the calculation
order. It is advised not to change this value and to use the IFLS function instead.
(See Appendix 1)
ME, NO, KW, HP: These are related to equipment sizing and operating costs, both of
which are not covered here.
The reaction extent (a fraction, not a %) is based on the first component defined in
the reaction;
The heat of reaction is based on the heat of formation of the reactants and products;
To use a controller for extent of reaction, use VCTL # (# = controller number), make
sure to select Reaction extent, enter an expression in the drop down menu;
There is also the possibility to use IF statements directly for extent of reaction (not to
be confused with the Logic Controller tab). This is useful when the extent depends on
temperature. As for using a controller for the reaction extent, make sure to select
Reaction extent, enter an expression in the drop down menu.
Using expressions in the round bracket array instead of constant numbers also works
(just remember the way APL works and use parentheses if unsure, as discussed in
Section 4).
Make sure to balance the reactions, especially for a phase change. E.g. for the reaction
of water evaporation H2O-li H2O-g, the first time you click on balance, the
stoichiometric coefficients will be 0. Click again and these coefficients become 1.
Energy information, including heat input and heat output are specified by selecting the
heat balance tab within the unit operation;
The heat input/output can be based on a fixed amount, a percent of total heat input
(which includes the heat of reaction) or as a calculated function of other parameters
(using APL);
To specify an output temperature for a unit operation, either enter the desired
temperature in the Contrl C field within the stream data window, or run ISTQ (see
Appendix 1), then select the stream to Edit and change TC manually. If this is not
done, the output temperature will be calculated by METSIM.
2.3 Controllers
Controllers form an important part of any METSIM model. Generally one will try to set-up
controllers to mimic those that would be found in an actual plant, but there are other uses for
controllers, as will be evident through the tutorials.
FFC: ( ) Feed forward (ratio controller) – vary an input proportionally to another input
PSC: ( ) Percent stream – Achieves a set solids content in a unit operation outlet
stream by varying a selected a feed stream flowrate. Note that this unit is
only useful when no reactions are present in the unit operation.
INS: ( ) Instrument – Is used to display values on the screen while the model is
converging.
Feedback controllers will slow down the convergence of a model. If there is any way not to
use one, then that option should always be considered first.
Fields must be entered when they have a , depending on the modules selected when first
starting the model. The fields in the edit window are as follows:
Tab FBC1
ON: Switch to turn on or off the controller. This is useful when debugging a model or
to speed up convergence.
CN: This is the controller number. Take great care before changing this value. (See
Section 9.4 about numbering)
TY: This is the controller type. It is best not to change this value to switch from one
type of controller to another. Rather, insert a new controller and turn the original
controller off and eventually delete it once you are satisfied that it is safe to do so.
(See Section 10.1 about deleting objects)
ID: This is the controller description or name. A good idea is to include what the
controller controls and what it manipulates to achieve the set point.
OP: Unit operation where set point is to be calculated. (Tip: This value should be
equal to or greater than the NO value)
OV: Output value of adjusted variable. Enter a first guess here when first setting-up
the controller.
LV and HV: Make limits as tight as possible. There are adjusted depending on
whether the convergence can be achieved. When a controller is unable to achieve its
setpoint, it is often because it has reached one of these limits.
Note that when the model converges, it only needs to hit these limits once to display
a warning or error message. This does not mean that the controller has not recovered
since.
Tab FBC2
DB is not used.
CO: Switch for dynamic modelling, which is not covered here. Leave it turned off.
KP, KI and KD are used for dynamic modelling. Leave these blank.
EE, PG and PV: These give an indication to how well the controller is behaving. It
contains the last three iterations from the controller. EE is the error between the set
point and the controlled variable. The controller tries to make this value zero. PG is
the manipulated variable value and PV is the controlled variable. To reset a FBC,
make all nine of these fields zero.
When the limits are for reaction extents or split parameters, might want to use values
close to 0 and 1 instead of 0 and 1 exactly (e.g. 0.001 and 0.999).
ON: Switch to turn on or off the controller. This is useful when debugging a model or
to speed up convergence.
CN: This is the controller number. Take great care before changing this value. (See
Section 9.4 about numbering)
TY: This is the controller type. It is best not to change this value to switch from one
type of controller to another. Rather, insert a new controller and turn the original
controller off (or delete it).
SN: Adjusted stream. Unlike the feedback controller, this controller does not require a
small s in front of the stream number.
VF: the APL expression for the ratio to restrict the stream to. There is a good
description inside METSIM in that window about how this ratio is to be set up. Just
remember, the stream being adjusted must be directly proportional to the numerator
of the ratio.
Instead of repeating the stream number of the adjusted stream in VF, you can use SN
instead. For example, if adjusting the flowrate of stream 210 and the ratio would
normally contain a value function like (c8 VMFR s210) in the numerator, instead use
(c8 VMFR SN). Within this controller, SN is a variable given the value you entered in
its corresponding field. In this case, the adjusted stream number.
On the right of the screen, click on the controls icon ( ), then on the FRC icon from the
series of icons that is presented.
Place the FRC directly on top of the stream number for stream 10. Left-click to place the
controller. METSIM will then suggest a controller number to use, for now, accept the
suggested number.
Take a moment to read the description at the top of the edit window that opens up.
ON: Switch to turn on or off the controller. This is useful when debugging a model or
to speed up convergence. Check this box to turn the controller on.
CN: This is the controller number. Take great care before changing this value. (See
Section 9.4 about numbering) Leave this value as it is at the moment.
TY: This is the controller type. It is best not to change this value to switch from one
type of controller to another. Rather, insert a new controller and turn the original
controller off. Leave this as it is at the moment.
ID: This is the controller description or name. In this case, use “Matte Slurry
Feedrate”
OP: Unit operation where set point is to be calculated. In this case, it is for unit
operation 2.
SN: Adjusted stream. Unlike the feedback controller, this controller does not require a
small s in front of the stream number. If the value here is not 10, then change it to 10
now.
SP: the desired set point (a value or an APL expression). In this case 11.487 (tonnes
per hour)
VF: the APL expression for the stream‟s flowrate. In this case, use (VSTR SN), which
represents the mass flowrate of stream SN (which was set at 10) in the units
specified by the user (set in IPAR, described in Appendix 1), which in this case is
tonnes/h.
On the right of the screen, click on the controls icon ( ), then on the PSC icon from the
series of icons that is presented.
Place the PSC directly on top of the stream number for stream 20. Left-click to place the
controller. METSIM will then suggest a number to use, for now, accept the suggested
number.
Take a moment to read the description at the top of the edit window that opens up.
ON: Switch to turn on or off the controller. This is useful when debugging a model or
to speed up convergence. Check this box to turn the controller on.
CN: This is the controller number. Take great care before changing this value. (See
Section 9.4 about numbering) Leave this value as it is at the moment.
TY: This is the controller type. It is best not to change this value to switch from one
type of controller to another. Rather, insert a new controller and turn the original
controller off. Leave this as it is at the moment.
ID: This is the controller description or name. In this case, use “Feed moisture”.
OP: Unit operation where set point is to be calculated. In this case, it is for unit
operation 2.
SN: Adjusted stream. Unlike the feedback controller, this controller does not require a
small s in front of the stream number. If the value here is not 20, then change it to 20
now.
PS: the desired concentration or fraction of solids in the feed stream to the unit
operation. In this case, enter 0.77.
CO: calculation option to specify whether the value entered in PS is a weight fraction
or a molar fraction. In this case, it is a weight fraction, so enter 0 here.
Now, turn off the other controller on this stream, that is feedback controller 1.
Remember this type of controller should not be used for unit operations where reactions
involving phase changes occur.
2.3.5 Instrument
There are instruments in the example model. We will be adding one controller here.
On the right of the screen, click on the controls icon ( ), then on the INS icon from the
series of icons that is presented.
Place the INS anywhere on the screen. METSIM will then suggest a controller number to
use, for now, accept the suggested number.
Take a moment to read the description at the top of the edit window that opens up.
ON: Switch to turn on or off the controller. As instruments do not affect the model,
there is no real purpose to turn them off. Check this box to turn the controller on.
CN: This is the controller number. Take great care before changing this value. (See
Section 9.4 about numbering) Leave this value as it is at the moment.
TY: This is the controller type. It is best not to change this value to switch from one
type of controller to another. Rather, insert a new controller and turn the original
controller off. Leave this as it is at the moment.
ID: This is the controller description or name. In this case, use “Nickel concentration
in hydro slurry”.
OP: Unit operation where this controller is to be used. In this case, it is for unit
operation 4.
VF: The value function of what is to be displayed by the instrument. In this case, type
(28 VGLE s80), which will give the g/L of nickel in stream 40.
CO, LV, HV, PC, SM, ND, DL: are only useful for the dynamic simulation module and
will not be covered here.
When the model is run, the instrument value is displayed in a window as shown in Figure
2.3-1, in the top-right corner of the window.
Instrument
3. Icons Description
Just above the flowsheet are a number of shortcut buttons that perform a variety of
commands. These can be grouped as discussed here.
New model
Print flowsheet
Model parameters
Error checking
3.1 General Commands
These are generally self-explanatory. The ones that require further explanation are as
follows:
Print flowsheet: When clicking on this icon, a window showing a list of all sections of the
model will be displayed. From this list, one can print one or multiple sections by using the
Shift and Ctrl keys on the keyboard.
Model parameters: this is the same as the IPAR menu. (See Appendix 1)
Error checking: This will give you a report on errors detected within the model.
These are some of the most used icons in METSIM. They are here described in more detail.
Locate stream: By clicking on this icon and typing the desired stream number, METSIM
will immediately take you to the stream and highlight it in fushia. If the stream connects
more than one section, it will give you the option of which section to go to. Try locating
stream 250 from your Navigate1 model.
Renumber streams: This is where a stream or all streams in an area of the flowsheet
are renumbered. Clicking on this icon brings up a window where you can define your
stream renumbering parameters.
To renumber a single stream, check the box RN1 and click on OK. Then click on the
stream to renumber. Try this on stream 210. Change it to stream 211. Doing this has
automatically updated the controller that is on this stream and any functions that refer
to this stream (provided there is a small s in front of the stream number and it is not
used in a vector or matrix – see Section 4.3) Have a try at this, but do not save your
file with the changes. It is best to reopen it before moving on.
To renumber all the streams on the current section, simply fill-in the information
required under the RENUMBER STREAMS ON CURRENT PAGE heading. Have a
try at this, but do not save your file with the changes. It is best to reopen it before
moving on.
Renumber controls: When clicking on this icon, you are prompted to enter a starting
controller number. It is suggested to make this number 1000 x section number. So for
section 4, 4000 would be selected. Then an increment number is to be specified. Using
the default 10 is fine. When this is done, click on Yes to start the renumbering process.
Only the current section is renumbered this way. Have a try at this, but do not save your
file with the changes. It is best to reopen it before moving on. This is also discussed in
Section 9.4. Remember that if you want to renumber all the controllers, it is best to start
from the last section and move up towards the start of the model.
Delete object: Click on the icon and then on the unit operation number, stream number
or controller to delete. Please see Section 10.1 for more information about deleting
objects.
Reverse Unit Op: Click on this icon and then on the unit operation that needs to be
flipped horizontally. Remember that yellow circles indicate input streams while the yellow
ones are output streams. If you don‟t see the circles on the unit operations, refresh the
screen ( ). Doing this may require that some streams are moved and redrawn.
Change Object Size: Once you click on this icon, left-click on a specific unit operation to
enlarge its size, right-click to reduce it.
Move Object: Once this icon has been selected, simply click on the object number to
move and drag it to a new location. Take care when moving a stream, it takes a little bit
of patience and practice to do it right. Generally, to move a stream, one needs to „redraw‟
it and left-click at every desired bend and right click when it is finished. Practice this on
streams now. It is important to feel comfortable with moving streams around as it is
something that is frequently done.
Move Text: This icon is used only to move text. This includes stream numbers and unit
operation names. A trick to do this right is to click towards the left-end of the text to be
moved. Try this on your example model now place stream number to more appropriate
placements and save your Navigate1 model.
Copy Object Data: This icon is used to mirror the data from one unit operation to
another or from one stream to another. It presents you with a number of items to chose
to copy over. It is a great time saver particularly when copying reactions from one unit
operation to the other.
When you have selected all the items to be copied, click on OK and then left click on
the original item to copy and right click on the item to copy it to.
If the second item is on another section, click on the icon, left click on the item to
copy from, then go to the section where your second item is located, click on the
copy object data icon again and right click on the second item.
Edit Object Data: This will allow you to see inside streams, unit operations and
controllers. Simply click on the icon and then on the number of the unit operation, the
stream number or directly on the controller to edit.
Unit Operations
APL Keyboard
Phases
Value Functions
Components
Math Functions
Streams Instrumentation
and Controls
There are two lots of icons that can be generally considered as tools. The first series above
is described here:
Elements: gives a list of elements in the current section. Note that the number to the
right of the element is the actual element number to use in various value functions.
APL keyboard: the APL keyboard is a very useful tool where APL commands can be
tested and in some instances, even executed. (See Section 4.2)
Math Functions: Gives a list of various mathematical operations that can be performed
in METSIM. These are not used as widely as normal operations like multiplication or
division, but they can be useful.
Value Functions: Gives a list of METSIM value functions. These have also been placed
in Appendix 3.
User Objects: This will open a window of all user-created objects. These can be
Display Value
Lock Model for
Function for Stream
Security
Plot Screen Analysis
c:\documents and settings\rafael\mis documentos\tutorial metsim hatch.docx
Display Instrument Spreadsheet TEXT-P.DOT, 00/01
ISO 9001-94
Page 18 of 50
Check elemental balance: allows the user to check for any elemental imbalances in the
displayed section. This is a great debugging tool.
Display Value Function for Stream: This is the same as DVAL (See Appendix 1)
Plot Screen Analysis: This is used when the Particle Size Analysis module is turned on
and will not be covered here.
Plot Dynamic Data: This is used when the Dynamic Simulation module is turned on and
will not be covered here.
Lock Model for Security: For enhanced security of the model, this can be used. Note
that once activated, this cannot be reversed.
Help: Brings up the help menu for METSIM. This is constantly being updated with every
new version of METSIM and can be very useful when finding information about various
functions or unit operations.
Calculate Current
Next Section
Section
Follow
Connecting Arrow Calculate Unit
Operation Range
Select
Section Calculate All
Sections
Previous Stop
Section Execution
These are some of the most used icons in METSIM. They are here described in more detail.
Select Section: This icon will bring up a window to select a model Section. Clicking on
the desired section will take the user to that section immediately.
Follow Connecting Arrow: Click on this icon, then click on a connecting arrow. It will
take the user to the Section the stream is connected to.
Previous and Next Section: Allows the user to browse up and down various sections.
Calculate One Unit Operation: To calculate a single unit operation, click on this icon,
then click on the number of the unit operation to calculate.
Calculate the Current Section: As implied, this will only calculate the displayed section.
Calculate Unit Operation Range: Before using this icon, the range of unit operation to
be calculated must be defined in IPAR, Calc Parameters, ROP. (See Appendix 1)
3.6 Others
These require special modules to be used and will not be covered here. Take care not to
press on these icons by mistake, some will actually freeze METSIM and you will be forced to
close your model and restart from your last saved version.
This is the language used by METSIM to define equations, mathematical expressions and
assign values. It uses special functions and symbols and does not comply with the universal
rules of executing mathematical expressions.
APL reads mathematical expressions from right to left, however each operation is read from
left to right, there is no specific hierarchy. To illustrate this, consider the following examples:
A good way to avoid confusion is to use parentheses though these tend to clutter APL
expressions significantly.
(5 4) +3 would now be 5/4 + 3 (but not 3 + 4/5). The correct APL way to write this
without using parentheses is 3 + 5 4
Getting used to not using unnecessary parentheses is good modelling practice and will help
keep your models „clean‟ and uncluttered.
Special symbols are required when entering APL expressions. A complete list of these can
be found by clicking on the APL keyboard icon ( ). The APL keyboard is depicted in
Figure 4.2-2. For example, the division is normally done using the slash "/", but for APL, the
division sign is used " ". There are numerous symbols that can perform other tasks. See
Appendix 2 for a list of these symbols, or look in the Help menu in METSIM. Note that, as
shown in Figure 4.2-1, the symbols to the left of each icon are the normal keyboard keys and
those to the right of each icon are the APL symbols. To type those in, just click on Alt and
the key that matches the symbol. Note that some require the Alt-Shift combination when they
are in the location of an uppercase. If entering an APL expression directly in the APL
keyboard window in Figure 4.2-2, clicking on the desired symbol will save the pain of using
Alt combinations.
APL
Keyboard
Normal
Keyboard
The APL keyboard can be used to perform calculations "outside" the model. That is, if one
wants to verify a certain value or confirm the syntax of an expression, the APL expression
can be entered in this window to obtain an immediate value. Matrices can also be viewed, as
well as user objects. METSIM will remember the last APL expression that was used in this
window.
Note that METSIM makes a distinction between the substraction symbol (-) and the
negative sign (alt-2), so be careful when using these.
Following are some more examples of APL expressions. Note that Alt-o = in this case, not
to be confused with alt-`
- 3 4 = -3 -4 1 = sin
3 4 = ⅓ ¼ (reciprocal) 2 = cos
3 4 = e 3 e4 -1 = arcsin
45 180 will convert 45° to radians +/29 10 29 10 293 (this will place a +
between each entry and give an added
52 3 4 = 25 125 625 result)
23 = 2³ 20 30 40 10 20 60 10 = 4 (index)
Value functions are expressions that define a particular value which is specific to a particular
component (C), stream (S), phase (P) or element (E). In order to reference one of these
characteristics, it must be know that the:
Components are numbered and a list can be obtained by running DCOM (see Appendix
1) or clicking on . When used in a value function a “c” must be specified before the
component number, for instance c15 would represent component 15;
Streams are also numbered when they are first defined. An “s” is required before the
stream number: s60 would represent stream 60;
Phases are numbered according to the METSIM predefined list of phases (Section 9.3).
No “p” is required when specified within a value function;
Elements are numbered using their own atomic numbers. No "e" is required when
specified within a value function.
It is always a good idea to put each APL function between parentheses to separate it from
the rest of your APL expression. e.g. (8 VEWF s140)x(VSTR s140)
A list of value functions if found in Appendix 3. This can also be accessed directly in
METSIM using the Value Functions icon ( )
5. User Objects
There are various user objects that can be created for models. These help customise a
model to the user‟s needs and can also help simplify expressions used throughout the
model. The disadvantage of using these is that when a new user takes ownership of the
model, it takes time to learn the various user objects. It is recommended to keep a list of
these with explanations detailing what they should be used for and what they calculate.
The various types of user objects that can be created are: BATCH, PRECALC, Function,
Scalar, Vector, Matrix and Text. The BATCH and PRECALC functions will not be covered
here as they are rarely used and are advanced user objects.
To access the user defined objects, click on the User Objects icon ( )
Function:
To create a user defined function, select New from the User Objects window and then
select Function:
Give it a name, use something which will be meaningful, e.g. VCO2 (for value of carbon
dioxide).
The function is entered in the following format, where the first line must always contain
the name of the function:
M VCO2 S;A;B;C;M
A (6 VELI S)
B (3 VPSG S)
C ((A×B)×(44.00995÷12.01115)×1000)
MC
The function can then be used in the model this way (VCO2 s#) where # is a stream
number. It will return the concentration of carbon expressed as CO 2 in g/L.
METSIM uses outdated IUPAC atomic weights. It is highly recommended to use the
exact values that METSIM uses in any APL expression that requires molecular
weights. For quick reference, these have been listed in Appendix 3.
The user-defined function can be written into a separate file (e.g. VCO2.cr) which can
then be reused in another model. Once the function is created, simply run SFNC (see
Appendix 1). Write the name of the function to save (e.g. VCO2). The file will be then
saved into the c:\Metsim\Fnc\ directory. To extract this file again from another model,
simply run RFNC (see Appendix 1). This will import ALL the function.cr files. Once in
within your model, they can be edited without affecting the original function.cr file.
To create one of these types of user defined object screen, select New from the User
Objects screen and then select Scalar, Vector or Matrix.
The names for these will start with US, UV and UM respectively. The rest of the name is
up to you. Eg: Usval, UVvec or UMmat. Try to use something which will be meaningful.
These functions use numerical entries only and they are exactly what their names
suggest.
To recall this value in the model, simply use the scalar‟s name, e.g. USval.
For a Vector, enter one or multiple values in a single line, separated by spaces.
To recall values from this vector, the following syntax is used, UVvec[] will recall the
entire vector. UVvec[x] will recall the xth value of the vector.
For a Matrix, enter one or multiple values in one or multiple lines, separated by
spaces.
2 10 0.2 5 66
1 2 3 4 5
To recall values from this matrix, the following syntax is used. UMmat[;] will recall the
entire matrix. UMmat[x;] will recall the x th row of the matrix. UMmat[;y] will recall the
yth column of the matrix. UMmat[x;y] will recall the value positioned in row x, column
y.
Text:
To create a text user object, select New from the User Objects screen and then select
Text.
The name of the variable will start with UT. E.g. UTmattegrade.
First type the description in the top field and then the desired expression in the next
field. This can be text, numbers or even APL expressions.
In the case of an APL expression, one can later use the expression as it is written in the
text object by using the “execute” function ( ) (alt-;). Without specifying execute,
METSIM will return the actual text instead of the answer that would result from
executing the APL expression.
e.g. use “ Utmattegrade” instead of “Utmattegrade”.
Do not use the “c” or the “s” in APL expressions for the Create User Object screen. It
does not recognise them. (Section 4.3)
6. Heat Balance
In addition to the points raised in Section 2.2 regarding the flow of heat involved for each unit
operation, overspecifying unit operation outputs will force METSIM to calculate any excess
or required energy into an “excess energy” column in the heat balance summary. This is a
good tool for working out heat losses when all stream information is known.
Another point that is raised on the units of all heat-related values. kcal/hr is always used. In
the case of heat of reaction, always use kcal/kmol. These units are used even when defining
your model in metric units.
Run OHBS (See Appendix 1). A window in 3 sections appears; including the HOP matrix,
the heats of reactions and a table which includes stream temperatures and enthalpies. Refer
to Appendix 4 for an example of the Heat Balance Summary.
The HOP matrix is a table containing the heat balance summary for each unit operation.
Columns 1 and 2 define the unit operation whilst columns 3 to 10 define the various
heats which contribute to the overall heat balance for each unit operation. The Heat
RQRD column shows what imbalances are present. This is usually present when the unit
operation is overspecified. This value gives the heat required by the unit operation or the
heat to be removed.
HOP[5;2] where 5 is the unit operation number (row 5) and 2 is the HEAT REACT
(column).
In the event that the flowsheet is modified and the order of unit operations change, it
will be necessary to manually update the HOP[ ] DDE command. They do not get
updated automatically.
1st number is given in 1000 kcal/hr (+ve for exothermic, -ve for endothermic)
For sensible heat use SHC[s140] (kcal/hr) where 140 is the stream number.
This Heat Balance Summary output can be sent directly to the printer: Run PRNT, then run
OHBS (See Appendix 1)
The HOP matrix can be copied directly into Excel using MTRX (See Appendix 1).
7.1 Display
In order to extract data from the METSIM simulation, the Display menu contains a few
options that allow the user to customise what should be included in the spreadsheets
generated by METSIM –called reports. The displayed report can be copied and pasted into
Excel using the copy button.
1. Detailed report;
2. Intermediate report;
3. Summary report.
DSDO (Spreadsheet Items, Standard) are in-built METSIM functions. They are chosen
simply by entering this menu and allocating the required items to their respective reports.
It is best to avoid using this, particularly for assays and concentrations as METSIM will
only display the components that are being used in the model. If a new component is
used at a later time, then METSIM will automatically add this new component, shifting all
the columns or rows, which can affect the spreadsheets where model outputs are pasted
into.
DCSI (Spreadsheet Items, Custom) are user defined value functions which can be added
to a report. Simply enter the value function into the field specified and allocate it a report
level. This allows for much more flexibility with outputs than DSDO.
When displaying molar flowrates, METSIM will always show the unit of mol,
however the actual value depends on the type of units selected at the beginning of
the model. If metric tones, then moles are actually Mmoles. If kilograms, then moles
are actually kmoles.
It is recommended to create an empty Section at the end of the model where all the
overall model reports can be created. This is because each report creation will remain
within the sheet that was displayed at the time of the creation. Each sheet can have
its own set of reports.
For this section, use the model named DDE example and also open the Excel spreadsheet
with an identical name.
Dynamic data exchange (or DDE) is the term used when one application shares data with
another application “live”, or dynamically. In the case of METSIM for example, information
can be shared between it and Excel or even other applications where DDE is made possible.
When using a dynamic simulation, this becomes an „online‟ interaction where parameters
can be changed while METSIM is running.
The Excel spreadsheet where the DDE is to occur must be open and must be the last
Excel workbook viewed on the screen for the data transfer to occur.
7.2.1 Uses
DDE is commonly used to export values to Excel that the normal model output would not
make readily easy, or that are of particular interest to the modeller. Some examples include:
Manual controls
DDE is commonly used to import values from Excel where user input is required on a
regular basis, most particularly with manual controls.
7.2.2 Steps
Setting-up Excel
The steps for setting up DDE are fairly straightforward. First, the Excel spreadsheet needs to
be configured to the modeller‟s requirements. This involves:
Naming of cells where DDE is to be used – this allows for formatting of a particular
worksheet without affecting the DDE, as long as the cells used keep the same name.
Each modeller might use a different system. For example, perhaps all cells METSIM
uses to export data might be called METSIMoutXXX and all cells METSIM uses to import
data might be called METSIMinXXX (where XXX is a three digit number). This is the
naming system used in this example.
Using unusual formatting may not work in METSIM. For example, using percentages
or dollar representations is not recognised by METSIM. METSIM will only take what
is shown on the screen, so whatever digits the modeller can see on the screen, that is
what METSIM uses.
Naming of worksheet
Named cell
Data to input
into METSIM
Named worksheet
Export to Excel
Once the spreadsheet is set-up, METSIM needs to be configured to match the spreadsheet.
To start, the following example shows how to export from METSIM:
2. Ensure that the New DDE line is selected and click on Edit
ID is the name that will identify this particular DDE entry. Including units is a good
idea to keep track of the value being exported.
MV is the actual APL expression that will calculate the value being exported to
Excel. In this case [24 hours x 365 days/year x Ni t/h in total ore feed].
4. Click OK when all this information has been entered and OK again to exit the IDDE
menu.
6. See in Excel if the value was exported properly, as shown in the following image.
In this vector, spaces had to be reserved before DDE could be used. Entering
many zeroes works well: 0 0 0 0 0 0 0 0 0, as long as there are more of these
than there are DDE values to be imported.
4. Click OK when all this information has been entered and OK again to exit the IDDE
window.
5. Give it a test! Click on Tools and select TDDE (Test DDE Data Exchange)
6. See in the user objects if the values were imported properly, as shown in the
following image.
Extra zero
METSIMin001 entries for
in the future DDE
UVMETSIMin[1]
position
To achieve this a mixer unit (MIX) was used where each stream feeding it was made-up of
one component in the ore make-up. A flowrate controller was used on each stream to set the
flowrate. Note that the UVMETSIMin vector previously created was used for the set points
(SP), as shown in the following diagram.
Note that using vectors and matrices does not allow for any format manipulation in
Excel unless the order of the cells is kept exactly the same.
To turn on the automatic DDE, run IPAR (see Appendix 1), then the Calc Options tab.
Check the DDES box to activate this feature, as shown in the image below.
Try changing some of the parameters in the DDE spreadsheet now and then run the
METSIM example. See how METSIM automatically updated all the relevant values.
There are several outputs available from METSIM (from the Output menu) that can only be
displayed on the screen or printed directly to the printer. There is a way to capture this
information into Excel, however there are a few steps that must be followed.
For example, to capture the model chemistry, run OCHE (See Appendix 1). The information
will be displayed in a text format as follows:
Open Excel and then open the Notepad file from Excel. To be able to open it you will
need to select All Files in the Files of type drop down menu, as follows:
8. Converging a Model
It is during the convergence of a model that everything finally comes together. Unfortunately,
this is also when modelling errors become evident and debugging needs to be done.
Depending on the various calculation settings used, METSIM will display a number of
windows while converging to allow the user to monitor convergence. These are illustrated in
Figure 8.1-1. Note that in all these windows except for the Alarms, anything in green
indicate no change, in yellow indicates a change, in red indicates a non-convergence.
Convergence
windows
Run Parameter. This window will give you basic convergence information.
Low is the lower level of tolerance selected in IPAR under the Calc Parameter tab.
High is the highest level of tolerance set in IPAR under the Calc Parameter tab..
Time will give you the number of seconds convergence took to reach the last level of
tolerance in Tol.
Feedback Controller. This window allows you to monitor the various feedback
controllers in your model. This is a good place to look at first when alarms indicate
controller troubles. Sometimes you will see that they are behaving correctly, despite the
alarms and even sometimes when values are highlighted in red.
VALUE is the current value. METSIM will try to make this value equal to the set point.
Recycle Streams. This window is perhaps not used as often, but when non-
convergence errors occur, it will help determine why they happen.
Iter is the number of iterations the recycle stream has gone through before
converging at the current tolerance level.
Alarms. This window is by far, the most important. While most types of errors are
classified under certain numbers, this is not as important as keeping a close eye on the
alarms as they light up this window. Simply click on a lit number to see the error
messages. This will tell you whether a controller has reached an upper or lower limit, if a
unit operation is not converging or if a controller is not converging. Note that when these
are highlighted in yellow, METSIM will continue to converge. If only one highlights in red,
METSIM will stop the model with a critical failure error.
8.2 Tolerances
The level of tolerance used in METSIM is very important. The higher the tolerance (i.e., the
smaller the number), then the closer to steady state the model will be. Generally, while
working on a model, it is best to leave the tolerance relatively low, say about 10 -4. For final
convergence, 10-6 is recommended. It is sometimes desired to force the model to keep
converging for longer periods, making the tolerance higher than 10 -6 is on trick used to do
this.
Alarms in various tolerance levels might indicate different types of issues with your model.
At 10-5 and 10-6, these are usually feedback controller instabilities and are usually not
serious if the model converges well.
At 10-3 and 10-4, there might be S.G. changes occurring or two controllers in conflict.
8.3 Debugging
There is no easy way to describe how one can go about debugging a model. Mostly, it is
from experience that one learns the various tricks and the things to look out for. Sometimes
debugging is as simple as adjusting the limits on a feeback controller, sometimes it is
something more complex, like evaluating the order of reactions in a unit operation or
checking that there is sufficient reagent for a reaction to reach its intended extent. Following
is a list of possible items to look out for while debugging a model:
Controller limits
Order of reactions
Order of controllers
Often a modeller will inherit a model that has already been created and often worked on by
various other modellers. It is important to be consistent and systematic when modelling in
METSIM as it is likely that you will pass the model onto another user eventually. Here is a
checklist of suggested actions to undertake when receiving a model to take ownership of:
9.1 Convergence
Check that the model has been fully converged. Run it at its current settings.
Check that small „s‟ and small „c‟ have been used in value functions where necessary as
well as in FBC‟s SN field.
Take note of user objects and whether they use value functions specific to certain
components. Remember, that when the component list is updated, the user object
functions are not automatically updated like the rest of the model is.
Check for APL expressions that will also not update automatically if the component order
is changed. These include vectors and matrices, particularly if they use specific
component numbers.
There are 8 phases in METSIM, as shown in Table 2. It is good practice to first order the
components by phase number, but as well, within each phase, a proper order should be
kept to ensure that METSIM will operate correctly. When receiving a model and after
having checked the syntax throughout the model described in the section above, it is
recommended to reorder the components as follows (Do this from ICOM, as shown in
Appendix 1):
Update any user objects affected by this change and any APL expressions that will not
have updated automatically.
Run the model to ensure that it has not been affected by this change.
Once the two steps above have been performed, it is recommended to renumber the
controllers such that they can then be reordered and found easily on the flowsheet. See
Section 3.3 for a description of how this is done.
Run ICTL, then click on the column heading LOOP to order the controllers by number.
Run the model section by section, starting from the back to ensure it has not been
affected by this change. Some controllers may not have been renumbered if they are
turned off, so be careful.
It is not recommended to renumber streams at this point as it is far more difficult to keep
track of the effect of doing this on the model.
At this stage it is a good idea to do a few diagnostic checks to ensure the model converges
properly. Run various checks from the Calc menu until you feel you understand where
imbalances may occur in the model. You can then decide whether to address those now or
later.
Unless you have extensive knowledge of a particular model, it is always difficult to know
whether it is safe to delete a stream or a controller, or even a unit operation. There are often
places where we do not remember or simply are not aware that their numbers are being
used elsewhere. Perhaps in a user defined object or in DDE or somewhere completely
different in the model.
What is important to remember is that when a stream is deleted, METSIM does not zero it. It
keeps the last value it had and thus, consequences of deleting the stream are not always
obvious.
It is important to be systematic before deleting anything. First, run OIDT on your screen (see
Appendix 1). Select the whole text and paste it into Word. From there, you can do a search
for the object you wish to delete. For example s120 or just 120 to find that particular stream.
You will know from there precisely where the stream has been referred to throughout the
model and you will be able to make appropriate changes to your model before deleting the
stream. The same goes with controllers, but here you could do a search for VCTL 1000 as
an example.
This same check might be performed when renumbering specific objects as well.
Here is a quick reference to the model building steps to follow. The first tutorial example in
Appendix 6 covers these steps in detail.
3. Select components
a. Remember order of phases and components
b. Modify any components as necessary
c. Rename the abbreviated name to include the phase
This can be done one unit operation at a time or in totality. It depends on the size of the
model and your own preference.
a. Draw the flowsheet in METSIM
b. Define input streams
c. Define unit operations
i. Reactions
ii. Heat balance
iii. Parameters
d. Define control strategy
e. Run the model
f. Debug any errors
It maybe a good idea to converge one unit operation at a time, then a small range, then a
whole section as you build your model. This works particularly well for very large models or
for newly acquired models
When using a feedback controller to vary a reagent‟s flowrate into a unit operation in order to
have a small residual of the reagent left in the discharge stream of that unit operation, it is
possible that the controller sends insufficient quantities such that there is zero residual in the
output. When this happens, usually the controller stops functioning and never recovers. One
way to reduce the occurrence of this happening (though it rarely completely eliminates it), is
to use a master-slave controller set-up, as described in the following example, illustrated in
Figure 10.3-1.
Master
Acid (FBC)
Set-point
Neutralisation
Slave
Product
(FFC)
Feed
This tends to work because the acid stream will be adjusted even before the unit operation is
calculating, which in general stops the final set point from reaching zero. The feeback
controller then slightly adjusts the feedforward controller set point for fine tuning.
Appendix 2: APL
4.