Skip to content

Commit

Permalink
Ascii plots now use bars (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
mj-xmr committed Jul 30, 2022
1 parent d78aed3 commit efa015b
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 78 deletions.
2 changes: 1 addition & 1 deletion src/opti-lib/src/OptiEnProfitSubject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;}
}
}
}
Expand Down
57 changes: 0 additions & 57 deletions src/opti-lib/src/SolUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
3 changes: 0 additions & 3 deletions src/opti-lib/src/SolUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
17 changes: 0 additions & 17 deletions tests/opti-test/src/SolUtilTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}


0 comments on commit efa015b

Please sign in to comment.