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
Planar.h
1
8#ifndef TOOLS_SUITE_PLANAR_H
9#define TOOLS_SUITE_PLANAR_H
10#include <cmath>
11#include <vector>
12
13// to be inherited by planes 3 and 3a, 3b
15 public:
16 double getPv3Value() const { return pv3; }
17
18 double get75percentRule() const { return percent75Rule; }
19
20 protected:
21 // protected constructor to be used only during the construction of its derived classes
22 VelocityPressureTraverseData(const double pitotTubeCoefficient, std::vector<std::vector<double>> traverseHoleData)
23 : pitotTubeCoefficient(pitotTubeCoefficient), traverseHoleData(std::move(traverseHoleData)) {
24 double maxPv3r = 0.0;
25 double sumPv3r = 0.0;
26 for (auto& row : this->traverseHoleData) {
27 for (double& val : row) {
28 if (val <= 0) {
29 val = 0;
30 continue;
31 }
32 val *= std::pow(pitotTubeCoefficient, 2);
33 if (val > maxPv3r) {
34 maxPv3r = val;
35 }
36 sumPv3r += std::sqrt(val);
37 }
38 }
39
40 pv3 = std::pow(sumPv3r / (this->traverseHoleData.size() * this->traverseHoleData[0].size()), 2);
41
42 std::size_t count = 0;
43 for (auto& row : this->traverseHoleData) {
44 for (auto& val : row) {
45 if (val > (0.1 * maxPv3r))
46 count++;
47 }
48 }
49
50 percent75Rule = count / static_cast<double>(this->traverseHoleData.size() * this->traverseHoleData[0].size());
51 }
52
53 double pitotTubeCoefficient;
54 double pv3 = 0, percent75Rule = 0;
55
56 std::vector<std::vector<double>> traverseHoleData;
57
58 friend class PlaneData;
59};
60
61class Planar {
62 protected:
63 Planar(const double area, const double tdx, const double pbx, const double psx)
64 : dryBulbTemperature(tdx), barometricPressure(pbx), area(area), staticPressure(psx) {}
73 double dryBulbTemperature, barometricPressure, area;
74 double gasDensity = 0, gasVelocity = 0, gasVolumeFlowRate = 0, gasVelocityPressure = 0, gasTotalPressure = 0;
75 double staticPressure = 0;
76
77 friend class PlaneData;
78 friend class Fan203;
79};
80
81class FlangePlane : public Planar {
82 public:
83 FlangePlane(const double area, const double tdx, const double pbx) : Planar(area, tdx, pbx, 0) {}
84};
85
87 public:
88 TraversePlane(const double area, const double tdx, const double pbx, const double psx,
89 const double pitotTubeCoefficient, std::vector<std::vector<double>> traverseHoleData)
90 : Planar(area, tdx, pbx, psx), VelocityPressureTraverseData(pitotTubeCoefficient, std::move(traverseHoleData)) {
91 }
92};
93
94class MstPlane : public Planar {
95 public:
96 MstPlane(const double area, const double tdx, const double pbx, const double psx) : Planar(area, tdx, pbx, psx) {}
97};
98
99#endif // TOOLS_SUITE_PLANAR_H
double dryBulbTemperature
Definition Planar.h:73