Skip to main content

A Hardware-in-the-Loop / Software-in-the-Loop simulation framework

Project description

hilsim

A Python package for rapid hardware-in-the-loop (HITL) and software-in-the-loop (SITL) simulation, designed for software/hardware prototyping, testing, and development.

Installation

pip install hilsim

Quick Start

See the examples folder for a host of configuration files, sensors, and actuators. hilsim has two commands to aid the developer:

  • hilsim create <project_name>: This automatically generates the project scaffolding in the current directory under <project_name>
  • hilsim run: This runs the project (i.e. builds all of the devices and runs the main function). It must be ran from the root directory of the project.

How It Works

hilsim generates a project structure where the developer has four main tasks:

  1. fill out configuration files
  2. Writes basic drivers for sensors based on a template.
  3. Describe the physics/behavior of actuators (anything that changes the state of the world), also based on a template.
  4. Write the main logic.

A simple run command then simulates the entire system. Switching the "sim" keyword for either a sensor, device, or actuator allows the user to rapidly switch between simulating a component and deploying the actual hardware. No need to worry about any middleware or fatal exceptions in the background.

Features

  • Data recording.
  • User defined event driven log file management with a built-in detailed message logging system.
  • Standardized serial protocol with built-in recovery.
  • High-level i2c bus interactions with built-in recovery.
  • Simulate latency between the host and peripheral device communication and actual hardware deployment.
  • Simulate sensor errors/failures.
  • Simulate noise and drift in sensors.
  • Simulate host-peripheral device communication failures.
  • Simulate hardware failures.
  • Background dynamics simulation. Background dynamics run on a high-speed background thread (on the ms level) which sensors may routinely pull from, mirroring the continuous nature of system dynamics and separating them from the discrete nature of sensor reads.

Current Limitations

Currently, the "supported" i2c_bus wraps the board and busio libraries, allowing hilsim to accommodate a wide range of readily-available/cheap sensors from manufacturers like Adafruit. A future release will include support for the smbus library, allowing the the use of custom sensors / i2c devices at a lower level.

Roadmap

  • Add detailed examples and walkthroughs.
  • Support for the smbus library.
  • Rapid power cycling / software cycling integration. The current release flags errors that the developer can accommodate in main, but does not have the capability to rapidly integrate software cycling or power cycling.
  • SPI support
  • Virtual serial ports with socat, ideal for testing microcontroller code alongside the host.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hilsim-0.1.2.tar.gz (30.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hilsim-0.1.2-py3-none-any.whl (36.9 kB view details)

Uploaded Python 3

File details

Details for the file hilsim-0.1.2.tar.gz.

File metadata

  • Download URL: hilsim-0.1.2.tar.gz
  • Upload date:
  • Size: 30.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for hilsim-0.1.2.tar.gz
Algorithm Hash digest
SHA256 7ca90575e0bb38a13be2c31e24f87950d01ee4b564dd27a2744c46adac604d9f
MD5 660f74aedf218792a209bc9eb0ba9f99
BLAKE2b-256 8b71283247e0c132a019f947370594fe96fc97926c012e84499da953e6c83ba7

See more details on using hashes here.

File details

Details for the file hilsim-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: hilsim-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 36.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for hilsim-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 75dd105c2765f67fa9b3b096f3e1fa32545e55efb3bf39bbd26c200bf7d8f662
MD5 265beef5773e2cb3817106d0b813dd94
BLAKE2b-256 5d0941a032c1d091ee5b3f73591b813b00cd98080c340f69d2c261cd0f8a0447

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page