Skip to content

Commit

Permalink
removed code for debug
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhengLiu1119 committed Oct 6, 2022
1 parent a5d6cbd commit 9feb4e9
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 348 deletions.
6 changes: 1 addition & 5 deletions src/PandaModels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ export run_powermodels_pf,
run_pandamodels_ploss,
run_pandamodels_vstab_test,
run_pandamodels_qflex_test,
run_pandamodels_ploss,
run_pandamodels_ploss_test,
run_powermodels_storage
run_pandamodels_ploss_test

include("input/pp_to_pm.jl")
include("input/tools.jl")
Expand All @@ -45,6 +43,4 @@ include("models/call_pandamodels.jl")
include("models/call_powermodels.jl")
include("models/run_pm_vstab_dev.jl")
include("models/run_pm_qflex_dev.jl")
include("models/run_pm_ploss_dev.jl")
include("models/run_pm_storage_dev.jl")
end
195 changes: 0 additions & 195 deletions src/models/run_pm_ploss_dev.jl

This file was deleted.

85 changes: 0 additions & 85 deletions src/models/run_pm_storage_dev.jl

This file was deleted.

64 changes: 1 addition & 63 deletions src/models/vstab.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export _run_vstab, _run_multi_vstab, _run_vstab_limq
export _run_vstab, _run_multi_vstab

"""
run optimization for maintaining voltage setpoints
Expand Down Expand Up @@ -117,65 +117,3 @@ function objective_multi_vstab(pm::_PM.AbstractPowerModel)
for nw in timestep_ids)
)
end


function _run_vstab_limq(file, model_type::_PM.Type, optimizer; kwargs...)
return _PM.solve_model(file, model_type, optimizer, _build_vstab_limq; kwargs...)
end

"""
given a JuMP model and a PowerModels network data structure,
builds an "maintainig voltage setpoints" formulation with limited reactive power
based on the given data and returns the JuMP model
"""

function _build_vstab_limq(pm::_PM.AbstractPowerModel)

_PM.variable_bus_voltage(pm)
_PM.variable_gen_power(pm)
_PM.variable_branch_power(pm)
_PM.variable_dcline_power(pm, bounded = false) # TODO: why false?


objective_vstab_limq(pm)

_PM.constraint_model_voltage(pm)

for i in _PM.ids(pm, :ref_buses)
_PM.constraint_theta_ref(pm, i)
end

for i in _PM.ids(pm, :bus)
_PM.constraint_power_balance(pm, i)
end

for (i, branch) in _PM.ref(pm, :branch)
_PM.constraint_ohms_yt_from(pm, i)
_PM.constraint_ohms_yt_to(pm, i)

_PM.constraint_thermal_limit_from(pm, i)
_PM.constraint_thermal_limit_to(pm, i)
end

for i in _PM.ids(pm, :dcline)
_PM.constraint_dcline_power_losses(pm, i)
end
end

function objective_vstab_limq(pm::_PM.AbstractPowerModel)

if haskey(pm.ext, :obj_factors)
if length(pm.ext[:obj_factors]) == 2
fac1 = pm.ext[:obj_factors]["fac_1"]
fac2 = pm.ext[:obj_factors]["fac_2"]
end
else
fac1 = 0.8
fac2 = 1-fac1
end

return JuMP.@objective(pm.model, Min,
fac1 * sum((var(pm, :vm, content["element_index"]) - content["value"])^2 for (i, content) in pm.ext[:setpoint_v])
+
fac2 * sum((var(pm, :qg, content)-0)^2 for (i, content) in pm.ext[:gen_and_controllable_sgen]))
end

0 comments on commit 9feb4e9

Please sign in to comment.