1. Notes:
1. Notes
2. User-defined %Variables and associated commands
3. $Functions
4. Commands - single lines
5. Commands - multiple lines
6. OLE commands - Excel Worksheets and Text Spreadsheets
7. Thermochemical, Database, Chemical and Physical $Variables$
'word'
is a character string (use " " if there are spaces)
2 examples: c:\FactSage
"c:\FactSage\My Results"
'number' is a integer, floating point
or scientific number
5 examples: 0 -101
12.34 1.234e-10 -5.678e+100
'string' is one or more words separated
by spaces
1 example: this is a string
'%variable' (or %var for
short) is a word starting with the '%' character and denotes a variable to
which you can assign a value (word, string, number)
ex: %1 %2 ... %9 %DIR
or user-defined variable (see VARIABLE).
'$variable$' - denotes a computed
or defined thermochemical variable (temperature, activity, moles,. ..) that
cannot be modified by you
ex: $E_ET$ (temperature), $E_sn2$ (moles
of species 2), $R_q3$ (quantity
of reactant 3)
'$function' - denotes a
function for displaying system values, manipulating strings, formatting output and
mathematical functions, etc.
ex: $DATE
$FORMATE(12,4,1.2345678)
$MATH((5!-(2-5)^2)/(sqr(abs(2^4-3^5))) $LOG10(1.234e-10)
$EXIST(My.dat)
[] denotes optional.
ex: %var = 'FirstValue' TO 'LastValue' [STEP 'IncrementValue']
%1 = 1 TO 10 %2 = 1 TO 10 STEP 2
() denotes alternatives.
ex: SET ESTIMATE T (P V ALPHA) 'value'
SET ESTIMATE T 1000 SET ESTIMATE ALPHA 0.5
Use DIM or VARIABLE to declare user-defined %variables. DIM '%Var1' '%Var2' ..// First character must be '%' // ex: 'DIM %PAGE %My.Directory. %My.File %Path\\' (note '.' and '\' for visual effect) // All user variables have an initial default value = '0'. // It is not necessary to declare %1 %2.. %9 - they are already are declared for you. // All %variables must be unique and non-ambiguous - avoid short names // - for example %P is not permitted since it can be confused with DIM %PAGE. // Note DIM %12 is not permitted since it can be confused with %1. You can declare tabular variables (1-dimension) and arrays (2-dimension). DIM '%Var1(n)' '%Var2(m)' '%Var3(n:m)' '%Var4(i,m)' '%Var5(i:j,m:n)' // DIM %My.Files(2) => %My.Files(1) %My.Files(2) // DIM %X(0:2) => %X(0), %X(1) and %X(2)) // DIM %B(2,0:3) => %B(1,0) %B(1,1) %B(1,2) %B(1,3) %B(2,0) %B(2,1) %B(2,2) %B(2,3)) // All user tabular variables have an initial default value = '0'. If a variable array has are already been declared, it can be re-dimensioned by using REDIM. DIM A%(2) // => A%(1) A%(2) REDIM A%(0:2,2) // Redimensions A% => %A(0,1) %A(0,2) %A(1,1) %A(1,2) %A(2,1) %A(2,2) Use $ARRAY_DIM(), $ARRAY_COUNT(), $ARRAY_LBOUND() and $ARRAY_UBOUND() for properties of the arrays. DIM %A %B(4) %C(2,3) $ARRAY_DIM(%1) // => 0 : %1 is not an array $ARRAY_DIM(%B) // => 1 : %B() is a 1-dimensional array $ARRAY_DIM(%C) // => 2 : %C() is a 2-dimensional array $ARRAY_COUNT(%B) // => 4 : %B has 4 members - %B(1) %B(2) %B(3) %B(4) $ARRAY_COUNT(%C) // => 6 : %C has 6 members - %C(1,1) %C(1,2) %C(1,3) %C(2,1) %C(2,2) %C(2,3) $ARRAY_LBOUND(%B) // => 1 : lower limit of dimension - %B(1) $ARRAY_LBOUND(%C) // => 1 : lower limit of first dimension - %C(1,*) $ARRAY_LBOUND(%C 1) // => 1 : lower limit of first dimension - %C(1,*) $ARRAY_LBOUND(%C 2) // => 1 : lower limit of second dimension - %C(*,1) $ARRAY_UBOUND(%B) // => 4 : upper limit of dimension - %B(4) $ARRAY_UBOUND(%C) // => 2 : upper limit of first dimension - %C(2,*) $ARRAY_UBOUND(%C 1) // => 2 : upper limit of first dimension - %C(2,*) $ARRAY_UBOUND(%C 2) // => 3 : upper limit of second dimension - %C(*,3) Use $ENUM() to enumerate the members of a user-defined array. DIM %B(4) %C(2,3) %B() = $ENUM(1) // => %B(1) = 1, %B(2) = 2, %B(3) = 3, %B(4) = 1 %B() = $ENUM(0 -2) // => %B(1) = 0, %B(2) = -2, %B(3) = -4, %B(4) = -6 %C() = $ENUM(0) // => %C(1,1) = 0, %C(1,2) = 1, ... %C(2,2) = 4, %C(2,3) = 5 The DEBUG commands are a debugging aid for %variables and have no effect on the macro processing. DEBUG 'options' // Use DEBUG to display the current values of all user-defined %variables DEBUG /ON // Activates the DEBUG Macro Window DEBUG /OFF // Deactivates the debug mode - this is the default setting. DEBUG 'caption' // Lists current values of all %VARIABLES - 'caption' is the display heading DEBUG /DEL %var1 %var2 ... // Drops %var1 %var2 ...from the debug list %DIR and %TITLE are system-defined %variables that you can change %DIR // default directory %TITLE // title of the current application There are a variety of ways to define the value of a %variable. %var = 'value' // set the value of a %variable %var = 'value' ASK 'prompt' // ask for the VALUE (default IS 'VALUE'). The user types in the value. %var = ASK_OK 'question or statement' // Ask the user to agree by clicking on an 'OK' button //- the result is 'OK' or '0' %var = 'default file name' ASK_BROWSE 'file masks | filters' 'statement' // Ask the user to enter a file name using the Windows browser //- the result is the name of the file %var = 'FileName' READ // variable is the line read from the file %var = 'FileName' READ CONTENTS // variable is contents of the text file // including {CR} {Tab} etc. %var = 'FileName' READ LINE // variable is the line read from the text // file (same as READ) %var = 'FileName' READ LINE 'n' // variable is line 'n' in text file ('1' is the first line) // - next READ (or READ LINE or READ WORD) is for line 'n+1' %var = 'TextFileName' READ LINECOUNT // variable is the number of lines in the file %var = 'FileName' READ WORD // variable is first word of the line read from the text file %var = 'FileName' READ WORD 'm' // variable is word 'm' (1 - 9) of the line read // from the text file // - 'READ WORD' is the same as 'READ WORD 1' %var = 'FileName' READ WORDLINE 'm' 'n' // variable is word m of line n in the text file %var = 'FileName' READ LINEWORD 'n' 'm' // variable is word m of line n in the text file %var = FACTOR 'value' // factors (multiplies) %variable by 'value' (see STEP) // i.e. %variable = %variable x 'value' // Same as '%var = $MATH(%var * 'value')' %var = GETMESSAGE // wait for value sent in message (SEND_MESSAGE) %var = HWND 'Title' // variable value is handle of application 'title' %var = READ_INI 'IniFile' 'Section' 'Variable' 'Default' or READINI ... // variable value read from *.ini file %var = WRITE_INI 'IniFile' 'Section' 'Variable' 'Default' or WRITEINI ... // variable value written to *.ini file %var = STEP ['value'] // steps (adds) %variable by +1 (or by "value') (see FACTOR) // i.e. %variable = %variable + 'value' (default 1) // Same as '%var = $MATH(%var + 1)' %var = $Function('arguments') // see 4. Macro $Functions below.3. $Functions
$Functions may be defined by the system as shown here or user-defined - see 5. Commands - multiple lines - FUNCTIONS ... END FUNCTIONS.
$ABS('value1') // Absolute value ex: $ABS(-1.2) -> 1.2 $ARRAY_DIM(), $ARRAY_COUNT(), $ARRAY_LBOUND(), $ARRAY_UBOUND() // Properties of the arrays, for example: // DIM %A %B(4) %C(2,3) // $ARRAY_DIM(%C) => 2 : %C() is a 2-dimensional array // $ARRAY_COUNT(%B) => 4 : %B has 4 members - %B(1) %B(2) %B(3) %B(4) // $ARRAY_LBOUND(%B) => 1 : lower limit of dimension - %B(1) // $ARRAY_UBOUND(%B) => 4 : upper limit of dimension - %B(4) // $ARRAY_UBOUND(%C 2) => 3 : upper limit of second dimension - %C(*,3) $ASC('character') // Ascii value of a character. // ex: $ASC(1) -> 48 ; $ASC(A) -> 65 ; $ASC(a) -> 97 $BLANK // ' ' (white space) - used in WRITE commands $CHEMSAGE_DIR\ or $CHEMSAGEDIR\ // ChemSage directory, typically 'c:\FactSage\CHEMSAGE\' $CHR('value') // Character from its ascii value. // ex: $CHR(48) -> '1' ; $CHR(65) -> 'A' ; $CHR(97) -> 'a' $CONSTANT('gas constant') // Gas constants: Rgas-cal Rgas-J Rgas-L-atm // ex: $CONSTANT(Rgas-J) -> '8.31451' J/mol-K $CONSTANT('unit1/unit2') // Unit conversion. List of units:- // Energy: J kJ mJ cal kcal Mcal Btu kWh // Pressure: bar Pa kPa atm psi mmHg torr // Mass: g gm kg tonne lb // Volume: L liter litre cc cm3 ml m3 dl CuFt Ft3 // ex: $CONSTANT(g/lb) -> '453.59237' g/lb $DATE // current date $ELEMENT_NAME('value') or $ELEMENTNAME ... // convert atomic number to an element // ex: $ELEMENT_NAME(26) -> 'Fe'4. Commands - single lines
$ELEMENT_NUMBER('name') // convert an element to an atomic number // ex: $ELEMENT_NAME(Fe) -> '26'
$ELEMENT_MASS('name' or 'value') // convert an element to an atomic mass
// ex: $ELEMENT_MASS(26) -> '55.847' $ELEMENT_MASS(Fe) -> '55.847' $ENUM('value') or $ENUM('value1' 'value2') // enumerate the members of a user-defined array // DIM %B(4) %C(2,3) // %B() = $ENUM(1) => %B(1) = 1, %B(2) = 2, %B(3) = 3, %B(4) = 1 // %B() = $ENUM(0 -2) => %B(1) = 0, %B(2) = -2, %B(3) = -4, %B(4) = -6 // %C() = $ENUM(0) => %C(1,1) = 0, %C(1,2) = 1, ... %C(2,2) = 4, %C(2,3) = 5 $EXAMPLES_DIR\ or $EXAMPLESDIR\ // examples directory, typically 'c:\FactSage\EXAMPLES\' $EXIST('file name') // If the file exists then $EXIST = 1 (i.e. true) else 0 $EXP('value1') // ex: $EXP(100) -> 2.688...E+43 $FACTDATA_DIR\ or $FACTDATADIR\ // database directory, typically 'c:\FactSage\FACTDATA\' $FACTHELP_DIR\ or $FACTHELPDIR\ // help directory, typically 'c:\FactSage\FACTHELP\' $FACTSAGE_DIR\ or $FACTSAGEDIR\ // directory where FACTWIN.INI resides - same as $FSDIR $FALSE // 0 (zero). Ex: 'IF $EXIST('file name') = $FALSE THEN GOTO END' $FIGURES_DIR\ or $FIGURESDIR\ // figures directory, typically 'c:\FactSage\FIGURES\' $FILE_BYTES('file name') or $FILEBYTES ... // Size of file in bytes // $FILE_BYTES(C:\FactSage\Figures\CaO_SiO2.fig) -> '19127' $FILE_DIR('long file name') or $FILEDIR ... // Directory of a long file name // ex: $FILE_DIR(C:\FactSage\Figures\CaO_SiO2.fig) -> 'C:\FactSage\Figures\' $FILE_NAME('long file name') or $FILENAME ... // File name of a long file name // ex: $FILE_NAME(C:\FactSage\Figures\CaO_SiO2.fig) -> 'CaO_SiO2.fig' $FILE_SHORTDIR('long file name') or $FILESHORTDIR ... // Short name of parent folder // $FILE_SHORTDIR(C:\FactSage\Figures\CaO_SiO2.fig) -> 'Figures\' $FORMATA( 'm' 'string') // Am character format // ex: $FORMATA( 12 Hello) -> ' Hello World' $FORMATE( 'm' 'n' 'value') // Em.n scientific format // ex: $FORMATE( 12 4 1.2345678) -> ' 0.1234E+01' $FORMATF( 'm' 'n' 'value') // Fm.n numerical format // ex: $FORMATF( 12 4 1.2345678) -> ' 1.2345' $FORMATG( 'm' 'n' 'value') // Gm.n general format // ex: $FORMATG( 12 4 1.2345678) -> ' 1.2345' // ex: $FORMATG( 12 4 123.45678e20) -> ' 1.2345e+22' $FORMATI( 'm' 'value' // Im integer format // ex: $FORMATI( 12 1.2345678) -> ' 1' $FSDIR // directory where FACTWIN.INI resides - same as $FACTSAGE_DIR\ $F90IO_DIR\ or $F90IODIR\ // fortran I/O directory, typically 'c:\FactSage\F90IO\' $FIX('value1') // ex: $FIX(4.2) -> 4 // ex: $FIX(-4.2) -> -4 $HWND // handle of current application $INT('value1') // ex: $INT(4.2) -> 4 // ex: $INT(-4.2) -> -5 $LCASE('string') // Lower case characters of 'string'. $LEFT('value' 'string') // 'value' left characters of trimmed 'string'. $LEN('string') // length of trimmed string // ex: LEN I Love U -> 8 $LN('value1') // ex: $LN(100) -> 4.60517... $LOG10('value1') // ex: $LOG10(100) -> 2 $MACFILE // full name of the current macro file $MACROS_DIR\ or $MACROSDIR\ // macros directory, typically 'c:\FactSage\MACROS\' $MATH('mathematical expression') // mixed mathematical expression can include the operators, + - / * ^ \, as well // the common functions abs(), ln(), log10(), exp(), cos(), sin(), tan(), acos(), // asin(), atan(), fix(), int(), sqr(), cbr() and fact(). $MATH(2 - 3) // -> -1 $MATH(2 * 3) // -> 6 $MATH(5 / 3) // -> 1.666666... $MATH(5 \ 3) // -> 1 $MATH(3 ^ 4) // -> 81 $MATH(28-3*9+2^4/16) // -> 2. Same as $MATH((28 - (3*9) + (2^4)/16)) $MATH(240/fact(5)) // -> 2. Same as $MATH(100/5!) $MATH(cos(100)^2 + sin(100)^2) // -> 1. Same as (cos(100))^2 + (sin(100))^2 $MATH(log10(100)) // -> 2. Same as $MATH(ln(100)/ln(10)) $MATH((5!-(2-5)^2)/(sqr(abs(2^4-3^5))) // -> 7.3673... $MAX('value1' 'value2' ...) // Maximum value in the list $MAXI('value1' 'value2' ...) // Item that has the maximum value in the list // $MAX(0 -1.5 2 3) -> 3 // $MAXI(0 -1.5 2 3) -> 4 $MID('value1' 'value2' 'string') // starting at character 'value1' returns //'value2' characters of trimmed 'string' // ex: MID 3 5 I Love U -> 'Love' $MIN('value1' 'value2' ...) // Minimum value in the list $MINI('value1' 'value2' ...) // Item that has the minimum value in the list // $MIN(0,-1.5,2,3) -> -1.5 // $MINI(0,-1.5,2,3) -> 2 $MOD('value1' 'value2') // Modulus (or remainder) operator divides value1 by value2 // (rounding floating-point numbers to integers) and returns only the remainder as result. // $MOD(22,10) -> '2' // $MOD(19.1, 6.7) -> '4' (i.e. 19 modulus 7) $MOLWT('species') // Molecular weight of a chemical species // $MOLWT(H2O) -> '18.01528' $PAGES // number of pages in last calculation $RETVAL // shell process returned value - see 'SHELL_WAIT' $REPLACE('string','old','new') // In 'string' replace all occurences of 'old' by 'new' // $REPLACE(your house and your dog,your,my) -> 'my house and my dog' $RND('min' 'max') // Random floating point number in the range min to max, where min >= 0 and max > min. // $RND(0,1) -> random floating point number in the range 0 to 1 // $RND(1,100.234) -> random floating point number in the range 1 to 100.234 $RND_INT('min' 'max') or $RNDINT ... // Random integer number in the range min to max, where min >= 0 and max > min. // $RNDINT(0,10) -> random integer number in the range 0 to 10 // $RNDINT(1,100) -> random inte3' ger number in the range 1 to 100 $RIGHT('value' 'string') // 'value' right characters of trimmed 'string'. $SCAN_DIR('File-Mask') or $SCANDIR ... // Initiates the scan and returns the number of files or '0' if no files are found. $SCAN_DIR() // Lists the name of first file in the list. $SCAN_DIR() // Lists the name of 2nd file in the list. $SCAN_DIR() // and so on. '0' denotes when all files have been listed. $SORT_DEC('value1' 'value2' ...) or $SORTDEC ... // Sort list by decreasing values $SORT_DECI('value1' 'value2' ...) or $SORTDECI ... // Indexes of the sorted items // $SORT_DEC(1.5 100 50 -50) -> '100 50 1.5 -50' // $SORT_DECI(1.5 100 50 -50) -> ' 2 3 1 4' $SORT_INC('value1' 'value2' ...) or $SORTINC ... // Sort list by increasing values $SORT_INCI('value1' 'value2' ...) or $SORT_INCI ... // Indexes of the sorted items // $SORT_INC(1.5 100 50 -50) -> '-50 1.5 50 100' // $SORT_INCI(1.5 100 50 -50) -> ' 4 1 3 2' $SQRT('value1') // ex: $SQRT(100) -> 10 $STRING('any text') // Used for literal output. Any functions and expressions are not executed. // ex: $STRING(Number of reactants = $M_Mr$) -> 'Number of reactants = $M_Mr$' $TIME // current time $TIME_RUN // time passed (hh:mm:ss) since the start $TIME_RUN_SECS // time passed (seconds) since the start $TIME_INTERVAL // time passed (hh:mm:ss) since last call to $TIME_INTERVAL $TIME_INTERVAL_SECS // time passed (seconds) since last call to $TIME_INTERVAL_SECS $TRIM('string') // Remove leading & trailing blanks $TRUE // 1 (one). Ex: 'IF $EXIST('file name') = $TRUE THEN' $UCASE('string') // Upper case characters of 'string'. $USERID // Customer ID in the range 1 - 9999 $USERNAME // Company name or affiliation.
APPEND 'FileName' 'string' // Append 'string' to end of a text file 'FileName' (see WRITE, WRITELINE) APPEND 'FileName1' FILENAME 'FileName2' // Append file 'FileName2' to end of text file 'FileName1' APPEND 'TextFileName' TAB_LINE(=) // - underline title (previous line) with a '=' (or other character - * ~ etc.) APPEND 'TextFileName' TAB_WORD(-) // - underline words (previous line) with a '-' (or other character = * ~ etc.) separated by spaces APPEND 'TextFileName' TAB_COL('value 1' 'value 2' 'value 3' ....) // Sets tabs for all subsequent APPEND %FILE output - useful for aligning tabular output APPEND 'TextFileName' TAB_JUSTIFY(<) // Left-justify words for all subsequent APPEND %FILE output. // TAB_JUSTIFY(>) - right justify all words, TAB_JUSTIFY(^) - center all words // TAB_JUSTIFY(^ < ^ > ...) - mixed mode, one tab per word. APPEND 'TextFileName' TAB_COL(0) // Cancel tabs. APPEND 'file' TAB_COL(5 10 20 35) // In 'file' set tabs at columns 5, 10, 20, 35 ... APPEND 'file' 1 2 3 4 // 1 2 3 4 APPEND 'file' 1.1 22.2 333.3 4444.4 // 1.1 22.2 333.3 4444.4 APPEND 'file' TAB_COL(0) // Cancel tabular output // See EQUIEx_TABS.mac for examples of TAB_LINE(), TAB_WORD(), TAB_COL() and TAB_JUSTIFY(). CALC // press Equilib 'Calculate >>' button CAPTION 'string' // set macro window caption CLOSE 'Filename' // used with READ - go to beginning of file COPY 'Source' 'Target' // copy .txt, .res, .tab, .xls, .fig files DEBUG /ON // Activates the DEBUG Macro Window DEBUG /OFF // Deactivates the debug mode - this is the default setting. DEBUG 'caption' // Lists current values of all %VARIABLES - 'caption' is the display heading DEBUG /DEL %var1 %var2 ... // Drops %VARIABLES from the debug list // The DEBUG commands are a debugging aid and have no effect on the macro processing. DELETE 'FileName' // delete .txt, .res, .tab .xls, .fig files // (same as KILL) DIM '%Var1' '%Var2' .. // DIM is the same as VARIABLE. See also REDIM // declare user variables. First character must be '%' // ex: DIM %PAGE %My.Directory. %My.File %Path\ // Note '.' and '\' to improve recability // All user variables have an initial default value = '0'. DIM '%Var1(n)' '%Var2(m)' '%Var2(n:m)' // declare user tabular variables (dimensions). // ex: %My.Files(2) (i.e variables %My.Files(1) and %My.Files(2)) // Ex: %X(0:2) (i.e variables %X(0), %X(1) and %X(2)) // All user tabular variables have an initial default value = '0'. ERROR_OFF or ERROROFF // suppress error handling (see ERROR_ON) - use with caution! ERROR_ON or ERRORON // resume error handling (see ERROR_OFF) - this is the default setting. END // last line in the macro file EXIT // quit (see TERMINATE) FACTOR // %var = FACTOR 'value' // - factors (multiplies) numerical %variable by 'value' // i.e. %var = %var x 'value'. Same as %var = $MATH(%var * 'value') // ex: %4 = 10 // %4 = FACTOR 0.5 => new %4 = current %4 x 0.5 i.e. %4 = '5'. Same as %4 = $MATH(%4*0.5) FIGURE 'Filename1.fig' // display the figure stored in .fig file (see VIEWER) FIGURE 'Filename2.fig' SUPERIMPOSE // superimpose a figure on to previous one FUNCTION // see 5.5 FUNCTIONS ... END FUNCTIONS GOTO 'word' // jump to a marker - used with MARK 'word' // A GOTO statement cannot be inside IF ....ENDIF GOTO END // jump to the end - i.e. quit' HIDE // hide FactSage module HIDE_MACRO or HIDE_MACRO // hide the macro window (see SHOW_MACRO) IF 'Value1' = [< > =< >= <>] 'Value2' GOTO 'mark' // 'IF' statement has 6 words (also see IF ... THEN ... ENDIF) INSERT 'FileName' // insert text 'FileName' into current macro. INSERT GETMESSAGE // waits & inserts message (SEND_MESSAGE) into current macro. KILL 'FileName' // delete .txt, .res, .tab .xls, .fig files (same as DELETE) LOAD_ONLY or LOADONLY // loads (opens) Equi*.dat (or Phas*.dat) without calculating. Units $R_*$, Database $D*$, // Reactant $U_*$ and Menu $M_*$ Window variables are defined (but not Equilibrium $E_?*$) LOG 'Filename' // log session in file (default macro.log) MARK 'word' // a marker - used with GOTO 'word' // A MARK statement cannot be inside IF ....ENDIF // nor in a LOOP or DOCASE. MSGBOX 'string' // post a message MSGBOX FILENAME 'Filename' // post contents of a file NAME 'FileName1' 'FileName2' // Rename 'FileName1' as file 'FileName2' // - 'FileName2' must be one of .txt, .res, .tab, .xls, .fig or .xml // Warning, if file 'FileName2' already exists it will be replaced. OLEn // see 6. OLE commands - Excel Worksheets and Text Spreadsheets OPEN 'FileName' // open (load) EQUI*.DAT, PHAS*.DAT files PAGE_KEEP or PAGEKEEP // Keep results from previous CALC(s) and // append current CALC results as new pages. PAGE_NEW or PAGENEW // (Default setting) - negates option PAGE_KEEP PAUSE // issue prompt to resume or quit processing PAUSE 'value' // wait 'value' seconds (same as WAIT 'value') PRINT_OFF or PRINTOFF // suppress listing in the macro window PRINT_ON or PRINTON // resume listing in the macro window POST_MESSAGE 'TargetHwnd' 'string' or POSTMESSAGE ... // post message in another application POST_MESSAGE 'TargetHwnd' FILENAME 'Filename' // post file contents in another application. PROCEDURE // see 5.6 PROCEDURES ... END PROCEDURES QUIT // exit REDIM '%Var1' '%Var2(m)' '%Var3(n:m)' // Redefine tabular variable declaritions (dimensions). // DIM %My.Files(2) %X(0:2) // REDIM %My.Files(1:2) %X(5) REM 'string' // comments line in the macro window REWIND 'Filename' // used with READ - go to top of file. RUNMACRO 'filename.mac' [command] // quit the current application and run a new macro (optional command line). SAVE 'Equi*.RES' // save results in a *.RES file accessible by module RESULTS SAVE 'Name.FIG' // save figure in a *.FIG file accessible by module FIGURE SAVE 'Name.TAB' // save spreadsheet in a text *.TAB file. SAVE 'Name.XLS' ['Sheet-Name'] [/SWAP] ['top-left-cell'] // save in excel spreadsheet *.XLS file. // - 'Sheet-Name' is an optional word // - /SWAP to exchange rows and columns // - 'top-left-cell' is the top left cell (default 'A1'). SAVE 'name.XML' // save spreadsheet in a *.XML file. SAVE 'MIXT*.DAT' GAS (LIQUIDS SOLIDS SOLUTIONS 'phase-name') // save results in a MIXT*.DAT stream SEND_MESSAGE 'TargetHwnd' 'string' or SENDMESSAGE ... // send message to another application SEND_MESSAGE 'TargetHwnd' FILENAME 'Filename' // send file contents to another application. SET EQUILIBRIUM NORMAL (TRANSITIONS TRANSITIONSONLY OPEN) // normal equilibrium calculation, or TRANSITIONS - normal and phase transitions, // or TRANSITIONSONLY - only phase transitions, or OPEN - open calculation SET COLOR 'RedValue' 'GreenValue' 'BlueValue' // RGB format 0 - 255 (color in Figure or Phase Diagram) SET COLOR LIMITS 'MinValue' 'MaxValue' // Lower and upper values (typically T) - used with SET COLOR VALUE SET COLOR VALUE 'Value' // value (typically T) in the range 'MinValue' 'MaxValue' - see SET COLOR LIMITS SET DATASEARCH GION (NOGION AQUA NOAQUA CXHY MINS1) // include/exclude gaseous ions, include/exclude aqueous species, // CxHy value, min. solution components (1 or 2) SET ESTIMATE T (P V ALPHA) 'value' // Redefine estimate of final T, P, V or ALPHA. SET FINAL A (B T P Z) 'value' // Redefine final <A>, <B>, T, P or Z (extensive property value). SET FINAL Z H (V G S C) // Redefine variable Z (extensive property variable) as Delta H (V G S or Cp). SET OUTPUT = display FORMAT FACT CHEMSAGE // Output Window = display FACT format and then ChemSage format SET OUTPUT FORMAT CHEMSAGE FACT // Output Window = display ChemSage format and then FACT format SET OUTPUT FORMAT FACT // Output Window = display FACT format only SET OUTPUT FORMAT CHEMSAGE // Output Window = display ChemSage format only SET OUTPUT FORMAT KEEP // The change in the output format is permanent. // When the macro processing is finished the display returns to the former setting unless KEEP is employed. SET PARAMETERS 'options' // Parameters Window settings to control the output in the Output Window or Phase Diagram. // - note that ON (or OFF) may be replaced by 1 (or 0) SET PARAMETERS PRINT CUTOFF 'limit' // lower limit for activities and concentrations SET PARAMETERS PRINT BONDS ON (OFF) // display bond fractions SET PARAMETERS PRINT STABLE ON (OFF) // only display stable phases - i.e. activity = 1 SET PARAMETERS PRINT DATA NEVER (ALWAYS ONLY) // NEVER display the name(s) of the database(s) // ALWAYS display the name(s) of the database(s) // ONLY display the name(s) of the database(s) if there is more than one compound or one solution database SET PARAMETERS PRINT [KEEP] // The change in the output format is permanent. // When the macro processing is finished the output returns to the former setting unless KEEP is employed. SET PARAMETERS TARGET T (P V ALPHA) 'minimum' 'maximum' // set target limits // note TARGET ALPHA limits are fixed at '1.0e-5' and '1' SET PARAMETERS TARGET DEFAULT // return all target limits to default settings SET PARAMETERS DISPLAY FULLSCREEN (COLOR TITLE SUBTITLE) ON (OFF) // set phase diagram screen display options SET PARAMETERS SHOW STATUS (TIELINES WARNING LABELS) ON (OFF) // set phase diagram output options SET PARAMETERS LABELS LABELSIZE '1-9' SET PARAMETERS LABELS LABELCOLOR 'color' (or '0-15') // set phase diagram label colors // colors BLACK MAROON GREEN OLIVE NAVY PURPLE TEAL GRAY SIVER RED LIME YELLOW BLUE FUSHIA AQUA WHITE // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 SET PARAMETERS LABELS BOLD (ITALIC UNDERLINE) ON (OFF) // set phase diagram label properties SET PARAMETERS LABELS LINEWIDTH '1-20' // set phase diagram label width 0.1 - 2.0 mms SET PARAMETERS LABELS LINECOLOR 'color' (or '0-15') // set phase diagram line color SET PARAMETERS LABELS ALWAYS (ONLY SHOWS) ON (OFF) // set phase diagram label display SET PARAMETERS LABELS CHEMICAL (NUMERICAL DEFAULT) // set phase diagram label format SET PARAMETERS ISOT COLOR (COLORTBAR BYPHASE TVALUE TUNITS PHASE) ON (OFF) // set phase diagram isothermal display properties SET PARAMETERS POLYTHERMAL LISTTMINMAX (LISTINTCOMPOSITIONS LABELSURFACE LABELINTNORT) ON (OFF) // set phase diagram polythermal display properties SET PARAMETERS POLYTHERMAL DISPLAYFIGURE (DISPLAYPAGE DISPLAYBOTH) // set phase diagram polythermal display properties SET PARAMETERS POLYTHERMAL LABELINTN (LABELINTT) // set phase diagram polythermal display properties SET PARAMETERS POLYTHERMAL LABELINTPOINT ON (OFF) // set phase diagram polythermal display properties SET PARAMETERS POLYTHERMAL NORTCOLOR 'color' (or '0-15') // set phase diagram polythermal display properties SET PARAMETERS POLYTHERMAL POINTCOLOR 'color' (or '0-15') // set phase diagram polythermal display properties SET PLOT AXIS/CAPTION/LABELS/DISPLAY/SELECT 'options' // SET PLOT commands for the Post Processor and Plot Species Selection Windows. SET PLOT AXIS Y-AXIS (X-AXIS) 'property' 'function' 'minimum' 'maximum' 'step' // where 'property' is one of: n X gram % alpha T P Cp G V H V S or page // where 'function' is one of: Y log10(Y) ln(Y) exp(Y) or 1/Y SET PLOT CAPTION TITLE 'title' // figure title SET PLOT CAPTION SUBTITLE 'sub-title' // and subtitle SET PLOT CAPTION Y-TITLE (X-TITLE) ' title' // axes captions SET PLOT CAPTION LABEL 'X' 'Y' 'label #1' // coordinates and user-defined label SET PLOT DISPLAY COLOR ON (OFF) // color (or B/W) SET PLOT DISPLAY COLORS 9 12 2 ... // color numbers 0 - 14 SET PLOT DISPLAY COLORS RED BLUE GREEN ... // color names BLACK MAROON ... AQUA // colors BLACK MAROON GREEN OLIVE NAVY PURPLE TEAL GRAY SIVER RED LIME YELLOW BLUE FUSHIA AQUA // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 SET PLOT DISPLAY REACTANTS ON (OFF) // list reactants in the title (if CAPTION TITLE not set) SET PLOT DISPLAY FILE_NAME ON (OFF) // list soyurce file in subtitle (if CAPTION SUBTITLE not set) SET PLOT DISPLAY SOURCE ON (OFF) // include data source in species label SET PLOT DISPLAY PHASE ON (OFF) // include phase name in species label SET PLOT DISPLAY NAME ON (OFF) // include species name in species label SET PLOT LABELS SIZE 2 (2 - 24) // size of labels SET PLOT LABELS NO 2 (1 - 9) // number of labels per plotted line line SET PLOT LABELS CHEMICAL (INTEGER or NONE) // type of label SET PLOT LABELS OFFSET ON (OFF) // offset labels above their coordinates SET PLOT SELECT CLEAR // clear current species salection SET PLOT SELECT MASS MOLE (GRAM) // mass units SET PLOT SELECT ORDER INTEGER (MASS FRACTION or ACTIVITY) // order with respect to integer or mass ... SET PLOT SELECT TOP 1 (2 ...) // select top species as defined in ORDER SET PLOT SELECT IGNORE ON (OFF) // ignore species and phase that have no mass SET PLOT SELECT STABLE PHASE (LIQUID SOLID SOLUTION) // select all stable phases (ALL S TABLE PURE LIQUIDS ...) SET PLOT SELECT SPECIES 2 5 8 // select species 2 5 and 8 SET REACTANT DEL 'reactant#' ('chemical_formula' or '[stream]') // Delete (remove) an existing reactant SET REACTANT ADD 'chemical_formula' or '[stream]' ['phase_name' ['steam_#'] ] // Add a new reactant (compound species or stream) SET REACTANT 'reactant#' ('chemical_formula') MASS (T P) 'mass' ('temperature' 'pressure') // define a reactant mass (T or P) SET REACTANT '[stream]' MASS (T P) 'mass' ('temperature' 'pressure') // define reactant input stream mass (T or P) SET REACTANT ALL MASS (T P) 'mass#1' (T#1 P#1) 'mass#2' (T#2 P#2) .... // define all reactant masses (T's or P's) SET SELECT COMPOUND + (or - !) [NICK [SPECIES]] SET SELECT SOLUTION + (or - !) [NICK-Phase [SPECIES]] SET SELECT GAS (or LIQUID AQUEOUS SOLID) + (or - !) [NICK [SPECIES]] // + to add, - to remove, ! for dormant (metastable). // NICK is the database 4-6 letter nickname. // Species is the chemical formula. SET SPECIES 'chemical_formula' ACTIVITY (or ACT or LOGACT) 'value' ['value2' 'value3'] // Define equilibrium activity or log10(activity) values(s) of an 'ACTIVITY species'. // For a range define 3 values - 'first last increment' . SET SPECIES ADD ACTIVITY 'chemical_formula(state)' 'compound_database' // Identify a new 'ACTIVITY species'. SET SPECIES DEL ACTIVITY 'chemical_formula' 'compound_database' // Drop an 'ACTIVITY species'. // Example of ACTIVIY commands is in EquiEx_CH4-O2_Activity.mac (new in 7.1) located in the /Macros folder. SET SUBTITLE 'String' // phase diagram subtitle SET TITLE 'String' // phase diagram title SET UNITS TK (TC TF) ATM (BAR PSI PA) J (CAL BTU KWH) // define units SET VARIABLES T (P A1 A2 .. C1 C2 ..) MIN (MAX) 'value' // set minimium (maximaum) product temperature (pressure, A - chemical potential, C - compostion) SET VARIABLES T STEP 'value' // step in temperature (polythermal projection) SET VARIABLES T DEFINE ON (OFF)' // temperature is defined (or not defined - i.e. blank) SET VDP ON (OFF) // include (or exclude) the 'VdP' term. SHELL 'CommandLine' // shell command SHELL_EXECUTE 'string' or SHELLEXECUTE ... // open a .doc, .fig, .txt, .xls, etc. file in the default Windows application. SHELL_WAIT 'CommandLine' or SHELLWAIT ... // shell and wait for return value $RETVAL SHOW 'FileName' // show .txt, .res, .tab, .xls, .fig files // and wait until 'GO' button is pressed. SHOW_GO 'FileName' or SHOWGO ... // same as SHOW but keep going (no pause) SHOW_LAST_PD or SHOWLASTPD // show last phase diagram. SHOW_MACRO or SHOWMACRO // show the macro window (see HIDE_MACRO) STEP 'variable' 'value' // increments 'variable' by 'value' STOP // press the macro 'STOP' button TERMINATE // quit and then terminate the module (see QUIT) TIME 'FileName' // stores current time in a text file // - same as WRITE 'FileName' $TIME VARIABLE '%Var1' '%Var2' .. // VARIABLE is the same as DIM // declare user variables. First character must be '%' // ex: %PAGE %My.Directory. %My.File %Path\ (note '.' and '\' visual for effect) // All user variables have an initial default value = '0'. VARIABLE '%Var1(n)' '%Var2(m)' '%Var3(n:m)' // declare user tabular variables (dimensions). // ex: %My.Files(2) (i.e variables %My.Files(1) and %My.Files(2)) // Ex: %X(0:2) (i.e variables %X(0), %X(1) and %X(2)) // All user tabular variables have an initial default value = '0'. VIEWER 'Filename1.fig' or VIEWFIG or VIEWFIGURE ... // view the figure stored in .fig file (see FIGURE) // Unlike Figure, Viewer can display many figures at the same time. VIEWTEXT 'Filename1.txt' // display the contents of a text file WAIT // issues prompt to resume or to quit WAIT 'Value1' // pauses 'Value1' seconds (same as PAUSE 'value1') WINDOWS LOG_OFF (LOGOFF) // quit all applications and logoff the PC WINDOWS REBOOT // quit all applications and reboot the PC WINDOWS SHUTDOWN // quit all applications and shutdown the PC WRITE 'FileName' 'string' // store 'string' in 'FileName', see APPEND, WRITELINE WRITELINE 'TextFileName' 'n' 'string' // Write 'string' to line 'n' of the text file WRITEINI 'IniFile' 'Section' 'Variable' 'Value' // variable value written to *.ini file (see READ_INI) WUFE 'FileName' // Wait Until 'FileName' Exists (used to control events) WUME HWND 'Message' // Wait Until 'Message' from HWND[0] exists5. Commands - multiple lines
5.1 Simple LOOP %var = 'FirstValue' TO 'LastValue' [STEP 'IncrementValue'] (macro lines) %var LOOP // End of loop. If %var line <> 'LastValue' // then go back to beginning, redefine %var and repeat. // A %var LOOP is always executed at least once ('FirstValue'). // If STEP is undefined then '1' is assumed. 5.2 Nested LOOPs %var1 = 'FirstValue1' TO 'LastValue1' [STEP 'IncrementValue1'] %var2 = 'FirstValue2' TO 'LastValue2' [STEP 'IncrementValue2'] %var3 = 'FirstValue3' TO 'LastValue3' [STEP 'IncrementValue3'] (macro lines) %var3 LOOP // End of %var3 loop. %var2 LOOP // End of %var2 loop. %var1 LOOP // End of %var1 loop. 5.3 IF...ENDIF IF 'value1' '?' 'value2' THEN // The first statement, '?' may (macro lines) // contain 'AND' or 'OR' operators. ... ELSEIF 'va1ue3' '?' 'value4' THEN // One or more ELSEIF statements (macro lines) // are optional. ... ELSE // One ELSE statement is optional. (macro lines) ... ENDIF // ENDIF statement must be present 5.4 DOCASE ... ENDDO DOCASE %var // The first statement defines the %variable CASE 'val1' ['val2' 'val3' ...] // If %var has value 'val1' (or 'val2' or 'val3'..) ... // execute these macro lines. CASE 'val4' ['val5' 'val6' ...] // If %var has any one of these values ... // execute these macro lines. CASE 'val1' TO 'val2' // If %var is in the range 'val1' to 'val2' ... // execute these macro lines. CASE IS 'operator' 'val1' /where operator is one of < > <> >= or <= . // If %var satisfies the condition ... // execute these macro lines. CASE ... etc CASE ELSE // Optional CASE ELSE - if none of the above are true ... ENDDO // ENDDO statement must be present 5.5 FUNCTIONS ... END FUNCTIONS FUNCTIONS // The format of a user-defined function is : // FUNCTION $'function name'('arguments') // - $'function name name' is any alphanumeric description starting with $. // - 'arguments' are values passed from the main body. // ....macro lines (where 'output variables' are defined) // $'function name' = 'value' (where the value of function is defined) // END FUNCTION FUNCTION $My-Whatever(arg1 arg2 ...) ... macro lines $My-Whatever = 'value' END FUNCTION FUNCTION $My-Another(arg1 arg2 ...) ... macro lines $My-Another = 'value' END FUNCTION END FUNCTIONS 5.6 PROCEDURES ... END PROCEDURES PROCEDURES // The format of a procedure is : // 'procedure name'('arguments') // - 'procedure name' is any alphanumeric description // - 'arguments' are values are defined in the main body. // ... macro lines where 'output variables' are defined) // END 'procedure name' SUB_CheckDim(%A) .... (macro lines) END SUB_CheckDim SUB_Another(C%) .... (macro lines) END SUB_Another END PROCEDURES6. OLE commands - Excel Worksheets and Text Spreadsheets - linking via OLEn
A Text Spreadsheet (introduced in FactSage 7.0) is stored in a *.txt or *.tab ascii file. It offers simplicity and speed when compared with the Excel Worksheet. There are often situations where the Text Spreadsheet is preferred to the Excel Worksheet especially in cases where data are simply being posted or manually entered. However data in a Text Spreadsheet cannot be shared with other applications nor can the data be manipulated by the Excel functions.
The Equilib macro processing enables you to create up to 9 simultaneous dynamic links (OLE1 to OLE9)
This advanced feature permits Object Linking and Embedding (OLE)
with an Excel Worksheet and/or Text Spreadsheet.
A simple example is given in the macro file
EquiEx_Xls_Simple_IO.mac (this example is expanded in FactSage 7)
and a more complicated one in EquiEx_CH4-O2-c.mac.
OLEn: OLEn 'ExcelFileName' ['Sheet-Name'] // Create an OLE link (n = 1 to 9) with an Excel Worksheet stored in an Excel Worksheet file (*.xls,*.xlsx). // ex: 'OLE1 MyExcel.xlsx Input' - creates a link to the 'Input' Spreadsheet of the Excel file. OLEn 'TextFileName' ['Sheet-Name'] // Create an OLE link (n = 1 to 9) with a Text Spreadsheet stored in an ascii file (*.txt,*.tab). // ex: 'OLE1 MyText.txt Input' - creates a link to the 'Input' Spreadsheet of the Text file. // You can create more links with different Worksheets in different Text files . // ex: 'OLE2 MyMoreText.tab Output' - creates a second link to the 'Output' Text Spreadsheet. // Many of the following commands are shown in EquiEx_Xls_Simple_IO.mac located in the /Macros folder. OLEn CLOSE // close the Spreadsheet; you will be prompted to save OLEn CLOSE SAVE // close and save the Spreadsheet without prompting OLEn CLOSE SAVE 'ExcelFileName' // close and save Excel Worksheet in a different *.xls or *.xlsx file OLEn CLOSE SAVE 'TextFileName' // close and save Text Spreadsheet in a different *.txt or *.tab file OLEn QUIT // close the Spreadsheet without saving OLEn CELLS ALL 'options' // apply options to all cells in the Worksheet OLEn COLUMNS 'F:F' 'options' // apply options to column F OLEn ROWS '2:3' 'options' // apply options to rows 2 and 3 OLEn RANGE 'B1:C4' 'options' // apply options to a range B1:C4 or R1C2:R4C3 OLEn NAME 'NAME' 'options' // apply options to a range name // List of 'options' for both Excel Worksheets and Text Spreadsheets : AUTOFIT // auto fit column width // ex: 'OLE1 CELLS ALL AUTOFIT' auto fits all cells in the Spreadsheet BOLD TRUE (FALSE) // Bold text - TRUE is default. BOLD may be replaced by: // ITALIC, SHADOW, STRIKETHROUGH, SUBSCRIPT, SUPERSCRIPT or UNDERLINE // ex: OLE1 ROWS 2:3 UNDERLINE CENTER (LEFT RIGHT) // alignment of contents in each cell CLEAR // clear the contents in each cell COLOR 'color' // text color where 'color' is one of BLACK, MAROON, GREEN, // OLIVE, NAVY, PURPLE, TEAL, GRAY, SILVER, RED, LIME, YELLOW, BLUE, FUSHIA, AQUA or WHITE COLOR RGB(i,j,k) // RGB color where i, j and k in the range 0 - 255 // ex: 'OLE1 RANGE A1:C:4 COLOR RGB(0,0,255)' - same as 'COLOR BLUE' FONTSTYLE 'font style' // font style ex: 'Bold_Italic' - use _ for spaces // ex: 'OLE1 RANGE R1C1:R3:C3 FONTSTYLE Times_New_Roman' HEIGHT 'value' // set rows to a common height SIZE 'value' // set font size to a commo value WIDTH 'value' // set columns to a common width OLEn GOTO 'RnCm' // put focus on this cell - scroll vertically and horizontally if necessary. // ex: 'OLEn GOTO R22C33' makes sure cell at row 22 column 33 is visible on the screen %var OLEn READ 'An' ('RnCm' 'An:Bm' 'RnCm:RiCj' 'name') // variable value(s) read from cell (or row & column or range). // ex: B5 R5C6 B5:D10 R5C2:R10C4 RangeName %var OLEn WRITE 'An' ('RnCm' 'An:Bm' 'RnCm:RiCj' 'name') // variable value(s) written to cell (or row & column or range). NAME OLEn CLEAR 'name' // clear the contents of a range name in the Spreadsheet NAME OLEn DELETE 'name' // delete the range name in the Spreadsheet NAME OLEn NEW 'name' 'An' 'Bn:Cm' ('RnCm:RiCj') // define a new range name in the Spreadsheet ERROR_OFF // Suppress error handling (also see ERROR_ON) - use with caution ! // This is not an OLE command but it is very useful in OLE processing. Minor link errors are often posted during // dynamic interaction with the Excel Worksheet. This command simply suppresses the offending error messages.7. Database, Thermochemical, Chemical and Physical $Variables$ ...
Thermochemical, Database, Chemical and Physical $Variables$ include
$DB_C_*$, $DB_S_*$, $E_*$,
$M_*$, $R_*$, $U_*$
Thermochemical variables are case sensitive and system dependent.
They are defined by the Equi*.dat (or Phas*.dat) file or calculated during the equilibrium
calculation ('CALC') and cannot be modified by you (except by editing the
Equi*.dat or Phas*.dat file) - see the 'SET' macro command for the thermochemical
variables that you can modify.
An example of the common thermochemical
variables is given in the macro file EquiEx_List_Results.mac
A complete example of most calculated thermochemical variables including solution
intregral and partial properties and component lists are given in the macro
files EquiEx_List_Thermo.mac and
EquiEx_List_Thermo_Functions.mac
An example of the 'SET' command is given in the macro file EquiEx_SET_Variables.mac.
Database search options $DS_*$ * = GION, AQUA, CXHY, MINS $DS_GION$ : 0 = exclude gas ions, 1 = include gas ions $DS_AQUA$ : 0 = exclude aqueous phase, 1 = include aqueous phase $DS_CXHY$ : value of X ( 1 to 99) $DS_MINS$ : 1 = minimum 1 component solutions, 2 = minimum 2 component solutions, Databases: Compound $DB_C_*$ and Solution $DB_S_*$ values, $DB_?_*$, ? = C or S, * = 1 - no limit $DB_?_M$ = number of selected compound (? = C) or solution (? = S) databases $DB_?_F*$ = file name of selected database * $DB_?_P*$ = path and file name of selected database * $DB_?_N*$ = nick name of selected database * $DB_?_I*$ = information about selected database * $DB_?_V*$ = selected database version * $DB_?_T*$ = time and date of selected database * Legend: - note, all thermochemical variables are case sensitive, for example upper case 'A' is 'Alpha' and lower case 'a' is 'activity'. A = Alpha a = activity B = Beta C = Cp heat capacity c = compound (pure substance) or molar cp D = data source E = extended name (data source and name) e = elements (+ electron phases) i.e. components F = total Gibbs free energy f = molar Gibbs free energy g = grams h = molar enthalpy H = total enthalpy i = integer j = integer l = lbs M = maximum number (total) m = mixture (solution) N = Name n = moles P = Pressure q = quantity (amount) - see input reactant R = Raoultian activity coefficient (gamma) - a = R.X r = reactant T = temperature V = Volume S = entropy s = species or molar entropy X = mole fraction x = excess U = units V = volume W = Weight % w = molecular weight Z = atomic number Units Window: $U_U?$ or $E_U?$ : ? = E, M, P, T, V $U_UE$ = units of energy : 'J' 'cal' 'Btu' or 'kWh' $U_UM$ = units of mass : 'mole' 'gram' or 'ft3' $U_UP$ = units of pressure : 'bar' 'atm' 'psi' or 'Pa' $U_UT$ = units of temperature : 'K' 'C' or 'F' $U_UV$ = units of volume : 'litre' or 'ft3' $E_UE$ = units of energy etc... Reactant Window - Reactant Values: $R_?*$ : ? = g, l, M, N, n, q, T, P, w, Z; * = 1 - 48. $R_M$ = number of reactants $R_Mr$ = number of reactants $R_Me$ = total elements (+ electron phases) i.e. components $R_g*$ = grams of reactant * $R_l*$ = lbs of reactant * $R_N*$ = Name (chemical formula) of reactant * $R_n*$ = moles of reactant * $R_q*$ = quantity (amount) of reactant * $R_T*$ = Temperature of reactant * $R_P*$ = Pressure of reactant * $R_w*$ = molecular weight of reactant * Reactant Window - Elemental Values of Reactants: $R_ei_?*$ : ? = N, n, q, w, Z; * = 1 - 48. $R_ei_N$ = element i (1 - 48) name (chemical symbol) $R_ei_Z$ = element i (1 - 48) atomic number (0 - 99) $R_ei_w$ = element i (1 - 48) atomic weight $R_ei_n$ = total moles of element i (1 - 48) in all reactants $R_ei_g$ = total grams of element i (1 - 48) in all reactants $R_ei_n*$ = input moles of element i (1 - 48) in reactant * $R_ei_g*$ = input grams of element i (1 - 48) in reactant * Menu Window Values: $M_M?$ - maximum number : ? = e, i, m, p, r, s - these values refer to the selected species (i.e. not the total species that are available) $M_Me$ = total elements (+ electron phases) i.e. components $M_Mi$ = total number of species in solutions $M_Mm$ = total number of mixtures (solutions) $M_Mp$ = total number of compound species (gas, aqueous, liquid, solid) $M_Mr$ = total number of reactants $M_Ms$ = total number of species = $M_Mi$ + M_Mp$ $M_Mm*$ = total number of species in mixture * = 1 - 150 Equilibriumm Values: All the remaining functions are $E_...$ - these values are only defined after the equilibrium has been calculated (CALC) i.e. $E_OK$ = 'OK' Extensive Property Values: $E_E?$, $E_D?$ ; ? = A, B, C, F, G, H, P, S, T, V - these values are only defined after the equilibrium has been calculated (CALC) i.e. $E_OK$ = 'OK' Absolute values: $E_E?$ $E_EA$ = Alpha (4 decimal places) $E_Ea$ = Alpha (free format) $E_EB$ = Beta $E_EC$ = Cp heat capacity $E_EF$ = Gibbs Free Energy $E_EG$ = Gibbs Free Energy $E_EH$ = Enthalpy $E_EP$ = Pressure $E_ES$ = Entropy $E_ET$ = Temperature (2 decimal places) $E_Et$ = Temperature (free format) $E_EV$ = Volume Property Changes: $E_D?$ ; ? = OK, C, F, G, H, S, V $E_DOK$ = 'OK' when delta values calculated (e.g. initial conditions defined) $E_DC$ = Delta Cp heat capacity $E_DF$ = Delta Gibbs Free Energy $E_DG$ = Delta Gibbs Free Energy $E_DH$ = Delta Enthalpy $E_DS$ = Delta Entropy $E_DV$ = Delta Volume Atoms: $E_zi_?$ - atom i = 1 - 99 (1=H 2=He 3=B ...); ? = g, N, n, w - these values are only defined after the equilibrium has been calculated (CALC) i.e. $E_OK$ = 'OK' $E_zi_g$ = total grams of atom i in products (e.g. $E_z1_g$ = total grams of H) $E_zi_n$ = total moles of atom i in products (e.g. $E_z17_n$ = total moles of Cl) $E_zi_N$ = atom i name (chemical symbol) (e.g. $E_z6_N$ = 'C') $E_zi_w$ = atom i atomic weight (e.g. $E_z6_w$ = 12.0107) $E_zi_mg*$ = total grams of atom i in product mixture * (e.g. $E_z1_mg1$ = total grams of H in the gas) $E_zi_mn*$ = total moles of atom i in product mixture * (e.g. $E_z17_mn2$ = total moles of Cl in mixture 2) $E_zi_sn*$ = total moles of atom i in product species * $E_zi_sg*$ = total grams of atom i in product species * Elements: $E_ei_?$ - elements (components) i = 1 - 48; ? = g, N, n, w, Z - these values are only defined after the equilibrium has been calculated (CALC) i.e. $E_OK$ = 'OK' $E_ei_g$ = total grams of element (component) i in products $E_ei_n$ = total moles of element (component) i in products $E_ei_N$ = element (component) i name (chemical symbol) $E_ei_Z$ = element (component) i atomic number (1 - 99) $E_ei_w$ = element (component) i atomic weight $E_ei_mn*$ = total moles of element (component) i in product mixture * (1 - 150) $E_ei_mg*$ = total grams of element (component) i in product mixture * (1 - 150) $E_ei_sn*$ = total moles of element (component) i in product species * (1 - 3000) $E_ei_sg*$ = total grams of element (component) i in product species * (1 - 3000) Species: $E_s?*$ - product species * = 1 - 3000; ? = a, D, d, E, f, g, h, l, N, n, R, s, W, w, X ... - these values are only defined after the equilibrium has been calculated (CALC) i.e. $E_OK$ = 'OK' $E_sa*$ = species activity $E_sD*$ = species data source $E_sd*$ = species density (g/l) - compounds only $E_sE*$ = species extended name (data source and name) $E_sf*$ = species partial molar Gibbs free energy G $E_sg*$ = species grams $E_sh*$ = species partial molar H $E_sl*$ = species lbs $E_sN*$ = species name $E_sn*$ = species moles $E_sR*$ = species Raoultian activity coefficient (gamma) $E_ss*$ = species partial molar S $E_sW*$ = species wt.% $E_sw*$ = species molecular weight $E_sX*$ = species mole fraction $E_si_?$ = species code number 1 - 3000, ? = species name (or extended name) $E_s0f*$ = species partial molar standard state (zero) G $E_s0h*$ = species partial molar standard state (zero) H $E_s0s*$ = species partial molar standard state (zero) S $E_sxf*$ = species partial molar excess G $E_sxh*$ = species partial molar excess H $E_sxs*$ = species partial molar excess S $E_sMc$ = number of compound species $E_sMn$ = number of solution species $E_sMs$ = number of species = $E_sMp$ + $E_sMc$ Maximum values: $E_M?$ - total values where ? = e i m P p s S gas liquid aqueous solid ... - these values refer to the selected species (i.e. not the total species that are available) $E_Me$ = total elements (+ electron phases) i.e. components $E_Mi$ = total number of solution species from the solution databases (i.e. excludes gas, aqueous) $E_MI$ = total number of solution species including gas and aqueous species $E_Mm$ = total number mixtures (solutions) $E_Mp$ = total number of compound species $E_MP$ = total number of compound species in calculation including standard states $E_Ms$ = total number of species $E_MS$ = total number of species in calculation including standard states $E_Mm*$ = total number of species in mixture * (1 - 150) $E_Mgas$ = total number of gas species - same as $E_Mm1$ $E_Mliquid$ = total number of compound liquid species $E_Maqueous$ = total number of compound aqueous species $E_Msolid$ = total number of compound solid species Solutions: $E_m?$ - product solutions (mixtures) * = 1 - 150; ? = a, D, E, g, m, N, n, ... - these values are only defined after the equilibrium has been calculated (CALC) i.e. $E_OK$ = 'OK' $E_ma*$ = mixture activity $E_mD*$ = mixture data source $E_mE*$ = mixture extended name (data source and name) $E_mg*$ = mixture grams $E_Mm*$ = total number of species in mixture $E_mN*$ = mixture name, 1 is always 'GAS' $E_mn*$ = mixture moles $E_mC*$ = mixture integral total Cp $E_mF*$ = mixture integral total G $E_mH*$ = mixture integral total H $E_mS*$ = mixture integral total S $E_mV*$ = mixture integral total V $E_mc*$ = mixture integral molar Cp $E_mf*$ = mixture integral molar G $E_mh*$ = mixture integral molar H $E_ms*$ = mixture integral molar S $E_mv*$ = mixture integral molar V $E_mi_?$ = mixture code number 1 - 150, ? = mixture name (or extended name) $E_mxf*$ = mixture integral molar excess G $E_mxh*$ = mixture integral molar excess H $E_mxs*$ = mixture integral molar excess S $E_mxF*$ = mixture integral total excess G $E_mxH*$ = mixture integral total excess H $E_mxS*$ = mixture integral total excess S Solution sites : $E_mli_M$ and $E_mli_Lj_*$ - these values are only defined after the equilibrium has been calculated (CALC) i.e. $E_OK$ = 'OK' $E_mli_M$ = number of sublattices (2 - 5) in mixture i (i = 1 to $E_Mm$) $E_mli_Lj_M$ = number of sites in mixture i, sublattice j (j = 1 - 5). $E_mli_Lj_N*$ = name of site consituent * in mixture i, sublattice j (j = 1 - 5) $E_mli_Lj_X*$ = fraction (0.0 - 1.0) of site consituent * in mixture i, sublattice j (j = 1 - 5) Solution bond fractions : SET PARAMETERS PRINT BONDS ON must be in effect. - these values are only defined after the equilibrium has been calculated (CALC) i.e. $E_OK$ = 'OK' $E_mbi_M$ = total number of bonds in mixture i (i = 1 to $E_Mm$) $E_mbi_N*$ = name of bond * in mixture i (* = 1 to $E_mbi_M$) $E_mbi_X*$ = fraction (0.0 - 1.0) of bond * in mixture i (* = 1 to $E_mbiM$) Solution Chemical and Physical Properties: $E_CP*_..$ : product solution (mixture) code number * = 1 - 150 - these values are only defined after the equilibrium has been calculated (CALC) i.e. $E_OK$ = 'OK' $E_CP*_Evolts$ = aqueous Eh $E_CP*_pH$ = aqueous pH $E_CP*_total_molality$ = total solute molality $E_CP*_ionic_strength$ = ionic strength $E_CP*_osmotic_coeff$ = osmotic coefficient $E_CP*_magnetic_moment$ = magnetic moment $E_CP*_Curie_T$ = Curie temperature $E_CP*_viscosity$ = viscosity $E_CP*_surface_tension$ = surface tension $E_CP*_thermal_cond$ = thermal conductivity $E_CP*_electrical_cond$ = electrical conductivity $E_CP*_surface_energy$ = surface energy $E_CP*_emissivity$ = emissivity $E_CP*_density$ = density $E_CP*_thermal_expan$ = thermal expansivity $E_CP*_bulk_modulus$ = bulk modulus $E_CP*_Grueneisen$ = Grueneisen $E_CP*_a_lattice$ = lattice parameter a $E_CP*_c_lattice$ = lattice parameter c Miscellaneous: $E_OK$ = 'OK' if calculation successful, else 'NotOK' (follows CALC) Manipulating tabular thermochemical variables: $E_sa*$ (or $E_sN*$) is the activity (or name) of product species * and $E_ei_mg*$ is the number of grams of element (component) i in product mixture (solution) *. The following lines show various ways to manipulate these tabular thermochemical variables. DIM %Index1(10) %Species_activity %Species_gram %Index1() = $ENUM(1) // Enumerate values of %Index1() starting at 1 // %Index1(1) = 1, %Index1(2) = 2, ... %Index1(10) = 10 %7 = 3 %8 = 4 %9 = 2 // In the following lines %Species_activity is the equilibrium activity of product species 4. // Parentheses '(...)' can be used in thermochemical variables ($...$) to improve the readability. %Species_activity = $E_sa4$ %Species_activity = $E_sa4:4$ %Species_activity = $E_sa(4:4)$ %Species_activity = $E_sa%8$ %Species_activity = $E_sa(%8)$ %Species_activity = $E_sa%Index1(4)$ %Species_activity = $E_sa(%Index1(4))$ %Species_activity = $E_sa(%Index1(%8))$ %Species_activity = $E_(sa)((%Index1(%8)))$ // In the following lines %Species_gram is the number of grams of element (component) 3 in product mixture (solution) 2 %Species_gram = $E_e3_mg2$ %Species_gram = $E_e3_mg%9$ %Species_gram = $E_e%7_mg(2)$ %Species_gram = $E_e(%7)_mg(%9)$ DIM %Total %Total = $M_Ms$ // total number of product species // Dynamic dimension declarations (DIM or VARIABLE) can appear anywhere in the .mac file. DIM %activity(%Total) %name(%Total) // or DIM %activity(1:%Total) %name(1:%Total) // Assign the values by one tabular variable at a time %1 = 1 TO %Total %activity(%1) = $E_sa%1$ // or $E_sa(%1)$ %name(%1) = $E_sN%1$ // or $E_sN(%1)$ %1 LOOP // Assign the values by the range of tabular variables - a simpler way. %activity(1:%Total) = $E_sa(1:%Total)$ %name(1:%Total) = $E_sN(1:%Total)$ // Assign the values by the range of tabular variables - the simplest way. %activity() = $E_sa()$ %name() = $E_sN()$