Cycle Abstract Base Class

class mcycle.bases.cycle.Cycle(tuple _componentKeys, tuple _cycleStateKeys, Config config=Config(), unicode name=u'Cycle')

Bases: mcycle.bases.mcabstractbase.MCAB

Abstract base class for all cycles.

Parameters:

_componentKeys : tuple of string

Tuple of keywords of the cycle components.

_cycleStateKeys : tuple of string

Tuple of cycle state numbers, eg. (“1”, “20”, “21”, “3” …).

config : Config, optional

Configuration parameters. Defaults to default Config object.

Attributes

config Config: Cycle configuration parameters.
name name: unicode

Methods

copy(self, dict kwargs={}) Return a new copy of a class object.
plot(self) Abstract method: Plots the working fluid cycle states and other meaningful cycle properties (such as source and sink properties).
run(self, unicode componentKey=u, …) Abstract method: Compute all state FlowStates from initial FlowState and set component characteristics.
size(self) Abstract method: Sets all cycle states from design parameters and executes size() for each component.
summary(self, bool printSummary=True[, …]) Returns (and prints) a summary of the component attributes/properties/flows.
update(self, dict kwargs)
config

Config: Cycle configuration parameters. Setter sets config object for all cycle components.

copy(self, dict kwargs={})

Return a new copy of a class object. Kwargs (as dict) are passed to update() as a shortcut of simultaneously copying and updating.

Parameters:

kwargs : dict, optional

Dictionary of attributes and their updated value.

name

name: unicode

plot(self)

Abstract method: Plots the working fluid cycle states and other meaningful cycle properties (such as source and sink properties).

run(self, unicode componentKey=u'', FlowState flowState=None)

Abstract method: Compute all state FlowStates from initial FlowState and set component characteristics.

This function must be overridden by subclasses.

Parameters:

flowState : FlowState, optional

FlowState to intiate the cycle. Defaults to None. If None, will search components for a non None flowIn and use that to initiate the cycle.

component : string

Component for which flowState is set as flowInWf

size(self) → void

Abstract method: Sets all cycle states from design parameters and executes size() for each component.

summary(self, bool printSummary=True, propertyKeys=u'all', cycleStateKeys=u'none', componentKeys=u'all', dict componentKwargs={u'flowKeys': u'none', u'propertyKeys': u'none'}, unicode name=u'', int rstHeading=0)

Returns (and prints) a summary of the component attributes/properties/flows.

Parameters:

printSummary : bool, optional

If true, the summary string is printed as well as returned. Defaults to True.

propertyKeys : list, optional

Keys of cycle properties to be included. The following strings are also accepted as inputs:

  • ‘all’: all properties in _properties are included,

  • ‘none’: no properties are included.

    Defaults to ‘all’.

cycleStateKeys : list, optional

Names of cycle flow states to be included. The following strings are also accepted as inputs:

  • ‘all’: all flows are included,

  • ‘none’: no flows are included.

    Defaults to ‘none’.

componentKeys : list, optional

Names of components to be included. The following strings are also accepted as inputs:

  • ‘all’: all components in _components are included,

  • ‘none’: no components are included.

    Defaults to ‘all’.

componentKwargs : dict, optional

Kwargs to parse to component summaries. Defaults to {“flowKeys”:’none’, “propertyKeys”:’none’}.

name : str, optional

Name of instance used in summary heading. If None, the name property of the instance is used. Defaults to None.

rstHeading : int, optional

Level of reStructuredText heading to give the summary, 0 being the top heading. Heading style taken from mcycle.DEFAULTS.RST_HEADINGS. Defaults to 0.

update(self, dict kwargs) → void