Skip to content

Conversation

@amirroth
Copy link
Collaborator

@amirroth amirroth commented Apr 21, 2025

Pull request overview

This PR cleans up use of enumerations and propagates use of getEnumValue to about eight modules, strategically chosen to not conflict with the parallel CoilAPI branch.

One of the modules is EconomicTariff which required (or at least underwent) a slight refactor to eliminate a bad idiom in which an integer is treated as a different type depending on its value, either an operation enumeration (negative), an end-of-line indictor (zero), or an index into an array of variables (positive). This is not a transparent or type safe idiom. A better way (in my opinion at least) is an enumeration that defines the actual use (operation enumeration, end-of-line, variable index) and then additional fields to define the operation enumeration and variable index, which can be constrained conventionally (e.g., an enumeration can only have the defined values, a variable index of 0 or -1 indicates that the index is not initialized or was not found). Clarity and type safety are more important than space saving in this case (and probably in most cases).

The lone diff is an error message which is modified because we are using the ShowSevereInvalidKey wrapper as opposed to an ad hoc message.

@amirroth amirroth added DoNotPublish Includes changes that shouldn't be reported in the changelog Refactoring Includes code changes that don't change the functionality of the program, just perform refactoring labels Apr 21, 2025
@amirroth amirroth added this to the EnergyPlus 25.2 milestone Apr 21, 2025
@github-actions
Copy link

⚠️ Regressions detected on macos-14 for commit 3c17cd0

Regression Summary
  • Table String Diffs: 32
  • Audit: 89
  • Table Big Diffs: 2
  • ERR: 1

@github-actions
Copy link

⚠️ Regressions detected on macos-14 for commit 2fdf056

Regression Summary
  • Table String Diffs: 32
  • ERR: 1

@github-actions
Copy link

⚠️ Regressions detected on macos-14 for commit 84fc607

Regression Summary
  • Table String Diffs: 1
  • ERR: 1

@github-actions
Copy link

⚠️ Regressions detected on macos-14 for commit baa84b8

Regression Summary
  • Table String Diffs: 1
  • ERR: 1

@github-actions
Copy link

⚠️ Regressions detected on macos-14 for commit 786e438

Regression Summary
  • ERR: 1

Copy link
Contributor

@JasonGlazer JasonGlazer left a comment

Choose a reason for hiding this comment

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

I walked through your changes and then the clean code and it all looks good. This was a big refactor. I think the addition of using StepType and separating out the operators and variable and EOL makes a lot of sense.

Code you didn't touch in EconomicTariff.unit.cc has some weird spurious lines with just a semicolon (see 348, 389, 598, 648, 674).

I didn't run any test cases but you were finding no diffs so that is good enough for me.

Thanks for taking such a careful look at all of this and getting rid of some of the FORTRAN-like code.

tariff.firstCategory = tariff.cats[(int)Cat::EnergyCharges];
tariff.lastCategory = tariff.cats[(int)Cat::NotIncluded];

// category variables first
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks like an old error of mine but the comment really should say "native variables next"

WaterInReformAirNode,
WaterInReformWaterNode,
WaterInReformSchedule,
Mains,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

enum class is a scope. No need to have the same words in both the type name and the type value.

struct PhotovoltaicsData : BaseGlobalStruct
{

std::string const cPVGeneratorObjectName = "Generator:Photovoltaic";
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

These can be constexpr std::string_views in the .cc file. Don't need to be member string objects.

Copy link
Member

Choose a reason for hiding this comment

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

😊

constexpr std::array<std::string_view, (int)AverageMethod::Num> averageMethodNamesUC = {
"NOMULTIPLEPEOPLEOBJECTS", "SPECIFICOBJECT", "OBJECTAVERAGE", "PEOPLEAVERAGE" };

enum class TempCtrl
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This three-way option was previously implemented using two bool, whether there is operative temperature control and whether that control is constant or scheduled. A three-value enum is a cleaner way to do this.

bool HeatOffFlag; // Heating off flag

// Default Constructor
ZoneTempControls()
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Are we still using these constructors? I'm moving away from them incrementally, but should be do a cleanup pass?

Copy link
Member

Choose a reason for hiding this comment

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

If an empty signature constructor isn't doing anything but assigning the values to the member variables directly, then yeah, let's get rid of them. A dedicated pass is fine, and it should be fairly easy to detect them. In fact, a very quick script resulted in the following list of "empty" constructors, which may not be 100% accurate, but my spot checks seem to indicate it is close, with an estimate of 344 to clean up:

Branch.hh (1)
  • BranchData
CTElectricGenerator.hh (1)
  • CTGeneratorData
CallingOrder.hh (1)
  • PlantCallingOrderInfoStruct
Component.hh (1)
  • CompData
ConnectedLoopData.hh (1)
  • ConnectedLoopData
Connection.hh (1)
  • PlantConnection
CostEstimateManager.hh (2)
  • CostAdjustmentStruct
  • monetaryUnitType
DXCoils.hh (3)
  • DXCoilData
  • PerfModeData
  • DXCoilNumericFieldData
DataBSDFWindow.hh (1)
  • BSDFDaylghtPosition
DataDaylightingDevices.hh (1)
  • TDDPipeData
DataDefineEquip.hh (1)
  • ZoneAirEquip
DataGenerators.hh (1)
  • GeneratorFuelSupplyDataStruct
DataHVACSystems.hh (1)
  • HVACSystemData
DataHeatBalance.hh (4)
  • ZoneResilience
  • ZoneData
  • ZoneListData
  • ExtVentedCavityStruct
DataPhotovoltaics.hh (8)
  • SimplePVParamsStruct
  • TRNSYSPVModuleParamsStruct
  • TRNSYSPVCalcStruct
  • SNLModuleParamsStuct
  • SNLPVInputStruct
  • SNLPVCalcStruct
  • PVReportVariables
  • PVArrayStruct
DataRootFinder.hh (3)
  • ControlsType
  • PointType
  • RootFinderDataType
DataRuntimeLanguage.hh (12)
  • OutputVarSensorType
  • InternalVarsAvailableType
  • InternalVarsUsedType
  • EMSActuatorAvailableType
  • ActuatorUsedType
  • EMSProgramCallManagementType
  • ErlValueType
  • ErlVariableType
  • InstructionType
  • ErlStackType
  • ErlExpressionType
  • TrendVariableType
DataShadowingCombinations.hh (1)
  • ShadowingCombinations
DataSizing.hh (8)
  • TermUnitSizingData
  • ZoneEqSizingData
  • ZoneHVACSizingData
  • AirTerminalSizingSpecData
  • SysSizPeakDDNumData
  • FacilitySizingData
  • CompDesWaterFlowData
  • ZoneAirDistributionData
DataSurfaceLists.hh (2)
  • SurfaceListData
  • SlabListData
DataSurfaces.hh (9)
  • Surface2D
  • SurfaceData
  • FrameDividerProperties
  • StormWindowData
  • OSCData
  • OSCMData
  • ShadingVertexData
  • FenestrationSolarAbsorbed
  • IntMassObject
DataWater.hh (5)
  • StorageTankDataStruct
  • RainfallCollectorDataStruct
  • GroundwaterWellDataStruct
  • SiteRainFallDataStruct
  • IrrigationDataStruct
DataWindowEquivalentLayer.hh (6)
  • CFSLWP
  • CFSSWP
  • CFSLAYER
  • CFSFILLGAS
  • CFSGAP
  • CFSTY
DataZoneControls.hh (5)
  • ZoneTempControls
  • ZoneHumidityControls
  • ZoneComfortControls
  • ZoneStagedControls
  • TStatObject
DataZoneEquipment.hh (7)
  • SubSubEquipmentData
  • SubEquipmentData
  • AirIn
  • EquipConfiguration
  • EquipmentData
  • ControlList
  • SupplyAir
DemandManager.hh (3)
  • DemandManagerListData
  • DemandManagerData
  • DemandManagerData
DesiccantDehumidifiers.hh (1)
  • DesiccantDehumidifierData
EconomicLifeCycleCost.hh (3)
  • RecurringCostsType
  • NonrecurringCostType
  • CashFlowType
EconomicTariff.hh (8)
  • EconVarType
  • TariffType
  • QualifyType
  • ChargeSimpleType
  • ChargeBlockType
  • RatchetType
  • ComputationType
  • StackType
ElectricBaseboardRadiator.hh (1)
  • ElecBaseboardNumericFieldData
ElectricPowerServiceManager.hh (2)
  • ElectricPowerServiceManager
  • ElectricPowerServiceManager
EquipAndOperations.hh (5)
  • EquipListPtrData
  • OpSchemePtrData
  • EquipListCompData
  • EquipOpList
  • OperationData
EvaporativeCoolers.hh (2)
  • EvapConditions
  • ZoneEvapCoolerUnitStruct
ExteriorEnergyUse.hh (2)
  • ExteriorLightUsage
  • ExteriorEquipmentUsage
ExternalInterface.hh (8)
  • fmuInputVariableType
  • checkFMUInstanceNameType
  • eplusOutputVariableType
  • fmuOutputVariableScheduleType
  • fmuOutputVariableVariableType
  • fmuOutputVariableActuatorType
  • eplusInputVariableVariableType
  • eplusInputVariableActuatorType
Fans.hh (3)
  • FanBase
  • FanSystem
  • FanSystem
FaultsManager.hh (12)
  • FaultPropertiesEconomizer
  • FaultPropertiesThermostat
  • FaultPropertiesHumidistat
  • FaultPropertiesFoulingCoil
  • FaultPropertiesCoilSAT
  • FaultPropertiesChillerSWT
  • FaultPropertiesCondenserSWT
  • FaultPropertiesTowerFouling
  • FaultPropertiesFouling
  • FaultPropertiesBoilerFouling
  • FaultPropertiesChillerFouling
  • FaultPropertiesEvapCoolerFouling
FluidCoolers.hh (1)
  • FluidCoolerspecs
FuelCellElectricGenerator.hh (11)
  • FCPowerModuleStruct
  • FCAirSupplyDataStruct
  • FCWaterSupplyDataStruct
  • FCAuxilHeatDataStruct
  • FCExhaustHXDataStruct
  • BatteryDichargeDataStruct
  • FCElecStorageDataStruct
  • FCInverterDataStruct
  • FCReportDataStruct
  • FCStackCoolerDataStruct
  • FCDataStruct
Furnaces.hh (1)
  • FurnaceEquipConditions
GroundHeatExchangers.hh (10)
  • ThermophysicalProps
  • PipeProps
  • GLHEVertProps
  • MyCartesian
  • GLHEVertSingle
  • GLHEVertArray
  • GLHEResponseFactors
  • GLHEBase
  • GLHEVert
  • GLHESlinky
HVACControllers.hh (1)
  • ControllerPropsType
HVACCooledBeam.hh (1)
  • CoolBeamData
HVACDXHeatPumpSystem.hh (1)
  • DXHeatPumpSystemStruct
HVACDuct.hh (1)
  • DuctData
HVACFourPipeBeam.hh (2)
  • HVACFourPipeBeam
  • HVACFourPipeBeam
HVACHXAssistedCoolingCoil.hh (1)
  • HXAssistedCoilParameters
HVACMultiSpeedHeatPump.hh (2)
  • MSHeatPumpData
  • MSHeatPumpReportData
HVACSingleDuctInduc.hh (1)
  • IndUnitData
HVACStandAloneERV.hh (1)
  • StandAloneERVData
HVACVariableRefrigerantFlow.hh (2)
  • VRFCondenserEquipment
  • TerminalUnitListData
HWBaseboardRadiator.hh (2)
  • HWBaseboardNumericFieldData
  • HWBaseboardDesignNumericFieldData
HeatBalFiniteDiffManager.hh (4)
  • ConstructionDataFD
  • MaterialActuatorData
  • SurfaceDataFD
  • MaterialDataFD
HeatBalanceHAMTManager.hh (1)
  • subcell
HeatBalanceManager.hh (1)
  • WarmupConvergence
HeatPumpWaterToWaterCOOLING.hh (1)
  • GshpPeCoolingSpecs
HeatPumpWaterToWaterHEATING.hh (1)
  • GshpPeHeatingSpecs
HeatPumpWaterToWaterSimple.hh (1)
  • GshpSpecs
HighTempRadiantSystem.hh (3)
  • HighTempRadiantSystemData
  • HighTempRadSysNumericFieldData
  • HighTempRadiantSystemData
Humidifiers.hh (1)
  • HumidifierData
HybridEvapCoolingModel.hh (2)
  • CSetting
  • CStepInputs
ICEngineElectricGenerator.hh (1)
  • ICEngineGeneratorSpecs
IceThermalStorage.hh (2)
  • SimpleIceStorageData
  • DetailedIceStorageData
IntegratedHeatPump.hh (1)
  • IntegratedHeatPumpData
Loop.hh (1)
  • PlantLoopData
LoopSide.hh (1)
  • HalfLoopData
LoopSidePumpInformation.hh (1)
  • LoopSidePumpInformation
MatrixDataManager.hh (1)
  • MatrixDataStruct
MeterData.hh (1)
  • MeterData
MicroCHPElectricGenerator.hh (2)
  • MicroCHPParamsNonNormalized
  • MicroCHPDataStruct
MicroturbineElectricGenerator.hh (1)
  • MTGeneratorSpecs
MixerComponent.hh (1)
  • MixerConditions
MixerData.hh (1)
  • MixerData
MoistureBalanceEMPDManager.hh (1)
  • EMPDReportVarsData
NodeInputManager.hh (1)
  • NodeListDef
OutdoorAirUnit.hh (2)
  • OAEquipList
  • OAUnitData
OutputProcessor.hh (1)
  • OutVar
OutputReportData.hh (1)
  • AnnualFieldSet
OutputReportPredefined.hh (6)
  • reportNameType
  • SubTableType
  • ColumnTagType
  • TableEntryType
  • CompSizeTableEntryType
  • ShadowRelateType
OutputReportTabular.hh (10)
  • BinResultsType
  • BinObjVarIDType
  • BinStatisticsType
  • NamedMonthlyType
  • MonthlyFieldSetInputType
  • MonthlyTablesType
  • MonthlyColumnsType
  • TOCEntriesType
  • UnitConvType
  • ZompComponentAreasType
OutputReportTabularAnnual.hh (2)
  • AnnualTable
  • AnnualTable
PackagedThermalStorageCoil.hh (1)
  • PackagedTESCoolingCoilStruct
PipeHeatTransfer.hh (1)
  • PipeHTData
Pipes.hh (1)
  • LocalPipeData
PlantCentralGSHP.hh (6)
  • CGSHPNodeData
  • WrapperComponentSpecs
  • CHReportVars
  • ChillerHeaterSpecs
  • WrapperReportVars
  • WrapperSpecs
PlantChillers.hh (5)
  • BaseChillerSpecs
  • ElectricChillerSpecs
  • EngineDrivenChillerSpecs
  • GTChillerSpecs
  • ConstCOPChillerSpecs
PlantComponentTemperatureSources.hh (1)
  • WaterSourceSpecs
PlantConvergencePoint.hh (1)
  • PlantConvergencePoint
PlantHeatExchangerFluidToFluid.hh (3)
  • PlantConnectionStruct
  • PlantLocatorStruct
  • HeatExchangerStruct
PlantLoadProfile.hh (1)
  • PlantProfileData
PlantLocation.hh (1)
  • PlantLocation
PlantLoopHeatPumpEIR.hh (1)
  • InOutNodePair
PlantPipingSystemsManager.hh (1)
  • ZoneCoupledSurfaceData
PondGroundHeatExchanger.hh (2)
  • PondGroundHeatExchangerData
  • PondGroundHeatExchangerData
PoweredInductionUnits.hh (1)
  • PowIndUnitData
PsychCacheData.hh (3)
  • cached_tsat_h_pb
  • cached_psat_t
  • cached_tsat_pb
PurchasedAirManager.hh (2)
  • ZonePurchasedAir
  • PurchAirPlenumArrayData
ReportBranchData.hh (1)
  • ReportBranchData
ReportCoilSelection.hh (1)
  • ReportCoilSelection
ReportCompData.hh (1)
  • ReportCompData
ReportLoopData.hh (1)
  • ReportLoopData
ResultsFramework.hh (1)
  • BaseResultObject
RuntimeLanguageProcessor.hh (2)
  • TokenType
  • RuntimeReportVarType
ScheduleManager.hh (7)
  • ScheduleBase
  • DayOrYearSchedule
  • DaySchedule
  • WeekSchedule
  • Schedule
  • ScheduleConstant
  • ScheduleDetailed
SingleDuct.hh (2)
  • SingleDuctAirTerminalFlowConditions
  • SingleDuctAirTerminal
SizingManager.hh (1)
  • ZoneListData
SolarReflectionManager.hh (1)
  • SolReflRecSurfData
SolarShading.hh (1)
  • SurfaceErrorTracking
SplitterComponent.hh (1)
  • SplitterConditions
SplitterData.hh (1)
  • SplitterData
SteamBaseboardRadiator.hh (4)
  • SteamBaseboardParams
  • SteamBaseboardDesignData
  • SteamBaseboardNumericFieldData
  • SteamBaseboardDesignNumericFieldData
SteamCoils.hh (1)
  • SteamCoilEquipConditions
Subcomponents.hh (2)
  • SubSubcomponentData
  • SubcomponentData
SurfaceGeometry.hh (1)
  • EdgeOfSurf
SurfaceGroundHeatExchanger.hh (1)
  • SurfaceGroundHeatExchangerData
SwimmingPool.hh (1)
  • SwimmingPoolData
SystemAvailabilityManager.hh (7)
  • SysAvailManagerNightCycle
  • SysAvailManagerOptimumStart
  • DefineASHRAEAdaptiveOptimumStartCoeffs
  • SysAvailManagerDiffThermo
  • SysAvailManagerHiLoTemp
  • SysAvailManagerNightVent
  • SysAvailManagerHybridVent
SystemReports.hh (3)
  • Energy
  • CompTypeError
  • IdentifyLoop
ThermalChimney.hh (3)
  • ThermalChimneyData
  • ThermChimZnReportVars
  • ThermChimReportVars
ThermalComfort.hh (4)
  • ThermalComfortDataType
  • ThermalComfortInASH55Type
  • ThermalComfortSetPointType
  • ThermalComfortsData
TranspiredCollector.hh (1)
  • UTSCDataStruct
UnitHeater.hh (2)
  • UnitHeaterData
  • UnitHeatNumericFieldData
UnitVentilator.hh (3)
  • UnitVentilatorData
  • UnitVentNumericFieldData
  • UnitVentilatorsData
UserDefinedComponents.hh (8)
  • PlantConnectionStruct
  • AirConnectionStruct
  • WaterUseTankConnectionStruct
  • ZoneInternalGainsStruct
  • UserPlantComponentStruct
  • UserCoilComponentStruct
  • UserZoneHVACForcedAirComponentStruct
  • UserAirTerminalComponentStruct
VariableSpeedCoils.hh (1)
  • VariableSpeedCoilData
VentilatedSlab.hh (5)
  • VentilatedSlabData
  • VentilatedSlabData
  • VentSlabNumericFieldData
  • VentilatedSlabData
  • VentilatedSlabData
WaterCoils.hh (3)
  • WaterCoilEquipConditions
  • WaterCoilNumericFieldData
  • WaterCoilsData
WaterManager.hh (1)
  • WaterManagerData
WaterThermalTanks.hh (5)
  • StratifiedNodeData
  • WaterHeaterSizingData
  • HeatPumpWaterHeaterData
  • WaterThermalTankData
  • WaterHeaterDesuperheaterData
WaterToAirHeatPump.hh (2)
  • WatertoAirHPEquipConditions
  • WaterToAirHeatPumpData
WaterToAirHeatPumpSimple.hh (1)
  • WaterToAirHeatPumpSimpleData
WindowAC.hh (3)
  • WindACData
  • WindACNumericFieldData
  • WindowACData
WindowComplexManager.hh (2)
  • WindowIndex
  • WindowComplexManagerData
WindowEquivalentLayer.hh (1)
  • WindowEquivalentLayerData

@@ -80,7 +80,206 @@ namespace EnergyPlus::EconomicTariff {

// Compute utility bills for a building based on energy
// use estimate.


constexpr std::array<std::string_view, (int)EconConv::Num> convEnergyStrings = {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Converted enum-to-string functions into constexpr std::array<std::string_view>.


// Control types:
enum class LowTempRadiantControlTypes
enum class CtrlType
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No point in having LowTempRadiant in both module name and type name.

SurfIntTempControl, // Controls system using a temperature inside the radiant system construction as defined by the Construction +
// ConstructionProperty:InternalHeatSource inputs
RunningMeanODBControl, // Controls system using the running mean outdoor dry-bulb temperature
MAT, // Controls system using mean air temperature
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No point in having Control in both type name and type values.

CondCtrlNone, // Condensation control--none, so system never shuts down
CondCtrlSimpleOff, // Condensation control--simple off, system shuts off when condensation predicted
CondCtrlVariedOff, // Condensation control--variable off, system modulates to keep running if possible
None, // Condensation control--none, so system never shuts down
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No point in having CondCtrl in both type name and type values.

state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cPVGeneratorObjectName);
state.dataPhotovoltaic->NumSimplePVModuleTypes =
state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, state.dataPhotovoltaic->cPVSimplePerfObjectName);
state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, pvModelNames[(int)PVModel::Simple]);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Constants do not need to be members of the state.data* object.

int y_max_index;
int z_max_index;
bool HorizInsPresentFlag;
HorizInsulation HorizIns = HorizInsulation::Invalid;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Another instance where two booleans were used to indicate three states.

MULTIPLY,
SUBTRACT,
DIVIDE,
ABSOLUTE,
Copy link
Collaborator

@dareumnam dareumnam May 5, 2025

Choose a reason for hiding this comment

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

When building this branch with Visual Studio on Windows, we encountered a number of strange, nonsensical errors. @mjwitte identified the issue—one of the enum names here, ABSOLUTE, seems to be interpreted by Visual Studio as a function name, which causes the build to fail.
After changing this enum name, the branch builds without any issues. I believe we should rename it to avoid this conflict. If you have a preferred alternative, please let me know. I can go ahead and make the change while also updating the clang format and addressing the issues needed to pass the custom checks. Or if anyone have any insight on how to resolve this without changing the name, please let me know.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Go ahead, thanks!

Copy link
Collaborator

@dareumnam dareumnam May 5, 2025

Choose a reason for hiding this comment

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

The only alternative name I can think of is ABSOLUTEVALUE, but if anyone has a better suggestion, feel free to let me know!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It doesn’t matter. Call it Dareum if you want.

@dareumnam dareumnam self-assigned this May 8, 2025
@github-actions
Copy link

⚠️ Regressions detected on macos-14 for commit d85d17e

Regression Summary
  • ERR: 1

@github-actions
Copy link

⚠️ Regressions detected on macos-14 for commit 041d897

Regression Summary
  • ERR: 1

@github-actions
Copy link

⚠️ Regressions detected on macos-14 for commit 9d0d4f7

Regression Summary
  • ERR: 1

@github-actions
Copy link

⚠️ Regressions detected on macos-14 for commit 6c1410c

Regression Summary
  • ERR: 1

@github-actions
Copy link

⚠️ Regressions detected on macos-14 for commit 8ca8b2a

Regression Summary
  • ERR: 1

@github-actions
Copy link

⚠️ Regressions detected on macos-14 for commit ee7e159

Regression Summary
  • ERR: 1

Copy link
Member

@Myoldmopar Myoldmopar left a comment

Choose a reason for hiding this comment

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

Looks great to me. I'll give it a final test and it should be ready to drop right in. We can tackle the constructors cleanup anytime you'd like, @amirroth

struct PhotovoltaicsData : BaseGlobalStruct
{

std::string const cPVGeneratorObjectName = "Generator:Photovoltaic";
Copy link
Member

Choose a reason for hiding this comment

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

😊

bool HeatOffFlag; // Heating off flag

// Default Constructor
ZoneTempControls()
Copy link
Member

Choose a reason for hiding this comment

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

If an empty signature constructor isn't doing anything but assigning the values to the member variables directly, then yeah, let's get rid of them. A dedicated pass is fine, and it should be fairly easy to detect them. In fact, a very quick script resulted in the following list of "empty" constructors, which may not be 100% accurate, but my spot checks seem to indicate it is close, with an estimate of 344 to clean up:

Branch.hh (1)
  • BranchData
CTElectricGenerator.hh (1)
  • CTGeneratorData
CallingOrder.hh (1)
  • PlantCallingOrderInfoStruct
Component.hh (1)
  • CompData
ConnectedLoopData.hh (1)
  • ConnectedLoopData
Connection.hh (1)
  • PlantConnection
CostEstimateManager.hh (2)
  • CostAdjustmentStruct
  • monetaryUnitType
DXCoils.hh (3)
  • DXCoilData
  • PerfModeData
  • DXCoilNumericFieldData
DataBSDFWindow.hh (1)
  • BSDFDaylghtPosition
DataDaylightingDevices.hh (1)
  • TDDPipeData
DataDefineEquip.hh (1)
  • ZoneAirEquip
DataGenerators.hh (1)
  • GeneratorFuelSupplyDataStruct
DataHVACSystems.hh (1)
  • HVACSystemData
DataHeatBalance.hh (4)
  • ZoneResilience
  • ZoneData
  • ZoneListData
  • ExtVentedCavityStruct
DataPhotovoltaics.hh (8)
  • SimplePVParamsStruct
  • TRNSYSPVModuleParamsStruct
  • TRNSYSPVCalcStruct
  • SNLModuleParamsStuct
  • SNLPVInputStruct
  • SNLPVCalcStruct
  • PVReportVariables
  • PVArrayStruct
DataRootFinder.hh (3)
  • ControlsType
  • PointType
  • RootFinderDataType
DataRuntimeLanguage.hh (12)
  • OutputVarSensorType
  • InternalVarsAvailableType
  • InternalVarsUsedType
  • EMSActuatorAvailableType
  • ActuatorUsedType
  • EMSProgramCallManagementType
  • ErlValueType
  • ErlVariableType
  • InstructionType
  • ErlStackType
  • ErlExpressionType
  • TrendVariableType
DataShadowingCombinations.hh (1)
  • ShadowingCombinations
DataSizing.hh (8)
  • TermUnitSizingData
  • ZoneEqSizingData
  • ZoneHVACSizingData
  • AirTerminalSizingSpecData
  • SysSizPeakDDNumData
  • FacilitySizingData
  • CompDesWaterFlowData
  • ZoneAirDistributionData
DataSurfaceLists.hh (2)
  • SurfaceListData
  • SlabListData
DataSurfaces.hh (9)
  • Surface2D
  • SurfaceData
  • FrameDividerProperties
  • StormWindowData
  • OSCData
  • OSCMData
  • ShadingVertexData
  • FenestrationSolarAbsorbed
  • IntMassObject
DataWater.hh (5)
  • StorageTankDataStruct
  • RainfallCollectorDataStruct
  • GroundwaterWellDataStruct
  • SiteRainFallDataStruct
  • IrrigationDataStruct
DataWindowEquivalentLayer.hh (6)
  • CFSLWP
  • CFSSWP
  • CFSLAYER
  • CFSFILLGAS
  • CFSGAP
  • CFSTY
DataZoneControls.hh (5)
  • ZoneTempControls
  • ZoneHumidityControls
  • ZoneComfortControls
  • ZoneStagedControls
  • TStatObject
DataZoneEquipment.hh (7)
  • SubSubEquipmentData
  • SubEquipmentData
  • AirIn
  • EquipConfiguration
  • EquipmentData
  • ControlList
  • SupplyAir
DemandManager.hh (3)
  • DemandManagerListData
  • DemandManagerData
  • DemandManagerData
DesiccantDehumidifiers.hh (1)
  • DesiccantDehumidifierData
EconomicLifeCycleCost.hh (3)
  • RecurringCostsType
  • NonrecurringCostType
  • CashFlowType
EconomicTariff.hh (8)
  • EconVarType
  • TariffType
  • QualifyType
  • ChargeSimpleType
  • ChargeBlockType
  • RatchetType
  • ComputationType
  • StackType
ElectricBaseboardRadiator.hh (1)
  • ElecBaseboardNumericFieldData
ElectricPowerServiceManager.hh (2)
  • ElectricPowerServiceManager
  • ElectricPowerServiceManager
EquipAndOperations.hh (5)
  • EquipListPtrData
  • OpSchemePtrData
  • EquipListCompData
  • EquipOpList
  • OperationData
EvaporativeCoolers.hh (2)
  • EvapConditions
  • ZoneEvapCoolerUnitStruct
ExteriorEnergyUse.hh (2)
  • ExteriorLightUsage
  • ExteriorEquipmentUsage
ExternalInterface.hh (8)
  • fmuInputVariableType
  • checkFMUInstanceNameType
  • eplusOutputVariableType
  • fmuOutputVariableScheduleType
  • fmuOutputVariableVariableType
  • fmuOutputVariableActuatorType
  • eplusInputVariableVariableType
  • eplusInputVariableActuatorType
Fans.hh (3)
  • FanBase
  • FanSystem
  • FanSystem
FaultsManager.hh (12)
  • FaultPropertiesEconomizer
  • FaultPropertiesThermostat
  • FaultPropertiesHumidistat
  • FaultPropertiesFoulingCoil
  • FaultPropertiesCoilSAT
  • FaultPropertiesChillerSWT
  • FaultPropertiesCondenserSWT
  • FaultPropertiesTowerFouling
  • FaultPropertiesFouling
  • FaultPropertiesBoilerFouling
  • FaultPropertiesChillerFouling
  • FaultPropertiesEvapCoolerFouling
FluidCoolers.hh (1)
  • FluidCoolerspecs
FuelCellElectricGenerator.hh (11)
  • FCPowerModuleStruct
  • FCAirSupplyDataStruct
  • FCWaterSupplyDataStruct
  • FCAuxilHeatDataStruct
  • FCExhaustHXDataStruct
  • BatteryDichargeDataStruct
  • FCElecStorageDataStruct
  • FCInverterDataStruct
  • FCReportDataStruct
  • FCStackCoolerDataStruct
  • FCDataStruct
Furnaces.hh (1)
  • FurnaceEquipConditions
GroundHeatExchangers.hh (10)
  • ThermophysicalProps
  • PipeProps
  • GLHEVertProps
  • MyCartesian
  • GLHEVertSingle
  • GLHEVertArray
  • GLHEResponseFactors
  • GLHEBase
  • GLHEVert
  • GLHESlinky
HVACControllers.hh (1)
  • ControllerPropsType
HVACCooledBeam.hh (1)
  • CoolBeamData
HVACDXHeatPumpSystem.hh (1)
  • DXHeatPumpSystemStruct
HVACDuct.hh (1)
  • DuctData
HVACFourPipeBeam.hh (2)
  • HVACFourPipeBeam
  • HVACFourPipeBeam
HVACHXAssistedCoolingCoil.hh (1)
  • HXAssistedCoilParameters
HVACMultiSpeedHeatPump.hh (2)
  • MSHeatPumpData
  • MSHeatPumpReportData
HVACSingleDuctInduc.hh (1)
  • IndUnitData
HVACStandAloneERV.hh (1)
  • StandAloneERVData
HVACVariableRefrigerantFlow.hh (2)
  • VRFCondenserEquipment
  • TerminalUnitListData
HWBaseboardRadiator.hh (2)
  • HWBaseboardNumericFieldData
  • HWBaseboardDesignNumericFieldData
HeatBalFiniteDiffManager.hh (4)
  • ConstructionDataFD
  • MaterialActuatorData
  • SurfaceDataFD
  • MaterialDataFD
HeatBalanceHAMTManager.hh (1)
  • subcell
HeatBalanceManager.hh (1)
  • WarmupConvergence
HeatPumpWaterToWaterCOOLING.hh (1)
  • GshpPeCoolingSpecs
HeatPumpWaterToWaterHEATING.hh (1)
  • GshpPeHeatingSpecs
HeatPumpWaterToWaterSimple.hh (1)
  • GshpSpecs
HighTempRadiantSystem.hh (3)
  • HighTempRadiantSystemData
  • HighTempRadSysNumericFieldData
  • HighTempRadiantSystemData
Humidifiers.hh (1)
  • HumidifierData
HybridEvapCoolingModel.hh (2)
  • CSetting
  • CStepInputs
ICEngineElectricGenerator.hh (1)
  • ICEngineGeneratorSpecs
IceThermalStorage.hh (2)
  • SimpleIceStorageData
  • DetailedIceStorageData
IntegratedHeatPump.hh (1)
  • IntegratedHeatPumpData
Loop.hh (1)
  • PlantLoopData
LoopSide.hh (1)
  • HalfLoopData
LoopSidePumpInformation.hh (1)
  • LoopSidePumpInformation
MatrixDataManager.hh (1)
  • MatrixDataStruct
MeterData.hh (1)
  • MeterData
MicroCHPElectricGenerator.hh (2)
  • MicroCHPParamsNonNormalized
  • MicroCHPDataStruct
MicroturbineElectricGenerator.hh (1)
  • MTGeneratorSpecs
MixerComponent.hh (1)
  • MixerConditions
MixerData.hh (1)
  • MixerData
MoistureBalanceEMPDManager.hh (1)
  • EMPDReportVarsData
NodeInputManager.hh (1)
  • NodeListDef
OutdoorAirUnit.hh (2)
  • OAEquipList
  • OAUnitData
OutputProcessor.hh (1)
  • OutVar
OutputReportData.hh (1)
  • AnnualFieldSet
OutputReportPredefined.hh (6)
  • reportNameType
  • SubTableType
  • ColumnTagType
  • TableEntryType
  • CompSizeTableEntryType
  • ShadowRelateType
OutputReportTabular.hh (10)
  • BinResultsType
  • BinObjVarIDType
  • BinStatisticsType
  • NamedMonthlyType
  • MonthlyFieldSetInputType
  • MonthlyTablesType
  • MonthlyColumnsType
  • TOCEntriesType
  • UnitConvType
  • ZompComponentAreasType
OutputReportTabularAnnual.hh (2)
  • AnnualTable
  • AnnualTable
PackagedThermalStorageCoil.hh (1)
  • PackagedTESCoolingCoilStruct
PipeHeatTransfer.hh (1)
  • PipeHTData
Pipes.hh (1)
  • LocalPipeData
PlantCentralGSHP.hh (6)
  • CGSHPNodeData
  • WrapperComponentSpecs
  • CHReportVars
  • ChillerHeaterSpecs
  • WrapperReportVars
  • WrapperSpecs
PlantChillers.hh (5)
  • BaseChillerSpecs
  • ElectricChillerSpecs
  • EngineDrivenChillerSpecs
  • GTChillerSpecs
  • ConstCOPChillerSpecs
PlantComponentTemperatureSources.hh (1)
  • WaterSourceSpecs
PlantConvergencePoint.hh (1)
  • PlantConvergencePoint
PlantHeatExchangerFluidToFluid.hh (3)
  • PlantConnectionStruct
  • PlantLocatorStruct
  • HeatExchangerStruct
PlantLoadProfile.hh (1)
  • PlantProfileData
PlantLocation.hh (1)
  • PlantLocation
PlantLoopHeatPumpEIR.hh (1)
  • InOutNodePair
PlantPipingSystemsManager.hh (1)
  • ZoneCoupledSurfaceData
PondGroundHeatExchanger.hh (2)
  • PondGroundHeatExchangerData
  • PondGroundHeatExchangerData
PoweredInductionUnits.hh (1)
  • PowIndUnitData
PsychCacheData.hh (3)
  • cached_tsat_h_pb
  • cached_psat_t
  • cached_tsat_pb
PurchasedAirManager.hh (2)
  • ZonePurchasedAir
  • PurchAirPlenumArrayData
ReportBranchData.hh (1)
  • ReportBranchData
ReportCoilSelection.hh (1)
  • ReportCoilSelection
ReportCompData.hh (1)
  • ReportCompData
ReportLoopData.hh (1)
  • ReportLoopData
ResultsFramework.hh (1)
  • BaseResultObject
RuntimeLanguageProcessor.hh (2)
  • TokenType
  • RuntimeReportVarType
ScheduleManager.hh (7)
  • ScheduleBase
  • DayOrYearSchedule
  • DaySchedule
  • WeekSchedule
  • Schedule
  • ScheduleConstant
  • ScheduleDetailed
SingleDuct.hh (2)
  • SingleDuctAirTerminalFlowConditions
  • SingleDuctAirTerminal
SizingManager.hh (1)
  • ZoneListData
SolarReflectionManager.hh (1)
  • SolReflRecSurfData
SolarShading.hh (1)
  • SurfaceErrorTracking
SplitterComponent.hh (1)
  • SplitterConditions
SplitterData.hh (1)
  • SplitterData
SteamBaseboardRadiator.hh (4)
  • SteamBaseboardParams
  • SteamBaseboardDesignData
  • SteamBaseboardNumericFieldData
  • SteamBaseboardDesignNumericFieldData
SteamCoils.hh (1)
  • SteamCoilEquipConditions
Subcomponents.hh (2)
  • SubSubcomponentData
  • SubcomponentData
SurfaceGeometry.hh (1)
  • EdgeOfSurf
SurfaceGroundHeatExchanger.hh (1)
  • SurfaceGroundHeatExchangerData
SwimmingPool.hh (1)
  • SwimmingPoolData
SystemAvailabilityManager.hh (7)
  • SysAvailManagerNightCycle
  • SysAvailManagerOptimumStart
  • DefineASHRAEAdaptiveOptimumStartCoeffs
  • SysAvailManagerDiffThermo
  • SysAvailManagerHiLoTemp
  • SysAvailManagerNightVent
  • SysAvailManagerHybridVent
SystemReports.hh (3)
  • Energy
  • CompTypeError
  • IdentifyLoop
ThermalChimney.hh (3)
  • ThermalChimneyData
  • ThermChimZnReportVars
  • ThermChimReportVars
ThermalComfort.hh (4)
  • ThermalComfortDataType
  • ThermalComfortInASH55Type
  • ThermalComfortSetPointType
  • ThermalComfortsData
TranspiredCollector.hh (1)
  • UTSCDataStruct
UnitHeater.hh (2)
  • UnitHeaterData
  • UnitHeatNumericFieldData
UnitVentilator.hh (3)
  • UnitVentilatorData
  • UnitVentNumericFieldData
  • UnitVentilatorsData
UserDefinedComponents.hh (8)
  • PlantConnectionStruct
  • AirConnectionStruct
  • WaterUseTankConnectionStruct
  • ZoneInternalGainsStruct
  • UserPlantComponentStruct
  • UserCoilComponentStruct
  • UserZoneHVACForcedAirComponentStruct
  • UserAirTerminalComponentStruct
VariableSpeedCoils.hh (1)
  • VariableSpeedCoilData
VentilatedSlab.hh (5)
  • VentilatedSlabData
  • VentilatedSlabData
  • VentSlabNumericFieldData
  • VentilatedSlabData
  • VentilatedSlabData
WaterCoils.hh (3)
  • WaterCoilEquipConditions
  • WaterCoilNumericFieldData
  • WaterCoilsData
WaterManager.hh (1)
  • WaterManagerData
WaterThermalTanks.hh (5)
  • StratifiedNodeData
  • WaterHeaterSizingData
  • HeatPumpWaterHeaterData
  • WaterThermalTankData
  • WaterHeaterDesuperheaterData
WaterToAirHeatPump.hh (2)
  • WatertoAirHPEquipConditions
  • WaterToAirHeatPumpData
WaterToAirHeatPumpSimple.hh (1)
  • WaterToAirHeatPumpSimpleData
WindowAC.hh (3)
  • WindACData
  • WindACNumericFieldData
  • WindowACData
WindowComplexManager.hh (2)
  • WindowIndex
  • WindowComplexManagerData
WindowEquivalentLayer.hh (1)
  • WindowEquivalentLayerData

Real64 thisMRTFraction; // temp working value for radiative fraction/weight
// is operative temp radiative fraction scheduled or fixed?
if (state.dataZoneCtrls->TempControlledZone(TempControlledZoneID).OpTempCntrlModeScheduled) {
if (state.dataZoneCtrls->TempControlledZone(TempControlledZoneID).OpTempCtrl == DataZoneControls::TempCtrl::Scheduled) {
Copy link
Member

Choose a reason for hiding this comment

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

Yep, this is nice.

@Myoldmopar
Copy link
Member

All checks completely happy, this seems ready to go in. Thanks @amirroth for more enumeration cleanups.

@Myoldmopar Myoldmopar merged commit 463a9e0 into develop May 14, 2025
9 checks passed
@Myoldmopar Myoldmopar deleted the EnumPass branch May 14, 2025 14:50
state->dataEconTariff->tariff(2).kindMtr = EconomicTariff::MeterType::Gas;
state->dataEconTariff->tariff(2).reportMeterIndx = GetMeterIndex(*state, "NATURALGAS:FACILITY");

state->dataEconTariff->tariff(3).tariffName = "DistrictCoolingUnit";
Copy link
Contributor

Choose a reason for hiding this comment

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

@amirroth On windows, with a debug build, unit test EconomicTariff_LEEDtariffReporting_Test fails with a subscript error here, because distCoolDemWindowUnits=invalid.

@Myoldmopar This fails with a debug build, but not with RelWithDebInfo. I wonder if we need to change the configuration on the CI unit test coverage to Debug?

Copy link
Member

Choose a reason for hiding this comment

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

The RelWithDebInfo was added to make CI run in a reasonable time. It could be changed back, but will result in a pretty major test time penalty. Hmm. I wonder if I can keep RelWithDebInfo, but re-enable subscript errors and assertions? I'll look real quick.

Copy link
Member

Choose a reason for hiding this comment

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

It looks like we could keep the optimizations from a RelWithDebInfo but give up a little performance by re-enabling assertions and subscript checks. I can look into handling NDEBUG and using sanitiziers, but I'm not sure the best path yet. I wonder if @jmarrec would want to look into this?

Copy link
Contributor

Choose a reason for hiding this comment

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

GCC: define _GLIBCXX_DEBUG. Incidentally, you can just use our option FORCE_DEBUG_ARITHM_GCC_OR_CLANG and this block will be executed

# ADDITIONAL GCC-SPECIFIC FLAGS
if(CMAKE_COMPILER_IS_GNUCXX) # g++
target_compile_options(project_options INTERFACE $<${need_arithm_debug_genex}:-ffloat-store>) # Improve debug run solution stability
target_compile_options(project_options INTERFACE $<${need_arithm_debug_genex}:-fsignaling-nans>) # Disable optimizations that may have concealed NaN behavior
target_compile_definitions(project_options INTERFACE $<${need_arithm_debug_genex}:_GLIBCXX_DEBUG>) # Standard container debug mode (bounds checking, ...>)
# ADD_CXX_RELEASE_DEFINITIONS("-finline-limit=2000") # More aggressive inlining This is causing unit test failures on Ubuntu 14.04
else()

On MSVC, I think it's _ITERATOR_DEBUG_LEVEL=2 (which is added by default in Debug mode)

Copy link
Contributor

Choose a reason for hiding this comment

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

MSVC is a piece of junk when it comes to ABI with this, so you need to ensure all libs are built with the same _ITERATOR_DEBUG_LEVEL or you'll get ABI violations.

ASAN would also catch this I think, but it might be annoying to clean everything up so it doesn't report OTHER things (looking at you, FMI/FMU code). Been a while since a ran a full test suite with ASAN.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Is there something I need to do here?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes:

1162: [ RUN      ] EnergyPlusFixture.EconomicTariff_LEEDtariffReporting_Test
1162: /usr/include/c++/13/array:211: constexpr const std::array<_Tp, _Nm>::value_type& std::array<_Tp, _Nm>::operator[](size_type) const [with _Tp = std::basic_string_view<char>; long unsigned int _Nm = 5; const_reference = const std::basic_string_view<char>&; size_type = long unsigned int]: Assertion '__n < this->size()' failed.
1/1 Test #1162: EnergyPlusFixture.EconomicTariff_LEEDtariffReporting_Test ...Subprocess aborted***Exception:   

Either in test:

# District cooling
state->dataEconTariff->tariff(3).demandWindow == DemandWindow::Quarter;

# distrinct heating water
state->dataEconTariff->tariff(4).demandWindow == DemandWindow::Quarter;

You probably should assign kindMtr too for meters 3 & 4.

Note that Gas itself has protection in the EconomicTariff.cc while DC /DH don't

format("{}{}",
convDemandStrings[(int)gasUnits],
(gasDemWindowUnits == DemandWindow::Invalid) ? "" : demandWindowStrings[(int)gasDemWindowUnits]));

Copy link
Contributor

Choose a reason for hiding this comment

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

Convenience for you: 17aeb29

Decide if you want to also protect in the CC file or not?

Copy link
Contributor

Choose a reason for hiding this comment

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

I opened #11059, if you can take it from there that'd be great. Have a nice weekend!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Looks like you've already fixed it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DoNotPublish Includes changes that shouldn't be reported in the changelog Refactoring Includes code changes that don't change the functionality of the program, just perform refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants