Remove all inputs and complete rungs that have references to floors higher than 2.Hi, Lancie, do you have any guidelines on how to shorten this program to a minimum for 2 floors?
U2, Main Ladder:
These minimal rungs only call the subroutines as needed.
U3, Initialization Subroutine:
Each time you test your program, you should first reset the simulation using the selection in the simulations menu. This will ensure that elevator is back at the first floor and all the hardware is in its initial state. When you place your program into the run mode, U3 will be executed, and it is here where you should ensure that all flags etc are in their correct initial state. In particular, the "Do Next or Wait" flag should be latched true which will ensure that subroutine U7 (Next Request or Wait) will be actively scanned at this time.
U4, Catch Floor Requests:
This subroutine is where the logic that will detect, and react to the closure of the 4th floor wall switch should be placed. The lamp for this switch should be latched on, but this should only occur if the elevator is not already at the 4th floor. In later exercises, additional logic will be added for the other switches that can initiate a change in the elevator's location.
U5, Next Request or Wait:
This subroutine is where the decision to move the elevator will be made. The built-in lamps of the wall mounted switches may be used as a flag to initiate a move of the elevator car. For now it will only be necessary to monitor flag (lamp) O:2/11 and set the "Close and Go" flag in response. This in-turn invokes the "Close Door and Move" subroutine (U7) which will take care of getting the elevator underway.
U6, Close Door and Move:
In this subroutine, locate the logic to close the door, and then energize the motor to get the elevator underway. The desired direction is obvious in this case, but later you will most certainly require flags to indicate which direction to proceed in. Before exiting this subroutine, make sure that both the "Do Next or Wait" and the "Close and Go" flags are cleared (unlatched), and set the "Car is Moving" flag so that positioning of the car will be controlled.
U7, Track Car Movement:
Once the car is moving, this subroutine takes control, and is responsible for deciding where to stop the car. In this exercise, both the direction and destination are fixed (up, 4th floor), so you will only be required to determine when the car has reached the fourth floor. Once there, the car's location should be flagged by updating the appropriate floor indicator lamps, and the "Stop and Open" flag should be set (latched) which will in-turn invoke the "Stop and Open Door" subroutine. The car's vertical position can be determined by reading the motor's shaft encoder (I:5), and equating this reading to those you have gathered for the individual floors. It may take a little trial and error to initially gather these values, but the task can be made easier if you temporarily slow the LogixPro scan rate down somewhat.
U8, Stop and Open Door:
The first thing to do here is to stop the motor and reset (unlatch) the "Car is Moving" flag. You should also extinguish the built-in lamp of the wall mounted request switch. The floor indicator lamps above the door can be utilized to determine which lamp is to be extinguished. Lastly a small 2 second settling delay should be allowed for, followed by opening the door.
Do not worry about being too practical. None of the programs presented here could ever be used for a real-life elevator (no safety switches or emergency stop and other required controls).For this one I do not wish to push it to a practical program that could be used in a real life scenario (I'm running out of time).
I am sorry that you have learned the wrong function of subroutines, and how to incorrectly divide a program into subroutines. Dividing according to your instructions is the exact wrong approach. You should divide according to the major steps required to PERFORM those options. For 1 and 2 of your 3 options, the elevator functions will be exactly the same routine. However, dividing by your Option 1 and Option 2, you will end up with two ladder programs artifically squeezed into 2 parts, like a fat woman split into 2 different girdles.I decided to divide the program in subroutine according to these options (3).
You should divide according to the major steps required to PERFORM those options.
Really, these two would be only typical Going Up and Going Down functions, with most buttons crippled and the Going Down routine crippled so that it automatically returns to the first floor after door is closed automatically by a timer (instead of responding to the normal elevator button controls).
Then, when the doors have fully closed, there is another 3 second delay before the lift starts to move. Why? What for? doors have closed, lift knows it has to go somewhere else, so what is it waiting for!! beats me.
Yes, but that only requies 1 PLC scan, about 1 split second.Do I have to assume that the Call Button or Internal Button have to be held long enough to seal-in B3:0/0 (Going UP)?
If you do not include the "short pause" as required by your problem instructions for both going up and going down, then you have not met the specifications for the program, and should receive a lower grade for not following instructions. I have included that by using a Short Pause timer for each travel direction. No time was specifed for the "short pause", therefore you COULD set these timers to 1 x 0.01 seconds and still meet the intent of the instructions. Technically, the way this instruction is written, the short pause must occur BEFORE the doors start to open.I added an extra rung branch to bypass a delay "waiting to go down" before the door motor closes.
This is good training for the real world, where your customers will often require unreasonable and illogical items in your programs. If you want to get paid, you can include those items, or stand on your principles, leave them out, and go hungry!After a short pause, the elevator doors should open via OP2.
Due to safety concerns, there is a lot of double-checking going on during those times. Before the elevator can move, the brakes have to be released. But if they are released and the cables are too tight, or too slack to overcome the new weight in the elevator, then the elevator may jump, fall downward, or snap the cables. All are unpleasent experiences for the passengers. So the steps are: Doors close, motor takes up slack in cables until weight on brake latches is 0 (cables supporting total weight but brakes still not released). Then double checks are made on all systems to make sure the motor can raise or lower the elevator. Only then are the brakes released. This is to prevent nasty surprises (such as maybe the cables broke while the car was stopped and latched into the shaft, or the motor failed and cannot hold the weight once the brakes release).Then, when the doors have fully closed, there is another 3 second delay before the lift starts to move. Why? What for? doors have closed, lift knows it has to go somewhere else, so what is it waiting for!! beats me.