Data
PowerModelsRestoration extends the base PowerModels data format by supporting a damaged
key to components that need to be repaired. Currently supported components for restoration are:
PowerModelsRestoration.restoration_components
1×4 Matrix{String}:
"bus" "gen" "storage" "branch"
To specify a damaged component, sets its damaged
value to 1.
case["gen"]["1"]["damaged"]==1
Terminology
There are three terms related to the status of components:
- active (inactive)
- damaged
- repairable
The component status value, e.g. gen["gen_status"]=1
determines that a component is active. The damaged status is determined by gen["damaged"]=1
. A component is repairable if is it active and damaged, gen["gen_status"]==1 && gen["damaged"]==1
.
Why? if a component is not active, it is filtered out of the network by the powermodels functions that create an optimization problem. When determining how many repairs can be done, this must be accounted for.
In addition, this allows heuristic problems like RAD to only consider repairing subsets of items that are active, i.e. a component that is damaged but not active is for future restoration problems.
Data Functions
The following functions are responsible for handling the data dictionary used in PowerModelsRestoration:
PowerModelsRestoration._clean_status!
— MethodPowerModelsRestoration._clear_damage_indicator!
— MethodPowerModelsRestoration._get_damaged_components
— MethodPowerModelsRestoration._get_inactive_components
— MethodPowerModelsRestoration._get_isolated_load
— MethodPowerModelsRestoration._get_repairable_components
— MethodPowerModelsRestoration._propagate_damage_status!
— MethodPowerModelsRestoration.add_load_weights!
— Methodadd_load_weights!(data::Dict{String,<:Any})
Add load weights to network data. Only supports pti files. Takes the load_ckt
key ('l', 'm', 'h') and assigns a load weight
key (1.0, 10.0, 100.0).
PowerModelsRestoration.apply_restoration_sequence!
— Method`apply_restoration_sequence!(data::Dict{String,<:Any}, repair_order::Dict{String,<:Any})`
Update devices status and damaged indicator based on the repair order.
E.g. if a device is repaired in network id 3, then before network 3 its status is `0`
and its `damaged` indicator is `1`. In network 3, its status is `1` and its damaged status is `1`.
After network 3, its status is `1` and its damaged indicator is `0`.
Before:
| nw_id | 1 | 2 | 3 | 4 |
| ------- | --- | --- | --- | --- |
| status | 1 | 1 | 1 | 1 |
| damaged | 1 | 1 | 1 | 1 |
Applying repair in network 3:
| nw_id | 1 | 2 | 3 | 4 |
| ------- | --- | --- | --- | --- |
| status | 0 | 0 | 1 | 1 |
| damaged | 1 | 1 | 1 | 0 |
PowerModelsRestoration.clean_status!
— Methodclean_status!(data::Dict{String,<:Any})
Replace near integer status values with integers (tol=1e-4) and set bus_type according to the status value.
Non-integer statuses may occur for due to numerical tolerance, where a component status may be reported as 1e-9 by a solver.
PowerModelsRestoration.clear_damage_indicator!
— Methodclear_damage_indicator!(network::Dict{String, <:Any})
Clear damage indicator and replace with damage=0
.
PowerModelsRestoration.count_active_components
— Methodcount_active_components(network::Dict{String, <:Any})
Count the number of components with an active component status.
PowerModelsRestoration.count_damaged_components
— Methodcount_damaged_components(network::Dict{String, <:Any})
Count the number of components with key "damaged" == 1
.
PowerModelsRestoration.count_inactive_components
— Methodcount_inactive_components(network::Dict{String, <:Any})
Count the number of components with an inactive component status.
PowerModelsRestoration.count_repairable_components
— Methodcount_repairable_components(network::Dict{String, <:Any})
Return the number of repairable components in a network.
PowerModelsRestoration.damage_components!
— Methoddamage_components!(nw_data::Dict{String,<:Any}, comp_list::Dict{String, Set{String}})
Set the damage indicator to 1 for components in the comp_list.
julia> damage_components!(network, Dict("bus"=>["1","3"]))
PowerModelsRestoration.get_active_components
— Methodget_active_components(network::Dict{String, <:Any})
Return a dictionary of the active component indices. A component is inactive if its status value is 1.
julia> get_active_components(network)
Dict{String, Set{String}} with 4 entries:
"gen" => Set(["4", "1", "2"])
"branch" => Set(["4", "1", "5", "2", "6", "7", "3"])
"storage" => Set(["1"])
"bus" => Set(["4"])
PowerModelsRestoration.get_damaged_components
— Methodget_damaged_components(network::Dict{String, <:Any})
Return a dictionary of the damaged component indices. A component is damaged if "damaged"==1
.
julia> get_damaged_components(network)
Dict{String, Set{String}} with 4 entries:
"gen" => Set(["4", "1", "2"])
"branch" => Set(["4", "1", "5", "2", "6", "7", "3"])
"storage" => Set(["1"])
"bus" => Set(["4"])
PowerModelsRestoration.get_inactive_components
— Methodget_inactive_components(network::Dict{String, <:Any})
Return a dictionary of the inactive component indices. A component is inactive if its status value is 0.
julia> get_inactive_components(network)
Dict{String, Set{String}} with 4 entries:
"gen" => Set(["4", "1", "2"])
"branch" => Set(["4", "1", "5", "2", "6", "7", "3"])
"storage" => Set(["1"])
"bus" => Set(["4"])
PowerModelsRestoration.get_isolated_load
— Methodget_isolated_load(data::Dict{String,<:Any})
Return a set of loads that are isolated (loads connected to an inactive bus).
PowerModelsRestoration.get_repairable_components
— Methodget_repairable_components(network::Dict{String, <:Any})
Return a dictionary of the repairable component indices. A component is repairable if "damaged"==1
and "status"=1
julia> get_repairable_components(network)
Dict{String, Set{String}} with 4 entries:
"gen" => Set(["4", "1", "2"])
"branch" => Set(["4", "1", "5", "2", "6", "7", "3"])
"storage" => Set(["1"])
"bus" => Set(["4"])
PowerModelsRestoration.make_inactive!
— Methodmake_inactive!(nw_data::Dict{String,<:Any}, comp_list::Dict{String, Set{String}})
Set the status indicator to 0 for components in the comp_list.
julia> make_inactive!(network, Dict("bus"=>["1","3"]))
PowerModelsRestoration.print_summary_restoration
— Methodprint_summary_restoration(data::Dict{String,<:Any})
prints a summary of a restoration solution to the terminal
PowerModelsRestoration.propagate_damage_status!
— Methodpropagate_damage_status!(data::Dict{String,<:Any})
Propagate the damaged indicator from buses to indicent branches, generators, and storage"
PowerModelsRestoration.replicate_restoration_network
— Methodreplicate_restoration_network(sn_data::Dict{String,<:Any}; count::Int=1, global_keys::Set{String}=Set{String}())
Transforms a single network into a multinetwork with several deepcopies of the original network. Start with nwid "0" before repairs are conducted, then count
number of preriods where repairs are performed. Add network keys for repairs
, the number of repairs that are allowed in each period, and repaired_total
, the cumulative repairs in the network. Also add time_elapsed
based on the number of repairs that occur in the following period.
PowerModelsRestoration.replicate_restoration_network
— Methodreplicate_restoration_network(sn_data::Dict{String,<:Any}; count::Int=1, global_keys::Set{String}=Set{String}())
Transforms a single network into a multinetwork with several deepcopies of the original network. Start with nwid "0" before repairs are conducted, then count
number of preriods where repairs are performed. Add network keys for repairs
, the number of repairs that are allowed in each period, and repaired_total
, the cumulative repairs in the network. Also add time_elapsed
based on the number of repairs that occur in the following period.
PowerModelsRestoration.replicate_restoration_network
— Methodreplicate_restoration_network(sn_data::Dict{String,<:Any}; count::Int=1, global_keys::Set{String}=Set{String}())
Transforms a single network into a multinetwork with several deepcopies of the original network. Start with nwid "0" before repairs are conducted, then count
number of preriods where repairs are performed. Add network keys for repairs
, the number of repairs that are allowed in each period, and repaired_total
, the cumulative repairs in the network. Also add time_elapsed
based on the number of repairs that occur in the following period.
PowerModelsRestoration.summary_restoration
— Methodsummary_restoration(io::IO, data::Dict{String,<:Any})
prints a summary of a restoration solution
PowerModelsRestoration.update_status!
— Methodupdate_status!(network_1::Dict{String, <:Any}, network_2::Dict{String, <:Any})
Update the status values in network1 with values from network2. Supports sparse networks.