Help future generations use existing tools.
Webify TLOSS.
Roy Hyunjin Han
TLOSS is a FORTRAN program written by David Brown that measures electricity loss on high voltage transmission lines.
20170908-1330 - 20170922-1330: 2 weeks estimated
20170908-1330 - 20171230-1700: 4 months actual
+ Webify TLOSS
+ Turn input text into tables
+ Turn output text into properties
FLNAME
RECORD
_ NOPT
RHO
NINS
gfortran -o tloss tloss.f
./tloss ldt800.dat x.log 100 1
+ Convert TLOSS live input into command line arguments
+ Wrap with subprocess in notebook
+ Create notebook wrapper for fortran script
+ Save work
+ Make raw tloss tool via cc.ini
+ Deploy raw tloss tool
Here is the raw tloss fortran program wrapped in a basic python script and run on different example datasets as provided in the original documentation:
The goal is to finish the first iteration of the TRANSPAC and PDPAC tools today. Let's first evaluate where we are.
+ Find where we have defined the TLOSS tool
+ Identify next steps
We'll have to postpone the direct notebook to tool conversion because of some complications with including extra code.
Is this something that we can realistically finish today? Let's hope so. That will count as one iteration.
+ Ask Alex if there is associated documentation
+ Ask Alex which tools to convert into Python and in which order
_ Attempt to FORTRAN programs into Python
The current strategy is that we will not touch the code for any of the modules and we will work entirely around it. Eventually, however, we should convert the code into Python, but I think we will reserve that for another contract.
For now, let's just focus on getting all the tools webified first. The idea is that we will convert the table into the format needed by this fortran program.
+ Review datasets
+ Examine source text
It looks like CSPAN.FOR is the only program that uses span length.
+ Find which tools use span length
Splitting the input into tables should be straightforward.
We should have a table for the bundles and the shields. The CSPAN tool will also have a table for the spans. I think it is safe to assume that only one copy of the tool will be running at any given time.
+ Plan how to split it into tables
We need code that will convert a table into a format acceptable by the fortran program.
There is only one example that has all three tables, so let us use that one.
+ Decide which file to use as the example
The problem is that we have this number called the code. But the code actually only refers to three numerical quantities. Another option is that we make the code itself modifiable in some kind of lookup table. Perhaps that is best.
+ See what we have right now
+ Check that it works
+ Make raw tloss tool via notebook
_ Work on converting each tool to Python
I don't think we should spend time converting the tools into Python.
+ Convert elec.dat into a table
+ Update script to accept custom elec.dat path
+ Check that everything still works
from pandas import read_csv
conductor_csv_table_path = '../Tools/conductors.csv'
conductor_csv_table = read_csv(conductor_csv_table_path).fillna('')
conductor_csv_table[-2:]
line_template = '{:<20}{:<7}{:<10.4}{:<10.4}{:<17.4}'
lines = []
for index, x in conductor_csv_table.iterrows():
lines.append(line_template.format(
x['Name'],
x['Code'],
x['Diameter (inches)'],
x['Subconductor Resistance (ohms/mile)'],
x['Reactance at 1 Foot Spacing (ohms/mile)']))
print('\n'.join(lines[-3:]))
from os.path import join
target_folder = '/tmp'
target_path = join(target_folder, 'conductors.dat')
open(target_path, 'wt').write('\n'.join(lines))
import numpy as np
from pandas import DataFrame
t = DataFrame([
(1, np.nan, np.nan),
])
t
t.fillna('')
+ Write function to convert conductors.csv into elec.dat
+ Define save_conductors_dat
from pathlib import Path
p = Path('/tmp/xyz.csv')
p
open(str(p), 'wt').write('abcdef')
p.open().read()
'{:<20}{:<7}{:<10.4}{:<10.4}{:<17.4}'.format(1, 2, '', '', '')
+ Add table for elec.dat
+ Check that everything still works
+ Split ldt345a.dat into three CSV tables
+ Convert example text file into tables
+ Make phase bundle table
+ Make shield bundle table
+ Make span elevation table
+ Write code to combine tables to text file for fortran script
+ Check that everything still works
+ Convert source text into tables
+ Convert target text into tables
+ Add text from comments into markdown
_ Webify each TRANSPAC tool
_ Webify each PDPAC tool
+ Draft webpage with links to each webified tool
_ Build tool that suggest optimizations and highlights savings
_ Make the interface for each tool more descriptive
_ Webify remaining TRANSPAC scripts by omitting the parts that require Graphoria
_ Webify CSPAN into multiple tools
_ Webify TLEFF if APPA can provide the example datasets
_ Webify PDPAC scripts if APPA can provide the example datasets
+ Process tasks
Salah Ahmed created 17 tools from the TRANSPAC scripts. We did not webify the remaining TRANSPAC and PDPAC scripts.