You are on page 1of 192

USIM PAC 3.

0
Development Kit

Programmer's Guide

USIM PAC

DEVELOPMENT KIT

BRGM Software

DEVELOPMENT KIT

USIM PAC 3.0


Programmers Guide

Version 3.0.7.0
Caspeo
3 avenue Claude Guillemin - BP 6009
45060 ORLEANS CEDEX 2 FRANCE
Tel: +33-238-643615
Fax: +33-238-259742
E-mail: info@caspeo.net

BRGM is the author of USIM PAC

Copyright BRGM 1986 2004, Caspeo 2004

USIM PAC

BRGM Software

USIM PAC

DEVELOPMENT KIT

BRGM Software

DEVELOPMENT KIT

USIM PAC 3.0 - Development Kit


Programmer's Guide
A - INCORPORATION OF ICONS ............................................................................... 12
A.1 - INTRODUCTION.................................................................................................. 14
A.2 - HOW DOES AN ICON WORK? ........................................................................... 14
A.3 - HOW TO ADD AN ICON INTO THE LIBRARY?.................................................. 15
A.3.1 - The Visual FORTRAN environment......................................................... 15
A.3.2 - Add an icon into the user-defined library ................................................. 15
A.3.3 - Program an icon ...................................................................................... 18
A.3.4 - Build the new user-defined library ........................................................... 18
A.3.5 - Configure an icon..................................................................................... 18
A.3.6 - Test and use the new icon....................................................................... 18
A.4 - HOW TO BUILD AN ICON ? AN EXAMPLE ........................................................ 18
A.4.1 - The icon shell........................................................................................... 19
A.4.2 - Presence working mode: UP_PRESENT ................................................ 20
A.4.3 - Attribute working mode: UP_PARAM ...................................................... 20
A.4.4 - Drawing working mode: UP_DRAW ........................................................ 22
A.4.5 - Final version ............................................................................................ 23
A.5 - CODE TRANSLATION FROM VERSION 2.1 TO VERSION 3.0......................... 24
B - INCORPORATION OF MODELS ........................................................................... 25
B.1 - INTRODUCTION.................................................................................................. 27
B.2 - HOW DOES A MODEL WORK? .......................................................................... 27
B.3 - HOW TO ADD A MODEL INTO THE LIBRARY?................................................. 27
B.3.1 - The Visual FORTRAN environment......................................................... 27
B.3.2 - Add a model into the user-defined library ................................................ 28
B.3.3 - Program a model ..................................................................................... 30
B.3.4 - Build the new user-defined library ........................................................... 30
B.3.5 - Configure model parameters ................................................................... 30
B.3.6 - Test and use the new model.................................................................... 30
B.4 - HOW TO BUILD A MODEL? AN EXAMPLE........................................................ 30

USIM PAC

BRGM Software

DEVELOPMENT KIT

B.4.1 - The model shell ....................................................................................... 31


B.4.2 - Presence working mode: UP_PRESENT ................................................ 33
B.4.3 - Parameter working mode: UP_PARAM ................................................... 34
B.4.4 - Compatibility working mode: UP_COMP ................................................. 36
B.4.5 - Mathematical model working mode: UP_MODEL.................................... 37
B.4.6 - Power working mode: UP_POWER......................................................... 47
B.4.7 - Cost working mode: UP_COST ............................................................... 48
B.4.8 - Help working mode: UP_HELP................................................................ 49
B.4.9 - Final version ............................................................................................ 50
B.5 - CODE TRANSLATION FROM VERSION 2.1 TO VERSION 3.0......................... 59
C - FUNCTION LIST..................................................................................................... 60
C.1. - INTRODUCTION ................................................................................................ 62
C.2. - FUNCTIONS FOR ICON BUILDING................................................................... 62
C.2.1. - Declaration functions .............................................................................. 62
C.2.2. - Drawing functions ................................................................................... 62
C.3. - FUNCTIONS FOR MODEL BUILDING............................................................... 63
C.3.1. - UP_PRESENT functions ........................................................................ 63
C.3.2. - UP_PARAM functions............................................................................. 64
C.3.3. - UP_COMP functions............................................................................... 64
C.3.4. - UP_MODEL functions............................................................................. 65
C.3.5. - UP_POWER functions............................................................................ 71
C.3.6. - UP_COST functions ............................................................................... 71
C.3.7. - UP_HELP functions ................................................................................ 72
C.3.8. - Declaration functions .............................................................................. 72
C.3.9. - Data receiving functions ......................................................................... 73
C.3.10. - Data sending functions ......................................................................... 77
C.3.11. - Test functions ....................................................................................... 77
C.3.12. - Treatment functions .............................................................................. 78
C.3.13. - Message functions................................................................................ 79
C.4. - SYMBOLIC CONSTANTS .................................................................................. 80
C.4.1. - Number range of the icon or model library subsets ................................ 80
C.4.2. - Working modes and variants .................................................................. 80
C.4.3. - Model parameter input interface type ..................................................... 81
C.4.4. - Phase model description elements......................................................... 81
C.5. - VARIABLES USED BY ALL MODELS................................................................ 83
C.6. - VARIABLES USED BY ALL ICONS ................................................................... 83

USIM PAC

BRGM Software

DEVELOPMENT KIT

D - FUNCTION REFERENCES .................................................................................... 84


INTRODUCTION .......................................................................................................... 86
ARC .............................................................................................................................. 86
ARCINF ........................................................................................................................ 86
ARCSUP....................................................................................................................... 87
BCLASSGRA................................................................................................................ 87
CERCLE ....................................................................................................................... 88
CIAB ............................................................................................................................. 88
CIATTRITION ............................................................................................................... 88
CIBA ............................................................................................................................. 89
CIBO ............................................................................................................................. 89
CICA ............................................................................................................................. 90
CICC ............................................................................................................................. 91
CICD ............................................................................................................................. 91
CICF ............................................................................................................................. 92
CICG............................................................................................................................. 92
CICM............................................................................................................................. 93
CICO............................................................................................................................. 93
CICR ............................................................................................................................. 94
CICV ............................................................................................................................. 95
CICY ............................................................................................................................. 95
CIEP ............................................................................................................................. 96
CIFB.............................................................................................................................. 96
CIFT.............................................................................................................................. 97
CIGC............................................................................................................................. 97
CIGP ............................................................................................................................. 98
CIGV ............................................................................................................................. 98
CIJ ................................................................................................................................ 99
CIRA ............................................................................................................................. 99
CISP ........................................................................................................................... 100
CITANKCONE ............................................................................................................ 100
CITANKFLAT.............................................................................................................. 101
CITS............................................................................................................................ 102
CISM........................................................................................................................... 102
CLASSNAME.............................................................................................................. 103
COMPONENTNAME .................................................................................................. 103
COPYPHA .................................................................................................................. 104

USIM PAC

BRGM Software

DEVELOPMENT KIT

CRUSHPOINF ............................................................................................................ 104


CRUSHPOWER ......................................................................................................... 105
CUMFLOWPASSDX................................................................................................... 106
DXGAUDINTERP ....................................................................................................... 107
DXLOGINTERP .......................................................................................................... 108
FLOATINGNAME ....................................................................................................... 108
GDBLTOSTR.............................................................................................................. 109
GET0DHIER ............................................................................................................... 110
GET1DHIER ............................................................................................................... 111
GET2DHIER ............................................................................................................... 112
GETBOOLFORCOST................................................................................................. 113
GETCOMPDENSITY .................................................................................................. 114
GETCOMPLHV........................................................................................................... 114
GETDATACRUSH ...................................................................................................... 115
GETDENSANDVOLFLOWPERCOMP ....................................................................... 116
GETFLOATPROP....................................................................................................... 117
GETFLOWPERCOMPFIXEDSP................................................................................. 118
GETFLOWPERSIZECOMP........................................................................................ 118
GETFLOWRATE ........................................................................................................ 119
GETFLOWRATEPERCOMP ...................................................................................... 119
GETFLOWRATEPERFIXEDSP.................................................................................. 120
GETFLOWRATEPERSIZE ......................................................................................... 121
GETINTFORCOST ..................................................................................................... 121
GETLIQFLOWRATE................................................................................................... 123
GETLIQVOLFLOW ..................................................................................................... 123
GETMOLECULARMASS............................................................................................ 124
GETNAMECRUSH ..................................................................................................... 124
GETNBCRUSH........................................................................................................... 125
GETNBFLUXIN........................................................................................................... 125
GETNUMFLUX ........................................................................................................... 125
GETNUMFLUXIN ....................................................................................................... 126
GETOREFLOWRATE................................................................................................. 126
GETORESOLFLOWRATE ......................................................................................... 127
GETORESOLVOLFLOW............................................................................................ 127
GETPARAM................................................................................................................ 128
GETPARAMDUPLI1CRIT........................................................................................... 128
GETPARAMDUPLI2CRIT........................................................................................... 129

USIM PAC

BRGM Software

DEVELOPMENT KIT

GETPARAMDUPLI2PHA............................................................................................ 129
GETPARAMDUPLIPARAM ........................................................................................ 130
GETPARAMDUPLIPARAM1CRIT .............................................................................. 131
GETPARAMDUPLIPARAMPHASE ............................................................................ 131
GETPARAMDUPLIPHASE......................................................................................... 132
GETPARAMREAC...................................................................................................... 132
GETPARAMSTRING .................................................................................................. 134
GETPHADENSANDVOLFLOW .................................................................................. 134
GETPHASEDENSITY................................................................................................. 135
GETPHASELHV ......................................................................................................... 135
GETREALFORCOST ................................................................................................. 136
GETROSINRAMMLER ............................................................................................... 137
GETSIZEFRACTIONS................................................................................................ 138
GETSTOECHIOMOL.................................................................................................. 139
GETSTOECHIOMAS.................................................................................................. 139
GETSTREAMPHASEDENSITY.................................................................................. 140
GETUNITPARAM ....................................................................................................... 141
GETUNITPARAMDUPLI1CRIT .................................................................................. 141
GETUNITPARAMDUPLI2CRIT .................................................................................. 142
GETUNITPARAMDUPLI2PHA ................................................................................... 143
GETUNITPARAMDUPLIPARAM ................................................................................ 144
GETUNITPARAMDUPLIPARAM1CRIT...................................................................... 144
GETUNITPARAMDUPLIPARAMPHASE.................................................................... 145
GETUNITPARAMDUPLIPHASE ................................................................................ 146
GETUNITPARAMSTRING.......................................................................................... 147
GETVOLFLOWPERCOMP......................................................................................... 148
GETVOLFLOWRATE ................................................................................................. 148
MESSCONCAT .......................................................................................................... 149
MESSMODEL............................................................................................................. 149
MESSMODELINT ....................................................................................................... 150
MESSMODELNEWLINE ............................................................................................ 151
MESSMODELREAL ................................................................................................... 151
MESSMODELTAB...................................................................................................... 152
MESSMODELTEXT.................................................................................................... 153
MESSTOCONV .......................................................................................................... 154
MESSTOCOST........................................................................................................... 154
MESSTOPOWER ....................................................................................................... 154

USIM PAC

BRGM Software

10

DEVELOPMENT KIT

MESSTOSCREEN...................................................................................................... 155
NBCLASSCRIT........................................................................................................... 155
NBCRIT ...................................................................................................................... 156
NBHIER ...................................................................................................................... 156
NBHIER1D.................................................................................................................. 156
NBHIER2D.................................................................................................................. 157
NBPHA ....................................................................................................................... 157
NBPHATYP ................................................................................................................ 158
NBSORTIE ................................................................................................................. 158
NTYPPHA................................................................................................................... 158
NUMCRITYP .............................................................................................................. 159
NUMHIER0D .............................................................................................................. 159
NUMHIER1D .............................................................................................................. 159
NUMHIER2D .............................................................................................................. 160
NUMHIERSYS............................................................................................................ 161
NUMSHAREDHIERSYS............................................................................................. 161
NUMPHATYP ............................................................................................................. 162
PHASENAME ............................................................................................................. 162
PHAUTE ..................................................................................................................... 163
PERFPARREAC......................................................................................................... 163
PERFPARREAC0....................................................................................................... 164
PERFREAC0 .............................................................................................................. 165
PERFREACTION........................................................................................................ 166
PERFREACTION0...................................................................................................... 167
RECTAN ..................................................................................................................... 168
REGD ......................................................................................................................... 169
SEND0DTOSTREAMS............................................................................................... 169
SEND1DTOSTREAMS............................................................................................... 170
SEND2DTOSTREAMS............................................................................................... 171
SENDPHASEDENSITYTOSTREAMS........................................................................ 171
SENDTOPARAM ........................................................................................................ 172
SENDTOPARAMDUPLIPARAM................................................................................. 172
SENDTOPARAMNEXTAPP ....................................................................................... 173
SETCOMMINUTION................................................................................................... 173
SETCOST................................................................................................................... 174
SETFLOATPROP ....................................................................................................... 174
SETGROUP................................................................................................................ 175

USIM PAC

BRGM Software

DEVELOPMENT KIT

11

SETGROUPPARAM................................................................................................... 176
SETINFMODHIER ...................................................................................................... 176
SETINFOHELP........................................................................................................... 177
SETINFOMODEL ....................................................................................................... 177
SETNAME .................................................................................................................. 177
SETPARAMDATABASENAME .................................................................................. 178
SETPARAMDIALOGTYPE ......................................................................................... 178
SETPARAMDUPLI1CRIT ........................................................................................... 179
SETPARAMDUPLI2CRIT ........................................................................................... 180
SETPARAMDUPLI2PHA ............................................................................................ 180
SETPARAMDUPLIPARAM......................................................................................... 181
SETPARAMDUPLIPARAMPHASE............................................................................. 182
SETPARAMDUPLIPARAM1CRIT .............................................................................. 182
SETPARAMDUPLIPHASE ......................................................................................... 183
SETPARAMFILENAME .............................................................................................. 184
SETPARAMSTRING .................................................................................................. 184
SETPHA ..................................................................................................................... 185
SETPHASLIQ ............................................................................................................. 185
SETROSINRAMMLER ............................................................................................... 186
SETTYPE ................................................................................................................... 187
SHOWERROR............................................................................................................ 187
SIZECLASSNAME...................................................................................................... 188
SORTIE ...................................................................................................................... 188
TESTHIERTYP ........................................................................................................... 189
TESTPHAORE ........................................................................................................... 189
TESTPHASMOD ........................................................................................................ 189
TESTSIZECOMPFLOW ............................................................................................. 190
TESTSIZEFLOW ........................................................................................................ 190
TRACE........................................................................................................................ 190
ZEROPHA .................................................................................................................. 191
ZONERECT ................................................................................................................ 191

USIM PAC

BRGM Software

12

INCORPORATION OF ICONS

A - INCORPORATION OF ICONS

USIM PAC

BRGM Software

INCORPORATION OF ICONS

USIM PAC

13

BRGM Software

14

INCORPORATION OF ICONS

A.1 - INTRODUCTION
The principal function of the Flowsheet Drawing option is the preparation, for a
complete project, of a file containing the description of a flowsheet, not only in terms of
graphical characteristics, but also in terms of simulation logic. This logic is controlled by
USIM PAC before being able to use the flowsheet for further uses.
Thus an icon introduction results not only in the creation of a FORTRAN drawing
subroutine (VISUAL FORTRAN 6.6) but also in the insertion of the icon parameter
description (how many outputs, etc.).

A.2 - HOW DOES AN ICON WORK?


An icon, in terms of code programming, is a set of working modes. Each working mode
has a particular function. There are three working modes:

the icon presence test,

the declaration of the icon attributes,

the icon drawing.

The presence test is called to determine the icon list of the library.
The icon attributes are:

the influence area of the icon,

the number of outputs and number of output locations,

for each output location, the output number and the position of the location
center,

the default name,

the icon type.

They are used to determine the number of outputs in the flowsheet drawing.
The icon drawing is called everywhere an icon is drawn (i.e., flowsheet display,
equipment description and icon configuration).

Icon
Presence test
Icon attributes
Icon drawing

USIM PAC

BRGM Software

INCORPORATION OF ICONS

15

A.3 - HOW TO ADD AN ICON INTO THE LIBRARY?


To add an icon into the user-defined library, you must follow the sequence:

close the USIM PAC application,

run Visual FORTRAN,

add your icon into the icon list,

build your icon following some programming rules,

configure your icon,

test and use your icon.

A.3.1 - The Visual FORTRAN environment

The development environment of Visual FORTRAN is Visual Studio from Microsoft.


Before you run the Visual FORTRAN environment, close the USIM PAC application.
Inside Visual Studio, choose the menu item File / Open Workspace and select the file
UPDK.dsw in the subdirectory UPDK Files of the USIM PAC installation directory.
This workspace opens two projects: LibIcon32 and LibUser32. It displays their names
in the left part of the Visual framework.
Activate the project LibIcon32 by clicking with the right button of the mouse to display
the popup menu and select the menu item Set as active project. The name of the
project is then displayed in bold face.
To display the list of source files, expand the LibIcon32 project by double clicking on
the corresponding line, then expand the Source Files folder. Three files appear:
Icouser.for, Libicon32.def and Icons.lib. They must remain all together in this list but
you can add your own FORTRAN source files (files with extension .for).
Only the file Icouser.for will be modified.
Remark
To be able to reload automatically the UPDK workspace during the Visual FORTRAN
startup:

Choose the menu item Tools / Options,

In the Options box, choose the Workspace thumb,

Check the item Reload documents when opening workspace,

Check the item Reload last workspace at startup,

Click on the OK button.

A.3.2 - Add an icon into the user-defined library

When you are in the UPDK workspace, open the file Icouser.for by double clicking on
its name in the list:

USIM PAC

BRGM Software

16

INCORPORATION OF ICONS

C**********************************************************************
C*
USIM PAC 3.0
**
C*
Module: LIBICON
**
C*
File: ICOUSER.FOR
**
C*
Version: 3.0
**
C*
Date:
**
C*
Author:
**
C*
**
C**********************************************************************
C
C Subroutine beginning
C
INTEGER FUNCTION ICONUSER (XC, YC, NUM, BELONG)
INTEGER XC
INTEGER YC
INTEGER NUM
INTEGER BELONG
C
INCLUDE 'ICONS.FI'
C
INTEGER EXAMPLE
C
C Orientation depends on the unit number (NUM)
C
SELECT CASE (NUM)
C--------------------------------------------------------------------C
TRAINING SAMPLE
C---------------------------------------------------------------------CASE (USER+1)
ICONUSER = EXAMPLE (XC, YC, BELONG)
RETURN
C--------------------------------------------------------------------C---------------------------------------------------------------------CASE DEFAULT
ICONUSER = 0
RETURN
END SELECT
END
C--------------------------------------------------------------------C
TRAINING SAMPLE
C---------------------------------------------------------------------INTEGER FUNCTION EXAMPLE (XC, YC, BELONG)
INTEGER XC
INTEGER YC
INTEGER BELONG
C
INCLUDE 'ICONS.FI'
C
C Orientation depends on the working mode (BELONG)
C
SELECT CASE (BELONG)
CASE (UP_PRESENT)
EXAMPLE = 0
CASE (UP_PARAM)
CALL NBSORTIE (USER+1, 3)
CALL SORTIE (1, 1, XC+16, YC)
CALL SORTIE (2, 1, XC-16, YC)
CALL SORTIE (3, 2, XC, YC-16)
CALL ZONERECT (XC-32, XC+32, YC+20, YC-20)
ICONNAME = 'EXAMPLE' C
CALL SETNAME (ICONNAME)
CALL SETTYPE (USER+1)
EXAMPLE = 0
CASE (UP_DRAW)
CALL PHAUTE (XC, YC+16)
CALL TRACE (XC, YC-16)
CALL PHAUTE (XC-16, YC)
CALL TRACE (XC+16, YC)
CALL CERCLE (XC, YC, 16)

USIM PAC

BRGM Software

INCORPORATION OF ICONS

17

CALL RECTAN (32, 32, XC-16, YC+16)


EXAMPLE = 0
CASE DEFAULT
EXAMPLE = 0
END SELECT
END

The function ICONUSER is called by the USIM PAC flowsheet drawing or by different
icon parameter determinations.
The four parameters of the ICONUSER function are:

XC, the x-coordinate of the icon center,

YC, the y-coordinate of the icon center,

NUM, the icon number,

BELONG, a flag that allows the function to run in three different working
modes.

The NUM parameter is the icon number. It allows calling the desired icon following the
associated CASE statement.
The value of NUM for the user defined icons must be greater than USER + 1. The first
icon can take the number USER + 1 such as in the example.
The parameter BELONG determines a working mode. It can take the values:
UP_PRESENT, UP_PARAM and UP_DRAW.
To add your icon, with the number ??, in the library, insert the following lines in the
ICONUSER function:
CASE (USER + ??)
ICONUSER = MYICON (XC, YC, BELONG)
RETURN

between your last icon call and the CASE DEFAULT statement.
MYICON is the function that contains the program code of your icon as the function
EXAMPLE in file Icouser.for.
This icon function can be programmed into another file. To do that:

select the menu item File / New,

in the Files thumb choose Fortran Fixed Format Source File,

enter the new file name with extension .for in the File name box (for example
Myicon.for),

click on OK. The new file is created, opened and added into the Source Files
list.

program your function in the new file.

The coding of this function is described in section A.4.

USIM PAC

BRGM Software

18

INCORPORATION OF ICONS

The function ICONUSER must recognize the type of your function MYICON. Then you
must add the line:
INTEGER MYICON

just after the line:


INTEGER EXAMPLE

in the ICONUSER function.

A.3.3 - Program an icon

Now you can program your icon function at the end of the file ICOUSER.FOR file or in
another file as explained previously. The second solution is recommended to avoid
overwriting your own icons during an installation of a future version.
The description of the icon programming is detailed in section A.4.

A.3.4 - Build the new user-defined library

When the icon programming is complete, build the new user-defined library. For that,
choose the menu item Build / Build LibIcon32.dll. The compilation of the *.for files
and the link utility are run to create the new version of LibIcon32.dll.
If no errors or warnings appear, quit the Visual Studio environment.

A.3.5 - Configure an icon

Run the USIM PAC application to adjust the configuration file ICONS.CNF to the new
library.
Choose the icon configuration to set a name to the new icon, to put it in the hierarchy
using the Parent menu and to associate the appropriate models to it.
The icon configuration is described in the part B.

A.3.6 - Test and use the new icon

To test the icon, use it in the flowsheet drawing.

A.4 - HOW TO BUILD AN ICON ? AN EXAMPLE

USIM PAC

BRGM Software

INCORPORATION OF ICONS

19

The example selected to illustrate the icon programming is a magnetic separator icon.
We will take USER + 1 as the icon number.
The new icon is inserted in the library by means of an icon function MAGSEP. This
function is called by the ICONUSER function. Replace the line:
ICONUSER = EXAMPLE (XC, YC, BELONG)

by the line:
ICONUSER = MAGSEP (XC, YC, BELONG)

Then replace the line:


INTEGER EXAMPLE

by the line:
INTEGER MYICON

Now you can program the MAGSEP function.

A.4.1 - The icon shell

All icon functions have the same shell:


C--------------------------------------------------------------------C
Comment on icon XXX
C---------------------------------------------------------------------INTEGER
INTEGER
INTEGER
INTEGER

FUNCTION XXX (XC, YC, BELONG)


XC
YC
BELONG

C
INCLUDE 'ICONS.FI'
C
SELECT CASE (BELONG)
CASE (UP_PRESENT)
XXX = 1
CASE (UP_PARAM)
CALL NBSORTIE (, )
CALL SORTIE (, , XC+, YC-)
CALL ZONERECT (XC-, XC+, YC+, YC-)
ICONNAME = 'NAME OF XXX' C
CALL SETNAME (ICONNAME)
CALL SETTYPE ()
XXX = 1
CASE (UP_DRAW)
XXX = 1

USIM PAC

BRGM Software

20

INCORPORATION OF ICONS

CASE DEFAULT
XXX = 0
END SELECT
RETURN
C
END
C

You can automatically include this shell into your file by using a Visual Studio macro.
To have access to this macro, you need to add the macro file in the Visual Studio
macro file list. This operation has to be done only once:

select the menu item Tools / Customize,

in the Customize box, select the Add-ins and Macro Files thumb,

click on the Browse button and select the file Updk.dsm in the subdirectory
UPDK Files of the USIM PAC installation directory,

check the UPDK line and click on the Close button.

To insert the function shell into your program file:

put the cursor where you want to insert the function shell,

select the menu item Tools / Macro and click on the OK button of the
information message if it appears (you can remove this information message by
unchecking Show this next time),

in the Macro File list, choose UPDK,

in the Macro Name list, select IconShell and click on Run to insert the shell.

Now you can replace the function name XXX by your function name MAGSEP.

A.4.2 - Presence working mode: UP_PRESENT

In the UP_PRESENT case, the ICON function can take two values: 1 if the icon has to
be present, 0 if it does not. Thus, if a user wants to remove icons from the Toolbox
library, in the Flowsheet Drawing window, he does not need to delete the code or to put
it in comment lines, he just has to give the value 0 to the function return value in the
UP_PRESENT case.
By default, the icon shell gives 1 as the return value. The icon is present:
CASE (UP_PRESENT)
MAGSEP = 1

A.4.3 - Attribute working mode: UP_PARAM

In this working mode, five kinds of functions must be called. The first one, NBSORTIE,
gives the number of output locations of the icon; the second, SORTIE, gives the output
location parameters (number, type, coordinates); the third, ZONERECT, gives the

USIM PAC

BRGM Software

INCORPORATION OF ICONS

21

coordinates of the icon influence area; the fourth, SETNAME, gives the default name of
the icon; and the fifth, SETTYPE, gives the location of the icon into the hierarchy.
An icon can have several output locations. Some of these output locations can be
equivalent for symmetry reasons in which case they have the same type.
The first parameter of the NBSORTIE function is the icon number (here: USER+1). For
the user-defined icons, the icon number must be "USER + X" where X is an integer
equal or greater than 1. For each icon, the X number must be different.
The second parameter of the NBSORTIE function is the number of output locations for
this icon. This number includes all the outputs, not only the real ones, but also all the
equivalent ones. For instance, a ball or a rod mill has got two output locations (two
possible ones) but only one real one.
The first parameter of the SORTIE function is the output location number. The numbers
must begin at 1. The second parameter is the output type, as explained above, the real
output number. The third and the fourth are the (x,y)-coordinates of the output area
center (a 1212-square), given from the icon center coordinates.
In our example, we have four output locations but two real outputs. The output
locations 1 and 3 are relative to real output 1 and the output locations 2 and 4 are
relative to real output 2 (see program display below).
The ZONERECT function defines the coordinates of the icon influence area, given from
the icon center coordinates. The parameters are:

x-coordinate of the upper left corner,

y-coordinate of the upper left corner,

x-coordinate of the lower right corner,

y-coordinate of the lower right corner.

The icon influence area must enclose the entire icon drawing and its output areas to
prevent icon superposition.
The SETNAME function gives a default name to the icon. This name is stored in the
predefined string variable (255 characters) ICONNAME which is passed as parameter
in the function. This variable is initialized like this:
ICONNAME = 'MAGNETIC SEPARATOR' C

where the C at the end of the line is absolutely necessary.


By default, the default name appears in the icon configuration. So, we advise you to
choose an upper case default name to differentiate it from the name defined in the icon
configuration.

USIM PAC

BRGM Software

22

INCORPORATION OF ICONS

The SETTYPE function sets the icon in a family represented by a generic icon (see
part B). Its parameter is the number of the generic icon. A generic icon must be an
existing icon. If the type is the current icon number, this icon becomes a generic icon.
In our example, we choose the type 29, which is the number of the existing magnetic
separator.
The return value of the UP_PARAM block is set to 1.
CASE (UP_PARAM)
CALL NBSORTIE (USER+1, 4)
CALL SORTIE (1, 1, XC-20, YC-10)
CALL SORTIE (2, 2, XC+20, YC+2)
CALL SORTIE (3, 1, XC+20, YC-10)
CALL SORTIE (4, 2, XC-20, YC+2)
CALL ZONERECT (XC-44, XC+44, YC+32, YC-24)
ICONNAME = 'MAGNETIC SEPARATOR' C
CALL SETNAME (ICONNAME)
CALL SETTYPE (29)
MAGSEP = 1

A.4.4 - Drawing working mode: UP_DRAW

In this working mode, drawing functions are called:

PHAUTE (X, Y) moves the pen to (X, Y) point without drawing a line.

TRACE (X, Y) draws a line from the current point to the (X, Y) point.

RECTAN (L, H, X, Y) draws a rectangle with length L and height H; (X, Y) is the
upper-left corner.

CERCLE (X, Y, R) draws a circle with (X, Y) as center coordinates and the R
radius.

ARCINF (X, Y, R, IARC) draws a lower circle arc, center on (X, Y) with an R
radius. IARC is the percentage of a complete circle (50 for a half circle, 25 for a
quarter).

ARCSUP (X, Y, R, IARC) draws an upper circle arc. The parameters have the
same meaning as the ARCINF ones.

The return value of the UP_DRAW block must be set to 1.


CASE (UP_DRAW)
CALL RECTAN (40, 12, XC-20, YC+2)
CALL ARCSUP (XC-10, YC+2, 8, 50)
CALL ARCSUP (XC+10, YC+2, 8, 50)
CALL PHAUTE (XC+20, YC+2)
CALL TRACE (XC+24, YC-2)
MAGSEP = 1

Remark
It is possible to draw a new icon from an existing icon drawing by plotting function
addition. This is only possible with the UP_DRAW mode:

USIM PAC

BRGM Software

INCORPORATION OF ICONS

23

CASE (UP_DRAW)
MYICON = OLDICON (XC, YC, BELONG)
Additional drawing
MYICON = 1

The existing icon functions are in the files ICONS10.FOR, ICONS20.FOR,


ICONS21.FOR, ICONS22.FOR and ICONS30.FOR in the UPDK Files subdirectory.

A.4.5 - Final version

The icon is:

With the areas, the icon is:

The icon function MAGSEP is defined by:


C--------------------------------------------------------------------C
MAGNETIC SEPARATOR
C---------------------------------------------------------------------INTEGER
INTEGER
INTEGER
INTEGER

FUNCTION MAGSEP (XC, YC, BELONG)


XC
YC
BELONG

C
INCLUDE 'ICONS.FI'
C
SELECT CASE (BELONG)
CASE (UP_PRESENT)
MAGSEP = 1
CASE (UP_PARAM)
CALL NBSORTIE (USER+1, 4)
CALL SORTIE (1, 1, XC-20, YC-10)
CALL SORTIE (2, 2, XC+20, YC+2)
CALL SORTIE (3, 1, XC+20, YC-10)
CALL SORTIE (4, 2, XC-20, YC+2)
CALL ZONERECT (XC-44, XC+44, YC+32, YC-24)
ICONNAME = 'MAGNETIC SEPARATOR' C
CALL SETNAME (ICONNAME)
CALL SETTYPE (29)
MAGSEP = 1
CASE (UP_DRAW)

USIM PAC

BRGM Software

24

INCORPORATION OF ICONS

CALL RECTAN (40, 12, XC-20, YC+2)


CALL ARCSUP (XC-10, YC+2, 8, 50)
CALL ARCSUP (XC+10, YC+2, 8, 50)
CALL PHAUTE (XC+20, YC+2)
CALL TRACE (XC+24, YC-2)
MAGSEP = 1
CASE DEFAULT
MAGSEP = 0
END SELECT
RETURN
C
END
C

The function call is made by the following part of the ICONUSER function:
CASE (USER + 1)
ICONUSER = MAGSEP (XC, YC, BELONG)
RETURN

A.5 - CODE TRANSLATION FROM VERSION 2.1 TO VERSION 3.0


To translate a .FOR file for icons developed with the USIM PAC Development Kit
version 2.1 into the version 3.0:
Remove the line
$INCLUDE: 'ICONS.DCL'.

Replace all
INTEGER*2

by
INTEGER.

Remove all
[FAR].

Replace all lines


$INCLUDE: 'DEFICON.DCL'

by
INCLUDE 'ICONS.FI'

Compile with option warning if undeclared variable.


Declare all undeclared variables.

USIM PAC

BRGM Software

INCORPORATION OF MODELS

25

B - INCORPORATION OF MODELS

USIM PAC

BRGM Software

26

USIM PAC

INCORPORATION OF MODELS

BRGM Software

INCORPORATION OF MODELS

27

B.1 - INTRODUCTION
This chapter explains how a new model is incorporated into the simulator. It does not
explain the principles of model design and specification.

B.2 - HOW DOES A MODEL WORK?


A mathematical model of a unit operation is a set of equations describing the changes
occurring to the feed materials during the process.
In the USIM PAC environment, a model may incorporate complementary functions,
such as the investment cost calculation, the power calculation, or at least gives some
information to the simulator: I am here, I have "x" parameters.
The principle of the communication between the models and the calling algorithms is
the following:

a model is called with a "working mode", corresponding to the type of


information required by the algorithm,

the model is then getting the data it needs, making calculations, and answering
(or not),

the calling routines then manage the answers of the model.

Section B.4 explains in detail the different "working modes" of the models, and what the
models do when they are called.

B.3 - HOW TO ADD A MODEL INTO THE LIBRARY?


To add a model into the user-defined library, you must follow the working sequence:

close the USIM PAC application,

run Visual FORTRAN,

add your model into the model list,

build your model following some programming rules,

configure your model parameters,

test and use your model.

B.3.1 - The Visual FORTRAN environment

The development environment of Visual FORTRAN is Visual Studio from Microsoft.


Before tou run the Visual FORTRAN environment, close the USIM PAC application.
Inside Visual Studio, choose the menu item File / Open Workspace and select the file
UPDK.dsw in the subdirectory UPDK Files of the USIM PAC installation directory.

USIM PAC

BRGM Software

28

INCORPORATION OF MODELS

This workspace opens two projects: LibIcon32 and LibUser32. It displays their names
in the left part of the Visual framework.
Activate the project LibUser32 by clicking with the right button of the mouse to display
the popup menu and select the menu item Set as active project. The name of the
project is then displayed in bold face.
To display the list of source files, expand the LibUser32 project by double clicking on
the corresponding line then expand the Source Files folder. Three files appear:
Messages.txt, Moduser.for and ModUser.lib. They must remain all together in this
list but you can add your own FORTRAN source files (files with extension .for).
Only the files Messages.txt and Moduser.for will be modified.
Remark
To be able to reload automatically the UPDK workspace during the Visual FORTRAN
startup:

Choose the menu item Tools / Options,

In the Options box, choose the Workspace thumb,

Check the item Reload documents when opening workspace,

Check the item Reload last workspace at startup,

Click on the OK button.

B.3.2 - Add a model into the user-defined library

When you are in the UPDK workspace, open the file Moduser.for by double clicking on
its name in the list:
C*********************************************************************
C*
USIM PAC 3.0
*
C*
Module: User defined models library
*
C*
File: MODUSER.FOR
*
C*
Version: 3.0
*
C*
Date:
*
C*
Author:
*
C*********************************************************************
C
C
C List of models
C
INTEGER FUNCTION MODELUSER (NUM, USE, USEOPT)
!DEC$ ATTRIBUTES DLLEXPORT :: MODELUSER
INTEGER NUM
INTEGER USE
INTEGER USEOPT
C
INCLUDE 'MODELS.FI'
C
INTEGER EXAMPLE
C
C Orientation depends on the unit number (NUM)
C
SELECT CASE (NUM)
C
CASE (NUMMOD_USER)
C
MODELUSER = EXAMPLE (USE, USEOPT)
C
RETURN

USIM PAC

BRGM Software

INCORPORATION OF MODELS

29

CASE DEFAULT
MODELUSER = 0
END SELECT
RETURN
END
C

The function MODELUSER is called by the USIM PAC model management.


The NUM parameter is the model number. It allows to call the desired model following
the associated CASE statement.
The value of NUM for the user-defined models must be in the range from
NUMMOD_USER to NUMMODMAX_USER (NUMMOD_USER+99). The first model
can take the number NUMMOD_USER such as the example.
The parameter USE determines a working mode. It can take the values:
UP_PRESENT, UP_PARAM, UP_COMP, UP_MODEL, UP_POWER, UP_COST and
UP_HELP.
The parameter USEOPT determines an option of the working mode.
To add your model, with the additional number ??, into the library, insert the lines:
CASE (NUMMOD_USER + ??)
MODELUSER = MYMODEL (USE, USEOPT)
RETURN

between your last model and the CASE DEFAULT statement.


MYMODEL is the function that contains the program code of your model.
This model function can be programmed into another file. To do that:

select the menu item File / New,

in the Files thumb, choose Fortran Fixed Format Source File,

enter the new file name with extension .for in the File name box (for example
Mymodel.for),

click on OK. The new file is created, opened and added in the Source Files list.

program your function in the new file.

The coding of this function is described in the section B.4.


The function MODELUSER must recognize the type of your function MYMODEL. Then
you must add the line:

USIM PAC

BRGM Software

30

INCORPORATION OF MODELS

INTEGER MYMODEL

just after:
INTEGER EXAMPLE

B.3.3 - Program a model

Now you can program your model function at the end of the file MODUSER.FOR or in
another file as explained previously. The second solution is recommended to avoid
overwriting your own models during an installation of a future version.
The description of the model programming is detailed in section B.4.

B.3.4 - Build the new user-defined library

When the model programming is complete, build the new user-defined library. For that,
choose the menu item Build / Build LibUser32.dll. The compilation of the *.for files
and the link utility are run to create the new version of LibUser.dll.
If no errors or warnings appear, quit the Visual Studio environment.

B.3.5 - Configure model parameters

Run the USIM PAC application to adjust the configuration file MODELS.CNF to the
new library.
Choose the model parameters configuration to name the new model and its
parameters, then define the type of each parameter.
The model parameters configuration is described in part B. If you have the
Development Kit option, some options are available in addition in the configuration tool
(such as edition of minimum and maximum code or choice between integer and real).

B.3.6 - Test and use the new model

To test your model, use it in different situations and observe the messages that are
sent.

B.4 - HOW TO BUILD A MODEL? AN EXAMPLE


The example selected to illustrate the model building is one of the models used for the
simulation of flotation cell banks. This example is a model of the physical separation
library LIBPHYSE.DLL. We will take NUMMOD_USER + 1 as the model number.

USIM PAC

BRGM Software

INCORPORATION OF MODELS

31

The new model is inserted in the user-defined library by means of a model function
FLOG. This function is called by the MODELUSER function:
CASE (NUMMOD_USER + 1)
MODELUSER = FLOG (USE, USEOPT)
RETURN

Then add the line:


INTEGER FLOG

just after the line:


INTEGER EXAMPLE

Now we can build the FLOG function.

B.4.1 - The model shell

All model functions have the same shell:


C**********************************************************************
C* Name of model XXX
*
C**********************************************************************
C
INTEGER FUNCTION XXX (USE, USEOPT)
INTEGER USE
INTEGER USEOPT
C
INCLUDE 'MODELS.FI'
C
C
Comment on model XXX
C
REAL*8 COUT
MODELNAME = 'NAME OF XXX' C
ANSWER = '' C
SELECT CASE (USE)
CASE (UP_PRESENT)
SELECT CASE (USEOPT)
CASE (UP_PRESENT_TEST)
XXX = 1
CASE (UP_PRESENT_INFO)
CALL SETINFOMODEL (, , )
XXX = 1
END SELECT
RETURN

C
C

USIM PAC

CASE (UP_PARAM)
SELECT CASE (USEOPT)
CASE (UP_PARAM_DIALOGTYPE)
CALL SETPARAMDIALOGTYPE (TP_SIMPLEPARAM)
List of the parameters:
1 :
XXX = 1

BRGM Software

32

INCORPORATION OF MODELS

END SELECT
RETURN
CASE (UP_COMP)
SELECT CASE (USEOPT)
CASE (UP_COMP_NECESSAIRE)
XXX = 1
CASE (UP_COMP_TRAITE)
XXX = 1
END SELECT
RETURN
CASE (UP_MODEL)
IF (USEOPT.EQ.UP_MODEL_MESSAGE) THEN
ANSWER = '' C
CALL MESSMODELNEWLINE (ANSWER)
CALL MESSMODEL (MODELNAME, 1, ANSWER)
CALL MESSMODELNEWLINE (ANSWER)
CALL MESSTOCONV (ANSWER)
ENDIF
XXX = 1
RETURN
CASE (UP_COST)
SELECT CASE (USEOPT)
CASE (UP_COST_CALC)
COUT = 0.D0
IF (COUT.EQ.0.D0) THEN
CALL SETCOST (0, ,COUT)
ELSE
CALL SETCOST (1, ,COUT)
ENDIF
XXX = 1
END SELECT
RETURN
CASE (UP_HELP)
SELECT CASE (USEOPT)
CASE (UP_HELP_INFO)
MODELHELPFILE = 'XXX.HLP' C
CALL SETINFOHELP (MODELHELPFILE, )
XXX = 1
END SELECT
RETURN
CASE DEFAULT
XXX = 0
RETURN
END SELECT
END
C

You can automatically include this shell into your file by using a Visual Studio macro.
To have access to this macro, you need to add the macro file in the Visual Studio
macro file list. This operation has to be done only one time (it is not necessary to do it if
you already did it for the icon incorporation):

select the menu item Tools / Customize,

in the Customize box select the Add-ins and Macro Files thumb,

click on the Browse button and select the file Updk.dsm in the subdirectory
UPDK Files of the USIM PAC installation directory,

USIM PAC

BRGM Software

INCORPORATION OF MODELS

33

check the UPDK line and click on the Close button.

To insert the function shell into your program file:

put the cursor where you want to insert the function shell,

select the menu item Tools / Macro and click on the OK button of the
information message if it appears (you can remove this information message by
unchecking Show this next time),

in the Macro File list choose UPDK,

in the Macro Name list select ModelShell and click on Run to insert the shell.

Now you can replace the function name XXX by your function name FLOG.

B.4.2 - Presence working mode: UP_PRESENT

The UP_PRESENT working mode has two options: UP_PRESENT_TEST and


UP_PRESENT_INFO.
UP_PRESENT_TEST is used only to test the presence of the model. If the return value
is 1, the model is present; if the return value is 0, the model is regarded as missing.
This can be used to hide a model without altering your code.
UP_PRESENT_INFO is used to give some fundamental information about the model:

a confirmation of the model number,

the number of output streams,

the number of parameters in the parameter configuration,

the material description elements that are not conserved (used for the material
balance tool).
CASE (UP_PRESENT)
SELECT CASE (USEOPT)
CASE (UP_PRESENT_TEST)
FLOG = 1
CASE (UP_PRESENT_INFO)
CALL SETINFOMODEL (NUMMOD_USER+1, 2, 8)
FLOG = 1
END SELECT
RETURN

The function SETINFOMODEL sets the model number, the number of output streams
and the number of parameters. This function must be called for each model.
If there is no information about the material conservation, the USIM PAC material
balance assumes that the model conserves the whole material. Otherwise, you must
indicate all the material description elements that will not be conserved.
The function SETINFMODHIER asserts that there are no conservation laws.

USIM PAC

BRGM Software

34

INCORPORATION OF MODELS

The function SETCOMMINUTION asserts that the size distribution is not kept (the
partial flowrate per size fraction is not conserved).
To take into account the model information, the return value must be 1.

B.4.3 - Parameter working mode: UP_PARAM

The UP_PARAM working mode has one option: UP_PARAM_DIALOGTYPE. It is


used to declare the type of the dialog box for the parameter edition and the duplication
mode of multiple parameters. A multiple parameter is a parameter that is duplicated as
many times as the number of classes of a criterion of the material description, for
example.
CASE (UP_PARAM)
SELECT CASE (USEOPT)
CASE (UP_PARAM_DIALOGTYPE)
CALL SETPARAMDIALOGTYPE (TP_DUPLIPARAM)
List of parameters:
1 : Number of banks in parallel
2 : Number of cells in a bank
3 : Pulp volume in one cell (m3)
4 : % water in the concentrate
Flotation parameters group
ANSWER = '' C
CALL MESSMODEL (MODELNAME, 20, ANSWER)
CALL SETGROUP (1, ANSWER)
5 : Size of the largest floating particle (m) per component
CALL SETPARAMDUPLI1CRIT (5, TYPORE, CRITCOMP)
CALL SETPARAMDUPLI1CRIT (5, TYPSOL, CRITCOMP)
CALL SETGROUPPARAM (1, 5)
6 : Size of the easiest floating particle (m) per component
CALL SETPARAMDUPLI1CRIT (6, TYPORE, CRITCOMP)
CALL SETPARAMDUPLI1CRIT (6, TYPSOL, CRITCOMP)
CALL SETGROUPPARAM (1, 6)
7 : Adjustment parameter per component
CALL SETPARAMDUPLI1CRIT (7, TYPORE, CRITCOMP)
CALL SETPARAMDUPLI1CRIT (7, TYPSOL, CRITCOMP)
CALL SETGROUPPARAM (1, 7)
8 : Effective volume percentage
FLOG = 1
END SELECT
RETURN

C
C
C
C
C
C

The function SETPARAMDIALOGTYPE sets the dialog box type. Here, there are four
types of dialog boxes:

TP_NOPARAM

dialog box for a model without parameter,

TP_SIMPLEPARAM
parameters,

dialog

TP_DUPLIPARAM

dialog box for a model with multiple parameter(s).

TP_CRUSHPARAM
database.

dialog box specialized for a crusher model in the

box

for

model

without

any

multiple

Version 3.0 doesn't take into account the type of the dialog box. It is automatically detected. The
different types are kept only for compatibility with previous versions.

USIM PAC

BRGM Software

INCORPORATION OF MODELS

35

The function SETPARAMDUPLI1CRIT declares the criterion and the phase type on
which the multiple parameter is duplicated (for more information about the phase
model, see part B).
In our example, parameters 5, 6 and 7 are multiple parameters. They are duplicated for
all the components of the ore or solid type phases.
As they have exactly the same duplication, these three parameters can be grouped in
one table with components in the lines and parameters in the columns. The function
SETGROUP (NUM, ANSWER) declares a group of parameters with the number NUM
and the name ANSWER. The name is stored in the file MESSAGES.TXT.
The function MESSMODEL (SEQUENCEKEYWORD, MESSAGEKEYWORD,
ANSWER) adds the message designated by MESSAGEKEYWORD of the sequence
SEQUENCEKEYWORD found in file MESSAGES.TXT to the string ANSWER.
In all models, it is advised to designate the sequence by MODELNAME and the
message by a number.
Notes
The string can be defined in the code with
ANSWER = 'TEXT' C
(The C attribute is necessary for compatibility with the C.), but it will not be
possible to modify it without compiling and linking.
The file MESSAGES.TXT can be edited with Visual Studio
Other usable functions for message formatting are described in parts C and D.
Example of [FLOG] sequence in the MESSAGES.TXT file:
[FLOG]
1=---> Flotation (2B)
2=Number of banks is 0.
3=Number of cells is 0.
4=Cell volume is 0 m3.
5=-> Cell\t%i
6=Phase %s\t
7=Recovery in cell (fraction)\t
8=Cumulative recovery (fraction)\t
9=%s\t
10=%g\t
11=Total weight recovery (fraction)\t%g
12=Error: Flotation (2B) - this model needs the floating ability
description of every component of the ore and solid phases.
13=Warning! Too high water flowrate in the concentrate. Verify your data.
14=Cumulative residence time (s)\t%g
20=Flotation parameters per component

You can also duplicate a parameter along the different phases, along two criteria of a
phase type, along one criterion of a phase type and one criterion of an another phase
type, along another parameter (integer parameter), along another parameter and a
criterion. For more details, see the function list in the part C.
To take into account the parameter information, the return value must be 1.

USIM PAC

BRGM Software

36

INCORPORATION OF MODELS

B.4.4 - Compatibility working mode: UP_COMP

The UP_COMP working mode has two options: UP_COMP_NECESSAIRE and


UP_COMP_TRAITE.
UP_COMP_NECESSAIRE is used to declare the material description elements that
are absolutely required to use the model. UP_COMP_TRAITE declares the material
description elements that are treated by the model. Both options use the same set of
functions.
The following example is the UP_COMP working mode of a mill model:
CASE (UP_COMP)
SELECT CASE (USEOPT)
CASE (UP_COMP_NECESSAIRE)
BOU1 = TESTPHASMOD (GRANULATS)
CASE (UP_COMP_TRAITE)
BOU1 = TESTPHASMOD (UPVER1)
END SELECT
RETURN

The function TESTPHASMOD tests the phase model coherence with an industrial
domain. The two domains considered here are:

GRANULATS: for the aggregates, sand and gravel industry,

UPVER1: for the mineral processing industry.

The first domain requires the presence of at least one ore type phase and a size
distribution in this phase. The second one requires the presence of at least one ore
type phase and a component grade per size class in this phase.
The functions TESTPHAORE, TESTSIZEFLOW and TESTSIZECOMPFLOW can be
used in the UP_COMP working mode. All the functions used in the UP_MODEL
working mode relative to the phase model can be used in this working mode.
If the test is positive, the return value must be 1, else 0.
If the UP_COMP working mode in the model function is omitted (as in our example
FLOG), the return value will be 0 and the compatibility of the model with the phase
model could be negative in a future version of USIM PAC. So we recommend to insert
systematically the lines:
CASE (UP_COMP)
SELECT CASE (USEOPT)
CASE (UP_COMP_NECESSAIRE)
FLOG = 1
CASE (UP_COMP_TRAITE)
FLOG = 1
END SELECT
RETURN

USIM PAC

BRGM Software

INCORPORATION OF MODELS

37

B.4.5 - Mathematical model working mode: UP_MODEL

This working mode has an option, UP_MODEL_MESSAGE, which allows to write


information in the CONV.INF file while the calculation is running.
This option is specified through the window Advanced use which appears before
running a calculation: the item Model trace allows to write in CONV.INF at each
iteration, the item Convergence report allows to run a supplementary iteration once
the convergence is reached, during which the models will write in CONV.INF (see part
B).
Beginning the calculation mode
The following lines appear in all models to write the model name into the CONV.INF file if
required:
CASE (UP_MODEL)
IF (USEOPT.EQ.UP_MODEL_MESSAGE) THEN
ANSWER = '' C
CALL MESSMODELNEWLINE (ANSWER)
CALL MESSMODEL (MODELNAME, 1, ANSWER)
CALL MESSMODELNEWLINE (ANSWER)
CALL MESSTOCONV (ANSWER)
ENDIF

The function MESSMODELNEWLINE (ANSWER) adds a "Carriage return, line feed" to


the C compatible string ANSWER.
The function MESSTOCONV (ANSWER) writes the string ANSWER in the file
CONV.INF and clears the string ANSWER.
Reading the simple parameters: the model gets the parameters it needs
C

1 : Number of banks in parallel


OK = GETPARAM (1, PARAM)
NOMB = IIDINT (PARAM)
2 : Number of cells in a bank
OK = GETPARAM (2, PARAM)
NOCELL = IIDINT (PARAM)
3 : Pulp volume in one cell (m3)
OK = GETPARAM (3, CELVOL)
4 : % water in the concentrate
OK = GETPARAM (4, LIQPC)
LIQPC = LIQPC / 100.D0
IF (LIQPC.GT.0.99D0) LIQPC = 0.99D0
IF (LIQPC.LT.0.D0) LIQPC = 0.D0

C
C
C

The function GETPARAM (NUMBER, VALUE) is used for simple parameters (not
duplicated). VALUE must be declared as REAL*8. If the parameter is an integer,
VALUE has to be converted into INTEGER using the IIDINT intrinsic FORTRAN
function.
Testing parameter values and displaying messages on the screen
ANSWER = '' C
IF (NOMB.LE.0) THEN
CALL MESSMODEL (MODELNAME, 2, ANSWER)
CALL MESSTOSCREEN (ANSWER)
FLOG = 0

USIM PAC

BRGM Software

38

INCORPORATION OF MODELS

RETURN
ENDIF
IF (NOCELL.LE.0) THEN
CALL MESSMODEL (MODELNAME, 3, ANSWER)
CALL MESSTOSCREEN (ANSWER)
FLOG = 0
RETURN
ENDIF
IF(CELVOL.LE.0.D0) THEN
CALL MESSMODEL (MODELNAME, 4, ANSWER)
CALL MESSTOSCREEN (ANSWER)
FLOG = 0
RETURN
ENDIF

The function MESSTOSCREEN (ANSWER) displays the string ANSWER in a


MessageBox. The option UP_MODEL_MESSAGE is not required to write on the
screen.
If a test fails, the return value is 0 to stop the simulation.
Getting information on streams
OK = GETORESOLFLOWRATE (0, DSOL)
OK = GETORESOLVOLFLOW (0, DSOLVOL)
OK = GETLIQFLOWRATE (0, DLIQ)
OK = GETLIQVOLFLOW (0, DLIQVOL)
IF ((DSOL.LE.0.D0).OR.(DSOLVOL.LE.0.D0)) THEN
FLOG = 1
RETURN
ENDIF

The function GETORESOLFLOWRATE (NUMFLUX, DSOL) sets the REAL*8 variable


DSOL to the value in kg/s of the total flowrate of solids (ore and solid phases) in the
stream NUMFLUX.
The function GETORESOLVOLFLOW (NUMFLUX, DSOLVOL) sets the REAL*8
variable DSOLVOL to the value in l/s of the total volumetric flowrate of solids (ore and
solids phases) in the stream NUMFLUX.
The function GETLIQFLOWRATE (NUMFLUX, DLIQ) sets the REAL*8 variable DLIQ
to the value in kg/s of the total flowrate of liquids (all liquid phases) in the stream
NUMFLUX.
The function GETLIQVOLFLOW (NUMFLUX, DLIQVOL) sets the REAL*8 variable
DLIQVOL to the value in l/s of the total volumetric flowrate of liquids (all liquid phases)
in the stream NUMFLUX.
If NUMFLUX is 0, the sum of all input streams of the unit is considered. If NUMFLUX is
not 0, it represents the stream number in the flowsheet.
The function GETNUMFLUX (OUTPUT) returns the stream number in the flowsheet of
the output index OUTPUT of the model, number defined when programming the icons.
With this function, a model can get any information about its output streams at the
previous iteration.
The function GETNUMFLUXIN (INPUT) returns the stream number in the flowsheet of
the input index INPUT of the model, number defining the order of input streams
between 1 and the number returned by the function GETNBFLUXIN (). With this
function, a model can get any information about a particular input stream.

USIM PAC

BRGM Software

INCORPORATION OF MODELS

39

Note
Other usable function: GETOREFLOWRATE (NUMFLUX, DSOL).
In the case of no solids (null ore or solid phase flowrates), the calculation is stopped
with a return value of 1. The simulation continues and the output streams will be
calculated by default (everything in output 1 - tailings).
Testing the phase model

&

NCGMAX = 0
NTYMAX = 0
NBPHASOL = 0
DO NPHA = 1, NBPHA ()
IF (NTYPPHA (NPHA).EQ.TYPGAZ) THEN
OK = COPYPHA (2, NPHA)
OK = ZEROPHA (1, NPHA)
ELSEIF ((NTYPPHA (NPHA).EQ.TYPORE).OR.
(NTYPPHA (NPHA).EQ.TYPSOL)) THEN
NCG = NBCLASSCRIT (NPHA, CRITSIZE)
IF (NCG.LE.0) NCG = 1
IF (NCG.GT.NCGMAX) NCGMAX = NCG
NTY = NBCLASSCRIT (NPHA, CRITCOMP)
IF (NTY.LE.0) NTY = 1
IF (NTY.GT.NTYMAX) NTYMAX = NTY
NBPHASOL = NBPHASOL + 1
ENDIF
END DO
IF (NBPHASOL.LE.0) THEN
FLOG = 1
RETURN
ENDIF

The function NBPHA () returns the number of phases in the phase model.
The function NTYPPHA (NPHA) returns the type of the phase of number NPHA. It may
be TYPORE, TYPSOL, TYPLIQ, or TYPGAZ.
The function NBCLASSCRIT (NPHA, CRITERIA) returns the number of classes of the
criterion CRITERIA of the phase NPHA. It is an INTEGER variable. The criteria can be
CRITSIZE (size classes), CRITCOMP (components), CRITFLOT (flotation subpopulations), CRITFIXEDSP1, CRITFIXEDSP2 or CRITFIXEDSP3 (user-defined subpopulations).
The gas phases are supposed to go with the concentrate (output 2).
The function COPYPHA (OUTPUT, NPHA) copies the phase NPHA in the output of
index OUTPUT as is.
The function ZEROPHA (OUTPUT, NPHA) initializes the phase NPHA in the output of
index OUTPUT with a null flowrate.
Allocating arrays
ALLOCATE
ALLOCATE
ALLOCATE
ALLOCATE

USIM PAC

(KC (NCGMAX, NTYMAX, NBPHASOL))


(FLOR (NCGMAX, NTYMAX, NBPHASOL))
(FLOL (NCGMAX, NTYMAX, NBPHASOL))
(SORR (NCGMAX, NTYMAX, NBPHASOL))

BRGM Software

40

INCORPORATION OF MODELS

ALLOCATE
ALLOCATE
ALLOCATE
ALLOCATE

(SORL (NCGMAX, NTYMAX, NBPHASOL))


(DENS (NTYMAX, NBPHASOL))
(REC (NTYMAX, NBPHASOL), ALIM (NTYMAX, NBPHASOL))
(DEBIFLO (NTYMAX, 3, NBPHASOL))

The dimensions of arrays when allocated must not be 0. Each ALLOCATEd array has
to be DEALLOCATEd (see later).
Declaration: REAL*8 (or INTEGER) ARRAY [ALLOCATABLE] (:,:) . The number of ":"
represents the number of dimensions of the array.
Getting duplicated parameters:
C

&

Feed of the first cell


NPHASOL = 0
DO NPHA = 1, NBPHA ()
IF ((NTYPPHA (NPHA).EQ.TYPORE).OR.
(NTYPPHA (NPHA).EQ.TYPSOL)) THEN
NPHASOL = NPHASOL + 1
NCG = NBCLASSCRIT (NPHA, CRITSIZE)
IF (NCG.LE.0) NCG = 1
NTY = NBCLASSCRIT (NPHA, CRITCOMP)
IF (NTY.LE.0) NTY = 1
ALLOCATE (MAXDIM (NTY))
OK = GETPARAMDUPLI1CRIT (NPHA, 5, MAXDIM)
ALLOCATE (FACEDIM (NTY))
OK = GETPARAMDUPLI1CRIT (NPHA, 6, FACEDIM)
ALLOCATE (ALPHA (NTY))
OK = GETPARAMDUPLI1CRIT (NPHA, 7, ALPHA)

The function GETPARAMDUPLI1CRIT (NPHA, NPAR, ARRAY) imports the


duplicated values of the parameter number NPAR corresponding to the phase NPHA
into the 1-dimensional ARRAY of REAL*8.
See parts C and D for the description of the other functions for duplicated parameter
import.
Getting the upper limits of size classes
ALLOCATE (BSUP (NCG))
OK = BCLASSGRA (NPHA, BSUP)

The function BCLASSGRA (NPHA, BSUP) gives the upper bounds of the size classes
in meters. REAL*8 array BSUP has to be allocated.
Getting the mean size of each class
DO I = 1, NCG
BSUP (I) = BSUP (I) * 1.D06
END DO
DO I = 1, NCG - 1
BSUP (I) = DSQRT (BSUP (I) * BSUP (I+1))
END DO
IF (BSUP (NCG).LT.1.D0) THEN
BSUP (NCG) = BSUP (NCG) / 2.D0
ELSE
BSUP (NCG) = DSQRT (BSUP (NCG))
ENDIF

USIM PAC

BRGM Software

INCORPORATION OF MODELS

41

The models generally use the geometric mean of the size class limits, and the
arithmetic mean for the finest class (then assuming the lower limit is 0 m).
Calculation of the kinetic constant by component and size class
C

&

Kinetic constant in s-1


DO J = 1, NTY
DO I = 1, NCG
IF (BSUP (I).GT.MAXDIM (J)) THEN
KC (I, J, NPHASOL) = 0.D0
ELSEIF ((BSUP (I).LT.1.D-10).OR.
(MAXDIM (J).LT.1.D-10)) THEN
KC (I, J, NPHASOL) = 0.D0
ELSE
TMP1 = ALPHA (J) / DSQRT (BSUP (I))
TMP2 = 1.D0 - ((BSUP (I) / MAXDIM (J)) ** 1.5D0)
TMP3 = FACEDIM (J) / 2.D0 / BSUP (I)
TMP3 = - TMP3 * TMP3
IF (TMP3.LT.-600.D0) TMP3 = -600.D0
TMP3 = DEXP (TMP3)
KC (I, J, NPHASOL) = TMP1 * TMP2 * TMP3 / 3600.D0
ENDIF
ENDDO
ENDDO
DEALLOCATE
DEALLOCATE
DEALLOCATE
DEALLOCATE

(BSUP)
(MAXDIM)
(FACEDIM)
(ALPHA)

Getting component density


ALLOCATE (INTER (NTY))
OK = GETCOMPDENSITY (NPHA, NTY, INTER)
DO I = 1, NTY
DENS (I, NPHASOL) = INTER (I)
END DO
DEALLOCATE (INTER)

The function GETCOMPDENSITY (NPHA, NTY, ARRAY) gives the density of the NTY
components of the phase NPHA into the ARRAY. If the density is not specified per
component in the phase model, and if there are several components, each of them has
the density of the phase. If the density of the phase is not specified in the phase model,
this function returns a negative value.
Getting information per phase on streams

USIM PAC

DO I = 1, NTY
ALIM (I, NPHASOL) = 0.D0
REC (I, NPHASOL) = 0.D0
1 = no floating, 2 = slow, 3 = fast
DEBIFLO (I, 1, NPHASOL) = 0.D0
DEBIFLO (I, 2, NPHASOL) = 0.D0
DEBIFLO (I, 3, NPHASOL) = 0.D0
DO J = 1, NCG
FLOR (J, I, NPHASOL) = 0.D0
FLOL (J, I, NPHASOL) = 0.D0
SORR (J, I, NPHASOL) = 0.D0
SORL (J, I, NPHASOL) = 0.D0
END DO
END DO

BRGM Software

42

INCORPORATION OF MODELS

OK = GETFLOWRATE (0, NPHA, DEBIT)


IF (DEBIT.GT.0.D0) THEN
ALLOCATE (NOFLO (NTY), SLOWFLO (NTY), FASTFLO (NTY))
OK = GETFLOATPROP (0, NPHA, NTY, NOFLO,SLOWFLO,FASTFLO)
IF (OK.LT.0) THEN
DO I = 1, NTY
NOFLO (I) = 0.D0
SLOWFLO (I) = 0.D0
FASTFLO (I) = 1.D0
END DO
IF (USEOPT.EQ.UP_MODEL_MESSAGE) THEN
ANSWER = '' C
CALL MESSMODEL (MODELNAME, 12, ANSWER)
CALL MESSTOCONV (ANSWER)
ENDIF
ENDIF
ALLOCATE (ENTR (NCG, NTY))
OK = GETFLOWPERSIZECOMP (0, NPHA, NCG, NTY, ENTR)

The function GETFLOWRATE (NUMFLUX, NPHA, FLOWRATE) copies the global


flowrate of the phase NPHA in the stream NUMFLUX into the variable REAL*8
FLOWRATE.
The function GETFLOATPROP (NUMFLUX, NPHA, NTY, NOFLO, SLOWFLO,
FASTFLO) gives directly the proportions of no-floating (array NOFLO), slow-floating
(SLOWFLO), fast-floating (FASTFLO) particles for the phase NPHA in the stream
NUMFLUX. The three arrays are allocated with NTY elements. If the criteria "flotation
property" has not been defined in the phase model, the return value of the function is
negative and all particles are considered fast-floating. A message is then written in the
CONV.INF file.
The function GETFLOWPERSIZECOMP (NUMFLUX, NPHA, NCG, NTY, ARRAY)
needs a 2-dimensional (NCG * NTY) array of REAL*8. ARRAY(I,J) contains the
flowrate in kg/s in the stream NUMFLUX for the phase NPHA of component J in size
class I.
Notes
Other usable functions to get flowrates in kg/s:

GETFLOWRATEPERSIZE (NUMFLUX, NPHA, NCG, ARRAY)

GETFLOWRATEPERCOMP (NUMFLUX, NPHA, NTY, ARRAY)

Another usable function to get fractions per size class:

GETSIZEFRACTIONS (NUMFLUX, NPHA, NCG, FRACTIONS)

Another usable function to get volumetric flowrates in l/s:

GETVOLFLOWPERCOMP (NUMFLUX, NPHA, NCG, ARRAY)


First cell input initialization

USIM PAC

DO I = 1, NTY
DO J = 1, NCG
Division by the number of banks
ENTR (J, I) = ENTR (J, I) / DBLE (NOMB)

BRGM Software

INCORPORATION OF MODELS

43

FLOR (J, I, NPHASOL) = ENTR (J, I) * FASTFLO (I)


FLOL (J, I, NPHASOL) = ENTR (J, I) * SLOWFLO (I)
ALIM (I, NPHASOL) = ALIM (I, NPHASOL) + ENTR (J,
I)
DEBIFLO (I, 3, NPHASOL) = DEBIFLO (I, 3, NPHASOL)
+ FLOR (J, I,

&
NPHASOL)

DEBIFLO (I, 2, NPHASOL) = DEBIFLO (I, 2, NPHASOL)


+ FLOL (J, I,

&
NPHASOL)
&

END DO
DEBIFLO (I, 1, NPHASOL) = ALIM (I, NPHASOL)
- DEBIFLO (I, 2, NPHASOL) - DEBIFLO (I, 3, NPHASOL)
END DO
DEALLOCATE (ENTR)
DEALLOCATE (NOFLO)
DEALLOCATE (SLOWFLO)
DEALLOCATE (FASTFLO)
ENDIF
ENDIF
END DO

Calculation begins...
VOLFLO = (DSOLVOL + DLIQVOL) / DBLE (NOMB)
DSOL = DSOL / DBLE (NOMB)
DLIQ = DLIQ / DBLE (NOMB)
DLIQ2 = 0.D0
DSOL1 = DSOL
DLIQ1 = DLIQ
C Calculation for each cell of the bank of the mass flowrate of solids
and water in the froth
TS = 0.D0
DO CELL=1,NOCELL
IF (VOLFLO.GT.0.1D-06) THEN
IF (USEOPT.EQ.UP_MODEL_MESSAGE) THEN
ANSWER = '' C
CALL MESSMODELNEWLINE (ANSWER)
CALL MESSMODELINT (MODELNAME, 5, CELL, ANSWER)
CALL MESSTOCONV (ANSWER)
ENDIF
C
Cell residence time
TSC = CELVOL / VOLFLO
C
Cumulative residence time
TS = TS + TSC

&

DSOL2 = 0.D0
PVS = 0.D0
NPHASOL = 0
DO NPHA = 1, NBPHA ()
IF ((NTYPPHA (NPHA).EQ.TYPORE).OR.
(NTYPPHA (NPHA).EQ.TYPSOL)) THEN
NPHASOL = NPHASOL + 1
NCG = NBCLASSCRIT (NPHA, CRITSIZE)
IF (NCG.LE.0) NCG = 1
NTY = NBCLASSCRIT (NPHA, CRITCOMP)
IF (NTY.LE.0) NTY = 1
IF (USEOPT.EQ.UP_MODEL_MESSAGE) THEN
ANSWER = '' C
ANSWER1= '' C
ANSWER2= '' C
CALL MESSMODELNEWLINE (ANSWER)
NAME = '' C
OK = PHASENAME (NPHA, NAME)
CALL MESSMODELTEXT (MODELNAME, 6, NAME, ANSWER)
CALL MESSMODELNEWLINE (ANSWER1)
CALL MESSMODEL (MODELNAME, 7, ANSWER1)

USIM PAC

BRGM Software

44

INCORPORATION OF MODELS

CALL MESSMODELNEWLINE (ANSWER2)


CALL MESSMODEL (MODELNAME, 8, ANSWER2)
ENDIF

Calculation continues...
DO J = 1, NTY
SUMDEBIT = 0.D0
SUMENTRE = 0.D0
DO I = 1, NCG
TMP = 1.D0
NPHASOL) * TSC)
C

1.D0

(1.D0

KC

(I,

J,

Solids mass flowrate in the froth


DEBITR = FLOR (I, J, NPHASOL) * TMP
DEBITL = FLOL (I, J, NPHASOL) * TMP
DSOL2 = DSOL2 + DEBITR + DEBITL
SORR (I, J, NPHASOL) = SORR (I, J, NPHASOL) +

DEBITR
SORL (I, J, NPHASOL) = SORL (I, J, NPHASOL) +
DEBITL
PVS = PVS + (DEBITR + DEBITL) / DENS (J,
NPHASOL)
C
&
NPHASOL)

Recovery of component j
SUMDEBIT = SUMDEBIT + DEBITR + DEBITL
SUMENTRE = SUMENTRE + FLOR (I, J, NPHASOL)
+
FLOL
(I,

J,

REC (J, NPHASOL) = REC (J, NPHASOL) + DEBITR


+ DEBITL
C

Feed of next cell


DSOL1 = DSOL1 - (DEBITR + DEBITL)
FLOR (I, J, NPHASOL) = FLOR (I, J, NPHASOL) -

DEBITR
FLOL (I, J, NPHASOL) = FLOL (I, J, NPHASOL) DEBITL
END DO
IF (USEOPT.EQ.UP_MODEL_MESSAGE) THEN
NAME = '' C
OK = COMPONENTNAME (NPHA, J, NAME)
CALL
MESSMODELTEXT
(MODELNAME,

9,

NAME,

ANSWER)
SUMENTRE = SUMENTRE + DEBIFLO (J, 1, NPHASOL)
IF (SUMENTRE.GT.0.D0) THEN
TMP = SUMDEBIT / SUMENTRE
ELSE
TMP = 0.D0
ENDIF
CALL
MESSMODELREAL
(MODELNAME,
10,
TMP,
ANSWER1)
IF (ALIM (J, NPHASOL).GT.0.D0) THEN
TMP = REC (J, NPHASOL) / ALIM (J, NPHASOL)
ELSE
TMP = 0.D0
ENDIF
CALL
MESSMODELREAL
(MODELNAME,
10,
TMP,
ANSWER2)
ENDIF
END DO
IF (USEOPT.EQ.UP_MODEL_MESSAGE) THEN
CALL MESSTOCONV (ANSWER)
CALL MESSTOCONV (ANSWER1)
CALL MESSTOCONV (ANSWER2)
ENDIF
ENDIF
END DO
IF (USEOPT.EQ.UP_MODEL_MESSAGE) THEN
ANSWER = '' C
CALL MESSMODELNEWLINE(ANSWER)
TMP = (DSOL - DSOL1)/DSOL
CALL MESSMODELREAL (MODELNAME,11,TMP,ANSWER)

USIM PAC

BRGM Software

INCORPORATION OF MODELS

45

CALL MESSTOCONV(ANSWER)
CALL MESSMODELREAL (MODELNAME,14,TS,ANSWER)
CALL MESSTOCONV(ANSWER)
ENDIF

...
C

Partition of water
DLIQCONC = DSOL2 * LIQPC / (1.D0 - LIQPC)
IF (DLIQCONC.GE.DLIQ1) THEN
DLIQCONC = DLIQ1
IF (USEOPT.EQ.UP_MODEL_MESSAGE) THEN
ANSWER = '' C
CALL MESSMODELNEWLINE (ANSWER)
CALL MESSMODEL (MODELNAME, 13, ANSWER)
CALL MESSTOCONV (ANSWER)
ENDIF
ENDIF
VOLFLO = VOLFLO - PVS - DLIQCONC
IF (VOLFLO.LE.0.D0) VOLFLO = 0.1D-06
DLIQ2 = DLIQ2 + DLIQCONC
IF (DLIQ2.GT.DLIQ) THEN
DLIQ2 = DLIQ
ENDIF
DLIQ1 = DLIQ - DLIQ2
ENDIF
END DO

Send results per phase


C

&

Outputs of the model


NPHASOL = 0
DO NPHA = 1, NBPHA ()
IF ((NTYPPHA (NPHA).EQ.TYPORE).OR.
(NTYPPHA (NPHA).EQ.TYPSOL)) THEN
NPHASOL = NPHASOL + 1
NCG = NBCLASSCRIT (NPHA, CRITSIZE)
IF (NCG.LE.0) NCG = 1
NTY = NBCLASSCRIT (NPHA, CRITCOMP)
IF (NTY.LE.0) NTY = 1
ALLOCATE (SOR1 (NCG, NTY), SOR2 (NCG, NTY))
ALLOCATE (ENTR (NCG, NTY))
OK = GETFLOWPERSIZECOMP (0, NPHA, NCG, NTY, ENTR)
DO J = 1, NTY
DO I = 1, NCG
SOR2
(I,
J)
=
SORR
(I,J,NPHASOL)

SORL

SOR2 (I, J) = SOR2 (I, J) * DBLE (NOMB)


SOR1 (I, J) = ENTR (I, J) - SOR2 (I, J)
END DO
END DO
DEALLOCATE (ENTR)
OK = SEND2DTOSTREAMS (1, NPHA, TYPFLOW,
CRITSIZE,
CRITCOMP,

NCG,

NTY,

OK = SEND2DTOSTREAMS (2, NPHA, TYPFLOW,


CRITSIZE,
CRITCOMP,

NCG,

NTY,

(I,J,NPHASOL)

&
SOR1)
&
SOR2)
C
C

USIM PAC

Sub-population of floatability
OK = NUMHIERSYS (NPHA, NSCONFLOTFLOW)
IF (OK.GT.0) THEN
concentrate
ALLOCATE (NOFLO (NTY), SLOWFLO (NTY), FASTFLO (NTY))
ALLOCATE (INTER (NTY))
DO J = 1, NTY
TMP = 0.D0
TMPR = 0.D0
TMPL = 0.D0
DO I = 1, NCG

BRGM Software

46

INCORPORATION OF MODELS

TMP = TMP + SOR2 (I, J)


TMPR = TMPR + SORR (I, J, NPHASOL)
TMPL = TMPL + SORL (I, J, NPHASOL)
END DO
INTER (J) = TMP
TMP = TMPR + TMPL
IF (TMP.GT.0.D0) THEN
FASTFLO (J) = TMPR / TMP
SLOWFLO (J) = TMPL / TMP
ELSE
FASTFLO (J) = 0.D0
SLOWFLO (J) = 0.D0
ENDIF
NOFLO (J) = 0.D0
END DO
OK=SETFLOATPROP(2,NPHA,NTY,INTER,NOFLO,SLOWFLO,FASTFLO)
tailings
DO J = 1, NTY
TMP = 0.D0
TMPR = 0.D0
TMPL = 0.D0
DO I = 1, NCG
TMP = TMP + SOR1 (I, J)
TMPR = TMPR + SORR (I, J, NPHASOL)
TMPL = TMPL + SORL (I, J, NPHASOL)
END DO
INTER (J) = TMP
TMP = TMP / DBLE (NOMB)
IF (TMP.GT.0.D0) THEN
FASTFLO (J) = (DEBIFLO (J,3,NPHASOL) - TMPR) / TMP
SLOWFLO (J) = (DEBIFLO (J,2,NPHASOL) - TMPL) / TMP
NOFLO (J)
= DEBIFLO (J, 1, NPHASOL) / TMP
ELSE
FASTFLO (J) = 0.D0
SLOWFLO (J) = 0.D0
NOFLO (J)
= 0.D0
ENDIF
END DO
OK=SETFLOATPROP(1,NPHA,NTY,INTER,NOFLO,SLOWFLO,FASTFLO)
DEALLOCATE (NOFLO)
DEALLOCATE (SLOWFLO)
DEALLOCATE (FASTFLO)
DEALLOCATE (INTER)
ENDIF
DEALLOCATE (SOR1)
DEALLOCATE (SOR2)
ENDIF
END DO

The function SEND2DTOSTREAMS (NUMOUT, NPHA, DATATYPE, CRIT1, CRIT2,


NC1, NC2, ARRAY) needs a 2-dimensional (NC1 * NC2) array of REAL*8. ARRAY(I,J)
contains the flowrate in kg/s (as DATATYPE is TYPFLOW) in the output stream
NUMOUT for the phase NPHA of component J in size class I. CRIT1 and CRIT2 may
be any criteria defined in the phase model: CRITSIZE for size classes, CRITCOMP for
components, CRITFLOT for flotation sub-populations.
The function NUMHIERSYS (NPHA, HIERSYS) is used here to know if there is a
description of type HIERSYS = NSCONFLOTFLOW (partial flowrates of the subpopulations by components) in the phase NPHA. It is present if the return value is
positive.

USIM PAC

BRGM Software

INCORPORATION OF MODELS

47

The function SETFLOATPROP (NUMOUT, NPHA, NTY, FLOWRATE, NOFLO,


SLOWFLO, FASTFLO) must be used with the criteria "flotation property" that has to be
defined in the phase model. FLOWRATE is the partial flowrate array for components in
the output NUMOUT, and NOFLO, SLOWFLO, FASTFLO are arrays of REAL*8
containing the proportions of "flotation properties".
Note:
Other usable functions to send flowrates in kg/s:

SEND1DTOSTREAMS (NUMOUT, NPHA, DATATYPE, CRIT1, NC1, ARRAY)

SEND0DTOSTREAMS (NUMOUT, NPHA, DATATYPE, FLOWRATE)

SETPHA (NUMOUT, NPHA, FLOWRATE); this function is identical to


SEND0DTOSTREAMS.
Send results per stream
DEALLOCATE
DEALLOCATE
DEALLOCATE
DEALLOCATE
DEALLOCATE
DEALLOCATE
DEALLOCATE
DEALLOCATE
DEALLOCATE

(KC)
(FLOR)
(FLOL)
(SORR)
(SORL)
(DENS)
(REC)
(ALIM)
(DEBIFLO)

DLIQ1 = DLIQ1 *
OK = SETPHASLIQ
DLIQ2 = DLIQ2 *
OK = SETPHASLIQ

DBLE (NOMB)
(1, DLIQ1)
DBLE (NOMB)
(2, DLIQ2)

FLOG = 1
RETURN

The function SETPHASLIQ (NUMOUT, FLOWRATE) sets the FLOWRATE of all liquid
phases in the output NUMOUT, keeping the proportions of the feed.

B.4.6 - Power working mode: UP_POWER

The power consumption of a unit of equipment is calculated in this working mode and
displayed into the power consumption file POWER.INF (a text file).
Generally, the UP_POWER working mode is called after a UP_MODEL working mode.
Then, the power consumption is generally calculated with the values of the model
parameters (input or output parameters).
The sequence of actions is:

data receiving,

power computation,

text assembling,

USIM PAC

BRGM Software

48

INCORPORATION OF MODELS

text sending into the power file.

The data receiving is carried out as in the UP_MODEL working mode. The function
GETPARAM calls the model parameters.
The text that displays the power consumption is made as in the UP_MODEL working
mode by the use of the MESSMODEL, MESSMODELINT, MESSMODELREAL
functions. The text is built in a string buffer (ANSWER in our example) before being
sent in the power consumption file using the function MESSTOPOWER.
The example taken to illustrate the power calculation is the rod mill model: BAR1. In
this example, the power consumption text recalls the number of mills in parallel and
gives the calculated rod load and power consumption:
CASE (UP_POWER)
OK1 = GETPARAM (1, PARAM)
IPARALL = HFIX (PARAM)
OK1 = GETPARAM (12, TR)
OK1 = GETPARAM (11, PWT)
ANSWER = '' C
CALL MESSMODELNEWLINE (ANSWER)
CALL MESSMODELINT (MODELNAME, 8, IPARALL, ANSWER)
CALL MESSMODELNEWLINE (ANSWER)
CALL MESSMODELREAL (MODELNAME, 31, TR, ANSWER)
CALL MESSTOPOWER (ANSWER)
CALL MESSMODELREAL (MODELNAME, 12, PWT, ANSWER)
CALL MESSTOPOWER (ANSWER)
RETURN

B.4.7 - Cost working mode: UP_COST

The cost estimation of a unit of equipment is called by the capital cost calculation.
The UP_COST working mode has one variant: UP_COST_CALC.
Generally, the UP_COST working mode is called after a UP_MODEL working mode.
Then, the cost estimation is generally calculated with the values of the model
parameters (input or output parameters).
The sequence of actions is:

data receiving,

cost computation,

cost sending to the capital cost calculation.


CASE (UP_COST)
SELECT CASE (USEOPT)
CASE (UP_COST_CALC)
OK = GETPARAM (1, PARAM)
NOMB = IIDINT (PARAM)
OK = GETPARAM (2, PARAM)
NOCELL = IIDINT (PARAM)
OK = GETPARAM (3, CELVOL)

USIM PAC

BRGM Software

INCORPORATION OF MODELS

49

OK = GETPARAM (8, EVP)


OK = CICF (NOCELL, CELVOL, EVP, COUT)
IF (COUT.EQ.0.D0) THEN
CALL SETCOST (0, NOMB, COUT)
ELSE
CALL SETCOST (1, NOMB, COUT)
ENDIF
FLOG = 1
END SELECT
RETURN

The data receiving is carried out as in the UP_MODEL working mode. The function
GETPARAM retrieves the model parameters.
Some information required for the cost calculation may not be in the USIM PAC
standard set of data. This information is input by the user through a dialog box (see
part B). Three functions can be used:
GETINTFORCOST

calls an integer input interface to ask for an integer


parameter of the cost calculation.

GETREALFORCOSTcalls a real input interface to ask for a real parameter of


the cost calculation.
GETBOOLFORCOST
calls a Boolean input interface for the cost
calculation.
Macro functions as CICF allow cost calculation for some units.
The function SETCOST sends the number of units and the cost of a unit of equipment
to the capital cost calculation.
To take into account the cost calculation, the return value must be 1.

B.4.8 - Help working mode: UP_HELP

The UP_HELP working mode has one variant: UP_HELP_INFO. It is used to declare
the user-defined help file that contains help about your model and the model topic
number.
The function SETINFOHELP sets the help file name and the topic number.
It is recommended to use the same number for the model number and the topic
number.
CASE (UP_HELP)
SELECT CASE (USEOPT)
CASE (UP_HELP_INFO)
MODELHELPFILE = 'MODELS.HLP' C
CALL SETINFOHELP (MODELHELPFILE, NUMMOD_PHYSEP+7)
FLOG = 1
END SELECT
RETURN

USIM PAC

BRGM Software

50

INCORPORATION OF MODELS

The user-defined help file has the Windows help format. It can be built with the
Microsoft help tools. These tools are not delivered with USIM PAC Development Kit.

B.4.9 - Final version

The model function FLOG is defined by:


C**********************************************************************
C*
**
C**********************************************************************
C
INTEGER FUNCTION FLOG (USE, USEOPT)
INTEGER USE
INTEGER USEOPT
INCLUDE 'MODELS.FI'
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C

MODEL FOR THE SIMULATION OF BANKS OF FLOTATION CELLS


This model takes into account a first order kinetic phenomenon with
limitation of the recovery by type of particle (or component). The
kinetic constant is calculated for each size fraction i and
component j by King's formula:
k(i,j) = (alpha(j)/(xi**0.5))*(1-((xi/delta(j))**1.5))
*exp(-(a(j)/(2*xi))**2)
with:

alpha
delta
a
xi

=
=
=
=

adjustment constant
size of the easiest floating particle
size of the largest floating particle
size of class i (geometric mean of limits)

The basic flotation kinetic formula is:


FLOT(i,j) = ENTREE(i,j) * (1 - (1/(1+K(i,j)*ts))) * Rlim(j)
where:
- FLOT(i,j)
-

= flowrate of particles of size xi and component j in


the froth.
ENTREE(i,j)= flowrate of particles of size xi and component j in
the cell feed.
K(i,j)
= kinetic constant for component j in size class i
ts
= cell volume/feed volumetric flowrate (average
residence time).
Rlim(j)
= limit recovery for component j

The behaviour of water is represented by the percentage of water in


the froth.

C
C
C
C
C
C
C
C

USIM PAC

Parameters
REAL*8 PARAM, CELVOL, LIQPC
INTEGER NOMB, NOCELL
Variables
SOR1(,)
= tailings
REAL*8 SOR1 [ALLOCATABLE] (:,:)
SOR2(,)
= concentrate
REAL*8 SOR2 [ALLOCATABLE] (:,:)
VOLFLO
= volumetric flowrate in each cell
PVS
= solids volumetric flowrate in each cell
DENS(,)
= density
REAL*8 DENS [ALLOCATABLE] (:,:)
MAXDIM()
= size of the largest floating particle (m)
REAL*8 MAXDIM [ALLOCATABLE] (:)
FACEDIM()
= size of the easiest floating particle (m)
REAL*8 FACEDIM [ALLOCATABLE] (:)

BRGM Software

INCORPORATION OF MODELS

C
C
C
C
C
C

51

ALPHA()
= adjustment parameter
REAL*8 ALPHA [ALLOCATABLE] (:)
KC(,,)
= kinetic constant
REAL*8 KC [ALLOCATABLE] (:,:,:)
FLOR(,,)
= feed mass flowrate (fast floating)
REAL*8 FLOR [ALLOCATABLE] (:,:,:)
FLOL(,,)
= feed mass flowrate (slow floating)
REAL*8 FLOL [ALLOCATABLE] (:,:,:)
SORR(,,)
= mass flowrate in froth (fast floating)
REAL*8 SORR [ALLOCATABLE] (:,:,:)
SORL(,,)
= mass flowrate in froth (slow floating)
REAL*8 SORL [ALLOCATABLE] (:,:,:)
INTEGER I, J, OK, CELL
INTEGER NCG, NTY, NPHA
INTEGER NCGMAX, NTYMAX, NBPHASOL, NPHASOL
REAL*8 DSOL, DSOL1, DSOL2
REAL*8 DLIQ, DLIQ1, DLIQ2, PVS, DLIQCONC
REAL*8 DSOLVOL, DLIQVOL, VOLFLO
REAL*8 TMP, TMP1, TMP2, TMP3, TS, TSC, TMPR, TMPL
REAL*8 DEBIT, DEBITR, DEBITL
REAL*8 SUMDEBIT, SUMENTRE
REAL*8 ENTR [ALLOCATABLE] (:,:)
REAL*8 BSUP [ALLOCATABLE] (:)
REAL*8 INTER [ALLOCATABLE] (:)
REAL*8 REC [ALLOCATABLE] (:,:)
REAL*8 ALIM [ALLOCATABLE] (:,:)
REAL*8 NOFLO [ALLOCATABLE] (:)
REAL*8 SLOWFLO [ALLOCATABLE] (:)
REAL*8 FASTFLO [ALLOCATABLE] (:)
REAL*8 DEBIFLO [ALLOCATABLE] (:,:,:)
CHARACTER*254 ANSWER1
CHARACTER*254 ANSWER2
REAL*8 COUT, EVP
MODELNAME='FLOG' C
ANSWER = '' C
SELECT CASE (USE)
CASE (UP_PRESENT)
SELECT CASE (USEOPT)
CASE (UP_PRESENT_TEST)
FLOG = 1
CASE (UP_PRESENT_INFO)
CALL SETINFOMODEL (NUMMOD_PHYSEP+7, 2, 8)
FLOG = 1
END SELECT
RETURN

C
C
C
C
C
C

USIM PAC

CASE (UP_PARAM)
SELECT CASE (USEOPT)
CASE (UP_PARAM_DIALOGTYPE)
CALL SETPARAMDIALOGTYPE (TP_DUPLIPARAM)
List of parameters:
1 : Number of banks in parallel
2 : Number of cells in a bank
3 : Pulp volume in one cell (m3)
4 : % water in the concentrate
Flotation parameters group
ANSWER = '' C
CALL MESSMODEL (MODELNAME, 20, ANSWER)
CALL SETGROUP (1, ANSWER)
5 : Size of the largest floating particle (m) per component
CALL SETPARAMDUPLI1CRIT (5, TYPORE, CRITCOMP)
CALL SETPARAMDUPLI1CRIT (5, TYPSOL, CRITCOMP)
CALL SETGROUPPARAM (1, 5)
6 : Size of the easiest floating particle (m) per component
CALL SETPARAMDUPLI1CRIT (6, TYPORE, CRITCOMP)
CALL SETPARAMDUPLI1CRIT (6, TYPSOL, CRITCOMP)
CALL SETGROUPPARAM (1, 6)
7 : Adjustment parameter per component

BRGM Software

52

INCORPORATION OF MODELS

CALL SETPARAMDUPLI1CRIT (7, TYPORE, CRITCOMP)


CALL SETPARAMDUPLI1CRIT (7, TYPSOL, CRITCOMP)
CALL SETGROUPPARAM (1, 7)
8 : Effective volume percentage
FLOG = 1
END SELECT
RETURN
CASE (UP_MODEL)
IF (USEOPT.EQ.UP_MODEL_MESSAGE) THEN
ANSWER = '' C
CALL MESSMODELNEWLINE(ANSWER)
CALL MESSMODELNEWLINE(ANSWER)
CALL MESSMODEL (MODELNAME,1,ANSWER)
CALL MESSMODELNEWLINE(ANSWER)
CALL MESSTOCONV(ANSWER)
ENDIF

C
C
C
C

1 : Number of banks in parallel


OK = GETPARAM (1, PARAM)
NOMB = IIDINT (PARAM)
2 : Number of cells in a bank
OK = GETPARAM (2, PARAM)
NOCELL = IIDINT (PARAM)
3 : Pulp volume in one cell (m3 then l)
OK = GETPARAM (3, CELVOL)
CELVOL = CELVOL * 1000.D0
4 : % water in the concentrate
OK = GETPARAM (4, LIQPC)
LIQPC = LIQPC / 100.D0
IF (LIQPC.GT.0.99D0) LIQPC = 0.99D0
IF (LIQPC.LT.0.D0) LIQPC = 0.D0
ANSWER = '' C
IF (NOMB.LE.0) THEN
CALL MESSMODEL (MODELNAME, 2, ANSWER)
CALL MESSTOSCREEN (ANSWER)
FLOG = 0
RETURN
ENDIF
IF (NOCELL.LE.0) THEN
CALL MESSMODEL (MODELNAME, 3, ANSWER)
CALL MESSTOSCREEN (ANSWER)
FLOG = 0
RETURN
ENDIF
IF(CELVOL.LE.0.D0) THEN
CALL MESSMODEL (MODELNAME, 4, ANSWER)
CALL MESSTOSCREEN (ANSWER)
FLOG = 0
RETURN
ENDIF
OK = GETORESOLFLOWRATE (0, DSOL)
OK = GETORESOLVOLFLOW (0, DSOLVOL)
OK = GETLIQFLOWRATE (0, DLIQ)
OK = GETLIQVOLFLOW (0, DLIQVOL)
IF ((DSOL.LE.0.D0).OR.(DSOLVOL.LE.0.D0)) THEN
FLOG = 1
RETURN
ENDIF
NCGMAX = 0
NTYMAX = 0
NBPHASOL = 0
DO NPHA = 1, NBPHA ()
IF (NTYPPHA (NPHA).EQ.TYPGAZ) THEN
OK = COPYPHA (2, NPHA)
OK = ZEROPHA (1, NPHA)
ELSEIF ((NTYPPHA (NPHA).EQ.TYPORE).OR.

USIM PAC

BRGM Software

INCORPORATION OF MODELS

&

(NTYPPHA (NPHA).EQ.TYPSOL)) THEN


NCG = NBCLASSCRIT (NPHA, CRITSIZE)
IF (NCG.LE.0) NCG = 1
IF (NCG.GT.NCGMAX) NCGMAX = NCG
NTY = NBCLASSCRIT (NPHA, CRITCOMP)
IF (NTY.LE.0) NTY = 1
IF (NTY.GT.NTYMAX) NTYMAX = NTY
NBPHASOL = NBPHASOL + 1
ENDIF
END DO
IF (NBPHASOL.LE.0) THEN
FLOG = 1
RETURN
ENDIF
ALLOCATE
ALLOCATE
ALLOCATE
ALLOCATE
ALLOCATE
ALLOCATE
ALLOCATE
ALLOCATE

&

53

(KC (NCGMAX, NTYMAX, NBPHASOL))


(FLOR (NCGMAX, NTYMAX, NBPHASOL))
(FLOL (NCGMAX, NTYMAX, NBPHASOL))
(SORR (NCGMAX, NTYMAX, NBPHASOL))
(SORL (NCGMAX, NTYMAX, NBPHASOL))
(DENS (NTYMAX, NBPHASOL))
(REC (NTYMAX, NBPHASOL), ALIM (NTYMAX, NBPHASOL))
(DEBIFLO (NTYMAX, 3, NBPHASOL))

Feed of the first cell


NPHASOL = 0
DO NPHA = 1, NBPHA ()
IF ((NTYPPHA (NPHA).EQ.TYPORE).OR.
(NTYPPHA (NPHA).EQ.TYPSOL)) THEN
NPHASOL = NPHASOL + 1
NCG = NBCLASSCRIT (NPHA, CRITSIZE)
IF (NCG.LE.0) NCG = 1
NTY = NBCLASSCRIT (NPHA, CRITCOMP)
IF (NTY.LE.0) NTY = 1
ALLOCATE (MAXDIM (NTY))
OK = GETPARAMDUPLI1CRIT (NPHA, 5, MAXDIM)
ALLOCATE (FACEDIM (NTY))
OK = GETPARAMDUPLI1CRIT (NPHA, 6, FACEDIM)
ALLOCATE (ALPHA (NTY))
OK = GETPARAMDUPLI1CRIT (NPHA, 7, ALPHA)
ALLOCATE (BSUP (NCG))
OK = BCLASSGRA (NPHA, BSUP)
DO I = 1, NCG
BSUP (I) = BSUP (I) * 1.D06
END DO
DO I = 1, NCG - 1
BSUP (I) = DSQRT (BSUP (I) * BSUP (I+1))
END DO
IF (BSUP (NCG).LT.1.D0) THEN
BSUP (NCG) = BSUP (NCG) / 2.D0
ELSE
BSUP (NCG) = DSQRT (BSUP (NCG))
ENDIF

&

USIM PAC

Kinetic constant in s-1


DO J = 1, NTY
DO I = 1, NCG
IF (BSUP (I).GT.MAXDIM (J)) THEN
KC (I, J, NPHASOL) = 0.D0
ELSEIF ((BSUP (I).LT.1.D-10).OR.
(MAXDIM (J).LT.1.D-10)) THEN
KC (I, J, NPHASOL) = 0.D0
ELSE
TMP1 = ALPHA (J) / DSQRT (BSUP (I))
TMP2 = 1.D0 - ((BSUP (I) / MAXDIM (J)) ** 1.5D0)
TMP3 = FACEDIM (J) / 2.D0 / BSUP (I)
TMP3 = - TMP3 * TMP3
IF (TMP3.LT.-600.D0) TMP3 = -600.D0
TMP3 = DEXP (TMP3)

BRGM Software

54

INCORPORATION OF MODELS

KC (I, J, NPHASOL) = TMP1 * TMP2 * TMP3 / 3600.D0


ENDIF
ENDDO
ENDDO
DEALLOCATE
DEALLOCATE
DEALLOCATE
DEALLOCATE

(BSUP)
(MAXDIM)
(FACEDIM)
(ALPHA)

ALLOCATE (INTER (NTY))


OK = GETCOMPDENSITY (NPHA, NTY, INTER)
DO I = 1, NTY
DENS (I, NPHASOL) = INTER (I)
END DO
DEALLOCATE (INTER)
DO I = 1, NTY
ALIM (I, NPHASOL) = 0.D0
REC (I, NPHASOL) = 0.D0
1 = no floating, 2 = slow, 3 = fast
DEBIFLO (I, 1, NPHASOL) = 0.D0
DEBIFLO (I, 2, NPHASOL) = 0.D0
DEBIFLO (I, 3, NPHASOL) = 0.D0
DO J = 1, NCG
FLOR (J, I, NPHASOL) = 0.D0
FLOL (J, I, NPHASOL) = 0.D0
SORR (J, I, NPHASOL) = 0.D0
SORL (J, I, NPHASOL) = 0.D0
END DO
END DO

OK = GETFLOWRATE (0, NPHA, DEBIT)


IF (DEBIT.GT.0.D0) THEN
ALLOCATE (NOFLO (NTY), SLOWFLO (NTY), FASTFLO (NTY))
OK = GETFLOATPROP (0, NPHA, NTY, NOFLO,SLOWFLO,FASTFLO)
IF (OK.LT.0) THEN
DO I = 1, NTY
NOFLO (I) = 0.D0
SLOWFLO (I) = 0.D0
FASTFLO (I) = 1.D0
END DO
IF (USEOPT.EQ.UP_MODEL_MESSAGE) THEN
ANSWER = '' C
CALL MESSMODEL (MODELNAME, 12, ANSWER)
CALL MESSTOCONV (ANSWER)
ENDIF
ENDIF
ALLOCATE (ENTR (NCG, NTY))
OK = GETFLOWPERSIZECOMP (0, NPHA, NCG, NTY, ENTR)
DO I = 1, NTY
DO J = 1, NCG
Division by the number of banks
ENTR (J, I) = ENTR (J, I) / DBLE (NOMB)
FLOR (J, I, NPHASOL) = ENTR (J, I) * FASTFLO (I)
FLOL (J, I, NPHASOL) = ENTR (J, I) * SLOWFLO (I)
ALIM (I, NPHASOL) = ALIM (I, NPHASOL) + ENTR (J,

I)
&
NPHASOL)
&
NPHASOL)
&

USIM PAC

DEBIFLO (I, 3, NPHASOL) = DEBIFLO (I, 3, NPHASOL)


+ FLOR (J, I,
DEBIFLO (I, 2, NPHASOL) = DEBIFLO (I, 2, NPHASOL)
+ FLOL (J, I,
END DO
DEBIFLO (I, 1, NPHASOL) = ALIM (I, NPHASOL)
- DEBIFLO (I, 2, NPHASOL) - DEBIFLO (I, 3, NPHASOL)
END DO
DEALLOCATE (ENTR)
DEALLOCATE (NOFLO)
DEALLOCATE (SLOWFLO)

BRGM Software

INCORPORATION OF MODELS

55

DEALLOCATE (FASTFLO)
ENDIF
ENDIF
END DO
VOLFLO = (DSOLVOL + DLIQVOL) / DBLE (NOMB)
DSOL = DSOL / DBLE (NOMB)
DLIQ = DLIQ / DBLE (NOMB)
DLIQ2 = 0.D0
DSOL1 = DSOL
DLIQ1 = DLIQ
C Calculation for each cell of the bank of the mass flowrate of solids
C and water in the froth
TS = 0.D0
DO CELL=1,NOCELL
IF (VOLFLO.GT.0.1D-06) THEN
IF (USEOPT.EQ.UP_MODEL_MESSAGE) THEN
ANSWER = '' C
CALL MESSMODELNEWLINE (ANSWER)
CALL MESSMODELINT (MODELNAME, 5, CELL, ANSWER)
CALL MESSTOCONV (ANSWER)
ENDIF
C
Cell residence time
TSC = CELVOL / VOLFLO
C
Cumulative residence time
TS = TS + TSC

&

DSOL2 = 0.D0
PVS = 0.D0
NPHASOL = 0
DO NPHA = 1, NBPHA ()
IF ((NTYPPHA (NPHA).EQ.TYPORE).OR.
(NTYPPHA (NPHA).EQ.TYPSOL)) THEN
NPHASOL = NPHASOL + 1
NCG = NBCLASSCRIT (NPHA, CRITSIZE)
IF (NCG.LE.0) NCG = 1
NTY = NBCLASSCRIT (NPHA, CRITCOMP)
IF (NTY.LE.0) NTY = 1
IF (USEOPT.EQ.UP_MODEL_MESSAGE) THEN
ANSWER = '' C
ANSWER1= '' C
ANSWER2= '' C
CALL MESSMODELNEWLINE (ANSWER)
NAME = '' C
OK = PHASENAME (NPHA, NAME)
CALL MESSMODELTEXT (MODELNAME, 6, NAME, ANSWER)
CALL MESSMODELNEWLINE (ANSWER1)
CALL MESSMODEL (MODELNAME, 7, ANSWER1)
CALL MESSMODELNEWLINE (ANSWER2)
CALL MESSMODEL (MODELNAME, 8, ANSWER2)
ENDIF
DO J = 1, NTY
SUMDEBIT = 0.D0
SUMENTRE = 0.D0
DO I = 1, NCG
TMP
=
1.D0

KC(I,J,NPHASOL)*TSC)
C

1.D0

(1.D0

Solids mass flowrate in the froth


DEBITR = FLOR (I, J, NPHASOL) * TMP
DEBITL = FLOL (I, J, NPHASOL) * TMP
DSOL2 = DSOL2 + DEBITR + DEBITL
SORR (I,J,NPHASOL) = SORR (I,J,NPHASOL)

SORL

DEBITR
(I,J,NPHASOL)

SORL

(I,J,NPHASOL)

DEBITL
PVS = PVS + (DEBITR + DEBITL) / DENS (J,
NPHASOL)
C

USIM PAC

Recovery of component j

BRGM Software

56

INCORPORATION OF MODELS

SUMDEBIT = SUMDEBIT + DEBITR + DEBITL


SUMENTRE = SUMENTRE + FLOR (I, J, NPHASOL)
+
FLOL
(I,

&
NPHASOL)

REC
DEBITR+DEBITL
C

(J,NPHASOL)

REC

(J,NPHASOL)

J,
+

Feed of next cell


DSOL1 = DSOL1 - (DEBITR + DEBITL)
FLOR (I,J,NPHASOL) = FLOR (I,J,NPHASOL)

FLOL

DEBITR
(I,J,NPHASOL)

FLOL

(I,J,NPHASOL)

DEBITL
END DO
IF (USEOPT.EQ.UP_MODEL_MESSAGE) THEN
NAME = '' C
OK = COMPONENTNAME (NPHA, J, NAME)
CALL
MESSMODELTEXT
(MODELNAME,

9,

NAME,

ANSWER)
SUMENTRE = SUMENTRE + DEBIFLO (J, 1, NPHASOL)
IF (SUMENTRE.GT.0.D0) THEN
TMP = SUMDEBIT / SUMENTRE
ELSE
TMP = 0.D0
ENDIF
CALL
MESSMODELREAL
(MODELNAME,
10,
TMP,
ANSWER1)
IF (ALIM (J, NPHASOL).GT.0.D0) THEN
TMP = REC (J, NPHASOL) / ALIM (J, NPHASOL)
ELSE
TMP = 0.D0
ENDIF
CALL
MESSMODELREAL
(MODELNAME,
10,
TMP,
ANSWER2)

USIM PAC

ENDIF
END DO
IF (USEOPT.EQ.UP_MODEL_MESSAGE) THEN
CALL MESSTOCONV (ANSWER)
CALL MESSTOCONV (ANSWER1)
CALL MESSTOCONV (ANSWER2)
ENDIF
ENDIF
END DO
IF (USEOPT.EQ.UP_MODEL_MESSAGE) THEN
ANSWER = '' C
CALL MESSMODELNEWLINE(ANSWER)
TMP = (DSOL - DSOL1)/DSOL
CALL MESSMODELREAL (MODELNAME,11,TMP,ANSWER)
CALL MESSTOCONV(ANSWER)
CALL MESSMODELREAL (MODELNAME,14,TS,ANSWER)
CALL MESSTOCONV(ANSWER)
ENDIF
Partition of water
DLIQCONC = DSOL2 * LIQPC / (1.D0 - LIQPC)
IF (DLIQCONC.GE.DLIQ1) THEN
DLIQCONC = DLIQ1
IF (USEOPT.EQ.UP_MODEL_MESSAGE) THEN
ANSWER = '' C
CALL MESSMODELNEWLINE (ANSWER)
CALL MESSMODEL (MODELNAME, 13, ANSWER)
CALL MESSTOCONV (ANSWER)
ENDIF
ENDIF
VOLFLO = VOLFLO - PVS - DLIQCONC
IF (VOLFLO.LE.0.D0) VOLFLO = 0.1D-06
DLIQ2 = DLIQ2 + DLIQCONC
IF (DLIQ2.GT.DLIQ) THEN
DLIQ2 = DLIQ
ENDIF
DLIQ1 = DLIQ - DLIQ2
ENDIF
END DO

BRGM Software

INCORPORATION OF MODELS

&

57

Outputs of the model


NPHASOL = 0
DO NPHA = 1, NBPHA ()
IF ((NTYPPHA (NPHA).EQ.TYPORE).OR.
(NTYPPHA (NPHA).EQ.TYPSOL)) THEN
NPHASOL = NPHASOL + 1
NCG = NBCLASSCRIT (NPHA, CRITSIZE)
IF (NCG.LE.0) NCG = 1
NTY = NBCLASSCRIT (NPHA, CRITCOMP)
IF (NTY.LE.0) NTY = 1
ALLOCATE (SOR1 (NCG, NTY), SOR2 (NCG, NTY))
ALLOCATE (ENTR (NCG, NTY))
OK = GETFLOWPERSIZECOMP (0, NPHA, NCG, NTY, ENTR)
DO J = 1, NTY
DO I = 1, NCG
SOR2
(I,
J)
=
SORR
(I,J,NPHASOL)

SORL

SOR2 (I, J) = SOR2 (I, J) * DBLE (NOMB)


SOR1 (I, J) = ENTR (I, J) - SOR2 (I, J)
END DO
END DO
DEALLOCATE (ENTR)
OK = SEND2DTOSTREAMS (1, NPHA, TYPFLOW,
CRITSIZE,
CRITCOMP,

NCG,

NTY,

OK = SEND2DTOSTREAMS (2, NPHA, TYPFLOW,


CRITSIZE,
CRITCOMP,

NCG,

NTY,

(I,J,NPHASOL)

&
SOR1)
&
SOR2)
C
C

USIM PAC

Sub-population of floatability
OK = NUMHIERSYS (NPHA, NSCONFLOTFLOW)
IF (OK.GT.0) THEN
concentrate
ALLOCATE (NOFLO (NTY), SLOWFLO (NTY), FASTFLO (NTY))
ALLOCATE (INTER (NTY))
DO J = 1, NTY
TMP = 0.D0
TMPR = 0.D0
TMPL = 0.D0
DO I = 1, NCG
TMP = TMP + SOR2 (I, J)
TMPR = TMPR + SORR (I, J, NPHASOL)
TMPL = TMPL + SORL (I, J, NPHASOL)
END DO
INTER (J) = TMP
TMP = TMPR + TMPL
IF (TMP.GT.0.D0) THEN
FASTFLO (J) = TMPR / TMP
SLOWFLO (J) = TMPL / TMP
ELSE
FASTFLO (J) = 0.D0
SLOWFLO (J) = 0.D0
ENDIF
NOFLO (J) = 0.D0
END DO
OK=SETFLOATPROP(2,NPHA,NTY,INTER,NOFLO,SLOWFLO,FASTFLO)
tailings
DO J = 1, NTY
TMP = 0.D0
TMPR = 0.D0
TMPL = 0.D0
DO I = 1, NCG
TMP = TMP + SOR1 (I, J)
TMPR = TMPR + SORR (I, J, NPHASOL)
TMPL = TMPL + SORL (I, J, NPHASOL)
END DO
INTER (J) = TMP
TMP = TMP / DBLE (NOMB)
IF (TMP.GT.0.D0) THEN
FASTFLO (J) = (DEBIFLO (J,3,NPHASOL) - TMPR) / TMP

BRGM Software

58

INCORPORATION OF MODELS

SLOWFLO (J) = (DEBIFLO (J,2,NPHASOL) - TMPL) / TMP


NOFLO (J)
= DEBIFLO (J, 1, NPHASOL) / TMP
ELSE
FASTFLO (J) = 0.D0
SLOWFLO (J) = 0.D0
NOFLO (J)
= 0.D0
ENDIF
END DO
OK=SETFLOATPROP(1,NPHA,NTY,INTER,NOFLO,SLOWFLO,FASTFLO)
DEALLOCATE (NOFLO)
DEALLOCATE (SLOWFLO)
DEALLOCATE (FASTFLO)
DEALLOCATE (INTER)
ENDIF
DEALLOCATE (SOR1)
DEALLOCATE (SOR2)
ENDIF
END DO
DEALLOCATE
DEALLOCATE
DEALLOCATE
DEALLOCATE
DEALLOCATE
DEALLOCATE
DEALLOCATE
DEALLOCATE
DEALLOCATE

(KC)
(FLOR)
(FLOL)
(SORR)
(SORL)
(DENS)
(REC)
(ALIM)
(DEBIFLO)

DLIQ1 = DLIQ1 *
OK = SETPHASLIQ
DLIQ2 = DLIQ2 *
OK = SETPHASLIQ

DBLE (NOMB)
(1, DLIQ1)
DBLE (NOMB)
(2, DLIQ2)

FLOG = 1
RETURN
CASE (UP_COST)
SELECT CASE (USEOPT)
CASE (UP_COST_CALC)
OK = GETPARAM (1, PARAM)
NOMB = IIDINT (PARAM)
OK = GETPARAM (2, PARAM)
NOCELL = IIDINT (PARAM)
OK = GETPARAM (3, CELVOL)
OK = GETPARAM (8, EVP)
OK = CICF (NOCELL, CELVOL, EVP, COUT)
IF (COUT.EQ.0.D0) THEN
CALL SETCOST (0, NOMB, COUT)
ELSE
CALL SETCOST (1, NOMB, COUT)
ENDIF
FLOG = 1
END SELECT
RETURN
CASE (UP_HELP)
SELECT CASE (USEOPT)
CASE (UP_HELP_INFO)
MODELHELPFILE = 'MODELS.HLP' C
CALL SETINFOHELP (MODELHELPFILE, NUMMOD_PHYSEP+7)
FLOG = 1
END SELECT
RETURN
CASE DEFAULT
FLOG = 0
RETURN

USIM PAC

BRGM Software

INCORPORATION OF MODELS

59

END SELECT
END

The function call is made by the MODELUSER function:


CASE (NUMMOD_USER + 1)
MODELUSER = FLOG (USE, USEOPT)
RETURN

B.5 - CODE TRANSLATION FROM VERSION 2.1 TO VERSION 3.0


To translate a .FOR file for models developed with the USIM PAC Development Kit
version 2.1 into the version 3.0:
Remove the line
$INCLUDE: 'FNMODEL.DCL'.

Replace all
INTEGER*2

by
INTEGER.

Remove all
[FAR].

or
FAR,.

Replace all lines


$INCLUDE: 'MODELS.DCL'

by
INCLUDE 'MODELS.FI'

Compile with option warning if undeclared variable.


Declare all undeclared variables.

USIM PAC

BRGM Software

60

FUNCTION LIST

C - FUNCTION LIST

USIM PAC

BRGM Software

FUNCTION LIST

USIM PAC

61

BRGM Software

62

FUNCTION LIST

C.1. - INTRODUCTION
This part of the manual is used to facilitate the icon or model function research. It can
be used in association with the following part that gives the detailed description of all
functions in alphabetical order.
The functions are divided into the icon functions and the model functions. For each set,
functions are displayed by use or by type.
A special section is devoted to the "symbolic constants" which are used to increase the
code understanding.
The variables, which are used in every icon and every model, are described in the last
sections.

C.2. - FUNCTIONS FOR ICON BUILDING


Functions used into an icon function can be divided into the declaration functions,
which give information about an icon, and the drawing functions, which are used to
draw the icon.

C.2.1. - Declaration functions

This set of functions is used in the working mode UP_PARAM. These functions are:
NBSORTIE

declares the number of output locations and recall the icon


number.

SORTIE

declares the output type and the center of an output location.

SETNAME

defines the default name of the icon.

SETTYPE

defines the icon type, the number of the generic icon of its
family.

ZONERECT

defines the coordinates of the icon influence area.

C.2.2. - Drawing functions

This is a set of elementary drawing functions:


PHAUTE

moves the pen to another point.

TRACE

draws a line from the current point to another point.

RECTAN

draws a rectangle with a length, a height and an upper left


corner.

CERCLE

draws a circle with a center and a circle radius.

ARC

draws a circle arc with a center, a radius and the starting and
ending angles.

USIM PAC

BRGM Software

FUNCTION LIST

63

ARCINF

draws a lower circle arc with a center, a radius and the


percentage of a complete circle (50 for a half circle, 25 for a
quarter).

ARCSUP

draws an upper circle arc with a center, a radius and the


percentage of a complete circle (50 for a half circle, 25 for a
quarter).

C.3. - FUNCTIONS FOR MODEL BUILDING


Functions used into a model function are classified according to their working mode
calls:
UP_PRESENT,
UP_PARAM,
UP_COMP,
UP_MODEL,
UP_POWER,
UP_COST,
UP_HELP,
or according to their behavior:

declaration,

data receiving,

data sending,

test,

treatment.

The declaration functions are essentially used in the UP_PRESENT, UP_PARAM and
UP_HELP working modes. The other functions are used in the UP_COMP,
UP_MODEL, UP_POWER and UP_COST working modes.
The data receiving and sending functions can be sub-classified into model parameter
functions, phase functions, stream functions, message functions and macro functions
(functions using a large set of elementary functions).

C.3.1. - UP_PRESENT functions

SETINFOMODEL recalls the model number and sets the number of outputs
and the number of parameters (a multiple parameter is
counted as one).
SETINFMODHIER asserts that a material description criterion is not kept for a
type of phase and a type of hierarchy.
SETCOMMINUTION asserts that the size distribution of the phases of type ore
and solid are not kept.

USIM PAC

BRGM Software

64

FUNCTION LIST

C.3.2. - UP_PARAM functions

SETPARAMDIALOGTYPE
interface.

sets the dialog box type of parameter input

SETPARAMDUPLIPHASE
sets that a parameter is duplicated along the
phases of a particular type.
SETPARAMDUPLI1CRIT sets that a parameter is duplicated along a
particular criterion of phases of a particular type.
SETPARAMDUPLI2CRIT sets that a parameter is duplicated along two
particular criteria of phases of a particular type.
SETPARAMDUPLI2PHA sets that a parameter is duplicated along two
particular criteria of two phases of two particular types.
SETPARAMDUPLIPARAM sets that a parameter is duplicated along another
parameter. Defines also a parameter as a chemical reaction
number.
SETPARAMDUPLIPARAMPHASE sets that a parameter is duplicated along
another parameter and the phases of a particular type.
SETPARAMDUPLIPARAM1CRIT sets that a parameter is duplicated along
another parameter and a particular criterion of phases of a
particular type.
SETPARAMSTRING sets that a parameter is a character string.
SETPARAMFILENAME sets that a parameter is a character string containing a
file name.
SETPARAMDATABASENAME sets that a parameter is a character string
containing the file name of a database of a particular type
with another parameter referring to the entry.
SETGROUP

defines a group of parameters for the model parameter


interface.

SETGROUPPARAM adds a parameter into a group of parameters.

C.3.3. - UP_COMP functions

TESTPHASMOD tests the phase model coherence with an industrial domain.


TESTPHAORE

tests the presence of at least one ore phase.

TESTSIZEFLOW tests the presence of a size distribution in an ore phase.


TESTSIZECOMPFLOW tests the presence of a component grade per size
class in an ore phase.
NBPHA

gives the number of phases in the phase model.

NTYPPHA

gives the type of a phase.

NBPHATYP

gives the number of phases with a particular type.

NUMPHATYPE

gives the phase number of a phase with a particular type.

USIM PAC

BRGM Software

FUNCTION LIST

65

NBCRIT

gives the number of criteria in a phase.

NUMCRITYP

gives the number of a criterion with a particular type in a


phase.

NBCLASSCRIT

gives the number of classes of a criterion with a particular


type in a phase.

NBHIER

gives the number of hierarchies in a phase.

NUMHIERSYS

gives the number of a hierarchy with a particular system


number in a phase.

NUMSHAREDHIERSYS gives the number of a shared hierarchy with a


particular system number in a phase.
TESTHIERTYP

tests that the hierarchy of a phase has a particular type.

C.3.4. - UP_MODEL functions


Model parameter functions

GETPARAM

receives the value of a simple model parameter.

GETUNITPARAM receives the value of a simple model parameter from another


unit operation.
GETPARAMDUPLIPHASE receives the value of a multiple model parameter
duplicated along the phases for a particular phase.
GETUNITPARAMDUPLIPHASE receives the value of a multiple model
parameter duplicated along the phases for a particular phase
from another unit operation.
GETPARAMDUPLI1CRIT receives the array of values of a multiple model
parameter duplicated along one criterion for a particular
phase.
GETUNITPARAMDUPLI1CRIT receives the array of values of a multiple
model parameter duplicated along one criterion for a
particular phase from another unit operation.
GETPARAMDUPLI2CRIT receives the array of values of a multiple model
parameter duplicated along two criteria for a particular
phase.
GETUNITPARAMDUPLI2CRIT receives the array of values of a multiple
model parameter duplicated along two criteria for a particular
phase from another unit operation.
GETPARAMDUPLI2PHA receives the array of values of a multiple model
parameter duplicated along two criteria for two particular
phases.
GETUNITPARAMDUPLI2PHA receives the array of values of a multiple
model parameter duplicated along two criteria for two
particular phases from another unit operation.
GETPARAMDUPLIPARAM receives the array of values of a multiple model
parameter duplicated along another parameter.

USIM PAC

BRGM Software

66

FUNCTION LIST

GETUNITPARAMDUPLIPARAM receives the array of values of a multiple


model parameter duplicated along another parameter from
another unit operation.
GETPARAMDUPLIPARAMPHASE receives the array of values of a multiple
model parameter duplicated along another parameter and
the phases for a particular phase.
GETUNITPARAMDUPLIPARAMPHASE receives the array of values of a
multiple model parameter duplicated along another
parameter and the phases for a particular phase from
another unit operation.
GETPARAMDUPLIPARAM1CRIT receives the array of values of a multiple
model parameter duplicated along another parameter and
one criterion for a particular phase.
GETUNITPARAMDUPLIPARAM1CRIT receives the array of values of a
multiple model parameter duplicated along another
parameter and one criterion for a particular phase from
another unit operation.
GETPARAMSTRING receives the character string value of a string model
parameter.
GETUNITPARAMSTRING receives the character string value of a string model
parameter from another unit operation.
GETPARAMREAC receives the parameters used to calculate the mass
transfer during chemical reactions.
SENDTOPARAM sends the value of a simple output model parameter to the
parameter set.
SENDTOPARAMDUPLIPARAM sends the array of values of a multiple output
model parameter duplicated along another parameter to the
parameter set.
SENDTOPARAMNEXTAPP sends the value of a simple model parameter to
the parameter set of the next unit operation in the flowsheet
order.
GETNAMECRUSH receives the name of a particular crusher from the crusher
database.
GETNBCRUSH

receives the number of exit settings and the number of feed


size classes for a particular crusher from the crusher
database.

GETDATACRUSHreceives the data set of a particular crusher from the


database.
Phase functions

NBPHA

gives the number of phases in the phase model.

NTYPPHA

gives the type of a phase.

NBPHATYPE

gives the number of phases with a particular type.

NUMPHATYPE

gives the phase number of a phase with a particular type.

NBCRIT

gives the number of criteria in a phase.

USIM PAC

BRGM Software

FUNCTION LIST

67

NUMCRITYP

gives the number of a criterion with a particular type in a


phase.

NBCLASSCRIT

gives the number of classes of a criterion with a particular


type in a phase.

BCLASSGRA

receives the size class array of a phase.

NBHIER

gives the number of hierarchies in a phase.

NUMHIERSYS

gives the number of a hierarchy with a particular system


number in a phase.

NUMSHAREDHIERSYS gives the number of a shared hierarchy with a


particular system number in a phase.
TESTHIERTYP

tests that the hierarchy of a phase has a particular type.

NUMHIER0D

gives the hierarchy number of the 0-dimensional hierarchy of


a particular type in a phase.

NBHIER1D

gives the number of 1-dimensional hierarchies of a particular


type in a phase. The 1-dimensional hierarchy is along a
particular criterion.

NUMHIER1D

gives the hierarchy number of a particular 1-dimensional


hierarchy among hierarchies enumerated by the NBHIER1D
function.

NBHIER2D

gives the number of 2-dimensional hierarchies of a particular


type in a phase. The 2-dimensional hierarchy is along two
particular criteria.

NUMHIER2D

gives the hierarchy number of a particular 2-dimensional


hierarchy among hierarchies enumerated by the NBHIER2D
function.

PHASENAME

receives the name of a phase.

CLASSNAME

receives the name of a criterion class in a phase.

COMPONENTNAME receives the name of a component in a phase.


SIZECLASSNAME

receives the name of a size class in a phase.

FLOATINGNAME receives the name of a floatability sub-population in a phase.


GETPHASEDENSITY

receives the density of a phase.

GETCOMPDENSITY receives the array of component densities in a phase.


GETMOLECULARMASS receives the array of component molecular masses
in a phase.
GETPHASELHV receives the low heating value of a phase.
GETCOMPLHV

receives the array of component low heating value in a


phase.

GETSTOECHIOMOL receives the arrays of consumption and production in


component moles for a particular chemical reaction.
GETSTOECHIOMAS receives the arrays of consumption and production in
component masses for a particular chemical reaction.
TESTPHAORE

USIM PAC

tests the presence of at least one ore phase.

BRGM Software

68

FUNCTION LIST

TESTSIZEFLOW tests the presence of a size distribution in an ore phase.


TESTSIZECOMPFLOW tests the presence of a component grade per size
class in an ore phase.
Stream functions

GETNBFLUXIN

gives the number of input streams of the unit of equipment.

GETNUMFLUXIN gives the stream number in the flowsheet that is an input


stream of the unit of equipment.
GETNUMFLUX

gives the stream number in the flowsheet that is an output


stream of the unit of equipment.

GET0DHIER

receives the value of a 0-dimensional hierarchy with a


particular type from a phase of a stream.

GET1DHIER

receives the value array of a 1-dimensional hierarchy with a


particular type from a phase of a stream. The 1-dimensional
hierarchy is along a particular criterion.

GET2DHIER

receives the value array of a 2-dimensional hierarchy with a


particular type from a phase of a stream. The 2-dimensional
hierarchy is along two particular criteria.

SEND0DTOSTREAMS sends a value of a 0-dimensional hierarchy with a


particular type to a phase of an output stream.
SEND1DTOSTREAMS sends the value array of a 1-dimensional hierarchy with
a particular type to a phase of an output stream. The 1dimensional hierarchy is along a particular criterion.
SEND2DTOSTREAMS sends the value array of a 2-dimensional hierarchy with
a particular type to a phase of an output stream. The 2dimensional hierarchy is along two particular criteria.
GETFLOWRATE receives the global flowrate from a phase of a stream.
GETVOLFLOWRATE receives the global volumetric flowrate from a phase of
a stream.
GETOREFLOWRATE receives the sum of global flowrates from the ore
phases of a stream.
GETORESOLFLOWRATE receives the sum of global flowrates from the ore
and solid phases of a stream.
GETORESOLVOLFLOW receives the sum of global volumetric flowrates from
the ore and solid phases of a stream.
GETLIQFLOWRATE receives the sum of global flowrates from the liquid
phases of a stream.
GETLIQVOLFLOW receives the sum of global volumetric flowrates from the
liquid phases of a stream.
GETFLOWRATEPERSIZE receives the array of partial flowrates per size class
from a phase of a stream.
GETSIZEFRACTIONS receives the array of size class fractions from a phase
of a stream.

USIM PAC

BRGM Software

FUNCTION LIST

69

GETFLOWRATEPERCOMP receives the array of partial flowrates per


component from a phase of a stream.
GETVOLFLOWPERCOMP receives the array of partial volumetric flowrates per
component from a phase of a stream.
GETFLOWPERSIZECOMP receives the array of partial flowrates per
component and per size class from a phase of a stream.
GETFLOATPROP receives arrays of the component proportions in the floating
ability populations: no floating, slow floating and fast floating,
from a phase of a stream.
SETFLOATPROP sends global flowrate and arrays of the component
proportions in the floating ability populations: no floating,
slow floating and fast floating, to a phase of an output
stream.
GETFLOWRATEPERFIXEDSP receives the array of partial flowrates per
user-defined sub-population from a phase of a stream.
GETFLOWPERCOMPFIXEDSP receives the array of partial flowrates per
user-defined sub-population and per component from a
phase of a stream.
GETSTREAMPHASEDENSITY receives the experimental or calculated value
of the stream density of a phase.
SENDPHASEDENSITYTOSTREAMS sends the calculated value of the stream
density to a phase of an output stream.
GETPHADENSANDVOLFLOW receives the density and the global volumetric
flowrate from a phase of a stream.
GETDENSANDVOLFLOWPERCOMP receives the arrays of densities and
partial volumetric flowrates per component from a phase of a
stream.
Message functions

MESSMODEL

adds a text registered in the file MESSAGES.TXT to the end


of a character string.

MESSMODELINT adds a text registered in the file MESSAGES.TXT containing


an integer value to the end of a character string.
MESSMODELREAL adds a text registered in the file MESSAGES.TXT
containing a real value to the end of a character string.
MESSMODELTEXT adds a text registered in the file MESSAGES.TXT
containing a contextual text to the end of a character string.
MESSMODELNEWLINE adds a new line character sequence to the end of a
character string.
MESSMODELTAB adds a tabulation character sequence to the end of a
character string.
MESSCONCAT

concatenates two character strings.

GDBLTOSTR

formats a real value as a character string using C formatting


code.

MESSTOCONV

writes a formatted text into the model trace file CONV.INF.

USIM PAC

BRGM Software

70

FUNCTION LIST

MESSTOCOST

writes a formatted text into the cost file COST.INF.

MESSTOSCREENsends a message from a formatted text to a message box on


the screen.
SHOWERROR

writes a general message from a predefined text registered


in file MESSAGES.TXT into the model trace file CONV.INF.

Macro functions

COPYPHA

copies the entire description of a phase to a specified output


stream.

ZEROPHA

copies a null description of a phase to a specified output


stream.

SETPHA

copies the entire description of a phase to a specified output


stream with change of the global phase flowrate.

SETPHASLIQ

copies the entire description of all liquid phases to a


specified output stream with change of the global phase
flowrates proportionally to the change of the global liquid
phase flowrate sum.

REGD

makes a linear regression.

DXLOGINTERP

gives dx for a component size distribution by a logarithmic


interpolation.

DXGAUDINTERP gives dx for a component size distribution by a GaudinSchuhmann interpolation.


CUMFLOWPASSDX gives the cumulative passing flowrate for a component
size distribution.
GETROSINRAMMLER gives the d63 and the slope of a component size
distribution by Rosin-Rammler distribution regression.
SETROSINRAMMLER gives a Rosin-Rammler component size distribution
with a d63 and a slope.
SET2ROSINRAMMLER gives a bi-modal Rosin-Rammler component size
distribution with a d63 and a slope for each term.
SET3ROSINRAMMLER gives a tri-modal Rosin-Rammler component size
distribution with a d63 and a slope for each term.
PERFREAC0

calculates mass transfer during chemical reactions using


partial flowrate setpoints.

PERFREACTION0 calculates mass transfer during chemical reactions


without setpoint.
PERFREACTION calculates mass transfer during chemical reactions using
mass fraction setpoints.
PERFPARREAC0 receives the parameters and calculates mass transfer during
chemical reactions without setpoint.
PERFPARREAC receives the parameters and calculates mass transfer during
chemical reactions using mass fraction setpoints.

USIM PAC

BRGM Software

FUNCTION LIST

71

C.3.5. - UP_POWER functions

MESSTOPOWER writes a formatted text into the power consumption file


POWER.INF.
GETPARAM

receives the value of a simple model parameter.

GETPARAMDUPLI* receives the array of values of a multiple model parameter


for a particular phase (see Parameter functions above).
CRUSHPOWER

calculates power consumption during crushing from the feed


and product d80s.

CRUSHPOINF

writes the calculated power consumption during crushing into


the file POWER.INF.

C.3.6. - UP_COST functions

SETCOST

sets the capital cost of a unit of equipment and the number


of units.

GETINTFORCOST calls an integer input interface to ask for an uninitialized


integer parameter of the cost calculation.
GETREALFORCOSTcalls a real input interface to ask for an uninitialized real
parameter of the cost calculation.
GETBOOLFORCOST

calls a Boolean interface for the cost calculation.

CIAB

allows the calculation of the cost of an autogenous mill.

CIATTRITION

allows the calculation of the cost of an attrition cell.

CIBA

allows the calculation of the cost of a rod mill.

CIBO

allows the calculation of the cost of a ball mill.

CICA

allows the calculation of the cost of an air cyclone.

CICC

allows the calculation of the cost of a cone crusher.

CICD

allows the calculation of the cost of a dense medium


cyclone.

CICF

allows the calculation of the cost of a flotation bank.

CICG

allows the calculation of the cost of a gyratory crusher.

CICM

allows the calculation of the cost of a jaw crusher.

CICO

allows the calculation of the cost of a conditioner.

CICR

allows the calculation of the cost of a screen.

CICV

allows the calculation of the cost of a classifier.

CICY

allows the calculation of the cost of an hydrocyclone.

CIEP

allows the calculation of the cost of a thickener.

CIFB

allows the calculation of the cost of a belt filter.

CIFT

allows the calculation of the cost of a drum filter.

CIGC

allows the calculation of the cost of a DSM screen.

CIGP

allows the calculation of the cost of a stationary screen.

USIM PAC

BRGM Software

72

FUNCTION LIST

CIGV

allows the calculation of the cost of a vibrating screen.

CIJ

allows the calculation of the cost of a jig.

CIRA

allows the calculation of the cost of a rake classifier.

CISM

allows the calculation of the cost of a magnetic separator.

CISP

allows the calculation of the cost of a spiral.

CITANKCONE

allows the calculation of the cost of a mild steel Pachuca


tank.

CITANKFLAT

allows the calculation of the cost of a mild flat bottom tank.

CITS

allows the calculation of the cost of a shaking table.

GETPARAM

receives the value of a simple model parameter.

GETPARAMDUPLI* receives the array of values of a multiple model parameter


for a particular phase (see Parameter functions above).

C.3.7. - UP_HELP functions

SETINFOHELP

associates the model to a topic of a user-defined help file.

C.3.8. - Declaration functions

SETINFOMODEL recalls the model number and sets the number of outputs
and the number of parameters (a multiple parameter is
counted as one).
SETINFMODHIER asserts that a material description criterion is not kept for a
type of phase and a type of hierarchy.
SETCOMMINUTION asserts that the size distribution of the phases of type ore
and solid are not kept.
SETINFOHELP

associates the model to a topic of a user-defined help file.

SETPARAMDIALOGTYPE
interface.

sets the dialog box type of parameter input

SETPARAMDUPLIPHASE
sets that a parameter is duplicated along the
phases of a particular type.
SETPARAMDUPLI1CRIT sets that a parameter is duplicated along a
particular criterion of phases of a particular type.
SETPARAMDUPLI2CRIT sets that a parameter is duplicated along two
particular criteria of phases of a particular type.
SETPARAMDUPLI2PHA sets that a parameter is duplicated along two
particular criteria of two phases of two particular types.
SETPARAMDUPLIPARAM sets that a parameter is duplicated along another
parameter. Defines also a parameter as a chemical reaction
number.

USIM PAC

BRGM Software

FUNCTION LIST

73

SETPARAMDUPLIPARAMPHASE sets that a parameter is duplicated along


another parameter and the phases of a particular type.
SETPARAMDUPLIPARAM1CRIT sets that a parameter is duplicated along
another parameter and a particular criterion of phases of a
particular type.
SETPARAMSTRING sets that a parameter is a character string.
SETPARAMFILENAME sets that a parameter is a character string containing a
file name.
SETPARAMDATABASENAME sets that a parameter is a character string
containing the file name of a database of a particular type
with another parameter referring to the entry.
SETGROUP

defines a group of parameters for the model parameter


interface.

SETGROUPPARAM adds a parameter into a group of parameters.

C.3.9. - Data receiving functions

GETPARAM

receives the value of a simple model parameter.

GETUNITPARAM receives the value of a simple model parameter from another


unit operation.
GETPARAMDUPLIPHASE receives the value of a multiple model parameter
duplicated along the phases for a particular phase.
GETUNITPARAMDUPLIPHASE receives the value of a multiple model
parameter duplicated along the phases for a particular phase
from another unit operation.
GETPARAMDUPLI1CRIT receives the array of values of a multiple model
parameter duplicated along one criterion for a particular
phase.
GETUNITPARAMDUPLI1CRIT receives the array of values of a multiple
model parameter duplicated along one criterion for a
particular phase from another unit operation.
GETPARAMDUPLI2CRIT receives the array of values of a multiple model
parameter duplicated along two criteria for a particular
phase.
GETUNITPARAMDUPLI2CRIT receives the array of values of a multiple
model parameter duplicated along two criteria for a particular
phase from another unit operation.
GETPARAMDUPLI2PHA receives the array of values of a multiple model
parameter duplicated along two criteria for two particular
phases.
GETUNITPARAMDUPLI2PHA receives the array of values of a multiple
model parameter duplicated along two criteria for two
particular phases from another unit operation.

USIM PAC

BRGM Software

74

FUNCTION LIST

GETPARAMDUPLIPARAM receives the array of values of a multiple model


parameter duplicated along another parameter.
GETUNITPARAMDUPLIPARAM receives the array of values of a multiple
model parameter duplicated along another parameter from
another unit operation.
GETPARAMDUPLIPARAMPHASE receives the array of values of a multiple
model parameter duplicated along another parameter and
the phases for a particular phase.
GETUNITPARAMDUPLIPARAMPHASE receives the array of values of a
multiple model parameter duplicated along another
parameter and the phases for a particular phase from
another unit operation.
GETPARAMDUPLIPARAM1CRIT receives the array of values of a multiple
model parameter duplicated along another parameter and
one criterion for a particular phase.
GETUNITPARAMDUPLIPARAM1CRIT receives the array of values of a
multiple model parameter duplicated along another
parameter and one criterion for a particular phase from
another unit operation.
GETPARAMSTRING receives the character string value of a string model
parameter.
GETUNITPARAMSTRING receives the character string value of a string model
parameter from another unit operation.
GETPARAMREAC receives the parameters used to calculate the mass
transfer during chemical reactions.
GETNAMECRUSH receives the name of a particular crusher from the crusher
database.
GETNBCRUSH

receives the number of exit settings and the number of feed


size classes for a particular crusher from the crusher
database.

GETDATACRUSHreceives the data set of a particular crusher from the


database.
NBPHA

gives the number of phases in the phase model.

NTYPPHA

gives the type of a phase.

NBPHATYPE

gives the number of phases with a particular type.

NUMPHATYPE

gives the phase number of a phase with a particular type.

NBCRIT

gives the number of criteria in a phase.

NUMCRITYP

gives the number of a criterion with a particular type in a


phase.

NBCLASSCRIT

gives the number of classes of a criterion with a particular


type in a phase.

BCLASSGRA

receives the size class array of a phase.

NBHIER

gives the number of hierarchies in a phase.

USIM PAC

BRGM Software

FUNCTION LIST

NUMHIERSYS

75

gives the number of a hierarchy with a particular system


number in a phase.

NUMSHAREDHIERSYS gives the number of a shared hierarchy with a


particular system number in a phase.
TESTHIERTYP

tests that the hierarchy of a phase has a particular type.

NUMHIER0D

gives the hierarchy number of the 0-dimensional hierarchy of


a particular type in a phase.

NBHIER1D

gives the number of 1-dimensional hierarchies of a particular


type in a phase. The 1-dimensional hierarchy is along a
particular criterion.

NUMHIER1D

gives the hierarchy number of a particular 1-dimensional


hierarchy among hierarchies enumerated by the NBHIER1D
function.

NBHIER2D

gives the number of 2-dimensional hierarchies of a particular


type in a phase. The 2-dimensional hierarchy is along two
particular criteria.

NUMHIER2D

gives the hierarchy number of a particular 2-dimensional


hierarchy among hierarchies enumerated by the NBHIER2D
function.

PHASENAME

receives the name of a phase.

CLASSNAME

receives the name of a criterion class in a phase.

COMPONENTNAME receives the name of a component in a phase.


SIZECLASSNAME

receives the name of a size class in a phase.

FLOATINGNAME receives the name of a floatability sub-population in a phase.


GETCOMPDENSITY receives the array of component densities in a phase.
GETMOLECULARMASS receives the array of component molecular masses
in a phase.
GETPHASELHV receives the low heating value of a phase.
GETCOMPLHV

receives the array of component low heating value in a


phase.

GETSTOECHIOMOL receives the arrays of consumption and production in


component moles for a particular chemical reaction.
GETSTOECHIOMAS receives the arrays of consumption and production in
component masses for a particular chemical reaction.
GETNBFLUXIN

gives the number of input streams of the unit of equipment.

GETNUMFLUXIN gives the stream number in the flowsheet that is an input


stream of the unit of equipment.
GETNUMFLUX

gives the stream number in the flowsheet that is an output


stream of the unit of equipment.

GET0DHIER

receives the value of a 0-dimensional hierarchy with a


particular type from a phase of a stream.

USIM PAC

BRGM Software

76

FUNCTION LIST

GET1DHIER

receives the value array of a 1-dimensional hierarchy with a


particular type from a phase of a stream. The 1-dimensional
hierarchy is along a particular criterion.

GET2DHIER

receives the value array of a 2-dimensional hierarchy with a


particular type from a phase of a stream. The 2-dimensional
hierarchy is along two particular criteria.

GETFLOWRATE receives the global flowrate from a phase of a stream.


GETVOLFLOWRATE receives the global volumetric flowrate from a phase of
a stream.
GETOREFLOWRATE receives the sum of global flowrates from the ore
phases of a stream.
GETORESOLFLOWRATE receives the sum of global flowrates from the ore
and solid phases of a stream.
GETORESOLVOLFLOW receives the sum of global volumetric flowrates from
the ore and solid phases of a stream.
GETLIQFLOWRATE receives the sum of global flowrates from the liquid
phases of a stream.
GETLIQVOLFLOW receives the sum of global volumetric flowrates from the
liquid phases of a stream.
GETFLOWRATEPERSIZE receives the array of partial flowrates per size class
from a phase of a stream.
GETSIZEFRACTIONS receives the array of size class fractions from a phase
of a stream.
GETFLOWRATEPERCOMP receives the array of partial flowrates per
component from a phase of a stream.
GETVOLFLOWPERCOMP receives the array of partial volumetric flowrates per
component from a phase of a stream.
GETFLOWPERSIZECOMP receives the array of partial flowrates per
component and per size class from a phase of a stream.
GETFLOATPROP receives arrays of the component proportions in the floating
ability populations: no floating, slow floating and fast floating,
from a phase of a stream.
GETFLOWRATEPERFIXEDSP receives the array of partial flowrates per
user-defined sub-population from a phase of a stream.
GETFLOWPERCOMPFIXEDSP receives the array of partial flowrates per
user-defined sub-population and per component from a
phase of a stream.
GETSTREAMPHASEDENSITY receives the experimental or calculated value
of the stream density of a phase.
GETPHADENSANDVOLFLOW receives the density and the global volumetric
flowrate from a phase of a stream.
GETDENSANDVOLFLOWPERCOMP receives the arrays of densities and
partial volumetric flowrates per component from a phase of a
stream.

USIM PAC

BRGM Software

FUNCTION LIST

77

C.3.10. - Data sending functions

SENDTOPARAM sends the value of a simple output model parameter to the


parameter set.
SENDTOPARAMDUPLIPARAM sends the array of values of a multiple output
model parameter duplicated along another parameter to the
parameter set.
SENDTOPARAMNEXTAPP sends the value of a simple model parameter to
the parameter set of the next unit operation in the flowsheet
order.
SEND0DTOSTREAMS sends a value of a 0-dimensional hierarchy with a
particular type to a phase of an output stream.
SEND1DTOSTREAMS sends the value array of a 1-dimensional hierarchy with
a particular type to a phase of an output stream. The 1dimensional hierarchy is along a particular criterion.
SEND2DTOSTREAMS sends the value array of a 2-dimensional hierarchy with
a particular type to a phase of an output stream. The 2dimensional hierarchy is along two particular criteria.
SETFLOATPROP sends global flowrate and arrays of the component
proportions in the floating ability populations: no floating,
slow floating and fast floating, to a phase of an output
stream.
SENDPHASEDENSITYTOSTREAMS sends the calculated value of the stream
density to a phase of an output stream.
COPYPHA

copies the entire description of a phase to a specified output


stream.

ZEROPHA

copies a null description of a phase to a specified output


stream.

SETPHA

copies the entire description of a phase to a specified output


stream with change of the global phase flowrate.

SETPHASLIQ

copies the entire description of all liquid phases to a


specified output stream with change of the global phase
flowrates proportionally to the change of the global liquid
phase flowrate sum.

C.3.11. - Test functions

TESTPHASMOD tests the phase model coherence with an industrial domain.


TESTPHAORE

tests the presence of at least one ore phase.

TESTSIZEFLOW tests the presence of a size distribution in an ore phase.


TESTSIZECOMPFLOW tests the presence of a component grade per size
class in an ore phase.
TESTHIERTYP

USIM PAC

tests that the hierarchy of a phase has a particular type.

BRGM Software

78

FUNCTION LIST

C.3.12. - Treatment functions

CIAB

allows the calculation of the cost of an autogenous mill.

CIATTRITION

allows the calculation of the cost of an attrition cell.

CIBA

allows the calculation of the cost of a rod mill.

CIBO

allows the calculation of the cost of a ball mill.

CICA

allows the calculation of the cost of an air cyclone.

CICC

allows the calculation of the cost of a cone crusher.

CICD

allows the calculation of the cost of a dense medium


cyclone.

CICF

allows the calculation of the cost of a flotation bank.

CICG

allows the calculation of the cost of a gyratory crusher.

CICM

allows the calculation of the cost of a jaw crusher.

CICO

allows the calculation of the cost of a conditioner.

CICR

allows the calculation of the cost of a screen.

CICV

allows the calculation of the cost of a classifier.

CICY

allows the calculation of the cost of an hydrocyclone.

CIEP

allows the calculation of the cost of a thickener.

CIFB

allows the calculation of the cost of a belt filter.

CIFT

allows the calculation of the cost of a drum filter.

CIGC

allows the calculation of the cost of a DSM screen.

CIGP

allows the calculation of the cost of a stationary screen.

CIGV

allows the calculation of the cost of a vibrating screen.

CIJ

allows the calculation of the cost of a jig.

CIRA

allows the calculation of the cost of a rake classifier.

CISM

allows the calculation of the cost of a magnetic separator.

CISP

allows the calculation of the cost of a spiral.

CITANKCONE

allows the calculation of the cost of a mild steel Pachuca


tank.

CITANKFLAT

allows the calculation of the cost of a mild flat bottom tank.

CITS

allows the calculation of the cost of a shaking table.

REGD

makes a linear regression.

DXLOGINTERP

gives dx for a component size distribution by a logarithmic


interpolation.

DXGAUDINTERP gives dx for a component size distribution by a GaudinSchuhmann interpolation.

USIM PAC

BRGM Software

FUNCTION LIST

79

CUMFLOWPASSDX gives the cumulative passing flowrate for a component


size distribution.
GETROSINRAMMLER gives the d63 and the slope of a component size
distribution by Rosin-Rammler distribution regression.
SETROSINRAMMLER gives a Rosin-Rammler component size distribution
with a d63 and a slope.
SET2ROSINRAMMLER gives a bi-modal Rosin-Rammler component size
distribution with a d63 and a slope for each term.
SET3ROSINRAMMLER gives a tri-modal Rosin-Rammler component size
distribution with a d63 and a slope for each term.
PERFREAC0

calculates mass transfer during chemical reactions using


partial flowrate setpoints.

PERFREACTION0 calculates mass transfer during chemical reactions


without setpoint.
PERFREACTION calculates mass transfer during chemical reactions using
mass fraction setpoints.
PERFPARREAC0 receives the parameters and calculates mass transfer during
chemical reactions without setpoint.
PERFPARREAC receives the parameters and calculates mass transfer during
chemical reactions using mass fraction setpoints.
CRUSHPOWER

calculates power consumption during crushing from the feed


and product d80s.

C.3.13. - Message functions

MESSMODEL

adds a text registered in the file MESSAGES.TXT to the end


of a character string.

MESSMODELINT adds a text registered in the file MESSAGES.TXT containing


an integer value to the end of a character string.
MESSMODELREAL adds a text registered in the file MESSAGES.TXT
containing a real value to the end of a character string.
MESSMODELTEXT adds a text registered in the file MESSAGES.TXT
containing a contextual text to the end of a character string.
MESSMODELNEWLINE adds a new line character sequence to the end of a
character string.
MESSMODELTAB adds a tabulation character sequence to the end of a
character string.
MESSCONCAT

concatenates two character strings.

GDBLTOSTR

formats a real value as a character string using C formatting


code.

MESSTOCONV

writes a formatted text into the model trace file CONV.INF.

MESSTOCOST

writes a formatted text into the cost file COST.INF.

USIM PAC

BRGM Software

80

FUNCTION LIST

MESSTOSCREENsends a message from a formatted text to a message box on


the screen.
SHOWERROR

writes a general message from a predefined text registered


in file MESSAGES.TXT into the model trace file CONV.INF.

MESSTOPOWER writes a formatted text into the power consumption file


POWER.INF.
CRUSHPOINF

writes the calculated power consumption during crushing into


the file POWER.INF.

C.4. - SYMBOLIC CONSTANTS


The symbolic constants are constants defined by the PARAMETER statement in the
files ICONS.FI and MODELS.FI.
These constants are:

number range of the icon or model library subsets,

working modes and variants,

model parameter input interface type,

phase model description elements.

C.4.1. - Number range of the icon or model library subsets

USER

lower limit of the number range of the user-defined icon


library. The first icon number of the user-defined library must
be USER+1.

MAXUSER

upper limit of the number range of the user-defined icon


library.

NUMMOD_USER lower limit of the number range of the user-defined model


library. The first model number of the user-defined library
must be NUMMOD_USER.
NUMMODMAX_USER upper limit of the number range of the user-defined
model library.
Other constants NUMMOD_XXX and NUMMODMAX_XXX are defined in the file
MODELS.FI but they are only used for the general, comminution, separation,
hydrometallurgical and waste management model libraries.

C.4.2. - Working modes and variants

UP_PRESENT

presence test working mode for both icon and model.

UP_PRESENT_TEST

variant of the UP_PRESENT working mode of a model.

UP_PRESENT_INFO variant of the UP_PRESENT working mode of a model.


UP_PARAM

USIM PAC

parameter declaration working mode for both icon and


model.

BRGM Software

FUNCTION LIST

81

UP_PARAM_DIALOGTYPE variant of the UP_PARAM working mode of a


model.
UP_DRAW

icon drawing working mode for an icon.

UP_COMP

phase model compatibility working mode for a model.

UP_COMP_NECESSAIRE

variant of the UP_COMP working mode.

UP_COMP_TRAITE variant of the UP_COMP working mode.


UP_MODEL

mathematical model working mode.

UP_MODEL_MESSAGE

variant of the UP_MODEL working mode.

UP_POWER

power consumption working mode.

UP_COST

capital cost estimation working mode.

UP_COST_CALC variant of the UP_COST working mode.


UP_HELP

model help working mode.

UP_HELP_INFO variant of the UP_HELP working mode.

C.4.3. - Model parameter input interface type

TP_NOPARAM

type of the model parameter input dialog box when there are
no parameter.

TP_SIMPLEPARAM type of the model parameter input dialog box when there
are no multiple parameter.
TP_DUPLIPARAM type of the model parameter input dialog box when there
are multiple parameters.

C.4.4. - Phase model description elements

TYPORE

characterizes the ore phase type.

TYPSOL

characterizes the solids phase type.

TYPLIQ

characterizes the liquid phase type.

TYPGAZ

characterizes the gas phase type.

CRITSIZE

characterizes the size classes criterion of the phase


description.

CRITCOMP

characterizes
description.

CRITFLOT

characterizes the floating ability criterion of the phase


description.

CRITFIXEDSP1

characterizes the first user-defined sub-population criterion


of the phase description.

CRITFIXEDSP2

characterizes the second user-defined


criterion of the phase description.

USIM PAC

the

component

criterion

of

the

phase

sub-population

BRGM Software

82

FUNCTION LIST

CRITFIXEDSP3

characterizes the third user-defined sub-population criterion


of the phase description.

TYPEFLOW

characterizes the flowrate hierarchy type.

TYPEDENS

characterizes the density hierarchy type.

TYPMOLMASS

characterizes the molecular mass hierarchy type.

TYPLHV

characterizes the low heating value hierarchy type.

NSPHAFLOW

characterizes the phase flowrate hierarchy.

NSSIZFLOW

characterizes the size distribution hierarchy of type flowrate.

NSSIZCONFLOW characterizes the component grade per size class hierarchy


of type flowrate.
NSCONFLOW

characterizes the component grade hierarchy of type


flowrate.

NSPHADENS

characterizes the phase density hierarchy.

NSCONDENS

characterizes the component density hierarchy.

NSCONFLOTFLOW characterizes
hierarchy.

the

floating

component

proportion

NSCONFSP1

characterizes the first user-defined sub-population proportion


per component hierarchy of type flowrate.

NSCONFSP2

characterizes the second user-defined sub-population


proportion per component hierarchy of type flowrate.

NSCONFSP3

characterizes the third user-defined sub-population


proportion per component hierarchy of type flowrate.

NSSIZFSP1

characterizes the first user-defined sub-population proportion


per size class hierarchy of type flowrate.

NSSIZFSP2

characterizes the second user-defined sub-population


proportion per size class hierarchy of type flowrate.

NSSIZFSP3

characterizes the third user-defined sub-population


proportion per size class hierarchy of type flowrate.

NSSTREAMPHADENS characterizes the stream phase density hierarchy.


NSCONMOLMASS characterizes the component molecular mass hierarchy.
NSSP1MOLMASScharacterizes the molecular mass per first user-defined subpopulation hierarchy.
NSPHALHV

characterizes the phase low heating value hierarchy.

NSCONLHV

characterizes the component low heating value hierarchy.

GRANULATS

characterizes the phase model used for the sand and gravel
industry.

UPVER1

characterizes the phase model used in USIM PAC version


1.x.

USIM PAC

BRGM Software

FUNCTION LIST

83

C.5. - VARIABLES USED BY ALL MODELS


Variables used by all models are defined in file MODELS.FI. So, it is not necessary to
redefine them in your model function declaration statement block.
MODELNAME

CHARACTER*50
contains the model name. This string variable must be
initialized with the C compatibility:
MODELNAME = 'MYMODEL' C

ANSWER

CHARACTER*254
contains a formatted text to display messages on the screen
or in files (power, model trace). This string variable must be
initialized with the C compatibility.

NAME

CHARACTER*31
contains a text receiving the name of a phase, a component,
a size class or a floating ability sub-population. This string
variable must be initialized with the C compatibility.

FORME

CHARACTER*14
contains the format string used by the GDBLTOSTR
function. This string variable must be initialized with the C
compatibility.

PARANAME

CHARACTER*50
no specific use.

MODELHELPFILE

CHARACTER*50

contains the model help file name. This string is used by the
function SETINFOHELP. This string variable must be
initialized with the C compatibility.

C.6. - VARIABLES USED BY ALL ICONS


Variables used by all icons are defined in file ICONS.FI. So, it is not necessary to
redefine them in your icon function declaration statement block.
ICONNAME

CHARACTER*255
contains the icon name. This string variable must be
initialized with the C compatibility:
ICONNAME = 'MYICON' C

USIM PAC

BRGM Software

84

FUNCTION REFERENCES

D - FUNCTION REFERENCES

USIM PAC

BRGM Software

FUNCTION REFERENCES

USIM PAC

85

BRGM Software

86

FUNCTION REFERENCES

INTRODUCTION
This part describes all the functions which can be used by the user-defined icon or
model functions.
To find easily a function use part C.

ARC
Syntax

SUBROUTINE ARC (XC, YC, R, IARCS, IARCE)


Draws a circle arc centered on point (XC, YC) with radius
R. IARCS and IARCE are the starting and ending point
angles with the trigonometric origine.

IARCE
IARCS

Parameters

Type/Description

XC

INTEGER X-coordinate of the circle


arc center.

YC

INTEGER Y-coordinate of the circle


arc center.

INTEGER Radius of the circle arc.

IARCS

INTEGER Angle, in degrees, of the


starting point.

IARCE

INTEGER Angle, in degrees, of the


ending point.

Comments:
This subroutine is called by the UP_DRAW working mode
of the icon library functions.
ARC is a new function of the version 3.0.

ARCINF
Syntax

SUBROUTINE ARCINF (XC, YC, R, IARC)


Draws a lower circle arc centered on point (XC, YC) with
radius R. IARC is the percentage of a complete circle (50
for a half circle, 25 for a quarter).
Parameters
XC

USIM PAC

Type/Description
INTEGER X-coordinate of the circle
arc center.

BRGM Software

FUNCTION REFERENCES

87

YC

INTEGER Y-coordinate of the circle


arc center.

INTEGER Radius of the circle arc.

IARC

INTEGER Percentage of a complete


circle.

Comments:
This subroutine is called by the UP_DRAW working mode
of the icon library functions.

ARCSUP
Syntax

SUBROUTINE ARCSUP (XC, YC, R, IARC)


Draws an upper circle arc centered on point (XC, YC) with
radius R. IARC is the percentage of a complete circle (50
for a half circle, 25 for a quarter).
Parameters

Type/Description

XC

INTEGER X-coordinate of the circle


arc center.

YC

INTEGER Y-coordinate of the circle


arc center.

INTEGER Radius of the circle arc.

IARC

INTEGER Percentage of a complete


circle.

Comments:
This subroutine is called by the UP_DRAW working mode
of the icon library functions.

BCLASSGRA
Syntax

INTEGER FUNCTION BCLASSGRA (NPHA, SIZE)


Receives the upper bound size array SIZE of the size
classes in phase number NPHA.
Parameters

Type/Description

NPHA

INTEGER Phase number.

SIZE

REAL*8 (:) Upper bound size array


of the size classes.

Return value:
A negative value if there is no size class or if the phase
number is not valid else 0.
Comments:

USIM PAC

BRGM Software

88

FUNCTION REFERENCES

This function is called by the UP_MODEL working mode of


the model library functions.

CERCLE
Syntax

SUBROUTINE CERCLE (XC, YC, R)


Draws a circle centered on the point (XC, YC) with a radius
R.
Parameters

Type/Description

XC

INTEGER X-coordinate of the circle


center.

YC

INTEGER Y-coordinate of the circle


center.

INTEGER Radius of the circle.

Comments:
This subroutine is called by the UP_DRAW working mode
of the icon library functions.

CIAB
Syntax

INTEGER FUNCTION CIAB (PW, COST)


Allows the calculation of the cost of an autogenous mill.
Parameters

Type/Description

PW

REAL*8 Mill power (kW).

COST

REAL*8 Calculated cost ($CAN


1982) of one autogenous mill.

Return value:
Returns 1.
Comments:
This function is called by an autogenous mill model. If the
cost parameter PW is not known, its value must be
initialized to 0. If the value of PW equals 0 or is not within
the range for cost calculation, the function asks for a new
parameter value. If the request is not cancelled, CIAB
calculates COST and transmits it to the model.
This function is called by the UP_COST working mode of
the model library functions.

CIATTRITION
Syntax

INTEGER FUNCTION CIATTRITION (CAP, COST)


Allows the calculation of the cost of an attrition cell.

USIM PAC

BRGM Software

FUNCTION REFERENCES

Parameters

89

Type/Description

CAP

REAL*8 Attrition cell capacity (m3).

COST

REAL*8 Calculated cost ($CAN


1982) of one attrition cell.

Return value:
Returns 1.
Comments:
This function is called by an attrition model. If the cost
parameter CAP is not known, its value must be initialized to
0. If the value of CAP equals 0 or is not within the range for
cost calculation, the function asks for a new parameter
value. If the request is not cancelled, CIATTRITION
calculates COST and transmits it to the model.
This function is called by the UP_COST working mode of
the model library functions.

CIBA
Syntax

INTEGER FUNCTION CIBA (D, XLD, FILL, COST)


Allows the calculation of the cost of a rod mill.
Parameters

Type/Description

REAL*8 Internal diameter of the rod


mill (m).

XLD

REAL*8 Length/Diameter ratio.

FILL

REAL*8 Filling factor (t/m3).

COST

REAL*8 Calculated cost ($CAN


1982) of one rod mill.

Return value:
Returns 1.
Comments:
This function is called by a rod mill model. If one of the cost
parameters D, XLD or FILL is not known, its value must be
initialized to 0. If one of the values of these parameters
equals 0 or is not within the range for cost calculation, the
function asks for new parameter values. If the request is
not cancelled, CIBA calculates COST and transmits it to
the model.
This function is called by the UP_COST working mode of
the model library functions.

CIBO
Syntax

USIM PAC

INTEGER FUNCTION CIBO (D, XLD, FILL, COST)

BRGM Software

90

FUNCTION REFERENCES

Allows the calculation of the cost of a ball mill.


Parameters

Type/Description

REAL*8 Internal diameter of the ball


mill (m).

XLD

REAL*8 Length/Diameter ratio.

FILL

REAL*8 Filling factor (t/m3).

COST

REAL*8 Calculated cost ($CAN


1982) of one ball mill.

Return value:
Returns 1.
Comments:
This function is called by a ball mill model. If one of the cost
parameters D, XLD or FILL is not known, its value must be
initialized to 0. If one of the value of these parameters
equals 0 or is not within the range for cost calculation, the
function asks for new parameters values. If the request is
not cancelled, CIBO calculates COST and transmits it to
the model.
This function is called by the UP_COST working mode of
the model library functions.

CICA
Syntax

INTEGER FUNCTION CICA (D, COST)


Allows the calculation of the cost of an air cyclone.
Parameters

Type/Description

REAL*8 Cyclone Diameter (m).

COST

REAL*8 Calculated cost ($CAN


1982) of one air cyclone.

Return value:
Returns 1.
Comments:
This function is called by an air cyclone model. If the cost
parameter D is not known, its value must be initialized to 0.
If the value of D equals 0 or is not within the range for cost
calculation, the function asks for a new parameter value. If
the request is not cancelled, CICA calculates COST and
transmits it to the model.
This function is called by the UP_COST working mode of
the model library functions.

USIM PAC

BRGM Software

FUNCTION REFERENCES

91

CICC
Syntax

INTEGER FUNCTION CICC (CAP, COST)


Allows the calculation of the cost of a cone crusher.
Parameters

Type/Description

CAP

REAL*8 Capacity (t/h).

COST

REAL*8 Calculated cost ($CAN


1982) of one cone crusher.

Return value:
Returns 1.
Comments:
This function is called by a cone crusher model. If the cost
parameter CAP is not known, its value must be initialized to
0. If the value of CAP equals 0 or is not within the range for
cost calculation, the function asks for a new parameter
value. If the request is not cancelled, CICC calculates
COST and transmits it to the model.
This function is called by the UP_COST working mode of
the model library functions.

CICD
Syntax

INTEGER FUNCTION CICD (D, LINER, COST)


Allows the calculation of the cost of a dense medium
cyclone.
Parameters

Type/Description

REAL*8 Cyclone Diameter (m).

LINER

INTEGER Liner type: Ceramic (1) or


NiHard (2).

COST

REAL*8 Calculated cost ($CAN


1982) of one dense medium cyclone.

Return value:
Returns 1.
Comments:
This function is called by a cyclone model. If the cost
parameters D or LINER are not known, their values must
be initialized to 0. If the values of these parameters equal 0
or are not within the range for cost calculation, the function
asks for new parameters values. If the request is not
cancelled, CICD calculates COST and transmits it to the
model.

USIM PAC

BRGM Software

92

FUNCTION REFERENCES

This function is called by the UP_COST working mode of


the model library functions.

CICF
Syntax

INTEGER FUNCTION CICF (NBCELLS, CEV, EVP, COST)


Allows the calculation of the cost of a flotation bank.
Parameters

Type/Description

NBCELLS

INTEGER Number of cells per bank.

CEV

REAL*8 Cell effective volume (m3).

EVP

REAL*8 Effective volume


percentage.

COST

REAL*8 Calculated cost ($CAN


1982) of one flotation bank.

Return value:
Returns 1.
Comments:
This function is called by a flotation model. If the cost
parameters NBCELLS, CEV and EVP are not known, their
values must be initialized to 0. If the values of these
parameters equal 0 or are not within the range for cost
calculation, the function asks for new parameters values. If
the request is not cancelled, CICF calculates COST and
transmits it to the model.
This function is called by the UP_COST working mode of
the model library functions.

CICG
Syntax

INTEGER FUNCTION CICG (OSS, CRUSH, COST)


Allows the calculation of the cost of a gyratory crusher.
Parameters

Type/Description

OSS

REAL*8 Opened Side Setting (m) .

CRUSH

INTEGER*2 Crusher type: Primary


(1) or Secondary (2).

COST

REAL*8 Calculated cost ($CAN


1982) of one gyratory crusher.

Return value:
Returns 1.
Comments:

USIM PAC

BRGM Software

FUNCTION REFERENCES

93

This function is called by a gyratory crusher model. If the


cost parameters OSS and CRUSH are not known, their
values must be initialized to 0. If the values of these
parameters equal 0 or are not within the range for cost
calculation, the function asks for new parameters values. If
the request is not cancelled, CICG calculates COST and
transmits it to the model.
This function is called by the UP_COST working mode of
the model library functions.

CICM
Syntax

INTEGER FUNCTION CICM (CSS, COST)


Allows the calculation of the cost of a jaw crusher.
Parameters

Type/Description

CSS

REAL*8 Closed side setting (m).

COST

REAL*8 Calculated cost ($CAN


1982) of one jaw crusher.

Return value:
Returns 1.
Comments:
This function is called by a jaw crusher model. If the cost
parameter CSS is not known, its value must be initialized to
0. If the value of CSS equals 0 or is not within the range for
cost calculation, the function asks for a new parameter
value. If the request is not cancelled, CICM calculates
COST and transmits it to the model.
This function is called by the UP_COST working mode of
the model library functions.

CICO
Syntax

INTEGER FUNCTION CICO (CAP, COST)


Allows the calculation of the cost of a conditioner.
Parameters

Type/Description

CAP

REAL*8 Conditioner capacity (m3).

COST

REAL*8 Calculated cost ($CAN


1982) of one conditioner.

Return value:
Returns 1.
Comments:

USIM PAC

BRGM Software

94

FUNCTION REFERENCES

This function is called by a conditioner model. If the cost


parameter CAP is not known, its value must be initialized to
0. If the value of CAP equals 0 or is not within the range for
cost calculation, the function asks for a new parameter
value. If the request is not cancelled, CICO calculates
COST and transmits it to the model.
This function is called by the UP_COST working mode of
the model library functions.

CICR
Syntax

INTEGER FUNCTION CICR (WI, XLD, SCREEN, COST, RADIUS,


STEEL, DECK)
Allows the calculation of the cost of a screen.
Parameters

Type/Description

WI

REAL*8 Screen width (m).

XLD

REAL*8 Length/width ratio.

SCREEN

INTEGER*2 Screen type: DSM


screen (1), Stationary screen (2),
Vibrating screen (3).

RADIUS

INTEGER Radius type: 5 ft 1 in. (1)


or 2 ft 6 in. (2). Used if SCREEN
equals 1.

STEEL

INTEGER Steel used: stainless (1)


or carbon (2). Used if SCREEN
equals 2.

DECK

INTEGER Multiple deck type: single


(1), double (2) or triple (3) deck. Used
if SCREEN equals 3.

COST

REAL*8 Calculated cost ($CAN


1982) of one screen.

Return value:
Returns 1.
Comments:
This function is called by a screen model. If the cost
parameters WI, XLD, SCREEN, RADIUS, STEEL and
DECK are not known, their values must be initialized to 0. If
the values of these parameters equal 0 or are not within the
range for cost calculation, the function asks for a new
parameter value. The function CICR calls the function
CIGC (calculation of the cost of a DSM screen) if SCREEN
equals 1, or the function CIGP (calculation of the cost of a
stationary screen) if SCREEN equals 2, or the function
CIGV (calculation of the cost of a vibrating screen) if
SCREEN equals 3, and transmits COST to the model.

USIM PAC

BRGM Software

FUNCTION REFERENCES

95

This function is called by the UP_COST working mode of


the model library functions.
The parameter list of the function CICR has been changed
in the version 3.0 compared to the version 2.1.

CICV
Syntax

INTEGER FUNCTION CICV (SD, SPIRAL, COST)


Allows the calculation of the cost of a spiral classifier.
Parameters

Type/Description

SD

REAL*8 Spiral Diameter (m).

SPIRAL

INTEGER Spiral type: Simplex (1) or


Duplex (2).

COST

REAL*8 Calculated cost ($CAN


1982) of one classifier.

Return value:
Returns 1.
Comments:
This function is called by a spiral classifier model. If the
cost parameters SD and SPIRAL are not known, their
values must be initialized to 0. If the values of these
parameters equal 0 or are not within the range for cost
calculation, the function asks for new parameters values. If
the request is not cancelled, CICV calculates COST and
transmits it to the model.
This function is called by the UP_COST working mode of
the model library functions.

CICY
Syntax

INTEGER FUNCTION CICY (D, COST)


Allows the calculation of the cost of an hydrocyclone.
Parameters

Type/Description

REAL*8 Hydrocyclone Diameter(m).

COST

REAL*8 Calculated cost ($CAN


1982) of one hydrocyclone.

Return value:
Returns 1.
Comments:
This function is called by an hydrocyclone model. If the cost
parameter D is not known, its value must be initialized to 0.
If the value of this parameter equals 0 or is not within the

USIM PAC

BRGM Software

96

FUNCTION REFERENCES

range for cost calculation, the function asks for a new


parameter value. If the request is not cancelled, CICY
calculates COST and transmits it to the model.
This function is called by the UP_COST working mode of
the model library functions.

CIEP
Syntax

INTEGER FUNCTION CIEP (TD, DRIVE, COST)


Allows the calculation of the cost of a thickener.
Parameters

Type/Description

TD

REAL*8 Tank Diameter (m).

DRIVE

INTEGER Drive type: Cable (1) or


Traction (2).

COST

REAL*8 Calculated cost ($CAN


1982) of one thickener.

Return value:
Returns 1.
Comments:
This function is called by a thickener model. If the cost
parameters TD and DRIVE are not known, their values
must be initialized to 0. If the values of these parameters
equal 0 or are not within the range for cost calculation, the
function asks for new parameters values. If the request is
not cancelled, CIEP calculates COST and transmits it to the
model.
This function is called by the UP_COST working mode of
the model library functions.

CIFB
Syntax

INTEGER FUNCTION CIFB (AREA, COST)


Allows the calculation of the cost of a belt filter.
Parameters

Type/Description

AREA

REAL*8 Filter area (m2).

COST

REAL*8 Calculated cost ($CAN


1982) of one belt filter.

Return value:
Returns 1.
Comments:
This function is called by a belt filter model. If the cost
parameter AREA is not known, its value must be initialized

USIM PAC

BRGM Software

FUNCTION REFERENCES

97

to 0. If the value of AREA equals 0 or is not within the


range for cost calculation, the function asks for a new
parameter value. If the request is not cancelled, CIFB
calculates COST and transmits it to the model.
This function is called by the UP_COST working mode of
the model library functions.

CIFT
Syntax

INTEGER FUNCTION CIFT (AREA, COST)


Allows the calculation of the cost of a drum filter.
Parameters

Type/Description

AREA

REAL*8 Filter area (m2).

COST

REAL*8 Calculated cost ($CAN


1982) of one drum filter.

Return value:
Returns 1.
Comments:
This function is called by a drum filter model. If the cost
parameter AREA is not known, its value must be initialized
to 0. If the value of AREA equals 0 or is not within the
range for cost calculation, the function asks for a new
parameter value. If the request is not cancelled, CIFT
calculates COST and transmits it to the model.
This function is called by the UP_COST working mode of
the model library functions.

CIGC
Syntax

INTEGER FUNCTION CIGC (WI, RADIUS, COST)


Allows the calculation of the cost of a DSM screen.
Parameters

Type/Description

WI

REAL*8 Screen width (m).

RADIUS

INTEGER Radius type: 5 ft 1 in. (1)


or 2 ft 6 in. (2).

COST

REAL*8 Calculated cost ($CAN


1982) of one DSM screen.

Return value:
Returns 1.
Comments:
This function is called by the function CICR. If the cost
parameters WI and RADIUS are not known, their values

USIM PAC

BRGM Software

98

FUNCTION REFERENCES

must be initialized to 0. If the values of these parameters


equal 0 or are not within the range for cost calculation, the
function asks for new parameter values. If the request is
not cancelled, CIGC calculates COST and transmits it to
CICR or the model.
This function is called by the UP_COST working mode of
the model library functions.

CIGP
Syntax

INTEGER FUNCTION CIGP (WI, XLD, STEEL, COST)


Allows the calculation of the cost of a stationary screen.
Parameters

Type/Description

WI

REAL*8 Screen width (m).

XLD

REAL*8 Length/width ratio.

STEEL

INTEGER Steel used: stainless (1)


or carbon (2).

COST

REAL*8 Calculated cost ($CAN


1982) of one stationary screen.

Return value:
Returns 1.
Comments:
This function is called by the function CICR. If the cost
parameters WI, XLD and STEEL are not known, their
values must be initialized to 0. If the values of these
parameters equal 0 or are not within the range for cost
calculation, the function asks for new parameter values. If
the request is not cancelled, CIGP calculates COST and
transmits it to CICR or the model.
This function is called by the UP_COST working mode of
the model library functions.

CIGV
Syntax

INTEGER FUNCTION CIGV (WI, XLD, DECK, COST)


Allows the calculation of the cost of a vibrating screen.
Parameters

USIM PAC

Type/Description

WI

REAL*8 Screen width (m).

XLD

REAL*8 Length/width ratio.

DECK

INTEGER Multiple deck type: single


(1), double (2) or triple (3) deck.

BRGM Software

FUNCTION REFERENCES

COST

99

REAL*8 Calculated cost ($CAN


1982) of one vibrating screen.

Return value:
Returns 1.
Comments:
This function is called by the function CICR. If the cost
parameters WI, XLD and DECK are not known, their values
must be initialized to 0. If the values of these parameters
equal 0 or are not within the range for cost calculation, the
function asks for new parameter values. If the request is
not cancelled, CIGV calculates COST and transmits it to
CICR or the model.
This function is called by the UP_COST working mode of
the model library functions.

CIJ
Syntax

INTEGER FUNCTION CIJ (AREA, JIG, COST)


Allows the calculation of the cost of a jig.
Parameters

Type/Description

AREA

REAL*8 Jigging area (m2).

JIG

INTEGER Jig type: simplex (1) or


duplex (2) jig.

COST

REAL*8 Calculated cost ($CAN


1982) of one jig.

Return value:
Returns 1.
Comments:
This function is called by a jig model. If the cost parameters
AREA and JIG are not known, their values must be
initialized to 0. If the values of these parameters equal 0 or
are not within the range for cost calculation, the function
asks for new parameter values. If the request is not
cancelled, CIJ calculates COST and transmits it to the
model.
This function is called by the UP_COST working mode of
the model library functions.

CIRA
Syntax

INTEGER FUNCTION CIRA (LENGTH, WIDTH, COST)


Allows the calculation of the cost of a rake classifier.
Parameters

USIM PAC

Type/Description

BRGM Software

100

FUNCTION REFERENCES

LENGTH

REAL*8 Length of the classifier (m).

WIDTH

REAL*8 Width of the classifier (m).

COST

REAL*8 Calculated cost ($CAN


1982) of one rake classifier.

Return value:
Returns 1.
Comments:
This function is called by a rake classifier model. If the cost
parameters LENGTH and WIDTH are not known, their
values must be initialized to 0. If the values of these
parameters equal 0 or are not within the range for cost
calculation, the function asks for new parameter values. If
the request is not cancelled, CIRA calculates COST and
transmits it to the model.
This function is called by the UP_COST working mode of
the model library functions.

CISP
Syntax

INTEGER FUNCTION CISP (FLOW, SPIRAL, COST)


Allows the calculation of the cost of a spiral.
Parameters

Type/Description

FLOW

REAL*8 Nominal solid flowrate (t/h).

SPIRAL

INTEGER Spiral type: steel (1) or


fiberglass (2) spiral.

COST

REAL*8 Calculated cost ($CAN


1982) of one spiral.

Return value:
Returns 1.
Comments:
This function is called by a spiral model. If the cost
parameters FLOW and SPIRAL are not known, their values
must be initialized to 0. If the values of these parameters
equal 0 or are not within the range for cost calculation, the
function asks for new parameter values. If the request is
not cancelled, CISP calculates COST and transmits it to the
model.
This function is called by the UP_COST working mode of
the model library functions.

CITANKCONE
Syntax

USIM PAC

INTEGER FUNCTION CITANKCONE (CAP, OPEN, RUBBER,


COST)

BRGM Software

FUNCTION REFERENCES

101

Allows the calculation of the cost of a tank of type Pachuca.


Parameters

Type/Description

CAP

REAL*8 Tank capacity or volume


(m3).

OPEN

INTEGER Open (1) or closed (2) top.

RUBBER

INTEGER Uncoated (1), Natural


rubber (2) or Butyl rubber (3).

COST

REAL*8 Calculated cost ($CAN


1982) of one spiral.

Return value:
Returns 1.
Comments:
This function is called by a CIP or CIL tank model. If the
cost parameters CAP, OPEN and RUBBER are not known,
their values must be initialized to 0. If the values of these
parameters equal 0 or are not within the range for cost
calculation, the function asks for new parameter values. If
the request is not cancelled, CITANKCONE calculates
COST and transmits it to the model.
This function is called by the UP_COST working mode of
the model library functions.
CITANKCONE is a new function of the version 3.0.

CITANKFLAT
Syntax

INTEGER FUNCTION CITANKFLAT (CAP, OPEN, RUBBER,


COST)
Allows the calculation of the cost of a tank with flat bottom.
Parameters

Type/Description

CAP

REAL*8 Tank capacity or volume


(m3).

OPEN

INTEGER Open (1) or closed (2) top.

RUBBER

INTEGER Uncoated (1), Natural


rubber (2) or Butyl rubber (3).

COST

REAL*8 Calculated cost ($CAN


1982) of one spiral.

Return value:
Returns 1.
Comments:
This function is called by a leaching tank model. If the cost
parameters CAP, OPEN and RUBBER are not known, their

USIM PAC

BRGM Software

102

FUNCTION REFERENCES

values must be initialized to 0. If the values of these


parameters equal 0 or are not within the range for cost
calculation, the function asks for new parameter values. If
the request is not cancelled, CITANKFLAT calculates
COST and transmits it to the model.
This function is called by the UP_COST working mode of
the model library functions.
CITANKFLAT is a new function of the version 3.0.

CITS
Syntax

INTEGER FUNCTION CITS (AREA, DECKA, DECKB, COST)


Allows the calculation of the cost of a shaking table.
Parameters

Type/Description

AREA

REAL*8 Deck area (m2).

DECKA

INTEGER Deck type: single (1)


double (2) or triple (3) deck.

DECKB

INTEGER Deck type: rectangular (1)


or diagonal (2) deck.

COST

REAL*8 Calculated cost ($CAN


1982) of one shaking table.

Return value:
Returns 1.
Comments:
This function is called by a shaking table model. If the cost
parameters AREA, DECKA or DECKB are not known, their
values must be initialized to 0. If the values of these
parameters equal 0 or are not within the range for cost
calculation, the function asks for new parameter values. If
the request is not cancelled, CITS calculates COST and
transmits it to the model.
This function is called by the UP_COST working mode of
the model library functions.

CISM
Syntax

INTEGER FUNCTION CISM (D, L, COST)


Allows the calculation of the cost of a magnetic separator.
Parameters

USIM PAC

Type/Description

REAL*8 Drum diameter (m).

REAL*8 Length (m).

BRGM Software

FUNCTION REFERENCES

COST

103

REAL*8 Calculated cost ($CAN


1982) of one shaking table.

Return value:
Returns 1.
Comments:
This function is called by a magnetic separator model. If the
cost parameters D or L are not known, their values must be
initialized to 0. If the values of these parameters equal 0 or
are not within the range for cost calculation, the function
asks for new parameter values. If the request is not
cancelled, CISM calculates COST and transmits it to the
model.
This function is called by the UP_COST working mode of
the model library functions.
CISM is a new function of the version 3.0.

CLASSNAME
Syntax

INTEGER FUNCTION CLASSNAME (NPHA, NCRIT, NCLASS,


NAME)
Receives the name of the class NCLASS of the criterion
type NCRIT of the phase NPHA into the variable NAME.
Parameters

Type/Description

NPHA

INTEGER Phase number.

NCRIT

INTEGER Criterion type: CRITSIZE,


CRITCOMP, CRITFLOT,
CRITSPFIXED1, CRITSPFIXED2 or
CRITSPFIXED3.

NCLASS

INTEGER Class index in the criterion


list (between 1 and the number of
classes given by NBCLASSCRIT).

NAME

CHARACTER*31 Character string


receiving the class name.

Return value:
The number of characters of the class name if success else
a negative integer.
Comments:
This function is called by the UP_MODEL working mode of
the model library functions.
CLASSNAME is a new function of the version 3.0.

COMPONENTNAME
Syntax

USIM PAC

INTEGER FUNCTION COMPONENTNAME (NPHA, NCOMP,


NAME)

BRGM Software

104

FUNCTION REFERENCES

Receives the name of the component NCOMP of the phase


NPHA into the variable NAME.
Parameters

Type/Description

NPHA

INTEGER Phase number.

NCOMP

INTEGER Component index


(between 1 and the number of
components given by
NBCLASSCRIT).

NAME

CHARACTER*31 Character string


receiving the component name.

Return value:
The number of characters of the component name if
success else a negative integer.
Comments:
If there is no composition criterion or if the component
index is not in the expected range, the return value is the
phase name.
This function is called by the UP_MODEL working mode of
the model library functions.
COMPONENTNAME is a new function of the version 3.0.

COPYPHA
Syntax

INTEGER FUNCTION COPYPHA (NOUTPUT, NPHA)


Copies the entire description of the phase of number NPHA
to the output stream NOUTPUT (output stream of a unit are
numbered 1, 2...).
Parameters

Type/Description

NOUTPUT

INTEGER Stream output number.

NPHA

INTEGER Phase number.

Return value:
0 if success else a negative integer.
Comments:
This function copies all description hierarchies of type
flowrate from the input stream (sum of all the input streams)
to an output stream. The hierarchies of other types are not
copied.
This function is called by the UP_MODEL working mode of
the model library functions.

CRUSHPOINF
Syntax

USIM PAC

SUBROUTINE CRUSHPOINF (NUMPAR)

BRGM Software

FUNCTION REFERENCES

105

Writes the power consumption of a crusher, calculated by


the function CRUSHPOWER, into the file POWER.INF from
the output model parameters.
Parameters
NUMPAR

Type/Description
INTEGER Index of the first
parameter of the parameter list for
power consumption calculation (see
comments of CRUSHPOWER).

Comments:
This function is called by the UP_POWER working mode of
the model library functions.
CRUSHPOINF is a new function of the version 3.0.

CRUSHPOWER
Syntax

SUBROUTINE CRUSHPOWER (NUMPAR, F80, P80, USEOPT)


Calculates the power consumption of a crusher from the
d80s of the feed (F80) and the product (P80) using the
Bond formula or the Magdalinovic formula. The power
consumption can be adjusted using experimental data.
Results are stored in output model parameters and written
in
the
file
CONV.INF
if
USEOPT
is
UP_MODEL_MESSAGE.
Parameters

Type/Description

NUMPAR

INTEGER Index of the first


parameter of the parameter list for
power consumption calculation (see
comments).

F80

REAL*8 (:) Array of feed d80 per


phase.

P80

REAL*8 (:) Array of product d80 per


phase.

USEOPT

INTEGER Allows to write results in


the CONV.INF file if its value is
UP_MODEL_MESSAGE.

Comments:
NUMPAR indicates the index of the first parameter of a
sub-list of 15 consecutive parameters into the model
parameter list:

USIM PAC

Work index per component (kWh/st)

Work index for the adjustment of Bond formula (kWh/st)

Flowrate for the adjustment of Bond formula (t/h)

D80 of product for the adjustment of Bond formula (mm)

BRGM Software

106

FUNCTION REFERENCES

D80 of feed for the adjustment of Bond formula (mm)

Power consumed for the adjustment of Bond formula


(kW)

Work index for the adjustment of Magdalinovic formula


(kWh/st)

Flowrate for the adjustment of Magdalinovic formula


(t/h)

D80 of product for the adjustment of Magdalinovic


formula (mm)

D80 of feed for the adjustment of Magdalinovic formula


(mm)

Power consumed for the adjustment of Magdalinovic


formula (kW)

Calculated power - Bond - without adjustment (kW)

Calculated power - Magdalinovic - without adjustment


(kW)

Calculated power - Bond - with adjustment (kW)

Calculated power - Magdalinovic - with adjustment (kW)

See the description of the "Model 131 - Crusher from


database" in the part C for more details about the
calculation of the power consumption for a crusher.
This function is called by the UP_MODEL working mode of
the model library functions.
CRUSHPOWER is a new function of the version 3.0.

CUMFLOWPASSDX
Syntax

INTEGER
FUNCTION
CUMFLOWPASSDX
NBCOMP, NCOMP, SIZE, PARFLOW, DX, FLOW)

(NBCLASS,

Calculates the flowrate FLOW of particles smaller than DX.


FLOW is calculated from the partial flowrates of
components per size class PARFLOW and the upper
bound sizes SIZE for the component number NCOMP. If
NCOMP equals 0, FLOW is calculated for the whole phase.
There are NBCLASS size classes and NBCOMP
components.
Calculation of FLOW is made by linear interpolation.
Parameters

USIM PAC

Type/Description

NBCLASS

INTEGER Number of size classes.

NBCOMP

INTEGER Number of components.

NCOMP

INTEGER Component number for


which the flowrate is calculated or 0
for the whole phase.

BRGM Software

FUNCTION REFERENCES

107

SIZE

REAL*8 Upper bound array of size


classes.

PARFLOW

REAL*8 Partial flowrate array of


components per size class.

DX

REAL*8 Size below which there is a


flowrate FLOW of the component.

FLOW

REAL*8 Flowrate of particles finer


than DX.

Return value:
0 if success else a negative integer.
Comments:
This function is called by the UP_MODEL working mode of
the model library functions.

DXGAUDINTERP
Syntax

INTEGER FUNCTION DXGAUDINTERP (NBCLASS, NBCOMP,


NCOMP, SIZE, PARFLOW, XPASS, DX)
Calculates the size DX below which there is XPASS %passing. DX is calculated from the partial flowrates of
components per size class PARFLOW and the upper
bound sizes SIZE for the component number NCOMP. If
NCOMP equals 0, DX is calculated for the whole phase.
There is NBCLASS size classes and NBCOMP
components.
Calculation of DX is made by Gaudin-Schuhmann
interpolation and it is supplied in the upper bound size unit.
Parameters

Type/Description

NBCLASS

INTEGER Number of size classes.

NBCOMP

INTEGER Number of components.

NCOMP

INTEGER Component number for


which the %-passing is calculated or
0 for the whole phase.

SIZE

REAL*8 Upper bound array of size


classes.

PARFLOW

REAL*8 Partial flowrate array of


components per size class.

XPASS

REAL*8 Cumulative %-passing of


the ore.

DX

REAL*8 Size below which there is


XPASS % of the ore.

Return value:
0 if success else a negative integer.

USIM PAC

BRGM Software

108

FUNCTION REFERENCES

Comments:
This function is called by the UP_MODEL working mode of
the model library functions.

DXLOGINTERP
Syntax

INTEGER FUNCTION DXLOGINTERP (NBCLASS, NBCOMP,


NCOMP, SIZE, PARFLOW, XPASS, DX)
Calculates the size DX below which there is XPASS %passing. DX is calculated from the partial flowrates of
components per size class PARFLOW and the upper
bound sizes SIZE for the component number NCOMP. If
NCOMP equals 0, DX is calculated for the whole phase.
There is NBCLASS size classes and NBCOMP
components.
Calculation of DX is made by a logarithmic interpolation
and it is supplied in the upper bound size unit.
Parameters

Type/Description

NBCLASS

INTEGER Number of size classes.

NBCOMP

INTEGER Number of components.

NCOMP

INTEGER Component number for


which the %-passing is calculated or
0 for the whole phase.

SIZE

REAL*8 Upper bound array of size


classes.

PARFLOW

REAL*8 Partial flowrate array of


components per size class.

XPASS

REAL*8 Cumulative %-passing of


the ore.

DX

REAL*8 Size below which there is


XPASS % of the ore.

Return value:
0 if success else a negative integer.
Comments:
This function is called by the UP_MODEL working mode of
the model library functions.

FLOATINGNAME
Syntax

INTEGER
NAME)

FUNCTION

FLOATINGNAME

(NPHA,

NFLOAT,

Receives the name of the floatability sub-population


NFLOAT of the phase NPHA into the variable NAME.

USIM PAC

BRGM Software

FUNCTION REFERENCES

109

Parameters

Type/Description

NPHA

INTEGER Phase number.

NFLOAT

INTEGER Floatability sub-population


index (between 1 and the number of
components given by
NBCLASSCRIT).

NAME

CHARACTER*31 Character string


receiving the floatability subpopulation name.

Return value:
The number of characters of the floatability sub-population
name if success else a negative integer.
Comments:
This function is called by the UP_MODEL working mode of
the model library functions.
FLOATINGNAME is a new function of the version 3.0.

GDBLTOSTR
Syntax

SUBROUTINE GDBLTOSTR (X, STR, FORM)


Converts the real value X into a character string STR
following the C format FORM. This conversion is used for
real value displaying in the files CONV.INF or POWER.INF
Parameters

Type/Description

REAL*8 real to be converted.

STR

CHARACTER*255 Character string


receiving the converted text.

FORM

CHARACTER*15 Conversion format


following C rules (see comments).

Comments:
The C format for real conversion is:
%[flags] [width] [.precision] type

USIM PAC

type is one of the following letter:


e

Signed value having the form []d.dddd e


[sign]ddd where d is a single decimal digit, dddd is
one or more decimal digits, ddd is exactly three
decimal digits, and sign is + or

Identical to the e format except that E rather than e


introduces the exponent.

Signed value having the form []dddd.dddd, where


dddd is one or more decimal digits. The number of
digits before the decimal point depends on the
magnitude of the number, and the number of digits

BRGM Software

110

FUNCTION REFERENCES

after the decimal point depends on the requested


precision.

Signed value printed in f or e format, whichever is


more compact for the given value and precision.
The e format is used only when the exponent of
the value is less than 4 or greater than or equal
to the precision argument. Trailing zeros are
truncated, and the decimal point appears only if
one or more digits follow it.

Identical to the g format, except that E, rather than


e, introduces the exponent (where appropriate).

flag is one of the following symbol:

Left align the result within the given field width.

Prefix the output value with a sign (+ or ) if the


output value is of a signed type.

If width is prefixed with 0, zeros are added until the


minimum width is reached. If 0 and appear, the 0
is ignored.

blank (' ') Prefix the output value with a blank if the
output value is signed and positive; the blank is
ignored if both the blank and + flags appear.
#

When used with the e, E, f, g or G format, the #


flag forces the output value to contain a decimal
point in all cases. In addition, when used with the g
or G format, the # flag prevents the truncation of
trailing zeros.

width
Optional number that specifies the minimum
number of characters output

precision specifies the maximum number of significant


digits printed.

If the format doesnt follow these rules, the STR string


contains FORM.
The real formatting can be made also through the
MESSMODELREAL function.
This function is called by the UP_MODEL or UP_POWER
working mode of the model library functions.
GDBLTOSTR is a new function of the version 3.0.

GET0DHIER
Syntax

INTEGER FUNCTION
HIERTYP, VALUE)

GET0DHIER

(NSTREAM,

NPHA,

Receives the VALUE of a 0-dimensional hierarchy of type


HIERTYP from the phase NPHA of the stream NSTREAM.

USIM PAC

BRGM Software

FUNCTION REFERENCES

Parameters

111

Type/Description

NSTREAM

INTEGER Stream number. If 0, the


stream is the sum of input streams.

NPHA

INTEGER Phase number.

HIERTYP

INTEGER Hierarchy type with value


TYPFLOW or TYPDENS.

VALUE

REAL*8 The value of the 0dimensional hierarchy.

Return value:
A positive or null value if the function is successful.
Otherwise negative value.
Comments:
This function is called by the UP_MODEL working mode of
the model library functions.

GET1DHIER
Syntax

INTEGER FUNCTION GET1DHIER


HIERTYP, CRITYP, NBCLASS, VALUE)

(NSTREAM,

NPHA,

Receives the value array VALUE of a 1-dimensional


hierarchy of type HIERTYP from phase number NPHA of
stream NSTREAM. The 1-dimensional hierarchy contains
the criterion of type CRITYP with NBCLASS classes.
Parameters

Type/Description

NSTREAM

INTEGER Stream number. If 0, the


stream is the sum of input streams.

NPHA

INTEGER Phase number.

HIERTYP

INTEGER Hierarchy type with value


TYPFLOW or TYPDENS.

CRITYP

INTEGER Criterion type: CRITSIZE,


CRITCOMP, CRITFLOT,
CRITSPFIXED1, CRITSPFIXED2 or
CRITSPFIXED3.

NBCLASS

INTEGER Number of classes in the


criterion of type CRITYP.

VALUE

REAL*8 The value array of the 1dimensional hierarchy. This array


must be declared or allocated with
the sufficient number of elements
(NBCLASS).

Return value:
A positive or null value if the function is successful.
Otherwise negative value.

USIM PAC

BRGM Software

112

FUNCTION REFERENCES

Comments:
This function is called by the UP_MODEL working mode of
the model library functions.

GET2DHIER
Syntax

INTEGER FUNCTION GET2DHIER (NSTREAM, NPHA,


HIERTYP, CRITYP1, NBCLASS1, CRITYP2, NBCLASS2, VALUE)
Receives the value array VALUE of a 2-dimensional
hierarchy of type HIERTYP from phase number NPHA of
stream NSTREAM. The 2-dimensional hierarchy contains
the criteria of type CRITYP1 and CRITYP2 with
NBCLASS1 and NBCLASS2 classes respectively.
Parameters

Type/Description

NSTREAM

INTEGER Stream number. If 0, the


stream is the sum of input streams.

NPHA

INTEGER Phase number.

HIERTYP

INTEGER Hierarchy type with value


TYPFLOW or TYPDENS.

CRITYP1

INTEGER First criterion type:


CRITSIZE, CRITCOMP, CRITFLOT,
CRITSPFIXED1, CRITSPFIXED2 or
CRITSPFIXED3.

NBCLASS1

INTEGER Number of classes in the


first criterion of type CRITYP1.

CRITYP2

INTEGER Second criterion type:


CRITSIZE, CRITCOMP, CRITFLOT,
CRITSPFIXED1, CRITSPFIXED2 or
CRITSPFIXED3.

NBCLASS2

INTEGER Number of classes in the


second criterion of type CRITYP2.

VALUE

REAL*8 The value array of the 2dimensional hierarchy. This 2dimensional array must be declared
or allocated with the sufficient
number of elements (NBCLASS1
NBCLASS2).

Return value:
A positive or null value if the function is successful.
Otherwise negative value.
Comments:
This function is called by the UP_MODEL working mode of
the model library functions.

USIM PAC

BRGM Software

FUNCTION REFERENCES

113

GETBOOLFORCOST
Syntax

INTEGER FUNCTION GETBOOLFORCOST (STR, NUM, RES)


Calls an alternative interface:

This dialog box has a title ("My model") and a question ("Do
you want a pump?"). Both texts are registered in file
MESSAGES.TXT:

[MyModel]
1=My model
2=What is the pressure drop?
3=Do you want a pump?
4=How many pumps do you want?

The string STR contains the tag text "MyModel". The title is
always registered with key 1. The question is registered
with key NUM. The response RES is 1 if Yes button is
pressed and 0 otherwise.
If the No cost calculation button is pressed, the return
value is 0 else it is 1.
For the example above, the function call is:
STR = 'MyModel' C
OK = GETBOOLFORCOST (STR, 3, RES)
Parameters

Type/Description

STR

CHARACTER*51 Tag text in file


MESSAGES.TXT.

NUM

INTEGER Key number containing


the question.

RES

INTEGER Response value: 1 if the


Yes button is pressed else 0.

Return value:
0 if the No cost calculation button is pressed else 1.
Comments:

USIM PAC

BRGM Software

114

FUNCTION REFERENCES

For more information about the use of file MESSAGE.TXT,


see part B.
This function is called by the UP_COST working mode of
the model library functions.

GETCOMPDENSITY
Syntax

INTEGER FUNCTION GETCOMPDENSITY (NPHA, NBCOMP,


VALUE)
Receives the component density array VALUE from phase
number NPHA. The number of components is NBCOMP.
Parameters

Type/Description

NPHA

INTEGER Phase number.

NBCOMP

INTEGER Number of components.

VALUE

REAL*8 The component density


array. This array must be declared or
allocated with the sufficient number of
elements (NBCOMP).

Return value:
A positive or null value if the function is successful.
Otherwise negative value.
Comments:
If there is not density per component, the phase density is
duplicated for all components.
This function is called by the UP_MODEL working mode of
the model library functions.

GETCOMPLHV
Syntax

INTEGER
VALUE)

FUNCTION

GETCOMPLHV

(NPHA,

NBCOMP,

Receives the component low heating value array VALUE


from phase number NPHA. The number of components is
NBCOMP.
Parameters

Type/Description

NPHA

INTEGER Phase number.

NBCOMP

INTEGER Number of components.

VALUE

REAL*8 The component low heating


value array. This array must be
declared or allocated with the
sufficient number of elements
(NBCOMP).

Return value:

USIM PAC

BRGM Software

FUNCTION REFERENCES

115

A positive or null value if the function is successful.


Otherwise negative value.
Comments:
If there is not low heating value per component, the phase
low heating value is duplicated for all components.
This function is called by the UP_MODEL working mode of
the model library functions.
GETCOMPLHV is a new function of the version 3.0.

GETDATACRUSH
Syntax

INTEGER
FUNCTION
GETDATACRUSH
(FILENAME,
NCRUSHER, NBSET, NBCLAS, NBSIZERANGE, SETTING,
PASSING, SIZECLASS, MIN, MAX, CAPACITY)
Receives the data set corresponding to the crusher
NCRUSHER from the crusher database (file FILENAME).
NBSET, NBCLAS and NBSIZERANGE are given by
GETNBCRUSH.
Parameters

USIM PAC

Type/Description

FILENAME

CHARACTER*1024 File name of the


crusher database.

NCRUSHER

INTEGER Crusher number in the


crusher database.

NBSET

INTEGER Number of settings.

NBCLAS

INTEGER Number of passing %.

NBSIZERANGE

INTEGER Number of feed size


ranges for capacity.

SETTING

REAL*8 The exit setting array in


mm. This array must be declared or
allocated with the sufficient number of
elements (NBSET).

PASSING

REAL*8 The passing percent array.


This array must be declared or
allocated with the sufficient number of
elements (NBCLAS).

SIZECLASS

REAL*8 The passing size class


array. This 2-dimensional array must
be declared or allocated with the
sufficient number of elements
(NBCLASS NBSET).

MIN

REAL*8 The lower bound capacity


array. This array must be declared or
allocated with the sufficient number of
elements (NBSIZERANGE).

BRGM Software

116

FUNCTION REFERENCES

MAX

REAL*8 The upper bound capacity


array. This array must be declared or
allocated with the sufficient number of
elements (NBSIZERANGE).

CAPACITY

REAL*8 The capacity array. This 2dimensional array must be declared


or allocated with the sufficient
number of elements (NBSET
NBSIZERANGE).

Return value:
1 if the function is successful. Otherwise 0.
Comments:
See the part D for more information about the crusher
database.
This function is called by the UP_MODEL working mode of
the model library functions.
The parameter list of the function GETDATACRUSH has
been changed in the version 3.0 compared to the version
2.1.

GETDENSANDVOLFLOWPERCOMP
Syntax

INTEGER
FUNCTION
GETDENSANDVOLFLOWPERCOMP
(NSTREAM, NPHA, NBCOMP, DENS, VFLOW)
Receives the density array DENS and the volumetric
flowrate array VFLOW for components of the phase
number NPHA in the stream NSTREAM. The number of
components is NBCOMP.
Parameters

Type/Description

NSTREAM

INTEGER Stream number. If 0, the


stream is the sum of the input
streams.

NPHA

INTEGER Phase number.

NBCOMP

INTEGER Number of components.

DENS

REAL*8 The component density


array. This array must be declared or
allocated with the sufficient number of
elements (NBCOMP).

VFLOW

REAL*8 The component volumetric


flowrate array. This array must be
declared or allocated with the
sufficient number of elements
(NBCOMP).

Return value:

USIM PAC

BRGM Software

FUNCTION REFERENCES

117

A positive or null value if the function is successful.


Otherwise negative value.
Comments:
This function is called by the UP_MODEL working mode of
the model library functions.
GETDENSANDVOLFLOWPERCOMP is a new function of
the version 3.0.

GETFLOATPROP
Syntax

INTEGER FUNCTION GETFLOATPROP (NSTREAM, NPHA,


NBCOMP, NOFLO, SLOWFLO, FASTFLO)
Receives the three arrays of the component proportions in
the floating ability sub-populations: no floating, slow floating
and fast floating, from phase number NPHA of stream
NSTREAM. The three arrays are respectively NOFLO,
SLOWFLO and FASTFLO. The number of components is
NBCOMP.
Parameters

Type/Description

NSTREAM

INTEGER Stream number. If 0, the


stream is the sum of the input
streams.

NPHA

INTEGER Phase number.

NBCOMP

INTEGER Number of components.

NOFLO

REAL*8 The component proportion


array of no floating components. This
array must be declared or allocated
with the sufficient number of
elements (NBCOMP).

SLOWFLO

REAL*8 The component proportion


array of slow floating components.
This array must be declared or
allocated with the sufficient number of
elements (NBCOMP).

FASTFLO

REAL*8 The component proportion


array of fast floating components.
This array must be declared or
allocated with the sufficient number of
elements (NBCOMP).

Return value:
A positive or null value if the function is successful.
Otherwise negative value.
Comments:
This function is called by the UP_MODEL working mode of
the model library functions.

USIM PAC

BRGM Software

118

FUNCTION REFERENCES

GETFLOWPERCOMPFIXEDSP
Syntax

INTEGER
FUNCTION
GETFLOWPERCOMPFIXEDSP
(NSTREAM, NPHA, NCRIT, NBCOMP, NBSP, VALUE)
Receives the partial flowrate array VALUE of the userdefined sub-population per components from phase
number NPHAN of stream NSTREAM. The user-defined
sub-population choice is given by NCRIT. The number of
components is NBCOMP and the number of subpopulations is NBSP.
Parameters

Type/Description

NSTREAM

INTEGER Stream number. If 0, the


stream is the sum of the input
streams.

NPHA

INTEGER Phase number.

NCRIT

INTEGER Criterion number of the


user-defined sub-population:
CRITFIXEDSP1, CRITFIXEDSP2 or
CRITFIXEDSP3.

NBCOMP

INTEGER Number of components.

NBSP

INTEGER Number of user-defined


sub-populations.

VALUE

REAL*8 The partial flowrate array of


the components per size classes.
This 2-dimensional array must be
declared or allocated with the
sufficient number of elements
(NBCOMP NBSP).

Return value:
A positive or null value if the function is successful.
Otherwise negative value.
Comments:
This function is called by the UP_MODEL working mode of
the model library functions.
GETFLOWPERCOMPFIXEDSP is a new function of the
version 3.0.

GETFLOWPERSIZECOMP
Syntax

INTEGER FUNCTION GETFLOWPERSIZECOMP (NSTREAM,


NPHA, NBCLASS, NBCOMP, VALUE)
Receives the partial flowrate array VALUE of the
components per size classes from phase number NPHAN
of stream NSTREAM. The number of size classes is
NBCLASS and the number of components is NBCOMP.

USIM PAC

BRGM Software

FUNCTION REFERENCES

Parameters

119

Type/Description

NSTREAM

INTEGER Stream number. If 0, the


stream is the sum of the input
streams.

NPHA

INTEGER Phase number.

NBCLASS

INTEGER Number of size classes.

NBCOMP

INTEGER Number of components.

VALUE

REAL*8 The partial flowrate array of


the components per size classes.
This 2-dimensional array must be
declared or allocated with the
sufficient number of elements
(NBCLASS NBCOMP).

Return value:
A positive or null value if the function is successful.
Otherwise negative value.
Comments:
This function is called by the UP_MODEL working mode of
the model library functions.

GETFLOWRATE
Syntax

INTEGER FUNCTION GETFLOWRATE (NSTREAM, NPHA,


VALUE)
Receives the global flowrate VALUE from phase number
NPHAN of stream NSTREAM.
Parameters

Type/Description

NSTREAM

INTEGER Stream number. If 0, the


stream is the sum of the input
streams.

NPHA

INTEGER Phase number.

VALUE

REAL*8 The value of the global


flowrate.

Return value:
A positive or null value if the function is successful.
Otherwise negative value.
Comments:
This function is called by the UP_MODEL working mode of
the model library functions.

GETFLOWRATEPERCOMP
Syntax

USIM PAC

INTEGER FUNCTION GETFLOWRATEPERCOMP (NSTREAM,


NPHA, NBCOMP, VALUE)

BRGM Software

120

FUNCTION REFERENCES

Receives the partial flowrate array VALUE of the


components from phase number NPHA of stream
NSTREAM. The number of components is NBCOMP.
Parameters

Type/Description

NSTREAM

INTEGER Stream number. If 0, the


stream is the sum of the input
streams.

NPHA

INTEGER Phase number.

NBCOMP

INTEGER Number of components.

VALUE

REAL*8 The partial flowrate array of


the components. This array must be
declared or allocated with the
sufficient number of elements
(NBCOMP).

Return value:
A positive or null value if the function is successful.
Otherwise negative value.
Comments:
This function is called by the UP_MODEL working mode of
the model library functions.

GETFLOWRATEPERFIXEDSP
Syntax

INTEGER
FUNCTION
GETFLOWRATEPERFIXEDSP
(NSTREAM, NPHA, NCRIT, NBSP, VALUE)
Receives the partial flowrate array VALUE of the userdefined sub-populations from phase number NPHAN of
stream NSTREAM. The user-defined sub-population choice
is given by NCRIT. The number of sub-populations is
NBSP.
Parameters

USIM PAC

Type/Description

NSTREAM

INTEGER Stream number. If 0, the


stream is the sum of the input
streams.

NPHA

INTEGER Phase number.

NCRIT

INTEGER Criterion number of the


user-defined sub-population:
CRITFIXEDSP1, CRITFIXEDSP2 or
CRITFIXEDSP3.

NBSP

INTEGER Number of user-defined


sub-populations.

VALUE

REAL*8 The partial flowrate array of


the components per size classes.
This array must be declared or

BRGM Software

FUNCTION REFERENCES

121

allocated with the sufficient number of


elements (NBSP).
Return value:
A positive or null value if the function is successful.
Otherwise negative value.
Comments:
This function is called by the UP_MODEL working mode of
the model library functions.
GETFLOWRATEPERFIXEDSP is a new function of the
version 3.0.

GETFLOWRATEPERSIZE
Syntax

INTEGER FUNCTION GETFLOWRATEPERSIZE (NSTREAM,


NPHA, NBCLASS, VALUE)
Receives the partial flowrate array VALUE of the size
classes from phase number NPHA of stream NSTREAM.
The number of size classes is NBCLASS.
Parameters

Type/Description

NSTREAM

INTEGER Stream number. If 0, the


stream is the sum of the input
streams.

NPHA

INTEGER Phase number.

NBCLASS

INTEGER Number of size classes.

VALUE

REAL*8 The partial flowrate array of


the size classes. This array must be
declared or allocated with the
sufficient number of elements
(NBCLASS).

Return value:
A positive or null value if the function is successful.
Otherwise negative value.
Comments:
This function is called by the UP_MODEL working mode of
the model library functions.

GETINTFORCOST
Syntax

INTEGER FUNCTION GETINTFORCOST (STR, NUM, NB,


NBMIN, NBMAX)
Calls an integer input interface:

USIM PAC

BRGM Software

122

FUNCTION REFERENCES

This dialog box has a title ("My model") and a question


("How many pumps do you want?"). Both texts are
registered in the file MESSAGES.TXT:

[MyModel]
1=My model
2=What is the pressure drop?
3=Do you want a pump?
4=How many pumps do you want?

The string STR contains the tag text "MyModel". The title is
always registered with key 1. The question is registered
with the NUM. The input integer NB is in the range NBMIN
to NBMAX.
If the No cost calculation button is pressed, the return
value is 0 else it is 1.
For the example above, the function call is:
STR = 'MyModel' C
OK = GETINTFORCOST (STR, 4, NB, 1, 5)
Parameters

Type/Description

STR

CHARACTER*51 Tag text in file


MESSAGES.TXT.

NUM

INTEGER Key number containing


the question.

NB

INTEGER Value of the input integer.

NBMIN

INTEGER Minimum value authorized


for the input integer.

NBMAX

INTEGER Maximum value


authorized for the input integer.

Return value:
0 if the No cost calculation button was pressed else 1.
Comments:

USIM PAC

BRGM Software

FUNCTION REFERENCES

123

For more information about


MESSAGES.TXT, see part B.

the

use

of

file

This function is called by the UP_COST working mode of


the model library functions.

GETLIQFLOWRATE
Syntax

INTEGER FUNCTION GETLIQFLOWRATE (NSTREAM, VALUE)


Receives the global liquid flowrate VALUE from the liquid
phases of stream NSTREAM. The global liquid flowrate is
the sum of the global flowrates of each liquid phase.
Parameters

Type/Description

NSTREAM

INTEGER Stream number. If 0, the


stream is the sum of the input
streams.

VALUE

REAL*8 The value of the global


liquid flowrate.

Return value:
A positive or null value if the function is successful.
Otherwise negative value.
Comments:
This function is called by the UP_MODEL working mode of
the model library functions.

GETLIQVOLFLOW
Syntax

INTEGER FUNCTION GETLIQVOLFLOW (NSTREAM, VALUE)


Receives the global liquid volumetric flowrate VALUE from
the liquid phases of stream NSTREAM. The global liquid
volumetric flowrate is the sum of the global volumetric
flowrates of each liquid phase.
Parameters

Type/Description

NSTREAM

INTEGER Stream number. If 0, the


stream is the sum of the input
streams.

VALUE

REAL*8 The value of the global


liquid volumetric flowrate.

Return value:
A positive or null value if the function is successful.
Otherwise negative value.
Comments:
This function is called by the UP_MODEL working mode of
the model library functions.

USIM PAC

BRGM Software

124

FUNCTION REFERENCES

GETMOLECULARMASS
Syntax

INTEGER
FUNCTION
NBCOMP, VALUE)

GETMOLECULARMASS

(NPHA,

Receives the component molecular mass array VALUE


from phase number NPHA. The number of components is
NBCOMP.
Parameters

Type/Description

NPHA

INTEGER Phase number.

NBCOMP

INTEGER Number of components.

VALUE

REAL*8 The component molecular


mass array. This array must be
declared or allocated with the
sufficient number of elements
(NBCOMP).

Return value:
A positive or null value if the function is successful.
Otherwise negative value.
Comments:
This function is called by the UP_MODEL working mode of
the model library functions.
GETMOLECULARMASS is a new function of the version
3.0.

GETNAMECRUSH
Syntax

INTEGER
FUNCTION
GETNAMECRUSH
NCRUSHER, CRUSHNAME)

(FILENAME,

Receives the name of the crusher NCRUSHER from the


crusher database (file FILENAME) into the character string
CRUSHNAME.
Parameters

Type/Description

FILENAME

CHARACTER*1024 File name of the


crusher database.

NCRUSHER

INTEGER Crusher number in the


crusher database.

CRUSHNAME

CHARACTER*256 Crusher name.

Return value:
1 if the function is successful. Otherwise 0.
Comments:
This function is called by the UP_MODEL working mode of

USIM PAC

BRGM Software

FUNCTION REFERENCES

125

the model library functions.


GETNAMECRUSH is a new function of the version 3.0.

GETNBCRUSH
Syntax

INTEGER FUNCTION GETNBCRUSH (FILENAME, NCRUSHER,


NBSET, NBCLAS, NBSIZERANGE)
Receives the dimensions of the data set corresponding to
the crusher NCRUSHER from the crusher database (file
FILENAME). NBSET, NBCLAS and NBSIZERANGE are
used by GETDATACRUSH.
Parameters

Type/Description

FILENAME

CHARACTER*1024 File name of the


crusher database.

NCRUSHER

INTEGER Crusher number in the


crusher database.

NBSET

INTEGER Number of settings.

NBCLAS

INTEGER Number of passing %.

NBSIZERANGE

INTEGER Number of feed size


ranges for capacity.

Return value:
1 if the function is successful. Otherwise 0.
Comments:
This function is called by the UP_MODEL working mode of
the model library functions.
The parameter list of the function GETNBCRUSH has been
changed in the version 3.0 compared to the version 2.1.

GETNBFLUXIN
Syntax

INTEGER FUNCTION GETNBFLUXIN ()


Gives the number of input streams of the current unit of
equipment.

Return value:
The number of input streams.
Comments:
This function is called by the UP_MODEL working mode of
the model library functions.

GETNUMFLUX
Syntax

USIM PAC

INTEGER FUNCTION GETNUMFLUX (NOUTPUT)

BRGM Software

126

FUNCTION REFERENCES

Gives the stream number in the flowsheet of the output of


number NOUTPUT of the current unit of equipment.
Parameters

Type/Description

NOUTPUT

INTEGER Stream output number.

Return value:
The stream number or a negative value if the stream output
number is not valid.
Comments:
This function is called by the UP_MODEL working mode of
the model library functions.

GETNUMFLUXIN
Syntax

INTEGER FUNCTION GETNUMFLUXIN (NINPUT)


Gives the stream number in the flowsheet of the NINPUTth
input stream of the current unit of equipment.
Parameters

Type/Description

NINPUT

INTEGER Stream input order


number.

Return value:
The stream number or CE_NOFLUX if the order number of
the stream input is not valid.
Comments:
This function is called by the UP_MODEL working mode of
the model library functions.

GETOREFLOWRATE
Syntax

INTEGER
VALUE)

FUNCTION

GETOREFLOWRATE

(NSTREAM,

Receives the global flowrate VALUE from the ore phases of


stream NSTREAM. The global flowrate is the sum of the
global flowrates of each ore phase.
Parameters

Type/Description

NSTREAM

INTEGER Stream number. If 0, the


stream is the sum of the input
streams.

VALUE

REAL*8 The value of the global


flowrate.

Return value:

USIM PAC

BRGM Software

FUNCTION REFERENCES

127

A positive or null value if the function is successful.


Otherwise negative value.
Comments:
This function is called by the UP_MODEL working mode of
the model library functions.

GETORESOLFLOWRATE
Syntax

INTEGER FUNCTION GETORESOLFLOWRATE (NSTREAM,


VALUE)
Receives the global flowrate VALUE from the ore and solid
phases of stream NSTREAM. The global flowrate is the
sum of the global flowrates of the ore and solids phases.
Parameters

Type/Description

NSTREAM

INTEGER Stream number. If 0, the


stream is the sum of the input
streams.

VALUE

REAL*8 The value of the global


flowrate.

Return value:
A positive or null value if the function is successful.
Otherwise negative value.
Comments:
This function is called by the UP_MODEL working mode of
the model library functions.

GETORESOLVOLFLOW
Syntax

INTEGER
VALUE)

FUNCTION

GETORESOLVOLFLOW

(NSTREAM,

Receives the global volumetric flowrate VALUE from the


ore and solid phases of stream NSTREAM. The global
volumetric flowrate is the sum of the global volumetric
flowrates of the ore and solid phases.
Parameters

Type/Description

NSTREAM

INTEGER Stream number. If 0, the


stream is the sum of the input
streams.

VALUE

REAL*8 The value of the global


volumetric flowrate.

Return value:
A positive or null value if the function is successful.
Otherwise negative value.

USIM PAC

BRGM Software

128

FUNCTION REFERENCES

Comments:
This function is called by the UP_MODEL working mode of
the model library functions.

GETPARAM
Syntax

INTEGER FUNCTION GETPARAM (NPAR, VALUE)


Receives the VALUE of a simple model parameter of
number NPAR.
Parameters

Type/Description

NPAR

INTEGER Simple model parameter


number.

VALUE

REAL*8 Value of the model


parameter.

Return value:
0 if success else a negative integer.
Comments:
This function is called by the UP_MODEL working mode of
the model library functions.

GETPARAMDUPLI1CRIT
Syntax

INTEGER FUNCTION GETPARAMDUPLI1CRIT (NPHA, NPAR,


VALUE)
Receives the array of values VALUE of the duplications
relative to the phase NPHA of the multiple model parameter
number NPAR. The duplicated parameter has been defined
using the function SETPARAMDUPLI1CRIT.
Parameters

Type/Description

NPHA

INTEGER Phase number.

NPAR

INTEGER Multiple model parameter


number.

VALUE

REAL*8 Array of values of the


duplications of the multiple model
parameter. This array must be
declared or allocated with the
sufficient number of elements which
is the number of classes in the
associated criterion.

Return value:
0 if success else a negative integer.
Comments:

USIM PAC

BRGM Software

FUNCTION REFERENCES

129

This function is called by the UP_MODEL working mode of


the model library functions.
GETPARAMDUPLI1CRIT is a new function of the version
3.0 and replace the obsolete function GETPARAMDUPLI.

GETPARAMDUPLI2CRIT
Syntax

INTEGER FUNCTION GETPARAMDUPLI2CRIT (NPHA, NPAR,


VALUE)
Receives the array of values VALUE of the duplications
relative to the phase NPHA of the multiple model parameter
number NPAR. The duplicated parameter has been defined
using the function SETPARAMDUPLI2CRIT.
Parameters

Type/Description

NPHA

INTEGER Phase number.

NPAR

INTEGER Multiple model parameter


number.

VALUE

REAL*8 Array of values of the


duplications of the multiple model
parameter. This 2-dimensional array
must be declared or allocated with
the sufficient number of elements
which is the product of the numbers
of classes in the two associated
criteria.

Return value:
0 if success else a negative integer.
Comments:
This function is called by the UP_MODEL working mode of
the model library functions.
GETPARAMDUPLI2CRIT is a new function of the version
3.0 and replace the obsolete function GETPARAMDUPLI.

GETPARAMDUPLI2PHA
Syntax

INTEGER FUNCTION GETPARAMDUPLI2PHA (NPHA1, NPHA2,


NPAR, VALUE)
Receives the array of values VALUE of the duplications
relative to the phases of number NPHA1 and NPHA2 of the
multiple parameter number NPAR. The duplicated
parameter has been defined using the function
SETPARAMDUPLI2PHA.
Parameters
NPHA1

USIM PAC

Type/Description
INTEGER First phase number.

BRGM Software

130

FUNCTION REFERENCES

NPHA2

INTEGER Second phase number.

NPAR

INTEGER Multiple model parameter


number.

VALUE

REAL*8 Array of values of the


duplications of the multiple model
parameter. This 2-dimensional array
must be declared or allocated with
the sufficient number of elements
which is the product of the numbers
of classes in the two associated
criteria of the two phases.

Return value:
0 if success else a negative integer.
Comments:
This function is called by the UP_MODEL working mode of
the model library functions.

GETPARAMDUPLIPARAM
Syntax

INTEGER
VALUE)

FUNCTION

GETPARAMDUPLIPARAM

(NPAR,

Receives the array of values VALUE of the duplications of


the multiple model parameter number NPAR. The
duplicated parameter has been defined using the function
SETPARAMDUPLIPARAM.
Parameters

Type/Description

NPAR

INTEGER Multiple model parameter


number.

VALUE

REAL*8 Array of values of the


duplications of the multiple model
parameter. This array must be
declared or allocated with the
sufficient number of elements which
is the value of the associated
parameter.

Return value:
0 if success else a negative integer.
Comments:
This function is called by the UP_MODEL working mode of
the model library functions.
GETPARAMDUPLIPARAM is a new function of the version
3.0

USIM PAC

BRGM Software

FUNCTION REFERENCES

131

GETPARAMDUPLIPARAM1CRIT
Syntax

INTEGER FUNCTION GETPARAMDUPLIPARAM1CRIT (NPHA,


NPAR, VALUE)
Receives the array of values VALUE of the duplications
relative to the phase NPHA of the multiple model parameter
number NPAR. The duplicated parameter has been defined
using the function SETPARAMDUPLIPARAM1CRIT.
Parameters

Type/Description

NPHA

INTEGER Phase number.

NPAR

INTEGER Multiple model parameter


number.

VALUE

REAL*8 Array of values of the


duplications of the multiple model
parameter. This array must be
declared or allocated with the
sufficient number of elements which
is product of the value of the
associated parameter and the
number of classes in the associated
criterion.

Return value:
0 if success else a negative integer.
Comments:
This function is called by the UP_MODEL working mode of
the model library functions.
GETPARAMDUPLIPARAM1CRIT is a new function of the
version 3.0

GETPARAMDUPLIPARAMPHASE
Syntax

INTEGER FUNCTION GETPARAMDUPLIPARAMPHASE (NPHA,


NPAR, VALUE)
Receives the array of values VALUE of the duplications
relative to the phase NPHA of the multiple model parameter
number NPAR. The duplicated parameter has been defined
using the function SETPARAMDUPLIPARAMPHASE.
Parameters

USIM PAC

Type/Description

NPHA

INTEGER Phase number.

NPAR

INTEGER Multiple model parameter


number.

VALUE

REAL*8 Array of values of the


duplications of the multiple model

BRGM Software

132

FUNCTION REFERENCES

parameter. This array must be


declared or allocated with the
sufficient number of elements which
is the value of the associated
parameter.
Return value:
0 if success else a negative integer.
Comments:
This function is called by the UP_MODEL working mode of
the model library functions.
GETPARAMDUPLIPARAMPHASE is a new function of the
version 3.0

GETPARAMDUPLIPHASE
Syntax

INTEGER FUNCTION GETPARAMDUPLIPHASE (NPHA, NPAR,


VALUE)
Receives the VALUE of the duplication relative to the
phase NPHA of the multiple model parameter number
NPAR. The duplicated parameter has been defined using
the function SETPARAMDUPLIPHASE.
Parameters

Type/Description

NPHA

INTEGER Phase number.

NPAR

INTEGER Multiple model parameter


number.

VALUE

REAL*8 Value of the duplication of


the multiple model parameter.

Return value:
0 if success else a negative integer.
Comments:
This function is called by the UP_MODEL working mode of
the model library functions.
GETPARAMDUPLIPHASE is a new function of the version
3.0 and replace the obsolete function GETPARAMDUPLI.

GETPARAMREAC
Syntax

INTEGER FUNCTION GETPARAMREAC (NBREAC, NBCOMP,


NPN, NUMR, NPL, LEVEL, NPR, RATIO, CONS, PROD,
USEOPT)
This macro function receives the parameters used to
calculate the mass transfer in a chemical reactor.
Parameters

USIM PAC

Type/Description

BRGM Software

FUNCTION REFERENCES

133

NBREAC

INTEGER Number of chemical


reactions.

NBCOMP

INTEGER Total number of


components: sum of all components
of all phases.

NPN

INTEGER Parameter number for the


reaction numbers NUMR.

NUMR

INTEGER (NBREAC) Array of the


reaction numbers contained in the
parameter number NPN.

NPL

INTEGER Parameter number for the


reaction levels LEVEL. If 0, all
reactions are in the first level.

LEVEL

INTEGER (NBREAC) Chemical


reaction level array contained in the
parameter number NPL.

NPR

INTEGER Parameter number for the


reaction ratios RATIO. If 0, the
reactions in the same level are
equally shared.

RATIO

REAL*8 (NBCOMP, NBREAC)


Array of the fraction of the
components available per chemical
reaction. They are calculated using
the values of the parameter number
NPR.

CONS

REAL*8 (NBCOMP, NBREAC)


Array of the consumption (in kg) of
the components per chemical
reaction.

PROD

REAL*8 (NBCOMP, NBREAC)


Array of the production (in kg) of the
components per chemical reaction.

USEOPT

INTEGER Allows to write information


about parameter checking in the
CONV.INF file if its value is
UP_MODEL_MESSAGE.

Return value:
1.
Comments:
All component arrays are sized for the total number of
components and built by the component array of the
individual phase putted end to end.
This function is called by the UP_MODEL working mode of
the model library functions.

USIM PAC

BRGM Software

134

FUNCTION REFERENCES

All the parameters received using this function are used as


are by the PERFREAC0, PERFREACTION0 and
PERFREACTION functions.
GETPARAMREAC is a new function of the version 3.0.

GETPARAMSTRING
Syntax

INTEGER FUNCTION GETPARAMSTRING (NPAR, LENGTH,


VALUE)
Receives the character string VALUE of a string model
parameter of number NPAR. The parameter has been
defined
using
the
function
SETPARAMSTRING,
SETPARAMFILENAME
or
SETPARAMDATABASENAME.
Parameters

Type/Description

NPAR

INTEGER Simple model parameter


number.

LENGTH

INTEGER Number of characters


really declared for VALUE.

VALUE

CHARACTER*1024 Value of the


model parameter.

Return value:
0 if success else a negative integer.
Comments:
This function is called by the UP_MODEL working mode of
the model library functions.
GETPARAMSTRING is a new function of the version 3.0

GETPHADENSANDVOLFLOW
Syntax

INTEGER
FUNCTION
GETPHADENSANDVOLFLOW
(NSTREAM, NPHA, DENS, VFLOW)
Receives the density DENS and the volumetric flowrate
VFLOW of the phase number NPHA in the stream
NSTREAM.
Parameters

USIM PAC

Type/Description

NSTREAM

INTEGER Stream number. If 0, the


stream is the sum of the input
streams.

NPHA

INTEGER Phase number. If 0, the


density is calculated for all phases in
the stream.

DENS

REAL*8 The phase density.

BRGM Software

FUNCTION REFERENCES

VFLOW

135

REAL*8 The phase volumetric


flowrate.

Return value:
A positive or null value if the function is successful.
Otherwise negative value.
Comments:
This function is called by the UP_MODEL working mode of
the model library functions.
GETPHADENSANDVOLFLOW is a new function of the
version 3.0

GETPHASEDENSITY
Syntax

INTEGER FUNCTION GETPHASEDENSITY (NSTREAM, NPHA,


VALUE)
Receives the density VALUE of the phase number NPHA in
the stream NSTREAM.
If it exists a stream phase density, the experimental value is
returned if not null. Otherwise the calculated value is
returned if not null.
If there is not valid stream phase density, the density is the
phase density if it exist in the model phase or the density
calculated from the component grades and their individual
densities.
Parameters

Type/Description

NSTREAM

INTEGER Stream number. If 0, the


stream is the sum of the input
streams.

NPHA

INTEGER Phase number. If 0, the


density is calculated for all phases in
the stream.

VALUE

REAL*8 The phase density.

Return value:
A positive or null value if the function is successful.
Otherwise negative value.
Comments:
This function is called by the UP_MODEL working mode of
the model library functions.
GETPHASEDENSITY is a new function of the version 3.0

GETPHASELHV
Syntax

USIM PAC

INTEGER FUNCTION GETPHASELHV (NPHA, VALUE)

BRGM Software

136

FUNCTION REFERENCES

Receives the low heating VALUE of the phase number


NPHA.
Parameters

Type/Description

NPHA

INTEGER Phase number.

VALUE

REAL*8 The low heating value of the


phase.

Return value:
A positive or null value if the function is successful.
Otherwise negative value.
Comments:
If there is not global low heating value of the phase, the
function fails.
This function is called by the UP_MODEL working mode of
the model library functions.
GETPHASELHV is a new function of the version 3.0

GETREALFORCOST
Syntax

INTEGER FUNCTION GETREALFORCOST (STR, NUM, NB,


NBMIN, NBMAX)
Calls an alternative interface:

This dialog box has a title ("My model") and a question


("What is the pressure drop?"). Both texts are registered in
file MESSAGES.TXT:

[MyModel]
1=My model
2=What is the pressure drop?
3=Do you want a pump?
4=How many pumps do you want?

The string STR contains the tag text "MyModel". The title is
always registered with key 1. The question is registered

USIM PAC

BRGM Software

FUNCTION REFERENCES

137

with key NUM. The input real NB is in the range NBMIN to


NBMAX.
If the No cost calculation button is pressed, the return
value is 0 else it is 1.
For the example above, the function call is:
STR = 'MyModel' C
OK = GETREALFORCOST (STR, 2, NB, 0.0,
10.0)
Parameters

Type/Description

STR

CHARACTER*51 Tag text in file


MESSAGES.TXT.

NUM

INTEGER Key number containing


the question.

NB

REAL*8 Value of the input real.

NBMIN

REAL*8 Minimum value authorized


for the input real.

NBMAX

REAL*8 Maximum value authorized


for the input real.

Return value:
0 if the No cost calculation button was pressed else 1.
Comments:
For more information about
MESSAGES.TXT, see part B.

the

use

of

file

This function is called by the UP_COST working mode of


the model library functions.

GETROSINRAMMLER
Syntax

INTEGER FUNCTION GETROSINRAMMLER (NBCLASS,


NBCOMP, NCOMP, SIZE, PARFLOW, D63, SLOPE)
Calculates the size D63 below which there is 63%-passing
and the curve SLOPE that defines a Rosin-Rammler
regression. Regression is calculated from the partial
flowrates of components per size class PARFLOW and the
upper bound SIZE array for component number NCOMP. If
NCOMP equals 0, regression is calculated for the whole
phase. There is NBCLASS size classes and NBCOMP
components.
Parameters

USIM PAC

Type/Description

NBCLASS

INTEGER Number of size classes.

NBCOMP

INTEGER Number of components.

BRGM Software

138

FUNCTION REFERENCES

NCOMP

INTEGER Component number for


which the Rosin-Rammler regression
is made or 0 for the whole phase.

SIZE

REAL*8 Upper bound array of size


classes.

PARFLOW

REAL*8 Partial flowrate array of


components per size class.

D63

REAL*8 Size below which there is


63% of the ore.

SLOPE

REAL*8 Rosin-Rammler regression


curve slope.

Return value:
0 if success else a negative integer.
Comments:
This function is called by the UP_MODEL working mode of
the model library functions.

GETSIZEFRACTIONS
Syntax

INTEGER FUNCTION GETSIZEFRACTIONS (NSTREAM, NPHA,


NBCLASS, VALUE)
Receives the size fraction array VALUE from phase
number NPHA of stream NSTREAM. The number of size
classes is NBCLASS.
Parameters

Type/Description

NSTREAM

INTEGER Stream number. If 0, the


stream is the sum of the input
streams.

NPHA

INTEGER Phase number.

NBCLASS

INTEGER Number of size classes.

VALUE

REAL*8 The size fraction array. This


array must be declared or allocated
with the sufficient number of
elements (NBCLASS).

Return value:
A positive or null value if the function is successful.
Otherwise negative value.
Comments:
This function is called by the UP_MODEL working mode of
the model library functions.

USIM PAC

BRGM Software

FUNCTION REFERENCES

139

GETSTOECHIOMOL
Syntax

INTEGER FUNCTION GETSTOECHIOMOL (NS, NBCOMP,


CONS, PROD)
Receives the consumption array CONS and the production
array PROD of the NBCOMP components of all phases
together corresponding to the chemical reaction number
NS. Consumption and production are given in moles.
Parameters

Type/Description

NS

INTEGER Chemical reaction number


given in the phase model.

NBCOMP

INTEGER Number of components.


This number is the sum of the
numbers of components for all
phases.

CONS

REAL*8 Consumption array. This


array must be declared or allocated
with the sufficient number of
elements (NBCOMP).

PROD

REAL*8 Production array. This array


must be declared or allocated with
the sufficient number of elements
(NBCOMP).

Return value:
A positive or null value if the function is successful.
Otherwise negative value.
Comments:
This function is called by the UP_MODEL working mode of
the model library functions.
GETSTOECHIOMOL is a new function of the version 3.0.

GETSTOECHIOMAS
Syntax

INTEGER FUNCTION GETSTOECHIOMAS (NS, NBCOMP,


CONS, PROD)
Receives the consumption array CONS and the production
array PROD of the NBCOMP components of all phases
together corresponding to the chemical reaction number
NS. Consumption and production are given in mass (kg).
Parameters
NS

USIM PAC

Type/Description
INTEGER Chemical reaction number
given in the phase model.

BRGM Software

140

FUNCTION REFERENCES

NBCOMP

INTEGER Number of components.


This number is the sum of the
numbers of components for all
phases.

CONS

REAL*8 Consumption array. This


array must be declared or allocated
with the sufficient number of
elements (NBCOMP).

PROD

REAL*8 Production array. This array


must be declared or allocated with
the sufficient number of elements
(NBCOMP).

Return value:
A positive or null value if the function is successful.
Otherwise negative value.
Comments:
This function is called by the UP_MODEL working mode of
the model library functions.
GETSTOECHIOMAS is a new function of the version 3.0.

GETSTREAMPHASEDENSITY
Syntax

INTEGER
FUNCTION
GETSTREAMPHASEDENSITY
(NSTREAM, NPHA, TYPE, VALUE)
Receives the stream phase density VALUE of the phase
number NPHA in the stream NSTREAM. Depending of
TYPE, the value is the experimental or the calculated one.
Parameters

Type/Description

NSTREAM

INTEGER Stream number. If 0, the


stream is the sum of the input
streams.

NPHA

INTEGER Phase number.

TYPE

INTEGER Experimental (0) or


calculated (1) density value.

VALUE

REAL*8 The phase density.

Return value:
A positive or null value if the function is successful.
Otherwise negative value.
Comments:
This function is called by the UP_MODEL working mode of
the model library functions.
GETSTREAMPHASEDENSITY is a new function of the
version 3.0.

USIM PAC

BRGM Software

FUNCTION REFERENCES

141

GETUNITPARAM
Syntax

INTEGER FUNCTION GETUNITPARAM (NUNIT, NMODEL,


NPAR, VALUE)
Receives the VALUE of a simple model parameter of
number NPAR from the unit of equipment number NUNIT
with the associated model number NMODEL.
Parameters

Type/Description

NUNIT

INTEGER Unit of equipment number


in the flowsheet.

NMODEL

INTEGER Model number expected


as associated to the desired unit of
equipment.

NPAR

INTEGER Simple model parameter


number.

VALUE

REAL*8 Value of the model


parameter.

Return value:
0 if success else a negative integer.
Comments:
This function is used when a model needs the value of a
parameter in another unit of equipment.
This function is called by the UP_MODEL working mode of
the model library functions.
GETUNITPARAM is a new function of the version 3.0.

GETUNITPARAMDUPLI1CRIT
Syntax

INTEGER FUNCTION GETUNITPARAMDUPLI1CRIT (NUNIT,


NMODEL, NPHA, NPAR, VALUE)
Receives the array of values VALUE of the duplications
relative to the phase NPHA of the multiple model parameter
number NPAR from the unit of equipment number NUNIT
with the associated model number NMODEL. The
duplicated parameter has been defined using the function
SETPARAMDUPLI1CRIT.
Parameters

USIM PAC

Type/Description

NUNIT

INTEGER Unit of equipment number


in the flowsheet.

NMODEL

INTEGER Model number expected


as associated to the desired unit of
equipment.

BRGM Software

142

FUNCTION REFERENCES

NPHA

INTEGER Phase number.

NPAR

INTEGER Multiple model parameter


number.

VALUE

REAL*8 Array of values of the


duplications of the multiple model
parameter. This array must be
declared or allocated with the
sufficient number of elements which
is the number of classes in the
associated criterion.

Return value:
0 if success else a negative integer.
Comments:
This function is used when a model needs the value of a
parameter in another unit of equipment.
This function is called by the UP_MODEL working mode of
the model library functions.
GETUNITPARAMDUPLI1CRIT is a new function of the
version 3.0.

GETUNITPARAMDUPLI2CRIT
Syntax

INTEGER FUNCTION GETUNITPARAMDUPLI2CRIT (NUNIT,


NMODEL, NPHA, NPAR, VALUE)
Receives the array of values VALUE of the duplications
relative to the phase NPHA of the multiple model parameter
number NPAR from the unit of equipment number NUNIT
with the associated model number NMODEL. The
duplicated parameter has been defined using the function
SETPARAMDUPLI2CRIT.
Parameters

USIM PAC

Type/Description

NUNIT

INTEGER Unit of equipment number


in the flowsheet.

NMODEL

INTEGER Model number expected


as associated to the desired unit of
equipment.

NPHA

INTEGER Phase number.

NPAR

INTEGER Multiple model parameter


number.

VALUE

REAL*8 Array of values of the


duplications of the multiple model
parameter. This 2-dimensional array
must be declared or allocated with
the sufficient number of elements
which is the product of the numbers

BRGM Software

FUNCTION REFERENCES

143

of classes in the two associated


criteria.
Return value:
0 if success else a negative integer.
Comments:
This function is used when a model needs the value of a
parameter in another unit of equipment.
This function is called by the UP_MODEL working mode of
the model library functions.
GETUNITPARAMDUPLI2CRIT is a new function of the
version 3.0.

GETUNITPARAMDUPLI2PHA
Syntax

INTEGER FUNCTION GETUNITPARAMDUPLI2PHA (NUNIT,


NMODEL, NPHA1, NPHA2, NPAR, VALUE)
Receives the array of values VALUE of the duplications
relative to the phases of number NPHA1 and NPHA2 of the
multiple parameter number NPAR from the unit of
equipment number NUNIT with the associated model
number NMODEL. The duplicated parameter has been
defined using the function SETPARAMDUPLI2PHA.
Parameters

Type/Description

NUNIT

INTEGER Unit of equipment number


in the flowsheet.

NMODEL

INTEGER Model number expected


as associated to the desired unit of
equipment.

NPHA1

INTEGER First phase number.

NPHA2

INTEGER Second phase number.

NPAR

INTEGER Multiple model parameter


number.

VALUE

REAL*8 Array of values of the


duplications of the multiple model
parameter. This 2-dimensional array
must be declared or allocated with
the sufficient number of elements
which is the product of the numbers
of classes in the two associated
criteria of the two phases.

Return value:
0 if success else a negative integer.
Comments:

USIM PAC

BRGM Software

144

FUNCTION REFERENCES

This function is used when a model needs the value of a


parameter in another unit of equipment.
This function is called by the UP_MODEL working mode of
the model library functions.
GETUNITPARAMDUPLI2PHA is a new function of the
version 3.0.

GETUNITPARAMDUPLIPARAM
Syntax

INTEGER FUNCTION GETUNITPARAMDUPLIPARAM (NUNIT,


NMODEL, NPAR, VALUE)
Receives the array of values VALUE of the duplications of
the multiple model parameter number NPAR from the unit
of equipment number NUNIT with the associated model
number NMODEL. The duplicated parameter has been
defined using the function SETPARAMDUPLIPARAM.
Parameters

Type/Description

NUNIT

INTEGER Unit of equipment number


in the flowsheet.

NMODEL

INTEGER Model number expected


as associated to the desired unit of
equipment.

NPAR

INTEGER Multiple model parameter


number.

VALUE

REAL*8 Array of values of the


duplications of the multiple model
parameter. This array must be
declared or allocated with the
sufficient number of elements which
is the value of the associated
parameter.

Return value:
0 if success else a negative integer.
Comments:
This function is used when a model needs the value of a
parameter in another unit of equipment.
This function is called by the UP_MODEL working mode of
the model library functions.
GETUNITPARAMDUPLIPARAM is a new function of the
version 3.0.

GETUNITPARAMDUPLIPARAM1CRIT
Syntax

USIM PAC

INTEGER FUNCTION GETUNITPARAMDUPLIPARAM1CRIT


(NUNIT, NMODEL, NPHA, NPAR, VALUE)

BRGM Software

FUNCTION REFERENCES

145

Receives the array of values VALUE of the duplications


relative to the phase NPHA of the multiple model parameter
number NPAR from the unit of equipment number NUNIT
with the associated model number NMODEL. The
duplicated parameter has been defined using the function
SETPARAMDUPLIPARAM1CRIT.
Parameters

Type/Description

NUNIT

INTEGER Unit of equipment number


in the flowsheet.

NMODEL

INTEGER Model number expected


as associated to the desired unit of
equipment.

NPHA

INTEGER Phase number.

NPAR

INTEGER Multiple model parameter


number.

VALUE

REAL*8 Array of values of the


duplications of the multiple model
parameter. This array must be
declared or allocated with the
sufficient number of elements which
is product of the value of the
associated parameter and the
number of classes in the associated
criterion.

Return value:
0 if success else a negative integer.
Comments:
This function is used when a model needs the value of a
parameter in another unit of equipment.
This function is called by the UP_MODEL working mode of
the model library functions.
GETUNITPARAMDUPLIPARAM1CRIT is a new function of
the version 3.0.

GETUNITPARAMDUPLIPARAMPHASE
Syntax

INTEGER FUNCTION GETUNITPARAMDUPLIPARAMPHASE


(NUNIT, NMODEL, NPHA, NPAR, VALUE)
Receives the array of values VALUE of the duplications
relative to the phase NPHA of the multiple model parameter
number NPAR from the unit of equipment number NUNIT
with the associated model number NMODEL. The
duplicated parameter has been defined using the function
SETPARAMDUPLIPARAMPHASE.
Parameters

USIM PAC

Type/Description

BRGM Software

146

FUNCTION REFERENCES

NUNIT

INTEGER Unit of equipment number


in the flowsheet.

NMODEL

INTEGER Model number expected


as associated to the desired unit of
equipment.

NPHA

INTEGER Phase number.

NPAR

INTEGER Multiple model parameter


number.

VALUE

REAL*8 Array of values of the


duplications of the multiple model
parameter. This array must be
declared or allocated with the
sufficient number of elements which
is the value of the associated
parameter.

Return value:
0 if success else a negative integer.
Comments:
This function is used when a model needs the value of a
parameter in another unit of equipment.
This function is called by the UP_MODEL working mode of
the model library functions.
GETUNITPARAMDUPLIPARAMPHASE is a new function
of the version 3.0.

GETUNITPARAMDUPLIPHASE
Syntax

INTEGER FUNCTION GETUNITPARAMDUPLIPHASE (NUNIT,


NMODEL, NPHA, NPAR, VALUE)
Receives the VALUE of the duplication relative to the
phase NPHA of the multiple model parameter number
NPAR from the unit of equipment number NUNIT with the
associated model number NMODEL. The duplicated
parameter has been defined using the function
SETPARAMDUPLIPHASE.
Parameters

USIM PAC

Type/Description

NUNIT

INTEGER Unit of equipment number


in the flowsheet.

NMODEL

INTEGER Model number expected


as associated to the desired unit of
equipment.

NPHA

INTEGER Phase number.

NPAR

INTEGER Multiple model parameter


number.

BRGM Software

FUNCTION REFERENCES

VALUE

147

REAL*8 Value of the duplication of


the multiple model parameter.

Return value:
0 if success else a negative integer.
Comments:
This function is used when a model needs the value of a
parameter in another unit of equipment.
This function is called by the UP_MODEL working mode of
the model library functions.
GETUNITPARAMDUPLIPHASE is a new function of the
version 3.0.

GETUNITPARAMSTRING
Syntax

INTEGER
FUNCTION
GETUNITPARAMSTRING
NMODEL, NPAR, LENGTH, VALUE)

(NUNIT,

Receives the character string VALUE of a string model


parameter of number NPAR from the unit of equipment
number NUNIT with the associated model number
NMODEL. The parameter has been defined using the
function SETPARAMSTRING, SETPARAMFILENAME or
SETPARAMDATABASENAME.
Parameters

Type/Description

NUNIT

INTEGER Unit of equipment number


in the flowsheet.

NMODEL

INTEGER Model number expected


as associated to the desired unit of
equipment.

NPAR

INTEGER Simple model parameter


number.

LENGTH

INTEGER Number of characters


really declared for VALUE.

VALUE

CHARACTER*1024 Value of the


model parameter.

Return value:
0 if success else a negative integer.
Comments:
This function is used when a model needs the value of a
parameter in another unit of equipment.
This function is called by the UP_MODEL working mode of
the model library functions.
GETUNITPARAMSTRING is a new function of the version
3.0.

USIM PAC

BRGM Software

148

FUNCTION REFERENCES

GETVOLFLOWPERCOMP
Syntax

INTEGER FUNCTION GETVOLFLOWPERCOMP (NSTREAM,


NPHA, NBCOMP, VALUE)
Receives the partial volumetric flowrate array VALUE of the
components from phase number NPHA of stream
NSTREAM. The number of components is NBCOMP.
Parameters

Type/Description

NSTREAM

INTEGER Stream number. If 0, the


stream is the sum of the input
streams.

NPHA

INTEGER Phase number.

NBCOMP

INTEGER Number of components.

VALUE

REAL*8 The partial volumetric


flowrate array of the components.
This array must be declared or
allocated with the sufficient number of
elements (NBCOMP).

Return value:
A positive or null value if the function is successful.
Otherwise negative value.
Comments:
This function is called by the UP_MODEL working mode of
the model library functions.

GETVOLFLOWRATE
Syntax

INTEGER FUNCTION GETVOLFLOWRATE (NSTREAM, NPHA,


VALUE)
Receives the volumetric flowrate VALUE of the phase
number NPHA of stream NSTREAM.
Parameters

Type/Description

NSTREAM

INTEGER Stream number. If 0, the


stream is the sum of the input
streams.

NPHA

INTEGER Phase number.

VALUE

REAL*8 The volumetric flowrate


array of the phase.

Return value:
A positive or null value if the function is successful.
Otherwise negative value.
Comments:

USIM PAC

BRGM Software

FUNCTION REFERENCES

149

This function is called by the UP_MODEL working mode of


the model library functions.
GETVOLFLOWRATE is a new function of the version 3.0.

MESSCONCAT
Syntax

SUBROUTINE MESSCONCAT (ANSWER, MORE)


Adds the character string MORE to the end of the string
ANSWER.
Parameters

Type/Description

ANSWER

CHARACTER*255 String receiving


the text to its end.

MORE

CHARACTER*255 String added to


the end of ANSWER.

Comments:
This subroutine is called by the UP_MODEL or
UP_POWER working mode of the model library functions.
MESSCONCAT is a new function of the version 3.0.

MESSMODEL
Syntax

SUBROUTINE MESSMODEL (MODELNAME, KEY, ANSWER)


Adds a text registered in file MESSAGES.TXT to the end of
the string ANSWER.
File MESSAGES.TXT has the following structure:
[FLOG]
1= Level 2B flotation.
2= Error: Level 2B flotation - number of banks is 0.
3= Error: Level 2B flotation - number of cells is 0.
4= Error: Level 2B flotation - cell volume is 0 m3.
5= Cell %i:
6= Phase %s
7= Recovery in cell
8= Cumulated recovery
9= component %i;
10= ;

%s

11= Total weight recovery: %g.


12= Error: Level 2B flotation - this model needs the floating
ability
13= description of every component of the ore and solid phases.
14= Cumulative residence time: %s s.

The element between brackets is the model function name


and each text associated with the model follows a key (an
integer followed by =).

USIM PAC

BRGM Software

150

FUNCTION REFERENCES

MODELNAME contains the model function name (here


'FLOG') and KEY contains the key number.
Here the text following the 2 can be added to string
ANSWER by this function.
Parameters

Type/Description

MODELNAME

CHARACTER*51 Model function


name which is between brackets in
file MESSAGES.TXT.

KEY

INTEGER Key number of the text.

ANSWER

CHARACTER*255 String receiving


the text to its end.

Comments:
This subroutine is called by the UP_MODEL or
UP_POWER working mode of the model library functions.

MESSMODELINT
Syntax

SUBROUTINE
ANSWER)

MESSMODELINT

(MODELNAME,

KEY,

I,

Adds a text registered in file MESSAGES.TXT to the end of


the string ANSWER. The text contains an integer I which
replaces the %i.
File MESSAGES.TXT has the following structure:
[FLOG]
1= Level 2B flotation.
2= Error: Level 2B flotation - number of banks is 0.
3= Error: Level 2B flotation - number of cells is 0.
4= Error: Level 2B flotation - cell volume is 0 m3.
5= Cell %i:
6= Phase %s
7= Recovery in cell
8= Cumulated recovery
9= component %i;
10= ;

%s

11= Total weight recovery: %g.


12= Error: Level 2B flotation - this model needs the floating
ability
13= description of every component of the ore and solid phases.
14= Cumulative residence time: %s s.

The element between brackets is the model function name


and each text associated with the model follows a key (an
integer followed by =).
MODELNAME contains the model function name (here
'FLOG') and KEY contains the key number.

USIM PAC

BRGM Software

FUNCTION REFERENCES

151

Here the text following key 5 can be added to string


ANSWER by this function. Integer I replaces the %i.
Parameters

Type/Description

MODELNAME

CHARACTER*51 Model function


name which is into brackets in file
MESSAGES.TXT.

KEY

INTEGER Key number of the text.

INTEGER Integer replacing the %i.

ANSWER

CHARACTER*255 String receiving


the text to its end.

Comments:
Formatted text follows the C rules to format integer.
This subroutine is called by the UP_MODEL or
UP_POWER working mode of the model library functions.

MESSMODELNEWLINE
Syntax

SUBROUTINE MESSMODELNEWLINE (ANSWER)


Adds a new line character sequence to the end of the string
ANSWER.
Parameters

Type/Description

ANSWER

CHARACTER*255 String receiving


the new line to its end.

Comments:
This subroutine is called by the UP_MODEL or
UP_POWER working mode of the model library functions.

MESSMODELREAL
Syntax

SUBROUTINE MESSMODELREAL (MODELNAME, KEY, X,


ANSWER)
Adds a text registered in file MESSAGES.TXT to the end of
string ANSWER. The text contains a real number X that
replaces the %s or %g.
The file MESSAGES.TXT has the structure:
[FLOG]
1= Level 2B flotation.
2= Error: Level 2B flotation - number of banks is 0.
3= Error: Level 2B flotation - number of cells is 0.
4= Error: Level 2B flotation - cell volume is 0 m3.
5= Cell %i:
6= Phase %s
7= Recovery in cell

USIM PAC

BRGM Software

152

FUNCTION REFERENCES

8= Cumulated recovery
9= component %i;
10= ;

%s

11= Total weight recovery: %g.


12= Error: Level 2B flotation - this model needs the floating
ability
13= description of every component of the ore and solid phases.
14= Cumulative residence time: %s s.

The element between brackets is the model function name


and each text associated with the model follows a key (an
integer followed by =).
MODELNAME contains the model function name (here
'FLOG') and KEY contains the key number.
Here the text following key 11 can be added to string
ANSWER by this function. Real X replaces the %g.
Parameters

Type/Description

MODELNAME

CHARACTER*51 Model function


name which is between brackets in
file MESSAGES.TXT.

KEY

INTEGER Key number of the text.

REAL*8 Real replacing the %s or


%g.

ANSWER

CHARACTER*255 String receiving


the text to its end.

Comments:
See comments of the function GDBLTOSTR for C
formatting of real value.
This subroutine is called by the UP_MODEL or
UP_POWER working mode of the model library functions.

MESSMODELTAB
Syntax

SUBROUTINE MESSMODELTAB (ANSWER)


Adds a tabulation character sequence to the end of the
string ANSWER.
Parameters
ANSWER

Type/Description
CHARACTER*255 String receiving
the tabulation to its end.

Comments:
This subroutine is called by the UP_MODEL or
UP_POWER working mode of the model library functions.
MESSMODELTAB is a new function of the version 3.0.

USIM PAC

BRGM Software

FUNCTION REFERENCES

153

MESSMODELTEXT
Syntax

SUBROUTINE MESSMODELTEXT (MODELNAME, KEY, TEXT,


ANSWER)
Adds a text registered in file MESSAGES.TXT to the end of
string ANSWER. The text contains a contextual string
TEXT that replaces the %s.
The file MESSAGES.TXT has the structure:
[FLOG]
1= Level 2B flotation.
2= Error: Level 2B flotation - number of banks is 0.
3= Error: Level 2B flotation - number of cells is 0.
4= Error: Level 2B flotation - cell volume is 0 m3.
5= Cell %i:
6= Phase %s
7= Recovery in cell
8= Cumulated recovery
9= component %i;
10= ;

%s

11= Total weight recovery: %g.


12= Error: Level 2B flotation - this model needs the floating
ability
13= description of every component of the ore and solid phases.
14= Cumulative residence time: %s s.

The element between brackets is the model function name


and each text associated with the model follows a key (an
integer followed by =).
MODELNAME contains the model function name (here
'FLOG') and KEY contains the key number.
Here the text following key 6 can be added to string
ANSWER by this function. TEXT replaces the %s.
Parameters

Type/Description

MODELNAME

CHARACTER*51 Model function


name which is between brackets in
file MESSAGES.TXT.

KEY

INTEGER Key number of the text.

TEXT

CHARACTER*255 Contextual string


replacing the %s.

ANSWER

CHARACTER*255 String receiving


the text to its end.

Comments:
This subroutine is called by the UP_MODEL or
UP_POWER working mode of the model library functions.

USIM PAC

BRGM Software

154

FUNCTION REFERENCES

MESSMODELTEXT is a new function of the version 3.0.

MESSTOCONV
Syntax

SUBROUTINE MESSTOCONV (ANSWER)


Sends a message from a formatted text ANSWER to the
model trace file CONV.INF.
Parameters
ANSWER

Type/Description
CHARACTER*255 String containing
the formatted text.

Comments:
The text is formatted by means of functions MESSMODEL,
MESSMODELINT,
MESSMODELREAL,
MESSMODELTEXT,
MESSMODELNEWLINE,
MESSMODELTAB and MESSCONCAT.
This subroutine is called by the UP_MODEL working mode
of the model library functions.

MESSTOCOST
Syntax

SUBROUTINE MESSTOCOST (ANSWER)


Sends a message from a formatted text ANSWER to the
cost file COST.INF.
Parameters
ANSWER

Type/Description
CHARACTER*255 String containing
the formatted text.

Comments:
The text is formatted by means of functions MESSMODEL,
MESSMODELINT,
MESSMODELREAL,
MESSMODELTEXT,
MESSMODELNEWLINE,
MESSMODELTAB and MESSCONCAT.
This subroutine is called by the UP_MODEL working mode
of the model library functions.

MESSTOPOWER
Syntax

SUBROUTINE MESSTOPOWER (ANSWER)


Sends a message from a formatted text ANSWER to the
power consumption file POWER.INF.
Parameters
ANSWER

USIM PAC

Type/Description
CHARACTER*255 String containing
the formatted text.

BRGM Software

FUNCTION REFERENCES

155

Comments:
The text is formatted by means of functions MESSMODEL,
MESSMODELINT,
MESSMODELREAL,
MESSMODELTEXT,
MESSMODELNEWLINE,
MESSMODELTAB and MESSCONCAT.
This subroutine is called by the UP_POWER working mode
of the model library functions.

MESSTOSCREEN
Syntax

SUBROUTINE MESSTOSCREEN (ANSWER)


Sends a message from a formatted text ANSWER to a
message box on the screen.
Parameters
ANSWER

Type/Description
CHARACTER*255 String containing
the formatted text.

Comments:
The text is formatted by means of functions MESSMODEL,
MESSMODELINT,
MESSMODELREAL,
MESSMODELTEXT,
MESSMODELNEWLINE,
MESSMODELTAB and MESSCONCAT.
This subroutine is called by the UP_MODEL working mode
of the model library functions.

NBCLASSCRIT
Syntax

INTEGER FUNCTION NBCLASSCRIT (NPHA, CRITYP)


Gives the number of classes of a criterion with the criterion
type CRITYP in the phase of number NPHA.
Parameters

Type/Description

NPHA

INTEGER Phase number.

CRITYP

INTEGER Criterion type: CRITSIZE,


CRITCOMP, CRITFLOT,
CRITFIXEDSP1, CRITFIXEDSP2 or
CRITFIXEDSP3.

Return value:
The number of classes in the criterion. The return value is 0
if there is no criterion of this type or if the phase number is
not valid.
Comments:
This function is called by the UP_MODEL working mode of
the model library functions.

USIM PAC

BRGM Software

156

FUNCTION REFERENCES

NBCRIT
Syntax

INTEGER FUNCTION NBCRIT (NPHA)


Gives the number of criteria in phase number NPHA.
Parameters
NPHA

Type/Description
INTEGER Phase number.

Return value:
The number of criteria or 0 if the phase number is not valid.
Comments:
This function is called by the UP_MODEL working mode of
the model library functions.

NBHIER
Syntax

INTEGER FUNCTION NBHIER (NPHA)


Gives the number of description hierarchies in phase
number NPHA.
Parameters
NPHA

Type/Description
INTEGER Phase number.

Return value:
The number of hierarchies or 0 if the phase number is not
valid.
Comments:
This function is called by the UP_MODEL working mode of
the model library functions.

NBHIER1D
Syntax

INTEGER FUNCTION NBHIER1D (NPHA, HIERTYP, CRITYP)


Gives the number of description hierarchies in phase
number NPHA which have a type HIERTYP and which
contain a criterion of type CRITYP.
Parameters

USIM PAC

Type/Description

NPHA

INTEGER Phase number.

HIERTYP

INTEGER Hierarchy type with value


TYPFLOW or TYPDENS.

CRITYP

INTEGER Criterion type: CRITSIZE,


CRITCOMP, CRITFLOT,
CRITFIXEDSP1, CRITFIXEDSP2 or
CRITFIXEDSP3.

BRGM Software

FUNCTION REFERENCES

157

Return value:
The number of hierarchies or 0 if there is no hierarchy with
the specifications or if the phase number is not valid.
Comments:
For a hierarchy of type TYPDENS, only the 1-dimensional
hierarchy with the criterion is numbered.
This function is called by the UP_MODEL working mode of
the model library functions.

NBHIER2D
Syntax

INTEGER FUNCTION NBHIER2D (NPHA, HIERTYP, CRITYP1,


CRITYP2)
Gives the number of description hierarchies in phase
number NPHA that have a type HIERTYP and which
contain criteria of types CRITYP1 and CRITYP2.
Parameters

Type/Description

NPHA

INTEGER Phase number.

HIERTYP

INTEGER Hierarchy type with value


TYPFLOW or TYPDENS.

CRITYP1

INTEGER First criterion type:


CRITSIZE, CRITCOMP, CRITFLOT,
CRITFIXEDSP1, CRITFIXEDSP2 or
CRITFIXEDSP3.

CRITYP2

INTEGER Second criterion type:


CRITSIZE, CRITCOMP, CRITFLOT,
CRITFIXEDSP1, CRITFIXEDSP2 or
CRITFIXEDSP3.

Return value:
The number of hierarchies or 0 if there is no hierarchy with
the specifications or if the phase number is not valid.
Comments:
For a hierarchy of type TYPDENS, only the 2-dimensional
hierarchy with the criteria is numbered.
This function is called by the UP_MODEL working mode of
the model library functions.

NBPHA
Syntax

INTEGER FUNCTION NBPHA ()


Gives the number of phases in the phase model.

Return value:
The number of phases.

USIM PAC

BRGM Software

158

FUNCTION REFERENCES

Comments:
This function is called by the UP_MODEL working mode of
the model library functions.

NBPHATYP
Syntax

INTEGER FUNCTION NBPHATYP (PHATYP)


Gives the number of phases of type PHATYP.
Parameters
PHATYP

Type/Description
INTEGER Phase type: TYPORE,
TYPSOL, TYPLIQ or TYPGAZ.

Return value:
The number of phases with the specified type.
Comments:
This function is called by the UP_MODEL working mode of
the model library functions.

NBSORTIE
Syntax

SUBROUTINE NBSORTIE (NUMICO, NS)


Defines the icon number NUMICO and the number of
output location NS.
Parameters

Type/Description

NUMICO

INTEGER Icon number.

NS

INTEGER Number of output


locations.

Comments:
This subroutine is called by the UP_PARAM working mode
of the icon library functions.

NTYPPHA
Syntax

INTEGER FUNCTION NTYPPHA (NPHA)


Gives the phase type of the phase number NPHA.
Parameters
NPHA

Type/Description
INTEGER Phase number.

Return value:
TYPORE, TYPSOL, TYPLIQ or TYPGAZ for ore, solid,
liquid or gas phase respectively. The return value is
negative if the phase number is not valid.

USIM PAC

BRGM Software

FUNCTION REFERENCES

159

Comments:
This function is called by the UP_MODEL working mode of
the model library functions.

NUMCRITYP
Syntax

INTEGER FUNCTION NUMCRITYP (NPHA, CRITYP)


Gives the criterion number in phase number NPHA with the
criterion type CRITYP.
Parameters

Type/Description

NPHA

INTEGER Phase number.

CRITYP

INTEGER Criterion type: CRITSIZE,


CRITCOMP, CRITFLOT,
CRITFIXEDSP1, CRITFIXEDSP2 or
CRITFIXEDSP3.

Return value:
The criterion number. The return value is 0 if there is no
criterion of this type in the phase or if the phase number is
not valid.
Comments:
This function is called by the UP_MODEL working mode of
the model library functions.

NUMHIER0D
Syntax

INTEGER FUNCTION NUMHIER0D (NPHA, HIERTYP)


Gives the hierarchy number in phase number NPHA of the
first hierarchy that has a type HIERTYP.
Parameters

Type/Description

NPHA

INTEGER Phase number.

HIERTYP

INTEGER Hierarchy type with value


TYPFLOW or TYPDENS.

Return value:
The hierarchy number or a negative value if there is no
hierarchy with the specified type or if the phase number is
not valid.
Comments:
This function is called by the UP_MODEL working mode of
the model library functions.

NUMHIER1D
Syntax

USIM PAC

INTEGER FUNCTION NUMHIER1D (NPHA, HIERTYP, CRITYP,


ORDER)

BRGM Software

160

FUNCTION REFERENCES

Gives the hierarchy number in phase number NPHA of a


hierarchy that has a type HIERTYP and which contains a
criterion of type CRITYP. ORDER is the order of the
hierarchy in the set of hierarchies numbered by the
NBHIER1D function.
Parameters

Type/Description

NPHA

INTEGER Phase number.

HIERTYP

INTEGER Hierarchy type with value


TYPFLOW or TYPDENS.

CRITYP

INTEGER Criterion type: CRITSIZE,


CRITCOMP, CRITFLOT,
CRITFIXEDSP1, CRITFIXEDSP2 or
CRITFIXEDSP3.

ORDER

INTEGER The hierarchy order in the


set of hierarchy numbered by
NBHIER1D.

Return value:
The hierarchy number or 0 if there is no hierarchy with the
specified type or if the phase number is not valid.
Comments:
For a hierarchy of type TYPDENS, only the 1-dimensional
hierarchies with the criteria are numbered.
This function is called by the UP_MODEL working mode of
the model library functions.

NUMHIER2D
Syntax

INTEGER FUNCTION NUMHIER2D (NPHA, HIERTYP, CRITYP1,


CRITYP2, ORDER)
Gives the hierarchy number in phase number NPHA of a
hierarchy that has a type HIERTYP and which contains
criteria of type CRITYP1 and CRITYP2. ORDER is the
order of the hierarchy in the set of hierarchies numbered by
the NBHIER2D function.
Parameters

USIM PAC

Type/Description

NPHA

INTEGER Phase number.

HIERTYP

INTEGER Hierarchy type with value


TYPFLOW or TYPDENS.

CRITYP1

INTEGER First criterion type:


CRITSIZE, CRITCOMP, CRITFLOT,
CRITFIXEDSP1, CRITFIXEDSP2 or
CRITFIXEDSP3.

CRITYP2

INTEGER Second criterion type:


CRITSIZE, CRITCOMP, CRITFLOT,

BRGM Software

FUNCTION REFERENCES

161

CRITFIXEDSP1, CRITFIXEDSP2 or
CRITFIXEDSP3.
ORDER

INTEGER The hierarchy order in the


set of hierarchy numbered by
NBHIER2D.

Return value:
The hierarchy number or 0 if there is no hierarchy with the
specified type or if the phase number is not valid.
Comments:
For a hierarchy of type TYPDENS, only the 2-dimensional
hierarchies with the criteria are numbered.
This function is called by the UP_MODEL working mode of
the model library functions.

NUMHIERSYS
Syntax

INTEGER FUNCTION NUMHIERSYS (NPHA, HIERSYS)


Gives the stream description hierarchy number in phase
number NPHA with hierarchy system number HIERSYS.
Parameters

Type/Description

NPHA

INTEGER Phase number.

HIERSYS

INTEGER Description hierarchy


system number: NSPHAFLOW,
NSSIZFLOW, NSSIZCONFLOW,
NSCONFLOW, NSCONFLOTFLOW,
NSCONFSP1, NSCONFSP2,
NSCONFSP3, NSSIZFSP1,
NSSIZFSP2, NSSIZFSP3 or
NSSTREAMPHADENS.

Return value:
The description hierarchy number. The return value is 0 if
there is no hierarchy with this system number in the phase
or if the phase number is not valid.
Comments:
This function is called by the UP_MODEL working mode of
the model library functions.

NUMSHAREDHIERSYS
Syntax

INTEGER
HIERSYS)

FUNCTION

NUMSHAREDHIERSYS

(NPHA,

Gives the shared description hierarchy number in phase


number NPHA with hierarchy system number HIERSYS.

USIM PAC

BRGM Software

162

FUNCTION REFERENCES

Parameters

Type/Description

NPHA

INTEGER Phase number.

HIERSYS

INTEGER Shared description


hierarchy system number:
NSPHADENS, NSCONDENS,
NSCONMOLMASS, NSPHALHV or
NSCONLHV.

Return value:
The shared description hierarchy number. The return value
is 0 if there is no hierarchy with this system number in the
phase or if the phase number is not valid.
Comments:
A shared description hierarchy is a description initialized in
the phase model and not depending of the stream.
This function is called by the UP_MODEL working mode of
the model library functions.
NUMSHAREDHIERSYS is a new function of the version
3.0.

NUMPHATYP
Syntax

INTEGER FUNCTION NUMPHATYP (PHATYP, ORDER)


Gives the number of ORDERth phase among phases of
type PHATYP. ORDER takes value between 1 to
NBPHATYP (PHATYP).
Parameters

Type/Description

PHATYP

INTEGER
Phase type: TYPORE,
TYPSOL, TYPLIQ or TYPGAZ.

ORDER

INTEGER
Order of the phase in
the same type phase set.

Return value:
The phase number. The return value is 0 if there is no
phase of this type or if the order is not in the legal range.
Comments:
This function is called by the UP_MODEL working mode of
the model library functions.

PHASENAME
Syntax

INTEGER FUNCTION PHASENAME (NPHA, NAME)


Receives the name of the phase NPHA into the variable
NAME.

USIM PAC

BRGM Software

FUNCTION REFERENCES

Parameters

163

Type/Description

NPHA

INTEGER Phase number.

NAME

CHARACTER*31 Character string


receiving the phase name.

Return value:
The number of characters of the phase name if success
else a negative integer.
Comments:
This function is called by the UP_MODEL working mode of
the model library functions.
PHASENAME is a new function of the version 3.0.

PHAUTE
Syntax

SUBROUTINE PHAUTE (X, Y)


Moves the pen to the point (X, Y) without drawing a line.
Parameters

Type/Description

INTEGER X-coordinate of the point.

INTEGER Y-coordinate of the point.

Comments:
This subroutine is called by the UP_DRAW working mode
of the icon library functions.

PERFPARREAC
Syntax

INTEGER FUNCTION PERFPARREAC (NBCOMP, NBREAC,


NPN, NPL, NPR, FLOWIN, TARGET, NPHA, NPI, NPC,
FLOWOUT, USEOPT)
This macro function receives the parameters and calculates
the mass transfer in a chemical reactor using mass fraction
setpoints.
Parameters

USIM PAC

Type/Description

NBCOMP

INTEGER Total number of


components: sum of all components
of all phases.

NBREAC

INTEGER Number of chemical


reactions.

NPN

INTEGER Parameter number for the


reaction numbers.

NPL

INTEGER Parameter number for the


reaction levels.

BRGM Software

164

FUNCTION REFERENCES

NPR

INTEGER Parameter number for the


reaction ratios.

FLOWIN

REAL*8 (NBCOMP) Array of the


input partial flowrates of components.

TARGET

REAL*8 (NBCOMP) Array of the


expected component mass proportion
after reactions.

NPHA

INTEGER (NBCOMP) Phase


number array giving the phase
number associated to each
component.

NPI

INTEGER Number of the parameter


containing the maximum number of
iterations.

NPC

INTEGER Number of the parameter


containing the convergence criterion.

FLOWOUT

REAL*8 (NBCOMP) Array of the


output partial flowrates of
components.

USEOPT

INTEGER Allows to write information


about convergence in the CONV.INF
file if its value is
UP_MODEL_MESSAGE.

Return value:
1.
Comments:
This function works as the GETPARAMREAC and
PERFREACTION functions in one step.
This function is called by the UP_MODEL working mode of
the model library functions.
PERFPARREAC is a new function of the version 3.0.

PERFPARREAC0
Syntax

INTEGER FUNCTION PERFPARREAC0 (NBCOMP, NBREAC,


NPN, NPL, NPR, FLOWIN, FLOWOUT, USEOPT)
This macro function receives the parameters and calculates
the mass transfer in a chemical reactor without setpoint.
Parameters

USIM PAC

Type/Description

NBCOMP

INTEGER Total number of


components: sum of all components
of all phases.

NBREAC

INTEGER Number of chemical


reactions.

BRGM Software

FUNCTION REFERENCES

165

NPN

INTEGER Parameter number for the


reaction numbers.

NPL

INTEGER Parameter number for the


reaction levels.

NPR

INTEGER Parameter number for the


reaction ratios.

FLOWIN

REAL*8 (NBCOMP) Array of the


input partial flowrates of components.

FLOWOUT

REAL*8 (NBCOMP) Array of the


output partial flowrates of
components.

USEOPT

INTEGER Allows to write information


about convergence in the CONV.INF
file if its value is
UP_MODEL_MESSAGE.

Return value:
1.
Comments:
This function works as the GETPARAMREAC and
PERFREACTION0 functions in one step.
This function is called by the UP_MODEL working mode of
the model library functions.
PERFPARREAC0 is a new function of the version 3.0.

PERFREAC0
Syntax

INTEGER FUNCTION PERFREAC0 (NBCOMP, NBREAC,


FLOWIN, LEVEL, CONS, PROD, RATIO, FLOWOUT, TARGET)
This macro function calculates the mass transfer in a
chemical reactor using partial mass flowrate setpoints.
Parameters

USIM PAC

Type/Description

NBCOMP

INTEGER Total number of


components: sum of all components
of all phases.

NBREAC

INTEGER Number of chemical


reactions.

FLOWIN

REAL*8 (NBCOMP) Array of the


input partial flowrates of components.

LEVEL

INTEGER (NBREAC) Chemical


reaction level array.

CONS

REAL*8 (NBCOMP, NBREAC)


Array of the consumption (in kg) of

BRGM Software

166

FUNCTION REFERENCES

the components per chemical


reaction.
PROD

REAL*8 (NBCOMP, NBREAC)


Array of the production (in kg) of the
components per chemical reaction.

RATIO

REAL*8 (NBCOMP, NBREAC)


Array of the fraction of the
components available per chemical
reaction.

FLOWOUT

REAL*8 (NBCOMP) Array of the


output partial flowrates of
components.

TARGET

REAL*8 (NBCOMP) Array of the


expected component partial flowrate
after reactions.

Return value:
1.
Comments:
All component arrays are sized for the total number of
components and built by the component array of the
individual phase putted end to end.
This function is called by the UP_MODEL working mode of
the model library functions. It is also called by the
PERFREACTION0 and PERFREACTION functions.
PERFREAC0 is a new function of the version 3.0.

PERFREACTION
Syntax

INTEGER FUNCTION PERFREACTION (NBCOMP, NBREAC,


FLOWIN, TARGET, NPHA, LEVEL, CONS, PROD, RATIO,
NBITER, CC, FLOWOUT, USEOPT)
This macro function calculates the mass transfer in a
chemical reactor using mass fraction setpoints.
Parameters

USIM PAC

Type/Description

NBCOMP

INTEGER Total number of


components: sum of all components
of all phases.

NBREAC

INTEGER Number of chemical


reactions.

FLOWIN

REAL*8 (NBCOMP) Array of the


input partial flowrates of components.

TARGET

REAL*8 (NBCOMP) Array of the


expected component mass proportion
after reactions.

BRGM Software

FUNCTION REFERENCES

167

NPHA

INTEGER (NBCOMP) Phase


number array giving the phase
number associated to each
component.

LEVEL

INTEGER (NBREAC) Chemical


reaction level array.

CONS

REAL*8 (NBCOMP, NBREAC)


Array of the consumption (in kg) of
the components per chemical
reaction.

PROD

REAL*8 (NBCOMP, NBREAC)


Array of the production (in kg) of the
components per chemical reaction.

RATIO

REAL*8 (NBCOMP, NBREAC)


Array of the fraction of the
components available per chemical
reaction.

NBITER

INTEGER Maximum number of


iterations for calculation.

CC

REAL*8 Convergence criterion


which is the fraction of flowrate
allowed as the maximum difference
between two iteration to stop
calculation.

FLOWOUT

REAL*8 (NBCOMP) Array of the


output partial flowrates of
components.

USEOPT

INTEGER Allows to write information


about convergence in the CONV.INF
file if its value is
UP_MODEL_MESSAGE.

Return value:
1.
Comments:
All component arrays are sized for the total number of
components and built by the component array of the
individual phase putted end to end.
This function is called by the UP_MODEL working mode of
the model library functions.
PERFREACTION is a new function of the version 3.0.

PERFREACTION0
Syntax

USIM PAC

INTEGER FUNCTION PERFREACTION0 (NBCOMP, NBREAC,


FLOWIN, LEVEL, CONS, PROD, RATIO, FLOWOUT)

BRGM Software

168

FUNCTION REFERENCES

This macro function calculates the mass transfer in a


chemical reactor without setpoint.
Parameters

Type/Description

NBCOMP

INTEGER Total number of


components: sum of all components
of all phases.

NBREAC

INTEGER Number of chemical


reactions.

FLOWIN

REAL*8 (NBCOMP) Array of the


input partial flowrates of components.

LEVEL

INTEGER (NBREAC) Chemical


reaction level array.

CONS

REAL*8 (NBCOMP, NBREAC)


Array of the consumption (in kg) of
the components per chemical
reaction.

PROD

REAL*8 (NBCOMP, NBREAC)


Array of the production (in kg) of the
components per chemical reaction.

RATIO

REAL*8 (NBCOMP, NBREAC)


Array of the fraction of the
components available per chemical
reaction.

FLOWOUT

REAL*8 (NBCOMP) Array of the


output partial flowrates of
components.

Return value:
1.
Comments:
All component arrays are sized for the total number of
components and built by the component array of the
individual phase putted end to end.
This function is called by the UP_MODEL working mode of
the model library functions.
PERFREACTION0 is a new function of the version 3.0.

RECTAN
Syntax

SUBROUTINE RECTAN (L, H, X, Y)


Draws a rectangle with length L and height H. (X, Y) is the
upper left corner.
Parameters
L

USIM PAC

Type/Description
INTEGER Length of the rectangle.

BRGM Software

FUNCTION REFERENCES

169

INTEGER Height of the rectangle.

INTEGER X-coordinate of the upper


left corner.

INTEGER Y-coordinate of the upper


left corner.

Comments:
This subroutine is called by the UP_DRAW working mode
of the icon library functions.

REGD
Syntax

INTEGER FUNCTION REGD (N, X, Y, A, B, F)


Gives the coefficients A and B of the straight-line equation:
Y = A + B X which is the linear regression of the N points
stored in the arrays X and Y. F is the calculated correlation
factor.
Parameters

Type/Description

INTEGER Number of points.

REAL*8 X-coordinate array of the


points.

REAL*8 Y-coordinate array of the


points.

REAL*8 Coefficient of the straightline equation: Y = A + B X.

REAL*8 Coefficient of the straightline equation: Y = A + B X.

REAL*8 Correlation factor.

Return value:
0 if success else a negative integer.
Comments:
This function is used in the GETROSINRAMMLER
function.
This function is called by the UP_MODEL working mode of
the model library functions.

SEND0DTOSTREAMS
Syntax

INTEGER FUNCTION SEND0DTOSTREAM (NOUTPUT, NPHA,


HIERTYP, VALUE)
Sends the VALUE of a 0-dimensional hierarchy of type
HIERTYP to phase number NPHA of output NOUTPUT.
Parameters

USIM PAC

Type/Description

BRGM Software

170

FUNCTION REFERENCES

NOUTPUT

INTEGER Output number.

NPHA

INTEGER Phase number.

HIERTYP

INTEGER Hierarchy type with value


TYPFLOW or TYPDENS.

VALUE

REAL*8 The value of the 0dimensional hierarchy.

Return value:
A positive or null value if the function is successful.
Otherwise negative value.
Comments:
This function is called by the UP_MODEL working mode of
the model library functions.

SEND1DTOSTREAMS
Syntax

INTEGER FUNCTION SEND1DTOSTREAM (NOUTPUT, NPHA,


HIERTYP, CRITYP, NBCLASS, VALUE)
Sends the value array VALUE of a 1-dimensional hierarchy
of type HIERTYP to phase number NPHA of output
NOUTPUT. The 1-dimensional hierarchy contains the
criterion of type CRITYP with NBCLASS classes.
Parameters

Type/Description

NOUTPUT

INTEGER Output number.

NPHA

INTEGER Phase number.

HIERTYP

INTEGER Hierarchy type with value


TYPFLOW or TYPDENS.

CRITYP

INTEGER Criterion type: CRITSIZE,


CRITCOMP, CRITFLOT,
CRITSPFIXED1, CRITSPFIXED2 or
CRITSPFIXED3.

NBCLASS

INTEGER Number of classes in the


criterion of type CRITYP.

VALUE

REAL*8 The value array of the 1dimensional hierarchy. This array


must be declared or allocated with
the sufficient number of elements
(NBCLASS).

Return value:
A positive or null value if the function is successful.
Otherwise negative value.
Comments:
This function is called by the UP_MODEL working mode of
the model library functions.

USIM PAC

BRGM Software

FUNCTION REFERENCES

171

SEND2DTOSTREAMS
Syntax

INTEGER FUNCTION SEND2DTOSTREAM (NOUTPUT, NPHA,


HIERTYP, CRITYP1, CRITYP2, NBCLASS1, NBCLASS2, VALUE)
Sends the value array VALUE of a 2-dimensional hierarchy
of type HIERTYP to phase number NPHA of output
NOUTPUT. The 2-dimensional hierarchy contains the
criteria of type CRITYP1 and CRITYP2 with NBCLASS1
and NBCLASS2 classes respectively.
Parameters

Type/Description

NOUTPUT

INTEGER Output number.

NPHA

INTEGER Phase number.

HIERTYP

INTEGER Hierarchy type with value


TYPFLOW or TYPDENS.

CRITYP1

INTEGER First criterion type:


CRITSIZE, CRITCOMP, CRITFLOT,
CRITSPFIXED1, CRITSPFIXED2 or
CRITSPFIXED3.

CRITYP2

INTEGER Second criterion type:


CRITSIZE, CRITCOMP, CRITFLOT,
CRITSPFIXED1, CRITSPFIXED2 or
CRITSPFIXED3.

NBCLASS1

INTEGER Number of classes in the


first criterion of type CRITYP1.

NBCLASS2

INTEGER Number of classes in the


second criterion of type CRITYP2.

VALUE

REAL*8 The value array of the 2dimensional hierarchy. This array


must be declared or allocated with
the sufficient number of elements
(NBCLASS1 NBCLASS2).

Return value:
A positive or null value if the function is successful.
Otherwise negative value.
Comments:
This function is called by the UP_MODEL working mode of
the model library functions.

SENDPHASEDENSITYTOSTREAMS
Syntax

INTEGER
FUNCTION
SENDPHASEDENSITYTOSTREAMS
(NOUTPUT, NPHA, VALUE)
Sends the calculated stream phase density VALUE of the
phase number NPHA to the output NOUTPUT.

USIM PAC

BRGM Software

172

FUNCTION REFERENCES

Parameters

Type/Description

NOUTPUT

INTEGER Output number.

NPHA

INTEGER Phase number.

VALUE

REAL*8 The phase density.

Return value:
A positive or null value if the function is successful.
Otherwise negative value.
Comments:
This function is called by the UP_MODEL working mode of
the model library functions.
SENDPHASEDENSITYTOSTREAMS is a new function of
the version 3.0.

SENDTOPARAM
Syntax

INTEGER FUNCTION SENDTOPARAM (NPAR, VALUE)


Sends the VALUE of a simple output model parameter of
number NPAR to the unit parameter set.
Parameters

Type/Description

NPAR

INTEGER Simple model parameter


number.

VALUE

REAL*8 New value of the model


parameter.

Return value:
0 if success else a negative integer.
Comments:
This function is called by the UP_MODEL working mode of
the model library functions.

SENDTOPARAMDUPLIPARAM
Syntax

INTEGER FUNCTION SENDTOPARAMDUPLIPARAM (NPAR,


NBELEM, VALUE)
Sends the value array VALUE of the NBELEM duplications
of a multiple output model parameter of number NPAR to
the unit parameter set. The duplicated parameter has been
defined using the function SETPARAMDUPLIPARAM.
Parameters
NPAR

USIM PAC

Type/Description
INTEGER Multiple model parameter
number.

BRGM Software

FUNCTION REFERENCES

173

NBELEM

INTEGER Number of elements in the


array. This number must be the value
of the associated parameter.

VALUE

REAL*8 Array of new values of the


duplications of the multiple model
parameter. This array must be
declared or allocated with NBELEM
elements.

Return value:
0 if success else a negative integer.
Comments:
This function is called by the UP_MODEL working mode of
the model library functions.
SENDTOPARAMDUPLIPARAM is a new function of the
version 3.0.

SENDTOPARAMNEXTAPP
Syntax

INTEGER FUNCTION SENDTOPARAMNEXTAPP


NMOD, NOUTPUT, VALUE)

(NPAR,

Sends the VALUE of a simple input model parameter of


number NPAR to the parameter set of the next unit. The
next unit is linked to the current one by the stream which
exit from the output NOUTPUT. The number of the model
attached to the next unit must be NMOD.
Parameters

Type/Description

NPAR

INTEGER Simple model parameter


number.

NMOD

INTEGER Next unit model number.

NOUTPUT

INTEGER Output number from


which the next unit is linked.

VALUE

REAL*8 New value of the model


parameter.

Return value:
0 if success else a negative integer.
Comments:
This function is called by the UP_MODEL working mode of
the model library functions.

SETCOMMINUTION
Syntax

SUBROUTINE SETCOMMINUTION ()
Asserts that the size distribution of the phases of ore and
solid types are not kept.

USIM PAC

BRGM Software

174

FUNCTION REFERENCES

Comments:
This subroutine is used by comminution models such as
mills or crushers. It is equivalent of the call of subroutines:
SETINFMODHIER
CRITSIZE)

(TYPORE,

TYPFLOW,

SETINFMODHIER
CRITSIZE)

(TYPSOL,

TYPFLOW,

This subroutine is called by the UP_PRESENT_INFO


variant of the UP_PRESENT working mode of the model
library functions.

SETCOST
Syntax

SUBROUTINE SETCOST (NOCOST, NBUNIT, COST)


Sets the capital COST of a unit of equipment and the
number of unit NBUNIT. If the capital cost has been
calculated, NOCOST must be 1, else it must be 0.
Parameters

Type/Description

NOCOST

INTEGER If it is 1, the cost has been


calculated else it is 0.

NBUNIT

INTEGER Number of units of


equipment related to the model.

COST

REAL*8 Capital cost of a unit of


equipment.

Comments:
This subroutine is called by the UP_COST_CALC variant of
the UP_COST working mode of the model library functions.

SETFLOATPROP
Syntax

INTEGER FUNCTION GETFLOATPROP (NOUTPUT, NPHA,


NBCOMP, GLOFLOW, NOFLO, SLOWFLO, FASTFLO)
Sends the three arrays of the component proportions in the
floating ability sub-populations: no floating, slow floating
and fast floating, from phase number NPHA of stream
output NOUTPUT. The three arrays are respectively
NOFLO, SLOWFLO and FASTFLO. The number of
components is NBCOMP. The global flowrate of the phase
is GLOFLOW.
Parameters

USIM PAC

Type/Description

NOUTPUT

INTEGER Output number.

NPHA

INTEGER Phase number.

NBCOMP

INTEGER Number of components.

BRGM Software

FUNCTION REFERENCES

175

GLOFLOW

REAL*8 The global flowrate of the


phase.

NOFLO

REAL*8 The component proportion


array of no floating components. This
array must be declared or allocated
with the sufficient number of
elements (NBCOMP).

SLOWFLO

REAL*8 The component proportion


array of slow floating components.
This array must be declared or
allocated with the sufficient number of
elements (NBCOMP).

FASTFLO

REAL*8 The component proportion


array of fast floating components.
This array must be declared or
allocated with the sufficient number of
elements (NBCOMP).

Return value:
A positive or null value if the function is successful.
Otherwise negative value.
Comments:
This function is called by the UP_MODEL working mode of
the model library functions.

SETGROUP
Syntax

SUBROUTINE SETGROUP (NGROUP, NAME)


Declares a parameter group with a unique number
NGROUP and a NAME.
Parameters

Type/Description

NGROUP

INTEGER Group number.

NAME

CHARACTER*32 Character string


containing the group name.

Comments:
NAME must be a C-compatible string variable and can be
initialized using the MESSMODEL function. The group
name is then stored in the MESSAGES.TXT file.
A group generates an individual interface (dialog box) for
the associated parameters.
This
subroutine
is
called
by
the
UP_PARAM_DIALOGTYPE variant of the UP_PARAM
working mode of the model library functions.
SETGROUP is a new function of the version 3.0.

USIM PAC

BRGM Software

176

FUNCTION REFERENCES

SETGROUPPARAM
Syntax

SUBROUTINE SETGROUPPARAM (NGROUP, NPAR)


Associates the parameter of number NPAR to the group of
number NGROUP.
Parameters

Type/Description

NGROUP

INTEGER Group number.

NPAR

INTEGER Associated parameter


number.

Comments:
This subroutine is called for each parameter associated to
the group. A parameter cannot be associated with more
than 1 group.
All parameters associated to a group are displayed in a
separate list box. A line containing the group name and an
edit button appears at the place of the parameters in the
main list box.
If a parameter is not associated to a group, it is directly
displayed in the main parameter list box.
If all the parameters associated to a group are duplicated
exactly following the same rules, a specific sheet box
appears.
This
subroutine
is
called
by
the
UP_PARAM_DIALOGTYPE variant of the UP_PARAM
working mode of the model library functions.
SETGROUPPARAM is a new function of the version 3.0.

SETINFMODHIER
Syntax

SUBROUTINE SETINFMODHIER (PHATYP, HIERTYP, CRITYP)


Asserts that a material description criterion characterized
by the system number CRITYP is not kept for the hierarchy
type HIERTYP of phase type PHATYP.
Parameters

USIM PAC

Type/Description

PHATYP

INTEGER Phase type with value


TYPORE, TYPSOL, TYPLIQ or
TYPGAZ.

HIERTYP

INTEGER Hierarchy type with value


TYPFLOW or TYPDENS.

CRITYP

INTEGER Criterion type: CRITSIZE,


CRITCOMP, CRITFLOT,
CRITSPFIXED1, CRITSPFIXED2 or
CRITSPFIXED3.

BRGM Software

FUNCTION REFERENCES

177

Comments:
This subroutine is called for each criterion that is not kept in
each phase.
This subroutine is called by the UP_PRESENT_INFO
variant of the UP_PRESENT working mode of the model
library functions.

SETINFOHELP
Syntax

SUBROUTINE SETINFOHELP (HELPFILE, TOPIC)


Associates the model to a topic of number TOPIC in a userdefined help file of name HELPFILE.
Parameters

Type/Description

HELPFILE

CHARACTER*256 User-defined
help file name.

TOPIC

INTEGER Number of the help file


topic which contains the model help.

Comments:
It is recommended to use the model number as topic
number.
This subroutine is called by the UP_HELP_INFO variant of
the UP_HELP working mode of the model library functions.

SETINFOMODEL
Syntax

SUBROUTINE SETINFOMODEL (NMOD, NBO, NBP)


Recalls the model number NMOD and sets the number of
outputs NBO and the number of parameters NBP (a
multiple parameter is counted as one).
Parameters

Type/Description

NMOD

INTEGER Model number.

NBO

INTEGER Number of outputs.

NBP

INTEGER Number of parameters.

Comments:
This subroutine is called by the UP_PRESENT_INFO
variant of the UP_PRESENT working mode of the model
library functions.

SETNAME
Syntax

SUBROUTINE SETNAME (ICONNAME)


Defines the icon default name. This name is the default
name until it is redefined in the icon configuration.

USIM PAC

BRGM Software

178

FUNCTION REFERENCES

Parameters
ICONNAME

Type/Description
CHARACTER*255 Name of the
icon.

Comments:
This subroutine is called by the UP_PARAM working mode
of the icon library functions.
The name must be in a C-compatible string variable.

SETPARAMDATABASENAME
Syntax

SUBROUTINE SETPARAMDATABASENAME
TYPE, NPARENTRY)

(NPAR,

EXT,

Sets that the parameter of number NPAR is a character


string containing a file name of a database with the default
extension EXT. The database has a TYPE. The associated
parameter NPARENTRY contains the index in the
database of the set of data selected for the model.
Parameters

Type/Description

NPAR

INTEGER Parameter number of the


string file name parameter.

EXT

CHARACTER*4 Character string


containing the default file name
extension.

TYPE

INTEGER Type of the database. For


the crusher database:
BASETYPE_CRUSHER.

NPARENTRY

INTEGER Number of the simple


integer parameter containing the
index of the selected set of data.

Comments:
EXT must be a C-compatible string variable.
The standard "Open" interface is proposed for the choice of
the file name.
A C++ class is proposed for automatic editing of the
database.
This
subroutine
is
called
by
the
UP_PARAM_DIALOGTYPE variant of the UP_PARAM
working mode of the model library functions.
SETPARAMDATABASENAME is a new function of the
version 3.0.

SETPARAMDIALOGTYPE
Syntax

USIM PAC

SUBROUTINE SETPARAMDIALOGTYPE (TYPE)

BRGM Software

FUNCTION REFERENCES

179

Sets the dialog box TYPE of the parameter input interface.


Parameters
TYPE

Type/Description
INTEGER Dialog box type:
TP_NOPARAM, TP_SIMPLEPARAM
and TP_DUPLIPARAM.

Comments:
This subroutine must be called but the value of TYPE has
no effect. It is kept for compatibility. USIM PAC is able to
recognize automatically the type of the dialog box.
This
subroutine
is
called
by
the
UP_PARAM_DIALOGTYPE variant of the UP_PARAM
working mode of the model library functions.

SETPARAMDUPLI1CRIT
Syntax

SUBROUTINE
CRITYP)

SETPARAMDUPLI1CRIT

(NPAR,

PHATYP,

Sets that the parameter of number NPAR is duplicated


along the material description criterion characterized by
CRITYP of the phases of type PHATYP.
Parameters

Type/Description

NPAR

INTEGER Parameter number of the


multiple parameter.

PHATYP

INTEGER Phase type containing the


criterion along which the parameter is
duplicated: TYPORE, TYPSOL,
TYPLIQ or TYPGAZ.

CRITYP

INTEGER Type of the criterion along


which the parameter is duplicated:
CRITSIZE, CRITCOMP, CRITFLOT,
CRITSPFIXED1, CRITSPFIXED2 or
CRITSPFIXED3.

Comments:
This subroutine is called for each multiple parameter and
each phase type containing the criterion along which the
parameter is duplicated.
Values of the parameter duplications are registered in a
1-dimensional array.
This
subroutine
is
called
by
the
UP_PARAM_DIALOGTYPE variant of the UP_PARAM
working mode of the model library functions.

USIM PAC

BRGM Software

180

FUNCTION REFERENCES

SETPARAMDUPLI2CRIT
Syntax

SUBROUTINE SETPARAMDUPLI2CRIT
CRITYP1, CRITYP2)

(NPAR,

PHATYP,

Sets that the parameter of number NPAR is duplicated


along the material description criteria characterized by
CRITYP1 and CRITYP2 of the phases of type PHATYP.
Parameters

Type/Description

NPAR

INTEGER Parameter number of the


multiple parameter.

PHATYP

INTEGER Phase type containing the


criterion along which the parameter is
duplicated: TYPORE, TYPSOL,
TYPLIQ or TYPGAZ.

CRITYP1

INTEGER Type of the first criterion


along which the parameter is
duplicated: CRITSIZE, CRITCOMP,
CRITFLOT, CRITSPFIXED1,
CRITSPFIXED2 or CRITSPFIXED3.

CRITYP2

INTEGER Type of the second


criterion along which the parameter is
duplicated: CRITSIZE, CRITCOMP,
CRITFLOT, CRITSPFIXED1,
CRITSPFIXED2 or CRITSPFIXED3.

Comments:
This subroutine is called for each multiple parameter and
each phase type containing the criteria along which the
parameter is duplicated.
Values of the parameter duplications are registered in a
2-dimensional array.
This
subroutine
is
called
by
the
UP_PARAM_DIALOGTYPE variant of the UP_PARAM
working mode of the model library functions.

SETPARAMDUPLI2PHA
Syntax

SUBROUTINE SETPARAMDUPLI2PHA
CRITYP1, PHATYP2, CRITYP2)

(NPAR,

PHATYP1,

Sets that the parameter of number NPAR is duplicated


along the material description criteria characterized by
CRITYP1 of the phases of type PHATYP1 and CRITYP2 of
the phases of type PHATYP2.
Parameters

USIM PAC

Type/Description

BRGM Software

FUNCTION REFERENCES

181

NPAR

INTEGER Parameter number of the


multiple parameter.

PHATYP1

INTEGER Phase type containing the


criterion CRITYP1 along which the
parameter is duplicated: TYPORE,
TYPSOL, TYPLIQ or TYPGAZ.

CRITYP1

INTEGER Type of the first criterion


along which the parameter is
duplicated: CRITSIZE, CRITCOMP,
CRITFLOT, CRITSPFIXED1,
CRITSPFIXED2 or CRITSPFIXED3.

PHATYP2

INTEGER Phase type containing the


criterion NSCRIT2 along which the
parameter is duplicated: TYPORE,
TYPSOL, TYPLIQ or TYPGAZ.

CRITYP2

INTEGER Type of the second


criterion along which the parameter is
duplicated: CRITSIZE, CRITCOMP,
CRITFLOT, CRITSPFIXED1,
CRITSPFIXED2 or CRITSPFIXED3.

Comments:
This subroutine is called for each multiple parameter and
each phase type containing the criteria along which the
parameter is duplicated.
Values of the parameter duplications are registered in a
2-dimensional array.
This
subroutine
is
called
by
the
UP_PARAM_DIALOGTYPE variant of the UP_PARAM
working mode of the model library functions.

SETPARAMDUPLIPARAM
Syntax

SUBROUTINE SETPARAMDUPLIPARAM (NPAR, NPARNB,


ISREAC)
Sets that the parameter of number NPAR is duplicated
along another parameter of number NPARNB giving the
number of elements. The other parameter must be a simple
integer parameter. If the parameter NPAR contains a
chemical reaction number, ISREAC has the value 1.
Parameters

USIM PAC

Type/Description

NPAR

INTEGER Parameter number of the


multiple parameter.

NPARNB

INTEGER Number of the parameter


containing the number of
duplications.

BRGM Software

182

FUNCTION REFERENCES

ISREAC

INTEGER Indicates if the multiple


parameter contains a chemical
reaction number (1) or not (0).

Comments:
Values of the parameter duplications are registered in a
1-dimensional array.
This
subroutine
is
called
by
the
UP_PARAM_DIALOGTYPE variant of the UP_PARAM
working mode of the model library functions.
SETPARAMDUPLIPARAM is a new function of the version
3.0.

SETPARAMDUPLIPARAMPHASE
Syntax

SUBROUTINE
SETPARAMDUPLIPARAMPHASE
NPARNB, PHATYP)

(NPAR,

Sets that the parameter of number NPAR is duplicated


along another parameter of number NPARNB and along
the phases of type PHATYP. The other parameter must be
a simple integer parameter.
Parameters

Type/Description

NPAR

INTEGER Parameter number of the


multiple parameter.

NPARNB

INTEGER Number of the parameter


along which the parameter is
duplicated.

PHATYP

INTEGER Phase type along which


the parameter is duplicated:
TYPORE, TYPSOL, TYPLIQ or
TYPGAZ.

Comments:
This subroutine is called for each multiple parameter and
each phase type along which the parameter is duplicated.
Values of the parameter duplications are registered in a
2-dimensional array.
This
subroutine
is
called
by
the
UP_PARAM_DIALOGTYPE variant of the UP_PARAM
working mode of the model library functions.
SETPARAMDUPLIPARAMPHASE is a new function of the
version 3.0.

SETPARAMDUPLIPARAM1CRIT
Syntax

USIM PAC

SUBROUTINE
SETPARAMDUPLIPARAM1CRIT
NPARNB, PHATYP, CRITYP)

(NPAR,

BRGM Software

FUNCTION REFERENCES

183

Sets that the parameter of number NPAR is duplicated


along another parameter of number NPARNB and along
the material description criterion characterized by CRITYP
of the phases of type PHATYP. The other parameter must
be a simple integer parameter.
Parameters

Type/Description

NPAR

INTEGER Parameter number of the


multiple parameter.

NPARNB

INTEGER Number of the parameter


along which the parameter is
duplicated.

PHATYP

INTEGER Phase type containing the


criterion along which the parameter is
duplicated: TYPORE, TYPSOL,
TYPLIQ or TYPGAZ.

CRITYP

INTEGER Type of the criterion along


which the parameter is duplicated:
CRITSIZE, CRITCOMP, CRITFLOT,
CRITSPFIXED1, CRITSPFIXED2 or
CRITSPFIXED3.

Comments:
This subroutine is called for each multiple parameter and
each phase type containing the criterion along which the
parameter is duplicated.
Values of the parameter duplications are registered in a
2-dimensional array.
This
subroutine
is
called
by
the
UP_PARAM_DIALOGTYPE variant of the UP_PARAM
working mode of the model library functions.
SETPARAMDUPLIPARAM1CRIT is a new function of the
version 3.0.

SETPARAMDUPLIPHASE
Syntax

SUBROUTINE SETPARAMDUPLIPHASE (NPAR, PHATYP)


Sets that the parameter of number NPAR is duplicated
along the phases of type PHATYP.
Parameters

USIM PAC

Type/Description

NPAR

INTEGER Parameter number of the


multiple parameter.

PHATYP

INTEGER Phase type along which


the parameter is duplicated:
TYPORE, TYPSOL, TYPLIQ or
TYPGAZ.

BRGM Software

184

FUNCTION REFERENCES

Comments:
This subroutine is called for each multiple parameter and
each phase along which the parameter is duplicated.
Values of the parameter duplications are registered in a
1-dimensional array.
This
subroutine
is
called
by
the
UP_PARAM_DIALOGTYPE variant of the UP_PARAM
working mode of the model library functions.
SETPARAMDUPLIPHASE is a new function of the version
3.0.

SETPARAMFILENAME
Syntax

SUBROUTINE SETPARAMFILENAME (NPAR, EXT)


Sets that the parameter of number NPAR is a character
string containing a file name with the default extension
EXT.
Parameters

Type/Description

NPAR

INTEGER Parameter number of the


string file name parameter.

EXT

CHARACTER*4 Character string


containing the default file name
extension.

Comments:
EXT must be a C-compatible string variable.
The standard "Open" interface is proposed for the choice of
the file name.
This
subroutine
is
called
by
the
UP_PARAM_DIALOGTYPE variant of the UP_PARAM
working mode of the model library functions.
SETPARAMFILENAME is a new function of the version
3.0.

SETPARAMSTRING
Syntax

SUBROUTINE SETPARAMSTRING (NPAR)


Sets that the parameter of number NPAR is a character
string.
Parameters
NPAR

Type/Description
INTEGER Parameter number of the
string parameter.

Comments:

USIM PAC

BRGM Software

FUNCTION REFERENCES

185

A special interface is proposed for string input.


This
subroutine
is
called
by
the
UP_PARAM_DIALOGTYPE variant of the UP_PARAM
working mode of the model library functions.
SETPARAMSTRING is a new function of the version 3.0.

SETPHA
Syntax

INTEGER FUNCTION SETPHA (NOUTPUT, NPHA, FLOW)


Copies the entire description of the phase number NPHA
into the stream output NOUTPUT (stream output of a unit
are numbered 1, 2...) changing only the global phase
flowrate FLOW.
Parameters

Type/Description

NOUTPUT

INTEGER Stream output number.

NPHA

INTEGER Phase number.

FLOW

REAL*8 New value of the global


phase flowrate.

Return value:
0 if success else a negative integer.
Comments:
This function copies all description hierarchies of type
flowrate from the input stream (sum of all the input stream)
to an output stream. The hierarchies of other types are not
copied. Only the global flowrate is changed. All ratio
between partial flowrates and global flowrate are
conserved.
This function is called by the UP_MODEL working mode of
the model library functions.

SETPHASLIQ
Syntax

INTEGER FUNCTION SETPHASLIQ (NOUTPUT, FLOW)


Copies the entire description of all liquid phases to the
output stream NOUTPUT (output stream of a unit are
numbered 1, 2...) changing only the global phase flowrates
proportionally to the change of the global liquid phase
flowrate sum FLOW.
Parameters

Type/Description

NOUTPUT

INTEGER Stream output number.

FLOW

REAL*8 New value of the sum of


global flowrates of all liquid phases.

Return value:

USIM PAC

BRGM Software

186

FUNCTION REFERENCES

0 if success else a negative integer.


Comments:
This function copies all description hierarchies of type
flowrate from the input stream (sum of all the input stream)
to an output stream. The hierarchies of other type are not
copied. Only the sum of global liquid phase flowrates is
changed. All ratio between each global liquid phase
flowrate and the sum of global liquid phase flowrate are
conserved as well as ratio between partial flowrates and
global flowrate.
This function is called by the UP_MODEL working mode of
the model library functions.

SETROSINRAMMLER
Syntax

INTEGER
FUNCTION
SETROSINRAMMLER
NBCOMP, NCOMP, SIZE, FRAC, D63, SLOPE)

(NBCLASS,

Calculates the size fractions FRAC for component NCOMP


with a Rosin-Rammler distribution. If NCOMP equals 0,
calculation is done for every component. D63 and SLOPE
are the Rosin-Rammler distribution parameters. The upper
bound size are in the array SIZE. There is NBCLASS size
classes and NBCOMP components.
Parameters

Type/Description

NBCLASS

INTEGER Number of size classes.

NBCOMP

INTEGER Number of components.

NCOMP

INTEGER Component number for


which the Rosin-Rammler distribution
is calculated or 0 for every
component.

SIZE

REAL*8 Upper bound array of size


classes.

FRAC

REAL*8 Size fraction array of


components. It is a 2-dimensional
array and only the column relative to
the component NCOMP is calculated.
If NCOMP is 0, all columns are
calculated

D63

REAL*8 Size below which there is


63% of the ore (must be in the same
unit as sizes).

SLOPE

REAL*8 Rosin-Rammler distribution


curve slope.

Return value:
0 if success else a negative integer.

USIM PAC

BRGM Software

FUNCTION REFERENCES

187

Comments:
This function is called by the UP_MODEL working mode of
the model library functions.

SETTYPE
Syntax

SUBROUTINE SETTYPE (TYPE)


Defines the icon type. This type is the number of the
generic icon representing the family of the current icon.
Parameters

Type/Description

TYPE

INTEGER Type of the icon.

Comments:
This subroutine is called by the UP_PARAM working mode
of the icon library functions.

SHOWERROR
Syntax

SUBROUTINE SHOWERROR (N)


Sends a general message from a predefined text registered
in file MESSAGES.TXT to the model trace file CONV.INF.
The part of the file MESSAGES.TXT containing the
predefined texts of the general messages has the structure:
[UTIL]
1= Warning: Linear regression - coefficients not calculated.
2=
Warning:
calculated.

Linear

regression

fitness

coefficient

not

10= Warning: Log interpolation - wrong component number.


11= Warning: Log interpolation - null flowrate.
12= Warning: Log interpolation - cumulative passing at maximum
size is lower than requested.
13= Warning:
interpolation

Log

interpolation

results

obtained

by

linear

14= Warning: Gaudin-Schuhmann - wrong component number.


15= Warning: Gaudin-Schuhmann - null flowrate.
16= Warning: Gaudin-Schuhmann - cumulative passing at maximum size
is lower than requested.
17= Warning:
interpolation

Gaudin-Schuhmann

results

obtained

by

linear

20= Warning: Rosin Rammler - wrong component number.


21= Warning: Rosin Rammler - null flowrate.
22= Warning: Rosin Rammler - cumulative passing at maximum size is
lower than 70%.
23= Warning: Rosin Rammler - problem in the linear regression.
24= Warning: Rosin Rammler - null slope of Rosin Rammler.
30= Warning:
number.

Cumulative

passing

calculation

wrong

component

31= Warning: Cumulative passing calculation - null flowrate.

USIM PAC

BRGM Software

188

FUNCTION REFERENCES

Each text associated with the general message set follows


a key (an integer followed by =).
N is the key number.
Parameters
N

Type/Description
INTEGER Key number of the
predefined text.

Comments:
This subroutine is called by the UP_MODEL working mode
of the model library functions and some utility functions.

SIZECLASSNAME
Syntax

INTEGER FUNCTION SIZECLASSNAME (NPHA, NCLASS,


NAME)
Receives the name of the size class NCLASS of the phase
NPHA into the variable NAME.
Parameters

Type/Description

NPHA

INTEGER Phase number.

NCLASS

INTEGER Size class index (between


1 and the number of size classes
given by NBCLASSCRIT).

NAME

CHARACTER*31 Character string


receiving the size class name.

Return value:
The number of characters of the size class name if success
else a negative integer.
Comments:
This function is called by the UP_MODEL working mode of
the model library functions.
SIZECLASSNAME is a new function of the version 3.0.

SORTIE
Syntax

SUBROUTINE SORTIE (NOUTLOC, NOUT, XC, YC)


Defines the output location with number NOUTLOC. This
output location is associated with the output with number
NOUT. It defines an influence area mapping by a little
rectangle centered on the point (XC, YC).
Parameters
NOUTLOC

USIM PAC

Type/Description
INTEGER Number of the output
location.

BRGM Software

FUNCTION REFERENCES

189

NOUT

INTEGER Number of the output


associated.

XC

INTEGER X-coordinate of the


influence area center.

YC

INTEGER Y-coordinate of the


influence area center.

Comments:
This subroutine must be called for each output location.
The number of output location is defined by the subroutine
NBSORTIE.
This subroutine is called by the UP_PARAM working mode
of the icon library functions.

TESTHIERTYP
Syntax

INTEGER FUNCTION TESTHIERTYP (NPHA, NHIER, HIERTYP)


Tests that hierarchy number NHIER in phase NPHA has a
type HIERTYP.
Parameters

Type/Description

NPHA

INTEGER Phase number.

NHIER

INTEGER Description hierarchy


number.

HIERTYP

INTEGER Hierarchy type with value


TYPFLOW or TYPDENS.

Return value:
1 if the hierarchy has the type else 0. The return value is 0
if the phase number or the hierarchy number are not valid.
Comments:
This function is called by the UP_MODEL working mode of
the model library functions.

TESTPHAORE
Syntax

INTEGER FUNCTION TESTPHAORE ()


Tests the presence of at least one ore phase.

Return value:
1 if there is at least one ore phase else 0.
Comments:
This function is called by the UP_COMP working mode of
the model library functions.

TESTPHASMOD
Syntax

USIM PAC

INTEGER FUNCTION TESTPHASMOD (DOMAIN)

BRGM Software

190

FUNCTION REFERENCES

Tests the phase model coherence with an industrial


domain.
Parameters

Type/Description

DOMAIN

INTEGER Symbolic constant


characterizing an industrial domain.

Return value:
1 if the phase model is coherent with the industrial domain
else 0.
Comments:
The industrial domains are:

GRANULATS

sand and gravel industry,

UPVER1
1.x.

phase model of USIM PAC version

This function is called by the UP_COMP working mode of


the model library functions.

TESTSIZECOMPFLOW
Syntax

INTEGER FUNCTION TESTSIZECOMPFLOW ()


Tests the presence of a component grade per size class in
an ore phase.

Return value:
1 if there is a component grade per size class in an ore
phase else 0.
Comments:
This function is called by the UP_COMP working mode of
the model library functions.

TESTSIZEFLOW
Syntax

INTEGER FUNCTION TESTSIZEFLOW ()


Tests the presence of a size distribution in an ore phase.

Return value:
1 if there is a size distribution in an ore phase else 0.
Comments:
This function is called by the UP_COMP working mode of
the model library functions.

TRACE
Syntax

SUBROUTINE TRACE (X, Y)


Draws a line from the current point to the point (X, Y).

USIM PAC

BRGM Software

FUNCTION REFERENCES

Parameters

191

Type/Description

INTEGER X-coordinate of the point.

INTEGER Y-coordinate of the point.

Comments:
This subroutine is called by the UP_DRAW working mode
of the icon library functions.

ZEROPHA
Syntax

INTEGER FUNCTION ZEROPHA (NOUTPUT, NPHA)


Copies a null description of the phase of number NPHA to
the output stream NOUTPUT (output streams of a unit are
numbered 1, 2...).
Parameters

Type/Description

NOUTPUT

INTEGER Stream output number.

NPHA

INTEGER Phase number.

Return value:
0 if success else a negative integer.
Comments:
This function initializes all description hierarchies of type
flowrate with a null global flowrate and copies it to an
output stream. The hierarchies of other types are not
initialized.
This function is called by the UP_MODEL working mode of
the model library functions.

ZONERECT
Syntax

SUBROUTINE ZONERECT (LEFT, RIGHT, TOP, BOTTOM)


Defines the icon influence area. This area is a rectangle
surrounding the icon drawing. (LEFT, TOP) are the
coordinates of the upper left corner and (RIGHT, BOTTOM)
are the coordinates of the lower right corner.
Parameters

USIM PAC

Type/Description

LEFT

INTEGER X-coordinate of the upper


left corner.

RIGHT

INTEGER X-coordinate of the lower


right corner.

TOP

INTEGER Y-coordinate of the upper


left corner.

BOTTOM

INTEGER Y-coordinate of the lower


right corner.

BRGM Software

192

FUNCTION REFERENCES

Comments:
This subroutine is called by the UP_PARAM working mode
of the icon library functions.

USIM PAC

BRGM Software

You might also like