diff --git a/coincell.cpp b/coincell.cpp index d600e7096add771c735b4aacade996560ac76d3c..127a96552a5f4d2e81e0166250bbcdf6cd052baf 100644 --- a/coincell.cpp +++ b/coincell.cpp @@ -105,5 +105,15 @@ bool CoinCell::setEnabled(bool enable) return heaters->setHeaterEnabled(heaterId, enable); } +double CoinCell::getFullVoltage() +{ + return 4.2; +} + +double CoinCell::getEmptyVoltage() +{ + return 3.0; +} + BioControl CoinCell::biocontrol; diff --git a/coincell.h b/coincell.h index c52e7696e49ba8ca736318a8f868669e65467ada..00be691c02442de8b041a34a9add2678f1ec60ee 100644 --- a/coincell.h +++ b/coincell.h @@ -37,6 +37,8 @@ public: bool setEnabled(bool enable); double getLastKnownCapacity(); void setLastKnownCapacity(double cap); + double getFullVoltage(); + double getEmptyVoltage(); static void setBiocontrol(const BioControl& biocontrol); }; diff --git a/expirament.cpp b/expirament.cpp index a30def72b6dbec580add0e2ebdf99fe9cdfbe031..8e59c0a4fe45fc852b52833df57a57b78957b21e 100644 --- a/expirament.cpp +++ b/expirament.cpp @@ -307,11 +307,11 @@ bool Expirament::charge(float fraction, bool all) return ret; } -bool Expirament::chargeCellToVoltage(int id, float voltage) +bool Expirament::chargeCellToVoltage(int id, float voltage, const std::string& prefix) { 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; ret = coinCells->at(id)->connectExclusive(); if(!ret) @@ -332,6 +332,32 @@ bool Expirament::chargeCellToVoltage(int id, float voltage) 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() { Log(Log::INFO)<<"Runnin startup sequence"; @@ -373,7 +399,7 @@ bool Expirament::startup() 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"; - ret = chargeCellToVoltage(i, leadOcv); + ret = chargeCellToVoltage(i, leadOcv, "voltage_equlaization_"); if(!ret) { Log(Log::ERROR)<<"Unable to equalize cell "<<i; diff --git a/expirament.h b/expirament.h index 86c5af0225725e587a9aefb7a4ea693df7ef74e1..a361d14966c6465f309f596f4371b8165709ba48 100644 --- a/expirament.h +++ b/expirament.h @@ -39,10 +39,12 @@ private: 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); + bool capacityMesureCycle(); + 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); diff --git a/expiramentimpl.h b/expiramentimpl.h index 1592f9965409a2192c6ac08fa14ae1dcb3910e7c..bdf6ddcce4f85898b10590dbcb754ed071769109 100644 --- a/expiramentimpl.h +++ b/expiramentimpl.h @@ -21,7 +21,14 @@ bool Expirament::step(size_t startsubstep) switch(globalstep % STEP_COUNT) { case 0: - ret = thermalCycle(CYCLES_PER_STEP, startsubstep); + if((globalstep/STEP_COUNT) == 20) + { + ret = capacityMesureCycle(); + } + else + { + ret = thermalCycle(CYCLES_PER_STEP, startsubstep); + } break; case 1: Log(Log::INFO)<<"Charing for globalstep "<<globalstep<<" will be executed at "<<chargeThermalSteps[0]<<" temperature";