示例#1
0
def parameterSweep(dataFile, inputs, inputs2, index):
    # Record time to solve
    t0 = time.time()

    # Load_Data - Expected Columns (units): DatetimeUTC (UTC format), t (min), dt (min), demand (MW), solar (MW)
    data = pd.read_csv(dataFile)
    data.loc[:, 'solar'] = data.loc[:, 'solar'] * inputs2.solarCapacity / 32.3

    # Solar Plant - All inputs are optional (default values shown below)
    solar = Solar(plantType='PV',
                  capacity=inputs2.solarCapacity,
                  cost_install=2004.,
                  cost_OM_fix=22.02)

    # Battery Storage - All inputs are optional (default values shown below)
    batt = Battery(capacity=inputs2.battSize,
                   rateMax=inputs2.battSize,
                   roundTripEff=90.0,
                   cost_install=2067.,
                   cost_OM_fix=35.6,
                   initCharge=100.0)

    # Fuel - All inputs are optional (default values shown below)
    fuel = Fuel(fuelType='NATGAS', cost=23.27, emissions=0.18)

    # Create power plant
    # 1 - create pandas series of power plant characteristics
    plant_inputs = defaultInputs(
        plantType='CCGT'
    )  # Start with CCGT default inputs and then adjust to specific case
    plant_inputs.plantType = inputs.sheetname
    plant_inputs.Eff_A = inputs.Eff_A
    plant_inputs.Eff_B = inputs.Eff_B
    plant_inputs.Eff_C = inputs.Eff_C
    plant_inputs.maxEfficiency = inputs.maxEfficiency
    plant_inputs.rampRate = inputs.rampRate
    plant_inputs.minRange = inputs.minRange
    plant_inputs.cost_install = inputs.cost_install
    plant_inputs.cost_OM_fix = inputs.cost_OM_fix
    plant_inputs.cost_OM_var = inputs.cost_OM_var
    plant_inputs.co2CaptureEff = inputs.co2CaptureEff
    plant_inputs.capacity = inputs2.plantSize  # MW

    # 2 - create power plant
    plant = PowerPlant(plant_inputs)

    # Create HRES (controller is built-in), data and plant are only required inputs
    # all other components will revert to default if not specified
    hres = HRES(data, plant, solar=solar, batt=batt, fuel=fuel, i=0.02, n=20)

    # Run Simulation
    results = hres.run()

    # Display Elapsed Time
    t1 = time.time()
    print("Time Elapsed: " + str(round(t1 - t0, 2)) + " s")

    # Save simulation results
    if index == 0:
        casename = inputs.sheetname + '_PV' + str(
            inputs2.solarCapacity) + '_Batt' + str(inputs2.battSize)
        hres.save(casename=casename)

    # Combine inputs and results into output and then return
    output = pd.concat([inputs, inputs2, results], axis=0)
    return output
示例#2
0
    )  # Start with CCGT default inputs and then adjust to specific case
    plant_inputs.plantType = "sCO2"
    plant_inputs.Eff_A = -5.60E-03
    plant_inputs.Eff_B = 1.05E+00
    plant_inputs.Eff_C = 5.00E+01
    plant_inputs.maxEfficiency = 53.1
    plant_inputs.rampRate = 50.0
    plant_inputs.minRange = minRange
    # 2 - create power plant
    plant = PowerPlant(plant_inputs)

    # Create HRES (controller is built-in), data and plant are only required inputs
    # all other components will revert to default if not specified
    hres = HRES(data, plant, solar=solar, batt=batt, fuel=fuel, i=0.02, n=20)

    # Run Simulation
    results = hres.run()

    # Create Plots and save time series data
    saveName = 'Results_SampleDay_Oct30th_sCO2_' + str(minRange)
    # hres.plot_battStatus(caseName = saveName)
    # hres.plot_EBalance(caseName = saveName)
    # hres.plot_efficiency(caseName = saveName)
    # hres.plot_pwrRamps(caseName = saveName)
    hres.save(saveName)
    # results.to_csv(saveName+'_Analysis.csv')

    # Display Elapsed Time
    t1 = time.time()
    print("Time Elapsed: " + str(round(t1 - t0, 2)) + " s")