Spaces:
Sleeping
Sleeping
Puneet Gopinath
feat: add reward and done fields; update observation return in environment
56cccac unverified | # Copyright (c) Meta Platforms, Inc. and affiliates. | |
| # All rights reserved. | |
| # | |
| # This source code is licensed under the BSD-style license found in the | |
| # LICENSE file in the root directory of this source tree. | |
| """ | |
| Data models for the Smart Grid Environment. | |
| The smart_grid environment is a simple test environment that simulates energy distribution in a smart grid powered by solar and wind energy. | |
| """ | |
| from pydantic import Field | |
| from openenv.core.env_server.types import Action, Observation | |
| class SmartGridAction(Action): | |
| """Action for the Smart Grid environment - details of controlling energy distribution.""" | |
| supply_r1: float = Field(default=0.0, ge=0, description="Supply to region 1 (MW)") | |
| supply_r2: float = Field(default=0.0, ge=0, description="Supply to region 2 (MW)") | |
| supply_r3: float = Field(default=0.0, ge=0, description="Supply to region 3 (MW)") | |
| charge_battery: float = Field(default=0.0, description="Amount to charge (positive) or discharge (negative) the battery (MW)") | |
| class SmartGridObservation(Observation): | |
| """ | |
| Observation returned by the Smart Grid environment at each timestamp. | |
| Represents current status of energy grid distribution. | |
| """ | |
| hour: int = Field(default=0, ge=0, le=23, description="Current hour of the day in the simulation (0-23)") | |
| demand_r1: float = Field(default=0.0, ge=0, description="Simulated demand for region 1") | |
| demand_r2: float = Field(default=0.0, ge=0, description="Simulated demand for region 2") | |
| demand_r3: float = Field(default=0.0, ge=0, description="Simulated demand for region 3") | |
| solar_generation: float = Field(default=0.0, ge=0, description="Simulated solar generation (MW)") | |
| wind_generation: float = Field(default=0.0, ge=0, description="Simulated wind generation (MW)") | |
| battery_level: float = Field(default=0.0, ge=0, description="Current battery storage level in simulation (MWh)") | |
| battery_capacity: float = Field(default=100.0, ge=0, description="Maximum battery capacity (MWh)") | |
| reward: float = Field(default=0.0, description="Reward received at this step based on the action taken and resulting state") | |
| done: bool = Field(default=False, description="Whether the episode has ended after this step") | |