Presentation is loading. Please wait.

Presentation is loading. Please wait.

2.7: Simulation.

Similar presentations


Presentation on theme: "2.7: Simulation."— Presentation transcript:

1 2.7: Simulation

2 Key points about computer simulation
Computer simulation involves the construction of models using computer programs, which can represent real or imaginary situations. Computer simulations allow users to study or try things that would be difficult or impossible to do in real life. Queues often form an integral part of computer simulation. Computer simulation models need to deal with the behaviour of a system over a period of time. Simulations also often include some element of randomness, often through the use of a pseudo random number generator.

3 Simulation examples There are many examples of computer simulations, for example: The Bank of England may use simulations to see what might happen to the economy if interest rates were reduced or increased. A factory may use a simulation to see the increase in output and profit if more machines were installed. A supermarket may use a simulation to find out the optimum number of checkouts to open at different times of day, in order to reduce queuing and increase customer satisfaction.

4 Entities and Attributes
Entities are the components that make up a system. Attributes are the characteristics of an entity. For example, in a supermarket, some entities might be Customer, Queue, Checkout Operator. An attribute of the customer might be waiting. An attribute of the queue might be its length. An attribute of the checkout operator might be busy.

5 States, events and activities
A system also has states, events and activities. State – What is happening at the moment in the system. For example, in a queuing system, the states are: Nobody in the queue, server waiting. Nobody in the queue, a customer being served. Event – An event is what causes a change of state to take place. For example, a customer arrives. Activity – is defined as a process which takes time The serving of a customer. The inter-arrival time between customers arriving.

6 Simulation example 1: Taxi company
A taxi cab company has a problem They only have one mechanic, Bob. Bob is very experienced but he cannot repair the taxis quickly enough on his own and taxis are out of action for too long queuing up waiting to be repaired. This means the company is losing money. One of the taxi drivers, Olly, used to be a mechanic. Should they use him to repair taxis as a backup? If so, the taxis may be back on the road more quickly. Olly is a quicker mechanic, but less experienced and thorough than Bob. The more time Olly is working as a mechanic, the less time he will be driving his taxi and earning taxi fares for the company. What should the company do to ensure they make the maximum profit? A computer simulation could help to model this situation.

7 Taxi scenario: Entities and Attributes
What would be the entities in this system? Taxi Mechanic Queue What attributes are there of the taxi? How long waiting for repair Whether on or off the road Etc. Can you think of attributes of the other entities?

8 Taxi scenario: States, events and activities
Possible states The mechanics are both busy; taxis are waiting. Olly is driving his cab; no taxis are waiting for repair. Possible events A taxi breaks down. Bob starts a repair. Bob finishes a repair. Possible activities Bob is repairing a taxi. Olly is repairing a taxi. Can you think of others?

9 Simulation example 2: Traffic flow
A town is becoming very congested with traffic most of the day, particularly at rush-hour. A range of alternatives have been suggested including more traffic lights, building a bypass and putting in speed restrictors. A computer simulation is needed to investigate all of these alternatives to see how much traffic congestion would reduce with each alternative. For example, a simulation might consider the effect of introducing traffic lights and enforcing a speed limit. What would be the events and variables in this simulation?

10 Traffic flow scenario: Entities and Attributes
What would be the entities in this system? A car The road The traffic lights What attributes are there of the traffic lights? Colour Time between changes Can you think of attributes of the other entities?

11 Traffic flow scenario: State, events and activities
Possible states – There are no cars waiting at the traffic lights; the lights are red. All traffic is stationary. Possible events – The traffic lights change to red. The traffic lights change to green. Possible activities – A car is moving along the road. A car is waiting at the traffic lights. Can you think of others?

12 Timing of events Many simulations involve changing the timing of events – these are called discrete event simulations. Events may occur at random time intervals. To do this a (pseudo) random number generator can be used. A number is generated between 0 and 1 using a mathematical formula. It can then be multiplied by a number to generate larger numbers. Probability may be used to give realistic timing of events in the simulation. These may be based on averages such as how many customers arrive in a given period of time.

13 Summary Computer simulations can be used for a wide range of different situations, where a “what if” question needs to be asked. Computer simulations involve creating a model of a real-life, or imaginary situation. Creating a model of a system involves determining the entities, attributes, states, events, attributes and activities within the system.


Download ppt "2.7: Simulation."

Similar presentations


Ads by Google