Lab 3

Model of elevator controller

 

 

During this lab you are going to design a model of elevator controller. The task is hard for one student, therefore it is recommended to do it in pair. Find the person with whom you can work effectively (you understand each other well, your working speed is approximately the same etc).

 

For this task you get “empty entity”- design interface elevator.vhd, which you need to fill with behavioral design of elevator controller. To test if your design is correct or not, ready simple testbench t_elevator.vhd is given for you.

 

Specification of elevator controller:

 

General block scheme of the task is given in the figure bellow:


 

 


The elevator controller design entity has 2 inputs: BUTTONS_IN and BUTTONS_OUT – each is of type bit_vector. The length of the vector equals to the number of floors in the building. The number of floors is specified as generic, therefore it is assigned a value only during the use of the component. These signals are constructed the way that every bit in vector represents button of the certain floor. BUTTONS_IN represents buttons inside the lift car. BUTTONS_OUT represents buttons outside the lift car on the floors near the lift doors. For example,

BUTTONS_IN<=”1000” denotes that the button for first floor is pressed inside the lift car (lift works for 4 floors).

BUTTONS_OUT<=”0101” denotes that buttons on the second and fourth floor are pressed.

Inputs must be pulses, what means that active only for some seconds and then back to null.

 

The elevator controller design entity has 4 outputs: DOORS_OPENED, DIR_UP, DIR_DN, MOTOR.

DOORS_OPENED is of type bit_vector with length equals to number of floors in the building. Every bit represents whether doors are opened on that particular floor (the bit is ‘1’) or closed (the bit is ‘0’). Doors can be opened only on one floor. For example,

DOORS_OPENED<=”0100” denotes that doors are opened on the second floor.

DIR_UP, DIR_DN are signals of type bit, which represent up/down indicators by showing whether elevator direction is up or down. Forbidden situation when DIR_UP is ’1’ and DIR_DN is ‘1’.

MOTOR is of type bit_vector with length 2. It represents the state of the motor at certain moment of time. It could be “00”-stop, “10”- goes up, “01” – goes down, “11” – forbidden.

 

Description of the behaviour:

 

According to the pressed buttons either in the lift car or outside it, elevator must go either up or down. Output MOTOR depicts the state of the elevator. There should be internal counter of floors. On the asked floor elevator must stop and open doors for 5 seconds, then close the doors. If more than one buttons are pressed (more than one floor are asked) then elevator must memorize where to stop and correspondingly stop on every asked floor. In case several floors are asked at the moment of time, the elevator should continue movement in the direction that it was previously. For example,

Current state of the elevator is STOP and it is on the first floor.

Inputs are BUTTONS_IN is “0010” and BUTTONS_OUT is “0001”,

The behavior is the following:

MOTOR=UP,

DIR_UP =’1’;

DIR_DN=’0’;

DOORS_OPENED=”0000”;

Internal counter should count from 1 to 3, then

MOTOR=STOP;

DOORS_OPENED=”0010”;

DIR_UP=’1’;

DIR_DN=’0’;

 after 5 seconds

MOTOR=UP;

DOORS_OPENED=”0000”;

DIR_UP=’1’;

DIR_DN=’0’;

Internal counter is at 4

MOTOR=STOP;

DOORS_OPENED=”0001”;

DIR_UP=’1’;

DIR_DN=’0’;

 after 5 seconds

MOTOR=STOP;

DOORS_OPENED=”0000”;

DIR_UP=’0’;

DIR_DN=’0’;

 

Task:

 

Write the behavioral model of elevator according to given specification. Simulate your design in order to get right behavior of the elevator. Try to optimize your design. The beautiful effective solution would be evaluated with extra plus, which gives you an advantage at the exam (it is possible to write pure behavior of the elevator with 30 lines of code).

Clue: you may describe all the behavior in one process; activate the process for example every 1 second.

 

Requirements:

·       Code with comments added to the report;

·       Waveform picture added to the report;

·       Description of the solution;

 

 

Questions:

 

 

Possible solution on waveform:

 

run 160 sec