Data Models and Parsers
Parsers
PowerModelsITD.parse_files
— Functionfunction parse_files(
pm_file::String,
pmd_file::String,
pmitd_file::String;
multinetwork::Bool=false
auto_rename::Bool=false
)
Parses PowerModels, PowerModelsDistribution, and PowerModelsITD boundary linkage input files and returns a data dictionary with the combined information of the inputted dictionaries.
function parse_files(
pm_file::String,
pmd_files::Vector,
pmitd_file::String;
multinetwork::Bool=false,
auto_rename::Bool=false
)
Parses PowerModels, PowerModelsDistribution vector, and PowerModelsITD linkage input files and returns a data dictionary with the combined information of the inputted dictionaries.
PowerModelsITD.parse_json
— Functionfunction parse_json(
path::String
)
Parses a JavaScript Object Notation (JSON) file from the file path path
and returns a dictionary containing the corresponding parsed data. Primarily used for boundry linkage files.
PowerModelsITD.parse_link_file
— Functionfunction parse_link_file(
pmitd_file::String
)
Parses a linking file from the file pmitd_file
and returns a PowerModelsITD data structured linking network dictionary.
PowerModelsITD.parse_power_transmission_file
— Functionfunction parse_power_transmission_file(
pm_file::String;
skip_correct::Bool = true,
multinetwork::Bool=false,
number_multinetworks::Int=0
)
Parses a power transmission file from the file pm_file
and returns a PowerModels data structured pm network dictionary.
PowerModelsITD.parse_power_distribution_file
— Functionfunction parse_power_distribution_file(
pmd_file::String,
base_data::Dict{String,<:Any}=Dict{String, Any}();
unique::Bool=true,
multinetwork::Bool=false,
auto_rename::Bool=false,
ms_num::Int=1
)
Parses power distribution files from the file pmd_file
depending on the file extension. base_data
represents a dictionary that contains data from other pmd systems (serving as the base where all data will be combined), unique
represents if the pmd data provided is the first one passed or unique. If it is not unique
, then the components need to be renamed before being added. Returns a PowerModelsDistribution data structured pmd network (a dictionary) with renamed components (if applicable).
Data Transformations
PowerModelsITD.apply_kron_reduction!
— Methodfunction apply_kron_reduction!(
pmitd_data::Dict{String,<:Any}
)
Applies the corresponding transformation that applies a Kron Reduction to the network, reducing out the kr_neutral
, leaving only the kr_phases
.
PowerModelsITD.apply_phase_projection!
— Methodfunction apply_phase_projection!(
pmitd_data::Dict{String,<:Any}
)
Applies the corresponding transformation to apply phase projection: pad matrices and vectors to max number of conductors
PowerModelsITD.apply_phase_projection_delta!
— Methodfunction apply_phase_projection_delta!(
pmitd_data::Dict{String,<:Any}
)
Applies the corresponding transformation to apply phase projection delta for components where unprojected states are not yet supported (delta configurations). See [apply_phase_projection!
]
PowerModelsITD.apply_voltage_angle_difference_bounds!
— Functionfunction apply_voltage_angle_difference_bounds!(
pmitd_data::Dict{String,<:Any},
vad::Real=5.0
)
Applies the corresponding transformation of voltage angle difference bound given by vad::Real
in degrees (i.e., the allowed drift of angle from one end of a line to another) to all lines, to the pmd
dictionary.
PowerModelsITD.apply_voltage_bounds!
— Methodfunction apply_voltage_bounds!(
pmitd_data::Dict{String,<:Any};
vm_lb::Union{Real,Missing}=0.9,
vm_ub::Union{Real,Missing}=1.1
)
Applies the corresponding transformation of voltage bounds to all buses based on per-unit upper (vm_ub
) and lower (vm_lb
) bounds, scaled by the bus' voltage, to the pmd
dictionary.
PowerModelsITD.make_lossless!
— Methodfunction make_lossless!(
pmitd_data::Dict{String,<:Any}
)
Applies the corresponding transformation that removes parameters from objects with loss models to make them lossless. This includes switches voltage sources and transformers, which all have loss model parameters that can be omitted.
PowerModelsITD.remove_all_bounds!
— Functionfunction remove_all_bounds!(
pmitd_data::Dict{String,<:Any};
exclude::Vector{<:String}=String["energy_ub"]
)
Applies the corresponding transformation that removes all fields ending in 'ub' or 'lb' that aren't required by the math model. Properties can be excluded from this removal with exclude::Vector{String}
. By default, "energy_ub"
is excluded from this removal, since it is a required property on storage (in pmd).
Data Checking and Units Correction
PowerModelsITD.correct_network_data!
— Functionfunction correct_network_data!(
data::Dict{String,<:Any};
multinetwork::Bool=false
)
Corrects and prepares the data in both pm and pmd dictionaries. Also, assigns the ids given in the boundary linking data to number buses. data
is the pmitd dictionary to be corrected and multinetwork
is the boolean that defines if there are multinetwork boundary buses to be assigned.
PowerModelsITD.assign_boundary_buses!
— Functionfunction assign_boundary_buses!(
data::Dict{String,<:Any};
multinetwork::Bool=false
)
Assigns the names given in the boundary linking data to number buses in corresponding transmission and distribution networks. data
is the pmitd dictionary containing the boundary information and multinetwork
is the boolean that defines if there are multinetwork boundary buses to be assigned.
PowerModelsITD.resolve_units!
— Functionfunction resolve_units!(
data::Dict{String,<:Any};
multinetwork::Bool=false,
number_multinetworks::Int=0
)
Resolve the units used throughout the disparate datasets by setting the same settings bases. data
is the pmitd dictionary to be corrected by resolving units, multinetwork
is the boolean that defines if there are multiple networks that need to be corrected, and number_multinetworks
defines the number of multinetworks.
PowerModelsITD.replicate
— Functionfunction replicate(
sn_data::Dict{String,<:Any},
count::Int;
global_keys::Set{String}=Set{String}()
)
Turns in given single network pmitd data in multinetwork data with a count
replicate of the given network. Note that this function performs a deepcopy of the network data. Significant multinetwork space savings can often be achieved by building application specific methods of building multinetwork with minimal data replication. sn_data
is the data to be replicated, count
is the number of networks to be replicated.
PowerModelsITD.sol_data_model!
— Functionfunction sol_data_model!(
pmitd::AbstractPowerModelITD,
solution::Dict{String,<:Any}
)
solution_processor to convert the solution(s) to polar voltage magnitudes and angles.
PowerModelsITD.calc_transmission_branch_flow_ac!
— Functionfunction calc_transmission_branch_flow_ac!(
result::Dict{String,<:Any},
pmitd_data::Dict{String,<:Any};
)
Assumes a valid ac solution is included in the result and computes the branch flow values. Returns the pf solution inside the pmitd_data
dictionary (not the result
dictionary). Replicates the _PM function but compatible with PMITD dicitionary.
PowerModelsITD.transform_pmitd_solution_to_eng!
— Functionfunction transform_pmitd_solution_to_eng!(
result::Dict{String,<:Any},
pmitd_data::Dict{String,<:Any}
)
Transforms the PMITD solution from MATH to ENG model. This transformation facilitates the conversion in "pmitd" of buses numbers to buses names according to the ENG model. Ex: (100002, 9, 6) -> (100002, voltagesource.3busunbalnogenmn_2.source, 6)