| 513 | } |
| 514 | |
| 515 | bool SqlFile_Impl::isValidConnection() { |
| 516 | std::string energyPlusVersion = this->energyPlusVersion(); |
| 517 | if (energyPlusVersion.empty()) { |
| 518 | return false; |
| 519 | } |
| 520 | |
| 521 | VersionString version(energyPlusVersion); |
| 522 | if (version >= VersionString(7, 0) && version <= VersionString(energyPlusVersionMajor(), energyPlusVersionMinor())) { |
| 523 | m_supportedVersion = true; |
| 524 | } else { |
| 525 | m_supportedVersion = false; |
| 526 | LOG(Warn, "Using unsupported EnergyPlus version " << version.str()); |
| 527 | } |
| 528 | |
| 529 | // v8.9.0 added the year tag, but it seems it's always zero... |
| 530 | // IlluminanceMap Year started in 9.2.0 |
| 531 | // m_hasYear & m_hasIlluminanceMapYear are both default initialized to true |
| 532 | if (version < VersionString(9, 2)) { |
| 533 | m_hasIlluminanceMapYear = false; |
| 534 | } else if (version < VersionString(9, 6)) { |
| 535 | m_illuminanceMapHasOnly2RefPts = true; |
| 536 | } |
| 537 | |
| 538 | if (version < VersionString(8, 9)) { |
| 539 | m_hasYear = false; |
| 540 | } else { |
| 541 | // Check if zero |
| 542 | boost::optional<int> maxYear = execAndReturnFirstInt("SELECT MAX(Year) FROM Time"); |
| 543 | if (!maxYear.is_initialized() || maxYear.get() <= 0) { |
| 544 | auto nOtherThanRunPeriod = |
| 545 | execAndReturnFirstInt("SELECT COUNT(ReportingFrequency) FROM ReportDataDictionary WHERE ReportingFrequency NOT LIKE '%Run Period%'"); |
| 546 | if (nOtherThanRunPeriod > 0) { |
| 547 | LOG(Warn, "Using EnergyPlusVersion version " << version.str() << " which should have 'Year' field, but it's always zero"); |
| 548 | } else { |
| 549 | LOG(Info, "Your SQLFile does not contain the 'Year' field since you did not request any outputs at a frequency lower than Run Period"); |
| 550 | } |
| 551 | m_hasYear = false; |
| 552 | } |
| 553 | } |
| 554 | |
| 555 | return true; |
| 556 | } |
| 557 | |
| 558 | int SqlFile_Impl::insertZone(const std::string& t_name, double t_relNorth, double t_originX, double t_originY, double t_originZ, double t_centroidX, |
| 559 | double t_centroidY, double t_centroidZ, int t_ofType, double t_multiplier, double t_listMultiplier, double t_minimumX, |
nothing calls this directly
no test coverage detected