MCPcopy Create free account
hub / github.com/NatLabRockies/OpenStudio / annualTotalCost

Method annualTotalCost

src/utilities/sql/SqlFile_Impl.cpp:1027–1052  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 4

valueDescriptionMethod · 0.80
execAndReturnFirstDoubleFunction · 0.70
execAndReturnFirstStringFunction · 0.70
getMethod · 0.45

Tested by

no test coverage detected