Previous: 26 Fools rush in
Next: Appendix A: A routine for plotting arrows
In this section:
Maybe I was just bored. Maybe, I’d written reams to various other folks embarking on updating their existing Fortran programs to run inside a Windows GUI. Perhaps it was when I found myself writing pretty much the same information in yet another email to someone else. Or maybe it was just vanity. Possibly I just wanted to leave a memoir, Or, indeed, that I felt charitably inclined. There is, of course, the likelihood that it was all of those things.
I am a Geotechnical Engineer, and not a programmer, although I have been programming computers since 1970. In my career, I took 3 degrees: a BSc in Civil Engineering, an MSc in Soil Mechanics, and a PhD. Along the way I became a Chartered Engineer and a Fellow of the Geological Society of London, and after some years working in Consulting firms I found a job in Academia, where I rose to a full Professorship. I retired from that job, as one does when one reaches a certain age, but have continued in various roles, for example being the Chief Scientific Editor of the Quarterly Journal of Engineering Geology and Hydrogeology for 5 years (as well as being on the Editorial Board even before that), and I have continued with consulting work and when the opportunity arises, mentoring students and potential aspirants to becoming Chartered.
I know that I program Fortran in an old-fashioned and somewhat pedestrian style, learnt when Fortran was in its comparative infancy, and although I prefer to do it that way, have no objection whatsoever with people choosing a different programming style. The choice is yours.
My own introduction to Fortran began in around 1970 when I had been attempting to program something on an Elliot-NCR 4120 computer using Algol 60, and that machine suffered a fire, and was replaced by an IBM 1130. The IBM only had a very restricted version of Fortran, and I only ever got the re-programmed application working properly a few years later when I had access to better hardware – the CDC 6400 at Imperial College.
Gradually, card and tape input to standalone systems gave way to terminal access, and late in 1983, I bought one of the first serious PCs to appear in Britain. Part of the appeal was the availability of Fortran, at which by then I was reasonably adept. It was Microsoft Fortran, a subset compiler, and was version 3.3
In my job as a lecturer at Kingston Polytechnic, I was required to attend and teach on the annual field courses in topographic surveying18. I soon gravitated to teaching certain tasks, to which I was best suited by temperament, using particular equipment that I liked using. As I was an enthusiastic participant in this exercise, the colleague (the late Wilf Schofield) who ran the exercise left me to do what I liked best. I had done field surveying at Portsmouth when I was a student, over the course of 3 weeks on the Isle of Wight (based in a Youth Hostel in an old chapel in St Helens village), but in comparison, Wilf Schofield’s week-long courses were brilliantly organised and far more effective.
The tasks in this course, which by the time I had joined Kingston’s staff group were being held alternately at Royal Holloway College and the University of Sussex in Brighton, were to make a survey of the relative positions of a number (6 to 8) set points called Major Control Stations, by measuring the angles round a closed polygonal path from station to station, and the distances between them19. This involved not only the field measurements forming a Traverse, but also a computation, followed by a distribution process for the inevitable slight errors, called Bowditch’s Correction. Back in 1973, there were no hand-held calculators, computers were too big and fragile to transport, and slide rules on which the majority of calculations were done simply lacked the accuracy to do the calculations. At Portsmouth when I was an undergraduate, we had used 7-figure logarithms, but Kingston had a programmable desktop calculator (Hewlett Packard model 9810A) on which another colleague (the late Brian Merrony) had produced several programs that were stored on magnetic cards.
Of course, only a subset of the students were involved with measuring the angles and distances of the main traverse, but others were involved in the base room gridding up a 2m x 1m sheet of film on which a map would be prepared, while others were out with other staff colleagues reconnoitring other Minor Control Traverses winding between the Major Control Stations, and representing a series of stations, marked with pegs, from which the various buildings, paths, roads and so on in the campus could all be seen. In turn, these Minor Control Traverses20 were surveyed in terms of angles and distances, with coordinates then calculated by means of another of Brian Merrony’s programs.
The programs were a revelation to me, as they brought the 3 weeks of the Portsmouth course down to a single week – and a week that was far more productive of practical surveying. Within a few days, the various major control and minor control stations appeared in their proper coordinated positions on the base map.
In an equally parallel operation, other student groups were setting surveying instruments up on the various control stations, and recording the outlines of buildings, paths and roads etc by means of a combination of angles and distances21. The problem was that there was no program to treat this information, and students had to sit down in their groups and plot it out with a big protractor and scale rule.
As the years passed, the technology improved, and distances that were originally measured electronically using huge, ponderous, devices were measured more rapidly with smaller and more accurate machines, and other optically-based distance measurement procedures were replaced by the electronic systems. Eventually, even the major control was measured with GPS. Moreover, the HP9810A was replaced by a far more capable HP9845 with programs in Basic
written by a student for his project, and when that fell by the wayside, another colleague, Bill Evans, wrote an integrated22 suite around a PC running Quattro Pro.
The problem of plotting the fine detail remained insuperable. Attempts were made to deal with it by investing in a Zeiss BRT006 rangefinder system, which could produce a simple plot using a pantograph mechanism called a Karti Table. This was so successful that a second set was bought. But groups of students still used the old protractor and scale rule, and still made many of the old mistakes, and still took days plotting.
Once the detail appeared on the base map (usually traced through from smaller surveys slipped under the gridded film), Wilf Schofield would lead the students through a process of designing the centreline of a road to weave round the campus in the form of a series of straights and circular curves. Eventually, the coordinates of the intersection points, the curve tangent lengths and so on were measured off the plan, and using the appropriate program(s) – initially Brian Merrony’s cards for the HP9810A, then the student’s Basic program, and later Bill Evan’s spreadsheet solution – would provide the angles and distances for students to go out in the field and set out with pegs and ranging rods the centreline of that road.
The problem with the detail surveys always remained, and returned with a vengeance when students opted to use hi-tech total stations instead of the very Germanic, but old-fashioned looking, Zeiss BRT machines.
An initial solution came about when I took one of my Apricot computers to survey camp one year. About midway through the course I disappeared for a couple of days24, and programmed up a solution to the detail plotting problem with the aid of an A3 pen plotter interfaced to the PC through an RS232C interface. I had written “Fortran and the Art of PC programming” with Tim Ward and produced a program into which the students could enter some simple parameters, their angles and distances, and the pen plotter would plot out their observations, point by point, even joining consecutive points if told to. I named this program “Tacheo” as the surveys of this kind are called Tacheometry – and that was too long. The program was an instant success, and within a year, we were running three Apricot PCs (gifted to the department by Nick Lambert and Rob Higginson, both Kingston ex-students, and their company Soils Ltd) and 3 Roland plotters on survey course to plot the details. I took the opportunity to tidy the program during the following year, and to make use of the simpler Centronics parallel interface, and the compiled program was used on survey courses without modification for nigh on 15 years, during which time the computers were replaced with more powerful machines. A critical moment occurred when the IT department upgraded the machines to Windows 2000. This operating system had the habit of buffering output into 512-byte blocks, so sometimes nothing would happen, and then a plotter would madly dash off and plot a dozen points, before appearing to go to sleep again – Tacheo was written to plot a point as soon as its data was entered. I knew that the end was nigh for Tacheo.
I had experimented with ClearWin, and indeed, I attended a launch event at Salford in around 1992. However, Salford FTN77 (as it was then) was fine for running traditional applications, but ClearWin+ still needed the DOS extender DBOS, and this was a pig to install. It only became a practical proposition with Windows 32-bit mode, effectively Windows 2000. I reprogrammed Tacheo from start to finish, this time with a Windows look and feel, and plotted the survey on the screen as it was input. Only at the end did I arrange for the plot to be unleashed via those Roland plotters. To my astonishment, students took to it like ducks to water, it worked faultlessly “out of the box”, and was a great success. Some had already been known to turn their noses up at the DOS version, and Bill Evans soon coined the phrase “Steam Tacheo” to denote the older version. It was never run again: like a genuine steam engine, it was sent to the scrapyard.
I had seen the light. I also saw one or two improvements I should like to make (which I did) and started to consider the day that the Roland plotters would not work – they were showing signs of wear. The day came faster than I anticipated, and the very next year, with rising student numbers on the courses, I had to implement the correct-to-scale output on dot matrix printers, of which some 4 A3-size printers materialised to replace the plotters. Once again, the code worked “out of the box” (to my surprise and relief) and apart from a few glitches and improvements, that was that. WinTacheo (as it is now called) continues to be used, as it has done now since 2005, with occasional small tweaks driven mainly by aesthetics, and very occasionally by real need, like stopping students specifying a scale that needed printout over hundreds of sheets (e.g. a scale of 1:1) – the multiple sheet option being one of my pet ideas, as bigger than A3 printers would not be portable enough to take on the course.
We knew that Bill Evans was angling to retire early, and his Quattro Pro spreadsheets were incomprehensible to anyone else, and Quattro Pro was changing anyway. I therefore resolved to write the successor to Bill Evan’s spreadsheet in an all-encompassing application called SCAMPS (Survey Course Master Program System – or maybe Survey CAMP System?), and this came online in 2012, with a few teething issues resolved the following year, both after I had retired from teaching at Kingston. SCAMPS is altogether more ambitious than WinTacheo, and covers the analysis of traverses and calculation of road setting out details, together with associated graphics.
I also developed a program for analysing intersection and resection problems in surveying called StationMaster, and a program for recording levelling survey called LevelBook, plus a tiny application called Janus to simplify the problem students have of subtracting one set of degrees, minutes and seconds from another.
While Brian Merrony probably saved students weeks away from home on courses over a decade, my software has saved greater numbers of students a day or two each – but over nearly three decades! As I am now retired from this part of University life, it is my hope to keep these programs running for colleagues until GPS makes a complete takeover of the surveying. They certainly work under Windows 7 and 8, 8.1, 10 and 11! Back in 2005 I programmed in parallel with WinTacheo a program for plotting GPS detail surveys, and this could be resurrected and updated rather quickly, I suspect.
Also in parallel with this work on topographic surveying, I had begun to write ClearWin+ codes for some programs connected with my Geotechnical Engineering professional and research interests. This started around the turn of the millennium, but really took off after my success with WinTacheo.
As it is, I have been programming seriously with the ClearWin+ system for well over a decade and approaching two, and although there are still things I have yet to master, this book contains much of the experience I have gained by dint of trial, error, and a great deal of agonising. There is no single way to programming – in Fortran or ClearWin+ - and I have tried to write as though I am offering suggestions and solutions, not laying down hard and fast rules. I have my own preferred way of doing things, and this shows through in my example codes. I am a fairly pedestrian programmer, eschewing sophisticated solutions for “plodding”, and maybe this won’t be entirely to your tastes. However, it should make it easy to understand what I am on about.
Despite my lengthy description of topographic survey programs written for student use during field courses, most of my programming has been devoted to software in my chosen field of geotechnical engineering, with the odd foray into structural engineering. I became an early adopter of computer graphics, firstly through the use of flatbed and drum plotters, and only when PC graphics matured and ClearWin+ became accessible have my programs used the screen to full effect.
Geotechnical engineering applications often use a limit equilibrium approach (a sort of bastardised plasticity method) or a continuum approach for which I started to use the finite element method as long ago as 1971. My programs are usually for my own use, or by research students and close colleagues, but I have been close enough to the commercial software market to have some firm ideas about Help and support!
My Fortran Rules are simple, and are as follows:
They are my rules for myself, and they are not a set of rules for you, the reader. Your rules are whatever you want them to be.
I really only have one hard and fast rule with ClearWin+, and that is to make the WINIO@ call statements have as few format codes as possible. Sure, this proliferates statements, but it simplifies each of them. I then group the statements by function and separate those different functions with blank lines – or for the main window, into subroutines.
Footnotes:
18. There was an end of summer term course with a big group of degree students, and a start of Autumn term course for HND students – a much smaller group. Roger Curtis gravitated to running the HND courses, usually aided by a much smaller and more select group of colleagues. I ran his course one year while he was on Sabbatical leave with the help only of Keith Shepherd – neither of us surveyors – and 10 students. Eventually all the courses were held at Sussex, due to building at Royal Holloway.
19. In 1973, distances were measures with an AGA model 6A geodimeter, powered by car batteries and barely portable, and angles by a Wild T2 1-second theodolite. Later, we used a Kern 1-second theodolite, which employed a telescope-mounted DM501 electronic distance measurement system. After a couple of years, the optical theodolite was traded in for an E1 total station (also using the DM501). When Kern was absorbed by Wild, a number of these total stations were obtained, and they served until replaced by some beautiful Leica (and less beautiful Sokkia) integrated total stations, and eventually by a Leica GPS system.
20. In the beginning, these surveys were done with a Wild or Kern precision tacheometer, or by using a subtense bar. Eventually, top-mounted accessory EDM systems were obtained. These were mounted on Kern, Wild and Watts theodolites with varying degrees of success. Later, the Kern total stations were a favourite until in turn they were replaced by the Leica and (less successfully Sokkia) total stations.
21. For those interested in surveying, as well as the Zeiss BRT 006 rangefinders, we also used self-reducing tacheometers by Wild and Kern until there were enough EDMs to supplant them.
22. It wasn’t very integrated at first, but it evolved.
23. Wm Shakespeare for this one: Ariel’s song in The Tempest
24. In those far-off days, the number of students was small, and they had already done a shorter field course in Richmond Park. Towards the end of the week the students more or less got on with it unattended, and staff retired in groups for long coffee and tea breaks where some would collaborate on the Guardian Crossword, and others would hatch plans for improvements to course organisation. Latterly, the Telegraph Crossword has been favoured. However, student numbers rose, and some staff made it very clear they had no interest in surveying, courses were run multiple times to eke out the availability of instruments, and such luxuries went by the wayside.
FORTRAN and the ART of Windows Programming, Copyright © Eddie Bromhead, 2023.