LCOV - code coverage report
Current view: top level - EnergyPlus - ChillerElectricASHRAE205.cc (source / functions) Coverage Total Hit
Test: lcov.output.filtered Lines: 0.0 % 755 0
Test Date: 2025-05-22 16:09:37 Functions: 0.0 % 13 0

            Line data    Source code
       1              : // EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois,
       2              : // The Regents of the University of California, through Lawrence Berkeley National Laboratory
       3              : // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge
       4              : // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other
       5              : // contributors. All rights reserved.
       6              : //
       7              : // NOTICE: This Software was developed under funding from the U.S. Department of Energy and the
       8              : // U.S. Government consequently retains certain rights. As such, the U.S. Government has been
       9              : // granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable,
      10              : // worldwide license in the Software to reproduce, distribute copies to the public, prepare
      11              : // derivative works, and perform publicly and display publicly, and to permit others to do so.
      12              : //
      13              : // Redistribution and use in source and binary forms, with or without modification, are permitted
      14              : // provided that the following conditions are met:
      15              : //
      16              : // (1) Redistributions of source code must retain the above copyright notice, this list of
      17              : //     conditions and the following disclaimer.
      18              : //
      19              : // (2) Redistributions in binary form must reproduce the above copyright notice, this list of
      20              : //     conditions and the following disclaimer in the documentation and/or other materials
      21              : //     provided with the distribution.
      22              : //
      23              : // (3) Neither the name of the University of California, Lawrence Berkeley National Laboratory,
      24              : //     the University of Illinois, U.S. Dept. of Energy nor the names of its contributors may be
      25              : //     used to endorse or promote products derived from this software without specific prior
      26              : //     written permission.
      27              : //
      28              : // (4) Use of EnergyPlus(TM) Name. If Licensee (i) distributes the software in stand-alone form
      29              : //     without changes from the version obtained under this License, or (ii) Licensee makes a
      30              : //     reference solely to the software portion of its product, Licensee must refer to the
      31              : //     software as "EnergyPlus version X" software, where "X" is the version number Licensee
      32              : //     obtained under this License and may not use a different name for the software. Except as
      33              : //     specifically required in this Section (4), Licensee shall not use in a company name, a
      34              : //     product name, in advertising, publicity, or other promotional activities any name, trade
      35              : //     name, trademark, logo, or other designation of "EnergyPlus", "E+", "e+" or confusingly
      36              : //     similar designation, without the U.S. Department of Energy's prior written consent.
      37              : //
      38              : // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
      39              : // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
      40              : // AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
      41              : // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
      42              : // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
      43              : // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
      44              : // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
      45              : // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
      46              : // POSSIBILITY OF SUCH DAMAGE.
      47              : 
      48              : // C++ Headers
      49              : #include <cassert>
      50              : #include <cmath>
      51              : #include <string>
      52              : 
      53              : // ObjexxFCL Headers
      54              : #include <ObjexxFCL/Fmath.hh>
      55              : 
      56              : // EnergyPlus Headers
      57              : #include "rs0001_factory.h"
      58              : #include <EnergyPlus/Autosizing/All_Simple_Sizing.hh>
      59              : #include <EnergyPlus/BranchNodeConnections.hh>
      60              : #include <EnergyPlus/ChillerElectricASHRAE205.hh>
      61              : #include <EnergyPlus/CurveManager.hh>
      62              : #include <EnergyPlus/Data/EnergyPlusData.hh>
      63              : #include <EnergyPlus/DataBranchAirLoopPlant.hh>
      64              : #include <EnergyPlus/DataEnvironment.hh>
      65              : #include <EnergyPlus/DataHVACGlobals.hh>
      66              : #include <EnergyPlus/DataHeatBalance.hh>
      67              : #include <EnergyPlus/DataIPShortCuts.hh>
      68              : #include <EnergyPlus/DataLoopNode.hh>
      69              : #include <EnergyPlus/DataSizing.hh>
      70              : #include <EnergyPlus/DataSystemVariables.hh>
      71              : #include <EnergyPlus/EMSManager.hh>
      72              : #include <EnergyPlus/EnergyPlusLogger.hh>
      73              : #include <EnergyPlus/FaultsManager.hh>
      74              : #include <EnergyPlus/FileSystem.hh>
      75              : #include <EnergyPlus/FluidProperties.hh>
      76              : #include <EnergyPlus/General.hh>
      77              : #include <EnergyPlus/GeneralRoutines.hh>
      78              : #include <EnergyPlus/GlobalNames.hh>
      79              : #include <EnergyPlus/HeatBalanceInternalHeatGains.hh>
      80              : #include <EnergyPlus/InputProcessing/InputProcessor.hh>
      81              : #include <EnergyPlus/NodeInputManager.hh>
      82              : #include <EnergyPlus/OutAirNodeManager.hh>
      83              : #include <EnergyPlus/OutputProcessor.hh>
      84              : #include <EnergyPlus/OutputReportPredefined.hh>
      85              : #include <EnergyPlus/Plant/DataPlant.hh>
      86              : #include <EnergyPlus/Plant/PlantLocation.hh>
      87              : #include <EnergyPlus/PlantUtilities.hh>
      88              : #include <EnergyPlus/ScheduleManager.hh>
      89              : #include <EnergyPlus/UtilityRoutines.hh>
      90              : #include <EnergyPlus/ZoneTempPredictorCorrector.hh>
      91              : 
      92              : namespace EnergyPlus::ChillerElectricASHRAE205 {
      93              : 
      94              : constexpr std::array<std::string_view, static_cast<int>(AmbientTempIndicator::Num) - 1> AmbientTempNamesUC{
      95              :     "SCHEDULE",
      96              :     "ZONE",
      97              :     "OUTDOORS",
      98              : };
      99              : 
     100              : std::map<std::string, Btwxt::InterpolationMethod> InterpMethods = // NOLINT(cert-err58-cpp)
     101              :     {{"LINEAR", Btwxt::InterpolationMethod::linear}, {"CUBIC", Btwxt::InterpolationMethod::cubic}};
     102              : 
     103            0 : void getChillerASHRAE205Input(EnergyPlusData &state)
     104              : {
     105              :     static constexpr std::string_view RoutineName("getChillerASHRAE205Input: "); // include trailing blank space
     106              :     static constexpr std::string_view routineName = "getChillerASHRAE205Input";
     107              : 
     108              :     using namespace tk205;
     109            0 :     RSInstanceFactory::register_factory("RS0001", std::make_shared<RS0001Factory>());
     110              : 
     111            0 :     bool ErrorsFound{false};
     112              : 
     113            0 :     auto &s_ip = state.dataInputProcessing->inputProcessor;
     114            0 :     auto &s_ipsc = state.dataIPShortCut;
     115              : 
     116            0 :     state.dataIPShortCut->cCurrentModuleObject = ChillerElectricASHRAE205::ASHRAE205ChillerSpecs::ObjectType;
     117            0 :     int numElectric205Chillers = s_ip->getNumObjectsFound(state, state.dataIPShortCut->cCurrentModuleObject);
     118              : 
     119            0 :     if (numElectric205Chillers <= 0) {
     120            0 :         ShowSevereError(state, format("No {} equipment specified in input file", state.dataIPShortCut->cCurrentModuleObject));
     121            0 :         ErrorsFound = true;
     122              :     }
     123              : 
     124            0 :     state.dataChillerElectricASHRAE205->Electric205Chiller.allocate(numElectric205Chillers);
     125              : 
     126            0 :     auto const &ChillerInstances = s_ip->epJSON.find(state.dataIPShortCut->cCurrentModuleObject).value();
     127            0 :     int ChillerNum{0};
     128            0 :     auto const &objectSchemaProps = s_ip->getObjectSchemaProps(state, state.dataIPShortCut->cCurrentModuleObject);
     129              : 
     130            0 :     for (auto &instance : ChillerInstances.items()) {
     131            0 :         auto const &fields = instance.value();
     132            0 :         std::string const &thisObjectName = instance.key();
     133              : 
     134            0 :         ErrorObjectHeader eoh{routineName, s_ipsc->cCurrentModuleObject, thisObjectName};
     135              : 
     136            0 :         GlobalNames::VerifyUniqueChillerName(
     137            0 :             state, state.dataIPShortCut->cCurrentModuleObject, thisObjectName, ErrorsFound, state.dataIPShortCut->cCurrentModuleObject + " Name");
     138              : 
     139            0 :         ++ChillerNum;
     140            0 :         auto &thisChiller = state.dataChillerElectricASHRAE205->Electric205Chiller(ChillerNum);
     141            0 :         thisChiller.Name = Util::makeUPPER(thisObjectName);
     142              : 
     143            0 :         s_ip->markObjectAsUsed(state.dataIPShortCut->cCurrentModuleObject, thisObjectName);
     144              : 
     145            0 :         std::string const rep_file_name = s_ip->getAlphaFieldValue(fields, objectSchemaProps, "representation_file_name");
     146            0 :         fs::path rep_file_path = DataSystemVariables::CheckForActualFilePath(state, fs::path(rep_file_name), std::string(RoutineName));
     147            0 :         if (rep_file_path.empty()) {
     148            0 :             ErrorsFound = true;
     149              :             // Given that several of the following expressions require the representation file to be present, we'll just throw a fatal here.
     150              :             // The ErrorsFound flag is still set to true here so that in the future, if we defer the fatal until later in this routine, it will still
     151              :             // be set The CheckForActualFilePath function emits some nice information to the ERR file, so we just need a simple fatal here
     152            0 :             ShowFatalError(state, "Program terminates due to the missing ASHRAE 205 RS0001 representation file.");
     153              :         }
     154              :         // Since logger context must persist across all calls to libtk205/btwxt, it must be a member
     155            0 :         thisChiller.LoggerContext = {&state, format("{} \"{}\"", state.dataIPShortCut->cCurrentModuleObject, thisObjectName)};
     156            0 :         thisChiller.Representation = std::dynamic_pointer_cast<tk205::rs0001_ns::RS0001>(
     157            0 :             RSInstanceFactory::create("RS0001", FileSystem::toString(rep_file_path).c_str(), std::make_shared<EnergyPlusLogger>()));
     158            0 :         if (nullptr == thisChiller.Representation) {
     159            0 :             ShowSevereError(state, format("{} is not an instance of an ASHRAE205 Chiller.", rep_file_path));
     160            0 :             ErrorsFound = true;
     161              :         }
     162            0 :         thisChiller.Representation->performance.performance_map_cooling.get_logger()->set_message_context(&thisChiller.LoggerContext);
     163            0 :         thisChiller.Representation->performance.performance_map_standby.get_logger()->set_message_context(&thisChiller.LoggerContext);
     164            0 :         thisChiller.InterpolationType =
     165            0 :             InterpMethods[Util::makeUPPER(s_ip->getAlphaFieldValue(fields, objectSchemaProps, "performance_interpolation_method"))];
     166              : 
     167            0 :         const auto &compressorSequence = thisChiller.Representation->performance.performance_map_cooling.grid_variables.compressor_sequence_number;
     168              :         // minmax_element is sound but perhaps overkill; as sequence numbers are required by A205 to be in ascending order
     169            0 :         const auto minmaxSequenceNum = std::minmax_element(compressorSequence.begin(), compressorSequence.end());
     170            0 :         thisChiller.MinSequenceNumber = *(minmaxSequenceNum.first);
     171            0 :         thisChiller.MaxSequenceNumber = *(minmaxSequenceNum.second);
     172              : 
     173            0 :         if (fields.count("rated_capacity")) {
     174            0 :             ShowWarningError(state, format("{}{}=\"{}\"", std::string{RoutineName}, state.dataIPShortCut->cCurrentModuleObject, thisChiller.Name));
     175            0 :             ShowContinueError(state, "Rated Capacity field is not yet supported for ASHRAE 205 representations.");
     176              :         }
     177              : 
     178            0 :         thisChiller.RefCap = 0.0;               // ip->getRealFieldValue(fields, objectSchemaProps, "rated_capacity");
     179            0 :         thisChiller.RefCapWasAutoSized = false; // for now
     180              : 
     181              :         //        if (thisChiller.RefCap == DataSizing::AutoSize) {
     182              :         //            thisChiller.RefCapWasAutoSized = true;
     183              :         //        }
     184              :         //        if (thisChiller.RefCap == 0.0) {
     185              :         //            ShowSevereError(
     186              :         //                state, format("{}{}=\"{}\"",std::string{RoutineName},state.dataIPShortCut->cCurrentModuleObject,thisChiller.Name);
     187              :         //            ShowContinueError(state, format("Invalid {}={:.2R}", "Rated Capacity", thisChiller.RefCap));
     188              :         //            ErrorsFound = true;
     189              :         //        }
     190              : 
     191            0 :         std::string const evap_inlet_node_name = s_ip->getAlphaFieldValue(fields, objectSchemaProps, "chilled_water_inlet_node_name");
     192            0 :         std::string const evap_outlet_node_name = s_ip->getAlphaFieldValue(fields, objectSchemaProps, "chilled_water_outlet_node_name");
     193            0 :         if (evap_inlet_node_name.empty() || evap_outlet_node_name.empty()) {
     194            0 :             ShowSevereError(state, format("{}{}=\"{}\"", std::string{RoutineName}, state.dataIPShortCut->cCurrentModuleObject, thisChiller.Name));
     195            0 :             ShowContinueError(state, "Evaporator Inlet or Outlet Node Name is blank.");
     196            0 :             ErrorsFound = true;
     197              :         }
     198            0 :         thisChiller.EvapInletNodeNum = NodeInputManager::GetOnlySingleNode(state,
     199              :                                                                            evap_inlet_node_name,
     200              :                                                                            ErrorsFound,
     201              :                                                                            DataLoopNode::ConnectionObjectType::ChillerElectricASHRAE205,
     202            0 :                                                                            thisChiller.Name,
     203              :                                                                            DataLoopNode::NodeFluidType::Water,
     204              :                                                                            DataLoopNode::ConnectionType::Inlet,
     205              :                                                                            NodeInputManager::CompFluidStream::Primary,
     206              :                                                                            DataLoopNode::ObjectIsNotParent);
     207            0 :         thisChiller.EvapOutletNodeNum = NodeInputManager::GetOnlySingleNode(state,
     208              :                                                                             evap_outlet_node_name,
     209              :                                                                             ErrorsFound,
     210              :                                                                             DataLoopNode::ConnectionObjectType::ChillerElectricASHRAE205,
     211            0 :                                                                             thisChiller.Name,
     212              :                                                                             DataLoopNode::NodeFluidType::Water,
     213              :                                                                             DataLoopNode::ConnectionType::Outlet,
     214              :                                                                             NodeInputManager::CompFluidStream::Primary,
     215              :                                                                             DataLoopNode::ObjectIsNotParent);
     216            0 :         BranchNodeConnections::TestCompSet(
     217            0 :             state, state.dataIPShortCut->cCurrentModuleObject, thisChiller.Name, evap_inlet_node_name, evap_outlet_node_name, "Chilled Water Nodes");
     218              : 
     219            0 :         thisChiller.CondenserType = DataPlant::CondenserType::WaterCooled;
     220              : 
     221            0 :         std::string const cond_inlet_node_name = s_ip->getAlphaFieldValue(fields, objectSchemaProps, "condenser_inlet_node_name");
     222            0 :         std::string const cond_outlet_node_name = s_ip->getAlphaFieldValue(fields, objectSchemaProps, "condenser_outlet_node_name");
     223            0 :         if (cond_inlet_node_name.empty() || cond_outlet_node_name.empty()) {
     224            0 :             ShowSevereError(state, format("{}{}=\"{}\"", std::string{RoutineName}, state.dataIPShortCut->cCurrentModuleObject, thisChiller.Name));
     225            0 :             ShowContinueError(state, "Condenser Inlet or Outlet Node Name is blank.");
     226            0 :             ErrorsFound = true;
     227              :         }
     228            0 :         thisChiller.CondInletNodeNum = NodeInputManager::GetOnlySingleNode(state,
     229              :                                                                            cond_inlet_node_name,
     230              :                                                                            ErrorsFound,
     231              :                                                                            DataLoopNode::ConnectionObjectType::ChillerElectricASHRAE205,
     232            0 :                                                                            thisChiller.Name,
     233              :                                                                            DataLoopNode::NodeFluidType::Water,
     234              :                                                                            DataLoopNode::ConnectionType::Inlet,
     235              :                                                                            NodeInputManager::CompFluidStream::Secondary,
     236              :                                                                            DataLoopNode::ObjectIsNotParent);
     237              : 
     238            0 :         thisChiller.CondOutletNodeNum = NodeInputManager::GetOnlySingleNode(state,
     239              :                                                                             cond_outlet_node_name,
     240              :                                                                             ErrorsFound,
     241              :                                                                             DataLoopNode::ConnectionObjectType::ChillerElectricASHRAE205,
     242            0 :                                                                             thisChiller.Name,
     243              :                                                                             DataLoopNode::NodeFluidType::Water,
     244              :                                                                             DataLoopNode::ConnectionType::Outlet,
     245              :                                                                             NodeInputManager::CompFluidStream::Secondary,
     246              :                                                                             DataLoopNode::ObjectIsNotParent);
     247              : 
     248            0 :         BranchNodeConnections::TestCompSet(state,
     249            0 :                                            state.dataIPShortCut->cCurrentModuleObject,
     250              :                                            thisChiller.Name,
     251              :                                            cond_inlet_node_name,
     252              :                                            cond_outlet_node_name,
     253              :                                            "Condenser Water Nodes");
     254              : 
     255            0 :         thisChiller.FlowMode = static_cast<DataPlant::FlowMode>(
     256            0 :             getEnumValue(DataPlant::FlowModeNamesUC, s_ip->getAlphaFieldValue(fields, objectSchemaProps, "chiller_flow_mode")));
     257              : 
     258            0 :         if (thisChiller.FlowMode == DataPlant::FlowMode::Invalid) {
     259            0 :             ShowSevereError(state, format("{}{}=\"{}\"", std::string{RoutineName}, state.dataIPShortCut->cCurrentModuleObject, thisObjectName));
     260            0 :             ShowContinueError(state, format("Invalid Chiller Flow Mode = {}", fields.at("chiller_flow_mode").get<std::string>()));
     261            0 :             ShowContinueError(state, "Available choices are ConstantFlow, NotModulated, or LeavingSetpointModulated");
     262            0 :             ShowContinueError(state, "Flow mode NotModulated is assumed and the simulation continues.");
     263            0 :             thisChiller.FlowMode = DataPlant::FlowMode::NotModulated;
     264              :         };
     265              : 
     266            0 :         thisChiller.SizFac = fields.at("sizing_factor").get<Real64>();
     267            0 :         if (thisChiller.SizFac <= 0.0) {
     268            0 :             thisChiller.SizFac = 1.0;
     269              :         }
     270              : 
     271              :         {
     272            0 :             auto &tmpFlowRate = fields.at("chilled_water_maximum_requested_flow_rate");
     273            0 :             if (tmpFlowRate == "Autosize") {
     274            0 :                 thisChiller.EvapVolFlowRate = DataSizing::AutoSize;
     275            0 :                 thisChiller.EvapVolFlowRateWasAutoSized = true;
     276              :             } else {
     277            0 :                 thisChiller.EvapVolFlowRate = tmpFlowRate.get<Real64>();
     278              :             }
     279              :         }
     280              :         {
     281            0 :             auto &tmpFlowRate = fields.at("condenser_maximum_requested_flow_rate");
     282            0 :             if (tmpFlowRate == "Autosize") {
     283            0 :                 thisChiller.CondVolFlowRate = DataSizing::AutoSize;
     284            0 :                 thisChiller.CondVolFlowRateWasAutoSized = true;
     285              :             } else {
     286            0 :                 thisChiller.CondVolFlowRate = tmpFlowRate.get<Real64>();
     287              :             }
     288              :         }
     289              : 
     290            0 :         thisChiller.AmbientTempType = static_cast<AmbientTempIndicator>(
     291            0 :             getEnumValue(AmbientTempNamesUC, Util::makeUPPER(s_ip->getAlphaFieldValue(fields, objectSchemaProps, "ambient_temperature_indicator"))));
     292            0 :         switch (thisChiller.AmbientTempType) {
     293            0 :         case AmbientTempIndicator::Schedule: {
     294            0 :             std::string const ambient_temp_schedule = s_ip->getAlphaFieldValue(fields, objectSchemaProps, "ambient_temperature_schedule");
     295            0 :             if ((thisChiller.ambientTempSched = Sched::GetSchedule(state, ambient_temp_schedule)) == nullptr) {
     296            0 :                 ShowSevereItemNotFound(state, eoh, "Ambient Temperature Schedule", ambient_temp_schedule);
     297            0 :                 ErrorsFound = true;
     298              :             }
     299              : 
     300            0 :             break;
     301            0 :         }
     302            0 :         case AmbientTempIndicator::TempZone: {
     303            0 :             std::string const ambient_temp_zone_name = s_ip->getAlphaFieldValue(fields, objectSchemaProps, "ambient_temperature_zone_name");
     304            0 :             thisChiller.AmbientTempZone = Util::FindItemInList(ambient_temp_zone_name, state.dataHeatBal->Zone);
     305            0 :             if (thisChiller.AmbientTempZone == 0) {
     306            0 :                 ShowSevereError(state,
     307            0 :                                 format("{} = {}:  Ambient Temperature Zone not found = {}",
     308            0 :                                        state.dataIPShortCut->cCurrentModuleObject,
     309              :                                        thisObjectName,
     310              :                                        ambient_temp_zone_name));
     311            0 :                 ErrorsFound = true;
     312              :             } else {
     313            0 :                 SetupZoneInternalGain(state,
     314              :                                       thisChiller.AmbientTempZone,
     315              :                                       thisChiller.Name,
     316              :                                       DataHeatBalance::IntGainType::ElectricEquipment,
     317              :                                       &thisChiller.AmbientZoneGain);
     318              :             }
     319            0 :             break;
     320            0 :         }
     321            0 :         case AmbientTempIndicator::OutsideAir: {
     322              :             std::string const ambient_temp_outdoor_node =
     323            0 :                 s_ip->getAlphaFieldValue(fields, objectSchemaProps, "ambient_temperature_outdoor_air_node_name");
     324            0 :             thisChiller.AmbientTempOutsideAirNode = NodeInputManager::GetOnlySingleNode(state,
     325              :                                                                                         ambient_temp_outdoor_node,
     326              :                                                                                         ErrorsFound,
     327              :                                                                                         DataLoopNode::ConnectionObjectType::ChillerElectricASHRAE205,
     328            0 :                                                                                         thisChiller.Name,
     329              :                                                                                         DataLoopNode::NodeFluidType::Air,
     330              :                                                                                         DataLoopNode::ConnectionType::OutsideAirReference,
     331              :                                                                                         NodeInputManager::CompFluidStream::Primary,
     332              :                                                                                         DataLoopNode::ObjectIsNotParent);
     333            0 :             if (fields.count("ambient_temperature_outdoor_air_node_name")) {
     334            0 :                 if (!OutAirNodeManager::CheckOutAirNodeNumber(state, thisChiller.AmbientTempOutsideAirNode)) {
     335            0 :                     ShowSevereError(state,
     336            0 :                                     format("{} = {}: Outdoor Air Node not on OutdoorAir:NodeList or OutdoorAir:Node",
     337            0 :                                            state.dataIPShortCut->cCurrentModuleObject,
     338              :                                            thisObjectName));
     339            0 :                     ShowContinueError(state, format("...Referenced Node Name={}", ambient_temp_outdoor_node));
     340            0 :                     ErrorsFound = true;
     341              :                 }
     342              :             } else {
     343            0 :                 ShowSevereError(state, format("{} = {}", state.dataIPShortCut->cCurrentModuleObject, ambient_temp_outdoor_node));
     344            0 :                 ShowContinueError(state, "An Ambient Outdoor Air Node name must be used when the Ambient Temperature Indicator is Outdoors.");
     345            0 :                 ErrorsFound = true;
     346              :             }
     347              : 
     348            0 :             break;
     349            0 :         }
     350            0 :         default: {
     351            0 :             ShowSevereError(state,
     352            0 :                             format("{} = {}:  Invalid Ambient Temperature Indicator entered={}",
     353            0 :                                    state.dataIPShortCut->cCurrentModuleObject,
     354              :                                    thisObjectName,
     355            0 :                                    s_ip->getAlphaFieldValue(fields, objectSchemaProps, "ambient_temperature_indicator")));
     356            0 :             ShowContinueError(state, " Valid entries are SCHEDULE, ZONE, and OUTDOORS.");
     357            0 :             ErrorsFound = true;
     358            0 :             break;
     359              :         }
     360              :         }
     361              :         // end Ambient temperature
     362            0 :         std::string const oil_cooler_inlet_node = s_ip->getAlphaFieldValue(fields, objectSchemaProps, "oil_cooler_inlet_node_name");
     363            0 :         std::string const oil_cooler_outlet_node = s_ip->getAlphaFieldValue(fields, objectSchemaProps, "oil_cooler_outlet_node_name");
     364            0 :         if (!oil_cooler_inlet_node.empty() && !oil_cooler_outlet_node.empty()) {
     365            0 :             thisChiller.OilCoolerInletNode = NodeInputManager::GetOnlySingleNode(state,
     366              :                                                                                  oil_cooler_inlet_node,
     367              :                                                                                  ErrorsFound,
     368              :                                                                                  DataLoopNode::ConnectionObjectType::ChillerElectricASHRAE205,
     369            0 :                                                                                  thisChiller.Name,
     370              :                                                                                  DataLoopNode::NodeFluidType::Water,
     371              :                                                                                  DataLoopNode::ConnectionType::Inlet,
     372              :                                                                                  NodeInputManager::CompFluidStream::Tertiary,
     373              :                                                                                  DataLoopNode::ObjectIsNotParent);
     374            0 :             thisChiller.OilCoolerOutletNode = NodeInputManager::GetOnlySingleNode(state,
     375              :                                                                                   oil_cooler_outlet_node,
     376              :                                                                                   ErrorsFound,
     377              :                                                                                   DataLoopNode::ConnectionObjectType::ChillerElectricASHRAE205,
     378            0 :                                                                                   thisChiller.Name,
     379              :                                                                                   DataLoopNode::NodeFluidType::Water,
     380              :                                                                                   DataLoopNode::ConnectionType::Outlet,
     381              :                                                                                   NodeInputManager::CompFluidStream::Tertiary,
     382              :                                                                                   DataLoopNode::ObjectIsNotParent);
     383            0 :             BranchNodeConnections::TestCompSet(state,
     384            0 :                                                state.dataIPShortCut->cCurrentModuleObject,
     385              :                                                thisChiller.Name,
     386              :                                                oil_cooler_inlet_node,
     387              :                                                oil_cooler_outlet_node,
     388              :                                                "Oil Cooler Water Nodes");
     389              :         }
     390            0 :         std::string const aux_heat_inlet_node = s_ip->getAlphaFieldValue(fields, objectSchemaProps, "auxiliary_inlet_node_name");
     391            0 :         std::string const aux_heat_outlet_node = s_ip->getAlphaFieldValue(fields, objectSchemaProps, "auxiliary_outlet_node_name");
     392            0 :         if (!aux_heat_inlet_node.empty() && !aux_heat_outlet_node.empty()) {
     393              : 
     394            0 :             thisChiller.AuxiliaryHeatInletNode = NodeInputManager::GetOnlySingleNode(state,
     395              :                                                                                      aux_heat_inlet_node,
     396              :                                                                                      ErrorsFound,
     397              :                                                                                      DataLoopNode::ConnectionObjectType::ChillerElectricASHRAE205,
     398            0 :                                                                                      thisChiller.Name,
     399              :                                                                                      DataLoopNode::NodeFluidType::Water,
     400              :                                                                                      DataLoopNode::ConnectionType::Inlet,
     401              :                                                                                      NodeInputManager::CompFluidStream::Quaternary,
     402              :                                                                                      DataLoopNode::ObjectIsNotParent);
     403            0 :             thisChiller.AuxiliaryHeatOutletNode = NodeInputManager::GetOnlySingleNode(state,
     404              :                                                                                       aux_heat_outlet_node,
     405              :                                                                                       ErrorsFound,
     406              :                                                                                       DataLoopNode::ConnectionObjectType::ChillerElectricASHRAE205,
     407            0 :                                                                                       thisChiller.Name,
     408              :                                                                                       DataLoopNode::NodeFluidType::Water,
     409              :                                                                                       DataLoopNode::ConnectionType::Outlet,
     410              :                                                                                       NodeInputManager::CompFluidStream::Quaternary,
     411              :                                                                                       DataLoopNode::ObjectIsNotParent);
     412            0 :             BranchNodeConnections::TestCompSet(state,
     413            0 :                                                state.dataIPShortCut->cCurrentModuleObject,
     414              :                                                thisChiller.Name,
     415              :                                                aux_heat_inlet_node,
     416              :                                                aux_heat_outlet_node,
     417              :                                                "Auxiliary Water Nodes");
     418              :         }
     419              : 
     420              :         // TODO: When implemented, add ...WasAutoSized variables
     421            0 :         if (fields.count("oil_cooler_design_flow_rate")) {
     422            0 :             thisChiller.OilCoolerVolFlowRate = fields.at("oil_cooler_design_flow_rate").get<Real64>();
     423              :         }
     424            0 :         if (fields.count("auxiliary_equipment_design_flow_rate")) {
     425            0 :             thisChiller.AuxiliaryVolFlowRate = fields.at("auxiliary_equipment_design_flow_rate").get<Real64>();
     426              :         }
     427              : 
     428            0 :         if (fields.count("end_use_subcategory")) {
     429            0 :             thisChiller.EndUseSubcategory = s_ip->getAlphaFieldValue(fields, objectSchemaProps, "end_use_subcategory");
     430              :         } else {
     431            0 :             thisChiller.EndUseSubcategory = "General";
     432              :         }
     433              :         // Set reference conditions
     434            0 :         thisChiller.TempRefCondIn = 29.44;
     435            0 :         thisChiller.TempRefEvapOut = 6.67;
     436            0 :     }
     437              : 
     438            0 :     if (ErrorsFound) {
     439            0 :         ShowFatalError(state, format("Errors found in processing input for {}", state.dataIPShortCut->cCurrentModuleObject));
     440              :     }
     441            0 : }
     442              : 
     443            0 : ASHRAE205ChillerSpecs *ASHRAE205ChillerSpecs::factory(EnergyPlusData &state, std::string const &objectName)
     444              : {
     445            0 :     if (state.dataChillerElectricASHRAE205->getInputFlag) {
     446            0 :         getChillerASHRAE205Input(state);
     447            0 :         state.dataChillerElectricASHRAE205->getInputFlag = false;
     448              :     }
     449            0 :     auto thisObj = std::find_if(state.dataChillerElectricASHRAE205->Electric205Chiller.begin(),
     450            0 :                                 state.dataChillerElectricASHRAE205->Electric205Chiller.end(),
     451            0 :                                 [&objectName](const ASHRAE205ChillerSpecs &myObj) { return myObj.Name == objectName; });
     452            0 :     if (thisObj != state.dataChillerElectricASHRAE205->Electric205Chiller.end()) return thisObj;
     453              :     // If we didn't find it, fatal
     454              :     ShowFatalError(state, format("ASHRAE205ChillerSpecs::factory: Error getting inputs for object named: {}", objectName)); // LCOV_EXCL_LINE
     455              :     return nullptr;                                                                                                         // LCOV_EXCL_LINE
     456              : }
     457              : 
     458            0 : void ASHRAE205ChillerSpecs::oneTimeInit_new(EnergyPlusData &state)
     459              : {
     460              :     // This function is called from GetPlantInput
     461              :     // Locate the chillers on the plant loops for later usage
     462            0 :     bool errFlag{false};
     463            0 :     PlantUtilities::ScanPlantLoopsForObject(
     464            0 :         state, this->Name, DataPlant::PlantEquipmentType::Chiller_ElectricASHRAE205, this->CWPlantLoc, errFlag, _, _, _, this->EvapInletNodeNum, _);
     465            0 :     if (this->CondenserType != DataPlant::CondenserType::AirCooled) {
     466            0 :         PlantUtilities::ScanPlantLoopsForObject(state,
     467              :                                                 this->Name,
     468              :                                                 DataPlant::PlantEquipmentType::Chiller_ElectricASHRAE205,
     469            0 :                                                 this->CDPlantLoc,
     470              :                                                 errFlag,
     471              :                                                 _,
     472              :                                                 _,
     473              :                                                 _,
     474            0 :                                                 this->CondInletNodeNum,
     475              :                                                 _);
     476            0 :         PlantUtilities::InterConnectTwoPlantLoopSides(
     477            0 :             state, this->CWPlantLoc, this->CDPlantLoc, DataPlant::PlantEquipmentType::Chiller_ElectricASHRAE205, true);
     478              :     }
     479            0 :     if (this->OilCoolerInletNode) {
     480            0 :         PlantUtilities::ScanPlantLoopsForObject(state,
     481              :                                                 this->Name,
     482              :                                                 DataPlant::PlantEquipmentType::Chiller_ElectricASHRAE205,
     483            0 :                                                 this->OCPlantLoc,
     484              :                                                 errFlag,
     485              :                                                 _,
     486              :                                                 _,
     487              :                                                 _,
     488            0 :                                                 this->OilCoolerInletNode,
     489              :                                                 _);
     490              :     }
     491            0 :     if (this->AuxiliaryHeatInletNode) {
     492            0 :         PlantUtilities::ScanPlantLoopsForObject(state,
     493              :                                                 this->Name,
     494              :                                                 DataPlant::PlantEquipmentType::Chiller_ElectricASHRAE205,
     495            0 :                                                 this->AHPlantLoc,
     496              :                                                 errFlag,
     497              :                                                 _,
     498              :                                                 _,
     499              :                                                 _,
     500            0 :                                                 this->AuxiliaryHeatInletNode,
     501              :                                                 _);
     502              :     }
     503              : // If and when heat recovery is implemented, uncomment
     504              : #if 0
     505              :         if (this->HeatRecActive) {
     506              :             PlantUtilities::ScanPlantLoopsForObject(state,
     507              :                                                     this->Name,
     508              :                                                     DataPlant::PlantEquipmentType::Chiller_ElectricASHRAE205,
     509              :                                                     this->HRPlantLoc,
     510              :                                                     errFlag,
     511              :                                                     _,
     512              :                                                     _,
     513              :                                                     _,
     514              :                                                     this->HeatRecInletNodeNum,
     515              :                                                     _);
     516              :             PlantUtilities::InterConnectTwoPlantLoopSides(
     517              :                     state, this->CWPlantLoc, this->HRPlantLoc, DataPlant::PlantEquipmentType::Chiller_ElectricASHRAE205, true);
     518              :         }
     519              : 
     520              :         if ((this->CondenserType != DataPlant::CondenserType::AirCooled) && (this->HeatRecActive)) {
     521              :             PlantUtilities::InterConnectTwoPlantLoopSides(
     522              :                     state, this->CDPlantLoc, this->HRPlantLoc, DataPlant::PlantEquipmentType::Chiller_ElectricASHRAE205, false);
     523              :         }
     524              : #endif // #if 0
     525              : 
     526            0 :     if (errFlag) {
     527            0 :         ShowFatalError(state, "InitElecASHRAE205Chiller: Program terminated due to previous condition(s).");
     528              :     }
     529              : 
     530            0 :     if (this->FlowMode == DataPlant::FlowMode::Constant) {
     531              :         // reset flow priority
     532            0 :         this->CWPlantLoc.comp->FlowPriority = DataPlant::LoopFlowStatus::NeedyIfLoopOn;
     533              :     }
     534              : 
     535            0 :     else if (this->FlowMode == DataPlant::FlowMode::LeavingSetpointModulated) {
     536              :         // reset flow priority
     537            0 :         this->CWPlantLoc.comp->FlowPriority = DataPlant::LoopFlowStatus::NeedyIfLoopOn;
     538              :         // check if setpoint on outlet node
     539            0 :         if ((state.dataLoopNodes->Node(this->EvapOutletNodeNum).TempSetPoint == DataLoopNode::SensedNodeFlagValue) &&
     540            0 :             (state.dataLoopNodes->Node(this->EvapOutletNodeNum).TempSetPointHi == DataLoopNode::SensedNodeFlagValue)) {
     541            0 :             if (!state.dataGlobal->AnyEnergyManagementSystemInModel) {
     542            0 :                 if (!this->ModulatedFlowErrDone) {
     543            0 :                     ShowWarningError(state, format("Missing temperature setpoint for LeavingSetpointModulated mode chiller named {}", this->Name));
     544            0 :                     ShowContinueError(
     545              :                         state, "  A temperature setpoint is needed at the outlet node of a chiller in variable flow mode, use a SetpointManager");
     546            0 :                     ShowContinueError(state, "  The overall loop setpoint will be assumed for chiller. The simulation continues ... ");
     547            0 :                     this->ModulatedFlowErrDone = true;
     548              :                 }
     549              :             } else {
     550              :                 // need call to EMS to check node
     551            0 :                 bool fatalError = false; // but not really fatal yet, but should be.
     552            0 :                 EMSManager::CheckIfNodeSetPointManagedByEMS(state, this->EvapOutletNodeNum, HVAC::CtrlVarType::Temp, fatalError);
     553            0 :                 state.dataLoopNodes->NodeSetpointCheck(this->EvapOutletNodeNum).needsSetpointChecking = false;
     554            0 :                 if (fatalError) {
     555            0 :                     if (!this->ModulatedFlowErrDone) {
     556            0 :                         ShowWarningError(state,
     557            0 :                                          format("Missing temperature setpoint for LeavingSetpointModulated mode chiller named {}", this->Name));
     558            0 :                         ShowContinueError(state,
     559              :                                           "  A temperature setpoint is needed at the outlet node of a chiller evaporator in variable flow mode");
     560            0 :                         ShowContinueError(state, "  use a Setpoint Manager to establish a setpoint at the chiller evaporator outlet node ");
     561            0 :                         ShowContinueError(state, "  or use an EMS actuator to establish a setpoint at the outlet node ");
     562            0 :                         ShowContinueError(state, "  The overall loop setpoint will be assumed for chiller. The simulation continues ... ");
     563            0 :                         this->ModulatedFlowErrDone = true;
     564              :                     }
     565              :                 }
     566              :             }
     567            0 :             this->ModulatedFlowSetToLoop = true;
     568            0 :             state.dataLoopNodes->Node(this->EvapOutletNodeNum).TempSetPoint =
     569            0 :                 state.dataLoopNodes->Node(this->CWPlantLoc.loop->TempSetPointNodeNum).TempSetPoint;
     570            0 :             state.dataLoopNodes->Node(this->EvapOutletNodeNum).TempSetPointHi =
     571            0 :                 state.dataLoopNodes->Node(this->CWPlantLoc.loop->TempSetPointNodeNum).TempSetPointHi;
     572              :         }
     573              :     }
     574              : 
     575            0 :     this->setOutputVariables(state);
     576            0 : }
     577              : 
     578            0 : void ASHRAE205ChillerSpecs::initialize(EnergyPlusData &state, bool const RunFlag, Real64 const MyLoad)
     579              : {
     580              :     static constexpr std::string_view RoutineName("ASHRAE205ChillerSpecs::initialize");
     581              : 
     582            0 :     switch (this->AmbientTempType) {
     583            0 :     case AmbientTempIndicator::Schedule: {
     584            0 :         this->AmbientTemp = this->ambientTempSched->getCurrentVal();
     585            0 :         break;
     586              :     }
     587            0 :     case AmbientTempIndicator::TempZone: {
     588            0 :         this->AmbientTemp = state.dataZoneTempPredictorCorrector->zoneHeatBalance(this->AmbientTempZone).MAT;
     589            0 :         break;
     590              :     }
     591            0 :     case AmbientTempIndicator::OutsideAir: {
     592            0 :         this->AmbientTemp = state.dataLoopNodes->Node(this->AmbientTempOutsideAirNode).Temp;
     593            0 :         break;
     594              :     }
     595            0 :     default:
     596            0 :         break;
     597              :     }
     598              : 
     599            0 :     this->EquipFlowCtrl = this->CWPlantLoc.comp->FlowCtrl;
     600              : 
     601            0 :     if (this->MyEnvrnFlag && state.dataGlobal->BeginEnvrnFlag && (state.dataPlnt->PlantFirstSizesOkayToFinalize)) {
     602            0 :         Real64 rho = this->CWPlantLoc.loop->glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName);
     603              : 
     604            0 :         this->EvapMassFlowRateMax = rho * this->EvapVolFlowRate;
     605            0 :         PlantUtilities::InitComponentNodes(state, 0.0, this->EvapMassFlowRateMax, this->EvapInletNodeNum, this->EvapOutletNodeNum);
     606              : 
     607            0 :         if (this->CondenserType == DataPlant::CondenserType::WaterCooled) {
     608            0 :             rho = this->CDPlantLoc.loop->glycol->getDensity(state, this->TempRefCondIn, RoutineName);
     609            0 :             this->CondMassFlowRateMax = rho * this->CondVolFlowRate;
     610            0 :             PlantUtilities::InitComponentNodes(state, 0.0, this->CondMassFlowRateMax, this->CondInletNodeNum, this->CondOutletNodeNum);
     611            0 :             state.dataLoopNodes->Node(this->CondInletNodeNum).Temp = this->TempRefCondIn;
     612              :         }
     613              :         // Set mass flow rates at Oil Cooler and Aux Equipment nodes
     614            0 :         if (this->OilCoolerInletNode) {
     615            0 :             Real64 rho_oil_cooler = this->OCPlantLoc.loop->glycol->getDensity(state, Constant::InitConvTemp, RoutineName);
     616            0 :             this->OilCoolerMassFlowRate = rho_oil_cooler * this->OilCoolerVolFlowRate;
     617            0 :             PlantUtilities::InitComponentNodes(state, 0.0, this->OilCoolerMassFlowRate, this->OilCoolerInletNode, this->OilCoolerOutletNode);
     618              :         }
     619            0 :         if (this->AuxiliaryHeatInletNode) {
     620            0 :             Real64 rho_aux = this->AHPlantLoc.loop->glycol->getDensity(state, Constant::InitConvTemp, RoutineName);
     621            0 :             this->AuxiliaryMassFlowRate = rho_aux * this->AuxiliaryVolFlowRate;
     622            0 :             PlantUtilities::InitComponentNodes(state, 0.0, this->AuxiliaryMassFlowRate, this->AuxiliaryHeatInletNode, this->AuxiliaryHeatOutletNode);
     623              :         }
     624              :     }
     625            0 :     if (!state.dataGlobal->BeginEnvrnFlag) {
     626            0 :         this->MyEnvrnFlag = true;
     627              :     }
     628              : 
     629            0 :     if ((this->FlowMode == DataPlant::FlowMode::LeavingSetpointModulated) && this->ModulatedFlowSetToLoop) {
     630              :         // see ReformulatedEIR or EIR Chiller for origin of the following
     631            0 :         state.dataLoopNodes->Node(this->EvapOutletNodeNum).TempSetPoint =
     632            0 :             state.dataLoopNodes->Node(this->CWPlantLoc.loop->TempSetPointNodeNum).TempSetPoint;
     633            0 :         state.dataLoopNodes->Node(this->EvapOutletNodeNum).TempSetPointHi =
     634            0 :             state.dataLoopNodes->Node(this->CWPlantLoc.loop->TempSetPointNodeNum).TempSetPointHi;
     635              :     }
     636              : 
     637            0 :     Real64 mdot = ((std::abs(MyLoad) > 0.0) && RunFlag) ? this->EvapMassFlowRateMax : 0.0;
     638            0 :     Real64 mdotCond = ((std::abs(MyLoad) > 0.0) && RunFlag) ? this->CondMassFlowRateMax : 0.0;
     639              : 
     640            0 :     PlantUtilities::SetComponentFlowRate(state, mdot, this->EvapInletNodeNum, this->EvapOutletNodeNum, this->CWPlantLoc);
     641              : 
     642            0 :     if (this->CondenserType == DataPlant::CondenserType::WaterCooled) {
     643            0 :         PlantUtilities::SetComponentFlowRate(state, mdotCond, this->CondInletNodeNum, this->CondOutletNodeNum, this->CDPlantLoc);
     644              :     }
     645              : 
     646              :     // Set component flow rates for Oil Cooler and Aux equipment
     647            0 :     if (this->OilCoolerInletNode) {
     648            0 :         PlantUtilities::SetComponentFlowRate(
     649            0 :             state, this->OilCoolerMassFlowRate, this->OilCoolerInletNode, this->OilCoolerOutletNode, this->OCPlantLoc);
     650              :     }
     651            0 :     if (this->AuxiliaryHeatInletNode) {
     652            0 :         PlantUtilities::SetComponentFlowRate(
     653            0 :             state, this->AuxiliaryMassFlowRate, this->AuxiliaryHeatInletNode, this->AuxiliaryHeatOutletNode, this->AHPlantLoc);
     654              :     }
     655              :     // Recalculate volumetric flow rates from component mass flow rates if necessary
     656              : 
     657              : // Revisit when heat recovery implemented
     658              : #if 0
     659              :       // Initialize heat recovery flow rates at node
     660              :         if (this->HeatRecActive) {
     661              : 
     662              :             // check if inlet limit active and if exceeded.
     663              :             bool HeatRecRunFlag = RunFlag;
     664              :             if (this->heatRecInletLimitSched != nullptr) {
     665              :                 Real64 HeatRecHighInletLimit = this->heatRecInletLimitSched->getCurrentVal();
     666              :                 if (state.dataLoopNodes->Node(this->HeatRecInletNodeNum).Temp > HeatRecHighInletLimit) { // shut down heat recovery
     667              :                     HeatRecRunFlag = false;
     668              :                 } else {
     669              :                     HeatRecRunFlag = RunFlag;
     670              :                 }
     671              :             }
     672              : 
     673              :             mdot = HeatRecRunFlag ? this->DesignHeatRecMassFlowRate : 0.0;
     674              : 
     675              :             PlantUtilities::SetComponentFlowRate(state, mdot, this->HeatRecInletNodeNum, this->HeatRecOutletNodeNum, this->HRPlantLoc);
     676              :         }
     677              : #endif // if 0
     678            0 : }
     679              : 
     680            0 : void ASHRAE205ChillerSpecs::size([[maybe_unused]] EnergyPlusData &state)
     681              : {
     682              :     static constexpr std::string_view RoutineName("SizeElectricASHRAE205Chiller");
     683              : 
     684            0 :     bool ErrorsFound = false;
     685            0 :     Real64 tmpNomCap{0.0};
     686            0 :     Real64 tmpEvapVolFlowRate = this->EvapVolFlowRate;
     687            0 :     Real64 tmpCondVolFlowRate = this->CondVolFlowRate;
     688              : 
     689              :     // Size evaporator flow rate
     690              :     // find the appropriate Plant Sizing object
     691            0 :     int PltSizNum = this->CWPlantLoc.loop->PlantSizNum;
     692              : 
     693            0 :     if (PltSizNum > 0) {
     694            0 :         if (state.dataSize->PlantSizData(PltSizNum).DesVolFlowRate >= HVAC::SmallWaterVolFlow) {
     695            0 :             tmpEvapVolFlowRate = state.dataSize->PlantSizData(PltSizNum).DesVolFlowRate * this->SizFac;
     696              :         } else {
     697            0 :             if (this->EvapVolFlowRateWasAutoSized) tmpEvapVolFlowRate = 0.0;
     698              :         }
     699            0 :         if (state.dataPlnt->PlantFirstSizesOkayToFinalize) {
     700            0 :             if (this->EvapVolFlowRateWasAutoSized) {
     701            0 :                 this->EvapVolFlowRate = tmpEvapVolFlowRate;
     702            0 :                 if (state.dataPlnt->PlantFinalSizesOkayToReport) {
     703            0 :                     BaseSizer::reportSizerOutput(
     704              :                         state, this->ObjectType, this->Name, "Design Size Chilled Water Maximum Requested Flow Rate [m3/s]", tmpEvapVolFlowRate);
     705              :                 }
     706            0 :                 if (state.dataPlnt->PlantFirstSizesOkayToReport) {
     707            0 :                     BaseSizer::reportSizerOutput(state,
     708              :                                                  this->ObjectType,
     709              :                                                  this->Name,
     710              :                                                  "Initial Design Size Chilled Water Maximum Requested Flow Rate [m3/s]",
     711              :                                                  tmpEvapVolFlowRate);
     712              :                 }
     713              :             } else { // Hard-size with sizing data
     714            0 :                 if (this->EvapVolFlowRate > 0.0 && tmpEvapVolFlowRate > 0.0) {
     715            0 :                     Real64 EvapVolFlowRateUser = this->EvapVolFlowRate;
     716            0 :                     if (state.dataPlnt->PlantFinalSizesOkayToReport) {
     717            0 :                         BaseSizer::reportSizerOutput(state,
     718              :                                                      this->ObjectType,
     719              :                                                      this->Name,
     720              :                                                      "Design Size Chilled Water Maximum Requested Flow Rate [m3/s]",
     721              :                                                      tmpEvapVolFlowRate,
     722              :                                                      "User-Specified Chilled Water Maximum Requested Flow Rate [m3/s]",
     723              :                                                      EvapVolFlowRateUser);
     724            0 :                         if (state.dataGlobal->DisplayExtraWarnings) {
     725            0 :                             if ((std::abs(tmpEvapVolFlowRate - EvapVolFlowRateUser) / EvapVolFlowRateUser) >
     726            0 :                                 state.dataSize->AutoVsHardSizingThreshold) {
     727            0 :                                 ShowMessage(state, format("{}: Potential issue with equipment sizing for {}", RoutineName, this->Name));
     728            0 :                                 ShowContinueError(
     729            0 :                                     state, format("User-Specified Chilled Water Maximum Requested Flow Rate of {:.5R} [m3/s]", EvapVolFlowRateUser));
     730            0 :                                 ShowContinueError(state,
     731            0 :                                                   format("differs from Design Size Chilled Water Maximum Requested Flow Rate of {:.5R} [m3/s]",
     732              :                                                          tmpEvapVolFlowRate));
     733            0 :                                 ShowContinueError(state, "This may, or may not, indicate mismatched component sizes.");
     734            0 :                                 ShowContinueError(state, "Verify that the value entered is intended and is consistent with other components.");
     735              :                             }
     736              :                         }
     737              :                     }
     738            0 :                     tmpEvapVolFlowRate = EvapVolFlowRateUser;
     739              :                 }
     740              :             }
     741              :         }
     742              :     } else {
     743            0 :         if (this->EvapVolFlowRateWasAutoSized && state.dataPlnt->PlantFirstSizesOkayToFinalize) {
     744            0 :             ShowSevereError(state, "Autosizing of Electric Chiller evap flow rate requires a loop Sizing:Plant object");
     745            0 :             ShowContinueError(state, format("Occurs in Electric Chiller object={}", this->Name));
     746            0 :             ErrorsFound = true;
     747              :         }
     748            0 :         if (!this->EvapVolFlowRateWasAutoSized && state.dataPlnt->PlantFinalSizesOkayToReport && (this->EvapVolFlowRate > 0.0)) {
     749            0 :             BaseSizer::reportSizerOutput(
     750              :                 state, this->ObjectType, this->Name, "User-Specified Chilled Water Maximum Requested Flow Rate [m3/s]", this->EvapVolFlowRate);
     751              :         }
     752              :     }
     753              : 
     754            0 :     PlantUtilities::RegisterPlantCompDesignFlow(state, this->EvapInletNodeNum, tmpEvapVolFlowRate);
     755              : 
     756              :     // Size condenser flow rate
     757            0 :     int PltSizCondNum = this->CDPlantLoc.loop->PlantSizNum; // Change for air-cooled when it's supported
     758            0 :     if (PltSizCondNum > 0 && PltSizNum > 0) {
     759            0 :         if (state.dataSize->PlantSizData(PltSizNum).DesVolFlowRate >= HVAC::SmallWaterVolFlow && tmpNomCap > 0.0) {
     760              : 
     761            0 :             Real64 rho = this->CDPlantLoc.loop->glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName);
     762            0 :             Real64 Cp = this->CDPlantLoc.loop->glycol->getSpecificHeat(state, this->TempRefCondIn, RoutineName);
     763            0 :             tmpCondVolFlowRate = tmpNomCap * (1.0 + (1.0 / this->RefCOP) * this->CompPowerToCondenserFrac) /
     764            0 :                                  (state.dataSize->PlantSizData(PltSizCondNum).DeltaT * Cp * rho);
     765              : 
     766              :         } else {
     767            0 :             if (this->CondVolFlowRateWasAutoSized) tmpCondVolFlowRate = 0.0;
     768              :         }
     769            0 :         if (state.dataPlnt->PlantFirstSizesOkayToFinalize) {
     770            0 :             if (this->CondVolFlowRateWasAutoSized) {
     771            0 :                 this->CondVolFlowRate = tmpCondVolFlowRate;
     772            0 :                 if (state.dataPlnt->PlantFinalSizesOkayToReport) {
     773            0 :                     BaseSizer::reportSizerOutput(
     774              :                         state, this->ObjectType, this->Name, "Design Size Condenser Maximum Requested Flow Rate [m3/s]", tmpCondVolFlowRate);
     775              :                 }
     776            0 :                 if (state.dataPlnt->PlantFirstSizesOkayToReport) {
     777            0 :                     BaseSizer::reportSizerOutput(
     778              :                         state, this->ObjectType, this->Name, "Initial Design Size Condenser Maximum Requested Flow Rate [m3/s]", tmpCondVolFlowRate);
     779              :                 }
     780              :             } else {
     781            0 :                 if (this->CondVolFlowRate > 0.0 && tmpCondVolFlowRate > 0.0) {
     782            0 :                     Real64 CondVolFlowRateUser = this->CondVolFlowRate;
     783            0 :                     if (state.dataPlnt->PlantFinalSizesOkayToReport) {
     784            0 :                         BaseSizer::reportSizerOutput(state,
     785              :                                                      this->ObjectType,
     786              :                                                      this->Name,
     787              :                                                      "Design Size Condenser Maximum Requested Flow Rate [m3/s]",
     788              :                                                      tmpCondVolFlowRate,
     789              :                                                      "User-Specified Condenser Maximum Requested Flow Rate [m3/s]",
     790              :                                                      CondVolFlowRateUser);
     791            0 :                         if (state.dataGlobal->DisplayExtraWarnings) {
     792            0 :                             if ((std::abs(tmpCondVolFlowRate - CondVolFlowRateUser) / CondVolFlowRateUser) >
     793            0 :                                 state.dataSize->AutoVsHardSizingThreshold) {
     794            0 :                                 ShowMessage(state, format("{}: Potential issue with equipment sizing for {}", RoutineName, this->Name));
     795            0 :                                 ShowContinueError(
     796            0 :                                     state, format("User-Specified Condenser Maximum Requested Flow Rate of {:.5R} [m3/s]", CondVolFlowRateUser));
     797            0 :                                 ShowContinueError(
     798              :                                     state,
     799            0 :                                     format("differs from Design Size Condenser Maximum Requested Flow Rate of {:.5R} [m3/s]", tmpCondVolFlowRate));
     800            0 :                                 ShowContinueError(state, "This may, or may not, indicate mismatched component sizes.");
     801            0 :                                 ShowContinueError(state, "Verify that the value entered is intended and is consistent with other components.");
     802              :                             }
     803              :                         }
     804              :                     }
     805            0 :                     tmpCondVolFlowRate = CondVolFlowRateUser;
     806              :                 }
     807              :             }
     808              :         }
     809            0 :     } else {
     810            0 :         if (this->CondenserType == DataPlant::CondenserType::WaterCooled) {
     811              : 
     812            0 :             if (this->CondVolFlowRateWasAutoSized && state.dataPlnt->PlantFirstSizesOkayToFinalize) {
     813            0 :                 ShowSevereError(state, "Autosizing of Electric ASHRAE 205 Chiller condenser fluid flow rate requires a condenser");
     814            0 :                 ShowContinueError(state, "loop Sizing:Plant object");
     815            0 :                 ShowContinueError(state, format("Occurs in Electric ASHRAE 205 Chiller object={}", this->Name));
     816            0 :                 ErrorsFound = true;
     817              :             }
     818            0 :             if (!this->CondVolFlowRateWasAutoSized && state.dataPlnt->PlantFinalSizesOkayToReport && (this->CondVolFlowRate > 0.0)) {
     819            0 :                 BaseSizer::reportSizerOutput(
     820              :                     state, this->ObjectType, this->Name, "User-Specified Condenser Maximum Requested Flow Rate [m3/s]", this->CondVolFlowRate);
     821              :             }
     822              : 
     823              :         } else {
     824              : 
     825              :             // Auto size condenser air flow to Total Capacity * 0.000114 m3/s/w (850 cfm/ton)
     826            0 :             if (state.dataPlnt->PlantFinalSizesOkayToReport) {
     827            0 :                 std::string_view CompType =
     828              :                     DataPlant::PlantEquipTypeNames[static_cast<int>(DataPlant::PlantEquipmentType::Chiller_ElectricASHRAE205)];
     829            0 :                 state.dataSize->DataConstantUsedForSizing = this->RefCap;
     830            0 :                 state.dataSize->DataFractionUsedForSizing = 0.000114;
     831            0 :                 Real64 TempSize = this->CondVolFlowRate;
     832            0 :                 bool bPRINT = true; // TRUE if sizing is reported to output (eio)
     833            0 :                 AutoCalculateSizer sizerCondAirFlow;
     834            0 :                 std::string stringOverride = "Condenser Maximum Requested Flow Rate  [m3/s]";
     835            0 :                 if (state.dataGlobal->isEpJSON) stringOverride = "condenser_maximum_requested_flow_rate [m3/s]";
     836            0 :                 sizerCondAirFlow.overrideSizingString(stringOverride);
     837            0 :                 sizerCondAirFlow.initializeWithinEP(state, CompType, this->Name, bPRINT, RoutineName);
     838            0 :                 this->CondVolFlowRate = sizerCondAirFlow.size(state, TempSize, ErrorsFound);
     839            0 :             }
     840              :         }
     841              :     }
     842              : 
     843              :     // save the reference condenser water volumetric flow rate for use by the condenser water loop sizing algorithms
     844            0 :     PlantUtilities::RegisterPlantCompDesignFlow(state, this->CondInletNodeNum, tmpCondVolFlowRate);
     845              : 
     846              :     // Calculate design evaporator capacity (eventually add autosize here too)
     847              : 
     848              :     // TODO: Determine actual rated flow rates instead of design flow rates
     849            0 :     this->RefCap = this->Representation->performance.performance_map_cooling
     850            0 :                        .calculate_performance(this->EvapVolFlowRate,
     851            0 :                                               this->TempRefEvapOut + Constant::Kelvin,
     852              :                                               this->CondVolFlowRate,
     853            0 :                                               this->TempRefCondIn + Constant::Kelvin,
     854            0 :                                               this->MaxSequenceNumber,
     855              :                                               this->InterpolationType)
     856            0 :                        .net_evaporator_capacity;
     857              : 
     858            0 :     if (PltSizNum > 0) {
     859            0 :         if (state.dataSize->PlantSizData(PltSizNum).DesVolFlowRate >= HVAC::SmallWaterVolFlow) {
     860            0 :             Real64 Cp = this->CWPlantLoc.loop->glycol->getSpecificHeat(state, Constant::CWInitConvTemp, RoutineName);
     861              : 
     862            0 :             Real64 rho = this->CWPlantLoc.loop->glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName);
     863            0 :             tmpNomCap = Cp * rho * state.dataSize->PlantSizData(PltSizNum).DeltaT * tmpEvapVolFlowRate;
     864              :         } else {
     865            0 :             tmpNomCap = 0.0;
     866              :         }
     867            0 :         if (state.dataPlnt->PlantFirstSizesOkayToFinalize) {
     868            0 :             if (this->RefCapWasAutoSized) {
     869            0 :                 this->RefCap = tmpNomCap;
     870            0 :                 if (state.dataPlnt->PlantFinalSizesOkayToReport) {
     871            0 :                     BaseSizer::reportSizerOutput(state, this->ObjectType, this->Name, "Design Size Rated Capacity [W]", tmpNomCap);
     872              :                 }
     873            0 :                 if (state.dataPlnt->PlantFirstSizesOkayToReport) {
     874            0 :                     BaseSizer::reportSizerOutput(state, this->ObjectType, this->Name, "Initial Design Size Rated Capacity [W]", tmpNomCap);
     875              :                 }
     876              :             } else { // Hard-sized with sizing data
     877            0 :                 if (this->RefCap > 0.0 && tmpNomCap > 0.0) {
     878            0 :                     Real64 RefCapUser = this->RefCap;
     879            0 :                     if (state.dataPlnt->PlantFinalSizesOkayToReport) {
     880            0 :                         BaseSizer::reportSizerOutput(state,
     881              :                                                      this->ObjectType,
     882              :                                                      this->Name,
     883              :                                                      "Design Size Rated Capacity [W]",
     884              :                                                      tmpNomCap,
     885              :                                                      "User-Specified Rated Capacity [W]",
     886              :                                                      RefCapUser);
     887            0 :                         if (state.dataGlobal->DisplayExtraWarnings) {
     888            0 :                             if ((std::abs(tmpNomCap - RefCapUser) / RefCapUser) > state.dataSize->AutoVsHardSizingThreshold) {
     889            0 :                                 ShowMessage(state, format("{}: Potential issue with equipment sizing for {}", RoutineName, this->Name));
     890            0 :                                 ShowContinueError(state, format("User-Specified Rated Capacity of {:.2R} [W]", RefCapUser));
     891            0 :                                 ShowContinueError(state, format("differs from Design Size Rated Capacity of {:.2R} [W]", tmpNomCap));
     892            0 :                                 ShowContinueError(state, "This may, or may not, indicate mismatched component sizes.");
     893            0 :                                 ShowContinueError(state, "Verify that the value entered is intended and is consistent with other components.");
     894              :                             }
     895              :                         }
     896              :                     }
     897            0 :                     tmpNomCap = RefCapUser;
     898              :                 }
     899              :             }
     900              :         }
     901              :     } else {
     902            0 :         if (this->RefCapWasAutoSized && state.dataPlnt->PlantFirstSizesOkayToFinalize) {
     903            0 :             ShowSevereError(state, "Autosizing of Electric Chiller reference capacity requires a loop Sizing:Plant object");
     904            0 :             ShowContinueError(state, format("Occurs in Electric Chiller object={}", this->Name));
     905            0 :             ErrorsFound = true;
     906              :         }
     907            0 :         if (!this->RefCapWasAutoSized && state.dataPlnt->PlantFinalSizesOkayToReport && (this->RefCap > 0.0)) { // Hard-sized with no sizing data
     908            0 :             BaseSizer::reportSizerOutput(state, this->ObjectType, this->Name, "User-Specified Rated Capacity [W]", this->RefCap);
     909              :         }
     910              :     }
     911              : 
     912            0 :     if (this->OilCoolerInletNode) {
     913            0 :         PlantUtilities::RegisterPlantCompDesignFlow(state, this->OilCoolerInletNode, this->OilCoolerVolFlowRate);
     914              :     }
     915              : 
     916            0 :     if (this->AuxiliaryHeatInletNode) {
     917            0 :         PlantUtilities::RegisterPlantCompDesignFlow(state, this->AuxiliaryHeatInletNode, this->AuxiliaryVolFlowRate);
     918              :     }
     919              : 
     920            0 :     if (state.dataPlnt->PlantFinalSizesOkayToReport) {
     921              :         // create predefined report
     922            0 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchMechType, this->Name, this->ObjectType);
     923            0 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchMechNomEff, this->Name, this->RefCOP);
     924            0 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchMechNomCap, this->Name, this->RefCap);
     925              :     }
     926              : 
     927            0 :     if (ErrorsFound) {
     928            0 :         ShowFatalError(state, "Preceding sizing errors cause program termination");
     929              :     }
     930            0 : }
     931              : 
     932            0 : void ASHRAE205ChillerSpecs::setOutputVariables(EnergyPlusData &state)
     933              : {
     934            0 :     SetupOutputVariable(state,
     935              :                         "Chiller Part Load Ratio",
     936              :                         Constant::Units::None,
     937            0 :                         this->ChillerPartLoadRatio,
     938              :                         OutputProcessor::TimeStepType::System,
     939              :                         OutputProcessor::StoreType::Average,
     940            0 :                         this->Name);
     941              : 
     942            0 :     SetupOutputVariable(state,
     943              :                         "Chiller Cycling Ratio",
     944              :                         Constant::Units::None,
     945            0 :                         this->ChillerCyclingRatio,
     946              :                         OutputProcessor::TimeStepType::System,
     947              :                         OutputProcessor::StoreType::Average,
     948            0 :                         this->Name);
     949              : 
     950            0 :     SetupOutputVariable(state,
     951              :                         "Minimum Part Load Ratio",
     952              :                         Constant::Units::None,
     953            0 :                         this->MinPartLoadRat,
     954              :                         OutputProcessor::TimeStepType::System,
     955              :                         OutputProcessor::StoreType::Average,
     956            0 :                         this->Name);
     957              : 
     958            0 :     SetupOutputVariable(state,
     959              :                         "Chiller Electricity Rate",
     960              :                         Constant::Units::W,
     961            0 :                         this->Power,
     962              :                         OutputProcessor::TimeStepType::System,
     963              :                         OutputProcessor::StoreType::Average,
     964            0 :                         this->Name);
     965              : 
     966            0 :     SetupOutputVariable(state,
     967              :                         "Chiller Electricity Energy",
     968              :                         Constant::Units::J,
     969            0 :                         this->Energy,
     970              :                         OutputProcessor::TimeStepType::System,
     971              :                         OutputProcessor::StoreType::Sum,
     972            0 :                         this->Name,
     973              :                         Constant::eResource::Electricity,
     974              :                         OutputProcessor::Group::Plant,
     975              :                         OutputProcessor::EndUseCat::Cooling,
     976              :                         this->EndUseSubcategory);
     977              : 
     978            0 :     SetupOutputVariable(state,
     979              :                         "Chiller Evaporator Cooling Rate",
     980              :                         Constant::Units::W,
     981            0 :                         this->QEvaporator,
     982              :                         OutputProcessor::TimeStepType::System,
     983              :                         OutputProcessor::StoreType::Average,
     984            0 :                         this->Name);
     985              : 
     986            0 :     SetupOutputVariable(state,
     987              :                         "Chiller Evaporator Cooling Energy",
     988              :                         Constant::Units::J,
     989            0 :                         this->EvapEnergy,
     990              :                         OutputProcessor::TimeStepType::System,
     991              :                         OutputProcessor::StoreType::Sum,
     992            0 :                         this->Name,
     993              :                         Constant::eResource::EnergyTransfer,
     994              :                         OutputProcessor::Group::Plant,
     995              :                         OutputProcessor::EndUseCat::Chillers);
     996              : 
     997            0 :     SetupOutputVariable(state,
     998              :                         "Chiller Evaporator Inlet Temperature",
     999              :                         Constant::Units::C,
    1000            0 :                         this->EvapInletTemp,
    1001              :                         OutputProcessor::TimeStepType::System,
    1002              :                         OutputProcessor::StoreType::Average,
    1003            0 :                         this->Name);
    1004              : 
    1005            0 :     SetupOutputVariable(state,
    1006              :                         "Chiller Evaporator Outlet Temperature",
    1007              :                         Constant::Units::C,
    1008            0 :                         this->EvapOutletTemp,
    1009              :                         OutputProcessor::TimeStepType::System,
    1010              :                         OutputProcessor::StoreType::Average,
    1011            0 :                         this->Name);
    1012              : 
    1013            0 :     SetupOutputVariable(state,
    1014              :                         "Chiller Evaporator Mass Flow Rate",
    1015              :                         Constant::Units::kg_s,
    1016            0 :                         this->EvapMassFlowRate,
    1017              :                         OutputProcessor::TimeStepType::System,
    1018              :                         OutputProcessor::StoreType::Average,
    1019            0 :                         this->Name);
    1020              : 
    1021            0 :     SetupOutputVariable(state,
    1022              :                         "Chiller Condenser Heat Transfer Rate",
    1023              :                         Constant::Units::W,
    1024            0 :                         this->QCondenser,
    1025              :                         OutputProcessor::TimeStepType::System,
    1026              :                         OutputProcessor::StoreType::Average,
    1027            0 :                         this->Name);
    1028              : 
    1029            0 :     SetupOutputVariable(state,
    1030              :                         "Chiller Condenser Heat Transfer Energy",
    1031              :                         Constant::Units::J,
    1032            0 :                         this->CondEnergy,
    1033              :                         OutputProcessor::TimeStepType::System,
    1034              :                         OutputProcessor::StoreType::Sum,
    1035            0 :                         this->Name,
    1036              :                         Constant::eResource::EnergyTransfer,
    1037              :                         OutputProcessor::Group::Plant,
    1038              :                         OutputProcessor::EndUseCat::HeatRejection);
    1039              : 
    1040            0 :     SetupOutputVariable(state,
    1041              :                         "Chiller COP",
    1042              :                         Constant::Units::W_W,
    1043            0 :                         this->ActualCOP,
    1044              :                         OutputProcessor::TimeStepType::System,
    1045              :                         OutputProcessor::StoreType::Average,
    1046            0 :                         this->Name);
    1047              : 
    1048            0 :     SetupOutputVariable(state,
    1049              :                         "Chiller Condenser Inlet Temperature",
    1050              :                         Constant::Units::C,
    1051            0 :                         this->CondInletTemp,
    1052              :                         OutputProcessor::TimeStepType::System,
    1053              :                         OutputProcessor::StoreType::Average,
    1054            0 :                         this->Name);
    1055              : 
    1056            0 :     SetupOutputVariable(state,
    1057              :                         "Chiller Condenser Outlet Temperature",
    1058              :                         Constant::Units::C,
    1059            0 :                         this->CondOutletTemp,
    1060              :                         OutputProcessor::TimeStepType::System,
    1061              :                         OutputProcessor::StoreType::Average,
    1062            0 :                         this->Name);
    1063              : 
    1064            0 :     SetupOutputVariable(state,
    1065              :                         "Chiller Condenser Mass Flow Rate",
    1066              :                         Constant::Units::kg_s,
    1067            0 :                         this->CondMassFlowRate,
    1068              :                         OutputProcessor::TimeStepType::System,
    1069              :                         OutputProcessor::StoreType::Average,
    1070            0 :                         this->Name);
    1071              : 
    1072            0 :     SetupOutputVariable(state,
    1073              :                         "Chiller Effective Heat Rejection Temperature",
    1074              :                         Constant::Units::C,
    1075            0 :                         this->ChillerCondAvgTemp,
    1076              :                         OutputProcessor::TimeStepType::System,
    1077              :                         OutputProcessor::StoreType::Average,
    1078            0 :                         this->Name);
    1079              : 
    1080            0 :     SetupOutputVariable(state,
    1081              :                         "Chiller Zone Heat Gain Rate",
    1082              :                         Constant::Units::W,
    1083            0 :                         this->AmbientZoneGain,
    1084              :                         OutputProcessor::TimeStepType::System,
    1085              :                         OutputProcessor::StoreType::Average,
    1086            0 :                         this->Name);
    1087              : 
    1088            0 :     SetupOutputVariable(state,
    1089              :                         "Chiller Zone Heat Gain Energy",
    1090              :                         Constant::Units::J,
    1091            0 :                         this->AmbientZoneGainEnergy,
    1092              :                         OutputProcessor::TimeStepType::System,
    1093              :                         OutputProcessor::StoreType::Sum,
    1094            0 :                         this->Name);
    1095              : 
    1096            0 :     SetupOutputVariable(state,
    1097              :                         "Oil Cooler Heat Transfer Rate",
    1098              :                         Constant::Units::W,
    1099            0 :                         this->QOilCooler,
    1100              :                         OutputProcessor::TimeStepType::System,
    1101              :                         OutputProcessor::StoreType::Average,
    1102            0 :                         this->Name);
    1103              : 
    1104            0 :     SetupOutputVariable(state,
    1105              :                         "Oil Cooler Heat Transfer Energy",
    1106              :                         Constant::Units::J,
    1107            0 :                         this->OilCoolerEnergy,
    1108              :                         OutputProcessor::TimeStepType::System,
    1109              :                         OutputProcessor::StoreType::Sum,
    1110            0 :                         this->Name);
    1111              : 
    1112            0 :     SetupOutputVariable(state,
    1113              :                         "Auxiliary Heat Transfer Rate",
    1114              :                         Constant::Units::W,
    1115            0 :                         this->QAuxiliary,
    1116              :                         OutputProcessor::TimeStepType::System,
    1117              :                         OutputProcessor::StoreType::Average,
    1118            0 :                         this->Name);
    1119              : 
    1120            0 :     SetupOutputVariable(state,
    1121              :                         "Auxiliary Heat Transfer Energy",
    1122              :                         Constant::Units::J,
    1123            0 :                         this->AuxiliaryEnergy,
    1124              :                         OutputProcessor::TimeStepType::System,
    1125              :                         OutputProcessor::StoreType::Sum,
    1126            0 :                         this->Name);
    1127            0 : }
    1128              : 
    1129            0 : void ASHRAE205ChillerSpecs::findEvaporatorMassFlowRate(EnergyPlusData &state, Real64 &load, Real64 Cp)
    1130              : {
    1131              :     static constexpr std::string_view RoutineName("ASHRAE205ChillerSpecs::findEvaporatorMassFlowRate");
    1132              : 
    1133              :     // If FlowLock is False (0), the chiller sets the plant loop mdot
    1134              :     // If FlowLock is True (1),  the new resolved plant loop mdot is used
    1135            0 :     if (this->CWPlantLoc.side->FlowLock == DataPlant::FlowLock::Unlocked) {
    1136            0 :         this->PossibleSubcooling = !(this->CWPlantLoc.comp->CurOpSchemeType == DataPlant::OpScheme::CompSetPtBased);
    1137              : 
    1138            0 :         Real64 evapDeltaTemp(0.0); // Evaporator temperature difference [C]
    1139              : 
    1140              :         // Either set the flow to the Constant value or calculate the flow for the variable volume case
    1141            0 :         if ((this->FlowMode == DataPlant::FlowMode::Constant) || (this->FlowMode == DataPlant::FlowMode::NotModulated)) {
    1142              :             // Set the evaporator mass flow rate to design
    1143              :             // Start by assuming max (design) flow
    1144            0 :             this->EvapMassFlowRate = this->EvapMassFlowRateMax;
    1145              :             // Use PlantUtilities::SetComponentFlowRate to decide actual flow
    1146            0 :             PlantUtilities::SetComponentFlowRate(state, this->EvapMassFlowRate, this->EvapInletNodeNum, this->EvapOutletNodeNum, this->CWPlantLoc);
    1147            0 :             if (this->EvapMassFlowRate != 0.0) {
    1148            0 :                 evapDeltaTemp = std::abs(load) / this->EvapMassFlowRate / Cp; // MyLoad = net evaporator capacity, QEvaporator
    1149              :             } else {
    1150            0 :                 evapDeltaTemp = 0.0;
    1151              :             }
    1152            0 :             this->EvapOutletTemp = state.dataLoopNodes->Node(this->EvapInletNodeNum).Temp - evapDeltaTemp;
    1153            0 :         } else if (this->FlowMode == DataPlant::FlowMode::LeavingSetpointModulated) {
    1154            0 :             switch (this->CWPlantLoc.loop->LoopDemandCalcScheme) {
    1155            0 :             case DataPlant::LoopDemandCalcScheme::SingleSetPoint: {
    1156              :                 // Calculate the Delta Temp from the inlet temp to the chiller outlet setpoint
    1157            0 :                 evapDeltaTemp =
    1158            0 :                     state.dataLoopNodes->Node(this->EvapInletNodeNum).Temp - state.dataLoopNodes->Node(this->EvapOutletNodeNum).TempSetPoint;
    1159            0 :             } break;
    1160            0 :             case DataPlant::LoopDemandCalcScheme::DualSetPointDeadBand: {
    1161            0 :                 evapDeltaTemp =
    1162            0 :                     state.dataLoopNodes->Node(this->EvapInletNodeNum).Temp - state.dataLoopNodes->Node(this->EvapOutletNodeNum).TempSetPointHi;
    1163            0 :             } break;
    1164            0 :             default: {
    1165            0 :                 assert(false);
    1166              :             } break;
    1167              :             }
    1168              : 
    1169            0 :             if (evapDeltaTemp != 0) {
    1170            0 :                 this->EvapMassFlowRate = max(0.0, (std::abs(load) / Cp / evapDeltaTemp));
    1171            0 :                 if ((this->EvapMassFlowRate - this->EvapMassFlowRateMax) > DataBranchAirLoopPlant::MassFlowTolerance) this->PossibleSubcooling = true;
    1172              :                 // Check to see if the Maximum is exceeded, if so set to maximum
    1173            0 :                 this->EvapMassFlowRate = min(this->EvapMassFlowRateMax, this->EvapMassFlowRate);
    1174              :                 // Use PlantUtilities::SetComponentFlowRate to decide actual flow
    1175            0 :                 PlantUtilities::SetComponentFlowRate(
    1176            0 :                     state, this->EvapMassFlowRate, this->EvapInletNodeNum, this->EvapOutletNodeNum, this->CWPlantLoc);
    1177              :                 // Should we recalculate this with the corrected setpoint?
    1178            0 :                 switch (this->CWPlantLoc.loop->LoopDemandCalcScheme) {
    1179            0 :                 case DataPlant::LoopDemandCalcScheme::SingleSetPoint: {
    1180            0 :                     this->EvapOutletTemp = state.dataLoopNodes->Node(this->EvapOutletNodeNum).TempSetPoint;
    1181            0 :                 } break;
    1182            0 :                 case DataPlant::LoopDemandCalcScheme::DualSetPointDeadBand: {
    1183            0 :                     this->EvapOutletTemp = state.dataLoopNodes->Node(this->EvapOutletNodeNum).TempSetPointHi;
    1184            0 :                 } break;
    1185            0 :                 default:
    1186            0 :                     break;
    1187              :                 }
    1188              :             } else {
    1189              :                 // Try to request zero flow
    1190            0 :                 this->EvapMassFlowRate = 0.0;
    1191              :                 // Use PlantUtilities::SetComponentFlowRate to decide actual flow
    1192            0 :                 PlantUtilities::SetComponentFlowRate(
    1193            0 :                     state, this->EvapMassFlowRate, this->EvapInletNodeNum, this->EvapOutletNodeNum, this->CWPlantLoc);
    1194              :                 // No deltaT since component is not running
    1195            0 :                 this->EvapOutletTemp = state.dataLoopNodes->Node(this->EvapInletNodeNum).Temp;
    1196            0 :                 this->QEvaporator = 0.0;
    1197              :                 // PartLoadRat = 0.0;
    1198            0 :                 this->ChillerPartLoadRatio = 0.0;
    1199              : 
    1200            0 :                 if (this->DeltaTErrCount < 1 && !state.dataGlobal->WarmupFlag) {
    1201            0 :                     ++this->DeltaTErrCount;
    1202            0 :                     ShowWarningError(state, "Evaporator DeltaTemp = 0 in mass flow calculation (Tevapin = Tevapout setpoint temp).");
    1203            0 :                     ShowContinueErrorTimeStamp(state, "");
    1204            0 :                 } else if (!state.dataGlobal->WarmupFlag) {
    1205            0 :                     ++this->ChillerCapFTError;
    1206            0 :                     ShowRecurringWarningErrorAtEnd(
    1207              :                         state,
    1208            0 :                         format("{} \"{}\": Evaporator DeltaTemp = 0 in mass flow calculation warning continues...", this->ObjectType, this->Name),
    1209            0 :                         this->DeltaTErrCountIndex,
    1210              :                         evapDeltaTemp,
    1211              :                         evapDeltaTemp);
    1212              :                 }
    1213              :             }
    1214              :         }
    1215              :     } else { // If FlowLock is True
    1216            0 :         this->EvapMassFlowRate = state.dataLoopNodes->Node(this->EvapInletNodeNum).MassFlowRate;
    1217            0 :         PlantUtilities::SetComponentFlowRate(state, this->EvapMassFlowRate, this->EvapInletNodeNum, this->EvapOutletNodeNum, this->CWPlantLoc);
    1218              :         //       Some other component set the flow to 0. No reason to continue with calculations.
    1219            0 :         if (this->EvapMassFlowRate == 0.0) {
    1220            0 :             load = 0.0;
    1221            0 :             return;
    1222              :         }
    1223              :     } // This is the end of the FlowLock Block
    1224              : 
    1225            0 :     const Real64 rho = this->CWPlantLoc.loop->glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName);
    1226              : 
    1227            0 :     this->EvapVolFlowRate = this->EvapMassFlowRate / rho;
    1228              : }
    1229              : 
    1230            0 : void ASHRAE205ChillerSpecs::calculate(EnergyPlusData &state, Real64 &MyLoad, bool const RunFlag)
    1231              : {
    1232              :     static constexpr std::string_view RoutineName("CalcElecASHRAE205ChillerModel");
    1233            0 :     this->ChillerPartLoadRatio = 0.0;
    1234            0 :     this->ChillerCyclingRatio = 1.0;
    1235            0 :     this->ChillerFalseLoadRate = 0.0;
    1236            0 :     this->EvapMassFlowRate = 0.0;
    1237            0 :     this->CondMassFlowRate = 0.0;
    1238            0 :     this->Power = 0.0;
    1239            0 :     this->QCondenser = 0.0;
    1240            0 :     this->QEvaporator = 0.0;
    1241            0 :     this->QOilCooler = 0.0;
    1242            0 :     this->QAuxiliary = 0.0;
    1243            0 :     int PlantLoopNum = this->CWPlantLoc.loopNum;
    1244            0 :     DataPlant::LoopSideLocation LoopSideNum = this->CWPlantLoc.loopSideNum;
    1245            0 :     int BranchNum = this->CWPlantLoc.branchNum;
    1246            0 :     int CompNum = this->CWPlantLoc.compNum;
    1247              : 
    1248              :     // Set module-level chiller evaporator and condenser inlet temperature variables
    1249              :     // using prior time step's temperature
    1250            0 :     Real64 condInletTemp = state.dataLoopNodes->Node(this->CondInletNodeNum).Temp;
    1251            0 :     this->EvapOutletTemp = state.dataLoopNodes->Node(this->EvapOutletNodeNum).Temp;
    1252              : 
    1253              :     // If no loop demand or chiller OFF, return
    1254              :     // If chiller load is 0 or chiller is not running then leave the subroutine. Before leaving
    1255              :     //  if the component control is SERIESACTIVE we set the component flow to inlet flow so that
    1256              :     //  flow resolver will not shut down the branch
    1257              : 
    1258              :     // Calculate performance for standby (only used when off or cycling)
    1259              :     Real64 standbyPower =
    1260            0 :         this->Representation->performance.performance_map_standby.calculate_performance(this->AmbientTemp, this->InterpolationType).input_power;
    1261            0 :     if (MyLoad >= 0 || !RunFlag) {
    1262            0 :         if (this->EquipFlowCtrl == DataBranchAirLoopPlant::ControlType::SeriesActive ||
    1263            0 :             this->CWPlantLoc.side->FlowLock == DataPlant::FlowLock::Locked) {
    1264            0 :             this->EvapMassFlowRate = state.dataLoopNodes->Node(this->EvapInletNodeNum).MassFlowRate;
    1265              :         }
    1266            0 :         if (this->CondenserType == DataPlant::CondenserType::WaterCooled) {
    1267            0 :             if (this->CDPlantLoc.comp->FlowCtrl == DataBranchAirLoopPlant::ControlType::SeriesActive) {
    1268            0 :                 this->CondMassFlowRate = state.dataLoopNodes->Node(this->CondInletNodeNum).MassFlowRate;
    1269              :             }
    1270              :         }
    1271            0 :         this->Power = standbyPower;
    1272            0 :         this->AmbientZoneGain = standbyPower;
    1273            0 :         return;
    1274              :     }
    1275              : 
    1276              : // Revisit
    1277              : #if 0
    1278              :         //        // If there is a fault of chiller fouling
    1279              : //        if (this->FaultyChillerFoulingFlag && (!state.dataGlobal->WarmupFlag) && (!state.dataGlobal->DoingSizing) &&
    1280              : //            (!state.dataGlobal->KickOffSimulation)) {
    1281              : //            int FaultIndex = this->FaultyChillerFoulingIndex;
    1282              : //            Real64 NomCap_ff = ChillerRefCap;
    1283              : //            Real64 ReferenceCOP_ff = ReferenceCOP;
    1284              : //
    1285              : //            // calculate the Faulty Chiller Fouling Factor using fault information
    1286              : //            this->FaultyChillerFoulingFactor = state.dataFaultsMgr->FaultsChillerFouling(FaultIndex).CalFoulingFactor(state);
    1287              : //
    1288              : //            // update the Chiller nominal capacity and COP at faulty cases
    1289              : //            ChillerRefCap = NomCap_ff * this->FaultyChillerFoulingFactor;
    1290              : //            ReferenceCOP = ReferenceCOP_ff * this->FaultyChillerFoulingFactor;
    1291              : //        }
    1292              : #endif // 0
    1293              : 
    1294              :     // Set mass flow rates
    1295            0 :     if (this->CondenserType == DataPlant::CondenserType::WaterCooled) {
    1296            0 :         this->CondMassFlowRate = this->CondMassFlowRateMax;
    1297            0 :         PlantUtilities::SetComponentFlowRate(state, this->CondMassFlowRate, this->CondInletNodeNum, this->CondOutletNodeNum, this->CDPlantLoc);
    1298            0 :         PlantUtilities::PullCompInterconnectTrigger(
    1299            0 :             state, this->CWPlantLoc, this->CondMassFlowIndex, this->CDPlantLoc, DataPlant::CriteriaType::MassFlowRate, this->CondMassFlowRate);
    1300              : 
    1301            0 :         if (this->CondMassFlowRate < DataBranchAirLoopPlant::MassFlowTolerance) {
    1302            0 :             MyLoad = 0.0;
    1303            0 :             this->Power = standbyPower;
    1304            0 :             this->AmbientZoneGain = standbyPower;
    1305            0 :             this->EvapMassFlowRate = 0.0;
    1306            0 :             PlantUtilities::SetComponentFlowRate(state, this->EvapMassFlowRate, this->EvapInletNodeNum, this->EvapOutletNodeNum, this->CWPlantLoc);
    1307            0 :             return;
    1308              :         }
    1309              :     }
    1310            0 :     Real64 EvapOutletTempSetPoint(0.0); // Evaporator outlet temperature setpoint [C]
    1311            0 :     switch (this->CWPlantLoc.loop->LoopDemandCalcScheme) {
    1312            0 :     case DataPlant::LoopDemandCalcScheme::SingleSetPoint: {
    1313            0 :         if ((this->FlowMode == DataPlant::FlowMode::LeavingSetpointModulated) ||
    1314            0 :             (this->CWPlantLoc.comp->CurOpSchemeType == DataPlant::OpScheme::CompSetPtBased) ||
    1315            0 :             (state.dataLoopNodes->Node(this->EvapOutletNodeNum).TempSetPoint != DataLoopNode::SensedNodeFlagValue)) {
    1316              :             // there will be a valid setpoint on outlet
    1317            0 :             EvapOutletTempSetPoint = state.dataLoopNodes->Node(this->EvapOutletNodeNum).TempSetPoint;
    1318              :         } else { // use plant loop overall setpoint
    1319            0 :             EvapOutletTempSetPoint = state.dataLoopNodes->Node(this->CWPlantLoc.loop->TempSetPointNodeNum).TempSetPoint;
    1320              :         }
    1321            0 :     } break;
    1322            0 :     case DataPlant::LoopDemandCalcScheme::DualSetPointDeadBand: {
    1323            0 :         if ((this->FlowMode == DataPlant::FlowMode::LeavingSetpointModulated) ||
    1324            0 :             (this->CWPlantLoc.comp->CurOpSchemeType == DataPlant::OpScheme::CompSetPtBased) ||
    1325            0 :             (state.dataLoopNodes->Node(this->EvapOutletNodeNum).TempSetPointHi != DataLoopNode::SensedNodeFlagValue)) {
    1326              :             // there will be a valid setpoint on outlet
    1327            0 :             EvapOutletTempSetPoint = state.dataLoopNodes->Node(this->EvapOutletNodeNum).TempSetPointHi;
    1328              :         } else { // use plant loop overall setpoint
    1329            0 :             EvapOutletTempSetPoint = state.dataLoopNodes->Node(this->CWPlantLoc.loop->TempSetPointNodeNum).TempSetPointHi;
    1330              :         }
    1331            0 :     } break;
    1332            0 :     default: {
    1333            0 :         assert(false);
    1334              :     } break;
    1335              :     }
    1336              : // Revisit
    1337              : #if 0
    1338              :         //        // If there is a fault of Chiller SWT Sensor
    1339              : //        if (this->FaultyChillerSWTFlag && (!state.dataGlobal->WarmupFlag) && (!state.dataGlobal->DoingSizing) && (!state.dataGlobal->KickOffSimulation)) {
    1340              : //            int FaultIndex = this->FaultyChillerSWTIndex;
    1341              : //            Real64 EvapOutletTempSetPoint_ff = EvapOutletTempSetPoint;
    1342              : //
    1343              : //            // calculate the sensor offset using fault information
    1344              : //            this->FaultyChillerSWTOffset = state.dataFaultsMgr->FaultsChillerSWTSensor(FaultIndex).CalFaultOffsetAct(state);
    1345              : //            // update the EvapOutletTempSetPoint
    1346              : //            EvapOutletTempSetPoint =
    1347              : //                    max(this->TempLowLimitEvapOut,
    1348              : //                        min(state.dataLoopNodes->Node(this->EvapInletNodeNum).Temp, EvapOutletTempSetPoint_ff - this->FaultyChillerSWTOffset));
    1349              : //            this->FaultyChillerSWTOffset = EvapOutletTempSetPoint_ff - EvapOutletTempSetPoint;
    1350              : //        }
    1351              : #endif // 0
    1352              :        // When implemented, TODO: correct temperature if using heat recovery
    1353              : 
    1354            0 :     this->EvapMassFlowRate = state.dataLoopNodes->Node(this->EvapInletNodeNum).MassFlowRate;
    1355              :     // If some other component set the flow to 0, no reason to continue with calculations.
    1356            0 :     if (this->EvapMassFlowRate == 0.0) {
    1357            0 :         MyLoad = 0.0;
    1358            0 :         return;
    1359              :     }
    1360              : 
    1361            0 :     Real64 CpEvap = this->CWPlantLoc.loop->glycol->getSpecificHeat(state, state.dataLoopNodes->Node(this->EvapInletNodeNum).Temp, RoutineName);
    1362              : 
    1363              :     // Calculate mass flow rate based on MyLoad (TODO: then adjust it after determining if chiller can meet the load)
    1364            0 :     this->findEvaporatorMassFlowRate(state, MyLoad, CpEvap);
    1365              : 
    1366              :     // Available chiller capacity is capacity at the highest sequence number; i.e. max chiller capacity
    1367            0 :     const Real64 maximumChillerCap = this->Representation->performance.performance_map_cooling
    1368            0 :                                          .calculate_performance(this->EvapVolFlowRate,
    1369            0 :                                                                 this->EvapOutletTemp + Constant::Kelvin,
    1370              :                                                                 this->CondVolFlowRate,
    1371            0 :                                                                 this->CondInletTemp + Constant::Kelvin,
    1372            0 :                                                                 this->MaxSequenceNumber,
    1373              :                                                                 this->InterpolationType)
    1374            0 :                                          .net_evaporator_capacity;
    1375            0 :     const Real64 minimumChillerCap = this->Representation->performance.performance_map_cooling
    1376            0 :                                          .calculate_performance(this->EvapVolFlowRate,
    1377            0 :                                                                 this->EvapOutletTemp + Constant::Kelvin,
    1378              :                                                                 this->CondVolFlowRate,
    1379            0 :                                                                 this->CondInletTemp + Constant::Kelvin,
    1380            0 :                                                                 this->MinSequenceNumber,
    1381              :                                                                 this->InterpolationType)
    1382            0 :                                          .net_evaporator_capacity;
    1383              :     // Part load ratio based on load and available chiller capacity; cap at max P.L.R. (can be >1)
    1384            0 :     this->ChillerPartLoadRatio = (maximumChillerCap > 0) ? max(0.0, std::abs(MyLoad) / maximumChillerCap) : 0.0;
    1385              :     // Minimum capacity ratio, under which cycling occurs
    1386            0 :     this->MinPartLoadRat = (maximumChillerCap > 0) ? minimumChillerCap / maximumChillerCap : 0.0;
    1387            0 :     Real64 partLoadSeqNum{0.};
    1388              : 
    1389              :     // Chiller may be operating in one of three modes: cycling, modulating, or full capacity
    1390            0 :     if (this->ChillerPartLoadRatio < this->MinPartLoadRat) // Cycling
    1391              :     {
    1392            0 :         this->ChillerCyclingRatio = this->ChillerPartLoadRatio / this->MinPartLoadRat;
    1393            0 :         partLoadSeqNum = this->MinSequenceNumber;
    1394            0 :     } else if (this->ChillerPartLoadRatio < 1.0) // Modulating
    1395              :     {
    1396              :         // Use performance map to find the fractional sequence number (which most closely matches our part load)
    1397            0 :         Real64 constexpr accuracy{0.0001};
    1398            0 :         int constexpr maxIter{500};
    1399            0 :         int solFla{0};
    1400            0 :         auto f = [MyLoad, this](Real64 partLoadSeqNum) {
    1401            0 :             this->QEvaporator = this->Representation->performance.performance_map_cooling
    1402            0 :                                     .calculate_performance(this->EvapVolFlowRate,
    1403            0 :                                                            this->EvapOutletTemp + Constant::Kelvin,
    1404            0 :                                                            this->CondVolFlowRate,
    1405            0 :                                                            this->CondInletTemp + Constant::Kelvin,
    1406              :                                                            partLoadSeqNum,
    1407            0 :                                                            this->InterpolationType)
    1408            0 :                                     .net_evaporator_capacity;
    1409            0 :             return std::abs(MyLoad) - this->QEvaporator;
    1410            0 :         };
    1411              :         // Iteratively calculate this->QEvaporator by modulating partLoadSeqNum, ending at Q_Evaporator(partLoadSeqNum)
    1412            0 :         General::SolveRoot(state, accuracy, maxIter, solFla, partLoadSeqNum, f, this->MinSequenceNumber, this->MaxSequenceNumber);
    1413              :     } else // Full capacity: std::abs(MyLoad) > this->QEvaporator
    1414              :     {
    1415            0 :         this->QEvaporator = maximumChillerCap;
    1416            0 :         partLoadSeqNum = this->MaxSequenceNumber;
    1417              :         // SolveRoot stuff for eventual flow rate (can always calculate Ts if you have MFR and capacity)
    1418              :         // recursion? Revisit.
    1419            0 :         findEvaporatorMassFlowRate(state, this->QEvaporator, CpEvap);
    1420              :         // if MFR changes, recalculate chiller capacity.
    1421              :         // repeat until load <= capacity
    1422              :     }
    1423              : 
    1424              :     // Use performance map to get the rest of results at new sequence number
    1425              :     auto lookupVariablesCooling = // This is a struct returned by value, relying on RVO (THIS_AUTO_OK)
    1426            0 :         this->Representation->performance.performance_map_cooling.calculate_performance(this->EvapVolFlowRate,
    1427            0 :                                                                                         this->EvapOutletTemp + Constant::Kelvin,
    1428              :                                                                                         this->CondVolFlowRate,
    1429            0 :                                                                                         this->CondInletTemp + Constant::Kelvin,
    1430              :                                                                                         partLoadSeqNum,
    1431              :                                                                                         this->InterpolationType);
    1432            0 :     this->QEvaporator = lookupVariablesCooling.net_evaporator_capacity * this->ChillerCyclingRatio;
    1433              : 
    1434            0 :     Real64 evapDeltaTemp = this->QEvaporator / this->EvapMassFlowRate / CpEvap;
    1435            0 :     this->EvapOutletTemp = state.dataLoopNodes->Node(this->EvapInletNodeNum).Temp - evapDeltaTemp;
    1436              : 
    1437              :     // TODO: Revisit fault
    1438              : #if 0
    1439              :         // If there is a fault of Chiller SWT Sensor
    1440              :         if (this->FaultyChillerSWTFlag && (!state.dataGlobal->WarmupFlag) && (!state.dataGlobal->DoingSizing) &&
    1441              :             (!state.dataGlobal->KickOffSimulation) && (this->EvapMassFlowRate > 0)) {
    1442              :             // calculate directly affected variables at faulty case: EvapOutletTemp, EvapMassFlowRate, QEvaporator
    1443              :             int FaultIndex = this->FaultyChillerSWTIndex;
    1444              :             bool VarFlowFlag = false;
    1445              :             state.dataFaultsMgr->FaultsChillerSWTSensor(FaultIndex)
    1446              :                     .CalFaultChillerSWT(VarFlowFlag,
    1447              :                                         this->FaultyChillerSWTOffset,
    1448              :                                         Cp,
    1449              :                                         state.dataLoopNodes->Node(this->EvapInletNodeNum).Temp,
    1450              :                                         this->EvapOutletTemp,
    1451              :                                         this->EvapMassFlowRate,
    1452              :                                         this->QEvaporator);
    1453              :             // update corresponding variables at faulty case
    1454              :         }
    1455              : #endif // 0
    1456              : 
    1457            0 :     Real64 cd = this->Representation->performance.cycling_degradation_coefficient;
    1458            0 :     Real64 cyclingFactor{(1.0 - cd) + (cd * this->ChillerCyclingRatio)};
    1459            0 :     Real64 runtimeFactor{this->ChillerCyclingRatio / cyclingFactor};
    1460            0 :     this->Power = lookupVariablesCooling.input_power * runtimeFactor + ((1 - this->ChillerCyclingRatio) * standbyPower);
    1461            0 :     this->QCondenser = lookupVariablesCooling.net_condenser_capacity * this->ChillerCyclingRatio;
    1462            0 :     this->QOilCooler = lookupVariablesCooling.oil_cooler_heat;
    1463            0 :     this->QAuxiliary = lookupVariablesCooling.auxiliary_heat;
    1464            0 :     Real64 QExternallyCooled{0.0};
    1465            0 :     if (this->OilCoolerInletNode) {
    1466            0 :         QExternallyCooled += this->QOilCooler;
    1467              :     }
    1468            0 :     if (this->AuxiliaryHeatInletNode) {
    1469            0 :         QExternallyCooled += this->QAuxiliary;
    1470              :     }
    1471              :     // Energy balance on the chiller system gives the amount of heat lost to the ambient zone
    1472            0 :     this->AmbientZoneGain = this->QEvaporator + this->Power - (this->QCondenser + QExternallyCooled);
    1473              : 
    1474            0 :     Real64 CpCond = this->CDPlantLoc.loop->glycol->getSpecificHeat(state, condInletTemp, RoutineName);
    1475            0 :     this->CondOutletTemp = this->QCondenser / this->CondMassFlowRate / CpCond + condInletTemp;
    1476              : 
    1477              :     // Oil cooler and Auxiliary Heat delta-T calculations
    1478            0 :     if (this->OilCoolerInletNode) {
    1479            0 :         Real64 oilCoolerDeltaTemp = 0.0;
    1480            0 :         PlantUtilities::SetComponentFlowRate(
    1481            0 :             state, this->OilCoolerMassFlowRate, this->OilCoolerInletNode, this->OilCoolerOutletNode, this->OCPlantLoc);
    1482              : 
    1483              :         Real64 CpOilCooler =
    1484            0 :             this->OCPlantLoc.loop->glycol->getSpecificHeat(state, state.dataLoopNodes->Node(this->OilCoolerInletNode).Temp, RoutineName);
    1485              : 
    1486            0 :         if (this->OilCoolerMassFlowRate != 0.0) {
    1487            0 :             oilCoolerDeltaTemp = this->QOilCooler / (this->OilCoolerMassFlowRate * CpOilCooler);
    1488              :         } else {
    1489            0 :             oilCoolerDeltaTemp = 0.0;
    1490              :         }
    1491            0 :         state.dataLoopNodes->Node(this->OilCoolerOutletNode).Temp = state.dataLoopNodes->Node(this->OilCoolerInletNode).Temp - oilCoolerDeltaTemp;
    1492              :     }
    1493            0 :     if (this->AuxiliaryHeatInletNode) {
    1494            0 :         Real64 auxiliaryDeltaTemp = 0.0;
    1495            0 :         PlantUtilities::SetComponentFlowRate(
    1496            0 :             state, this->AuxiliaryMassFlowRate, this->AuxiliaryHeatInletNode, this->AuxiliaryHeatOutletNode, this->AHPlantLoc);
    1497              : 
    1498              :         Real64 CpAux =
    1499            0 :             this->AHPlantLoc.loop->glycol->getSpecificHeat(state, state.dataLoopNodes->Node(this->AuxiliaryHeatInletNode).Temp, RoutineName);
    1500              : 
    1501            0 :         if (this->AuxiliaryMassFlowRate != 0.0) {
    1502            0 :             auxiliaryDeltaTemp = this->QAuxiliary / (this->AuxiliaryMassFlowRate * CpAux);
    1503              :         } else {
    1504            0 :             auxiliaryDeltaTemp = 0.0;
    1505              :         }
    1506            0 :         state.dataLoopNodes->Node(this->AuxiliaryHeatOutletNode).Temp =
    1507            0 :             state.dataLoopNodes->Node(this->AuxiliaryHeatInletNode).Temp - auxiliaryDeltaTemp;
    1508              :     }
    1509              : }
    1510              : 
    1511            0 : void ASHRAE205ChillerSpecs::update(EnergyPlusData &state, Real64 const MyLoad, bool const RunFlag)
    1512              : {
    1513            0 :     if (MyLoad >= 0.0 || !RunFlag) { // Chiller not running so pass inlet states to outlet states
    1514              :         // Set node temperatures
    1515            0 :         state.dataLoopNodes->Node(this->EvapOutletNodeNum).Temp = state.dataLoopNodes->Node(this->EvapInletNodeNum).Temp;
    1516            0 :         state.dataLoopNodes->Node(this->CondOutletNodeNum).Temp = state.dataLoopNodes->Node(this->CondInletNodeNum).Temp;
    1517            0 :         if (this->OilCoolerInletNode) {
    1518            0 :             state.dataLoopNodes->Node(this->OilCoolerOutletNode).Temp = state.dataLoopNodes->Node(this->OilCoolerInletNode).Temp;
    1519              :         }
    1520            0 :         if (this->AuxiliaryHeatInletNode) {
    1521            0 :             state.dataLoopNodes->Node(this->AuxiliaryHeatOutletNode).Temp = state.dataLoopNodes->Node(this->AuxiliaryHeatInletNode).Temp;
    1522              :         }
    1523              : 
    1524            0 :         this->ChillerPartLoadRatio = 0.0;
    1525            0 :         this->ChillerCyclingRatio = 0.0;
    1526            0 :         this->ChillerFalseLoadRate = 0.0;
    1527            0 :         this->ChillerFalseLoad = 0.0;
    1528            0 :         this->QEvaporator = 0.0;
    1529            0 :         this->QCondenser = 0.0;
    1530            0 :         this->Energy = 0.0;
    1531            0 :         this->EvapEnergy = 0.0;
    1532            0 :         this->CondEnergy = 0.0;
    1533            0 :         this->QOilCooler = 0.0;
    1534            0 :         this->QAuxiliary = 0.0;
    1535            0 :         this->OilCoolerEnergy = 0.0;
    1536            0 :         this->AuxiliaryEnergy = 0.0;
    1537            0 :         this->EvapInletTemp = state.dataLoopNodes->Node(this->EvapInletNodeNum).Temp;
    1538            0 :         this->CondInletTemp = state.dataLoopNodes->Node(this->CondInletNodeNum).Temp;
    1539            0 :         this->CondOutletTemp = state.dataLoopNodes->Node(this->CondOutletNodeNum).Temp;
    1540            0 :         this->EvapOutletTemp = state.dataLoopNodes->Node(this->EvapOutletNodeNum).Temp;
    1541            0 :         this->ActualCOP = 0.0;
    1542              : 
    1543              :     } else { // Chiller is running, so pass calculated values
    1544              :         // Set node temperatures
    1545            0 :         state.dataLoopNodes->Node(this->EvapOutletNodeNum).Temp = this->EvapOutletTemp;
    1546            0 :         state.dataLoopNodes->Node(this->CondOutletNodeNum).Temp = this->CondOutletTemp;
    1547              :         // Set node flow rates;  for these load based models
    1548              :         // assume that sufficient evaporator flow rate is available
    1549            0 :         this->EvapEnergy = this->QEvaporator * state.dataHVACGlobal->TimeStepSysSec;
    1550            0 :         this->CondEnergy = this->QCondenser * state.dataHVACGlobal->TimeStepSysSec;
    1551            0 :         this->OilCoolerEnergy = this->QOilCooler * state.dataHVACGlobal->TimeStepSysSec;
    1552            0 :         this->AuxiliaryEnergy = this->QAuxiliary * state.dataHVACGlobal->TimeStepSysSec;
    1553            0 :         this->EvapInletTemp = state.dataLoopNodes->Node(this->EvapInletNodeNum).Temp;
    1554            0 :         this->CondInletTemp = state.dataLoopNodes->Node(this->CondInletNodeNum).Temp;
    1555            0 :         this->CondOutletTemp = state.dataLoopNodes->Node(this->CondOutletNodeNum).Temp;
    1556            0 :         if (this->Power != 0.0) {
    1557            0 :             this->ActualCOP = this->QEvaporator / this->Power;
    1558              :         } else {
    1559            0 :             this->ActualCOP = 0.0;
    1560              :         }
    1561              :     }
    1562              : 
    1563              :     // Calculate in case of standby power
    1564            0 :     this->AmbientZoneGainEnergy = this->AmbientZoneGain * state.dataHVACGlobal->TimeStepSysSec;
    1565            0 :     this->Energy = this->Power * state.dataHVACGlobal->TimeStepSysSec;
    1566            0 : }
    1567              : 
    1568            0 : void ASHRAE205ChillerSpecs::simulate(
    1569              :     EnergyPlusData &state, const PlantLocation &calledFromLocation, bool FirstHVACIteration, Real64 &CurLoad, bool RunFlag)
    1570              : {
    1571            0 :     if (calledFromLocation.loopNum == this->CWPlantLoc.loopNum) {
    1572            0 :         this->initialize(state, RunFlag, CurLoad);
    1573            0 :         this->calculate(state, CurLoad, RunFlag);
    1574            0 :         this->update(state, CurLoad, RunFlag);
    1575            0 :     } else if (calledFromLocation.loopNum == this->CDPlantLoc.loopNum) {
    1576            0 :         DataPlant::LoopSideLocation LoopSide = this->CDPlantLoc.loopSideNum;
    1577            0 :         PlantUtilities::UpdateChillerComponentCondenserSide(state,
    1578            0 :                                                             calledFromLocation.loopNum,
    1579              :                                                             LoopSide,
    1580              :                                                             DataPlant::PlantEquipmentType::Chiller_ElectricASHRAE205,
    1581              :                                                             this->CondInletNodeNum,
    1582              :                                                             this->CondOutletNodeNum,
    1583              :                                                             this->QCondenser,
    1584              :                                                             this->CondInletTemp,
    1585              :                                                             this->CondOutletTemp,
    1586              :                                                             this->CondMassFlowRate,
    1587              :                                                             FirstHVACIteration);
    1588              :     }
    1589            0 : }
    1590              : 
    1591            0 : void ASHRAE205ChillerSpecs::getDesignCapacities(
    1592              :     [[maybe_unused]] EnergyPlusData &state, const PlantLocation &calledFromLocation, Real64 &MaxLoad, Real64 &MinLoad, Real64 &OptLoad)
    1593              : {
    1594            0 :     if (calledFromLocation.loopNum == this->CWPlantLoc.loopNum) {
    1595            0 :         MinLoad = this->Representation->performance.performance_map_cooling
    1596            0 :                       .calculate_performance(this->EvapVolFlowRate,
    1597            0 :                                              this->TempRefEvapOut + Constant::Kelvin,
    1598              :                                              this->CondVolFlowRate,
    1599            0 :                                              this->TempRefCondIn + Constant::Kelvin,
    1600            0 :                                              this->MinSequenceNumber,
    1601              :                                              this->InterpolationType)
    1602            0 :                       .net_evaporator_capacity;
    1603            0 :         MaxLoad = this->RefCap;
    1604            0 :         OptLoad = MaxLoad;
    1605              :     } else {
    1606            0 :         MinLoad = 0.0;
    1607            0 :         MaxLoad = 0.0;
    1608            0 :         OptLoad = 0.0;
    1609              :     }
    1610            0 : }
    1611              : 
    1612              : } // namespace EnergyPlus::ChillerElectricASHRAE205
        

Generated by: LCOV version 2.0-1