37

System Modeling & Simulation ... 1 - Basic...Discrete system –one for which the state variables change instantaneously (瞬间地) at separated points in time ... Systems Entities

Embed Size (px)

Citation preview

Grade

Homeworks:60%

Final Exam grade :40%

Analytical expression (correspond to analytic solution解析解理论解)

In mathematics, an analytical expression (or expression in analytical form) is a mathematical expression

constructed using well-known operations that lend themselves readily to calculation. As is true for

closed-form expressions, the set of well-known functions allowed can vary according to context but

always includes the basic arithmetic operations (addition, subtraction, multiplication, and division),

extraction of nth roots, exponentiation, logarithms, and trigonometric functions.

Closed–form expressions are an important sub-class of analytic expressions

Numerical analysis (correspond to numerical solution数值解近似解)

Numerical analysis is the study of algorithms that use numerical approximation (as opposed to general

symbolic manipulations) for the problems of mathematical analysis (as distinguished from discrete

mathematics).

Deterministic system

In mathematics and physics, a deterministic system is a system in which no randomness is involved in the development of future states of the system, say, without uncertainty

A deterministic model will thus always produce the same output from a given starting condition or initial state

Stochastic system

In probability theory, a stochastic process, or sometimes random process (widely used) is a collection of random variables; this is often used to represent the evolution of some random value, or system, over time, say, with uncertainty

This is the probabilistic counterpart to a deterministic process (or deterministic system). Instead of describing a process which can only evolve in one way (as in the case, for example, of solutions of an ordinary differential equation), in a stochastic or random process there is some indeterminacy: even if the initial condition (or starting point) is known, there are several (often infinitely many) directions in which the process may evolve

Static

Probability without time dependence

Stochastic

Probability with time dependence

Simulation aim to solve the problem of stochastic system

by using numerical analytic method

Simulation can be used to show the eventual real effects

of alternative conditions and courses of action

Simulation is also used when the real system cannot be

engaged, because it may not be accessible, or it may be

dangerous or unacceptable to engage, or it is being

designed but not yet built, or it may simply not exist

Simulation

Numerical Analysis

Stochastic System

The three most important OR techniques

Statistics

Simulation

Math programming

Simulation is one of the most widely used Operations-

research and management science techniques

Three most important OR techniques

Math programming

Linear Programming - LP

Non-Linear Programming – NLP

……

Simulation

Statistics

Why use Simulation?

The real system that can be used to testify is not set up because it still under developing state

There would occur or cause damage or destroy to the real system if the experiment be carried out

So high the cost or the time using in the test to be affording

The consistency of test condition can not sure in real environment

Manufacturing Applications

Semiconductor Manufacturing

Construction Engineering & PM

Military Application

Logistics, Supply Chain, and Distribution Applications

Transportation model & traffic

Business Process Simulation

Health Care

•Military

•Chemistry/Molecular Physics

•Electronics/IT/Computer Network

•Biology

•Environmental sciences

•……

Continuous system

Simulation

•Manufacturing

•Logistics

•Service: Bank/ harbor/catering/…

•Healthcare

•……

Discrete system

Simulation

Architecture of Simulation application

Simulation can be used to solve but not limit of:

Designing and analyzing manufacturing systems

Evaluating military weapons systems or their logistics requirements

Determining hardware requirements or protocols for communications networks

Determining hardware and software requirements for a computer system

Designing and operating transportation systems such as airports, freeways, ports, and subways

Evaluating designs for service organizations, such as contact center, fast-food restaurants, hospitals, and post offices

Reengineering of business processes

Analyzing supply chains

Determining ordering policies for an inventory system

Analyzing mining operations

… …

Simulation by using computer

General-purpose languages (FORTRAN, C)

Tedious, low-level, error-prone

But, almost complete flexibility

Spreadsheets (Excel)

Usually static models

Financial scenarios, distribution sampling, SQC

Simulation languages

GPSS, SIMSCRIPT, SLAM, SIMAN

Popular, still in use

Learning curve for features, effective use, syntax

High-level simulators (Arena, AnyLogic, Flexsim, Witness, AutoMod, eM-Plant)

Very easy, graphical interface

Domain-restricted (manufacturing, communications)

Limited flexibility — model validity?

System

A system is defined to be a collection of entities, e.g., people or machines, that act and interact together toward the accomplishment of some logical end.

The collection of entities that comprise a system for one study might be only a subset of the overall system for another

State

The state of a system to be that collection of variables necessary to describe a system at a particular time, relative to the objectives of a study.

System can be divided into two categories

Discrete system – one for which the state variables change instantaneously (瞬间地) at separated points in time

Continuous system – one for which the state variables change continuously with respect to time

Discrete System

Continuous System

Ways to study a System

System

Experiment with the actual system

Experiment with a model of the system

PhysicalModel

MathematicalModel

AnalyticalSolution

Simulation

使用解析模型获得解析解,即精确解

使用模拟模型获得近似解

Simulation model can be classified along three different

dimensions

Static vs. Dynamic

Deterministic vs. Stochastic

Continuous vs. Discrete

Static

Vs.

Dynamic

Deterministic

Vs.

Stochastic

Simulation Model

Continuous

Vs.

Discrete

Systems Entities Attributes Activities Events State variables

Banking CustomersChecking

account balanceMaking deposit

arrival; departure # of busy tellers; # of customers waitng

Rapid rail RidersOrigination; destination

TravelingArrival at station;

arrival at destination# of riders waiting at each station; # of

riders in transit

Production MachinesSpeed; capacity;breakdown rate

welding; stamping

Break down Status of machines (busy, idle, or down)

communications Messageslength;

destinationTransmitting Arrival at destination # waiting to be transmitted

InventoryWarehous

eCapacity Withdrawing Demand

Levels of inventory; backlogged demands

Coffee shop CustomersArrival time;

buyoutPurchasing Arrival; departure

# of busy staff; # of customers in the line; time of customer to make a drink

Procedure of system analysis by using simulation

研究对象:已有或设计中的系统

系统模型:物理、数学或物理-数学

模型

仿真模型:物理样机、仿真程序或仿

真器等

System

Modeling

Simulatio

n

Modeling

Simulation

Experiment

Relationship among system, model and simulation

Time-advance Mechanisms

A discrete-event simulation is the modeling over time of a system all of whose state changes occur at discrete points in time – those points when an event occurs. A discrete-event simulation proceeds by producing a sequence of system snapshots that represent the evolution of the system through time.

The mechanism for advancing simulation time and guaranteeing that all events occur in correct chronological order is based on the future event list(FEL).

The variable in a simulation model that gives the current value of simulated time is called Simulation clock

Two kind of time advance

Next-event time advance used in discrete-event simulation

Fixed-increment time advance not used normally

Next-event time-advance approach

Simulation clock is initialized to zero and the times of occurrence of future events are determined

Do while not reach terminal conditions

Simulation clock then advanced to the time of the most imminent of these future events

Update the state of system, and determine the future event times

loop

time of arrival of the ith customer (t0=0)

Inter-arrival time between (i-1)st and ith arrivals of customers

Time that server actually spends serving ith customer (exclusive of customer’s delay in queue)

Delay in queue of ith customer

Time that ith customer completes service and departs

Time of occurrence of ith event of any type (ith value the simulation clock takes on, excluding the value

e0=0)

Figure 1.2

The next-event time-advance approach illustrated for the single-server queuing system

Components and Organization of a Discrete-Event simulation Model

System state系统状态

Simulation clock模拟时钟

Event list事件列表

Statistical counters统计计数器

Initialization routine初始程序

Time routine时间管理程序

Event routine事件处理程序

Library routines库程序

Report generator报告生成器

Main program主程序

Components and Organization of a Discrete-Event simulation Model

Figure 1.3

e1=0.4 e2=1.6

e3=2.1

e4=2.4

e5=3.1

e6=3.3

e7=3.8

e8=4.0

e9=4.9

e10=5.6

e11=5.8

e12=7.2

e13=8.6=T(6)

e1=0.4 e2=1.6

e3=2.1

e4=2.4

e5=3.1e6=3.3

e7=3.8e8=4.0

e9=4.9

e10=5.6

e11=5.8

e12=7.2

e13=8.6=T(6)

Formulate the problem and plan the study

Collect data and define a model

Is the assumptions document valid?

Construct a computer program and verify

Make pilot runs

Is the programmed model valid?

Design experiments

Make production runs

Analyze output data

Document, present and use results

We define Monte Carlo simulation to be a scheme employing random numbers, that is, U(0,1) random variates, which is to

used for solving certain stochastic or deterministic problems where the passage of time plays no substantive role

Monte Carlo methods (or Monte Carlo experiments) are a broad class of computational algorithms that rely on

repeated random sampling to obtain numerical results; typically one runs simulations many times over in order

to obtain the distribution of an unknown probabilistic entity.

The name comes from the resemblance of the technique to the act of playing and recording your results in a

real gambling casino.

They are often used in physical and mathematical problems and are most useful when it is difficult or

impossible to obtain a closed-form expression(闭式解解析解), or infeasible to apply a deterministic

algorithm.

Monte Carlo methods are mainly used in three distinct problems classes: optimization, numerical integration

(数值积分)and generation of draws from a probability distribution

Example

consider a circle inscribed in a unit square.

Given that the circle and the square have a

ratio of areas that is π/4, the value of π can

be approximated using a Monte Carlo

method

A famous example of Monte Carlo Method

Suppose we have a floor made of parallel strips

of wood, each the same width, and we drop a

needle onto the floor. What is the probability

that the needle will lie across a line between

two strips?

A famous example of Monte Carlo Method

The red and blue needles are both centered at x. The red one falls within the gray area, contained by an angle of 2θ on each side, so it crosses the vertical line; the blue one does not. The proportion of the circle that is gray is what we integrate as the center x goes from 0 to 1

Suppose l < t (short needle), then Integrating the joint probability density function gives the probability that the needle will cross a line

Suppose l > t (long needle)

针压到线的概率