diff --git a/src/models/components.jl b/src/models/components.jl index 1208a282cb..2ff6a0577e 100644 --- a/src/models/components.jl +++ b/src/models/components.jl @@ -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 diff --git a/test/test_dynamic_generator.jl b/test/test_dynamic_generator.jl index a65405828f..72a6be9fa7 100644 --- a/test/test_dynamic_generator.jl +++ b/test/test_dynamic_generator.jl @@ -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)