-
Notifications
You must be signed in to change notification settings - Fork 193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #5116 - Annoying FT warnings for always XX Scheduled missing the schedule type limits object #5117
Merged
Merged
Fix #5116 - Annoying FT warnings for always XX Scheduled missing the schedule type limits object #5117
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,6 +44,8 @@ | |
#include "../../model/OutputVariable_Impl.hpp" | ||
#include "../../model/Version.hpp" | ||
#include "../../model/Version_Impl.hpp" | ||
#include "../../model/YearDescription.hpp" | ||
#include "../../model/YearDescription_Impl.hpp" | ||
#include "../../model/ZoneCapacitanceMultiplierResearchSpecial.hpp" | ||
#include "../../model/ZoneCapacitanceMultiplierResearchSpecial_Impl.hpp" | ||
|
||
|
@@ -64,14 +66,15 @@ | |
|
||
#include <boost/algorithm/string/predicate.hpp> | ||
|
||
#include <future> | ||
|
||
#include <resources.hxx> | ||
|
||
#include <future> | ||
#include <sstream> | ||
|
||
#include <vector> | ||
|
||
#include <fmt/format.h> | ||
#include <fmt/ranges.h> | ||
|
||
using namespace openstudio::energyplus; | ||
using namespace openstudio::model; | ||
using namespace openstudio; | ||
|
@@ -557,8 +560,8 @@ TEST_F(EnergyPlusFixture,ForwardTranslatorTest_AllObjects) { | |
} | ||
*/ | ||
|
||
/* This test fails because objects of the same type share state across the Logger | ||
See detailed notes below. This test is disabled and commented out. | ||
/* This test fails because objects of the same type share state across the Logger | ||
See detailed notes below. This test is disabled and commented out. | ||
TEST_F(EnergyPlusFixture, ForwardTranslatorTest_MultipleTranslatorsInScope) { | ||
Model model; | ||
Space space(model); // not in thermal zone will generate a warning | ||
|
@@ -632,8 +635,8 @@ class ForwardTranslatorThread | |
std::future<Workspace> future; | ||
}; | ||
|
||
/* ForwardTranslatorTest_MultiThreadedLogMessages is disabled. | ||
See notes below for reasons why this tests fails due to race conditions. | ||
/* ForwardTranslatorTest_MultiThreadedLogMessages is disabled. | ||
See notes below for reasons why this tests fails due to race conditions. | ||
TEST_F(EnergyPlusFixture, ForwardTranslatorTest_MultiThreadedLogMessages) { | ||
|
||
// Logger::instance().standardOutLogger().enable(); | ||
|
@@ -961,3 +964,25 @@ TEST_F(EnergyPlusFixture, Ensure_Name_Unicity_ZoneAndZoneListAndSpaceAndSpaceLis | |
EXPECT_NE(wos[i1].nameString(), wos[i2].nameString()); | ||
} | ||
} | ||
|
||
TEST_F(EnergyPlusFixture, NoUselessWarnings) { | ||
// Test for #5116 | ||
Model m; | ||
auto yd = m.getUniqueModelObject<model::YearDescription>(); | ||
EXPECT_TRUE(yd.setDayofWeekforStartDay("Tuesday")); | ||
|
||
ForwardTranslator ft; | ||
StringStreamLogSink sink; | ||
sink.setLogLevel(Warn); | ||
|
||
Workspace w = ft.translateModel(m); | ||
EXPECT_EQ(0u, ft.errors().size()); | ||
EXPECT_EQ(0u, ft.warnings().size()); | ||
|
||
std::vector<openstudio::LogMessage> logMessages = sink.logMessages(); | ||
|
||
std::vector<std::string> logStrings; | ||
std::transform(logMessages.cbegin(), logMessages.cend(), std::back_inserter(logStrings), | ||
[](const auto& logMessage) { return logMessage.logMessage(); }); | ||
EXPECT_EQ(0, logMessages.size()) << fmt::format("Expected no messages logged, got: {}", logStrings); | ||
} | ||
Comment on lines
+968
to
+988
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. New test. Before fix:
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just reordering things a bit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reordering is the fix?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep. auto schedule = model.alwaysOnDiscreteSchedule(); => this creates a schedule BUT also a ScheduleTypeLimits, if it wasn't instantiated already.
I put it above and not below the loop to translate all ScheduleTypeLimits.
Translating a scheduleconstant does not trigger translate of the ScheduleTypeLimits attached to it.