|
1 | 1 | # Modelitool |
2 | 2 |
|
3 | | -Python tools for modelica. |
4 | | -Use only UTC in datetime index. |
5 | | - |
6 | | -## modelitool.measures.MeasuredDats |
7 | | - |
8 | | -<span style="background-color: #ffe600">***class modelitool.measures.***<span style="color: #ff0040; font-size:1em">**MeasuredDats**</span>***(data=None, data_type=\{\}, corr_dict=\{\})***</span> |
9 | | - |
10 | | - |
11 | | -Handle time series of measured data with missing or incorrect values. |
12 | | - |
13 | | -Modelica CombiTimeTable input file can be generated from raw data or corrected data. |
14 | | - |
15 | | - |
16 | | -**Parameters:** |
17 | | ->**data :** *DataFrame* index must be a UTC timezone aware datetime index. |
18 | | -
|
19 | | ->**data_type :** *Dictionary* keys are data_type name (eg. temperatures, power), item is a list of columns |
20 | | -
|
21 | | ->**corr_dict :** *Dictionary* keys are data_type name. Item is a dictionary holding correction methods properties |
22 | | -
|
23 | | - |
24 | | ->**Available corrections :** |
25 | | -- <code>minmax</code> : Remove values beyond or below specific threshold. Arguments : <code>upper, lower</code> |
26 | | -- <code>derivative</code> : Remove values when absolute variation between to timstep is beyond defined threshold. Arguments : <code>lower_rate, upper_rate</code> |
27 | | -- <code>fill_nan</code> : Fill <code>nan</code> values. Argument is a list of method : |
28 | | - - <code>bfill</code> : Back propagates the next not nan value |
29 | | - - <code>ffill</code> : Front propagates the last not nan value |
30 | | -- <code>linear_interpolation</code>: Interpolate value with <code>linear</code> method. |
31 | | -
|
32 | | -**Attributes** |
33 | | -- **data :** copy of raw data |
34 | | -- **data_type_dict :** dictionary of data_type |
35 | | -- **corrected_data :** corrected data. Copy of data if no correction is applied |
36 | | -- **corr_dict :** dictionary of corrections |
37 | | -- **correction_journal :** History of measures properties. Gaps and missing values |
38 | | - |
39 | | -**Methods** |
40 | | -- **remove_anomalies**_()_ : apply minmax and derivative corrections described in <code>corr_dict</code>. Update correction journal with dict of missing values and measure gaps resume |
41 | | -- **fill_nan**_()_ : apply <code>fill_nan</code> corrections described in <code>corr_dict</code>. Update correction journal with dict of missing values and measure gaps resume |
42 | | -- **resample**_(timestep)_ : resample <code>corrected_data</code> to specify timestep. If no timestep is specified, the function uses the DataFrame mean difference of its time index. |
43 | | -- **generate_combitimetable_input**_(file_path, corrected_data=True)_ : generate a modelica CombiTimeTable input file based on <code>data</code> or <code>corrected_data</code> |
44 | | -- **auto_correct**_()_ : apply <code>remove_anomalies(), fill_nan(), resample()</code> in that order, using default arguments |
45 | | - |
46 | | - |
47 | | -**Example** |
48 | | - |
49 | | -<pre><code> |
50 | | -my_measures = MeasuredDats( |
51 | | - data = my_dirty_measure_df, |
52 | | - data_type_dict = { |
53 | | - "power": ["Power1", "Power2"], |
54 | | - "temperatures": ["Temperature1", "Temperature2"] |
55 | | - }, |
56 | | - corr_dict = { |
57 | | - "power": { |
58 | | - "minmax": { |
59 | | - "upper": 40000, |
60 | | - "lower": 0 |
61 | | - }, |
62 | | - "derivative": { |
63 | | - "upper_rate": 5000, |
64 | | - "lower_rate": 0, |
65 | | - }, |
66 | | - "fill_nan": [ |
67 | | - "linear_interpolation", |
68 | | - "bfill", |
69 | | - "ffill" |
70 | | - ], |
71 | | - "resample": np.mean, |
72 | | - }, |
73 | | - "temperatures": { |
74 | | - "minmax": { |
75 | | - "upper": 50, |
76 | | - "lower": -2 |
77 | | - }, |
78 | | - "derivative": { |
79 | | - "upper_rate": 5, |
80 | | - "lower_rate": 0, |
81 | | - }, |
82 | | - "fill_nan": [ |
83 | | - "linear_interpolation", |
84 | | - "bfill", |
85 | | - "ffill" |
86 | | - ], |
87 | | - "resample": np.sum, |
88 | | - } |
89 | | - } |
90 | | -) |
91 | | -</code></pre> |
92 | | - |
93 | | -## modelitool.weather.OikolabWeatherData |
94 | | - |
95 | | -<span style="background-color: #ffe600">***class modelitool.weather.***<span style="color: #ff0040; font-size:1em">**OikolabWeatherData**</span>***(location_name=None, location_lat=None, location_long=None, start=None, end=None, api_key=None)***</span> |
96 | | - |
97 | | -Get meteorological data from oikolab API. Transforms it to epw and TMY5 file |
98 | | -Available data are: |
99 | | -- Dry bulb temperatures [°C] |
100 | | -- Dew point temperatures [°C] |
101 | | -- Relative humidity [%] |
102 | | -- Atmospheric pressure [Pa] |
103 | | -- Global horizontal radiation [W/m²] |
104 | | -- Direct normal radiation [W/m²] |
105 | | -- Diffuse solar radiation [W/m²] |
106 | | -- Wind direction [deg] |
107 | | -- Wind speed [m/s] |
108 | | -- Total cloud cover [0-1] |
109 | | -- Snowfall [mm of water equivalent] |
110 | | -- Total precipitation [mm of water] |
111 | | - |
112 | | - |
113 | | - |
114 | | -**Parameters:** |
115 | | ->**location_name :** *String* Name of the meteo station. |
116 | | -
|
117 | | ->**location_lat :** *Float* Meteo site location latitude |
118 | | -
|
119 | | ->**location_long :** *Float* Meteo site location longitude |
120 | | -
|
121 | | ->**start :** *String* starting point date time format : <code>"YYYY-MM-DDThh:mm:ss"</code> provite UTC |
122 | | -
|
123 | | ->**end :** *String* ending point date time format : <code>"YYYY-MM-DDThh:mm:ss"</code> provite UTC |
124 | | -
|
125 | | ->**api_key :** *String* Oikolab API key |
126 | | -
|
127 | | -**Attributes** |
128 | | -- **data :** DataFrame holding meteo data |
129 | | - |
130 | | -**Methods** |
131 | | -- **get_data**_()_ : Fetch meteorological data from Oikolab API |
132 | | -- **generate_tmy5**_(file_path)_ : generate a TMY5 *.mos file compatible with Modelica Building library reader |
133 | | -- **generate_epw**_(file_path)_ : generate a EPW *.epw file compatible with energyPlus |
134 | | - |
135 | | -**Example** |
136 | | -<pre><code> |
137 | | -my_weather = OikolabWeatherData( |
138 | | - location_name="Anglet", |
139 | | - location_lat=43.47414153237001, |
140 | | - location_long=-1.5095114151032965, |
141 | | - start='2017-01-01T00:00:00', |
142 | | - end='2017-12-31T23:00:00', |
143 | | - api_key="d414d453fb0f496fb6dfa1c3xxxxxxxx" |
144 | | -) |
145 | | -</code></pre> |
| 3 | +Python tools for modelica. |
0 commit comments