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
CurveFitVal.h
1 
12 #ifndef AMO_LIBRARY_CURVEFITVAL_H
13 #define AMO_LIBRARY_CURVEFITVAL_H
14 
15 #include <vector>
16 #include <exception>
17 #include <stdexcept>
18 
19 class CurveFitVal {
20 public:
29  std::vector<double> xcoord,
30  std::vector<double> ycoord,
31  const std::size_t pdegree,
32  const double loadFactor = 0
33  ) :
34  pdegree(pdegree),
35  xcoord(std::move(xcoord)),
36  ycoord(std::move(ycoord)),
37  loadFactor(loadFactor)
38  {
39  if (this->xcoord.size() != this->ycoord.size()) {
40  throw std::runtime_error("X and Y coordinate vectors must be the same size");
41  }
42 
43  coeff = Fit_Coefficients();
44  }
45 
50  double calculate() const;
51  double calculate(double) const;
52 
53 private:
57  std::size_t pdegree;
61  std::vector<double> xcoord, ycoord;
65  double loadFactor;
66 
70  std::vector<double> coeff;
71  std::vector<double> Fit_Coefficients();
72 };
73 
74 
75 #endif //AMO_LIBRARY_CURVEFITVAL_H
Curve Fit class.
Definition: CurveFitVal.h:19
CurveFitVal(std::vector< double > xcoord, std::vector< double > ycoord, const std::size_t pdegree, const double loadFactor=0)
Definition: CurveFitVal.h:28
double calculate() const
Contains the definition of functions of CurveFitVal class. calculate(): Calculates the curve fit valu...
Definition: CurveFitVal.cpp:23