SurrogateElement¶
- class flexcore.config.spec.SurrogateElement(*, surrogate_type: ~flexcore.config.schema.SurrogateType, config_version: ~typing.Annotated[int, ~pydantic.types.Strict(strict=True), ~annotated_types.Ge(ge=1)] = 1, config: dict[str, ~typing.Any] = <factory>, parameters: dict[str, ~flexcore.config.schema.ParameterState] = <factory>, provenance: dict[str, ~typing.Any] = <factory>, kind: ~typing.Literal['surrogate'], unit: str, relation: str = 'power_electrical_relation', name: str | None = None)¶
A surrogate placed on one relation of a unit after the unit is built.
It carries a unit and relation plus exactly the fields of a SurrogateSpec (surrogate_type, config_version, config, parameters, provenance).
- classmethod from_surrogate_spec(spec: SurrogateSpec, *, unit: str, relation: str = 'power_electrical_relation', name: str | None = None) SurrogateElement¶
Place
speconrelationofunit.- Parameters:
spec – The surrogate to place.
unit – Name of the unit element it applies to.
relation – Name of the unit’s relation to replace.
name – Optional label.
- Returns:
The surrogate element.
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- to_surrogate_spec() SurrogateSpec¶
Return this element’s surrogate, without its placement.
- Returns:
A
SurrogateSpecwith this element’s type, config version, config, parameters, and provenance.