18.10.2014 Views

SIMSCRIPT II.5 Programming Language

SIMSCRIPT II.5 Programming Language

SIMSCRIPT II.5 Programming Language

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>SIMSCRIPT</strong> <strong>II.5</strong> <strong>Programming</strong> <strong>Language</strong><br />

Program 6-1.<br />

_______________________________________________________________________________<br />

preamble<br />

temporary entities<br />

every JOB has a LABOR.COST, a MATERIAL.COST,<br />

an OVERHEAD, a PROFIT, a RANKING FUNCTION<br />

and belongs to a QUEUE<br />

permanent entities<br />

every MACHINE owns a QUEUE<br />

define QUEUE as a set ranked by high RANKING<br />

end<br />

main<br />

read N.MACHINE<br />

create every MACHINE<br />

until data is ended<br />

do<br />

create a JOB<br />

read LABOR.COST.., MATERIAL.COST.., OVERHEAD.., PROFIT..<br />

and MACHINE..<br />

file JOB in QUEUE(MACHINE)<br />

.<br />

.<br />

remove JOB from QUEUE(MACHINE)<br />

.<br />

.<br />

loop<br />

.<br />

end<br />

routine RANKING given JOB<br />

define JOB as an integer variable<br />

return with (LABOR.COST..*2 + MATERIAL.COST..*3<br />

+ OVERHEAD.. + PROFIT..*4) / 10.0<br />

end<br />

_______________________________________________________________________________<br />

The preamble defines RANKING as a function attribute of JOB and as the attribute by which jobs<br />

are to be ranked when they are filed in a QUEUE set owned by some MACHINE. The routine<br />

RANKING provides a procedure for computing a ranking value. The routine is invoked each time a<br />

JOB is filed. It is used to compute a ranking value for the JOB being filed, and for all the jobs against<br />

which this job's ranking value must be compared in order to insert it properly.<br />

A somewhat more complex use of a function attribute is found in Program 6-2, which uses an attribute<br />

of the first member of a set owned by an entity as the ranking value for that entity's filing in<br />

another set.<br />

274

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

Saved successfully!

Ooh no, something went wrong!