Skip to content
Merged
18 changes: 12 additions & 6 deletions GridKit/Model/PhasorDynamics/Branch/BranchImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,16 +300,22 @@ namespace GridKit
{ return Ir1(); });
monitor_->set(Variable::ii1, [this]
{ return Ii1(); });
// monitor_->set(Variable::im1, [this] { return ?(); });
// monitor_->set(Variable::p1, [this] { return ?(); });
// monitor_->set(Variable::q1, [this] { return ?(); });
monitor_->set(Variable::im1, [this]
{ return std::sqrt(Ir1() * Ir1() + Ii1() * Ii1()); });
monitor_->set(Variable::p1, [this]
{ return Vr1() * Ir1() + Vi1() * Ii1(); });
monitor_->set(Variable::q1, [this]
{ return Vi1() * Ir1() - Vr1() * Ii1(); });
Comment thread
pelesh marked this conversation as resolved.
monitor_->set(Variable::ir2, [this]
{ return Ir2(); });
monitor_->set(Variable::ii2, [this]
{ return Ii2(); });
// monitor_->set(Variable::im2, [this] { return ?(); });
// monitor_->set(Variable::p2, [this] { return ?(); });
// monitor_->set(Variable::q2, [this] { return ?(); });
monitor_->set(Variable::im2, [this]
{ return std::sqrt(Ir2() * Ir2() + Ii2() * Ii2()); });
monitor_->set(Variable::p2, [this]
{ return Vr2() * Ir2() + Vi2() * Ii2(); });
monitor_->set(Variable::q2, [this]
{ return Vi2() * Ir2() - Vr2() * Ii2(); });
}

/**
Expand Down
34 changes: 34 additions & 0 deletions GridKit/Model/PhasorDynamics/Branch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,41 @@ None.
\end{aligned}
```

# Model Outputs

2 outputs are model variables of the branch model: $I_r$ and $I_i$.

There are 3 calculated outputs for the branch model: current magnitude $|I|$, active power $P_1$ and reactive power $Q_1$. They are calculated as follows:
``` math
\begin{aligned}
|I| &= \sqrt{(I_{r})^2 + (I_{i})^2} \\
P &= V_{r} I_{r} + V_{i} I_{i}\\
Q &= V_{i} I_{r} - V_{r} I_{i}
\end{aligned}
```
$|I|$ is the absolute value of the current phasor, independent of its direction or phase angle. The calculation above refelcts this as the geometric length.

In an AC electrical system, the complex power $S$ can be calculated from the voltage phasor $V$ and current phasor, $I$. By defenition, $S=VI^*$, where $I^*$ is the complex conjugate of $I$. Thus;

``` math
\begin{aligned}
S &= (V_r + V_i) (I_r - I_i)\\
S &= V_r I_r - V_r I_i + V_i I_r + V_i I_i\\
S &= (V_r I_r + V_i I_i) + (V_i I_r - V_r I_i)\\
\Re({S}) &= V_r I_r + V_i I_i\\
\Im({S}) &= V_i I_r - V_r I_i
\end{aligned}
```

$P_1$ is the real component of $S$. It is the power that actually does useful work.

$Q_1$ is the imaginary component of $S$. It is the power that oscillates back and forth between capacitors and inductors.

Positive active power values indicate that Bus 1 supplies active power into the branch. Negative values imply that Bus 1 is absorbing the active power.
$\newline$
The same sign convention applies to reactive power: positive $Q$ corresponds to injection into the branch, and negative $Q$ corresponds to absorption from the branch.

The same output variables are computed for Bus 2 following the identical procedure used for Bus 1.

# Transformer Branch Model

Expand Down
3 changes: 2 additions & 1 deletion GridKit/Model/PhasorDynamics/Exciter/IEEET1/Ieeet1Impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,8 @@ namespace GridKit
using Variable = model_data_type::MonitorableVariables;
monitor_->set(Variable::efd, [this]
{ return efd_signal_->read(); });
// monitor_->set(Variable::ksat, [this] { return ?; });
monitor_->set(Variable::ksat, [this]
{ return SB_ * (((y_[2] - SA_) * Math::sigmoid(y_[2] - SA_)) * ((y_[2] - SA_) * Math::sigmoid(y_[2] - SA_))); });
Comment thread
pelesh marked this conversation as resolved.
}
} // namespace Exciter
} // namespace PhasorDynamics
Expand Down
9 changes: 9 additions & 0 deletions GridKit/Model/PhasorDynamics/Exciter/IEEET1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,3 +224,12 @@ excitation limiters are non-existant. As of now, we assume there is no compensat
k_{sat} &= 0 \\
\end{aligned}
```
## Model Outputs

There are 2 outputs for this model: $E_{fd}$ and $k_{sat}$.

$E_{fd}$ is the field voltage applied to the rotor winding i.e. the control input to the synchronous machine. Its value is calculated from the internal model variable.

$k_{sat}$ is calculated using the formula from the smooth piecewise approximation (above). It represents the magnetic saturation coefficient of the exciter and models the nonlinear magnetization characteristics of the generator at high field voltage levels.

Magnetic saturation is modeled using a sigmoid function, which ensures small $k_{sat}$ values at low excitation and a steep rise as the field voltage increases.
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,10 @@ namespace GridKit
{ return y_[15]; });
monitor_->set(Variable::ii, [this]
{ return y_[16]; });
// monitor_->set(Variable::p, [this] { return ?(); });
// monitor_->set(Variable::q, [this] { return ?(); });
monitor_->set(Variable::p, [this]
{ return Vr() * Ir() + Vi() * Ii(); });
monitor_->set(Variable::q, [this]
{ return Vi() * Ir() - Vr() * Ii(); });
Comment thread
pelesh marked this conversation as resolved.
monitor_->set(Variable::delta, [this]
{ return y_[0]; });
monitor_->set(Variable::omega, [this]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,10 @@ namespace GridKit
{ return y_[3]; });
monitor_->set(Variable::ii, [this]
{ return y_[4]; });
// monitor_->set(Variable::p, [this] { return ?(); });
// monitor_->set(Variable::q, [this] { return ?(); });
monitor_->set(Variable::p, [this]
{ return Vr() * Ir() + Vi() * Ii(); });
monitor_->set(Variable::q, [this]
{ return Vi() * Ir() - Vr() * Ii(); });
Comment thread
pelesh marked this conversation as resolved.
monitor_->set(Variable::delta, [this]
{ return y_[0]; });
monitor_->set(Variable::omega, [this]
Expand Down
Loading