This design problem will be to design the controller for an elevator.
We will assume that is to to control elevators in buildings with up to
32 floors (including basements). You think you know how elevators work,
but do you really?
Suppose the elevator is on the 5th floor and someone pushes
buttons on the 2nd floor and on the 8th floor? Which
way will the elevator go? Other questions could be asked that might also
be hard to answer. So, here as a simple rule. An elevator changes direction
as seldom as possible. There is no technical problem with changing directions.
It is just a simple algorithm which yields relative good efficiency. This,
the answer to the above question would depend on which way the elevator
was going (or had been going).
Before we look at the details of this design, we need to consider some
plain old economic facts of life. Lets take a look at
what is on each floor and in the elevator car. With a 32 floor building
and with the controller either in the basement (hydraulic lift) or on the
roof (winch type), we would have a seven condictor cable leading from each
floor to the controller. If, for the sake of round numbers, we assume the
floors are 10 feet apart, we would need 310+300+290+ ... + 0 = 49,600
feet
of seven-conductor cable or 347,000 feet of wire. This much
wire
would be quite expensive. At a typical cost of 5 cents per
conductor foot, this would add up to $17,360! Silicon is much cheaper than
copper. This means
if, by putting a small piece of silicon (a PLD) at each floor, we can reduce
the amount of wire significantly, we can save money.
How can we do this? The first step at obtaining an answer is to consider
what the controller needs to know to run the elevator. Assume the elevator
is between floor I and I+1 and going up. An elevator is not supposed to
stop between floors so no change in control is needed until the elevator
nears floor I+1. Then, there are only two possible actions: (1) keep on
going, and (2) stop at that floor. Why should it stop? If someone in the
car wants off at that floor (i.e., they pushed the button in the car for
that floor) or someone standing at that floor wants to go to a higher floor.
If someone standing at that floor wants to go down, it should not stop
since we said the philosophy is that it should continue in the same direction.
The only time it would stop at that floor for someone going down is
if there were no need to go higher. That is, no one in the car pushed a
button for a higher floor and no one on a higher floor has pushed either
an up or a down button. All the elevator controller nneds to know then
are two things: (1) should it stop at that floor and (2) will it have to
continue going up?
If we design a controller for each floor, and it knows where the elevator car is currently at, it can send a signal to the main controller indicating the above two conditions. How does this save wire? If we use active low, open-collector signals, if any floor controller senses that the car should stop or continue, it can pull the appropriate line low, indicating that. If more than one floor controller senses it, the line still goes low. This means that all of the controllers may be wired in parallel and we need only one cable for the entire elevator shaft.
The floor controller is specified in a separate
document
The design of a controller for the elevator car will be left as an exercise.
It follows the dame sort of design and has the same interface signals to
the main controller. It is messy to design because of the large number
of buttons and lamps. The only difference with respect to the interface
is the presence of a START signal which is (somehow) produced when the
elevator is ready to start moving again (we won't worry about the doors!)
One problem we have to solve is, "Where's the elevator?" Inside the
elevator shaft we must mount some sort of switching
devices which will indicate where the car is. With this in place, the
block diagram of the entire system is as shown below.

It supplies the current floor number to all controllers. It supples
RUN, SLOW and BRAKE to the motor control. GOING_UP and GOING_DN are supplied
to both the motor controller and the other controllers.
We finally come to the design of the MAIN CONTROLLER.
With much of the control distributed in the floor controllers, the car
controller (not here described, but similar in nature to the floor controllers),
the main control is quite simple. Only the very smallest FLASH 370 series
CPLD's are needed.