Sign in to follow this  
Followers 0
Guest Matt Wakefield

DL05 Project - pulse counter & logger

18 posts in this topic

I'm new to PLC's, but I have a basic application to solve. The application is taking a "Pulse-signal" or dry contact from a utility meter (i.e. kyz output from electric meter) and storing it in the PLC every 15 minutes. Then, read the PLC periodically to download the historical 15 minute interval data via Modbus RTU protocol. I just ordered the $99 DL05, $99 software and Realtime clock/memory module. The price was so cheap, I figured this would be a good test scenario to learn from. Hopefully, the system I purchased can perform what I need it to do - does anyone have any insight on the DL05 capabilities and resources or assistance on how to perform the functionality I need? If nothing else, it will be a good setup to learn PLC programming. If found this site and www.plcs.net have some resources to learn from. Any others? Thanks in advance for any help you could provide. Sincerely, Matt Wakefield (mwakefield@wpsenergy.com) WPS Energy Services

Share this post


Link to post
Share on other sites
When I dive into a new PLC, I always like looking at some sample programs that someone else wrote. Here are some DL programs that other members have uploaded. http://forums.mrplc.com/index.php?act=Downl...&CODE=01&cat=27 The basics of PLCs are all the same no matter what brand. A nice little basics primer can be downloaded here: http://forums.mrplc.com/index.php?&act=Down...&CODE=02&id=277 If you REALLY want to crunch and learn, check out Hugh Jacks FREE PLC book: http://forums.mrplc.com/index.php?&act=Down...&CODE=02&id=156 Other than that, feel free to ask anything. We will all pitch in to help.

Share this post


Link to post
Share on other sites
Holy Cow...that book is HUGE! I don't think I'll get through it today , but it looks like an awesome resource. I did find another resource for PLC Direct code: PLCDirect Sample code I hope to get my new "toy" today and start playing. Thanks, Matt

Share this post


Link to post
Share on other sites
So basically you want to count the amount of pulses coming from say, a water meter for 15 minutes then detirmine the amount of flow over that period of time? Try to be a little more specific in the application and we can help you better. The DL05 is capable of doing most of the things that any other brand can. What are you planning to read this data into after it is recorded every 15 minutes?

Share this post


Link to post
Share on other sites
Sounds like a great project to learn PLCs. I think the AD manuals are really good. I'd start by downloading the 05 manual from their web site and start perusing their instruction set. There's a good section on Modbus with code examples.

Share this post


Link to post
Share on other sites
JNelson - you are correct in your assumptions about my project.. I'll try and be a little more specific and give you a few more details. I want the PLC to count pulses from an Electric meter (or water meter or gas meter). In this case electric demand is based on a 15 minute interval, so that's my goal. When I'm monitoring gas or water meters, I'm typically looking at an hourly interval. Ok, so what I want to do with the PLC is to be able to count pulses for 15 minutes and then store the data away in a holding register. Then the next 15 minutes in another holding register. Since there are 96 15 minute intervals in a day, I could store Sunday's data in holding registers 40000 through 40096, Monday's in 41000 through 41096 etc. and so on thru 46096. Then at the end of the week, do a FIFO and overwrite last Sundays data with the new data. I'm not sure if that's exactly how I want to store the data, but something along those lines. I will be reading the PLC with a product we developed called eMiner eMiner link. It is a product or internet appliance to web-enable process control systems, but primarily focused on the utility industry. The eMiner product has historical data storage capabilities, but I want to increase my reliability by storing the data as close to the source as possible (in the PLC). We currently have a solution using an Advantech ADAM 6051 Modbus/TCP compatible pulse counter, but if we lose network connectivity for more than 15 minutes, we lose the granularity of the actual demand for the individual 15 minute period. By storing data in the PLC, we could lose connectivity between the eMiner and the PLC for up to a week before we begin losing data. If you have any recommendations on how to do this, I would appreciate any advice you can provide. As I said, this is my first experience with PLC's. Timotheos - I did purchase the AD manual for the 05 PLC and I just receive the PLC and the manual etc this evening. - the fun begins, I've got the manual cracked open as I'm writing this. I'm impressed I already received feed back from this question. Thanks to all for responding. I look forward to continuing this discussion. -Matt

Share this post


Link to post
Share on other sites
Matt, The only other question I have is how many counts per minute are you going to get. This is important information and will determine if it will be easy or semi difficult. If the amount of pulses that are accumulated in a 15 minute period is under 9999 than this will make for a much easier project. One word of advise though, it would be much easier to store your data through a HMI/SCADA type package rather than trying to manipulate that much data in the plc. These types of packages have historical trending built in to them but are expensive and overkill for what you are doing. The other option is to use a DDE/OPC type package with something like Excell, this will be cheaper and is more customizable. This will however require more work on your part but is a much better way to do it. This is the way that I would do it ! Here is the link- http://web4.automationdirect.com/adc/Shopp...DE)/PC-KEPEBC-3 What you want to do is possible, but I am not sure worth the effort. The above link is the Ethernet version of the software. You would need to but the ecom card for the plc but you will be amazed at what you can do with it once you have it. Check it out, you can make flow charts, line diagrams, all kinds of good stuff. I personally do not think you are going to get any more reliablility out of storing your data in the plc vs the pc. If you set up the scripting in Excell correct and since you are on Ethernet you can store your data to a server, to your personal pc, whatever you want, any time you want. The sky is the limit once you are on Ethernet. Hope this helps

Share this post


Link to post
Share on other sites
JNeslon is correct It makes a large differance on how many pulses you are counting. I can tell you from lots of experiance that in the long run you will be better off storing a pc at the location if possible. PC's are cheap and connecting to them is easy. You can find some pritty small PC's now days. Let us know what the maximum count frequency is so that we can get some code flying and try and come up with a workable solution for you. Peace

Share this post


Link to post
Share on other sites
Just a quick note. The Up/Down Counter (UDC) uses a double word so it can go to 99999999.

Share this post


Link to post
Share on other sites
I could cascade counters too, but I was trying to keep it simple....

Share this post


Link to post
Share on other sites
Hi guys, The maximum number of counts I'm expecting is about 900 (1 pulse per second). We rarely receive pulses faster than 1 a second, but that is the number we try and shoot for because then, we can provide a reasonable calculation of "pseudo" real-time value based on the rate at which pulses are received. In regards to storing data in another PC, we already have that functionality in our eMiner product. ...On a side note, I would be curious to know what you guys think about this product (here's the cut-sheet). And, we are using ethernet to communicate the pulse counts with the ADAM 6051 (modbus/tcp pulse counter) - and we LOVE ethernet communications as well. We just don't have any local storage for reliability other than the counts incrementing - so we lose the individual intervals if the comm's are down over the 15 minute period. The cost of the ADAM 6051 is about $180 retail, so I'm trying to see if I can do this with an inexpensive PLC for about the same price and gain some added functionality. Some of the other things that we are doing is automatic load shedding based on peak demand and real-time price signals. Right now, our eMiner box is interfacing with customer's PLC's to communicate that data, but if we are already using a PLC, we have the capability to provide control for customers who don't have one. As far as my progress....well, it's going slow. The PLC programming is a little "different" than other programming I'm used to (VB & VB.Net, ASP etc), but my background is in Instrument and Controls - so that helps. Plus I'm trying to do my real job etc. so my progress has been pretty slow, but I'll keep chugging away. Thanks, -Matt

Share this post


Link to post
Share on other sites
cool, well I did a quick calc and 1hr = 7200 pulses that is at double the rate that you are using now ie 2 pulses per sec. what you may want to do is sort of a history thing, use one counter and then set up 2 shift reg 1 as a time stamp and one as the hourly count. Then set up a timer/counter combo to count 1 hr and use this to move the pulse counter and the time stamp into the shift reg and also reset the pulse counter. I am not really up to speed on the Direct line of PLC's but I have done something similar with an omron. by doing this you should be able to use 150 - 250 memory areas as data points and obviously the same amount for the time stamp. that way even if your network is down for a week or your computer crashes or hd failure whatever you will have a week of previous data and be able to be off line for a week without loosing anything. ps there are probably 10 good ways of doing this, this is just one that I thought up of. Peace Edited by KinK

Share this post


Link to post
Share on other sites
One more critical piece to the puzzle....I need to be able to synchronize the time on the PLC (I'm using the DO-01MC option card). If the intervals don't end at the correct time, this whole process is invalid. What I'm hoping to be able to do is be able to set the time via Modbus from my eMiner box. eMiner will have the correct time and it will be the time standard. I'm just starting to look at all the features of this PLC and from what I can tell, it should be doable, I just need to figure it all out. I hope to begin putting something together this weekend, maybe by then I'll have learned enough to begin writing some "working" code. -Matt

Share this post


Link to post
Share on other sites
Good Luck, as for the sync you should only have to do that once a day dont know how but I will see if I can find out.

Share this post


Link to post
Share on other sites
ok I looked at the manual and there is a memory card that has a settable date and time that you can use. Page 434 of the dl05 manual. Date time memory module. hmmm that sucks it does not have it onboard. and if you want the ethernet on there too you are screwed.... you could use the 06 which has it on board but for another $100

Share this post


Link to post
Share on other sites
Ok, Some (but not much) progress has been made. Here's the flow path of where I'm at with the program. 1) Each time the input changes state, increment the counter. Done! (My first PLC program is complete! ) 2) Check the time (I did purchase the optional memory / Date/time Card). If it is at minute 0, 15, 30, or 45, read the counter and put it in a memory location and reset the counter. Done! 2.a) When I put the counter value in a memory location, I haven't figured out how to put it in a different memory location each time without having 96 different rungs in my logic (one for each 15 minute period during the day) - there's got to be a better way . What I would like to do is have a set memory location for each 15 minute per day and repeat it for each day of the week (Sunday thru Saturday). For example, Sunday time 00:00 a specific memory location, Sunday 00:15, the next memory location, Sunday 00:30, another and so on. My logic in doing it this way is so when my eMiner box reads the PLC, it knows exactly where the data is coming from. I'm sure there are other ways of doing this - so don't hold back any comments or suggestions. The issue with my method is that I haven't found a way to dynamically increment a memory location - I'm not sure it can be done, so that's why I'm guessing there must be another way of doing this. A couple of other issues I will have to deal with: 1) Here's how I'm determining when I should read / reset the counter. Compare: If minute = 15 and second = 0, then read counter and reset. I do the same for each minute period (0, 15, 30, 45). What happens if several PLC scans occur during second 0? Will it reset and read each time. Is this an OK technique? Any recommendations on this? 2) Daylight savings time. There is a good example on Automation Direct's web-site. I can use that 3) I'm sure more issues to come..... -Matt

Share this post


Link to post
Share on other sites
Another way (and perhaps better) to store data that was mentioned previously may be to store the time/date stamp with each interval. And then just do a FIFO memory mapping. Then, when my eMiner box retrieves the data from the PLC, it will have the time stamp and the value and there will be no question as to what interval it was from. With my first solution, if the PLC was powered off for more than an interval (15 minutes), the interval from last week the same period would still be in the memory location and I wouldn't know it. I don't have an idea on how to do this, so I'll crack the books again and see if I can come up with some ideas. The way memory is handled is a little confusing to me, but there has got to be a way to do it, there's just got to . -Matt

Share this post


Link to post
Share on other sites
Matt, You have the right idea with the fifo, that is the way to do it. Read up on "pointers" you will understand once you read it. Once all of your data is in memory locations say v2000 through v2096, at the end of the 24 hour period, do a block transfer of data to a different memory location. Monday's data in v2000 to v2096 at 24hr move to v3000 to v3096 Tuesday's data in v2000 to v2096 at 24 hr move to v4000 to v4096 You get the idea? Or you could use indirect addressing (pointers) and a counter to indicate the day of week, which would correspond to a block of memory adresses. As far as keeping track of your 15 minute time period, I would just use a self resetting TON timer. Read up on timers. I don't see a need to use the real time clock module unless you need the date. I would not try to keep more than a week's worth of data in the plc. The "V" memory locations are retentative so if power is cycled you will not loose data. However, you will have issues with sycronizing your data then, that is where the clock module will come in.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0