Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
bf3346d
setting up new directory structure for clear public vs intermal api …
ParticularlyPythonicBS Oct 7, 2025
f371420
removing star imports from model.py, more work is needed to tame thi…
ParticularlyPythonicBS Oct 8, 2025
c30d544
small taming of the model file, considering moving to a component fo…
ParticularlyPythonicBS Oct 8, 2025
2dc439c
adding placeholder files for component structure
ParticularlyPythonicBS Oct 8, 2025
1b42d77
distributing temoa_initialize into components
ParticularlyPythonicBS Oct 8, 2025
927e047
distributing temoa_rules into components
ParticularlyPythonicBS Oct 8, 2025
ff6e71f
fixing linting errors in _internal
ParticularlyPythonicBS Oct 8, 2025
08448e8
fixing linting errors in components
ParticularlyPythonicBS Oct 8, 2025
5eb0b3d
splitting up CreateSparseDicts, storing the chunks in precompute for…
ParticularlyPythonicBS Oct 9, 2025
eea8271
moving the chunked from precompute to the component files
ParticularlyPythonicBS Oct 9, 2025
e3ab9bb
cleaning up capacity.py
ParticularlyPythonicBS Oct 9, 2025
eb71312
cleaning up commodities.py
ParticularlyPythonicBS Oct 9, 2025
6ade404
cleaning up costs.py
ParticularlyPythonicBS Oct 9, 2025
d7f69b4
cleaning up emissions.py
ParticularlyPythonicBS Oct 9, 2025
6c0185b
cleaning up flows.py
ParticularlyPythonicBS Oct 9, 2025
53462dd
cleaning up geography.py
ParticularlyPythonicBS Oct 9, 2025
f4c1125
cleaning up limits.py
ParticularlyPythonicBS Oct 9, 2025
53353a2
cleaning up operations and merging ramping into it
ParticularlyPythonicBS Oct 9, 2025
1a7d3bf
cleaning up reserves.py
ParticularlyPythonicBS Oct 9, 2025
3babdbe
cleaning up storage.py
ParticularlyPythonicBS Oct 9, 2025
93ed924
cleaning up technology.py
ParticularlyPythonicBS Oct 9, 2025
ec5aac5
cleaning up time.py
ParticularlyPythonicBS Oct 9, 2025
084077e
cleaning up utils.py
ParticularlyPythonicBS Oct 9, 2025
8b8f663
updated backwards compat temoa_model to not used temoa_rules or init…
ParticularlyPythonicBS Oct 10, 2025
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
Prev Previous commit
Next Next commit
moving the chunked from precompute to the component files
  • Loading branch information
ParticularlyPythonicBS committed Oct 9, 2025
commit eea827162fd084eb6f94a5d2c7d4cf8801e2d950
340 changes: 0 additions & 340 deletions temoa/_internal/precompute.py

This file was deleted.

48 changes: 48 additions & 0 deletions temoa/components/capacity.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,3 +507,51 @@ def get_capacity_factor(M: 'TemoaModel', r, p, s, d, t, v):
return value(M.CapacityFactorProcess[r, p, s, d, t, v])
else:
return value(M.CapacityFactorTech[r, p, s, d, t])


def create_capacity_and_retirement_sets(M: 'TemoaModel'):
"""
Creates sets and dictionaries related to technology capacity, retirement,
and end-of-life material flows.
"""
logger.debug('Creating capacity, retirement, and construction/EOL sets.')
# Retirement periods
for r, _i, t, v, _o in M.Efficiency.sparse_iterkeys():
lifetime = value(M.LifetimeProcess[r, t, v])
for p in M.time_optimize:
is_natural_eol = p <= v + lifetime < p + value(M.PeriodLength[p])
is_early_retire = t in M.tech_retirement and v < p <= v + lifetime - value(
M.PeriodLength[p]
)
is_survival_curve = M.isSurvivalCurveProcess[r, t, v] and v <= p <= v + lifetime

if t not in M.tech_uncap and any((is_natural_eol, is_early_retire, is_survival_curve)):
M.retirementPeriods.setdefault((r, t, v), set()).add(p)

# Construction and End-of-life flows
for r, i, t, v in M.ConstructionInput.sparse_iterkeys():
M.capacityConsumptionTechs.setdefault((r, v, i), set()).add(t)

for r, t, v, o in M.EndOfLifeOutput.sparse_iterkeys():
if (r, t, v) in M.retirementPeriods:
for p in M.retirementPeriods[r, t, v]:
M.retirementProductionProcesses.setdefault((r, p, o), set()).add((t, v))

# Active capacity sets
M.newCapacity_rtv = set(
(r, t, v)
for r, p, t in M.processVintages
for v in M.processVintages[r, p, t]
if t not in M.tech_uncap and v in M.time_optimize
)
M.activeCapacityAvailable_rpt = set(
(r, p, t)
for r, p, t in M.processVintages
if M.processVintages[r, p, t] and t not in M.tech_uncap
)
M.activeCapacityAvailable_rptv = set(
(r, p, t, v)
for r, p, t in M.processVintages
for v in M.processVintages[r, p, t]
if t not in M.tech_uncap
)
Loading