LCOV - code coverage report
Current view: top level - EnergyPlus - CostEstimateManager.hh (source / functions) Coverage Total Hit
Test: lcov.output.filtered Lines: 100.0 % 14 14
Test Date: 2025-05-22 16:09:37 Functions: 100.0 % 5 5

            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              : #ifndef CostEstimateManager_hh_INCLUDED
      49              : #define CostEstimateManager_hh_INCLUDED
      50              : 
      51              : // EnergyPlus Headers
      52              : #include <EnergyPlus/Data/BaseData.hh>
      53              : #include <EnergyPlus/EnergyPlus.hh>
      54              : 
      55              : namespace EnergyPlus {
      56              : 
      57              : // Forward declarations
      58              : struct EnergyPlusData;
      59              : 
      60              : namespace CostEstimateManager {
      61              : 
      62              :     enum class ParentObject
      63              :     {
      64              :         Invalid = -1,
      65              :         General,
      66              :         Construction,
      67              :         CoilDX,
      68              :         CoilCoolingDX,
      69              :         CoilCoolingDXSingleSpeed,
      70              :         CoilHeatingFuel,
      71              :         ChillerElectric,
      72              :         DaylightingControls,
      73              :         ShadingZoneDetailed,
      74              :         Lights,
      75              :         GeneratorPhotovoltaic,
      76              :         Num
      77              :     };
      78              : 
      79              :     struct CostLineItemStruct
      80              :     {
      81              :         // Members
      82              :         std::string LineName;       // object name (needed ?)
      83              :         ParentObject ParentObjType; // parent reference to IDD object type
      84              :         std::string ParentObjName;  // parent instance in IDF
      85              :         int ParentObjIDinList = 1;
      86              :         Real64 PerSquareMeter = 0.0;     // cost per square meter
      87              :         Real64 PerEach = 0.0;            // cost per each
      88              :         Real64 PerKiloWattCap = 0.0;     // cost per kW of nominal capacity
      89              :         Real64 PerKWCapPerCOP = 0.0;     // cost per kW of nominal capacity per COP
      90              :         Real64 PerCubicMeter = 0.0;      // cost per cubic meter
      91              :         Real64 PerCubMeterPerSec = 0.0;  // cost per cubic meter per second
      92              :         Real64 PerUAinWattperDelK = 0.0; // cost per (UA) in Watt/deltaK
      93              :         int LineNumber = -1;             // number of line item in detail list
      94              :         Real64 Qty = 0.0;                // quantity in calculations (can be input)
      95              :         std::string Units;               // Reported units
      96              :         Real64 ValuePer = 0.0;           // Cost used in final calculation
      97              :         Real64 LineSubTotal = 0.0;       // line item total  Qty * ValuePer
      98              :     };
      99              : 
     100              :     struct CostAdjustmentStruct
     101              :     {
     102              :         // Members
     103              :         Real64 LineItemTot;        // = 0.0 ! holds total from line item cost calculations
     104              :         Real64 MiscCostperSqMeter; // = 0.0 ! holds user-defined constant cost model
     105              :         Real64 DesignFeeFrac;      // = 0.0 ! holds user-defined fraction for design fees
     106              :         Real64 ContractorFeeFrac;  // = 0.0 ! holds user-defined fraction for contractor fees
     107              :         Real64 ContingencyFrac;    // = 0.0 ! holds user-defined fraction for contingencies
     108              :         Real64 BondCostFrac;       // = 0.0 ! holds user-defined fraction for bonding costs
     109              :         Real64 CommissioningFrac;  // = 0.0 ! holds user-defined fraction for commissioning costs
     110              :         Real64 RegionalModifier;   // = 1.0 ! holds user-defined multiplier to account for regional diffs
     111              :         Real64 GrandTotal;         // = 0.0 ! the Grand Total of all line items plus all other costs
     112              : 
     113              :         // Default Constructor
     114              :         CostAdjustmentStruct()
     115              :             : LineItemTot(0.0), MiscCostperSqMeter(0.0), DesignFeeFrac(0.0), ContractorFeeFrac(0.0), ContingencyFrac(0.0), BondCostFrac(0.0),
     116              :               CommissioningFrac(0.0), RegionalModifier(0.0), GrandTotal(0.0)
     117              :         {
     118              :         }
     119              : 
     120              :         // Member Constructor
     121         8458 :         CostAdjustmentStruct(Real64 const LineItemTot,        // = 0.0 ! holds total from line item cost calculations
     122              :                              Real64 const MiscCostperSqMeter, // = 0.0 ! holds user-defined constant cost model
     123              :                              Real64 const DesignFeeFrac,      // = 0.0 ! holds user-defined fraction for design fees
     124              :                              Real64 const ContractorFeeFrac,  // = 0.0 ! holds user-defined fraction for contractor fees
     125              :                              Real64 const ContingencyFrac,    // = 0.0 ! holds user-defined fraction for contingencies
     126              :                              Real64 const BondCostFrac,       // = 0.0 ! holds user-defined fraction for bonding costs
     127              :                              Real64 const CommissioningFrac,  // = 0.0 ! holds user-defined fraction for commissioning costs
     128              :                              Real64 const RegionalModifier,   // = 1.0 ! holds user-defined multiplier to account for regional diffs
     129              :                              Real64 const GrandTotal          // = 0.0 ! the Grand Total of all line items plus all other costs
     130              :                              )
     131         8458 :             : LineItemTot(LineItemTot), MiscCostperSqMeter(MiscCostperSqMeter), DesignFeeFrac(DesignFeeFrac), ContractorFeeFrac(ContractorFeeFrac),
     132         8458 :               ContingencyFrac(ContingencyFrac), BondCostFrac(BondCostFrac), CommissioningFrac(CommissioningFrac), RegionalModifier(RegionalModifier),
     133         8458 :               GrandTotal(GrandTotal)
     134              :         {
     135         8458 :         }
     136              :     };
     137              : 
     138              :     struct monetaryUnitType
     139              :     {
     140              :         // Members
     141              :         std::string code; // ISO code for currency such as USD or EUR
     142              :         std::string txt;  // text representation of the currency
     143              :         std::string html; // representation for HTML file - contains unicode references
     144              : 
     145              :         // Default Constructor
     146         8880 :         monetaryUnitType() : code(std::string()), txt(std::string()), html(std::string())
     147              :         {
     148         8880 :         }
     149              :     };
     150              : 
     151              :     void SimCostEstimate(EnergyPlusData &state);
     152              : 
     153              :     void GetCostEstimateInput(EnergyPlusData &state);
     154              : 
     155              :     void CheckCostEstimateInput(EnergyPlusData &state, bool &ErrorsFound); // Set to true if errors in input, fatal at end of routine
     156              : 
     157              :     void CalcCostEstimate(EnergyPlusData &state);
     158              : 
     159              : } // namespace CostEstimateManager
     160              : 
     161              : struct CostEstimateManagerData : BaseGlobalStruct
     162              : {
     163              : 
     164              :     bool GetCostInput = true;
     165              :     bool DoCostEstimate = false; // set to true if any cost estimating needed
     166              :     int selectedMonetaryUnit = 0;
     167              : 
     168              :     Array1D<CostEstimateManager::CostLineItemStruct> CostLineItem;
     169              : 
     170              :     CostEstimateManager::CostAdjustmentStruct CurntBldg = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0};
     171              :     // holds total from line item cost calculations | holds user-defined
     172              :     // constant cost model | holds user-defined fraction for design fees
     173              :     // | holds user-defined fraction for contractor fees | holds
     174              :     // user-defined fraction for contingencies | holds user-defined
     175              :     // fraction for bonding costs | holds user-defined fraction for
     176              :     // commissioning costs | holds user-defined multiplier to account for
     177              :     // regional diffs | the Grand Total of all line items plus all other
     178              :     // costs
     179              : 
     180              :     CostEstimateManager::CostAdjustmentStruct RefrncBldg{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0};
     181              :     // holds total from line item cost calculations | holds user-defined
     182              :     // constant cost model | holds user-defined fraction for design fees
     183              :     // | holds user-defined fraction for contractor fees | holds
     184              :     // user-defined fraction for contingencies | holds user-defined
     185              :     // fraction for bonding costs | holds user-defined fraction for
     186              :     // commissioning costs | holds user-defined multiplier to account
     187              :     // for regional diffs | the Grand Total of all line items plus all
     188              :     // other costs
     189              : 
     190              :     Array1D<CostEstimateManager::monetaryUnitType> monetaryUnit;
     191              : 
     192         2126 :     void init_constant_state([[maybe_unused]] EnergyPlusData &state) override
     193              :     {
     194         2126 :     }
     195              : 
     196         1152 :     void init_state([[maybe_unused]] EnergyPlusData &state) override
     197              :     {
     198         1152 :     }
     199              : 
     200         2100 :     void clear_state() override
     201              :     {
     202         2100 :         new (this) CostEstimateManagerData();
     203         2100 :     }
     204              : };
     205              : 
     206              : } // namespace EnergyPlus
     207              : 
     208              : #endif
        

Generated by: LCOV version 2.0-1