Sizing a Battery Backup (aka UPS)

I live in the Seattle area, apparently we get a nice windy storm around every Thanksgiving… sure to form, we lost power for a nice long 24 hours starting 11/17/2015… so i finally ordered a low end generator… and then i started wondering about UPS for continuity during the brownouts when lights flicker around these times

Power Requirements

  • nice reference
  • Typical UPS units will be rated in VA (Volt-Amps) aka Apparent Power … and possibly in Watts aka Real Power as well
  • The difference between these two comes from concept called Power Factor… PF = Real / Apparent…the gist to remember is:
    • a “purely resistive” load like an old school incandescent light bulb will have a PF = 1 where VA and Watts are equal
    • whereas “raw” electronic loads (aka RC circuits), like computers, tend to have a PF < 1 yielding Watts < VA… apparently the culprit is inductance vs capacitance
  • the Wikipedia shows the technical physics behind this are that the Voltage sine wave and Amperage sign wave are pulled out of phase by RC circuits… power is wasted when the waves aren’t aligned…
  • a PF < 1 means you are wasting some power… it is not ideally efficient… i.e. your electric bill is higher than it has to be … perhaps an inconsequential amount

  • Ideally your UPS will be rated for both their VA & Watts capacity but if only VA, then it is common to expect a UPS to handle Watts at 60% of it’s VA rating … i.e. 1000VA UPS should support 600Watts

  • So now you need to know your power requirements… there’s a couple ways to go about this:
    1. take your PSU at face value… but how did you size your PSU in the first place… to be honest I just threw a dart when i went shopping
    2. add up your components’ ratings
    3. buy a cheap (~$20) device to measure actuals - this option is cheap, satisfyingly definitive and it’s a nice bonus to go measure everything else in your house …
      • turns out my admittedly very non-gamer rig never went above 335VA (304 Watts, PF = 0.91) with maxed CPU and Gfx (Corsair HX750i PSU, Haswell-E 6 Core 5820k, Nvidia GTX 750Ti , 30” & 24” displays, USB speaker, USB mini network switch)
      • 300 VA just CPU maxed, no Gfx
      • 215 VA fairly idle
      • 144 VA remove 30” display
      • 75 VA remove 24” display
  • Now working back from those numbers into a UPS means I not only need at least 335VA but I also need to watch out for 304 Watts… i CAN NOT simply go after a 335VA UPS since that would only support 201 Watts (335 * 0.6) … and we see this in typical UPS specs - notice the 650VA/390Watts - … to put another way, since my PSU puts my overall PF near to 1 vs 0.6, PSU Watts are going to be the critical dimension to go after… to work back to a UPS VA that would support 304 Watts => VA * 0.6 = 304 Watts, VA = 304/0.6 = 506… so at minimum I am looking for 560VA/304Watts

Secondary Considerations

  • I’m an Amazon junkie, I typically check off Amazon prime and then scan similar products for a high number of positive reviews… in the consumer UPS space (+/- $100 range) it’s really a matter of CyberPower vs APC… The APC BE550G is the obvious best rated at 4.5 stars 3218 reviews…
  • Generator Compatibility!
  • AVR - Automatic Voltage Regulation - like all marketing, it sounds good… smooth out your voltages in brownouts, but I couldn’t find enough concrete evidence to say whether it was significant
  • Replaceable battery - the APS and CyberPowers both appear to be readily servicable
  • Info Display - I’m kind of a sucker for the LCD
  • Software - it’s tough to find specifics on the APC & CyberPower software beyond turning off the beep and setting up automatic shutdown… i was somewhat interested in something that would actually log power consumption over time to give me some “Kill A Watt” style info… since the software does show Watts it seems feasible to think i could reverse gen the USB info and record it (like i’ll actually get around to that ;)
    • Apparently CyberPower is Mac & Linux compatible whereas APC is Windows only
  • Leaning towards CyberPower CP600LCD = $65 @ 2015-11-23

Active Power Factor Correction (APFC)

  • the PF < 1 waste drives marketing of modern PC PSUs to trend towards Active Power Factor Correction (Active PFC) which means the PSU corrects the raw electronic load back to a PF = 1… and can thereby boast higher efficiency, which sells
  • through a fun combination of physical constraints, the kind of electric equipment humans could readily produce and politics at the outset of power distribution, we settled on high voltage AC and the large investments required have kept it that way…
  • further, current is most readily generated by rotating mechanisms which lead to a smooth “harmonic” curve of voltage highs and lows over time, i.e. the oft referred sine wave… hence our electric grid was founded on smooth sine wave current
  • and it’s therefore understandable that cost effective electric equipment would actually depend on a smooth sine… and apparently some Active PFC PSU’s implementations are indeed sensitive to having a pure sine wave input…
  • however it is also cost effective for UPS’s to convert their DC battery source into AC via electronic approximations that created a “stepped” wave vs the smooth sine from an inherently analog rotational AC source… this stepped sine is what dominates the consumer end UPS space…
  • the main downside of this potential conflict is that the fail-over from wall to UPS battery during a power outage may still cause a PC power cycle…
  • Nevertheless based on my quick reading, we should generally rely on contemporary hardware to be compatible and the only way to really know for sure is to find a published test or test it yourself… the simple test is to unplug the UPS and see if you get a reboot or not :)

Transcode (iPhone MOV to MP4, HandBrake, PowerShell)

Script features:

  • Handles multiple files at once.
  • Applies rotation where necessary.
  • Touches new file to be same as original.

Leverages 3rd party tools:

  • FileMenu Tools - handy for creating a FileExplorer right mouse context menu for executing transcode on selected files
  • HandBrake - read something that suggested HandBrake is faster than ffmpeg and that appears true on my quick comparison
  • MediaInfo - pulls the EXIF metadata to determine if any rotation is necessary


  1. save transcode.ps1 below into a known location
  2. install FileMenu Tools and disable all the commands you don’t want. Configure a “transcode” command as shown in screenshot (editing your ps1 file path appropriately)
  3. install HandBrake and put HandBrakeCli in your path
  4. minimally, put MediaInfo.exe and MediaInfo.dll in your path


$args | % {

    $rotation = (mediainfo "$_" | Select-String -Pattern "Rotation +: ([0-9]+)")

    if ($rotation) { 
        $rotate = "--rotate" #180 degree rotate
        if ($rotation.Matches[0].Groups[1] -eq "90") { $rotate = "--rotate=4" } #90 degree rotate

    $newFile = "$([System.IO.Path]::GetFileNameWithoutExtension($_)).mp4"
    handbrakecli -e x264 -q 26 $rotate -i "$_" -o "$newFile"
    touch -r "$_" "$newFile"

    $rotate = ""

#write-host "press any key to finish and close"
#$x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")

Example UI

enter image description here

FileMenu Tools Config

enter image description here

Chrome User Script - Whack page elements based on jQuery seletors

// ==UserScript==
// @name AdBlock Hack
// @match*
// ==/UserScript==

function addJQuery(callback) {
  var script = document.createElement("script");
  script.setAttribute("src", "");
  script.addEventListener('load', function() {
    var script = document.createElement("script");
    script.textContent = "(" + callback.toString() + ")();";
  }, false);

function main() {
  $("span:contains('Adblock is enabled')").remove();

// load jQuery and execute the main function
enter image description here
enter image description here

Bash script - loop over inline list of files



# read args:
# -r = disable backslash escaping
# -d '' = read the whole here-doc as one big input vs stopping stopping at the first new line as the default delimiter
# -a = put the results into an array
#the minus in "<<-" provides for indenting the here-doc lines, but with TABS ONLY
#bash4 is way easier but wanted to be portable: readarray -t arr <<-"EOT"
IFS=$'\n' read -r -d '' -a arr <<-'EOF'

#echo ${#arr[*]}

# disable default space delimiter
for filePath in ${arr[*]}
  stat "${filePath}"

unset IFS

2015Q1 Haswell-E X99 Build

Mobo: Gigabyte GA-X99-UD4 - LGA 2011-v3

CPU: Intel i7-5820k - 6 core Haswell-E

Cooler: Corsair H80i GT

PSU: Corsair HX750i

RAM: Crucial 32GB (4 x 8GB) Ballistix Sport (DDR4 PC4-19200 2400 MHz, 16-16-16 CAS)

CaseCooler Master Storm Scout 2 Advanced - love that rubber top handle! :)


Video: Asus Strix Nvidia GeForce GTX 750Ti 2GB ... this card is a perfect fit in my book:
  • No drivers necessary to vanilla boot into Yosemite - no QE/CI out of box but very workable for initial install and then full QE/CI via Nvidia "webdriver".
  • fanless unless pushed hard
  • 3 x digital display, INCLUDING DP - I can confirm this card supports at least dual monitors under Yosemite via any combination of DP / HDMI / DVI (dual- link) with any of them driving 2560 x 1600 res... I've seen mention of possible 4k support on this card and can't wait to confirm that myself :)
  • no more horsepower than I care to pay for => $160 at the time ... and was well stocked in major outlets circa March 2015
PC Hound build pricing
($1,675.26 pre-tax from Amazon on 2015-03-11)

Biggest gripe - the Corsair Link software is total junk... super flaky...all kinds of known issues installing on Win8 and above... even with the hacks in place, only some rare reboots would yield working gauges... looks like USB device initialization timing bugs... sounds neat at face value but the unreliable drivers ruin the whole experience... there are open source alternatives brewing... guess there's a new build up for Win10, we'll see how that goes.

2015-09-03 Update: Spooky! Machine was just totally dead this morning, no power up at all ... jiggled the usual stuff, manually shunted the mobo power-on pins, re-seated ram, nothing... was expecting dead PSU but it checked out fine on voltmeter... and test button on PSU revved up the fans just fine... so next i started figuring dead mobo and was basically giving up ... then the big guy nudged a thought into my sad mind, "try the paperclip trick"... so i shunted pins 15 & 16 on the back of the 24pin header (while PSU connected to mobo) and sure enough it all powered right up <whew>... after that the case power button was working normally again as well... no other changes...

very interesting behavior ... really grasping to place blame anywhere particular  ???

i shudder to think of the time and effort i could have easily wasted swapping out working components chasing this ghost

we did have a power outage here a couple days ago but the machine had been running fine since then; even going in and out of sleep mode so it's hard to think there would be something "lingering"... yet there i was

Installing Windows in UEFI Mode

For motherboard: Gigabyte GA-X99-UD4

Booting Windows in UEFI mode offers a couple mild advantages:
  1. it's more compatible with Clover if you're booting OSX this way already
  2. it's supposed to be the fastest way to boot
Notes / Lessons Learned:
  • Rufus flash usb boot tool - wound up going with mbr and uefi-csm - not the normal recommendation
  • bios settings
    • fast boot didn’t seem to matter
    • legacy usb worked in disabled mode
    • worked with “other OS” selected
    • machine would not display bios after reboot whenever i disabled CSM (even though that's what most UEFI guides recommendation)
  • what really seemed to matter was putting the usb stick in a certain USB port! i used the chassis USB header with 2 USB3 and 2 USB2… going from left to right it was the second USB3 port that worked and the left most one never would
  • Lesson Learned - Disconnect all other drives than the one installing to
    1. existing windows drives get targeted for reusing their boot partition to install the bootloader files and wouldn’t create all 4 "ideal" GPT UEFI partitions on my clean drive (Recovery, System, MSR, Primary)
    2. having my mac clover drive connected during these attempts allowed the setup utility to put the windows bootloader on that drive and ruin that clover boot…
      • reinstalling clover via vmware osx guest DID NOT put the UEFI clover bootloader back in charge!
      • had to delete/rename \efi\windows folder and then the old EFI option started showing back up on the “BBS” “F12” boot choice menu
  • to confirm you’re really booted into UEFI mode:
    • from “WinPE” environment:
      • shift F10 to open command window
      • wpeutil UpdateBootInfo
      • reg query HKLM\System\CurrentControlSet\Control /v PEFirmwareType
      • 0x1 = legacy, 0x2 = uefi
    • from real windows:
      • msinfo32
      • look for “BIOS Mode” under System Summary

Code Readability = "Art"

The following quote by Bill Atkinson has been posed many ways by other clever folks and continues to resonate with me ... it's comforting that someone more cultured than i will ever be, considers this "art"... i naturally lean towards loving the code like one would take care with a fine wood piece, which does follow to the idea of a craftsman or artisan.

... I’m a firm believer that the best way to prevent bugs is to make it so that you can read through the code and understand exactly what it’s doing ...
--Bill Atkinson

It's pleasing this ties back to the computer era I came up in, the mid 80's, when i was first imprinted with the wide eyed sense of wonder that software offers... when these OG's were right there building the first versions of the contemporary user interface... sure things have been refined immensely but not really much has changed since then... i would say robust "touch" is a fairly big change since then and of course there will be new breakthroughs