GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 60.0% 3 / 2 / 7
Functions: 60.0% 3 / 2 / 7
Branches: -% 0 / 2 / 2

src/model/GeneratorFuelSupply.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_GENERATORFUELSUPPLY_HPP
7 #define MODEL_GENERATORFUELSUPPLY_HPP
8
9 #include "ModelAPI.hpp"
10 #include "ModelObject.hpp"
11
12 namespace openstudio {
13
14 namespace model {
15
16 class Node;
17 class Schedule;
18 class CurveCubic;
19 class GeneratorFuelCell;
20
21 namespace detail {
22
23 class GeneratorFuelSupply_Impl;
24
25 } // namespace detail
26
27 /** This class implements a constituent */
28 class MODEL_API FuelSupplyConstituent
29 {
30 public:
31 FuelSupplyConstituent(const std::string& constituentName, double molarFraction);
32
33 std::string constituentName() const;
34 double molarFraction() const;
35
36 static bool isValid(const std::string& constituentName);
37 static std::vector<std::string> constituentNameValues();
38 static std::vector<std::string> validConstituentNameValues();
39
40 private:
41 std::string m_name;
42 double m_molarFraction;
43 − REGISTER_LOGGER("openstudio.model.FuelSupplyConstituent");
44 };
45
46 // Overload operator<<
47 MODEL_API std::ostream& operator<<(std::ostream& out, const openstudio::model::FuelSupplyConstituent& constituent);
48
49 /** GeneratorFuelSupply is a ModelObject that wraps the OpenStudio IDD object 'OS:Generator:FuelSupply'. */
50 class MODEL_API GeneratorFuelSupply : public ModelObject
51 {
52 public:
53 /** @name Constructors and Destructors */
54 //@{
55
56 explicit GeneratorFuelSupply(const Model& model);
57
58 explicit GeneratorFuelSupply(const Model& model, Schedule& tempSchedule, const CurveCubic& powerCurve);
59
60 86 virtual ~GeneratorFuelSupply() override = default;
61 // Default the copy and move operators because the virtual dtor is explicit
62 17 GeneratorFuelSupply(const GeneratorFuelSupply& other) = default;
63 40 GeneratorFuelSupply(GeneratorFuelSupply&& other) = default;
64 ✗ GeneratorFuelSupply& operator=(const GeneratorFuelSupply&) = default;
65 ✗ GeneratorFuelSupply& operator=(GeneratorFuelSupply&&) = default;
66
67 //@}
68
69 static IddObjectType iddObjectType();
70
71 static std::vector<std::string> fuelTemperatureModelingModeValues();
72
73 static std::vector<std::string> fuelTypeValues();
74
75 //extensible fields
76
77 bool addConstituent(const FuelSupplyConstituent& constituent);
78 // Convenience function to add a constituent without explicitly creating a FuelSupplyConstituent
79 bool addConstituent(const std::string& name, double molarFraction);
80
81 // TODO: this should return bool (to indicate whether groupIndex is valid...)
82 void removeConstituent(int groupIndex);
83
84 void removeAllConstituents();
85
86 std::vector<FuelSupplyConstituent> constituents() const;
87
88 /** @name Getters */
89 //@{
90
91 std::string fuelTemperatureModelingMode() const;
92
93 boost::optional<Node> fuelTemperatureReferenceNode() const;
94
95 boost::optional<Schedule> fuelTemperatureSchedule() const;
96
97 CurveCubic compressorPowerMultiplierFunctionofFuelRateCurve() const;
98
99 double compressorHeatLossFactor() const;
100
101 std::string fuelType() const;
102
103 boost::optional<double> liquidGenericFuelLowerHeatingValue() const;
104
105 boost::optional<double> liquidGenericFuelHigherHeatingValue() const;
106
107 boost::optional<double> liquidGenericFuelMolecularWeight() const;
108
109 boost::optional<double> liquidGenericFuelCO2EmissionFactor() const;
110
111 // TODO: this should be non optional
112 boost::optional<unsigned int> numberofConstituentsinGaseousConstituentFuelSupply() const;
113
114 // Convenience function to check that it's equal to 1.0 (If no constituents, returns 0 and warns)
115 double sumofConstituentsMolarFractions() const;
116
117 // Return optional parent generator
118 boost::optional<GeneratorFuelCell> fuelCell() const;
119
120 //@}
121 /** @name Setters */
122 //@{
123
124 bool setFuelTemperatureModelingMode(const std::string& fuelTemperatureModelingMode);
125
126 void resetFuelTemperatureModelingMode();
127
128 bool setFuelTemperatureReferenceNode(const Node& connection);
129
130 void resetFuelTemperatureReferenceNode();
131
132 bool setFuelTemperatureSchedule(Schedule& schedule);
133
134 void resetFuelTemperatureSchedule();
135
136 bool setCompressorPowerMultiplierFunctionofFuelRateCurve(const CurveCubic& cubicCurves);
137
138 bool setCompressorHeatLossFactor(double compressorHeatLossFactor);
139
140 void resetCompressorHeatLossFactor();
141
142 bool setFuelType(const std::string& fuelType);
143
144 void resetFuelType();
145
146 bool setLiquidGenericFuelLowerHeatingValue(double liquidGenericFuelLowerHeatingValue);
147
148 void resetLiquidGenericFuelLowerHeatingValue();
149
150 bool setLiquidGenericFuelHigherHeatingValue(double liquidGenericFuelHigherHeatingValue);
151
152 void resetLiquidGenericFuelHigherHeatingValue();
153
154 bool setLiquidGenericFuelMolecularWeight(double liquidGenericFuelMolecularWeight);
155
156 void resetLiquidGenericFuelMolecularWeight();
157
158 bool setLiquidGenericFuelCO2EmissionFactor(double liquidGenericFuelCO2EmissionFactor);
159
160 void resetLiquidGenericFuelCO2EmissionFactor();
161
162 // Automatically handled by addConstituent, removeConstituent
163 // bool setNumberofConstituentsinGaseousConstituentFuelSupply(unsigned int numberofConstituentsinGaseousConstituentFuelSupply);
164 // void resetNumberofConstituentsinGaseousConstituentFuelSupply();
165
166 //@}
167 /** @name Other */
168 //@{
169
170 //@}
171 protected:
172 /// @cond
173 using ImplType = detail::GeneratorFuelSupply_Impl;
174
175 explicit GeneratorFuelSupply(std::shared_ptr<detail::GeneratorFuelSupply_Impl> impl);
176
177 friend class detail::GeneratorFuelSupply_Impl;
178 friend class Model;
179 friend class IdfObject;
180 friend class openstudio::detail::IdfObject_Impl;
181 /// @endcond
182 private:
183 − REGISTER_LOGGER("openstudio.model.GeneratorFuelSupply");
184 };
185
186 /** \relates GeneratorFuelSupply*/
187 using OptionalGeneratorFuelSupply = boost::optional<GeneratorFuelSupply>;
188
189 /** \relates GeneratorFuelSupply*/
190 using GeneratorFuelSupplyVector = std::vector<GeneratorFuelSupply>;
191
192 } // namespace model
193 } // namespace openstudio
194
195 #endif // MODEL_GENERATORFUELSUPPLY_HPP
196