Process Calculator for MS Excel

The application is very simple to use but with powerful performance
for calculation of the equilibrium state, as well as for create of process models

 

Content
1.General
2. Menu Functions
3. Definition of the Thermodynamic System
4. Definition of the Calculation Conditions
5. Parameter Definition, and Creating Parameters
6. Possible Errors and Trouble Shooting
7. Behaviour of the MS Excel
8. State Functions and Heat Balance



1. General

Process Calculator for MS Excel (XProCalc.exe) calculates thermodynamic equilibriums
corresponding to the input data in a MS Excel Sheet (Table).

The application XProCalc.exe can be executed with defined parameters, like following example shows.

In the example above, Public Sub ExecXProCalc( ) runs the application XProCalc.exe, which calculates the thermodynamic equilibrium and writes the results in the MS Excel files .
When you deactivate macros in MS Excel, you can also run Process Calculator for MS Excel using an symbolic link or in another external program.

When the application is executed without parameters, then you can select an MS Excel file and execute calculations from a window, as the following example shows.

Several Applications for process simulation and process control use MS Excel tables for data input/output.
Most of the Applications for the simulation can not calculate any equilibrium state.
Using MS Excel interface, you can integrate Process Calculator for MS Excel (XProCalc.exe) into the software for process simulations.

When the application is executed using parameters without -s:, the application closes immediately after the transfer of the calculation result to MS Excel.
You can see only the icon in the MS Windows Task Bar and the calculation progress, while the calculation runs.

 


2. Menu Functions
When the application is executed without parameter, an icon is shown in the Taskbar of MS Windows.
When the right mouse button is pressed, a popup menu is shown.

In this menu:
Close terminates the application
-
Help shows the help file
About Process Calculator shows software information and the depending files
-
Break a calculation can be break
Calculate, the last system is calculated again corresponding to current data in the MS Excel Tables.
-
Messages shows the current messages
Thermodynamic System the phases in the thermodynamic system are shown, which are relevant to the calculation.
MS Excel Source  You can select a MS Excel file, You can make the parameter string for a fast calculation.
-
Leave Menu, the menu is closed.

The application can be executed fast, when the necessary parameter are given.
The string can be used in your own program or in a process simulation software.
You can also create symbolic link to execute program from your desktop or elsewhere.


2. Definition of the Thermodynamic System

Every phase must be defined in a separate sheet. 
The following picture shows, how a phase is defined in the thermodynamic system

 

Column A
Cell A1, the state of the phase is written: (g), (l), or (s)
The cells A2 to A256 contains substance names
After the last substance, the tables should end EOT. All data behind the cell EOT are not regarded.

Column B contains input values. In the cell B1, the dimension should be given.
Valid values are: in [mol], in [kg], in [g], in [lb] and for gases also in [m3], in [Nm3], in [ft3]
When no any valid dimension is given, the dimensions are regarded as [mol].

Column C contains output values as calculations result.
In the cell C1, the dimension should be given.
Valid values are: out [mol], out [kg], out [g], out [lb] and for gases also out [m3], out [Nm3], out [ft3]
When no any valid dimension is given, the dimensions are regarded as [mol].
All Cells C1 to C(until EOT) are overwritten, when a calculation succeed.

Column D contains output concentration values as calculation result.
In the cell D1, the dimension should be given
valid values: x, w, w%; x means mol ration, w is weight ratio, w%  is wait ratio as per cent.
When no any dimension defined, the output concentrations are in mol ratio.
All Cells D1 to D(until EOT) are overwritten, when a calculation succeed.

Column E contains fugacity (f) of gas substances or activity (a) of the solid or liquid substances.
All Cells E1 to E(until EOT) are overwritten, when a calculation succeed.

Column G activity or fugacity coefficient of a substance. When the coefficients are known, you can enter values.
When no any value is given, the value is regarded as 1.
The Cells G1 to G(until EOT) is not overwritten by application.
When a substance can be exist only as pure substance, like soot in combustion processes enter '(1)
number one in parenthesis.
Some times may be apostrophe necessary.
Important
When you do not write for activity coefficient '(1), then the substance is regarded in a solution in any solvent.
for example carbon solved in iron.

Column H. Mass relation of the input values, which reacts in the equilibrium system.
When a value of 10 kg is given in the cell A3 and a value of 0.6 in the cell H3,
then the mass of 6 kg is regarded in the calculation system. The mass of 4 kg does not react.
Valid values are between 0 to 1.
When the value is invalid, or when no any value is given, then the relation value in the cells is regarded 1.
 

2.1. Selection of the Substances in the Phases from the AsTher Database
When you execute XProCalc.exe without parameters or using parameter -s:, the application icon is shown in the taskbar of the MS Windows.
Press right mouse button on the icon, a menu is shown.
Select menu item Thermodynamic system, as the following picture shows.

The window for the Thermodynamic System is shown.
In the window Thermodynamic System, Select menu item System -> Elements

 

In the following dialog box, select the elements of the requested substances pressing the buttons for the elements.

Press button Accept and close the dialog box.
In the Window Thermodynamic System, Select Menu System -> Compounds

 

When you press the button OK, and when you already defined the phase in the MS Excel file,
the compounds in the MS Excel file will be updated corresponding to your selection.

2.3. Creating of the MS Excel files creating a copy of a thermodynamic system

You can create a MS Excel file with the same substances, which are currently selected in the thermodynamic system.
Select menu item File -> Export to New Excel File

 

2.2. Creating of the MS Excel Files using the Application Equilibrium.

A Thermodynamic system can be also created using the AsTher Equilibrium.
You can export this file to MS Excel by the menu item  File -> To MS Excel.
The file must be saved, before using for AsTher Process Calculator MS Excel
Y
ou can  insert also another sheets in the new MS Excel file..

Important, Equilibrium enables more than one phase with the same name, but not MS Excel do it..
When two ore more phases have the same name, the transfer to MS Excel broken with error messages.


3. Definition of the Calculation Conditions

The calculation conditions temperature and pressure have to be given in a sheet, which is defined as in the string after the second parameter -c:.
Example:
-x: C:\AsTher\projects\Furnace.xls -c: FurnCond

In the Sheet for the condition, in this example FurnCond,
B2 ,Temperature value, when dimension of the temperature fails  in B1, then °C is valid for temperatures.
B3, Pressure value is in [bar] for const Pressure or Volume [m³] of a gasphase.
When volume is given, then the sheet name of the a gas phase must be given cell B4 (the first phase must be a gas phase).
B4..I4 Phases in System : the sheet names are given in the cells B4, C4, . . . I4, which are regarded in the calculation.
The sheets must exist in the same MS Excel file.
The system can contain until 8 Phases, there are until 2 gas-, until 3 liquid- and until 3 solid phases can be given.
When the calculation is succeed, then the text "Success" is written by XProCalc.exe in the cell B1

The data below the Row 5 are optional parameters

B6, Count: When a calculation executed, the count of the calculation is written in the cell B5;
When the number in the cell C6 is higher than the calculation count, then a following calculation executed.
The MS Excel file for the following process can be defined in the cell B11.
The Following Process may be defined in the same MS Excel File or in an different MS Excel File.
When you use the same MS Excel file for more than one processes, the conditions should be defined in the separate sheets for each process..

B7 Precision of the calculation result.
The precision should be less than 0.1.
A precision of 0.05 is sufficient.
Default value is 0.01.
Range is: 0<B7-Value<1.

The multiplication by 100 of the given precision value yields the precision value in per cent,
The value 0.02 means a precision of 2%.

When you make a process simulation, the precision value should be not less than 0.02.
When you calculate an equilibrium state, the value should be less than 0.02.

An exact calculation of the equilibrium state often causes  higher difference of the real systems.
When a process simulation is intended. The value of the precision should correspond nearly to the precision of the inputs values.

B8 Number iteration steps: The thermodynamic equilibrium is calculated iterative.
When no any solution is found until the given iteration steps, the calculation is broken.
The values should be less than 100000.

B11: The Filename and the sheet name for the conditions of the following calculation is given in Cells B11 and B12.

When no any Following File is given and when the value in Cell B6 equal or less than C6, then  the same system will be calculated again.
Such calculation is useful, when one ore more conditions or input data  in the thermodynamic system is changed in depend of the calculations count.
Following calculation is run, when the value is more than zero in the cell C6

The following example shows, that the temperature is varied from 300°C to 1000°C by steps of 100°C in depend of the calculations count in the cells B6 and C6. 8 Calculations are carried out.

The following example shows, that the systems in the files Furnace.xls and Cleaning.xls are calculated.
A Following calculations can be carried out, when the value in B6 is equal to C6 or less than C6 .

B13, Record Data: When you calculate the system and vary parameters, you can record the defined data.
The record variables must be given as link, as the following example shows.


In the example above, =Gas!D3 given as link.
After each calculation, the data in the cell B14 and the bellows B14 is written in the Sheet Graphics., which is defined in the Cell B13.
The description of the variable is optional. The description is not written by XProCalc.exe.
You can write in the cell A14 and bellow A14 your own description.
You can also write in the cell A1, B1, C1 .... your own description.
The definition of the graphic is leaved to user.
The rows of the written data in the Record-Sheet (in example Graphics) always correspond to the calculation count in the cell B6 of Conditions-Sheet.


5. Parameter Definition, and Creating Parameters

Valid parameters are

-x: is always the first parameter. The name of the MS Excel file follows  -x:
Blanc character or specific character should not be used in the file name.
The application breaks calculation, and shows error message, when the file does not exist.
Parameter -x: is necessary.

-c:  is always the second parameter. After -x:, the name of the sheet is given, which contains the calculation conditions,
temperature, pressure, and the name of the sheets, which contains the thermodynamic system.

-r: Read only, The calculation will be executed, but no any cell in the MS Excel file is written after the calculation.
The application is not closed.
When  the parameter -r: exits, then the parameter -s: takes no any effect.
Parameter -r: is optional

-s: Process Calculator for MS Excel is usually closed, when a calculation is succeed and the parameter -s: is not given.
The application will not be closed, when the parameter contains -s:.
You can see messages of the application.
Parameter -s: is optional

When the Process Calculator for MS Excel (XProCalc.exe) executed without parameters, a widow is shown.
In the window, you can create the parameter string with mouse clicks.

When the Button "Search" is pressed, in the following dialog box, you can select a MS Excel file.

After the file selection, the sheets names of the selected Excel file are shown in the selection box.
In the selection box "Conditions Sheet", the sheet is to select, which contains the calculation conditions.

Button "Make ->" creates the parameter string.

Button "Copy" the parameter string is copied to the clipboard.

Button "Calculation" runs immediately XProCalc.exe .
When Read only is not selected, the calculation results are written in the MS Excel File.
Important: When you do not select "Don't Close" the application is terminated immediately after the calculation, when the button "Calculation" is pressed and when no errors are occurred.

Button Help, the help file will be shown.

Button Exit: Only the window is closed. The application runs, and you can see the application icon in the taskbar.

 

6. Possible Errors and Trouble Shooting

6.1. MS Excel does usually not permit more than one access at the same time.
When you edit a cell  in a sheet (when a cell gets focus), the application Process Calculator for MS Excel (XProCalc.exe) can not read or write in the MS Excel file. When you are editing a cell the Excel file and execute XProCalc.exe, then an error will be occurred.


6.2. when the mass-conservation is not possible, the calculation will be terminated. For example, if elementary oxygen (O2 (g) or O (g) ) does not exist in a system consisting of the elements H and O, when only the substances H2(g) and H2O(l) for the calculation selected, the calculation is impossible for 1 bar and 1000 °C. Calculations are broken .
To avoid this, it is recommended to include first time all possible substances into the calculation. You can deselect substances from the calculation system, when it is secure, that the deselected substances can not be exist in the system.
Height number of substances causes long calculation time and imprecision. The thermodynamic data set of  the rare substances may be some times approximated. It is also difficult to overview.
Low number of substances causes fast calculation time. It is easy to overview. But the calculation may be incorrect, because the system  may be not complete.
An optimum is often individual to decide.

6.3. Error messages related to operations system may occur due to excessively high values of the free energy of a substance, so that the processor can not interpret the value. In this case, please check the thermodynamic data set.

6.4. Two reaction systems with high different quantities may produce erroneous results.
Example, when a system consisting of Fe, Cl2, FeCl2, H2O,CO,CO2,N2,NO.
wherein one reaction system is consisting of Fe-Cl2-FeCl2 and  the other consisting of C-CO-H2O-N2-NO.
If the inputs of the calculation is 10000 mol FeCl2, 1 mol H2O and 1 mol N2, 0.1 mol C, and the precision is 0.01,
the calculation result may be incorrect for the system C-CO-H2O-N2-NO.
It is recommended to calculate in separate systems.

6.5. Pure Substances :
If a substance my be exists as a pure substance (and accordingly the activity coefficient has been set to (1) in the a.c./f.c.- column, please check after the calculation, whether:
- the info column shows the value 1,
- the amount of that substance is more than 1e-23 mol,
- the calculated value or the activity is nearly 1.
If not, those substances should be excluded from the calculation, e.g. by setting the a.c.-value to 0.

6.6. An Obviously Erroneous Result (e.g. the formation of liquid Fe at 20 °C), although the calculation results keeps minimare consistent.
This may happen, if the extrapolation is enabled and the extrapolated data itself are unusable.
With the application Pure Substance, you can follow the course of the free Enthalpy in graphic and table window in order to check the validity range of the required dataset.

6.7. Erroneous calculation can be caused by the incomplete definition of the system. The system can be influenced by mass of the gaseous substances, although these substance can not take in any reaction. The results of the calculation will be is different in a system consisting of CaO, CaCO3, CO and N2, when the mass of N2 is different, although N2 does not react.

7. Behaviour of the MS Excel

When MS Excel was not run by user, then Process Calculator runs MS Excel in background. The calculation results are written in the MS Excel file and the file is saved.

When MS Excel was already  run by user, then Process Calculator shows the given MS Excel file in the active MS Excel Window.
The results are written in the MS Excel file but the file is not saved by Process Calculator.
When you are going to close MS Excel, you will be asked by MS Excle, if you want to save the changes..

When  Process Calculator runs MS Excel in background and try to open a MS Excel File, which has values from a different MS Excel Files (external links), then a calculations may be impossible in depend of the settings in MS Excel and in depend of the MS Excel version.

8. State Functions and Heat Balance

The columns J and after J are not used for calculations. You can get the values of the state functions in the column J.
When you enter in the Cell J1 one of the following chars,
C for specific heat [kJ/mol]
H
for enthalpy [kJ/mol]
S
for entropy  [J/mol K]
G
for free energy  [kJ/mol]
M
for mol weight  [g/mol] or [kg/kmol]
the values of the state functions or mol weight of the substances is written in the cells J1..J256.

The temperature of the state functions usually corresponds to the value in B2 in the conditions sheet,
when no any value exists in the cells I2 to I256.
You enter another value for the temperature in the cells I2 to I256.
When you cut the values from J and paste into columns K or after K, the calculation time will be faster, because the data write/read in MS Excel files costly in terms of time

Corresponding to the data of enthalpy and the mol weight, you can calculate heat balances..