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

Duplicate json keys are allowed in ECMs #210

Closed briangerke closed 1 month ago

briangerke commented 5 years ago

Currently if an ECM contains duplicate JSON keys, Scout will happily accept this as valid data and will silently ignore all but the last key from the list of duplicates.

This is the expected behavior of the python json module, but it seems like it would be worth at least checking for this and throwing up an error message during the ecm_prep script.

For reference, I'm attaching an ECM I created that contains duplicate keys and caused me a great deal of confusion until I realized. This is an attempt to create a California-specific Title 24 ECM for windows, with scaling fractions assigned by climate zone to reflect the California population. However, down near the bottom, there's another market_scaling_fractions key, set to null, which effectively overwrites my desired scaling.

briangerke commented 5 years ago

Apparently I can't attach a JSON file, so here is the example ECM mentioned above.

{
  "name": "CA Title 24 Residential Windows, 2016",
  "climate_zone": "all", 
  "bldg_type": "all residential",
  "structure_type": "all",
  "end_use": [
      "heating",
      "secondary heating",
      "cooling"
    ],
  "fuel_type": "all",
  "technology": [
      "windows conduction",
      "windows solar"
    ],
  "market_entry_year": 2016,
  "market_entry_year_source": {
    "notes": "Year in which current T24 standard went into effect",
    "source_data": {
      "title": "2016 Building Energy Efficiency Standards for Residential and Nonresidential Buildings",
      "author": null,
      "organization": "California Energy Commission",
      "year": 2016,
      "pages": "174-184",
      "URL": "https://www.energy.ca.gov/2015publications/CEC-400-2015-037/CEC-400-2015-037-CMF.pdf"
    }
  },
  "market_exit_year": null,
  "market_exit_year_source": null,
  "energy_efficiency": {
    "windows conduction": 3.125,
    "windows solar": 0.25
    },
  "energy_efficiency_units": {
      "windows conduction": "R value",
      "windows solar": "SHGC"
    },
  "energy_efficiency_source": {
    "notes": "Ignored the lack of solar standard in CA climate zones 1-3, since these don't map neatly onto the AIA zones.",
    "source_data": {
        "title": "2016 Building Energy Efficiency Standards for Residential and Nonresidential Buildings",
        "author": null,
        "organization": "California Energy Commission",
        "year": 2016,
        "pages": "174-184",
        "URL": "https://www.energy.ca.gov/2015publications/CEC-400-2015-037/CEC-400-2015-037-CMF.pdf",
        "notes": "See here for simpler table summary: https://energycodeace.com/download/15282/file_path/fieldList/FactSheet.Res-Fenestration.2016"
    }
  },
  "market_scaling_fractions":{
      "AIA_CZ1": 0.0005,
      "AIA_CZ2": 0.0006,
      "AIA_CZ3": 0.0033, 
      "AIA_CZ4": 0.4690, 
      "AIA_CZ5": 0.0151
  },
  "market_scaling_fractions_source": {
    "fraction_derivation": "From 'Scout Geography Mapping spreadsheed provided by Jared Langevin.",
    "title": "Scout Geography Mapping",
    "author": "Jared Langevin",
    "organization": "LBNL",
    "year": "2018",
    "URL": null
  },
  "installed_cost": 48.4,
  "cost_units": "2016$/ft^2 glazing",
  "installed_cost_source": {
    "notes": "Assume baseline window cost from Scout data",
    "source_data": {
      "title": "Scout - Baseline Envelope and MELs Cost, Performance, and Lifetime Data ('cpl_envelope_mels.json')",
      "author": null,
      "organization": "U.S. Department of Energy",
      "year": 2018,
      "pages": null,
      "URL": "https://github.com/trynthink/scout/blob/master/cpl_envelope_mels.json"
    }
  },
  "product_lifetime": 30,
  "product_lifetime_units": "years",
  "product_lifetime_source": {
    "notes": "Average lifetime for Low-E, Triple, Non-metal, Arg, L-Gain",
    "source_data": {
      "title": "NREL National Residential Efficiency Measures Database",
      "author": null,
      "organization": "National Renewable Energy Laboratory",
      "year": 2018,
      "pages": null,
      "URL": "https://remdb.nrel.gov/measures.php?gId=16&ctId=190"
    }
  },
  "measure_type": "full service",
  "fuel_switch_to": null,
  "market_scaling_fractions": null,
  "market_scaling_fractions_source": "NA",
  "_description": "Typical size residential double pane window that meets the T24 performance standard in 2016",
  "_notes": null,
  "_added_by": {
    "name": "Brian Gerke",
    "organization": "Lawrence Berkeley National Lab",
    "email": "bfgerke@lbl.gov@lbl.gov",
    "timestamp": "2018-12-14  13:19:00 PST"
  },
  "_updated_by": {
    "name": "Brian Gerke",
    "organization": "Lawrence Berkeley National Lab",
    "email": "bfgerke@lbl.gov@lbl.gov",
    "timestamp": "2018-12-14  13:19:00 PST"
  }
}