friendlysam.parts.Part

class friendlysam.parts.Part(name=None)

A part of a model.

End users probably primarily want to use the subclasses Node, FlowNetwork, etc.

The Part class serves several purposes:

  1. Part has the attribute constraints.

  2. A Part can contain other parts. Read more about

  3. Part implements Friendly Sam’s time model. Read more about

Parameters:name (str, optional) – The name of the part.

Examples

See Node for examples.

Part.add_part(part) Add a part to this part.
Part.find(name) Try to find a part by name.
Part.iter_times(start, *range_args) A generator yielding a sequence of times.
Part.iter_times_between(start, end) A generator yielding all times between two points.
Part.parts([depth, include_self]) Get contained parts, recursively.
Part.remove_part(part) Remove a part from this part.
Part.state_variables(index) The state variables of the part.
Part.step_time(index, num_steps) A function for stepping forward or backward in time.
Part.times(start, *range_args) Get a sequence of times.
Part.times_between(start, end) Get a tuple of all times between two points.
Part.children Parts in this part, excluding self.
Part.children_and_self Parts in this part, including self.
Part.constraints For defining and generating constraints.
Part.descendants All children, children of children, etc, excluding self.
Part.descendants_and_self All children, children of children, etc, including self.
Part.name A name for the object.
Part.time_unit The time unit used in step_time().