Error handling

When AutoCal performs a model simulation, the return code from the called program is checked. In the case an error in the model simulation has occurred for a given parameter set, e.g. by creating instabilities, an error return code is received by AutoCal (a return value different from 0). In such a case the output measures and objective functions are given a delete value of -99, which are written to the output files.

Depending on the simulation option chosen in AutoCal, error return codes from the called program are handled differently:

·         In the case the Scenario runs option is chosen AutoCal continues with the next scenario.

·         In the case the Sensitivity analysis options is chosen AutoCal is halted. In this case the sensitivity coefficients and the parameter covariance matrix cannot be calculated.

·         In the case the Parameter optimisation option is chosen, the optimisation continues and the parameter set that gave an error in the simulation model is penalised in the optimisation by assigning the aggregated objective function a penalty value of 1030. However, if a large number of model runs return error codes, a general model failure is suspected and AutoCal is halted.

If the simulation model does not provide a return code, AutoCal offers another possibility for error handling. When a model run is started, AutoCal creates an empty file called AutocalSimErr.dat that is placed in the process directory. When the model run finishes, AutoCal checks the file, and if it is not empty it is assumed that the model simulation has failed. In this case AutoCal handles the simulation in the same way as when it receives an error return code as described above.

To use this facility, it is necessary to include as part of the model simulation an option that writes an error message (or any dummy string) to the Autocal­SimErr.dat file if an error occurs during the model simulation. If an error mes­sage is written to the file, the file can be saved as part of the AutoCal run for later inspection by using the Save Output Files option.