Help future generations use existing tools.
Run TRANSPAC scripts with the original input.
Roy Hyunjin Han
The TRANSPAC load analysis software was originally written in FORTRAN by David Brown. The goal of this project is to transform the FORTRAN scripts into web-based tools.
20170607-1200 - 20170621-1200: 2 weeks estimated
20170607-1200 - 20170908-1245: 3 months actual
+ Run each script.
It looks like
ANOISE.FOR is making calculations on audible noise data. Looking up "audible noise analysis program" on Google suggests that audible noise was used as some sort of diagnostic or proxy for measuring something else. The program was written by David R. Brown and the American Public Power Association in 1989.
Measurement and Analysis of Audible Noise from Operating 765 kV Transmission Lines describes how the authors measured noise from 765 kV transmission lines.
Audible Noise Characteristics of 765 KV Insulator explains that moving power over longer distances requires higher transmission voltages, but that higher transmission voltages also generate a lot of noise that can be annoying to people.
+ Describe ANOISE.FOR
AUX1.DAT file appears to be a data file where each column has a fixed length, perhaps for easy rendering by a line feed printer. The fixed column format is actually easier to read than a CSV.
Looking up some of the descriptions suggests that the file is a list of different materials that could be used for transmission lines.
For example, ACSR stands for Aluminum Conductor Steel Reinforced, which means that aluminum lines have been wrapped around a steel rod in order to prevent it from breaking under high winds.
And HD CU stands for Hard-Drawn Copper Wire, where AWG is some measure of size.
We can take a closer look at the other columns later.
+ Describe AUX1.DAT
It looks like
AUX2.DAT has the same rows as
AUX1.DAT but adds additional columns. The same goes for
+ Describe AUX2.DAT + Describe AUX3.DAT
AUX4.DAT file is a bit funky and has two rows for each row of ACSR in
AUX1.DAT. Subsequent rows correspond one for one.
+ Describe AUX4.DAT
It looks like we are missing AUX5.DAT, but none of the scripts reference it so maybe we do not need it.
AUX6.BAK files say that they are dimensions of wood species. I am assuming this is referring to the wood used for the wooden posts that elevate the transmission line. Wood is probably used instead of metal because I think wood is a poor conductor of electricity and having metal transmission posts would be dangerous.
$ diff AUX6.DAT AUX6.BAK 1,2c1,2 < C MASTER DATA FILE AUX6.DAT, VERSION 1.0 < C DIMENSIONS OF WOOD SPECIES, PP. 4-269 TO 4-271 F&B. --- > C > C
diff shows that the only difference between the two files are the descriptive comments at the top. Thank goodness for those comments. Otherwise the files are identical and we can safely delete the
AUX6.BAK backup file.
+ Describe AUX6.BAK + Describe AUX6.DAT + Compare AUX6.BAK and AUX6.DAT + Remove AUX6.BAK
CMPCT.FOR seems to be a separate program. It has a lot of lines of code. Luckily, it is divided into several subroutines. We should probably attempt to run each program.
This time, it will probably be a good idea to try to recreate the original behavior first before trying any improvements. Having a version that recreates the original behavior will make it easier to persuade the original users to migrate to the new version.
Searching for "compact lines analysis transmission" on Google produces some studies on the impact of lightning on transmission lines.
Lightning Performance of Compact Transmission Lines is an interesting study that uses Monte Carlo techniques to simulate the effect of lightning on different transmission configurations, specifically taking into account the physics of compact lines.
I'm not entirely sure what
CMPCT.FOR is analyzing, however. Perhaps we can look at the
WRITE statements to get an idea of what exactly is being output.
$ grep WRITE CMPCT.FOR
CMPCT.FOR seems to be computing various losses related to compact line. It seems like there are different kinds of losses. I thought loss referred to the voltage drop when transmitting energy over long distances. But there are terms like corona loss and conductor loss.
According to this document provided by the Vermont Electric Company, transmission line corona is a phenomenon where a localized field of ionized air molecules forms around high voltage transmission lines. Depending on weather, transmission line corona can produce a crackling or humming sound. It is one of many forms of energy loss that utilities would like to minimize because minimal energy loss (or maximizing operational efficiency) means less production is required to deliver more energy to the customer and is healthy for the long-term sustainability of the utility.
+ Describe corona loss
According AC Transmission Line Losses, the two major sources of loss in high voltage AC transmission line are resistive (conductor) loss and corona loss. It seems like resistive loss just means the loss incurred when electrons are slowed down by bumping into the conductor and generating heat as they try to travel through the conductor.
+ Describe conductor loss + Describe CMPCT.FOR
Now we are looking at
CMPCT2.FOR, which is version 2.0 of
CMPCT.FOR. I'm not sure why both files were included. Perhaps this was a form of version control? Or it offered a variation so that the user could choose to run either one or the other.
vimdiff CMPCT2.FOR CMPCT.FOR
There seem to be significant differences between the two files.
+ Compare CMPCT2.FOR and CMPCT.FOR + Describe CMPCT2.FOR
Now I am looking at a file called
CSPAN.FOR which he describes as the conductor span analysis program. It seems to be a program for computing the amount of sagging and tension in a transmission line at both connection endpoints. I wonder how accurate these calculations are. They seem to be pretty mathematical.
It looks like there are a bunch of separate tools. I should ask Alex which tools have higher priority before I spend too much on tools that are not as important.
+ Describe CSPAN.FOR
I am guessing that
CTEMP.FOR calculates the temperature increase in the conductor of the transmission line depending on variables such as voltage, solar absorption and such.
+ Describe CTEMP.FOR
I think at the end of this week, I should report my findings to Alex and ask for documentation as well as his thoughts on which tool we should work on first.
EFIELD.FOR program seems to be some kind of computation of electric field analysis for high voltage insulation systems. It produces some kind of plots which we can only see if we run the program.
+ Describe EFIELD.FOR
Looking at the following files, I am guessing that these data files are actually some kind of lookup table so that the user can enter the CCODE (computer code) into the program and it will use the parameters associated with that CCODE.
These data files are used in many programs here.
+ Describe ELEC.DAT + Describe ELEC1.BAK + Describe ELEC1.DAT + Describe ELEC2.BAK + Describe ELEC2.DAT + Describe ELEC3.BAK + Describe ELEC3.DAT
INCL*.FOR files seem to be various helper functions.
+ Describe INCL1.FOR + Describe INCL2.FOR + Describe INCL3.FOR + Describe INCL5.FOR
LCAP.FOR seems to be calculating the electric power transfer capability of the transmission line. According to Electric Power Transfer Capability: Concepts, Applications, Sensitivity, Uncertainty, it is important to compute the maximum amount of electricity than can be both safely and optimally transferred through the line. That means that above this point, either too much energy is lost or perhaps there is a risk of fire or shock to passerby.
+ Describe LCAP.FOR
Perhaps as an initial first step, we should just webify each of these tools and preserve the FORTRAN code. It looks like converting the FORTRAN to Python will be a very messy job.
LPAR.FOR program might computing miscellaneous parameters of the transmission line based on the amount of electricity flowing through it. It is probably some kind of simulation thing.
+ Describe LPAR.FOR
According to Study of Lightning Damage Risk Assessment Method for Power Grid, lightning trip-out is an undesirable disturbance to the electric grid caused by lightning. The program seems to have been important enough to merit multiple revisions over several years.
+ Describe LTRPOLD.FOR (LTRPS v1.0) + Describe LTRPS.FOR (LTRPS v2.0) + Describe LTRPS2.FOR (LTRPS v2.1)
MFIELD.FOR program is some sort of analysis of the magnetic field produced by transmission lines. Usually I hear about electromagnetic fields, so it is interesting to hear that one can study the electric field and magnetic field separately. To be honest, I'm not really clear on the difference between the two.
+ Describe MFIELD.FOR (MFIELD v2.0) + Describe MFLDOLD.FOR (MFIELD v1.1)
With another thirty minutes, I could finish my initial review of the existing code. Then I should probably summarize the results and proposed next steps to Alex.
MYPLOT.FOR file seems to be something that takes an output file and generates a plot.
+ Describe MYPLOT.BAK + Describe MYPLOT.FOR
PDSGN.FOR seems to be more calculations to make sure that the wood poles supporting the transmission lines can bear the tension and stress of the transmission line and weather conditions (wind, ice) without breaking.
+ Describe PDSGN.FOR (v1.0) + Describe PDSGN2.FOR (v2.0)
According to Radio-Frequency Interference (RFI) From Extra-HighVoltage (EHV) Transmission Lines, there are three types of transmission line corona:
The author notes that radio noise has the longest range and can affect radio telescopes as well as AM radio stations.
RNOISE.FOR program analyzes the radio noise associated with the transmission line.
+ Describe RNOISE.FOR
The Switching Surge and Arresters says that a switching surge happens when a breaker or switch is manually triggered (such as during maintenance work on a line). These switching surges can be dangerous to electronic equipment (thus surge protectors).
SSRG.FOR program seems to be computing the amount of surge (i.e. overvoltage) that could happen on a particular piece of transmission line.
+ Describe SSRG.FOR
TLEFF.FOR program seems to be computing variables that the transmission line is having on the environment.
+ Describe TLEFF.FOR
TLOSS.FOR program seems to be computing transmission line losses. I thought there was another program that also computes losses. I wonder if there is a difference between compact transmission line and regular transmission line.
Mitigating the Impacts of Electric Transmission Lines provides an excellent comparison of different types and configurations of transmission line. The presentation lists the following technologies, including compact line:
The rest of the presentation discusses pros and cons of each technology.
+ Describe TLOSS.FOR
TPLOT2.FOR seem to be some helper functions for generating plots.
+ Describe TPLOT.FOR (v1.0) + Describe TPLOT2.FOR (v2.0)
TRES.FOR says that it is a Tower Grounding Resistance Program.
Grounding for Tower Lightning Protection Systems More Than Just Low Ground Resistance explains the needs for having adequate grounding protection for a tower. When lighting strikes a power tower, the majority of the surge should go into the earth rather than into the transmission line. That will only happen if the resistance of the earth is less than the resistance of the transmission line, I think.
Thus the Tower Grounding Resistance Program seems to be analyzing various grounding configurations to make sure that it can handle a lightning strike.
+ Describe TRES.FOR + Write a description for each file in the archive
+ Record in README the people who have worked on this software + David R. Brown 1987 + David R. Brown 1989 + David R. Brown 1990 + David R. Brown 1992 + David R. Brown 1993 + David R. Brown 1994 + American Public Power Association
There does seem to be a Jupyter Notebook kernel for FORTRAN, though I haven't tried it yet.
I think we should start by trying to run the FORTRAN code directly in a self-contained docker container. Hopefully, the code will still work and we can see what kind of outputs it produces.
The next step will be to experiment with the Jupyter FORTRAN kernel. If it works properly, we will use that in our next step.
The next step will be to webify the FORTRAN code directly. That means we will leave the mathematics in FORTRAN and just wrap our CrossCompute application framework around it. That should result in several web-based tools for which we can generate hidden links. We will make some changes to our site so that users will not have to login to run the tools.
Then, based on time and budget, we will attempt to convert the FORTRAN code into Python, which will open the possibility of improving the underlying mathematics with the latest algorithms and packages.
+ Propose that we first just webify the original FORTRAN code + Summarize results and proposed next steps
+ Catalog which tools are in the provided code and why they are useful + Adjust https://crosscompute.com so that users will not have to login to run the tools + Process completed tasks + Reconcile tasks from statement of work and mission documents
There are 93 pages of documentation. Hopefully there are a lot of diagrams. At least for documentation, more is better. It looks like the word document was scanned using an OCR program.
We should spend some time to skim through this documentation.
+ Read through TRANSPAC documentation
I have finished skimming through the documentation. The next step is to try to run each of the programs.
As discussed with Alex, we'll try working on the programs related to electrical performance first. In particular, we will start with TLOSS.
We will try to upgrade all of the tools in the following order.
Let's try to run the TLOSS program. We should use a docker container just in case, I think.
sudo docker run -it fedora bash dnf -y install gcc-gfortran cd /root tar xf scripts.tar.gz gfortran TLOSS.FOR sudo docker cp scripts.tar.gz 169ef:/root/scripts.tar.gz + Start docker container using fedora + Install fortran + Upload files _ Run TLOSS
I ran into several errors while trying to run the programs. One option is to try to run the programs in bits and pieces to try to figure out what it was trying to do.
sudo dnf -y install gcc-gfortran VIRTUAL_ENV=~/.virtualenvs/fortran virtualenv -p $(which python3) $VIRTUAL_ENV source $VIRTUAL_ENV/bin/activate cd ~/Documents/ git clone https://github.com/ZedThree/jupyter-fortran-kernel.git cd jupyter-fortran-kernel/ pip install -U jupyter notebook pip install -e . jupyter-kernelspec install fortran_spec --user mkdir ~/Experiments/fortran cd ~/Experiments/fortran/ jupyter notebook program hi print *, "hi" end program hi + Install jupyter fortran kernel + See if we can run [FORTRAN in a Jupyter Notebook](https://github.com/ZedThree/jupyter-fortran-kernel)
My next step will be to work through the TLOSS program bit by bit and see if I can figure out what the original script did.
+ Set up jupyter fortran kernel + Set up APPA hidden notebook + Prepare terminal demo + Try running stuff with g77 instead of gfortran + Save errors + Figure out variable declaration error
Professor Brown had used a non-standard variable declaration syntax for character arrays.
CHARACTER CDESC*20(25) # Non Standard CHARACTER CDESC(25)*20 # Standard
After making these change, I was able to compile TLOSS.FOR successfully.
After making the above changes to the other files, I was successfully able to compile 14 out of the 28 FORTRAN modules using the standard
gfortran available in Fedora.
The remaining 14 modules rely on a proprietary graphics library called Graphoria.
I was able to obtain the original Lahey Graphoria library from an AbandonWare site called VetusWare.
The next step is to try compiling the programs in a DOS emulator.
It looks like Fedora has a DOS emulator called dosbox. I really like the "SET BLASTER=A220 I7 D1 H5 T6" detail.
sudo dnf -y install dosbox + Obtain DOS emulator mount c ~/Downloads + Figure out how to get the files into the dos emulator
Now we have the problem of how to install from multiple floppies.
cd ~/Experiments/dosbox genisoimage -o lahey-fortran-disk1.iso lahey-fortran/Disk1 genisoimage -o lahey-fortran-disk2.iso lahey-fortran/Disk2 genisoimage -o lahey-graphoria.iso lahey-graphoria dosbox imgmount -t iso \ a \ lahey-fortran-disk1.iso \ lahey-fortran-disk2.iso \ lahey-graphoria.iso mount c ~/Experiments/dosbox/drive-c a: install.exe # Use CTRL-F4 to swap floppies
It looks like we were successfully able to install Lahey F77. The next steps are to try using F77 with Graphoria to compile the original FORTRAN modules.
Looking at the default F77 installation, it looks like Graphoria comes included.
F77L3/LIB/GRAPH3.LIB F77L3/LIB/GRAPH3K.LIB dosbox mount c ~/Experiments/dosbox/drive-c c: autoexec.bat + Put TRANSPAC files on drive-c and mount it
I'm able to compile stuff but it is not generating any executables.
cd f77l3/src f77l3 demo.for 386link demo.obj demo.exe
Just like the Borland compiler, we need the linking step to generate the executable.
Now let's try compiling each program from TRANSPAC.
ls *.FOR -1 ANOISE.FOR CMPCT2.FOR CMPCT.FOR CSPAN.FOR CTEMP.FOR EFIELD.FOR INCL1.FOR INCL2.FOR INCL3.FOR INCL5.FOR LCAP.FOR LPAR.FOR LTRPOLD.FOR LTRPS2.FOR LTRPS.FOR MFIELD.FOR MFLDOLD.FOR MYPLOT.FOR PDSGN2.FOR PDSGN.FOR RNOISE.FOR SSRG.FOR TLEFF.FOR TLOSS.FOR TPLOT2.FOR TPLOT.FOR TRES.FOR + Gather list of FORTRAN programs from TRANSPAC vim compile.bat f77l3 %1.for 386link %1.obj + Write batch file to simplify compilation
+ Try running various sample programs from f77l3 + Compile ANOISE.FOR + Compile CSPAN.FOR + Compile CTEMP.FOR + Compile EFIELD.FOR + Compile LCAP.FOR + Compile LPAR.FOR + Compile LTRPOLD.FOR + Compile MFIELD.FOR + Compile MFLDOLD.FOR + Compile RNOISE.FOR + Compile SSRG.FOR + Compile TLEFF.FOR + Compile TLOSS.FOR + Compile TRES.FOR
I'm still having problems compile the fortran programs that require Graphoria. Let's try putting the Graphoria library files directly in the folder.
mount d ~/Experiments/dosbox/lahey-graphoria d: cd /example3 cd /example4 _ Try to compile graphoria examples
386link tplot.obj -l d:/graph3k.lib vim compile.bat f77l3 %1.for 386link %1.obj -l d:/graph3k.lib + Compile CMPCT2.FOR with Graphoria + Compile CMPCT.FOR with Graphoria _ Compile INCL1.FOR with Graphoria (miscellaneous subroutines) _ Compile INCL2.FOR with Graphoria (miscellaneous subroutines) _ Compile INCL3.FOR with Graphoria (miscellaneous subroutines) _ Compile INCL5.FOR with Graphoria (miscellaneous subroutines) + Compile LTRPS2.FOR with Graphoria + Compile LTRPS.FOR with Graphoria + Compile MYPLOT.FOR with Graphoria + Compile PDSGN2.FOR with Graphoria + Compile PDSGN.FOR with Graphoria + Compile TPLOT2.FOR with Graphoria + Compile TPLOT.FOR with Graphoria + Try to compile each fortran program from TRANSPAC
I successfully compiled each script, but can we run them?
I'm getting an error:
Abort - Weitek co-processor required for execution.
This must be a compiler specific thing.
Aha, I needed to use graph3.lib instead of graph3k.lib.
vim compile.bat f77l3 %1.for 386link %1.obj -l d:/graph3.lib
Now everything runs.
+ Try compiling the remaining programs using the original Lahey compiler and Graphoria library
mount c ~/Experiments/dosbox/drive-c c: autoexec cd transpac _ AUX1.DAT _ AUX2.DAT _ AUX3.DAT _ AUX4.DAT _ AUX6.DAT _ ELEC1.DAT _ ELEC2.DAT _ ELEC3.DAT _ ELEC.DAT + Try each data file to see which works with TLOSS.FOR
None of the provided data files work with TLOSS.FOR, but I can reconstruct what an example data file should look like by examining the code.
IF(STRNG(1:1) .EQ. 'C') GO TO 1 IF(STRNG(1:1) .EQ. 'E') GO TO 30 IF(STRNG(1:1) .EQ. 'P') THEN L=IPB IPB=IPB+1 NPB=NPB+1 READ(STRNG(2:),*) MCODE,X,Y,MSUB,BSPACE,BV,BC,PH,BNM END IF IF(STRNG(1:1) .EQ. 'S') THEN L=ISB ISB=ISB-1 NSHB=NSHB+1 READ(STRNG(2:),*) MCODE,X,Y,MSUB,BSPACE,BNM BV=0. BC=0. PH=0. END IF
The input data file has the following format:
Subsequent rows can either start with a C (comment), E (end), P (?) or S (?).
READ(STRNG(2:),) MCODE,X,Y,MSUB,BSPACE,BV,BC,PH,BNM READ(STRNG(2:),) MCODE,X,Y,MSUB,BSPACE,BNM
MCODE is the conductor code, which should match a row in CCODE in ELEC.DAT. It is a shortcut way to specify parameters using a lookup table and specifies the type of material used for the bundle subconductors at the point.
Here is good article that describes corona loss and mentions that methods to reduce corona discharge effects include large diameter conductors, hollow conductors and bundled conductors. The article also describes some of the terminology behind bundle spacing and bundle radius.
The difference between a P row and an S row is that voltage, current and phase of the bundle for an S row is assumed to be zero. I'm not really sure what the P and S stand for in English.
+ Understand the columns in a P row and an S row
Alex commented last time that there is a sample data file in the manual.
+ Recreate the a data file from the documentation
The line endings in the data file need to be in dos format.
+ Understand appropriate values for each column in a P row + Run TLOSS.FOR
We successfully ran TLOSS.FOR. Let's do the simplest thing we can do, which is to package the FORTRAN.
+ Figure out how to get a fortran program to take command line arguments