From 37fb236a8a0f1310fb06c625bf7b284b31a662d4 Mon Sep 17 00:00:00 2001 From: Nigusse Date: Fri, 16 Jun 2017 17:16:26 -0400 Subject: [PATCH] Added unit tests and updated IO and Eng Ref documentations (Issue #6151) --- .../system-availability-managers.tex | 8 +- .../group-system-availability-managers.tex | 6 +- .../unit/SystemAvailabilityManager.unit.cc | 312 ++++++++++++++++++ 3 files changed, 320 insertions(+), 6 deletions(-) diff --git a/doc/engineering-reference/src/simulation-models-encyclopedic-reference-004/system-availability-managers.tex b/doc/engineering-reference/src/simulation-models-encyclopedic-reference-004/system-availability-managers.tex index 1400585997a..e14dee7ab0d 100644 --- a/doc/engineering-reference/src/simulation-models-encyclopedic-reference-004/system-availability-managers.tex +++ b/doc/engineering-reference/src/simulation-models-encyclopedic-reference-004/system-availability-managers.tex @@ -39,6 +39,8 @@ \subsection{Night Cycle}\label{night-cycle} \item Thermostat on/off tolerance \emph{T\(_{tol}\)} (degrees C); +\item Cycling run time control type: \emph{FixedRunTime}, \emph{Thermostat}, or \emph{ThermostatWithMinimumRunTime}; + \item Cycling run time in seconds; used to calculate a stop time (in time steps since the start of the current run period) once the status has become \emph{Cycle On}. \item A control zone or zone list name. @@ -56,11 +58,11 @@ \subsection{Night Cycle}\label{night-cycle} Otherwise: \begin{enumerate} -\item If current time (in time steps since the start of the run period) is greater than the start time and less than the stop time, \emph{AvailStatus = CycleOn} (or \emph{CycleOnZoneFansOnly} if the control type is \emph{Cycle On Any -- Zone Fans only}). +\item If current time (in time steps since the start of the run period) is greater than the start time and less than the stop time, \emph{AvailStatus = CycleOn} (or \emph{CycleOnZoneFansOnly} if the control type is \emph{Cycle On Any -- Zone Fans only}) for CyclingRunTimeControlType = \emph{CyclingRunTimeControlType = FixedRunTime}, or \emph{CyclingRunTimeControlType = ThermostatWithMinimumRunTime} but for \emph{CyclingRunTimeControlType = Thermostat} the availability status is determined based on the zone air and the thermostat setpoint temperature difference and the tolerance limits. -\item If the current time equals the stop time, \emph{AvailStatus = NoAction} ~and the fan schedule will determine if the system is on. +\item If the current time equals the stop time and the CyclingRunTimeControlType = \emph{CyclingRunTimeControlType = FixedRunTime}, or \emph{CyclingRunTimeControlType = ThermostatWithMinimumRunTime}, \emph{AvailStatus = NoAction} ~and the fan schedule will determine if the system is on. For \emph{CyclingRunTimeControlType = Thermostat} the availability status is determined based on the zone air and the thermostat setpoint temperature difference and the tolerance limits, and the fan schedule will determine if the system is on. -\item If the current time is greater than the stop time, the manager can potentially cycle the system on. +\item If the current time is greater than the stop time, the manager can potentially cycle the system on for \emph{CyclingRunTimeControlType = FixedRunTime}, \emph{CyclingRunTimeControlType = Thermostat}, or \emph{CyclingRunTimeControlType = ThermostatWithMinimumRunTime}. \begin{enumerate} \item For control types \emph{CycleOnAny} and \emph{CycleOnAnyZoneFansOnly} the manger looks at each zone served by the air loop and detects whether the zone temperature at the thermostat is greater than the cooling setpoint plus ½\emph{T\(_{tol}\)} or less than the heating setpoint minus ½\emph{T\(_{tol}\)}. If it is, \emph{AvailStatus} is set to \emph{CycleOn} (or \emph{CycleOnZoneFansOnly}). If not, \emph{AvailStatus} is set to \emph{NoAction}. diff --git a/doc/input-output-reference/src/overview/group-system-availability-managers.tex b/doc/input-output-reference/src/overview/group-system-availability-managers.tex index 0845d151e74..990d04df178 100644 --- a/doc/input-output-reference/src/overview/group-system-availability-managers.tex +++ b/doc/input-output-reference/src/overview/group-system-availability-managers.tex @@ -169,9 +169,9 @@ \subsubsection{Inputs}\label{inputs-3-037} \begin{itemize} \tightlist -\item \emph{FixedRunTime} cycling run time control mode the AvailabilityManager:NightCycle activates an airloop or zone equipment for a fixed amount of run time when the zone air temperature is one half the Thermostat Tolerance above the thermostat cooling setpoint or when the zone air temperature is one half the Thermostat Tolerance below the thermostat heating setpoint. -\item \emph{Thermostat} cycling run time control mode the AvailabilityManager:NightCycle activates an airloop or zone equipment until the zone air temperature is within 0.05 C above the thermostat cooling setpoint in cooling mode or until the zone air temperature is within 0.05 C below the thermostat heating setpoint in heating mode. -\item \emph{ThermostatWithMinimumRunTime} cycling run time control mode the AvailabilityManager:NightCycle activates an airloop or zone equipment for the specified minimum Cycling Run Time when the zone air temperature is with in 0.05 C above the thermostat cooling setpoint or when the zone air temperature is within 0.05 C below the thermostat heating setpoint and then continues running until the zone air temperature reaches the thermostat setpoint. +\item \emph{FixedRunTime} cycling run time control type the AvailabilityManager:NightCycle activates an airloop or zone equipment for a fixed amount of run time when the zone air temperature is one half of the Thermostat Tolerance above the thermostat cooling setpoint or when the zone air temperature is one half of the Thermostat Tolerance below the thermostat heating setpoint. +\item \emph{Thermostat} cycling run time control type the AvailabilityManager:NightCycle activates an airloop or zone equipment until the zone air temperature is within 0.05 deg C above the thermostat cooling setpoint in cooling mode or until the zone air temperature is within 0.05 deg C below the thermostat heating setpoint in heating mode. Cycling Run Time input field below is not used for this cycling run time control type. +\item \emph{ThermostatWithMinimumRunTime} cycling run time control type the AvailabilityManager:NightCycle activates an airloop or zone equipment for the specified minimum Cycling Run Time when the zone air temperature is with in 0.05 deg C above the thermostat cooling setpoint or when the zone air temperature is within 0.05 deg C below the thermostat heating setpoint and then continues running beyond the minimum Cycling Run Time until the zone air temperature reaches the thermostat setpoint within 0.05 deg C thermostat tolerance. \end{itemize} \paragraph{Field: Cycling Run Time}\label{field-cycling-run-time} diff --git a/tst/EnergyPlus/unit/SystemAvailabilityManager.unit.cc b/tst/EnergyPlus/unit/SystemAvailabilityManager.unit.cc index f755a22c453..5a8bbcc787c 100644 --- a/tst/EnergyPlus/unit/SystemAvailabilityManager.unit.cc +++ b/tst/EnergyPlus/unit/SystemAvailabilityManager.unit.cc @@ -480,3 +480,315 @@ TEST_F( EnergyPlusFixture, SysAvailManager_HybridVentilation_OT_CO2Control ) DataHeatBalFanSys::TempZoneThermostatSetPoint.deallocate( ); } + +TEST_F( EnergyPlusFixture, SysAvailManager_NightCycleGetInput ) +{ + + std::string const idf_objects = delimited_string( { + + " AvailabilityManager:NightCycle,", + " VAV Sys 1 Avail, !- Name", + " SysAvailApplicSch, !- Applicability Schedule Name", + " FanAvailSched, !- Fan Schedule Name", + " CycleOnAny, !- Control Type", + " 1, !- Thermostat Tolerance {deltaC}", + " FixedRunTime, !- Cycling Run Time Control Type", + " 7200.0; !- Cycling Run Time {s}", + + " Schedule:Compact,", + " SysAvailApplicSch, !- Name", + " On/Off, !- Schedule Type Limits Name", + " Through: 12/31, !- Field 9", + " For: AllDays, !- Field 10", + " Until: 24:00,1.0; !- Field 11", + + " Schedule:Compact,", + " FanAvailSched, !- Name", + " Fraction, !- Schedule Type Limits Name", + " Through: 12/31, !- Field 1", + " For: AllDays, !- Field 2", + " Until: 7:00, 0.0, !- Field 3", + " Until: 24:00, 1.0; !- Field 3", + + " AvailabilityManager:NightCycle,", + " VAV Sys 2 Avail, !- Name", + " SysAvailApplicSch, !- Applicability Schedule Name", + " FanAvailSched, !- Fan Schedule Name", + " CycleOnAny, !- Control Type", + " 1, !- Thermostat Tolerance {deltaC}", + " Thermostat, !- Cycling Run Time Control Type", + " 7200.0; !- Cycling Run Time {s}", + + " AvailabilityManager:NightCycle,", + " VAV Sys 3 Avail, !- Name", + " SysAvailApplicSch, !- Applicability Schedule Name", + " FanAvailSched, !- Fan Schedule Name", + " CycleOnAny, !- Control Type", + " 1, !- Thermostat Tolerance {deltaC}", + " ThermostatWithMinimumRunTime, !- Cycling Run Time Control Type", + " 7200.0; !- Cycling Run Time {s}", + + } ); + + ASSERT_FALSE( process_idf( idf_objects ) ); + + DataGlobals::NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized + DataGlobals::MinutesPerTimeStep = 60; // must initialize this to get schedules initialized + ScheduleManager::ProcessScheduleInput(); // read schedules + ScheduleManager::ScheduleInputProcessed = true; + // get system availability schedule + SystemAvailabilityManager::GetSysAvailManagerInputs(); + // check the three cycling run time control types + EXPECT_EQ( 3, SystemAvailabilityManager::NumNCycSysAvailMgrs ); + EXPECT_EQ( SystemAvailabilityManager::FixedRunTime, SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).CycRunTimeCntrlType ); + EXPECT_EQ( SystemAvailabilityManager::Thermostat, SystemAvailabilityManager::NCycSysAvailMgrData( 2 ).CycRunTimeCntrlType ); + EXPECT_EQ( SystemAvailabilityManager::ThermostatWithMinimumRunTime, SystemAvailabilityManager::NCycSysAvailMgrData( 3 ).CycRunTimeCntrlType ); + +} + +TEST_F( EnergyPlusFixture, SysAvailManager_NightCycleZone_CalcNCycSysAvailMgr ) +{ + int NumZones( 1 ); + int SysAvailNum = 1; + int PriAirSysNum = 0; + int AvailStatus; + int const ZoneEquipType = 1; + int const CompNum = 1; + + DataGlobals::NumOfZones = 1; + DataHeatBalance::Zone.allocate( NumZones ); + DataHeatBalance::Zone( 1 ).Name = "SPACE1-1"; + DataHVACGlobals::ZoneComp.allocate( 1 ); + DataHVACGlobals::ZoneComp( 1 ).ZoneCompAvailMgrs.allocate( 1 ); + DataHVACGlobals::ZoneComp( 1 ).TotalNumComp = 1; + DataHVACGlobals::ZoneComp( 1 ).ZoneCompAvailMgrs( 1 ).AvailStatus = 0; + + DataHeatBalFanSys::TempControlType.allocate( NumZones ); + DataHeatBalFanSys::TempTstatAir.allocate( NumZones ); + DataHeatBalFanSys::TempZoneThermostatSetPoint.allocate( NumZones ); + DataHeatBalFanSys::TempControlType( 1 ) = DataHVACGlobals::SingleCoolingSetPoint; + DataHeatBalFanSys::TempZoneThermostatSetPoint( 1 ) = 25.0; + DataHeatBalFanSys::TempTstatAir( 1 ) = 25.1; + + SystemAvailabilityManager::NCycSysAvailMgrData.allocate( NumZones ); + SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).Name = "System Avail"; + SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).CtrlType = SystemAvailabilityManager::CycleOnAny; + SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).SchedPtr = 1; + SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).FanSchedPtr = 2; + SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).TempTolRange = 0.4; + SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).CyclingTimeSteps = 4; + SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).CtrlZoneListName = DataHeatBalance::Zone( 1 ).Name; + SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).NumOfCtrlZones = NumZones; + SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).CtrlZonePtrs.allocate( 1 ); + SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).CtrlZonePtrs( 1 ) = 1; + SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).CoolingZoneListName = DataHeatBalance::Zone( 1 ).Name; + SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).NumOfCoolingZones = NumZones; + SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).CoolingZonePtrs = NumZones; + ScheduleManager::Schedule.allocate( 2 ); + ScheduleManager::Schedule( 1 ).CurrentValue = 1; + ScheduleManager::Schedule( 2 ).CurrentValue = 0; + + // Cycling Run Time Control Type = FixedRunTime + // and current time is within the run time period, starting time is less than stopping time + DataGlobals::SimTimeSteps = 0; + DataHVACGlobals::ZoneComp( 1 ).ZoneCompAvailMgrs( 1 ).StartTime = 0.0; + DataHVACGlobals::ZoneComp( 1 ).ZoneCompAvailMgrs( 1 ).StopTime = 4.0; + SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).CycRunTimeCntrlType = SystemAvailabilityManager::FixedRunTime; + SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).AvailStatus = 0; + SystemAvailabilityManager::CalcNCycSysAvailMgr( SysAvailNum, PriAirSysNum, AvailStatus, ZoneEquipType, CompNum ); + // check that the system is cycling On + EXPECT_EQ( DataHVACGlobals::CycleOn, SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).AvailStatus ); + // starting time is equal to stopping time + DataGlobals::SimTimeSteps = 4; + DataHVACGlobals::ZoneComp( 1 ).ZoneCompAvailMgrs( 1 ).StartTime = 4.0; + DataHVACGlobals::ZoneComp( 1 ).ZoneCompAvailMgrs( 1 ).StopTime = 4.0; + SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).AvailStatus = 2; + SystemAvailabilityManager::CalcNCycSysAvailMgr( SysAvailNum, PriAirSysNum, AvailStatus, ZoneEquipType, CompNum ); + // check that the system is no action mode + EXPECT_EQ( DataHVACGlobals::NoAction, SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).AvailStatus ); + + // Cycling Run Time Control Type = Thermostat, Run Time has no effect + // starting time is less than stopping time, control is driven by temp differential + SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).CtrlType = SystemAvailabilityManager::CycleOnControlZone; + SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).CycRunTimeCntrlType = SystemAvailabilityManager::Thermostat; + SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).AvailStatus = 0; + DataGlobals::SimTimeSteps = 0; + DataHVACGlobals::ZoneComp( 1 ).ZoneCompAvailMgrs( 1 ).StartTime = 0.0; + DataHVACGlobals::ZoneComp( 1 ).ZoneCompAvailMgrs( 1 ).StopTime = 4.0; + SystemAvailabilityManager::CalcNCycSysAvailMgr( SysAvailNum, PriAirSysNum, AvailStatus, ZoneEquipType, CompNum ); + // check that the system is cycling On, 25.1 > 25.0 + 0.05 + EXPECT_EQ( DataHVACGlobals::CycleOn, SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).AvailStatus ); + // Cycling Run Time Control Type = Thermostat, Run Time has no effect + // starting time and stopping time are the same, control is driven by temp differential + DataGlobals::SimTimeSteps = 4; + DataHVACGlobals::ZoneComp( 1 ).ZoneCompAvailMgrs( 1 ).StartTime = 4.0; + DataHVACGlobals::ZoneComp( 1 ).ZoneCompAvailMgrs( 1 ).StopTime = 4.0; + SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).AvailStatus = 0; + // the unit still cycles on because of high zone air temp + DataHeatBalFanSys::TempTstatAir( 1 ) = 25.1; + SystemAvailabilityManager::CalcNCycSysAvailMgr( SysAvailNum, PriAirSysNum, AvailStatus, ZoneEquipType, CompNum ); + // Check that the system is cycling On, run time has no effect, // 25.1 > 25.0 + 0.05 + EXPECT_EQ( DataHVACGlobals::CycleOn, SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).AvailStatus ); + // Cycling Run Time Control Type = Thermostat, Run Time has no effect + // Reduce zone air temperature, control is driven by temp differential + DataGlobals::SimTimeSteps = 4; + DataHVACGlobals::ZoneComp( 1 ).ZoneCompAvailMgrs( 1 ).StartTime = 4.0; + DataHVACGlobals::ZoneComp( 1 ).ZoneCompAvailMgrs( 1 ).StopTime = 4.0; + SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).AvailStatus = 2; + // Reduce zone air temperature within the tolerance (0.05) to turn off night cycling + DataHeatBalFanSys::TempTstatAir( 1 ) = 25.04; + SystemAvailabilityManager::CalcNCycSysAvailMgr( SysAvailNum, PriAirSysNum, AvailStatus, ZoneEquipType, CompNum ); + // Check that the system is no action mode, 25.04 < 25.0 + 0.05 + EXPECT_EQ( DataHVACGlobals::NoAction, SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).AvailStatus ); + + // Cycling Run Time Control Type = ThermostatWithMinimumRunTime and + // current time is the end of run time period + DataGlobals::SimTimeSteps = 4; + DataHVACGlobals::ZoneComp( 1 ).ZoneCompAvailMgrs( 1 ).StartTime = 4.0; + DataHVACGlobals::ZoneComp( 1 ).ZoneCompAvailMgrs( 1 ).StopTime = 4.0; + SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).CycRunTimeCntrlType = SystemAvailabilityManager::ThermostatWithMinimumRunTime; + SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).AvailStatus = 0; + DataHeatBalFanSys::TempTstatAir( 1 ) = 25.1; + SystemAvailabilityManager::CalcNCycSysAvailMgr( SysAvailNum, PriAirSysNum, AvailStatus, ZoneEquipType, CompNum ); + // check that the system is cycling On, zone air temp is outside T tolerance limits of 0.05, 25.1 > 25.0 + 0.05 + EXPECT_EQ( DataHVACGlobals::CycleOn, SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).AvailStatus ); + // Cycling Run Time Control Type = ThermostatWithMinimumRunTime and + // current time is the end of run time period + DataGlobals::SimTimeSteps = 4; + DataHVACGlobals::ZoneComp( 1 ).ZoneCompAvailMgrs( 1 ).StartTime = 4.0; + DataHVACGlobals::ZoneComp( 1 ).ZoneCompAvailMgrs( 1 ).StopTime = 4.0; + SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).AvailStatus = 2; + // Reduce zone air temperature within the tolerance (0.05) to turn off night cycling + DataHeatBalFanSys::TempTstatAir( 1 ) = 25.04; + SystemAvailabilityManager::CalcNCycSysAvailMgr( SysAvailNum, PriAirSysNum, AvailStatus, ZoneEquipType, CompNum ); + // check that the system is no action mode, zone air temp is outside T tolerance limits of 0.05, 25.04 < 25.0 + 0.05 + EXPECT_EQ( DataHVACGlobals::NoAction, SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).AvailStatus ); +} + +TEST_F( EnergyPlusFixture, SysAvailManager_NightCycleSys_CalcNCycSysAvailMgr ) +{ + int NumZones( 1 ); + int SysAvailNum = 1; + int PriAirSysNum = 1; + int AvailStatus; + + DataGlobals::NumOfZones = 1; + DataAirLoop::PriAirSysAvailMgr.allocate( PriAirSysNum ); + SystemAvailabilityManager::NCycSysAvailMgrData.allocate( NumZones ); + DataHeatBalFanSys::TempControlType.allocate( NumZones ); + DataHeatBalFanSys::TempTstatAir.allocate( NumZones ); + DataHeatBalFanSys::TempZoneThermostatSetPoint.allocate( NumZones ); + DataHeatBalFanSys::TempControlType( 1 ) = DataHVACGlobals::SingleCoolingSetPoint; + DataHeatBalFanSys::TempZoneThermostatSetPoint( 1 ) = 25.0; + DataHeatBalFanSys::TempTstatAir( 1 ) = 25.1; + DataHeatBalance::Zone.allocate( NumZones ); + DataHeatBalance::Zone( 1 ).Name = "SPACE1-1"; + + DataAirLoop::AirToZoneNodeInfo.allocate( 1 ); + DataAirLoop::AirToZoneNodeInfo( 1 ).NumZonesCooled = 1; + DataAirLoop::AirToZoneNodeInfo( 1 ).CoolCtrlZoneNums.allocate( 1 ); + DataAirLoop::AirToZoneNodeInfo( 1 ).CoolCtrlZoneNums( 1 ) = 1; + DataZoneEquipment::ZoneEquipConfig.allocate( DataZoneEquipment::NumOfZones ); + DataZoneEquipment::ZoneEquipConfig( 1 ).ZoneName = "SPACE1-1"; + DataZoneEquipment::ZoneEquipConfig( 1 ).ActualZoneNum = 1; + DataZoneEquipment::ZoneEquipConfig( 1 ).ZoneNode = 1; + DataZoneEquipment::ZoneEquipConfig( 1 ).AirLoopNum = 1; + + SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).Name = "System Avail"; + SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).CtrlType = SystemAvailabilityManager::CycleOnAny; + SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).SchedPtr = 1; + SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).FanSchedPtr = 2; + SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).TempTolRange = 0.4; + SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).CyclingTimeSteps = 4; + SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).CtrlZoneListName = DataHeatBalance::Zone( 1 ).Name; + SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).NumOfCtrlZones = NumZones; + SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).CtrlZonePtrs.allocate( 1 ); + SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).CtrlZonePtrs( 1 ) = 1; + SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).CoolingZoneListName = DataHeatBalance::Zone( 1 ).Name; + SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).NumOfCoolingZones = NumZones; + SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).CoolingZonePtrs = NumZones; + ScheduleManager::Schedule.allocate( 2 ); + ScheduleManager::Schedule( 1 ).CurrentValue = 1; + ScheduleManager::Schedule( 2 ).CurrentValue = 0; + + // Cycling Run Time Control Type = FixedRunTime + // and current time is within the run time period, starting time is less than stopping time + DataGlobals::SimTimeSteps = 0; + DataAirLoop::PriAirSysAvailMgr( PriAirSysNum ).StartTime = 0.0; + DataAirLoop::PriAirSysAvailMgr( PriAirSysNum ).StopTime = 4.0; + SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).CycRunTimeCntrlType = SystemAvailabilityManager::FixedRunTime; + SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).AvailStatus = 0; + SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).PriorAvailStatus = 2; + SystemAvailabilityManager::CalcNCycSysAvailMgr( SysAvailNum, PriAirSysNum, AvailStatus ); + // Check that the system is cycling On + EXPECT_EQ( DataHVACGlobals::CycleOn, SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).AvailStatus ); + // Starting time is equal to stopping time + DataGlobals::SimTimeSteps = 4; + DataAirLoop::PriAirSysAvailMgr( PriAirSysNum ).StartTime = 4.0; + DataAirLoop::PriAirSysAvailMgr( PriAirSysNum ).StopTime = 4.0; + SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).CycRunTimeCntrlType = SystemAvailabilityManager::FixedRunTime; + SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).AvailStatus = 2; + SystemAvailabilityManager::CalcNCycSysAvailMgr( SysAvailNum, PriAirSysNum, AvailStatus ); + // Check that the system is no action mode because of run time limit + EXPECT_EQ( DataHVACGlobals::NoAction, SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).AvailStatus ); + + // Cycling Run Time Control Type = Thermostat, Run Time has no effect + // starting time is less than stopping time, control is driven by temp differential + SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).CtrlType = SystemAvailabilityManager::CycleOnControlZone; + SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).CycRunTimeCntrlType = SystemAvailabilityManager::Thermostat; + SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).AvailStatus = 0; + DataGlobals::SimTimeSteps = 0; + DataAirLoop::PriAirSysAvailMgr( PriAirSysNum ).StartTime = 0.0; + DataAirLoop::PriAirSysAvailMgr( PriAirSysNum ).StopTime = 4.0; + SystemAvailabilityManager::CalcNCycSysAvailMgr( SysAvailNum, PriAirSysNum, AvailStatus ); + // Check that the system is cycling On, 25.1 > 25.0 + 0.05 + EXPECT_EQ( DataHVACGlobals::CycleOn, SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).AvailStatus ); + + // Cycling Run Time Control Type = Thermostat, Run Time has no effect + // starting time and stopping time are the same, control is driven by temp differential + DataGlobals::SimTimeSteps = 4; + DataAirLoop::PriAirSysAvailMgr( PriAirSysNum ).StartTime = 4.0; + DataAirLoop::PriAirSysAvailMgr( PriAirSysNum ).StopTime = 4.0; + SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).AvailStatus = 0; + // reduce zone air temperature within the tolerance (0.05) to turn off night cycling + DataHeatBalFanSys::TempTstatAir( 1 ) = 25.1; + SystemAvailabilityManager::CalcNCycSysAvailMgr( SysAvailNum, PriAirSysNum, AvailStatus ); + // Check that the system is cycling On, run time has no effect, // 25.1 > 25.0 + 0.05 + EXPECT_EQ( DataHVACGlobals::CycleOn, SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).AvailStatus ); + + // Cycling Run Time Control Type = Thermostat, Run Time has no effect + // starting time and stopping time are the same, control is driven by temp differential + DataGlobals::SimTimeSteps = 4; + DataAirLoop::PriAirSysAvailMgr( PriAirSysNum ).StartTime = 4.0; + DataAirLoop::PriAirSysAvailMgr( PriAirSysNum ).StopTime = 4.0; + SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).AvailStatus = 2; + // Reduce zone air temperature within the tolerance (0.05) to turn off night cycling + DataHeatBalFanSys::TempTstatAir( 1 ) = 25.04; + SystemAvailabilityManager::CalcNCycSysAvailMgr( SysAvailNum, PriAirSysNum, AvailStatus ); + // Check that the system is no action mode, 25.04 < 25.0 + 0.05 + EXPECT_EQ( DataHVACGlobals::NoAction, SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).AvailStatus ); + + // Cycling Run Time Control Type = ThermostatWithMinimumRunTime and + // starting time and stopping time are the same, control is driven by temp differential + DataGlobals::SimTimeSteps = 4; + DataAirLoop::PriAirSysAvailMgr( PriAirSysNum ).StartTime = 4.0; + DataAirLoop::PriAirSysAvailMgr( PriAirSysNum ).StopTime = 4.0; + SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).CycRunTimeCntrlType = SystemAvailabilityManager::ThermostatWithMinimumRunTime; + SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).AvailStatus = 0; + DataHeatBalFanSys::TempTstatAir( 1 ) = 25.1; + SystemAvailabilityManager::CalcNCycSysAvailMgr( SysAvailNum, PriAirSysNum, AvailStatus ); + // Check that the system is cycling On, zone air temp is outside T tolerance limits of 0.05, 25.1 > 25.0 + 0.05 + EXPECT_EQ( DataHVACGlobals::CycleOn, SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).AvailStatus ); + + // Cycling Run Time Control Type = ThermostatWithMinimumRunTime and + // starting time and stopping time are the same, control is driven by temp differential + DataGlobals::SimTimeSteps = 4; + DataAirLoop::PriAirSysAvailMgr( PriAirSysNum ).StartTime = 4.0; + DataAirLoop::PriAirSysAvailMgr( PriAirSysNum ).StopTime = 4.0; + SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).AvailStatus = 2; + // Reduce zone air temperature within the tolerance (0.05) to turn off night cycling + DataHeatBalFanSys::TempTstatAir( 1 ) = 25.04; + SystemAvailabilityManager::CalcNCycSysAvailMgr( SysAvailNum, PriAirSysNum, AvailStatus ); + // Check that the system is no action mode, zone air temp is within T tolerance limits of 0.05, 25.04 < 25.0 + 0.05 + EXPECT_EQ( DataHVACGlobals::NoAction, SystemAvailabilityManager::NCycSysAvailMgrData( 1 ).AvailStatus ); +} \ No newline at end of file