Skip to content

Commit 9ed54c2

Browse files
authored
Update Cycler.cpp
Made Cycler compatible with Linux
1 parent d0d39f2 commit 9ed54c2

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

src/Cycler.cpp

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,14 @@ double Cycler::checkUp_batteryStates(bool blockDegradation, bool checkCap, int c
405405
// Write the results to the csv file
406406
if(verbose >= printCyclerHighLevel)
407407
cout<<"Cycler::checkUp_batteryStates is writing the capacity to the csv file"<<endl;
408-
string fullName = ".\\"+ID+"\\"+nameState; // we want to write the file in a subfolder, so append the name of the subfolder before the name of the csv file
408+
// We want to write the file in the subfolder of this cell, but Windows and Linux use the opposite subfolder separation symbol
409+
string fol;
410+
#ifdef _WIN32
411+
fol = ".\\"+ID+"\\"; // Windows: parent\child
412+
#elif defined __linux__
413+
fol = "./"+ID+"/"; // Linux: parent/child
414+
#endif
415+
string fullName = fol+nameState; // we want to write the file in a subfolder, so append the name of the subfolder before the name of the csv file
409416
ofstream output(fullName,std::ios_base::app); // open the csv file and append the new data after the already existing data
410417
if (output.is_open()){
411418
output<<cumCycle<<","<<cumTime<<","<<cumAh<<","<<cumWh; // write the data points for where the cell is in it's life
@@ -490,7 +497,14 @@ void Cycler::checkUp_OCVcurves(bool blockDegradation, double ocvpini, double ocv
490497
// Write the curves to the csv file
491498
if(verbose >= printCyclerHighLevel)
492499
cout<<"Cycler::checkUp_OCVcurves is writing the OCV curves to a csv file"<<endl;
493-
string fullName = ".\\"+ID+"\\"+nameOCV; // we want to write the file in a subfolder, so append the name of the subfolder before the name of the csv file
500+
// We want to write the file in the subfolder of this cell, but Windows and Linux use the opposite subfolder separation symbol
501+
string fol;
502+
#ifdef _WIN32
503+
fol = ".\\"+ID+"\\"; // Windows: parent\child
504+
#elif defined __linux__
505+
fol = "./"+ID+"/"; // Linux: parent/child
506+
#endif
507+
string fullName = fol+nameOCV; // we want to write the file in a subfolder, so append the name of the subfolder before the name of the csv file
494508
ofstream output(fullName,std::ios_base::app); // open the csv file and append the new data after the already existing data
495509
if (output.is_open()){
496510

0 commit comments

Comments
 (0)