From 3ef88f5673e70ed7dd5612ac08a9f3f2ea1b4666 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodrigo=20Henr=C3=ADquez-Auba?= Date: Fri, 22 Apr 2022 15:01:55 -0700 Subject: [PATCH] Fix Source R and X source base values (#881) * update zsource base * fix function call --- src/parsers/psse_dynamic_data.jl | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/parsers/psse_dynamic_data.jl b/src/parsers/psse_dynamic_data.jl index 7a66499eff..ed00135085 100644 --- a/src/parsers/psse_dynamic_data.jl +++ b/src/parsers/psse_dynamic_data.jl @@ -113,15 +113,19 @@ function _make_shaft(param_map, val) return constructor_shaft(shaft_args...) end -function _make_source(g::StaticInjection, r::Float64, x::Float64) +function _make_source(g::StaticInjection, r::Float64, x::Float64, sys_base::Float64) + # Transform Z_source to System Base + machine_base = get_base_power(g) + r_sysbase = r * (sys_base / machine_base) + x_sysbase = x * (sys_base / machine_base) return Source( name = get_name(g), available = true, bus = get_bus(g), active_power = get_active_power(g), reactive_power = get_reactive_power(g), - R_th = r, - X_th = x, + R_th = r_sysbase, + X_th = x_sysbase, ) end @@ -443,7 +447,7 @@ function add_dyn_injectors!(sys::System, bus_dict_gen::Dict) @warn "No series reactance found. Setting it to 1e-6" x = 1e-6 end - s = _make_source(g, r, x) + s = _make_source(g, r, x, get_base_power(sys)) remove_component!(typeof(g), sys, _name) add_component!(sys, s) elseif all(.!ismissing.(temp_dict[_id])) @@ -463,7 +467,7 @@ function add_dyn_injectors!(sys::System, bus_dict_gen::Dict) set_Xd_p!(machine, x) if get_H(shaft) == 0.0 @info "Machine at bus $(_num), id $(_id) has zero inertia. Modeling it as Voltage Source" - s = _make_source(g, r, x) + s = _make_source(g, r, x, get_base_power(sys)) remove_component!(typeof(g), sys, _name) add_component!(sys, s) # Don't add DynamicComponent in case of adding Source