src/model/OutputMeter.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_OUTPUTMETER_HPP | ||
| 7 | #define MODEL_OUTPUTMETER_HPP | ||
| 8 | |||
| 9 | #include "ModelAPI.hpp" | ||
| 10 | #include "ModelObject.hpp" | ||
| 11 | |||
| 12 | namespace openstudio { | ||
| 13 | |||
| 14 | class EndUseType; | ||
| 15 | class FuelType; | ||
| 16 | class InstallLocationType; | ||
| 17 | class TimeSeries; | ||
| 18 | |||
| 19 | namespace model { | ||
| 20 | |||
| 21 | namespace detail { | ||
| 22 | |||
| 23 | class OutputMeter_Impl; | ||
| 24 | |||
| 25 | } // namespace detail | ||
| 26 | |||
| 27 | /** OutputMeter is a ModelObject that wraps the OpenStudio IDD object 'OS_Output_Meter'. | ||
| 28 | * | ||
| 29 | * A OutputMeter is a virtual instrument measuring energy use of some fuel type at a particular location. | ||
| 30 | * OutputMeter objects may be associated with various classes in the building model hierarchy (e.g. Facility, Building, Zone, Plant, etc). | ||
| 31 | * A OutputMeter can be used to request output data as well as access it from the EnergyPlus SQLite output. | ||
| 32 | * If the user wants to access measured data from a particular OutputMeter, they must ensure that input objects are present to | ||
| 33 | * trigger EnergyPlus to output the desired data. This is similar to needing to instrument a real | ||
| 34 | * building during field measurements. | ||
| 35 | * | ||
| 36 | */ | ||
| 37 | class MODEL_API OutputMeter : public ModelObject | ||
| 38 | { | ||
| 39 | public: | ||
| 40 | /** @name Constructors and Destructors */ | ||
| 41 | //@{ | ||
| 42 | |||
| 43 | explicit OutputMeter(const Model& model); | ||
| 44 | |||
| 45 | 7310 | virtual ~OutputMeter() override = default; | |
| 46 | // Default the copy and move operators because the virtual dtor is explicit | ||
| 47 | 106 | OutputMeter(const OutputMeter& other) = default; | |
| 48 | 1015 | OutputMeter(OutputMeter&& other) = default; | |
| 49 | ✗ | OutputMeter& operator=(const OutputMeter&) = default; | |
| 50 | 49 | OutputMeter& operator=(OutputMeter&&) = default; | |
| 51 | |||
| 52 | virtual std::vector<openstudio::IdfObject> remove(); | ||
| 53 | |||
| 54 | //@} | ||
| 55 | /** @name Static Methods */ | ||
| 56 | //@{ | ||
| 57 | |||
| 58 | static IddObjectType iddObjectType(); | ||
| 59 | |||
| 60 | /// Returns the regular expression used to parse the name field. | ||
| 61 | /// matches[1], specific end use type | ||
| 62 | /// matches[2], end use type | ||
| 63 | /// matches[3], fuel type | ||
| 64 | /// matches[4], install location type | ||
| 65 | /// matches[5], install location name | ||
| 66 | static boost::regex meterRegex(); | ||
| 67 | |||
| 68 | /// Returns the Meter name for a set of inputs. | ||
| 69 | static std::string getName(const boost::optional<std::string>& specificEndUseType, const boost::optional<EndUseType>& endUseType, | ||
| 70 | const boost::optional<FuelType>& fuelType, const boost::optional<InstallLocationType>& installLocationType, | ||
| 71 | const boost::optional<std::string>& specificInstallLocation); | ||
| 72 | |||
| 73 | static std::vector<std::string> reportingFrequencyValues(); | ||
| 74 | |||
| 75 | //@} | ||
| 76 | /** @name Getters */ | ||
| 77 | //@{ | ||
| 78 | |||
| 79 | //DLM@20110823: this method is overriding name from IdfObject | ||
| 80 | std::string name() const; | ||
| 81 | |||
| 82 | std::string reportingFrequency() const; | ||
| 83 | |||
| 84 | bool isReportingFrequencyDefaulted() const; | ||
| 85 | |||
| 86 | bool meterFileOnly() const; | ||
| 87 | |||
| 88 | bool isMeterFileOnlyDefaulted() const; | ||
| 89 | |||
| 90 | bool cumulative() const; | ||
| 91 | |||
| 92 | bool isCumulativeDefaulted() const; | ||
| 93 | |||
| 94 | /// Returns the specific end use category to meter from the name field. | ||
| 95 | /// For example, to meter all Lights with endUseSubcategory set to "General" the specific end use would be "General" | ||
| 96 | /// and the Meter name would be "General:InteriorLights:Electricity". | ||
| 97 | boost::optional<std::string> specificEndUse() const; | ||
| 98 | |||
| 99 | /// Returns the end use type to meter from the name field. | ||
| 100 | /// For example, to meter all Lights the end use type would be "InteriorLights" | ||
| 101 | /// and the Meter name would be "InteriorLights:Electricity:Facility". | ||
| 102 | boost::optional<EndUseType> endUseType() const; | ||
| 103 | |||
| 104 | /// Returns the fuel type to meter from the name field. | ||
| 105 | /// For example, to meter all electricity use the fuel type would be "Electricity" | ||
| 106 | /// and the Meter name would be "Electricity:Facility". | ||
| 107 | boost::optional<FuelType> fuelType() const; | ||
| 108 | |||
| 109 | /// Returns the location the meter is installed at from the name field. | ||
| 110 | /// For example, to meter all electricity at the Facility level the install location | ||
| 111 | /// would be "Facility" and the Meter name would be "Electricity:Facility". | ||
| 112 | boost::optional<InstallLocationType> installLocationType() const; | ||
| 113 | |||
| 114 | /// Returns the specific location the meter is installed at from the name field. | ||
| 115 | /// For example, to meter all electricity in a Zone named "Zone1" the specific install location | ||
| 116 | /// would be "Zone1" and the Meter name would be "Electricity:Zone:Zone1". | ||
| 117 | /// The value '*' indicates reporting for all locations. | ||
| 118 | boost::optional<std::string> specificInstallLocation() const; | ||
| 119 | |||
| 120 | //@} | ||
| 121 | /** @name Setters */ | ||
| 122 | //@{ | ||
| 123 | |||
| 124 | bool setReportingFrequency(const std::string& reportingFrequency); | ||
| 125 | |||
| 126 | void resetReportingFrequency(); | ||
| 127 | |||
| 128 | bool setMeterFileOnly(bool meterFileOnly); | ||
| 129 | |||
| 130 | void resetMeterFileOnly(); | ||
| 131 | |||
| 132 | bool setCumulative(bool cumulative); | ||
| 133 | |||
| 134 | void resetCumulative(); | ||
| 135 | |||
| 136 | /// Sets the specific end use category to meter in the name field. | ||
| 137 | /// For example, to meter all Lights with endUseSubcategory set to "General" the specific end use would be "General" | ||
| 138 | /// and the Meter name would be "General:InteriorLights:Electricity:Facility". Passing an empty string will unset the value. | ||
| 139 | bool setSpecificEndUse(const std::string& specifcEndUse); | ||
| 140 | bool resetSpecificEndUse(); | ||
| 141 | |||
| 142 | /// Sets the end use type to meter in the name field. | ||
| 143 | /// For example, to meter all Lights the end use type would be "InteriorLights" | ||
| 144 | /// and the Meter name would be "InteriorLights:Electricity:Facility". | ||
| 145 | bool setEndUseType(EndUseType type); | ||
| 146 | bool resetEndUseType(); | ||
| 147 | |||
| 148 | /// Sets the fuel type to meter in the name field. | ||
| 149 | /// For example, to meter all electricity use the fuel type would be "Electricity" | ||
| 150 | /// and the Meter name would be "Electricity:Facility". | ||
| 151 | bool setFuelType(FuelType type); | ||
| 152 | bool resetFuelType(); | ||
| 153 | |||
| 154 | /// Sets the location the meter is installed at from the name field. | ||
| 155 | /// For example, to meter all electricity at the Facility level the install location | ||
| 156 | /// would be "Facility" and the Meter name would be "Electricity:Facility". | ||
| 157 | bool setInstallLocationType(InstallLocationType type); | ||
| 158 | bool resetInstallLocationType(); | ||
| 159 | |||
| 160 | /// Sets the specific location the meter is installed at from the name field. | ||
| 161 | /// For example, to meter all electricity in a Zone named "Zone1" the specific install location | ||
| 162 | /// would be "Zone1" and the Meter name would be "Electricity:Zone:Zone1". | ||
| 163 | /// Passing an empty string will unset the value, '*' indicates reporting for all locations. | ||
| 164 | bool setSpecificInstallLocation(const std::string& locationName); | ||
| 165 | bool resetSpecificInstallLocation(); | ||
| 166 | |||
| 167 | //@} | ||
| 168 | |||
| 169 | /// Returns TimeSeries data for this Meter. Requires EnergyPlus simulation data. | ||
| 170 | boost::optional<openstudio::TimeSeries> getData(const std::string& envPeriod) const; | ||
| 171 | |||
| 172 | /// Returns TimeSeries data for this Meter, using given specificInstallLocation instead of this->specificInstallLocation. | ||
| 173 | /// Useful if this->specificInstallLocation is '*'. Requires EnergyPlus simulation data. | ||
| 174 | boost::optional<openstudio::TimeSeries> getData(const std::string& envPeriod, const boost::optional<std::string>& specificInstallLocation) const; | ||
| 175 | |||
| 176 | protected: | ||
| 177 | /// @cond | ||
| 178 | using ImplType = detail::OutputMeter_Impl; | ||
| 179 | |||
| 180 | friend class Model; | ||
| 181 | friend class openstudio::IdfObject; | ||
| 182 | |||
| 183 | explicit OutputMeter(std::shared_ptr<detail::OutputMeter_Impl> impl); | ||
| 184 | |||
| 185 | /// @endcond | ||
| 186 | private: | ||
| 187 | − | REGISTER_LOGGER("openstudio.model.OutputMeter"); | |
| 188 | }; | ||
| 189 | |||
| 190 | /** \relates OutputMeter*/ | ||
| 191 | using OptionalOutputMeter = boost::optional<OutputMeter>; | ||
| 192 | |||
| 193 | /** \relates OutputMeter*/ | ||
| 194 | using OutputMeterVector = std::vector<OutputMeter>; | ||
| 195 | |||
| 196 | /** Predicate for finding \link OutputMeter OutputMeters \endlink with fuelType() ft. \relates OutputMeter */ | ||
| 197 | MODEL_API bool MeterFuelTypeEquals(const OutputMeter& meter, const FuelType& ft); | ||
| 198 | |||
| 199 | } // namespace model | ||
| 200 | } // namespace openstudio | ||
| 201 | |||
| 202 | #endif // MODEL_OUTPUTMETER_HPP | ||
| 203 |