Presentation is loading. Please wait.

Presentation is loading. Please wait.

MECH 3550 : Simulation & Visualization

Similar presentations


Presentation on theme: "MECH 3550 : Simulation & Visualization"— Presentation transcript:

1 MECH 3550 : Simulation & Visualization
Building Complex Systems See ME3550Ch2PDF

2 Flow Chart for a Complex System
Function end_CPU_run Remove job from CPU Does job require more CPU time? Yes No Place job at end of queue Compute response time of job and gather statistics Invoke start_CPU_run Schedule an arrival event for the terminal of this job Add 1 to the number of jobs processed Yes Are enough jobs done? No Are there any jobs in the queue? Schedule an end-simulation even immediately No Yes Invoke start_CPU_run Return

3 Arrive Depart Flow Charts for a Bank
Function arrive Function depart Schedule the next arrival event Schedule the next arrival event Is a teller idle? Is the queue for this teller idle? Yes No Yes No Tally a delay of 0 for this customer Find the number, shortest_queue, of the leftmost shortest queue Make this teller idle Remove the first customer from this queue Make the teller busy Place the customer at the end of queue number shortest_queue Compute this customer’s delay and gather statistics Schedule a departure event for this customer Schedule a departure event for this customer Return Invoke jockey Return

4 Flow Chart for Bank Model
Function jockey Is there a customer to jockey? Yes No Remove this customer from the tail of his or her current queue Is the teller who just completed service now busy? Yes No Place the jockeying customer at the tail of the queue of the teller who just completed service Compute the delay of the jockeying customer and gather statistics Make the teller busy Schedule a departure event for the jockeying customer Return

5 Flow Chart for Arrive and Depart
Function arrive Function depart Is this a new arrival? Determine the station from which the job is departing Yes Schedule the next (new) arrival event Is the queue for this station empty? Yes No No Make a machine in this station idle and gather statistics Remove the first job from the queue Generate the job type and set task=1 for this job Compute the delay for this job and gather statistics Determine the station for this job Are all machines in this station busy? Schedule a departure event for this job Yes No Place the job at the end of the queue for this station Tally a delay of 0 for this job Does departing job have more tasks to be done? Yes Make a machine in this station busy and gather statistics Add 1 to task of the departing job No Schedule a departure event for this job Invoke arrive with new_job =2 Return Return

6 C CProgram Examples


Download ppt "MECH 3550 : Simulation & Visualization"

Similar presentations


Ads by Google