trnsystor.collections.ComponentCollection

class trnsystor.collections.ComponentCollection(initlist=None)[source]

A class that handles collections of components.

Supported members:
  • TrnsysModels

  • EquationCollections

  • ConstantCollections

Get a component from a ComponentCollection using either the component’s unit numer or its full name.

Examples

>>> from trnsystor.collections import ComponentCollection
>>> cc = ComponentCollection()
>>> cc.update({tank_type: tank_type})
>>> cc['Storage Tank; Fixed Inlets, Uniform Losses']._unit = 1
>>> cc[1]
Type146: Single Speed Fan/Blower
>>> cc['Single Speed Fan/Blower']
Type146: Single Speed Fan/Blower
property iloc

Access a component by its unit_number.

property loc

Access a components by its identify (self).

Examples

>>> cc = ComponentCollection([tank_type])
>>> assert cc.loc[tank_type] == cc.iloc[tank_type.unit_number]
append(item)

S.append(value) – append value to the end of the sequence

clear()None remove all items from S
count(value)integer return number of occurrences of value
extend(other)

S.extend(iterable) – extend sequence by appending elements from the iterable

index(value[, start[, stop]])integer return first index of value.

Raises ValueError if the value is not present.

Supporting start and stop arguments is optional, but recommended.

insert(i, item)

S.insert(index, value) – insert value before index

pop([index])item remove and return item at index (default last).

Raise IndexError if list is empty or index is out of range.

remove(item)

S.remove(value) – remove first occurrence of value. Raise ValueError if the value is not present.

reverse()

S.reverse() – reverse IN PLACE