Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ jobs:

- name: Clone SMSpp
run: |
git clone -b develop --recurse-submodules https://gitlab.com/smspp/smspp-project.git
git clone -b test_win --recurse-submodules https://gitlab.com/davide-f/smspp-project.git

- name: Compile SMSpp
run: |
Expand Down
4 changes: 2 additions & 2 deletions configs/S_2N.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ apply_weighting_patch: true # Whether to apply the weighting path to the model:

model_parameters: # Parameters for the model (example for microgrid)
buses_demand: [0, 1] # (mandatory) List of nodes where demand is installed; the same profile applies to each
bus_PV: null # Node where PV is installed; when null or missing, no PV is installed
bus_PV: 0 # Node where PV is installed; when null or missing, no PV is installed
bus_wind: null # Node where wind is installed; when null or missing, no wind is installed
bus_storage: null # Node where battery storage is installed; when null or missing, no battery storage is installed
bus_store: 2 # Node where the store is installed
bus_diesel: 0 # Node where diesel is installed; when null or missing, no diesel is installed
bus_diesel: 1 # Node where diesel is installed; when null or missing, no diesel is installed
buses_transformer: null # Nodes connected by a transformer; the trasformer is connected to each node and its following
bus_hydro: null # Node where hydro power plant is installed; when null or missing, no hydro is installed
# the available inflow is calculated proportionally to match a fraction (hydro_factor) of the total demand
Expand Down
25 changes: 19 additions & 6 deletions scripts/microgrid_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,23 +209,36 @@ def build_microgrid_model(
"battery",
bus=f"Bus {bus_store}",
carrier="battery",
p_nom_extendable=True,
capital_cost=assumptions.at["battery", "capital_cost"],
e_nom_extendable=True,
capital_cost=assumptions.at["battery", "capital_cost"]*4/5, # assumption: 80% cost of cell, 20% cost of converter
e_initial=0.,
e_cyclic=e_cycling,
)

n.add(
"Link",
"battery link",
carrier = "battery link",
carrier = "battery discharger",
bus0 = f"Bus {bus_store}",
bus1 = f"Bus {bus_store-1}",
p_min_pu = -1,
p_min_pu = 0,
p_max_pu = 1,
capital_cost=assumptions.at["battery", "capital_cost"],
capital_cost=assumptions.at["battery", "capital_cost"]/10,
marginal_cost=assumptions.at["battery", "OPEX_marginal"],
efficiency = 1,
efficiency = 0.9,
p_nom_extendable = True
)

n.add(
"Link",
"battery charger",
carrier = "battery link",
bus0 = f"Bus {bus_store-1}",
bus1 = f"Bus {bus_store}",
p_min_pu = 0,
p_max_pu = 1,
capital_cost=assumptions.at["battery", "capital_cost"]/10,
efficiency = 1.,
p_nom_extendable = True
)

Expand Down
18 changes: 13 additions & 5 deletions scripts/smspp_dispatch_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,14 +184,22 @@ def add_network(
n.links.p_nom_opt.values * n.links.p_min_pu.values,
- n.transformers.s_nom_opt,
])

# Max power flow
max_power_flow = mb.createVariable("MaxPowerFlow", NC_DOUBLE, ("NumberLines",))
max_power_flow[:] = np.concatenate([
n.lines.s_nom_opt.values,
n.links.p_nom_opt.values * n.links.p_max_pu.values,
n.transformers.s_nom_opt.values,
])

# Efficiency
efficiency = mb.createVariable("Efficiency", NC_DOUBLE, ("NumberLines",))
efficiency[:] = np.concatenate([
np.full(len(get_bus_idx(n, n.lines.bus1).values), 1.0),
n.links.efficiency.values,
np.full(len(get_bus_idx(n, n.transformers.bus1).values), 1.0),
])

# Susceptance
susceptance = mb.createVariable("LineSusceptance", NC_DOUBLE, ("NumberLines",))
Expand Down Expand Up @@ -372,8 +380,8 @@ def get_battery_blocks(n, id_initial, bub_carriers):
"MinStorage": 0.0,
"MaxStorage": row.p_nom_opt * row.max_hours,
"InitialStorage": init_store,
"StoringBatteryRho": row.efficiency_store,
"ExtractingBatteryRho": row.efficiency_dispatch,
"StoringBatteryRho": 1/row.efficiency_store,
"ExtractingBatteryRho": 1/row.efficiency_dispatch,
}
)
id_battery += 1
Expand All @@ -389,7 +397,7 @@ def get_battery_blocks(n, id_initial, bub_carriers):
{
"id": id_battery,
"block_type": "BatteryUnitBlock",
"MinPower": (row.e_nom_opt * e_min_pu.loc[:, idx_name]).values * 10,
"MinPower": - (row.e_nom_opt * e_max_pu.loc[:, idx_name]).values * 10,
"MaxPower": (row.e_nom_opt * e_max_pu.loc[:, idx_name]).values * 10,
"MinStorage": 0.0,
"MaxStorage": row.e_nom_opt,
Expand Down Expand Up @@ -600,7 +608,7 @@ def add_hydro_unit_blocks(mb, n, unit_count, hub_carriers):
from helpers import mock_snakemake

os.chdir(os.path.dirname(os.path.abspath(__file__)))
snakemake = mock_snakemake("smspp_dispatch_builder", configfiles=["configs/ALLbuthydro_5N.yaml"])
snakemake = mock_snakemake("smspp_dispatch_builder", configfiles=["configs/S_2N.yaml"])

logger = create_logger("smspp_dispatch_builder", logfile=snakemake.log[0])

Expand Down
Loading