Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/EnergyPlus/AirflowNetwork/src/Solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5066,12 +5066,12 @@ namespace AirflowNetwork {
if (simulation_control.DuctLoss) {
// Assign node num based on Distribution node
for (int i = 1; i <= AirflowNetworkNumOfLinks; ++i) {
for (int j = 1; j <= DisSysNumOfNodes; ++j) {
if (Util::SameString(AirflowNetworkLinkageData(i).NodeNames[0], DisSysNodeData(j).Name)) {
AirflowNetworkLinkageData(i).NodeNums[0] = j;
for (int k = 1; k <= DisSysNumOfNodes; ++k) {
if (Util::SameString(AirflowNetworkLinkageData(i).NodeNames[0], DisSysNodeData(k).Name)) {
AirflowNetworkLinkageData(i).NodeNums[0] = k;
}
if (Util::SameString(AirflowNetworkLinkageData(i).NodeNames[1], DisSysNodeData(j).Name)) {
AirflowNetworkLinkageData(i).NodeNums[1] = j;
if (Util::SameString(AirflowNetworkLinkageData(i).NodeNames[1], DisSysNodeData(k).Name)) {
AirflowNetworkLinkageData(i).NodeNums[1] = k;
}
}
if (AirflowNetworkLinkageData(i).NodeNums[0] == 0) {
Expand Down Expand Up @@ -11479,7 +11479,7 @@ namespace AirflowNetwork {

// Check number of fans specified in an AirLoop #6748
int BranchNum;
int NumOfFans;
int NumOfFans = 0;
std::string FanNames;
for (BranchNum = 1; BranchNum <= m_state.dataAirSystemsData->PrimaryAirSystems(1).NumBranches; ++BranchNum) {
NumOfFans = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/DataSurfaces.cc
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ Real64 SurfaceData::get_average_height(EnergyPlusData &state) const
for (Vertices::size_type i = 0; i < n; ++i) {
Vertex2D const &v(v2d[i]);

Vertex2D *v2;
Vertex2D const *v2;
if (i == n - 1) {
v2 = &v2d[0];
} else {
Expand Down
15 changes: 6 additions & 9 deletions src/EnergyPlus/DuctLoss.cc
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,11 @@ namespace DuctLoss {
state.dataDuctLoss->ductloss(DuctLossNum).CalcDuctLoss(state, DuctLossNum);
}
}
}
// Return branch leak
if (AirPathWay == AirPath::Return) {

SupplyPathUpdate(state, PathNum);
ReportDuctLoss(state);

} else if (AirPathWay == AirPath::Return) { // Return branch leak
for (int DuctLossNum = 1; DuctLossNum <= state.dataDuctLoss->NumOfDuctLosses; DuctLossNum++) {
if (state.dataDuctLoss->ductloss(DuctLossNum).LossSubType == DuctLossSubType::RetLeakBranch) {
state.dataDuctLoss->ductloss(DuctLossNum).CalcDuctLoss(state, DuctLossNum);
Expand Down Expand Up @@ -165,14 +167,9 @@ namespace DuctLoss {
state.dataDuctLoss->ductloss(DuctLossNum).CalcDuctLoss(state, DuctLossNum);
}
}
}
if (AirPathWay == AirPath::Return) {

ReturnPathUpdate(state, PathNum);
}
if (AirPathWay == AirPath::Supply) {
SupplyPathUpdate(state, PathNum);
ReportDuctLoss(state);
}
}
}

Expand Down
11 changes: 8 additions & 3 deletions src/EnergyPlus/ExternalInterface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -799,8 +799,13 @@ void InstantiateInitializeFMUImport(EnergyPlusData &state)
for (int j = 1; j <= fmu.NumInstances; ++j) {
auto &fmuInst = fmu.Instance(j);
std::string const folderStr = FileSystem::toString(fmuInst.WorkingFolder);
fmuInst.fmicomponent = fmiEPlusInstantiateSlave(
(char *)folderStr.c_str(), &fmuInst.LenWorkingFolder, &fmu.TimeOut, &fmu.Visible, &fmu.Interactive, &fmu.LoggingOn, &fmuInst.Index);
fmuInst.fmicomponent = fmiEPlusInstantiateSlave(const_cast<char *>(folderStr.c_str()),
&fmuInst.LenWorkingFolder,
&fmu.TimeOut,
&fmu.Visible,
&fmu.Interactive,
&fmu.LoggingOn,
&fmuInst.Index);
// TODO: This is doing a null pointer check; OK?
if (fmuInst.fmicomponent == nullptr) {
ShowSevereError(state, "ExternalInterface/CalcExternalInterfaceFMUImport: Error when trying to instantiate");
Expand Down Expand Up @@ -1109,7 +1114,7 @@ void InitExternalInterfaceFMUImport(EnergyPlusData &state)
std::vector<char> workingFolderArr(getCharArrayFromString(workingFolderStr));

// make the library call
fmuInst.Index = model_ID_GUID((char *)fmuInst.Name.c_str(),
fmuInst.Index = model_ID_GUID(const_cast<char *>(fmuInst.Name.c_str()),
&workingFolderArr[0],
&fmuInst.LenWorkingFolder,
&fmuInst.NumInputVariablesInFMU,
Expand Down
18 changes: 9 additions & 9 deletions src/EnergyPlus/Furnaces.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9540,15 +9540,15 @@ namespace Furnaces {
int constexpr SolveMaxIter(50);

// SUBROUTINE LOCAL VARIABLE DECLARATIONS:
Real64 mdot; // heating coil steam or hot water mass flow rate
Real64 MinWaterFlow; // coil minimum hot water mass flow rate, kg/s
Real64 MaxHotWaterFlow; // coil maximum hot water mass flow rate, kg/s
Real64 HotWaterMdot; // actual hot water mass flow rate
HVAC::CoilType CoilType = HVAC::CoilType::Invalid; // heating coil type number
int HeatingCoilIndex(0); // heating coil index
int CoilControlNode(0); // control node for hot water and steam heating coils
int CoilOutletNode(0); // air outlet node of the heating coils
PlantLocation plantLoc{}; // plant loop location
Real64 mdot; // heating coil steam or hot water mass flow rate
Real64 MinWaterFlow; // coil minimum hot water mass flow rate, kg/s
Real64 MaxHotWaterFlow; // coil maximum hot water mass flow rate, kg/s
Real64 HotWaterMdot; // actual hot water mass flow rate
HVAC::CoilType CoilType; // heating coil type number
int HeatingCoilIndex(0); // heating coil index
int CoilControlNode(0); // control node for hot water and steam heating coils
int CoilOutletNode(0); // air outlet node of the heating coils
PlantLocation plantLoc{}; // plant loop location

Real64 QActual = 0.0; // actual heating load
std::string &HeatingCoilName = state.dataFurnaces->HeatingCoilName; // name of heating coil
Expand Down
2 changes: 0 additions & 2 deletions src/EnergyPlus/HVACVariableRefrigerantFlow.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9881,8 +9881,6 @@ void SetAverageAirFlow(EnergyPlusData &state,
// could there be a reason for air loops to use inlet node flow? Possibly when VAV TUs used?
if (!vrfTu.isInOASys) {
state.dataLoopNodes->Node(InletNode).MassFlowRate = AverageUnitMassFlow;
}
if (!vrfTu.isInOASys) {
state.dataLoopNodes->Node(InletNode).MassFlowRateMaxAvail = AverageUnitMassFlow;
}
if (OutsideAirNode > 0) {
Expand Down
2 changes: 0 additions & 2 deletions src/EnergyPlus/HeatingCoils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2830,8 +2830,6 @@ namespace HeatingCoils {

heatingCoil.ParasiticFuelConsumption = heatingCoil.ParasiticFuelRate * TimeStepSysSec;

std::string coilObjClassName = std::string{HVAC::coilTypeNames[(int)heatingCoil.coilType]};

if (heatingCoil.reportCoilFinalSizes) {
if (!state.dataGlobal->WarmupFlag && !state.dataGlobal->DoingHVACSizingSimulations && !state.dataGlobal->DoingSizing) {
ReportCoilSelection::setCoilFinalSizes(
Expand Down
4 changes: 2 additions & 2 deletions src/EnergyPlus/HybridEvapCoolingModel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1945,7 +1945,7 @@ namespace HybridEvapCoolingModel {
QLatentZoneOutMass = OutletMassFlowRateDry * (InletHumRat - OutletHumRat); // Watts
QLatentZoneOut = QLatentZoneOutMass * LambdaSa;
QTotZoneOut = OutletMassFlowRateDry * (InletEnthalpy - OutletEnthalpy); // Watts
Real64 QLatentCheck = QTotZoneOut - QSensZoneOut; // Watts
// Real64 QLatentCheck = QTotZoneOut - QSensZoneOut; // Watts

// System Sensible Cooling{ W } = m'SA {kg/s} * 0.5*(cpRA + OSAF*(cpOSA-cpRA) + cpSA) {kJ/kg-C} * (T_RA + OSAF*(T_OSA - T_RA) - T_SA)
// System Latent Cooling{ W } = m'SAdryair {kg/s} * L {kJ/kgWater} * (HR_RA + OSAF *(HR_OSA - HR_RA) - HR_SA) {kgWater/kgDryAir}
Expand All @@ -1958,7 +1958,7 @@ namespace HybridEvapCoolingModel {

QLatentSystemOut = LambdaSa * OutletMassFlowRateDry * SystemTimeStepW; // Watts
QTotSystemOut = OutletMassFlowRateDry * (MixedAirEnthalpy - OutletEnthalpy); // Watts
QLatentCheck = QTotSystemOut - QSensSystemOut; // Watts
// QLatentCheck = QTotSystemOut - QSensSystemOut; // Watts

// reset outputs
ResetOutputs();
Expand Down
3 changes: 1 addition & 2 deletions src/EnergyPlus/PluginManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -473,9 +473,8 @@ void initPython(EnergyPlusData &state, fs::path const &pathToPythonPackages)
// GilGrabber is an RAII helper that will ensure we release the GIL (including if we end up throwing)
struct GilGrabber
{
GilGrabber()
GilGrabber() : gil(PyGILState_Ensure())
{
gil = PyGILState_Ensure();
}
~GilGrabber()
{
Expand Down
13 changes: 7 additions & 6 deletions src/EnergyPlus/PollutionModule.cc
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,13 @@ void SetupPollutionCalculations(EnergyPlusData &state)
// and the like are happening as expected.
OutputProcessor::ReportFreq freq = OutputProcessor::ReportFreq::Simulation;

if (!state.dataIPShortCut->lAlphaFieldBlanks(1) &&
(freq = static_cast<OutputProcessor::ReportFreq>(
getEnumValue(OutputProcessor::reportFreqNamesUC, Util::makeUPPER(state.dataIPShortCut->cAlphaArgs(1))))) ==
OutputProcessor::ReportFreq::Invalid) {
ShowSevereError(state, EnergyPlus::format("Invalid reporting frequency {}", state.dataIPShortCut->cAlphaArgs(1)));
continue;
if (!state.dataIPShortCut->lAlphaFieldBlanks(1)) {
freq = static_cast<OutputProcessor::ReportFreq>(
getEnumValue(OutputProcessor::reportFreqNamesUC, Util::makeUPPER(state.dataIPShortCut->cAlphaArgs(1))));
if (freq == OutputProcessor::ReportFreq::Invalid) {
ShowSevereError(state, EnergyPlus::format("Invalid reporting frequency {}", state.dataIPShortCut->cAlphaArgs(1)));
continue;
}
}

InitPollutionMeterReporting(state, freq);
Expand Down
24 changes: 9 additions & 15 deletions src/EnergyPlus/Psychrometrics.cc
Original file line number Diff line number Diff line change
Expand Up @@ -306,42 +306,36 @@ namespace Psychrometrics {

DISABLE_WARNING_PUSH
DISABLE_WARNING_STRICT_ALIASING
// cppcheck-suppress invalidPointerCast
std::uint64_t Tdb_tag = *reinterpret_cast<std::uint64_t const *>(&Tdb) >> Grid_Shift;
// cppcheck-suppress invalidPointerCast
std::uint64_t W_tag = *reinterpret_cast<std::uint64_t const *>(&W) >> Grid_Shift;
// cppcheck-suppress invalidPointerCast
std::uint64_t Pb_tag = *reinterpret_cast<std::uint64_t const *>(&Pb) >> Grid_Shift;
DISABLE_WARNING_POP

std::uint64_t hash = (Tdb_tag ^ (W_tag ^ Pb_tag)) & std::uint64_t(twbcache_size - 1);

auto &cached_Twb = state.dataPsychCache->cached_Twb;
auto &twb_Cache = state.dataPsychCache->cached_Twb;

if (cached_Twb[hash].iTdb != Tdb_tag || cached_Twb[hash].iW != W_tag || cached_Twb[hash].iPb != Pb_tag) {
cached_Twb[hash].iTdb = Tdb_tag;
cached_Twb[hash].iW = W_tag;
cached_Twb[hash].iPb = Pb_tag;
if (twb_Cache[hash].iTdb != Tdb_tag || twb_Cache[hash].iW != W_tag || twb_Cache[hash].iPb != Pb_tag) {
twb_Cache[hash].iTdb = Tdb_tag;
twb_Cache[hash].iW = W_tag;
twb_Cache[hash].iPb = Pb_tag;

DISABLE_WARNING_PUSH
DISABLE_WARNING_STRICT_ALIASING
Tdb_tag <<= Grid_Shift;
// cppcheck-suppress invalidPointerCast
Real64 Tdb_tag_r = *reinterpret_cast<Real64 const *>(&Tdb_tag);

W_tag <<= Grid_Shift;
// cppcheck-suppress invalidPointerCast
Real64 W_tag_r = *reinterpret_cast<Real64 const *>(&W_tag);

Pb_tag <<= Grid_Shift;
// cppcheck-suppress invalidPointerCast
Real64 Pb_tag_r = *reinterpret_cast<Real64 const *>(&Pb_tag);
DISABLE_WARNING_POP

cached_Twb[hash].Twb = PsyTwbFnTdbWPb_raw(state, Tdb_tag_r, W_tag_r, Pb_tag_r, CalledFrom);
twb_Cache[hash].Twb = PsyTwbFnTdbWPb_raw(state, Tdb_tag_r, W_tag_r, Pb_tag_r, CalledFrom);
}

return cached_Twb[hash].Twb;
return twb_Cache[hash].Twb;
}

Real64 PsyTwbFnTdbWPb_raw(EnergyPlusData &state,
Expand Down Expand Up @@ -1311,8 +1305,8 @@ namespace Psychrometrics {
// na

// FUNCTION LOCAL VARIABLE DECLARATIONS:
Real64 tSat; // Water temperature guess
int iter(0); // Iteration counter
Real64 tSat; // Water temperature guess
[[maybe_unused]] int iter(0); // Iteration counter

#ifdef EP_psych_stats
++state.dataPsychCache->NumTimesCalled[static_cast<int>(PsychrometricFunction::TsatFnPb)];
Expand Down
4 changes: 2 additions & 2 deletions src/EnergyPlus/PythonEngine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -395,10 +395,10 @@ sys.argv.append("energyplus")
for (auto &p : std::filesystem::directory_iterator(pathToPythonPackages)) {
if (p.is_directory()) {
std::string dirName = p.path().filename().string();
if (dirName.find("tcl", 0) == 0 && dirName.find('.', 0) > 0) {
if (dirName.starts_with("tcl") && dirName.find('.', 0) > 0) {
tclConfigDir = dirName;
}
if (dirName.find("tk", 0) == 0 && dirName.find('.', 0) > 0) {
if (dirName.starts_with("tk") && dirName.find('.', 0) > 0) {
tkConfigDir = dirName;
}
if (!tclConfigDir.empty() && !tkConfigDir.empty()) {
Expand Down
2 changes: 0 additions & 2 deletions src/EnergyPlus/RuntimeLanguageProcessor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3318,7 +3318,6 @@ void GetRuntimeLanguageUserInput(EnergyPlusData &state)

lbracket = index(cAlphaArgs(1), '[');
if (lbracket == std::string::npos) {
UnitsA = "";
// if (lAlphaFieldBlanks(6)) then
// CALL ShowWarningError(state, RoutineName//TRIM(cCurrentModuleObject)//'="'//TRIM(cAlphaArgs(1))//' no units
// indicated.') CALL ShowContinueError(state, '...no units indicated for this variable. [] is assumed.')
Expand Down Expand Up @@ -3494,7 +3493,6 @@ void GetRuntimeLanguageUserInput(EnergyPlusData &state)

lbracket = index(cAlphaArgs(1), '[');
if (lbracket == std::string::npos) {
UnitsA = "";
// if (lAlphaFieldBlanks(9)) then
// CALL ShowWarningError(state, RoutineName//TRIM(cCurrentModuleObject)//'="'//TRIM(cAlphaArgs(1))//' no units
// indicated.') CALL ShowContinueError(state, '...no units indicated for this variable. [] is assumed.')
Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/ScheduleManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2436,7 +2436,7 @@ namespace Sched {
int DayNum = 1;
while (DayNum <= 366) {
auto *weekSched = schedDetailed->weekScheds[DayNum];
while (schedDetailed->weekScheds[DayNum] == weekSched && DayNum <= 366) {
while (DayNum <= 366 && schedDetailed->weekScheds[DayNum] == weekSched) {
if (DayNum == 366) {
General::InvOrdinalDay(DayNum, PMon, PDay, 1);
print(state.files.eio, ThruFmt, Months[PMon - 1], PDay, weekSched->Name);
Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/SizingManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2696,7 +2696,7 @@ void GetZoneSizingInput(EnergyPlusData &state)
bool errFlag;
Array1D_string ZoneNames;
int NumZones;
int NumZoneLists;
int NumZoneLists = 0;

struct GlobalMiscObject
{
Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/SolarShading.cc
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ void InitSolarCalculations(EnergyPlusData &state)
if (state.files.outputControl.shd) {
state.dataSolarShading->shd_stream =
std::make_unique<std::fstream>(state.dataStrGlobals->outputShdFilePath, std::ios_base::out | std::ios_base::trunc);
if (!state.dataSolarShading->shd_stream) {
if (!static_cast<std::fstream *>(state.dataSolarShading->shd_stream.get())->is_open()) {
ShowFatalError(state,
EnergyPlus::format("InitSolarCalculations: Could not open file \"{}\" for output (write).",
state.dataStrGlobals->outputShdFilePath));
Expand Down
1 change: 0 additions & 1 deletion src/EnergyPlus/SurfaceGeometry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10019,7 +10019,6 @@ namespace SurfaceGeometry {
ErrorsFound = true;
}
} else if (IShadedConst > 0 && IShadingDevice > 0) {
IShadingDevice = 0;
ShowWarningError(state,
EnergyPlus::format("{}=\"{}\" Both {} and {} are specified.",
s_ipsc->cCurrentModuleObject,
Expand Down
2 changes: 0 additions & 2 deletions src/EnergyPlus/TARCOGOutput.cc
Original file line number Diff line number Diff line change
Expand Up @@ -550,8 +550,6 @@ void WriteModifiedArguments(InputOutputFile &InArgumentsFile,
for (i = 1; i <= nlayer + 1; ++i) { // loop through gaps:
if ((i > 1) && (i <= nlayer)) {
print(InArgumentsFile, Format_1111, i - 1);
}
if ((i > 1) && (i <= nlayer)) {
print(InArgumentsFile, Format_1112, gap(i - 1));
}
if (i == 1) {
Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/UnitarySystem.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15674,7 +15674,7 @@ namespace UnitarySystems {
std::string CompName; // Name of Unitary System object
Real64 SensLoad = 0.0;
Real64 LatLoad = 0.0;
HVAC::CoilType coilType = HVAC::CoilType::Invalid;
HVAC::CoilType coilType;
int CompIndex = 0;
Real64 dummy = 0.0;

Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/UtilityRoutines.hh
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ namespace Util {
template <typename Container, class = typename std::enable_if<!std::is_same<typename Container::value_type, std::string>::value>::type>
// Container needs operator[i] and value_type
inline int
FindItemInList(std::string_view const String, Container const &ListOfItems, std::string Container::value_type::*name_p, int const NumItems)
FindItemInList(std::string_view const String, Container const &ListOfItems, std::string Container::value_type::*const name_p, int const NumItems)
{
for (typename Container::size_type i = 0, e = NumItems; i < e; ++i) {
if (String == ListOfItems[i].*name_p) {
Expand Down
Loading
Loading