Internals

Index

Types

EnergyModelsGUI.ConnectionType
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 to.
  • connection::AbstractElement is the EMX connection structure.
  • colors::Vector{RGB} is the associated colors of the connection.
  • plots::Vector{Any} is a vector with all Makie object associated with this object.
  • invest_data::ProcInvData stores processed investment data.
source
EnergyModelsGUI.EnergySystemIteratorType
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.ProcInvDataType
ProcInvData

Type for storing processed investment data.

Fields

  • inv_times::Vector{String} is a vector of formatted strings for added investments.
  • capex::Vector{Number} contains the capex of all times with added investments.
  • invested::Bool indicates if the element has been invested in.
source
EnergyModelsGUI.SystemType
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 (e.g., the Area node of the reference GeoAvailability node).
  • ref_element::AbstractElement is the reference element of the system (first Availability node).
source
EnergyModelsGUI.SystemGeoType
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{<: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.
  • ref_element::AbstractElement is the reference element of the system.
source

Methods

Base.iterateFunction
iterate(itr::EnergySystemIterator)

Initialize the iteration over an EnergySystemIterator, returning the first EnergySystemDesign object in the stack and the iterator itself. If the stack is empty, return nothing.

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 with its type in parantheses.

source
EnergyModelsGUI.add_description!Method
add_description!(
    field::Any,
    name::String,
    ::String,
    pre_desc::String,
    element,
    available_data::Vector{Dict},
    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,
    element,
    available_data::Vector{Dict},
    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,
    element,
    available_data::Vector{Dict},
    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,
    element,
    available_data::Vector{Dict},
    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.alignMethod
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.angleMethod
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.boxMethod
function box(x, y, Δ)

Get the coordinates of a box with half side lengths Δ and centered at (x,y) starting at the upper right corner.

source
EnergyModelsGUI.clear_selectionMethod
clear_selection(gui::GUI; clear_topo=true, clear_results=true)

Clear the color selection of components within 'getdesign(gui)' instance and reset the `getselected_systems(gui)` variable.

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

When a boolean argument two_way is specified, draw the lines in both directions.

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

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

source
EnergyModelsGUI.create_labelMethod
create_label(selection::Vector{Any})

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

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

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

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

Draw a box for EnergySystemDesign design and it's appearance, including style, color, size.

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

Export the plots to a .xlsx file with path given by filename and top header xlabel.

source
EnergyModelsGUI.extract_data_selectionMethod
extract_data_selection(var::SparseVars, selection::Vector, i_T::Int64, periods::Vector)

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

source
EnergyModelsGUI.find_iconMethod
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.

source
EnergyModelsGUI.find_min_max_coordinatesMethod
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, min_y, max_x, and max_y.

source
EnergyModelsGUI.get_EMGUI_objMethod
get_EMGUI_obj(plt)

Get the EnergySystemDesign/Connection assosiated 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_capexMethod
get_capex(data::ProcInvData)
get_capex(design::AbstractGUIObj)

Returns the capex of the investments of a ProcInvData/AbstractGUIObj object data.

source
EnergyModelsGUI.get_changeMethod
get_change(::GUI, ::Val)

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

source
EnergyModelsGUI.get_dataMethod
get_data(
    model::JuMP.Model,
    selection::Dict{Symbol, Any},
    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.

source
EnergyModelsGUI.get_elementMethod
get_element(design::EnergySystemDesign)

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

source
EnergyModelsGUI.get_element_labelMethod
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.

source
EnergyModelsGUI.get_inv_timesMethod
get_inv_times(data::ProcInvData)
get_inv_times(design::AbstractGUIObj)

Returns the inv_times field of a ProcInvData/AbstractGUIObj object data.

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

Calculate when investments has taken place and store the information. An investement is assumed to have taken place if any investment_indicators are larger than getvar(gui,:tol) relative to `maxinst`.

source
EnergyModelsGUI.get_linked_nodes!Method
get_linked_nodes!(
    node::EMB.Node,
    links::Vector{Link},
    area_links::Vector{Link},
    area_nodes::Vector{EMB.Node},
    indices::Vector{Int
)

Recursively find all nodes connected (directly or indirectly) to node in a system of links and store the found links in area_links and nodes in area_nodes.

Here, indices contains the indices where the next link and node is to be stored, respectively.

source
EnergyModelsGUI.get_periodsMethod
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_resource_colorsMethod
get_resource_colors(l::Vector{Link}, id_to_color_map::Dict{Any,Any})

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

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

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

source
EnergyModelsGUI.get_scenario_indicesMethod
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_pointsMethod
get_sector_points(;
    center::Tuple{Real,Real} = (0.0, 0.0),
    Δ::Real = 1.0,
    θ₁::Real = 0,
    θ₂::Real = π/4,
    steps::Int=200,
    geometry::Symbol = :circle)

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

source
EnergyModelsGUI.get_time_axisMethod
get_time_axis(
    data::Union{
        JuMP.Containers.DenseAxisArray,
        JuMP.Containers.SparseAxisArray,
        SparseVariables.IndexedVarArray,
    },
)

Get the index of the axis/column of data (i.e. from a JuMP variable) corresponding to TS.TimePeriod and return this index (i_T) alongside its TimeStruct type.

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

Return the first element of Vector a satisfying the requirement of Function f.

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.new_global_delta_hMethod
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 an resizing the window.

source
EnergyModelsGUI.pick_component!Method
pick_component!(gui::GUI)

Check if a system is found under the mouse pointer and if it is an EnergySystemDesign or a Connection and update state variables.

source
EnergyModelsGUI.place_nodes_in_circleMethod
place_nodes_in_circle(total_nodes::Int, current_node::Int, r::Real, xₒ::Real, yₒ::Real)

Return coordinate for point number i of a total of n points evenly distributed around a circle of radius r centered at (xₒ, yₒ) from -π/4 to 5π/4.

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

Plot the topology of get_design(gui) (only if not already available), and toggle visibility based on the optional argument visible.

source
EnergyModelsGUI.print_nested_structure!Method
print_nested_structure!(
    element,
    output;
    indent::Int64=0,
    vector_limit::Int64=typemax(Int64),
)

Appends the nested structure of element in a nice format to the output[] string. The parameter vector_limit is used to truncate large vectors.

source
EnergyModelsGUI.save_designMethod
save_design(design::EnergySystemDesign, file::String)

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

source
EnergyModelsGUI.save_designMethod
save_design(design::EnergySystemDesign)

Save the x,y-coordinates of EnergySystemDesign design to a .yml file specifield in the field file of design.

source
EnergyModelsGUI.square_intersectionMethod
square_intersection(
    c::Tuple{Tc, Tc},
    θ::Tθ, Δ::TΔ
) where {Tc<:Real, Tx<:Real, Tθ<:Real, TΔ<:Real}

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_intersectionMethod
square_intersection(
    c::Vector{Tc}, x::Vector{Tx},
    θ::Tθ, Δ::TΔ
) where {Tc<:Real, Tx<:Real, Tθ<:Real, TΔ<:Real}

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.

source
EnergyModelsGUI.sub_systemMethod
sub_system(system::SystemGeo, element::AbstractElement)

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

source
EnergyModelsGUI.toggle_selection_color!Method
toggle_selection_color!(gui::GUI, selection, 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.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_descriptive_names!Method
update_descriptive_names!(gui::GUI)

Update the dictionary of descriptive_names where the Dict is appended/overwritten in the following order:

  • The default descriptive names found in src/descriptive_names.yml.
  • Any descriptive_names.yml file found in the ext/EMGUIExt folder of any other EMX package.
  • Descriptive names from a user defined file (from the GUI input argument path_to_descriptive_names).
  • Descriptive names from a user defined Dict (from the GUI input argument descriptive_names_dict).
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