LCOV - code coverage report
Current view: top level - EnergyPlus - ChillerElectricASHRAE205.hh (source / functions) Hit Total Coverage
Test: lcov.output.filtered Lines: 3 6 50.0 %
Date: 2023-01-17 19:17:23 Functions: 5 8 62.5 %

          Line data    Source code
       1             : // EnergyPlus, Copyright (c) 1996-2023, 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             : #ifndef ChillerElectricASHRAE205_hh_INCLUDED
      49             : #define ChillerElectricASHRAE205_hh_INCLUDED
      50             : 
      51             : #include <ObjexxFCL/Array1D.hh>
      52             : 
      53             : #include "EnergyPlus/ChillerElectricEIR.hh"
      54             : #include "rs0001.h"
      55             : #include <EnergyPlus/Data/BaseData.hh>
      56             : #include <EnergyPlus/DataGlobals.hh>
      57             : #include <EnergyPlus/EnergyPlus.hh>
      58             : 
      59             : namespace EnergyPlus {
      60             : 
      61             : struct EnergyPlusData;
      62             : 
      63             : namespace ChillerElectricASHRAE205 {
      64             : 
      65             :     enum class AmbientTempIndicator
      66             :     {
      67             :         Invalid = -1,
      68             :         Schedule,   // ambient temperature around tank (or HPWH inlet air) is scheduled
      69             :         TempZone,   // tank is located in a zone or HPWH inlet air is zone air only
      70             :         OutsideAir, // tank is located outdoors or HPWH inlet air is outdoor air only
      71             :         ZoneAndOA,  // applicable to HPWH only, inlet air is mixture of OA and zone air
      72             :         Num,
      73             :     };
      74             : 
      75             :     void tk205ErrCallback(tk205::MsgSeverity message_type, const std::string &message, void *context_ptr);
      76             : 
      77             :     void getChillerASHRAE205Input(EnergyPlusData &state);
      78             : 
      79          13 :     struct ASHRAE205ChillerSpecs : ChillerElectricEIR::ElectricEIRChillerSpecs
      80             :     {
      81             :         static constexpr std::string_view ObjectType{"Chiller:Electric:ASHRAE205"};
      82             :         std::shared_ptr<tk205::rs0001_ns::RS0001> Representation; // ASHRAE205 representation instance
      83             :         Btwxt::Method InterpolationType{Btwxt::Method::LINEAR};
      84             :         int MinSequenceNumber{1};
      85             :         int MaxSequenceNumber{1};
      86             : 
      87             :         int OilCoolerInletNode{0};
      88             :         int OilCoolerOutletNode{0};
      89             :         Real64 OilCoolerVolFlowRate{0};
      90             :         Real64 OilCoolerMassFlowRate{0};
      91             :         PlantLocation OCPlantLoc{0, DataPlant::LoopSideLocation::Invalid, 0, 0};
      92             :         int AuxiliaryHeatInletNode{0};
      93             :         int AuxiliaryHeatOutletNode{0};
      94             :         Real64 AuxiliaryVolFlowRate{0};
      95             :         Real64 AuxiliaryMassFlowRate{0};
      96             :         PlantLocation AHPlantLoc{0, DataPlant::LoopSideLocation::Invalid, 0, 0};
      97             :         Real64 QOilCooler{0};
      98             :         Real64 QAuxiliary{0};
      99             :         Real64 OilCoolerEnergy{0};
     100             :         Real64 AuxiliaryEnergy{0};
     101             : 
     102             :         AmbientTempIndicator AmbientTempType{AmbientTempIndicator::Invalid};
     103             :         int AmbientTempSchedule{0};       // Schedule index pointer
     104             :         int AmbientTempZone{0};           // Number of ambient zone around tank
     105             :         int AmbientTempOutsideAirNode{0}; // Number of outside air node
     106             :         Real64 AmbientTemp{0};
     107             :         Real64 AmbientZoneGain{0};         // Internal gain to zone from losses (W)
     108             :         Real64 AmbientZoneGainEnergy{0};   // Internal gain to zone from losses (J)
     109             :         std::string EndUseSubcategory{""}; // identifier use for the end use subcategory
     110             : 
     111             :         // Default Constructor
     112           3 :         ASHRAE205ChillerSpecs() = default;
     113             : 
     114             :         void setOutputVariables(EnergyPlusData &state);
     115             : 
     116             :         static ASHRAE205ChillerSpecs *factory(EnergyPlusData &state, std::string const &chillerName);
     117             : 
     118             :         void simulate([[maybe_unused]] EnergyPlusData &state,
     119             :                       const PlantLocation &calledFromLocation,
     120             :                       bool FirstHVACIteration,
     121             :                       Real64 &CurLoad,
     122             :                       bool RunFlag) override;
     123             : 
     124             :         void getDesignCapacities(
     125             :             EnergyPlusData &state, const PlantLocation &calledFromLocation, Real64 &MaxLoad, Real64 &MinLoad, Real64 &OptLoad) override;
     126             : 
     127             :         void initialize(EnergyPlusData &state, bool RunFlag, Real64 MyLoad) override;
     128             : 
     129             :         void size(EnergyPlusData &state) override;
     130             : 
     131             :         void findEvaporatorMassFlowRate(EnergyPlusData &state, Real64 &load, Real64 Cp);
     132             : 
     133             :         void calculate(EnergyPlusData &state,
     134             :                        Real64 &MyLoad, // operating load
     135             :                        bool RunFlag    // TRUE when chiller operating
     136             :                        ) override;
     137             : 
     138             :         void update(EnergyPlusData &state,
     139             :                     Real64 MyLoad, // current load
     140             :                     bool RunFlag   // TRUE if chiller operating
     141             :                     ) override;
     142             : 
     143             :         void oneTimeInit_new(EnergyPlusData &state) override;
     144             :     };
     145             : 
     146             : } // namespace ChillerElectricASHRAE205
     147             : 
     148        1542 : struct ChillerElectricASHRAE205Data : BaseGlobalStruct
     149             : {
     150             :     bool getInputFlag = true;
     151             :     Array1D<ChillerElectricASHRAE205::ASHRAE205ChillerSpecs> Electric205Chiller;
     152             : 
     153           0 :     void clear_state() override
     154             :     {
     155           0 :         *this = ChillerElectricASHRAE205Data();
     156           0 :     }
     157             : };
     158             : 
     159             : } // namespace EnergyPlus
     160             : #endif // ChillerElectricASHRAE205_hh_INCLUDED

Generated by: LCOV version 1.13