eta_utility.eta_x.envs.state module
- class eta_utility.eta_x.envs.state.StateVar(name: str, *, is_agent_action=False, is_agent_observation=False, add_to_state_log=True, ext_id: str | int | None = None, is_ext_input=False, is_ext_output=False, ext_scale_add=0, ext_scale_mult=1, interact_id: int | None = None, from_interact=False, interact_scale_add=0, interact_scale_mult=1, scenario_id: str | None = None, from_scenario=False, scenario_scale_add=0, scenario_scale_mult=1, low_value=nan, high_value=nan, abort_condition_min=None, abort_condition_max=None, index=0)[source]
Bases:
object
A variable in the state of an environment.
- is_agent_observation: bool
Should the agent be allowed to observe the value of this variable? (default: False).
- add_to_state_log: bool
Should the state log of this episode be added to state_log_longtime? (default: True).
- ext_id: str | int | None
Name or identifier (order) of the variable in the external interaction model (e.g.: environment or FMU) (default: StateVar.name if (is_ext_input or is_ext_output) else None).
- is_ext_input: bool
Should this variable be passed to the external model as an input? (default: False).
- is_ext_output: bool
Should this variable be parsed from the external model output? (default: False).
- interact_id: int | None
Name or identifier (order) of the variable in an interaction environment (default: None).
- from_interact: bool
Should this variable be read from the interaction environment? (default: False).
- scenario_id: str | None
Name of the scenario variable, this value should be read from (default: None).
- abort_condition_min: float | None
If the value of the variable dips below this, the episode should be aborted (default: None).
- abort_condition_max: float | None
If the value of the variable rises above this, the episode should be aborted (default: None).
- class eta_utility.eta_x.envs.state.StateConfig(*state_vars: StateVar)[source]
Bases:
object
The configuration for the action and observation spaces. The values are used to control which variables are part of the action space and observation space. Additionally, the parameters can specify abort conditions and the handling of values from interaction environments or from simulation. Therefore, the StateConfig is very important for the functionality of ETA X.
- vars: dict[str, StateVar]
Mapping of the variables names to their StateVar instance with all associated information.
- ext_inputs: list[str]
List of variables that should be provided to an external source (such as an FMU).
- ext_outputs: list[str]
List of variables that can be received from an external source (such as an FMU).
- rev_ext_ids: dict[str | int, str]
Reverse mapping of external IDs to their corresponding variable names.
- ext_scale: dict[str, dict[str, float]]
Dictionary of scaling values for external input values (for example from simulations). Contains fields ‘add’ and ‘multiply’
- interact_scale: dict[str, dict[str, float]]
Dictionary of scaling values for interact values. Contains fields ‘add’ and ‘multiply’.
- scenario_scale: dict[str, dict[str, float]]
Dictionary of scaling values for scenario values. Contains fields ‘add’ and ‘multiply’.
- classmethod from_dict(mapping: Sequence[Mapping[str, Any]] | pd.DataFrame) StateConfig [source]
This will convert a potentially incomplete StateConfig DataFrame or a list of dictionaries to the standardized StateConfig format. This will ignore any additional columns.
- Parameters:
mapping – Mapping to be converted to the StateConfig format.
- Returns:
StateConfig object.
- append_state(var: StateVar) None [source]
Append a state variable to the state configuration.
- Parameters:
var – StateVar instance to append to the configuration.
- store_file(file: Path) None [source]
Save the StateConfig to a comma separated file.
- Parameters:
file – Path to the file.
- within_abort_conditions(state: Mapping[str, float]) bool [source]
Check whether the given state is within the abort conditions specified by the StateConfig instance.
- Parameters:
state – The state array to check for conformance.
- Returns:
Result of the check (False if the state does not conform to the required conditions).
- continuous_action_space() Box [source]
Generate an action space according to the format required by the OpenAI specification.
- Returns:
Action space.
- continuous_obs_space() Box [source]
Generate a continuous observation space according to the format required by the OpenAI specification.
- Returns:
Observation Space.