Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
7a0bc96
First pass, moving everything over to the new SameString definition.
GaryMarksBigladder Nov 11, 2025
9cf5041
First pass, moving everything over to the new SameString definition.
GaryMarksBigladder Nov 11, 2025
820c968
Fixing a mistake with coils
GaryMarksBigladder Nov 20, 2025
aa0160b
Made getEnumValue case insensitve, and sped up equali and SameString
GaryMarksBigladder Dec 8, 2025
01e5851
Merging in NREL/develop
GaryMarksBigladder Dec 8, 2025
9597250
Bug fix for truple casing
GaryMarksBigladder Dec 9, 2025
804c19c
Fixing an issue with Ductloss
GaryMarksBigladder Dec 9, 2025
947bccb
Adding comments
GaryMarksBigladder Dec 12, 2025
2f5859c
Fixing formatting
GaryMarksBigladder Dec 16, 2025
72fd575
Fixing unit tests
GaryMarksBigladder Dec 17, 2025
7616287
Additional formatting fixes
GaryMarksBigladder Dec 17, 2025
eb90a48
Fixing a difference in how Mac and Linux treat string pointers vs how…
GaryMarksBigladder Dec 17, 2025
632053f
Fixing a difference in how Mac and Linux treat string pointers vs how…
GaryMarksBigladder Dec 17, 2025
e581203
Fixing a difference in how Mac and Linux treat string pointers vs how…
GaryMarksBigladder Dec 17, 2025
ba11d83
Fixing additional differences in how Mac and Linux treat string point…
GaryMarksBigladder Dec 17, 2025
eaa0c2f
Changing the string conversion to uppercase to help with regression t…
GaryMarksBigladder Dec 17, 2025
88d978c
Updating empty string check to use the equals method
GaryMarksBigladder Dec 18, 2025
09a9d0c
Merge branch 'develop' into Refactor-9183-SameString
GaryMarksBigladder Dec 22, 2025
99a2cdb
Clang formatting
GaryMarksBigladder Dec 22, 2025
32ba482
Fixing a mac/linux/windows compiler difference
GaryMarksBigladder Dec 22, 2025
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
37 changes: 19 additions & 18 deletions src/EnergyPlus/AirLoopHVACDOAS.cc
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,8 @@ namespace AirLoopHVACDOAS {

int index = -1;
std::size_t loop = 0;
for (const auto &thisAirLoopMixerObject : state.dataAirLoopHVACDOAS->airloopMixer) {
if (Util::SameString(objectName, thisAirLoopMixerObject.name)) {
for (auto &thisAirLoopMixerObject : state.dataAirLoopHVACDOAS->airloopMixer) {
if (Util::SameString(thisAirLoopMixerObject.name, objectName)) {
index = static_cast<int>(loop);
return index;
}
Expand Down Expand Up @@ -367,8 +367,8 @@ namespace AirLoopHVACDOAS {

int index = -1;
std::size_t loop = 0;
for (const auto &thisAirLoopSplitterObj : state.dataAirLoopHVACDOAS->airloopSplitter) {
if (Util::SameString(objectName, thisAirLoopSplitterObj.name)) {
for (auto &thisAirLoopSplitterObj : state.dataAirLoopHVACDOAS->airloopSplitter) {
if (Util::SameString(thisAirLoopSplitterObj.name, objectName)) {
index = static_cast<int>(loop);
return index;
}
Expand Down Expand Up @@ -505,14 +505,17 @@ namespace AirLoopHVACDOAS {
CurrentModuleObject = "AirLoopHVAC:OutdoorAirSystem:EquipmentList";
int CoolingCoilOrder = 0;
int FanOrder = 0;
std::string coilCoolingWater = "COIL:COOLING:WATER";
std::string coilHeatingWater = "Coil:Heating:Water";
std::string coilCoolingWaterDetailedGeometry = "Coil : Cooling : Water : DetailedGeometry";
for (int CompNum = 1; CompNum <= thisOutsideAirSys.NumComponents; ++CompNum) {
std::string const &CompType = thisOutsideAirSys.ComponentType(CompNum);
std::string const &CompName = thisOutsideAirSys.ComponentName(CompNum);
std::string &CompType = thisOutsideAirSys.ComponentType(CompNum);
std::string &CompName = thisOutsideAirSys.ComponentName(CompNum);

bool InletNodeErrFlag = false;
bool OutletNodeErrFlag = false;

const std::string typeNameUC = Util::makeUPPER(thisOutsideAirSys.ComponentType(CompNum));
std::string typeNameUC = Util::makeUPPER(thisOutsideAirSys.ComponentType(CompNum));
switch (static_cast<ValidEquipListType>(getEnumValue(validEquipNamesUC, typeNameUC))) {
case ValidEquipListType::OutdoorAirMixer:
case ValidEquipListType::FanConstantVolume:
Expand Down Expand Up @@ -560,7 +563,7 @@ namespace AirLoopHVACDOAS {
case ValidEquipListType::CoilCoolingWater:
thisOutsideAirSys.InletNodeNum(CompNum) = WaterCoils::GetCoilInletNode(state, typeNameUC, CompName, InletNodeErrFlag);
thisOutsideAirSys.OutletNodeNum(CompNum) = WaterCoils::GetCoilOutletNode(state, typeNameUC, CompName, OutletNodeErrFlag);
thisDOAS.CWCtrlNodeNum = WaterCoils::GetCoilWaterInletNode(state, "COIL:COOLING:WATER", CompName, errorsFound);
thisDOAS.CWCtrlNodeNum = WaterCoils::GetCoilWaterInletNode(state, coilCoolingWater, CompName, errorsFound);
if (errorsFound) {
ShowContinueError(state, format("The control node number is not found in {} = {}", CurrentModuleObject, CompName));
}
Expand All @@ -576,7 +579,7 @@ namespace AirLoopHVACDOAS {
case ValidEquipListType::CoilHeatingWater:
thisOutsideAirSys.InletNodeNum(CompNum) = WaterCoils::GetCoilInletNode(state, typeNameUC, CompName, InletNodeErrFlag);
thisOutsideAirSys.OutletNodeNum(CompNum) = WaterCoils::GetCoilOutletNode(state, typeNameUC, CompName, OutletNodeErrFlag);
thisDOAS.HWCtrlNodeNum = WaterCoils::GetCoilWaterInletNode(state, "Coil:Heating:Water", CompName, errorsFound);
thisDOAS.HWCtrlNodeNum = WaterCoils::GetCoilWaterInletNode(state, coilHeatingWater, CompName, errorsFound);
if (errorsFound) {
ShowContinueError(state, format("The control node number is not found in {} = {}", CurrentModuleObject, CompName));
}
Expand All @@ -596,8 +599,7 @@ namespace AirLoopHVACDOAS {
case ValidEquipListType::CoilCoolingWaterDetailedGeometry:
thisOutsideAirSys.InletNodeNum(CompNum) = WaterCoils::GetCoilInletNode(state, typeNameUC, CompName, InletNodeErrFlag);
thisOutsideAirSys.OutletNodeNum(CompNum) = WaterCoils::GetCoilOutletNode(state, typeNameUC, CompName, OutletNodeErrFlag);
thisDOAS.CWCtrlNodeNum =
WaterCoils::GetCoilWaterInletNode(state, "Coil:Cooling:Water:DetailedGeometry", CompName, errorsFound);
thisDOAS.CWCtrlNodeNum = WaterCoils::GetCoilWaterInletNode(state, coilCoolingWaterDetailedGeometry, CompName, errorsFound);
if (errorsFound) {
ShowContinueError(state, format("The control node number is not found in {} = {}", CurrentModuleObject, CompName));
}
Expand Down Expand Up @@ -844,7 +846,7 @@ namespace AirLoopHVACDOAS {

// Check valid OA controller
for (int OASysNum = 1; OASysNum <= state.dataAirLoop->NumOASystems; OASysNum++) {
if (Util::SameString(state.dataAirLoop->OutsideAirSys(OASysNum).ControllerListName, "")) {
if (state.dataAirLoop->OutsideAirSys(OASysNum).ControllerListName == "") {
if (state.dataAirLoop->OutsideAirSys(OASysNum).AirLoopDOASNum == -1) {
ShowSevereError(state,
format(R"(AirLoopHVAC:OutdoorAirSystem = "{}" invalid Controller List Name = " not found.)",
Expand All @@ -867,8 +869,8 @@ namespace AirLoopHVACDOAS {
bool ErrorsFound = false;
Real64 rho;
for (int CompNum = 1; CompNum <= state.dataAirLoop->OutsideAirSys(this->m_OASystemNum).NumComponents; ++CompNum) {
std::string const &CompType = state.dataAirLoop->OutsideAirSys(this->m_OASystemNum).ComponentType(CompNum);
std::string const &CompName = state.dataAirLoop->OutsideAirSys(this->m_OASystemNum).ComponentName(CompNum);
std::string &CompType = state.dataAirLoop->OutsideAirSys(this->m_OASystemNum).ComponentType(CompNum);
std::string &CompName = state.dataAirLoop->OutsideAirSys(this->m_OASystemNum).ComponentName(CompNum);
if (Util::SameString(CompType, "FAN:SYSTEMMODEL")) {
state.dataFans->fans(this->m_FanIndex)->simulate(state, FirstHVACIteration);
}
Expand All @@ -878,7 +880,7 @@ namespace AirLoopHVACDOAS {

if (Util::SameString(CompType, "COIL:HEATING:WATER")) {
WaterCoils::SimulateWaterCoilComponents(state, CompName, FirstHVACIteration, this->m_HeatCoilNum);
Real64 const CoilMaxVolFlowRate = WaterCoils::GetCoilMaxWaterFlowRate(state, "Coil:Heating:Water", CompName, ErrorsFound);
Real64 const CoilMaxVolFlowRate = WaterCoils::GetCoilMaxWaterFlowRate(state, CompType, CompName, ErrorsFound);
rho = state.dataPlnt->PlantLoop(this->HWPlantLoc.loopNum).glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName);
PlantUtilities::InitComponentNodes(state,
0.0,
Expand All @@ -888,7 +890,7 @@ namespace AirLoopHVACDOAS {
}
if (Util::SameString(CompType, "COIL:COOLING:WATER")) {
WaterCoils::SimulateWaterCoilComponents(state, CompName, FirstHVACIteration, this->m_CoolCoilNum);
Real64 const CoilMaxVolFlowRate = WaterCoils::GetCoilMaxWaterFlowRate(state, "Coil:Cooling:Water", CompName, ErrorsFound);
Real64 const CoilMaxVolFlowRate = WaterCoils::GetCoilMaxWaterFlowRate(state, CompType, CompName, ErrorsFound);
rho = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName);
PlantUtilities::InitComponentNodes(state,
0.0,
Expand All @@ -898,8 +900,7 @@ namespace AirLoopHVACDOAS {
}
if (Util::SameString(CompType, "COIL:COOLING:WATER:DETAILEDGEOMETRY")) {
WaterCoils::SimulateWaterCoilComponents(state, CompName, FirstHVACIteration, this->m_CoolCoilNum);
Real64 const CoilMaxVolFlowRate =
WaterCoils::GetCoilMaxWaterFlowRate(state, "Coil:Cooling:Water:DetailedGeometry", CompName, ErrorsFound);
Real64 const CoilMaxVolFlowRate = WaterCoils::GetCoilMaxWaterFlowRate(state, CompType, CompName, ErrorsFound);
rho = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName);
PlantUtilities::InitComponentNodes(state,
0.0,
Expand Down
14 changes: 7 additions & 7 deletions src/EnergyPlus/AirflowNetwork/src/Solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2284,11 +2284,11 @@ namespace AirflowNetwork {
cNumericFields);

simulation_control.ductSizing.name = Alphas(1);
if (Util::SameString(Alphas(2), Util::makeUPPER("MaximumVelocity"))) {
if (Util::SameString(Alphas(2), "MaximumVelocity")) {
simulation_control.ductSizing.method = DuctSizingMethod::MaxVelocity;
} else if (Util::SameString(Alphas(2), Util::makeUPPER("PressureLoss"))) {
} else if (Util::SameString(Alphas(2), "PressureLoss")) {
simulation_control.ductSizing.method = DuctSizingMethod::PressureLoss;
} else if (Util::SameString(Alphas(2), Util::makeUPPER("PressureLossWithMaximumVelocity"))) {
} else if (Util::SameString(Alphas(2), "PressureLossWithMaximumVelocity")) {
simulation_control.ductSizing.method = DuctSizingMethod::VelocityAndLoss;
} else {
ShowSevereError(m_state, format("{} {} object, {} = {} is invalid.", RoutineName, CurrentModuleObject, cAlphaFields(2), Alphas(2)));
Expand Down Expand Up @@ -3961,7 +3961,7 @@ namespace AirflowNetwork {
// Avoid duplication of EPlusName
if (!simulation_control.DuctLoss) {
for (int j = 1; j < i; ++j) {
if (!Util::SameString(Alphas(2), "")) {
if (Alphas(2) != "") {
if (Util::SameString(DisSysNodeData(j).EPlusName, Alphas(2))) {
ShowSevereError(m_state,
format(RoutineName) + CurrentModuleObject + "=\"" + Alphas(1) + "\" Duplicated " + cAlphaFields(2) +
Expand Down Expand Up @@ -10374,12 +10374,12 @@ namespace AirflowNetwork {
}
// Validate EPlus Node names and types
for (int i = 1; i <= DisSysNumOfNodes; ++i) {
if (Util::SameString(DisSysNodeData(i).EPlusName, "") || Util::SameString(DisSysNodeData(i).EPlusName, "Other")) {
if (DisSysNodeData(i).EPlusName.empty() || Util::SameString(DisSysNodeData(i).EPlusName, "Other")) {
continue;
}
LocalError = false;
for (int j = 1; j <= m_state.dataLoopNodes->NumOfNodes; ++j) { // NodeID
if (DisSysNodeData(i).EPlusName == m_state.dataLoopNodes->NodeID(j)) {
if (equali(DisSysNodeData(i).EPlusName, m_state.dataLoopNodes->NodeID(j))) {
DisSysNodeData(i).AirLoopNum = get_airloop_number(j);
if (DisSysNodeData(i).AirLoopNum == 0) {
ShowSevereError(m_state,
Expand Down Expand Up @@ -12123,7 +12123,7 @@ namespace AirflowNetwork {
if (m_state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(NumOfComp).NumSubComps == 0) {
DataLoopNode::ConnectionObjectType TypeOfComp = static_cast<DataLoopNode::ConnectionObjectType>(EnergyPlus::getEnumValue(
BranchNodeConnections::ConnectionObjectTypeNamesUC,
m_state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(NumOfComp).TypeOf));
Util::makeUPPER(m_state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(NumOfComp).TypeOf)));
std::string const &NameOfComp =
m_state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(NumOfComp).Name;
if (IsParentObject(m_state, TypeOfComp, NameOfComp)) {
Expand Down
4 changes: 2 additions & 2 deletions src/EnergyPlus/Autosizing/Base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ void BaseSizer::select2StgDXHumCtrlSizerOutput(EnergyPlusData &state, bool &erro
}
}

bool BaseSizer::isValidCoilType(std::string const &_compType)
bool BaseSizer::isValidCoilType(std::string &_compType)
{
int coilNum = 0;
for (auto const &coilType : HVAC::cAllCoilTypes) {
Expand All @@ -619,7 +619,7 @@ bool BaseSizer::isValidCoilType(std::string const &_compType)
return false;
}

bool BaseSizer::isValidFanType(std::string const &_compType)
bool BaseSizer::isValidFanType(std::string &_compType)
{
// if compType name is one of the fan objects, then return true
if (Util::SameString(_compType, "Fan:SystemModel")) {
Expand Down
4 changes: 2 additions & 2 deletions src/EnergyPlus/Autosizing/Base.hh
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,9 @@ protected:

void select2StgDXHumCtrlSizerOutput(EnergyPlusData &state, bool &errorsFound);

bool isValidCoilType(std::string const &compType);
bool isValidCoilType(std::string &compType);

bool isValidFanType(std::string const &compType);
bool isValidFanType(std::string &compType);

bool checkInitialized(EnergyPlusData &state, bool &errorsFound);

Expand Down
3 changes: 2 additions & 1 deletion src/EnergyPlus/BoilerSteam.cc
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,8 @@ namespace BoilerSteam {
thisBoiler.Name = state.dataIPShortCut->cAlphaArgs(1);

// Validate fuel type input
thisBoiler.FuelType = static_cast<Constant::eFuel>(getEnumValue(Constant::eFuelNamesUC, state.dataIPShortCut->cAlphaArgs(2)));
thisBoiler.FuelType =
static_cast<Constant::eFuel>(getEnumValue(Constant::eFuelNamesUC, Util::makeUPPER(state.dataIPShortCut->cAlphaArgs(2))));

// INPUTS from the IDF file
thisBoiler.BoilerMaxOperPress = state.dataIPShortCut->rNumericArgs(1);
Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/Boilers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ void GetBoilerInput(EnergyPlusData &state)
thisBoiler.Type = DataPlant::PlantEquipmentType::Boiler_Simple;

// Validate fuel type input
thisBoiler.FuelType = static_cast<Constant::eFuel>(getEnumValue(Constant::eFuelNamesUC, s_ipsc->cAlphaArgs(2)));
thisBoiler.FuelType = static_cast<Constant::eFuel>(getEnumValue(Constant::eFuelNamesUC, Util::makeUPPER(s_ipsc->cAlphaArgs(2))));

thisBoiler.NomCap = s_ipsc->rNumericArgs(1);
if (s_ipsc->rNumericArgs(1) == 0.0) {
Expand Down
18 changes: 9 additions & 9 deletions src/EnergyPlus/BranchInputManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -367,8 +367,8 @@ namespace BranchInputManager {
} else {
for (BranchNum = 1; BranchNum <= NumBranches; ++BranchNum) {
for (CompNum = 1; CompNum <= state.dataBranchInputManager->Branch(BranchNum).NumOfComponents; ++CompNum) {
if (Util::SameString(CompType, state.dataBranchInputManager->Branch(BranchNum).Component(CompNum).CType) &&
Util::SameString(CompName, state.dataBranchInputManager->Branch(BranchNum).Component(CompNum).Name)) {
if (Util::SameString(state.dataBranchInputManager->Branch(BranchNum).Component(CompNum).CType, CompType) &&
Util::SameString(state.dataBranchInputManager->Branch(BranchNum).Component(CompNum).Name, CompName)) {
GetAirBranchIndex = BranchNum;
goto BranchLoop_exit;
}
Expand Down Expand Up @@ -421,10 +421,10 @@ namespace BranchInputManager {
} else {
if (BranchNum > 0 && BranchNum <= NumBranches) {
for (CompNum = 1; CompNum <= state.dataBranchInputManager->Branch(BranchNum).NumOfComponents; ++CompNum) {
if (Util::SameString("Fan:OnOff", state.dataBranchInputManager->Branch(BranchNum).Component(CompNum).CType) ||
Util::SameString("Fan:ConstantVolume", state.dataBranchInputManager->Branch(BranchNum).Component(CompNum).CType) ||
Util::SameString("Fan:VariableVolume", state.dataBranchInputManager->Branch(BranchNum).Component(CompNum).CType) ||
Util::SameString("Fan:SystemModel", state.dataBranchInputManager->Branch(BranchNum).Component(CompNum).CType)) {
if (Util::SameString(state.dataBranchInputManager->Branch(BranchNum).Component(CompNum).CType, "Fan:OnOff") ||
Util::SameString(state.dataBranchInputManager->Branch(BranchNum).Component(CompNum).CType, "Fan:ConstantVolume") ||
Util::SameString(state.dataBranchInputManager->Branch(BranchNum).Component(CompNum).CType, "Fan:VariableVolume") ||
Util::SameString(state.dataBranchInputManager->Branch(BranchNum).Component(CompNum).CType, "Fan:SystemModel")) {
FanType = state.dataBranchInputManager->Branch(BranchNum).Component(CompNum).CType;
FanName = state.dataBranchInputManager->Branch(BranchNum).Component(CompNum).Name;
break;
Expand Down Expand Up @@ -1093,7 +1093,7 @@ namespace BranchInputManager {
void GetSingleBranchInput(EnergyPlusData &state,
std::string_view const RoutineName,
int const BCount,
Array1D_string const &Alphas,
Array1D_string &Alphas,
Array1D_string const &cAlphaFields,
int const NumAlphas,
Array1D_int &NodeNums,
Expand Down Expand Up @@ -2460,8 +2460,8 @@ namespace BranchInputManager {
std::string FoundBranchName;
if (present(CompType) && present(CompName)) {
for (CpN = 1; CpN <= state.dataBranchInputManager->Branch(BrN).NumOfComponents; ++CpN) {
if (!Util::SameString(CompType(), state.dataBranchInputManager->Branch(BrN).Component(CpN).CType) ||
!Util::SameString(CompName(), state.dataBranchInputManager->Branch(BrN).Component(CpN).Name)) {
if (!Util::SameString(state.dataBranchInputManager->Branch(BrN).Component(CpN).CType, CompType()) ||
!Util::SameString(state.dataBranchInputManager->Branch(BrN).Component(CpN).Name, CompName())) {
continue;
}
FoundBranchName = state.dataBranchInputManager->Branch(BrN).Name;
Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/BranchInputManager.hh
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ namespace BranchInputManager {
void GetSingleBranchInput(EnergyPlusData &state,
std::string_view RoutineName,
int BCount,
Array1D_string const &Alphas,
Array1D_string &Alphas,
Array1D_string const &cAlphaFields,
int NumAlphas,
Array1D_int &NodeNums,
Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/CTElectricGenerator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ namespace CTElectricGenerator {

// Validate fuel type input
state.dataCTElectricGenerator->CTGenerator(genNum).FuelType =
static_cast<Constant::eFuel>(getEnumValue(Constant::eFuelNamesUC, AlphArray(11)));
static_cast<Constant::eFuel>(getEnumValue(Constant::eFuelNamesUC, Util::makeUPPER(AlphArray(11))));
if (state.dataCTElectricGenerator->CTGenerator(genNum).FuelType == Constant::eFuel::Invalid) {
ShowSevereError(state, format("Invalid {}={}", state.dataIPShortCut->cAlphaFieldNames(11), AlphArray(11)));
ShowContinueError(state, format("Entered in {}={}", state.dataIPShortCut->cCurrentModuleObject, AlphArray(1)));
Expand Down
Loading
Loading