# American Public Power Association tools

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

# TOWER GROUNDING RESISTANCE PROGRAM: SYMMETRICAL ARRANGEMENT OF VERTICAL GROUND RODS¶

I.E., IDENTICAL RODS EQUALLY SPACED AROUND THE CIRCUMFERENCE OF A CIRCLE.

This program was originally written in Fortran in 1989 by David R. Brown and the American Public Power Association.

{n : TOTAL NUMBER OF RODS (UP TO 500)}

YOU MAY ENTER THE ROD SPACING OR THE DIAMETER OF THE CIRCULAR ARRANGEMENT OF RODS.

{nopt: rod spacing or diameter ? TYPE A 1 TO ENTER ROD SPACING. TYPE A 2 TO ENTER DIAMETER OF ARRANGEMENT.}

{val: value ? depending on previous value this is rodspacing or diameter of arrangement (feet)}

{rho: EARTH RESISTIVITY IN OHM-METERS}

{xl: LENGTH OF THE RODS IN FEET}

{rd: DIAMETER OF THE RODS IN INCHES}

In [1]:
# Click the Blue Plane to preview this as a CrossCompute tool

n = 100
nopt = 1
val = 10
rho = 10
xl = 10
rd = 10

target_folder = '/tmp'

In [2]:
n = int(n)
if n > 500 or n < 1:
raise Exception("total number of rods must be in range [1,500]")
nopt = 1 if int(nopt) == 1 else 2

In [3]:
from os.path import join
output_text_path = join(target_folder, 'sym_arr_vertical_rods.log')
target_text_path = join(target_folder, 'sym_arr_vertical_rods.txt')

In [4]:
from subprocess import run

executable = 'sym_arr_vertical_rods.out'
script = 'sym_arr_vertical_rods.f'

output_text = run([
'gfortran',
'-o',
executable,
script,])

In [5]:
from os.path import expanduser
from subprocess import check_output, STDOUT
output_text = check_output([
'./sym_arr_vertical_rods.out',
expanduser(target_text_path),
str(n),
str(nopt),
str(val),
str(rho),
str(xl),
str(rd),
], stderr=STDOUT)
with open(output_text_path, 'wb') as output_file:
output_file.write(output_text)

In [7]:
print('output_text_path = ' + output_text_path)
print('target_text_path = ' + target_text_path)

output_text_path = /tmp/sym_arr_vertical_rods.log
target_text_path = /tmp/sym_arr_vertical_rods.txt