Commit 86862218 authored by Michal Maciejewski's avatar Michal Maciejewski
Browse files

Added HWC figures for IPQ circuits.

parent 27e26311
%% Cell type:markdown id: tags:
<h1><center>Analysis of an FPA in an 600A Circuit - RCBX Family</center></h1>
Figure below shows a generic circuit diagram, equipped with EE and parallel resistor, as well as lead resistances and a quench resistance.
<img src="https://gitlab.cern.ch/LHCData/lhc-sm-hwc/-/raw/master/figures/600A/600A_without_EE.png" width=75%>
source: Test Procedure and Acceptance Criteria for the 600 A Circuits, MP3 Procedure, <a href="https://edms.cern.ch/document/874716/5.3">https://edms.cern.ch/document/874716/5.3</a>
%% Cell type:markdown id: tags:
# Analysis Assumptions
- We consider standard analysis scenarios, i.e., all signals can be queried. Depending on what signal is missing, an analysis can raise a warning and continue or an error and abort the analysis.
- In case an analyzed signal can't be queried, 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 an 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 the square bracket, 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
- Title contains timestamp, circuit name, signal name allowing for re-access the signal.
- The plots assigned to the left scale got 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, change color of the label to match 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
# lhc-sm-api
from lhcsmapi.Time import Time
from lhcsmapi.Timer import Timer
from lhcsmapi.analysis.R600ACircuitQuery import R600ACircuitQuery
from lhcsmapi.analysis.expert_input import get_expert_decision
from lhcsmapi.analysis.report_template import apply_report_template
from lhcsmapi.analysis.R600ACircuitAnalysis import R600ACircuitAnalysis
from lhcsmapi.metadata.SignalMetadata import SignalMetadata
# GUI
from lhcsmapi.gui.qh.DateTimeBaseModule import DateTimeBaseModule
from lhcsmapi.gui.pc.FgcPmSearchModuleMediator import FgcPmSearchModuleMediator
from lhcsmapi.gui.pc.R600AFgcPmSearchBaseModule import R600ARcbxhvFgcPmSearchBaseModule
analysis_start_time = datetime.now().strftime("%Y.%m.%d_%H%M%S.%f")
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))
```
%% Output
Analysis executed with lhcsmapi version: 1.3.323
Analysis executed with lhc-sm-hwc notebooks version: 1.1.0
%% 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 RCD/O 600A circuit please:
1. Select circuit name (e.g., RC.A12B1)
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
fgc_pm_search = FgcPmSearchModuleMediator(DateTimeBaseModule(start_date_time='2017-04-26 00:00:00+01:00',
end_date_time='2017-04-28 00:00:00+01:00'), R600ARcbxhvFgcPmSearchBaseModule(), circuit_type='600A_RCBXHV')
```
%% Output
Selected FGC PM event RCBXV1.R1: 2017-04-26 17:07:49.220000+02:00; RCBXH1.R1: 2017-04-26 17:07:49.240000+02:00.
The analysis is executed in Automatic mode.
FGC PM events in circuits of sector S12:
%% Cell type:markdown id: tags:
# 2. Query All Signals Prior to Analysis
%% Cell type:code id: tags:skip_output
``` python
with Timer():
author = fgc_pm_search.get_author()
is_automatic = fgc_pm_search.is_automatic_mode()
circuit_type = '600A'
circuit_names = fgc_pm_search.get_fgc_circuit()
timestamp_fgc_rcbxh, timestamp_fgc_rcbxv = fgc_pm_search.get_fgc_timestamp()
query_rcbxh = R600ACircuitQuery(circuit_type, circuit_names[0], max_executions=10)
query_rcbxv = R600ACircuitQuery(circuit_type, circuit_names[1], max_executions=10)
# RCBXH
i_meas_rcbxh_df, i_a_rcbxh_df, i_ref_rcbxh_df, i_earth_rcbxh_df = query_rcbxh.query_pc_pm(timestamp_fgc_rcbxh, timestamp_fgc_rcbxh,
signal_names=['I_MEAS', 'I_A', 'I_REF', 'I_EARTH'])
events_action_rcbxh_df, events_symbol_rcbxh_df = query_rcbxh.query_pc_pm_events(timestamp_fgc_rcbxh, signal_names=['ACTION', 'SYMBOL'])
# RCBXV
i_meas_rcbxv_df, i_a_rcbxv_df, i_ref_rcbxv_df, i_earth_rcbxv_df = query_rcbxv.query_pc_pm(timestamp_fgc_rcbxv, timestamp_fgc_rcbxv,
signal_names=['I_MEAS', 'I_A', 'I_REF', 'I_EARTH'])
events_action_rcbxv_df, events_symbol_rcbxv_df = query_rcbxv.query_pc_pm_events(timestamp_fgc_rcbxv, signal_names=['ACTION', 'SYMBOL'])
# PIC
# # RCBXH
timestamp_pic_rcbxh = query_rcbxh.find_timestamp_pic(timestamp_fgc_rcbxh, spark=spark)
# # RCBXV
timestamp_pic_rcbxv = query_rcbxv.find_timestamp_pic(timestamp_fgc_rcbxv, spark=spark)
# QDS NXCALS - To check if there was any drift of QDS cards prior to the trigger
# # RCBXH
i_meas_nxcals_rcbxh_df = query_rcbxh.query_pc_nxcals(timestamp_fgc_rcbxh, signal_names=['I_MEAS'], spark=spark)[0]
u_res_nxcals_rcbxh_df = query_rcbxh.query_iqps_nxcals(timestamp_fgc_rcbxh, signal_names=['U_RES'], spark=spark)[0]
# # RCBXV
i_meas_nxcals_rcbxv_df = query_rcbxv.query_pc_nxcals(timestamp_fgc_rcbxv, signal_names=['I_MEAS'], spark=spark)[0]
u_res_nxcals_rcbxv_df = query_rcbxv.query_iqps_nxcals(timestamp_fgc_rcbxv, signal_names=['U_RES'], spark=spark)[0]
# QDS PM
# # RCBXH
source_timestamp_qds_rcbxh_df = query_rcbxh.find_source_timestamp_qds(timestamp_fgc_rcbxh, duration=[(2, 's'), (2, 's')])
timestamp_qds_rcbxh = np.nan if source_timestamp_qds_rcbxh_df.empty else source_timestamp_qds_rcbxh_df.loc[0, 'timestamp']
i_dcct_rcbxh_df, i_didt_rcbxh_df, u_res_rcbxh_df, u_diff_rcbxh_df = query_rcbxh.query_qds_pm(timestamp_qds_rcbxh, timestamp_qds_rcbxh,
signal_names=['I_DCCT', 'I_DIDT', 'U_RES', 'U_DIFF'])
# # RCBXV
source_timestamp_qds_rcbxv_df = query_rcbxv.find_source_timestamp_qds(timestamp_fgc_rcbxv, duration=[(2, 's'), (2, 's')])
timestamp_qds_rcbxv = np.nan if source_timestamp_qds_rcbxv_df.empty else source_timestamp_qds_rcbxv_df.loc[0, 'timestamp']
i_dcct_rcbxv_df, i_didt_rcbxv_df, u_res_rcbxv_df, u_diff_rcbxv_df = query_rcbxv.query_qds_pm(timestamp_qds_rcbxv, timestamp_qds_rcbxv,
signal_names=['I_DCCT', 'I_DIDT', 'U_RES', 'U_DIFF'])
# LEADS
# # RCBXH
leads_name = [x for x in SignalMetadata.get_system_types_per_circuit_name(circuit_type, circuit_names[0]) if 'LEADS' in x][0]
source_timestamp_leads_rcbxh_df = query_rcbxh.find_timestamp_leads(timestamp_fgc_rcbxh, leads_name)
u_hts_leads_rcbxh_dfs = query_rcbxh.query_leads(timestamp_fgc_rcbxh, source_timestamp_leads_rcbxh_df, system=leads_name, signal_names=['U_HTS'], spark=spark, duration=[(300, 's'), (900, 's')])
u_res_leads_rcbxh_dfs = query_rcbxh.query_leads(timestamp_fgc_rcbxh, source_timestamp_leads_rcbxh_df, system=leads_name, signal_names=['U_RES'], spark=spark, duration=[(300, 's'), (900, 's')])
# # RCBXV
leads_name = [x for x in SignalMetadata.get_system_types_per_circuit_name(circuit_type, circuit_names[1]) if 'LEADS' in x][0]
source_timestamp_leads_rcbxv_df = query_rcbxv.find_timestamp_leads(timestamp_fgc_rcbxv, leads_name)
u_hts_leads_rcbxv_dfs = query_rcbxv.query_leads(timestamp_fgc_rcbxv, source_timestamp_leads_rcbxv_df, system=leads_name, signal_names=['U_HTS'], spark=spark, duration=[(300, 's'), (900, 's')])
u_res_leads_rcbxv_dfs = query_rcbxv.query_leads(timestamp_fgc_rcbxv, source_timestamp_leads_rcbxv_df, system=leads_name, signal_names=['U_RES'], spark=spark, duration=[(300, 's'), (900, 's')])
# Create results table - RCBXH/V
results_table = query_rcbxh.create_report_analysis_template_rcbx(timestamp_fgc_rcbxh, timestamp_fgc_rcbxv, circuit_names, author=author)
analysis_rcbxh = R600ACircuitAnalysis(circuit_type, results_table, is_automatic=is_automatic)
analysis_rcbxv = R600ACircuitAnalysis(circuit_type, results_table, is_automatic=is_automatic)
```
%% Output
Querying PM event signal(s) STATUS.I_REF, IEARTH.IEARTH, STATUS.I_MEAS, IAB.I_A for system: RPMBB.UL16.RCBXH1.R1, className: 51_self_pmd, source: FGC at 2017-04-26 17:07:49.240
Querying PM event signal(s) EVENTS.SYMBOL, EVENTS.ACTION for system: RPMBB.UL16.RCBXH1.R1, className: 51_self_pmd, source: FGC at 2017-04-26 17:07:49.240
Querying PM event signal(s) STATUS.I_REF, IEARTH.IEARTH, STATUS.I_MEAS, IAB.I_A for system: RPMBB.UL16.RCBXV1.R1, className: 51_self_pmd, source: FGC at 2017-04-26 17:07:49.220
Querying PM event signal(s) EVENTS.SYMBOL, EVENTS.ACTION for system: RPMBB.UL16.RCBXV1.R1, className: 51_self_pmd, source: FGC at 2017-04-26 17:07:49.220
Querying NXCALS signal(s) RCBXH1.R1:ST_ABORT_PIC from 2017-04-26 17:07:48.240 to 2017-04-26 17:08:49.240
Querying NXCALS signal(s) RCBXV1.R1:ST_ABORT_PIC from 2017-04-26 17:07:48.220 to 2017-04-26 17:08:49.220
Querying NXCALS signal(s) I_MEAS from 2017-04-26 17:02:49.240 to 2017-04-26 17:07:59.240
Querying NXCALS signal(s) RCBXH1.R1:U_RES from 2017-04-26 17:02:49.240 to 2017-04-26 17:07:59.240
Querying NXCALS signal(s) I_MEAS from 2017-04-26 17:02:49.220 to 2017-04-26 17:07:59.220
Querying NXCALS signal(s) RCBXV1.R1:U_RES from 2017-04-26 17:02:49.220 to 2017-04-26 17:07:59.220
Querying PM event timestamps for system: RCBXH1.R1, className: DQAMGNA, source: QPS from 2017-04-26 17:07:47.240 to 2017-04-26 17:07:51.240
Querying PM event signal(s) circ.RCBXH1.R1:I_DIDT, circ.RCBXH1.R1:U_DIFF, circ.RCBXH1.R1:U_RES, circ.RCBXH1.R1:I_DCCT for system: RCBXH1.R1, className: DQAMGNA, source: QPS at 2017-04-26 17:07:49.213
Querying PM event timestamps for system: RCBXV1.R1, className: DQAMGNA, source: QPS from 2017-04-26 17:07:47.220 to 2017-04-26 17:07:51.220
Elapsed: 119.783 s.
In function QdsQuery.query_qds_pm: Input timestamp is NaN, query skipped returning default return_type.
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-3-b56a8903fa70> in <module>()
46 # # RCBXH
47 leads_name = [x for x in SignalMetadata.get_system_types_per_circuit_name(circuit_type, circuit_names[0]) if 'LEADS' in x][0]
---> 48 source_timestamp_leads_rcbxh_df = query_rcbxh.find_timestamp_leads(timestamp_fgc_rcbxh, leads_name)
49
50 u_hts_leads_rcbxh_dfs = query_rcbxh.query_leads(timestamp_fgc_rcbxh, source_timestamp_leads_rcbxh_df, system=leads_name, signal_names=['U_HTS'], spark=spark, duration=[(300, 's'), (900, 's')])
AttributeError: 'R600ACircuitQuery' object has no attribute 'find_timestamp_leads'
%% 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:
- 2 PM DQAMGNA (A+B) files and 1 PM EE file should be generated for 600 A circuits with EE
- Difference between QPS board A and B timestamp = 1 ms
- PC timestamp is QPS timestamp +/- 20 ms
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
timestamp_dct = {'FGC_RCBXH': timestamp_fgc_rcbxh, 'FGC_RCBXV': timestamp_fgc_rcbxv,
'PIC_RCBXH': timestamp_pic_rcbxh, 'PIC_RCBXV': timestamp_pic_rcbxv,
'QDS_A_RCBXH':source_timestamp_qds_rcbxh_df.loc[0, 'timestamp'] if len(source_timestamp_qds_rcbxh_df) > 0 else np.nan,
'QDS_B_RCBXH':source_timestamp_qds_rcbxh_df.loc[1, 'timestamp'] if len(source_timestamp_qds_rcbxh_df) > 1 else np.nan,
'QDS_A_RCBXV':source_timestamp_qds_rcbxv_df.loc[0, 'timestamp'] if len(source_timestamp_qds_rcbxv_df) > 0 else np.nan,
'QDS_B_RCBXV':source_timestamp_qds_rcbxv_df.loc[1, 'timestamp'] if len(source_timestamp_qds_rcbxv_df) > 1 else np.nan}
analysis_rcbxh.create_timestamp_table(timestamp_dct, circuit_name=circuit_names[0])
```
%% Cell type:markdown id: tags:
# 4. PC
## 4.1. Main Current
*QUERY*:
|Variable Name |Variable Type |Variable Unit |Database|Comment
|---------------|---------------|---------------|--------|------|
|i_a_rcbx_df |DataFrame |A |PM|I_A is the raw RCBX power converter current logged around the FPA with high sampling frequency|
|i_meas_rcbx_df |DataFrame |A |PM|I_MEAS RCBX power converter current is filtered I_A with lower sampling frequency and longer duration|
|i_ref_rcbx_df |DataFrame |A |PM|The reference current of an RCBX power converter, I_REF|
|events_action_rcbx_df |DataFrame |text |PM|event action storing information about the state of an RCBX PC operation, e.g. FAULT, EVENTS.ACTION|
|events_symbol_rcbx_df |DataFrame |text |PM|event action storing information about source of an RCBX PC FPA, e.g. TRG EXTERNAL FAST ABORT, EVENTS.SYMBOL|
Note that **rcbx** in the table above denotes RCBXH and RCBXV, i.e., there are four signals for each circuit.
*ANALYSIS*:
- determination of the source of an FPA trigger based on EVENTS.SYMBOL and EVENTS.ACTION signals
- detection of the start of a quench as a deviation of I_A and I_REF
- calculation of the MIITs
- calculation of the quench current
- calculation of the duration of a plateau / the ramp rate before a quench (based on PM event buffer)
*GRAPHS*:
- dashed blue line denotes the start of a quench (I_A starts to deviate from I_REF)
- t = 0 s corresponds to the FGC timestamp
%% Cell type:code id: tags:
``` python
t_quench = analysis_rcbxh.find_time_of_quench(i_ref_rcbxh_df, i_a_rcbxh_df)
t_quench = 0 if t_quench is None else t_quench
analysis_rcbxh.plot_i_meas_pc(circuit_names[0], timestamp_fgc_rcbxh, [i_meas_rcbxh_df, i_a_rcbxh_df, i_ref_rcbxh_df], xlim=(t_quench-0.1, t_quench+0.1))
```
%% Cell type:code id: tags:
``` python
analysis_rcbxh.plot_i_meas_pc_zoom(circuit_names[0], timestamp_fgc_rcbxh, t_quench, [i_meas_rcbxh_df, i_a_rcbxh_df, i_ref_rcbxh_df], xlim=(t_quench-0.1, t_quench+0.1))
analysis_rcbxh.analyze_i_meas_pc_trigger(timestamp_fgc_rcbxh, events_action_rcbxh_df, events_symbol_rcbxh_df)
analysis_rcbxh.calculate_current_miits(i_meas_rcbxh_df, t_quench, col_name='I_MEAS MIITs H')
analysis_rcbxh.calculate_quench_current(i_meas_rcbxh_df, t_quench, col_name='I_Q_H')
analysis_rcbxh.calculate_current_slope(i_meas_rcbxh_df, col_name=['Ramp Rate H', 'Plateau Duration H'])
```
%% Cell type:code id: tags:
``` python
t_quench = analysis_rcbxv.find_time_of_quench(i_ref_rcbxv_df, i_a_rcbxv_df)
t_quench = 0 if t_quench is None else t_quench
analysis_rcbxv.plot_i_meas_pc(circuit_names[1], timestamp_fgc_rcbxv, [i_meas_rcbxv_df, i_a_rcbxv_df, i_ref_rcbxv_df], xlim=(t_quench-1, t_quench+1))
```
%% Cell type:code id: tags:
``` python
analysis_rcbxv.plot_i_meas_pc_zoom(circuit_names[1], timestamp_fgc_rcbxv, t_quench, [i_meas_rcbxv_df, i_a_rcbxv_df, i_ref_rcbxv_df], xlim=(t_quench-0.1, t_quench+0.1))
analysis_rcbxv.analyze_i_meas_pc_trigger(timestamp_fgc_rcbxv, events_action_rcbxv_df, events_symbol_rcbxv_df)
analysis_rcbxv.calculate_current_miits(i_meas_rcbxv_df, t_quench, col_name='I_MEAS MIITs V')
analysis_rcbxv.calculate_quench_current(i_meas_rcbxv_df, t_quench, col_name='I_Q_V')
analysis_rcbxv.calculate_current_slope(i_meas_rcbxv_df, col_name=['Ramp Rate V', 'Plateau Duration V'])
```
%% Cell type:code id: tags:
``` python
analysis_rcbxh.results_table[['Circuit Name', 'Date', 'Time', 'I_Q_H', 'I_Q_V', 'I_MEAS MIITs H', 'I_MEAS MIITs V', 'Ramp Rate H', 'Ramp Rate V', 'Plateau Duration H', 'Plateau Duration V']]
```
%% Cell type:markdown id: tags:
## 4.2. Earth Current
*QUERY*:
|Variable Name |Variable Type |Variable Unit |Database|Comment
|---------------|---------------|---------------|--------|------|
|i_earth_rcbx_df |DataFrame |A |PM|Earth current of an RCBX circuit power converter, I_EARTH|
Note that **rcbx** in the table above denotes RCBXH and RCBXV, i.e., there is one signal for each circuit.
*ANALYSIS*:
- calculation of the maximum absolute earth current (maintaining the sign)
*GRAPHS*:
- t = 0 s corresponds to the FGC timestamp
%% Cell type:code id: tags:
``` python
analysis_rcbxh.plot_i_earth_pc(circuit_names[0], timestamp_fgc_rcbxh, i_earth_rcbxh_df)
analysis_rcbxh.calculate_max_i_earth_pc(i_earth_rcbxh_df, col_name='Earth Current H')
```
%% Cell type:code id: tags:
``` python
analysis_rcbxv.plot_i_earth_pc(circuit_names[1], timestamp_fgc_rcbxv, i_earth_rcbxv_df)
analysis_rcbxv.calculate_max_i_earth_pc(i_earth_rcbxv_df, col_name='Earth Current V')
```
%% Cell type:markdown id: tags:
# 5. QDS
The quench voltage U_RES is calculated according to the following formula:
\begin{equation}
U_{\text{RES}} = U_{\text{DIFF}} + L d/dt (I+U_{\text{DIFF}}/R).
\end{equation}
Note that I_DCCT is the QPS signal name, even though the current is actually measured not with a DCCT, but with a LEM detector, hence the poorer quality w.r.t. to the FGC I_A/B/MEAS signals that are measured with a DCCT.
It can be seen from the sign convention in the figure below that a resistive voltage always has opposite sign to the measured current.
<img src="https://gitlab.cern.ch/LHCData/lhc-sm-hwc/-/raw/master/figures/600A/600A_without_EE.png" width=75%>
As U_DIFF contributes directly to U_RES, the resolution of U_RES is, at least partially, limited by that of U_DIFF. Moreover, U_RES is affected by the noisy time derivative of the current signal.
The QPS signals that are communicated to the post-mortem system have only 12 bit resolution.
## 5.1. Resistive Voltage
*QUERY*:
|Variable Name |Variable Type |Variable Unit |Database|Comment
|---------------|---------------|---------------|--------|------|
|i_meas_nxcals_rcbx_df |DataFrame |A |NXCALS|Power converter current in an RCBX circuit, I_MEAS|
|u_res_nxcals_rcbx_df |DataFrame |V |NXCALS|Resistive voltage of magnets measured with QPS in an RCBX circuit, U_RES|
|u_res_rc_df |DataFrame |V |PM|Resistive voltage of magnets measured with QPS in an RCBX circuit, U_RES|
Note that **rcbx** in the table above denotes RCBXH and RCBXV, i.e., there are two signals for each circuit.
*ANALYSIS*:
- Check if the U_RES signal before a quench is increasing for at least one board, which would indicate a QPS trip
- Calculate the initial voltage slope of U_RES signal. The slope is calculated as a ratio of the voltage change from 50 to 200 mV and the corresponding time change.
*GRAPHS*:
First plot (U_RES and I_MEAS prior to a quench)
- t = 0 s corresponds to the FGC timestamp
Second plot (U_RES and the initial slope of U_RES)
- t = 0 s corresponds to the QPS timestamp
%% Cell type:code id: tags:
``` python
analysis_rcbxh.plot_u_res(circuit_names[0], timestamp_qds_rcbxh, u_res_nxcals_rcbxh_df, i_meas_nxcals_rcbxh_df)
```
%% Cell type:code id: tags:
``` python
u_res_rcbxh_slope_df = analysis_rcbxh.calculate_u_res_slope(u_res_rcbxh_df, col_name='dUres/dt H')
analysis_rcbxh.plot_u_res_slope(circuit_names[0], timestamp_qds_rcbxh, u_res_rcbxh_df, u_res_rcbxh_slope_df)
```
%% Cell type:code id: tags:
``` python
analysis_rcbxv.plot_u_res(circuit_names[1], timestamp_qds_rcbxv, u_res_nxcals_rcbxv_df, i_meas_nxcals_rcbxv_df)
```
%% Cell type:code id: tags:
``` python
u_res_rcbxv_slope_df = analysis_rcbxv.calculate_u_res_slope(u_res_rcbxv_df, col_name='dUres/dt V')
analysis_rcbxv.plot_u_res_slope(circuit_names[1], timestamp_qds_rcbxv, u_res_rcbxv_df, u_res_rcbxv_slope_df)
```
%% Cell type:code id: tags:
``` python
analysis_rcbxh.results_table[['Circuit Name', 'Date', 'Time', 'dUres/dt H', 'dUres/dt V']]
```
%% Cell type:markdown id: tags:
## 5.2. I_DCCT, I_DIDT Currents; U_RES, U_DIFF Voltages
*QUERY*:
|Variable Name |Variable Type |Variable Unit |Database|Comment
|---------------|---------------|---------------|--------|------|
|i_dcct_rcbx_df |DataFrame |A |PM|DC current leads of QPS in an RCBX circuit, I_DCCT|
|i_didt_rcbx_df |DataFrame |A/s |PM|di/dt current leads of QPS in an RCBX circuit, I_DIDT|
|u_diff_rcbx_df |DataFrame |V |PM|differential voltage of QPS in an RCBX circuit, U_DIFF|
|u_res_rcbx_df |DataFrame |V |PM|resistive voltage (after inductance compensation) of QPS in an RCBX circuit used for quench detection, U_RES|
Note that **rcbx** in the table above denotes RCBXH and RCBXV, i.e., there are two signals for each circuit.
*ANALYSIS*
- Check the integrity of all four signals (U_DIFF, I_DCCT, I_DIDT and U_RES). If one of the signals (especially U_DIFF or I_DCCT) stays at zero or shows wrong values the cabling of this quench detector could have issues. Compare U_DIFF (measured signal) to U_REF (signal compensated for inductive voltage).
*CRITERIA*
- **U_RES < 0.7*100 mV and noise of U_RES on the plateaus < 20mV**
*GRAPHS*:
- t = 0 s corresponds to the QPS timestamp
%% Cell type:code id: tags:
``` python
analysis_rcbxh.plot_qds(circuit_names[0], timestamp_qds_rcbxh, i_dcct_rcbxh_df, i_didt_rcbxh_df, u_diff_rcbxh_df, u_res_rcbxh_df)
```
%% Cell type:code id: tags:
``` python
analysis_rcbxv.plot_qds(circuit_names[1], timestamp_qds_rcbxv, i_dcct_rcbxv_df, i_didt_rcbxv_df, u_diff_rcbxv_df, u_res_rcbxv_df)
```
%% Cell type:markdown id: tags:
## 5.3. LEADS
*QUERY*:
|Variable Name |Variable Type |Variable Unit |Database|Comment
|---------------|---------------|---------------|--------|------|
|u_hts_leads_rcbx_df |DataFrame |V |PM/NXCALS|RC leads voltage, U_HTS|
|u_res_leads_rcbx_df |DataFrame |V |PM/NXCALS|RC leads voltage, U_RES|
Note that **rcbx** in the table above denotes RCBXH and RCBXV, i.e., there are two signals for each circuit.
*ANALYSIS*:
- check if U_HTS for 2 consecutive datapoints is above the threshold 3 mV
- check if U_RES for 2 consecutive datapoints is above the threshold 100 mV
*GRAPHS*:
- t = 0 s corresponds to the FGC timestamp
%% Cell type:code id: tags:
``` python
analysis_rcbxh.analyze_leads_voltage(u_hts_leads_rcbxh_dfs, circuit_names[0], timestamp_fgc_rcbxh, signal='U_HTS', value_min=-0.003, value_max=0.003)
```
%% Cell type:code id: tags:
``` python
analysis_rcbxh.analyze_leads_voltage(u_res_leads_rcbxh_dfs, circuit_names[0], timestamp_fgc_rcbxh, signal='U_RES', value_min=-0.1, value_max=0.1)
```
%% Cell type:code id: tags:
``` python
analysis_rcbxv.analyze_leads_voltage(u_hts_leads_rcbxv_dfs, circuit_names[1], timestamp_fgc_rcbxv, signal='U_HTS', value_min=-0.003, value_max=0.003)
```
%% Cell type:code id: tags:
``` python
analysis_rcbxv.analyze_leads_voltage(u_res_leads_rcbxv_dfs, circuit_names[1], timestamp_fgc_rcbxv, signal='U_RES', value_min=-0.1, value_max=0.1)
```
%% Cell type:code id: tags:
``` python
# Get expert input on reason
analysis_rcbxv.results_table['Reason'] = get_expert_decision('Circuit Reason for FPA: ', ['H', 'V', 'other'])
# Get expert input on quench origin
analysis_rcbxv.results_table['Quench Origin'] = get_expert_decision('Origin of a quench', ['magnet', 'busbar', 'other'])
```
%% Cell type:markdown id: tags:
# 6. Final Report
%% Cell type:code id: tags:
``` python
pd.set_option('display.max_columns', None)
pd.set_option('display.max_rows', None)
# Create folder for circuit_name
circuit_name = circuit_names[0]
!mkdir -p /eos/project/l/lhcsm/operation/600A/$circuit_name
timestamp_fgc = timestamp_fgc_rcbxh if not np.isnan(timestamp_fgc_rcbxh) else timestamp_fgc_rcbxv
file_name = "{}-{}-PM_600A_RCBX_FPA".format(Time.to_datetime(timestamp_fgc).strftime("%Y.%m.%d_%H%M%S.%f"), analysis_start_time)
full_path = '/eos/project/l/lhcsm/operation/600A/{}/{}_mp3_results_table.csv'.format(circuit_name, file_name)
mp3_results_table = analysis_rcbxh.create_mp3_results_table_rcbxhv()
display(HTML(mp3_results_table.T.to_html()))
mp3_results_table.to_csv(full_path)
print('MP3 results table saved to (Windows): ' + '\\\\cernbox-smb' + full_path.replace('/', '\\'))
apply_report_template()
file_name_html = file_name + '_report.html'
full_path = '/eos/project/l/lhcsm/operation/600A/{}/{}'.format(circuit_name, file_name_html)
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_600A_RCBXHV_FPA.ipynb' --output /eos/project/l/lhcsm/operation/600A/$circuit_name/$file_name_html --TemplateExporter.exclude_input=True --TagRemovePreprocessor.remove_all_outputs_tags='["skip_output"]' --TagRemovePreprocessor.remove_cell_tags='["skip_cell"]'
```
%% Cell type:code id: tags:
``` python
```
......
......@@ -148,8 +148,6 @@ The RQ analysis notebook follows the same structure except for the lack of schem
### Notebook Output
The notebook creates two output files in the folder (path with Windows convention)
```
\\cernbox-smb\eos\project\l\operation\$circuit_type$\$circuit_name$\
......@@ -275,7 +273,7 @@ Note that the IT’s at points 2 and 8 have a slightly higher nominal operating
Nominal operating currents for 7 TeV of the three PC’s as given in the LHC design report volume I. For the nominal current during HWC see EDMS 1375861.
source: Test Procedure and Acceptance Criteria for the Inner Triplet Circuits in the LHC, MP3 Procedure, <a href="https://edms.cern.ch/document/874886/2.1">https://edms.cern.ch/document/874886/2.1
source: Test Procedure and Acceptance Criteria for the Inner Triplet Circuits in the LHC, MP3 Procedure, <a href="https://edms.cern.ch/document/874886/2.1">https://edms.cern.ch/document/874886/2.1</a>
|Type|Test|Current|Description|Notebook|Example report|
|----|----|-------|-----------|--------|--------------|
......@@ -289,10 +287,110 @@ source: Test Procedure and Acceptance Criteria for the Inner Triplet Circuits in
|HWC|PNO.A9|I\_PNO+I\_DELTA|Training and plateau at nominal current|[AN\_IT\_PNO.A9](https://gitlab.cern.ch/LHCData/lhc-sm-hwc/-/blob/master/it/AN_IT_PNO.A9.ipynb)|[AN_IT_PNO.A9](https://sigmon.web.cern.ch/node/82)|
|HWC|PNO.D16|90% of I\_PNO|Powering Failure at +90% of nominal current|[AN\_IT\_PNO.D16](https://gitlab.cern.ch/LHCData/lhc-sm-hwc/-/blob/master/it/AN_IT_PNO.D16.ipynb)|[AN_IT_PNO.D16](https://sigmon.web.cern.ch/node/83)|
|HWC|PNO.D17|90% of I\_PNO|Powering Failure at -90% of nominal current|AN\_IT\_PNO.D17|-|
|Operation|FPA|I\_PNO|FPA during operation with magnets quenching|[AN\_IT\_FPA](https://gitlab.cern.ch/LHCData/lhc-sm-hwc/-/blob/master/it/AN_IT_FPA.ipynb)|[AN_IT_FPA](https://sigmon.web.cern.ch/node/84)|
|Operation|FPA|I\_PNO|FPA during operation with magnets quenching|[AN\_IT\_FPA](https://gitlab.cern.ch/LHCData/lhc-sm-hwc/-/blob/master/it/AN_IT_FPA.ipynb)|[AN\_IT\_FPA](https://sigmon.web.cern.ch/node/84)|
## 4. IPQ - Individually Powered 4-6 kA Quadrupole Circuits in the LHC Insertions
This section is a copy of a document created by Alexandre Erokhin (https://twiki.cern.ch/twiki/pub/MP3/Analysis_Manual_IPQ/MQM.pdf).
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.
|Magnets in the Circuit|Temperature|Position|General information|
|----------------------|-----------|--------|-------------------|
|2MQM|1.9 K| RQ7.L4, RQ7.R4|I Nominal: 5390A, I_Ultimate: 6820A|
| | | |L tot: 2x15 mH, L per aperture: 15 mH|
| | | |max(di/dt): 12.917 A/s|
|2x2MQM|1.9\4.5\* K| RQ7.L1, RQ7.R1 RQ7.L2, RQ7.R2 RQ7.L5, RQ7.R5 RQ7.L8, RQ7.R8 RQ5.L8\*, RQ5.R2\*|I Nominal: 5390A\4310A\*, I_Ultimate: 5820A\4650A\*|
| | | |L tot: 2x2x15 mH, L per aperture: 15 mH|
| | | |max(di/dt): 12.917 A/s|
|2MQML|1.9\4.5\* K| RQ5.L1\*, RQ5.R1\* RQ5.L5\*, RQ5.R5\* RQ6.L1\*, RQ6.R1\* RQ6.L5\*, RQ6.R5* RQ8.L1, RQ8.R1 RQ8.L2, RQ8.R2 RQ8.L4, RQ8.R4 RQ8.L5, RQ8.R5 RQ8.L6, RQ8.R6 RQ8.L8, RQ8.R8 RQ10.L1, RQ10.R1 RQ10.L2, RQ10.R2 RQ10.L4, RQ10.R4 RQ10.L5, RQ10.R5 RQ10.L6, RQ10.R6 RQ10.L8, RQ10.R8|I Nominal: 5390A \ 4310A\*, I_Ultimate: 5820A \ 4650A\*|
| | | |L tot: 2x21 mH, L per aperture: 21 mH|
| | | |max(di/dt): 12.917 A/s|
|2MQMC|1.9 K\4.5K\*| Does not exist as an individual power circuit (exists only in combination with 2MQM)|I Nominal: 5390A\4310A\*, I_Ultimate: 5820A\4650A\*|
| | | |L tot: 2x11 mH, L per aperture: 11 mH|
| | | |max(di/dt): 12.917 A/s|
|2MQM+2MQML|4.5 K| RQ6.L2, RQ6.R2 RQ6.L8, RQ6.R8|I Nominal: 4310A, I_Ultimate: 4650A|
| | | |L tot: 2x15 mH + 2x21 mH|
| | | |max(di/dt): 12.917 A/s|
|2MQM+2MQMC|1.9 K| RQ9.L1, RQ9.L1 RQ9.L2, RQ9.R2 RQ9.L4, RQ9.R4 RQ9.L5, RQ9.R5 RQ9.L6, RQ9.R6 RQ9.L8, RQ9.R8|I Nominal: 5390A, I_Ultimate: 5820A|
| | | |L tot: 2x15 mH + 2x21 mH|
| | | |max(di/dt): 12.917 A/s|
The MQM quadrupole consists of two individually powered apertures assembled in a common yoke structure. Depending on a subsector there are few kinds of power circuits:
- 2MQM
<img src="https://gitlab.cern.ch/LHCData/lhc-sm-hwc/-/raw/master/figures/ipq/2MQM_QPS.png" width=75%>
Apertures B1 of 2 magnets are powered in series with one power supply Apertures B2 of 2 magnets are powered in series with second power supply. The return bus is common for both power circuits.
- 2x2MQM
<img src="https://gitlab.cern.ch/LHCData/lhc-sm-hwc/-/raw/master/figures/ipq/2x2MQM_QPS.png" width=75%>
Apertures B1 of 4 magnets are powered in series with one power supply Apertures B2 of 4 magnets are powered in series with second power supply. The return bus is common for both power circuits.
- 2MQML – long version
<img src="https://gitlab.cern.ch/LHCData/lhc-sm-hwc/-/raw/master/figures/ipq/2MQML_QPS.png" width=75%>
Apertures B1 of 2 magnets are powered in series with one power supply Apertures B2 of 2 magnets are powered in series with second power supply. The return bus is common for both power circuits.
- 2MQM + 2MQML
<img src="https://gitlab.cern.ch/LHCData/lhc-sm-hwc/-/raw/master/figures/ipq/2MQM_2MQML_QPS.png" width=75%>
Apertures B1 of 2 MQM and 2 MQML are powered in series with one power supply Apertures B2 of 2 MQM and 2 MQML are powered in series with second power supply. The return bus is common for both power circuits.
- 2MQM+2MQMC
<img src="https://gitlab.cern.ch/LHCData/lhc-sm-hwc/-/raw/master/figures/ipq/2MQM_2MQMC_QPS.png" width=75%>
Apertures B1 of 2 MQM and 2 MQMC are powered in series with one power supply Apertures B2 of 2 MQM and 2 MQMC are powered in series with second power supply. The return bus is common for both power circuits.
## Quench Detection System
**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, 1 s
- Polarity convention: if I_B1 = I_B2 > 0, LD1:U_RES < 0, LD3: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 here above
- U_RES_B1 = U_1_B1 + U_2_B1
- U_RES_B2 = U_1_B2 + U_2_B2
- Threshold on U_RES: 100 mV, 10 ms
- Attention: B1 signals & B2 signals can be shifted by 4ms from each other
- If pure inductive signal:
- If dI/dt < 0:
- U_1_Qx = Ldi / dt < 0
- U_2_Qx = -Ldi / dt > 0
- PM file:
- Buffer range: 501 to 1500, event at point 1000
- Time range: -2 to 2s
- Frequency: 250Hz (dt = 4ms)
The protection of the MQM quadrupole during a quench is assured by eight strip quench heaters placed on the outer layer of each coil octant.
<img src="https://gitlab.cern.ch/LHCData/lhc-sm-hwc/-/raw/master/figures/ipq/QH_topology.png" width=75%>
For redundancy, the heaters are connected in two circuits, such that each circuit covers all four poles and powered by independent power supplies.
<img src="https://gitlab.cern.ch/LHCData/lhc-sm-hwc/-/raw/master/figures/ipq/QH_powering.png" width=75%>
|Type|Test|Current|Description|Notebook|Example report|
|----|----|-------|-----------|--------|--------------|
|HWC|PCC.3|I\_PCC|Power Converter Configuration|-|-|
|HWC|PIC2|I\_MIN\_OP|Powering Interlock Controller check with standby current in the circuits.|-|-|
|HWC|PLI1.c3|I\_INJECTION|Fast Power Abort at injection current.|[AN\_IPQ\_PLI1.c3](https://gitlab.cern.ch/LHCData/lhc-sm-hwc/-/blob/master/ipq/AN_IPQ_PLI1.c2.ipynb)|[AN_IPQ_PLI1.c3](https://sigmon.web.cern.ch/node/#)|
|HWC|PLI2.f3|I\_INTERM\_1|Unbalanced ramp and Quench Heater Firing|[AN\_IPQ\_PLI2.f3](https://gitlab.cern.ch/LHCData/lhc-sm-hwc/-/blob/master/ipq/AN_IPQ_PLI2.f3.ipynb)|[AN_IPQ_PLI2.f3](https://sigmon.web.cern.ch/node/#)|
|HWC|PLI2.e3|I\_INTERM\_1|Unbalanced slow power abort|[AN\_IPQ\_PLI2.e3](https://gitlab.cern.ch/LHCData/lhc-sm-hwc/-/blob/master/ipq/AN_IPQ_PLI2.e3.ipynb)|[AN_IPQ_PLI2.e3](https://sigmon.web.cern.ch/node/#)|
|HWC|PNO.f4|I\_PNO|Symmetric Ramp and Symmetric Quench Heater Firing|[AN\_IPQ\_PNO.f4](https://gitlab.cern.ch/LHCData/lhc-sm-hwc/-/blob/master/ipqAN_IPQ_PNO.f4.ipynb)|[AN_IPQ_PNO.f4](https://sigmon.web.cern.ch/node/#)|
|HWC|PNO.a7|I\_PNO+I\_DELTA|Powering to I\_PNO + I\_DELTA and unbalanced SPA|[AN\_IPQ\_PNO.a7](https://gitlab.cern.ch/LHCData/lhc-sm-hwc/-/blob/master/ipq/AN_IPQ_PNO.a7.ipynb)|[AN_IPQ_PNO.a7](https://sigmon.web.cern.ch/node/#)|
|HWC|PNO.c4|I\_PNO|Current Lead test and FPA from I\_PNO|[AN\_IPQ\_PNO.c4](https://gitlab.cern.ch/LHCData/lhc-sm-hwc/-/blob/master/ipq/AN_IPQ_PNO.c4.ipynb)|[AN_IPQ_PNO.c4](https://sigmon.web.cern.ch/node/#)|
|Operation|FPA|I\_PNO|FPA during operation with magnets quenching|[AN\_IPQ\_FPA](https://gitlab.cern.ch/LHCData/lhc-sm-hwc/-/blob/master/ipq/AN_IPQ_FPA.ipynb)|[AN_IPQ_FPA](https://sigmon.web.cern.ch/node/#)|
source: Test Procedure and Acceptance Criteria for the Individually Powered 4-6 kA Quadrupole-Circuits in the LHC Insertions, MP3 Procedure, <a href="https://edms.cern.ch/document/874884/3.1">https://edms.cern.ch/document/874884/3.1</a>
## 4. IPD - Beam Separation Dipoles D1-D4
## 5. IPD - Beam Separation Dipoles D1-D4
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)
......@@ -374,7 +472,7 @@ DQAMG - controller attached to global protection
source: Test Procedure and Acceptance Criteria for the Separation Dipoles Circuits, MP3 Procedure, <a href="https://edms.cern.ch/document/874885/4.1">https://edms.cern.ch/document/874885/4.1</a>
## 5. 600A Circuits
## 6. 600A Circuits
The 600-A circuits come in one of two main variants:
- circuits with
- and without EE.
......