From e83ade3e023052e198b3f47548e058c23647cd6b Mon Sep 17 00:00:00 2001 From: Joe Robertson Date: Tue, 27 Feb 2024 08:55:32 -0700 Subject: [PATCH 01/10] Add EnclosureAveraged key to idd. --- resources/model/OpenStudio.idd | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/resources/model/OpenStudio.idd b/resources/model/OpenStudio.idd index 714e8753ce0..1d7b5471005 100644 --- a/resources/model/OpenStudio.idd +++ b/resources/model/OpenStudio.idd @@ -3904,8 +3904,9 @@ OS:People:Definition, A5, \field Mean Radiant Temperature Calculation Type \note optional (only required for thermal comfort runs) \type choice - \default ZoneAveraged + \default EnclosureAveraged \key ZoneAveraged + \key EnclosureAveraged \key SurfaceWeighted \key AngleFactor A6; \field Thermal Comfort Model Type From dcfb9020a8b57910481f620cc7346b3bf84d5bae Mon Sep 17 00:00:00 2001 From: Joe Robertson Date: Tue, 27 Feb 2024 08:55:52 -0700 Subject: [PATCH 02/10] Update people model tests. --- src/model/test/People_GTest.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/model/test/People_GTest.cpp b/src/model/test/People_GTest.cpp index 74ef0d4f4a8..90fd04ab4f5 100644 --- a/src/model/test/People_GTest.cpp +++ b/src/model/test/People_GTest.cpp @@ -40,6 +40,16 @@ TEST_F(ModelFixture, People_DefaultConstructor) { EXPECT_EQ(0, definition.numberofPeople().get()); EXPECT_FALSE(definition.peopleperSpaceFloorArea()); EXPECT_FALSE(definition.spaceFloorAreaperPerson()); + + EXPECT_TRUE(definition.isMeanRadiantTemperatureCalculationTypeDefaulted()); + EXPECT_NE("ZoneAveraged", definition.meanRadiantTemperatureCalculationType()); + EXPECT_NE("EnclosureAveraged", definition.meanRadiantTemperatureCalculationType()); + EXPECT_TRUE(definition.setMeanRadiantTemperatureCalculationType("ZoneAveraged")); + EXPECT_EQ("ZoneAveraged", definition.meanRadiantTemperatureCalculationType()); + EXPECT_FALSE(definition.isMeanRadiantTemperatureCalculationTypeDefaulted()); + EXPECT_TRUE(definition.setMeanRadiantTemperatureCalculationType("EnclosureAveraged")); + EXPECT_EQ("EnclosureAveraged", definition.meanRadiantTemperatureCalculationType()); + EXPECT_TRUE(definition.isMeanRadiantTemperatureCalculationTypeDefaulted()); } TEST_F(ModelFixture, People_DesignLevels) { From fcec630a36c52d85367711d8f52345b5a39f9071 Mon Sep 17 00:00:00 2001 From: Joe Robertson Date: Tue, 27 Feb 2024 08:56:28 -0700 Subject: [PATCH 03/10] Update people ft to not write ZoneAveraged. --- src/energyplus/ForwardTranslator/ForwardTranslatePeople.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/energyplus/ForwardTranslator/ForwardTranslatePeople.cpp b/src/energyplus/ForwardTranslator/ForwardTranslatePeople.cpp index de06ac3cd96..9ff52218adb 100644 --- a/src/energyplus/ForwardTranslator/ForwardTranslatePeople.cpp +++ b/src/energyplus/ForwardTranslator/ForwardTranslatePeople.cpp @@ -103,7 +103,10 @@ namespace energyplus { } if (!definition.isMeanRadiantTemperatureCalculationTypeDefaulted()) { - idfObject.setString(PeopleFields::MeanRadiantTemperatureCalculationType, definition.meanRadiantTemperatureCalculationType()); + std::string meanRadiantTemperatureCalculationType = definition.meanRadiantTemperatureCalculationType(); + if (!(meanRadiantTemperatureCalculationType == "ZoneAveraged")) { + idfObject.setString(PeopleFields::MeanRadiantTemperatureCalculationType, meanRadiantTemperatureCalculationType); + } } // TODO: Surface Name/Angle Factor List Name From 94b3e26622c5516dc8acec9a5a556b02ddc61217 Mon Sep 17 00:00:00 2001 From: Joe Robertson Date: Tue, 27 Feb 2024 08:56:43 -0700 Subject: [PATCH 04/10] Update people def vt and add tests. --- src/osversion/VersionTranslator.cpp | 43 ++++++++++++++++++- src/osversion/VersionTranslator.hpp | 1 + .../test/3_8_0/test_vt_PeopleDefinition.osm | 18 ++++++++ .../test/3_8_0/test_vt_PeopleDefinition.rb | 10 +++++ .../test/VersionTranslator_GTest.cpp | 25 +++++++++++ 5 files changed, 96 insertions(+), 1 deletion(-) create mode 100644 src/osversion/test/3_8_0/test_vt_PeopleDefinition.osm create mode 100644 src/osversion/test/3_8_0/test_vt_PeopleDefinition.rb diff --git a/src/osversion/VersionTranslator.cpp b/src/osversion/VersionTranslator.cpp index 31a3334ada1..2b757280cad 100644 --- a/src/osversion/VersionTranslator.cpp +++ b/src/osversion/VersionTranslator.cpp @@ -143,7 +143,8 @@ namespace osversion { m_updateMethods[VersionString("3.5.1")] = &VersionTranslator::update_3_5_0_to_3_5_1; m_updateMethods[VersionString("3.6.0")] = &VersionTranslator::update_3_5_1_to_3_6_0; m_updateMethods[VersionString("3.7.0")] = &VersionTranslator::update_3_6_1_to_3_7_0; - m_updateMethods[VersionString("3.8.0")] = &VersionTranslator::defaultUpdate; + m_updateMethods[VersionString("3.8.0")] = &VersionTranslator::update_3_7_0_to_3_8_0; + // m_updateMethods[VersionString("3.8.0")] = &VersionTranslator::defaultUpdate; // List of previous versions that may be updated to this one. // - To increment the translator, add an entry for the version just released (branched for @@ -8951,5 +8952,45 @@ namespace osversion { } // end update_3_6_1_to_3_7_0 + std::string VersionTranslator::update_3_7_0_to_3_8_0(const IdfFile& idf_3_7_0, const IddFileAndFactoryWrapper& idd_3_8_0) { + std::stringstream ss; + boost::optional value; + + ss << idf_3_7_0.header() << '\n' << '\n'; + IdfFile targetIdf(idd_3_8_0.iddFile()); + ss << targetIdf.versionObject().get(); + + for (const IdfObject& object : idf_3_7_0.objects()) { + auto iddname = object.iddObject().name(); + + if (iddname == "OS:People:Definition") { + + // 1 Key has been changed from 3.7.0 to 3.8.0: + // ---------------------------------------------- + // * Mean Radiant Temperature Calculation Type * 10 + // * ZoneAveraged -> EnclosureAveraged + + auto iddObject = idd_3_8_0.getObject(iddname); + IdfObject newObject(iddObject.get()); + + if ((value = object.getString(10))) { + if (value.get() == "ZoneAveraged") { + newObject.setString(10, "EnclosureAveraged"); + } + } + + m_refactored.push_back(RefactoredObjectData(object, newObject)); + ss << newObject; + + // No-op + } else { + ss << object; + } + } + + return ss.str(); + + } // end update_3_7_0_to_3_8_0 + } // namespace osversion } // namespace openstudio diff --git a/src/osversion/VersionTranslator.hpp b/src/osversion/VersionTranslator.hpp index ca4a4d3b8a6..b5a93555c6f 100644 --- a/src/osversion/VersionTranslator.hpp +++ b/src/osversion/VersionTranslator.hpp @@ -235,6 +235,7 @@ namespace osversion { std::string update_3_5_0_to_3_5_1(const IdfFile& idf_3_5_0, const IddFileAndFactoryWrapper& idd_3_5_1); std::string update_3_5_1_to_3_6_0(const IdfFile& idf_3_5_1, const IddFileAndFactoryWrapper& idd_3_6_0); std::string update_3_6_1_to_3_7_0(const IdfFile& idf_3_6_1, const IddFileAndFactoryWrapper& idd_3_7_0); + std::string update_3_7_0_to_3_8_0(const IdfFile& idf_3_7_0, const IddFileAndFactoryWrapper& idd_3_8_0); IdfObject updateUrlField_0_7_1_to_0_7_2(const IdfObject& object, unsigned index); diff --git a/src/osversion/test/3_8_0/test_vt_PeopleDefinition.osm b/src/osversion/test/3_8_0/test_vt_PeopleDefinition.osm new file mode 100644 index 00000000000..9ff2f47ab9c --- /dev/null +++ b/src/osversion/test/3_8_0/test_vt_PeopleDefinition.osm @@ -0,0 +1,18 @@ + +OS:Version, + {7541834d-c2da-4d8b-8eaa-5219048d5428}, !- Handle + 3.7.0; !- Version Identifier + +OS:People:Definition, + {ede10f40-c28d-4de2-b32b-570d4e205850}, !- Handle + People Definition 1, !- Name + People, !- Number of People Calculation Method + 0, !- Number of People {people} + , !- People per Space Floor Area {person/m2} + , !- Space Floor Area per Person {m2/person} + 0.3, !- Fraction Radiant + , !- Sensible Heat Fraction + , !- Carbon Dioxide Generation Rate {m3/s-W} + , !- Enable ASHRAE 55 Comfort Warnings + ZoneAveraged; !- Mean Radiant Temperature Calculation Type + diff --git a/src/osversion/test/3_8_0/test_vt_PeopleDefinition.rb b/src/osversion/test/3_8_0/test_vt_PeopleDefinition.rb new file mode 100644 index 00000000000..280a6cbaa2e --- /dev/null +++ b/src/osversion/test/3_8_0/test_vt_PeopleDefinition.rb @@ -0,0 +1,10 @@ +#require '/usr/local/openstudio-3.6.1/Ruby/openstudio' + +include OpenStudio::Model + +m = Model.new + +people_def = PeopleDefinition.new(m) +people_def.setMeanRadiantTemperatureCalculationType("ZoneAveraged") + +m.save('test_vt_PeopleDefinition.osm', true) diff --git a/src/osversion/test/VersionTranslator_GTest.cpp b/src/osversion/test/VersionTranslator_GTest.cpp index 906a56e500a..12b21905292 100644 --- a/src/osversion/test/VersionTranslator_GTest.cpp +++ b/src/osversion/test/VersionTranslator_GTest.cpp @@ -4022,3 +4022,28 @@ TEST_F(OSVersionFixture, update_3_6_1_to_3_7_0_HeatPumpPlantLoopEIR) { EXPECT_TRUE(hp.isEmpty(insertionIndex++)); // TimedEmpiricalDefrostHeatInputEnergyFractionCurveName } } + +TEST_F(OSVersionFixture, update_3_7_0_to_3_8_0_HeatExchangerAirToAirSensibleAndLatent) { + openstudio::path path = resourcesPath() / toPath("osversion/3_8_0/test_vt_PeopleDefinition.osm"); + osversion::VersionTranslator vt; + boost::optional model = vt.loadModel(path); + ASSERT_TRUE(model) << "Failed to load " << path; + + openstudio::path outPath = resourcesPath() / toPath("osversion/3_8_0/test_vt_PeopleDefinition_updated.osm"); + model->save(outPath, true); + + std::vector defs = model->getObjectsByType("OS:People:Definition"); + ASSERT_EQ(1u, defs.size()); + WorkspaceObject def = defs[0]; + + EXPECT_EQ("People Definition 1", def.getString(1).get()); // Name + EXPECT_EQ("People", def.getString(2).get()); // Number of People Calculation Method + EXPECT_EQ(0, def.getDouble(3).get()); // Number of People {people} + EXPECT_TRUE(def.isEmpty(4)); // People per Space Floor Area {person/m2} + EXPECT_TRUE(def.isEmpty(5)); // Space Floor Area per Person {m2/person} + EXPECT_EQ(0.3, def.getDouble(6).get()); // Fraction Radiant + EXPECT_TRUE(def.isEmpty(7)); // Sensible Heat Fraction + EXPECT_TRUE(def.isEmpty(8)); // Carbon Dioxide Generation Rate {m3/s-W} + EXPECT_TRUE(def.isEmpty(9)); // Enable ASHRAE 55 Comfort Warnings + EXPECT_EQ("EnclosureAveraged", def.getString(10).get()); // Mean Radiant Temperature Calculation Type +} From 20db9844f2e04e0f685fded0b623097be9959aab Mon Sep 17 00:00:00 2001 From: Joe Robertson Date: Tue, 27 Feb 2024 08:57:00 -0700 Subject: [PATCH 05/10] Formatting. --- src/osversion/VersionTranslator.cpp | 2 +- src/osversion/test/VersionTranslator_GTest.cpp | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/osversion/VersionTranslator.cpp b/src/osversion/VersionTranslator.cpp index 2b757280cad..6f993636ca1 100644 --- a/src/osversion/VersionTranslator.cpp +++ b/src/osversion/VersionTranslator.cpp @@ -8976,7 +8976,7 @@ namespace osversion { if ((value = object.getString(10))) { if (value.get() == "ZoneAveraged") { newObject.setString(10, "EnclosureAveraged"); - } + } } m_refactored.push_back(RefactoredObjectData(object, newObject)); diff --git a/src/osversion/test/VersionTranslator_GTest.cpp b/src/osversion/test/VersionTranslator_GTest.cpp index 12b21905292..609e3e7aa6d 100644 --- a/src/osversion/test/VersionTranslator_GTest.cpp +++ b/src/osversion/test/VersionTranslator_GTest.cpp @@ -4037,13 +4037,13 @@ TEST_F(OSVersionFixture, update_3_7_0_to_3_8_0_HeatExchangerAirToAirSensibleAndL WorkspaceObject def = defs[0]; EXPECT_EQ("People Definition 1", def.getString(1).get()); // Name - EXPECT_EQ("People", def.getString(2).get()); // Number of People Calculation Method - EXPECT_EQ(0, def.getDouble(3).get()); // Number of People {people} - EXPECT_TRUE(def.isEmpty(4)); // People per Space Floor Area {person/m2} - EXPECT_TRUE(def.isEmpty(5)); // Space Floor Area per Person {m2/person} - EXPECT_EQ(0.3, def.getDouble(6).get()); // Fraction Radiant - EXPECT_TRUE(def.isEmpty(7)); // Sensible Heat Fraction - EXPECT_TRUE(def.isEmpty(8)); // Carbon Dioxide Generation Rate {m3/s-W} - EXPECT_TRUE(def.isEmpty(9)); // Enable ASHRAE 55 Comfort Warnings - EXPECT_EQ("EnclosureAveraged", def.getString(10).get()); // Mean Radiant Temperature Calculation Type + EXPECT_EQ("People", def.getString(2).get()); // Number of People Calculation Method + EXPECT_EQ(0, def.getDouble(3).get()); // Number of People {people} + EXPECT_TRUE(def.isEmpty(4)); // People per Space Floor Area {person/m2} + EXPECT_TRUE(def.isEmpty(5)); // Space Floor Area per Person {m2/person} + EXPECT_EQ(0.3, def.getDouble(6).get()); // Fraction Radiant + EXPECT_TRUE(def.isEmpty(7)); // Sensible Heat Fraction + EXPECT_TRUE(def.isEmpty(8)); // Carbon Dioxide Generation Rate {m3/s-W} + EXPECT_TRUE(def.isEmpty(9)); // Enable ASHRAE 55 Comfort Warnings + EXPECT_EQ("EnclosureAveraged", def.getString(10).get()); // Mean Radiant Temperature Calculation Type } From 392b25882e65f6296f7c3c06d43bf433d7badc48 Mon Sep 17 00:00:00 2001 From: Joe Robertson Date: Tue, 27 Feb 2024 09:59:12 -0700 Subject: [PATCH 06/10] Fix new vt test. --- src/osversion/VersionTranslator.cpp | 34 ++++++++++++------- .../test/VersionTranslator_GTest.cpp | 2 +- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/src/osversion/VersionTranslator.cpp b/src/osversion/VersionTranslator.cpp index 6f993636ca1..55e186dacd4 100644 --- a/src/osversion/VersionTranslator.cpp +++ b/src/osversion/VersionTranslator.cpp @@ -8973,24 +8973,32 @@ namespace osversion { auto iddObject = idd_3_8_0.getObject(iddname); IdfObject newObject(iddObject.get()); - if ((value = object.getString(10))) { - if (value.get() == "ZoneAveraged") { - newObject.setString(10, "EnclosureAveraged"); + for (size_t i = 0; i < object.numFields(); ++i) { + if ((value = object.getString(i))) { + if (i == 10) { + if (value.get() == "ZoneAveraged") { + newObject.setString(10, "EnclosureAveraged"); + } else { + newObject.setString(10, value.get()); + } + } else { + newObject.setString(i, value.get()); + } } - } - m_refactored.push_back(RefactoredObjectData(object, newObject)); - ss << newObject; + m_refactored.push_back(RefactoredObjectData(object, newObject)); + ss << newObject; - // No-op - } else { - ss << object; + // No-op + } + else { + ss << object; + } } - } - return ss.str(); + return ss.str(); - } // end update_3_7_0_to_3_8_0 + } // end update_3_7_0_to_3_8_0 -} // namespace osversion + } // namespace osversion } // namespace openstudio diff --git a/src/osversion/test/VersionTranslator_GTest.cpp b/src/osversion/test/VersionTranslator_GTest.cpp index 609e3e7aa6d..b8d45dec41f 100644 --- a/src/osversion/test/VersionTranslator_GTest.cpp +++ b/src/osversion/test/VersionTranslator_GTest.cpp @@ -4023,7 +4023,7 @@ TEST_F(OSVersionFixture, update_3_6_1_to_3_7_0_HeatPumpPlantLoopEIR) { } } -TEST_F(OSVersionFixture, update_3_7_0_to_3_8_0_HeatExchangerAirToAirSensibleAndLatent) { +TEST_F(OSVersionFixture, update_3_7_0_to_3_8_0_PeopleDefinition) { openstudio::path path = resourcesPath() / toPath("osversion/3_8_0/test_vt_PeopleDefinition.osm"); osversion::VersionTranslator vt; boost::optional model = vt.loadModel(path); From 8b501d90e0cbdfaf66e81def7c7caa9f9cac9c60 Mon Sep 17 00:00:00 2001 From: Joe Robertson Date: Tue, 27 Feb 2024 13:14:11 -0700 Subject: [PATCH 07/10] Formatting. --- src/osversion/VersionTranslator.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/osversion/VersionTranslator.cpp b/src/osversion/VersionTranslator.cpp index 55e186dacd4..1354d90c6b8 100644 --- a/src/osversion/VersionTranslator.cpp +++ b/src/osversion/VersionTranslator.cpp @@ -8985,20 +8985,20 @@ namespace osversion { newObject.setString(i, value.get()); } } + } - m_refactored.push_back(RefactoredObjectData(object, newObject)); - ss << newObject; + m_refactored.push_back(RefactoredObjectData(object, newObject)); + ss << newObject; - // No-op - } - else { - ss << object; - } + // No-op + } else { + ss << object; } + } - return ss.str(); + return ss.str(); - } // end update_3_7_0_to_3_8_0 + } // end update_3_7_0_to_3_8_0 - } // namespace osversion +} // namespace osversion } // namespace openstudio From 7e187ab0626b5bde5e951ab783a246c51537b85f Mon Sep 17 00:00:00 2001 From: Joe Robertson Date: Tue, 27 Feb 2024 14:11:44 -0700 Subject: [PATCH 08/10] Fix model default ctor test. --- src/model/test/People_GTest.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/model/test/People_GTest.cpp b/src/model/test/People_GTest.cpp index 90fd04ab4f5..f702a0f1b24 100644 --- a/src/model/test/People_GTest.cpp +++ b/src/model/test/People_GTest.cpp @@ -43,12 +43,14 @@ TEST_F(ModelFixture, People_DefaultConstructor) { EXPECT_TRUE(definition.isMeanRadiantTemperatureCalculationTypeDefaulted()); EXPECT_NE("ZoneAveraged", definition.meanRadiantTemperatureCalculationType()); - EXPECT_NE("EnclosureAveraged", definition.meanRadiantTemperatureCalculationType()); + EXPECT_EQ("EnclosureAveraged", definition.meanRadiantTemperatureCalculationType()); EXPECT_TRUE(definition.setMeanRadiantTemperatureCalculationType("ZoneAveraged")); EXPECT_EQ("ZoneAveraged", definition.meanRadiantTemperatureCalculationType()); EXPECT_FALSE(definition.isMeanRadiantTemperatureCalculationTypeDefaulted()); EXPECT_TRUE(definition.setMeanRadiantTemperatureCalculationType("EnclosureAveraged")); EXPECT_EQ("EnclosureAveraged", definition.meanRadiantTemperatureCalculationType()); + EXPECT_FALSE(definition.isMeanRadiantTemperatureCalculationTypeDefaulted()); + definition.resetMeanRadiantTemperatureCalculationType(); EXPECT_TRUE(definition.isMeanRadiantTemperatureCalculationTypeDefaulted()); } From 35b24a5abe65f75573f3c8c7a841638ce1909813 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Thu, 7 Mar 2024 18:43:20 +0100 Subject: [PATCH 09/10] Remove ZoneAveraged from IDD, implement some backward compat only in the setter --- resources/model/OpenStudio.idd | 3 +-- .../ForwardTranslator/ForwardTranslatePeople.cpp | 5 +---- src/model/PeopleDefinition.cpp | 5 ++++- src/model/test/People_GTest.cpp | 12 +++++++++--- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/resources/model/OpenStudio.idd b/resources/model/OpenStudio.idd index 650df669c66..41670d9174b 100644 --- a/resources/model/OpenStudio.idd +++ b/resources/model/OpenStudio.idd @@ -3905,7 +3905,6 @@ OS:People:Definition, \note optional (only required for thermal comfort runs) \type choice \default EnclosureAveraged - \key ZoneAveraged \key EnclosureAveraged \key SurfaceWeighted \key AngleFactor @@ -12055,7 +12054,7 @@ OS:AirLoopHVAC:UnitarySystem, \key Yes \key No \required-field - \note This field is not used when Design Specification Multispeed Object Type input is present + \note This field is not used when Design Specification Multispeed Object Type input is present \note When Yes is selected the minimum air flow rate is used. \note When No is selected the maximum air flow rate is used. N17, \field Maximum Supply Air Temperature diff --git a/src/energyplus/ForwardTranslator/ForwardTranslatePeople.cpp b/src/energyplus/ForwardTranslator/ForwardTranslatePeople.cpp index 9ff52218adb..de06ac3cd96 100644 --- a/src/energyplus/ForwardTranslator/ForwardTranslatePeople.cpp +++ b/src/energyplus/ForwardTranslator/ForwardTranslatePeople.cpp @@ -103,10 +103,7 @@ namespace energyplus { } if (!definition.isMeanRadiantTemperatureCalculationTypeDefaulted()) { - std::string meanRadiantTemperatureCalculationType = definition.meanRadiantTemperatureCalculationType(); - if (!(meanRadiantTemperatureCalculationType == "ZoneAveraged")) { - idfObject.setString(PeopleFields::MeanRadiantTemperatureCalculationType, meanRadiantTemperatureCalculationType); - } + idfObject.setString(PeopleFields::MeanRadiantTemperatureCalculationType, definition.meanRadiantTemperatureCalculationType()); } // TODO: Surface Name/Angle Factor List Name diff --git a/src/model/PeopleDefinition.cpp b/src/model/PeopleDefinition.cpp index cbc79b06078..1c4d9e0aa95 100644 --- a/src/model/PeopleDefinition.cpp +++ b/src/model/PeopleDefinition.cpp @@ -247,7 +247,10 @@ namespace model { } bool PeopleDefinition_Impl::setMeanRadiantTemperatureCalculationType(const std::string& meanRadiantTemperatureCalculationType) { - bool result = setString(OS_People_DefinitionFields::MeanRadiantTemperatureCalculationType, meanRadiantTemperatureCalculationType); + // Backward compat, starting at 3.8.0 + const std::string mrtType = + istringEqual("ZoneAveraged", meanRadiantTemperatureCalculationType) ? "EnclosureAveraged" : meanRadiantTemperatureCalculationType; + bool result = setString(OS_People_DefinitionFields::MeanRadiantTemperatureCalculationType, mrtType); return result; } diff --git a/src/model/test/People_GTest.cpp b/src/model/test/People_GTest.cpp index f702a0f1b24..1b1dfd08ec8 100644 --- a/src/model/test/People_GTest.cpp +++ b/src/model/test/People_GTest.cpp @@ -44,11 +44,17 @@ TEST_F(ModelFixture, People_DefaultConstructor) { EXPECT_TRUE(definition.isMeanRadiantTemperatureCalculationTypeDefaulted()); EXPECT_NE("ZoneAveraged", definition.meanRadiantTemperatureCalculationType()); EXPECT_EQ("EnclosureAveraged", definition.meanRadiantTemperatureCalculationType()); + + EXPECT_TRUE(definition.setMeanRadiantTemperatureCalculationType("SurfaceWeighted")); + EXPECT_EQ("SurfaceWeighted", definition.meanRadiantTemperatureCalculationType()); + + // Backward compat EXPECT_TRUE(definition.setMeanRadiantTemperatureCalculationType("ZoneAveraged")); - EXPECT_EQ("ZoneAveraged", definition.meanRadiantTemperatureCalculationType()); - EXPECT_FALSE(definition.isMeanRadiantTemperatureCalculationTypeDefaulted()); - EXPECT_TRUE(definition.setMeanRadiantTemperatureCalculationType("EnclosureAveraged")); EXPECT_EQ("EnclosureAveraged", definition.meanRadiantTemperatureCalculationType()); + + EXPECT_FALSE(definition.isMeanRadiantTemperatureCalculationTypeDefaulted()); + EXPECT_TRUE(definition.setMeanRadiantTemperatureCalculationType("SurfaceWeighted")); + EXPECT_EQ("SurfaceWeighted", definition.meanRadiantTemperatureCalculationType()); EXPECT_FALSE(definition.isMeanRadiantTemperatureCalculationTypeDefaulted()); definition.resetMeanRadiantTemperatureCalculationType(); EXPECT_TRUE(definition.isMeanRadiantTemperatureCalculationTypeDefaulted()); From 45185c5ab9a52eb0bfd31fb0ad349c6810ac6b44 Mon Sep 17 00:00:00 2001 From: Joe Robertson Date: Thu, 7 Mar 2024 14:06:48 -0700 Subject: [PATCH 10/10] Use istringEqual in vt. --- src/osversion/VersionTranslator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/osversion/VersionTranslator.cpp b/src/osversion/VersionTranslator.cpp index d8fa4dbb994..ad7436325f7 100644 --- a/src/osversion/VersionTranslator.cpp +++ b/src/osversion/VersionTranslator.cpp @@ -9146,7 +9146,7 @@ namespace osversion { for (size_t i = 0; i < object.numFields(); ++i) { if ((value = object.getString(i))) { if (i == 10) { - if (value.get() == "ZoneAveraged") { + if (istringEqual(value.get(), "ZoneAveraged")) { newObject.setString(10, "EnclosureAveraged"); } else { newObject.setString(10, value.get());