friendlysam.parts.Storage¶
-
class
friendlysam.parts.
Storage
(resource, capacity=None, maxchange=None, name=None)¶ Simple storage model.
The storage has a volume function. It should be thought of as the volume at the beginning of a time step, such that
volume(t) + accumulation[resource](t) == volume(t+1)
, or more exactly,>>> s = Storage('my_resource') >>> t = 42 >>> t_plus_1 = s.step_time(t, 1) >>> s.accumulation['my_resource'](t) == s.volume(t_plus_1) - s.volume(t) True
Parameters: - resource – The resource to store.
- capacity (float, optional) – The maximum amount that can be stored. If
None
(the default), there is no limit. - maxchange (float, optional) – The
maxchange
of the storage. - name (str, optional) – The
name
of the node.
Examples
>>> from pandas import Timestamp, Timedelta >>> battery = Storage('power', name='Battery') >>> battery.time_unit = Timedelta('3h') >>> t = Timestamp('2015-06-10 18:00') >>> print(battery.accumulation['power'](t)) Battery.volume(2015-06-10 21:00:00) - Battery.volume(2015-06-10 18:00:00)
Storage.add_part (part) |
Add a part to this part. |
Storage.balance_constraints (index) |
Balance constraints for all resources. |
Storage.cluster (resource) |
Get a Cluster this node is in. |
Storage.find (name) |
Try to find a part by name. |
Storage.iter_times (start, *range_args) |
A generator yielding a sequence of times. |
Storage.iter_times_between (start, end) |
A generator yielding all times between two points. |
Storage.parts ([depth, include_self]) |
Get contained parts, recursively. |
Storage.remove_part (part) |
Remove a part from this part. |
Storage.set_cluster (cluster) |
Add this node to a Cluster . |
Storage.state_variables (index) |
The only state variable is volume (index) . |
Storage.step_time (index, num_steps) |
A function for stepping forward or backward in time. |
Storage.times (start, *range_args) |
Get a sequence of times. |
Storage.times_between (start, end) |
Get a tuple of all times between two points. |
Storage.unset_cluster (cluster) |
Remove from a Cluster . |
Storage.accumulation |
A dictionary of accumulation functions. |
Storage.children |
Parts in this part, excluding self . |
Storage.children_and_self |
Parts in this part, including self . |
Storage.constraints |
For defining and generating constraints. |
Storage.consumption |
A dictionary of consumption functions. |
Storage.descendants |
All children , children of children, etc, excluding self . |
Storage.descendants_and_self |
All children , children of children, etc, including self . |
Storage.inflows |
A dictionary of sets of inflow functions. |
Storage.name |
A name for the object. |
Storage.outflows |
A dictionary of sets of outflow functions. |
Storage.production |
A dictionary of production functions. |
Storage.resource |
The resource this storage stores. |
Storage.resources |
The set of resources this node handles. |
Storage.time_unit |
The time unit used in step_time() . |