Git Product home page Git Product logo

ezs_charge_point_simulator's Introduction

Icon   MicroOcppSimulator

Build (Ubuntu) Build (Docker) Build (WebAssembly)

Tester / Demo App for the MicroOcpp Client, running on native Ubuntu, WSL, WebAssembly or MSYS2. Online demo: Try it

Screenshot

The Simulator has two purposes:

  • As a development tool, it allows to run MicroOcpp directly on the host computer and simplifies the development (no flashing of the microcontroller required)
  • As a demonstration tool, it allows backend operators to test and use MicroOcpp without the need to set up an actual microcontroller or to buy an actual charger with MicroOcpp.

That means that the Simulator runs on your computer and connects to an OCPP server using the same software like a microcontroller. It provides a Graphical User Interface to show the connection status and to trigger simulated charging sessions (and further simulated actions).

Running on Docker

The Simulator can be run on Docker. This is the easiest way to get it up and running. The Docker image is based on Ubuntu 20.04 and contains all necessary dependencies.

Firstly, build the image:

docker build -t matthx/microocppsimulator:latest .

Then run the image:

docker run -p 8000:8000 matthx/microocppsimulator:latest

The Simulator should be up and running now on localhost:8000.

Installation (Ubuntu or WSL)

On Windows, get the Windows Subsystem for Linux (WSL): https://ubuntu.com/wsl or MSYS2.

Then follow the same steps like for Ubuntu.

On Ubuntu (other distros probably work as well, tested on Ubuntu 20.04 and 22.04), install cmake, OpenSSL and the C++ compiler:

sudo apt install cmake libssl-dev build-essential

Navigate to the preferred installation directory or just to the home folder. Clone the Simulator and all submodules:

git clone --recurse-submodules https://github.com/matth-x/MicroOcppSimulator

Navigate to the copy of the Simulator and build:

cd MicroOcppSimulator
cmake -S . -B ./build
cmake --build ./build -j 16 --target mo_simulator

The installation is complete! To run the Simulator, type:

./build/mo_simulator

This will open localhost:8000. You can access the Graphical User Interface by entering that address into a browser running on the same computer. Make sure that the firewall settings allow the Simulator to connect and to be reached.

The Simulator should be up and running now!

Building the Webapp (Developers)

The webapp is registered as a git submodule in webapp-src.

Before you can build the webapp, you have to create a .env.production file in the webapp-src folder. If you just want to try out the build process, you can simply duplicate the .env.development file and rename it.

After that, to build it for deployment, all you have to do is run ./build-webapp/build_webapp.ps1 (Windows) from the root directory. For this to work NodeJS, npm and git have to be installed on your machine. The called script automatically performs the following tasks:

  • pull the newest version of the the arduino-ocpp-dashboard
  • check if you have added a .env.production file
  • install webapp dependencies
  • build the webapp
  • compress the webapp
  • move the g-zipped bundle file into the public folder

During the process there might be some warnings displayed. Als long as the script exits without an error everything worked fine. An up-to-date version of the webapp should be placed in the public folder.

Porting to WebAssembly (Developers)

If you want to run the Simulator in the browser instead of a Linux host, you can port the code for WebAssembly.

Make sure that emscripten is installed and on the path (see https://emscripten.org/docs/getting_started/downloads.html#installation-instructions-using-the-emsdk-recommended).

Then, create the CMake build files with the corresponding emscripten tool and change the target:

emcmake cmake -S . -B ./build
cmake --build ./build -j 16 --target mo_simulator_wasm

The compiler toolchain should emit the WebAssembly binary and a JavaScript wrapper into the build folder. They need to be built into the preact webapp. Instead of making XHR requests to the server, the webapp will call the API of the WebAssembly JS wrapper then. The install_webassembly.sh script patches the webapp sources with the WASM binary and JS wrapper:

./build-webapp/install_webassembly.sh

Now, the GUI can be developed or built as described in the webapp repository.

After building the GUI, the emited files contain the full Simulator functionality. To run the Simualtor, start an HTTP file server in the dist folder and access it with your browser.

License

This project is licensed under the GPL as it uses the Mongoose Embedded Networking Library. If you have a proprietary license of Mongoose, then the MIT License applies.

ezs_charge_point_simulator's People

Contributors

matth-x avatar agruenb avatar xobs avatar xblaz3kx avatar msqr avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.