Skip to content

Commit bb03e51

Browse files
committed
address comments
1 parent 4311487 commit bb03e51

File tree

2 files changed

+23
-46
lines changed

2 files changed

+23
-46
lines changed

carsons/carsons.py

Lines changed: 19 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -320,56 +320,35 @@ def __init__(self, model, *args, **kwargs):
320320
self.ds = model.tape_shield_outer_diameter
321321
self.thickness = model.tape_shield_thickness
322322

323-
self.tape_shield_phases = model.tape_shield_outer_diameter.keys()
323+
self.phases.extend(
324+
f'{ph}t' for ph in model.tape_shield_outer_diameter.keys()
325+
)
324326

325327
self.r.update({
326328
f'{ph}t': self.compute_shield_r(self.ds[ph], self.thickness[ph])
327-
for ph in self.tape_shield_phases
329+
for ph in model.tape_shield_outer_diameter.keys()
328330
})
329331

330332
self.gmr.update({
331333
f'{ph}t': self.compute_shield_gmr(self.ds[ph], self.thickness[ph])
332-
for ph in self.tape_shield_phases
334+
for ph in model.tape_shield_outer_diameter.keys()
333335
})
334336

335337
# set shield position to be the same as its phase conductor position
336338
tape_shield_positions = {
337339
f'{ph}t': self.phase_positions[ph]
338-
for ph in self.tape_shield_phases
340+
for ph in model.tape_shield_outer_diameter.keys()
339341
}
340342
self.phase_positions.update(tape_shield_positions)
341343

342-
def build_z_primitive(self) -> ndarray:
343-
neutral_conductors = sorted([
344-
ph for ph in self.phases
345-
if ph.startswith("N")
346-
])
347-
shield_conductors = sorted([
348-
f'{ph}t' for ph in self.tape_shield_phases])
349-
350-
conductors = ['A', 'B', 'C'] + shield_conductors + neutral_conductors
351-
352-
dimension = len(conductors)
353-
z_primitive = zeros(shape=(dimension, dimension), dtype=complex)
354-
355-
for index_i, phase_i in enumerate(conductors):
356-
for index_j, phase_j in enumerate(conductors):
357-
if phase_i.strip('t') not in self.phases \
358-
or phase_j.strip('t') not in self.phases:
359-
continue
360-
R = self.compute_R(phase_i, phase_j)
361-
X = self.compute_X(phase_i, phase_j)
362-
z_primitive[index_i, index_j] = complex(R, X)
363-
364-
return z_primitive
365-
366344
@staticmethod
367345
def compute_shield_gmr(ds, thickness) -> float:
368346
return (ds - thickness) / 2
369347

370-
def compute_shield_r(self, ds, thickness) -> float:
348+
@classmethod
349+
def compute_shield_r(cls, ds, thickness) -> float:
371350
area = (π*(ds/2)**2) - (π*(ds/2 - thickness)**2)
372-
return self.ρ_tape_shield/area
351+
return cls.ρ_tape_shield/area
373352

374353
def compute_d(self, i, j) -> float:
375354
I, J = set(i), set(j)
@@ -379,22 +358,18 @@ def compute_d(self, i, j) -> float:
379358
if one_tape_shield_same_phase:
380359
return self.gmr[i] if 't' in i else self.gmr[j]
381360
else:
382-
return self.calculate_distance(self.phase_positions[i],
383-
self.phase_positions[j])
361+
return super().compute_d(i, j)
384362

385-
def compute_X(self, i, j) -> float:
386-
Q_first_term = super().compute_Q(i, j, 1)
387-
388-
# Simplify equations and don't compute Dᵢⱼ explicitly
389-
kᵢⱼ_Dᵢⱼ_ratio = sqrt(self.ω * self.μ / self.ρ)
390-
ΔX = Q_first_term * 2 + log(2)
391-
392-
if i == j:
393-
X_o = -log(self.gmr[i]) - log(kᵢⱼ_Dᵢⱼ_ratio)
394-
else:
395-
X_o = -log(self.compute_d(i, j)) - log(kᵢⱼ_Dᵢⱼ_ratio)
363+
@property
364+
def conductors(self):
365+
neutral_conductors = sorted([
366+
ph for ph in self.phases if ph.startswith("N")
367+
])
368+
shield_conductors = sorted([
369+
ph for ph in self.phases if ph.endswith("t")
370+
])
396371

397-
return (X_o + ΔX) * self.ω * self.μ / (2 * π)
372+
return ['A', 'B', 'C'] + shield_conductors + neutral_conductors
398373

399374

400375
class MultiConductorCarsonsEquations(ModifiedCarsonsEquations):

tests/test_tape_shielded_cables.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,6 @@ def phases(self):
6161
def test_single_phase_tape_shield_with_neutral_Keirsting():
6262
# Example 4.4, Kiersting, Distribution System Modelling and Analysis
6363
# 4th Ed, Taylor&Francis, 2018
64-
# small numerical error found in solution to Kersting example
65-
# and is adjusted for here
6664

6765
n_pos = 3 # n phase conductor placed 3 inches away from phase cond
6866

@@ -73,6 +71,10 @@ def test_single_phase_tape_shield_with_neutral_Keirsting():
7371
calculate_impedance(tape_shielded_cable),
7472
array(
7573
[
74+
# Kersting example has:
75+
# [1.3218 + 1j * 0.6744, ...]
76+
# but we think this is due to a numerical error in
77+
# the calculation of the tape shield resistivity
7678
[1.3325 + 1j * 0.6458, 0.0 + 1j * 0.0, 0 + 1j * 0],
7779
[0 + 1j * 0, 0 + 1j * 0, 0 + 1j * 0],
7880
[0 + 1j * 0, 0 + 1j * 0, 0 + 1j * 0],

0 commit comments

Comments
 (0)