Skip to content

Commit

Permalink
Merge branch 'develop' into variable_speed_piu
Browse files Browse the repository at this point in the history
  • Loading branch information
lymereJ committed Dec 29, 2023
2 parents 56ac29f + dd41e28 commit ab1a6b4
Show file tree
Hide file tree
Showing 23 changed files with 2,721 additions and 240 deletions.
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ add_library(project_fp_options INTERFACE)

add_library(project_warnings INTERFACE)

add_library(turn_off_warnings INTERFACE)

set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads)
target_link_libraries(project_options INTERFACE Threads::Threads)
Expand Down Expand Up @@ -174,6 +176,7 @@ endif()

# we are making *a Python 3.6 Interpreter* a required dependency, so find it here
# If LINK_WITH_PYTHON, also request the Development (libs) at the same time, to ensure consistent version between interpreter and Development
# and ask for at least 3.8 (for the PyConfig stuff).
if(LINK_WITH_PYTHON)
# find_package(Python) has the problem that on github actions in particular it'll pick up the most recent python (eg 3.9) from the tool cache
# even if you have used the setup-python action and set it to 3.8, so we make the exact version required
Expand All @@ -184,7 +187,7 @@ if(LINK_WITH_PYTHON)
if(Python_REQUIRED_VERSION)
find_package(Python ${Python_REQUIRED_VERSION} EXACT COMPONENTS Interpreter Development REQUIRED)
else()
find_package(Python 3.6 COMPONENTS Interpreter Development REQUIRED)
find_package(Python 3.8 COMPONENTS Interpreter Development REQUIRED)
endif()
else()
find_package(Python 3.6 COMPONENTS Interpreter REQUIRED)
Expand Down
25 changes: 22 additions & 3 deletions cmake/CompilerFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ if(MSVC AND NOT ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")) # Visual C++ (VS
target_compile_options(project_options INTERFACE $<$<CONFIG:Debug>:/RTCsu>) # Runtime checks
target_compile_options(project_fp_options INTERFACE $<$<CONFIG:Debug>:/fp:strict>) # Floating point model
target_compile_options(project_options INTERFACE $<$<CONFIG:Debug>:/DMSVC_DEBUG>) # Triggers code in main.cc to catch floating point NaNs

target_compile_options(turn_off_warnings INTERFACE /W0)

elseif(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang") # g++/Clang

# TODO: after we fix all test, enable this by default on Debug builds
Expand All @@ -86,9 +89,10 @@ elseif(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" O

# COMPILER FLAGS
target_compile_options(project_options INTERFACE -pipe) # Faster compiler processing
target_compile_options(project_warnings INTERFACE -Wpedantic
)# Turn on warnings about constructs/situations that may be non-portable or outside of the standard
target_compile_options(project_warnings INTERFACE -Wall -Wextra) # Turn on warnings
target_compile_options(project_warnings INTERFACE -Wpedantic)
# Turn on warnings about constructs/situations that may be non-portable or outside of the standard
target_compile_options(project_warnings INTERFACE -Wall) # Turn on warnings
target_compile_options(project_warnings INTERFACE -Wextra) # Turn on warnings
target_compile_options(project_warnings INTERFACE -Wno-unknown-pragmas)
if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 9.0)
target_compile_options(project_warnings INTERFACE -Wno-deprecated-copy)
Expand All @@ -101,6 +105,16 @@ elseif(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" O
target_compile_options(project_warnings INTERFACE -Wno-unused-but-set-parameter -Wno-unused-but-set-variable)
target_compile_options(project_warnings INTERFACE -Wno-maybe-uninitialized)
target_compile_options(project_warnings INTERFACE -Wno-aggressive-loop-optimizations)
# Sadly, GCC 13.2 is throwing many false positives on dangling references and compile time array-bounds
# https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=6b927b1297e66e26e62e722bf15c921dcbbd25b9
# https://trofi.github.io/posts/264-gcc-s-new-Wdangling-reference-warning.html
target_compile_options(project_warnings INTERFACE -Wno-dangling-reference)
# The array-bounds appears to be problematic as well depending on the optimization level chosen
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100430
target_compile_options(project_warnings INTERFACE -Wno-array-bounds)
# depending on the level of overflow check selected, the stringop-overflow can also emit false positives
# https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wstringop-overflow
target_compile_options(project_warnings INTERFACE -Wno-stringop-overflow)
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.0)
# Suppress unused-but-set warnings until more serious ones are addressed
Expand Down Expand Up @@ -139,6 +153,8 @@ elseif(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" O
target_compile_options(project_options INTERFACE $<$<CONFIG:Release>:-fno-stack-protector>)
# ADD_CXX_RELEASE_DEFINITIONS("-Ofast") # -Ofast (or -ffast-math) needed to auto-vectorize floating point loops

target_compile_options(turn_off_warnings INTERFACE -w)

elseif(WIN32 AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")

# Disabled Warnings: Enable some of these as more serious warnings are addressed
Expand Down Expand Up @@ -192,6 +208,8 @@ elseif(WIN32 AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
target_compile_options(project_fp_options INTERFACE $<$<CONFIG:Debug>:/Qfp-stack-check>)
target_compile_options(project_options INTERFACE $<$<CONFIG:Debug>:/traceback>) # Enables traceback on error

target_compile_options(turn_off_warnings INTERFACE /w)

elseif(UNIX AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")

# Disabled Warnings: Enable some of these as more serious warnings are addressed
Expand Down Expand Up @@ -237,6 +255,7 @@ elseif(UNIX AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
target_compile_options(project_fp_options INTERFACE $<$<CONFIG:Debug>:-fp-stack-check>) # Check the floating point stack after every function call
target_compile_options(project_options INTERFACE $<$<CONFIG:Debug>:-traceback>) # Enables traceback on error

target_compile_options(turn_off_warnings INTERFACE -w)
endif() # COMPILER TYPE

# Add Color Output if Using Ninja:
Expand Down
4 changes: 2 additions & 2 deletions idd/Energy+.idd.in
Original file line number Diff line number Diff line change
Expand Up @@ -23357,7 +23357,7 @@ Daylighting:Controls,
A12, \field Daylighting Reference Point 6 Name
\type object-list
\object-list DaylightReferencePointNames
N18, \field Fraction of Zone Controlled by Reference Point 6
N18, \field Fraction of Lights Controlled by Reference Point 6
\type real
\minimum 0.0
\maximum 1.0
Expand Down Expand Up @@ -23396,7 +23396,7 @@ Daylighting:Controls,
A15, \field Daylighting Reference Point 9 Name
\type object-list
\object-list DaylightReferencePointNames
N24, \field Fraction of Zone Controlled by Reference Point 9
N24, \field Fraction of Lights Controlled by Reference Point 9
\type real
\minimum 0.0
\maximum 1.0
Expand Down
16 changes: 12 additions & 4 deletions src/EnergyPlus/HeatBalanceIntRadExchange.cc
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,7 @@ namespace HeatBalanceIntRadExchange {
// the grey interchange between surfaces in an enclosure.

// SUBROUTINE LOCAL VARIABLE DECLARATIONS:
static constexpr std::string_view RoutineName("InitInteriorRadExchange: ");
bool NoUserInputF; // Logical flag signifying no input F's for zone
bool ErrorsFound(false);
Real64 CheckValue1;
Expand Down Expand Up @@ -499,7 +500,10 @@ namespace HeatBalanceIntRadExchange {
thisEnclosure.NumOfSurfaces = numEnclosureSurfaces;
state.dataHeatBalIntRadExchg->MaxNumOfRadEnclosureSurfs =
max(state.dataHeatBalIntRadExchg->MaxNumOfRadEnclosureSurfs, numEnclosureSurfaces);
if (numEnclosureSurfaces < 1) ShowFatalError(state, "No surfaces in an enclosure in InitInteriorRadExchange");
if (numEnclosureSurfaces < 1) {
ShowSevereError(state, format("{}No surfaces in enclosure={}.", RoutineName, thisEnclosure.Name));
ErrorsFound = true;
}

// Allocate the parts of the derived type
thisEnclosure.F.dimension(numEnclosureSurfaces, numEnclosureSurfaces, 0.0);
Expand Down Expand Up @@ -767,7 +771,7 @@ namespace HeatBalanceIntRadExchange {
}

if (ErrorsFound) {
ShowFatalError(state, "InitInteriorRadExchange: Errors found during initialization of radiant exchange. Program terminated.");
ShowFatalError(state, format("{}Errors found during initialization of radiant exchange. Program terminated.", RoutineName));
}
}

Expand All @@ -778,6 +782,7 @@ namespace HeatBalanceIntRadExchange {

Array2D<Real64> SaveApproximateViewFactors; // Save for View Factor reporting
std::string Option1; // view factor report option
static constexpr std::string_view RoutineName("InitSolarViewFactors: ");

bool ErrorsFound = false;
bool ViewFactorReport = false;
Expand Down Expand Up @@ -817,7 +822,10 @@ namespace HeatBalanceIntRadExchange {
}
}
thisEnclosure.NumOfSurfaces = numEnclosureSurfaces;
if (numEnclosureSurfaces < 1) ShowFatalError(state, "No surfaces in an enclosure in InitSolarViewFactors");
if (numEnclosureSurfaces < 1) {
ShowSevereError(state, format("{}No surfaces in enclosure={}.", RoutineName, thisEnclosure.Name));
ErrorsFound = true;
}

// Allocate the parts of the derived type
thisEnclosure.F.dimension(numEnclosureSurfaces, numEnclosureSurfaces, 0.0);
Expand Down Expand Up @@ -1048,7 +1056,7 @@ namespace HeatBalanceIntRadExchange {
}

if (ErrorsFound) {
ShowFatalError(state, "InitSolarViewFactors: Errors found during initialization of diffuse solar distribution. Program terminated.");
ShowFatalError(state, format("{}Errors found during initialization of diffuse solar distribution. Program terminated.", RoutineName));
}
}

Expand Down
18 changes: 9 additions & 9 deletions src/EnergyPlus/PhaseChangeModeling/HysteresisModel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -165,14 +165,14 @@ namespace HysteresisPhaseChange {
phaseChangeState = PhaseChangeStates::FREEZING;
this->enthNew =
this->getEnthalpy(updatedTempTDT, this->peakTempFreezing, this->deltaTempFreezingLow, this->deltaTempFreezingHigh);
} else if (this->enthNew < this->enthalpyF && this->enthNew > this->enthalpyM) {
} else if ((this->enthNew < this->enthalpyF) && (this->enthNew > this->enthalpyM)) {
phaseChangeState = PhaseChangeStates::TRANSITION;
this->enthNew = (this->specHeatTransition * updatedTempTDT) + (this->enthOld - (this->specHeatTransition * prevTempTD));
} else if (this->enthNew < this->enthalpyF && updatedTempTDT > phaseChangeTempReverse) {
} else if ((this->enthNew < this->enthalpyF) && (updatedTempTDT > phaseChangeTempReverse)) {
phaseChangeState = PhaseChangeStates::TRANSITION;
this->enthNew =
(this->specHeatTransition * updatedTempTDT) + (this->enthRev - (this->specHeatTransition * phaseChangeTempReverse));
} else if (this->enthNew <= this->enthalpyM && updatedTempTDT <= phaseChangeTempReverse) {
} else if ((this->enthNew <= this->enthalpyM) && (updatedTempTDT <= phaseChangeTempReverse)) {
phaseChangeState = PhaseChangeStates::TRANSITION;
this->enthNew =
(this->specHeatTransition * updatedTempTDT) + (this->enthRev - (this->specHeatTransition * phaseChangeTempReverse));
Expand All @@ -191,11 +191,11 @@ namespace HysteresisPhaseChange {
this->enthNew = (this->specHeatTransition * updatedTempTDT) + (this->enthOld - (this->specHeatTransition * prevTempTD));
this->enthalpyM = this->getEnthalpy(updatedTempTDT, this->peakTempMelting, this->deltaTempMeltingLow, this->deltaTempMeltingHigh);
this->enthalpyF = this->getEnthalpy(updatedTempTDT, this->peakTempMelting, this->deltaTempMeltingLow, this->deltaTempMeltingHigh);
if (updatedTempTDT < phaseChangeTempReverse && this->enthNew > this->enthalpyF) {
if ((updatedTempTDT < phaseChangeTempReverse) && (this->enthNew > this->enthalpyF)) {
phaseChangeState = PhaseChangeStates::FREEZING;
this->enthNew =
this->getEnthalpy(updatedTempTDT, this->peakTempFreezing, this->deltaTempFreezingLow, this->deltaTempFreezingHigh);
} else if (this->enthNew < this->enthalpyF && this->enthNew > this->enthalpyM &&
} else if ((this->enthNew < this->enthalpyF) && (this->enthNew > this->enthalpyM) &&
(updatedTempTDT < prevTempTD || updatedTempTDT > prevTempTD)) {
phaseChangeState = PhaseChangeStates::TRANSITION;
this->enthNew =
Expand All @@ -211,7 +211,7 @@ namespace HysteresisPhaseChange {
this->enthNew = (this->specHeatTransition * updatedTempTDT) + (this->enthRev - (this->specHeatTransition * phaseChangeTempReverse));
this->enthalpyM = this->getEnthalpy(updatedTempTDT, this->peakTempMelting, this->deltaTempMeltingLow, this->deltaTempMeltingHigh);
this->enthalpyF = this->getEnthalpy(updatedTempTDT, this->peakTempFreezing, this->deltaTempFreezingLow, this->deltaTempFreezingHigh);
if (this->enthNew < this->enthalpyF && this->enthNew > this->enthalpyM) {
if ((this->enthNew < this->enthalpyF) && (this->enthNew > this->enthalpyM)) {
phaseChangeState = PhaseChangeStates::TRANSITION;
this->enthNew =
(this->specHeatTransition * updatedTempTDT) + (this->enthRev - (this->specHeatTransition * phaseChangeTempReverse));
Expand All @@ -223,14 +223,14 @@ namespace HysteresisPhaseChange {
this->enthNew = (this->specHeatTransition * updatedTempTDT) + (this->enthOld - (this->specHeatTransition * prevTempTD));
this->enthalpyM = this->getEnthalpy(updatedTempTDT, this->peakTempMelting, this->deltaTempMeltingLow, this->deltaTempMeltingHigh);
this->enthalpyF = this->getEnthalpy(updatedTempTDT, this->peakTempFreezing, this->deltaTempFreezingLow, this->deltaTempFreezingHigh);
if (this->enthNew < this->enthOld && updatedTempTDT < prevTempTD) {
if ((this->enthNew < this->enthOld) && (updatedTempTDT < prevTempTD)) {
phaseChangeState = PhaseChangeStates::TRANSITION;
this->enthNew = (this->specHeatTransition * updatedTempTDT) + (this->enthOld - (this->specHeatTransition * prevTempTD));
} else if (this->enthNew < this->enthalpyF && this->enthNew > this->enthalpyM && updatedTempTDT < prevTempTD) {
} else if ((this->enthNew < this->enthalpyF) && (this->enthNew > this->enthalpyM) && (updatedTempTDT < prevTempTD)) {
phaseChangeState = PhaseChangeStates::TRANSITION;
this->enthNew =
(this->specHeatTransition * updatedTempTDT) + (this->enthRev - (this->specHeatTransition * phaseChangeTempReverse));
} else if (this->enthNew >= this->enthalpyF && updatedTempTDT <= phaseChangeTempReverse) {
} else if ((this->enthNew >= this->enthalpyF) && (updatedTempTDT <= phaseChangeTempReverse)) {
phaseChangeState = PhaseChangeStates::TRANSITION;
this->enthNew =
(this->specHeatTransition * updatedTempTDT) + (this->enthRev - (this->specHeatTransition * phaseChangeTempReverse));
Expand Down
Loading

5 comments on commit ab1a6b4

@nrel-bot-2b
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

variable_speed_piu (lymereJ) - x86_64-Linux-Ubuntu-22.04-gcc-11.4: OK (3587 of 3587 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot-2c
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

variable_speed_piu (lymereJ) - x86_64-Linux-Ubuntu-22.04-gcc-11.4-UnitTestsCoverage-Debug: OK (1972 of 1972 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

@nrel-bot-2
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

variable_speed_piu (lymereJ) - x86_64-Linux-Ubuntu-22.04-gcc-11.4-IntegrationCoverage-Debug: OK (790 of 790 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

@nrel-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

variable_speed_piu (lymereJ) - Win64-Windows-10-VisualStudio-16: OK (2759 of 2759 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot-3
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

variable_speed_piu (lymereJ) - x86_64-MacOS-10.17-clang-14.0.0: OK (3546 of 3546 tests passed, 786 test warnings)

Messages:\n

  • 785 tests had: AUD diffs.
  • 25 tests had: MTD diffs.
  • 75 tests had: MTR small diffs.
  • 56 tests had: ESO small diffs.
  • 10 tests had: MDD diffs.

Build Badge Test Badge

Please sign in to comment.