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

Support fix for PowerSimulations #1064 #1078

Merged
merged 2 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/models/components.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
function get_system_base_power(c::Component)
return get_internal(c).units_info.base_value
end

"""
Default behavior of a component. If there is no base_power field, assume is in the system's base power.
"""
function get_base_power(c::Component)
return get_internal(c).units_info.base_value
end
get_base_power(c::Component) = get_system_base_power(c)

function _get_multiplier(c::T) where {T <: Component}
setting = get_internal(c).units_info
Expand Down
4 changes: 4 additions & 0 deletions test/test_dynamic_generator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,10 @@ end
@test get_dynamic_injector(static_gen) === Gen2AVR
@test get_base_power(static_gen) == get_base_power(Gen2AVR)

set_base_power!(static_gen, 1234.5)
@test get_base_power(static_gen) == 1234.5
@test PSY.get_system_base_power(static_gen) == get_base_power(sys)

# Rule: Can't set the pair injector if the current injector is already set.
@test_throws ArgumentError set_dynamic_injector!(static_gen, Gen1AVR)

Expand Down
Loading