Skip to content

Investigate the use of dictionaries instead of vectors for multi-conductor quantities #22

Open
@matteorossini

Description

@matteorossini

The current implementation of PowerModelsMCDC uses an hybrid approach to data structures:

  • dictionaries as a general data structure, providing hierarchy;
  • vectors (only at the leaves of the dict tree) to host multi-conductor quantities.

Problem

If we look at the $k$-th element of a vector, its meaning depends on another variable.

Example

Let's look at converter results in a solution dictionary. The meaning of pdc vector's elements depends on 2 parameters in input data (conv_confi and connect_at).

Bipolar converter:

julia> conv["1"]["pdc"]
3-element Vector{Float64}:
 1.2 # positive pole
 0.1 # metallic return
 1.4 # negative pole

Monopolar converter connected to positive and neutral terminal:

julia> conv["2"]["pdc"]
1-element Vector{Float64}:
 1.2 # positive pole
 0.1 # metallic return

Monopolar converter connected to negative and neutral terminal:

julia> conv["3"]["pdc"]
2-element Vector{Float64}:
 1.2 # negative pole
 0.1 # metallic return

Depending on the converter configuration:

  • the first element can refer to either positive or negative pole;
  • there may or may not be a third element.

Consequences of the problem

  • Developer side: we have to use look-up tables for bookkeeping.
  • User side: to interpret the content of solution dict, the input data dict is needed, too.

Why we have this problem?

Vectors have contiguous indices. E.g., cannot have v[2] if there is no v[1].

Possible solution

Use dictionaries.

Bipolar converter:

julia> conv["1"]["pdc"]
Dict{String, Any} with 3 entries:
  "p" => 1.2
  "r" => 0.1
  "n" => 1.4

Monopolar converter connected to positive and neutral terminal:

julia> conv["2"]["pdc"]
Dict{String, Any} with 2 entries:
  "p" => 1.2
  "r" => 0.1

Monopolar converter connected to negative and neutral terminal:

julia> conv["3"]["pdc"]
Dict{String, Any} with 2 entries:
  "r" => 0.1
  "n" => 1.4

Caveats

  • Need to investigate whether this choice would lead to unexpected consequences or awkward code patterns.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions