Commit 13238f17 authored by Michal Maciejewski's avatar Michal Maciejewski
Browse files

Upgraded RB and RQ

parent 80b20a1e
%% Cell type:markdown id: tags:
<h1><center>Analysis of a PLI1.c2 HWC Test in an IPD Circuit</center></h1>
Superconducting beam separation dipoles of four different types are required in the Experimental Insertions (IR 1, 2, 5 and 8) and the RF insertion (IR 4). Single aperture dipoles D1 (MBX) and twin aperture dipoles D2 (MBRC) are utilized in the Experimental Insertions. They bring the two beams of the LHC into collision at four separate points then separate the beams again beyond the collision point. In the RF Insertions two types of twin aperture dipoles, each type with two different aperture spacings are used: D3 (MBRS) and D4 (MBRB). The D3 and D4 magnets increase the separation of the beams in IR 4 from the nominal spacing 194 mm to 420 mm. D2 and D4 are the twin apertures magnets with common iron core for both apertures. D3 is a twin apertures magnet with independent iron cores for each aperture.
The MBRC dipole consists of two individually powered apertures assembled in a common yoke structure.
- MBX – D1
Single aperture of the magnet powered with one power supply.
- MBRC – D2
- MBRB – D4
Apertures B1 and B2 of the magnet are powered in series with one power supply.
- MBRS - D3
Apertures B1 and B2 of the magnet are powered in series with one power supply but series connection done in the DFBA.
|Magnets in the Circuit|Temperature|Position|General information|
|----------------------|-----------|--------|-------------------|
|MBX (D1)|1.9 K| RD1.R2, RD1.R8|I Nominal: 5800A, I_Ultimate: 6100A|
| | | |L tot: 26 mH, L per aperture: 26 mH|
| | | |max(di/dt): 17.453 A/s|
|MBRC (D2)|4.5 K| RD2.L1, RD2.R1, RD2.L5, RD2.R5|I Nominal: 4400A, I_Ultimate: 4670A|
| | | RD2.L2, RD2.R2, RD2.L8, RD2.R8|I Nominal: 6000A, I_Ultimate: 6500A|
| | | |L tot: 52 mH, L per aperture: 26 mH|
| | | |max(di/dt): 18.147 A/s|
|MBRS (D3)|4.5 K| RD3.L4, RD3.R4|I Nominal: 5520A, I_Ultimate: 6000A|
| | | |L tot: 26 mH, L per aperture: 26 mH|
| | | |max(di/dt): 18.147 A/s|
|MBRB (D4)|4.5 K| RD4.L4, RD4.R4|I Nominal: 5520A, I_Ultimate: 6000A|
| | | |L tot: 26 mH, L per aperture: 26 mH|
| | | |max(di/dt): 18.147 A/s|
### PLI1.C2 - FAST POWER ABORT AT INJECTION CURRENT
The aim of this test is to verify the correct performance of the power converter and the superconducting components, and generation of a PM file after a fast power abort.
<img src="https://gitlab.cern.ch/LHCData/lhc-sm-hwc/-/raw/master/figures/ipd/PLI1_current.png" width=50%>
<center>IPD currents during PLI.C2. Note: the actual parameters are listed in Appendix 1.</center>
Offline analyses are listed below:
|Responsible|Type of Analysis|Criteria|
|-----------|----------------|--------|
|PC|Analysis of the current and waveform decay.|Agreement of V_MEAS(t) and I_MEAS(t) to the theoretical decay curve withing a tolerance of 10 %.|
|MP3|Check if QPS PM event was created (it is not expected).||
| |Check if FGC PM event was created (it is expected).||
%% Cell type:markdown id: tags:
# Analysis Assumptions
- We consider standard analysis scenarios, i.e., all signals can be queried. If a signal is missing, an analysis can raise a warning and continue or an error and abort the analysis.
- In case a signal is not needed for the analysis, a particular analysis is skipped. In other words, all signals have to be available in order to perform an analysis.
- It is recommended to execute each cell one after another. However, since the signals are queried prior to analysis, any order of execution is allowed. In case an analysis cell is aborted, the following ones may not be executed (e.g. I\_MEAS not present).
# Plot Convention
- Scales are labeled with signal name followed by a comma and a unit in square brackets, e.g., I_MEAS, [A].
- If a reference signal is present, it is represented with a dashed line.
- If the main current is present, its axis is on the left. Remaining signals are attached to the axis on the right. The legend of these signals is located on the lower left and upper right, respectively.
- The grid comes from the left axis.
- The title contains timestamp, circuit name, and signal name allowing to re-access the signal.
- The plots assigned to the left scale have colors: blue (C0) and orange (C1). Plots presented on the right have colors red (C2) and green (C3).
- Each plot has an individual time-synchronization mentioned explicitly in the description.
- If an axis has a single signal, then the color of the label matches the signal's color. Otherwise, the label color is black.
%% Cell type:markdown id: tags:
# 0. Initialise Working Environment
%% Cell type:code id: tags:
``` python
import io
import re
import sys
import pandas as pd
import numpy as np
from datetime import datetime
import time
from IPython.display import display, Javascript, HTML
from lhcsmapi.Time import Time
from lhcsmapi.Timer import Timer
from lhcsmapi.analysis.expert_input import get_expert_decision
from lhcsmapi.analysis.report_template import apply_report_template
from lhcsmapi.analysis.IpdCircuitQuery import IpdCircuitQuery
from lhcsmapi.analysis.IpdCircuitAnalysis import IpdCircuitAnalysis
# GUI
from lhcsmapi.gui.hwc.HwcSearchModuleMediator import HwcSearchModuleMediator
analysis_start_time = datetime.now().strftime("%Y.%m.%d_%H%M%S")
import lhcsmapi
print('Analysis executed with lhcsmapi version: {}'.format(lhcsmapi.__version__))
with io.open("../__init__.py", "rt", encoding="utf8") as f:
version = re.search(r'__version__ = "(.*?)"', f.read()).group(1)
print('Analysis executed with lhc-sm-hwc notebooks version: {}'.format(version))
```
%% Cell type:markdown id: tags:
# 1. Select HWC Test
%% Cell type:code id: tags:
``` python
circuit_type = 'IPD'
hwc_test = 'PLI1.c2'
hwcb = HwcSearchModuleMediator(circuit_type=circuit_type, hwc_test=hwc_test, hwc_summary_path='/eos/project/l/lhcsm/hwc/HWC_Summary.csv')
```
%% Cell type:markdown id: tags:
# 2. Query All Signals Prior to Analysis
%% Cell type:code id: tags:skip_output
``` python
with Timer():
circuit_name = hwcb.get_circuit_name()
t_start = Time.to_unix_timestamp(hwcb.get_start_time())
t_end = Time.to_unix_timestamp(hwcb.get_end_time())
author = hwcb.get_author()
is_automatic = hwcb.is_automatic_mode()
query = IpdCircuitQuery(circuit_type, circuit_name, max_executions=7)
# PC
i_meas_df = query.query_signal_nxcals(t_start, t_end, system='PC', signal_names='I_MEAS', spark=spark)[0]
i_meas_df = query.query_signal_nxcals(t_start, t_end, t0=t_start, system='PC', signal_names='I_MEAS', spark=spark)[0]
source_timestamp_df = query.find_source_timestamp_pc(t_start, t_end)
timestamp_fgc = source_timestamp_df.at[0, 'timestamp']
# PIC
timestamp_pic = query.find_timestamp_pic(timestamp_fgc, spark=spark)
# QDS
source_timestamp_qds_df = query.find_source_timestamp_qds(timestamp_fgc, duration=[(2, 's'), (2, 's')])
timestamp_qds = np.nan if source_timestamp_qds_df.empty else source_timestamp_qds_df.loc[0, 'timestamp']
signal_names = 'U_RES_B1' if query.circuit_type == 'IPD2_B1B2' else 'U_RES'
u_res_df = query.query_signal_nxcals(t_start, t_end, system='QDS', signal_names=signal_names, spark=spark)[0]
u_res_df = query.query_signal_nxcals(t_start, t_end, t0=t_start, system='QDS', signal_names=signal_names, spark=spark)[0]
# LEADS
u_hts_dfs = query.query_leads(timestamp_fgc, source_timestamp_qds_df.drop_duplicates('source') if not source_timestamp_qds_df.empty else pd.DataFrame(), system='LEADS', signal_names=['U_HTS'], spark=spark, duration=[(t_end-t_start, 'ns')])
u_res_dfs = query.query_leads(timestamp_fgc, source_timestamp_qds_df.drop_duplicates('source') if not source_timestamp_qds_df.empty else pd.DataFrame(), system='LEADS', signal_names=['U_RES'], spark=spark, duration=[(t_end-t_start, 'ns')])
analysis = IpdCircuitAnalysis(query.circuit_type, pd.DataFrame())
timestamp_dct = {'FGC': timestamp_fgc, 'PIC': timestamp_pic,
'QDS_A':source_timestamp_qds_df.loc[0, 'timestamp'] if len(source_timestamp_qds_df) > 0 else np.nan,
'QDS_B':source_timestamp_qds_df.loc[1, 'timestamp'] if len(source_timestamp_qds_df) > 1 else np.nan}
```
%% Cell type:markdown id: tags:
# 3. Timestamps
It is expected that only the PC PM event was created and QPS did not trip (no PM event).
In case the QPS tripped, the analysis for MP3 consists of checking the existence of PM events and of consistency of the PM timestamps (PC, QPS).
In short the following criteria should be checked:
- The PC timestamp (51_self) is QPS timestamp +-20 ms.
- The difference between QPS board A and B timestamp = 1ms.
If one or more of these conditions are not fulfilled, then an in-depth analysis has to be performed by the QPS team.
%% Cell type:code id: tags:
``` python
analysis.create_timestamp_table(timestamp_dct)
```
%% Cell type:markdown id: tags:
# 4. PC
## 4.1. Main Current
*GRAPHS*:
- t = 0 s corresponds to the start of the test
%% Cell type:code id: tags:
``` python
ax = i_meas_df.plot(figsize=(30, 10), grid=True)
ax.set_xlabel("time, [s]", fontsize=15)
ax.set_ylabel("I_MEAS, [A]", fontsize=15)
ax.tick_params(labelsize=15)
```
%% Cell type:markdown id: tags:
# 5. Quench Protection System
The signal names used for quench detection are shown in the figures above (picture from A. Erokhin).
**Quench Detector Type**
DQQDC - current leads quench detector
DQAMG - controller attached to global protection
**Current Leads:**
- Typical resistance for U_RES: 7 uOhm
- Threshold for U_HTS: 3 mV, 1s
- Polarity convention: Arrows show how signals are measured. If I > 0, LD1: U_RES > 0, LD2: U_RES < 0
- PM file
- Buffer range 0 to 250, event at point 50
- Time range: -10 to 40 s
- Frequency: 5 Hz (dt = 200 ms)
**Magnet:**
- See polarity convention in the circuit schematics
- U_RES_B1 = U_1_B1 + U_2_B1
- Threshold on U_RES_B1: 100 mV, 10 ms
- U_RES_B2, U_1_B2, U_2_B2 and U_INDUCT_B2 are given for diagnostics only
- Signals are measured with -2.5 V offset and with the gain factor = 0.0012
- *Attention: B1 signals and B2 singals can be shifted by 4 ms from each other*
- If pure inductive signal and di/dt < 0:
- U_1_B1 = L di/dt < 0
- U_2_B1 = -L di/dt < 0
- PM file
- Buffer range 501 to 1500, event at point 1000
- Time range: -2 to 2 s
- Frequency: 250 Hz (dt = 4 ms)
%% Cell type:markdown id: tags:
## 5.1. Resistive Voltage
*GRAPHS*:
- t = 0 s corresponds to the start of the test
%% Cell type:code id: tags:
``` python
analysis.plot_u_res(circuit_name, timestamp_fgc, u_res_df, i_meas_df)
```
%% Cell type:markdown id: tags:
## 5.2. Current Leads
*CRITERIA*:
- quench detection for U_HTS for 2 consecutive datapoints above the threshold of 3 mV
- detection for U_RES for 2 consecutive datapoints above the threshold of 100 mV
*GRAPHS*:
- t = 0 s corresponds to the start of the test
%% Cell type:code id: tags:
``` python
analysis.analyze_leads_voltage(u_hts_dfs, circuit_name, timestamp_fgc, signal='U_HTS', value_min=-0.003, value_max=0.003)
```
%% Cell type:code id: tags:
``` python
analysis.analyze_leads_voltage(u_res_dfs, circuit_name, timestamp_fgc, signal='U_RES', value_min=-0.1, value_max=0.1)
```
%% Cell type:markdown id: tags:
# 6. Final Report
%% Cell type:code id: tags:
``` python
campaign = hwcb.get_campaign()
file_name_html = '{}_{}-{}-{}_report.html'.format(circuit_name, hwc_test, Time.to_datetime(t_start).strftime("%Y.%m.%d_%H%M%S"), analysis_start_time)
full_path = '/eos/project/l/lhcsm/hwc/IPD/{}/{}/{}/{}'.format(circuit_name, hwc_test, campaign, file_name_html)
!mkdir -p /eos/project/l/lhcsm/hwc/IPD/$circuit_name/$hwc_test/$campaign
print('Compact notebook report saved to (Windows): ' + '\\\\cernbox-smb' + full_path.replace('/', '\\'))
display(Javascript('IPython.notebook.save_notebook();'))
time.sleep(5)
!{sys.executable} -m jupyter nbconvert --to html $'AN_IPD_PLI1.c2.ipynb' --output /eos/project/l/lhcsm/hwc/IPD/$circuit_name/$hwc_test/$campaign/$file_name_html --TemplateExporter.exclude_input=True --TagRemovePreprocessor.remove_all_outputs_tags='["skip_output"]'
```
%% Cell type:code id: tags:
``` python
```
......
%% Cell type:markdown id: tags:
<h1><center>Analysis of a PLI3.c5 HWC Test in an IPD Circuit</center></h1>
Superconducting beam separation dipoles of four different types are required in the Experimental Insertions (IR 1, 2, 5 and 8) and the RF insertion (IR 4). Single aperture dipoles D1 (MBX) and twin aperture dipoles D2 (MBRC) are utilized in the Experimental Insertions. They bring the two beams of the LHC into collision at four separate points then separate the beams again beyond the collision point. In the RF Insertions two types of twin aperture dipoles, each type with two different aperture spacings are used: D3 (MBRS) and D4 (MBRB). The D3 and D4 magnets increase the separation of the beams in IR 4 from the nominal spacing 194 mm to 420 mm. D2 and D4 are the twin apertures magnets with common iron core for both apertures. D3 is a twin apertures magnet with independent iron cores for each aperture.
The MBRC dipole consists of two individually powered apertures assembled in a common yoke structure.
- MBX – D1
Single aperture of the magnet powered with one power supply.
- MBRC – D2
- MBRB – D4
Apertures B1 and B2 of the magnet are powered in series with one power supply.
- MBRS - D3
Apertures B1 and B2 of the magnet are powered in series with one power supply but series connection done in the DFBA.
|Magnets in the Circuit|Temperature|Position|General information|
|----------------------|-----------|--------|-------------------|
|MBX (D1)|1.9 K| RD1.R2, RD1.R8|I Nominal: 5800A, I_Ultimate: 6100A|
| | | |L tot: 26 mH, L per aperture: 26 mH|
| | | |max(di/dt): 17.453 A/s|
|MBRC (D2)|4.5 K| RD2.L1, RD2.R1, RD2.L5, RD2.R5|I Nominal: 4400A, I_Ultimate: 4670A|
| | | RD2.L2, RD2.R2, RD2.L8, RD2.R8|I Nominal: 6000A, I_Ultimate: 6500A|
| | | |L tot: 52 mH, L per aperture: 26 mH|
| | | |max(di/dt): 18.147 A/s|
|MBRS (D3)|4.5 K| RD3.L4, RD3.R4|I Nominal: 5520A, I_Ultimate: 6000A|
| | | |L tot: 26 mH, L per aperture: 26 mH|
| | | |max(di/dt): 18.147 A/s|
|MBRB (D4)|4.5 K| RD4.L4, RD4.R4|I Nominal: 5520A, I_Ultimate: 6000A|
| | | |L tot: 26 mH, L per aperture: 26 mH|
| | | |max(di/dt): 18.147 A/s|
### PLI3.C5 – MEASUREMENT OF SPLICE RESISTANCE AND FAST POWER ABORT AT INTERMEDIATE CURRENT
The aim of this test is to carry out electrical measurements to evaluate the superconducting splices and to verify the correct performance of the power converter, the superconducting components and generation of a PM file after a fast power abort.
<img src="https://gitlab.cern.ch/LHCData/lhc-sm-hwc/-/raw/master/figures/ipd/PLI3_current.png" width=75%>
<center>IPD currents during PLI3.C5. Note: the actual parameters are listed in Appendix 1.</center>
Offline analyses are listed below:
|Responsible|Type of Analysis|Criteria|
|-----------|----------------|--------|
|PC|Analysis of the current and waveform decay.|Agreement of V_MEAS(t) and I_MEAS(t) to the theoretical decay curve withing a tolerance of 10 %.
|MP3|Check if QPS PM event was created (it is not expected).||
| |Check if FGC PM event was created (it is expected).||
|MP3|Calculate splice resistances| $R_\text{max}$ < 5 nOhm|
|MP3|Check DFB regulation|$T_\text{top HTS}$ = temperature at 0 A current +/- 4K|
| | |$T_\text{top Cu}$ = temperature at 0 A current +/- 10K|
%% Cell type:markdown id: tags:
# Analysis Assumptions
- We consider standard analysis scenarios, i.e., all signals can be queried. If a signal is missing, an analysis can raise a warning and continue or an error and abort the analysis.
- In case a signal is not needed for the analysis, a particular analysis is skipped. In other words, all signals have to be available in order to perform an analysis.
- It is recommended to execute each cell one after another. However, since the signals are queried prior to analysis, any order of execution is allowed. In case an analysis cell is aborted, the following ones may not be executed (e.g. I\_MEAS not present).
# Plot Convention
- Scales are labeled with signal name followed by a comma and a unit in square brackets, e.g., I_MEAS, [A].
- If a reference signal is present, it is represented with a dashed line.
- If the main current is present, its axis is on the left. Remaining signals are attached to the axis on the right. The legend of these signals is located on the lower left and upper right, respectively.
- The grid comes from the left axis.
- The title contains timestamp, circuit name, and signal name allowing to re-access the signal.
- The plots assigned to the left scale have colors: blue (C0) and orange (C1). Plots presented on the right have colors red (C2) and green (C3).
- Each plot has an individual time-synchronization mentioned explicitly in the description.
- If an axis has a single signal, then the color of the label matches the signal's color. Otherwise, the label color is black.
%% Cell type:markdown id: tags:
# 0. Initialise Working Environment
%% Cell type:code id: tags:
``` python
import io
import re
import sys
import pandas as pd
import numpy as np
from datetime import datetime
import time
from IPython.display import display, Javascript, HTML
from lhcsmapi.Time import Time
from lhcsmapi.Timer import Timer
from lhcsmapi.analysis.expert_input import get_expert_decision
from lhcsmapi.analysis.report_template import apply_report_template
from lhcsmapi.analysis.IpdCircuitQuery import IpdCircuitQuery
from lhcsmapi.analysis.IpdCircuitAnalysis import IpdCircuitAnalysis
from lhcsmapi.pyedsl.AssertionBuilder import AssertionBuilder
from lhcsmapi.pyedsl.PlotBuilder import PlotBuilder
# GUI
from lhcsmapi.gui.hwc.HwcSearchModuleMediator import HwcSearchModuleMediator
analysis_start_time = datetime.now().strftime("%Y.%m.%d_%H%M%S")
import lhcsmapi
print('Analysis executed with lhcsmapi version: {}'.format(lhcsmapi.__version__))
with io.open("../__init__.py", "rt", encoding="utf8") as f:
version = re.search(r'__version__ = "(.*?)"', f.read()).group(1)
print('Analysis executed with lhc-sm-hwc notebooks version: {}'.format(version))
```
%% Cell type:markdown id: tags:
# 1. Select HWC Test
%% Cell type:code id: tags:
``` python
circuit_type = 'IPD'
hwc_test = 'PLI3.c5'
hwcb = HwcSearchModuleMediator(circuit_type=circuit_type, hwc_test=hwc_test, hwc_summary_path='/eos/project/l/lhcsm/hwc/HWC_Summary.csv')
```
%% Cell type:markdown id: tags:
# 2. Query All Signals Prior to Analysis
%% Cell type:code id: tags:skip_output
``` python
with Timer():
circuit_name = hwcb.get_circuit_name()
t_start = Time.to_unix_timestamp(hwcb.get_start_time())
t_end = Time.to_unix_timestamp(hwcb.get_end_time())
author = hwcb.get_author()
is_automatic = hwcb.is_automatic_mode()
query = IpdCircuitQuery(circuit_type, circuit_name, max_executions=11)
analysis = IpdCircuitAnalysis(query.circuit_type, pd.DataFrame())
# PC
i_meas_df = query.query_signal_nxcals(t_start, t_end, system='PC', signal_names='I_MEAS', spark=spark)[0]
i_meas_df = query.query_signal_nxcals(t_start, t_end, t0=t_start, system='PC', signal_names='I_MEAS', spark=spark)[0]
i_meas_raw_df = query.query_raw_signal_nxcals(t_start, t_end, system='PC', signal_names='I_MEAS', spark=spark)[0]
source_timestamp_df = query.find_source_timestamp_pc(t_start, t_end)
timestamp_fgc = source_timestamp_df.at[0, 'timestamp']
# PIC
timestamp_pic = query.find_timestamp_pic(timestamp_fgc, spark=spark)
# QDS
source_timestamp_qds_df = query.find_source_timestamp_qds(timestamp_fgc, duration=[(2, 's'), (2, 's')])
timestamp_qds = np.nan if source_timestamp_qds_df.empty else source_timestamp_qds_df.loc[0, 'timestamp']
signal_names = 'U_RES_B1' if query.circuit_type == 'IPD2_B1B2' else 'U_RES'
u_res_df = query.query_signal_nxcals(t_start, t_end, system='QDS', signal_names=signal_names, spark=spark)[0]
u_res_df = query.query_signal_nxcals(t_start, t_end, t0=t_start, system='QDS', signal_names=signal_names, spark=spark)[0]
# Splice resitance
plateau_start, plateau_end = analysis.find_plateau_start_and_end(i_meas_raw_df, i_meas_threshold=0, min_duration_in_sec=60, time_shift_in_sec=(30, 10))
u_res_raw_df = query.query_raw_signal_nxcals(t_start, t_end, system='QDS', signal_names=['U_RES'], spark=spark)[0]
# LEADS
u_hts_dfs = query.query_leads(t_start, source_timestamp_qds_df.drop_duplicates('source') if not source_timestamp_qds_df.empty else pd.DataFrame(), system='LEADS', signal_names=['U_HTS'], spark=spark, duration=[(t_end-t_start, 'ns')])
u_res_dfs = query.query_leads(t_start, source_timestamp_qds_df.drop_duplicates('source') if not source_timestamp_qds_df.empty else pd.DataFrame(), system='LEADS', signal_names=['U_RES'], spark=spark, duration=[(t_end-t_start, 'ns')])
tt893_nxcals_dfs = query.query_dfb_signal_nxcals(t_start, t_end, system='LEADS_NXCALS_WINCCOA', signal_names='TT893', spark=spark)
tt891a_nxcals_dfs = query.query_dfb_signal_nxcals(t_start, t_end, system='LEADS_NXCALS_WINCCOA', signal_names='TT891A', spark=spark)
timestamp_dct = {'FGC': timestamp_fgc, 'PIC': timestamp_pic,
'QDS_A':source_timestamp_qds_df.loc[0, 'timestamp'] if len(source_timestamp_qds_df) > 0 else np.nan,
'QDS_B':source_timestamp_qds_df.loc[1, 'timestamp'] if len(source_timestamp_qds_df) > 1 else np.nan}
```
%% Cell type:markdown id: tags:
# 3. Timestamps
The analysis for MP3 consists of checking the existence of PM file and of consistency of the PM timestamps (PC, QPS). The criterion of passing this test described in detail in 600APIC2.
In short the following criteria should be checked:
- The PC timestamp (51_self) is QPS timestamp +-20 ms.
- The difference between QPS board A and B timestamp = 1ms.
If one or more of these conditions are not fulfilled, then an in-depth analysis has to be performed by the QPS team.
%% Cell type:code id: tags:
``` python
analysis.create_timestamp_table(timestamp_dct)
```
%% Cell type:markdown id: tags:
# 4. PC
## 4.1. Main Current
*GRAPHS*:
- t = 0 s corresponds to the start of the test
%% Cell type:code id: tags:
``` python
title = '%s, %s: %s-%s' % (circuit_name, hwc_test, Time.to_string(t_start).split('.')[0], Time.to_string(t_end).split('.')[0])
analysis.plot_i_meas_with_current_plateau(i_meas_df, t0=i_meas_raw_df.index[0], plateau_start=plateau_start, plateau_end=plateau_end, title=title)
```
%% Cell type:markdown id: tags:
## 4.2. Splice Resistance
*ANALYSIS*:
- Calculate splice resistance values based on power converter currents and QDS voltages
*CRITERIA*
- Check if R_max < 5 nOhm
*GRAPHS*:
- t = 0 s corresponds to the start of the test
%% Cell type:code id: tags:
``` python
title = '%s, %s: %s-%s' % (circuit_name, hwc_test, Time.to_string(t_start).split('.')[0], Time.to_string(t_end).split('.')[0])
analysis.plot_i_meas_u_res_current_plateau(i_meas_df, u_res_df, t0=i_meas_raw_df.index[0], plateau_start=plateau_start, plateau_end=plateau_end, title=title)
```
%% Cell type:code id: tags:
``` python
res = analysis.calculate_splice_resistance_linreg(u_res_raw_df, i_meas_raw_df, plateau_start, plateau_end)
```
%% Cell type:code id: tags:
``` python
res_df = pd.DataFrame({'R_RES': {'R': res}})
analysis.analyze_busbar_magnet_resistance(res_df, 'R_RES', 5e-9)
```
%% Cell type:markdown id: tags:
# 5. Quench Protection System
The signal names used for quench detection are shown in the figures above (picture from A. Erokhin).
**Quench Detector Type**
DQQDC - current leads quench detector
DQAMG - controller attached to global protection
**Current Leads:**
- Typical resistance for U_RES: 7 uOhm
- Threshold for U_HTS: 3 mV, 1s
- Polarity convention: Arrows show how signals are measured. If I > 0, LD1: U_RES > 0, LD2: U_RES < 0
- PM file
- Buffer range 0 to 250, event at point 50
- Time range: -10 to 40 s
- Frequency: 5 Hz (dt = 200 ms)
**Magnet:**
- See polarity convention in the circuit schematics
- U_RES_B1 = U_1_B1 + U_2_B1
- Threshold on U_RES_B1: 100 mV, 10 ms
- U_RES_B2, U_1_B2, U_2_B2 and U_INDUCT_B2 are given for diagnostics only
- Signals are measured with -2.5 V offset and with the gain factor = 0.0012
- *Attention: B1 signals and B2 singals can be shifted by 4 ms from each other*
- If pure inductive signal and di/dt < 0:
- U_1_B1 = L di/dt < 0
- U_2_B1 = -L di/dt < 0
- PM file
- Buffer range 501 to 1500, event at point 1000
- Time range: -2 to 2 s
- Frequency: 250 Hz (dt = 4 ms)
%% Cell type:markdown id: tags:
## 5.1. Resistive Voltage
*GRAPHS*:
- t = 0 s corresponds to the start of the test
%% Cell type:code id: tags:
``` python
analysis.plot_u_res(circuit_name, timestamp_fgc, u_res_df, i_meas_df)
```
%% Cell type:markdown id: tags:
## 5.2. Current Leads
*CRITERIA*:
- quench detection for U_HTS for 2 consecutive datapoints above the threshold of 3 mV
- detection for U_RES for 2 consecutive datapoints above the threshold of 100 mV
*GRAPHS*:
- t = 0 s corresponds to the start of the test
%% Cell type:code id: tags:
``` python
analysis.analyze_leads_voltage(u_hts_dfs, circuit_name, timestamp_fgc, signal='U_HTS', value_min=-0.003, value_max=0.003)
```
%% Cell type:code id: tags:
``` python
analysis.analyze_leads_voltage(u_res_dfs, circuit_name, timestamp_fgc, signal='U_RES', value_min=-0.1, value_max=0.1)
```
%% Cell type:markdown id: tags:
## 5.3. DFB Regulation
*CRITERIA*
- Check if the temperatures TT893 at the top of the copper part of the four current leads, is over dew point, but not overheated: TT893(0 current) - 4 K < TT893 < TT893(0 current) + 4 K
- Check if the temperatures TT891A at the top of the HTS part of the four current leads, is regulated around TT891A(0 current): TT891A(0 current) - 10 K < TT891A < TT891A(0 current) + 10 K, even without current
*GRAPHS*:
- t = 0 s corresponds to the start of the test
%% Cell type:code id: tags:
``` python
t_no_current = i_meas_df[i_meas_df.index < 10]['I_MEAS'].idxmin()
t_no_current = i_meas_df.iloc[0, 0]
temp_no_current = max([df[df.index == df.index.get_loc(t_no_current, 'nearest')].values[0][0] for df in tt893_nxcals_dfs])
analysis.assert_tt893_min_max_value(tt893_nxcals_dfs, i_meas_df, value_range=(temp_no_current-4, temp_no_current+4))
```
%% Cell type:code id: tags:
``` python
t_no_current = i_meas_df[i_meas_df.index < 10]['I_MEAS'].idxmin()
t_no_current = i_meas_df.iloc[0,0]
temp_no_current = max([df[df.index == df.index.get_loc(t_no_current, 'nearest')].values[0][0] for df in tt891a_nxcals_dfs])
analysis.assert_tt891a_min_max_value(tt891a_nxcals_dfs, i_meas_df, value_range=(temp_no_current-10, temp_no_current+10))
```
%% Cell type:markdown id: tags:
# 6. Final Report
%% Cell type:code id: tags:
``` python
campaign = hwcb.get_campaign()
file_name_html = '{}_{}-{}-{}_report.html'.format(circuit_name, hwc_test, Time.to_datetime(t_start).strftime("%Y.%m.%d_%H%M%S"), analysis_start_time)
full_path = '/eos/project/l/lhcsm/hwc/IPD/{}/{}/{}/{}'.format(circuit_name, hwc_test, campaign, file_name_html)
!mkdir -p /eos/project/l/lhcsm/hwc/IPD/$circuit_name/$hwc_test/$campaign
print('Compact notebook report saved to (Windows): ' + '\\\\cernbox-smb' + full_path.replace('/', '\\'))
display(Javascript('IPython.notebook.save_notebook();'))
time.sleep(5)
!{sys.executable} -m jupyter nbconvert --to html $'AN_IPD_PLI3.c5.ipynb' --output /eos/project/l/lhcsm/hwc/IPD/$circuit_name/$hwc_test/$campaign/$file_name_html --TemplateExporter.exclude_input=True --TagRemovePreprocessor.remove_all_outputs_tags='["skip_output"]'
```
%% Cell type:code id: tags:
``` python
```
......
%% Cell type:markdown id: tags:
<h1><center>Analysis of a PNO.a8 HWC Test in an IPD Circuit</center></h1>
Superconducting beam separation dipoles of four different types are required in the Experimental Insertions (IR 1, 2, 5 and 8) and the RF insertion (IR 4). Single aperture dipoles D1 (MBX) and twin aperture dipoles D2 (MBRC) are utilized in the Experimental Insertions. They bring the two beams of the LHC into collision at four separate points then separate the beams again beyond the collision point. In the RF Insertions two types of twin aperture dipoles, each type with two different aperture spacings are used: D3 (MBRS) and D4 (MBRB). The D3 and D4 magnets increase the separation of the beams in IR 4 from the nominal spacing 194 mm to 420 mm. D2 and D4 are the twin apertures magnets with common iron core for both apertures. D3 is a twin apertures magnet with independent iron cores for each aperture.
The MBRC dipole consists of two individually powered apertures assembled in a common yoke structure.
- MBX – D1
Single aperture of the magnet powered with one power supply.
- MBRC – D2
- MBRB – D4
Apertures B1 and B2 of the magnet are powered in series with one power supply.
- MBRS - D3
Apertures B1 and B2 of the magnet are powered in series with one power supply but series connection done in the DFBA.
|Magnets in the Circuit|Temperature|Position|General information|
|----------------------|-----------|--------|-------------------|
|MBX (D1)|1.9 K| RD1.R2, RD1.R8|I Nominal: 5800A, I_Ultimate: 6100A|
| | | |L tot: 26 mH, L per aperture: 26 mH|
| | | |max(di/dt): 17.453 A/s|
|MBRC (D2)|4.5 K| RD2.L1, RD2.R1, RD2.L5, RD2.R5|I Nominal: 4400A, I_Ultimate: 4670A|
| | | RD2.L2, RD2.R2, RD2.L8, RD2.R8|I Nominal: 6000A, I_Ultimate: 6500A|
| | | |L tot: 52 mH, L per aperture: 26 mH|
| | | |max(di/dt): 18.147 A/s|
|MBRS (D3)|4.5 K| RD3.L4, RD3.R4|I Nominal: 5520A, I_Ultimate: 6000A|
| | | |L tot: 26 mH, L per aperture: 26 mH|
| | | |max(di/dt): 18.147 A/s|
|MBRB (D4)|4.5 K| RD4.L4, RD4.R4|I Nominal: 5520A, I_Ultimate: 6000A|
| | | |L tot: 26 mH, L per aperture: 26 mH|
| | | |max(di/dt): 18.147 A/s|
### PNO.A8 - POWERING TO I_PNO + I_DELTA
The aim of this test is to ramp the IPD to I_PNO + I_DELTA. Training quenches of magnets in the circuits should be expected.
<img src="https://gitlab.cern.ch/LHCData/lhc-sm-hwc/-/raw/master/figures/ipd/PNO.a8_current.png" width=75%>
<center>IPD currents during PNO.a8. Note: the actual parameters are listed in Appendix 1.</center>
Offline analyses are listed below:
|Responsible|Type of Analysis|Criteria|
|-----------|----------------|--------|
|MP3|Check if QPS tripped.||
| |Check if PM file was created.||
|MP3|Quench analysis|The signals have to be compared to the reference signals, and should agree within the limits given below:|
| |Check heater voltages (U_HDS_1; U_HDS_2) during the discharge, and their decay time constant | U_HDS: +/- 5%|
| | | $\tau$_HDS +/- 5%|
| |Check the heater delay from the quench signal | t_delay +/- 5 ms|
%% Cell type:markdown id: tags:
# Analysis Assumptions
- We consider standard analysis scenarios, i.e., all signals can be queried. If a signal is missing, an analysis can raise a warning and continue or an error and abort the analysis.
- In case a signal is not needed for the analysis, a particular analysis is skipped. In other words, all signals have to be available in order to perform an analysis.
- It is recommended to execute each cell one after another. However, since the signals are queried prior to analysis, any order of execution is allowed. In case an analysis cell is aborted, the following ones may not be executed (e.g. I\_MEAS not present).
# Plot Convention
- Scales are labeled with signal name followed by a comma and a unit in square brackets, e.g., I_MEAS, [A].
- If a reference signal is present, it is represented with a dashed line.
- If the main current is present, its axis is on the left. Remaining signals are attached to the axis on the right. The legend of these signals is located on the lower left and upper right, respectively.
- The grid comes from the left axis.
- The title contains timestamp, circuit name, and signal name allowing to re-access the signal.
- The plots assigned to the left scale have colors: blue (C0) and orange (C1). Plots presented on the right have colors red (C2) and green (C3).
- Each plot has an individual time-synchronization mentioned explicitly in the description.
- If an axis has a single signal, then the color of the label matches the signal's color. Otherwise, the label color is black.
%% Cell type:markdown id: tags:
# 0. Initialise Working Environment
%% Cell type:code id: tags:
``` python
import io
import re
import sys
import pandas as pd
import numpy as np
from datetime import datetime
import time
from IPython.display import display, Javascript, HTML
from lhcsmapi.Time import Time
from lhcsmapi.Timer import Timer
from lhcsmapi.analysis.expert_input import get_expert_decision
from lhcsmapi.analysis.report_template import apply_report_template
from lhcsmapi.analysis.IpdCircuitQuery import IpdCircuitQuery
from lhcsmapi.analysis.IpdCircuitAnalysis import IpdCircuitAnalysis
from lhcsmapi.pyedsl.AssertionBuilder import AssertionBuilder
from lhcsmapi.pyedsl.PlotBuilder import PlotBuilder
# GUI
from lhcsmapi.gui.hwc.HwcSearchModuleMediator import HwcSearchModuleMediator
analysis_start_time = datetime.now().strftime("%Y.%m.%d_%H%M%S")
import lhcsmapi
print('Analysis executed with lhcsmapi version: {}'.format(lhcsmapi.__version__))
with io.open("../__init__.py", "rt", encoding="utf8") as f:
version = re.search(r'__version__ = "(.*?)"', f.read()).group(1)
print('Analysis executed with lhc-sm-hwc notebooks version: {}'.format(version))
```
%% Cell type:markdown id: tags:
# 1. Select HWC Test
%% Cell type:code id: tags:
``` python
circuit_type = 'IPD'
hwc_test = 'PNO.a8'
hwcb = HwcSearchModuleMediator(circuit_type=circuit_type, hwc_test=hwc_test, hwc_summary_path='/eos/project/l/lhcsm/hwc/HWC_Summary.csv')
```
%% Cell type:markdown id: tags:
# 2. Query All Signals Prior to Analysis
%% Cell type:code id: tags:skip_output
``` python
with Timer():
circuit_name = hwcb.get_circuit_name()
t_start = Time.to_unix_timestamp(hwcb.get_start_time())
t_end = Time.to_unix_timestamp(hwcb.get_end_time())
author = hwcb.get_author()
is_automatic = hwcb.is_automatic_mode()
query = IpdCircuitQuery(circuit_type, circuit_name, max_executions=12)
analysis = IpdCircuitAnalysis(query.circuit_type, pd.DataFrame())
# PC
i_meas_df = query.query_signal_nxcals(t_start, t_end, system='PC', signal_names='I_MEAS', spark=spark)[0]
i_meas_df = query.query_signal_nxcals(t_start, t_end, t0=t_start, system='PC', signal_names='I_MEAS', spark=spark)[0]
i_meas_raw_df = query.query_raw_signal_nxcals(t_start, t_end, system='PC', signal_names='I_MEAS', spark=spark)[0]
source_timestamp_df = query.find_source_timestamp_pc(t_start, t_end)
timestamp_fgc = source_timestamp_df.at[0, 'timestamp']
# PIC
timestamp_pic = query.find_timestamp_pic(timestamp_fgc, spark=spark)
# QDS
source_timestamp_qds_df = query.find_source_timestamp_qds(timestamp_fgc, duration=[(2, 's'), (2, 's')])
timestamp_qds = np.nan if source_timestamp_qds_df.empty else source_timestamp_qds_df.loc[0, 'timestamp']
signal_names = 'U_RES_B1' if query.circuit_type == 'IPD2_B1B2' else 'U_RES'
u_res_df = query.query_signal_nxcals(t_start, t_end, system='QDS', signal_names=signal_names, spark=spark)[0]
u_res_df = query.query_signal_nxcals(t_start, t_end, t0=t_start, system='QDS', signal_names=signal_names, spark=spark)[0]
# QH
u_hds_dfss = query.query_qh_pm(source_timestamp_qds_df.drop_duplicates('source') if not source_timestamp_qds_df.empty else pd.DataFrame(), signal_names=['U_HDS'])
u_hds_dfs = u_hds_dfss[0] if u_hds_dfss else []
# # Reference
u_hds_ref_dfss = query.query_qh_pm(source_timestamp_qds_df.drop_duplicates('source') if not source_timestamp_qds_df.empty else pd.DataFrame(), signal_names=['U_HDS'], is_ref=True)
u_hds_ref_dfs = u_hds_ref_dfss[0] if u_hds_ref_dfss else []
# Splice resitance
plateau_start, plateau_end = analysis.find_plateau_start_and_end(i_meas_raw_df, i_meas_threshold=0, min_duration_in_sec=40, time_shift_in_sec=(10, 10))
u_res_raw_df = query.query_raw_signal_nxcals(t_start, t_end, system='QDS', signal_names=['U_RES'], spark=spark)[0]
# LEADS
u_hts_dfs = query.query_leads(t_start, source_timestamp_qds_df.drop_duplicates('source') if not source_timestamp_qds_df.empty else pd.DataFrame(), system='LEADS', signal_names=['U_HTS'], spark=spark, duration=[(t_end-t_start, 'ns')])
u_res_dfs = query.query_leads(t_start, source_timestamp_qds_df.drop_duplicates('source') if not source_timestamp_qds_df.empty else pd.DataFrame(), system='LEADS', signal_names=['U_RES'], spark=spark, duration=[(t_end-t_start, 'ns')])
timestamp_dct = {'FGC': timestamp_fgc, 'PIC': timestamp_pic,
'QDS_A':source_timestamp_qds_df.loc[0, 'timestamp'] if len(source_timestamp_qds_df) > 0 else np.nan,
'QDS_B':source_timestamp_qds_df.loc[1, 'timestamp'] if len(source_timestamp_qds_df) > 1 else np.nan}
```
%% Cell type:markdown id: tags:
# 3. Timestamps
The analysis for MP3 consists of checking the existence of PM events and of consistency of the PM timestamps (PC, QPS). The criterion of passing this test described in detail in 600APIC2.
In short the following criteria should be checked:
- The PC timestamp (51_self) is QPS timestamp +-20 ms.
- The difference between QPS board A and B timestamp = 1ms.
If one or more of these conditions are not fulfilled, then an in-depth analysis has to be performed by the QPS team.
%% Cell type:code id: tags:
``` python
analysis.create_timestamp_table(timestamp_dct)
```
%% Cell type:markdown id: tags:
# 4. PC
## 4.1. Main Current
*GRAPHS*:
- t = 0 s corresponds to the start of the test
%% Cell type:code id: tags:
``` python
title = '%s, %s: %s-%s' % (circuit_name, hwc_test, Time.to_string(t_start).split('.')[0], Time.to_string(t_end).split('.')[0])
analysis.plot_i_meas_with_current_plateau(i_meas_df, t0=i_meas_raw_df.index[0], plateau_start=plateau_start, plateau_end=plateau_end, title=title)
```
%% Cell type:markdown id: tags:
# 5. Quench Protection System
The signal names used for quench detection are shown in the figures above (picture from A. Erokhin).
**Quench Detector Type**
DQQDC - current leads quench detector
DQAMG - controller attached to global protection
**Current Leads:**
- Typical resistance for U_RES: 7 uOhm
- Threshold for U_HTS: 3 mV, 1s
- Polarity convention: Arrows show how signals are measured. If I > 0, LD1: U_RES > 0, LD2: U_RES < 0
- PM file
- Buffer range 0 to 250, event at point 50
- Time range: -10 to 40 s
- Frequency: 5 Hz (dt = 200 ms)
**Magnet:**
- See polarity convention in the circuit schematics
- U_RES_B1 = U_1_B1 + U_2_B1
- Threshold on U_RES_B1: 100 mV, 10 ms
- U_RES_B2, U_1_B2, U_2_B2 and U_INDUCT_B2 are given for diagnostics only
- Signals are measured with -2.5 V offset and with the gain factor = 0.0012
- *Attention: B1 signals and B2 singals can be shifted by 4 ms from each other*
- If pure inductive signal and di/dt < 0:
- U_1_B1 = L di/dt < 0
- U_2_B1 = -L di/dt < 0
- PM file
- Buffer range 501 to 1500, event at point 1000
- Time range: -2 to 2 s
- Frequency: 250 Hz (dt = 4 ms)
%% Cell type:markdown id: tags:
## 5.1. Resistive Voltage
*GRAPHS*:
- t = 0 s corresponds to the start of the test
%% Cell type:code id: tags:
``` python
analysis.plot_u_res(circuit_name, timestamp_fgc, u_res_df, i_meas_df)
```
%% Cell type:markdown id: tags:
## 5.2. Splice Resistance
*ANALYSIS*:
- Calculate splice resistance values based on power converter currents and QDS voltages
*CRITERIA*
- Check if R_max < 5 nOhm
*GRAPHS*:
- t = 0 s corresponds to the start of the test
%% Cell type:code id: tags:
``` python
title = '%s, %s: %s-%s' % (circuit_name, hwc_test, Time.to_string(t_start).split('.')[0], Time.to_string(t_end).split('.')[0])
analysis.plot_i_meas_u_res_current_plateau(i_meas_df, u_res_df, t0=i_meas_raw_df.index[0], plateau_start=plateau_start, plateau_end=plateau_end, title=title)
```
%% Cell type:code id: tags:
``` python
res = analysis.calculate_splice_resistance_linreg(u_res_raw_df, i_meas_raw_df, plateau_start, plateau_end)
```
%% Cell type:code id: tags:
``` python
res_df = pd.DataFrame({'R_RES': {'R': res}})
analysis.analyze_busbar_magnet_resistance(res_df, 'R_RES', 5e-9)
```
%% Cell type:markdown id: tags:
## 5.3. Current Leads
*CRITERIA*:
- quench detection for U_HTS for 2 consecutive datapoints above the threshold of 3 mV
- detection for U_RES for 2 consecutive datapoints above the threshold of 100 mV
*GRAPHS*:
- t = 0 s corresponds to the start of the test
%% Cell type:code id: tags:
``` python
analysis.analyze_leads_voltage(u_hts_dfs, circuit_name, timestamp_qds, signal='U_HTS', value_min=-0.003, value_max=0.003)
```
%% Cell type:code id: tags:
``` python
analysis.analyze_leads_voltage(u_res_dfs, circuit_name, timestamp_qds, signal='U_RES', value_min=-0.1, value_max=0.1)
```
%% Cell type:markdown id: tags:
## 5.4. Quench Heaters
*CRITERIA*:
- all characteristic times of an exponential decay calculated with the 'charge' approach for voltage is +/- 5 ms from the reference ones
- the initial voltage should be between 810 V and 1000 V
- the final voltage should be between 0 V and 10 V
*GRAPHS*:
- t = 0 s corresponds to the start of the pseudo-exponential decay
Voltage view (linear and log)
- the queried and filtered quench heater voltage on the left axis (actual signal continuous, reference dashed), U_HDS
%% Cell type:code id: tags:
``` python
if u_hds_dfs:
analysis.analyze_qh(circuit_name, timestamp_qds, u_hds_dfs, u_hds_ref_dfs)
else:
print('No Quench Heater discharges!')
```
%% Cell type:code id: tags:
``` python
analysis.find_voltage_threshold_detection(u_hts_dfs, threshold=0.003)
```
%% Cell type:markdown id: tags:
# 6. Final Report
%% Cell type:code id: tags:
``` python
campaign = hwcb.get_campaign()
file_name_html = '{}_{}-{}-{}_report.html'.format(circuit_name, hwc_test, Time.to_datetime(t_start).strftime("%Y.%m.%d_%H%M%S"), analysis_start_time)
full_path = '/eos/project/l/lhcsm/hwc/IPD/{}/{}/{}/{}'.format(circuit_name, hwc_test, campaign, file_name_html)
!mkdir -p /eos/project/l/lhcsm/hwc/IPD/$circuit_name/$hwc_test/$campaign
print('Compact notebook report saved to (Windows): ' + '\\\\cernbox-smb' + full_path.replace('/', '\\'))
display(Javascript('IPython.notebook.save_notebook();'))
time.sleep(5)
!{sys.executable} -m jupyter nbconvert --to html $'AN_IPD_PNO.a8.ipynb' --output /eos/project/l/lhcsm/hwc/IPD/$circuit_name/$hwc_test/$campaign/$file_name_html --TemplateExporter.exclude_input=True --TagRemovePreprocessor.remove_all_outputs_tags='["skip_output"]'
```
%% Cell type:code id: tags:
``` python
```
......
%% Cell type:markdown id: tags:
<h1><center>Analysis of a PNO.c6 HWC Test in an IPD Circuit</center></h1>
Superconducting beam separation dipoles of four different types are required in the Experimental Insertions (IR 1, 2, 5 and 8) and the RF insertion (IR 4). Single aperture dipoles D1 (MBX) and twin aperture dipoles D2 (MBRC) are utilized in the Experimental Insertions. They bring the two beams of the LHC into collision at four separate points then separate the beams again beyond the collision point. In the RF Insertions two types of twin aperture dipoles, each type with two different aperture spacings are used: D3 (MBRS) and D4 (MBRB). The D3 and D4 magnets increase the separation of the beams in IR 4 from the nominal spacing 194 mm to 420 mm. D2 and D4 are the twin apertures magnets with common iron core for both apertures. D3 is a twin apertures magnet with independent iron cores for each aperture.
The MBRC dipole consists of two individually powered apertures assembled in a common yoke structure.
- MBX – D1
Single aperture of the magnet powered with one power supply.
- MBRC – D2
- MBRB – D4
Apertures B1 and B2 of the magnet are powered in series with one power supply.
- MBRS - D3
Apertures B1 and B2 of the magnet are powered in series with one power supply but series connection done in the DFBA.
|Magnets in the Circuit|Temperature|Position|General information|
|----------------------|-----------|--------|-------------------|
|MBX (D1)|1.9 K| RD1.R2, RD1.R8|I Nominal: 5800A, I_Ultimate: 6100A|
| | | |L tot: 26 mH, L per aperture: 26 mH|
| | | |max(di/dt): 17.453 A/s|
|MBRC (D2)|4.5 K| RD2.L1, RD2.R1, RD2.L5, RD2.R5|I Nominal: 4400A, I_Ultimate: 4670A|
| | | RD2.L2, RD2.R2, RD2.L8, RD2.R8|I Nominal: 6000A, I_Ultimate: 6500A|
| | | |L tot: 52 mH, L per aperture: 26 mH|
| | | |max(di/dt): 18.147 A/s|
|MBRS (D3)|4.5 K| RD3.L4, RD3.R4|I Nominal: 5520A, I_Ultimate: 6000A|
| | | |L tot: 26 mH, L per aperture: 26 mH|
| | | |max(di/dt): 18.147 A/s|
|MBRB (D4)|4.5 K| RD4.L4, RD4.R4|I Nominal: 5520A, I_Ultimate: 6000A|
| | | |L tot: 26 mH, L per aperture: 26 mH|
| | | |max(di/dt): 18.147 A/s|
This section is a copy of a document created by Alexandre Erokhin (https://twiki.cern.ch/twiki/pub/MP3/General_Info_IPD/separation_dipole.pdf)
### PNO.C6 – FAST POWER ABORT AT NOMINAL CURRENT AND LEAD TEST
The aim of this test is to verify the correct performance of the current leads at operational current and evaluate the converter and magnet performance after a fast power abort from nominal current.
<img src="https://gitlab.cern.ch/LHCData/lhc-sm-hwc/-/raw/master/figures/ipd/PLI3_current.png" width=50%>
<center>IPD currents during PNO.c6. Note: the actual parameters are listed in Appendix 1.</center>
Offline analyses are listed below:
|Responsible|Type of Analysis|Criteria|
|-----------|----------------|--------|
|PC|Analysis of the current and waveform decay.|Agreement of V_MEAS(t) and I_MEAS(t) to the theoretical decay curve withing a tolerance of 10 %.
|MP3|Check if QPS tripped, i.e. QPS PM event was created (it is not expected).||
| |Check if FGC PM event was created (it is expected).||
|MP3|Calculate splice resistances| $R_\text{max}$ < 5 nOhm|
|MP3|Check DFB regulation|$T_\text{top HTS}$ = temperature at 0 A current +/- 4K|
| | |$T_\text{top Cu}$ = temperature at 0 A current +/- 10K|
|MP3|Quench analysis (in case of a quench)|The signals have to be compared to the reference signals, and should agree within the limits given below:|
| |Check heater voltages (U_HDS_1; U_HDS_2) during the discharge, and their decay time constant | U_HDS: +/- 5%|
| | | $\tau$_HDS +/- 5%|
| |Check the heater delay from the quench signal | t_delay +/- 5 ms|
%% Cell type:markdown id: tags:
# Analysis Assumptions
- We consider standard analysis scenarios, i.e., all signals can be queried. If a signal is missing, an analysis can raise a warning and continue or an error and abort the analysis.
- In case a signal is not needed for the analysis, a particular analysis is skipped. In other words, all signals have to be available in order to perform an analysis.
- It is recommended to execute each cell one after another. However, since the signals are queried prior to analysis, any order of execution is allowed. In case an analysis cell is aborted, the following ones may not be executed (e.g. I\_MEAS not present).
# Plot Convention
- Scales are labeled with signal name followed by a comma and a unit in square brackets, e.g., I_MEAS, [A].
- If a reference signal is present, it is represented with a dashed line.
- If the main current is present, its axis is on the left. Remaining signals are attached to the axis on the right. The legend of these signals is located on the lower left and upper right, respectively.
- The grid comes from the left axis.
- The title contains timestamp, circuit name, and signal name allowing to re-access the signal.
- The plots assigned to the left scale have colors: blue (C0) and orange (C1). Plots presented on the right have colors red (C2) and green (C3).
- Each plot has an individual time-synchronization mentioned explicitly in the description.
- If an axis has a single signal, then the color of the label matches the signal's color. Otherwise, the label color is black.
%% Cell type:markdown id: tags:
# 0. Initialise Working Environment
%% Cell type:code id: tags:
``` python
import io
import re
import sys
import pandas as pd
import numpy as np
from datetime import datetime
import time
from IPython.display import display, Javascript, HTML
from lhcsmapi.Time import Time
from lhcsmapi.Timer import Timer
from lhcsmapi.analysis.expert_input import get_expert_decision
from lhcsmapi.analysis.report_template import apply_report_template
from lhcsmapi.analysis.IpdCircuitQuery import IpdCircuitQuery
from lhcsmapi.analysis.IpdCircuitAnalysis import IpdCircuitAnalysis
from lhcsmapi.pyedsl.AssertionBuilder import AssertionBuilder
from lhcsmapi.pyedsl.PlotBuilder import PlotBuilder
# GUI
from lhcsmapi.gui.hwc.HwcSearchModuleMediator import HwcSearchModuleMediator
analysis_start_time = datetime.now().strftime("%Y.%m.%d_%H%M%S")
import lhcsmapi
print('Analysis executed with lhcsmapi version: {}'.format(lhcsmapi.__version__))
with io.open("../__init__.py", "rt", encoding="utf8") as f:
version = re.search(r'__version__ = "(.*?)"', f.read()).group(1)
print('Analysis executed with lhc-sm-hwc notebooks version: {}'.format(version))
```
%% Cell type:markdown id: tags:
# 1. Select HWC Test
%% Cell type:code id: tags:
``` python
circuit_type = 'IPD'
hwc_test = 'PNO.c6'
hwcb = HwcSearchModuleMediator(circuit_type=circuit_type, hwc_test=hwc_test, hwc_summary_path='/eos/project/l/lhcsm/hwc/HWC_Summary.csv')
```
%% Cell type:markdown id: tags:
# 2. Query All Signals Prior to Analysis
%% Cell type:code id: tags:skip_output
``` python
with Timer():
circuit_name = hwcb.get_circuit_name()
t_start = Time.to_unix_timestamp(hwcb.get_start_time())
t_end = Time.to_unix_timestamp(hwcb.get_end_time())
author = hwcb.get_author()
is_automatic = hwcb.is_automatic_mode()
query = IpdCircuitQuery(circuit_type, circuit_name, max_executions=9)
analysis = IpdCircuitAnalysis(query.circuit_type, pd.DataFrame())
# PC
i_meas_df = query.query_signal_nxcals(t_start, t_end, system='PC', signal_names='I_MEAS', spark=spark)[0]
i_meas_df = query.query_signal_nxcals(t_start, t_end, t0=t_start,system='PC', signal_names='I_MEAS', spark=spark)[0]
i_meas_raw_df = query.query_raw_signal_nxcals(t_start, t_end, system='PC', signal_names='I_MEAS', spark=spark)[0]
source_timestamp_df = query.find_source_timestamp_pc(t_start, t_end)
timestamp_fgc = source_timestamp_df.at[0, 'timestamp']
# PIC
timestamp_pic = query.find_timestamp_pic(timestamp_fgc, spark=spark)
# QDS
source_timestamp_qds_df = query.find_source_timestamp_qds(timestamp_fgc, duration=[(2, 's'), (2, 's')])
timestamp_qds = np.nan if source_timestamp_qds_df.empty else source_timestamp_qds_df.loc[0, 'timestamp']
signal_names = 'U_RES_B1' if query.circuit_type == 'IPD2_B1B2' else 'U_RES'
u_res_df = query.query_signal_nxcals(t_start, t_end, system='QDS', signal_names=signal_names, spark=spark)[0]
u_res_df = query.query_signal_nxcals(t_start, t_end, t0=t_start, system='QDS', signal_names=signal_names, spark=spark)[0]
# Splice resitance
plateau_start, plateau_end = analysis.find_plateau_start_and_end(i_meas_raw_df, i_meas_threshold=0, min_duration_in_sec=60, time_shift_in_sec=(30, 10))
u_res_raw_df = query.query_raw_signal_nxcals(t_start, t_end, system='QDS', signal_names=['U_RES'], spark=spark)[0]
# LEADS
u_hts_dfs = query.query_leads(t_start, source_timestamp_qds_df.drop_duplicates('source') if not source_timestamp_qds_df.empty else pd.DataFrame(), system='LEADS', signal_names=['U_HTS'], spark=spark, duration=[(t_end-t_start, 'ns')])
u_res_dfs = query.query_leads(t_start, source_timestamp_qds_df.drop_duplicates('source') if not source_timestamp_qds_df.empty else pd.DataFrame(), system='LEADS', signal_names=['U_RES'], spark=spark, duration=[(t_end-t_start, 'ns')])
tt893_nxcals_dfs = query.query_dfb_signal_nxcals(t_start, t_end, system='LEADS_NXCALS_WINCCOA', signal_names='TT893', spark=spark)
tt891a_nxcals_dfs = query.query_dfb_signal_nxcals(t_start, t_end, system='LEADS_NXCALS_WINCCOA', signal_names='TT891A', spark=spark)
timestamp_dct = {'FGC': timestamp_fgc, 'PIC': timestamp_pic,
'QDS_A':source_timestamp_qds_df.loc[0, 'timestamp'] if len(source_timestamp_qds_df) > 0 else np.nan,
'QDS_B':source_timestamp_qds_df.loc[1, 'timestamp'] if len(source_timestamp_qds_df) > 1 else np.nan}
```
%% Cell type:markdown id: tags:
# 3. Timestamps
It is expected that only the PC PM event was created and QPS did not trip (no PM event).
In case the QPS tripped, the analysis for MP3 consists of checking the existence of PM events and of consistency of the PM timestamps (PC, QPS).
In short the following criteria should be checked:
- The PC timestamp (51_self) is QPS timestamp +-20 ms.
- The difference between QPS board A and B timestamp = 1ms.
If one or more of these conditions are not fulfilled, then an in-depth analysis has to be performed by the QPS team.
%% Cell type:code id: tags:
``` python
analysis.create_timestamp_table(timestamp_dct)
```
%% Cell type:markdown id: tags:
# 4. PC
## 4.1. Main Current
*GRAPHS*:
- t = 0 s corresponds to the start of the test
%% Cell type:code id: tags:
``` python
title = '%s, %s: %s-%s' % (circuit_name, hwc_test, Time.to_string(t_start).split('.')[0], Time.to_string(t_end).split('.')[0])
analysis.plot_i_meas_with_current_plateau(i_meas_df, t0=i_meas_raw_df.index[0], plateau_start=plateau_start, plateau_end=plateau_end, title=title)
```
%% Cell type:markdown id: tags:
# 5. Quench Protection System
The signal names used for quench detection are shown in the figures above (picture from A. Erokhin).
**Quench Detector Type**
DQQDC - current leads quench detector
DQAMG - controller attached to global protection
**Current Leads:**
- Typical resistance for U_RES: 7 uOhm
- Threshold for U_HTS: 3 mV, 1s
- Polarity convention: Arrows show how signals are measured. If I > 0, LD1: U_RES > 0, LD2: U_RES < 0
- PM file
- Buffer range 0 to 250, event at point 50
- Time range: -10 to 40 s
- Frequency: 5 Hz (dt = 200 ms)
**Magnet:**
- See polarity convention in the circuit schematics
- U_RES_B1 = U_1_B1 + U_2_B1
- Threshold on U_RES_B1: 100 mV, 10 ms
- U_RES_B2, U_1_B2, U_2_B2 and U_INDUCT_B2 are given for diagnostics only
- Signals are measured with -2.5 V offset and with the gain factor = 0.0012
- *Attention: B1 signals and B2 singals can be shifted by 4 ms from each other*
- If pure inductive signal and di/dt < 0:
- U_1_B1 = L di/dt < 0
- U_2_B1 = -L di/dt < 0
- PM file
- Buffer range 501 to 1500, event at point 1000
- Time range: -2 to 2 s
- Frequency: 250 Hz (dt = 4 ms)
%% Cell type:markdown id: tags:
## 5.1. Resistive Voltage
*GRAPHS*:
- t = 0 s corresponds to the start of the test
%% Cell type:code id: tags:
``` python
analysis.plot_u_res(circuit_name, timestamp_fgc, u_res_df, i_meas_df)
```
%% Cell type:markdown id: tags:
## 5.2. Splice Resistance
*ANALYSIS*:
- Calculate splice resistance values based on power converter currents and QDS voltages
*CRITERIA*
- Check if R_max < 5 nOhm
*GRAPHS*:
- t = 0 s corresponds to the start of the test
%% Cell type:code id: tags:
``` python
title = '%s, %s: %s-%s' % (circuit_name, hwc_test, Time.to_string(t_start).split('.')[0], Time.to_string(t_end).split('.')[0])
analysis.plot_i_meas_u_res_current_plateau(i_meas_df, u_res_df, t0=i_meas_raw_df.index[0], plateau_start=plateau_start, plateau_end=plateau_end, title=title)
```
%% Cell type:code id: tags:
``` python
res = analysis.calculate_splice_resistance_linreg(u_res_raw_df, i_meas_raw_df, plateau_start, plateau_end)
```
%% Cell type:code id: tags:
``` python
res_df = pd.DataFrame({'R_RES': {'R': res}})
analysis.analyze_busbar_magnet_resistance(res_df, 'R_RES', 5e-9)
```
%% Cell type:markdown id: tags:
## 5.3. Current Leads
*CRITERIA*:
- quench detection for U_HTS for 2 consecutive datapoints above the threshold of 3 mV
- detection for U_RES for 2 consecutive datapoints above the threshold of 100 mV
*GRAPHS*:
- t = 0 s corresponds to the start of the test
%% Cell type:code id: tags:
``` python
analysis.analyze_leads_voltage(u_hts_dfs, circuit_name, timestamp_fgc, signal='U_HTS', value_min=-0.003, value_max=0.003)
```
%% Cell type:code id: tags:
``` python
analysis.analyze_leads_voltage(u_res_dfs, circuit_name, timestamp_fgc, signal='U_RES', value_min=-0.1, value_max=0.1)
```
%% Cell type:markdown id: tags:
## 5.4. DFB Regulation
*CRITERIA*
- Check if the temperatures TT893 at the top of the copper part of the four current leads, is over dew point, but not overheated: TT893(0 current) - 4 K < TT893 < TT893(0 current) + 4 K
- Check if the temperatures TT891A at the top of the HTS part of the four current leads, is regulated around TT891A(0 current): TT891A(0 current) - 10 K < TT891A < TT891A(0 current) + 10 K, even without current
*GRAPHS*:
- t = 0 s corresponds to the start of the test
%% Cell type:code id: tags:
``` python
t_no_current = i_meas_df[i_meas_df.index < 10]['I_MEAS'].idxmin()
temp_no_current = max([df[df.index == df.index.get_loc(t_no_current, 'nearest')].values[0][0] for df in tt893_nxcals_dfs])
analysis.assert_tt893_min_max_value(tt893_nxcals_dfs, i_meas_df, value_range=(temp_no_current-4, temp_no_current+4))
```
%% Cell type:code id: tags:
``` python
t_no_current = i_meas_df[i_meas_df.index < 10]['I_MEAS'].idxmin()
temp_no_current = max([df[df.index == df.index.get_loc(t_no_current, 'nearest')].values[0][0] for df in tt891a_nxcals_dfs])
analysis.assert_tt891a_min_max_value(tt891a_nxcals_dfs, i_meas_df, value_range=(temp_no_current-10, temp_no_current+10))
```
%% Cell type:markdown id: tags:
# 6. Final Report
%% Cell type:code id: tags:
``` python
campaign = hwcb.get_campaign()
file_name_html = '{}_{}-{}-{}_report.html'.format(circuit_name, hwc_test, Time.to_datetime(t_start).strftime("%Y.%m.%d_%H%M%S"), analysis_start_time)
full_path = '/eos/project/l/lhcsm/hwc/IPD/{}/{}/{}/{}'.format(circuit_name, hwc_test, campaign, file_name_html)
!mkdir -p /eos/project/l/lhcsm/hwc/IPD/$circuit_name/$hwc_test/$campaign
print('Compact notebook report saved to (Windows): ' + '\\\\cernbox-smb' + full_path.replace('/', '\\'))
display(Javascript('IPython.notebook.save_notebook();'))
time.sleep(5)
!{sys.executable} -m jupyter nbconvert --to html $'AN_IPD_PNO.c6.ipynb' --output /eos/project/l/lhcsm/hwc/IPD/$circuit_name/$hwc_test/$campaign/$file_name_html --TemplateExporter.exclude_input=True --TagRemovePreprocessor.remove_all_outputs_tags='["skip_output"]'
```
%% Cell type:code id: tags:
``` python
```
......
%% Cell type:markdown id: tags:
<h1><center>Analysis of an FPA in an IPQ Circuit</center></h1>
The Individually Powered Quadrupole magnets (IPQs) in the LHC are located on both sides of the Interaction Regions (IR), in the matching sector and in the dispersion suppressor. The IPQ circuits RQ4 to RQ7 are part of the matching sector, and the IPQ circuits RQ8 to RQ10 are part of the dispersion suppressor. The magnets Q4 to Q6 are operated at
4.5 K, whereas the magnets Q7 to Q10 are operated at 1.9 K.
The MQM quadrupole consists of two individually powered apertures assembled in a common yoke structure.
The MQY wide-aperture quadrupole consists of two individually powered apertures assembled in a common yoke structure.
%% Cell type:markdown id: tags:
# Analysis Assumptions
- We consider standard analysis scenarios, i.e., all signals can be queried. If a signal is missing, an analysis can raise a warning and continue or an error and abort the analysis.
- In case a signal is not needed for the analysis, a particular analysis is skipped. In other words, all signals have to be available in order to perform an analysis.
- It is recommended to execute each cell one after another. However, since the signals are queried prior to analysis, any order of execution is allowed. In case an analysis cell is aborted, the following ones may not be executed (e.g. I\_MEAS not present).
# Plot Convention
- Scales are labeled with signal name followed by a comma and a unit in square brackets, e.g., I_MEAS, [A].
- If a reference signal is present, it is represented with a dashed line.
- If the main current is present, its axis is on the left. Remaining signals are attached to the axis on the right. The legend of these signals is located on the lower left and upper right, respectively.
- The grid comes from the left axis.
- The title contains timestamp, circuit name, and signal name allowing to re-access the signal.
- The plots assigned to the left scale have colors: blue (C0) and orange (C1). Plots presented on the right have colors red (C2) and green (C3).
- Each plot has an individual time-synchronization mentioned explicitly in the description.
- If an axis has a single signal, then the color of the label matches the signal's color. Otherwise, the label color is black.
%% Cell type:markdown id: tags:
# 0. Initialise Working Environment
%% Cell type:code id: tags:
``` python
import io
import re
import sys
import pandas as pd
import numpy as np
from datetime import datetime
import time
from IPython.display import display, Javascript, HTML
from lhcsmapi.Time import Time
from lhcsmapi.Timer import Timer
from lhcsmapi.analysis.expert_input import get_expert_decision
from lhcsmapi.analysis.report_template import apply_report_template
from lhcsmapi.analysis.IpqCircuitQuery import IpqCircuitQuery
from lhcsmapi.analysis.IpqCircuitAnalysis import IpqCircuitAnalysis
# GUI
from lhcsmapi.gui.qh.DateTimeBaseModule import DateTimeBaseModule
from lhcsmapi.gui.pc.FgcPmSearchModuleMediator import FgcPmSearchModuleMediator
from lhcsmapi.gui.pc.IpqFgcPmSearchBaseModule import IpqFgcPmSearchBaseModule
analysis_start_time = datetime.now().strftime("%Y.%m.%d_%H%M%S")
import lhcsmapi
print('Analysis executed with lhcsmapi version: {}'.format(lhcsmapi.__version__))
with io.open("../__init__.py", "rt", encoding="utf8") as f:
version = re.search(r'__version__ = "(.*?)"', f.read()).group(1)
print('Analysis executed with lhc-sm-hwc notebooks version: {}'.format(version))
```
%% Cell type:markdown id: tags:
# 1. Select FGC Post Mortem Entry
%% Cell type:markdown id: tags:skip_cell
In order to perform the analysis of a FPA in an IPQ circuit please:
1. Select circuit name prefix (e.g., RQ5)
2. Choose start and end time
3. Choose analysis mode (Automatic by default)
Once these inputs are provided, click 'Find FGC PM entries' button. This will trigger a search of the PM database in order to provide a list of timestamps of FGC events associated with the selected circuit name for the provided period of time. Select one timestamp from the 'FGC PM Entries' list to be processed by the following cells.
**Note that 24 hours is the maximum duration of a single PM query for an event. To avoid delays in querying events, please restrict your query duration as much as possible.**
%% Cell type:code id: tags:
``` python
circuit_type = 'IPQ'
fgc_pm_search = FgcPmSearchModuleMediator(DateTimeBaseModule(start_date_time='2018-12-10 00:00:00+01:00',
end_date_time='2018-12-11 00:00:00+01:00'), IpqFgcPmSearchBaseModule(), circuit_type=circuit_type)
```
%% Cell type:markdown id: tags:
# 2. Query All Signals Prior to Analysis
%% Cell type:code id: tags:skip_output
``` python
with Timer():
timestamp_fgc = fgc_pm_search.get_fgc_timestamp()
circuit_name = fgc_pm_search.get_fgc_circuit()
author = fgc_pm_search.get_author()
is_automatic = fgc_pm_search.is_automatic_mode()
ipq_query = IpqCircuitQuery(circuit_type, circuit_name, max_executions=14)
# PC
source_timestamp_fgc_df = ipq_query.find_source_timestamp_pc(t_start=timestamp_fgc-1e9, t_end=timestamp_fgc+1e9)
source_fgc_b1, timestamp_fgc_b1 = ipq_query.split_source_timestamp_fgc(source_timestamp_fgc_df, 'B1')
source_fgc_b2, timestamp_fgc_b2 = ipq_query.split_source_timestamp_fgc(source_timestamp_fgc_df, 'B2')
i_meas_b1_df, i_ref_b1_df, i_a_b1_df, i_earth_b1_df, i_earth_pcnt_b1_df = ipq_query.query_pc_pm_with_source(timestamp_fgc_b1, timestamp_fgc_b1,
source_fgc_b1, signal_names=['I_MEAS', 'I_REF', 'I_A', 'I_EARTH', 'I_EARTH_PCNT'])
i_meas_b2_df, i_ref_b2_df, i_a_b2_df, i_earth_b2_df, i_earth_pcnt_b2_df = ipq_query.query_pc_pm_with_source(timestamp_fgc_b2, timestamp_fgc_b2,
source_fgc_b2, signal_names=['I_MEAS', 'I_REF', 'I_A', 'I_EARTH', 'I_EARTH_PCNT'])
# PIC
timestamp_pic = ipq_query.find_timestamp_pic(timestamp_fgc, spark=spark)
# QDS
source_timestamp_qds_df = ipq_query.find_source_timestamp_qds(timestamp_fgc_b1, duration=[(2, 's'), (2, 's')])
timestamp_qds = np.nan if source_timestamp_qds_df.empty else source_timestamp_qds_df.loc[0, 'timestamp']
u_res_b1_df, u_res_b2_df = ipq_query.query_qds_pm(timestamp_qds, timestamp_fgc, signal_names=['U_RES_B1', 'U_RES_B2'])
u_1_b1_df, u_1_b2_df = ipq_query.query_qds_pm(timestamp_qds, timestamp_fgc, signal_names=['U_1_B1', 'U_1_B2'])
u_2_b1_df, u_2_b2_df = ipq_query.query_qds_pm(timestamp_qds, timestamp_fgc, signal_names=['U_2_B1', 'U_2_B2'])
# QH
u_hds_dfss = ipq_query.query_qh_pm(source_timestamp_qds_df, signal_names=['U_HDS'])
u_hds_dfs = u_hds_dfss[0] if u_hds_dfss else []
# # Reference
u_hds_ref_dfss = ipq_query.query_qh_pm(source_timestamp_qds_df, signal_names=['U_HDS'], is_ref=True)
u_hds_ref_dfs = u_hds_ref_dfss[0] if u_hds_ref_dfss else []
# LEADS B1
u_hts_b1_dfs = ipq_query.query_leads(timestamp_fgc, source_timestamp_qds_df, system='LEADS_B1', signal_names=['U_HTS'], spark=spark, duration=[(300, 's'), (900, 's')])
u_res_b1_dfs = ipq_query.query_leads(timestamp_fgc, source_timestamp_qds_df, system='LEADS_B1', signal_names=['U_RES'], spark=spark, duration=[(300, 's'), (900, 's'