AMO-Tools-Suite  v.0.9.0
Set of tools for calculating energy efficiency in industrial equipment
All Classes Namespaces Files Functions Variables Enumerations Friends Macros Pages
Planar.h
1 
8 #ifndef AMO_TOOLS_SUITE_PLANAR_H
9 #define AMO_TOOLS_SUITE_PLANAR_H
10 #include <vector>
11 #include <cmath>
12 
13 // to be inherited by planes 3 and 3a, 3b
15 public:
16  double getPv3Value() const {
17  return pv3;
18  }
19 
20  double get75percentRule() const {
21  return percent75Rule;
22  }
23 protected:
24  // protected constructor to be used only during the construction of its derived classes
25  VelocityPressureTraverseData(const double pitotTubeCoefficient,
26  std::vector< std::vector< double > > traverseHoleData)
27  : pitotTubeCoefficient(pitotTubeCoefficient), traverseHoleData(std::move(traverseHoleData))
28  {
29  double maxPv3r = 0.0;
30  double sumPv3r = 0.0;
31  for (auto & row : this->traverseHoleData) {
32  for (double & val : row) {
33  if (val <= 0) {
34  val = 0;
35  continue;
36  }
37  val *= std::pow(pitotTubeCoefficient, 2);
38  if (val > maxPv3r) {
39  maxPv3r = val;
40  }
41  sumPv3r += std::sqrt(val);
42  }
43  }
44 
45  pv3 = std::pow(sumPv3r / (this->traverseHoleData.size() * this->traverseHoleData[0].size()), 2);
46 
47  std::size_t count = 0;
48  for (auto & row : this->traverseHoleData) {
49  for (auto & val : row) {
50  if (val > (0.1 * maxPv3r)) count++;
51  }
52  }
53 
54  percent75Rule = count / static_cast<double>(this->traverseHoleData.size() * this->traverseHoleData[0].size());
55  }
56 
57  const double pitotTubeCoefficient;
58  double pv3 = 0, percent75Rule = 0;
59 
60  std::vector< std::vector< double > > traverseHoleData;
61 
62  friend class PlaneData;
63 };
64 
65 class Planar {
66 protected:
67  Planar(const double area, const double tdx, const double pbx, const double psx)
68  : dryBulbTemperature(tdx), barometricPressure(pbx), area(area), staticPressure(psx)
69  {}
78  const double dryBulbTemperature, barometricPressure, area;
79  double gasDensity = 0, gasVelocity = 0, gasVolumeFlowRate = 0, gasVelocityPressure = 0, gasTotalPressure = 0;
80  double staticPressure = 0;
81 
82  friend class PlaneData;
83  friend class Fan203;
84 };
85 
86 class FlangePlane : public Planar {
87 public:
88  FlangePlane(const double area, const double tdx, const double pbx)
89  : Planar(area, tdx, pbx, 0) {}
90 };
91 
92 class TraversePlane : public Planar, public VelocityPressureTraverseData {
93 public:
94  TraversePlane(const double area, const double tdx, const double pbx, const double psx,
95  const double pitotTubeCoefficient, std::vector< std::vector< double > > traverseHoleData)
96  : Planar(area, tdx, pbx, psx),
97  VelocityPressureTraverseData(pitotTubeCoefficient, std::move(traverseHoleData))
98  {}
99 };
100 
101 class MstPlane : public Planar {
102 public:
103  MstPlane(const double area, const double tdx, const double pbx, const double psx)
104  : Planar(area, tdx, pbx, psx) {}
105 };
106 
107 #endif //AMO_TOOLS_SUITE_PLANAR_H
Definition: Planar.h:65
Definition: Fan203.h:614