Posted 8 Nov 2012 I have a program project of an small elevator, the problem I have is how could I keep the sequence in which the elevator is called to certain floor while is going to another floor. What i want is something like if the elevator is going to the 4th floor and is going up or down and somebody calls for the elvator back down to the first floor, how do I keep those commands on afile and be executed accordinly. Share this post Link to post Share on other sites
Posted 8 Nov 2012 (edited) Step away from the ladder for a moment and start to define your project. From your references I'll assume a 4 floor elevator. (And a student project I assume.) There are three sets of items which will need seperate bits assigned to them. One set are the states of movement or position of the car. It could be STOPPED AT floor 1, 2, 3 or 4 (these will need expanding later) It could be MOVING 1 ->2, 2 -> 3, 3 ->4 4 -> 3, 3 -> 2, 2 -> 1 It can only be at ONE of these states at a time. Draw the 'Stopped At' states as circles and label them. Now draw the 'Moving' states as circles between the 'Stopped At' states. Another set of items are the 'Call Buttons' You have Floor 1 up (obviously), Floor 2 Up, Floor 2 Down, Floor 3 Up, Floor 3 Down, Floor 4 Down A final set of items (and this will be simplified) are the 'At Floor X' sensors. (Usually there would be two for each direction of movement but we'll start simply) The 'Call Buttons' and the 'At Floor' sensors are the reasons that transitions are made from one of the previously named circles to another. Here's an example: The state (circle) is 'Stopped At Floor 1' The triggering reasons are 'Any Button above Floor 1 is Pressed'. The state changes to 'MOVING 1 -> 2" Your assignment at this point is to see if you can fill in the other transition states. You may find a reason for a need to expanded the 'Stopped At Floor x' states. This is aa LOT of work but it will eventually make writing the ladder much easier. [Edit] Sorry, you'll need the buttons inside the car also. One for each floor. Those become triggers also. Edited 8 Nov 2012 by b_carlton 1 person likes this Share this post Link to post Share on other sites