Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable use of transmission techs in custom math #505

Merged
merged 38 commits into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
f5cfe90
Move change to correct backend file
brynpickering Oct 6, 2023
4c1abe2
Merge branch 'main' into update-remove-equals-and-scale
brynpickering Oct 24, 2023
e4e8be0
Remove `_equals` and `_scale` params
brynpickering Apr 21, 2023
e2912be
Clean diff by reverting to 4 space YAML indent
brynpickering Apr 25, 2023
1f24195
Minor fixes
brynpickering May 29, 2023
3895141
Add test to increase coverage
brynpickering May 29, 2023
4fa3e6a
Minor docs fix
brynpickering Oct 2, 2023
644edb6
run/model config -> config.init/build/solve
brynpickering Oct 5, 2023
a8db367
Update top-level param config
brynpickering Oct 11, 2023
d73dc96
Minor fixes
brynpickering Oct 24, 2023
34dacd0
Add comments to config options
brynpickering Oct 24, 2023
5fcabf0
Merge branch 'main' into update-top-level-config-params
brynpickering Oct 24, 2023
7549643
Minor fixes
brynpickering Oct 25, 2023
c271b0b
Create `definition_matrix`; new where helper func
brynpickering Oct 6, 2023
b3c985a
Fixes to handle definition_matrix
brynpickering Oct 6, 2023
2b5bf13
Add docstrings
brynpickering Oct 9, 2023
8167a41
Updates to clean up docs
brynpickering Oct 9, 2023
e3b66a1
Create `definition_matrix`; new where helper func
brynpickering Oct 6, 2023
79c07ff
Updates to clean up docs
brynpickering Oct 9, 2023
3f8aa87
Fix clean-up of model data with def matrix
brynpickering Oct 25, 2023
78b3ba8
Remove rogue file
brynpickering Oct 25, 2023
49231e6
Pre-commit run all
brynpickering Oct 25, 2023
c721d2e
Add custom math examples
brynpickering Oct 10, 2023
a27770b
Fix base math
brynpickering Oct 10, 2023
c37aa94
Start adding tests
brynpickering Oct 11, 2023
89d472d
Clean up example math & issues in code; add tests
brynpickering Oct 13, 2023
3903aea
Verbose constraint coords; minor name fixes
brynpickering Oct 25, 2023
dd01765
Track dev requirements in mamba CI cache decision
brynpickering Oct 25, 2023
f5f8696
Merge branch 'main' into feature-custom-math-examples
brynpickering Oct 26, 2023
150e455
Add helper function & net import math example.
brynpickering Oct 10, 2023
1e9e9f5
Add helper func test
brynpickering Oct 26, 2023
818a0ac
Add net import share custom math tests
brynpickering Oct 26, 2023
7fef103
Update doc/_static/custom_math/net_import_share.yaml
brynpickering Oct 30, 2023
db4d2f1
Update doc/_static/custom_math/net_import_share.yaml
brynpickering Oct 30, 2023
91bb23d
Update doc/_static/custom_math/net_import_share.yaml
brynpickering Oct 30, 2023
0d713ba
Update doc/_static/custom_math/net_import_share.yaml
brynpickering Oct 30, 2023
b9a5652
Merge branch 'main' into feature-transmissions-in-custom-math
brynpickering Oct 30, 2023
e9fc66c
Fixes in response to review
brynpickering Oct 30, 2023
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
4 changes: 4 additions & 0 deletions doc/_static/custom_math/annual_energy_balance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
# annual_flow_max (if summing over technologies and/or nodes)
# flow_max_group (if summing over technologies and/or nodes)

# helper functions used
# inheritance (where)
# sum (expression)

constraints:
annual_energy_balance_per_tech_and_node:
description: Limit total technology annual energy production at each possible deployment site.
Expand Down
3 changes: 3 additions & 0 deletions doc/_static/custom_math/chp_htp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@
# power_to_heat_ratio
# boiler_eff

# helper functions used
# reduce_carrier_dim (expression)

constraints:
# Extraction turbine constraints
# ~~
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
# demand_share_limit.
# decide_demand_share <- Link supply technologies to the demand technology they are going to be a share of.

# helper functions used
# sum (expression)
# select_from_lookup_arrays (expression)

variables:
demand_share_per_timestep_decision:
description: Relative share of demand that a given technology must meet per node.
Expand Down
4 changes: 4 additions & 0 deletions doc/_static/custom_math/fuel_dist.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
# fuel_distributor_costs
# allow_fuel_distribution <- lookup array with a value of `True` for each carrier where you want to track its distribution

# helper functions used
# any (where)
# sum (expression)

variables:
fuel_distributor:
description: >
Expand Down
3 changes: 3 additions & 0 deletions doc/_static/custom_math/max_time_varying.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
# flow_cap_max_relative_per_ts
# storage_max_relative_per_ts

# helper functions used
# reduce_carrier_dim (expression)

constraints:
max_time_varying_flow_cap:
description: Limit flow out in each hour according to a time varying fractional limit that is multiplied by the technology flow cap. This represents, for instance, the impact of outdoor temperature on the maximum output of a technology relative to its rated max output.
Expand Down
53 changes: 53 additions & 0 deletions doc/_static/custom_math/net_import_share.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Force upper limit on carrier imports within nodes or across all nodes as a share of all carrier flows at a node/across nodes.
# Imports of transmission technologies are defined by `flow_out` (outflow from a transmission technology that originated in a remote node).
# We assume that transmission technologies `test_transmission_elec` and `test_transmission_heat` have been defined.

# New top-level parameters:
# net_import_share

# helper functions used
# defined (where)
# sum (expression)
# get_transmission_techs (expression)

brynpickering marked this conversation as resolved.
Show resolved Hide resolved
constraints:
net_import_share_max:
description: Limit upper bound on electricity imports within nodes as a share of all electricity flows at each node.
foreach: [nodes, timesteps]
where: "defined(techs=test_transmission_elec, within=nodes, how=any)"
equations:
- expression: net_import_share * sum(flow_out[techs=$transmission_techs, carriers=electricity], over=techs) <= $total_energy_balance
sub_expressions:
total_energy_balance:
- expression: sum(flow_out[carriers=electricity], over=techs) - sum(flow_in[carriers=electricity], over=techs)
slices:
transmission_techs:
- expression: get_transmission_techs(test_transmission_elec)
sjpfenninger marked this conversation as resolved.
Show resolved Hide resolved

net_annual_import_share_max:
description: Limit upper bound on annual electricity imports within nodes as a share of all electricity flows at each node.
foreach: [nodes]
where: "defined(techs=test_transmission_elec, within=nodes, how=any)"
equations:
- expression: net_import_share * sum(flow_out[techs=$transmission_techs, carriers=electricity], over=[techs, timesteps]) <= $total_energy_balance
sub_expressions:
total_energy_balance:
- expression: sum(flow_out[carriers=electricity], over=[techs, timesteps]) - sum(flow_in[carriers=electricity], over=[techs, timesteps])
slices:
transmission_techs:
- expression: get_transmission_techs(test_transmission_elec)

net_annual_import_share_max_node_group:
description: Limit upper bound on annual heat imports across a subset of nodes in the model as a share of combined heat flows in those nodes.
equations:
- expression: net_import_share * sum(flow_out[techs=$transmission_techs, nodes=$node_group, carriers=$carrier], over=[nodes, techs, timesteps]) <= $total_energy_balance
sub_expressions:
total_energy_balance:
- expression: sum(flow_out[nodes=$node_group, carriers=$carrier], over=[nodes, techs, timesteps]) - sum(flow_in[nodes=$node_group, carriers=$carrier], over=[nodes, techs, timesteps])
slices:
transmission_techs:
- expression: get_transmission_techs(test_transmission_heat)
node_group: # The subset of nodes in which to limit heat imports
- expression: "[a, c]"
carrier: # The carrier for which to limit imports
- expression: heat
3 changes: 3 additions & 0 deletions doc/_static/custom_math/piecewise_linear_efficiency.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
# flow_eff_piecewise_slopes (defining the new parameter `pieces`)
# flow_eff_piecewise_intercept (defining the new parameter `pieces`)

# helper functions used
# reduce_carrier_dim (expression)

variables:
available_flow_cap:
description: Flow capacity that will be set to zero if the technology is not operating in a given timestep and will be set to the value of the decision variable `flow_cap` otherwise.
Expand Down
4 changes: 4 additions & 0 deletions doc/_static/custom_math/share_all_timesteps.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
# demand_share_equals
# supply_share_equals

# helper functions used
# sum (expression)
# reduce_carrier_dim (expression)

constraints:
demand_share_equals_per_tech:
description: Set the total outflow of certain technologies which produce the `power` carrier to a share of total demand inflow.
Expand Down
4 changes: 4 additions & 0 deletions doc/_static/custom_math/share_per_timestep.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
# demand_share_per_timestep_equals
# supply_share_per_timestep_equals

# helper functions used
# sum (expression)
# reduce_carrier_dim (expression)

constraints:
demand_share_per_timestep_equals_per_tech:
description: Set the per-timestep outflow of certain technologies which produce the `power` carrier to a share of demand inflow.
Expand Down
4 changes: 4 additions & 0 deletions doc/_static/custom_math/uptime_downtime_limits.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
# downtime_periods (from CSV as a timeseries)
# uptime_limit

# helper functions used
# sum (expression)
# reduce_carrier_dim (expression)

constraints:
annual_capacity_factor_min:
description: Limit the lower bound of annual technology operation as a fraction of annual operation at maximum capacity.
Expand Down
Loading