diff --git a/chronix2grid/generation/consumption/consumption_utils.py b/chronix2grid/generation/consumption/consumption_utils.py index 063c387..1723ca7 100755 --- a/chronix2grid/generation/consumption/consumption_utils.py +++ b/chronix2grid/generation/consumption/consumption_utils.py @@ -63,8 +63,8 @@ def compute_residential(locations, Pmax, temperature_noise, params, weekly_patte nb_sec_per_day = 24. * 60. * 60. nb_sec_per_year = (365. * nb_sec_per_day) year_pattern = 2. * np.pi / nb_sec_per_year - #seasonal_pattern = 1.5 / 7. * np.cos(year_pattern * (t + start_min - 45 * nb_sec_per_day)) # min of the load is 15 of February so 45 days after beginning of year - seasonal_pattern = 1.5 / 7. * np.cos(year_pattern * (t - start_min - 30 * nb_sec_per_day)) + seasonal_pattern = 1.5 / 7. * np.cos(year_pattern * (t + start_min - 45 * nb_sec_per_day)) # min of the load is 15 of February so 45 days after beginning of year + #seasonal_pattern = 1.5 / 7. * np.cos(year_pattern * (t - start_min - 30 * nb_sec_per_day)) #older version to be removed seasonal_pattern += 5.5 / 7. # Get weekly pattern @@ -142,11 +142,11 @@ def create_csv(prng, dict_, path, forecasted=False, reordering=True, noise=None, df_reactive_power = 0.7 * df if noise is not None: - #df *= prng.lognormal(mean=0.0,sigma=noise, size=df.shape) - df *= np.random.lognormal(mean=0.0, sigma=noise, size=df.shape) - #df_reactive_power *= prng.lognormal(mean=0.0, sigma=noise, size=df.shape) - df_reactive_power *= np.random.lognormal(mean=0.0, sigma=noise, - size=df.shape) + df *= prng.lognormal(mean=0.0,sigma=noise, size=df.shape) + #df *= np.random.lognormal(mean=0.0, sigma=noise, size=df.shape) #older version to be removed + df_reactive_power *= prng.lognormal(mean=0.0, sigma=noise, size=df.shape) + #df_reactive_power *= np.random.lognormal(mean=0.0, sigma=noise, + # size=df.shape) #older version to be removed if write_results: file_extension = '_forecasted' if forecasted else '' diff --git a/chronix2grid/generation/consumption/generate_load.py b/chronix2grid/generation/consumption/generate_load.py index c9dc1bd..0f57307 100755 --- a/chronix2grid/generation/consumption/generate_load.py +++ b/chronix2grid/generation/consumption/generate_load.py @@ -40,7 +40,7 @@ def main(scenario_destination_path, seed, params, loads_charac, load_weekly_patt # Set random seed of scenario prng = default_rng(seed) - np.random.seed(seed) + #np.random.seed(seed) #older version - to be removed # Define reference datetime indices datetime_index = pd.date_range( @@ -57,7 +57,7 @@ def main(scenario_destination_path, seed, params, loads_charac, load_weekly_patt y_plus = int(y // dy_corr + 1) add_dim = max(y_plus, add_dim) add_dim = max(x_plus, add_dim) - add_dim=0 + #add_dim=0 #to get back to when this parameter did not exist - to be removed # Generate GLOBAL temperature noise print('Computing global auto-correlated spatio-temporal noise for thermosensible demand...') ## temperature is simply to reflect the fact that loads is correlated spatially, and so is the real "temperature". It is not the real temperature. diff --git a/chronix2grid/generation/generation_utils.py b/chronix2grid/generation/generation_utils.py index 079838b..2519e05 100644 --- a/chronix2grid/generation/generation_utils.py +++ b/chronix2grid/generation/generation_utils.py @@ -65,8 +65,8 @@ def generate_coarse_noise(prng, params, data_type, add_dim): Nt_comp = int(T // dt_corr + 1) + add_dim # Generate gaussian noise input· - output = np.random.normal(0, 1, (Nx_comp, Ny_comp, Nt_comp)) - #output = prng.normal(0, 1, (Nx_comp, Ny_comp, Nt_comp)) + #output = np.random.normal(0, 1, (Nx_comp, Ny_comp, Nt_comp)) + output = prng.normal(0, 1, (Nx_comp, Ny_comp, Nt_comp)) return output diff --git a/chronix2grid/generation/renewable/generate_solar_wind.py b/chronix2grid/generation/renewable/generate_solar_wind.py index ec0cfd6..2f9df71 100755 --- a/chronix2grid/generation/renewable/generate_solar_wind.py +++ b/chronix2grid/generation/renewable/generate_solar_wind.py @@ -44,7 +44,7 @@ def main(scenario_destination_path, seed, params, prods_charac, solar_pattern, w """ prng = default_rng(seed) - np.random.seed(seed) + #np.random.seed(seed) #olver version - to be removed smoothdist = params['smoothdist'] # Define datetime indices @@ -81,10 +81,6 @@ def main(scenario_destination_path, seed, params, prods_charac, solar_pattern, w add_dim = max(y_plus, add_dim) add_dim = max(x_plus, add_dim) - ########## - #Getting back to old model - add_dim=0 - ########## solar_noise = utils.generate_coarse_noise(prng, params, 'solar', add_dim=add_dim) long_scale_wind_noise = utils.generate_coarse_noise(prng, params, 'long_wind', add_dim=add_dim) medium_scale_wind_noise = utils.generate_coarse_noise(prng, params, 'medium_wind', add_dim=add_dim) diff --git a/chronix2grid/generation/renewable/solar_wind_utils.py b/chronix2grid/generation/renewable/solar_wind_utils.py index e813369..e9c9d0d 100755 --- a/chronix2grid/generation/renewable/solar_wind_utils.py +++ b/chronix2grid/generation/renewable/solar_wind_utils.py @@ -50,9 +50,9 @@ def compute_wind_series(prng, locations, Pmax, long_noise, medium_noise, short_n signal = (0.7 + 0.3 * seasonal_pattern) * (0.3 + std_medium_wind_noise * medium_scale_signal + std_long_wind_noise * long_scale_signal) signal += std_short_wind_noise * short_scale_signal signal = 1e-1 * np.exp(4 * signal) - # signal += prng.uniform(0, SMOOTHDIST/Pmax, signal.shape) - #signal += prng.uniform(0, smoothdist, signal.shape) - signal += np.random.uniform(0, smoothdist, signal.shape) + #signal += prng.uniform(0, SMOOTHDIST/Pmax, signal.shape) + signal += prng.uniform(0, smoothdist, signal.shape) + #signal += np.random.uniform(0, smoothdist, signal.shape) #older version - to be removed # signal *= 0.95 signal[signal < 0.] = 0. @@ -80,14 +80,14 @@ def compute_solar_series(prng, locations, Pmax, solar_noise, params, solar_patte mean_solar_pattern = 0.75 signal = solar_pattern * (mean_solar_pattern + std_solar_noise * final_noise) - # signal += prng.uniform(0, smoothdist/Pmax, signal.shape) - signal += np.random.uniform(0, smoothdist / Pmax, signal.shape) + #signal += prng.uniform(0, smoothdist/Pmax, signal.shape) #to be revised: since smmothdist/PMax is very small, the added noise compared to the previous sinal was unsignificant + #signal += np.random.uniform(0, smoothdist / Pmax, signal.shape) #older version - to be removed # signal[signal > 1] = 1 signal[signal < 0.] = 0. signal = smooth(signal) solar_series = Pmax * signal # solar_series[np.isclose(solar_series, 0.)] = 0 - #solar_series[solar_series > 0.95 * Pmax] = 0.95 * Pmax + solar_series[solar_series > 0.95 * Pmax] = 0.95 * Pmax return solar_series def compute_solar_pattern(params, solar_pattern): @@ -178,8 +178,8 @@ def create_csv(prng, dict_, path, reordering=True, noise=None, shift=False, new_ordering = [x for _ ,x in sorted(zip(value ,list(df)))] df = df[new_ordering] if noise is not None: - #df *= ( 1 +noise * prng.normal(0, 1, df.shape)) - df *= (1 + noise * np.random.normal(0, 1, df.shape)) + df *= ( 1 +noise * prng.normal(0, 1, df.shape)) + #df *= (1 + noise * np.random.normal(0, 1, df.shape)) #older version - to be removed if shift: df = df.shift(-1) df = df.fillna(0)