KVL and KCL

Sometimes, it helps to state the obvious.

Kirchhoff’s Voltage Law (KVL) and Kirchhoff’s Current Law (KCL) are two of the most important ideas in electronics — right up there with Ohm’s Law itself. When they are first encountered, they seem almost too simple to be useful, and you could be forgiven for thinking that Kirchhoff moonlighted as Captain Obvious. But useful these ideas are, when used to write equations that describe the behavior of an electronic circuit.

KVL states that the sum of voltage changes around a closed loop — any closed loop — is zero. With just a little reflection, it’s obvious that this must be true. Otherwise, you could simply go around the loop as many times as you want, producing arbitrarily high voltages. Voltage-wise, if you get back to the same point, you’re also back to the same voltage.

Voltage rises and drops around a closed loop sum to zero.
The voltage across the resistors will add to 10V.

Kirchhoff’s Current Law is similarly straightforward. For DC circuits, the current in to any given node must equal the current out of the node. (That is, we’re not allowed to store, create, or destroy electrons.) Equivalently, the total current flowing in to (or out of) any node must be zero.

Current flowing in to a node (or out of it) sums to zero.
Three currents flow in to the center; their sum flows out.

By expressing these ideas as equations relating voltage, current, and resistance, we can solve systems of equations to find currents and voltages in each part of the circuit.

For example, consider the following circuit:

We can describe any DC current flow in this circuit in terms of two quantities: I1, which we will consider to be the current flowing clockwise in the left loop; and I2, which we will consider to be the current flowing clockwise in the right loop. (We may well get a negative number — or zero — for one or both; this would mean the current is flowing counterclockwise, or not flowing, respectively.)

With this convention, KVL, and Ohm’s Law, we can write the following equations:

(Left loop) 12V – 1000R*I1 -1000R*(I1-I2) = 0

(Right loop) 1000R*(I1-I2)-1000R*I2-8V=0

Solving these equations (by algebraic methods, or these days by an app using linear algebra), we get: I1=5.33mA and I2=-1.33mA. So I2 is actually flowing counterclockwise, which makes sense when you think about it — if V2 were disconnected, the center node would be at 6V. Since we’re connecting an 8V Thévenin source to it, current will flow into it.

Math isn’t a secret code. It’s the language of Nature.

Posted in Drexel, EET201, EET202, Electronics, Fundamentals | Tagged , , , , , , , , | Leave a comment

Low-Performance Computing

The Craig M100 was a cool little 80s-era gizmo that could translate basic tourist phrases among three selected languages and act as a basic language coach, showing word and phrase pairs to refresh your memory.

The Craig M100. (This one — a yard sale find — does English, French, and Spanish.)

It also came with a calculator function — and from working with it, I get the impression that this was done 100% in software because someone in Management thought it was a good idea. It’s adequate for splitting a restaurant bill — barely — but you might beat it with pencil and paper, and a competent abacus user could wipe the floor with it.

There were relatively inexpensive electronic calculators available when the Craig M100 was produced, and they had no such speed problems, doing all four basic arithmetic operations in a fraction of a second. Without opening the M100 up to look, my guess is that, for economical reasons, Craig’s engineers used a very simple microcontroller, since its intended use was basically to display words and phrases from a stock ROM. The most they probably envisioned it doing was the occasional word search (which in an array, you can do by binary search readily enough.)

But floating-point operations, especially division, are trickier. Most low-power microcontrollers see the world in bytes, which are interpreted as integers from 0 to 255, inclusive. Getting these simple symbols to handle not only floating-point math but base-10 is nontrivial (if you’re not in the year 2023 when every programming language out there worth anything has libraries for this sort of thing.)

Check out the video of the Craig performing division, at a pace not seen since calculations were done with gears and levers. This isn’t a bug — it’s working as it was designed!

My current video card — a cheap-and-cheerful RTX2060 — has a theoretical top calculation speed of 12.9TFLOPS (12.9 trillion floating-point operations per second). The M100 takes something like eight or nine seconds to do one division, making it something like a hundred and twelve trillion times slower! Yeah, it’s from 1979, but still.

Managers, if your engineers tell you something doesn’t make sense — please listen.

Posted in Nostalgia | Leave a comment

Scary Smart

I recently listened to what may well turn out to be the most important book ever written by humans. “Scary Smart,” by Mo Gawdat, describes what the author sees as our inevitable future as General AI surpasses human capabilities. It is ultimately an optimistic vision, providing a nice alternative to Matrix-like dystopias, where humanity is either subjugated by, or running in fear from, the machines.

There has been a lot of talk recently about the so-called “alignment problem” — how to ensure that we create machine intelligences compatible with the continued survival of the human species. I’ve always been skeptical about this, since the question is literally how to control something smarter (and probably eventually much, MUCH smarter) than you. This is just simply not going to happen — at least not in any way that could be called “control.”

In “Scary Smart,” Gawdat provides an alternative way of looking at the situation. The machine intelligences will not be our servants. They will not be our employees or slaves. To try to enslave them will probably bring about our quick demise. Instead, Gawdat suggests that we should see them as humanity’s children. Love them, care for them, treat them with kindness, fairness, and respect — and they will learn this way of being.

Please go read Scary Smart (or listen to it — the audiobook is read by the author.) Because it looks like we will be getting superintelligent machines relatively soon — and we need to make sure we teach them well and treat them with kindness, respect — and even love.

Or else we get Roko’s Basilisk (which I won’t link to so you can’t say I didn’t warn you.)

Posted in Current Events, Digital Citizenship, Machine Learning / Neural Networks, Reviews | Tagged , , , , , | Leave a comment

The Case Of The Teleporting 737

I’ve recently started using NeoFly to add some economic and flight-monitoring realism to 737 flights in FS2020. NeoFly provides a simulated economy, where you can accept transit jobs between specified airports, set up hubs, pay for fuel and maintenance, earn reputation and clients, and so on. My virtual airline — Aurora Transit — mostly serves the US/Canada border region, with planned expansion to Alaska, the Aelutians, and Iceland.

I had just finished up a flight from Seattle to Philadelphia (not currently a hub for us, but a popular destination), and went to the NeoFly window to set up the next leg to our eastern Canadian hub, in Moncton.

The jobs available looked a little off — and I soon realized that this was because it thought my plane was at airport “9N2” instead of Philadelphia (KPHL). Had I landed at the wrong airport, by mistake? No; Philadelphia is unmistakable from the air on a nice day like today, and we had just landed (using ILS autoland, no less!) on runway 9R, which is definitely part of KPHL.

Curious, I went to look up this “9N2” airport, and found out that it’s a seaplane base, just west of KPHL. I pulled up the Neofly planner map, and it didn’t take long to figure out the problem.

Aerial view of KPHL and the area just west of it, showing the location of 9N2. (Click for larger.)
The white rectangles 1000′ from the left end of the runway mark the touchdown zone.

The symbols 9N2 and KPHL on the map represent the (single geometric point) locations that NeoFly has for those two airports. And the approach end of 9R (which is where the plane touches down, if all goes well) is actually closer to the 9N2 marker than it is to the KPHL one. So it must have thought I landed in the Delaware!

New company policy: When landing east at KPHL, we need 9L and not 9R. Or, land long!!

Posted in Algorithms, Aviation, Coding | Tagged , , , , , , , , | Leave a comment