Skip to content

Commit 7bbec6f

Browse files
committed
UPD: 1phase pv case for dss validation
Uses dss results for validation
1 parent bb8524b commit 7bbec6f

File tree

4 files changed

+21
-5
lines changed

4 files changed

+21
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## staged
44

5+
- Fixed `1phase-pv` unit tests
56
- Adjusted `sbase_default`, and added `@info` if basemva from dss is the default value
67
- Fixed storage model for powerflow validation (new test values are based directly on dss outputs)
78
- Added `con(pm, nw, :ohms_yt, f_idx)` to store ohms constraints

src/data_model/eng2math.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -735,6 +735,9 @@ function _map_eng2math_generator!(data_math::Dict{String,<:Any}, data_eng::Dict{
735735
end
736736
end
737737

738+
math_obj["pg"] = get(eng_obj, "pg", fill(0.0, length(connections)))
739+
math_obj["qg"] = get(eng_obj, "qg", fill(0.0, length(connections)))
740+
738741
_add_gen_cost_model!(math_obj, eng_obj)
739742

740743
math_obj["configuration"] = get(eng_obj, "configuration", WYE)
@@ -755,6 +758,8 @@ function _map_eng2math_solar!(data_math::Dict{String,<:Any}, data_eng::Dict{Stri
755758
for (name, eng_obj) in get(data_eng, "solar", Dict{Any,Dict{String,Any}}())
756759
math_obj = _init_math_obj("solar", name, eng_obj, length(data_math["gen"])+1; pass_props=pass_props)
757760

761+
connections = eng_obj["connections"]
762+
758763
math_obj["gen_bus"] = data_math["bus_lookup"][eng_obj["bus"]]
759764
math_obj["gen_status"] = status = Int(eng_obj["status"])
760765

@@ -780,6 +785,9 @@ function _map_eng2math_solar!(data_math::Dict{String,<:Any}, data_eng::Dict{Stri
780785
math_obj[to_k] = haskey(eng_obj, fr_k) ? eng_obj[fr_k] : fill(def, N)
781786
end
782787

788+
math_obj["pg"] = get(eng_obj, "pg", fill(0.0, N))
789+
math_obj["qg"] = get(eng_obj, "qg", fill(0.0, N))
790+
783791
_add_gen_cost_model!(math_obj, eng_obj)
784792

785793
data_math["gen"]["$(math_obj["index"])"] = math_obj

test/data/opendss/case3_unbalanced_1phase-pv.dss

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
11
Clear
22
New Circuit.3Bus_example
33
! define a really stiff source
4-
~ basekv=0.4 pu=0.9959 MVAsc1=1e6 MVAsc3=1e6
4+
~ basekv=0.4 pu=1.0 MVAsc1=1e6 MVAsc3=1e6 basemva=0.001
55

66
!Define Linecodes
77
New linecode.556MCM nphases=3 basefreq=50 ! ohms per 5 mile
88
~ rmatrix = ( 0.1000 | 0.0400 0.1000 | 0.0400 0.0400 0.1000)
99
~ xmatrix = ( 0.0583 | 0.0233 0.0583 | 0.0233 0.0233 0.0583)
1010
~ cmatrix = (50.92958178940651 | -0 50.92958178940651 | -0 -0 50.92958178940651 ) ! small capacitance
1111

12-
1312
New linecode.4/0QUAD nphases=3 basefreq=50 ! ohms per 100ft
1413
~ rmatrix = ( 0.1167 | 0.0467 0.1167 | 0.0467 0.0467 0.1167)
1514
~ xmatrix = (0.0667 | 0.0267 0.0667 | 0.0267 0.0267 0.0667 )
1615
~ cmatrix = (50.92958178940651 | -0 50.92958178940651 | -0 -0 50.92958178940651 ) ! small capacitance
1716

17+
!Define loadshapes
18+
19+
New loadshape.dailyshape npts=1 minterval=60 mult=[ 1 ]
20+
1821
!Define lines
1922

2023
New Line.OHLine bus1=sourcebus.1.2.3 Primary.1.2.3 linecode = 556MCM length=1 ! 5 mile line
@@ -26,7 +29,7 @@ New Load.L1 phases=1 loadbus.1.0 ( 0.4 3 sqrt / ) kW=8 kvar=3 model=1
2629
New Load.L2 phases=1 loadbus.2.0 ( 0.4 3 sqrt / ) kW=6 kvar=3 model=1
2730
New Load.L3 phases=1 loadbus.3.0 ( 0.4 3 sqrt / ) kW=6 kvar=3 model=1
2831

29-
New PVSystem.PV1 phases=1 bus1=primary.1 kv=0.4 kva=2 kvar=2
32+
New PVSystem.PV1 phases=1 bus1=primary.1 kv=( 0.4 3 sqrt / ) pmpp=2 irradiance=1 kva=2 daily=dailyshape
3033

3134
Set voltagebases=[0.4]
3235
Set tolerance=0.000001

test/opf.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,10 +209,14 @@
209209
@test result["termination_status"] == LOCALLY_SOLVED
210210

211211
@test isapprox(sum(result["solution"]["voltage_source"]["source"]["pg"]), 18.38728; atol=1e-2)
212-
@test isapprox(sum(result["solution"]["voltage_source"]["source"]["qg"]), 7.28903; atol=1e-2)
212+
@test isapprox(sum(result["solution"]["voltage_source"]["source"]["qg"]), 9.21713; atol=1e-2)
213213

214214
@test all(isapprox(sum(result["solution"]["solar"]["pv1"]["pg"]), 1.9947; atol=1e-2))
215-
@test all(isapprox(sum(result["solution"]["solar"]["pv1"]["qg"]), 1.9259; atol=1e-2))
215+
@test all(isapprox(sum(result["solution"]["solar"]["pv1"]["qg"]), 0.0; atol=1e-2))
216+
217+
vbase = case3_unbalanced_1phase_pv["settings"]["vbases_default"]["sourcebus"]
218+
@test all(isapprox(result["solution"]["bus"]["primary"]["vm"] ./ vbase, [0.990984, 0.991149, 0.991134]; atol=1e-3))
219+
@test all(isapprox(result["solution"]["bus"]["primary"]["va"], [-0.03, -120.03, 119.97]; atol=1e-2))
216220
end
217221

218222
@testset "3-bus balanced capacitor acp opf" begin

0 commit comments

Comments
 (0)