From a334a7dc497bb19500dc99d83e3bf3abcd8635f1 Mon Sep 17 00:00:00 2001 From: Yujie Xu Date: Fri, 28 Apr 2023 11:29:44 -0700 Subject: [PATCH] add curve validation --- .../Coils/CoilCoolingDXCurveFitPerformance.cc | 8 +++ src/EnergyPlus/DXCoils.cc | 49 +++++++++++++++++++ src/EnergyPlus/VariableSpeedCoils.cc | 24 +++++++++ 3 files changed, 81 insertions(+) diff --git a/src/EnergyPlus/Coils/CoilCoolingDXCurveFitPerformance.cc b/src/EnergyPlus/Coils/CoilCoolingDXCurveFitPerformance.cc index 85b800ab2e3..16f75ce0e79 100644 --- a/src/EnergyPlus/Coils/CoilCoolingDXCurveFitPerformance.cc +++ b/src/EnergyPlus/Coils/CoilCoolingDXCurveFitPerformance.cc @@ -127,6 +127,14 @@ void CoilCoolingDXCurveFitPerformance::instantiateFromInputSpec(EnergyPlus::Ener if (!input_data.outdoor_temperature_dependent_crankcase_heater_capacity_curve_name.empty()) { this->crankcaseHeaterCapacityCurveIndex = Curve::GetCurveIndex(state, input_data.outdoor_temperature_dependent_crankcase_heater_capacity_curve_name); + // Verify Curve Object, only legal type is Quadratic and Cubic + errorsFound |= Curve::CheckCurveDims(state, + this->crankcaseHeaterCapacityCurveIndex, // Curve index + {1}, // Valid dimensions + routineName, // Routine name + this->object_name, // Object Type + this->name, // Object Name + input_data.outdoor_temperature_dependent_crankcase_heater_capacity_curve_name); // Field Name } if (errorsFound) { ShowFatalError( diff --git a/src/EnergyPlus/DXCoils.cc b/src/EnergyPlus/DXCoils.cc index fe9774ba381..20bf7377466 100644 --- a/src/EnergyPlus/DXCoils.cc +++ b/src/EnergyPlus/DXCoils.cc @@ -1365,6 +1365,13 @@ void GetDXCoils(EnergyPlusData &state) // A19; \field Crankcase Heater Capacity Function of Outdoor Temperature Curve Name if (!lAlphaBlanks(19)) { thisDXCoil.CrankcaseHeaterCapacityCurveIndex = Curve::GetCurveIndex(state, Alphas(19)); + ErrorsFound |= Curve::CheckCurveDims(state, + thisDXCoil.CrankcaseHeaterCapacityCurveIndex, // Curve index + {1}, // Valid dimensions + RoutineName, // Routine name + CurrentModuleObject, // Object Type + thisDXCoil.Name, // Object Name + cAlphaFields(19)); // Field Name } } // end of the Doe2 DX coil loop @@ -1916,6 +1923,13 @@ void GetDXCoils(EnergyPlusData &state) // A16; \field Crankcase Heater Capacity Function of Outdoor Temperature Curve Name if (!lAlphaBlanks(16)) { thisDXCoil.CrankcaseHeaterCapacityCurveIndex = Curve::GetCurveIndex(state, Alphas(16)); + ErrorsFound |= Curve::CheckCurveDims(state, + thisDXCoil.CrankcaseHeaterCapacityCurveIndex, // Curve index + {1}, // Valid dimensions + RoutineName, // Routine name + CurrentModuleObject, // Object Type + thisDXCoil.Name, // Object Name + cAlphaFields(16)); // Field Name } } // end of the Multimode DX coil loop @@ -2371,6 +2385,13 @@ void GetDXCoils(EnergyPlusData &state) // A17; \field Crankcase Heater Capacity Function of Outdoor Temperature Curve Name if (!lAlphaBlanks(17)) { thisDXCoil.CrankcaseHeaterCapacityCurveIndex = Curve::GetCurveIndex(state, Alphas(17)); + ErrorsFound |= Curve::CheckCurveDims(state, + thisDXCoil.CrankcaseHeaterCapacityCurveIndex, // Curve index + {1}, // Valid dimensions + RoutineName, // Routine name + CurrentModuleObject, // Object Type + thisDXCoil.Name, // Object Name + cAlphaFields(17)); // Field Name } } // end of the DX heating coil loop @@ -3430,6 +3451,13 @@ void GetDXCoils(EnergyPlusData &state) if (!lAlphaBlanks(17)) { thisDXCoil.CrankcaseHeaterCapacityCurveIndex = Curve::GetCurveIndex(state, Alphas(17)); + ErrorsFound |= Curve::CheckCurveDims(state, + thisDXCoil.CrankcaseHeaterCapacityCurveIndex, // Curve index + {1}, // Valid dimensions + RoutineName, // Routine name + CurrentModuleObject, // Object Type + thisDXCoil.Name, // Object Name + cAlphaFields(17)); // Field Name } // assume compressor resides at the inlet to the DX Coil @@ -3816,6 +3844,13 @@ void GetDXCoils(EnergyPlusData &state) // Coil:WaterHeating:AirToWaterHeatPump:Wrapped if (!lAlphaBlanks(11)) { thisDXCoil.CrankcaseHeaterCapacityCurveIndex = Curve::GetCurveIndex(state, Alphas(11)); + ErrorsFound |= Curve::CheckCurveDims(state, + thisDXCoil.CrankcaseHeaterCapacityCurveIndex, // Curve index + {1}, // Valid dimensions + RoutineName, // Routine name + CurrentModuleObject, // Object Type + thisDXCoil.Name, // Object Name + cAlphaFields(11)); // Field Name } // assume compressor resides at the inlet to the DX Coil @@ -4372,6 +4407,13 @@ void GetDXCoils(EnergyPlusData &state) } if (!lAlphaBlanks(38)) { thisDXCoil.CrankcaseHeaterCapacityCurveIndex = Curve::GetCurveIndex(state, Alphas(38)); + ErrorsFound |= Curve::CheckCurveDims(state, + thisDXCoil.CrankcaseHeaterCapacityCurveIndex, // Curve index + {1}, // Valid dimensions + RoutineName, // Routine name + CurrentModuleObject, // Object Type + thisDXCoil.Name, // Object Name + cAlphaFields(38)); // Field Name } } @@ -4871,6 +4913,13 @@ void GetDXCoils(EnergyPlusData &state) } if (!lAlphaBlanks(43)) { thisDXCoil.CrankcaseHeaterCapacityCurveIndex = Curve::GetCurveIndex(state, Alphas(43)); + ErrorsFound |= Curve::CheckCurveDims(state, + thisDXCoil.CrankcaseHeaterCapacityCurveIndex, // Curve index + {1}, // Valid dimensions + RoutineName, // Routine name + CurrentModuleObject, // Object Type + thisDXCoil.Name, // Object Name + cAlphaFields(43)); // Field Name } } diff --git a/src/EnergyPlus/VariableSpeedCoils.cc b/src/EnergyPlus/VariableSpeedCoils.cc index 72a28414036..ae0c884abfb 100644 --- a/src/EnergyPlus/VariableSpeedCoils.cc +++ b/src/EnergyPlus/VariableSpeedCoils.cc @@ -1389,6 +1389,14 @@ namespace VariableSpeedCoils { // A50; \field Crankcase Heater Capacity Function of Outdoor Temperature Curve Name if (!lAlphaBlanks(50)) { state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterCapacityCurveIndex = Curve::GetCurveIndex(state, AlphArray(50)); + ErrorsFound |= + Curve::CheckCurveDims(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterCapacityCurveIndex, // Curve index + {1}, // Valid dimensions + RoutineName, // Routine name + CurrentModuleObject, // Object Type + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, // Object Name + cAlphaFields(50)); // Field Name } // CurrentModuleObject = "Coil:Cooling:DX:VariableSpeed" @@ -2410,6 +2418,14 @@ namespace VariableSpeedCoils { if (!lAlphaBlanks(48)) { state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterCapacityCurveIndex = Curve::GetCurveIndex(state, AlphArray(48)); + ErrorsFound |= + Curve::CheckCurveDims(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterCapacityCurveIndex, // Curve index + {1}, // Valid dimensions + RoutineName, // Routine name + CurrentModuleObject, // Object Type + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, // Object Name + cAlphaFields(48)); // Field Name } // CurrentModuleObject = "Coil:Heating:DX:Variablespeed " @@ -3036,6 +3052,14 @@ namespace VariableSpeedCoils { if (!lAlphaBlanks(71)) { state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterCapacityCurveIndex = Curve::GetCurveIndex(state, AlphArray(71)); + ErrorsFound |= + Curve::CheckCurveDims(state, + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).CrankcaseHeaterCapacityCurveIndex, // Curve index + {1}, // Valid dimensions + RoutineName, // Routine name + CurrentModuleObject, // Object Type + state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).Name, // Object Name + cAlphaFields(71)); // Field Name } // CurrentModuleObject = "Coil:Waterheating:Airtowaterheatpump:Variablespeed"