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.

Modelling Concepts<br />

VESSEL<br />

V(I)<br />

NAME<br />

TONNAGE<br />

NAME<br />

TONNAGE<br />

Figure 4-8. Entity Creation<br />

If desired, the words a or an can be used after create to improve readability, as in:<br />

create a SHIP called QUEEN.MARY<br />

create an EVENT called BIRTH<br />

If no variable is specified in a called clause, the entity identification number is assigned to the<br />

global variable with the same name as the entity class. Recall that the every statement implicitly<br />

declares a global pointer variable with the same name as the entity class. The statement:<br />

create a SHIP<br />

allocates space for a SHIP entity, and assigns the pointer value to the automatically defined global<br />

variable named SHIP. It is interpreted as if written:<br />

create a SHIP called SHIP<br />

The attributes of a particular instance of a temporary entity are referenced using the notation:<br />

as in:<br />

and:<br />

attribute name(identification number)<br />

NAME(VESSEL)<br />

TONNAGE(QUEEN.MARY)<br />

Because attribute references refer to locations in memory, like variable names, they can be used in<br />

the same way that variables are used — in input/output lists and in logical and arithmetic expressions.<br />

For example:<br />

145

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

Saved successfully!

Ooh no, something went wrong!