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

Merge branch 'dev' into 'master'

SIGMON-82 add notebookplot

See merge request !12
parents a06b4736 e93bd33f
Pipeline #2518964 passed with stage
in 14 seconds
/.idea/
**/.sys.v#.*.ipynb/
**.sys.v#.*
......
......@@ -35,6 +35,9 @@ deploy_dev_eos:
- deploy-eos
before_script: []
after_script: []
only:
- master
- dev
deploy_production_eos:
stage: deploy
......
# Contributing Manual
## Issue reporting and tracking
To report issues and track their progress we use a [JIRA dashboard](https://its.cern.ch/jira/secure/RapidBoard.jspa?rapidView=7215&projectKey=SIGMON&view=detail).
- When a new issue is raised, one can report it by creating a new story on the JIRA board on the `Create` button.
- This new story/task should be assigned yourself as a `Reporter` and `Assignee` and put into the `BACKLOG` column.
- The issue must contain a complete and explicit description. Feel free to use images, screenshots or figures to illustrate the issue.
- It is now waiting for someone to check it out and start working on it.
Note: issues can move back to their previous steps if needed.
## Fixing an issue
### 1. Open a new SWAN session with the configuration
- Software stack: `NXCals Python3`
- Platform: `CentOS 7 (gcc7)` - default
- Environment script: `/eos/project/l/lhcsm/public/contributor.sh`
- Number of cores: `4`
- Memory: `16 GB`
- Spark cluster: `BE NXCALS (NXCals)`
##### On JIRA dashboard:
- If not done already, put yourself as `Assignee` of the issue.
- Move the issue to the `IN PROGRESS` column.
### 2. The repository `hwc_working` has been created or loaded. All the notebooks can be updated from this repository.
- Update and modify notebooks from `hwc_working` in order to fix the issue.
- You can continue to work on your Notebooks for several days by repeating step 1. when reloading a SWAN session.
- __IMPORTANT__ -> Issues can occur if multiple people are working in parallel on the same Notebooks. Make sure to synchronise with other developers.
### 3. Commit and push your changes to Gitlab:
- __IMPORTANT__ -> Before pushing all the notebooks must stay __CLEAN__ !! They should **NOT** contain any SWAN execution outputs.
To clean a notebook click on the tab `CELL` --> `All Output->Clear`
- __IMPORTANT__ -> Increment the version number in the `hwc_working/__init__.py` file.
- Open the SWAN terminal.
- Then run the command `source /eos/project/l/lhcsm/public/contributor_push.sh`
- (Note the working directory `hwc_working` has been deleted, if you want to reload it you can run in the terminal `source /eos/project/l/lhcsm/public/contributor.sh`)
### 4. Open a merge request on [Gitlab with your changes to be reviewed](https://gitlab.cern.ch/LHCData/lhc-sm-hwc/-/merge_requests):
- select source branch `dev`
- select target branch `master`
- The merge request is waiting review from software experts.
##### On JIRA dashboard:
- When the merge request is open move the issue to the `REVIEW` column.
### 5. Once the merge request has been reviewed and approved then click on the `Merge` button of the merge request page.
- The `DEV` [pipeline](https://gitlab.cern.ch/LHCData/lhc-sm-api/-/pipelines) is now triggered. Wait until the pipeline is completed and all steps are green.
- To load the `DEV` environment you can restart the SWAN configuration with the option Environment script: `/eos/project/l/lhcsm/public/packages_notebooks_dev.sh`
- On this `DEV` environment experts (you?) can validate that all the changes are correct.
##### On JIRA dashboard:
- During validation on the `DEV` environment by experts, move the task to `VALIDATION` column.
### RELEASE TO PRO
### 6. When changes are validated, you must __TAG__ the `master` branch with the previously given **_version_ _number_**: https://gitlab.cern.ch/LHCData/lhc-sm-hwc/-/tags/new
- The `PRO` [pipeline](https://gitlab.cern.ch/LHCData/lhc-sm-api/-/pipelines) is now triggered. Wait until the pipeline is completed and all steps are green.
- To load the `PRO` environment you can restart the SWAN configuration with the option Environment script: `/eos/project/l/lhcsm/public/packages_notebooks.sh`
##### On JIRA dashboard:
- The issue is fixed and can be moved to `DONE` column.
\ No newline at end of file
__version__ = "1.5.57"
__version__ = "1.5.58"
......@@ -4,14 +4,17 @@
<img src="https://gitlab.cern.ch/LHCData/lhc-sm-hwc/raw/master/figures/rb/RB.png" width=75%>
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 id: tags:
Original text: 2020-2021 (Michal); Last corrections: 29/03/2021 (Zinur)
%% 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).
- 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.
......@@ -45,10 +48,11 @@
print('Loading (12/12)'); from lhcsmapi.gui.pc.FgcPmSearchModuleMediator import FgcPmSearchModuleMediator
clear_output()
lhcsmapi.get_lhcsmapi_version()
lhcsmapi.get_lhcsmhwc_version('../__init__.py')
```
%% Cell type:markdown id: tags:
# 1. Select FGC Post Mortem Entry
......@@ -66,12 +70,12 @@
%% Cell type:code id: tags:
``` python
circuit_type = 'RB'
fgc_pm_search = FgcPmSearchModuleMediator(DateTimeBaseModule(start_date_time='2021-03-13 00:00:00+01:00',
end_date_time='2021-03-16 00:00:00+01:00'), circuit_type=circuit_type)
fgc_pm_search = FgcPmSearchModuleMediator(DateTimeBaseModule(start_date_time='2021-05-01 00:00:00+02:00',
end_date_time='2021-05-02 00:00:00+02:00'), circuit_type=circuit_type)
```
%% Cell type:markdown id: tags:
# 2. Query All Signals Prior to Analysis
......@@ -137,14 +141,18 @@
# iQPS, nQPS - PM
source_timestamp_qds_df = rb_query.find_source_timestamp_qds(timestamp_fgc)
source_timestamp_nqps_df = rb_query.find_source_timestamp_nqps(timestamp_fgc)
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)
# QDS
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'])
u_nqps_dfs = rb_query.query_voltage_nqps(source_timestamp_nqps_df, source_timestamp_qds_df, timestamp_fgc, spark=spark)
# QDS from second board (A/B)
source_timestamp_qds_df['timestamp'] = source_timestamp_qds_df['timestamp'] + 2000000
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'])
source_timestamp_qds_df['timestamp'] = source_timestamp_qds_df['timestamp'] - 2000000
# QH
source_timestamp_qh_df = rb_query.find_source_timestamp_qh(timestamp_fgc, duration=[(10, 's'), (500, 's')])
i_hds_dfs = rb_query.query_qh_pm(source_timestamp_qh_df, signal_names='I_HDS')
u_hds_dfs = rb_query.query_qh_pm(source_timestamp_qh_df, signal_names='U_HDS')
......@@ -190,13 +198,13 @@
# 3. Timestamps
## 3.1. Fast Power Abort event (FPA)
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.
In short, the following criteria should be kept:
- The PC PM (FGC, lhc_self) timestamp is expected within QPS PM timestamp +/-40 ms.
- Time delay between PIC and EE at an odd (RR or UJ) point is 100±50 ms.
- 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;
- Time delay between PIC and EE at an odd (RR or UJ) point is 100±50 ms;
- Time delay between PIC and EE at an even (UA) point is 600±50 ms;
%% Cell type:code id: tags:
``` python
timestamp_dct = {'FGC': timestamp_fgc, 'PIC': min(timestamp_pic), 'EE_EVEN': timestamp_ee_even, 'EE_ODD': timestamp_ee_odd,
......@@ -221,11 +229,21 @@
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 id: tags:
## 3.2. Reference
## 3.1.1. Quenched magnets
%% Cell type:code id: tags:
``` python
rb_analysis.results_table[['Circuit Name', 'Position', 'I_Q_M', 'Delta_t(iQPS-PIC)', 'nQPS crate name', 'Delta_t(nQPS-PIC)']]
```
%% Cell type:markdown id: tags:
## 3.2. Reference Event
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.
%% Cell type:code id: tags:
``` python
......@@ -256,12 +274,12 @@
timestamp_fgc, source_ee_odd, timestamp_ee_odd, source_ee_even, timestamp_ee_even, show_magnet_name=False)
```
%% Cell type:markdown id: tags:
# 5. Powering Interlock system (PIC)
## 5.1. Analysis of the PIC Timestamp
# 5. Powering Iinterlock system (PIC)
## 5.1. Analysis of the PIC Timestamps
*ANALYSIS*:
- Show warning if the two PIC timestamps (ODD and EVEN) differ by more than a 1 ms. (PIC)
%% Cell type:code id: tags:
......@@ -290,17 +308,17 @@
- Characteristic time of pseudo-exponential decay of I_MEAS from t=1 to 120 s: 90 s< Tau <110 s
*PLOT*:
- The main power converter current (analyzed and reference) on the left axis, I_MEAS
- The characteristic time calculated for the main current (reference and actual) on the right axis, -I_MEAS/dI_MEAS_dt
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.
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.
- t = 0 s corresponds to the respective (analyzed and reference) FGC timestamps.
%% Cell type:code id: tags:
``` python
%matplotlib notebook
%matplotlib inline
rb_analysis.analyze_i_meas_pc(circuit_name, timestamp_fgc, timestamp_fgc_ref, min(timestamp_pic), i_meas_df, i_meas_ref_df)
rb_analysis.calculate_current_miits_i_meas_i_a(i_meas_df, i_a_df, t_quench=0, col_name='MIITS_circ')
rb_analysis.calculate_quench_current(i_meas_df, t_quench=0, col_name='I_Q_circ')
rb_analysis.calculate_current_slope(i_meas_df, col_name=['Ramp rate', 'Plateau duration'])
```
......@@ -308,19 +326,19 @@
%% Cell type:markdown id: tags:
## 6.2. Analysis of the Power Converter Earth Current
*CRITERIA*:
- Checks whether for t > 3 s, I_EARTH_PCNT is within +/-3 % w.r.t. the reference
- Checks whether for t > 3 s, I_EARTH_PCNT is within +/-3 % w.r.t. the reference;
- Note: 100% corresponds to 55 mA;
*PLOT*:
t = 0 s corresponds to respective (actual and reference) FGC PM timestamps
First plot (I_EARTH, absolute scale, mA)
- The main power converter current on the left axis, I_A
- Actual and reference earth current on the right axis, IEARTH
- Actual and reference earth current on the right axis, I_EARTH
Second plot (I_EARTH_PCNT, percentage scale)
- The main power converter current on the left axis, I_MEAS
- Actual and reference earth current on the right axis, I_EARTH_PCNT; I_EARTH_PCNT scaled according to the peak value of the main reference current
......@@ -333,10 +351,11 @@
```
%% Cell type:code id: tags:
``` python
%matplotlib inline
rb_analysis.analyze_i_earth_pcnt_pc(circuit_type, circuit_name, timestamp_fgc, i_meas_df, i_meas_ref_df, i_earth_pcnt_df, i_earth_pcnt_ref_df, xlim=(-50, 350))
```
%% Cell type:markdown id: tags:
......@@ -385,11 +404,11 @@
i_a_df, i_ref_df, [u_dump_res_odd_df, u_dump_res_even_df])
```
%% Cell type:markdown id: tags:
## 7.2. Analysis of the Energy Extraction Temperature
## 7.2. Analysis of the Energy Extraction resistance Temperature
*CRITERIA*
- Checks whether temperature profile is +/-25 K w.r.t. the reference temperature profile
- Checks whether maximum temperatures are within [100, 200] K range
......@@ -419,11 +438,11 @@
rb_analysis.results_table['EE analysis'] = get_expert_decision('EE analysis: ', ['PASS', 'FAIL'])
```
%% Cell type:markdown id: tags:
# 8. Quench Protection System
# 8. Quench Protection System: QDS, QH and by pass Diode
<img src="https://gitlab.cern.ch/LHCData/lhc-sm-hwc/raw/master/figures/rb/RB_QPS_Signals.png" width=75%>
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.
|Circuit |Resistive voltage U1 |Resistive voltage U2 |Inductive voltage U1 |Inductive voltage U2|
......@@ -468,44 +487,47 @@
- diode voltage on the right axis, U_DIODE_RB
%% Cell type:code id: tags:
``` python
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
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 id: tags:
``` python
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 id: tags:
``` python
%matplotlib inline
u_diode_with_quench_rb_dfs = rb_analysis.filter_quenched_magnets(u_diode_rb_dfs, results_table['Position'])
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))
print("done!")
```
%% Cell type:code id: tags:
``` python
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))
```
%% Cell type:markdown id: tags:
## 8.2. Analysis of Quenched Magnets by QDS - PM
## 8.2. Analysis of Quenched Magnets by QDS - PMs
*ANALYSIS*:
- 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
- compute the time difference (in milliseconds) from the first quench - dt_quench
%% Cell type:code id: tags:
``` python
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)']]
```
%% Cell type:markdown id: tags:
## 8.3. Analysis of Quench Detection Voltage and Logic Signals for Quenched Magnets
......@@ -521,11 +543,11 @@
- finds U_QS0 value, u_start_quench, at the moment of quench start as u_start_quench = U_QS0(t=t_start_quench);
- the slope of the quench detection signals is calculated as du_dt = (u_ST_NQD0 - u_start_quench) / (t_st_nqd0 - t_start_quench);
- the quench detection signal polarity is taken as the sign of its slope;
- 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;
Determine source of QH trigger for nQPS signals in PM:
Determine possible source of QH trigger for nQPS signals in PM:
- calculates nQPS differences for the symmetric quench detection;
- selects only the differences that involve the quenched magnet and exclude already quenched magnets in the cell;
- for t in [-0.2 s, t_st_magnet_ok] take the maximum value of voltage difference;
- if the maximum is above 1V (considering sun glasses active from t = 0 s) and the time of maximum is less than t_st_magnet_ok, than the QH system was triggered by nQPS, otherwise iQPS;
- it is assumed that the first training quench was detected by iQPS;
......@@ -572,27 +594,27 @@
%% Cell type:code id: tags:
``` python
%matplotlib inline
rb_analysis.analyze_qds(timestamp_fgc, min(timestamp_pic), u_qds_dfs, u_nqps_dfs, i_meas_df, threshold=threshold_iqps)
rb_analysis.analyze_qds(timestamp_fgc, min(timestamp_pic), u_qds_dfs, u_qds_dfs2, u_nqps_dfs, i_meas_df, threshold=threshold_iqps)
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']]
```
%% Cell type:markdown id: tags:
## 8.4. Analysis of Quench Heater Discharges
## 8.4. Check of Quench Heater Discharges
*CRITERIA*:
- all characteristic times of an exponential decay calculated with the 'charge' approach for voltage and current are +/- 3 ms from the reference ones;
- all initial resistances are +/- 0.5 Ohm from the reference ones;
- all initial voltages are between 780 and 980 V;
- all final voltages are between 15 and 70 V;
*PLOT*:
t = 0 s corresponds to the start of the pseudo-exponential decay.
t = 0 s corresponds to the start of the decay.
Line for actual signal is continuous and dashed for the reference.
Left plot (Voltage view)
- the querried and filtered quench heater voltage on the left axis, U_HDS;
......@@ -604,18 +626,18 @@
%% Cell type:code id: tags:
``` python
%matplotlib inline
rb_analysis.analyze_qh(source_timestamp_qh_df, u_hds_dfs, i_hds_dfs, u_hds_ref_dfs, i_hds_ref_dfs)
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']]
```
%% Cell type:markdown id: tags:
## 8.5. Evaluation of Diode Lead Resistance
## 8.5. Evaluation of Diode Leads Resistance
**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.**
*ANALYSIS*:
- calculates diode lead resistance from voltage difference between board A and B and current;
......@@ -654,11 +676,11 @@
%% Cell type:code id: tags:
``` python
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)
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']]
```
%% Cell type:markdown id: tags:
## 8.6. General view of Voltage Feelers (nQPS)
......@@ -678,12 +700,11 @@
- the power converter current on the left axis, I_MEAS;
- earth voltage on the right axis, U_EARTH_RB;
Second plot (zoom)
- the power converter current on the left axis, I_MEAS;
- earth voltage on the right axis, U_EARTH_RB;
- earth voltage on the right axis, U_EARTH_RB;i
%% Cell type:code id: tags:
``` python
rb_analysis.analyze_voltage_feelers(circuit_name, timestamp_fgc, i_meas_df, u_earth_rb_dfs, 'U_EARTH_RB', 'VF')
......@@ -696,33 +717,34 @@
rb_analysis.results_table['V feeler analysis'] = get_expert_decision('Voltage feeler analysis: ', ['PASS', 'FAIL'])
```
%% Cell type:markdown id: tags:
## 8.7. Check QDS of Current Leads
*CRITERIA*:
- Check if the quench detection signal for U_HTS is below the threshold (3 mV);
- Check if the quench detection signal for U_RES is below the threshold (100 mV);
**NB: The discrimination time is not taken into account! ;(**
**NB: The discrimination time is not taken into account!** ;(
*PLOT*:
- t = 0 s corresponds to the FGC timestamp
- t = 0 s corresponds to the FGC timestamp;
Global view (for odd and even leads)
- voltage of the HTS leads on the left axis, U_HTS
- voltage of the normal conducting leads on the left axis, U_RES
- blue horizontal dashed line denotes the QPS timestamp
- voltage of the HTS leads on the left axis, U_HTS;
- voltage of the normal conducting leads on the left axis, U_RES;
- blue horizontal dashed line denotes the QPS timestamp;
Zoom view (for odd and even leads)
- voltage of the HTS leads on the left axis, U_HTS
- blue horizontal dashed line denotes the QPS timestamp
- cyan horizontal dashed line denotes the EE odd timestamp
- green horizontal dashed line denotes the EE even timestamp
- voltage of the HTS leads on the left axis, U_HTS;
- blue horizontal dashed line denotes the QPS timestamp;
- cyan horizontal dashed line denotes the EE odd timestamp;
- green horizontal dashed line denotes the EE even timestamp;
%% Cell type:code id: tags:
``` python
rb_analysis.analyze_leads_voltage(u_hts_odd_dfs+u_hts_even_dfs, circuit_name, timestamp_fgc, timestamp_qps=source_timestamp_qds_df.loc[0, 'timestamp'], signal='U_HTS', value_min=-0.003, value_max=0.003)
......@@ -781,11 +803,12 @@
rb_analysis.results_table['FPA Reason'] = get_expert_decision('Reason for FPA: ', ['QPS trip', 'Converter trip', 'EE spurious opening', 'Spurious heater firing', 'Busbar quench', 'Magnet quench', 'HTS current lead quench' ,'RES current lead overvoltage', 'No quench', 'Unknown'])
```
%% Cell type:markdown id: tags:
# 10. Analysis Comment
# 10. Analysis General Comment
%% Cell type:code id: tags:
``` python
if not fgc_pm_search.is_automatic_mode():
......@@ -797,11 +820,11 @@
# 11. Final Report
%% Cell type:code id: tags:
``` python
pd.set_option('display.max_columns', None)
# pd.set_option('display.max_columns', None)
pd.set_option('display.max_rows', None)
analysis_start_time = Time.get_analysis_start_time()
date_time_fgc = Time.to_datetime(timestamp_fgc).strftime("%Y-%m-%d-%Hh%M")
!mkdir -p /eos/project/m/mp3/RB/$circuit_name/FPA
......@@ -819,5 +842,11 @@
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_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 id: tags:
``` python
```
......
......@@ -26,24 +26,24 @@
%% Cell type:code id: tags:
``` python
# External libraries
print('Loading (1/12)'); import sys; import pandas as pd
print('Loading (1/12)'); import sys, warnings
print('Loading (2/12)'); from IPython.display import display, Javascript, HTML, clear_output
print('Loading (3/12)'); import pandas as pd
# Internal libraries
print('Loading (4/12)'); import lhcsmapi
print('Loading (5/12)'); from lhcsmapi.Time import Time
print('Loading (6/12)'); from lhcsmapi.Timer import Timer
print('Loading (7/12)'); from lhcsmapi.analysis.RbCircuitQuery import RbCircuitQuery
print('Loading (8/12)'); from lhcsmapi.analysis.RbCircuitAnalysis import RbCircuitAnalysis
print('Loading (9/12)'); from lhcsmapi.analysis.report_template import apply_report_template
print('Loading (10/12)'); from lhcsmapi.gui.qh.DateTimeBaseModule import DateTimeBaseModule
print('Loading (11/12)'); from lhcsmapi.gui.hwc.HwcSearchModuleMediator import HwcSearchModuleMediator
print('Loading (12/12)'); from lhcsmapi.analysis.expert_input import get_expert_decision
print('Loading (10/12)'); from lhcsmapi.analysis.expert_input import get_expert_decision
print('Loading (11/12)'); from lhcsmapi.gui.qh.DateTimeBaseModule import DateTimeBaseModule
print('Loading (12/12)'); from lhcsmapi.gui.hwc.HwcSearchModuleMediator import HwcSearchModuleMediator
clear_output()
lhcsmapi.get_lhcsmapi_version()
lhcsmapi.get_lhcsmhwc_version('../__init__.py')
print('Analysis performed by %s' % HwcSearchModuleMediator.get_user())
......@@ -105,11 +105,11 @@
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 = Time.to_unix_timestamp(t_start_ref), Time.to_unix_timestamp(t_end_ref)
is_automatic = False
rb_query = RbCircuitQuery(circuit_type, circuit_name, max_executions=35)
rb_query = RbCircuitQuery(circuit_type, circuit_name, max_executions=40)
with Timer():
source_timestamp_pc = rb_query.find_source_timestamp_pc(t_start, t_end)
timestamp_fgc = source_timestamp_pc.at[0, 'timestamp']
......@@ -144,10 +144,11 @@
t_res_even_0_df = rb_query.query_ee_t_res_pm(source_timestamp_ee_even_df.loc[0, 'timestamp'], timestamp_fgc, signal_names=['T_RES_BODY_1', 'T_RES_BODY_2', 'T_RES_BODY_3'], system='EE_EVEN')
if len(source_timestamp_ee_even_df) > 1:
t_res_even_1_df = rb_query.query_ee_t_res_pm(source_timestamp_ee_even_df.loc[1, 'timestamp'], timestamp_fgc, signal_names=['T_RES_BODY_1', 'T_RES_BODY_2', 'T_RES_BODY_3'], system='EE_EVEN')
else:
t_res_even_1_df = [pd.DataFrame(columns=['T_RES_BODY_1']), pd.DataFrame(columns=['T_RES_BODY_2']), pd.DataFrame(columns=['T_RES_BODY_3'])]
# EE TEMPERATURE REF
source_timestamp_ee_odd_ref_df = rb_query.find_source_timestamp_ee(timestamp_fgc_ref, system='EE_ODD')
source_timestamp_ee_even_ref_df = rb_query.find_source_timestamp_ee(timestamp_fgc_ref, system='EE_EVEN')
t_res_odd_0_ref_df = rb_query.query_ee_t_res_pm(source_timestamp_ee_odd_ref_df.loc[0, 'timestamp'], timestamp_fgc_ref, signal_names=['T_RES_BODY_1', 'T_RES_BODY_2', 'T_RES_BODY_3'], system='EE_ODD')
......@@ -158,10 +159,11 @@
t_res_even_0_ref_df = rb_query.query_ee_t_res_pm(source_timestamp_ee_even_ref_df.loc[0, 'timestamp'], timestamp_fgc_ref, signal_names=['T_RES_BODY_1', 'T_RES_BODY_2', 'T_RES_BODY_3'], system='EE_EVEN')
if len(source_timestamp_ee_even_ref_df) > 1:
t_res_even_1_ref_df = rb_query.query_ee_t_res_pm(source_timestamp_ee_even_ref_df.loc[1, 'timestamp'], timestamp_fgc_ref, signal_names=['T_RES_BODY_1', 'T_RES_BODY_2', 'T_RES_BODY_3'], system='EE_EVEN')
else:
t_res_even_1_ref_df = [pd.DataFrame(columns=['T_RES_BODY_1']), pd.DataFrame(columns=['T_RES_BODY_2']), pd.DataFrame(columns=['T_RES_BODY_3'])]
# U_DIODE - CALS
u_diode_rb_dfs = rb_query.query_voltage_nxcals('DIODE_RB', 'U_DIODE_RB', timestamp_fgc, spark=spark, duration=[(50, 's'), (350, 's')])
# iQPS, nQPS - PM
source_timestamp_qds_df = rb_query.find_source_timestamp_qds(timestamp_fgc)
......@@ -187,11 +189,11 @@
# DIODE LEADS
i_a_u_diode_u_ref_pm_dfs = rb_query.query_current_voltage_diode_leads_pm(timestamp_fgc, source_timestamp_qds_df)
i_meas_u_diode_nxcals_dfs = rb_query.query_current_voltage_diode_leads_nxcals(source_timestamp_qds_df, spark=spark, duration=[(50, 's'), (350, 's')])
# U_EARTH
u_earth_rb_dfs = rb_query.query_voltage_nxcals('VF', 'U_EARTH_RB', timestamp_fgc, ldb=ldb, duration=[(50, 's'), (350, 's')])
u_earth_rb_dfs = rb_query.query_voltage_nxcals('VF', 'U_EARTH_RB', timestamp_fgc, spark=spark, duration=[(50, 's'), (350, 's')])
# DFB
source_timestamp_leads_odd_df = rb_query.find_timestamp_leads(timestamp_fgc, 'LEADS_ODD')
u_hts_odd_dfs = rb_query.query_leads(timestamp_fgc, source_timestamp_leads_odd_df, system='LEADS_ODD', signal_names=['U_HTS'], spark=spark)
u_res_odd_dfs = rb_query.query_leads(timestamp_fgc, source_timestamp_leads_odd_df, system='LEADS_ODD', signal_names=['U_RES'], spark=spark)
......@@ -349,10 +351,11 @@
```
%% Cell type:code id: tags:
``` python
%matplotlib notebook
rb_analysis.analyze_i_earth_pcnt_pc(circuit_type, circuit_name, timestamp_fgc, i_meas_df, i_meas_ref_df, i_earth_pcnt_df, i_earth_pcnt_ref_df, xlim=(-50, 350))
```
%% Cell type:markdown id: tags:
......@@ -489,11 +492,11 @@
```
%% Cell type:code id: tags:
``` python
u_diode_with_quench_rb_dfs = rb_analysis.filter_quenched_magnets(u_diode_rb_dfs)
u_diode_with_quench_rb_dfs = rb_analysis.filter_quenched_magnets(u_diode_rb_dfs, results_table['Position'])
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=(-2, 3))
```
%% Cell type:markdown id: tags:
......@@ -568,13 +571,20 @@
%% Cell type:code id: tags:
``` python
# iQPS Threshold
threshold_iqps = 0.1
```
%% Cell type:code id: tags:
``` python
%matplotlib inline
if u_nqps_dfs:
rb_analysis.analyze_qds(timestamp_fgc, min(timestamp_pic), u_qds_dfs, u_nqps_dfs, i_meas_df)
rb_analysis.analyze_qds(timestamp_fgc, min(timestamp_pic), u_qds_dfs, u_nqps_dfs, i_meas_df, threshold=threshold_iqps)
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']]
```