src/osversion/VersionTranslator.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 "VersionTranslator.hpp" | ||
| 7 | |||
| 8 | #include "../model/Model.hpp" | ||
| 9 | #include "../model/Component.hpp" | ||
| 10 | #include "../model/Component_Impl.hpp" | ||
| 11 | #include "../model/Schedule.hpp" | ||
| 12 | #include "../model/Schedule_Impl.hpp" | ||
| 13 | #include "../model/ScheduleTypeLimits.hpp" | ||
| 14 | #include "../model/ScheduleTypeLimits_Impl.hpp" | ||
| 15 | #include "../model/ScheduleTypeRegistry.hpp" | ||
| 16 | #include "../model/ScheduleDay.hpp" | ||
| 17 | #include "../model/ScheduleDay_Impl.hpp" | ||
| 18 | #include "../model/ScheduleRule.hpp" | ||
| 19 | #include "../model/ScheduleRule_Impl.hpp" | ||
| 20 | #include "../model/ScheduleRuleset.hpp" | ||
| 21 | #include "../model/ScheduleRuleset_Impl.hpp" | ||
| 22 | #include "../model/ComponentData.hpp" | ||
| 23 | #include "../model/ComponentData_Impl.hpp" | ||
| 24 | #include "../model/ModelExtensibleGroup.hpp" | ||
| 25 | |||
| 26 | #include "../utilities/idf/IdfExtensibleGroup.hpp" | ||
| 27 | #include "../utilities/idf/ValidityReport.hpp" | ||
| 28 | #include "../utilities/core/PathHelpers.hpp" | ||
| 29 | #include "../utilities/core/Containers.hpp" | ||
| 30 | #include "../utilities/core/Compare.hpp" | ||
| 31 | #include "../utilities/core/Assert.hpp" | ||
| 32 | #include "../utilities/plot/ProgressBar.hpp" | ||
| 33 | #include "../utilities/units/QuantityConverter.hpp" | ||
| 34 | #include "../utilities/math/FloatCompare.hpp" | ||
| 35 | #include "../utilities/idf/IdfObject_Impl.hpp" | ||
| 36 | #include "../utilities/core/ASCIIStrings.hpp" | ||
| 37 | #include "../utilities/core/UUID.hpp" | ||
| 38 | #include "../utilities/data/DataEnums.hpp" | ||
| 39 | |||
| 40 | #include <utilities/idd/IddFactory.hxx> | ||
| 41 | #include <utilities/idd/IddEnums.hxx> | ||
| 42 | #include <utilities/idd/OS_ComponentData_FieldEnums.hxx> | ||
| 43 | |||
| 44 | #include <OpenStudio.hxx> | ||
| 45 | |||
| 46 | #include <boost/regex.hpp> | ||
| 47 | #include <boost/lexical_cast.hpp> | ||
| 48 | #include <fmt/format.h> | ||
| 49 | |||
| 50 | #include <algorithm> | ||
| 51 | #include <array> | ||
| 52 | #include <cmath> | ||
| 53 | #include <iterator> | ||
| 54 | #include <map> | ||
| 55 | #include <memory> | ||
| 56 | #include <sstream> | ||
| 57 | #include <string> | ||
| 58 | #include <string_view> | ||
| 59 | #include <thread> | ||
| 60 | |||
| 61 | namespace openstudio { | ||
| 62 | namespace osversion { | ||
| 63 | |||
| 64 | // Helper class | ||
| 65 | // A passed lvalue binds to name, then is copied into m_name. | ||
| 66 | 9658 | RefactoredObjectData::RefactoredObjectData(const IdfObject& oldObject, const IdfObject& newObject) | |
| 67 |
1/1✓ Branch 2 taken 9658 times.
|
9658 | : m_oldObject(oldObject), m_newObject(newObject) {} |
| 68 | |||
| 69 | // A passed rvalue binds to rname, then is moved into m_name. | ||
| 70 | 2518 | RefactoredObjectData::RefactoredObjectData(IdfObject&& oldObject, IdfObject&& newObject) | |
| 71 | 2518 | : m_oldObject(std::move(oldObject)), m_newObject(std::move(newObject)) {} | |
| 72 | |||
| 73 | ✗ | IdfObject RefactoredObjectData::oldObject() const { | |
| 74 | ✗ | return m_oldObject; | |
| 75 | } | ||
| 76 | |||
| 77 | ✗ | IdfObject RefactoredObjectData::newObject() const { | |
| 78 | ✗ | return m_newObject; | |
| 79 | } | ||
| 80 | |||
| 81 |
3/3✓ Branch 3 taken 167 times.
✓ Branch 6 taken 167 times.
✓ Branch 11 taken 167 times.
|
501 | VersionTranslator::VersionTranslator() : m_originalVersion("0.0.0"), m_allowNewerVersions(true) { |
| 82 |
1/1✓ Branch 1 taken 167 times.
|
167 | m_logSink.setLogLevel(Warn); |
| 83 |
2/2✓ Branch 1 taken 167 times.
✓ Branch 4 taken 167 times.
|
167 | m_logSink.setChannelRegex(boost::regex("openstudio\\.osversion\\.VersionTranslator")); |
| 84 |
1/1✓ Branch 2 taken 167 times.
|
167 | m_logSink.setThreadId(std::this_thread::get_id()); |
| 85 | |||
| 86 | // Register required update methods, indexed on the file version returned by the method (the | ||
| 87 | // target version). | ||
| 88 | // - For all but latest version, these are non-trivial transformations between two subsequent | ||
| 89 | // versions. | ||
| 90 | // - For the latest version, start with the defaultUpdate method, and then switch it out for a | ||
| 91 | // non-trivial transformation if necessary. If the previous update was also trivial, just | ||
| 92 | // replace that version number with the new one. (At most there should only be one occurrence | ||
| 93 | // of defaultUpdate in this list.) | ||
| 94 |
4/4✓ Branch 1 taken 167 times.
✓ Branch 4 taken 167 times.
✓ Branch 7 taken 167 times.
✓ Branch 10 taken 167 times.
|
334 | m_updateMethods[VersionString("0.7.2")] = &VersionTranslator::update_0_7_1_to_0_7_2; |
| 95 |
4/4✓ Branch 1 taken 167 times.
✓ Branch 4 taken 167 times.
✓ Branch 7 taken 167 times.
✓ Branch 10 taken 167 times.
|
334 | m_updateMethods[VersionString("0.7.3")] = &VersionTranslator::update_0_7_2_to_0_7_3; |
| 96 |
4/4✓ Branch 1 taken 167 times.
✓ Branch 4 taken 167 times.
✓ Branch 7 taken 167 times.
✓ Branch 10 taken 167 times.
|
334 | m_updateMethods[VersionString("0.7.4")] = &VersionTranslator::update_0_7_3_to_0_7_4; |
| 97 |
4/4✓ Branch 1 taken 167 times.
✓ Branch 4 taken 167 times.
✓ Branch 7 taken 167 times.
✓ Branch 10 taken 167 times.
|
334 | m_updateMethods[VersionString("0.9.2")] = &VersionTranslator::update_0_9_1_to_0_9_2; |
| 98 |
4/4✓ Branch 1 taken 167 times.
✓ Branch 4 taken 167 times.
✓ Branch 7 taken 167 times.
✓ Branch 10 taken 167 times.
|
334 | m_updateMethods[VersionString("0.9.6")] = &VersionTranslator::update_0_9_5_to_0_9_6; |
| 99 |
4/4✓ Branch 1 taken 167 times.
✓ Branch 4 taken 167 times.
✓ Branch 7 taken 167 times.
✓ Branch 10 taken 167 times.
|
334 | m_updateMethods[VersionString("0.10.0")] = &VersionTranslator::update_0_9_6_to_0_10_0; |
| 100 |
4/4✓ Branch 1 taken 167 times.
✓ Branch 4 taken 167 times.
✓ Branch 7 taken 167 times.
✓ Branch 10 taken 167 times.
|
334 | m_updateMethods[VersionString("0.11.1")] = &VersionTranslator::update_0_11_0_to_0_11_1; |
| 101 |
4/4✓ Branch 1 taken 167 times.
✓ Branch 4 taken 167 times.
✓ Branch 7 taken 167 times.
✓ Branch 10 taken 167 times.
|
334 | m_updateMethods[VersionString("0.11.2")] = &VersionTranslator::update_0_11_1_to_0_11_2; |
| 102 |
4/4✓ Branch 1 taken 167 times.
✓ Branch 4 taken 167 times.
✓ Branch 7 taken 167 times.
✓ Branch 10 taken 167 times.
|
334 | m_updateMethods[VersionString("0.11.5")] = &VersionTranslator::update_0_11_4_to_0_11_5; |
| 103 |
4/4✓ Branch 1 taken 167 times.
✓ Branch 4 taken 167 times.
✓ Branch 7 taken 167 times.
✓ Branch 10 taken 167 times.
|
334 | m_updateMethods[VersionString("0.11.6")] = &VersionTranslator::update_0_11_5_to_0_11_6; |
| 104 |
4/4✓ Branch 1 taken 167 times.
✓ Branch 4 taken 167 times.
✓ Branch 7 taken 167 times.
✓ Branch 10 taken 167 times.
|
334 | m_updateMethods[VersionString("1.0.2")] = &VersionTranslator::update_1_0_1_to_1_0_2; |
| 105 |
4/4✓ Branch 1 taken 167 times.
✓ Branch 4 taken 167 times.
✓ Branch 7 taken 167 times.
✓ Branch 10 taken 167 times.
|
334 | m_updateMethods[VersionString("1.0.3")] = &VersionTranslator::update_1_0_2_to_1_0_3; |
| 106 |
4/4✓ Branch 1 taken 167 times.
✓ Branch 4 taken 167 times.
✓ Branch 7 taken 167 times.
✓ Branch 10 taken 167 times.
|
334 | m_updateMethods[VersionString("1.2.3")] = &VersionTranslator::update_1_2_2_to_1_2_3; |
| 107 |
4/4✓ Branch 1 taken 167 times.
✓ Branch 4 taken 167 times.
✓ Branch 7 taken 167 times.
✓ Branch 10 taken 167 times.
|
334 | m_updateMethods[VersionString("1.3.5")] = &VersionTranslator::update_1_3_4_to_1_3_5; |
| 108 |
4/4✓ Branch 1 taken 167 times.
✓ Branch 4 taken 167 times.
✓ Branch 7 taken 167 times.
✓ Branch 10 taken 167 times.
|
334 | m_updateMethods[VersionString("1.5.4")] = &VersionTranslator::update_1_5_3_to_1_5_4; |
| 109 |
4/4✓ Branch 1 taken 167 times.
✓ Branch 4 taken 167 times.
✓ Branch 7 taken 167 times.
✓ Branch 10 taken 167 times.
|
334 | m_updateMethods[VersionString("1.7.2")] = &VersionTranslator::update_1_7_1_to_1_7_2; |
| 110 |
4/4✓ Branch 1 taken 167 times.
✓ Branch 4 taken 167 times.
✓ Branch 7 taken 167 times.
✓ Branch 10 taken 167 times.
|
334 | m_updateMethods[VersionString("1.7.5")] = &VersionTranslator::update_1_7_4_to_1_7_5; |
| 111 |
4/4✓ Branch 1 taken 167 times.
✓ Branch 4 taken 167 times.
✓ Branch 7 taken 167 times.
✓ Branch 10 taken 167 times.
|
334 | m_updateMethods[VersionString("1.8.4")] = &VersionTranslator::update_1_8_3_to_1_8_4; |
| 112 |
4/4✓ Branch 1 taken 167 times.
✓ Branch 4 taken 167 times.
✓ Branch 7 taken 167 times.
✓ Branch 10 taken 167 times.
|
334 | m_updateMethods[VersionString("1.8.5")] = &VersionTranslator::update_1_8_4_to_1_8_5; |
| 113 |
4/4✓ Branch 1 taken 167 times.
✓ Branch 4 taken 167 times.
✓ Branch 7 taken 167 times.
✓ Branch 10 taken 167 times.
|
334 | m_updateMethods[VersionString("1.9.0")] = &VersionTranslator::update_1_8_5_to_1_9_0; |
| 114 |
4/4✓ Branch 1 taken 167 times.
✓ Branch 4 taken 167 times.
✓ Branch 7 taken 167 times.
✓ Branch 10 taken 167 times.
|
334 | m_updateMethods[VersionString("1.9.3")] = &VersionTranslator::update_1_9_2_to_1_9_3; |
| 115 |
4/4✓ Branch 1 taken 167 times.
✓ Branch 4 taken 167 times.
✓ Branch 7 taken 167 times.
✓ Branch 10 taken 167 times.
|
334 | m_updateMethods[VersionString("1.9.5")] = &VersionTranslator::update_1_9_4_to_1_9_5; |
| 116 |
4/4✓ Branch 1 taken 167 times.
✓ Branch 4 taken 167 times.
✓ Branch 7 taken 167 times.
✓ Branch 10 taken 167 times.
|
334 | m_updateMethods[VersionString("1.10.0")] = &VersionTranslator::update_1_9_5_to_1_10_0; |
| 117 |
4/4✓ Branch 1 taken 167 times.
✓ Branch 4 taken 167 times.
✓ Branch 7 taken 167 times.
✓ Branch 10 taken 167 times.
|
334 | m_updateMethods[VersionString("1.10.2")] = &VersionTranslator::update_1_10_1_to_1_10_2; |
| 118 |
4/4✓ Branch 1 taken 167 times.
✓ Branch 4 taken 167 times.
✓ Branch 7 taken 167 times.
✓ Branch 10 taken 167 times.
|
334 | m_updateMethods[VersionString("1.10.6")] = &VersionTranslator::update_1_10_5_to_1_10_6; |
| 119 |
4/4✓ Branch 1 taken 167 times.
✓ Branch 4 taken 167 times.
✓ Branch 7 taken 167 times.
✓ Branch 10 taken 167 times.
|
334 | m_updateMethods[VersionString("1.11.4")] = &VersionTranslator::update_1_11_3_to_1_11_4; |
| 120 |
4/4✓ Branch 1 taken 167 times.
✓ Branch 4 taken 167 times.
✓ Branch 7 taken 167 times.
✓ Branch 10 taken 167 times.
|
334 | m_updateMethods[VersionString("1.11.5")] = &VersionTranslator::update_1_11_4_to_1_11_5; |
| 121 |
4/4✓ Branch 1 taken 167 times.
✓ Branch 4 taken 167 times.
✓ Branch 7 taken 167 times.
✓ Branch 10 taken 167 times.
|
334 | m_updateMethods[VersionString("1.12.1")] = &VersionTranslator::update_1_12_0_to_1_12_1; |
| 122 |
4/4✓ Branch 1 taken 167 times.
✓ Branch 4 taken 167 times.
✓ Branch 7 taken 167 times.
✓ Branch 10 taken 167 times.
|
334 | m_updateMethods[VersionString("1.12.4")] = &VersionTranslator::update_1_12_3_to_1_12_4; |
| 123 |
4/4✓ Branch 1 taken 167 times.
✓ Branch 4 taken 167 times.
✓ Branch 7 taken 167 times.
✓ Branch 10 taken 167 times.
|
334 | m_updateMethods[VersionString("2.1.1")] = &VersionTranslator::update_2_1_0_to_2_1_1; |
| 124 |
4/4✓ Branch 1 taken 167 times.
✓ Branch 4 taken 167 times.
✓ Branch 7 taken 167 times.
✓ Branch 10 taken 167 times.
|
334 | m_updateMethods[VersionString("2.1.2")] = &VersionTranslator::update_2_1_1_to_2_1_2; |
| 125 |
4/4✓ Branch 1 taken 167 times.
✓ Branch 4 taken 167 times.
✓ Branch 7 taken 167 times.
✓ Branch 10 taken 167 times.
|
334 | m_updateMethods[VersionString("2.3.1")] = &VersionTranslator::update_2_3_0_to_2_3_1; |
| 126 |
4/4✓ Branch 1 taken 167 times.
✓ Branch 4 taken 167 times.
✓ Branch 7 taken 167 times.
✓ Branch 10 taken 167 times.
|
334 | m_updateMethods[VersionString("2.4.2")] = &VersionTranslator::update_2_4_1_to_2_4_2; |
| 127 |
4/4✓ Branch 1 taken 167 times.
✓ Branch 4 taken 167 times.
✓ Branch 7 taken 167 times.
✓ Branch 10 taken 167 times.
|
334 | m_updateMethods[VersionString("2.5.0")] = &VersionTranslator::update_2_4_3_to_2_5_0; |
| 128 |
4/4✓ Branch 1 taken 167 times.
✓ Branch 4 taken 167 times.
✓ Branch 7 taken 167 times.
✓ Branch 10 taken 167 times.
|
334 | m_updateMethods[VersionString("2.6.1")] = &VersionTranslator::update_2_6_0_to_2_6_1; |
| 129 |
4/4✓ Branch 1 taken 167 times.
✓ Branch 4 taken 167 times.
✓ Branch 7 taken 167 times.
✓ Branch 10 taken 167 times.
|
334 | m_updateMethods[VersionString("2.6.2")] = &VersionTranslator::update_2_6_1_to_2_6_2; |
| 130 |
4/4✓ Branch 1 taken 167 times.
✓ Branch 4 taken 167 times.
✓ Branch 7 taken 167 times.
✓ Branch 10 taken 167 times.
|
334 | m_updateMethods[VersionString("2.7.0")] = &VersionTranslator::update_2_6_2_to_2_7_0; |
| 131 |
4/4✓ Branch 1 taken 167 times.
✓ Branch 4 taken 167 times.
✓ Branch 7 taken 167 times.
✓ Branch 10 taken 167 times.
|
334 | m_updateMethods[VersionString("2.7.1")] = &VersionTranslator::update_2_7_0_to_2_7_1; |
| 132 |
4/4✓ Branch 1 taken 167 times.
✓ Branch 4 taken 167 times.
✓ Branch 7 taken 167 times.
✓ Branch 10 taken 167 times.
|
334 | m_updateMethods[VersionString("2.7.2")] = &VersionTranslator::update_2_7_1_to_2_7_2; |
| 133 |
4/4✓ Branch 1 taken 167 times.
✓ Branch 4 taken 167 times.
✓ Branch 7 taken 167 times.
✓ Branch 10 taken 167 times.
|
334 | m_updateMethods[VersionString("2.9.0")] = &VersionTranslator::update_2_8_1_to_2_9_0; |
| 134 |
4/4✓ Branch 1 taken 167 times.
✓ Branch 4 taken 167 times.
✓ Branch 7 taken 167 times.
✓ Branch 10 taken 167 times.
|
334 | m_updateMethods[VersionString("2.9.1")] = &VersionTranslator::update_2_9_0_to_2_9_1; |
| 135 |
4/4✓ Branch 1 taken 167 times.
✓ Branch 4 taken 167 times.
✓ Branch 7 taken 167 times.
✓ Branch 10 taken 167 times.
|
334 | m_updateMethods[VersionString("3.0.0")] = &VersionTranslator::update_2_9_1_to_3_0_0; |
| 136 |
4/4✓ Branch 1 taken 167 times.
✓ Branch 4 taken 167 times.
✓ Branch 7 taken 167 times.
✓ Branch 10 taken 167 times.
|
334 | m_updateMethods[VersionString("3.0.1")] = &VersionTranslator::update_3_0_0_to_3_0_1; |
| 137 |
4/4✓ Branch 1 taken 167 times.
✓ Branch 4 taken 167 times.
✓ Branch 7 taken 167 times.
✓ Branch 10 taken 167 times.
|
334 | m_updateMethods[VersionString("3.1.0")] = &VersionTranslator::update_3_0_1_to_3_1_0; |
| 138 |
4/4✓ Branch 1 taken 167 times.
✓ Branch 4 taken 167 times.
✓ Branch 7 taken 167 times.
✓ Branch 10 taken 167 times.
|
334 | m_updateMethods[VersionString("3.2.0")] = &VersionTranslator::update_3_1_0_to_3_2_0; |
| 139 |
4/4✓ Branch 1 taken 167 times.
✓ Branch 4 taken 167 times.
✓ Branch 7 taken 167 times.
✓ Branch 10 taken 167 times.
|
334 | m_updateMethods[VersionString("3.2.1")] = &VersionTranslator::update_3_2_0_to_3_2_1; |
| 140 |
4/4✓ Branch 1 taken 167 times.
✓ Branch 4 taken 167 times.
✓ Branch 7 taken 167 times.
✓ Branch 10 taken 167 times.
|
334 | m_updateMethods[VersionString("3.3.0")] = &VersionTranslator::update_3_2_1_to_3_3_0; |
| 141 |
4/4✓ Branch 1 taken 167 times.
✓ Branch 4 taken 167 times.
✓ Branch 7 taken 167 times.
✓ Branch 10 taken 167 times.
|
334 | m_updateMethods[VersionString("3.4.0")] = &VersionTranslator::update_3_3_0_to_3_4_0; |
| 142 |
4/4✓ Branch 1 taken 167 times.
✓ Branch 4 taken 167 times.
✓ Branch 7 taken 167 times.
✓ Branch 10 taken 167 times.
|
334 | m_updateMethods[VersionString("3.5.0")] = &VersionTranslator::update_3_4_0_to_3_5_0; |
| 143 |
4/4✓ Branch 1 taken 167 times.
✓ Branch 4 taken 167 times.
✓ Branch 7 taken 167 times.
✓ Branch 10 taken 167 times.
|
334 | m_updateMethods[VersionString("3.5.1")] = &VersionTranslator::update_3_5_0_to_3_5_1; |
| 144 |
4/4✓ Branch 1 taken 167 times.
✓ Branch 4 taken 167 times.
✓ Branch 7 taken 167 times.
✓ Branch 10 taken 167 times.
|
334 | m_updateMethods[VersionString("3.6.0")] = &VersionTranslator::update_3_5_1_to_3_6_0; |
| 145 |
4/4✓ Branch 1 taken 167 times.
✓ Branch 4 taken 167 times.
✓ Branch 7 taken 167 times.
✓ Branch 10 taken 167 times.
|
334 | m_updateMethods[VersionString("3.7.0")] = &VersionTranslator::update_3_6_1_to_3_7_0; |
| 146 |
4/4✓ Branch 1 taken 167 times.
✓ Branch 4 taken 167 times.
✓ Branch 7 taken 167 times.
✓ Branch 10 taken 167 times.
|
334 | m_updateMethods[VersionString("3.8.0")] = &VersionTranslator::update_3_7_0_to_3_8_0; |
| 147 |
4/4✓ Branch 1 taken 167 times.
✓ Branch 4 taken 167 times.
✓ Branch 7 taken 167 times.
✓ Branch 10 taken 167 times.
|
334 | m_updateMethods[VersionString("3.9.0")] = &VersionTranslator::update_3_8_0_to_3_9_0; |
| 148 |
4/4✓ Branch 1 taken 167 times.
✓ Branch 4 taken 167 times.
✓ Branch 7 taken 167 times.
✓ Branch 10 taken 167 times.
|
334 | m_updateMethods[VersionString("3.10.0")] = &VersionTranslator::update_3_9_0_to_3_10_0; |
| 149 |
4/4✓ Branch 1 taken 167 times.
✓ Branch 4 taken 167 times.
✓ Branch 7 taken 167 times.
✓ Branch 10 taken 167 times.
|
334 | m_updateMethods[VersionString("3.11.0")] = &VersionTranslator::update_3_10_0_to_3_11_0; |
| 150 |
4/4✓ Branch 1 taken 167 times.
✓ Branch 4 taken 167 times.
✓ Branch 7 taken 167 times.
✓ Branch 10 taken 167 times.
|
334 | m_updateMethods[VersionString("3.12.0")] = &VersionTranslator::update_3_11_0_to_3_12_0; |
| 151 | |||
| 152 | // List of previous versions that may be updated to this one. | ||
| 153 | // - To increment the translator, add an entry for the version just released (branched for | ||
| 154 | // release). | ||
| 155 |
2/4✓ Branch 0 taken 27054 times.
✓ Branch 1 taken 167 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
27221 | m_startVersions = { |
| 156 |
1/1✓ Branch 1 taken 167 times.
|
167 | VersionString("0.7.0"), VersionString("0.7.1"), VersionString("0.7.2"), VersionString("0.7.3"), VersionString("0.7.4"), |
| 157 | 835 | VersionString("0.7.5"), VersionString("0.7.6"), VersionString("0.8.0"), VersionString("0.8.1"), VersionString("0.8.2"), | |
| 158 | 835 | VersionString("0.8.3"), VersionString("0.8.4"), VersionString("0.8.5"), VersionString("0.9.0"), VersionString("0.9.1"), | |
| 159 | 835 | VersionString("0.9.2"), VersionString("0.9.3"), VersionString("0.9.4"), VersionString("0.9.5"), VersionString("0.9.6"), | |
| 160 | 835 | VersionString("0.10.0"), VersionString("0.10.1"), VersionString("0.10.2"), VersionString("0.10.3"), VersionString("0.10.4"), | |
| 161 | 835 | VersionString("0.10.5"), VersionString("0.11.0"), VersionString("0.11.1"), VersionString("0.11.2"), VersionString("0.11.3"), | |
| 162 | 835 | VersionString("0.11.4"), VersionString("0.11.5"), VersionString("0.11.6"), VersionString("1.0.0"), VersionString("1.0.1"), | |
| 163 | 835 | VersionString("1.0.2"), VersionString("1.0.3"), VersionString("1.0.4"), VersionString("1.0.5"), VersionString("1.0.6"), | |
| 164 | 835 | VersionString("1.0.7"), VersionString("1.1.0"), VersionString("1.1.1"), VersionString("1.1.2"), VersionString("1.1.3"), | |
| 165 | 835 | VersionString("1.2.0"), VersionString("1.2.1"), VersionString("1.2.2"), VersionString("1.2.3"), VersionString("1.2.4"), | |
| 166 | 835 | VersionString("1.2.5"), VersionString("1.3.0"), VersionString("1.3.1"), VersionString("1.3.2"), VersionString("1.3.3"), | |
| 167 | 835 | VersionString("1.3.4"), VersionString("1.3.5"), VersionString("1.4.0"), VersionString("1.4.1"), VersionString("1.4.2"), | |
| 168 | 835 | VersionString("1.4.3"), VersionString("1.5.0"), VersionString("1.5.1"), VersionString("1.5.2"), VersionString("1.5.3"), | |
| 169 | 835 | VersionString("1.5.4"), VersionString("1.5.5"), VersionString("1.6.0"), VersionString("1.6.1"), VersionString("1.6.2"), | |
| 170 | 835 | VersionString("1.6.3"), VersionString("1.7.0"), VersionString("1.7.1"), VersionString("1.7.2"), VersionString("1.7.3"), | |
| 171 | 835 | VersionString("1.7.4"), VersionString("1.7.5"), VersionString("1.8.0"), VersionString("1.8.1"), VersionString("1.8.2"), | |
| 172 | 835 | VersionString("1.8.3"), VersionString("1.8.4"), VersionString("1.8.5"), VersionString("1.9.0"), VersionString("1.9.1"), | |
| 173 | 835 | VersionString("1.9.2"), VersionString("1.9.3"), VersionString("1.9.4"), VersionString("1.9.5"), VersionString("1.10.0"), | |
| 174 | 835 | VersionString("1.10.1"), VersionString("1.10.2"), VersionString("1.10.3"), VersionString("1.10.4"), VersionString("1.10.5"), | |
| 175 | 835 | VersionString("1.10.6"), VersionString("1.11.0"), VersionString("1.11.1"), VersionString("1.11.2"), VersionString("1.11.3"), | |
| 176 | 835 | VersionString("1.11.4"), VersionString("1.11.5"), VersionString("1.11.6"), VersionString("1.12.0"), VersionString("1.12.1"), | |
| 177 | 835 | VersionString("1.12.2"), VersionString("1.12.3"), VersionString("1.12.4"), VersionString("1.12.5"), VersionString("1.12.6"), | |
| 178 | 835 | VersionString("1.13.0"), VersionString("1.13.1"), VersionString("1.13.2"), VersionString("1.13.3"), VersionString("1.13.4"), | |
| 179 | 835 | VersionString("1.14.0"), VersionString("2.0.0"), VersionString("2.0.1"), VersionString("2.0.2"), VersionString("2.0.3"), | |
| 180 | 835 | VersionString("2.0.5"), VersionString("2.1.0"), VersionString("2.1.1"), VersionString("2.1.2"), VersionString("2.2.0"), | |
| 181 | 835 | VersionString("2.2.1"), VersionString("2.2.2"), VersionString("2.3.0"), VersionString("2.3.1"), VersionString("2.4.0"), | |
| 182 | 835 | VersionString("2.4.1"), VersionString("2.4.2"), VersionString("2.4.3"), VersionString("2.5.0"), VersionString("2.5.1"), | |
| 183 | 835 | VersionString("2.5.2"), VersionString("2.6.0"), VersionString("2.6.1"), VersionString("2.6.2"), VersionString("2.7.0"), | |
| 184 | 835 | VersionString("2.7.1"), VersionString("2.7.2"), VersionString("2.8.0"), VersionString("2.8.1"), VersionString("2.9.0"), | |
| 185 | 835 | VersionString("2.9.1"), VersionString("3.0.0"), VersionString("3.0.1"), VersionString("3.1.0"), VersionString("3.2.0"), | |
| 186 | 835 | VersionString("3.2.1"), VersionString("3.3.0"), VersionString("3.4.0"), VersionString("3.5.0"), VersionString("3.5.1"), | |
| 187 | 835 | VersionString("3.6.0"), VersionString("3.6.1"), VersionString("3.7.0"), VersionString("3.8.0"), VersionString("3.9.0"), | |
| 188 | 334 | VersionString("3.10.0"), VersionString("3.11.0") | |
| 189 | // Note: do **not** include the **current** version in m_startVersions, stop at the previous release | ||
| 190 | //VersionString("3.12.0"), | ||
| 191 | 27221 | }; | |
| 192 | 668 | } | |
| 193 | |||
| 194 | 160 | boost::optional<model::Model> VersionTranslator::loadModel(const openstudio::path& pathToOldOsm, ProgressBar* progressBar) { | |
| 195 |
8/8✓ Branch 1 taken 160 times.
✓ Branch 4 taken 160 times.
✓ Branch 7 taken 160 times.
✓ Branch 10 taken 160 times.
✓ Branch 13 taken 160 times.
✓ Branch 17 taken 160 times.
✓ Branch 20 taken 160 times.
✓ Branch 23 taken 160 times.
|
160 | LOG(Trace, "Loading model from " << toString(pathToOldOsm) << "."); |
| 196 |
3/4✓ Branch 1 taken 160 times.
✓ Branch 4 taken 160 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 160 times.
|
160 | if (getFileExtension(pathToOldOsm) != modelFileExtension()) { |
| 197 | ✗ | LOG(Error, "Cannot loadModel for path'" << toString(pathToOldOsm) << "'. Extension must be '" << modelFileExtension() << "'. For '" | |
| 198 | << componentFileExtension() << "'s use loadComponent."); | ||
| 199 | ✗ | return boost::none; | |
| 200 | } | ||
| 201 | |||
| 202 |
2/2✓ Branch 1 taken 160 times.
✓ Branch 5 taken 160 times.
|
160 | path wp = completePathToFile(pathToOldOsm, path(), modelFileExtension(), false); |
| 203 |
1/1✓ Branch 1 taken 160 times.
|
160 | openstudio::filesystem::ifstream inFile(wp); |
| 204 |
2/3✓ Branch 1 taken 160 times.
✓ Branch 3 taken 160 times.
✗ Branch 4 not taken.
|
160 | if (inFile) { |
| 205 |
1/1✓ Branch 1 taken 160 times.
|
160 | return loadModel(inFile, progressBar); |
| 206 | } | ||
| 207 | ✗ | return boost::none; | |
| 208 | 160 | } | |
| 209 | |||
| 210 | 174 | boost::optional<model::Model> VersionTranslator::loadModel(std::istream& is, ProgressBar* progressBar) { | |
| 211 | 174 | return updateVersion(is, false, progressBar); | |
| 212 | } | ||
| 213 | |||
| 214 | ✗ | boost::optional<model::Model> VersionTranslator::loadModelFromString(const std::string& str, ProgressBar* progressBar) { | |
| 215 | ✗ | std::stringstream ss(str); | |
| 216 | ✗ | return updateVersion(ss, false, progressBar); | |
| 217 | ✗ | } | |
| 218 | |||
| 219 | 4 | boost::optional<model::Component> VersionTranslator::loadComponent(const openstudio::path& pathToOldOsc, ProgressBar* progressBar) { | |
| 220 |
8/8✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✓ Branch 10 taken 4 times.
✓ Branch 13 taken 4 times.
✓ Branch 17 taken 4 times.
✓ Branch 20 taken 4 times.
✓ Branch 23 taken 4 times.
|
4 | LOG(Trace, "Loading component from " << toString(pathToOldOsc) << "."); |
| 221 |
3/4✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 4 times.
|
4 | if (getFileExtension(pathToOldOsc) != componentFileExtension()) { |
| 222 | ✗ | LOG(Error, "Cannot loadComponent for path'" << toString(pathToOldOsc) << "'. Extension must be '" << componentFileExtension() << "'. For '" | |
| 223 | << modelFileExtension() << "'s use loadModel."); | ||
| 224 | ✗ | return boost::none; | |
| 225 | } | ||
| 226 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 5 taken 4 times.
|
4 | path wp = completePathToFile(pathToOldOsc, path(), componentFileExtension(), false); |
| 227 |
1/1✓ Branch 1 taken 4 times.
|
4 | openstudio::filesystem::ifstream inFile(wp); |
| 228 |
2/3✓ Branch 1 taken 4 times.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
|
4 | if (inFile) { |
| 229 |
1/1✓ Branch 1 taken 4 times.
|
4 | return loadComponent(inFile, progressBar); |
| 230 | } | ||
| 231 | |||
| 232 | ✗ | return boost::none; | |
| 233 | 4 | } | |
| 234 | |||
| 235 | 4 | boost::optional<model::Component> VersionTranslator::loadComponent(std::istream& is, ProgressBar* progressBar) { | |
| 236 |
1/1✓ Branch 1 taken 4 times.
|
4 | model::OptionalModel result = updateVersion(is, true, progressBar); |
| 237 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
4 | if (result) { |
| 238 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | return result->optionalCast<model::Component>(); |
| 239 | } | ||
| 240 | ✗ | return boost::none; | |
| 241 | 4 | } | |
| 242 | |||
| 243 | ✗ | VersionString VersionTranslator::originalVersion() const { | |
| 244 | ✗ | return m_originalVersion; | |
| 245 | } | ||
| 246 | |||
| 247 | ✗ | std::vector<LogMessage> VersionTranslator::warnings() const { | |
| 248 | ✗ | std::vector<LogMessage> result = m_logSink.logMessages(); | |
| 249 | ✗ | result.erase(std::remove_if(result.begin(), result.end(), [](const auto& logMessage) { return logMessage.logLevel() != Warn; }), result.end()); | |
| 250 | ✗ | return result; | |
| 251 | ✗ | } | |
| 252 | |||
| 253 | ✗ | std::vector<LogMessage> VersionTranslator::errors() const { | |
| 254 | ✗ | std::vector<LogMessage> result = m_logSink.logMessages(); | |
| 255 | ✗ | result.erase(std::remove_if(result.begin(), result.end(), [](const auto& logMessage) { return logMessage.logLevel() <= Warn; }), result.end()); | |
| 256 | ✗ | return result; | |
| 257 | ✗ | } | |
| 258 | |||
| 259 | 168 | std::vector<IdfObject> VersionTranslator::deprecatedObjects() const { | |
| 260 | 168 | return m_deprecated; | |
| 261 | } | ||
| 262 | |||
| 263 | 168 | std::vector<IdfObject> VersionTranslator::untranslatedObjects() const { | |
| 264 | 168 | return m_untranslated; | |
| 265 | } | ||
| 266 | |||
| 267 | 168 | std::vector<IdfObject> VersionTranslator::newObjects() const { | |
| 268 | 168 | return m_new; | |
| 269 | } | ||
| 270 | |||
| 271 | ✗ | std::vector<RefactoredObjectData> VersionTranslator::refactoredObjects() const { | |
| 272 | ✗ | return m_refactored; | |
| 273 | } | ||
| 274 | |||
| 275 | ✗ | bool VersionTranslator::allowNewerVersions() const { | |
| 276 | ✗ | return m_allowNewerVersions; | |
| 277 | } | ||
| 278 | |||
| 279 | 1 | void VersionTranslator::setAllowNewerVersions(bool allowNewerVersions) { | |
| 280 | 1 | m_allowNewerVersions = allowNewerVersions; | |
| 281 | 1 | } | |
| 282 | |||
| 283 | 178 | boost::optional<model::Model> VersionTranslator::updateVersion(std::istream& is, bool isComponent, ProgressBar* progressBar) { | |
| 284 |
2/2✓ Branch 1 taken 178 times.
✓ Branch 4 taken 178 times.
|
178 | m_originalVersion = VersionString("0.0.0"); |
| 285 | 178 | m_map.clear(); | |
| 286 |
1/1✓ Branch 2 taken 178 times.
|
178 | m_logSink.setThreadId(std::this_thread::get_id()); |
| 287 |
1/1✓ Branch 1 taken 178 times.
|
178 | m_logSink.resetStringStream(); |
| 288 | 178 | m_deprecated.clear(); | |
| 289 | 178 | m_untranslated.clear(); | |
| 290 | 178 | m_new.clear(); | |
| 291 | 178 | m_refactored.clear(); | |
| 292 | 178 | m_nObjectsStart = 0; | |
| 293 | 178 | m_nObjectsFinalIdf = 0; | |
| 294 | 178 | m_nObjectsFinalModel = 0; | |
| 295 | 178 | m_isComponent = isComponent; | |
| 296 | |||
| 297 |
1/1✓ Branch 1 taken 178 times.
|
178 | initializeMap(is); |
| 298 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 178 times.
✗ Branch 4 not taken.
|
178 | OS_ASSERT(m_map.size() < 2u); |
| 299 |
2/2✓ Branch 1 taken 10 times.
✓ Branch 2 taken 168 times.
|
178 | if (m_map.empty()) { |
| 300 | 10 | return boost::none; | |
| 301 | } | ||
| 302 | |||
| 303 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 168 times.
|
168 | if (progressBar) { |
| 304 | ✗ | progressBar->setMinimum(0); | |
| 305 | ✗ | progressBar->setMaximum(m_startVersions.size()); | |
| 306 | } | ||
| 307 |
2/2✓ Branch 5 taken 27216 times.
✓ Branch 6 taken 168 times.
|
27384 | for (const VersionString& startVersion : m_startVersions) { |
| 308 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 27216 times.
|
27216 | if (progressBar) { |
| 309 | ✗ | progressBar->setWindowTitle("Upgrading from " + startVersion.str()); | |
| 310 | ✗ | progressBar->setValue(progressBar->value() + 1); | |
| 311 | } | ||
| 312 |
1/1✓ Branch 1 taken 27216 times.
|
27216 | update(startVersion); // does nothing if no map entry |
| 313 | } | ||
| 314 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 168 times.
|
168 | if (progressBar) { |
| 315 | ✗ | progressBar->setValue(m_startVersions.size()); | |
| 316 | } | ||
| 317 | |||
| 318 | 168 | model::OptionalModel result; | |
| 319 |
4/4✓ Branch 1 taken 168 times.
✓ Branch 4 taken 168 times.
✓ Branch 7 taken 168 times.
✓ Branch 10 taken 168 times.
|
168 | IdfFile finalModel = m_map[VersionString(openStudioVersion())]; |
| 320 |
8/8✓ Branch 1 taken 168 times.
✓ Branch 4 taken 168 times.
✓ Branch 7 taken 168 times.
✓ Branch 10 taken 168 times.
✓ Branch 13 taken 168 times.
✓ Branch 16 taken 168 times.
✓ Branch 19 taken 168 times.
✓ Branch 22 taken 168 times.
|
168 | LOG(Debug, "Final model has " << finalModel.numObjects() << " objects in IDF form."); |
| 321 |
1/1✓ Branch 1 taken 168 times.
|
168 | m_nObjectsFinalIdf = finalModel.numObjects(); |
| 322 |
3/3✓ Branch 1 taken 168 times.
✓ Branch 5 taken 168 times.
✓ Branch 9 taken 168 times.
|
168 | int numExpectedObjects = m_nObjectsStart + newObjects().size() - deprecatedObjects().size() - untranslatedObjects().size(); |
| 323 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 168 times.
|
168 | if (m_nObjectsFinalIdf != numExpectedObjects) { |
| 324 | ✗ | LOG(Warn, "Expected final translated model to have " << numExpectedObjects << ", but it actually has " << m_nObjectsFinalIdf << " objects."); | |
| 325 | ✗ | if ((m_nObjectsStart > 0) && (m_nObjectsFinalIdf == 0)) { | |
| 326 | ✗ | LOG(Error, "Original model contained " << m_nObjectsStart << ", but final translated model is empty."); | |
| 327 | ✗ | return boost::none; | |
| 328 | } | ||
| 329 | ✗ | numExpectedObjects = m_nObjectsFinalIdf; | |
| 330 | } | ||
| 331 | |||
| 332 | // validity checking | ||
| 333 |
2/2✓ Branch 1 taken 168 times.
✓ Branch 4 taken 168 times.
|
168 | Workspace finalWorkspace(finalModel); |
| 334 |
1/1✓ Branch 1 taken 168 times.
|
168 | model::Model tempModel(finalWorkspace); // None-level strictness! |
| 335 |
3/5✓ Branch 1 taken 168 times.
✓ Branch 4 taken 168 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 168 times.
✗ Branch 10 not taken.
|
168 | OS_ASSERT(tempModel.strictnessLevel() == StrictnessLevel::Minimal); |
| 336 |
1/1✓ Branch 1 taken 168 times.
|
168 | std::vector<std::shared_ptr<InterobjectIssueInformation>> issueInfo = fixInterobjectIssuesStage1(tempModel, m_originalVersion); |
| 337 |
3/4✓ Branch 1 taken 168 times.
✓ Branch 4 taken 168 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 168 times.
|
168 | if (!tempModel.isValid(StrictnessLevel::Draft)) { |
| 338 | ✗ | LOG(Error, "Model with Version " << openStudioVersion() << " IDD is not valid to draft " << "strictness level."); | |
| 339 | ✗ | LOG(Error, tempModel.validityReport(StrictnessLevel::Draft)); | |
| 340 | ✗ | return boost::none; | |
| 341 | } | ||
| 342 |
2/2✓ Branch 1 taken 168 times.
✓ Branch 4 taken 168 times.
|
168 | bool test = tempModel.setStrictnessLevel(StrictnessLevel::Draft); |
| 343 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 168 times.
✗ Branch 3 not taken.
|
168 | OS_ASSERT(test); |
| 344 |
1/1✓ Branch 1 taken 168 times.
|
168 | fixInterobjectIssuesStage2(tempModel, issueInfo); |
| 345 | |||
| 346 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 164 times.
|
168 | if (isComponent) { |
| 347 | try { | ||
| 348 |
3/3✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
|
4 | result = model::Component(tempModel.toIdfFile()); // includes name conflict fixes |
| 349 | ✗ | } catch (std::exception& e) { | |
| 350 | ✗ | LOG(Error, "Could not translate component, because " << e.what()); | |
| 351 | ✗ | } | |
| 352 | } else { | ||
| 353 |
3/3✓ Branch 1 taken 164 times.
✓ Branch 4 taken 164 times.
✓ Branch 7 taken 164 times.
|
164 | result = model::Model(tempModel.toIdfFile()); // includes name conflict fixes |
| 354 | } | ||
| 355 | |||
| 356 |
1/2✓ Branch 0 taken 168 times.
✗ Branch 1 not taken.
|
168 | if (result) { |
| 357 |
2/2✓ Branch 1 taken 168 times.
✓ Branch 4 taken 168 times.
|
168 | m_nObjectsFinalModel = result->numObjects(); |
| 358 |
7/7✓ Branch 1 taken 168 times.
✓ Branch 4 taken 168 times.
✓ Branch 7 taken 168 times.
✓ Branch 10 taken 168 times.
✓ Branch 13 taken 168 times.
✓ Branch 16 taken 168 times.
✓ Branch 19 taken 168 times.
|
168 | LOG(Debug, "Final model has " << m_nObjectsFinalModel << " objects in Model form."); |
| 359 |
3/4✓ Branch 0 taken 164 times.
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 164 times.
|
168 | if ((m_nObjectsStart > 0) && (m_nObjectsFinalModel == 0)) { |
| 360 | ✗ | LOG(Error, "Original model contained " << m_nObjectsStart << ", but final translated model is empty."); | |
| 361 | ✗ | return boost::none; | |
| 362 | } | ||
| 363 | } | ||
| 364 |
1/1✓ Branch 1 taken 168 times.
|
168 | return result; |
| 365 | 168 | } | |
| 366 | |||
| 367 | 178 | void VersionTranslator::initializeMap(std::istream& is) { | |
| 368 | // default version is 0.7.0 | ||
| 369 |
2/2✓ Branch 1 taken 178 times.
✓ Branch 4 taken 178 times.
|
178 | VersionString currentVersion("0.7.0"); |
| 370 | |||
| 371 | // load with current IDD and extract version | ||
| 372 |
3/3✓ Branch 1 taken 178 times.
✓ Branch 3 taken 176 times.
✓ Branch 4 taken 2 times.
|
356 | if (boost::optional<VersionString> candidate = IdfFile::loadVersionOnly(is)) { |
| 373 |
2/2✓ Branch 1 taken 176 times.
✓ Branch 4 taken 176 times.
|
176 | currentVersion = *candidate; |
| 374 | 178 | } | |
| 375 | |||
| 376 | // we didn't bump Version Identifier in 3.3.0's idd OS:Version object, so the following is necessary | ||
| 377 |
5/5✓ Branch 1 taken 178 times.
✓ Branch 4 taken 178 times.
✓ Branch 7 taken 178 times.
✓ Branch 11 taken 1 time.
✓ Branch 12 taken 177 times.
|
356 | if (currentVersion == VersionString("3.2.2")) { |
| 378 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | currentVersion = VersionString("3.3.0"); |
| 379 | } | ||
| 380 | |||
| 381 |
1/1✓ Branch 1 taken 178 times.
|
178 | m_originalVersion = currentVersion; // save for user |
| 382 |
1/1✓ Branch 2 taken 178 times.
|
178 | is.seekg(std::ios_base::beg); // prep to re-read file |
| 383 | |||
| 384 | // bracket allowable versions | ||
| 385 |
8/8✓ Branch 1 taken 178 times.
✓ Branch 4 taken 178 times.
✓ Branch 7 taken 178 times.
✓ Branch 10 taken 178 times.
✓ Branch 13 taken 178 times.
✓ Branch 17 taken 178 times.
✓ Branch 20 taken 178 times.
✓ Branch 23 taken 178 times.
|
178 | LOG(Debug, "Starting translation from Version " << currentVersion.str() << "."); |
| 386 |
4/5✓ Branch 1 taken 178 times.
✓ Branch 4 taken 178 times.
✓ Branch 7 taken 178 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 178 times.
|
356 | if (currentVersion < VersionString("0.7.0")) { |
| 387 | ✗ | LOG(Error, "Version translation is not provided for OpenStudio models created prior to " << "Version 0.7.0."); | |
| 388 | ✗ | return; | |
| 389 | } | ||
| 390 |
5/5✓ Branch 1 taken 178 times.
✓ Branch 4 taken 178 times.
✓ Branch 7 taken 178 times.
✓ Branch 11 taken 12 times.
✓ Branch 12 taken 166 times.
|
178 | if (currentVersion > VersionString(openStudioVersion())) { |
| 391 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 6 times.
|
12 | if (m_allowNewerVersions) { |
| 392 | // if currentVersion is just one ahead, may be a developer using the cloud. | ||
| 393 | // let it pass as if currentVersion == openStudioVersion(), with a warning | ||
| 394 |
5/5✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
✓ Branch 11 taken 3 times.
✓ Branch 12 taken 3 times.
|
6 | if (VersionString(openStudioVersion()).isNextVersion(currentVersion)) { |
| 395 |
13/13✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 10 taken 3 times.
✓ Branch 13 taken 3 times.
✓ Branch 16 taken 3 times.
✓ Branch 19 taken 3 times.
✓ Branch 22 taken 3 times.
✓ Branch 25 taken 3 times.
✓ Branch 28 taken 3 times.
✓ Branch 33 taken 3 times.
✓ Branch 36 taken 3 times.
✓ Branch 39 taken 3 times.
|
3 | LOG(Warn, "Version extracted from file '" << currentVersion.str() << "' is one " << "increment ahead of OpenStudio Version " |
| 396 | << openStudioVersion() << ". " | ||
| 397 | << "Proceeding as if these versions are the same. Use with caution."); | ||
| 398 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | currentVersion = VersionString(openStudioVersion()); |
| 399 | } else { | ||
| 400 | // if currentVersion is farther ahead, log error and return nothing | ||
| 401 |
11/11✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 10 taken 3 times.
✓ Branch 13 taken 3 times.
✓ Branch 16 taken 3 times.
✓ Branch 19 taken 3 times.
✓ Branch 22 taken 3 times.
✓ Branch 27 taken 3 times.
✓ Branch 30 taken 3 times.
✓ Branch 33 taken 3 times.
|
3 | LOG(Error, "Version extracted from file '" << currentVersion.str() << "' is not supported by OpenStudio Version " << openStudioVersion() |
| 402 | << ". Please check https://www.openstudio.net for updates."); | ||
| 403 | 3 | return; | |
| 404 | } | ||
| 405 | } else { | ||
| 406 | // log error and return nothing | ||
| 407 |
11/11✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
✓ Branch 10 taken 6 times.
✓ Branch 13 taken 6 times.
✓ Branch 16 taken 6 times.
✓ Branch 19 taken 6 times.
✓ Branch 22 taken 6 times.
✓ Branch 27 taken 6 times.
✓ Branch 30 taken 6 times.
✓ Branch 33 taken 6 times.
|
6 | LOG(Error, "Version extracted from file '" << currentVersion.str() << "' is newer than current OpenStudio Version " << openStudioVersion() |
| 408 | << ". Please check https://www.openstudio.net for updates."); | ||
| 409 | 6 | return; | |
| 410 | } | ||
| 411 | } | ||
| 412 | |||
| 413 | // load IdfFile with correct IddFile and save | ||
| 414 | 169 | OptionalIdfFile oIdfFile; | |
| 415 |
1/1✓ Branch 1 taken 169 times.
|
169 | IddFileAndFactoryWrapper iddFile = getIddFile(currentVersion); |
| 416 |
4/4✓ Branch 1 taken 169 times.
✓ Branch 4 taken 169 times.
✓ Branch 7 taken 150 times.
✓ Branch 8 taken 19 times.
|
169 | if (iddFile.iddFileType() == IddFileType::UserCustom) { |
| 417 |
2/2✓ Branch 1 taken 150 times.
✓ Branch 4 taken 150 times.
|
150 | oIdfFile = IdfFile::load(is, iddFile.iddFile()); |
| 418 |
3/4✓ Branch 1 taken 150 times.
✓ Branch 4 taken 150 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 150 times.
|
150 | if (currentVersion == VersionString(1, 9, 0)) { |
| 419 | ✗ | if (oIdfFile) { | |
| 420 | ✗ | auto sizingObjects = oIdfFile->getObjectsByType(iddFile.getObject("OS:Sizing:Zone").get()); | |
| 421 | |||
| 422 | // Figure out if the OS:Sizing:Zone object looks like it is from CBECC | ||
| 423 | // it will have extra fields that would were not in the "real" 1.9.0 IDD | ||
| 424 | ✗ | bool fromCBECC = false; | |
| 425 | ✗ | for (auto const& object : sizingObjects) { | |
| 426 | ✗ | if (auto value = object.getString(2)) { | |
| 427 | ✗ | if (istringEqual("SupplyAirTemperature", value.get()) || istringEqual("TemperatureDifference", value.get())) { | |
| 428 | ✗ | fromCBECC = true; | |
| 429 | ✗ | break; | |
| 430 | } | ||
| 431 | ✗ | } | |
| 432 | } | ||
| 433 | |||
| 434 | ✗ | if (fromCBECC) { | |
| 435 | // Remove the sizing objects so that the translation will proceed smoothly | ||
| 436 | ✗ | oIdfFile->removeObjects(sizingObjects); | |
| 437 | |||
| 438 | // Get a special CBECC idd file, | ||
| 439 | // load the idf file again against that idd, | ||
| 440 | // get the sizing objects and save them for later, | ||
| 441 | // we will reintrodce the sizing objects in the version 1.10.2 phase of the translation | ||
| 442 | // when they were officially part of OS | ||
| 443 | ✗ | auto cbeccIddFile = get_1_9_0_CBECC_IddFile(); | |
| 444 | |||
| 445 | ✗ | is.seekg(0, std::ios::beg); | |
| 446 | ✗ | auto cbeccIdfFile = IdfFile::load(is, cbeccIddFile); | |
| 447 | ✗ | OS_ASSERT(cbeccIdfFile); | |
| 448 | ✗ | m_cbeccSizingObjects = cbeccIdfFile->getObjectsByType(cbeccIddFile.getObject("OS:Sizing:Zone").get()); | |
| 449 | ✗ | } | |
| 450 | ✗ | } | |
| 451 | } | ||
| 452 | } else { | ||
| 453 |
2/2✓ Branch 1 taken 19 times.
✓ Branch 4 taken 19 times.
|
19 | oIdfFile = IdfFile::load(is, iddFile.iddFileType()); |
| 454 | } | ||
| 455 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 2 taken 168 times.
|
169 | if (!oIdfFile) { |
| 456 |
8/8✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
✓ Branch 17 taken 1 time.
✓ Branch 20 taken 1 time.
✓ Branch 23 taken 1 time.
|
1 | LOG(Error, "Unable to load Model with Version " << currentVersion.str() << " IDD."); |
| 457 | 1 | return; | |
| 458 | } | ||
| 459 | |||
| 460 |
2/2✓ Branch 1 taken 168 times.
✓ Branch 4 taken 168 times.
|
168 | IdfFile idfFile = *oIdfFile; |
| 461 |
1/1✓ Branch 1 taken 168 times.
|
168 | m_nObjectsStart = idfFile.numObjects(); |
| 462 | |||
| 463 | // DLM: would like to check validity here, can't due to bug with validity checking using custom idds | ||
| 464 | |||
| 465 |
2/2✓ Branch 1 taken 168 times.
✓ Branch 4 taken 168 times.
|
168 | m_map[currentVersion] = idfFile; |
| 466 |
8/8✓ Branch 1 taken 168 times.
✓ Branch 4 taken 168 times.
✓ Branch 7 taken 168 times.
✓ Branch 10 taken 168 times.
✓ Branch 13 taken 168 times.
✓ Branch 16 taken 168 times.
✓ Branch 19 taken 168 times.
✓ Branch 22 taken 168 times.
|
168 | LOG(Debug, "Initial model has " << idfFile.numObjects() << " objects."); |
| 467 | 180 | } | |
| 468 | |||
| 469 | 1925 | IddFileAndFactoryWrapper VersionTranslator::getIddFile(const VersionString& version) { | |
| 470 |
2/2✓ Branch 1 taken 1925 times.
✓ Branch 4 taken 1925 times.
|
1925 | IddFileAndFactoryWrapper result(IddFileType::OpenStudio); |
| 471 |
5/5✓ Branch 1 taken 1925 times.
✓ Branch 4 taken 1925 times.
✓ Branch 7 taken 1925 times.
✓ Branch 11 taken 1757 times.
✓ Branch 12 taken 168 times.
|
1925 | if (version < VersionString(openStudioVersion())) { |
| 472 |
3/3✓ Branch 1 taken 1757 times.
✓ Branch 4 taken 1757 times.
✓ Branch 7 taken 1757 times.
|
1757 | OptionalIddFile iddFile = IddFactory::instance().getIddFile(IddFileType::OpenStudio, version); |
| 473 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1757 times.
|
1757 | if (!iddFile) { |
| 474 | ✗ | LOG_AND_THROW("Unable to retrieve OpenStudio Version " << version.str() << " IDD from the IddFactory."); | |
| 475 | } | ||
| 476 |
2/2✓ Branch 1 taken 1757 times.
✓ Branch 4 taken 1757 times.
|
1757 | result = IddFileAndFactoryWrapper(*iddFile); |
| 477 | 1757 | } | |
| 478 | 1925 | return result; | |
| 479 | ✗ | } | |
| 480 | |||
| 481 | 27216 | void VersionTranslator::update(const VersionString& startVersion) { | |
| 482 |
1/1✓ Branch 1 taken 27216 times.
|
27216 | auto start = m_map.find(startVersion); |
| 483 |
2/2✓ Branch 2 taken 1756 times.
✓ Branch 3 taken 25460 times.
|
27216 | if (start != m_map.end()) { |
| 484 | |||
| 485 | 1756 | bool is_component_update_needed = false; // To avoid constantly comparing VersionString | |
| 486 | |||
| 487 | 1756 | std::string translatedIdf; | |
| 488 |
2/2✓ Branch 1 taken 1756 times.
✓ Branch 4 taken 1756 times.
|
1756 | VersionString lastVersion("0.0.0"); |
| 489 | 1756 | boost::optional<IddFileAndFactoryWrapper> oIddFile; | |
| 490 |
1/2✓ Branch 4 taken 81838 times.
✗ Branch 5 not taken.
|
81838 | for (auto it = m_updateMethods.begin(), itEnd = m_updateMethods.end(); it != itEnd; ++it) { |
| 491 | // make sure map iteration is behaving as expected | ||
| 492 |
2/4✓ Branch 2 taken 81838 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 81838 times.
✗ Branch 7 not taken.
|
81838 | OS_ASSERT(lastVersion < it->first); |
| 493 |
1/1✓ Branch 2 taken 81838 times.
|
81838 | lastVersion = it->first; |
| 494 |
3/3✓ Branch 2 taken 81838 times.
✓ Branch 4 taken 1756 times.
✓ Branch 5 taken 80082 times.
|
81838 | if (startVersion < it->first) { |
| 495 |
2/2✓ Branch 2 taken 1756 times.
✓ Branch 5 taken 1756 times.
|
1756 | oIddFile = getIddFile(it->first); |
| 496 |
2/2✓ Branch 2 taken 1756 times.
✓ Branch 6 taken 1756 times.
|
1756 | translatedIdf = it->second(this, start->second, *oIddFile); |
| 497 | 1756 | break; | |
| 498 | } | ||
| 499 | } | ||
| 500 | |||
| 501 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1756 times.
|
1756 | if (translatedIdf.empty()) { |
| 502 | ✗ | LOG(Error, "Unable to complete translation from " << startVersion.str() << " to " << lastVersion.str() | |
| 503 | << ". Unable to find and execute the appropriate update method."); | ||
| 504 | ✗ | return; | |
| 505 | } | ||
| 506 |
1/1✓ Branch 2 taken 1756 times.
|
1756 | std::stringstream ss(translatedIdf); |
| 507 | 1756 | OptionalIdfFile oIdfFile; | |
| 508 |
5/5✓ Branch 1 taken 1756 times.
✓ Branch 4 taken 1756 times.
✓ Branch 7 taken 1756 times.
✓ Branch 10 taken 1607 times.
✓ Branch 11 taken 149 times.
|
1756 | if (oIddFile->iddFileType() == IddFileType::UserCustom) { |
| 509 |
3/3✓ Branch 1 taken 1607 times.
✓ Branch 4 taken 1607 times.
✓ Branch 7 taken 1607 times.
|
1607 | oIdfFile = IdfFile::load(ss, oIddFile->iddFile()); |
| 510 | } else { | ||
| 511 |
3/3✓ Branch 1 taken 149 times.
✓ Branch 4 taken 149 times.
✓ Branch 7 taken 149 times.
|
149 | oIdfFile = IdfFile::load(ss, oIddFile->iddFileType()); |
| 512 | } | ||
| 513 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1756 times.
|
1756 | if (!oIdfFile) { |
| 514 | ✗ | LOG(Error, "Unable to complete translation from " << startVersion.str() << " to " << lastVersion.str() | |
| 515 | << ". Could not load translated IDF using the " | ||
| 516 | << "latter version's IddFile. Translated text: " << '\n' | ||
| 517 | << translatedIdf); | ||
| 518 | ✗ | return; | |
| 519 | } | ||
| 520 |
2/2✓ Branch 1 taken 1756 times.
✓ Branch 4 taken 1756 times.
|
1756 | IdfFile idfFile = *oIdfFile; |
| 521 |
11/14✓ Branch 0 taken 83 times.
✓ Branch 1 taken 1673 times.
✓ Branch 2 taken 83 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 83 times.
✓ Branch 8 taken 83 times.
✓ Branch 10 taken 80 times.
✓ Branch 11 taken 3 times.
✓ Branch 12 taken 83 times.
✓ Branch 13 taken 1673 times.
✓ Branch 15 taken 80 times.
✓ Branch 16 taken 1676 times.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
|
1756 | if (m_isComponent && (is_component_update_needed || (lastVersion > VersionString(0, 7, 4)))) { |
| 522 | 80 | is_component_update_needed = true; | |
| 523 |
1/1✓ Branch 1 taken 80 times.
|
80 | updateComponentData(idfFile); |
| 524 | } | ||
| 525 |
4/4✓ Branch 1 taken 1756 times.
✓ Branch 4 taken 1756 times.
✓ Branch 7 taken 1756 times.
✓ Branch 10 taken 1756 times.
|
1756 | m_map[oIdfFile->version()] = idfFile; |
| 526 |
12/12✓ Branch 1 taken 1756 times.
✓ Branch 4 taken 1756 times.
✓ Branch 7 taken 1756 times.
✓ Branch 10 taken 1756 times.
✓ Branch 13 taken 1756 times.
✓ Branch 16 taken 1756 times.
✓ Branch 19 taken 1756 times.
✓ Branch 22 taken 1756 times.
✓ Branch 25 taken 1756 times.
✓ Branch 29 taken 1756 times.
✓ Branch 32 taken 1756 times.
✓ Branch 35 taken 1756 times.
|
1756 | LOG(Debug, "Translation to " << lastVersion.str() << " model has " << oIdfFile->numObjects() << " objects."); |
| 527 | 1756 | } | |
| 528 | } | ||
| 529 | |||
| 530 | 80 | void VersionTranslator::updateComponentData(IdfFile& idfFile) { | |
| 531 |
4/5✓ Branch 1 taken 80 times.
✓ Branch 4 taken 80 times.
✓ Branch 7 taken 80 times.
✓ Branch 12 taken 80 times.
✗ Branch 13 not taken.
|
320 | if (OptionalIddObject oIddObject = idfFile.iddFile().getObject("OS:ComponentData")) { |
| 532 |
2/2✓ Branch 1 taken 80 times.
✓ Branch 4 taken 80 times.
|
80 | auto compDatas = idfFile.getObjectsByType(*oIddObject); |
| 533 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 80 times.
|
80 | if (compDatas.empty()) { |
| 534 | ✗ | return; | |
| 535 | } | ||
| 536 | |||
| 537 | 80 | std::set<std::string> newHandles; | |
| 538 |
5/5✓ Branch 1 taken 72 times.
✓ Branch 4 taken 72 times.
✓ Branch 7 taken 72 times.
✓ Branch 13 taken 80 times.
✓ Branch 18 taken 80 times.
|
152 | std::transform(m_new.cbegin(), m_new.cend(), std::inserter(newHandles, newHandles.begin()), [](const auto& n) { return n.getString(0).get(); }); |
| 539 | |||
| 540 | 80 | std::set<std::string> deletedHandles; | |
| 541 |
2/2✓ Branch 2 taken 80 times.
✓ Branch 7 taken 80 times.
|
80 | std::transform(m_untranslated.cbegin(), m_untranslated.cend(), std::inserter(deletedHandles, deletedHandles.begin()), |
| 542 | ✗ | [](const auto& n) { return n.getString(0).get(); }); | |
| 543 |
2/2✓ Branch 2 taken 80 times.
✓ Branch 7 taken 80 times.
|
80 | std::transform(m_deprecated.cbegin(), m_deprecated.cend(), std::inserter(deletedHandles, deletedHandles.begin()), |
| 544 |
3/3✓ Branch 1 taken 108 times.
✓ Branch 4 taken 108 times.
✓ Branch 7 taken 108 times.
|
108 | [](const auto& n) { return n.getString(0).get(); }); |
| 545 | |||
| 546 |
1/1✓ Branch 2 taken 80 times.
|
152 | std::erase_if(newHandles, [&deletedHandles](auto& s) { return deletedHandles.contains(s); }); |
| 547 | |||
| 548 | // There should really be only one ComponentData object anyways, it'll throw in the Component ctor later if not... | ||
| 549 |
2/2✓ Branch 5 taken 80 times.
✓ Branch 6 taken 80 times.
|
160 | for (auto& compData : compDatas) { |
| 550 | // We want to preserve the original order, so primary Object stays the same... so we don't use a set | ||
| 551 | 80 | std::vector<std::string> currentHandles; | |
| 552 |
1/1✓ Branch 1 taken 80 times.
|
80 | auto egs = compData.extensibleGroups(); |
| 553 |
5/5✓ Branch 1 taken 379 times.
✓ Branch 4 taken 379 times.
✓ Branch 7 taken 379 times.
✓ Branch 12 taken 80 times.
✓ Branch 17 taken 80 times.
|
459 | std::transform(egs.cbegin(), egs.cend(), std::back_inserter(currentHandles), [](const auto& eg) { return eg.getString(0).get(); }); |
| 554 | |||
| 555 |
1/1✓ Branch 2 taken 80 times.
|
459 | std::erase_if(currentHandles, [&deletedHandles](auto& s) { return deletedHandles.contains(s); }); |
| 556 | |||
| 557 |
1/1✓ Branch 3 taken 80 times.
|
80 | currentHandles.reserve(currentHandles.size() + newHandles.size()); |
| 558 | // m_new isn 't cleared between distinct version updates, so we can't bindly copy everything. | ||
| 559 |
4/4✓ Branch 1 taken 80 times.
✓ Branch 5 taken 80 times.
✓ Branch 9 taken 80 times.
✓ Branch 12 taken 80 times.
|
80 | std::copy_if( |
| 560 | std::make_move_iterator(newHandles.begin()), std::make_move_iterator(newHandles.end()), std::back_inserter(currentHandles), | ||
| 561 |
1/1✓ Branch 4 taken 72 times.
|
72 | [¤tHandles](const auto& elem) { return std::find(currentHandles.begin(), currentHandles.end(), elem) == currentHandles.end(); }); |
| 562 | |||
| 563 |
1/1✓ Branch 1 taken 80 times.
|
80 | compData.clearExtensibleGroups(); |
| 564 |
2/2✓ Branch 4 taken 387 times.
✓ Branch 5 taken 80 times.
|
467 | for (auto& handle : currentHandles) { |
| 565 |
4/6✓ Branch 1 taken 387 times.
✓ Branch 4 taken 387 times.
✓ Branch 8 taken 387 times.
✓ Branch 9 taken 387 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
|
1161 | compData.pushExtensibleGroup({handle}); |
| 566 | } | ||
| 567 | 80 | } | |
| 568 | 160 | } | |
| 569 | 387 | } | |
| 570 | |||
| 571 | ✗ | std::string VersionTranslator::defaultUpdate(const IdfFile& idf, const IddFileAndFactoryWrapper& targetIdd) { | |
| 572 | // use for version increments with no IDD changes | ||
| 573 | ✗ | std::stringstream ss; | |
| 574 | |||
| 575 | ✗ | ss << idf.header() << '\n' << '\n'; | |
| 576 | |||
| 577 | // new version object | ||
| 578 | ✗ | IdfFile targetIdf(targetIdd.iddFile()); | |
| 579 | ✗ | ss << targetIdf.versionObject().get(); | |
| 580 | |||
| 581 | // all other objects | ||
| 582 | ✗ | for (const IdfObject& object : idf.objects()) { | |
| 583 | ✗ | ss << object; | |
| 584 | ✗ | } | |
| 585 | |||
| 586 | ✗ | return ss.str(); | |
| 587 | ✗ | } | |
| 588 | |||
| 589 | 1 | std::string VersionTranslator::update_0_7_1_to_0_7_2(const IdfFile& idf_0_7_1, const IddFileAndFactoryWrapper& idd_0_7_2) { | |
| 590 | // Url field refinements | ||
| 591 |
1/1✓ Branch 1 taken 1 time.
|
1 | std::stringstream ss; |
| 592 | |||
| 593 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
|
1 | ss << idf_0_7_1.header() << '\n' << '\n'; |
| 594 | |||
| 595 | // new version object | ||
| 596 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfFile targetIdf(idd_0_7_2.iddFile()); |
| 597 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | ss << targetIdf.versionObject().get(); |
| 598 | |||
| 599 | // all other objects | ||
| 600 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 8 taken 4 times.
✓ Branch 9 taken 1 time.
|
5 | for (const IdfObject& object : idf_0_7_1.objects()) { |
| 601 |
1/1✓ Branch 1 taken 4 times.
|
4 | IdfObject toPrint = object; |
| 602 |
4/5✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 4 times.
|
4 | if (object.iddObject().name() == "OS:WeatherFile") { |
| 603 | ✗ | toPrint = updateUrlField_0_7_1_to_0_7_2(object, 9); | |
| 604 |
4/5✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 4 times.
|
4 | } else if (object.iddObject().name() == "OS:Construction:WindowDataFile") { |
| 605 | ✗ | toPrint = updateUrlField_0_7_1_to_0_7_2(object, 1); | |
| 606 |
4/5✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 4 times.
|
4 | } else if (object.iddObject().name() == "OS:Luminaire:Definition") { |
| 607 | ✗ | toPrint = updateUrlField_0_7_1_to_0_7_2(object, 1); | |
| 608 | } | ||
| 609 | |||
| 610 |
1/1✓ Branch 1 taken 4 times.
|
4 | ss << toPrint; |
| 611 | 5 | } | |
| 612 | |||
| 613 |
1/1✓ Branch 1 taken 1 time.
|
2 | return ss.str(); |
| 614 | 1 | } | |
| 615 | |||
| 616 | ✗ | IdfObject VersionTranslator::updateUrlField_0_7_1_to_0_7_2(const IdfObject& object, unsigned index) { | |
| 617 | ✗ | IdfObject result = object; | |
| 618 | ✗ | if (OptionalString os = object.getString(index)) { | |
| 619 | ✗ | std::string original = *os; | |
| 620 | ✗ | if (!original.empty()) { | |
| 621 | ✗ | std::string transformed = toString(toPath(original)); | |
| 622 | ✗ | if (!transformed.empty()) { | |
| 623 | ✗ | IdfObject objCopy = object.clone(); | |
| 624 | ✗ | bool ok = objCopy.setString(index, transformed); | |
| 625 | ✗ | OS_ASSERT(ok); | |
| 626 | ✗ | result = objCopy; | |
| 627 | ✗ | } else { | |
| 628 | ✗ | LOG(Warn, "Tried to update the file path '" << original << "' to the new format, " << "but was unsuccessful."); | |
| 629 | } | ||
| 630 | ✗ | } | |
| 631 | ✗ | } | |
| 632 | ✗ | return result; | |
| 633 | ✗ | } | |
| 634 | |||
| 635 | 1 | std::string VersionTranslator::update_0_7_2_to_0_7_3(const IdfFile& idf_0_7_2, const IddFileAndFactoryWrapper& idd_0_7_3) { | |
| 636 | // use for version increments with no IDD changes | ||
| 637 |
1/1✓ Branch 1 taken 1 time.
|
1 | std::stringstream ss; |
| 638 | |||
| 639 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
|
1 | ss << idf_0_7_2.header() << '\n' << '\n'; |
| 640 | |||
| 641 | // new version object | ||
| 642 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfFile targetIdf(idd_0_7_3.iddFile()); |
| 643 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | ss << targetIdf.versionObject().get(); |
| 644 | |||
| 645 | // all other objects | ||
| 646 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 8 taken 4 times.
✓ Branch 9 taken 1 time.
|
5 | for (const IdfObject& object : idf_0_7_2.objects()) { |
| 647 |
5/6✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✓ Branch 10 taken 4 times.
✗ Branch 15 not taken.
✓ Branch 16 taken 4 times.
|
8 | if (istringEqual(object.iddObject().name(), "OS:PlantLoop")) { |
| 648 | // ETH@20120514 Kyle - Please refine/completely rework this as appropriate. | ||
| 649 | ✗ | LOG(Warn, "This model contains an out-of-date " << object.iddObject().name() << " object. " | |
| 650 | << "In particular, it needs a bypass branch added in order to run properly in EnergyPlus."); | ||
| 651 | } | ||
| 652 |
1/1✓ Branch 1 taken 4 times.
|
4 | ss << object; |
| 653 | 1 | } | |
| 654 | |||
| 655 |
1/1✓ Branch 1 taken 1 time.
|
2 | return ss.str(); |
| 656 | 1 | } | |
| 657 | |||
| 658 | 1 | std::string VersionTranslator::update_0_7_3_to_0_7_4(const IdfFile& idf_0_7_3, const IddFileAndFactoryWrapper& idd_0_7_4) { | |
| 659 |
1/1✓ Branch 1 taken 1 time.
|
1 | std::stringstream ss; |
| 660 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
|
1 | IddObject componentDataIdd = idd_0_7_4.getObject("OS:ComponentData").get(); |
| 661 |
1/1✓ Branch 1 taken 1 time.
|
1 | IdfObject componentDataIdf(componentDataIdd); |
| 662 |
1/1✓ Branch 1 taken 1 time.
|
1 | int fs = IdfObject::printedFieldSpace(); |
| 663 | |||
| 664 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
|
1 | ss << idf_0_7_3.header() << '\n' << '\n'; |
| 665 | |||
| 666 | // new version object | ||
| 667 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfFile targetIdf(idd_0_7_4.iddFile()); |
| 668 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | ss << targetIdf.versionObject().get(); |
| 669 | |||
| 670 | // all other objects | ||
| 671 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 8 taken 4 times.
✓ Branch 9 taken 1 time.
|
5 | for (IdfObject& object : idf_0_7_3.objects()) { |
| 672 |
6/6✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✓ Branch 10 taken 4 times.
✓ Branch 15 taken 1 time.
✓ Branch 16 taken 3 times.
|
8 | if (istringEqual(object.iddObject().name(), "OS:ComponentData:Tags")) { |
| 673 |
1/1✓ Branch 1 taken 1 time.
|
1 | m_deprecated.push_back(object); |
| 674 | 2 | continue; | |
| 675 | } | ||
| 676 |
6/6✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 10 taken 3 times.
✓ Branch 15 taken 1 time.
✓ Branch 16 taken 2 times.
|
6 | if (istringEqual(object.iddObject().name(), "OS:ComponentData:Attributes")) { |
| 677 |
1/1✓ Branch 1 taken 1 time.
|
1 | m_deprecated.push_back(object); |
| 678 | 1 | continue; | |
| 679 | } | ||
| 680 | |||
| 681 |
1/1✓ Branch 1 taken 2 times.
|
2 | std::stringstream objectSS; |
| 682 |
1/1✓ Branch 1 taken 2 times.
|
2 | object.printName(objectSS); |
| 683 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | std::string handleStr = toString(object.handle()); |
| 684 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | objectSS << " " << handleStr; |
| 685 |
2/3✓ Branch 1 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
|
2 | if (object.numFields() == 0) { |
| 686 | ✗ | objectSS << ";"; | |
| 687 | } else { | ||
| 688 |
1/1✓ Branch 1 taken 2 times.
|
2 | objectSS << ","; |
| 689 | } | ||
| 690 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
|
2 | for (int cnt = handleStr.size(); cnt < fs; ++cnt) { |
| 691 | ✗ | objectSS << " "; | |
| 692 | } | ||
| 693 |
4/4✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
|
2 | objectSS << " " << componentDataIdf.fieldComment(0, true) << '\n'; |
| 694 | |||
| 695 |
6/6✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
✓ Branch 15 taken 1 time.
✓ Branch 16 taken 1 time.
|
4 | if (istringEqual(object.iddObject().name(), "OS:ComponentData")) { |
| 696 | // create new, refactored OS:ComponentData object from original data | ||
| 697 |
1/1✓ Branch 1 taken 1 time.
|
1 | componentDataIdf = IdfObject(componentDataIdd); |
| 698 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | componentDataIdf.setName(object.name().get()); |
| 699 | // uuid | ||
| 700 |
1/1✓ Branch 1 taken 1 time.
|
1 | OptionalString os = object.getString(1); |
| 701 |
1/2✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
|
1 | if (os) { |
| 702 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | componentDataIdf.setString(2, *os); |
| 703 | } else { | ||
| 704 | ✗ | LOG(Warn, | |
| 705 | "No value available for required " << object.iddObject().name() << " field " << object.iddObject().getField(1).get().name() << "."); | ||
| 706 | } | ||
| 707 | // version uuid | ||
| 708 |
1/1✓ Branch 1 taken 1 time.
|
1 | os = object.getString(2); |
| 709 |
1/2✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
|
1 | if (os) { |
| 710 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | componentDataIdf.setString(3, *os); |
| 711 | } else { | ||
| 712 | ✗ | LOG(Warn, | |
| 713 | "No value available for required " << object.iddObject().name() << " field " << object.iddObject().getField(2).get().name() << "."); | ||
| 714 | } | ||
| 715 | // creation timestamp - leave blank because unknown | ||
| 716 | // version timestamp - leave blank because unknown | ||
| 717 | // object list | ||
| 718 |
1/1✓ Branch 1 taken 1 time.
|
1 | StringVector handleForContents(1u); |
| 719 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 8 taken 1 time.
✓ Branch 9 taken 1 time.
|
2 | for (const IdfExtensibleGroup& eg : object.extensibleGroups()) { |
| 720 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | std::string typeStr = eg.getString(0).get(); |
| 721 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | typeStr = boost::regex_replace(typeStr, boost::regex("_"), ":"); |
| 722 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | std::string nameStr = eg.getString(1).get(); |
| 723 | 1 | OptionalIddObjectType objTyp; | |
| 724 | try { | ||
| 725 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | objTyp = IddObjectType(typeStr); |
| 726 | ✗ | } catch (...) { | |
| 727 | ✗ | } | |
| 728 | |||
| 729 | // find candidates and match | ||
| 730 | 1 | IdfObjectVector candidates; | |
| 731 | 1 | OptionalIdfObject match; | |
| 732 |
1/2✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
|
1 | if (!nameStr.empty()) { |
| 733 |
1/1✓ Branch 1 taken 1 time.
|
1 | candidates = idf_0_7_3.getObjectsByName(nameStr); |
| 734 | // narrow by object type | ||
| 735 | 1 | auto it(candidates.begin()); | |
| 736 |
2/2✓ Branch 2 taken 1 time.
✓ Branch 3 taken 1 time.
|
2 | while (it != candidates.end()) { |
| 737 | 1 | bool keep = true; | |
| 738 |
7/13✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 time.
✓ Branch 8 taken 1 time.
✓ Branch 11 taken 1 time.
✗ Branch 14 not taken.
✓ Branch 15 taken 1 time.
✓ Branch 16 taken 1 time.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✓ Branch 20 taken 1 time.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
|
2 | if (objTyp && (it->iddObject().type() != IddObjectType::UserCustom)) { |
| 739 | ✗ | if (it->iddObject().type() != *objTyp) { | |
| 740 | ✗ | keep = false; | |
| 741 | } | ||
| 742 |
4/5✓ Branch 2 taken 1 time.
✓ Branch 5 taken 1 time.
✓ Branch 8 taken 1 time.
✗ Branch 12 not taken.
✓ Branch 13 taken 1 time.
|
1 | } else if (!istringEqual(it->iddObject().name(), typeStr)) { |
| 743 | ✗ | keep = false; | |
| 744 | } | ||
| 745 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
|
1 | if (!keep) { |
| 746 | ✗ | it = candidates.erase(it); | |
| 747 | ✗ | continue; | |
| 748 | } | ||
| 749 | 1 | ++it; | |
| 750 | } | ||
| 751 |
1/2✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
|
1 | if (!candidates.empty()) { |
| 752 |
1/1✓ Branch 2 taken 1 time.
|
1 | match = candidates[0]; |
| 753 | } | ||
| 754 | } | ||
| 755 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
|
1 | if (!match) { |
| 756 | // object without a name--get by type, then check first field if non-empty nameStr. | ||
| 757 | ✗ | if (OptionalIddObject oIddObject = idf_0_7_3.iddFile().getObject(typeStr)) { | |
| 758 | ✗ | candidates = idf_0_7_3.getObjectsByType(*oIddObject); | |
| 759 | ✗ | } | |
| 760 | ✗ | auto it(candidates.begin()); | |
| 761 | ✗ | while (it != candidates.end()) { | |
| 762 | ✗ | bool keep = true; | |
| 763 | ✗ | if (!nameStr.empty()) { | |
| 764 | ✗ | if (!it->getString(0, true) || (!istringEqual(nameStr, it->getString(0, true).get()))) { | |
| 765 | ✗ | keep = false; | |
| 766 | } | ||
| 767 | } | ||
| 768 | ✗ | if (!keep) { | |
| 769 | ✗ | it = candidates.erase(it); | |
| 770 | ✗ | continue; | |
| 771 | } | ||
| 772 | ✗ | ++it; | |
| 773 | } | ||
| 774 | ✗ | if (!candidates.empty()) { | |
| 775 | ✗ | match = candidates[0]; | |
| 776 | } | ||
| 777 | ✗ | if (match && match->name()) { | |
| 778 | ✗ | LOG(Warn, "Found match for object in OS:ComponentData contents list by type only, even " << "though this type of object (" << typeStr | |
| 779 | << ") has a name field."); | ||
| 780 | } | ||
| 781 | } | ||
| 782 | |||
| 783 | // raise warnings and errors | ||
| 784 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
|
1 | if (!match) { |
| 785 | ✗ | if (eg.groupIndex() == 0u) { | |
| 786 | ✗ | LOG(Error, "Unable to locate primary object in contents list of " << '\n' | |
| 787 | << object | ||
| 788 | << " Will throw this OS:ComponentData object out of the model."); | ||
| 789 | ✗ | break; | |
| 790 | } else { | ||
| 791 | ✗ | LOG(Warn, "Unable to locate object in OS:ComponentData contents list called out " | |
| 792 | << "as object type '" << typeStr << "', and with name '" << nameStr | ||
| 793 | << "'. Skipping this object (that is, removing it from the Component " << "definition)."); | ||
| 794 | ✗ | continue; | |
| 795 | ✗ | } | |
| 796 | } | ||
| 797 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
|
1 | if (candidates.size() > 1u) { |
| 798 | ✗ | LOG(Warn, "Ambiguous match for object in OS:ComponentData contents list called out " | |
| 799 | << "as object type '" << typeStr << "', and with name '" << nameStr | ||
| 800 | << "'. Connecting translated OS:ComponentData object to first match."); | ||
| 801 | } | ||
| 802 | |||
| 803 | // add match to translated contents list | ||
| 804 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | handleForContents[0] = toString(match->handle()); |
| 805 |
1/1✓ Branch 1 taken 1 time.
|
1 | IdfExtensibleGroup reg = componentDataIdf.pushExtensibleGroup(handleForContents); |
| 806 |
2/4✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 time.
✗ Branch 6 not taken.
|
1 | OS_ASSERT(!reg.empty()); |
| 807 | 2 | } | |
| 808 | |||
| 809 |
2/3✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 time.
|
1 | if (componentDataIdf.numExtensibleGroups() == 0u) { |
| 810 | // totally invalid OS:ComponentData object. just don't include in translated file. | ||
| 811 | ✗ | m_untranslated.push_back(object); | |
| 812 | ✗ | continue; | |
| 813 | } | ||
| 814 | |||
| 815 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 6 times.
✓ Branch 4 taken 1 time.
|
7 | for (unsigned i = 1, n = componentDataIdf.numFields(); i < n; ++i) { |
| 816 |
2/2✓ Branch 0 taken 1 time.
✓ Branch 1 taken 5 times.
|
6 | if (i == n - 1) { |
| 817 |
1/1✓ Branch 1 taken 1 time.
|
1 | componentDataIdf.printField(objectSS, i, true); |
| 818 | } else { | ||
| 819 |
1/1✓ Branch 1 taken 5 times.
|
5 | componentDataIdf.printField(objectSS, i); |
| 820 | } | ||
| 821 | } | ||
| 822 |
1/1✓ Branch 1 taken 1 time.
|
1 | m_refactored.emplace_back(object, componentDataIdf); |
| 823 |
2/4✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 time.
✗ Branch 5 not taken.
|
1 | } else { |
| 824 | // modify the object if necessary | ||
| 825 |
5/6✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 time.
|
2 | if (istringEqual(object.iddObject().name(), "OS:Connection")) { |
| 826 | |||
| 827 | // increment inlet port as other object's fields have shifted | ||
| 828 | ✗ | boost::optional<int> portId = object.getInt(2); | |
| 829 | ✗ | if (portId) { | |
| 830 | ✗ | object.setInt(2, portId.get() + 1); | |
| 831 | } else { | ||
| 832 | ✗ | LOG(Warn, "OS:Connection object does not specify Inlet Port"); | |
| 833 | |||
| 834 | // remove the object? | ||
| 835 | //m_untranslated.push_back(object); | ||
| 836 | //continue; | ||
| 837 | } | ||
| 838 | |||
| 839 | // increment outlet port as other object's fields have shifted | ||
| 840 | ✗ | portId = object.getInt(4); | |
| 841 | ✗ | if (portId) { | |
| 842 | ✗ | object.setInt(4, portId.get() + 1); | |
| 843 | } else { | ||
| 844 | ✗ | LOG(Warn, "OS:Connection object does not specify Outlet Port"); | |
| 845 | |||
| 846 | // remove the object? | ||
| 847 | //m_untranslated.push_back(object); | ||
| 848 | //continue; | ||
| 849 | } | ||
| 850 | } | ||
| 851 | |||
| 852 | // loop over all the fields | ||
| 853 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 6 times.
✓ Branch 4 taken 1 time.
|
7 | for (unsigned i = 0, n = object.numFields(); i < n; ++i) { |
| 854 |
2/2✓ Branch 0 taken 1 time.
✓ Branch 1 taken 5 times.
|
6 | if (i == n - 1) { |
| 855 |
1/1✓ Branch 1 taken 1 time.
|
1 | object.printField(objectSS, i, true); |
| 856 | } else { | ||
| 857 |
1/1✓ Branch 1 taken 5 times.
|
5 | object.printField(objectSS, i); |
| 858 | } | ||
| 859 | } | ||
| 860 | } | ||
| 861 | |||
| 862 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | ss << objectSS.str(); |
| 863 | 3 | } | |
| 864 | |||
| 865 |
1/1✓ Branch 1 taken 1 time.
|
2 | return ss.str(); |
| 866 | 1 | } | |
| 867 | |||
| 868 | std::vector<std::shared_ptr<VersionTranslator::InterobjectIssueInformation>> | ||
| 869 | 168 | VersionTranslator::fixInterobjectIssuesStage1(model::Model& model, const VersionString& startVersion) { | |
| 870 |
3/5✓ Branch 1 taken 168 times.
✓ Branch 4 taken 168 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 168 times.
✗ Branch 10 not taken.
|
168 | OS_ASSERT(model.strictnessLevel() == StrictnessLevel::Minimal); |
| 871 | 168 | std::vector<std::shared_ptr<InterobjectIssueInformation>> result; | |
| 872 | |||
| 873 |
5/5✓ Branch 1 taken 168 times.
✓ Branch 4 taken 168 times.
✓ Branch 7 taken 168 times.
✓ Branch 11 taken 1 time.
✓ Branch 12 taken 167 times.
|
336 | if (startVersion < VersionString("0.8.4")) { |
| 874 |
1/1✓ Branch 1 taken 1 time.
|
1 | std::shared_ptr<InterobjectIssueInformation> info = fixInterobjectIssuesStage1_0_8_3_to_0_8_4(model); |
| 875 |
1/1✓ Branch 1 taken 1 time.
|
1 | result.push_back(info); |
| 876 | 1 | } | |
| 877 | |||
| 878 | 168 | return result; | |
| 879 | ✗ | } | |
| 880 | |||
| 881 | 168 | void VersionTranslator::fixInterobjectIssuesStage2(model::Model& model, | |
| 882 | std::vector<std::shared_ptr<InterobjectIssueInformation>>& stage1Information) { | ||
| 883 |
3/5✓ Branch 1 taken 168 times.
✓ Branch 4 taken 168 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 168 times.
✗ Branch 10 not taken.
|
168 | OS_ASSERT(model.strictnessLevel() == StrictnessLevel::Draft); |
| 884 | |||
| 885 |
2/2✓ Branch 5 taken 1 time.
✓ Branch 6 taken 168 times.
|
169 | for (std::shared_ptr<InterobjectIssueInformation>& info : stage1Information) { |
| 886 |
4/5✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 8 taken 1 time.
✓ Branch 12 taken 1 time.
✗ Branch 13 not taken.
|
2 | if (info->endVersion == VersionString("0.8.4")) { |
| 887 |
1/1✓ Branch 1 taken 1 time.
|
1 | fixInterobjectIssuesStage2_0_8_3_to_0_8_4(model, info); |
| 888 | } | ||
| 889 | } | ||
| 890 | 168 | } | |
| 891 | |||
| 892 | 1 | std::shared_ptr<VersionTranslator::InterobjectIssueInformation> VersionTranslator::fixInterobjectIssuesStage1_0_8_3_to_0_8_4(model::Model& model) { | |
| 893 | |||
| 894 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto result = std::make_shared<InterobjectIssueInformation_0_8_3_to_0_8_4>(); |
| 895 | |||
| 896 | // deal with component data | ||
| 897 |
1/1✓ Branch 1 taken 1 time.
|
1 | model::ComponentDataVector allComponentData = model.getConcreteModelObjects<model::ComponentData>(); |
| 898 | 1 | std::vector<IdfObject> allIdfComponentData; // make sure idf versions share data | |
| 899 | 1 | std::vector<model::ModelObjectVector> allComponentDataObjects; | |
| 900 |
2/2✓ Branch 4 taken 1 time.
✓ Branch 5 taken 1 time.
|
2 | for (const model::ComponentData& cd : allComponentData) { |
| 901 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | allComponentDataObjects.push_back(cd.componentObjects()); |
| 902 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | allIdfComponentData.push_back(cd.idfObject()); |
| 903 | } | ||
| 904 | 1 | std::set<int> found; | |
| 905 | // loop through all schedules | ||
| 906 |
1/1✓ Branch 1 taken 1 time.
|
1 | model::ScheduleVector schedules = model.getModelObjects<model::Schedule>(); |
| 907 |
1/2✗ Branch 5 not taken.
✓ Branch 6 taken 1 time.
|
1 | for (model::Schedule& schedule : schedules) { |
| 908 | // get users | ||
| 909 | ✗ | model::ModelObjectVector users = schedule.getModelObjectSources<model::ModelObject>(); | |
| 910 | ✗ | if (!users.empty()) { | |
| 911 | ✗ | if (!schedule.scheduleTypeLimits() || !schedule.isValid(StrictnessLevel::Draft)) { | |
| 912 | ✗ | LOG(Debug, "Adding Schedule '" << schedule.name().get() << "' to the list of schedules that need fix-up."); | |
| 913 | ✗ | result->schedules.push_back(schedule); | |
| 914 | ✗ | auto& thisUsers = result->users.emplace_back(std::move(users)); | |
| 915 | // keep separate track of component data objects | ||
| 916 | ✗ | auto& thisComponentDataObjects = result->componentDataObjects.emplace_back(); | |
| 917 | ✗ | IdfObjectVector thisSchedulesComponentData; | |
| 918 | ✗ | for (int i = 0, n = allComponentData.size(); i < n; ++i) { | |
| 919 | ✗ | model::ModelObjectVector objs = allComponentDataObjects[i]; | |
| 920 | ✗ | if (std::find(objs.begin(), objs.end(), schedule) != objs.end()) { | |
| 921 | ✗ | thisSchedulesComponentData.push_back(allIdfComponentData[i]); | |
| 922 | ✗ | found.insert(i); | |
| 923 | } | ||
| 924 | ✗ | } | |
| 925 | ✗ | for (IdfObject& cd : thisSchedulesComponentData) { | |
| 926 | ✗ | auto it = std::find_if(thisUsers.begin(), thisUsers.end(), | |
| 927 | ✗ | [&cd](const IdfObject& idfObject) { return handleEquals<IdfObject, Handle>(idfObject, cd.handle()); }); | |
| 928 | ✗ | if (it != thisUsers.end()) { | |
| 929 | ✗ | thisUsers.erase(it); | |
| 930 | } | ||
| 931 | ✗ | auto jit = std::find(allIdfComponentData.begin(), allIdfComponentData.end(), cd); | |
| 932 | ✗ | OS_ASSERT(jit != allIdfComponentData.end()); | |
| 933 | ✗ | thisComponentDataObjects.push_back(*jit); | |
| 934 | } | ||
| 935 | |||
| 936 | ✗ | std::vector<std::vector<unsigned>> thisSchedulesIndices; | |
| 937 | ✗ | std::vector<std::vector<model::ScheduleTypeKey>> thisSchedulesKeys; | |
| 938 | ✗ | auto it = thisUsers.begin(); | |
| 939 | ✗ | while (it != thisUsers.end()) { | |
| 940 | ✗ | UnsignedVector thisUsersIndices = it->getSourceIndices(schedule.handle()); | |
| 941 | ✗ | std::vector<model::ScheduleTypeKey> thisUsersKeys = it->getScheduleTypeKeys(schedule); | |
| 942 | |||
| 943 | ✗ | if (thisUsersKeys.empty()) { | |
| 944 | ✗ | it = thisUsers.erase(it); | |
| 945 | ✗ | continue; | |
| 946 | } | ||
| 947 | |||
| 948 | ✗ | OS_ASSERT(thisUsersIndices.size() == thisUsersKeys.size()); | |
| 949 | ✗ | for (unsigned index : thisUsersIndices) { | |
| 950 | ✗ | it->setString(index, ""); // clear for now--only change to be made at none strictness | |
| 951 | } | ||
| 952 | ✗ | thisSchedulesIndices.push_back(thisUsersIndices); | |
| 953 | ✗ | thisSchedulesKeys.push_back(thisUsersKeys); | |
| 954 | ✗ | if (std::find_if(result->originalUsers.begin(), result->originalUsers.end(), | |
| 955 | ✗ | [&it](const IdfObject& idfObject) { return handleEquals<IdfObject, Handle>(idfObject, it->handle()); }) | |
| 956 | ✗ | == result->originalUsers.end()) { | |
| 957 | ✗ | result->originalUsers.push_back(it->idfObject()); | |
| 958 | } | ||
| 959 | ✗ | ++it; | |
| 960 | ✗ | } | |
| 961 | ✗ | result->indices.push_back(thisSchedulesIndices); | |
| 962 | ✗ | result->keys.push_back(thisSchedulesKeys); | |
| 963 | ✗ | } | |
| 964 | } | ||
| 965 | ✗ | } | |
| 966 | |||
| 967 | // remove component data objects from model--replace in Stage 2 | ||
| 968 |
1/2✗ Branch 5 not taken.
✓ Branch 6 taken 1 time.
|
1 | for (int index : found) { |
| 969 | ✗ | m_untranslated.push_back(allIdfComponentData[index]); | |
| 970 | ✗ | if (allComponentData[index].initialized()) { | |
| 971 | ✗ | allComponentData[index].remove(); | |
| 972 | } | ||
| 973 | } | ||
| 974 | |||
| 975 | 2 | return result; | |
| 976 | 1 | } | |
| 977 | |||
| 978 | 1 | void VersionTranslator::fixInterobjectIssuesStage2_0_8_3_to_0_8_4(model::Model& model, std::shared_ptr<InterobjectIssueInformation>& info) { | |
| 979 | std::shared_ptr<InterobjectIssueInformation_0_8_3_to_0_8_4> schedulesToFixup = | ||
| 980 | 1 | std::dynamic_pointer_cast<InterobjectIssueInformation_0_8_3_to_0_8_4>(info); | |
| 981 | |||
| 982 | // make sure ScheduleDays are owned by their ScheduleRules and ScheduleRulesets | ||
| 983 |
1/1✓ Branch 1 taken 1 time.
|
1 | model::ScheduleDayVector daySchedules = model.getConcreteModelObjects<model::ScheduleDay>(); |
| 984 |
1/2✗ Branch 5 not taken.
✓ Branch 6 taken 1 time.
|
1 | for (model::ScheduleDay& daySchedule : daySchedules) { |
| 985 | ✗ | model::ScheduleRulesetVector rulesetUsers = daySchedule.getModelObjectSources<model::ScheduleRuleset>(); | |
| 986 | ✗ | model::ScheduleRuleVector ruleUsers = daySchedule.getModelObjectSources<model::ScheduleRule>(); | |
| 987 | ✗ | if (rulesetUsers.size() + ruleUsers.size() > 1u) { | |
| 988 | ✗ | model::OptionalModelObject primaryUser; | |
| 989 | ✗ | if (!rulesetUsers.empty()) { | |
| 990 | ✗ | primaryUser = rulesetUsers[0]; | |
| 991 | ✗ | for (unsigned i = 0, ni = rulesetUsers.size(); i < ni; ++i) { | |
| 992 | ✗ | UnsignedVector indices = rulesetUsers[i].getSourceIndices(daySchedule.handle()); | |
| 993 | ✗ | unsigned j = 0; | |
| 994 | ✗ | if (i == 0) { | |
| 995 | ✗ | j = 1; | |
| 996 | } | ||
| 997 | ✗ | for (unsigned nj = indices.size(); j < nj; ++j) { | |
| 998 | ✗ | model::ModelObject dayScheduleClone = daySchedule.clone(); | |
| 999 | ✗ | rulesetUsers[i].setPointer(indices[j], dayScheduleClone.handle()); | |
| 1000 | ✗ | } | |
| 1001 | ✗ | } | |
| 1002 | } | ||
| 1003 | ✗ | for (auto& ruleUser : ruleUsers) { | |
| 1004 | ✗ | UnsignedVector indices = ruleUser.getSourceIndices(daySchedule.handle()); | |
| 1005 | ✗ | unsigned j = 0; | |
| 1006 | ✗ | if (!primaryUser) { | |
| 1007 | ✗ | primaryUser = ruleUser; | |
| 1008 | ✗ | j = 1; | |
| 1009 | } | ||
| 1010 | ✗ | for (unsigned nj = indices.size(); j < nj; ++j) { | |
| 1011 | ✗ | model::ModelObject dayScheduleClone = daySchedule.clone(); | |
| 1012 | ✗ | ruleUser.setPointer(indices[j], dayScheduleClone.handle()); | |
| 1013 | ✗ | } | |
| 1014 | ✗ | } | |
| 1015 | ✗ | } | |
| 1016 | ✗ | } | |
| 1017 | |||
| 1018 | 1 | unsigned nSched = schedulesToFixup->schedules.size(); | |
| 1019 |
1/3✗ Branch 2 not taken.
✓ Branch 3 taken 1 time.
✗ Branch 5 not taken.
|
1 | OS_ASSERT(schedulesToFixup->users.size() == nSched); |
| 1020 |
1/3✗ Branch 2 not taken.
✓ Branch 3 taken 1 time.
✗ Branch 5 not taken.
|
1 | OS_ASSERT(schedulesToFixup->indices.size() == nSched); |
| 1021 |
1/3✗ Branch 2 not taken.
✓ Branch 3 taken 1 time.
✗ Branch 5 not taken.
|
1 | OS_ASSERT(schedulesToFixup->keys.size() == nSched); |
| 1022 |
1/3✗ Branch 2 not taken.
✓ Branch 3 taken 1 time.
✗ Branch 5 not taken.
|
1 | OS_ASSERT(schedulesToFixup->componentDataObjects.size() == nSched); |
| 1023 | |||
| 1024 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
|
1 | for (unsigned i = 0; i < nSched; ++i) { |
| 1025 | |||
| 1026 | // resolve schedule type limits | ||
| 1027 | ✗ | model::Schedule schedule = schedulesToFixup->schedules[i]; | |
| 1028 | ✗ | LOG(Debug, "Fixing up Schedule '" << schedule.name().get() << "'."); | |
| 1029 | ✗ | model::OptionalScheduleTypeLimits originalScheduleLimits = schedule.scheduleTypeLimits(); | |
| 1030 | ✗ | model::OptionalScheduleTypeLimits scheduleLimits(originalScheduleLimits); | |
| 1031 | ✗ | IdfObject originalSchedule = schedule.idfObject(); | |
| 1032 | ✗ | model::ScheduleVector candidates; // vector of clones | |
| 1033 | ✗ | bool okToModifySchedule(true); | |
| 1034 | |||
| 1035 | ✗ | unsigned nUsers = schedulesToFixup->users[i].size(); | |
| 1036 | ✗ | OS_ASSERT(schedulesToFixup->indices[i].size() == nUsers); | |
| 1037 | ✗ | OS_ASSERT(schedulesToFixup->keys[i].size() == nUsers); | |
| 1038 | |||
| 1039 | ✗ | for (unsigned j = 0; j < nUsers; ++j) { | |
| 1040 | ✗ | model::ModelObject user = schedulesToFixup->users[i][j]; | |
| 1041 | ✗ | UnsignedVector indices = schedulesToFixup->indices[i][j]; | |
| 1042 | ✗ | std::vector<model::ScheduleTypeKey> keys = schedulesToFixup->keys[i][j]; | |
| 1043 | |||
| 1044 | ✗ | OS_ASSERT(!keys.empty()); | |
| 1045 | |||
| 1046 | ✗ | unsigned n = keys.size(); | |
| 1047 | ✗ | OS_ASSERT(indices.size() == n); | |
| 1048 | ✗ | for (unsigned k = 0, n = keys.size(); k < n; ++k) { | |
| 1049 | ✗ | bool ok(false); | |
| 1050 | ✗ | if (scheduleLimits) { | |
| 1051 | ✗ | ok = isCompatible(keys[k].className(), keys[k].scheduleDisplayName(), *scheduleLimits); | |
| 1052 | } | ||
| 1053 | ✗ | if (ok) { | |
| 1054 | ✗ | ok = user.setPointer(indices[k], schedule.handle()); | |
| 1055 | ✗ | OS_ASSERT(ok); | |
| 1056 | ✗ | okToModifySchedule = false; | |
| 1057 | } else { | ||
| 1058 | ✗ | for (model::Schedule& candidate : candidates) { | |
| 1059 | ✗ | if (model::OptionalScheduleTypeLimits limits = candidate.scheduleTypeLimits()) { | |
| 1060 | ✗ | if (isCompatible(keys[k].className(), keys[k].scheduleDisplayName(), *limits)) { | |
| 1061 | ✗ | user.setPointer(indices[k], candidate.handle()); | |
| 1062 | ✗ | schedulesToFixup->refactoredUsers.insert(user); | |
| 1063 | ✗ | ok = true; | |
| 1064 | ✗ | break; | |
| 1065 | } | ||
| 1066 | ✗ | } | |
| 1067 | } | ||
| 1068 | } | ||
| 1069 | |||
| 1070 | ✗ | if (!ok) { | |
| 1071 | ✗ | unsigned modelN = model.numObjects(); | |
| 1072 | ✗ | if (okToModifySchedule) { | |
| 1073 | ✗ | if (scheduleLimits) { | |
| 1074 | ✗ | ok = schedule.resetScheduleTypeLimits(); | |
| 1075 | ✗ | OS_ASSERT(ok); // unhooked schedule in Stage 1 | |
| 1076 | } | ||
| 1077 | ✗ | ok = checkOrAssignScheduleTypeLimits(keys[k].className(), keys[k].scheduleDisplayName(), schedule); | |
| 1078 | ✗ | OS_ASSERT(ok); | |
| 1079 | ✗ | scheduleLimits = schedule.scheduleTypeLimits(); | |
| 1080 | ✗ | if (model.numObjects() > modelN) { | |
| 1081 | ✗ | m_new.push_back(schedule.scheduleTypeLimits().get().idfObject()); | |
| 1082 | } | ||
| 1083 | ✗ | okToModifySchedule = false; | |
| 1084 | ✗ | ok = user.setPointer(indices[k], schedule.handle()); | |
| 1085 | ✗ | OS_ASSERT(ok); | |
| 1086 | } else { | ||
| 1087 | ✗ | auto clonedSchedule = schedule.clone().cast<model::Schedule>(); | |
| 1088 | ✗ | ok = clonedSchedule.resetScheduleTypeLimits(); | |
| 1089 | ✗ | OS_ASSERT(ok); | |
| 1090 | ✗ | modelN = model.numObjects(); | |
| 1091 | ✗ | ok = checkOrAssignScheduleTypeLimits(keys[k].className(), keys[k].scheduleDisplayName(), clonedSchedule); | |
| 1092 | ✗ | OS_ASSERT(ok); | |
| 1093 | ✗ | if (model.numObjects() > modelN) { | |
| 1094 | ✗ | m_new.push_back(clonedSchedule.scheduleTypeLimits().get().idfObject()); | |
| 1095 | } | ||
| 1096 | ✗ | ok = user.setPointer(indices[k], clonedSchedule.handle()); | |
| 1097 | ✗ | candidates.push_back(clonedSchedule); | |
| 1098 | ✗ | } | |
| 1099 | } | ||
| 1100 | } // for keys | ||
| 1101 | ✗ | } // for users | |
| 1102 | ✗ | m_refactored.emplace_back(originalSchedule, schedule.idfObject()); | |
| 1103 | ✗ | for (const auto& candidate : candidates) { | |
| 1104 | ✗ | model::ModelObjectVector wholeCandidate = getRecursiveChildren(candidate); | |
| 1105 | ✗ | m_new.push_back(candidate.idfObject()); | |
| 1106 | ✗ | m_new.push_back(candidate.scheduleTypeLimits().get().idfObject()); | |
| 1107 | ✗ | for (unsigned k = 1, nc = wholeCandidate.size(); k < nc; ++k) { | |
| 1108 | ✗ | m_new.push_back(wholeCandidate[k].idfObject()); | |
| 1109 | } | ||
| 1110 | ✗ | } | |
| 1111 | // start to fix-up component data--add objects | ||
| 1112 | ✗ | std::set<model::ModelObject> usersSet(schedulesToFixup->users[i].begin(), schedulesToFixup->users[i].end()); | |
| 1113 | ✗ | for (IdfObject& cd : schedulesToFixup->componentDataObjects[i]) { | |
| 1114 | ✗ | LOG(Debug, "Adding ScheduleTypeLimits '" << scheduleLimits->name().get() << "' to component data list."); | |
| 1115 | ✗ | cd.pushExtensibleGroup(StringVector(1u, toString(scheduleLimits->handle()))); | |
| 1116 | ✗ | for (const auto& candidate : candidates) { | |
| 1117 | ✗ | model::ModelObjectVector wholeCandidate = getRecursiveChildren(candidate); | |
| 1118 | ✗ | LOG(Debug, "Adding Schedule '" << candidate.name().get() << "', its ScheduleTypeLimits, and all children to component data list."); | |
| 1119 | ✗ | cd.pushExtensibleGroup(StringVector(1u, toString(candidate.handle()))); | |
| 1120 | ✗ | cd.pushExtensibleGroup(StringVector(1u, toString(candidate.scheduleTypeLimits()->handle()))); | |
| 1121 | ✗ | for (unsigned k = 1, nc = wholeCandidate.size(); k < nc; ++k) { | |
| 1122 | ✗ | cd.pushExtensibleGroup(StringVector(1u, toString(wholeCandidate[k].handle()))); | |
| 1123 | } | ||
| 1124 | ✗ | } | |
| 1125 | } | ||
| 1126 | // remove original schedule type limits if now unused | ||
| 1127 | ✗ | if (originalScheduleLimits) { | |
| 1128 | ✗ | OS_ASSERT(*originalScheduleLimits != *scheduleLimits); | |
| 1129 | ✗ | if (originalScheduleLimits->sources().empty()) { | |
| 1130 | ✗ | m_untranslated.push_back(originalScheduleLimits->idfObject()); | |
| 1131 | ✗ | originalScheduleLimits->remove(); | |
| 1132 | } | ||
| 1133 | } | ||
| 1134 | ✗ | } // for schedules | |
| 1135 | |||
| 1136 | // clean up component data | ||
| 1137 | 1 | std::set<IdfObject, IdfObjectImplLess> uniqueComponentData; | |
| 1138 |
1/2✗ Branch 6 not taken.
✓ Branch 7 taken 1 time.
|
1 | for (const std::vector<IdfObject>& scheduleCD : schedulesToFixup->componentDataObjects) { |
| 1139 | ✗ | for (const IdfObject& cd : scheduleCD) { | |
| 1140 | ✗ | uniqueComponentData.insert(cd); | |
| 1141 | } | ||
| 1142 | } | ||
| 1143 |
1/1✓ Branch 3 taken 1 time.
|
1 | IdfObjectVector uniqueComponentDataVector(uniqueComponentData.begin(), uniqueComponentData.end()); |
| 1144 |
1/2✗ Branch 5 not taken.
✓ Branch 6 taken 1 time.
|
1 | for (IdfObject& cd : uniqueComponentDataVector) { |
| 1145 | // remove duplicates and objects not in model | ||
| 1146 | ✗ | model::ModelObjectVector componentObjects; | |
| 1147 | ✗ | unsigned i = 0; | |
| 1148 | ✗ | while (i < cd.numExtensibleGroups()) { | |
| 1149 | ✗ | Handle h = toUUID(*cd.getExtensibleGroup(i).getString(0)); | |
| 1150 | ✗ | if (std::find_if(componentObjects.begin(), componentObjects.end(), | |
| 1151 | ✗ | [&h](const model::ModelObject& mo) { return handleEquals<model::ModelObject, Handle>(mo, h); }) | |
| 1152 | ✗ | != componentObjects.end()) { | |
| 1153 | ✗ | cd.eraseExtensibleGroup(i); | |
| 1154 | ✗ | continue; | |
| 1155 | } | ||
| 1156 | ✗ | if (OptionalWorkspaceObject object = model.getObject(h)) { | |
| 1157 | ✗ | componentObjects.push_back(object->cast<model::ModelObject>()); | |
| 1158 | } else { | ||
| 1159 | ✗ | cd.eraseExtensibleGroup(i); | |
| 1160 | ✗ | continue; | |
| 1161 | ✗ | } | |
| 1162 | ✗ | ++i; | |
| 1163 | } | ||
| 1164 | |||
| 1165 | // remove schedules that have no users in the component | ||
| 1166 | ✗ | model::ModelObjectVector toRemove; | |
| 1167 | ✗ | std::sort(componentObjects.begin(), componentObjects.end(), IdfObjectImplLess()); | |
| 1168 | ✗ | for (unsigned i = 0, n = componentObjects.size(); i < n; ++i) { | |
| 1169 | ✗ | if (model::OptionalSchedule schedule = componentObjects[i].optionalCast<model::Schedule>()) { | |
| 1170 | ✗ | if (i == 0) { | |
| 1171 | ✗ | continue; | |
| 1172 | } | ||
| 1173 | ✗ | model::ModelObjectVector users = castVector<model::ModelObject>(schedule->sources()); | |
| 1174 | ✗ | std::sort(users.begin(), users.end(), IdfObjectImplLess()); | |
| 1175 | ✗ | model::ModelObjectVector children = model::getRecursiveChildren(*schedule); | |
| 1176 | ✗ | std::sort(children.begin(), children.end(), IdfObjectImplLess()); | |
| 1177 | ✗ | model::ModelObjectVector intersection(users.size(), componentObjects[0]); | |
| 1178 | ✗ | model::ModelObjectVector result(users.size(), componentObjects[0]); | |
| 1179 | // intersect users and componentObjects | ||
| 1180 | ✗ | auto intersectionEnd = std::set_intersection(users.begin(), users.end(), componentObjects.begin(), componentObjects.end(), | |
| 1181 | intersection.begin(), IdfObjectImplLess()); | ||
| 1182 | // subtract children from intersection | ||
| 1183 | auto resultEnd = | ||
| 1184 | ✗ | std::set_difference(intersection.begin(), intersectionEnd, children.begin(), children.end(), result.begin(), IdfObjectImplLess()); | |
| 1185 | ✗ | if (int(resultEnd - result.begin()) == 0) { | |
| 1186 | ✗ | toRemove.insert(toRemove.end(), children.begin(), children.end()); | |
| 1187 | } | ||
| 1188 | ✗ | } | |
| 1189 | } | ||
| 1190 | |||
| 1191 | ✗ | auto it = componentObjects.begin(); | |
| 1192 | ✗ | i = 0; | |
| 1193 | ✗ | while (it != componentObjects.end()) { | |
| 1194 | ✗ | if (std::find(toRemove.begin(), toRemove.end(), *it) != toRemove.end()) { | |
| 1195 | ✗ | cd.eraseExtensibleGroup(i); | |
| 1196 | ✗ | it = componentObjects.erase(it); | |
| 1197 | ✗ | continue; | |
| 1198 | } | ||
| 1199 | ✗ | ++it; | |
| 1200 | ✗ | ++i; | |
| 1201 | } | ||
| 1202 | |||
| 1203 | // remove schedule type limits that have no users in the component | ||
| 1204 | ✗ | it = componentObjects.begin(); | |
| 1205 | ✗ | i = 0; | |
| 1206 | ✗ | while (it != componentObjects.end()) { | |
| 1207 | ✗ | if (model::OptionalScheduleTypeLimits limits = it->optionalCast<model::ScheduleTypeLimits>()) { | |
| 1208 | ✗ | model::ModelObjectVector users = castVector<model::ModelObject>(limits->sources()); | |
| 1209 | ✗ | std::sort(users.begin(), users.end(), IdfObjectImplLess()); | |
| 1210 | ✗ | model::ModelObjectVector intersection(users.size(), componentObjects[0]); | |
| 1211 | ✗ | auto intersectionEnd = std::set_intersection(componentObjects.begin(), componentObjects.end(), users.begin(), users.end(), | |
| 1212 | intersection.begin(), IdfObjectImplLess()); | ||
| 1213 | ✗ | if (int(intersectionEnd - intersection.begin()) == 0) { | |
| 1214 | ✗ | cd.eraseExtensibleGroup(i); | |
| 1215 | ✗ | it = componentObjects.erase(it); | |
| 1216 | ✗ | continue; | |
| 1217 | } | ||
| 1218 | ✗ | } | |
| 1219 | ✗ | ++it; | |
| 1220 | ✗ | ++i; | |
| 1221 | } | ||
| 1222 | |||
| 1223 | // add component data back to model and mark as refactored | ||
| 1224 | ✗ | OptionalWorkspaceObject restoredComponentData = model.addObject(cd); | |
| 1225 | ✗ | OS_ASSERT(restoredComponentData); | |
| 1226 | ✗ | restoredComponentData->cast<model::ComponentData>().createVersionUUID(); | |
| 1227 | ✗ | m_new.push_back(restoredComponentData->idfObject()); | |
| 1228 | ✗ | } | |
| 1229 | |||
| 1230 | // populate m_refactored | ||
| 1231 |
1/1✓ Branch 5 taken 1 time.
|
1 | model::ModelObjectVector refactoredUsersVector(schedulesToFixup->refactoredUsers.begin(), schedulesToFixup->refactoredUsers.end()); |
| 1232 |
1/2✗ Branch 4 not taken.
✓ Branch 5 taken 1 time.
|
1 | for (model::ModelObject& user : refactoredUsersVector) { |
| 1233 | ✗ | auto it = std::find_if(schedulesToFixup->originalUsers.begin(), schedulesToFixup->originalUsers.end(), | |
| 1234 | ✗ | [&user](const IdfObject& idfObject) { return handleEquals<IdfObject, Handle>(idfObject, user.handle()); }); | |
| 1235 | ✗ | OS_ASSERT(it != schedulesToFixup->originalUsers.end()); | |
| 1236 | ✗ | m_refactored.emplace_back(*it, user.idfObject()); | |
| 1237 | } | ||
| 1238 | 1 | } | |
| 1239 | |||
| 1240 | 1 | std::string VersionTranslator::update_0_9_1_to_0_9_2(const IdfFile& idf_0_9_1, const IddFileAndFactoryWrapper& idd_0_9_2) { | |
| 1241 | // use for version increments with no IDD changes | ||
| 1242 |
1/1✓ Branch 1 taken 1 time.
|
1 | std::stringstream ss; |
| 1243 | |||
| 1244 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
|
1 | ss << idf_0_9_1.header() << '\n' << '\n'; |
| 1245 | |||
| 1246 | // new version object | ||
| 1247 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfFile targetIdf(idd_0_9_2.iddFile()); |
| 1248 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | ss << targetIdf.versionObject().get(); |
| 1249 | |||
| 1250 | // Fixup all thermal zone objects | ||
| 1251 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 8 taken 2 times.
✓ Branch 9 taken 1 time.
|
3 | for (const IdfObject& object : idf_0_9_1.objects()) { |
| 1252 |
4/5✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 2 times.
|
2 | if (object.iddObject().name() == "OS:ThermalZone") { |
| 1253 | ✗ | boost::optional<std::string> s; | |
| 1254 | |||
| 1255 | ✗ | IdfObject newInletPortList(idd_0_9_2.getObject("OS:PortList").get()); | |
| 1256 | ✗ | newInletPortList.setString(0, toString(createUUID())); | |
| 1257 | |||
| 1258 | ✗ | IdfObject newExhaustPortList(idd_0_9_2.getObject("OS:PortList").get()); | |
| 1259 | ✗ | newExhaustPortList.setString(0, toString(createUUID())); | |
| 1260 | |||
| 1261 | ✗ | IdfObject newZoneHVACEquipmentList(idd_0_9_2.getObject("OS:ZoneHVAC:EquipmentList").get()); | |
| 1262 | |||
| 1263 | ✗ | IdfObject newThermalZone(idd_0_9_2.getObject("OS:ThermalZone").get()); | |
| 1264 | |||
| 1265 | ✗ | boost::optional<IdfObject> fanPowerTerminal; | |
| 1266 | ✗ | boost::optional<IdfObject> newFPTSecondaryInletConn; | |
| 1267 | |||
| 1268 | ✗ | for (unsigned i = 0; i < object.numFields(); i++) { | |
| 1269 | ✗ | s = object.getString(i); | |
| 1270 | ✗ | if (s) { | |
| 1271 | ✗ | switch (i) { | |
| 1272 | ✗ | case 0: // Handle | |
| 1273 | { | ||
| 1274 | ✗ | newZoneHVACEquipmentList.setString(2, s.get()); | |
| 1275 | |||
| 1276 | ✗ | newThermalZone.setString(i, s.get()); | |
| 1277 | |||
| 1278 | ✗ | break; | |
| 1279 | } | ||
| 1280 | ✗ | case 9: // Inlet Port List | |
| 1281 | { | ||
| 1282 | ✗ | newThermalZone.setString(i, newInletPortList.getString(0).get()); | |
| 1283 | |||
| 1284 | ✗ | newInletPortList.setString(2, s.get()); | |
| 1285 | |||
| 1286 | // Find the connection object associated with the inlet port | ||
| 1287 | ✗ | std::vector<IdfObject> connections = idf_0_9_1.getObjectsByType(idf_0_9_1.iddFile().getObject("OS:Connection").get()); | |
| 1288 | ✗ | for (auto& connection : connections) { | |
| 1289 | ✗ | if (connection.getString(0).get() == s.get()) { | |
| 1290 | // Fixup the connection's target object and port | ||
| 1291 | ✗ | connection.setString(4, newInletPortList.getString(0).get()); | |
| 1292 | ✗ | connection.setUnsigned(5, 2); | |
| 1293 | |||
| 1294 | // Find the inlet model object to the connection - assume it is a node | ||
| 1295 | ✗ | if (boost::optional<std::string> sourceObject1Handle = connection.getString(2)) { | |
| 1296 | ✗ | std::vector<IdfObject> nodes = idf_0_9_1.getObjectsByType(idf_0_9_1.iddFile().getObject("OS:Node").get()); | |
| 1297 | ✗ | for (const auto& node : nodes) { | |
| 1298 | ✗ | if (sourceObject1Handle.get() == node.getString(0).get()) { | |
| 1299 | // Find the connection object associated with the inlet node | ||
| 1300 | ✗ | if (boost::optional<std::string> nodeInletConnectionHandle = node.getString(2)) { | |
| 1301 | ✗ | for (const auto& connection2 : connections) { | |
| 1302 | ✗ | if (nodeInletConnectionHandle.get() == connection2.getString(0).get()) { | |
| 1303 | // Find the inlet model object to connection2 | ||
| 1304 | ✗ | if (boost::optional<std::string> sourceObject2Handle = connection2.getString(2)) { | |
| 1305 | ✗ | std::vector<IdfObject> objects = idf_0_9_1.objects(); | |
| 1306 | ✗ | for (const auto& object2 : objects) { | |
| 1307 | ✗ | if (object2.getString(0).get() == sourceObject2Handle.get()) { | |
| 1308 | ✗ | if (object2.iddObject() != idf_0_9_1.iddFile().getObject("OS:AirLoopHVAC:ZoneSplitter").get()) { | |
| 1309 | // If there is zone equipment add it to the zone equipment list | ||
| 1310 | ✗ | newZoneHVACEquipmentList.setString(3, sourceObject2Handle.get()); | |
| 1311 | ✗ | newZoneHVACEquipmentList.setUnsigned(4, 1); | |
| 1312 | ✗ | newZoneHVACEquipmentList.setUnsigned(5, 1); | |
| 1313 | } | ||
| 1314 | |||
| 1315 | ✗ | if (object2.iddObject() | |
| 1316 | ✗ | == idf_0_9_1.iddFile().getObject("OS:AirTerminal:SingleDuct:ParallelPIU:Reheat").get()) { | |
| 1317 | ✗ | fanPowerTerminal = object2; | |
| 1318 | } | ||
| 1319 | |||
| 1320 | ✗ | break; | |
| 1321 | } | ||
| 1322 | } | ||
| 1323 | ✗ | } | |
| 1324 | ✗ | break; | |
| 1325 | } | ||
| 1326 | } | ||
| 1327 | ✗ | } | |
| 1328 | ✗ | break; | |
| 1329 | } | ||
| 1330 | } | ||
| 1331 | ✗ | } | |
| 1332 | ✗ | break; | |
| 1333 | } | ||
| 1334 | } | ||
| 1335 | |||
| 1336 | ✗ | break; | |
| 1337 | ✗ | } | |
| 1338 | ✗ | case 10: // Exhaust Port List | |
| 1339 | { | ||
| 1340 | ✗ | newThermalZone.setString(i, newExhaustPortList.getString(0).get()); | |
| 1341 | |||
| 1342 | // Find the connection object associated with the exhaust port | ||
| 1343 | ✗ | std::vector<IdfObject> connections = idf_0_9_1.getObjectsByType(idf_0_9_1.iddFile().getObject("OS:Connection").get()); | |
| 1344 | ✗ | for (auto& connection : connections) { | |
| 1345 | ✗ | if (connection.getString(0).get() == s.get()) { | |
| 1346 | // Find the target model object of the connection - assume it is a node | ||
| 1347 | ✗ | if (boost::optional<std::string> target1Handle = connection.getString(4)) { | |
| 1348 | ✗ | std::vector<IdfObject> nodes = idf_0_9_1.getObjectsByType(idf_0_9_1.iddFile().getObject("OS:Node").get()); | |
| 1349 | ✗ | for (auto& node : nodes) { | |
| 1350 | ✗ | if (target1Handle.get() == node.getString(0).get()) { | |
| 1351 | // Does the exhaust node have a outlet connection? | ||
| 1352 | ✗ | if (boost::optional<std::string> connection2Handle = node.getString(3)) { | |
| 1353 | ✗ | if (connection2Handle && !connection2Handle.get().empty()) { | |
| 1354 | // We fix up the connection to the thermal zone. | ||
| 1355 | // Now actually it is a connection to the port list. | ||
| 1356 | ✗ | newExhaustPortList.setString(2, s.get()); | |
| 1357 | ✗ | connection.setString(2, newExhaustPortList.getString(0).get()); | |
| 1358 | ✗ | connection.setUnsigned(3, 2); | |
| 1359 | } | ||
| 1360 | ✗ | } else if (fanPowerTerminal) { | |
| 1361 | ✗ | newExhaustPortList.setString(2, s.get()); | |
| 1362 | ✗ | connection.setString(2, newExhaustPortList.getString(0).get()); | |
| 1363 | ✗ | connection.setUnsigned(3, 2); | |
| 1364 | |||
| 1365 | ✗ | newFPTSecondaryInletConn = IdfObject(idd_0_9_2.getObject("OS:Connection").get()); | |
| 1366 | ✗ | newFPTSecondaryInletConn->setString(0, toString(createUUID())); | |
| 1367 | |||
| 1368 | ✗ | newFPTSecondaryInletConn->setString(2, node.getString(0).get()); | |
| 1369 | ✗ | newFPTSecondaryInletConn->setUnsigned(3, 3); | |
| 1370 | ✗ | newFPTSecondaryInletConn->setString(4, fanPowerTerminal->getString(0).get()); | |
| 1371 | ✗ | newFPTSecondaryInletConn->setUnsigned(5, 8); | |
| 1372 | |||
| 1373 | ✗ | node.setString(3, newFPTSecondaryInletConn->getString(0).get()); | |
| 1374 | ✗ | fanPowerTerminal->setString(8, newFPTSecondaryInletConn->getString(0).get()); | |
| 1375 | } else { | ||
| 1376 | // Exhaust nodes don't exist by default anymore. | ||
| 1377 | // They are only needed if there is zone equipment hooked up to them. | ||
| 1378 | // We break the connection to the thermal zone. | ||
| 1379 | ✗ | connection.setString(2, ""); | |
| 1380 | ✗ | connection.setString(3, ""); | |
| 1381 | ✗ | connection.setString(4, ""); | |
| 1382 | ✗ | connection.setString(5, ""); | |
| 1383 | |||
| 1384 | ✗ | node.setString(2, ""); | |
| 1385 | ✗ | node.setString(3, ""); | |
| 1386 | ✗ | } | |
| 1387 | ✗ | break; | |
| 1388 | } | ||
| 1389 | } | ||
| 1390 | ✗ | } | |
| 1391 | ✗ | break; | |
| 1392 | } | ||
| 1393 | } | ||
| 1394 | ✗ | break; | |
| 1395 | ✗ | } | |
| 1396 | ✗ | default: { | |
| 1397 | ✗ | newThermalZone.setString(i, s.get()); | |
| 1398 | ✗ | break; | |
| 1399 | } | ||
| 1400 | } | ||
| 1401 | } | ||
| 1402 | } | ||
| 1403 | |||
| 1404 | ✗ | ss << newThermalZone; | |
| 1405 | ✗ | ss << newInletPortList; | |
| 1406 | ✗ | ss << newExhaustPortList; | |
| 1407 | ✗ | ss << newZoneHVACEquipmentList; | |
| 1408 | |||
| 1409 | ✗ | m_new.push_back(newInletPortList); | |
| 1410 | ✗ | m_new.push_back(newExhaustPortList); | |
| 1411 | ✗ | m_new.push_back(newZoneHVACEquipmentList); | |
| 1412 | |||
| 1413 | ✗ | if (newFPTSecondaryInletConn) { | |
| 1414 | ✗ | ss << newFPTSecondaryInletConn.get(); | |
| 1415 | } | ||
| 1416 | ✗ | } | |
| 1417 | 1 | } | |
| 1418 | |||
| 1419 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 8 taken 2 times.
✓ Branch 9 taken 1 time.
|
3 | for (const IdfObject& object : idf_0_9_1.objects()) { |
| 1420 |
4/5✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 11 taken 2 times.
✗ Branch 12 not taken.
|
2 | if (object.iddObject().name() != "OS:ThermalZone") { |
| 1421 |
1/1✓ Branch 1 taken 2 times.
|
2 | ss << object; |
| 1422 | } | ||
| 1423 | 1 | } | |
| 1424 | |||
| 1425 |
1/1✓ Branch 1 taken 1 time.
|
2 | return ss.str(); |
| 1426 | 1 | } | |
| 1427 | |||
| 1428 | 6 | std::string VersionTranslator::update_0_9_5_to_0_9_6(const IdfFile& idf_0_9_5, const IddFileAndFactoryWrapper& idd_0_9_6) { | |
| 1429 | // if multiple OS:RunPeriod objects remove them all | ||
| 1430 | 6 | bool skipRunPeriods = false; | |
| 1431 | 6 | unsigned numRunPeriods = 0; | |
| 1432 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 8 taken 1022 times.
✓ Branch 9 taken 6 times.
|
1028 | for (const IdfObject& object : idf_0_9_5.objects()) { |
| 1433 |
4/5✓ Branch 1 taken 1022 times.
✓ Branch 4 taken 1022 times.
✓ Branch 7 taken 1022 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 1022 times.
|
1022 | if (object.iddObject().name() == "OS:RunPeriod") { |
| 1434 | ✗ | ++numRunPeriods; | |
| 1435 | |||
| 1436 | ✗ | if (numRunPeriods > 1) { | |
| 1437 | ✗ | LOG(Warn, "Multiple OS:RunPeriod objects are no longer supported, these have been removed"); | |
| 1438 | ✗ | skipRunPeriods = true; | |
| 1439 | ✗ | break; | |
| 1440 | } | ||
| 1441 | } | ||
| 1442 | 6 | } | |
| 1443 | |||
| 1444 | // use for version increments with no IDD changes | ||
| 1445 |
1/1✓ Branch 1 taken 6 times.
|
6 | std::stringstream ss; |
| 1446 | |||
| 1447 |
4/4✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
✓ Branch 10 taken 6 times.
|
6 | ss << idf_0_9_5.header() << '\n' << '\n'; |
| 1448 | |||
| 1449 | // new version object | ||
| 1450 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
6 | IdfFile targetIdf(idd_0_9_6.iddFile()); |
| 1451 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
|
6 | ss << targetIdf.versionObject().get(); |
| 1452 | |||
| 1453 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 8 taken 1022 times.
✓ Branch 9 taken 6 times.
|
1028 | for (const IdfObject& object : idf_0_9_5.objects()) { |
| 1454 |
4/5✓ Branch 1 taken 1022 times.
✓ Branch 4 taken 1022 times.
✓ Branch 7 taken 1022 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 1022 times.
|
1022 | if (object.iddObject().name() == "OS:PlantLoop") { |
| 1455 | ✗ | IdfObject newSizingPlant(idd_0_9_6.getObject("OS:Sizing:Plant").get()); | |
| 1456 | |||
| 1457 | ✗ | newSizingPlant.setString(0, toString(createUUID())); | |
| 1458 | |||
| 1459 | ✗ | newSizingPlant.setString(1, object.getString(0).get()); | |
| 1460 | |||
| 1461 | ✗ | newSizingPlant.setString(2, "Heating"); | |
| 1462 | |||
| 1463 | ✗ | newSizingPlant.setDouble(3, 0.001); | |
| 1464 | |||
| 1465 | ✗ | newSizingPlant.setDouble(4, 0.001); | |
| 1466 | |||
| 1467 | ✗ | ss << newSizingPlant; | |
| 1468 | |||
| 1469 | ✗ | m_new.push_back(newSizingPlant); | |
| 1470 | |||
| 1471 | ✗ | ss << object; | |
| 1472 |
4/5✓ Branch 2 taken 1022 times.
✓ Branch 5 taken 1022 times.
✓ Branch 8 taken 1022 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 1022 times.
|
1022 | } else if (object.iddObject().name() == "OS:Sizing:Parameters") { |
| 1473 | ✗ | IdfObject newSizingParameters = object.clone(true); | |
| 1474 | |||
| 1475 | ✗ | if (!object.getDouble(1)) { | |
| 1476 | ✗ | newSizingParameters.setDouble(1, 1.25); | |
| 1477 | } | ||
| 1478 | |||
| 1479 | ✗ | if (!object.getDouble(2)) { | |
| 1480 | ✗ | newSizingParameters.setDouble(2, 1.15); | |
| 1481 | } | ||
| 1482 | |||
| 1483 | ✗ | ss << newSizingParameters; | |
| 1484 |
4/5✓ Branch 2 taken 1022 times.
✓ Branch 5 taken 1022 times.
✓ Branch 8 taken 1022 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 1022 times.
|
1022 | } else if (object.iddObject().name() == "OS:RunPeriod") { |
| 1485 | ✗ | if (skipRunPeriods) { | |
| 1486 | // put the object in the untranslated list | ||
| 1487 | ✗ | m_untranslated.push_back(object); | |
| 1488 | } else { | ||
| 1489 | ✗ | ss << object; | |
| 1490 | } | ||
| 1491 | } else { | ||
| 1492 |
1/1✓ Branch 1 taken 1022 times.
|
1022 | ss << object; |
| 1493 | } | ||
| 1494 | 6 | } | |
| 1495 | |||
| 1496 |
1/1✓ Branch 1 taken 6 times.
|
12 | return ss.str(); |
| 1497 | 6 | } | |
| 1498 | |||
| 1499 | 6 | std::string VersionTranslator::update_0_9_6_to_0_10_0(const IdfFile& idf_0_9_6, const IddFileAndFactoryWrapper& idd_0_10_0) { | |
| 1500 |
1/1✓ Branch 1 taken 6 times.
|
6 | std::stringstream ss; |
| 1501 | |||
| 1502 |
4/4✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
✓ Branch 10 taken 6 times.
|
6 | ss << idf_0_9_6.header() << '\n' << '\n'; |
| 1503 | |||
| 1504 | // new version object | ||
| 1505 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
6 | IdfFile targetIdf(idd_0_10_0.iddFile()); |
| 1506 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
|
6 | ss << targetIdf.versionObject().get(); |
| 1507 | |||
| 1508 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 8 taken 1022 times.
✓ Branch 9 taken 6 times.
|
1028 | for (IdfObject& object : idf_0_9_6.objects()) { |
| 1509 | |||
| 1510 |
4/5✓ Branch 1 taken 1022 times.
✓ Branch 4 taken 1022 times.
✓ Branch 7 taken 1022 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 1022 times.
|
1022 | if (object.iddObject().name() == "OS:RadianceParameters") { |
| 1511 | ✗ | boost::optional<std::string> value = object.getString(14); | |
| 1512 | |||
| 1513 | ✗ | if (!value || *value == "146" || *value == "581" || *value == "2321") { | |
| 1514 | ✗ | ss << object; | |
| 1515 | } else { | ||
| 1516 | ✗ | IdfObject newParameters = object.clone(true); | |
| 1517 | ✗ | newParameters.setString(14, ""); | |
| 1518 | |||
| 1519 | ✗ | ss << newParameters; | |
| 1520 | ✗ | m_refactored.emplace_back(std::move(object), std::move(newParameters)); | |
| 1521 | ✗ | } | |
| 1522 | ✗ | } else { | |
| 1523 |
1/1✓ Branch 1 taken 1022 times.
|
1022 | ss << object; |
| 1524 | } | ||
| 1525 | 6 | } | |
| 1526 | |||
| 1527 |
1/1✓ Branch 1 taken 6 times.
|
12 | return ss.str(); |
| 1528 | 6 | } | |
| 1529 | |||
| 1530 | 6 | std::string VersionTranslator::update_0_11_0_to_0_11_1(const IdfFile& idf_0_11_0, const IddFileAndFactoryWrapper& idd_0_11_1) { | |
| 1531 | // use for version increments with no IDD changes | ||
| 1532 |
1/1✓ Branch 1 taken 6 times.
|
6 | std::stringstream ss; |
| 1533 | |||
| 1534 |
4/4✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
✓ Branch 10 taken 6 times.
|
6 | ss << idf_0_11_0.header() << '\n' << '\n'; |
| 1535 | |||
| 1536 | // new version object | ||
| 1537 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
6 | IdfFile targetIdf(idd_0_11_1.iddFile()); |
| 1538 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
|
6 | ss << targetIdf.versionObject().get(); |
| 1539 | |||
| 1540 | // hold OS:ComponentData objects for later | ||
| 1541 | 6 | std::vector<IdfObject> componentDataObjects; | |
| 1542 | 6 | std::vector<std::string> removedComponentCostLineItemHandles; | |
| 1543 | |||
| 1544 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 8 taken 1022 times.
✓ Branch 9 taken 6 times.
|
1028 | for (const IdfObject& object : idf_0_11_0.objects()) { |
| 1545 |
4/5✓ Branch 1 taken 1022 times.
✓ Branch 4 taken 1022 times.
✓ Branch 7 taken 1022 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 1022 times.
|
1022 | if (object.iddObject().name() == "OS:ComponentCost:LineItem") { |
| 1546 | ✗ | removedComponentCostLineItemHandles.push_back(toString(object.handle())); | |
| 1547 | ✗ | m_untranslated.push_back(object); | |
| 1548 |
5/5✓ Branch 1 taken 1022 times.
✓ Branch 4 taken 1022 times.
✓ Branch 7 taken 1022 times.
✓ Branch 11 taken 1 time.
✓ Branch 12 taken 1021 times.
|
1022 | } else if (object.iddObject().name() == "OS:ComponentData") { |
| 1549 |
1/1✓ Branch 1 taken 1 time.
|
1 | componentDataObjects.push_back(object); |
| 1550 | } else { | ||
| 1551 |
1/1✓ Branch 1 taken 1021 times.
|
1021 | ss << object; |
| 1552 | } | ||
| 1553 | 6 | } | |
| 1554 | |||
| 1555 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
|
6 | if (!removedComponentCostLineItemHandles.empty()) { |
| 1556 | ✗ | LOG(Warn, "OS:ComponentCost:LineItem objects created before 0.11.1 are no longer supported, " << removedComponentCostLineItemHandles.size() | |
| 1557 | << " objects have been removed."); | ||
| 1558 | } | ||
| 1559 | |||
| 1560 | // remove these handles from any component data objects | ||
| 1561 | // DLM: this is probably a standard thing we want to do in every version translation function | ||
| 1562 |
2/2✓ Branch 5 taken 1 time.
✓ Branch 6 taken 6 times.
|
7 | for (const IdfObject& componentDataObject : componentDataObjects) { |
| 1563 | |||
| 1564 | // if object was primary component remove the component data completely | ||
| 1565 |
1/1✓ Branch 1 taken 1 time.
|
1 | boost::optional<std::string> primaryObjectHandle = componentDataObject.getString(6); |
| 1566 |
1/2✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
|
1 | if (primaryObjectHandle) { |
| 1567 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 6 taken 1 time.
|
1 | if (std::find(removedComponentCostLineItemHandles.begin(), removedComponentCostLineItemHandles.end(), *primaryObjectHandle) |
| 1568 |
1/2✗ Branch 2 not taken.
✓ Branch 3 taken 1 time.
|
2 | != removedComponentCostLineItemHandles.end()) { |
| 1569 | ✗ | LOG(Warn, "Primary object removed from OS:ComponentData, component will be removed."); | |
| 1570 | ✗ | m_untranslated.push_back(componentDataObject); | |
| 1571 | ✗ | continue; | |
| 1572 | ✗ | } | |
| 1573 | } | ||
| 1574 | |||
| 1575 | // translate base fields | ||
| 1576 |
1/1✓ Branch 1 taken 1 time.
|
1 | componentDataObject.printName(ss, true); |
| 1577 |
1/1✓ Branch 1 taken 1 time.
|
1 | componentDataObject.printField(ss, 0, false); // Handle |
| 1578 |
1/1✓ Branch 1 taken 1 time.
|
1 | componentDataObject.printField(ss, 1, false); // Name |
| 1579 |
1/1✓ Branch 1 taken 1 time.
|
1 | componentDataObject.printField(ss, 2, false); // UUID |
| 1580 |
1/1✓ Branch 1 taken 1 time.
|
1 | componentDataObject.printField(ss, 3, false); // Version UUID |
| 1581 |
1/1✓ Branch 1 taken 1 time.
|
1 | componentDataObject.printField(ss, 4, false); // Creation Timestamp |
| 1582 |
1/1✓ Branch 1 taken 1 time.
|
1 | componentDataObject.printField(ss, 5, false); // Version Timestamp |
| 1583 | |||
| 1584 | // make list of fields to keep | ||
| 1585 | 1 | std::vector<unsigned> extensibleIndicesToKeep; | |
| 1586 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | for (unsigned i = 6, imax = componentDataObject.numFields(); i < imax; ++i) { |
| 1587 |
1/1✓ Branch 1 taken 1 time.
|
1 | boost::optional<std::string> objectHandle = componentDataObject.getString(i); |
| 1588 |
1/2✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
|
1 | if (objectHandle) { |
| 1589 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 6 taken 1 time.
|
1 | if (std::find(removedComponentCostLineItemHandles.begin(), removedComponentCostLineItemHandles.end(), *objectHandle) |
| 1590 |
1/2✓ Branch 2 taken 1 time.
✗ Branch 3 not taken.
|
2 | == removedComponentCostLineItemHandles.end()) { |
| 1591 |
1/1✓ Branch 1 taken 1 time.
|
1 | extensibleIndicesToKeep.push_back(i); |
| 1592 | } | ||
| 1593 | } | ||
| 1594 | 1 | } | |
| 1595 | |||
| 1596 | // write out remaining fields | ||
| 1597 |
2/2✓ Branch 5 taken 1 time.
✓ Branch 6 taken 1 time.
|
2 | for (auto it = extensibleIndicesToKeep.begin(), itend = extensibleIndicesToKeep.end(); it < itend; ++it) { |
| 1598 |
1/2✓ Branch 2 taken 1 time.
✗ Branch 3 not taken.
|
1 | if (it == itend - 1) { |
| 1599 |
1/1✓ Branch 2 taken 1 time.
|
1 | componentDataObject.printField(ss, *it, true); |
| 1600 | } else { | ||
| 1601 | ✗ | componentDataObject.printField(ss, *it, false); | |
| 1602 | } | ||
| 1603 | } | ||
| 1604 | 1 | } | |
| 1605 | |||
| 1606 |
1/1✓ Branch 1 taken 6 times.
|
12 | return ss.str(); |
| 1607 | 6 | } | |
| 1608 | |||
| 1609 | 6 | std::string VersionTranslator::update_0_11_1_to_0_11_2(const IdfFile& idf_0_11_1, const IddFileAndFactoryWrapper& idd_0_11_2) { | |
| 1610 | // This version update has two things to do. | ||
| 1611 | // Make updates for new control related objects. | ||
| 1612 | // Make updates for component costs. | ||
| 1613 | |||
| 1614 |
1/1✓ Branch 1 taken 6 times.
|
6 | std::stringstream ss; |
| 1615 | |||
| 1616 |
4/4✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
✓ Branch 10 taken 6 times.
|
6 | ss << idf_0_11_1.header() << '\n' << '\n'; |
| 1617 | |||
| 1618 | // new version object | ||
| 1619 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
6 | IdfFile targetIdf(idd_0_11_2.iddFile()); |
| 1620 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
|
6 | ss << targetIdf.versionObject().get(); |
| 1621 | |||
| 1622 | // hold OS:ComponentData objects for later | ||
| 1623 | 6 | std::vector<IdfObject> componentDataObjects; | |
| 1624 | 6 | std::vector<std::string> removedItemHandles; | |
| 1625 | |||
| 1626 | 6 | unsigned numComponentCostAdjustment = 0; | |
| 1627 | 6 | unsigned numComponentCostAdjustmentRemoved = 0; | |
| 1628 | 6 | unsigned numComponentCostReferenceRemoved = 0; | |
| 1629 | 6 | unsigned numLifeCycleCostUseAdjustmentRemoved = 0; | |
| 1630 | |||
| 1631 | 6 | boost::optional<IdfObject> alwaysOnSchedule; | |
| 1632 | |||
| 1633 |
2/2✓ Branch 0 taken 5 times.
✓ Branch 1 taken 1 time.
|
6 | if (!m_isComponent) { |
| 1634 | // Add an always on discrete schedule if one does not already exist | ||
| 1635 | |||
| 1636 |
3/3✓ Branch 1 taken 5 times.
✓ Branch 8 taken 1020 times.
✓ Branch 9 taken 5 times.
|
1025 | for (const IdfObject& object : idf_0_11_1.objects()) { |
| 1637 |
4/5✓ Branch 1 taken 1020 times.
✓ Branch 4 taken 1020 times.
✓ Branch 7 taken 1020 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 1020 times.
|
1020 | if (object.iddObject().name() == "OS:Schedule:Constant") { |
| 1638 | ✗ | if (boost::optional<std::string> name = object.getString(1)) { | |
| 1639 | ✗ | if (istringEqual(name.get(), "Always On Discrete")) { | |
| 1640 | ✗ | if (boost::optional<double> value = object.getDouble(3)) { | |
| 1641 | ✗ | if (equal<double>(value.get(), 1.0)) { | |
| 1642 | ✗ | alwaysOnSchedule = object; | |
| 1643 | } | ||
| 1644 | } | ||
| 1645 | } | ||
| 1646 | ✗ | } | |
| 1647 | } | ||
| 1648 | 5 | } | |
| 1649 | |||
| 1650 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | if (!alwaysOnSchedule) { |
| 1651 |
5/5✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
✓ Branch 13 taken 5 times.
|
5 | alwaysOnSchedule = IdfObject(idd_0_11_2.getObject("OS:Schedule:Constant").get()); |
| 1652 | |||
| 1653 |
4/4✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
|
5 | alwaysOnSchedule->setString(0, toString(createUUID())); |
| 1654 | |||
| 1655 |
3/3✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
|
10 | alwaysOnSchedule->setString(1, "Always On Discrete"); |
| 1656 | |||
| 1657 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | alwaysOnSchedule->setDouble(3, 1.0); |
| 1658 | |||
| 1659 |
4/4✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
|
5 | IdfObject typeLimits(idd_0_11_2.getObject("OS:ScheduleTypeLimits").get()); |
| 1660 | |||
| 1661 |
3/3✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
|
5 | typeLimits.setString(0, toString(createUUID())); |
| 1662 | |||
| 1663 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | typeLimits.setString(1, "Always On Discrete Limits"); |
| 1664 | |||
| 1665 |
1/1✓ Branch 1 taken 5 times.
|
5 | typeLimits.setDouble(2, 0.0); |
| 1666 | |||
| 1667 |
1/1✓ Branch 1 taken 5 times.
|
5 | typeLimits.setDouble(3, 1.0); |
| 1668 | |||
| 1669 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
10 | typeLimits.setString(4, "Discrete"); |
| 1670 | |||
| 1671 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | typeLimits.setString(5, "Availability"); |
| 1672 | |||
| 1673 |
4/4✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
|
5 | alwaysOnSchedule->setString(2, typeLimits.getString(0).get()); |
| 1674 | |||
| 1675 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | ss << alwaysOnSchedule.get(); |
| 1676 | |||
| 1677 |
1/1✓ Branch 1 taken 5 times.
|
5 | ss << typeLimits; |
| 1678 | |||
| 1679 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | m_new.push_back(alwaysOnSchedule.get()); |
| 1680 | |||
| 1681 |
1/1✓ Branch 1 taken 5 times.
|
5 | m_new.push_back(typeLimits); |
| 1682 | 5 | } | |
| 1683 | } | ||
| 1684 | |||
| 1685 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 8 taken 1022 times.
✓ Branch 9 taken 6 times.
|
1028 | for (const IdfObject& object : idf_0_11_1.objects()) { |
| 1686 | // There are no official components with HVAC at this version. | ||
| 1687 | // We don't do this translation because it breaks tests related to OS:ComponentData when new objects are added. | ||
| 1688 | // Future version will do something better. | ||
| 1689 |
7/17✓ Branch 1 taken 1022 times.
✓ Branch 4 taken 1022 times.
✓ Branch 7 taken 1022 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 1022 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 1022 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 1022 times.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✓ Branch 20 taken 1022 times.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
|
1022 | if (object.iddObject().name() == "OS:Controller:OutdoorAir" && !m_isComponent) { |
| 1690 | ✗ | IdfObject newOAController = object.clone(true); | |
| 1691 | |||
| 1692 | ✗ | IdfObject newMechVentController(idd_0_11_2.getObject("OS:Controller:MechanicalVentilation").get()); | |
| 1693 | |||
| 1694 | ✗ | newMechVentController.setString(0, toString(createUUID())); | |
| 1695 | |||
| 1696 | ✗ | newMechVentController.setString(4, "ZoneSum"); | |
| 1697 | |||
| 1698 | ✗ | newMechVentController.setString(2, alwaysOnSchedule->getString(0).get()); | |
| 1699 | |||
| 1700 | ✗ | newOAController.setString(20, newMechVentController.getString(0).get()); | |
| 1701 | |||
| 1702 | ✗ | ss << newOAController; | |
| 1703 | |||
| 1704 | ✗ | ss << newMechVentController; | |
| 1705 | |||
| 1706 | ✗ | m_new.push_back(newMechVentController); | |
| 1707 |
7/17✓ Branch 3 taken 1022 times.
✓ Branch 6 taken 1022 times.
✓ Branch 9 taken 1022 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 1022 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 1022 times.
✗ Branch 16 not taken.
✓ Branch 18 taken 1022 times.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✓ Branch 22 taken 1022 times.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
|
1022 | } else if (object.iddObject().name() == "OS:AirLoopHVAC" && !m_isComponent) { |
| 1708 | ✗ | IdfObject newAirLoopHVAC = object.clone(true); | |
| 1709 | |||
| 1710 | ✗ | IdfObject newAvailList(idd_0_11_2.getObject("OS:AvailabilityManagerAssignmentList").get()); | |
| 1711 | |||
| 1712 | ✗ | newAvailList.setString(0, toString(createUUID())); | |
| 1713 | |||
| 1714 | ✗ | newAirLoopHVAC.setString(3, newAvailList.getString(0).get()); | |
| 1715 | |||
| 1716 | ✗ | IdfObject newAvailabilityManagerScheduled(idd_0_11_2.getObject("OS:AvailabilityManager:Scheduled").get()); | |
| 1717 | |||
| 1718 | ✗ | newAvailabilityManagerScheduled.setString(0, toString(createUUID())); | |
| 1719 | |||
| 1720 | ✗ | newAvailabilityManagerScheduled.setString(2, alwaysOnSchedule->getString(0).get()); | |
| 1721 | |||
| 1722 | ✗ | IdfExtensibleGroup eg = newAvailList.insertExtensibleGroup(0); | |
| 1723 | |||
| 1724 | ✗ | eg.setString(0, newAvailabilityManagerScheduled.getString(0).get()); | |
| 1725 | |||
| 1726 | ✗ | IdfObject newAvailabilityManagerNightCycle(idd_0_11_2.getObject("OS:AvailabilityManager:NightCycle").get()); | |
| 1727 | |||
| 1728 | ✗ | newAvailabilityManagerNightCycle.setString(0, toString(createUUID())); | |
| 1729 | |||
| 1730 | ✗ | eg = newAvailList.insertExtensibleGroup(1); | |
| 1731 | |||
| 1732 | ✗ | eg.setString(0, newAvailabilityManagerNightCycle.getString(0).get()); | |
| 1733 | |||
| 1734 | ✗ | ss << newAirLoopHVAC; | |
| 1735 | |||
| 1736 | ✗ | ss << newAvailList; | |
| 1737 | |||
| 1738 | ✗ | ss << newAvailabilityManagerScheduled; | |
| 1739 | |||
| 1740 | ✗ | ss << newAvailabilityManagerNightCycle; | |
| 1741 | |||
| 1742 | ✗ | m_new.push_back(newAvailList); | |
| 1743 | |||
| 1744 | ✗ | m_new.push_back(newAvailabilityManagerScheduled); | |
| 1745 | |||
| 1746 | ✗ | m_new.push_back(newAvailabilityManagerNightCycle); | |
| 1747 |
4/5✓ Branch 6 taken 1022 times.
✓ Branch 9 taken 1022 times.
✓ Branch 12 taken 1022 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 1022 times.
|
1022 | } else if (object.iddObject().name() == "OS:ComponentCost:Adjustment") { |
| 1748 | ✗ | numComponentCostAdjustment += 1; | |
| 1749 | |||
| 1750 | // this was made unique, remove if more than 1 | ||
| 1751 | ✗ | if (numComponentCostAdjustment == 1) { | |
| 1752 | ✗ | ss << object; | |
| 1753 | } else { | ||
| 1754 | ✗ | numComponentCostAdjustmentRemoved += 1; | |
| 1755 | ✗ | removedItemHandles.push_back(toString(object.handle())); | |
| 1756 | ✗ | m_untranslated.push_back(object); | |
| 1757 | } | ||
| 1758 |
4/5✓ Branch 1 taken 1022 times.
✓ Branch 4 taken 1022 times.
✓ Branch 7 taken 1022 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 1022 times.
|
1022 | } else if (object.iddObject().name() == "OS:ComponentCost:Reference") { |
| 1759 | ✗ | numComponentCostReferenceRemoved += 1; | |
| 1760 | ✗ | removedItemHandles.push_back(toString(object.handle())); | |
| 1761 | ✗ | m_untranslated.push_back(object); | |
| 1762 |
4/5✓ Branch 1 taken 1022 times.
✓ Branch 4 taken 1022 times.
✓ Branch 7 taken 1022 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 1022 times.
|
1022 | } else if (object.iddObject().name() == "OS:LifeCycleCost:UseAdjustment") { |
| 1763 | ✗ | numLifeCycleCostUseAdjustmentRemoved += 1; | |
| 1764 | ✗ | removedItemHandles.push_back(toString(object.handle())); | |
| 1765 | ✗ | m_untranslated.push_back(object); | |
| 1766 |
4/5✓ Branch 1 taken 1022 times.
✓ Branch 4 taken 1022 times.
✓ Branch 7 taken 1022 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 1022 times.
|
1022 | } else if (object.iddObject().name() == "OS:LifeCycleCost:Parameters") { |
| 1767 | ✗ | object.printName(ss, true); | |
| 1768 | ✗ | object.printField(ss, 0, false); // Handle | |
| 1769 | ✗ | ss << "Custom, !- AnalysisType" << '\n'; // Name -> AnalysisType | |
| 1770 | |||
| 1771 | ✗ | for (unsigned i = 2, imax = 12; i < imax; ++i) { | |
| 1772 | ✗ | if (i == imax - 1) { | |
| 1773 | ✗ | object.printField(ss, i, true); | |
| 1774 | } else { | ||
| 1775 | ✗ | object.printField(ss, i, false); | |
| 1776 | } | ||
| 1777 | } | ||
| 1778 |
5/5✓ Branch 1 taken 1022 times.
✓ Branch 4 taken 1022 times.
✓ Branch 7 taken 1022 times.
✓ Branch 11 taken 1 time.
✓ Branch 12 taken 1021 times.
|
1022 | } else if (object.iddObject().name() == "OS:ComponentData") { |
| 1779 |
1/1✓ Branch 1 taken 1 time.
|
1 | componentDataObjects.push_back(object); |
| 1780 | } else { | ||
| 1781 |
1/1✓ Branch 1 taken 1021 times.
|
1021 | ss << object; |
| 1782 | } | ||
| 1783 | 6 | } | |
| 1784 | |||
| 1785 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
|
6 | if (numComponentCostAdjustmentRemoved > 0) { |
| 1786 | ✗ | LOG(Warn, "Multiple OS:ComponentCost:Adjustment objects created in a single model before 0.11.1 are no longer supported, " | |
| 1787 | << numComponentCostAdjustmentRemoved << " objects have been removed."); | ||
| 1788 | } | ||
| 1789 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
|
6 | if (numComponentCostReferenceRemoved > 0) { |
| 1790 | ✗ | LOG(Warn, "OS:ComponentCost:Reference objects created before 0.11.1 are no longer supported, " << numComponentCostReferenceRemoved | |
| 1791 | << " objects have been removed."); | ||
| 1792 | } | ||
| 1793 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
|
6 | if (numLifeCycleCostUseAdjustmentRemoved > 0) { |
| 1794 | ✗ | LOG(Warn, "OS:LifeCycleCos:UseAdjustment objects created before 0.11.1 are no longer supported, " << numLifeCycleCostUseAdjustmentRemoved | |
| 1795 | << " objects have been removed."); | ||
| 1796 | } | ||
| 1797 | |||
| 1798 | // remove these handles from any component data objects | ||
| 1799 | // DLM: this is probably a standard thing we want to do in every version translation function | ||
| 1800 |
2/2✓ Branch 5 taken 1 time.
✓ Branch 6 taken 6 times.
|
7 | for (const IdfObject& componentDataObject : componentDataObjects) { |
| 1801 | |||
| 1802 | // if object was primary component remove the component data completely | ||
| 1803 |
1/1✓ Branch 1 taken 1 time.
|
1 | boost::optional<std::string> primaryObjectHandle = componentDataObject.getString(6); |
| 1804 |
1/2✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
|
1 | if (primaryObjectHandle) { |
| 1805 |
3/4✓ Branch 2 taken 1 time.
✓ Branch 7 taken 1 time.
✗ Branch 10 not taken.
✓ Branch 11 taken 1 time.
|
1 | if (std::find(removedItemHandles.begin(), removedItemHandles.end(), *primaryObjectHandle) != removedItemHandles.end()) { |
| 1806 | ✗ | LOG(Warn, "Primary object removed from OS:ComponentData, component will be removed."); | |
| 1807 | ✗ | m_untranslated.push_back(componentDataObject); | |
| 1808 | ✗ | continue; | |
| 1809 | ✗ | } | |
| 1810 | } | ||
| 1811 | |||
| 1812 | // translate base fields | ||
| 1813 |
1/1✓ Branch 1 taken 1 time.
|
1 | componentDataObject.printName(ss, true); |
| 1814 |
1/1✓ Branch 1 taken 1 time.
|
1 | componentDataObject.printField(ss, 0, false); // Handle |
| 1815 |
1/1✓ Branch 1 taken 1 time.
|
1 | componentDataObject.printField(ss, 1, false); // Name |
| 1816 |
1/1✓ Branch 1 taken 1 time.
|
1 | componentDataObject.printField(ss, 2, false); // UUID |
| 1817 |
1/1✓ Branch 1 taken 1 time.
|
1 | componentDataObject.printField(ss, 3, false); // Version UUID |
| 1818 |
1/1✓ Branch 1 taken 1 time.
|
1 | componentDataObject.printField(ss, 4, false); // Creation Timestamp |
| 1819 |
1/1✓ Branch 1 taken 1 time.
|
1 | componentDataObject.printField(ss, 5, false); // Version Timestamp |
| 1820 | |||
| 1821 | // make list of fields to keep | ||
| 1822 | 1 | std::vector<unsigned> extensibleIndicesToKeep; | |
| 1823 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | for (unsigned i = 6, imax = componentDataObject.numFields(); i < imax; ++i) { |
| 1824 |
1/1✓ Branch 1 taken 1 time.
|
1 | boost::optional<std::string> objectHandle = componentDataObject.getString(i); |
| 1825 |
1/2✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
|
1 | if (objectHandle) { |
| 1826 |
3/4✓ Branch 2 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✗ Branch 11 not taken.
|
1 | if (std::find(removedItemHandles.begin(), removedItemHandles.end(), *objectHandle) == removedItemHandles.end()) { |
| 1827 |
1/1✓ Branch 1 taken 1 time.
|
1 | extensibleIndicesToKeep.push_back(i); |
| 1828 | } | ||
| 1829 | } | ||
| 1830 | 1 | } | |
| 1831 | |||
| 1832 | // write out remaining fields | ||
| 1833 |
2/2✓ Branch 5 taken 1 time.
✓ Branch 6 taken 1 time.
|
2 | for (auto it = extensibleIndicesToKeep.begin(), itend = extensibleIndicesToKeep.end(); it < itend; ++it) { |
| 1834 |
1/2✓ Branch 2 taken 1 time.
✗ Branch 3 not taken.
|
1 | if (it == itend - 1) { |
| 1835 |
1/1✓ Branch 2 taken 1 time.
|
1 | componentDataObject.printField(ss, *it, true); |
| 1836 | } else { | ||
| 1837 | ✗ | componentDataObject.printField(ss, *it, false); | |
| 1838 | } | ||
| 1839 | } | ||
| 1840 | 1 | } | |
| 1841 | |||
| 1842 |
1/1✓ Branch 1 taken 6 times.
|
12 | return ss.str(); |
| 1843 | 6 | } | |
| 1844 | |||
| 1845 | 6 | std::string VersionTranslator::update_0_11_4_to_0_11_5(const IdfFile& idf_0_11_4, const IddFileAndFactoryWrapper& idd_0_11_5) { | |
| 1846 | // Make updates for component costs. | ||
| 1847 | |||
| 1848 |
1/1✓ Branch 1 taken 6 times.
|
6 | std::stringstream ss; |
| 1849 | |||
| 1850 |
4/4✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
✓ Branch 10 taken 6 times.
|
6 | ss << idf_0_11_4.header() << '\n' << '\n'; |
| 1851 | |||
| 1852 | // new version object | ||
| 1853 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
6 | IdfFile targetIdf(idd_0_11_5.iddFile()); |
| 1854 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
|
6 | ss << targetIdf.versionObject().get(); |
| 1855 | |||
| 1856 | // hold OS:ComponentData objects for later | ||
| 1857 | 6 | std::vector<IdfObject> componentDataObjects; | |
| 1858 | 6 | std::vector<std::string> removedItemHandles; | |
| 1859 | |||
| 1860 | 6 | unsigned numComponentCostLineItemRemoved = 0; | |
| 1861 | 6 | unsigned numLifeCycleNonRecurringCostRemoved = 0; | |
| 1862 | 6 | unsigned numLifeCycleRecurringCostRemoved = 0; | |
| 1863 | |||
| 1864 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 8 taken 1032 times.
✓ Branch 9 taken 6 times.
|
1038 | for (const IdfObject& object : idf_0_11_4.objects()) { |
| 1865 | |||
| 1866 |
4/5✓ Branch 1 taken 1032 times.
✓ Branch 4 taken 1032 times.
✓ Branch 7 taken 1032 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 1032 times.
|
1032 | if (object.iddObject().name() == "OS:ComponentCost:LineItem") { |
| 1867 | ✗ | numComponentCostLineItemRemoved += 1; | |
| 1868 | ✗ | removedItemHandles.push_back(toString(object.handle())); | |
| 1869 | ✗ | m_untranslated.push_back(object); | |
| 1870 |
4/5✓ Branch 1 taken 1032 times.
✓ Branch 4 taken 1032 times.
✓ Branch 7 taken 1032 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 1032 times.
|
1032 | } else if (object.iddObject().name() == "OS:LifeCycleCost:NonrecurringCost") { |
| 1871 | ✗ | numLifeCycleNonRecurringCostRemoved += 1; | |
| 1872 | ✗ | removedItemHandles.push_back(toString(object.handle())); | |
| 1873 | ✗ | m_untranslated.push_back(object); | |
| 1874 |
4/5✓ Branch 1 taken 1032 times.
✓ Branch 4 taken 1032 times.
✓ Branch 7 taken 1032 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 1032 times.
|
1032 | } else if (object.iddObject().name() == "OS:LifeCycleCost:RecurringCosts") { |
| 1875 | ✗ | numLifeCycleRecurringCostRemoved += 1; | |
| 1876 | ✗ | removedItemHandles.push_back(toString(object.handle())); | |
| 1877 | ✗ | m_untranslated.push_back(object); | |
| 1878 |
5/5✓ Branch 1 taken 1032 times.
✓ Branch 4 taken 1032 times.
✓ Branch 7 taken 1032 times.
✓ Branch 11 taken 1 time.
✓ Branch 12 taken 1031 times.
|
1032 | } else if (object.iddObject().name() == "OS:ComponentData") { |
| 1879 |
1/1✓ Branch 1 taken 1 time.
|
1 | componentDataObjects.push_back(object); |
| 1880 | } else { | ||
| 1881 |
1/1✓ Branch 1 taken 1031 times.
|
1031 | ss << object; |
| 1882 | } | ||
| 1883 | 6 | } | |
| 1884 | |||
| 1885 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
|
6 | if (numComponentCostLineItemRemoved > 0) { |
| 1886 | ✗ | LOG(Warn, "OS:ComponentCost:LineItem objects created before 0.11.5 are no longer supported, " << numComponentCostLineItemRemoved | |
| 1887 | << " objects have been removed."); | ||
| 1888 | } | ||
| 1889 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
|
6 | if (numLifeCycleNonRecurringCostRemoved > 0) { |
| 1890 | ✗ | LOG(Warn, "OS:LifeCycleCost:NonrecurringCost objects created before 0.11.5 are no longer supported, " << numLifeCycleNonRecurringCostRemoved | |
| 1891 | << " objects have been removed."); | ||
| 1892 | } | ||
| 1893 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
|
6 | if (numLifeCycleRecurringCostRemoved > 0) { |
| 1894 | ✗ | LOG(Warn, "OS:LifeCycleCost:RecurringCosts objects created before 0.11.5 are no longer supported, " << numLifeCycleRecurringCostRemoved | |
| 1895 | << " objects have been removed."); | ||
| 1896 | } | ||
| 1897 | |||
| 1898 | // remove these handles from any component data objects | ||
| 1899 | // DLM: this is probably a standard thing we want to do in every version translation function | ||
| 1900 |
2/2✓ Branch 5 taken 1 time.
✓ Branch 6 taken 6 times.
|
7 | for (const IdfObject& componentDataObject : componentDataObjects) { |
| 1901 | |||
| 1902 | // if object was primary component remove the component data completely | ||
| 1903 |
1/1✓ Branch 1 taken 1 time.
|
1 | boost::optional<std::string> primaryObjectHandle = componentDataObject.getString(6); |
| 1904 |
1/2✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
|
1 | if (primaryObjectHandle) { |
| 1905 |
3/4✓ Branch 2 taken 1 time.
✓ Branch 7 taken 1 time.
✗ Branch 10 not taken.
✓ Branch 11 taken 1 time.
|
1 | if (std::find(removedItemHandles.begin(), removedItemHandles.end(), *primaryObjectHandle) != removedItemHandles.end()) { |
| 1906 | ✗ | LOG(Warn, "Primary object removed from OS:ComponentData, component will be removed."); | |
| 1907 | ✗ | m_untranslated.push_back(componentDataObject); | |
| 1908 | ✗ | continue; | |
| 1909 | ✗ | } | |
| 1910 | } | ||
| 1911 | |||
| 1912 | // translate base fields | ||
| 1913 |
1/1✓ Branch 1 taken 1 time.
|
1 | componentDataObject.printName(ss, true); |
| 1914 |
1/1✓ Branch 1 taken 1 time.
|
1 | componentDataObject.printField(ss, 0, false); // Handle |
| 1915 |
1/1✓ Branch 1 taken 1 time.
|
1 | componentDataObject.printField(ss, 1, false); // Name |
| 1916 |
1/1✓ Branch 1 taken 1 time.
|
1 | componentDataObject.printField(ss, 2, false); // UUID |
| 1917 |
1/1✓ Branch 1 taken 1 time.
|
1 | componentDataObject.printField(ss, 3, false); // Version UUID |
| 1918 |
1/1✓ Branch 1 taken 1 time.
|
1 | componentDataObject.printField(ss, 4, false); // Creation Timestamp |
| 1919 |
1/1✓ Branch 1 taken 1 time.
|
1 | componentDataObject.printField(ss, 5, false); // Version Timestamp |
| 1920 | |||
| 1921 | // make list of fields to keep | ||
| 1922 | 1 | std::vector<unsigned> extensibleIndicesToKeep; | |
| 1923 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | for (unsigned i = 6, imax = componentDataObject.numFields(); i < imax; ++i) { |
| 1924 |
1/1✓ Branch 1 taken 1 time.
|
1 | boost::optional<std::string> objectHandle = componentDataObject.getString(i); |
| 1925 |
1/2✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
|
1 | if (objectHandle) { |
| 1926 |
3/4✓ Branch 2 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✗ Branch 11 not taken.
|
1 | if (std::find(removedItemHandles.begin(), removedItemHandles.end(), *objectHandle) == removedItemHandles.end()) { |
| 1927 |
1/1✓ Branch 1 taken 1 time.
|
1 | extensibleIndicesToKeep.push_back(i); |
| 1928 | } | ||
| 1929 | } | ||
| 1930 | 1 | } | |
| 1931 | |||
| 1932 | // write out remaining fields | ||
| 1933 |
2/2✓ Branch 5 taken 1 time.
✓ Branch 6 taken 1 time.
|
2 | for (auto it = extensibleIndicesToKeep.begin(), itend = extensibleIndicesToKeep.end(); it < itend; ++it) { |
| 1934 |
1/2✓ Branch 2 taken 1 time.
✗ Branch 3 not taken.
|
1 | if (it == itend - 1) { |
| 1935 |
1/1✓ Branch 2 taken 1 time.
|
1 | componentDataObject.printField(ss, *it, true); |
| 1936 | } else { | ||
| 1937 | ✗ | componentDataObject.printField(ss, *it, false); | |
| 1938 | } | ||
| 1939 | } | ||
| 1940 | 1 | } | |
| 1941 | |||
| 1942 |
1/1✓ Branch 1 taken 6 times.
|
12 | return ss.str(); |
| 1943 | 6 | } | |
| 1944 | |||
| 1945 | 6 | std::string VersionTranslator::update_0_11_5_to_0_11_6(const IdfFile& idf_0_11_5, const IddFileAndFactoryWrapper& idd_0_11_6) { | |
| 1946 | // Update the OS:PortList object to point back to the OS:ThermalZone | ||
| 1947 | |||
| 1948 |
1/1✓ Branch 1 taken 6 times.
|
6 | std::stringstream ss; |
| 1949 | |||
| 1950 |
4/4✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
✓ Branch 10 taken 6 times.
|
6 | ss << idf_0_11_5.header() << '\n' << '\n'; |
| 1951 | |||
| 1952 | // new version object | ||
| 1953 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
6 | IdfFile targetIdf(idd_0_11_6.iddFile()); |
| 1954 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
|
6 | ss << targetIdf.versionObject().get(); |
| 1955 | |||
| 1956 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 8 taken 1032 times.
✓ Branch 9 taken 6 times.
|
1038 | for (const IdfObject& object : idf_0_11_5.objects()) { |
| 1957 | |||
| 1958 |
4/5✓ Branch 1 taken 1032 times.
✓ Branch 4 taken 1032 times.
✓ Branch 7 taken 1032 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 1032 times.
|
1032 | if (object.iddObject().name() == "OS:ThermalZone") { |
| 1959 | |||
| 1960 | ✗ | boost::optional<std::string> inletPortListString = object.getString(9); | |
| 1961 | ✗ | boost::optional<std::string> exhaustPortListString = object.getString(10); | |
| 1962 | |||
| 1963 | ✗ | for (IdfObject& object2 : idf_0_11_5.objects()) { | |
| 1964 | |||
| 1965 | ✗ | if (object2.iddObject().name() == "OS:PortList") { | |
| 1966 | |||
| 1967 | ✗ | if (boost::optional<std::string> object2Handle = object2.getString(0)) { | |
| 1968 | |||
| 1969 | ✗ | if ((inletPortListString && object2Handle.get() == inletPortListString.get()) | |
| 1970 | ✗ | || (exhaustPortListString && object2Handle.get() == exhaustPortListString.get())) { | |
| 1971 | |||
| 1972 | // Make the required change to OS:PortList | ||
| 1973 | |||
| 1974 | ✗ | IdfObject newPortList(idd_0_11_6.getObject("OS:PortList").get()); | |
| 1975 | |||
| 1976 | ✗ | boost::optional<std::string> s; | |
| 1977 | |||
| 1978 | ✗ | if ((s = object2.getString(0))) { | |
| 1979 | ✗ | newPortList.setString(0, s.get()); | |
| 1980 | } | ||
| 1981 | |||
| 1982 | ✗ | if ((s = object2.getString(1))) { | |
| 1983 | ✗ | newPortList.setString(1, s.get()); | |
| 1984 | } | ||
| 1985 | |||
| 1986 | ✗ | if ((s = object.getString(0))) { | |
| 1987 | ✗ | newPortList.setString(2, s.get()); | |
| 1988 | } | ||
| 1989 | |||
| 1990 | ✗ | for (unsigned i = 2; i < object2.numFields(); i++) { | |
| 1991 | |||
| 1992 | ✗ | if ((s = object2.getString(i))) { | |
| 1993 | ✗ | newPortList.setString(i + 1, s.get()); | |
| 1994 | } | ||
| 1995 | } | ||
| 1996 | |||
| 1997 | ✗ | ss << newPortList; | |
| 1998 | ✗ | m_refactored.emplace_back(std::move(object2), std::move(newPortList)); | |
| 1999 | ✗ | } | |
| 2000 | ✗ | } | |
| 2001 | } | ||
| 2002 | ✗ | } | |
| 2003 | |||
| 2004 | ✗ | ss << object; | |
| 2005 | |||
| 2006 |
4/5✓ Branch 3 taken 1032 times.
✓ Branch 6 taken 1032 times.
✓ Branch 9 taken 1032 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 1032 times.
|
1032 | } else if (object.iddObject().name() == "OS:PortList") { |
| 2007 | |||
| 2008 | ✗ | continue; | |
| 2009 | |||
| 2010 | } else { | ||
| 2011 | |||
| 2012 |
1/1✓ Branch 1 taken 1032 times.
|
1032 | ss << object; |
| 2013 | } | ||
| 2014 | 6 | } | |
| 2015 | |||
| 2016 |
1/1✓ Branch 1 taken 6 times.
|
12 | return ss.str(); |
| 2017 | 6 | } | |
| 2018 | |||
| 2019 | 6 | std::string VersionTranslator::update_1_0_1_to_1_0_2(const IdfFile& idf_1_0_1, const IddFileAndFactoryWrapper& idd_1_0_2) { | |
| 2020 |
1/1✓ Branch 1 taken 6 times.
|
6 | std::stringstream ss; |
| 2021 | |||
| 2022 |
4/4✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
✓ Branch 10 taken 6 times.
|
6 | ss << idf_1_0_1.header() << '\n' << '\n'; |
| 2023 | |||
| 2024 | // new version object | ||
| 2025 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
6 | IdfFile targetIdf(idd_1_0_2.iddFile()); |
| 2026 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
|
6 | ss << targetIdf.versionObject().get(); |
| 2027 | |||
| 2028 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 8 taken 1032 times.
✓ Branch 9 taken 6 times.
|
1038 | for (IdfObject& object : idf_1_0_1.objects()) { |
| 2029 | |||
| 2030 |
4/5✓ Branch 1 taken 1032 times.
✓ Branch 4 taken 1032 times.
✓ Branch 7 taken 1032 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 1032 times.
|
1032 | if (object.iddObject().name() == "OS:Boiler:HotWater") { |
| 2031 | |||
| 2032 | ✗ | if (object.getString(15) && istringEqual(object.getString(15).get(), "VariableFlow")) { | |
| 2033 | // Update Boiler Flow Mode | ||
| 2034 | |||
| 2035 | ✗ | IdfObject newBoiler = object.clone(true); | |
| 2036 | |||
| 2037 | ✗ | newBoiler.setString(15, "LeavingSetpointModulated"); | |
| 2038 | |||
| 2039 | ✗ | ss << newBoiler; | |
| 2040 | ✗ | m_refactored.emplace_back(std::move(object), std::move(newBoiler)); | |
| 2041 | |||
| 2042 | ✗ | } else { | |
| 2043 | |||
| 2044 | ✗ | ss << object; | |
| 2045 | } | ||
| 2046 |
4/5✓ Branch 1 taken 1032 times.
✓ Branch 4 taken 1032 times.
✓ Branch 7 taken 1032 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 1032 times.
|
1032 | } else if (object.iddObject().name() == "OS:Boiler:HotWater") { |
| 2047 | |||
| 2048 | ✗ | if (object.getString(15) && istringEqual(object.getString(15).get(), "VariableFlow")) { | |
| 2049 | // Update Chiller Flow Mode | ||
| 2050 | |||
| 2051 | ✗ | IdfObject newChiller = object.clone(true); | |
| 2052 | |||
| 2053 | ✗ | newChiller.setString(15, "LeavingSetpointModulated"); | |
| 2054 | |||
| 2055 | ✗ | ss << newChiller; | |
| 2056 | ✗ | m_refactored.emplace_back(std::move(object), std::move(newChiller)); | |
| 2057 | |||
| 2058 | ✗ | } else { | |
| 2059 | |||
| 2060 | ✗ | ss << object; | |
| 2061 | } | ||
| 2062 | |||
| 2063 | } else { | ||
| 2064 | |||
| 2065 |
1/1✓ Branch 1 taken 1032 times.
|
1032 | ss << object; |
| 2066 | } | ||
| 2067 | 6 | } | |
| 2068 | |||
| 2069 |
1/1✓ Branch 1 taken 6 times.
|
12 | return ss.str(); |
| 2070 | 6 | } | |
| 2071 | |||
| 2072 | 6 | std::string VersionTranslator::update_1_0_2_to_1_0_3(const IdfFile& idf_1_0_2, const IddFileAndFactoryWrapper& idd_1_0_3) { | |
| 2073 |
1/1✓ Branch 1 taken 6 times.
|
6 | std::stringstream ss; |
| 2074 | |||
| 2075 |
4/4✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
✓ Branch 10 taken 6 times.
|
6 | ss << idf_1_0_2.header() << '\n' << '\n'; |
| 2076 | |||
| 2077 | // new version object | ||
| 2078 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
6 | IdfFile targetIdf(idd_1_0_3.iddFile()); |
| 2079 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
|
6 | ss << targetIdf.versionObject().get(); |
| 2080 | |||
| 2081 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 8 taken 1032 times.
✓ Branch 9 taken 6 times.
|
1038 | for (IdfObject& object : idf_1_0_2.objects()) { |
| 2082 | |||
| 2083 |
4/5✓ Branch 1 taken 1032 times.
✓ Branch 4 taken 1032 times.
✓ Branch 7 taken 1032 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 1032 times.
|
1032 | if (object.iddObject().name() == "OS:RadianceParameters") { |
| 2084 | ✗ | boost::optional<std::string> value = object.getString(14); | |
| 2085 | |||
| 2086 | ✗ | if (value && (*value == "581" || *value == "2321")) { | |
| 2087 | ✗ | IdfObject newParameters = object.clone(true); | |
| 2088 | |||
| 2089 | ✗ | if (*value == "581") { | |
| 2090 | ✗ | newParameters.setString(14, "578"); | |
| 2091 | } else { | ||
| 2092 | ✗ | newParameters.setString(14, "2306"); | |
| 2093 | } | ||
| 2094 | |||
| 2095 | ✗ | ss << newParameters; | |
| 2096 | ✗ | m_refactored.emplace_back(std::move(object), std::move(newParameters)); | |
| 2097 | ✗ | } else { | |
| 2098 | ✗ | ss << object; | |
| 2099 | } | ||
| 2100 | ✗ | } else { | |
| 2101 |
1/1✓ Branch 1 taken 1032 times.
|
1032 | ss << object; |
| 2102 | } | ||
| 2103 | 6 | } | |
| 2104 | |||
| 2105 |
1/1✓ Branch 1 taken 6 times.
|
12 | return ss.str(); |
| 2106 | 6 | } | |
| 2107 | |||
| 2108 | 6 | std::string VersionTranslator::update_1_2_2_to_1_2_3(const IdfFile& idf_1_2_2, const IddFileAndFactoryWrapper& idd_1_2_3) { | |
| 2109 |
1/1✓ Branch 1 taken 6 times.
|
6 | std::stringstream ss; |
| 2110 | |||
| 2111 |
4/4✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
✓ Branch 10 taken 6 times.
|
6 | ss << idf_1_2_2.header() << '\n' << '\n'; |
| 2112 | |||
| 2113 | // new version object | ||
| 2114 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
6 | IdfFile targetIdf(idd_1_2_3.iddFile()); |
| 2115 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
|
6 | ss << targetIdf.versionObject().get(); |
| 2116 | |||
| 2117 | 6 | boost::optional<int> numberOfStories; | |
| 2118 | 6 | boost::optional<int> numberOfAboveGroundStories; | |
| 2119 | 6 | boost::optional<std::string> buildingTypeValue; | |
| 2120 | 6 | boost::optional<IdfObject> buildingObject; | |
| 2121 | |||
| 2122 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 8 taken 1032 times.
✓ Branch 9 taken 6 times.
|
1038 | for (IdfObject& object : idf_1_2_2.objects()) { |
| 2123 | |||
| 2124 |
4/5✓ Branch 1 taken 1032 times.
✓ Branch 4 taken 1032 times.
✓ Branch 7 taken 1032 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 1032 times.
|
1032 | if (object.iddObject().name() == "OS:StandardsInformation:Construction") { |
| 2125 | ✗ | boost::optional<std::string> value = object.getString(2); // Intended Surface Type | |
| 2126 | |||
| 2127 | ✗ | if (value && (istringEqual(*value, "ExteriorFloor") || istringEqual(*value, "ExposedExteriorFloor"))) { | |
| 2128 | ✗ | IdfObject newObject = object.clone(true); | |
| 2129 | ✗ | if (istringEqual(*value, "ExteriorFloor")) { | |
| 2130 | ✗ | newObject.setString(2, "GroundContactFloor"); | |
| 2131 | } else { | ||
| 2132 | ✗ | newObject.setString(2, "ExteriorFloor"); | |
| 2133 | } | ||
| 2134 | ✗ | ss << newObject; | |
| 2135 | ✗ | m_refactored.emplace_back(std::move(object), std::move(newObject)); | |
| 2136 | ✗ | } else { | |
| 2137 | ✗ | ss << object; | |
| 2138 | } | ||
| 2139 | |||
| 2140 |
5/5✓ Branch 2 taken 1032 times.
✓ Branch 5 taken 1032 times.
✓ Branch 8 taken 1032 times.
✓ Branch 12 taken 5 times.
✓ Branch 13 taken 1027 times.
|
1032 | } else if (object.iddObject().name() == "OS:Building") { |
| 2141 | |||
| 2142 |
1/1✓ Branch 1 taken 5 times.
|
5 | buildingObject = object; |
| 2143 | |||
| 2144 |
4/5✓ Branch 1 taken 1027 times.
✓ Branch 4 taken 1027 times.
✓ Branch 7 taken 1027 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 1027 times.
|
1027 | } else if (object.iddObject().name() == "OS:StandardsInformation:Building") { |
| 2145 | |||
| 2146 | //Number of Stories | ||
| 2147 | ✗ | numberOfStories = object.getInt(1); | |
| 2148 | |||
| 2149 | // Number of Above Ground Stories | ||
| 2150 | ✗ | numberOfAboveGroundStories = object.getInt(2); | |
| 2151 | |||
| 2152 | // Building Type Value | ||
| 2153 | ✗ | buildingTypeValue = object.getString(6); | |
| 2154 | |||
| 2155 | ✗ | m_deprecated.push_back(object); | |
| 2156 | |||
| 2157 | } else { | ||
| 2158 |
1/1✓ Branch 1 taken 1027 times.
|
1027 | ss << object; |
| 2159 | } | ||
| 2160 | 6 | } | |
| 2161 | |||
| 2162 |
2/2✓ Branch 0 taken 5 times.
✓ Branch 1 taken 1 time.
|
6 | if (buildingObject) { |
| 2163 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | boost::optional<IddObject> buildingIdd = idd_1_2_3.getObject("OS:Building"); |
| 2164 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
✗ Branch 4 not taken.
|
5 | OS_ASSERT(buildingIdd); |
| 2165 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | IdfObject newBuildingObject(*buildingIdd); |
| 2166 | |||
| 2167 | // Handle | ||
| 2168 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | boost::optional<std::string> s = buildingObject->getString(0); |
| 2169 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if (s) { |
| 2170 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | bool test = newBuildingObject.setString(0, *s); |
| 2171 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
✗ Branch 3 not taken.
|
5 | OS_ASSERT(test); |
| 2172 | } | ||
| 2173 | |||
| 2174 | // Name | ||
| 2175 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | s = buildingObject->getString(1); |
| 2176 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if (s) { |
| 2177 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | bool test = newBuildingObject.setString(1, *s); |
| 2178 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
✗ Branch 3 not taken.
|
5 | OS_ASSERT(test); |
| 2179 | } | ||
| 2180 | |||
| 2181 | // Building Sector Type | ||
| 2182 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | s = buildingObject->getString(2); |
| 2183 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if (s) { |
| 2184 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | bool test = newBuildingObject.setString(2, *s); |
| 2185 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
✗ Branch 3 not taken.
|
5 | OS_ASSERT(test); |
| 2186 | } | ||
| 2187 | |||
| 2188 | // North Axis | ||
| 2189 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | s = buildingObject->getString(3); |
| 2190 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if (s) { |
| 2191 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | bool test = newBuildingObject.setString(3, *s); |
| 2192 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
✗ Branch 3 not taken.
|
5 | OS_ASSERT(test); |
| 2193 | } | ||
| 2194 | |||
| 2195 | // Nominal Floor to Floor Height | ||
| 2196 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | s = buildingObject->getString(4); |
| 2197 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if (s) { |
| 2198 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | bool test = newBuildingObject.setString(4, *s); |
| 2199 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
✗ Branch 3 not taken.
|
5 | OS_ASSERT(test); |
| 2200 | } | ||
| 2201 | |||
| 2202 | // Space Type Name | ||
| 2203 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | s = buildingObject->getString(5); |
| 2204 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if (s) { |
| 2205 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | bool test = newBuildingObject.setString(5, *s); |
| 2206 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
✗ Branch 3 not taken.
|
5 | OS_ASSERT(test); |
| 2207 | } | ||
| 2208 | |||
| 2209 | // Default Construction Set Name | ||
| 2210 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | s = buildingObject->getString(6); |
| 2211 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if (s) { |
| 2212 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | bool test = newBuildingObject.setString(6, *s); |
| 2213 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
✗ Branch 3 not taken.
|
5 | OS_ASSERT(test); |
| 2214 | } | ||
| 2215 | |||
| 2216 | // Default Schedule Set Name | ||
| 2217 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | s = buildingObject->getString(7); |
| 2218 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if (s) { |
| 2219 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | bool test = newBuildingObject.setString(7, *s); |
| 2220 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
✗ Branch 3 not taken.
|
5 | OS_ASSERT(test); |
| 2221 | } | ||
| 2222 | |||
| 2223 | // Standards Number of Stories | ||
| 2224 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
|
5 | if (numberOfStories) { |
| 2225 | ✗ | bool test = newBuildingObject.setInt(8, *numberOfStories); | |
| 2226 | ✗ | OS_ASSERT(test); | |
| 2227 | } | ||
| 2228 | |||
| 2229 | /// Standards Number of Above Ground Stories | ||
| 2230 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
|
5 | if (numberOfAboveGroundStories) { |
| 2231 | ✗ | bool test = newBuildingObject.setInt(9, *numberOfAboveGroundStories); | |
| 2232 | ✗ | OS_ASSERT(test); | |
| 2233 | } | ||
| 2234 | |||
| 2235 | // Standards Building Type | ||
| 2236 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
|
5 | if (buildingTypeValue) { |
| 2237 | ✗ | bool test = newBuildingObject.setString(10, *buildingTypeValue); | |
| 2238 | ✗ | OS_ASSERT(test); | |
| 2239 | } | ||
| 2240 | |||
| 2241 |
1/1✓ Branch 1 taken 5 times.
|
5 | ss << newBuildingObject; |
| 2242 |
2/2✓ Branch 2 taken 5 times.
✓ Branch 6 taken 5 times.
|
5 | m_refactored.emplace_back(std::move(*buildingObject), std::move(newBuildingObject)); |
| 2243 | 5 | } | |
| 2244 | |||
| 2245 |
1/1✓ Branch 1 taken 6 times.
|
12 | return ss.str(); |
| 2246 | 6 | } | |
| 2247 | |||
| 2248 | 6 | std::string VersionTranslator::update_1_3_4_to_1_3_5(const IdfFile& idf_1_3_4, const IddFileAndFactoryWrapper& idd_1_3_5) { | |
| 2249 |
1/1✓ Branch 1 taken 6 times.
|
6 | std::stringstream ss; |
| 2250 | |||
| 2251 |
4/4✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
✓ Branch 10 taken 6 times.
|
6 | ss << idf_1_3_4.header() << '\n' << '\n'; |
| 2252 | |||
| 2253 | // new version object | ||
| 2254 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
6 | IdfFile targetIdf(idd_1_3_5.iddFile()); |
| 2255 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
|
6 | ss << targetIdf.versionObject().get(); |
| 2256 | |||
| 2257 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 8 taken 1032 times.
✓ Branch 9 taken 6 times.
|
1038 | for (IdfObject& object : idf_1_3_4.objects()) { |
| 2258 | |||
| 2259 |
4/5✓ Branch 1 taken 1032 times.
✓ Branch 4 taken 1032 times.
✓ Branch 7 taken 1032 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 1032 times.
|
1032 | if (object.iddObject().name() == "OS:Refrigeration:WalkIn") { |
| 2260 | |||
| 2261 | ✗ | IdfObject newWalkin = object.clone(true); | |
| 2262 | |||
| 2263 | ✗ | boost::optional<std::string> s = object.getString(22); | |
| 2264 | ✗ | if (s) { | |
| 2265 | ✗ | bool test = newWalkin.setString(22, ""); | |
| 2266 | ✗ | OS_ASSERT(test); | |
| 2267 | ✗ | test = newWalkin.setString(23, *s); | |
| 2268 | ✗ | OS_ASSERT(test); | |
| 2269 | } | ||
| 2270 | |||
| 2271 | ✗ | ss << newWalkin; | |
| 2272 | ✗ | m_refactored.emplace_back(std::move(object), std::move(newWalkin)); | |
| 2273 | |||
| 2274 | ✗ | } else { | |
| 2275 | |||
| 2276 |
1/1✓ Branch 1 taken 1032 times.
|
1032 | ss << object; |
| 2277 | } | ||
| 2278 | 6 | } | |
| 2279 | |||
| 2280 |
1/1✓ Branch 1 taken 6 times.
|
12 | return ss.str(); |
| 2281 | 6 | } | |
| 2282 | |||
| 2283 | 6 | std::string VersionTranslator::update_1_5_3_to_1_5_4(const IdfFile& idf_1_5_3, const IddFileAndFactoryWrapper& idd_1_5_4) { | |
| 2284 |
1/1✓ Branch 1 taken 6 times.
|
6 | std::stringstream ss; |
| 2285 | |||
| 2286 |
4/4✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
✓ Branch 10 taken 6 times.
|
6 | ss << idf_1_5_3.header() << '\n' << '\n'; |
| 2287 | |||
| 2288 | // new version object | ||
| 2289 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
6 | IdfFile targetIdf(idd_1_5_4.iddFile()); |
| 2290 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
|
6 | ss << targetIdf.versionObject().get(); |
| 2291 | |||
| 2292 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 8 taken 1032 times.
✓ Branch 9 taken 6 times.
|
1038 | for (IdfObject& object : idf_1_5_3.objects()) { |
| 2293 |
4/5✓ Branch 1 taken 1032 times.
✓ Branch 4 taken 1032 times.
✓ Branch 7 taken 1032 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 1032 times.
|
1032 | if (object.iddObject().name() == "OS:TimeDependentValuation") { |
| 2294 | // put the object in the untranslated list | ||
| 2295 | ✗ | m_untranslated.emplace_back(std::move(object)); | |
| 2296 | } else { | ||
| 2297 |
1/1✓ Branch 1 taken 1032 times.
|
1032 | ss << object; |
| 2298 | } | ||
| 2299 | 6 | } | |
| 2300 | |||
| 2301 |
1/1✓ Branch 1 taken 6 times.
|
12 | return ss.str(); |
| 2302 | 6 | } | |
| 2303 | |||
| 2304 | 6 | std::string VersionTranslator::update_1_7_1_to_1_7_2(const IdfFile& idf_1_7_1, const IddFileAndFactoryWrapper& idd_1_7_2) { | |
| 2305 |
1/1✓ Branch 1 taken 6 times.
|
6 | std::stringstream ss; |
| 2306 | |||
| 2307 |
4/4✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
✓ Branch 10 taken 6 times.
|
6 | ss << idf_1_7_1.header() << '\n' << '\n'; |
| 2308 | |||
| 2309 | // new version object | ||
| 2310 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
6 | IdfFile targetIdf(idd_1_7_2.iddFile()); |
| 2311 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
|
6 | ss << targetIdf.versionObject().get(); |
| 2312 | |||
| 2313 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 8 taken 1032 times.
✓ Branch 9 taken 6 times.
|
1038 | for (IdfObject& object : idf_1_7_1.objects()) { |
| 2314 |
4/5✓ Branch 1 taken 1032 times.
✓ Branch 4 taken 1032 times.
✓ Branch 7 taken 1032 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 1032 times.
|
1032 | if (object.iddObject().name() == "OS:EvaporativeCooler:Direct:ResearchSpecial") { |
| 2315 | ✗ | auto iddObject = idd_1_7_2.getObject("OS:EvaporativeCooler:Direct:ResearchSpecial"); | |
| 2316 | ✗ | OS_ASSERT(iddObject); | |
| 2317 | ✗ | IdfObject newObject(iddObject.get()); | |
| 2318 | |||
| 2319 | ✗ | for (size_t i = 0; i < 10; ++i) { | |
| 2320 | ✗ | if (auto s = object.getString(i)) { | |
| 2321 | ✗ | newObject.setString(i, s.get()); | |
| 2322 | ✗ | } | |
| 2323 | } | ||
| 2324 | |||
| 2325 | ✗ | auto d = object.getDouble(4); | |
| 2326 | ✗ | if (!d) { | |
| 2327 | ✗ | newObject.setString(4, "Autosize"); | |
| 2328 | } | ||
| 2329 | ✗ | newObject.setDouble(11, 0.1); | |
| 2330 | |||
| 2331 | ✗ | ss << newObject; | |
| 2332 | ✗ | m_refactored.emplace_back(std::move(object), std::move(newObject)); | |
| 2333 |
4/5✓ Branch 3 taken 1032 times.
✓ Branch 6 taken 1032 times.
✓ Branch 9 taken 1032 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 1032 times.
|
1032 | } else if (object.iddObject().name() == "OS:EvaporativeCooler:Indirect:ResearchSpecial") { |
| 2334 | ✗ | auto iddObject = idd_1_7_2.getObject("OS:EvaporativeCooler:Indirect:ResearchSpecial"); | |
| 2335 | ✗ | OS_ASSERT(iddObject); | |
| 2336 | ✗ | IdfObject newObject(iddObject.get()); | |
| 2337 | |||
| 2338 | ✗ | for (size_t i = 0; i < 19; ++i) { | |
| 2339 | ✗ | if (auto s = object.getString(i)) { | |
| 2340 | ✗ | newObject.setString(i, s.get()); | |
| 2341 | ✗ | } | |
| 2342 | } | ||
| 2343 | |||
| 2344 | ✗ | auto d = object.getDouble(5); | |
| 2345 | ✗ | if (!d) { | |
| 2346 | ✗ | newObject.setString(5, "Autosize"); | |
| 2347 | } | ||
| 2348 | ✗ | newObject.setDouble(22, 0.1); | |
| 2349 | ✗ | newObject.setDouble(24, 1.0); | |
| 2350 | |||
| 2351 | ✗ | ss << newObject; | |
| 2352 | ✗ | m_refactored.emplace_back(std::move(object), std::move(newObject)); | |
| 2353 | ✗ | } else { | |
| 2354 |
1/1✓ Branch 1 taken 1032 times.
|
1032 | ss << object; |
| 2355 | } | ||
| 2356 | 6 | } | |
| 2357 | |||
| 2358 |
1/1✓ Branch 1 taken 6 times.
|
12 | return ss.str(); |
| 2359 | 6 | } | |
| 2360 | |||
| 2361 | 6 | std::string VersionTranslator::update_1_7_4_to_1_7_5(const IdfFile& idf_1_7_4, const IddFileAndFactoryWrapper& idd_1_7_5) { | |
| 2362 |
1/1✓ Branch 1 taken 6 times.
|
6 | std::stringstream ss; |
| 2363 | |||
| 2364 |
4/4✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
✓ Branch 10 taken 6 times.
|
6 | ss << idf_1_7_4.header() << '\n' << '\n'; |
| 2365 | |||
| 2366 | // new version object | ||
| 2367 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
6 | IdfFile targetIdf(idd_1_7_5.iddFile()); |
| 2368 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
|
6 | ss << targetIdf.versionObject().get(); |
| 2369 | |||
| 2370 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 8 taken 1032 times.
✓ Branch 9 taken 6 times.
|
1038 | for (IdfObject& object : idf_1_7_4.objects()) { |
| 2371 |
4/5✓ Branch 1 taken 1032 times.
✓ Branch 4 taken 1032 times.
✓ Branch 7 taken 1032 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 1032 times.
|
1032 | if (object.iddObject().name() == "OS:Sizing:System") { |
| 2372 | ✗ | auto iddObject = idd_1_7_5.getObject("OS:Sizing:System"); | |
| 2373 | ✗ | OS_ASSERT(iddObject); | |
| 2374 | ✗ | IdfObject newObject(iddObject.get()); | |
| 2375 | |||
| 2376 | ✗ | for (size_t i = 0; i < 21; ++i) { | |
| 2377 | ✗ | if (auto s = object.getString(i)) { | |
| 2378 | ✗ | newObject.setString(i, s.get()); | |
| 2379 | ✗ | } | |
| 2380 | } | ||
| 2381 | |||
| 2382 | ✗ | newObject.setDouble(21, 1.0); | |
| 2383 | ✗ | newObject.setDouble(22, 9.9676501E-3); | |
| 2384 | ✗ | newObject.setDouble(23, 1.0); | |
| 2385 | ✗ | newObject.setDouble(24, 3.9475456E-5); | |
| 2386 | ✗ | newObject.setDouble(25, 9.9676501E-3); | |
| 2387 | ✗ | newObject.setDouble(26, 1.0); | |
| 2388 | ✗ | newObject.setDouble(27, 1.0); | |
| 2389 | ✗ | newObject.setDouble(28, 3.1588213E-5); | |
| 2390 | ✗ | newObject.setString(29, "CoolingDesignCapacity"); | |
| 2391 | ✗ | newObject.setString(30, "Autosize"); | |
| 2392 | ✗ | newObject.setDouble(31, 234.7); | |
| 2393 | ✗ | newObject.setDouble(32, 1.0); | |
| 2394 | ✗ | newObject.setString(33, "HeatingDesignCapacity"); | |
| 2395 | ✗ | newObject.setString(34, "Autosize"); | |
| 2396 | ✗ | newObject.setDouble(35, 157.0); | |
| 2397 | ✗ | newObject.setDouble(36, 1.0); | |
| 2398 | ✗ | newObject.setString(37, "OnOff"); | |
| 2399 | |||
| 2400 | ✗ | ss << newObject; | |
| 2401 | ✗ | m_refactored.emplace_back(std::move(object), std::move(newObject)); | |
| 2402 |
4/5✓ Branch 3 taken 1032 times.
✓ Branch 6 taken 1032 times.
✓ Branch 9 taken 1032 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 1032 times.
|
1032 | } else if (object.iddObject().name() == "OS:Sizing:Plant") { |
| 2403 | ✗ | auto iddObject = idd_1_7_5.getObject("OS:Sizing:Plant"); | |
| 2404 | ✗ | OS_ASSERT(iddObject); | |
| 2405 | ✗ | IdfObject newObject(iddObject.get()); | |
| 2406 | |||
| 2407 | ✗ | for (size_t i = 0; i < 5; ++i) { | |
| 2408 | ✗ | if (auto s = object.getString(i)) { | |
| 2409 | ✗ | newObject.setString(i, s.get()); | |
| 2410 | ✗ | } | |
| 2411 | } | ||
| 2412 | |||
| 2413 | ✗ | newObject.setString(5, "NonCoincident"); | |
| 2414 | ✗ | newObject.setInt(6, 1); | |
| 2415 | ✗ | newObject.setString(7, "None"); | |
| 2416 | |||
| 2417 | ✗ | ss << newObject; | |
| 2418 | ✗ | m_refactored.emplace_back(std::move(object), std::move(newObject)); | |
| 2419 |
4/5✓ Branch 3 taken 1032 times.
✓ Branch 6 taken 1032 times.
✓ Branch 9 taken 1032 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 1032 times.
|
1032 | } else if (object.iddObject().name() == "OS:DistrictCooling") { |
| 2420 | ✗ | IdfObject newObject = object.clone(true); | |
| 2421 | |||
| 2422 | ✗ | if (!object.getDouble(4)) { | |
| 2423 | ✗ | newObject.setString(4, "Autosize"); | |
| 2424 | } | ||
| 2425 | |||
| 2426 | ✗ | ss << newObject; | |
| 2427 | ✗ | m_refactored.emplace_back(std::move(object), std::move(newObject)); | |
| 2428 |
4/5✓ Branch 2 taken 1032 times.
✓ Branch 5 taken 1032 times.
✓ Branch 8 taken 1032 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 1032 times.
|
1032 | } else if (object.iddObject().name() == "OS:DistrictHeating") { |
| 2429 | ✗ | IdfObject newObject = object.clone(true); | |
| 2430 | |||
| 2431 | ✗ | if (!object.getDouble(4)) { | |
| 2432 | ✗ | newObject.setString(4, "Autosize"); | |
| 2433 | } | ||
| 2434 | |||
| 2435 | ✗ | ss << newObject; | |
| 2436 | ✗ | m_refactored.emplace_back(std::move(object), std::move(newObject)); | |
| 2437 |
4/5✓ Branch 2 taken 1032 times.
✓ Branch 5 taken 1032 times.
✓ Branch 8 taken 1032 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 1032 times.
|
1032 | } else if (object.iddObject().name() == "OS:Humidifier:Steam:Electric") { |
| 2438 | ✗ | IdfObject newObject = object.clone(true); | |
| 2439 | |||
| 2440 | ✗ | if (!object.getDouble(3)) { | |
| 2441 | ✗ | newObject.setString(4, "Autosize"); | |
| 2442 | } | ||
| 2443 | |||
| 2444 | ✗ | ss << newObject; | |
| 2445 | ✗ | m_refactored.emplace_back(std::move(object), std::move(newObject)); | |
| 2446 | ✗ | } else { | |
| 2447 |
1/1✓ Branch 1 taken 1032 times.
|
1032 | ss << object; |
| 2448 | } | ||
| 2449 | 6 | } | |
| 2450 | |||
| 2451 |
1/1✓ Branch 1 taken 6 times.
|
12 | return ss.str(); |
| 2452 | 6 | } | |
| 2453 | |||
| 2454 | 6 | std::string VersionTranslator::update_1_8_3_to_1_8_4(const IdfFile& idf_1_8_3, const IddFileAndFactoryWrapper& idd_1_8_4) { | |
| 2455 |
1/1✓ Branch 1 taken 6 times.
|
6 | std::stringstream ss; |
| 2456 | |||
| 2457 |
4/4✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
✓ Branch 10 taken 6 times.
|
6 | ss << idf_1_8_3.header() << '\n' << '\n'; |
| 2458 | |||
| 2459 | // new version object | ||
| 2460 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
6 | IdfFile targetIdf(idd_1_8_4.iddFile()); |
| 2461 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
|
6 | ss << targetIdf.versionObject().get(); |
| 2462 | |||
| 2463 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 8 taken 1032 times.
✓ Branch 9 taken 6 times.
|
1038 | for (IdfObject& object : idf_1_8_3.objects()) { |
| 2464 |
2/2✓ Branch 1 taken 1032 times.
✓ Branch 4 taken 1032 times.
|
1032 | auto iddname = object.iddObject().name(); |
| 2465 |
2/3✓ Branch 1 taken 1032 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1032 times.
|
1032 | if (iddname == "OS:PlantLoop") { |
| 2466 | ✗ | auto iddObject = idd_1_8_4.getObject("OS:PlantLoop"); | |
| 2467 | ✗ | OS_ASSERT(iddObject); | |
| 2468 | ✗ | IdfObject newObject(iddObject.get()); | |
| 2469 | |||
| 2470 | ✗ | for (size_t i = 0; i < 4; ++i) { | |
| 2471 | ✗ | if (auto s = object.getString(i)) { | |
| 2472 | ✗ | newObject.setString(i, s.get()); | |
| 2473 | ✗ | } | |
| 2474 | } | ||
| 2475 | |||
| 2476 | ✗ | for (size_t i = 5; i < 23; ++i) { | |
| 2477 | ✗ | if (auto s = object.getString(i)) { | |
| 2478 | ✗ | newObject.setString(i + 2, s.get()); | |
| 2479 | ✗ | } | |
| 2480 | } | ||
| 2481 | |||
| 2482 | ✗ | ss << newObject; | |
| 2483 | ✗ | m_refactored.emplace_back(std::move(object), std::move(newObject)); | |
| 2484 |
2/3✓ Branch 3 taken 1032 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1032 times.
|
1032 | } else if (iddname == "OS:AirLoopHVAC") { |
| 2485 | ✗ | auto iddObject = idd_1_8_4.getObject("OS:AirLoopHVAC"); | |
| 2486 | ✗ | OS_ASSERT(iddObject); | |
| 2487 | ✗ | IdfObject newObject(iddObject.get()); | |
| 2488 | |||
| 2489 | // Handle | ||
| 2490 | ✗ | if (auto value = object.getString(0)) { | |
| 2491 | ✗ | newObject.setString(0, value.get()); | |
| 2492 | ✗ | } | |
| 2493 | |||
| 2494 | // Name | ||
| 2495 | ✗ | if (auto value = object.getString(1)) { | |
| 2496 | ✗ | newObject.setString(1, value.get()); | |
| 2497 | ✗ | } | |
| 2498 | |||
| 2499 | // Controller List Name | ||
| 2500 | // Not used | ||
| 2501 | |||
| 2502 | // AvailabilityManagerAssignmentList | ||
| 2503 | ✗ | auto availabilityManagerListHandle = object.getString(3); | |
| 2504 | ✗ | OS_ASSERT(availabilityManagerListHandle); | |
| 2505 | ✗ | auto availabilityManagerList = idf_1_8_3.getObject(toUUID(availabilityManagerListHandle.get())); | |
| 2506 | ✗ | OS_ASSERT(availabilityManagerList); | |
| 2507 | |||
| 2508 | ✗ | auto availabilityManagerScheduledHandle = availabilityManagerList->getString(2); | |
| 2509 | ✗ | OS_ASSERT(availabilityManagerScheduledHandle); | |
| 2510 | ✗ | auto availabilityManagerScheduled = idf_1_8_3.getObject(toUUID(availabilityManagerScheduledHandle.get())); | |
| 2511 | ✗ | OS_ASSERT(availabilityManagerScheduled); | |
| 2512 | |||
| 2513 | ✗ | auto availabilityScheduleHandle = availabilityManagerScheduled->getString(2); | |
| 2514 | ✗ | OS_ASSERT(availabilityScheduleHandle); | |
| 2515 | ✗ | auto availabilitySchedule = idf_1_8_3.getObject(toUUID(availabilityScheduleHandle.get())); | |
| 2516 | ✗ | OS_ASSERT(availabilitySchedule); | |
| 2517 | |||
| 2518 | ✗ | auto availabilityManagerNightCycleHandle = availabilityManagerList->getString(3); | |
| 2519 | ✗ | OS_ASSERT(availabilityManagerNightCycleHandle); | |
| 2520 | ✗ | auto availabilityManagerNightCycle = idf_1_8_3.getObject(toUUID(availabilityManagerNightCycleHandle.get())); | |
| 2521 | ✗ | OS_ASSERT(availabilityManagerNightCycle); | |
| 2522 | |||
| 2523 | ✗ | auto controlType = availabilityManagerNightCycle->getString(4); | |
| 2524 | |||
| 2525 | // Availability Schedule | ||
| 2526 | ✗ | newObject.setString(3, toString(availabilitySchedule->handle())); | |
| 2527 | |||
| 2528 | // Availability Manager | ||
| 2529 | ✗ | if (controlType | |
| 2530 | ✗ | && (istringEqual("CycleOnAny", controlType.get()) || istringEqual("CycleOnControlZone", controlType.get()) | |
| 2531 | ✗ | || istringEqual("CycleOnAnyZoneFansOnly", controlType.get()))) { | |
| 2532 | ✗ | newObject.setString(4, toString(availabilityManagerNightCycle->handle())); | |
| 2533 | } | ||
| 2534 | |||
| 2535 | // All the remaining fields are unchanged but shifted down one to account for new field | ||
| 2536 | ✗ | for (size_t i = 4; i < 15; ++i) { | |
| 2537 | ✗ | if (auto value = object.getString(i)) { | |
| 2538 | ✗ | newObject.setString(i + 1, value.get()); | |
| 2539 | ✗ | } | |
| 2540 | } | ||
| 2541 | |||
| 2542 | ✗ | ss << newObject; | |
| 2543 | ✗ | m_refactored.emplace_back(std::move(object), std::move(newObject)); | |
| 2544 |
2/3✓ Branch 12 taken 1032 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 1032 times.
|
1032 | } else if (iddname == "OS:AvailabilityManager:Scheduled") { |
| 2545 | ✗ | m_deprecated.push_back(object); | |
| 2546 |
2/3✓ Branch 1 taken 1032 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1032 times.
|
1032 | } else if (iddname == "OS:AvailabilityManagerAssignmentList") { |
| 2547 | ✗ | m_deprecated.push_back(object); | |
| 2548 |
2/3✓ Branch 1 taken 1032 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1032 times.
|
1032 | } else if (iddname == "OS:AvailabilityManager:NightCycle") { |
| 2549 | ✗ | auto controlType = object.getString(4); | |
| 2550 | ✗ | if (controlType | |
| 2551 | ✗ | && (istringEqual("CycleOnAny", controlType.get()) || istringEqual("CycleOnControlZone", controlType.get()) | |
| 2552 | ✗ | || istringEqual("CycleOnAnyZoneFansOnly", controlType.get()))) { | |
| 2553 | ✗ | ss << object; | |
| 2554 | } else { | ||
| 2555 | ✗ | m_deprecated.push_back(object); | |
| 2556 | } | ||
| 2557 | ✗ | } else { | |
| 2558 |
1/1✓ Branch 1 taken 1032 times.
|
1032 | ss << object; |
| 2559 | } | ||
| 2560 | 1038 | } | |
| 2561 | |||
| 2562 |
1/1✓ Branch 1 taken 6 times.
|
12 | return ss.str(); |
| 2563 | 6 | } | |
| 2564 | |||
| 2565 | 6 | std::string VersionTranslator::update_1_8_4_to_1_8_5(const IdfFile& idf_1_8_4, const IddFileAndFactoryWrapper& idd_1_8_5) { | |
| 2566 |
1/1✓ Branch 1 taken 6 times.
|
6 | std::stringstream ss; |
| 2567 | |||
| 2568 |
4/4✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
✓ Branch 10 taken 6 times.
|
6 | ss << idf_1_8_4.header() << '\n' << '\n'; |
| 2569 | |||
| 2570 | // new version object | ||
| 2571 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
6 | IdfFile targetIdf(idd_1_8_5.iddFile()); |
| 2572 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
|
6 | ss << targetIdf.versionObject().get(); |
| 2573 | |||
| 2574 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 8 taken 1032 times.
✓ Branch 9 taken 6 times.
|
1038 | for (const IdfObject& object : idf_1_8_4.objects()) { |
| 2575 |
2/2✓ Branch 1 taken 1032 times.
✓ Branch 4 taken 1032 times.
|
1032 | auto iddname = object.iddObject().name(); |
| 2576 |
2/3✓ Branch 1 taken 1032 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1032 times.
|
1032 | if (iddname == "OS:SetpointManager:Scheduled") { |
| 2577 | ✗ | if ((!object.getString(2)) || object.getString(2).get().empty()) { | |
| 2578 | ✗ | auto iddObject = idd_1_8_5.getObject("OS:SetpointManager::Scheduled"); | |
| 2579 | ✗ | OS_ASSERT(iddObject); | |
| 2580 | ✗ | IdfObject newObject(iddObject.get()); | |
| 2581 | |||
| 2582 | ✗ | for (size_t i = 0; i < 5; ++i) { | |
| 2583 | ✗ | if (i == 2) { | |
| 2584 | ✗ | newObject.setString(i, "Temperature"); | |
| 2585 | ✗ | } else if (auto s = object.getString(i)) { | |
| 2586 | ✗ | newObject.setString(i, s.get()); | |
| 2587 | ✗ | } | |
| 2588 | } | ||
| 2589 | ✗ | ss << newObject; | |
| 2590 | ✗ | } else { | |
| 2591 | ✗ | ss << object; | |
| 2592 | } | ||
| 2593 |
2/3✓ Branch 1 taken 1032 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1032 times.
|
1032 | } else if (iddname == "OS:PlantLoop") { |
| 2594 | ✗ | if ((!object.getString(20)) || object.getString(20).get().empty()) { | |
| 2595 | ✗ | auto iddObject = idd_1_8_5.getObject("OS:PlantLoop"); | |
| 2596 | ✗ | OS_ASSERT(iddObject); | |
| 2597 | ✗ | IdfObject newObject(iddObject.get()); | |
| 2598 | |||
| 2599 | ✗ | for (size_t i = 0; i < 25; ++i) { | |
| 2600 | ✗ | if (i == 20) { | |
| 2601 | ✗ | newObject.setString(i, "Optimal"); | |
| 2602 | ✗ | } else if (auto s = object.getString(i)) { | |
| 2603 | ✗ | newObject.setString(i, s.get()); | |
| 2604 | ✗ | } | |
| 2605 | } | ||
| 2606 | ✗ | ss << newObject; | |
| 2607 | ✗ | } else { | |
| 2608 | ✗ | ss << object; | |
| 2609 | } | ||
| 2610 | } else { | ||
| 2611 |
1/1✓ Branch 1 taken 1032 times.
|
1032 | ss << object; |
| 2612 | } | ||
| 2613 | 1038 | } | |
| 2614 | |||
| 2615 |
1/1✓ Branch 1 taken 6 times.
|
12 | return ss.str(); |
| 2616 | 6 | } | |
| 2617 | |||
| 2618 | 6 | std::string VersionTranslator::update_1_8_5_to_1_9_0(const IdfFile& idf_1_8_5, const IddFileAndFactoryWrapper& idd_1_9_0) { | |
| 2619 |
1/1✓ Branch 1 taken 6 times.
|
6 | std::stringstream ss; |
| 2620 | |||
| 2621 |
4/4✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
✓ Branch 10 taken 6 times.
|
6 | ss << idf_1_8_5.header() << '\n' << '\n'; |
| 2622 | |||
| 2623 | // new version object | ||
| 2624 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
6 | IdfFile targetIdf(idd_1_9_0.iddFile()); |
| 2625 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
|
6 | ss << targetIdf.versionObject().get(); |
| 2626 | |||
| 2627 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 8 taken 1032 times.
✓ Branch 9 taken 6 times.
|
1038 | for (IdfObject& object : idf_1_8_5.objects()) { |
| 2628 |
2/2✓ Branch 1 taken 1032 times.
✓ Branch 4 taken 1032 times.
|
1032 | auto iddname = object.iddObject().name(); |
| 2629 |
2/3✓ Branch 1 taken 1032 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1032 times.
|
1032 | if (iddname == "OS:SpaceInfiltration:EffectiveLeakageArea") { |
| 2630 | ✗ | auto iddObject = idd_1_9_0.getObject("OS:SpaceInfiltration:EffectiveLeakageArea"); | |
| 2631 | ✗ | OS_ASSERT(iddObject); | |
| 2632 | ✗ | IdfObject newObject(iddObject.get()); | |
| 2633 | |||
| 2634 | ✗ | for (size_t i = 0; i < object.numNonextensibleFields(); ++i) { | |
| 2635 | ✗ | if (i == 4) { | |
| 2636 | ✗ | if (auto value = object.getDouble(i)) { | |
| 2637 | ✗ | newObject.setDouble(i, convert(value.get(), "m^2", "cm^2").get()); | |
| 2638 | } | ||
| 2639 | ✗ | } else if (auto s = object.getString(i)) { | |
| 2640 | ✗ | newObject.setString(i, s.get()); | |
| 2641 | ✗ | } | |
| 2642 | } | ||
| 2643 | ✗ | ss << newObject; | |
| 2644 | ✗ | m_refactored.emplace_back(std::move(object), std::move(newObject)); | |
| 2645 | ✗ | } else { | |
| 2646 |
1/1✓ Branch 1 taken 1032 times.
|
1032 | ss << object; |
| 2647 | } | ||
| 2648 | 1038 | } | |
| 2649 | |||
| 2650 |
1/1✓ Branch 1 taken 6 times.
|
12 | return ss.str(); |
| 2651 | 6 | } | |
| 2652 | |||
| 2653 | 6 | std::string VersionTranslator::update_1_9_2_to_1_9_3(const IdfFile& idf_1_9_2, const IddFileAndFactoryWrapper& idd_1_9_3) { | |
| 2654 |
1/1✓ Branch 1 taken 6 times.
|
6 | std::stringstream ss; |
| 2655 | |||
| 2656 |
4/4✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
✓ Branch 10 taken 6 times.
|
6 | ss << idf_1_9_2.header() << '\n' << '\n'; |
| 2657 | |||
| 2658 | // new version object | ||
| 2659 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
6 | IdfFile targetIdf(idd_1_9_3.iddFile()); |
| 2660 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
|
6 | ss << targetIdf.versionObject().get(); |
| 2661 | |||
| 2662 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 8 taken 1032 times.
✓ Branch 9 taken 6 times.
|
1038 | for (IdfObject& object : idf_1_9_2.objects()) { |
| 2663 |
2/2✓ Branch 1 taken 1032 times.
✓ Branch 4 taken 1032 times.
|
1032 | auto iddname = object.iddObject().name(); |
| 2664 | |||
| 2665 |
2/3✓ Branch 1 taken 1032 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1032 times.
|
1032 | if (iddname == "OS:EvaporativeCooler:Direct:ResearchSpecial") { |
| 2666 | ✗ | auto iddObject = idd_1_9_3.getObject("OS:EvaporativeCooler:Direct:ResearchSpecial"); | |
| 2667 | ✗ | OS_ASSERT(iddObject); | |
| 2668 | ✗ | IdfObject newObject(iddObject.get()); | |
| 2669 | ✗ | for (size_t i = 0; i < object.numNonextensibleFields(); ++i) { | |
| 2670 | ✗ | if (i < 5) { | |
| 2671 | ✗ | if (auto value = object.getString(i)) { | |
| 2672 | ✗ | newObject.setString(i, value.get()); | |
| 2673 | ✗ | } | |
| 2674 | ✗ | } else if (i == 5) { | |
| 2675 | ✗ | if (auto value = object.getString(i)) { | |
| 2676 | ✗ | newObject.setString(i + 1, value.get()); | |
| 2677 | ✗ | } | |
| 2678 | ✗ | newObject.setString(i, "Autosize"); | |
| 2679 | } else { | ||
| 2680 | ✗ | if (auto value = object.getString(i)) { | |
| 2681 | ✗ | newObject.setString(i + 1, value.get()); | |
| 2682 | ✗ | } | |
| 2683 | } | ||
| 2684 | } | ||
| 2685 | ✗ | ss << newObject; | |
| 2686 | ✗ | m_refactored.emplace_back(std::move(object), std::move(newObject)); | |
| 2687 | |||
| 2688 |
2/3✓ Branch 3 taken 1032 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1032 times.
|
1032 | } else if (iddname == "OS:ZoneAirMassFlowConservation") { |
| 2689 | ✗ | auto iddObject = idd_1_9_3.getObject("OS:ZoneAirMassFlowConservation"); | |
| 2690 | ✗ | OS_ASSERT(iddObject); | |
| 2691 | ✗ | IdfObject newObject(iddObject.get()); | |
| 2692 | |||
| 2693 | ✗ | if (auto value = object.getString(0)) { // Handle -> Handle | |
| 2694 | ✗ | newObject.setString(0, value.get()); | |
| 2695 | ✗ | } | |
| 2696 | ✗ | if (auto value = | |
| 2697 | ✗ | object.getString(1)) { // Adjust Zone Mixing For Zone Air Mass Flow Balance -> Adjust Zone Mixing For Zone Air Mass Flow Balance | |
| 2698 | ✗ | newObject.setString(1, value.get()); | |
| 2699 | } else { | ||
| 2700 | // old default was Yes, new default is No | ||
| 2701 | ✗ | } | |
| 2702 | ✗ | if (auto value = object.getString(2)) { // Source Zone Infiltration Treatment -> Infiltration Balancing Method | |
| 2703 | // old default was AddInfiltrationFlow, new default is AddInfiltrationFlow | ||
| 2704 | // old keys AddInfiltrationFlow, AdjustInfiltrationFlow | ||
| 2705 | // new keys AddInfiltrationFlow, AdjustInfiltrationFlow, None | ||
| 2706 | ✗ | newObject.setString(2, value.get()); | |
| 2707 | ✗ | } | |
| 2708 | // new field Infiltration Balancing Zones is defaulted to MixingSourceZonesOnly | ||
| 2709 | ✗ | ss << newObject; | |
| 2710 | ✗ | m_refactored.emplace_back(std::move(object), std::move(newObject)); | |
| 2711 |
2/3✓ Branch 3 taken 1032 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1032 times.
|
1032 | } else if (iddname == "OS:AirTerminal:SingleDuct:VAV:Reheat") { |
| 2712 | ✗ | auto iddObject = idd_1_9_3.getObject("OS:AirTerminal:SingleDuct:VAV:Reheat"); | |
| 2713 | ✗ | OS_ASSERT(iddObject); | |
| 2714 | ✗ | IdfObject newObject(iddObject.get()); | |
| 2715 | |||
| 2716 | ✗ | for (size_t i = 0; i < object.numNonextensibleFields(); ++i) { | |
| 2717 | ✗ | if (auto value = object.getString(i)) { | |
| 2718 | ✗ | newObject.setString(i, value.get()); | |
| 2719 | ✗ | } | |
| 2720 | } | ||
| 2721 | |||
| 2722 | ✗ | newObject.setString(18, "No"); | |
| 2723 | |||
| 2724 | ✗ | ss << newObject; | |
| 2725 | ✗ | m_refactored.emplace_back(std::move(object), std::move(newObject)); | |
| 2726 |
2/3✓ Branch 3 taken 1032 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1032 times.
|
1032 | } else if (iddname == "OS:AirTerminal:SingleDuct:VAV:NoReheat") { |
| 2727 | ✗ | auto iddObject = idd_1_9_3.getObject("OS:AirTerminal:SingleDuct:VAV:NoReheat"); | |
| 2728 | ✗ | OS_ASSERT(iddObject); | |
| 2729 | ✗ | IdfObject newObject(iddObject.get()); | |
| 2730 | |||
| 2731 | ✗ | for (size_t i = 0; i < object.numNonextensibleFields(); ++i) { | |
| 2732 | ✗ | if (auto value = object.getString(i)) { | |
| 2733 | ✗ | newObject.setString(i, value.get()); | |
| 2734 | ✗ | } | |
| 2735 | } | ||
| 2736 | |||
| 2737 | ✗ | newObject.setString(10, "No"); | |
| 2738 | |||
| 2739 | ✗ | ss << newObject; | |
| 2740 | ✗ | m_refactored.emplace_back(std::move(object), std::move(newObject)); | |
| 2741 | ✗ | } else { | |
| 2742 |
1/1✓ Branch 1 taken 1032 times.
|
1032 | ss << object; |
| 2743 | } | ||
| 2744 | 1038 | } | |
| 2745 | |||
| 2746 |
1/1✓ Branch 1 taken 6 times.
|
12 | return ss.str(); |
| 2747 | 6 | } | |
| 2748 | |||
| 2749 | 6 | std::string VersionTranslator::update_1_9_4_to_1_9_5(const IdfFile& idf_1_9_4, const IddFileAndFactoryWrapper& idd_1_9_5) { | |
| 2750 |
1/1✓ Branch 1 taken 6 times.
|
6 | std::stringstream ss; |
| 2751 | |||
| 2752 |
4/4✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
✓ Branch 10 taken 6 times.
|
6 | ss << idf_1_9_4.header() << '\n' << '\n'; |
| 2753 | |||
| 2754 | // new version object | ||
| 2755 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
6 | IdfFile targetIdf(idd_1_9_5.iddFile()); |
| 2756 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
|
6 | ss << targetIdf.versionObject().get(); |
| 2757 | |||
| 2758 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 8 taken 1032 times.
✓ Branch 9 taken 6 times.
|
1038 | for (IdfObject& object : idf_1_9_4.objects()) { |
| 2759 |
2/2✓ Branch 1 taken 1032 times.
✓ Branch 4 taken 1032 times.
|
1032 | auto iddname = object.iddObject().name(); |
| 2760 | |||
| 2761 |
2/3✓ Branch 1 taken 1032 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1032 times.
|
1032 | if (iddname == "OS:Controller:WaterCoil") { |
| 2762 | ✗ | auto iddObject = idd_1_9_5.getObject("OS:Controller:WaterCoil"); | |
| 2763 | ✗ | OS_ASSERT(iddObject); | |
| 2764 | ✗ | IdfObject newObject(iddObject.get()); | |
| 2765 | |||
| 2766 | ✗ | for (size_t i = 0, j = 0; i < object.numNonextensibleFields(); ++i) { | |
| 2767 | ✗ | if (auto value = object.getString(i)) { | |
| 2768 | ✗ | newObject.setString(j, value.get()); | |
| 2769 | ✗ | } | |
| 2770 | ✗ | if (i == 1) { | |
| 2771 | // new field after i = 1 | ||
| 2772 | ✗ | ++j; | |
| 2773 | } | ||
| 2774 | ✗ | ++j; | |
| 2775 | } | ||
| 2776 | |||
| 2777 | // Figure out value of new field j = 2 | ||
| 2778 | // This is the handle of the associated water coil | ||
| 2779 | // Past versions made this connection by matching the controller actuator node | ||
| 2780 | // to the coil water inlet node. | ||
| 2781 | // To do this version translation we have to track down that node | ||
| 2782 | ✗ | if (auto actuatorNodeHandle = object.getString(6)) { | |
| 2783 | ✗ | auto coilHandle = [&](const IddObject& type, unsigned waterInletIndex) { | |
| 2784 | ✗ | boost::optional<std::string> result; | |
| 2785 | ✗ | auto coils = idf_1_9_4.getObjectsByType(type); | |
| 2786 | ✗ | for (const auto& coil : coils) { | |
| 2787 | // waterInletConnection will be a handle to a connection object | ||
| 2788 | ✗ | if (auto waterInletConnectionHandle = coil.getString(waterInletIndex)) { | |
| 2789 | ✗ | if (auto waterInletConnection = idf_1_9_4.getObject(toUUID(waterInletConnectionHandle.get()))) { | |
| 2790 | ✗ | if (auto sourceHandle = waterInletConnection->getString(2)) { | |
| 2791 | ✗ | if (sourceHandle.get() == actuatorNodeHandle.get()) { | |
| 2792 | ✗ | result = toString(coil.handle()); | |
| 2793 | ✗ | break; | |
| 2794 | } | ||
| 2795 | ✗ | } | |
| 2796 | ✗ | } | |
| 2797 | ✗ | } | |
| 2798 | } | ||
| 2799 | ✗ | return result; | |
| 2800 | ✗ | }; | |
| 2801 | ✗ | if (auto handle = coilHandle(idf_1_9_4.iddFile().getObject("OS:Coil:Cooling:Water").get(), 10)) { | |
| 2802 | ✗ | newObject.setString(2, handle.get()); | |
| 2803 | ✗ | } else if (auto handle = coilHandle(idf_1_9_4.iddFile().getObject("OS:Coil:Heating:Water").get(), 5)) { | |
| 2804 | ✗ | newObject.setString(2, handle.get()); | |
| 2805 | ✗ | } | |
| 2806 | ✗ | } | |
| 2807 | |||
| 2808 | ✗ | ss << newObject; | |
| 2809 | ✗ | m_refactored.emplace_back(std::move(object), std::move(newObject)); | |
| 2810 | ✗ | } else { | |
| 2811 |
1/1✓ Branch 1 taken 1032 times.
|
1032 | ss << object; |
| 2812 | } | ||
| 2813 | 1038 | } | |
| 2814 | |||
| 2815 |
1/1✓ Branch 1 taken 6 times.
|
12 | return ss.str(); |
| 2816 | 6 | } | |
| 2817 | |||
| 2818 | 6 | std::string VersionTranslator::update_1_9_5_to_1_10_0(const IdfFile& idf_1_9_5, const IddFileAndFactoryWrapper& idd_1_10_0) { | |
| 2819 |
1/1✓ Branch 1 taken 6 times.
|
6 | std::stringstream ss; |
| 2820 | |||
| 2821 |
4/4✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
✓ Branch 10 taken 6 times.
|
6 | ss << idf_1_9_5.header() << '\n' << '\n'; |
| 2822 | |||
| 2823 | // new version object | ||
| 2824 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
6 | IdfFile targetIdf(idd_1_10_0.iddFile()); |
| 2825 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
|
6 | ss << targetIdf.versionObject().get(); |
| 2826 | |||
| 2827 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 8 taken 1032 times.
✓ Branch 9 taken 6 times.
|
1038 | for (IdfObject& object : idf_1_9_5.objects()) { |
| 2828 |
2/2✓ Branch 1 taken 1032 times.
✓ Branch 4 taken 1032 times.
|
1032 | auto iddname = object.iddObject().name(); |
| 2829 | |||
| 2830 |
2/3✓ Branch 1 taken 1032 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1032 times.
|
1032 | if (iddname == "OS:AirTerminal:SingleDuct:VAV:Reheat") { |
| 2831 | ✗ | auto iddObject = idd_1_10_0.getObject("OS:AirTerminal:SingleDuct:VAV:Reheat"); | |
| 2832 | ✗ | OS_ASSERT(iddObject); | |
| 2833 | ✗ | IdfObject newObject(iddObject.get()); | |
| 2834 | |||
| 2835 | ✗ | for (size_t i = 0; i < object.numNonextensibleFields(); ++i) { | |
| 2836 | ✗ | if (auto value = object.getString(i)) { | |
| 2837 | ✗ | newObject.setString(i, value.get()); | |
| 2838 | ✗ | } | |
| 2839 | } | ||
| 2840 | |||
| 2841 | // This is a redo because some models didn't get updated by the logic in | ||
| 2842 | // 1.9.2 -> 1.9.3 | ||
| 2843 | { | ||
| 2844 | ✗ | auto controlForOA = object.getString(18); | |
| 2845 | ✗ | if ((!controlForOA) || controlForOA->empty()) { | |
| 2846 | ✗ | newObject.setString(18, "No"); | |
| 2847 | } | ||
| 2848 | ✗ | } | |
| 2849 | |||
| 2850 | ✗ | ss << newObject; | |
| 2851 | ✗ | m_refactored.emplace_back(std::move(object), std::move(newObject)); | |
| 2852 |
2/3✓ Branch 3 taken 1032 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1032 times.
|
1032 | } else if (iddname == "OS:AirTerminal:SingleDuct:VAV:NoReheat") { |
| 2853 | ✗ | auto iddObject = idd_1_10_0.getObject("OS:AirTerminal:SingleDuct:VAV:NoReheat"); | |
| 2854 | ✗ | OS_ASSERT(iddObject); | |
| 2855 | ✗ | IdfObject newObject(iddObject.get()); | |
| 2856 | |||
| 2857 | ✗ | for (size_t i = 0; i < object.numNonextensibleFields(); ++i) { | |
| 2858 | ✗ | if (auto value = object.getString(i)) { | |
| 2859 | ✗ | newObject.setString(i, value.get()); | |
| 2860 | ✗ | } | |
| 2861 | } | ||
| 2862 | |||
| 2863 | ✗ | newObject.setString(10, "No"); | |
| 2864 | // This is a redo because some models didn't get updated by the logic in | ||
| 2865 | // 1.9.2 -> 1.9.3 | ||
| 2866 | { | ||
| 2867 | ✗ | auto controlForOA = object.getString(10); | |
| 2868 | ✗ | if ((!controlForOA) || controlForOA->empty()) { | |
| 2869 | ✗ | newObject.setString(10, "No"); | |
| 2870 | } | ||
| 2871 | ✗ | } | |
| 2872 | |||
| 2873 | ✗ | ss << newObject; | |
| 2874 | ✗ | m_refactored.emplace_back(std::move(object), std::move(newObject)); | |
| 2875 | ✗ | } else { | |
| 2876 |
1/1✓ Branch 1 taken 1032 times.
|
1032 | ss << object; |
| 2877 | } | ||
| 2878 | 1038 | } | |
| 2879 | |||
| 2880 |
1/1✓ Branch 1 taken 6 times.
|
12 | return ss.str(); |
| 2881 | 6 | } | |
| 2882 | |||
| 2883 | 6 | std::string VersionTranslator::update_1_10_1_to_1_10_2(const IdfFile& idf_1_10_1, const IddFileAndFactoryWrapper& idd_1_10_2) { | |
| 2884 | |||
| 2885 |
1/1✓ Branch 1 taken 6 times.
|
6 | std::stringstream ss; |
| 2886 | |||
| 2887 |
4/4✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
✓ Branch 10 taken 6 times.
|
6 | ss << idf_1_10_1.header() << '\n' << '\n'; |
| 2888 | |||
| 2889 | // new version object | ||
| 2890 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
6 | IdfFile targetIdf(idd_1_10_2.iddFile()); |
| 2891 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
|
6 | ss << targetIdf.versionObject().get(); |
| 2892 | |||
| 2893 |
5/5✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
✓ Branch 10 taken 6 times.
✓ Branch 13 taken 6 times.
|
18 | auto zones = idf_1_10_1.getObjectsByType(idf_1_10_1.iddFile().getObject("OS:ThermalZone").get()); |
| 2894 | |||
| 2895 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 8 taken 1032 times.
✓ Branch 9 taken 6 times.
|
1038 | for (IdfObject& object : idf_1_10_1.objects()) { |
| 2896 |
2/2✓ Branch 1 taken 1032 times.
✓ Branch 4 taken 1032 times.
|
1032 | auto iddname = object.iddObject().name(); |
| 2897 | |||
| 2898 |
3/3✓ Branch 1 taken 1032 times.
✓ Branch 3 taken 5 times.
✓ Branch 4 taken 1027 times.
|
1032 | if (iddname == "OS:ThermostatSetpoint:DualSetpoint") { |
| 2899 | // Get all of the zones that point to this thermostat | ||
| 2900 | 5 | std::vector<IdfObject> referencingZones; | |
| 2901 |
1/2✗ Branch 5 not taken.
✓ Branch 6 taken 5 times.
|
5 | for (const auto& zone : zones) { |
| 2902 | ✗ | if (auto thermostatHandle = zone.getString(19)) { | |
| 2903 | ✗ | if (toUUID(thermostatHandle.get()) == object.handle()) { | |
| 2904 | ✗ | referencingZones.push_back(zone); | |
| 2905 | } | ||
| 2906 | ✗ | } | |
| 2907 | } | ||
| 2908 | |||
| 2909 | // Clone the thermostat for every zone after the first | ||
| 2910 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
|
5 | if (referencingZones.size() > 1u) { |
| 2911 | ✗ | for (auto& referencingZone : referencingZones) { | |
| 2912 | // This will leave the original thermostate hanging out alone in most circumstances | ||
| 2913 | // but since we are messing with the name it is probably best | ||
| 2914 | ✗ | auto newThermostat = object.clone(); | |
| 2915 | ✗ | newThermostat.setName(referencingZone.nameString() + " Thermostat"); | |
| 2916 | ✗ | ss << newThermostat; | |
| 2917 | ✗ | m_new.push_back(newThermostat); | |
| 2918 | ✗ | auto newHandle = newThermostat.getString(0).get(); | |
| 2919 | ✗ | referencingZone.setString(19, newHandle); | |
| 2920 | ✗ | } | |
| 2921 | } | ||
| 2922 |
1/1✓ Branch 1 taken 5 times.
|
5 | ss << object; |
| 2923 |
2/3✓ Branch 2 taken 1027 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1027 times.
|
1032 | } else if (iddname == "OS:Sizing:Zone") { |
| 2924 | ✗ | auto iddObject = idd_1_10_2.getObject("OS:Sizing:Zone"); | |
| 2925 | ✗ | OS_ASSERT(iddObject); | |
| 2926 | ✗ | IdfObject newObject(iddObject.get()); | |
| 2927 | |||
| 2928 | ✗ | size_t newi = 0; | |
| 2929 | ✗ | for (size_t i = 0; i < object.numNonextensibleFields(); ++i) { | |
| 2930 | ✗ | if (i == 2) { | |
| 2931 | ✗ | newObject.setString(newi, "SupplyAirTemperature"); | |
| 2932 | ✗ | ++newi; | |
| 2933 | ✗ | if (auto value = object.getString(i)) { | |
| 2934 | ✗ | newObject.setString(newi, value.get()); | |
| 2935 | ✗ | } | |
| 2936 | ✗ | ++newi; | |
| 2937 | ✗ | newObject.setDouble(newi, 11.11); | |
| 2938 | ✗ | } else if (i == 3) { | |
| 2939 | ✗ | newObject.setString(newi, "SupplyAirTemperature"); | |
| 2940 | ✗ | ++newi; | |
| 2941 | ✗ | if (auto value = object.getString(i)) { | |
| 2942 | ✗ | newObject.setString(newi, value.get()); | |
| 2943 | ✗ | } | |
| 2944 | ✗ | ++newi; | |
| 2945 | ✗ | newObject.setDouble(newi, 11.11); | |
| 2946 | ✗ | } else if (auto value = object.getString(i)) { | |
| 2947 | ✗ | newObject.setString(newi, value.get()); | |
| 2948 | ✗ | } | |
| 2949 | ✗ | ++newi; | |
| 2950 | } | ||
| 2951 | |||
| 2952 | ✗ | newObject.setString(24, "No"); | |
| 2953 | ✗ | newObject.setString(25, "NeutralSupplyAir"); | |
| 2954 | ✗ | newObject.setString(26, "Autosize"); | |
| 2955 | ✗ | newObject.setString(27, "Autosize"); | |
| 2956 | |||
| 2957 | ✗ | ss << newObject; | |
| 2958 | ✗ | m_refactored.emplace_back(std::move(object), std::move(newObject)); | |
| 2959 | ✗ | } else { | |
| 2960 |
1/1✓ Branch 1 taken 1027 times.
|
1027 | ss << object; |
| 2961 | } | ||
| 2962 | 1038 | } | |
| 2963 | |||
| 2964 | // Reintroduce m_cbeccSizingObjects | ||
| 2965 |
1/2✗ Branch 5 not taken.
✓ Branch 6 taken 6 times.
|
6 | for (auto const& sizingObject : m_cbeccSizingObjects) { |
| 2966 | ✗ | auto iddObject = idd_1_10_2.getObject("OS:Sizing:Zone"); | |
| 2967 | ✗ | OS_ASSERT(iddObject); | |
| 2968 | ✗ | IdfObject newObject(iddObject.get()); | |
| 2969 | |||
| 2970 | ✗ | for (size_t i = 0; i < sizingObject.numNonextensibleFields(); ++i) { | |
| 2971 | ✗ | if (auto value = sizingObject.getString(i)) { | |
| 2972 | ✗ | newObject.setString(i, value.get()); | |
| 2973 | ✗ | } | |
| 2974 | } | ||
| 2975 | ✗ | newObject.setString(24, "No"); | |
| 2976 | ✗ | newObject.setString(25, "NeutralSupplyAir"); | |
| 2977 | ✗ | newObject.setString(26, "Autosize"); | |
| 2978 | ✗ | newObject.setString(27, "Autosize"); | |
| 2979 | |||
| 2980 | ✗ | m_new.push_back(newObject); | |
| 2981 | ✗ | ss << newObject; | |
| 2982 | ✗ | } | |
| 2983 | |||
| 2984 |
1/1✓ Branch 1 taken 6 times.
|
12 | return ss.str(); |
| 2985 | 6 | } | |
| 2986 | |||
| 2987 | 6 | std::string VersionTranslator::update_1_10_5_to_1_10_6(const IdfFile& idf_1_10_5, const IddFileAndFactoryWrapper& idd_1_10_6) { | |
| 2988 |
1/1✓ Branch 1 taken 6 times.
|
6 | std::stringstream ss; |
| 2989 | |||
| 2990 |
4/4✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
✓ Branch 10 taken 6 times.
|
6 | ss << idf_1_10_5.header() << '\n' << '\n'; |
| 2991 | |||
| 2992 | // new version object | ||
| 2993 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
6 | IdfFile targetIdf(idd_1_10_6.iddFile()); |
| 2994 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
|
6 | ss << targetIdf.versionObject().get(); |
| 2995 | |||
| 2996 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 8 taken 1032 times.
✓ Branch 9 taken 6 times.
|
1038 | for (IdfObject& object : idf_1_10_5.objects()) { |
| 2997 |
2/2✓ Branch 1 taken 1032 times.
✓ Branch 4 taken 1032 times.
|
1032 | auto iddname = object.iddObject().name(); |
| 2998 | |||
| 2999 |
2/3✓ Branch 1 taken 1032 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1032 times.
|
1032 | if (iddname == "OS:PlantLoop") { |
| 3000 | ✗ | auto iddObject = idd_1_10_6.getObject("OS:PlantLoop"); | |
| 3001 | ✗ | IdfObject newObject(iddObject.get()); | |
| 3002 | |||
| 3003 | ✗ | for (size_t i = 0; i < object.numNonextensibleFields(); ++i) { | |
| 3004 | ✗ | if (auto s = object.getString(i)) { | |
| 3005 | ✗ | if (i == 20) { | |
| 3006 | ✗ | if (istringEqual("Sequential", s.get())) { | |
| 3007 | ✗ | newObject.setString(i, "SequentialLoad"); | |
| 3008 | ✗ | } else if (istringEqual("Uniform", s.get())) { | |
| 3009 | ✗ | newObject.setString(i, "UniformLoad"); | |
| 3010 | } else { | ||
| 3011 | ✗ | newObject.setString(i, s.get()); | |
| 3012 | } | ||
| 3013 | } else { | ||
| 3014 | ✗ | newObject.setString(i, s.get()); | |
| 3015 | } | ||
| 3016 | } else { | ||
| 3017 | ✗ | } | |
| 3018 | } | ||
| 3019 | |||
| 3020 | ✗ | ss << newObject; | |
| 3021 | ✗ | m_refactored.emplace_back(std::move(object), std::move(newObject)); | |
| 3022 | ✗ | } else { | |
| 3023 |
1/1✓ Branch 1 taken 1032 times.
|
1032 | ss << object; |
| 3024 | } | ||
| 3025 | 1038 | } | |
| 3026 | |||
| 3027 |
1/1✓ Branch 1 taken 6 times.
|
12 | return ss.str(); |
| 3028 | 6 | } | |
| 3029 | |||
| 3030 | 6 | std::string VersionTranslator::update_1_11_3_to_1_11_4(const IdfFile& idf_1_11_3, const IddFileAndFactoryWrapper& idd_1_11_4) { | |
| 3031 |
1/1✓ Branch 1 taken 6 times.
|
6 | std::stringstream ss; |
| 3032 | |||
| 3033 |
4/4✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
✓ Branch 10 taken 6 times.
|
6 | ss << idf_1_11_3.header() << '\n' << '\n'; |
| 3034 | |||
| 3035 | // new version object | ||
| 3036 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
6 | IdfFile targetIdf(idd_1_11_4.iddFile()); |
| 3037 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
|
6 | ss << targetIdf.versionObject().get(); |
| 3038 | |||
| 3039 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 8 taken 1032 times.
✓ Branch 9 taken 6 times.
|
1038 | for (IdfObject& object : idf_1_11_3.objects()) { |
| 3040 |
2/2✓ Branch 1 taken 1032 times.
✓ Branch 4 taken 1032 times.
|
1032 | auto iddname = object.iddObject().name(); |
| 3041 | |||
| 3042 |
2/3✓ Branch 1 taken 1032 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1032 times.
|
1032 | if (iddname == "OS:Coil:Heating:Water:Baseboard") { |
| 3043 | ✗ | auto iddObject = idd_1_11_4.getObject("OS:Coil:Heating:Water:Baseboard"); | |
| 3044 | ✗ | IdfObject newObject(iddObject.get()); | |
| 3045 | |||
| 3046 | ✗ | size_t newi = 0; | |
| 3047 | ✗ | for (size_t i = 0; i < object.numNonextensibleFields(); ++i) { | |
| 3048 | ✗ | if (auto s = object.getString(i)) { | |
| 3049 | ✗ | newObject.setString(newi, s.get()); | |
| 3050 | ✗ | if (i == 1) { | |
| 3051 | ✗ | newi = newi + 4; | |
| 3052 | } | ||
| 3053 | ✗ | } | |
| 3054 | ✗ | ++newi; | |
| 3055 | } | ||
| 3056 | |||
| 3057 | ✗ | newObject.setString(2, "HeatingDesignCapacity"); | |
| 3058 | ✗ | newObject.setString(3, "Autosize"); | |
| 3059 | ✗ | newObject.setDouble(4, 0.0); | |
| 3060 | ✗ | newObject.setDouble(5, 0.8); | |
| 3061 | |||
| 3062 | ✗ | ss << newObject; | |
| 3063 | ✗ | m_refactored.emplace_back(std::move(object), std::move(newObject)); | |
| 3064 | ✗ | } else { | |
| 3065 |
1/1✓ Branch 1 taken 1032 times.
|
1032 | ss << object; |
| 3066 | } | ||
| 3067 | 1038 | } | |
| 3068 | |||
| 3069 |
1/1✓ Branch 1 taken 6 times.
|
12 | return ss.str(); |
| 3070 | 6 | } | |
| 3071 | |||
| 3072 | 6 | std::string VersionTranslator::update_1_11_4_to_1_11_5(const IdfFile& idf_1_11_4, const IddFileAndFactoryWrapper& idd_1_11_5) { | |
| 3073 |
1/1✓ Branch 1 taken 6 times.
|
6 | std::stringstream ss; |
| 3074 | |||
| 3075 |
4/4✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
✓ Branch 10 taken 6 times.
|
6 | ss << idf_1_11_4.header() << '\n' << '\n'; |
| 3076 | |||
| 3077 | // new version object | ||
| 3078 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
6 | IdfFile targetIdf(idd_1_11_5.iddFile()); |
| 3079 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
|
6 | ss << targetIdf.versionObject().get(); |
| 3080 | |||
| 3081 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 8 taken 1032 times.
✓ Branch 9 taken 6 times.
|
1038 | for (IdfObject& object : idf_1_11_4.objects()) { |
| 3082 |
2/2✓ Branch 1 taken 1032 times.
✓ Branch 4 taken 1032 times.
|
1032 | auto iddname = object.iddObject().name(); |
| 3083 | |||
| 3084 |
2/3✓ Branch 1 taken 1032 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1032 times.
|
1032 | if (iddname == "OS:Coil:Heating:DX:SingleSpeed") { |
| 3085 | ✗ | auto iddObject = idd_1_11_5.getObject("OS:Coil:Heating:DX:SingleSpeed"); | |
| 3086 | ✗ | IdfObject newObject(iddObject.get()); | |
| 3087 | |||
| 3088 | ✗ | size_t newi = 0; | |
| 3089 | ✗ | for (size_t i = 0; i < object.numNonextensibleFields(); ++i) { | |
| 3090 | |||
| 3091 | ✗ | if (i == 6) { | |
| 3092 | ✗ | newObject.setDouble(i, 773.3); | |
| 3093 | ✗ | newi = i + 1; | |
| 3094 | ✗ | } else if (i > 6) { | |
| 3095 | ✗ | newi = i + 1; | |
| 3096 | } else { | ||
| 3097 | ✗ | newi = i; | |
| 3098 | } | ||
| 3099 | |||
| 3100 | ✗ | if (auto s = object.getString(i)) { | |
| 3101 | ✗ | newObject.setString(newi, s.get()); | |
| 3102 | ✗ | } | |
| 3103 | } | ||
| 3104 | |||
| 3105 | ✗ | ss << newObject; | |
| 3106 | ✗ | m_refactored.emplace_back(std::move(object), std::move(newObject)); | |
| 3107 | ✗ | } else { | |
| 3108 |
1/1✓ Branch 1 taken 1032 times.
|
1032 | ss << object; |
| 3109 | } | ||
| 3110 | 1038 | } | |
| 3111 | |||
| 3112 |
1/1✓ Branch 1 taken 6 times.
|
12 | return ss.str(); |
| 3113 | 6 | } | |
| 3114 | |||
| 3115 | 16 | std::string VersionTranslator::update_1_12_0_to_1_12_1(const IdfFile& idf_1_12_0, const IddFileAndFactoryWrapper& idd_1_12_1) { | |
| 3116 |
1/1✓ Branch 1 taken 16 times.
|
16 | std::stringstream ss; |
| 3117 | |||
| 3118 |
4/4✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
✓ Branch 7 taken 16 times.
✓ Branch 10 taken 16 times.
|
16 | ss << idf_1_12_0.header() << '\n' << '\n'; |
| 3119 | |||
| 3120 | // new version object | ||
| 3121 |
2/2✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
|
16 | IdfFile targetIdf(idd_1_12_1.iddFile()); |
| 3122 |
3/3✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
✓ Branch 7 taken 16 times.
|
16 | ss << targetIdf.versionObject().get(); |
| 3123 | |||
| 3124 |
3/3✓ Branch 1 taken 16 times.
✓ Branch 8 taken 5892 times.
✓ Branch 9 taken 16 times.
|
5908 | for (IdfObject& object : idf_1_12_0.objects()) { |
| 3125 |
2/2✓ Branch 1 taken 5892 times.
✓ Branch 4 taken 5892 times.
|
5892 | auto iddname = object.iddObject().name(); |
| 3126 | |||
| 3127 |
2/3✓ Branch 1 taken 5892 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 5892 times.
|
5892 | if (iddname == "OS:Meter") { |
| 3128 | ✗ | auto iddObject = idd_1_12_1.getObject("OS:Output:Meter"); | |
| 3129 | ✗ | IdfObject newObject(iddObject.get()); | |
| 3130 | |||
| 3131 | ✗ | size_t newi = 0; | |
| 3132 | ✗ | for (size_t i = 0; i < object.numNonextensibleFields(); ++i) { | |
| 3133 | ✗ | if (auto s = object.getString(i)) { | |
| 3134 | ✗ | newObject.setString(newi, s.get()); | |
| 3135 | ✗ | } | |
| 3136 | ✗ | ++newi; | |
| 3137 | } | ||
| 3138 | |||
| 3139 | ✗ | ss << newObject; | |
| 3140 | ✗ | m_refactored.emplace_back(std::move(object), std::move(newObject)); | |
| 3141 | ✗ | } else { | |
| 3142 |
1/1✓ Branch 1 taken 5892 times.
|
5892 | ss << object; |
| 3143 | } | ||
| 3144 | 5908 | } | |
| 3145 | |||
| 3146 |
1/1✓ Branch 1 taken 16 times.
|
32 | return ss.str(); |
| 3147 | 16 | } | |
| 3148 | |||
| 3149 | 16 | std::string VersionTranslator::update_1_12_3_to_1_12_4(const IdfFile& idf_1_12_3, const IddFileAndFactoryWrapper& idd_1_12_4) { | |
| 3150 |
1/1✓ Branch 1 taken 16 times.
|
16 | std::stringstream ss; |
| 3151 | |||
| 3152 |
4/4✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
✓ Branch 7 taken 16 times.
✓ Branch 10 taken 16 times.
|
16 | ss << idf_1_12_3.header() << '\n' << '\n'; |
| 3153 |
2/2✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
|
16 | IdfFile targetIdf(idd_1_12_4.iddFile()); |
| 3154 |
3/3✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
✓ Branch 7 taken 16 times.
|
16 | ss << targetIdf.versionObject().get(); |
| 3155 | |||
| 3156 |
3/3✓ Branch 1 taken 16 times.
✓ Branch 8 taken 5892 times.
✓ Branch 9 taken 16 times.
|
5908 | for (IdfObject& object : idf_1_12_3.objects()) { |
| 3157 |
2/2✓ Branch 1 taken 5892 times.
✓ Branch 4 taken 5892 times.
|
5892 | auto iddname = object.iddObject().name(); |
| 3158 | |||
| 3159 |
2/3✓ Branch 1 taken 5892 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 5892 times.
|
5892 | if (iddname == "OS:AirTerminal:SingleDuct:VAV:Reheat") { |
| 3160 | ✗ | auto iddObject = idd_1_12_4.getObject("OS:AirTerminal:SingleDuct:VAV:Reheat"); | |
| 3161 | ✗ | IdfObject newObject(iddObject.get()); | |
| 3162 | |||
| 3163 | ✗ | for (size_t i = 0; i < object.numNonextensibleFields(); ++i) { | |
| 3164 | ✗ | if (auto s = object.getString(i)) { | |
| 3165 | ✗ | if (i == 14u) { | |
| 3166 | ✗ | if (istringEqual("Reverse", s.get())) { | |
| 3167 | ✗ | newObject.setString(i, "ReverseWithLimits"); | |
| 3168 | } else { | ||
| 3169 | ✗ | newObject.setString(i, s.get()); | |
| 3170 | } | ||
| 3171 | } else { | ||
| 3172 | ✗ | newObject.setString(i, s.get()); | |
| 3173 | } | ||
| 3174 | ✗ | } | |
| 3175 | } | ||
| 3176 | |||
| 3177 | ✗ | ss << newObject; | |
| 3178 | ✗ | m_refactored.emplace_back(std::move(object), std::move(newObject)); | |
| 3179 | ✗ | } else { | |
| 3180 |
1/1✓ Branch 1 taken 5892 times.
|
5892 | ss << object; |
| 3181 | } | ||
| 3182 | 5908 | } | |
| 3183 | |||
| 3184 |
1/1✓ Branch 1 taken 16 times.
|
32 | return ss.str(); |
| 3185 | 16 | } | |
| 3186 | |||
| 3187 | 16 | std::string VersionTranslator::update_2_1_0_to_2_1_1(const IdfFile& idf_2_1_0, const IddFileAndFactoryWrapper& idd_2_1_1) { | |
| 3188 |
1/1✓ Branch 1 taken 16 times.
|
16 | std::stringstream ss; |
| 3189 | |||
| 3190 |
4/4✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
✓ Branch 7 taken 16 times.
✓ Branch 10 taken 16 times.
|
16 | ss << idf_2_1_0.header() << '\n' << '\n'; |
| 3191 |
2/2✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
|
16 | IdfFile targetIdf(idd_2_1_1.iddFile()); |
| 3192 |
3/3✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
✓ Branch 7 taken 16 times.
|
16 | ss << targetIdf.versionObject().get(); |
| 3193 | |||
| 3194 |
3/3✓ Branch 1 taken 16 times.
✓ Branch 8 taken 5892 times.
✓ Branch 9 taken 16 times.
|
5908 | for (IdfObject& object : idf_2_1_0.objects()) { |
| 3195 |
2/2✓ Branch 1 taken 5892 times.
✓ Branch 4 taken 5892 times.
|
5892 | auto iddname = object.iddObject().name(); |
| 3196 | |||
| 3197 |
2/3✓ Branch 1 taken 5892 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 5892 times.
|
5892 | if (iddname == "OS:WaterHeater:Stratified") { |
| 3198 | ✗ | auto iddObject = idd_2_1_1.getObject("OS:WaterHeater:Stratified"); | |
| 3199 | ✗ | IdfObject newObject(iddObject.get()); | |
| 3200 | |||
| 3201 | ✗ | size_t oldi = 0; | |
| 3202 | ✗ | for (size_t i = 0; i < object.numNonextensibleFields(); ++i) { | |
| 3203 | ✗ | if ((i == 64u) || (i == 65u)) { | |
| 3204 | ✗ | newObject.setDouble(i, 0.0); | |
| 3205 | } else { | ||
| 3206 | ✗ | if (auto s = object.getString(oldi)) { | |
| 3207 | ✗ | newObject.setString(i, s.get()); | |
| 3208 | ✗ | } | |
| 3209 | ✗ | oldi++; | |
| 3210 | } | ||
| 3211 | } | ||
| 3212 | |||
| 3213 | ✗ | ss << newObject; | |
| 3214 | ✗ | m_refactored.emplace_back(std::move(object), std::move(newObject)); | |
| 3215 |
2/3✓ Branch 3 taken 5892 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 5892 times.
|
5892 | } else if (iddname == "OS:HeatPump:WaterToWater:EquationFit:Heating") { |
| 3216 | ✗ | auto iddObject = idd_2_1_1.getObject("OS:HeatPump:WaterToWater:EquationFit:Heating"); | |
| 3217 | ✗ | IdfObject newObject(iddObject.get()); | |
| 3218 | |||
| 3219 | ✗ | for (size_t i = 0; i < object.numNonextensibleFields(); ++i) { | |
| 3220 | ✗ | if (auto s = object.getString(i)) { | |
| 3221 | ✗ | newObject.setString(i, s.get()); | |
| 3222 | ✗ | } | |
| 3223 | } | ||
| 3224 | ✗ | newObject.setDouble(20, 7.5); | |
| 3225 | ✗ | newObject.setDouble(21, 1.0); | |
| 3226 | ✗ | newObject.setString(22, ""); | |
| 3227 | |||
| 3228 | ✗ | ss << newObject; | |
| 3229 | ✗ | m_refactored.emplace_back(std::move(object), std::move(newObject)); | |
| 3230 |
2/3✓ Branch 3 taken 5892 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 5892 times.
|
5892 | } else if (iddname == "OS:HeatPump:WaterToWater:EquationFit:Cooling") { |
| 3231 | ✗ | auto iddObject = idd_2_1_1.getObject("OS:HeatPump:WaterToWater:EquationFit:Cooling"); | |
| 3232 | ✗ | IdfObject newObject(iddObject.get()); | |
| 3233 | |||
| 3234 | ✗ | for (size_t i = 0; i < object.numNonextensibleFields(); ++i) { | |
| 3235 | ✗ | if (auto s = object.getString(i)) { | |
| 3236 | ✗ | newObject.setString(i, s.get()); | |
| 3237 | ✗ | } | |
| 3238 | } | ||
| 3239 | ✗ | newObject.setDouble(20, 8.0); | |
| 3240 | ✗ | newObject.setDouble(21, 1.0); | |
| 3241 | ✗ | newObject.setString(22, ""); | |
| 3242 | |||
| 3243 | ✗ | ss << newObject; | |
| 3244 | ✗ | m_refactored.emplace_back(std::move(object), std::move(newObject)); | |
| 3245 | ✗ | } else { | |
| 3246 |
1/1✓ Branch 1 taken 5892 times.
|
5892 | ss << object; |
| 3247 | } | ||
| 3248 | 5908 | } | |
| 3249 | |||
| 3250 |
1/1✓ Branch 1 taken 16 times.
|
32 | return ss.str(); |
| 3251 | 16 | } | |
| 3252 | |||
| 3253 | 16 | std::string VersionTranslator::update_2_1_1_to_2_1_2(const IdfFile& idf_2_1_1, const IddFileAndFactoryWrapper& idd_2_1_2) { | |
| 3254 |
1/1✓ Branch 1 taken 16 times.
|
16 | std::stringstream ss; |
| 3255 | |||
| 3256 |
4/4✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
✓ Branch 7 taken 16 times.
✓ Branch 10 taken 16 times.
|
16 | ss << idf_2_1_1.header() << '\n' << '\n'; |
| 3257 |
2/2✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
|
16 | IdfFile targetIdf(idd_2_1_2.iddFile()); |
| 3258 |
3/3✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
✓ Branch 7 taken 16 times.
|
16 | ss << targetIdf.versionObject().get(); |
| 3259 | |||
| 3260 |
3/3✓ Branch 1 taken 16 times.
✓ Branch 8 taken 5892 times.
✓ Branch 9 taken 16 times.
|
5908 | for (IdfObject& object : idf_2_1_1.objects()) { |
| 3261 |
2/2✓ Branch 1 taken 5892 times.
✓ Branch 4 taken 5892 times.
|
5892 | auto iddname = object.iddObject().name(); |
| 3262 | |||
| 3263 |
3/3✓ Branch 1 taken 5892 times.
✓ Branch 3 taken 10 times.
✓ Branch 4 taken 5882 times.
|
5892 | if (iddname == "OS:PlantLoop") { |
| 3264 |
2/2✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
|
10 | auto iddObject = idd_2_1_2.getObject("OS:PlantLoop"); |
| 3265 |
2/2✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
|
10 | IdfObject newObject(iddObject.get()); |
| 3266 | |||
| 3267 | 10 | size_t newi = 0; | |
| 3268 |
3/3✓ Branch 1 taken 260 times.
✓ Branch 3 taken 250 times.
✓ Branch 4 taken 10 times.
|
260 | for (size_t i = 0; i < object.numNonextensibleFields(); ++i) { |
| 3269 |
2/2✓ Branch 0 taken 10 times.
✓ Branch 1 taken 240 times.
|
250 | if (i == 3u) { |
| 3270 |
1/1✓ Branch 1 taken 10 times.
|
10 | newObject.setInt(newi, 0); |
| 3271 | 10 | ++newi; | |
| 3272 | } else { | ||
| 3273 |
2/3✓ Branch 1 taken 240 times.
✓ Branch 3 taken 240 times.
✗ Branch 4 not taken.
|
480 | if (auto s = object.getString(i)) { |
| 3274 |
2/2✓ Branch 1 taken 240 times.
✓ Branch 4 taken 240 times.
|
240 | newObject.setString(newi, s.get()); |
| 3275 | 240 | } | |
| 3276 | } | ||
| 3277 | 250 | ++newi; | |
| 3278 | } | ||
| 3279 | |||
| 3280 |
1/1✓ Branch 1 taken 10 times.
|
10 | ss << newObject; |
| 3281 |
1/1✓ Branch 3 taken 10 times.
|
10 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 3282 |
2/3✓ Branch 3 taken 5882 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 5882 times.
|
5892 | } else if (iddname == "OS:ZoneHVAC:FourPipeFanCoil") { |
| 3283 | ✗ | auto iddObject = idd_2_1_2.getObject("OS:ZoneHVAC:FourPipeFanCoil"); | |
| 3284 | ✗ | IdfObject newObject(iddObject.get()); | |
| 3285 | |||
| 3286 | ✗ | size_t newi = 0; | |
| 3287 | ✗ | for (size_t i = 0; i < object.numNonextensibleFields(); ++i) { | |
| 3288 | ✗ | if (auto s = object.getString(i)) { | |
| 3289 | ✗ | newObject.setString(newi, s.get()); | |
| 3290 | ✗ | } | |
| 3291 | ✗ | ++newi; | |
| 3292 | } | ||
| 3293 | ✗ | newObject.setString(23, "Autosize"); | |
| 3294 | ✗ | newObject.setString(24, "Autosize"); | |
| 3295 | |||
| 3296 | ✗ | ss << newObject; | |
| 3297 | ✗ | m_refactored.emplace_back(std::move(object), std::move(newObject)); | |
| 3298 | ✗ | } else { | |
| 3299 |
1/1✓ Branch 1 taken 5882 times.
|
5882 | ss << object; |
| 3300 | } | ||
| 3301 | 5908 | } | |
| 3302 | |||
| 3303 |
1/1✓ Branch 1 taken 16 times.
|
32 | return ss.str(); |
| 3304 | 16 | } | |
| 3305 | |||
| 3306 | 16 | std::string VersionTranslator::update_2_3_0_to_2_3_1(const IdfFile& idf_2_3_0, const IddFileAndFactoryWrapper& idd_2_3_1) { | |
| 3307 |
1/1✓ Branch 1 taken 16 times.
|
16 | std::stringstream ss; |
| 3308 | |||
| 3309 |
4/4✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
✓ Branch 7 taken 16 times.
✓ Branch 10 taken 16 times.
|
16 | ss << idf_2_3_0.header() << '\n' << '\n'; |
| 3310 |
2/2✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
|
16 | IdfFile targetIdf(idd_2_3_1.iddFile()); |
| 3311 |
3/3✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
✓ Branch 7 taken 16 times.
|
16 | ss << targetIdf.versionObject().get(); |
| 3312 | |||
| 3313 | 16 | boost::optional<std::string> value; | |
| 3314 | |||
| 3315 |
3/3✓ Branch 1 taken 16 times.
✓ Branch 8 taken 5892 times.
✓ Branch 9 taken 16 times.
|
5908 | for (IdfObject& object : idf_2_3_0.objects()) { |
| 3316 |
2/2✓ Branch 1 taken 5892 times.
✓ Branch 4 taken 5892 times.
|
5892 | auto iddname = object.iddObject().name(); |
| 3317 | |||
| 3318 |
3/3✓ Branch 1 taken 5892 times.
✓ Branch 3 taken 10 times.
✓ Branch 4 taken 5882 times.
|
5892 | if (iddname == "OS:Pump:ConstantSpeed") { |
| 3319 |
2/2✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
|
10 | auto iddObject = idd_2_3_1.getObject("OS:Pump:ConstantSpeed"); |
| 3320 |
2/2✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
|
10 | IdfObject newObject(iddObject.get()); |
| 3321 | |||
| 3322 |
3/3✓ Branch 1 taken 170 times.
✓ Branch 3 taken 160 times.
✓ Branch 4 taken 10 times.
|
170 | for (size_t i = 0; i < object.numNonextensibleFields(); ++i) { |
| 3323 |
2/3✓ Branch 1 taken 160 times.
✓ Branch 5 taken 160 times.
✗ Branch 6 not taken.
|
320 | if ((value = object.getString(i))) { |
| 3324 |
2/2✓ Branch 1 taken 160 times.
✓ Branch 4 taken 160 times.
|
160 | newObject.setString(i, value.get()); |
| 3325 | } | ||
| 3326 | } | ||
| 3327 | |||
| 3328 |
2/2✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
|
20 | newObject.setString(16, "PowerPerFlowPerPressure"); |
| 3329 |
2/2✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
|
20 | newObject.setString(17, "348701.1"); |
| 3330 |
2/2✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
|
10 | newObject.setString(18, "1.282051282"); |
| 3331 | |||
| 3332 |
1/1✓ Branch 1 taken 10 times.
|
10 | ss << newObject; |
| 3333 |
1/1✓ Branch 3 taken 10 times.
|
10 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 3334 |
2/3✓ Branch 3 taken 5882 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 5882 times.
|
5892 | } else if (iddname == "OS:Pump:VariableSpeed") { |
| 3335 | ✗ | auto iddObject = idd_2_3_1.getObject("OS:Pump:VariableSpeed"); | |
| 3336 | ✗ | IdfObject newObject(iddObject.get()); | |
| 3337 | |||
| 3338 | ✗ | for (size_t i = 0; i < object.numNonextensibleFields(); ++i) { | |
| 3339 | ✗ | if ((value = object.getString(i))) { | |
| 3340 | ✗ | newObject.setString(i, value.get()); | |
| 3341 | } | ||
| 3342 | } | ||
| 3343 | |||
| 3344 | ✗ | newObject.setString(25, "0.5"); | |
| 3345 | ✗ | newObject.setString(26, "PowerPerFlowPerPressure"); | |
| 3346 | ✗ | newObject.setString(27, "348701.1"); | |
| 3347 | ✗ | newObject.setString(28, "1.282051282"); | |
| 3348 | ✗ | newObject.setString(29, "0.0"); | |
| 3349 | |||
| 3350 | ✗ | ss << newObject; | |
| 3351 | ✗ | m_refactored.emplace_back(std::move(object), std::move(newObject)); | |
| 3352 |
2/3✓ Branch 3 taken 5882 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 5882 times.
|
5882 | } else if (iddname == "OS:CoolingTower:SingleSpeed") { |
| 3353 | ✗ | auto iddObject = idd_2_3_1.getObject("OS:CoolingTower:SingleSpeed"); | |
| 3354 | ✗ | IdfObject newObject(iddObject.get()); | |
| 3355 | |||
| 3356 | ✗ | for (size_t i = 0; i < object.numNonextensibleFields(); ++i) { | |
| 3357 | ✗ | if ((value = object.getString(i))) { | |
| 3358 | ✗ | newObject.setString(i, value.get()); | |
| 3359 | } | ||
| 3360 | } | ||
| 3361 | |||
| 3362 | ✗ | newObject.setString(29, "0.1"); | |
| 3363 | ✗ | newObject.setString(30, "0.1"); | |
| 3364 | ✗ | newObject.setString(31, "1.25"); | |
| 3365 | ✗ | newObject.setString(32, "0.1"); | |
| 3366 | ✗ | newObject.setString(33, "35.0"); | |
| 3367 | ✗ | newObject.setString(34, "25.6"); | |
| 3368 | ✗ | newObject.setString(35, "Autosize"); | |
| 3369 | ✗ | newObject.setString(36, "Autosize"); | |
| 3370 | ✗ | newObject.setString(37, "General"); | |
| 3371 | |||
| 3372 | ✗ | ss << newObject; | |
| 3373 | ✗ | m_refactored.emplace_back(std::move(object), std::move(newObject)); | |
| 3374 |
2/3✓ Branch 3 taken 5882 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 5882 times.
|
5882 | } else if (iddname == "OS:CoolingTower:TwoSpeed") { |
| 3375 | ✗ | auto iddObject = idd_2_3_1.getObject("OS:CoolingTower:TwoSpeed"); | |
| 3376 | ✗ | IdfObject newObject(iddObject.get()); | |
| 3377 | |||
| 3378 | ✗ | for (size_t i = 0; i < object.numNonextensibleFields(); ++i) { | |
| 3379 | ✗ | if ((value = object.getString(i))) { | |
| 3380 | ✗ | newObject.setString(i, value.get()); | |
| 3381 | } | ||
| 3382 | } | ||
| 3383 | |||
| 3384 | ✗ | newObject.setString(41, "35.0"); | |
| 3385 | ✗ | newObject.setString(42, "25.6"); | |
| 3386 | ✗ | newObject.setString(43, "Autosize"); | |
| 3387 | ✗ | newObject.setString(44, "Autosize"); | |
| 3388 | ✗ | newObject.setString(45, "General"); | |
| 3389 | |||
| 3390 | ✗ | ss << newObject; | |
| 3391 | ✗ | m_refactored.emplace_back(std::move(object), std::move(newObject)); | |
| 3392 |
2/3✓ Branch 3 taken 5882 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 5882 times.
|
5882 | } else if (iddname == "OS:CoolingTower:VariableSpeed") { |
| 3393 | ✗ | auto iddObject = idd_2_3_1.getObject("OS:CoolingTower:VariableSpeed"); | |
| 3394 | ✗ | IdfObject newObject(iddObject.get()); | |
| 3395 | |||
| 3396 | ✗ | for (size_t i = 0; i < object.numNonextensibleFields(); ++i) { | |
| 3397 | ✗ | if ((value = object.getString(i))) { | |
| 3398 | ✗ | newObject.setString(i, value.get()); | |
| 3399 | } | ||
| 3400 | } | ||
| 3401 | |||
| 3402 | ✗ | newObject.setString(31, "General"); | |
| 3403 | |||
| 3404 | ✗ | ss << newObject; | |
| 3405 | ✗ | m_refactored.emplace_back(std::move(object), std::move(newObject)); | |
| 3406 | |||
| 3407 |
2/3✓ Branch 3 taken 5882 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 5882 times.
|
5882 | } else if (iddname == "OS:Chiller:Electric:EIR") { |
| 3408 | ✗ | auto iddObject = idd_2_3_1.getObject("OS:Chiller:Electric:EIR"); | |
| 3409 | ✗ | IdfObject newObject(iddObject.get()); | |
| 3410 | |||
| 3411 | ✗ | for (size_t i = 0; i < object.numNonextensibleFields(); ++i) { | |
| 3412 | ✗ | if ((value = object.getString(i))) { | |
| 3413 | ✗ | newObject.setString(i, value.get()); | |
| 3414 | } | ||
| 3415 | } | ||
| 3416 | |||
| 3417 | ✗ | if (object.getString(17) && (!object.getString(17).get().empty())) { | |
| 3418 | ✗ | newObject.setString(19, "WaterCooled"); | |
| 3419 | } else { | ||
| 3420 | ✗ | newObject.setString(19, "AirCooled"); | |
| 3421 | } | ||
| 3422 | |||
| 3423 | ✗ | ss << newObject; | |
| 3424 | ✗ | m_refactored.emplace_back(std::move(object), std::move(newObject)); | |
| 3425 |
3/3✓ Branch 3 taken 5882 times.
✓ Branch 5 taken 10 times.
✓ Branch 6 taken 5872 times.
|
5882 | } else if (iddname == "OS:AirLoopHVAC") { |
| 3426 |
2/2✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
|
10 | auto iddObject = idd_2_3_1.getObject("OS:AirLoopHVAC"); |
| 3427 |
2/2✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
|
10 | IdfObject newObject(iddObject.get()); |
| 3428 | |||
| 3429 |
3/3✓ Branch 1 taken 200 times.
✓ Branch 3 taken 190 times.
✓ Branch 4 taken 10 times.
|
200 | for (size_t i = 0; i < object.numNonextensibleFields(); ++i) { |
| 3430 |
2/3✓ Branch 1 taken 190 times.
✓ Branch 5 taken 190 times.
✗ Branch 6 not taken.
|
380 | if ((value = object.getString(i))) { |
| 3431 |
2/2✓ Branch 1 taken 190 times.
✓ Branch 4 taken 190 times.
|
190 | newObject.setString(i, value.get()); |
| 3432 | } | ||
| 3433 | } | ||
| 3434 | |||
| 3435 | /* We need handle the change from the old behavior (one AvailabilityManager:xxx) to the new AVMList | ||
| 3436 | * First, we must create an AVMList for each loop, then if an AVM was assigned, we put it on the AVM list | ||
| 3437 | */ | ||
| 3438 | |||
| 3439 | // Create an AVMList with a handle and a name | ||
| 3440 | 10 | std::string avmName; | |
| 3441 |
2/3✓ Branch 1 taken 10 times.
✓ Branch 3 taken 10 times.
✗ Branch 4 not taken.
|
20 | if (auto loopName = object.getString(1)) { |
| 3442 |
2/2✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
|
10 | avmName = loopName.get(); |
| 3443 | 10 | } | |
| 3444 |
1/1✓ Branch 1 taken 10 times.
|
10 | avmName += " AvailabilityManagerAssignmentList"; |
| 3445 | |||
| 3446 |
4/4✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
✓ Branch 7 taken 10 times.
✓ Branch 10 taken 10 times.
|
10 | IdfObject avmList(idd_2_3_1.getObject("OS:AvailabilityManagerAssignmentList").get()); |
| 3447 |
2/2✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
|
10 | std::string avmHandle = toString(createUUID()); |
| 3448 |
1/1✓ Branch 1 taken 10 times.
|
10 | avmList.setString(0, avmHandle); |
| 3449 |
1/1✓ Branch 1 taken 10 times.
|
10 | avmList.setString(1, avmName); |
| 3450 | |||
| 3451 | // Check if there was an AVM assigned to the Loop, it so, put it on the newly created AVMList | ||
| 3452 |
2/3✓ Branch 1 taken 10 times.
✓ Branch 3 taken 10 times.
✗ Branch 4 not taken.
|
20 | if (auto existingAVMUUid = object.getString(4)) { |
| 3453 |
3/3✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
✓ Branch 7 taken 10 times.
|
20 | avmList.pushExtensibleGroup(StringVector(1u, existingAVMUUid.get())); |
| 3454 | 10 | } | |
| 3455 | |||
| 3456 | // Assign AVM list to loop | ||
| 3457 |
1/1✓ Branch 1 taken 10 times.
|
10 | newObject.setString(4, avmHandle); |
| 3458 | |||
| 3459 |
1/1✓ Branch 1 taken 10 times.
|
10 | m_refactored.emplace_back(object, newObject); |
| 3460 |
1/1✓ Branch 1 taken 10 times.
|
10 | m_new.push_back(avmList); |
| 3461 | |||
| 3462 |
1/1✓ Branch 1 taken 10 times.
|
10 | ss << newObject; |
| 3463 |
1/1✓ Branch 1 taken 10 times.
|
10 | ss << avmList; |
| 3464 | |||
| 3465 |
3/3✓ Branch 6 taken 5872 times.
✓ Branch 8 taken 10 times.
✓ Branch 9 taken 5862 times.
|
5882 | } else if (iddname == "OS:PlantLoop") { |
| 3466 |
2/2✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
|
10 | auto iddObject = idd_2_3_1.getObject("OS:PlantLoop"); |
| 3467 |
2/2✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
|
10 | IdfObject newObject(iddObject.get()); |
| 3468 | |||
| 3469 |
3/3✓ Branch 1 taken 350 times.
✓ Branch 3 taken 340 times.
✓ Branch 4 taken 10 times.
|
350 | for (size_t i = 0; i < object.numNonextensibleFields(); ++i) { |
| 3470 |
2/3✓ Branch 1 taken 340 times.
✓ Branch 5 taken 340 times.
✗ Branch 6 not taken.
|
680 | if ((value = object.getString(i))) { |
| 3471 |
2/2✓ Branch 1 taken 340 times.
✓ Branch 4 taken 340 times.
|
340 | newObject.setString(i, value.get()); |
| 3472 | } | ||
| 3473 | } | ||
| 3474 | |||
| 3475 | // Create an AVMList with a handle and a name | ||
| 3476 | 10 | std::string avmName; | |
| 3477 |
2/3✓ Branch 1 taken 10 times.
✓ Branch 3 taken 10 times.
✗ Branch 4 not taken.
|
20 | if (auto loopName = object.getString(1)) { |
| 3478 |
2/2✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
|
10 | avmName = loopName.get(); |
| 3479 | 10 | } | |
| 3480 |
1/1✓ Branch 1 taken 10 times.
|
10 | avmName += " AvailabilityManagerAssignmentList"; |
| 3481 | |||
| 3482 |
4/4✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
✓ Branch 7 taken 10 times.
✓ Branch 10 taken 10 times.
|
10 | IdfObject avmList(idd_2_3_1.getObject("OS:AvailabilityManagerAssignmentList").get()); |
| 3483 |
2/2✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
|
10 | std::string avmHandle = toString(createUUID()); |
| 3484 |
1/1✓ Branch 1 taken 10 times.
|
10 | avmList.setString(0, avmHandle); |
| 3485 |
1/1✓ Branch 1 taken 10 times.
|
10 | avmList.setString(1, avmName); |
| 3486 | |||
| 3487 | // Check if there was an AVM assigned to the Loop, it so, put it on the newly created AVMList | ||
| 3488 |
2/3✓ Branch 1 taken 10 times.
✓ Branch 3 taken 10 times.
✗ Branch 4 not taken.
|
20 | if (auto existingAVMUUid = object.getString(22)) { |
| 3489 |
3/3✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
✓ Branch 7 taken 10 times.
|
20 | avmList.pushExtensibleGroup(StringVector(1u, existingAVMUUid.get())); |
| 3490 | 10 | } | |
| 3491 | |||
| 3492 | // Assign AVM list to loop | ||
| 3493 |
1/1✓ Branch 1 taken 10 times.
|
10 | newObject.setString(22, avmHandle); |
| 3494 | |||
| 3495 |
1/1✓ Branch 1 taken 10 times.
|
10 | m_refactored.emplace_back(object, newObject); |
| 3496 |
1/1✓ Branch 1 taken 10 times.
|
10 | m_new.push_back(avmList); |
| 3497 | |||
| 3498 |
1/1✓ Branch 1 taken 10 times.
|
10 | ss << newObject; |
| 3499 |
1/1✓ Branch 1 taken 10 times.
|
10 | ss << avmList; |
| 3500 | |||
| 3501 |
2/3✓ Branch 6 taken 5862 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 5862 times.
|
5872 | } else if (iddname == "OS:AvailabilityManager:NightCycle") { |
| 3502 | ✗ | auto iddObject = idd_2_3_1.getObject("OS:AvailabilityManager:NightCycle"); | |
| 3503 | ✗ | IdfObject newObject(iddObject.get()); | |
| 3504 | |||
| 3505 | // Cycling Run Time Control Type was placed before Cycling Run Time | ||
| 3506 | ✗ | for (size_t i = 0; i < object.numNonextensibleFields() - 1; ++i) { | |
| 3507 | ✗ | if ((value = object.getString(i))) { | |
| 3508 | ✗ | newObject.setString(i, value.get()); | |
| 3509 | } | ||
| 3510 | } | ||
| 3511 | |||
| 3512 | // No need to set the default Cycling Run Time Control Type, it has a defaulted option | ||
| 3513 | // But we need to carry the cycling Run Time (seconds) in the right field | ||
| 3514 | ✗ | if (auto cyclingRunTime = newObject.getDouble(6)) { | |
| 3515 | ✗ | newObject.setDouble(7, cyclingRunTime.get()); | |
| 3516 | } | ||
| 3517 | |||
| 3518 | // We need to create the four ModelObjectLists for the control zones | ||
| 3519 | // 8 = Control Zone or Zone List Name | ||
| 3520 | ✗ | std::string controlThermalZoneListName; | |
| 3521 | ✗ | if (auto avmName = object.getString(1)) { | |
| 3522 | ✗ | controlThermalZoneListName = avmName.get(); | |
| 3523 | ✗ | } | |
| 3524 | ✗ | controlThermalZoneListName += " Control Zone List"; | |
| 3525 | |||
| 3526 | ✗ | IdfObject controlThermalZoneList(idd_2_3_1.getObject("OS:ModelObjectList").get()); | |
| 3527 | ✗ | std::string controlThermalZoneListHandle = toString(createUUID()); | |
| 3528 | ✗ | controlThermalZoneList.setString(0, controlThermalZoneListHandle); | |
| 3529 | ✗ | controlThermalZoneList.setString(1, controlThermalZoneListName); | |
| 3530 | ✗ | newObject.setString(8, controlThermalZoneListHandle); | |
| 3531 | |||
| 3532 | // 9 = Cooling Control Zone or Zone List Name | ||
| 3533 | ✗ | std::string coolingControlThermalZoneListName; | |
| 3534 | ✗ | if (auto avmName = object.getString(1)) { | |
| 3535 | ✗ | coolingControlThermalZoneListName = avmName.get(); | |
| 3536 | ✗ | } | |
| 3537 | ✗ | coolingControlThermalZoneListName += " Cooling Control Zone List"; | |
| 3538 | |||
| 3539 | ✗ | IdfObject coolingControlThermalZoneList(idd_2_3_1.getObject("OS:ModelObjectList").get()); | |
| 3540 | ✗ | std::string coolingControlThermalZoneListHandle = toString(createUUID()); | |
| 3541 | ✗ | coolingControlThermalZoneList.setString(0, coolingControlThermalZoneListHandle); | |
| 3542 | ✗ | coolingControlThermalZoneList.setString(1, coolingControlThermalZoneListName); | |
| 3543 | ✗ | newObject.setString(9, coolingControlThermalZoneListHandle); | |
| 3544 | |||
| 3545 | // 10 = Heating Control Zone or Zone List Name | ||
| 3546 | ✗ | std::string heatingControlThermalZoneListName; | |
| 3547 | ✗ | if (auto avmName = object.getString(1)) { | |
| 3548 | ✗ | heatingControlThermalZoneListName = avmName.get(); | |
| 3549 | ✗ | } | |
| 3550 | ✗ | heatingControlThermalZoneListName += " Heating Control Zone List"; | |
| 3551 | |||
| 3552 | ✗ | IdfObject heatingControlThermalZoneList(idd_2_3_1.getObject("OS:ModelObjectList").get()); | |
| 3553 | ✗ | std::string heatingControlThermalZoneListHandle = toString(createUUID()); | |
| 3554 | ✗ | heatingControlThermalZoneList.setString(0, heatingControlThermalZoneListHandle); | |
| 3555 | ✗ | heatingControlThermalZoneList.setString(1, heatingControlThermalZoneListName); | |
| 3556 | ✗ | newObject.setString(10, heatingControlThermalZoneListHandle); | |
| 3557 | |||
| 3558 | // 11 = Heating Control Zone or Zone List Name | ||
| 3559 | ✗ | std::string heatingZoneFansOnlyThermalZoneListName; | |
| 3560 | ✗ | if (auto avmName = object.getString(1)) { | |
| 3561 | ✗ | heatingZoneFansOnlyThermalZoneListName = avmName.get(); | |
| 3562 | ✗ | } | |
| 3563 | ✗ | heatingZoneFansOnlyThermalZoneListName += " Heating Zone Fans Only Zone List"; | |
| 3564 | |||
| 3565 | ✗ | IdfObject heatingZoneFansOnlyThermalZoneList(idd_2_3_1.getObject("OS:ModelObjectList").get()); | |
| 3566 | ✗ | std::string heatingZoneFansOnlyThermalZoneListHandle = toString(createUUID()); | |
| 3567 | ✗ | heatingZoneFansOnlyThermalZoneList.setString(0, heatingZoneFansOnlyThermalZoneListHandle); | |
| 3568 | ✗ | heatingZoneFansOnlyThermalZoneList.setString(1, heatingZoneFansOnlyThermalZoneListName); | |
| 3569 | ✗ | newObject.setString(11, heatingZoneFansOnlyThermalZoneListHandle); | |
| 3570 | |||
| 3571 | ✗ | m_refactored.emplace_back(object, newObject); | |
| 3572 | ✗ | m_new.push_back(controlThermalZoneList); | |
| 3573 | ✗ | m_new.push_back(coolingControlThermalZoneList); | |
| 3574 | ✗ | m_new.push_back(heatingControlThermalZoneList); | |
| 3575 | ✗ | m_new.push_back(heatingZoneFansOnlyThermalZoneList); | |
| 3576 | |||
| 3577 | ✗ | ss << newObject; | |
| 3578 | ✗ | ss << controlThermalZoneList; | |
| 3579 | ✗ | ss << coolingControlThermalZoneList; | |
| 3580 | ✗ | ss << heatingControlThermalZoneList; | |
| 3581 | ✗ | ss << heatingZoneFansOnlyThermalZoneList; | |
| 3582 | |||
| 3583 | ✗ | } else { | |
| 3584 |
1/1✓ Branch 1 taken 5862 times.
|
5862 | ss << object; |
| 3585 | } | ||
| 3586 | 5908 | } | |
| 3587 | |||
| 3588 |
1/1✓ Branch 1 taken 16 times.
|
32 | return ss.str(); |
| 3589 | 16 | } | |
| 3590 | |||
| 3591 | 16 | std::string VersionTranslator::update_2_4_1_to_2_4_2(const IdfFile& idf_2_4_1, const IddFileAndFactoryWrapper& idd_2_4_2) { | |
| 3592 |
1/1✓ Branch 1 taken 16 times.
|
16 | std::stringstream ss; |
| 3593 | |||
| 3594 |
4/4✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
✓ Branch 7 taken 16 times.
✓ Branch 10 taken 16 times.
|
16 | ss << idf_2_4_1.header() << '\n' << '\n'; |
| 3595 |
2/2✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
|
16 | IdfFile targetIdf(idd_2_4_2.iddFile()); |
| 3596 |
3/3✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
✓ Branch 7 taken 16 times.
|
16 | ss << targetIdf.versionObject().get(); |
| 3597 | |||
| 3598 | 16 | boost::optional<std::string> value; | |
| 3599 | |||
| 3600 |
3/3✓ Branch 1 taken 16 times.
✓ Branch 8 taken 5912 times.
✓ Branch 9 taken 16 times.
|
5928 | for (IdfObject& object : idf_2_4_1.objects()) { |
| 3601 |
2/2✓ Branch 1 taken 5912 times.
✓ Branch 4 taken 5912 times.
|
5912 | auto iddname = object.iddObject().name(); |
| 3602 | |||
| 3603 |
2/3✓ Branch 1 taken 5912 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 5912 times.
|
5912 | if (iddname == "OS:BuildingUnit") { |
| 3604 | ✗ | auto iddObject = idd_2_4_2.getObject("OS:BuildingUnit"); | |
| 3605 | ✗ | IdfObject newObject(iddObject.get()); | |
| 3606 | |||
| 3607 | ✗ | for (size_t i = 0; i < object.numNonextensibleFields(); ++i) { | |
| 3608 | ✗ | if ((value = object.getString(i))) { | |
| 3609 | ✗ | newObject.setString(i, value.get()); | |
| 3610 | } | ||
| 3611 | } | ||
| 3612 | |||
| 3613 | ✗ | iddObject = idd_2_4_2.getObject("OS:AdditionalProperties"); | |
| 3614 | ✗ | IdfObject additionalProperties(iddObject.get()); | |
| 3615 | ✗ | additionalProperties.setString(0, toString(createUUID())); | |
| 3616 | ✗ | additionalProperties.setString(1, newObject.getString(0).get()); // point additional properties to new object | |
| 3617 | |||
| 3618 | ✗ | size_t newIdx = 2; | |
| 3619 | ✗ | for (size_t oldIdx = object.numNonextensibleFields(); oldIdx < object.numFields(); ++oldIdx, ++newIdx) { | |
| 3620 | ✗ | if ((value = object.getString(oldIdx))) { | |
| 3621 | ✗ | additionalProperties.setString(newIdx, value.get()); | |
| 3622 | } | ||
| 3623 | } | ||
| 3624 | |||
| 3625 | ✗ | ss << newObject; | |
| 3626 | ✗ | m_refactored.emplace_back(std::move(object), std::move(newObject)); | |
| 3627 | ✗ | m_new.push_back(additionalProperties); | |
| 3628 | ✗ | ss << additionalProperties; | |
| 3629 | |||
| 3630 |
2/3✓ Branch 4 taken 5912 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 5912 times.
|
5912 | } else if (iddname == "OS:Boiler:HotWater") { |
| 3631 | ✗ | auto iddObject = idd_2_4_2.getObject("OS:Boiler:HotWater"); | |
| 3632 | ✗ | IdfObject newObject(iddObject.get()); | |
| 3633 | |||
| 3634 | ✗ | for (size_t i = 0; i < object.numNonextensibleFields(); ++i) { | |
| 3635 | ✗ | if ((value = object.getString(i))) { | |
| 3636 | ✗ | newObject.setString(i, value.get()); | |
| 3637 | } | ||
| 3638 | } | ||
| 3639 | ✗ | newObject.setString(18, "General"); | |
| 3640 | |||
| 3641 | ✗ | ss << newObject; | |
| 3642 | ✗ | m_refactored.emplace_back(std::move(object), std::move(newObject)); | |
| 3643 | |||
| 3644 |
2/3✓ Branch 3 taken 5912 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 5912 times.
|
5912 | } else if (iddname == "OS:Boiler:Steam") { |
| 3645 | ✗ | auto iddObject = idd_2_4_2.getObject("OS:Boiler:Steam"); | |
| 3646 | ✗ | IdfObject newObject(iddObject.get()); | |
| 3647 | |||
| 3648 | ✗ | for (size_t i = 0; i < object.numNonextensibleFields(); ++i) { | |
| 3649 | ✗ | if ((value = object.getString(i))) { | |
| 3650 | ✗ | newObject.setString(i, value.get()); | |
| 3651 | } | ||
| 3652 | } | ||
| 3653 | ✗ | newObject.setString(16, "General"); | |
| 3654 | |||
| 3655 | ✗ | ss << newObject; | |
| 3656 | ✗ | m_refactored.emplace_back(std::move(object), std::move(newObject)); | |
| 3657 | |||
| 3658 |
3/3✓ Branch 3 taken 5912 times.
✓ Branch 5 taken 10 times.
✓ Branch 6 taken 5902 times.
|
5912 | } else if (iddname == "OS:WaterHeater:Mixed") { |
| 3659 |
2/2✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
|
10 | auto iddObject = idd_2_4_2.getObject("OS:WaterHeater:Mixed"); |
| 3660 |
2/2✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
|
10 | IdfObject newObject(iddObject.get()); |
| 3661 | |||
| 3662 |
3/3✓ Branch 1 taken 410 times.
✓ Branch 3 taken 400 times.
✓ Branch 4 taken 10 times.
|
410 | for (size_t i = 0; i < object.numNonextensibleFields(); ++i) { |
| 3663 |
2/3✓ Branch 1 taken 400 times.
✓ Branch 5 taken 400 times.
✗ Branch 6 not taken.
|
800 | if ((value = object.getString(i))) { |
| 3664 |
2/2✓ Branch 1 taken 400 times.
✓ Branch 4 taken 400 times.
|
400 | newObject.setString(i, value.get()); |
| 3665 | } | ||
| 3666 | } | ||
| 3667 | |||
| 3668 | // Source Side Flow Control Mode | ||
| 3669 |
2/2✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
|
20 | newObject.setString(40, "IndirectHeatPrimarySetpoint"); |
| 3670 | |||
| 3671 | // Indirect Alternate Setpoint Temperature Schedule Name: nothing to do, leave empty | ||
| 3672 | |||
| 3673 | // End Use Subcategory | ||
| 3674 |
2/2✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
|
10 | newObject.setString(42, "General"); |
| 3675 | |||
| 3676 |
1/1✓ Branch 1 taken 10 times.
|
10 | ss << newObject; |
| 3677 |
1/1✓ Branch 3 taken 10 times.
|
10 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 3678 | |||
| 3679 |
2/3✓ Branch 3 taken 5902 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 5902 times.
|
5912 | } else if (iddname == "OS:Chiller:Electric:EIR") { |
| 3680 | ✗ | auto iddObject = idd_2_4_2.getObject("OS:Chiller:Electric:EIR"); | |
| 3681 | ✗ | IdfObject newObject(iddObject.get()); | |
| 3682 | |||
| 3683 | ✗ | for (size_t i = 0; i < object.numNonextensibleFields(); ++i) { | |
| 3684 | ✗ | if ((value = object.getString(i))) { | |
| 3685 | ✗ | newObject.setString(i, value.get()); | |
| 3686 | } | ||
| 3687 | } | ||
| 3688 | |||
| 3689 | // Condenser Heat Recovery Relative Capacity Fraction: this is an optional | ||
| 3690 | // but in E+ code (ChillerElectricEIR.cc > GetElectricEIRChillerInput() around line 655) | ||
| 3691 | // if omitted (and heat recovery is used), it defaults to 1.0 | ||
| 3692 | // newObject.setDouble(32, 1.0); | ||
| 3693 | |||
| 3694 | // Heat Recovery Inlet High Temperature Limit Schedule Name: leave empty | ||
| 3695 | |||
| 3696 | // Heat Recovery Leaving Temperature Setpoint Node Name: leave empty | ||
| 3697 | |||
| 3698 | // endUseSubcategory | ||
| 3699 | ✗ | newObject.setString(34, "General"); | |
| 3700 | |||
| 3701 | ✗ | ss << newObject; | |
| 3702 | ✗ | m_refactored.emplace_back(std::move(object), std::move(newObject)); | |
| 3703 | |||
| 3704 | // Default case | ||
| 3705 | ✗ | } else { | |
| 3706 |
1/1✓ Branch 1 taken 5902 times.
|
5902 | ss << object; |
| 3707 | } | ||
| 3708 | 5928 | } | |
| 3709 | |||
| 3710 |
1/1✓ Branch 1 taken 16 times.
|
32 | return ss.str(); |
| 3711 | 16 | } | |
| 3712 | |||
| 3713 | 16 | std::string VersionTranslator::update_2_4_3_to_2_5_0(const IdfFile& idf_2_4_3, const IddFileAndFactoryWrapper& idd_2_5_0) { | |
| 3714 |
1/1✓ Branch 1 taken 16 times.
|
16 | std::stringstream ss; |
| 3715 | |||
| 3716 |
4/4✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
✓ Branch 7 taken 16 times.
✓ Branch 10 taken 16 times.
|
16 | ss << idf_2_4_3.header() << '\n' << '\n'; |
| 3717 |
2/2✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
|
16 | IdfFile targetIdf(idd_2_5_0.iddFile()); |
| 3718 |
3/3✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
✓ Branch 7 taken 16 times.
|
16 | ss << targetIdf.versionObject().get(); |
| 3719 | |||
| 3720 | 16 | boost::optional<std::string> value; | |
| 3721 | |||
| 3722 |
3/3✓ Branch 1 taken 16 times.
✓ Branch 8 taken 5912 times.
✓ Branch 9 taken 16 times.
|
5928 | for (IdfObject& object : idf_2_4_3.objects()) { |
| 3723 |
2/2✓ Branch 1 taken 5912 times.
✓ Branch 4 taken 5912 times.
|
5912 | auto iddname = object.iddObject().name(); |
| 3724 | |||
| 3725 |
2/3✓ Branch 1 taken 5912 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 5912 times.
|
5912 | if (iddname == "OS:AirflowNetworkZone") { |
| 3726 | // In 2.5.0, a field "Name" was inserted right after the handle | ||
| 3727 | ✗ | auto iddObject = idd_2_5_0.getObject("OS:AirflowNetworkZone"); | |
| 3728 | ✗ | IdfObject newObject(iddObject.get()); | |
| 3729 | |||
| 3730 | ✗ | for (size_t i = 0; i < object.numNonextensibleFields(); ++i) { | |
| 3731 | ✗ | if ((value = object.getString(i))) { | |
| 3732 | ✗ | if (i == 0) { | |
| 3733 | // Handle | ||
| 3734 | ✗ | newObject.setString(i, value.get()); | |
| 3735 | ✗ | } else if (i == 1) { | |
| 3736 | // Thermal Zone Name field | ||
| 3737 | |||
| 3738 | // We place the Thermal Zone's handle into the right field | ||
| 3739 | ✗ | newObject.setString(i + 1, value.get()); | |
| 3740 | |||
| 3741 | // We want to rename the AFN Zone object with its thermal Zone name | ||
| 3742 | // So we need to locate the right thermal zone from its handle so we can get the name | ||
| 3743 | ✗ | boost::optional<IdfObject> _zone = idf_2_4_3.getObject(toUUID(value.get())); | |
| 3744 | ✗ | if (_zone) { | |
| 3745 | ✗ | newObject.setString(i, "Airflow Network Zone " + _zone->nameString()); | |
| 3746 | } else { | ||
| 3747 | // Safety fall back, name it with the thermal zone handle instead... | ||
| 3748 | ✗ | newObject.setString(i, "Airflow Network Zone " + value.get()); | |
| 3749 | } | ||
| 3750 | |||
| 3751 | ✗ | } else { | |
| 3752 | // Every other is shifted by one field | ||
| 3753 | ✗ | newObject.setString(i + 1, value.get()); | |
| 3754 | } | ||
| 3755 | } | ||
| 3756 | } | ||
| 3757 | |||
| 3758 | ✗ | ss << newObject; | |
| 3759 | ✗ | m_refactored.emplace_back(std::move(object), std::move(newObject)); | |
| 3760 | |||
| 3761 | // Default case | ||
| 3762 | ✗ | } else { | |
| 3763 |
1/1✓ Branch 1 taken 5912 times.
|
5912 | ss << object; |
| 3764 | } | ||
| 3765 | 5928 | } | |
| 3766 | |||
| 3767 |
1/1✓ Branch 1 taken 16 times.
|
32 | return ss.str(); |
| 3768 | 16 | } | |
| 3769 | |||
| 3770 | 16 | std::string VersionTranslator::update_2_6_0_to_2_6_1(const IdfFile& idf_2_6_0, const IddFileAndFactoryWrapper& idd_2_6_1) { | |
| 3771 |
1/1✓ Branch 1 taken 16 times.
|
16 | std::stringstream ss; |
| 3772 | 16 | boost::optional<std::string> value; | |
| 3773 | |||
| 3774 |
4/4✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
✓ Branch 7 taken 16 times.
✓ Branch 10 taken 16 times.
|
16 | ss << idf_2_6_0.header() << '\n' << '\n'; |
| 3775 |
2/2✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
|
16 | IdfFile targetIdf(idd_2_6_1.iddFile()); |
| 3776 |
3/3✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
✓ Branch 7 taken 16 times.
|
16 | ss << targetIdf.versionObject().get(); |
| 3777 | |||
| 3778 | struct ConnectionInfo | ||
| 3779 | { | ||
| 3780 | std::string zoneHandle; | ||
| 3781 | std::string connectionHandle; | ||
| 3782 | std::string newPortListHandle; | ||
| 3783 | }; | ||
| 3784 | // map of a connection object handle to a ConnectionInfo instance | ||
| 3785 | 16 | std::map<std::string, ConnectionInfo> connectionsToFix; | |
| 3786 | |||
| 3787 | // Find the connection object associated with the return air port | ||
| 3788 |
5/5✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
✓ Branch 7 taken 16 times.
✓ Branch 10 taken 16 times.
✓ Branch 13 taken 16 times.
|
48 | auto zones = idf_2_6_0.getObjectsByType(idf_2_6_0.iddFile().getObject("OS:ThermalZone").get()); |
| 3789 |
2/2✓ Branch 5 taken 20 times.
✓ Branch 6 taken 16 times.
|
36 | for (auto& zone : zones) { |
| 3790 | // index 12 is the handle of a connection that will need fixing | ||
| 3791 |
1/1✓ Branch 1 taken 20 times.
|
20 | value = zone.getString(12); |
| 3792 |
1/2✓ Branch 0 taken 20 times.
✗ Branch 1 not taken.
|
20 | if (value) { |
| 3793 | 20 | ConnectionInfo info; | |
| 3794 |
3/3✓ Branch 1 taken 20 times.
✓ Branch 4 taken 20 times.
✓ Branch 7 taken 20 times.
|
20 | info.zoneHandle = zone.getString(0).get(); |
| 3795 |
2/2✓ Branch 1 taken 20 times.
✓ Branch 4 taken 20 times.
|
20 | info.connectionHandle = value.get(); |
| 3796 |
3/3✓ Branch 1 taken 20 times.
✓ Branch 4 taken 20 times.
✓ Branch 7 taken 20 times.
|
20 | connectionsToFix[value.get()] = info; |
| 3797 | 20 | } | |
| 3798 | } | ||
| 3799 | |||
| 3800 |
3/3✓ Branch 1 taken 16 times.
✓ Branch 8 taken 5912 times.
✓ Branch 9 taken 16 times.
|
5928 | for (IdfObject& object : idf_2_6_0.objects()) { |
| 3801 |
2/2✓ Branch 1 taken 5912 times.
✓ Branch 4 taken 5912 times.
|
5912 | auto iddname = object.iddObject().name(); |
| 3802 | |||
| 3803 |
3/3✓ Branch 1 taken 5912 times.
✓ Branch 3 taken 20 times.
✓ Branch 4 taken 5892 times.
|
5912 | if (iddname == "OS:ThermalZone") { |
| 3804 |
2/2✓ Branch 1 taken 20 times.
✓ Branch 4 taken 20 times.
|
20 | auto iddObject = idd_2_6_1.getObject("OS:ThermalZone"); |
| 3805 |
2/2✓ Branch 1 taken 20 times.
✓ Branch 4 taken 20 times.
|
20 | IdfObject newObject(iddObject.get()); |
| 3806 | |||
| 3807 |
4/4✓ Branch 1 taken 20 times.
✓ Branch 4 taken 20 times.
✓ Branch 7 taken 20 times.
✓ Branch 10 taken 20 times.
|
20 | IdfObject newReturnPortList(idd_2_6_1.getObject("OS:PortList").get()); |
| 3808 | |||
| 3809 |
2/2✓ Branch 1 taken 20 times.
✓ Branch 4 taken 20 times.
|
20 | auto h = toString(createUUID()); |
| 3810 |
1/1✓ Branch 1 taken 20 times.
|
20 | newReturnPortList.setString(0, h); |
| 3811 |
3/3✓ Branch 1 taken 20 times.
✓ Branch 4 taken 20 times.
✓ Branch 7 taken 20 times.
|
20 | newReturnPortList.setString(2, object.getString(0).get()); |
| 3812 | |||
| 3813 |
3/3✓ Branch 1 taken 440 times.
✓ Branch 3 taken 420 times.
✓ Branch 4 taken 20 times.
|
440 | for (size_t i = 0; i < object.numNonextensibleFields(); ++i) { |
| 3814 |
1/1✓ Branch 1 taken 420 times.
|
420 | value = object.getString(i); |
| 3815 |
1/2✓ Branch 0 taken 420 times.
✗ Branch 1 not taken.
|
420 | if (value) { |
| 3816 |
2/2✓ Branch 0 taken 20 times.
✓ Branch 1 taken 400 times.
|
420 | if (i == 12) { |
| 3817 |
1/1✓ Branch 1 taken 20 times.
|
20 | auto eg = newReturnPortList.pushExtensibleGroup(); |
| 3818 |
2/2✓ Branch 1 taken 20 times.
✓ Branch 4 taken 20 times.
|
20 | eg.setString(0, value.get()); |
| 3819 |
3/3✓ Branch 1 taken 20 times.
✓ Branch 4 taken 20 times.
✓ Branch 7 taken 20 times.
|
20 | connectionsToFix[value.get()].newPortListHandle = h; |
| 3820 |
1/1✓ Branch 1 taken 20 times.
|
20 | newObject.setString(i, h); |
| 3821 | 20 | } else { | |
| 3822 |
2/2✓ Branch 1 taken 400 times.
✓ Branch 4 taken 400 times.
|
400 | newObject.setString(i, value.get()); |
| 3823 | } | ||
| 3824 | } | ||
| 3825 | } | ||
| 3826 | |||
| 3827 |
1/1✓ Branch 1 taken 20 times.
|
20 | m_refactored.emplace_back(object, newObject); |
| 3828 |
1/1✓ Branch 1 taken 20 times.
|
20 | m_new.push_back(newReturnPortList); |
| 3829 |
1/1✓ Branch 1 taken 20 times.
|
20 | ss << newObject; |
| 3830 |
1/1✓ Branch 1 taken 20 times.
|
20 | ss << newReturnPortList; |
| 3831 |
3/3✓ Branch 5 taken 5892 times.
✓ Branch 7 taken 420 times.
✓ Branch 8 taken 5472 times.
|
5912 | } else if (iddname == "OS:Connection") { |
| 3832 |
1/1✓ Branch 1 taken 420 times.
|
420 | value = object.getString(0); |
| 3833 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 420 times.
✗ Branch 4 not taken.
|
420 | OS_ASSERT(value); |
| 3834 |
2/2✓ Branch 1 taken 420 times.
✓ Branch 4 taken 420 times.
|
420 | auto c = connectionsToFix.find(value.get()); |
| 3835 |
2/2✓ Branch 2 taken 10 times.
✓ Branch 3 taken 410 times.
|
420 | if (c != connectionsToFix.end()) { |
| 3836 |
4/4✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
✓ Branch 7 taken 10 times.
✓ Branch 10 taken 10 times.
|
10 | IdfObject newConnection(idd_2_6_1.getObject("OS:Connection").get()); |
| 3837 |
3/3✓ Branch 1 taken 70 times.
✓ Branch 3 taken 60 times.
✓ Branch 4 taken 10 times.
|
70 | for (size_t i = 0; i < object.numNonextensibleFields(); ++i) { |
| 3838 |
1/1✓ Branch 1 taken 60 times.
|
60 | value = object.getString(i); |
| 3839 |
1/2✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
|
60 | if (value) { |
| 3840 |
2/2✓ Branch 1 taken 60 times.
✓ Branch 4 taken 60 times.
|
60 | newConnection.setString(i, value.get()); |
| 3841 | } | ||
| 3842 | } | ||
| 3843 | // index 3 is the source object port, | ||
| 3844 | // it needs to specify a port on the PortList instead of the ThermalZone now | ||
| 3845 |
1/1✓ Branch 2 taken 10 times.
|
10 | newConnection.setString(2, c->second.newPortListHandle); |
| 3846 |
1/1✓ Branch 1 taken 10 times.
|
10 | newConnection.setUnsigned(3, 3); |
| 3847 |
1/1✓ Branch 1 taken 10 times.
|
10 | ss << newConnection; |
| 3848 |
1/1✓ Branch 3 taken 10 times.
|
10 | m_refactored.emplace_back(std::move(object), std::move(newConnection)); |
| 3849 | 10 | } else { | |
| 3850 |
1/1✓ Branch 1 taken 410 times.
|
410 | ss << object; |
| 3851 | } | ||
| 3852 | // No-op | ||
| 3853 | } else { | ||
| 3854 |
1/1✓ Branch 1 taken 5472 times.
|
5472 | ss << object; |
| 3855 | } | ||
| 3856 | 5928 | } | |
| 3857 | |||
| 3858 |
1/1✓ Branch 1 taken 16 times.
|
32 | return ss.str(); |
| 3859 | 16 | } | |
| 3860 | |||
| 3861 | 16 | std::string VersionTranslator::update_2_6_1_to_2_6_2(const IdfFile& idf_2_6_1, const IddFileAndFactoryWrapper& idd_2_6_2) { | |
| 3862 |
1/1✓ Branch 1 taken 16 times.
|
16 | std::stringstream ss; |
| 3863 | |||
| 3864 |
4/4✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
✓ Branch 7 taken 16 times.
✓ Branch 10 taken 16 times.
|
16 | ss << idf_2_6_1.header() << '\n' << '\n'; |
| 3865 |
2/2✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
|
16 | IdfFile targetIdf(idd_2_6_2.iddFile()); |
| 3866 |
3/3✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
✓ Branch 7 taken 16 times.
|
16 | ss << targetIdf.versionObject().get(); |
| 3867 | |||
| 3868 |
3/3✓ Branch 1 taken 16 times.
✓ Branch 8 taken 5932 times.
✓ Branch 9 taken 16 times.
|
5948 | for (IdfObject& object : idf_2_6_1.objects()) { |
| 3869 |
2/2✓ Branch 1 taken 5932 times.
✓ Branch 4 taken 5932 times.
|
5932 | auto iddname = object.iddObject().name(); |
| 3870 | |||
| 3871 |
2/3✓ Branch 1 taken 5932 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 5932 times.
|
5932 | if (iddname == "OS:EvaporativeCooler:Direct:ResearchSpecial") { |
| 3872 | |||
| 3873 | ✗ | auto iddObject = idd_2_6_2.getObject("OS:EvaporativeCooler:Direct:ResearchSpecial"); | |
| 3874 | ✗ | IdfObject newObject(iddObject.get()); | |
| 3875 | |||
| 3876 | ✗ | for (size_t i = 0; i < object.numNonextensibleFields(); ++i) { | |
| 3877 | ✗ | auto value = object.getString(i); | |
| 3878 | ✗ | if (value) { | |
| 3879 | ✗ | newObject.setString(i, value.get()); | |
| 3880 | } | ||
| 3881 | ✗ | } | |
| 3882 | // The last three fields were added in #3118 as NON optional doubles, so default to extreme values | ||
| 3883 | // to make it behave like when blank = no control | ||
| 3884 | |||
| 3885 | // Evaporative Operation Minimum Drybulb Temperature | ||
| 3886 | ✗ | if (!newObject.getDouble(14)) { | |
| 3887 | ✗ | newObject.setDouble(14, -99); | |
| 3888 | } | ||
| 3889 | // Evaporative Operation Maximum Limit Wetbulb Temperature | ||
| 3890 | ✗ | if (!newObject.getDouble(15)) { | |
| 3891 | ✗ | newObject.setDouble(15, 99); | |
| 3892 | } | ||
| 3893 | // Evaporative Operation Maximum Limit Drybulb Temperature | ||
| 3894 | ✗ | if (!newObject.getDouble(16)) { | |
| 3895 | ✗ | newObject.setDouble(16, 99); | |
| 3896 | } | ||
| 3897 | |||
| 3898 | ✗ | ss << newObject; | |
| 3899 | ✗ | m_refactored.emplace_back(std::move(object), std::move(newObject)); | |
| 3900 | |||
| 3901 |
3/3✓ Branch 3 taken 5932 times.
✓ Branch 5 taken 20 times.
✓ Branch 6 taken 5912 times.
|
5932 | } else if (iddname == "OS:ZoneHVAC:EquipmentList") { |
| 3902 | // In 2.6.2, a field "Load Distribution Scheme" was inserted right after the thermal zone | ||
| 3903 |
2/2✓ Branch 1 taken 20 times.
✓ Branch 4 taken 20 times.
|
20 | auto iddObject = idd_2_6_2.getObject("OS:ZoneHVAC:EquipmentList"); |
| 3904 |
2/2✓ Branch 1 taken 20 times.
✓ Branch 4 taken 20 times.
|
20 | IdfObject newObject(iddObject.get()); |
| 3905 | |||
| 3906 |
3/3✓ Branch 1 taken 140 times.
✓ Branch 3 taken 120 times.
✓ Branch 4 taken 20 times.
|
140 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 3907 |
1/1✓ Branch 1 taken 120 times.
|
120 | auto value = object.getString(i); |
| 3908 |
1/2✓ Branch 0 taken 120 times.
✗ Branch 1 not taken.
|
120 | if (value) { |
| 3909 |
2/2✓ Branch 0 taken 60 times.
✓ Branch 1 taken 60 times.
|
120 | if (i < 3) { |
| 3910 | // Handle | ||
| 3911 |
2/2✓ Branch 1 taken 60 times.
✓ Branch 4 taken 60 times.
|
60 | newObject.setString(i, value.get()); |
| 3912 | } else { | ||
| 3913 | // Every other is shifted by one field | ||
| 3914 |
2/2✓ Branch 1 taken 60 times.
✓ Branch 4 taken 60 times.
|
60 | newObject.setString(i + 1, value.get()); |
| 3915 | } | ||
| 3916 | } | ||
| 3917 | 120 | } | |
| 3918 | |||
| 3919 |
1/1✓ Branch 1 taken 20 times.
|
20 | ss << newObject; |
| 3920 |
1/1✓ Branch 3 taken 20 times.
|
20 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 3921 | |||
| 3922 | 20 | } else { | |
| 3923 |
1/1✓ Branch 1 taken 5912 times.
|
5912 | ss << object; |
| 3924 | } | ||
| 3925 | 5948 | } | |
| 3926 | |||
| 3927 |
1/1✓ Branch 1 taken 16 times.
|
32 | return ss.str(); |
| 3928 | 16 | } | |
| 3929 | |||
| 3930 | 16 | std::string VersionTranslator::update_2_6_2_to_2_7_0(const IdfFile& idf_2_6_2, const IddFileAndFactoryWrapper& idd_2_7_0) { | |
| 3931 |
1/1✓ Branch 1 taken 16 times.
|
16 | std::stringstream ss; |
| 3932 | |||
| 3933 |
4/4✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
✓ Branch 7 taken 16 times.
✓ Branch 10 taken 16 times.
|
16 | ss << idf_2_6_2.header() << '\n' << '\n'; |
| 3934 |
2/2✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
|
16 | IdfFile targetIdf(idd_2_7_0.iddFile()); |
| 3935 |
3/3✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
✓ Branch 7 taken 16 times.
|
16 | ss << targetIdf.versionObject().get(); |
| 3936 | |||
| 3937 | struct ConnectionInfo | ||
| 3938 | { | ||
| 3939 | std::string atuHandle; | ||
| 3940 | std::string connectionHandle; | ||
| 3941 | std::string newNodeHandle; | ||
| 3942 | }; | ||
| 3943 | // map of a connection object handle to a ConnectionInfo instance | ||
| 3944 | 16 | std::map<std::string, ConnectionInfo> connectionsToFix; | |
| 3945 | |||
| 3946 | // Find the connections object associated with the ATU Uncontrolled | ||
| 3947 |
5/5✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
✓ Branch 7 taken 16 times.
✓ Branch 10 taken 16 times.
✓ Branch 13 taken 16 times.
|
48 | auto atus = idf_2_6_2.getObjectsByType(idf_2_6_2.iddFile().getObject("OS:AirTerminal:SingleDuct:Uncontrolled").get()); |
| 3948 |
2/2✓ Branch 5 taken 10 times.
✓ Branch 6 taken 16 times.
|
26 | for (auto& atu : atus) { |
| 3949 | // index 3 = Air Inlet Node Name | ||
| 3950 | // It's the handle of a connection that will need fixing | ||
| 3951 | // Because ATU Uncontrolled was directly connected to ZoneSplitter; now we want a node in between | ||
| 3952 |
1/1✓ Branch 1 taken 10 times.
|
10 | auto value = atu.getString(3); |
| 3953 |
1/2✓ Branch 0 taken 10 times.
✗ Branch 1 not taken.
|
10 | if (value) { |
| 3954 | 10 | ConnectionInfo info; | |
| 3955 |
3/3✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
✓ Branch 7 taken 10 times.
|
10 | info.atuHandle = atu.getString(0).get(); |
| 3956 |
2/2✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
|
10 | info.connectionHandle = value.get(); |
| 3957 |
3/3✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
✓ Branch 7 taken 10 times.
|
10 | connectionsToFix[value.get()] = info; |
| 3958 | 10 | } | |
| 3959 | 10 | } | |
| 3960 | |||
| 3961 |
3/3✓ Branch 1 taken 16 times.
✓ Branch 8 taken 5932 times.
✓ Branch 9 taken 16 times.
|
5948 | for (IdfObject& object : idf_2_6_2.objects()) { |
| 3962 |
2/2✓ Branch 1 taken 5932 times.
✓ Branch 4 taken 5932 times.
|
5932 | auto iddname = object.iddObject().name(); |
| 3963 | |||
| 3964 | // ATU:SingleDuct:Uncontrolled got made obsolete by ATU:SingleDuct:ConstantVolume:NoReheat in E+ 9.0.0 | ||
| 3965 | // in order to be more consistent with the naming of other ATUs, but it also isn't exactly laid out the same | ||
| 3966 |
3/3✓ Branch 1 taken 5932 times.
✓ Branch 3 taken 10 times.
✓ Branch 4 taken 5922 times.
|
5932 | if (iddname == "OS:AirTerminal:SingleDuct:Uncontrolled") { |
| 3967 | // We just create a new object, and copy every field but one. | ||
| 3968 |
2/2✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
|
10 | auto iddObject = idd_2_7_0.getObject("OS:AirTerminal:SingleDuct:ConstantVolume:NoReheat"); |
| 3969 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 10 times.
✗ Branch 4 not taken.
|
10 | OS_ASSERT(iddObject); |
| 3970 |
2/2✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
|
10 | IdfObject newObject(iddObject.get()); |
| 3971 | |||
| 3972 |
3/3✓ Branch 1 taken 70 times.
✓ Branch 3 taken 60 times.
✓ Branch 4 taken 10 times.
|
70 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 3973 |
2/3✓ Branch 1 taken 60 times.
✓ Branch 3 taken 60 times.
✗ Branch 4 not taken.
|
120 | if (auto s = object.getString(i)) { |
| 3974 |
2/2✓ Branch 0 taken 10 times.
✓ Branch 1 taken 50 times.
|
60 | if (i == 3) { |
| 3975 | // ATU Uncontrolled references the AirLoopHVAC:ZoneSplitter directly, here we want a node in between, so we need a new node and a new | ||
| 3976 | // connection | ||
| 3977 | // Before: ZoneSplitter ----connection1---->ATU Uncontrolled | ||
| 3978 | // New: ZoneSplitter-----connection1---->newNode----------newConnection----ATU Single Duct CV No Reheat | ||
| 3979 |
2/2✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
|
10 | auto nodeIdd = idd_2_7_0.getObject("OS:Node"); |
| 3980 |
2/2✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
|
10 | auto nodeHandle = toString(createUUID()); |
| 3981 |
2/2✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
|
10 | IdfObject newNode(nodeIdd.get()); |
| 3982 |
1/1✓ Branch 1 taken 10 times.
|
10 | newNode.setString(0, nodeHandle); |
| 3983 | |||
| 3984 |
2/2✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
|
10 | auto connectionIdd = idd_2_7_0.getObject("OS:Connection"); |
| 3985 | // We pass fastname = true, to mimic the normal behavior (a connection gets a handle for name) | ||
| 3986 |
2/2✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
|
10 | IdfObject newConnection(connectionIdd.get(), true); |
| 3987 |
2/2✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
|
10 | auto newConnectionHandle = toString(createUUID()); |
| 3988 |
1/1✓ Branch 1 taken 10 times.
|
10 | newConnection.setString(0, newConnectionHandle); |
| 3989 | // Name | ||
| 3990 | // Source Object: Node | ||
| 3991 |
1/1✓ Branch 1 taken 10 times.
|
10 | newConnection.setString(2, nodeHandle); |
| 3992 | // Outlet Port: 3 | ||
| 3993 |
1/1✓ Branch 1 taken 10 times.
|
10 | newConnection.setInt(3, 3); |
| 3994 | |||
| 3995 | // Target Object: ATU | ||
| 3996 |
3/3✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
✓ Branch 7 taken 10 times.
|
10 | newConnection.setString(4, newObject.getString(0).get()); |
| 3997 | // Inlet Port: i=3 | ||
| 3998 |
1/1✓ Branch 1 taken 10 times.
|
10 | newConnection.setInt(5, 3); |
| 3999 | |||
| 4000 | // ATU now refers to the newConnection | ||
| 4001 |
1/1✓ Branch 1 taken 10 times.
|
10 | newObject.setString(i, newConnectionHandle); |
| 4002 | |||
| 4003 | // The existing connection is going to have to point to the newNode | ||
| 4004 |
3/3✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
✓ Branch 7 taken 10 times.
|
10 | connectionsToFix[s.get()].newNodeHandle = nodeHandle; |
| 4005 | |||
| 4006 |
3/3✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
✓ Branch 7 taken 10 times.
|
10 | newNode.setName(object.nameString() + " Inlet Node"); |
| 4007 | // Node Inlet Port = old connection | ||
| 4008 |
2/2✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
|
10 | newNode.setString(2, s.get()); |
| 4009 | // Outlet Port = New connection | ||
| 4010 |
1/1✓ Branch 1 taken 10 times.
|
10 | newNode.setString(3, newConnectionHandle); |
| 4011 | |||
| 4012 | // Register new objects | ||
| 4013 |
1/1✓ Branch 1 taken 10 times.
|
10 | m_new.push_back(newNode); |
| 4014 |
1/1✓ Branch 1 taken 10 times.
|
10 | m_new.push_back(newConnection); |
| 4015 |
1/1✓ Branch 1 taken 10 times.
|
10 | ss << newNode; |
| 4016 |
1/1✓ Branch 1 taken 10 times.
|
10 | ss << newConnection; |
| 4017 | |||
| 4018 | 10 | } else { | |
| 4019 | // Otherwise, keep the same | ||
| 4020 |
2/2✓ Branch 1 taken 50 times.
✓ Branch 4 taken 50 times.
|
50 | newObject.setString(i, s.get()); |
| 4021 | } | ||
| 4022 | 60 | } | |
| 4023 | } | ||
| 4024 | |||
| 4025 |
1/1✓ Branch 1 taken 10 times.
|
10 | ss << newObject; |
| 4026 |
1/1✓ Branch 3 taken 10 times.
|
10 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 4027 | |||
| 4028 |
3/3✓ Branch 3 taken 5922 times.
✓ Branch 5 taken 420 times.
✓ Branch 6 taken 5502 times.
|
5932 | } else if (iddname == "OS:Connection") { |
| 4029 | // No-Op for now | ||
| 4030 |
1/1✓ Branch 1 taken 420 times.
|
420 | auto value = object.getString(0); |
| 4031 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 420 times.
✗ Branch 4 not taken.
|
420 | OS_ASSERT(value); |
| 4032 |
4/4✓ Branch 2 taken 420 times.
✓ Branch 5 taken 420 times.
✓ Branch 8 taken 410 times.
✓ Branch 9 taken 10 times.
|
420 | if (connectionsToFix.find(value.get()) == connectionsToFix.end()) { |
| 4033 | // No need to fix it, we just push it | ||
| 4034 |
1/1✓ Branch 1 taken 410 times.
|
410 | ss << object; |
| 4035 | } | ||
| 4036 | |||
| 4037 |
3/3✓ Branch 2 taken 5502 times.
✓ Branch 4 taken 15 times.
✓ Branch 5 taken 5487 times.
|
5922 | } else if (iddname == "OS:Building") { |
| 4038 | // Inserted a field "Standards Template" at position 10 | ||
| 4039 |
2/2✓ Branch 1 taken 15 times.
✓ Branch 4 taken 15 times.
|
15 | auto iddObject = idd_2_7_0.getObject("OS:Building"); |
| 4040 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 15 times.
✗ Branch 4 not taken.
|
15 | OS_ASSERT(iddObject); |
| 4041 |
2/2✓ Branch 1 taken 15 times.
✓ Branch 4 taken 15 times.
|
15 | IdfObject newObject(iddObject.get()); |
| 4042 | |||
| 4043 |
2/2✓ Branch 0 taken 150 times.
✓ Branch 1 taken 15 times.
|
165 | for (size_t i = 0; i < 10; ++i) { |
| 4044 |
3/3✓ Branch 1 taken 150 times.
✓ Branch 3 taken 140 times.
✓ Branch 4 taken 10 times.
|
300 | if (auto s = object.getString(i)) { |
| 4045 |
2/2✓ Branch 1 taken 140 times.
✓ Branch 4 taken 140 times.
|
140 | newObject.setString(i, s.get()); |
| 4046 | 150 | } | |
| 4047 | } | ||
| 4048 | |||
| 4049 |
3/3✓ Branch 1 taken 25 times.
✓ Branch 3 taken 10 times.
✓ Branch 4 taken 15 times.
|
25 | for (size_t i = 10; i < object.numNonextensibleFields(); ++i) { |
| 4050 |
2/3✓ Branch 1 taken 10 times.
✓ Branch 3 taken 10 times.
✗ Branch 4 not taken.
|
20 | if (auto s = object.getString(i)) { |
| 4051 |
2/2✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
|
10 | newObject.setString(i + 1, s.get()); |
| 4052 | 10 | } | |
| 4053 | } | ||
| 4054 | |||
| 4055 | // Field is optional string, so leave it empty | ||
| 4056 | |||
| 4057 |
1/1✓ Branch 1 taken 15 times.
|
15 | ss << newObject; |
| 4058 |
1/1✓ Branch 3 taken 15 times.
|
15 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 4059 | |||
| 4060 |
3/3✓ Branch 3 taken 5487 times.
✓ Branch 5 taken 60 times.
✓ Branch 6 taken 5427 times.
|
5502 | } else if (iddname == "OS:SpaceType") { |
| 4061 | // Added a field "Standards Template" at position 6 | ||
| 4062 |
2/2✓ Branch 1 taken 60 times.
✓ Branch 4 taken 60 times.
|
60 | auto iddObject = idd_2_7_0.getObject("OS:SpaceType"); |
| 4063 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 60 times.
✗ Branch 4 not taken.
|
60 | OS_ASSERT(iddObject); |
| 4064 |
2/2✓ Branch 1 taken 60 times.
✓ Branch 4 taken 60 times.
|
60 | IdfObject newObject(iddObject.get()); |
| 4065 | |||
| 4066 |
2/2✓ Branch 0 taken 360 times.
✓ Branch 1 taken 60 times.
|
420 | for (size_t i = 0; i < 6; ++i) { |
| 4067 |
3/3✓ Branch 1 taken 360 times.
✓ Branch 3 taken 355 times.
✓ Branch 4 taken 5 times.
|
720 | if (auto s = object.getString(i)) { |
| 4068 |
2/2✓ Branch 1 taken 355 times.
✓ Branch 4 taken 355 times.
|
355 | newObject.setString(i, s.get()); |
| 4069 | 360 | } | |
| 4070 | } | ||
| 4071 | |||
| 4072 |
3/3✓ Branch 1 taken 160 times.
✓ Branch 3 taken 100 times.
✓ Branch 4 taken 60 times.
|
160 | for (size_t i = 6; i < object.numNonextensibleFields(); ++i) { |
| 4073 |
2/3✓ Branch 1 taken 100 times.
✓ Branch 3 taken 100 times.
✗ Branch 4 not taken.
|
200 | if (auto s = object.getString(i)) { |
| 4074 |
2/2✓ Branch 1 taken 100 times.
✓ Branch 4 taken 100 times.
|
100 | newObject.setString(i + 1, s.get()); |
| 4075 | 100 | } | |
| 4076 | } | ||
| 4077 | |||
| 4078 | // Field is optional string, so leave it empty | ||
| 4079 | |||
| 4080 |
1/1✓ Branch 1 taken 60 times.
|
60 | ss << newObject; |
| 4081 |
1/1✓ Branch 3 taken 60 times.
|
60 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 4082 | |||
| 4083 | 60 | } else { | |
| 4084 |
1/1✓ Branch 1 taken 5427 times.
|
5427 | ss << object; |
| 4085 | } | ||
| 4086 | 5948 | } | |
| 4087 | |||
| 4088 | // Do a second pass, though you'd expect connections to be after the objects it connects, technically it's possible that it wouldn't | ||
| 4089 | // if the user moved objects manually inside the file | ||
| 4090 | // So I do want connectionInfos to be properly populated with newNodeHandle | ||
| 4091 |
3/3✓ Branch 1 taken 16 times.
✓ Branch 8 taken 5932 times.
✓ Branch 9 taken 16 times.
|
5948 | for (IdfObject& object : idf_2_6_2.objects()) { |
| 4092 |
2/2✓ Branch 1 taken 5932 times.
✓ Branch 4 taken 5932 times.
|
5932 | auto iddname = object.iddObject().name(); |
| 4093 | |||
| 4094 |
3/3✓ Branch 1 taken 5932 times.
✓ Branch 3 taken 420 times.
✓ Branch 4 taken 5512 times.
|
5932 | if (iddname == "OS:Connection") { |
| 4095 |
1/1✓ Branch 1 taken 420 times.
|
420 | auto value = object.getString(0); |
| 4096 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 420 times.
✗ Branch 4 not taken.
|
420 | OS_ASSERT(value); |
| 4097 |
2/2✓ Branch 1 taken 420 times.
✓ Branch 4 taken 420 times.
|
420 | auto c = connectionsToFix.find(value.get()); |
| 4098 |
2/2✓ Branch 2 taken 10 times.
✓ Branch 3 taken 410 times.
|
420 | if (c != connectionsToFix.end()) { |
| 4099 |
4/4✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
✓ Branch 7 taken 10 times.
✓ Branch 10 taken 10 times.
|
10 | IdfObject newConnection(idd_2_7_0.getObject("OS:Connection").get()); |
| 4100 |
3/3✓ Branch 1 taken 70 times.
✓ Branch 3 taken 60 times.
✓ Branch 4 taken 10 times.
|
70 | for (size_t i = 0; i < object.numNonextensibleFields(); ++i) { |
| 4101 |
1/1✓ Branch 1 taken 60 times.
|
60 | auto value = object.getString(i); |
| 4102 |
1/2✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
|
60 | if (value) { |
| 4103 |
2/2✓ Branch 1 taken 60 times.
✓ Branch 4 taken 60 times.
|
60 | newConnection.setString(i, value.get()); |
| 4104 | } | ||
| 4105 | 60 | } | |
| 4106 | |||
| 4107 | // The target object (field 4) becomes the Node handle | ||
| 4108 | // And it connects to the "Inlet Port" of the name (field 2 of the node) | ||
| 4109 |
1/1✓ Branch 2 taken 10 times.
|
10 | newConnection.setString(4, c->second.newNodeHandle); |
| 4110 |
1/1✓ Branch 1 taken 10 times.
|
10 | newConnection.setUnsigned(5, 2); |
| 4111 |
1/1✓ Branch 1 taken 10 times.
|
10 | ss << newConnection; |
| 4112 |
1/1✓ Branch 3 taken 10 times.
|
10 | m_refactored.emplace_back(std::move(object), std::move(newConnection)); |
| 4113 | 10 | } | |
| 4114 | 420 | } | |
| 4115 | 5948 | } | |
| 4116 | |||
| 4117 |
1/1✓ Branch 1 taken 16 times.
|
32 | return ss.str(); |
| 4118 | 16 | } | |
| 4119 | |||
| 4120 | 16 | std::string VersionTranslator::update_2_7_0_to_2_7_1(const IdfFile& idf_2_7_0, const IddFileAndFactoryWrapper& idd_2_7_1) { | |
| 4121 |
1/1✓ Branch 1 taken 16 times.
|
16 | std::stringstream ss; |
| 4122 | 16 | boost::optional<std::string> value; | |
| 4123 | |||
| 4124 |
4/4✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
✓ Branch 7 taken 16 times.
✓ Branch 10 taken 16 times.
|
16 | ss << idf_2_7_0.header() << '\n' << '\n'; |
| 4125 |
2/2✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
|
16 | IdfFile targetIdf(idd_2_7_1.iddFile()); |
| 4126 |
3/3✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
✓ Branch 7 taken 16 times.
|
16 | ss << targetIdf.versionObject().get(); |
| 4127 | |||
| 4128 |
3/3✓ Branch 1 taken 16 times.
✓ Branch 8 taken 5952 times.
✓ Branch 9 taken 16 times.
|
5968 | for (IdfObject& object : idf_2_7_0.objects()) { |
| 4129 |
2/2✓ Branch 1 taken 5952 times.
✓ Branch 4 taken 5952 times.
|
5952 | auto iddname = object.iddObject().name(); |
| 4130 | |||
| 4131 |
3/3✓ Branch 1 taken 5952 times.
✓ Branch 3 taken 10 times.
✓ Branch 4 taken 5942 times.
|
5952 | if (iddname == "OS:Sizing:System") { |
| 4132 | // Note JM 2018-11-05: | ||
| 4133 | // We deprecated the 'Latent' option which is no longer used by E+ (and hasn't been for a long time) | ||
| 4134 | // It should have produced a crash anyways before, but if we find 'Latent', we replace by 'Total' | ||
| 4135 | // Why did I choose 'Total' and not 'Sensible' (or VentilationRequirement)? | ||
| 4136 | // 'Sensible' is the default choice, but if the user had picked 'Latent', they probably didn't want 'Sensible', so I went with 'Total' instead. | ||
| 4137 |
1/1✓ Branch 1 taken 10 times.
|
10 | value = object.getString(2); |
| 4138 |
8/17✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 10 times.
✓ Branch 7 taken 10 times.
✓ Branch 10 taken 10 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 10 times.
✓ Branch 14 taken 10 times.
✗ Branch 15 not taken.
✓ Branch 17 taken 10 times.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✓ Branch 20 taken 10 times.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
|
40 | if (value && istringEqual(value.get(), "Latent")) { |
| 4139 | ✗ | IdfObject newObject = object.clone(true); | |
| 4140 | ✗ | newObject.setString(2, "Total"); | |
| 4141 | ✗ | LOG(Warn, "OS:Sizing:System does not support 'Latent' as 'Type of Load To Size On'. " | |
| 4142 | << "It was replaced by 'Total' instead for object with handle '" << newObject.getString(0).get() | ||
| 4143 | << "'. Please review carefully."); | ||
| 4144 | |||
| 4145 | ✗ | ss << newObject; | |
| 4146 | ✗ | m_refactored.emplace_back(std::move(object), std::move(newObject)); | |
| 4147 | ✗ | } else { | |
| 4148 | // Nothing to do here | ||
| 4149 |
1/1✓ Branch 1 taken 10 times.
|
10 | ss << object; |
| 4150 | } | ||
| 4151 | } else { | ||
| 4152 |
1/1✓ Branch 1 taken 5942 times.
|
5942 | ss << object; |
| 4153 | } | ||
| 4154 | 5968 | } | |
| 4155 | |||
| 4156 |
1/1✓ Branch 1 taken 16 times.
|
32 | return ss.str(); |
| 4157 | 16 | } | |
| 4158 | |||
| 4159 | 16 | std::string VersionTranslator::update_2_7_1_to_2_7_2(const IdfFile& idf_2_7_1, const IddFileAndFactoryWrapper& idd_2_7_2) { | |
| 4160 |
1/1✓ Branch 1 taken 16 times.
|
16 | std::stringstream ss; |
| 4161 | 16 | boost::optional<std::string> value; | |
| 4162 | |||
| 4163 |
4/4✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
✓ Branch 7 taken 16 times.
✓ Branch 10 taken 16 times.
|
16 | ss << idf_2_7_1.header() << '\n' << '\n'; |
| 4164 |
2/2✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
|
16 | IdfFile targetIdf(idd_2_7_2.iddFile()); |
| 4165 |
3/3✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
✓ Branch 7 taken 16 times.
|
16 | ss << targetIdf.versionObject().get(); |
| 4166 | |||
| 4167 |
3/3✓ Branch 1 taken 16 times.
✓ Branch 8 taken 5952 times.
✓ Branch 9 taken 16 times.
|
5968 | for (IdfObject& object : idf_2_7_1.objects()) { |
| 4168 |
2/2✓ Branch 1 taken 5952 times.
✓ Branch 4 taken 5952 times.
|
5952 | auto iddname = object.iddObject().name(); |
| 4169 | |||
| 4170 |
3/3✓ Branch 1 taken 5952 times.
✓ Branch 3 taken 10 times.
✓ Branch 4 taken 5942 times.
|
5952 | if (iddname == "OS:WeatherFile") { |
| 4171 | // Note JM 2019-01-08: We remove the file:// prefix from QUrl | ||
| 4172 |
1/1✓ Branch 1 taken 10 times.
|
10 | value = object.getString(10); |
| 4173 | // If there's a filepath, and it starts with file:// | ||
| 4174 |
5/8✓ Branch 0 taken 10 times.
✗ Branch 1 not taken.
✓ Branch 3 taken 10 times.
✓ Branch 6 taken 10 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 10 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 10 times.
|
10 | if (value && (value.get().rfind("file://", 0) == 0)) { |
| 4175 | ✗ | IdfObject newObject = object.clone(true); | |
| 4176 | ✗ | newObject.setString(10, value.get().substr(7)); | |
| 4177 | ✗ | ss << newObject; | |
| 4178 | ✗ | m_refactored.emplace_back(std::move(object), std::move(newObject)); | |
| 4179 | ✗ | } else { | |
| 4180 | // Nothing to do here | ||
| 4181 |
1/1✓ Branch 1 taken 10 times.
|
10 | ss << object; |
| 4182 | } | ||
| 4183 | |||
| 4184 | // Both of these happen to have the url field at pos 2 (note: neither of these are actually implemented in the SDK, but let's be safe) | ||
| 4185 |
5/8✓ Branch 1 taken 5942 times.
✓ Branch 3 taken 5942 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 5942 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 5942 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 5942 times.
|
5942 | } else if ((iddname == "OS:Construction:WindowDataFile") || (iddname == "OS:Luminaire:Definition")) { |
| 4186 | // Note JM 2019-01-08: We remove the file:// prefix from QUrl | ||
| 4187 | ✗ | value = object.getString(2); | |
| 4188 | // If there's a filepath, and it starts with file:// | ||
| 4189 | ✗ | if (value && (value.get().rfind("file://", 0) == 0)) { | |
| 4190 | ✗ | IdfObject newObject = object.clone(true); | |
| 4191 | ✗ | newObject.setString(2, value.get().substr(7)); | |
| 4192 | ✗ | ss << newObject; | |
| 4193 | ✗ | m_refactored.emplace_back(std::move(object), std::move(newObject)); | |
| 4194 | ✗ | } else { | |
| 4195 | // Nothing to do here | ||
| 4196 | ✗ | ss << object; | |
| 4197 | } | ||
| 4198 | |||
| 4199 |
3/3✓ Branch 1 taken 5942 times.
✓ Branch 3 taken 20 times.
✓ Branch 4 taken 5922 times.
|
5942 | } else if (iddname == "OS:ZoneHVAC:EquipmentList") { |
| 4200 | |||
| 4201 |
2/2✓ Branch 1 taken 20 times.
✓ Branch 4 taken 20 times.
|
20 | auto iddObject = idd_2_7_2.getObject("OS:ZoneHVAC:EquipmentList"); |
| 4202 |
2/2✓ Branch 1 taken 20 times.
✓ Branch 4 taken 20 times.
|
20 | IdfObject newObject(iddObject.get()); |
| 4203 | |||
| 4204 | // Copy non extensible fields in place | ||
| 4205 |
3/3✓ Branch 1 taken 90 times.
✓ Branch 3 taken 70 times.
✓ Branch 4 taken 20 times.
|
90 | for (size_t i = 0; i < object.numNonextensibleFields(); ++i) { |
| 4206 |
2/3✓ Branch 1 taken 70 times.
✓ Branch 5 taken 70 times.
✗ Branch 6 not taken.
|
140 | if ((value = object.getString(i))) { |
| 4207 |
2/2✓ Branch 1 taken 70 times.
✓ Branch 4 taken 70 times.
|
70 | newObject.setString(i, value.get()); |
| 4208 | } | ||
| 4209 | } | ||
| 4210 | |||
| 4211 | // Copy the existing eg values (the new fields were added at the end of the extensible groups, and have defaults) | ||
| 4212 |
3/3✓ Branch 1 taken 20 times.
✓ Branch 8 taken 20 times.
✓ Branch 9 taken 20 times.
|
40 | for (const IdfExtensibleGroup& eg : object.extensibleGroups()) { |
| 4213 |
1/1✓ Branch 1 taken 20 times.
|
20 | IdfExtensibleGroup new_eg = newObject.pushExtensibleGroup(); |
| 4214 |
2/2✓ Branch 0 taken 60 times.
✓ Branch 1 taken 20 times.
|
80 | for (size_t i = 0; i < 3; ++i) { |
| 4215 |
3/3✓ Branch 1 taken 60 times.
✓ Branch 4 taken 60 times.
✓ Branch 7 taken 60 times.
|
60 | new_eg.setString(i, eg.getString(i).get()); |
| 4216 | } | ||
| 4217 | 40 | } | |
| 4218 | |||
| 4219 |
1/1✓ Branch 1 taken 20 times.
|
20 | ss << newObject; |
| 4220 |
1/1✓ Branch 3 taken 20 times.
|
20 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 4221 | |||
| 4222 | // No-op | ||
| 4223 | 20 | } else { | |
| 4224 |
1/1✓ Branch 1 taken 5922 times.
|
5922 | ss << object; |
| 4225 | } | ||
| 4226 | 5968 | } | |
| 4227 | |||
| 4228 |
1/1✓ Branch 1 taken 16 times.
|
32 | return ss.str(); |
| 4229 | 16 | } | |
| 4230 | |||
| 4231 | 16 | std::string VersionTranslator::update_2_8_1_to_2_9_0(const IdfFile& idf_2_8_1, const IddFileAndFactoryWrapper& idd_2_9_0) { | |
| 4232 |
1/1✓ Branch 1 taken 16 times.
|
16 | std::stringstream ss; |
| 4233 | 16 | boost::optional<std::string> value; | |
| 4234 | |||
| 4235 |
4/4✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
✓ Branch 7 taken 16 times.
✓ Branch 10 taken 16 times.
|
16 | ss << idf_2_8_1.header() << '\n' << '\n'; |
| 4236 |
2/2✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
|
16 | IdfFile targetIdf(idd_2_9_0.iddFile()); |
| 4237 |
3/3✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
✓ Branch 7 taken 16 times.
|
16 | ss << targetIdf.versionObject().get(); |
| 4238 | |||
| 4239 |
3/3✓ Branch 1 taken 16 times.
✓ Branch 8 taken 5952 times.
✓ Branch 9 taken 16 times.
|
5968 | for (IdfObject& object : idf_2_8_1.objects()) { |
| 4240 |
2/2✓ Branch 1 taken 5952 times.
✓ Branch 4 taken 5952 times.
|
5952 | auto iddname = object.iddObject().name(); |
| 4241 | |||
| 4242 |
2/3✓ Branch 1 taken 5952 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 5952 times.
|
5952 | if (iddname == "OS:Foundation:Kiva") { |
| 4243 | ✗ | auto iddObject = idd_2_9_0.getObject("OS:Foundation:Kiva"); | |
| 4244 | ✗ | IdfObject newObject(iddObject.get()); | |
| 4245 | |||
| 4246 | ✗ | for (size_t i = 0; i < object.numFields(); ++i) { | |
| 4247 | ✗ | if ((value = object.getString(i))) { | |
| 4248 | ✗ | if (i < 2) { | |
| 4249 | // Handle | ||
| 4250 | ✗ | newObject.setString(i, value.get()); | |
| 4251 | } else { | ||
| 4252 | // Every other is shifted by one field | ||
| 4253 | ✗ | newObject.setString(i + 1, value.get()); | |
| 4254 | } | ||
| 4255 | } | ||
| 4256 | } | ||
| 4257 | |||
| 4258 | ✗ | ss << newObject; | |
| 4259 | ✗ | m_refactored.emplace_back(std::move(object), std::move(newObject)); | |
| 4260 | |||
| 4261 |
2/3✓ Branch 3 taken 5952 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 5952 times.
|
5952 | } else if (iddname == "OS:Schedule:FixedInterval") { |
| 4262 | ✗ | auto iddObject = idd_2_9_0.getObject("OS:Schedule:FixedInterval"); | |
| 4263 | ✗ | IdfObject newObject(iddObject.get()); | |
| 4264 | |||
| 4265 | ✗ | for (size_t i = 0; i < object.numFields(); ++i) { | |
| 4266 | ✗ | if ((value = object.getString(i))) { | |
| 4267 | ✗ | if (i < 3) { | |
| 4268 | // Schedule Type Limits Name | ||
| 4269 | ✗ | newObject.setString(i, value.get()); | |
| 4270 | } else { | ||
| 4271 | // Every other is shifted by one field | ||
| 4272 | ✗ | newObject.setString(i + 1, value.get()); | |
| 4273 | } | ||
| 4274 | } | ||
| 4275 | } | ||
| 4276 | |||
| 4277 | ✗ | ss << newObject; | |
| 4278 | ✗ | m_refactored.emplace_back(std::move(object), std::move(newObject)); | |
| 4279 | |||
| 4280 |
3/3✓ Branch 3 taken 5952 times.
✓ Branch 5 taken 20 times.
✓ Branch 6 taken 5932 times.
|
5952 | } else if (iddname == "OS:ZoneHVAC:EquipmentList") { |
| 4281 |
2/2✓ Branch 1 taken 20 times.
✓ Branch 4 taken 20 times.
|
20 | auto iddObject = idd_2_9_0.getObject("OS:ZoneHVAC:EquipmentList"); |
| 4282 |
2/2✓ Branch 1 taken 20 times.
✓ Branch 4 taken 20 times.
|
20 | IdfObject newObject(iddObject.get()); |
| 4283 | |||
| 4284 | // Copy non extensible fields in place | ||
| 4285 |
3/3✓ Branch 1 taken 90 times.
✓ Branch 3 taken 70 times.
✓ Branch 4 taken 20 times.
|
90 | for (size_t i = 0; i < object.numNonextensibleFields(); ++i) { |
| 4286 |
2/3✓ Branch 1 taken 70 times.
✓ Branch 5 taken 70 times.
✗ Branch 6 not taken.
|
140 | if ((value = object.getString(i))) { |
| 4287 |
2/2✓ Branch 1 taken 70 times.
✓ Branch 4 taken 70 times.
|
70 | newObject.setString(i, value.get()); |
| 4288 | } | ||
| 4289 | } | ||
| 4290 | |||
| 4291 | // Copy the eg values 0 through 2 and create ScheduleConstant out of 3 and 4 | ||
| 4292 |
3/3✓ Branch 1 taken 20 times.
✓ Branch 8 taken 20 times.
✓ Branch 9 taken 20 times.
|
40 | for (const IdfExtensibleGroup& eg : object.extensibleGroups()) { |
| 4293 |
1/1✓ Branch 1 taken 20 times.
|
20 | IdfExtensibleGroup new_eg = newObject.pushExtensibleGroup(); |
| 4294 |
2/2✓ Branch 0 taken 100 times.
✓ Branch 1 taken 20 times.
|
120 | for (size_t i = 0; i < 5; ++i) { |
| 4295 |
2/2✓ Branch 0 taken 40 times.
✓ Branch 1 taken 60 times.
|
100 | if (i > 2) { |
| 4296 | 40 | boost::optional<double> fraction; | |
| 4297 |
2/3✓ Branch 1 taken 40 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 40 times.
|
80 | if ((fraction = eg.getDouble(i))) { |
| 4298 | ✗ | auto iddObject = idd_2_9_0.getObject("OS:Schedule:Constant"); | |
| 4299 | ✗ | IdfObject scheduleConstant(iddObject.get()); | |
| 4300 | ✗ | std::string uuid = toString(createUUID()); | |
| 4301 | ✗ | scheduleConstant.setString(0, uuid); | |
| 4302 | ✗ | scheduleConstant.setString(1, "Name"); | |
| 4303 | // eg.getString(0) is the equipment handle | ||
| 4304 | // | ||
| 4305 | ✗ | boost::optional<IdfObject> _eq = idf_2_8_1.getObject(toUUID(eg.getString(0).get())); | |
| 4306 | ✗ | if (_eq) { | |
| 4307 | // name of zone equipment plus group index | ||
| 4308 | ✗ | scheduleConstant.setString(1, _eq->nameString() + " " + std::to_string(static_cast<int>(i))); | |
| 4309 | } | ||
| 4310 | |||
| 4311 | ✗ | scheduleConstant.setString(2, ""); | |
| 4312 | ✗ | scheduleConstant.setDouble(3, fraction.get()); | |
| 4313 | |||
| 4314 | ✗ | m_new.push_back(scheduleConstant); | |
| 4315 | ✗ | ss << scheduleConstant; | |
| 4316 | |||
| 4317 | ✗ | new_eg.setString(i, uuid); | |
| 4318 | ✗ | } | |
| 4319 | } else { | ||
| 4320 |
3/3✓ Branch 1 taken 60 times.
✓ Branch 4 taken 60 times.
✓ Branch 7 taken 60 times.
|
60 | new_eg.setString(i, eg.getString(i).get()); |
| 4321 | } | ||
| 4322 | } | ||
| 4323 | 40 | } | |
| 4324 | |||
| 4325 |
1/1✓ Branch 1 taken 20 times.
|
20 | ss << newObject; |
| 4326 |
1/1✓ Branch 3 taken 20 times.
|
20 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 4327 | |||
| 4328 |
2/3✓ Branch 3 taken 5932 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 5932 times.
|
5952 | } else if (iddname == "OS:ThermalStorage:Ice:Detailed") { |
| 4329 | ✗ | auto iddObject = idd_2_9_0.getObject("OS:ThermalStorage:Ice:Detailed"); | |
| 4330 | ✗ | IdfObject newObject(iddObject.get()); | |
| 4331 | |||
| 4332 | // Inserting two fields: after position 5 and after position 6 | ||
| 4333 | ✗ | for (size_t i = 0; i < object.numFields(); ++i) { | |
| 4334 | ✗ | if ((value = object.getString(i))) { | |
| 4335 | ✗ | if (i < 6) { | |
| 4336 | // 0-5 Unchanged | ||
| 4337 | ✗ | newObject.setString(i, value.get()); | |
| 4338 | ✗ | } else if (i == 6) { | |
| 4339 | // 6 (Discharge Curve) is Shifted by one field | ||
| 4340 | ✗ | newObject.setString(i + 1, value.get()); | |
| 4341 | } else { | ||
| 4342 | // 7 (Charge Curve)-End Shifted by two fields | ||
| 4343 | ✗ | newObject.setString(i + 2, value.get()); | |
| 4344 | } | ||
| 4345 | } | ||
| 4346 | } | ||
| 4347 | |||
| 4348 | // Now deal with new fields. | ||
| 4349 | // From https://github.com/NREL/EnergyPlus/pull/7339/files#diff-6bcecd46a03668bc5e9998616e6e8066R476, E+ transition rules | ||
| 4350 | // if QuadraticLinear => FractionDischargedLMTD/FractionChargedLMTD for discharge/charge respectively | ||
| 4351 | // if CubicLinear => LMTDMassFlow | ||
| 4352 | // else, does something wrong. | ||
| 4353 | // | ||
| 4354 | // OpenStudio doesn't wrap CubicLinear. I doubt many people were using TableMultiVariableLookup and probably wouldn't more right to set that as | ||
| 4355 | // LMTDMassFlow, so let's just do ahead and set everything to Fraction(Dis)ChargedLMTD | ||
| 4356 | |||
| 4357 | // DischargingCurve was in field 6. New object 6 is the Discharging Specifications, 7 is the Discharging Curve | ||
| 4358 | ✗ | newObject.setString(6, "FractionDischargedLMTD"); | |
| 4359 | /* | ||
| 4360 | *boost::optional<std::string> dischargingCurveHandle = object.getString(6); | ||
| 4361 | *OS_ASSERT(dischargingCurveHandle); | ||
| 4362 | *boost::optional<IdfObject> dischargingCurve = idf_2_8_1.getObject(toUUID(dischargingCurveHandle.get())); | ||
| 4363 | *OS_ASSERT(dischargingCurve); | ||
| 4364 | *IddObject dischargingCurveIddObject = dischargingCurve->iddObject(); | ||
| 4365 | *std::string dischargingCurveIddObjectName = dischargingCurveIddObject.name(); | ||
| 4366 | *if (openstudio::istringEqual(dischargingCurveIddObjectName, "OS:Curve:QuadraticLinear")) { | ||
| 4367 | * newObject.setString(6, "FractionDischargedLMTD"); | ||
| 4368 | *} else { | ||
| 4369 | * newObject.setString(6, "LMTDMassFlow"); | ||
| 4370 | *} | ||
| 4371 | */ | ||
| 4372 | |||
| 4373 | // ChargingCurve was in field 7. New Object 8 is the Charging Specifications, 9 is the Charging Curve | ||
| 4374 | ✗ | newObject.setString(8, "FractionChargedLMTD"); | |
| 4375 | |||
| 4376 | /* | ||
| 4377 | *boost::optional<std::string> chargingCurveHandle = object.getString(7); | ||
| 4378 | *OS_ASSERT(chargingCurveHandle); | ||
| 4379 | *boost::optional<IdfObject> chargingCurve = idf_2_8_1.getObject(toUUID(chargingCurveHandle.get())); | ||
| 4380 | *OS_ASSERT(chargingCurve); | ||
| 4381 | *IddObject chargingCurveIddObject = chargingCurve->iddObject(); | ||
| 4382 | *std::string chargingCurveIddObjectName = chargingCurveIddObject.name(); | ||
| 4383 | *if (openstudio::istringEqual(chargingCurveIddObjectName, "OS:Curve:QuadraticLinear")) { | ||
| 4384 | * newObject.setString(8, "FractionChargedLMTD"); | ||
| 4385 | *} else { | ||
| 4386 | * newObject.setString(8, "LMTDMassFlow"); | ||
| 4387 | *} | ||
| 4388 | */ | ||
| 4389 | |||
| 4390 | ✗ | ss << newObject; | |
| 4391 | ✗ | m_refactored.emplace_back(std::move(object), std::move(newObject)); | |
| 4392 | |||
| 4393 |
2/3✓ Branch 3 taken 5932 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 5932 times.
|
5932 | } else if (iddname == "OS:AirLoopHVAC:UnitaryHeatCool:VAVChangeoverBypass") { |
| 4394 | ✗ | auto iddObject = idd_2_9_0.getObject("OS:AirLoopHVAC:UnitaryHeatCool:VAVChangeoverBypass"); | |
| 4395 | ✗ | IdfObject newObject(iddObject.get()); | |
| 4396 | |||
| 4397 | // We only add two fields at the end, so copy all existing | ||
| 4398 | ✗ | for (size_t i = 0; i < object.numFields(); ++i) { | |
| 4399 | ✗ | if ((value = object.getString(i))) { | |
| 4400 | ✗ | newObject.setString(i, value.get()); | |
| 4401 | } | ||
| 4402 | } | ||
| 4403 | |||
| 4404 | // At 24, we add a Connection and a Node for the Plenum or Mixer Inlet Node | ||
| 4405 | ✗ | auto nodeIdd = idd_2_9_0.getObject("OS:Node"); | |
| 4406 | ✗ | auto nodeHandle = toString(createUUID()); | |
| 4407 | ✗ | IdfObject newNode(nodeIdd.get()); | |
| 4408 | ✗ | newNode.setString(0, nodeHandle); | |
| 4409 | |||
| 4410 | ✗ | auto connectionIdd = idd_2_9_0.getObject("OS:Connection"); | |
| 4411 | // We pass fastname = true, to mimic the normal behavior (a connection gets a handle for name) | ||
| 4412 | ✗ | IdfObject newConnection(connectionIdd.get(), true); | |
| 4413 | ✗ | auto newConnectionHandle = toString(createUUID()); | |
| 4414 | ✗ | newConnection.setString(0, newConnectionHandle); | |
| 4415 | // Name | ||
| 4416 | // Source Object: Unitary | ||
| 4417 | ✗ | newConnection.setString(2, newObject.getString(0).get()); | |
| 4418 | // Outlet Port: 24 | ||
| 4419 | ✗ | newConnection.setInt(3, 24); | |
| 4420 | |||
| 4421 | // Target Object: Node | ||
| 4422 | ✗ | newConnection.setString(4, nodeHandle); | |
| 4423 | // Inlet Port: i=2 | ||
| 4424 | ✗ | newConnection.setInt(5, 2); | |
| 4425 | |||
| 4426 | // Unitary now refers to the newConnection | ||
| 4427 | ✗ | newObject.setString(24, newConnectionHandle); | |
| 4428 | |||
| 4429 | ✗ | newNode.setName(object.nameString() + " Plenum or Mixer Inlet Node"); | |
| 4430 | // Node Inlet Port = new connection | ||
| 4431 | ✗ | newNode.setString(2, newConnectionHandle); | |
| 4432 | // Outlet Port stays blank | ||
| 4433 | |||
| 4434 | // At 25, we add a numeric field Minimum Runtime Before Operating Change, which we want to set to zero to match historical behavior | ||
| 4435 | // and what the Ctor now does | ||
| 4436 | ✗ | newObject.setDouble(25, 0.0); | |
| 4437 | |||
| 4438 | // Register new objects | ||
| 4439 | ✗ | m_new.push_back(newNode); | |
| 4440 | ✗ | m_new.push_back(newConnection); | |
| 4441 | ✗ | ss << newNode; | |
| 4442 | ✗ | ss << newConnection; | |
| 4443 | |||
| 4444 | // Register refactored | ||
| 4445 | ✗ | ss << newObject; | |
| 4446 | ✗ | m_refactored.emplace_back(std::move(object), std::move(newObject)); | |
| 4447 | |||
| 4448 | // Four fields were added but only the last (End Use Subcat) was implemented, but withotu transition rules either | ||
| 4449 |
5/8✓ Branch 9 taken 5932 times.
✓ Branch 11 taken 5932 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 5932 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 5932 times.
✗ Branch 18 not taken.
✓ Branch 19 taken 5932 times.
|
5932 | } else if ((iddname == "OS:HeaderedPumps:ConstantSpeed") || (iddname == "OS:HeaderedPumps:VariableSpeed")) { |
| 4450 | ✗ | auto iddObject = idd_2_9_0.getObject(iddname); | |
| 4451 | ✗ | IdfObject newObject(iddObject.get()); | |
| 4452 | |||
| 4453 | ✗ | for (size_t i = 0; i < object.numFields(); ++i) { | |
| 4454 | ✗ | if ((value = object.getString(i))) { | |
| 4455 | ✗ | newObject.setString(i, value.get()); | |
| 4456 | } | ||
| 4457 | } | ||
| 4458 | |||
| 4459 | ✗ | unsigned currentIndex = 20; | |
| 4460 | ✗ | if (iddname == "OS:HeaderedPumps:ConstantSpeed") { | |
| 4461 | ✗ | currentIndex = 15; | |
| 4462 | } | ||
| 4463 | |||
| 4464 | // DesignPowerSizingMethod | ||
| 4465 | ✗ | newObject.setString(currentIndex++, "PowerPerFlowPerPressure"); | |
| 4466 | // DesignElectricPowerPerUnitFlowRate | ||
| 4467 | ✗ | newObject.setDouble(currentIndex++, 348701.1); | |
| 4468 | // DesignElectricPowerPerUnitFlowRate | ||
| 4469 | ✗ | newObject.setDouble(currentIndex++, 1.282051282); | |
| 4470 | |||
| 4471 | // EndUseSubcategory | ||
| 4472 | ✗ | if ((value = object.getString(currentIndex))) { | |
| 4473 | ✗ | newObject.setString(currentIndex, value.get()); | |
| 4474 | } else { | ||
| 4475 | ✗ | newObject.setString(currentIndex, "General"); | |
| 4476 | } | ||
| 4477 | |||
| 4478 | // Register refactored | ||
| 4479 | ✗ | ss << newObject; | |
| 4480 | ✗ | m_refactored.emplace_back(std::move(object), std::move(newObject)); | |
| 4481 | |||
| 4482 | // No-op | ||
| 4483 | ✗ | } else { | |
| 4484 |
1/1✓ Branch 1 taken 5932 times.
|
5932 | ss << object; |
| 4485 | } | ||
| 4486 | 5968 | } | |
| 4487 | |||
| 4488 |
1/1✓ Branch 1 taken 16 times.
|
32 | return ss.str(); |
| 4489 | 16 | } | |
| 4490 | |||
| 4491 | 16 | std::string VersionTranslator::update_2_9_0_to_2_9_1(const IdfFile& idf_2_9_0, const IddFileAndFactoryWrapper& idd_2_9_1) { | |
| 4492 |
1/1✓ Branch 1 taken 16 times.
|
16 | std::stringstream ss; |
| 4493 | 16 | boost::optional<std::string> value; | |
| 4494 | |||
| 4495 |
4/4✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
✓ Branch 7 taken 16 times.
✓ Branch 10 taken 16 times.
|
16 | ss << idf_2_9_0.header() << '\n' << '\n'; |
| 4496 |
2/2✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
|
16 | IdfFile targetIdf(idd_2_9_1.iddFile()); |
| 4497 |
3/3✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
✓ Branch 7 taken 16 times.
|
16 | ss << targetIdf.versionObject().get(); |
| 4498 | |||
| 4499 | 16 | boost::optional<IdfObject> alwaysOnDiscreteSchedule; | |
| 4500 | |||
| 4501 | // Add an alwaysOnDiscreteSchedule if one does not already exist | ||
| 4502 |
2/2✓ Branch 0 taken 15 times.
✓ Branch 1 taken 1 time.
|
16 | if (!m_isComponent) { |
| 4503 |
3/3✓ Branch 1 taken 15 times.
✓ Branch 8 taken 5950 times.
✓ Branch 9 taken 15 times.
|
5965 | for (const IdfObject& object : idf_2_9_0.objects()) { |
| 4504 |
5/5✓ Branch 1 taken 5950 times.
✓ Branch 4 taken 5950 times.
✓ Branch 7 taken 5950 times.
✓ Branch 11 taken 35 times.
✓ Branch 12 taken 5915 times.
|
5950 | if (object.iddObject().name() == "OS:Schedule:Constant") { |
| 4505 |
2/3✓ Branch 1 taken 35 times.
✓ Branch 3 taken 35 times.
✗ Branch 4 not taken.
|
70 | if (boost::optional<std::string> name = object.getString(1)) { |
| 4506 |
5/5✓ Branch 1 taken 35 times.
✓ Branch 4 taken 35 times.
✓ Branch 7 taken 35 times.
✓ Branch 10 taken 15 times.
✓ Branch 11 taken 20 times.
|
70 | if (istringEqual(name.get(), "Always On Discrete")) { |
| 4507 |
2/3✓ Branch 1 taken 15 times.
✓ Branch 3 taken 15 times.
✗ Branch 4 not taken.
|
30 | if (boost::optional<double> value = object.getDouble(3)) { |
| 4508 |
2/3✓ Branch 2 taken 15 times.
✓ Branch 5 taken 15 times.
✗ Branch 6 not taken.
|
15 | if (equal<double>(value.get(), 1.0)) { |
| 4509 |
1/1✓ Branch 1 taken 15 times.
|
15 | alwaysOnDiscreteSchedule = object; |
| 4510 | } | ||
| 4511 | } | ||
| 4512 | } | ||
| 4513 | 35 | } | |
| 4514 | } | ||
| 4515 | 15 | } | |
| 4516 | |||
| 4517 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 15 times.
|
15 | if (!alwaysOnDiscreteSchedule) { |
| 4518 | ✗ | alwaysOnDiscreteSchedule = IdfObject(idd_2_9_1.getObject("OS:Schedule:Constant").get()); | |
| 4519 | |||
| 4520 | ✗ | alwaysOnDiscreteSchedule->setString(0, toString(createUUID())); | |
| 4521 | ✗ | alwaysOnDiscreteSchedule->setString(1, "Always On Discrete"); | |
| 4522 | ✗ | alwaysOnDiscreteSchedule->setDouble(3, 1.0); | |
| 4523 | |||
| 4524 | ✗ | IdfObject typeLimits(idd_2_9_1.getObject("OS:ScheduleTypeLimits").get()); | |
| 4525 | ✗ | typeLimits.setString(0, toString(createUUID())); | |
| 4526 | ✗ | typeLimits.setString(1, "Always On Discrete Limits"); | |
| 4527 | ✗ | typeLimits.setDouble(2, 0.0); | |
| 4528 | ✗ | typeLimits.setDouble(3, 1.0); | |
| 4529 | ✗ | typeLimits.setString(4, "Discrete"); | |
| 4530 | ✗ | typeLimits.setString(5, "Availability"); | |
| 4531 | |||
| 4532 | ✗ | alwaysOnDiscreteSchedule->setString(2, typeLimits.getString(0).get()); | |
| 4533 | |||
| 4534 | ✗ | ss << alwaysOnDiscreteSchedule.get(); | |
| 4535 | ✗ | ss << typeLimits; | |
| 4536 | |||
| 4537 | // Register new objects | ||
| 4538 | ✗ | m_new.push_back(alwaysOnDiscreteSchedule.get()); | |
| 4539 | ✗ | m_new.push_back(typeLimits); | |
| 4540 | ✗ | } | |
| 4541 | } // End locating or creating alwaysOnDiscreteSchedule | ||
| 4542 | |||
| 4543 |
3/3✓ Branch 1 taken 16 times.
✓ Branch 8 taken 5952 times.
✓ Branch 9 taken 16 times.
|
5968 | for (IdfObject& object : idf_2_9_0.objects()) { |
| 4544 |
2/2✓ Branch 1 taken 5952 times.
✓ Branch 4 taken 5952 times.
|
5952 | auto iddname = object.iddObject().name(); |
| 4545 | |||
| 4546 |
2/3✓ Branch 1 taken 5952 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 5952 times.
|
5952 | if (iddname == "OS:AvailabilityManager:NightCycle") { |
| 4547 | ✗ | auto iddObject = idd_2_9_1.getObject("OS:AvailabilityManager:NightCycle"); | |
| 4548 | ✗ | IdfObject newObject(iddObject.get()); | |
| 4549 | |||
| 4550 | ✗ | for (size_t i = 0; i < object.numFields(); ++i) { | |
| 4551 | ✗ | if ((value = object.getString(i))) { | |
| 4552 | ✗ | newObject.setString(i, value.get()); | |
| 4553 | } | ||
| 4554 | } | ||
| 4555 | |||
| 4556 | // Applicability Schedule | ||
| 4557 | ✗ | newObject.setString(2, alwaysOnDiscreteSchedule->getString(0).get()); | |
| 4558 | |||
| 4559 | ✗ | ss << newObject; | |
| 4560 | ✗ | m_refactored.emplace_back(std::move(object), std::move(newObject)); | |
| 4561 | |||
| 4562 | // No-op | ||
| 4563 | ✗ | } else { | |
| 4564 |
1/1✓ Branch 1 taken 5952 times.
|
5952 | ss << object; |
| 4565 | } | ||
| 4566 | 5968 | } | |
| 4567 | |||
| 4568 |
1/1✓ Branch 1 taken 16 times.
|
32 | return ss.str(); |
| 4569 | 16 | } | |
| 4570 | |||
| 4571 | 20 | std::string VersionTranslator::update_2_9_1_to_3_0_0(const IdfFile& idf_2_9_1, const IddFileAndFactoryWrapper& idd_3_0_0) { | |
| 4572 |
1/1✓ Branch 1 taken 20 times.
|
20 | std::stringstream ss; |
| 4573 | 20 | boost::optional<std::string> value; | |
| 4574 | |||
| 4575 |
4/4✓ Branch 1 taken 20 times.
✓ Branch 4 taken 20 times.
✓ Branch 7 taken 20 times.
✓ Branch 10 taken 20 times.
|
20 | ss << idf_2_9_1.header() << '\n' << '\n'; |
| 4576 |
2/2✓ Branch 1 taken 20 times.
✓ Branch 4 taken 20 times.
|
20 | IdfFile targetIdf(idd_3_0_0.iddFile()); |
| 4577 |
3/3✓ Branch 1 taken 20 times.
✓ Branch 4 taken 20 times.
✓ Branch 7 taken 20 times.
|
20 | ss << targetIdf.versionObject().get(); |
| 4578 | |||
| 4579 | // Making the map case-insensitive by providing a Comparator `IstringCompare` | ||
| 4580 | const std::map<std::string, std::string, openstudio::IstringCompare> replaceFuelTypesMap({ | ||
| 4581 | {"FuelOil#1", "FuelOilNo1"}, | ||
| 4582 | {"FuelOil#2", "FuelOilNo2"}, | ||
| 4583 | {"Gas", "NaturalGas"}, | ||
| 4584 | {"PropaneGas", "Propane"}, | ||
| 4585 |
2/4✓ Branch 0 taken 80 times.
✓ Branch 1 taken 20 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
100 | }); |
| 4586 | |||
| 4587 | const std::multimap<std::string, int> fuelTypeRenamesMap({ | ||
| 4588 | ✗ | {"OS:OtherEquipment", 6}, // Fuel Type | |
| 4589 | ✗ | {"OS:Exterior:FuelEquipment", 4}, // Fuel Use Type | |
| 4590 | ✗ | {"OS:AirConditioner:VariableRefrigerantFlow", 67}, // Fuel Type | |
| 4591 | ✗ | {"OS:Boiler:Steam", 2}, // Fuel Type | |
| 4592 | ✗ | {"OS:Coil:Cooling:DX:MultiSpeed", 16}, // Fuel Type | |
| 4593 | ✗ | {"OS:Coil:Heating:Gas", 11}, // Fuel Type | |
| 4594 | ✗ | {"OS:Coil:Heating:DX:MultiSpeed", 16}, // Fuel Type | |
| 4595 | ✗ | {"OS:WaterHeater:Mixed", 11}, // Heater Fuel Type | |
| 4596 | ✗ | {"OS:WaterHeater:Mixed", 15}, // Off Cycle Parasitic Fuel Type | |
| 4597 | ✗ | {"OS:WaterHeater:Mixed", 18}, // On Cycle Parasitic Fuel Type | |
| 4598 | ✗ | {"OS:WaterHeater:Stratified", 17}, // Heater Fuel Type | |
| 4599 | ✗ | {"OS:WaterHeater:Stratified", 20}, // Off Cycle Parasitic Fuel Type | |
| 4600 | ✗ | {"OS:WaterHeater:Stratified", 24}, // On Cycle Parasitic Fuel Type | |
| 4601 | ✗ | {"OS:Generator:MicroTurbine", 13}, // Fuel Type | |
| 4602 | ✗ | {"OS:LifeCycleCost:UsePriceEscalation", 2}, // Resource | |
| 4603 | ✗ | {"OS:Meter:Custom", 2}, // Fuel Type | |
| 4604 | ✗ | {"OS:Meter:CustomDecrement", 2}, // Fuel Type | |
| 4605 | ✗ | {"OS:EnergyManagementSystem:MeteredOutputVariable", 5}, // Resource Type | |
| 4606 | |||
| 4607 | // Note JM 2020-03-05: OS:BoilerHotWater is handled in its own block below | ||
| 4608 | // {"OS:Boiler:HotWater", 2}, // Fuel Type | ||
| 4609 |
2/4✓ Branch 0 taken 360 times.
✓ Branch 1 taken 20 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
380 | }); |
| 4610 | |||
| 4611 | 53 | auto checkIfReplaceNeeded = [replaceFuelTypesMap](const IdfObject& object, int fieldIndex) -> bool { | |
| 4612 | // std::map::contains() only in C++20 | ||
| 4613 |
3/3✓ Branch 1 taken 53 times.
✓ Branch 3 taken 43 times.
✓ Branch 4 taken 10 times.
|
106 | if (boost::optional<std::string> _fuelType = object.getString(fieldIndex)) { |
| 4614 |
2/2✓ Branch 2 taken 43 times.
✓ Branch 5 taken 43 times.
|
43 | return replaceFuelTypesMap.find(_fuelType.get()) != replaceFuelTypesMap.end(); |
| 4615 | 53 | } | |
| 4616 | 10 | return false; | |
| 4617 |
1/1✓ Branch 1 taken 20 times.
|
20 | }; |
| 4618 | |||
| 4619 | 18 | auto replaceForField = [&replaceFuelTypesMap](const IdfObject& object, IdfObject& newObject, int fieldIndex) -> void { | |
| 4620 |
2/3✓ Branch 1 taken 18 times.
✓ Branch 3 taken 18 times.
✗ Branch 4 not taken.
|
36 | if (boost::optional<std::string> _fuelType = object.getString(fieldIndex)) { |
| 4621 |
2/2✓ Branch 1 taken 18 times.
✓ Branch 4 taken 18 times.
|
18 | auto it = replaceFuelTypesMap.find(_fuelType.get()); |
| 4622 |
1/2✓ Branch 2 taken 18 times.
✗ Branch 3 not taken.
|
18 | if (it != replaceFuelTypesMap.end()) { |
| 4623 |
14/14✓ Branch 1 taken 18 times.
✓ Branch 4 taken 18 times.
✓ Branch 7 taken 18 times.
✓ Branch 10 taken 18 times.
✓ Branch 13 taken 18 times.
✓ Branch 17 taken 18 times.
✓ Branch 20 taken 18 times.
✓ Branch 23 taken 18 times.
✓ Branch 26 taken 18 times.
✓ Branch 29 taken 18 times.
✓ Branch 32 taken 18 times.
✓ Branch 36 taken 18 times.
✓ Branch 39 taken 18 times.
✓ Branch 42 taken 18 times.
|
18 | LOG(Trace, "Replacing " << _fuelType.get() << " with " << it->second << " at fieldIndex " << fieldIndex << " for " << object.nameString()); |
| 4624 |
1/1✓ Branch 2 taken 18 times.
|
18 | newObject.setString(fieldIndex, it->second); |
| 4625 | } | ||
| 4626 | 18 | } | |
| 4627 | 18 | }; | |
| 4628 | |||
| 4629 |
3/3✓ Branch 1 taken 20 times.
✓ Branch 8 taken 6011 times.
✓ Branch 9 taken 20 times.
|
6031 | for (IdfObject& object : idf_2_9_1.objects()) { |
| 4630 |
2/2✓ Branch 1 taken 6011 times.
✓ Branch 4 taken 6011 times.
|
6011 | auto iddname = object.iddObject().name(); |
| 4631 | |||
| 4632 |
3/3✓ Branch 2 taken 6011 times.
✓ Branch 5 taken 33 times.
✓ Branch 6 taken 5978 times.
|
6011 | if (fuelTypeRenamesMap.find(iddname) != fuelTypeRenamesMap.end()) { |
| 4633 |
10/10✓ Branch 1 taken 33 times.
✓ Branch 4 taken 33 times.
✓ Branch 7 taken 33 times.
✓ Branch 10 taken 33 times.
✓ Branch 13 taken 33 times.
✓ Branch 16 taken 33 times.
✓ Branch 19 taken 33 times.
✓ Branch 23 taken 33 times.
✓ Branch 26 taken 33 times.
✓ Branch 29 taken 33 times.
|
33 | LOG(Trace, "Checking for a fuel type rename in Object of type '" << iddname << "' and named '" << object.nameString() << "'"); |
| 4634 |
1/1✓ Branch 1 taken 33 times.
|
33 | auto rangeFields = fuelTypeRenamesMap.equal_range(iddname); |
| 4635 | // First pass, find if a replacement is needed | ||
| 4636 | 33 | bool isReplaceNeeded = false; | |
| 4637 |
2/2✓ Branch 2 taken 53 times.
✓ Branch 3 taken 20 times.
|
73 | for (auto it = rangeFields.first; it != rangeFields.second; ++it) { |
| 4638 |
3/3✓ Branch 2 taken 53 times.
✓ Branch 4 taken 13 times.
✓ Branch 5 taken 40 times.
|
53 | if (checkIfReplaceNeeded(object, it->second)) { |
| 4639 | 13 | isReplaceNeeded = true; | |
| 4640 | 13 | break; | |
| 4641 | } | ||
| 4642 | } | ||
| 4643 |
2/2✓ Branch 0 taken 13 times.
✓ Branch 1 taken 20 times.
|
33 | if (isReplaceNeeded) { |
| 4644 |
5/5✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
✓ Branch 7 taken 13 times.
✓ Branch 10 taken 13 times.
✓ Branch 13 taken 13 times.
|
13 | LOG(Trace, "Replace needed!"); |
| 4645 | |||
| 4646 | // Make a new object, and copy evertything in place | ||
| 4647 |
1/1✓ Branch 1 taken 13 times.
|
13 | auto iddObject = idd_3_0_0.getObject(iddname); |
| 4648 |
2/2✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
|
13 | IdfObject newObject(iddObject.get()); |
| 4649 |
3/3✓ Branch 1 taken 314 times.
✓ Branch 3 taken 301 times.
✓ Branch 4 taken 13 times.
|
314 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 4650 |
2/3✓ Branch 1 taken 301 times.
✓ Branch 5 taken 301 times.
✗ Branch 6 not taken.
|
602 | if ((value = object.getString(i))) { |
| 4651 |
2/2✓ Branch 1 taken 301 times.
✓ Branch 4 taken 301 times.
|
301 | newObject.setString(i, value.get()); |
| 4652 | } | ||
| 4653 | } | ||
| 4654 | |||
| 4655 | // Then handle the renames | ||
| 4656 |
2/2✓ Branch 2 taken 17 times.
✓ Branch 3 taken 13 times.
|
30 | for (auto it = rangeFields.first; it != rangeFields.second; ++it) { |
| 4657 |
1/1✓ Branch 2 taken 17 times.
|
17 | replaceForField(object, newObject, it->second); |
| 4658 | } | ||
| 4659 | |||
| 4660 |
1/1✓ Branch 1 taken 13 times.
|
13 | ss << newObject; |
| 4661 |
1/1✓ Branch 3 taken 13 times.
|
13 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 4662 | 13 | } else { | |
| 4663 | // No-op | ||
| 4664 |
1/1✓ Branch 1 taken 20 times.
|
20 | ss << object; |
| 4665 | } | ||
| 4666 | |||
| 4667 |
3/3✓ Branch 1 taken 5978 times.
✓ Branch 3 taken 181 times.
✓ Branch 4 taken 5797 times.
|
5978 | } else if (iddname == "OS:Material") { |
| 4668 |
2/2✓ Branch 1 taken 181 times.
✓ Branch 4 taken 181 times.
|
181 | auto iddObject = idd_3_0_0.getObject("OS:Material"); |
| 4669 |
2/2✓ Branch 1 taken 181 times.
✓ Branch 4 taken 181 times.
|
181 | IdfObject newObject(iddObject.get()); |
| 4670 | |||
| 4671 |
3/3✓ Branch 1 taken 1598 times.
✓ Branch 3 taken 1417 times.
✓ Branch 4 taken 181 times.
|
1598 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 4672 | // Specific Heat | ||
| 4673 |
2/2✓ Branch 0 taken 181 times.
✓ Branch 1 taken 1236 times.
|
1417 | if (i == 6) { |
| 4674 | // This field is required so it should always be initialized | ||
| 4675 |
2/3✓ Branch 1 taken 181 times.
✓ Branch 3 taken 181 times.
✗ Branch 4 not taken.
|
362 | if (boost::optional<double> _value = object.getDouble(6)) { |
| 4676 |
2/3✓ Branch 1 taken 181 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 181 times.
|
181 | if (_value.get() == 0.1) { |
| 4677 | ✗ | LOG(Warn, "Updated Specific Heat for OS:Material named '" << object.nameString() << "' from " << value.get() | |
| 4678 | << " to the new default of 1400.0."); | ||
| 4679 | ✗ | newObject.setDouble(6, 1400.0); | |
| 4680 |
2/3✓ Branch 1 taken 181 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 181 times.
|
181 | } else if (_value.get() < 100) { |
| 4681 | ✗ | LOG(Warn, "Updated Specific Heat for OS:Material named '" << object.nameString() << "' from " << value.get() | |
| 4682 | << " to the new minimum of 100.0."); | ||
| 4683 | ✗ | newObject.setDouble(6, 100.0); | |
| 4684 | } else { | ||
| 4685 |
2/2✓ Branch 1 taken 181 times.
✓ Branch 4 taken 181 times.
|
181 | newObject.setDouble(6, _value.get()); |
| 4686 | } | ||
| 4687 | } else { | ||
| 4688 | // Let's be safe | ||
| 4689 | ✗ | newObject.setDouble(6, 1400.0); | |
| 4690 | } | ||
| 4691 |
2/3✓ Branch 1 taken 1236 times.
✓ Branch 5 taken 1236 times.
✗ Branch 6 not taken.
|
2472 | } else if ((value = object.getString(i))) { |
| 4692 |
2/2✓ Branch 1 taken 1236 times.
✓ Branch 4 taken 1236 times.
|
1236 | newObject.setString(i, value.get()); |
| 4693 | } | ||
| 4694 | } | ||
| 4695 | |||
| 4696 |
1/1✓ Branch 1 taken 181 times.
|
181 | ss << newObject; |
| 4697 |
1/1✓ Branch 3 taken 181 times.
|
181 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 4698 | |||
| 4699 |
3/3✓ Branch 3 taken 5797 times.
✓ Branch 5 taken 225 times.
✓ Branch 6 taken 5572 times.
|
5978 | } else if (iddname == "OS:Schedule:Rule") { |
| 4700 |
1/1✓ Branch 1 taken 225 times.
|
225 | auto iddObject = idd_3_0_0.getObject(iddname); |
| 4701 |
2/2✓ Branch 1 taken 225 times.
✓ Branch 4 taken 225 times.
|
225 | IdfObject newObject(iddObject.get()); |
| 4702 | |||
| 4703 | // Removed field 12: Apply Holiday | ||
| 4704 |
3/3✓ Branch 1 taken 3855 times.
✓ Branch 3 taken 3630 times.
✓ Branch 4 taken 225 times.
|
3855 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 4705 |
2/3✓ Branch 1 taken 3630 times.
✓ Branch 5 taken 3630 times.
✗ Branch 6 not taken.
|
7260 | if ((value = object.getString(i))) { |
| 4706 |
2/2✓ Branch 0 taken 2700 times.
✓ Branch 1 taken 930 times.
|
3630 | if (i < 12) { |
| 4707 |
2/2✓ Branch 1 taken 2700 times.
✓ Branch 4 taken 2700 times.
|
2700 | newObject.setString(i, value.get()); |
| 4708 |
2/2✓ Branch 0 taken 775 times.
✓ Branch 1 taken 155 times.
|
930 | } else if (i > 12) { |
| 4709 |
2/2✓ Branch 1 taken 775 times.
✓ Branch 4 taken 775 times.
|
775 | newObject.setString(i - 1, value.get()); |
| 4710 | } // i == 12: skip | ||
| 4711 | } | ||
| 4712 | } | ||
| 4713 | |||
| 4714 |
1/1✓ Branch 1 taken 225 times.
|
225 | ss << newObject; |
| 4715 |
1/1✓ Branch 3 taken 225 times.
|
225 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 4716 | |||
| 4717 | // Note: OS:ScheduleRuleset got a new optional field at the end, so no-op | ||
| 4718 | // } else if (iddname == "OS:Schedule:Ruleset") { | ||
| 4719 | |||
| 4720 |
2/3✓ Branch 3 taken 5572 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 5572 times.
|
5797 | } else if (iddname == "OS:ZoneHVAC:UnitHeater") { |
| 4721 | ✗ | auto iddObject = idd_3_0_0.getObject(iddname); | |
| 4722 | ✗ | IdfObject newObject(iddObject.get()); | |
| 4723 | |||
| 4724 | ✗ | for (size_t i = 0; i < object.numFields(); ++i) { | |
| 4725 | // Maximum Hot Water Flow Rate: this wasn't explicitly set as autosize in Ctor as it should have been | ||
| 4726 | ✗ | if (i == 9) { | |
| 4727 | ✗ | if (boost::optional<double> _value = object.getDouble(i)) { | |
| 4728 | ✗ | newObject.setDouble(i, _value.get()); | |
| 4729 | } else { | ||
| 4730 | // If not a double, either blank or actual autosize => set to autosize | ||
| 4731 | ✗ | newObject.setString(i, "autosize"); | |
| 4732 | } | ||
| 4733 | ✗ | } else if ((value = object.getString(i))) { | |
| 4734 | ✗ | newObject.setString(i, value.get()); | |
| 4735 | } | ||
| 4736 | } | ||
| 4737 | |||
| 4738 | ✗ | ss << newObject; | |
| 4739 | ✗ | m_refactored.emplace_back(std::move(object), std::move(newObject)); | |
| 4740 | |||
| 4741 |
3/3✓ Branch 3 taken 5572 times.
✓ Branch 5 taken 10 times.
✓ Branch 6 taken 5562 times.
|
5572 | } else if (iddname == "OS:ClimateZones") { |
| 4742 |
1/1✓ Branch 1 taken 10 times.
|
10 | auto iddObject = idd_3_0_0.getObject(iddname); |
| 4743 |
2/2✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
|
10 | IdfObject newObject(iddObject.get()); |
| 4744 | |||
| 4745 | // Deleted Field 1 & 2 (0-indexed): 'Active Institution' and 'Active Year' | ||
| 4746 |
3/3✓ Branch 1 taken 120 times.
✓ Branch 3 taken 110 times.
✓ Branch 4 taken 10 times.
|
120 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 4747 |
2/3✓ Branch 1 taken 110 times.
✓ Branch 5 taken 110 times.
✗ Branch 6 not taken.
|
220 | if ((value = object.getString(i))) { |
| 4748 |
2/2✓ Branch 0 taken 10 times.
✓ Branch 1 taken 100 times.
|
110 | if (i < 1) { |
| 4749 | // 0 Unchanged | ||
| 4750 |
2/2✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
|
10 | newObject.setString(i, value.get()); |
| 4751 |
2/2✓ Branch 0 taken 80 times.
✓ Branch 1 taken 20 times.
|
100 | } else if (i > 2) { |
| 4752 | // 3-End shifted -2 | ||
| 4753 |
2/2✓ Branch 1 taken 80 times.
✓ Branch 4 taken 80 times.
|
80 | newObject.setString(i - 2, value.get()); |
| 4754 | } | ||
| 4755 | } | ||
| 4756 | } | ||
| 4757 | |||
| 4758 |
1/1✓ Branch 1 taken 10 times.
|
10 | ss << newObject; |
| 4759 |
1/1✓ Branch 3 taken 10 times.
|
10 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 4760 | |||
| 4761 |
3/3✓ Branch 3 taken 5562 times.
✓ Branch 5 taken 1 time.
✓ Branch 6 taken 5561 times.
|
5572 | } else if (iddname == "OS:Boiler:HotWater") { |
| 4762 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto iddObject = idd_3_0_0.getObject(iddname); |
| 4763 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfObject newObject(iddObject.get()); |
| 4764 | |||
| 4765 | // Deleted Field 7: Design Water Outlet Temperature | ||
| 4766 |
3/3✓ Branch 1 taken 20 times.
✓ Branch 3 taken 19 times.
✓ Branch 4 taken 1 time.
|
20 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 4767 |
2/3✓ Branch 1 taken 19 times.
✓ Branch 5 taken 19 times.
✗ Branch 6 not taken.
|
38 | if ((value = object.getString(i))) { |
| 4768 |
2/2✓ Branch 0 taken 7 times.
✓ Branch 1 taken 12 times.
|
19 | if (i < 7) { |
| 4769 | // 0-6 Unchanged | ||
| 4770 |
2/2✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
|
7 | newObject.setString(i, value.get()); |
| 4771 |
2/2✓ Branch 0 taken 11 times.
✓ Branch 1 taken 1 time.
|
12 | } else if (i > 7) { |
| 4772 | // 8-End shifted -1 | ||
| 4773 |
2/2✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
|
11 | newObject.setString(i - 1, value.get()); |
| 4774 | } | ||
| 4775 | } | ||
| 4776 | } | ||
| 4777 | |||
| 4778 | // Fuel Type: renames | ||
| 4779 |
1/1✓ Branch 1 taken 1 time.
|
1 | replaceForField(object, newObject, 2); |
| 4780 | |||
| 4781 |
1/1✓ Branch 1 taken 1 time.
|
1 | ss << newObject; |
| 4782 |
1/1✓ Branch 3 taken 1 time.
|
1 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 4783 | |||
| 4784 |
2/3✓ Branch 3 taken 5561 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 5561 times.
|
5562 | } else if (iddname == "OS:Chiller:Electric:EIR") { |
| 4785 | ✗ | auto iddObject = idd_3_0_0.getObject(iddname); | |
| 4786 | ✗ | IdfObject newObject(iddObject.get()); | |
| 4787 | |||
| 4788 | ✗ | for (size_t i = 0; i < object.numFields(); ++i) { | |
| 4789 | // 6: Reference Chilled Water Flow Rate: used to default to autosize in IDD, now required | ||
| 4790 | ✗ | if (i == 6) { | |
| 4791 | ✗ | if (boost::optional<double> _value = object.getDouble(i)) { | |
| 4792 | ✗ | newObject.setDouble(i, _value.get()); | |
| 4793 | } else { | ||
| 4794 | // If not a double, it's Autosize (either hard-set, or by default from 2.9.1 IDD) | ||
| 4795 | ✗ | newObject.setString(i, "Autosize"); | |
| 4796 | } | ||
| 4797 | |||
| 4798 | // 24: Design Heat Recovery Water Flow Rate: was already required, and used to default to 0.0 in CTOR: | ||
| 4799 | // * Technically we could get away doing nothing here. | ||
| 4800 | // * Instead we'll check if the value is 0.0 (old ctor default) and that it's not connected to a HR Loop | ||
| 4801 | // by checking field 25 ('Heat Recovery Inlet Node Name'), in which case we switch it to Autosize | ||
| 4802 | ✗ | } else if (i == 24) { | |
| 4803 | ✗ | if (boost::optional<double> _value = object.getDouble(i)) { | |
| 4804 | ✗ | newObject.setDouble(i, _value.get()); | |
| 4805 | |||
| 4806 | // Unless it was 0.0 (default ctor) and not connected to a HR loop, then switch it to Autosize | ||
| 4807 | ✗ | if (_value.get() == 0.0) { | |
| 4808 | ✗ | if (!object.getString(25).has_value()) { | |
| 4809 | ✗ | newObject.setString(i, "Autosize"); | |
| 4810 | } | ||
| 4811 | } | ||
| 4812 | } else { | ||
| 4813 | // Should never get here, but just in case... | ||
| 4814 | ✗ | newObject.setString(i, "Autosize"); | |
| 4815 | } | ||
| 4816 | |||
| 4817 | // 31: Condenser Heat Recovery Relative Capacity Fraction => now required, defaults to 1.0 | ||
| 4818 | ✗ | } else if (i == 31) { | |
| 4819 | ✗ | if (boost::optional<double> _value = object.getDouble(i)) { | |
| 4820 | ✗ | newObject.setDouble(i, _value.get()); | |
| 4821 | } else { | ||
| 4822 | ✗ | newObject.setDouble(i, 1.0); | |
| 4823 | } | ||
| 4824 | |||
| 4825 | // All other fields: unchanged | ||
| 4826 | ✗ | } else if ((value = object.getString(i))) { | |
| 4827 | ✗ | newObject.setString(i, value.get()); | |
| 4828 | } | ||
| 4829 | } | ||
| 4830 | |||
| 4831 | ✗ | ss << newObject; | |
| 4832 | ✗ | m_refactored.emplace_back(std::move(object), std::move(newObject)); | |
| 4833 | |||
| 4834 |
3/3✓ Branch 3 taken 5561 times.
✓ Branch 5 taken 13 times.
✓ Branch 6 taken 5548 times.
|
5561 | } else if (iddname == "OS:ShadowCalculation") { |
| 4835 |
1/1✓ Branch 1 taken 13 times.
|
13 | auto iddObject = idd_3_0_0.getObject(iddname); |
| 4836 |
2/2✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
|
13 | IdfObject newObject(iddObject.get()); |
| 4837 | |||
| 4838 | // Handle | ||
| 4839 |
3/3✓ Branch 1 taken 58 times.
✓ Branch 3 taken 45 times.
✓ Branch 4 taken 13 times.
|
58 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 4840 |
1/1✓ Branch 1 taken 45 times.
|
45 | value = object.getString(i); |
| 4841 |
6/7✓ Branch 0 taken 45 times.
✗ Branch 1 not taken.
✓ Branch 3 taken 45 times.
✓ Branch 6 taken 42 times.
✓ Branch 7 taken 3 times.
✓ Branch 8 taken 42 times.
✓ Branch 9 taken 3 times.
|
45 | if (value && !value->empty()) { |
| 4842 |
6/7✓ Branch 0 taken 13 times.
✓ Branch 1 taken 13 times.
✓ Branch 2 taken 13 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 5 taken 1 time.
✗ Branch 6 not taken.
|
42 | switch (i) { |
| 4843 | 13 | case 0: // Handle | |
| 4844 |
2/2✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
|
13 | newObject.setString(0, value.get()); |
| 4845 | 13 | break; | |
| 4846 | 13 | case 1: // Calculation Frequency => Shading Calculation Update Frequency | |
| 4847 |
2/2✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
|
13 | newObject.setString(3, value.get()); |
| 4848 | 13 | break; | |
| 4849 | 13 | case 2: // Maximum Figures in Shadow Overlap Calculations | |
| 4850 |
2/2✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
|
13 | newObject.setString(4, value.get()); |
| 4851 | 13 | break; | |
| 4852 | 1 | case 3: // Polygon Clipping Algorithm | |
| 4853 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | newObject.setString(5, value.get()); |
| 4854 | 1 | break; | |
| 4855 | 1 | case 4: // Polygon Clipping Algorithm | |
| 4856 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | newObject.setString(7, value.get()); |
| 4857 | 1 | break; | |
| 4858 | 1 | case 5: // Calculation Method => Shading Calculation Update Frequency Method + key rename | |
| 4859 |
4/5✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✗ Branch 10 not taken.
✓ Branch 11 taken 1 time.
|
3 | if (openstudio::istringEqual("TimestepFrequency", value.get())) { |
| 4860 | ✗ | newObject.setString(2, "Timestep"); | |
| 4861 | } else { // AverageOverDaysInFrequency | ||
| 4862 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | newObject.setString(2, "Periodic"); |
| 4863 | } | ||
| 4864 | 1 | break; | |
| 4865 | ✗ | default: | |
| 4866 | ✗ | LOG(Error, "ShadowCalculation appears to have had more than 6 fields which is impossible"); | |
| 4867 | ✗ | OS_ASSERT(false); | |
| 4868 | ✗ | break; | |
| 4869 | } | ||
| 4870 | } | ||
| 4871 | } | ||
| 4872 | |||
| 4873 | // NEW REQUIRED FIELDS | ||
| 4874 | |||
| 4875 | // Shading Calculation Method | ||
| 4876 |
2/2✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
|
13 | newObject.setString(1, "PolygonClipping"); |
| 4877 | // Pixel Counting Resolution | ||
| 4878 |
1/1✓ Branch 1 taken 13 times.
|
13 | newObject.setInt(6, 512); |
| 4879 | // Output External Shading Calculation Results | ||
| 4880 |
2/2✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
|
26 | newObject.setString(8, "No"); |
| 4881 | // Disable Self-Shading Within Shading Zone Groups | ||
| 4882 |
2/2✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
|
26 | newObject.setString(9, "No"); |
| 4883 | // Disable Self-Shading From Shading Zone Groups to Other Zones | ||
| 4884 |
2/2✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
|
13 | newObject.setString(10, "No"); |
| 4885 | |||
| 4886 |
1/1✓ Branch 1 taken 13 times.
|
13 | ss << newObject; |
| 4887 |
1/1✓ Branch 3 taken 13 times.
|
13 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 4888 | |||
| 4889 |
3/3✓ Branch 3 taken 5548 times.
✓ Branch 5 taken 20 times.
✓ Branch 6 taken 5528 times.
|
5561 | } else if (iddname == "OS:Sizing:Zone") { |
| 4890 |
1/1✓ Branch 1 taken 20 times.
|
20 | auto iddObject = idd_3_0_0.getObject(iddname); |
| 4891 |
2/2✓ Branch 1 taken 20 times.
✓ Branch 4 taken 20 times.
|
20 | IdfObject newObject(iddObject.get()); |
| 4892 | |||
| 4893 | // I moved fields 22 & 23 to the end (Design Zone Air Distribution Effectiveness in Cooling|Heating Mode) | ||
| 4894 | // to group all fields that belong onto DesignSpecification:ZoneAirDistribution in E+ together | ||
| 4895 |
3/3✓ Branch 1 taken 580 times.
✓ Branch 3 taken 560 times.
✓ Branch 4 taken 20 times.
|
580 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 4896 |
2/3✓ Branch 1 taken 560 times.
✓ Branch 5 taken 560 times.
✗ Branch 6 not taken.
|
1120 | if ((value = object.getString(i))) { |
| 4897 |
2/2✓ Branch 0 taken 440 times.
✓ Branch 1 taken 120 times.
|
560 | if (i < 22) { |
| 4898 |
2/2✓ Branch 1 taken 440 times.
✓ Branch 4 taken 440 times.
|
440 | newObject.setString(i, value.get()); |
| 4899 |
2/2✓ Branch 0 taken 40 times.
✓ Branch 1 taken 80 times.
|
120 | } else if (i < 24) { |
| 4900 | // No need to initialize these fields by default especially now that they're at the end | ||
| 4901 |
3/3✓ Branch 1 taken 40 times.
✓ Branch 4 taken 20 times.
✓ Branch 5 taken 20 times.
|
40 | if (!value->empty()) { |
| 4902 |
2/2✓ Branch 1 taken 20 times.
✓ Branch 4 taken 20 times.
|
20 | newObject.setString(i + 4, value.get()); |
| 4903 | } | ||
| 4904 | } else { | ||
| 4905 |
2/2✓ Branch 1 taken 80 times.
✓ Branch 4 taken 80 times.
|
80 | newObject.setString(i - 2, value.get()); |
| 4906 | } | ||
| 4907 | } | ||
| 4908 | } | ||
| 4909 | |||
| 4910 | // Two fields were plain added to the end: Design Zone Secondary Recirculation Fraction, | ||
| 4911 | // and Design Minimum Zone Ventilation Efficiency, but both are optional (has default) so no-op there | ||
| 4912 | |||
| 4913 |
1/1✓ Branch 1 taken 20 times.
|
20 | ss << newObject; |
| 4914 |
1/1✓ Branch 3 taken 20 times.
|
20 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 4915 | |||
| 4916 |
2/3✓ Branch 3 taken 5528 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 5528 times.
|
5548 | } else if (iddname == "OS:ZoneHVAC:TerminalUnit:VariableRefrigerantFlow") { |
| 4917 | // Note #3687 was originally planned for 2.9.0 inclusion, so VT was there. But it was only merged to develop3 and hence relased in 3.0.0 | ||
| 4918 | // Moving it in the right location, as needed per #4016 | ||
| 4919 | ✗ | auto iddObject = idd_3_0_0.getObject("OS:ZoneHVAC:TerminalUnit:VariableRefrigerantFlow"); | |
| 4920 | ✗ | IdfObject newObject(iddObject.get()); | |
| 4921 | |||
| 4922 | // Added fields at end, so copy everything existing in place | ||
| 4923 | ✗ | for (size_t i = 0; i < object.numFields(); ++i) { | |
| 4924 | ✗ | if ((value = object.getString(i))) { | |
| 4925 | ✗ | newObject.setString(i, value.get()); | |
| 4926 | } | ||
| 4927 | } | ||
| 4928 | |||
| 4929 | // 21 = AVM List | ||
| 4930 | // 22 = Design Spec ZoneHVAC Sizing | ||
| 4931 | // 23 = Supplemental Heating Coil (optional) | ||
| 4932 | // Maximum SAT for Supplemental Heater | ||
| 4933 | ✗ | newObject.setString(24, "Autosize"); | |
| 4934 | // Maximum OATdb for Supplemental Heater | ||
| 4935 | ✗ | newObject.setDouble(25, 21.0); | |
| 4936 | |||
| 4937 | // Register refactored | ||
| 4938 | ✗ | ss << newObject; | |
| 4939 | ✗ | m_refactored.emplace_back(std::move(object), std::move(newObject)); | |
| 4940 | |||
| 4941 | // No-op | ||
| 4942 | ✗ | } else { | |
| 4943 |
1/1✓ Branch 1 taken 5528 times.
|
5528 | ss << object; |
| 4944 | } | ||
| 4945 | 6031 | } | |
| 4946 | |||
| 4947 |
1/1✓ Branch 1 taken 20 times.
|
40 | return ss.str(); |
| 4948 | 60 | } | |
| 4949 | |||
| 4950 | 30 | std::string VersionTranslator::update_3_0_0_to_3_0_1(const IdfFile& idf_3_0_0, const IddFileAndFactoryWrapper& idd_3_0_1) { | |
| 4951 |
1/1✓ Branch 1 taken 30 times.
|
30 | std::stringstream ss; |
| 4952 | 30 | boost::optional<std::string> value; | |
| 4953 | |||
| 4954 |
4/4✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
✓ Branch 7 taken 30 times.
✓ Branch 10 taken 30 times.
|
30 | ss << idf_3_0_0.header() << '\n' << '\n'; |
| 4955 |
2/2✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
|
30 | IdfFile targetIdf(idd_3_0_1.iddFile()); |
| 4956 |
3/3✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
✓ Branch 7 taken 30 times.
|
30 | ss << targetIdf.versionObject().get(); |
| 4957 | |||
| 4958 |
3/3✓ Branch 1 taken 30 times.
✓ Branch 8 taken 8783 times.
✓ Branch 9 taken 30 times.
|
8813 | for (IdfObject& object : idf_3_0_0.objects()) { |
| 4959 |
2/2✓ Branch 1 taken 8783 times.
✓ Branch 4 taken 8783 times.
|
8783 | auto iddname = object.iddObject().name(); |
| 4960 | |||
| 4961 |
3/3✓ Branch 1 taken 8783 times.
✓ Branch 3 taken 11 times.
✓ Branch 4 taken 8772 times.
|
8783 | if (iddname == "OS:Coil:Cooling:DX:SingleSpeed") { |
| 4962 | // Inserted field 'Minimum Outdoor Dry-Bulb Temperature for Compressor Operation' at position 15 (0-indexed) | ||
| 4963 |
1/1✓ Branch 1 taken 11 times.
|
11 | auto iddObject = idd_3_0_1.getObject(iddname); |
| 4964 |
2/2✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
|
11 | IdfObject newObject(iddObject.get()); |
| 4965 | |||
| 4966 |
3/3✓ Branch 1 taken 352 times.
✓ Branch 3 taken 341 times.
✓ Branch 4 taken 11 times.
|
352 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 4967 |
2/3✓ Branch 1 taken 341 times.
✓ Branch 5 taken 341 times.
✗ Branch 6 not taken.
|
682 | if ((value = object.getString(i))) { |
| 4968 |
2/2✓ Branch 0 taken 165 times.
✓ Branch 1 taken 176 times.
|
341 | if (i < 15) { |
| 4969 | // Handle | ||
| 4970 |
2/2✓ Branch 1 taken 165 times.
✓ Branch 4 taken 165 times.
|
165 | newObject.setString(i, value.get()); |
| 4971 | } else { | ||
| 4972 | // Every other is shifted by one field | ||
| 4973 |
2/2✓ Branch 1 taken 176 times.
✓ Branch 4 taken 176 times.
|
176 | newObject.setString(i + 1, value.get()); |
| 4974 | } | ||
| 4975 | } | ||
| 4976 | } | ||
| 4977 | |||
| 4978 | // Set new field per IDD default, same as Model Ctor, since it was made required-field | ||
| 4979 |
1/1✓ Branch 1 taken 11 times.
|
11 | newObject.setDouble(15, -25.0); |
| 4980 | |||
| 4981 |
1/1✓ Branch 1 taken 11 times.
|
11 | ss << newObject; |
| 4982 |
1/1✓ Branch 3 taken 11 times.
|
11 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 4983 | |||
| 4984 |
3/3✓ Branch 3 taken 8772 times.
✓ Branch 5 taken 1 time.
✓ Branch 6 taken 8771 times.
|
8783 | } else if (iddname == "OS:Coil:Cooling:DX:TwoStageWithHumidityControlMode") { |
| 4985 | // Inserted field 'Minimum Outdoor Dry-Bulb Temperature for Compressor Operation' at position 15 (0-indexed) | ||
| 4986 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto iddObject = idd_3_0_1.getObject(iddname); |
| 4987 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfObject newObject(iddObject.get()); |
| 4988 | |||
| 4989 |
3/3✓ Branch 1 taken 19 times.
✓ Branch 3 taken 18 times.
✓ Branch 4 taken 1 time.
|
19 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 4990 |
2/3✓ Branch 1 taken 18 times.
✓ Branch 5 taken 18 times.
✗ Branch 6 not taken.
|
36 | if ((value = object.getString(i))) { |
| 4991 |
2/2✓ Branch 0 taken 15 times.
✓ Branch 1 taken 3 times.
|
18 | if (i < 15) { |
| 4992 | // Handle | ||
| 4993 |
2/2✓ Branch 1 taken 15 times.
✓ Branch 4 taken 15 times.
|
15 | newObject.setString(i, value.get()); |
| 4994 | } else { | ||
| 4995 | // Every other is shifted by one field | ||
| 4996 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | newObject.setString(i + 1, value.get()); |
| 4997 | } | ||
| 4998 | } | ||
| 4999 | } | ||
| 5000 | |||
| 5001 | // Set new field per IDD default, same as Model Ctor, since it was made required-field | ||
| 5002 |
1/1✓ Branch 1 taken 1 time.
|
1 | newObject.setDouble(15, -25.0); |
| 5003 | |||
| 5004 |
1/1✓ Branch 1 taken 1 time.
|
1 | ss << newObject; |
| 5005 |
1/1✓ Branch 3 taken 1 time.
|
1 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 5006 | |||
| 5007 |
3/3✓ Branch 3 taken 8771 times.
✓ Branch 5 taken 2 times.
✓ Branch 6 taken 8769 times.
|
8772 | } else if (iddname == "OS:Coil:Cooling:DX:MultiSpeed") { |
| 5008 | // Inserted field 'Minimum Outdoor Dry-Bulb Temperature for Compressor Operation' at position 7 (0-indexed) | ||
| 5009 |
1/1✓ Branch 1 taken 2 times.
|
2 | auto iddObject = idd_3_0_1.getObject(iddname); |
| 5010 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | IdfObject newObject(iddObject.get()); |
| 5011 | |||
| 5012 |
3/3✓ Branch 1 taken 36 times.
✓ Branch 3 taken 34 times.
✓ Branch 4 taken 2 times.
|
36 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 5013 |
2/3✓ Branch 1 taken 34 times.
✓ Branch 5 taken 34 times.
✗ Branch 6 not taken.
|
68 | if ((value = object.getString(i))) { |
| 5014 |
2/2✓ Branch 0 taken 14 times.
✓ Branch 1 taken 20 times.
|
34 | if (i < 7) { |
| 5015 | // Handle | ||
| 5016 |
2/2✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
|
14 | newObject.setString(i, value.get()); |
| 5017 | } else { | ||
| 5018 | // Every other is shifted by one field | ||
| 5019 |
2/2✓ Branch 1 taken 20 times.
✓ Branch 4 taken 20 times.
|
20 | newObject.setString(i + 1, value.get()); |
| 5020 | } | ||
| 5021 | } | ||
| 5022 | } | ||
| 5023 | |||
| 5024 | // Set new field per IDD default, same as Model Ctor, since it was made required-field | ||
| 5025 |
1/1✓ Branch 1 taken 2 times.
|
2 | newObject.setDouble(7, -25.0); |
| 5026 | |||
| 5027 |
1/1✓ Branch 1 taken 2 times.
|
2 | ss << newObject; |
| 5028 |
1/1✓ Branch 3 taken 2 times.
|
2 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 5029 | |||
| 5030 |
3/3✓ Branch 3 taken 8769 times.
✓ Branch 5 taken 1 time.
✓ Branch 6 taken 8768 times.
|
8771 | } else if (iddname == "OS:Coil:Cooling:DX:VariableSpeed") { |
| 5031 | // Inserted field 'Minimum Outdoor Dry-Bulb Temperature for Compressor Operation' at position 15 (0-indexed) | ||
| 5032 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto iddObject = idd_3_0_1.getObject(iddname); |
| 5033 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfObject newObject(iddObject.get()); |
| 5034 | |||
| 5035 |
3/3✓ Branch 1 taken 22 times.
✓ Branch 3 taken 21 times.
✓ Branch 4 taken 1 time.
|
22 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 5036 |
2/3✓ Branch 1 taken 21 times.
✓ Branch 5 taken 21 times.
✗ Branch 6 not taken.
|
42 | if ((value = object.getString(i))) { |
| 5037 |
2/2✓ Branch 0 taken 15 times.
✓ Branch 1 taken 6 times.
|
21 | if (i < 15) { |
| 5038 | // Handle | ||
| 5039 |
2/2✓ Branch 1 taken 15 times.
✓ Branch 4 taken 15 times.
|
15 | newObject.setString(i, value.get()); |
| 5040 | } else { | ||
| 5041 | // Every other is shifted by one field | ||
| 5042 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
6 | newObject.setString(i + 1, value.get()); |
| 5043 | } | ||
| 5044 | } | ||
| 5045 | } | ||
| 5046 | |||
| 5047 | // Set new field per IDD default, same as Model Ctor, since it was made required-field | ||
| 5048 |
1/1✓ Branch 1 taken 1 time.
|
1 | newObject.setDouble(15, -25.0); |
| 5049 | |||
| 5050 |
1/1✓ Branch 1 taken 1 time.
|
1 | ss << newObject; |
| 5051 |
1/1✓ Branch 3 taken 1 time.
|
1 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 5052 | |||
| 5053 |
3/3✓ Branch 3 taken 8768 times.
✓ Branch 5 taken 1 time.
✓ Branch 6 taken 8767 times.
|
8769 | } else if (iddname == "OS:Coil:Cooling:DX:TwoSpeed") { |
| 5054 | // Inserted 'Unit Internal Static Air Pressure' at field 7 | ||
| 5055 | // Inserted field 'Minimum Outdoor Dry-Bulb Temperature for Compressor Operation' at position 23 (0-indexed) | ||
| 5056 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto iddObject = idd_3_0_1.getObject(iddname); |
| 5057 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfObject newObject(iddObject.get()); |
| 5058 | |||
| 5059 |
3/3✓ Branch 1 taken 34 times.
✓ Branch 3 taken 33 times.
✓ Branch 4 taken 1 time.
|
34 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 5060 |
2/3✓ Branch 1 taken 33 times.
✓ Branch 5 taken 33 times.
✗ Branch 6 not taken.
|
66 | if ((value = object.getString(i))) { |
| 5061 |
2/2✓ Branch 0 taken 7 times.
✓ Branch 1 taken 26 times.
|
33 | if (i < 7) { |
| 5062 | // Handle | ||
| 5063 |
2/2✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
|
7 | newObject.setString(i, value.get()); |
| 5064 |
2/2✓ Branch 0 taken 15 times.
✓ Branch 1 taken 11 times.
|
26 | } else if (i < 22) { |
| 5065 | // Shifted by one field | ||
| 5066 |
2/2✓ Branch 1 taken 15 times.
✓ Branch 4 taken 15 times.
|
15 | newObject.setString(i + 1, value.get()); |
| 5067 | } else { | ||
| 5068 | // Every other is shifted by two fields | ||
| 5069 |
2/2✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
|
11 | newObject.setString(i + 2, value.get()); |
| 5070 | } | ||
| 5071 | } | ||
| 5072 | } | ||
| 5073 | |||
| 5074 | // Set new field per I/O ref /source code default, same as Model Ctor, since it was made required-field | ||
| 5075 |
1/1✓ Branch 1 taken 1 time.
|
1 | newObject.setDouble(7, 773.3); |
| 5076 | |||
| 5077 | // Set new field per IDD default, same as Model Ctor, since it was made required-field | ||
| 5078 |
1/1✓ Branch 1 taken 1 time.
|
1 | newObject.setDouble(23, -25.0); |
| 5079 | |||
| 5080 |
1/1✓ Branch 1 taken 1 time.
|
1 | ss << newObject; |
| 5081 |
1/1✓ Branch 3 taken 1 time.
|
1 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 5082 | |||
| 5083 | // No-op | ||
| 5084 | 1 | } else { | |
| 5085 |
1/1✓ Branch 1 taken 8767 times.
|
8767 | ss << object; |
| 5086 | } | ||
| 5087 | 8813 | } | |
| 5088 | |||
| 5089 |
1/1✓ Branch 1 taken 30 times.
|
60 | return ss.str(); |
| 5090 | |||
| 5091 | 30 | } // end update_3_0_0_to_3_0_1 | |
| 5092 | |||
| 5093 | 38 | std::string VersionTranslator::update_3_0_1_to_3_1_0(const IdfFile& idf_3_0_1, const IddFileAndFactoryWrapper& idd_3_1_0) { | |
| 5094 |
1/1✓ Branch 1 taken 38 times.
|
38 | std::stringstream ss; |
| 5095 | 38 | boost::optional<std::string> value; | |
| 5096 | |||
| 5097 |
4/4✓ Branch 1 taken 38 times.
✓ Branch 4 taken 38 times.
✓ Branch 7 taken 38 times.
✓ Branch 10 taken 38 times.
|
38 | ss << idf_3_0_1.header() << '\n' << '\n'; |
| 5098 |
2/2✓ Branch 1 taken 38 times.
✓ Branch 4 taken 38 times.
|
38 | IdfFile targetIdf(idd_3_1_0.iddFile()); |
| 5099 |
3/3✓ Branch 1 taken 38 times.
✓ Branch 4 taken 38 times.
✓ Branch 7 taken 38 times.
|
38 | ss << targetIdf.versionObject().get(); |
| 5100 | |||
| 5101 | /***************************************************************************************************************************************************** | ||
| 5102 | * Output:Variable fuel * | ||
| 5103 | *****************************************************************************************************************************************************/ | ||
| 5104 | |||
| 5105 |
3/7✓ Branch 0 taken 38 times.
✗ Branch 1 not taken.
✓ Branch 3 taken 38 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 38 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
38 | const static boost::regex re_strip_multiple_spaces("[' ']{2,}"); |
| 5106 | |||
| 5107 | // Making the map case-insensitive by providing a Comparator `IstringCompare` | ||
| 5108 | // https://github.com/NREL/EnergyPlus/blob/v9.4.0-IOFreeze/src/Transition/SupportFiles/Report%20Variables%209-3-0%20to%209-4-0.csv | ||
| 5109 | const static std::map<std::string, std::string, openstudio::IstringCompare> replaceOutputVariablesMap({ | ||
| 5110 | {"Other Equipment FuelOil#1 Rate", "Other Equipment FuelOilNo1 Rate"}, | ||
| 5111 | {"Other Equipment FuelOil#2 Rate", "Other Equipment FuelOilNo2 Rate"}, | ||
| 5112 | {"Exterior Equipment FuelOil#1 Energy", "Exterior Equipment FuelOilNo1 Energy"}, | ||
| 5113 | {"Exterior Equipment FuelOil#2 Energy", "Exterior Equipment FuelOilNo2 Energy"}, | ||
| 5114 | {"FuelOil#1:Facility", "FuelOilNo1:Facility"}, | ||
| 5115 | {"FuelOil#2:Facility", "FuelOilNo2:Facility"}, | ||
| 5116 | {"FuelOil#1:HVAC", "FuelOilNo1:HVAC"}, | ||
| 5117 | {"FuelOil#2:HVAC", "FuelOilNo2:HVAC"}, | ||
| 5118 | {"ExteriorEquipment:FuelOil#1", "ExteriorEquipment:FuelOilNo1"}, | ||
| 5119 | {"Cooling:FuelOil#1", "Cooling:FuelOilNo1"}, | ||
| 5120 | {"Heating:FuelOil#1", "Heating:FuelOilNo1"}, | ||
| 5121 | {"WaterSystems:FuelOil#1", "WaterSystems:FuelOilNo1"}, | ||
| 5122 | {"Cogeneration:FuelOil#1", "Cogeneration:FuelOilNo1"}, | ||
| 5123 | {"ExteriorEquipment:FuelOil#2", "ExteriorEquipment:FuelOilNo2"}, | ||
| 5124 | {"Cooling:FuelOil#2", "Cooling:FuelOilNo2"}, | ||
| 5125 | {"Heating:FuelOil#2", "Heating:FuelOilNo2"}, | ||
| 5126 | {"WaterSystems:FuelOil#2", "WaterSystems:FuelOilNo2"}, | ||
| 5127 | {"Cogeneration:FuelOil#2", "Cogeneration:FuelOilNo2"}, | ||
| 5128 | {"Chiller FuelOil#1 Rate", "Chiller FuelOilNo1 Rate"}, | ||
| 5129 | {"Chiller FuelOil#1 Energy", "Chiller FuelOilNo1 Energy"}, | ||
| 5130 | {"Chiller FuelOil#1 Mass Flow Rate", "Chiller FuelOilNo1 Mass Flow Rate"}, | ||
| 5131 | {"Chiller FuelOil#2 Rate", "Chiller FuelOilNo2 Rate"}, | ||
| 5132 | {"Chiller FuelOil#2 Energy", "Chiller FuelOilNo2 Energy"}, | ||
| 5133 | {"Chiller FuelOil#2 Mass Flow Rate", "Chiller FuelOilNo2 Mass Flow Rate"}, | ||
| 5134 | {"Boiler FuelOil#1 Rate", "Boiler FuelOilNo1 Rate"}, | ||
| 5135 | {"Boiler FuelOil#1 Energy", "Boiler FuelOilNo1 Energy"}, | ||
| 5136 | {"Boiler FuelOil#2 Rate", "Boiler FuelOilNo2 Rate"}, | ||
| 5137 | {"Boiler FuelOil#2 Energy", "Boiler FuelOilNo2 Energy"}, | ||
| 5138 | {"Cooling Coil FuelOil#1 Power", "Cooling Coil FuelOilNo1 Power"}, | ||
| 5139 | {"Cooling Coil FuelOil#1 Energy", "Cooling Coil FuelOilNo1 Energy"}, | ||
| 5140 | {"Cooling Coil FuelOil#2 Power", "Cooling Coil FuelOilNo2 Power"}, | ||
| 5141 | {"Cooling Coil FuelOil#2 Energy", "Cooling Coil FuelOilNo2 Energy"}, | ||
| 5142 | {"Generator FuelOil#1 Rate", "Generator FuelOilNo1 Rate"}, | ||
| 5143 | {"Generator FuelOil#1 Energy", "Generator FuelOilNo1 Energy"}, | ||
| 5144 | {"Generator FuelOil#1 Mass Flow Rate", "Generator FuelOilNo1 Mass Flow Rate"}, | ||
| 5145 | {"Generator FuelOil#2 Rate", "Generator FuelOilNo2 Rate"}, | ||
| 5146 | {"Generator FuelOil#2 Energy", "Generator FuelOilNo2 Energy"}, | ||
| 5147 | {"Generator FuelOil#2 Mass Flow Rate", "Generator FuelOilNo2 Mass Flow Rate"}, | ||
| 5148 | {"Generator FuelOil#1 HHV Basis Rate", "Generator FuelOilNo1 HHV Basis Rate"}, | ||
| 5149 | {"Generator FuelOil#1 HHV Basis Energy", "Generator FuelOilNo1 HHV Basis Energy"}, | ||
| 5150 | {"Generator FuelOil#2 HHV Basis Rate", "Generator FuelOilNo2 HHV Basis Rate"}, | ||
| 5151 | {"Generator FuelOil#2 HHV Basis Energy", "Generator FuelOilNo2 HHV Basis Energy"}, | ||
| 5152 | {"FuelOil#2Emissions:Source", "FuelOilNo2Emissions:Source"}, | ||
| 5153 | {"FuelOil#2Emissions:CO2", "FuelOilNo2Emissions:CO2"}, | ||
| 5154 | {"FuelOil#2Emissions:CO", "FuelOilNo2Emissions:CO"}, | ||
| 5155 | {"FuelOil#2Emissions:CH4", "FuelOilNo2Emissions:CH4"}, | ||
| 5156 | {"FuelOil#2Emissions:NOx", "FuelOilNo2Emissions:NOx"}, | ||
| 5157 | {"FuelOil#2Emissions:N2O", "FuelOilNo2Emissions:N2O"}, | ||
| 5158 | {"FuelOil#2Emissions:SO2", "FuelOilNo2Emissions:SO2"}, | ||
| 5159 | {"FuelOil#2Emissions:PM", "FuelOilNo2Emissions:PM"}, | ||
| 5160 | {"FuelOil#2Emissions:PM10", "FuelOilNo2Emissions:PM10"}, | ||
| 5161 | {"FuelOil#2Emissions:PM2.5", "FuelOilNo2Emissions:PM2.5"}, | ||
| 5162 | {"FuelOil#2Emissions:NH3", "FuelOilNo2Emissions:NH3"}, | ||
| 5163 | {"FuelOil#2Emissions:NMVOC", "FuelOilNo2Emissions:NMVOC"}, | ||
| 5164 | {"FuelOil#2Emissions:Hg", "FuelOilNo2Emissions:Hg"}, | ||
| 5165 | {"FuelOil#2Emissions:Pb", "FuelOilNo2Emissions:Pb"}, | ||
| 5166 | {"FuelOil#2Emissions:WaterEnvironmentalFactors", "FuelOilNo2Emissions:WaterEnvironmentalFactors"}, | ||
| 5167 | {"FuelOil#2Emissions:Nuclear High", "FuelOilNo2Emissions:Nuclear High"}, | ||
| 5168 | {"FuelOil#2Emissions:Nuclear Low", "FuelOilNo2Emissions:Nuclear Low"}, | ||
| 5169 | {"FuelOil#1Emissions:Source", "FuelOilNo1Emissions:Source"}, | ||
| 5170 | {"FuelOil#1Emissions:CO2", "FuelOilNo1Emissions:CO2"}, | ||
| 5171 | {"FuelOil#1Emissions:CO", "FuelOilNo1Emissions:CO"}, | ||
| 5172 | {"FuelOil#1Emissions:CH4", "FuelOilNo1Emissions:CH4"}, | ||
| 5173 | {"FuelOil#1Emissions:NOx", "FuelOilNo1Emissions:NOx"}, | ||
| 5174 | {"FuelOil#1Emissions:N2O", "FuelOilNo1Emissions:N2O"}, | ||
| 5175 | {"FuelOil#1Emissions:SO2", "FuelOilNo1Emissions:SO2"}, | ||
| 5176 | {"FuelOil#1Emissions:PM", "FuelOilNo1Emissions:PM"}, | ||
| 5177 | {"FuelOil#1Emissions:PM10", "FuelOilNo1Emissions:PM10"}, | ||
| 5178 | {"FuelOil#1Emissions:PM2.5", "FuelOilNo1Emissions:PM2.5"}, | ||
| 5179 | {"FuelOil#1Emissions:NH3", "FuelOilNo1Emissions:NH3"}, | ||
| 5180 | {"FuelOil#1Emissions:NMVOC", "FuelOilNo1Emissions:NMVOC"}, | ||
| 5181 | {"FuelOil#1Emissions:Hg", "FuelOilNo1Emissions:Hg"}, | ||
| 5182 | {"FuelOil#1Emissions:Pb", "FuelOilNo1Emissions:Pb"}, | ||
| 5183 | {"FuelOil#1Emissions:WaterEnvironmentalFactors", "FuelOilNo1Emissions:WaterEnvironmentalFactors"}, | ||
| 5184 | {"FuelOil#1Emissions:Nuclear High", "FuelOilNo1Emissions:Nuclear High"}, | ||
| 5185 | {"FuelOil#1Emissions:Nuclear Low", "FuelOilNo1Emissions:Nuclear Low"}, | ||
| 5186 | {"Environmental Impact Fuel Oil #2 CO2 Emissions Mass", "Environmental Impact FuelOilNo2 CO2 Emissions Mass"}, | ||
| 5187 | {"Environmental Impact Fuel Oil #2 Source Energy", "Environmental Impact FuelOilNo2 Source Energy"}, | ||
| 5188 | {"Environmental Impact Fuel Oil #2 CO2 Emissions Mass", "Environmental Impact FuelOilNo2 CO2 Emissions Mass"}, | ||
| 5189 | {"Environmental Impact Fuel Oil #2 CO Emissions Mass", "Environmental Impact FuelOilNo2 CO Emissions Mass"}, | ||
| 5190 | {"Environmental Impact Fuel Oil #2 CH4 Emissions Mass", "Environmental Impact FuelOilNo2 CH4 Emissions Mass"}, | ||
| 5191 | {"Environmental Impact Fuel Oil #2 NOx Emissions Mass", "Environmental Impact FuelOilNo2 NOx Emissions Mass"}, | ||
| 5192 | {"Environmental Impact Fuel Oil #2 N2O Emissions Mass", "Environmental Impact FuelOilNo2 N2O Emissions Mass"}, | ||
| 5193 | {"Environmental Impact Fuel Oil #2 SO2 Emissions Mass", "Environmental Impact FuelOilNo2 SO2 Emissions Mass"}, | ||
| 5194 | {"Environmental Impact Fuel Oil #2 PM Emissions Mass", "Environmental Impact FuelOilNo2 PM Emissions Mass"}, | ||
| 5195 | {"Environmental Impact Fuel Oil #2 PM10 Emissions Mass", "Environmental Impact FuelOilNo2 PM10 Emissions Mass"}, | ||
| 5196 | {"Environmental Impact Fuel Oil #2 PM2.5 Emissions Mass", "Environmental Impact FuelOilNo2 PM2.5 Emissions Mass"}, | ||
| 5197 | {"Environmental Impact Fuel Oil #2 NH3 Emissions Mass", "Environmental Impact FuelOilNo2 NH3 Emissions Mass"}, | ||
| 5198 | {"Environmental Impact Fuel Oil #2 NMVOC Emissions Mass", "Environmental Impact FuelOilNo2 NMVOC Emissions Mass"}, | ||
| 5199 | {"Environmental Impact Fuel Oil #2 Hg Emissions Mass", "Environmental Impact FuelOilNo2 Hg Emissions Mass"}, | ||
| 5200 | {"Environmental Impact Fuel Oil #2 Pb Emissions Mass", "Environmental Impact FuelOilNo2 Pb Emissions Mass"}, | ||
| 5201 | {"Environmental Impact Fuel Oil #2 Water Consumption Volume", "Environmental Impact FuelOilNo2 Water Consumption Volume"}, | ||
| 5202 | {"Environmental Impact Fuel Oil #2 Nuclear High Level Waste Mass", "Environmental Impact FuelOilNo2 Nuclear High Level Waste Mass"}, | ||
| 5203 | {"Environmental Impact Fuel Oil #2 Nuclear Low Level Waste Volume", "Environmental Impact FuelOilNo2 Nuclear Low Level Waste Volume"}, | ||
| 5204 | {"Environmental Impact Fuel Oil #1 Source Energy", "Environmental Impact FuelOilNo1 Source Energy"}, | ||
| 5205 | {"Environmental Impact Fuel Oil #1 CO2 Emissions Mass", "Environmental Impact FuelOilNo1 CO2 Emissions Mass"}, | ||
| 5206 | {"Environmental Impact Fuel Oil #1 CO Emissions Mass", "Environmental Impact FuelOilNo1 CO Emissions Mass"}, | ||
| 5207 | {"Environmental Impact Fuel Oil #1 CH4 Emissions Mass", "Environmental Impact FuelOilNo1 CH4 Emissions Mass"}, | ||
| 5208 | {"Environmental Impact Fuel Oil #1 NOx Emissions Mass", "Environmental Impact FuelOilNo1 NOx Emissions Mass"}, | ||
| 5209 | {"Environmental Impact Fuel Oil #1 N2O Emissions Mass", "Environmental Impact FuelOilNo1 N2O Emissions Mass"}, | ||
| 5210 | {"Environmental Impact Fuel Oil #1 SO2 Emissions Mass", "Environmental Impact FuelOilNo1 SO2 Emissions Mass"}, | ||
| 5211 | {"Environmental Impact Fuel Oil #1 PM Emissions Mass", "Environmental Impact FuelOilNo1 PM Emissions Mass"}, | ||
| 5212 | {"Environmental Impact Fuel Oil #1 PM10 Emissions Mass", "Environmental Impact FuelOilNo1 PM10 Emissions Mass"}, | ||
| 5213 | {"Environmental Impact Fuel Oil #1 PM2.5 Emissions Mass", "Environmental Impact FuelOilNo1 PM2.5 Emissions Mass"}, | ||
| 5214 | {"Environmental Impact Fuel Oil #1 NH3 Emissions Mass", "Environmental Impact FuelOilNo1 NH3 Emissions Mass"}, | ||
| 5215 | {"Environmental Impact Fuel Oil #1 NMVOC Emissions Mass", "Environmental Impact FuelOilNo1 NMVOC Emissions Mass"}, | ||
| 5216 | {"Environmental Impact Fuel Oil #1 Hg Emissions Mass", "Environmental Impact FuelOilNo1 Hg Emissions Mass"}, | ||
| 5217 | {"Environmental Impact Fuel Oil #1 Pb Emissions Mass", "Environmental Impact FuelOilNo1 Pb Emissions Mass"}, | ||
| 5218 | {"Environmental Impact Fuel Oil #1 Water Consumption Volume", "Environmental Impact FuelOilNo1 Water Consumption Volume"}, | ||
| 5219 | {"Environmental Impact Fuel Oil #1 Nuclear High Level Waste Mass", "Environmental Impact FuelOilNo1 Nuclear High Level Waste Mass"}, | ||
| 5220 | {"Environmental Impact Fuel Oil #1 Nuclear Low Level Waste Volume", "Environmental Impact FuelOilNo1 Nuclear Low Level Waste Volume"}, | ||
| 5221 | {"Baseboard Electric Energy", "Baseboard Electricity Energy"}, | ||
| 5222 | {"Baseboard Electric Power", "Baseboard Electricity Rate"}, | ||
| 5223 | {"Boiler Electric Power", "Boiler Electricity Rate"}, | ||
| 5224 | {"Boiler Electric Energy", "Boiler Electricity Energy"}, | ||
| 5225 | {"Boiler Ancillary Electric Power", "Boiler Ancillary Electricity Rate"}, | ||
| 5226 | {"Boiler Ancillary Electric Energy", "Boiler Ancillary Electricity Energy"}, | ||
| 5227 | {"Generator Produced Electric Power", "Generator Produced AC Electricity Rate"}, | ||
| 5228 | {"Generator Produced Electric Energy", "Generator Produced AC Electricity Energy"}, | ||
| 5229 | {"Chiller Electric Power", "Chiller Electricity Rate"}, | ||
| 5230 | {"Chiller Electric Energy", "Chiller Electricity Energy"}, | ||
| 5231 | {"Chiller Condenser Fan Electric Power", "Chiller Condenser Fan Electricity Rate"}, | ||
| 5232 | {"Chiller Condenser Fan Electric Energy", "Chiller Condenser Fan Electricity Energy"}, | ||
| 5233 | {"Chiller Basin Heater Electric Power", "Chiller Basin Heater Electricity Rate"}, | ||
| 5234 | {"Chiller Basin Heater Electric Energy", "Chiller Basin Heater Electricity Energy"}, | ||
| 5235 | {"Chiller Heater Electric Power", "Chiller Heater Electricity Rate"}, | ||
| 5236 | {"Chiller Heater Electric Energy", "Chiller Heater Electricity Energy"}, | ||
| 5237 | {"Chiller Heater Cooling Electric Power", "Chiller Heater Cooling Electricity Rate"}, | ||
| 5238 | {"Chiller Heater Cooling Electric Energy", "Chiller Heater Cooling Electricity Energy"}, | ||
| 5239 | {"Chiller Heater Heating Electric Power", "Chiller Heater Heating Electricity Rate"}, | ||
| 5240 | {"Chiller Heater Heating Electric Energy", "Chiller Heater Heating Electricity Energy"}, | ||
| 5241 | {"Cooling Coil Electric Power", "Cooling Coil Electricity Rate"}, | ||
| 5242 | {"Cooling Coil Electric Energy", "Cooling Coil Electricity Energy"}, | ||
| 5243 | {"Cooling Coil Crankcase Heater Electric Power", "Cooling Coil Crankcase Heater Electricity Rate"}, | ||
| 5244 | {"Cooling Coil Crankcase Heater Electric Energy", "Cooling Coil Crankcase Heater Electricity Energy"}, | ||
| 5245 | {"Cooling Coil Basin Heater Electric Power", "Cooling Coil Basin Heater Electricity Rate"}, | ||
| 5246 | {"Cooling Coil Basin Heater Electric Energy", "Cooling Coil Basin Heater Electricity Energy"}, | ||
| 5247 | {"Cooling Coil Evaporative Condenser Pump Electric Power", "Cooling Coil Evaporative Condenser Pump Electricity Rate"}, | ||
| 5248 | {"Cooling Coil Evaporative Condenser Pump Electric Energy", "Cooling Coil Evaporative Condenser Pump Electricity Energy"}, | ||
| 5249 | {"Cooling Tower Fan Electric Power", "Cooling Tower Fan Electricity Rate"}, | ||
| 5250 | {"Cooling Tower Fan Electric Energy", "Cooling Tower Fan Electricity Energy"}, | ||
| 5251 | {"Cooling Tower Basin Heater Electric Power", "Cooling Tower Basin Heater Electricity Rate"}, | ||
| 5252 | {"Zone Cooltower Pump Electric Power", "Zone Cooltower Pump Electricity Rate"}, | ||
| 5253 | {"Zone Cooltower Pump Electric Energy", "Zone Cooltower Pump Electricity Energy"}, | ||
| 5254 | {"Heating Coil Electric Power", "Heating Coil Electricity Rate"}, | ||
| 5255 | {"Heating Coil Electric Energy", "Heating Coil Electricity Energy"}, | ||
| 5256 | {"Heating Coil Defrost Electric Power", "Heating Coil Defrost Electricity Rate"}, | ||
| 5257 | {"Heating Coil Crankcase Heater Electric Power", "Heating Coil Crankcase Heater Electricity Rate"}, | ||
| 5258 | {"Heating Coil Crankcase Heater Electric Energy", "Heating Coil Crankcase Heater Electricity Energy"}, | ||
| 5259 | {"Cooling Coil Water Heating Electric Power", "Cooling Coil Water Heating Electricity Rate"}, | ||
| 5260 | {"Cooling Coil Water Heating Electric Energy", "Cooling Coil Water Heating Electricity Energy"}, | ||
| 5261 | {"Dehumidifier Electric Power", "Dehumidifier Electricity Rate"}, | ||
| 5262 | {"Dehumidifier Electric Energy", "Dehumidifier Electricity Energy"}, | ||
| 5263 | {"Dehumidifier Exhaust Fan Electric Power", "Dehumidifier Exhaust Fan Electricity Rate"}, | ||
| 5264 | {"Dehumidifier Exhaust Fan Electric Energy", "Dehumidifier Exhaust Fan Electricity Energy"}, | ||
| 5265 | {"Earth Tube Fan Electric Energy", "Earth Tube Fan Electricity Energy"}, | ||
| 5266 | {"Earth Tube Fan Electric Power", "Earth Tube Fan Electricity Rate"}, | ||
| 5267 | {"Gas:Facility", "NaturalGas:Facility"}, | ||
| 5268 | {"Gas:Building", "NaturalGas:Building"}, | ||
| 5269 | {"Gas:Plant", "NaturalGas:Plant"}, | ||
| 5270 | {"Gas:HVAC", "NaturalGas:HVAC"}, | ||
| 5271 | {"Facility Total Purchased Electric Power", "Facility Total Purchased Electricity Rate"}, | ||
| 5272 | {"Facility Total Purchased Electric Energy", "Facility Total Purchased Electricity Energy"}, | ||
| 5273 | {"Facility Total Surplus Electric Power", "Facility Total Surplus Electricity Rate"}, | ||
| 5274 | {"Facility Total Surplus Electric Energy", "Facility Total Surplus Electricity Energy"}, | ||
| 5275 | {"Facility Net Purchased Electric Power", "Facility Net Purchased Electricity Rate"}, | ||
| 5276 | {"Facility Net Purchased Electric Energy", "Facility Net Purchased Electricity Energy"}, | ||
| 5277 | {"Facility Total Building Electric Demand Power", "Facility Total Building Electricity Demand Rate"}, | ||
| 5278 | {"Facility Total HVAC Electric Demand Power", "Facility Total HVAC Electricity Demand Rate"}, | ||
| 5279 | {"Facility Total Electric Demand Power", "Facility Total Electricity Demand Rate"}, | ||
| 5280 | {"Facility Total Produced Electric Power", "Facility Total Produced Electricity Rate"}, | ||
| 5281 | {"Facility Total Produced Electric Energy", "Facility Total Produced Electricity Energy"}, | ||
| 5282 | {"Electric Load Center Produced Electric Power", "Electric Load Center Produced Electricity Rate"}, | ||
| 5283 | {"Electric Load Center Produced Electric Energy", "Electric Load Center Produced Electricity Energy"}, | ||
| 5284 | {"Electric Load Center Supplied Electric Power", "Electric Load Center Supplied Electricity Rate"}, | ||
| 5285 | {"Electric Load Center Drawn Electric Power", "Electric Load Center Drawn Electricity Rate"}, | ||
| 5286 | {"Electric Load Center Requested Electric Power", "Electric Load Center Requested Electricity Rate"}, | ||
| 5287 | {"Generator Requested Electric Power", "Generator Requested Electricity Rate"}, | ||
| 5288 | {"Inverter DC Input Electric Power", "Inverter DC Input Electricity Rate"}, | ||
| 5289 | {"Inverter DC Input Electric Energy", "Inverter DC Input Electricity Energy"}, | ||
| 5290 | {"Inverter AC Output Electric Power", "Inverter AC Output Electricity Rate"}, | ||
| 5291 | {"Inverter AC Output Electric Energy", "Inverter AC Output Electricity Energy"}, | ||
| 5292 | {"Inverter Ancillary AC Electric Power", "Inverter Ancillary AC Electricity Rate"}, | ||
| 5293 | {"Inverter Ancillary AC Electric Energy", "Inverter Ancillary AC Electricity Energy"}, | ||
| 5294 | {"Converter AC Input Electric Power", "Converter AC Input Electricity Rate"}, | ||
| 5295 | {"Converter AC Input Electric Energy", "Converter AC Input Electricity Energy"}, | ||
| 5296 | {"Converter DC Output Electric Power", "Converter DC Output Electricity Rate"}, | ||
| 5297 | {"Converter DC Output Electric Energy", "Converter DC Output Electricity Energy"}, | ||
| 5298 | {"Converter Electric Loss Power", "Converter Electricity Loss Rate"}, | ||
| 5299 | {"Converter Electric Loss Energy", "Converter Electricity Loss Energy"}, | ||
| 5300 | {"Converter Electric Loss Decrement Energy", "Converter Electricity Loss Decrement Energy"}, | ||
| 5301 | {"Converter Ancillary AC Electric Power", "Converter Ancillary AC Electricity Rate"}, | ||
| 5302 | {"Converter Ancillary AC Electric Energy", "Converter Ancillary AC Electricity Energy"}, | ||
| 5303 | {"Transformer Input Electric Power", "Transformer Input Electricity Rate"}, | ||
| 5304 | {"Transformer Input Electric Energy", "Transformer Input Electricity Energy"}, | ||
| 5305 | {"Transformer Output Electric Power", "Transformer Output Electricity Rate"}, | ||
| 5306 | {"Transformer Output Electric Energy", "Transformer Output Electricity Energy"}, | ||
| 5307 | {"Transformer Distribution Electric Loss Energy", "Transformer Distribution Electricity Loss Energy"}, | ||
| 5308 | {"Transformer Cogeneration Electric Loss Energy", "Transformer Cogeneration Electricity Loss Energy"}, | ||
| 5309 | {"Transformer Conversion Electric Loss Energy", "Transformer Conversion Electricity Loss Energy"}, | ||
| 5310 | {"Evaporative Cooler Electric Energy", "Evaporative Cooler Electricity Energy"}, | ||
| 5311 | {"Evaporative Cooler Electric Power", "Evaporative Cooler Electricity Rate"}, | ||
| 5312 | {"Exterior Lights Electric Power", "Exterior Lights Electricity Rate"}, | ||
| 5313 | {"Exterior Lights Electric Energy", "Exterior Lights Electricity Energy"}, | ||
| 5314 | {"Fan Coil Fan Electric Power", "Fan Coil Fan Electricity Rate"}, | ||
| 5315 | {"Fan Coil Fan Electric Energy", "Fan Coil Fan Electricity Energy"}, | ||
| 5316 | {"Fan Electric Power", "Fan Electricity Rate"}, | ||
| 5317 | {"Fan Electric Energy", "Fan Electricity Energy"}, | ||
| 5318 | {"Generator Blower Electric Power", "Generator Blower Electricity Rate"}, | ||
| 5319 | {"Generator Blower Electric Energy", "Generator Blower Electricity Energy"}, | ||
| 5320 | {"Generator Fuel Compressor Electric Power", "Generator Fuel Compressor Electricity Rate"}, | ||
| 5321 | {"Generator Fuel Compressor Electric Energy", "Generator Fuel Compressor Electricity Energy"}, | ||
| 5322 | {"Generator Fuel Reformer Water Pump Electric Power", "Generator Fuel Reformer Water Pump Electricity Rate"}, | ||
| 5323 | {"Generator Fuel Reformer Water Pump Electric Energy", "Generator Fuel Reformer Water Pump Electricity Energy"}, | ||
| 5324 | {"Generator Produced DC Electric Power", "Generator Produced DC Electricity Rate"}, | ||
| 5325 | {"Generator Ancillary AC Electric Power", "Generator Ancillary AC Electricity Rate"}, | ||
| 5326 | {"Generator Ancillary AC Electric Energy", "Generator Ancillary AC Electricity Energy"}, | ||
| 5327 | {"Unitary System Ancillary Electric Power", "Unitary System Ancillary Electricity Rate"}, | ||
| 5328 | {"Unitary System Cooling Ancillary Electric Energy", "Unitary System Cooling Ancillary Electricity Energy"}, | ||
| 5329 | {"Unitary System Heating Ancillary Electric Energy", "Unitary System Heating Ancillary Electricity Energy"}, | ||
| 5330 | {"Unitary System Electric Power", "Unitary System Electricity Rate"}, | ||
| 5331 | {"Unitary System Electric Energy", "Unitary System Electricity Energy"}, | ||
| 5332 | {"Zone Ventilator Electric Power", "Zone Ventilator Electricity Rate"}, | ||
| 5333 | {"Zone Ventilator Electric Energy", "Zone Ventilator Electricity Energy"}, | ||
| 5334 | {"Zone VRF Air Terminal Cooling Electric Power", "Zone VRF Air Terminal Cooling Electricity Rate"}, | ||
| 5335 | {"Zone VRF Air Terminal Cooling Electric Energy", "Zone VRF Air Terminal Cooling Electricity Energy"}, | ||
| 5336 | {"Zone VRF Air Terminal Heating Electric Power", "Zone VRF Air Terminal Heating Electricity Rate"}, | ||
| 5337 | {"Zone VRF Air Terminal Heating Electric Energy", "Zone VRF Air Terminal Heating Electricity Energy"}, | ||
| 5338 | {"VRF Heat Pump Cooling Electric Power", "VRF Heat Pump Cooling Electricity Rate"}, | ||
| 5339 | {"VRF Heat Pump Cooling Electric Energy", "VRF Heat Pump Cooling Electricity Energy"}, | ||
| 5340 | {"VRF Heat Pump Heating Electric Power", "VRF Heat Pump Heating Electricity Rate"}, | ||
| 5341 | {"VRF Heat Pump Heating Electric Energy", "VRF Heat Pump Heating Electricity Energy"}, | ||
| 5342 | {"VRF Heat Pump Compressor Electric Power", "VRF Heat Pump Compressor Electricity Rate"}, | ||
| 5343 | {"VRF Heat Pump Defrost Electric Power", "VRF Heat Pump Defrost Electricity Rate"}, | ||
| 5344 | {"VRF Heat Pump Defrost Electric Energy", "VRF Heat Pump Defrost Electricity Energy"}, | ||
| 5345 | {"VRF Heat Pump Crankcase Heater Electric Power", "VRF Heat Pump Crankcase Heater Electricity Rate"}, | ||
| 5346 | {"VRF Heat Pump Crankcase Heater Electric Energy", "VRF Heat Pump Crankcase Heater Electricity Energy"}, | ||
| 5347 | {"VRF Heat Pump Evaporative Condenser Pump Electric Power", "VRF Heat Pump Evaporative Condenser Pump Electricity Rate"}, | ||
| 5348 | {"VRF Heat Pump Evaporative Condenser Pump Electric Energy", "VRF Heat Pump Evaporative Condenser Pump Electricity Energy"}, | ||
| 5349 | {"VRF Heat Pump Basin Heater Electric Power", "VRF Heat Pump Basin Heater Electricity Rate"}, | ||
| 5350 | {"VRF Heat Pump Basin Heater Electric Energy", "VRF Heat Pump Basin Heater Electricity Energy"}, | ||
| 5351 | {"Zone Combined Outdoor Air Fan Electric Energy", "Zone Combined Outdoor Air Fan Electricity Energy"}, | ||
| 5352 | {"Zone Ventilation Fan Electric Energy", "Zone Ventilation Fan Electricity Energy"}, | ||
| 5353 | {"Heat Pump Electric Power", "Heat Pump Electricity Rate"}, | ||
| 5354 | {"Heat Pump Electric Energy", "Heat Pump Electricity Energy"}, | ||
| 5355 | {"Heat Exchanger Electric Power", "Heat Exchanger Electricity Rate"}, | ||
| 5356 | {"Heat Exchanger Electric Energy", "Heat Exchanger Electricity Energy"}, | ||
| 5357 | {"Heating Coil Gas Energy", "Heating Coil NaturalGas Energy"}, | ||
| 5358 | {"Heating Coil Gas Rate", "Heating Coil NaturalGas Rate"}, | ||
| 5359 | {"Heating Coil Ancillary Gas Rate", "Heating Coil Ancillary NaturalGas Rate"}, | ||
| 5360 | {"Heating Coil Ancillary Gas Energy", "Heating Coil Ancillary NaturalGas Energy"}, | ||
| 5361 | {"Zone Radiant HVAC Gas Rate", "Zone Radiant HVAC NaturalGas Rate"}, | ||
| 5362 | {"Zone Radiant HVAC Gas Energy", "Zone Radiant HVAC NaturalGas Energy"}, | ||
| 5363 | {"Zone Radiant HVAC Electric Power", "Zone Radiant HVAC Electricity Rate"}, | ||
| 5364 | {"Zone Radiant HVAC Electric Energy", "Zone Radiant HVAC Electricity Energy"}, | ||
| 5365 | {"Humidifier Electric Power", "Humidifier Electricity Rate"}, | ||
| 5366 | {"Humidifier Electric Energy", "Humidifier Electricity Energy"}, | ||
| 5367 | {"Humidifier Gas Use Thermal Efficiency", "Humidifier NaturalGas Use Thermal Efficiency"}, | ||
| 5368 | {"Humidifier Gas Use Rate", "Humidifier NaturalGas Rate"}, | ||
| 5369 | {"Humidifier Gas Use Energy", "Humidifier NaturalGas Energy"}, | ||
| 5370 | {"Humidifier Auxiliary Electric Power", "Humidifier Auxiliary Electricity Rate"}, | ||
| 5371 | {"Humidifier Auxiliary Electric Energy", "Humidifier Auxiliary Electricity Energy"}, | ||
| 5372 | {"Zone Hybrid Unitary HVAC Electric Power", "Zone Hybrid Unitary HVAC Electricity Rate"}, | ||
| 5373 | {"Zone Hybrid Unitary HVAC Electric Energy", "Zone Hybrid Unitary HVAC Electricity Energy"}, | ||
| 5374 | {"Zone Hybrid Unitary HVAC Supply Fan Electric Power", "Zone Hybrid Unitary HVAC Supply Fan Electricity Rate"}, | ||
| 5375 | {"Zone Hybrid Unitary HVAC Supply Fan Electric Energy", "Zone Hybrid Unitary HVAC Supply Fan Electricity Energy"}, | ||
| 5376 | {"Ice Thermal Storage Ancillary Electric Power", "Ice Thermal Storage Ancillary Electricity Rate"}, | ||
| 5377 | {"Ice Thermal Storage Ancillary Electric Energy", "Ice Thermal Storage Ancillary Electricity Energy"}, | ||
| 5378 | {"Zone Lights Electric Energy", "Zone Lights Electricity Energy"}, | ||
| 5379 | {"Zone Electric Equipment Electric Energy", "Zone Electric Equipment Electricity Energy"}, | ||
| 5380 | {"Boiler Gas Consumption", "Boiler NaturalGas Consumption"}, | ||
| 5381 | {"Boiler Gas Consumption Rate", "Boiler NaturalGas Consumption Rate"}, | ||
| 5382 | {"Zone Window Air Conditioner Electric Energy", "Zone Window Air Conditioner Electricity Energy"}, | ||
| 5383 | {"Zone Window Air Conditioner Electric Power", "Zone Window Air Conditioner Electricity Rate"}, | ||
| 5384 | {"Water Heater Gas Consumption", "Water Heater NaturalGas Consumption"}, | ||
| 5385 | {"Generator Gas Consumption", "Generator NaturalGas Consumption"}, | ||
| 5386 | {"Pump Electric Energy", "Pump Electricity Energy"}, | ||
| 5387 | {"Pump Electric Power", "Pump Electricity Rate"}, | ||
| 5388 | {"Air System Electric Energy", "Air System Electricity Energy"}, | ||
| 5389 | {"Air System Gas Energy", "Air System Naturalgas Energy"}, | ||
| 5390 | {"Air System Fan Electric Energy", "Air System Fan Electricity Energy"}, | ||
| 5391 | {"Air System DX Heating Coil Electric Energy", "Air System DX Heating Coil Electricity Energy"}, | ||
| 5392 | {"Air System DX Cooling Coil Electric Energy", "Air System DX Cooling Coil Electricity Energy"}, | ||
| 5393 | {"Air System Heating Coil Electric Energy", "Air System Heating Coil Electricity Energy"}, | ||
| 5394 | {"Air System Heating Coil Gas Energy", "Air System Heating Coil NaturalGas Energy"}, | ||
| 5395 | {"Air System Humidifier Electric Energy", "Air System Humidifier Electricity Energy"}, | ||
| 5396 | {"Air System Evaporative Cooler Electric Energy", "Air System Evaporative Cooler Electricity Energy"}, | ||
| 5397 | {"Air System Desiccant Dehumidifier Electric Energy", "Air System Desiccant Dehumidifier Electricity Energy"}, | ||
| 5398 | {"Integrated Heat Pump Electric Power", "Integrated Heat Pump Electricity Rate"}, | ||
| 5399 | {"Integrated Heat Pump Electric Energy", "Integrated Heat Pump Electricity Energy"}, | ||
| 5400 | {"Lights Electric Power", "Lights Electricity Rate"}, | ||
| 5401 | {"Lights Electric Energy", "Lights Electricity Energy"}, | ||
| 5402 | {"Zone Lights Electric Power", "Zone Lights Electricity Rate"}, | ||
| 5403 | {"Zone Lights Electric Energy", "Zone Lights Electricity Energy"}, | ||
| 5404 | {"Electric Equipment Electric Power", "Electric Equipment Electricity Rate"}, | ||
| 5405 | {"Electric Equipment Electric Energy", "Electric Equipment Electricity Energy"}, | ||
| 5406 | {"Zone Electric Equipment Electric Power", "Zone Electric Equipment Electricity Rate"}, | ||
| 5407 | {"Zone Electric Equipment Electric Energy", "Zone Electric Equipment Electricity Energy"}, | ||
| 5408 | {"Gas Equipment Gas Rate", "Gas Equipment NaturalGas Rate"}, | ||
| 5409 | {"Gas Equipment Gas Energy", "Gas Equipment NaturalGas Energy"}, | ||
| 5410 | {"Zone Gas Equipment Gas Rate", "Zone Gas Equipment NaturalGas Rate"}, | ||
| 5411 | {"Zone Gas Equipment Gas Energy", "Zone Gas Equipment NaturalGas Energy"}, | ||
| 5412 | {"ITE CPU Electric Power", "ITE CPU Electricity Rate"}, | ||
| 5413 | {"ITE Fan Electric Power", "ITE Fan Electricity Rate"}, | ||
| 5414 | {"ITE UPS Electric Power", "ITE UPS Electricity Rate"}, | ||
| 5415 | {"ITE CPU Electric Power at Design Inlet Conditions", "ITE CPU Electricity Rate at Design Inlet Conditions"}, | ||
| 5416 | {"ITE Fan Electric Power at Design Inlet Conditions", "ITE Fan Electricity Rate at Design Inlet Conditions"}, | ||
| 5417 | {"ITE CPU Electric Energy", "ITE CPU Electricity Energy"}, | ||
| 5418 | {"ITE Fan Electric Energy", "ITE Fan Electricity Energy"}, | ||
| 5419 | {"ITE UPS Electric Energy", "ITE UPS Electricity Energy"}, | ||
| 5420 | {"ITE CPU Electric Energy at Design Inlet Conditions", "ITE CPU Electricity Energy at Design Inlet Conditions"}, | ||
| 5421 | {"ITE Fan Electric Energy at Design Inlet Conditions", "ITE Fan Electricity Energy at Design Inlet Conditions"}, | ||
| 5422 | {"Zone ITE CPU Electric Power", "Zone ITE CPU Electricity Rate"}, | ||
| 5423 | {"Zone ITE Fan Electric Power", "Zone ITE Fan Electricity Rate"}, | ||
| 5424 | {"Zone ITE UPS Electric Power", "Zone ITE UPS Electricity Rate"}, | ||
| 5425 | {"Zone ITE CPU Electric Power at Design Inlet Conditions", "Zone ITE CPU Electricity Rate at Design Inlet Conditions"}, | ||
| 5426 | {"Zone ITE Fan Electric Power at Design Inlet Conditions", "Zone ITE Fan Electricity Rate at Design Inlet Conditions"}, | ||
| 5427 | {"Zone ITE CPU Electric Energy", "Zone ITE CPU Electricity Energy"}, | ||
| 5428 | {"Zone ITE Fan Electric Energy", "Zone ITE Fan Electricity Energy"}, | ||
| 5429 | {"Zone ITE UPS Electric Energy", "Zone ITE UPS Electricity Energy"}, | ||
| 5430 | {"Zone ITE CPU Electric Energy at Design Inlet Conditions", "Zone ITE CPU Electricity Energy at Design Inlet Conditions"}, | ||
| 5431 | {"Zone ITE Fan Electric Energy at Design Inlet Conditions", "Zone ITE Fan Electricity Energy at Design Inlet Conditions"}, | ||
| 5432 | {"Zone Baseboard Electric Power", "Zone Baseboard Electricity Rate"}, | ||
| 5433 | {"Zone Baseboard Electric Energy", "Zone Baseboard Electricity Energy"}, | ||
| 5434 | {"Zone Radiant HVAC Pump Electric Power", "Zone Radiant HVAC Pump Electricity Rate"}, | ||
| 5435 | {"Zone Radiant HVAC Pump Electric Energy", "Zone Radiant HVAC Pump Electricity Energy"}, | ||
| 5436 | {"Generator Standby Electric Power", "Generator Standby Electricity Rate"}, | ||
| 5437 | {"Generator Ancillary Electric Power", "Generator Ancillary Electricity Rate"}, | ||
| 5438 | {"Generator Ancillary Electric Energy", "Generator Ancillary Electricity Energy"}, | ||
| 5439 | {"Zone Outdoor Air Unit Fan Electric Power", "Zone Outdoor Air Unit Fan Electricity Rate"}, | ||
| 5440 | {"Zone Outdoor Air Unit Fan Electric Energy", "Zone Outdoor Air Unit Fan Electricity Energy"}, | ||
| 5441 | {"InteriorEquipment:Gas", "InteriorEquipment:NaturalGas"}, | ||
| 5442 | {"ExteriorEquipment:Gas", "ExteriorEquipment:NaturalGas"}, | ||
| 5443 | {"Heating:Gas", "Heating:NaturalGas"}, | ||
| 5444 | {"Cooling:Gas", "Cooling:NaturalGas"}, | ||
| 5445 | {"WaterSystems:Gas", "WaterSystems:NaturalGas"}, | ||
| 5446 | {"Cogeneration:Gas", "Cogeneration:NaturalGas"}, | ||
| 5447 | {"Humidifier:Gas", "Humidifier:NaturalGas"}, | ||
| 5448 | {"Air System Humidifier Gas Energy", "Air System Humidifier Natural Gas Energy"}, | ||
| 5449 | {"Generator Produced DC Electric Energy", "Generator Produced DC Electricity Energy"}, | ||
| 5450 | {"Zone Packaged Terminal Heat Pump Electric Power", "Zone Packaged Terminal Heat Pump Electricity Rate"}, | ||
| 5451 | {"Zone Packaged Terminal Heat Pump Electric Energy", "Zone Packaged Terminal Heat Pump Electricity Energy"}, | ||
| 5452 | {"Zone Packaged Terminal Air Conditioner Electric Power", "Zone Packaged Terminal Air Conditioner Electricity Rate"}, | ||
| 5453 | {"Zone Packaged Terminal Air Conditioner Electric Energy", "Zone Packaged Terminal Air Conditioner Electricity Energy"}, | ||
| 5454 | {"Zone Water to Air Heat Pump Electric Power", "Zone Water to Air Heat Pump Electricity Rate"}, | ||
| 5455 | {"Zone Water to Air Heat Pump Electric Energy", "Zone Water to Air Heat Pump Electricity Energy"}, | ||
| 5456 | {"Cooling Coil Cold Weather Protection Electric Energy", "Cooling Coil Cold Weather Protection Electricity Energy"}, | ||
| 5457 | {"Cooling Coil Cold Weather Protection Electric Power", "Cooling Coil Cold Weather Protection Electricity Rate"}, | ||
| 5458 | {"Chiller Heater System Cooling Electric Energy", "Chiller Heater System Cooling Electricity Energy"}, | ||
| 5459 | {"Chiller Heater System Heating Electric Energy", "Chiller Heater System Heating Electricity Energy"}, | ||
| 5460 | {"Chiller Heater System Cooling Electric Power", "Chiller Heater System Cooling Electricity Rate"}, | ||
| 5461 | {"Chiller Heater System Heating Electric Power", "Chiller Heater System Heating Electricity Rate"}, | ||
| 5462 | {"Chiller Heater Cooling Electric Power Unit", "Chiller Heater Cooling Electricity Rate Unit"}, | ||
| 5463 | {"Chiller Heater Heating Electric Power Unit", "Chiller Heater Heating Electricity Rate Unit"}, | ||
| 5464 | {"Chiller Heater Cooling Electric Energy Unit", "Chiller Heater Cooling Electricity Energy Unit"}, | ||
| 5465 | {"Chiller Heater Heating Electric Energy Unit", "Chiller Heater Heating Electricity Energy Unit"}, | ||
| 5466 | {"Environmental Impact Natural Gas Source Energy", "Environmental Impact NaturalGas Source Energy"}, | ||
| 5467 | {"Environmental Impact Natural Gas CO2 Emissions Mass", "Environmental Impact NaturalGas CO2 Emissions Mass"}, | ||
| 5468 | {"Environmental Impact Natural Gas CO Emissions Mass", "Environmental Impact NaturalGas CO Emissions Mass"}, | ||
| 5469 | {"Environmental Impact Natural Gas CH4 Emissions Mass", "Environmental Impact NaturalGas CH4 Emissions Mass"}, | ||
| 5470 | {"Environmental Impact Natural Gas NOx Emissions Mass", "Environmental Impact NaturalGas NOx Emissions Mass"}, | ||
| 5471 | {"Environmental Impact Natural Gas N2O Emissions Mass", "Environmental Impact NaturalGas N2O Emissions Mass"}, | ||
| 5472 | {"Environmental Impact Natural Gas SO2 Emissions Mass", "Environmental Impact NaturalGas SO2 Emissions Mass"}, | ||
| 5473 | {"Environmental Impact Natural Gas PM Emissions Mass", "Environmental Impact NaturalGas PM Emissions Mass"}, | ||
| 5474 | {"Environmental Impact Natural Gas PM10 Emissions Mass", "Environmental Impact NaturalGas PM10 Emissions Mass"}, | ||
| 5475 | {"Environmental Impact Natural Gas PM2.5 Emissions Mass", "Environmental Impact NaturalGas PM2.5 Emissions Mass"}, | ||
| 5476 | {"Environmental Impact Natural Gas NH3 Emissions Mass", "Environmental Impact NaturalGas NH3 Emissions Mass"}, | ||
| 5477 | {"Environmental Impact Natural Gas NMVOC Emissions Mass", "Environmental Impact NaturalGas NMVOC Emissions Mass"}, | ||
| 5478 | {"Environmental Impact Natural Gas Hg Emissions Mass", "Environmental Impact NaturalGas Hg Emissions Mass"}, | ||
| 5479 | {"Environmental Impact Natural Gas Pb Emissions Mass", "Environmental Impact NaturalGas Pb Emissions Mass"}, | ||
| 5480 | {"Environmental Impact Natural Gas Water Consumption Volume", "Environmental Impact NaturalGas Water Consumption Volume"}, | ||
| 5481 | {"Environmental Impact Natural Gas Nuclear High Level Waste Mass", "Environmental Impact NaturalGas Nuclear High Level Waste Mass"}, | ||
| 5482 | {"Environmental Impact Natural Gas Nuclear Low Level Waste Volume", "Environmental Impact NaturalGas Nuclear Low Level Waste Volume"}, | ||
| 5483 | {"Refrigeration Case Evaporator Fan Electric Power", "Refrigeration Case Evaporator Fan Electricity Rate"}, | ||
| 5484 | {"Refrigeration Case Evaporator Fan Electric Energy", "Refrigeration Case Evaporator Fan Electricity Energy"}, | ||
| 5485 | {"Refrigeration Case Lighting Electric Power", "Refrigeration Case Lighting Electricity Rate"}, | ||
| 5486 | {"Refrigeration Case Lighting Electric Energy", "Refrigeration Case Lighting Electricity Energy"}, | ||
| 5487 | {"Refrigeration Case Anti Sweat Electric Power", "Refrigeration Case Anti Sweat Electricity Rate"}, | ||
| 5488 | {"Refrigeration Case Anti Sweat Electric Energy", "Refrigeration Case Anti Sweat Electricity Energy"}, | ||
| 5489 | {"Refrigeration Case Defrost Electric Power", "Refrigeration Case Defrost Electricity Rate"}, | ||
| 5490 | {"Refrigeration Case Defrost Electric Energy", "Refrigeration Case Defrost Electricity Energy"}, | ||
| 5491 | {"Refrigeration Walk In Ancillary Electric Power", "Refrigeration Walk In Ancillary Electricity Rate"}, | ||
| 5492 | {"Refrigeration Walk In Ancillary Electric Energy", "Refrigeration Walk In Ancillary Electricity Energy"}, | ||
| 5493 | {"Refrigeration Walk In Fan Electric Power", "Refrigeration Walk In Fan Electricity Rate"}, | ||
| 5494 | {"Refrigeration Walk In Fan Electric Energy", "Refrigeration Walk In Fan Electricity Energy"}, | ||
| 5495 | {"Refrigeration Walk In Lighting Electric Power", "Refrigeration Walk In Lighting Electricity Rate"}, | ||
| 5496 | {"Refrigeration Walk In Lighting Electric Energy", "Refrigeration Walk In Lighting Electricity Energy"}, | ||
| 5497 | {"Refrigeration Walk In Heater Electric Power", "Refrigeration Walk In Heater Electricity Rate"}, | ||
| 5498 | {"Refrigeration Walk In Heater Electric Energy", "Refrigeration Walk In Heater Electricity Energy"}, | ||
| 5499 | {"Refrigeration Walk In Defrost Electric Power", "Refrigeration Walk In Defrost Electricity Rate"}, | ||
| 5500 | {"Refrigeration Walk In Defrost Electric Energy", "Refrigeration Walk In Defrost Electricity Energy"}, | ||
| 5501 | {"Refrigeration Zone Air Chiller Total Electric Power", "Refrigeration Zone Air Chiller Total Electricity Rate"}, | ||
| 5502 | {"Refrigeration Zone Air Chiller Total Electric Energy", "Refrigeration Zone Air Chiller Total Electricity Energy"}, | ||
| 5503 | {"Refrigeration Zone Air Chiller Fan Electric Power", "Refrigeration Zone Air Chiller Fan Electricity Rate"}, | ||
| 5504 | {"Refrigeration Zone Air Chiller Heater Electric Power", "Refrigeration Zone Air Chiller Heater Electricity Rate"}, | ||
| 5505 | {"Refrigeration Zone Air Chiller Heater Electric Energy", "Refrigeration Zone Air Chiller Heater Electricity Energy"}, | ||
| 5506 | {"Refrigeration Zone Air Chiller Defrost Electric Power", "Refrigeration Zone Air Chiller Defrost Electricity Rate"}, | ||
| 5507 | {"Refrigeration Zone Air Chiller Defrost Electric Energy", "Refrigeration Zone Air Chiller Defrost Electricity Energy"}, | ||
| 5508 | {"Refrigeration Air Chiller Secondary Loop Pump Electric Power", "Refrigeration Air Chiller Secondary Loop Pump Electricity Rate"}, | ||
| 5509 | {"Refrigeration Air Chiller Secondary Loop Pump Electric Energy", "Refrigeration Air Chiller Secondary Loop Pump Electricity Energy"}, | ||
| 5510 | {"Refrigeration Secondary Loop Pump Electric Power", "Refrigeration Secondary Loop Pump Electricity Rate"}, | ||
| 5511 | {"Refrigeration Secondary Loop Pump Electric Energy", "Refrigeration Secondary Loop Pump Electricity Energy"}, | ||
| 5512 | {"Refrigeration Air Chiller Compressor Rack Electric Power", "Refrigeration Air Chiller Compressor Rack Electricity Rate"}, | ||
| 5513 | {"Refrigeration Air Chiller Compressor Rack Electric Energy", "efrigeration Air Chiller Compressor Rack Electricity Energy"}, | ||
| 5514 | {"Refrigeration Air Chiller Compressor Rack Condenser Fan Electric Power", | ||
| 5515 | "Refrigeration Air Chiller Compressor Rack Condenser Fan Electricity Rate"}, | ||
| 5516 | {"Refrigeration Air Chiller Compressor Rack Condenser Fan Electric Energy", | ||
| 5517 | "Refrigeration Air Chiller Compressor Rack Condenser Fan Electricity Energy"}, | ||
| 5518 | {"Refrigeration Air Chiller Compressor Rack Evaporative Condenser Pump Electric Power", | ||
| 5519 | "Refrigeration Air Chiller Compressor Rack Evaporative Condenser Pump Electricity Rate"}, | ||
| 5520 | {"Refrigeration Air Chiller Compressor Rack Evaporative Condenser Pump Electric Energy", | ||
| 5521 | "Refrigeration Air Chiller Compressor Rack Evaporative Condenser Pump Electricity Energy"}, | ||
| 5522 | {"Refrigeration Air Chiller Compressor Rack Evaporative Condenser Basin Heater Electric Power", | ||
| 5523 | "Refrigeration Air Chiller Compressor Rack Evaporative Condenser Basin Heater Electricity Rate"}, | ||
| 5524 | {"Refrigeration Air Chiller Compressor Rack Evaporative Condenser Basin Heater Electric Energy", | ||
| 5525 | "Refrigeration Air Chiller Compressor Rack Evaporative Condenser Basin Heater Electricity Energy"}, | ||
| 5526 | {"Refrigeration Compressor Rack Electric Power", "Refrigeration Compressor Rack Electricity Rate"}, | ||
| 5527 | {"Refrigeration Compressor Rack Electric Energy", "Refrigeration Compressor Rack Electricity Energy"}, | ||
| 5528 | {"Refrigeration Compressor Rack Condenser Fan Electric Power", "Refrigeration Compressor Rack Condenser Fan Electricity Rate"}, | ||
| 5529 | {"Refrigeration Compressor Rack Condenser Fan Electric Energy", "Refrigeration Compressor Rack Condenser Fan Electricity Energy"}, | ||
| 5530 | {"Refrigeration Compressor Rack Evaporative Condenser Pump Electric Power", | ||
| 5531 | "Refrigeration Compressor Rack Evaporative Condenser Pump Electricity Rate"}, | ||
| 5532 | {"Refrigeration Compressor Rack Evaporative Condenser Pump Electric Energy", | ||
| 5533 | "Refrigeration Compressor Rack Evaporative Condenser Pump Electricity Energy"}, | ||
| 5534 | {"Refrigeration Compressor Rack Evaporative Condenser Basin Heater Electric Power", | ||
| 5535 | "Refrigeration Compressor Rack Evaporative Condenser Basin Heater Electricity Rate"}, | ||
| 5536 | {"Refrigeration Compressor Rack Evaporative Condenser Basin Heater Electric Energy", | ||
| 5537 | "Refrigeration Compressor Rack Evaporative Condenser Basin Heater Electricity Energy"}, | ||
| 5538 | {"Refrigeration Air Chiller System Total Compressor Electric Power", "Refrigeration Air Chiller System Total Compressor Electricity Rate"}, | ||
| 5539 | {"Refrigeration Air Chiller System Total Compressor Electric Energy", "Refrigeration Air Chiller System Total Compressor Electricity Energy"}, | ||
| 5540 | {"Refrigeration Air Chiller System Total Low Stage Compressor Electric Power", | ||
| 5541 | "Refrigeration Air Chiller System Total Low Stage Compressor Electricity Rate"}, | ||
| 5542 | {"Refrigeration Air Chiller System Total Low Stage Compressor Electric Energy", | ||
| 5543 | "Refrigeration Air Chiller System Total Low Stage Compressor Electricity Energy"}, | ||
| 5544 | {"Refrigeration Air Chiller System Total High Stage Compressor Electric Power", | ||
| 5545 | "Refrigeration Air Chiller System Total High Stage Compressor Electricity Rate"}, | ||
| 5546 | {"Refrigeration Air Chiller System Total High Stage Compressor Electric Energy", | ||
| 5547 | "Refrigeration Air Chiller System Total High Stage Compressor Electricity Energy"}, | ||
| 5548 | {"Refrigeration Air Chiller System Total Low and High Stage Compressor Electric Energy", | ||
| 5549 | "Refrigeration Air Chiller System Total Low and High Stage Compressor Electricity Energy"}, | ||
| 5550 | {"Refrigeration System Total Compressor Electric Power", "Refrigeration System Total Compressor Electricity Rate"}, | ||
| 5551 | {"Refrigeration System Total Compressor Electric Energy", "Refrigeration System Total Compressor Electricity Energy"}, | ||
| 5552 | {"Refrigeration System Total Low Stage Compressor Electric Power", "Refrigeration System Total Low Stage Compressor Electricity Rate"}, | ||
| 5553 | {"Refrigeration System Total Low Stage Compressor Electric Energy", "Refrigeration System Total Low Stage Compressor Electricity Energy"}, | ||
| 5554 | {"Refrigeration System Total High Stage Compressor Electric Power", "Refrigeration System Total High Stage Compressor Electricity Rate"}, | ||
| 5555 | {"Refrigeration System Total High Stage Compressor Electric Energy", "Refrigeration System Total High Stage Compressor Electricity Energy"}, | ||
| 5556 | {"Refrigeration System Total Low and High Stage Compressor Electric Energy", | ||
| 5557 | "Refrigeration System Total Low and High Stage Compressor Electricity Energy"}, | ||
| 5558 | {"Refrigeration Air Chiller System Compressor Electric Power", "Refrigeration Air Chiller System Compressor Electricity Rate"}, | ||
| 5559 | {"Refrigeration Air Chiller System Compressor Electric Energy", "Refrigeration Air Chiller System Compressor Electricity Energy"}, | ||
| 5560 | {"Refrigeration Compressor Electric Power", "Refrigeration Compressor Electricity Rate"}, | ||
| 5561 | {"Refrigeration Compressor Electric Energy", "Refrigeration Compressor Electricity Energy"}, | ||
| 5562 | {"Refrigeration Air Chiller System Condenser Fan Electric Power", "Refrigeration Air Chiller System Condenser Fan Electricity Rate"}, | ||
| 5563 | {"Refrigeration Air Chiller System Condenser Fan Electric Energy", "Refrigeration Air Chiller System Condenser Fan Electricity Energy"}, | ||
| 5564 | {"Refrigeration Air Chiller System Condenser Fan Electric Power", "Refrigeration Air Chiller System Condenser Fan Electricity Rate"}, | ||
| 5565 | {"Refrigeration Air Chiller System Condenser Fan Electric Energy", "Refrigeration Air Chiller System Condenser Fan Electricity Energy"}, | ||
| 5566 | {"Refrigeration Air Chiller System Condenser Pump Electric Power", "Refrigeration Air Chiller System Condenser Pump Electricity Rate"}, | ||
| 5567 | {"Refrigeration Air Chiller System Condenser Pump Electric Energy", "Refrigeration Air Chiller System Condenser Pump Electricity Energy"}, | ||
| 5568 | {"Refrigeration Air Chiller System Condenser Basin Heater Electric Power", | ||
| 5569 | "Refrigeration Air Chiller System Condenser Basin Heater Electricity Rate"}, | ||
| 5570 | {"Refrigeration Air Chiller System Condenser Basin Heater Electric Energy", | ||
| 5571 | "Refrigeration Air Chiller System Condenser Basin Heater Electricity Energy"}, | ||
| 5572 | {"Refrigeration System Condenser Fan Electric Power", "Refrigeration System Condenser Fan Electricity Rate"}, | ||
| 5573 | {"Refrigeration System Condenser Fan Electric Energy", "Refrigeration System Condenser Fan Electricity Energy"}, | ||
| 5574 | {"Refrigeration System Condenser Fan Electric Power", "Refrigeration System Condenser Fan Electricity Rat"}, | ||
| 5575 | {"Refrigeration System Condenser Fan Electric Energy", "Refrigeration System Condenser Fan Electricity Energy"}, | ||
| 5576 | {"Refrigeration System Condenser Pump Electric Power", "Refrigeration System Condenser Pump Electricity Rate"}, | ||
| 5577 | {"Refrigeration System Condenser Pump Electric Energy", "Refrigeration System Condenser Pump Electricity Energy"}, | ||
| 5578 | {"Refrigeration System Condenser Basin Heater Electric Power", "Refrigeration System Condenser Basin Heater Electricity Rate"}, | ||
| 5579 | {"Refrigeration System Condenser Basin Heater Electric Energy", "Refrigeration System Condenser Basin Heater Electricity Energy"}, | ||
| 5580 | {"Refrigeration Transcritical System Total High Pressure Compressor Electric Power", | ||
| 5581 | "Refrigeration Transcritical System Total High Pressure Compressor Electricity Rate"}, | ||
| 5582 | {"Refrigeration Transcritical System Total High Pressure Compressor Electric Energy", | ||
| 5583 | "Refrigeration Transcritical System Total High Pressure Compressor Electricity Energy"}, | ||
| 5584 | {"Refrigeration Transcritical System Total Compressor Electric Energy", | ||
| 5585 | "Refrigeration Transcritical System Total Compressor Electricity Energy"}, | ||
| 5586 | {"Refrigeration Transcritical System Low Pressure Compressor Electric Power", | ||
| 5587 | "Refrigeration Transcritical System Low Pressure Compressor Electricity Rate"}, | ||
| 5588 | {"Refrigeration Transcritical System Low Pressure Compressor Electric Energy", | ||
| 5589 | "Refrigeration Transcritical System Low Pressure Compressor Electricity Energy"}, | ||
| 5590 | {"Refrigeration Compressor Electric Power", "Refrigeration Compressor Electricity Rate"}, | ||
| 5591 | {"Refrigeration Compressor Electric Energy", "Refrigeration Compressor Electricity Energy"}, | ||
| 5592 | {"Refrigeration Compressor Electric Power", "Refrigeration Compressor Electricity Rate"}, | ||
| 5593 | {"Refrigeration Compressor Electric Energy", "Refrigeration Compressor Electricity Energy"}, | ||
| 5594 | {"Refrigeration Transcritical System Gas Cooler Fan Electric Power", "Refrigeration Transcritical System Gas Cooler Fan Electricity Rate"}, | ||
| 5595 | {"Refrigeration Transcritical System Gas Cooler Fan Electric Energy", "Refrigeration Transcritical System Gas Cooler Fan Electricity Energy"}, | ||
| 5596 | {"Air System Humidifier Electric Energy", "Air System Humidifier Electricity Energy"}, | ||
| 5597 | {"Zone Unit Heater Fan Electric Power", "Zone Unit Heater Fan Electricity Rate"}, | ||
| 5598 | {"Zone Unit Heater Fan Electric Energy", "Zone Unit Heater Fan Electricity Energy"}, | ||
| 5599 | {"Zone Unit Ventilator Fan Electric Power", "Zone Unit Ventilator Fan Electricity Rate"}, | ||
| 5600 | {"Zone Unit Ventilator Fan Electric Energy", "Zone Unit Ventilator Fan Electricity Energy"}, | ||
| 5601 | {"Heating Coil Defrost Electric Energy", "Heating Coil Defrost Electricity Energy"}, | ||
| 5602 | {"Cooling Coil Water Heating Pump Electric Power", "Cooling Coil Water Heating Pump Electricity Rate"}, | ||
| 5603 | {"Cooling Coil Water Heating Pump Electric Energy", "Cooling Coil Water Heating Pump Electricity Energy"}, | ||
| 5604 | {"Zone Ventilated Slab Fan Electric Power", "Zone Ventilated Slab Fan Electricity Rate"}, | ||
| 5605 | {"Zone Ventilated Slab Fan Electric Energy", "one Ventilated Slab Fan Electricity Energy"}, | ||
| 5606 | {"Water System Groundwater Well Pump Electric Power", "Water System Groundwater Well Pump Electricity Rate"}, | ||
| 5607 | {"Water System Groundwater Well Pump Electric Energy", "Water System Groundwater Well Pump Electricity Energy"}, | ||
| 5608 | {"Water Heater Electric Power", "Water Heater Electricity Rate"}, | ||
| 5609 | {"Water Heater Electric Energy", "Water Heater Electricity Energy"}, | ||
| 5610 | {"Water Heater Off Cycle Parasitic Electric Power", "Water Heater Off Cycle Parasitic Electricity Rate"}, | ||
| 5611 | {"Water Heater Off Cycle Parasitic Electric Energy", "Water Heater Off Cycle Parasitic Electricity Energy"}, | ||
| 5612 | {"Water Heater On Cycle Parasitic Electric Power", "Water Heater On Cycle Parasitic Electricity Rate"}, | ||
| 5613 | {"Water Heater On Cycle Parasitic Electric Energy", "Water Heater On Cycle Parasitic Electricity Energy"}, | ||
| 5614 | {"Water Heater Off Cycle Ancillary Electric Power", "Water Heater Off Cycle Ancillary Electricity Rate"}, | ||
| 5615 | {"Water Heater Off Cycle Ancillary Electric Energy", "Water Heater Off Cycle Ancillary Electricity Energy"}, | ||
| 5616 | {"Water Heater On Cycle Ancillary Electric Power", "Water Heater On Cycle Ancillary Electricity Rate"}, | ||
| 5617 | {"Water Heater On Cycle Ancillary Electric Energy", "Water Heater On Cycle Ancillary Electricity Energy"}, | ||
| 5618 | {"Water Heater Gas Rate", "Water Heater NaturalGas Rate"}, | ||
| 5619 | {"Water Heater Gas Energy", "Water Heater NaturalGas Energy"}, | ||
| 5620 | {"Water Heater Off Cycle Parasitic Gas Rate", "Water Heater Off Cycle Parasitic NaturalGas Rate"}, | ||
| 5621 | {"Water Heater Off Cycle Parasitic Gas Energy", "Water Heater Off Cycle Parasitic NaturalGas Energy"}, | ||
| 5622 | {"Water Heater On Cycle Parasitic Gas Rate", "Water Heater On Cycle Parasitic NaturalGas Rate"}, | ||
| 5623 | {"Water Heater On Cycle Parasitic Gas Energy", "Water Heater On Cycle Parasitic NaturalGas Energy"}, | ||
| 5624 | {"Water Heater Off Cycle Ancillary Gas Rate", "Water Heater Off Cycle Ancillary NaturalGas Rate"}, | ||
| 5625 | {"Water Heater Off Cycle Ancillary Gas Energy", "Water Heater Off Cycle Ancillary NaturalGas Energy"}, | ||
| 5626 | {"Water Heater On Cycle Ancillary Gas Rate", "Water Heater On Cycle Ancillary NaturalGas Rate"}, | ||
| 5627 | {"Water Heater On Cycle Ancillary Gas Energy", "Water Heater On Cycle Ancillary NaturalGas Energy"}, | ||
| 5628 | {"Water Heater FuelOil#1 Rate", "Water Heater FuelOilNo1 Rate"}, | ||
| 5629 | {"Water Heater FuelOil#1 Energy", "Water Heater FuelOilNo1 Energy"}, | ||
| 5630 | {"Water Heater Off Cycle Parasitic FuelOil#1 Rate", "Water Heater Off Cycle Parasitic FuelOilNo1 Rate"}, | ||
| 5631 | {"Water Heater Off Cycle Parasitic FuelOil#1 Energy", "Water Heater Off Cycle Parasitic FuelOilNo1 Energy"}, | ||
| 5632 | {"Water Heater On Cycle Parasitic FuelOil#1 Rate", "Water Heater On Cycle Parasitic FuelOilNo1 Rate"}, | ||
| 5633 | {"Water Heater On Cycle Parasitic FuelOil#1 Energy", "Water Heater On Cycle Parasitic FuelOilNo1 Energy"}, | ||
| 5634 | {"Water Heater Off Cycle Ancillary FuelOil#1 Rate", "Water Heater Off Cycle Ancillary FuelOilNo1 Rate"}, | ||
| 5635 | {"Water Heater Off Cycle Ancillary FuelOil#1 Energy", "Water Heater Off Cycle Ancillary FuelOilNo1 Energy"}, | ||
| 5636 | {"Water Heater On Cycle Ancillary FuelOil#1 Rate", "Water Heater On Cycle Ancillary FuelOilNo1 Rate"}, | ||
| 5637 | {"Water Heater On Cycle Ancillary FuelOil#1 Energy", "Water Heater On Cycle Ancillary FuelOilNo1 Energy"}, | ||
| 5638 | {"Water Heater FuelOil#2 Rate", "Water Heater FuelOilNo2 Rate"}, | ||
| 5639 | {"Water Heater FuelOil#2 Energy", "Water Heater FuelOilNo2 Energy"}, | ||
| 5640 | {"Water Heater Off Cycle Parasitic FuelOil#2 Rate", "Water Heater Off Cycle Parasitic FuelOilNo2 Rate"}, | ||
| 5641 | {"Water Heater Off Cycle Parasitic FuelOil#2 Energy", "Water Heater Off Cycle Parasitic FuelOilNo2 Energy"}, | ||
| 5642 | {"Water Heater On Cycle Parasitic FuelOil#2 Rate", "Water Heater On Cycle Parasitic FuelOilNo2 Rate"}, | ||
| 5643 | {"Water Heater On Cycle Parasitic FuelOil#2 Energy", "Water Heater On Cycle Parasitic FuelOilNo2 Energy"}, | ||
| 5644 | {"Water Heater Off Cycle Ancillary FuelOil#2 Rate", "Water Heater Off Cycle Ancillary FuelOilNo2 Rate"}, | ||
| 5645 | {"Water Heater Off Cycle Ancillary FuelOil#2 Energy", "Water Heater Off Cycle Ancillary FuelOilNo2 Energy"}, | ||
| 5646 | {"Water Heater On Cycle Ancillary FuelOil#2 Rate", "Water Heater On Cycle Ancillary FuelOilNo2 Rate"}, | ||
| 5647 | {"Water Heater On Cycle Ancillary FuelOil#2 Energy", "Water Heater On Cycle Ancillary FuelOilNo2 Energy"}, | ||
| 5648 | {"Water Heater Pump Electric Power", "Water Heater Pump NaturalGas Rate"}, | ||
| 5649 | {"Water Heater Pump Electric Energy", "Water Heater Pump NaturalGas Energy"}, | ||
| 5650 | {"Zone Dehumidifier Electric Power", "Zone Dehumidifier Electricity Rate"}, | ||
| 5651 | {"Zone Dehumidifier Electric Energy", "Zone Dehumidifier Electricity Energy"}, | ||
| 5652 | {"Zone Dehumidifier Off Cycle Parasitic Electric Power", "Zone Dehumidifier Off Cycle Parasitic Electricity Rate"}, | ||
| 5653 | {"Zone Dehumidifier Off Cycle Parasitic Electric Energy", "Zone Dehumidifier Off Cycle Parasitic Electricity Energy"}, | ||
| 5654 | {"Chiller Gas Rate", "Chiller NaturalGas Rate"}, | ||
| 5655 | {"Chiller Gas Energy", "Chiller NaturalGas Energy"}, | ||
| 5656 | {"Chiller Gas Mass Flow Rate", "Chiller NaturalGas Mass Flow Rate"}, | ||
| 5657 | {"Boiler Gas Rate", "Boiler NaturalGas Rate"}, | ||
| 5658 | {"Boiler Gas Energy", "Boiler NaturalGas Energy"}, | ||
| 5659 | {"Cooling Coil Gas Rate", "Cooling Coil NaturalGas Rate"}, | ||
| 5660 | {"Cooling Coil Gas Energy", "Cooling Coil NaturalGas Energy"}, | ||
| 5661 | {"Generator Gas Rate", "Generator NaturalGas Rate"}, | ||
| 5662 | {"Generator Gas Energy", "Generator NaturalGas Energy"}, | ||
| 5663 | {"Generator Gas Mass Flow Rate", "Generator NaturalGas Mass Flow Rate"}, | ||
| 5664 | {"Generator Gas HHV Basis Rate", "Generator NaturalGas HHV Basis Rate"}, | ||
| 5665 | {"Generator Gas HHV Basis Energy", "Generator NaturalGas HHV Basis Energy"}, | ||
| 5666 | {"Chiller Heater Gas Rate", "Chiller Heater NaturalGas Rate"}, | ||
| 5667 | {"Chiller Heater Gas Energy", "Chiller Heater NaturalGas Energy"}, | ||
| 5668 | {"Chiller Heater FuelOil#1 Rate", "Chiller Heater FuelOilNo1 Rate"}, | ||
| 5669 | {"Chiller Heater FuelOil#1 Energy", "Chiller Heater FuelOilNo1 Energy"}, | ||
| 5670 | {"Chiller Heater FuelOil#2 Rate", "Chiller Heater FuelOilNo2 Rate"}, | ||
| 5671 | {"Chiller Heater FuelOil#2 Energy", "Chiller Heater FuelOilNo2 Energy"}, | ||
| 5672 | {"Heating Coil FuelOil#1 Energy", "Heating Coil FuelOilNo1 Energy"}, | ||
| 5673 | {"Heating Coil FuelOil#2 Rate", "Heating Coil FuelOilNo2 Rate"}, | ||
| 5674 | {"Heating Coil FuelOil#1 Energy", "Heating Coil FuelOilNo1 Energy"}, | ||
| 5675 | {"Heating Coil FuelOil#2 Rate", "Heating Coil FuelOilNo2 Rate"}, | ||
| 5676 | |||
| 5677 | // EMS ACTUATORS | ||
| 5678 | {"Electric Power Level", "Electricity Rate"}, | ||
| 5679 | {"Gas Power Level", "NaturalGas Rate"}, | ||
| 5680 |
4/10✓ Branch 0 taken 38 times.
✗ Branch 1 not taken.
✓ Branch 3 taken 38 times.
✗ Branch 4 not taken.
✓ Branch 7 taken 20710 times.
✓ Branch 8 taken 38 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
|
20786 | }); |
| 5681 | |||
| 5682 | /***************************************************************************************************************************************************** | ||
| 5683 | * Output:Meter fuel types renames * | ||
| 5684 | *****************************************************************************************************************************************************/ | ||
| 5685 | |||
| 5686 | const static std::map<std::string, std::string> meterFuelTypesMap({ | ||
| 5687 | {"FuelOil_1", "FuelOilNo1"}, | ||
| 5688 | {"FuelOil_2", "FuelOilNo2"}, | ||
| 5689 | {"Gas", "NaturalGas"}, | ||
| 5690 |
4/10✓ Branch 0 taken 38 times.
✗ Branch 1 not taken.
✓ Branch 3 taken 38 times.
✗ Branch 4 not taken.
✓ Branch 7 taken 114 times.
✓ Branch 8 taken 38 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
|
190 | }); |
| 5691 | |||
| 5692 | /***************************************************************************************************************************************************** | ||
| 5693 | * Shading Control Refactor: pre-scan * | ||
| 5694 | *****************************************************************************************************************************************************/ | ||
| 5695 | |||
| 5696 | 38 | std::map<std::string, std::string> shadingControlToSurfaceMap; | |
| 5697 |
5/5✓ Branch 1 taken 38 times.
✓ Branch 4 taken 38 times.
✓ Branch 7 taken 38 times.
✓ Branch 10 taken 38 times.
✓ Branch 13 taken 38 times.
|
114 | std::vector<IdfObject> subSurfaces = idf_3_0_1.getObjectsByType(idf_3_0_1.iddFile().getObject("OS:SubSurface").get()); |
| 5698 |
2/2✓ Branch 5 taken 141 times.
✓ Branch 6 taken 38 times.
|
179 | for (auto& subSurface : subSurfaces) { |
| 5699 |
1/1✓ Branch 1 taken 141 times.
|
141 | value = subSurface.getString(7, false, true); // Shading Control Name |
| 5700 |
2/2✓ Branch 0 taken 1 time.
✓ Branch 1 taken 140 times.
|
141 | if (value) { |
| 5701 |
5/5✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
|
1 | shadingControlToSurfaceMap[value.get()] = subSurface.getString(0).get(); |
| 5702 | } | ||
| 5703 | } | ||
| 5704 | |||
| 5705 |
3/3✓ Branch 1 taken 38 times.
✓ Branch 8 taken 8897 times.
✓ Branch 9 taken 38 times.
|
8935 | for (IdfObject& object : idf_3_0_1.objects()) { |
| 5706 |
2/2✓ Branch 1 taken 8897 times.
✓ Branch 4 taken 8897 times.
|
8897 | auto iddname = object.iddObject().name(); |
| 5707 | |||
| 5708 |
3/3✓ Branch 1 taken 8897 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 8896 times.
|
8897 | if (iddname == "OS:AvailabilityManager:HybridVentilation") { |
| 5709 | // Added 2 new fields at end only, and made them required-field by setting their default in the Ctor, so VT needed | ||
| 5710 | |||
| 5711 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto iddObject = idd_3_1_0.getObject(iddname); |
| 5712 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfObject newObject(iddObject.get()); |
| 5713 | |||
| 5714 |
3/3✓ Branch 1 taken 15 times.
✓ Branch 3 taken 14 times.
✓ Branch 4 taken 1 time.
|
15 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 5715 |
2/3✓ Branch 1 taken 14 times.
✓ Branch 5 taken 14 times.
✗ Branch 6 not taken.
|
28 | if ((value = object.getString(i))) { |
| 5716 |
2/2✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
|
14 | newObject.setString(i, value.get()); |
| 5717 | } | ||
| 5718 | } | ||
| 5719 | |||
| 5720 | // Set new fields per IDD default, same as Model Ctor, since it was made required-field | ||
| 5721 | // Minimum HVAC Operation Time | ||
| 5722 |
1/1✓ Branch 1 taken 1 time.
|
1 | newObject.setDouble(17, 0.0); |
| 5723 | // Minimum Ventilation Time | ||
| 5724 |
1/1✓ Branch 1 taken 1 time.
|
1 | newObject.setDouble(18, 0.0); |
| 5725 | |||
| 5726 |
1/1✓ Branch 1 taken 1 time.
|
1 | ss << newObject; |
| 5727 |
1/1✓ Branch 3 taken 1 time.
|
1 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 5728 | |||
| 5729 |
3/3✓ Branch 3 taken 8896 times.
✓ Branch 5 taken 12 times.
✓ Branch 6 taken 8884 times.
|
8897 | } else if (iddname == "OS:AirLoopHVAC") { |
| 5730 | |||
| 5731 | // Design Return Air Flow Fraction of Supply Air Flow, inserted at position 6 (0-indexed) | ||
| 5732 | |||
| 5733 |
1/1✓ Branch 1 taken 12 times.
|
12 | auto iddObject = idd_3_1_0.getObject(iddname); |
| 5734 |
2/2✓ Branch 1 taken 12 times.
✓ Branch 4 taken 12 times.
|
12 | IdfObject newObject(iddObject.get()); |
| 5735 | |||
| 5736 |
3/3✓ Branch 1 taken 240 times.
✓ Branch 3 taken 228 times.
✓ Branch 4 taken 12 times.
|
240 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 5737 |
2/3✓ Branch 1 taken 228 times.
✓ Branch 5 taken 228 times.
✗ Branch 6 not taken.
|
456 | if ((value = object.getString(i))) { |
| 5738 |
2/2✓ Branch 0 taken 72 times.
✓ Branch 1 taken 156 times.
|
228 | if (i < 6) { |
| 5739 |
2/2✓ Branch 1 taken 72 times.
✓ Branch 4 taken 72 times.
|
72 | newObject.setString(i, value.get()); |
| 5740 | } else { | ||
| 5741 | // Shifted by one field | ||
| 5742 |
2/2✓ Branch 1 taken 156 times.
✓ Branch 4 taken 156 times.
|
156 | newObject.setString(i + 1, value.get()); |
| 5743 | } | ||
| 5744 | } | ||
| 5745 | } | ||
| 5746 | |||
| 5747 | // Set new field per IDD default, same as Model Ctor, since it was made required-field | ||
| 5748 |
1/1✓ Branch 1 taken 12 times.
|
12 | newObject.setDouble(6, 1.0); |
| 5749 | |||
| 5750 |
1/1✓ Branch 1 taken 12 times.
|
12 | ss << newObject; |
| 5751 |
1/1✓ Branch 3 taken 12 times.
|
12 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 5752 | |||
| 5753 |
3/3✓ Branch 3 taken 8884 times.
✓ Branch 5 taken 1 time.
✓ Branch 6 taken 8883 times.
|
8896 | } else if (iddname == "OS:Construction:InternalSource") { |
| 5754 | |||
| 5755 | // Two-Dimensional Temperature Calculation Position, inserted at position 6 (0-indexed) | ||
| 5756 | // Object has extensible groups too | ||
| 5757 | |||
| 5758 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto iddObject = idd_3_1_0.getObject(iddname); |
| 5759 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfObject newObject(iddObject.get()); |
| 5760 | |||
| 5761 |
3/3✓ Branch 1 taken 11 times.
✓ Branch 3 taken 10 times.
✓ Branch 4 taken 1 time.
|
11 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 5762 |
2/3✓ Branch 1 taken 10 times.
✓ Branch 5 taken 10 times.
✗ Branch 6 not taken.
|
20 | if ((value = object.getString(i))) { |
| 5763 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 4 times.
|
10 | if (i < 6) { |
| 5764 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
6 | newObject.setString(i, value.get()); |
| 5765 | } else { | ||
| 5766 | // Shifted by one field | ||
| 5767 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | newObject.setString(i + 1, value.get()); |
| 5768 | } | ||
| 5769 | } | ||
| 5770 | } | ||
| 5771 | |||
| 5772 | // If we made it required-field, set new field per IDD default, same as Model Ctor | ||
| 5773 | // newObject.setDouble(6, 0.0); | ||
| 5774 | |||
| 5775 |
1/1✓ Branch 1 taken 1 time.
|
1 | ss << newObject; |
| 5776 |
1/1✓ Branch 3 taken 1 time.
|
1 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 5777 | |||
| 5778 |
3/3✓ Branch 3 taken 8883 times.
✓ Branch 5 taken 1 time.
✓ Branch 6 taken 8882 times.
|
8884 | } else if (iddname == "OS:ZoneHVAC:LowTemperatureRadiant:Electric") { |
| 5779 | |||
| 5780 | // Inserted a field 'Sepoint Control Type' with a default at position 6 (0-indexed) | ||
| 5781 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto iddObject = idd_3_1_0.getObject(iddname); |
| 5782 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfObject newObject(iddObject.get()); |
| 5783 | |||
| 5784 |
3/3✓ Branch 1 taken 9 times.
✓ Branch 3 taken 8 times.
✓ Branch 4 taken 1 time.
|
9 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 5785 |
2/3✓ Branch 1 taken 8 times.
✓ Branch 5 taken 8 times.
✗ Branch 6 not taken.
|
16 | if ((value = object.getString(i))) { |
| 5786 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 2 times.
|
8 | if (i < 6) { |
| 5787 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
6 | newObject.setString(i, value.get()); |
| 5788 | } else { | ||
| 5789 | // Shifted by one field | ||
| 5790 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | newObject.setString(i + 1, value.get()); |
| 5791 | } | ||
| 5792 | } | ||
| 5793 | } | ||
| 5794 | |||
| 5795 |
1/1✓ Branch 1 taken 1 time.
|
1 | ss << newObject; |
| 5796 |
1/1✓ Branch 3 taken 1 time.
|
1 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 5797 | |||
| 5798 |
3/3✓ Branch 3 taken 8882 times.
✓ Branch 5 taken 1 time.
✓ Branch 6 taken 8881 times.
|
8883 | } else if (iddname == "OS:WaterHeater:HeatPump") { |
| 5799 | |||
| 5800 | // Inserted a field 'Maximum Inlet Air Temperature for Compressor Operation' at position 16 (0-indexed) | ||
| 5801 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto iddObject = idd_3_1_0.getObject(iddname); |
| 5802 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfObject newObject(iddObject.get()); |
| 5803 | |||
| 5804 |
3/3✓ Branch 1 taken 26 times.
✓ Branch 3 taken 25 times.
✓ Branch 4 taken 1 time.
|
26 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 5805 |
2/3✓ Branch 1 taken 25 times.
✓ Branch 5 taken 25 times.
✗ Branch 6 not taken.
|
50 | if ((value = object.getString(i))) { |
| 5806 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 9 times.
|
25 | if (i < 16) { |
| 5807 |
2/2✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
|
16 | newObject.setString(i, value.get()); |
| 5808 | } else { | ||
| 5809 | // Shifted by one field | ||
| 5810 |
2/2✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
|
9 | newObject.setString(i + 1, value.get()); |
| 5811 | } | ||
| 5812 | } | ||
| 5813 | } | ||
| 5814 | |||
| 5815 | // Made it a required-field with the E+ IDD default value set in Ctor, so set it here too | ||
| 5816 |
1/1✓ Branch 1 taken 1 time.
|
1 | newObject.setDouble(16, 48.89); |
| 5817 | |||
| 5818 |
1/1✓ Branch 1 taken 1 time.
|
1 | ss << newObject; |
| 5819 |
1/1✓ Branch 3 taken 1 time.
|
1 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 5820 | |||
| 5821 |
3/3✓ Branch 3 taken 8881 times.
✓ Branch 5 taken 1 time.
✓ Branch 6 taken 8880 times.
|
8882 | } else if (iddname == "OS:ZoneHVAC:LowTemperatureRadiant:ConstantFlow") { |
| 5822 | |||
| 5823 | // Insertion points (0-indexed) | ||
| 5824 | // * Fluid to Radiant Surface Heat Transfer Model: 4 | ||
| 5825 | // * Hydronic Tubing Outside Diameter: 6 | ||
| 5826 | // * Hydronic Tubing Conductivity: 8 | ||
| 5827 | // * Running Mean Outdoor Dry-Bulb Temperature Weighting Factor: 10 | ||
| 5828 | // * Changeover Delay Time Period Schedule: 21 : last field, optional | ||
| 5829 | |||
| 5830 | // Mapping: | ||
| 5831 | // * Hydronic Tubing Inside Diameter - 4 => 5 | ||
| 5832 | // * Hydronic Tubing Length - 5 => 7 | ||
| 5833 | // * Temperature Control Type - 6 => 9 | ||
| 5834 | // * Low Temp Radiant Constant Flow Heating Coil Name - 7 => 11 | ||
| 5835 | // * Low Temp Radiant Constant Flow Cooling Coil Name - 8 => 12 | ||
| 5836 | // * Rated Flow Rate - 9 => 13 | ||
| 5837 | // * Pump Flow Rate Schedule Name - 10 => 14 | ||
| 5838 | // * Rated Pump Head - 11 => 15 | ||
| 5839 | // * Rated Power Consumption - 12 => 16 | ||
| 5840 | // * Motor Efficiency - 13 => 17 | ||
| 5841 | // * Fraction of Motor Inefficiencies to Fluid Stream - 14 => 18 | ||
| 5842 | // * Number of Circuits - 15 => 19 | ||
| 5843 | // * Circuit Length - 16 => 20 | ||
| 5844 | |||
| 5845 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto iddObject = idd_3_1_0.getObject(iddname); |
| 5846 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfObject newObject(iddObject.get()); |
| 5847 | |||
| 5848 |
3/3✓ Branch 1 taken 18 times.
✓ Branch 3 taken 17 times.
✓ Branch 4 taken 1 time.
|
18 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 5849 |
2/3✓ Branch 1 taken 17 times.
✓ Branch 5 taken 17 times.
✗ Branch 6 not taken.
|
34 | if ((value = object.getString(i))) { |
| 5850 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 13 times.
|
17 | if (i < 4) { |
| 5851 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | newObject.setString(i, value.get()); |
| 5852 |
2/2✓ Branch 0 taken 1 time.
✓ Branch 1 taken 12 times.
|
13 | } else if (i < 5) { |
| 5853 | // Shifted by one field | ||
| 5854 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | newObject.setString(i + 1, value.get()); |
| 5855 |
2/2✓ Branch 0 taken 1 time.
✓ Branch 1 taken 11 times.
|
12 | } else if (i < 6) { |
| 5856 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | newObject.setString(i + 2, value.get()); |
| 5857 |
2/2✓ Branch 0 taken 1 time.
✓ Branch 1 taken 10 times.
|
11 | } else if (i < 7) { |
| 5858 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | newObject.setString(i + 3, value.get()); |
| 5859 | } else { | ||
| 5860 |
2/2✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
|
10 | newObject.setString(i + 4, value.get()); |
| 5861 | } | ||
| 5862 | } | ||
| 5863 | } | ||
| 5864 | |||
| 5865 | // If we wanted to make them required-field, these are the defaults | ||
| 5866 | // newObject.setString(4, "ConvectionOnly"); | ||
| 5867 | // newObject.setDouble(6, 0.016); | ||
| 5868 | // newObject.setDouble(8, 0.35); | ||
| 5869 | // newObject.setDouble(10, 0.8); | ||
| 5870 | |||
| 5871 |
1/1✓ Branch 1 taken 1 time.
|
1 | ss << newObject; |
| 5872 |
1/1✓ Branch 3 taken 1 time.
|
1 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 5873 | |||
| 5874 |
3/3✓ Branch 3 taken 8880 times.
✓ Branch 5 taken 1 time.
✓ Branch 6 taken 8879 times.
|
8881 | } else if (iddname == "OS:ZoneHVAC:LowTemperatureRadiant:VariableFlow") { |
| 5875 | |||
| 5876 | // Insertion points (0-indexed) | ||
| 5877 | // * Fluid to Radiant Surface Heat Transfer Model * 6 | ||
| 5878 | // * Hydronic Tubing Outside Diameter * 8 | ||
| 5879 | // * Hydronic Tubing Conductivity * 10 | ||
| 5880 | // * Setpoint Control Type * 12 | ||
| 5881 | // * Changeover Delay Time Period Schedule * 15 | ||
| 5882 | |||
| 5883 | // Mapping: | ||
| 5884 | // * Hydronic Tubing Inside Diameter - 6 => 7 | ||
| 5885 | // * Hydronic Tubing Length - 7 => 9 | ||
| 5886 | // * Temperature Control Type - 8 => 11 | ||
| 5887 | // * Number of Circuits - 9 => 13 | ||
| 5888 | // * Circuit Length - 10 => 14 | ||
| 5889 | |||
| 5890 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto iddObject = idd_3_1_0.getObject(iddname); |
| 5891 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfObject newObject(iddObject.get()); |
| 5892 | |||
| 5893 |
3/3✓ Branch 1 taken 12 times.
✓ Branch 3 taken 11 times.
✓ Branch 4 taken 1 time.
|
12 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 5894 |
2/3✓ Branch 1 taken 11 times.
✓ Branch 5 taken 11 times.
✗ Branch 6 not taken.
|
22 | if ((value = object.getString(i))) { |
| 5895 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 5 times.
|
11 | if (i < 6) { |
| 5896 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
6 | newObject.setString(i, value.get()); |
| 5897 |
2/2✓ Branch 0 taken 1 time.
✓ Branch 1 taken 4 times.
|
5 | } else if (i < 7) { |
| 5898 | // Shifted by one field | ||
| 5899 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | newObject.setString(i + 1, value.get()); |
| 5900 |
2/2✓ Branch 0 taken 1 time.
✓ Branch 1 taken 3 times.
|
4 | } else if (i < 8) { |
| 5901 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | newObject.setString(i + 2, value.get()); |
| 5902 |
2/2✓ Branch 0 taken 1 time.
✓ Branch 1 taken 2 times.
|
3 | } else if (i < 9) { |
| 5903 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | newObject.setString(i + 3, value.get()); |
| 5904 | } else { | ||
| 5905 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | newObject.setString(i + 4, value.get()); |
| 5906 | } | ||
| 5907 | } | ||
| 5908 | } | ||
| 5909 | |||
| 5910 | // If we wanted to make them required-field, these are the defaults | ||
| 5911 | // newObject.setString(6, "ConvectionOnly"); | ||
| 5912 | // newObject.setDouble(8, 0.016); | ||
| 5913 | // newObject.setDouble(10, 0.35); | ||
| 5914 | // newObject.setString(23, "HalfFlowPower"); | ||
| 5915 | |||
| 5916 |
1/1✓ Branch 1 taken 1 time.
|
1 | ss << newObject; |
| 5917 |
1/1✓ Branch 3 taken 1 time.
|
1 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 5918 | |||
| 5919 |
3/3✓ Branch 3 taken 8879 times.
✓ Branch 5 taken 53 times.
✓ Branch 6 taken 8826 times.
|
8880 | } else if (iddname == "OS:Output:Meter") { |
| 5920 | |||
| 5921 |
1/1✓ Branch 1 taken 53 times.
|
53 | std::string name = object.nameString(); |
| 5922 | |||
| 5923 | // Structured bindings | ||
| 5924 |
2/2✓ Branch 6 taken 159 times.
✓ Branch 7 taken 53 times.
|
212 | for (const auto& [k, v] : meterFuelTypesMap) { |
| 5925 |
3/3✓ Branch 1 taken 159 times.
✓ Branch 4 taken 159 times.
✓ Branch 7 taken 159 times.
|
159 | name = boost::regex_replace(name, boost::regex(k, boost::regex::icase), v); |
| 5926 | } | ||
| 5927 |
3/3✓ Branch 1 taken 53 times.
✓ Branch 5 taken 31 times.
✓ Branch 6 taken 22 times.
|
53 | if (name == object.nameString()) { |
| 5928 | // No-op | ||
| 5929 |
1/1✓ Branch 1 taken 31 times.
|
31 | ss << object; |
| 5930 | } else { | ||
| 5931 | |||
| 5932 | // Copy everything but 'Variable Name' field | ||
| 5933 |
1/1✓ Branch 1 taken 22 times.
|
22 | auto iddObject = idd_3_1_0.getObject(iddname); |
| 5934 |
2/2✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
|
22 | IdfObject newObject(iddObject.get()); |
| 5935 | |||
| 5936 |
3/3✓ Branch 1 taken 126 times.
✓ Branch 3 taken 104 times.
✓ Branch 4 taken 22 times.
|
126 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 5937 | // Skip name field | ||
| 5938 |
2/2✓ Branch 0 taken 22 times.
✓ Branch 1 taken 82 times.
|
104 | if (i == 1) { |
| 5939 | 22 | continue; | |
| 5940 | } | ||
| 5941 |
2/3✓ Branch 1 taken 82 times.
✓ Branch 5 taken 82 times.
✗ Branch 6 not taken.
|
164 | if ((value = object.getString(i))) { |
| 5942 |
2/2✓ Branch 1 taken 82 times.
✓ Branch 4 taken 82 times.
|
82 | newObject.setString(i, value.get()); |
| 5943 | } | ||
| 5944 | } | ||
| 5945 | |||
| 5946 |
1/1✓ Branch 1 taken 22 times.
|
22 | newObject.setName(name); |
| 5947 | |||
| 5948 |
1/1✓ Branch 1 taken 22 times.
|
22 | ss << newObject; |
| 5949 |
1/1✓ Branch 3 taken 22 times.
|
22 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 5950 | 22 | } | |
| 5951 | |||
| 5952 |
4/4✓ Branch 2 taken 8826 times.
✓ Branch 5 taken 8694 times.
✓ Branch 7 taken 8683 times.
✓ Branch 8 taken 11 times.
|
17573 | } else if ((iddname == "OS:Output:Variable") || (iddname == "OS:EnergyManagementSystem:Sensor") |
| 5953 |
6/7✓ Branch 0 taken 8694 times.
✓ Branch 1 taken 132 times.
✓ Branch 3 taken 8683 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 8683 times.
✓ Branch 7 taken 143 times.
✓ Branch 8 taken 8683 times.
|
17520 | || (iddname == "OS:EnergyManagementSystem:Actuator")) { |
| 5954 | |||
| 5955 | 143 | unsigned variableNameIndex = 3; | |
| 5956 | // Note: I forgot to add the EMSActuator case in 3.1.0, it was added after the release | ||
| 5957 |
2/3✓ Branch 1 taken 143 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 143 times.
|
143 | if (iddname == "OS:EnergyManagementSystem:Actuator") { |
| 5958 | ✗ | variableNameIndex = 4; // Actuated Component Control Type | |
| 5959 | } | ||
| 5960 | |||
| 5961 |
2/3✓ Branch 1 taken 143 times.
✓ Branch 5 taken 143 times.
✗ Branch 6 not taken.
|
286 | if ((value = object.getString(variableNameIndex))) { |
| 5962 | |||
| 5963 |
2/2✓ Branch 1 taken 143 times.
✓ Branch 4 taken 143 times.
|
143 | std::string variableName = value.get(); |
| 5964 | // Strip consecutive spaces and all | ||
| 5965 |
1/1✓ Branch 1 taken 143 times.
|
143 | variableName = boost::regex_replace(variableName, re_strip_multiple_spaces, " "); |
| 5966 | |||
| 5967 |
1/1✓ Branch 1 taken 143 times.
|
143 | auto it = replaceOutputVariablesMap.find(variableName); |
| 5968 |
2/2✓ Branch 2 taken 114 times.
✓ Branch 3 taken 29 times.
|
143 | if (it == replaceOutputVariablesMap.end()) { |
| 5969 | // No-op | ||
| 5970 |
1/1✓ Branch 1 taken 114 times.
|
114 | ss << object; |
| 5971 | } else { | ||
| 5972 | |||
| 5973 | // Copy everything but 'Variable Name' field | ||
| 5974 |
1/1✓ Branch 1 taken 29 times.
|
29 | auto iddObject = idd_3_1_0.getObject(iddname); |
| 5975 |
2/2✓ Branch 1 taken 29 times.
✓ Branch 4 taken 29 times.
|
29 | IdfObject newObject(iddObject.get()); |
| 5976 | |||
| 5977 |
3/3✓ Branch 1 taken 166 times.
✓ Branch 3 taken 137 times.
✓ Branch 4 taken 29 times.
|
166 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 5978 |
2/2✓ Branch 0 taken 29 times.
✓ Branch 1 taken 108 times.
|
137 | if (i == variableNameIndex) { |
| 5979 | 29 | continue; | |
| 5980 |
2/3✓ Branch 1 taken 108 times.
✓ Branch 5 taken 108 times.
✗ Branch 6 not taken.
|
216 | } else if ((value = object.getString(i))) { |
| 5981 |
2/2✓ Branch 1 taken 108 times.
✓ Branch 4 taken 108 times.
|
108 | newObject.setString(i, value.get()); |
| 5982 | } | ||
| 5983 | } | ||
| 5984 | |||
| 5985 |
11/11✓ Branch 1 taken 29 times.
✓ Branch 4 taken 29 times.
✓ Branch 7 taken 29 times.
✓ Branch 10 taken 29 times.
✓ Branch 14 taken 29 times.
✓ Branch 17 taken 29 times.
✓ Branch 20 taken 29 times.
✓ Branch 23 taken 29 times.
✓ Branch 27 taken 29 times.
✓ Branch 30 taken 29 times.
✓ Branch 33 taken 29 times.
|
29 | LOG(Trace, "Replacing " << variableName << " with " << it->second << " for " << object.nameString()); |
| 5986 |
1/1✓ Branch 2 taken 29 times.
|
29 | newObject.setString(variableNameIndex, it->second); |
| 5987 | |||
| 5988 |
1/1✓ Branch 1 taken 29 times.
|
29 | ss << newObject; |
| 5989 |
1/1✓ Branch 3 taken 29 times.
|
29 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 5990 | 29 | } | |
| 5991 | 143 | } else { | |
| 5992 | // No-op | ||
| 5993 | ✗ | ss << object; | |
| 5994 | } | ||
| 5995 | |||
| 5996 |
8/8✓ Branch 1 taken 8683 times.
✓ Branch 3 taken 8681 times.
✓ Branch 4 taken 2 times.
✓ Branch 6 taken 8681 times.
✓ Branch 8 taken 2 times.
✓ Branch 9 taken 8679 times.
✓ Branch 10 taken 4 times.
✓ Branch 11 taken 8679 times.
|
8683 | } else if ((iddname == "OS:Meter:Custom") || (iddname == "OS:Meter:CustomDecrement")) { |
| 5997 | |||
| 5998 | 4 | bool isReplaceNeeded = false; | |
| 5999 | |||
| 6000 | // First pass scan to see if any of the extensible "Output Variable or Meter Name" need replacing | ||
| 6001 |
3/3✓ Branch 1 taken 4 times.
✓ Branch 8 taken 2 times.
✓ Branch 9 taken 2 times.
|
4 | for (const IdfExtensibleGroup& eg : object.extensibleGroups()) { |
| 6002 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
|
4 | if ((value = eg.getString(1))) { |
| 6003 | |||
| 6004 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | std::string variableName = value.get(); |
| 6005 | // Strip consecutive spaces and all | ||
| 6006 |
1/1✓ Branch 1 taken 2 times.
|
2 | variableName = boost::regex_replace(variableName, re_strip_multiple_spaces, " "); |
| 6007 | |||
| 6008 |
1/1✓ Branch 1 taken 2 times.
|
2 | auto it = replaceOutputVariablesMap.find(variableName); |
| 6009 |
1/2✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | if (it != replaceOutputVariablesMap.end()) { |
| 6010 | 2 | isReplaceNeeded = true; | |
| 6011 | 2 | break; | |
| 6012 | } | ||
| 6013 | 2 | } | |
| 6014 | 4 | } | |
| 6015 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 2 times.
|
4 | if (!isReplaceNeeded) { |
| 6016 | // No-op | ||
| 6017 |
1/1✓ Branch 1 taken 2 times.
|
2 | ss << object; |
| 6018 | } else { | ||
| 6019 | |||
| 6020 | // Copy everything but 'Variable Name' field | ||
| 6021 |
1/1✓ Branch 1 taken 2 times.
|
2 | auto iddObject = idd_3_1_0.getObject(iddname); |
| 6022 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | IdfObject newObject(iddObject.get()); |
| 6023 | |||
| 6024 | // Copy non extensible fields in place | ||
| 6025 |
3/3✓ Branch 1 taken 9 times.
✓ Branch 3 taken 7 times.
✓ Branch 4 taken 2 times.
|
9 | for (size_t i = 0; i < object.numNonextensibleFields(); ++i) { |
| 6026 |
2/3✓ Branch 1 taken 7 times.
✓ Branch 5 taken 7 times.
✗ Branch 6 not taken.
|
14 | if ((value = object.getString(i))) { |
| 6027 |
2/2✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
|
7 | newObject.setString(i, value.get()); |
| 6028 | } | ||
| 6029 | } | ||
| 6030 | |||
| 6031 | // Now deal with the extensibles | ||
| 6032 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 8 taken 4 times.
✓ Branch 9 taken 2 times.
|
6 | for (const IdfExtensibleGroup& eg : object.extensibleGroups()) { |
| 6033 |
1/1✓ Branch 1 taken 4 times.
|
4 | IdfExtensibleGroup new_eg = newObject.pushExtensibleGroup(); |
| 6034 | // Copy Key Name as-is | ||
| 6035 |
3/4✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 4 times.
|
4 | if (value == eg.getString(0)) { |
| 6036 | ✗ | new_eg.setString(0, value.get()); | |
| 6037 | } | ||
| 6038 |
2/3✓ Branch 1 taken 4 times.
✓ Branch 5 taken 4 times.
✗ Branch 6 not taken.
|
8 | if ((value = eg.getString(1))) { |
| 6039 | |||
| 6040 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | std::string variableName = value.get(); |
| 6041 | // Strip consecutive spaces and all | ||
| 6042 |
1/1✓ Branch 1 taken 4 times.
|
4 | variableName = boost::regex_replace(variableName, re_strip_multiple_spaces, " "); |
| 6043 |
1/1✓ Branch 1 taken 4 times.
|
4 | auto it = replaceOutputVariablesMap.find(variableName); |
| 6044 |
1/2✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
|
4 | if (it != replaceOutputVariablesMap.end()) { |
| 6045 |
1/1✓ Branch 2 taken 4 times.
|
4 | new_eg.setString(1, it->second); |
| 6046 | } else { | ||
| 6047 | ✗ | new_eg.setString(1, value.get()); | |
| 6048 | } | ||
| 6049 | 4 | } | |
| 6050 | 6 | } | |
| 6051 | |||
| 6052 |
1/1✓ Branch 1 taken 2 times.
|
2 | ss << newObject; |
| 6053 |
1/1✓ Branch 3 taken 2 times.
|
2 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 6054 | 2 | } | |
| 6055 | |||
| 6056 | // Note: Would have needed to do UtilityCost:Tariff for Fuel Type renames too, but not wrapped | ||
| 6057 | |||
| 6058 |
3/3✓ Branch 1 taken 8679 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 8678 times.
|
8679 | } else if (iddname == "OS:ShadingControl") { |
| 6059 | // get all subsurfaces | ||
| 6060 | // loop thru subsurfaces | ||
| 6061 | // check if shading control name equals this handle | ||
| 6062 | // add extensible field with subsurface handle | ||
| 6063 | // remove shading control name field from subsurface | ||
| 6064 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto iddObject = idd_3_1_0.getObject(iddname); |
| 6065 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfObject newObject(iddObject.get()); |
| 6066 | |||
| 6067 |
3/3✓ Branch 1 taken 5 times.
✓ Branch 3 taken 4 times.
✓ Branch 4 taken 1 time.
|
5 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 6068 |
2/3✓ Branch 1 taken 4 times.
✓ Branch 5 taken 4 times.
✗ Branch 6 not taken.
|
8 | if ((value = object.getString(i))) { |
| 6069 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | newObject.setString(i, value.get()); |
| 6070 | } | ||
| 6071 | } | ||
| 6072 | |||
| 6073 | // New field at end, before extensible, and I moved to E+ default to the Ctor and made it required, so need to set it here | ||
| 6074 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | newObject.setString(13, "Sequential"); |
| 6075 | |||
| 6076 | // Add the SubSurface to the list if any | ||
| 6077 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | auto subSurfaceHandleIt = shadingControlToSurfaceMap.find(object.getString(0).get()); |
| 6078 |
1/2✓ Branch 2 taken 1 time.
✗ Branch 3 not taken.
|
1 | if (subSurfaceHandleIt != shadingControlToSurfaceMap.end()) { |
| 6079 |
2/2✓ Branch 2 taken 1 time.
✓ Branch 5 taken 1 time.
|
2 | newObject.pushExtensibleGroup(StringVector(1u, subSurfaceHandleIt->second)); |
| 6080 | } | ||
| 6081 | |||
| 6082 |
1/1✓ Branch 1 taken 1 time.
|
1 | ss << newObject; |
| 6083 |
1/1✓ Branch 3 taken 1 time.
|
1 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 6084 | |||
| 6085 |
3/3✓ Branch 3 taken 8678 times.
✓ Branch 5 taken 141 times.
✓ Branch 6 taken 8537 times.
|
8679 | } else if (iddname == "OS:SubSurface") { |
| 6086 | |||
| 6087 |
1/1✓ Branch 1 taken 141 times.
|
141 | auto iddObject = idd_3_1_0.getObject(iddname); |
| 6088 |
2/2✓ Branch 1 taken 141 times.
✓ Branch 4 taken 141 times.
|
141 | IdfObject newObject(iddObject.get()); |
| 6089 | |||
| 6090 |
3/3✓ Branch 1 taken 3384 times.
✓ Branch 3 taken 3243 times.
✓ Branch 4 taken 141 times.
|
3384 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 6091 |
2/3✓ Branch 1 taken 3243 times.
✓ Branch 5 taken 3243 times.
✗ Branch 6 not taken.
|
6486 | if ((value = object.getString(i))) { |
| 6092 |
2/2✓ Branch 0 taken 987 times.
✓ Branch 1 taken 2256 times.
|
3243 | if (i < 7) { |
| 6093 |
2/2✓ Branch 1 taken 987 times.
✓ Branch 4 taken 987 times.
|
987 | newObject.setString(i, value.get()); |
| 6094 |
2/2✓ Branch 0 taken 2115 times.
✓ Branch 1 taken 141 times.
|
2256 | } else if (i == 7) { // Shading Control Name |
| 6095 | // no-op | ||
| 6096 | } else { | ||
| 6097 |
2/2✓ Branch 1 taken 2115 times.
✓ Branch 4 taken 2115 times.
|
2115 | newObject.setString(i - 1, value.get()); |
| 6098 | } | ||
| 6099 | } | ||
| 6100 | } | ||
| 6101 | |||
| 6102 |
1/1✓ Branch 1 taken 141 times.
|
141 | ss << newObject; |
| 6103 |
1/1✓ Branch 3 taken 141 times.
|
141 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 6104 | |||
| 6105 | // No-op | ||
| 6106 | 141 | } else { | |
| 6107 |
1/1✓ Branch 1 taken 8537 times.
|
8537 | ss << object; |
| 6108 | } | ||
| 6109 | 8935 | } | |
| 6110 | |||
| 6111 |
1/1✓ Branch 1 taken 38 times.
|
76 | return ss.str(); |
| 6112 | |||
| 6113 | 114 | } // end update_3_0_1_to_3_1_0 | |
| 6114 | |||
| 6115 | 50 | std::string VersionTranslator::update_3_1_0_to_3_2_0(const IdfFile& idf_3_1_0, const IddFileAndFactoryWrapper& idd_3_2_0) { | |
| 6116 |
1/1✓ Branch 1 taken 50 times.
|
50 | std::stringstream ss; |
| 6117 | 50 | boost::optional<std::string> value; | |
| 6118 | |||
| 6119 |
4/4✓ Branch 1 taken 50 times.
✓ Branch 4 taken 50 times.
✓ Branch 7 taken 50 times.
✓ Branch 10 taken 50 times.
|
50 | ss << idf_3_1_0.header() << '\n' << '\n'; |
| 6120 |
2/2✓ Branch 1 taken 50 times.
✓ Branch 4 taken 50 times.
|
50 | IdfFile targetIdf(idd_3_2_0.iddFile()); |
| 6121 |
3/3✓ Branch 1 taken 50 times.
✓ Branch 4 taken 50 times.
✓ Branch 7 taken 50 times.
|
50 | ss << targetIdf.versionObject().get(); |
| 6122 | |||
| 6123 | 8 | auto makeCurveQuadLinear = [&idd_3_2_0]() -> IdfObject { | |
| 6124 |
4/4✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
✓ Branch 7 taken 8 times.
✓ Branch 10 taken 8 times.
|
16 | auto quadLinearIddObject = idd_3_2_0.getObject("OS:Curve:QuadLinear").get(); |
| 6125 | |||
| 6126 |
1/1✓ Branch 1 taken 8 times.
|
8 | IdfObject curveQuadLinear(quadLinearIddObject); |
| 6127 | |||
| 6128 | 8 | int i = 7; | |
| 6129 |
1/1✓ Branch 1 taken 8 times.
|
8 | curveQuadLinear.setDouble(i++, -100.0); |
| 6130 |
1/1✓ Branch 1 taken 8 times.
|
8 | curveQuadLinear.setDouble(i++, 100.0); |
| 6131 |
1/1✓ Branch 1 taken 8 times.
|
8 | curveQuadLinear.setDouble(i++, -100.0); |
| 6132 |
1/1✓ Branch 1 taken 8 times.
|
8 | curveQuadLinear.setDouble(i++, 100.0); |
| 6133 |
1/1✓ Branch 1 taken 8 times.
|
8 | curveQuadLinear.setDouble(i++, 0.0); |
| 6134 |
1/1✓ Branch 1 taken 8 times.
|
8 | curveQuadLinear.setDouble(i++, 100.0); |
| 6135 |
1/1✓ Branch 1 taken 8 times.
|
8 | curveQuadLinear.setDouble(i++, 0.0); |
| 6136 |
1/1✓ Branch 1 taken 8 times.
|
8 | curveQuadLinear.setDouble(i++, 100.0); |
| 6137 | |||
| 6138 | 16 | return curveQuadLinear; | |
| 6139 | 8 | }; | |
| 6140 | |||
| 6141 | 1 | auto makeCurveQuintLinear = [&idd_3_2_0]() -> IdfObject { | |
| 6142 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
|
2 | auto quadLinearIddObject = idd_3_2_0.getObject("OS:Curve:QuintLinear").get(); |
| 6143 | |||
| 6144 |
1/1✓ Branch 1 taken 1 time.
|
1 | IdfObject curveQuintLinear(quadLinearIddObject); |
| 6145 | |||
| 6146 | 1 | int i = 8; | |
| 6147 |
1/1✓ Branch 1 taken 1 time.
|
1 | curveQuintLinear.setDouble(i++, -100.0); |
| 6148 |
1/1✓ Branch 1 taken 1 time.
|
1 | curveQuintLinear.setDouble(i++, 100.0); |
| 6149 |
1/1✓ Branch 1 taken 1 time.
|
1 | curveQuintLinear.setDouble(i++, -100.0); |
| 6150 |
1/1✓ Branch 1 taken 1 time.
|
1 | curveQuintLinear.setDouble(i++, 100.0); |
| 6151 |
1/1✓ Branch 1 taken 1 time.
|
1 | curveQuintLinear.setDouble(i++, -100.0); |
| 6152 |
1/1✓ Branch 1 taken 1 time.
|
1 | curveQuintLinear.setDouble(i++, 100.0); |
| 6153 |
1/1✓ Branch 1 taken 1 time.
|
1 | curveQuintLinear.setDouble(i++, 0.0); |
| 6154 |
1/1✓ Branch 1 taken 1 time.
|
1 | curveQuintLinear.setDouble(i++, 100.0); |
| 6155 |
1/1✓ Branch 1 taken 1 time.
|
1 | curveQuintLinear.setDouble(i++, 0.0); |
| 6156 |
1/1✓ Branch 1 taken 1 time.
|
1 | curveQuintLinear.setDouble(i++, 100.0); |
| 6157 | |||
| 6158 | 2 | return curveQuintLinear; | |
| 6159 | 1 | }; | |
| 6160 | |||
| 6161 |
3/3✓ Branch 1 taken 50 times.
✓ Branch 8 taken 28940 times.
✓ Branch 9 taken 50 times.
|
28990 | for (IdfObject& object : idf_3_1_0.objects()) { |
| 6162 |
2/2✓ Branch 1 taken 28940 times.
✓ Branch 4 taken 28940 times.
|
28940 | auto iddname = object.iddObject().name(); |
| 6163 | |||
| 6164 |
8/8✓ Branch 1 taken 28940 times.
✓ Branch 3 taken 28938 times.
✓ Branch 4 taken 2 times.
✓ Branch 6 taken 28938 times.
✓ Branch 8 taken 2 times.
✓ Branch 9 taken 28936 times.
✓ Branch 10 taken 4 times.
✓ Branch 11 taken 28936 times.
|
28940 | if ((iddname == "OS:Coil:Heating:LowTemperatureRadiant:VariableFlow") || (iddname == "OS:Coil:Cooling:LowTemperatureRadiant:VariableFlow")) { |
| 6165 | |||
| 6166 | // Inserted 4 fields at position 2 (0-indexed) | ||
| 6167 | // * Heating Design Capacity Method = 2 | ||
| 6168 | // * Heating Design Capacity = 3 | ||
| 6169 | // * Heating Design Capacity Per Floor Area = 4 | ||
| 6170 | // * Fraction of Autosized Heating Design Capacity = 5 | ||
| 6171 | |||
| 6172 |
1/1✓ Branch 1 taken 4 times.
|
4 | auto iddObject = idd_3_2_0.getObject(iddname); |
| 6173 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | IdfObject newObject(iddObject.get()); |
| 6174 | |||
| 6175 |
3/3✓ Branch 1 taken 34 times.
✓ Branch 3 taken 30 times.
✓ Branch 4 taken 4 times.
|
34 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 6176 |
2/3✓ Branch 1 taken 30 times.
✓ Branch 5 taken 30 times.
✗ Branch 6 not taken.
|
60 | if ((value = object.getString(i))) { |
| 6177 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 22 times.
|
30 | if (i < 2) { |
| 6178 |
2/2✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
|
8 | newObject.setString(i, value.get()); |
| 6179 | } else { | ||
| 6180 | // Every other is shifted by four fields | ||
| 6181 |
2/2✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
|
22 | newObject.setString(i + 4, value.get()); |
| 6182 | } | ||
| 6183 | } | ||
| 6184 | } | ||
| 6185 | |||
| 6186 | // Set new fields per IDD default, same as Model Ctor | ||
| 6187 |
3/3✓ Branch 1 taken 4 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 2 times.
|
4 | if (iddname == "OS:Coil:Heating:LowTemperatureRadiant:VariableFlow") { |
| 6188 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
4 | newObject.setString(2, "HeatingDesignCapacity"); |
| 6189 | } else { | ||
| 6190 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
4 | newObject.setString(2, "CoolingDesignCapacity"); |
| 6191 | } | ||
| 6192 | |||
| 6193 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | newObject.setString(3, "Autosize"); |
| 6194 |
1/1✓ Branch 1 taken 4 times.
|
4 | newObject.setDouble(4, 0.0); |
| 6195 |
1/1✓ Branch 1 taken 4 times.
|
4 | newObject.setDouble(5, 1.0); |
| 6196 | |||
| 6197 |
1/1✓ Branch 1 taken 4 times.
|
4 | ss << newObject; |
| 6198 |
1/1✓ Branch 3 taken 4 times.
|
4 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 6199 | |||
| 6200 |
8/8✓ Branch 3 taken 28936 times.
✓ Branch 5 taken 28222 times.
✓ Branch 6 taken 714 times.
✓ Branch 8 taken 28222 times.
✓ Branch 10 taken 801 times.
✓ Branch 11 taken 27421 times.
✓ Branch 12 taken 1515 times.
✓ Branch 13 taken 27421 times.
|
28940 | } else if ((iddname == "OS:Connection") || (iddname == "OS:PortList")) { |
| 6201 | // Deleted the 'Name' field | ||
| 6202 |
1/1✓ Branch 1 taken 1515 times.
|
1515 | auto iddObject = idd_3_2_0.getObject(iddname); |
| 6203 |
2/2✓ Branch 1 taken 1515 times.
✓ Branch 4 taken 1515 times.
|
1515 | IdfObject newObject(iddObject.get()); |
| 6204 |
3/3✓ Branch 1 taken 8413 times.
✓ Branch 3 taken 6898 times.
✓ Branch 4 taken 1515 times.
|
8413 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 6205 |
2/3✓ Branch 1 taken 6898 times.
✓ Branch 5 taken 6898 times.
✗ Branch 6 not taken.
|
13796 | if ((value = object.getString(i))) { |
| 6206 |
2/2✓ Branch 0 taken 1515 times.
✓ Branch 1 taken 5383 times.
|
6898 | if (i < 1) { |
| 6207 |
2/2✓ Branch 1 taken 1515 times.
✓ Branch 4 taken 1515 times.
|
1515 | newObject.setString(i, value.get()); |
| 6208 |
2/2✓ Branch 0 taken 3868 times.
✓ Branch 1 taken 1515 times.
|
5383 | } else if (i == 1) { |
| 6209 | // Deleted the name: no-op | ||
| 6210 | } else { | ||
| 6211 |
2/2✓ Branch 1 taken 3868 times.
✓ Branch 4 taken 3868 times.
|
3868 | newObject.setString(i - 1, value.get()); |
| 6212 | } | ||
| 6213 | } | ||
| 6214 | } | ||
| 6215 | |||
| 6216 |
1/1✓ Branch 1 taken 1515 times.
|
1515 | ss << newObject; |
| 6217 |
1/1✓ Branch 3 taken 1515 times.
|
1515 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 6218 | |||
| 6219 |
3/3✓ Branch 3 taken 27421 times.
✓ Branch 5 taken 1 time.
✓ Branch 6 taken 27420 times.
|
28936 | } else if (iddname == "OS:Construction:AirBoundary") { |
| 6220 | |||
| 6221 | // Removed 2 fields at positions 2 and 3 (0-indexed) | ||
| 6222 | // * Solar and Daylighting Method = 2 | ||
| 6223 | // * Radiant Exchange Method = 3 | ||
| 6224 | |||
| 6225 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto iddObject = idd_3_2_0.getObject(iddname); |
| 6226 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfObject newObject(iddObject.get()); |
| 6227 | |||
| 6228 |
3/3✓ Branch 1 taken 7 times.
✓ Branch 3 taken 6 times.
✓ Branch 4 taken 1 time.
|
7 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 6229 |
2/3✓ Branch 1 taken 6 times.
✓ Branch 5 taken 6 times.
✗ Branch 6 not taken.
|
12 | if ((value = object.getString(i))) { |
| 6230 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 4 times.
|
6 | if (i < 2) { |
| 6231 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | newObject.setString(i, value.get()); |
| 6232 |
4/4✓ Branch 0 taken 3 times.
✓ Branch 1 taken 1 time.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 1 time.
|
4 | } else if (i == 2 || i == 3) { |
| 6233 | // No-op | ||
| 6234 | } else { | ||
| 6235 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | newObject.setString(i - 2, value.get()); |
| 6236 | } | ||
| 6237 | } | ||
| 6238 | } | ||
| 6239 | |||
| 6240 |
1/1✓ Branch 1 taken 1 time.
|
1 | ss << newObject; |
| 6241 |
1/1✓ Branch 3 taken 1 time.
|
1 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 6242 | |||
| 6243 |
3/3✓ Branch 3 taken 27420 times.
✓ Branch 5 taken 1 time.
✓ Branch 6 taken 27419 times.
|
27421 | } else if (iddname == "OS:ZoneAirMassFlowConservation") { |
| 6244 | |||
| 6245 | // Field 1 (0-index) 'Yes' becomes 'AdjustMixingOnly' and 'No' becomes 'None' | ||
| 6246 | |||
| 6247 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto iddObject = idd_3_2_0.getObject(iddname); |
| 6248 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfObject newObject(iddObject.get()); |
| 6249 | |||
| 6250 |
3/3✓ Branch 1 taken 5 times.
✓ Branch 3 taken 4 times.
✓ Branch 4 taken 1 time.
|
5 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 6251 |
2/3✓ Branch 1 taken 4 times.
✓ Branch 5 taken 4 times.
✗ Branch 6 not taken.
|
8 | if ((value = object.getString(i))) { |
| 6252 |
2/2✓ Branch 0 taken 1 time.
✓ Branch 1 taken 3 times.
|
4 | if (i == 1) { |
| 6253 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | std::string cur_choice = value.get(); |
| 6254 |
3/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✗ Branch 8 not taken.
|
2 | if (openstudio::istringEqual("Yes", cur_choice)) { |
| 6255 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | newObject.setString(i, "AdjustMixingOnly"); |
| 6256 | ✗ | } else if (openstudio::istringEqual("No", cur_choice)) { | |
| 6257 | ✗ | newObject.setString(i, "None"); | |
| 6258 | } | ||
| 6259 | 1 | } else { | |
| 6260 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | newObject.setString(i, value.get()); |
| 6261 | } | ||
| 6262 | } | ||
| 6263 | } | ||
| 6264 | |||
| 6265 |
1/1✓ Branch 1 taken 1 time.
|
1 | ss << newObject; |
| 6266 |
1/1✓ Branch 3 taken 1 time.
|
1 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 6267 | |||
| 6268 |
3/3✓ Branch 3 taken 27419 times.
✓ Branch 5 taken 1 time.
✓ Branch 6 taken 27418 times.
|
27420 | } else if (iddname == "OS:ZoneHVAC:TerminalUnit:VariableRefrigerantFlow") { |
| 6269 | |||
| 6270 | // Field 13 (0-index) 'Supply Air Fan Placement' is now defaulted inside the Ctor | ||
| 6271 | |||
| 6272 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto iddObject = idd_3_2_0.getObject(iddname); |
| 6273 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfObject newObject(iddObject.get()); |
| 6274 | |||
| 6275 |
3/3✓ Branch 1 taken 27 times.
✓ Branch 3 taken 26 times.
✓ Branch 4 taken 1 time.
|
27 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 6276 |
2/3✓ Branch 1 taken 26 times.
✓ Branch 5 taken 26 times.
✗ Branch 6 not taken.
|
52 | if ((value = object.getString(i))) { |
| 6277 |
2/2✓ Branch 1 taken 26 times.
✓ Branch 4 taken 26 times.
|
26 | newObject.setString(i, value.get()); |
| 6278 | } | ||
| 6279 | } | ||
| 6280 | |||
| 6281 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | newObject.setString(13, "DrawThrough"); |
| 6282 | |||
| 6283 |
1/1✓ Branch 1 taken 1 time.
|
1 | ss << newObject; |
| 6284 |
1/1✓ Branch 3 taken 1 time.
|
1 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 6285 | |||
| 6286 |
3/3✓ Branch 3 taken 27418 times.
✓ Branch 5 taken 1 time.
✓ Branch 6 taken 27417 times.
|
27419 | } else if (iddname == "OS:Coil:Cooling:WaterToAirHeatPump:EquationFit") { |
| 6287 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto iddObject = idd_3_2_0.getObject(iddname); |
| 6288 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfObject newObject(iddObject.get()); |
| 6289 | |||
| 6290 | // Fields that have been removed from 3.1.0 to 3.2.0: | ||
| 6291 | // -------------------------------------------------- | ||
| 6292 | // * Total Cooling Capacity Coefficient 1 * 11 | ||
| 6293 | // * Total Cooling Capacity Coefficient 2 * 12 | ||
| 6294 | // * Total Cooling Capacity Coefficient 3 * 13 | ||
| 6295 | // * Total Cooling Capacity Coefficient 4 * 14 | ||
| 6296 | // * Total Cooling Capacity Coefficient 5 * 15 | ||
| 6297 | // * Sensible Cooling Capacity Coefficient 1 * 16 | ||
| 6298 | // * Sensible Cooling Capacity Coefficient 2 * 17 | ||
| 6299 | // * Sensible Cooling Capacity Coefficient 3 * 18 | ||
| 6300 | // * Sensible Cooling Capacity Coefficient 4 * 19 | ||
| 6301 | // * Sensible Cooling Capacity Coefficient 5 * 20 | ||
| 6302 | // * Sensible Cooling Capacity Coefficient 6 * 21 | ||
| 6303 | // * Cooling Power Consumption Coefficient 1 * 22 | ||
| 6304 | // * Cooling Power Consumption Coefficient 2 * 23 | ||
| 6305 | // * Cooling Power Consumption Coefficient 3 * 24 | ||
| 6306 | // * Cooling Power Consumption Coefficient 4 * 25 | ||
| 6307 | // * Cooling Power Consumption Coefficient 5 * 26 | ||
| 6308 | // | ||
| 6309 | // Fields that have been added from 3.1.0 to 3.2.0: | ||
| 6310 | // ------------------------------------------------ | ||
| 6311 | // * Total Cooling Capacity Curve Name * 11 | ||
| 6312 | // * Sensible Cooling Capacity Curve Name * 12 | ||
| 6313 | // * Cooling Power Consumption Curve Name * 13 | ||
| 6314 | // | ||
| 6315 | // Fields with changed indices from 3.1.0 to 3.2.0: | ||
| 6316 | // ------------------------------------------------ | ||
| 6317 | // * Nominal Time for Condensate Removal to Begin - 27 => 14 | ||
| 6318 | // * Ratio of Initial Moisture Evaporation Rate and Steady State Latent Capacity - 28 => 15 | ||
| 6319 | |||
| 6320 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
|
2 | auto quadLinearIddObject = idd_3_2_0.getObject("OS:Curve:QuadLinear").get(); |
| 6321 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
|
1 | auto quintLinearIddObject = idd_3_2_0.getObject("OS:Curve:QuadLinear").get(); |
| 6322 | |||
| 6323 |
1/1✓ Branch 1 taken 1 time.
|
1 | IdfObject totalCoolingCapacityCurve = makeCurveQuadLinear(); |
| 6324 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | totalCoolingCapacityCurve.setName(object.nameString() + " TotCoolCapCurve"); |
| 6325 | |||
| 6326 |
1/1✓ Branch 1 taken 1 time.
|
1 | IdfObject sensibleCoolingCapacityCurve = makeCurveQuintLinear(); |
| 6327 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | sensibleCoolingCapacityCurve.setName(object.nameString() + " SensCoolCapCurve"); |
| 6328 | |||
| 6329 |
1/1✓ Branch 1 taken 1 time.
|
1 | IdfObject coolingPowerConsumptionCurve = makeCurveQuadLinear(); |
| 6330 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | coolingPowerConsumptionCurve.setName(object.nameString() + " CoolPowCurve"); |
| 6331 | |||
| 6332 |
3/3✓ Branch 1 taken 30 times.
✓ Branch 3 taken 29 times.
✓ Branch 4 taken 1 time.
|
30 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 6333 |
2/3✓ Branch 1 taken 29 times.
✓ Branch 5 taken 29 times.
✗ Branch 6 not taken.
|
58 | if ((value = object.getString(i))) { |
| 6334 |
2/2✓ Branch 0 taken 11 times.
✓ Branch 1 taken 18 times.
|
29 | if (i < 11) { |
| 6335 |
2/2✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
|
11 | newObject.setString(i, value.get()); |
| 6336 |
2/2✓ Branch 0 taken 5 times.
✓ Branch 1 taken 13 times.
|
18 | } else if (i < 16) { |
| 6337 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | totalCoolingCapacityCurve.setString(i - 11 + 2, value.get()); |
| 6338 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 7 times.
|
13 | } else if (i < 22) { |
| 6339 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
6 | sensibleCoolingCapacityCurve.setString(i - 16 + 2, value.get()); |
| 6340 |
2/2✓ Branch 0 taken 5 times.
✓ Branch 1 taken 2 times.
|
7 | } else if (i < 27) { |
| 6341 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | coolingPowerConsumptionCurve.setString(i - 22 + 2, value.get()); |
| 6342 | } else { | ||
| 6343 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | newObject.setString(i - 13, value.get()); |
| 6344 | } | ||
| 6345 | } | ||
| 6346 | } | ||
| 6347 | |||
| 6348 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | newObject.setString(11, totalCoolingCapacityCurve.nameString()); |
| 6349 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | newObject.setString(12, sensibleCoolingCapacityCurve.nameString()); |
| 6350 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | newObject.setString(13, coolingPowerConsumptionCurve.nameString()); |
| 6351 | |||
| 6352 |
1/1✓ Branch 1 taken 1 time.
|
1 | ss << newObject; |
| 6353 |
1/1✓ Branch 3 taken 1 time.
|
1 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 6354 | |||
| 6355 | // Register new Curve objects | ||
| 6356 |
1/1✓ Branch 1 taken 1 time.
|
1 | ss << totalCoolingCapacityCurve; |
| 6357 |
1/1✓ Branch 1 taken 1 time.
|
1 | ss << sensibleCoolingCapacityCurve; |
| 6358 |
1/1✓ Branch 1 taken 1 time.
|
1 | ss << coolingPowerConsumptionCurve; |
| 6359 |
1/1✓ Branch 2 taken 1 time.
|
1 | m_new.emplace_back(std::move(totalCoolingCapacityCurve)); |
| 6360 |
1/1✓ Branch 2 taken 1 time.
|
1 | m_new.emplace_back(std::move(sensibleCoolingCapacityCurve)); |
| 6361 |
1/1✓ Branch 2 taken 1 time.
|
1 | m_new.emplace_back(std::move(coolingPowerConsumptionCurve)); |
| 6362 | |||
| 6363 |
3/3✓ Branch 8 taken 27417 times.
✓ Branch 10 taken 1 time.
✓ Branch 11 taken 27416 times.
|
27418 | } else if (iddname == "OS:Coil:Heating:WaterToAirHeatPump:EquationFit") { |
| 6364 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto iddObject = idd_3_2_0.getObject(iddname); |
| 6365 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfObject newObject(iddObject.get()); |
| 6366 | |||
| 6367 | // Fields that have been removed from 3.1.0 to 3.2.0: | ||
| 6368 | // -------------------------------------------------- | ||
| 6369 | // * Heating Capacity Coefficient 1 * 10 | ||
| 6370 | // * Heating Capacity Coefficient 2 * 11 | ||
| 6371 | // * Heating Capacity Coefficient 3 * 12 | ||
| 6372 | // * Heating Capacity Coefficient 4 * 13 | ||
| 6373 | // * Heating Capacity Coefficient 5 * 14 | ||
| 6374 | // * Heating Power Consumption Coefficient 1 * 15 | ||
| 6375 | // * Heating Power Consumption Coefficient 2 * 16 | ||
| 6376 | // * Heating Power Consumption Coefficient 3 * 17 | ||
| 6377 | // * Heating Power Consumption Coefficient 4 * 18 | ||
| 6378 | // * Heating Power Consumption Coefficient 5 * 19 | ||
| 6379 | // | ||
| 6380 | // Fields that have been added from 3.1.0 to 3.2.0: | ||
| 6381 | // ------------------------------------------------ | ||
| 6382 | // * Heating Capacity Curve Name * 10 | ||
| 6383 | // * Heating Power Consumption Curve Name * 11 | ||
| 6384 | |||
| 6385 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
|
1 | auto quadLinearIddObject = idd_3_2_0.getObject("OS:Curve:QuadLinear").get(); |
| 6386 | |||
| 6387 |
1/1✓ Branch 1 taken 1 time.
|
1 | IdfObject heatingCapacityCurve = makeCurveQuadLinear(); |
| 6388 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | heatingCapacityCurve.setName(object.nameString() + " HeatCapCurve"); |
| 6389 | |||
| 6390 |
1/1✓ Branch 1 taken 1 time.
|
1 | IdfObject heatingPowerConsumptionCurve = makeCurveQuadLinear(); |
| 6391 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | heatingPowerConsumptionCurve.setName(object.nameString() + " HeatPowCurve"); |
| 6392 | |||
| 6393 |
3/3✓ Branch 1 taken 21 times.
✓ Branch 3 taken 20 times.
✓ Branch 4 taken 1 time.
|
21 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 6394 |
2/3✓ Branch 1 taken 20 times.
✓ Branch 5 taken 20 times.
✗ Branch 6 not taken.
|
40 | if ((value = object.getString(i))) { |
| 6395 |
2/2✓ Branch 0 taken 10 times.
✓ Branch 1 taken 10 times.
|
20 | if (i < 10) { |
| 6396 |
2/2✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
|
10 | newObject.setString(i, value.get()); |
| 6397 |
2/2✓ Branch 0 taken 5 times.
✓ Branch 1 taken 5 times.
|
10 | } else if (i < 15) { |
| 6398 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | heatingCapacityCurve.setString(i - 10 + 2, value.get()); |
| 6399 | } else { | ||
| 6400 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | heatingPowerConsumptionCurve.setString(i - 15 + 2, value.get()); |
| 6401 | } | ||
| 6402 | } | ||
| 6403 | } | ||
| 6404 | |||
| 6405 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | newObject.setString(10, heatingCapacityCurve.nameString()); |
| 6406 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | newObject.setString(11, heatingPowerConsumptionCurve.nameString()); |
| 6407 | |||
| 6408 |
1/1✓ Branch 1 taken 1 time.
|
1 | ss << newObject; |
| 6409 |
1/1✓ Branch 3 taken 1 time.
|
1 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 6410 | |||
| 6411 | // Register new Curve objects | ||
| 6412 |
1/1✓ Branch 1 taken 1 time.
|
1 | ss << heatingCapacityCurve; |
| 6413 |
1/1✓ Branch 1 taken 1 time.
|
1 | ss << heatingPowerConsumptionCurve; |
| 6414 |
1/1✓ Branch 2 taken 1 time.
|
1 | m_new.emplace_back(std::move(heatingCapacityCurve)); |
| 6415 |
1/1✓ Branch 2 taken 1 time.
|
1 | m_new.emplace_back(std::move(heatingPowerConsumptionCurve)); |
| 6416 | |||
| 6417 |
3/3✓ Branch 6 taken 27416 times.
✓ Branch 8 taken 1 time.
✓ Branch 9 taken 27415 times.
|
27417 | } else if (iddname == "OS:HeatPump:WaterToWater:EquationFit:Cooling") { |
| 6418 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto iddObject = idd_3_2_0.getObject(iddname); |
| 6419 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfObject newObject(iddObject.get()); |
| 6420 | |||
| 6421 | // Fields that have been removed from 3.1.0 to 3.2.0: | ||
| 6422 | // -------------------------------------------------- | ||
| 6423 | // * Cooling Capacity Coefficient 1 * 10 | ||
| 6424 | // * Cooling Capacity Coefficient 2 * 11 | ||
| 6425 | // * Cooling Capacity Coefficient 3 * 12 | ||
| 6426 | // * Cooling Capacity Coefficient 4 * 13 | ||
| 6427 | // * Cooling Capacity Coefficient 5 * 14 | ||
| 6428 | // * Cooling Compressor Power Coefficient 1 * 15 | ||
| 6429 | // * Cooling Compressor Power Coefficient 2 * 16 | ||
| 6430 | // * Cooling Compressor Power Coefficient 3 * 17 | ||
| 6431 | // * Cooling Compressor Power Coefficient 4 * 18 | ||
| 6432 | // * Cooling Compressor Power Coefficient 5 * 19 | ||
| 6433 | // | ||
| 6434 | // Fields that have been added from 3.1.0 to 3.2.0: | ||
| 6435 | // ------------------------------------------------ | ||
| 6436 | // * Cooling Capacity Curve Name * 10 | ||
| 6437 | // * Cooling Compressor Power Curve Name * 11 | ||
| 6438 | // | ||
| 6439 | // Fields with changed indices from 3.1.0 to 3.2.0: | ||
| 6440 | // ------------------------------------------------ | ||
| 6441 | // * Reference Coefficient of Performance - 20 => 12 | ||
| 6442 | // * Sizing Factor - 21 => 13 | ||
| 6443 | // * Companion Heating Heat Pump Name - 22 => 14 | ||
| 6444 | |||
| 6445 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
|
1 | auto quadLinearIddObject = idd_3_2_0.getObject("OS:Curve:QuadLinear").get(); |
| 6446 | |||
| 6447 |
1/1✓ Branch 1 taken 1 time.
|
1 | IdfObject coolingCapacityCurve = makeCurveQuadLinear(); |
| 6448 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | coolingCapacityCurve.setName(object.nameString() + " CoolCapCurve"); |
| 6449 | |||
| 6450 |
1/1✓ Branch 1 taken 1 time.
|
1 | IdfObject coolingCompressorPowerCurve = makeCurveQuadLinear(); |
| 6451 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | coolingCompressorPowerCurve.setName(object.nameString() + " CoolCompPowerCurve"); |
| 6452 | |||
| 6453 |
3/3✓ Branch 1 taken 24 times.
✓ Branch 3 taken 23 times.
✓ Branch 4 taken 1 time.
|
24 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 6454 |
2/3✓ Branch 1 taken 23 times.
✓ Branch 5 taken 23 times.
✗ Branch 6 not taken.
|
46 | if ((value = object.getString(i))) { |
| 6455 |
2/2✓ Branch 0 taken 10 times.
✓ Branch 1 taken 13 times.
|
23 | if (i < 10) { |
| 6456 |
2/2✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
|
10 | newObject.setString(i, value.get()); |
| 6457 |
2/2✓ Branch 0 taken 5 times.
✓ Branch 1 taken 8 times.
|
13 | } else if (i < 15) { |
| 6458 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | coolingCapacityCurve.setString(i - 10 + 2, value.get()); |
| 6459 |
2/2✓ Branch 0 taken 5 times.
✓ Branch 1 taken 3 times.
|
8 | } else if (i < 20) { |
| 6460 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | coolingCompressorPowerCurve.setString(i - 15 + 2, value.get()); |
| 6461 | } else { | ||
| 6462 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | newObject.setString(i - 8, value.get()); |
| 6463 | } | ||
| 6464 | } | ||
| 6465 | } | ||
| 6466 | |||
| 6467 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | newObject.setString(10, coolingCapacityCurve.nameString()); |
| 6468 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | newObject.setString(11, coolingCompressorPowerCurve.nameString()); |
| 6469 | |||
| 6470 |
1/1✓ Branch 1 taken 1 time.
|
1 | ss << newObject; |
| 6471 |
1/1✓ Branch 3 taken 1 time.
|
1 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 6472 | |||
| 6473 | // Register new Curve objects | ||
| 6474 |
1/1✓ Branch 1 taken 1 time.
|
1 | ss << coolingCapacityCurve; |
| 6475 |
1/1✓ Branch 1 taken 1 time.
|
1 | ss << coolingCompressorPowerCurve; |
| 6476 |
1/1✓ Branch 2 taken 1 time.
|
1 | m_new.emplace_back(std::move(coolingCapacityCurve)); |
| 6477 |
1/1✓ Branch 2 taken 1 time.
|
1 | m_new.emplace_back(std::move(coolingCompressorPowerCurve)); |
| 6478 | |||
| 6479 |
3/3✓ Branch 6 taken 27415 times.
✓ Branch 8 taken 1 time.
✓ Branch 9 taken 27414 times.
|
27416 | } else if (iddname == "OS:HeatPump:WaterToWater:EquationFit:Heating") { |
| 6480 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto iddObject = idd_3_2_0.getObject(iddname); |
| 6481 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfObject newObject(iddObject.get()); |
| 6482 | |||
| 6483 | // Fields that have been removed from 3.1.0 to 3.2.0: | ||
| 6484 | // -------------------------------------------------- | ||
| 6485 | // * Heating Capacity Coefficient 1 * 10 | ||
| 6486 | // * Heating Capacity Coefficient 2 * 11 | ||
| 6487 | // * Heating Capacity Coefficient 3 * 12 | ||
| 6488 | // * Heating Capacity Coefficient 4 * 13 | ||
| 6489 | // * Heating Capacity Coefficient 5 * 14 | ||
| 6490 | // * Heating Compressor Power Coefficient 1 * 15 | ||
| 6491 | // * Heating Compressor Power Coefficient 2 * 16 | ||
| 6492 | // * Heating Compressor Power Coefficient 3 * 17 | ||
| 6493 | // * Heating Compressor Power Coefficient 4 * 18 | ||
| 6494 | // * Heating Compressor Power Coefficient 5 * 19 | ||
| 6495 | // | ||
| 6496 | // Fields that have been added from 3.1.0 to 3.2.0: | ||
| 6497 | // ------------------------------------------------ | ||
| 6498 | // * Heating Capacity Curve Name * 10 | ||
| 6499 | // * Heating Compressor Power Curve Name * 11 | ||
| 6500 | // | ||
| 6501 | // Fields with changed indices from 3.1.0 to 3.2.0: | ||
| 6502 | // ------------------------------------------------ | ||
| 6503 | // * Reference Coefficient of Performance - 20 => 12 | ||
| 6504 | // * Sizing Factor - 21 => 13 | ||
| 6505 | // * Companion Cooling Heat Pump Name - 22 => 14 | ||
| 6506 | |||
| 6507 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
|
1 | auto quadLinearIddObject = idd_3_2_0.getObject("OS:Curve:QuadLinear").get(); |
| 6508 | |||
| 6509 |
1/1✓ Branch 1 taken 1 time.
|
1 | IdfObject heatingCapacityCurve = makeCurveQuadLinear(); |
| 6510 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | heatingCapacityCurve.setName(object.nameString() + " HeatCapCurve"); |
| 6511 | |||
| 6512 |
1/1✓ Branch 1 taken 1 time.
|
1 | IdfObject heatingCompressorPowerCurve = makeCurveQuadLinear(); |
| 6513 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | heatingCompressorPowerCurve.setName(object.nameString() + " HeatCompPowerCurve"); |
| 6514 | |||
| 6515 |
3/3✓ Branch 1 taken 24 times.
✓ Branch 3 taken 23 times.
✓ Branch 4 taken 1 time.
|
24 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 6516 |
2/3✓ Branch 1 taken 23 times.
✓ Branch 5 taken 23 times.
✗ Branch 6 not taken.
|
46 | if ((value = object.getString(i))) { |
| 6517 |
2/2✓ Branch 0 taken 10 times.
✓ Branch 1 taken 13 times.
|
23 | if (i < 10) { |
| 6518 |
2/2✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
|
10 | newObject.setString(i, value.get()); |
| 6519 |
2/2✓ Branch 0 taken 5 times.
✓ Branch 1 taken 8 times.
|
13 | } else if (i < 15) { |
| 6520 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | heatingCapacityCurve.setString(i - 10 + 2, value.get()); |
| 6521 |
2/2✓ Branch 0 taken 5 times.
✓ Branch 1 taken 3 times.
|
8 | } else if (i < 20) { |
| 6522 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | heatingCompressorPowerCurve.setString(i - 15 + 2, value.get()); |
| 6523 | } else { | ||
| 6524 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | newObject.setString(i - 8, value.get()); |
| 6525 | } | ||
| 6526 | } | ||
| 6527 | } | ||
| 6528 | |||
| 6529 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | newObject.setString(10, heatingCapacityCurve.nameString()); |
| 6530 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | newObject.setString(11, heatingCompressorPowerCurve.nameString()); |
| 6531 | |||
| 6532 |
1/1✓ Branch 1 taken 1 time.
|
1 | ss << newObject; |
| 6533 |
1/1✓ Branch 3 taken 1 time.
|
1 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 6534 | |||
| 6535 | // Register new Curve objects | ||
| 6536 |
1/1✓ Branch 1 taken 1 time.
|
1 | ss << heatingCapacityCurve; |
| 6537 |
1/1✓ Branch 1 taken 1 time.
|
1 | ss << heatingCompressorPowerCurve; |
| 6538 |
1/1✓ Branch 2 taken 1 time.
|
1 | m_new.emplace_back(std::move(heatingCapacityCurve)); |
| 6539 |
1/1✓ Branch 2 taken 1 time.
|
1 | m_new.emplace_back(std::move(heatingCompressorPowerCurve)); |
| 6540 | |||
| 6541 | // No-op | ||
| 6542 | 1 | } else { | |
| 6543 |
1/1✓ Branch 1 taken 27414 times.
|
27414 | ss << object; |
| 6544 | } | ||
| 6545 | 28990 | } | |
| 6546 | |||
| 6547 |
1/1✓ Branch 1 taken 50 times.
|
100 | return ss.str(); |
| 6548 | |||
| 6549 | 50 | } // end update_3_1_0_to_3_2_0 | |
| 6550 | |||
| 6551 | 51 | std::string VersionTranslator::update_3_2_0_to_3_2_1(const IdfFile& idf_3_2_0, const IddFileAndFactoryWrapper& idd_3_2_1) { | |
| 6552 |
1/1✓ Branch 1 taken 51 times.
|
51 | std::stringstream ss; |
| 6553 | 51 | boost::optional<std::string> value; | |
| 6554 | |||
| 6555 |
4/4✓ Branch 1 taken 51 times.
✓ Branch 4 taken 51 times.
✓ Branch 7 taken 51 times.
✓ Branch 10 taken 51 times.
|
51 | ss << idf_3_2_0.header() << '\n' << '\n'; |
| 6556 |
2/2✓ Branch 1 taken 51 times.
✓ Branch 4 taken 51 times.
|
51 | IdfFile targetIdf(idd_3_2_1.iddFile()); |
| 6557 |
3/3✓ Branch 1 taken 51 times.
✓ Branch 4 taken 51 times.
✓ Branch 7 taken 51 times.
|
51 | ss << targetIdf.versionObject().get(); |
| 6558 | |||
| 6559 |
3/3✓ Branch 1 taken 51 times.
✓ Branch 8 taken 28962 times.
✓ Branch 9 taken 51 times.
|
29013 | for (const IdfObject& object : idf_3_2_0.objects()) { |
| 6560 |
2/2✓ Branch 1 taken 28962 times.
✓ Branch 4 taken 28962 times.
|
28962 | auto iddname = object.iddObject().name(); |
| 6561 | |||
| 6562 |
8/8✓ Branch 1 taken 28962 times.
✓ Branch 3 taken 28949 times.
✓ Branch 4 taken 13 times.
✓ Branch 6 taken 28949 times.
✓ Branch 8 taken 2 times.
✓ Branch 9 taken 28947 times.
✓ Branch 10 taken 15 times.
✓ Branch 11 taken 28947 times.
|
28962 | if ((iddname == "OS:WaterHeater:Mixed") || (iddname == "OS:WaterHeater:Stratified")) { |
| 6563 | |||
| 6564 | // Object is unchanged | ||
| 6565 |
1/1✓ Branch 1 taken 15 times.
|
15 | ss << object; |
| 6566 | |||
| 6567 | // But we also add a WaterHeater:Sizing object | ||
| 6568 |
2/2✓ Branch 1 taken 15 times.
✓ Branch 4 taken 15 times.
|
15 | auto iddObject = idd_3_2_1.getObject("OS:WaterHeater:Sizing"); |
| 6569 |
2/2✓ Branch 1 taken 15 times.
✓ Branch 4 taken 15 times.
|
15 | IdfObject newObject(iddObject.get()); |
| 6570 | |||
| 6571 | // WaterHeaterName | ||
| 6572 |
3/3✓ Branch 1 taken 15 times.
✓ Branch 4 taken 15 times.
✓ Branch 7 taken 15 times.
|
15 | newObject.setString(1, toString(object.handle())); |
| 6573 | // Design Mode | ||
| 6574 |
2/2✓ Branch 1 taken 15 times.
✓ Branch 4 taken 15 times.
|
15 | newObject.setString(2, "PeakDraw"); |
| 6575 | // Time Storage Can Meet Peak Draw {hr} | ||
| 6576 |
1/1✓ Branch 1 taken 15 times.
|
15 | newObject.setDouble(3, 0.538503); |
| 6577 | // Time for Tank Recovery {hr} | ||
| 6578 |
1/1✓ Branch 1 taken 15 times.
|
15 | newObject.setDouble(4, 0.0); |
| 6579 | // Nominal Tank Volume for Autosizing Plant Connections {m3} | ||
| 6580 |
1/1✓ Branch 1 taken 15 times.
|
15 | newObject.setDouble(5, 1.0); |
| 6581 | |||
| 6582 | // Register new WaterHeater:Sizing objects | ||
| 6583 |
1/1✓ Branch 1 taken 15 times.
|
15 | ss << newObject; |
| 6584 |
1/1✓ Branch 2 taken 15 times.
|
15 | m_new.emplace_back(std::move(newObject)); |
| 6585 | |||
| 6586 | // No-op | ||
| 6587 | 15 | } else { | |
| 6588 |
1/1✓ Branch 1 taken 28947 times.
|
28947 | ss << object; |
| 6589 | } | ||
| 6590 | 29013 | } | |
| 6591 | |||
| 6592 |
1/1✓ Branch 1 taken 51 times.
|
102 | return ss.str(); |
| 6593 | |||
| 6594 | 51 | } // end update_3_2_0_to_3_2_1 | |
| 6595 | |||
| 6596 | 57 | std::string VersionTranslator::update_3_2_1_to_3_3_0(const IdfFile& idf_3_2_1, const IddFileAndFactoryWrapper& idd_3_3_0) { | |
| 6597 |
1/1✓ Branch 1 taken 57 times.
|
57 | std::stringstream ss; |
| 6598 | 57 | boost::optional<std::string> value; | |
| 6599 | |||
| 6600 |
4/4✓ Branch 1 taken 57 times.
✓ Branch 4 taken 57 times.
✓ Branch 7 taken 57 times.
✓ Branch 10 taken 57 times.
|
57 | ss << idf_3_2_1.header() << '\n' << '\n'; |
| 6601 |
2/2✓ Branch 1 taken 57 times.
✓ Branch 4 taken 57 times.
|
57 | IdfFile targetIdf(idd_3_3_0.iddFile()); |
| 6602 |
3/3✓ Branch 1 taken 57 times.
✓ Branch 4 taken 57 times.
✓ Branch 7 taken 57 times.
|
57 | ss << targetIdf.versionObject().get(); |
| 6603 | |||
| 6604 |
3/3✓ Branch 1 taken 57 times.
✓ Branch 8 taken 29733 times.
✓ Branch 9 taken 57 times.
|
29790 | for (IdfObject& object : idf_3_2_1.objects()) { |
| 6605 |
2/2✓ Branch 1 taken 29733 times.
✓ Branch 4 taken 29733 times.
|
29733 | auto iddname = object.iddObject().name(); |
| 6606 | |||
| 6607 |
3/3✓ Branch 1 taken 29733 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 29732 times.
|
29733 | if (iddname == "OS:AirTerminal:SingleDuct:InletSideMixer") { |
| 6608 | |||
| 6609 | // Fields that have been added from 3.2.1 to 3.3.0: | ||
| 6610 | // ------------------------------------------------ | ||
| 6611 | // * Control For Outdoor Air * 5 | ||
| 6612 | // * Per Person Ventilation Rate Mode * 6 | ||
| 6613 | |||
| 6614 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto iddObject = idd_3_3_0.getObject(iddname); |
| 6615 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfObject newObject(iddObject.get()); |
| 6616 | |||
| 6617 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 3 taken 5 times.
✓ Branch 4 taken 1 time.
|
6 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 6618 |
2/3✓ Branch 1 taken 5 times.
✓ Branch 5 taken 5 times.
✗ Branch 6 not taken.
|
10 | if ((value = object.getString(i))) { |
| 6619 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | newObject.setString(i, value.get()); |
| 6620 | } | ||
| 6621 | } | ||
| 6622 | |||
| 6623 | // Set new fields per IDD default, same as Model Ctor, since it was made required-field | ||
| 6624 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | newObject.setString(5, "Yes"); |
| 6625 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | newObject.setString(6, "CurrentOccupancy"); |
| 6626 | |||
| 6627 |
1/1✓ Branch 1 taken 1 time.
|
1 | ss << newObject; |
| 6628 |
1/1✓ Branch 3 taken 1 time.
|
1 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 6629 | |||
| 6630 |
3/3✓ Branch 3 taken 29732 times.
✓ Branch 5 taken 1 time.
✓ Branch 6 taken 29731 times.
|
29733 | } else if (iddname == "OS:GroundHeatExchanger:Vertical") { |
| 6631 | |||
| 6632 | // Removed 1 fields at position 11 (0-indexed) | ||
| 6633 | // * Design Flow Rate = 11 | ||
| 6634 | // I moved it to the field 4, previously maximumFlowRate. I'm discarding the previous Design Flow Rate version as that's what the comments in | ||
| 6635 | // GroundHeatExchangerVertical.hpp were saying (maximumFlowRate was used instead of designFlowRate which was unused...) | ||
| 6636 | |||
| 6637 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto iddObject = idd_3_3_0.getObject(iddname); |
| 6638 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfObject newObject(iddObject.get()); |
| 6639 | |||
| 6640 |
3/3✓ Branch 1 taken 90 times.
✓ Branch 3 taken 89 times.
✓ Branch 4 taken 1 time.
|
90 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 6641 |
2/3✓ Branch 1 taken 89 times.
✓ Branch 5 taken 89 times.
✗ Branch 6 not taken.
|
178 | if ((value = object.getString(i))) { |
| 6642 |
2/2✓ Branch 0 taken 11 times.
✓ Branch 1 taken 78 times.
|
89 | if (i < 11) { |
| 6643 |
2/2✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
|
11 | newObject.setString(i, value.get()); |
| 6644 |
2/2✓ Branch 0 taken 77 times.
✓ Branch 1 taken 1 time.
|
78 | } else if (i == 11) { |
| 6645 | // No-op | ||
| 6646 | } else { | ||
| 6647 |
2/2✓ Branch 1 taken 77 times.
✓ Branch 4 taken 77 times.
|
77 | newObject.setString(i - 1, value.get()); |
| 6648 | } | ||
| 6649 | } | ||
| 6650 | } | ||
| 6651 | |||
| 6652 |
1/1✓ Branch 1 taken 1 time.
|
1 | ss << newObject; |
| 6653 |
1/1✓ Branch 3 taken 1 time.
|
1 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 6654 | |||
| 6655 |
8/8✓ Branch 3 taken 29731 times.
✓ Branch 5 taken 29717 times.
✓ Branch 6 taken 14 times.
✓ Branch 8 taken 29717 times.
✓ Branch 10 taken 17 times.
✓ Branch 11 taken 29700 times.
✓ Branch 12 taken 31 times.
✓ Branch 13 taken 29700 times.
|
29732 | } else if ((iddname == "OS:Controller:MechanicalVentilation") || (iddname == "OS:Sizing:System")) { |
| 6656 | |||
| 6657 | // OS:Controller:MechanicalVentilation, Field 4: VentilationRateProcedure -> Standard62.1VentilationRateProcedure | ||
| 6658 | // OS:Sizing:System, Field 20: VentilationRateProcedure -> Standard62.1VentilationRateProcedure | ||
| 6659 | 31 | unsigned int changedIndex = 4; | |
| 6660 |
3/3✓ Branch 1 taken 31 times.
✓ Branch 3 taken 17 times.
✓ Branch 4 taken 14 times.
|
31 | if (iddname == "OS:Sizing:System") { |
| 6661 | 17 | changedIndex = 20; | |
| 6662 | } | ||
| 6663 |
1/1✓ Branch 1 taken 31 times.
|
31 | value = object.getString(changedIndex, false, true); |
| 6664 |
10/17✓ Branch 1 taken 31 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 31 times.
✓ Branch 7 taken 31 times.
✓ Branch 10 taken 31 times.
✓ Branch 12 taken 2 times.
✓ Branch 13 taken 29 times.
✓ Branch 14 taken 31 times.
✗ Branch 15 not taken.
✓ Branch 17 taken 31 times.
✗ Branch 18 not taken.
✓ Branch 19 taken 2 times.
✓ Branch 20 taken 29 times.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
|
124 | if (value && openstudio::istringEqual(value.get(), "VentilationRateProcedure")) { |
| 6665 | |||
| 6666 |
1/1✓ Branch 1 taken 2 times.
|
2 | auto iddObject = idd_3_3_0.getObject(iddname); |
| 6667 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | IdfObject newObject(iddObject.get()); |
| 6668 | |||
| 6669 |
3/3✓ Branch 1 taken 45 times.
✓ Branch 3 taken 43 times.
✓ Branch 4 taken 2 times.
|
45 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 6670 |
2/3✓ Branch 1 taken 43 times.
✓ Branch 5 taken 43 times.
✗ Branch 6 not taken.
|
86 | if ((value = object.getString(i))) { |
| 6671 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 41 times.
|
43 | if (i == changedIndex) { |
| 6672 | // System Outdoor Air Method | ||
| 6673 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
4 | newObject.setString(i, "Standard62.1VentilationRateProcedure"); |
| 6674 | } else { | ||
| 6675 |
2/2✓ Branch 1 taken 41 times.
✓ Branch 4 taken 41 times.
|
41 | newObject.setString(i, value.get()); |
| 6676 | } | ||
| 6677 | } | ||
| 6678 | } | ||
| 6679 | |||
| 6680 |
1/1✓ Branch 1 taken 2 times.
|
2 | ss << newObject; |
| 6681 |
1/1✓ Branch 3 taken 2 times.
|
2 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 6682 | |||
| 6683 | 2 | } else { | |
| 6684 | // Nothing to do since there's no rename to perform | ||
| 6685 |
1/1✓ Branch 1 taken 29 times.
|
29 | ss << object; |
| 6686 | } | ||
| 6687 | |||
| 6688 |
3/3✓ Branch 1 taken 29700 times.
✓ Branch 3 taken 90 times.
✓ Branch 4 taken 29610 times.
|
29700 | } else if (iddname == "OS:SizingPeriod:DesignDay") { |
| 6689 | |||
| 6690 |
1/1✓ Branch 1 taken 90 times.
|
90 | auto iddObject = idd_3_3_0.getObject(iddname); |
| 6691 |
2/2✓ Branch 1 taken 90 times.
✓ Branch 4 taken 90 times.
|
90 | IdfObject newObject(iddObject.get()); |
| 6692 | |||
| 6693 | 90 | std::string humidityIndicatingType; | |
| 6694 | |||
| 6695 |
3/3✓ Branch 1 taken 2070 times.
✓ Branch 3 taken 1980 times.
✓ Branch 4 taken 90 times.
|
2070 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 6696 |
2/3✓ Branch 1 taken 1980 times.
✓ Branch 5 taken 1980 times.
✗ Branch 6 not taken.
|
3960 | if ((value = object.getString(i))) { |
| 6697 |
2/2✓ Branch 0 taken 360 times.
✓ Branch 1 taken 1620 times.
|
1980 | if (i < 4) { |
| 6698 |
2/2✓ Branch 1 taken 360 times.
✓ Branch 4 taken 360 times.
|
360 | newObject.setString(i, value.get()); |
| 6699 |
2/2✓ Branch 0 taken 90 times.
✓ Branch 1 taken 1530 times.
|
1620 | } else if (i == 4) { |
| 6700 |
3/3✓ Branch 1 taken 90 times.
✓ Branch 4 taken 90 times.
✓ Branch 7 taken 90 times.
|
90 | humidityIndicatingType = object.getString(15).get(); // Humidity Indicating Type |
| 6701 |
11/21✓ Branch 1 taken 90 times.
✓ Branch 4 taken 33 times.
✓ Branch 7 taken 33 times.
✓ Branch 9 taken 11 times.
✓ Branch 10 taken 22 times.
✓ Branch 12 taken 33 times.
✓ Branch 13 taken 57 times.
✓ Branch 14 taken 90 times.
✗ Branch 15 not taken.
✓ Branch 17 taken 90 times.
✗ Branch 18 not taken.
✓ Branch 19 taken 79 times.
✓ Branch 20 taken 11 times.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
|
336 | if (istringEqual(humidityIndicatingType, "WetBulb") || istringEqual(humidityIndicatingType, "DewPoint") |
| 6702 |
7/12✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
✓ Branch 6 taken 11 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 11 times.
✓ Branch 10 taken 79 times.
✓ Branch 11 taken 33 times.
✓ Branch 12 taken 57 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
|
112 | || istringEqual(humidityIndicatingType, "WetBulbProfileMultiplierSchedule") |
| 6703 |
7/12✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
✓ Branch 6 taken 11 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 11 times.
✓ Branch 10 taken 79 times.
✓ Branch 11 taken 11 times.
✓ Branch 12 taken 79 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
|
112 | || istringEqual(humidityIndicatingType, "WetBulbProfileDifferenceSchedule") |
| 6704 |
12/17✓ Branch 1 taken 90 times.
✓ Branch 3 taken 33 times.
✓ Branch 4 taken 57 times.
✓ Branch 6 taken 11 times.
✓ Branch 9 taken 11 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 11 times.
✓ Branch 13 taken 11 times.
✓ Branch 14 taken 79 times.
✓ Branch 16 taken 11 times.
✓ Branch 17 taken 79 times.
✓ Branch 18 taken 11 times.
✓ Branch 19 taken 79 times.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
|
224 | || istringEqual(humidityIndicatingType, "WetBulbProfileDefaultMultipliers")) { |
| 6705 |
2/2✓ Branch 1 taken 79 times.
✓ Branch 4 taken 79 times.
|
79 | newObject.setString(16, value.get()); // Wetbulb or DewPoint at Maximum Dry-Bulb |
| 6706 |
3/4✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 11 times.
|
22 | } else if (istringEqual(humidityIndicatingType, "HumidityRatio")) { |
| 6707 | ✗ | newObject.setString(17, value.get()); // Humidity Ratio at Maximum Dry-Bulb | |
| 6708 |
3/4✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
✓ Branch 7 taken 11 times.
✗ Branch 8 not taken.
|
22 | } else if (istringEqual(humidityIndicatingType, "Enthalpy")) { |
| 6709 |
2/2✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
|
11 | newObject.setString(18, value.get()); // Enthalpy at Maximum Dry-Bulb |
| 6710 | } | ||
| 6711 |
6/6✓ Branch 0 taken 1440 times.
✓ Branch 1 taken 90 times.
✓ Branch 2 taken 1350 times.
✓ Branch 3 taken 90 times.
✓ Branch 4 taken 90 times.
✓ Branch 5 taken 1260 times.
|
1530 | } else if (i == 9 || i == 10 || i == 14) { |
| 6712 |
4/4✓ Branch 1 taken 270 times.
✓ Branch 4 taken 270 times.
✓ Branch 6 taken 269 times.
✓ Branch 7 taken 1 time.
|
540 | if (value.get() == "0") { |
| 6713 |
2/2✓ Branch 1 taken 269 times.
✓ Branch 4 taken 269 times.
|
538 | newObject.setString(i - 1, "No"); |
| 6714 |
3/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 time.
|
1 | } else if (value.get() == "1") { |
| 6715 | ✗ | newObject.setString(i - 1, "Yes"); | |
| 6716 | } | ||
| 6717 |
2/2✓ Branch 0 taken 630 times.
✓ Branch 1 taken 630 times.
|
1260 | } else if (i < 15) { |
| 6718 |
2/2✓ Branch 1 taken 630 times.
✓ Branch 4 taken 630 times.
|
630 | newObject.setString(i - 1, value.get()); |
| 6719 |
2/2✓ Branch 0 taken 90 times.
✓ Branch 1 taken 540 times.
|
630 | } else if (i == 15) { |
| 6720 |
1/1✓ Branch 1 taken 90 times.
|
90 | newObject.setString(i - 1, humidityIndicatingType); |
| 6721 |
2/2✓ Branch 0 taken 90 times.
✓ Branch 1 taken 450 times.
|
540 | } else if (i == 16) { |
| 6722 |
2/2✓ Branch 1 taken 90 times.
✓ Branch 4 taken 90 times.
|
90 | newObject.setString(i - 1, value.get()); |
| 6723 |
1/2✓ Branch 0 taken 450 times.
✗ Branch 1 not taken.
|
450 | } else if (i < 25) { |
| 6724 |
2/2✓ Branch 1 taken 450 times.
✓ Branch 4 taken 450 times.
|
450 | newObject.setString(i + 2, value.get()); |
| 6725 | } | ||
| 6726 | } | ||
| 6727 | } | ||
| 6728 | |||
| 6729 |
1/1✓ Branch 1 taken 90 times.
|
90 | ss << newObject; |
| 6730 |
1/1✓ Branch 3 taken 90 times.
|
90 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 6731 | |||
| 6732 | // No-op | ||
| 6733 | 90 | } else { | |
| 6734 |
1/1✓ Branch 1 taken 29610 times.
|
29610 | ss << object; |
| 6735 | } | ||
| 6736 | 29790 | } | |
| 6737 | |||
| 6738 |
1/1✓ Branch 1 taken 57 times.
|
114 | return ss.str(); |
| 6739 | |||
| 6740 | 57 | } // end update_3_2_1_to_3_3_0 | |
| 6741 | |||
| 6742 | 71 | std::string VersionTranslator::update_3_3_0_to_3_4_0(const IdfFile& idf_3_3_0, const IddFileAndFactoryWrapper& idd_3_4_0) { | |
| 6743 |
1/1✓ Branch 1 taken 71 times.
|
71 | std::stringstream ss; |
| 6744 | 71 | boost::optional<std::string> value; | |
| 6745 | |||
| 6746 |
4/4✓ Branch 1 taken 71 times.
✓ Branch 4 taken 71 times.
✓ Branch 7 taken 71 times.
✓ Branch 10 taken 71 times.
|
71 | ss << idf_3_3_0.header() << '\n' << '\n'; |
| 6747 |
2/2✓ Branch 1 taken 71 times.
✓ Branch 4 taken 71 times.
|
71 | IdfFile targetIdf(idd_3_4_0.iddFile()); |
| 6748 |
3/3✓ Branch 1 taken 71 times.
✓ Branch 4 taken 71 times.
✓ Branch 7 taken 71 times.
|
71 | ss << targetIdf.versionObject().get(); |
| 6749 | |||
| 6750 |
3/3✓ Branch 1 taken 71 times.
✓ Branch 8 taken 61712 times.
✓ Branch 9 taken 71 times.
|
61783 | for (IdfObject& object : idf_3_3_0.objects()) { |
| 6751 |
2/2✓ Branch 1 taken 61712 times.
✓ Branch 4 taken 61712 times.
|
61712 | auto iddname = object.iddObject().name(); |
| 6752 | |||
| 6753 |
3/3✓ Branch 1 taken 61712 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 61710 times.
|
61712 | if (iddname == "OS:Coil:Heating:DX:MultiSpeed") { |
| 6754 | |||
| 6755 | // Stage Data List becomes extensible list (Stage 1, Stage 2, etc.) | ||
| 6756 | // ModelObjectList gets removed | ||
| 6757 | |||
| 6758 |
1/1✓ Branch 1 taken 2 times.
|
2 | auto iddObject = idd_3_4_0.getObject(iddname); |
| 6759 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | IdfObject newObject(iddObject.get()); |
| 6760 | |||
| 6761 |
2/2✓ Branch 0 taken 36 times.
✓ Branch 1 taken 2 times.
|
38 | for (size_t i = 0; i < 18; ++i) { |
| 6762 |
2/3✓ Branch 1 taken 36 times.
✓ Branch 5 taken 36 times.
✗ Branch 6 not taken.
|
72 | if ((value = object.getString(i))) { |
| 6763 |
2/2✓ Branch 1 taken 36 times.
✓ Branch 4 taken 36 times.
|
36 | newObject.setString(i, value.get()); |
| 6764 | } | ||
| 6765 | } | ||
| 6766 | |||
| 6767 | // Before: There was a single modelObjectList, which extensible groups were the StageDatas | ||
| 6768 | // Now: We move these directly onto extensible groups | ||
| 6769 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
|
2 | std::string stageDataList = object.getString(18).get(); // Stage Data List: handle of the ModelObjectList |
| 6770 |
3/4✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✗ Branch 8 not taken.
|
4 | if (boost::optional<IdfObject> modelObjectList = idf_3_3_0.getObject(openstudio::toUUID(stageDataList))) { |
| 6771 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | m_untranslated.push_back(modelObjectList.get()); // original OS:ModelObjectList |
| 6772 |
4/4✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 11 taken 4 times.
✓ Branch 12 taken 2 times.
|
6 | for (const IdfExtensibleGroup& eg : modelObjectList->extensibleGroups()) { |
| 6773 |
3/3✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
|
4 | std::string stageDataListHandleStr = eg.getString(0).get(); |
| 6774 |
1/2✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
|
4 | if (!stageDataListHandleStr.empty()) { |
| 6775 |
4/6✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✓ Branch 8 taken 4 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
|
12 | IdfExtensibleGroup new_eg = newObject.pushExtensibleGroup({stageDataListHandleStr}); // new OS:Coil:Heating:DX:MultiSpeed:StageData |
| 6776 | 4 | } | |
| 6777 | 6 | } | |
| 6778 | 2 | } | |
| 6779 | |||
| 6780 |
1/1✓ Branch 1 taken 2 times.
|
2 | ss << newObject; |
| 6781 |
1/1✓ Branch 3 taken 2 times.
|
2 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 6782 |
3/3✓ Branch 4 taken 61710 times.
✓ Branch 6 taken 4 times.
✓ Branch 7 taken 61706 times.
|
61712 | } else if (iddname == "OS:Coil:Heating:DX:MultiSpeed:StageData") { |
| 6783 |
1/1✓ Branch 1 taken 4 times.
|
4 | auto iddObject = idd_3_4_0.getObject(iddname); |
| 6784 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | IdfObject newObject(iddObject.get()); |
| 6785 | |||
| 6786 | // Inserted name at pos 1 | ||
| 6787 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | newObject.setString(1, "Coil Heating DX Multi Speed Stage Data"); |
| 6788 | |||
| 6789 |
3/3✓ Branch 1 taken 52 times.
✓ Branch 3 taken 48 times.
✓ Branch 4 taken 4 times.
|
52 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 6790 |
2/3✓ Branch 1 taken 48 times.
✓ Branch 5 taken 48 times.
✗ Branch 6 not taken.
|
96 | if ((value = object.getString(i))) { |
| 6791 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 44 times.
|
48 | if (i < 1) { |
| 6792 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | newObject.setString(i, value.get()); |
| 6793 | } else { | ||
| 6794 |
2/2✓ Branch 1 taken 44 times.
✓ Branch 4 taken 44 times.
|
44 | newObject.setString(i + 1, value.get()); |
| 6795 | } | ||
| 6796 | } | ||
| 6797 | } | ||
| 6798 | |||
| 6799 |
1/1✓ Branch 1 taken 4 times.
|
4 | ss << newObject; |
| 6800 |
1/1✓ Branch 3 taken 4 times.
|
4 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 6801 | |||
| 6802 |
3/3✓ Branch 3 taken 61706 times.
✓ Branch 5 taken 17 times.
✓ Branch 6 taken 61689 times.
|
61710 | } else if (iddname == "OS:ModelObjectList") { |
| 6803 | |||
| 6804 | 17 | bool isOnCoil = false; | |
| 6805 |
5/5✓ Branch 1 taken 17 times.
✓ Branch 4 taken 17 times.
✓ Branch 7 taken 17 times.
✓ Branch 10 taken 17 times.
✓ Branch 13 taken 17 times.
|
51 | std::vector<IdfObject> coils = idf_3_3_0.getObjectsByType(idf_3_3_0.iddFile().getObject("OS:Coil:Heating:DX:MultiSpeed").get()); |
| 6806 |
2/2✓ Branch 5 taken 4 times.
✓ Branch 6 taken 17 times.
|
21 | for (auto& coil : coils) { |
| 6807 |
6/6✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✓ Branch 10 taken 4 times.
✓ Branch 15 taken 2 times.
✓ Branch 16 taken 2 times.
|
4 | if (object.getString(0).get() == coil.getString(18).get()) { // Handle == Stage Data List |
| 6808 | 2 | isOnCoil = true; | |
| 6809 | } | ||
| 6810 | } | ||
| 6811 | |||
| 6812 |
2/2✓ Branch 0 taken 15 times.
✓ Branch 1 taken 2 times.
|
17 | if (!isOnCoil) { |
| 6813 |
1/1✓ Branch 1 taken 15 times.
|
15 | ss << object; |
| 6814 | } | ||
| 6815 | |||
| 6816 | // No-op | ||
| 6817 | 17 | } else { | |
| 6818 |
1/1✓ Branch 1 taken 61689 times.
|
61689 | ss << object; |
| 6819 | } | ||
| 6820 | 61783 | } | |
| 6821 | |||
| 6822 |
1/1✓ Branch 1 taken 71 times.
|
142 | return ss.str(); |
| 6823 | |||
| 6824 | 75 | } // end update_3_3_0_to_3_4_0 | |
| 6825 | |||
| 6826 | 86 | std::string VersionTranslator::update_3_4_0_to_3_5_0(const IdfFile& idf_3_4_0, const IddFileAndFactoryWrapper& idd_3_5_0) { | |
| 6827 |
1/1✓ Branch 1 taken 86 times.
|
86 | std::stringstream ss; |
| 6828 | 86 | boost::optional<std::string> value; | |
| 6829 | |||
| 6830 |
4/4✓ Branch 1 taken 86 times.
✓ Branch 4 taken 86 times.
✓ Branch 7 taken 86 times.
✓ Branch 10 taken 86 times.
|
86 | ss << idf_3_4_0.header() << '\n' << '\n'; |
| 6831 |
2/2✓ Branch 1 taken 86 times.
✓ Branch 4 taken 86 times.
|
86 | IdfFile targetIdf(idd_3_5_0.iddFile()); |
| 6832 |
3/3✓ Branch 1 taken 86 times.
✓ Branch 4 taken 86 times.
✓ Branch 7 taken 86 times.
|
86 | ss << targetIdf.versionObject().get(); |
| 6833 | |||
| 6834 | // ZoneHVAC:Packaged AirConditionner / HeatPump: prescan | ||
| 6835 | // In E+ 22.1.0, you could have a Packaged system with a Fan:ConstantVolume and a blank schedule for Supply Air Fan Operating Mode Schedule Name | ||
| 6836 | // and it would behave like a cycling fan (which it shouldn't have done). This is now disallowed in E+ 22.2.0, and you also cannot set a Schedule | ||
| 6837 | // with 0 values with a Fan:ConstantVolume. So we must replace these fans with a Fan:SystemModel (that mimics a Fan:OnOff really, just planning | ||
| 6838 | // for the future + avoid having to create 2 curves for FanOnOff) | ||
| 6839 | 86 | std::vector<std::string> packagedFanCVHandleStrs; | |
| 6840 | { | ||
| 6841 |
5/5✓ Branch 1 taken 86 times.
✓ Branch 4 taken 86 times.
✓ Branch 7 taken 86 times.
✓ Branch 10 taken 86 times.
✓ Branch 13 taken 86 times.
|
258 | std::vector<IdfObject> fanCVs = idf_3_4_0.getObjectsByType(idf_3_4_0.iddFile().getObject("OS:Fan:ConstantVolume").get()); |
| 6842 | 86 | std::vector<std::string> fanCVHandleStrs; | |
| 6843 |
1/1✓ Branch 2 taken 86 times.
|
86 | fanCVHandleStrs.reserve(fanCVs.size()); |
| 6844 |
1/1✓ Branch 2 taken 86 times.
|
86 | packagedFanCVHandleStrs.reserve(fanCVs.size()); |
| 6845 |
2/2✓ Branch 1 taken 86 times.
✓ Branch 6 taken 86 times.
|
86 | std::transform(fanCVs.cbegin(), fanCVs.cend(), std::back_inserter(fanCVHandleStrs), |
| 6846 |
3/3✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
✓ Branch 7 taken 16 times.
|
16 | [](const auto& idfObject) { return idfObject.getString(0).get(); }); |
| 6847 |
7/7✓ Branch 1 taken 86 times.
✓ Branch 4 taken 86 times.
✓ Branch 7 taken 86 times.
✓ Branch 10 taken 86 times.
✓ Branch 13 taken 86 times.
✓ Branch 23 taken 1 time.
✓ Branch 24 taken 86 times.
|
259 | for (const auto& ptac : idf_3_4_0.getObjectsByType(idf_3_4_0.iddFile().getObject("OS:ZoneHVAC:PackagedTerminalAirConditioner").get())) { |
| 6848 | // If the Supply Air Fan Operating Mode Schedule is empty | ||
| 6849 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
1 | if (ptac.isEmpty(17)) { |
| 6850 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | if (auto fanHandleStr_ = ptac.getString(13, false, true)) { |
| 6851 |
3/4✓ Branch 2 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✗ Branch 11 not taken.
|
1 | if (std::find(fanCVHandleStrs.cbegin(), fanCVHandleStrs.cend(), fanHandleStr_.get()) != fanCVHandleStrs.cend()) { |
| 6852 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | packagedFanCVHandleStrs.push_back(fanHandleStr_.get()); |
| 6853 | } | ||
| 6854 | 1 | } | |
| 6855 | } | ||
| 6856 | 86 | } | |
| 6857 |
7/7✓ Branch 1 taken 86 times.
✓ Branch 4 taken 86 times.
✓ Branch 7 taken 86 times.
✓ Branch 10 taken 86 times.
✓ Branch 13 taken 86 times.
✓ Branch 23 taken 1 time.
✓ Branch 24 taken 86 times.
|
259 | for (const auto& pthp : idf_3_4_0.getObjectsByType(idf_3_4_0.iddFile().getObject("OS:ZoneHVAC:PackagedTerminalHeatPump").get())) { |
| 6858 | // If the Supply Air Fan Operating Mode Schedule is empty | ||
| 6859 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
1 | if (pthp.isEmpty(23)) { |
| 6860 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | if (auto fanName_ = pthp.getString(13, false, true)) { |
| 6861 |
3/4✓ Branch 2 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✗ Branch 11 not taken.
|
1 | if (std::find(fanCVHandleStrs.cbegin(), fanCVHandleStrs.cend(), fanName_.get()) != fanCVHandleStrs.cend()) { |
| 6862 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | packagedFanCVHandleStrs.push_back(fanName_.get()); |
| 6863 | } | ||
| 6864 | 1 | } | |
| 6865 | } | ||
| 6866 | 86 | } | |
| 6867 | 86 | } | |
| 6868 | |||
| 6869 | 86 | std::string alwaysOnDiscreteScheduleHandleStr; | |
| 6870 | 86 | std::string alwaysOffDiscreteScheduleHandleStr; | |
| 6871 | |||
| 6872 | 2 | auto getOrCreateAlwaysDiscreteScheduleHandleStr = [this, &ss, &idf_3_4_0, &idd_3_5_0, &alwaysOnDiscreteScheduleHandleStr, | |
| 6873 | &alwaysOffDiscreteScheduleHandleStr](bool isAlwaysOn) -> std::string { | ||
| 6874 |
2/2✓ Branch 0 taken 1 time.
✓ Branch 1 taken 1 time.
|
2 | auto& discreteSchHandleStr = isAlwaysOn ? alwaysOnDiscreteScheduleHandleStr : alwaysOffDiscreteScheduleHandleStr; |
| 6875 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
|
2 | if (!discreteSchHandleStr.empty()) { |
| 6876 | ✗ | return discreteSchHandleStr; | |
| 6877 | } | ||
| 6878 |
3/3✓ Branch 0 taken 1 time.
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 2 times.
|
2 | std::string name = isAlwaysOn ? "Always On Discrete" : "Always Off Discrete"; |
| 6879 |
2/2✓ Branch 0 taken 1 time.
✓ Branch 1 taken 1 time.
|
2 | double val = isAlwaysOn ? 1.0 : 0.0; |
| 6880 | // Add an alwaysOnDiscreteSchedule if one does not already exist | ||
| 6881 |
7/7✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
✓ Branch 13 taken 2 times.
✓ Branch 23 taken 1 time.
✓ Branch 24 taken 2 times.
|
7 | for (const IdfObject& object : idf_3_4_0.getObjectsByType(idf_3_4_0.iddFile().getObject("OS:Schedule:Constant").get())) { |
| 6882 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | if (boost::optional<std::string> name_ = object.getString(1)) { |
| 6883 |
3/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 time.
|
1 | if (istringEqual(name_.get(), name)) { |
| 6884 | ✗ | if (boost::optional<double> value = object.getDouble(3)) { | |
| 6885 | ✗ | if (equal<double>(value.get(), val)) { | |
| 6886 | ✗ | discreteSchHandleStr = object.getString(0).get(); | |
| 6887 | ✗ | break; | |
| 6888 | } | ||
| 6889 | } | ||
| 6890 | } | ||
| 6891 | 1 | } | |
| 6892 | 2 | } | |
| 6893 | |||
| 6894 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | if (discreteSchHandleStr.empty()) { |
| 6895 |
4/4✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
|
4 | auto discreteSch = IdfObject(idd_3_5_0.getObject("OS:Schedule:Constant").get()); |
| 6896 | |||
| 6897 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | discreteSchHandleStr = toString(createUUID()); |
| 6898 |
1/1✓ Branch 1 taken 2 times.
|
2 | discreteSch.setString(0, discreteSchHandleStr); |
| 6899 |
1/1✓ Branch 1 taken 2 times.
|
2 | discreteSch.setString(1, name); |
| 6900 |
1/1✓ Branch 1 taken 2 times.
|
2 | discreteSch.setDouble(3, val); |
| 6901 | |||
| 6902 |
4/4✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
|
4 | IdfObject typeLimits(idd_3_5_0.getObject("OS:ScheduleTypeLimits").get()); |
| 6903 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
|
2 | typeLimits.setString(0, toString(createUUID())); |
| 6904 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | typeLimits.setString(1, name + " Limits"); |
| 6905 |
1/1✓ Branch 1 taken 2 times.
|
2 | typeLimits.setDouble(2, 0.0); |
| 6906 |
1/1✓ Branch 1 taken 2 times.
|
2 | typeLimits.setDouble(3, 1.0); |
| 6907 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
4 | typeLimits.setString(4, "Discrete"); |
| 6908 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | typeLimits.setString(5, "Availability"); |
| 6909 | |||
| 6910 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
|
2 | discreteSch.setString(2, typeLimits.getString(0).get()); |
| 6911 | |||
| 6912 |
1/1✓ Branch 1 taken 2 times.
|
2 | ss << discreteSch; |
| 6913 |
1/1✓ Branch 1 taken 2 times.
|
2 | ss << typeLimits; |
| 6914 | |||
| 6915 | // Register new objects | ||
| 6916 |
1/1✓ Branch 1 taken 2 times.
|
2 | m_new.push_back(discreteSch); |
| 6917 |
1/1✓ Branch 1 taken 2 times.
|
2 | m_new.push_back(typeLimits); |
| 6918 | 2 | } | |
| 6919 | |||
| 6920 |
1/1✓ Branch 1 taken 2 times.
|
2 | return discreteSchHandleStr; |
| 6921 | 2 | }; | |
| 6922 | |||
| 6923 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 2 taken 85 times.
|
86 | if (!packagedFanCVHandleStrs.empty()) { |
| 6924 |
1/1✓ Branch 1 taken 1 time.
|
1 | alwaysOffDiscreteScheduleHandleStr = getOrCreateAlwaysDiscreteScheduleHandleStr(false); |
| 6925 | } // End locating or creating alwaysOnDiscreteSchedule | ||
| 6926 | |||
| 6927 |
3/3✓ Branch 1 taken 86 times.
✓ Branch 8 taken 61810 times.
✓ Branch 9 taken 86 times.
|
61896 | for (const IdfObject& object : idf_3_4_0.objects()) { |
| 6928 |
2/2✓ Branch 1 taken 61810 times.
✓ Branch 4 taken 61810 times.
|
61810 | auto iddname = object.iddObject().name(); |
| 6929 | |||
| 6930 |
3/3✓ Branch 1 taken 61810 times.
✓ Branch 3 taken 454 times.
✓ Branch 4 taken 61356 times.
|
61810 | if (iddname == "OS:Construction") { |
| 6931 | |||
| 6932 | // Remove Construction with Material:AirWall layer | ||
| 6933 | // Replace with Construction:AirBoundary | ||
| 6934 | |||
| 6935 |
1/1✓ Branch 1 taken 454 times.
|
454 | auto iddObject = idd_3_5_0.getObject(iddname); |
| 6936 | |||
| 6937 | 454 | bool isAirWall = false; | |
| 6938 |
3/3✓ Branch 1 taken 454 times.
✓ Branch 3 taken 177 times.
✓ Branch 4 taken 277 times.
|
454 | if (object.numExtensibleGroups() == 1u) { |
| 6939 |
1/1✓ Branch 1 taken 177 times.
|
177 | const IdfExtensibleGroup eg = object.extensibleGroups()[0]; |
| 6940 |
5/6✓ Branch 1 taken 177 times.
✓ Branch 4 taken 177 times.
✓ Branch 7 taken 177 times.
✓ Branch 10 taken 177 times.
✓ Branch 14 taken 177 times.
✗ Branch 15 not taken.
|
354 | if (boost::optional<IdfObject> layer = idf_3_4_0.getObject(toUUID(eg.getString(0).get()))) { |
| 6941 |
3/3✓ Branch 1 taken 177 times.
✓ Branch 4 taken 177 times.
✓ Branch 7 taken 177 times.
|
177 | auto layeriddname = layer->iddObject().name(); |
| 6942 |
3/3✓ Branch 1 taken 177 times.
✓ Branch 3 taken 19 times.
✓ Branch 4 taken 158 times.
|
177 | if (layeriddname == "OS:Material:AirWall") { |
| 6943 | |||
| 6944 |
2/2✓ Branch 1 taken 19 times.
✓ Branch 4 taken 19 times.
|
19 | auto iddObject = idd_3_5_0.getObject("OS:Construction:AirBoundary"); |
| 6945 |
2/2✓ Branch 1 taken 19 times.
✓ Branch 4 taken 19 times.
|
19 | IdfObject newObject(iddObject.get()); |
| 6946 | |||
| 6947 | // Handle | ||
| 6948 |
2/3✓ Branch 1 taken 19 times.
✓ Branch 3 taken 19 times.
✗ Branch 4 not taken.
|
38 | if (auto value = object.getString(0)) { |
| 6949 |
2/2✓ Branch 1 taken 19 times.
✓ Branch 4 taken 19 times.
|
19 | newObject.setString(0, value.get()); |
| 6950 | 19 | } | |
| 6951 | |||
| 6952 | // Name | ||
| 6953 |
2/3✓ Branch 1 taken 19 times.
✓ Branch 3 taken 19 times.
✗ Branch 4 not taken.
|
38 | if (auto value = object.getString(1)) { |
| 6954 |
2/2✓ Branch 1 taken 19 times.
✓ Branch 4 taken 19 times.
|
19 | newObject.setString(1, value.get()); |
| 6955 | 19 | } | |
| 6956 | |||
| 6957 | // Surface Rendering Name (Rendering Color) | ||
| 6958 |
2/3✓ Branch 1 taken 19 times.
✓ Branch 3 taken 19 times.
✗ Branch 4 not taken.
|
38 | if (auto value = object.getString(2)) { |
| 6959 |
2/2✓ Branch 1 taken 19 times.
✓ Branch 4 taken 19 times.
|
19 | newObject.setString(5, value.get()); |
| 6960 | 19 | } | |
| 6961 | |||
| 6962 | // Simple Mixing Air Changes per Hour | ||
| 6963 | // Set ACH to 0.0, to match the old style Material:AirWall (same as the ConstructionAirBoundary Ctor) | ||
| 6964 |
1/1✓ Branch 1 taken 19 times.
|
19 | newObject.setDouble(3, 0.0); |
| 6965 | |||
| 6966 |
2/2✓ Branch 1 taken 19 times.
✓ Branch 4 taken 19 times.
|
19 | m_refactored.push_back(RefactoredObjectData(object, newObject)); |
| 6967 |
1/1✓ Branch 1 taken 19 times.
|
19 | ss << newObject; |
| 6968 | |||
| 6969 | 19 | isAirWall = true; | |
| 6970 | 19 | } | |
| 6971 | 354 | } | |
| 6972 | 177 | } | |
| 6973 | |||
| 6974 |
2/2✓ Branch 0 taken 435 times.
✓ Branch 1 taken 19 times.
|
454 | if (!isAirWall) { |
| 6975 |
1/1✓ Branch 1 taken 435 times.
|
435 | ss << object; |
| 6976 | } | ||
| 6977 | |||
| 6978 |
3/3✓ Branch 2 taken 61356 times.
✓ Branch 4 taken 19 times.
✓ Branch 5 taken 61337 times.
|
61810 | } else if (iddname == "OS:Material:AirWall") { |
| 6979 |
1/1✓ Branch 1 taken 19 times.
|
19 | m_untranslated.push_back(object); |
| 6980 | |||
| 6981 |
3/3✓ Branch 1 taken 61337 times.
✓ Branch 3 taken 5 times.
✓ Branch 4 taken 61332 times.
|
61337 | } else if (iddname == "OS:Table:MultiVariableLookup") { |
| 6982 | |||
| 6983 | // Stage Data List becomes extensible list (Stage 1, Stage 2, etc.) | ||
| 6984 | // ModelObjectList gets removed | ||
| 6985 | |||
| 6986 |
4/4✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
|
5 | IdfObject tableObject(idd_3_5_0.getObject("OS:Table:LookUp").get()); |
| 6987 | |||
| 6988 | // Handle and name are copied | ||
| 6989 |
2/2✓ Branch 0 taken 10 times.
✓ Branch 1 taken 5 times.
|
15 | for (size_t i = 0; i < 2; ++i) { |
| 6990 |
2/3✓ Branch 1 taken 10 times.
✓ Branch 5 taken 10 times.
✗ Branch 6 not taken.
|
20 | if ((value = object.getString(i))) { |
| 6991 |
2/2✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
|
10 | tableObject.setString(i, value.get()); |
| 6992 | } | ||
| 6993 | } | ||
| 6994 | |||
| 6995 |
3/3✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
|
5 | std::string oriInterpMethod = object.getString(2, true).get(); |
| 6996 |
1/1✓ Branch 1 taken 5 times.
|
10 | std::string newInterpMethod = "Cubic"; |
| 6997 |
1/1✓ Branch 1 taken 5 times.
|
10 | std::string newExtrapMethod = "Constant"; |
| 6998 |
4/4✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 1 time.
✓ Branch 8 taken 4 times.
|
10 | if (openstudio::istringEqual(oriInterpMethod, "LagrangeInterpolationLinearExtrapolation")) { |
| 6999 |
1/1✓ Branch 1 taken 1 time.
|
1 | newInterpMethod = "Cubic"; |
| 7000 |
1/1✓ Branch 1 taken 1 time.
|
1 | newExtrapMethod = "Linear"; |
| 7001 |
4/4✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 2 times.
✓ Branch 8 taken 2 times.
|
8 | } else if (istringEqual(oriInterpMethod, "LinearInterpolationOfTable")) { |
| 7002 |
1/1✓ Branch 1 taken 2 times.
|
2 | newInterpMethod = "Linear"; |
| 7003 |
1/1✓ Branch 1 taken 2 times.
|
2 | newExtrapMethod = "Constant"; |
| 7004 | } | ||
| 7005 | |||
| 7006 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | unsigned numIndVars = object.getInt(28).get(); |
| 7007 |
1/1✓ Branch 1 taken 5 times.
|
5 | unsigned numPoints = object.numExtensibleGroups() / (numIndVars + 1); |
| 7008 | |||
| 7009 |
4/4✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
|
5 | IdfObject varList(idd_3_5_0.getObject("OS:ModelObjectList").get()); |
| 7010 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | std::string varListHandle = toString(createUUID()); |
| 7011 |
1/1✓ Branch 1 taken 5 times.
|
5 | varList.setString(0, varListHandle); |
| 7012 |
3/3✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
|
5 | varList.setString(1, object.nameString() + "_IndependentVariableList"); |
| 7013 |
1/1✓ Branch 1 taken 5 times.
|
5 | tableObject.setString(2, varListHandle); |
| 7014 | |||
| 7015 | // If Normalization Reference is supplied | ||
| 7016 |
3/3✓ Branch 1 taken 5 times.
✓ Branch 3 taken 4 times.
✓ Branch 4 taken 1 time.
|
10 | if (boost::optional<double> normref_ = object.getDouble(9)) { |
| 7017 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | tableObject.setString(3, "DivisorOnly"); |
| 7018 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | tableObject.setDouble(4, normref_.get()); |
| 7019 | } else { | ||
| 7020 | // Same as Ctor for these required-fields | ||
| 7021 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | tableObject.setString(3, "None"); |
| 7022 |
1/1✓ Branch 1 taken 1 time.
|
1 | tableObject.setDouble(4, 1.0); |
| 7023 | } | ||
| 7024 | |||
| 7025 | // Min/Maximum OutputValue | ||
| 7026 |
2/3✓ Branch 1 taken 5 times.
✓ Branch 3 taken 5 times.
✗ Branch 4 not taken.
|
10 | if (boost::optional<double> minVal_ = object.getDouble(20)) { |
| 7027 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | tableObject.setDouble(5, minVal_.get()); |
| 7028 | } | ||
| 7029 |
2/3✓ Branch 1 taken 5 times.
✓ Branch 3 taken 5 times.
✗ Branch 4 not taken.
|
10 | if (boost::optional<double> minVal_ = object.getDouble(21)) { |
| 7030 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | tableObject.setDouble(6, minVal_.get()); |
| 7031 | } | ||
| 7032 | |||
| 7033 | // Output Unit Type (will pull "Dimensionless" as default if not set, which matches the Ctor) | ||
| 7034 |
3/3✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
|
5 | tableObject.setString(7, object.getString(27, true).get()); |
| 7035 | |||
| 7036 | // 8, 9, 10 are External File stuff, left blank | ||
| 7037 | |||
| 7038 | // Now extensible Output Values | ||
| 7039 |
2/2✓ Branch 0 taken 284 times.
✓ Branch 1 taken 5 times.
|
289 | for (unsigned k = 0; k < numPoints; ++k) { |
| 7040 |
6/8✓ Branch 1 taken 284 times.
✓ Branch 4 taken 284 times.
✓ Branch 7 taken 284 times.
✓ Branch 10 taken 284 times.
✓ Branch 14 taken 284 times.
✓ Branch 15 taken 284 times.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
|
1136 | tableObject.pushExtensibleGroup({object.getExtensibleGroup(numIndVars + (k * (numIndVars + 1))).getString(0).get()}); |
| 7041 | } | ||
| 7042 | |||
| 7043 | 5 | std::vector<IdfObject> varsAdded; | |
| 7044 | |||
| 7045 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 5 times.
|
13 | for (unsigned i = 0; i < numIndVars; ++i) { |
| 7046 |
4/4✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
✓ Branch 7 taken 8 times.
✓ Branch 10 taken 8 times.
|
8 | IdfObject& var = varsAdded.emplace_back(idd_3_5_0.getObject("OS:Table:IndependentVariable").get()); |
| 7047 |
2/2✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
|
8 | std::string varHandle = toString(createUUID()); |
| 7048 |
1/1✓ Branch 1 taken 8 times.
|
8 | var.setString(0, varHandle); |
| 7049 |
4/6✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
✓ Branch 8 taken 8 times.
✓ Branch 9 taken 8 times.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
|
24 | varList.pushExtensibleGroup({varHandle}); |
| 7050 |
4/4✓ Branch 2 taken 8 times.
✓ Branch 5 taken 8 times.
✓ Branch 8 taken 8 times.
✓ Branch 11 taken 8 times.
|
8 | var.setName(object.nameString() + "_IndependentVariable_" + std::to_string(i)); |
| 7051 | |||
| 7052 |
1/1✓ Branch 1 taken 8 times.
|
8 | var.setString(2, newInterpMethod); |
| 7053 |
1/1✓ Branch 1 taken 8 times.
|
8 | var.setString(3, newExtrapMethod); |
| 7054 | |||
| 7055 | // Min Max | ||
| 7056 |
2/3✓ Branch 1 taken 8 times.
✓ Branch 3 taken 8 times.
✗ Branch 4 not taken.
|
16 | if (auto minVal_ = object.getDouble(10 + 2 * i)) { |
| 7057 |
2/2✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
|
8 | var.setDouble(4, minVal_.get()); |
| 7058 | } | ||
| 7059 |
2/3✓ Branch 1 taken 8 times.
✓ Branch 3 taken 8 times.
✗ Branch 4 not taken.
|
16 | if (auto maxVal_ = object.getDouble(11 + 2 * i)) { |
| 7060 |
2/2✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
|
8 | var.setDouble(5, maxVal_.get()); |
| 7061 | } | ||
| 7062 | |||
| 7063 | // 6 - Normalization Reference Value is left blank | ||
| 7064 | |||
| 7065 | // 7 - Unit Type | ||
| 7066 |
3/3✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
✓ Branch 7 taken 8 times.
|
8 | var.setString(7, object.getString(22 + i, true).get()); |
| 7067 | |||
| 7068 | // 8, 9, 10 are External File stuff, left blank | ||
| 7069 | |||
| 7070 | // Now extensible values: keep only unique, and sorted | ||
| 7071 | 8 | std::vector<double> xValues; | |
| 7072 |
2/2✓ Branch 0 taken 552 times.
✓ Branch 1 taken 8 times.
|
560 | for (unsigned k = 0; k < numPoints; ++k) { |
| 7073 |
4/4✓ Branch 1 taken 552 times.
✓ Branch 4 taken 552 times.
✓ Branch 7 taken 552 times.
✓ Branch 10 taken 552 times.
|
552 | xValues.push_back(object.getExtensibleGroup(i + (k * (numIndVars + 1))).getDouble(0).get()); |
| 7074 | } | ||
| 7075 | |||
| 7076 |
1/1✓ Branch 3 taken 8 times.
|
8 | std::sort(xValues.begin(), xValues.end()); |
| 7077 |
2/2✓ Branch 5 taken 8 times.
✓ Branch 9 taken 8 times.
|
8 | xValues.erase(std::unique(xValues.begin(), xValues.end()), xValues.end()); |
| 7078 | |||
| 7079 |
2/2✓ Branch 4 taken 75 times.
✓ Branch 5 taken 8 times.
|
83 | for (auto& val : xValues) { |
| 7080 |
2/2✓ Branch 1 taken 75 times.
✓ Branch 4 taken 75 times.
|
75 | var.pushExtensibleGroup().setDouble(0, val); |
| 7081 | } | ||
| 7082 | 8 | } | |
| 7083 | |||
| 7084 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | m_refactored.push_back(RefactoredObjectData(object, tableObject)); |
| 7085 |
1/1✓ Branch 1 taken 5 times.
|
5 | m_new.push_back(varList); |
| 7086 | |||
| 7087 |
1/1✓ Branch 1 taken 5 times.
|
5 | ss << tableObject; |
| 7088 |
1/1✓ Branch 1 taken 5 times.
|
5 | ss << varList; |
| 7089 | |||
| 7090 |
2/2✓ Branch 5 taken 8 times.
✓ Branch 6 taken 5 times.
|
13 | for (auto&& varAdded : varsAdded) { |
| 7091 |
1/1✓ Branch 1 taken 8 times.
|
8 | ss << varAdded; |
| 7092 |
1/1✓ Branch 2 taken 8 times.
|
8 | m_new.emplace_back(std::move(varAdded)); |
| 7093 | } | ||
| 7094 | |||
| 7095 |
3/3✓ Branch 8 taken 61332 times.
✓ Branch 10 taken 2 times.
✓ Branch 11 taken 61330 times.
|
61337 | } else if (iddname == "OS:Coil:Heating:DX:SingleSpeed") { |
| 7096 | |||
| 7097 | // Fields that have been added from 3.4.0 to 3.5.0: | ||
| 7098 | // ------------------------------------------------ | ||
| 7099 | // * Rated Supply Fan Power Per Volume Flow Rate 2023 * 7 | ||
| 7100 | |||
| 7101 |
1/1✓ Branch 1 taken 2 times.
|
2 | auto iddObject = idd_3_5_0.getObject(iddname); |
| 7102 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | IdfObject newObject(iddObject.get()); |
| 7103 | |||
| 7104 |
3/3✓ Branch 1 taken 48 times.
✓ Branch 3 taken 46 times.
✓ Branch 4 taken 2 times.
|
48 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 7105 |
2/3✓ Branch 1 taken 46 times.
✓ Branch 5 taken 46 times.
✗ Branch 6 not taken.
|
92 | if ((value = object.getString(i))) { |
| 7106 |
2/2✓ Branch 0 taken 14 times.
✓ Branch 1 taken 32 times.
|
46 | if (i < 7) { |
| 7107 |
2/2✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
|
14 | newObject.setString(i, value.get()); |
| 7108 | } else { | ||
| 7109 |
2/2✓ Branch 1 taken 32 times.
✓ Branch 4 taken 32 times.
|
32 | newObject.setString(i + 1, value.get()); |
| 7110 | } | ||
| 7111 | } | ||
| 7112 | } | ||
| 7113 | |||
| 7114 | // Rated Supply Fan Power Per Volume Flow Rate 2023 | ||
| 7115 |
1/1✓ Branch 1 taken 2 times.
|
2 | newObject.setDouble(7, 934.4); |
| 7116 | |||
| 7117 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | m_refactored.push_back(RefactoredObjectData(object, newObject)); |
| 7118 |
1/1✓ Branch 1 taken 2 times.
|
2 | ss << newObject; |
| 7119 | |||
| 7120 |
3/3✓ Branch 3 taken 61330 times.
✓ Branch 5 taken 18 times.
✓ Branch 6 taken 61312 times.
|
61332 | } else if (iddname == "OS:Coil:Cooling:DX:SingleSpeed") { |
| 7121 | |||
| 7122 |
1/1✓ Branch 1 taken 18 times.
|
18 | auto iddObject = idd_3_5_0.getObject(iddname); |
| 7123 |
2/2✓ Branch 1 taken 18 times.
✓ Branch 4 taken 18 times.
|
18 | IdfObject newObject(iddObject.get()); |
| 7124 | |||
| 7125 | // Fields that have been added from 3.4.0 to 3.5.0: | ||
| 7126 | // ------------------------------------------------ | ||
| 7127 | // * Rated Evaporator Fan Power Per Volume Flow Rate 2023 * 8 | ||
| 7128 | |||
| 7129 |
3/3✓ Branch 1 taken 594 times.
✓ Branch 3 taken 576 times.
✓ Branch 4 taken 18 times.
|
594 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 7130 |
2/3✓ Branch 1 taken 576 times.
✓ Branch 5 taken 576 times.
✗ Branch 6 not taken.
|
1152 | if ((value = object.getString(i))) { |
| 7131 |
2/2✓ Branch 0 taken 144 times.
✓ Branch 1 taken 432 times.
|
576 | if (i < 8) { |
| 7132 |
2/2✓ Branch 1 taken 144 times.
✓ Branch 4 taken 144 times.
|
144 | newObject.setString(i, value.get()); |
| 7133 | } else { | ||
| 7134 |
2/2✓ Branch 1 taken 432 times.
✓ Branch 4 taken 432 times.
|
432 | newObject.setString(i + 1, value.get()); |
| 7135 | } | ||
| 7136 | } | ||
| 7137 | } | ||
| 7138 | |||
| 7139 | // Rated Supply Fan Power Per Volume Flow Rate 2023 | ||
| 7140 |
1/1✓ Branch 1 taken 18 times.
|
18 | newObject.setDouble(8, 934.4); |
| 7141 | |||
| 7142 | // New defaults (now required-field, before = optional) | ||
| 7143 | // ------------------------------------------------ | ||
| 7144 | // From blank to zero: | ||
| 7145 | // * Nominal Time for Condensate Removal to Begin * 17, | ||
| 7146 | // * Ratio of Initial Moisture Evaporation Rate and Steady State Latent Capacity * 18 | ||
| 7147 | // * Maximum Cycling Rate * 19 | ||
| 7148 | // * Latent Capacity Time Constant * 20 | ||
| 7149 |
2/2✓ Branch 0 taken 72 times.
✓ Branch 1 taken 18 times.
|
90 | for (size_t i = 17; i <= 20; ++i) { |
| 7150 |
3/3✓ Branch 1 taken 72 times.
✓ Branch 3 taken 47 times.
✓ Branch 4 taken 25 times.
|
72 | if (newObject.isEmpty(i)) { |
| 7151 |
1/1✓ Branch 1 taken 47 times.
|
47 | newObject.setDouble(i, 0.0); |
| 7152 | } | ||
| 7153 | } | ||
| 7154 | |||
| 7155 |
2/2✓ Branch 1 taken 18 times.
✓ Branch 4 taken 18 times.
|
18 | m_refactored.push_back(RefactoredObjectData(object, newObject)); |
| 7156 |
1/1✓ Branch 1 taken 18 times.
|
18 | ss << newObject; |
| 7157 | |||
| 7158 |
3/3✓ Branch 3 taken 61312 times.
✓ Branch 5 taken 5 times.
✓ Branch 6 taken 61307 times.
|
61330 | } else if (iddname == "OS:Coil:Heating:DX:MultiSpeed:StageData") { |
| 7159 | |||
| 7160 | // Fields that have been added from 3.4.0 to 3.5.0: | ||
| 7161 | // ------------------------------------------------ | ||
| 7162 | // * Rated Supply Air Fan Power Per Volume Flow Rate 2023 * 6 | ||
| 7163 | |||
| 7164 |
1/1✓ Branch 1 taken 5 times.
|
5 | auto iddObject = idd_3_5_0.getObject(iddname); |
| 7165 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | IdfObject newObject(iddObject.get()); |
| 7166 | |||
| 7167 |
3/3✓ Branch 1 taken 70 times.
✓ Branch 3 taken 65 times.
✓ Branch 4 taken 5 times.
|
70 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 7168 |
2/3✓ Branch 1 taken 65 times.
✓ Branch 5 taken 65 times.
✗ Branch 6 not taken.
|
130 | if ((value = object.getString(i))) { |
| 7169 |
2/2✓ Branch 0 taken 30 times.
✓ Branch 1 taken 35 times.
|
65 | if (i < 6) { |
| 7170 |
2/2✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
|
30 | newObject.setString(i, value.get()); |
| 7171 | } else { | ||
| 7172 |
2/2✓ Branch 1 taken 35 times.
✓ Branch 4 taken 35 times.
|
35 | newObject.setString(i + 1, value.get()); |
| 7173 | } | ||
| 7174 | } | ||
| 7175 | } | ||
| 7176 | |||
| 7177 | // Rated Supply Fan Power Per Volume Flow Rate 2023 | ||
| 7178 |
1/1✓ Branch 1 taken 5 times.
|
5 | newObject.setDouble(6, 934.4); |
| 7179 | |||
| 7180 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | m_refactored.push_back(RefactoredObjectData(object, newObject)); |
| 7181 |
1/1✓ Branch 1 taken 5 times.
|
5 | ss << newObject; |
| 7182 | |||
| 7183 |
3/3✓ Branch 3 taken 61307 times.
✓ Branch 5 taken 1 time.
✓ Branch 6 taken 61306 times.
|
61312 | } else if (iddname == "OS:Coil:Cooling:DX:MultiSpeed:StageData") { |
| 7184 | |||
| 7185 | // Fields that have been added from 3.4.0 to 3.5.0: | ||
| 7186 | // ------------------------------------------------ | ||
| 7187 | // * Rated Evaporator Fan Power Per Volume Flow Rate 2023 * 7 | ||
| 7188 | |||
| 7189 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto iddObject = idd_3_5_0.getObject(iddname); |
| 7190 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfObject newObject(iddObject.get()); |
| 7191 | |||
| 7192 |
3/3✓ Branch 1 taken 22 times.
✓ Branch 3 taken 21 times.
✓ Branch 4 taken 1 time.
|
22 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 7193 |
2/3✓ Branch 1 taken 21 times.
✓ Branch 5 taken 21 times.
✗ Branch 6 not taken.
|
42 | if ((value = object.getString(i))) { |
| 7194 |
2/2✓ Branch 0 taken 7 times.
✓ Branch 1 taken 14 times.
|
21 | if (i < 7) { |
| 7195 |
2/2✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
|
7 | newObject.setString(i, value.get()); |
| 7196 | } else { | ||
| 7197 |
2/2✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
|
14 | newObject.setString(i + 1, value.get()); |
| 7198 | } | ||
| 7199 | } | ||
| 7200 | } | ||
| 7201 | |||
| 7202 | // Rated Supply Fan Power Per Volume Flow Rate 2023 | ||
| 7203 |
1/1✓ Branch 1 taken 1 time.
|
1 | newObject.setDouble(7, 934.4); |
| 7204 | |||
| 7205 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | m_refactored.push_back(RefactoredObjectData(object, newObject)); |
| 7206 |
1/1✓ Branch 1 taken 1 time.
|
1 | ss << newObject; |
| 7207 | |||
| 7208 |
3/3✓ Branch 3 taken 61306 times.
✓ Branch 5 taken 1 time.
✓ Branch 6 taken 61305 times.
|
61307 | } else if (iddname == "OS:Coil:Cooling:DX:CurveFit:Speed") { |
| 7209 | |||
| 7210 | // Fields that have been added from 3.4.0 to 3.5.0: | ||
| 7211 | // ------------------------------------------------ | ||
| 7212 | // * Rated Evaporator Fan Power Per Volume Flow Rate 2023 * 9 | ||
| 7213 | |||
| 7214 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto iddObject = idd_3_5_0.getObject(iddname); |
| 7215 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfObject newObject(iddObject.get()); |
| 7216 | |||
| 7217 |
3/3✓ Branch 1 taken 18 times.
✓ Branch 3 taken 17 times.
✓ Branch 4 taken 1 time.
|
18 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 7218 |
2/3✓ Branch 1 taken 17 times.
✓ Branch 5 taken 17 times.
✗ Branch 6 not taken.
|
34 | if ((value = object.getString(i))) { |
| 7219 |
2/2✓ Branch 0 taken 9 times.
✓ Branch 1 taken 8 times.
|
17 | if (i < 9) { |
| 7220 |
2/2✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
|
9 | newObject.setString(i, value.get()); |
| 7221 | } else { | ||
| 7222 |
2/2✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
|
8 | newObject.setString(i + 1, value.get()); |
| 7223 | } | ||
| 7224 | } | ||
| 7225 | } | ||
| 7226 | |||
| 7227 | // Rated Supply Fan Power Per Volume Flow Rate 2023 | ||
| 7228 |
1/1✓ Branch 1 taken 1 time.
|
1 | newObject.setDouble(9, 934.4); |
| 7229 | |||
| 7230 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | m_refactored.push_back(RefactoredObjectData(object, newObject)); |
| 7231 |
1/1✓ Branch 1 taken 1 time.
|
1 | ss << newObject; |
| 7232 | |||
| 7233 |
3/3✓ Branch 3 taken 61305 times.
✓ Branch 5 taken 2 times.
✓ Branch 6 taken 61303 times.
|
61306 | } else if (iddname == "OS:Coil:Heating:WaterToAirHeatPump:EquationFit") { |
| 7234 | |||
| 7235 | // Fields that have been added from 3.4.0 to 3.5.0: | ||
| 7236 | // ------------------------------------------------ | ||
| 7237 | // * Rated Entering Water Temperature * 10 | ||
| 7238 | // * Rated Entering Air Dry-Bulb Temperature * 11 | ||
| 7239 | // * Ratio of Rated Heating Capacity to Rated Cooling Capacity * 12 | ||
| 7240 | |||
| 7241 |
1/1✓ Branch 1 taken 2 times.
|
2 | auto iddObject = idd_3_5_0.getObject(iddname); |
| 7242 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | IdfObject newObject(iddObject.get()); |
| 7243 | |||
| 7244 |
3/3✓ Branch 1 taken 26 times.
✓ Branch 3 taken 24 times.
✓ Branch 4 taken 2 times.
|
26 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 7245 |
2/3✓ Branch 1 taken 24 times.
✓ Branch 5 taken 24 times.
✗ Branch 6 not taken.
|
48 | if ((value = object.getString(i))) { |
| 7246 |
2/2✓ Branch 0 taken 20 times.
✓ Branch 1 taken 4 times.
|
24 | if (i < 10) { |
| 7247 |
2/2✓ Branch 1 taken 20 times.
✓ Branch 4 taken 20 times.
|
20 | newObject.setString(i, value.get()); |
| 7248 | } else { | ||
| 7249 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | newObject.setString(i + 3, value.get()); |
| 7250 | } | ||
| 7251 | } | ||
| 7252 | } | ||
| 7253 | |||
| 7254 | // Rated Entering Water Temperature | ||
| 7255 |
1/1✓ Branch 1 taken 2 times.
|
2 | newObject.setDouble(10, 20); |
| 7256 | |||
| 7257 | // Rated Entering Air Dry-Bulb Temperature | ||
| 7258 |
1/1✓ Branch 1 taken 2 times.
|
2 | newObject.setDouble(11, 20); |
| 7259 | |||
| 7260 | // Ratio of Rated Heating Capacity to Rated Cooling Capacity | ||
| 7261 |
1/1✓ Branch 1 taken 2 times.
|
2 | newObject.setDouble(12, 1.0); |
| 7262 | |||
| 7263 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | m_refactored.push_back(RefactoredObjectData(object, newObject)); |
| 7264 |
1/1✓ Branch 1 taken 2 times.
|
2 | ss << newObject; |
| 7265 | |||
| 7266 |
3/3✓ Branch 3 taken 61303 times.
✓ Branch 5 taken 2 times.
✓ Branch 6 taken 61301 times.
|
61305 | } else if (iddname == "OS:Coil:Cooling:WaterToAirHeatPump:EquationFit") { |
| 7267 | |||
| 7268 | // Fields that have been added from 3.4.0 to 3.5.0: | ||
| 7269 | // ------------------------------------------------ | ||
| 7270 | // * Rated Entering Water Temperature * 11 | ||
| 7271 | // * Rated Entering Air Dry-Bulb Temperature * 12 | ||
| 7272 | // * Rated Entering Air Wet-Bulb Temperature * 13 | ||
| 7273 | |||
| 7274 |
1/1✓ Branch 1 taken 2 times.
|
2 | auto iddObject = idd_3_5_0.getObject(iddname); |
| 7275 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | IdfObject newObject(iddObject.get()); |
| 7276 | |||
| 7277 |
3/3✓ Branch 1 taken 34 times.
✓ Branch 3 taken 32 times.
✓ Branch 4 taken 2 times.
|
34 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 7278 |
2/3✓ Branch 1 taken 32 times.
✓ Branch 5 taken 32 times.
✗ Branch 6 not taken.
|
64 | if ((value = object.getString(i))) { |
| 7279 |
2/2✓ Branch 0 taken 22 times.
✓ Branch 1 taken 10 times.
|
32 | if (i < 11) { |
| 7280 |
2/2✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
|
22 | newObject.setString(i, value.get()); |
| 7281 | } else { | ||
| 7282 |
2/2✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
|
10 | newObject.setString(i + 3, value.get()); |
| 7283 | } | ||
| 7284 | } | ||
| 7285 | } | ||
| 7286 | |||
| 7287 | // Rated Entering Water Temperature | ||
| 7288 |
1/1✓ Branch 1 taken 2 times.
|
2 | newObject.setDouble(11, 30); |
| 7289 | |||
| 7290 | // Rated Entering Air Dry-Bulb Temperature | ||
| 7291 |
1/1✓ Branch 1 taken 2 times.
|
2 | newObject.setDouble(12, 27); |
| 7292 | |||
| 7293 | // Rated Entering Air Wet-Bulb Temperature | ||
| 7294 |
1/1✓ Branch 1 taken 2 times.
|
2 | newObject.setDouble(13, 19.0); |
| 7295 | |||
| 7296 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | m_refactored.push_back(RefactoredObjectData(object, newObject)); |
| 7297 |
1/1✓ Branch 1 taken 2 times.
|
2 | ss << newObject; |
| 7298 | |||
| 7299 |
3/3✓ Branch 3 taken 61301 times.
✓ Branch 5 taken 1326 times.
✓ Branch 6 taken 59975 times.
|
61303 | } else if (iddname == "OS:Sizing:Zone") { |
| 7300 | |||
| 7301 | // 9 Fields have been added from 3.4.0 to 3.5.0: | ||
| 7302 | // ------------------------------------------------ | ||
| 7303 | // * Zone Load Sizing Method * 26 | ||
| 7304 | // * Zone Latent Cooling Design Supply Air Humidity Ratio Input Method * 27 | ||
| 7305 | // * Zone Dehumidification Design Supply Air Humidity Ratio * 28 | ||
| 7306 | // * Zone Cooling Design Supply Air Humidity Ratio Difference * 29 | ||
| 7307 | // * Zone Latent Heating Design Supply Air Humidity Ratio Input Method * 30 | ||
| 7308 | // * Zone Humidification Design Supply Air Humidity Ratio * 31 | ||
| 7309 | // * Zone Humidification Design Supply Air Humidity Ratio Difference * 32 | ||
| 7310 | // * Zone Humidistat Dehumidification Set Point Schedule Name * 33 | ||
| 7311 | // * Zone Humidistat Humidification Set Point Schedule Name * 34 | ||
| 7312 |
1/1✓ Branch 1 taken 1326 times.
|
1326 | auto iddObject = idd_3_5_0.getObject(iddname); |
| 7313 |
2/2✓ Branch 1 taken 1326 times.
✓ Branch 4 taken 1326 times.
|
1326 | IdfObject newObject(iddObject.get()); |
| 7314 | |||
| 7315 |
3/3✓ Branch 1 taken 35826 times.
✓ Branch 3 taken 34500 times.
✓ Branch 4 taken 1326 times.
|
35826 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 7316 |
1/1✓ Branch 1 taken 34500 times.
|
34500 | auto value = object.getString(i); |
| 7317 |
1/2✓ Branch 0 taken 34500 times.
✗ Branch 1 not taken.
|
34500 | if (value) { |
| 7318 |
2/2✓ Branch 0 taken 34476 times.
✓ Branch 1 taken 24 times.
|
34500 | if (i < 26) { |
| 7319 | // Handle | ||
| 7320 |
2/2✓ Branch 1 taken 34476 times.
✓ Branch 4 taken 34476 times.
|
34476 | newObject.setString(i, value.get()); |
| 7321 | } else { | ||
| 7322 | // Every other is shifted by 9 fields | ||
| 7323 |
2/2✓ Branch 1 taken 24 times.
✓ Branch 4 taken 24 times.
|
24 | newObject.setString(i + 9, value.get()); |
| 7324 | } | ||
| 7325 | } | ||
| 7326 | 34500 | } | |
| 7327 | |||
| 7328 | // New E+ 22.2.0 fields, IDD defaults for required fields set in Ctor | ||
| 7329 |
2/2✓ Branch 1 taken 1326 times.
✓ Branch 4 taken 1326 times.
|
2652 | newObject.setString(26, "Sensible Load Only No Latent Load"); |
| 7330 |
2/2✓ Branch 1 taken 1326 times.
✓ Branch 4 taken 1326 times.
|
1326 | newObject.setString(27, "HumidityRatioDifference"); |
| 7331 | // newObject.setString(28, ""); | ||
| 7332 |
1/1✓ Branch 1 taken 1326 times.
|
1326 | newObject.setDouble(29, 0.005); |
| 7333 |
2/2✓ Branch 1 taken 1326 times.
✓ Branch 4 taken 1326 times.
|
1326 | newObject.setString(30, "HumidityRatioDifference"); |
| 7334 | // newObject.setString(31, ""); | ||
| 7335 |
1/1✓ Branch 1 taken 1326 times.
|
1326 | newObject.setDouble(32, 0.005); |
| 7336 | |||
| 7337 |
2/2✓ Branch 1 taken 1326 times.
✓ Branch 4 taken 1326 times.
|
1326 | m_refactored.push_back(RefactoredObjectData(object, newObject)); |
| 7338 |
1/1✓ Branch 1 taken 1326 times.
|
1326 | ss << newObject; |
| 7339 | |||
| 7340 |
3/3✓ Branch 3 taken 59975 times.
✓ Branch 5 taken 1 time.
✓ Branch 6 taken 59974 times.
|
61301 | } else if (iddname == "OS:Coil:Heating:Gas:MultiStage") { |
| 7341 | |||
| 7342 | // 1 Field was made required: | ||
| 7343 | // ------------------------------------------------ | ||
| 7344 | // * Availability Schedule * 2 | ||
| 7345 | |||
| 7346 |
2/3✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 time.
|
1 | if (!object.isEmpty(2)) { |
| 7347 | ✗ | ss << object; | |
| 7348 | } else { | ||
| 7349 | |||
| 7350 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto iddObject = idd_3_5_0.getObject(iddname); |
| 7351 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfObject newObject(iddObject.get()); |
| 7352 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 3 taken 5 times.
✓ Branch 4 taken 1 time.
|
6 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 7353 |
2/3✓ Branch 1 taken 5 times.
✓ Branch 5 taken 5 times.
✗ Branch 6 not taken.
|
10 | if ((value = object.getString(i))) { |
| 7354 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | newObject.setString(i, value.get()); |
| 7355 | } | ||
| 7356 | } | ||
| 7357 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | newObject.setString(2, getOrCreateAlwaysDiscreteScheduleHandleStr(true)); |
| 7358 | |||
| 7359 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | m_refactored.push_back(RefactoredObjectData(object, newObject)); |
| 7360 |
1/1✓ Branch 1 taken 1 time.
|
1 | ss << newObject; |
| 7361 | 1 | } | |
| 7362 | |||
| 7363 |
3/3✓ Branch 1 taken 59974 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 59973 times.
|
59974 | } else if (iddname == "OS:ZoneHVAC:PackagedTerminalHeatPump") { |
| 7364 | |||
| 7365 |
2/3✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 time.
|
1 | if (!object.isEmpty(23)) { |
| 7366 | ✗ | ss << object; | |
| 7367 | |||
| 7368 | } else { | ||
| 7369 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto iddObject = idd_3_5_0.getObject(iddname); |
| 7370 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfObject newObject(iddObject.get()); |
| 7371 | |||
| 7372 |
3/3✓ Branch 1 taken 25 times.
✓ Branch 3 taken 24 times.
✓ Branch 4 taken 1 time.
|
25 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 7373 |
2/3✓ Branch 1 taken 24 times.
✓ Branch 5 taken 24 times.
✗ Branch 6 not taken.
|
48 | if ((value = object.getString(i))) { |
| 7374 |
2/2✓ Branch 1 taken 24 times.
✓ Branch 4 taken 24 times.
|
24 | newObject.setString(i, value.get()); |
| 7375 | } | ||
| 7376 | } | ||
| 7377 | // alwaysOffDiscreteScheduleHandleStr has already been initialized above | ||
| 7378 |
1/1✓ Branch 1 taken 1 time.
|
1 | newObject.setString(23, alwaysOffDiscreteScheduleHandleStr); |
| 7379 | |||
| 7380 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | m_refactored.push_back(RefactoredObjectData(object, newObject)); |
| 7381 |
1/1✓ Branch 1 taken 1 time.
|
1 | ss << newObject; |
| 7382 | 1 | } | |
| 7383 |
3/3✓ Branch 1 taken 59973 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 59972 times.
|
59973 | } else if (iddname == "OS:ZoneHVAC:PackagedTerminalAirConditioner") { |
| 7384 | |||
| 7385 |
2/3✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 time.
|
1 | if (!object.isEmpty(17)) { |
| 7386 | ✗ | ss << object; | |
| 7387 | |||
| 7388 | } else { | ||
| 7389 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto iddObject = idd_3_5_0.getObject(iddname); |
| 7390 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfObject newObject(iddObject.get()); |
| 7391 | |||
| 7392 |
3/3✓ Branch 1 taken 19 times.
✓ Branch 3 taken 18 times.
✓ Branch 4 taken 1 time.
|
19 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 7393 |
2/3✓ Branch 1 taken 18 times.
✓ Branch 5 taken 18 times.
✗ Branch 6 not taken.
|
36 | if ((value = object.getString(i))) { |
| 7394 |
2/2✓ Branch 1 taken 18 times.
✓ Branch 4 taken 18 times.
|
18 | newObject.setString(i, value.get()); |
| 7395 | } | ||
| 7396 | } | ||
| 7397 | // alwaysOffDiscreteScheduleHandleStr has already been initialized above | ||
| 7398 |
1/1✓ Branch 1 taken 1 time.
|
1 | newObject.setString(17, alwaysOffDiscreteScheduleHandleStr); |
| 7399 | |||
| 7400 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | m_refactored.push_back(RefactoredObjectData(object, newObject)); |
| 7401 |
1/1✓ Branch 1 taken 1 time.
|
1 | ss << newObject; |
| 7402 | 1 | } | |
| 7403 | |||
| 7404 |
3/3✓ Branch 1 taken 59972 times.
✓ Branch 3 taken 16 times.
✓ Branch 4 taken 59956 times.
|
59972 | } else if (iddname == "OS:Fan:ConstantVolume") { |
| 7405 |
3/3✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
✓ Branch 7 taken 16 times.
|
16 | std::string fanHandleStr = object.getString(0).get(); |
| 7406 |
3/3✓ Branch 4 taken 16 times.
✓ Branch 7 taken 14 times.
✓ Branch 8 taken 2 times.
|
16 | if (std::find(packagedFanCVHandleStrs.cbegin(), packagedFanCVHandleStrs.cend(), fanHandleStr) == packagedFanCVHandleStrs.cend()) { |
| 7407 |
1/1✓ Branch 1 taken 14 times.
|
14 | ss << object; |
| 7408 | } else { | ||
| 7409 |
8/8✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
✓ Branch 13 taken 2 times.
✓ Branch 17 taken 2 times.
✓ Branch 20 taken 2 times.
✓ Branch 23 taken 2 times.
|
2 | LOG(Warn, "Fan:ConstantVolume " |
| 7410 | << object.nameString() | ||
| 7411 | << " is used in a Packaged System (PTAC or PTHP) that does not have a Supply Air Fan Operating Mode Schedule. " | ||
| 7412 | "In 22.1.0 this would effectively, and mistakenly, function as a cycling fan, but this is now disallowed in E+ 22.2.0. " | ||
| 7413 | "In order to retain a similar functionality and energy usage, this will be replaced by a Fan:SystemModel " | ||
| 7414 | "with an always Off Schedule (cycling fan, similar to a Fan:OnOff)"); | ||
| 7415 |
4/4✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
|
2 | IdfObject newObject(idd_3_5_0.getObject("OS:Fan:SystemModel").get()); |
| 7416 | // Handle | ||
| 7417 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
|
4 | if ((value = object.getString(0))) { |
| 7418 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | newObject.setString(0, value.get()); |
| 7419 | } | ||
| 7420 | |||
| 7421 | // Name | ||
| 7422 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
|
4 | if ((value = object.getString(1))) { |
| 7423 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | newObject.setString(1, value.get()); |
| 7424 | } | ||
| 7425 | |||
| 7426 | // Availability Schedule Name | ||
| 7427 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
|
4 | if ((value = object.getString(2))) { |
| 7428 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | newObject.setString(2, value.get()); |
| 7429 | } | ||
| 7430 | |||
| 7431 | // Note the use of "true" to return default. Fan:ConstantVolume has way more defaulted fields, while Fan:SystemModel adheres to the newer | ||
| 7432 | // "make \required-field and hardcode in ctor" doctrine, AND has different defaults than Fan:ConstantVolume. So we do this to fulfil two | ||
| 7433 | // goals: Put a value in all required-fields AND set the same values | ||
| 7434 | // Fan Total Efficiency | ||
| 7435 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
|
4 | if ((value = object.getString(3, true))) { |
| 7436 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | newObject.setString(15, value.get()); |
| 7437 | } | ||
| 7438 | |||
| 7439 | // Pressure Rise | ||
| 7440 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
|
4 | if ((value = object.getString(4, true))) { |
| 7441 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | newObject.setString(8, value.get()); |
| 7442 | } | ||
| 7443 | |||
| 7444 | // Maximum Flow Rate | ||
| 7445 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
|
4 | if ((value = object.getString(5, true))) { |
| 7446 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | newObject.setString(5, value.get()); |
| 7447 | } | ||
| 7448 | |||
| 7449 | // Motor Efficiency | ||
| 7450 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
|
4 | if ((value = object.getString(6, true))) { |
| 7451 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | newObject.setString(9, value.get()); |
| 7452 | } | ||
| 7453 | |||
| 7454 | // Motor In Airstream Fraction | ||
| 7455 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
|
4 | if ((value = object.getString(7, true))) { |
| 7456 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | newObject.setString(10, value.get()); |
| 7457 | } | ||
| 7458 | |||
| 7459 | // Nodes should be blank since it's inside a containing ZoneHVAC | ||
| 7460 | // Air Inlet Node Name | ||
| 7461 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
|
4 | if ((value = object.getString(8))) { |
| 7462 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | newObject.setString(3, value.get()); |
| 7463 | } | ||
| 7464 | |||
| 7465 | // Air Outlet Node Name | ||
| 7466 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
|
4 | if ((value = object.getString(9))) { |
| 7467 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | newObject.setString(4, value.get()); |
| 7468 | } | ||
| 7469 | |||
| 7470 | // End-Use Subcategory | ||
| 7471 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
|
4 | if ((value = object.getString(10, true))) { |
| 7472 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | newObject.setString(21, value.get()); |
| 7473 | } | ||
| 7474 | |||
| 7475 | // Speed Control Method | ||
| 7476 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | newObject.setString(6, "Discrete"); |
| 7477 | |||
| 7478 | // Electric Power Minimum Flow Rate Fraction | ||
| 7479 |
1/1✓ Branch 1 taken 2 times.
|
2 | newObject.setDouble(7, 0.0); |
| 7480 | |||
| 7481 | // Design Electric Power Consumption | ||
| 7482 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
4 | newObject.setString(11, "Autosize"); |
| 7483 | |||
| 7484 | // Design Power Sizing Method | ||
| 7485 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | newObject.setString(12, "TotalEfficiencyAndPressure"); |
| 7486 | |||
| 7487 | // Electric Power Per Unit Flow Rate (not used given Power Sizing Method, but required-field & set in Ctor) | ||
| 7488 |
1/1✓ Branch 1 taken 2 times.
|
2 | newObject.setDouble(13, 840.0); |
| 7489 | |||
| 7490 | // Electric Power Per Unit Flow Rate Per Unit Pressure (not used given Power Sizing Method, but required-field & set in Ctor) | ||
| 7491 |
1/1✓ Branch 1 taken 2 times.
|
2 | newObject.setDouble(14, 1.66667); |
| 7492 | |||
| 7493 | // Electric Power Function of Flow Fraction Curve Name | ||
| 7494 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
4 | newObject.setString(16, ""); |
| 7495 | |||
| 7496 | // Night Ventilation Mode Pressure Rise | ||
| 7497 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
4 | newObject.setString(17, ""); |
| 7498 | |||
| 7499 | // Night Ventilation Mode Flow Fraction | ||
| 7500 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
4 | newObject.setString(18, ""); |
| 7501 | |||
| 7502 | // Motor Loss Zone Name | ||
| 7503 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | newObject.setString(19, ""); |
| 7504 | |||
| 7505 | // Motor Loss Radiative Fraction | ||
| 7506 |
1/1✓ Branch 1 taken 2 times.
|
2 | newObject.setDouble(20, 0.0); |
| 7507 | |||
| 7508 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | m_refactored.push_back(RefactoredObjectData(object, newObject)); |
| 7509 |
1/1✓ Branch 1 taken 2 times.
|
2 | ss << newObject; |
| 7510 | 2 | } | |
| 7511 | |||
| 7512 | // No-op | ||
| 7513 | 16 | } else { | |
| 7514 |
1/1✓ Branch 1 taken 59956 times.
|
59956 | ss << object; |
| 7515 | } | ||
| 7516 | 61896 | } | |
| 7517 | |||
| 7518 |
1/1✓ Branch 1 taken 86 times.
|
172 | return ss.str(); |
| 7519 | |||
| 7520 | 662 | } // end update_3_4_0_to_3_5_0 | |
| 7521 | |||
| 7522 | 89 | std::string VersionTranslator::update_3_5_0_to_3_5_1(const IdfFile& idf_3_5_0, const IddFileAndFactoryWrapper& idd_3_5_1) { | |
| 7523 |
1/1✓ Branch 1 taken 89 times.
|
89 | std::stringstream ss; |
| 7524 | 89 | boost::optional<std::string> value; | |
| 7525 | |||
| 7526 |
4/4✓ Branch 1 taken 89 times.
✓ Branch 4 taken 89 times.
✓ Branch 7 taken 89 times.
✓ Branch 10 taken 89 times.
|
89 | ss << idf_3_5_0.header() << '\n' << '\n'; |
| 7527 |
2/2✓ Branch 1 taken 89 times.
✓ Branch 4 taken 89 times.
|
89 | IdfFile targetIdf(idd_3_5_1.iddFile()); |
| 7528 |
3/3✓ Branch 1 taken 89 times.
✓ Branch 4 taken 89 times.
✓ Branch 7 taken 89 times.
|
89 | ss << targetIdf.versionObject().get(); |
| 7529 | |||
| 7530 |
3/3✓ Branch 1 taken 89 times.
✓ Branch 8 taken 61829 times.
✓ Branch 9 taken 89 times.
|
61918 | for (const IdfObject& object : idf_3_5_0.objects()) { |
| 7531 |
2/2✓ Branch 1 taken 61829 times.
✓ Branch 4 taken 61829 times.
|
61829 | auto iddname = object.iddObject().name(); |
| 7532 | |||
| 7533 |
3/3✓ Branch 1 taken 61829 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 61828 times.
|
61829 | if (iddname == "OS:UnitarySystemPerformance:Multispeed") { |
| 7534 | |||
| 7535 | // 1 Field has been added from 3.5.0 to 3.5.1: | ||
| 7536 | // ---------------------------------------------- | ||
| 7537 | // * No Load Supply Air Flow Rate Ratio * 3 | ||
| 7538 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto iddObject = idd_3_5_1.getObject(iddname); |
| 7539 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfObject newObject(iddObject.get()); |
| 7540 | |||
| 7541 |
3/3✓ Branch 1 taken 8 times.
✓ Branch 3 taken 7 times.
✓ Branch 4 taken 1 time.
|
8 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 7542 |
2/3✓ Branch 1 taken 7 times.
✓ Branch 5 taken 7 times.
✗ Branch 6 not taken.
|
14 | if ((value = object.getString(i))) { |
| 7543 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 4 times.
|
7 | if (i < 3) { |
| 7544 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | newObject.setString(i, value.get()); |
| 7545 | } else { | ||
| 7546 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | newObject.setString(i + 1, value.get()); |
| 7547 | } | ||
| 7548 | } | ||
| 7549 | } | ||
| 7550 | |||
| 7551 |
1/1✓ Branch 1 taken 1 time.
|
1 | newObject.setDouble(3, 1.0); |
| 7552 | |||
| 7553 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | m_refactored.push_back(RefactoredObjectData(object, newObject)); |
| 7554 |
1/1✓ Branch 1 taken 1 time.
|
1 | ss << newObject; |
| 7555 | |||
| 7556 | // No-op | ||
| 7557 | 1 | } else { | |
| 7558 |
1/1✓ Branch 1 taken 61828 times.
|
61828 | ss << object; |
| 7559 | } | ||
| 7560 | 61918 | } | |
| 7561 | |||
| 7562 |
1/1✓ Branch 1 taken 89 times.
|
178 | return ss.str(); |
| 7563 | |||
| 7564 | 89 | } // end update_3_5_0_to_3_5_1 | |
| 7565 | |||
| 7566 | 89 | std::string VersionTranslator::update_3_5_1_to_3_6_0(const IdfFile& idf_3_5_1, const IddFileAndFactoryWrapper& idd_3_6_0) { | |
| 7567 |
1/1✓ Branch 1 taken 89 times.
|
89 | std::stringstream ss; |
| 7568 | 89 | boost::optional<std::string> value; | |
| 7569 | |||
| 7570 |
4/4✓ Branch 1 taken 89 times.
✓ Branch 4 taken 89 times.
✓ Branch 7 taken 89 times.
✓ Branch 10 taken 89 times.
|
89 | ss << idf_3_5_1.header() << '\n' << '\n'; |
| 7571 |
2/2✓ Branch 1 taken 89 times.
✓ Branch 4 taken 89 times.
|
89 | IdfFile targetIdf(idd_3_6_0.iddFile()); |
| 7572 |
3/3✓ Branch 1 taken 89 times.
✓ Branch 4 taken 89 times.
✓ Branch 7 taken 89 times.
|
89 | ss << targetIdf.versionObject().get(); |
| 7573 | |||
| 7574 |
3/3✓ Branch 1 taken 89 times.
✓ Branch 8 taken 61829 times.
✓ Branch 9 taken 89 times.
|
61918 | for (const IdfObject& object : idf_3_5_1.objects()) { |
| 7575 |
2/2✓ Branch 1 taken 61829 times.
✓ Branch 4 taken 61829 times.
|
61829 | auto iddname = object.iddObject().name(); |
| 7576 | |||
| 7577 |
3/3✓ Branch 1 taken 61829 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 61828 times.
|
61829 | if (iddname == "OS:GroundHeatExchanger:HorizontalTrench") { |
| 7578 | |||
| 7579 | // Kusuda fields get moved over to OS:Site:GroundTemperature:Undisturbed:KusudaAchenbach | ||
| 7580 | |||
| 7581 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto iddObject = idd_3_6_0.getObject(iddname); |
| 7582 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfObject ghxObject(iddObject.get()); |
| 7583 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
|
1 | IdfObject kusudaObject(idd_3_6_0.getObject("OS:Site:GroundTemperature:Undisturbed:KusudaAchenbach").get()); |
| 7584 | |||
| 7585 |
3/3✓ Branch 1 taken 25 times.
✓ Branch 3 taken 24 times.
✓ Branch 4 taken 1 time.
|
25 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 7586 |
2/2✓ Branch 0 taken 19 times.
✓ Branch 1 taken 5 times.
|
24 | if (i < 19) { |
| 7587 |
2/3✓ Branch 1 taken 19 times.
✓ Branch 5 taken 19 times.
✗ Branch 6 not taken.
|
38 | if ((value = object.getString(i))) { |
| 7588 |
2/2✓ Branch 1 taken 19 times.
✓ Branch 4 taken 19 times.
|
19 | ghxObject.setString(i, value.get()); |
| 7589 |
6/6✓ Branch 0 taken 18 times.
✓ Branch 1 taken 1 time.
✓ Branch 2 taken 17 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 5 taken 16 times.
|
19 | if (((i == 11) || (i == 12) || (i == 13))) { // Soil xxx |
| 7590 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | kusudaObject.setString(i - 9, value.get()); |
| 7591 | } | ||
| 7592 | } | ||
| 7593 |
2/2✓ Branch 0 taken 1 time.
✓ Branch 1 taken 4 times.
|
5 | } else if (i == 19) { // Undisturbed Ground Temperature Model |
| 7594 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | ghxObject.setString(i, kusudaObject.getString(0).get()); |
| 7595 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 1 time.
|
4 | } else if (i < 23) { // Kusuda-Achenbach xxx |
| 7596 |
2/3✓ Branch 1 taken 3 times.
✓ Branch 5 taken 3 times.
✗ Branch 6 not taken.
|
6 | if ((value = object.getString(i))) { |
| 7597 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | kusudaObject.setString(i - 15, value.get()); |
| 7598 | } | ||
| 7599 |
1/2✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
|
1 | } else if (i == 23) { // Evapotranspiration Ground Cover Parameter |
| 7600 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 5 taken 1 time.
✗ Branch 6 not taken.
|
2 | if ((value = object.getString(i))) { |
| 7601 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | ghxObject.setString(20, value.get()); |
| 7602 | } | ||
| 7603 | } | ||
| 7604 | } | ||
| 7605 | |||
| 7606 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | m_refactored.push_back(RefactoredObjectData(object, ghxObject)); |
| 7607 |
1/1✓ Branch 1 taken 1 time.
|
1 | m_new.push_back(kusudaObject); |
| 7608 | |||
| 7609 |
1/1✓ Branch 1 taken 1 time.
|
1 | ss << ghxObject; |
| 7610 |
1/1✓ Branch 1 taken 1 time.
|
1 | ss << kusudaObject; |
| 7611 | |||
| 7612 | // No-op | ||
| 7613 | 1 | } else { | |
| 7614 |
1/1✓ Branch 1 taken 61828 times.
|
61828 | ss << object; |
| 7615 | } | ||
| 7616 | 61918 | } | |
| 7617 | |||
| 7618 |
1/1✓ Branch 1 taken 89 times.
|
178 | return ss.str(); |
| 7619 | |||
| 7620 | 89 | } // end update_3_5_1_to_3_6_0 | |
| 7621 | |||
| 7622 | struct CoilLatentTransitionInfo | ||
| 7623 | { | ||
| 7624 | enum class ParentType | ||
| 7625 | { | ||
| 7626 | Unknown = -1, | ||
| 7627 | AirLoopHVACUnitary, | ||
| 7628 | ZoneWAHP | ||
| 7629 | }; | ||
| 7630 | 18 | static ParentType objectParentType(const IdfObject& parentObject) { | |
| 7631 |
2/2✓ Branch 1 taken 18 times.
✓ Branch 4 taken 18 times.
|
18 | const std::string iddname = parentObject.iddObject().name(); |
| 7632 |
3/3✓ Branch 1 taken 18 times.
✓ Branch 3 taken 16 times.
✓ Branch 4 taken 2 times.
|
18 | if (iddname == "OS:AirLoopHVAC:UnitarySystem") { |
| 7633 | 16 | return ParentType::AirLoopHVACUnitary; | |
| 7634 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
|
2 | } else if (iddname == "OS:ZoneHVAC:WaterToAirHeatPump") { |
| 7635 | 2 | return ParentType::ZoneWAHP; | |
| 7636 | } | ||
| 7637 | ✗ | return ParentType::Unknown; | |
| 7638 | 18 | }; | |
| 7639 | |||
| 7640 | public: | ||
| 7641 | ParentType parentType; | ||
| 7642 | std::string parentName; | ||
| 7643 | std::string heatingCoilType; | ||
| 7644 | std::string coolingCoilType; | ||
| 7645 | std::string heatingCoilName; | ||
| 7646 | std::string coolingCoilName; | ||
| 7647 | double maxCyclingRate = 2.5; // Nmax, in /hr | ||
| 7648 | double heatPumpTimeConst = 60.0; // tau, in s | ||
| 7649 | double fractionOnCycle = 0.01; | ||
| 7650 | double hpDelayTime = 60.0; | ||
| 7651 | |||
| 7652 | // Helpers | ||
| 7653 | static std::vector<CoilLatentTransitionInfo>::iterator findFromParent(std::vector<CoilLatentTransitionInfo>& infos, | ||
| 7654 | const IdfObject& parentObject); | ||
| 7655 | static std::vector<CoilLatentTransitionInfo>::iterator findFromCoolingCoil(std::vector<CoilLatentTransitionInfo>& infos, | ||
| 7656 | const IdfObject& coilObject); | ||
| 7657 | static std::vector<CoilLatentTransitionInfo>::iterator findFromHeatingCoil(std::vector<CoilLatentTransitionInfo>& infos, | ||
| 7658 | const IdfObject& coilObject); | ||
| 7659 | |||
| 7660 | static IdfObject defaultHeatPumpCoilPLFCorrelationCurve(const IddFileAndFactoryWrapper& idd_3_7_0, const std::string& name, | ||
| 7661 | double maximumCyclingRatePerHour = 2.5, double heatPumpTimeConstantSeconds = 60.0); | ||
| 7662 | |||
| 7663 | 9 | bool isCurveCreationNeeded() const { | |
| 7664 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 2 taken 3 times.
|
15 | return (heatingCoilType == "OS:Coil:Heating:WaterToAirHeatPump:EquationFit" || // |
| 7665 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 2 taken 5 times.
|
15 | coolingCoilType == "OS:Coil:Cooling:WaterToAirHeatPump:EquationFit"); |
| 7666 | // OS:Coil:Cooling:WaterToAirHeatPump:VariableSpeedEquationFit, and OS:Coil:Cooling:DX:VariableSpeed already have a PLF curve | ||
| 7667 | // OS:Coil:Heating:WaterToAirHeatPump:VariableSpeedEquationFit does not have any change | ||
| 7668 | } | ||
| 7669 | |||
| 7670 | IdfObject createCurveLinear(const IddFileAndFactoryWrapper& idd_3_7_0) const; | ||
| 7671 | |||
| 7672 | 10 | std::string curveName() const { | |
| 7673 | 20 | return fmt::format("{}-AutogeneratedPLFCurve", parentName); | |
| 7674 | } | ||
| 7675 | |||
| 7676 | private: | ||
| 7677 | mutable boost::optional<IdfObject> cachedCurveLinear_; | ||
| 7678 | }; | ||
| 7679 | |||
| 7680 | 18 | std::vector<CoilLatentTransitionInfo>::iterator CoilLatentTransitionInfo::findFromParent(std::vector<CoilLatentTransitionInfo>& infos, | |
| 7681 | const IdfObject& parentObject) { | ||
| 7682 | |||
| 7683 |
1/1✓ Branch 1 taken 18 times.
|
18 | ParentType pType = objectParentType(parentObject); |
| 7684 |
1/1✓ Branch 1 taken 18 times.
|
18 | const auto name = parentObject.nameString(); |
| 7685 | auto it = | ||
| 7686 |
4/5✓ Branch 0 taken 19 times.
✗ Branch 1 not taken.
✓ Branch 3 taken 9 times.
✓ Branch 4 taken 10 times.
✓ Branch 8 taken 18 times.
|
37 | std::find_if(infos.begin(), infos.end(), [&pType, &name](auto& info) { return (info.parentType == pType) && (info.parentName == name); }); |
| 7687 | 18 | return it; | |
| 7688 | 18 | } | |
| 7689 | |||
| 7690 | 13 | std::vector<CoilLatentTransitionInfo>::iterator CoilLatentTransitionInfo::findFromCoolingCoil(std::vector<CoilLatentTransitionInfo>& infos, | |
| 7691 | const IdfObject& coilObject) { | ||
| 7692 | |||
| 7693 |
1/1✓ Branch 3 taken 13 times.
|
13 | auto it = std::find_if(infos.begin(), infos.end(), [&coilObject](auto& info) { |
| 7694 |
11/19✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
✓ Branch 7 taken 9 times.
✓ Branch 8 taken 5 times.
✓ Branch 10 taken 9 times.
✓ Branch 13 taken 7 times.
✓ Branch 14 taken 2 times.
✓ Branch 15 taken 9 times.
✓ Branch 16 taken 5 times.
✓ Branch 18 taken 14 times.
✗ Branch 19 not taken.
✓ Branch 21 taken 14 times.
✗ Branch 22 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
|
14 | return (info.coolingCoilType == coilObject.iddObject().name()) && (info.coolingCoilName == coilObject.nameString()); |
| 7695 | }); | ||
| 7696 | 13 | return it; | |
| 7697 | } | ||
| 7698 | |||
| 7699 | 6 | std::vector<CoilLatentTransitionInfo>::iterator CoilLatentTransitionInfo::findFromHeatingCoil(std::vector<CoilLatentTransitionInfo>& infos, | |
| 7700 | const IdfObject& coilObject) { | ||
| 7701 | |||
| 7702 |
1/1✓ Branch 3 taken 6 times.
|
6 | auto it = std::find_if(infos.begin(), infos.end(), [&coilObject](auto& info) { |
| 7703 |
11/19✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 4 times.
✓ Branch 8 taken 2 times.
✓ Branch 10 taken 4 times.
✓ Branch 13 taken 3 times.
✓ Branch 14 taken 1 time.
✓ Branch 15 taken 4 times.
✓ Branch 16 taken 2 times.
✓ Branch 18 taken 6 times.
✗ Branch 19 not taken.
✓ Branch 21 taken 6 times.
✗ Branch 22 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
|
6 | return (info.heatingCoilType == coilObject.iddObject().name()) && (info.heatingCoilName == coilObject.nameString()); |
| 7704 | }); | ||
| 7705 | 6 | return it; | |
| 7706 | } | ||
| 7707 | |||
| 7708 | 10 | IdfObject CoilLatentTransitionInfo::defaultHeatPumpCoilPLFCorrelationCurve(const IddFileAndFactoryWrapper& idd_3_7_0, const std::string& name, | |
| 7709 | double maximumCyclingRatePerHour, double heatPumpTimeConstantSeconds) { | ||
| 7710 | |||
| 7711 | 10 | const double A = 4 * (heatPumpTimeConstantSeconds / 3600.0) * maximumCyclingRatePerHour; | |
| 7712 | 10 | const double Cd = A * (1 - std::exp(-1 / A)); | |
| 7713 | |||
| 7714 |
2/2✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
|
10 | auto iddObject = idd_3_7_0.getObject("OS:Curve:Linear"); |
| 7715 |
2/2✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
|
10 | IdfObject curveObject(iddObject.get()); |
| 7716 |
2/2✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
|
10 | const std::string uuid = toString(createUUID()); |
| 7717 |
1/1✓ Branch 1 taken 10 times.
|
10 | curveObject.setString(0, uuid); |
| 7718 |
1/1✓ Branch 1 taken 10 times.
|
10 | curveObject.setString(1, name); |
| 7719 |
1/1✓ Branch 1 taken 10 times.
|
10 | curveObject.setDouble(2, (1 - Cd)); |
| 7720 |
1/1✓ Branch 1 taken 10 times.
|
10 | curveObject.setDouble(3, Cd); |
| 7721 | // Min/Max Value of x | ||
| 7722 |
1/1✓ Branch 1 taken 10 times.
|
10 | curveObject.setDouble(4, 0.0); |
| 7723 |
1/1✓ Branch 1 taken 10 times.
|
10 | curveObject.setDouble(5, 1.0); |
| 7724 | // Min/max curve output | ||
| 7725 |
1/1✓ Branch 1 taken 10 times.
|
10 | curveObject.setDouble(6, 0.0); |
| 7726 |
1/1✓ Branch 1 taken 10 times.
|
10 | curveObject.setDouble(7, 1.0); |
| 7727 | // Input Unit type for X | ||
| 7728 |
2/2✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
|
20 | curveObject.setString(8, "Dimensionless"); |
| 7729 | // Output Unit type | ||
| 7730 |
2/2✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
|
10 | curveObject.setString(9, "Dimensionless"); |
| 7731 | 20 | return curveObject; | |
| 7732 | 10 | } | |
| 7733 | |||
| 7734 | 4 | IdfObject CoilLatentTransitionInfo::createCurveLinear(const IddFileAndFactoryWrapper& idd_3_7_0) const { | |
| 7735 |
1/2✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
|
4 | if (!cachedCurveLinear_) { |
| 7736 | cachedCurveLinear_ = | ||
| 7737 |
3/3✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
|
4 | CoilLatentTransitionInfo::defaultHeatPumpCoilPLFCorrelationCurve(idd_3_7_0, curveName(), maxCyclingRate, heatPumpTimeConst); |
| 7738 | } | ||
| 7739 | 4 | return *cachedCurveLinear_; | |
| 7740 | } | ||
| 7741 | |||
| 7742 | 117 | std::vector<CoilLatentTransitionInfo> preScanCoilLatentChanges(const IdfFile& idf_3_6_1) { | |
| 7743 | |||
| 7744 | static constexpr std::array<std::string_view, 2> heatingCoilTypesChanged{"OS:Coil:Heating:WaterToAirHeatPump:EquationFit", | ||
| 7745 | "OS:Coil:Heating:WaterToAirHeatPump:VariableSpeedEquationFit"}; | ||
| 7746 | static constexpr std::array<std::string_view, 3> coolingCoilTypesChanged{"OS:Coil:Cooling:WaterToAirHeatPump:EquationFit", | ||
| 7747 | "OS:Coil:Cooling:WaterToAirHeatPump:VariableSpeedEquationFit", | ||
| 7748 | "OS:Coil:Cooling:DX:VariableSpeed"}; | ||
| 7749 | |||
| 7750 | 117 | std::vector<CoilLatentTransitionInfo> result; | |
| 7751 | |||
| 7752 |
3/3✓ Branch 1 taken 117 times.
✓ Branch 8 taken 64251 times.
✓ Branch 9 taken 117 times.
|
64368 | for (const IdfObject& object : idf_3_6_1.objects()) { |
| 7753 |
2/2✓ Branch 1 taken 64251 times.
✓ Branch 4 taken 64251 times.
|
64251 | auto iddname = object.iddObject().name(); |
| 7754 | |||
| 7755 |
3/3✓ Branch 1 taken 64251 times.
✓ Branch 3 taken 16 times.
✓ Branch 4 taken 64235 times.
|
64251 | if (iddname == "OS:AirLoopHVAC:UnitarySystem") { |
| 7756 | |||
| 7757 | 16 | std::string heatingCoilType; | |
| 7758 | 16 | std::string heatingCoilName; | |
| 7759 | 16 | std::string coolingCoilType; | |
| 7760 | 16 | std::string coolingCoilName; | |
| 7761 | |||
| 7762 | // 11 - Heating Coil Name | ||
| 7763 |
2/3✓ Branch 1 taken 16 times.
✓ Branch 3 taken 16 times.
✗ Branch 4 not taken.
|
32 | if (auto handleStr_ = object.getString(11)) { |
| 7764 |
5/5✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
✓ Branch 7 taken 16 times.
✓ Branch 10 taken 7 times.
✓ Branch 11 taken 9 times.
|
32 | if (auto coilObject_ = idf_3_6_1.getObject(toUUID(*handleStr_))) { |
| 7765 |
2/2✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
|
7 | heatingCoilName = coilObject_->nameString(); |
| 7766 |
3/3✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
✓ Branch 7 taken 7 times.
|
7 | heatingCoilType = coilObject_->iddObject().name(); |
| 7767 | 16 | } | |
| 7768 | 16 | } | |
| 7769 | |||
| 7770 | // 13 - Cooling Coil Name | ||
| 7771 |
2/3✓ Branch 1 taken 16 times.
✓ Branch 3 taken 16 times.
✗ Branch 4 not taken.
|
32 | if (auto handleStr_ = object.getString(13)) { |
| 7772 |
5/5✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
✓ Branch 7 taken 16 times.
✓ Branch 10 taken 8 times.
✓ Branch 11 taken 8 times.
|
32 | if (auto coilObject_ = idf_3_6_1.getObject(toUUID(*handleStr_))) { |
| 7773 |
2/2✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
|
8 | coolingCoilName = coilObject_->nameString(); |
| 7774 |
3/3✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
✓ Branch 7 taken 8 times.
|
8 | coolingCoilType = coilObject_->iddObject().name(); |
| 7775 | 16 | } | |
| 7776 | 16 | } | |
| 7777 | |||
| 7778 | const bool hasHeatingChanges = | ||
| 7779 |
1/1✓ Branch 3 taken 16 times.
|
16 | (std::find(heatingCoilTypesChanged.cbegin(), heatingCoilTypesChanged.cend(), heatingCoilType) != heatingCoilTypesChanged.end()); |
| 7780 | const bool hasCoolingChanges = | ||
| 7781 |
1/1✓ Branch 3 taken 16 times.
|
16 | (std::find(coolingCoilTypesChanged.cbegin(), coolingCoilTypesChanged.cend(), coolingCoilType) != coolingCoilTypesChanged.end()); |
| 7782 |
4/4✓ Branch 0 taken 12 times.
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 9 times.
|
16 | const bool infoNeeded = hasHeatingChanges || hasCoolingChanges; |
| 7783 | |||
| 7784 |
2/2✓ Branch 0 taken 9 times.
✓ Branch 1 taken 7 times.
|
16 | if (!infoNeeded) { |
| 7785 | 9 | continue; | |
| 7786 | } | ||
| 7787 | |||
| 7788 |
1/1✓ Branch 1 taken 7 times.
|
7 | CoilLatentTransitionInfo& info = result.emplace_back(); |
| 7789 | 7 | info.parentType = CoilLatentTransitionInfo::ParentType::AirLoopHVACUnitary; | |
| 7790 |
1/1✓ Branch 1 taken 7 times.
|
7 | info.parentName = object.nameString(); |
| 7791 | 7 | info.heatingCoilName = std::move(heatingCoilName); | |
| 7792 | 7 | info.heatingCoilType = std::move(heatingCoilType); | |
| 7793 | 7 | info.coolingCoilName = std::move(coolingCoilName); | |
| 7794 | 7 | info.coolingCoilType = std::move(coolingCoilType); | |
| 7795 | |||
| 7796 | // 38 - Maximum Cycling Rate | ||
| 7797 |
2/3✓ Branch 1 taken 7 times.
✓ Branch 3 taken 7 times.
✗ Branch 4 not taken.
|
14 | if (auto val_ = object.getDouble(38)) { |
| 7798 |
1/1✓ Branch 1 taken 7 times.
|
7 | info.maxCyclingRate = *val_; |
| 7799 | } | ||
| 7800 | |||
| 7801 | // 39 - Heat Pump Time Constant | ||
| 7802 |
2/3✓ Branch 1 taken 7 times.
✓ Branch 3 taken 7 times.
✗ Branch 4 not taken.
|
14 | if (auto val_ = object.getDouble(39)) { |
| 7803 |
1/1✓ Branch 1 taken 7 times.
|
7 | info.heatPumpTimeConst = *val_; |
| 7804 | } | ||
| 7805 | |||
| 7806 | // 40 - Fraction of On-Cycle Power Use | ||
| 7807 |
2/3✓ Branch 1 taken 7 times.
✓ Branch 3 taken 7 times.
✗ Branch 4 not taken.
|
14 | if (auto val_ = object.getDouble(40)) { |
| 7808 |
1/1✓ Branch 1 taken 7 times.
|
7 | info.fractionOnCycle = *val_; |
| 7809 | } | ||
| 7810 | |||
| 7811 | // 41 - Heat Pump Fan Delay Time | ||
| 7812 |
2/3✓ Branch 1 taken 7 times.
✓ Branch 3 taken 7 times.
✗ Branch 4 not taken.
|
14 | if (auto val_ = object.getDouble(41)) { |
| 7813 |
1/1✓ Branch 1 taken 7 times.
|
7 | info.hpDelayTime = *val_; |
| 7814 | } | ||
| 7815 | |||
| 7816 |
11/11✓ Branch 1 taken 7 times.
✓ Branch 2 taken 9 times.
✓ Branch 4 taken 7 times.
✓ Branch 5 taken 9 times.
✓ Branch 7 taken 7 times.
✓ Branch 8 taken 9 times.
✓ Branch 10 taken 7 times.
✓ Branch 11 taken 9 times.
✓ Branch 13 taken 64235 times.
✓ Branch 15 taken 2 times.
✓ Branch 16 taken 64233 times.
|
64278 | } else if (iddname == "OS:ZoneHVAC:WaterToAirHeatPump") { |
| 7817 | |||
| 7818 | 2 | std::string heatingCoilType; | |
| 7819 | 2 | std::string heatingCoilName; | |
| 7820 | 2 | std::string coolingCoilType; | |
| 7821 | 2 | std::string coolingCoilName; | |
| 7822 | |||
| 7823 | // 13 - Heating Coil Name | ||
| 7824 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
|
4 | if (auto handleStr_ = object.getString(13)) { |
| 7825 |
4/5✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
✗ Branch 11 not taken.
|
4 | if (auto coilObject_ = idf_3_6_1.getObject(toUUID(*handleStr_))) { |
| 7826 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | heatingCoilName = coilObject_->nameString(); |
| 7827 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
|
2 | heatingCoilType = coilObject_->iddObject().name(); |
| 7828 | 2 | } | |
| 7829 | 2 | } | |
| 7830 | |||
| 7831 | // 14 - Cooling Coil Name | ||
| 7832 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
|
4 | if (auto handleStr_ = object.getString(14)) { |
| 7833 |
4/5✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
✗ Branch 11 not taken.
|
4 | if (auto coilObject_ = idf_3_6_1.getObject(toUUID(*handleStr_))) { |
| 7834 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | coolingCoilName = coilObject_->nameString(); |
| 7835 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
|
2 | coolingCoilType = coilObject_->iddObject().name(); |
| 7836 | 2 | } | |
| 7837 | 2 | } | |
| 7838 | |||
| 7839 | const bool hasHeatingChanges = | ||
| 7840 |
1/1✓ Branch 3 taken 2 times.
|
2 | (std::find(heatingCoilTypesChanged.cbegin(), heatingCoilTypesChanged.cend(), heatingCoilType) != heatingCoilTypesChanged.end()); |
| 7841 | const bool hasCoolingChanges = | ||
| 7842 |
1/1✓ Branch 3 taken 2 times.
|
2 | (std::find(coolingCoilTypesChanged.cbegin(), coolingCoilTypesChanged.cend(), coolingCoilType) != coolingCoilTypesChanged.end()); |
| 7843 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
2 | const bool infoNeeded = hasHeatingChanges || hasCoolingChanges; |
| 7844 | |||
| 7845 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
|
2 | if (!infoNeeded) { |
| 7846 | ✗ | continue; | |
| 7847 | } | ||
| 7848 | |||
| 7849 |
1/1✓ Branch 1 taken 2 times.
|
2 | CoilLatentTransitionInfo& info = result.emplace_back(); |
| 7850 | 2 | info.parentType = CoilLatentTransitionInfo::ParentType::ZoneWAHP; | |
| 7851 |
1/1✓ Branch 1 taken 2 times.
|
2 | info.parentName = object.nameString(); |
| 7852 | 2 | info.heatingCoilName = std::move(heatingCoilName); | |
| 7853 | 2 | info.heatingCoilType = std::move(heatingCoilType); | |
| 7854 | 2 | info.coolingCoilName = std::move(coolingCoilName); | |
| 7855 | 2 | info.coolingCoilType = std::move(coolingCoilType); | |
| 7856 | |||
| 7857 | // 15 - Maximum Cycling Rate | ||
| 7858 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
|
4 | if (auto val_ = object.getDouble(15)) { |
| 7859 |
1/1✓ Branch 1 taken 2 times.
|
2 | info.maxCyclingRate = *val_; |
| 7860 | } | ||
| 7861 | |||
| 7862 | // 16 - Heat Pump Time Constant | ||
| 7863 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
|
4 | if (auto val_ = object.getDouble(16)) { |
| 7864 |
1/1✓ Branch 1 taken 2 times.
|
2 | info.heatPumpTimeConst = *val_; |
| 7865 | } | ||
| 7866 | |||
| 7867 | // 17 - Fraction of On-Cycle Power Use | ||
| 7868 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
|
4 | if (auto val_ = object.getDouble(17)) { |
| 7869 |
1/1✓ Branch 1 taken 2 times.
|
2 | info.fractionOnCycle = *val_; |
| 7870 | } | ||
| 7871 | |||
| 7872 | // 18 - Heat Pump Fan Delay Time | ||
| 7873 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
|
4 | if (auto val_ = object.getDouble(18)) { |
| 7874 |
1/1✓ Branch 1 taken 2 times.
|
2 | info.hpDelayTime = *val_; |
| 7875 | } | ||
| 7876 | 2 | } | |
| 7877 | |||
| 7878 | // AIRLOOPHVAC:UNITARYHEATPUMP:WATERTOAIR is not wrapped | ||
| 7879 | 64368 | } | |
| 7880 | 117 | return result; | |
| 7881 | ✗ | } | |
| 7882 | |||
| 7883 | 117 | std::string VersionTranslator::update_3_6_1_to_3_7_0(const IdfFile& idf_3_6_1, const IddFileAndFactoryWrapper& idd_3_7_0) { | |
| 7884 |
1/1✓ Branch 1 taken 117 times.
|
117 | std::stringstream ss; |
| 7885 | 117 | boost::optional<std::string> value; | |
| 7886 | |||
| 7887 |
4/4✓ Branch 1 taken 117 times.
✓ Branch 4 taken 117 times.
✓ Branch 7 taken 117 times.
✓ Branch 10 taken 117 times.
|
117 | ss << idf_3_6_1.header() << '\n' << '\n'; |
| 7888 |
2/2✓ Branch 1 taken 117 times.
✓ Branch 4 taken 117 times.
|
117 | IdfFile targetIdf(idd_3_7_0.iddFile()); |
| 7889 |
3/3✓ Branch 1 taken 117 times.
✓ Branch 4 taken 117 times.
✓ Branch 7 taken 117 times.
|
117 | ss << targetIdf.versionObject().get(); |
| 7890 | |||
| 7891 |
1/1✓ Branch 1 taken 117 times.
|
117 | std::vector<CoilLatentTransitionInfo> coilTransitionInfos = preScanCoilLatentChanges(idf_3_6_1); |
| 7892 | |||
| 7893 | 117 | constexpr std::array<std::pair<std::string_view, size_t>, 10> crankcaseCoilWithIndex{{ | |
| 7894 | {"OS:Coil:Cooling:DX:CurveFit:Performance", 3}, | ||
| 7895 | {"OS:Coil:Cooling:DX:SingleSpeed", 27}, | ||
| 7896 | {"OS:Coil:Cooling:DX:TwoStageWithHumidityControlMode", 6}, | ||
| 7897 | {"OS:Coil:Cooling:DX:MultiSpeed", 13}, | ||
| 7898 | {"OS:Coil:Heating:DX:SingleSpeed", 19}, | ||
| 7899 | {"OS:Coil:Heating:DX:MultiSpeed", 8}, | ||
| 7900 | {"OS:Coil:Heating:DX:VariableSpeed", 13}, | ||
| 7901 | {"OS:Coil:WaterHeating:AirToWaterHeatPump", 20}, | ||
| 7902 | {"OS:Coil:WaterHeating:AirToWaterHeatPump:VariableSpeed", 18}, | ||
| 7903 | {"OS:Coil:WaterHeating:AirToWaterHeatPump:Wrapped", 13}, | ||
| 7904 | }}; | ||
| 7905 | |||
| 7906 | // Making the map case-insensitive by providing a Comparator `IstringCompare` | ||
| 7907 | const std::map<std::string, std::string, openstudio::IstringCompare> replaceFuelTypesMap{{ | ||
| 7908 | {"Steam", "DistrictHeatingSteam"}, | ||
| 7909 | {"DistrictHeating", "DistrictHeatingWater"}, | ||
| 7910 | // Additionally, for UtilityBill, align the IDD choices to E+. This will also be covered by this | ||
| 7911 | {"Gas", "NaturalGas"}, | ||
| 7912 | {"FuelOil_1", "FuelOilNo1"}, | ||
| 7913 | {"FuelOil_2", "FuelOilNo2"}, | ||
| 7914 | {"OtherFuel_1", "OtherFuel1"}, | ||
| 7915 | {"OtherFuel_2", "OtherFuel2"}, | ||
| 7916 |
3/5✓ Branch 1 taken 117 times.
✓ Branch 3 taken 819 times.
✓ Branch 4 taken 117 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
1053 | }}; |
| 7917 | |||
| 7918 | const std::multimap<std::string, int> fuelTypeRenamesMap{{ | ||
| 7919 | ✗ | {"OS:OtherEquipment", 6}, // Fuel Type | |
| 7920 | ✗ | {"OS:Exterior:FuelEquipment", 4}, // Fuel Use Type | |
| 7921 | ✗ | {"OS:WaterHeater:Mixed", 11}, // Heater Fuel Type | |
| 7922 | ✗ | {"OS:WaterHeater:Mixed", 15}, // Off Cycle Parasitic Fuel Type | |
| 7923 | ✗ | {"OS:WaterHeater:Mixed", 18}, // On Cycle Parasitic Fuel Type | |
| 7924 | ✗ | {"OS:WaterHeater:Stratified", 17}, // Heater Fuel Type | |
| 7925 | ✗ | {"OS:WaterHeater:Stratified", 20}, // Off Cycle Parasitic Fuel Type | |
| 7926 | ✗ | {"OS:WaterHeater:Stratified", 24}, // On Cycle Parasitic Fuel Type | |
| 7927 | ✗ | {"OS:UtilityBill", 2}, // Fuel Type | |
| 7928 | ✗ | {"OS:Meter:Custom", 2}, // Fuel Type | |
| 7929 | ✗ | {"OS:Meter:CustomDecrement", 2}, // Fuel Type | |
| 7930 | ✗ | {"OS:EnergyManagementSystem:MeteredOutputVariable", 5}, // Resource Type | |
| 7931 | ✗ | {"OS:PythonPlugin:OutputVariable", 6}, // Resource Type | |
| 7932 |
3/5✓ Branch 1 taken 117 times.
✓ Branch 3 taken 1521 times.
✓ Branch 4 taken 117 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
1755 | }}; |
| 7933 | |||
| 7934 | 88 | auto checkIfReplaceNeeded = [replaceFuelTypesMap](const IdfObject& object, int fieldIndex) -> bool { | |
| 7935 |
2/3✓ Branch 1 taken 88 times.
✓ Branch 3 taken 88 times.
✗ Branch 4 not taken.
|
176 | if (boost::optional<std::string> fuelType_ = object.getString(fieldIndex)) { |
| 7936 |
2/2✓ Branch 1 taken 88 times.
✓ Branch 4 taken 88 times.
|
88 | return replaceFuelTypesMap.contains(*fuelType_); |
| 7937 | 88 | } | |
| 7938 | ✗ | return false; | |
| 7939 |
1/1✓ Branch 1 taken 117 times.
|
117 | }; |
| 7940 | |||
| 7941 | 24 | auto replaceForField = [&replaceFuelTypesMap](const IdfObject& object, IdfObject& newObject, int fieldIndex) -> void { | |
| 7942 |
2/3✓ Branch 1 taken 24 times.
✓ Branch 3 taken 24 times.
✗ Branch 4 not taken.
|
48 | if (boost::optional<std::string> fuelType_ = object.getString(fieldIndex)) { |
| 7943 |
2/2✓ Branch 1 taken 24 times.
✓ Branch 4 taken 24 times.
|
24 | auto it = replaceFuelTypesMap.find(*fuelType_); |
| 7944 |
1/2✓ Branch 2 taken 24 times.
✗ Branch 3 not taken.
|
24 | if (it != replaceFuelTypesMap.end()) { |
| 7945 |
14/14✓ Branch 1 taken 24 times.
✓ Branch 4 taken 24 times.
✓ Branch 7 taken 24 times.
✓ Branch 10 taken 24 times.
✓ Branch 13 taken 24 times.
✓ Branch 17 taken 24 times.
✓ Branch 20 taken 24 times.
✓ Branch 23 taken 24 times.
✓ Branch 26 taken 24 times.
✓ Branch 29 taken 24 times.
✓ Branch 32 taken 24 times.
✓ Branch 36 taken 24 times.
✓ Branch 39 taken 24 times.
✓ Branch 42 taken 24 times.
|
24 | LOG(Trace, "Replacing " << *fuelType_ << " with " << it->second << " at fieldIndex " << fieldIndex << " for " << object.nameString()); |
| 7946 |
1/1✓ Branch 2 taken 24 times.
|
24 | newObject.setString(fieldIndex, it->second); |
| 7947 | } | ||
| 7948 | 24 | } | |
| 7949 | 24 | }; | |
| 7950 | |||
| 7951 | /************************************************************************************************************************************************* | ||
| 7952 | * Output:Variable fuel * | ||
| 7953 | ************************************************************************************************************************************************/ | ||
| 7954 | |||
| 7955 |
4/7✓ Branch 0 taken 116 times.
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 116 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 116 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
117 | const static boost::regex re_strip_multiple_spaces("[' ']{2,}"); |
| 7956 | |||
| 7957 | // Making the map case-insensitive by providing a Comparator `IstringCompare` | ||
| 7958 | // https://github.com/NREL/EnergyPlus/blob/v9.4.0-IOFreeze/src/Transition/SupportFiles/Report%20Variables%209-3-0%20to%209-4-0.csv | ||
| 7959 | const static std::map<std::string, std::string, openstudio::IstringCompare> replaceOutputVariablesMap({ | ||
| 7960 | {"District Cooling Chilled Water Energy", "District Cooling Water Energy"}, | ||
| 7961 | {"District Cooling Chilled Water Rate", "District Cooling Water Rate"}, | ||
| 7962 | {"District Cooling Rate", "District Cooling Water Rate"}, | ||
| 7963 | {"District Cooling Inlet Temperature", "District Cooling Water Inlet Temperature"}, | ||
| 7964 | {"District Cooling Outlet Temperature", "District Cooling Water Outlet Temperature"}, | ||
| 7965 | {"District Cooling Mass Flow Rate", "District Cooling Water Mass Flow Rate"}, | ||
| 7966 | {"District Heating Hot Water Energy", "District Heating Water Energy"}, | ||
| 7967 | {"District Heating Hot Water Rate", "District Heating Water Rate"}, | ||
| 7968 | {"District Heating Rate", "District Heating Water Rate"}, | ||
| 7969 | {"District Heating Inlet Temperature", "District Heating Water Inlet Temperature"}, | ||
| 7970 | {"District Heating Outlet Temperature", "District Heating Water Outlet Temperature"}, | ||
| 7971 | {"District Heating Mass Flow Rate", "District Heating Water Mass Flow Rate"}, | ||
| 7972 |
5/10✓ Branch 0 taken 116 times.
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 116 times.
✗ Branch 4 not taken.
✓ Branch 7 taken 1392 times.
✓ Branch 8 taken 116 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
|
1625 | }); |
| 7973 | |||
| 7974 | /************************************************************************************************************************************************* | ||
| 7975 | * Output:Meter fuel types renames * | ||
| 7976 | ************************************************************************************************************************************************/ | ||
| 7977 | |||
| 7978 | const static std::array<std::pair<std::string, std::string>, 2> meterFuelTypesMap{{ | ||
| 7979 | {"DistrictHeating", "DistrictHeatingWater"}, | ||
| 7980 | {"Steam", "DistrictHeatingSteam"}, | ||
| 7981 |
5/12✓ Branch 0 taken 116 times.
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 116 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 116 times.
✓ Branch 9 taken 116 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
|
117 | }}; |
| 7982 | |||
| 7983 | // Could make it a static inside the lambda, except that it won't be reset so if you try to translate twice it fails | ||
| 7984 | 117 | std::string continuousSchHandleStr; | |
| 7985 | |||
| 7986 | 5 | auto getOrCreateAlwaysOnContinuousScheduleHandleStr = [this, &ss, &idf_3_6_1, &idd_3_7_0, &continuousSchHandleStr]() -> std::string { | |
| 7987 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 2 taken 3 times.
|
5 | if (!continuousSchHandleStr.empty()) { |
| 7988 |
6/6✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
✓ Branch 13 taken 2 times.
✓ Branch 16 taken 2 times.
|
2 | LOG(Trace, "Already found 'Always On Continuous' Schedule in model with handle " << continuousSchHandleStr); |
| 7989 |
1/1✓ Branch 1 taken 2 times.
|
2 | return continuousSchHandleStr; |
| 7990 | } | ||
| 7991 | |||
| 7992 |
1/1✓ Branch 1 taken 3 times.
|
3 | const std::string name = "Always On Continuous"; |
| 7993 | 3 | const double val = 1.0; | |
| 7994 | // Add an alwaysOnDiscreteSchedule if one does not already exist | ||
| 7995 |
7/7✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 10 taken 3 times.
✓ Branch 13 taken 3 times.
✓ Branch 23 taken 1 time.
✓ Branch 24 taken 2 times.
|
9 | for (const IdfObject& object : idf_3_6_1.getObjectsByType(idf_3_6_1.iddFile().getObject("OS:Schedule:Constant").get())) { |
| 7996 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | if (boost::optional<std::string> name_ = object.getString(1)) { |
| 7997 |
3/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 6 taken 1 time.
✗ Branch 7 not taken.
|
1 | if (istringEqual(name_.get(), name)) { |
| 7998 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | if (boost::optional<double> value = object.getDouble(3)) { |
| 7999 |
2/3✓ Branch 2 taken 1 time.
✓ Branch 5 taken 1 time.
✗ Branch 6 not taken.
|
1 | if (equal<double>(value.get(), val)) { |
| 8000 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | continuousSchHandleStr = object.getString(0).get(); // Store in state variable |
| 8001 |
6/6✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
✓ Branch 16 taken 1 time.
|
1 | LOG(Trace, "Found existing 'Always On Continuous' Schedule in model with handle " << continuousSchHandleStr); |
| 8002 |
1/1✓ Branch 1 taken 1 time.
|
2 | return continuousSchHandleStr; |
| 8003 | } | ||
| 8004 | } | ||
| 8005 | } | ||
| 8006 | 1 | } | |
| 8007 | 3 | } | |
| 8008 | |||
| 8009 |
4/4✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
|
4 | auto continuousSch = IdfObject(idd_3_7_0.getObject("OS:Schedule:Constant").get()); |
| 8010 | |||
| 8011 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | continuousSchHandleStr = toString(createUUID()); // Store in state variable |
| 8012 |
1/1✓ Branch 1 taken 2 times.
|
2 | continuousSch.setString(0, continuousSchHandleStr); |
| 8013 |
1/1✓ Branch 1 taken 2 times.
|
2 | continuousSch.setString(1, name); |
| 8014 |
1/1✓ Branch 1 taken 2 times.
|
2 | continuousSch.setDouble(3, val); |
| 8015 | |||
| 8016 |
4/4✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
|
4 | IdfObject typeLimits(idd_3_7_0.getObject("OS:ScheduleTypeLimits").get()); |
| 8017 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
|
2 | typeLimits.setString(0, toString(createUUID())); |
| 8018 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | typeLimits.setString(1, name + " Limits"); |
| 8019 |
1/1✓ Branch 1 taken 2 times.
|
2 | typeLimits.setDouble(2, 0.0); |
| 8020 |
1/1✓ Branch 1 taken 2 times.
|
2 | typeLimits.setDouble(3, 1.0); |
| 8021 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
4 | typeLimits.setString(4, "Continuous"); |
| 8022 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | typeLimits.setString(5, ""); |
| 8023 | |||
| 8024 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
|
2 | continuousSch.setString(2, typeLimits.getString(0).get()); |
| 8025 | |||
| 8026 |
1/1✓ Branch 1 taken 2 times.
|
2 | ss << continuousSch; |
| 8027 |
1/1✓ Branch 1 taken 2 times.
|
2 | ss << typeLimits; |
| 8028 | |||
| 8029 | // Register new objects | ||
| 8030 |
1/1✓ Branch 2 taken 2 times.
|
2 | m_new.emplace_back(std::move(continuousSch)); |
| 8031 |
1/1✓ Branch 2 taken 2 times.
|
2 | m_new.emplace_back(std::move(typeLimits)); |
| 8032 |
6/6✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
✓ Branch 13 taken 2 times.
✓ Branch 16 taken 2 times.
|
2 | LOG(Trace, "Created 'Always On Continuous' Schedule with handle " << continuousSchHandleStr); |
| 8033 | |||
| 8034 |
1/1✓ Branch 1 taken 2 times.
|
2 | return continuousSchHandleStr; |
| 8035 | 3 | }; | |
| 8036 | |||
| 8037 |
3/3✓ Branch 1 taken 117 times.
✓ Branch 8 taken 64251 times.
✓ Branch 9 taken 117 times.
|
64368 | for (const IdfObject& object : idf_3_6_1.objects()) { |
| 8038 |
2/2✓ Branch 1 taken 64251 times.
✓ Branch 4 taken 64251 times.
|
64251 | auto iddname = object.iddObject().name(); |
| 8039 | |||
| 8040 |
3/3✓ Branch 1 taken 64251 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 64249 times.
|
64251 | if (iddname == "OS:GroundHeatExchanger:Vertical") { |
| 8041 | |||
| 8042 | // 1 Field has been added from 3.6.1 to 3.7.0: | ||
| 8043 | // ------------------------------------------- | ||
| 8044 | // * Undisturbed Ground Temperature Model * 17 | ||
| 8045 |
1/1✓ Branch 1 taken 2 times.
|
2 | auto iddObject = idd_3_7_0.getObject(iddname); |
| 8046 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | IdfObject ghxObject(iddObject.get()); |
| 8047 |
4/4✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
|
2 | IdfObject kusudaObject(idd_3_7_0.getObject("OS:Site:GroundTemperature:Undisturbed:KusudaAchenbach").get()); |
| 8048 | |||
| 8049 |
3/3✓ Branch 1 taken 178 times.
✓ Branch 3 taken 176 times.
✓ Branch 4 taken 2 times.
|
178 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 8050 |
2/2✓ Branch 0 taken 34 times.
✓ Branch 1 taken 142 times.
|
176 | if (i < 17) { |
| 8051 |
2/3✓ Branch 1 taken 34 times.
✓ Branch 5 taken 34 times.
✗ Branch 6 not taken.
|
68 | if ((value = object.getString(i))) { |
| 8052 |
2/2✓ Branch 1 taken 34 times.
✓ Branch 4 taken 34 times.
|
34 | ghxObject.setString(i, value.get()); |
| 8053 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 32 times.
|
34 | if (i == 8) { // Soil Thermal Conductivity |
| 8054 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | kusudaObject.setString(i - 6, value.get()); |
| 8055 | } | ||
| 8056 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 32 times.
|
34 | if (i == 10) { // Average Soil Surface Temperature |
| 8057 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | kusudaObject.setString(i - 5, value.get()); |
| 8058 | } | ||
| 8059 | } | ||
| 8060 |
3/3✓ Branch 1 taken 34 times.
✓ Branch 3 taken 26 times.
✓ Branch 4 taken 8 times.
|
68 | if (boost::optional<double> _value = object.getDouble(i)) { |
| 8061 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 24 times.
|
26 | if (i == 9) { // Soil Specific Heat |
| 8062 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | kusudaObject.setDouble(i - 5, _value.get() / 920.0); |
| 8063 | } | ||
| 8064 | } | ||
| 8065 | } else { | ||
| 8066 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 140 times.
|
142 | if (i == 17) { // Undisturbed Ground Temperature Model |
| 8067 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
|
2 | ghxObject.setString(i, kusudaObject.getString(0).get()); |
| 8068 | } | ||
| 8069 |
2/3✓ Branch 1 taken 142 times.
✓ Branch 5 taken 142 times.
✗ Branch 6 not taken.
|
284 | if ((value = object.getString(i))) { |
| 8070 |
2/2✓ Branch 1 taken 142 times.
✓ Branch 4 taken 142 times.
|
142 | ghxObject.setString(i + 1, value.get()); |
| 8071 | } | ||
| 8072 | } | ||
| 8073 | } | ||
| 8074 | |||
| 8075 |
1/1✓ Branch 1 taken 2 times.
|
2 | kusudaObject.setDouble(3, 920.0); // Soil Density |
| 8076 |
1/1✓ Branch 1 taken 2 times.
|
2 | kusudaObject.setDouble(6, 3.2); // Average Amplitude of Surface Temperature |
| 8077 |
1/1✓ Branch 1 taken 2 times.
|
2 | kusudaObject.setDouble(7, 8.0); // Phase Shift of Minimum Surface Temperature |
| 8078 | |||
| 8079 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | m_refactored.push_back(RefactoredObjectData(object, ghxObject)); |
| 8080 |
1/1✓ Branch 1 taken 2 times.
|
2 | m_new.push_back(kusudaObject); |
| 8081 | |||
| 8082 |
1/1✓ Branch 1 taken 2 times.
|
2 | ss << ghxObject; |
| 8083 |
1/1✓ Branch 1 taken 2 times.
|
2 | ss << kusudaObject; |
| 8084 | |||
| 8085 |
8/8✓ Branch 4 taken 64249 times.
✓ Branch 6 taken 64248 times.
✓ Branch 7 taken 1 time.
✓ Branch 9 taken 64248 times.
✓ Branch 11 taken 1 time.
✓ Branch 12 taken 64247 times.
✓ Branch 13 taken 2 times.
✓ Branch 14 taken 64247 times.
|
64251 | } else if ((iddname == "OS:Coil:Cooling:DX:VariableSpeed:SpeedData") || (iddname == "OS:Coil:Heating:DX:VariableSpeed:SpeedData")) { |
| 8086 | |||
| 8087 | // The two coils have the new fields in the same location, with the same defaults | ||
| 8088 | |||
| 8089 | // Fields that have been added from 3.6.1 to 3.7.0: | ||
| 8090 | // ------------------------------------------------ | ||
| 8091 | // Heating: | ||
| 8092 | // * Rated Supply Fan Power Per Volume Flow Rate 2017 * 5 | ||
| 8093 | // * Rated Supply Fan Power Per Volume Flow Rate 2023 * 6 | ||
| 8094 | // Cooling: | ||
| 8095 | // * Rated Evaporator Fan Power Per Volume Flow Rate 2017 - 6 | ||
| 8096 | // * Rated Evaporator Fan Power Per Volume Flow Rate 2023 - 7 | ||
| 8097 | |||
| 8098 |
1/1✓ Branch 1 taken 2 times.
|
2 | const bool is_cooling = (iddname == "OS:Coil:Cooling:DX:VariableSpeed:SpeedData"); |
| 8099 |
2/2✓ Branch 0 taken 1 time.
✓ Branch 1 taken 1 time.
|
2 | const size_t insertionIndex = is_cooling ? 6 : 5; |
| 8100 | |||
| 8101 |
1/1✓ Branch 1 taken 2 times.
|
2 | auto iddObject = idd_3_7_0.getObject(iddname); |
| 8102 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | IdfObject newObject(iddObject.get()); |
| 8103 | |||
| 8104 |
3/3✓ Branch 1 taken 23 times.
✓ Branch 3 taken 21 times.
✓ Branch 4 taken 2 times.
|
23 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 8105 |
2/3✓ Branch 1 taken 21 times.
✓ Branch 5 taken 21 times.
✗ Branch 6 not taken.
|
42 | if ((value = object.getString(i))) { |
| 8106 |
2/2✓ Branch 0 taken 11 times.
✓ Branch 1 taken 10 times.
|
21 | if (i < insertionIndex) { |
| 8107 |
2/2✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
|
11 | newObject.setString(i, value.get()); |
| 8108 | } else { | ||
| 8109 |
2/2✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
|
10 | newObject.setString(i + 2, value.get()); |
| 8110 | } | ||
| 8111 | } | ||
| 8112 | } | ||
| 8113 | |||
| 8114 | // Rated Supply/Evaporator Fan Power Per Volume Flow Rate 2017 | ||
| 8115 |
1/1✓ Branch 1 taken 2 times.
|
2 | newObject.setDouble(insertionIndex, 773.3); |
| 8116 | |||
| 8117 | // Rated Supply/Evaporator Fan Power Per Volume Flow Rate 2023 | ||
| 8118 |
1/1✓ Branch 1 taken 2 times.
|
2 | newObject.setDouble(insertionIndex + 1, 934.4); |
| 8119 | |||
| 8120 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | m_refactored.push_back(RefactoredObjectData(object, newObject)); |
| 8121 |
1/1✓ Branch 1 taken 2 times.
|
2 | ss << newObject; |
| 8122 | |||
| 8123 |
3/3✓ Branch 3 taken 64247 times.
✓ Branch 5 taken 2 times.
✓ Branch 6 taken 64245 times.
|
64249 | } else if (iddname == "OS:Coil:Cooling:DX:TwoSpeed") { |
| 8124 | |||
| 8125 | // Fields that have been added from 3.6.1 to 3.7.0: | ||
| 8126 | // ------------------------------------------------ | ||
| 8127 | // * Rated High Speed Evaporator Fan Power Per Volume Flow Rate 2017 * 7 | ||
| 8128 | // * Rated High Speed Evaporator Fan Power Per Volume Flow Rate 2023 * 8 | ||
| 8129 | // * Rated Low Speed Evaporator Fan Power Per Volume Flow Rate 2017 * 21 | ||
| 8130 | // * Rated Low Speed Evaporator Fan Power Per Volume Flow Rate 2023 * 22 | ||
| 8131 | |||
| 8132 |
1/1✓ Branch 1 taken 2 times.
|
2 | auto iddObject = idd_3_7_0.getObject(iddname); |
| 8133 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | IdfObject newObject(iddObject.get()); |
| 8134 | |||
| 8135 |
3/3✓ Branch 1 taken 72 times.
✓ Branch 3 taken 70 times.
✓ Branch 4 taken 2 times.
|
72 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 8136 |
2/3✓ Branch 1 taken 70 times.
✓ Branch 5 taken 70 times.
✗ Branch 6 not taken.
|
140 | if ((value = object.getString(i))) { |
| 8137 |
2/2✓ Branch 0 taken 14 times.
✓ Branch 1 taken 56 times.
|
70 | if (i < 7) { |
| 8138 |
2/2✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
|
14 | newObject.setString(i, value.get()); |
| 8139 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 32 times.
|
56 | } else if (i < 19) { |
| 8140 |
2/2✓ Branch 1 taken 24 times.
✓ Branch 4 taken 24 times.
|
24 | newObject.setString(i + 2, value.get()); |
| 8141 | } else { | ||
| 8142 |
2/2✓ Branch 1 taken 32 times.
✓ Branch 4 taken 32 times.
|
32 | newObject.setString(i + 4, value.get()); |
| 8143 | } | ||
| 8144 | } | ||
| 8145 | } | ||
| 8146 | |||
| 8147 | // Rated High Speed Evaporator Fan Power Per Volume Flow Rate 2017 | ||
| 8148 |
1/1✓ Branch 1 taken 2 times.
|
2 | newObject.setDouble(7, 773.3); |
| 8149 | // Rated High Speed Evaporator Fan Power Per Volume Flow Rate 2023 | ||
| 8150 |
1/1✓ Branch 1 taken 2 times.
|
2 | newObject.setDouble(8, 934.4); |
| 8151 | |||
| 8152 | // Rated Low Speed Evaporator Fan Power Per Volume Flow Rate 2017 | ||
| 8153 |
1/1✓ Branch 1 taken 2 times.
|
2 | newObject.setDouble(21, 773.3); |
| 8154 | // Rated Low Speed Evaporator Fan Power Per Volume Flow Rate 2023 | ||
| 8155 |
1/1✓ Branch 1 taken 2 times.
|
2 | newObject.setDouble(22, 934.4); |
| 8156 | |||
| 8157 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | m_refactored.push_back(RefactoredObjectData(object, newObject)); |
| 8158 |
1/1✓ Branch 1 taken 2 times.
|
2 | ss << newObject; |
| 8159 | |||
| 8160 |
3/3✓ Branch 3 taken 64245 times.
✓ Branch 5 taken 16 times.
✓ Branch 6 taken 64229 times.
|
64247 | } else if (iddname == "OS:AirLoopHVAC:UnitarySystem") { |
| 8161 | |||
| 8162 | // Removed fields | ||
| 8163 | // 38 - Maximum Cycling Rate | ||
| 8164 | // 39 - Heat Pump Time Constant | ||
| 8165 | // 40 - Fraction of On-Cycle Power Use | ||
| 8166 | // 41 - Heat Pump Fan Delay Time | ||
| 8167 | |||
| 8168 |
1/1✓ Branch 1 taken 16 times.
|
16 | auto iddObject = idd_3_7_0.getObject(iddname); |
| 8169 |
2/2✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
|
16 | IdfObject newObject(iddObject.get()); |
| 8170 | |||
| 8171 |
3/3✓ Branch 1 taken 720 times.
✓ Branch 3 taken 704 times.
✓ Branch 4 taken 16 times.
|
720 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 8172 |
2/3✓ Branch 1 taken 704 times.
✓ Branch 5 taken 704 times.
✗ Branch 6 not taken.
|
1408 | if ((value = object.getString(i))) { |
| 8173 |
2/2✓ Branch 0 taken 608 times.
✓ Branch 1 taken 96 times.
|
704 | if (i < 38) { |
| 8174 |
2/2✓ Branch 1 taken 608 times.
✓ Branch 4 taken 608 times.
|
608 | newObject.setString(i, value.get()); |
| 8175 |
2/2✓ Branch 0 taken 32 times.
✓ Branch 1 taken 64 times.
|
96 | } else if (i > 41) { |
| 8176 |
2/2✓ Branch 1 taken 32 times.
✓ Branch 4 taken 32 times.
|
32 | newObject.setString(i - 4, value.get()); |
| 8177 | } | ||
| 8178 | } | ||
| 8179 | } | ||
| 8180 | |||
| 8181 | // * 11 - Heating Coil Name | ||
| 8182 | 16 | constexpr unsigned heatingCoilNameIndex = 11; | |
| 8183 |
1/1✓ Branch 1 taken 16 times.
|
16 | const bool hasHeatingCoil = !object.isEmpty(heatingCoilNameIndex); |
| 8184 | |||
| 8185 | // * 13 - Cooling Coil Name | ||
| 8186 | 16 | constexpr unsigned coolingCoilNameIndex = 13; | |
| 8187 |
1/1✓ Branch 1 taken 16 times.
|
16 | const bool hasCoolingCoil = !object.isEmpty(coolingCoilNameIndex); |
| 8188 | |||
| 8189 | // We use getString(idx, false, true) to not get default, returned unitialized empty | ||
| 8190 | |||
| 8191 | // * 18 - Supply Air Flow Rate Method During Cooling Operation | ||
| 8192 | 16 | constexpr unsigned coolingSAFMethodIndex = 18; | |
| 8193 |
1/1✓ Branch 1 taken 16 times.
|
16 | boost::optional<std::string> coolingSAFMethod = object.getString(coolingSAFMethodIndex, false, true); |
| 8194 | |||
| 8195 | // * 23 - Supply Air Flow Rate Method During Heating Operation | ||
| 8196 | 16 | constexpr unsigned heatingSAFMethodIndex = 23; | |
| 8197 |
1/1✓ Branch 1 taken 16 times.
|
16 | boost::optional<std::string> heatingSAFMethod = object.getString(heatingSAFMethodIndex, false, true); |
| 8198 | |||
| 8199 | // * 28 - Supply Air Flow Rate Method When No Cooling or Heating is Required | ||
| 8200 | 16 | constexpr unsigned noCoolHeatSAFMethodIndex = 28; | |
| 8201 |
1/1✓ Branch 1 taken 16 times.
|
16 | boost::optional<std::string> noCoolHeatSAFMethod = object.getString(noCoolHeatSAFMethodIndex, false, true); |
| 8202 | |||
| 8203 | 16 | constexpr std::array<std::string_view, 4> coolingSAFMethodChoices{"SupplyAirFlowRate", "FlowPerFloorArea", "FractionOfAutosizedCoolingValue", | |
| 8204 | "FlowPerCoolingCapacity"}; | ||
| 8205 | |||
| 8206 | 16 | constexpr std::array<std::string_view, 4> coolingSAFMethodChoicesUC{"SUPPLYAIRFLOWRATE", "FLOWPERFLOORAREA", | |
| 8207 | "FRACTIONOFAUTOSIZEDCOOLINGVALUE", "FLOWPERCOOLINGCAPACITY"}; | ||
| 8208 | |||
| 8209 | 16 | constexpr std::array<std::string_view, 4> heatingSAFMethodChoices{"SupplyAirFlowRate", "FlowPerFloorArea", "FractionOfAutosizedHeatingValue", | |
| 8210 | "FlowPerHeatingCapacity"}; | ||
| 8211 | 16 | constexpr std::array<std::string_view, 4> heatingSAFMethodChoicesUC{"SUPPLYAIRFLOWRATE", "FLOWPERFLOORAREA", | |
| 8212 | "FRACTIONOFAUTOSIZEDHEATINGVALUE", "FLOWPERHEATINGCAPACITY"}; | ||
| 8213 | |||
| 8214 | 16 | constexpr std::array<std::string_view, 6> noCoolHeatSAFMethodChoices{ | |
| 8215 | "SupplyAirFlowRate", "FlowPerFloorArea", "FractionOfAutosizedCoolingValue", "FractionOfAutosizedHeatingValue", | ||
| 8216 | "FlowPerCoolingCapacity", "FlowPerHeatingCapacity"}; | ||
| 8217 | |||
| 8218 | 16 | constexpr std::array<std::string_view, 6> noCoolHeatSAFMethodChoicesUC{ | |
| 8219 | "SUPPLYAIRFLOWRATE", "FLOWPERFLOORAREA", "FRACTIONOFAUTOSIZEDCOOLINGVALUE", "FRACTIONOFAUTOSIZEDHEATINGVALUE", | ||
| 8220 | "FLOWPERCOOLINGCAPACITY", "FLOWPERHEATINGCAPACITY"}; | ||
| 8221 | |||
| 8222 | // Reset all flow fields, we want only one at best to be set | ||
| 8223 |
2/2✓ Branch 0 taken 64 times.
✓ Branch 1 taken 16 times.
|
96 | for (size_t i = 0; i < coolingSAFMethodChoices.size(); ++i) { |
| 8224 | 64 | const size_t fieldIndex = coolingSAFMethodIndex + 1 + i; | |
| 8225 |
2/2✓ Branch 1 taken 64 times.
✓ Branch 4 taken 64 times.
|
128 | newObject.setString(fieldIndex, ""); |
| 8226 | } | ||
| 8227 |
2/2✓ Branch 0 taken 64 times.
✓ Branch 1 taken 16 times.
|
96 | for (size_t i = 0; i < heatingSAFMethodChoices.size(); ++i) { |
| 8228 | 64 | const size_t fieldIndex = heatingSAFMethodIndex + 1 + i; | |
| 8229 |
2/2✓ Branch 1 taken 64 times.
✓ Branch 4 taken 64 times.
|
128 | newObject.setString(fieldIndex, ""); |
| 8230 | } | ||
| 8231 |
2/2✓ Branch 0 taken 96 times.
✓ Branch 1 taken 16 times.
|
128 | for (size_t i = 0; i < noCoolHeatSAFMethodChoices.size(); ++i) { |
| 8232 | 96 | const size_t fieldIndex = noCoolHeatSAFMethodIndex + 1 + i; | |
| 8233 |
2/2✓ Branch 1 taken 96 times.
✓ Branch 4 taken 96 times.
|
192 | newObject.setString(fieldIndex, ""); |
| 8234 | } | ||
| 8235 | |||
| 8236 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 8 times.
|
16 | if (!hasCoolingCoil) { |
| 8237 |
2/2✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
|
16 | newObject.setString(coolingSAFMethodIndex, "None"); |
| 8238 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 2 taken 2 times.
|
8 | } else if (!coolingSAFMethod) { |
| 8239 | // Technically here E+ checks if the cooling coil rated air flow rate is autosized or not | ||
| 8240 | // Also could get overriden by the DesignSpecification:ZoneHVAC:Sizing | ||
| 8241 | // Finally it lets it slide as long as one of the other SupplyAirFlowRateXXX is not empty | ||
| 8242 | // Here I guess we'll scan the fields in order, and pick the first we find | ||
| 8243 | // * 19 - Supply Air Flow Rate During Cooling Operation | ||
| 8244 | // * 20 - Supply Air Flow Rate Per Floor Area During Cooling Operation | ||
| 8245 | // * 21 - Fraction of Autosized Design Cooling Supply Air Flow Rate | ||
| 8246 | // * 22 - Design Supply Air Flow Rate Per Unit of Capacity During Cooling Operation | ||
| 8247 | 6 | bool found = false; | |
| 8248 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
12 | for (size_t i = 0; i < coolingSAFMethodChoices.size(); ++i) { |
| 8249 | 6 | const size_t fieldIndex = coolingSAFMethodIndex + 1 + i; | |
| 8250 |
2/3✓ Branch 1 taken 6 times.
✓ Branch 5 taken 6 times.
✗ Branch 6 not taken.
|
12 | if ((value = object.getString(fieldIndex, false, true))) { |
| 8251 |
2/2✓ Branch 2 taken 6 times.
✓ Branch 5 taken 6 times.
|
12 | newObject.setString(coolingSAFMethodIndex, std::string{coolingSAFMethodChoices[i]}); |
| 8252 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
6 | newObject.setString(fieldIndex, *value); |
| 8253 | 6 | found = true; | |
| 8254 | 6 | break; | |
| 8255 | } | ||
| 8256 | } | ||
| 8257 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
|
6 | if (!found) { |
| 8258 | ✗ | LOG(Warn, "For AirLoopHVACUnitarySystem '" | |
| 8259 | << object.nameString() | ||
| 8260 | << "', there is a cooling coil, but no Supply Air Flow Rate Method During Cooling Operation and no flow rate fields set. " | ||
| 8261 | "Defaulting to SupplyAirFlowRate with Autosize"); | ||
| 8262 | ✗ | newObject.setString(coolingSAFMethodIndex, "SupplyAirFlowRate"); | |
| 8263 | ✗ | newObject.setString(coolingSAFMethodIndex + 1, "Autosize"); | |
| 8264 | } | ||
| 8265 | } else { | ||
| 8266 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 5 taken 2 times.
|
2 | std::string coolingSAFMethodUC = ascii_to_upper_copy(*coolingSAFMethod); |
| 8267 |
2/3✓ Branch 1 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
|
2 | if (coolingSAFMethodUC == "NONE") { |
| 8268 | ✗ | LOG(Warn, "For AirLoopHVACUnitarySystem '" | |
| 8269 | << object.nameString() | ||
| 8270 | << "', Supply Air Flow Method Rate During Cooling Operation is 'None' but you have a Cooling Coil, consider changing it"); | ||
| 8271 | } else { | ||
| 8272 |
1/1✓ Branch 3 taken 2 times.
|
2 | auto it = std::find_if(coolingSAFMethodChoicesUC.cbegin(), coolingSAFMethodChoicesUC.cend(), |
| 8273 | 5 | [&coolingSAFMethodUC](auto& s) { return s == coolingSAFMethodUC; }); | |
| 8274 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
|
2 | if (it == coolingSAFMethodChoicesUC.cend()) { |
| 8275 | ✗ | LOG(Error, "For AirLoopHVACUnitarySystem '" | |
| 8276 | << object.nameString() << "', Unrecognized Supply Air Flow Method Rate During Cooling Operation=" << *coolingSAFMethod); | ||
| 8277 | } else { | ||
| 8278 | 2 | const auto dist = std::distance(coolingSAFMethodChoicesUC.cbegin(), it); | |
| 8279 | 2 | const size_t index = coolingSAFMethodIndex + 1 + dist; | |
| 8280 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 5 taken 1 time.
✓ Branch 6 taken 1 time.
|
4 | if ((value = object.getString(index, false, true))) { |
| 8281 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | newObject.setString(index, *value); |
| 8282 | } else { | ||
| 8283 |
11/11✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
✓ Branch 16 taken 1 time.
✓ Branch 19 taken 1 time.
✓ Branch 22 taken 1 time.
✓ Branch 26 taken 1 time.
✓ Branch 29 taken 1 time.
✓ Branch 32 taken 1 time.
|
1 | LOG(Error, "For AirLoopHVACUnitarySystem '" << object.nameString() << "', Supply Air Flow Method Rate During Cooling Operation is '" |
| 8284 | << *coolingSAFMethod << "' but associated field is empty. Setting it to zero."); | ||
| 8285 |
1/1✓ Branch 1 taken 1 time.
|
1 | newObject.setDouble(index, 0.0); |
| 8286 | } | ||
| 8287 | } | ||
| 8288 | } | ||
| 8289 | 2 | } | |
| 8290 | |||
| 8291 |
2/2✓ Branch 0 taken 9 times.
✓ Branch 1 taken 7 times.
|
16 | if (!hasHeatingCoil) { |
| 8292 |
2/2✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
|
18 | newObject.setString(heatingSAFMethodIndex, "None"); |
| 8293 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 2 taken 2 times.
|
7 | } else if (!heatingSAFMethod) { |
| 8294 | |||
| 8295 | // * 23 - Supply Air Flow Rate Method During Heating Operation | ||
| 8296 | // * 24 - Supply Air Flow Rate During Heating Operation | ||
| 8297 | // * 25 - Supply Air Flow Rate Per Floor Area during Heating Operation | ||
| 8298 | // * 26 - Fraction of Autosized Design Heating Supply Air Flow Rate | ||
| 8299 | // * 27 - Design Supply Air Flow Rate Per Unit of Capacity During Heating Operation | ||
| 8300 | 5 | bool found = false; | |
| 8301 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
10 | for (size_t i = 0; i < heatingSAFMethodChoices.size(); ++i) { |
| 8302 | 5 | const size_t fieldIndex = heatingSAFMethodIndex + 1 + i; | |
| 8303 |
2/3✓ Branch 1 taken 5 times.
✓ Branch 5 taken 5 times.
✗ Branch 6 not taken.
|
10 | if ((value = object.getString(fieldIndex, false, true))) { |
| 8304 |
2/2✓ Branch 2 taken 5 times.
✓ Branch 5 taken 5 times.
|
10 | newObject.setString(heatingSAFMethodIndex, std::string{heatingSAFMethodChoices[i]}); |
| 8305 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | newObject.setString(fieldIndex, *value); |
| 8306 | 5 | found = true; | |
| 8307 | 5 | break; | |
| 8308 | } | ||
| 8309 | } | ||
| 8310 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
|
5 | if (!found) { |
| 8311 | ✗ | LOG(Warn, "For AirLoopHVACUnitarySystem '" | |
| 8312 | << object.nameString() | ||
| 8313 | << "', there is a heating coil, but no Supply Air Flow Rate Method During Heating Operation and no flow rate fields set. " | ||
| 8314 | "Defaulting to SupplyAirFlowRate with Autosize"); | ||
| 8315 | ✗ | newObject.setString(heatingSAFMethodIndex, "SupplyAirFlowRate"); | |
| 8316 | ✗ | newObject.setString(heatingSAFMethodIndex + 1, "Autosize"); | |
| 8317 | } | ||
| 8318 | } else { | ||
| 8319 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 5 taken 2 times.
|
2 | std::string heatingSAFMethodUC = ascii_to_upper_copy(*heatingSAFMethod); |
| 8320 |
2/3✓ Branch 1 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
|
2 | if (heatingSAFMethodUC == "NONE") { |
| 8321 | ✗ | LOG(Warn, "For AirLoopHVACUnitarySystem '" | |
| 8322 | << object.nameString() | ||
| 8323 | << "', Supply Air Flow Method Rate During Heating Operation is 'None' but you have a Heating coil, consider changing it"); | ||
| 8324 | } else { | ||
| 8325 |
1/1✓ Branch 3 taken 2 times.
|
2 | auto it = std::find_if(heatingSAFMethodChoicesUC.cbegin(), heatingSAFMethodChoicesUC.cend(), |
| 8326 | 6 | [&heatingSAFMethodUC](auto& s) { return s == heatingSAFMethodUC; }); | |
| 8327 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
|
2 | if (it == heatingSAFMethodChoicesUC.cend()) { |
| 8328 | ✗ | LOG(Error, "For AirLoopHVACUnitarySystem '" | |
| 8329 | << object.nameString() << "', Unrecognized Supply Air Flow Method Rate During Heating Operation=" << *heatingSAFMethod); | ||
| 8330 | } else { | ||
| 8331 | 2 | auto dist = std::distance(heatingSAFMethodChoicesUC.cbegin(), it); | |
| 8332 | 2 | const size_t index = heatingSAFMethodIndex + 1 + dist; | |
| 8333 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 5 taken 1 time.
✓ Branch 6 taken 1 time.
|
4 | if ((value = object.getString(index, false, true))) { |
| 8334 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | newObject.setString(index, *value); |
| 8335 | } else { | ||
| 8336 |
11/11✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
✓ Branch 16 taken 1 time.
✓ Branch 19 taken 1 time.
✓ Branch 22 taken 1 time.
✓ Branch 26 taken 1 time.
✓ Branch 29 taken 1 time.
✓ Branch 32 taken 1 time.
|
1 | LOG(Error, "For AirLoopHVACUnitarySystem '" << object.nameString() << "', Supply Air Flow Method Rate During Heating Operation is '" |
| 8337 | << *heatingSAFMethod << "' but associated field is empty. Setting it to zero."); | ||
| 8338 |
1/1✓ Branch 1 taken 1 time.
|
1 | newObject.setDouble(index, 0.0); |
| 8339 | } | ||
| 8340 | } | ||
| 8341 | } | ||
| 8342 | 2 | } | |
| 8343 | |||
| 8344 |
4/4✓ Branch 0 taken 9 times.
✓ Branch 1 taken 7 times.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 6 times.
|
16 | if (!hasHeatingCoil && !hasCoolingCoil) { |
| 8345 | // TODO: not sure here | ||
| 8346 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
6 | newObject.setString(noCoolHeatSAFMethodIndex, "None"); |
| 8347 |
2/2✓ Branch 1 taken 9 times.
✓ Branch 2 taken 4 times.
|
13 | } else if (!noCoolHeatSAFMethod) { |
| 8348 | |||
| 8349 | // Blank is equivalent to None here, no question | ||
| 8350 |
2/2✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
|
18 | newObject.setString(noCoolHeatSAFMethodIndex, "None"); |
| 8351 | #if 0 | ||
| 8352 | // * 29 - Supply Air Flow Rate When No Cooling or Heating is Required | ||
| 8353 | // * 30 - Supply Air Flow Rate Per Floor Area When No Cooling or Heating is Required | ||
| 8354 | // * 31 - Fraction of Autosized Design Cooling Supply Air Flow Rate When No Cooling or Heating is Required | ||
| 8355 | // * 32 - Fraction of Autosized Design Heating Supply Air Flow Rate When No Cooling or Heating is Required | ||
| 8356 | // * 33 - Design Supply Air Flow Rate Per Unit of Capacity During Cooling Operation When No Cooling or Heating is Required | ||
| 8357 | // * 34 - Design Supply Air Flow Rate Per Unit of Capacity During Heating Operation When No Cooling or Heating is Required | ||
| 8358 | bool found = false; | ||
| 8359 | for (size_t i = 0; i < noCoolHeatSAFMethodChoices.size(); ++i) { | ||
| 8360 | const size_t fieldIndex = noCoolHeatSAFMethodIndex + 1 + i; | ||
| 8361 | if ((value = object.getString(fieldIndex, false, true))) { | ||
| 8362 | newObject.setString(noCoolHeatSAFMethodIndex, std::string{noCoolHeatSAFMethodChoices[i]}); | ||
| 8363 | newObject.setString(fieldIndex, *value); | ||
| 8364 | found = true; | ||
| 8365 | break; | ||
| 8366 | } | ||
| 8367 | } | ||
| 8368 | if (!found) { | ||
| 8369 | LOG(Warn, "For AirLoopHVACUnitarySystem '" << object.nameString() | ||
| 8370 | << ", there is no Supply Air Flow Rate Method When No Cooling or Heating is Required and no flow rate fields set. " | ||
| 8371 | "Defaulting to None"); | ||
| 8372 | newObject.setString(noCoolHeatSAFMethodIndex, "None"); | ||
| 8373 | } | ||
| 8374 | #endif | ||
| 8375 | } else { | ||
| 8376 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 5 taken 4 times.
|
4 | std::string noCoolHeatSAFMethodUC = ascii_to_upper_copy(*noCoolHeatSAFMethod); |
| 8377 |
2/3✓ Branch 1 taken 4 times.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
|
4 | if (noCoolHeatSAFMethodUC != "NONE") { |
| 8378 |
1/1✓ Branch 3 taken 4 times.
|
4 | auto it = std::find_if(noCoolHeatSAFMethodChoicesUC.cbegin(), noCoolHeatSAFMethodChoicesUC.cend(), |
| 8379 | 18 | [&noCoolHeatSAFMethodUC](auto& s) { return s == noCoolHeatSAFMethodUC; }); | |
| 8380 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
|
4 | if (it == noCoolHeatSAFMethodChoicesUC.cend()) { |
| 8381 | ✗ | LOG(Error, "For AirLoopHVACUnitarySystem '" | |
| 8382 | << object.nameString() | ||
| 8383 | << "', Unrecognized Supply Air Flow Rate Method When No Cooling or Heating is Required=" << *noCoolHeatSAFMethod); | ||
| 8384 | } else { | ||
| 8385 | 4 | auto dist = std::distance(noCoolHeatSAFMethodChoicesUC.cbegin(), it); | |
| 8386 | 4 | const size_t index = noCoolHeatSAFMethodIndex + 1 + dist; | |
| 8387 |
3/3✓ Branch 1 taken 4 times.
✓ Branch 5 taken 2 times.
✓ Branch 6 taken 2 times.
|
8 | if ((value = object.getString(index, false, true))) { |
| 8388 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | newObject.setString(index, *value); |
| 8389 | } else { | ||
| 8390 |
11/11✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
✓ Branch 13 taken 2 times.
✓ Branch 16 taken 2 times.
✓ Branch 19 taken 2 times.
✓ Branch 22 taken 2 times.
✓ Branch 26 taken 2 times.
✓ Branch 29 taken 2 times.
✓ Branch 32 taken 2 times.
|
2 | LOG(Error, "For AirLoopHVACUnitarySystem '" << object.nameString() |
| 8391 | << "', Supply Air Flow Rate Method When No Cooling or Heating is Required is '" | ||
| 8392 | << *noCoolHeatSAFMethod << "' but associated field is empty"); | ||
| 8393 |
1/1✓ Branch 1 taken 2 times.
|
2 | newObject.setDouble(index, 0.0); |
| 8394 | } | ||
| 8395 | } | ||
| 8396 | } | ||
| 8397 | 4 | } | |
| 8398 | |||
| 8399 |
1/1✓ Branch 1 taken 16 times.
|
16 | ss << newObject; |
| 8400 |
2/2✓ Branch 2 taken 16 times.
✓ Branch 5 taken 16 times.
|
16 | m_refactored.push_back(RefactoredObjectData(object, std::move(newObject))); |
| 8401 | |||
| 8402 |
1/1✓ Branch 1 taken 16 times.
|
16 | auto it = CoilLatentTransitionInfo::findFromParent(coilTransitionInfos, object); |
| 8403 |
2/2✓ Branch 2 taken 7 times.
✓ Branch 3 taken 9 times.
|
16 | if (it != coilTransitionInfos.end()) { |
| 8404 |
3/3✓ Branch 2 taken 7 times.
✓ Branch 4 taken 3 times.
✓ Branch 5 taken 4 times.
|
7 | if (it->isCurveCreationNeeded()) { |
| 8405 |
1/1✓ Branch 2 taken 3 times.
|
3 | IdfObject plfCurve = it->createCurveLinear(idd_3_7_0); |
| 8406 |
1/1✓ Branch 1 taken 3 times.
|
3 | ss << plfCurve; |
| 8407 |
1/1✓ Branch 2 taken 3 times.
|
3 | m_new.emplace_back(std::move(plfCurve)); |
| 8408 | 3 | } | |
| 8409 | } | ||
| 8410 | |||
| 8411 |
3/3✓ Branch 6 taken 64229 times.
✓ Branch 8 taken 2 times.
✓ Branch 9 taken 64227 times.
|
64245 | } else if (iddname == "OS:ZoneHVAC:WaterToAirHeatPump") { |
| 8412 | |||
| 8413 | // Removed fields | ||
| 8414 | // 15 - Maximum Cycling Rate | ||
| 8415 | // 16 - Heat Pump Time Constant | ||
| 8416 | // 17 - Fraction of On-Cycle Power Use | ||
| 8417 | // 18 - Heat Pump Fan Delay Time | ||
| 8418 | |||
| 8419 |
1/1✓ Branch 1 taken 2 times.
|
2 | auto iddObject = idd_3_7_0.getObject(iddname); |
| 8420 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | IdfObject newObject(iddObject.get()); |
| 8421 | |||
| 8422 |
3/3✓ Branch 1 taken 54 times.
✓ Branch 3 taken 52 times.
✓ Branch 4 taken 2 times.
|
54 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 8423 |
2/3✓ Branch 1 taken 52 times.
✓ Branch 5 taken 52 times.
✗ Branch 6 not taken.
|
104 | if ((value = object.getString(i))) { |
| 8424 |
2/2✓ Branch 0 taken 30 times.
✓ Branch 1 taken 22 times.
|
52 | if (i < 15) { |
| 8425 |
2/2✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
|
30 | newObject.setString(i, value.get()); |
| 8426 |
2/2✓ Branch 0 taken 14 times.
✓ Branch 1 taken 8 times.
|
22 | } else if (i > 18) { |
| 8427 |
2/2✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
|
14 | newObject.setString(i - 4, value.get()); |
| 8428 | } | ||
| 8429 | } | ||
| 8430 | } | ||
| 8431 | |||
| 8432 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | m_refactored.push_back(RefactoredObjectData(object, newObject)); |
| 8433 |
1/1✓ Branch 1 taken 2 times.
|
2 | ss << newObject; |
| 8434 | |||
| 8435 |
1/1✓ Branch 1 taken 2 times.
|
2 | auto it = CoilLatentTransitionInfo::findFromParent(coilTransitionInfos, object); |
| 8436 |
1/2✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | if (it != coilTransitionInfos.end()) { |
| 8437 |
3/3✓ Branch 2 taken 2 times.
✓ Branch 4 taken 1 time.
✓ Branch 5 taken 1 time.
|
2 | if (it->isCurveCreationNeeded()) { |
| 8438 |
1/1✓ Branch 2 taken 1 time.
|
1 | IdfObject plfCurve = it->createCurveLinear(idd_3_7_0); |
| 8439 |
1/1✓ Branch 1 taken 1 time.
|
1 | ss << plfCurve; |
| 8440 |
1/1✓ Branch 2 taken 1 time.
|
1 | m_new.emplace_back(std::move(plfCurve)); |
| 8441 | 1 | } | |
| 8442 | } | ||
| 8443 | |||
| 8444 |
3/3✓ Branch 3 taken 64227 times.
✓ Branch 5 taken 3 times.
✓ Branch 6 taken 64224 times.
|
64229 | } else if (iddname == "OS:Coil:Cooling:DX:VariableSpeed") { |
| 8445 | |||
| 8446 | // Fields that have been added from 3.6.1 to 3.7.0: | ||
| 8447 | // ------------------------------------------------ | ||
| 8448 | // * Maximum Cycling Rate * 9 | ||
| 8449 | // * Latent Capacity Time Constant * 10 | ||
| 8450 | // * Fan Delay Time * 11 | ||
| 8451 | // * Crankcase Heater Capacity Function of Temperature Curve Name - 17 | ||
| 8452 |
1/1✓ Branch 1 taken 3 times.
|
3 | auto iddObject = idd_3_7_0.getObject(iddname); |
| 8453 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | IdfObject newObject(iddObject.get()); |
| 8454 | |||
| 8455 |
3/3✓ Branch 1 taken 69 times.
✓ Branch 3 taken 66 times.
✓ Branch 4 taken 3 times.
|
69 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 8456 |
2/3✓ Branch 1 taken 66 times.
✓ Branch 5 taken 66 times.
✗ Branch 6 not taken.
|
132 | if ((value = object.getString(i))) { |
| 8457 |
2/2✓ Branch 0 taken 27 times.
✓ Branch 1 taken 39 times.
|
66 | if (i < 9) { |
| 8458 |
2/2✓ Branch 1 taken 27 times.
✓ Branch 4 taken 27 times.
|
27 | newObject.setString(i, value.get()); |
| 8459 |
2/2✓ Branch 0 taken 15 times.
✓ Branch 1 taken 24 times.
|
39 | } else if (i < 14) { |
| 8460 | // * Energy Part Load Fraction Curve Name - 9 => 12 | ||
| 8461 |
2/2✓ Branch 1 taken 15 times.
✓ Branch 4 taken 15 times.
|
15 | newObject.setString(i + 3, value.get()); |
| 8462 | } else { | ||
| 8463 | // * Maximum Outdoor Dry-Bulb Temperature for Crankcase Heater Operation - 14 => 18 | ||
| 8464 |
2/2✓ Branch 1 taken 24 times.
✓ Branch 4 taken 24 times.
|
24 | newObject.setString(i + 4, value.get()); |
| 8465 | } | ||
| 8466 | } | ||
| 8467 | } | ||
| 8468 | |||
| 8469 |
1/1✓ Branch 1 taken 3 times.
|
3 | auto it = CoilLatentTransitionInfo::findFromCoolingCoil(coilTransitionInfos, object); |
| 8470 | 3 | const bool hasCoilInfo = (it != coilTransitionInfos.end()); | |
| 8471 | // No PLF Curve needed here | ||
| 8472 | |||
| 8473 | 3 | double maxCyclingRate = 2.5; | |
| 8474 | 3 | double heatPumpTimeConst = 60.0; | |
| 8475 | 3 | double hpDelayTime = 60.0; | |
| 8476 |
2/2✓ Branch 0 taken 1 time.
✓ Branch 1 taken 2 times.
|
3 | if (hasCoilInfo) { |
| 8477 | 1 | maxCyclingRate = it->maxCyclingRate; | |
| 8478 | 1 | heatPumpTimeConst = it->heatPumpTimeConst; | |
| 8479 | 1 | hpDelayTime = it->hpDelayTime; | |
| 8480 | } | ||
| 8481 | |||
| 8482 |
1/1✓ Branch 1 taken 3 times.
|
3 | newObject.setDouble(9, maxCyclingRate); |
| 8483 |
1/1✓ Branch 1 taken 3 times.
|
3 | newObject.setDouble(10, heatPumpTimeConst); |
| 8484 |
1/1✓ Branch 1 taken 3 times.
|
3 | newObject.setDouble(11, hpDelayTime); |
| 8485 | |||
| 8486 | // Cranckcase curve is optional | ||
| 8487 | // newObject.setString(17; ""); | ||
| 8488 | |||
| 8489 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | m_refactored.push_back(RefactoredObjectData(object, newObject)); |
| 8490 |
1/1✓ Branch 1 taken 3 times.
|
3 | ss << newObject; |
| 8491 | |||
| 8492 |
3/3✓ Branch 3 taken 64224 times.
✓ Branch 5 taken 6 times.
✓ Branch 6 taken 64218 times.
|
64227 | } else if (iddname == "OS:Coil:Cooling:WaterToAirHeatPump:EquationFit") { |
| 8493 | |||
| 8494 | // Fields that have been added from 3.6.1 to 3.7.0: | ||
| 8495 | // ------------------------------------------------ | ||
| 8496 | // * Part Load Fraction Correlation Curve Name* 17 | ||
| 8497 | // New at end | ||
| 8498 | // * Maximum Cycling Rate * 20 | ||
| 8499 | // * Latent Capacity Time Constant * 21 | ||
| 8500 | // * Fan Delay Time * 22 | ||
| 8501 | |||
| 8502 |
1/1✓ Branch 1 taken 6 times.
|
6 | auto iddObject = idd_3_7_0.getObject(iddname); |
| 8503 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
6 | IdfObject newObject(iddObject.get()); |
| 8504 | |||
| 8505 |
3/3✓ Branch 1 taken 120 times.
✓ Branch 3 taken 114 times.
✓ Branch 4 taken 6 times.
|
120 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 8506 |
2/3✓ Branch 1 taken 114 times.
✓ Branch 5 taken 114 times.
✗ Branch 6 not taken.
|
228 | if ((value = object.getString(i))) { |
| 8507 |
2/2✓ Branch 0 taken 102 times.
✓ Branch 1 taken 12 times.
|
114 | if (i < 17) { |
| 8508 |
2/2✓ Branch 1 taken 102 times.
✓ Branch 4 taken 102 times.
|
102 | newObject.setString(i, value.get()); |
| 8509 | } else { | ||
| 8510 |
2/2✓ Branch 1 taken 12 times.
✓ Branch 4 taken 12 times.
|
12 | newObject.setString(i + 1, value.get()); |
| 8511 | } | ||
| 8512 | } | ||
| 8513 | } | ||
| 8514 | |||
| 8515 |
1/1✓ Branch 1 taken 6 times.
|
6 | auto it = CoilLatentTransitionInfo::findFromCoolingCoil(coilTransitionInfos, object); |
| 8516 | 6 | const bool hasCoilInfo = (it != coilTransitionInfos.end()); | |
| 8517 |
6/8✓ Branch 0 taken 3 times.
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 10 taken 3 times.
✓ Branch 11 taken 3 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
|
9 | const std::string curveName = hasCoilInfo ? it->curveName() : fmt::format("{}-PLFCorrelationCurve", object.nameString()); |
| 8518 |
1/1✓ Branch 1 taken 6 times.
|
6 | newObject.setString(17, curveName); |
| 8519 | |||
| 8520 | // E+ 23.2.0 defaults Maximum Cycling Rate and Latent Capacity Time Constant to 0.0, we don't, cf #4999 | ||
| 8521 | 6 | double maxCyclingRate = 2.5; | |
| 8522 | 6 | double heatPumpTimeConst = 60.0; | |
| 8523 | 6 | double hpDelayTime = 60.0; | |
| 8524 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 3 times.
|
6 | if (hasCoilInfo) { |
| 8525 | 3 | maxCyclingRate = it->maxCyclingRate; | |
| 8526 | 3 | heatPumpTimeConst = it->heatPumpTimeConst; | |
| 8527 | 3 | hpDelayTime = it->hpDelayTime; | |
| 8528 | } | ||
| 8529 | |||
| 8530 |
1/1✓ Branch 1 taken 6 times.
|
6 | newObject.setDouble(20, maxCyclingRate); |
| 8531 |
1/1✓ Branch 1 taken 6 times.
|
6 | newObject.setDouble(21, heatPumpTimeConst); |
| 8532 |
1/1✓ Branch 1 taken 6 times.
|
6 | newObject.setDouble(22, hpDelayTime); |
| 8533 | |||
| 8534 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
6 | m_refactored.push_back(RefactoredObjectData(object, newObject)); |
| 8535 |
1/1✓ Branch 1 taken 6 times.
|
6 | ss << newObject; |
| 8536 | |||
| 8537 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 3 times.
|
6 | if (!hasCoilInfo) { |
| 8538 |
1/1✓ Branch 1 taken 3 times.
|
3 | IdfObject plfCurve = CoilLatentTransitionInfo::defaultHeatPumpCoilPLFCorrelationCurve(idd_3_7_0, curveName); |
| 8539 |
1/1✓ Branch 1 taken 3 times.
|
3 | ss << plfCurve; |
| 8540 |
1/1✓ Branch 2 taken 3 times.
|
3 | m_new.emplace_back(std::move(plfCurve)); |
| 8541 | 3 | } | |
| 8542 | |||
| 8543 |
3/3✓ Branch 4 taken 64218 times.
✓ Branch 6 taken 4 times.
✓ Branch 7 taken 64214 times.
|
64224 | } else if (iddname == "OS:Coil:Cooling:WaterToAirHeatPump:VariableSpeedEquationFit") { |
| 8544 | |||
| 8545 | // Fields that have been added from 3.6.1 to 3.7.0: | ||
| 8546 | // ------------------------------------------------ | ||
| 8547 | // * Maximum Cycling Rate * 12 | ||
| 8548 | // * Latent Capacity Time Constant * 13 | ||
| 8549 | // * Fan Delay Time * 14 | ||
| 8550 | |||
| 8551 |
1/1✓ Branch 1 taken 4 times.
|
4 | auto iddObject = idd_3_7_0.getObject(iddname); |
| 8552 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | IdfObject newObject(iddObject.get()); |
| 8553 | |||
| 8554 |
3/3✓ Branch 1 taken 64 times.
✓ Branch 3 taken 60 times.
✓ Branch 4 taken 4 times.
|
64 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 8555 |
2/3✓ Branch 1 taken 60 times.
✓ Branch 5 taken 60 times.
✗ Branch 6 not taken.
|
120 | if ((value = object.getString(i))) { |
| 8556 |
2/2✓ Branch 0 taken 48 times.
✓ Branch 1 taken 12 times.
|
60 | if (i < 12) { |
| 8557 |
2/2✓ Branch 1 taken 48 times.
✓ Branch 4 taken 48 times.
|
48 | newObject.setString(i, value.get()); |
| 8558 | } else { | ||
| 8559 |
2/2✓ Branch 1 taken 12 times.
✓ Branch 4 taken 12 times.
|
12 | newObject.setString(i + 3, value.get()); |
| 8560 | } | ||
| 8561 | } | ||
| 8562 | } | ||
| 8563 | |||
| 8564 | // No Curve needed here | ||
| 8565 |
1/1✓ Branch 1 taken 4 times.
|
4 | auto it = CoilLatentTransitionInfo::findFromCoolingCoil(coilTransitionInfos, object); |
| 8566 | 4 | const bool hasCoilInfo = (it != coilTransitionInfos.end()); | |
| 8567 | |||
| 8568 | // E+ 23.2.0 defaults Maximum Cycling Rate and Latent Capacity Time Constant to 0.0, we don't, cf #4999 | ||
| 8569 | 4 | double maxCyclingRate = 2.5; | |
| 8570 | 4 | double heatPumpTimeConst = 60.0; | |
| 8571 | 4 | double hpDelayTime = 60.0; | |
| 8572 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 1 time.
|
4 | if (hasCoilInfo) { |
| 8573 | 3 | maxCyclingRate = it->maxCyclingRate; | |
| 8574 | 3 | heatPumpTimeConst = it->heatPumpTimeConst; | |
| 8575 | 3 | hpDelayTime = it->hpDelayTime; | |
| 8576 | } | ||
| 8577 | |||
| 8578 |
1/1✓ Branch 1 taken 4 times.
|
4 | newObject.setDouble(12, maxCyclingRate); |
| 8579 |
1/1✓ Branch 1 taken 4 times.
|
4 | newObject.setDouble(13, heatPumpTimeConst); |
| 8580 |
1/1✓ Branch 1 taken 4 times.
|
4 | newObject.setDouble(14, hpDelayTime); |
| 8581 | |||
| 8582 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | m_refactored.push_back(RefactoredObjectData(object, newObject)); |
| 8583 |
1/1✓ Branch 1 taken 4 times.
|
4 | ss << newObject; |
| 8584 | |||
| 8585 |
3/3✓ Branch 3 taken 64214 times.
✓ Branch 5 taken 6 times.
✓ Branch 6 taken 64208 times.
|
64218 | } else if (iddname == "OS:Coil:Heating:WaterToAirHeatPump:EquationFit") { |
| 8586 | |||
| 8587 | // Fields that have been added from 3.6.1 to 3.7.0: | ||
| 8588 | // ------------------------------------------------ | ||
| 8589 | // * Part Load Fraction Correlation Curve Name * 15 | ||
| 8590 | |||
| 8591 |
1/1✓ Branch 1 taken 6 times.
|
6 | auto iddObject = idd_3_7_0.getObject(iddname); |
| 8592 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
6 | IdfObject newObject(iddObject.get()); |
| 8593 | |||
| 8594 |
3/3✓ Branch 1 taken 96 times.
✓ Branch 3 taken 90 times.
✓ Branch 4 taken 6 times.
|
96 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 8595 |
2/3✓ Branch 1 taken 90 times.
✓ Branch 5 taken 90 times.
✗ Branch 6 not taken.
|
180 | if ((value = object.getString(i))) { |
| 8596 |
2/2✓ Branch 1 taken 90 times.
✓ Branch 4 taken 90 times.
|
90 | newObject.setString(i, value.get()); |
| 8597 | } | ||
| 8598 | } | ||
| 8599 | |||
| 8600 |
1/1✓ Branch 1 taken 6 times.
|
6 | auto it = CoilLatentTransitionInfo::findFromHeatingCoil(coilTransitionInfos, object); |
| 8601 | 6 | const bool hasCoilInfo = (it != coilTransitionInfos.end()); | |
| 8602 |
6/8✓ Branch 0 taken 3 times.
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 10 taken 3 times.
✓ Branch 11 taken 3 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
|
9 | const std::string curveName = hasCoilInfo ? it->curveName() : fmt::format("{}-PLFCorrelationCurve", object.nameString()); |
| 8603 |
1/1✓ Branch 1 taken 6 times.
|
6 | newObject.setString(15, curveName); |
| 8604 | |||
| 8605 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
6 | m_refactored.push_back(RefactoredObjectData(object, newObject)); |
| 8606 |
1/1✓ Branch 1 taken 6 times.
|
6 | ss << newObject; |
| 8607 | |||
| 8608 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 3 times.
|
6 | if (!hasCoilInfo) { |
| 8609 |
1/1✓ Branch 1 taken 3 times.
|
3 | IdfObject plfCurve = CoilLatentTransitionInfo::defaultHeatPumpCoilPLFCorrelationCurve(idd_3_7_0, curveName); |
| 8610 |
1/1✓ Branch 1 taken 3 times.
|
3 | ss << plfCurve; |
| 8611 |
1/1✓ Branch 2 taken 3 times.
|
3 | m_new.emplace_back(std::move(plfCurve)); |
| 8612 | 3 | } | |
| 8613 | |||
| 8614 |
3/3✓ Branch 4 taken 64208 times.
✓ Branch 6 taken 2 times.
✓ Branch 7 taken 64206 times.
|
64214 | } else if (iddname == "OS:Boiler:HotWater") { |
| 8615 | |||
| 8616 | // 1 Field has been added from 3.6.1 to 3.7.0: | ||
| 8617 | // ------------------------------------------- | ||
| 8618 | // * Off Cycle Parasitic Fuel Load * 16 | ||
| 8619 |
1/1✓ Branch 1 taken 2 times.
|
2 | auto iddObject = idd_3_7_0.getObject(iddname); |
| 8620 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | IdfObject newObject(iddObject.get()); |
| 8621 | |||
| 8622 |
3/3✓ Branch 1 taken 38 times.
✓ Branch 3 taken 36 times.
✓ Branch 4 taken 2 times.
|
38 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 8623 |
2/3✓ Branch 1 taken 36 times.
✓ Branch 5 taken 36 times.
✗ Branch 6 not taken.
|
72 | if ((value = object.getString(i))) { |
| 8624 |
2/2✓ Branch 0 taken 32 times.
✓ Branch 1 taken 4 times.
|
36 | if (i < 16) { |
| 8625 |
2/2✓ Branch 1 taken 32 times.
✓ Branch 4 taken 32 times.
|
32 | newObject.setString(i, value.get()); |
| 8626 | } else { | ||
| 8627 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | newObject.setString(i + 1, value.get()); |
| 8628 | } | ||
| 8629 | } | ||
| 8630 | } | ||
| 8631 | |||
| 8632 | // IDD 3.6.1 had a default of 0.0, so it'll pick that up if empty, and it matches the new Ctor value | ||
| 8633 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
|
2 | newObject.setDouble(15, object.getDouble(15, true).get()); |
| 8634 |
1/1✓ Branch 1 taken 2 times.
|
2 | newObject.setDouble(16, 0.0); |
| 8635 | |||
| 8636 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | m_refactored.push_back(RefactoredObjectData(object, newObject)); |
| 8637 |
1/1✓ Branch 1 taken 2 times.
|
2 | ss << newObject; |
| 8638 | |||
| 8639 |
3/3✓ Branch 3 taken 64206 times.
✓ Branch 5 taken 3 times.
✓ Branch 6 taken 64203 times.
|
64208 | } else if (iddname == "OS:DistrictHeating") { |
| 8640 | |||
| 8641 | // Object was renamed from OS:DistrictHeating to OS:DistrictHeating:Water (since OS:DistrictHeating:Steam was added) | ||
| 8642 | |||
| 8643 | // Fields that have been added from 3.6.1 to 3.7.0: | ||
| 8644 | // ------------------------------------------------ | ||
| 8645 | // * Capacity Fraction Schedule * 5 | ||
| 8646 | |||
| 8647 | // We start by creating a new object, and copy every field. | ||
| 8648 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | auto iddObject = idd_3_7_0.getObject("OS:DistrictHeating:Water"); |
| 8649 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | IdfObject newObject(iddObject.get()); |
| 8650 | |||
| 8651 |
3/3✓ Branch 1 taken 18 times.
✓ Branch 3 taken 15 times.
✓ Branch 4 taken 3 times.
|
18 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 8652 |
2/3✓ Branch 1 taken 15 times.
✓ Branch 5 taken 15 times.
✗ Branch 6 not taken.
|
30 | if ((value = object.getString(i))) { |
| 8653 |
2/2✓ Branch 1 taken 15 times.
✓ Branch 4 taken 15 times.
|
15 | newObject.setString(i, value.get()); |
| 8654 | } | ||
| 8655 | } | ||
| 8656 | |||
| 8657 | // Add the new "Capacity Fraction Schedule" | ||
| 8658 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | newObject.setString(5, getOrCreateAlwaysOnContinuousScheduleHandleStr()); |
| 8659 | |||
| 8660 |
1/1✓ Branch 1 taken 3 times.
|
3 | ss << newObject; |
| 8661 |
1/1✓ Branch 3 taken 3 times.
|
3 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 8662 | |||
| 8663 |
3/3✓ Branch 3 taken 64203 times.
✓ Branch 5 taken 2 times.
✓ Branch 6 taken 64201 times.
|
64206 | } else if (iddname == "OS:DistrictCooling") { |
| 8664 | // Fields that have been added from 3.6.1 to 3.7.0: | ||
| 8665 | // ------------------------------------------------ | ||
| 8666 | // * Capacity Fraction Schedule * 5 | ||
| 8667 | |||
| 8668 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | auto iddObject = idd_3_7_0.getObject("OS:DistrictCooling"); |
| 8669 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | IdfObject newObject(iddObject.get()); |
| 8670 | |||
| 8671 |
3/3✓ Branch 1 taken 12 times.
✓ Branch 3 taken 10 times.
✓ Branch 4 taken 2 times.
|
12 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 8672 |
2/3✓ Branch 1 taken 10 times.
✓ Branch 5 taken 10 times.
✗ Branch 6 not taken.
|
20 | if ((value = object.getString(i))) { |
| 8673 |
2/2✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
|
10 | newObject.setString(i, value.get()); |
| 8674 | } | ||
| 8675 | } | ||
| 8676 | // Add the new "Capacity Fraction Schedule" | ||
| 8677 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | newObject.setString(5, getOrCreateAlwaysOnContinuousScheduleHandleStr()); |
| 8678 | |||
| 8679 |
1/1✓ Branch 1 taken 2 times.
|
2 | ss << newObject; |
| 8680 |
1/1✓ Branch 3 taken 2 times.
|
2 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 8681 | |||
| 8682 |
3/3✓ Branch 3 taken 64201 times.
✓ Branch 5 taken 79 times.
✓ Branch 6 taken 64122 times.
|
64203 | } else if (iddname == "OS:Output:Meter") { |
| 8683 | |||
| 8684 |
1/1✓ Branch 1 taken 79 times.
|
79 | std::string name = object.nameString(); |
| 8685 | |||
| 8686 | // Structured bindings | ||
| 8687 |
2/2✓ Branch 2 taken 158 times.
✓ Branch 3 taken 79 times.
|
237 | for (const auto& [k, v] : meterFuelTypesMap) { |
| 8688 |
3/3✓ Branch 1 taken 158 times.
✓ Branch 4 taken 158 times.
✓ Branch 7 taken 158 times.
|
158 | name = boost::regex_replace(name, boost::regex(k, boost::regex::icase), v); |
| 8689 | } | ||
| 8690 |
3/3✓ Branch 1 taken 79 times.
✓ Branch 5 taken 77 times.
✓ Branch 6 taken 2 times.
|
79 | if (name == object.nameString()) { |
| 8691 | // No-op | ||
| 8692 |
1/1✓ Branch 1 taken 77 times.
|
77 | ss << object; |
| 8693 | } else { | ||
| 8694 | |||
| 8695 | // Copy everything but 'Variable Name' field | ||
| 8696 |
1/1✓ Branch 1 taken 2 times.
|
2 | auto iddObject = idd_3_7_0.getObject(iddname); |
| 8697 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | IdfObject newObject(iddObject.get()); |
| 8698 | |||
| 8699 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 3 taken 4 times.
✓ Branch 4 taken 2 times.
|
6 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 8700 | // Skip name field | ||
| 8701 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 2 times.
|
4 | if (i == 1) { |
| 8702 | 2 | continue; | |
| 8703 | } | ||
| 8704 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
|
4 | if ((value = object.getString(i))) { |
| 8705 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | newObject.setString(i, value.get()); |
| 8706 | } | ||
| 8707 | } | ||
| 8708 | |||
| 8709 |
1/1✓ Branch 1 taken 2 times.
|
2 | newObject.setName(name); |
| 8710 | |||
| 8711 |
1/1✓ Branch 1 taken 2 times.
|
2 | ss << newObject; |
| 8712 |
1/1✓ Branch 3 taken 2 times.
|
2 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 8713 | 2 | } | |
| 8714 | |||
| 8715 |
4/4✓ Branch 2 taken 64122 times.
✓ Branch 5 taken 63962 times.
✓ Branch 7 taken 63934 times.
✓ Branch 8 taken 28 times.
|
128163 | } else if ((iddname == "OS:Output:Variable") || (iddname == "OS:EnergyManagementSystem:Sensor") |
| 8716 |
7/7✓ Branch 0 taken 63962 times.
✓ Branch 1 taken 160 times.
✓ Branch 3 taken 63934 times.
✓ Branch 5 taken 4 times.
✓ Branch 6 taken 63930 times.
✓ Branch 7 taken 192 times.
✓ Branch 8 taken 63930 times.
|
128084 | || (iddname == "OS:EnergyManagementSystem:Actuator")) { |
| 8717 | |||
| 8718 | 192 | unsigned variableNameIndex = 3; | |
| 8719 |
3/3✓ Branch 1 taken 192 times.
✓ Branch 3 taken 4 times.
✓ Branch 4 taken 188 times.
|
192 | if (iddname == "OS:EnergyManagementSystem:Actuator") { |
| 8720 | 4 | variableNameIndex = 4; // Actuated Component Control Type | |
| 8721 | } | ||
| 8722 | |||
| 8723 |
2/3✓ Branch 1 taken 192 times.
✓ Branch 5 taken 192 times.
✗ Branch 6 not taken.
|
384 | if ((value = object.getString(variableNameIndex))) { |
| 8724 | |||
| 8725 |
2/2✓ Branch 1 taken 192 times.
✓ Branch 4 taken 192 times.
|
192 | std::string variableName = value.get(); |
| 8726 | // Strip consecutive spaces and all | ||
| 8727 |
1/1✓ Branch 1 taken 192 times.
|
192 | variableName = boost::regex_replace(variableName, re_strip_multiple_spaces, " "); |
| 8728 | |||
| 8729 |
1/1✓ Branch 1 taken 192 times.
|
192 | auto it = replaceOutputVariablesMap.find(variableName); |
| 8730 |
2/2✓ Branch 2 taken 179 times.
✓ Branch 3 taken 13 times.
|
192 | if (it == replaceOutputVariablesMap.end()) { |
| 8731 | // No-op | ||
| 8732 |
1/1✓ Branch 1 taken 179 times.
|
179 | ss << object; |
| 8733 | } else { | ||
| 8734 | |||
| 8735 | // Copy everything but 'Variable Name' field | ||
| 8736 |
1/1✓ Branch 1 taken 13 times.
|
13 | auto iddObject = idd_3_7_0.getObject(iddname); |
| 8737 |
2/2✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
|
13 | IdfObject newObject(iddObject.get()); |
| 8738 | |||
| 8739 |
3/3✓ Branch 1 taken 65 times.
✓ Branch 3 taken 52 times.
✓ Branch 4 taken 13 times.
|
65 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 8740 |
2/2✓ Branch 0 taken 13 times.
✓ Branch 1 taken 39 times.
|
52 | if (i == variableNameIndex) { |
| 8741 | 13 | continue; | |
| 8742 |
2/3✓ Branch 1 taken 39 times.
✓ Branch 5 taken 39 times.
✗ Branch 6 not taken.
|
78 | } else if ((value = object.getString(i))) { |
| 8743 |
2/2✓ Branch 1 taken 39 times.
✓ Branch 4 taken 39 times.
|
39 | newObject.setString(i, value.get()); |
| 8744 | } | ||
| 8745 | } | ||
| 8746 | |||
| 8747 |
11/11✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
✓ Branch 7 taken 13 times.
✓ Branch 10 taken 13 times.
✓ Branch 14 taken 13 times.
✓ Branch 17 taken 13 times.
✓ Branch 20 taken 13 times.
✓ Branch 23 taken 13 times.
✓ Branch 27 taken 13 times.
✓ Branch 30 taken 13 times.
✓ Branch 33 taken 13 times.
|
13 | LOG(Trace, "Replacing " << variableName << " with " << it->second << " for " << object.nameString()); |
| 8748 |
1/1✓ Branch 2 taken 13 times.
|
13 | newObject.setString(variableNameIndex, it->second); |
| 8749 | |||
| 8750 |
1/1✓ Branch 1 taken 13 times.
|
13 | ss << newObject; |
| 8751 |
1/1✓ Branch 3 taken 13 times.
|
13 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 8752 | 13 | } | |
| 8753 | 192 | } else { | |
| 8754 | // No-op | ||
| 8755 | ✗ | ss << object; | |
| 8756 | } | ||
| 8757 | |||
| 8758 |
1/1✓ Branch 3 taken 63930 times.
|
63930 | } else if (auto it = std::find_if(crankcaseCoilWithIndex.cbegin(), crankcaseCoilWithIndex.cend(), |
| 8759 | 638969 | [&iddname](const auto& p) { return iddname == p.first; }); | |
| 8760 |
2/2✓ Branch 1 taken 50 times.
✓ Branch 2 taken 63880 times.
|
63930 | it != crankcaseCoilWithIndex.cend()) { |
| 8761 | |||
| 8762 | // Fields that have been added from 3.6.1 to 3.7.0: | ||
| 8763 | // ------------------------------------------------ | ||
| 8764 | // * Crankcase Heater Capacity Function of Temperature Curve Name * (varies) | ||
| 8765 | |||
| 8766 | 50 | const size_t insertionIndex = it->second; | |
| 8767 | |||
| 8768 |
1/1✓ Branch 1 taken 50 times.
|
50 | auto iddObject = idd_3_7_0.getObject(iddname); |
| 8769 |
2/2✓ Branch 1 taken 50 times.
✓ Branch 4 taken 50 times.
|
50 | IdfObject newObject(iddObject.get()); |
| 8770 | |||
| 8771 |
3/3✓ Branch 1 taken 1456 times.
✓ Branch 3 taken 1406 times.
✓ Branch 4 taken 50 times.
|
1456 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 8772 |
2/3✓ Branch 1 taken 1406 times.
✓ Branch 5 taken 1406 times.
✗ Branch 6 not taken.
|
2812 | if ((value = object.getString(i))) { |
| 8773 |
2/2✓ Branch 0 taken 1086 times.
✓ Branch 1 taken 320 times.
|
1406 | if (i < insertionIndex) { |
| 8774 |
2/2✓ Branch 1 taken 1086 times.
✓ Branch 4 taken 1086 times.
|
1086 | newObject.setString(i, value.get()); |
| 8775 | } else { | ||
| 8776 |
2/2✓ Branch 1 taken 320 times.
✓ Branch 4 taken 320 times.
|
320 | newObject.setString(i + 1, value.get()); |
| 8777 | } | ||
| 8778 | } | ||
| 8779 | } | ||
| 8780 | |||
| 8781 | // Cranckcase curve is optional | ||
| 8782 | // newObject.setString(insertionIndex; ""); | ||
| 8783 | |||
| 8784 |
2/2✓ Branch 1 taken 50 times.
✓ Branch 4 taken 50 times.
|
50 | m_refactored.push_back(RefactoredObjectData(object, newObject)); |
| 8785 |
1/1✓ Branch 1 taken 50 times.
|
50 | ss << newObject; |
| 8786 | |||
| 8787 |
3/3✓ Branch 4 taken 63880 times.
✓ Branch 7 taken 56 times.
✓ Branch 8 taken 63824 times.
|
63930 | } else if (fuelTypeRenamesMap.find(iddname) != fuelTypeRenamesMap.end()) { |
| 8788 |
10/10✓ Branch 1 taken 56 times.
✓ Branch 4 taken 56 times.
✓ Branch 7 taken 56 times.
✓ Branch 10 taken 56 times.
✓ Branch 13 taken 56 times.
✓ Branch 16 taken 56 times.
✓ Branch 19 taken 56 times.
✓ Branch 23 taken 56 times.
✓ Branch 26 taken 56 times.
✓ Branch 29 taken 56 times.
|
56 | LOG(Trace, "Checking for a fuel type rename in Object of type '" << iddname << "' and named '" << object.nameString() << "'"); |
| 8789 |
1/1✓ Branch 1 taken 56 times.
|
56 | auto rangeFields = fuelTypeRenamesMap.equal_range(iddname); |
| 8790 | // First pass, find if a replacement is needed | ||
| 8791 | 56 | bool isReplaceNeeded = false; | |
| 8792 |
2/2✓ Branch 2 taken 88 times.
✓ Branch 3 taken 36 times.
|
124 | for (auto it = rangeFields.first; it != rangeFields.second; ++it) { |
| 8793 |
3/3✓ Branch 2 taken 88 times.
✓ Branch 4 taken 20 times.
✓ Branch 5 taken 68 times.
|
88 | if (checkIfReplaceNeeded(object, it->second)) { |
| 8794 | 20 | isReplaceNeeded = true; | |
| 8795 | 20 | break; | |
| 8796 | } | ||
| 8797 | } | ||
| 8798 |
2/2✓ Branch 0 taken 20 times.
✓ Branch 1 taken 36 times.
|
56 | if (isReplaceNeeded) { |
| 8799 |
5/5✓ Branch 1 taken 20 times.
✓ Branch 4 taken 20 times.
✓ Branch 7 taken 20 times.
✓ Branch 10 taken 20 times.
✓ Branch 13 taken 20 times.
|
20 | LOG(Trace, "Replace needed!"); |
| 8800 | |||
| 8801 | // Make a new object, and copy evertything in place | ||
| 8802 |
1/1✓ Branch 1 taken 20 times.
|
20 | auto iddObject = idd_3_7_0.getObject(iddname); |
| 8803 |
2/2✓ Branch 1 taken 20 times.
✓ Branch 4 taken 20 times.
|
20 | IdfObject newObject(iddObject.get()); |
| 8804 |
3/3✓ Branch 1 taken 1067 times.
✓ Branch 3 taken 1047 times.
✓ Branch 4 taken 20 times.
|
1067 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 8805 |
2/3✓ Branch 1 taken 1047 times.
✓ Branch 5 taken 1047 times.
✗ Branch 6 not taken.
|
2094 | if ((value = object.getString(i))) { |
| 8806 |
2/2✓ Branch 1 taken 1047 times.
✓ Branch 4 taken 1047 times.
|
1047 | newObject.setString(i, value.get()); |
| 8807 | } | ||
| 8808 | } | ||
| 8809 | |||
| 8810 | // Then handle the renames | ||
| 8811 |
2/2✓ Branch 2 taken 24 times.
✓ Branch 3 taken 20 times.
|
44 | for (auto it = rangeFields.first; it != rangeFields.second; ++it) { |
| 8812 |
1/1✓ Branch 2 taken 24 times.
|
24 | replaceForField(object, newObject, it->second); |
| 8813 | } | ||
| 8814 | |||
| 8815 |
1/1✓ Branch 1 taken 20 times.
|
20 | ss << newObject; |
| 8816 |
1/1✓ Branch 3 taken 20 times.
|
20 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 8817 | 20 | } else { | |
| 8818 | // No-op | ||
| 8819 |
1/1✓ Branch 1 taken 36 times.
|
36 | ss << object; |
| 8820 | } | ||
| 8821 | |||
| 8822 | // } else if ((iddname == "OS:Coil:Heating:Gas") || (iddname == "OS:Coil:Heating:Gas:MultiStage") | ||
| 8823 | // || (iddname == "OS:Coil:Heating:Gas:MultiStage:StageData") || (iddname == "OS:Coil:Heating:Desuperheater")) { | ||
| 8824 | // | ||
| 8825 | // // No-op: only field name changes: | ||
| 8826 | // // * Change Parasitic Electric Load => On Cycle Parasitic Electric Load | ||
| 8827 | // // * Change Parasitic Gas Load => Off Cycle Parasitic Gas Load | ||
| 8828 | // ss << object; | ||
| 8829 | |||
| 8830 |
3/3✓ Branch 1 taken 63824 times.
✓ Branch 3 taken 22 times.
✓ Branch 4 taken 63802 times.
|
63824 | } else if (iddname == "OS:Controller:OutdoorAir") { |
| 8831 | |||
| 8832 | // 1 Field has been added from 3.6.1 to 3.7.0: | ||
| 8833 | // ------------------------------------------- | ||
| 8834 | // * Economizer Operation Staging * 27 | ||
| 8835 |
1/1✓ Branch 1 taken 22 times.
|
22 | auto iddObject = idd_3_7_0.getObject(iddname); |
| 8836 |
2/2✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
|
22 | IdfObject newObject(iddObject.get()); |
| 8837 | |||
| 8838 |
3/3✓ Branch 1 taken 616 times.
✓ Branch 3 taken 594 times.
✓ Branch 4 taken 22 times.
|
616 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 8839 |
2/3✓ Branch 1 taken 594 times.
✓ Branch 5 taken 594 times.
✗ Branch 6 not taken.
|
1188 | if ((value = object.getString(i))) { |
| 8840 |
2/2✓ Branch 1 taken 594 times.
✓ Branch 4 taken 594 times.
|
594 | newObject.setString(i, value.get()); |
| 8841 | } | ||
| 8842 | } | ||
| 8843 | |||
| 8844 |
2/2✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
|
22 | newObject.setString(27, "InterlockedWithMechanicalCooling"); |
| 8845 | |||
| 8846 |
2/2✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
|
22 | m_refactored.push_back(RefactoredObjectData(object, newObject)); |
| 8847 |
1/1✓ Branch 1 taken 22 times.
|
22 | ss << newObject; |
| 8848 | |||
| 8849 |
3/3✓ Branch 3 taken 63802 times.
✓ Branch 5 taken 1 time.
✓ Branch 6 taken 63801 times.
|
63824 | } else if (iddname == "OS:LoadProfile:Plant") { |
| 8850 | |||
| 8851 | // Fields that have been added from 3.6.1 to 3.7.0: | ||
| 8852 | // ------------------------------------------------ | ||
| 8853 | // * Plant Loop Fluid Type * 7 | ||
| 8854 | // * Degree of SubCooling * 8 | ||
| 8855 | // * Degree of Loop SubCooling * 9 | ||
| 8856 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto iddObject = idd_3_7_0.getObject(iddname); |
| 8857 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfObject newObject(iddObject.get()); |
| 8858 | |||
| 8859 |
3/3✓ Branch 1 taken 8 times.
✓ Branch 3 taken 7 times.
✓ Branch 4 taken 1 time.
|
8 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 8860 |
2/3✓ Branch 1 taken 7 times.
✓ Branch 5 taken 7 times.
✗ Branch 6 not taken.
|
14 | if ((value = object.getString(i))) { |
| 8861 |
2/2✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
|
7 | newObject.setString(i, value.get()); |
| 8862 | } | ||
| 8863 | } | ||
| 8864 | |||
| 8865 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | newObject.setString(7, "Water"); |
| 8866 |
1/1✓ Branch 1 taken 1 time.
|
1 | newObject.setDouble(8, 5.0); |
| 8867 |
1/1✓ Branch 1 taken 1 time.
|
1 | newObject.setDouble(9, 20.0); |
| 8868 | |||
| 8869 |
1/1✓ Branch 1 taken 1 time.
|
1 | ss << newObject; |
| 8870 |
1/1✓ Branch 3 taken 1 time.
|
1 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 8871 | |||
| 8872 |
3/3✓ Branch 3 taken 63801 times.
✓ Branch 5 taken 1 time.
✓ Branch 6 taken 63800 times.
|
63802 | } else if (iddname == "OS:HeatPump:PlantLoop:EIR:Cooling") { |
| 8873 | |||
| 8874 | // Fields that have been added from 3.6.1 to 3.7.0: | ||
| 8875 | // ------------------------------------------------ | ||
| 8876 | // * Control Type * 16 | ||
| 8877 | // * Flow Mode * 17 | ||
| 8878 | // * Minimum Part Load Ratio * 18 | ||
| 8879 | // * Minimum Source Inlet Temperature * 19 | ||
| 8880 | // * Maximum Source Inlet Temperature * 20 | ||
| 8881 | // * Minimum Supply Water Temperature Curve Name * 21 --- Optional | ||
| 8882 | // * Maximum Supply Water Temperature Curve Name * 22 --- Optional | ||
| 8883 | |||
| 8884 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto iddObject = idd_3_7_0.getObject(iddname); |
| 8885 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfObject newObject(iddObject.get()); |
| 8886 | |||
| 8887 |
3/3✓ Branch 1 taken 17 times.
✓ Branch 3 taken 16 times.
✓ Branch 4 taken 1 time.
|
17 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 8888 |
2/3✓ Branch 1 taken 16 times.
✓ Branch 5 taken 16 times.
✗ Branch 6 not taken.
|
32 | if ((value = object.getString(i))) { |
| 8889 |
2/2✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
|
16 | newObject.setString(i, value.get()); |
| 8890 | } | ||
| 8891 | } | ||
| 8892 | |||
| 8893 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | newObject.setString(16, "Load"); |
| 8894 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | newObject.setString(17, "ConstantFlow"); |
| 8895 |
1/1✓ Branch 1 taken 1 time.
|
1 | newObject.setDouble(18, 0.0); |
| 8896 |
1/1✓ Branch 1 taken 1 time.
|
1 | newObject.setDouble(19, -100.0); |
| 8897 |
1/1✓ Branch 1 taken 1 time.
|
1 | newObject.setDouble(20, 100.0); |
| 8898 | |||
| 8899 |
1/1✓ Branch 1 taken 1 time.
|
1 | ss << newObject; |
| 8900 |
1/1✓ Branch 3 taken 1 time.
|
1 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 8901 | |||
| 8902 |
3/3✓ Branch 3 taken 63800 times.
✓ Branch 5 taken 1 time.
✓ Branch 6 taken 63799 times.
|
63801 | } else if (iddname == "OS:HeatPump:PlantLoop:EIR:Heating") { |
| 8903 | |||
| 8904 | // Fields that have been added from 3.6.1 to 3.7.0: | ||
| 8905 | // ------------------------------------------------ | ||
| 8906 | // * Heating To Cooling Capacity Sizing Ratio * 16 | ||
| 8907 | // * Heat Pump Sizing Method * 17 | ||
| 8908 | // * Control Type * 18 | ||
| 8909 | // * Flow Mode * 19 | ||
| 8910 | // * Minimum Part Load Ratio * 20 | ||
| 8911 | // * Minimum Source Inlet Temperature * 21 | ||
| 8912 | // * Maximum Source Inlet Temperature * 22 | ||
| 8913 | // * Minimum Supply Water Temperature Curve Name * 23 --- Optional | ||
| 8914 | // * Maximum Supply Water Temperature Curve Name * 24 --- Optional | ||
| 8915 | // * Dry Outdoor Correction Factor Curve Name * 25 | ||
| 8916 | // * Maximum Outdoor Dry Bulb Temperature For Defrost Operation * 26 | ||
| 8917 | // * Heat Pump Defrost Control * 27 | ||
| 8918 | // * Heat Pump Defrost Time Period Fraction * 28 | ||
| 8919 | // * Defrost Energy Input Ratio Function of Temperature Curve Name * 29 --- Optional | ||
| 8920 | // * Timed Empirical Defrost Frequency Curve Name * 30 --- Optional | ||
| 8921 | // * Timed Empirical Defrost Heat Load Penalty Curve Name * 31 --- Optional | ||
| 8922 | // * Timed Empirical Defrost Heat Input Energy Fraction Curve Name * 32 --- Optional | ||
| 8923 | |||
| 8924 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto iddObject = idd_3_7_0.getObject(iddname); |
| 8925 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfObject newObject(iddObject.get()); |
| 8926 | |||
| 8927 |
3/3✓ Branch 1 taken 17 times.
✓ Branch 3 taken 16 times.
✓ Branch 4 taken 1 time.
|
17 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 8928 |
2/3✓ Branch 1 taken 16 times.
✓ Branch 5 taken 16 times.
✗ Branch 6 not taken.
|
32 | if ((value = object.getString(i))) { |
| 8929 |
2/2✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
|
16 | newObject.setString(i, value.get()); |
| 8930 | } | ||
| 8931 | } | ||
| 8932 |
1/1✓ Branch 1 taken 1 time.
|
1 | newObject.setDouble(16, 1.0); |
| 8933 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | newObject.setString(17, "CoolingCapacity"); |
| 8934 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | newObject.setString(18, "Load"); |
| 8935 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | newObject.setString(19, "ConstantFlow"); |
| 8936 | |||
| 8937 |
1/1✓ Branch 1 taken 1 time.
|
1 | newObject.setDouble(20, 0.0); |
| 8938 |
1/1✓ Branch 1 taken 1 time.
|
1 | newObject.setDouble(21, -100.0); |
| 8939 |
1/1✓ Branch 1 taken 1 time.
|
1 | newObject.setDouble(22, 100.0); |
| 8940 | |||
| 8941 |
1/1✓ Branch 1 taken 1 time.
|
1 | newObject.setDouble(26, 10.0); |
| 8942 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | newObject.setString(27, "None"); |
| 8943 |
1/1✓ Branch 1 taken 1 time.
|
1 | newObject.setDouble(28, 0.058333); |
| 8944 | |||
| 8945 |
1/1✓ Branch 1 taken 1 time.
|
1 | ss << newObject; |
| 8946 |
1/1✓ Branch 3 taken 1 time.
|
1 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 8947 | |||
| 8948 | // No-op | ||
| 8949 | 1 | } else { | |
| 8950 |
1/1✓ Branch 1 taken 63799 times.
|
63799 | ss << object; |
| 8951 | } | ||
| 8952 | 64368 | } | |
| 8953 | |||
| 8954 |
1/1✓ Branch 1 taken 117 times.
|
234 | return ss.str(); |
| 8955 | |||
| 8956 | 467 | } // end update_3_6_1_to_3_7_0 | |
| 8957 | |||
| 8958 | 126 | std::string VersionTranslator::update_3_7_0_to_3_8_0(const IdfFile& idf_3_7_0, const IddFileAndFactoryWrapper& idd_3_8_0) { | |
| 8959 |
1/1✓ Branch 1 taken 126 times.
|
126 | std::stringstream ss; |
| 8960 | 126 | boost::optional<std::string> value; | |
| 8961 | |||
| 8962 |
4/4✓ Branch 1 taken 126 times.
✓ Branch 4 taken 126 times.
✓ Branch 7 taken 126 times.
✓ Branch 10 taken 126 times.
|
126 | ss << idf_3_7_0.header() << '\n' << '\n'; |
| 8963 |
2/2✓ Branch 1 taken 126 times.
✓ Branch 4 taken 126 times.
|
126 | IdfFile targetIdf(idd_3_8_0.iddFile()); |
| 8964 |
3/3✓ Branch 1 taken 126 times.
✓ Branch 4 taken 126 times.
✓ Branch 7 taken 126 times.
|
126 | ss << targetIdf.versionObject().get(); |
| 8965 | |||
| 8966 | 126 | constexpr std::array<int, 4> hx_old_100effectiveness_idxs{4, 5, 8, 9}; | |
| 8967 | 126 | constexpr std::array<int, 4> hx_new_effectiveness_curves_idxs{20, 21, 22, 23}; | |
| 8968 | 126 | constexpr std::array<std::string_view, 4> hx_new_table_names{"SensHeat", "LatHeat", "SensCool", "LatCool"}; | |
| 8969 | |||
| 8970 |
3/3✓ Branch 1 taken 126 times.
✓ Branch 8 taken 65631 times.
✓ Branch 9 taken 126 times.
|
65757 | for (const IdfObject& object : idf_3_7_0.objects()) { |
| 8971 |
2/2✓ Branch 1 taken 65631 times.
✓ Branch 4 taken 65631 times.
|
65631 | auto iddname = object.iddObject().name(); |
| 8972 | |||
| 8973 |
3/3✓ Branch 1 taken 65631 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 65630 times.
|
65631 | if (iddname == "OS:HeatExchanger:AirToAir:SensibleAndLatent") { |
| 8974 | |||
| 8975 | // 4 Fields have been removed from 3.7.0 to 3.8.0: | ||
| 8976 | // ---------------------------------------------- | ||
| 8977 | // * Sensible Effectiveness at 75% Heating Air Flow {dimensionless} * 6 | ||
| 8978 | // * Latent Effectiveness at 75% Heating Air Flow {dimensionless} * 7 | ||
| 8979 | // * Sensible Effectiveness at 75% Cooling Air Flow {dimensionless} * 10 | ||
| 8980 | // * Latent Effectiveness at 75% Cooling Air Flow {dimensionless} * 11 | ||
| 8981 | |||
| 8982 | // 4 Fields have been added from 3.7.0 to 3.8.0: | ||
| 8983 | // ---------------------------------------------- | ||
| 8984 | // * Sensible Effectiveness of Heating Air Flow Curve Name * 20 | ||
| 8985 | // * Latent Effectiveness of Heating Air Flow Curve Name * 21 | ||
| 8986 | // * Sensible Effectiveness of Cooling Air Flow Curve Name * 22 | ||
| 8987 | // * Latent Effectiveness of Cooling Air Flow Curve Name * 23 | ||
| 8988 | |||
| 8989 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto iddObject = idd_3_8_0.getObject(iddname); |
| 8990 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfObject newObject(iddObject.get()); |
| 8991 | |||
| 8992 |
3/3✓ Branch 1 taken 25 times.
✓ Branch 3 taken 24 times.
✓ Branch 4 taken 1 time.
|
25 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 8993 |
2/3✓ Branch 1 taken 24 times.
✓ Branch 5 taken 24 times.
✗ Branch 6 not taken.
|
48 | if ((value = object.getString(i))) { |
| 8994 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 18 times.
|
24 | if (i < 6) { |
| 8995 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
6 | newObject.setString(i, value.get()); |
| 8996 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 2 times.
|
18 | } else if (i < 8) { |
| 8997 | // no op | ||
| 8998 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 14 times.
|
16 | } else if (i < 10) { |
| 8999 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | newObject.setString(i - 2, value.get()); |
| 9000 |
2/2✓ Branch 0 taken 12 times.
✓ Branch 1 taken 2 times.
|
14 | } else if (i < 12) { |
| 9001 | // no op | ||
| 9002 | } else { | ||
| 9003 |
2/2✓ Branch 1 taken 12 times.
✓ Branch 4 taken 12 times.
|
12 | newObject.setString(i - 4, value.get()); |
| 9004 | } | ||
| 9005 | } | ||
| 9006 | } | ||
| 9007 | |||
| 9008 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | const std::string varListHandle = toString(createUUID()); |
| 9009 | 1 | bool tableAdded = false; | |
| 9010 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 1 time.
|
10 | for (size_t i = 0; i < hx_old_100effectiveness_idxs.size(); ++i) { |
| 9011 | // Sensible/Latent Effectiveness at 100% Heating/Cooling Air Flow {dimensionless} | ||
| 9012 |
2/3✓ Branch 2 taken 4 times.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
|
8 | if (auto e100 = object.getDouble(hx_old_100effectiveness_idxs[i])) { |
| 9013 | // Sensible/Latent Effectiveness at 75% Heating/Cooling Air Flow {dimensionless} | ||
| 9014 | |||
| 9015 |
2/3✓ Branch 2 taken 4 times.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
|
8 | if (auto e75 = object.getDouble(hx_old_100effectiveness_idxs[i] + 2)) { |
| 9016 |
3/4✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 6 taken 4 times.
✗ Branch 7 not taken.
|
4 | if (e100.get() != e75.get()) { |
| 9017 | 4 | tableAdded = true; | |
| 9018 | |||
| 9019 |
4/4✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✓ Branch 10 taken 4 times.
|
4 | IdfObject tableLookup(idd_3_8_0.getObject("OS:Table:Lookup").get()); |
| 9020 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | std::string uuid = toString(createUUID()); |
| 9021 |
1/1✓ Branch 1 taken 4 times.
|
4 | tableLookup.setString(0, uuid); // Handle |
| 9022 |
2/2✓ Branch 2 taken 4 times.
✓ Branch 6 taken 4 times.
|
8 | tableLookup.setString(1, fmt::format("{}_{}Eff", object.nameString(), hx_new_table_names[i])); // Name |
| 9023 |
1/1✓ Branch 1 taken 4 times.
|
4 | tableLookup.setString(2, varListHandle); // Independent Variable List Name |
| 9024 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | tableLookup.setString(3, "DivisorOnly"); // Normalization Method |
| 9025 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | tableLookup.setDouble(4, e100.get()); // Normalization Divisor |
| 9026 |
1/1✓ Branch 1 taken 4 times.
|
4 | tableLookup.setDouble(5, 0.0); // Minimum Output |
| 9027 |
1/1✓ Branch 1 taken 4 times.
|
4 | tableLookup.setDouble(6, 10.0); // Maximum Output |
| 9028 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | tableLookup.setString(7, "Dimensionless"); // Output Unit Type |
| 9029 |
3/3✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
|
4 | tableLookup.pushExtensibleGroup().setDouble(0, e75.get()); // Output Value 1 |
| 9030 |
3/3✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
|
4 | tableLookup.pushExtensibleGroup().setDouble(0, e100.get()); // Output Value 2 |
| 9031 | |||
| 9032 | // Sensible/Latent Effectiveness of Heating/Cooling Air Flow Curve Name | ||
| 9033 |
1/1✓ Branch 2 taken 4 times.
|
4 | newObject.setString(hx_new_effectiveness_curves_idxs[i], uuid); |
| 9034 | |||
| 9035 |
1/1✓ Branch 1 taken 4 times.
|
4 | ss << tableLookup; |
| 9036 |
1/1✓ Branch 1 taken 4 times.
|
4 | m_new.push_back(tableLookup); |
| 9037 | 4 | } | |
| 9038 | } | ||
| 9039 | } | ||
| 9040 | } | ||
| 9041 | |||
| 9042 |
1/1✓ Branch 1 taken 1 time.
|
1 | ss << newObject; |
| 9043 |
1/1✓ Branch 2 taken 1 time.
|
1 | m_refactored.emplace_back(object, std::move(newObject)); |
| 9044 | |||
| 9045 |
1/2✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
|
1 | if (tableAdded) { |
| 9046 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
|
1 | IdfObject varList(idd_3_8_0.getObject("OS:ModelObjectList").get()); |
| 9047 |
1/1✓ Branch 1 taken 1 time.
|
1 | varList.setString(0, varListHandle); |
| 9048 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | varList.setString(1, object.nameString() + "_IndependentVariableList"); // Name |
| 9049 | |||
| 9050 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
|
1 | IdfObject var(idd_3_8_0.getObject("OS:Table:IndependentVariable").get()); |
| 9051 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | std::string varHandle = toString(createUUID()); |
| 9052 |
1/1✓ Branch 1 taken 1 time.
|
1 | var.setString(0, varHandle); |
| 9053 |
4/6✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 8 taken 1 time.
✓ Branch 9 taken 1 time.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
|
3 | varList.pushExtensibleGroup({varHandle}); // Model Object 1 |
| 9054 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | var.setString(1, object.nameString() + "_IndependentVariable"); // Name |
| 9055 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | var.setString(2, "Linear"); // Interpolation Method |
| 9056 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | var.setString(3, "Linear"); // Extrapolation Method |
| 9057 |
1/1✓ Branch 1 taken 1 time.
|
1 | var.setDouble(4, 0.0); // Minimum Value |
| 9058 |
1/1✓ Branch 1 taken 1 time.
|
1 | var.setDouble(5, 10.0); // Maximum Value |
| 9059 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | var.setString(7, "Dimensionless"); // Unit Type |
| 9060 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | var.pushExtensibleGroup().setDouble(0, 0.75); // Value 1 |
| 9061 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | var.pushExtensibleGroup().setDouble(0, 1.0); // Value 2 |
| 9062 | |||
| 9063 |
1/1✓ Branch 1 taken 1 time.
|
1 | ss << varList; |
| 9064 |
1/1✓ Branch 2 taken 1 time.
|
1 | m_new.emplace_back(std::move(varList)); |
| 9065 | |||
| 9066 |
1/1✓ Branch 1 taken 1 time.
|
1 | ss << var; |
| 9067 |
1/1✓ Branch 2 taken 1 time.
|
1 | m_new.emplace_back(std::move(var)); |
| 9068 | 1 | } | |
| 9069 | |||
| 9070 |
8/8✓ Branch 4 taken 65630 times.
✓ Branch 6 taken 65628 times.
✓ Branch 7 taken 2 times.
✓ Branch 9 taken 65628 times.
✓ Branch 11 taken 2 times.
✓ Branch 12 taken 65626 times.
✓ Branch 13 taken 4 times.
✓ Branch 14 taken 65626 times.
|
65631 | } else if ((iddname == "OS:ZoneHVAC:PackagedTerminalAirConditioner") || (iddname == "OS:ZoneHVAC:PackagedTerminalHeatPump")) { |
| 9071 | |||
| 9072 | // 1 Field has been added from 3.7.0 to 3.8.0: | ||
| 9073 | // ---------------------------------------------- | ||
| 9074 | // * No Load Supply Air Flow Rate Control Set To Low Speed * 10 | ||
| 9075 |
1/1✓ Branch 1 taken 4 times.
|
4 | auto iddObject = idd_3_8_0.getObject(iddname); |
| 9076 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | IdfObject newObject(iddObject.get()); |
| 9077 | |||
| 9078 |
3/3✓ Branch 1 taken 88 times.
✓ Branch 3 taken 84 times.
✓ Branch 4 taken 4 times.
|
88 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 9079 |
2/3✓ Branch 1 taken 84 times.
✓ Branch 5 taken 84 times.
✗ Branch 6 not taken.
|
168 | if ((value = object.getString(i))) { |
| 9080 |
2/2✓ Branch 0 taken 40 times.
✓ Branch 1 taken 44 times.
|
84 | if (i < 10) { |
| 9081 |
2/2✓ Branch 1 taken 40 times.
✓ Branch 4 taken 40 times.
|
40 | newObject.setString(i, value.get()); |
| 9082 | } else { | ||
| 9083 |
2/2✓ Branch 1 taken 44 times.
✓ Branch 4 taken 44 times.
|
44 | newObject.setString(i + 1, value.get()); |
| 9084 | } | ||
| 9085 | } | ||
| 9086 | } | ||
| 9087 | |||
| 9088 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | newObject.setString(10, "Yes"); |
| 9089 | |||
| 9090 |
1/1✓ Branch 1 taken 4 times.
|
4 | ss << newObject; |
| 9091 |
1/1✓ Branch 3 taken 4 times.
|
4 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 9092 | |||
| 9093 |
3/3✓ Branch 3 taken 65626 times.
✓ Branch 5 taken 3 times.
✓ Branch 6 taken 65623 times.
|
65630 | } else if (iddname == "OS:ZoneHVAC:WaterToAirHeatPump") { |
| 9094 | |||
| 9095 | // 1 Field has been added from 3.7.0 to 3.8.0: | ||
| 9096 | // ---------------------------------------------- | ||
| 9097 | // * No Load Supply Air Flow Rate Control Set To Low Speed * 9 | ||
| 9098 |
1/1✓ Branch 1 taken 3 times.
|
3 | auto iddObject = idd_3_8_0.getObject(iddname); |
| 9099 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | IdfObject newObject(iddObject.get()); |
| 9100 | |||
| 9101 |
3/3✓ Branch 1 taken 69 times.
✓ Branch 3 taken 66 times.
✓ Branch 4 taken 3 times.
|
69 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 9102 |
2/3✓ Branch 1 taken 66 times.
✓ Branch 5 taken 66 times.
✗ Branch 6 not taken.
|
132 | if ((value = object.getString(i))) { |
| 9103 |
2/2✓ Branch 0 taken 27 times.
✓ Branch 1 taken 39 times.
|
66 | if (i < 9) { |
| 9104 |
2/2✓ Branch 1 taken 27 times.
✓ Branch 4 taken 27 times.
|
27 | newObject.setString(i, value.get()); |
| 9105 | } else { | ||
| 9106 |
2/2✓ Branch 1 taken 39 times.
✓ Branch 4 taken 39 times.
|
39 | newObject.setString(i + 1, value.get()); |
| 9107 | } | ||
| 9108 | } | ||
| 9109 | } | ||
| 9110 | |||
| 9111 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | newObject.setString(9, "Yes"); |
| 9112 | |||
| 9113 |
1/1✓ Branch 1 taken 3 times.
|
3 | ss << newObject; |
| 9114 |
1/1✓ Branch 3 taken 3 times.
|
3 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 9115 | |||
| 9116 |
3/3✓ Branch 3 taken 65623 times.
✓ Branch 5 taken 17 times.
✓ Branch 6 taken 65606 times.
|
65626 | } else if (iddname == "OS:AirLoopHVAC:UnitarySystem") { |
| 9117 | |||
| 9118 | // 1 Field has been added from 3.7.0 to 3.8.0: | ||
| 9119 | // ---------------------------------------------- | ||
| 9120 | // * No Load Supply Air Flow Rate Control Set To Low Speed * 35 | ||
| 9121 |
1/1✓ Branch 1 taken 17 times.
|
17 | auto iddObject = idd_3_8_0.getObject(iddname); |
| 9122 |
2/2✓ Branch 1 taken 17 times.
✓ Branch 4 taken 17 times.
|
17 | IdfObject newObject(iddObject.get()); |
| 9123 | |||
| 9124 |
3/3✓ Branch 1 taken 697 times.
✓ Branch 3 taken 680 times.
✓ Branch 4 taken 17 times.
|
697 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 9125 |
2/3✓ Branch 1 taken 680 times.
✓ Branch 5 taken 680 times.
✗ Branch 6 not taken.
|
1360 | if ((value = object.getString(i))) { |
| 9126 |
2/2✓ Branch 0 taken 595 times.
✓ Branch 1 taken 85 times.
|
680 | if (i < 35) { |
| 9127 |
2/2✓ Branch 1 taken 595 times.
✓ Branch 4 taken 595 times.
|
595 | newObject.setString(i, value.get()); |
| 9128 | } else { | ||
| 9129 |
2/2✓ Branch 1 taken 85 times.
✓ Branch 4 taken 85 times.
|
85 | newObject.setString(i + 1, value.get()); |
| 9130 | } | ||
| 9131 | } | ||
| 9132 | } | ||
| 9133 | |||
| 9134 |
2/2✓ Branch 1 taken 17 times.
✓ Branch 4 taken 17 times.
|
17 | newObject.setString(35, "Yes"); |
| 9135 | |||
| 9136 |
1/1✓ Branch 1 taken 17 times.
|
17 | ss << newObject; |
| 9137 |
1/1✓ Branch 3 taken 17 times.
|
17 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 9138 | |||
| 9139 |
3/3✓ Branch 3 taken 65606 times.
✓ Branch 5 taken 608 times.
✓ Branch 6 taken 64998 times.
|
65623 | } else if (iddname == "OS:People:Definition") { |
| 9140 | |||
| 9141 | // 1 Key has been changed from 3.7.0 to 3.8.0: | ||
| 9142 | // ---------------------------------------------- | ||
| 9143 | // * Mean Radiant Temperature Calculation Type * 10 | ||
| 9144 | // * ZoneAveraged -> EnclosureAveraged | ||
| 9145 | |||
| 9146 |
1/1✓ Branch 1 taken 608 times.
|
608 | auto iddObject = idd_3_8_0.getObject(iddname); |
| 9147 |
2/2✓ Branch 1 taken 608 times.
✓ Branch 4 taken 608 times.
|
608 | IdfObject newObject(iddObject.get()); |
| 9148 | |||
| 9149 |
3/3✓ Branch 1 taken 6952 times.
✓ Branch 3 taken 6344 times.
✓ Branch 4 taken 608 times.
|
6952 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 9150 |
2/3✓ Branch 1 taken 6344 times.
✓ Branch 5 taken 6344 times.
✗ Branch 6 not taken.
|
12688 | if ((value = object.getString(i))) { |
| 9151 |
2/2✓ Branch 0 taken 419 times.
✓ Branch 1 taken 5925 times.
|
6344 | if (i == 10) { |
| 9152 |
4/5✓ Branch 1 taken 419 times.
✓ Branch 4 taken 419 times.
✓ Branch 7 taken 419 times.
✓ Branch 10 taken 419 times.
✗ Branch 11 not taken.
|
838 | if (istringEqual(value.get(), "ZoneAveraged")) { |
| 9153 |
2/2✓ Branch 1 taken 419 times.
✓ Branch 4 taken 419 times.
|
838 | newObject.setString(10, "EnclosureAveraged"); |
| 9154 | } else { | ||
| 9155 | ✗ | newObject.setString(10, value.get()); | |
| 9156 | } | ||
| 9157 | } else { | ||
| 9158 |
2/2✓ Branch 1 taken 5925 times.
✓ Branch 4 taken 5925 times.
|
5925 | newObject.setString(i, value.get()); |
| 9159 | } | ||
| 9160 | } | ||
| 9161 | } | ||
| 9162 | |||
| 9163 |
1/1✓ Branch 1 taken 608 times.
|
608 | ss << newObject; |
| 9164 |
1/1✓ Branch 3 taken 608 times.
|
608 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 9165 | |||
| 9166 |
3/3✓ Branch 3 taken 64998 times.
✓ Branch 5 taken 3294 times.
✓ Branch 6 taken 61704 times.
|
65606 | } else if (iddname == "OS:Schedule:Day") { |
| 9167 | |||
| 9168 | // 1 Field has been modified from 3.7.0 to 3.8.0: | ||
| 9169 | // ---------------------------------------------- | ||
| 9170 | // * Interpolate to Timestep * 3 - Changed from bool to string choice | ||
| 9171 | |||
| 9172 |
1/1✓ Branch 1 taken 3294 times.
|
3294 | auto iddObject = idd_3_8_0.getObject(iddname); |
| 9173 |
2/2✓ Branch 1 taken 3294 times.
✓ Branch 4 taken 3294 times.
|
3294 | IdfObject newObject(iddObject.get()); |
| 9174 | |||
| 9175 |
3/3✓ Branch 1 taken 46725 times.
✓ Branch 3 taken 43431 times.
✓ Branch 4 taken 3294 times.
|
46725 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 9176 |
2/3✓ Branch 1 taken 43431 times.
✓ Branch 5 taken 43431 times.
✗ Branch 6 not taken.
|
86862 | if ((value = object.getString(i))) { |
| 9177 |
2/2✓ Branch 0 taken 3294 times.
✓ Branch 1 taken 40137 times.
|
43431 | if (i == 3) { |
| 9178 |
5/5✓ Branch 1 taken 3294 times.
✓ Branch 4 taken 3294 times.
✓ Branch 7 taken 3294 times.
✓ Branch 10 taken 1 time.
✓ Branch 11 taken 3293 times.
|
6588 | if (istringEqual(value.get(), "Yes")) { |
| 9179 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | newObject.setString(3, "Average"); |
| 9180 | } else { | ||
| 9181 |
2/2✓ Branch 1 taken 3293 times.
✓ Branch 4 taken 3293 times.
|
6586 | newObject.setString(3, "No"); |
| 9182 | } | ||
| 9183 | } else { | ||
| 9184 |
2/2✓ Branch 1 taken 40137 times.
✓ Branch 4 taken 40137 times.
|
40137 | newObject.setString(i, value.get()); |
| 9185 | } | ||
| 9186 | } | ||
| 9187 | } | ||
| 9188 | |||
| 9189 |
1/1✓ Branch 1 taken 3294 times.
|
3294 | ss << newObject; |
| 9190 |
1/1✓ Branch 3 taken 3294 times.
|
3294 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 9191 | |||
| 9192 | // No-op | ||
| 9193 | 3294 | } else { | |
| 9194 |
1/1✓ Branch 1 taken 61704 times.
|
61704 | ss << object; |
| 9195 | } | ||
| 9196 | 65757 | } | |
| 9197 | |||
| 9198 |
1/1✓ Branch 1 taken 126 times.
|
252 | return ss.str(); |
| 9199 | |||
| 9200 | 127 | } // end update_3_7_0_to_3_8_0 | |
| 9201 | |||
| 9202 | 133 | std::string VersionTranslator::update_3_8_0_to_3_9_0(const IdfFile& idf_3_8_0, const IddFileAndFactoryWrapper& idd_3_9_0) { | |
| 9203 |
1/1✓ Branch 1 taken 133 times.
|
133 | std::stringstream ss; |
| 9204 | 133 | boost::optional<std::string> value; | |
| 9205 | |||
| 9206 |
4/4✓ Branch 1 taken 133 times.
✓ Branch 4 taken 133 times.
✓ Branch 7 taken 133 times.
✓ Branch 10 taken 133 times.
|
133 | ss << idf_3_8_0.header() << '\n' << '\n'; |
| 9207 |
2/2✓ Branch 1 taken 133 times.
✓ Branch 4 taken 133 times.
|
133 | IdfFile targetIdf(idd_3_9_0.iddFile()); |
| 9208 |
3/3✓ Branch 1 taken 133 times.
✓ Branch 4 taken 133 times.
✓ Branch 7 taken 133 times.
|
133 | ss << targetIdf.versionObject().get(); |
| 9209 | |||
| 9210 | // ZoneHVAC:TerminalUnit:VariableRefrigerantFlow prescan | ||
| 9211 | // In E+ v24.2.0, we must change Fan:VariableVolume to Fan:SystemModel for Supply Air Fan Object Type / Name. | ||
| 9212 | 133 | std::vector<std::string> vrfFanVVHandleStrs; | |
| 9213 | { | ||
| 9214 |
5/5✓ Branch 1 taken 133 times.
✓ Branch 4 taken 133 times.
✓ Branch 7 taken 133 times.
✓ Branch 10 taken 133 times.
✓ Branch 13 taken 133 times.
|
399 | std::vector<IdfObject> fanVVs = idf_3_8_0.getObjectsByType(idf_3_8_0.iddFile().getObject("OS:Fan:VariableVolume").get()); |
| 9215 | 133 | std::vector<std::string> fanVVHandleStrs; | |
| 9216 |
1/1✓ Branch 2 taken 133 times.
|
133 | fanVVHandleStrs.reserve(fanVVs.size()); |
| 9217 |
1/1✓ Branch 2 taken 133 times.
|
133 | vrfFanVVHandleStrs.reserve(fanVVs.size()); |
| 9218 |
2/2✓ Branch 1 taken 133 times.
✓ Branch 6 taken 133 times.
|
133 | std::transform(fanVVs.cbegin(), fanVVs.cend(), std::back_inserter(fanVVHandleStrs), |
| 9219 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | [](const auto& idfObject) { return idfObject.getString(0).get(); }); |
| 9220 |
7/7✓ Branch 1 taken 133 times.
✓ Branch 4 taken 133 times.
✓ Branch 7 taken 133 times.
✓ Branch 10 taken 133 times.
✓ Branch 13 taken 133 times.
✓ Branch 23 taken 4 times.
✓ Branch 24 taken 133 times.
|
403 | for (const auto& vrf : idf_3_8_0.getObjectsByType(idf_3_8_0.iddFile().getObject("OS:ZoneHVAC:TerminalUnit:VariableRefrigerantFlow").get())) { |
| 9221 |
2/3✓ Branch 1 taken 4 times.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
|
8 | if (auto fanHandleStr_ = vrf.getString(14, false, true)) { |
| 9222 |
4/4✓ Branch 2 taken 4 times.
✓ Branch 7 taken 4 times.
✓ Branch 10 taken 1 time.
✓ Branch 11 taken 3 times.
|
4 | if (std::find(fanVVHandleStrs.cbegin(), fanVVHandleStrs.cend(), fanHandleStr_.get()) != fanVVHandleStrs.cend()) { |
| 9223 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 5 taken 1 time.
|
1 | vrfFanVVHandleStrs.emplace_back(std::move(*fanHandleStr_)); |
| 9224 | } | ||
| 9225 | 4 | } | |
| 9226 | 133 | } | |
| 9227 | 133 | } | |
| 9228 | |||
| 9229 |
3/3✓ Branch 1 taken 133 times.
✓ Branch 8 taken 65682 times.
✓ Branch 9 taken 133 times.
|
65815 | for (const IdfObject& object : idf_3_8_0.objects()) { |
| 9230 |
2/2✓ Branch 1 taken 65682 times.
✓ Branch 4 taken 65682 times.
|
65682 | auto iddname = object.iddObject().name(); |
| 9231 | |||
| 9232 |
3/3✓ Branch 1 taken 65682 times.
✓ Branch 3 taken 29 times.
✓ Branch 4 taken 65653 times.
|
65682 | if (iddname == "OS:Controller:OutdoorAir") { |
| 9233 | |||
| 9234 | // 2 Fields have been made required from 3.8.0 to 3.9.0: | ||
| 9235 | // ---------------------------------------------- | ||
| 9236 | // * High Humidity Outdoor Air Flow Ratio * 24 | ||
| 9237 | // * Control High Indoor Humidity Based on Outdoor Humidity Ratio * 25 | ||
| 9238 | |||
| 9239 |
1/1✓ Branch 1 taken 29 times.
|
29 | auto iddObject = idd_3_9_0.getObject(iddname); |
| 9240 |
2/2✓ Branch 1 taken 29 times.
✓ Branch 4 taken 29 times.
|
29 | IdfObject newObject(iddObject.get()); |
| 9241 | |||
| 9242 |
3/3✓ Branch 1 taken 841 times.
✓ Branch 3 taken 812 times.
✓ Branch 4 taken 29 times.
|
841 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 9243 |
2/3✓ Branch 1 taken 812 times.
✓ Branch 5 taken 812 times.
✗ Branch 6 not taken.
|
1624 | if ((value = object.getString(i))) { |
| 9244 |
2/2✓ Branch 1 taken 812 times.
✓ Branch 4 taken 812 times.
|
812 | newObject.setString(i, value.get()); |
| 9245 | } | ||
| 9246 | } | ||
| 9247 | |||
| 9248 |
2/3✓ Branch 1 taken 29 times.
✓ Branch 3 taken 29 times.
✗ Branch 4 not taken.
|
29 | if (newObject.isEmpty(24)) { |
| 9249 |
1/1✓ Branch 1 taken 29 times.
|
29 | newObject.setDouble(24, 1.0); |
| 9250 | } | ||
| 9251 |
2/3✓ Branch 1 taken 29 times.
✓ Branch 3 taken 29 times.
✗ Branch 4 not taken.
|
29 | if (newObject.isEmpty(25)) { |
| 9252 |
2/2✓ Branch 1 taken 29 times.
✓ Branch 4 taken 29 times.
|
58 | newObject.setString(25, "Yes"); |
| 9253 | } | ||
| 9254 | |||
| 9255 |
1/1✓ Branch 1 taken 29 times.
|
29 | ss << newObject; |
| 9256 |
1/1✓ Branch 3 taken 29 times.
|
29 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 9257 | |||
| 9258 |
3/3✓ Branch 3 taken 65653 times.
✓ Branch 5 taken 1 time.
✓ Branch 6 taken 65652 times.
|
65682 | } else if (iddname == "OS:OutputControl:Files") { |
| 9259 | // 1 Field has been added from 3.8.0 to 3.9.0: | ||
| 9260 | // ---------------------------------------------- | ||
| 9261 | // * Output Space Sizing * 9 | ||
| 9262 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto iddObject = idd_3_9_0.getObject(iddname); |
| 9263 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfObject newObject(iddObject.get()); |
| 9264 | |||
| 9265 |
3/3✓ Branch 1 taken 32 times.
✓ Branch 3 taken 31 times.
✓ Branch 4 taken 1 time.
|
32 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 9266 |
2/3✓ Branch 1 taken 31 times.
✓ Branch 5 taken 31 times.
✗ Branch 6 not taken.
|
62 | if ((value = object.getString(i))) { |
| 9267 |
2/2✓ Branch 0 taken 9 times.
✓ Branch 1 taken 22 times.
|
31 | if (i < 9) { |
| 9268 |
2/2✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
|
9 | newObject.setString(i, value.get()); |
| 9269 | } else { | ||
| 9270 |
2/2✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
|
22 | newObject.setString(i + 1, value.get()); |
| 9271 | } | ||
| 9272 | } | ||
| 9273 | } | ||
| 9274 | |||
| 9275 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | newObject.setString(9, "Yes"); |
| 9276 | |||
| 9277 |
1/1✓ Branch 1 taken 1 time.
|
1 | ss << newObject; |
| 9278 |
1/1✓ Branch 3 taken 1 time.
|
1 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 9279 | |||
| 9280 |
3/3✓ Branch 3 taken 65652 times.
✓ Branch 5 taken 2 times.
✓ Branch 6 taken 65650 times.
|
65653 | } else if (iddname == "OS:HeatPump:PlantLoop:EIR:Heating") { |
| 9281 | |||
| 9282 | // 3 Fields have been inserted from 3.8.0 to 3.9.0: | ||
| 9283 | // ---------------------------------------------- | ||
| 9284 | // * Heat Recovery Inlet Node Name * 7 | ||
| 9285 | // * Heat Recovery Outlet Node Name * 8 | ||
| 9286 | // * Heat Recovery Reference Flow Rate * 12 | ||
| 9287 | |||
| 9288 | // 1 required Field has been added from 3.8.0 to 3.9.0: | ||
| 9289 | // ---------------------------------------------- | ||
| 9290 | // * Minimum Heat Recovery Outlet Temperature * 36 | ||
| 9291 | |||
| 9292 |
1/1✓ Branch 1 taken 2 times.
|
2 | auto iddObject = idd_3_9_0.getObject(iddname); |
| 9293 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | IdfObject newObject(iddObject.get()); |
| 9294 | |||
| 9295 |
3/3✓ Branch 1 taken 60 times.
✓ Branch 3 taken 58 times.
✓ Branch 4 taken 2 times.
|
60 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 9296 |
2/3✓ Branch 1 taken 58 times.
✓ Branch 5 taken 58 times.
✗ Branch 6 not taken.
|
116 | if ((value = object.getString(i))) { |
| 9297 |
2/2✓ Branch 0 taken 14 times.
✓ Branch 1 taken 44 times.
|
58 | if (i < 7) { |
| 9298 |
2/2✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
|
14 | newObject.setString(i, value.get()); |
| 9299 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 38 times.
|
44 | } else if (i < 10) { |
| 9300 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
6 | newObject.setString(i + 2, value.get()); |
| 9301 | } else { | ||
| 9302 |
2/2✓ Branch 1 taken 38 times.
✓ Branch 4 taken 38 times.
|
38 | newObject.setString(i + 3, value.get()); |
| 9303 | } | ||
| 9304 | } | ||
| 9305 | } | ||
| 9306 | |||
| 9307 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
4 | newObject.setString(7, ""); |
| 9308 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
4 | newObject.setString(8, ""); |
| 9309 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | newObject.setString(12, "Autosize"); |
| 9310 |
1/1✓ Branch 1 taken 2 times.
|
2 | newObject.setDouble(36, 4.5); |
| 9311 | |||
| 9312 |
1/1✓ Branch 1 taken 2 times.
|
2 | ss << newObject; |
| 9313 |
1/1✓ Branch 3 taken 2 times.
|
2 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 9314 | |||
| 9315 |
3/3✓ Branch 3 taken 65650 times.
✓ Branch 5 taken 2 times.
✓ Branch 6 taken 65648 times.
|
65652 | } else if (iddname == "OS:HeatPump:PlantLoop:EIR:Cooling") { |
| 9316 | |||
| 9317 | // 3 Fields have been inserted from 3.8.0 to 3.9.0: | ||
| 9318 | // ---------------------------------------------- | ||
| 9319 | // * Heat Recovery Inlet Node Name * 7 | ||
| 9320 | // * Heat Recovery Outlet Node Name * 8 | ||
| 9321 | // * Heat Recovery Reference Flow Rate * 12 | ||
| 9322 | |||
| 9323 | // 2 required Fields have been added from 3.8.0 to 3.9.0: | ||
| 9324 | // ---------------------------------------------- | ||
| 9325 | // * Maximum Heat Recovery Outlet Temperature * 26 | ||
| 9326 | // * Minimum Thermosiphon Minimum Temperature Difference * 30 | ||
| 9327 | |||
| 9328 |
1/1✓ Branch 1 taken 2 times.
|
2 | auto iddObject = idd_3_9_0.getObject(iddname); |
| 9329 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | IdfObject newObject(iddObject.get()); |
| 9330 | |||
| 9331 |
3/3✓ Branch 1 taken 44 times.
✓ Branch 3 taken 42 times.
✓ Branch 4 taken 2 times.
|
44 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 9332 |
2/3✓ Branch 1 taken 42 times.
✓ Branch 5 taken 42 times.
✗ Branch 6 not taken.
|
84 | if ((value = object.getString(i))) { |
| 9333 |
2/2✓ Branch 0 taken 14 times.
✓ Branch 1 taken 28 times.
|
42 | if (i < 7) { |
| 9334 |
2/2✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
|
14 | newObject.setString(i, value.get()); |
| 9335 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 22 times.
|
28 | } else if (i < 10) { |
| 9336 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
6 | newObject.setString(i + 2, value.get()); |
| 9337 | } else { | ||
| 9338 |
2/2✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
|
22 | newObject.setString(i + 3, value.get()); |
| 9339 | } | ||
| 9340 | } | ||
| 9341 | } | ||
| 9342 | |||
| 9343 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
4 | newObject.setString(7, ""); |
| 9344 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
4 | newObject.setString(8, ""); |
| 9345 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | newObject.setString(12, "Autosize"); |
| 9346 |
1/1✓ Branch 1 taken 2 times.
|
2 | newObject.setDouble(26, 60.0); |
| 9347 |
1/1✓ Branch 1 taken 2 times.
|
2 | newObject.setDouble(30, 0.0); |
| 9348 | |||
| 9349 |
1/1✓ Branch 1 taken 2 times.
|
2 | ss << newObject; |
| 9350 |
1/1✓ Branch 3 taken 2 times.
|
2 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 9351 | |||
| 9352 |
3/3✓ Branch 3 taken 65648 times.
✓ Branch 5 taken 1 time.
✓ Branch 6 taken 65647 times.
|
65650 | } else if (iddname == "OS:AirTerminal:SingleDuct:SeriesPIU:Reheat") { |
| 9353 | |||
| 9354 | // 5 Fields have been added from 3.8.0 to 3.9.0: | ||
| 9355 | // ---------------------------------------------- | ||
| 9356 | // * Fan Control Type * 16 | ||
| 9357 | // * Minimum Fan Turn Down Ratio * 17 | ||
| 9358 | // * Heating Control Type * 18 | ||
| 9359 | // * Design Heating Discharge Air Temperature * 19 | ||
| 9360 | // * High Limit Heating Discharge Air Temperature * 20 | ||
| 9361 | |||
| 9362 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto iddObject = idd_3_9_0.getObject(iddname); |
| 9363 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfObject newObject(iddObject.get()); |
| 9364 | |||
| 9365 |
3/3✓ Branch 1 taken 17 times.
✓ Branch 3 taken 16 times.
✓ Branch 4 taken 1 time.
|
17 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 9366 |
2/3✓ Branch 1 taken 16 times.
✓ Branch 5 taken 16 times.
✗ Branch 6 not taken.
|
32 | if ((value = object.getString(i))) { |
| 9367 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if (i < 16) { |
| 9368 |
2/2✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
|
16 | newObject.setString(i, value.get()); |
| 9369 | } | ||
| 9370 | } | ||
| 9371 | } | ||
| 9372 | |||
| 9373 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | newObject.setString(16, "ConstantSpeed"); |
| 9374 |
1/1✓ Branch 1 taken 1 time.
|
1 | newObject.setDouble(17, 0.3); |
| 9375 |
1/1✓ Branch 1 taken 1 time.
|
1 | newObject.setDouble(19, 32.1); |
| 9376 |
1/1✓ Branch 1 taken 1 time.
|
1 | newObject.setDouble(20, 37.7); |
| 9377 | |||
| 9378 |
1/1✓ Branch 1 taken 1 time.
|
1 | ss << newObject; |
| 9379 |
1/1✓ Branch 3 taken 1 time.
|
1 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 9380 | |||
| 9381 |
3/3✓ Branch 3 taken 65647 times.
✓ Branch 5 taken 1 time.
✓ Branch 6 taken 65646 times.
|
65648 | } else if (iddname == "OS:AirTerminal:SingleDuct:ParallelPIU:Reheat") { |
| 9382 | |||
| 9383 | // 5 Fields have been added from 3.8.0 to 3.9.0: | ||
| 9384 | // ---------------------------------------------- | ||
| 9385 | // * Fan Control Type * 17 | ||
| 9386 | // * Minimum Fan Turn Down Ratio * 18 | ||
| 9387 | // * Heating Control Type * 19 | ||
| 9388 | // * Design Heating Discharge Air Temperature * 20 | ||
| 9389 | // * High Limit Heating Discharge Air Temperature * 21 | ||
| 9390 | |||
| 9391 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto iddObject = idd_3_9_0.getObject(iddname); |
| 9392 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfObject newObject(iddObject.get()); |
| 9393 | |||
| 9394 |
3/3✓ Branch 1 taken 18 times.
✓ Branch 3 taken 17 times.
✓ Branch 4 taken 1 time.
|
18 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 9395 |
2/3✓ Branch 1 taken 17 times.
✓ Branch 5 taken 17 times.
✗ Branch 6 not taken.
|
34 | if ((value = object.getString(i))) { |
| 9396 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if (i < 17) { |
| 9397 |
2/2✓ Branch 1 taken 17 times.
✓ Branch 4 taken 17 times.
|
17 | newObject.setString(i, value.get()); |
| 9398 | } | ||
| 9399 | } | ||
| 9400 | } | ||
| 9401 | |||
| 9402 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | newObject.setString(17, "ConstantSpeed"); |
| 9403 |
1/1✓ Branch 1 taken 1 time.
|
1 | newObject.setDouble(18, 0.3); |
| 9404 |
1/1✓ Branch 1 taken 1 time.
|
1 | newObject.setDouble(20, 32.1); |
| 9405 |
1/1✓ Branch 1 taken 1 time.
|
1 | newObject.setDouble(21, 37.7); |
| 9406 | |||
| 9407 |
1/1✓ Branch 1 taken 1 time.
|
1 | ss << newObject; |
| 9408 |
1/1✓ Branch 3 taken 1 time.
|
1 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 9409 | |||
| 9410 |
3/3✓ Branch 3 taken 65646 times.
✓ Branch 5 taken 1 time.
✓ Branch 6 taken 65645 times.
|
65647 | } else if (iddname == "OS:Chiller:Electric:EIR") { |
| 9411 | |||
| 9412 | // 3 required Fields has been added from 3.8.0 to 3.9.0: | ||
| 9413 | // ---------------------------------------------- | ||
| 9414 | // * Condenser Flow Control * 35 | ||
| 9415 | // * Condenser Minimum Flow Fraction * 38 | ||
| 9416 | // * Thermosiphon Minimum Temperature Difference * 40 | ||
| 9417 | |||
| 9418 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto iddObject = idd_3_9_0.getObject(iddname); |
| 9419 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfObject newObject(iddObject.get()); |
| 9420 | |||
| 9421 |
3/3✓ Branch 1 taken 36 times.
✓ Branch 3 taken 35 times.
✓ Branch 4 taken 1 time.
|
36 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 9422 |
2/3✓ Branch 1 taken 35 times.
✓ Branch 5 taken 35 times.
✗ Branch 6 not taken.
|
70 | if ((value = object.getString(i))) { |
| 9423 |
2/2✓ Branch 1 taken 35 times.
✓ Branch 4 taken 35 times.
|
35 | newObject.setString(i, value.get()); |
| 9424 | } | ||
| 9425 | } | ||
| 9426 | |||
| 9427 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | newObject.setString(35, "ConstantFlow"); |
| 9428 |
1/1✓ Branch 1 taken 1 time.
|
1 | newObject.setDouble(38, 0.2); |
| 9429 |
1/1✓ Branch 1 taken 1 time.
|
1 | newObject.setDouble(40, 0.0); |
| 9430 | |||
| 9431 |
1/1✓ Branch 1 taken 1 time.
|
1 | ss << newObject; |
| 9432 |
1/1✓ Branch 3 taken 1 time.
|
1 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 9433 | |||
| 9434 |
3/3✓ Branch 3 taken 65645 times.
✓ Branch 5 taken 1 time.
✓ Branch 6 taken 65644 times.
|
65646 | } else if (iddname == "OS:Chiller:Electric:ReformulatedEIR") { |
| 9435 | |||
| 9436 | // 3 required Fields has been added from 3.8.0 to 3.9.0: | ||
| 9437 | // ---------------------------------------------- | ||
| 9438 | // * Condenser Flow Control * 31 | ||
| 9439 | // * Condenser Minimum Flow Fraction * 34 | ||
| 9440 | // * Thermosiphon Minimum Temperature Difference * 36 | ||
| 9441 | |||
| 9442 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto iddObject = idd_3_9_0.getObject(iddname); |
| 9443 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfObject newObject(iddObject.get()); |
| 9444 | |||
| 9445 |
3/3✓ Branch 1 taken 32 times.
✓ Branch 3 taken 31 times.
✓ Branch 4 taken 1 time.
|
32 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 9446 |
2/3✓ Branch 1 taken 31 times.
✓ Branch 5 taken 31 times.
✗ Branch 6 not taken.
|
62 | if ((value = object.getString(i))) { |
| 9447 |
2/2✓ Branch 1 taken 31 times.
✓ Branch 4 taken 31 times.
|
31 | newObject.setString(i, value.get()); |
| 9448 | } | ||
| 9449 | } | ||
| 9450 | |||
| 9451 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | newObject.setString(31, "ConstantFlow"); |
| 9452 |
1/1✓ Branch 1 taken 1 time.
|
1 | newObject.setDouble(34, 0.2); |
| 9453 |
1/1✓ Branch 1 taken 1 time.
|
1 | newObject.setDouble(36, 0.0); |
| 9454 | |||
| 9455 |
1/1✓ Branch 1 taken 1 time.
|
1 | ss << newObject; |
| 9456 |
1/1✓ Branch 3 taken 1 time.
|
1 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 9457 | |||
| 9458 |
3/3✓ Branch 3 taken 65644 times.
✓ Branch 5 taken 1 time.
✓ Branch 6 taken 65643 times.
|
65645 | } else if (iddname == "OS:Fan:VariableVolume") { |
| 9459 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | std::string fanHandleStr = object.getString(0).get(); |
| 9460 |
2/3✓ Branch 4 taken 1 time.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 time.
|
1 | if (std::find(vrfFanVVHandleStrs.cbegin(), vrfFanVVHandleStrs.cend(), fanHandleStr) == vrfFanVVHandleStrs.cend()) { |
| 9461 | ✗ | ss << object; | |
| 9462 | } else { | ||
| 9463 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
|
1 | IdfObject newObject(idd_3_9_0.getObject("OS:Fan:SystemModel").get()); |
| 9464 | |||
| 9465 | // Handle | ||
| 9466 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 5 taken 1 time.
✗ Branch 6 not taken.
|
2 | if ((value = object.getString(0))) { |
| 9467 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | newObject.setString(0, value.get()); |
| 9468 | } | ||
| 9469 | |||
| 9470 | // Name | ||
| 9471 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 5 taken 1 time.
✗ Branch 6 not taken.
|
2 | if ((value = object.getString(1))) { |
| 9472 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | newObject.setString(1, value.get()); |
| 9473 | } | ||
| 9474 | |||
| 9475 | // Availability Schedule Name | ||
| 9476 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 5 taken 1 time.
✗ Branch 6 not taken.
|
2 | if ((value = object.getString(2))) { |
| 9477 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | newObject.setString(2, value.get()); |
| 9478 | } | ||
| 9479 | |||
| 9480 | // Fan Total Efficiency | ||
| 9481 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 5 taken 1 time.
✗ Branch 6 not taken.
|
2 | if ((value = object.getString(3, true))) { |
| 9482 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | newObject.setString(15, value.get()); |
| 9483 | } | ||
| 9484 | |||
| 9485 | // Pressure Rise | ||
| 9486 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 5 taken 1 time.
✗ Branch 6 not taken.
|
2 | if ((value = object.getString(4, true))) { |
| 9487 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | newObject.setString(8, value.get()); |
| 9488 | } | ||
| 9489 | |||
| 9490 | // Maximum Flow Rate | ||
| 9491 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 5 taken 1 time.
✗ Branch 6 not taken.
|
2 | if ((value = object.getString(5, true))) { |
| 9492 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | newObject.setString(5, value.get()); |
| 9493 | } | ||
| 9494 | |||
| 9495 | // Motor Efficiency | ||
| 9496 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 5 taken 1 time.
✗ Branch 6 not taken.
|
2 | if ((value = object.getString(9, true))) { |
| 9497 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | newObject.setString(9, value.get()); |
| 9498 | } | ||
| 9499 | |||
| 9500 | // Motor In Airstream Fraction | ||
| 9501 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 5 taken 1 time.
✗ Branch 6 not taken.
|
2 | if ((value = object.getString(10, true))) { |
| 9502 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | newObject.setString(10, value.get()); |
| 9503 | } | ||
| 9504 | |||
| 9505 | // Nodes should be blank since it's inside a containing ZoneHVAC | ||
| 9506 | // Air Inlet Node Name | ||
| 9507 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 5 taken 1 time.
✗ Branch 6 not taken.
|
2 | if ((value = object.getString(16))) { |
| 9508 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | newObject.setString(3, value.get()); |
| 9509 | } | ||
| 9510 | |||
| 9511 | // Air Outlet Node Name | ||
| 9512 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 5 taken 1 time.
✗ Branch 6 not taken.
|
2 | if ((value = object.getString(17))) { |
| 9513 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | newObject.setString(4, value.get()); |
| 9514 | } | ||
| 9515 | |||
| 9516 | // End-Use Subcategory | ||
| 9517 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 5 taken 1 time.
✗ Branch 6 not taken.
|
2 | if ((value = object.getString(18, true))) { |
| 9518 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | newObject.setString(21, value.get()); |
| 9519 | } | ||
| 9520 | |||
| 9521 | // Speed Control Method | ||
| 9522 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | newObject.setString(6, "Continuous"); |
| 9523 | |||
| 9524 | // Electric Power Minimum Flow Rate Fraction | ||
| 9525 |
1/1✓ Branch 1 taken 1 time.
|
1 | newObject.setDouble(7, 0.0); |
| 9526 | |||
| 9527 | // Design Electric Power Consumption | ||
| 9528 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | newObject.setString(11, "Autosize"); |
| 9529 | |||
| 9530 | // Design Power Sizing Method | ||
| 9531 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | newObject.setString(12, "TotalEfficiencyAndPressure"); |
| 9532 | |||
| 9533 | // Electric Power Per Unit Flow Rate (not used given Power Sizing Method, but required-field & set in Ctor) | ||
| 9534 |
1/1✓ Branch 1 taken 1 time.
|
1 | newObject.setDouble(13, 840.0); |
| 9535 | |||
| 9536 | // Electric Power Per Unit Flow Rate Per Unit Pressure (not used given Power Sizing Method, but required-field & set in Ctor) | ||
| 9537 |
1/1✓ Branch 1 taken 1 time.
|
1 | newObject.setDouble(14, 1.66667); |
| 9538 | |||
| 9539 | // OS:Curve:Quartic | ||
| 9540 | // Create the new Curve:Quartic object and populate with Fan Power Coefficient i | ||
| 9541 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
|
1 | IdfObject curveQuartic(idd_3_9_0.getObject("OS:Curve:Quartic").get()); |
| 9542 | |||
| 9543 | // Handle | ||
| 9544 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | curveQuartic.setString(0, toString(createUUID())); |
| 9545 | |||
| 9546 | // Name | ||
| 9547 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
|
1 | curveQuartic.setString(1, newObject.getString(1).get() + " Curve"); |
| 9548 | |||
| 9549 | // Coefficient1 Constant | ||
| 9550 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 5 taken 1 time.
✗ Branch 6 not taken.
|
2 | if ((value = object.getString(11, true))) { |
| 9551 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | curveQuartic.setString(2, value.get()); |
| 9552 | } | ||
| 9553 | |||
| 9554 | // Coefficient2 x | ||
| 9555 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 5 taken 1 time.
✗ Branch 6 not taken.
|
2 | if ((value = object.getString(12, true))) { |
| 9556 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | curveQuartic.setString(3, value.get()); |
| 9557 | } | ||
| 9558 | |||
| 9559 | // Coefficient3 x**2 | ||
| 9560 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 5 taken 1 time.
✗ Branch 6 not taken.
|
2 | if ((value = object.getString(13, true))) { |
| 9561 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | curveQuartic.setString(4, value.get()); |
| 9562 | } | ||
| 9563 | |||
| 9564 | // Coefficient4 x**3 | ||
| 9565 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 5 taken 1 time.
✗ Branch 6 not taken.
|
2 | if ((value = object.getString(14, true))) { |
| 9566 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | curveQuartic.setString(5, value.get()); |
| 9567 | } | ||
| 9568 | |||
| 9569 | // Coefficient5 x**4 | ||
| 9570 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 5 taken 1 time.
✗ Branch 6 not taken.
|
2 | if ((value = object.getString(15, true))) { |
| 9571 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | curveQuartic.setString(6, value.get()); |
| 9572 | } | ||
| 9573 | |||
| 9574 | // Minimum Value of x | ||
| 9575 |
1/1✓ Branch 1 taken 1 time.
|
1 | curveQuartic.setDouble(7, 0.0); |
| 9576 | |||
| 9577 | // Maximum Value of x | ||
| 9578 |
1/1✓ Branch 1 taken 1 time.
|
1 | curveQuartic.setDouble(8, 1.0); |
| 9579 | |||
| 9580 | // Minimum Curve Output | ||
| 9581 |
1/1✓ Branch 1 taken 1 time.
|
1 | curveQuartic.setDouble(9, 0.0); |
| 9582 | |||
| 9583 | // Maximum Curve Output | ||
| 9584 |
1/1✓ Branch 1 taken 1 time.
|
1 | curveQuartic.setDouble(10, 5.0); |
| 9585 | |||
| 9586 | // Input Unit Type for X | ||
| 9587 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | curveQuartic.setString(11, "Dimensionless"); |
| 9588 | |||
| 9589 | // Output Unit Type | ||
| 9590 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | curveQuartic.setString(12, "Dimensionless"); |
| 9591 | |||
| 9592 |
1/1✓ Branch 1 taken 1 time.
|
1 | ss << curveQuartic; |
| 9593 |
1/1✓ Branch 1 taken 1 time.
|
1 | m_new.push_back(curveQuartic); |
| 9594 | |||
| 9595 | // Electric Power Function of Flow Fraction Curve Name | ||
| 9596 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | newObject.setString(16, curveQuartic.getString(0).get()); |
| 9597 | |||
| 9598 | // Night Ventilation Mode Pressure Rise | ||
| 9599 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | newObject.setString(17, ""); |
| 9600 | |||
| 9601 | // Night Ventilation Mode Flow Fraction | ||
| 9602 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | newObject.setString(18, ""); |
| 9603 | |||
| 9604 | // Motor Loss Zone Name | ||
| 9605 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | newObject.setString(19, ""); |
| 9606 | |||
| 9607 | // Motor Loss Radiative Fraction | ||
| 9608 |
1/1✓ Branch 1 taken 1 time.
|
1 | newObject.setDouble(20, 0.0); |
| 9609 | |||
| 9610 |
1/1✓ Branch 3 taken 1 time.
|
1 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 9611 |
1/1✓ Branch 1 taken 1 time.
|
1 | ss << newObject; |
| 9612 | 1 | } | |
| 9613 | |||
| 9614 |
3/3✓ Branch 2 taken 65643 times.
✓ Branch 4 taken 1340 times.
✓ Branch 5 taken 64303 times.
|
65644 | } else if (iddname == "OS:Sizing:Zone") { |
| 9615 | |||
| 9616 | // 1 required Field has been added from 3.8.0 to 3.9.0: | ||
| 9617 | // ---------------------------------------------- | ||
| 9618 | // * Sizing Option * 39 | ||
| 9619 | |||
| 9620 |
1/1✓ Branch 1 taken 1340 times.
|
1340 | auto iddObject = idd_3_9_0.getObject(iddname); |
| 9621 |
2/2✓ Branch 1 taken 1340 times.
✓ Branch 4 taken 1340 times.
|
1340 | IdfObject newObject(iddObject.get()); |
| 9622 | |||
| 9623 |
3/3✓ Branch 1 taken 45606 times.
✓ Branch 3 taken 44266 times.
✓ Branch 4 taken 1340 times.
|
45606 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 9624 |
2/3✓ Branch 1 taken 44266 times.
✓ Branch 5 taken 44266 times.
✗ Branch 6 not taken.
|
88532 | if ((value = object.getString(i))) { |
| 9625 |
2/2✓ Branch 1 taken 44266 times.
✓ Branch 4 taken 44266 times.
|
44266 | newObject.setString(i, value.get()); |
| 9626 | } | ||
| 9627 | } | ||
| 9628 | |||
| 9629 |
2/2✓ Branch 1 taken 1340 times.
✓ Branch 4 taken 1340 times.
|
1340 | newObject.setString(39, "Coincident"); |
| 9630 | |||
| 9631 |
1/1✓ Branch 1 taken 1340 times.
|
1340 | ss << newObject; |
| 9632 |
1/1✓ Branch 3 taken 1340 times.
|
1340 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 9633 | |||
| 9634 | // No-op | ||
| 9635 | 1340 | } else { | |
| 9636 |
1/1✓ Branch 1 taken 64303 times.
|
64303 | ss << object; |
| 9637 | } | ||
| 9638 | 65815 | } | |
| 9639 | |||
| 9640 |
1/1✓ Branch 1 taken 133 times.
|
266 | return ss.str(); |
| 9641 | |||
| 9642 | 133 | } // end update_3_8_0_to_3_9_0 | |
| 9643 | |||
| 9644 | 137 | std::string VersionTranslator::update_3_9_0_to_3_10_0(const IdfFile& idf_3_9_0, const IddFileAndFactoryWrapper& idd_3_10_0) { | |
| 9645 |
1/1✓ Branch 1 taken 137 times.
|
137 | std::stringstream ss; |
| 9646 | 137 | boost::optional<std::string> value; | |
| 9647 | |||
| 9648 |
4/4✓ Branch 1 taken 137 times.
✓ Branch 4 taken 137 times.
✓ Branch 7 taken 137 times.
✓ Branch 10 taken 137 times.
|
137 | ss << idf_3_9_0.header() << '\n' << '\n'; |
| 9649 |
2/2✓ Branch 1 taken 137 times.
✓ Branch 4 taken 137 times.
|
137 | IdfFile targetIdf(idd_3_10_0.iddFile()); |
| 9650 |
3/3✓ Branch 1 taken 137 times.
✓ Branch 4 taken 137 times.
✓ Branch 7 taken 137 times.
|
137 | ss << targetIdf.versionObject().get(); |
| 9651 | |||
| 9652 |
3/3✓ Branch 1 taken 137 times.
✓ Branch 8 taken 65722 times.
✓ Branch 9 taken 137 times.
|
65859 | for (const IdfObject& object : idf_3_9_0.objects()) { |
| 9653 |
2/2✓ Branch 1 taken 65722 times.
✓ Branch 4 taken 65722 times.
|
65722 | auto iddname = object.iddObject().name(); |
| 9654 | |||
| 9655 |
3/3✓ Branch 1 taken 65722 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 65720 times.
|
65722 | if (iddname == "OS:WaterHeater:HeatPump") { |
| 9656 | |||
| 9657 | // 1 Field has been inserted from 3.9.0 to 3.10.0: | ||
| 9658 | // ---------------------------------------------- | ||
| 9659 | // * Tank Element Control Logic * 25 | ||
| 9660 |
1/1✓ Branch 1 taken 2 times.
|
2 | auto iddObject = idd_3_10_0.getObject(iddname); |
| 9661 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | IdfObject newObject(iddObject.get()); |
| 9662 | |||
| 9663 |
3/3✓ Branch 1 taken 54 times.
✓ Branch 3 taken 52 times.
✓ Branch 4 taken 2 times.
|
54 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 9664 |
2/3✓ Branch 1 taken 52 times.
✓ Branch 5 taken 52 times.
✗ Branch 6 not taken.
|
104 | if ((value = object.getString(i))) { |
| 9665 |
2/2✓ Branch 0 taken 50 times.
✓ Branch 1 taken 2 times.
|
52 | if (i < 25) { |
| 9666 |
2/2✓ Branch 1 taken 50 times.
✓ Branch 4 taken 50 times.
|
50 | newObject.setString(i, value.get()); |
| 9667 | } else { | ||
| 9668 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | newObject.setString(i + 1, value.get()); |
| 9669 | } | ||
| 9670 | } | ||
| 9671 | } | ||
| 9672 | |||
| 9673 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | newObject.setString(25, "Simultaneous"); |
| 9674 | |||
| 9675 |
1/1✓ Branch 1 taken 2 times.
|
2 | ss << newObject; |
| 9676 |
1/1✓ Branch 3 taken 2 times.
|
2 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 9677 | |||
| 9678 |
3/3✓ Branch 3 taken 65720 times.
✓ Branch 5 taken 3 times.
✓ Branch 6 taken 65717 times.
|
65722 | } else if (iddname == "OS:GroundHeatExchanger:Vertical") { |
| 9679 | |||
| 9680 | // 1 Field has been inserted from 3.9.0 to 3.10.0: | ||
| 9681 | // ---------------------------------------------- | ||
| 9682 | // * Bore Hole Top Depth * 6 | ||
| 9683 | |||
| 9684 |
1/1✓ Branch 1 taken 3 times.
|
3 | auto iddObject = idd_3_10_0.getObject(iddname); |
| 9685 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | IdfObject newObject(iddObject.get()); |
| 9686 | |||
| 9687 |
3/3✓ Branch 1 taken 270 times.
✓ Branch 3 taken 267 times.
✓ Branch 4 taken 3 times.
|
270 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 9688 |
2/3✓ Branch 1 taken 267 times.
✓ Branch 5 taken 267 times.
✗ Branch 6 not taken.
|
534 | if ((value = object.getString(i))) { |
| 9689 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 249 times.
|
267 | if (i < 6) { |
| 9690 |
2/2✓ Branch 1 taken 18 times.
✓ Branch 4 taken 18 times.
|
18 | newObject.setString(i, value.get()); |
| 9691 | } else { | ||
| 9692 |
2/2✓ Branch 1 taken 249 times.
✓ Branch 4 taken 249 times.
|
249 | newObject.setString(i + 1, value.get()); |
| 9693 | } | ||
| 9694 | } | ||
| 9695 | } | ||
| 9696 | |||
| 9697 |
1/1✓ Branch 1 taken 3 times.
|
3 | newObject.setDouble(6, 1.0); // this value of 1 is what we previously had hardcoded in FT |
| 9698 | |||
| 9699 |
1/1✓ Branch 1 taken 3 times.
|
3 | ss << newObject; |
| 9700 |
1/1✓ Branch 3 taken 3 times.
|
3 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 9701 | |||
| 9702 |
3/3✓ Branch 3 taken 65717 times.
✓ Branch 5 taken 1 time.
✓ Branch 6 taken 65716 times.
|
65720 | } else if (iddname == "OS:ZoneVentilation:DesignFlowRate") { |
| 9703 | |||
| 9704 | // 1 Field has been added from 3.9.0 to 3.10.0: | ||
| 9705 | // ------------------------------------------- | ||
| 9706 | // * Density Basis * 26 | ||
| 9707 | |||
| 9708 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto iddObject = idd_3_10_0.getObject(iddname); |
| 9709 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfObject newObject(iddObject.get()); |
| 9710 | |||
| 9711 |
3/3✓ Branch 1 taken 27 times.
✓ Branch 3 taken 26 times.
✓ Branch 4 taken 1 time.
|
27 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 9712 |
2/3✓ Branch 1 taken 26 times.
✓ Branch 5 taken 26 times.
✗ Branch 6 not taken.
|
52 | if ((value = object.getString(i))) { |
| 9713 |
2/2✓ Branch 1 taken 26 times.
✓ Branch 4 taken 26 times.
|
26 | newObject.setString(i, value.get()); |
| 9714 | } | ||
| 9715 | } | ||
| 9716 | |||
| 9717 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | newObject.setString(26, "Outdoor"); |
| 9718 | |||
| 9719 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | m_refactored.push_back(RefactoredObjectData(object, newObject)); |
| 9720 |
1/1✓ Branch 1 taken 1 time.
|
1 | ss << newObject; |
| 9721 | |||
| 9722 |
3/3✓ Branch 3 taken 65716 times.
✓ Branch 5 taken 654 times.
✓ Branch 6 taken 65062 times.
|
65717 | } else if (iddname == "OS:SpaceInfiltration:DesignFlowRate") { |
| 9723 | |||
| 9724 | // 1 Field has been added from 3.9.0 to 3.10.0: | ||
| 9725 | // ------------------------------------------- | ||
| 9726 | // * Density Basis * 13 | ||
| 9727 | |||
| 9728 |
1/1✓ Branch 1 taken 654 times.
|
654 | auto iddObject = idd_3_10_0.getObject(iddname); |
| 9729 |
2/2✓ Branch 1 taken 654 times.
✓ Branch 4 taken 654 times.
|
654 | IdfObject newObject(iddObject.get()); |
| 9730 | |||
| 9731 |
3/3✓ Branch 1 taken 9156 times.
✓ Branch 3 taken 8502 times.
✓ Branch 4 taken 654 times.
|
9156 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 9732 |
2/3✓ Branch 1 taken 8502 times.
✓ Branch 5 taken 8502 times.
✗ Branch 6 not taken.
|
17004 | if ((value = object.getString(i))) { |
| 9733 |
2/2✓ Branch 1 taken 8502 times.
✓ Branch 4 taken 8502 times.
|
8502 | newObject.setString(i, value.get()); |
| 9734 | } | ||
| 9735 | } | ||
| 9736 | |||
| 9737 |
2/2✓ Branch 1 taken 654 times.
✓ Branch 4 taken 654 times.
|
654 | newObject.setString(13, "Outdoor"); |
| 9738 | |||
| 9739 |
2/2✓ Branch 1 taken 654 times.
✓ Branch 4 taken 654 times.
|
654 | m_refactored.push_back(RefactoredObjectData(object, newObject)); |
| 9740 |
1/1✓ Branch 1 taken 654 times.
|
654 | ss << newObject; |
| 9741 | |||
| 9742 | // No-op | ||
| 9743 | 654 | } else { | |
| 9744 |
1/1✓ Branch 1 taken 65062 times.
|
65062 | ss << object; |
| 9745 | } | ||
| 9746 | 65859 | } | |
| 9747 | |||
| 9748 |
1/1✓ Branch 1 taken 137 times.
|
274 | return ss.str(); |
| 9749 | |||
| 9750 | 137 | } // end update_3_9_0_to_3_10_0 | |
| 9751 | |||
| 9752 | 147 | std::string VersionTranslator::update_3_10_0_to_3_11_0(const IdfFile& idf_3_10_0, const IddFileAndFactoryWrapper& idd_3_11_0) { | |
| 9753 |
1/1✓ Branch 1 taken 147 times.
|
147 | std::stringstream ss; |
| 9754 | 147 | boost::optional<std::string> value; | |
| 9755 | |||
| 9756 |
4/4✓ Branch 1 taken 147 times.
✓ Branch 4 taken 147 times.
✓ Branch 7 taken 147 times.
✓ Branch 10 taken 147 times.
|
147 | ss << idf_3_10_0.header() << '\n' << '\n'; |
| 9757 |
2/2✓ Branch 1 taken 147 times.
✓ Branch 4 taken 147 times.
|
147 | IdfFile targetIdf(idd_3_11_0.iddFile()); |
| 9758 |
3/3✓ Branch 1 taken 147 times.
✓ Branch 4 taken 147 times.
✓ Branch 7 taken 147 times.
|
147 | ss << targetIdf.versionObject().get(); |
| 9759 | |||
| 9760 | // Could make it a static inside the lambda, except that it won't be reset so if you try to translate twice it fails | ||
| 9761 | 147 | std::string discreteSchHandleStr; | |
| 9762 | |||
| 9763 | 42 | auto getOrCreateAlwaysOnDiscreteScheduleHandleStr = [this, &ss, &idf_3_10_0, &idd_3_11_0, &discreteSchHandleStr]() -> std::string { | |
| 9764 |
2/2✓ Branch 1 taken 27 times.
✓ Branch 2 taken 15 times.
|
42 | if (!discreteSchHandleStr.empty()) { |
| 9765 |
6/6✓ Branch 1 taken 27 times.
✓ Branch 4 taken 27 times.
✓ Branch 7 taken 27 times.
✓ Branch 10 taken 27 times.
✓ Branch 13 taken 27 times.
✓ Branch 16 taken 27 times.
|
27 | LOG(Trace, "Already found 'Always On Discrete' Schedule in model with handle " << discreteSchHandleStr); |
| 9766 |
1/1✓ Branch 1 taken 27 times.
|
27 | return discreteSchHandleStr; |
| 9767 | } | ||
| 9768 | |||
| 9769 |
1/1✓ Branch 1 taken 15 times.
|
15 | const std::string name = "Always On Discrete"; |
| 9770 | 15 | const double val = 1.0; | |
| 9771 | // Add an alwaysOnDiscreteSchedule if one does not already exist | ||
| 9772 |
7/7✓ Branch 1 taken 15 times.
✓ Branch 4 taken 15 times.
✓ Branch 7 taken 15 times.
✓ Branch 10 taken 15 times.
✓ Branch 13 taken 15 times.
✓ Branch 23 taken 7 times.
✓ Branch 24 taken 9 times.
|
46 | for (const IdfObject& object : idf_3_10_0.getObjectsByType(idf_3_10_0.iddFile().getObject("OS:Schedule:Constant").get())) { |
| 9773 |
2/3✓ Branch 1 taken 7 times.
✓ Branch 3 taken 7 times.
✗ Branch 4 not taken.
|
14 | if (boost::optional<std::string> name_ = object.getString(1)) { |
| 9774 |
4/4✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
✓ Branch 6 taken 6 times.
✓ Branch 7 taken 1 time.
|
7 | if (istringEqual(name_.get(), name)) { |
| 9775 |
2/3✓ Branch 1 taken 6 times.
✓ Branch 3 taken 6 times.
✗ Branch 4 not taken.
|
12 | if (boost::optional<double> value = object.getDouble(3)) { |
| 9776 |
2/3✓ Branch 2 taken 6 times.
✓ Branch 5 taken 6 times.
✗ Branch 6 not taken.
|
6 | if (equal<double>(value.get(), val)) { |
| 9777 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
|
6 | discreteSchHandleStr = object.getString(0).get(); // Store in state variable |
| 9778 |
6/6✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
✓ Branch 10 taken 6 times.
✓ Branch 13 taken 6 times.
✓ Branch 16 taken 6 times.
|
6 | LOG(Trace, "Found existing 'Always On Discrete' Schedule in model with handle " << discreteSchHandleStr); |
| 9779 |
1/1✓ Branch 1 taken 6 times.
|
12 | return discreteSchHandleStr; |
| 9780 | } | ||
| 9781 | } | ||
| 9782 | } | ||
| 9783 | 7 | } | |
| 9784 | 15 | } | |
| 9785 | |||
| 9786 |
4/4✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
✓ Branch 7 taken 9 times.
✓ Branch 10 taken 9 times.
|
18 | auto discreteSch = IdfObject(idd_3_11_0.getObject("OS:Schedule:Constant").get()); |
| 9787 | |||
| 9788 |
2/2✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
|
9 | discreteSchHandleStr = toString(createUUID()); // Store in state variable |
| 9789 |
1/1✓ Branch 1 taken 9 times.
|
9 | discreteSch.setString(0, discreteSchHandleStr); |
| 9790 |
1/1✓ Branch 1 taken 9 times.
|
9 | discreteSch.setString(1, name); |
| 9791 |
1/1✓ Branch 1 taken 9 times.
|
9 | discreteSch.setDouble(3, val); |
| 9792 | |||
| 9793 |
4/4✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
✓ Branch 7 taken 9 times.
✓ Branch 10 taken 9 times.
|
18 | IdfObject typeLimits(idd_3_11_0.getObject("OS:ScheduleTypeLimits").get()); |
| 9794 |
3/3✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
✓ Branch 7 taken 9 times.
|
9 | typeLimits.setString(0, toString(createUUID())); |
| 9795 |
2/2✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
|
9 | typeLimits.setString(1, name + " Limits"); |
| 9796 |
1/1✓ Branch 1 taken 9 times.
|
9 | typeLimits.setDouble(2, 0.0); |
| 9797 |
1/1✓ Branch 1 taken 9 times.
|
9 | typeLimits.setDouble(3, 1.0); |
| 9798 |
2/2✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
|
18 | typeLimits.setString(4, "Discrete"); |
| 9799 |
2/2✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
|
9 | typeLimits.setString(5, "Availability"); |
| 9800 | |||
| 9801 |
3/3✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
✓ Branch 7 taken 9 times.
|
9 | discreteSch.setString(2, typeLimits.getString(0).get()); |
| 9802 | |||
| 9803 |
1/1✓ Branch 1 taken 9 times.
|
9 | ss << discreteSch; |
| 9804 |
1/1✓ Branch 1 taken 9 times.
|
9 | ss << typeLimits; |
| 9805 | |||
| 9806 | // Register new objects | ||
| 9807 |
1/1✓ Branch 2 taken 9 times.
|
9 | m_new.emplace_back(std::move(discreteSch)); |
| 9808 |
1/1✓ Branch 2 taken 9 times.
|
9 | m_new.emplace_back(std::move(typeLimits)); |
| 9809 |
6/6✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
✓ Branch 7 taken 9 times.
✓ Branch 10 taken 9 times.
✓ Branch 13 taken 9 times.
✓ Branch 16 taken 9 times.
|
9 | LOG(Trace, "Created 'Always On Discrete' Schedule with handle " << discreteSchHandleStr); |
| 9810 | |||
| 9811 |
1/1✓ Branch 1 taken 9 times.
|
9 | return discreteSchHandleStr; |
| 9812 | 15 | }; | |
| 9813 | |||
| 9814 |
3/3✓ Branch 1 taken 147 times.
✓ Branch 8 taken 65869 times.
✓ Branch 9 taken 147 times.
|
66016 | for (const IdfObject& object : idf_3_10_0.objects()) { |
| 9815 |
2/2✓ Branch 1 taken 65869 times.
✓ Branch 4 taken 65869 times.
|
65869 | auto iddname = object.iddObject().name(); |
| 9816 | |||
| 9817 |
4/4✓ Branch 1 taken 65869 times.
✓ Branch 4 taken 65865 times.
✓ Branch 6 taken 65863 times.
✓ Branch 7 taken 2 times.
|
131734 | if ((iddname == "OS:Coil:Cooling:DX:VariableSpeed") || (iddname == "OS:Coil:Heating:DX:VariableSpeed") |
| 9818 |
6/6✓ Branch 1 taken 65863 times.
✓ Branch 3 taken 65854 times.
✓ Branch 4 taken 9 times.
✓ Branch 6 taken 65854 times.
✓ Branch 8 taken 65845 times.
✓ Branch 9 taken 9 times.
|
65863 | || (iddname == "OS:Coil:Cooling:WaterToAirHeatPump:EquationFit") || (iddname == "OS:Coil:Heating:WaterToAirHeatPump:EquationFit") |
| 9819 |
3/3✓ Branch 1 taken 65845 times.
✓ Branch 3 taken 65840 times.
✓ Branch 4 taken 5 times.
|
65845 | || (iddname == "OS:Coil:Cooling:WaterToAirHeatPump:VariableSpeedEquationFit") |
| 9820 |
6/6✓ Branch 1 taken 65840 times.
✓ Branch 3 taken 65835 times.
✓ Branch 4 taken 5 times.
✓ Branch 6 taken 65835 times.
✓ Branch 8 taken 65831 times.
✓ Branch 9 taken 4 times.
|
65840 | || (iddname == "OS:Coil:Heating:WaterToAirHeatPump:VariableSpeedEquationFit") || (iddname == "OS:Coil:WaterHeating:AirToWaterHeatPump") |
| 9821 |
10/10✓ Branch 0 taken 65865 times.
✓ Branch 1 taken 4 times.
✓ Branch 3 taken 65831 times.
✓ Branch 5 taken 65829 times.
✓ Branch 6 taken 2 times.
✓ Branch 8 taken 65829 times.
✓ Branch 10 taken 2 times.
✓ Branch 11 taken 65827 times.
✓ Branch 12 taken 42 times.
✓ Branch 13 taken 65827 times.
|
131734 | || (iddname == "OS:Coil:WaterHeating:AirToWaterHeatPump:Wrapped") || (iddname == "OS:Coil:WaterHeating:AirToWaterHeatPump:VariableSpeed")) { |
| 9822 | |||
| 9823 | // 1 Field has been inserted from 3.10.0 to 3.11.0: | ||
| 9824 | // ------------------------------------------------ | ||
| 9825 | // * Availability Schedule Name * 2 | ||
| 9826 | |||
| 9827 |
1/1✓ Branch 1 taken 42 times.
|
42 | auto iddObject = idd_3_11_0.getObject(iddname); |
| 9828 |
2/2✓ Branch 1 taken 42 times.
✓ Branch 4 taken 42 times.
|
42 | IdfObject newObject(iddObject.get()); |
| 9829 | |||
| 9830 |
3/3✓ Branch 1 taken 895 times.
✓ Branch 3 taken 853 times.
✓ Branch 4 taken 42 times.
|
895 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 9831 |
2/3✓ Branch 1 taken 853 times.
✓ Branch 5 taken 853 times.
✗ Branch 6 not taken.
|
1706 | if ((value = object.getString(i))) { |
| 9832 |
2/2✓ Branch 0 taken 84 times.
✓ Branch 1 taken 769 times.
|
853 | if (i < 2) { |
| 9833 |
2/2✓ Branch 1 taken 84 times.
✓ Branch 4 taken 84 times.
|
84 | newObject.setString(i, value.get()); |
| 9834 | } else { | ||
| 9835 |
2/2✓ Branch 1 taken 769 times.
✓ Branch 4 taken 769 times.
|
769 | newObject.setString(i + 1, value.get()); |
| 9836 | } | ||
| 9837 | } | ||
| 9838 | } | ||
| 9839 | |||
| 9840 | // Applicability Schedule | ||
| 9841 |
2/2✓ Branch 1 taken 42 times.
✓ Branch 4 taken 42 times.
|
42 | newObject.setString(2, getOrCreateAlwaysOnDiscreteScheduleHandleStr()); |
| 9842 | |||
| 9843 |
1/1✓ Branch 1 taken 42 times.
|
42 | ss << newObject; |
| 9844 |
1/1✓ Branch 3 taken 42 times.
|
42 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 9845 | |||
| 9846 |
3/3✓ Branch 3 taken 65827 times.
✓ Branch 5 taken 15 times.
✓ Branch 6 taken 65812 times.
|
65869 | } else if (iddname == "OS:Site:WaterMainsTemperature") { |
| 9847 | |||
| 9848 | // 2 Fields have been inserted from 3.10.0 to 3.11.0: | ||
| 9849 | // ------------------------------------------------ | ||
| 9850 | // * Temperature Multiplier * 5 | ||
| 9851 | // * Temperature Offset * 6 | ||
| 9852 | |||
| 9853 |
1/1✓ Branch 1 taken 15 times.
|
15 | auto iddObject = idd_3_11_0.getObject(iddname); |
| 9854 |
2/2✓ Branch 1 taken 15 times.
✓ Branch 4 taken 15 times.
|
15 | IdfObject newObject(iddObject.get()); |
| 9855 | |||
| 9856 |
3/3✓ Branch 1 taken 87 times.
✓ Branch 3 taken 72 times.
✓ Branch 4 taken 15 times.
|
87 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 9857 |
2/3✓ Branch 1 taken 72 times.
✓ Branch 5 taken 72 times.
✗ Branch 6 not taken.
|
144 | if ((value = object.getString(i))) { |
| 9858 |
2/2✓ Branch 1 taken 72 times.
✓ Branch 4 taken 72 times.
|
72 | newObject.setString(i, value.get()); |
| 9859 | } | ||
| 9860 | } | ||
| 9861 | |||
| 9862 |
1/1✓ Branch 1 taken 15 times.
|
15 | newObject.setDouble(5, 1.0); |
| 9863 |
1/1✓ Branch 1 taken 15 times.
|
15 | newObject.setDouble(6, 0.0); |
| 9864 | |||
| 9865 |
1/1✓ Branch 1 taken 15 times.
|
15 | ss << newObject; |
| 9866 |
1/1✓ Branch 3 taken 15 times.
|
15 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 9867 | |||
| 9868 |
3/3✓ Branch 3 taken 65812 times.
✓ Branch 5 taken 1 time.
✓ Branch 6 taken 65811 times.
|
65827 | } else if (iddname == "OS:ThermalStorage:ChilledWater:Stratified") { |
| 9869 | |||
| 9870 | // 1 Field was made required from 3.10.0 to 3.11.0: | ||
| 9871 | // ------------------------------------------------ | ||
| 9872 | // * Nominal Cooling Capacity * 10 | ||
| 9873 | |||
| 9874 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto iddObject = idd_3_11_0.getObject(iddname); |
| 9875 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfObject newObject(iddObject.get()); |
| 9876 | |||
| 9877 |
3/3✓ Branch 1 taken 45 times.
✓ Branch 3 taken 44 times.
✓ Branch 4 taken 1 time.
|
45 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 9878 |
2/3✓ Branch 1 taken 44 times.
✓ Branch 5 taken 44 times.
✗ Branch 6 not taken.
|
88 | if ((value = object.getString(i))) { |
| 9879 |
2/2✓ Branch 1 taken 44 times.
✓ Branch 4 taken 44 times.
|
44 | newObject.setString(i, value.get()); |
| 9880 | } | ||
| 9881 | } | ||
| 9882 | |||
| 9883 | // Default to 0.0 and not Autosize to preserve old behavior | ||
| 9884 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✗ Branch 5 not taken.
|
1 | if (!object.getDouble(10)) { |
| 9885 |
1/1✓ Branch 1 taken 1 time.
|
1 | newObject.setDouble(10, 0.0); |
| 9886 | } | ||
| 9887 | |||
| 9888 |
1/1✓ Branch 1 taken 1 time.
|
1 | ss << newObject; |
| 9889 |
1/1✓ Branch 3 taken 1 time.
|
1 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 9890 | |||
| 9891 | // But we also add a WaterHeater:Sizing object | ||
| 9892 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | auto whIddObject = idd_3_11_0.getObject("OS:WaterHeater:Sizing"); |
| 9893 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfObject whSizingObj(whIddObject.get()); |
| 9894 | |||
| 9895 | // WaterHeaterName | ||
| 9896 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | whSizingObj.setString(1, toString(object.handle())); |
| 9897 | // Design Mode | ||
| 9898 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | whSizingObj.setString(2, "PeakDraw"); |
| 9899 | // Time Storage Can Meet Peak Draw {hr} | ||
| 9900 |
1/1✓ Branch 1 taken 1 time.
|
1 | whSizingObj.setDouble(3, 0.538503); |
| 9901 | // Time for Tank Recovery {hr} | ||
| 9902 |
1/1✓ Branch 1 taken 1 time.
|
1 | whSizingObj.setDouble(4, 0.0); |
| 9903 | // Nominal Tank Volume for Autosizing Plant Connections {m3} | ||
| 9904 |
1/1✓ Branch 1 taken 1 time.
|
1 | whSizingObj.setDouble(5, 1.0); |
| 9905 | |||
| 9906 | // Register new WaterHeater:Sizing objects | ||
| 9907 |
1/1✓ Branch 1 taken 1 time.
|
1 | ss << whSizingObj; |
| 9908 |
1/1✓ Branch 2 taken 1 time.
|
1 | m_new.emplace_back(std::move(whSizingObj)); |
| 9909 | |||
| 9910 |
3/3✓ Branch 5 taken 65811 times.
✓ Branch 7 taken 1341 times.
✓ Branch 8 taken 64470 times.
|
65812 | } else if (iddname == "OS:Sizing:Zone") { |
| 9911 | |||
| 9912 | // 2 Fields have been added from 3.10.0 to 3.11.0: | ||
| 9913 | // ------------------------------------------------ | ||
| 9914 | // * Heating Coil Sizing Method * 40 | ||
| 9915 | // * Maximum Heating Capacity To Cooling Load Sizing Ratio * 41 | ||
| 9916 | |||
| 9917 |
1/1✓ Branch 1 taken 1341 times.
|
1341 | auto iddObject = idd_3_11_0.getObject(iddname); |
| 9918 |
2/2✓ Branch 1 taken 1341 times.
✓ Branch 4 taken 1341 times.
|
1341 | IdfObject newObject(iddObject.get()); |
| 9919 | |||
| 9920 |
3/3✓ Branch 1 taken 54981 times.
✓ Branch 3 taken 53640 times.
✓ Branch 4 taken 1341 times.
|
54981 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 9921 |
2/3✓ Branch 1 taken 53640 times.
✓ Branch 5 taken 53640 times.
✗ Branch 6 not taken.
|
107280 | if ((value = object.getString(i))) { |
| 9922 |
2/2✓ Branch 1 taken 53640 times.
✓ Branch 4 taken 53640 times.
|
53640 | newObject.setString(i, value.get()); |
| 9923 | } | ||
| 9924 | } | ||
| 9925 | |||
| 9926 |
2/2✓ Branch 1 taken 1341 times.
✓ Branch 4 taken 1341 times.
|
1341 | newObject.setString(40, "None"); |
| 9927 |
1/1✓ Branch 1 taken 1341 times.
|
1341 | newObject.setDouble(41, 1.0); |
| 9928 | |||
| 9929 |
1/1✓ Branch 1 taken 1341 times.
|
1341 | ss << newObject; |
| 9930 |
1/1✓ Branch 3 taken 1341 times.
|
1341 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 9931 | |||
| 9932 |
3/3✓ Branch 3 taken 64470 times.
✓ Branch 5 taken 31 times.
✓ Branch 6 taken 64439 times.
|
65811 | } else if (iddname == "OS:Sizing:System") { |
| 9933 | |||
| 9934 | // 2 Fields have been added from 3.10.0 to 3.11.0: | ||
| 9935 | // ------------------------------------------------ | ||
| 9936 | // * Heating Coil Sizing Method * 39 | ||
| 9937 | // * Maximum Heating Capacity To Cooling Capacity Sizing Ratio * 40 | ||
| 9938 | |||
| 9939 |
1/1✓ Branch 1 taken 31 times.
|
31 | auto iddObject = idd_3_11_0.getObject(iddname); |
| 9940 |
2/2✓ Branch 1 taken 31 times.
✓ Branch 4 taken 31 times.
|
31 | IdfObject newObject(iddObject.get()); |
| 9941 | |||
| 9942 |
3/3✓ Branch 1 taken 1240 times.
✓ Branch 3 taken 1209 times.
✓ Branch 4 taken 31 times.
|
1240 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 9943 |
2/3✓ Branch 1 taken 1209 times.
✓ Branch 5 taken 1209 times.
✗ Branch 6 not taken.
|
2418 | if ((value = object.getString(i))) { |
| 9944 |
2/2✓ Branch 1 taken 1209 times.
✓ Branch 4 taken 1209 times.
|
1209 | newObject.setString(i, value.get()); |
| 9945 | } | ||
| 9946 | } | ||
| 9947 | |||
| 9948 |
2/2✓ Branch 1 taken 31 times.
✓ Branch 4 taken 31 times.
|
31 | newObject.setString(39, "None"); |
| 9949 |
1/1✓ Branch 1 taken 31 times.
|
31 | newObject.setDouble(40, 1.0); |
| 9950 | |||
| 9951 |
1/1✓ Branch 1 taken 31 times.
|
31 | ss << newObject; |
| 9952 |
1/1✓ Branch 3 taken 31 times.
|
31 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 9953 | |||
| 9954 |
3/3✓ Branch 3 taken 64439 times.
✓ Branch 5 taken 1 time.
✓ Branch 6 taken 64438 times.
|
64470 | } else if (iddname == "OS:HeatPump:AirToWater:FuelFired:Heating") { |
| 9955 | |||
| 9956 | // 1 Field has been added from 3.10.0 to 3.11.0: | ||
| 9957 | // ------------------------------------------------ | ||
| 9958 | // * Minimum Unloading Ratio * 32 | ||
| 9959 | |||
| 9960 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto iddObject = idd_3_11_0.getObject(iddname); |
| 9961 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfObject newObject(iddObject.get()); |
| 9962 | |||
| 9963 |
3/3✓ Branch 1 taken 33 times.
✓ Branch 3 taken 32 times.
✓ Branch 4 taken 1 time.
|
33 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 9964 |
2/3✓ Branch 1 taken 32 times.
✓ Branch 5 taken 32 times.
✗ Branch 6 not taken.
|
64 | if ((value = object.getString(i))) { |
| 9965 |
2/2✓ Branch 1 taken 32 times.
✓ Branch 4 taken 32 times.
|
32 | newObject.setString(i, value.get()); |
| 9966 | } | ||
| 9967 | } | ||
| 9968 | |||
| 9969 |
1/1✓ Branch 1 taken 1 time.
|
1 | newObject.setDouble(32, 0.25); |
| 9970 | |||
| 9971 |
1/1✓ Branch 1 taken 1 time.
|
1 | ss << newObject; |
| 9972 |
1/1✓ Branch 3 taken 1 time.
|
1 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 9973 | |||
| 9974 |
3/3✓ Branch 3 taken 64438 times.
✓ Branch 5 taken 1 time.
✓ Branch 6 taken 64437 times.
|
64439 | } else if (iddname == "OS:HeatPump:AirToWater:FuelFired:Cooling") { |
| 9975 | |||
| 9976 | // 1 Field has been added from 3.10.0 to 3.11.0: | ||
| 9977 | // ------------------------------------------------ | ||
| 9978 | // * Minimum Unloading Ratio * 27 | ||
| 9979 | |||
| 9980 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto iddObject = idd_3_11_0.getObject(iddname); |
| 9981 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfObject newObject(iddObject.get()); |
| 9982 | |||
| 9983 |
3/3✓ Branch 1 taken 28 times.
✓ Branch 3 taken 27 times.
✓ Branch 4 taken 1 time.
|
28 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 9984 |
2/3✓ Branch 1 taken 27 times.
✓ Branch 5 taken 27 times.
✗ Branch 6 not taken.
|
54 | if ((value = object.getString(i))) { |
| 9985 |
2/2✓ Branch 1 taken 27 times.
✓ Branch 4 taken 27 times.
|
27 | newObject.setString(i, value.get()); |
| 9986 | } | ||
| 9987 | } | ||
| 9988 | |||
| 9989 |
1/1✓ Branch 1 taken 1 time.
|
1 | newObject.setDouble(27, 0.25); |
| 9990 | |||
| 9991 |
1/1✓ Branch 1 taken 1 time.
|
1 | ss << newObject; |
| 9992 |
1/1✓ Branch 3 taken 1 time.
|
1 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 9993 | |||
| 9994 |
3/3✓ Branch 3 taken 64437 times.
✓ Branch 5 taken 3 times.
✓ Branch 6 taken 64434 times.
|
64438 | } else if (iddname == "OS:ZoneHVAC:PackagedTerminalHeatPump") { |
| 9995 | |||
| 9996 | // 1 Field has been inserted from 3.10.0 to 3.11.0: | ||
| 9997 | // ------------------------------------------------ | ||
| 9998 | // * DX Heating Coil Sizing Ratio * 25 | ||
| 9999 | |||
| 10000 |
1/1✓ Branch 1 taken 3 times.
|
3 | auto iddObject = idd_3_11_0.getObject(iddname); |
| 10001 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | IdfObject newObject(iddObject.get()); |
| 10002 | |||
| 10003 |
3/3✓ Branch 1 taken 78 times.
✓ Branch 3 taken 75 times.
✓ Branch 4 taken 3 times.
|
78 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 10004 |
2/3✓ Branch 1 taken 75 times.
✓ Branch 5 taken 75 times.
✗ Branch 6 not taken.
|
150 | if ((value = object.getString(i))) { |
| 10005 |
2/2✓ Branch 1 taken 75 times.
✓ Branch 4 taken 75 times.
|
75 | newObject.setString(i, value.get()); |
| 10006 | } | ||
| 10007 | } | ||
| 10008 | |||
| 10009 |
1/1✓ Branch 1 taken 3 times.
|
3 | newObject.setDouble(25, 1.0); |
| 10010 | |||
| 10011 |
1/1✓ Branch 1 taken 3 times.
|
3 | ss << newObject; |
| 10012 |
1/1✓ Branch 3 taken 3 times.
|
3 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 10013 | |||
| 10014 |
3/3✓ Branch 3 taken 64434 times.
✓ Branch 5 taken 4 times.
✓ Branch 6 taken 64430 times.
|
64437 | } else if (iddname == "OS:ZoneHVAC:WaterToAirHeatPump") { |
| 10015 | |||
| 10016 | // 1 Field has been inserted from 3.10.0 to 3.11.0: | ||
| 10017 | // ------------------------------------------------ | ||
| 10018 | // * DX Heating Coil Sizing Ratio * 25 | ||
| 10019 | |||
| 10020 |
1/1✓ Branch 1 taken 4 times.
|
4 | auto iddObject = idd_3_11_0.getObject(iddname); |
| 10021 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | IdfObject newObject(iddObject.get()); |
| 10022 | |||
| 10023 |
3/3✓ Branch 1 taken 96 times.
✓ Branch 3 taken 92 times.
✓ Branch 4 taken 4 times.
|
96 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 10024 |
2/3✓ Branch 1 taken 92 times.
✓ Branch 5 taken 92 times.
✗ Branch 6 not taken.
|
184 | if ((value = object.getString(i))) { |
| 10025 |
2/2✓ Branch 1 taken 92 times.
✓ Branch 4 taken 92 times.
|
92 | newObject.setString(i, value.get()); |
| 10026 | } | ||
| 10027 | } | ||
| 10028 | |||
| 10029 |
1/1✓ Branch 1 taken 4 times.
|
4 | newObject.setDouble(25, 1.0); |
| 10030 | |||
| 10031 |
1/1✓ Branch 1 taken 4 times.
|
4 | ss << newObject; |
| 10032 |
1/1✓ Branch 3 taken 4 times.
|
4 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 10033 | |||
| 10034 |
3/3✓ Branch 3 taken 64430 times.
✓ Branch 5 taken 1 time.
✓ Branch 6 taken 64429 times.
|
64434 | } else if (iddname == "OS:AirLoopHVAC:UnitaryHeatPump:AirToAir") { |
| 10035 | |||
| 10036 | // 1 Field has been inserted from 3.10.0 to 3.11.0: | ||
| 10037 | // ------------------------------------------------ | ||
| 10038 | // * DX Heating Coil Sizing Ratio * 18 | ||
| 10039 | |||
| 10040 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto iddObject = idd_3_11_0.getObject(iddname); |
| 10041 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfObject newObject(iddObject.get()); |
| 10042 | |||
| 10043 |
3/3✓ Branch 1 taken 18 times.
✓ Branch 3 taken 17 times.
✓ Branch 4 taken 1 time.
|
18 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 10044 |
2/3✓ Branch 1 taken 17 times.
✓ Branch 5 taken 17 times.
✗ Branch 6 not taken.
|
34 | if ((value = object.getString(i))) { |
| 10045 |
2/2✓ Branch 1 taken 17 times.
✓ Branch 4 taken 17 times.
|
17 | newObject.setString(i, value.get()); |
| 10046 | } | ||
| 10047 | } | ||
| 10048 | |||
| 10049 |
1/1✓ Branch 1 taken 1 time.
|
1 | newObject.setDouble(18, 1.0); |
| 10050 | |||
| 10051 |
1/1✓ Branch 1 taken 1 time.
|
1 | ss << newObject; |
| 10052 |
1/1✓ Branch 3 taken 1 time.
|
1 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 10053 | |||
| 10054 |
3/3✓ Branch 3 taken 64429 times.
✓ Branch 5 taken 1 time.
✓ Branch 6 taken 64428 times.
|
64430 | } else if (iddname == "OS:AirLoopHVAC:UnitaryHeatPump:AirToAir:MultiSpeed") { |
| 10055 | |||
| 10056 | // 1 Field has been inserted from 3.10.0 to 3.11.0: | ||
| 10057 | // ------------------------------------------------ | ||
| 10058 | // * DX Heating Coil Sizing Ratio * 10 | ||
| 10059 | |||
| 10060 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto iddObject = idd_3_11_0.getObject(iddname); |
| 10061 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfObject newObject(iddObject.get()); |
| 10062 | |||
| 10063 |
3/3✓ Branch 1 taken 33 times.
✓ Branch 3 taken 32 times.
✓ Branch 4 taken 1 time.
|
33 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 10064 |
2/3✓ Branch 1 taken 32 times.
✓ Branch 5 taken 32 times.
✗ Branch 6 not taken.
|
64 | if ((value = object.getString(i))) { |
| 10065 |
2/2✓ Branch 1 taken 32 times.
✓ Branch 4 taken 32 times.
|
32 | newObject.setString(i, value.get()); |
| 10066 | } | ||
| 10067 | } | ||
| 10068 | |||
| 10069 |
1/1✓ Branch 1 taken 1 time.
|
1 | newObject.setDouble(10, 1.0); |
| 10070 | |||
| 10071 |
1/1✓ Branch 1 taken 1 time.
|
1 | ss << newObject; |
| 10072 |
1/1✓ Branch 3 taken 1 time.
|
1 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 10073 | |||
| 10074 |
3/3✓ Branch 3 taken 64428 times.
✓ Branch 5 taken 31 times.
✓ Branch 6 taken 64397 times.
|
64429 | } else if (iddname == "OS:Controller:MechanicalVentilation") { |
| 10075 | |||
| 10076 | // 1 Field has been modified from 3.10.0 to 3.11.0: | ||
| 10077 | // ------------------------------------------------ | ||
| 10078 | // * System Outdoor Air Method * 4 - Removed ProportionalControl as mapping to ProportionalControlBasedonOccupancySchedule | ||
| 10079 | |||
| 10080 |
1/1✓ Branch 1 taken 31 times.
|
31 | auto iddObject = idd_3_11_0.getObject(iddname); |
| 10081 |
2/2✓ Branch 1 taken 31 times.
✓ Branch 4 taken 31 times.
|
31 | IdfObject newObject(iddObject.get()); |
| 10082 | |||
| 10083 |
3/3✓ Branch 1 taken 186 times.
✓ Branch 3 taken 155 times.
✓ Branch 4 taken 31 times.
|
186 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 10084 |
2/3✓ Branch 1 taken 155 times.
✓ Branch 5 taken 155 times.
✗ Branch 6 not taken.
|
310 | if ((value = object.getString(i))) { |
| 10085 |
2/2✓ Branch 0 taken 31 times.
✓ Branch 1 taken 124 times.
|
155 | if (i == 4) { |
| 10086 |
5/5✓ Branch 1 taken 31 times.
✓ Branch 4 taken 31 times.
✓ Branch 7 taken 31 times.
✓ Branch 10 taken 1 time.
✓ Branch 11 taken 30 times.
|
62 | if (istringEqual(value.get(), "ProportionalControl")) { |
| 10087 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | newObject.setString(4, "ProportionalControlBasedonOccupancySchedule"); |
| 10088 | } else { | ||
| 10089 |
2/2✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
|
30 | newObject.setString(i, value.get()); |
| 10090 | } | ||
| 10091 | } else { | ||
| 10092 |
2/2✓ Branch 1 taken 124 times.
✓ Branch 4 taken 124 times.
|
124 | newObject.setString(i, value.get()); |
| 10093 | } | ||
| 10094 | } | ||
| 10095 | } | ||
| 10096 | |||
| 10097 |
1/1✓ Branch 1 taken 31 times.
|
31 | ss << newObject; |
| 10098 |
1/1✓ Branch 3 taken 31 times.
|
31 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 10099 | |||
| 10100 |
3/3✓ Branch 3 taken 64397 times.
✓ Branch 5 taken 622 times.
✓ Branch 6 taken 63775 times.
|
64428 | } else if (iddname == "OS:People") { |
| 10101 | |||
| 10102 | // 2 Fields have been inserted from 3.10.0 to 3.11.0: | ||
| 10103 | // ------------------------------------------------ | ||
| 10104 | // * Clothing Insulation Calculation Method * 8 | ||
| 10105 | // * Clothing Insulation Calculation Method Schedule Name * 9 | ||
| 10106 | |||
| 10107 |
1/1✓ Branch 1 taken 622 times.
|
622 | auto iddObject = idd_3_11_0.getObject(iddname); |
| 10108 |
2/2✓ Branch 1 taken 622 times.
✓ Branch 4 taken 622 times.
|
622 | IdfObject newObject(iddObject.get()); |
| 10109 | |||
| 10110 |
3/3✓ Branch 1 taken 6385 times.
✓ Branch 3 taken 5763 times.
✓ Branch 4 taken 622 times.
|
6385 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 10111 |
2/3✓ Branch 1 taken 5763 times.
✓ Branch 5 taken 5763 times.
✗ Branch 6 not taken.
|
11526 | if ((value = object.getString(i))) { |
| 10112 |
2/2✓ Branch 0 taken 4368 times.
✓ Branch 1 taken 1395 times.
|
5763 | if (i < 8) { |
| 10113 |
2/2✓ Branch 1 taken 4368 times.
✓ Branch 4 taken 4368 times.
|
4368 | newObject.setString(i, value.get()); |
| 10114 | } else { | ||
| 10115 |
2/2✓ Branch 1 taken 1395 times.
✓ Branch 4 taken 1395 times.
|
1395 | newObject.setString(i + 2, value.get()); |
| 10116 | } | ||
| 10117 | } | ||
| 10118 | } | ||
| 10119 | |||
| 10120 |
2/2✓ Branch 1 taken 622 times.
✓ Branch 4 taken 622 times.
|
622 | newObject.setString(8, "ClothingInsulationSchedule"); |
| 10121 | |||
| 10122 |
1/1✓ Branch 1 taken 622 times.
|
622 | ss << newObject; |
| 10123 |
1/1✓ Branch 3 taken 622 times.
|
622 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 10124 | |||
| 10125 |
3/3✓ Branch 3 taken 63775 times.
✓ Branch 5 taken 1 time.
✓ Branch 6 taken 63774 times.
|
64397 | } else if (iddname == "OS:EvaporativeFluidCooler:SingleSpeed") { |
| 10126 | |||
| 10127 | // 1 Field has been inserted from 3.10.0 to 3.10.1: | ||
| 10128 | // ------------------------------------------------ | ||
| 10129 | // * Heat Rejection Capacity and Nominal Capacity Sizing Ratio * 9 | ||
| 10130 | |||
| 10131 | // 3 Fields were made required from 3.10.0 to 3.10.1: | ||
| 10132 | // ------------------------------------------------ | ||
| 10133 | // * Design Entering Water Temperature * 14 | ||
| 10134 | // * Design Entering Air Temperature * 15 | ||
| 10135 | // * Design Entering Air Wet-bulb Temperature * 16 | ||
| 10136 | |||
| 10137 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto iddObject = idd_3_11_0.getObject(iddname); |
| 10138 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfObject newObject(iddObject.get()); |
| 10139 | |||
| 10140 |
3/3✓ Branch 1 taken 26 times.
✓ Branch 3 taken 25 times.
✓ Branch 4 taken 1 time.
|
26 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 10141 |
2/3✓ Branch 1 taken 25 times.
✓ Branch 5 taken 25 times.
✗ Branch 6 not taken.
|
50 | if ((value = object.getString(i))) { |
| 10142 |
2/2✓ Branch 0 taken 9 times.
✓ Branch 1 taken 16 times.
|
25 | if (i < 9) { |
| 10143 |
2/2✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
|
9 | newObject.setString(i, value.get()); |
| 10144 | } else { | ||
| 10145 |
2/2✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
|
16 | newObject.setString(i + 1, value.get()); |
| 10146 | } | ||
| 10147 | } | ||
| 10148 | } | ||
| 10149 | |||
| 10150 |
1/1✓ Branch 1 taken 1 time.
|
1 | newObject.setDouble(9, 1.25); |
| 10151 | |||
| 10152 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✗ Branch 5 not taken.
|
1 | if (!object.getDouble(13)) { |
| 10153 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | newObject.setString(14, "Autosize"); |
| 10154 | } | ||
| 10155 | |||
| 10156 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✗ Branch 5 not taken.
|
1 | if (!object.getDouble(14)) { |
| 10157 |
1/1✓ Branch 1 taken 1 time.
|
1 | newObject.setDouble(15, 35.0); |
| 10158 | } | ||
| 10159 | |||
| 10160 |
2/3✓ Branch 1 taken 1 time.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 time.
|
1 | if (!object.getDouble(15)) { |
| 10161 | ✗ | newObject.setDouble(16, 25.6); | |
| 10162 | } | ||
| 10163 | |||
| 10164 |
1/1✓ Branch 1 taken 1 time.
|
1 | ss << newObject; |
| 10165 |
1/1✓ Branch 3 taken 1 time.
|
1 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 10166 | |||
| 10167 |
3/3✓ Branch 3 taken 63774 times.
✓ Branch 5 taken 1 time.
✓ Branch 6 taken 63773 times.
|
63775 | } else if (iddname == "OS:EvaporativeFluidCooler:TwoSpeed") { |
| 10168 | |||
| 10169 | // 3 Fields were made required from 3.10.0 to 3.10.1: | ||
| 10170 | // ------------------------------------------------ | ||
| 10171 | // * Design Entering Water Temperature * 24 | ||
| 10172 | // * Design Entering Air Temperature * 25 | ||
| 10173 | // * Design Entering Air Wet-bulb Temperature * 26 | ||
| 10174 | |||
| 10175 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto iddObject = idd_3_11_0.getObject(iddname); |
| 10176 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfObject newObject(iddObject.get()); |
| 10177 | |||
| 10178 |
3/3✓ Branch 1 taken 35 times.
✓ Branch 3 taken 34 times.
✓ Branch 4 taken 1 time.
|
35 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 10179 |
2/3✓ Branch 1 taken 34 times.
✓ Branch 5 taken 34 times.
✗ Branch 6 not taken.
|
68 | if ((value = object.getString(i))) { |
| 10180 |
2/2✓ Branch 1 taken 34 times.
✓ Branch 4 taken 34 times.
|
34 | newObject.setString(i, value.get()); |
| 10181 | } | ||
| 10182 | } | ||
| 10183 | |||
| 10184 |
2/3✓ Branch 1 taken 1 time.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 time.
|
1 | if (!object.getDouble(24)) { |
| 10185 | ✗ | newObject.setString(24, "Autosize"); | |
| 10186 | } | ||
| 10187 | |||
| 10188 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✗ Branch 5 not taken.
|
1 | if (!object.getDouble(25)) { |
| 10189 |
1/1✓ Branch 1 taken 1 time.
|
1 | newObject.setDouble(25, 35.0); |
| 10190 | } | ||
| 10191 | |||
| 10192 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✗ Branch 5 not taken.
|
1 | if (!object.getDouble(26)) { |
| 10193 |
1/1✓ Branch 1 taken 1 time.
|
1 | newObject.setDouble(26, 25.6); |
| 10194 | } | ||
| 10195 | |||
| 10196 |
1/1✓ Branch 1 taken 1 time.
|
1 | ss << newObject; |
| 10197 |
1/1✓ Branch 3 taken 1 time.
|
1 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 10198 | |||
| 10199 |
3/3✓ Branch 3 taken 63773 times.
✓ Branch 5 taken 2 times.
✓ Branch 6 taken 63771 times.
|
63774 | } else if (iddname == "OS:OutputControl:Files") { |
| 10200 | |||
| 10201 | // 1 Field has been added from 3.10.0 to 3.11.0: | ||
| 10202 | // ---------------------------------------------- | ||
| 10203 | // * Output Plant Component Sizing * 32 | ||
| 10204 | |||
| 10205 |
1/1✓ Branch 1 taken 2 times.
|
2 | auto iddObject = idd_3_11_0.getObject(iddname); |
| 10206 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | IdfObject newObject(iddObject.get()); |
| 10207 | |||
| 10208 |
3/3✓ Branch 1 taken 66 times.
✓ Branch 3 taken 64 times.
✓ Branch 4 taken 2 times.
|
66 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 10209 |
2/3✓ Branch 1 taken 64 times.
✓ Branch 5 taken 64 times.
✗ Branch 6 not taken.
|
128 | if ((value = object.getString(i))) { |
| 10210 |
2/2✓ Branch 1 taken 64 times.
✓ Branch 4 taken 64 times.
|
64 | newObject.setString(i, value.get()); |
| 10211 | } | ||
| 10212 | } | ||
| 10213 | |||
| 10214 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | newObject.setString(32, "Yes"); |
| 10215 | |||
| 10216 |
1/1✓ Branch 1 taken 2 times.
|
2 | ss << newObject; |
| 10217 |
1/1✓ Branch 3 taken 2 times.
|
2 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 10218 | |||
| 10219 | // No-op | ||
| 10220 | 2 | } else { | |
| 10221 |
1/1✓ Branch 1 taken 63771 times.
|
63771 | ss << object; |
| 10222 | } | ||
| 10223 | 66016 | } | |
| 10224 | |||
| 10225 |
1/1✓ Branch 1 taken 147 times.
|
294 | return ss.str(); |
| 10226 | |||
| 10227 | 147 | } // end update_3_10_0_to_3_11_0 | |
| 10228 | |||
| 10229 | 149 | std::string VersionTranslator::update_3_11_0_to_3_12_0(const IdfFile& idf_3_11_0, const IddFileAndFactoryWrapper& idd_3_12_0) { | |
| 10230 |
1/1✓ Branch 1 taken 149 times.
|
149 | std::stringstream ss; |
| 10231 | 149 | boost::optional<std::string> value; | |
| 10232 | |||
| 10233 |
4/4✓ Branch 1 taken 149 times.
✓ Branch 4 taken 149 times.
✓ Branch 7 taken 149 times.
✓ Branch 10 taken 149 times.
|
149 | ss << idf_3_11_0.header() << '\n' << '\n'; |
| 10234 |
2/2✓ Branch 1 taken 149 times.
✓ Branch 4 taken 149 times.
|
149 | IdfFile targetIdf(idd_3_12_0.iddFile()); |
| 10235 |
3/3✓ Branch 1 taken 149 times.
✓ Branch 4 taken 149 times.
✓ Branch 7 taken 149 times.
|
149 | ss << targetIdf.versionObject().get(); |
| 10236 | |||
| 10237 |
3/3✓ Branch 1 taken 149 times.
✓ Branch 8 taken 65929 times.
✓ Branch 9 taken 149 times.
|
66078 | for (const IdfObject& object : idf_3_11_0.objects()) { |
| 10238 |
2/2✓ Branch 1 taken 65929 times.
✓ Branch 4 taken 65929 times.
|
65929 | auto iddname = object.iddObject().name(); |
| 10239 | |||
| 10240 |
3/3✓ Branch 1 taken 65929 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 65928 times.
|
65929 | if (iddname == "OS:CentralHeatPumpSystem") { |
| 10241 | |||
| 10242 | // 1 Field has been removed from 3.11.0 to 3.12.0: | ||
| 10243 | // ------------------------------------------------ | ||
| 10244 | // * Control Method * 2 | ||
| 10245 | |||
| 10246 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto iddObject = idd_3_12_0.getObject(iddname); |
| 10247 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfObject newObject(iddObject.get()); |
| 10248 | |||
| 10249 |
3/3✓ Branch 1 taken 13 times.
✓ Branch 3 taken 12 times.
✓ Branch 4 taken 1 time.
|
13 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 10250 |
2/3✓ Branch 1 taken 12 times.
✓ Branch 5 taken 12 times.
✗ Branch 6 not taken.
|
24 | if ((value = object.getString(i))) { |
| 10251 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 10 times.
|
12 | if (i < 2) { |
| 10252 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | newObject.setString(i, value.get()); |
| 10253 |
2/2✓ Branch 0 taken 9 times.
✓ Branch 1 taken 1 time.
|
10 | } else if (i == 2) { |
| 10254 | // no-op: Control Method field removed | ||
| 10255 | } else { | ||
| 10256 |
2/2✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
|
9 | newObject.setString(i - 1, value.get()); |
| 10257 | } | ||
| 10258 | } | ||
| 10259 | } | ||
| 10260 | |||
| 10261 |
1/1✓ Branch 1 taken 1 time.
|
1 | ss << newObject; |
| 10262 |
1/1✓ Branch 3 taken 1 time.
|
1 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 10263 | |||
| 10264 |
3/3✓ Branch 3 taken 65928 times.
✓ Branch 5 taken 1 time.
✓ Branch 6 taken 65927 times.
|
65929 | } else if (iddname == "OS:ChillerHeaterPerformance:Electric:EIR") { |
| 10265 | |||
| 10266 | // 1 Field has been removed from 3.11.0 to 3.12.0: | ||
| 10267 | // ------------------------------------------------ | ||
| 10268 | // * Condenser Type * 18 | ||
| 10269 | |||
| 10270 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto iddObject = idd_3_12_0.getObject(iddname); |
| 10271 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfObject newObject(iddObject.get()); |
| 10272 | |||
| 10273 |
3/3✓ Branch 1 taken 31 times.
✓ Branch 3 taken 30 times.
✓ Branch 4 taken 1 time.
|
31 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 10274 |
2/3✓ Branch 1 taken 30 times.
✓ Branch 5 taken 30 times.
✗ Branch 6 not taken.
|
60 | if ((value = object.getString(i))) { |
| 10275 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 12 times.
|
30 | if (i < 18) { |
| 10276 |
2/2✓ Branch 1 taken 18 times.
✓ Branch 4 taken 18 times.
|
18 | newObject.setString(i, value.get()); |
| 10277 |
2/2✓ Branch 0 taken 11 times.
✓ Branch 1 taken 1 time.
|
12 | } else if (i == 18) { |
| 10278 | // no-op: Condenser Type field removed | ||
| 10279 | } else { | ||
| 10280 |
2/2✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
|
11 | newObject.setString(i - 1, value.get()); |
| 10281 | } | ||
| 10282 | } | ||
| 10283 | } | ||
| 10284 | |||
| 10285 |
1/1✓ Branch 1 taken 1 time.
|
1 | ss << newObject; |
| 10286 |
1/1✓ Branch 3 taken 1 time.
|
1 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 10287 | |||
| 10288 |
3/3✓ Branch 3 taken 65927 times.
✓ Branch 5 taken 3 times.
✓ Branch 6 taken 65924 times.
|
65928 | } else if (iddname == "OS:Coil:Cooling:DX:CurveFit:OperatingMode") { |
| 10289 | |||
| 10290 | // 1 Field has been added from 3.11.0 to 3.12.0: | ||
| 10291 | // ------------------------------------------------ | ||
| 10292 | // * Apply Part Load Fraction to Speeds Greater than 1 * 9 | ||
| 10293 | |||
| 10294 |
1/1✓ Branch 1 taken 3 times.
|
3 | auto iddObject = idd_3_12_0.getObject(iddname); |
| 10295 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | IdfObject newObject(iddObject.get()); |
| 10296 | |||
| 10297 |
3/3✓ Branch 1 taken 42 times.
✓ Branch 3 taken 39 times.
✓ Branch 4 taken 3 times.
|
42 | for (size_t i = 0; i < object.numFields(); ++i) { |
| 10298 |
2/3✓ Branch 1 taken 39 times.
✓ Branch 5 taken 39 times.
✗ Branch 6 not taken.
|
78 | if ((value = object.getString(i))) { |
| 10299 |
2/2✓ Branch 0 taken 27 times.
✓ Branch 1 taken 12 times.
|
39 | if (i < 9) { |
| 10300 |
2/2✓ Branch 1 taken 27 times.
✓ Branch 4 taken 27 times.
|
27 | newObject.setString(i, value.get()); |
| 10301 | } else { | ||
| 10302 |
2/2✓ Branch 1 taken 12 times.
✓ Branch 4 taken 12 times.
|
12 | newObject.setString(i + 1, value.get()); |
| 10303 | } | ||
| 10304 | } | ||
| 10305 | } | ||
| 10306 | |||
| 10307 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | newObject.setString(9, "No"); |
| 10308 | |||
| 10309 |
1/1✓ Branch 1 taken 3 times.
|
3 | ss << newObject; |
| 10310 |
1/1✓ Branch 3 taken 3 times.
|
3 | m_refactored.emplace_back(std::move(object), std::move(newObject)); |
| 10311 | |||
| 10312 | // No-op | ||
| 10313 | 3 | } else { | |
| 10314 |
1/1✓ Branch 1 taken 65924 times.
|
65924 | ss << object; |
| 10315 | } | ||
| 10316 | 66078 | } | |
| 10317 | |||
| 10318 |
1/1✓ Branch 1 taken 149 times.
|
298 | return ss.str(); |
| 10319 | |||
| 10320 | 149 | } // end update_3_11_0_to_3_12_0 | |
| 10321 | } // namespace osversion | ||
| 10322 | } // namespace openstudio | ||
| 10323 |