diff --git a/src/opti-lib/src/OptiEnProfitSubject.cpp b/src/opti-lib/src/OptiEnProfitSubject.cpp index 9cf2aad..9584639 100644 --- a/src/opti-lib/src/OptiEnProfitSubject.cpp +++ b/src/opti-lib/src/OptiEnProfitSubject.cpp @@ -280,7 +280,7 @@ double OptiSubjectEnProfit::GetVerbose(const EnjoLib::Matrix & dataMat, bool ver GnuplotPlotTerminal1d(prod, "Energy production", 1, 0.5); //GnuplotPlotTerminal1d(hashrateBonus, "Bashrate bonus seasonal", 1, 0.5); - {LOGL << "Bat charge:\n" << SolUtil().GetPercentToAscii(m_loads, m_dataModel.GetBatPars().MIN_LOAD_AMPH, batteryCopy.m_maxCapacityAmph) << Nl;} + {LOGL << "Bat charge:\n" << ToolsMixed().GetPercentToAscii(m_loads, m_dataModel.GetBatPars().MIN_LOAD_AMPH, batteryCopy.m_maxCapacityAmph) << Nl;} } } } diff --git a/src/opti-lib/src/SolUtil.cpp b/src/opti-lib/src/SolUtil.cpp index 3c0ecd9..ddde080 100644 --- a/src/opti-lib/src/SolUtil.cpp +++ b/src/opti-lib/src/SolUtil.cpp @@ -11,60 +11,3 @@ using namespace EnjoLib; SolUtil::SolUtil(){} SolUtil::~SolUtil(){} - -EnjoLib::Str SolUtil::GetPercentToAscii(double val, double minimum, double maximum) -{ - Assertions::IsTrue(maximum > minimum, "maximum < minimum GetPercentToAscii"); - const double diff = maximum - minimum; - Assertions::IsNonZero(diff, "diff GetPercentToAscii"); - const double pro = (val - minimum) / diff; - //LOGL << pro << Nl; - EnjoLib::Str ret = "1"; - - if (pro < 0) - { - ret = " "; - } - else if (0 <= pro && pro < 0.1) - { - ret = "_"; - } - else if (0.1 <= pro && pro < 0.3) - { - ret = "."; - } - else if (0.3 <= pro && pro < 0.5) - { - ret = "░"; - } - else if (0.5 <= pro && pro < 0.7) - { - ret = "▒"; - } - else if (0.7 <= pro && pro < 1) - { - ret = "▓"; - } - else - { - ret = "█"; - } - return ret; -} -EnjoLib::Str SolUtil::GetPercentToAscii(const EnjoLib::VecD & vals, double minimum, double maximum, bool decoration) -{ - EnjoLib::Osstream oss; - if (decoration) - { - oss << "├ "; - } - for (const double val : vals) - { - oss << GetPercentToAscii(val, minimum, maximum); - } - if (decoration) - { - oss << " ┤"; - } - return oss.str(); -} \ No newline at end of file diff --git a/src/opti-lib/src/SolUtil.h b/src/opti-lib/src/SolUtil.h index f3df28e..0c772b9 100644 --- a/src/opti-lib/src/SolUtil.h +++ b/src/opti-lib/src/SolUtil.h @@ -10,9 +10,6 @@ class SolUtil public: SolUtil(); virtual ~SolUtil(); - - EnjoLib::Str GetPercentToAscii(double val, double minimum = 0, double maximum = 1); - EnjoLib::Str GetPercentToAscii(const EnjoLib::VecD & val, double minimum = 0, double maximum = 1, bool decoration = false); protected: diff --git a/tests/opti-test/src/SolUtilTest.cpp b/tests/opti-test/src/SolUtilTest.cpp index d704e2c..616e4c5 100644 --- a/tests/opti-test/src/SolUtilTest.cpp +++ b/tests/opti-test/src/SolUtilTest.cpp @@ -5,21 +5,4 @@ using namespace EnjoLib; -TEST(SolUtil_values_to_ascii1) -{ - const double minimum = 0; - const double maximum = 10; - VecD inp; - for (int i = 1; i >= -2; --i) - { - inp.Add(i); - } - for (int i = 0; i <= 12; ++i) - { - inp.Add(i); - } - SolUtil().GetPercentToAscii(inp, minimum, maximum); - LOGL << "values_to_ascii1:" << Nl << SolUtil().GetPercentToAscii(inp, minimum, maximum) << Nl; -} -