Panelpwr-log

From OLPC
Jump to navigation Jump to search

Purpose

panelpwr-log is a power logging script that is designed to measure how much power is provided to the XO via the external power jack. Its primary use is for logging and measuring the input power from a solar panel directly connected to the XO.

Usage

Setup

panelpwr-log records the timezone setting so the processing scripts can calculate the local time of day the data was sampled at. This makes it easier for logs from different timezones to be compared. Depending on if the build on the XO is customized the timezone setting may or may not match the local timezone. The timezone is set via the Sugar_Control_Panel#Available_options using the Date & Time control.

Execution

Copy panelpwr-log onto the XO. You can either run the program from the terminal app or from a VT console. It works as the olpc user so you don't have to be root. It also will run on secure laptops.

Make the program executable with 'chmod +x panelpwr-log' and then run it with ./panelpwr-log

When it runs it sets up the XO to go into a low power mode. A couple of messages are printed and then the display will go dark and the laptop will suspend. In this mode the laptop is only drawing .3W so almost all the power input will go into the battery and show up in the log. Its set to log every 5 minutes. When it logs the screen will briefly turn on for 5 seconds.

It creates a new log file every time you run it. Each file in unique so you can just run it over and over and then copy all the logs to a usb drive. The .csv log files are created in the current directory and start with 'pp-'

If you press a key the screen will turn on and it will wait for 5 seconds before going back to sleep. To exit just hit a key to wake it up and then press ctrl-c

Data Column Descriptions

panelpwr-log data is 7 columns which are mostly for the scripts that process the output. The key for the columns is:

<date_in_seconds>, <battery SOC>, <bat voltage>, <bat current>, <bat temp>, <accumulated current><status>, <Net mAh>, <net time in minutes>, <Vin>, < W per sample>

In the panelpwr-log context there are only 3 key columns. Those columns are <date_in_seconds>, <bat voltage>, and <accumulated current> or ACR. Time and voltage should be self explanatory. ACR is a measurement of the battery current over a period of time. Its reported in microamp-hours (uAh). Using these 3 values and any 2 sample points the avg power between those 2 points can be computed. Assuming 2 points P1 and P1 the computation is as follows:

Compute the average current

(ACR P2 - ACR P1) / (date_in_seconds P2 - date_in_seconds P1) 

Compute the average voltage

(bat voltage P2 + bat voltage P1) / 2

Then compute the average wattage by ave current * average voltage.

The last 4 columns are human readable. They make it easy to look at the file to see to see what is happening. However, the values are calculated using integer math in the bash shell so they are only estimates. The last 4 columns are

<Net mAh>, <net time in minutes>, <Vin>, < W per sample>

Net mAh
This is the net sum of the mAh from the start of the log until the current reading. Its just the difference in ACR adjusted to mA rather than uA.
Net time in minutes
Time in minutes from the start of the log. Default sample time is 300 seconds so this usually bumps by 5 each sample. Pressing a key will make it wake up early so its not always a multiple of 5.
Vin
This can be ignored.
W per sample
This is the diff in ACR over the diff in time at the midpoint of the battery voltages between the current and previous sample. Its a rough approx of the average battery power for that sample period. Its in mW although its not accurate to a mW.