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

            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 EconomicLifeCycleCost_hh_INCLUDED
      49              : #define EconomicLifeCycleCost_hh_INCLUDED
      50              : 
      51              : // C++ Headers
      52              : #include <map>
      53              : 
      54              : // ObjexxFCL Headers
      55              : #include <ObjexxFCL/Array1D.hh>
      56              : #include <ObjexxFCL/Array2D.hh>
      57              : 
      58              : // EnergyPlus Headers
      59              : #include <EnergyPlus/Data/BaseData.hh>
      60              : #include <EnergyPlus/DataGlobalConstants.hh>
      61              : #include <EnergyPlus/DataGlobals.hh>
      62              : #include <EnergyPlus/EPVector.hh>
      63              : #include <EnergyPlus/EnergyPlus.hh>
      64              : 
      65              : namespace EnergyPlus {
      66              : 
      67              : namespace EconomicLifeCycleCost {
      68              : 
      69              :     // Using/Aliasing
      70              : 
      71              :     // Data
      72              :     // MODULE PARAMETER DEFINITIONS:
      73              :     enum class DiscConv
      74              :     {
      75              :         Invalid = -1,
      76              :         BeginOfYear,
      77              :         MidYear,
      78              :         EndOfYear,
      79              :         Num
      80              :     };
      81              : 
      82              :     constexpr std::array<std::string_view, static_cast<int>(DiscConv::Num)> DiscConvNamesUC{"BEGINNINGOFYEAR", "MIDYEAR", "ENDOFYEAR"};
      83              : 
      84              :     constexpr std::array<std::string_view, static_cast<int>(DiscConv::Num)> DiscConvNames{"BeginningOfYear", "MidYear", "EndOfYear"};
      85              : 
      86              :     enum class InflAppr
      87              :     {
      88              :         Invalid = -1,
      89              :         ConstantDollar,
      90              :         CurrentDollar,
      91              :         Num
      92              :     };
      93              : 
      94              :     constexpr std::array<std::string_view, static_cast<int>(InflAppr::Num)> InflApprNamesUC{"CONSTANTDOLLAR", "CURRENTDOLLAR"};
      95              : 
      96              :     constexpr std::array<std::string_view, static_cast<int>(InflAppr::Num)> InflApprNames{"ConstantDollar", "CurrentDollar"};
      97              : 
      98              :     enum class DeprMethod
      99              :     {
     100              :         Invalid = -1,
     101              :         MACRS3,
     102              :         MACRS5,
     103              :         MACRS7,
     104              :         MACRS10,
     105              :         MACRS15,
     106              :         MACRS20,
     107              :         Straight27,
     108              :         Straight31,
     109              :         Straight39,
     110              :         Straight40,
     111              :         None,
     112              :         Num
     113              :     };
     114              : 
     115              :     int constexpr SizeDepr(41);
     116              : 
     117              :     constexpr std::array<std::array<Real64, SizeDepr>, static_cast<int>(DeprMethod::Num)> DepreciationPercentTable{
     118              :         {{33.33, 44.45, 14.81, 7.41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
     119              :          {20.0, 32.0, 19.2, 11.52, 11.52, 5.76, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
     120              :           0,    0,    0,    0,     0,     0,    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
     121              :          {14.29, 24.49, 17.49, 12.49, 8.93, 8.92, 8.93, 4.46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
     122              :           0,     0,     0,     0,     0,    0,    0,    0,    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
     123              :          {10.0, 18.0, 14.4, 11.52, 9.22, 7.37, 6.55, 6.55, 6.56, 6.55, 3.28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
     124              :           0,    0,    0,    0,     0,    0,    0,    0,    0,    0,    0,    0, 0, 0, 0, 0, 0, 0, 0, 0},
     125              :          {5.0, 9.5, 8.55, 7.7, 6.93, 6.23, 5.9, 5.9, 5.91, 5.9, 5.91, 5.9, 5.91, 5.9, 5.91, 2.95, 0, 0, 0, 0, 0,
     126              :           0,   0,   0,    0,   0,    0,    0,   0,   0,    0,   0,    0,   0,    0,   0,    0,    0, 0, 0, 0},
     127              :          {3.75,  7.219, 6.677, 6.177, 5.713, 5.285, 4.888, 4.522, 4.462, 4.461, 4.462, 4.461, 4.462, 4.461,
     128              :           4.462, 4.461, 4.462, 4.461, 4.462, 4.461, 2.231, 0,     0,     0,     0,     0,     0,     0,
     129              :           0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0},
     130              :          {1.97,  3.636, 3.636, 3.636, 3.636, 3.636, 3.636, 3.636, 3.636, 3.637, 3.636, 3.637, 3.636, 3.637,
     131              :           3.636, 3.637, 3.636, 3.637, 3.636, 3.637, 3.636, 3.637, 3.636, 3.637, 3.636, 3.637, 3.636, 3.485,
     132              :           0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0},
     133              :          {1.72,  3.175, 3.175, 3.175, 3.175, 3.175, 3.175, 3.174, 3.175, 3.174, 3.175, 3.174, 3.175, 3.174,
     134              :           3.175, 3.174, 3.175, 3.174, 3.175, 3.174, 3.175, 3.174, 3.175, 3.174, 3.175, 3.174, 3.175, 3.174,
     135              :           3.175, 3.174, 3.175, 3.042, 0,     0,     0,     0,     0,     0,     0,     0,     0},
     136              :          {1.391, 2.564, 2.564, 2.564, 2.564, 2.564, 2.564, 2.564, 2.564, 2.564, 2.564, 2.564, 2.564, 2.564,
     137              :           2.564, 2.564, 2.564, 2.564, 2.564, 2.564, 2.564, 2.564, 2.564, 2.564, 2.564, 2.564, 2.564, 2.564,
     138              :           2.564, 2.564, 2.564, 2.564, 2.564, 2.564, 2.564, 2.564, 2.564, 2.564, 2.564, 1.177, 0},
     139              :          {1.354, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5,  2.5,
     140              :           2.5,   2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 1.146}}};
     141              : 
     142              :     constexpr std::array<std::string_view, static_cast<int>(DeprMethod::Num)> DeprMethodNamesUC{
     143              :         "MODIFIEDACCELERATEDCOSTRECOVERYSYSTEM-3YEAR",
     144              :         "MODIFIEDACCELERATEDCOSTRECOVERYSYSTEM-5YEAR",
     145              :         "MODIFIEDACCELERATEDCOSTRECOVERYSYSTEM-7YEAR",
     146              :         "MODIFIEDACCELERATEDCOSTRECOVERYSYSTEM-10YEAR",
     147              :         "MODIFIEDACCELERATEDCOSTRECOVERYSYSTEM-15YEAR",
     148              :         "MODIFIEDACCELERATEDCOSTRECOVERYSYSTEM-20YEAR",
     149              :         "STRAIGHTLINE-27YEAR",
     150              :         "STRAIGHTLINE-31YEAR",
     151              :         "STRAIGHTLINE-39YEAR",
     152              :         "STRAIGHTLINE-40YEAR",
     153              :         "NONE",
     154              :     };
     155              : 
     156              :     constexpr std::array<std::string_view, static_cast<int>(DeprMethod::Num)> DeprMethodNames{
     157              :         "ModifiedAcceleratedCostRecoverySystem-3year",
     158              :         "ModifiedAcceleratedCostRecoverySystem-5year",
     159              :         "ModifiedAcceleratedCostRecoverySystem-7year",
     160              :         "ModifiedAcceleratedCostRecoverySystem-10year",
     161              :         "ModifiedAcceleratedCostRecoverySystem-15year",
     162              :         "ModifiedAcceleratedCostRecoverySystem-20year",
     163              :         "StraightLine-27year",
     164              :         "StraightLine-31year",
     165              :         "StraightLine-39year",
     166              :         "StraightLine-40year",
     167              :         "None",
     168              :     };
     169              : 
     170              :     enum CostCategory
     171              :     {
     172              :         Invalid = -1,
     173              :         Maintenance,
     174              :         Repair,
     175              :         Operation,
     176              :         Replacement,
     177              :         MinorOverhaul,
     178              :         MajorOverhaul,
     179              :         OtherOperational,
     180              :         Water,
     181              :         Energy,
     182              :         TotOper,
     183              :         Construction,
     184              :         Salvage,
     185              :         OtherCapital,
     186              :         TotCaptl,
     187              :         TotEnergy,
     188              :         TotGrand,
     189              :         Num
     190              :     };
     191              : 
     192              :     constexpr std::array<std::string_view, static_cast<int>(CostCategory::Num)> CostCategoryNames{"Maintenance",
     193              :                                                                                                   "Repair",
     194              :                                                                                                   "Operation",
     195              :                                                                                                   "Replacement",
     196              :                                                                                                   "Minor Overhaul",
     197              :                                                                                                   "Major Overhaul",
     198              :                                                                                                   "Other Operational",
     199              :                                                                                                   "Water",
     200              :                                                                                                   "Energy",
     201              :                                                                                                   "Total Operation",
     202              :                                                                                                   "Construction",
     203              :                                                                                                   "Salvage",
     204              :                                                                                                   "Other Capital",
     205              :                                                                                                   "Total Capital",
     206              :                                                                                                   "Total Energy",
     207              :                                                                                                   "Grand Total"};
     208              : 
     209              :     constexpr std::array<std::string_view, static_cast<int>(CostCategory::Num)> CostCategoryNamesNoSpace{"Maintenance",
     210              :                                                                                                          "Repair",
     211              :                                                                                                          "Operation",
     212              :                                                                                                          "Replacement",
     213              :                                                                                                          "MinorOverhaul",
     214              :                                                                                                          "MajorOverhaul",
     215              :                                                                                                          "OtherOperational",
     216              :                                                                                                          "Water",
     217              :                                                                                                          "Energy",
     218              :                                                                                                          "TotalOperational",
     219              :                                                                                                          "Construction",
     220              :                                                                                                          "Salvage",
     221              :                                                                                                          "OtherCapital",
     222              :                                                                                                          "TotalCapital",
     223              :                                                                                                          "TotalEnergy",
     224              :                                                                                                          "GrandTotal"};
     225              : 
     226              :     constexpr std::array<std::string_view, static_cast<int>(CostCategory::Num)> CostCategoryNamesUC{"MAINTENANCE",
     227              :                                                                                                     "REPAIR",
     228              :                                                                                                     "OPERATION",
     229              :                                                                                                     "REPLACEMENT",
     230              :                                                                                                     "MINOR OVERHAUL",
     231              :                                                                                                     "MAJOR OVERHAUL",
     232              :                                                                                                     "OTHER OPERATIONAL",
     233              :                                                                                                     "WATER",
     234              :                                                                                                     "ENERGY",
     235              :                                                                                                     "TOTAL OPERATIONAL",
     236              :                                                                                                     "CONSTRUCTION",
     237              :                                                                                                     "SALVAGE",
     238              :                                                                                                     "OTHER CAPITAL",
     239              :                                                                                                     "TOTAL CAPITAL",
     240              :                                                                                                     "TOTAL ENERGY",
     241              :                                                                                                     "GRAND TOTAL"};
     242              :     constexpr std::array<std::string_view, static_cast<int>(CostCategory::Num)> CostCategoryNamesUCNoSpace{"MAINTENANCE",
     243              :                                                                                                            "REPAIR",
     244              :                                                                                                            "OPERATION",
     245              :                                                                                                            "REPLACEMENT",
     246              :                                                                                                            "MINOROVERHAUL",
     247              :                                                                                                            "MAJOROVERHAUL",
     248              :                                                                                                            "OTHEROPERATIONAL",
     249              :                                                                                                            "WATER",
     250              :                                                                                                            "ENERGY",
     251              :                                                                                                            "TOTALOPERATIONAL",
     252              :                                                                                                            "CONSTRUCTION",
     253              :                                                                                                            "SALVAGE",
     254              :                                                                                                            "OTHERCAPITAL", // No space
     255              :                                                                                                            "TOTALCAPITAL",
     256              :                                                                                                            "TOTALENERGY",
     257              :                                                                                                            "GRANDTOTAL"};
     258              : 
     259              :     constexpr std::string_view Total{"Total"};
     260              :     constexpr std::string_view TotalUC{"TOTAL"};
     261              : 
     262              :     // The NIST supplement includes UPV* factors for
     263              :     //   Electricity
     264              :     //   Natural gas
     265              :     //   Distillate oil - FuelOilNo1
     266              :     //   Liquified petroleum gas - Propane
     267              :     //   Residual oil - FuelOilNo2
     268              :     //   Coal
     269              : 
     270              :     enum class StartCosts
     271              :     {
     272              :         Invalid = -1,
     273              :         ServicePeriod,
     274              :         BasePeriod,
     275              :         Num
     276              :     };
     277              : 
     278              :     constexpr std::array<std::string_view, static_cast<int>(StartCosts::Num)> StartCostNamesUC{"SERVICEPERIOD", "BASEPERIOD"};
     279              : 
     280              :     enum class SourceKindType
     281              :     {
     282              :         Invalid = -1,
     283              :         Recurring,
     284              :         Nonrecurring,
     285              :         Resource,
     286              :         Sum,
     287              :         Num
     288              :     };
     289              : 
     290              :     constexpr std::array<std::string_view, static_cast<int>(SourceKindType::Num)> SourceKindTypeNames{"Recurring", "Nonrecurring"};
     291              : 
     292              :     enum class ResourceCostCategory
     293              :     {
     294              :         Invalid = -1,
     295              :         Water,
     296              :         Energy,
     297              :         Num
     298              :     };
     299              :     constexpr std::array<std::string_view, static_cast<int>(ResourceCostCategory::Num)> ResourceCostCategoryNames{"Water Cost", "Energy Cost"};
     300              : 
     301              :     enum class PrValKind
     302              :     {
     303              :         Invalid = -1,
     304              :         Energy,
     305              :         NonEnergy,
     306              :         NotComputed,
     307              :         Num
     308              :     };
     309              : 
     310              :     // Types
     311              : 
     312              :     struct RecurringCostsType
     313              :     {
     314              :         // Members
     315              :         std::string name;            // Name
     316              :         std::string lineItem;        // Line Item
     317              :         CostCategory category;       // Category
     318              :         Real64 cost;                 // Cost
     319              :         StartCosts startOfCosts;     // Start of Costs
     320              :         int yearsFromStart;          // Years from Start 0 - 100
     321              :         int monthsFromStart;         // Months from Start 0 - 11
     322              :         int totalMonthsFromStart;    // Total months (12 x years) + months
     323              :         int repeatPeriodYears;       // Repeat Period Years 1 - 100
     324              :         int repeatPeriodMonths;      // Repeat Period Months 0 - 11
     325              :         int totalRepeatPeriodMonths; // Total months (12 x years) + months
     326              :         Real64 annualEscalationRate; // Annual escalation rate
     327              : 
     328              :         // Default Constructor
     329            2 :         RecurringCostsType()
     330            4 :             : category(CostCategory::Maintenance), cost(0.0), startOfCosts(StartCosts::ServicePeriod), yearsFromStart(0), monthsFromStart(0),
     331            2 :               totalMonthsFromStart(0), repeatPeriodYears(0), repeatPeriodMonths(0), totalRepeatPeriodMonths(0), annualEscalationRate(0.0)
     332              :         {
     333            2 :         }
     334              :     };
     335              : 
     336              :     struct NonrecurringCostType
     337              :     {
     338              :         // Members
     339              :         std::string name;         // Name
     340              :         std::string lineItem;     // Line Item
     341              :         CostCategory category;    // Category
     342              :         Real64 cost;              // Cost
     343              :         StartCosts startOfCosts;  // Start of Costs
     344              :         int yearsFromStart;       // Years from Start 0 - 100
     345              :         int monthsFromStart;      // Months from Start 0 - 11
     346              :         int totalMonthsFromStart; // Total months (12 x years) + months
     347              : 
     348              :         // Default Constructor
     349            7 :         NonrecurringCostType()
     350           14 :             : category(CostCategory::Construction), cost(0.0), startOfCosts(StartCosts::ServicePeriod), yearsFromStart(0), monthsFromStart(0),
     351            7 :               totalMonthsFromStart(0)
     352              :         {
     353            7 :         }
     354              :     };
     355              : 
     356              :     struct UsePriceEscalationType
     357              :     {
     358              :         // Members
     359              :         std::string name; // Name
     360              :         Constant::eResource resource =
     361              :             Constant::eResource::Invalid; // resource like electricity or natural gas (uses definitions from DataGlobalConstants)
     362              :         int escalationStartYear = 0;      // Escalation Start Year 1900-2100
     363              :         int escalationStartMonth = 0;     // Escalation Start Month 1 to 12
     364              :         Array1D<Real64> Escalation;       // Escalation by year, first year is baseDateYear
     365              :         // last year is baseDateYear + lengthStudyYears - 1
     366              :     };
     367              : 
     368              :     struct UseAdjustmentType
     369              :     {
     370              :         // Members
     371              :         std::string name; // Name
     372              :         Constant::eResource resource =
     373              :             Constant::eResource::Invalid; // resource like electricity or natural gas (uses definitions from DataGlobalConstants)
     374              :         Array1D<Real64> Adjustment;       // Adjustment by year, first year is baseDateYear
     375              :         // last year is baseDateYear + lengthStudyYears - 1
     376              :     };
     377              : 
     378              :     struct CashFlowType
     379              :     {
     380              :         // Members
     381              :         std::string name;             // Name - just for labeling output - use Category for aggregation
     382              :         SourceKindType SourceKind;    // 1=recurring, 2=nonrecurring, 3=resource
     383              :         Constant::eResource Resource; // resource like electricity or natural gas (uses definitions from DataGlobalConstants)
     384              :         CostCategory Category;        // uses "costCat" constants above
     385              :         Array1D<Real64> mnAmount;     // cashflow dollar amount by month, first year is baseDateYear
     386              :         // last year is baseDateYear + lengthStudyYears - 1
     387              :         Array1D<Real64> yrAmount;  // cashflow dollar amount by year, first year is baseDateYear
     388              :         PrValKind pvKind;          // kind of present value 1=energy, 2=non-energy,3=not computed but summed
     389              :         Real64 presentValue;       // total present value for cashflow
     390              :         Real64 orginalCost;        // original cost from recurring, non-recurring or energy cost
     391              :         Array1D<Real64> yrPresVal; // present value by year, first year is baseDateYear
     392              : 
     393              :         // Default Constructor
     394           19 :         CashFlowType()
     395           38 :             : SourceKind(SourceKindType::Invalid), Resource(Constant::eResource::Invalid), Category(CostCategory::Invalid),
     396           19 :               pvKind(PrValKind::Invalid), presentValue(0.), orginalCost(0.)
     397              :         {
     398           19 :         }
     399              :     };
     400              : 
     401              :     // Functions
     402              : 
     403              :     void GetInputForLifeCycleCost(EnergyPlusData &state);
     404              : 
     405              :     void ComputeLifeCycleCostAndReport(EnergyPlusData &state);
     406              : 
     407              :     //======================================================================================================================
     408              :     //======================================================================================================================
     409              : 
     410              :     //    GET INPUT ROUTINES
     411              : 
     412              :     //======================================================================================================================
     413              :     //======================================================================================================================
     414              : 
     415              :     void GetInputLifeCycleCostParameters(EnergyPlusData &state);
     416              : 
     417              :     void GetInputLifeCycleCostRecurringCosts(EnergyPlusData &state);
     418              : 
     419              :     void GetInputLifeCycleCostNonrecurringCost(EnergyPlusData &state);
     420              : 
     421              :     void GetInputLifeCycleCostUsePriceEscalation(EnergyPlusData &state);
     422              : 
     423              :     void GetInputLifeCycleCostUseAdjustment(EnergyPlusData &state);
     424              : 
     425              :     //======================================================================================================================
     426              :     //======================================================================================================================
     427              : 
     428              :     //    COMPUTATION ROUTINES
     429              : 
     430              :     //======================================================================================================================
     431              :     //======================================================================================================================
     432              : 
     433              :     void ExpressAsCashFlows(EnergyPlusData &state);
     434              : 
     435              :     void ComputeEscalatedEnergyCosts(EnergyPlusData &state);
     436              : 
     437              :     void ComputePresentValue(EnergyPlusData &state);
     438              : 
     439              :     void ComputeTaxAndDepreciation(EnergyPlusData &state);
     440              : 
     441              :     //======================================================================================================================
     442              :     //======================================================================================================================
     443              : 
     444              :     //    OUTPUT ROUTINES
     445              : 
     446              :     //======================================================================================================================
     447              :     //======================================================================================================================
     448              : 
     449              :     void WriteTabularLifeCycleCostReport(EnergyPlusData &state);
     450              : 
     451              : } // namespace EconomicLifeCycleCost
     452              : 
     453              : struct EconomicLifeCycleCostData : BaseGlobalStruct
     454              : {
     455              :     // related to LifeCycleCost:Parameters
     456              :     bool LCCparamPresent = false; // If a LifeCycleCost:Parameters object is present
     457              :     std::string LCCname;          // Name
     458              :     EconomicLifeCycleCost::DiscConv discountConvention = EconomicLifeCycleCost::DiscConv::EndOfYear;     // Discounting Convention
     459              :     EconomicLifeCycleCost::InflAppr inflationApproach = EconomicLifeCycleCost::InflAppr::ConstantDollar; // Inflation Approach
     460              :     Real64 realDiscountRate = 0.0;                                                                       // Real Discount Rate
     461              :     Real64 nominalDiscountRate = 0.0;                                                                    // Nominal Discount Rate
     462              :     Real64 inflation = 0.0;                                                                              // Inflation
     463              :     int baseDateMonth = 0;                                                                               // Base Date Month (1=Jan, 12=Dec)
     464              :     int baseDateYear = 0;                                                                                // Base Date Year  1900-2100
     465              :     int serviceDateMonth = 0;                                                                            // Service Date Month (1=Jan, 12=Dec)
     466              :     int serviceDateYear = 0;                                                                             // Service Date Year 1900-2100
     467              :     int lengthStudyYears = 0;                                                                            // Length of Study Period in Years
     468              :     int lengthStudyTotalMonths = 0; // Length of Study expressed in months (years x 12)
     469              :     Real64 taxRate = 0.0;           // Tax rate
     470              :     EconomicLifeCycleCost::DeprMethod depreciationMethod = EconomicLifeCycleCost::DeprMethod::None; // Depreciation Method
     471              :     // derived
     472              :     int lastDateYear = 0; // Last Date Year (base date year + length of study period in years)
     473              :     int numRecurringCosts = 0;
     474              :     int numNonrecurringCost = 0;
     475              :     int numUsePriceEscalation = 0;
     476              :     int numUseAdjustment = 0;
     477              :     int numCashFlow = 0;
     478              :     int numResourcesUsed = 0;
     479              :     bool GetInput_GetLifeCycleCostInput = true;
     480              : 
     481              :     // from former statics in GetInputLifeCycleCostUsePriceEscalation()
     482              :     int UsePriceEscalation_escStartYear = 0;
     483              :     int UsePriceEscalation_escNumYears = 0;
     484              :     int UsePriceEscalation_escEndYear = 0;
     485              :     int UsePriceEscalation_earlierEndYear = 0;
     486              :     int UsePriceEscalation_laterStartYear = 0;
     487              :     int UsePriceEscalation_curEsc = 0;
     488              :     int UsePriceEscalation_curFld = 0;
     489              : 
     490              :     // from former statics in ExpressAsCashFlows
     491              :     int ExpressAsCashFlows_baseMonths1900 = 0;    // number of months since 1900 for base period
     492              :     int ExpressAsCashFlows_serviceMonths1900 = 0; // number of months since 1900 for service period
     493              : 
     494              :     // present value factors
     495              :     Array1D<Real64> SPV;
     496              :     std::map<int, std::array<Real64, static_cast<int>(Constant::eResource::Num)>> energySPV; // yearly equivalent to FEMP UPV* values
     497              : 
     498              :     // arrays related to computing after tax cashflow and present value
     499              :     Array1D<Real64> DepreciatedCapital;
     500              :     Array1D<Real64> TaxableIncome;
     501              :     Array1D<Real64> Taxes;
     502              :     Array1D<Real64> AfterTaxCashFlow;
     503              :     Array1D<Real64> AfterTaxPresentValue;
     504              : 
     505              :     // arrays related to escalated energy costs
     506              :     Array1D<Real64> EscalatedTotEnergy;
     507              :     std::map<int, std::array<Real64, static_cast<int>(Constant::eResource::Num)>> EscalatedEnergy;
     508              : 
     509              :     std::vector<EconomicLifeCycleCost::RecurringCostsType> RecurringCosts;
     510              :     std::vector<EconomicLifeCycleCost::NonrecurringCostType> NonrecurringCost;
     511              :     EPVector<EconomicLifeCycleCost::UsePriceEscalationType> UsePriceEscalation;
     512              :     EPVector<EconomicLifeCycleCost::UseAdjustmentType> UseAdjustment;
     513              :     std::vector<EconomicLifeCycleCost::CashFlowType> CashFlow;
     514              : 
     515         2126 :     void init_constant_state([[maybe_unused]] EnergyPlusData &state) override
     516              :     {
     517         2126 :     }
     518              : 
     519         1152 :     void init_state([[maybe_unused]] EnergyPlusData &state) override
     520              :     {
     521         1152 :     }
     522              : 
     523         2100 :     void clear_state() override
     524              :     {
     525         2100 :         this->LCCparamPresent = false;
     526         2100 :         this->LCCname.clear();
     527         2100 :         this->discountConvention = EconomicLifeCycleCost::DiscConv::EndOfYear;
     528         2100 :         this->inflationApproach = EconomicLifeCycleCost::InflAppr::ConstantDollar;
     529         2100 :         this->realDiscountRate = 0.0;
     530         2100 :         this->nominalDiscountRate = 0.0;
     531         2100 :         this->inflation = 0.0;
     532         2100 :         this->baseDateMonth = 0;
     533         2100 :         this->baseDateYear = 0;
     534         2100 :         this->serviceDateMonth = 0;
     535         2100 :         this->serviceDateYear = 0;
     536         2100 :         this->lengthStudyYears = 0;
     537         2100 :         this->lengthStudyTotalMonths = 0;
     538         2100 :         this->taxRate = 0.0;
     539         2100 :         this->depreciationMethod = EconomicLifeCycleCost::DeprMethod::None;
     540         2100 :         this->lastDateYear = 0;
     541         2100 :         this->numRecurringCosts = 0;
     542         2100 :         this->numNonrecurringCost = 0;
     543         2100 :         this->numUsePriceEscalation = 0;
     544         2100 :         this->numUseAdjustment = 0;
     545         2100 :         this->numCashFlow = 0;
     546         2100 :         this->numResourcesUsed = 0;
     547         2100 :         this->GetInput_GetLifeCycleCostInput = true;
     548         2100 :         this->UsePriceEscalation_escStartYear = 0;
     549         2100 :         this->UsePriceEscalation_escNumYears = 0;
     550         2100 :         this->UsePriceEscalation_escEndYear = 0;
     551         2100 :         this->UsePriceEscalation_earlierEndYear = 0;
     552         2100 :         this->UsePriceEscalation_laterStartYear = 0;
     553         2100 :         this->UsePriceEscalation_curEsc = 0;
     554         2100 :         this->UsePriceEscalation_curFld = 0;
     555         2100 :         this->ExpressAsCashFlows_baseMonths1900 = 0;
     556         2100 :         this->ExpressAsCashFlows_serviceMonths1900 = 0;
     557         2100 :         this->SPV.deallocate();
     558         2100 :         this->energySPV.clear();
     559         2100 :         this->DepreciatedCapital.deallocate();
     560         2100 :         this->TaxableIncome.deallocate();
     561         2100 :         this->Taxes.deallocate();
     562         2100 :         this->AfterTaxCashFlow.deallocate();
     563         2100 :         this->AfterTaxPresentValue.deallocate();
     564         2100 :         this->EscalatedTotEnergy.deallocate();
     565         2100 :         this->EscalatedEnergy.clear();
     566         2100 :         this->RecurringCosts.clear();
     567         2100 :         this->NonrecurringCost.clear();
     568         2100 :         this->UsePriceEscalation.deallocate();
     569         2100 :         this->UseAdjustment.deallocate();
     570         2100 :         this->CashFlow.clear();
     571         2100 :     }
     572              : };
     573              : 
     574              : } // namespace EnergyPlus
     575              : 
     576              : #endif
        

Generated by: LCOV version 2.0-1