Skip to content

Transformer

The Transformer is the main object that needs to be defined to work with our thermal model.

Transformer

Transformer(
    user_specs: UserTransformerSpecifications,
    cooling_type: CoolerType,
)

Bases: ABC

Abstract class to define the transformer object.

Depending on the type of transformer (either PowerTransformer or DistributionTransformer), the transformer attains certain default attributes. These attributes can be overwritten by using the TR_Specs dictionary.

Attributes:

Name Type Description
cooling_type CoolerType

The cooling type. Can be CoolerType.ONAN or CoolerType.ONAF.

(TransformerSpecifications): The transformer specifications that you need to provide to build the transformer. Any optional specifications not provided will be taken from the default specifications.

Parameters:

Name Type Description Default
user_specs UserTransformerSpecifications

The transformer specifications that you need to provide to build the transformer. Any optional specifications not provided will be taken from the default specifications.

required
cooling_type CoolerType

The cooling type. Can be ONAN, ONAF.

required
Source code in transformer_thermal_model/transformer/base.py
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
def __init__(
    self,
    user_specs: UserTransformerSpecifications,
    cooling_type: CoolerType,
):
    """Initialize the Transformer object.

    Args:
        user_specs (UserTransformerSpecifications): The transformer specifications that you need to
            provide to build the transformer. Any optional specifications not provided will be taken from the
            default specifications.
        cooling_type (CoolerType): The cooling type. Can be ONAN, ONAF.
    """
    self.cooling_type: CoolerType = cooling_type
    self.specs = TransformerSpecifications.create(self.defaults, user_specs)

defaults abstractmethod property

The default transformer specifications.

PowerTransformer

PowerTransformer(
    user_specs: UserTransformerSpecifications,
    cooling_type: CoolerType,
    internal_component_specs: TransformerComponentSpecifications
    | None = None,
)

Bases: Transformer

A power transformer.

This class represents a power transformer. This class inherits from the Transformer class.

Attributes:

Name Type Description
internal_component_specs TransformerComponentSpecifications | None

The internal component specifications which are used to calculate the relative component capacities. Defaults to None.

Parameters:

Name Type Description Default
user_specs UserTransformerSpecifications

The transformer specifications that you need to provide to build the transformer. Any optional specifications not provided will be taken from the default specifications.

required
cooling_type CoolerType

The cooling type. Can be ONAN or ONAF.

required
internal_component_specs TransformerComponentSpecifications

The internal component specifications, which are used to calculate the limiting component. Defaults to None.

None
Source code in transformer_thermal_model/transformer/power.py
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
def __init__(
    self,
    user_specs: UserTransformerSpecifications,
    cooling_type: CoolerType,
    internal_component_specs: TransformerComponentSpecifications | None = None,
):
    """Initialize the transformer object.

    Args:
        user_specs (UserTransformerSpecifications): The transformer specifications that you need to
            provide to build the transformer. Any optional specifications not provided will be taken from the
            default specifications.
        cooling_type (CoolerType): The cooling type. Can be ONAN or ONAF.
        internal_component_specs (TransformerComponentSpecifications, optional): The internal component
            specifications, which are used to calculate the limiting component. Defaults to None.

    """
    logger.info("Creating a power transformer object.")
    logger.info("User transformer specifications: %s", user_specs)
    logger.info("Cooling type: %s", cooling_type)

    if internal_component_specs is not None:
        logger.info("Internal component specifications: %s", internal_component_specs)
        self.internal_component_specs = internal_component_specs

    super().__init__(
        user_specs=user_specs,
        cooling_type=cooling_type,
    )

defaults property

The ClassVar for default TransformerSpecifications.

If PowerTransformer is not initialised, uses the ONAF specifications.

tap_changer_capacity_ratio property

tap_changer_capacity_ratio: float | None

The ratio between the tap changer capacity and the nominal load of the transformer.

primary_bushing_capacity_ratio property

primary_bushing_capacity_ratio: float | None

The ratio between the primary bushing capacity and the nominal load of the transformer.

secondary_bushing_capacity_ratio property

secondary_bushing_capacity_ratio: float | None

The ratio between the secondary bushing capacity and the nominal load of the transformer.

int_cur_trans_capacity_ratio property

int_cur_trans_capacity_ratio: float | None

The ratio between the internal current transformer capacity and the nominal load of the transformer.

component_capacities property

component_capacities: dict

Puts the limits of all transformer components in a single dictionary.

DistributionTransformer

DistributionTransformer(
    user_specs: UserTransformerSpecifications,
)

Bases: Transformer

A distribution transformer.

The DistributionTransformer class represents a distribution transformer. This class inherits from the Transformer class. This transformer can only be used with ONAN (Oil Natural Air Natural) cooling type.

Initialising a distribution transformer.
>>> from transformer_thermal_model.schemas import UserTransformerSpecifications
>>> from transformer_thermal_model.transformer import DistributionTransformer

>>> transformer_specifications = UserTransformerSpecifications(
...     load_loss=5200,  # Transformer load loss [W]
...     nom_load_sec_side=900,  # Transformer nominal current secondary side [A]
...     no_load_loss=800,  # Transformer no-load loss [W]
...     amb_temp_surcharge=10,  # Ambient temperature surcharge [K]
... )
>>> # note that no cooling type can be specified here, as this is a distribution transformer
>>> my_transformer = DistributionTransformer(user_specs=transformer_specifications)
>>> # the default specifications that will be used when not provided
>>> print(my_transformer.defaults)
time_const_oil=180.0 time_const_windings=4.0 top_oil_temp_rise=60.0
winding_oil_gradient=23.0 hot_spot_fac=1.2 oil_const_k11=1.0
winding_const_k21=1 winding_const_k22=2 oil_exp_x=0.8 winding_exp_y=1.6
end_temp_reduction=0.0
>>> # the combination of the user specifications and the default specifications
>>> print(my_transformer.specs)
load_loss=5200.0 nom_load_sec_side=900.0 no_load_loss=800.0
amb_temp_surcharge=10.0 time_const_oil=180.0 time_const_windings=4.0
top_oil_temp_rise=60.0 winding_oil_gradient=23.0 hot_spot_fac=1.2
oil_const_k11=1.0 winding_const_k21=1 winding_const_k22=2 oil_exp_x=0.8
winding_exp_y=1.6 end_temp_reduction=0.0

Parameters:

Name Type Description Default
user_specs UserTransformerSpecifications

The transformer specifications that you need to provide to build the transformer. Any optional specifications not provided will be taken from the default specifications.

required
Source code in transformer_thermal_model/transformer/distribution.py
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
def __init__(
    self,
    user_specs: UserTransformerSpecifications,
):
    """Initialize the transformer object.

    Args:
        user_specs (UserTransformerSpecifications): The transformer specifications that you need to
            provide to build the transformer. Any optional specifications not provided will be taken from the
            default specifications.

    """
    logger.info("Creating a distribution transformer object.")
    logger.info("User transformer specifications: %s", user_specs)

    super().__init__(
        user_specs=user_specs,
        cooling_type=CoolerType.ONAN,
    )

defaults property

Return the default transformer specifications.