Dynamic Influent

QSDsan: Quantitative Sustainable Design for sanitation and resource recovery systems

This module is developed by:

Joy Zhang <joycheung1994@gmail.com>

This module is under the University of Illinois/NCSA Open Source License. Please refer to https://github.com/QSD-Group/QSDsan/blob/main/LICENSE.txt for license details.

class qsdsan.sanunits._dynamic_influent.DynamicInfluent(ID='', ins: Sequence[AbstractStream] | None = None, outs: Sequence[AbstractStream] | None = (), data_file=None, by_mass=False, interpolator=None, derivative_approximator=None, thermo=None, init_with='WasteStream', isdynamic=True, load_data_kwargs={}, intpl_kwargs={}, **kwargs)

A fake SanUnit to generate a dynamic WasteStream at its outlet by interpolating time-series data.

Parameters:
  • ID (str, optional) – ID for the dynamic influent generator. The default is ‘’.

  • outs (WasteStream) – Dynamic influent.

  • data_file (str, optional) – The file path for the time-series data. Acceptable file extensions are .xlsx, .xls, .csv, .tsv. If none specified, will load the default time-series data of dry-weather influent with components from ASM1.

  • by_mass (bool, optional) –

    Whether time-series data indicate mass flowrates. If True, all columns assumed in kg/hr. If False, data are assumed to indicate concentrations [mg/L] and total volumetric flowrate [m3/d]. The default is False.

    Note

    When by_mass is set to True, the state array of the unit as well as the state array of its effluent by default indicate mass flow rates in g/d. This may not be consistent with downstream assumptions.

interpolatorstr|int|callable, optional

Interpolation method to use. It can be a string (e.g., ‘slinear’, ‘quadratic’, ‘cubic’) or an integer within [1,5] to specify the order of a spline interpolation. Other strings will be passed on to scipy.interpolate.interp1d as the ‘kind’ argument. It can also be a class in scipy.interpolate that takes time-series data as input upon initiation. Interpolant that is not at least first-order differentiable is not recommended (e.g., linear interpolation). The default is scipy.interpolate.CubicSpline.

derivative_approximatorcallable, optional

Function that returns derivative of the variable at given time. If none specified, will use the derivative() method of (if available) of the interpolant.

load_data_kwargsdict, optional

Keyword arguments for loading the data file with the qsdsan.utils.load_data() function. The default is {}.

intpl_kwargsdict, optional

Keyword arguments for initiating the interpolant. The default is {}.

derivative(t)

Returns the estimated time derivatives at time t.

property derivative_approximator

[callable] The function to estimate time derivatives.

interpolant(t)

Returns the interpolated values at time t.

property interpolator

[callable] The interpolation method.

line: str = 'Dynamic influent'

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