Introduction to modeling and simulation

Document Sample
Introduction to modeling and simulation Powered By Docstoc
					                   Introduction to
                 modeling, simulation,
                   and Optimization
                            Dr. Yan Liu
Department of Biomedical, Industrial and Human Factors Engineering
                     Wright State University

   What is System
       A system is a set of components which are related by some form of interaction
        and which act together to achieve some objective or purpose
            Components are the individual parts or elements that collectively make up the
            Relationships are the cause-effect dependencies between components
            Objective is the desired state or outcome which the system is attempting to achieve

                            • Collectors
                              • Capture sun’s thermal energy
                            • Storage tank
                            • Pump
                              • Move the water through the tank
                            • Booster element
                             • Heat water
                            • Relief valve
                            • Cold water inlet
                            • Hot water outlet

Solar-Heated Water System

   Natural vs. Artificial Systems
       A natural system exists as a result of processes occurring in the natural world
        (e.g. river, universe)
       An artificial system owes its origin to human activity (e.g. space shuttle,
   Static vs. Dynamic Systems
       A static system has structure but no associated activity (e.g. bridge, building)
       A dynamic system involves time-varying behavior (e.g. machine, U.S.

   Open-Loop vs. Closed-Loop systems
       Inputs
            Variables that influence the behavior of the system
                e.g. wheel, accelerator, and brake of a car

       Outputs
            Variables that are determined by the system and may influence the surrounding
                e.g. direction and speed of a car

       An open-loop system cannot control or adjust its own performance
            e.g. watch, car
       A closed-loop system controls and adjusts its own performance in response to
        outputs generated by the system through feedback
            e.g. watch with owner, car with driver
       Feedback is the system function that obtains data on system performance
        (outputs), compares the actual performance to the desired performance (a
        standard or criterion), and determines the corrective action necessary
                Input       System        Output

                        Open-Loop System

Desired Reference
      or Input     Error     System          Output
               + Signal      Controller

                        Closed-Loop System


   What is Model
       A model of a system is a representation of the construction and working of the
       Similar to but simpler than the system it represents
            Close approximation to the real system and incorporate most of its salient features
            Should not be so complex that it is hard to understand or experiment with it
   Physical Model
       A physical object that mimics some properties of a real system
            e.g. During design of buildings, it is common to construct small physical models
             with the same shape and appearance as the real buildings to be studied
       Through prototyping process
            Prototyping is the process of quickly putting together a working model (a prototype)
             in order to test various aspects of a design, illustrate ideas or features and gather
             early user feedback

   Mathematical Model
       A description of a system where the relationship between variables of the system
        are expressed in a mathematical form
             e.g. Ohm's law describes the relationship between current and voltage for a resistor;
             Hooke's Law gives the relationship between the force applied to an unstretched
             spring and the amount the spring is stretched when the force is applied, etc.
       Through virtual prototyping
       Deterministic vs. stochastic models
            In deterministic models, the input and output variables are not subject to random
             fluctuations, so that the system is at any time entirely defined by the initial
             conditions chosen
                 e.g. the return on a 5-year investment with an annual interest rate of 7%,
                   compounded monthly
            In stochastic models, at least one of the input or output variables is probabilistic or
             involves randomness
                 e.g. the number of machines that are needed to make certain parts based on the
                   probability of machine failure                                                8
 Fspring              spring constant The amount spring
                                         is stretched
                     FSpring = -k∙x

                     x= -FSpring/k

Hooke’s Law


   What is Simulation
       A simulation of a system is the operation of a model of the system, as an
        imitation of the real system
       A tool to evaluate the performance of a system, existing or proposed, under
        different configurations of interest and over a long period of time
            e.g. a simulation of an industrial process to learn about its behavior under different
             operating conditions in order to improve the process
   Reasons for Simulation
       Experiments on real systems are too expensive, too dangerous, or the system to
        be investigated does not yet exist
            e.g. Investigating ship durability by building ships and letting them collide is a very
             expensive method of gaining information; training nuclear plant operators in
             handling dangerous situations by letting the nuclear reactor enter hazardous states is
             not advisable


   Reasons for Simulation (Cont.)
       The time scale of the dynamics of the system is not compatible with that of the
            e.g. It takes millions of years to observe small changes in the development of the
             universe, whereas similar changes can be quickly observed in a computer simulation
             of the universe
       Easy manipulation of parameters of models (even outside the feasible range of a
        particular physical system)
            e.g. The mass of a body in a computer-based simulation model can be increased from
             40 to 500 kg at a keystroke, whereas this change might be hard to realize in the
             physical system
       Suppression of disturbances
            Allow isolating particular effects and gaining a better understanding of effects of
             particular interest as a result
            e.g. simulation of free-fall objects ignores the effect of air resistance


   Dangers of Simulation
       Fall in love with a model
            Become too enthusiastic about a model and forget about the experimental frame
            e.g. Hooke’s law applies only if the spring is not stretched beyond its elastic limit
       Force reality into the constraints of a model
            e.g. Shaping of our societies after fashionable economic theories that have a
             simplified view of reality and ignoring many other important aspects of human
             behavior, society, and nature
       Forget the model’s level of accuracy
            All models have simplifying assumptions
            e.g. Free-fall motion is a simplified model (assuming air resistance is negligible)

                Phases and Steps of Simulation

   Phase 1. Develop Simulation Model
       Step 1. Identify the problem
       Step 2. Formulate the problem
       Step 3. Collect and process real system data
       Step 4. Formulate and develop a model
       Step 5. Validate the model
       Step 6. Document model for future use
   Phase 2. Design and Conduct Simulation Experiment
       A test or series of tests in which meaningful changes are made to the input
        variables of a simulation model so that we may observe and identify the reasons
        for changes in the performance measures
       Step 7. Select appropriate experimental design
       Step 8. Establish experimental conditions for runs
       Step 9. Perform simulation runs

   Phase 3. Perform Simulation Analysis
       Step 10. Analyze data and present results
       Step 11. Recommend further courses of actions

                        Develop Simulation Model
   Step 1. Identify Problem
       Enumerate problems with an existing system
       Produce requirements for a proposed system
   Step 2. Formulate Problem
       Define overall objectives of the study and specific issues to be addressed
       Define performance measures
            Quantitative criteria on the basis of which different system configurations will be
             evaluated and compared
       Develop a set of working assumptions that will form the basis for model
            Model boundary and scope (width of model)
                Determines what is in the model and what is out
            Level of detail (depth of model)
                Specifies how in-depth one component or entity is modeled
                Determined by the questions being asked and data availability

       Decide the time frame of the study
            Used for one-time or over a period of time on a regular basis
                       Develop Simulation Model

   Step 3. Collect and Process Real System Data
       Collect data on system specifications, input variables, performance of the
        existing system, etc.
       Identify sources of randomness (stochastic input variables) in the system
       Select an appropriate input probability distribution for each stochastic input
        variable and estimate corresponding parameters
            Standard distributions (e.g. normal, exponential, etc.)
            Empirical distributions
            Software packages for distribution fitting (e.g. @Risk, Arena, Matlab, etc.)

                       Develop Simulation Model

   Step 4. Formulate and Develop a Model
       Develop schematics and network diagrams of the system
            How do entities flow through the system
       Translate conceptual models to simulation software acceptable form
       Verify that the simulation model executes as intended
            Build the model right (low-level checking)
            Traces
                Vary input parameters over their acceptable ranges and check the output

                       Develop Simulation Model

   Step 5. Validate Model
       Check whether the model satisfies or fits the intended usage of system (high-
        level checking)
            Build the right model
       Compare the model's performance under known conditions with the
        performance of the real system
       Perform statistical inference tests and get the model examined by system experts
       Assess the confidence that the end user places on the model and address
        problems if any
   Step 6. Document Model for Future Use
       Objectives, assumptions, inputs, outputs, etc.

     Design and Conduct Simulation Experiment
   Step 7. Select Appropriate Experimental Design
       Performance measures
       Input parameters to be varied
            Ranges and legitimate combinations
       Document experiment design
   Step 8. Establish Experimental Conditions for Runs
       Whether the system is stationary (performance measure does not change over
        time) or non-stationary (performance measure changes over time)
       Whether a terminating or a non-terminating simulation run is appropriate
       Starting condition
       Length of warm-up period
       Model run length
       Number of statistical replications
   Step 9. Perform Simulation Runs
                                 Simulation Analysis

   Step 10. Analyze Data and Present Results
       Statistics of the performance measure for each configuration of the model
              Mean, standard deviation, range, confidence intervals, etc.
       Graphical displays of output data
              Histograms, scatterplot, etc.
       Document results and conclusions
   Step 11. Recommend Further Courses of Actions
       Other performance measures
       Further experiments to increase the precision and reduce the bias of estimators
       Sensitivity analysis
              How sensitive the behavior of the model is to changes of model parameters
       etc.

A machine shop contains two drills, one straightener, and one finishing operator.
Type 1 parts require drilling, straightening, and finishing in sequence. Type 2 parts
require only drilling and finishing. The frequency of arrival and the time to be
routed to the drilling area are deterministic for both types of parts.


                  Drill #1
                  Drill #2                               Operator

                                                                  Type 1 parts
                                                                  Type 2 parts

Step 1. Identify the problem
• Assess utilization of drills, straightener, and finishing operator
• The following modification to the original system is of interest: the frequency of arrival of both
parts is exponential with the same respective means as in the original system

Step 2. Formulate the problem
• Obtain the utilization of drills, straightener, and finishing operator for the system
• Assess the modification
Performance measure
• Utilization of operations (the fraction of time the server is busy, i.e. busy time divided by the
total time)
• Two drills are identical
• There is no material handling time between the three operations
• Parts are processed on a first-come-first-serve basis
• Parts wait in a queue till one of the two drilling machines becomes available

Step 3. Collect and process real system data
• A type 1 part arrives every 30 min.
• A type 2 part arrives every 20 min.
• It takes 2 min. and 10 min. to route a type 1 part and a type 2 part to the drilling area,
• Drilling time is normally distributed with mean 10 min. and standard deviation 1 min.
• Straightening time is exponentially distributed with a mean of 15 min.
• Finishing requires 5 min. per part
Step 4. Formulate and develop a model
• A model of the system and the modification are developed using a simulation package
• A trace verifies that the parts flowed through the job shop as expected
Step 5. Validate the model
• The model of the original system is run for a sufficiently long period, and its utilization
performance measures are judged to be reasonable by the machine shop operators
Step 6. Document model for future use
• The models of the original system and the modification are documented as thoroughly as

Step 7. Select appropriate experimental design
• Performance measures are the utilization of operations
• Vary input parameters: operating times for drilling, straightening, and arrival time of parts (in
• Document experiment design for the models of the original and modified systems
Step 8. Establish experimental conditions for runs
• The system is non-stationary
• There is no part in the machine shop initially
• 1000 min. warm-up period
• Each model is run three times for 4000 min.
Step 9. Perform simulation runs
• Runs are performed as specified in Steps 7 and 8

Step 10. Interpret and present results

    Utilization Statistics of Models of Original and Modified Systems (in parenthesis)
                           Drilling       Straightening       Finishing
        Mean Run #1       0.83 (0.78)      0.51 (0.58)       0.42 (0.39)
        Mean Run #2       0.82 (0.90)      0.52 (0.49)       0.41 (0.45)
        Mean Run #3       0.84 (0.81)      0.42 (0.56)       0.42 (0.40)
        Std. Run #1       0.69 (0.75)      0.50 (0.49)       0.49 (0.49)
        Std. Run #2       0.68 (0.78)      0.50 (0.50)       0.49 (0.50)
        Std. Run #3       0.69 (0.76)      0.49 (0.50)       0.49 (0.49)

 • Utilization of each drill is about 80%
 • Utilization of straightener is about 50%
 • Utilization of finishing operator is about 40%
 • Average utilization of the original and modified systems does not differ significantly
 • The standard deviation of the drilling operation seems to have increased because of the
 increased randomness in the modification

Step 11. Recommend further course of action
• Other performance measures of interest may be: throughput of parts for the system, mean
time in system for both types of parts, average and maximum queue lengths for each operation
• Other modification of interest may be: the flow of parts to the machine shop doubles

                                 Simulation Tools

   General Purpose Programming Languages
       FORTRAN, PASCAL,C/C++ JAVA, etc.
       Advantages:
            Little or no additional software cost
            Universally available (portable)
            No additional training
       Disadvantages:
            Every model starts from scratch
            Very little reusable code
            Long development cycle for each model

                                 Simulation Tools
   General Simulation Languages
       Arena, Extend, GPSS, SIMSCRIPT, SIMULINK (In Matlab), etc.
       Advantages
            Standardized features in modeling
            Shorter development cycle for each model
            Very readable code
       Disadvantages
            Higher software cost (up-front)
            Additional training required
            Limited portability

                                 Simulation Tools

   Special Purpose Simulation Packages
       Manufacturing (e.g. AutoMod, FACTOR/AIM, etc.), Communications network
        (e.g.COMNET III, NETWORK II.5, etc.), Business (BP$IM, ProcessModel,
        etc.), Health care (e.g. MedModel)
       Advantages
            Very quick development of complex models
            Short learning cycle
            little programming
       Disadvantages
            High cost of software
            Limited scope of applicability
            Limited flexibility

   What is Optimization
      Its objective is to select the best possible decision for a given set of circumstances
       without having to enumerate all of the possibilities
      Involves maximization or minimization as desired
             How can a large manufacturing company determine the monthly product mix at its Indianapolis
              plant that maximizes corporate profitability?
             Design of civil engineering structures such as frames, foundations, bridges, towers, chimneys
              and dams for the minimum cost
   Components
        Decision variables
             Variables in the model which you have control over
        Objective function
             A function (mathematical model) that quantifies the quality of a solution in an optimization
        Constraints
             Conditions that a solution to an optimization problem must satisfy
             Restrict decision variables by defining relationships among them
        Find the values of the decision variables that maximize (minimize) the objective function
         value, while staying within the constraints
   Linear Programming
       The objective function and all constraints are linear functions (e.g. no squared
        terms, trigonometric functions, ratios of variables) of the decision variables

        Maximize z = 15x1+10x2
        subject to
        0≤ x1 ≤2, 0 ≤ x2 ≤ 3, x1+x2 ≤4

     The objective function is z = 15x1+10x2
     The constraints are:
     0≤ x1≤2, 0 ≤ x2 ≤ 3, x1+x2 ≤4

5 2                                x1=2


3                                                            x2=3

                                   Optimal point (x1=x2=2)
                                          x1+ x2 = 4
        Feasible Region


                                    z = 40
                              z = 30                                    x1
    0          1     z = 20    2              3         4           5
            z = 10

                          zmax = 15*2 + 10*2 = 50
                                Excel Solver
   A Microsoft Excel Add-In
       Go to Tools >>Add-Ins , select Solver Add-in, click OK
   Originally designed for optimization problems but also useful for root
    finding and similar mathematical problems
                                               Target cell
                                               • The objective or goal
                                               • Maximize, minimize or set a specific
                                               value to the target cell

                                               Changing cells
                                               • Can be adjusted until the constraints in the
                                               problem are satisfied and the cell in the Set
                                               Target Cell box reaches its target

                                               • The restrictions placed on the changing
                                               cells                                 33

Shared By: