%%% lorem.tex --- 
%% 
%% Filename: lorem.tex
%% Description: 
%% Author: Ola Leifler
%% Maintainer: 
%% Created: Wed Nov 10 09:59:23 2010 (CET)
%% Version: $Id$
%% Version: 
%% Last-Updated: Wed Nov 10 09:59:47 2010 (CET)
%%           By: Ola Leifler
%%     Update #: 2
%% URL: 
%% Keywords: 
%% Compatibility: 
%% 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 
%%% Commentary: 
%% 
%% 
%% 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 
%%% Change log:
%% 
%% 
%% RCS $Log$
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 
%%% Code:
% !TeX root = main.tex

\chapter{Methods}\label{cha:methods}
This chapter covers the methodologies used during the project.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Prestudy}
During the project efforts were made to find relevant research using Linköping University Library's\footnote{\url{https://liu.se/en/library/}} and Google Scholar's\footnote{\url{https://scholar.google.se/}} search engines.

Since the equipment intended for this project was untested before the project start, the first step was to hook it up and make some initial measurements to be able to decide the continuation of the project.

If the equipment is in line with the new standard requirements, the project will go along the following path:
\begin{enumerate}
    \item Investigate test architectures suitable for automatic testing and verification.
    \item Design any utilities needed for the test and verification setup.
    \item Implement the test architecture and any necessary utilities.
    \item Measure and evaluate the system and the utilities.
\end{enumerate}

If the equipment deviates from the new standard requirements, the project will go along the following path:
\begin{enumerate}
    \item Investigate possible causes and fixes for the failure.
    \item Design any utilities needed for the equipment to pass.
    \item Implement these utilities.
    \item Measure and evaluate the system with these utilities manually.
\end{enumerate}

In either case, the following tasks should be considered if there is time:
\begin{enumerate}
    \item Investigate possible methods, or algorithms, that can automatically verify the pulse shapes and parameters.
    \item Implement a number of these methods.
    \item Evaluate these methods.
\end{enumerate}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Comparison between the old and the new standard}
Since the equipment used in the project is designed for the older version of the standard, ISO~7637\nd2:2004 and possibly even ISO~7637\nd1:1990 together with ISO~7637\nd2:1990, the differences will be examined. This is done simply by comparing the standards side by side and noting the differences.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Examination and initial measurement of the old equipment}
To decide the continuation of the project, the equipment first had to be inspected to see if it is capable to operate within the limits for use with the newer standard. This was done as a verification as specified by the standard, described in \autoref{sec:theory:verification}. Only the open load measurements could be done, since no dummy loads were available at this time in the project.

With exception for Pulse 3a and Pulse 3b, all of the pulses were measured with the use of the high voltage differential probe described in \autoref{sec:hv-diff-probe}. The pulses are measured both directly on each generator connected according to \autoref{fig:manual-measurement-hv-diff} and also through the coupling network CNA~200, as depicted in \autoref{fig:manual-measurement-hv-diff-cna}.

\begin{figure}[H]
	\centering
	\begin{subfigure}[t]{0.5\textwidth}
		\includegraphics[width=\textwidth]{manual-measurement-hv-diff}
		\caption{Without CNA.}
   	    \label{fig:manual-measurement-hv-diff}
	\end{subfigure}
	
	\begin{subfigure}[t]{0.7\textwidth}
		\includegraphics[width=\textwidth]{manual-measurement-hv-diff-cna}
		\caption{With CNA.}
   	    \label{fig:manual-measurement-hv-diff-cna}
	\end{subfigure}
	\caption{The setup for measuring for test pulse 1, test pulse 2a and load dump test A.}
\end{figure}

Test pulse 3a and 3b was measured using the attenuators described in \autoref{sec:hv-attenuators} connected directly to the coaxial connector according to \autoref{fig:manual-measurement-hv-att} without the CNA. They were also measured connected through the CNA, directly to the coaxial connector according to \autoref{fig:manual-measurement-hv-att-cna}. Thanks to the 50-ohm attenuator, PAT-50, this pulse could be measured in its matched state. 

\begin{figure}[H]
	\centering
	\begin{subfigure}[t]{0.45\textwidth}
		\includegraphics[width=\textwidth]{manual-measurement-hv-att}
		\caption{Without CNA.}
   	    \label{fig:manual-measurement-hv-att}
	\end{subfigure}\hfill
	\begin{subfigure}[t]{0.45\textwidth}
		\includegraphics[width=\textwidth]{manual-measurement-hv-att-cna}
		\caption{With CNA.}
   	    \label{fig:manual-measurement-hv-att-cna}
	\end{subfigure}
	\caption{The setup for measuring for pulse 3a and pulse 3b.}
\end{figure}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Test architecture}
The total number of tests needed to verify the testing equipment before each product test is 14, according to \autoref{tab:verification-list}. There are in total three different values for dummy loads. In practice these could be represented by two high frequency attenuators for pulse 3a and pulse 3b, since these have really short rise times that will be affected much by parasitics of components, and three different high power dummy loads for the slower pulses where the parasitic effects might be negligible but the ability to withstand power must be higher.

The following test architectures were considered, together with the external supervisor at the company. The company has a testing framework that is capable of controlling GPIB-compatible equipment which will be used to control the generators and measurement equipment in the future.

Additionally there needs to be some sort of measurement fixture for evaluating the verification equipment.

%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Alternative 1 -- Human assisted}
The test can be performed semi-automatically by means of the existing equipment complemented by some dummy loads, in the same manner the manual performance tests were executed. A computer could control the equipment with GPIB and compare the results. A human needs to make the necessary reconnections between the tests. A proposed setup for this is shown in \autoref{fig:test_setup_human_assisted}.

The main advantage of this alternative is that it would require the least amount of hardware development time. It also doesn't need any extra hardware except from the dummy loads needed to do the verification.

The biggest disadvantage is that it would be very cumbersome to perform and also prone to human error. If the verification list is studied carefully one can minimize it to five reconnections after the initial connections are made, for example in the following order: No load, \SI{2}{\ohm}, \SI{10}{\ohm}, \SI{50}{\ohm} low frequency, \SI{50}{\ohm} high frequency, \SI{1}{\kilo\ohm} high frequency.

\begin{figure}[H]
    \centering
    %\captionsetup{width=.5\linewidth}
    \includegraphics[width=0.5\textwidth]{test setup human assisted}    
    \caption{The proposed setup for alternative must be connected in different ways by a human during the verification process.}
    \label{fig:test_setup_human_assisted}
\end{figure}

%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Alternative 2 -- Fully automatic rig with external attenuators}
To accurately measure Pulse 3a and Pulse 3b, the probes should be attached as close as possible to the generator because of the high frequency, to avoid influence of the connecting wires. This could be accomplished by the means of a fixture that is attached directly to the generator, which can switch the pulses to the different loads or to the measurement outputs.

The dummy loads for all pulses, but Pulse 3a and Pulse 3b, will need to be put in a separate enclosure because of the high power dissipation. The proposed dummy loads for pulse 3a and pulse 3b is the external attenuators PAT~50 and PAT~1000. A proposed setup is depicted in \autoref{fig:test_setup_automatic_external}.

\begin{figure}[H]
    \centering
    %\captionsetup{width=.5\linewidth}
    \includegraphics[width=0.5\textwidth]{test setup automatic external}
    \caption{The proposed setup for alternative 2 is fully automatic, but exposes high voltage connectors between the demultiplexer and the two attenuators, marked with a red line.}
    \label{fig:test_setup_automatic_external}
\end{figure}

The advantage of this method is that the verification can be performed fully automatically, except for the initial connection of the test rig. This also uses the commercially created attenuators that are already available.

The disadvantage to this setup is that the fixture needs to be designed, making the development costs greater. The fixture that attaches to the generator will expose high voltage on its measurement connectors, making it a safety hazard for the test operator.

%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Alternative 3 -- Fully automatic rig with embedded attenuators}
To cope with the high voltage exposure, of alternative 1, the high frequency attenuators can be embedded inside the switching fixture, removing the need for high-voltage connectors. \autoref{fig:test_setup_automatic_internal}.

To design Alternative 3 some utilities needs to be designed, namely:
\begin{itemize}
    \item Relay box, the fixture with embedded attenuators that are to be attached to the front of the CNA.
    \item Match box, the dummy loads with some relays to be able to switch between them.
\end{itemize}

\begin{figure}[H]
    \centering
    %\captionsetup{width=.5\linewidth}
    \includegraphics[width=0.5\textwidth]{test setup automatic internal}
    \caption{The proposed setup for alternative 3 have no high voltage connectors exposed during the calibration.}
    \label{fig:test_setup_automatic_internal}
\end{figure}

The advantages of this, in addition to the advantages of alternative 2, are that there is no longer need for external attenuators and that the connectors will no longer expose high voltage to the test operator.

The disadvantage of this would be that the embedded attenuators might prove difficult to design. They need to be accurate up to high frequencies, be tolerable to high voltage, dissipate the power necessary and also be electrically safe.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Design of dummy loads}
Each dummy load must withstand the applied test pulses, and preferably the worst possible test pulse for the specific dummy load even though it might not be intended. The dummy loads must have a tolerance of \SI{1}{\percent} or less and be non-inductive. \cite{iso_7637_2}

The dummy loads consists of one or more resistors. When determining whether the resistors withstands the test pulses, the parameters of interest are power dissipation, maximum voltage and maximum energy applied over time.

Since the pulse generators in most cases can generate a higher voltage than required by the standard, the dummy loads should be designed for the worst case setting on the generator. This mitigates the risk of overloading the dummy load caused human error or an error in the control system.

Three different dummy loads are needed. One \SI{2}{\ohm} load for load dump test A and for test pulse 2a, one \SI{10}{\ohm} load for pulse 1 in \SI{24}{\volt} systems and one \SI{50}{\ohm} load for pulse 1 in \SI{24}{\volt} systems.

%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Components}
\label{sec:dummy_load:components}
At first the momentary worst case powers and voltages were calculated by hand, using \autoref{eq:dummy_load_peak}. But to find components that withstand these high momentary powers proved very difficult, and it is not necessary since the pulse power is only high for a very short time. 

\begin{equation}
    P_{peak} = \left( \frac{U_S}{R_S+R_L} \right)^2 R_L
    \label{eq:dummy_load_peak}
\end{equation}

Instead of selecting components based on peak power they can be selected based on energy over time. Although, not all manufacturers specify this data in the datasheet. To get the proper values for this project, a simulation was made with LTSpice. The simulated circuit can be seen in \autoref{fig:ltspice-pulse-energy}. There are preconstructed models for all of the relevant pulses, but the parameters are not tweakable. Thus, the pulse offset is removed, the magnitude is normalized and then multiplied by the desired $U_S$ using the behavioural voltage source component in LTSpice. The power dissipated in the dummy load is then integrated over time to obtain the energy. The simulated circuit translates to the calculation shown in \autoref{eq:dummy_load_energy}.

\begin{equation}
    E_{dummy load} = \int_{t_0}^{t_1}P(t)dt
    \label{eq:dummy_load_energy}
\end{equation}


\begin{figure}[H]
    %\captionsetup{width=.5\linewidth}
    \centering
    \includegraphics[width=\textwidth]{ltspice-pulse-energy}
    \caption{The energy transferred to the dummy load was simulated using the above LTSpice circuit for pulse 1. Similar circuits was used for the other pulses.}
    \label{fig:ltspice-pulse-energy}
\end{figure}

Based on the energy in each load, the minimum number of resistances could be achieved by dividing the energy from simulation by the energy specified in the resistor's datasheet.

%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{PCB}
\label{sec:dummy_load_pcb}

Since most of the test pulses exceedes the properties of most resistors available, the dummy loads will be constructed of many resistors to share the power. It was decided to design a circuit board to connect all the discrete resistors. Not only does a PCB ease the connectivity of many components, it also gives good mechanical control of the resistors and the possibility to design for good heat dissipation.

Both the circuit schematic and layout editing of the board were performed in the free EDA, Electronic Design Automation, tool KiCad\footnote{KiCad EDA \url{http://kicad-pcb.org/}}.

Before ordering the PCB, it was printed in 1:1 scale and attached to a piece of cardboard. The cardboard was then populated with the components already at hand to ensure that the footprints are correct and that the placement of the components make sense and do not collide.



%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Measurements}
When the dummy loads had been assembled, their resistances were determined using four wire resistance measurement directly at the PCB's connection points, as described in \autoref{sec:measurement:resistance}.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Design of the switching fixture and the embedded attenuators}
The chosen implementation requires a fixture with switches and attenuators, which purpose is to multiplex the pulse to the desired attenuator or to the dummy load. The principle is shown in \autoref{fig:relay_box}.

\begin{figure}[h]
    \captionsetup{width=.5\linewidth}
    \centering
    \includegraphics[width=0.5\textwidth]{relay_box}
    \caption{The multiplexing relay box can couple each of the three inputs through any of the attenuators. It can also connect the external dummy load to the $+$ and $-$ signal.}
    \label{fig:relay_box}
\end{figure}

Only Pulse 3a and Pulse 3b were considered when designing these attenuators, since all other test pulses will be coupled to the separate dummy load. The attenuators must be able to withstand the pulse energies and voltages and should not distort the pulses. Preferably, the attenuators should also be able to withstand the worst case settings in the pulse generator with regard to voltage and power.

%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Components}
The same methods were used for the attenuators as for the dummy loads to determine the number of resistors needed to share the power and voltage.

The relays were chosen based on high breakdown voltage between open contacts.

%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Attenuators}
The target attenuation was decided to mimic the commercial attenuators, introduced in \autoref{sec:hv-attenuators}, where the \SI{50}{\ohm} attenuator has an attenuation of \SI{54.7}{\deci\bel} and the \SI{1000}{\ohm} attenuator has an attenuation of \SI{60.1}{\deci\bel}.

The two attenuators were implemented as $\Pi$-attenuators. The resistor values for the attenuators were retrieved from an online calculator\footnote{$\Pi$\nd{}attenuator calculator \url{https://chemandy.com/calculators/matching-pi-attenuator-calculator.htm}}, and then simulated in LTSpice to verify the resulting properties.

By dividing the attenuators into two $\Pi$-networks, the series resistance required is lower compared to realizing them in a single $\Pi$-network. This is desirable because the parasitic capacitance, which is dependent of the resistor package and not the resistance value, will influence a high value resistor more at lower frequencies than it would on a low value resistor, as explained in \autoref{sec:theory:resistors_at_high_frequencies}.

When the ideal resistor values had been obtained, the power over time and maximum voltage for each resistor was obtained by simulation in a similar way as for the dummy load described in \autoref{sec:dummy_load:components}. Based on this, the minimum number of discrete resistors needed to withstand the pulse energy was calculated. The minimum number of series resistors to withstand the maximum pulse voltage was also obtained from the simulation.

With the minimum number of discrete resistors needed for each ideal resistor known, a constellation of available resistor values was constructed to approximate the nominal value with as few resistors as possible. The circuits for the two attenuators are presented in \autoref{sec:result-attenuators}.

When the number of resistors and their constellations was decided, all of the discrete ideal resistors were replaced with non-ideal models in the simulation software. Each lead inductance was set to \SI{1}{\nano\henry}, the internal inductance was set to \SI{0.1}{\nano\henry} and the internal capacitance was set to \SI{1}{\pico\farad}. Then the attenuators were checked in frequency domain, as well as how the pulses were affected in time domain. If the required \SI{400}{\mega\hertz} bandwidth could not be achieved, frequency compensation with capacitors was attempted.

%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{PCB}

A PCB was designed for the attenuators and the switches. This gives good control of the lengths of the conductors, which is of importance when designing for higher frequencies. It is also possible to use the PCB for other mechanical purposes. For example to fit connectors in a desired constellation.

The design process followed the same methods as for the dummy load PCB. But because of the higher voltages some special considerations had to be made.

The measurement connectors accessible on the outside of the encapsulation must be electrically safe at all times. This involves keeping a minimum creepage distance of \SI{6}{\milli\meter} to any trace that carry a high voltage, according to the regulations in EN~60664\nd1 \cite{en_60664_1}.

The EDA tool has functionality for design rule checking, DRC, but there are some limitations in this function that inhibit its use in this case. The DRC in KiCad only allows to set the clearance for a specified net to all other nets. In this case it is only desired to restrict the clearance between the high voltage traces to the traces that must be considered safe. It is allowed for one high voltage trace to be close to another high voltage trace, it is only the functional isolation requirement of \SI{3}{\milli\meter} that applies here. The output signal and the output ground can also be close to each other, since both are considered safe.

The high voltage traces were placed on the top layer of the PCB, while all signal traces were placed on the bottom layer. To aid the design process without the DRC, a workaround was used to ensure that that enough clearance was kept between the pads and the traces. The \SI{6}{\milli\meter} clearance was added to the package footprint as a graphical circle on a user layer in the EDA, as seen in \autoref{fig:relay_footprint}. This is not an enforced rule, but it helps during the manual design process.

\begin{figure}[h]
    \captionsetup{width=.5\linewidth}
    \centering
    \includegraphics[width=0.5\textwidth]{relay_footprint}
    \caption{Decorational circles were made on the relay footprint to mark the creepage and clearance distance required.}
    \label{fig:relay_footprint}
\end{figure}

The layout was printed in 1:1 scale to verify the layout in the same way as for the dummy load. This was especially important due to the critical positioning of the \SI{4}{\mm} banana connectors that will attach to the test equipment.

When the PCB was delivered, it was visually inspected before assembling. Some modifications were required to fulfill the clearance criteria, these were made using a rotary multitool to machine away the undesired part of the traces.

No compensation of the attenuators were made during the work of this thesis, since this requires more time.

%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Measurements}
Since the relay card will be used for measuring pulses with short rise times, it is of importance to know that it does not distort the signal. It is desired to measure the magnitude response in the frequency domain, as well as the test pulse in time domain.

To measure the magnitude response, an $S_{21}$ measurement was performed using the ZVL network analyzer. A fixture was made to mimic the front panel of the CNA~200 to allow for a representative connection of the relay card. The setup can be seen in \autoref{fig:network_analyzing}. This setup proved to be unstable at first, as moving the coaxial wires and the grounding wire greatly affected the results for the higher frequencies. Because of the unstable results early in the measuring process, a modification was made to shorten the ground connection by attaching a braid as close to the attenuator grounds as possible and then grounding it directly to the fixture case, as depicted in \autoref{fig:ground_braid}. All subsequent measurements were performed with this modification.

\begin{figure}
	\centering
	\begin{subfigure}[t]{0.48\textwidth}
	    \includegraphics[width=\textwidth]{network_analyzing}
	    \caption{The network analyzer sends its signal into the attenuator through the metallic test rig and receives it back through the BNC outlet of the attenuator.}
	    \label{fig:network_analyzing}
	\end{subfigure}
	\begin{subfigure}[t]{0.48\textwidth}
    	\includegraphics[width=\textwidth]{ground_braid}
	    \caption{The modified grounding path.}
	    \label{fig:ground_braid}
	\end{subfigure}
	\caption{The test setups for frequency measurements of the attenuators.}
   	\label{fig:dummy-load-pcb-freq}
\end{figure}

The signal was measured for each output terminal through each of the attenuators to get the magnitude response for the intended use, \autoref{fig:relay_box_other_open} shows this for the + terminal. To see how well the design suppresses unconnected signals, the magnitude response was also measured when the signal was disconnected completely, i.e. all the relays in the fixture were opened as depicted in \autoref{fig:relay_box_all_open}. In addition to this, the magnitude response was also measured with all but the relays on the current terminal closed, seen in \autoref{fig:relay_box_other_closed}, to see if there was any overhearing on the circuit board from the other terminals and the traces after the relays. The results were saved both as an image and as raw data in the form of complex numbers in a CSV\nd{}file to allow for further analysis and plotting.


\begin{figure}
	\centering
	\begin{subfigure}[t]{0.4\textwidth}
		\includegraphics[width=\textwidth]{relay_measurement}
		\caption{The relay measured with coaxial wires.}
		\label{fig:relay-setup}
	\end{subfigure}
	\begin{subfigure}[t]{0.4\textwidth}
		\includegraphics[width=\textwidth]{relay_card_measurement_time}
		\caption{The time measurement setup. Both the commercial and the constructed attenuators were measured in this setup.}
		\label{fig:relay_card_measurement_time}
	\end{subfigure}
	\caption{The test setups for frequency and time measurements of the attenuators.}
   	\label{fig:dummy-load-pcb-time}
\end{figure}

A single relay was also measured using the network analyzer to get a perception of its high frequency properties. The setup was made by soldering coaxial cable directly to the relay, with as short connecting wires as possible to prevent any influence on the result from the wires. The setup can be seen in \autoref{fig:relay-setup}.

To measure the test pulses through the attenuators, the switching fixture was connected to the CNA~200 and the pulses were measured on the intended connectors using an oscilloscope, as seen in \autoref{fig:relay_card_measurement_time}. The results were saved both as an image and as data points in a CSV\nd{}file, for further analysis.

For comparison, the commercial attenuators were also measured in frequency domain with the ZVL and in time domain using the oscilloscope.


\begin{figure}
	\centering
	\begin{subfigure}[t]{0.3\textwidth}
		\includegraphics[width=\textwidth]{relay_box_other_open}
		\caption{The intended signal through the attenuator.}
		\label{fig:relay_box_other_open}
	\end{subfigure}\hfill
	\begin{subfigure}[t]{0.3\textwidth}
		\includegraphics[width=\textwidth]{relay_box_all_open}
		\caption{The isolation of the signal from the incoming terminals to the output of the attenuator.}
		\label{fig:relay_box_all_open}
	\end{subfigure}\hfill
	\begin{subfigure}[t]{0.3\textwidth}
		\includegraphics[width=\textwidth]{relay_box_other_closed}
		\caption{The isolation of the signal from all other signal paths connected to the output of the attenuator.}
		\label{fig:relay_box_other_closed}
	\end{subfigure}
	\caption{The different scenarios that were measured in frequency domain for the $+$ terminal to the \SI{50}{\ohm} attenuator. Corresponding measurements were made for the $-$ and the PE terminal as well as for the \SI{1000}{\ohm} attenuator.}
\end{figure}

