jcjhot / everest-core

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

everest-core

This is the main part of EVerest containing the actual charge controller logic included in a large set of modules.

All documentation and the issue tracking can be found in our main repository here: https://github.com/EVerest/everest

Prerequisites:

Hardware recommendations

It is recommended to have at least 4GB of RAM available to build EVerest. More CPU cores will optionally boost the build process, while requiring more RAM accordingly.

Ubuntu 20.04 & 22.04

sudo apt update
sudo apt install -y python3-pip git rsync wget cmake doxygen graphviz build-essential clang-tidy cppcheck openjdk-17-jdk npm docker docker-compose libboost-all-dev nodejs libssl-dev libsqlite3-dev clang-format curl rfkill libpcap-dev libevent-dev pkg-config libcap-dev
Ubuntu 20.04

In order to build EVerest, we need clang-format version greater than 11. To date apt does only install an older version, so we install version 12 manually:

sudo apt install clang-format-12

Then make Ubuntu use version 12:

sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-12 100

EVerest requires nodejs version >10.20 for node_api version 6+. as Ubuntu 20.4 only installs v10.19 including node_api version <6 by default we need to install a newer version.

Follow these instructions to install a newer version, minimum v12.

OpenSuse

zypper update && zypper install -y sudo shadow
zypper install -y --type pattern devel_basis
zypper install -y git rsync wget cmake doxygen graphviz clang-tools cppcheck boost-devel libboost_filesystem-devel libboost_log-devel libboost_program_options-devel libboost_system-devel libboost_thread-devel java-17-openjdk java-17-openjdk-devel nodejs nodejs-devel npm python3-pip gcc-c++ libopenssl-devel sqlite3-devel libpcap-devel libevent-devel libcap-devel

Fedora 37, 38 & 39

sudo dnf update
sudo dnf install make automake gcc gcc-c++ kernel-devel python3-pip python3-devel git rsync wget cmake doxygen graphviz clang-tools-extra cppcheck java-17-openjdk java-17-openjdk-devel boost-devel nodejs nodejs-devel npm openssl openssl-devel libsqlite3x-devel curl rfkill libpcap-devel libevent-devel libcap-devel

Build & Install:

It is required that you have uploaded your public ssh key to github.

To install the Everest Dependency Manager, follow these steps:

Install required python packages:

python3 -m pip install --upgrade pip setuptools wheel jstyleson jsonschema

Get EDM source files and change into the directory:

git clone git@github.com:EVerest/everest-dev-environment.git
cd everest-dev-environment/dependency_manager

Install EDM:

python3 -m pip install .

We need to add /home/USER/.local/bin and CPM_SOURCE_CACHE to $PATH:

export PATH=$PATH:/home/$(whoami)/.local/bin
export CPM_SOURCE_CACHE=$HOME/.cache/CPM

Now setup EVerest workspace:

cd everest-dev-environment/dependency_manager
edm init --workspace ~/checkout/everest-workspace

This sets up a workspace based on the most recent EVerest release. If you want to check out the most recent main you can use the following command:

cd everest-dev-environment/dependency_manager
edm init main --workspace ~/checkout/everest-workspace

Install ev-cli:

Change the directory and install ev-cli:

cd ~/checkout/everest-workspace/everest-utils/ev-dev-tools
python3 -m pip install .

Change the directory and install the required packages for ISO15118 communication:

cd ~/checkout/everest-workspace/Josev
python3 -m pip install -r requirements.txt

For ISO15118 communication including Plug&Charge you need to install the required CA certificates inside config/certs/ca and client certificates, private keys and password files inside config/certs/client. For an more seamless development experience, these are automatically generated for you, but you can set the ISO15118_2_GENERATE_AND_INSTALL_CERTIFICATES cmake option to OFF to disable this auto-generation for production use.

Now we can build EVerest!

mkdir -p ~/checkout/everest-workspace/everest-core/build
cd ~/checkout/everest-workspace/everest-core/build
cmake ..
make install

(Optional) In case you have more than one CPU core and more RAM availble you can use the following command to significantly speed up the build process:

make -j$(nproc) install

$(nproc) puts out the core count of your machine, so it is using all available CPU cores! You can also specify any number of CPU cores you like.

Done!

Simulation

In order to test your build of Everest you can simulate the code on your local machine! Check out the different configuration files to run EVerest and the corresponding nodered flows in the config folder.

Check out this guide for using EVerest SIL

Troubleshoot

1. Problem: "make install" fails with complaining about missing header files.

Cause: Most probably your clang-format version is older than 11 and ev-cli is not able to generate the header files during the build process.

Solution: Install newer clang-format version and make Ubuntu using the new version e.g.:

sudo apt install clang-format-12
sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-12 100

Verify clang-format version:

clang-format --version
Ubuntu clang-format version 12.0.0-3ubuntu1~20.04.4

To retry building EVerest delete the entire everest-core/build folder and recreate it. Start building EVerest using cmake .. and make install again.

2. Problem: Build speed is very slow.

Cause: cmake and make are only utilizing one CPU core.

Solution: use

cmake -j$(nproc) .. 

and

make -j$(nproc) install

to use all available CPU cores. Be aware that this will need roughly an additional 1-2GB of RAM per core. Alternatively you can also use any number between 2 and your maximum core count instead of $(nproc).

About

License:Apache License 2.0


Languages

Language:C++ 83.7%Language:Python 3.9%Language:CMake 3.8%Language:JavaScript 3.1%Language:Rust 3.0%Language:C 1.8%Language:Starlark 0.6%Language:Shell 0.2%Language:Dockerfile 0.0%