Commit f9291d84 authored by Thibaud Marie Eric Buffet's avatar Thibaud Marie Eric Buffet
Browse files

SIGMON-117: Following zinur suggestions notebook

parent 38b80739
Pipeline #2501498 failed with stage
in 6 seconds
......@@ -11,6 +11,13 @@
"source: Powering Procedure and Acceptance Criteria for the 13 kA Dipole Circuits, MP3 Procedure, <a href=\"https://edms.cern.ch/document/874713\">https://edms.cern.ch/document/874713</a>"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Original text: 2020-2021 (Michal); Last corrections: 29/03/2021 (Zinur)"
]
},
{
"cell_type": "markdown",
"metadata": {
......@@ -19,8 +26,7 @@
"source": [
"# Analysis Assumptions\n",
"- 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.\n",
"- 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).\n",
"\n",
"- 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). \n",
"\n",
"# Plot Convention\n",
"- Scales are labeled with signal name followed by a comma and a unit in square brackets, e.g., I_MEAS, [A].\n",
......@@ -69,7 +75,7 @@
"\n",
"clear_output()\n",
"lhcsmapi.get_lhcsmapi_version()\n",
"lhcsmapi.get_lhcsmhwc_version('../__init__.py')"
"lhcsmapi.get_lhcsmhwc_version('../__init__.py')\n"
]
},
{
......@@ -110,8 +116,8 @@
"outputs": [],
"source": [
"circuit_type = 'RB'\n",
"fgc_pm_search = FgcPmSearchModuleMediator(DateTimeBaseModule(start_date_time='2021-03-13 00:00:00+01:00',\n",
" end_date_time='2021-03-16 00:00:00+01:00'), circuit_type=circuit_type)"
"fgc_pm_search = FgcPmSearchModuleMediator(DateTimeBaseModule(start_date_time='2021-04-01 00:00:00+02:00',\n",
" end_date_time='2021-04-12 00:00:00+02:00'), circuit_type=circuit_type)"
]
},
{
......@@ -194,11 +200,16 @@
" # iQPS, nQPS - PM\n",
" source_timestamp_qds_df = rb_query.find_source_timestamp_qds(timestamp_fgc)\n",
" source_timestamp_nqps_df = rb_query.find_source_timestamp_nqps(timestamp_fgc)\n",
" results_table = rb_query.create_report_analysis_template(source_timestamp_qds_df, source_timestamp_nqps_df, min(timestamp_pic), timestamp_fgc, '../__init__.py', i_meas_df, author)\n",
" #results_table = rb_query.create_report_analysis_template(source_timestamp_qds_df, source_timestamp_nqps_df, min(timestamp_pic), timestamp_fgc, '../__init__.py', i_meas_df, author)\n",
" results_table = rb_query.create_report_analysis_template(source_timestamp_qds_df, source_timestamp_nqps_df, min(timestamp_pic), timestamp_fgc, '/eos/home-z/zinur/SWAN_projects/hwc_dev_zinur/__init__.py', i_meas_df, author)\n",
"\n",
" # QDS\n",
" u_qds_dfs = rb_query.query_voltage_logic_iqps(source_timestamp_qds_df, signal_names=['U_QS0', 'U_1', 'U_2', 'ST_NQD0', 'ST_MAGNET_OK'])\n",
" u_nqps_dfs = rb_query.query_voltage_nqps(source_timestamp_nqps_df, source_timestamp_qds_df, timestamp_fgc, spark=spark)\n",
" # QDS from second board (A/B)\n",
" source_timestamp_qds_df['timestamp'] = source_timestamp_qds_df['timestamp'] + 2000000\n",
" u_qds_dfs2 = rb_query.query_voltage_logic_iqps(source_timestamp_qds_df, signal_names=['U_QS0', 'U_1', 'U_2', 'ST_NQD0', 'ST_MAGNET_OK'])\n",
" source_timestamp_qds_df['timestamp'] = source_timestamp_qds_df['timestamp'] - 2000000\n",
"\n",
" # QH \n",
" source_timestamp_qh_df = rb_query.find_source_timestamp_qh(timestamp_fgc, duration=[(10, 's'), (500, 's')])\n",
......@@ -252,9 +263,9 @@
"Table below provides timestamps ordered achronologically and represents the sequence of events that occurred in the analyzed circuit. Only the first PIC timestamp from the logging DB is reported. Note that for iQPS and nQPS only the very first PM timestamp is reported. Tables with all iQPS and nQPS PM timestamps are presented in the section dedicated to magnet quench protection analysis. The table also contains a time difference in milliseconds from the first trigger event, from the FGC and PIC trigger times.\n",
"\n",
"In short, the following criteria should be kept:\n",
"- The PC PM (FGC, lhc_self) timestamp is expected within QPS PM timestamp +/-40 ms.\n",
"- Time delay between PIC and EE at an odd (RR or UJ) point is 100±50 ms.\n",
"- Time delay between PIC and EE at an even (UA) point is 600±50 ms."
"- The PC PM (FGC, lhc_self) timestamp is expected within QPS PM timestamp +/-40 ms;\n",
"- Time delay between PIC and EE at an odd (RR or UJ) point is 100±50 ms;\n",
"- Time delay between PIC and EE at an even (UA) point is 600±50 ms;"
]
},
{
......@@ -294,13 +305,29 @@
" warnings.warn(f\"The time difference between PIC and EE EVEN is not within the given range_value {value_range_ee_even}.PIC :{min(timestamp_pic)} and EE_EVEN {timestamp_ee_even}\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 3.1.1. Quenched magnets "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"rb_analysis.results_table[['Circuit Name', 'Position', 'I_Q_M', 'Delta_t(iQPS-PIC)', 'nQPS crate name', 'Delta_t(nQPS-PIC)']]"
]
},
{
"cell_type": "markdown",
"metadata": {
"deletable": false
},
"source": [
"## 3.2. Reference\n",
"## 3.2. Reference Event\n",
"Table below contains the reference event timestamps of signals used for comparison to the analyzed FPA. The reference comes as the last succesfull PNO.b2 HWC test."
]
},
......@@ -356,8 +383,8 @@
"deletable": false
},
"source": [
"# 5. Powering Interlock system (PIC)\n",
"## 5.1. Analysis of the PIC Timestamp\n",
"# 5. Powering Iinterlock system (PIC)\n",
"## 5.1. Analysis of the PIC Timestamps\n",
"\n",
"*ANALYSIS*:\n",
"- Show warning if the two PIC timestamps (ODD and EVEN) differ by more than a 1 ms. (PIC)"
......@@ -401,7 +428,7 @@
"*PLOT*:\n",
"- The main power converter current (analyzed and reference) on the left axis, I_MEAS\n",
"- The characteristic time calculated for the main current (reference and actual) on the right axis, -I_MEAS/dI_MEAS_dt \n",
"The actual characteristic time contains steps, which indicate a quenching magnet (decrease of circuit inductance); note that for the reference one the steps are not present. Timing of PIC abort, FGC timestamp, and the maximum current are reported next to the graph.\n",
"The actual characteristic time can contains steps, which indicate a quenching magnet if so (decrease of circuit inductance); note that for the reference one the steps are not present. Timing of PIC abort, FGC timestamp, and the maximum current are reported next to the graph.\n",
"- t = 0 s corresponds to the respective (analyzed and reference) FGC timestamps."
]
},
......@@ -413,7 +440,8 @@
},
"outputs": [],
"source": [
"%matplotlib notebook\n",
"#%matplotlib notebook\n",
"%matplotlib inline\n",
"rb_analysis.analyze_i_meas_pc(circuit_name, timestamp_fgc, timestamp_fgc_ref, min(timestamp_pic), i_meas_df, i_meas_ref_df)\n",
"rb_analysis.calculate_current_miits_i_meas_i_a(i_meas_df, i_a_df, t_quench=0, col_name='MIITS_circ')\n",
"rb_analysis.calculate_quench_current(i_meas_df, t_quench=0, col_name='I_Q_circ')\n",
......@@ -429,7 +457,7 @@
"## 6.2. Analysis of the Power Converter Earth Current\n",
"\n",
"*CRITERIA*:\n",
"- Checks whether for t > 3 s, I_EARTH_PCNT is within +/-3 % w.r.t. the reference\n",
"- Checks whether for t > 3 s, I_EARTH_PCNT is within +/-3 % w.r.t. the reference;\n",
"- Note: 100% corresponds to 55 mA;\n",
"\n",
"*PLOT*: \n",
......@@ -437,7 +465,7 @@
"\n",
"First plot (I_EARTH, absolute scale, mA)\n",
"- The main power converter current on the left axis, I_A\n",
"- Actual and reference earth current on the right axis, IEARTH\n",
"- Actual and reference earth current on the right axis, I_EARTH\n",
"\n",
"Second plot (I_EARTH_PCNT, percentage scale)\n",
"- The main power converter current on the left axis, I_MEAS\n",
......@@ -461,7 +489,8 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"deletable": false
"deletable": false,
"scrolled": false
},
"outputs": [],
"source": [
......@@ -523,7 +552,8 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"deletable": false
"deletable": false,
"scrolled": false
},
"outputs": [],
"source": [
......@@ -537,7 +567,7 @@
"deletable": false
},
"source": [
"## 7.2. Analysis of the Energy Extraction Temperature\n",
"## 7.2. Analysis of the Energy Extraction resistance Temperature\n",
"\n",
"*CRITERIA*\n",
"- Checks whether temperature profile is +/-25 K w.r.t. the reference temperature profile\n",
......@@ -591,7 +621,7 @@
"deletable": false
},
"source": [
"# 8. Quench Protection System\n",
"# 8. Quench Protection System: QDS, QH and by pass Diode\n",
"<img src=\"https://gitlab.cern.ch/LHCData/lhc-sm-hwc/raw/master/figures/rb/RB_QPS_Signals.png\" width=75%>\n",
"\n",
"The table below shows the sign of the resistive voltages and inductive voltages (for positive ramp rate) of U1 and U2. U_QS0=-U1-U2.\n",
......@@ -647,43 +677,51 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"deletable": false
"deletable": false,
"scrolled": false
},
"outputs": [],
"source": [
"rb_analysis.analyze_u_diode_nqps(circuit_name, timestamp_fgc, i_meas_df, u_diode_rb_dfs, 'U_DIODE_RB', 'DIODE_RB', xlim=(-5, 350))"
"%matplotlib inline\n",
"rb_analysis.analyze_u_diode_nqps(circuit_name, timestamp_fgc, i_meas_df, u_diode_rb_dfs, 'U_DIODE_RB', 'DIODE_RB', xlim=(-25, 350))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"deletable": false
"deletable": false,
"scrolled": false
},
"outputs": [],
"source": [
"rb_analysis.analyze_u_diode_nqps(circuit_name, timestamp_fgc, i_meas_df, u_diode_rb_dfs, 'U_DIODE_RB', 'DIODE_RB', xlim=(-2, 3))"
"rb_analysis.analyze_u_diode_nqps(circuit_name, timestamp_fgc, i_meas_df, u_diode_rb_dfs, 'U_DIODE_RB', 'DIODE_RB', xlim=(-1, 3))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"deletable": false
"deletable": false,
"scrolled": false
},
"outputs": [],
"source": [
"%matplotlib notebook\n",
"u_diode_with_quench_rb_dfs = rb_analysis.filter_quenched_magnets(u_diode_rb_dfs, results_table['Position'])\n",
"rb_analysis.analyze_u_diode_nqps(circuit_name, timestamp_fgc, i_meas_df, u_diode_with_quench_rb_dfs, 'U_DIODE_RB', 'DIODE_RB', legend=True, xlim=(-5, 350))"
"rb_analysis.analyze_u_diode_nqps(circuit_name, timestamp_fgc, i_meas_df, u_diode_with_quench_rb_dfs, 'U_DIODE_RB', 'DIODE_RB', legend=True, xlim=(-25, 350))\n",
"print(\"done!\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"scrolled": false
},
"outputs": [],
"source": [
"rb_analysis.analyze_u_diode_nqps(circuit_name, timestamp_fgc, i_meas_df, u_diode_with_quench_rb_dfs, 'U_DIODE_RB', 'DIODE_RB', legend=True, xlim=(-2, 3))"
"rb_analysis.analyze_u_diode_nqps(circuit_name, timestamp_fgc, i_meas_df, u_diode_with_quench_rb_dfs, 'U_DIODE_RB', 'DIODE_RB', legend=True, xlim=(-1, 3))"
]
},
{
......@@ -692,7 +730,7 @@
"deletable": false
},
"source": [
"## 8.2. Analysis of Quenched Magnets by QDS - PM\n",
"## 8.2. Analysis of Quenched Magnets by QDS - PMs\n",
"\n",
"*ANALYSIS*:\n",
"- calculates the current at which a quench occured by finding the timestamp of the current dataframe (i_meas_df) closest to the quench time and the curresponding value of current - I_MEAS_quench\n",
......@@ -707,7 +745,7 @@
},
"outputs": [],
"source": [
"rb_analysis.results_table[['Circuit Name', 'Position', 'nQPS crate name', 'Delta_t(iQPS-PIC)','I_Q_circ', 'Delta_t(nQPS-PIC)']]"
"rb_analysis.results_table[['Circuit Name', 'I_Q_circ', 'Position', 'I_Q_M', 'Delta_t(iQPS-PIC)', 'nQPS crate name', 'Delta_t(nQPS-PIC)']]"
]
},
{
......@@ -735,7 +773,7 @@
"- the quench detection signal polarity is taken as the sign of its slope;\n",
"- the delay of the quench heaters triggering, t_delay_qh_trigger, is assumed to be the negative value of t_st_magnet_ok, t_delay_qh_trigger = -t_st_magnet_ok;\n",
"\n",
"Determine source of QH trigger for nQPS signals in PM:\n",
"Determine possible source of QH trigger for nQPS signals in PM:\n",
"- calculates nQPS differences for the symmetric quench detection;\n",
"- selects only the differences that involve the quenched magnet and exclude already quenched magnets in the cell;\n",
"- for t in [-0.2 s, t_st_magnet_ok] take the maximum value of voltage difference;\n",
......@@ -796,7 +834,7 @@
"outputs": [],
"source": [
"%matplotlib inline\n",
"rb_analysis.analyze_qds(timestamp_fgc, min(timestamp_pic), u_qds_dfs, u_nqps_dfs, i_meas_df, threshold=threshold_iqps)\n",
"rb_analysis.analyze_qds(timestamp_fgc, min(timestamp_pic), u_qds_dfs, u_qds_dfs2, u_nqps_dfs, i_meas_df, threshold=threshold_iqps)\n",
"rb_analysis.results_table[['Circuit Name', 'Position', 'nQPS crate name', 'Delta_t(iQPS-PIC)','I_Q_circ', 'I_Q_M', 'Delta_t(nQPS-PIC)', 'QDS trigger origin', 'dU_iQPS/dt', 'Type of Quench']]"
]
},
......@@ -806,7 +844,7 @@
"deletable": false
},
"source": [
"## 8.4. Analysis of Quench Heater Discharges\n",
"## 8.4. Check of Quench Heater Discharges\n",
"\n",
"*CRITERIA*:\n",
"- all characteristic times of an exponential decay calculated with the 'charge' approach for voltage and current are +/- 3 ms from the reference ones;\n",
......@@ -816,7 +854,7 @@
"\n",
"*PLOT*: \n",
"\n",
"t = 0 s corresponds to the start of the pseudo-exponential decay. \n",
"t = 0 s corresponds to the start of the decay. \n",
"Line for actual signal is continuous and dashed for the reference.\n",
"\n",
"Left plot (Voltage view)\n",
......@@ -838,8 +876,8 @@
},
"outputs": [],
"source": [
"%matplotlib inline\n",
"rb_analysis.analyze_qh(source_timestamp_qh_df, u_hds_dfs, i_hds_dfs, u_hds_ref_dfs, i_hds_ref_dfs)\n",
"\n",
"rb_analysis.results_table[['Circuit Name', 'Position', 'Delta_t(iQPS-PIC)', 'I_Q_circ', 'I_Q_M', 'Delta_t(nQPS-PIC)', 'QDS trigger origin', 'QH analysis']]"
]
},
......@@ -849,7 +887,7 @@
"deletable": false
},
"source": [
"## 8.5. Evaluation of Diode Lead Resistance\n",
"## 8.5. Evaluation of Diode Leads Resistance\n",
"\n",
"**NB: It is not a reason to fail and flag the circuit! It is just a subject to be discussed and to pay an attention.**\n",
"\n",
......@@ -899,7 +937,7 @@
"outputs": [],
"source": [
"rb_analysis.analyze_diode_leads(source_timestamp_qds_df, timestamp_fgc, results_table['I_Q_M'], circuit_name, i_a_u_diode_u_ref_pm_dfs, i_meas_u_diode_nxcals_dfs)\n",
"rb_analysis.results_table[['Circuit Name', 'Date (FGC)', 'Time (FGC)', 'I_Q_circ', 'I_Q_M', 'R_DL_max', 'I at R_DL_max']]"
"rb_analysis.results_table[['Circuit Name', 'Date (FGC)', 'Time (FGC)', 'I_Q_circ', 'Position', 'I_Q_M', 'R_DL_max', 'I at R_DL_max']]"
]
},
{
......@@ -927,7 +965,7 @@
"\n",
"Second plot (zoom)\n",
"- the power converter current on the left axis, I_MEAS;\n",
"- earth voltage on the right axis, U_EARTH_RB;\n"
"- earth voltage on the right axis, U_EARTH_RB;i"
]
},
{
......@@ -960,6 +998,7 @@
"deletable": false
},
"source": [
"\n",
"## 8.7. Check QDS of Current Leads\n",
"\n",
"*CRITERIA*:\n",
......@@ -967,22 +1006,22 @@
"- Check if the quench detection signal for U_HTS is below the threshold (3 mV);\n",
"- Check if the quench detection signal for U_RES is below the threshold (100 mV);\n",
"\n",
"**NB: The discrimination time is not taken into account! ;(**\n",
"**NB: The discrimination time is not taken into account!** ;(\n",
"\n",
"*PLOT*: \n",
"\n",
"- t = 0 s corresponds to the FGC timestamp\n",
"- t = 0 s corresponds to the FGC timestamp;\n",
"\n",
"Global view (for odd and even leads)\n",
"- voltage of the HTS leads on the left axis, U_HTS\n",
"- voltage of the normal conducting leads on the left axis, U_RES\n",
"- blue horizontal dashed line denotes the QPS timestamp\n",
"- voltage of the HTS leads on the left axis, U_HTS;\n",
"- voltage of the normal conducting leads on the left axis, U_RES;\n",
"- blue horizontal dashed line denotes the QPS timestamp;\n",
"\n",
"Zoom view (for odd and even leads)\n",
"- voltage of the HTS leads on the left axis, U_HTS\n",
"- blue horizontal dashed line denotes the QPS timestamp\n",
"- cyan horizontal dashed line denotes the EE odd timestamp\n",
"- green horizontal dashed line denotes the EE even timestamp"
"- voltage of the HTS leads on the left axis, U_HTS;\n",
"- blue horizontal dashed line denotes the QPS timestamp;\n",
"- cyan horizontal dashed line denotes the EE odd timestamp;\n",
"- green horizontal dashed line denotes the EE even timestamp;"
]
},
{
......@@ -1082,7 +1121,8 @@
"deletable": false
},
"source": [
"# 10. Analysis Comment"
"\n",
"# 10. Analysis General Comment"
]
},
{
......@@ -1110,12 +1150,11 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"deletable": false,
"scrolled": false
"deletable": false
},
"outputs": [],
"source": [
"pd.set_option('display.max_columns', None)\n",
"# pd.set_option('display.max_columns', None)\n",
"pd.set_option('display.max_rows', None)\n",
"analysis_start_time = Time.get_analysis_start_time()\n",
"date_time_fgc = Time.to_datetime(timestamp_fgc).strftime(\"%Y-%m-%d-%Hh%M\")\n",
......@@ -1137,6 +1176,13 @@
"Time.sleep(5)\n",
"!{sys.executable} -m jupyter nbconvert --to html $'AN_RB_FPA.ipynb' --output /eos/project/m/mp3/RB/$circuit_name/FPA/$file_name_html --TemplateExporter.exclude_input=True --TagRemovePreprocessor.remove_all_outputs_tags='[\"skip_output\"]' --TagRemovePreprocessor.remove_cell_tags='[\"skip_cell\"]'"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
......@@ -1185,4 +1231,4 @@
},
"nbformat": 4,
"nbformat_minor": 2
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment