SPSUnipi / EnergyCommunity.jl

Optimization of Energy Communities in Julia
GNU General Public License v3.0
6 stars 5 forks source link

Include thermal generators and modularity #15

Closed enri07 closed 4 months ago

enri07 commented 4 months ago

This fork has been created to add the support for thermal generators (ASSET_TYPE THER=4) in the Energy Community model. By adding this modification, a nominal capacity for all the assets has been introduced, transforming the installed capacity x_us into an integer variable indicating the number of base plants installed. Morevoer, the maintenance and consumption C_gen_us of thermal generators has been reproduced using a linear function (see base_model.jl, line 189) with some parameters specified in the .yml file. Regarding auxiliary function, all the functions calculating the energy shares among users and self production have been modified in order to include also the production of thermal generators. Lastly, due to the new nature of the model (i.e. MILP), we created a function set_parameters_ECmodel! in order to early stop the execution of the process by setting a maximum time limit, a primal gap and the number of threads. NOTE: at the moment, only CPLEX and HiGHS are supported by this function, but it can be easily extended to new solvers.

enri07 commented 4 months ago

Hi!

Thank you very much for your review!

I have just updated a new commit. Now all the sources have a install_type voice in the .yml file. When created in the build_base_model! function, the x_us are declared to be continuous, and only the ones with the above mentioned voice set to integer are converted into integer variables.

I have left the nom_capacity voice for all the plants, assuming that resources having a continuous capacity, should have this parameter set to 1.

The only thing left is the overload of the JuMP function to set some parameters of the model, but I checked that the model is correctly working even when some variables assume an integer domain and other a continuous one.

Let me know what you think about it!

Best,

Enrico

enri07 commented 4 months ago

Hi!

So I made some new commits to fix the previously discussed errors. Note that I didn't change the .yml file inside the test/data folder, in order to get the expected results. Thus, no thermal generator is considered in those tests.

Now in the CI all tests pass (also the ones regarding SankeyPlots), except the ones regarding the business_plan. This is only because now a new term C_gen is considered inside the legend, even if the actual value is 0 and so the plot doesn't changes.

Differently, the tests inside the Documentation are still running, because they utilize the .yml file inside the main data folder, where the generators are considered. In this case the problem is that no stopping condition is considered, and the MILP problem continues running. What should I do in this case?

Thank you very much for your time!

Enrico

davide-f commented 4 months ago

@enri07 I'm pushing to the branch to finalize, please do not push to the branch

davide-f commented 4 months ago

@enri07 merged :D