Skip to content
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

Merged
merged 15 commits into from
Jul 8, 2024
Merged

Conversation

HaleyRoss
Copy link
Contributor

Add control logic for output current limiters.


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
Copy link
Contributor

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})
Copy link
Contributor

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)
Copy link
Contributor

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
Copy link
Contributor

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)
Copy link
Contributor

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.

@jd-lara jd-lara requested a review from rodrigomha June 10, 2024 21:09
@jd-lara
Copy link
Member

jd-lara commented Jul 2, 2024

@HaleyRoss and @rodrigomha is this in a good place to merge?

Copy link
Contributor

@rodrigomha rodrigomha left a 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

@rodrigomha rodrigomha merged commit ad1aa65 into NREL-Sienna:jd/psy4_update Jul 8, 2024
0 of 6 checks passed
jd-lara added a commit that referenced this pull request Jul 8, 2024
* 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 <rodrigomha@gmail.com>

* 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 <125164295+HaleyRoss@users.noreply.github.com>
Co-authored-by: Rodrigo Henríquez-Auba <rodrigomha@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants