def test_standalone_json(): """Test baseline windbos calc with standalone json file""" fpath = TESTDATADIR + '/SAM/i_singleowner_windbos.json' with open(fpath, 'r') as f: inputs = json.load(f) wb1 = WindBos(inputs) fpath = TESTDATADIR + '/SAM/i_windbos.json' with open(fpath, 'r') as f: inputs = json.load(f) wb2 = WindBos(inputs) for k, v in wb1.output.items(): assert v == wb2.output[k]
def _windbos(inputs): """Run SAM Wind Balance of System cost model if requested. Parameters ---------- inputs : dict Dictionary of SAM key-value pair inputs. "total_installed_cost": "windbos" will trigger the windbos method. Returns ------- inputs : dict Dictionary of SAM key-value pair inputs with the total installed cost replaced with WindBOS values if requested. output : dict Dictionary of windbos cost breakdowns. """ outputs = {} if inputs is not None: if 'total_installed_cost' in inputs: if isinstance(inputs['total_installed_cost'], str): if inputs['total_installed_cost'].lower() == 'windbos': wb = WindBos(inputs) inputs['total_installed_cost'] = \ wb.total_installed_cost outputs = wb.output return inputs, outputs
def test_rev_windbos(): """Test baseline windbos calc with single owner defaults""" fpath = TESTDATADIR + '/SAM/i_singleowner_windbos.json' with open(fpath, 'r') as f: inputs = json.load(f) wb = WindBos(inputs) assert np.allclose(wb.turbine_cost, 52512000.00, atol=ATOL, rtol=RTOL) assert np.allclose(wb.bos_cost, 36380236.00, atol=ATOL, rtol=RTOL) assert np.allclose(wb.total_installed_cost, 88892240.00, atol=ATOL, rtol=RTOL)
def test_rev_windbos_sales(): """Test windbos calc with turbine transport costs""" fpath = TESTDATADIR + '/SAM/i_singleowner_windbos.json' with open(fpath, 'r') as f: inputs = json.load(f) inputs['sales_tax_basis'] = 5.0 wb = WindBos(inputs) assert np.allclose(wb.turbine_cost, 52512000.00, atol=ATOL, rtol=RTOL) assert np.allclose(wb.bos_cost, 36380236.00, atol=ATOL, rtol=RTOL) assert np.allclose(wb.total_installed_cost, 89114464.00, atol=ATOL, rtol=RTOL)
def test_rev_windbos_transport(): """Test windbos calc with turbine transport costs""" fpath = TESTDATADIR + '/SAM/i_singleowner_windbos.json' with open(fpath, 'r') as f: inputs = json.load(f) inputs['turbine_transportation'] = 100.0 wb = WindBos(inputs) assert np.allclose(wb.turbine_cost, 52512000.00, atol=ATOL, rtol=RTOL) assert np.allclose(wb.bos_cost, 37720412.00, atol=ATOL, rtol=RTOL) assert np.allclose(wb.total_installed_cost, 90232416.00, atol=ATOL, rtol=RTOL)
def test_rev_windbos_perf_bond(): """Test windbos calc with performance bonds""" fpath = TESTDATADIR + '/SAM/i_singleowner_windbos.json' with open(fpath, 'r') as f: inputs = json.load(f) inputs['performance_bond'] = 10.0 wb = WindBos(inputs) assert np.allclose(wb.turbine_cost, 52512000.00, atol=ATOL, rtol=RTOL) assert np.allclose(wb.bos_cost, 36686280.00, atol=ATOL, rtol=RTOL) assert np.allclose(wb.total_installed_cost, 89198280.00, atol=ATOL, rtol=RTOL)