Skip to content
Snippets Groups Projects
Commit c0cbda92 authored by Carl Philipp Klemm's avatar Carl Philipp Klemm
Browse files

add capacy mesure cycle

parent 5ef32fc1
No related branches found
No related tags found
No related merge requests found
...@@ -105,5 +105,15 @@ bool CoinCell::setEnabled(bool enable) ...@@ -105,5 +105,15 @@ bool CoinCell::setEnabled(bool enable)
return heaters->setHeaterEnabled(heaterId, enable); return heaters->setHeaterEnabled(heaterId, enable);
} }
double CoinCell::getFullVoltage()
{
return 4.2;
}
double CoinCell::getEmptyVoltage()
{
return 3.0;
}
BioControl CoinCell::biocontrol; BioControl CoinCell::biocontrol;
...@@ -37,6 +37,8 @@ public: ...@@ -37,6 +37,8 @@ public:
bool setEnabled(bool enable); bool setEnabled(bool enable);
double getLastKnownCapacity(); double getLastKnownCapacity();
void setLastKnownCapacity(double cap); void setLastKnownCapacity(double cap);
double getFullVoltage();
double getEmptyVoltage();
static void setBiocontrol(const BioControl& biocontrol); static void setBiocontrol(const BioControl& biocontrol);
}; };
...@@ -307,11 +307,11 @@ bool Expirament::charge(float fraction, bool all) ...@@ -307,11 +307,11 @@ bool Expirament::charge(float fraction, bool all)
return ret; return ret;
} }
bool Expirament::chargeCellToVoltage(int id, float voltage) bool Expirament::chargeCellToVoltage(int id, float voltage, const std::string& prefix)
{ {
bool ret; bool ret;
std::string filename = "voltage_equalization_"+std::to_string(id)+".csv"; std::string filename = prefix+std::to_string(id)+".csv";
std::filesystem::path path = outdir/filename; std::filesystem::path path = outdir/filename;
ret = coinCells->at(id)->connectExclusive(); ret = coinCells->at(id)->connectExclusive();
if(!ret) if(!ret)
...@@ -332,6 +332,32 @@ bool Expirament::chargeCellToVoltage(int id, float voltage) ...@@ -332,6 +332,32 @@ bool Expirament::chargeCellToVoltage(int id, float voltage)
return ret; return ret;
} }
bool Expirament::capacityMesureCycle()
{
bool ret = true;
for(size_t i = 0; i < coinCells->size(); ++i)
{
switch(i)
{
case 0 ... 3:
case 12 ... 15:
case 16 ... 19:
ret = chargeCellToVoltage(i, coinCells->at(i)->getFullVoltage(),
"single_cell_charge_"+std::to_string(getGlobalstep())+"_");
if(!ret)
return ret;
ret = chargeCellToVoltage(i, coinCells->at(i)->getEmptyVoltage(),
"single_cell_discharge_"+std::to_string(getGlobalstep())+"_");
if(!ret)
return ret;
break;
default:
break;
}
}
return ret;
}
bool Expirament::startup() bool Expirament::startup()
{ {
Log(Log::INFO)<<"Runnin startup sequence"; Log(Log::INFO)<<"Runnin startup sequence";
...@@ -373,7 +399,7 @@ bool Expirament::startup() ...@@ -373,7 +399,7 @@ bool Expirament::startup()
else if(std::abs(leadOcv - ocv) > 0.2) else if(std::abs(leadOcv - ocv) > 0.2)
{ {
Log(Log::WARN)<<"Cell "<<i<<" has a voltage delta of "<<std::abs(leadOcv - ocv)<<" compeared to Cell 0, cell equalization needed"; Log(Log::WARN)<<"Cell "<<i<<" has a voltage delta of "<<std::abs(leadOcv - ocv)<<" compeared to Cell 0, cell equalization needed";
ret = chargeCellToVoltage(i, leadOcv); ret = chargeCellToVoltage(i, leadOcv, "voltage_equlaization_");
if(!ret) if(!ret)
{ {
Log(Log::ERROR)<<"Unable to equalize cell "<<i; Log(Log::ERROR)<<"Unable to equalize cell "<<i;
......
...@@ -39,10 +39,12 @@ private: ...@@ -39,10 +39,12 @@ private:
bool charge(float fraction, bool all = false); bool charge(float fraction, bool all = false);
bool chargeCellToVoltage(int id, float voltage); bool chargeCellToVoltage(int id, float voltage, const std::string& prefix);
void saveStep(size_t substep = 0); void saveStep(size_t substep = 0);
bool capacityMesureCycle();
std::filesystem::path createCsvPath(const std::filesystem::path& filename); std::filesystem::path createCsvPath(const std::filesystem::path& filename);
static std::vector<double> createStepSequence(size_t upSteps, size_t downSteps, double low = 0, double high = 1); static std::vector<double> createStepSequence(size_t upSteps, size_t downSteps, double low = 0, double high = 1);
......
...@@ -21,7 +21,14 @@ bool Expirament::step(size_t startsubstep) ...@@ -21,7 +21,14 @@ bool Expirament::step(size_t startsubstep)
switch(globalstep % STEP_COUNT) switch(globalstep % STEP_COUNT)
{ {
case 0: case 0:
if((globalstep/STEP_COUNT) == 20)
{
ret = capacityMesureCycle();
}
else
{
ret = thermalCycle(CYCLES_PER_STEP, startsubstep); ret = thermalCycle(CYCLES_PER_STEP, startsubstep);
}
break; break;
case 1: case 1:
Log(Log::INFO)<<"Charing for globalstep "<<globalstep<<" will be executed at "<<chargeThermalSteps[0]<<" temperature"; Log(Log::INFO)<<"Charing for globalstep "<<globalstep<<" will be executed at "<<chargeThermalSteps[0]<<" temperature";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment