| 149 | } |
| 150 | |
| 151 | double UtilityBill_Impl::consumptionUnitConversionFactor() const { |
| 152 | boost::optional<double> value = getDouble(OS_UtilityBillFields::ConsumptionUnitConversionFactor, true); |
| 153 | |
| 154 | // if value not set, use a smart default |
| 155 | if (!value) { |
| 156 | FuelType fuelType = this->fuelType(); |
| 157 | bool isEnergy = (fuelType != FuelType::Water); |
| 158 | |
| 159 | // DLM: Energy conversion factors come from https://www.energystar.gov/ia/business/tools_resources/target_finder/help/Energy_Units_Conversion_Table.htm |
| 160 | // Thermal Energy Conversions, Technical Reference, July 2013 |
| 161 | // Portfolio Manager uses these to convert to kBtu |
| 162 | // |
| 163 | // Original source: |
| 164 | // TABLE C-1 TO SUBPART C OF PART 98-DEFAULT CO2 EMISSION FACTORS AND HIGH HEAT VALUES FOR VARIOUS TYPES OF FUEL |
| 165 | boost::optional<double> unitToKBtu; |
| 166 | boost::optional<double> unitToM3; |
| 167 | |
| 168 | std::string consumptionUnit = this->consumptionUnit(); |
| 169 | |
| 170 | if (consumptionUnit == "kBtu") { |
| 171 | unitToKBtu = 1; |
| 172 | } else if (consumptionUnit == "MBtu") { |
| 173 | unitToKBtu = 1000; |
| 174 | } else if (consumptionUnit == "kWh") { |
| 175 | unitToKBtu = 3.4121416331; |
| 176 | } else if (consumptionUnit == "MWh") { |
| 177 | unitToKBtu = 3412.1416331; |
| 178 | } else if (consumptionUnit == "therms") { |
| 179 | unitToKBtu = 100; |
| 180 | } else if (consumptionUnit == "RTh") { |
| 181 | switch (fuelType.value()) { |
| 182 | case FuelType::DistrictCooling: |
| 183 | unitToKBtu = 12; |
| 184 | break; |
| 185 | default:; |
| 186 | } |
| 187 | } else if (consumptionUnit == "tons") { |
| 188 | //switch (fuelType.value()){ |
| 189 | //case FuelType::Coal: |
| 190 | // //unitToKBtu = 25090.0; // anthracite |
| 191 | // unitToKBtu = 24930.0; // bituminous |
| 192 | // break; |
| 193 | //default: |
| 194 | // ; |
| 195 | //} |
| 196 | } else if (consumptionUnit == "lbs") { |
| 197 | switch (fuelType.value()) { |
| 198 | //case FuelType::Coal: |
| 199 | // //unitToKBtu = 12.545; // anthracite |
| 200 | // unitToKBtu = 12.465; // bituminous |
| 201 | // break; |
| 202 | case FuelType::Steam: |
| 203 | unitToKBtu = 1.194; |
| 204 | break; |
| 205 | default:; |
| 206 | } |
| 207 | } else if (consumptionUnit == "kLbs") { |
| 208 | switch (fuelType.value()) { |