With the new Python integration for the Qmix SDK you can develop small applications in the shortest time, automate certain dosing processes or realize your own analyses. The main advantage of Python is its ease of programming, which significantly reduces the time required to develop, debug and maintain the code. In the following example we show you how easy and fast you can implement an application with Python and the Qmix SDK.
To install, simply use the Qmix SDK installation package for Windows. The SDK will be installed in a folder of your choice.
To include the Qmix SDK in your Python script you have to add the path containing the Qmix SDK modules to the module search path. In order for Python to load the shared libraries (DLLs) of the SDK, you must then add the path containing the DLLs to the Windows search path. All details are also available in the online documentation.
Now you can import the modules of the Qmix SDK Python integration.
The first Python application
Now you can start developing your first application. The following program shows a small example. First a bus object is created, initialized with the path to a device configuration and then the communication is started. Then we create a pump object and connect it to the first pump in the SDK - device index 0. As a test we print the name of the pump with the print function.
In the next step we perform a reference run with the calibrate function to determine the zero position of the pump. Before the reference run, we clear any remaining errors (clear_fault) and enable the pump (enable). With the help of a timeout timer we wait until the calibration is finished.
The pump is now initialized and we can start dosing. For this we set the units for volume and flow rate to milliliter and milliliter per second. As a test we will output the unit for the flow with the print function. Then we configure the syringe to be used. We use a syringe with 1 mm inner diameter and 60 mm plunger stroke. In line 41 we start the aspiration (aspirate) of 0.02 ml with a flow rate of 0.004 ml/s. With a timeout timer we wait again until the dosage is finished.
At the end of the program we stop the communication and call the close function of the bus object to release all resources again.
We hope you got a small impression of how powerful and simple the Qmix SDK for Python is. You can download the Python example from this blog post here.