Crashing of program


The CPO programs have a very large and comprehensive set of traps, so that informative error messages almost always appear when a program stops. After clicking on the 'OK' in the error box control is nearly always returned to the screen, so that the user can then edit the data file and rerun.


Nearly all the run-time messages that the program cannot trap refer to errors in reading from or writing to files (which can arise when the information in the processed data file or its binary counterpart has been corrupted or is not appropriate) So the solution then is simply to delete the processed data file.


Other crashes (outside the control of the program) sometimes occur when ray tracing is stopped before the natural end.


The messages

 Unit has neither been OPENed nor preconnected


 Storage heap is corrupt

usually mean that the user is using key-strokes instead of clicking with the mouse (for example alt+R instead of clicking on Run) and that the key-strokes are being carried out too soon (that is, before the clickable item has appeared). The safest method is to click with the mouse. Another rare cause of this type of message is the unnecessary use of the cursor to scan the screen while the program is updating the screen.


One error that occurs rarely in space-charge simulations concerns running a simulation a second time without deleting the processed data file that was created during the first run. A box might then appear with one of the following messages:


Salfor run time error

floating point division by zero

character buffer too small.


The solution is obviously to delete the processed data file.


Another type of problem, which seems to be outside our control, occurs sometimes when data files are edited on-line. Spurious binary characters might appear at the end of the file, giving rise to messages such as:

 Null character(s) encountered -file may be binary

which can usually be safely ignored. Another effect of these spurious characters is that they remove or hide the 'end of file' marker, so that if a CPO3D program is looking for the line

 'start of ray information'

it might look beyond the end of the file and search other files in the same part of the memory until it finds the line, giving an unexpected result! The solution is to replace the line by:

 'no ray information'

as recommended in the relevant note.



Finally, a rare reason for crashing is that the number of lines in the information window becomes too large -perhaps because the cumulative mode is in use. The default number is 5000. Similarly a large number of lines written to the ray output file might cause a crash. The default number is 75000. A warning message appears when the number of lines exceeds this number. The numbers of lines that cause crashes are system-dependent and can be determined empirically.

So there is an option to limit (1) the maximum number of lines in the information window and (2) the number of lines written to the ray output file at which a warning message will appear. You must create the file maxlines.dat, in the folder that has cpo2d.exe or cpo3d.exe, and put these 2 numbers in the first line. If the program cannot find this file it will use the default values.




We will be grateful to be informed of any unexplained crashes (and it would help us very much if you could email us copies of the data files that led to the crash, and could tell us the sequence of events).


We would also be grateful for any suggestions for any improvements to the programs (see program improvements).