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