State#
- class State(system, specification=None, parameters=None)[source]#
Create a State object that can update the system state given a sample of parameter states.
- Parameters:
- load_default_parameters(feedstock, shape=<function triang>, bounded_shape=<function bounded_triang>, operating_days=False, include_feedstock_price=True)#
Load all default parameters, including coefficients of cost items, stream prices, electricity price, heat utility prices, feedstock flow rate, and number of operating days.
- Parameters:
feedstock (Stream) – Main feedstock of process.
shape (function, optional) – Should take in baseline value and return a chaospy.Dist object or None. Default function returns a chaospy.Triangle object with bounds at +- 10% of baseline value. The distribution is applied to all parameters except exponential factor “n” of cost items.
bounded_shape (function, optional) – Should take in baseline value and return a chaospy.Dist object or None. Default function returns a chaospy.Triangle object with bounds at +- 0.1 of baseline value or minimum 0 and maximum 1. The distribution is applied to exponential factor “n” of cost items.
operating_days (bool, optional) – If True, include operating days
- get_baseline_sample(parameters=None, array=False)[source]#
Return a pandas Series object of parameter baseline values.
- property parameters#
tuple[Parameter] All parameters added to the model.
- get_joint_distribution()[source]#
Return a chaospy joint distribution object constituting of all parameter objects.
- parameter(setter=None, element=None, kind=None, name=None, distribution=None, units=None, baseline=None, bounds=None, hook=None, description=None, scale=None)[source]#
Define and register parameter.
- Parameters:
setter (function) – Should set parameter in the element.
element (Unit or
Stream
) – Element in the system being altered.kind ({'coupled', 'isolated', 'design', 'cost'}, optional) –
‘coupled’: parameter is coupled to the system.
’isolated’: parameter does not affect the system but does affect the element (if any).
’design’: parameter only affects design and/or cost of the element.
name (str, optional) – Name of parameter. If None, default to argument name of setter.
distribution (chaospy.Dist) – Parameter distribution.
units (str, optional) – Parameter units of measure
baseline (float, optional) – Baseline value of parameter.
bounds (tuple[float, float], optional) – Lower and upper bounds of parameter.
hook (Callable, optional) – Should return the new parameter value given the sample.
scale (float, optional) – The sample is multiplied by the scale before setting.
Notes
If kind is ‘coupled’, account for downstream operations. Otherwise, only account for given element. If kind is ‘design’ or ‘cost’, element must be a Unit object.
- problem()[source]#
Return a dictionary of parameter metadata (referred to as “problem”) to be used for sampling by
SALib
.See also
- sample(N, rule, **kwargs)[source]#
Return N samples from parameter distribution at given rule.
- Parameters:
Notes
This method relies on the
chaospy
library for sampling from distributions, and the``SALib`` library for sampling schemes specific to sensitivity analysis.For sampling from a joint distribution of all parameters, use the following
rule
flags:key
Description
C
Roots of the first order Chebyshev polynomials.
NC
Chebyshev nodes adjusted to ensure nested.
K
Korobov lattice.
R
Classical (Pseudo-)Random samples.
RG
Regular spaced grid.
NG
Nested regular spaced grid.
L
Latin hypercube samples.
S
Sobol low-discrepancy sequence.
H
Halton low-discrepancy sequence.
M
Hammersley low-discrepancy sequence.
If sampling for sensitivity analysis, use the following
rule
flags:key
Description
MORRIS
Samples for Morris One-at-A-Time (OAT)
RBD
Chebyshev nodes adjusted to ensure nested.
FAST
Korobov lattice.
SOBOL
Classical (Pseudo-) Random samples.
Note that only distribution bounds (i.e. lower and upper bounds) are taken into account for sensitivity analysis, the type of distribution (e.g., triangle vs. uniform) do not affect the sampling.