Commit 99fc546b authored by Michal Maciejewski's avatar Michal Maciejewski
Browse files

Relocated and renamed gui files

parent bb282d76
%% Cell type:markdown id: tags:
<h1><center>Analysis of PLI1.a2 HWC Test in an RB Circuit</center></h1>
<img src="https://gitlab.cern.ch/LHCData/lhc-sm-hwc/raw/master/figures/rb/RB.png" width=75%>
A current cycle up and down from I_MIN_OP to I_INJECTION is performed with a short plateau (typically 10 minutes) at highest current. The aim of this test is to check the magnet performance and the QPS calibration at that current level. The current to earth and the current error from the power convertor are checked during the sequence.
<img src="https://gitlab.cern.ch/LHCData/lhc-sm-hwc/raw/master/figures/rb/PLI1_current.png" width=75%>
The required analysis and signatures are listed below.
|Responsible|Type of analysis|Criterion|
|-----------|----------------|---------|
|MP3|Splice signals|U_res < 500$\mu$V if the inductive voltage of the bus-bar segments is compensated|
|-|Automatic analysis on earth current and error current|I_EARTH_PLI1_A2 < I_EARTH_MAX and I_ERR_PLI1_A2 < I_ERR_MAX|
source: Powering Procedure and Acceptance Criteria for the 13 kA Dipole Circuits, MP3 Procedure, <a href="https://edms.cern.ch/document/874713/5.1">https://edms.cern.ch/document/874713/5.1</a> (Please follow this link for the latest version)
%% 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.
- 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 importlib
importlib.reload(lhcsmapi.gui.hwc.HwcSearchModuleMediator)
from lhcsmapi.gui.hwc.HwcSearchModuleMediator import HwcSearchModuleMediator
```
%% Cell type:code id: tags:
``` python
# External libraries
print('Loading (1/11)'); import sys
print('Loading (2/11)'); from IPython.display import display, Javascript, HTML, clear_output
# Internal libraries
print('Loading (3/11)'); import lhcsmapi
print('Loading (4/11)'); from lhcsmapi.Time import Time
print('Loading (5/11)'); from lhcsmapi.Timer import Timer
print('Loading (6/11)'); from lhcsmapi.analysis.RbCircuitQuery import RbCircuitQuery
print('Loading (7/11)'); from lhcsmapi.analysis.RbCircuitAnalysis import RbCircuitAnalysis
print('Loading (8/11)'); from lhcsmapi.analysis.report_template import apply_report_template
print('Loading (9/11)'); from lhcsmapi.gui.hwc.HwcSearchModuleMediator import HwcSearchModuleMediator
print('Loading (10/11)'); from lhcsmapi.pyedsl.PlotBuilder import create_hwc_plot_title_with_circuit_name
print('Loading (11/11)'); from lhcsmapi.analysis.expert_input import get_expert_decision
analysis_start_time = Time.get_analysis_start_time()
clear_output()
lhcsmapi.get_lhcsmapi_version()
lhcsmapi.get_lhcsmhwc_version('../__init__.py')
```
%% Cell type:markdown id: tags:
%% Output
# User Input
1. Copy code from AccTesting
Analysis executed with lhc-sm-api version: 1.4.35
Analysis executed with lhc-sm-hwc notebooks version: 1.4.0
%% Cell type:markdown id: tags:
# 1. User Input
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">
- 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 = 'PLI1.a2'
circuit_name = 'RB.A12'
campaign = 'HWC_2017'
t_start = '2017-04-21 15:42:31.569'
t_end = '2017-04-21 16:01:35.843'
```
2. To analyze a historical test, copy the following code into 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 = 'RB'
hwc_test = 'PLI1.a2'
hwcb = HwcSearchModuleMediator(circuit_type=circuit_type, hwc_test=hwc_test, hwc_summary_path='/eos/project/l/lhcsm/hwc/HWC_Summary.csv')
```
- 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:
``` python
circuit_type = 'RB'
hwc_test = 'PLI1.a2'
hwcb = HwcSearchModuleMediator(circuit_type=circuit_type, hwc_test=hwc_test, hwc_summary_path='/eos/project/l/lhcsm/hwc/HWC_Summary.csv')
circuit_name = 'RB.A12'
campaign = 'HWC_2017'
t_start = '2017-04-21 15:42:31.569'
t_end = '2017-04-21 16:01:35.843'
```
%% Cell type:markdown id: tags:
# 2. Query All Signals Prior to Analysis
%% Cell type:code id: tags:skip_output
``` python
circuit_name = hwcb.get_circuit_name()
t_start = Time.to_unix_timestamp(hwcb.get_start_time())
t_end = Time.to_unix_timestamp(hwcb.get_end_time())
author = hwcb.get_author()
is_automatic = hwcb.is_automatic_mode()
circuit_type = 'RB'
if 'hwcb' in locals():
circuit_name = hwcb.get_circuit_name()
t_start = Time.to_unix_timestamp(hwcb.get_start_time())
t_end = Time.to_unix_timestamp(hwcb.get_end_time())
is_automatic = hwcb.is_automatic_mode()
else:
t_start = Time.to_unix_timestamp(t_start)
t_end = Time.to_unix_timestamp(t_end)
is_automatic = False
author = HwcSearchModuleMediator.get_user()
rb_query = RbCircuitQuery(circuit_type, circuit_name, max_executions=4)
rb_analysis = RbCircuitAnalysis(circuit_type, results_table=None, is_automatic=is_automatic)
with Timer():
# PC
i_meas_nxcals_df = rb_query.query_signal_nxcals(t_start, t_end, t0=t_start, system='PC', signal_names='I_MEAS', spark=spark)[0]
i_meas_raw_nxcals_df = rb_query.query_raw_signal_nxcals(t_start, t_end, system='PC', signal_names='I_MEAS', spark=spark)[0]
plateau_start, plateau_end = rb_analysis.find_plateau_start_and_end(i_meas_raw_nxcals_df, i_meas_threshold=0, min_duration_in_sec=60, time_shift_in_sec=(30, 1))
# BUSBAR
u_res_df = rb_query.query_busbar_features_nxcals(t_start, t_end, signal='U_RES', features=['min', 'max'], spark=spark)
# MAGNET
u_mag_df = rb_query.query_busbar_features_nxcals(t_start, t_end, signal='U_MAG', features=['min', 'max'], spark=spark)
```
%% Output
%% Cell type:markdown id: tags:
# 3. Power Converter
## 3.1. Plot of the Power Converter Main Current
*GRAPHS*:
- t = 0 s corresponds to the start of the test
%% Cell type:code id: tags:
``` python
import matplotlib as mpl
mpl.rcParams['savefig.dpi'] = 80
mpl.rcParams['figure.dpi'] = 80
%matplotlib notebook
title = create_hwc_plot_title_with_circuit_name(circuit_name=circuit_name, hwc_test=hwc_test,
t_start=t_start, t_end=t_end, signal='I_MEAS')
rb_analysis.plot_i_meas(i_meas_nxcals_df, title=title)
```
%% Cell type:markdown id: tags:
# 4. Busbar
## 4.1. Busbar Voltage
*CRITERIA*:
- Check if all 156 signals are present
- Check if the absolute maximum busbar voltage is below 5 mV
*WARNING*
- Check if the absolute maximum busbar voltage is below 2.5 mV
*GRAPHS*:
- The busbar maximum absolute voltage, U_RES
- The green box denotes the validity region of the busbar voltage (0, 5] mV
%% Cell type:code id: tags:
``` python
rb_analysis.check_signal_count(u_res_df, expected_signal_count=156, signal='U_RES')
```
%% Cell type:code id: tags:
``` python
u_res_outside_range_df = rb_analysis.analyze_busbar_magnet_voltage(u_res_df, max_value=5e-3, title=title, ylabel='U_RES_abs_max (Calculated), [V]')
```
%% Cell type:code id: tags:
``` python
rb_query.query_and_plot_outlier_voltage(u_res_outside_range_df, t_start, t_end, i_meas_raw_nxcals_df.index[0], plateau_start, plateau_end, spark=spark)
```
%% Cell type:code id: tags:
``` python
u_res_outside_range_df = rb_analysis.analyze_busbar_magnet_voltage(u_res_df, max_value=2.5e-3, title=title, ylabel='U_RES_abs_max (Calculated), [V]')
```
%% Cell type:code id: tags:
``` python
rb_query.query_and_plot_outlier_voltage(u_res_outside_range_df, t_start, t_end, i_meas_raw_nxcals_df.index[0], plateau_start, plateau_end, spark=spark)
```
%% Cell type:markdown id: tags:
## 4.2. Magnet Voltage
*CRITERIA*:
- Check if all 156 signals are present
%% Cell type:code id: tags:
``` python
rb_analysis.check_signal_count(u_res_df, expected_signal_count=156, signal='U_MAG')
```
%% Cell type:markdown id: tags:
# 5. Signature Decision
%% Cell type:code id: tags:
``` python
signature = get_expert_decision('Expert Signature Decision: ', ['PASSED', 'FAILED'])
```
%% Cell type:markdown id: tags:
# 6. Final Report
%% Cell type:code id: tags:
``` python
apply_report_template()
file_name_html = '{}_{}-{}-{}_{}.html'.format(circuit_name, hwc_test, Time.to_datetime(t_start).strftime("%Y-%m-%d-%Hh%M"), analysis_start_time, signature)
full_path = '/eos/project/m/mp3/RB/{}/{}/{}'.format(circuit_name, hwc_test, file_name_html)
!mkdir -p /eos/project/m/mp3/RB/$circuit_name/$hwc_test
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_RB_PLI1.a2.ipynb' --output /eos/project/m/mp3/RB/$circuit_name/$hwc_test/$file_name_html --TemplateExporter.exclude_input=True --TagRemovePreprocessor.remove_all_outputs_tags='["skip_output"]'
```
%% Cell type:code id: tags:
``` python
```
......
Supports Markdown
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