diff --git a/process/pfcoil.py b/process/pfcoil.py index c52299e1..3371a86a 100644 --- a/process/pfcoil.py +++ b/process/pfcoil.py @@ -507,7 +507,7 @@ def pfcoil(self): pf.ccls[nng] = 1.0e6 * pfv.ccls_ma[nng] # Beginning of pulse: t = tv.tramp - pfv.curpfs[ncl] = 1.0e-6 * pf.ccl0[nng] + pfv.curpfb[ncl] = 1.0e-6 * pf.ccl0[nng] # Beginning of flat-top: t = tv.tramp+tv.tohs pfv.curpff[ncl] = 1.0e-6 * ( @@ -515,7 +515,7 @@ def pfcoil(self): ) # End of flat-top: t = tv.tramp+tv.tohs+tv.t_fusion_ramp+tv.tburn - pfv.curpfb[ncl] = 1.0e-6 * ( + pfv.curpfs[ncl] = 1.0e-6 * ( pf.ccls[nng] - (pf.ccl0[nng] * (1.0e0 / pfv.fcohbop)) ) @@ -523,9 +523,9 @@ def pfcoil(self): # 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 @@ -1265,11 +1265,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 @@ -2697,10 +2697,10 @@ def waveform(self): for ic in range(pfv.nohc): # Find where the peak current occurs # Beginning of pulse, t = tramp - 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 = tramp + tohs if (abs(pfv.curpff[ic]) >= abs(pfv.curpfb[ic])) and ( @@ -2709,17 +2709,17 @@ def waveform(self): pfv.ric[ic] = pfv.curpff[ic] # End of flat-top, t = tramp + tohs + t_fusion_ramp + tburn - 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( diff --git a/process/power.py b/process/power.py index b3162b64..95bb8f6f 100644 --- a/process/power.py +++ b/process/power.py @@ -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) diff --git a/tests/integration/test_pfcoil_int.py b/tests/integration/test_pfcoil_int.py index a9bb842a..8e8b6c73 100644 --- a/tests/integration/test_pfcoil_int.py +++ b/tests/integration/test_pfcoil_int.py @@ -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, @@ -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, diff --git a/tests/unit/test_pfcoil.py b/tests/unit/test_pfcoil.py index 6919f903..a3fb892d 100644 --- a/tests/unit/test_pfcoil.py +++ b/tests/unit/test_pfcoil.py @@ -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], diff --git a/tests/unit/test_power.py b/tests/unit/test_power.py index 3db0fc69..2d204575 100644 --- a/tests/unit/test_power.py +++ b/tests/unit/test_power.py @@ -209,7 +209,7 @@ class PfpwrParam(NamedTuple): cptdin: Any = None - curpfb: Any = None + curpfs: Any = None sxlg: Any = None @@ -497,7 +497,7 @@ class PfpwrParam(NamedTuple): ), order="F", ).transpose(), - curpfb=numpy.array( + curpfs=numpy.array( numpy.array( ( 0.067422231232391661, @@ -1239,7 +1239,7 @@ class PfpwrParam(NamedTuple): ), order="F", ).transpose(), - curpfb=numpy.array( + curpfs=numpy.array( numpy.array( ( 0.019288882290113718, @@ -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)