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
CompressedAir.h
1 
9 #ifndef AMO_TOOLS_SUITE_COMPRESSEDAIR_H
10 #define AMO_TOOLS_SUITE_COMPRESSEDAIR_H
11 
12 #include <vector>
13 #include <cmath>
14 #include <stdexcept>
15 #include <functional>
16 
17 class CompressedAir{
18 public:
19  enum CompressorType {
20  Centrifugal
21  };
22 };
23 
25 public:
26  enum class PistonType {
27  SingleActing,
28  DoubleActing
29  };
30 
42  PneumaticAirRequirement(PistonType pistonType, double cylinderDiameter, double cylinderStroke, double pistonRodDiameter,
43  double airPressure, double cyclesPerMin);
44 
55  PneumaticAirRequirement(PistonType pistonType, double cylinderDiameter, double cylinderStroke, double airPressure,
56  double cyclesPerMin);
57 
58  PneumaticAirRequirement() = default;
59 
60  class Output {
61  public:
69  Output(const double volumeAirIntakePiston, const double compressionRatio,
70  const double airRequirementPneumaticCylinder)
71  : volumeAirIntakePiston(volumeAirIntakePiston),
72  compressionRatio(compressionRatio),
73  airRequirementPneumaticCylinder(airRequirementPneumaticCylinder)
74  {}
75 
76  const double volumeAirIntakePiston, compressionRatio, airRequirementPneumaticCylinder;
77  };
78 
83  Output calculate();
84 
85 private:
86  PistonType pistonType;
87  double cylinderDiameter, cylinderStroke, pistonRodDiameter = 0, airPressure, cyclesPerMin;
88 };
89 
90 class ReceiverTank {
91 public:
92  enum class Method {
93  General,
94  DedicatedStorage,
95  MeteredStorage,
96  BridgingCompressorReactionDelay
97  };
98 
99  ReceiverTank() = default;
100 
111  ReceiverTank(Method method, double airDemand, double allowablePressureDrop, double atmosphericPressure);
112 
125  ReceiverTank(Method method, double lengthOfDemandOrDistanceToCompressorRoom, double airFlowRequirementOrSpeedOfAir,
126  double atmosphericPressure, double initialTankPressureOrAirDemand, double finalTankPressureOrAllowablePressureDrop);
127 
141  ReceiverTank(Method method, double lengthOfDemand, double airFlowRequirement, double atmosphericPressure,
142  double initialTankPressure, double finalTankPressure, double meteredFlowControl);
143 
151  static double calculateUsableCapacity(const double tankSize, const double airPressureIn, const double airPressureOut) {
152  return (tankSize / 7.48) * (airPressureIn - airPressureOut) / 14.7;
153  }
154 
159  double calculateSize();
160 
161 private:
162  Method method;
163  double airDemand, allowablePressureDrop, atmosphericPressure;
164 
165  double lengthOfDemandOrDistanceToCompressorRoom, airFlowRequirementOrSpeedOfAir, initialTankPressureOrAirDemand;
166  double finalTankPressureOrAllowablePressureDrop;
167 
168  double meteredFlowControl;
169 };
170 
171 namespace Compressor {
172  struct PipeData {
178  PipeData(const double oneHalf, const double threeFourths, const double one, const double oneAndOneFourth,
179  const double oneAndOneHalf, const double two, const double twoAndOneHalf, const double three,
180  const double threeAndOneHalf, const double four, const double five, const double six, const double eight,
181  const double ten, const double twelve, const double fourteen, const double sixteen, const double eighteen,
182  const double twenty, const double twentyFour)
183  : oneHalf(oneHalf * 0.0021), threeFourths(threeFourths * 0.0037), one(one * 0.006),
184  oneAndOneFourth(oneAndOneFourth * 0.0104), oneAndOneHalf(oneAndOneHalf * 0.0141),
185  two(two * 0.0233), twoAndOneHalf(twoAndOneHalf * 0.0333), three(three * 0.0513),
186  threeAndOneHalf(threeAndOneHalf * 0.0687), four(four * 0.0884), five(five * 0.1389),
187  six(six * 0.2006), eight(eight * 0.3442), ten(ten * 0.5476), twelve(twelve * 0.7763), fourteen(fourteen * 0.9354), // **ten and twelve**
188  sixteen(sixteen * 1.223), eighteen(eighteen * 1.555), twenty(twenty * 1.926), twentyFour(twentyFour * 2.793),
189  totalPipeVolume(this->oneHalf + this->threeFourths + this->one + this->oneAndOneFourth
190  + this->oneAndOneHalf + this->two + this->twoAndOneHalf + this->three
191  + this->threeAndOneHalf + this->four + this->five + this->six
192  + this->eight + this->ten + this->twelve + this->fourteen + this->sixteen
193  + this->eighteen + this->twenty + this->twentyFour)
194  {}
195 
202  explicit PipeData(std::function<double (const double)> const & compVel)
203  : oneHalf(compVel(0.3)), threeFourths(compVel(0.53)), one(compVel(0.86)),
204  oneAndOneFourth(compVel(1.5)), oneAndOneHalf(compVel(2.04)),
205  two(compVel(3.36)), twoAndOneHalf(compVel(4.79)), three(compVel(7.39)),
206  threeAndOneHalf(compVel(9.89)), four(compVel(12.73)), five(compVel(20)),
207  six(compVel(28.89)), eight(compVel(50.02)), ten(compVel(78.85)), twelve(compVel(111.9)),
208  fourteen(compVel(135.3)), sixteen(compVel(176.7)), eighteen(compVel(224)), twenty(compVel(278)),
209  twentyFour(compVel(402.10))
210  {}
211 
212  const double oneHalf, threeFourths, one, oneAndOneFourth, oneAndOneHalf, two;
213  const double twoAndOneHalf, three, threeAndOneHalf, four, five, six;
214  const double eight, ten, twelve, fourteen, sixteen, eighteen, twenty, twentyFour;
215  const double totalPipeVolume = 0;
216  };
217 
218  class OperatingCost {
219  public:
232  OperatingCost(double motorBhp, double bhpUnloaded, double annualOperatingHours, double runTimeLoaded,
233  double efficiencyLoaded, double efficiencyUnloaded, double costOfElectricity);
234 
235  struct Output {
236  Output(const double runTimeUnloaded, const double costForLoaded, const double costForUnloaded,
237  const double totalAnnualCost)
238  : runTimeUnloaded(runTimeUnloaded), costForLoaded(costForLoaded),
239  costForUnloaded(costForUnloaded), totalAnnualCost(totalAnnualCost)
240  {}
241 
242  const double runTimeUnloaded, costForLoaded, costForUnloaded, totalAnnualCost;
243  };
244 
245  Output calculate();
246 
247  private:
248  double motorBhp, bhpUnloaded, annualOperatingHours, runTimeLoaded, efficiencyLoaded;
249  double efficiencyUnloaded, costOfElectricity;
250  };
251 
252 
253  class AirSystemCapacity {
254  public:
255  struct Output {
256  Output(const double totalPipeVolume, std::vector<double> receiverCapacities,
257  const double totalReceiverVol, const double totalCapacityOfCompressedAirSystem,
258  PipeData pipeLengths)
259  : totalPipeVolume(totalPipeVolume), totalReceiverVol(totalReceiverVol),
260  totalCapacityOfCompressedAirSystem(totalCapacityOfCompressedAirSystem),
261  receiverCapacities(std::move(receiverCapacities)), pipeLengths(pipeLengths)
262  {}
263 
264  const double totalPipeVolume, totalReceiverVol, totalCapacityOfCompressedAirSystem;
265  const std::vector<double> receiverCapacities;
266  const PipeData pipeLengths;
267  };
268 
275  AirSystemCapacity(PipeData pipeLengths, std::vector<double> gallons);
276 
277  Output calculate();
278 
279  private:
280  PipeData pipeLengths;
281  std::vector<double> receivers;
282  };
283 
284  class AirVelocity {
285  public:
296  AirVelocity(double airFlow, double pipePressure, double atmosphericPressure);
297 
298  Compressor::PipeData calculate();
299 
300  private:
301  double airFlow, pipePressure, atmosphericPressure;
302  };
303 
304  class PipeSizing {
305  public:
306  struct Output {
307  Output(const double crossSectionalArea, const double pipeDiameter)
308  : crossSectionalArea(crossSectionalArea), pipeDiameter(pipeDiameter)
309  {}
310  const double crossSectionalArea, pipeDiameter;
311  };
312 
322  PipeSizing(double airflow, double airlinePressure, double designVelocity, double atmosphericPressure);
323 
328  Output calculate();
329 
330  private:
331  double airflow, airlinePressure, designVelocity, atmosphericPressure;
332  };
333 
334  class PneumaticValve {
335  public:
341  PneumaticValve(double inletPressure, double outletPressure);
348  PneumaticValve(double inletPressure, double outletPressure, double flowRate);
349 
353  double calculate();
354 
355  private:
356  double inletPressure, outletPressure, flowRate;
357  bool flowRateKnown;
358  };
359 }
360 
361 class BagMethod {
362 public:
363  struct Output {
364  Output(const double flowRate, const double annualConsumption)
365  : flowRate(flowRate), annualConsumption(annualConsumption)
366  {}
367 
368  const double flowRate, annualConsumption;
369  };
370 
380  BagMethod(double operatingTime, double bagFillTime, double heightOfBag, double diameterOfBag, int numberOfUnits);
381 
385  Output calculate();
386 
387 private:
388  double operatingTime, bagFillTime, heightOfBag, diameterOfBag, numberOfUnits;
389 };
390 
391 // enum class CompressorType ???
392 
393 class EstimateMethod {
394  public:
395  struct Output {
396  Output(const double annualConsumption) : annualConsumption(annualConsumption)
397  {}
398 
399  const double annualConsumption;
400  };
401 
407  EstimateMethod(const double operatingTime, const double leakRateEstimate);
408 
412  Output calculate();
413 
414  private:
415  double operatingTime, leakRateEstimate;
416 };
417 
418 class DecibelsMethod {
419  public:
420  struct Output {
421  Output(const double leakRateEstimate, const double annualConsumption)
422  : leakRateEstimate(leakRateEstimate), annualConsumption(annualConsumption)
423  {}
424 
425  const double leakRateEstimate, annualConsumption;
426  };
427 
442  DecibelsMethod(const double operatingTime, const double linePressure, const double decibels, const double decibelRatingA,
443  const double pressureA, const double firstFlowA, const double secondFlowA, const double decibelRatingB, const double pressureB,
444  const double firstFlowB, const double secondFlowB);
445 
449  Output calculate();
450 
451  private:
452  double operatingTime;
453  double linePressure; // X
454  double decibels; // Y
455  double decibelRatingA; // Y1
456  double pressureA; // X1
457  double firstFlowA; // Q11
458  double secondFlowA; // Q21
459  double decibelRatingB; // Y2
460  double pressureB; // X2
461  double firstFlowB; // Q12
462  double secondFlowB; // Q22
463 };
464 
465 class OrificeMethod {
466  public:
467  struct Output {
468  Output(const double standardDensity, const double sonicDensity, const double leakVelocity, const double leakRateLBMmin,
469  const double leakRateScfm, const double leakRateEstimate, const double annualConsumption)
470  : standardDensity(standardDensity), sonicDensity(sonicDensity), leakVelocity(leakVelocity),
471  leakRateLBMmin(leakRateLBMmin), leakRateScfm(leakRateScfm), leakRateEstimate(leakRateEstimate),
472  annualConsumption(annualConsumption)
473  {}
474 
475  const double standardDensity, sonicDensity, leakVelocity, leakRateLBMmin, leakRateScfm, leakRateEstimate, annualConsumption;
476  };
477 
488  OrificeMethod(const double operatingTime, const double airTemp, const double atmPressure, const double dischargeCoef,
489  const double diameter, const double supplyPressure, const int numOrifices);
490 
494  Output calculate();
495 
496  private:
497  double operatingTime, airTemp, atmPressure, dischargeCoef, diameter, supplyPressure;
498  int numOrifices;
499 
500 };
501 
502 class AirLeakSurvey {
507  enum class MethodType
508  {
511  BagMethod,
513  };
514  /*
515  annualOperatingHours: number;
516  //
517  // leakDescription
518  // anualOperatingHours
519  // measurementMethod
520  // utilityType = 'electricity' or 'compressed air'
521  // utilityCost comes from TH setup but is editable input
522  // compressorControlType
523  // compressorType
524  leaks: Array<AirLeakSurveyData>;
525  */
526 };
527 
528 #endif //AMO_TOOLS_SUITE_COMPRESSEDAIR_H
static double calculateUsableCapacity(const double tankSize, const double airPressureIn, const double airPressureOut)
PipeData(std::function< double(const double)> const &compVel)
PipeData(const double oneHalf, const double threeFourths, const double one, const double oneAndOneFourth, const double oneAndOneHalf, const double two, const double twoAndOneHalf, const double three, const double threeAndOneHalf, const double four, const double five, const double six, const double eight, const double ten, const double twelve, const double fourteen, const double sixteen, const double eighteen, const double twenty, const double twentyFour)
Contains all the implementations of the various components of a compressed air system.
Definition: CompressedAir.h:17
Output(const double volumeAirIntakePiston, const double compressionRatio, const double airRequirementPneumaticCylinder)
Definition: CompressedAir.h:69