RSlogix - Simple 2 level Elevator with Subroutine

For the alarm, you might should do an interlock on each subroutine RET, so that the RET cannot be activated until the alarm output is OFF. Otherwise, if some sneaky instructor held his finger on the alarm button while your program exited any of the subroutines, the alarm output would get left ON (unless you have an alarm output copy in the Main and ALL subroutines so that the alarm output immediatley gets evaluated again with the alarm button now OFF).

Got it. Checked
 
I understand that. I remember as well the double-coil syndrome.
From reading your responses, possibly you do not realize that (unlike double coils in the Main ladder) it is okay to reuse the same coil or output in a subroutine IF you set up your logic to prevent unwanted consequences. For example, in your case when you only had 2 subroutines, Going Up and Going Down, the Open Door and Close Door outputs had to be used 2 times each. That worked okay IF you put in interlocks to insure that each of those outputs had done its job then was turned OFF again before exiting that subroutine. Otherwise it could get left ON, wrecking havoc in your program and causing it not to work correctly.

Where you have stacked subroutines as in the last version 27062013, it is difficult to avoid reusing an output, for example your elevator alarm output. Because you have to lock in the Open Door and Close Door subroutines to prevent exiting until they are finished, that means that if something goes wrong and someone presses the alarm button while the PLC is inside one of those subroutines, the alarm will not go off unless there is an output inside each subroutine (or you use an alarm flag in each subroutine and manage to set up your logic so it always returns to the Main on each scan, where you have only 1 version of the alarm output).

In the 19062013 version, and also in my LogixPro Elevator Student Exercise 4, I did return to the Main every scan where possible, so that the main ladder logic always called EACH subroutine. That was necessary for the LogixPro Elevator because a new floor request could come in at any time, unlike your stripped-down bare-bones 2-floor crippled version that only goes up then back down automatically in response to ONE 2nd-floor request.

EDIT: Further testing indicates that the alarm output in the 26062013 version only needs to be in the Main, Sub 5 and Sub 6. That is because the PLC scan actually returns from Subs 3 and 4 back to the Main each time when either of those two are called (unconditional returns for Subs 3 and 4).

EDIT 2: You don't really need the extra interlocks on Rung 000, Sub 5 (I forgot to remove them). The reason is that you only arive at that point because the elevator is on one floor or the other, so you don't have to check to see where it is. In other words, the Close Door subroutine should only be called when you are ready to close the door, not before, and not after. Therfore you do not have to do a double check to see which floor you are on. At that point, you have to be on the correct floor and the correct time to close the door, or the PLC would not be seeing the Close Door subroutine.
 
Last edited:
Corrections for Edits:

EDIT: Further testing indicates that the alarm output in the 27062013 version only needs to be 3 places in the Main, Sub 5, and Sub 6. That is because the PLC scan actually returns from Subs 3 and 4 back to the Main each time when either of those two are called (unconditional returns for Subs 3 and 4).

EDIT 2: You don't really need the extra interlocks on Rung 000, Sub 5 for the 27062013 version (I forgot to remove them). The reason is that in this version, the PLC scan only arrives at that point because the elevator is on one floor or the other, so you don't have to check to see where it is. In other words, the Close Door subroutine should only be called when you are ready to close the door, not before, and not after. Therfore you do not have to do a double check to see which floor you are on. At that point, you have to be on the correct floor and the correct time to close the door, or the PLC would not be seeing the Close Door subroutine. In the previous version, you did have to check the elevator position, because you did not have separate CLOSE and OPEN subroutines.

I mean the actual I/O that comes with this student elevator problem.
I think you could use the extra subroutines with that student problem, if you disregard the "auto return from the 2nd floor" instruction. In other words, it would stop at 2 and remain there until you pressed a "1" button either in the car or on the 2nd floor. In fact, set up properly, you should be able to press the "1" button as soon as the car moves off the 1st floor position switch. Then the car would go to 2, pause, open door, wait short period, close door, and return to 1 (only if the 1 button had been pressed at some point after the car left the 1st floor). I don't advise deleting the auto return without permission from your instructor.
 
Last edited:
I don't advise deleting the auto return without permission from your instructor.

The documentation doesn't mention anything about auto-return or WAIT on second floor action. It's omitted so I first did the easiest program design (auto-return).

if you disregard the "auto return from the 2nd floor" instruction. In other words, it would stop at 2 and remain there until you pressed a "1" button either in the car or on the 2nd floor. In fact, set up properly, you should be able to press the "1" button as soon as the car moves off the 1st floor position switch. Then the car would go to 2, pause, open door, wait short period, close door, and return to 1 (only if the 1 button had been pressed at some point after the car left the 1st floor).

I will add this to the program and post my new version.

Cheers.
 
OK Lancie, I got a new version to which I added the possibility for the car to wait at the 2nd floor. There is as well an attempt to flag a call using latch/unlatch B3.

I have 2 problems:

1. The CALL B3 flag unlatch too early and doesn't trigger the car to go up or down to wherever floor it is suppose to go after the first stop.

2. Subroutines don't seems to be interlocked properly as a result of these new modifications. The PLC scan seems to want to activated motor DOWN before the car got to the second floor and open the doors, and vice-versa.

How to you proceed to test this elevator program? I bought the LogixPro license. Is there a way to import this program in it and run a simulation?

Can you tell me a little bit more about your methodology for troubleshooting?
Several problem are often coming up at the same time, it makes it very difficult to isolate one of them if I don't not have a proper observation method.

Using I/O indicators in LogixPro maybe?
I do not have any PLC hardware for tests yet.

Much appreciated,
Cheers.
 
The documentation doesn't mention anything about auto-return or WAIT on second floor action. It's omitted so I first did the easiest program design (auto-return).
Then what does the statement below mean? Is that part of the instructions, or your interpretation of the instructions?
After closing, the elevator car goes back down and opens its door, waiting for the next user to press the internal car button.
Literally the above means that the car does an auto-return to the 1st level. If that is part of your assignment, then you are done. If not, you will eventually wind up with something that looks like my original subroutines!

One thing you will learn (the hard way) about this type of program is that it does not help at all to do an easy version, then try to convert that to the hard version. Usually that means completely rewriting most of the logic. Where you need two versions for an assignment, it is best to do the more complicated, more involved one FIRST, then just delete the stuff not needed for the simpler version. Oh well, live and learn, always the hard way!
 
Last edited:
1. The CALL B3 flag unlatch too early and doesn't trigger the car to go up or down to wherever floor it is suppose to go after the first stop.
Yes, it will not work correctly. The problem is right now you don't have any routine to seal in all the floor requests. That part is VERY IMPORTANT and I don't think you can make an elevator without it. The problem is that an elevator call pushbutton is only ON for about 1 or 2 seconds, but the elevator make take 60 or 120 or more to complete the action. The only way to save a button press is to use flag relays or similar to save those button presses until each one is completed. Back to Square 1!

Your current version (which I mistakenly thought was THE ASSIGNMENT) was only set up to do the crippled up-to-2-back-to-1 and nothing else. If I had known you were really trying to do the real thing, I sure would not have wasted all that time doing the crippled version (which cannot easily be converted to the real thing).

The question is, what to do now? Please tell me exactly what you are trying to do with the elevator.

Can you tell me a little bit more about your methodology for troubleshooting?
Where possible, I write a LogixPro simulaton program version, then test it using LogixPro to see if it works.

How to you proceed to test this elevator program? I bought the LogixPro license. Is there a way to import this program in it and run a simulation?
No, you cannot import a RSLogix RSS program directly, but you can type in a copy, and you can copy rung comment text from your RSLogix program directly to LogixPro. Because RSLogix is commercial software, it is not allowed to use the RSLogix machine language directly, but Rockwell did give permission to use the RSLogix Instruction Help file inside LogixPro.

What I do is open RSLogix in a reduced top window, and LogixPro in a bottom window. Then I make my LogixPro simulation look as close to the RSLogix program as possible, copying rung comments as needed, and added rung logic that uses similar memory addresses.

I have the LogixPro version of the elevator, which I think I put in the last ZIP file version. Yes, the 27062013 ZIP version in Post #40 has your complete Elevator 4-subroutine LogixPro RSL file, which you can upload to your computer, and open with your new LogixPro program. Just like the real RSLogix, you must open a ladder file, click the "Download to PLC" button, then "Go Online", then switch the simulated PLC to "RUN" mode.

Then (because your addresses and outputs do not match the LogixPro Elevator simulator), you must use the "I/O Simulator" and open and close the inputs yourself at the right time as the "elevator" outputs go on and off and the different subroutines are called. It requires a little practice to learn how to use the LogixPro I/O Simulator. First you must set the LogixPro I/O Simulator Input switches to match your real elevator switches and sensors (NO or NC, maintained-contact or momentary-contact). Right-click on each Input switch in the I/O simulator to cyle it through all the combinations. Notice that your Inputs in LogixPro start at PLC Slot 1, not at Slot 0 as in a MicroLogix PLC. (LogixPro is closest to an Allen Bradley model "SLC 5/02" PLC), although it simulates a mixture of SLC types.

For the Elevator 27062013 LogixPro I/O Simulator, you should have your inputs set like this:
I:1/0 = N.O pushbutton, momentary-contact
I:1/1 = N.O. switch, maintained-contact
I:1/2 = N.O. switch, maintained-contact
I:1/3 = N.O pushbutton, momentary-contact
I:1/4 = N.O. switch, maintained-contact
I:1/5 = N.O. switch, maintained-contact
I:1/6 = N.O pushbutton, momentary-contact
 
Last edited:
Quote Mitureg:
The documentation doesn't mention anything about auto-return or WAIT on second floor action. It's omitted so I first did the easiest program design (auto-return).

Question Lancie1: Then what does the statement below mean? Is that part of the instructions, or your interpretation of the instructions?

mitureg said:
After closing, the elevator car goes back down and opens its door, waiting for the next user to press the internal car button.

It's my interpretation, the choice I made considering the gap in the documentation for the return of the car. It is not explained. We have the documentation in a previous post of this thread.

The question is, what to do now? Please tell me exactly what you are trying to do with the elevator.

The button is pressed, door closes, goes up to second floor. If the call button is pressed another time during "going up" it is flagged, the elevator reach the second floor, doors open, then closes. Elevator go back down to the CALL and do the final going up for the call that was flagged, unlatching it. The Elevator waits at the second floor for the next call.

Note: This flagged call could be done the other way around (i.e.: While going down the call button is pressed at the second floor). The elevator could then wait at the first floor once the last trip is done for the call button flag to unlatch.

Cheers.
 
If the call button is pressed another time during "going up" it is flagged, the elevator reach the second floor, doors open, then closes.
That sort of summarizes your problems in a nutshell. To catch those calls while the elevator is moving for a PREVIOUS call, you need a routine that only looks for and saves calls. You do not have that routine.

At this point, it is time to go back and try to determine how it should have been done. I can only refer you back to Post #8. That would be a good place to start, if you have time to do it over.
Try to think about how a real elevator operates, and how you can divide up its functions. Then make a list of those functions. Then make each function into a subroutine. You can do all that, but you should eventually arrive as similar categories in the above picture, even though your elevator only has 2 floors.

I will try to help you out, and go back and figure out how to do it for a 2-floor uncrippled elevator with no funny business. I think my job will be simple: follow my own directions in Post #18!
 
Last edited:
What do you think of my last version ELEVATOR_V2_3K - 28062013 -.RSS, can it be patched or it should be started from scratch?

Cheers.
 
Start over, but not from scratch. Use the instructions in Post #18, and also adjust the addresses to match your assignment addresses.
 
I added the simulated encoder as subroutine 9. Now we will have a way to make the elevator move when it is activated. The other routines needed modififying to remove the top 2 floors, to convert from 4 floors to 2 floors. See attched LogixPro file.

Big important question: Do you HAVE to use the MicroLogix PLC memory addresses in your assignment? If not, we could use the Logix Elevator Simulator addresses, and use the actual LogixPro Elevator simulator to test your program. That would make testing a lot easier. The LogixPro Elevator Simulation set-up has all your I/O functions, except the Door Obstruction Input (where we could substitute the LogixPro Simulator STOP pushbutton I:1/0 for the Door Obstruction input) and the LogixPro Call pushbutton I:1/5 and bell O:2/5 for your alarm pushbutton and alarm output.

Even if you can't use it for your final version, it still would be a good test platform, with the appropriate address substitutions.
 
Last edited:
I changed the LogixPro Elevator standard program into a 2-floor elevator, with added simulated encoder at the end (Sub 9). Test it out yourself by loading into LogixPro and switcing to RUN mode. It works great (as long as you remember NOT to use any button above the 2nd floor)! Otherwise it will hang up, because it doesn't know now that there is anything up there! If it hangs up, you can go to PROGRAM mode and then select "Simulations, Reset Simulations".

Now all that is left is to make an RSLogix copy, and (1) convert the I/O addresses to your MicroLogix assignment addresses; and (2)add the encoder Subroutine 9 and encoder addresses, and use it to track the elevator in Sub 7.
 
Last edited:
I had to delete the test rungs from Sub 9, and also expand the LIM range for Floor 2 in Sub 7, to allow time for the elevator to stop on Floor 2 every time. For the first run after a switch from Program to Run, the door will open and close 2 times due to the Initialization. After that, it only opens and closes once for each run.
 
Last edited:
Here is RSLogix 28062013 version 4, a complete non-crippled 2-floor elevator with simulated encoder tracking, and I/O addresses that match your assignment. Adjust the "encoder" position numbers to adjust the amount of time the elevator needs to go from one level to the other.
 
Last edited:

Similar Topics

Good morning (EST), I am trying to implement the code below in on an S7-1200. It's barely half a dozen instructions, but I am stuck; I have not...
Replies
26
Views
5,694
Hello, I have a modicon background where there is a "Pulse" function that accepts an input for the deisred pulse time length. I effectively...
Replies
8
Views
2,061
Here is the rungs I have made for my school project: Basically I just press an associated Function Key (F1, F2, etc) on the PanelView to...
Replies
7
Views
1,861
I am learning Rslogix on my own when free time is available at home and have created several simple programs. My question now, is how to change...
Replies
4
Views
2,182
Hello everyone. I would like to thank anyone reading this post. I would appreciate any advice or thoughts on this program. I am a beginner. This...
Replies
28
Views
9,549
Back
Top Bottom