From 5ed7c6d641f333adcc6dd89310a22e3343300101 Mon Sep 17 00:00:00 2001 From: Julian Straus <104911227+JulStraus@users.noreply.github.com> Date: Tue, 20 Aug 2024 10:46:03 +0200 Subject: [PATCH] Name emissions constraints to allow for emissions extensions (#36) * Give name to emission constraint --------- Co-authored-by: Truls Flatberg --- NEWS.md | 1 + src/model.jl | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/NEWS.md b/NEWS.md index 2199af7..cb019c2 100644 --- a/NEWS.md +++ b/NEWS.md @@ -12,6 +12,7 @@ * Updated minor issues in the documentation (docstrings, indices, and quick start). * Use dev version of EMB for examples when running as part of tests, solving [Issue #17](https://github.com/EnergyModelsX/EnergyModelsBase.jl/issues/17). +* Naming of the total emission constraint to allow for updates in the coefficients in other packages. ## Version 0.7.0 (2024-05-24) diff --git a/src/model.jl b/src/model.jl index 2bc3e8a..b13d835 100644 --- a/src/model.jl +++ b/src/model.jl @@ -272,8 +272,9 @@ function constraints_emissions(m, ๐’ฉ, ๐’ฏ, ๐’ซ, modeltype::EnergyModel) ๐’ฏแดตโฟแต› = strategic_periods(๐’ฏ) # Creation of the individual constraints. - @constraint(m, [t โˆˆ ๐’ฏ, p โˆˆ ๐’ซแต‰แต], - m[:emissions_total][t, p] == sum(m[:emissions_node][n, t, p] for n โˆˆ ๐’ฉแต‰แต) + @constraint(m, con_em_tot[t โˆˆ ๐’ฏ, p โˆˆ ๐’ซแต‰แต], + m[:emissions_total][t, p] == + sum(m[:emissions_node][n, t, p] for n โˆˆ ๐’ฉแต‰แต) ) @constraint(m, [t_inv โˆˆ ๐’ฏแดตโฟแต›, p โˆˆ ๐’ซแต‰แต], m[:emissions_strategic][t_inv, p] ==