|
1 | | -import os |
2 | 1 | from pownet.stochastic.solar import SolarTSModel |
3 | | -from pownet.stochastic.demand import DemandTSModel |
4 | 2 | import pandas as pd |
5 | 3 | import matplotlib.pyplot as plt |
6 | 4 |
|
|
9 | 7 | # Show info |
10 | 8 | logging.basicConfig(level=logging.INFO) |
11 | 9 |
|
12 | | -# %% Demand |
13 | | - |
14 | | -data = pd.read_csv("../temp/hourly_demand_2023.csv") |
15 | | - |
16 | | -demand_model = DemandTSModel() |
17 | | -demand_model.load_data(data) |
18 | | -exog_vars = ["temp", "rhum", "prcp", "weekend"] |
19 | | - |
20 | | -# arima_order, seasonal_order = demand_model.find_best_model( |
21 | | -# target_column="demand", |
22 | | -# exog_vars=exog_vars, |
23 | | -# ) |
| 10 | +# %% Solar |
| 11 | +data = pd.read_csv("../temp/merra_2019.csv") |
24 | 12 |
|
| 13 | +solar_model = SolarTSModel() |
| 14 | +solar_model.load_data(data) |
25 | 15 |
|
26 | | -demand_model.fit( |
27 | | - target_column="demand", |
28 | | - exog_vars=exog_vars, |
29 | | - arima_order=(1, 0, 1), |
30 | | - seasonal_order=(0, 0, 0, 0), |
31 | | -) |
32 | | -predictions = demand_model.predict() |
| 16 | +solar_model.fit(target_column="ground_irradiance", arima_order=(2, 1, 2)) |
| 17 | +predictions = solar_model.predict() |
33 | 18 |
|
34 | | -data.index = pd.to_datetime(data["datetime"]) |
35 | | -exog_data = data[exog_vars].astype(float) |
36 | | -synthetic = demand_model.get_synthetic(exog_data=exog_data) |
| 19 | +resids = solar_model.pred_residuals |
37 | 20 |
|
| 21 | +synthetic = solar_model.get_synthetic() |
38 | 22 |
|
39 | | -duration = 10 |
| 23 | +duration = 30 |
40 | 24 | # plt.plot(predictions[: 24 * 3], label="Predictions") |
41 | 25 | plt.plot(synthetic[: 24 * duration], label="Synthetic") |
42 | 26 | plt.plot( |
43 | | - data.set_index("datetime")["demand"].iloc[: 24 * duration], |
| 27 | + data.set_index("datetime")["ground_irradiance"].iloc[: 24 * duration], |
44 | 28 | label="Actual", |
45 | 29 | ) |
46 | 30 | plt.legend() |
47 | 31 | plt.show() |
48 | | - |
49 | | -"""# %% Solar |
50 | | -data = pd.read_csv("../temp/merra_2019.csv") |
51 | | -
|
52 | | -solar_model = SolarTSModel() |
53 | | -solar_model.load_data(data) |
54 | | -
|
55 | | -solar_model.fit(target_column="ground_irradiance", arima_order=(2, 1, 2)) |
56 | | -predictions = solar_model.predict() |
57 | | -
|
58 | | -resids = solar_model.pred_residuals""" |
59 | | - |
60 | | -# synthetic = solar_model.get_synthetic() |
61 | | - |
62 | | -# duration = 30 |
63 | | -# # plt.plot(predictions[: 24 * 3], label="Predictions") |
64 | | -# plt.plot(synthetic[: 24 * duration], label="Synthetic") |
65 | | -# plt.plot( |
66 | | -# data.set_index("datetime")["ground_irradiance"].iloc[: 24 * duration], |
67 | | -# label="Actual", |
68 | | -# ) |
69 | | -# plt.legend() |
70 | | -# plt.show() |
0 commit comments