The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 3 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
CS vesrion: HMW4 and HMW5 have to be uploaded in two different folders or files, despite related.Thanks.
*cpp , C++, no C+1
HW#4&5Elevator SimulationDesign a program to simulate the daily service of an elevator in a building.Report the number of passengers served, the average wait time, the maximum wait time, the average totaltravel time, and the maximum total travel time.HW#4Implement the linked-list queue (e.g., for hall calls) and the BST (e.g., for carServiceTrip).You may use a six floors building , called “ERC” (labeled from 3 to 8).The home floor for the elevators is Floor4.HW#5Develop a framework to be used in elevator applications.Simulate the elevator for more than two cars and for taller buildings.NOTES on modeling:Important things to model include passenger (P), elevator car (C), hallway up/dn buttons (HBtn), hallwaydisplay (HD), car buttons (CBtn), motor, car door, floor limit sensors, clock, timer.These things can be represented by a struct/class, each containing all the relevant data.Passenger: PID, timeOfRequest, originFloor, destFloor, waitTime, travelTime.Car: CarID, tripCounter, floorServedByTrip, passengerCount.HallCallQueue: upServiceCall, dnServiceCallTimer and time counter: idle, doorOpen, doorClose, moveByOneFlightTime=5s, accelerateUpTime=2s,accelerateDnTime=2s, decelerateUpTime=2s, decelerateDnTime=2s,STDa) Each car goes through a finite number of states:S1-Idle/Wait state, S2-Accelerate, S3-ConstantMotion, S4-MoveByOneFloor, S5-Decelerate.b) Events and conditions that trigger the transition between states:S1->S2:Inputs: (CBtn pressed->CBtnQ entry added) or (HBtnpressed->HBtnQ entry added)Pre: {CBtnQ not empty} or {HBtnQ not empty}Determine direction of travel: if destF – currF > 0setTripDirection=Up; else =DnPost: close car door, motor on for the direction, timestampTripStartTime, TimeCounter onUpdateCBtnQ and HBtnQ, TripPlanBSTOutputs: car in motion, serve the CBtnQ and HBtnQS2->S3:Inputs: {CBtn} or {HBtn}Pre: ExitFloor-sensorPost: TripTime = TripTime + accelerateTimeOutputs: NextFloor <- nextFloorOfBSTS3-> S4:Inputs: {CBtn} or {HBtn}Pre: ExitFloor-sensor -> currFPost: TripTime = TripTime + moveByOneFlightTimeOutputs: currF < nextFloorOfBSTS3->S5:Inputs: {CBtn not empty} or {HBtn not empty}Pre: NextFloor = nextFloorOfBSTPost:Outputs:S5->S1:Inputs: TripPlanPre: TripPlan not completedPost:currF = EnterFOutputs:
Attachments: