American Public Power Association tools




Pay Notebook Creator: Salah Ahmed0
Set Container: Numerical CPU with TINY Memory for 10 Minutes 0
Total0

TRANSMISSION LINE ENVIRONMENTAL EFFECTS PROGRAM

ELECTRIC FIELD CALCULATION MODULE

ENTER CONDUCTOR VOLTAGES, MAGNITUDE AND ANGLE.

MAGNITUDE MUST BE RMS KV LINE-TO-GROUND.

I.E., A 69 KV LINE IMPLIES 69/SQRT(3)=39.8.

ANGLES SHOULD BE IN DEGEES, TYPICALLY 0,120,-120.

{magnitude_angles_table : ENTER MAGNITUDE AND ANGLE.}

ENTER COORDINATES WHERE E FIELD IS DESIRED.

ENTER DISTANCE DATA IN FEET, NUMBER OF DATA POINTS AS AN INTEGER.

For example, if xstart is 0, xstop is 10 and the number of data points is 3, then the program will calculate noise at ground level at the following distances away from the distribution line: 0 feet, 5 feet, 10 feet.

{xstart: first x coordinate}

{xstop : last x coordinate}

{y: height above ground}

{npnts : number of points}

In [ ]:
# Click the Blue Plane to preview this as a CrossCompute tool
phase_table_path = 'phases.csv'
shield_table_path = 'shields.csv'
span_table_path = 'spans.csv'

magnitude_angles_table_path = 'magnitude_angles.csv'

xstart = 12
xstop = 35
y = 10
npnts = 1

target_folder = '/tmp'
In [ ]:
from os.path import join
output_text_path = join(target_folder, 'electric_field.log')
target_text_path = join(target_folder, 'electric_field.txt')
In [ ]:
from pandas import read_csv
df = read_csv(magnitude_angles_table_path)
df
In [ ]:
mag_angles = [','.join((str(x), str(y))) for x,y in zip(df['magnitudes'], df['angles'])]
In [ ]:
pylon_text_path = ''
In [ ]:
from subprocess import run

executable = '1.out'
script = '1.f'

output_text = run([
    'gfortran',
    '-o',
    executable,
    script,])
In [ ]:
from itertools import chain
from os.path import expanduser

cmd = list(chain([
          join('.', executable),
          pylon_text_path,
          expanduser(target_text_path)
         ],
         mag_angles, 
        [str(xstart),
         str(xstop),
         str(y),
         str(npnts)]))
In [ ]:
from subprocess import check_output, STDOUT
output_text = check_output(cmd, stderr=STDOUT)
with open(output_text_path, 'wb') as output_file:
    output_file.write(output_text)
In [ ]:
print('output_text_path = ' + output_text_path)
print('target_text_path = ' + target_text_path)