From 2cac7d53f995517031f7bdeb13a0ca953164f660 Mon Sep 17 00:00:00 2001 From: bechtt Date: Tue, 29 Aug 2023 20:57:39 -0700 Subject: [PATCH] Fix DIII-D machine mapping for F-coil currents IMAS specifies the current should be the measured value for a single turn, but MDS+ stores A-turns. This only impacts F-coils and is related to a quirk for how the coils are specified in EFIT. Also fixed a bad IDS entry and reordered coils in pf_active to match the OMFIT ordering. This MR should be accompanied by corresponding fixes in OMFIT so that k-files are still formed properly (from the OMAS machine mappings). --- omas/machine_mappings/d3d.py | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/omas/machine_mappings/d3d.py b/omas/machine_mappings/d3d.py index 4ece501bf..5d3f25b24 100644 --- a/omas/machine_mappings/d3d.py +++ b/omas/machine_mappings/d3d.py @@ -361,6 +361,12 @@ def pf_active_hardware(ods, pulse): mhdin.to_omas(ods, update='pf_active') coil_names = [ + 'ECOILA', + 'ECOILB', + 'E567UP', + 'E567DN', + 'E89DN', + 'E89UP', 'F1A', 'F2A', 'F3A', @@ -379,12 +385,6 @@ def pf_active_hardware(ods, pulse): 'F7B', 'F8B', 'F9B', - 'ECOILA', - 'ECOILB', - 'E567UP', - 'E567DN', - 'E89DN', - 'E89UP', ] for k, fcid in enumerate(coil_names): ods['pf_active.coil'][k]['name'] = fcid @@ -407,7 +407,7 @@ def pf_active_coil_current_data(ods, pulse): ods1, pulse, channels='pf_active.coil', - identifier='pf_active.coil.{channel}.element.0.identifier', + identifier='pf_active.coil.{channel}.identifier', time='pf_active.coil.{channel}.current.time', data='pf_active.coil.{channel}.current.data', validity=None, @@ -431,6 +431,15 @@ def pf_active_coil_current_data(ods, pulse): nt = len(ods[f'pf_active.coil.{k}.current.data']) ods[f'pf_active.coil.{k}.current.data_error_upper'] = abs(data[identifier][3] * data[identifier][4]) * np.ones(nt) * 10.0 + # IMAS stores the current in the coil not multiplied by the number of turns + for channel in ods1['pf_active.coil']: + if f'pf_active.coil.{channel}.current.data' in ods: + if 'F' in f'pf_active.coil.{channel}.identifier': + ods[f'pf_active.coil.{channel}.current.data'] /= ods1[f'pf_active.coil.{channel}.element.0.turns_with_sign'] + ods[f'pf_active.coil.{channel}.current.data_error_upper'] /= ods1[f'pf_active.coil.{channel}.element.0.turns_with_sign'] + else: + print(f'WARNING: pf_active.coil[{channel}].current.data is missing') + # ================================ @machine_mapping_function(__regression_arguments__, pulse=133221)