Presentation is loading. Please wait.

Presentation is loading. Please wait.

SIMSCRIPT SIMSCRIPT is a general-purpose simulation language

Similar presentations


Presentation on theme: "SIMSCRIPT SIMSCRIPT is a general-purpose simulation language"— Presentation transcript:

1 SIMSCRIPT SIMSCRIPT is a general-purpose simulation language
SIMSCRIPT was developed in 1962 by Nobel Prize Laureate Harry Markowitz and his team to support an Air Force RAND project in efficient preparation of simulation models. Powerful, English-like general-purpose and simulation language SIMSCRIPT III is the only simulation package (programming language + ancillary features) It support object-oriented simulation development. It has an Interactive Development Environment (IDE) SimStudio. SIMSCRIPT III can be used in broad range of simulation areas: telecommunications, simulation of factory processes, airport logistics, theater-level military training exercises with large geographical situation maps and with animated military units, flight formations, ships, etc. Ajith G.S: poposir.orgfree.com

2 SIMSCRIPT SIMSCRIPT III creates portable models which can run on PC Windows platforms, UNIX workstations, and on 32-bit and 64-bit PC Linux platforms. SIMSCRIPT III also provides database interface for storing and retrieving simulation. Ajith G.S: poposir.orgfree.com

3 SIMSCRIPT System Concept:
The system to be simulated is considered to consist of entities having attributes that interact with activities. Temporary entities: The entities that are created and destroyed during the execution of a simulation. Permanent entities: These entities remain during the run. Sets: Entities can form sets. Event routine: Each type of event is described by an event routine, each of which is given a name and programmed as a separate closed subroutine. Endogenous (or internal) event: It arises from actions within the system. Exogenous (or external) event: It arises from actions in the system environment. Ajith G.S: poposir.orgfree.com

4 SIMSCRIPT System Concept:
SIMSCRIPT program structure consists of Entities Permanent Temporary Sets Event routines . Ajith G.S: poposir.orgfree.com

5 SIMSCRIPT System Concept:
The program structure of a SIMSCRIPT program is The SIMSCRIPT program consists of three primary elements: A preamble giving a static description of each modeling element is given. It is purely declarative. It includes no executable statements. All the modeling elements (processes and resources) must be named in the preamble. A main program where execution begins. Resources must be created and initialized before they can use by processes. This is usually accomplished in MAIN. A process/event routine for each process/event notice declared in the preamble. Ajith G.S: poposir.orgfree.com

6 SIMSCRIPT Organization of a SIMSCRIPT program
Event notices: These are created when it is determined that an event is scheduled. Each event notice records the time the event is due to occur and the event routine that is to execute the event. Ajith G.S: poposir.orgfree.com

7 SIMSCRIPT Organization of a SIMSCRIPT program
Execution cycle of a SIMSCRIPT program The event notices are filed in chronological order. When all events that can be executed at a particular time have been processed, the clock is updated to the time of the next event notice and control is passed to the event routine identified by the notice. Each event notice records the time the event is due to occur and the event routine that is to execute the event. If the event executed by a routine results in another event, either at the current clock time or in the future, the routine must create a new event notice and file it with the other notices. Ajith G.S: poposir.orgfree.com

8 Example: AGE, AB12, PERSON.AGE
SIMSCRIPT Names and Labels: Names may consist of any combination of letters and digits provided there is at least one letter. Period (“.”) can be used. Example: AGE, AB12, PERSON.AGE Labels: Labels are used for identifying programming statements similarly consists of any combination of letters and numbers. Period (“.”) can be used. Labels are identified by being enclosed between single quotation marks. Example: ‘LABEL1’, ‘AB12’, ‘1234’ Ajith G.S: poposir.orgfree.com

9 PRINT n LINES AS FOLLOWS PRINT n LINES THUS
SIMSCRIPT SIMSCRIPT statements # Print statements: PRINT n LINES AS FOLLOWS PRINT n LINES THUS # Print with the values of a variable: PRINT n LINES WITH X AND Y LINE THIS # Three digit integer * * *, Four digit real number with one decimal place would be indicated by * * * .* Ajith G.S: poposir.orgfree.com

10 SIMSCRIPT A simple example of a SIMSCRIPT II.5 program: read X and Y
add X to Y print 1 line with Y thus The Sum is: ***** stop This program consists of four statements. 1. Read the values of two variables called X and Y from input data 2. Add these variables together 3. Print the sum of the variables along with the message, The Sum is:, and 4. Stop. In the example, read, and, add, to, print, line, with, thus, and stop are all SIMSCRIPT words. X, Y, and the phrase, add the current value of X to the current value of Y, giving Y a new value The Sum is: are expressions provided by the programmer. Ajith G.S: poposir.orgfree.com

11 Text Let TITLE = “Far and away” Reading Input Data
SIMSCRIPT Variables Integer Let NUMBER = 1 Real, Double Let MONEY = 5.50 Alpha Let GRADE = “A” Text Let TITLE = “Far and away” Reading Input Data The general form of a read statement is: read variable name list Eg read X, Y and QUANTITY Ajith G.S: poposir.orgfree.com

12 Arithmetic Expressions
SIMSCRIPT Arithmetic Expressions Arithmetic expressions are formed by combining variables and constants with arithmetic operators. The arithmetic operators are + (add), - (subtract), * (multiply), / (divide), and ** (exponentiate). Ajith G.S: poposir.orgfree.com

13 SIMSCRIPT Print Statement
The variables PRICE and ITEMS appearing in the following print statements are assumed to have the values and 27, respectively: 1. print 1 line with PRICE/ITEMS thus PRICE/ITEM = $*.*** is printed as: PRICE/ITEM = $3.737 2. print 3 lines with PRICE, ITEMS, PRICE/ITEMS thus PRICE = $***.* ITEMS = * PRICE = $100.9 ITEMS = 27 Ajith G.S: poposir.orgfree.com

14 SIMSCRIPT if statement is used to test the truth or falsity of a logical expression and to choose between The general form of the if statement is: if logical expression first group of statements else second group of statements Always Eg: if STATUS = BUSY add 1 to QUEUE let STATUS = BUSY always Ajith G.S: poposir.orgfree.com

15 print 1 line with I and I ** 2 thus THE SQUARE OF * IS * output
SIMSCRIPT For loop for I = 1 to 3 by 1 print 1 line with I and I ** 2 thus THE SQUARE OF * IS * output THE SQUARE OF 1 IS 1 THE SQUARE OF 2 IS 4 THE SQUARE OF 3 IS 9 Ajith G.S: poposir.orgfree.com

16 The general form of a control phrase is: for V = E1 to E2 by E3
SIMSCRIPT For loop The general form of a control phrase is: for V = E1 to E2 by E3 where E1, E2, and E3 are arithmetic expressions, and V is a variable. E3 must be greater than zero, or an error results. Ajith G.S: poposir.orgfree.com

17 SIMSCRIPT Nested Loop for NUM = 1 to 12, for MULT = 1 to 10,
print 1 line with MULT, NUM, and MULT * NUM thus ** TIMES ** IS *** o/p 1 TIMES 1 IS 1 2 TIMES 1 IS 2 3 TIMES 1 IS 3 . 10 TIMES 1 IS 10 1 TIMES 2 IS 2 2 TIMES 2 IS 4 3 TIMES 2 IS 6 Ajith G.S: poposir.orgfree.com

18 A comment is delimited on the left by two single apostrophes ('').
SIMSCRIPT Array for I = 1 to N read LIST(I) A comment is delimited on the left by two single apostrophes (''). Ajith G.S: poposir.orgfree.com

19 SIMSCRIPT Sample program
Finding the Area of a Triangle The program calculates the area and perimeter of a triangle with the lengths of the sides A, B, and C as input data. The first if statement verifies that none of the sides is of zero or negative length. The second if statement checks that the values read will form a triangle, based on the condition that The sum of the lengths of any two sides is greater than the length of the remaining side. All three conditions of the if statement must prove false before control is passed to the group of statements that calculates the area and perimeter. Ajith G.S: poposir.orgfree.com

20 SIMSCRIPT Sample program
Finding the Area of a Triangle ‘’Program to Compute the Area and Perimeter of a Triangle read A,B,C print 2 lines with A,B,C as follows CALCULATE AREA OF A TRIANGLE WITH FOLLOWING SIDES: A=**.** B=**.** C=**.** if A <= 0 or B <= 0 or C <= 0 print 1 line as follows TRIANGLE CONTAINS SIDE OF ZERO OR NEGATIVE LENGTH. else if A+B <= C or B+C <= A or C+A <= B print 1 line thus SIDES DO NOT FORM A TRIANGLE. else let S = (A+B+C)/2 let AREA = (S*(S-A)*(S-B)*(S-C))**O.5 print 1 line with AREA, 2*S as follows THIS AREA IS ***.** PERIMETER = ***.** always end Ajith G.S: poposir.orgfree.com

21 SIMSCRIPT Sample program
Routine Definition A SIMSCRIPT II.5 program may be composed of several program sections: a preamble (data declaration) section, a main routine, and a number of subprograms. The variable declaration section is headed by the word preamble and terminated by the word end. Ajith G.S: poposir.orgfree.com

22 SIMSCRIPT Sample program
Routine Definition main This is not strictly necessary. Since all other sections of a program must have a heading, it is possible to omit the main statement complete program may have only one main like all other program sections, main should be terminated by the word end like all other program sections, should be terminated by the word end Ajith G.S: poposir.orgfree.com

23 SIMSCRIPT Sample program
Routine Definition A subprogram definition statement 1. Declares that the statements following are part of a subprogram 2. Names to the subprogram 3. Sets up a communication mechanism for passing data to and from the subprogram. Each variable and subprogram name must be unique. Ajith G.S: poposir.orgfree.com

24 SIMSCRIPT Sample program
Routine Definition A subprogram definition of the simplest form is: routine name The optional words to and for are allowed after the word routine. Eg : routine SQUARE.ROOT or routine for SQUARE.ROOT For the execution , calling the subprogram and commonly takes the form: call name Ajith G.S: poposir.orgfree.com

25 SIMSCRIPT Sample program
preamble normally, mode is integer normally, mode is real end main read N read V1 and V2 call PROCESS.DATA routine PRINTOUT print 1 line thus Hello I am Here return Ajith G.S: poposir.orgfree.com

26 SIMSCRIPT Sample program
A preamble can have more than one normally statement. normally define properties for local variables Ajith G.S: poposir.orgfree.com


Download ppt "SIMSCRIPT SIMSCRIPT is a general-purpose simulation language"

Similar presentations


Ads by Google