Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Windmills : Working out Watt Hours
Author | Message | ||||
Gizmo Admin Group Joined: 05/06/2004 Location: AustraliaPosts: 5078 |
I want to add a Watt Hours display to the PicLog software. But not sure which way i should go about this. I know if the windmill made 10 watts for 1 hour ( or 5 watts for 2 hours ), it made 10 watt hours, how should I calculate a watt hour figure for something that varies so much. If the PicLog recorded every 60 seconds, and the values jumped around between 0 to 25 watts, how would I work out watt hours for that hour, or day? Would I add all the recordings for the day, then divide that by the number of recordings in the loggin period ( 3600 for a full day ) then multiply that by 60 to get our full hour? I think I'm off the track a bit here. Glenn The best time to plant a tree was twenty years ago, the second best time is right now. JAQ |
||||
RossW Guru Joined: 25/02/2006 Location: AustraliaPosts: 495 |
Glenn, watts are an instantaneous measure, expressed conveniently in units like watt-hour, kilowatt-hour etc, but absolutely just as reasonable in watt-seconds. I built a controller some years ago that did exactly that - measured instantaneous power every second and accumulated to provide: total watt-hours in total watt-hours out nett watt-hours (in-out) If you add the watts every second, then divide the answer by 3600 (seconds in an hour) you get watt-hours. If you only take a measurement every minute, you're going to be moderately inaccurate - but it might be good enough for the purposes. The more samples you take, the closer you will be to the actual value. (I believe some of the NiMH "smart packs" have an 8 MIPS processor and sample power in and out at least 1000 times a second) Oh, and if you are logging every minute, there are only 1,440 minutes in a day (86,400 seconds), not 3600. (That's how many seconds in an hour) RossW |
||||
Xcat Newbie Joined: 13/07/2006 Location: AustraliaPosts: 6 |
Gizmo, I haven't looked at your PICLOG so I will just write in terms of algorithms. I am presuming you are calculating watts by sampling voltage and current and multiplying the corresponding samples. After that establishing the quantum of watt-hours simply becomes an integration exercise. In the digital world there is a trade-off between accuracy and sampling frequency. The main issue that affects this trade-off is inertia of the system being sampled. Basically this is the rate of change of the system output. If the rate of change is low then the sampling frequency can be lengthened without the risk of missing a change in the output. In your example you have set the sampling frequency at 60 seconds. This may be too long (gut feel) for a windmill in gusty conditions. My feeling is that 15 seconds may be nearer the mark for inertia of such a system. So in pseudo code, try this: Inner loop (sample frequency 15 seconds) get volts (from ADC channel) get amps (from ADC channel) watts = volts * amps * 15 add to watt-hour accumulator hour timer flag set? go to outer loop wait for the next 15 second tick (or do something else by returning from interupt service routine Go to Inner loop outer loop (executed once per hour) reset hour timer flag reset seconds time flag store watt-hour accumulator in log_array{1} +1 store time_stamp in log_array{2} +1 (assumes presence of real time clock) increment log_array index counter inner loop time flag set? go to inner loop wait until inner loop need to start or do something else This should end up with an array log of watt hours that you can download or spit out to something else as needed. Using a real-time clock to trigger a couple of interrupt service routines will leave a good chunk of computing power to do other things in the meantime. HTH Xcat Brisbane QZ |
||||
Gizmo Admin Group Joined: 05/06/2004 Location: AustraliaPosts: 5078 |
Thanks for that guys, I now know exactly what I need to do. I will post an update on the Piclog this weekend with the updated software. Thanks again. Glenn The best time to plant a tree was twenty years ago, the second best time is right now. JAQ |
||||
Print this page |