Simulations CS 2123 What are simulations Simulations attempt

  • Slides: 12
Download presentation
Simulations CS 2123

Simulations CS 2123

What are simulations? • Simulations attempt to model a real-world situation to learn before

What are simulations? • Simulations attempt to model a real-world situation to learn before actually making what could be an expensive change. • Frequently, simulations investigate a situation prior to implementing the change. • Computer Scientists are sought to provide simulation assistance.

Case #1: Space Shuttle Robotic Arm • In the 1970 s, UTSA had a

Case #1: Space Shuttle Robotic Arm • In the 1970 s, UTSA had a research contract to help model movement of the very expensive robotic arm. NASA didn’t want the arm to be damaged or damage the shuttle, harming the astronauts. • The simulation provided a graphical model of the arm movement and provided graphics with hidden-line filtering. • Robotic arm control software could then be modified to understand all movement tolerances.

Case #2: Should WGFY add a teller? • The “We’ve Got a Fee for

Case #2: Should WGFY add a teller? • The “We’ve Got a Fee for You” (WGFY) Bank is hearing many complaints from customers who are waiting in line at their bank. • Customers are complaining that they are waiting over 20 minutes • Lobby has three tellers, each with a separate queue • Due to bank lobby configuration expenses, labor expenses, and customer inconvenience, they would like a simulation to learn the effects of proposed changes • Alternative A: change to a single queue serving all tellers ($100 K) • Alternative B: add another teller ($400 K + $60 K/year) • Alternative C: add another teller and utilize a single queue serving all tellers ($600 K + $60 K/year)

Case #3: Call Center Management • A large insurance company needed to improve telephone

Case #3: Call Center Management • A large insurance company needed to improve telephone coverage. Customers were hanging up due to long waits for a service representative during peak times (10 am – 2 pm CDT). • Hang-up probability (of calls still live) • > 5 minutes – 40% • between 2 and 5 minutes – 20% • < 2 minutes – 5% • Company had geographic call centers in each major time zone. PST service representatives only worked with customers on the West coast; MST service representatives only worked with customers in the Rocky Mountain area; CDT service representatives worked with customers in any time zone.

Case #3: Call Center Management (cont) • Due to labor costs and time to

Case #3: Call Center Management (cont) • Due to labor costs and time to onboard new employees, adding labor is expensive and wouldn’t immediately change the call waiting times. Options (select combinations): • Add X employees (X * $100 K/year) with impact not realized until after 3 months. • Provide automated call-back system ($500 K + $400 K/year support) • During low morning call periods in the MST and PST areas, use MST and PST service representatives to help with the peak in the CST. Licensing requirements would mandate additional training (productivity loss of 1 month per utilized service representative)

Case #4: Podunk Intersection Congestion: • The City of Podunk needs to determine how

Case #4: Podunk Intersection Congestion: • The City of Podunk needs to determine how to handle congestion at a particular intersection. Should a traffic light be installed or should a roundabout be used? • During Peak congestion (7 am-9 am and 4 pm-6 pm), traffic queues up to 4 -9 vehicles and a wait time of over 1 minute. • Alternatives: • Traffic Light ($400 K + $40 K / yr). Average wait times are expected to be 50 seconds during peak due to waiting for a complete light cycle. • Roundabout ($600 K + $0 / yr). Average wait times are expected to be less than 6 seconds (but it hasn’t been verified).

Time-based Event Simulations • Cases 2 thru 4 are timed-based event simulations: • Need

Time-based Event Simulations • Cases 2 thru 4 are timed-based event simulations: • Need to know: • Arrival rates • Service time • Want to produce (at least): • • Average waiting time Average queue length Maximum waiting time Maximum queue length • Observations of current arrivals (customer at lobby, customer call, vehicles at intersections) can provide arrival rates • Observations of service time (teller service, call center service representative service, time to cross intersection) • Observations of existing wait time and queue length

Time-based Event Simulations • Time-based Event List • Arrival events are inserted based on

Time-based Event Simulations • Time-based Event List • Arrival events are inserted based on information from observations • Service completion events are inserted when servicing begins • Implementation: Ordered (by time) Linked List with duplicates • Clock • Next clock value set from time-based event list • Implementation: Simple integer value • Queues • While customers (or widgets ) are waiting, they queue up • Used to compute average waiting times, maximum waiting times, average queue length, and maximum queue length • Implementation: queue (with additional attributes for statistics) • Servers • Maintain whether they are busy • Associate the server with a queue • Try to take the next customer (or widget) from the queue • Widgets • Represent the thing that moves through the simulation (customers, vehicles, parts) • Implementation: structure (with additional attributes for statistics)

Running a Simulation • run. Simulation routine: • Loops through the dynamic list of

Running a Simulation • run. Simulation routine: • Loops through the dynamic list of time-based events • Based on the event type, invokes the appropriate capability. Examples: • Arrival: • arrival • enter queue • try to seize server • Service Completion: • release server (and server take’s another widget from queue if possible)

Sample run. Simulation: single queue, one server generate. Arrival(sim, 0); while (remove. LL(sim->event. List,

Sample run. Simulation: single queue, one server generate. Arrival(sim, 0); while (remove. LL(sim->event. List, &event)) { sim->i. Clock = event. i. Time; // advance clock switch(event. Type); { case EVT_ARRIVAL: arrival(sim, &event. widget); queue. Up(sim, queue. Teller, &event. widget); seize(sim, queue. Teller, server. Teller); break; case EVT_TELLER_COMPLETE: release(sim, queue. Teller, server. Teller, &event. widget); leave. System(sim, event. widget); break; default: Err. Exit(ERR_ALGORITHM, "Unknown event type: %dn", event. i. Event. Type); } }

Queue Statistics - average waiting time Gather queue time for each widget. • Each

Queue Statistics - average waiting time Gather queue time for each widget. • Each widget includes a time in queue (for each queue). • On leaving queue: • Add the widget’s time to the queue time sum. • Add 1 to queue exit widget count.