| 953 | } |
| 954 | |
| 955 | boost::optional<double> SizingSystem_Impl::autosizedOccupantDiversity() const { |
| 956 | boost::optional<double> result; |
| 957 | |
| 958 | // Note: as of 9.6.0, for some reason, it returns one entry for cooling and one for heating... |
| 959 | // And it's only present in the tabular report 'Standard62.1Summary' |
| 960 | // Both the Heating and Cooling are actually the same underlying value. Cf https://github.com/NREL/OpenStudio/pull/4450#issue-1011104323 |
| 961 | std::string tableName = "System Ventilation Requirements for Cooling"; |
| 962 | |
| 963 | // Get the parent AirLoopHVAC |
| 964 | AirLoopHVAC parAirLoop = airLoopHVAC(); |
| 965 | |
| 966 | // Get the object name and transform to the way it is recorded |
| 967 | // in the sql file |
| 968 | std::string sqlName = parAirLoop.nameString(); |
| 969 | boost::to_upper(sqlName); |
| 970 | |
| 971 | // Check that the model has a sql file |
| 972 | if (!model().sqlFile()) { |
| 973 | LOG(Warn, "This model has no sql file, cannot retrieve the autosized " + tableName + " - 'Occupant Diversity - D'."); |
| 974 | return result; |
| 975 | } |
| 976 | |
| 977 | // Query the InitializationSummary -> System Sizing table to get |
| 978 | // the row names that contains information for this component. |
| 979 | std::string rowsQuery = R"( |
| 980 | SELECT Value FROM TabularDataWithStrings |
| 981 | WHERE ReportName = 'Standard62.1Summary' |
| 982 | AND ReportForString = 'Entire Facility' |
| 983 | AND ColumnName = 'Occupant Diversity - D' |
| 984 | AND TableName = ? |
| 985 | AND RowName = ?; |
| 986 | )"; |
| 987 | |
| 988 | result = model().sqlFile().get().execAndReturnFirstDouble(rowsQuery, |
| 989 | // Bind args |
| 990 | tableName, sqlName); |
| 991 | return result; |
| 992 | } |
| 993 | |
| 994 | void SizingSystem_Impl::autosize() { |
| 995 | autosizeDesignOutdoorAirFlowRate(); |
nothing calls this directly
no test coverage detected