From 84952f702d2577c84256e74664bbc6a731dc07fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20Vegard=20Ven=C3=A5s?= Date: Wed, 9 Oct 2024 10:19:59 +0200 Subject: [PATCH] Fix bug that errored on time-indepentent variables by ignoring these. Also added some minor adjustments --- NEWS.md | 6 ++++++ Project.toml | 2 +- examples/EMI_geography.jl | 2 -- src/setup_GUI.jl | 9 +++++---- src/utils_GUI/GUI_utils.jl | 5 ++++- src/utils_GUI/results_axis_utils.jl | 4 +++- test/test_interactivity.jl | 4 ++-- 7 files changed, 21 insertions(+), 11 deletions(-) diff --git a/NEWS.md b/NEWS.md index 5cf422c..8cbbae5 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,11 @@ # Release notes +## Version 0.5.7 (2024-10-09) + +### Bugfix + +* Fix bug that errored on time-indepentent variables by ignoring these. + ## Version 0.5.6 (2024-09-16) ### Bugfix diff --git a/Project.toml b/Project.toml index c523738..12b719a 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "EnergyModelsGUI" uuid = "737a7361-d3b7-40e9-b1ac-59bee4c5ea2d" authors = ["Jon Vegard Venås ", "Magnus Askeland ", "Shweta Tiwari "] -version = "0.5.6" +version = "0.5.7" [deps] CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0" diff --git a/examples/EMI_geography.jl b/examples/EMI_geography.jl index 4e623cb..17c67b8 100644 --- a/examples/EMI_geography.jl +++ b/examples/EMI_geography.jl @@ -488,8 +488,6 @@ solution_summary(m) # Uncomment to print all the constraints set in the model. # print(m) -solution_summary(m) - ############################################################################################ ## Code below for displaying the GUI diff --git a/src/setup_GUI.jl b/src/setup_GUI.jl index 72e8ec8..c94a233 100644 --- a/src/setup_GUI.jl +++ b/src/setup_GUI.jl @@ -12,8 +12,8 @@ Initialize the EnergyModelsGUI window and visualize the topology of a system `ca # Keyword arguments: - **`design_path::String=""`** is a file path or identifier related to the design. -- **`id_to_color_map::Dict=Dict()` is a dict that maps `Resource`s `id` to colors. -- **`id_to_icon_map::Dict=Dict()` is a dict that maps `Node/Area` `id` to .png files for icons. +- **`id_to_color_map::Dict=Dict()`** is a dict that maps `Resource`s `id` to colors. +- **`id_to_icon_map::Dict=Dict()`** is a dict that maps `Node/Area` `id` to .png files for icons. - **`model::JuMP.Model=JuMP.Model()`** is the solved JuMP model with results for the `case`. - **`hide_topo_ax_decorations::Bool=true`** is a visibility toggle of ticks, ticklabels and grids for the topology axis. @@ -24,8 +24,9 @@ Initialize the EnergyModelsGUI window and visualize the topology of a system `ca representative periods. - **`scenarios_labels::Vector=[]`** are descriptive labels for scenarios. - **`path_to_results::String=""`** is the path to where exported files are stored. -- **`path_to_descriptive_names::String=""` is the Path to a .yml file where variables. - are described. +- **`path_to_descriptive_names::String=""`** is the Path to a .yml file where variables +are described. +- **`descriptive_names_dict::Dict=Dict()`** is a dictionary where variables are described. - **`coarse_coast_lines::Bool=true`** is a toggle for coarse or fine resolution coastlines. - **`backgroundcolor=GLMakie.RGBf(0.99, 0.99, 0.99)`** is the background color of the main window. diff --git a/src/utils_GUI/GUI_utils.jl b/src/utils_GUI/GUI_utils.jl index 84371a4..0b8b72f 100644 --- a/src/utils_GUI/GUI_utils.jl +++ b/src/utils_GUI/GUI_utils.jl @@ -235,7 +235,10 @@ function initialize_available_data!(gui) if isempty(var) continue end - i_T, type = get_time_axis(model[sym]) + i_T, type = get_time_axis(var) + if isnothing(type) # No time dimension found + continue + end periods = get_periods(T, type) for combination ∈ get_combinations(var, i_T) diff --git a/src/utils_GUI/results_axis_utils.jl b/src/utils_GUI/results_axis_utils.jl index 5c8a704..840e21e 100644 --- a/src/utils_GUI/results_axis_utils.jl +++ b/src/utils_GUI/results_axis_utils.jl @@ -14,7 +14,9 @@ function create_description(gui::GUI, key_str::String; pre_desc::String="") catch description = key_str[(findfirst('.', key_str) + 1):end] @warn "Could't find a description for $description. \ - Using the string $description instead" + Using the string $description instead. \ + You can customize the descriptions as explained here: \ + https://energymodelsx.github.io/EnergyModelsGUI.jl/stable/how-to/customize-descriptive_names/" end return description end diff --git a/test/test_interactivity.jl b/test/test_interactivity.jl index 9d5b098..32b209c 100644 --- a/test/test_interactivity.jl +++ b/test/test_interactivity.jl @@ -31,8 +31,8 @@ import EnergyModelsGUI: case, model, m, gui = run_case() - op_cost = [3371970.004, 5382390.006, 2010420.002] - inv_cost = [0.0, 0.0, 29536224.88] + op_cost = [3371970.00359, 5382390.00598, 2010420.00219] + inv_cost = [0.0, 0.0, 29536224.881975] @testset "Compare with Integrate results" begin T = get_design(gui).system[:T] for (i, t) ∈ enumerate(strategic_periods(T))