Commit 341966b4 authored by Viviane's avatar Viviane
Browse files

continuation of doc. finished RXLine model.

parent cb1d265c
......@@ -95,7 +95,7 @@ k\\[6pt]
\begin{figure}[h]
\centering
\includegraphics[scale=0.8]{img/Resistor.png}
\includegraphics[scale=0.6]{img/Resistor.png}
\caption{Resistor between nodes j and k}
\label{fig:Resistor}
\end{figure}
......@@ -128,12 +128,12 @@ k\\
\subsection{Voltage Source and Modified Nodal Analysis} \label{IdealVoltageSource}
An ideal voltage source cannot be included in nodal analysis. In this case, the modified nodal analysis approach is used. The voltage source is represented by adding a new equation to the problem and adding the current trough the voltage source $i_{jk}$ as unknown.
For a voltage source with positive terminal connected to node j and negative terminal connected to node k. The added equation is the following:
For a voltage source with positive terminal connected to node j and negative terminal connected to node k, the added equation is the following:
\begin{equation}
e_j - e_k = V
\end{equation}
Moreover, the current trough the voltage source $i_{jk}$ is added to the equation of node j and subtracted to the equation of node k.
Therefore, the conductance matrix $G$ and the vector $A$ are stamped as following.
Moreover, the new unknown $i_{jk}$ is added to the equation of node j and subtracted to the equation of node k.
Therefore, the conductance matrix $G$ and the vector $A$ are stamped as following:
\begin{align}
& \begin{matrix}
......@@ -182,8 +182,9 @@ Therefore, the conductance matrix $G$ and the vector $A$ are stamped as followin
\end{figure}
\subsection{Other components}
Components such as capacitor, inductor and real voltage source can be represented by equivalent circuits, composed by current source and resistance. That means that the matrix stamp of these components is made by stamping an equivalent current source and resistance on the respective matrices.
The method used to represent capacitor and inductor is detailed in \ref{ResistiveCompanion}.
Components such as capacitor, inductor and real voltage source (ideal voltage source in series with a resistance) can be represented by equivalent circuits, composed by a current source and a resistance. That means that the matrix stamp of these components is made by stamping a current source and a resistance on the matrix equation.
The method used to represent capacitors and inductors is detailed in section \ref{ResistiveCompanion}. The model used for a real voltage source is presented in subsection \ref{sub:RealVoltageSource}.
\section{Resistive Companion Method} \label{ResistiveCompanion}
......@@ -212,6 +213,7 @@ In dynamic phasors the inductor equations become:
\end{equation}
A numerical solution for these equations can only be obtained at a finite number of points, therefore a discretization of time is required.
For modeling inductors and capacitors, resistive companion method is used. Each dynamic component is transformed into a DC equivalent circuit, which represent one iteration of an integration method.
There are different integration methods available to solve the integration problem. The method chosen in this work is the trapezoidal rule.
......@@ -227,7 +229,7 @@ With the trapezoidal rule $y(k+1)$ is calculated as following:
y(k+1)=y(k)+ \frac{x(k)+x(k+1)}{2} \cdot \Delta t
\end{equation}
Applying trapezoidal rule for the inductor equation:
Applying trapezoidal rule for the inductor equation in dynamic phasor:
\begin{equation}
i_L(k+1) = i_L(k) + \frac{\Delta t}{2} \left[ \frac{1}{L} \cdot v_L(k+1) - j \omega \cdot i_L(k+1) + \frac{1}{L} \cdot v(k) - j \omega \cdot i_L(k) \right]
\end{equation}
......@@ -246,7 +248,15 @@ The equation can be rewritten as
i_L(k+1) &= \frac{1-b^2-j2b}{1+b^2}i_L(k) + \frac{a-jab}{1+b^2} v_L(k) + \frac{a-jab}{1+b^2} v_L(k+1)
\end{align}
The equation shows that the inductor current at the time k+1 has a part which depends on the voltage and current at the time k and a part which depends on the actual voltage. Therefore, the inductor can be substituted with a resistance $R_L$ in parallel with a current source $A_L(k)$. The value of $R_L$ is constant for a constant frequency and constant time step. The value of $A_L(k)$ depends on the knowledge of the previous step and has to be upgraded for each iteration.
The equation shows that the inductor current at the step k+1 has a part which depends on the voltage and current at the step k and a part which depends on the actual voltage. Therefore, the inductor can be substituted with a resistance $R_L$ in parallel with a current source $A_L(k)$. The value of $R_L$ is constant for a constant frequency and constant time step. The value of $A_L(k)$ depends on the knowledge of the previous step and has to be updated for each iteration.
\begin{figure}[ht]
\centering
\includegraphics[scale=0.6]{img/Inductor.png}
\caption{Equivalent circuit of an Inductor}
\label{fig:Inductor}
\end{figure}
\begin{equation} \label{eq:AL}
A_L(k) = i_L(k) \cdot \frac{1-b^2-2bj}{1+b^2} + v_L(k) \cdot \frac{a-jab}{1+b^2}
......@@ -299,13 +309,6 @@ k\\[6pt]
\end{split}
\end{align}
\begin{figure}[ht]
\centering
\includegraphics[scale=0.6]{img/Inductor.png}
\caption{Equivalent circuit of an Inductor}
\label{fig:Inductor}
\end{figure}
\subsection{Capacitor} \label{ResistiveCompanionCapacitor}
The same approach used for the inductor is used now for the capacitor.
......@@ -343,7 +346,7 @@ Defining:
\begin{align}
v_C(k+1) &= v_C(k) + a \cdot i_C(k+1) - j b \cdot v_C(k+1) + a \cdot i_C(k) - j b \cdot v_C(k) \\
i_C(k+1) &= -i_C(k) + \frac{1+jb}{a} \cdot v_C(k+1) - \frac{1-jb}{a} \cdot v_C(k)
i_C(k+1) &= \frac{1+jb}{a} \cdot v_C(k+1) - \frac{1-jb}{a} \cdot v_C(k) -i_C(k)
\end{align}
The capacitor in calculation step k+1 can also be substituted with a resistance $R_C$ in parallel with a current source $A_C(k)$.The value of $R_C$ is constant for a constant frequency and constant time step. The value of $A_C(k)$ depends only on the previous time step and changes for each iteration.
......
......@@ -5,15 +5,15 @@
Every component is a part of the class "BaseComponent", which has as variables the name of the component and the nodes on which they are connected. Furthermore, four functions are defined in "BaseComponent":
\begin{itemize}
\item init: This function initializes the values of the component variables. For instance, initial values of current and voltage of inductors and capacitors.
\item "init": This function initializes the values of the component variables. For instance, initial values of current and voltage of inductors and capacitors.
\item applySystemMatrixStamp: This function stamps the conductance matrix $G$.
\item "applySystemMatrixStamp": This function stamps the conductance matrix $G$.
\item applyRightSideMatrixStamp: This function stamps the vector $A$.
\item "applyRightSideMatrixStamp": This function stamps the vector $A$.
step: This function upgrade the values of the vector $A$ in each calculation step.
\item "step": This function updates the values of the vector $A$ in each calculation step.
\item postStep: This function upgrades the variables which depends on the solution of the equation $e=G^{-1} \cdot A$.
\item "postStep": This function updates the variables which depends on the solution of the equation $e=G^{-1} \cdot A$.
\end{itemize}
\subsection{Linear Resistor}
......@@ -24,14 +24,15 @@ The linear resistor has the following parameters defined by the user:
\item dest: Second node where the resistor is connected
\item resistance: Resistance given in Ohms
\end{itemize}
The program calculates the conductance $G = \frac{1}{R}$ and apply the matrix Stamp as in \ref{ResistorMatrixStamp} with the function "applySystemMatrixStamp".
The function "applySystemMatrixStamp" stamps the resistance to the conductance matrix $G$ as in section \ref{ResistorMatrixStamp} considering $j=src$ and $k=dest$.
\subsection{Inductor}
The inductor model is developed based on the Resistive Companion Method presented in \ref{ResistiveCompanion}.
The inductor model is developed based on the Resistive Companion Method presented in section \ref{ResistiveCompanion}.
For a constant frequency and fixed time step, the value of $R_L$ will be constant. Therefore the matrix stamp of the conductance matrix will me made just once. By the other hand, the value of $A_L$ needs to be updated each time step, since it depends on the voltage and current of the inductor at the previous step.
For a constant frequency and fixed time step, the value of $R_L$ will be constant. Therefore, the matrix stamp of the conductance matrix will be made just once. By the other hand, the value of $A_L$ needs to be updated each step, since it depends on the voltage and current of the inductor at the previous step.
The inductor has the following parameters defined by the user:
......@@ -42,7 +43,7 @@ The inductor has the following parameters defined by the user:
\item inductance: Inductance given in H
\end{itemize}
The function "applySystemMatrixStamp" will stamp $R_L$ to the conductance matrix $G$ as in \ref{ResistiveCompanionInductor}
The function "applySystemMatrixStamp" will stamp $R_L$ to the conductance matrix $G$ as in subsection, considering $j=src$ and $k=dest$. \ref{ResistiveCompanionInductor}
The function "init" defines as zero the initial values of current and voltage of the inductor as well the initial value of the equivalent current source $A_L$.
......@@ -52,7 +53,7 @@ i_L(0)&=0A \\
A_L(0)&=0A \\
\end{align*}
The function "step" is called each time step. It recalculates the value of the equivalent current source $A_L$ using equation \ref{eq:AL} and apply the stamp of the vector $A$ as in \ref{ResistiveCompanionInductor}, where $j=src$ and $k=dest$.
The function "step" is called each step. It recalculates the value of the equivalent current source $A_L(k)$, using equation \ref{eq:AL} and apply the stamp of the vector $A$ as in subsection \ref{ResistiveCompanionInductor}, considering $j=src$ and $k=dest$.
The function "poststep" will calculate the inductor voltage $v_L$, based on the solution of the vector $e$ at the actual step (k+1) and the inductor current, based on the calculated $v_L$ and on the value of $A_L$ from the previous step (k).
......@@ -78,7 +79,7 @@ It has the following parameters defined by the user:
\item capacitance: Capacitance given in F
\end{itemize}
The function "applySystemMatrixStamp" will stamp $R_C$ to the conductance matrix $G$ as in \ref{ResistiveCompanionCapacitor}.
The function "applySystemMatrixStamp" will stamp $R_C$ to the conductance matrix $G$ as in subsection \ref{ResistiveCompanionCapacitor}, considering $j=src$ and $k=dest$.
The function "init" defines as zero the initial values of current and voltage of the capacitor as well the initial value of the equivalent current source $A_C$.
......@@ -88,20 +89,20 @@ i_C(0)&=0A \\
A_C(0)&=0A \\
\end{align*}
The function "step" is called each time step. It recalculates the value of the equivalent current source $A_C$ as in equation \ref{eq:AC} and stamps its value to the vector $A$ as in \ref{ResistiveCompanionCapacitor}.
The function "step" is called each time step. It recalculates the value of the equivalent current source $A_C(k)$ as in equation \ref{eq:AC} and stamps its value to the vector $A$ as in subsection \ref{ResistiveCompanionCapacitor}, considering $j=src$ and $k=dest$.
The function "poststep" will calculate the capacitor voltage $v_C$ and current $i_C$, based on the solution of $e$ at the actual step.
The function "poststep" will calculate the capacitor voltage $v_C$, based on the solution of $e$ at the actual step (k+1) and the capacitor current, based on the calculated $v_C(k+1)$ and on the value of $A_C$ from the previous step (k).
\begin{equation}
v_C(k+1) = e_{src}(k+1) - e_{dest}(k+1)
\end{equation}
\begin{equation}
i_C(k+1) = \frac{v_C(k+1)}{R_C} - A_L(k)
i_C(k+1) = \frac{v_C(k+1)}{R_C} - A_C(k)
\end{equation}
\subsection{Real Voltage Source}
\subsection{Real Voltage Source} \label{sub:RealVoltageSource}
A real voltage source can be represented as a voltage source $V$ in series with a resistance $R$, with
......@@ -118,14 +119,14 @@ As nodal analysis does not support voltage source, it is transformed to a curren
\begin{figure}[ht]
\centering
\includegraphics[scale=0.5]{img/VoltageSourceRes.png}
\includegraphics[scale=0.6]{img/RealVoltageSource.png}
\caption{Real Voltage Source}
\label{fig:Real_Voltage_Source}
\end{figure}
The matrix stamp for a real voltage source is therefore as follow.
The matrix stamp for a real voltage source is therefore as in equation \ref{eq:MatrixStampRealVS}.
\begin{align}
\begin{align} \label{eq:MatrixStampRealVS}
\begin{split}
&
\begin{matrix}
......@@ -170,20 +171,20 @@ The following parameters are defined by the user for the real voltage source:
\begin{itemize}
\item name: Name of the component
\item src: Node connected to voltage source positive terminal
\item dest: Node connected to voltage source negative terminal
\item src: Node connected to voltage source positive terminal (j)
\item dest: Node connected to voltage source negative terminal (k)
\item voltage: Voltage in V
\item phase: Phase shift in degrees
\item resistance: Series resistance in ohms
\end{itemize}
The function "applySystemMatrixStamp" will stamp the resistance $R$ at the conductance matrix $G$.
The function "applySystemMatrixStamp" will stamp the resistance at the conductance matrix $G$.
The function "applyRightSideVectorStamp" will stamp the equivalent current source $I=\frac{V}{R}$ to the vector $A$.
The function step will repeat the stamp of the vector $A$ each time step.
The function "step" will repeat the stamp of the vector $A$ each time step.
\subsection{Ideal Voltage Source}
The model of the ideal voltage source uses the modified nodal analysis as presented in \ref{IdealVoltageSource}.
The model of the ideal voltage source uses the modified nodal analysis as presented in subsection \ref{IdealVoltageSource}.
The following parameters are defined by the user:
\begin{itemize}
......@@ -195,7 +196,7 @@ The following parameters are defined by the user:
\item num: Number of the voltage source (the voltage sources have to be numbered in sequence)
\end{itemize}
The function "applyMatrixStamp" will stamp the conductance matrix according to \ref{IdealVoltageSource}. The additional unknown $i_{jk}$ of the voltage source number 1 (with variable num=1) will be added in the first line after the last node voltage and so on. Therefore, for a circuit with n voltage sources and m nodes, the vector of unknown variable $e$ and the vector $A$ will have the size $m+n$. The conductance matrix G will have the size $(m+n)X(m+n)$.
The function "applyMatrixStamp" will stamp the conductance matrix according to subsection \ref{IdealVoltageSource}. The additional unknown $i_{jk}$ of the voltage source number 1 (with variable num=1) will be added in the first line after the last node voltage and so on. Therefore, for a circuit with n voltage sources and m nodes, the vector of unknown variable $e$ and the vector $A$ will have the size $m+n$. The conductance matrix G will have the size $(m+n)X(m+n)$.
\begin{equation}
e=
......@@ -224,18 +225,11 @@ For the current source, the following parameters are defined by the user:
\item phase: Phase shift in degrees
\end{itemize}
The function "applyRightSideVectorStamp" will stamp the current at the vector $A$ as in section \ref{CurrentSourceMatrixStamp}.
The function "applyRightSideVectorStamp" will stamp the current at the vector $A$ as in subsection \ref{CurrentSourceMatrixStamp}.
\subsection{RX Line}
The RX Line model corresponds to a resistance in series with a inductance. The inductance is represented using resistive companion and therefore replaced by a resitance in parallel to a current source.
\begin{figure}[ht]
\centering
\includegraphics[scale=0.5]{img/RxLine.png}
\caption{RX Line model}
\label{fig:RxLine}
\end{figure}
The user can define the RX Line in two ways. The first one is with the following parameters:
\begin{itemize}
......@@ -247,9 +241,60 @@ The user can define the RX Line in two ways. The first one is with the following
\item inductance: Inductance in H
\end{itemize}
In this case, the function "applySystemMatrixStamp" will stamp the resistances $R$ between node1 and node3 and $R_L$ between node3 and node2 to the conductance matrix $G$. The function step will recalculate the value of $A_L$ as in equation \ref{eq:AL} and stamp it to the vector $A$. The function post step will update the values of inductor current and voltage using equations \ref{eq:inductorCurrent} and \ref{eq:inductorVoltage}.
\begin{figure}[h]
\centering
\includegraphics[scale=0.5]{img/RxLine.png}
\caption{RX Line model}
\label{fig:RxLine}
\end{figure}
In this case, the function "applySystemMatrixStamp" will stamp the resistances $R$ between node1 and node3 and $R_L$ between node3 and node2 to the conductance matrix $G$. The function "step" will recalculate the value of $A_L$ as in equation \ref{eq:AL} and stamp it between node3 and node2 to the vector $A$. The function "poststep" will update the values of inductor current and voltage using equations \ref{eq:inductorCurrent} and \ref{eq:inductorVoltage}.
\begin{align}
\begin{split}
&
\begin{matrix}
& \cdots & node1 & node2 & node3 & \cdots
\end{matrix}\\[-6pt]
G \quad = \quad
\begin{matrix}
\vdots\\[8pt]
node1\\[8pt]
node2\\[8pt]
node3\\[8pt]
\vdots\\
\end{matrix}
&
\begin{bmatrix}
\quad & \quad & \\[8pt]
\quad & \quad \dfrac{1}{R} & \quad & \quad \dfrac{-1}{R} & \quad \\[8pt]
\quad & \quad & \quad \dfrac{1}{R_L} & \quad \dfrac{-1}{R_L} & \quad \\[8pt]
\quad & \quad \dfrac{-1}{R} & \quad \dfrac{-1}{R_L} & \dfrac{1}{R}+\dfrac{1}{R_L} & \quad\\[8pt]
\quad\\
\end{bmatrix}
\end{split}
\end{align}
\begin{align}
\begin{split}
A\quad = \quad
\begin{matrix}
\vdots\\[8pt]
node1\\[8pt]
node2\\[8pt]
node3\\[8pt]
\vdots\\
\end{matrix}
\begin{bmatrix}
\quad \\[8pt]
\quad \\[8pt]
A_L(k) \\[8pt]
-A_L(k) \\[8pt]
\quad
\end{bmatrix}
\end{split}
\end{align}
The second way of define the RXLine is defining only two nodes (node1 and node2).In this case, the following equivalent current is considered.
The second way of define the RX Line is defining only two nodes (node1 and node2). In this case, the equivalent circuit in figure \ref{fig:RxLine2} is considered.
\begin{figure}[ht]
\centering
......@@ -258,14 +303,74 @@ The second way of define the RXLine is defining only two nodes (node1 and node2)
\label{fig:RxLine2}
\end{figure}
The function "applySystemMatrixStamp" will stamp the resistance $R+R_L$ between node1 and node2 to the conductance matrix $G$.
\begin{align}
\begin{split}
&
\begin{matrix}
& \cdots & node1 & \quad node2 & \cdots
\end{matrix}\\[-5pt]
G \quad = \quad
\begin{matrix}
\vdots\\[6pt]
node1\\[6pt]
node2\\[6pt]
\vdots\\
\end{matrix}
&
\begin{bmatrix}
\quad & \quad & \\[6pt]
\quad & \dfrac{1}{R+R_L} & \dfrac{-1}{R+R_L} & \quad \\[6pt]
\quad & \dfrac{-1}{R+R_L} & \dfrac{1}{R+R_L} & \quad \\[6pt]
\quad & &
\end{bmatrix}
\end{split}
\end{align}
The function "step" will update the values of $A_L$ as in equation \ref{eq:AL} and $A_{Leq}(k)$. $A_{Leq}$ will be stamped to the vector $A$ as in equation \ref{eq:AleqStamp}.
\begin{equation}
A_{Leq}=A_L \cdot \frac{R_L}{R_L+R}
A_{Leq}(k)=A_L(k) \cdot \frac{R_L}{R_L+R}
\end{equation}
The function "applySystemMatrixStamp" will stamp the resistance $R+R_L$ between node1 and node2 to the conductance matrix $G$. The function step will update the values of $A_{Leq}$ according to the previous time step and stamp it to the vector $A$.
The function "poststep" will calculate the values of the line current and voltage and the voltage across the inductor.
\begin{align} \label{eq:AleqStamp}
\begin{split}
A\quad = \quad
\begin{matrix}
\vdots\\[8pt]
node1\\[8pt]
node2\\[8pt]
\vdots\\
\end{matrix}
\begin{bmatrix}
\quad \\[8pt]
-A_{Leq}(k) \\[8pt]
A_{Leq}(k) \\[8pt]
\quad
\end{bmatrix}
\end{split}
\end{align}
The function "poststep" will calculate the values of the line voltage and current and inductor voltage and current for the actual step (k+1).
\begin{equation}
v_{Line}(k+1) = v_{node1}(k+1) - v_{node2}(k+1)
\end{equation}
\begin{equation}
i_{Line}(k+1) = \frac{v_{Line}(k+1)}{R+R_L} + A_{Leq}
\end{equation}
\begin{equation}
v_L(k+1) = v_{Line}(k+1) - R \cdot i_{Line}(k+1)
\end{equation}
\begin{equation}
i_L(k+1) = i_{Line}(k+1)
\end{equation}
In both cases, the function init is setting every initial value to zero.
In both cases, the function "init" is setting every initial value to zero.
\section{Synchronous Machine}
......
......@@ -177,8 +177,8 @@ void RxLine::postStep(SystemModel& system) {
deltavr_ind = vposr - mResistance*mCurrRe - vnegr;
deltavi_ind = vposi - mResistance*mCurrIm - vnegi;
currr_ind = glr_ind*deltavr_ind - gli_ind*deltavi_ind + cureqr_ind;
curri_ind = gli_ind*deltavr_ind + glr_ind*deltavi_ind + cureqi_ind;
currr_ind = mCurrRe;
curri_ind = mCurrIm;
}
else{
......
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