Skip to content

Phase Correction Procedure

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

This documentation is for software version 0.2.0 and earlier. This process is not required in v0.3.0 and later. v0.3.0 Instructions

Overview

Hopefully you've acquired the last 4 components in the list of component needs... An A/C clamp meter, a high power resistive load, and a light duty extension cord that you're willing to "destroy".

Also, having read through the previous section on phase correction theory will help you understand what's going on.

You must have a purely resistive load for this procedure. A power-hungry device that isn't purely resistive does not have the characteristics needed for this method of calibration.

Lastly, the procedure below outlines the process for a single current transformer. Here are some suggestions:

  • Your current transformers should already be labeled (CT1, CT2, ... CT6)
  • Calibrate a specific current transformer for a specific input channel. Don't use a single CT to calibrate every channel... at this level of precision, all CTs are unique!

This is a new experimental feature that I deployed in mid July 2020. If you have followed the steps below and experience an issue, please let me know by opening an issue or emailing me at github@dalbrecht.tech!

Procedure

  1. Take your light-duty extension cord and unplug it from the wall so that it is not energized. We are going to be SAFELY modifying it so that we can install the current transformer on it. The current transformer will not give a proper reading when the neutral or ground wires are going through the opening.

    I bought an extension cord that has all three wires already separately insulated - just glued together. This makes separating them as easy as pulling them apart.

    The extension cable should have 3 insulated wires inside it. The hot wire is usually the black one. If you don't see a black wire, you can use your A/C clamp meter to determine which wire carries the current to the load.

    Be careful not to nick any of the inner insulated wires. If you see bare wire on any of the individual wires, the cable can no longer safely be used. Use caution and make small incisions as necessary to ensure you don't damage any of the internal wires or their immediate insulation jackets.

    Once you get the wire separated, you should be able to just pull on the wire and continue separating it. You'll want to get enough of the hot wire separated so that you can make a few loops of just the hot wire. Here is my cable:

    Current Multiplication Example

    The loop on top contains only the hot wire. The loop on bottom contains the ground and neutral wires, which we aren't concerned with at all. Ensure that you create the loops in such a way that the electricity flows in the same direction while in the loop. This will have the effect of multiplying the reading from the current transformer.

  2. Install your CT over the hot wire loop. Don't try to force the CT to close - they can break easily. Try to get it over as many loops of the hot wire as you can, but again, don't push it.

  3. Plug the CT into the input that this CT will end up being permanently connected to. (It defeats the purpose to do the phase correction for a CT using input #1, and then later use the same CT on input #5 If a particular CT is phase corrected on input channel 1, then that CT should later be connected to input channel 1 during your final installation).

    As a reminder, the RJ-45 supports CTs 0-3, and the two 3.5mm jacks are for CT4 and CT5.

  4. Plug in your extension cable to the wall and connect your resistive load to it.

  5. In your Pi's terminal window, from the project directory, start the software in phase mode:

     cd ~/rpi_power_monitor    
     python3 rpi_power_monitor/power_monitor.py phase
    
  6. At the prompt, enter the number associated with the CT. Either 1, 2, 3, 4, 5, or 6.

  7. Turn on your resistive test load, and enter y or yes to begin the automatic calibration:

     #------------------------------------------------------------------------------#
     # 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]:
    
  8. If you see a message that says current transformer is installed backwards, simply unhook it from your wire loop and flip the CT so that the power flows in the opposite direction from the CT's perspective. Press enter when you've flipped the CT around. If your CT was placed correctly the first time around, the calibration will already be running. You'll see output like this:

     2020-07-13 10:02:54 : Please wait while I read ct4 and calculate the best PHASECAL value. This can take a few minutes, so please be patient.
     2020-07-13 10:03:45 : Wave 1/3 results:
     2020-07-13 10:03:45 :  Best PF: 0.9998892912129425 using phasecal: 1.1672070833098185
     2020-07-13 10:04:35 : Wave 2/3 results:
     2020-07-13 10:04:35 :  Best PF: 0.9998558973554496 using phasecal: 1.2585538711486512
     2020-07-13 10:05:26 : Wave 3/3 results:
     2020-07-13 10:05:26 :  Best PF: 0.9998556363199735 using phasecal: 1.258576147979076
     2020-07-13 10:05:26 : Please update the value for ct4 in ct_phase_correction in config.py with the following value: 1.22811237
     2020-07-13 10:05:26 : Please wait... building HTML plot...
     2020-07-13 10:05:33 : file written to ct4-phase-correction-result.html
    

    The software is trying to determine the proper phasecal value to use to get the power factor as close to 1.0 as possible.

    ATTENTION!

    If the software suggests a phasecal value higher than 1.x, don't proceed just yet. This implies you are having a sample rate problem. There is an issue in the latest Linux kernels dealing with sample rates over SPI. Please see the question titled "Why is my sample rate low?" in the FAQ to determine if your Pi is experiencing this issue, and how to fix it if so.

  9. Copy the value from the line Please update the value for ct4 in ct_phase_correction in config.py with the following value: and open up the file config.py in a text editor.

  10. Find the ct_phase_correction variable. Replace the value for the specific CT you just calibrated with the value you copied. Since I was calibrating CT4, I will replace the value next to ct4:

    ct_phase_correction = {
        'ct1' : 1.069606140,
        'ct2' : 1.3,
        'ct3' : 1.475,
        'ct4' : 1.775,
        'ct5' : 1.22811237,    # <----- This is the value that the phase configuration process suggested I use for CT4, so I am plugging it in here.
        'ct6' : 1.220857186171267,
    }
    
  11. Save config.py and repeat the process for your other current transformers.

    Note: You can view the visual results of the calibration in the report that is generated. In the output I pasted above in step 8, you'll see a line that says file written to ct4-phase-correction-result.html. Navigate to your Pi's IP address in a web browser to pull up this report. If you zoom in to a very close part of the wave, you should see that the "Phase corrected voltage wave" trace is closer to the current wave than the "Original voltage wave" is.

  1. When finished with the process for all CTs, you'll need to run the following to update the installed rpi_power_monitor module settings.

    cd ~/rpi_power_monitor
    pip install .