src/model/UtilityBill.hpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /*********************************************************************************************************************** | ||
| 2 | * OpenStudio(R), Copyright (c) Alliance for Energy Innovation, LLC. | ||
| 3 | * See also https://openstudio.net/license | ||
| 4 | ***********************************************************************************************************************/ | ||
| 5 | |||
| 6 | #ifndef MODEL_UTILITYBILL_HPP | ||
| 7 | #define MODEL_UTILITYBILL_HPP | ||
| 8 | |||
| 9 | #include "ModelAPI.hpp" | ||
| 10 | #include "ModelObject.hpp" | ||
| 11 | #include "ModelExtensibleGroup.hpp" | ||
| 12 | |||
| 13 | #include "../utilities/data/Vector.hpp" | ||
| 14 | |||
| 15 | namespace openstudio { | ||
| 16 | |||
| 17 | class FuelType; | ||
| 18 | class InstallLocationType; | ||
| 19 | class EndUseCategoryType; | ||
| 20 | class Date; | ||
| 21 | |||
| 22 | namespace model { | ||
| 23 | |||
| 24 | class OutputMeter; | ||
| 25 | |||
| 26 | namespace detail { | ||
| 27 | |||
| 28 | class UtilityBill_Impl; | ||
| 29 | |||
| 30 | } // namespace detail | ||
| 31 | |||
| 32 | /** BillingPeriod is a ModelExtensibleGroup that represents a single billing period in the | ||
| 33 | UtilityBill ModelObject. */ | ||
| 34 | class MODEL_API BillingPeriod : public ModelExtensibleGroup | ||
| 35 | { | ||
| 36 | public: | ||
| 37 | /** @name Getters */ | ||
| 38 | //@{ | ||
| 39 | |||
| 40 | /** The date that the billing period starts. */ | ||
| 41 | Date startDate() const; | ||
| 42 | |||
| 43 | /** The date that the billing period ends. */ | ||
| 44 | Date endDate() const; | ||
| 45 | |||
| 46 | /** The duration of the billing period in days. */ | ||
| 47 | unsigned numberOfDays() const; | ||
| 48 | |||
| 49 | /** Returns the consumption in billing units. */ | ||
| 50 | boost::optional<double> consumption() const; | ||
| 51 | |||
| 52 | /** Returns the peak demand in billing units. */ | ||
| 53 | boost::optional<double> peakDemand() const; | ||
| 54 | |||
| 55 | /** Returns the total cost of the bill in dollars. */ | ||
| 56 | boost::optional<double> totalCost() const; | ||
| 57 | |||
| 58 | //@} | ||
| 59 | /** @name Setters */ | ||
| 60 | //@{ | ||
| 61 | |||
| 62 | /** Sets the start date. If startDate is before endDate then endDate is retained. | ||
| 63 | If startDate is after endDate then numberOfDays is retained. */ | ||
| 64 | bool setStartDate(const Date& startDate); | ||
| 65 | |||
| 66 | /** Sets the end date. If endDate is after startDate then startDate is retained. | ||
| 67 | If endDate is before startDate then numberOfDays is retained. */ | ||
| 68 | bool setEndDate(const Date& endDate); | ||
| 69 | |||
| 70 | /** Sets the number of days in billing period, startDate is always retained. */ | ||
| 71 | bool setNumberOfDays(unsigned numberOfDays); | ||
| 72 | |||
| 73 | /** Sets the consumption in billing units. */ | ||
| 74 | bool setConsumption(double consumption); | ||
| 75 | |||
| 76 | void resetConsumption(); | ||
| 77 | |||
| 78 | /** Sets the peak demand in billing units. */ | ||
| 79 | bool setPeakDemand(double peakDemand); | ||
| 80 | |||
| 81 | void resetPeakDemand(); | ||
| 82 | |||
| 83 | /** Sets the total cost of the bill in dollars. */ | ||
| 84 | bool setTotalCost(double totalCost); | ||
| 85 | |||
| 86 | void resetTotalCost(); | ||
| 87 | |||
| 88 | //@} | ||
| 89 | /** @name Other */ | ||
| 90 | //@{ | ||
| 91 | |||
| 92 | /** Returns true if this billing period is strictly within the model's run period.*/ | ||
| 93 | bool withinRunPeriod() const; | ||
| 94 | |||
| 95 | /** Returns true if this billing period is within the model's run period assuming periodic boundary conditions.*/ | ||
| 96 | bool withinPeriodicRunPeriod() const; | ||
| 97 | |||
| 98 | /** Returns true if this billing period is partially within the model's run period.*/ | ||
| 99 | bool overlapsRunPeriod() const; | ||
| 100 | |||
| 101 | /** Returns the consumption for each day in billing period from simulation in model units. */ | ||
| 102 | Vector modelConsumptionValues() const; | ||
| 103 | |||
| 104 | /** Returns the sum of modelConsumptionValues if it is not empty. */ | ||
| 105 | boost::optional<double> modelConsumption() const; | ||
| 106 | |||
| 107 | /** Returns the maximum peak over the billing period if available. */ | ||
| 108 | boost::optional<double> modelPeakDemand() const; | ||
| 109 | |||
| 110 | /** Returns total energy cost over the billing period if available. */ | ||
| 111 | boost::optional<double> modelTotalCost() const; | ||
| 112 | |||
| 113 | //@} | ||
| 114 | protected: | ||
| 115 | /// @cond | ||
| 116 | using ImplType = detail::UtilityBill_Impl; | ||
| 117 | |||
| 118 | friend class IdfExtensibleGroup; | ||
| 119 | friend class detail::UtilityBill_Impl; | ||
| 120 | |||
| 121 | BillingPeriod(std::shared_ptr<detail::UtilityBill_Impl> impl, unsigned index); | ||
| 122 | |||
| 123 | /// @endcond | ||
| 124 | private: | ||
| 125 | − | REGISTER_LOGGER("openstudio.model.BillingPeriod"); | |
| 126 | }; | ||
| 127 | |||
| 128 | /** \relates BillingPeriod */ | ||
| 129 | using BillingPeriodVector = std::vector<BillingPeriod>; | ||
| 130 | |||
| 131 | /** UtilityBill is a ModelObject that wraps the OpenStudio IDD object 'OS:UtilityBill'. | ||
| 132 | This object allows the user to enter in actual fuel usage for model calibration. | ||
| 133 | */ | ||
| 134 | class MODEL_API UtilityBill : public ModelObject | ||
| 135 | { | ||
| 136 | public: | ||
| 137 | /** @name Constructors and Destructors */ | ||
| 138 | //@{ | ||
| 139 | |||
| 140 | explicit UtilityBill(const FuelType& fuelType, const Model& model); | ||
| 141 | |||
| 142 | 58 | virtual ~UtilityBill() override = default; | |
| 143 | // Default the copy and move operators because the virtual dtor is explicit | ||
| 144 | ✗ | UtilityBill(const UtilityBill& other) = default; | |
| 145 | 20 | UtilityBill(UtilityBill&& other) = default; | |
| 146 | ✗ | UtilityBill& operator=(const UtilityBill&) = default; | |
| 147 | ✗ | UtilityBill& operator=(UtilityBill&&) = default; | |
| 148 | |||
| 149 | //@} | ||
| 150 | |||
| 151 | static IddObjectType iddObjectType(); | ||
| 152 | |||
| 153 | std::vector<std::string> consumptionUnitValues(); | ||
| 154 | |||
| 155 | std::vector<std::string> peakDemandUnitValues(); | ||
| 156 | |||
| 157 | static std::vector<std::string> calibrationGuidelines(); | ||
| 158 | |||
| 159 | static boost::optional<double> maxNMBE(const std::string& calibrationGuideline); | ||
| 160 | |||
| 161 | static boost::optional<double> maxCVRMSE(const std::string& calibrationGuideline); | ||
| 162 | |||
| 163 | /** @name Getters */ | ||
| 164 | //@{ | ||
| 165 | |||
| 166 | FuelType fuelType() const; | ||
| 167 | |||
| 168 | InstallLocationType meterInstallLocation() const; | ||
| 169 | |||
| 170 | bool isMeterInstallLocationDefaulted() const; | ||
| 171 | |||
| 172 | boost::optional<std::string> meterSpecificInstallLocation() const; | ||
| 173 | |||
| 174 | boost::optional<EndUseCategoryType> meterEndUseCategory() const; | ||
| 175 | |||
| 176 | boost::optional<std::string> meterSpecificEndUse() const; | ||
| 177 | |||
| 178 | std::string consumptionUnit() const; | ||
| 179 | |||
| 180 | boost::optional<std::string> consumptionUnitDescription() const; | ||
| 181 | |||
| 182 | double consumptionUnitConversionFactor() const; | ||
| 183 | |||
| 184 | bool isConsumptionUnitConversionFactorDefaulted() const; | ||
| 185 | |||
| 186 | boost::optional<std::string> peakDemandUnit() const; | ||
| 187 | |||
| 188 | boost::optional<std::string> peakDemandUnitDescription() const; | ||
| 189 | |||
| 190 | boost::optional<double> peakDemandUnitConversionFactor() const; | ||
| 191 | |||
| 192 | boost::optional<unsigned> timestepsInPeakDemandWindow() const; | ||
| 193 | |||
| 194 | bool isTimestepsInPeakDemandWindowDefaulted() const; | ||
| 195 | |||
| 196 | boost::optional<double> minutesInPeakDemandWindow() const; | ||
| 197 | |||
| 198 | std::vector<BillingPeriod> billingPeriods() const; | ||
| 199 | |||
| 200 | //@} | ||
| 201 | /** @name Setters */ | ||
| 202 | //@{ | ||
| 203 | |||
| 204 | bool setMeterInstallLocation(const InstallLocationType& meterInstallLocation); | ||
| 205 | |||
| 206 | void resetMeterInstallLocation(); | ||
| 207 | |||
| 208 | bool setMeterSpecificInstallLocation(const std::string& meterSpecificInstallLocation); | ||
| 209 | |||
| 210 | void resetMeterSpecificInstallLocation(); | ||
| 211 | |||
| 212 | bool setMeterEndUseCategory(const EndUseCategoryType& meterEndUseCategory); | ||
| 213 | |||
| 214 | void resetMeterEndUseCategory(); | ||
| 215 | |||
| 216 | bool setMeterSpecificEndUse(const std::string& meterSpecificEndUse); | ||
| 217 | |||
| 218 | void resetMeterSpecificEndUse(); | ||
| 219 | |||
| 220 | bool setConsumptionUnit(const std::string& consumptionUnit); | ||
| 221 | |||
| 222 | bool setConsumptionUnitConversionFactor(double consumptionUnitConversionFactor); | ||
| 223 | |||
| 224 | void resetConsumptionUnitConversionFactor(); | ||
| 225 | |||
| 226 | bool setPeakDemandUnit(const std::string& peakDemandUnit); | ||
| 227 | |||
| 228 | bool setTimestepsInPeakDemandWindow(unsigned timestepsInPeakDemandWindow); | ||
| 229 | |||
| 230 | void resetTimestepsInPeakDemandWindow(); | ||
| 231 | |||
| 232 | void clearBillingPeriods(); | ||
| 233 | |||
| 234 | BillingPeriod addBillingPeriod(); | ||
| 235 | |||
| 236 | //@} | ||
| 237 | /** @name Other */ | ||
| 238 | //@{ | ||
| 239 | |||
| 240 | /** Gets the meter associated with consumption for this UtilityBill, creates it if it does not exist.*/ | ||
| 241 | OutputMeter consumptionMeter() const; | ||
| 242 | |||
| 243 | /** Gets the meter associated with peak demand for this UtilityBill, creates it if it does not exist.*/ | ||
| 244 | boost::optional<OutputMeter> peakDemandMeter() const; | ||
| 245 | |||
| 246 | /** Number of billing periods used to compute CVRMSE or NMBE.*/ | ||
| 247 | unsigned numberBillingPeriodsInCalculations() const; | ||
| 248 | |||
| 249 | /** Coefficient of variation of the root mean square error, see ASHRAE 14-2002 5.2.11.3.*/ | ||
| 250 | boost::optional<double> CVRMSE() const; | ||
| 251 | |||
| 252 | /** Normalized mean bias error, see ASHRAE 14-2002 5.2.11.3.*/ | ||
| 253 | boost::optional<double> NMBE() const; | ||
| 254 | |||
| 255 | //@} | ||
| 256 | protected: | ||
| 257 | /// @cond | ||
| 258 | using ImplType = detail::UtilityBill_Impl; | ||
| 259 | |||
| 260 | explicit UtilityBill(std::shared_ptr<detail::UtilityBill_Impl> impl); | ||
| 261 | |||
| 262 | friend class detail::UtilityBill_Impl; | ||
| 263 | friend class Model; | ||
| 264 | friend class IdfObject; | ||
| 265 | friend class openstudio::detail::IdfObject_Impl; | ||
| 266 | /// @endcond | ||
| 267 | private: | ||
| 268 | − | REGISTER_LOGGER("openstudio.model.UtilityBill"); | |
| 269 | }; | ||
| 270 | |||
| 271 | /** \relates UtilityBill*/ | ||
| 272 | using OptionalUtilityBill = boost::optional<UtilityBill>; | ||
| 273 | |||
| 274 | /** \relates UtilityBill*/ | ||
| 275 | using UtilityBillVector = std::vector<UtilityBill>; | ||
| 276 | |||
| 277 | } // namespace model | ||
| 278 | } // namespace openstudio | ||
| 279 | |||
| 280 | #endif // MODEL_UTILITYBILL_HPP | ||
| 281 |