From iLab Cookbook

Toolkits: WattsUpComponent


NOTE: THIS DOCUMENTATION AND THE CODE IS STILL BEING BUILT. USE AT YOUR OWN RISK, BUT FOR NOW WE SUGGEST YOU AVOID DOWNLOADING THIS.

The WattsUpComponent is a component that interfaces with the WattsUp Pro USB device, This device lets one plug in household things into it (e.g., lamps, fridges, powerbars with many things attached to it, etc.). It measures power use, and returns a variety of readings - the most importnat which is the # of watts being consumed. As a USB devices, one can set the WattsUp Pro to send this data to the computer.

This component is a wrapper around the WattsUp Pro API. In essence, one can set sampling rates and various other options, start sampling the device, and get various readings back as an event. It is implemented as a drag and drop component that allows the programmer to access various properties and events from the Visual Studio Properties window.

Contents



Download and Installation

The API

Properties affecting the sampling rate.

There are four interacting properties that determine how the component will raise events giving you the latest data reading. The InternalSamplingRate determines how often the WattsUpPro returns a sample to the component. The component will then use calculations over these samples to determine when it should raise an event to your program. Next, the SamplingRate is the minimum sampling rate that your program wants the component to return as an event; for example, if its set to (say) 5, it will raise an event every 5 seconds (this assumes that the SamplingRate is greater than the Internal SamplingRate). The WattsThreshold is a threshold where the component compares the current sample against the last sample raised as an event; if it differs by more than the threshold amout, then an event is raised regardless of the SamplingRate. One can turn this thresholding on or off by setting the UseWattsDelta boolean property.

For example, lets say InternalSamplingRate is 1 second, SamplingRate is 5 seconds, and UseWattsDelta is 5. lets also look at around 12 seconds of time. The component will read 12 samples in 12 seconds. The first reading will be raised as an event, and then (if the wattage has not changed by more than 5) the 6th reading and 11th reading. On the other hand, lets say you flipped on a lamp attached to the WattsUp at time 7. The increased wattage use will be more than a threshold, so you will likely get a new event at time 7, and maybe even time 8 as the wattage stabilizes. Thus you can play with these values to give yourself a high sampling rate, but to minimize event processing (and perhaps screen redraws) if there is no significant change detected between readings.

Other Properties

Methods

Events

wuData Class

Tutorials and Examples

Links

WattsUp Web Site

Retrieved from http://grouplab.cpsc.ucalgary.ca/cookbook/index.php/Toolkits/WattsUpComponent
Page last modified on June 18, 2008, at 10:42 PM