Skip to content

Commit 0319092

Browse files
committed
Some miscellaneous refactoring/tidy up
Signed-off-by: Davey Elder <iandavidelder@gmail.com>
1 parent b939799 commit 0319092

5 files changed

Lines changed: 15 additions & 74 deletions

File tree

docs/source/database_schema.mmd

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -275,33 +275,6 @@ limit_capacity_share {
275275
TEXT notes
276276
REAL share
277277
}
278-
limit_degrowth_capacity {
279-
TEXT operator PK
280-
TEXT region PK
281-
TEXT tech_or_group PK
282-
TEXT notes
283-
REAL rate
284-
REAL seed
285-
TEXT seed_units
286-
}
287-
limit_degrowth_new_capacity {
288-
TEXT operator PK
289-
TEXT region PK
290-
TEXT tech_or_group PK
291-
TEXT notes
292-
REAL rate
293-
REAL seed
294-
TEXT seed_units
295-
}
296-
limit_degrowth_new_capacity_delta {
297-
TEXT operator PK
298-
TEXT region PK
299-
TEXT tech_or_group PK
300-
TEXT notes
301-
REAL rate
302-
REAL seed
303-
TEXT seed_units
304-
}
305278
limit_emission {
306279
TEXT emis_comm PK
307280
TEXT operator PK
@@ -311,33 +284,6 @@ limit_emission {
311284
TEXT units
312285
REAL value
313286
}
314-
limit_growth_capacity {
315-
TEXT operator PK
316-
TEXT region PK
317-
TEXT tech_or_group PK
318-
TEXT notes
319-
REAL rate
320-
REAL seed
321-
TEXT seed_units
322-
}
323-
limit_growth_new_capacity {
324-
TEXT operator PK
325-
TEXT region PK
326-
TEXT tech_or_group PK
327-
TEXT notes
328-
REAL rate
329-
REAL seed
330-
TEXT seed_units
331-
}
332-
limit_growth_new_capacity_delta {
333-
TEXT operator PK
334-
TEXT region PK
335-
TEXT tech_or_group PK
336-
TEXT notes
337-
REAL rate
338-
REAL seed
339-
TEXT seed_units
340-
}
341287
limit_new_capacity {
342288
TEXT operator PK
343289
INTEGER period PK

temoa/_internal/table_data_puller.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
from temoa._internal.exchange_tech_cost_ledger import CostType, ExchangeTechCostLedger
2121
from temoa.components import costs
2222
from temoa.components.utils import get_variable_efficiency
23-
from temoa.extensions.economies_of_scale.core import data_puller as eos
2423
from temoa.types.model_types import EI, FI, SLI, CapData, FlowType
2524

2625
if TYPE_CHECKING:
@@ -491,14 +490,10 @@ def poll_cost_results(
491490
}
492491
)
493492

494-
# Get nonlinear costs from the EOS extension, if active
495-
eos.poll_costs(
496-
model=model,
497-
exchange_costs=exchange_costs,
498-
entries=entries,
499-
p_0=p_0_true,
500-
epsilon=epsilon,
501-
)
493+
if 'eos' in model.enabled_extensions:
494+
import temoa.extensions.economies_of_scale.core.data_puller as eos
495+
496+
eos.poll_costs(model, exchange_costs, entries, p_0_true, epsilon)
502497

503498
exchange_entries = exchange_costs.get_entries()
504499
return entries, exchange_entries

temoa/core/model.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,6 @@
3939
technology,
4040
time,
4141
)
42-
from temoa.extensions.economies_of_scale.core.model import (
43-
register_early_eos_components,
44-
)
4542
from temoa.extensions.framework import apply_model_extension_hooks, resolve_extension_specs
4643
from temoa.model_checking.validators import (
4744
no_slash_or_pipe,
@@ -570,7 +567,10 @@ def __init__(
570567
self.cost_invest = Param(self.cost_invest_rtv)
571568

572569
# Inject cost_invest_eos extension components prior to loan params, if active
573-
register_early_eos_components(self)
570+
if 'eos' in self.enabled_extensions:
571+
import temoa.extensions.economies_of_scale.core.model as eos
572+
573+
eos.register_early_eos_components(self)
574574

575575
self.default_loan_rate = Param(domain=NonNegativeReals)
576576
self.loan_rate = Param(
@@ -687,9 +687,13 @@ def __init__(
687687
self.seasonal_storage_constraints_rpsdtv = Set(
688688
dimen=6, initialize=storage.seasonal_storage_constraint_indices
689689
)
690-
self.limit_storage_fraction_param_rsdt = (
691-
Set()
692-
) # populated by hybrid_loader with (r, s, d, t, op) keys
690+
self.limit_storage_fraction_param_rsdt = Set(
691+
within=self.regional_global_indices
692+
* (self.time_season | self.time_season_sequential)
693+
* self.time_of_day
694+
* self.tech_storage
695+
* self.operator
696+
)
693697
self.limit_storage_fraction = Param(
694698
self.limit_storage_fraction_param_rsdt, validate=validate_0to1
695699
)

temoa/extensions/economies_of_scale/core/data_puller.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ def poll_costs(
3333
Poll the fixed and variable costs for all EOS clusters in the planning horizon
3434
and add them to the cost entries for the model.
3535
"""
36-
if 'eos' not in model.enabled_extensions:
37-
return
3836
model = cast('EOSModel', model)
3937

4038
global_discount_rate = value(model.global_discount_rate)

temoa/extensions/economies_of_scale/core/model.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,6 @@ class EOSModel(TemoaModel):
8282

8383
def register_early_eos_components(model: TemoaModel) -> None:
8484
"""Build cost_invest_eos components that must be instantiated before loan parameters."""
85-
if 'eos' not in model.enabled_extensions:
86-
return
8785
m = cast('EOSModel', model)
8886

8987
m.cost_invest_eos_rtn = Set(

0 commit comments

Comments
 (0)