Skip to content

Commit

Permalink
start adding ts builder function
Browse files Browse the repository at this point in the history
  • Loading branch information
akbarnes committed Oct 29, 2024
1 parent 1cb23fc commit 50fb47f
Showing 1 changed file with 99 additions and 0 deletions.
99 changes: 99 additions & 0 deletions src/prob/gmd_blocker_placement.jl
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,102 @@ function build_blocker_placement(pm::_PM.AbstractPowerModel; kwargs...)

objective_blocker_placement_cost(pm)
end


"FUNCTION: build the multi-time-series coupled quasi-dc-pf and ac-ots with ac-mls problem
as a generator dispatch minimization problem"
function build_blocker_placement_ts(pm::_PM.AbstractPowerModel; kwargs...)
# Reference:
# built minimum loadshedding problem specification corresponds to the "Model C4" of
# Mowen et al., "Optimal Transmission Line Switching under Geomagnetic Disturbances", 2018.


for (n, network) in _PM.nws(pm)
_PMR.variable_bus_voltage_on_off(pm, nw=n)
_PM.variable_gen_indicator(pm, nw=n)
_PM.variable_gen_power(pm, nw=n)
_PM.variable_branch_indicator(pm, nw=n)
_PM.variable_branch_power(pm, nw=n)
_PM.variable_dcline_power(pm, nw=n)

_PM.variable_load_power_factor(pm, relax=true)
_PM.variable_shunt_admittance_factor(pm, relax=true)

variable_dc_voltage_on_off(pm, nw=n)
variable_dc_line_flow(pm, nw=n, bounded=false)
variable_dc_current_mag(pm, nw=n)
variable_qloss(pm, nw=n)

variable_delta_oil_ss(pm, nw=n, bounded=true)
variable_delta_oil(pm, nw=n, bounded=true)
variable_delta_hotspot_ss(pm, nw=n, bounded=true)
variable_delta_hotspot(pm, nw=n, bounded=true)
variable_hotspot(pm, nw=n, bounded=true)

_PM.constraint_model_voltage_on_off(pm, nw=n)

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

for i in _PM.ids(pm, :bus, nw=n)
constraint_power_balance_gmd_shunt_ls(pm, i, nw=n)
end

for i in _PM.ids(pm, :bus, nw=n)
_PM.constraint_gen_power_on_off(pm, i, nw=n)
constraint_gen_ots_on_off(pm, i, nw=n)
constraint_gen_perspective(pm, i, nw=n)
end

for i in _PM.ids(pm, :branch, nw=n)

_PM.constraint_ohms_yt_from_on_off(pm, i, nw=n)
_PM.constraint_ohms_yt_to_on_off(pm, i, nw=n)

_PM.constraint_voltage_angle_difference_on_off(pm, i, nw=n)

_PM.constraint_thermal_limit_from_on_off(pm, i, nw=n)
_PM.constraint_thermal_limit_to_on_off(pm, i, nw=n)

constraint_qloss_vnom(pm, i, nw=n)
constraint_dc_current_mag(pm, i, nw=n)
constraint_dc_current_mag_on_off(pm, i, nw=n)

constraint_temperature_state_ss(pm, i, nw=n)
constraint_hotspot_temperature_state_ss(pm, i, nw=n)
constraint_hotspot_temperature_state(pm, i, nw=n)
constraint_absolute_hotspot_temperature_state(pm, i, nw=n)

end

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

for i in _PM.ids(pm, :gmd_bus, nw=n)
constraint_dc_kcl(pm, i, nw=n)
end

for i in _PM.ids(pm, :gmd_branch, nw=n)
constraint_dc_ohms_on_off(pm, i, nw=n)
end

end

network_ids = sort(collect(nw_ids(pm)))
n_1 = network_ids[1]
for i in _PM.ids(pm, :branch, nw=n_1)
constraint_temperature_state(pm, i, nw=n_1)
end
for n_2 in network_ids[2:end]
for i in _PM.ids(pm, :branch, nw=n_2)
constraint_temperature_state(pm, i, n_1, n_2)
end
n_1 = n_2
end

_PM.objective_min_fuel_and_flow_cost(pm)
end


0 comments on commit 50fb47f

Please sign in to comment.