UNIT6

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 28

UNIT6

SIMULATION
PROGRAMMING LANGUAGES
Simulation languages
• Unfortunately, there is a bewildering variety of simulation
languages. Of scores of simulation languages that have
been designed, implemented, and used, there is no single
language which can be termed as the "best," "most
useful," or "universally" available. Most of these languages
are suited for a narrow class of applications.
• If we were simulating a military system we might pick
MILITRAN; but for simulating a world dynamics model we
would perhaps use DYNAMO; for simulating a sampled-
data system we might use BLODIB; but for simulating a
job-shop scheduling. GPSS would be preferred.
continued
• In addition to the nature of a system being
simulated, the availability of the hardware and the
software also dictates the choice of a language.
• If we have only a minicomputer at our disposal, we
would not consider implementing a "large" language
such as SIMSCRIPT II.5 for our simulation
experiments.
• Availability of a simulation language is an obvious
but very important consideration in choosing a
language.
Continuous and discrete simulation
languages

• Continuous simulation languages are


designed for simulating continuous models
and discrete simulation languages for
discrete models-models that change their
states abruptly at discrete points in time.
• More recently, a few languages have been
designed which are suitable for both
discrete as well as continuous models.
continued
• These continuous and discrete variables, of
course, interact with each other.
• GASP IV is perhaps the best known example of
a combined simulation language.
• Other examples are GSL-A (Generalized
Simulation Language), CLASS (Composite
Language Approach for System Simulation), and
PROSE (Problem Level Programming System).
Continuous simulation languages

• As soon as the digital computer arrived, some of its advantages (such as


greater accuracy, freedom from scaling) over the analog computer became
obvious.
• Therefore, special program packages (canned programs) were implemented
on digital computers to make a digital computer appear like an analog
computer.
• These so-called digital analog simulators (program packages) were meant
either to replace an analog computer or check the results
of an analog simulation on a digital computer.
• Such a simulation language (that makes a digital computer emulate an
analog computer) is called a Meck-structured coste simulation language.
• It requires the user to prepare an analog-compute-type block diagram and
then input this diagram. Later, more versatile expression-based simulation
languages were developed.
Mock-structured continuous simulation languages

• As pointed out in the last section, block-


structured continuous simulation languages
were the first to be devised. They were
designed to simulate only those systems that
could be represented as analog block
diagrams, and thus their application area is
restricted.
continued
• The first such digital analog simulator was designed by R. G. Selfridge
in 1955 and implemented on the 18M 701 computer. It used
Simpson's rule for integration. Selfridge's simulator was followed by a
host or similar (block-oriented) languages, in the late 1950's and the
early 1960's. The better-known amongst these were DEPI (1958, on
DATATRON 204 Computer, using the fourth-order Runge-Kutta
method for integration);
• DEPI-4 rewritten DEPI for the IBM 704 computer, in 1959); DYSAC (in
1961, on the CDC 1604 computer, fourth-order Runge-Kutta): DAS (in
1962, on the IBM 7090 computer, using Euler's formula for
integration) and MIDAS (in 1963, using variable- stop Bith-order
predictor-corrector method for integration). MIDAS became an
outstanding success.
MOBSSL-UAF : (Merritt and Millers Own
Block Structured Simulation language
It is an interactive augmented block-structured simulation language
for continuous systems.
It is an extremely simple language to learn,
One need not have any prior programming knowledge or experience.
MOBSSL is a descendant of the IBM 1130 CSMP, but it has overcome
some of the rigidity of the latter by incorporating additional features,
such as, disk I/O blocks; a gradient processor; a variable constant; a
storage block; a large selection of trigonometric functions; and
digital-to-analog and analog- to-digital blocks for hybrid computation.
MOBSSL-UAF was developed at the University of Southern California
in 1969 and implemented on a number of mid-sized computers
including PDP-11/40, IBM 360/44 as well as on CDC 3600, IBM S/370.
continued
• In 1966 a compiler version was also written. It is available on many
computers including the IBM 1620, 7040, and 7090 families, and UNIVAC
1107 and 1108.
• By the mid-1960's the use of the digital computer for simulation of
continuous systems was well-established and so were the block-oriented
simulation languages. The development of new languages has, of course,
continued. We will now briefly describe a block-oriented continuous
simulation language and illustrate its use with an example:
• A block-structured language requires the user to first prepare a block
diagram to represent the system to be simulated (just as he would do to
simulate it on an analog computer). Then he must provide "patching"
instructions, which specify how these blocks are to be connected together.
• A typical block-oriented language (such as the IBM 1130 CSMP) pro- vides
a number of standard functional blocks
Expression-based languages

• A purely block-oriented continuous system simulation language is severely


limited because of its small specialized vocabulary. It does not allow any
FORTRAN-type statements. Therefore no relationship or equation in the system
can be expressed directly. The system must first be represented in an analog-like
block diagram.
• Thus the block-oriented languages are suited for those who "think analog," and
model their system by a block diagram and not for those who model their system
as a set of equations.
• Around 1965, after the outstanding success of MIDAS (which was a purely block-
oriented language), this limitation was realized, and a successor of MIDAS called
MIMIC was written for the IBM 7090 family of computers. In MIMIC one could write
FORTRAN-like statements also (along with representing the block diagrams).
• Such a feature eliminates the necessity of drawing a block diagram. Differential,
algebraic and logical equations (representing the model of the system being
simulated) can then be written directly as statements or expressions in the
language
continued
• Continuous system simulation languages such as BEDSOCS
(Bradford EDucational Simulation language for Continuous
System) are called expression-based or statement-based
continuous system simulation languages.
• Expression-based languages do not need to follow block-
structures of the analog patchboards but directly implement the
differential equations of the model.
• A large number of expression-based languages have been
designed and implemented-some popular, others obscure. We
will first discuss some of the important common characteristics
of these languages and then give a brief survey of some better
known members in this class
Methods of integration
• In most expression-based languages several different routines are
available for the user to choose from. They include both fixed step-size
routines and variable integration step-size routines.
• For example, in S/360 CSMP five fixed-size routines are avail- able: fixed
Runge-Kutta, Simpson's, trapezoidal, rectangular, and second- order
Adams.
• Two variable step-size routines are also available: fifth- order Milne
predictercorrecter and fourth-order Runge-Kutta.
• The integration step A is automatically varied during the problem
execution to satisfy the user specified error criterion.
• If none of these seven methods satisfy the S/360 CSMP requirement,
he could use a dummy integration - routine named CENTRL and specify
any other method of integration he wishes.
Automatic Sequencing of Statements
• As every programmer knows an assignment statement in a program
would be invalid if all the variables appearing on the right hand side had
not already been defined by earlier statements.
• Likewise, it is necessary to ensure in a simulation program (as in any
other program) that the statements appear in a correct sequence.
• However, in writing a simulation program for a large complex system,
this task (of ensuring a correct sequence of statements) may be too
much of a burden on the programmers. Therefore, most of the
expression based simulation languages have a built-in facility which
automatically sorts the input statements into a proper calculational
order.
• Thus the user is free to input the statements in any arbitrary order, and
not be burdened with putting them in a correct sequence.
Intermediate Language
• Most of the expression-based languages are designed to be
extensions of some well-known, existing high-level language. For
example, BEDSOCS is an extension of BASIC. Similarly, DSL/90 and
S/360 CSMP are extensions of FORTRAN.
• Thus the capability of FORTRAN is available to the user of the S/360
CSMP. Expressions in S/360 CSMP can be intermixed with FORTRAN
statements. The standard FORTRAN library of functions such as
cosine, tangent, absolute value are available to the programmer.
• A preprocessor first translates all the non-FORTRAN statements (of
S/360 CSMP) into FORTRAN. These statements along with the
FORTRAN statements (which were intermixed with the S/360 CSMP
statements) constitute a single program, which then gets compiled by
the FORTRAN compiler and run.
continued
• The advantages of having an intermediate language are obvious-the power,
flexibility, ease of implementation. The price one pays for this facility is
increased preprocessing time, as the language first has to be translated into
the intermediate language and then into the machine language before being
executed.
• For example, a simulation program written in MIMIC (a language where the
compiler translates simulation programs directly into machine language
without going through an intermediate lan- guage) takes much less
translation time than the same program written in DSL/90 (or S/360 CSMP).
• Another disadvantage of using an intermediate language is that the
programmer has also to become proficient at the intermediate language in
order to use the simulation language effectively.
Prepackaged Input Output

• In an expression-based continuous system simulation language the


input is usually of free-form. The user does not have to format it.
Similarly, the output is also displayed (printed or plotted) in a fixed
format by means of a built-in output package. One has only to specify
the variables to be displayed and the increments of the independent
variable (time).
• For instance, in our example of the BEDSOCS program for host-
parasite problem we simply asked that the host-population H, ad the
parasite population, P, be displayed on the CRT screen against time,
with a vertical scale of 100 creatures per unit height of the screen,
with a single statement DISPLAY H/100, P/100. This prepackaging of
input/output relieves the programmer from the task of formatting
them.
Macro Facilities
• An important feature available in many of the expression-based
languages is the powerful function-defining capability called
macro.
• It allows the user to build larger functional blocks from the basic
functions available in the language, and thereby, to identify, a
subsection of a simulation block diagram or the corresponding
subset of 12(45-123/77) structure statements.
• Once defined, macro functions may be used any number of
times, as if they were operators of the language. As an
illustration, we will show how this facility is used in S/360 CSMP,
with the help of the following example.
(f) Optional Block-Oriented Representation: Many of the expression- based
languages incorporate the facilities of a block-oriented language also. This
accommodates both type of users-those who model their system as a set of
equations and those who model their system as a set of intercon- nected blocks.
Most of the popular expression-based languages, such as S/360 CSMP, CSSL,
DSL, have this facility.
There are many other features which distinguish these languages. For
example, BEDSOCS incorporates only first order derivative equations. but many
languages can accept higher order equations written directly. For instance, in such
a language
𝑑 3𝑥
=y
𝑑𝑡 3
could be written directly as
DER 3 (X) = Y
and would not have to be converted into three equations such as
DER (X) = Z1
DER (Z1) Z2
DER (Z2)= Y.
continued
• It is neither possible in this limited space, nor desirable to give a complete
description of any specific expression-based simulation language. Such
descriptions can be found in various manuals supplied by the manufacturers.
We will merely highlight some features of a few of the better known languages
in this class:
• DSL: DSL (Digital Simulation Language) is a classic and a very well- known
continuous system simulation language. This language, which was developed
by IBM, first in 1964 as DSL/90 for its 7090/7094 computers, has gone through
many revisions, modifications, and implementations for different computers.
• Some of these are DSL/40 (for the IBM 7040): DSL/44 (for the IBM 360/44);
DSL/1130 (for the IBM 1130); DSL/1800 (for the IBM 1800); and DSL/360 (for
the IBM System 360). It has also been implemented on IBM's System 3 and
System 7. System/360 CSMP is an implementation of DSL to some of the IBM
360 computers. DSL is an extension of FORTRAN.
S/360 CSMP
• S/360 CSMP (Continuous System Modeling Program) language can
handle either expressions or block-oriented descriptions.
• As mentioned earlier, it is a preprocessor with FORTRAN as an
intermediate language, i.e., it accepts a simulation model description
and run-time instructions and produces a FORTRAN program which
can be compiled and executed.
• The user's original program can contain FORTRAN statements and use
FORTRAN subroutines. Capabilities of this language include seven
integration methods, over 50 simulation functions, and macros, and
excellent diagnostics and debugging aids.
• Input/output formats are rich and include various tabular and plot
arrangements. It is not a difficult language to learn, but it is
computationally expensive.
CSSL
• CSSL (Continuous Systems Simulation Language) was defined
in 1967, in accordance with the recommendations made by a
Simulation Software Committee formed by Simulation
Councils, Inc. The Committee has combined desirable
features of a simulation language, related to: application
areas, programming skills and digital computers.
• The language has a powerful capability to be extended in
order to satisfy users requirements. As other good languages
it does have error control and debugging facilities.
• Integration can be done with the use of several available
numerical methods.
Versions of simulation
• Numerous versions of CSSL have been
implemented. For example, CSSL III on CDC
6400 and XDS Sigma 7; CSSL IV on IBM
360/370, UNIVAC 1108/1110, DEC 10, and
CDC 6600/7600. A version of CSSL, called RSSL,
has also been implemented on CDC 7600.
Languages called HYTRAN and SL-1 are also
versions of CSSL.
DARE
DARE (Differential Analyzer REplacement) is a series of
continuous system simulation languages for batch and on-line
use. One version, DARE P(Portable), has been developed by
the University of Arizona. DARE P has been implemented on
IBM S/360, CDC 6000 series, and DEC 10 machines. Users can
add new integration algorithms or special library of subroutines.
FORTRAN can be used to control logic of the simulation
studies and define special functions. Problem equations are
entered in a form resembling mathematical notations, and the
associated procedural language is FORTRAN. Input data are
provided by format- free data cards. Outputs can be generated
on a line-printer, or a CalComp plotter can be used.
continued
The following integration methods are incorporated:
Runge-Kutta Merson, fourth-order Runge-Kutta, third-
order Runge- Kutta, two-point Runge-Kutta, Adam's
two-point predictor, simple Euler one-point predictor,
and two methods (Pope's and Gear's) for solving
systems of stiff differential equations.
The language can be used interactively using PDP-9
computers. Other versions of DARE run on the PDP-
11 series computers, including one version which
runs on the PDP-11V03 (LSI-11 microcomputer).
DYNAMO
• DYNAMO (available on IBM 360, 370, 7090, B 5500, UNIVAC 1107,
1108) is the most widely used simulation language amongst economists
and social scientists. It was developed in the late 1950's by J. W.
Forrester and his industrial dynamics group at MIT. It uses first order
difference equations to approximate the modeled continuous process.
• The dynamic systems are described in terms of levels and rate equa
tions and continuous variables. The level variables (commodities,
money, population, etc.) characterize the state of the system at any
particular time. They accumulate the flows described by the rate
equations and variables.
• These equations and variables define how quickly the levels are
changing. Using these two types of equations and variables it is possible
to model many systems that can be classified as feedback systems.
continued
• The DYNAMO compiler accepts the model written in the form of level,
rate and auxiliary equations using special postscript notation. The
compiler functions are: (a) error control; (b) sequencing equations
according to the structural concepts of system dynamics; (c)
compilation of the program defining the model: and (d) execution of
the program and generation of output in a tabular or graphical form.
• The language has many computational facilities in the form of special
statistical and mathematical functions. One of the signi ficant
weaknesses of the language is a very primitive and inaccurate
integration scheme (Euler's method).
• In spite of this deficiency DYNAMO has been extensively used to
model and solve numerous information feedback systems. It has
great appeal to social scientists because of its conceptual simplicity
and ease of use.
MIMIC
• As mentioned early in this section, MIMIC was one of the first expression-
based continuous system simulation languages, developed originally in
1965 for the IBM 7090 family of computers. It still remains a popular
language for solving engineering problems and is regarded as an
alternative language to DYNAMO.
• This language has very rigid coding requirements, and has only one
integration subroutine, which uses fourth- order Runge-Kutta variable-step
method.
• A MIMIC program is directly translated into a machine-language program
(without going through an intermediate language, such as FORTRAN), and
it has only limited diagnostics. Therefore MIMIC is an inexpensive language
to use in terms of the preprocessing time. It has been implemented on the
UNICAC 1107, 1108, and CDC 6000 series of computers amongst numerous
others.

You might also like