Giter VIP home page Giter VIP logo

hackaton-2021's Introduction

OCPP 1.6 Central System and ChargePoint Emulator

Install

  1. Download Node.js. You can use

  2. Goto root folder of repo (where packages.json file is present) and install required NPM packages with:

npm install

To start server

Open shell in root folder and start server

npm run start-server

To start client

Open shell in root folder and start server

npm run start-client

Start under docker

Attached Dockerfile demonstrates procedure for starting node application with docker. Important point is to install packages with node package manager (npm), copy source file over and then use custom scripts defined inside package.json to start node via npm.

Another approach can be used if you like.

Some general info on inner flow

Server

  1. Servers accepts client conections and upgrades them to websocket protocol
  2. It responds to various OCPP messages
  3. Ocasionally it send PING / PONG to determine which clients are still alive

Client

  1. When client connects with websocket, it sends boot notification.
  2. After response is recevied, it reads heartbeat interval from it
  3. it send heartbeat message according to interval

Environment variables

Environment variables that client script uses

  1. CS_PROTOCOL defaults to ws. possible values are: ws, wss (for SSL)
  2. CS_HOST defaults to localhost. host to connect to
  3. CS_PORT defaults to 8080. port to connect to
  4. CONCURRENCY_LEVEL defaults to 1. Number of clients to create
  5. LOG_PAYLOAD verbose logging of data exchange between client and server
  6. LOG_LIFECYCLE = log lifecyle events (connect, reconnect, pingpong)

Environment variables that server script uses

  1. WEB_SRV_HOST interface to bind to (could be only one)
  2. WEB_SRV_PORT port on bind interface
  3. HEARTBEAT_INT_MS interval in which we check client if its still connected
  4. LOG_PAYLOAD verbose logging of data exchange between client and server
  5. LOG_LIFECYCLE = log lifecyle events (connect, reconnect, pingpong)

Debugging

Manually start server

node ocpp-central-cystem-server.js

Manually start client

node ocpp-chargepoint-client.js

Debug with debugger

  1. Install extension for debugging in chrome browser

Node.js V8 --inspector Manager (NiM]

  1. Start NiM extension in Chrome:

Open about://inspect in a new tab

  1. Start node script with inspect enabled.
node --inspect-brk ocpp-chargepoint-client.js
  1. After a few seconds you should see Target upgradeServer.js on your chrome tab. Click on inspect link and new DevTools window will appear with source code.

hackaton-2021's People

Contributors

etrel-development avatar alespermeetrel avatar

Stargazers

Mitja Guštin avatar

Watchers

 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.