ConstantIntensitySurrogate¶
- class flexops.surrogates.constant_intensity.ConstantIntensitySurrogate(spec: SurrogateSpec | dict)¶
Sets a unit’s
energy_intensityrather than swapping a relation.The spec is:
{"surrogate_type": "constant_intensity", "config": {"input_variables": {"flow_out": "m^3/hr"}, "output_variables": {"power_electrical": "kW"}}, "parameters": {"energy_intensity": {"value": 0.9, "fixed": true}}}
- apply_to_unit(unit) Any¶
Set
unit’senergy_intensityvalue and fixed flag from the spec.- Parameters:
unit – The built unit.
- Returns:
The intensity component.
- Raises:
FlexConfigError – If a named variable is not on the unit or is not the one its intensity relates, if the unit has no regressable intensity, or if the spec frees an intensity that is a Param (which can’t be free).
- config_model¶
alias of
ConstantIntensityConfig
- property input_variables: dict[str, str]¶
Return the recorded input variable names; not resolved at build.
- classmethod make_spec(*, energy_intensity: float | None, input_variables: dict[str, str] | None = None, output_variables: dict[str, str] | None = None, fixed: bool = True, provenance: dict[str, Any] | None = None) SurrogateSpec¶
Return a validated constant-intensity spec.
- Parameters:
energy_intensity – The intensity, in the unit’s declared units, or
Noneto leave a free parameter at its current value.input_variables – The fitted input column and its units.
output_variables – The fitted output column and its units.
fixed – Whether the unit holds the intensity fixed.
provenance – Free-form fit metadata.
- Returns:
The spec.
- property output_variables: dict[str, str]¶
Return the recorded output variable names; not resolved at build.
- static parameter_of(unit)¶
Return
unit’s regressableenergy_intensitycomponent.- Raises:
FlexConfigError – If
unitdoes not register one.
- classmethod parameter_shapes(config: ConstantIntensityConfig) dict[str, tuple]¶
Return the one scalar parameter,
energy_intensity.
- read_from_unit(unit) SurrogateSpec¶
Return this surrogate’s spec with
unit’s live intensity.- Parameters:
unit – The built unit.
- Returns:
The spec, which re-applies the intensity as it stands.