Skip to content

Software 1. Overview

David Albrecht edited this page Apr 14, 2023 · 5 revisions

This documentation is for software version 0.2.0 and earlier. Click here to see this page in the latest docs.

Modes of Operation

The software has several different modes of operation which are discussed below. You will be using each different mode during the project setup. There are four modes that the software can run in. Phase, debug, and terminal modes are intended to help you get setup. Regular mode is for use when you are finished calibrating and are ready to install the project in your electrical panel.

  • debug mode
  • phase mode
  • terminal mode
  • Regular mode

debug Mode

What it does: takes one set of 2000 samples per input channel, saves the raw data to a file on disk, builds an interactive plot of the raw data, measures the sampling speed, and prepares an HTML file containing the plot for you to inspect.

  • Saves data to database: No

How to use it: Launch power_monitor.py using the debug keyword followed by a chart title. Example:

python3 power_monitor.py debug "Initial Test"

The software will take 2000 samples from each CT input and the voltage channel, and plot them on a chart. A message will be printed to your terminal window when the chart has been created with a link to the Pi's onboard web server to view the plot. Visit the address from any device on your LAN to see the chart. The sampling speed in Kilo-samples per second (KSPS) will also be printed to the screen, and written to the HTML plot.

Why use it: This mode will plot the data from all CTs onto an interactive HTML plot. This is very helpful to ensure that your Pi is collecting samples that represent the type of load you are monitoring. You can also use this mode to take a quick snapshot of the harmonics on each channel. You can also use it to measure the sampling speed and benchmark your sampling rate.


phase Mode

What it does: Launches the interactive phase correction process.

  • Saves data to database: No

How to use it: Launch power_monitor.py using the phase keyword. Example:

$ python3 power_monitor.py phase

Read the prompts and follow the instructions.

Which CT number are you calibrating? Enter the number of the CT label [1 - 6], NOT the input channel that the CT is using: 1

#------------------------------------------------------------------------------#
# IMPORTANT: Make sure that current transformer ct1 is installed over          #
#            a purely resistive load and that the load is turned on            #
#            before continuing with the calibration!                           #
#------------------------------------------------------------------------------#

Continue? [y/yes/n/no]: y

Why use it: This is a critical part of the setup process. This step performs the phase correction procedure to find the optimal phase correction value for each input channel. It also provides a plot of the pre-corrected and post-corrected samples so you can visually observe the improvement in correcting for phase errors.


terminal Mode

What it does: runs the software like normal, but also prints all readings to the terminal window.

  • Saves data to database: Yes

How to use it: Launch power_monitor.py using the terminal keyword. Example:

python3 power_monitor.py terminal

Sample Output: (Note: Only CT1 is installed and reading data in my example below)

+---------+--------+----------+-------+-------+--------+-------+
|         |  CT1   |   CT2    |  CT3  |  CT4  |  CT5   |  CT6  |
+---------+--------+----------+-------+-------+--------+-------+
|  Watts  | -0.36  | 1807.642 | 0.305 | 0.883 |  -0.2  | 0.734 |
| Current | 0.121  |  14.765  | 0.113 | 0.221 | 0.115  | 0.111 |
|   P.F.  | -0.024 |   1.0    | 0.022 | 0.032 | -0.014 | 0.054 |
| Voltage | 122.18 |          |       |       |        |       |
+---------+--------+----------+-------+-------+--------+-------+

Why use it: This is helpful when you want to see data in real time in the terminal instead of in Grafana.


Regular Mode

What it does: runs the software as it is intended to be ran when setup is complete. Note that this is the default run method and you can also start/stop it via the service file with sudo systemctl start power-monitor.service

  • Saves data to database: Yes

How to use it: Launch power_monitor.py. Example:

python3 power_monitor.py