Esempio n. 1
0
    def __init__(self,
                 dfm,
                 run_uuid,
                 min_kw,
                 max_kw,
                 existing_kw,
                 fuel_slope_gal_per_kwh,
                 fuel_intercept_gal_per_hr,
                 fuel_avail_gal,
                 min_turn_down_pct,
                 outage_start_hour=None,
                 outage_end_hour=None,
                 time_steps_per_hour=1,
                 fuel_avail_before_outage_pct=1,
                 emissions_factor_lb_CO2_per_gal=None,
                 **kwargs):
        super(Generator, self).__init__(min_kw=min_kw, max_kw=max_kw, **kwargs)
        """
        super class init for generator is not unique anymore as we are now allowing users to define min/max sizes;
        and include diesel generator's size as optimization decision variable.
        
        Note that default burn rate, slope, and min/max sizes are handled in ValidateNestedInput.
        """

        self.fuel_slope = fuel_slope_gal_per_kwh
        self.fuel_intercept = fuel_intercept_gal_per_hr
        self.fuel_avail = fuel_avail_gal
        self.min_turn_down = min_turn_down_pct
        self.reopt_class = 'GENERATOR'
        self.outage_start_hour = outage_start_hour
        self.outage_end_hour = outage_end_hour
        self.time_steps_per_hour = time_steps_per_hour
        self.generator_only_runs_during_grid_outage = kwargs[
            'generator_only_runs_during_grid_outage']
        self.fuel_avail_before_outage_pct = fuel_avail_before_outage_pct
        self.generator_sells_energy_back_to_grid = kwargs[
            'generator_sells_energy_back_to_grid']
        self.diesel_fuel_cost_us_dollars_per_gallon = kwargs[
            'diesel_fuel_cost_us_dollars_per_gallon']
        self.derate = 0.0
        self.loads_served = ['retail', 'storage']
        self.incentives = Incentives(**kwargs)
        if max_kw < min_kw:
            min_kw = max_kw
        self.min_kw = min_kw
        self.max_kw = max_kw
        self.existing_kw = existing_kw
        self.emissions_factor_lb_CO2_per_gal = emissions_factor_lb_CO2_per_gal

        # no net-metering for gen so it can only sell in "wholesale" bin (and not "export" bin)
        if self.generator_sells_energy_back_to_grid:
            self.loads_served.append('wholesale')

        dfm.add_generator(self)
    def __init__(self,
                 dfm,
                 degradation_pct,
                 time_steps_per_hour=1,
                 acres_per_kw=6e-3,
                 kw_per_square_foot=0.01,
                 existing_kw=0.0,
                 tilt=0.537,
                 azimuth=180,
                 **kwargs):
        super(PV, self).__init__(**kwargs)

        self.degradation_pct = degradation_pct
        self.nmil_regime = 'BelowNM'
        self.reopt_class = 'PV'
        self.acres_per_kw = acres_per_kw
        self.kw_per_square_foot = kw_per_square_foot
        self.time_steps_per_hour = time_steps_per_hour
        self.incentives = Incentives(**kwargs)
        self.tilt = tilt
        self.azimuth = azimuth
        self.pvwatts_prod_factor = None
        self.existing_kw = existing_kw

        # if user hasn't entered the tilt (default value is 0.537), tilt value gets assigned based on array_type
        if self.tilt == 0.537:
            if kwargs.get(
                    'array_type'
            ) == 0:  # 0 are Ground Mount Fixed (Open Rack) arrays, we assume an optimal tilt
                """
                start assuming the site is in the northern hemisphere, set the tilt to the latitude and leave the 
                default azimuth of 180 (unless otherwise specified)
                """
                self.tilt = kwargs.get('latitude')
                if kwargs.get('latitude') < 0:
                    """
                    if the site is in the southern hemisphere, now set the tilt to the positive latitude value and 
                    change the azimuth to 0. Also update kwargs going forward so they get saved to the database later 
                    show up in final results
                    """
                    self.tilt = -1 * self.tilt
                    self.azimuth = 0
            else:  # All other tilts come from lookup table included in the array_type_to_tilt_angle dictionary above
                self.tilt = PV.array_type_to_tilt_angle[kwargs.get(
                    'array_type')]

        self.pvwatts = PVWatts(time_steps_per_hour=self.time_steps_per_hour,
                               azimuth=self.azimuth,
                               tilt=self.tilt,
                               **self.kwargs)

        dfm.add_pv(self)