Skip to content

Commit

Permalink
Initial commit to the forked repository
Browse files Browse the repository at this point in the history
  • Loading branch information
matteo-nicoli committed Jun 29, 2023
1 parent d500c1f commit ecb43ec
Show file tree
Hide file tree
Showing 8 changed files with 9,066 additions and 65 deletions.
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,31 @@
# TEMOA
## Model features

This is an extended version of the [TEMOA](https://temoacloud.com/) (Tools for Energy Modeling Optimization and Analysis) energy system modeling framework.

The development team currently includes [Matteo Nicoli](http://www.mahtep.polito.it/people/phd_students/nicoli_matteo), [Gianvito Colucci](http://www.mahtep.polito.it/people/phd_students/colucci_gianvito), [Daniele Lerede](http://www.mahtep.polito.it/people/phd_students/lerede_daniele) and Prof. [Laura Savoldi](http://www.mahtep.polito.it/people/head/savoldi_laura) from [MAHTEP Group](http://www.mahtep.polito.it/) at [Department of Energy](https://www.denerg.polito.it/en/) of [Politecnico di Torino](https://www.polito.it/). For any communication related to our TEMOA version, please write to [[email protected]](mailto:[email protected]).

Figure 1 schematically shows the main differences between the [original TEMOA](https://github.com/TemoaProject/temoa) version and the MAHTEP version.

![](docs/TEMOA.svg)
*Figure 1. Original (a) and extended (b) TEMOA structure.*

The main changes between the two versions concern:
* Integration of new parameters and constraints in the TEMOA algorithm, as explained in [1].
* Development of a database pre-processing module, whom functions are explained in [1].
* Development of a database post-processing module, to derive aggregated results by technologies, commodities, and groups of them.

The public model instances based on this TEMOA version are:
* [TEMOA-Italy](https://github.com/MAHTEP/TEMOA-Italy)
* [TEMOA-Europe](https://github.com/MAHTEP/TEMOA-Europe)

Below, the list of publications in which this version was used:
1. M. Nicoli, F. Gracceva, D. Lerede, and L. Savoldi, “Can We Rely on Open-Source Energy System Optimization Models? The TEMOA-Italy Case Study,” Energies (Basel), vol. 15, no. 18, p. 6505, Sep. 2022, doi: 10.3390/en15186505.
2. M. Nicoli, A TIMES-like open-source model for the Italian energy system. Turin, 2021. Accessed: Jul. 05, 2022. [Online]. Available: https://webthesis.biblio.polito.it/18850/
3. G. Colucci, D. Lerede, M. Nicoli, and L. Savoldi, “Dynamic Accounting for End-Use CO2 Emissions From Low-Carbon Fuels in Energy System Optimization Models,” Energy Proceedings, 2022, doi: 10.46855/energy-proceedings-10294.
4. A. Balbo, “Will hydrogen be a game-changer in the Italian decarbonization pathways? Exploiting an Energy System Optimization Model for scenario analysis,” Politecnico di Torino, 2022. Accessed: Feb. 11, 2023. [Online]. Available: https://webthesis.biblio.polito.it/24983/
5. M. E. Alfano, “Modeling the Energy and the Water Systems in an open-access Energy System Optimization Model: the Pantelleria case study,” Politecnico di Torino, 2022. Accessed: Jan. 19, 2023. [Online]. Available: https://webthesis.biblio.polito.it/24982/

# Overview

The 'energysystem' branch is the current master branch of
Expand Down
Binary file added Temoa_Extended.docx
Binary file not shown.
8,659 changes: 8,659 additions & 0 deletions docs/TEMOA.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions temoa_model/config_sample
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

# Report Duals (Optional)
# Store Duals results in the output .sqlite file
#--saveDUALS
--saveDUALS

# Spreadsheet Output (Optional)
# Direct model output to a spreadsheet
Expand All @@ -44,8 +44,8 @@

# Solver-related arguments (Optional)
#--neos # Optional, specify if you want to use NEOS server to solve
#--solver=cplex # Optional, indicate the solver
#--keep_pyomo_lp_file # Optional, generate Pyomo-compatible LP file
--solver=gurobi # Optional, indicate the solver
#--keep_pyomo_lp_file # Optional, generate Pyomo-compatible LP file

# Modeling-to-Generate Alternatives (Optional)
# Run name will be automatically generated by appending '_mga_' and iteration number to scenario name
Expand Down
11 changes: 9 additions & 2 deletions temoa_model/temoa_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,14 @@ def query_table (t_properties, f):
['set', 'tech_annual', '', '', 0],
['set', 'tech_variable', '', '', 0],
['set', 'groups', '', '', 0],
['param','MinGenGroupTarget', '', '', 2],
['param','MinGenGroupWeight', '', '', 3],
['param','TechGroupWeight', '', '', 3],
['param','MinActivityGroup', '', '', 2],
['param','MaxActivityGroup', '', '', 2],
['param','MinCapacityGroup', '', '', 2],
['param','MaxCapacityGroup', '', '', 2],
['param','MinInputGroup', '', '', 4],
['param','MaxInputGroup', '', '', 4],
['param','MaxOutputGroup', '', '', 4],
['param','LinkedTechs', '', '', 3],
['param','SegFrac', '', '', 2],
['param','DemandSpecificDistribution','', '', 4],
Expand All @@ -154,6 +160,7 @@ def query_table (t_properties, f):
['param','LifetimeTech', '', '', 2],
['param','LifetimeProcess', '', '', 3],
['param','LifetimeLoanTech', '', '', 2],
['param','CapacityFactor', '', '', 3],
['param','CapacityFactorTech', '', '', 4],
['param','CapacityFactorProcess', '', '', 5],
['param','Efficiency', '', '', 5],
Expand Down
11 changes: 11 additions & 0 deletions temoa_model/temoa_initialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,17 @@ def CreateSparseDicts ( M ):
# associated with specific parameters.
# ---------------------------------------------------------------

def CapacityFactorIndices(M):
indices = set(
(r, t, v)

for r in M.regions
for t in M.tech_all
for v in M.vintage_all
)

return indices

def CapacityFactorProcessIndices ( M ):
indices = set(
(r, s, d, t, v)
Expand Down
77 changes: 56 additions & 21 deletions temoa_model/temoa_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ def temoa_create_model(name="Temoa"):
)
M.validate_UsedEfficiencyIndices = BuildAction(rule=CheckEfficiencyIndices)

M.CapacityFactor_rtv = Set(dimen=3, initialize= CapacityFactorIndices)
M.CapacityFactor = Param(M.CapacityFactor_rtv, default=1)

M.CapacityFactor_rsdtv = Set(dimen=5, initialize=CapacityFactorProcessIndices)
M.CapacityFactorProcess = Param(M.CapacityFactor_rsdtv, mutable=True)

Expand Down Expand Up @@ -210,17 +213,21 @@ def temoa_create_model(name="Temoa"):
M.MinCapacity = Param(M.RegionalIndices, M.time_optimize, M.tech_all)
M.MaxCapacity = Param(M.RegionalIndices, M.time_optimize, M.tech_all)
M.MaxResource = Param(M.RegionalIndices, M.tech_all)
M.MinCapacitySum = Param(M.time_optimize) # for techs in tech_capacity
M.MaxCapacitySum = Param(M.time_optimize) # for techs in tech_capacity
M.MaxActivity = Param(M.RegionalGlobalIndices, M.time_optimize, M.tech_all)
M.MinActivity = Param(M.RegionalGlobalIndices, M.time_optimize, M.tech_all)
M.GrowthRateMax = Param(M.RegionalIndices, M.tech_all)
M.GrowthRateSeed = Param(M.RegionalIndices, M.tech_all)
M.EmissionLimit = Param(M.RegionalGlobalIndices, M.time_optimize, M.commodity_emissions)
M.EmissionActivity_reitvo = Set(dimen=6, initialize=EmissionActivityIndices)
M.EmissionActivity = Param(M.EmissionActivity_reitvo)
M.MinGenGroupWeight = Param(M.RegionalIndices, M.tech_groups, M.groups, default = 0)
M.MinGenGroupTarget = Param(M.time_optimize, M.groups)
M.EmissionActivity = Param(M.EmissionActivity_reitvo, default = 0)
M.TechGroupWeight = Param(M.RegionalIndices, M.tech_groups, M.groups, default = 0)
M.MinActivityGroup = Param(M.time_optimize, M.groups)
M.MaxActivityGroup = Param(M.time_optimize, M.groups)
M.MinCapacityGroup = Param(M.time_optimize, M.groups)
M.MaxCapacityGroup = Param(M.time_optimize, M.groups)
M.MinInputGroup = Param(M.regions, M.time_optimize, M.commodity_physical, M.groups)
M.MaxInputGroup = Param(M.regions, M.time_optimize, M.commodity_physical, M.groups)
M.MaxOutputGroup = Param(M.regions, M.time_optimize, M.commodity_physical, M.groups)
M.LinkedTechs = Param(M.RegionalIndices, M.tech_all, M.commodity_emissions)

# Define parameters associated with electric sector operation
Expand Down Expand Up @@ -448,12 +455,54 @@ def temoa_create_model(name="Temoa"):
)

M.MinActivityGroup_pg = Set(
dimen=2, initialize=lambda M: M.MinGenGroupTarget.sparse_iterkeys()
dimen=2, initialize=lambda M: M.MinActivityGroup.sparse_iterkeys()
)
M.MinActivityGroup = Constraint(
M.MinActivityGroupConstraint = Constraint(
M.MinActivityGroup_pg, rule=MinActivityGroup_Constraint
)

M.MaxActivityGroup_pg = Set(
dimen=2, initialize=lambda M: M.MaxActivityGroup.sparse_iterkeys()
)
M.MaxActivityGroupConstraint = Constraint(
M.MaxActivityGroup_pg, rule=MaxActivityGroup_Constraint
)

M.MinCapacityGroupConstraint_pg = Set(
dimen=2, initialize=lambda M: M.MinCapacityGroup.sparse_iterkeys()
)
M.MinCapacityGroupConstraint = Constraint(
M.MinCapacityGroupConstraint_pg, rule=MinCapacityGroup_Constraint
)

M.MaxCapacityGroupConstraint_pg = Set(
dimen=2, initialize=lambda M: M.MaxCapacityGroup.sparse_iterkeys()
)
M.MaxCapacityGroupConstraint = Constraint(
M.MaxCapacityGroupConstraint_pg, rule=MaxCapacityGroup_Constraint
)

M.MinInputGroup_Constraint_rpig = Set(
dimen=4, initialize=lambda M: M.MinInputGroup.sparse_iterkeys()
)
M.MinInputGroupConstraint = Constraint(
M.MinInputGroup_Constraint_rpig, rule=MinInputGroup_Constraint
)

M.MaxInputGroup_Constraint_rpig = Set(
dimen=4, initialize=lambda M: M.MaxInputGroup.sparse_iterkeys()
)
M.MaxInputGroupConstraint = Constraint(
M.MaxInputGroup_Constraint_rpig, rule=MaxInputGroup_Constraint
)

M.MaxOutputGroup_Constraint_rpig = Set(
dimen=4, initialize=lambda M: M.MaxOutputGroup.sparse_iterkeys()
)
M.MaxOutputGroupConstraint = Constraint(
M.MaxOutputGroup_Constraint_rpig, rule=MaxOutputGroup_Constraint
)

M.MaxCapacityConstraint_rpt = Set(
dimen=3, initialize=lambda M: M.MaxCapacity.sparse_iterkeys()
)
Expand All @@ -468,27 +517,13 @@ def temoa_create_model(name="Temoa"):
M.MaxResourceConstraint_rt, rule=MaxResource_Constraint
)

M.MaxCapacitySetConstraint_rp = Set(
dimen=2, initialize=lambda M: M.MaxCapacitySum.sparse_iterkeys()
)
M.MaxCapacitySetConstraint = Constraint(
M.MaxCapacitySetConstraint_rp, rule=MaxCapacitySet_Constraint
)

M.MinCapacityConstraint_rpt = Set(
dimen=3, initialize=lambda M: M.MinCapacity.sparse_iterkeys()
)
M.MinCapacityConstraint = Constraint(
M.MinCapacityConstraint_rpt, rule=MinCapacity_Constraint
)

M.MinCapacitySetConstraint_rp = Set(
dimen=2, initialize=lambda M: M.MinCapacitySum.sparse_iterkeys()
)
M.MinCapacitySetConstraint = Constraint(
M.MinCapacitySetConstraint_rp, rule=MinCapacitySet_Constraint
)

M.TechInputSplitConstraint_rpsditv = Set(
dimen=7, initialize=TechInputSplitConstraintIndices
)
Expand Down
Loading

0 comments on commit ecb43ec

Please sign in to comment.