LCOV - code coverage report
Current view: top level - EnergyPlus - PlantValves.cc (source / functions) Coverage Total Hit
Test: lcov.output.filtered Lines: 0.0 % 164 0
Test Date: 2025-05-22 16:09:37 Functions: 0.0 % 8 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 <algorithm>
      50              : 
      51              : // ObjexxFCL Headers
      52              : #include <ObjexxFCL/Array.functions.hh>
      53              : 
      54              : // EnergyPlus Headers
      55              : #include <EnergyPlus/BranchNodeConnections.hh>
      56              : #include <EnergyPlus/Data/EnergyPlusData.hh>
      57              : #include <EnergyPlus/DataBranchAirLoopPlant.hh>
      58              : #include <EnergyPlus/DataHVACGlobals.hh>
      59              : #include <EnergyPlus/DataIPShortCuts.hh>
      60              : #include <EnergyPlus/DataLoopNode.hh>
      61              : #include <EnergyPlus/General.hh>
      62              : #include <EnergyPlus/InputProcessing/InputProcessor.hh>
      63              : #include <EnergyPlus/NodeInputManager.hh>
      64              : #include <EnergyPlus/OutputProcessor.hh>
      65              : #include <EnergyPlus/Plant/DataPlant.hh>
      66              : #include <EnergyPlus/PlantUtilities.hh>
      67              : #include <EnergyPlus/PlantValves.hh>
      68              : #include <EnergyPlus/UtilityRoutines.hh>
      69              : 
      70              : namespace EnergyPlus {
      71              : 
      72              : namespace PlantValves {
      73              : 
      74              :     // Module containing the routines dealing with the <module_name>
      75              : 
      76              :     // MODULE INFORMATION:
      77              :     //       AUTHOR         B. Griffith
      78              :     //       DATE WRITTEN   Jan, 2006
      79              :     //       MODIFIED       Nov 2010, B. Griffith, plant upgrades
      80              :     //       RE-ENGINEERED  na
      81              : 
      82              :     // PURPOSE OF THIS MODULE:
      83              :     // Collect "valve" type models for Plant loops
      84              : 
      85              :     using namespace DataLoopNode;
      86              : 
      87            0 :     PlantComponent *TemperValveData::factory(EnergyPlusData &state, std::string objectName)
      88              :     {
      89              :         // Process the input data for valves if it hasn't been done already
      90            0 :         if (state.dataPlantValves->GetTemperingValves) {
      91            0 :             GetPlantValvesInput(state);
      92            0 :             state.dataPlantValves->GetTemperingValves = false;
      93              :         }
      94              :         // Now look for this particular pipe in the list
      95            0 :         for (auto &valve : state.dataPlantValves->TemperValve) {
      96            0 :             if (valve.Name == objectName) {
      97            0 :                 return &valve;
      98              :             }
      99              :         }
     100              :         // If we didn't find it, fatal
     101              :         ShowFatalError(state, format("TemperValveDataFactory: Error getting inputs for valve named: {}", objectName)); // LCOV_EXCL_LINE
     102              :         // Shut up the compiler
     103              :         return nullptr; // LCOV_EXCL_LINE
     104              :     }
     105              : 
     106            0 :     void TemperValveData::simulate(EnergyPlusData &state,
     107              :                                    [[maybe_unused]] const PlantLocation &calledFromLocation,
     108              :                                    [[maybe_unused]] bool FirstHVACIteration,
     109              :                                    [[maybe_unused]] Real64 &CurLoad,
     110              :                                    [[maybe_unused]] bool RunFlag)
     111              :     {
     112            0 :         this->initialize(state);
     113            0 :         this->calculate(state);
     114            0 :         PlantUtilities::SafeCopyPlantNode(state, this->PltInletNodeNum, this->PltOutletNodeNum);
     115            0 :         Real64 mdot = this->MixedMassFlowRate * this->FlowDivFract;
     116            0 :         if (this->plantLoc.loopNum > 0) {
     117            0 :             PlantUtilities::SetComponentFlowRate(state, mdot, this->PltInletNodeNum, this->PltOutletNodeNum, this->plantLoc);
     118              :         }
     119            0 :     }
     120              : 
     121            0 :     void TemperValveData::getDesignCapacities([[maybe_unused]] EnergyPlusData &state,
     122              :                                               [[maybe_unused]] const PlantLocation &calledFromLocation,
     123              :                                               Real64 &MaxLoad,
     124              :                                               Real64 &MinLoad,
     125              :                                               Real64 &OptLoad)
     126              :     {
     127            0 :         MaxLoad = 0.0;
     128            0 :         MinLoad = 0.0;
     129            0 :         OptLoad = 0.0;
     130            0 :     }
     131              : 
     132            0 :     void GetPlantValvesInput(EnergyPlusData &state)
     133              :     {
     134              : 
     135              :         // SUBROUTINE INFORMATION:
     136              :         //       AUTHOR         Brent Griffith
     137              :         //       DATE WRITTEN   Jan. 2006
     138              :         //       MODIFIED       na
     139              :         //       RE-ENGINEERED  na
     140              : 
     141              :         // PURPOSE OF THIS SUBROUTINE:
     142              :         // get input from user
     143              : 
     144              :         // METHODOLOGY EMPLOYED:
     145              :         // usual method using InputProcessor
     146              : 
     147              :         // Using/Aliasing
     148              :         using BranchNodeConnections::TestCompSet;
     149              :         using NodeInputManager::GetOnlySingleNode;
     150              : 
     151              :         // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
     152              :         int Item;                        // Item to be "gotten"
     153            0 :         Array1D_string Alphas(6);        // Alpha items for object
     154            0 :         Array1D<Real64> Numbers(1);      // Numeric items for object
     155              :         int NumAlphas;                   // Number of Alphas for each GetObjectItem call
     156              :         int NumNumbers;                  // Number of Numbers for each GetObjectItem call
     157              :         int IOStatus;                    // Used in GetObjectItem
     158            0 :         bool ErrorsFound(false);         // Set to true if errors in input, fatal at end of routine
     159            0 :         std::string CurrentModuleObject; // for ease in renaming.
     160              : 
     161            0 :         CurrentModuleObject = "TemperingValve";
     162            0 :         state.dataPlantValves->NumTemperingValves = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject);
     163              : 
     164            0 :         state.dataPlantValves->TemperValve.allocate(state.dataPlantValves->NumTemperingValves);
     165              : 
     166            0 :         for (Item = 1; Item <= state.dataPlantValves->NumTemperingValves; ++Item) {
     167              : 
     168            0 :             state.dataInputProcessing->inputProcessor->getObjectItem(
     169              :                 state, CurrentModuleObject, Item, Alphas, NumAlphas, Numbers, NumNumbers, IOStatus);
     170              :             //  <process, noting errors>
     171            0 :             state.dataPlantValves->TemperValve(Item).Name = Alphas(1);
     172              :             // Get Plant Inlet Node
     173            0 :             state.dataPlantValves->TemperValve(Item).PltInletNodeNum = GetOnlySingleNode(state,
     174            0 :                                                                                          Alphas(2),
     175              :                                                                                          ErrorsFound,
     176              :                                                                                          DataLoopNode::ConnectionObjectType::TemperingValve,
     177            0 :                                                                                          Alphas(1),
     178              :                                                                                          DataLoopNode::NodeFluidType::Water,
     179              :                                                                                          DataLoopNode::ConnectionType::Inlet,
     180              :                                                                                          NodeInputManager::CompFluidStream::Primary,
     181              :                                                                                          ObjectIsNotParent);
     182              :             // Get Plant Outlet Node
     183            0 :             state.dataPlantValves->TemperValve(Item).PltOutletNodeNum = GetOnlySingleNode(state,
     184            0 :                                                                                           Alphas(3),
     185              :                                                                                           ErrorsFound,
     186              :                                                                                           DataLoopNode::ConnectionObjectType::TemperingValve,
     187            0 :                                                                                           Alphas(1),
     188              :                                                                                           DataLoopNode::NodeFluidType::Water,
     189              :                                                                                           DataLoopNode::ConnectionType::Outlet,
     190              :                                                                                           NodeInputManager::CompFluidStream::Primary,
     191              :                                                                                           ObjectIsNotParent);
     192              : 
     193              :             // Get Stream 2 Source Node
     194            0 :             state.dataPlantValves->TemperValve(Item).PltStream2NodeNum = GetOnlySingleNode(state,
     195            0 :                                                                                            Alphas(4),
     196              :                                                                                            ErrorsFound,
     197              :                                                                                            DataLoopNode::ConnectionObjectType::TemperingValve,
     198            0 :                                                                                            Alphas(1),
     199              :                                                                                            DataLoopNode::NodeFluidType::Water,
     200              :                                                                                            DataLoopNode::ConnectionType::Sensor,
     201              :                                                                                            NodeInputManager::CompFluidStream::Primary,
     202              :                                                                                            ObjectIsNotParent);
     203              :             // Get Mixed water Setpoint
     204            0 :             state.dataPlantValves->TemperValve(Item).PltSetPointNodeNum = GetOnlySingleNode(state,
     205            0 :                                                                                             Alphas(5),
     206              :                                                                                             ErrorsFound,
     207              :                                                                                             DataLoopNode::ConnectionObjectType::TemperingValve,
     208            0 :                                                                                             Alphas(1),
     209              :                                                                                             DataLoopNode::NodeFluidType::Water,
     210              :                                                                                             DataLoopNode::ConnectionType::SetPoint,
     211              :                                                                                             NodeInputManager::CompFluidStream::Primary,
     212              :                                                                                             ObjectIsNotParent);
     213              : 
     214              :             // Get Pump outlet
     215            0 :             state.dataPlantValves->TemperValve(Item).PltPumpOutletNodeNum = GetOnlySingleNode(state,
     216            0 :                                                                                               Alphas(6),
     217              :                                                                                               ErrorsFound,
     218              :                                                                                               DataLoopNode::ConnectionObjectType::TemperingValve,
     219            0 :                                                                                               Alphas(1),
     220              :                                                                                               DataLoopNode::NodeFluidType::Water,
     221              :                                                                                               DataLoopNode::ConnectionType::Sensor,
     222              :                                                                                               NodeInputManager::CompFluidStream::Primary,
     223              :                                                                                               ObjectIsNotParent);
     224              : 
     225              :             // Note most checks on user input are made in second pass thru init routine
     226              : 
     227            0 :             TestCompSet(state, CurrentModuleObject, Alphas(1), Alphas(2), Alphas(3), "Supply Side Water Nodes");
     228              :         }
     229              : 
     230            0 :         for (Item = 1; Item <= state.dataPlantValves->NumTemperingValves; ++Item) {
     231              : 
     232            0 :             SetupOutputVariable(state,
     233              :                                 "Tempering Valve Flow Fraction",
     234              :                                 Constant::Units::None,
     235            0 :                                 state.dataPlantValves->TemperValve(Item).FlowDivFract,
     236              :                                 OutputProcessor::TimeStepType::System,
     237              :                                 OutputProcessor::StoreType::Average,
     238            0 :                                 state.dataPlantValves->TemperValve(Item).Name);
     239              :         }
     240              : 
     241            0 :         if (ErrorsFound) {
     242            0 :             ShowFatalError(state, format("GetPlantValvesInput: {} Errors found in input", CurrentModuleObject));
     243              :         }
     244            0 :     }
     245              : 
     246            0 :     void TemperValveData::initialize(EnergyPlusData &state)
     247              :     {
     248              : 
     249              :         // SUBROUTINE INFORMATION:
     250              :         //       AUTHOR         B. Griffith, NREL
     251              :         //       DATE WRITTEN   Jan. 2006
     252              :         //       MODIFIED       na
     253              :         //       RE-ENGINEERED  na
     254              : 
     255              :         // PURPOSE OF THIS SUBROUTINE:
     256              :         // initialize data for valve modeling
     257              : 
     258              :         // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
     259              :         int InletNode;   // local working variable for inlet node number
     260              :         int OutletNode;  // local working variable for outlet node number
     261              :         int Strm2Node;   // local working variable for stream 2 outlet node number
     262              :         int SetPntNode;  // local working variable for setpoint node number
     263              :         int PumpOutNode; // local working variable for pump outlet node number
     264              : 
     265              :         bool InNodeOnSplitter; // input data check
     266              :         bool PumpOutNodeOkay;  // input data check
     267              :         bool ErrorsFound;      // input data check
     268              :         bool TwoBranchesBetwn; // input data check
     269              :         bool SetPointNodeOkay; // input data check
     270              :         bool Stream2NodeOkay;  // input data check
     271              :         bool IsBranchActive;   // input data check
     272              : 
     273              :         bool errFlag;
     274              : 
     275            0 :         if (state.dataPlantValves->OneTimeInitFlag) {
     276            0 :             state.dataPlantValves->OneTimeInitFlag = false;
     277              :         } else {
     278              :             // delay checks one pass so more of plant data structure gets filled in
     279            0 :             if (this->compDelayedInitFlag) {
     280              :                 // do some checks on input data
     281              :                 // Search thru PlantLoop Data Structure to check some things.
     282              :                 // Locate the component on the plant loops for later usage
     283            0 :                 errFlag = false;
     284            0 :                 PlantUtilities::ScanPlantLoopsForObject(
     285            0 :                     state, this->Name, DataPlant::PlantEquipmentType::ValveTempering, this->plantLoc, errFlag, _, _, _, _, _);
     286              : 
     287            0 :                 if (errFlag) {
     288            0 :                     ShowFatalError(state, "InitPlantValves: Program terminated due to previous condition(s).");
     289              :                 }
     290              :                 // init logical flags
     291            0 :                 ErrorsFound = false;
     292            0 :                 InNodeOnSplitter = false;
     293            0 :                 PumpOutNodeOkay = false;
     294            0 :                 TwoBranchesBetwn = false;
     295            0 :                 SetPointNodeOkay = false;
     296            0 :                 Stream2NodeOkay = false;
     297            0 :                 IsBranchActive = false;
     298              : 
     299              :                 // . A) find indexes of PlantLoop, Half loop, and Branch by searching CompData
     300            0 :                 for (auto &thisPlantLoop : state.dataPlnt->PlantLoop) {
     301            0 :                     for (auto &thisLoopSide : thisPlantLoop.LoopSide) {
     302            0 :                         int branchCtr = 0;
     303            0 :                         for (auto const &thisBranch : thisLoopSide.Branch) {
     304            0 :                             branchCtr++;
     305            0 :                             for (auto const &thisComp : thisBranch.Comp) {
     306              : 
     307            0 :                                 if ((thisComp.Type == DataPlant::PlantEquipmentType::ValveTempering) &&
     308            0 :                                     (thisComp.Name == this->Name)) { // we found it.
     309              : 
     310              :                                     // is branch control type 'Active'
     311            0 :                                     if (thisBranch.controlType == DataBranchAirLoopPlant::ControlType::Active) IsBranchActive = true;
     312              : 
     313              :                                     // is Valve inlet node an outlet node of a splitter
     314            0 :                                     if (thisLoopSide.Splitter.Exists) {
     315            0 :                                         if (allocated(thisLoopSide.Splitter.NodeNumOut)) {
     316            0 :                                             if (any_eq(thisLoopSide.Splitter.NodeNumOut, this->PltInletNodeNum)) {
     317            0 :                                                 InNodeOnSplitter = true;
     318              :                                             }
     319              :                                         } // allocated
     320              : 
     321              :                                         // are there only 2 branches between splitter and mixer?
     322            0 :                                         if (thisLoopSide.Splitter.TotalOutletNodes == 2) {
     323            0 :                                             TwoBranchesBetwn = true;
     324              :                                         }
     325              :                                     } // has splitter
     326              : 
     327              :                                     // is stream 2 node an inlet to the mixer ?
     328            0 :                                     if (thisLoopSide.Mixer.Exists) {
     329            0 :                                         if (any_eq(thisLoopSide.Mixer.NodeNumIn, this->PltStream2NodeNum)) {
     330            0 :                                             int thisInnerBranchCtr = 0;
     331            0 :                                             for (auto const &thisInnerBranch : thisLoopSide.Branch) {
     332            0 :                                                 thisInnerBranchCtr++;
     333            0 :                                                 if (branchCtr == thisInnerBranchCtr) continue; // already looped into this one
     334            0 :                                                 for (auto const &thisInnerComp : thisInnerBranch.Comp) {
     335            0 :                                                     if (thisInnerComp.NodeNumOut == this->PltStream2NodeNum) {
     336            0 :                                                         Stream2NodeOkay = true;
     337              :                                                     }
     338              :                                                 }
     339              :                                             }
     340              :                                         }
     341              :                                     } // has mixer
     342              : 
     343              :                                     // is pump node really the outlet of a branch with a pump?
     344            0 :                                     for (auto const &thisInnerBranch : thisLoopSide.Branch) {
     345            0 :                                         if (thisInnerBranch.NodeNumOut == this->PltPumpOutletNodeNum) {
     346            0 :                                             for (auto const &thisInnerComp : thisInnerBranch.Comp) {
     347            0 :                                                 if (DataPlant::PlantEquipmentTypeIsPump[static_cast<int>(thisInnerComp.Type)]) {
     348            0 :                                                     PumpOutNodeOkay = true;
     349              :                                                 }
     350              :                                             }
     351              :                                         }
     352              :                                     }
     353              : 
     354              :                                     // does sensor node agree with plant loop setpoint?
     355            0 :                                     if (thisPlantLoop.TempSetPointNodeNum == this->PltSetPointNodeNum) {
     356            0 :                                         SetPointNodeOkay = true;
     357              :                                     }
     358              : 
     359              :                                 } // found item
     360              : 
     361              :                             } // comps
     362              :                         }     // Branches
     363              :                     }         // Loop Sides
     364              :                 }             // Plant loops
     365              : 
     366            0 :                 if (!IsBranchActive) {
     367            0 :                     ShowSevereError(state, "TemperingValve object needs to be on an ACTIVE branch");
     368            0 :                     ErrorsFound = true;
     369              :                 }
     370              : 
     371            0 :                 if (!InNodeOnSplitter) {
     372            0 :                     ShowSevereError(state, "TemperingValve object needs to be between a Splitter and Mixer");
     373            0 :                     ErrorsFound = true;
     374              :                 }
     375              : 
     376            0 :                 if (!PumpOutNodeOkay) {
     377            0 :                     ShowSevereError(state, "TemperingValve object needs to reference a node that is the outlet of a pump on its loop");
     378            0 :                     ErrorsFound = true;
     379              :                 }
     380              : 
     381            0 :                 if (!TwoBranchesBetwn) {
     382            0 :                     ShowSevereError(state, "TemperingValve object needs exactly two branches between a Splitter and Mixer");
     383            0 :                     ErrorsFound = true;
     384              :                 }
     385              : 
     386            0 :                 if (!SetPointNodeOkay) {
     387            0 :                     ShowSevereError(state, "TemperingValve object setpoint node not valid.  Check Setpoint manager for Plant Loop Temp Setpoint");
     388            0 :                     ErrorsFound = true;
     389              :                 }
     390              : 
     391            0 :                 if (!Stream2NodeOkay) {
     392            0 :                     ShowSevereError(state, "TemperingValve object stream 2 source node not valid.");
     393            0 :                     ShowContinueError(state, "Check that node is a component outlet, enters a mixer, and on the other branch");
     394            0 :                     ErrorsFound = true;
     395              :                 }
     396            0 :                 if (ErrorsFound) {
     397            0 :                     ShowFatalError(state, format("Errors found in input, TemperingValve object {}", this->Name));
     398              :                 }
     399            0 :                 this->compDelayedInitFlag = false;
     400              :             } // my two time flag for input checking
     401              : 
     402              :         } // my one time flag for input checking
     403              : 
     404            0 :         InletNode = this->PltInletNodeNum;
     405            0 :         OutletNode = this->PltOutletNodeNum;
     406            0 :         Strm2Node = this->PltStream2NodeNum;
     407            0 :         SetPntNode = this->PltSetPointNodeNum;
     408            0 :         PumpOutNode = this->PltPumpOutletNodeNum;
     409              : 
     410            0 :         if (state.dataGlobal->BeginEnvrnFlag && this->environmentInit) {
     411              : 
     412            0 :             if ((InletNode > 0) && (OutletNode > 0)) {
     413              :                 //   Node(InletNode)%Temp = 0.0
     414            0 :                 PlantUtilities::InitComponentNodes(
     415            0 :                     state, 0.0, state.dataLoopNodes->Node(PumpOutNode).MassFlowRateMax, this->PltInletNodeNum, this->PltOutletNodeNum);
     416              :             }
     417            0 :             this->environmentInit = false;
     418              :         }
     419              : 
     420            0 :         if (!state.dataGlobal->BeginEnvrnFlag) this->environmentInit = true;
     421              : 
     422            0 :         if (InletNode > 0) {
     423            0 :             this->InletTemp = state.dataLoopNodes->Node(InletNode).Temp;
     424              :         }
     425            0 :         if (Strm2Node > 0) {
     426            0 :             this->Stream2SourceTemp = state.dataLoopNodes->Node(Strm2Node).Temp;
     427              :         }
     428            0 :         if (SetPntNode > 0) {
     429            0 :             this->SetPointTemp = state.dataLoopNodes->Node(SetPntNode).TempSetPoint;
     430              :         }
     431            0 :         if (PumpOutNode > 0) {
     432            0 :             this->MixedMassFlowRate = state.dataLoopNodes->Node(PumpOutNode).MassFlowRate;
     433              :         }
     434            0 :     }
     435              : 
     436            0 :     void TemperValveData::calculate(EnergyPlusData &state)
     437              :     {
     438              : 
     439              :         // SUBROUTINE INFORMATION:
     440              :         //       AUTHOR         B. Griffith, NREL
     441              :         //       DATE WRITTEN   Jan. 2006
     442              :         //       MODIFIED       na
     443              :         //       RE-ENGINEERED  na
     444              : 
     445              :         // PURPOSE OF THIS SUBROUTINE:
     446              :         //  This routine does the calculations for Valves.
     447              :         //  Currently only one type of valve, for Tempering.
     448              : 
     449              :         // METHODOLOGY EMPLOYED:
     450              :         //   Tempering valve calculations involve computing a flow fraction
     451              :         //     that should be diverted.  See update routine for setting flow rates.
     452              : 
     453              :         // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
     454              :         Real64 Tin;  // local working variable for Inlet Temperature (C)
     455              :         Real64 Tset; // local working variable for Setpoint Temperature (C)
     456              :         Real64 Ts2;  // local Working Variable for Stream 2 outlet Temperature (C)
     457              : 
     458            0 :         if (state.dataGlobal->KickOffSimulation) return;
     459              : 
     460            0 :         if (state.dataPlnt->PlantLoop(this->plantLoc.loopNum).LoopSide(this->plantLoc.loopSideNum).FlowLock == DataPlant::FlowLock::Unlocked) {
     461            0 :             Tin = this->InletTemp;
     462            0 :             Tset = this->SetPointTemp;
     463            0 :             Ts2 = this->Stream2SourceTemp;
     464              : 
     465            0 :             if (Ts2 <= Tset) {
     466            0 :                 this->FlowDivFract = 0.0;
     467              :             } else { // Divert some or all flow
     468            0 :                 if (Tin < Ts2) {
     469            0 :                     this->FlowDivFract = (Ts2 - Tset) / (Ts2 - Tin);
     470              :                 } else {
     471            0 :                     this->FlowDivFract = 1.0;
     472              :                 }
     473              :             }
     474            0 :         } else if (state.dataPlnt->PlantLoop(this->plantLoc.loopNum).LoopSide(this->plantLoc.loopSideNum).FlowLock ==
     475              :                    DataPlant::FlowLock::Locked) { // don't recalc diversion, just reuse current flows
     476            0 :             if (this->MixedMassFlowRate > 0.0) {
     477            0 :                 this->FlowDivFract = state.dataLoopNodes->Node(this->PltOutletNodeNum).MassFlowRate / this->MixedMassFlowRate;
     478              :             } else {
     479            0 :                 this->FlowDivFract = 0.0;
     480              :             }
     481              :         }
     482              : 
     483            0 :         if (this->FlowDivFract < 0.0) this->FlowDivFract = 0.0;
     484            0 :         if (this->FlowDivFract > 1.0) this->FlowDivFract = 1.0;
     485              :     }
     486            0 :     void TemperValveData::oneTimeInit([[maybe_unused]] EnergyPlusData &state)
     487              :     {
     488            0 :     }
     489            0 :     void TemperValveData::oneTimeInit_new([[maybe_unused]] EnergyPlusData &state)
     490              :     {
     491            0 :     }
     492              : 
     493              : } // namespace PlantValves
     494              : 
     495              : } // namespace EnergyPlus
        

Generated by: LCOV version 2.0-1