MEASUR-Tools-Suite v1.0.11
The MEASUR Tools Suite is a collection of industrial efficiency calculations written in C++ and with bindings for compilation to WebAssembly.
Loading...
Searching...
No Matches
OptimalFanEfficiency.h
1
8#pragma once
9
10#include <cfloat>
11#include <cmath>
12#include <functional>
13
19 public:
20 enum class FanType {
21 AirfoilSISW,
22 BackwardCurvedSISW,
23 RadialSISW,
24 RadialTipSISW,
25 BackwardInclinedSISW,
26 AirfoilDIDW,
27 BackwardCurvedDIDW,
28 BackwardInclinedDIDW,
29 VaneAxial,
30 AirHandling,
31 MaterialHandling,
32 LongShavings
33 };
34
35 OptimalFanEfficiency(FanType const fanType, const double fanSpeed, const double flowRate,
36 const double inletPressure, const double outletPressure, const double compressibility)
37 : fanType(fanType), fanSpeed(fanSpeed), flowRate(flowRate), outletPressure(outletPressure),
38 inletPressure(inletPressure), compressibility(compressibility) {};
39
44 double calculate() {
45 FanTypeProperties const& currentFan = fanTypeProperties[static_cast<std::size_t>(fanType)];
46 double specificSpeed = (fanSpeed * std::sqrt(flowRate)) /
47 (std::pow(outletPressure - inletPressure, 0.75) * std::pow(compressibility, 0.25));
48
49 if (specificSpeed < currentFan.minSpecificSpeed) {
50 specificSpeed = currentFan.minSpecificSpeed;
51 }
52 else if (specificSpeed > currentFan.maxSpecificSpeed) {
53 specificSpeed = currentFan.maxSpecificSpeed;
54 }
55
56 bool isPolynomial = specificSpeed < currentFan.transition;
57 if (isPolynomial) {
58 return currentFan.polynomialFunction(specificSpeed);
59 }
60 return currentFan.exponentialFunction(specificSpeed);
61 }
62
63 private:
64 FanType const fanType;
65 const double fanSpeed, flowRate, outletPressure, inletPressure, compressibility;
66
68 private:
78 const FanType fanType, const double transition, const double minSpecificSpeed,
79 const double maxSpecificSpeed, std::function<double(double n)> polynomialFunction,
80 std::function<double(double n)> exponentialFunction = [](double) { return 0; })
81 : fanType(fanType), transition(transition), minSpecificSpeed(minSpecificSpeed),
82 maxSpecificSpeed(maxSpecificSpeed), polynomialFunction(std::move(polynomialFunction)),
83 exponentialFunction(std::move(exponentialFunction)) {}
84
85 const FanType fanType;
86 const double transition, minSpecificSpeed, maxSpecificSpeed;
87 const std::function<double(double n)> polynomialFunction;
88 const std::function<double(double n)> exponentialFunction;
89 friend class OptimalFanEfficiency;
90 };
91
92 // TODO consider making this static. I think C++17 should allow this to be done inline, in this header file
93 const FanTypeProperties fanTypeProperties[12] = {
94 {FanType::AirfoilSISW, 40500, 25000, 1200100,
95 [](double n) {
96 return -8.0126838E+01 + 1.4126667E-02 * n + -1.0177155E-06 * std::pow(n, 2) +
97 3.8587782E-11 * std::pow(n, 3) + -8.1056442E-16 * std::pow(n, 4) + 8.9381481E-21 * std::pow(n, 5) +
98 -4.0433292E-26 * std::pow(n, 6);
99 },
100 [](double n) {
101 return 0.0028841 + 0.27192 * std::exp(-2.2547E-06 * n) + 0.86849 * std::exp(-0.00001064 * n);
102 }},
103 {
104 FanType::BackwardCurvedSISW,
105 DBL_MAX,
106 27900,
107 102000,
108 [](double n) {
109 return -3.3858306E+00 + 4.1209144E-04 * n + -1.6548201E-08 * std::pow(n, 2) +
110 3.5761249E-13 * std::pow(n, 3) + -4.5693281E-18 * std::pow(n, 4) +
111 3.4555013E-23 * std::pow(n, 5) + -1.4316102E-28 * std::pow(n, 6) +
112 2.5065191E-34 * std::pow(n, 7);
113 },
114 },
115 {
116 FanType::RadialSISW,
117 37900,
118 14000,
119 135800,
120 [](double n) {
121 return -1.9069988E+00 + 7.3713948E-04 * n + -1.0257832E-07 * std::pow(n, 2) +
122 8.3624959E-12 * std::pow(n, 3) + -4.1052861E-16 * std::pow(n, 4) +
123 1.1767564E-20 * std::pow(n, 5) + -1.8050575E-25 * std::pow(n, 6) +
124 1.1417504E-30 * std::pow(n, 7);
125 },
126 [](double n) {
127 return 0.056999916 + 0.67916774 * std::exp(-2.18789E-05 * n) + 5.1126555 * std::exp(-0.000132336 * n);
128 },
129 },
130 {
131 FanType::RadialTipSISW,
132 64000,
133 19400,
134 213400,
135 [](double n) {
136 return 5.2461E-01 + 1.1922E-05 * n + 3.1851E-11 * std::pow(n, 2) + -7.0532E-15 * std::pow(n, 3) +
137 4.8891E-20 * std::pow(n, 4) + 1.5505E-25 * std::pow(n, 5);
138 },
139 [](double n) {
140 return 0.053287 + 0.47705 * std::exp(-7.7713E-06 * n) + 0.93414 * std::exp(-0.000023195 * n);
141 },
142 },
143 {
144 FanType::BackwardInclinedSISW,
145 DBL_MAX,
146 32100,
147 150100,
148 [](double n) {
149 return -3.8748275E+00 + 5.7599797E-04 * n + -3.4547599E-08 * std::pow(n, 2) +
150 1.3031136E-12 * std::pow(n, 3) + -3.2700894E-17 * std::pow(n, 4) +
151 5.4984885E-22 * std::pow(n, 5) + -6.1792981E-27 * std::pow(n, 6) +
152 4.5680803E-32 * std::pow(n, 7) + -2.1294090E-37 * std::pow(n, 8) +
153 5.6703436E-43 * std::pow(n, 9) + -6.5731157E-49 * std::pow(n, 10);
154 },
155 },
156 {
157 FanType::AirfoilDIDW,
158 78000,
159 39000,
160 1800000,
161 [](double n) {
162 return -7.7454E+00 + 5.3186E-04 * n + -1.1335E-08 * std::pow(n, 2) + 7.1361E-14 * std::pow(n, 3) +
163 6.9345E-19 * std::pow(n, 4) + -1.1607E-23 * std::pow(n, 5) + 4.3954E-29 * std::pow(n, 6);
164 },
165 [](double n) {
166 return 0.019737 + 0.37398 * std::exp(-0.000002682 * n) + 0.8666 * std::exp(-0.000010656 * n);
167 },
168 },
169 {
170 FanType::BackwardCurvedDIDW,
171 148900,
172 38000,
173 270800,
174 [](double n) {
175 return -8.6410E+00 + 8.1273E-04 * n + -2.9882E-08 * std::pow(n, 2) + 6.1531E-13 * std::pow(n, 3) +
176 -7.7968E-18 * std::pow(n, 4) + 6.2161E-23 * std::pow(n, 5) + -3.0415E-28 * std::pow(n, 6) +
177 8.3466E-34 * std::pow(n, 7) + -9.8355E-40 * std::pow(n, 8);
178 },
179 [](double n) {
180 return 0.11242 + 1.5789 * std::exp(-9.2707E-06 * n) + -0.55707 * std::exp(-9.9734E-06 * n);
181 },
182 },
183 {
184 FanType::BackwardInclinedDIDW,
185 132600,
186 46000,
187 622500,
188 [](double n) {
189 return -2.5449389E+02 + 2.7852726E-02 * n + -1.3284246E-06 * std::pow(n, 2) +
190 3.6371269E-11 * std::pow(n, 3) + -6.3036202E-16 * std::pow(n, 4) +
191 7.1757531E-21 * std::pow(n, 5) + -5.3686875E-26 * std::pow(n, 6) +
192 2.5473585E-31 * std::pow(n, 7) + -6.9602675E-37 * std::pow(n, 8) +
193 8.3493931E-43 * std::pow(n, 9);
194 },
195 [](double n) {
196 return 0.036754527 + 0.50694842 * std::exp(-4.70913E-06 * n) + 1.0416177 * std::exp(-1.79781E-05 * n);
197 },
198 },
199 {
200 FanType::VaneAxial,
201 179670,
202 60375,
203 348620,
204 [](double n) {
205 return -5.4813500E+00 + 5.0387520E-04 * n + -1.8304300E-08 * std::pow(n, 2) +
206 3.7439830E-13 * std::pow(n, 3) + -4.6531220E-18 * std::pow(n, 4) +
207 3.5829160E-23 * std::pow(n, 5) + -1.6699090E-28 * std::pow(n, 6) +
208 4.3158650E-34 * std::pow(n, 7) + -4.7471640E-40 * std::pow(n, 8);
209 },
210 [](double n) {
211 return 0.1704079 + 1.968828 * std::exp(-7.24616E-06 * n) + -1.782739 * std::exp(-1.32444E-05 * n);
212 },
213 },
214 {
215 FanType::AirHandling,
216 DBL_MAX,
217 15100,
218 67600,
219 [](double n) {
220 return 1.9237E-01 + 8.0744E-05 * n + -4.3274E-09 * std::pow(n, 2) + 9.5885E-14 * std::pow(n, 3) +
221 -1.0050E-18 * std::pow(n, 4) + 4.0941E-24 * std::pow(n, 5);
222 },
223 },
224 {
225 FanType::MaterialHandling,
226 28600,
227 10100,
228 65600,
229 [](double n) {
230 return -1.4085021E+02 + 6.9753242E-02 * n + -1.4963605E-05 * std::pow(n, 2) +
231 1.8305766E-09 * std::pow(n, 3) + -1.4075805E-13 * std::pow(n, 4) +
232 7.0623637E-18 * std::pow(n, 5) + -2.3154680E-22 * std::pow(n, 6) +
233 4.7905555E-27 * std::pow(n, 7) + -5.6833385E-32 * std::pow(n, 8) +
234 2.9495463E-37 * std::pow(n, 9);
235 },
236 [](double n) {
237 return 0.046254578 + 0.44481692 * std::exp(-2.74877E-05 * n) + 0.61800978 * std::exp(-2.56071E-05 * n);
238 },
239 },
240 {
241 FanType::LongShavings,
242 38500,
243 12400,
244 180500,
245 [](double n) {
246 return -4.9068901E+00 + 1.1742587E-03 * n + -9.8831999E-08 * std::pow(n, 2) +
247 4.2747034E-12 * std::pow(n, 3) + -1.0139920E-16 * std::pow(n, 4) +
248 1.2507408E-21 * std::pow(n, 5) + -6.2553192E-27 * std::pow(n, 6);
249 },
250 [](double n) {
251 return 0.026213128 + 0.31783591 * std::exp(-1.22334E-05 * n) + 0.90262955 * std::exp(-4.33422E-05 * n);
252 },
253 }};
254};
FanTypeProperties(const FanType fanType, const double transition, const double minSpecificSpeed, const double maxSpecificSpeed, std::function< double(double n)> polynomialFunction, std::function< double(double n)> exponentialFunction=[](double) { return 0;})