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 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)
Beispiel #3
0
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