Parking Barrier

Is there a way to do the logic for a parking lot (similar to that one), with a down-counter instead of a SUB block?.

I wanna know if it's possible to use the same ACUMM variable for the up-counter and the down-counter, so that the down-counter substract 1 from the count whenever a car exits the parking lot.

Is that posible? or is the up/down-counter the only way?

I hope I made myself clear. I'll really appretiate some help. Thanks in advance.
 
The fist thing that comes to mind is to use the Add/Subtract or INC/DEC instructins to count the cars as they are coming and going. (no counter required).
 
Yeah, I've seen a few ways of doing this, both with INC/DEC (ADD/SUB) and with an up/down counter. My question is if it is possible to do this using only 1 up-counter and 1 down-counter, and not any other function block.

This might seems as a weird question, but I'm testing something here. Thanks for the reply anyway ;)
 
Luis,

There are endless ways to skin a rabbit. The bottom line is why your doing it..so you dont have to eat fur...

If you have a down counter available and it can be setup to reference the same accumulator as the up counter then the answer is yes. It all depends on what PLC if a PLC your working with. If your using a "smart relay" then maybe no...

What are you trying to accomplish, and what are you using to do it with?
 
Actually I'm doing a program that works as a PLC, and for now it has a limited set of instructions (no up/down counter, no math function blocks).

The thing is that the way it is designed, I can't find a way to do the parking lot logic the way I'm asking, because both counters cannot have only one variable in common (if they have the same ACCUM variable they will have the same others variables also).

The reason I'm asking this is to know if that's a flaw on my software, or if it's simply not posible. The logic of the instructions on my software is based on the IEC 61131 standard.
 
Luis,

I dont know of any programming language worthwhile that wount allow you to create or name spicific variables that you would use for this purpose. Somehow you should be able to reference a variable and use it exclusively to keep track of how many cars in the lot. If you cant do that then you have a very poor piece of sofware, or your overlooking something.

Now if you really need to do this with out using a counter or math, then you could create a counter circuit by using ALL relays. (I have done this with hardwired relays before) However you will need to use THREE coils per position. So if you wanted to track 10 cars it'll take 30 relay coils. For each position or count coil there will be another for stepping up, and another for stepping down. No timers involved... The rest is up to you. Work on it and post your code for further comments.

Good luck with it...
 
Well, maybe I'm not making myself very clear. It's hard to explain it this way.

The thing is that I designed the counters so their variables are strongly attached to the name given to the counter. Both counters in the logic can keep track of the variable storing the number of cars. But to do this, both counters must have the same name, and because of this, the same internal variables. So, when the up-counter gets to, lets say a preset of 20, and it sets the DONE bit to an ON state, down on the ladder the down-counter will reset the same bit back to OFF since its preset is for default 0. With the current software I can keep track of the number of cars, but I cannot set a limit for it (for example activating a light or whatever) because one counter will activate the output and the other will deactivate it.

I did it this way, not because I couldn't do it differently, but because I didn't foresee this issue. I just want to know if I should de-attach the internal variables of the counter from its name (i.e having the user setting the variables he wants for the counter).

BTW, Thanks for the replies, any feedback is valuable help.
 
Even an older thread came be educational. I guess before traffic lights it was parking barriers. Now this thread will show up on a traffic signal search, and be informative in one way or another.

Jocks Registered: 5/26/03

Last Post: 5/28/03

mnehez registered: 5/24/03

Last post: 5/27/03

Wonder if either still has anything to do with plc's?

If they do, then they visit this site regularly, probably under a new identity!

regards.....casey
 
LuisEn said:
The thing is that I designed the counters so their variables are strongly attached to the name given to the counter. Both counters in the logic can keep track of the variable storing the number of cars. But to do this, both counters must have the same name, and because of this, the same internal variables. So, when the up-counter gets to, lets say a preset of 20, and it sets the DONE bit to an ON state, down on the ladder the down-counter will reset the same bit back to OFF since its preset is for default 0. With the current software I can keep track of the number of cars, but I cannot set a limit for it (for example activating a light or whatever) because one counter will activate the output and the other will deactivate it.

This sort of answers you own question as to the need for an up/down counter. If you need to count UP, you use an UP counter. To count DOWN, you use a DOWN counter. If you need to count up AND down, you use (and therefore NEED) an UP/DOWN counter.

Of course, there are other ways to count.

beerchug

-Eric
 
Eric Nelson said:


This sort of answers you own question as to the need for an up/down counter. If you need to count UP, you use an UP counter. To count DOWN, you use a DOWN counter. If you need to count up AND down, you use (and therefore NEED) an UP/DOWN counter.

Of course, there are other ways to count.

beerchug

-Eric
So, would it be ok to leave the counters the way they are, and later implement the up/down counter for that kind of issues? (which is on the TODO list anyway)
 
Luis,

In the function block coutnters you created, you should be able to use the same variable for both coutners. This will essentially give you an up/down counter. If your really using an IEC 61131 compliant software then you should be able to do this. As I understand it YOU, the programmer can create your own function blocks. It's a hard way to go.. but that's the way it works.
 
Mike,

I think you're not getting it. I CAN use the same variable for both counters. The thing is if I use ONE of the variables for both counters, then ALL of the counter variables must be the same.

I have the following internal variables for counters: ACCUM, PRESET, ENABLE (not sure if this one will stay), DONE, RESET. If 2 counters have the same ACCUM, then both must have the same DONE, RESET, etc.

What I want to know is if this is ok, or if I have to let the user specify which variables he will set for the counter.
 
LuisEn said:
Mike,

I think you're not getting it. I CAN use the same variable for both counters. The thing is if I use ONE of the variables for both counters, then ALL of the counter variables must be the same.


Your use of the word "variable" is confusing. I think you really mean address, as in the case of C5:0 in Allen Bradley.

I have the following internal variables for counters: ACCUM, PRESET, ENABLE (not sure if this one will stay), DONE, RESET. If 2 counters have the same ACCUM, then both must have the same DONE, RESET, etc..

Yes...

What I want to know is if this is ok, or if I have to let the user specify which variables he will set for the counter.

Yes... not like you have a choice here...

Since YOU are the one who write the software, isn't this really a question for yourself? Afterall, we know nothing about your 'soft plc' <== that's what I'm assuming you are doing.
 
harryting said:


Since YOU are the one who write the software, isn't this really a question for yourself? Afterall, we know nothing about your 'soft plc' <== that's what I'm assuming you are doing.
Exactly, that's what I doing, a softPLC.

You got a good point there.The reason I'm asking this is because I really don't have much experience with the current PLCs on the field, and it's important for me to know if this behavior would be consider a flaw on the software or just a different way of doing things (or maybe it is the way to do things). This is an issue that just showed up, and having opinion of people with experience is always helpful. We have to do a presentation of the software this friday, and I wanna know possible weak points in the softPLC to be prepared. Thanks for all the replies.
 
Luis,

You dont have to use all the variables you've created. Just because thier there dosnt force you to use them. In this application the up and down counter will share the same accumulator. Another function block could compare the accumulated value with the parking lot limit or whatever fixed or varable you want.

I do get it, but I dont think I understand why you might think your so limited?? The whole idea here is that there are very few limits on what you can do..or create in the way of a function block or how it works. I use real PLCs because I dont have the time to write my own function blocks, and the instructions provided by Directsoft etc.. work well for me. Understand that what your doing is good for grad students and other egg heads (no offence ment), but isnt very popular in the real world....not yet anyway...

It's a good exercise, but when your boss comes down on you and gives you a deadline and budget...This isnt going to be the way to go.

Opps...I just started a whole new argument!!!

As new CPUs are introduced their instruction sets are growing and growing. All thoes fancy new instructions are function blocks built from the basic rudumentry set. That's what your doing. Your creating an instruction set. How these instructions work are entirely up to you.
 

Similar Topics

G
If anyone help me, I have to do a Ladder Program of a Parking Lot with a capacity of 20 cars. When a car drive in to the parking Lot a sensor...
Replies
2
Views
3,470
This is the reason why I signed up here and decided to get some help before I tackle the traffic light program on Wednesday. It looked good on...
Replies
17
Views
11,763
I have an assignment that I have to do with a PLC and a parking garage. The parking garage can fit 15 cars but the light has to be green up until...
Replies
5
Views
2,348
I am supposed to create a ladder diagram for a parking garage indicating a green light when there is parking space. Include counters so it can...
Replies
10
Views
5,047
I am in desperate need of help with this issue. So we are connecting a rack that was used, initially we connected all the devicenet devices and...
Replies
4
Views
2,825
Back
Top Bottom