SanUnit

class qsdsan.SanUnit(ID='', ins: Sequence[AbstractStream] | None = None, outs: Sequence[AbstractStream] | None = (), thermo=None, init_with='WasteStream', include_construction=True, construction=[], transportation=[], equipment=[], add_OPEX={}, uptime_ratio=1.0, lifetime=None, F_BM_default=None, isdynamic=False, exogenous_vars=(), **kwargs)

Subclass of biosteam.Unit, can be initialized with thermosteam.Stream, SanStream, or WasteStream.

Parameters:
  • init_with (str or dict) – Which class of stream the SanUnit will be initialized with, can be “Stream” (shorthanded as “s”), “SanStream” (“ss”), or “WasteStream” (“ws”). When provided as a str, all streams will be of the same class; when provided as a dict, use “ins” or “outs” followed with the order number (i.e., ins0, outs-1) as keys; you can use “:” to denote a range (e.g., ins2:4); you can also use “else” to specify the stream class for non-provided ones.

  • include_construction (bool) – Whether to include construction-related design (if applicable) in simulation.

  • construction (list(obj)) – Construction with construction information.

  • transportation (list(obj)) – Transportation with transportation information.

  • equipment (list(obj)) – Equipment with equipment information.

  • add_OPEX (float/int or dict) – Operating expense per hour in addition to utility cost (assuming 100% uptime). Float input will be automatically converted to a dict with the key being “Additional OPEX”.

  • uptime_ratio (float) –

    Uptime of the unit to adjust add_OPEX, should be in [0,1] (i.e., a unit that is always operating has an uptime_ratio of 1).

    Note

    This will not affect the utility (heating, cooling, power) and material costs/environmental impacts.

    To account for less utility and material flows, normalize them to the uptime_ratio of the system. For example, if the system operates 100% of time but a pump only works 50% of the pump at 50 kW. Set the pump power_utility to be 50*50%=25 kW.

lifetimeint or dict

Lifetime of this unit (int) or individual equipment within this unit (dict) in year. It will be used to adjust cost and emission calculation in TEA and LCA. Equipment without provided lifetime will be assumed to have the same lifetime as the TEA/LCA.

F_BM_defaultfloat

If not None, all bare module factors will be default to the set value.

Note

Regardless of F_BM_default, design (F_D), pressure (F_P), and material (F_M) factors are all defaulted to 1.

isdynamicbool

If this unit is simulated dynamically with rate equations.

exogenous_variterable[ExogenousDynamicVariable], optional

Any exogenously dynamic variables that affect the process mass balance. Must be independent of state variables of the process model (if has one).

kwargsdict

Additional keyword arguments that can be set for this unit.

property add_OPEX

[dict] Operating expense per hour in addition to utility cost. Float input will be automatically converted to a dict with the key being “Additional OPEX”.

add_construction(add_unit=True, add_design=True, add_cost=True, add_lifetime=True)

Batch-adding construction unit, designs, and costs.

property components

[Components] The Components object associated with this unit.

property construction

list(obj) Construction with construction information.

property equipment

list(obj) Equipment with equipment information.

eval_exo_dynamic_vars(t)

Evaluates the exogenous dynamic variables at time t.

property exo_dynamic_vars

[iterable[ExogenousDynamicVariable]] Exogenous dynamic variables that affect the process mass balance, e.g., temperature, sunlight irradiance.

property hasode

Whether this unit’s dynamic states are determined by ordinary differential equations.

heat_utilities: tuple[HeatUtility, ...]

All heat utilities associated to unit. Cooling and heating requirements are stored here (including auxiliary requirements).

property isdynamic

[bool] Whether the unit runs dynamically within a system.

property lifetime

[int or dict] Lifetime of this unit (int) or individual equipment within this unit (dict) in year. It will be used to adjust cost and emission calculation in TEA and LCA. Equipment without provided lifetime will be assumed to have the same lifetime as the TEA/LCA.

line: str = 'San unit'

class-attribute Name denoting the type of Unit class. Defaults to the class name of the first child class

parallel: dict[str, int]

Name-number pairs of baseline purchase costs and auxiliary unit operations in parallel. Use ‘self’ to refer to the main unit. Capital and heat and power utilities in parallel will become proportional to this value.

power_utility: PowerUtility

Electric utility associated to unit (including auxiliary requirements).

prioritize: bool

Whether to prioritize unit operation specification within recycle loop (if any).

reset_cache(dynamic_system=False)

Reset cached states for dynamic units.

results(with_units=True, include_utilities=True, include_total_cost=True, include_installed_cost=False, include_zeros=True, external_utilities=(), key_hook=None)

Return key results from simulation as a DataFrame if with_units is True or as a Series otherwise.

property scope

A tracker of the unit’s time-series data during dynamic simulation.

set_dynamic_tracker(*subjects, **kwargs)

Set up an SystemScope object to track the dynamic data.

Parameters:

*subjects – Any subjects of the system to track, which must have an .scope attribute of type Scope.

show(T=None, P=None, flow='g/hr', composition=None, N=15, IDs=None, stream_info=True)

Print information of the unit, including waste stream-specific information.

simulate(run=True, design_kwargs={}, cost_kwargs={}, **kwargs)

Converge mass and energy flows, design, and cost the unit.

Note

If this unit is a dynamic unit, AEs/ODEs will be run after _run and/or specification.

Parameters:
  • run – Whether to run the _run method, if not, will assume the same inlet and outlet conditions.

  • design_kwargs – Keyword arguments passed to _design method.

  • cost_kwargs – Keyword arguments passed to _cost method.

  • kwargs (dict) – Keyword arguments that will be passed to biosteam.systeam.dynamic_run (useful when running dynamic simulation).

See also

biosteam.System.dynamic_run()

scipy.integrate.solve_ivp

property transportation

list(obj) Transportation with transportation information.

property uptime_ratio

[float] Uptime of the unit to adjust add_OPEX, should be in [0,1] (i.e., a unit that is always operating).