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.

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

Table 5-10. Before and After Arguments<br />

Operation Before After<br />

creating an entity (not allowed) Entity identifier<br />

destroying an entity Entity identifier (not allowed)<br />

scheduling an event Entity identifier, time Entity identifier, time<br />

canceling an event Entity identifier Entity identifier<br />

filing in a set Entity identifier, set subscripts Entity identifier, set subscripts<br />

removing from a set Entity identifier, set subscripts Entity identifier, set subscripts<br />

Note: In file before and file after statements, the identifier of the second named entity is not<br />

passed as an argument.<br />

In some implementations the entity identifier passed for a remove first or remove last has a<br />

zero value.<br />

Removals from the events set by the timing routine may not be monitored by the above statements,<br />

as these are not done in the usual way. <strong>SIMSCRIPT</strong> <strong>II.5</strong> does provide a mechanism by which, under<br />

program control, the activation of events or processes may be monitored. A subprogram variable,<br />

between.v, may be assigned the name of a routine which will then be called immediately before<br />

each new activation of a process or event routine. At the time that the between.v routine is called,<br />

the simulation time, time.v, will already have advanced to the time.a attribute of the selected<br />

event or process notice, the global variable event.v has been updated to the event or process priority<br />

class, and the global variable of the same name as the event or process type holds the pointer<br />

to the event or process notice, allowing the attributes to be referenced. This event tracing may be<br />

inhibited at any time by resetting between.v to zero.<br />

5.7 Synchronous Variables<br />

Recall that it is possible for two or more process interactions or events to be scheduled for precisely<br />

the same instant in simulation time. The order of activation of the associated routines is then determined<br />

from the class or priority of each, while the value of time.v remains constant. This operation,<br />

however, may not prove satisfactory if two or more of these routines must access the same<br />

variable. If it is modified by the first, this modified value is the one accessed by the second. What<br />

is required is a mechanism by which such values appear unchanged until all events at an instant have<br />

been completed, and the simulation time has been advanced. Such a mechanism may be programmed,<br />

using the between.v feature. In the following example, we assume that the values<br />

which may be accessed by "parallel interactions" are elements of a one-dimensional array. A memo<br />

entity is created, through left-hand monitoring of these values (discussed in paragraph 6.10), for<br />

each assignment to any value. A routine called through the between.v variable updates the values<br />

appropriately, using an equivalenced name to inhibit monitoring, at the first change in simulation<br />

236

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

Saved successfully!

Ooh no, something went wrong!