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.

Modelling Concepts<br />

preamble<br />

normally dimension is 2<br />

the system has an EXCESS<br />

define EXCESS as an integer array<br />

normally dimension is 0, mode is real<br />

the system has a VALUE and owns a COLLECTION<br />

permanent entities<br />

every SAMPLE belongs to the COLLECTION<br />

and has a PRICE and a NAME<br />

temporary entities<br />

every POINT has an IDENTITY and a<br />

COLLECT.TIME<br />

define NAME and IDENTITY as text variables<br />

This preamble defines five system attributes, one of which is real-valued (VALUE), one of which<br />

is a base pointer for a two-dimensional array (EXCESS) whose elements are integer-valued, one<br />

of which is an integer counter for set members (N.COLLECTION), and two of which are set<br />

pointers (F.COLLECTION and L.COLLECTION). The preamble also defines a class of permanent<br />

entities (SAMPLE) and a class of temporary entities (POINT). Each entity of type SAMPLE has two<br />

set pointer attributes (P.COLLECTION and S.COLLECTION), an integer set membership flag<br />

(M.COLLECTION), a real attribute (PRICE), and a text attribute (NAME). These attributes are stored<br />

as one-dimensional arrays, of dimension N.SAMPLE. Each entity of type POINT has a text attribute<br />

(IDENTITY) and a real attribute (COLLECT.TIME). These attributes are stored in individual<br />

locations within the temporary entity structures.<br />

Figure 4-10 illustrates the storage of the attributes of the N.SAMPLE permanent entities of the class<br />

SAMPLE. Figure 4-11 illustrates the layout of an entity record for a temporary entity of the class<br />

POINT. Figure 4-12 shows the arrangement in memory of the system attributes VALUE, EXCESS,<br />

F.COLLECTION, L.COLLECTION, and N.COLLECTION.<br />

4.8 Sets: Their Declaration and Use<br />

Sets are declared in every statements when their owner and member entities are defined. Every<br />

set must have an owner, either an entity or the system, and can have either permanent or temporary<br />

entities as members, but not both.<br />

Sets named in every statements have the following properties:<br />

1. Owner entities have first and last-in-set pointers named F.set and L.set.<br />

2. Member entities have predecessor and successor pointers named P.set and S.set.<br />

3. Set members are ranked on a first-in, first-out basis when they are put in a set.<br />

4. Each member entity has a membership named M.set that is a non-zero value if an entity is<br />

in the set, and zero if it is not. Note that M.set is non-zero if an entity is in any set with<br />

the given name. A non-zero value does not guarantee the entity is in one specific set.<br />

151

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

Saved successfully!

Ooh no, something went wrong!