Component Abstract Base Classes

mcycle.bases.component.Component(…[, …]) Basic component with incoming and outgoing flows.
mcycle.bases.component.Component11(…[, …]) Component with 1 incoming and 1 outgoing flow of the working fluid.
mcycle.bases.component.Component22(…[, …]) Component with 2 incoming and 2 outgoing flows of the working fluid and a secondary fluid.
class mcycle.bases.component.Component(list flowsIn, list flowsOut=[None], FlowState ambient=None, unicode sizeAttr=u'', list sizeBounds=[], list sizeUnitsBounds=[], runBounds=[nan, nan], unicode name=u'Component instance', unicode notes=u'No notes/model info.', Config config=Config())

Bases: mcycle.bases.mcabstractbase.MCAB

Basic component with incoming and outgoing flows. The first flow in and out (index=0) should be allocated to the working fluid.

Parameters:

flowsIn : list of FlowState

Incoming FlowStates. Defaults to None.

flowsOut : list of FlowState, optional

Outgoing FlowStates. Defaults to None.

sizeAttr : string, optional

Default attribute used by size(). Defaults to None.

sizeBounds : float or list of float, optional

Bracket containing solution of size(). Defaults to None.

  • if sizeBounds=[a,b]: scipy.optimize.brentq is used.
  • if sizeBounds=a or [a]: scipy.optimize.newton is used.

name : string, optional

Description of Component object. Defaults to “Component instance”.

notes : string, optional

Additional notes on the component such as model numbers. Defaults “no notes”.

config : Config, optional

Configuration parameters. Defaults to default Config object.

kwargs : optional

Arbitrary keyword arguments.

Attributes

ambient ambient: mcycle.bases.flowstate.FlowState
config config: mcycle.bases.config.Config
flowInWf Alias for self.flowsIn[0]
flowOutWf Alias for self.flowsOut[0]
flowsIn flowsIn: list
flowsOut flowsOut: list
mWf Alias for self.flowsIn[0].m
name name: unicode
notes notes: unicode
runBounds runBounds: ‘double [2]’
sizeAttr sizeAttr: unicode
sizeBounds sizeBounds: list
sizeUnitsBounds sizeUnitsBounds: list

Methods

copy(self, dict kwargs={}) Return a new copy of a class object.
run(self) Compute the outgoing working fluid FlowState from component attributes.
size(self, unicode attr=u, list bounds=[], …)
sizeUnits(self, unicode attr, list bounds)
summary(self, bool printSummary=True[, …]) Returns (and prints) a summary of the component attributes/properties/flows.
update(self, dict kwargs) Update (multiple) class variables from a dictionary of keyword arguments.
ambient

ambient: mcycle.bases.flowstate.FlowState

config

config: mcycle.bases.config.Config

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.

flowInWf

Alias for self.flowsIn[0]

flowOutWf

Alias for self.flowsOut[0]

flowsIn

flowsIn: list

flowsOut

flowsOut: list

mWf

Alias for self.flowsIn[0].m

name

name: unicode

notes

notes: unicode

run(self) → void

Compute the outgoing working fluid FlowState from component attributes.

runBounds

runBounds: ‘double [2]’

size(self, unicode attr=u'', list bounds=[], list unitsBounds=[])
sizeAttr

sizeAttr: unicode

sizeBounds

sizeBounds: list

sizeUnits(self, unicode attr, list bounds) → void
sizeUnitsBounds

sizeUnitsBounds: list

summary(self, bool printSummary=True, propertyKeys=u'all', flowKeys=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 or str, optional

Keys of component 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’.

flowKeys : list or str, optional

Keys of component flows to be included. The following strings are also accepted as inputs:

  • ‘all’: all flows are included,

  • ‘none’: no flows are included.

    Defaults to ‘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.RSTHEADINGS. Defaults to 0.

update(self, dict kwargs) → void

Update (multiple) class variables from a dictionary of keyword arguments.

Parameters:

kwargs : dict

Dictionary of attributes and their updated value; kwargs={‘key’: value}.

class mcycle.bases.component.Component11(FlowState flowIn, FlowState flowOut=None, FlowState ambient=None, unicode sizeAttr=u'', list sizeBounds=[], list sizeUnitsBounds=[], runBounds=[nan, nan], unicode name=u'Component11 instance', unicode notes=u'No notes/model info.', config=Config())

Bases: mcycle.bases.component.Component

Component with 1 incoming and 1 outgoing flow of the working fluid.

Parameters:

flowIn : FlowState

Incoming FlowState.

flowOut : FlowState, optional

Outgoing FlowState. Defaults to None.

sizeAttr : string, optional

Default attribute used by size(). Defaults to None.

sizeBounds : float or list of float, optional

Bracket containing solution of size(). Defaults to None.

  • if sizeBounds=[a,b]: scipy.optimize.brentq is used.
  • if sizeBounds=a or [a]: scipy.optimize.newton is used.

name : string, optional

Description of Component object. Defaults to “Component instance”.

notes : string, optional

Additional notes on the component such as model numbers. Defaults “no notes”.

config : Config, optional

Configuration parameters. Defaults to default Config object.

kwargs : optional

Arbitrary keyword arguments.

Attributes

ambient ambient: mcycle.bases.flowstate.FlowState
config config: mcycle.bases.config.Config
flowIn Alias for self.flowsIn[0]
flowInSf Alias for self.flowsIn[1]
flowInWf Alias for self.flowsIn[0]
flowOut Alias for self.flowsOut[0]
flowOutSf Alias for self.flowsOut[1]
flowOutWf Alias for self.flowsOut[0]
flowsIn flowsIn: list
flowsOut flowsOut: list
m Alias for self.flowsIn[0].m
mWf Alias for self.flowsIn[0].m
name name: unicode
notes notes: unicode
runBounds runBounds: ‘double [2]’
sizeAttr sizeAttr: unicode
sizeBounds sizeBounds: list
sizeUnitsBounds sizeUnitsBounds: list

Methods

copy(self, dict kwargs={}) Return a new copy of a class object.
run(self) Compute the outgoing working fluid FlowState from component attributes.
size(self, unicode attr=u, list bounds=[], …)
sizeUnits(self, unicode attr, list bounds)
summary(self, bool printSummary=True[, …]) Returns (and prints) a summary of the component attributes/properties/flows.
update(self, dict kwargs) Update (multiple) class variables from a dictionary of keyword arguments.
ambient

ambient: mcycle.bases.flowstate.FlowState

config

config: mcycle.bases.config.Config

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.

flowIn

Alias for self.flowsIn[0]

flowInSf

Alias for self.flowsIn[1]

flowInWf

Alias for self.flowsIn[0]

flowOut

Alias for self.flowsOut[0]

flowOutSf

Alias for self.flowsOut[1]

flowOutWf

Alias for self.flowsOut[0]

flowsIn

flowsIn: list

flowsOut

flowsOut: list

m

Alias for self.flowsIn[0].m

mWf

Alias for self.flowsIn[0].m

name

name: unicode

notes

notes: unicode

run(self) → void

Compute the outgoing working fluid FlowState from component attributes.

runBounds

runBounds: ‘double [2]’

size(self, unicode attr=u'', list bounds=[], list unitsBounds=[])
sizeAttr

sizeAttr: unicode

sizeBounds

sizeBounds: list

sizeUnits(self, unicode attr, list bounds) → void
sizeUnitsBounds

sizeUnitsBounds: list

summary(self, bool printSummary=True, propertyKeys=u'all', flowKeys=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 or str, optional

Keys of component 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’.

flowKeys : list or str, optional

Keys of component flows to be included. The following strings are also accepted as inputs:

  • ‘all’: all flows are included,

  • ‘none’: no flows are included.

    Defaults to ‘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.RSTHEADINGS. Defaults to 0.

update(self, dict kwargs) → void

Update (multiple) class variables from a dictionary of keyword arguments.

Parameters:

kwargs : dict

Dictionary of attributes and their updated value; kwargs={‘key’: value}.

class mcycle.bases.component.Component22(FlowState flowInWf, FlowState flowInSf, FlowState flowOutWf=None, FlowState flowOutSf=None, FlowState ambient=None, unicode sizeAttr=u'', list sizeBounds=[], list sizeUnitsBounds=[], runBounds=[nan, nan], unicode name=u'Component22 instance', unicode notes=u'No notes/model info.', Config config=Config())

Bases: mcycle.bases.component.Component

Component with 2 incoming and 2 outgoing flows of the working fluid and a secondary fluid.

Parameters:

flowInWf : FlowState

Incoming FlowState of the working fluid.

flowInSf : FlowState

Incoming FlowState of the secondary fluid.

flowOutWf : FlowState, optional

Outgoing FlowState of the working fluid. Defaults to None.

flowOutSf : FlowState, optional

Outgoing FlowState of the secondary fluid. Defaults to None.

sizeAttr : string, optional

Default attribute used by size(). Defaults to None.

sizeBounds : float or list of float, optional

Bracket containing solution of size(). Defaults to None.

  • if sizeBounds=[a,b]: scipy.optimize.brentq is used.
  • if sizeBounds=a or [a]: scipy.optimize.newton is used.

name : string, optional

Description of Component object. Defaults to “Component instance”.

notes : string, optional

Additional notes on the component such as model numbers. Defaults “no notes”.

config : Config, optional

Configuration parameters. Defaults to default Config object.

kwargs : optional

Arbitrary keyword arguments.

Attributes

ambient ambient: mcycle.bases.flowstate.FlowState
config config: mcycle.bases.config.Config
flowInSf Alias for self.flowsIn[1]
flowInWf Alias for self.flowsIn[0]
flowOutSf Alias for self.flowsOut[1]
flowOutWf Alias for self.flowsOut[0]
flowsIn flowsIn: list
flowsOut flowsOut: list
mSf Alias for self.flowsIn[1].m
mWf Alias for self.flowsIn[0].m
name name: unicode
notes notes: unicode
runBounds runBounds: ‘double [2]’
sizeAttr sizeAttr: unicode
sizeBounds sizeBounds: list
sizeUnitsBounds sizeUnitsBounds: list

Methods

copy(self, dict kwargs={}) Return a new copy of a class object.
run(self) Compute the outgoing working fluid FlowState from component attributes.
size(self, unicode attr=u, list bounds=[], …)
sizeUnits(self, unicode attr, list bounds)
summary(self, bool printSummary=True[, …]) Returns (and prints) a summary of the component attributes/properties/flows.
update(self, dict kwargs) Update (multiple) class variables from a dictionary of keyword arguments.
ambient

ambient: mcycle.bases.flowstate.FlowState

config

config: mcycle.bases.config.Config

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.

flowInSf

Alias for self.flowsIn[1]

flowInWf

Alias for self.flowsIn[0]

flowOutSf

Alias for self.flowsOut[1]

flowOutWf

Alias for self.flowsOut[0]

flowsIn

flowsIn: list

flowsOut

flowsOut: list

mSf

Alias for self.flowsIn[1].m

mWf

Alias for self.flowsIn[0].m

name

name: unicode

notes

notes: unicode

run(self) → void

Compute the outgoing working fluid FlowState from component attributes.

runBounds

runBounds: ‘double [2]’

size(self, unicode attr=u'', list bounds=[], list unitsBounds=[])
sizeAttr

sizeAttr: unicode

sizeBounds

sizeBounds: list

sizeUnits(self, unicode attr, list bounds) → void
sizeUnitsBounds

sizeUnitsBounds: list

summary(self, bool printSummary=True, propertyKeys=u'all', flowKeys=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 or str, optional

Keys of component 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’.

flowKeys : list or str, optional

Keys of component flows to be included. The following strings are also accepted as inputs:

  • ‘all’: all flows are included,

  • ‘none’: no flows are included.

    Defaults to ‘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.RSTHEADINGS. Defaults to 0.

update(self, dict kwargs) → void

Update (multiple) class variables from a dictionary of keyword arguments.

Parameters:

kwargs : dict

Dictionary of attributes and their updated value; kwargs={‘key’: value}.