-
Notifications
You must be signed in to change notification settings - Fork 88
/
techs.py
78 lines (60 loc) · 2.44 KB
/
techs.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
"""
Copyright (C) 2013 Stefan Pfenninger.
Licensed under the Apache 2.0 License (see LICENSE file).
techs.py
~~~~~~~~
Basic Technology class and additional custom classes for technologies to
perform custom initialization tasks during model initialization.
"""
from __future__ import print_function
from __future__ import division
class Technology(object):
"""Base Technology
If parameters need to be calculated from configuration settings, this
can be done in the __init__() function of a Technology subclass.
Technology subclasses must be named like so for core.py to find them:
`<Techname>Technology`.
`<Techname>` must always have the first letter capitalized, but no other
letters, even if it is an acronym (e.g., CspTechnology).
"""
def __init__(self, model=None, name=None):
"""
Initialization: perform any calculations that can be done without
having read in the full (time series) data. By default, this does
nothing apart from attaching the name property to the Technology
object.
Args:
o : (AttrDict) model settings -- not used for anything
name : (string) name for the technology
"""
super(Technology, self).__init__()
self.name = name
def _setup(self):
"""Setup: perform any calculations that need the full (time
series) data already read in. By default, this does nothing."""
pass
def __repr__(self):
if self.name:
return 'Generic technology ({})'.format(self.name)
else:
return 'Generic technology'
class CspTechnology(Technology):
"""Concentrating solar power (CSP)"""
def __init__(self, model):
"""
Based on settings in `model`, calculates the maximum storage time if
needed.
Args:
o : (AttrDict) model settings
"""
super(CspTechnology, self).__init__()
# If necessary, set storage capacity based on s_time
# and reference efficiency
if model.get_option('csp.constraints.use_s_time'):
s_time = model.get_option('csp.constraints.s_time')
e_cap_max = model.get_option('csp.constraints.e_cap_max')
e_eff_ref = model.get_eff_ref('e', 'csp')
model.set_option('csp.constraints.s_cap_max',
s_time * e_cap_max / e_eff_ref)
def __repr__(self):
return 'Concentrating solar power (CSP)'