Skip to content

Commit

Permalink
add post calculation for mechanical torque for pidgov
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigomha committed Aug 23, 2024
1 parent 0812999 commit a5a4e1f
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions src/post_processing/post_proc_generator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1081,3 +1081,38 @@ function _mechanical_torque(
τm = ((x_g4 .- q_nl) .* h * At - D_T * Δω .* x_g3) ./ ω
return ts, τm
end

"""
Function to obtain the mechanical torque time series of a Dynamic Generator with HydroTurbineGov (HYGOV) Turbine Governor.
"""
function _mechanical_torque(
tg::PSY.PIDGOV,
name::String,
res::SimulationResults,
dt::Union{Nothing, Float64, Vector{Float64}},
)
# Get params
D_turb = PSY.get_D_turb(tg)
gate_openings = PSY.get_gate_openings(tg)
power_gate_openings = PSY.get_power_gate_openings(tg)
A_tw = PSY.get_A_tw(tg)
Tw = PSY.get_Tw(tg)
setpoints = get_setpoints(res)
ω_ref = setpoints[name]["ω_ref"]
# Get state results
ts, x_g7 = post_proc_state_series(res, (name, :x_g7), dt)
_, x_g6 = post_proc_state_series(res, (name, :x_g6), dt)
_, ω = post_proc_state_series(res, (name, ), dt)
Pe = similar(x_g7)
for (ix, x7) in enumerate(x_g7)
x6 = x_g6[ix]
power_at_gate =
three_level_gate_to_power_map(x6, gate_openings, power_gate_openings)
Tz = A_tw * Tw
ll_out, _ = lead_lag(power_at_gate, x7, 1.0, -Tz, Tz / 2.0)
Pe[ix] = ll_out - D_turb * (ω[ix] - ω_ref)
end
τm = Pe ./ ω
return ts, τm
end

0 comments on commit a5a4e1f

Please sign in to comment.