knowgoio / knowgo-vehicle-simulator

An interactive multi-platform Connected Car simulator for generating and streaming realistic vehicle telemetry.
https://knowgoio.github.io/knowgo-vehicle-simulator/docs
MIT License
33 stars 7 forks source link
connected-car digital-twin flutter-app flutter-desktop flutter-mac flutter-web flutter-windows iso20078 knowgo sae-j3016 simulation-model vehicle-dynamics vehicle-simulator

KnowGo Vehicle Simulator Logo

knowgo-vehicle-simulator

Build Status GitHub issues GitHub GitHub release (latest by date) knowgo-vehicle-simulator DOI

An interactive multi-platform Connected Car simulator for generating and streaming realistic vehicle telemetry.

Overview

knowgo-vehicle-simulator has been developed to aid in the development and validation of data-driven Connected Car services and models that require easy access to realistic synthetic driving data, both for static and streaming applications. It was originally designed for generating event records for the KnowGo Car platform, but has been generalized so that it may be useful both to Connected Car service developers and researchers.

The vehicle simulator generates a single unique vehicle, which can be controlled either directly through the UI or through an optional REST API. This may be further interfaced with OEM-specific external data sources and models in order to permit the simulation state to act as an automotive digital twin. For fleet simulation workloads, multiple instances of the simulator may be run in parallel, with each generated vehicle being manually joined to a specified fleet.

Live Demo

A live demonstration of the Simulator is available here.

Installation

Installation from a binary release is recommended. Regular releases are made to various app stores, please refer to the one appropriate for your platform:

Get it from the Snap Store Get it from Microsoft Get it on Google Play

Releases can also be obtained directly from GitHub.

Deployment

For deployment of a self-contained web-based instance of the simulator, a number of deployment options have been provided:

Docker

Multi-arch images are provided under knowgo/knowgo-vehicle-simulator. The image can be run directly as:

$ docker run -p 8086:8086 knowgo/knowgo-vehicle-simulator

Kubernetes

To create a Kubernetes Deployment including a single instance of the simulator:

$ kubectl apply -f https://raw.githubusercontent.com/knowgoio/knowgo-vehicle-simulator/simulator-deployment.yaml

An optional Service exposing the simulator port on the cluster can also be applied:

$ kubectl apply -f https://raw.githubusercontent.com/knowgoio/knowgo-vehicle-simulator/simulator-service.yaml

Simulator UI

KnowGo Vehicle Simulator Screenshot

Documentation

For additional documentation and tutorials, please refer to the documentation.

Postman Collection for Simulator REST API

A Postman Collection and pre-configured environment for interacting with the Simulator REST API in a local simulation environment is available here.

Architecture

The Simulator itself consists of several different components:

As the simulation state can not be shared directly across the isolates, the simulation model in the main isolate acts as the source of truth across the system:

An overview of the overall interactivity patterns for the different target platforms is provided in the table below:

Flutter Web Other Target Platforms
Web Worker-driven Simulation Flow Isolate-driven Simulation Flow

Implementation Status

Event Publication

By default, generated events are only logged in the console. Events can be published to a custom notification endpoint, a KnowGo API backend, as well as MQTT and Kafka brokers (as well as any combination thereof). The specific configuration for each is outlined below.

Configuration

Configuration of the simulator can be tuned through a config.yaml file, which will be parsed and updated by configuration changes within the UI. The format of the file is:

sessionLogging: true
eventLogging: true

# Allow unauthenticated requests to REST API
allowUnauthenticated: true

# Optional endpoint to post generated events to
notificationUrl: http://myserver.com/endpoint

# Optional KnowGo Backend Configuration
knowgo:
  server: <knowgo-API-server>
  apiKey: <knowgo-API-Key>

# Optional Kafka Broker Configuration
kafka:
  broker: <kafka-broker-address>
  topic: <kafka-topic>

# Optional MQTT Broker Configuration
mqtt:
  broker: <MQTT-broker-address>
  topic: <MQTT-topic>

A number of environment variables can also be set:

Environment Variable Description Default value
KNOWGO_VEHICLE_SIMULATOR_CONFIG Path to config file <appDocDir>/knowgo_vehicle_simulator/config.yaml
KNOWGO_VEHICLE_SIMULATOR_LOGS Path to log directory <appDocDir>/knowgo_vehicle_simulator/logs
KNOWGO_VEHICLE_SIMULATOR_IP IP address to bind for REST API 0.0.0.0
KNOWGO_VEHICLE_SIMULATOR_PORT HTTP port to bind for REST API 8086
KNOWGO_SIGNING_KEY Signing and validation secret for API keys secret-key

Features and bugs

Please file feature requests and bugs at the issue tracker.

License

Licensed under the terms of the MIT license, the full version of which can be found in the LICENSE file included in the distribution.