Battery-Intelligence-Lab / SLIDE

SLIDE is C++ code that simulates degradation of lithium ion cells. It extends the single particle model with various degradation models from literature. Users can select which degradation models they want to use for a given simulation.
Other
107 stars 35 forks source link

update csv file capitalization #7

Closed okyang closed 2 years ago

okyang commented 2 years ago

Hi,

I ran into an error when running the code.

Inked241044695_546011419955858_5437992778651841201_n_LI

This was the problem: in load_CSV_mat function calls in src/Model.cpp was referring the the Cheb*.csv files, but it was a lowercase cheb*.csv. I changed it to all start with a capitalized C.

Great project btw 🙂

ElektrikAkar commented 2 years ago

Hi Owen,

Thank you so much for engaging with SLIDE! We were aware of this bug and it was solved in the develop branch. Since there are also some changes in the file structure, I pulled the version in the develop branch. The new version also comes with some speed improvements. Could you check if this solves your problem? Thank you very much again :)

Volkan

okyang commented 2 years ago

@ElektrikAkar I pulled from master and followed the instructions from the SLIDE Documentation - Installation. Ran into some issues after running cmake --build .

I copied the error messages in https://pastebin.com/cDrhGv8U

OS: Ubuntu 18.04 LTS on WSL cmake version: 3.10.2 gcc version: 8.4.0

Would you like me to submit an issue?

ElektrikAkar commented 2 years ago

Hi Owen,

Thank you for letting us know! I could reproduce the error you encountered. It is caused by some filesystem library requirements, as discussed here.

So you need to link -lstdc++fs library. In addition to this library on WSL you probably also need -lpthread. Then, you should be able to run it with g++-8.

To add this library link you could try changing CMakeLists.txt by

nano ../CMakeLists.txt # Assuming that you are still in build folder. 

And change the line

TARGET_LINK_LIBRARIES(slide)

with

TARGET_LINK_LIBRARIES(slide "-lstdc++fs" "-lpthread")

then it should work. To save yourself from dependency of -lstdc++fs you may also upgrade your GCC version to GCC 9 (or preferably 10). By following tutorial here

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-10 g++-10
export CXX=/usr/bin/g++-10

Of course, when building the code again, it is better to have a clean build (or delete files in the build folder).

Could you try these solutions and let me know? If it works, you (or I) can create an issue this to be solved in future versions. However, since this affects other platforms, I cannot directly push this change into the repository without necessary checks.

okyang commented 2 years ago

Hi Volkan,

Thanks for the instructions, it works 🎉. Adding the line TARGET_LINK_LIBRARIES(slide "-lstdc++fs" "-lpthread") in CMakeLists.txt was the solution that helped it work.

ElektrikAkar commented 2 years ago

Glad to hear that it worked! Then I am happily closing this issue and you are welcome to open another issue if you face any further problems :)