Skip to content

Wrong TGTypeII equation in documentation #417

@BAO-Rongxin

Description

@BAO-Rongxin

Describe the bug
Differential equations provided in documentation does not align with simulation results or general defination.
https://nrel-sienna.github.io/PowerSimulationsDynamics.jl/stable/component_models/turbine_gov/#TG-Type-II-[TGTypeII]

In this document,
Image
we should also add state variable xg to this equation, then it aligns with code and Milano's Power System Modeling and Scripting on page 359.

To Reproduce
when adding xg to mechanical torque, Tm will match simulation results.
and the following equations are also met:

"""
Lead-Lag Block:
┌───────────┐
│ 1 + sT1 │
u -> │ K ─────── │ -> y
│ 1 + sT2 │
└───────────┘

Internal State: x
"""

function lead_lag_mass_matrix(
u::Z,
x::Z,
K::Float64,
T1::Float64,
T2::Float64,
) where {Z <: ACCEPTED_REAL_TYPES}
T1_T2 = T2 < eps() ? 0.0 : (T1 / T2)
return x + (K * T1_T2) * u, K * (1 - T1_T2) * u - x
end

function lead_lag(
u::Z,
x::Z,
K::Float64,
T1::Float64,
T2::Float64,
) where {Z <: ACCEPTED_REAL_TYPES}
y, dxdt_scaled = lead_lag_mass_matrix(u, x, K, T1, T2)
return y, (1.0 / T2) * dxdt_scaled
end

#Compute block derivatives
y_ll1, dxg_dt = lead_lag(inv_R * (ω_ref - ω[1]), xg, 1.0, T1, T2)
τ_m = y_ll1 + P_ref # Uses P_ref assuming that τ_m0 = P_ref in SS.

Expected behavior

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions