Real Elevators....
BDF,
I took a look at your program, and I would say it represents a very good guess as how a real elevator works. However.....
If you were to build a working model to simulate your elevator, you would find that your concept requires quite a bit of IO and much human intervention. So let me explain a few things..
Door operation:
There is only one door open/close circuit for all floors. All the door locks are wired in series, so there is only one input there. Also the door "unlocking" and opening/closing device (door operator) rides on the elevator car, (in the case of passenger elevators). As the car door opens a clutch mounted on the car door unlocks the landing door and pulls it open with the car door. The door operator requires Outputs from you program for Open & Close, and requires inputs for open limit, and close limit.
Positioning:
There usually a sensor box on top of the elevator car that would have 5 sensors: (Known as the Selector) They are UP Count, Down Count, UP level, Down Level, and Door zone. These sensors are used for all floors. And for the sake of this project (keeping it simple), they are prox switches operated by metal vanes mounted in the elevator shaft.
Selector operation.
UP Count: placed between floors activted when sensor passes it, incrementing UP/Down counter in program. (UP/Down counter keeps track of what floor your on). Also initates slowdown for next floor if a call is in for that floor.
Down Count: Same as above but in down direction.
UP Level: There is a single 6 inch vane at each floor level. The Up level sensor brings the car into final level at the floor. when the sensor come off the top of the vane the elevator stops, and the doors open.
Down Level: Same as UP Level, but works in down direction, and stops elevator as sensor comes off bottom of vane.
Door Zone: This sensor is placed vertically between the up and down level sensors and is active with the elevator at the floor level. this sensor allows the doors to open (safety issue)
Direction Prefrence:
There are two rungs in your direction prefrence circuit. Each rung will end with one relay called either CA for Call Above, or CB for Call Below. Actually for students this seems to be the biggest bridge to cross, but the concept is rather simple.
Your UP/Down position counter will activate position coils (1F, 2F, and 3F), by way of comparision contacts. N/C contacts from these coils will be placed in series will the latched call contacts to provide direction prefrence. Like so.
2C 2F 3F CB
--||--|/|--+--|/|-----|\|------(CA)
|
3C |
---||------+
Motion:
Once you have a direction prefrence, (CA or CB), the motion will be initated by a up or down, and high speed output. (for this example we will only work with two speeds in either direction). The Direction output will be active when the door closed limit and door lock inputs are active. Like so.
door lock door close limit CA DOWN UP
--||---------------||-------------||---|\|-------( )
If you can get these concepts togeather and working, the gory details of interfacing the door operation, motion, and direction prefrence etc.. should be more obivious and fall into place for you. Post any revisions and I'll be glad to help with them.
Have fun.
Mike