Skip to content

SAM Cash Flow GUI for HOPP Financials

Darice L Guittet edited this page Apr 11, 2022 · 4 revisions

Viewing the Cash Flow

There are many financial outputs in the HybridSimulation's Singleowner model. This model is based on SAM's Singleowner.

In the SAM GUI, there is a Cash Flow Viewer that facilitates understanding the financial outputs, as shown below. This Wiki shows how to set up a HOPP simulation to export its financial data to this viewer. This has not been rigorously tested for complex financial cases, so if you notice a difference in the finances, please report an issue.

image

1. Exporting the Financial Model from HOPP

Paste the following code in the script that calls the HybridSimulation class after simulate has been called:

with open(examples_dir / "singleowner.json", 'w') as f:
    dat = hybrid_plant.grid._financial_model.export()
    d = dict()
    for k, v in dat.items():
        d.update(v)
    json.dump(d, f)

2. Set up SAM

Download SAM and Register. Then open SAM, select New Project and create a Generic System, Power Purchase Agreement -> Single owner case.

3. Use the LK Script

Create a new Script by selecting File -> New Script and copy in the following code. Set the file path to where the JSON file was exported in Step 1. Then click Run.

dat = json_file("/Users/dguittet/Projects/HybridSystems/HOPP/examples/singleowner.json");

n_years = dat.analysis_period;
gen_len = #dat.gen;
ts_per_year = gen_len / n_years;

single_year_gen = alloc(ts_per_year);

for (i=0; i < ts_per_year; i++)
	single_year_gen[i] = dat.gen[i];

keys = @dat;
for (i=0; i < #keys; i++){
	set(keys[i], dat{keys[i]});
}

set('degradation', [0]);
set("derate", 0);
set("grid_interconnection_limit_kwac", 1000*1e3);
set("spec_mode", 1);
set("energy_output_array", single_year_gen);
set("fixed_plant_input", dat.total_installed_cost);
set("genericsys.cost.per_watt", 0 );
set("genericsys.cost.contingency_percent", 0 );
set("genericsys.cost.sales_tax.percent", 0 );
set("heat_rate", 0);

// This assumes the other construction costs are 0
constr_percent = dat.construction_financing_cost / dat.total_installed_cost;
set("const_per_percent1", constr_percent * 100);
set("const_per_upfront_rate1", 100);
set("const_per_months1", 0);
set("const_per_interest_rate1", 0);
set("const_per_percent2", 0);
set("const_per_percent3", 0);
set("const_per_percent4", 0);
set("const_per_percent5", 0);

4. View the Cash Flow

Switch to the main SAM Window and click Simulate at the bottom left. Then go to the Cash Flow tab. From here you can also export the results to CSV.