def get_wind_energy_output(self): ssc = pssc.PySSC() f = open(self.sam_export_json) self.dic = json.load(f) self.dic['wind_resource_filename'] = self.fp_srw wp_dat = pssc.dict_to_ssc_table(self.dic, "windpower") grid_dat = pssc.dict_to_ssc_table(self.dic, "grid") f.close() wp = Windpower.wrap(wp_dat) grid = Grid.from_existing(wp) grid.assign(Grid.wrap(grid_dat).export()) wp.execute() grid.execute() self.json_dict = wp.Outputs.export() # print(self.json_dict.keys()) # print (self.json_dict['gen']) self.df_output = pd.DataFrame() self.df_output[self.year] = self.json_dict['gen'] for col in self.df_output.columns: self.df_output[col] = preprocessing.minmax_scale( self.df_output[col].values.reshape(1, -1), feature_range=(0, 1), axis=1, copy=True).T if self.df_all is None: self.df_all = self.df_output.copy() else: self.df_all = pd.concat([self.df_all, self.df_output], axis=1)
def __init__(self, site: SiteInfo, interconnect_kw): """ Class that houses the hybrid system performance and financials. Enforces interconnection and curtailment limits based on PySAM's Grid module :param site: Power source site information (SiteInfo object) :param interconnect_kw: Interconnection limit [kW] """ system_model = GridModel.default("GenericSystemSingleOwner") financial_model: Singleowner.Singleowner = Singleowner.from_existing(system_model, "GenericSystemSingleOwner") super().__init__("Grid", site, system_model, financial_model) self._system_model.GridLimits.enable_interconnection_limit = 1 self._system_model.GridLimits.grid_interconnection_limit_kwac = interconnect_kw # financial calculations set up self._financial_model.value("add_om_num_types", 1) self._dispatch: GridDispatch = None # TODO: figure out if this is the best place for these self.missed_load = [0.] self.missed_load_percentage = 0.0 self.schedule_curtailed = [0.] self.schedule_curtailed_percentage = 0.0
def __init__(self, site: SiteInfo, interconnect_kw): system_model = GridModel.default("GenericSystemSingleOwner") financial_model: Singleowner.Singleowner = Singleowner.from_existing( system_model, "GenericSystemSingleOwner") super().__init__("Grid", site, system_model, financial_model) self.system_model.GridLimits.enable_interconnection_limit = 1 self.system_model.GridLimits.grid_interconnection_limit_kwac = interconnect_kw
def get_solar_energy_output(self): ssc = pssc.PySSC() f = open(self.sam_export_json) self.dic = json.load(f) self.dic['solar_resource_file'] = self.fp_srw ### uncomment if you want to change any model input parameters # self.dic['system_capacity'] = 20000 # self.dic['module_type'] = 0 # self.dic['dc_ac_ratio'] = 1.3 # self.dic['array_type'] = 2 # self.dic['tilt'] = 35 # self.dic['azimuth'] = 180 # self.dic['gcr'] = 0.40 # self.dic['losses'] = 14 # self.dic['en_snowloss'] = 0 # self.dic['inv_eff'] = 95 pv_dat = pssc.dict_to_ssc_table(self.dic, "pvwattsv7") grid_dat = pssc.dict_to_ssc_table(self.dic, "grid") f.close() pv = PVWatts.wrap(pv_dat) grid = Grid.from_existing(pv) grid.assign(Grid.wrap(grid_dat).export()) pv.execute() grid.execute() self.json_dict = pv.Outputs.export() # print(self.json_dict.keys()) self.df_output = pd.DataFrame() self.df_output[self.year] = self.json_dict['gen'] for col in self.df_output.columns: self.df_output[col] = preprocessing.minmax_scale( self.df_output[col].values.reshape(1, -1), feature_range=(0, 1), axis=1, copy=True).T if self.df_all is None: self.df_all = self.df_output.copy() else: self.df_all = pd.concat([self.df_all, self.df_output], axis=1)
Most recently tested against PySAM 2.2.3 @author: frohro """ import json import PySAM.GenericSystem as GenericSystem import PySAM.Grid as Grid import PySAM.Singleowner as Singleowner import PySAM.PySSC as pssc ssc = pssc.PySSC() with open("Examples/100mW_Generic.json") as f: dic = json.load(f) gs_dat = pssc.dict_to_ssc_table(dic, "generic_system") grid_dat = pssc.dict_to_ssc_table(dic, "grid") so_dat = pssc.dict_to_ssc_table(dic, "singleowner") gs = GenericSystem.wrap(gs_dat) grid = Grid.from_existing(gs) grid.assign(Grid.wrap(grid_dat).export()) # to create GenericSystem and Singleowner combined simulation, sharing the same data so = Singleowner.from_existing(gs) so.assign(Singleowner.wrap(so_dat).export()) gs.execute() grid.execute() so.execute() print('Made it past execute.') print(gs.Outputs.export()) # as dictionary