Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix DIII-D machine mapping for F-coil currents #268

Merged
merged 2 commits into from
Aug 30, 2023
Merged
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
23 changes: 16 additions & 7 deletions omas/machine_mappings/d3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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
Expand All @@ -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,
Expand All @@ -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)
Expand Down
Loading