Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
# Since EnergyModelsGUI doesn't have binary dependencies,
# only test on a subset of possible platforms.
include:
- version: '1.11' # The latest point-release (Linux)
- version: '1' # The latest point-release (Linux)
os: ubuntu-latest
arch: x64
#- version: '1.11' # The latest point-release (Windows)
#- version: '1' # The latest point-release (Windows)
# os: windows-latest
# arch: x64
- version: 'lts' # lts
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@latest
with:
version: '1.11'
version: '1'
- run: sudo apt-get update && sudo apt-get install -y xorg-dev mesa-utils xvfb libgl1 freeglut3-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxext-dev xsettingsd x11-xserver-utils
- name: Install dependencies
shell: julia --color=yes --project=docs/ {0}
Expand Down
12 changes: 10 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Release notes

## Version 0.5.17 (2025-11-09)
## Version 0.5.17 (2025-11-19)

### Bugfix

* Fix bug that made nodes/areas disappear when plotting too many objects (max z_level is 10000).
* Fix bug that made `Node`s/`Area`s disappear when plotting too many objects (max z_level is 10000).
* Fix square_intersection function.

### Enhancements
Expand All @@ -13,6 +13,14 @@
* Remove redundant `notify_component` function and `Observable`s (use the `@lift` macro instead).
* Improve performance of updates to `ax_info`.
* Add missing tests for show-function on the types `AbstractSystem` and `ProcInvData`, and improve code structure.
* Bumped Makie packages to latest versions (and adjusted the code to the breaking changes) which increased performance.
* Improved code performance.
* Toggeling of GeoMakie is also now available which improves performance if the background map is not required.

# Adjustments

* Skip warnings if a provided non-empty `id_to_icon_map` does not contain icons for all `Node`s/`Area`s (as it is fine to combine custom icon with the default generated icons).
* Introduced the new parametric type `PlotContainer` to replace `Dict{:Symbol, Any}` types used as container for plotted data.

## Version 0.5.16 (2025-09-24)

Expand Down
30 changes: 15 additions & 15 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "EnergyModelsGUI"
uuid = "737a7361-d3b7-40e9-b1ac-59bee4c5ea2d"
authors = ["Jon Vegard Venås <JonVegard.Venas@sintef.no>", "Magnus Askeland <Magnus.Askeland@sintef.no>", "Shweta Tiwari <Shweta.Tiwari@sintef.no>"]
version = "0.5.17"
authors = ["Jon Vegard Venås <JonVegard.Venas@sintef.no>", "Magnus Askeland <Magnus.Askeland@sintef.no>", "Shweta Tiwari <Shweta.Tiwari@sintef.no>"]

[deps]
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
Expand All @@ -17,6 +17,7 @@ GeoJSON = "61d90e0f-e114-555e-ac52-39dfb47a3ef9"
GeoMakie = "db073c08-6b98-4ee5-b6a4-5efafb3259c6"
HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3"
ImageMagick = "6218d12a-5da1-5696-b52f-db25d2ecc6d1"
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
IntervalSets = "8197267c-284f-5f27-9208-e0e47529a953"
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
Expand All @@ -26,7 +27,6 @@ SparseVariables = "2749762c-80ed-4b14-8f33-f0736679b02b"
TimeStruct = "f9ed5ce0-9f41-4eaa-96da-f38ab8df101c"
XLSX = "fdbf4ff8-1666-58a4-91e7-1b58723a45e0"
YAML = "ddb6d928-2868-570f-bddf-ab3f9cf99eb6"
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"

[weakdeps]
EnergyModelsGeography = "3f775d88-a4da-46c4-a2cc-aa9f16db6708"
Expand All @@ -36,27 +36,27 @@ EMGExt = "EnergyModelsGeography"

[compat]
CSV = "0.10"
CairoMakie = "=0.12.18"
Colors = "0.12"
DataFrames = "1.7"
Dates = "1.9"
CairoMakie = "0.15"
Colors = "0.13"
DataFrames = "1"
Dates = "1"
EnergyModelsBase = "0.9"
EnergyModelsGeography = "0.11"
EnergyModelsInvestments = "0.8"
FileIO = "1.16"
GLMakie = "=0.10.18"
FileIO = "1"
GLMakie = "0.13"
GeoJSON = "0.8"
GeoMakie = "=0.7.12"
GeoMakie = "0.7.16"
HTTP = "1.10"
ImageMagick = "1.3"
ImageMagick = "1"
InteractiveUtils = "1"
IntervalSets = "<0.7.12"
JuMP = "1.22"
Pkg = "1.9"
PrettyTables = "2.3"
Printf = "1.9"
Pkg = "1"
PrettyTables = "3"
Printf = "1"
SparseVariables = "0.7"
TimeStruct = "0.9"
XLSX = "0.10"
YAML = "0.4"
julia = "1.10"
InteractiveUtils = "1"
julia = "1.10, 1.11, 1.12"
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ Visualization of the results after simulations will be added at a later stage.

The EnergyModelsGUI package has taken inspiration from the source code of [ModelingToolkitDesigner](https://github.com/bradcarman/ModelingToolkitDesigner.jl) as a starting point for development.

> [!WARNING]
> EnergyModelsGUI.jl currently does not support Julia verison 1.12 due to a breaking change in GLMakie. It is assumed that this issue will resolve soon in the future.

## Usage

If you already have constructed a `case` in EMX you can view this case with
Expand Down
48 changes: 32 additions & 16 deletions docs/generate_images.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@ import EnergyModelsGUI:
get_button,
get_root_design,
get_components,
get_component,
get_selected_systems,
get_name,
update!,
toggle_selection_color!
toggle_selection_color!,
select_data!

include(joinpath(@__DIR__, "..", "examples", "generate_examples.jl"))

"""
create_colors_visualization_image()
Expand Down Expand Up @@ -63,8 +68,26 @@ end
Create figures of the GUI based on the EMI_geography.jl example to be used for docs and README.md.
"""
function create_EMI_geography_images()
include(joinpath(@__DIR__, "..", "examples", "generate_examples.jl"))
include(joinpath(@__DIR__, "..", "examples", "EMI_geography.jl"))
case, model = generate_example_data_geo()
optimizer = optimizer_with_attributes(HiGHS.Optimizer, MOI.Silent() => true)
m = create_model(case, model)
set_optimizer(m, optimizer)
optimize!(m)

solution_summary(m)

# Set folder where visualization info is saved and retrieved
design_path = joinpath(@__DIR__, "design", "EMI", "geography")

# Run the GUI
gui = GUI(
case;
design_path,
model = m,
coarse_coast_lines = false,
scale_tot_opex = true,
scale_tot_capex = false,
)

# Create examples.png image
path_to_results = joinpath(@__DIR__, "src", "figures")
Expand All @@ -73,7 +96,6 @@ function create_EMI_geography_images()
get_menu(gui, :export_type).selection[] = "png"
export_button = get_button(gui, :export)
open_button = get_button(gui, :open)
available_data_menu = get_menu(gui, :available_data)
notify(export_button.clicks)
mv(
joinpath(path_to_results, "All.png"),
Expand All @@ -82,15 +104,11 @@ function create_EMI_geography_images()
)

# Create EMI_geography.png image
root_design = get_root_design(gui)
components = get_components(root_design)
component = components[1] # fetch the Oslo area
push!(get_selected_systems(gui), component) # Manually add to :selected_systems
oslo_area = get_component(get_root_design(gui), 1)
push!(get_selected_systems(gui), oslo_area) # Manually add to :selected_systems
update!(gui)
toggle_selection_color!(gui, component, true)
available_data = [x[2][:name] for x ∈ collect(available_data_menu.options[])]
i_selected = findfirst(x -> x == "area_exchange", available_data)
available_data_menu.i_selected = i_selected # Select flow_out (CO2)
toggle_selection_color!(gui, oslo_area, true)
select_data!(gui, "area_exchange")
notify(export_button.clicks)
mv(
joinpath(path_to_results, "All.png"),
Expand All @@ -100,15 +118,13 @@ function create_EMI_geography_images()

# Create EMI_geography_Oslo.png image
notify(open_button.clicks)
sub_component = components[1].components[2] # fetch the Oslo area
sub_component = get_component(oslo_area, 5) # fetch node id 5 in Oslo area
selected_systems = get_selected_systems(gui)
empty!(selected_systems)
push!(selected_systems, sub_component) # Manually add to :selected_systems
update!(gui)
toggle_selection_color!(gui, sub_component, true)
available_data = [x[2][:name] for x ∈ collect(available_data_menu.options[])]
i_selected = findfirst(x -> x == "cap_add", available_data)
available_data_menu.i_selected = i_selected # Select flow_out (CO2)
select_data!(gui, "cap_add")
notify(export_button.clicks)
mv(
joinpath(path_to_results, "All.png"),
Expand Down
1 change: 1 addition & 0 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ if isfile(news)
end
cp("NEWS.md", news)

ENV["EMX_TEST"] = true # Set flag for example scripts to check if they are run as part CI
include("generate_images.jl")

DocMeta.setdocmeta!(
Expand Down
Binary file modified docs/src/figures/EMI_geography.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/src/figures/EMI_geography_Oslo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 4 additions & 17 deletions ext/EMGExt/EMGExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -136,31 +136,18 @@ end
Create a sub-system of `system` with the `element` as the availability node.
"""
function EMGUI.sub_system(system::EMGUI.SystemGeo, element::AbstractElement)
area_an::EMB.Node = availability_node(element)
# Get all nodes and links in the area directly or indirectly connected by `Link`s to `element`.
area_nodes::Vector{EMB.Node}, area_links::Vector{Link} =
EMG.nodes_in_area(element, get_links(system); n_nodes = length(get_nodes(system)))

# Allocate redundantly large vector (for efficiency) to collect all links and nodes
links::Vector{Link} = get_links(system)
area_links::Vector{Link} = Vector{Link}(undef, length(links))
area_nodes::Vector{EMB.Node} = Vector{EMB.Node}(
undef, length(get_nodes(system)),
)

area_nodes[1] = area_an

# Create counting indices for area_links and area_nodes respectively
indices::Vector{Int} = [1, 2]

EMGUI.get_linked_nodes!(area_an, links, area_links, area_nodes, indices)
resize!(area_links, indices[1] - 1)
resize!(area_nodes, indices[2] - 1)
return EMGUI.System(
get_time_struct(system),
get_products(system),
get_elements_vec(system),
area_nodes,
area_links,
element,
area_an,
availability_node(element),
)
end

Expand Down
Loading
Loading