import math


def repeat_data(preload, num_simulation_steps):
    """Repeats the transformer preload data until there are as many values as there are
    simulation steps.

    Args:
        preload: (list): Containing the data (floats) to be repeated.
        num_simulation_steps: (int): Number of simulation steps and expected length of
            the transformer preload after it is repeated.

    Returns:
        transformer_preload_repeated: (list): Repeated values. len() = num_simulation_steps.
        """

    n = math.floor(num_simulation_steps / len(preload))

    transformer_preload_repeated = preload * n

    values_to_add = num_simulation_steps - len(transformer_preload_repeated)

    transformer_preload_repeated += preload[:values_to_add]

    return transformer_preload_repeated