











Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
This document will teach you system simulation and modeling
Typology: Lecture notes
1 / 19
This page cannot be seen from the preview
Don't miss anything!












Chapter two Simulation concepts Discrete and Continues Systems
A discrete system is one in which the state variables change only at a discrete set of points in time. Bank example
A continues system is one in which the state variables change continuously over time: Head of water behind the dam
Stochastics and Deterministic system
Stochastic simulation system is a system where the output of the system is not determined from the input values where as in Deterministic simulation system the output can be determined. Model that have no random input are deterministic.
STATIC VS DYNAMIC – Time doesn’t play a natural role in static model but does in dynamic models.
Markov Chains (please refer your exercise book)
Generation of random numbers
Defining Random It is impossible to appreciate a random number generator without first understanding what it means to be random. Developing a well-rounded definition of randomness can be accomplished by studying a random phenomenon, such as a dice roll, and exploring what qualities makes it random. To begin, imagine that a family game includes a die to make things more interesting. In the first turn, the die rolls a five. By itself, the roll of five is completely random. However, as the game goes on, the sequence of rolls is five, five, five, and five. A generally accepted and basic definition of a random number sequence is as follows: a random number sequence is uniformly distributed over all possible values and each number is independent of the numbers generated before it (Marsaglia, 2005). A random number generator can be defined as any system that creates random sequences like the one just defined. Unfortunately, time has shown that the requirements for a random number generator change greatly depending on the context in which it is used. When a random number generator is used in cryptography, it is vital that the past sequences can neither be discovered nor repeated; otherwise, attackers would be able to break into systems (Kenny, 2005). The opposite is true when a generator is used in simulations. In this context, it is actually desirable to obtain the same random sequence multiple times. This allows
backgammon server to a company that uses the numbers for random drug screenings (Kenny, 2005). However, since the numbers are obtained over the Internet, it would be unwise to use them for security purposes or situations where the sequence absolutely needs to stay private. There is always the risk that the transmission will be intercepted. The random number generator from this site collects its entropy from atmospheric noise. Radio devices pick up on the noise and run it through a postprocessor that converts it into a stream of binary ones and zeroes. Scholars have pointed out that the laws governing atmospheric noise are actually deterministic, so the sequences produced by this generator are not completely random (Random.org, 2012). The proponents of this claim believe that only quantum phenomena are truly nondeterministic. Random.org has countered this argument by pointing out that the number of variables that would be required to predict the values of atmospheric noise are infeasible for humans to obtain. Guessing the next number produced would mean accurately recoding every broadcasting device and atmospheric fluctuation in the area, possibly even down to molecules. It has been certified by several third parties that the number sequences on this site pass the industry-standard test suites, making it a free and viable option for casual consumers of random numbers.
HotBits. The other popular free Internet-based random number generator is referred to as HotBits. This site generates its random number sequences based off of radioactive decay. Because this is a quantum-level phenomenon, there is no debate over whether the number sequences are truly non- deterministic. At the same time, the process involved in harvesting this phenomenon restricts HotBits to only producing numbers at the rate of 800 bits (100 bytes) per second (HotBits, 2012). Although the HotBits server stores a backlog of random numbers, the rate at which random sequences can be extracted is still limited in comparison to other options. As with Random.org, random numbers obtained from this generator are sent over the Internet, so there is always the possibility that a third party has knowledge of the sequence. This makes it unsuitable for security- focused applications, but Hotbits is useful when unquestionably random data is necessary.
Lasers. The use of lasers allows for true random number generators that overcome the obstacle of slow production. In laser-based generators, entropy can be obtained by several different means. Having two photons race to a destination is one method that is currently implemented (Stefanov, et al., 2008). Another high-speed technique is measuring the varying intensity of a chaotic laser. Prototype systems in this second category have been created that can produce random bits at rates
of over ten Gigabits per second (Li, Wang, & Zhang, 2010). The prototypes exhibited a natural bias toward one value over the other, so a post processor needed to be applied to create truly random sequences. A commonly used tactic is to take several bits at a time and exclusiveor them together to remove the unwanted bias. The stream of bits that emerged from this process was able to pass the most stringent randomness tests that are used for generators dealing with cryptography. Laser generators are capable of increased speeds, but they are complex to install and prohibitively expensive. Care needs to be taken during construction and installation that no bias is introduced, and the natural wear of the laser could also lead to it subtly producing more biased results over time. It is difficult to imagine laser-based generators being used in practical applications.
Oscillators. Oscillators, the final category of true random number generator to be discussed, make use of basic hardware, resulting in more convenient installation. An oscillator is a simple circuit obtained by placing an odd number of inverter gates in a loop. The final output of this configuration is undefined, since the current oscillates in a sine wave pattern over time. However, manufacturing is never perfect and defects always cause a slight and random deviation from a sine wave. These deviations are referred to as jitter, which is a common source of entropy in simple random number generators (Sunar, Martin, & Stinson, 2006). Because oscillators rely on manufacturing defects that cannot be replicated, they are part of a broader group of physical unclonable functions, or PUF (Gassend, Clarke, Dijk, & Devadas, 2002). PUF are simple hardware that rely on unrepeatable idiosyncrasies during production to create random patterns. There are many types of PUF; oscillators are part of the delay category since jitter is caused by delay introduced by differences in the wires and silicon. To increase the randomness of jitter, oscillators of different lengths can be combined and evaluated together. Oscillators are cheap to install and use in comparison to other types of physical devices since their components are commonly used.
Pseudo Random Number Generators
Random number generators that do not rely on real world phenomena to produce their streams are referred to as pseudo random number generators. These generators appear to produce random sequences to anyone who does not know the secret initial value. In a minimalistic generator, the initial value will be the only time entropy is introduced into the system. Unlike true random number generators that convert entropy sources directly into sequences, a pseudo random needs to find entropy to use to keep itself unpredictable. Classic tactics for accomplishing this include taking
Monte carlo simulation vs stochastic system
What is Monte Carlo simulation? Monte Carlo simulation is a computerized mathematical technique that allows people to account for risk in quantitative analysis and decision making. The technique is used by professionals in such widely disparate fields as finance, project management, energy, manufacturing, engineering, research and development, insurance, oil & gas, transportation, and the environment.
Monte Carlo simulation furnishes the decision-maker with a range of possible outcomes and the probabilities they will occur for any choice of action. It shows the extreme possibilities—the outcomes of going for broke and for the most conservative decision—along with all possible consequences for middle-of-the-road decisions.
The technique was first used by scientists working on the atom bomb; it was named for Monte Carlo, the Monaco resort town renowned for its casinos. Since its introduction in World War II, Monte Carlo simulation has been used to model a variety of physical and conceptual systems.
How Monte Carlo simulation works Monte Carlo simulation performs risk analysis by building models of possible results by substituting a range of values—a probability distribution—for any factor that has inherent uncertainty. It then calculates results over and over, each time using a different set of random values from the probability functions. Depending upon the number of uncertainties and the ranges specified for them, a Monte Carlo simulation could involve thousands or tens of thousands of recalculations before it is complete. Monte Carlo simulation produces distributions of possible outcome values.
By using probability distributions, variables can have different probabilities of different outcomes occurring. Probability distributions are a much more realistic way of describing uncertainty in variables of a risk analysis. Common probability distributions include:
Normal – Or “bell curve.” The user simply defines the mean or expected value and a standard deviation to describe the variation about the mean. Values in the middle near the mean are most likely to occur. It is symmetric and describes many natural phenomena such as people’s heights. Examples of variables described by normal distributions include inflation rates and energy prices.
Lognormal – Values are positively skewed, not symmetric like a normal distribution. It is used to represent values that don’t go below zero but have unlimited positive potential. Examples of variables described by lognormal distributions include real estate property values, stock prices, and oil reserves.
Uniform – All values have an equal chance of occurring, and the user simply defines the minimum and maximum. Examples of variables that could be uniformly distributed include manufacturing costs or future sales revenues for a new product.
Triangular – The user defines the minimum, most likely, and maximum values. Values around the most likely are more likely to occur. Variables that could be described by a triangular distribution include past sales history per unit of time and inventory levels.
PERT - The user defines the minimum, most likely, and maximum values, just like the triangular distribution. Values around the most likely are more likely to occur. However values between the most likely and extremes are more likely to occur than the triangular; that is, the extremes are not as emphasized. An example of the use of a PERT distribution is to describe the duration of a task in a project management model.
Discrete – The user defines specific values that may occur and the likelihood of each. An example might be the results of a lawsuit: 20% chance of positive verdict, 30% change of negative verdict, 40% chance of settlement, and 10% chance of mistrial.
During a Monte Carlo simulation, values are sampled at random from the input probability distributions. Each set of samples is called an iteration, and the resulting outcome from that sample is recorded. Monte Carlo simulation does this hundreds or thousands of times, and the result is a probability distribution of possible outcomes. In this way, Monte Carlo simulation
Monte Carlo random walk simulation example
The below python program calculate distance from Home after every 10 random walks.
Calculate percentage of no transport cost amount for walks less than 8 blocks.
Hot Pursuit- When target is aware of the pursuer.
Pure Pursuit - When target is not aware of pursuer. In this case, the course of the target is known.
Pure Pursuit Problem example
A fighter aircraft sights an enemy bomber and flies directly toward it, in order to catch up and destroy it. We have to determine the attack the attack course of the fighter and how long does the fighter take to catch up with the bomber.
If the target flies along a straight line, the problem can be solved directly with analytic techniques. But if the path of the bomber is curved, the problem can not be solved directly. We can solve such problems using simulation.
can wait in line. Finally, units are served in the order of their arrival (often called FlFO: first in, first out) by a single server or channel. Arrivals and services are defined by the distribution of the time between arrivals and the distribution of service times, respectively. For any simple single-or multichannel queue, the overall effective arrival rate must be less than the total service rate, or the waiting line will grow without bound. When queues grow without bound, they are termed "explosive" or unstable. (In some re-entrant queuing networks in which units return a number of times to the same server before finally exiting from the system, the condition that arrival rate be less than service rate might not guarantee stability. See Harrison and Nguyen [1995] for more explanation. Interestingly, this type of instability was noticed first, not in theory, but in actual manufacturing in semiconductor manufacturing plants.) More complex situations can occur-for example, arrival rates that are greater than service rates for short periods of time, or networks of queues with routing. However, this chapter sticks to the most basic queues.
Variance Reduction Techniques.
One way to increase the accuracy of an estimate (i.e., reduce the width of its confidence interval) is to increase n. For instance, the confidence interval width can be halved if the sample size is increased to 4n. However, large sample sizes required long simulation runs which, in general, are expensive. An alternative way to increasing the estimate's accuracy is to reduce its variance. If one can reduce the variance of an endogenously created random variable without disturbing its expected value, then the confidence interval width will be smaller, for the same amount of simulation. Techniques aiming at reducing the variance of a random variable are known as
Chapter five
Simulation language
The common simulation languages are GPSS, SIMSCRIPT, SIMULA, SLAM and SIMAN
Arena is a simulation software based on the SIMAN simulation language. It combines modules to build a fairly wide variety of simulation models and it is mostly focused in discrete models.
GPSS
GPSS is a highly structured, special-purpose simulation programming language based on the process-interaction approach and oriented toward queuing systems. A block diagram provides a convenient way to describe the system being simulated. There are over 40 standard blocks in GPSS. Entities called transactions may be viewed as flowing through the block diagram. Blocks represent events, delays, and other actions that affect transaction flow. Thus, GPSS can be used to model any situation where transactions (entities, customers, units of traffic) are flowing through a system (e.g., a network of queues, with the queues preceding scarce resources). The block diagram is converted to block statements, control statements are added, and the result is a GPSS model. The first version of GPSS was released by IDM in 1961. It was the first process-interaction simulation language and became popular; it has been implemented a new and improved by many parties since 1961, with GPSS/H being the most widely used version in use today. Example 4.3 is based on GPSS/H. GPSS/H is a product of Wolverine SoftWare Corporation, Annandale, VA (Banks, Carson, and Sy, 1995; Henriksen, 1999). It is a flexible, yet powerful tool for simulation. Unlike the original IDM implementation, GPSS/H includes built-in file and screen 1/0, use of an arithmetic expression as a block operand, an interactive debugger, faster execution, expanded control statements, ordinary variables and arrays, a floating point clock, built-in math functions, and built-in random-variate generators.
General-Purpose Languages, Simulation Languages and High-Level Simulators
General-Purpose Languages(C++,Python,java…):
Simulation Languages(GPSS,SIMULA,SIMSCRIPT….):
High-Level Simulators:
Performance measures
PIECES OF A SIMULATION MODEL
Entities:
The dynamic objects in the simulation that move around, change status, affect and are affected by other entities and the state of the system, and affect the output performance They usually are created, move around for a while and then are disposed (leave)
Departure – A part finishes its operations (service) and leaves the system
Queues
Simulation Clock
Starting and Stopping
Replication
ARENA