new member,logixpro student

Hi guys.. I know this is an old thread and I don't mean to bump it..
However, I was thinking since this thread is about exercise 4 (Door moving), I was wondering if you guys can comment on my code.. Negative comments are welcome so that I can learn..
Honestly, I'm not so sure whether my method of doing rung 1,2,7 and 8 are right or not.. However, it does get the job done.. Thanks in advance for the comments..

Exercise 4.jpg
 

Attachments

  • Exercise 4.zip
    717 bytes · Views: 21
Looks like you achieved all the student exercise goals except the following two:

If the door is currently opening, pressing the Close Switch will immediately halt movement. Door movement will remain halted when the switch is released.

If the door is currently closing, pressing the Open Switch will immediately halt movement. Door movement will remain halted when the switch is released.

Your program reverses direction instead of stopping the door when the opposite-direction-of-travel buttton is pressed. Although that might be what you wanted, it is not what the specifications called for. If you write programs for a living, you will have to learn to give the customer what was asked for, not what you thought he needed.

Also, your program takes a fairly simple 6-rung program and adds 7 additional rungs in order to make it into a "state" machine. I often think the state-machine jarjon is a method that allows people who don't really understand how a machine works to still be able to write a program that will (eventually) make it run. The problem with the state machines method is that it is very difficult to correctly define all possible states. In you case you missed one - the state that allows the motor to stop when opposite-travel button is pushed. If you had instead thought about how it works, you might have found a simpler solution.

On rungs 1 and 5, each rung has one input and one output. You should understand that these rungs add very little value to the program. Everywhere that you used the outputs, you could have instead just used the original input and saved yourself some work and saved the next guy who has to trouble-shoot a problem some hassle in back-tracking and figuring out that these two outputs are dummies - they add nothing but confusion and are nice if you are getting paid by the number of rungs written (rarely the case in real life). If your instructor insists on the open and closed limit switches being called "states" then name them that, although for me it would only add to the chaos.
 
Last edited:
Looks like you achieved all the student exercise goals except the following two:

Your program reverses direction instead of stopping the door when the opposite-direction-of-travel buttton is pressed. Although that might be what you wanted, it is not what the specifications called for. If you write programs for a living, you will have to learn to give the customer what was asked for, not what you thought he needed.

Thanks for the comments..
I checked the coding again and I did do that 2 parts u mentioned above about opposite-direction-of-travel button..

Rung 1 & 2 is about stopping the motor when it is opening without closing it and Rung 7 & 8 is about stopping the motor when it is closing without opening it..

When the door is closing, pressing "Open Button" and holding it will stop the door. However the door will not open because "Latch Closing" is still HIGH.

One of the conditions for the "Opening State" is "Latch Closing" being LOW (Rung 0). "Latch Closing" will only be LOW at the release of "Open Button" (Rung 8)..

When "Open Button" is pressed the second time, then only the door will open..

The same thing also applies to the door opening..


As for Rungs 1 and 5 having only 1 output, those are the latches i used for only the above purposes. Because of that i decided to keep it separate and independent..


Honestly, when I was coding it, I didn't feel comfortable doing opposite-direction-of-travel part that way, but i didn't know of better way to do it.. Any idea on how I can make the code less confusing, easier to read and also easier to modify (as in minimal changes to get the job done)..?

Thanks..
 
Last edited:
What the Customer requested:
...pressing the Open Switch will immediately halt movement.
What you gave them:
When the door is closing, pressing "Open Button" and holding it will stop the door.
Holding the button in is not an option that the customer requested. You have to be aware of the specifications and meet them exactly. In this case it is just a student exercise, but in the real world, if the contract calls for a button press and you give them a push-and-hold, that would not be acceptable and would call for a program revision or a programmer firing, whichever comes first.

This is a classic case of "making a button do two or more different things, depending on the SITUATION." Ask yourself how a plain old pushbutton, an input of 1 bit, which has a value of either 0 or 1, can do more than one thing. The answer is that you have to somehow record WHEN the button is pushed. Was it pushed when the door was opening, or was it pressed when the door was closing? Was it pressed when the door was stopped? How could the PLC know? How many additional bits of information will it take for the PLC to know?
 
Last edited:
Ouch......
I've just realised what happened...
Really sorry Lancie1, I uploaded the wrong code... That code i uploaded is for Exercise 3. That code has only 9 rungs.

The image attached is for Excercise 4 and it has 13 rungs.. I will upload the correct Exercise 4 file later when I have time to do so and also attached a better quality image file..

Really really sorry for uploading the incorrect file..
Thanks..
 
Last edited:
To see the way I did it, click on the "Downloads" section at the top of your screen and look under "Allen Bradley", then download the file "LogixPro Door_Opener_EX_4". I think it was 6 rungs, using two flags (just like the instructions called for) "Going Up" and "Going Down"

http://www.plcs.net/downloads/index...ey&PHPSESSID=8baaed0a08ff3ae4f26316020202bc42

If you want to set it up as a state machine, it can be done with 12 rungs: 2 to set up 1-shot pushbuttons; 4 rungs to define the State Transitions Idle to Open, Open to Idle, Idle to Close, Close to Idle; 3 rungs for the 3 States Idle, Going Up, and Going Down, and 3 more rungs for the position indicators.
 
Last edited:
Finally, here is the correct exercise 4 which i was meant to upload the first time. Here is also a clearer image of the exercise..

I use the latch just for the transition from door opening/closing to stop. I did not tie any output to the latch because i read somewhere that it is not advisable to tie a latch to the output because if lets say there is a power failure while the door is moving, the latch will be HIGH. once the power is back on, the latch will still be HIGH and the door will be moving unexpectedly.. Because of that, i use the latch independently/seperated from the normal functioning of opening/closing the door and only limit it to transition.

Exercise 4.jpg
 

Attachments

  • Exercise 4.zip
    873 bytes · Views: 13

Similar Topics

Is there a way to use the FAL instruction to do +=2 instead of +=1? I have an array that is organized with alternating "data" and "flag" values...
Replies
5
Views
127
Square D had a group that wanted to develop PLC compatible power monitoring. They worked out of the Cedar Rapids circuit breaker plant - before...
Replies
0
Views
831
Hi! Omron CP1L. CX Programmer. How do I fix so that a CNTRX(548) remembers the count it had before a power failure? I need to know how many...
Replies
3
Views
1,401
Hello all new member here. Have upgraded to supporting member status as I will likely be her asking help quite often. My situation is I just last...
Replies
15
Views
4,124
New member here. I'm going to a site tomorrow for the first time to work on a GE Versamax CPU005. The fault light is on, so I need to get online...
Replies
8
Views
3,119
Back
Top Bottom