Watts Up Component

Toolkits.WattsUpComponent History

Hide minor edits - Show changes to output

June 18, 2008, at 10:42 PM by 24.64.87.10 -
Added line 31:
* '''NOTE: THIS DOCUMENTATION AND THE CODE IS STILL BEING BUILT. USE AT YOUR OWN RISK, BUT FOR NOW WE SUGGEST YOU AVOID DOWNLOADING THIS'''
Deleted line 33:
'''NOTE: THIS DOCUMENTATION AND THE CODE IS STILL BEING BUILT. USE AT YOUR OWN RISK, BUT FOR NOW WE SUGGEST YOU AVOID DOWNLOADING THIS.
June 18, 2008, at 10:41 PM by 24.64.87.10 -
Added line 33:
'''NOTE: THIS DOCUMENTATION AND THE CODE IS STILL BEING BUILT. USE AT YOUR OWN RISK, BUT FOR NOW WE SUGGEST YOU AVOID DOWNLOADING THIS.
June 18, 2008, at 10:41 PM by 24.64.87.10 -
Changed lines 11-12 from:
'''NOTE: THIS DOCUMENTATION IS STILL BEING BUILT. USE AT YOUR OWN RISK.'''
to:
'''NOTE: THIS DOCUMENTATION AND THE CODE IS STILL BEING BUILT. USE AT YOUR OWN RISK, BUT FOR NOW WE SUGGEST YOU AVOID DOWNLOADING THIS.'''
June 18, 2008, at 10:38 PM by 24.64.87.10 -
Changed line 10 from:
%rfloat% Attach:xxx.jpg
to:
%rfloat% Attach:WattsUpComponent.png
June 17, 2008, at 10:29 PM by 24.64.87.10 -
Added lines 11-12:
'''NOTE: THIS DOCUMENTATION IS STILL BEING BUILT. USE AT YOUR OWN RISK.'''
Deleted line 93:
* %newwin% [[http://grouplab.cpsc.ucalgary.ca/software/SDGT/Documentation/index.html | Documentation]]
June 17, 2008, at 10:28 PM by 24.64.87.10 -
Added lines 43-44:
* '''int myWatttsThreshold'''
** This threshold will be compared to the difference in watts between the current watt reading and the last watts reading raised as an event.
Changed lines 47-48 from:
* '''int myWatttsThreshold'''
** This threshold will be compared to the difference in watts between the current watt reading and the last watts reading raised as an event.
to:

!!!!Other Properties
* '''string myPort'''
** The COM Port that the WattsUp Pro is connected to. While the WattsUp is a USB device, it is configured to appear as a COM Serial Port. You just need to know which port it appears as.

!!!!Methods
* '''bool Start()'''
** Connect to the WattsUp and start recording. Returns true on success, else false
* '''bool Stop()'''
** Stop recording of data and disconnect from the WattsUp. Return true if successful.
* '''string GetReading()'''
** Read the Watts Up. Returns "" if no reading is available, or if cannot do it. Note that you shouldn't have to do this call as readings are raised as events. I just include it mostly for debugging
* '''string GetVersion()'''
** Get the version of WattsUp device. Returns "" if we can't get it. Note that you shouldn't have to do this call as readings are raised as events. I just include it mostly for debugging.

!!!!Events
* '''OnWuReading'''
** Event invoked whenever a new reading arrives from the WattsUp.
** The event handler has the form '''XX_OnWuReading(object sender, WuReadingEventArgs e)''' .
** More importantly, the '''e''' argument will have a property called '''e.wuData''' (see below) which gives access to all the data returned by the WattsUp Pro.

!!!!wuData Class
* '''DateTime Time'''
** the time of the reading
* '''double Watts'''
** the Watts reported
* '''string Record'''
** This is the actual raw data returned by the WattsUp Pro. Included here for debuggin.
June 17, 2008, at 10:16 PM by 24.64.87.10 -
Changed lines 35-43 from:
* '''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.
** '''int InternalSamplingRate'''
*** The interval in seconds that this class should internally sample the WattsUp Pro (between 1 and 3600). That is, if the InternalSamplingRate was set to (say) 1, the component configures the WattsUp Pro to return a new reading to the component every second.
** '''int SamplingRate'''
*** The interval in seconds that we should raise an event, where we return the most recent reading (between 1 and 3600).
** '''bool UseWattsDelta'''
*** Use thresholding if true, and don't
use it if false.
** '''int myWatttsThreshold'''
***
This threshold will be compared to the difference in watts between the current watt reading and the last watts reading raised as an event.
to:
!!!!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.
* '''int InternalSamplingRate'''
** The interval in seconds that this class should internally sample the WattsUp Pro (between 1 and 3600). That is, if the InternalSamplingRate was set to (say) 1, the component configures the WattsUp Pro to return a new reading to the component every second.
* '''int SamplingRate'''
** The interval in seconds that we should raise an event, where we return the most recent reading (between 1 and 3600).
* '''bool UseWattsDelta'''
** Use thresholding if true, and don't use it if false.
* '''int myWatttsThreshold'''

** This threshold will be compared to the difference in watts between the current watt reading and the last watts reading raised as an event.
June 17, 2008, at 10:09 PM by 24.64.87.10 -
Changed lines 34-36 from:
!!! Recipes and How-To's
* None yet
to:
!!! 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.
** '''int InternalSamplingRate'''
*** The interval in seconds that this class should internally sample the WattsUp Pro (between 1 and 3600). That is, if the InternalSamplingRate was set to (say) 1, the component configures the WattsUp Pro to return a new reading to the component every second.
** '''int SamplingRate'''
*** The interval in seconds that we should raise an event, where we return the most recent reading (between 1 and 3600).
** '''bool UseWattsDelta'''
*** Use thresholding if true, and don't use it if false.
** '''int myWatttsThreshold'''
*** This threshold will be compared to the difference in watts between the current watt reading and the last watts reading raised as an event.
June 17, 2008, at 09:48 PM by 24.64.87.10 -
Added lines 1-57:
%define=box padding-left=1em padding-right=1em margin='3px 3px 0'%
%define=yellowbox box bgcolor=#fdfaea border='1px solid #ffad80'%
%define=redbox box bgcolor=#fff3f3 border='1px solid #ffc9c9'%
%define=bluebox box bgcolor=#f4fbff border='1px solid #a1cae6'%
%define=skybox box bgcolor=#f8fcff border='1px solid #aaaaaa'%
%define=greybox box bgcolor=#fbfbfb border='1px solid #aaaaaa'%
%define=greenbox box bgcolor=#e6f3e5 border='1px solid #8fd586'%
%define=whitebox box bgcolor=#ffffff border='1px solid #999999'%
\\
%rfloat% Attach:xxx.jpg
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 | Download and Installation]]
* [[#recipes | Recipes, How-To's]]
* [[#tutorials | Tutorials and Examples]]
* [[#links | Links]]
\\
\\


[[#download]]
>>greenbox<<
!!! Download and Installation

* [[Attach:WattsUpComponent-1.0.zip|WattsUpComponent-1.0.zip]]. Download / unzip the WattsUp Component package (includes example).

>><<

[[#recipes]]
>>yellowbox<<
!!! Recipes and How-To's
* None yet

>><<


[[#tutorials]]
>>bluebox<<
!!! Tutorials and Examples

* None yet


>><<

[[#links]]
>>greybox<<
!!! Links
'''WattsUp Web Site'''
* %newwin% [[https://www.wattsupmeters.com/secure/products.php| The various versions of the Watts up? Meter that you can buy ]] (we use the Watts up? Pro)
* %newwin% [[http://grouplab.cpsc.ucalgary.ca/software/SDGT/Documentation/index.html | Documentation]]
* %newwin% [[https://www.wattsupmeters.com/secure/downloads/CommunicationsProtocol080520.pdf| Watts up? Communication Protocol]] - this is what I based my code on. Its a bit hard to understand some parts without explanation. Their support person was helpful in explaining some of it to me.

>><<