Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions process/pfcoil.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,25 +510,25 @@ def pfcoil(self):
pf.ccls[nng] = 1.0e6 * pfv.ccls_ma[nng]

# Beginning of pulse: t = tv.t_precharge
pfv.curpfs[ncl] = 1.0e-6 * pf.ccl0[nng]
pfv.curpfb[ncl] = 1.0e-6 * pf.ccl0[nng]

# Beginning of flat-top: t = tv.t_precharge+tv.t_current_ramp_up
pfv.curpff[ncl] = 1.0e-6 * (
pf.ccls[nng] - (pf.ccl0[nng] * pfv.fcohbof / pfv.fcohbop)
)

# End of flat-top: t = tv.t_precharge+tv.t_current_ramp_up+tv.t_fusion_ramp+tv.t_burn
pfv.curpfb[ncl] = 1.0e-6 * (
pfv.curpfs[ncl] = 1.0e-6 * (
pf.ccls[nng] - (pf.ccl0[nng] * (1.0e0 / pfv.fcohbop))
)

ncl = ncl + 1

# Current in Central Solenoid as a function of time
# N.B. If the Central Solenoid is not present then ioheof is zero.
pfv.curpfs[ncl] = -1.0e-6 * ioheof * pfv.fcohbop
pfv.curpfb[ncl] = -1.0e-6 * ioheof * pfv.fcohbop
pfv.curpff[ncl] = 1.0e-6 * ioheof * pfv.fcohbof
pfv.curpfb[ncl] = 1.0e-6 * ioheof
pfv.curpfs[ncl] = 1.0e-6 * ioheof

# Set up coil current waveforms, normalised to the peak current in
# each coil
Expand Down Expand Up @@ -1268,11 +1268,11 @@ def peakb(self, i, ii, it):
kk = 0
else:
# Check different times for maximum current
if abs(pfv.curpfs[i - 1] - pfv.ric[i - 1]) < 1.0e-12:
if abs(pfv.curpfb[i - 1] - pfv.ric[i - 1]) < 1.0e-12:
it = 2
elif abs(pfv.curpff[i - 1] - pfv.ric[i - 1]) < 1.0e-12:
it = 4
elif abs(pfv.curpfb[i - 1] - pfv.ric[i - 1]) < 1.0e-12:
elif abs(pfv.curpfs[i - 1] - pfv.ric[i - 1]) < 1.0e-12:
it = 5
else:
eh.idiags[0] = it
Expand Down Expand Up @@ -2700,10 +2700,10 @@ def waveform(self):
for ic in range(pfv.nohc):
# Find where the peak current occurs
# Beginning of pulse, t = t_precharge
if (abs(pfv.curpfs[ic]) >= abs(pfv.curpfb[ic])) and (
abs(pfv.curpfs[ic]) >= abs(pfv.curpff[ic])
if (abs(pfv.curpfb[ic]) >= abs(pfv.curpfs[ic])) and (
abs(pfv.curpfb[ic]) >= abs(pfv.curpff[ic])
):
pfv.ric[ic] = pfv.curpfs[ic]
pfv.ric[ic] = pfv.curpfb[ic]

# Beginning of flat-top, t = t_precharge + t_current_ramp_up
if (abs(pfv.curpff[ic]) >= abs(pfv.curpfb[ic])) and (
Expand All @@ -2712,17 +2712,17 @@ def waveform(self):
pfv.ric[ic] = pfv.curpff[ic]

# End of flat-top, t = t_precharge + t_current_ramp_up + t_fusion_ramp + t_burn
if (abs(pfv.curpfb[ic]) >= abs(pfv.curpfs[ic])) and (
abs(pfv.curpfb[ic]) >= abs(pfv.curpff[ic])
if (abs(pfv.curpfs[ic]) >= abs(pfv.curpfs[ic])) and (
abs(pfv.curpfs[ic]) >= abs(pfv.curpff[ic])
):
pfv.ric[ic] = pfv.curpfb[ic]
pfv.ric[ic] = pfv.curpfs[ic]

# Set normalized current waveforms
pfv.waves[ic, 0] = 0.0e0
pfv.waves[ic, 1] = pfv.curpfs[ic] / pfv.ric[ic]
pfv.waves[ic, 1] = pfv.curpfb[ic] / pfv.ric[ic]
pfv.waves[ic, 2] = pfv.curpff[ic] / pfv.ric[ic]
pfv.waves[ic, 3] = pfv.curpff[ic] / pfv.ric[ic]
pfv.waves[ic, 4] = pfv.curpfb[ic] / pfv.ric[ic]
pfv.waves[ic, 4] = pfv.curpfs[ic] / pfv.ric[ic]
pfv.waves[ic, 5] = 0.0e0

def superconpf(
Expand Down
2 changes: 1 addition & 1 deletion process/power.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def pfpwr(self, output: bool):
cktr[ig] = pfcr[ig] + pfbusr[ig] # total resistance of circuit (ohms)
cptburn = (
pfcoil_variables.cptdin[ic]
* pfcoil_variables.curpfb[ic]
* pfcoil_variables.curpfs[ic]
/ pfcoil_variables.ric[ic]
)
rcktvm[ig] = abs(cptburn) * cktr[ig] # peak resistive voltage (V)
Expand Down
28 changes: 14 additions & 14 deletions tests/integration/test_pfcoil_int.py
Original file line number Diff line number Diff line change
Expand Up @@ -2492,13 +2492,13 @@ def test_peakb(monkeypatch: pytest.MonkeyPatch, pfcoil: PFCoil):
"curpfb",
np.array(
[
0.067422231232391661,
-2.9167273287450968,
-8.1098913365453491,
-8.1098913365453491,
-5.5984385047179153,
-5.5984385047179153,
-186.98751599968148,
14.742063826112622,
20.032681634901664,
0.58040662653667285,
0.58040662653667285,
0.42974674788703021,
0.42974674788703021,
174.22748790786324,
0,
0,
0,
Expand Down Expand Up @@ -2552,13 +2552,13 @@ def test_peakb(monkeypatch: pytest.MonkeyPatch, pfcoil: PFCoil):
"curpfs",
np.array(
[
14.742063826112622,
20.032681634901664,
0.58040662653667285,
0.58040662653667285,
0.42974674788703021,
0.42974674788703021,
174.22748790786324,
0.067422231232391661,
-2.9167273287450968,
-8.1098913365453491,
-8.1098913365453491,
-5.5984385047179153,
-5.5984385047179153,
-186.98751599968148,
0,
0,
0,
Expand Down
14 changes: 7 additions & 7 deletions tests/unit/test_pfcoil.py
Original file line number Diff line number Diff line change
Expand Up @@ -1194,13 +1194,13 @@ def test_waveform(monkeypatch, pfcoil):
)
waves_exp = np.array(
[
[0.0, 1.0, 0.00457346, 0.00457346, 0.00457346, 0.0],
[0.0, 1.0, -0.14559845, -0.14559845, -0.14559845, 0.0],
[0.0, -0.07156774, 1.0, 1.0, 1.0, 0.0],
[0.0, -0.07156774, 1.0, 1.0, 1.0, 0.0],
[0.0, -0.07676189, 1.0, 1.0, 1.0, 0.0],
[0.0, -0.07676189, 1.0, 1.0, 1.0, 0.0],
[0.0, -0.93176, 1.0, 1.0, 1.0, 0.0],
[0.0, 0.00457346, 0.00457346, 0.00457346, 1.0, 0.0],
[0.0, -0.14559845, -0.14559845, -0.14559845, 1.0, 0.0],
[0.0, 1.0, 1.0, 1.0, -0.07156774, 0.0],
[0.0, 1.0, 1.0, 1.0, -0.07156774, 0.0],
[0.0, 1.0, 1.0, 1.0, -0.07676189, 0.0],
[0.0, 1.0, 1.0, 1.0, -0.07676189, 0.0],
[0.0, 1.0, 1.0, 1.0, -0.93176, 0.0],
[1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
[0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
[0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
Expand Down
8 changes: 4 additions & 4 deletions tests/unit/test_power.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ class PfpwrParam(NamedTuple):

cptdin: Any = None

curpfb: Any = None
curpfs: Any = None

sxlg: Any = None

Expand Down Expand Up @@ -497,7 +497,7 @@ class PfpwrParam(NamedTuple):
),
order="F",
).transpose(),
curpfb=numpy.array(
curpfs=numpy.array(
numpy.array(
(
0.067422231232391661,
Expand Down Expand Up @@ -1239,7 +1239,7 @@ class PfpwrParam(NamedTuple):
),
order="F",
).transpose(),
curpfb=numpy.array(
curpfs=numpy.array(
numpy.array(
(
0.019288882290113718,
Expand Down Expand Up @@ -1812,7 +1812,7 @@ def test_pfpwr(pfpwrparam, monkeypatch, power):

monkeypatch.setattr(pfcoil_variables, "cptdin", pfpwrparam.cptdin)

monkeypatch.setattr(pfcoil_variables, "curpfb", pfpwrparam.curpfb)
monkeypatch.setattr(pfcoil_variables, "curpfs", pfpwrparam.curpfs)

monkeypatch.setattr(pfcoil_variables, "sxlg", pfpwrparam.sxlg)

Expand Down