21
Simulation Basics Simulation Basics ( ( 模模模模模模 模模模模模模 ) ) By C. L. Hsieh By C. L. Hsieh Department of Industrial Department of Industrial Management Management Aletheia University Aletheia University

Simulation Basics ( 模擬基本概念 )

  • Upload
    marina

  • View
    108

  • Download
    0

Embed Size (px)

DESCRIPTION

Simulation Basics ( 模擬基本概念 ). By C. L. Hsieh Department of Industrial Management Aletheia University. Questions. What types of simulation are there? ( 模擬類型有些 ?) How is random behavior simulated? ( 隨機行為如何模擬 ?) How does discrete event simulation work? ( 離散事件型模擬之運作過程為何 ?) - PowerPoint PPT Presentation

Citation preview

Simulation BasicsSimulation Basics(( 模擬基本概念模擬基本概念 ))

By C. L. HsiehBy C. L. HsiehDepartment of Industrial Department of Industrial

Management Management Aletheia UniversityAletheia University

QuestionsQuestions What types of simulation are there?What types of simulation are there? (( 模擬類型有些模擬類型有些 ?)?) How is random behavior simulated?How is random behavior simulated? (( 隨機行為如何模擬隨機行為如何模擬 ?) ?) How does discrete event simulation work?How does discrete event simulation work? (( 離散事件型模擬之運作過程為何離散事件型模擬之運作過程為何 ?)?) How is simulation software used?How is simulation software used? (( 如何使用模擬軟體如何使用模擬軟體 ?)?) What is the future of simulation technology?What is the future of simulation technology? (( 模擬技術之未來發展模擬技術之未來發展 ?)?)

Types of Simulation (Types of Simulation ( 模擬之類模擬之類型型 ))

Static v.s. Dynamic Simulation (Static v.s. Dynamic Simulation ( 固定性與動態固定性與動態性模擬性模擬 ))– StaticStatic is not based on time: Monte Carlo Simulatio is not based on time: Monte Carlo Simulatio

nn (( 固定性模擬與時間無關,如蒙地卡羅模擬固定性模擬與時間無關,如蒙地卡羅模擬 ))– DynamicDynamic includes the passage of time. includes the passage of time. (( 動態性模擬紀錄時間之變化動態性模擬紀錄時間之變化 ))

States are changed over time.States are changed over time. (( 系統中之狀態隨時間之改變而變化系統中之狀態隨時間之改變而變化 )) Clock mechanism moves forward in timeClock mechanism moves forward in time (( 系統時鐘紀錄狀態隨時間之改變之任何事件系統時鐘紀錄狀態隨時間之改變之任何事件 ))

Types of Simulation (Types of Simulation ( 模擬之類模擬之類型型 ))

Deterministic (Deterministic ( 確定性確定性 ) v.s. Stochastic Simulati) v.s. Stochastic Simulation (on ( 隨機性隨機性 ) )

One run is

enough

Several Runs

require

Types of Simulation (Types of Simulation ( 模擬之類模擬之類型型 ))

Discrete-Event v.s. Continuous Simulation (Discrete-Event v.s. Continuous Simulation ( 離離散事件 散事件 v.s. v.s. 連續型模擬連續型模擬 ) ) – A A discrete-eventdiscrete-event simulation simulation is one in which state is one in which state

(( 狀態狀態 ) changes at discrete time ) changes at discrete time as triggered by as triggered by eveeventsnts (( 離散事件模擬由事件所驅動,紀錄不同時間不同離散事件模擬由事件所驅動,紀錄不同時間不同事件之狀態事件之狀態 ) )

Types of Simulation (Types of Simulation ( 模擬之類模擬之類型型 ))

In In continuouscontinuous simulation, state variables c simulation, state variables changes continuously w.r.t. timehanges continuously w.r.t. time

(e.g. (e.g. temperaturetemperature of a building controlled by a heating s of a building controlled by a heating system)ystem)

(( 連續型模擬中,狀態變數隨時間以連續方式改變,如加熱連續型模擬中,狀態變數隨時間以連續方式改變,如加熱系統中溫度之變化系統中溫度之變化 ))

Simulating Random Bahavior Simulating Random Bahavior (( 模擬亂數之行為模擬亂數之行為 ))

Random number Generation Random number Generation (( 亂數產生方式亂數產生方式 ))

– Simulation uses a Simulation uses a random number generatorrandom number generator (RNG) (RNG) (( 模擬過程中使用亂數產生程式模擬過程中使用亂數產生程式 ).).– RNG is a deterministic algorithm used to create RNG is a deterministic algorithm used to create unifunif

ormlyormly & & independentlyindependently distribution between [0,1] distribution between [0,1] (( 亂數產生程式亂數產生程式 RNGRNG 昰一種定性演算法,能產生介於昰一種定性演算法,能產生介於 [0,[0,

1]1] 均勻、獨立的分配均勻、獨立的分配 ) ) – The most popular RNG is called The most popular RNG is called Linear CongruentiaLinear Congruentia

l Generatorsl Generators (LCGs) (LCGs) (( 最有名之最有名之 RNGRNG 稱為稱為 LCGs)LCGs)

Examples of LCGs (LCGsExamples of LCGs (LCGs 範例範例 ))

Generating Random Variates Generating Random Variates (( 隨機變異值隨機變異值 ))

“ “Generating a random variate”: the aGenerating a random variate”: the activity of obtaining an observation of a rctivity of obtaining an observation of a random variable from desired distributioandom variable from desired distribution n

(( 產生隨機變異值產生隨機變異值 :: 昰一種產生某種特殊隨機昰一種產生某種特殊隨機變數之機率分配的觀察值之方法變數之機率分配的觀察值之方法 ))

A Random number (from LCGs) is pluggeA Random number (from LCGs) is plugged into a transform equation d into a transform equation

(( 原理昰將由原理昰將由 LCGsLCGs 程式產生之隨機變數置程式產生之隨機變數置於一轉置方程式中作運算於一轉置方程式中作運算 (See Law, 1991)(See Law, 1991)

DES Simulation (DES Simulation ( 離散事件模離散事件模擬擬 ))

Discrete-event simulation uses process fDiscrete-event simulation uses process flow by a sequence of low by a sequence of eventsevents ( ( 離散事件模離散事件模擬藉由一系列之事件產生過程流程擬藉由一系列之事件產生過程流程 ))– ScheduledScheduled(( 事先決定事先決定 DES):determined befoDES):determined befo

rehand by the passage of timerehand by the passage of time– Conditioned Conditioned (( 條件式條件式 DES):triggered by a coDES):triggered by a co

ndition (e.g. multiple entities waiting for resndition (e.g. multiple entities waiting for resources when it is available) ources when it is available) (( 由某些條件驅動由某些條件驅動 ))

DES Simulation (DES Simulation ( 離散事件模離散事件模擬擬 ))

After events being processed, a After events being processed, a clockclock a advances to the next scheduled events & dvances to the next scheduled events & the process continues. the process continues. (( 某事件處理後,一某事件處理後,一個個模擬時鐘模擬時鐘會移動至下一個排定之事件使整個程會移動至下一個排定之事件使整個程序繼續進行序繼續進行 ))

When a termination event occurs, the siWhen a termination event occurs, the simulation ends and statistical reports armulation ends and statistical reports are generated e generated (( 終止事件停止所有模擬動作,之終止事件停止所有模擬動作,之後會產生一個統計報表後會產生一個統計報表 ))

Dia

gra

m

of

Dis

cre

te-

Even

t S

imu

latio

n

A Manual Simulation Example A Manual Simulation Example (( 一個人工模擬範例一個人工模擬範例 ))

Model Assumption (Model Assumption ( 模型假設模型假設 ))– No parts in the system initiallyNo parts in the system initially (( 系統起初沒有任何零件系統起初沒有任何零件 ))– No operators included in the systemNo operators included in the system (( 系統無任何作業員系統無任何作業員 ))– Move time from queue to the package station is neMove time from queue to the package station is ne

gligible gligible (( 由等候線至包裝站之移動時間可忽略由等候線至包裝站之移動時間可忽略 ))– Queue priority rule Queue priority rule (( 等候線以等候線以 FIFOFIFO 方式控制方式控制 ))– Package station never fail down Package station never fail down (( 包裝站在模擬過程不會故障包裝站在模擬過程不會故障 ))

A Manual Simulation ExampleA Manual Simulation Example(( 一個人工模擬範例一個人工模擬範例 ))

結果計算結果計算

–有幾件事件到達有幾件事件到達 ??–有幾台機器曾在等候線上有幾台機器曾在等候線上 ??–模擬結束時,仍有幾台在系統中模擬結束時,仍有幾台在系統中 ??–等候線等候線平均等候時間平均等候時間為何為何 ??–系統系統平均等候時間平均等候時間為何為何 ??–系統系統平均使用率平均使用率為何為何 ??

範例模型

的模擬流

程圖

A Manual Simulation Example A Manual Simulation Example (( 一個人工模擬範例一個人工模擬範例 ))

Types of Scheduled Events (Types of Scheduled Events ( 排定事件之類型排定事件之類型 ))– Arrivals, Package Done & TerminationArrivals, Package Done & Termination (( 到達事件,包裝完成事件,模擬終止事件到達事件,包裝完成事件,模擬終止事件 ))

Number in Queue (Number in Queue ( 在等候線上之實體數在等候線上之實體數 ))– 某事件處理完後在等候線上等候之螢幕個數某事件處理完後在等候線上等候之螢幕個數

Cumulative time in Queue(Cumulative time in Queue( 等候線累計時間等候線累計時間 ))– 等候線上數量乘以下次事件發生的時間減掉本次時間等候線上數量乘以下次事件發生的時間減掉本次時間

的差的差 ,, 再加上原有累計時間再加上原有累計時間

Commercial Simulation Software Commercial Simulation Software (( 商用模擬軟體商用模擬軟體 ))

Simulation Using Promodel Simulation Using Promodel (( 以以 Promodel Promodel 模擬模擬 ))

Building A Model (Building A Model ( 建立一個模式建立一個模式 ))– Entities (Entities ( 實體實體 ) ) (items being processed)(items being processed)– LocationsLocations (( 位址位址 )) (the places where process (the places where process

ing occurs)ing occurs)– Resources (Resources ( 資源資源 ) ) (agents used to process e(agents used to process e

ntities)ntities)– Paths (Paths ( 路徑路徑 )) (pathways along which entitie (pathways along which entitie

s & resources traverse)s & resources traverse)

Simulation Using PromodelSimulation Using Promodel (( 以以 Promodel Promodel 模擬模擬 ))

Running the Simulation (Running the Simulation ( 執行模擬執行模擬 ))– Model database (Model database ( 模式資料庫模式資料庫 ))– simulation DB (simulation DB ( 模擬資料庫模擬資料庫 ))– Animation graphics (Animation graphics ( 動畫圖形動畫圖形 ))

Output Analysis (Output Analysis (輸出報告分析輸出報告分析 ))– Summary Reports (Summary Reports ( 總報表總報表 ))– Time-Series Plots & Histograms (Time-Series Plots & Histograms ( 時間序列圖與值方時間序列圖與值方

圖圖 ))

Future of Simulation (Future of Simulation ( 模擬未來發模擬未來發展展 ))

Input data analysis for distribution fittingInput data analysis for distribution fitting (( 資料分析、分配配對資料分析、分配配對 )) Graphical User Interface (Graphical User Interface ( 圖形使用者介面圖形使用者介面 )) Reusable Components (Reusable Components (元件回收元件回收 )) 2-D, 3-D Animation (2-D, 3-D2-D, 3-D Animation (2-D, 3-D 動畫動畫 ) ) Online helps & tutorials (Online helps & tutorials ( 線上教學、求救線上教學、求救 )) Interactive debugging (Interactive debugging (互動式偵錯互動式偵錯 )) Automatic model generation (Automatic model generation (自動化模式產生自動化模式產生 )) Output analysis tool (Output analysis tool (輸出分析工具輸出分析工具 )) Optimization (Optimization ( 最佳化最佳化 )) Database connectivity (Database connectivity ( 資料庫連結資料庫連結 ))

Summary (Summary ( 總結總結 ))

Most manufacturing & service system are dyMost manufacturing & service system are dynamic, stochastic & DES namic, stochastic & DES ((多數製造與服務系統多數製造與服務系統為動態、隨機、為動態、隨機、 DESDES 型系統型系統 ))

Random number generator Random number generator (( 亂數產生器亂數產生器 )) DES based on DES based on eventsevents & & consequent reactionconsequent reaction

s s (DES(DES 以事件與相關之反應為基礎以事件與相關之反應為基礎 )) Events are Events are timetime or or conditionedconditioned triggered triggered (( 事件昰被時間或條件所驅動事件昰被時間或條件所驅動 )) Simulation models can be defined by commSimulation models can be defined by comm

ercial simulation software (ercial simulation software (e.g. Promodel) e.g. Promodel) (( 模擬模式可以在商用模擬軟體中定義,如模擬模式可以在商用模擬軟體中定義,如 PromoPromodel)del)