https://github.com/despairblue/chemapp-iec
https://github.com/despairblue/chemapp-iec
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/despairblue/chemapp-iec
- Owner: despairblue
- Created: 2011-09-11T15:50:40.000Z (almost 14 years ago)
- Default Branch: master
- Last Pushed: 2011-11-08T12:16:02.000Z (over 13 years ago)
- Last Synced: 2025-02-24T02:56:52.166Z (4 months ago)
- Language: C
- Size: 590 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README
Awesome Lists containing this project
README
*********
* Usage *
*********
1. ChemApp has to be initalized.
2. A data file has to be read.
3. An iteration_input struct and an iteration_output has to be initialized (Explanation for the fields are given in iter.h).
4. run_iteration can be called.***********************
* Functions in iter.c *
***********************
int run_iteration( struct iteration_input, struct iteration_output* )
* parameters are self explaining
* return value is an error code which explains what is wrong with the iteration_input (see error_code_to_str())
char* error_code_to_str( int error_code )
* turns an errror code given by run_iteration into a hopefully helpfull error message
void print_settings( struct iteration_input, int nelements, int nphases )
* prints a table with the options set in iteration_input
* nelements = number of elements
* nphases = number of phases**************************
* Functions in helpers.c *
**************************
void abortprog( int line_number, char instruction_name[10], LI error_number, char* filename )
* may be called after a ChemApp instruction
* prints the ChemApp error number, what instruction caused it, in what line and what file the instruction isint show_total_chemapp_errors( int show_them )
* returns the total of ChemApp errors that occurred
* if show_them is 0 it will print nothing and increase the error count
* if show_them is not 0, it will print themvoid table()
* prints a table with all phase name, amount and activityvoid check_elimination( int eliminated[], double margin )
* checks which phases could be eliminated in the current equilibrium
* margin is the offset from zero which is still thought to be low enough for eliminationDB calc_error( DB amounts, DB amounts_with_eliminations )
* returns the error which was causes by eliminating a phaseint biggest_error_calc( DB amounts[], DB amounts_with_eliminations[], DB biggest_error_so_far[] )
* returns 1 if there is an error otherwhise 0
* amounts = amounts of all phases without elimination
* amounts_with_eliminations = amounts of all phases with elimination
* biggest_error_so_far = before first call all set to 0, in subsequent the biggest error for
a phases will be saved therevoid get_amounts( DB amounts[] )
* retrieves the equilibrium amounts of all phasesvoid count_amounts( DB total_amount[] )
* adds up the current amounts in the equilibrium to total_amountsvoid show_amounts( DB total_amount[] )
* prints the total amount for all phases in a tablevoid enter_all_phases()
* enters all phasesvoid reset_vars( DB *a, DB *b, DB *c, DB *d, DB *e, DB *f )
* resets all vars to 0void set_all_ia( int arr[], int step, int* ignored_elements )
* sets the initial amount for all phases
* will not set for ignored elements
* step: initial amount is set in iteration_input as an integer
step says by what it must be diveded to be the correct double value for initial amount
preset is 10void eliminate_phases( int eliminate[] )
* takes an array as arguments, each phase with (index == 0) will be eliminated
int check_for_ignored_element( int element, int* ignored_elements )
* returns 1 if the element should be ignoredint sum_array( int arr[], int n )
* sums up an array and returns the sumint check_for_range( int arr[], int min_set_ranges[], int max_set_ranges[], int nelements )
* returns 0 if any element is out of range