| 738 | } |
| 739 | |
| 740 | boost::optional<double> SizingSystem_Impl::autosizedCoolingDesignCapacity() const { |
| 741 | boost::optional<double> result; |
| 742 | |
| 743 | std::string capacityType = "Cooling"; |
| 744 | |
| 745 | // Get the parent AirLoopHVAC |
| 746 | AirLoopHVAC parAirLoop = airLoopHVAC(); |
| 747 | |
| 748 | // Get the name of the air loop |
| 749 | if (!parAirLoop.name()) { |
| 750 | LOG(Warn, "This object's parent AirLoopHVAC does not have a name, cannot retrieve the autosized " + capacityType + " Design Capacity."); |
| 751 | return result; |
| 752 | } |
| 753 | |
| 754 | // Get the object name and transform to the way it is recorded |
| 755 | // in the sql file |
| 756 | std::string sqlName = parAirLoop.name().get(); |
| 757 | boost::to_upper(sqlName); |
| 758 | |
| 759 | // Check that the model has a sql file |
| 760 | if (!model().sqlFile()) { |
| 761 | LOG(Warn, "This model has no sql file, cannot retrieve the autosized " + capacityType + " Design Capacity."); |
| 762 | return result; |
| 763 | } |
| 764 | |
| 765 | // Query the InitializationSummary -> System Sizing Information table to get |
| 766 | // the row names that contains information for this component. |
| 767 | std::string rowsQuery = R"( |
| 768 | SELECT RowName FROM TabularDataWithStrings |
| 769 | WHERE ReportName = 'InitializationSummary' |
| 770 | AND ReportForString = 'Entire Facility' |
| 771 | AND TableName = 'System Sizing Information' |
| 772 | AND Value = ?;)"; |
| 773 | |
| 774 | boost::optional<std::vector<std::string>> rowNames = model().sqlFile().get().execAndReturnVectorOfString(rowsQuery, |
| 775 | // Bind args |
| 776 | sqlName); |
| 777 | |
| 778 | // Warn if the query failed |
| 779 | if (!rowNames) { |
| 780 | LOG(Warn, "Could not find a component called '" + sqlName + "' in any rows of the InitializationSummary System Sizing table."); |
| 781 | return result; |
| 782 | } |
| 783 | |
| 784 | // Query each row of the InitializationSummary -> System Sizing table |
| 785 | // that contains this component to get the desired value. |
| 786 | for (const std::string& rowName : rowNames.get()) { |
| 787 | |
| 788 | std::string rowCheckQuery = R"( |
| 789 | SELECT Value FROM TabularDataWithStrings |
| 790 | WHERE ReportName = 'InitializationSummary' |
| 791 | AND ReportForString = 'Entire Facility' |
| 792 | AND TableName = 'System Sizing Information' |
| 793 | AND RowName = ? |
| 794 | AND Value = ?;)"; |
| 795 | boost::optional<std::string> rowValueName = model().sqlFile().get().execAndReturnFirstString(rowCheckQuery, |
| 796 | // bindArgs |
| 797 | rowName, capacityType); |
nothing calls this directly
no test coverage detected