def run(self): sim = Simulator(self.location, self.year_choice, Windturbine(5), terrain_factor = self.terrain_factor ) sim.latitude = self.latitude sim.longitude = self.longitude if self.store_wt_out: P_wt,_ = sim.calc_wind(self.windfeatures) else: P_wt = 0 if self.store_sp_out: P_sp,_ = sim.calc_solar(Az=self.solarfeatures[2::3], Inc=self.solarfeatures[1::3],sp_area=self.solarfeatures[0::3], sp_eff=self.sp_eff) else: P_sp = 0 if self.store_total_out: P_tot,_ = sim.calc_total_power(self.solarfeatures, self.windfeatures, self.sp_eff) else: P_tot = 0 data = {'Pwt':P_wt,'Psp': P_sp,'Ptot': P_tot} self.write_data(data, self.filename) evt = SimDoneEvent(myEVT_SIMDONE, -1, filename=self.filename) wx.PostEvent(self.parent, evt)
def collectyeardata(year): all_stats = pd.DataFrame(columns=['Name','Year','Lat','Lon','cost','solar_cost','wind_cost','cable_cost','cable_area','storage_cost','deficit_cost','total_surplus', 'total_storage','storage_st_cost','zp_st_cost','wt_st_cost','Zp1_angle','Zp1_or','Zp1_area','Zp2_angle','Zp2_or','Zp2_area','Zp3_angle', 'Zp3_or','Zp3_area','Zp4_angle','Zp4_or','Zp4_area','ZP_tot_area','Zp_tot_power','Turbine_n','Turbine_h','Terrain_f','Turbine_tot_power','Total_power']) for i in range(len(loc_array)): loc_data = Location(loc_array[i]) file_name = 'Data' + os.sep + 'location_' + str(loc_data.stn) + '.xlsx' excel_file = pd.ExcelFile(file_name) years = np.array(excel_file.sheet_names) if str(year) in years : sim = Simulator(file_name, str(year), turbine, index_col=0, latitude=loc_data.latitude, longitude=loc_data.longitude, terrain_factor=loc_data.terrain) configuratie = np.array([[10000,0,0,0],[0,0,0,0],[37,0,0,0]]) sol_power,_ = sim.calc_solar(Az=[0,0,0,0] ,Inc=[37,0,0,0] ,sp_area=[10000,0,0,0]) sol_power_total = np.sum(sol_power) inputs = {'Name': loc_data.name, 'Year': year, 'Lat': loc_data.latitude, 'Lon': loc_data.longitude, 'storage_st_cost': 0, 'zp_st_cost': 0, 'wt_st_cost': 0, 'Zp1_angle': configuratie[2][0], 'Zp1_or': configuratie[1][0], 'Zp1_area': configuratie[0][0], 'Zp2_angle': configuratie[2][1], 'Zp2_or': configuratie[1][1], 'Zp2_area': configuratie[0][1], 'Zp3_angle': configuratie[2][2], 'Zp3_or': configuratie[1][2], 'Zp3_area': configuratie[0][2], 'Zp4_angle': configuratie[2][3], 'Zp4_or': configuratie[1][3], 'Zp4_area': configuratie[0][3], 'ZP_tot_area': 10000, 'Zp_tot_power': sol_power_total, 'Turbine_n': 0, 'Turbine_h': 0, 'Terrain_f': loc_data.terrain, 'Turbine_tot_power': 0, 'Total_power': 0} all_stats = all_stats.append(inputs, ignore_index=True) #Uncomment this to store all the best stats from training print('Done with: ' + loc_array[i] + '. Year: ' + str(year)) all_stats.to_excel('Output_data' + os.sep + 'solardata_'+ str(year) + '_' + '.xlsx')
tr_rating=loc_data.terrain, sp_efficiency=16) best_pick = best_array[0] best_solar = best_pick[:12] best_wind = best_pick[-2:] best_pick_power, _ = sim.calc_total_power(best_solar, best_wind, 16) total_solar_sm = np.sum(best_solar[0::3]) costings = cost_calc.calculate_cost(best_pick_power, total_solar_sm, TURBINETYPE, int(best_wind[0])) stats = cost_calc.get_stats(best_pick_power, total_solar_sm, TURBINETYPE, int(best_wind[0])) sol_power, _ = sim.calc_solar(Az=best_solar[2::3], Inc=best_solar[1::3], sp_area=best_solar[0::3]) win_power, _ = sim.calc_wind(best_wind) win_power_total = np.sum(win_power) sol_power_total = np.sum(sol_power) inputs = { 'Name': loc_data.name, 'Year': years[j], 'Lat': loc_data.latitude, 'Lon': loc_data.longitude, 'storage_st_cost': 400, 'zp_st_cost': 160, 'wt_st_cost': 3210000, 'Zp1_angle': best_solar[1], 'Zp1_or': best_solar[2],