Internals

Index

Types

EnergyModelsGUI.Connection — Type
Connection <: AbstractGUIObj

Mutable type for providing a flexible data structure for connections between EnergySystemDesigns.

Fields

  • from::EnergySystemDesign is the EnergySystemDesign from which the connection originates.
  • to::EnergySystemDesign is the EnergySystemDesign to which the connection is linked.
  • connection::AbstractElement is the EMX connection structure.
  • parent::EnergySystemDesign is the parent EnergySystemDesign of the connection.
  • colors::Vector{RGBA{Float32}} are the associated colors of the connection.
  • inv_data::Vector{ProcInvData} stores processed investment data.
  • regular_plots::Vector{Makie.AbstractPlot} is a vector with all regular plots associated with the connection.
  • simplified_plots::Vector{Makie.AbstractPlot} is a vector with all simplified plots associated with the connection.
  • alpha::Vector{Observable{Float32}} is the alpha value of the connection, observed for changes. For each line it controls the alpha value, which is used to toggle the visibility of the line when the connection has not been invested in.
source
EnergyModelsGUI.EnergySystemIterator — Type
EnergySystemIterator

Type for iterating over nested EnergySystemDesign structures, enabling recursion through AbstractGUIObjs.

Fields

  • stack::Vector{<:AbstractGUIObj} is the stack used to manage the iteration through the nested EnergySystemDesign components (and its connections). It starts with the initial EnergySystemDesign object and progressively includes its subcomponents as the iteration proceeds.
source
EnergyModelsGUI.PlotContainer — Type
PlotContainer{T}

Type for storing plot-related data available from the "Data" menu.

Fields

  • name::String: is the reference name for the data.
  • selection::Vector: is the indices used to extract the data to be plotted.
  • field_data::Any: is the data from which plots are extracted based on selection.
  • description::String: is the description to be used for the legend.
source
EnergyModelsGUI.ProcInvData — Type
ProcInvData

Type for storing processed investment data.

Fields

  • id::String is the identifier for structures that have TransmissionModes (default is thus an empty string).
  • inv_times::Vector{String} is a vector of formatted strings for added investments.
  • capex::Vector{Float64} contains the capex of all times with added investments.
  • invested::Observable{Bool} indicates if the element has been invested in.
source
EnergyModelsGUI.System — Type
System

Type for storing processed system data from EnergyModelsBase.

Fields

  • T::TimeStructure is the time structure of the model.
  • products::Vector{<:Resource} are the resources that should be incorporated into the model.
  • elements::Vector{Vector} are the vectors of AbstractElement that should be included in the analysis.
  • children::Vector{<:EMB.Node} are the children of the system.
  • connections::Vector{<:Link} are the connections between system parts.
  • parent::AbstractElement is the parent of the system (a NothingElement for the top level system, otherwise the element, e.g., an Area, that the system belongs to).
  • ref_element::AbstractElement is the reference element of the system (first Availability node, or NothingElement if there is none).
source
EnergyModelsGUI.SystemGeo — Type
SystemGeo

Type for storing processed system data from EnergyModelsGeography.

Fields

  • T::TimeStructure is the time structure of the model.
  • products::Vector{<:Resource} are the resources that should be incorporated into the model.
  • elements::Vector{Vector} are the vectors of AbstractElement that should be included in the analysis.
  • children::Vector{<:AbstractElement} are the children of the system (the Areas).
  • connections::Vector{<:AbstractElement} are the connections between system parts (the Transmissions).
  • parent::AbstractElement is the parent of the system.
  • ref_element::AbstractElement is the reference element of the system (the first Area).
source

Functions

Base.iterate — Function
iterate(itr::EnergySystemIterator, state = nothing)

Iterate over an EnergySystemIterator, returning the next object of the stack (an EnergySystemDesign or a Connection) and the index of that object as the new state. Without state, the first object is returned. If the end of the stack is reached, return nothing.

source
EnergyModelsGUI._type_to_header — Method
_type_to_header(::Type{<:TS.AbstractStrategicPeriod})
_type_to_header(::Type{<:TS.AbstractRepresentativePeriod})
_type_to_header(::Type{<:TS.AbstractOperationalScenario})
_type_to_header(::Type{<:TS.TimePeriod})
_type_to_header(::Type{<:TS.TimeStructure})
_type_to_header(::Type{<:TS.PeriodPartition})
_type_to_header(::Type{<:Resource})
_type_to_header(::Type{<:AbstractElement})
_type_to_header(::Type{<:Int})

Map types to header symbols for saving results.

source
EnergyModelsGUI.add_component! — Method
add_component!(gui::GUI, component::EnergySystemDesign)

Draw a box containing the icon and add a label with the id of the EnergySystemDesign component.

source
EnergyModelsGUI.add_description! — Method
add_description!(
    field::Any,
    name::String,
    key_str::String,
    pre_desc::String,
    selection::Vector,
    available_data::Vector{PlotContainer},
    gui::GUI,
)

Loop through all struct fieldnames of field (i.e., for the field level of type NoStartInvData) and update available_data with an added description.

source
EnergyModelsGUI.add_description! — Method
add_description!(
    field::Dict,
    name::String,
    key_str::String,
    pre_desc::String,
    selection::Vector,
    available_data::Vector{PlotContainer},
    gui::GUI,
)

Loop through all dictnames for a field of type Dict (e.g. for the field penalty having the keys :deficit and :surplus) and update available_data with an added description.

source
EnergyModelsGUI.add_description! — Method
add_description!(
    field::TS.TimeProfile,
    name::String,
    key_str::String,
    pre_desc::String,
    selection::Vector,
    available_data::Vector{PlotContainer},
    gui::GUI,
)

Create a container with a description, and add container to available_data.

source
EnergyModelsGUI.add_description! — Method
add_description!(
    field::Vector,
    name::String,
    key_str::String,
    pre_desc::String,
    selection::Vector,
    available_data::Vector{PlotContainer},
    gui::GUI,
)

Loop through all elements of field of type Vector (i.e., for the field data) and update available_data with an added description.

source
EnergyModelsGUI.align — Method
align(gui::GUI, align::Symbol)

Align components in get_selected_systems(gui) based on the value of Symbol align.

The following values are allowed

  • :horizontal for horizontal alignment.
  • :vertical for vertical alignment.
source
EnergyModelsGUI.angle — Method
angle(node_1::EnergySystemDesign, node_2::EnergySystemDesign)

Based on the location of node_1 and node_2, return the angle between the x-axis and node_2 with node_1 being the origin.

source
EnergyModelsGUI.box — Method
box(x::Float32, y::Float32, Δ::Float32)

Get the coordinates of a box with half side lengths Δ and centered at (x,y) starting at the upper right corner, returned as the vectors xs and ys of a closed path.

source
EnergyModelsGUI.clear_selection! — Method
clear_selection!(gui::GUI, ax_type::Symbol)

Clear the color selection of the topology axis if ax_type = :topo, and of the results axis if ax_type = :results.

source
EnergyModelsGUI.connect! — Method
connect!(gui::GUI, connection::Connection, two_way::Bool)

Draw the lines and the arrows of connection. If two_way is true, a connection in the opposite direction exists and the lines are shifted to separate the two.

source
EnergyModelsGUI.connect! — Method
connect!(gui::GUI, design::EnergySystemDesign)

Draws lines between connected nodes/areas in GUI gui using EnergySystemDesign design.

source
EnergyModelsGUI.convert_partitions — Method
convert_partitions(df::DataFrame, 𝒯::TimeStructure, varname::Symbol)

Convert the string representations of the TS.PeriodPartitions in column :pd of df to the partitions themselves and store them in column :t.

As the string representation of a partition does not include its operational periods and the partitions may differ between elements, the partitions are reconstructed for each element in column :element through period_partitions. Rows whose partition cannot be reconstructed are removed with a warning highlighting the element.

source
EnergyModelsGUI.create_label — Method
create_label(selection::PlotContainer)

Return a label for a given selection to be used in the getmenus(gui)[:availabledata] menu.

source
EnergyModelsGUI.create_makie_objects — Method
create_makie_objects(vars::Dict, design::EnergySystemDesign)

Create Makie figure and all its objects (buttons, menus, toggles, sliders, legends and axes) for EnergySystemDesign design and the options vars. Returns the tuple (fig, buttons, menus, toggles, sliders, axes, legends).

source
EnergyModelsGUI.design_file — Method
design_file(system::AbstractSystem, path::String)

Construct and return the path for the .yml file for system in the folder path (an empty string if path is empty).

source
EnergyModelsGUI.draw_box! — Method
draw_box!(gui::GUI, design::EnergySystemDesign)

Draw a box for EnergySystemDesign design and its appearance, including style, color, size.

source
EnergyModelsGUI.export_svg — Method
export_svg(ax::Makie.Block, filename::String; legend=nothing)

Export the ax to a .svg file with path given by filename. The optional keyword argument legend is a Makie.Legend that is added to the exported file.

Temporary approach

This approach awaits solution from issue https://github.com/MakieOrg/Makie.jl/issues/4500

source
EnergyModelsGUI.export_to_file — Method
export_to_file(gui::GUI)

Export results based on the state of gui to a file located within the folder specified through the path_to_results keyword of GUI. The file name and format are given by the menus :axes and :export_type. Returns 0 on success, 1 if the combination of axes and file format is not supported, and 2 if an error occurred (nothing is returned if path_to_results is empty).

source
EnergyModelsGUI.export_xlsx — Method
export_xlsx(gui::GUI, filename::String)

Export the variables of the JuMP model of gui to an xlsx file (one sheet per variable) with path given by filename. Returns 0 on success and 1 if the model is empty.

source
EnergyModelsGUI.export_xlsx — Method
export_xlsx(plots::Vector, filename::String, xlabel::Symbol)

Export the plots to a .xlsx file with path given by filename and top header xlabel for the first column. Returns 0 on success and 1 if plots is empty.

source
EnergyModelsGUI.extract_data_selection — Method
extract_data_selection(var::SparseVars, selection::Vector, i_T::Int64, periods::Vector)
extract_data_selection(var::JuMP.Containers.DenseAxisArray, selection::Vector, i_T::Int64, ::Vector)
extract_data_selection(var::DataFrame, selection::Vector, ::Int64, ::Vector)

Extract data from var having its time dimension at index i_T for all time periods in periods.

Reading model results from CSV-files

This function does not support more than three indices for var::DataFrame (i.e., when model results are read from CSV-files). This implies it is incompatible with potential extensions that introduce more than three indices for variables.

source
EnergyModelsGUI.extract_svg — Method
extract_svg(svg_string)

Extract the raw SVG content from the SVG string svg_string. Returns the content between the opening <svg ...> and closing </svg> tags and the header preceding the content (both empty strings if svg_string is empty).

source
EnergyModelsGUI.filter_partitions — Method
filter_partitions(
    pds::Vector{<:TS.PeriodPartition}, sp::Int64, rp::Int64, sc::Int64,
)

Filter the TS.PeriodPartitions pds to the strategic period sp, representative period rp, and scenario sc (indices not present in the partitions are ignored).

source
EnergyModelsGUI.find_icon — Method
find_icon(system::AbstractSystem, id_to_icon_map::Dict)

Find the icon associated with a given system's node id utilizing the mapping provided through id_to_icon_map, with a lookup by id taking precedence over a lookup by type. An empty string is returned if no icon is found.

source
EnergyModelsGUI.find_icon_path — Method
find_icon_path(icon::String)

Search for the path to the .png file of the icon based on the icon name icon (without file ending). The search covers icon as a path, the icons folder of EnergyModelsGUI, and the folder ext/EMGUIExt/icons of installed EnergyModels packages. An empty string is returned if no icon is found.

source
EnergyModelsGUI.find_min_max_coordinates — Method
find_min_max_coordinates(
    design::EnergySystemDesign,
    min_x::Number,
    max_x::Number,
    min_y::Number,
    max_y::Number
)

Find the minimum and maximum coordinates of the components of EnergySystemDesign design given the minimum and maximum coordinates min_x, max_x, min_y, and max_y. The updated values are returned as the tuple (min_x, max_x, min_y, max_y).

source
EnergyModelsGUI.find_min_max_coordinates — Method
find_min_max_coordinates(design::EnergySystemDesign)

Find the minimum and maximum coordinates of the components of EnergySystemDesign design, returned as the tuple (min_x, max_x, min_y, max_y).

source
EnergyModelsGUI.find_type_field — Method
find_type_field(dict::Dict, x::Any)

Return the closest supertype of x (including its own type) that is a key of dict, or Nothing if there is none.

source
EnergyModelsGUI.get_EMGUI_obj — Method
get_EMGUI_obj(plt)

Get the EnergySystemDesign/Connection associated with plt. Note that due to the nested structure of Makie, we must iteratively look through up to three nested layers to find where this object is stored.

source
EnergyModelsGUI.get_JuMP_dict — Method
get_JuMP_dict(model::Model)
get_JuMP_dict(model::Dict)

Get the dictionary of the model results. If the model is a JuMP.Model, it returns the object dictionary. If the model is a Dict (results read from CSV-files), the entry :metadata is excluded.

source
EnergyModelsGUI.get_all_periods! — Method
get_all_periods!(vec::Vector, per, ::TwoLevel)
get_all_periods!(vec::Vector, per, ::RepresentativePeriods)
get_all_periods!(vec::Vector, per, ::OperationalScenarios)
get_all_periods!(vec::Vector, per, ::SimpleTimes)
get_all_periods!(::Vector, per, ::Any)

Get all TimeStructures in per and append them to vec. The required time structures are automatically deduced from the internal structure of per.

source
EnergyModelsGUI.get_all_periods — Method
get_all_periods(𝒯::TimeStructure)

Get all TimeStructures and TimePeriods in 𝒯 as a dictionary with their string representation as keys.

source
EnergyModelsGUI.get_change — Method
get_change(::GUI, ::Val)

Handle different keyboard inputs (events) and return changes in x, y coordinates in the design object gui.

source
EnergyModelsGUI.get_combinations — Method
get_combinations(var::SparseVars, i_T::Int)
get_combinations(var::JuMP.Containers.DenseAxisArray, i_T::Int)
get_combinations(var::DataFrame, ::Int)

Get an iterator of combinations of unique indices excluding the time index located at index i_T.

source
EnergyModelsGUI.get_component — Method
get_component(designs::Vector{EnergySystemDesign}, id)
get_component(designs::EnergySystemDesign, id)

Extract the component from a vector of EnergySystemDesign(s) that has a parent with the given id.

source
EnergyModelsGUI.get_data — Method
get_data(data::String)
get_data(data::DataFrame)

Get the data from a string path to a CSV file or directly from a DataFrame.

source
EnergyModelsGUI.get_data — Method
get_data(
    model::Union{JuMP.Model, Dict},
    selection::PlotContainer,
    T::TS.TimeStructure,
    sp::Int64,
    rp::Int64,
    sc::Int64,
)

Get the values from the JuMP model, or the input data, at selection for all periods in T restricted to strategic period sp, representative period rp, and scenario sc.

Return the periods, the corresponding values, and the time axis (e.g., :results_op).

source
EnergyModelsGUI.get_element — Method
get_element(design::EnergySystemDesign)

Returns the system node (i.e., availability node for areas) of a EnergySystemDesign design.

source
EnergyModelsGUI.get_element_label — Method
get_element_label(element)

Get the label of the element based on its id field. If the id is a number it returns the built in Base.display() functionality of node, otherwise, the id field is converted to a string. For a Link, the labels of from and to are joined by -.

source
EnergyModelsGUI.get_inv_objs — Method
get_inv_objs(obj::AbstractElement)

Get the objects for which investment information should be stored for a given AbstractElement. By default, this is just the element itself, but for some elements (e.g., Transmission) it can be relevant to also store the investment information of related objects (e.g., its modes).

source
EnergyModelsGUI.get_investment_times — Method
get_investment_times(gui::GUI, max_inst::Float64)

Calculate when investments have taken place and store the information. An investment is assumed to have taken place if any investment_indicators are larger than get_var(gui, :tol) relative to max_inst.

source
EnergyModelsGUI.get_jump_axis_types — Method
get_jump_axis_types(data::JuMP.Containers.DenseAxisArray)
get_jump_axis_types(data::SparseVars)
get_jump_axis_types(data::DataFrame)

Get the types for each axis in the data.

source
EnergyModelsGUI.get_max_installed — Method
get_max_installed(n, t::Vector{<:TS.TimeStructure})

Get the maximum capacity installable by an investment in the node n over the time periods t (zero if n has no investments). For a Storage, the maximum over the charge, level, and discharge capacities is returned.

source
EnergyModelsGUI.get_mode_to_transmission_map — Method
get_mode_to_transmission_map(::System)

Dispatchable function to get the mapping between modes and transmissions. It returns an empty Dict for a System and is overloaded for a SystemGeo in EMGExt.

source
EnergyModelsGUI.get_nth_field — Method
get_nth_field(s::String, delimiter::Char, n::Int)

Get the n'th value of a string s separated by the character delimiter (an empty string if s has fewer than n values).

source
EnergyModelsGUI.get_partition_periods — Method
get_partition_periods(selection::JuMPContainer, ::TS.TimeStructure)
get_partition_periods(selection::PlotContainer, T::TS.TimeStructure)

Get all TS.PeriodPartitions for the data in selection, either from the time periods of the extracted JuMP data (sorted through partition_sort_key) or, for case data, constructed from the element itself (see period_partitions).

source
EnergyModelsGUI.get_periods — Method
get_periods(T::TS.TimeStructure, type::Type, sp::Int64, rp::Int64, sc::Int64)

Get the periods for a given TimePeriod/TimeProfile type (e.g., TS.StrategicPeriod, TS.RepresentativePeriod, TS.OperationalPeriod) restricted to the strategic period sp, representative period rp and the scenario sc.

source
EnergyModelsGUI.get_plots — Method
get_plots(conn::Connection, simplified::Bool)

Returns the plots field of a Connection conn based on the simplified flag.

source
EnergyModelsGUI.get_resource_colors — Method
get_resource_colors(resources::Vector{<:Resource}, id_to_color_map::Dict{Any,Any})

Get the colors linked to the resources in resources based on the mapping id_to_color_map.

source
EnergyModelsGUI.get_scenario_indices — Method
get_scenario_indices(T::TS.TimeStructure, sp::Int64, rp::Int64)

Return indices of the scenarios in the time structure T for strategic period number sp and representative period rp.

source
EnergyModelsGUI.get_sector_points — Method
get_sector_points(;
    c::Point2f = Point2f(0.0f0, 0.0f0),
    Δ::Float32 = 1.0f0,
    θ₁::Float32 = 0.0f0,
    θ₂::Float32 = π32 / 4,
    steps::Int = 200,
    geometry::Symbol = :circle)

Get points for the boundary of a sector defined by the center c, radius/half side length Δ, and angles θ₁ and θ₂ for a square (geometry = :rect), a circle (geometry = :circle), or a triangle (geometry = :triangle).

source
EnergyModelsGUI.get_supertypes — Method
get_supertypes(input) -> Dict{Symbol, Vector{Type}}

Retrieves the supertypes of all defined types from modules or packages.

Method Overloads

  • get_supertypes(modul::Module): Returns a dictionary mapping type names to their supertypes from the given module.

  • get_supertypes(moduls::Vector{Module}): Merges and returns supertypes from multiple modules.

Arguments

  • input: Can be a single module or a vector of modules.

Returns

  • Dict: A dictionary where each key is a type name and the value is a vector of its supertypes.

Description

This set of functions helps extract the inheritance hierarchy of types defined in Julia modules or packages. It filters out non-type bindings and collects supertypes using supertypes. The supertypes are ordered starting with the type itself.

source
EnergyModelsGUI.get_time_axis — Method
get_time_axis(
    data::Union{
        JuMP.Containers.DenseAxisArray,
        JuMP.Containers.SparseAxisArray,
        SparseVariables.IndexedVarArray,
        DataFrames.DataFrame,
    },
)

Get the index of the axis/column of data (i.e., from a JuMP variable) corresponding to a TS.TimePeriod, TS.TimeStructure, or TS.PeriodPartition and return this index (i_T) alongside its TimeStruct type (both nothing if there is no such axis).

source
EnergyModelsGUI.get_time_periods — Method
get_time_periods(field_data::DataFrame)
get_time_periods(field_data)

Get the time periods of the extracted data field_data of a JuMP variable, i.e., the column :t if the model results are read from CSV-files and the first axis otherwise.

source
EnergyModelsGUI.get_total_sum_time — Method
get_total_sum_time(data::JuMP.Containers.DenseAxisArray, ::Vector{<:TS.TimeStructure})
get_total_sum_time(data::DataFrame, periods::Vector{<:TS.TimeStructure})

Get the total sum of data over all indices except the time for each period in periods.

source
EnergyModelsGUI.get_types — Method
get_types(input) -> Vector{Symbol}

Retrieves the names of all defined types from modules or packages (exported names only).

Method Overloads

  • get_types(modul::Module): Returns a vector of type names defined in the given module.

  • get_types(moduls::Vector{Module}): Returns a vector containing one vector of type names per module.

  • get_types(pkg::Union{String, Symbol}): Converts the package name to a module (via Main) and returns its defined types.

  • get_types(pkgs::Union{Vector{<:Union{String, Symbol}}, Set{<:Union{String, Symbol}}}): Returns a vector containing one vector of type names per package.

Arguments

  • input: Can be a single module, a vector of modules, a single package name (as String or Symbol), or a collection of package names.

Returns

  • Vector{Symbol} for a single module or package: A list of names corresponding to types defined in it. A vector of such vectors for a collection of modules or packages.

Description

This set of functions helps extract type definitions from Julia modules or packages. It filters out non-type bindings and collects only those that are (possibly parametric) DataTypes.

Example

get_types(Base)  # returns type names defined in Base

get_types(["Base", "Core"])  # returns type names from both packages
source
EnergyModelsGUI.get_types_structure — Method
get_types_structure(emx_supertypes_dict::Dict{Any, Vector{Type}}) -> Dict{Type, Union{Dict, Nothing}}

Constructs a nested dictionary representing type dependencies from a dictionary of supertypes.

Arguments

  • emx_supertypes_dict::Dict{Any, Vector{Type}}: A dictionary where each key corresponds to a type identifier, and the value is a vector of supertypes ordered from the most specific (the type itself) to the most general.

Returns

  • Dict{Type, Union{Dict, Nothing}}: A nested dictionary structure where each type is a key pointing to its subtype hierarchy. Leaf nodes point to an empty Dict.

Description

This function builds a tree-like structure of type dependencies by iterating through each type's supertypes and nesting them accordingly. It uses the helper function update_tree! to insert types into the correct level of the hierarchy.

source
EnergyModelsGUI.get_values — Method
get_values(vals::SparseVars)
get_values(vals::JuMP.Containers.DenseAxisArray)
get_values(vals::DataFrame)
get_values(vals::JuMP.Containers.SparseAxisArray, ts::Vector)
get_values(vals::SparseVariables.IndexedVarArray, ts::Vector)
get_values(vals::JuMP.Containers.DenseAxisArray, ts::Vector)
get_values(vals::DataFrame, ts::Vector)
get_values(vals::DataFrame, ts::Vector{<:TS.PeriodPartition})
get_values(vals::TimeProfile, ts::Vector)

Get the values of the variables in vals. If a vector of time periods ts is provided, it returns the values for the times in ts. For TS.PeriodPartitions read from CSV-files, the values are returned in the order of ts.

source
EnergyModelsGUI.get_var_periods — Method
get_var_periods(var::SparseVars, selection::Vector, i_T::Int64)

Get the sorted time indices available in var at axis i_T for the combination selection of the remaining indices. This is required for variables indexed over TS.PeriodPartitions as the partitions may differ between elements.

source
EnergyModelsGUI.getfirst — Method
getfirst(f::Function, a::Vector)

Return the first element of Vector a satisfying the requirement of Function f, or nothing if there is none.

source
EnergyModelsGUI.has_fields — Method
has_fields(type::Type) -> Bool

Checks whether a given type is a struct type with at least one field.

Arguments

  • type: The type to be inspected (a UnionAll is unwrapped first).

Returns

  • Bool: Returns true if the type is a struct type and has one or more fields; otherwise, returns false.

Description

This function combines three checks:

  • type isa DataType: Ensures the type is a DataType.
  • isstructtype(type): Ensures the type is a struct.
  • nfields(type) > 0: Ensures the struct has at least one field.

Example

struct MyStruct
    x::Int
end

has_fields(MyStruct)  # returns true

abstract type AbstractType end
has_fields(AbstractType)  # returns false
source
EnergyModelsGUI.has_invested — Method
has_invested(data::ProcInvData)
has_invested(data::EnergySystemDesign)

Returns an observable of the boolean indicator for if investment has occurred.

source
EnergyModelsGUI.inherit_descriptive_names_from_supertypes! — Method
inherit_descriptive_names_from_supertypes!(descriptive_names, emx_supertypes_dict)

Copies descriptive field names from supertypes to subtypes in the descriptive_names dictionary.

Arguments

  • descriptive_names::Dict: A dictionary containing descriptive names for structure fields,

organized by type.

  • emx_supertypes_dict::Dict: A dictionary mapping type identifiers to arrays of types,

where the first element is the type itself and the remaining elements are its supertypes.

Description

For each type in emx_supertypes_dict, this function checks if the type has fields. For each field, it looks for descriptive names in the supertypes. If a descriptive name exists for a field in a supertype but not in the subtype, it copies the descriptive name from the supertype to the subtype.

Modifies

  • Updates descriptive_names in-place by inheriting missing descriptive names from supertypes.
source
EnergyModelsGUI.initialize_plot! — Method
initialize_plot!(gui::GUI, design::EnergySystemDesign)

Initialize the plot of the topology of design object gui given an EnergySystemDesign design.

source
EnergyModelsGUI.installed — Method
installed()

Get a dictionary of the direct dependencies (with versions) of the active environment (replacement for the deprecated Pkg.installed()).

source
EnergyModelsGUI.instantiate_inv_data — Method
instantiate_inv_data(element::AbstractElement)

Instantiate the inv_data field for an AbstractElement by creating a vector of ProcInvData. This function can be specialized for different types of AbstractElement to handle specific cases, such as Transmission where multiple modes may require separate ProcInvData instances.

source
EnergyModelsGUI.is_partition_data — Method
is_partition_data(container::PlotContainer)

Return true if container holds data indexed over TS.PeriodPartitions, i.e., a JuMP variable with a TS.PeriodPartition axis or a field of type PartitionProfile.

source
EnergyModelsGUI.new_global_delta_h — Method
new_global_delta_h(gui::GUI)

Recalculate the sizes of the boxes in get_axes(gui)[:topo] such that their size is independent of zooming and resizing the window.

source
EnergyModelsGUI.outer_bbox — Method
outer_bbox(ax::Makie.AbstractAxis; padding::Number = 0)

Compute the outer bounding box of the axis ax with additional padding.

source
EnergyModelsGUI.parse_case — Method
parse_case(case::Case)

Parse the case and return an AbstractSystem instance (SystemGeo if the case includes elements from the EnergyModelsGeography package, otherwise System).

source
EnergyModelsGUI.partition_sort_key — Method
partition_sort_key(pd::TS.PeriodPartition)

Return a sort key for the TS.PeriodPartition pd given by the tuple of its strategic period, representative period, scenario, and partition indices (indices not present in pd are set to zero).

source
EnergyModelsGUI.period_partitions — Method
period_partitions(element, T::TS.TimeStructure)

Return the vector of TS.PeriodPartitions partitioning the operational periods of T for element.

By default, the partitions are constructed from the field period_duration of element (the convention introduced by, e.g., PeriodDemandSink in EnergyModelsFlex). Elements that store the partition duration differently require a specialized method of this function. If the partitions cannot be determined, a warning highlighting element is issued and an empty vector is returned.

source
EnergyModelsGUI.pick_component! — Method
pick_component!(gui::GUI, ax_type::Symbol)
pick_component!(gui::GUI, plt::AbstractPlot, ax_type::Symbol)
pick_component!(gui::GUI, element::AbstractGUIObj, ::Symbol)
pick_component!(gui::GUI, element::Dict, ::Symbol)
pick_component!(gui::GUI, ::Nothing, ax_type::Symbol)

Check if a system is found under the mouse pointer and if it is an AbstractGUIObj (for objects in the topology axis) or a Dict (for objects in the results axis). If found, state variables are updated. Otherwise, the selection in the topology axis is only cleared if ax_type = :topo and the selection in the results axis if ax_type = :results.

source
EnergyModelsGUI.place_nodes_in_circle — Method
place_nodes_in_circle(n::Int64, i::Int64, r::Float32, c::Point2f)

Return coordinate for point number i of a total of n points evenly distributed around a circle of radius r centered at c from -π/4 to 5π/4 (point 1 at 5π/4; a single point is placed at π).

source
EnergyModelsGUI.plot_design! — Method
plot_design!(
    gui::GUI, design::EnergySystemDesign; visible::Bool=true, expand_all::Bool=true
)

Set the visibility of design to visible and recursively of its components. If expand_all is false, only the component equal to get_design(gui) is visible.

source
EnergyModelsGUI.print_nested_structure! — Method
print_nested_structure!(
    element,
    io::IOBuffer,
    indent::Int64,
    vector_limit::Int64,
    show_the_n_last_elements::Int64,
)

Append the nested structure of element in a nice format to the io buffer. The parameter indent tracks the indentation level, the parameter vector_limit is used to truncate large vectors and show_the_n_last_elements specifies how many of the last elements to show.

source
EnergyModelsGUI.read_csv — Method
read_csv(file::String)

Read a CSV file and return it as a DataFrame. The time column is renamed to :t if it is named "t", "sp", "rp", "osc", or "op".

source
EnergyModelsGUI.rename_time_column! — Method
rename_time_column!(df::DataFrame)

Rename the time column in df to :t if it is named "t", "sp", "rp", "osc", or "op". If more than one of these columns are present, an error is thrown.

source
EnergyModelsGUI.save_design — Method
save_design(design_dict::Dict, file::String)

Save the x,y-coordinates stored in design_dict to a .yml file at location and filename given by file.

source
EnergyModelsGUI.save_design — Method
save_design(design::EnergySystemDesign)

Save the x,y-coordinates of the components of EnergySystemDesign design (including its sub designs) to a .yml file specified in the field file of design.

source
EnergyModelsGUI.scroll_ylim — Method
scroll_ylim(ax::Makie.AbstractAxis, val::Float64)

Shift the ylim with val units to mimic scrolling feature of an axis ax (the limits are reset to (0, 1) if the upper limit would exceed 1).

source
EnergyModelsGUI.select_data! — Method
select_data!(gui::GUI, name::String; selection::Vector = Any[], fun::Function = findfirst)

Select the data with name name from the available_data menu. If selection is provided, it is used to further specify which data to select. The fun argument is used to specify the function for finding the data in the menu (default is findfirst).

source
EnergyModelsGUI.square_intersection — Method
square_intersection(c::Point2f, θ::Float32, Δ::Float32)

Calculate the intersection point between a line starting at c and direction described by θ and a square with half side lengths Δ centered at center c.

source
EnergyModelsGUI.square_intersection — Method
square_intersection(c::Point2f, x::Point2f, θ::Float32, Δ::Float32)

Calculate the intersection point between a line starting at x and direction described by θ, and a square with half side lengths Δ centered at center c. If the line does not intersect the square, the extension of the two facing sides to x will be used instead.

source
EnergyModelsGUI.sub_system — Method
sub_system(system::System, element::AbstractElement)

Create a sub-system of system with the element as the parent and reference node.

source
EnergyModelsGUI.toggle_selection_color! — Method
toggle_selection_color!(gui::GUI, selection::EnergySystemDesign, selected::Bool)
toggle_selection_color!(gui::GUI, selection::Connection, selected::Bool)
toggle_selection_color!(gui::GUI, selection::Dict{Symbol,Any}, selected::Bool)

Set the color of selection to get_selection_color(gui) if selected, and its original color otherwise using the argument selected.

source
EnergyModelsGUI.transfer_model — Method
transfer_model(model::Model, system::AbstractSystem)
transfer_model(model::String, system::AbstractSystem)

Return model unchanged if it is a Model. If it is a path to a directory with results saved as CSV-files, convert it to a Dict containing a DataFrame for each variable and the :metadata.

source
EnergyModelsGUI.update! — Method
update!(gui::GUI, element; updateplot::Bool=true)

Based on element, update the text in get_axes(gui)[:info] and update plot in get_axes(gui)[:results] if updateplot = true.

source
EnergyModelsGUI.update! — Method
update!(gui::GUI, connection::Connection; updateplot::Bool=true)

Based on Connection, update the text in get_axes(gui)[:info] and update plot in get_axes(gui)[:results] if updateplot = true.

source
EnergyModelsGUI.update! — Method
update!(gui::GUI, design::EnergySystemDesign; updateplot::Bool=true)

Based on design, update the text in get_axes(gui)[:info] and update plot in get_axes(gui)[:results] if updateplot = true.

source
EnergyModelsGUI.update_distances! — Method
update_distances!(gui::GUI)

Find the minimum distance between the elements in the design object gui and update Δh such that neighbouring icons do not overlap.

source
EnergyModelsGUI.update_time_menu! — Method
update_time_menu!(gui::GUI, element)

Update the options of the time menu based on element: The option for plotting data over TS.PeriodPartitions is only made available if element has data indexed over such partitions.

source
EnergyModelsGUI.update_tree! — Method
update_tree!(current_lvl::Dict{Type, Union{Dict, Nothing}}, tmp_type::Type) -> Nothing

Ensures that a given type exists as a key in the current level of a nested type dependency dictionary.

Arguments

  • current_lvl::Dict{Type, Union{Dict, Nothing}}: The current level of the nested dictionary structure representing type dependencies.
  • tmp_type::Type: The type to be added as a key in the current level if it does not already exist.

Behavior

If tmp_type is not already a key in current_lvl, it adds it with an empty dictionary as its value, preparing for further nesting.

Returns

  • This function modifies current_lvl in-place; its return value should not be used.
source