Skip to content

Commit

Permalink
FIX: lindistflow power balance implementation (#16)
Browse files Browse the repository at this point in the history
* FIX: power balance eq. for lindistflow

* test updates
  • Loading branch information
pseudocubic authored Sep 23, 2024
1 parent e910054 commit b3589bd
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## staged

- none
- Fixed bug in `constraint_mc_power_balance_shed_block` (`LPUBFDiagPowerModel` version) where `pd_zblock_zdemand` was used instead of `qd_zblock_zdemand`

## v3.5.0

Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ InfrastructureModels = "0.7"
Ipopt = "0.9, 1.0.2, 1.3"
JSON = "0.21"
JSONSchema = "0.3.3, 1"
JuMP = "0.22, 0.23, 1"
JuMP = "<1.15"
Juniper = "0.8, 0.9"
LoggingExtras = "0.4.7, 0.4.9"
PolyhedralRelaxations = "0.3.3, 0.3.4, 0.3.5"
Expand Down
2 changes: 1 addition & 1 deletion src/form/lindistflow.jl
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ function constraint_mc_power_balance_shed_block(pm::PMD.LPUBFDiagModel, nw::Int,
==
sum(qg[g][t] for (g, conns) in bus_gens if t in conns)
- sum(qs[s][t] for (s, conns) in bus_storage if t in conns)
- sum(pd_zblock_zdemand[l][t] for (l, conns) in bus_loads if t in conns)
- sum(qd_zblock_zdemand[l][t] for (l, conns) in bus_loads if t in conns)
- sum((-w[t] * LinearAlgebra.diag(Bt')[idx]) for (sh, conns) in uncontrolled_shunts if t in conns)
- sum(-var(pm, nw, :capacitor_reactive_power, sh)[t] for (sh, conns) in controlled_shunts if t in conns)
)
Expand Down
10 changes: 5 additions & 5 deletions test/mld.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
r = optimize_switches!(args)

@test all(_r["termination_status"] == OPTIMAL for (n,_r) in r)
@test isapprox(sum(Float64[_r["objective"] for _r in values(r)]), 119.89; atol=1)
@test isapprox(sum(Float64[_r["objective"] for _r in values(r)]), 176.86; atol=1)
end

@testset "test rolling-horizon optimal switching - lindistflow - traditional" begin
Expand All @@ -53,7 +53,7 @@
r = optimize_switches!(args)

@test all(_r["termination_status"] == OPTIMAL for (n,_r) in r)
@test isapprox(sum(Float64[_r["objective"] for _r in values(r)]), 119.89; atol=1)
@test isapprox(sum(Float64[_r["objective"] for _r in values(r)]), 176.86; atol=1)
end

@testset "test rolling-horizon optimal switching - nfa - block" begin
Expand Down Expand Up @@ -138,7 +138,7 @@
r = optimize_switches!(args)

@test first(r).second["termination_status"] == OPTIMAL
@test isapprox(r["1"]["objective"], 80.65; atol=1)
@test isapprox(r["1"]["objective"], 80.64; atol=1)
end

@testset "test full-lookahead optimal switching - lindistflow - traditional - radial-disabled - inverter-disabled" begin
Expand Down Expand Up @@ -244,7 +244,7 @@ end
r = solve_block_mld(eng_s, LPUBFDiagPowerModel, solver)

@test r["solution"]["switch"]["680675"]["state"] == OPEN
@test r["solution"]["switch"]["671692"]["state"] == CLOSED
@test r["solution"]["switch"]["671692"]["state"] == OPEN
@test length(filter(x->x.second["state"]==OPEN, r["solution"]["switch"])) == 2
@test r["objective"] < 1.0

Expand All @@ -253,7 +253,7 @@ end

r = solve_block_mld(eng_s, LPUBFDiagPowerModel, solver)

@test r["solution"]["switch"]["680675"]["state"] == CLOSED
@test r["solution"]["switch"]["680675"]["state"] == OPEN
@test r["solution"]["switch"]["671692"]["state"] == OPEN
@test length(filter(x->x.second["state"]==OPEN, r["solution"]["switch"])) == 2
@test r["objective"] < 1.0
Expand Down

0 comments on commit b3589bd

Please sign in to comment.