Design a program to simulate the daily service

Assignment Help Computer Engineering
Reference no: EM131149145

Design 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 total travel time, and the maximum total travel time.

HW

Implement the linked-list queue (e.g., for hall calls) and the BST (e.g., for carServiceTrip).

You may use the ERC building as an example. ERC has six floors (labeled from 3 to 8).

The home floor for the elevators is Floor4.

HW

Develop 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), hallway display (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, dnServiceCall

Timer and time counter: idle, doorOpen, doorClose, moveByOneFlightTime=5s, accelerateUpTime=2s, accelerateDnTime=2s, decelerateUpTime=2s, decelerateDnTime=2s, STD

STD
a) Each car goes through a finite number of states:
S1-Idle/Wait state, S2-Accelerate, S3-ConstantMotion, S4-MoveByOneFloor, S5-Decelerate.
b) Events and conditionsthat trigger the transition between states:

S1->S2:

  Inputs: (CBtn pressed->CBtnQ entry added) or (HBtn pressed->HBtnQ entry added)

  Pre: {CBtnQ not empty} or {HBtnQ not empty}

Determine direction of travel: if destF - currF > 0 setTripDirection=Up; else=Dn

  Post: close car door, motor on for the direction, timestamp TripStartTime, TimeCounter on

                UpdateCBtnQ and HBtnQ, TripPlanBST

  Outputs: car in motion, serve the CBtnQ and HBtnQ

S2->S3:

  Inputs: {CBtn} or {HBtn}

  Pre: ExitFloor-sensor

  Post: TripTime = TripTime + accelerateTime

  Outputs: NextFloor <- nextFloorOfBST

S3-> S4:

  Inputs: {CBtn} or {HBtn}

  Pre: ExitFloor-sensor -> currF

  Post: TripTime = TripTime + moveByOneFlightTime

  Outputs: currF < nextFloorOfBST

S3->S5:

  Inputs: {CBtn not empty} or {HBtn not empty}

  Pre: NextFloor = nextFloorOfBST

  Post:

  Outputs:

S5->S1:

  Inputs: TripPlan

  Pre: TripPlan not completed

  Post:currF = EnterF

  Outputs:

 

c) Time line
Assume the period to be studied is during the business hours of a weekday. The activities may occur any time between 7:00 AM till 7:00 PM (7:00:00 - 19:00:00). Using second as the smallest time unit, 12 hours will have 43,200 seconds. We may choose a coarser time unit, say 5-second intervals. Then the time line can be divided into 8,640 units.
On a campus setting, the traffic is usually heaviest during morning and late rush hours, lunch time, and during class breaks. Based on these observations and some assumptions, we could try to develop an outline of the rough traffic pattern based on the nature of the occupants and the usage of the building.

Using a sample run in one of the elevators on campus: A round trip: F8->F6 and -- F6->F8
======== ============ P# = {#, Fat-src, up/dn, Fdest,Tarr, Tgeton, Tgetoff, Twait, Tride}
P1-arrFsrc8-phb-dn:13:09:07 == > P1 = {1, F8, dn, --, 13:09:07, --, --, --, --}
S1-Tcar-arvF8: 13:10:01 == > P1 = {1, F8, dn, --, 13:09:07, --, --, --, --}
S1-Tp1-getonCar 13:10:05 == >P1 = {1, F8, dn, --, 13:09:07, 13:10:05, --, 58, --} 10:05 - 09:07 = 58
S1-Tp1-pb6 13:10:06 == > P1 = {1, F8, dn, F6, 13:09:07, 13:10:05, --, 58, --}
S2-Taccel-dn: 13:10:10
S3-Tmov8 13:10:13
S4-Tmov8-7x: 13:10 19
S3-Tmov7 13:10:24
S4-Tmov7-6x: 13:10:27
S3-Tmov6 13:10:29
S5-Tslow-dn: 13:10:31
S1-Tcar-arvF6 13:10:35 == > P1 = {1, F8, dn, F6, 13:09:07, 13:10:05, --, 58, --}
P1 leave 13:10:36 == >P1 = {1, F8, dn, F6, 13:09:07, 13:10:05, 13:10:36, 58, 21}
==Trip 1: {run#=1, 13:10:01-13:10:35, dir = dn, 8 to 6, travel-time = 10:35-10:10= 25, #rider=1}

===========
P2-arrFsrc6- 13:10:35 == > P2 = {2, F6, up, --, 13:10:35, --, --, --, --}
S1-Tp2-getonCar 13:10:35 == >P2 = {2, F6, up, --, 13:10:35, 13:10:35, --, 0, --}
S1-Tp2-pb8 13:10:37 == > P2 = {2, F6, up, F8, 13:10:35, 13:10:35, --, 0, --}
S2-Taccel-up 13:10:43
S3-Tmov6 13:10:46
S4-Tmov6-7x 13:10:51
S3-Tmov7 13:10:56
S4-Tmov7-8x 13:10:58
S3-Tmov8 13:10:59
S5-Tslow-up 13:11:02
S1-Tcar-arvF8 13:11:06 == > P2 = {2, F6, up, F8, 13:10:35, 13:10:35, --, 0, --}
P2 leave 13:11:07 == >P2 = {2, F6, up, F8, 13:10:35, 13:10:35, 13:11:07, 0, 25}
== trip 2: {run#=2, 13:10:35-13:11:06, dir = up, 6 to 8, travel-time = 11;06-10:43= 23, #rider=1}

The travel time of the elevator car can be viewed as the following:.
S1- Idle time (including opening the door, door open wait time, close door) = 10 seconds, two units.
S2- Car Move-Accelerate time (departing and pickup speed before crossing the floor sensor) = 3~5 seconds
S3- Car Move - steady state/constant speed at a floor
S4- Car Move - Crossing floors (sensor/beep) = about 10 seconds per floor
S5- Car Move-Decelerate (to stop) = about 3 ~ 5 seconds

d) Building Layout and Usage
A more elaborated regular traffic pattern can be developed for the tenants of the building. But it will not be possible for the visitors. Using the ERC building as an example,it houses both offices and laboratories. Office occupants are the permanent users who are part of the daily elevator user. Lab users are irregular users of the building. Floor 4 is the main entrance. Floor6 and Floor 7 connect to an adjacent building. Therefore, there are people who transit through Floor4 to Floor6or Floor7 to and from the adjacent building. A wild guess. Let's assume that Floor 8 has about 20 regular tenants, Floor 7 about 30 tenants and 20 lab users, Floor6 20 tenants and 10 users, Floor 5 20 tenants and 15 users, Floor 4 20 tenants and 15 users and Floor 3 10 users of the labs. Assume these regulars use elevator at least twice a day, that would be around 400 rides. Adding the transit people, we may make a rough estimate of a total of 800 passengers using the elevator daily.

The distribution of passenger arrival at each floor should be context-dependent and a time-series.
Context: usage of the rooms in the building: {person: office/lab, role, task purpose}

Data structures
To keep the current active list of all the passengers waiting atall the floors, let's create a queue data structure, called carServRequest. To manage the car travel, these requests can be further separated into smaller lists, identified by the floor and by the direction of the target destination floor, either up and down. (floor passenger list, both FPLup and FPLdn).

People using elevator: {passenger#, Fat-src, direction:up/dn, Fdest,Tarr, Tgetoncar, Tgetoff, Twait, Tride}
The range for each of these parameters:
PassengerCount [1, MaxPassengerNum=800], Floor-origin:Fat-src [3-8], car-direction:dir [up, dn], Floor-destination:Fdest [3-8], TimeOfArrivalOnFloor:Tarr [1-8640], Tgetoncar [1-8640], Tgetoffcar [1-8640],Twait [1-600], Tride [1-100].
The wait time is the difference between Tgetoncar and Tarr, and the time of the travel/ride is Tgetoff - Tgeton.

e) Car Workflow
The system initialization:
Each car has a home floor, where the starting state, the S1-Idle state, begins.
Assume that the elevator begins its service at time line on 7:00:00.

Each trip consists of a directional run until the top/bottom floor on the plan list is reached.
When reaching to the end of a run, the elevator can either idle at that floor, indefinitely, or after a given dormant interval, goes back to its home floor, say, Floor4.

The trip plan is generated when in idle state (no previous calls) a call or calls(*), either a hall call or a car floor call, is entered into a queue (carServRequest). The first destination floor entered will determine the direction of the trip.
Two strategies: a) This plan can be locked up and no new request is serviced until the trip is completed or b) the plan can be dynamically updated as the car travels along the path and more calls are entered during the run.

Case study of Car Controller data structure. A sample scenario -

Car idle at F4. Hall up call registered at F7, and car floor call F8 entered. carServRequest={F7, F8}
Car trip plan created: {trip#, dir = up, Fsrc=F4, Fdest=(F7, F8), Plan=(nextStop=F7, endFloor=F8)}
Trip Log:
Car moves: F4->F5, (*) new Hall up call at F6 registered in carServRequest queue== > update trip plan
{trip#, dir = up, Fsrc=F4, Fdest = (F6, F7, F8), Plan=(nextStop: F6, endFloor=F8)}
Car moves: F5->F6. F6 == nextStop.
Car stops at F6, serves a new passenger, whose car floor call (*) is registered in carServRequest queue, and added to the plan, if not already on the list.
== > update trip plan: {trip#, dir = up, Fsrc=F4, Fdest = (F7, F8), Plan=(nextStop: F7, endFloor=F8)}
Resume motion: {trip#, dir = up, Fsrc=F4, Fdest = (F7, F8), Plan=(nextStop: F7, endFloor=F8)}
Car moves: F6->F7. F7 == nextStop.
Car stops at F7, serves a new passenger, whose car floor call is added to the plan, if not already on the list.
== > update trip plan: {trip#, dir = up, Fsrc=F4, Fdest = (F8), Plan=(nextStop: F8, endFloor=F8)}
Car moves: F7->F8. F8 == nextStop.
Car stops at F8. F8== endFloor.Trip complete.
Close out trip plan. {trip#, dir=up, Fsrc, Fstopped={F6, F7, F8}, Ttraveled}
Enter the start Idle state. Check the carServRequest queue to begin a new run, or wait.

Reference no: EM131149145

Questions Cloud

Do they feel confident with the tools they were given : Consider asking what has changed. Has the program made a difference? Are behavioral changes going to occur? What behavior shifts have already occurred?
Write c program to find the distance traveled : Write C program to find the distance traveled at regular intervals of time given the values of ‘u' and ‘a'. The program should provide the flexibility to the user to select his own time intervals and repeat the calculations for different values of..
The united states should deal with the refugee crisis : Why do you think Europe is hesitant to allow Syrian Refugees into their countries? -  How do you think the United States should deal with the refugee crisis?
What are some of the main differences between theories : What are the main components of each of the psychoanalytic-social personality theories? What are some of the main differences between theories
Design a program to simulate the daily service : Design a program to simulate the daily service of an elevator in a building - Implement the linked-list queue (e.g., for hall calls) and the BST
How that statement may apply to that activity as experience : Then, think of one area of your life, such as your job, banking, your education, a leisure activity, etc. (NOT choosing one of the areas described in the textbook), and think of how that statement may apply to that activity as you experience it. B..
Method to insert dna from one cell into another cell : What is one method by which you could insert DNA from one cell into another cell?- Which of the following is NOT a vector?- The natural role of restriction enzymes in bacteria is to
Summarize challenges experienced within customer service : Explain the methods of communication used to reach identified external stakeholders of the business. Summarize challenges experienced within customer service, or customer satisfaction as a result of virtual communication failures
Describe the scope and analyze how to control the scope : Define relevant terms that will be used throughout project. Describe the scope and analyze how to control the scope. Identify possible risks, constraints, and assumptions.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Build a code in preparation for creating a spell-checker

Write down a code in preparation for creating a spell-checker. For now don't worry about actually spell checking: Just write a program that can read in the dictionary word by word.

  Give us your insights on why packet switched networks are

give us your insights on why packet switched networks are the future of telecommunications? what applicationsuses will

  Pros and cons of each with a focus on it investments

Total Cost of Ownership (TCO) and 2) Return on Investment (ROI). Describe each of these approaches, state your preference, and analyze the pros and cons of each with a focus on IT investments

  What is the name generally given to that internal connector

What is the name generally given to that internal connector and give a typical example of what might connect to it.

  Suspecting the icmp flooding attack

In reviewing your firewall logs, you notice a large number of the ICMP echo requests coming from external host 63.10.100.4. You suspect an attempted ICMP flooding attack. How could you respond.

  Find cause of problems with the users'' personal computers

You are the first-level help desk technician at a medium-sized company. Your job is to handle the initial calls from company computer users with personal computer related problems.

  Calculate yield to maturity ytm and bond prices a

calculate yield to maturity ytm and bond prices. a continuous compounding convention for ytm calculations should be

  What would be the transmission rate

Supposed two TCP connections are present over some bottleneck link of rate R bps. Both connections have a huge file to send (in the same direction over the bottleneck link). The transmissions of the files start at the similar time. What is the tra..

  What are the elf magic numbers

What primitive operations exist to support the transfer of data to and from kernel space? Do you want to implement more on top of these?

  Write an int method named sum that accepts an integer array

Write an int method named sum that accepts an integer array , and the number of elements in the array and returns the sum of the elements of the array .

  What do you mean by addressable memory capacity

What do you mean by addressable memory capacity.

  Write down a 2- to 3-page paper which compares and

designing and coding a procedure module or object can be complex and time consuming. once these elements of a computer

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd