We spent 2 weeks on the elevator simulation program, I am very grateful to my partner Wang Chang classmate (blog address: http://www.cnblogs.com/naturewang/), in the process he gave me
a lot of help, no there's his Help and I think we're not It's easy to get this program finished.
Wang Chang classmate very careful, also very patient, in the process of writing a number of problems, he can be patient with me to solve, and also can carefully improve the program, in the process of writing procedures, we jointly conducted a demand analysis, analysis of the following:
Definition of the initial state of the elevator
(1) There are 21 floors of the building, a total of four elevators, two of which can serve all floors, the other two is a single double-decker elevator, numbering 1, 2, 3, 4, (2) No. 0 is the basement level, that is, our access is generally in 0 and 1th (underground and lobby). When designing a program, if the passenger chooses number No. 0, then when the passenger lifts the elevator, the elevator will automatically return to position 1th, facilitating the next wave of passengers, (3) 0 There are 23 buttons inside the elevator (only 13 buttons for a single double-deck elevator), including the opening, closing button and the buttons to reach each specific floor. ; There are two button up and down buttons on each floor of the elevator. According to the bottom of the elevator is the 0-storey only with the up button, the top and 20 floors only down button. (4) Elevators are numbered, there are floor restrictions, and there is an overweight alarm, (5) The elevator door completion time and to reach each level of the time set by the person.
Specific process
(1) The passenger presses the button up or down on a certain floor, and (2) when the passenger presses the down button on a certain floor, and the four elevators receive the command at the same time, the response of the passenger by controlling the operation of the corresponding elevator is made after the specific algorithm responds to the request. The elevator door is opened only when the reaction of the elevator conforms to the passenger's request; (3) when the condition is met, the elevator opens for the passengers, and after the passenger enters the elevator, it is necessary to judge whether the inside of the elevator is full, and if the overload pops up the warning, the passenger exits and waits. (5) The operation result of the elevator is the output result, the elevator door opens after reaching the floor.
Elevators in many cases will receive two or more than two requests, to enter the elevator more than one passenger, in order to reduce the waiting time for multiple requests, the system needs to be a priority for multiple requests to be judged. Each passenger is delivered to a designated floor according to priority, and when multiple passengers use the elevator, the system receives a request after receiving more than one request, the system compares the current first destination floor with the new request, and determines which request takes precedence based on the waiting time between requests to reduce the request. The priority request is updated to the new destination floor of the elevator, and if there are new cases in the middle, the same treatment will be done.
Since then, I am responsible for writing the algorithm, he is responsible for writing code, and then we co-debug the program, due to our limited level, so there is no design interface, although there are some shortcomings and shortcomings in the algorithm, and then improved, in the general thinking, he successfully wrote the elevator simulation program, After the debugging of the program encountered a number of errors, but after our efforts, also all resolved, the final program was written without errors, can be perfect to run.
This pair of tasks, I realized the importance of the team, teammates and teammates only more communication, more understanding, to form enough tacit understanding, to be able to complete the task together successfully, especially in the completion of large-scale software projects, the degree of tacit understanding between teammates more determined the success and failure of the project, so, Thanks again for the help my teammates have given me in designing the research program, and I hope to continue to work with you in the future.
Summary and experience of pair-pair operation