When you set out to write a program, always question conventional wisdom — the neck you save may be your own!
Swaziland is an absolute monarchy in a rather dry area of Southern Africa. As part of a United Nations project to irrigate sugar cane fields, a dam was built on a river that flowed from Swaziland to Mozambique. Because the water flowed across an international border, there was a bilateral agreement as to how much water was to be released from the dam. The amount to be released was also a function of the inflow to the dam.
In order to measure the water flow, a weir was built consisting of a concrete base with a stepped steel profile set into it. The water level, coupled with the cross sectional area of the weir, together with some hydrological tables determined the water flow. Of course, there were several rivers and streams to be measured. I was contracted to build the microcomputer that measured the water level and transmitted the data, via a repeater station on a nearby hilltop, to the central computer behind the dam wall in the control centre. The outstation was based around the 80C35 (an 8748 minus the EPROM) because — in those days — there were no complete single chip CMOS micros. The repeater was 8748 controlled.
Note the IC superstructure in the middle. National Semiconductor apparently never had access to EPROM technology, so they created the 87P50, which was an 8748 with a piggyback EPROM allowing from 1Kbytes to 4Kbytes to be plugged in.
The central computer (which I also programmed) was based on an Intel Multibus system running an 8085, which displayed the hydrological data on a Lear Siegler “dumb” terminal (all of this took place in the early 1980s).
In order to calculate the water flow, I created a lookup table, which was obviously finite. I asked the question as to what happened when the water rose above the maximum specified and what message should I display. I was told that this could never happen. In fact, I was told that this was so unlikely I could display the message: “THE KING IS A ****” (expletive deleted). Well, I was rather more genteel back in those days, so I opted to display “FLOOD!” instead.
At the time we completed the project, there had been a drought, and this continued until the area was hit by tropical cyclone Domoina in 1984. This incredible weather system dropped 50cm (20″) of rain in a 36-hour period. The 135 MCM (million cubic metres) Mnjoli dam went from 0 to 100% in less than 20 hours. The dam had an earth wall, and if water flows over the top of this structure, that that is the end of the dam. In the event, they evacuated the control centre when all eight stations were reading “FLOOD!” Fortunately, the design of the overflow channels managed to cope, and a greater disaster was averted.
The screen output during development.
In the aftermath, it turned out that all of the water level stations had been completely washed away and the whole system had to be replaced. If I had followed the original advice I was given, I wouldn't have been able to return.
Have you ever made the mistake of believing what you were told? And has any of your work been destroyed by major natural event?