Education/GMinstructions/archive/upto1220/DataProcessing/FullTexts.tex


\subsection{Measurement procedure}

%<*DataAccess>
All the data collected during the experiment are stored in the GOLEM database in so-called \textit{signals}. A signal typically contains a time axis and the measured values. The sampling rate of all measurements is 1 MHz (time step $\Delta t=1 \, \mu$s). The time delay between starting the diagnostics ($t=0$ of the time axis) and switching on the toroidal magnetic field drive is 5 ms. A list of all collected signals may be viewed at \url{http://golem.fjfi.cvut.cz/shots/0/Data.php\#all\_data} for each respective discharge.

To access the data, one may manually download the text files from GOLEM webpage. However, when processing the data automatically, it is far more convenient to download them using scripts. An example Python script for data access is available in \cite{gw:KFpraktdopr}.
%</DataAccess>



%<*Offset>
\begin{figure}[h]
  \centering
\includegraphics[width=0.6\linewidth]{OffsetDemonstration.png}
	\caption{Time traces of $dB/dt$ and integrated $B$ in GOLEM discharge \#31150, demonstrating the offset impact on the integrated data quality.}
	\label{fig:offset}
\end{figure}

Magnetic measurements via electromagnetic induction are quite simple to set up, but their disadvantage lies in the need to integrate the signal. This involves many problems, the most basic of which is handling the \textit{offset}. An offset is a non-physical addition to a signal, created by noise in the electronics, parasitic voltages, cross-talk between the diagnostics and many other influences. Figure \ref{fig:offset} demonstrates the impact an offset can have on data integration. In blue, the real, physical $dB/dt$ and $B$ are plotted. In red, a small constant offset was added to the entire raw signal. In green, a normal-distributed noise with a zero mean was added to the raw signal. One observes the effect that this has on the integrated signal, in particular the \textit{drift} in the red case. 

In this assignment, offsets are more than likely to appear on the $U_{l}$, $U_{B_t}$ and $U_{RC}$ signals. The simplest method to remove them is to average the first few hundred/thousands of samples (before the 5 ms mark) and subtract this average from the signal prior to its integration. This method will fail if the offset is time-dependent, but in that case removing it is a whole new problem which cannot be addressed within the time frame of this assignment. If persistent offset problems appear, ask the assistant for help.
%</Offset>


%<*Averaging>
\begin{figure}[ht]
  \centering
\includegraphics[width=\linewidth]{FlowChartSimple/fig/drawing.pdf}
	\caption{Flow chart of the $\tau_E$ evaluation procedure.}
	\label{fig:flowchart}
\end{figure}

The general workflow of data processing in this assignment is shown in figure \ref{fig:flowchart}. In the upper part of the figure, entire time-dependent signals are processed sample by sample. In the middle, averaging takes place, replacing the time vectors with a single number (and its standard deviation as the uncertainty). In the lower part of the figure, all calculations are performed with these representative numbers only.

The time span $(t_1, t_2)$ over which $I_p$, $U_{l}$, $n_e$ and $B_t$ are averaged can be chosen arbitrarily. It should, however, cover a substantial part of the quasi-stationary discharge phase, shown in figure \ref{fig:discharge-evol}.

Experimental uncertainties come from three main sources: turbulent plasma fluctuations during the discharge, changing plasma properties over the averaging period, and differences between the individual 10 discharges performed in task \ref{task:5}. The first two can be captured using $\tau_E$ and $B_t$ errorbars in the scatterplot produced in task \ref{task:5}. The third uncertainty creates scatter within the $\tau_E$-$B_t$ plot. To calculate the errorbars of $\tau_E$ from the uncertainties in $U_{l}$, $I_p$, $R_{ch}$ and $n_e$, use the standard error propagation tools. Do not consider errors contained in the calibration factors, the chamber current $I_{ch}$ and the offset removal (that is, the operations performed in the upper half of figure \ref{fig:flowchart}).
%</Averaging>






%<*Procedure>
\subsection{General strategy}

\begin{figure}[ht]
  \centering
\includegraphics[width=\linewidth]{FlowChartSimple/fig/drawing.pdf}
	\caption{The flow chart of the $\tau_E$ evaluation procedure}
	\label{fig:flowchart}
\end{figure}

The flow chart of the $\tau_E$ evaluation procedure is depicted at the figure \ref{fig:flowchart}. 
Due to the fact that the vessel is metallic, the current induced in the transformer after the breakdown flows both through the plasma and through the vessel and thus 
we need to perform two discharges: i) vacuum discharge (with no gas injected into the vessel) to get Chamber resistivity $R_{ch}$ and calibrate $B_t$ and Rogowski measuring coils ($C_{Bt}$, $C_{RC}$) and ii) plasma discharge to get other physical quantities necessary for the experiment mission: loop voltage $U_l$, plasma current $I_p$  and electron density $n_e$ for the $\tau_E$ evaluation and toroidal magnetic field $B_t$ as an independent variable.

The sampling rate of the time resolved measurements $f_{DAS}=1$ MHz, time delay 
between starting diagnostics and toroidal magnetic field drive  $T_{DAS}=5$ ms and
time delay between toroidal field and inductive current drive $T_{CD}$ are Data Acquisition System (DAS) time parameters.

\subsection{Magnetic measurements}

The toroidal magnetic field $B_t (t)$ measured by the $B_t$ coil and the  currents $I_{ch+p} (t), I_{ch} (t)$ measured by the Rogowski coil (generally diagnostics $D(t)$) measurements are from the magnetic diagnostics family and the corresponding measured raw signals (analog  $U_r(t)$ or, respectively, it's discretized digital $U_i$ counterpart form ) must be specialy maintained: i) corrected for the DC bias $U_{offset}$ of the measurement circuit, ii) integrated (pure diagnostics signal voltage $U_{d} (t)$ is induced by the time derivative of the appropriate magnetic flux), and iii) multiplied by calibration factors $C_d$ ($C_Bt$, $C_{RC}$). We can express the basic relationship in this form:

\begin{equation*}
U_r(t)=U_d(t)+U_{offset}
\end{equation*}

The measured signal $U_d(t)$ is proportional to the time derivative of the  original physical quantity $D(t)$ signal (it is a magnetic measurement):

\begin{equation*}
U_d(t)\propto\frac{dD(t)}{dt} \mbox{, or  } U_d(t)=C_d\frac{dD(t)}{dt}
\end{equation*}

Where the linearity coefficient $C_d$ is called a calibration factor. 

To determine the desired physical quantity $D(t)$, we just have to perform an integration over time:

\begin{equation*}
D_{}(t)=\frac{1}{C_d}\overset t{\underset 0{\int}}
U_{d}(t')dt'=\frac{1}{C_d}\overset t{\underset 0{\int}}
\left(U_r(t)-U_{offset}\right)dt'
\end{equation*}

This is a theoretical formula: in reality, the measurement is not continuous. The system
performs a series of measurements $U_i$ separated by a small time interval  $\mathit{\Delta t} = 1$ us. In practice, to determine the desired discretized evolution of the physical quantity $D_i$, we replace the integral by a sum,
assuming that the quantity $D(t)$ does not change during narrow time intervals:

\begin{equation*}
\begin{matrix}
D_{}(t)&=&\frac{1}{C_d}\overset t{\underset 0{\int}}\left(U_i(t')-U_{offset}\right)dt'
\\D_i&=&
\frac{1}{C_d}{\overset{t/\mathit{\Delta t}}{\underset{j=0}\sum}\left(U_i(t_j)-U_{offset}\right)}\mathit{\Delta t}
\\D_i&= &
\frac{1}{C_d}{\left(\overset{t/\mathit{\Delta t}}{\underset{j=0}\sum}U_i(t_j)\right)}-U_{offset} t
\end{matrix}
\end{equation*}


The offset $U_{offset}$ can be specified from the beggining of the data series before switching on the discharge when there is a  only background noise in the signals.  If the sampling rate is 1 MHz, and the shot starts at 5 ms, we have 5000 samples from the background noise. It is better to exclude a few samples around the swithing time point.

\begin{equation*}
U_{offset}=\frac{\overset{4500}{\underset{i=1}{\sum U_i}}}{4500}
\end{equation*}
%</Procedure>




\subsection{Determination of vacuum chamber parameters}\label{sec:vacuum}

In GOLEM, part of the toroidal current always flows in the vacuum vessel, which has to be taken into account during the interpretation of experimental results. In a vacuum shot, when no plasma is formed, it is possible to determine the resistance of the vacuum vessel: all the current measured by the Rogowski-coil flows in the vessel. This is an important parameter for further evaluations.

Let us denote the loop voltage with $U_{l}$, the resistance of the chamber by $R_{ch}$, the total current (which is the chamber current ($I_{ch}$) in this case) with $I_{tot}$ and the inductance of the chamber by $L_{ch}$.

The circuit equation is then
\begin{equation}
	U_{l}(t)= R_{ch} \cdot I_{tot}(t) + L_{ch} \dfrac{d I_{tot}}{d t}.
\label{eq:vac}
\end{equation}

Using the loop voltage measurement and the Rogowski-coil, we have both $U_{l}$, $I_{tot}$ and $dI_{tot}/dt$ measured, so $R_{ch}$ and $L_{ch}$ can be determined. 

A simple method is the following: Just after switching on the toroidal electric field, the toroidal current is still close to zero ($I_{tot}\approx 0$), so $U_{l}\approx L_{ch} dI_{tot}/dt$, so $L_{ch}$ can be determined. On the other hand, at the flat top of the current curve ($dI_{tot}/dt \approx 0$) equation \eqref{eq:vac} simplifies to $U_{l}\approx R_{ch} \cdot I_{tot}$, so $R_{ch}$ can be estimated.

A more sophisticated method is a 2D least squares linear fit making use of all data points $(U_{l},I_{tot},dI_{tot}/dt)$. Since we have only two independent parameters $R_{ch}$ and $L_{ch}$, the fitted plane has to pass through the origin. If we divide equation \eqref{eq:vac} by $I_{tot}$, we can simplify the task to a 1D least squares linear fit, which can be easily implemented in MATLAB (OCTAVE), using \textit{polyfit} function.

Values of $R_{ch}$ and $L_{ch}$ should be calculated for about \textbf{5} discharges having different parameters, and the results should be compiled to a single best estimate for both parameters. Estimation should be performed by both methods described above, and the results of the method giving the more precise estimates should be used in the further steps.


\section{Measurement tasks, method of evaluation}\label{sec:tasks}

This section starts with a short description on how to reconstruct the measured plasma parameters from the raw signals returned by GOLEM\_get\_data.m. Measurement tasks are detailed in the later subsections.

The sampling rate of the time resolved measurements (samplerate), time delay
between starting diagnostics and toroidal magnetic field drive (trigger) and
time delay between toroidal field and inductive current drive (time\_delay) are
returned by GOLEM\_get\_data.m, and these are to be used whenever needed instead
of the examples provided in this description.


The simplest signal to be reconstructed is the loop voltage ($U_l$): The measurement loop of the loop voltage is connected to a voltage divider, therefore the signal must be multiplied by a calibration factor (U\_loop\_calibration) as plotted in Figure \ref{fig:bd_U_l}.

\begin{figure}[ht]
\centerline{\resizebox{100mm}{!}{\rotatebox{0}{\includegraphics[trim=0cm 8.5cm 9cm 4cm, clip=true]{BlockDiagrams/bd_U_l.pdf}}}}
	\caption{Block diagram showing the steps of data processing for loop voltage measurement.}
	\label{fig:bd_U_l}
\end{figure}

The toroidal magnetic field ($B_t$) and the total current ($I_{tot}$) raw signals must be integrated before multiplying by calibration factors (Bt\_calibration and Rogowski\_calibration). The reason for this is that the voltage measured is induced in these diagnostic loops and coils by the changing of the toroidal and poloidal magnetic field respectively.

Integrated magnetic measurements are very sensitive to the DC bias of the measurement circuit, which needs to be corrected for. If the sampling rate is 1 MHz, and the shot starts at 5 ms, we have 5000 samples from the background noise. It is better to exclude a few samples around the swithing time point. This is important, because these samples measure the bias, and we can correct the integrated values with this factor.

Figure \ref{fig:bd_dB_t} shows the block diagram for the necessary steps of processing for the toroidal magnetic field signal. Routines for all the steps are ready, they should just be parametrized and linked.

\begin{figure}[ht]
\centerline{\resizebox{160mm}{!}{\rotatebox{0}{\includegraphics[trim=1cm 8.5cm 0cm 4cm, clip=true]{BlockDiagrams/bd_dB_t.pdf}}}}
	\caption{Block diagram showing the steps of data processing for toroidal magnetic field measurement.}
	\label{fig:bd_dB_t}
\end{figure}

The block diagram for the total current measured by the Rogowski coils is only slightly more complicated: Switching the toroidal magnetic field on causes an offset in the toroidal current measurement, which has to be corrected by subtracting the average value measured in the $\tau_{OH}$ long interval before switching on the toroidal electrical field from the integrated current value.

\begin{figure}[ht]
\centerline{\resizebox{160mm}{!}{\rotatebox{0}{\includegraphics[trim=1cm 5cm 0cm 4cm, clip=true]{BlockDiagrams/bd_dI_t.pdf}}}}
	\caption{Block diagram showing the steps of data processing for total plasma current measurement.}
	\label{fig:bd_dI_t}
\end{figure}



\subsection{Estimation of main plasma parameters}\label{sec:parameters}

If plasma breakdown occurs, plasma parameters can be determined - with different accuracy - from the measured parameters. The aim of this task is to investigate the effect of different parameters on the performance of the discharge, and reach discharges with the highest central temperature, plasma energy or energy confinement time. This task should result in about \textbf{25} discharges.