| 5146 | } |
| 5147 | |
| 5148 | bool EpwFile::parseDesignConditions(const std::string& line) { |
| 5149 | // DESIGN CONDITIONS,1,Climate Design Data 2009 ASHRAE Handbook,,Heating,12,-17.4,-14,-21.5,0.7,-11.7,-18.9,0.9,-6.9,14.1,1.8,12,2.4,3.3,160,Cooling,7,15.2,34.6,15.7,33.2,15.6,31.8,15.4,18.3,27.3,17.6,27,17,26.5,4.2,80,16,14,19.9,15.2,13.2,19.7,14.1,12.3,19.6,58.3,27,55.9,26.9,53.8,26.3,722,Extremes,11.9,10.4,8.8,20.7,-22.7,37.1,2.8,1.3,-24.7,38,-26.3,38.8,-27.9,39.5,-29.9,40.5 |
| 5150 | // DESIGN CONDITIONS,Number of Design Conditions,Title of Design Condition,Design Stat,HDB 99.6%,HDB 99%,X WS 1%,X WS 2.5%,X WS 5%,CM WS .4%,CM MDB .4%,CM WS 1%,CM MDB 1%,MWS 99.6%,PWD 99.6%,MWS .4%,PWD .4%,X MnDB Max,X MnDB Min,X StdDB Max,X StdDB Min,Design Stat,CDB .4%,C MWB .4%,CDB 1%,C MWB 1%,CDB 2%,C MWB 2%,E WB .4%,E MDB .4%,E WB 1%,E MDB 1%,E WB 2%,E MDB 2%,DP .4%,HR .4%,MDB .4%,DP 1%,HR 1%,MDB 1%,DP 2%,HR 2%,MDB 2%,DB Range |
| 5151 | // Bail out if the design conditions array already has contents |
| 5152 | if (!m_designs.empty()) { |
| 5153 | return true; |
| 5154 | } |
| 5155 | |
| 5156 | std::vector<std::string> split = splitString(line, ','); |
| 5157 | |
| 5158 | if (split[0] != "DESIGN CONDITIONS") { |
| 5159 | LOG(Error, "Missing DESIGN CONDITIONS specifier in EPW file '" << m_path << "'"); |
| 5160 | return false; |
| 5161 | } else if (split[1] == "0") { |
| 5162 | LOG(Warn, "Appears there are no design condition fields in the EPW file '" << m_path << "'"); |
| 5163 | return true; |
| 5164 | } |
| 5165 | |
| 5166 | int nDesignConditions = std::stoi(split[1]); |
| 5167 | |
| 5168 | size_t num_design_cond_fields = 68; |
| 5169 | size_t expected_split_size = 2 + nDesignConditions * num_design_cond_fields; |
| 5170 | if (split.size() != expected_split_size) { |
| 5171 | // Could technically happen if EPW was prepared with HoF 2017, but never seen a file like that |
| 5172 | num_design_cond_fields = 67; |
| 5173 | expected_split_size = 2 + nDesignConditions * num_design_cond_fields; |
| 5174 | |
| 5175 | if (split.size() != expected_split_size) { |
| 5176 | LOG(Warn, "Expected " << expected_split_size << " design condition fields rather than the " << split.size() << " fields in the EPW file '" |
| 5177 | << m_path << "'. Design conditions will not be parsed."); |
| 5178 | nDesignConditions = 0; |
| 5179 | } |
| 5180 | } |
| 5181 | |
| 5182 | if (nDesignConditions > 1) { |
| 5183 | LOG(Warn, "Found " << nDesignConditions << " in the EPW file '" << m_path << "'"); |
| 5184 | } |
| 5185 | |
| 5186 | for (int j = 0; j < nDesignConditions; j++) { |
| 5187 | std::vector<std::string> design_condition(num_design_cond_fields); |
| 5188 | for (size_t k = 0; k < num_design_cond_fields; k++) { |
| 5189 | design_condition[k] = split[k + 2 + (num_design_cond_fields * j)]; |
| 5190 | } |
| 5191 | boost::optional<EpwDesignCondition> dc = EpwDesignCondition::fromDesignConditionsStrings(design_condition); |
| 5192 | if (dc) { |
| 5193 | m_designs.push_back(dc.get()); |
| 5194 | } else { |
| 5195 | LOG(Error, "Failed to parse design condition " << j + 1 << " of EPW file '" << m_path << "'"); |
| 5196 | return false; |
| 5197 | } |
| 5198 | } |
| 5199 | return true; |
| 5200 | } |
| 5201 | |
| 5202 | bool EpwFile::parseGroundTemperatures(const std::string& line) { |
| 5203 | // GROUND TEMPERATURES,3,.5,,,,-0.60,1.34,5.12,8.69,15.46,19.02,20.00,18.20,14.02,8.83,3.71,0.32,2,,,,2.08,2.55,4.70,7.10,12.30,15.62,17.28,16.91,14.53,10.94,6.90,3.72,4,,,,4.84,4.51,5.45,6.81,10.25,12.82,14.49,14.90,13.86,11.74,9.00,6.53 |
nothing calls this directly
no test coverage detected