Canonical RHS excerpt from the registered callable used for this benchmark cell. Expand it to verify the state equations; it is not a standalone runnable fixture.
Show canonical RHS excerpt
def _ieee9_fault_bus7_rhs(t: float, y: np.ndarray) -> np.ndarray:
"""IEEE 9-bus 3-machine 6th-order subtransient model.
Y_red switches at t=1.0 s (fault at bus 7) and t=1.15 s (line 5-7
tripped). State layout: 6 states per machine packed consecutively.
"""
if t < _I9_FAULT_ON:
Y_red = _Y9_PRE
elif t < _I9_FAULT_OFF:
Y_red = _Y9_FLT
else:
Y_red = _Y9_PST
delta = np.array([y[0], y[6], y[12]])
omega = np.array([y[1], y[7], y[13]])
Eq_p = np.array([y[2], y[8], y[14]])
Ed_p = np.array([y[3], y[9], y[15]])
psi_ppd = np.array([y[4], y[10], y[16]])
psi_ppq = np.array([y[5], y[11], y[17]])
Vd_pp = -psi_ppq
Vq_pp = psi_ppd
sin_d = np.sin(delta)
cos_d = np.cos(delta)
E_D = Vd_pp * sin_d + Vq_pp * cos_d
E_Q = -Vd_pp * cos_d + Vq_pp * sin_d
I_complex = Y_red @ (E_D + 1j * E_Q)
I_D = I_complex.real
I_Q = I_complex.imag
Id = I_D * sin_d - I_Q * cos_d
Iq = I_D * cos_d + I_Q * sin_d
Pe = Vd_pp * Id + Vq_pp * Iq
dy = np.zeros(18)
for i in range(3):
j = i * 6
dy[j] = _I9_ws * (omega[i] - 1.0)
dy[j + 1] = (
(_I9_Pm[i] - Pe[i] - _I9_D[i] * (omega[i] - 1.0))
/ (2.0 * _I9_H[i])
)
dy[j + 2] = (
(_I9_Efd[i] - Eq_p[i] - (_I9_Xd[i] - _I9_Xdp[i]) * Id[i])
/ _I9_Td0p[i]
)
dy[j + 3] = -(Ed_p[i] + (_I9_Xq[i] - _I9_Xqp[i]) * Iq[i]) / _I9_Tq0p[i]
dy[j + 4] = (
(Eq_p[i] - psi_ppd[i] - (_I9_Xdp[i] - _I9_Xppd[i]) * Id[i])
/ _I9_Td0pp[i]
)
# d/q-symmetric with the psi''d equation above; the previous leading
# minus sign made the psi''q self-term positive feedback (+1/T''q0),
# giving 3 unstable real eigenvalues (+21.7/+12.7/+4.6 /s) at the
# pre-fault equilibrium (model audit 2026-07-17, jobs 10592/10593).
dy[j + 5] = (
(Ed_p[i] - psi_ppq[i] + (_I9_Xqp[i] - _I9_Xppq[i]) * Iq[i])
/ _I9_Tq0pp[i]
)
return dy- Parameters
- _I9_D = [0.04, 0.04, 0.02]
- _I9_Efd = [1, 1, 1]
- _I9_FAULT_OFF = 1.15
- _I9_FAULT_ON = 1
- _I9_H = [23.64, 6.4, 3.01]
- _I9_Pm = [0.189749685802, 0.0263675033201, 0.0184537781352]
- _I9_Td0p = [8.96, 6, 5.89]
- _I9_Td0pp = [0.04, 0.033, 0.032]
- _I9_Tq0p = [0.31, 0.535, 0.6]
- _I9_Tq0pp = [0.06, 0.078, 0.047]
- _I9_Xd = [0.146, 0.8958, 1.3125]
- _I9_Xdp = [0.0608, 0.1198, 0.1813]
- _I9_Xppd = [0.06, 0.11, 0.18]
- _I9_Xppq = [0.06, 0.11, 0.18]
- _I9_Xq = [0.1, 0.8645, 1.2578]
- _I9_Xqp = [0.0969, 0.1969, 0.25]
- _I9_ws = 376.991118431
- _Y9_FLT = [1.09948845941−21.8316411859j, 5.2988e-05+1.29804e-06j, -0.00352340872293+1.68756988513j, 5.2988e-05+1.29804e-06j, 0.000255999591737−25.0909090849j, 6.62931e-05+1.48842e-06j, -0.00352340872293+1.68756988513j, 6.62931e-05+1.48842e-06j, 0.710940495786−11.3139372171j]
- _Y9_PRE = [1.10838108454−21.3641314571j, 0.0982345250387+2.25626669645j, 0.00879689862905+2.27241774971j, 0.0982345250387+2.25626669645j, 0.740931720167−14.2083965479j, 0.128663567748+2.82241535363j, 0.00879689862905+2.27241774971j, 0.128663567748+2.82241535363j, 0.727848960903−10.5823041104j]
- _Y9_PST = [1.47972144879−19.7375684858j, -0.0111983779222+0.513586902445j, 0.0182671759177+2.09816299494j, -0.0111983779222+0.513586902445j, 0.545271929776−12.5979709754j, 0.0865742024051+2.95279110628j, 0.0182671759177+2.09816299494j, 0.0865742024051+2.95279110628j, 0.721323299311−10.5761347127j]
- Initial condition
- y(0) = [0, 1, 0.385036673486, -0.00434761657827, 0.379262369951, 0.0474030452728, …] [shape=(18,), min=-0.0224580804979, max=1]
- Horizon
- t ∈ [0, 10]
Canonical RHS excerpt captured from the same registered callable used for the published benchmark. Frozen closure values are summarized below; helper imports and solver settings are intentionally omitted.