\documentclass{article}
\usepackage{graphicx} % Required for inserting images
\usepackage{amsmath}
\usepackage{matlab-prettifier}
\usepackage{float}
\usepackage[paperheight=11in,
   paperwidth=8.5in,
   top=0.5in,
   bottom=.5in,
   left=.5in,
   right=.5in]{geometry}

\title{EENG 577 M5 Assignmnet 1: PM Generator}
\author{E. Hildenbrandt \\ D. Davis  \\ J. Brownlee}
\date{14 February 2025}
% \twocolumn % Use this to make it 2 columns. However it might break the figures unless we manually resize them.
% let's do this on the next assignment
% sounds like a solid plan 
\begin{document}
\maketitle 
%------------------------------------------------------------------------------------------
\section*{Permanent Magnet Generator}
%------------------------------------------------------------------------------------------
\subsection*{Part 1.0)}
The machine cross-section consist of 6 permanent magnets making up the poles. The machine is radial, meaning that the magnets are arranged radially around the rotor. The schematic shows the a, b, and, c phases of the Y-connected armature. The damping bars are illustrated as the shorted windings kd and kq. The shorted windings sd and sq represent the shorted collar which also acts as a damping circuit. In Figure 1a, for simplicity, the stator windings are drawn as one coil, but in the actual machine they would be many coils arranged sinusoidally with peaks at the location drawn \cite{bib1}. Here we assume a 2-pole rotor for the schematic in Figure \ref{machine}b.
\begin{figure}[H]\label{machine}
    \centering
    \includegraphics[width=.49\linewidth]{CrossSection.png}
    \includegraphics[width=.49\linewidth]{Windings.png}
    \caption{a) Machine Cross-Section. b) Machine Axes Schematic Diagram [2] }
    \label{machine}
\end{figure}

%------------------------------------------------------------------------------------------
The state space model for a 6 pole 3 phase permanent magnet type synchronous machine is given below in the general form $\dot{X} = AX + BU$. The model neglects the effects from the damper bars, and the permanent magnetic is replaced with an equivalent field winding coil around the rotor with constant field current. This introduces a no-load phase to neutral back electromotive force vector on the armature phase winding with components $e_a, e_b,$ and $e_c$ \cite{bib2}. The field winding current is constant and thus not considered as one of the state variables in (\ref{ss model}) \cite{bib3}. We can calculate the values for A and B in given the resistance, self, and mutual inductance of the stator windings which results with values in (\ref{ss vars}).
\begin{align}\label{ss model}
\begin{bmatrix}
    \boldsymbol{\dot{i_a}} \\
    \boldsymbol{\dot{i_b}} \\
    \boldsymbol{\dot{i_c}}
\end{bmatrix}  =
-\begin{bmatrix}
    L_{sa} & L_{ma} & L_{ma} \\
    L_{ma} & L_{sa} & L_{ma} \\
    L_{ma} & L_{ma} & L_{sa}
\end{bmatrix}^{-1} \cdot
\begin{bmatrix}
    R_s & 0 & 0 \\
    0 & R_s & 0 \\
    0 & 0 & R_s
\end{bmatrix}\cdot
\begin{bmatrix}
    i_a \\
    i_b \\
    i_c
\end{bmatrix} +
\begin{bmatrix}
    L_{sa} & L_{ma} & L_{ma} \\
    L_{ma} & L_{sa} & L_{ma} \\
    L_{ma} & L_{ma} & L_{sa}
\end{bmatrix}^{-1}\cdot
\begin{bmatrix}
    v_a - E_mcos(\theta - 0.46) \\
    v_b - E_mcos(\theta - 0.46 -  2\pi/3) \\
    v_c - E_mcos(\theta - 0.46 - 4\pi/3)
\end{bmatrix}
\end{align}
\begin{align*}
    & A = -L^{-1}\cdot R && B = L^{-1}
\end{align*}
\begin{align}\label{ss vars}
    & A = 
    \begin{bmatrix}
        -63.827 &	5.8025 &	5.8025 \\
        5.8025 &	-63.827 &	5.8025 \\
        5.8025 &	5.8025 &	-63.827
    \end{bmatrix}
    && B = 
    \begin{bmatrix}
        6.7901 &	-0.6172840 &	-0.6172840 \\
        -0.6172840 &	6.7901 &	-0.6172840 \\
        -0.6172840 &	-0.6172840 &	6.7901
    \end{bmatrix} \times 10^{3}
\end{align}
%---------------------------------------------------------------------------------------
\subsection*{Part 2.0)}
We developed a state-space model in Simulink to show the transient and steady state values for the armature windings and output torque shown in Figure \ref{sim01}.  The mechanical frequency is assumed to be held constant by the prime mover and the rotor field permanent magnet has been replaced with an equivalent rotor field electromagnet winding of constant current \cite{bib2}. The terminal voltages are given as functions of the electrical angular position where $V_a = V_m\cos(\omega_et)$ and the internal generator voltage from the movement of the fictitious field winding is governed by $E_a = E_mcos(\omega_et - 0.46)$. The B and C phase windings are shifted by 120 and 240 degrees respectively, and we can substitute the electrical angular position for $\omega_et$ given the prime mover holds the speed of the machine constant. The appendix of this document contains Matlab functions used in the Simulink model for the armature winding voltages and the internal generator voltages as a function of $\theta_e$.

\begin{figure}[H]
    \begin{center}
    \includegraphics[width=7.5in]{simulink overall.PNG}
    \caption{Simulink Overall}
    \label{sim01}
    \end{center}
\end{figure}

The submodel calculates the machine torque from (\ref{T}) and (\ref{w}) where the internal generated voltage, phase winding currents, and electrical frequency are provided as input parameters shown in Figure \ref{sim02}. 

\begin{equation}\label{T}
    T = \frac{P_\mathrm{conv}}{\omega_m} = \frac{e_ai_a + e_bi_b + e_ci_c}{\omega_m}
\end{equation}
\begin{equation}\label{w}
    \omega_m = \frac{2}{P}\omega_\mathrm{electrical }
\end{equation}

\begin{figure}[H]
    \begin{center}
    \includegraphics[width=5in]{torque calc.PNG}
    \caption{Torque Calculation}
    \label{sim02}
    \end{center}
\end{figure}
Simulink also has a built in State-Space Model Solver in the form $\dot{x} = Ax + Bu$ and $y = Cx + Du$, where $x$ is $I_{abc}$: the state of the armature winding currents, and $u$ is the input: the voltage drop in the windings as shown by the forcing function shown in (\ref{forcing}). The block model internal parameters for A and B can be calculated from the winding resistance, self, and mutual inductance values discussed in Part 1 which gives values in (\ref{ss vars}). Values C and D are `diag([1,1,1])` and $\hat 0$ respectively to make the block output its state. We used this built-in model, shown in Figure \ref{sspace}, to help verify the results from our method above. 

\begin{equation}\label{forcing}
    \boldsymbol{V_{abc}} - \boldsymbol{E_{abc}} = \begin{bmatrix}
        v_a - E_m\cos(\theta_e - 0.46) \\
        v_b - E_m\cos(\theta_e - 0.46 - 2\pi/3 \\
        v_c - E_m\cos(\theta_e - 0.46 - 4\pi/3)
    \end{bmatrix}
\end{equation}
    \begin{figure}[H]
    \begin{center}
    \includegraphics[width=5in]{StateSpaceModel.png}
    \caption{Simulink Model Using State Space Block}
    \label{sspace}
    \end{center}
\end{figure}
%---------------------------------------------------------------------------------------
\subsection*{2.1 PM Motor Operation)}
The prime mover applies power to the rotor and maintains constant angular mechanical frequency. At time t=0, the terminal voltage are connected to an arbitrary load with phase to neutral voltage, $\boldsymbol{V_{abc}}$. The movement of the rotor generates an internal voltage in the synchronous motor with per phase currents on the armature winding shown in Figure \ref{motor}a. We can calculate the induced torque from the converted power using (\ref{T}) and the synchronous machine generates steady-state torque of 38.7 N/m shown in Figure \ref{motor}b. Neglecting stray, friction, and core losses in the machine, the applied torque from the prime mover would be equal to the induced torque plus the ohmic losses in the armature windings. The prime mover would have to apply a torque of 40 N/m such that the induced toque plus the copper losses maintains a terminal voltage of $\boldsymbol{V_{abc}}$.
\begin{figure}[H]
    \centering
    \includegraphics[width=.49\linewidth]{currents_split_motor.png}
    \includegraphics[width=.49\linewidth]{torque motor.png}
    \caption{a) Armature Winding Currents b) Induced Torque }
    \label{motor}
\end{figure}
In Figure \ref{motor}a we can see the spikes in current due to the voltage being applied at time t=0. The mismatch between them is due to the rotor position when they are energized. This mismatch also causes oscillations in the torque developed. As the transients die out we see the currents balancing out and the system reaching steady state at around 0.04 seconds. In Figure \ref{motor}b we can see rapid oscillation in torque before reaching steady state. This oscillation is due to the rotor attempting to align with the magnetic fields of the stator.
%---------------------------------------------------------------------------------------
\subsection*{2.2 PM Generator Operation)}
In this section, the synchronous machine has the terminal voltage shorted to neutral at time t=0. We assume the prime mover is holding the mechanical frequency of the rotor constant. When the terminals are shorted to neutral, the synchronous machine is not connected to a load and the induced torque is only slightly negative due to the copper losses in the armature phase windings shown in Figure \ref{generator}b. If the winding losses were ignored, the output toque would be zero. The armature winding currents, $\boldsymbol{I_{abc}}$, in Figure \ref{generator}a are greater than when the windings are connected to a load shown in Figure \ref{motor}a and we would expect a rise in temperature of the synchronous machine while operating in this mode.
\begin{figure}[H]
    \centering
    \includegraphics[width=.49\linewidth]{currents_split_generator.png}
    \includegraphics[width=.49\linewidth]{torque generator.png}
    \caption{a) Armature Winding Currents b) Induced Torque }
    \label{generator}
\end{figure}
In Figure \ref{generator}a we see that at time t=0, when the phases are shorted, there is a spike in phase currents due to high transient and sub-transient effects in the stator windings. The sub-transient effects cause the initial spike but decay very quickly. The transient effects decay slower until the system reaches steady state. In Figure \ref{generator}b we see the effect the high current has on torque when the mechanical speed is held constant. When the current spikes due to the phases shorting, torque must increase to maintain the mechanical speed of the system. 
%---------------------------------------------------------------------------------------
\subsection*{2.3 Contributions}
\begin{table}[H]
    \centering
    % add what you feel the contributions are .. rows and columns both add to 100 .. kinda like a little game of sodoku
    \begin{tabular}{c|c|c|c|c}
        & Tasks                          & Eric Hildenbrandt & Devon Davis & Joseph Brownlee \\
        & Formulations \& Calculations   & 30  \% & 40  \% & 30 \% \\
        & MATLAB/Simulink Coding         & 30  \% & 30  \% & 40 \% \\
        & Report Writing                 & 40  \% & 30  \% & 30 \% \\
        & Overall \% Contribution/Member & 100 \% & 100 \% & 100 \% 
    \end{tabular}
\end{table}
%---------------------------------------------------------------------------------------
\begin{thebibliography}{00}
    \bibitem[1]{bib1} Stephen J. Chapman. (2005). Electric Machinery Fundamentals. McGraw-Hill.
    
    \bibitem[2]{bib2} A.A. Arkadan EENG577 Class Notes, Colorado School of Mines.  
    
    \bibitem[3]{bib3} A.A. Arkadan, and N.A. Demerdash, "Modeling of Transients in Permanent Magnet Generators with Multiple Damping Circuits Using the Natural abc Frame of Reference," IEEE Trans. On Energy Conversion, Vol. 3, No. 3, pp. 722-731, September 1988.
    
    %\bibitem[4]{bib4} A.A. Arkadan, N.A. Demerdash, J.G. Vaidya, and M.J. Shah, "Impact of Load on Winding Inductances of Permanent Magnet Generators with Multiple Damping Circuits Using Energy Perturbation," IEEE Trans. On Energy Conversion, Vol. 3, No. 4, pp. 880-889, December 1988.
    
    %\bibitem[5]{bib5} A.A. Arkadan, T.M. Hijazi, and N.A. Dmerdash, "Computer-Aided Modeling of a Rectified DC Load-Permanent Magnet Generator System with Multiple Damper Winding in the Natural abc Frame of Reference," IEEE Trans. On Energy Conversion, Vol. 4, No. 3, pp. 519-525, September, 1989.
\end{thebibliography}
%---------------------------------------------------------------------------------------
\newpage
\subsection*{Appendix: Matlab}
\input{appendix}
\end{document}
