Skip to content

Toolbox

This module contains a function that can be useful when working with the Transformer Thermal Model.a

Modules:

Name Description
temp_sim_profile_tools

Functions:

Name Description
create_temp_sim_profile_from_df

Create an InputProfile from a dataframe.

create_temp_sim_profile_from_df

create_temp_sim_profile_from_df(
    profile_as_dataframe: DataFrame,
) -> InputProfile

Create an InputProfile from a dataframe.

This function is added as support for the transformer thermal model. It is handy if you have a dataframe with the temperature simulation profile and you want to use it in the transformer thermal model. Be mindful of the names of the columns, since these are directly called in the function.

If you do not want to change column names, consider using the InputProfile.create method directly.

The dataframe should contain the following columns
  • timestamp: The timestamp of the profile.
  • load: The load profile.
  • ambient_temperature: The ambient temperature profile.
Creating an input profile from a dataframe.
>>> import pandas as pd

>>> profile = pd.DataFrame(
...     {
...         "timestamp": pd.to_datetime(["2021-01-01 00:00:00", "2021-01-01 01:00:00", "2021-01-01 02:00:00"]),
...         "load": [0, 0, 0],
...         "ambient_temperature": [5, 5, 5],
...     }
... )
>>> input_profile = create_temp_sim_profile_from_df(profile)

Parameters:

Name Type Description Default
profile_as_dataframe DataFrame

The dataframe containing the profile data.

required

Returns:

Name Type Description
InputProfile InputProfile

The temperature simulation profile.

Source code in transformer_thermal_model/toolbox/temp_sim_profile_tools.py
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
def create_temp_sim_profile_from_df(profile_as_dataframe: pd.DataFrame) -> InputProfile:
    """Create an InputProfile from a dataframe.

    This function is added as support for the transformer thermal model. It is
    handy if you have a dataframe with the temperature simulation profile and
    you want to use it in the transformer thermal model. Be mindful of the
    names of the columns, since these are directly called in the function.

    If you do not want to change column names, consider using the
    [InputProfile.create][transformer_thermal_model.schemas.thermal_model.input_profile.InputProfile.create]
    method directly.

    The dataframe should contain the following columns:
        - timestamp: The timestamp of the profile.
        - load: The load profile.
        - ambient_temperature: The ambient temperature profile.

    Example: Creating an input profile from a dataframe.
        ```python
        >>> import pandas as pd

        >>> profile = pd.DataFrame(
        ...     {
        ...         "timestamp": pd.to_datetime(["2021-01-01 00:00:00", "2021-01-01 01:00:00", "2021-01-01 02:00:00"]),
        ...         "load": [0, 0, 0],
        ...         "ambient_temperature": [5, 5, 5],
        ...     }
        ... )
        >>> input_profile = create_temp_sim_profile_from_df(profile)

        ```

    Args:
        profile_as_dataframe (pd.DataFrame): The dataframe containing the profile data.

    Returns:
        InputProfile: The temperature simulation profile.

    """
    return InputProfile.create(
        datetime_index=profile_as_dataframe["timestamp"],
        load_profile=profile_as_dataframe["load"],
        ambient_temperature_profile=profile_as_dataframe["ambient_temperature"],
    )