The macro example files are stored in the \MACROS folder.
Equilib Macros - EquiEx*.mac
EquiExample_1.mac
It loads Equilib file Ex_CH4-O2, calculates and displays results as
Equilib.txt, Equilib.tab and Equilib.xml
EquiExample_2.mac
It prompts (ASK) the user to enter the Equilib Equi*.dat file number (* = 1 to 9999) or 'Cancel' to quit.
It calculates the Equi*.TXT, Equi*.RES, Equi*.FIG, Equi*.TAB, Equi*.XML files and recycles to ASK again.
It prompts (ASK) the user to enter Equilib Equi*.dat file numbers %First and %Last (* is within the range 1 to 9999.
It processes all EQUI*.dat files where * = %First to %Last and calculates the Equi*.TXT and Equi*.RES files.
This example demonstrates the three basic macro commands OPEN, CALC, SHOW.
This is a good example of :
The macro :
Note: if you want an efficient way to calculate the maximum adiabatic flame temperature of a gas use module FactOptimal.
Figure 1 - EX_CH4-O2_Figure-1.fig - is a plot of the adiabatic temperature versus the page (1- 21).
Figure 2 - EX_CH4-O2_Figure-2.fig - is a plot activity versus page for the 8 most prominent species.
Both figures are then displayed via the VIEWFIG command.
The macro :
The Command Prompt (or command shell) is a feature of Windows that provides an entry point for typing
Windows commands including former MS-DOS commands and is typically only used by advanced users.
Run this macro and the Command Prompt Windows commands will :
In the example we scan the figures and macros folders and return number (%Scan_number) of *.fig and *.mac files.
In addition the size (%Scan_big_size) and name (%Scan_big_name) of the largest file in the folder are determined.
Functions and subroutines perform identical operations except that the $Function also returns a value.
Here we scan for '*.fig' files in the figures directory.
%1 = $SCAN_DIR(c:\FactSage\Figures\*.fig)
%1 = $SCAN_DIR()
Note this example works with any saved Equi*.dat file.
The process is broken down into 3 reactions:
Reactions R1, R2 and R3 are repeated at each time step, until the total process duration is reached
The simulation i/o is stored in the Excel file Ex_Streams_inoutput.xls and includes a chart that plots
the process in real time. The Excel file can be manually edited and inital conditions changed.
As a backup all the original files are stored in the folder Ex_Streams\Original_Files\.
Phase Diagram Macros - PhasEx*.mac
PhasExample_1.mac
PhasExample_3.mac
The macro shows how to :
PhasEx_Calc_All_PDs.MAC - new in FactSage 7.2
Copy PhasEx_Calc_All_PDs.MAC to the folder where the Phas*.dat files are stored.
Run 'Phase Diagram' and then 'Phase Diagram - Components Window > File > Macro Processing > Run .... PhasEx_Calc_All_PDs.MAC'.
The macro :
In order to permanently save a record of all calculated and saved figures use 'Word' to open Phas_Calc_All_PDS.htm and
save as a *.pdf file - for example Phas_Calc_All_PDS.pdf
Christopher W. Bale
This is a simple example for getting started.
This is a simple example for getting started.
EquiExample_3.mac
This is a simple example for getting started.
EquiEx_CH4-O2-a.mac
This is the first (a) of three (a, b & c) Equilib macros where the system is
(1-alpha) CH4 (25C,gas) + (alpha) O2 (25C,gas) => Adiabatic flame temperature.
EquiEx_CH4-O2-b.mac
Example (b) illustrates user variables and demonstrates how a macro
can prompt the user to specify which type of output he wants
- simple calculation or save calculation or show results in various formats.
EquiEx_CH4-O2-c.mac
Example (c) is an advanced macro where the user interacts with an Excel Worksheet and text spreadsheet.
EquiEx_CH4-O2_Figure.mac
This example is for advanced users. It shows how to plot equilibrium results and save figures.
EquiEx_CH4-O2_Set-Activity.mac
This example is for advanced users. It shows how to define the equilibrium P(O2(g)) and a(C(s)).
EquiEx_CMD.mac
This macro shows how to execute Command Prompt Windows commands via the macro processing command CMD.
EquiEx_Functions_and_Procedures.mac
This macro shows user-defined $Functions (FUNCTIONS ... END FUNCTIONS) and subroutines (PROCEDURES ... END PROCEDURES).
EquiEx_List_Files.mac
In this example function $My_Total_Files() and subroutine Sub_SCAN_Files() perform the same tasks
and $My_Total_Files also returns the total number of files.
Example of scanning a directory and listing the files.
EquiEx_List_Functions.mac
Examples of the functions :
EquiEx_List_Results.mac
Simple example of common thermochemical $variables$ to list the input and calculated values
EquiEx_List_Thermo.mac
- note $variables$ are case sensitive.
An advanced example of thermochemical $variables$ including thermochemical, chemical and physical properties for compounds and solutions.
EquiEx_List_Thermo_Functions.mac
An advanced example of thermochemical $variables$ including solution properties and components.
EquiEx_New_in_7.0.mac
This is the same as EquiEx_List_Thermo.mac except here the $function codes are also displayed.
This macro uses variables and commands that are new in FactSage 7.0 :
EquiEx_New_in_7.1.mac
This macro lists the .mac files that are new in FactSage 7.1.
EquiEx_Set_Page.mac
After loading an Equi*.dat file and calculating multiple pages of results
(for example EquiEx_CH4-O2.DAT has 21 pages of results)
this example shows how to accessing each page after multiple pages of results have been calculated.
EquiEx_SET_Variables.mac
This example first calculates the adiabatic temperatures for the reaction (1-A) CH4 + (A) O2 and then uses the
SET command to change the databases, reactants, species selection and type of calculation. For example:
EquiEx_Sort_Functions.mac
Example of the sort Functions :
EquiEx_Xls_Simple_IO.mac
Example of simple interactive Input and Output with Excel Worksheets and Text Spreadsheets.
Ex_Streams\EquiEx_Streams.mac
The Excel files must be *.xls or *.xlsx
The Text files must be *.txt or *.tab.
This macro is for advanced users and shows how to use streams in a simplified process.
The process consists of the desulfurisation of hot metal by the top slag.
This is a simple example for getting started.
The macro shows how to :
This macro processes all the PHAS*.dat files where * = %1 to %LAST (in the range 1 to 9999).
This macro is particularly useful for database developers who wish to recalculate phase diagrams using revised databases.
The macro loads each Phas*.dat that is stored in a folder, calculates the phase diagram and then displays the calculated figures in a web browser (htm) format.
If the PHAS*.dat also contains a stored diagram it is displayed as well.
In this manner the developer can compare the newly calculated diagram with the old one.
CRCT, 2020