Commit 413f4b39 authored by Zinour Charifoulline's avatar Zinour Charifoulline
Browse files

Contributor

parent b04aee4d
Pipeline #2471346 passed with stage
in 19 seconds
__version__ = "1.5.54" __version__ = "1.5.55"
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
<h1><center>Analysis of PLI2.f1 HWC Test in an RQ Circuit</center></h1> <h1><center>Analysis of PLI2.f1 HWC Test in an RQ Circuit</center></h1>
<img src="https://gitlab.cern.ch/LHCData/lhc-sm-hwc/raw/master/figures/rq/RQ.png" width=75%> <img src="https://gitlab.cern.ch/LHCData/lhc-sm-hwc/raw/master/figures/rq/RQ.png" width=75%>
source: Test Procedure and Acceptance Criteria for the 13 kA Quadrupole (RQD-RQF) Circuits, MP3 Procedure, <a href="https://edms.cern.ch/document/874714">https://edms.cern.ch/document/874714</a> (Please follow this link for the latest version) source: Test Procedure and Acceptance Criteria for the 13 kA Quadrupole (RQD-RQF) Circuits, MP3 Procedure, <a href="https://edms.cern.ch/document/874714">https://edms.cern.ch/document/874714</a> (Please follow this link for the latest version)
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
# Analysis Assumptions # 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. - 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.
- 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). - 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 # Plot Convention
- Scales are labeled with signal name followed by a comma and a unit in square brackets, e.g., I_MEAS, [A]. - 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 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. - 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 grid comes from the left axis.
- The title contains timestamp, circuit name, and signal name allowing to re-access the signal. - 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). - 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. - 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. - 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: %% Cell type:markdown id: tags:
# 0. Initialise Working Environment # 0. Initialise Working Environment
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
# External libraries # External libraries
print('Loading (1/11)'); import pandas as pd print('Loading (1/11)'); import pandas as pd
print('Loading (2/11)'); import sys print('Loading (2/11)'); import sys
print('Loading (3/11)'); from IPython.display import display, Javascript, clear_output, HTML print('Loading (3/11)'); from IPython.display import display, Javascript, clear_output, HTML
# Internal libraries # Internal libraries
print('Loading (4/11)'); import lhcsmapi print('Loading (4/11)'); import lhcsmapi
print('Loading (5/11)'); from lhcsmapi.Time import Time print('Loading (5/11)'); from lhcsmapi.Time import Time
print('Loading (6/11)'); from lhcsmapi.Timer import Timer print('Loading (6/11)'); from lhcsmapi.Timer import Timer
print('Loading (7/11)'); from lhcsmapi.analysis.RqCircuitQuery import RqCircuitQuery print('Loading (7/11)'); from lhcsmapi.analysis.RqCircuitQuery import RqCircuitQuery
print('Loading (8/11)'); from lhcsmapi.analysis.RqCircuitAnalysis import RqCircuitAnalysis print('Loading (8/11)'); from lhcsmapi.analysis.RqCircuitAnalysis import RqCircuitAnalysis
print('Loading (9/11)'); from lhcsmapi.analysis.report_template import apply_report_template print('Loading (9/11)'); from lhcsmapi.analysis.report_template import apply_report_template
print('Loading (10/11)'); from lhcsmapi.gui.hwc.HwcSearchModuleMediator import HwcSearchModuleMediator print('Loading (10/11)'); from lhcsmapi.gui.hwc.HwcSearchModuleMediator import HwcSearchModuleMediator
print('Loading (11/11)'); from lhcsmapi.analysis.expert_input import get_expert_decision print('Loading (11/11)'); from lhcsmapi.analysis.expert_input import get_expert_decision
clear_output() clear_output()
lhcsmapi.get_lhcsmapi_version() lhcsmapi.get_lhcsmapi_version()
lhcsmapi.get_lhcsmhwc_version('../__init__.py') lhcsmapi.get_lhcsmhwc_version('../__init__.py')
print('Analysis performed by %s' % HwcSearchModuleMediator.get_user()) print('Analysis performed by %s' % HwcSearchModuleMediator.get_user())
``` ```
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
# 1. User Input # 1. User Input
1. Copy code from AccTesting and paste into an empty cell below 1. Copy code from AccTesting and paste into an empty cell below
<img src="https://gitlab.cern.ch/LHCData/lhc-sm-hwc/-/raw/master/figures/swan-manual-acctesting-integration.png"> <img src="https://gitlab.cern.ch/LHCData/lhc-sm-hwc/-/raw/master/figures/swan-manual-acctesting-integration.png">
- If you only want to test the notebook only for the copy&paste feature (without opening the AccTesting), please copy and execute the code below - If you only want to test the notebook only for the copy&paste feature (without opening the AccTesting), please copy and execute the code below
``` ```
hwc_test = 'PLI2.f1' hwc_test = 'PLI2.f1'
circuit_name = 'RQD.A12' circuit_name = 'RQD.A12'
campaign = 'HWC_2014' campaign = 'HWC_2014'
t_start = '2015-01-17 21:52:03.746' t_start = '2015-01-17 21:52:03.746'
t_end = '2015-01-17 22:04:52.451' t_end = '2015-01-17 22:04:52.451'
``` ```
2. To analyze a historical test with a browser GUI, copy and execute the following code in the cell below 2. To analyze a historical test with a browser GUI, copy and execute the following code in the cell below
``` ```
circuit_type = 'RQ' circuit_type = 'RQ'
hwc_test = 'PLI2.f1' hwc_test = 'PLI2.f1'
hwcb = HwcSearchModuleMediator(circuit_type=circuit_type, hwc_test=hwc_test, hwc_summary_path='/eos/project/l/lhcsm/hwc/HWC_Summary.csv') hwcb = HwcSearchModuleMediator(circuit_type=circuit_type, hwc_test=hwc_test, hwc_summary_path='/eos/project/l/lhcsm/hwc/HWC_Summary.csv')
``` ```
- After opening the browser GUI, choose a circuit name in order to display HWC test with, campaign name as well as start and end time - After opening the browser GUI, choose a circuit name in order to display HWC test with, campaign name as well as start and end time
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
hwc_test = 'PLI2.f1'
circuit_name = 'RQD.A45'
campaign= 'Recommissioning post LS2'
t_start = '2021-04-07 20:44:14.437000000'
t_end = '2021-04-07 20:55:41.364000000'
``` ```
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
print('hwc_test = \'%s\'\ncircuit_name = \'%s\'\ncampaign = \'%s\'\nt_start = \'%s\'\nt_end = \'%s\'' % (hwc_test, circuit_name, campaign, t_start, t_end)) print('hwc_test = \'%s\'\ncircuit_name = \'%s\'\ncampaign = \'%s\'\nt_start = \'%s\'\nt_end = \'%s\'' % (hwc_test, circuit_name, campaign, t_start, t_end))
``` ```
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
# 2. Query All Signals Prior to Analysis # 2. Query All Signals Prior to Analysis
%% Cell type:code id: tags:skip_output %% Cell type:code id: tags:skip_output
``` python ``` python
circuit_type = 'RQ' circuit_type = 'RQ'
if 'hwcb' in locals(): if 'hwcb' in locals():
circuit_name = hwcb.get_circuit_name() circuit_name = hwcb.get_circuit_name()
t_start = Time.to_unix_timestamp(hwcb.get_start_time()) t_start = Time.to_unix_timestamp(hwcb.get_start_time())
t_end = Time.to_unix_timestamp(hwcb.get_end_time()) t_end = Time.to_unix_timestamp(hwcb.get_end_time())
t_start_ref = Time.to_unix_timestamp(hwcb.get_ref_start_time()) t_start_ref = Time.to_unix_timestamp(hwcb.get_ref_start_time())
t_end_ref = Time.to_unix_timestamp(hwcb.get_ref_end_time()) t_end_ref = Time.to_unix_timestamp(hwcb.get_ref_end_time())
is_automatic = hwcb.is_automatic_mode() is_automatic = hwcb.is_automatic_mode()
else: else:
t_start = Time.to_unix_timestamp(t_start) t_start = Time.to_unix_timestamp(t_start)
t_end = Time.to_unix_timestamp(t_end) t_end = Time.to_unix_timestamp(t_end)
t_start_ref, t_end_ref = HwcSearchModuleMediator.get_last_ref_start_end_time('/eos/project/l/lhcsm/hwc/HWC_Summary.csv', circuit_name, hwc_test, Time.to_string_short(t_start)) t_start_ref, t_end_ref = HwcSearchModuleMediator.get_last_ref_start_end_time('/eos/project/l/lhcsm/hwc/HWC_Summary.csv', circuit_name, hwc_test, Time.to_string_short(t_start))
t_start_ref, t_end_ref = Time.to_unix_timestamp(t_start_ref), Time.to_unix_timestamp(t_end_ref) t_start_ref, t_end_ref = Time.to_unix_timestamp(t_start_ref), Time.to_unix_timestamp(t_end_ref)
is_automatic = False is_automatic = False
circuit_names = [circuit_name if 'RQD' in circuit_name else circuit_name.replace('F', 'D'), circuit_names = [circuit_name if 'RQD' in circuit_name else circuit_name.replace('F', 'D'),
circuit_name if 'RQF' in circuit_name else circuit_name.replace('D', 'F')] circuit_name if 'RQF' in circuit_name else circuit_name.replace('D', 'F')]
rqd_query = RqCircuitQuery(circuit_type, circuit_names[0], max_executions=28) rqd_query = RqCircuitQuery(circuit_type, circuit_names[0], max_executions=28)
rqf_query = RqCircuitQuery(circuit_type, circuit_names[1], max_executions=19) rqf_query = RqCircuitQuery(circuit_type, circuit_names[1], max_executions=19)
with Timer(): with Timer():
# PC # PC
source_timestamp_df = rqd_query.find_source_timestamp_pc(t_start, t_end) source_timestamp_df = rqd_query.find_source_timestamp_pc(t_start, t_end)
timestamp_fgc_rqd = source_timestamp_df.at[0, 'timestamp'] timestamp_fgc_rqd = source_timestamp_df.at[0, 'timestamp']
source_timestamp_df = rqf_query.find_source_timestamp_pc(t_start, t_end) source_timestamp_df = rqf_query.find_source_timestamp_pc(t_start, t_end)
timestamp_fgc_rqf = source_timestamp_df.at[0, 'timestamp'] timestamp_fgc_rqf = source_timestamp_df.at[0, 'timestamp']
i_meas_rqd_df, i_a_rqd_df, i_earth_rqd_df, i_earth_pcnt_rqd_df, i_ref_rqd_df = rqd_query.query_pc_pm(timestamp_fgc_rqd, timestamp_fgc_rqd, signal_names=['I_MEAS', 'I_A', 'IEARTH', 'I_EARTH_PCNT', 'I_REF']) i_meas_rqd_df, i_a_rqd_df, i_earth_rqd_df, i_earth_pcnt_rqd_df, i_ref_rqd_df = rqd_query.query_pc_pm(timestamp_fgc_rqd, timestamp_fgc_rqd, signal_names=['I_MEAS', 'I_A', 'IEARTH', 'I_EARTH_PCNT', 'I_REF'])
i_meas_rqf_df, i_a_rqf_df, i_earth_rqf_df, i_earth_pcnt_rqf_df, i_ref_rqf_df = rqf_query.query_pc_pm(timestamp_fgc_rqf, timestamp_fgc_rqf, signal_names=['I_MEAS', 'I_A', 'IEARTH', 'I_EARTH_PCNT', 'I_REF']) i_meas_rqf_df, i_a_rqf_df, i_earth_rqf_df, i_earth_pcnt_rqf_df, i_ref_rqf_df = rqf_query.query_pc_pm(timestamp_fgc_rqf, timestamp_fgc_rqf, signal_names=['I_MEAS', 'I_A', 'IEARTH', 'I_EARTH_PCNT', 'I_REF'])
source_timestamp_pc_rqd_ref_df = rqd_query.find_source_timestamp_pc(t_start_ref, t_end_ref) source_timestamp_pc_rqd_ref_df = rqd_query.find_source_timestamp_pc(t_start_ref, t_end_ref)
timestamp_fgc_ref_rqd = source_timestamp_pc_rqd_ref_df.at[0, 'timestamp'] timestamp_fgc_ref_rqd = source_timestamp_pc_rqd_ref_df.at[0, 'timestamp']
source_timestamp_pc_rqf_ref_df = rqf_query.find_source_timestamp_pc(t_start_ref, t_end_ref) source_timestamp_pc_rqf_ref_df = rqf_query.find_source_timestamp_pc(t_start_ref, t_end_ref)
timestamp_fgc_ref_rqf = source_timestamp_pc_rqf_ref_df.at[0, 'timestamp'] timestamp_fgc_ref_rqf = source_timestamp_pc_rqf_ref_df.at[0, 'timestamp']
i_meas_ref_rqd_df, i_earth_rqd_ref_df, i_earth_pcnt_rqd_ref_df = rqd_query.query_pc_pm(timestamp_fgc_ref_rqd, timestamp_fgc_ref_rqd, signal_names=['I_MEAS', 'IEARTH', 'I_EARTH_PCNT']) i_meas_ref_rqd_df, i_earth_rqd_ref_df, i_earth_pcnt_rqd_ref_df = rqd_query.query_pc_pm(timestamp_fgc_ref_rqd, timestamp_fgc_ref_rqd, signal_names=['I_MEAS', 'IEARTH', 'I_EARTH_PCNT'])
i_meas_ref_rqf_df, i_earth_rqf_ref_df, i_earth_pcnt_rqf_ref_df = rqf_query.query_pc_pm(timestamp_fgc_ref_rqf, timestamp_fgc_ref_rqf, signal_names=['I_MEAS', 'IEARTH', 'I_EARTH_PCNT']) i_meas_ref_rqf_df, i_earth_rqf_ref_df, i_earth_pcnt_rqf_ref_df = rqf_query.query_pc_pm(timestamp_fgc_ref_rqf, timestamp_fgc_ref_rqf, signal_names=['I_MEAS', 'IEARTH', 'I_EARTH_PCNT'])
# PIC # PIC
timestamp_pic_rqd = rqd_query.find_timestamp_pic(timestamp_fgc_rqd, spark=spark) timestamp_pic_rqd = rqd_query.find_timestamp_pic(timestamp_fgc_rqd, spark=spark)
timestamp_pic_rqf = rqf_query.find_timestamp_pic(timestamp_fgc_rqf, spark=spark) timestamp_pic_rqf = rqf_query.find_timestamp_pic(timestamp_fgc_rqf, spark=spark)
# EE # EE
source_timestamp_ee_rqd_df = rqd_query.find_source_timestamp_ee(timestamp_fgc_rqd) source_timestamp_ee_rqd_df = rqd_query.find_source_timestamp_ee(timestamp_fgc_rqd)
timestamp_ee_rqd = source_timestamp_ee_rqd_df.loc[0, 'timestamp'] timestamp_ee_rqd = source_timestamp_ee_rqd_df.loc[0, 'timestamp']
u_dump_res_rqd_df = rqd_query.query_ee_u_dump_res_pm(timestamp_ee_rqd, timestamp_fgc_rqd, system='EE', signal_names=['U_DUMP_RES'])[0] u_dump_res_rqd_df = rqd_query.query_ee_u_dump_res_pm(timestamp_ee_rqd, timestamp_fgc_rqd, system='EE', signal_names=['U_DUMP_RES'])[0]
source_timestamp_ee_rqf_df = rqf_query.find_source_timestamp_ee(timestamp_fgc_rqf) source_timestamp_ee_rqf_df = rqf_query.find_source_timestamp_ee(timestamp_fgc_rqf)
timestamp_ee_rqf = source_timestamp_ee_rqf_df.loc[0, 'timestamp'] timestamp_ee_rqf = source_timestamp_ee_rqf_df.loc[0, 'timestamp']
u_dump_res_rqf_df = rqf_query.query_ee_u_dump_res_pm(timestamp_ee_rqf, timestamp_fgc_rqf, system='EE', signal_names=['U_DUMP_RES'])[0] u_dump_res_rqf_df = rqf_query.query_ee_u_dump_res_pm(timestamp_ee_rqf, timestamp_fgc_rqf, system='EE', signal_names=['U_DUMP_RES'])[0]
t_res_0_rqd_df = rqd_query.query_ee_t_res_pm(source_timestamp_ee_rqd_df.loc[0, 'timestamp'], timestamp_fgc_rqd, system='EE', signal_names=['T_RES'])[0] t_res_0_rqd_df = rqd_query.query_ee_t_res_pm(source_timestamp_ee_rqd_df.loc[0, 'timestamp'], timestamp_fgc_rqd, system='EE', signal_names=['T_RES'])[0]
if len(source_timestamp_ee_rqd_df) > 1: if len(source_timestamp_ee_rqd_df) > 1:
t_res_1_rqd_df = rqd_query.query_ee_t_res_pm(source_timestamp_ee_rqd_df.loc[1, 'timestamp'], timestamp_fgc_rqd, system='EE', signal_names=['T_RES'])[0] t_res_1_rqd_df = rqd_query.query_ee_t_res_pm(source_timestamp_ee_rqd_df.loc[1, 'timestamp'], timestamp_fgc_rqd, system='EE', signal_names=['T_RES'])[0]
else: else:
t_res_1_rqd_df = pd.DataFrame(columns=['T_RES']) t_res_1_rqd_df = pd.DataFrame(columns=['T_RES'])
t_res_0_rqf_df = rqf_query.query_ee_t_res_pm(source_timestamp_ee_rqf_df.loc[0, 'timestamp'], timestamp_fgc_rqf, system='EE', signal_names=['T_RES'])[0] t_res_0_rqf_df = rqf_query.query_ee_t_res_pm(source_timestamp_ee_rqf_df.loc[0, 'timestamp'], timestamp_fgc_rqf, system='EE', signal_names=['T_RES'])[0]
if len(source_timestamp_ee_rqf_df) > 1: if len(source_timestamp_ee_rqf_df) > 1:
t_res_1_rqf_df = rqf_query.query_ee_t_res_pm(source_timestamp_ee_rqf_df.loc[1, 'timestamp'], timestamp_fgc_rqf, system='EE', signal_names=['T_RES'])[0] t_res_1_rqf_df = rqf_query.query_ee_t_res_pm(source_timestamp_ee_rqf_df.loc[1, 'timestamp'], timestamp_fgc_rqf, system='EE', signal_names=['T_RES'])[0]
else: else:
t_res_1_rqf_df = pd.DataFrame(columns=['T_RES']) t_res_1_rqf_df = pd.DataFrame(columns=['T_RES'])
# EE - REF # EE - REF
source_timestamp_ee_rqd_ref_df = rqd_query.find_source_timestamp_ee(timestamp_fgc_ref_rqd) source_timestamp_ee_rqd_ref_df = rqd_query.find_source_timestamp_ee(timestamp_fgc_ref_rqd)
source_timestamp_ee_rqf_ref_df = rqf_query.find_source_timestamp_ee(timestamp_fgc_ref_rqf) source_timestamp_ee_rqf_ref_df = rqf_query.find_source_timestamp_ee(timestamp_fgc_ref_rqf)
t_res_0_rqd_ref_df = rqd_query.query_ee_t_res_pm(source_timestamp_ee_rqd_ref_df.loc[0, 'timestamp'], timestamp_fgc_ref_rqd, system='EE', signal_names=['T_RES'])[0] t_res_0_rqd_ref_df = rqd_query.query_ee_t_res_pm(source_timestamp_ee_rqd_ref_df.loc[0, 'timestamp'], timestamp_fgc_ref_rqd, system='EE', signal_names=['T_RES'])[0]
if len(source_timestamp_ee_rqd_ref_df) > 1: if len(source_timestamp_ee_rqd_ref_df) > 1:
t_res_1_rqd_ref_df = rqd_query.query_ee_t_res_pm(source_timestamp_ee_rqd_ref_df.loc[1, 'timestamp'], timestamp_fgc_ref_rqd, system='EE', signal_names=['T_RES'])[0] t_res_1_rqd_ref_df = rqd_query.query_ee_t_res_pm(source_timestamp_ee_rqd_ref_df.loc[1, 'timestamp'], timestamp_fgc_ref_rqd, system='EE', signal_names=['T_RES'])[0]
else: else:
t_res_1_rqd_ref_df = pd.DataFrame(columns=['T_RES']) t_res_1_rqd_ref_df = pd.DataFrame(columns=['T_RES'])
t_res_0_rqf_ref_df = rqf_query.query_ee_t_res_pm(source_timestamp_ee_rqf_ref_df.loc[0, 'timestamp'], timestamp_fgc_ref_rqf, system='EE', signal_names=['T_RES'])[0] t_res_0_rqf_ref_df = rqf_query.query_ee_t_res_pm(source_timestamp_ee_rqf_ref_df.loc[0, 'timestamp'], timestamp_fgc_ref_rqf, system='EE', signal_names=['T_RES'])[0]
if len(source_timestamp_ee_rqf_ref_df) > 1: if len(source_timestamp_ee_rqf_ref_df) > 1:
t_res_1_rqf_ref_df = rqf_query.query_ee_t_res_pm(source_timestamp_ee_rqf_ref_df.loc[1, 'timestamp'], timestamp_fgc_ref_rqf, system='EE', signal_names=['T_RES'])[0] t_res_1_rqf_ref_df = rqf_query.query_ee_t_res_pm(source_timestamp_ee_rqf_ref_df.loc[1, 'timestamp'], timestamp_fgc_ref_rqf, system='EE', signal_names=['T_RES'])[0]
else: else:
t_res_1_rqf_ref_df = pd.DataFrame(columns=['T_RES']) t_res_1_rqf_ref_df = pd.DataFrame(columns=['T_RES'])
# iQPS # iQPS
source_timestamp_qds_rq_df = rqd_query.find_source_timestamp_qds(timestamp_fgc_rqd, duration=[(10, 's'), (200, 's')]) source_timestamp_qds_rq_df = rqd_query.find_source_timestamp_qds(timestamp_fgc_rqd, duration=[(10, 's'), (200, 's')])
if Time.to_unix_timestamp(timestamp_fgc_rqd) > 1577833200000000000: if Time.to_unix_timestamp(timestamp_fgc_rqd) > 1577833200000000000:
iqps_analog_0_dfs = rqd_query.query_iqps_analog_pm(source_timestamp_qds_rq_df, signal_names=['U_QS0_INT_A', 'U_QS0_EXT_A']) iqps_analog_dfs = rqd_query.query_iqps_analog_pm(source_timestamp_qds_rq_df, signal_names=['U_QS0_INT_A', 'U_QS0_EXT_A'])
iqps_analog_1_dfs = rqd_query.query_iqps_analog_pm(source_timestamp_qds_rq_df, signal_names=['U_QS1_INT_A', 'U_QS1_EXT_A'])
iqps_digital_dfs = rqd_query.query_iqps_analog_pm(source_timestamp_qds_rq_df, signal_names=['ST_NOLATCH_BR_EXT_A', 'ST_NOLATCH_BR_INT_A', 'ST_NOTRIG_BR_EXT_A', 'ST_NOTRIG_BR_INT_A']) iqps_digital_dfs = rqd_query.query_iqps_analog_pm(source_timestamp_qds_rq_df, signal_names=['ST_NOLATCH_BR_EXT_A', 'ST_NOLATCH_BR_INT_A', 'ST_NOTRIG_BR_EXT_A', 'ST_NOTRIG_BR_INT_A'])
else: else:
iqps_analog_dfs = rqd_query.query_iqps_analog_pm(source_timestamp_qds_rq_df, signal_names=['U_QS0_EXT', 'U_QS0_INT', 'U_1_EXT', 'U_2_EXT', 'U_1_INT', 'U_2_INT']) iqps_analog_dfs = rqd_query.query_iqps_analog_pm(source_timestamp_qds_rq_df, signal_names=['U_QS0_EXT', 'U_QS0_INT', 'U_1_EXT', 'U_2_EXT', 'U_1_INT', 'U_2_INT'])
iqps_digital_dfs = rqd_query.query_iqps_analog_pm(source_timestamp_qds_rq_df, signal_names=['ST_MAGNET_OK', 'ST_MAGNET_OK_INT', 'ST_NQD0_EXT', 'ST_NQD0_INT']) iqps_digital_dfs = rqd_query.query_iqps_analog_pm(source_timestamp_qds_rq_df, signal_names=['ST_MAGNET_OK', 'ST_MAGNET_OK_INT', 'ST_NQD0_EXT', 'ST_NQD0_INT'])
# nQPS # nQPS
source_timestamp_nqps_rqd_df = rqd_query.find_source_timestamp_nqps(timestamp_fgc_rqd) source_timestamp_nqps_rqd_df = rqd_query.find_source_timestamp_nqps(timestamp_fgc_rqd)
source_timestamp_nqps_rqf_df = rqf_query.find_source_timestamp_nqps(timestamp_fgc_rqf) source_timestamp_nqps_rqf_df = rqf_query.find_source_timestamp_nqps(timestamp_fgc_rqf)
u_nqps_rqd_dfs = rqd_query.query_nqps_voltage_pm(source_timestamp_qds_rq_df) u_nqps_rqd_dfs = rqd_query.query_nqps_voltage_pm(source_timestamp_qds_rq_df)
u_nqps_rqf_dfs = rqf_query.query_nqps_voltage_pm(source_timestamp_qds_rq_df) u_nqps_rqf_dfs = rqf_query.query_nqps_voltage_pm(source_timestamp_qds_rq_df)
# Results table # Results table
results_table = rqd_query.create_report_analysis_template(source_timestamp_qds_rq_df, source_timestamp_nqps_rqd_df, min(timestamp_fgc_rqd, timestamp_fgc_rqf), min(timestamp_pic_rqd, timestamp_pic_rqf), '../__init__.py', i_meas_rqd_df, i_meas_rqf_df, HwcSearchModuleMediator.get_user()) results_table = rqd_query.create_report_analysis_template(source_timestamp_qds_rq_df, source_timestamp_nqps_rqd_df, min(timestamp_fgc_rqd, timestamp_fgc_rqf), min(timestamp_pic_rqd, timestamp_pic_rqf), '../__init__.py', i_meas_rqd_df, i_meas_rqf_df, HwcSearchModuleMediator.get_user())
# QH # QH
source_timestamp_qh_rq_df = rqd_query.find_source_timestamp_qh(timestamp_fgc_rqd, duration=[(10, 's'), (200, 's')]) source_timestamp_qh_rq_df = rqd_query.find_source_timestamp_qh(timestamp_fgc_rqd, duration=[(10, 's'), (200, 's')])
i_hds_rq_dfs = rqd_query.query_qh_pm(source_timestamp_qh_rq_df, signal_names='I_HDS') i_hds_rq_dfs = rqd_query.query_qh_pm(source_timestamp_qh_rq_df, signal_names='I_HDS')
u_hds_rq_dfs = rqd_query.query_qh_pm(source_timestamp_qh_rq_df, signal_names='U_HDS') u_hds_rq_dfs = rqd_query.query_qh_pm(source_timestamp_qh_rq_df, signal_names='U_HDS')
i_hds_rq_ref_dfs = rqd_query.query_qh_pm(source_timestamp_qh_rq_df, signal_names='I_HDS', is_ref=True) i_hds_rq_ref_dfs = rqd_query.query_qh_pm(source_timestamp_qh_rq_df, signal_names='I_HDS', is_ref=True)
u_hds_rq_ref_dfs = rqd_query.query_qh_pm(source_timestamp_qh_rq_df, signal_names='U_HDS', is_ref=True) u_hds_rq_ref_dfs = rqd_query.query_qh_pm(source_timestamp_qh_rq_df, signal_names='U_HDS', is_ref=True)
# DIODE LEADS # DIODE LEADS
i_meas_u_diode_u_ref_rqd_pm_dfs = rqd_query.query_current_voltage_diode_leads_pm(timestamp_fgc_rqd, source_timestamp_qds_rq_df) i_meas_u_diode_u_ref_rqd_pm_dfs = rqd_query.query_current_voltage_diode_leads_pm(timestamp_fgc_rqd, source_timestamp_qds_rq_df)
i_meas_u_diode_rqd_nxcals_dfs = rqd_query.query_current_voltage_diode_leads_nxcals(source_timestamp_qds_rq_df, spark=spark) i_meas_u_diode_rqd_nxcals_dfs = rqd_query.query_current_voltage_diode_leads_nxcals(source_timestamp_qds_rq_df, spark=spark)
i_meas_u_diode_u_ref_rqf_pm_dfs = rqf_query.query_current_voltage_diode_leads_pm(timestamp_fgc_rqf, source_timestamp_qds_rq_df) i_meas_u_diode_u_ref_rqf_pm_dfs = rqf_query.query_current_voltage_diode_leads_pm(timestamp_fgc_rqf, source_timestamp_qds_rq_df)
i_meas_u_diode_rqf_nxcals_dfs = rqf_query.query_current_voltage_diode_leads_nxcals(source_timestamp_qds_rq_df, spark=spark) i_meas_u_diode_rqf_nxcals_dfs = rqf_query.query_current_voltage_diode_leads_nxcals(source_timestamp_qds_rq_df, spark=spark)
# DFB # DFB
source_timestamp_leads_rqd_df = rqd_query.find_timestamp_leads(timestamp_fgc_rqd) source_timestamp_leads_rqd_df = rqd_query.find_timestamp_leads(timestamp_fgc_rqd)
u_hts_rqd_dfs = rqd_query.query_leads(timestamp_fgc_rqd, source_timestamp_leads_rqd_df, signal_names=['U_HTS'], spark=spark) u_hts_rqd_dfs = rqd_query.query_leads(timestamp_fgc_rqd, source_timestamp_leads_rqd_df, signal_names=['U_HTS'], spark=spark)
u_res_rqd_dfs = rqd_query.query_leads(timestamp_fgc_rqd, source_timestamp_leads_rqd_df, signal_names=['U_RES'], spark=spark) u_res_rqd_dfs = rqd_query.query_leads(timestamp_fgc_rqd, source_timestamp_leads_rqd_df, signal_names=['U_RES'], spark=spark)
source_timestamp_leads_rqf_df = rqf_query.find_timestamp_leads(timestamp_fgc_rqf) source_timestamp_leads_rqf_df = rqf_query.find_timestamp_leads(timestamp_fgc_rqf)
u_hts_rqf_dfs = rqf_query.query_leads(timestamp_fgc_rqf, source_timestamp_leads_rqf_df, signal_names=['U_HTS'], spark=spark) u_hts_rqf_dfs = rqf_query.query_leads(timestamp_fgc_rqf, source_timestamp_leads_rqf_df, signal_names=['U_HTS'], spark=spark)
u_res_rqf_dfs = rqf_query.query_leads(timestamp_fgc_rqf, source_timestamp_leads_rqf_df, signal_names=['U_RES'], spark=spark) u_res_rqf_dfs = rqf_query.query_leads(timestamp_fgc_rqf, source_timestamp_leads_rqf_df, signal_names=['U_RES'], spark=spark)
# U_DIODE # U_DIODE
u_diode_rqd_dfs = rqd_query.query_voltage_nxcals('DIODE_RQD', 'U_DIODE_RQD', timestamp_fgc_rqd, spark=spark) u_diode_rqd_dfs = rqd_query.query_voltage_nxcals('DIODE_RQD', 'U_DIODE_RQD', timestamp_fgc_rqd, spark=spark)
u_diode_rqf_dfs = rqf_query.query_voltage_nxcals('DIODE_RQF', 'U_DIODE_RQF', timestamp_fgc_rqf, spark=spark) u_diode_rqf_dfs = rqf_query.query_voltage_nxcals('DIODE_RQF', 'U_DIODE_RQF', timestamp_fgc_rqf, spark=spark)
# U_EARTH # U_EARTH
u_earth_rqd_dfs = rqd_query.query_voltage_nxcals('VF_RQD', 'U_EARTH_RQD', timestamp_fgc_rqd, spark=spark) u_earth_rqd_dfs = rqd_query.query_voltage_nxcals('VF_RQD', 'U_EARTH_RQD', timestamp_fgc_rqd, spark=spark)
u_earth_rqf_dfs = rqf_query.query_voltage_nxcals('VF_RQF', 'U_EARTH_RQF', timestamp_fgc_rqf, spark=spark) u_earth_rqf_dfs = rqf_query.query_voltage_nxcals('VF_RQF', 'U_EARTH_RQF', timestamp_fgc_rqf, spark=spark)
rq_analysis = RqCircuitAnalysis(circuit_type, results_table, is_automatic=is_automatic) rq_analysis = RqCircuitAnalysis(circuit_type, results_table, is_automatic=is_automatic)
``` ```
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
# 3. Circuit Parameters Table # 3. Circuit Parameters Table
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
rq_analysis.display_parameters_table(circuit_names[0]) rq_analysis.display_parameters_table(circuit_names[0])
``` ```
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
# 4. Timestamps # 4. Timestamps
## 4.1. FPA ## 4.1. FPA
Table below provides timestamps ordered achronologically and represents the sequence of events that occurred in the analyzed circuit: PIC_RQD, PIC_RQF, iQPS, nQPS, FGC_RQD, FGC_RQF, EE_RQD, EE_RQF and optionally LEADS_RQD and LEADS_RQF, provided they exist. Note that for iQPS and nQPS only the first timestamp is reported. Tables with all iQPS and NQPS timestamps are presented in the section dedicated to magnet and quench protection analysis. The table also contains time difference in milliseconds from the first event and from the FGC event. Table below provides timestamps ordered achronologically and represents the sequence of events that occurred in the analyzed circuit: PIC_RQD, PIC_RQF, iQPS, nQPS, FGC_RQD, FGC_RQF, EE_RQD, EE_RQF and optionally LEADS_RQD and LEADS_RQF, provided they exist. Note that for iQPS and nQPS only the first timestamp is reported. Tables with all iQPS and NQPS timestamps are presented in the section dedicated to magnet and quench protection analysis. The table also contains time difference in milliseconds from the first event and from the FGC event.
In short, the following criteria should be kept: In short, the following criteria should be kept:
- The PC timestamp (51_self) is QPS time stamp +/-20 ms. - The PC timestamp (51_self) is QPS time stamp +/-40 ms.
- Time stamp difference between FGC and EE: 100±15 ms - Time stamp delay between PIC and EE: 100±15 ms
If one or more of these conditions are not fulfilled, then an in-depth analysis has to be performed by the QPS team. 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: %% Cell type:code id: tags:
``` python ``` python
timestamp_dct = {'FGC_RQD': timestamp_fgc_rqd, 'FGC_RQF': timestamp_fgc_rqf, timestamp_dct = {'FGC_RQD': timestamp_fgc_rqd, 'FGC_RQF': timestamp_fgc_rqf,
'PIC_RQD': timestamp_pic_rqd, 'PIC_RQF': timestamp_pic_rqf, 'PIC_RQD': timestamp_pic_rqd, 'PIC_RQF': timestamp_pic_rqf,
'EE_RQD': source_timestamp_ee_rqd_df, 'EE_RQF': source_timestamp_ee_rqf_df, 'EE_RQD': source_timestamp_ee_rqd_df, 'EE_RQF': source_timestamp_ee_rqf_df,
'iQPS': source_timestamp_qds_rq_df, 'nQPS': source_timestamp_nqps_rqd_df, 'iQPS': source_timestamp_qds_rq_df, 'nQPS': source_timestamp_nqps_rqd_df,
'LEADS_RQD': source_timestamp_leads_rqd_df, 'LEADS_RQF': source_timestamp_leads_rqf_df} 'LEADS_RQD': source_timestamp_leads_rqd_df, 'LEADS_RQF': source_timestamp_leads_rqf_df}
rq_analysis.create_timestamp_table(timestamp_dct) rq_analysis.create_timestamp_table(timestamp_dct)
``` ```
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
## 4.2. Reference ## 4.2. Reference
Table below contains reference timestamps of signals used for comparison to the analyzed FPA. The reference comes as the last PNO.b3 HWC test with activation of EE systems and no magnets quenching. Table below contains reference timestamps of signals used for comparison to the analyzed FPA. The reference comes as the last PNO.b3 HWC test with activation of EE systems and no magnets quenching.
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
timestamp_ref_dct = {'FGC_RQD': timestamp_fgc_ref_rqd, 'FGC_RQF': timestamp_fgc_ref_rqf, timestamp_ref_dct = {'FGC_RQD': timestamp_fgc_ref_rqd, 'FGC_RQF': timestamp_fgc_ref_rqf,
'EE_RQD_first': source_timestamp_ee_rqd_ref_df.loc[0, 'timestamp'], 'EE_RQD_second': source_timestamp_ee_rqd_ref_df.loc[1, 'timestamp'], 'EE_RQD_first': source_timestamp_ee_rqd_ref_df.loc[0, 'timestamp'], 'EE_RQD_second': source_timestamp_ee_rqd_ref_df.loc[1, 'timestamp'],
'EE_RQF_first': source_timestamp_ee_rqd_ref_df.loc[0, 'timestamp'], 'EE_RQF_second': source_timestamp_ee_rqd_ref_df.loc[1, 'timestamp']} 'EE_RQF_first': source_timestamp_ee_rqd_ref_df.loc[0, 'timestamp'], 'EE_RQF_second': source_timestamp_ee_rqd_ref_df.loc[1, 'timestamp']}
rq_analysis.create_ref_timestamp_table(timestamp_ref_dct) rq_analysis.create_ref_timestamp_table(timestamp_ref_dct)
``` ```
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
# 5. PIC # 5. PIC
## 5.1. Analysis of the PIC Timestamp ## 5.1. Analysis of the PIC Timestamp
*CRITERIA*: *CRITERIA*:
- Check iff the the difference between RQD and RQF PIC timestamps is less than 1 ms. If yes, then a warning is displayed. - Check iff the the difference between RQD and RQF PIC timestamps is less than 1 ms. If yes, then a warning is displayed.
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
rq_analysis.analyze_pic([timestamp_pic_rqd, timestamp_pic_rqf]) rq_analysis.analyze_pic([timestamp_pic_rqd, timestamp_pic_rqf])
``` ```
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
# 6. Power Converter # 6. Power Converter
## 6.1. Analysis of the Power Converter Main Current ## 6.1. Analysis of the Power Converter Main Current
This analysis module displays the main current of the power converter (I_MEAS), and for comparison, a reference I_MEAS (PNO.b3). This analysis module displays the main current of the power converter (I_MEAS), and for comparison, a reference I_MEAS (PNO.b3).
*ANALYSIS*: *ANALYSIS*:
- The evolution of the characteristic time $\tau$ of an exponential decay $f(t)$ is obtained as - The evolution of the characteristic time $\tau$ of an exponential decay $f(t)$ is obtained as
\begin{equation} \begin{equation}
-\frac{f(t)}{\partial_t f(t)} = -\frac{f_0 e^{-t/\tilde{\tau}}}{\partial_t (f_0 e^{-t/\tilde{\tau}})} = -\frac{f_0 e^{-t/\tilde{\tau}}}{-f_0/\tilde{\tau} e^{-t/\tilde{\tau}}}=-\frac{1}{-1/\tau}=\tau -\frac{f(t)}{\partial_t f(t)} = -\frac{f_0 e^{-t/\tilde{\tau}}}{\partial_t (f_0 e^{-t/\tilde{\tau}})} = -\frac{f_0 e^{-t/\tilde{\tau}}}{-f_0/\tilde{\tau} e^{-t/\tilde{\tau}}}=-\frac{1}{-1/\tau}=\tau
\end{equation} \end{equation}
Naturally, this formula only applies to exponential decayed characterised by a time constant. Nonetheless, for pseudo-exponential decays, this formula gives a notion of the change of the characteristic time $\tilde{\tau}$. For a circuit we compute the time-varying characteristic time as Naturally, this formula only applies to exponential decayed characterised by a time constant. Nonetheless, for pseudo-exponential decays, this formula gives a notion of the change of the characteristic time $\tilde{\tau}$. For a circuit we compute the time-varying characteristic time as
\begin{equation} \begin{equation}
\tilde{\tau} = \frac{\partial \text{I_MEAS}}{\partial_t} \tilde{\tau} = \frac{\partial \text{I_MEAS}}{\partial_t}
\end{equation} \end{equation}
*CRITERIA* *CRITERIA*
- Check if the characteristic time of the pseudo-exponential I_MEAS decay from t=1 to 100 s is 25 s< Tau < 35 s - Check if the characteristic time of the pseudo-exponential I_MEAS decay from t=1 to 100 s is 25 s< Tau < 35 s
*GRAPHS* (one for each circuit): *GRAPHS* (one for each circuit):
- The main power converter current (reference and actual) on the left axis, I_MEAS - The main power converter current (reference and actual) on the left axis, I_MEAS
- The characteristic pseudo time constant calculated for the main current (reference and actual) on the right axis, -I_MEAS/dI_MEAS - The characteristic pseudo time constant calculated for the main current (reference and actual) on the right axis, -I_MEAS/dI_MEAS
The actual characteristic pseudo time constant contains discrete steps, which indicate a quenching magnet (decreasing L, increasing R); note that for the reference one the steps are not present (no quench). The actual characteristic pseudo time constant contains discrete steps, which indicate a quenching magnet (decreasing L, increasing R); note that for the reference one the steps are not present (no quench).
- Timing of PIC abort, FGC timestamps, the maximum currents, and the characteristic times are reported next to the graph. - Timing of PIC abort, FGC timestamps, the maximum currents, and the characteristic times are reported next to the graph.
- t = 0 s corresponds to the respective (actual and reference) FGC timestamps. - t = 0 s corresponds to the respective (actual and reference) FGC timestamps.
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
%matplotlib notebook %matplotlib notebook
rq_analysis.analyze_i_meas_pc(circuit_names[0], timestamp_fgc_rqd, timestamp_fgc_ref_rqd, timestamp_pic_rqd, i_meas_rqd_df, i_meas_ref_rqd_df) rq_analysis.analyze_i_meas_pc(circuit_names[0], timestamp_fgc_rqd, timestamp_fgc_ref_rqd, timestamp_pic_rqd, i_meas_rqd_df, i_meas_ref_rqd_df)
rq_analysis.calculate_current_miits(i_meas_rqd_df, t_quench=0, col_name='MIITS_RQD')