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 (HIL) and software-in-the-loop (SIL) simulation, designed for software/hardware testing, deployment, and development.

Installation

pip install hilsim

Quick Start

See the examples folder for a host of configuration files, sensors, and actuators.

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.0.tar.gz (29.6 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.0-py3-none-any.whl (36.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: hilsim-0.1.0.tar.gz
  • Upload date:
  • Size: 29.6 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.0.tar.gz
Algorithm Hash digest
SHA256 676fd36b5ae4c1b90eb6bb8a0fd38606542813273295ee1a250156ab85ab6fab
MD5 212dd8d220a20e86eaf4568a1e36df09
BLAKE2b-256 525e36318af95dc369814deb46940854b06d52f33e83dc1d6e85122ff890e98a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hilsim-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 36.3 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 99b93a713dfdde4d32a4b4c7dcffc7e5b1b33c3a17b4e3f128d00e501b8820d9
MD5 a6da43e1786dc848b91c311e26dc0f75
BLAKE2b-256 b2d5f452c6527d2970c34ea21fe71f41dbd6749e5b72d4560af8a8b9cc7a4c36

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