Al-Imam Mohammad Ibn Saud University CS433 Modeling and Simulation Lecture 01 Introduction http://10.2.230.10:4040/akoubaa/cs433/ 19 Oct 2008 Dr. Anis Koubâa 1 Who I Am? 2 Dr. Anis Koubâa Assistant Professor at CS Dept. Research Associate at ISEP/IPP-HURRAY! (Portugal) Email (Teaching): anis.koubaa.ccis@gmail.com Phone: 25 81 921 Background PhD from INPL/LORIA, Nancy (France) Master from UHP Nancy I (France) My Research Main: Wireless Sensor Networks, Cyber-Physical Systems, RealTime Embedded Systems, Quality-of-Service, Performance Evaluation 2 Other: Security Goals for Today 3 Understand what is simulation and what is modelling Some applications of simulation and modelling What is the Life Cycle of the Modelling Process 3 Keywords 4 System It is a collection of entities that act and interact together toward the accomplishment of some logical end (computer, network, communication systems, etc.) Simulation It is an experiment in a computer where the real system is replaced by the execution of the program It is a program that mimics (imitate) the behaviour of the real system 4 Keywords 5 Model It is a simplification of the reality A (usually miniature) representation of something; an example for imitation or emulation A model can be Analytical (Queuing Theory) or by Simulation. Performance Evaluation of a System means quantifying the service delivered by the System Experimental, Analytical, or by simulation 5 Example 6 Models of the System Real System (Motherboard) 6 Example 7 Simulation Models of the System 7 Example 8 8 Example 9 Models of the System 9 10 Simulation 10 Why we need to Simulate? 11 It may be too difficult, risky, or expensive to observe a real, operational system Parts of the system may not be observable (e.g., internals of a silicon chip or biological system) Uses of simulations Analyze systems (performance, behavior) before they are built Reduce the number of design errors Optimize design to improve the behavior Analyze operational systems Create virtual environments for training, entertainment 11 Applications of Simulation 12 System Analysis Telecommunication Networks (ATM, IP, TCP, UDP, WiFi …) Transportation systems (Traffic, Urban planning, Metro Planning, …) Electronic systems (e.g., microelectronics, computer systems) Battlefield simulations (blue army vs. red army) Ecological systems, Manufacturing systems, Logistics … Virtual Environments Physical phenomena (e.g. Trajectory of projectiles) training and entertainment (e.g., military, medicine, emergency planning, flight simulation) 12 A Few Example Applications War gaming: test strategies; training Flight Simulator Transportation systems: improved operations; urban planning Games Parallel computer systems: developing scalable software Computer communication network: protocol design 13 Computer Simulation 14 A Computer Simulation is a computer program that attempts to simulate an abstract model of a particular system. that describes the behavior of a real (physical) system and its evolution in time How it works? The behavior of the system is described by state variables The simulation program modifies the states variables to emulate the evolution 14 Model Development Life Cycle Define goals, objectives of study Develop conceptual model Develop specification of model Fundamentally an iterative process Develop computational model Verify model Validate model 15 Model Development Life Cycle Determine Goals and Objectives What do you what to do with the model It may be an end in itself More often, it is a means to an end Goals may not be known when you start the project! One often learns things along the way Develop Conceptual Model An abstract representation of the system What should be included in model? What can be left out? What abstractions should be used? What is the level of details? Appropriate choice depends on the purpose of the model 16 Model Development Life Cycle Develop Specification Model A more detailed specification of the model including more specifics Collect data to populate model Example: Traffic: Road geometry, signal timing, expected traffic demand, driver behavior Communication: network topology, message type, inter-arrival time Empirical data or probability distributions often used Develop a Computational Model Executable simulation model Software approach General purpose programming language Special purpose simulation language Simulation package Other (non-functional) requirements Performance Interoperability with other models/tools/data 17 Model Development Life Cycle Verification Did I Build the Model Right? هل أنجزت النموذج بطريقة صحيح؟ Does the computational model match the specification model? Debugging: checking if the program contains any programming errors. Verification is different from Validation: (see model validation)! Validation Did I Build the Right Model? هل أنجزت النموذج الصحيح؟ Does the computational model match the actual (or envisioned) system? Typically, the validation of a simulation model can be done by comparing Measurements of actual system An analytic (mathematical) model of the system Another simulation model By necessity, validation is always an incomplete activity! Often can only validate portions of the model If you can validate the simulation with 100% certainty, why build the simulation? 18 Validation Did I build the right model? Does the computational model match the actual (or envisioned) system? Typically, compare against Measurements of actual system An analytic (mathematical) model of the system Another simulation model By necessity, always an incomplete activity! Often can only validate portions of the model If you can validate the simulation with 100% certainty, why build the simulation? 19 20 Performance Evaluation 20 Performance Metrics 21 The Performance Metric is a measurable quantity that precisely captures what we want to measure (response time, throughput, delay, etc.). For example, In computer systems, we might evaluate The response time of a processor to execute a given task. The execution time of two programs in a multi-processor machine. In Network systems, we might evaluate The (maximum/average) delay experienced by a voice packet to reach the destination The throughput of the network The required bandwidth to avoid congestion 21 What does affect the performance? 22 The performance of a system is dramatically affected by the Workload The Workload: it characterises the quantity and the nature of the system inputs In the context of Web Servers, system inputs are http requests (GET or POST requests). The workload characterises the intensity of the requests: how many requests are received by the web server. High intensities deteriorate the performance. The nature of the requests: the request can be simple GET request or a request that require the access of a remote database. The performance will be different for different request types. Benchmarks: used to generate loads that is intended to mimic a typical user behaviour. 22 Why using Models and Simulations? Why to use models? Implementation on real systems is very complex and costly, Experimentation on real systems may be dangerous (e.g. chemical systems) If models adequately describes the reality, experimenting with them can save money and time, and reduce the development complexity When to use simulations? Analytic models may be very complex to evaluate, and may lead to over implication of the real system Simulation can be a good alternative to evaluate the system behavior very close to reality 23 Some Terminologies State: A variable characterizing an attribute in the system the number of (messages/clients) in a queue waiting to be processed Event: An occurrence at a point in time which may change the state of the system Arrival/Departure of a message or start transmitting a message Entity: An object that passes through the system Message (or packet) in a network, A job of a task in computer Queue: A queue is buffer where entities are waiting for something to happen for any reason Network: Queues are implemented in routers to handle messages Computer: Queues are implemented to handle jobs of tasks 24 Some Terminologies Creating: Creating is causing an arrival of a new entity to the system at some point in time. Scheduling: Scheduling is the act of Random variable: A random variable is a quantity that is uncertain, such as inter-arrival time between two incoming flights or number of defective parts in a shipment Random variate: A random variate is an artificially generated random variable Distribution: A distribution is the mathematical law which governs the probabilistic features of a random variable. 25