Adding a new device type¶
This guide will walk through the steps needed to add a new device type.
drivers\<device_type>[\<device_series>]\<device_driver>.py
Steps to follow¶
- Create an abstract device type class within the
drivers/subpackage- Create a new subpackage for the new device type alongside the existing
device type subpackages at the appropriate spot in the file tree (e.g.
power_supplies/,margin_testers/,scopes/) - Create a new Python file and class with appropriate inheritance for the
new device type (e.g.
power_supply.py,margin_tester.py,scope.py) - Add an
__init__.pyfile within the new device type subpackage containing a short docstring explaining what is in the new subpackage. (See other__init__.pyfiles for examples)
- Create a new subpackage for the new device type alongside the existing
device type subpackages at the appropriate spot in the file tree (e.g.
- Update the
DeviceTypesenum exposed intm_devices/helpers/__init__.py - Add the DeviceType enum value to the newly created device driver class as a class property (see existing device type classes for an example)
- Update the
VALID_DEVICE_CONNECTION_TYPESlookup exposed intm_devices/helpers/__init__.pywith the new device type and its valid connection types- If needed, update the
ConnectionTypesenum exposed intm_devices/helpers/__init__.pywith any new connection types
- If needed, update the
- Create a new, empty Type Alias for the new device type inside
device_manager.py(search for “Type Aliases”)- This Type Alias should be named after the abstracted base device type parent class, and it should contain all device drivers that are of its type
- Create a new
add_<device_type>()method with the appropriate signature insidedevice_manager.py(use other methods as examples) - Create a new
get_<device_type>()method with the appropriate signature insidedevice_manager.py(use other methods as examples) - Add a new folder in
tests/sim_devices/<new_type>for unit tests - Update the advanced architecture page to include the new device type
- Update anything new that needs to be in configuration.md