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
PneumaticAirRequirement.h
Go to the documentation of this file.
1
10#ifndef TOOLS_SUITE_PNEUMATICAIRREQUIREMENT_H
11#define TOOLS_SUITE_PNEUMATICAIRREQUIREMENT_H
12
13#include <cmath>
14#include <functional>
15#include <stdexcept>
16#include <vector>
17
19 public:
20 enum class PistonType { SingleActing, DoubleActing };
21
36 PneumaticAirRequirement(PistonType pistonType, double cylinderDiameter, double cylinderStroke,
37 double pistonRodDiameter, double airPressure, double cyclesPerMin)
38 : pistonType(pistonType), cylinderDiameter(cylinderDiameter), cylinderStroke(cylinderStroke),
39 pistonRodDiameter(pistonRodDiameter), airPressure(airPressure), cyclesPerMin(cyclesPerMin) {
40 if (pistonType != PistonType::DoubleActing) {
41 throw std::runtime_error("You must have a DoubleActing piston type to use piston rod diameter");
42 }
43 }
44
57 PneumaticAirRequirement(PistonType pistonType, double cylinderDiameter, double cylinderStroke, double airPressure,
58 double cyclesPerMin)
59 : pistonType(pistonType), cylinderDiameter(cylinderDiameter), cylinderStroke(cylinderStroke),
60 airPressure(airPressure), cyclesPerMin(cyclesPerMin) {
61 if (pistonType != PistonType::SingleActing) {
62 throw std::runtime_error("You must have a SingleActing piston type if you do not use piston rod diameter");
63 }
64 }
65
66 PneumaticAirRequirement() = default;
67
68 class Output {
69 public:
78 Output(const double volumeAirIntakePiston, const double compressionRatio,
79 const double airRequirementPneumaticCylinder)
80 : volumeAirIntakePiston(volumeAirIntakePiston), compressionRatio(compressionRatio),
81 airRequirementPneumaticCylinder(airRequirementPneumaticCylinder) {}
82
83 const double volumeAirIntakePiston, compressionRatio, airRequirementPneumaticCylinder;
84 };
85
91 auto const volumeAirIntakeSingle =
92 (0.785 * std::pow(cylinderDiameter, 2) * cylinderStroke * cyclesPerMin) / 1728;
93 auto const compressionRatio = (airPressure + 14.7) / 14.7;
94
95 if (pistonType == PneumaticAirRequirement::PistonType::SingleActing) {
96 return {volumeAirIntakeSingle, compressionRatio, volumeAirIntakeSingle * compressionRatio};
97 }
98 auto const volumeAirIntakeDouble = (2 * 1728 * volumeAirIntakeSingle -
99 (0.785 * std::pow(pistonRodDiameter, 2) * cylinderStroke * cyclesPerMin)) /
100 1728;
101 return {volumeAirIntakeDouble, compressionRatio, volumeAirIntakeDouble * compressionRatio};
102 }
103
104 private:
105 PistonType pistonType;
106 double cylinderDiameter, cylinderStroke, pistonRodDiameter = 0, airPressure, cyclesPerMin;
107};
108
109#endif
Output(const double volumeAirIntakePiston, const double compressionRatio, const double airRequirementPneumaticCylinder)
PneumaticAirRequirement(PistonType pistonType, double cylinderDiameter, double cylinderStroke, double pistonRodDiameter, double airPressure, double cyclesPerMin)
PneumaticAirRequirement(PistonType pistonType, double cylinderDiameter, double cylinderStroke, double airPressure, double cyclesPerMin)