Component

Design abilities for AguaClara drinking water treatment plant components

This module allows plant component classes to

  1. specify expert inputs and their defaults automatically

  2. propogate plant-wide design inputs throughout all of its subcomponents

  3. reconfigure Onshape Part Studios and Assemblies that represent plant components.

If a Component is instantiated with custom subcomponents, and the subcomponents have their own q and/or temp specified:

plant = Plant(
        q = 40 * u.L / u.s,
        filter = Filter(q = 20 * u.L / u.s)
    )

then the subcomponets will preserve their q and temp:

>>> plant.q
40 liter / second
>>> plant.filter.q
20 liter / second

Otherwise, subcomponents will inherit the main component’s q and temp:

>>> plant = Plant(q = 40 * u.L / u.s)
>>> plant.q
40 liter / second
>>> plant.filter.q
40 liter / second
class aguaclara.design.component.Component(**kwargs)[source]

An abstract class representing AguaClara plant components.

This class provides subclasses with the ability to record and propogate a configuration of plant design variables (q and temp) for a component and all of its subcomponents.

set_subcomponents()[source]

Set the plant-wide inputs of all subcomponents.

Call this function at the end of a subclass’s __init__() set q and temp for subcomponents, except when a subcomponent specifies its own custom q and temp.

serialize_properties()[source]

Return the properties (fields and @property functions) of a component as a dictionary string.

print_properties()[source]

Print the serialized properties with pretty indentation.

write_properties_to_file()[source]

Append the properties of a component to a file. If it does not exist, then the file is created.

Args:
  • filename (str): The name of the file