Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
ad715ff
Implement inheritance of field names for structures based on supertypes:
dqpinel Oct 27, 2025
43070ac
Julia formatter
dqpinel Nov 4, 2025
0ac130f
Add InteractiveUtils to Project.toml
dqpinel Nov 5, 2025
abe0e62
Add InteractiveUtils to package
dqpinel Nov 5, 2025
0bd069d
remove duplicate entry in descriptive names
dqpinel Nov 5, 2025
698e3b8
Add initial test of inheritance of descriptive names
dqpinel Nov 5, 2025
9aeb855
fix tests and processing of supertypes
dqpinel Nov 5, 2025
8efcc4b
Fix feature for parametric structs that have type UnionAll and added …
dqpinel Nov 6, 2025
fa36490
Implement inheritance of field names for structures based on supertypes:
dqpinel Oct 27, 2025
b95dd72
Julia formatter
dqpinel Nov 4, 2025
d571f27
remove duplicate entry in descriptive names
dqpinel Nov 5, 2025
a1d00c2
Add initial test of inheritance of descriptive names
dqpinel Nov 5, 2025
529e97c
fix tests and processing of supertypes
dqpinel Nov 5, 2025
012f4c1
Fix feature for parametric structs that have type UnionAll and added …
dqpinel Nov 6, 2025
0f9ed95
Implement inheritance of field names for structures based on supertypes:
dqpinel Oct 27, 2025
1f40db2
Add initial test of inheritance of descriptive names
dqpinel Nov 5, 2025
56621a9
fix tests and processing of supertypes
dqpinel Nov 5, 2025
02aa062
Moving tests to own file
dqpinel Nov 17, 2025
bf8ea91
simplify descriptive names even more
dqpinel Nov 17, 2025
4297473
Change from reading installed packages to loaded packages
dqpinel Nov 17, 2025
9767bc3
Apply suggestions from code review
dqpinel Nov 17, 2025
ae43625
Merge branch 'feat/inherit_desc_names' of https://github.com/EnergyMo…
dqpinel Nov 17, 2025
e04b8ed
julia formatter
dqpinel Nov 17, 2025
c3dbf2a
change implementation of loaded and close gui in descriptive names test
dqpinel Nov 18, 2025
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
2 changes: 2 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ 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 Down Expand Up @@ -58,3 +59,4 @@ TimeStruct = "0.9"
XLSX = "0.10"
YAML = "0.4"
julia = "1.10"
InteractiveUtils = "1"
3 changes: 3 additions & 0 deletions src/EnergyModelsGUI.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ using Colors
# To format numbers with @sprintf
using Printf

# To retrieve supertypes
using InteractiveUtils

# Use GLMakie front end to visualize the GUI figure
using GLMakie

Expand Down
145 changes: 20 additions & 125 deletions src/descriptive_names.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,127 +3,60 @@
structures:
# EnergyModelsBase
## node.jl
StorCapOpex:
AbstractStorageParameters:
capacity: "Installed capacity"
opex_var: "Relative variable operating expense per energy unit"
opex_fixed: "Relative fixed operating expense per installed capacity"

StorCap:
capacity: "Installed capacity"

StorCapOpexVar:
capacity: "Installed capacity"
opex_var: "Relative variable operating expense per energy unit"

StorCapOpexFixed:
capacity: "Installed capacity"
opex_fixed: "Relative fixed operating expense per installed capacity"

StorOpexVar:
opex_var: "Relative variable operating expense per energy unit"

RefSource:
cap: "Installed capacity"
opex_var: "Relative variable operating expense per energy unit produced"
opex_fixed: "Relative fixed operating expense per installed capacity"

RefNetworkNode:
Node:
cap: "Installed capacity"
opex_var: "Relative variable operating expense per energy unit produced"
opex_fixed: "Relative fixed operating expense per installed capacity"

RefSink:
Sink:
cap: "Demand"
penalty:
surplus: "Penalties for surplus"
deficit: "Penalties for deficits"

# EnergyModelsGeography
## mode.jl
RefDynamic:
trans_cap: "Capacity of the transmission mode"
trans_loss: "Relative loss of the transported resource during transmission"
opex_var: "Relative variable operating expense per energy unit transported"
opex_fixed: "Relative fixed operating expense per installed capacity"

RefStatic:
trans_cap: "Capacity of the transmission mode"
trans_loss: "Relative loss of the transported resource during transmission"
opex_var: "Relative variable operating expense per energy unit transported"
opex_fixed: "Relative fixed operating expense per installed capacity"

PipeSimple:
consumption_rate: "Rate at which the resource is consumed, as a ratio of the volume of the resource going into the inlet"
TransmissionMode:
trans_cap: "Capacity of the transmission mode"
trans_loss: "Relative loss of the transported resource during transmission"
opex_var: "Relative variable operating expense per energy unit transported"
opex_fixed: "Relative fixed operating expense per installed capacity"

PipeLinepackSimple:
consumption_rate: "Rate at which the resource is consumed, as a ratio of the volume of the resource going into the inlet"
trans_cap: "Capacity of the transmission mode"
trans_loss: "Relative loss of the transported resource during transmission"
opex_var: "Relative variable operating expense per energy unit transported"
opex_fixed: "Relative fixed operating expense per installed capacity"

# EnergyModelsInvestment
## investment_data.jl
NoStartInvData:
capex: "Capital costs for investing in a capacity"
max_inst: "Maximum installed capacity in a strategic period"

StartInvData:
AbstractInvData:
capex: "Capital costs for investing in a capacity"
max_inst: "Maximum installed capacity in a strategic period"
initial: "Initial capacity in the first strategic period"

## investment_mode.jl
Investment:
min_add: "Minimum added capacity in a strategic period"
max_add: "Maximum added capacity in a strategic period"
increment: "Used increment for discrete investments"
capex_offset: "Offset for the CAPEX in a strategic period"
FixedInvestment:
cap: "Capacity used for the fixed investments"

BinaryInvestment:
cap: "Capacity used for the binary investments"

DiscreteInvestment:
increment: "Used increment for discrete investments"

ContinuousInvestment:
min_add: "Minimum added capacity in a strategic period"
max_add: "Maximum added capacity in a strategic period"

SemiContinuousInvestment:
min_add: "Minimum added capacity in a strategic period"
max_add: "Maximum added capacity in a strategic period"

SemiContinuousOffsetInvestment:
max_add: "Maximum added capacity in a strategic period"
min_add: "Minimum added capacity in a strategic period"
capex_offset: "Offset for the CAPEX in a strategic period"

## lifetime_mode.jl
StudyLife:
lifetime: "Chosen lifetime of the technology"

PeriodLife:
lifetime: "Chosen lifetime of the technology"

RollingLife:
LifetimeMode:
lifetime: "Chosen lifetime of the technology"

# EnergyModelsRenewableProducers
## datastructures.jl
NonDisRES:
cap: "Installed capacity"
AbstractNonDisRES:
profile: "Power production profile as a ratio of installed capacity"
opex_var: "Relative variable operating expense per energy unit produced"
opex_fixed: "Relative fixed operating expense per installed capacity"

HydroStor:
level_init: "Initial stored energy in the dam"
level_inflow: "Inflow of power per operational period"
level_min: "Minimum fraction of the reservoir capacity required"

PumpedHydroStor:
HydroStorage:
level_init: "Initial stored energy in the dam"
level_inflow: "Inflow of power per operational period"
level_min: "Minimum fraction of the reservoir capacity required"
Expand All @@ -141,17 +74,17 @@ structures:
opex_var: "Variable operational costs per water flow"
opex_fixed: "Fixed operational costs"

HydroGenerator:
cap: "Installed discharge or power capacity"
HydroUnit:
opex_var: "Variable operational costs per energy unit produced"
opex_fixed: "Fixed operational costs"

HydroGenerator:
cap: "Installed discharge or power capacity"

HydroPump:
cap: "Installed pumping capacity"
opex_var: "Variable operational costs per energy unit produced"
opex_fixed: "Fixed operational costs"

CycleLife:
AbstractBatteryLife:
stack_cost: "Relative cost for replacing a battery stack"

# EnergyModelsHeat
Expand All @@ -162,22 +95,9 @@ structures:

## node.jl
HeatPump:
cap: "Installed capacity"
t_source: "Heat source temperature"
t_sink: "Heat sink temperature"
eff_carnot: "Carnot Efficiency"
opex_var: "Variable operating expense per energy unit produced"
opex_fixed: "Fixed operating expense per installed capacity"

HeatExchanger:
cap: "Installed capacity"
opex_var: "Variable operating expense per energy unit produced"
opex_fixed: "Fixed operating expense per installed capacity"

DirectHeatUpgrade:
cap: "Installed capacity"
opex_var: "Variable operating expense per energy unit produced"
opex_fixed: "Fixed operating expense per installed capacity"

## resource.jl
ResourceHeat:
Expand All @@ -186,52 +106,27 @@ structures:

# EnergyModelsHydrogen
## node.jl
Electrolyzer:
cap: "Installed capacity"
opex_var: "Variable operating expense per capacity used"
opex_fixed: "Fixed operating expense per installed capacity"
stack_replacement_cost: "Replacement cost of electrolyzer stacks"

SimpleElectrolyzer:
cap: "Installed capacity"
AbstractElectrolyzer:
opex_var: "Variable operating expense per capacity used"
opex_fixed: "Fixed operating expense per installed capacity"
stack_replacement_cost: "Replacement cost of electrolyzer stacks"

CommitParameters:
opex: "Operating cost per installed capacity and operational duration"
time: "Minimum time node must remain in a state before transitioning"

RampBi:
up: "Maximum positive rate of change of a node"
down: "Maximum negative rate of change of a node"

RampUp:
AbstractRampParameters:
up: "Maximum positive rate of change of a node"

RampDown:
down: "Maximum negative rate of change of a node"

Reformer:
cap: "Installed capacity"
opex_var: "Variable operating expense per capacity usage"
opex_fixed: "Fixed operating expense per installed capacity"

# EnergyModelsCO2
CO2Source:
cap: "Installed capacity"
opex_var: "Variable operating expense per energy unit produced"
opex_fixed: "Fixed operating expense"

RefNetworkNodeRetrofit:
cap: "Installed capacity"
opex_var: "Variable operating expense per energy unit produced"
opex_fixed: "Fixed operating expense"

CCSRetroFit:
cap: "Installed capacity"
opex_var: "Variable operating expense per unit of CO₂ captured"
opex_fixed: "Fixed operating expense"


variables:
Expand Down
13 changes: 8 additions & 5 deletions src/utils_GUI/GUI_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -625,16 +625,19 @@ function update_descriptive_names!(gui::GUI)
joinpath(@__DIR__, "..", "descriptive_names.yml"); dicttype = Dict{Symbol,Any},
)

# Get a dictionary of installed packages
installed_packages = installed()
# Get a dictionary of loaded packages
loaded_packages = loaded()

# Filter packages with names matching the pattern "EnergyModels*"
emx_packages = filter(pkg -> occursin(r"EnergyModels", pkg), keys(installed_packages))

# Search through EMX packages if icons are available there
emx_packages = filter(pkg -> occursin(r"EnergyModels", pkg), loaded_packages)
# apply inheritances for fetching descriptive names
# create a dictionary were the keys are all the types defined in emx_packages and the values are the types they inherit from
emx_supertypes_dict = get_supertypes(emx_packages)
inherit_descriptive_names_from_supertypes!(descriptive_names, emx_supertypes_dict)
for package ∈ emx_packages
package_path::Union{String,Nothing} = dirname(dirname(Base.find_package(package)))
if !isnothing(package_path)
# check for presence of file to extend descriptive names
path_to_descriptive_names_ext = joinpath(
package_path, "ext", "EMGUIExt", "descriptive_names.yml",
)
Expand Down
7 changes: 7 additions & 0 deletions src/utils_gen/structures_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ function installed()
return installs
end

"""
function loaded()

Get a list of loaded packages.
"""
loaded() = [String(n) for n ∈ names(Main, imported = true) if getfield(Main, n) isa Module]

"""
place_nodes_in_circle(total_nodes::Int64, current_node::Int64, r::Float32, xₒ::Float32, yₒ::Float32)

Expand Down
Loading
Loading