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

Method autosizedHeatingDesignCapacity

src/model/SizingSystem.cpp:827–912  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

825 }
826
827 boost::optional<double> SizingSystem_Impl::autosizedHeatingDesignCapacity() const {
828 boost::optional<double> result;
829
830 std::string capacityType = "Heating";
831
832 // Get the parent AirLoopHVAC
833 AirLoopHVAC parAirLoop = airLoopHVAC();
834
835 // Get the name of the air loop
836 if (!parAirLoop.name()) {
837 LOG(Debug, "This object's parent AirLoopHVAC does not have a name, cannot retrieve the autosized " + capacityType + " Design Capacity.");
838 return result;
839 }
840
841 // Get the object name and transform to the way it is recorded
842 // in the sql file
843 std::string sqlName = parAirLoop.name().get();
844 boost::to_upper(sqlName);
845
846 // Check that the model has a sql file
847 if (!model().sqlFile()) {
848 LOG(Warn, "This model has no sql file, cannot retrieve the autosized " + capacityType + " Design Capacity.");
849 return result;
850 }
851
852 // Query the InitializationSummary -> System Sizing table to get
853 // the row names that contains information for this component.
854 std::string rowsQuery = R"(
855 SELECT RowName FROM TabularDataWithStrings
856 WHERE ReportName = 'InitializationSummary'
857 AND ReportForString = 'Entire Facility'
858 AND TableName = 'System Sizing Information'
859 AND Value = ?;)";
860
861 boost::optional<std::vector<std::string>> rowNames = model().sqlFile().get().execAndReturnVectorOfString(rowsQuery,
862 // Bind args
863 sqlName);
864
865 // Warn if the query failed
866 if (!rowNames) {
867 LOG(Warn, "Could not find a component called '" + sqlName + "' in any rows of the InitializationSummary System Sizing table.");
868 return result;
869 }
870
871 // Query each row of the InitializationSummary -> System Sizing table
872 // that contains this component to get the desired value.
873 for (const std::string& rowName : rowNames.get()) {
874
875 std::string rowCheckQuery = R"(
876 SELECT Value FROM TabularDataWithStrings
877 WHERE ReportName = 'InitializationSummary'
878 AND ReportForString = 'Entire Facility'
879 AND TableName = 'System Sizing Information'
880 AND RowName = ?
881 AND Value = ?;)";
882 boost::optional<std::string> rowValueName = model().sqlFile().get().execAndReturnFirstString(rowCheckQuery,
883 // bindArgs
884 rowName, capacityType);

Callers

nothing calls this directly

Calls 6

sqlFileMethod · 0.80
nameMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected