def buildIs2BpolB(isttok_mag): """ Build B poloidal response Matrix on the poloidal field probes from a set of PFC coil circuits (Vertical + Horizontal) Gives poloidal field on each probe for a Is=1A on coils Args: Returns: Is2Bpol : """ ns = 3 # number of PFC active independent coils circuits (sources) # number of poloidal probes nPrb = isttok_mag['nPrb'] Rprb = isttok_mag['Rprb'] Zprb = isttok_mag['Zprb'] tethaProb = isttok_mag['tethaPrb'] turnsV = isttok_mag['TurnsPfcVer'] RPfcVer = isttok_mag['RPfcVer'] ZPfcVer = isttok_mag['ZPfcVer'] IgainVert = isttok_mag['IgainVert'] turnsH = isttok_mag['TurnsPfcHor'] RPfcHor = isttok_mag['RPfcHor'] ZPfcHor = isttok_mag['ZPfcHor'] IgainHor = isttok_mag['IgainHor'] turnsP = isttok_mag['TurnsPfcPrim'] RPfcPrim = isttok_mag['RPfcPrim'] ZPfcPrim = isttok_mag['ZPfcPrim'] IgainPrim = isttok_mag['IgainPrim'] Is2Bpol = np.zeros((nPrb, ns)) # Vertical Coils for k in range(len(turnsV)): br, bz = mf.Bloop(RPfcVer[k], ZPfcVer[k], Rprb, Zprb) bpol, brad = mf.BpolBrad(br, bz, tethaProb) Is2Bpol[:, 0] += turnsV[k] * bpol * IgainVert # Horizontal Coils for k in range(len(turnsH)): br, bz = mf.Bloop(RPfcHor[k], ZPfcHor[k], Rprb, Zprb) bpol, brad = mf.BpolBrad(br, bz, tethaProb) Is2Bpol[:, 1] += turnsH[k] * bpol * IgainHor # Primary Coils for k in range(len(turnsP)): br, bz = mf.Bloop(RPfcPrim[k], ZPfcPrim[k], Rprb, Zprb) bpol, brad = mf.BpolBrad(br, bz, tethaProb) Is2Bpol[:, 2] += turnsP[k] * bpol * IgainPrim return Is2Bpol
def buildIc2Bpol(RIc, ZIc): """ Build B poloidal response Matrix on the poloidal field probes from a set of filaments Gives poloidal field on each probe for a Is=1A on filament # Args: # np: number of poloidal probes # ns: number of PF Returns: MsBpol :0.0 """ nc = len(RIc) nPrb = isttok_mag['nPrb'] Rprb = isttok_mag['Rprb'] Zprb = isttok_mag['Zprb'] tethaProb = isttok_mag['tethaPrb'] Ic2Bpol = np.zeros((nPrb, nc)) # each filamen for k in range(len(RIc)): br, bz = mf.Bloop(RIc[k], ZIc[k], Rprb, Zprb) bpol, brad = mf.BpolBrad(br, bz, tethaProb) Ic2Bpol[:, 0] += bpol return Ic2Bpol
def buildIs2Bpol(Vcoil, Hcoil=None, PrimCoil=None): """ Build B poloidal response Matrix on the poloidal field probes from a set of PFC coil circuits (Vertical + Horizontal + Primary) Gives poloidal field on each probe for a Is=1A on coils # Args: Vcoil: numpy.array([RPfcVer,ZPfcVer,TurnsPfcVer]) Returns: Is2Bpol : array [12, 3] """ ns = 3 # number of PFC active independent coils circuits (sources) # number of poloidal probes nPrb = isttok_mag['nPrb'] Rprb = isttok_mag['Rprb'] Zprb = isttok_mag['Zprb'] tethaProb = isttok_mag['tethaPrb'] Is2Bpol = np.zeros((nPrb, ns)) # Vertical Coils for k in range(Vcoil.shape[0]): br, bz = mf.Bloop(Vcoil[k, 0], Vcoil[k, 1], Rprb, Zprb) bpol, brad = mf.BpolBrad(br, bz, tethaProb) Is2Bpol[:, 0] += Vcoil[k, 2] * bpol # Horizontal Coils if isinstance(Hcoil, np.ndarray): for k in range(Hcoil.shape[0]): br, bz = mf.Bloop(Hcoil[k, 0], Hcoil[k, 1], Rprb, Zprb) bpol, brad = mf.BpolBrad(br, bz, tethaProb) Is2Bpol[:, 1] += Hcoil[k, 2] * bpol # Primary Coils if isinstance(PrimCoil, np.ndarray): for k in range(PrimCoil.shape[0]): br, bz = mf.Bloop(PrimCoil[k, 0], PrimCoil[k, 1], Rprb, Zprb) bpol, brad = mf.BpolBrad(br, bz, tethaProb) Is2Bpol[:, 2] += PrimCoil[k, 2] * bpol return Is2Bpol
node = flux_int[0] signalStructArray = client.getData(node, '0x0000', Nshot) signalStruct = signalStructArray[0] Tstart = signalStruct.getTStart() Tstart.date plotFluxCoilData(client, Nshot) plotFluxCoilIntegrated(client, Nshot) # Primary Coils #PF1 ATorres PrimCoil = np.array([[0.615, 0.144, 14.], [0.615, -0.145, 14.]]) RFluxPrb = np.array([0.714, 0.705, 0.714]) ZFluxPrb = np.array([0.012, 0.0, -0.012]) ATFluxPrb = np.array( [0.012 * 0.154 * 10, 0.023 * 0.185 * 10, 0.012 * 0.154 * 10]) # Total Area * turns of probes #Is2Bpol=np.zeros((nPrb, ns)) BrFluxPrb = np.zeros((3)) BzFluxPrb = np.zeros((3)) FluxPrbEstim = np.zeros((3)) for k in range(PrimCoil.shape[0]): br, bz = mf.Bloop(PrimCoil[k, 0], PrimCoil[k, 1], RFluxPrb, ZFluxPrb) BrFluxPrb += br * PrimCoil[k, 2] BzFluxPrb += bz * PrimCoil[k, 2] FluxPrbEstim[0] = BrFluxPrb[0] * ATFluxPrb[0] FluxPrbEstim[1] = BzFluxPrb[1] * ATFluxPrb[1] FluxPrbEstim[2] = BrFluxPrb[2] * ATFluxPrb[2] FluxPrbEstim = FluxPrbEstim * Iprim