You are on page 1of 4

16.

0 METSIM Function Subroutines


The following subroutines perform certain mathematical, editing and process functions
on data scalars, vectors, and matrices. They are programming tools used to assist in the
rapid development of other subroutines.

They are used in one of the APL forms, depending on the arguments needed and the
results returned.

These programs may be chained together to form complex expressions. For example, to
calculate the average of the positive values of X,

Average FAVE FPOS X

FAST Alphabetic sort


Larg None
Rarg Character matrix
Result Sorted character matrix
FAVE Numeric average
Larg None
Rarg Numeric vector
Result Numerical average
FCEN Temperature conversion to degrees Celsius
Larg None
Rarg Temperatures in degrees Fahrenheit
Result Temperature in degrees Celsius
FCHC Component heat content
Larg Stream number
Rarg Component numbers
Result Heat content of components in kcal/hour
FCOL Create column matrix
Larg None
Rarg numeric of character vector of length n
Result Numeric of character matrix of dimensions n x 1
FDEF Default values
Larg Numeric vector A
Rarg Numeric vector B
Result Numeric vector A with zero plus values replaced by
corresponding values of B
FDIF Difference between elements of vector or matrix
Larg None
Rarg Numeric vector or matrix of dimensions n or (m x n)
Result Numeric vector or matrix of dimensions (n-1) or (m x
(n-1)) containing the difference between adjacent
values
FELE Element weight fraction of specified elements E in components C in
streams S, (a vector of stream numbers defined before calling FELE)
Larg Vector of element numbers
Rarg Vector of component numbers
Result Matrix of elemental weight fractions
FEPM Calculate EP separation factors
Larg EP value for gravity separation efficiency
Rarg SG, specific gravity of separation
Result Separation factors for each specific gravity fraction
FEWT Elemental flowrate of specified elements E in components C in
stream S, (S is a scalar or vector of stream numbers defined before
calling FEWT)
1
Larg Vector of element numbers
Rarg Vector of component numbers
Result Matrix of elemental mass flowrates in user units
FFAR Temperature conversion to degrees Fahrenheit
Larg None
Rarg Temperature in degrees Celsius
Result Temperature in degrees Fahrenheit
FFLA Adiabatic flash of water in stream S1
Larg None
Rarg None
Result Six-element vector containing the temperature,
pressure, liquid fraction, vapor pressure, vapor
fraction, and partial pressure of water in stream S1
FGWA Get washability data
Larg None
Rarg Vector of stream numbers
Result Matrix containing the washability data for the
specified streams
FHTG Free energy of formation components
Larg Vector of component numbers
Rarg Temperature in degrees Kelvin
Result Free energy of formation of specified components at
specified temperature in kcal/kg-mole
FINT Interpolation of data array
Larg Scalar or vector of independent values
Rarg Matrix M with independent variable in first column
Result Dependent values, scalar if Larg is scalar and matrix
M is (n x 2) vector if Larg is a vector and matrix M is
(n x m) matrix if Larg is a vector and matrix M is (n x
m)
FMCL Multiply matrix by columns
Larg Numeric matrix M of dimensions (n x m)
Rarg Numeric matrix M of dimensions (n x m) Comment [d1]:
Result Numeric matrix where each column of matrix M is
multiplied by the corresponding element of vector V
FMRW Multiply matrix by rows
Larg Numeric vector V of length n
Rarg Numeric matrix M of dimensions (n x m)
Result Numeric matrix where each row of matrix M is
multiplied by the corresponding element of vector V
FMUL Multiply stream data by a constant factor. Used to adjust stream
flowrates
Larg Vector of stream numbers
Rarg Scalar factor for scaling selected streams
Result None
FNEG Negative numbers from a numeric vector
Larg None
Rarg Numeric vector V
Result Numeric vector containing only the negative values
of V
FNST Numeric sort into ascending order
Larg None
Rarg Numeric vector
Result Numeric vector sorted in ascending order
FNZR None zero values
Larg None
Rarg Numeric vector V
Result Numeric vector containing only the non-zero values
of V
FPCP Screen analysis percent (weight fraction) passing
Larg None
Rarg Vector of mass flowrates for all mesh sizes
Result Vector of weight fraction passing each mesh size
FPCR Screen analysis percent (weight fraction) retained
Larg None
Rarg Vector of cumulative fraction passing each mesh size
Result Vector of with fraction retained on each mesh size
FPOS Positive values
2
Larg None
Rarg Numeric vector V
Result Numeric vector containing only the positive values of
V
FPWA Store washability data, used to pack data
Larg Stream number of washability data
Rarg Washability of data of single stream
Result None
FRND Round off data to nearest integer
Larg None
Rarg Scalar, vector or matrix of numeric values
Result Scalar, vector or matrix of nearest integers
FSHC Calculate stream heat content from stream temperature
Larg None
Rarg Vector of stream numbers
Result None
FSRT Sort numeric matrix, preserve rows
Larg Column for sorting
Rarg Matrix to be sorted
Result Sorted matrix
FSSA Calculates, for selected streams, the screen size analysis in SSA from
the inorganic solids S1 in STR and the weighted screen size analysis
in SSA, used to guarantee consistency between arrays in STR and
SSA
Larg None
Rarg Vector of stream numbers
Result None
FSSE Set streams in equal composition and size analysis, used to define
one stream in terms of another
Larg None
Rarg Destination stream number, factor, source stream
number
Result None
FSTM Converts character string to character matrix
Larg None
Rarg Break character, character string
Result Character matrix
FSUB Subtract one string from another, A = A – B
Larg Stream number A
Rarg Stream number B
Result None
FTDA convert to two-dimensional array, converts a scalar or vector into a
matrix
Larg None
Rarg Scalar, vector or matrix of dimension n, or (m x n)
Result Two-dimensional matrix of dimension (1 x n) or (m x
n)
FTEM Calculate stream temperature from stream heat content
Larg None
Rarg Vector of streams
Result None
FVPR Vapor pressure of water at specified temperature
Larg None
Rarg Temperature in degrees Celsius
Result Vapor pressure of water in mm Hg at given
temperature
FWPA Weight percent (fraction) of an array. Calculates weight
fraction of each row in a matrix
Larg None
Rarg Numeric matrix
Result Numeric matrix of weight fractions
FWPC Weight percent (fraction) of a vector
Larg None
Rarg Numeric vector
Result Numeric vector of weight fractions
FZDV Zero divide trap, replaces zeroes, ‘0’ with ones, ‘1’. Used on
divisor to prevent domain error in division operations.
Programmers must verify that operation gives valid results
3
Larg None
Rarg Numeric scalar, vector or matrix
Result Numeric scalar, vector or matrix with 1’s replacing
0’s
FZER Set stream data to zero
Larg None
Rarg Vector of streams numbers to be zeroed
Result None

You might also like