trynthink / scout

A tool for estimating the future energy use, carbon emissions, and capital and operating cost impacts of energy efficiency and demand flexibility technologies in the U.S. residential and commercial building sectors.
https://scout.energy.gov
Other
61 stars 23 forks source link

"baseline" in ecm_prep_shapes.json changes when run with --tsv_metrics option #288

Closed gpavlak closed 1 year ago

gpavlak commented 1 year ago

1) Prepare an ECM that includes "tsv_features": { "shape": { "custom_annual_savings": "<savings_shape_filename>.csv" } with the --tsv_metrics option.

python3 ecm_prep.py --alt_regions --site_energy --detail_brkout --tsv_metrics --sect_shapes --verbose

"tsv_metrics": ["1","2","2","1","1","1"]

mv ./supporting_data/ecm_prep_shapes.json ./supporting_data/ecm_prep_shapes_tsv.json
mv ./supporting_data/ecm_prep.json ./supporting_data/ecm_prep_tsv.json

2) Prepare same ECM without the --tsv_metrics option.

python3 ecm_prep.py --alt_regions --site_energy --detail_brkout  --sect_shapes --verbose
mv ./supporting_data/ecm_prep_shapes.json ./supporting_data/ecm_prep_shapes_no_tsv.json
mv ./supporting_data/ecm_prep.json ./supporting_data/ecm_prep_no_tsv.json

3) Compare the "baseline" and "efficient" data stored in ecm_prep_shapes_tsv.json and ecm_prep_shapes_no_tsv.json

4) Observation: "efficient" shapes are the same, but "baseline" shapes are different.

This may be related to parts of partition_microsegment where the effects of tsv_energy_eff and tsv_energy_base are factored out for the "efficient" case, but not the "baseline" case?

(around line 8150)

energy_total[yr] = \
                energy_total_sbmkt[yr] * diffuse_frac * tsv_energy_base
... 

self.sector_shapes[adopt_scheme][mskeys[1]][yr]["baseline"] = [
                    self.sector_shapes[adopt_scheme][mskeys[1]][yr][
                        "baseline"][x] + tsv_shapes["baseline"][x] *
                    energy_total[yr] for x in range(8760)]

(around line 8529)

 self.sector_shapes[adopt_scheme][mskeys[1]][yr][
                        "efficient"] = [self.sector_shapes[adopt_scheme][
                            mskeys[1]][yr]["efficient"][x] + ((
                                energy_tot_comp_meas +
                                energy_tot_uncomp_meas) / tsv_energy_eff) *
                            tsv_shapes["efficient"][x] + ((
                                energy_tot_comp_base +
                                energy_tot_uncomp_base) / tsv_energy_base) *
                            tsv_shapes["baseline"][x]
                        for x in range(8760)]

(Note division by tsv_energy_base and tsv_energy_eff in later chunk for the "efficient" case.)

example_files.zip

jtlangevin commented 1 year ago

Thanks @gpavlak for not only pointing out the issue but correctly identifying the solution! Fix to be committed shortly.

gpavlak commented 1 year ago

Excellent, glad to hear. Happy to make a small contribution to this already great work!