| 1025 | } |
| 1026 | |
| 1027 | OptionalDouble SqlFile_Impl::annualTotalCost(const FuelType& fuel) const { |
| 1028 | if (fuel == FuelType::Electricity) { |
| 1029 | return execAndReturnFirstDouble("SELECT Value from TabularDataWithStrings where (reportname = 'Economics Results Summary Report') and " |
| 1030 | "(ReportForString = 'Entire Facility') and (TableName = 'Annual Cost') and (ColumnName ='Electricity') and " |
| 1031 | "(((RowName = 'Cost') and (Units = '~~$~~')) or (RowName = 'Cost (~~$~~)'))"); |
| 1032 | } else if (fuel == FuelType::Gas) { |
| 1033 | return execAndReturnFirstDouble("SELECT Value from TabularDataWithStrings where (reportname = 'Economics Results Summary Report') and " |
| 1034 | "(ReportForString = 'Entire Facility') and (TableName = 'Annual Cost') and (ColumnName ='Natural Gas') and " |
| 1035 | "(((RowName = 'Cost') and (Units = '~~$~~')) or (RowName = 'Cost (~~$~~)'))"); |
| 1036 | } else { |
| 1037 | // E+ lumps all other fuel types under "Other," so we are forced to use the meters table instead. |
| 1038 | // This is fragile if there are custom submeters, but this is the only option |
| 1039 | std::string meterName = boost::to_upper_copy(fuel.valueDescription()) + ":FACILITY"; |
| 1040 | |
| 1041 | auto rowName = execAndReturnFirstString("SELECT RowName FROM TabularDataWithStrings WHERE ReportName='Economics Results Summary Report' AND " |
| 1042 | "ReportForString='Entire Facility' AND TableName='Tariff Summary' AND Value='" |
| 1043 | + meterName + "'"); |
| 1044 | if (rowName) { |
| 1045 | return execAndReturnFirstDouble("SELECT Value FROM TabularDataWithStrings WHERE ReportName='Economics Results Summary Report' AND " |
| 1046 | "ReportForString='Entire Facility' AND TableName='Tariff Summary' AND RowName='" |
| 1047 | + rowName.get() + "' AND ColumnName='Annual Cost (~~$~~)'"); |
| 1048 | } else { |
| 1049 | return boost::none; // Return an empty optional double, indicating that there is no annual cost for this energy type |
| 1050 | } |
| 1051 | } |
| 1052 | } |
| 1053 | |
| 1054 | OptionalDouble SqlFile_Impl::annualTotalCostPerBldgArea(const FuelType& fuel) const { |
| 1055 | // Get the total building area |
nothing calls this directly
no test coverage detected