示例#1
0
    def __init__(self, params):
        """ Generates the objective function, finds and creates constraints.

          Args:
            params (Dict): input parameters

        """

        # generate the generic service object
        ValueStream.__init__(self, 'Resource Adequacy', params)

        # add RA specific attributes
        self.days = params['days']  # number of peak events
        self.length = params['length']  # discharge duration
        self.idmode = params['idmode'].lower()  # peak selection mode
        self.dispmode = params['dispmode']  # dispatch mode
        self.capacity_rate = params[
            'value']  # monthly RA capacity rate (length = 12)
        if 'active hours' in self.idmode:
            self.active = params[
                'active'] == 1  # active RA timesteps (length = 8760/dt) must be boolean, not int
        self.system_load = params[
            'system_load']  # system load profile (length = 8760/dt)

        # initialize the following atrributes to be set later
        self.peak_intervals = []
        self.event_intervals = None
        self.event_start_times = None
        self.charge_max_constraint = None
        self.discharge_min_constraint = None
        self.energy_min_constraint = None
        self.qc = 0
示例#2
0
    def __init__(self, params):
        """ Generates the objective function, finds and creates constraints.

          Args:
            params (Dict): input parameters
        """

        # generate the generic service object
        ValueStream.__init__(self, 'Deferral', params)

        # add Deferral specific attributes
        self.max_import = params['planned_load_limit']  # positive
        self.max_export = params['reverse_power_flow_limit']  # negative
        self.last_year = params['last_year'].year
        self.year_failed = params['last_year'].year + 1
        self.min_years = params.get('min_year_objective', 0)
        self.load = params['load']  # deferral load
        self.growth = params['growth']  # Growth Rate of deferral load (%/yr)
        self.price = params['price']  # $/yr

        self.p_min = 0
        self.e_min = 0
        self.deferral_df = None
        self.e_walk = pd.Series()
        self.power_requirement = pd.Series()
示例#3
0
    def __init__(self, params):
        """ Generates the objective function, finds and creates constraints.

        Args:
            params (Dict): input parameters
        """
        ValueStream.__init__(self, 'DA', params)
        self.price = params['price']
        self.growth = params['growth']  # growth rate of energy prices (%/yr)
示例#4
0
    def __init__(self, params):
        """ Generates the objective function, finds and creates constraints.

          Args:
            params (Dict): input parameters
        """

        # generate the generic service object
        ValueStream.__init__(self, 'Backup', params)
        self.energy_req = params['daily_energy']
        self.monthly_energy = params[
            'monthly_energy']  # raw input form of energy requirement
        self.price = params['monthly_price']
示例#5
0
    def __init__(self, params):
        """ Generates the objective function, finds and creates constraints.

        Args:
            params (Dict): input parameters
        """
        ValueStream.__init__(self, 'retailETS', params)
        self.price = params['price']
        self.tariff = params['tariff']
        self.growth = params['growth'] / 100

        self.billing_period_bill = pd.DataFrame()
        self.monthly_bill = pd.DataFrame()
示例#6
0
    def __init__(self, params):
        """ Generates the objective function, finds and creates constraints.

          Args:
            params (Dict): input parameters
        """

        # generate the generic service object
        ValueStream.__init__(self, 'Volt Var', params)

        # add voltage support specific attributes
        self.vars_percent = params['percent'] / 100
        self.price = params['price']

        self.vars_reservation = 0
示例#7
0
    def proforma_report(self, opt_years, apply_inflation_rate_func,
                        fill_forward_func, results):
        """ Calculates the proforma that corresponds to participation in this value stream

        Args:
            opt_years (list): list of years the optimization problem ran for
            apply_inflation_rate_func:
            fill_forward_func:
            results (pd.DataFrame): DataFrame with all the optimization variable solutions

        Returns: A tuple of a DateFrame (of with each year in opt_year as the index and the corresponding
        value this stream provided)

        """
        proforma = ValueStream.proforma_report(self, opt_years,
                                               apply_inflation_rate_func,
                                               fill_forward_func, results)
        proforma[self.name + 'Capacity Payment'] = 0

        for year in opt_years:
            proforma.loc[pd.Period(
                year=year, freq='y')] = self.qc * np.sum(self.capacity_rate)
        # apply inflation rates
        proforma = apply_inflation_rate_func(proforma, None, min(opt_years))

        return proforma
示例#8
0
    def __init__(self, name, full_name, params):
        """ Generates the objective function, finds and creates constraints.

        Args:
            name (str): abbreviated name
            full_name (str): the expanded name of the service
            params (Dict): input parameters
        """
        ValueStream.__init__(self, name, params)
        self.price = params['price']
        self.growth = params[
            'growth']  # growth rate of spinning reserve price (%/yr)
        self.duration = params['duration']
        self.full_name = full_name
        self.variable_names = {'ch_less', 'dis_more'}
        self.variables_df = pd.DataFrame(columns=self.variable_names)
示例#9
0
    def __init__(self, params):
        """ Generates the objective function, finds and creates constraints.

          Args:
            params (Dict): input parameters

        """

        # generate the generic service object
        ValueStream.__init__(self, 'Demand Response', params)

        # add dr specific attributes to object
        self.days = params['days']
        self.length = params.get('length')  # length of an event
        self.weekend = params['weekend']
        self.start_hour = params['program_start_hour']
        self.end_hour = params.get(
            'program_end_hour')  # last hour of the program
        self.day_ahead = params[
            'day_ahead']  # indicates whether event is scheduled in real-time or day ahead

        # handle length and end_hour attributes here
        self.fill_dr_event_details()

        # timeseries data
        self.system_load = params['system_load']
        self.months = params['dr_months'] == 1
        self.cap_commitment = params[
            'dr_cap']  # this is the max capacity a user is willing to provide

        # monthly data
        self.cap_monthly = params['cap_monthly']
        self.cap_price = params['cap_price']
        self.ene_price = params['ene_price']

        # the following attributes will be used to save values during analysis
        self.qc = None
        self.qe = None
        self.charge_max_constraint = pd.Series()
        self.discharge_min_constraint = pd.Series()
        self.energy_min_constraint = pd.Series()
        self.possible_event_times = None
示例#10
0
    def __init__(self, params):
        """ Generates the objective function, finds and creates constraints.

        Acceptable constraint names are: 'Power Max (kW)', 'Power Min (kW)', 'Energy Max (kWh)', 'Energy Min (kWh)'

          Args:
            params (Dict): input parameters
        """
        # generate the generic service object
        ValueStream.__init__(self, 'User Constraints', params)

        self.user_power = params['power']
        self.user_energy = params['energy']
        self.price = params['price']  # $/yr
        self.charge_min_constraint = None
        self.charge_max_constraint = None
        self.discharge_min_constraint = None
        self.discharge_max_constraint = None
        self.soe_min_constraint = None
        self.soe_max_constraint = None
示例#11
0
    def __init__(self, name, full_name, params):
        """ Generates the objective function, finds and creates constraints.

        Args:
            name (str): abbreviated name
            full_name (str): the expanded name of the service
            params (Dict): input parameters
        """
        ValueStream.__init__(self, name, params)
        self.full_name = full_name
        self.combined_market = params['CombinedMarket']
        self.duration = params['duration']
        self.energy_growth = params['energyprice_growth'] / 100
        self.eod_avg = params['eod']
        self.eou_avg = params['eou']
        self.growth = params['growth'] / 100
        self.price_down = params['regd_price']
        self.price_up = params['regu_price']
        self.price_energy = params['energy_price']
        self.variable_names = {'up_ch', 'up_dis', 'down_ch', 'down_dis'}
        self.variables_df = pd.DataFrame(columns=self.variable_names)
示例#12
0
    def proforma_report(self, opt_years, apply_inflation_rate_func,
                        fill_forward_func, results):
        """ Calculates the proforma that corresponds to participation in this value stream

        Args:
            opt_years (list): list of years the optimization problem ran for
            apply_inflation_rate_func:
            fill_forward_func:
            results (pd.DataFrame): DataFrame with all the optimization variable solutions

        Returns: A tuple of a DateFrame (of with each year in opt_year as the index and the corresponding
        value this stream provided)

        """
        proforma = ValueStream.proforma_report(self, opt_years,
                                               apply_inflation_rate_func,
                                               fill_forward_func, results)
        proforma[self.name + ' Capacity Payment'] = 0
        proforma[self.name + ' Energy Payment'] = 0

        energy_displaced = results.loc[self.possible_event_times,
                                       'Total Storage Power (kW)']
        energy_displaced += results.loc[self.possible_event_times,
                                        'Total Generation (kW)']

        for year in opt_years:
            year_cap_price = self.cap_price.loc[self.cap_price.index.year ==
                                                year]
            year_monthly_cap = self.cap_monthly.loc[self.cap_monthly.index.year
                                                    == year]
            proforma.loc[pd.Period(year=year, freq='y'), self.name + ' Capacity Payment'] = \
                np.sum(np.multiply(year_monthly_cap, year_cap_price))

            if self.day_ahead:
                # in our "day of" event notification: the battery does not actually dispatch to
                # meet a DR event, so no $ is awarded
                year_subset = energy_displaced[energy_displaced.index.year ==
                                               year]
                year_ene_price = self.ene_price.loc[self.ene_price.index.year
                                                    == year]
                energy_payment = 0
                for month in range(1, 13):
                    energy_payment = \
                        np.sum(year_subset.loc[month == year_subset.index.month]) * year_ene_price.loc[year_ene_price.index.month == month].values
                proforma.loc[pd.Period(year=year, freq='y'), self.name + ' Energy Payment'] = \
                    energy_payment * self.dt
        # apply inflation rates
        proforma = apply_inflation_rate_func(proforma, None, min(opt_years))

        return proforma