Skip to content

Commit

Permalink
gfli test added
Browse files Browse the repository at this point in the history
  • Loading branch information
jtabarez committed Mar 11, 2024
1 parent 498f8f3 commit 35f3494
Show file tree
Hide file tree
Showing 7 changed files with 391 additions and 5 deletions.
19 changes: 17 additions & 2 deletions src/core/admittance_matrix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ end
function build_mc_delta_current_generator!(delta_i, v, data)
for (_, gen) in data["gen"]
if occursin("generator", gen["source_id"])
if gen["gen_model"] == 1
if gen["gen_model"] == 1
calc_delta_current_generator!(gen, delta_i, v, data)
end
end
Expand Down Expand Up @@ -494,7 +494,6 @@ function build_mc_delta_current_inverter!(delta_i, v, data, z_matrix)
if occursin("solar.", gen["source_id"])
if gen["pv_model"] == 1
if gen["grid_forming"]
println(oooooo)
calc_mc_delta_current_gfmi!(gen, delta_i, v, data)
else
calc_mc_delta_current_gfli!(gen, delta_i, v, data)
Expand Down Expand Up @@ -595,6 +594,7 @@ function update_mc_delta_current_vector(model, v)
delta_i = zeros(Complex{Float64}, n, 1)
update_mc_delta_current_generator!(delta_i, v, model.data)
update_mc_delta_current_load!(delta_i, v, model.data)
update_mc_delta_current_inverter!(delta_i, v, model.data)
return _SP.sparse(delta_i)
end

Expand All @@ -618,4 +618,19 @@ function update_mc_delta_current_load!(delta_i, v, data)
end
end
end
end


function update_mc_delta_current_inverter!(delta_i, v, data)
for (_, gen) in data["gen"]
if occursin("solar.", gen["source_id"])
if gen["pv_model"] == 1
if gen["grid_forming"]
calc_mc_delta_current_gfmi!(gen, delta_i, v, data)
else
calc_mc_delta_current_gfli!(gen, delta_i, v, data)
end
end
end
end
end
2 changes: 1 addition & 1 deletion src/data_model/components.jl
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ function _map_eng2math_mc_admittance_2w_transformer!(transformer::Dict{String,<:
end
end
if w == 1
if transformer["leadlag"] == "lag"
if transformer["leadlag"] == "lead"
a[1,1] = a[1,6] = a[2,5] = a[2,10] = a[3,9] = a[3,2] = 1
else
a[1,1] = a[1,10] = a[2,2] = a[2,5] = a[3,6] = a[3,9] = 1
Expand Down
2 changes: 1 addition & 1 deletion src/data_model/eng2math.jl
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ end

"field/values to passthrough from the ENGINEERING to MATHEMATICAL data models"
const _pmp_eng2math_passthrough = Dict{String,Vector{String}}(
"generator" => String["zr", "zx", "grid_forming", "gen_model", "xdp", "rp", "xdpp", "vnom_kv"],
"generator" => String["zr", "zx", "gen_model", "xdp", "rp", "xdpp", "vnom_kv"],
"solar" => String["i_max", "solar_max", "kva", "pf", "grid_forming", "balanced", "vminpu", "transformer", "type", "pv_model", "transformer_id"],
"voltage_source" => String["zr", "zx"],
"load" => String["vminpu", "vmaxpu"],
Expand Down
19 changes: 19 additions & 0 deletions src/io/dss/dss2eng.jl
Original file line number Diff line number Diff line change
Expand Up @@ -459,3 +459,22 @@ function _dss2eng_solar_transformer(data_eng::Dict{String,<:Any}, data_dss::Dict
end
end
end


function _dss2eng_issues!(data_eng::Dict{String,<:Any}, data_dss::Dict{String,<:Any})
# println(keys(data_eng))
# # println(data_eng["bus"])
# if haskey(data_eng, "line")
# for (id, line) in data_eng["line"]
# if haskey(line["dss"], "geometry")
# # println(line)
# # calc_line_paramters!(line, data_dss)
# if length(line["rs"]) != length(line["f_connections"])^2

# println(line)
# end
# end
# end
# end
# println(oooo)
end
2 changes: 1 addition & 1 deletion src/io/opendss.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ data model adding some extra data transformations specific to fault studies.
`kwargs` can be any valid keyword arguments from PowerModelsDistribution's `parse_file` function.
"""
function parse_opendss(file::String; method::Union{String,Missing}=missing, kwargs...)
pm_data = _PMD.parse_file(file; dss2eng_extensions=[_dss2eng_solar_dynamics!, _dss2eng_load_dynamics!, _dss2eng_gen_dynamics!, _dss2eng_transformer_dynamics!, _dss2eng_transformers!], kwargs...)
pm_data = _PMD.parse_file(file; dss2eng_extensions=[_dss2eng_solar_dynamics!, _dss2eng_load_dynamics!, _dss2eng_gen_dynamics!, _dss2eng_transformer_dynamics!, _dss2eng_transformers!, _dss2eng_issues!], kwargs...)
if ismissing(method)
pm_data["method"] = "PMD"
else
Expand Down
58 changes: 58 additions & 0 deletions test/data/dist/gfmi_test.dss
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
Clear
New Circuit.3Bus_example
! define a really stiff source
~ basekv=4.16 BaseMVA=.5 pu=0.9959 r1=.7 x1=3.5

!Define Linecodes


New linecode.556MCM nphases=3 basefreq=60 ! ohms per 5 mile
~ rmatrix = ( 0.1000 | 0.0400 0.1000 | 0.0400 0.0400 0.1000)
~ xmatrix = ( 0.0583 | 0.0233 0.0583 | 0.0233 0.0233 0.0583)
~ cmatrix = (50.92958178940651 | -0 50.92958178940651 | -0 -0 50.92958178940651 ) ! small capacitance


New linecode.4/0QUAD nphases=3 basefreq=60 ! ohms per 100ft
~ rmatrix = ( 0.1167 | 0.0467 0.1167 | 0.0467 0.0467 0.1167)
~ xmatrix = (0.0667 | 0.0267 0.0667 | 0.0267 0.0267 0.0667 )
~ cmatrix = (50.92958178940651 | -0 50.92958178940651 | -0 -0 50.92958178940651 ) ! small capacitance

!Define lines

New Line.OHLine bus1=sourcebus.1.2.3 Primary.1.2.3 linecode = 556MCM length=1 ! 5 mile line
New Line.Quad Bus1=Primary.1.2.3 loadbus.1.2.3 linecode = 4/0QUAD length=1 ! 100 ft
New Line.PV_line Bus1=PV_bus.1.2.3 Primary.1.2.3 linecode = 4/0QUAD length=1 ! 100 ft

!Loads - single phase

!New Load.L1 phases=3 bus1=loadbus.1.2.3 Conn=Wye kW=160 kvar=130 model=1 kV=4.16
New Load.L1 phases=3 bus1=loadbus.1.2.3 Conn=Wye kW=18 kvar=8 model=1 kV=4.16

New Transformer.TX1 windings=2 phases=3 Buses=[PV_bus1 PV_bus]
~ Conns=[Delta Wye]
~ kVs=[.4 4.16]
~ kVAs=[25 25]
~ %Rs=[1 2]
~ xhl=5
~ %noloadloss=0.0
~ %imag=0.0
~ leadlag=lag

New PVSystem.PV1 phases=3 bus1=PV_bus1.1.2.3 kv=0.4 conn=wye irradiance=1 Pmpp=25 kva=25 pf=.95 balanced=true limitcurrent=true vminpu=0.9090909


Set voltagebases=[4.16 0.4]
Set tolerance=0.000001
set defaultbasefreq=60
Calcvoltagebases
solve

!batchedit load..* enable=false
!batchedit capacitor..* enabled=false
new fault.test phases=3 bus1=loadbus.1.2.3 r=.0001 enabled=true

Solve mode=snap

set mode=dynamic controlmode=time
set stepsize=.0002s number=800
solve
Loading

0 comments on commit 35f3494

Please sign in to comment.