Skip to content

model_input_schemas

AbstractScenarioModel

Bases: DataFrameModel

Base schema for scenario dataframe as used when creating a model.

Structure: - Index: datetime (time series) - Columns: - load_ (float): load in Amperes for each circuit (e.g., load_circuit1, load_circuit2, etc.) - screen_current__ (optional float): RMS screen current in amperes for a cable. - ambient_temperature (float): ambient temperature in degrees Celsius

Load and screen-current values describe the interval ending at their timestamp. The first row initializes the simulation; it does not drive a preceding interval.

Config

Configuration for the schema model.

check_datetime_index classmethod

check_datetime_index(df: DataFrame)

Ensure index is datetime-like or timedelta-like.

Source code in cable_thermal_model/model/schemas/model_input_schemas.py
45
46
47
48
49
@pa.dataframe_check(error="Scenario index must be either datetime-like or timedelta-like..")
@classmethod
def check_datetime_index(cls, df: pd.DataFrame):
    """Ensure index is datetime-like or timedelta-like."""
    return pd.api.types.is_datetime64_any_dtype(df.index) or pd.api.types.is_timedelta64_dtype(df.index)

check_no_missing_values classmethod

check_no_missing_values(df: DataFrame)

Ensure there are no missing values in the scenario dataframe.

Source code in cable_thermal_model/model/schemas/model_input_schemas.py
51
52
53
54
55
@pa.dataframe_check(error="Scenario dataframe must not contain missing values.")
@classmethod
def check_no_missing_values(cls, df: pd.DataFrame):
    """Ensure there are no missing values in the scenario dataframe."""
    return not df.isna().any().any()

ScenarioModelAir

Bases: AbstractScenarioModel

Air scenario schema extending the base scenario schema.

ScenarioModelSoil

Bases: AbstractScenarioModel

Soil scenario schema extending the base scenario schema.

get_screen_current_column

get_screen_current_column(cable_key: CableKey) -> str

Return the optional scenario column for a cable's RMS screen current.

Source code in cable_thermal_model/model/schemas/model_input_schemas.py
17
18
19
def get_screen_current_column(cable_key: "CableKey") -> str:
    """Return the optional scenario column for a cable's RMS screen current."""
    return f"screen_current_{cable_key.circuit_name}_{cable_key.cable_position.value}"