On modern elevators, relay technology has been replaced by PLC, because solid state
components are cheaper than relays. Besides, a PLC makes simple electrical connections and changes.
On old elevators, the direction of the car is controlled by selectors
fixed in the shaft, one at each floor. On modern elevators, there is a proximity switch,
mounted on the top of the car. When the elevator moves, that switch detects a string of magnets
placed in the shaft, then sends the signals to the PLC.
The pdf link below is a ladder logic of 4 floors and automatic door elevator, with leveling speed.
I simulated the program, but I didn't test it on a real elevator model. The car direction
is controlled by a count magnetic switch. On real elevators, there
are often more count switches, so the car stops with a better precision.
The limit switches at the ends of the shaft (S1-S2) are supposed to
reset the program once the CPU is energized. In that condition, none of the count merkers are activated,
then the CPU does not know the position of the elevator. Therefore, the direction instructions (rung 17 and 18)
would be both activated. For that reason, I used the timer T40.
This image is a simplified
diagram of the direction instructions. Note that two instructions within
the same rung are not allowed by S7 PLC software.