## Problem 1

### Coenergy Calculation

The mechanical rotor position $\theta_{rm}$ is such that $\theta_r = \theta_{rm}$, implying that the number of poles is $P = 2$. Coenergy will be calculated in steps using a sequential ramping process. Before any steps can be completed, the contribution to coenergy of fixing the mechanical system should be documented (zero unless the mechanical system can store energy).

$$$W_{c,0} = 0$$$

The first step in the coenergy calculation will ramp dummy variable $i_1'$ from $0$ to its final value of $i_1$ while dummy variable $i_2' = 0$ is held at its initial value. Substitute $i_m = i_1 + 2i_2$ as needed.

\begin{align} W_{c,1} &= \left.\int_{i_1' = 0}^{i_1} \lambda_1\left(i_1', i_2', \theta_r\right) \, di_1'\right|_{i_2' = 0} + \left.\int_{i_1' = 0}^{i_1} \lambda_2\left(i_1', i_2', \theta_r\right) \, di_1'\right|_{i_2' = 0} \\ W_{c,1} &= \int_{i_1' = 0}^{i_1} \left[5i_1' + 10\left(1 - \frac{1}{1 + i_1' + \cancelto{0}{2i_2'}}\right) \cos(\theta_r)\right] \, di_1' + \int_{i_1' = 0}^{i_1} \left[\cancelto{0}{i_2'} + 20\left(1 - \frac{1}{1 + i_1' + \cancelto{0}{2i_2'}}\right) \cos(\theta_r)\right] \, di_1' \\ W_{c,1} &= \frac{5}{2} i_1^2 + 10\left(i_1 - \ln|1 + i_1| + \cancelto{0}{\ln|1 + 0|}\right) \cos(\theta_r) + 20\left(i_1 - \ln|1 + i_1| + \cancelto{0}{\ln|1 + 0|}\right) \cos(\theta_r) \\ W_{c,1} &= \frac{5}{2} i_1^2 + 10\left(i_1 - \ln|1 + i_1|\right) \cos(\theta_r) + 20\left(i_1 - \ln|1 + i_1|\right) \cos(\theta_r) \end{align}

The second step in the coenergy calculation will ramp dummy variable $i_2'$ from $0$ to its final value of $i_2$ while dummy variable $i_1' = i_1$ is held at its final value. Substitute $i_m = i_1 + 2i_2$ as needed.

\begin{align} W_{c,2} &= \left.\int_{i_2' = 0}^{i_2} \lambda_1\left(i_1', i_2', \theta_r\right) \, di_2'\right|_{i_1' = i_1} + \left.\int_{i_2' = 0}^{i_2} \lambda_2\left(i_1', i_2', \theta_r\right) \, di_2'\right|_{i_1' = i_1} \\ W_{c,2} &= \int_{i_2' = 0}^{i_2} \left[5i_1 + 10\left(1 - \frac{1}{1 + i_1 + 2i_2'}\right) \cos(\theta_r)\right] \, di_2' + \int_{i_2' = 0}^{i_2} \left[i_2' + 20\left(1 - \frac{1}{1 + i_1 + 2i_2'}\right) \cos(\theta_r)\right] \, di_2' \\ W_{c,2} &= 5 i_1 i_2 + 10\left(i_2 - \ln|1 + i_1 + 2i_2| + \ln|1 + i_1|\right) \cos(\theta_r) + \frac{1}{2} i_2^2 + 20\left(i_2 - \ln|1 + i_1 + 2i_2| + \ln|1 + i_1|\right) \cos(\theta_r) \end{align}

The final step is the sum all the individual coenergy contributions $W_c(i_1, i_2, \theta_r) = \sum_{k = 0}^{2} W_{c,k}(i_1, i_2, \theta_r)$. Recall that $i_1, i_2 \geq 0$ to simplify the absolute value signs.

\begin{align} W_c(i_1, i_2, \theta_r) &= W_{c,0} + W_{c,1} + W_{c,2} \\ W_c(i_1, i_2, \theta_r) &= \begin{split} &{}0 + \frac{5}{2} i_1^2 + 10\left(i_1 - \cancel{\ln|1 + i_1|}\right) \cos(\theta_r) + 20\left(i_1 - \cancel{\ln|1 + i_1|}\right) \cos(\theta_r) \\ &{}+ 5 i_1 i_2 + 10\left(i_2 - \ln|1 + i_1 + 2i_2| + \cancel{\ln|1 + i_1|}\right) \cos(\theta_r) \\ &{}+ \frac{1}{2} i_2^2 + 20\left(i_2 - \ln|1 + i_1 + 2i_2| + \cancel{\ln|1 + i_1|}\right) \cos(\theta_r) \end{split} \\ W_c(i_1, i_2, \theta_r) &= \frac{5}{2} i_1^2 + 5 i_1 i_2 + \frac{1}{2} i_2^2 + 10\left[i_1 + i_2 - \ln(1 + i_1 + 2i_2)\right] \cos(\theta_r) + 20\left[i_1 + i_2 - \ln(1 + i_1 + 2i_2)\right] \cos(\theta_r) \end{align}

The last two terms have the same variable dependence, so the coefficients may be added.

$$$\boxed{W_c(i_1, i_2, \theta_r) = \frac{5}{2} i_1^2 + 5 i_1 i_2 + \frac{1}{2} i_2^2 + 30\cos(\theta_r)\left[i_1 + i_2 - \ln(1 + i_1 + 2i_2)\right]}$$$

### Electromechanical Torque Calculation

Electromechanical torque is just the partial derivative of coenergy with respect to mechanical rotor position.

\begin{align} T_e &= \frac{\partial W_c(i_1, i_2, \theta_r)}{\partial \cancelto{\theta_r}{\theta_{rm}}} \\ T_e &= 0 + 0 + 0 - 30\sin(\theta_r)\left[i_1 + i_2 - \ln(1 + i_1 + 2i_2)\right] \end{align}

Thus, the electromechanical torque equation is obtained for this device.

$$$\boxed{T_e = -30\sin(\theta_r)\left[i_1 + i_2 - \ln(1 + i_1 + 2i_2)\right]}$$$