Articles

Learning Fortran

In my freshman year (1965) in engineering school, one if the first two quarters was dedicated to Analytical Graphics. The teacher would draw three-dimensional solid figures, and step through how to rotate the solid. Or to calculate whether a pipe running at odd angles would intersect something in the midst of the room. His only tools for this were a string and a piece of chalk. The other quarter was covered engineering-focused programming.

My first quarter was the graphics, and programming in the winter quarter.

After fall quarter I was taking the Empire Builder back home to Montana from Chicago. A classmate and I headed down to Union Station together. I was very early for my train, but the campus was essentially closed after finals. He was going off to his home in Iowa.

I purchased the textbook for the computer class to be held in the next quarter. I consumed it while waiting the 6 hours for the train.

When class resumed after the first of the year, I figured out how to get the compiler to print out the assembly language generated by the compiler. The computer we used was a CDC 3500, and the language was Fortran II. I pestered the instructor with so many questions that he shuffled me off a professor named Dr. Van Ness who became my advisor.

Long term impact

The first project ended up, I found out many years later, to have significant impact.

The overall project, of which my code was a very small part, helped decide where Fermilab was to be located.

First computer job

It turned out that he needed some programming help and offered me a summer job. So after spring semester, I headed home for a week, then back to Evanston for the summer.

The problem he was working on was on behalf of the Bonneville Power Administration. This is a supplier of electricity to most of the Northwest. I quickly learned that the system was unstable, and would occasionally pop the breakers. This was particularly interesting, as one normally thinks of instabilities as wide swings in voltage. This particular kind of instability was actually that of frequency.

Alternating Current Generation

The electricity in North America runs at a frequency of 60 Hz (cycles per second). The one exception, up until 2007, in New York City. There was a provider of electricity in was direct current--one of the original Edison plants. There are sill some uses of DC current, such as many subway lines that convert the main AC to DC for the cars.

A/C current can be converted to other voltages quite easily with transformers. This is a hugely useful feature, as it means that cross-country transmission of electricity is eminently feasible. The voltage is converted to as much as 300,000 volts. A higher voltage means a lower loss due to resistance. At or near the destination, the voltage is transformed down to lower voltages for local transmission, and eventually to 220/110 for residential use.

The downside of A/C current generation is that all the generators on a grid, such as the one on the Northwest, must be very closely in sync. If they are off by a little, the slower generator becomes a motor. Power is drawn in proportion to the difference in the phase angle of the two.

Additionally, many appliances require accurate 60 Hz frequency to operate properly. For example older electric clocks will speed up if the frequency is higher than 60Hz.

Stability

The problem that BPA was having was that systems to bring all the generators into sync would end up causing the frequency to swing back and forth. Eventually, the swing was enough that one or more parts to the power grid would trip out.

My professor, Dr James E Van Ness was asked by the BPA to find a solution to this problem. There were additional efforts he did, including the Load-Flow studies that greatly simplified power system capacity calculations. The part that I worked with involved finding the eigenvalues and eigenvectors of a 500th order matrix. The matrix represented the properties of their interconnected system, which included hydro power and coal at the time.

The calculation was to determine the poles and zeros of the equations describing the dynamics of the system. If the poles are too far to the left in real plane, the system will take longer to come to a stable state. If the points slip to the right of the vertical axis, you have an oscilator. This is not good for a power system.

Finding the eigenvalues of a complex system can indicate whether the system is stable or, much worse, an oscillator.

The analysis of these power grids and their control systems often lead to 67th order differential equations.

This was a particularly challenging computation, as the CDC 3400 had a total of 64k (if my memory is correct) words, which is far short of the 250,000 required for the matrix. Imagine inverting a matrix where you had to read a handful of rows in from tape.

FMCMX

The (very small part) of the work I had was to read data to populate what was called the 'C'(coefficient) matrix. The program was called FMCMX. (Languages those days improved abbreviation skills.) Of course, this was all done on punched cards. All of this was in Fortran II. He had two cabinets filled with drawers of punched cards that represented this program, and some others.

I visited Dr. Van Ness towards his retirement, probably 30 or 35 years after that summer. To my surprise, he remembered me well, and shared a printout with me of the current version of the code. It had not changed all that much, which was a surprise. He told me that the program was used in a calculation to show that Fermilab, if located in the Northwest, would cause the lights to dim across the region for four seconds at four second intervals. It also showed that the power grid in Illinois would have no such problem.

Reflections

What amazed me about the whole power grid behavior is that here is something that is man-made, yet there are things that we don't know about it's behavior. This turned out to be an interesting principle in my later career in security.

Some references for further reading

There are a number of papers that outline his work.

Recent entries