コード例 #1
0
 def test_calculate_installed_costs_per_mw(self):
     """
     Test if calculate_installed_costs returns the correct value for cost/mw model
     """
     cost_calculator = create_cost_calculator(
         100,
         'CostPerMW',
         'greenfield',
         wind_installed_cost_mw=1454000,
         solar_installed_cost_mw=960000,
         storage_installed_cost_mw=1455000,
         storage_installed_cost_mwh=0,
         wind_bos_cost_mw=0,
         solar_bos_cost_mw=0,
         storage_bos_cost_mw=0,
         storage_bos_cost_mwh=0,
         modify_costs=False)
     assert cost_calculator.calculate_installed_costs(
         1, 1, 1, 2) == (1454000, 960000, 1455000, 3869000)
     assert cost_calculator.model.calculate_bos_costs(
         wind_mw=1,
         solar_mw=1,
         storage_mw=1,
         storage_mwh=1,
         wind_bos_cost_mw=550000,
         solar_bos_cost_mw=550000,
         storage_bos_cost_mw=200000,
         storage_bos_cost_mwh=300000,
         interconnection_mw=100,
         scenario_info='greenfield') == (550000, 550000, 500000, 1600000, 0)
コード例 #2
0
 def test_calculate_installed_costs_per_mw_atb(self):
     """
     Test if calculate_installed_costs and calculate_bos_costs returns the correct value for cost/mw model with ATB
     """
     cost_calculator = create_cost_calculator(
         100,
         'CostPerMW',
         'greenfield',
         atb_costs=True,
         atb_year=2020,
         atb_scenario='Moderate',
         wind_installed_cost_mw=1454000,
         solar_installed_cost_mw=960000,
         storage_installed_cost_mw=1455000,
         storage_installed_cost_mwh=0,
         wind_bos_cost_mw=0,
         solar_bos_cost_mw=0,
         storage_bos_cost_mw=0,
         storage_bos_cost_mwh=0,
         modify_costs=False)
     assert cost_calculator.calculate_installed_costs(
         1, 1, 1, 2) == (1678595.2959999999, 1353542.8569999998,
                         857314.6919, 3889452.8449)
     assert cost_calculator.model.calculate_bos_costs(
         wind_mw=1,
         solar_mw=1,
         storage_mw=1,
         storage_mwh=1,
         wind_bos_cost_mw=550000,
         solar_bos_cost_mw=550000,
         storage_bos_cost_mw=200000,
         storage_bos_cost_mwh=300000,
         interconnection_mw=100,
         scenario_info='greenfield') == (550000, 550000, 500000, 1600000, 0)
コード例 #3
0
 def test_calculate_installed_costs(self):
     """
     Test if calculate_installed_costs runs
     """
     cost_calculator = create_cost_calculator(
         100,
         'BOSLookup',
         'greenfield',
         wind_installed_cost_mw=1454000,
         solar_installed_cost_mw=960000,
         storage_installed_cost_mw=1455000)
     assert cost_calculator.calculate_installed_costs(
         1, 1, 1, 1) == (1454000, 960000, 1790000, 4204000)
コード例 #4
0
ファイル: single_location.py プロジェクト: barker59/HOPP
def run_hopp_calc(Site, scenario_description, bos_details,
                  total_hybrid_plant_capacity_mw, solar_size_mw, wind_size_mw,
                  nameplate_mw, interconnection_size_mw,
                  load_resource_from_file, ppa_price, results_dir):
    """ run_hopp_calc Establishes sizing models, creates a wind or solar farm based on the desired sizes,
     and runs SAM model calculations for the specified inputs.
     save_outputs contains a dictionary of all results for the hopp calculation.

    :param scenario_description: Project scenario - 'greenfield' or 'solar addition'.
    :param bos_details: contains bos details including type of analysis to conduct (cost/mw, json lookup, HybridBOSSE).
    :param total_hybrid_plant_capacity_mw: capacity in MW of hybrid plant.
    :param solar_size_mw: capacity in MW of solar component of plant.
    :param wind_size_mw: capacity in MW of wind component of plant.
    :param nameplate_mw: nameplate capacity of total plant.
    :param interconnection_size_mw: interconnection size in MW.
    :param load_resource_from_file: flag determining whether resource is loaded directly from file or through
     interpolation routine.
    :param ppa_price: PPA price in USD($)
    :return: collection of outputs from SAM and hybrid-specific calculations (includes e.g. AEP, IRR, LCOE),
     plus wind and solar filenames used
    (save_outputs)
    """
    # Get resource data
    if load_resource_from_file:
        pass
    else:
        Site[
            'resource_filename_solar'] = ""  # Unsetting resource filename to force API download of wind resource
        Site[
            'resource_filename_wind'] = ""  # Unsetting resource filename to force API download of solar resource

    site = SiteInfo(Site,
                    solar_resource_file=sample_site['resource_filename_solar'],
                    wind_resource_file=sample_site['resource_filename_wind'])

    #TODO: Incorporate this in SiteInfo
    # if 'roll_tz' in Site.keys():
    #     site.solar_resource.roll_timezone(Site['roll_tz'], Site['roll_tz'])

    # Set up technology and cost model info
    technologies = {
        'solar': solar_size_mw,  # mw system capacity
        'wind': wind_size_mw,  # mw system capacity
        'grid': interconnection_size_mw
    }  # mw interconnect

    # Create model
    hybrid_plant = HybridSimulation(technologies,
                                    site,
                                    interconnect_kw=interconnection_size_mw *
                                    1000)

    hybrid_plant.setup_cost_calculator(
        create_cost_calculator(interconnection_size_mw,
                               bos_details['BOSSource'], scenario_description))

    hybrid_plant.ppa_price = ppa_price
    hybrid_plant.discount_rate = 6.4
    hybrid_plant.solar.system_capacity_kw = solar_size_mw * 1000
    hybrid_plant.wind.system_capacity_by_num_turbines(wind_size_mw * 1000)
    actual_solar_pct = hybrid_plant.solar.system_capacity_kw / \
                       (hybrid_plant.solar.system_capacity_kw + hybrid_plant.wind.system_capacity_kw)

    logger.info("Run with solar percent {}".format(actual_solar_pct))
    hybrid_plant.simulate()
    outputs = hybrid_plant.hybrid_outputs()
    for k, v in outputs.items():
        outputs[k] = [v]

    return outputs, site.wind_resource.filename, site.solar_resource.filename
コード例 #5
0
ファイル: h2_setup_optimize.py プロジェクト: NREL/HOPP
def setup_cost_calcs(scenario,
                     hybrid_plant,
                     electrolyzer_size_mw,
                     wind_size_mw,
                     solar_size_mw,
                     solar_cost_multiplier=1.0):
    """
    A function to facilitate plant setup for COST calculations. 
    
    INPUT VARIABLES
    scenario: dict, the H2 scenario of interest
    hybrid_plant: the hybrid plant object from setup_power_calcs, so we don't need to reinput everything
    electrolyzer_size_mw: float, the exlectrolyzer capacity in MW
    wind_size_mw: float, the amount of wind capacity in MW
    solar_size_mw: float, the amount of solar capacity in MW
    solar_cost_multiplier: float, if you want to test design sensitivities to solar costs. Multiplies the solar costs

    OUTPUTS
    hybrid_plant: the hybrid plant object from HOPP for cost calculations
    """

    # Step 1: Establish output structure and special inputs
    year = 2013
    sample_site['year'] = year
    useful_life = 30

    sample_site['lat'] = scenario['Lat']
    sample_site['lon'] = scenario['Long']
    wind_cost_kw = scenario['Wind Cost KW']
    solar_cost_kw = scenario['Solar Cost KW'] * solar_cost_multiplier
    storage_cost_kw = scenario['Storage Cost KW']
    storage_cost_kwh = scenario['Storage Cost KWh']

    #Todo: Add useful life to .csv scenario input instead
    scenario['Useful Life'] = useful_life

    interconnection_size_mw = electrolyzer_size_mw

    hybrid_plant.setup_cost_calculator(
        create_cost_calculator(
            interconnection_size_mw,
            bos_cost_source='CostPerMW',
            wind_installed_cost_mw=wind_cost_kw * 1000,
            solar_installed_cost_mw=solar_cost_kw * 1000,
            storage_installed_cost_mw=storage_cost_kw * 1000,
            storage_installed_cost_mwh=storage_cost_kwh * 1000))
    hybrid_plant.wind._system_model.Turbine.wind_resource_shear = 0.33
    if solar_size_mw > 0:
        hybrid_plant.pv._financial_model.FinancialParameters.analysis_period = scenario[
            'Useful Life']
        hybrid_plant.pv._financial_model.FinancialParameters.debt_percent = scenario[
            'Debt Equity']
        if scenario['ITC Available']:
            hybrid_plant.pv._financial_model.TaxCreditIncentives.itc_fed_percent = 26
        else:
            hybrid_plant.pv._financial_model.TaxCreditIncentives.itc_fed_percent = 0

    if wind_size_mw > 0:
        hybrid_plant.wind._financial_model.FinancialParameters.analysis_period = scenario[
            'Useful Life']
        hybrid_plant.wind._financial_model.FinancialParameters.debt_percent = scenario[
            'Debt Equity']
        if scenario['PTC Available']:
            ptc_val = 0.022
        else:
            ptc_val = 0.0

        interim_list = list(hybrid_plant.wind._financial_model.
                            TaxCreditIncentives.ptc_fed_amount)
        interim_list[0] = ptc_val
        hybrid_plant.wind._financial_model.TaxCreditIncentives.ptc_fed_amount = tuple(
            interim_list)
        hybrid_plant.wind._system_model.Turbine.wind_turbine_hub_ht = scenario[
            'Tower Height']

    hybrid_plant.ppa_price = 0.05
    hybrid_plant.wind.system_capacity_kw = wind_size_mw * 1000
    return hybrid_plant
コード例 #6
0
ファイル: multi_location.py プロジェクト: NREL/HOPP
def run_hopp_calc(Site, scenario_description, bos_details, total_hybrid_plant_capacity_mw, solar_size_mw, wind_size_mw,
                    nameplate_mw, interconnection_size_mw, load_resource_from_file,
                    ppa_price, results_dir):
    """ run_hopp_calc Establishes sizing models, creates a wind or solar farm based on the desired sizes,
     and runs SAM model calculations for the specified inputs.
     save_outputs contains a dictionary of all results for the hopp calculation.

    :param scenario_description: Project scenario - 'greenfield' or 'solar addition'.
    :param bos_details: contains bos details including type of analysis to conduct (cost/mw, json lookup, HybridBOSSE).
    :param total_hybrid_plant_capacity_mw: capacity in MW of hybrid plant.
    :param solar_size_mw: capacity in MW of solar component of plant.
    :param wind_size_mw: capacity in MW of wind component of plant.
    :param nameplate_mw: nameplate capacity of total plant.
    :param interconnection_size_mw: interconnection size in MW.
    :param load_resource_from_file: flag determining whether resource is loaded directly from file or through
     interpolation routine.
    :param ppa_price: PPA price in USD($)
    :return: collection of outputs from SAM and hybrid-specific calculations (includes e.g. AEP, IRR, LCOE),
     plus wind and solar filenames used
    (save_outputs)
    """
    # Get resource data
    # sample_site['lat'] = Site['Lat']
    # sample_site['lon'] = Site['Lon']
    # # site = SiteInfo(sample_site, solar_resource_file=Site['resource_filename_solar'],
    # #                 wind_resource_file=Site['resource_filename_wind'])
    if load_resource_from_file:
        pass
    else:
        Site['resource_filename_solar'] = ""  # Unsetting resource filename to force API download of wind resource
        Site['resource_filename_wind'] = ""  # Unsetting resource filename to force API download of solar resource

    site = SiteInfo(Site)

    if 'roll_tz' in Site.keys():
        site.solar_resource.roll_timezone(Site['roll_tz'], Site['roll_tz'])

    # Set up technology and cost model info
    technologies = {'solar': solar_size_mw,          # mw system capacity
                    'wind': wind_size_mw            # mw system capacity
                    }

    # Create model
    hybrid_plant = HybridSimulation(technologies, site, interconnect_kw=interconnection_size_mw * 1000)

    # hybrid_plant.setup_cost_calculator(create_cost_calculator(bos_cost_source='boslookup', interconnection_mw=interconnection_size_mw))
    hybrid_plant.setup_cost_calculator(create_cost_calculator(bos_cost_source=bos_details['BOSSource'],
                                                                    interconnection_mw=interconnection_size_mw,
                                                              modify_costs=bos_details['Modify Costs'],
                                                              cost_reductions=bos_details,
                                                              wind_installed_cost_mw=1696000,
                                                              solar_installed_cost_mw=1088600,
                                                              storage_installed_cost_mw=0,
                                                              storage_installed_cost_mwh=0,
                                                              ))

    hybrid_plant.ppa_price = ppa_price
    hybrid_plant.discount_rate = 6.4
    hybrid_plant.solar.system_capacity_kw = solar_size_mw * 1000
    hybrid_plant.wind.rotor_diameter = 100
    # Modify Wind Turbine Coordinates
    Nx = 8
    Ny = 5
    spacing = hybrid_plant.wind.row_spacing
    turbine_x = np.linspace(0, (Nx * spacing) - spacing, Nx)
    turbine_y = np.linspace(0, (Ny * spacing) - spacing, Ny)
    turbX = np.zeros(Nx * Ny)
    turbY = np.zeros(Nx * Ny)
    count = 0
    for i in range(Nx):
        for j in range(Ny):
            turbX[count] = turbine_x[i]
            turbY[count] = turbine_y[j]
            count = count + 1
    hybrid_plant.wind.modify_coordinates(list(turbX), list(turbY))
    hybrid_plant.wind.system_capacity_by_num_turbines(wind_size_mw * 1000)
    actual_solar_pct = hybrid_plant.solar.system_capacity_kw / \
                       (hybrid_plant.solar.system_capacity_kw + hybrid_plant.wind.system_capacity_kw)

    logger.info("Run with solar percent {}".format(actual_solar_pct))
    hybrid_plant.simulate()
    outputs = hybrid_plant.hybrid_outputs()
    for k, v in outputs.items():
        outputs[k] = [v]

    return outputs, site.wind_resource.filename, site.solar_resource.filename
コード例 #7
0
ファイル: test_cost_calculator.py プロジェクト: jlcox119/HOPP
 def test_run_hybridbosse(self):
     try:
         cost_calculator = create_cost_calculator(100, 'hybridbosse', 'hybrid', 1454000, 960000, False)
         answer = cost_calculator.calculate_bos_costs(10, 10)
     except ValueError:
         assert True
コード例 #8
0
ファイル: test_cost_calculator.py プロジェクト: jlcox119/HOPP
 def test_calculate_installed_costs(self):
     """
     Test if calculate_installed_costs runs
     """
     cost_calculator = create_cost_calculator(100, 'BOSLookup', 'greenfield', 1454000, 960000, False)
     assert cost_calculator.calculate_installed_costs(1, 1) == (1454000, 960000, 2414000)
コード例 #9
0
interconnection_size_mw = 20

technologies = {'solar': solar_size_mw,  # mw system capacity
                'wind': wind_size_mw,  # mw system capacity
                'grid': interconnection_size_mw}

# Get resource
lat = flatirons_site['lat']
lon = flatirons_site['lon']
site = SiteInfo(flatirons_site)

# Create model
hybrid_plant = HybridSimulation(technologies, site, interconnect_kw=interconnection_size_mw * 1000)

# Setup cost model
hybrid_plant.setup_cost_calculator(create_cost_calculator(interconnection_size_mw))
hybrid_plant.solar.system_capacity_kw = solar_size_mw * 1000
hybrid_plant.wind.system_capacity_by_num_turbines(wind_size_mw * 1000)
hybrid_plant.ppa_price = 0.1
hybrid_plant.simulate(25)

# Save the outputs
annual_energies = hybrid_plant.annual_energies
wind_plus_solar_npv = hybrid_plant.net_present_values.wind + hybrid_plant.net_present_values.solar
npvs = hybrid_plant.net_present_values

wind_installed_cost = hybrid_plant.wind.financial_model.SystemCosts.total_installed_cost
solar_installed_cost = hybrid_plant.solar.financial_model.SystemCosts.total_installed_cost
hybrid_installed_cost = hybrid_plant.grid.financial_model.SystemCosts.total_installed_cost

print("Wind Installed Cost: {}".format(wind_installed_cost))