diff --git a/coincells.cpp b/coincells.cpp index e7c45851b9ed7df52b586aba43df44e4b425aa6c..f89d8f8d9ae9b661ac702b2a48e22e4da50869a4 100644 --- a/coincells.cpp +++ b/coincells.cpp @@ -6,26 +6,50 @@ std::vector<std::unique_ptr<CoinCell>> asign_coincells(std::vector<uint16_t> cel { CoinCell cell(heaters, multiplexers, 0, {3}); std::vector<std::unique_ptr<CoinCell>> coinCells; + + /* Cell distrobution: + * Shelf 0: 0 1 2 3 | 4 5 6 + * Shelf 1: 7 8 9 10 | 11 12 13 + * Shelf 2: 14 15 16 17 | 18 19 20 + * + * Groups: + * Shelf 0: 0 | 1 + * Shelf 1: 2 | 3 + * Shelf 2: 4 | 5 + */ + + // Shelf 0 + // Group 0 coinCells.push_back(std::make_unique<CoinCell>(heaters, multiplexers, 0, std::vector<int>({3, 10}))); coinCells.push_back(std::make_unique<CoinCell>(heaters, multiplexers, 1, std::vector<int>({2, 9}))); coinCells.push_back(std::make_unique<CoinCell>(heaters, multiplexers, 2, std::vector<int>({1, 8}))); coinCells.push_back(std::make_unique<CoinCell>(heaters, multiplexers, 3, std::vector<int>({0, 7}))); + + // Group 1 coinCells.push_back(std::make_unique<CoinCell>(heaters, multiplexers, 4, std::vector<int>({6, 13}))); coinCells.push_back(std::make_unique<CoinCell>(heaters, multiplexers, 5, std::vector<int>({5, 12}))); coinCells.push_back(std::make_unique<CoinCell>(heaters, multiplexers, 6, std::vector<int>({4, 11}))); + // Shelf 1 + // Group 2 coinCells.push_back(std::make_unique<CoinCell>(heaters, multiplexers, 8, std::vector<int>({24, 17}))); coinCells.push_back(std::make_unique<CoinCell>(heaters, multiplexers, 9, std::vector<int>({23, 16}))); coinCells.push_back(std::make_unique<CoinCell>(heaters, multiplexers, 10, std::vector<int>({22, 15}))); coinCells.push_back(std::make_unique<CoinCell>(heaters, multiplexers, 11, std::vector<int>({21, 14}))); + + // Group 3 coinCells.push_back(std::make_unique<CoinCell>(heaters, multiplexers, 12, std::vector<int>({27, 20}))); coinCells.push_back(std::make_unique<CoinCell>(heaters, multiplexers, 13, std::vector<int>({26, 19}))); coinCells.push_back(std::make_unique<CoinCell>(heaters, multiplexers, 14, std::vector<int>({25, 18}))); + // Shelf 2 + // Group 4 coinCells.push_back(std::make_unique<CoinCell>(heaters, multiplexers, 16, std::vector<int>({31}))); coinCells.push_back(std::make_unique<CoinCell>(heaters, multiplexers, 17, std::vector<int>({30}))); coinCells.push_back(std::make_unique<CoinCell>(heaters, multiplexers, 18, std::vector<int>({29}))); coinCells.push_back(std::make_unique<CoinCell>(heaters, multiplexers, 19, std::vector<int>({28}))); + + // Group 5 coinCells.push_back(std::make_unique<CoinCell>(heaters, multiplexers, 20, std::vector<int>({34}))); coinCells.push_back(std::make_unique<CoinCell>(heaters, multiplexers, 21, std::vector<int>({33}))); coinCells.push_back(std::make_unique<CoinCell>(heaters, multiplexers, 22, std::vector<int>({32}))); diff --git a/expirament.cpp b/expirament.cpp index acce335674194d25f88f487aea45e5c91d4b1fe0..3cee48c51149d724c2ba714226167f53b1db9c29 100644 --- a/expirament.cpp +++ b/expirament.cpp @@ -13,6 +13,13 @@ #include <thread> #include <fstream> + +/* Cell distrobution: + * 0 1 2 3 | 4 5 6 + * 7 8 9 10 | 11 12 13 + * 14 15 16 17 | 18 19 20 + */ + Expirament::Expirament(std::vector<std::unique_ptr<CoinCell>>* coinCellsIn, Vcpps* psuIn, float voltageIn, float currentIn, Heaters* heatersIn, Multiplexers* multiplexersIn, BioControl* biocontrolIn, const std::filesystem::path& outdirIn, const std::filesystem::path& stepfileIn): @@ -179,7 +186,7 @@ bool Expirament::thermalCycle(size_t count, size_t start) { bool ret = true; - for(size_t i = 0; i < count; ++i) + for(size_t i = start; i < count; ++i) { Log(Log::INFO)<<"Cycle "<<i<<" for globalsetp "<<globalstep; saveStep(i); @@ -232,19 +239,22 @@ void Expirament::setTemperatures(float fraction) switch(i) { case 0 ... 3: - coinCells->at(i)->setTemperature(35+25*fraction); + coinCells->at(i)->setTemperature(35+20*fraction); break; - case 4 ... 7: - coinCells->at(i)->setTemperature(35+25*fraction); + case 4 ... 6: + coinCells->at(i)->setTemperature(35+20*fraction); break; - case 8 ... 11: + case 7 ... 10: coinCells->at(i)->setTemperature(35+10*fraction); break; - case 12 ... 15: - coinCells->at(i)->setTemperature(60); + case 11 ... 13: + coinCells->at(i)->setTemperature(35+10*fraction); break; - case 16 ... 19: - coinCells->at(i)->setTemperature(45); + case 14 ... 17: + coinCells->at(i)->setTemperature(55); + break; + case 18 ... 20: + coinCells->at(i)->setTemperature(35); break; default: break; @@ -275,8 +285,8 @@ bool Expirament::charge(float fraction, bool all) switch(i) { case 0 ... 3: - case 12 ... 15: - case 16 ... 19: + case 7 ... 10: + case 14 ... 17: { bool ret = coinCells->at(i)->setConnected(true); if(!ret) @@ -340,8 +350,8 @@ bool Expirament::capacityMesureCycle() switch(i) { case 0 ... 3: - case 12 ... 15: - case 16 ... 19: + case 7 ... 10: + case 14 ... 17: ret = chargeCellToVoltage(i, coinCells->at(i)->getFullVoltage(), "single_cell_charge_"+std::to_string(getGlobalstep())+"_"); if(!ret) @@ -350,7 +360,7 @@ bool Expirament::capacityMesureCycle() "single_cell_discharge_"+std::to_string(getGlobalstep())+"_"); if(!ret) return ret; - break; + break; default: break; } diff --git a/expirament.h b/expirament.h index a361d14966c6465f309f596f4371b8165709ba48..a09ff76bf7d960c13658dfa94baa3379bb7d4628 100644 --- a/expirament.h +++ b/expirament.h @@ -12,7 +12,7 @@ class Expirament { private: static constexpr size_t MAX_LOOP = 100; - static constexpr size_t STEP_COUNT = 11; + static constexpr size_t STEP_COUNT = 12; std::vector<std::unique_ptr<CoinCell>>* coinCells; Vcpps* psu; diff --git a/expiramentimpl.h b/expiramentimpl.h index bdf6ddcce4f85898b10590dbcb754ed071769109..474e43bb1d8b8e78486787ce8c89474cb1cac05e 100644 --- a/expiramentimpl.h +++ b/expiramentimpl.h @@ -14,7 +14,7 @@ bool Expirament::step(size_t startsubstep) saveStep(startsubstep); std::vector<double> steps = createStepSequence(3, 2, 0, 1); - std::vector<double> chargeThermalSteps(5); + std::vector<double> chargeThermalSteps(6); std::for_each(chargeThermalSteps.begin(), chargeThermalSteps.end(), [](double& in){in = rd::rand(1, 0);}); bool ret = true; @@ -100,6 +100,31 @@ bool Expirament::step(size_t startsubstep) case 10: ret = thermalCycle(CYCLES_PER_STEP, startsubstep); break; + case 11: + Log(Log::INFO)<<"Starting multi Charing for globalstep "<<globalstep<<" will be executed at "<<chargeThermalSteps[5]<<" temperature"; + setTemperatures(chargeThermalSteps[5]); + ret = heaters->allReady(); + if(!ret) + { + Log(Log::ERROR)<<"Not all heaters moved to ready state in globalstep"<<globalstep; + break; + } + for(size_t i = 0; i < CYCLES_PER_STEP; ++i) + { + ret = charge(1); + if(!ret) + { + Log(Log::ERROR)<<"Unable to charge in "<<globalstep; + break; + } + ret = charge(0); + if(!ret) + { + Log(Log::ERROR)<<"Unable to discharge in "<<globalstep; + break; + } + } + break; break; default: Log(Log::ERROR)<<"Unkown step "<<(globalstep % STEP_COUNT)<<'\n';