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.

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.3.tar.gz (30.1 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.3-py3-none-any.whl (36.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: hilsim-0.1.3.tar.gz
  • Upload date:
  • Size: 30.1 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.3.tar.gz
Algorithm Hash digest
SHA256 ce622eff1e8774e452e6826b3298087d66615b12976d5a7df0628e3d987bde50
MD5 45e032318b4ad1cc53676b35a684fe88
BLAKE2b-256 99db804ff7b878026d00e4407667052773de61a4a0421c2390f104cd2a950d76

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hilsim-0.1.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a0999581179259e338ca7905b81f99b6bcf289259b69428d1893b665e088d8ef
MD5 71bda0638f4fc2b868ee005b2e73d107
BLAKE2b-256 432a7001e2d9db8c762267d242592058b2947926fae0a970c7e7e70b9f5ccb98

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