GCC Code Coverage Report


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

src/model/FanSystemModel.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_FANSYSTEMMODEL_HPP
7 #define MODEL_FANSYSTEMMODEL_HPP
8
9 #include <model/ModelAPI.hpp>
10 #include "StraightComponent.hpp"
11
12 namespace openstudio {
13
14 namespace model {
15
16 class Schedule;
17 class Curve;
18 class ThermalZone;
19 class AirflowNetworkFan;
20
21 namespace detail {
22
23 class FanSystemModel_Impl;
24
25 } // namespace detail
26
27 /** This class implements a speed */
28 class MODEL_API FanSystemModelSpeed
29 {
30 public:
31 FanSystemModelSpeed(double flowFraction);
32
33 FanSystemModelSpeed(double flowFraction, double electricPowerFraction);
34
35 double flowFraction() const;
36 boost::optional<double> electricPowerFraction() const;
37
38 bool operator<(const FanSystemModelSpeed& other) const;
39
40 private:
41 double m_flowFraction;
42 boost::optional<double> m_electricPowerFraction;
43 − REGISTER_LOGGER("openstudio.model.FanSystemModelSpeed");
44 };
45
46 // Overload operator<<
47 MODEL_API std::ostream& operator<<(std::ostream& out, const openstudio::model::FanSystemModelSpeed& speed);
48
49 /** FanSystemModel is a StraightComponent that wraps the OpenStudio IDD object 'OS:Fan:SystemModel'. */
50 class MODEL_API FanSystemModel : public StraightComponent
51 {
52 public:
53 /** @name Constructors and Destructors */
54 //@{
55
56 explicit FanSystemModel(const Model& model);
57
58 174 virtual ~FanSystemModel() override = default;
59 // Default the copy and move operators because the virtual dtor is explicit
60 9 FanSystemModel(const FanSystemModel& other) = default;
61 31 FanSystemModel(FanSystemModel&& other) = default;
62 ✗ FanSystemModel& operator=(const FanSystemModel&) = default;
63 ✗ FanSystemModel& operator=(FanSystemModel&&) = default;
64
65 //@}
66
67 static IddObjectType iddObjectType();
68
69 static std::vector<std::string> speedControlMethodValues();
70
71 static std::vector<std::string> designPowerSizingMethodValues();
72
73 /** @name Getters */
74 //@{
75
76 Schedule availabilitySchedule() const;
77
78 boost::optional<double> designMaximumAirFlowRate() const;
79 bool isDesignMaximumAirFlowRateAutosized() const;
80 boost::optional<double> autosizedDesignMaximumAirFlowRate();
81
82 std::string speedControlMethod() const;
83
84 double electricPowerMinimumFlowRateFraction() const;
85
86 double designPressureRise() const;
87
88 double motorEfficiency() const;
89
90 double motorInAirStreamFraction() const;
91
92 boost::optional<double> designElectricPowerConsumption() const;
93 bool isDesignElectricPowerConsumptionAutosized() const;
94 boost::optional<double> autosizedDesignElectricPowerConsumption();
95
96 std::string designPowerSizingMethod() const;
97
98 double electricPowerPerUnitFlowRate() const;
99
100 double electricPowerPerUnitFlowRatePerUnitPressure() const;
101
102 double fanTotalEfficiency() const;
103
104 boost::optional<Curve> electricPowerFunctionofFlowFractionCurve() const;
105
106 boost::optional<double> nightVentilationModePressureRise() const;
107
108 boost::optional<double> nightVentilationModeFlowFraction() const;
109
110 boost::optional<ThermalZone> motorLossZone() const;
111
112 double motorLossRadiativeFraction() const;
113
114 std::string endUseSubcategory() const;
115
116 unsigned numberofSpeeds() const;
117 std::vector<FanSystemModelSpeed> speeds() const;
118
119 /** Find a given speed by the flowFraction (key) */
120 boost::optional<unsigned> speedIndex(const FanSystemModelSpeed& speed) const;
121
122 boost::optional<FanSystemModelSpeed> getSpeed(unsigned speedIndex) const;
123
124 //@}
125 /** @name Setters */
126 //@{
127
128 /** If a speed group is already present (= the flowFraction already exists) (cf `speedIndex()`), it will Warn and override the electricPowerFraction value */
129 bool addSpeed(const FanSystemModelSpeed& speed);
130
131 // This one leaves the electricPowerFraction blank, so the electricPowerFunctionofFlowFractionCurve is used.
132 bool addSpeed(double flowFraction);
133
134 // Overloads, it creates a FanSystemModelSpeed wrapper, then call `addSpeed(const FanSystemModelSpeed&)`
135 // This one specifies both
136 bool addSpeed(double flowFraction, double electricPowerFraction);
137
138 bool removeSpeed(unsigned speedIndex);
139
140 void removeAllSpeeds();
141
142 // Directly set the speeds from a vector, will delete any existing speeds. Will sort out the speeds too, ascending by flowFraction
143 bool setSpeeds(const std::vector<FanSystemModelSpeed>& speeds);
144
145 bool setAvailabilitySchedule(Schedule& schedule);
146
147 bool setDesignMaximumAirFlowRate(double designMaximumAirFlowRate);
148 void autosizeDesignMaximumAirFlowRate();
149
150 bool setSpeedControlMethod(const std::string& speedControlMethod);
151
152 bool setElectricPowerMinimumFlowRateFraction(double electricPowerMinimumFlowRateFraction);
153
154 bool setDesignPressureRise(double designPressureRise);
155
156 bool setMotorEfficiency(double motorEfficiency);
157
158 bool setMotorInAirStreamFraction(double motorInAirStreamFraction);
159
160 bool setDesignElectricPowerConsumption(double designElectricPowerConsumption);
161 void autosizeDesignElectricPowerConsumption();
162
163 bool setDesignPowerSizingMethod(const std::string& designPowerSizingMethod);
164
165 bool setElectricPowerPerUnitFlowRate(double electricPowerPerUnitFlowRate);
166
167 bool setElectricPowerPerUnitFlowRatePerUnitPressure(double electricPowerPerUnitFlowRatePerUnitPressure);
168
169 bool setFanTotalEfficiency(double fanTotalEfficiency);
170
171 bool setElectricPowerFunctionofFlowFractionCurve(const Curve& univariateFunctions);
172 void resetElectricPowerFunctionofFlowFractionCurve();
173
174 bool setNightVentilationModePressureRise(double nightVentilationModePressureRise);
175 void resetNightVentilationModePressureRise();
176
177 bool setNightVentilationModeFlowFraction(double nightVentilationModeFlowFraction);
178 void resetNightVentilationModeFlowFraction();
179
180 bool setMotorLossZone(const ThermalZone& thermalZone);
181 void resetMotorLossZone();
182
183 bool setMotorLossRadiativeFraction(double motorLossRadiativeFraction);
184
185 bool setEndUseSubcategory(const std::string& endUseSubcategory);
186
187 //@}
188 /** @name Other */
189 //@{
190
191 AirflowNetworkFan getAirflowNetworkFan();
192 boost::optional<AirflowNetworkFan> airflowNetworkFan() const;
193
194 //@}
195 protected:
196 /// @cond
197 using ImplType = detail::FanSystemModel_Impl;
198
199 explicit FanSystemModel(std::shared_ptr<detail::FanSystemModel_Impl> impl);
200
201 friend class detail::FanSystemModel_Impl;
202 friend class Model;
203 friend class IdfObject;
204 friend class openstudio::detail::IdfObject_Impl;
205 /// @endcond
206 private:
207 REGISTER_LOGGER("openstudio.model.FanSystemModel");
208 };
209
210 /** \relates FanSystemModel*/
211 using OptionalFanSystemModel = boost::optional<FanSystemModel>;
212
213 /** \relates FanSystemModel*/
214 using FanSystemModelVector = std::vector<FanSystemModel>;
215
216 } // namespace model
217 } // namespace openstudio
218
219 #endif // MODEL_FANSYSTEMMODEL_HPP
220