18.10.2014 Views

SIMSCRIPT II.5 Programming Language

SIMSCRIPT II.5 Programming Language

SIMSCRIPT II.5 Programming Language

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Discrete Simulation Concepts<br />

before the start simulation statement is executed. The origin is set by a call to a library routine.<br />

The arguments to this routine are as shown below:<br />

call origin.r(integer month expression, integer day expression,<br />

integer year expression)<br />

Because simulation time is maintained in time.v and saved in the time.a attribute of event and<br />

process notices as a real number, conversions must be made between calendar specifications and<br />

the <strong>SIMSCRIPT</strong> <strong>II.5</strong> internal representation. The algorithm that performs this conversion assumes<br />

the origin date is a Monday, and that simulation starts at the beginning of that day (00.00 hours).<br />

Time.v is always set to zero at the start of simulation.<br />

Four functions are provided to convert year, month, and day expressions into cumulative simulation<br />

times and vice versa. These functions are described in table 5-4. The examples assume that the<br />

origin time has been set to July 1, 1982, by the call:<br />

call origin.r(7, 1, 82)<br />

Table 5.4 Calendar Date Conversion Functions<br />

Name<br />

Arguments<br />

Function<br />

Mode<br />

Function<br />

Values<br />

Example<br />

date.f<br />

3 INTEGER<br />

expressions<br />

INTEGER<br />

current simulation<br />

day<br />

month, day, year<br />

date.f(7,15,82) =<br />

14<br />

year.f<br />

month.f<br />

REAL time<br />

expression<br />

REAL time<br />

expression<br />

INTEGER current year year.f(476.2) =<br />

1983<br />

INTEGER 1-12 current month month.f(476.2) = 10<br />

day.f<br />

REAL time<br />

expression<br />

INTEGER 1-31<br />

day of current<br />

month<br />

day.f(476.2) = 21<br />

These functions may be used directly within statements to convert from calendar format times. For<br />

example:<br />

schedule a DEPART at date.f(MONTH, DAY, YEAR) + SERVICE.TIME<br />

Sample external event data records, containing no optional data, are:<br />

SERVICE 1/15/80 05 35 *<br />

ARRIVAL 14 05 35 *<br />

DEPART 476.2 *<br />

211

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!