LCOV - code coverage report
Current view: top level - EnergyPlus - EconomicLifeCycleCost.hh (source / functions) Hit Total Coverage
Test: lcov.output.filtered Lines: 22 70 31.4 %
Date: 2023-01-17 19:17:23 Functions: 14 20 70.0 %

          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 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           1 :     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           1 :         RecurringCostsType()
     330           1 :             : category(CostCategory::Maintenance), cost(0.0), startOfCosts(StartCosts::ServicePeriod), yearsFromStart(0), monthsFromStart(0),
     331           1 :               totalMonthsFromStart(0), repeatPeriodYears(0), repeatPeriodMonths(0), totalRepeatPeriodMonths(0), annualEscalationRate(0.0)
     332             :         {
     333           1 :         }
     334             :     };
     335             : 
     336           5 :     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           5 :         NonrecurringCostType()
     350           5 :             : category(CostCategory::Construction), cost(0.0), startOfCosts(StartCosts::ServicePeriod), yearsFromStart(0), monthsFromStart(0),
     351           5 :               totalMonthsFromStart(0)
     352             :         {
     353           5 :         }
     354             :     };
     355             : 
     356           7 :     struct UsePriceEscalationType
     357             :     {
     358             :         // Members
     359             :         std::string name;                           // Name
     360             :         DataGlobalConstants::ResourceType resource; // resource like electricity or natural gas (uses definitions from DataGlobalConstants)
     361             :         int escalationStartYear;                    // Escalation Start Year 1900-2100
     362             :         int escalationStartMonth;                   // Escalation Start Month 1 to 12
     363             :         Array1D<Real64> Escalation;                 // Escalation by year, first year is baseDateYear
     364             :         // last year is baseDateYear + lengthStudyYears - 1
     365             : 
     366             :         // Default Constructor
     367           4 :         UsePriceEscalationType() : resource(DataGlobalConstants::ResourceType::None), escalationStartYear(0), escalationStartMonth(0)
     368             :         {
     369           4 :         }
     370             :     };
     371             : 
     372           3 :     struct UseAdjustmentType
     373             :     {
     374             :         // Members
     375             :         std::string name;                           // Name
     376             :         DataGlobalConstants::ResourceType resource; // resource like electricity or natural gas (uses definitions from DataGlobalConstants)
     377             :         Array1D<Real64> Adjustment;                 // Adjustment by year, first year is baseDateYear
     378             :         // last year is baseDateYear + lengthStudyYears - 1
     379             : 
     380             :         // Default Constructor
     381           2 :         UseAdjustmentType() : resource(DataGlobalConstants::ResourceType::None)
     382             :         {
     383           2 :         }
     384             :     };
     385             : 
     386          23 :     struct CashFlowType
     387             :     {
     388             :         // Members
     389             :         std::string name;                           // Name - just for labeling output - use Category for aggregation
     390             :         SourceKindType SourceKind;                  // 1=recurring, 2=nonrecurring, 3=resource
     391             :         DataGlobalConstants::ResourceType Resource; // resource like electricity or natural gas (uses definitions from DataGlobalConstants)
     392             :         CostCategory Category;                      // uses "costCat" constants above
     393             :         Array1D<Real64> mnAmount;                   // cashflow dollar amount by month, first year is baseDateYear
     394             :         // last year is baseDateYear + lengthStudyYears - 1
     395             :         Array1D<Real64> yrAmount;  // cashflow dollar amount by year, first year is baseDateYear
     396             :         PrValKind pvKind;          // kind of present value 1=energy, 2=non-energy,3=not computed but summed
     397             :         Real64 presentValue;       // total present value for cashflow
     398             :         Real64 orginalCost;        // original cost from recurring, non-recurring or energy cost
     399             :         Array1D<Real64> yrPresVal; // present value by year, first year is baseDateYear
     400             : 
     401             :         // Default Constructor
     402          23 :         CashFlowType()
     403          23 :             : SourceKind(SourceKindType::Invalid), Resource(DataGlobalConstants::ResourceType::None), Category(CostCategory::Invalid),
     404          23 :               pvKind(PrValKind::Invalid), presentValue(0.), orginalCost(0.)
     405             :         {
     406          23 :         }
     407             :     };
     408             : 
     409             :     // Functions
     410             : 
     411             :     void GetInputForLifeCycleCost(EnergyPlusData &state);
     412             : 
     413             :     void ComputeLifeCycleCostAndReport(EnergyPlusData &state);
     414             : 
     415             :     //======================================================================================================================
     416             :     //======================================================================================================================
     417             : 
     418             :     //    GET INPUT ROUTINES
     419             : 
     420             :     //======================================================================================================================
     421             :     //======================================================================================================================
     422             : 
     423             :     void GetInputLifeCycleCostParameters(EnergyPlusData &state);
     424             : 
     425             :     void GetInputLifeCycleCostRecurringCosts(EnergyPlusData &state);
     426             : 
     427             :     void GetInputLifeCycleCostNonrecurringCost(EnergyPlusData &state);
     428             : 
     429             :     void GetInputLifeCycleCostUsePriceEscalation(EnergyPlusData &state);
     430             : 
     431             :     void GetInputLifeCycleCostUseAdjustment(EnergyPlusData &state);
     432             : 
     433             :     //======================================================================================================================
     434             :     //======================================================================================================================
     435             : 
     436             :     //    COMPUTATION ROUTINES
     437             : 
     438             :     //======================================================================================================================
     439             :     //======================================================================================================================
     440             : 
     441             :     void ExpressAsCashFlows(EnergyPlusData &state);
     442             : 
     443             :     void ComputeEscalatedEnergyCosts(EnergyPlusData &state);
     444             : 
     445             :     void ComputePresentValue(EnergyPlusData &state);
     446             : 
     447             :     void ComputeTaxAndDepreciation(EnergyPlusData &state);
     448             : 
     449             :     //======================================================================================================================
     450             :     //======================================================================================================================
     451             : 
     452             :     //    OUTPUT ROUTINES
     453             : 
     454             :     //======================================================================================================================
     455             :     //======================================================================================================================
     456             : 
     457             :     void WriteTabularLifeCycleCostReport(EnergyPlusData &state);
     458             : 
     459             : } // namespace EconomicLifeCycleCost
     460             : 
     461        1542 : struct EconomicLifeCycleCostData : BaseGlobalStruct
     462             : {
     463             :     // related to LifeCycleCost:Parameters
     464             :     bool LCCparamPresent = false; // If a LifeCycleCost:Parameters object is present
     465             :     std::string LCCname;          // Name
     466             :     EconomicLifeCycleCost::DiscConv discountConvention = EconomicLifeCycleCost::DiscConv::EndOfYear;     // Discounting Convention
     467             :     EconomicLifeCycleCost::InflAppr inflationApproach = EconomicLifeCycleCost::InflAppr::ConstantDollar; // Inflation Approach
     468             :     Real64 realDiscountRate = 0.0;                                                                       // Real Discount Rate
     469             :     Real64 nominalDiscountRate = 0.0;                                                                    // Nominal Discount Rate
     470             :     Real64 inflation = 0.0;                                                                              // Inflation
     471             :     int baseDateMonth = 0;                                                                               // Base Date Month (1=Jan, 12=Dec)
     472             :     int baseDateYear = 0;                                                                                // Base Date Year  1900-2100
     473             :     int serviceDateMonth = 0;                                                                            // Service Date Month (1=Jan, 12=Dec)
     474             :     int serviceDateYear = 0;                                                                             // Service Date Year 1900-2100
     475             :     int lengthStudyYears = 0;                                                                            // Length of Study Period in Years
     476             :     int lengthStudyTotalMonths = 0; // Length of Study expressed in months (years x 12)
     477             :     Real64 taxRate = 0.0;           // Tax rate
     478             :     EconomicLifeCycleCost::DeprMethod depreciationMethod = EconomicLifeCycleCost::DeprMethod::None; // Depreciation Method
     479             :     // derived
     480             :     int lastDateYear = 0; // Last Date Year (base date year + length of study period in years)
     481             :     int numRecurringCosts = 0;
     482             :     int numNonrecurringCost = 0;
     483             :     int numUsePriceEscalation = 0;
     484             :     int numUseAdjustment = 0;
     485             :     int numCashFlow = 0;
     486             :     int numResourcesUsed = 0;
     487             :     bool GetInput_GetLifeCycleCostInput = true;
     488             : 
     489             :     // from former statics in GetInputLifeCycleCostUsePriceEscalation()
     490             :     int UsePriceEscalation_escStartYear = 0;
     491             :     int UsePriceEscalation_escNumYears = 0;
     492             :     int UsePriceEscalation_escEndYear = 0;
     493             :     int UsePriceEscalation_earlierEndYear = 0;
     494             :     int UsePriceEscalation_laterStartYear = 0;
     495             :     int UsePriceEscalation_curEsc = 0;
     496             :     int UsePriceEscalation_curFld = 0;
     497             : 
     498             :     // from former statics in ExpressAsCashFlows
     499             :     int ExpressAsCashFlows_baseMonths1900 = 0;    // number of months since 1900 for base period
     500             :     int ExpressAsCashFlows_serviceMonths1900 = 0; // number of months since 1900 for service period
     501             : 
     502             :     // present value factors
     503             :     Array1D<Real64> SPV;
     504             :     std::map<int, std::map<DataGlobalConstants::ResourceType, Real64>> energySPV; // yearly equivalent to FEMP UPV* values
     505             : 
     506             :     // arrays related to computing after tax cashflow and present value
     507             :     Array1D<Real64> DepreciatedCapital;
     508             :     Array1D<Real64> TaxableIncome;
     509             :     Array1D<Real64> Taxes;
     510             :     Array1D<Real64> AfterTaxCashFlow;
     511             :     Array1D<Real64> AfterTaxPresentValue;
     512             : 
     513             :     // arrays related to escalated energy costs
     514             :     Array1D<Real64> EscalatedTotEnergy;
     515             :     std::map<int, std::map<DataGlobalConstants::ResourceType, Real64>> EscalatedEnergy;
     516             : 
     517             :     std::vector<EconomicLifeCycleCost::RecurringCostsType> RecurringCosts;
     518             :     std::vector<EconomicLifeCycleCost::NonrecurringCostType> NonrecurringCost;
     519             :     EPVector<EconomicLifeCycleCost::UsePriceEscalationType> UsePriceEscalation;
     520             :     EPVector<EconomicLifeCycleCost::UseAdjustmentType> UseAdjustment;
     521             :     std::vector<EconomicLifeCycleCost::CashFlowType> CashFlow;
     522             : 
     523           0 :     void clear_state() override
     524             :     {
     525           0 :         this->LCCparamPresent = false;
     526           0 :         this->LCCname.clear();
     527           0 :         this->discountConvention = EconomicLifeCycleCost::DiscConv::EndOfYear;
     528           0 :         this->inflationApproach = EconomicLifeCycleCost::InflAppr::ConstantDollar;
     529           0 :         this->realDiscountRate = 0.0;
     530           0 :         this->nominalDiscountRate = 0.0;
     531           0 :         this->inflation = 0.0;
     532           0 :         this->baseDateMonth = 0;
     533           0 :         this->baseDateYear = 0;
     534           0 :         this->serviceDateMonth = 0;
     535           0 :         this->serviceDateYear = 0;
     536           0 :         this->lengthStudyYears = 0;
     537           0 :         this->lengthStudyTotalMonths = 0;
     538           0 :         this->taxRate = 0.0;
     539           0 :         this->depreciationMethod = EconomicLifeCycleCost::DeprMethod::None;
     540           0 :         this->lastDateYear = 0;
     541           0 :         this->numRecurringCosts = 0;
     542           0 :         this->numNonrecurringCost = 0;
     543           0 :         this->numUsePriceEscalation = 0;
     544           0 :         this->numUseAdjustment = 0;
     545           0 :         this->numCashFlow = 0;
     546           0 :         this->numResourcesUsed = 0;
     547           0 :         this->GetInput_GetLifeCycleCostInput = true;
     548           0 :         this->UsePriceEscalation_escStartYear = 0;
     549           0 :         this->UsePriceEscalation_escNumYears = 0;
     550           0 :         this->UsePriceEscalation_escEndYear = 0;
     551           0 :         this->UsePriceEscalation_earlierEndYear = 0;
     552           0 :         this->UsePriceEscalation_laterStartYear = 0;
     553           0 :         this->UsePriceEscalation_curEsc = 0;
     554           0 :         this->UsePriceEscalation_curFld = 0;
     555           0 :         this->ExpressAsCashFlows_baseMonths1900 = 0;
     556           0 :         this->ExpressAsCashFlows_serviceMonths1900 = 0;
     557           0 :         this->SPV.deallocate();
     558           0 :         this->energySPV.clear();
     559           0 :         this->DepreciatedCapital.deallocate();
     560           0 :         this->TaxableIncome.deallocate();
     561           0 :         this->Taxes.deallocate();
     562           0 :         this->AfterTaxCashFlow.deallocate();
     563           0 :         this->AfterTaxPresentValue.deallocate();
     564           0 :         this->EscalatedTotEnergy.deallocate();
     565           0 :         this->EscalatedEnergy.clear();
     566           0 :         this->RecurringCosts.clear();
     567           0 :         this->NonrecurringCost.clear();
     568           0 :         this->UsePriceEscalation.deallocate();
     569           0 :         this->UseAdjustment.deallocate();
     570           0 :         this->CashFlow.clear();
     571           0 :     }
     572             : };
     573             : 
     574             : } // namespace EnergyPlus
     575             : 
     576             : #endif

Generated by: LCOV version 1.13