Input
Simulations often need a lot of input data. To support a readable
ASCII input format, a class "TomasFile" is defined. TomasFile
supports almost all value and character types of Delphi. Based on
the assumption that the programmer knows the input format, all
conversions, spacing, linefeeds and comments are handled by
TomasFile. Assume we made a general model for a job shop with a
variable number of departments, each with a number of machines and
a distribution for the execution time. One example of an input
file ("jobshop.txt") is given below.
'Milling' 3 {name of department and number of machines}
'normal(5,1)' {distribution of execution time}
'Welding' 5
'normal(7,2)'
//
The part of the program to read this file will look like:
InputFile:=TomasFile.Create('jobshop.txt');
While NOT(InputFile.FileMarker) Do
Begin
- Department:=TDepartment.Create(InputFile.GetString);
- Department.NrOfMachine:=InputFile.GetInteger;
- Department.ExecTime:=TInputDistribution.Create(InputFile.GetString);
End;