Skip to content

Commit

Permalink
Merge pull request #22 from Mathias157/mbr-spatial-aggregation
Browse files Browse the repository at this point in the history
Added Danish spatial aggregation study to Balmorel community
  • Loading branch information
Mathias157 authored Jun 19, 2024
2 parents e4ae333 + a1583b2 commit 190cd1c
Show file tree
Hide file tree
Showing 136 changed files with 79,449 additions and 214 deletions.
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,9 @@
**/output/economic/*.*
/base/bui/gamsscr/*.*


*.lst
*.log
*.log~1
*.log~2
*.err
*.csv
2 changes: 2 additions & 0 deletions Balmorel.lxi
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
B 3 C o m p i l a t i o n
B 159 Include File Summary
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Balmorel
# Spatial Aggregation Study
This branch is used for analysing the effect of various spatial resolutions in Denmark - from Nordpool bidding zones, through NUTS2-3 and to a municipality resolution. An application is illustrated in the conference poster below.

The pre-processing of data is performed through the balmorel-preprocessing tool ("Raw Data Processing" folder) in https://github.com/Mathias157/balmorel-preprocessing. A Zenodo repository is also provided here.
![Application example](https://github.com/Mathias157/balmorel-preprocessing/blob/master/Raw%20Data%20Processing/Conference%20Poster%20for%20Analysis%20of%20Spatial%20Resolutions%20for%20Modelling%20Sector-Coupled%20Energy%20Systems.png)

# Balmorel
## What is Balmorel?

Balmorel is a partial equilibrium model for analysing the electricity and combined heat and power sectors in an international perspective. It is highly versatile and may be applied for long range planning as well as shorter time operational analysis. Balmorel is implemented as a mainly linear programming optimisation problem.
Expand Down
16 changes: 16 additions & 0 deletions StoringData.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
## Storing the Data
All code is stored in git, but input data is not tracked
Execute the following commands in powershell to zip data:

powershell Compress-Archive -Path "base/data, nuts2/data, nuts3/data, muni/data" -DestinationPath "Balmorel_branch_version.zip"

## Unzipping the Data on HPC
Use the following command to unzip - -qq disables logging output, -o overwrites existing files
unzip -qq -o Balmorel_branch_version.zip

If unzipping the data file on a HPC, you may need to ensure writing capabilities on the extracted files by doing the following commands on the extracted folders:
chmod -R +x data
chmod -R +x Pre-Processing
chmod -R +x input

Otherwise, these files will not be editable, which is needed in the framework
2 changes: 2 additions & 0 deletions base/Balmorel.lxi
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
B 3 C o m p i l a t i o n
B 159 Include File Summary
15 changes: 15 additions & 0 deletions base/addons/_hooks/acronyms.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
* Location of acronyms used in add-ons
$ifi %BB4%==yes $goto beginbb4

$ifi %HYDROGEN%==yes $include "../../base/addons/hydrogen/hydrogen_acronyms.inc";
$ifi not %BB4%==yes $goto endoffile

$label beginbb4

$ifi not %bb4%==yes $goto endoffile

$ifi %HYDROGEN%==yes $include "../../base/addons/hydrogen/bb4/hydrogen_acronymsadditions.inc";

$label endoffile


1 change: 1 addition & 0 deletions base/addons/_hooks/balbase4.inc
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@ $ifi %ANC_SERV%==yes $include "../../base/addons/ancilliary_services/ancillia
$ifi %BalancingMarket%==yes $include "../../base/addons/balancing_market/balancing_market_balbase4.inc";
$ifi %INDIVUSERS%==yes $include "../../base/addons/indivusers/bb4/indivusers_balbase4.inc";
$ifi %OPTIFLOW%==yes $include "../../base/addons/optiflow/bb4/optiflow_balbase4.inc";
$ifi %FLEXDEM%==yes $include "../../base/addons/flexdem/bb4/flexdem_balbase4.inc";

$label endoffile
1 change: 1 addition & 0 deletions base/addons/_hooks/eqndecdef.inc
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,6 @@ $ifi %ANC_SERV%==yes $include "../../base/addons/ancilliary_services/ancillia
$ifi %BalancingMarket%==yes $include "../../base/addons/balancing_market/balancing_market_eqndecdef.inc";
$ifi %INDIVUSERS%==yes $include "../../base/addons/indivusers/bb4/indivusers_eqndecdef.inc";
$ifi %OPTIFLOW%==yes $include "../../base/addons/optiflow/bb4/optiflow_eqndecdef.inc";
$ifi %FLEXDEM%==yes $include "../../base/addons/flexdem/bb4/flexdem_eqndecdef.inc";

$label endoffile
1 change: 1 addition & 0 deletions base/addons/_hooks/pardeclare.inc
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,6 @@ $ifi %TRANS_RAMP%==yes $include "../../base/addons/transmission_ramping/trans
$ifi %ANC_SERV%==yes $include "../../base/addons/ancilliary_services/ancilliary_services_pardeclare.inc";
$ifi %CCS%==yes $include "../../base/addons/CCS/bb4/CCS_pardeclare.inc";
$ifi %INDIVUSERS%==yes $include "../../base/addons/indivusers/bb4/indivusers_pardeclare.inc";
$ifi %FLEXDEM%==yes $include "../../base/addons/flexdem/bb4/flexdem_pardeclare.inc";

$label endoffile
1 change: 1 addition & 0 deletions base/addons/_hooks/pardefine.inc
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ $ifi %ANC_SERV%==yes $include "../../base/addons/ancilliary_services/ancillia
$ifi %CCS%==yes $include "../../base/addons/CCS/bb4/CCS_pardefine.inc";
$ifi %INDIVUSERS%==yes $include "../../base/addons/indivusers/bb4/indivusers_pardefine.inc";
$ifi %OPTIFLOW%==yes $include "../../base/addons/optiflow/bb4/optiflow_pardefine.inc";
$ifi %FLEXDEM%==yes $include "../../base/addons/flexdem/bb4/flexdem_pardefine.inc";



Expand Down
1 change: 1 addition & 0 deletions base/addons/_hooks/qeeq.inc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ $ifi %DEMANDRESPONSE%==yes $include "../../base/addons/demandrespons
$ifi %FlowBased%==yes $include "../../base/addons/FlowBased/bb4/flowbased_qeeq.inc";
$ifi %CCS%==yes $include "../../base/addons/CCS/bb4/CCS_qeeq.inc";
$ifi %OPTIFLOW%==yes $include "../../base/addons/optiflow/bb4/optiflow_qeeq.inc";
$ifi %FLEXDEM%==yes $include "../../base/addons/flexdem/bb4/flexdem_qeeq.inc";

$ifi %vqdebug%==yes $setglobal equation qeeq
$ifi %vqdebug%==yes $include "../../base/addons/vqdebug/bb4/vqdebug_equations.inc";
Expand Down
1 change: 1 addition & 0 deletions base/addons/_hooks/vardeclare.inc
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ $ifi %FlowBased%==yes $include "../../base/addons/FlowBased/bb4/flow
$ifi %INDIVUSERS%==yes $include "../../base/addons/indivusers/bb4/indivusers_vardeclare.inc";
$ifi %BalancingMarket%==yes $include "../../base/addons/balancing_market/balancing_market_vardeclare.inc";
$ifi %OPTIFLOW%==yes $include "../../base/addons/optiflow/bb4/optiflow_vardeclare.inc";
$ifi %FLEXDEM%==yes $include "../../base/addons/flexdem/bb4/flexdem_vardeclare.inc";
$ifi %import_results%==yes $include "../../base/addons/import_results/import_results_vardeclare.inc";

$ifi %vqdebug%==yes $include "../../base/addons/vqdebug/bb4/vqdebug_declare.inc";
Expand Down
8 changes: 8 additions & 0 deletions base/addons/flexdem/bb4/flexdem_balbase4.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
* Flexible demand add-on. Added by Mathias Berg Rosendal

* Additional equations in model definition:

QFLEXDEMAND_YR
$ifi %seasonal_demand%==yes QFLEXDEMAND_SR
* $ifi %inflex_demand%==yes QINFLEXDEM_S
$ifi %inflex_demand%==yes QINFLEXDEM_T
37 changes: 37 additions & 0 deletions base/addons/flexdem/bb4/flexdem_eqndecdef.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
* Flexible demand add-on. Added by Mathias Berg Rosendal

* Yearly demand has to be met in every region
EQUATION QFLEXDEMAND_YR(Y,RRR,FLEXUSER) 'Annual transport demand has to be met in each region (MWh)';

QFLEXDEMAND_YR(IY411,IR,FLEXUSER)$FLEXYDEMAND(IY411,IR,FLEXUSER)..
SUM((IS3,T),
VFLEXDEMAND_T(FLEXUSER,IY411,IR,IS3,T)*IHOURSINST(IS3,T))
=E=
FLEXYDEMAND(IY411,IR,FLEXUSER)
;

* Seasonal demand has to be met in every region
EQUATION QFLEXDEMAND_SR(Y,SSS,RRR,FLEXUSER) 'Annual transport demand has to be met in each region (MWh)';
QFLEXDEMAND_SR(IY411,IS3,IR,FLEXUSER)$FLEXSDEMAND(IY411,IS3,IR,FLEXUSER)..
SUM(T,
VFLEXDEMAND_T(FLEXUSER,IY411,IR,IS3,T)*WEIGHT_S(IS3)/IWEIGHSUMT)
=E=
FLEXSDEMAND(IY411,IS3,IR,FLEXUSER)
;

EQUATION QINFLEXDEM_T(FLEXUSER, YYY, RRR, SSS, TTT) 'Terms must be equal to each other';
QINFLEXDEM_T(FLEXUSER, IY411, IR, IS3, T)$(ord(T) > 1)..
VFLEXDEMAND_T(FLEXUSER,IY411,IR,IS3,T)
=E=
VFLEXDEMAND_T(FLEXUSER,IY411,IR,IS3,T++1)
;

* Not working
* EQUATION QINFLEXDEM_S(FLEXUSER, YYY, RRR, SSS) 'Seasons must be equal to each other';
* QINFLEXDEM_S(FLEXUSER, IY411, IR, IS3)$(ord(IS3) > 1)..
* SUM(T, VFLEXDEMAND_T(FLEXUSER,IY411,IR,IS3,T))
* =E=
* SUM(T, VFLEXDEMAND_T(FLEXUSER,IY411,IR,IS3++1,T))
* ;


9 changes: 9 additions & 0 deletions base/addons/flexdem/bb4/flexdem_pardeclare.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
* Flexible demand add-on. Added by Mathias Berg Rosendal

SET FLEXUSER 'Flexible demand users' %semislash%
$if EXIST '../data/FLEXDEM_FLEXUSER.inc' $INCLUDE '../data/FLEXDEM_FLEXUSER.inc';
$if not EXIST '../data/FLEXDEM_FLEXUSER.inc' $INCLUDE '../../base/data/FLEXDEM_FLEXUSER.inc';
%semislash%;

PARAMETER FLEXSDEMAND(YYY,SSS,CCCRRRAAA,FLEXUSER) 'Flexible seasonal demand per year, node and user (MWh)';
PARAMETER FLEXYDEMAND(YYY,CCCRRRAAA,FLEXUSER) 'Flexible yearly demand node and user (MWh)';
13 changes: 13 additions & 0 deletions base/addons/flexdem/bb4/flexdem_pardefine.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
* Flex add-on. Added by Juan Gea Bermudez

PARAMETER FLEXYDEMAND(YYY,CCCRRRAAA,FLEXUSER) 'Flexible yearly demand node and user (MWh)' %semislash%
$if EXIST '../data/FLEXDEM_FLEXYDEMAND.inc' $INCLUDE '../data/FLEXDEM_FLEXYDEMAND.inc';
$if not EXIST '../data/FLEXDEM_FLEXYDEMAND.inc' $INCLUDE '../../base/data/FLEXDEM_FLEXYDEMAND.inc';
%semislash%;

PARAMETER FLEXSDEMAND(YYY,SSS,CCCRRRAAA,FLEXUSER) 'Flexible seasonal demand per year, node and user (MWh)' %semislash%
$if EXIST '../data/FLEXDEM_FLEXSDEMAND.inc' $INCLUDE '../data/FLEXDEM_FLEXSDEMAND.inc';
$if not EXIST '../data/FLEXDEM_FLEXSDEMAND.inc' $INCLUDE '../../base/data/FLEXDEM_FLEXSDEMAND.inc';
%semislash%;


6 changes: 6 additions & 0 deletions base/addons/flexdem/bb4/flexdem_qeeq.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
* Flexdem add-on. Added by Mathias Berg Rosendal

+ SUM(FLEXUSER, VFLEXDEMAND_T(FLEXUSER,IY411,IR,IS3,T)$(FLEXYDEMAND(IY411,IR,FLEXUSER)))



6 changes: 6 additions & 0 deletions base/addons/flexdem/bb4/flexdem_vardeclare.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
* Flexible demand add-on. Added by Mathias Berg Rosendal

* Variables

POSITIVE VARIABLE VFLEXDEMAND_T(FLEXUSER,Y,RRR,S,T) 'Flexible demand variable (MWh)';

Loading

0 comments on commit 190cd1c

Please sign in to comment.