Normal distribution approach

For the normal distribution approach every time step is normally distributed to their previous and next time steps. The normal distribution equation looks like:

ND(x, t) = \frac{e^{-0.5 \frac{\left(x - t\right)^2}{\sigma^2}}}{\sqrt{2 \cdot \pi} \cdot \sigma}

To ensure the sum stays equal this equation is integrated:

NDI(x, t) = \frac{erf((x + 0.5 - t) / (\sigma \cdot \sqrt{2})) - erf((x - 0.5 - t) / (\sigma \cdot \sqrt{2}))}{2}

Which leads to the following approach for the new time series:

P_{new}^t =  \sum_{i=t-4 \cdot \lfloor\sigma+0.5\rceil}^{t+4 \cdot \lfloor\sigma+0.5\rceil} P_{original}^i \cdot NDI(i, t)

An example code is shown below:

../../examples/example_normal_distribution.py
 1"""
 2example python scripts for the normal distribution method
 3"""
 4from tssm import TimeSeriesScalingModule as tssm
 5
 6
 7def main() -> None:
 8    """
 9    main function to show normal distribution scaling examples
10    """
11    # initialize class with a number of buildings of 202 with a simultaneity factor of 0.786
12    scaling: tssm = tssm(1, 0.786, one_2_many=False)
13    # read profile from data.csv file and use the Electricity column
14    scaling.data.read_profile_from_csv("./test.csv", "0")
15    # calculate normal distribution with the variance for the given simultaneity factor
16    normal_distributed_values = scaling.calculate_using_normal_distribution()
17    # print results
18    print(f"normal_distributed_values: {normal_distributed_values}")
19    # calculate normal distribution with a given variance
20    # initialize class with a number of buildings of 202 with a simultaneity factor of 0.786
21    scaling = tssm(202)
22    # read profile from data.csv file and use the Electricity column
23    scaling.data.read_profile_from_csv_with_date("./data_flex_time_step_short.csv", "Heating", "Date")
24    # calculate normal distribution with a given variance
25    normal_distributed_values_with_given_variance = scaling.calculate_using_normal_distribution(sigma=1.2)
26    # print results
27    print(f"normal_distributed_values_with_given_variance: {normal_distributed_values_with_given_variance}")
28
29
30if __name__ == "__main__":
31    main()