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.1.tar.gz (29.7 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.1-py3-none-any.whl (36.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: hilsim-0.1.1.tar.gz
  • Upload date:
  • Size: 29.7 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.1.tar.gz
Algorithm Hash digest
SHA256 65bd81ee9e9e4e99ff514232ef43e2f310370d4aae42b3ca6dbcefedaa5ace47
MD5 2d569c8f76c2253d2bbbdebaf45465f8
BLAKE2b-256 bf62dc1e456e231b48c148b6b26c15dd573197c34f003996154da5a4c55f638c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hilsim-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 36.4 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d76101e4c082484fc6a0cdf8f5c8396565ee5f52a04ab82b49a92a4833414d91
MD5 78182d260b1ded8ad5d8ed8a4893f670
BLAKE2b-256 5932eb5dab58019097c282c2f6d9205df1e4f78120d9832416143f6b3a0fd1db

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