-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hr/add limiters #376
Hr/add limiters #376
Conversation
|
||
function limit_output_current(limiter :: PSY.MagnitudeOutputCurrentLimiter, Id_cnv_ref :: Union{Float64, ForwardDiff.Dual}, Iq_cnv_ref :: Union{Float64, ForwardDiff.Dual}) | ||
limit_value = PSY.get_I_max(limiter) | ||
if (Id_cnv_ref^2 + Iq_cnv_ref^2)^(1/2) > limit_value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider using sqrt(Id_cnv_ref^2 + Iq_cnv_ref^2)
rather than (Id_cnv_ref^2 + Iq_cnv_ref^2)^(1/2)
@@ -0,0 +1,56 @@ | |||
function limit_output_current(limiter :: Nothing, Id_cnv_ref :: Union{Float64, ForwardDiff.Dual}, Iq_cnv_ref :: Union{Float64, ForwardDiff.Dual}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can replace Union{Float64, Forwardiff.Dual}
with ACCEPTED_REAL_TYPES
function limit_output_current(limiter :: PSY.MagnitudeOutputCurrentLimiter, Id_cnv_ref :: Union{Float64, ForwardDiff.Dual}, Iq_cnv_ref :: Union{Float64, ForwardDiff.Dual}) | ||
limit_value = PSY.get_I_max(limiter) | ||
if (Id_cnv_ref^2 + Iq_cnv_ref^2)^(1/2) > limit_value | ||
Id_cnv_ref2 = limit_value*cos(theta) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't work. I don't see theta defined. Also, consider using θ (\theta), rather than theta.
limit_value = PSY.get_I_max(limiter) | ||
gain = PSY.get_kw(limiter) | ||
theta = atan(Iq_cnv_ref, Id_cnv_ref) | ||
if (Id_cnv_ref^2 + Iq_cnv_ref^2)^(1/2) > limit_value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
again with sqrt
Id_cnv_ref2 = Id_cnv_ref | ||
Iq_cnv_ref2 = Iq_cnv_ref | ||
end | ||
Del_Vv_d = ω * imag_imped * (Iq_cnv_ref2 - Iq_cnv_ref) + real_imped * (Id_cnv_ref - Id_cnv_ref2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recommend here to be consistent with the signs rather than flipping signs inside the parenthesis.
u_d = Id_cnv_ref - Id_cnv_ref2
u_q = Iq_cnv_ref - Id_cnv_ref2
u = u_d + u_q * 1im
Z = R_vi + L_vi * ω
# u * Z = R_vi * u_d - L_vi * ω * u_q + 1im ( u_q * R_vi + u_d * L_vi)
Del_Vv_d = R_vi * u_d - L_vi * ω * u_q
Del_Vv_q = R_vi * u_q + L_vi * ω * u_d
It seems that the implementation is correct as Del_Vv_d
has the signs flipped in the q-axis.
Pull Jd/psy4 update
@HaleyRoss and @rodrigomha is this in a good place to merge? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's merge temporarily to do the bump to PSY4
* correct get_rate to get_rating (#381) * bump dependencies * Hr/add limiters (#376) * Add current limiters to inner_conrol_models * Fix limiter integration mistakes * Add saturation limiting logic * Add hybrid limiter control logic * Correct sign error hybrid limiter * Remove print * Change PowerSystems version * modify inner control gain * debug * fix mag limiter * change placement of kiv in hyblim * debug load * revert debug --------- Co-authored-by: Rodrigo Henríquez-Auba <[email protected]> * bump project toml * formatter * reuse multiple dispatch * change exponential names * update json exponential coefficients * revert IS check * change Union to real types * try catch for test 10 * add sim type * update printing * change to logs * update printing * add directly the LinearMatrix * revert try and catch --------- Co-authored-by: HaleyRoss <[email protected]> Co-authored-by: Rodrigo Henríquez-Auba <[email protected]>
Add control logic for output current limiters.