DEV Community

Andrii Zhukovskyi
Andrii Zhukovskyi

Posted on Originally published at zhukovskyi.space

My wire-size calculator had the right tables and still gave the wrong answer

I'm a platform engineer. Kubernetes, Java, AWS, that kind of work. I am not an electrician, and for the last few weeks I've been building a calculator for electricians. This post is about the mistake that taught me the most. It was not in the math.

What the app does

Electrician Calc picks the wire and the breaker for a circuit, checks the voltage drop and shows every step of the working, so you can show it to an inspector or a client.

It started as an IEC app: mm², metres, 230/400 V, the standard used in Ukraine and most of Europe. Then I added the NEC for the US: AWG, feet, 120/240 V, Table 310.16. The app picks one by the phone's region and you can switch with one tap.

I thought the NEC part was mostly tables. Type in the ampacity table, the standard breaker sizes and the grounding table, write tests against worked examples, done. The tests were green and I was happy.

A 40 A range

I didn't have an American electrician to ask, so I ran a user test with an AI agent in that role. The brief: you are a licensed residential electrician in the US, today you use a free app from a wire manufacturer and your memory. The agent first got only the store page and wrote down what it expected. Then it installed the app on an emulator and tried a real job: a 40 A range, 240 V, 60 ft away, NM-B cable.

Anyone in the trade knows the answer: 8 AWG copper, a 40 A breaker, a 10 AWG ground.

My app said a 50 A breaker.

The funny part is that the agent checked five things against the code, and all five numbers were right. NM-B was sized from the 60 °C column. The small-conductor limits were there. The 50 A did not come from a wrong table. It came from two defaults: "Continuous load" was on and the wire type was THHN. Continuous means a 125 % factor, and 40 × 1.25 is 50. That is correct for a store with the lights on all day. Nobody sizes a kitchen range like that.

I know this bug from my day job. Every value in the config is valid and the system still does the wrong thing, because the defaults were written for a different environment. Here the different environment was a different kind of electrician.

The fix was small. Continuous load is off by default, NM-B is the default wire, and the switch sits next to the current field where you can see it. The range now reads 8 AWG on 40 A with a 10 AWG ground.

What else the test found

Almost none of it was about formulas.

  • "Next step" opened the Voltage Drop calculator with demo numbers, not with the circuit I had just entered. Now the current, voltage, wire and run length carry over.
  • The PDF report had the result but not the working, so there was nothing to hand to the inspector. Now the steps are printed under each result.
  • The words gave the app away as a translated European one. "Installation method" and "grouping" in the onboarding. Loop impedance offered as a next step. A store screenshot that said "Sockets" and "Hob".
  • The demo panel had kitchen receptacles without AFCI and only one small-appliance circuit. The tester's note was: if an inspector sees a directory like this, there will be questions.
  • The paywall came right after onboarding, before the first result. That one hurt to read, because I knew it was wrong when I shipped it. The offers now wait until you have a result.

A sentence that read as an instruction

One line of the working said "voltage drop ≤ 3 % first met by 10 AWG". I meant a lower bound. The tester read it as "install 10 AWG", and the circuit needed 8. For a tool people use with a wire reel in their hands, this is worse than a crash.

Now it says "10 AWG or larger keeps the voltage drop within 3 %", and the last step names the size to install.

I found one more like it myself after that. The Voltage Drop calculator used to pass 14 AWG on a 20 A circuit when the run was short, because the drop really was fine. But 14 AWG may only be protected at 15 A. A calculator that says PASS there is technically answering the question it was asked, and it is wrong for the job. Now it fails.

About testing with an agent

An agent is not an electrician. It can't tell me how the app works with gloves on in a cold garage, and it has never argued with an inspector. I still want real people to try it.

But it did something my unit tests can't. Tests check the things I already thought of. The agent read the store page cold, expected something, and got annoyed when the app did something else. Most of what I fixed in the last two weeks came from that one report.

App Review

Apple sent the first build back under Guideline 2.1, Information Needed. Nothing was rejected. They wanted a screen recording from a real iPhone and review notes that explain the purpose of the app, how to use it, which external services it calls, whether it differs by region, and whether it is in a regulated industry.

The last one matters for a trade app. A calculator that names code sections can look like professional advice. So I wrote plainly what it is: a design aid, not a licensed electrical service, and I used the same words in the store description. After that it went through.

Try it

Wire Size, Voltage Drop, Power & Ohm's Law, the reference tables and three projects with PDF reports are free. No ads and no account, everything runs on the phone. The Panel Planner, Conduit and Box Fill and the other calculators are in Pro.

If you are an electrician and something looks wrong, tell me. That is the feedback I can't get from tests.

Calculations are a design aid. Check the final design against the code edition adopted where you work.

Top comments (1)

Collapse
 
launchgatecheck profile image
Launch Gate •

"Every value in the config is valid and the system still does the wrong thing" is the whole lesson in one sentence, and the range example is why: a default is a domain assumption wearing a UI toggle. Continuous load being on was not a wrong value, it was a claim about what kind of building you were standing in - and the app made that claim silently, on every job, until someone role-played the right kind of user.

That's also why the worked-example tests were green through all of it: they verify the math, never the context. Your agent test caught it because it tested intent - what would a residential electrician actually expect - which is a different test suite from the one tables can give you.

And the "10 AWG first met" line shows output phrasing is a safety surface, not copy. In a tool people act on, an ambiguous sentence is a bug with the same severity as a wrong number.