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
OperatingCost.h
Go to the documentation of this file.
1
10#ifndef TOOLS_SUITE_OPERATINGCOST_H
11#define TOOLS_SUITE_OPERATINGCOST_H
12
13#include <cmath>
14#include <functional>
15#include <stdexcept>
16#include <vector>
17
19 public:
32 OperatingCost(double motorBhp, double bhpUnloaded, double annualOperatingHours, double runTimeLoaded,
33 double efficiencyLoaded, double efficiencyUnloaded, double costOfElectricity)
34 : motorBhp(motorBhp), bhpUnloaded(bhpUnloaded), annualOperatingHours(annualOperatingHours),
35 runTimeLoaded(runTimeLoaded), efficiencyLoaded(efficiencyLoaded), efficiencyUnloaded(efficiencyUnloaded),
36 costOfElectricity(costOfElectricity) {}
37
38 struct Output {
39 Output(const double runTimeUnloaded, const double costForLoaded, const double costForUnloaded,
40 const double totalAnnualCost)
41 : runTimeUnloaded(runTimeUnloaded), costForLoaded(costForLoaded), costForUnloaded(costForUnloaded),
42 totalAnnualCost(totalAnnualCost) {}
43
44 const double runTimeUnloaded, costForLoaded, costForUnloaded, totalAnnualCost;
45 };
46
47 Output calculate() {
48 auto const runTimeUnloaded = 100 - runTimeLoaded;
49 auto const costForLoaded =
50 (motorBhp * 0.746 * annualOperatingHours * costOfElectricity * (runTimeLoaded / 100)) /
51 (efficiencyLoaded / 100);
52 auto const costForUnloaded = (motorBhp * 0.746 * annualOperatingHours * costOfElectricity *
53 (bhpUnloaded / 100) * (runTimeUnloaded / 100)) /
54 (efficiencyUnloaded / 100);
55 return {runTimeUnloaded, costForLoaded, costForUnloaded, costForLoaded + costForUnloaded};
56 }
57
58 private:
59 double motorBhp, bhpUnloaded, annualOperatingHours, runTimeLoaded, efficiencyLoaded;
60 double efficiencyUnloaded, costOfElectricity;
61};
62
63#endif
OperatingCost(double motorBhp, double bhpUnloaded, double annualOperatingHours, double runTimeLoaded, double efficiencyLoaded, double efficiencyUnloaded, double costOfElectricity)