SI M SCR I P T .
4.4 SI M SCR I P T .
SIM SCRI PT was developed by RAND corporat ion in t he early 1960‘ s and was … rst released in 1962. It has undergone many revisions and improve- ment s, including t he development of SIMSCRI PT I .5 . A complet ely new version SI MSCRIPT I I was released by t he RAND corporat ion in 1968. T he lat est ver sion is SI MSCRI PT I I .5, which was released in 1972.
Thelanguage is very FORT RAN likein appearance; in fact init ially it was implement ed wit h FORTRAN as an int ermediat e language. SI MSCRIPT I I ( I I .5) can be viewed as a general programming language wit h ext ra feat ures for discr et e-event simulat ion. Because of t his general power and it s FOR- TRAN base , SI MSCRIPT has been widely implement ed and used discret e simulat ion language. I t has been implement ed on IBM 7090, 7094, 360,370 series and many ot hers.
² Level 1 of SI MSCRIPT I I is comparable t o a very simple algorit hmic language such as BASIC . An inexperienced user would appreciat e such feat ur es as : format free dat a and ease of programming , simpli…ed out put opt ions and aut omat ic mode conversion.
² For example consider, t he following simple st at ement s in SI MSCRIPT
I I .5 ² READ X, Y AND N
² PRI NT 1 LI NE WI TH X, X/ Y, N* * 2 AS FOLLOWS ² X=**. * , Y= * * . * , X/ Y= * * . * , N SQUARED = * * *
² The …rst st at ement reads t he values of t he t hree variables X, Y, and N . The second st at ement evaluat es X , Y , X/ Y and N2 and display t heir values.
² Level 2 of SIMSCRI PT I I.5 , provides addit ional facilit ies in t he area of dat a st ruct ures. The language allows const ruct ion of piecemeal arrays( eg; t wo-dimensional arrays wit h di¤erent number of element s in each row.)and complex t ree st ruct ures.
² Level 3 provides ALGOL like st at ement s . T he …rst t hr ee levels view SIM SCRI PT I I as an algebraic procedural language.
² Level 4 gives SI MSCRIPT I I a power t o de…ne and manipulat e ent i- ² Level 4 gives SI MSCRIPT I I a power t o de…ne and manipulat e ent i-
Ent it ies can be of t wo types: permanent ( speci…ed for all t imeof program execut ion) and t emporary(speci…ed
dynamically as t he program proceeds) . Temporary ent it ies are physically creat ed and dest royed t hrough special st at ement s . Permanent ent it ies have t heir at t ribut es st ored as arrays. Ent it ies may be declared as t emporary or permanent in t he PREAMBLE of a SI MSCRI PT I I program.
SI MSCRIPT I I requires a model t o be speci…ed only in t erms of separat e event s, and scheduling an event means …ling an ” event not ice” in t he ” event set ” .
Ex; SCHEDULE A DEPARTURE AT TI ME.V+ 8.5 Schedules an event called DEPARTURE t o occur at t he current simulat ed
t ime, given by t he variable TI ME.V, plus 8.5 t ime unit s. SI MSCRIPT I I provides eleven funct ions for gener at ing pseudo-random samples from t he following st at ist ical dist ribut ions: Uniform, Normal, Pois- son, exponent ial, bet a , Erlang, lognormal , binomial, gamma, Weibull, and uniformly dist r ibut ed int egers.
Two st at ement s , ACCUMULATE and TALLY , are used in t hePREAM- PLE t o inst ruct t he compiler t o generat e aut omat ic dat a collect ion and analy- sis st at ement s at appropriat e places in t he program.
Example: Program for simulat ion of single-server queueusing SI MSCRI PT
I I .5 SI MSCRIPT I I .5 programs st art wit h a preamble t hat describes t he com-
ponent s of t he model. T hese are : (a) processes
(b) resources (c) variables and st at ist ics gat hering variables.
Thepreamble servesa double purpose . Declaring all of t hecomponent s of t he program causes t he SI MSCRI PT I I .5 compiler t o check each component ment ioned in t he preamble for consist ent and correct usage in t he program code. T he syst em keywords are writ t en in lower or mixed case and user declared variables in upper case .
Not e t hat , once t he t wo pr ocesses are declared , t he preamble adds an at t ribut e ,
Resources are a built -in capabilit y in SI MSCRIPT I I.5 , so it is only necessary t o declare t hem. Aft er t he processes and resources are declared in t he preamble , t he pro- gram var iables are also declared . Not e t hat t he keywords ” Tally” and ” Accumulat e ” are also declared in t he preamble. The Accumulat e keyword is t he same as t he Tally keyword except t hat it weighs it s aver age wit h respect t o t he simulat ion t ime which has elapsed.
The Tally keyword speci…es t hat TI ME.I N.SYSTEM will be monit ored. Whenever an assignment is made t o t he variable T IME.I N.SYSTEM, st at is- t ics will be aut omat ically gat hered. The part icular st at ist ic t hat will be kept in t his case is t he average of all assignment s t o t his variable. T he average will be called MEAN.TI ME.I N.SYSTEM .
N.Q.SERVER is one of t he at t ribut es of t he SERVER resource t hat is aut omat ically generat ed and managed by t he syst em t o keep t rack of t he SERVER resource‘ s queue st at ist ics. M AX.QUEUE is t he highest number ever wait ing in t he queue for service.
N.X.SERVER is an at t ribut e of SERVER resource, aut omat ically gener- at ed by t he syst em t o keep t rack of resource ut ilizat ion st at ist ics. The pr ogram st art s execut ing in t he Main sect ion where program vari- ables are init ialized, pr ocesses creat ed and act ivat ed and t he simulat ion is st art ed. Aft er one resource called SERVER is creat ed t hen one cust omer generat or process is creat ed. Once t he simulat ion has run it s course and …nished , t he report generat or is called and t he program t erminat es at t he End st at ement .
The cust omer process code , illust rat es how readable SI MSCRI PT I I .5 code helps t he reader t o underst and a model. First , a local variable called ARRI VAL.TI ME is declared and used t o not e t he current simulat ion t ime which is t aken from t he syst em variable called T IM E.V. The cust omer process t hen request ed for on unit of SERVER resource. If one unit of resource is not available , t he cust omer process blocks and wait s for an inde…nit e t ime unt il t he resource is available. It t hen cont inues t o work st at ement , and , once …nish wit h t he resource , t he cust omer process relinquishes it , comput es st at ist ics and t erminat es.
The next part of t he program, generat es t he int er arrival t ime from t he exponent ial dist ribut ion. The last part is t he report generat or .