Exemple #1
0
def test_dc():
    model = batt.default("GenericBatteryCommercial")
    model.BatteryCell.batt_chem = 1
    model.Inverter.inverter_model = 0
    model.Inverter.inv_snl_eff_cec = 50
    model.BatterySystem.batt_ac_or_dc = 0
    PySAM.BatteryTools.battery_model_sizing(model, 100, 400, 500)
    assert (model.BatterySystem.batt_computed_bank_capacity == pytest.approx(
        400, 5))
    assert (model.BatterySystem.batt_power_charge_max_kwdc == pytest.approx(
        100, 20))
    assert (model.BatterySystem.batt_power_charge_max_kwac == pytest.approx(
        200, 5))
    assert (model.BatterySystem.batt_power_charge_max_kwdc == pytest.approx(
        100, 2))

    model.Inverter.inv_snl_eff_cec = 100
    model.BatterySystem.batt_ac_or_dc = 0
    PySAM.BatteryTools.battery_model_sizing(model, 100, 400, 500)
    assert (model.BatterySystem.batt_computed_bank_capacity == pytest.approx(
        400, 1))
    assert (model.BatterySystem.batt_power_charge_max_kwdc == pytest.approx(
        100, 1))
    print(model.BatterySystem.batt_power_charge_max_kwac)
    print(model.BatterySystem.batt_power_charge_max_kwdc)
Exemple #2
0
def test_liion():
    model = batt.default("GenericBatteryCommercial")
    model.BatteryCell.batt_chem = 1
    PySAM.BatteryTools.battery_model_sizing(model, 100, 400, 500)
    assert (model.BatterySystem.batt_computed_bank_capacity == pytest.approx(
        400, 5))
    assert (model.BatterySystem.batt_power_charge_max_kwdc == pytest.approx(
        100, 20))
Exemple #3
0
def test_leadacid():
    model = batt.default("GenericBatteryCommercial")
    model.BatteryCell.batt_chem = 0
    assert(model.BatterySystem.batt_computed_bank_capacity != pytest.approx(100, .5))
    assert(model.BatterySystem.batt_power_charge_max_kwdc != pytest.approx(50, 0.5))

    PySAM.BatteryTools.battery_model_sizing(model, 100, 400, 500)
    assert(model.BatterySystem.batt_computed_strings == 370)
    assert(model.BatterySystem.batt_computed_series == 139)
    assert(model.BatterySystem.batt_computed_bank_capacity == pytest.approx(416, 1))
    assert(model.BatterySystem.batt_power_charge_max_kwdc == pytest.approx(104, 1))

    PySAM.BatteryTools.battery_model_sizing(model, 100, 400, 500, 50, 60, 30)
    assert(model.BatterySystem.batt_computed_bank_capacity == pytest.approx(416, 1))
    assert(model.BatterySystem.batt_power_charge_max_kwdc == pytest.approx(104, 1))
    assert(model.BatteryCell.LeadAcid_q10_computed == pytest.approx(50, 5))
    assert(model.BatteryCell.LeadAcid_q20_computed == pytest.approx(60, 5))
    assert(model.BatteryCell.LeadAcid_qn_computed == pytest.approx(30, 5))
Additional financial models, inputs, and outputs can be found at https://nrel-pysam.readthedocs.io/en/2.0.2/modules/StandAloneBattery.html

Most recently tested against PySAM 2.1.4

@author: brtietz
"""

import PySAM.StandAloneBattery as battery_model
from PySAM.PySSC import *

analysis_period = 1  # years
steps_in_year = 8760  # currently hours in year, multiply this for subhourly tests (example * 12 for 5 minute tests)
days_in_year = 365

# Create the model using PySAM's defaults
battery = battery_model.default("GenericBatterySingleOwner")

# Set up inputs needed by the model.
battery.BatteryCell.batt_room_temperature_celsius = [20] * (
    steps_in_year * analysis_period
)  # degrees C, room temperature. Would normally come from weather file

# 24 hours of data to duplicate for the test. Would need to add data here for subhourly
lifetime_generation = []
lifetime_dispatch = []
daily_generation = [
    0, 0, 0, 0, 0, 0, 0, 200, 400, 600, 800, 1000, 1000, 1000, 1000, 800, 600,
    400, 200, 0, 0, 0, 0, 0
]  # kW
daily_dispatch = [
    0, 0, 0, 0, 0, 0, 0, -200, -400, -600, -800, -1000, -1000, 0, 0, 200, 400,
Exemple #5
0
Additional financial models, inputs, and outputs can be found at https://nrel-pysam.readthedocs.io/en/2.0.2/modules/StandAloneBattery.html

Most recently tested against PySAM 2.0.2

@author: brtietz
"""

import PySAM.StandAloneBattery as battery_model
from PySAM.PySSC import *

analysis_period = 1  # years
steps_in_year = 8760  # currently hours in year, multiply this for subhourly tests (example * 12 for 5 minute tests)
days_in_year = 365

# Create the model using PySAM's defaults
battery = battery_model.default("GenericSystemSingleOwner")

# Set up inputs needed by the model.
battery.BatteryCell.batt_room_temperature_celsius = [20] * (
    steps_in_year * analysis_period
)  # degrees C, room temperature. Would normally come from weather file

# 24 hours of data to duplicate for the test. Would need to add data here for subhourly
lifetime_generation = []
lifetime_dispatch = []
daily_generation = [
    0, 0, 0, 0, 0, 0, 0, 200, 400, 600, 800, 1000, 1000, 1000, 1000, 800, 600,
    400, 200, 0, 0, 0, 0, 0
]  # kW
daily_dispatch = [
    0, 0, 0, 0, 0, 0, 0, -200, -400, -600, -800, -1000, -1000, 0, 0, 200, 400,