Commit 80b20a1e authored by Michal Maciejewski's avatar Michal Maciejewski
Browse files

Upgraded IT, IPQ, IPD

parent 9689385d
Pipeline #2021489 failed with stage
in 37 seconds
......@@ -411,23 +411,23 @@ This number of heaters is required to limit the voltage during quench in case of
|----|----|-------|-----------|--------|--------------|
|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|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.c3.ipynb)|[AN\_IPQ\_PLI1.c3](https://sigmon.web.cern.ch/node/94)|
|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/95)|
|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/96)|
|HWC|PNO.f4|I\_PNO|Symmetric Ramp and Symmetric Quench Heater Firing|||
|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://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/#)|
|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/97)|
|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/98)|
|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/99)|
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>
## 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)
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](https://twiki.cern.ch/twiki/pub/MP3/General_Info_IPD/separation_dipole.pdf)
|Magnets in the Circuit|Temperature|Position|General information|
|----------------------|-----------|--------|-------------------|
|MBX (D1)|1.9 K| RD1.R2, RD1.R8|I Nominal: 5800A, I_Ultimate: 6100A|
|MBX (D1)|1.9 K| RD1.L2, RD1.R2, RD1.L8, 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|
......
__version__ = "1.1.0"
__version__ = "1.2.0"
%% Cell type:markdown id: tags:
<h1><center>Analysis of an FPA 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.
<img src="https://gitlab.cern.ch/LHCData/lhc-sm-hwc/-/raw/master/figures/ipd/IPD_MBX_D1.png" width=50%>
- MBRC – D2
- MBRB – D4
Apertures B1 and B2 of the magnet are powered in series with one power supply.
<img src="https://gitlab.cern.ch/LHCData/lhc-sm-hwc/-/raw/master/figures/ipd/IPD_MBRC_D2_MBRB_D4.png" width=50%>
- MBRS - D3
Apertures B1 and B2 of the magnet are powered in series with one power supply but series connection done in the DFBA.
<img src="https://gitlab.cern.ch/LHCData/lhc-sm-hwc/-/raw/master/figures/ipd/IPD_MBRS_D3.png" width=50%>
|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)
%% 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.qh.DateTimeBaseModule import DateTimeBaseModule
from lhcsmapi.gui.pc.FgcPmSearchModuleMediator import FgcPmSearchModuleMediator
from lhcsmapi.gui.pc.IpdFgcPmSearchBaseModule import IpdFgcPmSearchBaseModule
analysis_start_time = datetime.now().strftime("%Y.%m.%d_%H%M%S.%f")
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 IPD circuit please:
1. Select circuit name (e.g., RD1.L2)
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 = 'IPD'
fgc_pm_search = FgcPmSearchModuleMediator(DateTimeBaseModule(start_date_time='2018-12-03 00:00:00+01:00',
end_date_time='2018-12-04 00:00:00+01:00'), IpdFgcPmSearchBaseModule(), 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():
circuit_name = fgc_pm_search.get_circuit_name()
timestamp_fgc = fgc_pm_search.get_fgc_timestamp()
author = fgc_pm_search.get_author()
is_automatic = fgc_pm_search.is_automatic_mode()
query = IpdCircuitQuery(circuit_type, circuit_name, max_executions=8)
# PC
i_meas_df, i_a_df, i_ref_df, i_earth_df = query.query_pc_pm(timestamp_fgc, timestamp_fgc, signal_names=['I_MEAS', 'I_A', 'I_REF', 'I_EARTH'])
i_meas_df, i_a_df, i_ref_df, i_earth_df, i_earth_pcnt_df = query.query_pc_pm(timestamp_fgc, timestamp_fgc, signal_names=['I_MEAS', 'I_A', 'I_REF', 'I_EARTH', 'I_EARTH_PCNT'])
# 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_1_B1', 'U_2_B1', 'U_RES_B1'] if query.circuit_type == 'IPD2_B1B2' else ['U_1', 'U_2', 'U_RES']
u_1_df, u_2_df, u_res_df = query.query_qds_pm(timestamp_qds, timestamp_qds, signal_names=signal_names)
u_1_df, u_2_df, u_res_df = query.query_qds_pm(timestamp_qds, timestamp_fgc, signal_names=signal_names)
# 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 []
# 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=[(300, 's'), (900, 's')])
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=[(300, 's'), (900, 's')])
# Results Table
results_table = query.create_report_analysis_template(timestamp_fgc=timestamp_fgc, author=author)
analysis = IpdCircuitAnalysis(query.circuit_type, results_table)
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
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}
analysis.create_timestamp_table(timestamp_dct)
```
%% Cell type:markdown id: tags:
# 4. PC
## 4.1. Main Current
*QUERY*:
|Variable Name |Variable Type |Variable Unit |Database|Comment
|---------------|---------------|---------------|--------|------|
|i_meas_df |DataFrame |A |PM|Main current of the power converter, I_MEAS|
|i_a_df |DataFrame |A |PM|Actual current of the power converter, I_A|
|i_ref_df |DataFrame |A |PM|Reference current of the RQX power converter, I_REF|
*ANALYSIS*:
- calculation of the ramp rate
- calculation of the time constant
- calculation of the duration of a plateau prior to a quench
- calculation of DCCT MIIts
*GRAPHS*:
- t = 0 s corresponds to the FGC timestamp
- one plot for each power converter
%% Cell type:code id: tags:
``` python
analysis.plot_i_meas_pc(circuit_name, timestamp_fgc, [i_meas_df, i_a_df, i_ref_df], xlim=(-10, 5))
tau_ipd = analysis.calculate_i_meas_tau([i_meas_df], duration_decay=(0, 2))
print('Time constant = %4.3f s.' % (tau_ipd))
analysis.plot_i_meas_pc(circuit_name, timestamp_fgc, [i_meas_df, i_a_df, i_ref_df], xlim=(-10, 3*tau_ipd))
```
%% Cell type:code id: tags:
``` python
analysis.plot_i_meas_pc(circuit_name, timestamp_fgc, [i_meas_df, i_a_df, i_ref_df],
xlim=(-0.1, 0.2), ylim=(i_meas_df.max().values[0]-1500, i_meas_df.max().values[0]+500))
```
%% Cell type:code id: tags:
``` python
t_quench = analysis.find_time_of_quench(i_ref_df)
t_quench = analysis.find_start_end_quench_detection(u_res_df)[0]
analysis.calculate_current_slope(i_meas_df)
analysis.calculate_current_miits(i_meas_df, t_quench, col_name='MIITs_DCCT')
analysis.calculate_quench_current(i_meas_df, t_quench, col_name='I_MEAS')
```
%% Cell type:markdown id: tags:
## 4.2. Earth Current
*QUERY*:
|Variable Name |Variable Type |Variable Unit |Database|Comment
|---------------|---------------|---------------|--------|-------|
|i_earth_df |DataFrame |A |PM|Main current of the power converter, I_EARTH|
*ANALYSIS*:
- calculation of the maximum earth current
*GRAPHS*:
- t = 0 s corresponds to the FGC timestamp
- one plot for each power converter
%% Cell type:code id: tags:
``` python
analysis.plot_i_earth_pcnt_pc(circuit_name, timestamp_fgc, i_earth_pcnt_df)
```
%% Cell type:code id: tags:
``` python
analysis.plot_i_earth_pc(circuit_name, timestamp_fgc, i_earth_df)
analysis.calculate_max_i_earth_pc(i_earth_df, col_name='max_I_EARTH')
```
%% 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
*QUERY*:
|Variable Name |Variable Type |Variable Unit |Database|Comment
|---------------|---------------|---------------|--------|------|
|u_res_q_df |DataFrame |V |PM|Resistive voltage of magnets measured with QPS, U_RES_Q1, U_RES_Q2, U_RES_Q3|
|u_1_q_df |DataFrame |V |PM|Voltage of the first aperture measured with QPS, U_1_Q1, U_1_Q2, U_1_Q3|
|u_2_q_df |DataFrame |V |PM|Voltage of the first aperture measured with QPS, U_2_Q1, U_2_Q2, U_2_Q3|
Note that **q** in the table above denotes Q1, Q2, and Q3, i.e., there are three signals for each magnet.
*ANALYSIS*:
- 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.
- Origin of a quench, i.e., name of the first magnet for which the U_RES voltage exceeded the 100 mV threshold.
*GRAPHS*:
t = 0 s corresponds to the QPS timestamp
t = 0 s corresponds to the FGC timestamp
%% Cell type:code id: tags:
``` python
u_res_slope_df = analysis.calculate_u_res_slope(u_res_df)
analysis.plot_u_res_u_res_slope_u_1_u_2(circuit_name, timestamp_qds, u_res_df, u_res_slope_df, u_1_df, u_2_df)
t_quench = analysis.find_start_end_quench_detection(u_res_df)[0]
u_res_slope_df = analysis.calculate_u_res_slope(u_res_df[u_res_df.index < t_quench])
analysis.plot_u_res_u_res_slope_u_1_u_2(circuit_name, timestamp_qds, u_res_df, u_res_slope_df, u_1_df, u_2_df,
xlim=(u_res_slope_df.index[0]-0.2, u_res_slope_df.index[1]+0.1))
```
%% Cell type:markdown id: tags:
## 5.2. Current Leads
*QUERY*:
|Variable Name |Variable Type |Variable Unit |Database|Comment
|---------------|---------------|---------------|--------|------|
|u_res_dfs |DataFrame |V |PM|Leads resisitive voltage, U_RES|
|u_hts_dfs |DataFrame |V |PM|Leads HTS voltage, U_HTS|
*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 LEADS timestamp.
- t = 0 s corresponds to the FGC timestamp.
%% 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:code id: tags:
``` python
analysis.results_table['Reason'] = get_expert_decision('Reason for FPA: ', ['quench', 'coupling', 'other'])
analysis.results_table['Quench Origin'] = get_expert_decision('Quench Origin: ', ['magnet', 'busbar', 'u_res_lead', 'u_hts_lead'])
```
%% Cell type:markdown id: tags:
## 5.3. Quench Heaters
*QUERY*:
|Variable Name |Variable Type |Variable Unit |Database|Comment
|---------------|---------------|---------------|--------|------|
|u_hds_dfs |list of DataFrame| V |PM| A list of U_HDS_1-2/U_HDS_1-4, signals from PM for quenched magnets|
|u_hds_ref_dfs |list of DataFrame| V |PM| A list of U_HDS_1-2 from PM for reference magnets|
*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
- 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: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)
!mkdir -p /eos/project/l/lhcsm/operation/IPD/$circuit_name
file_name = "{}-{}-PM_IPD_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/IPD/{}/{}_mp3_results_table.csv'.format(circuit_name, file_name)
file_name = "{}_FPA-{}-{}".format(circuit_name, Time.to_datetime(timestamp_fgc).strftime("%Y.%m.%d_%H%M%S"), analysis_start_time)
full_path = '/eos/project/l/lhcsm/operation/IPD/{}/{}_mp3_table.csv'.format(circuit_name, file_name)
mp3_results_table = analysis.create_mp3_results_table()
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/IPD/{}/{}'.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_IPD_FPA.ipynb' --output /eos/project/l/lhcsm/operation/IPD/$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
```
......