Drivers: Difference between revisions

From SweepMe! Wiki
Jump to navigation Jump to search
No edit summary
 
(20 intermediate revisions by the same user not shown)
Line 1: Line 1:
A Device Class is a library file allowing you to include and use any device with SweepMe!. It basically is a small code snippet called '''main.py''' written in the programming language python 3.6 (https://www.python.org/). All Device Classes can be found in the folder DeviceClasses of the SweepMe! installation.  
Several Modules can load Instrument drivers (formerly "Device classes") which are small code snippets allowing you to include and use any equipment with SweepMe!. It basically is a python file called '''main.py''' written in the programming language python 3.6 (32bit) (https://www.python.org/).  
 
A list of all publicly available drivers can be found here: https://sweep-me.net/devices


== Download ==
== Download ==


=== Device manager ===
=== Version manager ===
You can download Device Classes via the device-manager.exe which you can find in your SweepMe! installation. Please close SweepMe! beforehand. The [[device manager]] lists all online available Device Classes which have been uploaded to our server. Check all Device Classes you need and press "Install/Update" to download them to your local Device Class folder.
You can download or update Drivers via the Version Manager (menu "Tools" -> "Modules & Devics") which is part of the SweepMe! main installation.
 
=== Direct download ===
Drivers can be directly downloaded via the website (https://sweep-me.net/devices) after registering an account (https://sweep-me.net/register).
 
== Contribution and upload==
 
To make SweepMe! a powerful tool, we are relying on you! Help us to build up a large library of Drivers. Implement your own instruments and contribute them. Here is a guideline:
 
* Contact us if you have developed a driver. We will register the driver name on the server and make an initial check of the code.
* Then, we can give you account rights to maintain the driver and upload them to the system using the devzone.
* Alternatively, you can send us drivers and we will upload and maintain them.
 
Please note that we try to publish all drivers whenever possible under MIT license to have rather uniform landscape of licenses and to make it easy to use our drivers for different purposes.
To contribute a driver it also important to have all rights. For example, other authors might have contributed or your employer (university or company) has the rights about the drivers. Furthermore, the license of used third-partty libraries must be considered. Please contact us if you have any question.
 
For companies, we have a standard agreement for contributing drivers. Let us know if you like to contribute your drivers.
 
 
== Places and folders ==
 
SweepMe! can load Drivers from different places:
 
'''pre-installed''': These Drivers come with your installation of SweepMe! You can find them in the folder 'Devices' of your SweepMe! installation, e.g "C:\SweepMe!\SweepMe!_1.5.5\Devices" if you use the suggested installation path


The device manager will automatically store your previous Device class version so that you can swap back if something does not work as expected after an update.
'''installed''': These Drivers are obtained using the [[version manager] (menu "Modules&Devices"). Every Driver you download is versioned and will be copied to "C:\ProgramData\SweepMe!\Devices". These folders are read-only. Please, do not modify them to keep the file integrity. You can delete these versions using the version manager of SweepMe! Please also do not add any Driver yourself, except you know why. You can make a copy of these files if you like to test modifications as described below.


=== Direct download ===
'''custom''': These Drivers are placed in the public folder of SweepMe! called "CustomDevices". You can find this folder via the folder link on your desktop that was created during the installation or via the Menu of SweepMe! 'File' -> 'Open Folder' -> 'Public'. We recommend to use this folder to create your own Drives as this folder will not be changed if you install a newer version of SweepMe! so that you can still access your Drivers with any further SweepMe! version.
Click the link "Supported Devices" on the left side of this page and you will come to a list of all available Device Classes. You can download the Device Class directly as a zip-folder and you only need to unzip the Device Class into your local "DeviceClasses" folder of your SweepMe! installation.


These different kinds of Drivers are shown in the version manager of SweepMe! having the label '''pre-installed''', '''installed''', or '''custom'''.


== Structure ==
== Structure ==


Each Device Class file can be found in a folder of the following folder name structure:
SweepMe! searches for new Drivers in the folders described above. Each Driver has to have a name of the following structure:


'''<Type of the Module>-<Name of the manufacturer>_<Name of the device model>'''
'''<Type of the Module>-<Name of the manufacturer>_<Name of the device model>'''
Line 25: Line 50:
The <Type of the Module> must be related to the [[Modules]] provided by SweepMe! and every Module provides different functionality to control a certain type of equipment.
The <Type of the Module> must be related to the [[Modules]] provided by SweepMe! and every Module provides different functionality to control a certain type of equipment.


The Device Class itself is a file which always has the name "main.py" and which can load further python modules, [dll]s, or simply text files as needed to get your Device Class working.
The Driver itself is a file which always has the name "main.py" and which can load further python modules, [dll]s, or simple text files as needed to get your Driver working.
 
The [[Sequencer procedure]] provides various semantic standard functions which can be used at certain points during the run of the measurement sequence.
 
== Documentation ==


The [[Device Class Structure]] provides various standard functions which can be used at certain points during the run of the measurement sequence.
Each device class that has been uploaded to sweep-me.net automatically gets a webpage here [[https://sweep-me.net/devices/]]. One can find there further details about the instrument, the handling of the driver, and links to manufacturer or the manual. Feel free to contact us if further information are needed.


== Creating new Drivers ==


== Creating new Device Classes ==
You can implement Drivers on your own into SweepMe!.
How to program a Driver is described here: [[Device Class Programming]]


You can implement Device Classes on your own into SweepMe!:
==== Create a copy of an existing one ====


1.) Use the [[Device Class Assistant]]
* Open SweepMe!'s [[version manager]] using the menu 'Modules & Devices'
* Navigate to the Device you like to copy and choose a version
* Right-click the version and choose "Copy to public folder 'CustomDevices'"
* Right-click on the new version and select "Open in folder" or "Open in editor" to find or modify


2.) Copy another Device Class of your SweepMe! installation of the same type of [[Modules]] you are aiming for and modify it according to your needs
==== Create a new one using the version manager ====


3.) Go to [[Device Class Programming]] and learn how it works.
* Open SweepMe!'s [[version manager]] using the menu 'Modules & Devices'.
* Navigate to the Device you like to copy and choose a version.
* Right-click the version and choose "Copy to public folder 'CustomDevices'".
* Open the public folder "CustomDevices" (e.g. using the main menu via File -> Open folder -> Devices -> public).
* Rename the folder regarding module name, manufacturer and model.
* Delete the info.ini file if the new Driver was not automatically removed.
* Restart SweepMe! to reload all Drivers.


== Testing & Debugging ==
==== Manually create one ====


A new Device Class will be found by SweepMe! during the start. Add the Module to the [[Sequencer]] for which the Device Class is designed and the tab of the module will pop up where you will be able to chosse your Device Class from the list of devices.
* Open the public folder "CustomDevices" (e.g. using the main menu via File -> Open folder -> Devices -> public).
Whenever you run a measurement, the Device Class will be loaded again. Thus, you can change your Device Class in an editor and run a test meaurement to see whether it works. There is no need to restart SweepMe!.
* Create a folder with module name, manufacturer and model as defined above
* Add a main.py
* Insert the minimal working example as given in [[Device Class Programming]]


To display and test certain variables, you can insert print() commands and the output will be displayed in the debug window which you can open via ''Window'' -> ''Debug'' or by pressing the key "F2".


== Open/Modify ==
== Open/Modify ==


You can open any Device Class out of SweepMe! in an included notepad++ editor. Any change to the Device Class will automatically affect its operation after saving the file. If you like to try some modifications, we recommend to create a copy of the respective Device Class folder and rename it by keeping the same folder name structure as given above.
You can open any Driver in SweepMe! with the included Pnotepad editor. Any change to the Drive will automatically affect its operation after saving the file and starting a new run. Versions that have the origin 'installed' cannot be modifed as they are versioned. Use the [[Device Class Programming]] guide to find all possibilities.
 


== Upload your Device Class ==
== pysweepme ==


To make SweepMe! a powerful tool, we are relying on you! Help us to build up a large library of Device Classes. Implement your own Device Classes and upload your files to our webpage. Contact us and you get an account over which you can create a new Device Class available for everyone to download.
SweepMe!'s instrument drivers now have a double use. They can either be used with SweepMe! but also loaded in individual python projects using the open-sourve library [https://pypi.org/project/pysweepme/ pysweepme].

Latest revision as of 19:49, 24 May 2022

Several Modules can load Instrument drivers (formerly "Device classes") which are small code snippets allowing you to include and use any equipment with SweepMe!. It basically is a python file called main.py written in the programming language python 3.6 (32bit) (https://www.python.org/).

A list of all publicly available drivers can be found here: https://sweep-me.net/devices

Download

Version manager

You can download or update Drivers via the Version Manager (menu "Tools" -> "Modules & Devics") which is part of the SweepMe! main installation.

Direct download

Drivers can be directly downloaded via the website (https://sweep-me.net/devices) after registering an account (https://sweep-me.net/register).

Contribution and upload

To make SweepMe! a powerful tool, we are relying on you! Help us to build up a large library of Drivers. Implement your own instruments and contribute them. Here is a guideline:

  • Contact us if you have developed a driver. We will register the driver name on the server and make an initial check of the code.
  • Then, we can give you account rights to maintain the driver and upload them to the system using the devzone.
  • Alternatively, you can send us drivers and we will upload and maintain them.

Please note that we try to publish all drivers whenever possible under MIT license to have rather uniform landscape of licenses and to make it easy to use our drivers for different purposes. To contribute a driver it also important to have all rights. For example, other authors might have contributed or your employer (university or company) has the rights about the drivers. Furthermore, the license of used third-partty libraries must be considered. Please contact us if you have any question.

For companies, we have a standard agreement for contributing drivers. Let us know if you like to contribute your drivers.


Places and folders

SweepMe! can load Drivers from different places:

pre-installed: These Drivers come with your installation of SweepMe! You can find them in the folder 'Devices' of your SweepMe! installation, e.g "C:\SweepMe!\SweepMe!_1.5.5\Devices" if you use the suggested installation path

installed: These Drivers are obtained using the [[version manager] (menu "Modules&Devices"). Every Driver you download is versioned and will be copied to "C:\ProgramData\SweepMe!\Devices". These folders are read-only. Please, do not modify them to keep the file integrity. You can delete these versions using the version manager of SweepMe! Please also do not add any Driver yourself, except you know why. You can make a copy of these files if you like to test modifications as described below.

custom: These Drivers are placed in the public folder of SweepMe! called "CustomDevices". You can find this folder via the folder link on your desktop that was created during the installation or via the Menu of SweepMe! 'File' -> 'Open Folder' -> 'Public'. We recommend to use this folder to create your own Drives as this folder will not be changed if you install a newer version of SweepMe! so that you can still access your Drivers with any further SweepMe! version.

These different kinds of Drivers are shown in the version manager of SweepMe! having the label pre-installed, installed, or custom.

Structure

SweepMe! searches for new Drivers in the folders described above. Each Driver has to have a name of the following structure:

<Type of the Module>-<Name of the manufacturer>_<Name of the device model>

Examples:

  • SMU-Keithley_2400
  • LCRmeter-HP_4284A
  • Logger-PC_Mouse

The <Type of the Module> must be related to the Modules provided by SweepMe! and every Module provides different functionality to control a certain type of equipment.

The Driver itself is a file which always has the name "main.py" and which can load further python modules, [dll]s, or simple text files as needed to get your Driver working.

The Sequencer procedure provides various semantic standard functions which can be used at certain points during the run of the measurement sequence.

Documentation

Each device class that has been uploaded to sweep-me.net automatically gets a webpage here [[1]]. One can find there further details about the instrument, the handling of the driver, and links to manufacturer or the manual. Feel free to contact us if further information are needed.

Creating new Drivers

You can implement Drivers on your own into SweepMe!. How to program a Driver is described here: Device Class Programming

Create a copy of an existing one

  • Open SweepMe!'s version manager using the menu 'Modules & Devices'
  • Navigate to the Device you like to copy and choose a version
  • Right-click the version and choose "Copy to public folder 'CustomDevices'"
  • Right-click on the new version and select "Open in folder" or "Open in editor" to find or modify

Create a new one using the version manager

  • Open SweepMe!'s version manager using the menu 'Modules & Devices'.
  • Navigate to the Device you like to copy and choose a version.
  • Right-click the version and choose "Copy to public folder 'CustomDevices'".
  • Open the public folder "CustomDevices" (e.g. using the main menu via File -> Open folder -> Devices -> public).
  • Rename the folder regarding module name, manufacturer and model.
  • Delete the info.ini file if the new Driver was not automatically removed.
  • Restart SweepMe! to reload all Drivers.

Manually create one

  • Open the public folder "CustomDevices" (e.g. using the main menu via File -> Open folder -> Devices -> public).
  • Create a folder with module name, manufacturer and model as defined above
  • Add a main.py
  • Insert the minimal working example as given in Device Class Programming


Open/Modify

You can open any Driver in SweepMe! with the included Pnotepad editor. Any change to the Drive will automatically affect its operation after saving the file and starting a new run. Versions that have the origin 'installed' cannot be modifed as they are versioned. Use the Device Class Programming guide to find all possibilities.

pysweepme

SweepMe!'s instrument drivers now have a double use. They can either be used with SweepMe! but also loaded in individual python projects using the open-sourve library pysweepme.