src/model/WeatherFile.cpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /*********************************************************************************************************************** | ||
| 2 | * OpenStudio(R), Copyright (c) Alliance for Energy Innovation, LLC. | ||
| 3 | * See also https://openstudio.net/license | ||
| 4 | ***********************************************************************************************************************/ | ||
| 5 | |||
| 6 | #include "WeatherFile.hpp" | ||
| 7 | #include "WeatherFile_Impl.hpp" | ||
| 8 | |||
| 9 | #include "Model.hpp" | ||
| 10 | #include "Model_Impl.hpp" | ||
| 11 | #include "Site.hpp" | ||
| 12 | #include "Site_Impl.hpp" | ||
| 13 | |||
| 14 | #include <utilities/idd/OS_WeatherFile_FieldEnums.hxx> | ||
| 15 | #include <utilities/idd/IddEnums.hxx> | ||
| 16 | |||
| 17 | #include "../utilities/filetypes/EpwFile.hpp" | ||
| 18 | #include "../utilities/time/Date.hpp" | ||
| 19 | #include "../utilities/core/Assert.hpp" | ||
| 20 | #include "../utilities/core/PathHelpers.hpp" | ||
| 21 | #include "../utilities/core/String.hpp" | ||
| 22 | |||
| 23 | #include <boost/algorithm/string/replace.hpp> | ||
| 24 | |||
| 25 | namespace openstudio { | ||
| 26 | namespace model { | ||
| 27 | |||
| 28 | namespace detail { | ||
| 29 | |||
| 30 | 29 | WeatherFile_Impl::WeatherFile_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle) | |
| 31 | 29 | : ModelObject_Impl(idfObject, model, keepHandle) { | |
| 32 |
4/6✓ Branch 1 taken 29 times.
✓ Branch 4 taken 29 times.
✓ Branch 7 taken 29 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 29 times.
✗ Branch 13 not taken.
|
29 | OS_ASSERT(idfObject.iddObject().type() == WeatherFile::iddObjectType()); |
| 33 | 29 | } | |
| 34 | |||
| 35 | 11 | WeatherFile_Impl::WeatherFile_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle) | |
| 36 | 11 | : ModelObject_Impl(other, model, keepHandle) { | |
| 37 |
4/6✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
✓ Branch 7 taken 11 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 11 times.
✗ Branch 13 not taken.
|
11 | OS_ASSERT(other.iddObject().type() == WeatherFile::iddObjectType()); |
| 38 | 11 | } | |
| 39 | |||
| 40 | 75 | WeatherFile_Impl::WeatherFile_Impl(const WeatherFile_Impl& other, Model_Impl* model, bool keepHandle) | |
| 41 | 75 | : ModelObject_Impl(other, model, keepHandle) {} | |
| 42 | |||
| 43 | 1 | boost::optional<ParentObject> WeatherFile_Impl::parent() const { | |
| 44 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | boost::optional<ParentObject> result(this->site()); |
| 45 | 1 | return result; | |
| 46 | } | ||
| 47 | |||
| 48 | ✗ | bool WeatherFile_Impl::setParent(ParentObject& newParent) { | |
| 49 | ✗ | if (newParent.optionalCast<Site>() && (newParent.model() == model())) { | |
| 50 | ✗ | return true; | |
| 51 | } | ||
| 52 | ✗ | return false; | |
| 53 | } | ||
| 54 | |||
| 55 | ✗ | const std::vector<std::string>& WeatherFile_Impl::outputVariableNames() const { | |
| 56 | ✗ | static const std::vector<std::string> result; | |
| 57 | ✗ | return result; | |
| 58 | } | ||
| 59 | |||
| 60 | 2 | IddObjectType WeatherFile_Impl::iddObjectType() const { | |
| 61 | 2 | return WeatherFile::iddObjectType(); | |
| 62 | } | ||
| 63 | |||
| 64 | ✗ | std::string WeatherFile_Impl::city() const { | |
| 65 | ✗ | boost::optional<std::string> value = getString(OS_WeatherFileFields::City, true); | |
| 66 | ✗ | OS_ASSERT(value); | |
| 67 | ✗ | return value.get(); | |
| 68 | ✗ | } | |
| 69 | |||
| 70 | ✗ | std::string WeatherFile_Impl::stateProvinceRegion() const { | |
| 71 | ✗ | boost::optional<std::string> value = getString(OS_WeatherFileFields::StateProvinceRegion, true); | |
| 72 | ✗ | OS_ASSERT(value); | |
| 73 | ✗ | return value.get(); | |
| 74 | ✗ | } | |
| 75 | |||
| 76 | ✗ | std::string WeatherFile_Impl::country() const { | |
| 77 | ✗ | boost::optional<std::string> value = getString(OS_WeatherFileFields::Country, true); | |
| 78 | ✗ | OS_ASSERT(value); | |
| 79 | ✗ | return value.get(); | |
| 80 | ✗ | } | |
| 81 | |||
| 82 | ✗ | std::string WeatherFile_Impl::dataSource() const { | |
| 83 | ✗ | boost::optional<std::string> value = getString(OS_WeatherFileFields::DataSource, true); | |
| 84 | ✗ | OS_ASSERT(value); | |
| 85 | ✗ | return value.get(); | |
| 86 | ✗ | } | |
| 87 | |||
| 88 | ✗ | std::string WeatherFile_Impl::wMONumber() const { | |
| 89 | ✗ | boost::optional<std::string> value = getString(OS_WeatherFileFields::WMONumber, true); | |
| 90 | ✗ | OS_ASSERT(value); | |
| 91 | ✗ | return value.get(); | |
| 92 | ✗ | } | |
| 93 | |||
| 94 | ✗ | double WeatherFile_Impl::latitude() const { | |
| 95 | ✗ | boost::optional<double> value = getDouble(OS_WeatherFileFields::Latitude, true); | |
| 96 | ✗ | OS_ASSERT(value); | |
| 97 | ✗ | return value.get(); | |
| 98 | } | ||
| 99 | |||
| 100 | ✗ | double WeatherFile_Impl::longitude() const { | |
| 101 | ✗ | boost::optional<double> value = getDouble(OS_WeatherFileFields::Longitude, true); | |
| 102 | ✗ | OS_ASSERT(value); | |
| 103 | ✗ | return value.get(); | |
| 104 | } | ||
| 105 | |||
| 106 | ✗ | double WeatherFile_Impl::timeZone() const { | |
| 107 | ✗ | boost::optional<double> value = getDouble(OS_WeatherFileFields::TimeZone, true); | |
| 108 | ✗ | OS_ASSERT(value); | |
| 109 | ✗ | return value.get(); | |
| 110 | } | ||
| 111 | |||
| 112 | ✗ | double WeatherFile_Impl::elevation() const { | |
| 113 | ✗ | boost::optional<double> value = getDouble(OS_WeatherFileFields::Elevation, true); | |
| 114 | ✗ | OS_ASSERT(value); | |
| 115 | ✗ | return value.get(); | |
| 116 | } | ||
| 117 | |||
| 118 | ✗ | bool WeatherFile_Impl::isElevationDefaulted() const { | |
| 119 | ✗ | return isEmpty(OS_WeatherFileFields::Elevation); | |
| 120 | } | ||
| 121 | |||
| 122 | 66 | boost::optional<std::string> WeatherFile_Impl::url() const { | |
| 123 | 66 | return getString(OS_WeatherFileFields::Url, false, true); | |
| 124 | } | ||
| 125 | |||
| 126 | 66 | boost::optional<openstudio::path> WeatherFile_Impl::path() const { | |
| 127 | 66 | boost::optional<openstudio::path> result; | |
| 128 |
1/1✓ Branch 1 taken 66 times.
|
66 | OptionalString oUrlStr = this->url(); |
| 129 |
1/2✓ Branch 0 taken 66 times.
✗ Branch 1 not taken.
|
66 | if (oUrlStr) { |
| 130 |
3/3✓ Branch 1 taken 66 times.
✓ Branch 4 taken 66 times.
✓ Branch 7 taken 66 times.
|
66 | result = toPath(*oUrlStr); |
| 131 | } | ||
| 132 | 132 | return result; | |
| 133 | 66 | } | |
| 134 | |||
| 135 | ✗ | boost::optional<std::string> WeatherFile_Impl::checksum() const { | |
| 136 | ✗ | return getString(OS_WeatherFileFields::Checksum, true); | |
| 137 | } | ||
| 138 | |||
| 139 | ✗ | bool WeatherFile_Impl::setCity(const std::string& city) { | |
| 140 | ✗ | bool result = setString(OS_WeatherFileFields::City, city); | |
| 141 | ✗ | OS_ASSERT(result); | |
| 142 | ✗ | return result; | |
| 143 | } | ||
| 144 | |||
| 145 | ✗ | bool WeatherFile_Impl::setStateProvinceRegion(const std::string& stateProvinceRegion) { | |
| 146 | ✗ | bool result = setString(OS_WeatherFileFields::StateProvinceRegion, stateProvinceRegion); | |
| 147 | ✗ | OS_ASSERT(result); | |
| 148 | ✗ | return result; | |
| 149 | } | ||
| 150 | |||
| 151 | ✗ | bool WeatherFile_Impl::setCountry(const std::string& country) { | |
| 152 | ✗ | bool result = setString(OS_WeatherFileFields::Country, country); | |
| 153 | ✗ | OS_ASSERT(result); | |
| 154 | ✗ | return result; | |
| 155 | } | ||
| 156 | |||
| 157 | ✗ | bool WeatherFile_Impl::setDataSource(const std::string& dataSource) { | |
| 158 | ✗ | bool result = setString(OS_WeatherFileFields::DataSource, dataSource); | |
| 159 | ✗ | OS_ASSERT(result); | |
| 160 | ✗ | return result; | |
| 161 | } | ||
| 162 | |||
| 163 | ✗ | bool WeatherFile_Impl::setWMONumber(const std::string& wMONumber) { | |
| 164 | ✗ | bool result = setString(OS_WeatherFileFields::WMONumber, wMONumber); | |
| 165 | ✗ | OS_ASSERT(result); | |
| 166 | ✗ | return result; | |
| 167 | } | ||
| 168 | |||
| 169 | ✗ | bool WeatherFile_Impl::setLatitude(double latitude) { | |
| 170 | ✗ | bool result = setDouble(OS_WeatherFileFields::Latitude, latitude); | |
| 171 | ✗ | return result; | |
| 172 | } | ||
| 173 | |||
| 174 | ✗ | bool WeatherFile_Impl::setLongitude(double longitude) { | |
| 175 | ✗ | bool result = setDouble(OS_WeatherFileFields::Longitude, longitude); | |
| 176 | ✗ | return result; | |
| 177 | } | ||
| 178 | |||
| 179 | ✗ | bool WeatherFile_Impl::setTimeZone(double timeZone) { | |
| 180 | ✗ | bool result = setDouble(OS_WeatherFileFields::TimeZone, timeZone); | |
| 181 | ✗ | return result; | |
| 182 | } | ||
| 183 | |||
| 184 | ✗ | bool WeatherFile_Impl::setElevation(double elevation) { | |
| 185 | ✗ | bool result = setDouble(OS_WeatherFileFields::Elevation, elevation); | |
| 186 | ✗ | return result; | |
| 187 | } | ||
| 188 | |||
| 189 | ✗ | void WeatherFile_Impl::resetElevation() { | |
| 190 | ✗ | bool result = setString(OS_WeatherFileFields::Elevation, ""); | |
| 191 | ✗ | OS_ASSERT(result); | |
| 192 | ✗ | } | |
| 193 | /* | ||
| 194 | bool WeatherFile_Impl::setUrl(boost::optional<std::string> url) { | ||
| 195 | bool result = false; | ||
| 196 | if (url) { | ||
| 197 | result = setString(OS_WeatherFileFields::Url, url.get()); | ||
| 198 | } else { | ||
| 199 | result = setString(OS_WeatherFileFields::Url, ""); | ||
| 200 | } | ||
| 201 | OS_ASSERT(result); | ||
| 202 | return result; | ||
| 203 | } | ||
| 204 | |||
| 205 | bool WeatherFile_Impl::setUrl(const std::string& url) { | ||
| 206 | bool result = setString(OS_WeatherFileFields::Url, url); | ||
| 207 | OS_ASSERT(result); | ||
| 208 | return result; | ||
| 209 | } | ||
| 210 | |||
| 211 | void WeatherFile_Impl::resetUrl() { | ||
| 212 | bool result = setString(OS_WeatherFileFields::Url, ""); | ||
| 213 | OS_ASSERT(result); | ||
| 214 | } | ||
| 215 | |||
| 216 | bool WeatherFile_Impl::setChecksum(boost::optional<std::string> checksum) { | ||
| 217 | bool result = false; | ||
| 218 | if (checksum) { | ||
| 219 | result = setString(OS_WeatherFileFields::Checksum, checksum.get()); | ||
| 220 | } else { | ||
| 221 | result = setString(OS_WeatherFileFields::Checksum, ""); | ||
| 222 | } | ||
| 223 | OS_ASSERT(result); | ||
| 224 | return result; | ||
| 225 | } | ||
| 226 | |||
| 227 | bool WeatherFile_Impl::setChecksum(const std::string& checksum) { | ||
| 228 | bool result = setString(OS_WeatherFileFields::Checksum, checksum); | ||
| 229 | OS_ASSERT(result); | ||
| 230 | return result; | ||
| 231 | } | ||
| 232 | |||
| 233 | void WeatherFile_Impl::resetChecksum() { | ||
| 234 | bool result = setString(OS_WeatherFileFields::Checksum, ""); | ||
| 235 | OS_ASSERT(result); | ||
| 236 | } | ||
| 237 | */ | ||
| 238 | 1 | boost::optional<Site> WeatherFile_Impl::site() const { | |
| 239 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | return this->model().getOptionalUniqueModelObject<Site>(); |
| 240 | } | ||
| 241 | |||
| 242 | ✗ | boost::optional<EpwFile> WeatherFile_Impl::file(const openstudio::path& dir) const { | |
| 243 | ✗ | boost::optional<EpwFile> result; | |
| 244 | |||
| 245 | // get current path | ||
| 246 | ✗ | boost::optional<openstudio::path> currentPath = this->path(); | |
| 247 | ✗ | if (currentPath) { | |
| 248 | |||
| 249 | // try to load absolute path | ||
| 250 | ✗ | if (currentPath->is_absolute() && openstudio::filesystem::exists(*currentPath)) { | |
| 251 | try { | ||
| 252 | ✗ | result = EpwFile(*currentPath); | |
| 253 | ✗ | return result; | |
| 254 | ✗ | } catch (...) { | |
| 255 | ✗ | } | |
| 256 | |||
| 257 | // loading absolute path failed, try as relative path | ||
| 258 | ✗ | currentPath = currentPath->filename(); | |
| 259 | } | ||
| 260 | |||
| 261 | // try relative path | ||
| 262 | ✗ | if (!dir.empty()) { | |
| 263 | ✗ | openstudio::path newPath = openstudio::filesystem::absolute(*currentPath, dir); | |
| 264 | ✗ | if (openstudio::filesystem::exists(newPath)) { | |
| 265 | try { | ||
| 266 | ✗ | result = EpwFile(newPath); | |
| 267 | ✗ | return result; | |
| 268 | ✗ | } catch (...) { | |
| 269 | ✗ | } | |
| 270 | } | ||
| 271 | ✗ | } | |
| 272 | } | ||
| 273 | |||
| 274 | ✗ | return boost::none; | |
| 275 | ✗ | } | |
| 276 | |||
| 277 | ✗ | bool WeatherFile_Impl::makeUrlRelative(const openstudio::path& basePath) { | |
| 278 | ✗ | boost::optional<openstudio::path> currentPath = this->path(); | |
| 279 | ✗ | if (currentPath) { | |
| 280 | ✗ | openstudio::path newPath; | |
| 281 | ✗ | if (basePath.empty()) { | |
| 282 | ✗ | newPath = currentPath->filename(); | |
| 283 | } else { | ||
| 284 | ✗ | newPath = relativePath(*currentPath, basePath); | |
| 285 | } | ||
| 286 | ✗ | if (!newPath.empty()) { | |
| 287 | ✗ | std::string weatherFileUrl = toString(newPath); | |
| 288 | ✗ | LOG(Debug, "Setting weather file url to " << weatherFileUrl); | |
| 289 | ✗ | return setString(OS_WeatherFileFields::Url, weatherFileUrl); | |
| 290 | ✗ | } | |
| 291 | ✗ | } | |
| 292 | ✗ | return false; | |
| 293 | ✗ | } | |
| 294 | |||
| 295 | ✗ | bool WeatherFile_Impl::makeUrlAbsolute(const openstudio::path& searchDirectory) { | |
| 296 | ✗ | boost::optional<openstudio::path> currentPath = this->path(); | |
| 297 | ✗ | if (currentPath) { | |
| 298 | ✗ | if (currentPath->is_absolute() && openstudio::filesystem::exists(*currentPath)) { | |
| 299 | ✗ | return true; | |
| 300 | } | ||
| 301 | ✗ | openstudio::path newPath; | |
| 302 | ✗ | openstudio::path workingPath(*currentPath); | |
| 303 | ✗ | if (!currentPath->is_absolute()) { | |
| 304 | ✗ | newPath = openstudio::filesystem::system_complete(workingPath); | |
| 305 | ✗ | LOG(Debug, "Current path '" << toString(*currentPath) << "' not complete. " << "After calling system_complete have '" << toString(newPath) | |
| 306 | << "'."); | ||
| 307 | } | ||
| 308 | ✗ | if (newPath.empty() || !openstudio::filesystem::exists(newPath)) { | |
| 309 | ✗ | newPath = searchDirectory / *currentPath; | |
| 310 | ✗ | LOG(Debug, "Going to look for '" << toString(newPath) << "'."); | |
| 311 | } | ||
| 312 | ✗ | if (newPath.empty() || !openstudio::filesystem::exists(newPath)) { | |
| 313 | ✗ | workingPath = currentPath->filename(); | |
| 314 | ✗ | newPath = searchDirectory / workingPath; | |
| 315 | ✗ | LOG(Debug, "Going to look for '" << toString(newPath) << "'."); | |
| 316 | } | ||
| 317 | ✗ | if (newPath.empty() || !openstudio::filesystem::exists(newPath)) { | |
| 318 | ✗ | return false; | |
| 319 | } | ||
| 320 | ✗ | std::string weatherFileUrl = toString(newPath); | |
| 321 | ✗ | LOG(Debug, "Setting weather file url to " << weatherFileUrl); | |
| 322 | ✗ | return setString(OS_WeatherFileFields::Url, weatherFileUrl); | |
| 323 | ✗ | } | |
| 324 | ✗ | return false; | |
| 325 | ✗ | } | |
| 326 | |||
| 327 | ✗ | boost::optional<std::string> WeatherFile_Impl::environmentName() const { | |
| 328 | ✗ | OptionalString result; | |
| 329 | |||
| 330 | ✗ | OptionalString city = getString(OS_WeatherFileFields::City, true); | |
| 331 | ✗ | OptionalString state = getString(OS_WeatherFileFields::StateProvinceRegion, true); | |
| 332 | ✗ | OptionalString country = getString(OS_WeatherFileFields::Country, true); | |
| 333 | ✗ | OptionalString dataSource = getString(OS_WeatherFileFields::DataSource, true); | |
| 334 | ✗ | OptionalString wmoNumber = getString(OS_WeatherFileFields::WMONumber, true); | |
| 335 | |||
| 336 | ✗ | if (city && state && country && dataSource && wmoNumber) { | |
| 337 | ✗ | result = *city + " " + *state + " " + *country + " " + *dataSource + " WMO#=" + *wmoNumber; | |
| 338 | } | ||
| 339 | |||
| 340 | ✗ | return result; | |
| 341 | ✗ | } | |
| 342 | |||
| 343 | ✗ | std::vector<EMSActuatorNames> WeatherFile_Impl::emsActuatorNames() const { | |
| 344 | std::vector<EMSActuatorNames> actuators{ | ||
| 345 | {"Weather Data", "Outdoor Dry Bulb"}, {"Weather Data", "Outdoor Dew Point"}, {"Weather Data", "Outdoor Relative Humidity"}, | ||
| 346 | {"Weather Data", "Diffuse Solar"}, {"Weather Data", "Direct Solar"}, {"Weather Data", "Wind Speed"}, | ||
| 347 | ✗ | {"Weather Data", "Wind Direction"}}; | |
| 348 | ✗ | return actuators; | |
| 349 | ✗ | } | |
| 350 | |||
| 351 | ✗ | std::vector<std::string> WeatherFile_Impl::emsInternalVariableNames() const { | |
| 352 | ✗ | std::vector<std::string> types; | |
| 353 | ✗ | return types; | |
| 354 | } | ||
| 355 | |||
| 356 | 214 | boost::optional<int> WeatherFile_Impl::startDateActualYear() const { | |
| 357 |
1/1✓ Branch 1 taken 214 times.
|
214 | boost::optional<int> result = getInt(OS_WeatherFileFields::StartDateActualYear, true); |
| 358 | 214 | return result; | |
| 359 | } | ||
| 360 | |||
| 361 | 215 | boost::optional<DayOfWeek> WeatherFile_Impl::startDayOfWeek() const { | |
| 362 |
1/1✓ Branch 1 taken 215 times.
|
215 | boost::optional<std::string> result = getString(OS_WeatherFileFields::StartDayofWeek, false, true); |
| 363 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 2 taken 212 times.
|
215 | if (!result) { |
| 364 | 3 | return boost::none; | |
| 365 | } | ||
| 366 |
3/3✓ Branch 1 taken 212 times.
✓ Branch 4 taken 212 times.
✓ Branch 7 taken 212 times.
|
212 | return openstudio::DayOfWeek{*result}; |
| 367 | 215 | } | |
| 368 | |||
| 369 | } // namespace detail | ||
| 370 | |||
| 371 | 10901 | IddObjectType WeatherFile::iddObjectType() { | |
| 372 |
1/1✓ Branch 1 taken 10901 times.
|
10901 | IddObjectType result(IddObjectType::OS_WeatherFile); |
| 373 | 10901 | return result; | |
| 374 | } | ||
| 375 | |||
| 376 | 22 | boost::optional<WeatherFile> WeatherFile::setWeatherFile(Model& model, const openstudio::EpwFile& epwFile) { | |
| 377 |
1/1✓ Branch 1 taken 22 times.
|
22 | WeatherFile weatherFile = model.getUniqueModelObject<WeatherFile>(); |
| 378 |
2/2✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
|
22 | weatherFile.setString(OS_WeatherFileFields::City, epwFile.city()); |
| 379 |
2/2✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
|
22 | weatherFile.setString(OS_WeatherFileFields::StateProvinceRegion, epwFile.stateProvinceRegion()); |
| 380 |
2/2✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
|
22 | weatherFile.setString(OS_WeatherFileFields::Country, epwFile.country()); |
| 381 |
2/2✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
|
22 | weatherFile.setString(OS_WeatherFileFields::DataSource, epwFile.dataSource()); |
| 382 |
2/2✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
|
22 | weatherFile.setString(OS_WeatherFileFields::WMONumber, epwFile.wmoNumber()); |
| 383 |
2/2✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
|
22 | weatherFile.setDouble(OS_WeatherFileFields::Latitude, epwFile.latitude()); |
| 384 |
2/2✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
|
22 | weatherFile.setDouble(OS_WeatherFileFields::Longitude, epwFile.longitude()); |
| 385 |
2/2✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
|
22 | weatherFile.setDouble(OS_WeatherFileFields::TimeZone, epwFile.timeZone()); |
| 386 |
2/2✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
|
22 | weatherFile.setDouble(OS_WeatherFileFields::Elevation, epwFile.elevation()); |
| 387 |
3/3✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
✓ Branch 7 taken 22 times.
|
22 | weatherFile.setString(OS_WeatherFileFields::Url, toString(epwFile.path())); |
| 388 |
2/2✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
|
22 | weatherFile.setString(OS_WeatherFileFields::Checksum, epwFile.checksum()); |
| 389 |
3/3✓ Branch 1 taken 22 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 21 times.
|
44 | if (auto s_ = epwFile.startDateActualYear()) { |
| 390 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | weatherFile.setInt(OS_WeatherFileFields::StartDateActualYear, s_.get()); |
| 391 | } | ||
| 392 | |||
| 393 |
3/3✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
✓ Branch 7 taken 22 times.
|
22 | weatherFile.setString(OS_WeatherFileFields::StartDayofWeek, epwFile.startDayOfWeek().valueName()); |
| 394 | |||
| 395 |
1/1✓ Branch 1 taken 22 times.
|
44 | return weatherFile; |
| 396 | 22 | } | |
| 397 | |||
| 398 | ✗ | std::string WeatherFile::city() const { | |
| 399 | ✗ | return getImpl<detail::WeatherFile_Impl>()->city(); | |
| 400 | } | ||
| 401 | |||
| 402 | ✗ | std::string WeatherFile::stateProvinceRegion() const { | |
| 403 | ✗ | return getImpl<detail::WeatherFile_Impl>()->stateProvinceRegion(); | |
| 404 | } | ||
| 405 | |||
| 406 | ✗ | std::string WeatherFile::country() const { | |
| 407 | ✗ | return getImpl<detail::WeatherFile_Impl>()->country(); | |
| 408 | } | ||
| 409 | |||
| 410 | ✗ | std::string WeatherFile::dataSource() const { | |
| 411 | ✗ | return getImpl<detail::WeatherFile_Impl>()->dataSource(); | |
| 412 | } | ||
| 413 | |||
| 414 | ✗ | std::string WeatherFile::wMONumber() const { | |
| 415 | ✗ | return getImpl<detail::WeatherFile_Impl>()->wMONumber(); | |
| 416 | } | ||
| 417 | |||
| 418 | ✗ | double WeatherFile::latitude() const { | |
| 419 | ✗ | return getImpl<detail::WeatherFile_Impl>()->latitude(); | |
| 420 | } | ||
| 421 | |||
| 422 | ✗ | double WeatherFile::longitude() const { | |
| 423 | ✗ | return getImpl<detail::WeatherFile_Impl>()->longitude(); | |
| 424 | } | ||
| 425 | |||
| 426 | ✗ | double WeatherFile::timeZone() const { | |
| 427 | ✗ | return getImpl<detail::WeatherFile_Impl>()->timeZone(); | |
| 428 | } | ||
| 429 | |||
| 430 | ✗ | double WeatherFile::elevation() const { | |
| 431 | ✗ | return getImpl<detail::WeatherFile_Impl>()->elevation(); | |
| 432 | } | ||
| 433 | |||
| 434 | ✗ | bool WeatherFile::isElevationDefaulted() const { | |
| 435 | ✗ | return getImpl<detail::WeatherFile_Impl>()->isElevationDefaulted(); | |
| 436 | } | ||
| 437 | |||
| 438 | ✗ | boost::optional<std::string> WeatherFile::url() const { | |
| 439 | ✗ | return getImpl<detail::WeatherFile_Impl>()->url(); | |
| 440 | } | ||
| 441 | |||
| 442 | 66 | boost::optional<openstudio::path> WeatherFile::path() const { | |
| 443 |
1/1✓ Branch 3 taken 66 times.
|
66 | return getImpl<detail::WeatherFile_Impl>()->path(); |
| 444 | } | ||
| 445 | |||
| 446 | ✗ | boost::optional<std::string> WeatherFile::checksum() const { | |
| 447 | ✗ | return getImpl<detail::WeatherFile_Impl>()->checksum(); | |
| 448 | } | ||
| 449 | |||
| 450 | ✗ | bool WeatherFile::setCity(const std::string& city) { | |
| 451 | ✗ | return getImpl<detail::WeatherFile_Impl>()->setCity(city); | |
| 452 | } | ||
| 453 | |||
| 454 | ✗ | bool WeatherFile::setStateProvinceRegion(const std::string& stateProvinceRegion) { | |
| 455 | ✗ | return getImpl<detail::WeatherFile_Impl>()->setStateProvinceRegion(stateProvinceRegion); | |
| 456 | } | ||
| 457 | |||
| 458 | ✗ | bool WeatherFile::setCountry(const std::string& country) { | |
| 459 | ✗ | return getImpl<detail::WeatherFile_Impl>()->setCountry(country); | |
| 460 | } | ||
| 461 | |||
| 462 | ✗ | bool WeatherFile::setDataSource(const std::string& dataSource) { | |
| 463 | ✗ | return getImpl<detail::WeatherFile_Impl>()->setDataSource(dataSource); | |
| 464 | } | ||
| 465 | |||
| 466 | ✗ | bool WeatherFile::setWMONumber(const std::string& wMONumber) { | |
| 467 | ✗ | return getImpl<detail::WeatherFile_Impl>()->setWMONumber(wMONumber); | |
| 468 | } | ||
| 469 | |||
| 470 | ✗ | bool WeatherFile::setLatitude(double latitude) { | |
| 471 | ✗ | return getImpl<detail::WeatherFile_Impl>()->setLatitude(latitude); | |
| 472 | } | ||
| 473 | |||
| 474 | ✗ | bool WeatherFile::setLongitude(double longitude) { | |
| 475 | ✗ | return getImpl<detail::WeatherFile_Impl>()->setLongitude(longitude); | |
| 476 | } | ||
| 477 | |||
| 478 | ✗ | bool WeatherFile::setTimeZone(double timeZone) { | |
| 479 | ✗ | return getImpl<detail::WeatherFile_Impl>()->setTimeZone(timeZone); | |
| 480 | } | ||
| 481 | |||
| 482 | ✗ | bool WeatherFile::setElevation(double elevation) { | |
| 483 | ✗ | return getImpl<detail::WeatherFile_Impl>()->setElevation(elevation); | |
| 484 | } | ||
| 485 | |||
| 486 | ✗ | void WeatherFile::resetElevation() { | |
| 487 | ✗ | getImpl<detail::WeatherFile_Impl>()->resetElevation(); | |
| 488 | ✗ | } | |
| 489 | /* | ||
| 490 | bool WeatherFile::setUrl(boost::optional<std::string> url) { | ||
| 491 | return getImpl<detail::WeatherFile_Impl>()->setUrl(url); | ||
| 492 | } | ||
| 493 | |||
| 494 | bool WeatherFile::setUrl(const std::string& url) { | ||
| 495 | return getImpl<detail::WeatherFile_Impl>()->setUrl(url); | ||
| 496 | } | ||
| 497 | |||
| 498 | void WeatherFile::resetUrl() { | ||
| 499 | getImpl<detail::WeatherFile_Impl>()->resetUrl(); | ||
| 500 | } | ||
| 501 | |||
| 502 | bool WeatherFile::setChecksum(boost::optional<std::string> checksum) { | ||
| 503 | return getImpl<detail::WeatherFile_Impl>()->setChecksum(checksum); | ||
| 504 | } | ||
| 505 | |||
| 506 | bool WeatherFile::setChecksum(const std::string& checksum) { | ||
| 507 | return getImpl<detail::WeatherFile_Impl>()->setChecksum(checksum); | ||
| 508 | } | ||
| 509 | |||
| 510 | void WeatherFile::resetChecksum() { | ||
| 511 | getImpl<detail::WeatherFile_Impl>()->resetChecksum(); | ||
| 512 | } | ||
| 513 | */ | ||
| 514 | |||
| 515 | ✗ | boost::optional<Site> WeatherFile::site() const { | |
| 516 | ✗ | return getImpl<detail::WeatherFile_Impl>()->site(); | |
| 517 | } | ||
| 518 | |||
| 519 | ✗ | boost::optional<EpwFile> WeatherFile::file(const openstudio::path& dir) const { | |
| 520 | ✗ | return getImpl<detail::WeatherFile_Impl>()->file(dir); | |
| 521 | } | ||
| 522 | |||
| 523 | ✗ | bool WeatherFile::makeUrlRelative(const openstudio::path& basePath) { | |
| 524 | ✗ | return getImpl<detail::WeatherFile_Impl>()->makeUrlRelative(basePath); | |
| 525 | } | ||
| 526 | |||
| 527 | ✗ | bool WeatherFile::makeUrlAbsolute(const openstudio::path& searchDirectory) { | |
| 528 | ✗ | return getImpl<detail::WeatherFile_Impl>()->makeUrlAbsolute(searchDirectory); | |
| 529 | } | ||
| 530 | |||
| 531 | ✗ | boost::optional<std::string> WeatherFile::environmentName() const { | |
| 532 | ✗ | return getImpl<detail::WeatherFile_Impl>()->environmentName(); | |
| 533 | } | ||
| 534 | |||
| 535 | 214 | boost::optional<int> WeatherFile::startDateActualYear() const { | |
| 536 |
1/1✓ Branch 3 taken 214 times.
|
214 | return getImpl<detail::WeatherFile_Impl>()->startDateActualYear(); |
| 537 | } | ||
| 538 | |||
| 539 | 215 | boost::optional<DayOfWeek> WeatherFile::startDayOfWeek() const { | |
| 540 |
1/1✓ Branch 3 taken 215 times.
|
215 | return getImpl<detail::WeatherFile_Impl>()->startDayOfWeek(); |
| 541 | } | ||
| 542 | |||
| 543 | /// @cond | ||
| 544 |
1/1✓ Branch 3 taken 61 times.
|
61 | WeatherFile::WeatherFile(std::shared_ptr<detail::WeatherFile_Impl> impl) : ModelObject(std::move(impl)) {} |
| 545 | 18 | WeatherFile::WeatherFile(Model& model) : ModelObject(WeatherFile::iddObjectType(), model) {} | |
| 546 | |||
| 547 | /// @endcond | ||
| 548 | |||
| 549 | } // namespace model | ||
| 550 | } // namespace openstudio | ||
| 551 |