Skip to content

Commit

Permalink
Make identical to main
Browse files Browse the repository at this point in the history
  • Loading branch information
olejandro committed Nov 17, 2024
1 parent 6bcedd3 commit 7cc8a8b
Show file tree
Hide file tree
Showing 2 changed files with 170 additions and 0 deletions.
92 changes: 92 additions & 0 deletions benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -348,3 +348,95 @@ benchmarks:
- "b_tra_emissions"
- "b_tra_ev_parity"
- "b_tra_f_modalshares"
- name: TIMES-NZ-KEA
input_folder: TIMES-NZ
inputs:
- "VT_NI_ELC_V4.xlsx"
- "VT_NI_IND_V2.xlsx"
- "VT_NI_OTH_V4.xlsx"
- "VT_NI_PRI_V4.xlsx"
- "VT_NI_TRA_V4.xlsx"
- "VT_SI_ELC_V4.xlsx"
- "VT_SI_IND_V2.xlsx"
- "VT_SI_OTH_V4.xlsx"
- "VT_SI_PRI_V4.xlsx"
- "VT_SI_TRA_V4.xlsx"
- "BY_Trans.xlsx"
- "SuppXLS/Trades/ScenTrade__Trade_Links.xlsx"
- "SubRES_TMPL/SubRES_NewTech_ELC_KEA.xlsx"
- "SubRES_TMPL/SubRES_NewTechs_Industry.xlsx"
- "SubRES_TMPL/SubRES_NewTechs_Industry_Trans.xlsx"
- "SubRES_TMPL/SubRES_NewTransport-KEA.xlsx"
- "SubRES_TMPL/SubRES_NewTech_AGR_KEA.xlsx"
- "SubRES_TMPL/SubRES_NewTech_AGR_KEA_Trans.xlsx"
- "SubRES_TMPL/SubRES_NewTech_RC.xlsx"
- "SuppXLS/Trades/ScenTrade_TRADE_PARMS.xlsx"
- "SysSettings.xlsx"
- "SuppXLS/Scen_Base_constraints.xlsx"
- "SuppXLS/Scen_RE_Potentials.xlsx"
- "SuppXLS/Scen_LoadCurve_COM-FR.xlsx"
- "SuppXLS/Scen_AF_Renewable.xlsx"
- "SuppXLS/Scen_WEM_WCM.xlsx"
- "SuppXLS/Scen_Cohesive.xlsx"
dd_folder: TIMES-NZ-KEA
dd_files:
- "base.dd"
- "newtech_elc_kea.dd"
- "newtechs_industry.dd"
- "newtransport-kea.dd"
- "newtech_agr_kea.dd"
- "newtech_rc.dd"
- "trade_parms.dd"
- "syssettings.dd"
- "base_constraints.dd"
- "re_potentials.dd"
- "loadcurve_com-fr.dd"
- "af_renewable.dd"
- "wem_wcm.dd"
- "cohesive.dd"
- name: TIMES-NZ-TUI
input_folder: TIMES-NZ
inputs:
- "VT_NI_ELC_V4.xlsx"
- "VT_NI_IND_V2.xlsx"
- "VT_NI_OTH_V4.xlsx"
- "VT_NI_PRI_V4.xlsx"
- "VT_NI_TRA_V4.xlsx"
- "VT_SI_ELC_V4.xlsx"
- "VT_SI_IND_V2.xlsx"
- "VT_SI_OTH_V4.xlsx"
- "VT_SI_PRI_V4.xlsx"
- "VT_SI_TRA_V4.xlsx"
- "BY_Trans.xlsx"
- "SuppXLS/Trades/ScenTrade__Trade_Links.xlsx"
- "SubRES_TMPL/SubRES_NewTech_ELC_TUI.xlsx"
- "SubRES_TMPL/SubRES_NewTechs_Industry.xlsx"
- "SubRES_TMPL/SubRES_NewTechs_Industry_Trans.xlsx"
- "SubRES_TMPL/SubRES_NewTransport-TUI.xlsx"
- "SubRES_TMPL/SubRES_NewTech_AGR_TUI.xlsx"
- "SubRES_TMPL/SubRES_NewTech_AGR_TUI_Trans.xlsx"
- "SubRES_TMPL/SubRES_NewTech_RC.xlsx"
- "SuppXLS/Trades/ScenTrade_TRADE_PARMS.xlsx"
- "SysSettings.xlsx"
- "SuppXLS/Scen_Base_constraints.xlsx"
- "SuppXLS/Scen_RE_Potentials.xlsx"
- "SuppXLS/Scen_LoadCurve_COM-FR.xlsx"
- "SuppXLS/Scen_AF_Renewable.xlsx"
- "SuppXLS/Scen_WEM_WCM.xlsx"
- "SuppXLS/Scen_Individualistic.xlsx"
dd_folder: TIMES-NZ-TUI
dd_files:
- "base.dd"
- "newtechs_industry.dd"
- "newtech_elc_tui.dd"
- "newtransport-tui.dd"
- "newtech_agr_tui.dd"
- "newtech_rc.dd"
- "trade_parms.dd"
- "syssettings.dd"
- "base_constraints.dd"
- "re_potentials.dd"
- "loadcurve_com-fr.dd"
- "af_renewable.dd"
- "wem_wcm.dd"
- "individualistic.dd"
78 changes: 78 additions & 0 deletions setup-benchmarks.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#!/bin/bash

# A helper script to setup or update the repositories containing benchmark models under `benchmarks/`

set -eo pipefail

# Commit SHA for each repository:
REF_TIMES_model="b488fb07f0899ee8b7e710c230b1a9414fa06f7d"
REF_demos_xlsx="34a2a5c044cc0bbea1357de50db2f5f02d575181"
REF_demos_dd="2848a8a8e2fdcf0cdf7f83eefbdd563b0bb74e86"
REF_tim="e820d8002adc6b1526a3bffcc439219b28d0eed5"
REF_tim_gams="703f6a4e1d0bedd95c3ebdae534496f3a7e1b7cc"
REF_TIMES_NZ="c83f2d0e51d692cba27a55032c8f8a2a48e4d425"

# If no GitHub token is provided, try to clone using SSH
if [ -z "$GH_PAT_DEMOS_XLSX" ]; then
echo "Warning: no GitHub token provided, will try to clone private repos using SSH"
use_SSH=1
fi

# Move to the directory containing this script
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
cd "$SCRIPT_DIR"

mkdir -p benchmarks

# Function to check out a repository at a specified commit
checkout_repo() {
local repo=$1
local dest_dir=$2
local commit=$3
local private=$4

if [ -d "$dest_dir" ]; then
echo "Directory $dest_dir already exists. Checking if on correct commit."
pushd "$dest_dir" > /dev/null
git fetch --depth=1 origin "$commit"
else
echo "Directory $dest_dir does not exist. Cloning repository."
if [ -n "$private" ]; then
if [ -n "$use_SSH" ]; then
repo_url="[email protected]:${repo}.git"
else
repo_url="https://$GH_PAT_DEMOS_XLSX@github.com/${repo}/"
fi
else
repo_url="https://github.com/${repo}/"
fi
git clone --filter=blob:none "$repo_url" "$dest_dir"
pushd "$dest_dir" > /dev/null
fi
git checkout "$commit" || exit 1
popd > /dev/null
echo "$dest_dir: successfully checked out $repo at $commit"
}

# Array of repositories to check out, in the form repo|dest_dir|commit|private
repositories=(
"etsap-TIMES/TIMES_model|TIMES_model|$REF_TIMES_model"
"olejandro/demos-dd|benchmarks/dd|$REF_demos_dd"
"olejandro/demos-xlsx|benchmarks/xlsx|$REF_demos_xlsx|true"
"esma-cgep/tim|benchmarks/xlsx/Ireland|$REF_tim"
"esma-cgep/tim-gams|benchmarks/dd/Ireland|$REF_tim_gams"
"olejandro/TIMES-NZ-Model-Files|benchmarks/TIMES-NZ|$REF_TIMES_NZ"
)

# Setup / update the repositories
for repo_info in "${repositories[@]}"; do
IFS='|' read -r repo dest_dir commit private <<< "$repo_info"
checkout_repo "$repo" "$dest_dir" "$commit" "$private"
done

# Create symlinks for TIMES-NZ since xlsx & dd files are in same repo
ln -s "$SCRIPT_DIR/benchmarks/TIMES-NZ/TIMES-NZ" "$SCRIPT_DIR/benchmarks/xlsx/TIMES-NZ"
ln -s "$SCRIPT_DIR/benchmarks/TIMES-NZ/TIMES-NZ-GAMS/times_scenarios/kea-v2_1_3" "$SCRIPT_DIR/benchmarks/dd/TIMES-NZ-KEA"
ln -s "$SCRIPT_DIR/benchmarks/TIMES-NZ/TIMES-NZ-GAMS/times_scenarios/tui-v2_1_3" "$SCRIPT_DIR/benchmarks/dd/TIMES-NZ-TUI"

echo "All benchmark repositories are set up and up to date :)"

0 comments on commit 7cc8a8b

Please sign in to comment.