Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 2 Basic Simulation Modeling

Similar presentations


Presentation on theme: "Chapter 2 Basic Simulation Modeling"— Presentation transcript:

1 Chapter 2 Basic Simulation Modeling

2 CONTENTS 1. The Nature of Simulation
2. Systems, Models, and Simulation 3. Discrete-Event Simulation 4. Simulation of a Single-Server Queueing System 5. Other Types of Simulation 6. Advantages, Disadvantages, and Pitfalls of Simulation 1. طبيعة المحاكاة 2. أنظمة، نماذج، ومحاكاة 3. محاكاة الأحدث المنفصلة، 4. محاكاة لنظام تشكيل طابوربخادم واحد 5. أنواع أخرى من المحاكاة 6. مزايا، عيوب، و مخاطرالمحاكاة

3 1. THE NATURE OF SIMULATION
Simulation: Imitate the operations of a facility or process, usually via computer What’s being simulated is the system To study system, often make assumptions/approximations, both logical and mathematical, about how it works These assumptions form a model of the system If model structure is simple enough, could use mathematical methods to get exact information on questions of interest — analytical solution 1. طبيعة المحاكاه . المحاكاة: تقليد عمليات منشأة أو عملية، عادة عن طريق الكمبيوتر . ما يجري هو محاكاة النظام . لدراسة النظام، وغالبا ما تجعل الافتراضات / تقريبية، سواء المنطقية والرياضية، عن كيفية عمله . هذه الافتراضات تشكل نموذجا للنظام . إذا كان هيكل النموذج بسيط بما فيه الكفاية، يمكن استخدام الطرق الرياضية للحصول على معلومات دقيقة( الحل التحليلي)

4 1. The Nature of Simulation (cont’d.)
But most complex systems require models that are also complex (to be valid) Must be studied via simulation — evaluate model numerically and collect data to estimate model characteristics Example: Manufacturing company considering extending its plant Build it and see if it works out? Simulate current, expanded operations — could also investigate many other issues along the way, quickly and cheaply . ولكن معظم الأنظمة المعقدة تتطلب النماذج التي هي أيضا معقدة (لتكون صحيحة) . يجب دراستها عن طريق المحاكاة - تقييم نموذج رقميا وجمع البيانات لتقدير خصائص النموذج . على سبيل المثال: شركة تصنيع: النظر في توسيع مصنعها . بناء ومعرفة ما اذا كان يعمل بها؟ . محاكاة العمليات التوسعية ويمكن أيضا تحقيق العديد من المسائل الأخرى على طول الطريق، بسرعة وبتكاليف زهيدة

5 1. The Nature of Simulation (cont’d.)
Some (not all) application areas 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 call centers, fast-food restaurants, hospitals, and post offices Analyzing financial or economic systems . بعض (وليس كل) مجالات التطبيق . تصميم وتحليل نظم التصنيع . تقييم أنظمة الأسلحة العسكرية أو المتطلبات اللوجستية الخاصة بهم . تحديد متطلبات الأجهزة أو بروتوكولات شبكات الاتصالات . تحديد متطلبات الأجهزة والبرامج لنظام الكمبيوتر . تصميم وتشغيل أنظمة النقل مثل المطارات والطرق السريعة والموانئ ومترو الانفاق . تقييم تصاميم لمنظمات الخدمات مثل مراكز الاتصال، ومطاعم الوجبات السريعة، والمستشفيات، ومكاتب البريد . تحليل الأنظمة المالية أو الاقتصادية

6 1. The Nature of Simulation (cont’d.)
Impediments to acceptance, use of simulation Models of large systems are usually very complex But now have better modeling software … more general, flexible, but still (relatively) easy to use Can consume a lot of computer time But now have faster, bigger, cheaper hardware to allow for much better studies than just a few years ago … this trend will continue However, simulation will also continue to push the envelope on computing power in that we ask more and more of our simulation models Impression that simulation is “just programming” There’s a lot more to a simulation study than just “coding” a model in some software and running it to get “the answer” Need careful design and analysis of simulation models – simulation methodology . معوقات القبول، استخدام المحاكاة . نماذج من النظم الكبيرة وعادة ما تكون معقدة جدا - ولكن الآن لديهم أفضل برامج للنمذجة و التصميم ... أكثر عمومية، ومرنة، ولكن لا تزال (نسبيا) سهلة الاستخدام . يمكن أن تستهلك الكثير من وقت الكمبيوتر - ولكن لديها الآن أسرع، أكبر، أرخص الأجهزة للسماح للدراسات أفضل بكثير مما كانت عليه قبل بضع سنوات فقط ... وسوف يستمر , هذا الاتجاه - ومع ذلك، سوف تستمر أيضا محاكاة لدفع مظروف على قوة الحوسبة في أن نطلب المزيد والمزيد من نماذج المحاكاة . الانطباع بأن المحاكاة هي "مجرد برمجة" - هناك الكثير لدراسة المحاكاة من مجرد "الترميز" نموذجا في بعض البرامج والتي تعمل على الحصول على "جواب" - بحاجة إلى تصميم دقيق وتحليل نماذج المحاكاة - منهجية المحاكاة

7 2. SYSTEMS, MODELS, AND SIMULATION
System: A collection of entities (people, parts, messages, machines, servers, …) that act and interact together toward some end (Schmidt and Taylor, 1970) In practice, depends on objectives of study Might limit the boundaries (physical and logical) of the system Judgment call: level of detail (e.g., what is an entity?) Usually assume a time element – dynamic system State of a system: Collection of variables and their values necessary to describe the system at that time Might depend on desired objectives, output performance measures Bank model: Could include number of busy tellers, time of arrival of each customer, etc. 2. الأنظمة النماذج، والمحاكاة . النظام: مجموعة من الكيانات (الناس وقطع، والرسائل، وآلات والخوادم، ...) التي تعمل وتتفاعل معا نحو نهاية و نتيجة معينة (شميدت وتايلور، 1970 ) . في الممارسة العملية، ويعتمد على أهداف الدراسة . قد تحد حدود النظام (المادية والمنطقية) . الأحكامالمعتمدة : مستوى التفاصيل (على سبيل المثال، ما هو الكيان؟) . عادة ما تفترض عنصر الوقت - نظام ديناميكي . حالة نظام: مجموعة من خلايا التخزين المتغيرة المحتوى لوصف النظام في ذلك الوقت . قد تعتمد على الأهداف المرجوة و مقاييس الأداء . نموذج البنك: يمكن أن تشمل عددا من العناصر المشغولة، وقت وصول كل عميل، الخ

8 2. Systems, Models, and Simulation (cont’d.)
Types of systems Discrete State variables change instantaneously at separated points in time Bank model: State changes occur only when a customer arrives or departs Continuous State variables change continuously as a function of time Airplane flight: State variables like position, velocity change continuously Many systems are partly discrete, partly continuous . أنواع الأنظمة . منفصل . متغيرات حالة تغيير فوري في نقاط منفصلة في الوقت المناسب . نموذج البنك: تحدث تغييرات الدولة الوحيدة عند وصول العميل أو يغادر . متواصل . متغيرات حالة تغيير مستمر بوصفها وظيفة من الوقت . رحلة الطائرة: المتغيرات الخارجية مثل الموقف، تغيير سرعة مستمر . العديد من النظم المنفصلة جزئيا، جزئيا المستمر

9 2. Systems, Models, and Simulation (cont’d.)
Ways to study a system

10 2. Systems, Models, and Simulation (cont’d.)
Classification of simulation models Static vs. dynamic Deterministic vs. stochastic Continuous vs. discrete Most operational models are dynamic, stochastic, and discrete – will be called discrete-event simulation models . تصنيف نماذج المحاكاة . ثابت مقابل ديناميكية . القطعية مقابل العشوائية . المستمر مقابل منفصلة . معظم النماذج التشغيلية هي ديناميكية، عشوائية ومنفصلة - وسوف يطلق عليها اسم نماذج المحاكاة منفصلة و متقطعة الحدث

11 3. DISCRETE-EVENT SIMULATION
Discrete-event simulation: Modeling of a system as it evolves over time by a representation where the state variables change instantaneously at separated points in time More precisely, state can change at only a countable number of points in time These points in time are when events occur Event: Instantaneous occurrence that may change the state of the system Sometimes get creative about what an “event” is … e.g., end of simulation, make a decision about a system’s operation Can in principle be done by hand, but usually done on computer 3. المحاكاة منفصلة و متقطعة الحدث . محاكاة منفصلة أو متقطعة الحدث: تصميم و نمذجة النظام باعتبار تطوره بمرور الوقت من خلال تجسيد متغيرات حالة خلايا التخزين في نقاط منفصلة في الزمن . حالة النظام يمكن أن تتغير في العديد من مراحل الزمن . هذه النقاط من مراحل الزمن هي عند قدوم حدث . الحدث: حصول أو قدوم فعل قد يغير حالة النظام . في بعض الأحيان يجب التفكير بخصوص"الحدث" ... على سبيل المثال، نهاية المحاكاة تعتبر اتخاذ قرار بشأن عمليات النظام . يمكن من حيث المبدأ أن يتم يتم انهاء المحاكاة باليد، ولكن في أغلب الأحيان يتم عن طريق الحاسوب

12 3. Discrete-Event Simulation (cont’d.)
Example: Single-server queue Estimate expected average delay in queue (line, not service) State variables Status of server (idle, busy) – needed to decide what to do with an arrival Current length of the queue – to know where to store an arrival that must wait in line Time of arrival of each customer now in queue – needed to compute time in queue when service starts Events Arrival of a new customer Service completion (and departure) of a customer Maybe – end-simulation event (a “fake” event) – whether this is an event depends on how simulation terminates (a modeling decision) . مثال: قائمة انتظار خادم واحدة - توقع متوسط ​​التأخير المتوقع في قائمة الانتظار - حالة خلايا التخزين . حالة الخادم (راحة، مشغول) – لابد أن يقرر ما ينبغي فعله مع حريف وصول حريف . طول قائمة الانتظار الحالية - أين سيقع تخزين وقت وصول حريف و انتظاره في الصف . وقت وصول كل عميل(حريف) الى قائمة الانتظار - حساب الوقت في قائمة الانتظار عند بدء تشغيل الخدمة - أحداث . وصول عميل جديد . إنجاز و انهاء الخدمة (ورحيل) عميل . ربما - حدث نهاية المحاكاة (حدثا "وهميا") - هو حدث يعتمد على كيفية إنهاء المحاكاة (قرار النمذجة)

13 3.1. Time-Advance Mechanisms
Simulation clock: Variable that keeps the current value of (simulated) time in the model Must decide on, be consistent about, time units Usually no relation between simulated time and (real) time needed to run a model on a computer Two approaches for time advance Next-event time advance (usually used) … described in detail below Fixed-increment time advance (seldom used) … Described in Appendix 1A Generally introduces some amount of modeling error in terms of when events should occur vs. do occur Forces a tradeoff between model accuracy and computational efficiency

14 3.1. Time-Advance Mechanisms (cont’d.)
More on next-event time advance Initialize simulation clock to 0 Determine times of occurrence of future events – event list Clock advances to next (most imminent) event, which is executed Event execution may involve updating event list Continue until stopping rule is satisfied (must be explicitly stated) . أكثر معلومات على وقت الحدث المقبل - تهيئة ساعة محاكاة في وقت 0 - تحديد أوقات قوع أحداث المستقبل - قائمة الأحداث - تقدم الساعة للحدث المقبل الذي سيتم تنفيذه . تنفيذ الحدث يمكن من تحديث قائمة الأحداث - تستمر المحاكاة حتى النهاية (يجب أن تذكر طريقة انهاء المحاكاة)

15 3.1. Time-Advance Mechanisms (cont’d.)
Next-event time advance for the single-server queue ti = time of arrival of ith customer (t0 = 0) Ai = ti – ti-1 = interarrival time between (i-1)st and ith customers (usually assumed to be a random variable from some probability distribution) Si = service-time requirement of ith customer (another random variable) Di = delay in queue of ith customer Ci = ti + Di + Si = time ith customer completes service and departs ej = time of occurrence of the jth event (of any type), j = 1, 2, 3, … Possible trace of events (detailed narrative in text)

16 3.2. Components and Organization of a Discrete-Event Simulation Model
Each simulation model must be customized to target system But there are several common components, general organization System state – variables to describe state Simulation clock – current value of simulated time Event list – times of future events (as needed) Statistical counters – to accumulate quantities for output Initialization routine – initialize model at time 0 Timing routine – determine next event time, type; advance clock Event routines – carry out logic for each event type Library routines – utility routines to generate random variates, etc. Report generator – to summarize, report results at end Main program – ties routines together, executes them in right order 3.2. مكونات وتنظيم نموذج محاكاة متقطع الأحداث . يجب تخصيص كل نموذج محاكاة لنظام معين . ولكن هناك العديد من العناصر المشتركة و تنظيم عام - حالة النظام – خلايا التخزين لوصف النظام - ساعة المحاكاة - الوقت الحالي محاكاة - قائمة الأحداث - أوقات الأحداث المستقبلية (حسب الحاجة) - العدادات الإحصائية - تهيئة حدث البداية الروتيني - تهيئة نموذج المحاكاة في وقت 0 - التوقيت الروتيني- تحديد وقت الحدث القادم، ونوعه على مدار الساعة - إجراءات الحدث - تنفيذ المنطق لكل نوع الحدث الإجراءات الروتينية لتوليد محتوى عشوائي لخلايا التخزين ، الخ - اجراء التقارير - لتلخيص، النتائج - البرنامج الرئيسي – تنفيذكل العمليات و الأحداث بشكل متسلسل

17 3.2. Components and Organization of a Discrete-Event Simulation Model (cont’d.)

18 4. SIMULATION OF A SINGLE-SERVER QUEUEING SYSTEM
Will show how to simulate a specific version of the single-server queueing system Though simple, it contains many features found in all simulation models 4. محاكاة لنظام طابور أحادي الخدمة . سوف نرى كيفية محاكاة نظام طابور أحادي الخادمة . على الرغم من بساطته، فإنه يحتوي على العديد من الميزات الموجودة في كل نماذج المحاكاة

19 4.1. Problem Statement Recall single-server queueing model
Assume interarrival times are independent and identically distributed (IID) random variables Assume service times are IID, and are independent of interarrival times Queue discipline is FIFO Start empty and idle at time 0 First customer arrives after an interarrival time, not at time 0 Stopping rule 4.1. بيان المشكلة . نظام طابور أحادي الخادمة . أوقات مجيء الحرفاء مستقلة و عشوائية . تفترض مدة الخدمة مستقلة عن أوقات مجيء الحرفاء FIFO طريقة عمل الطابور . . بدء المحاكاة في وقت 0 . وصول أول حريف بعد وقت 0. . قاعدة نهاية المحاكاة

20 4.1. Problem Statement (cont’d.)
Quantities to be estimated Expected average delay in queue (excluding service time) of the n customers completing their delays Why “expected?” Expected average number of customers in queue (excluding any in service) A continuous-time average Area under Q(t) = queue length at time t, divided by T(n) = time simulation ends … Expected utilization (proportion of time busy) of the server Another continuous-time average Area under B(t) = server-busy function (1 if busy, 0 if idle at time t), divided by T(n) … Many others are possible (maxima, minima, time or number in system, proportions, quantiles, variances …) Important: Discrete-time vs. continuous-time statistics . الكميات التي يمكن تقديرها - متوسط ​​التأخير المتوقع في قائمة الانتظار (باستثناء وقت الخدمة) - توقع متوسط ​​عدد الحرفاء في قائمة الانتظار (باستثناء أي في الخدمة) . متوسط ​​الوقت المستمر - طول قائمة الانتظار في الوقت مقسومة على وقت نهاية المحاكة - مدة استعمال السرفر (نسبة الوقت مشغول) المهم: إحصاءات بخصوص المحاكاة باستعمال الوقت المتقطع مقابل المحاكاة باستعمال الوقت المستمر

21 4.2. Intuitive Explanation
Given (for now) interarrival times (all times are in minutes): 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, … Given service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, … n = 6 delays in queue desired “Hand” simulation: Display system, state variables, clock, event list, statistical counters … all after execution of each event Use above lists of interarrival, service times to “drive” simulation Stop when number of delays hits n = 6, compute output performance measures

22 4.2. Intuitive Explanation (cont’d)
Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, … Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, … Status shown is after all changes have been made in each case …

23 4.2. Intuitive Explanation (cont’d)
Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, … Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …

24 4.2. Intuitive Explanation (cont’d)
Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, … Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …

25 4.2. Intuitive Explanation (cont’d)
Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, … Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …

26 4.2. Intuitive Explanation (cont’d)
Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, … Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …

27 4.2. Intuitive Explanation (cont’d)
Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, … Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …

28 4.2. Intuitive Explanation (cont’d)
Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, … Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …

29 4.2. Intuitive Explanation (cont’d)
Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, … Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …

30 4.2. Intuitive Explanation (cont’d)
Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, … Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …

31 4.2. Intuitive Explanation (cont’d)
Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, … Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …

32 4.2. Intuitive Explanation (cont’d)
Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, … Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …

33 4.2. Intuitive Explanation (cont’d)
Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, … Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …

34 4.2. Intuitive Explanation (cont’d)
Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, … Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …

35 4.2. Intuitive Explanation (cont’d)
Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, … Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, … Final output performance measures: Average delay in queue = 5.7/6 = 0.95 min./cust. Time-average number in queue = 9.9/8.6 = 1.15 custs. Server utilization = 7.7/8.6 = 0.90 (dimensionless)

36 5. OTHER TYPES OF SIMULATION
Continuous simulation Typically, solve sets of differential equations numerically over time May involve stochastic elements Some specialized software available; some discrete-event simulation software will do continuous simulation as well Combined discrete-continuous simulation Continuous variables described by differential equations Discrete events can occur that affect the continuously-changing variables Some discrete-event simulation software will do combined discrete-continuous simulation as well 5. أنواع أخرى من المحاكاة . المحاكاة مستمرة - عادة، حل مجموعات من المعادلات التفاضلية رقميا على مر الزمن - قد تنطوي على عناصر عشوائية - بعض البرامج المتخصصة الموجودة؛ بعض برامج المحاكاة المنفصلة الحدث هي برامج محاكاة تستطيع أن تقوم بالمحاكاة المستمرة . الجمع بين المحاكاة لمنفصلة و المستمرة - وصف خلايا التخزين بالمعادلات التفاضلية - يمكن أن تقع الأحداث المنفصلة التي تؤثر على خلايا التخزين المتغيرة باستمرار، - بعض برامج المحاكاة المنفصلة الحدث سوف مجتمعة تقوم بالمحاكاة المنفصلة و المستمر

37 5. OTHER TYPES OF SIMULATION (cont’d)
Agent-based modeling addresses the simultaneous interactions of multiple agents to simulate, recreate, study, and predict complex phenomenon. The concept of agent-based modeling is that an overall behavior emerges through the micro-level interactions of individual agents. The primary assumption is that simple local behaviors generate complex height level behavior. Individual agents are modeled according to individual characteristics and are generally assumed to be rational, acting in their own interests which may be economic or socially derived. النمذجة القائمة على الخلايا تستعمل الخلايا المتعددة لمحاكاة، إعادة، دراسة، والتنبؤ بالظواهر المعقدة. مفهوم النمذجة القائمة على الخلايا هو الحصول على سلوك عام و أكثر تطور من خلال التفاعلات على المستوى الجزئي و الفردي لكل خلية. القاعدة الأساسية هو أن السلوكيات الفردية و البسيطة للخلايا تولد سلوكا أكثر تعقيدا و تطورا. كل خلية هي مصممة وفقا لخصائص فردية ويفترض عموما أن تكون ذكية، و تتصرف حسب مصالحهم و أهدافهم الخاصة والتي قد تكون مشتقة حسب معايير اقتصادية أو اجتماعيا.

38 5. OTHER TYPES OF SIMULATION (cont’d)
Most agent-based models have the following elements: 1. multiple agents modeled and scaled with various levels of detail (granularity) 2. decision-making heuristics and rules 3. adaptive behaviors or learning 4. interaction rules or topology 5. environment for interaction often consisting of constrained resource معظم النماذج المتعددة الخلايا لديها العناصر التالية: 1. خلايا متعددة مع مستويات مختلفة من التفاصيل (تحبب) 2. صنع القرار والقواعد 3. السلوكيات التكيفية أو التعلم 4. قواعد التفاعل 5. بيئة للتفاعل غالبا ما تتكون من الموارد المحدودة

39 6 . ADVANTAGES, DISADVANTAGES, AND PITFALLS OF SIMULATION
Simulation allows great flexibility in modeling complex systems, so simulation models can be highly valid Easy to compare alternatives Control experimental conditions Can study system with a very long time frame Disadvantages Stochastic simulations produce only estimates – with noise Simulation models can be expensive to develop Simulations usually produce large volumes of output – need to summarize, statistically analyze appropriately Pitfalls Failure to identify objectives clearly up front In appropriate level of detail (both ways) Inadequate design and analysis of simulation experiments Inadequate education, training


Download ppt "Chapter 2 Basic Simulation Modeling"

Similar presentations


Ads by Google