Support in Programming

Customers can program or adapt their own user programs so that every PI controller can be seamlessly integrated into their application. For this purpose, various libraries and drivers are available which allow access to the controller in form of encapsulated function calls. A connection and communication with the controller can be established with little effort and independently of the communication interface of the controller.

In the comprehensive software package for PI controllers, libraries and drivers for common programming languages are available, e.g.:

  • C, C++, C#, VB.NET
  • Python
  • MATLAB
  • NI LabVIEW

 

For less common programming languages such as Visual Basic (VB) or Delphi, you can quickly and easily ask PI for custom solutions.

Not every function is available for all controllers. For details, please refer to the corresponding product data sheets.

C, C++, C#, VB.NET

For text-based languages, such as C, C++, C#, and VB.NET, an API is available that allows the control of PI controllers from propriety programs. This API is available as dynamic library for the following operating systems: Windows, Linux, macOS, 32/64 bit. It allows for an easy connection to the respective development environment.

Completed examples ("Samples"), with which the customer can immediately put together a functioning application, are included for all supported programming languages. These "Samples" include first steps such as the connection and fundamental communication with the controller as well as more extensive functionalities with different axes. The usage of the function generator and the data recorder are examples thereof. Upon request, "Samples" can be designed for customer-specific problems or for programming languages not supported.

Python

For more complex tasks which the controller has to carry out independently, that is without connection to a PC, the user can use scripts based on Python. For this purpose, PI offers PIPython, a collection of Python modules, with which PI controllers can be directly controlled using Python. The power of this programming language is, therefore, combined with the flexibility of PI's proprietary GCS commands. Furthermore, PIPython offers a variety of useful auxiliary support functions.

PIPython can be used starting with Python 2.7 or Python 3.4 and it works on all platforms which support Python. Some additional functions are only available with standard operating systems such as Windows, Linux, and macOS.

Example of commands in Python

from pipython import GCSDevice
pi_device = GCSDevice ()
# Load PI Python Libraries
pi_device.ConnectUSB ('123456789') # Connect to the controller via USB
pi_device.SVO ('A', 1) # Turn on servo control of axis "A"
pi_device.MOV ('A', 3.142) # Command axis "A" to position 3.142
position = pi_device.qPOS ('A')# Query current position of axis "A"

MATLAB

 

PI controllers can be directly controlled in MATLAB by using the PI MATLAB driver. For this purpose, no additional MATLAB tool boxes are necessary. A Windows installer facilitates the access, a Linux installer is available on request. PI is a Connections Partner of The Mathworks and therefore offers MATLAB users a high-quality integration of PI products into the MATLAB environment.

NI LabVIEW

The PI GCS NI LabVIEW driver set offers complete support of NI LabVIEW as a programming language for customer-specific applications. It offers a complete driver package as well as practical examples including a comfortable configuration VI.

Since nearly the entire driver set is based on pure NI LabVIEW code and NI-VISA communication, it is platform-independent and supports all PI controllers independently of the positioning stage connected. Except for the actual configuration, all VI's are open source and include a comprehensive online help. The sustainability of the customer applications is ensured thanks to the extensive downward compatibility of the driver set.

PI is a Product Alliance Partner of National Instruments. This ensures high-quality solutions and an up-to-date knowledge of the PI developers at all times.

Possibility of Debugging

For debugging macros, scripts, or programs, tools are delivered which support the developer while searching for errors. PIMikroMove, PI's PC software, supports the debugging process of GCS macros. The macro thereby runs on the PC and the included commands are sent to the controller individually. For example, variable names can be read, or the logical flow can be tested, and much more.

Some controllers can be addressed with Python scripts which run on the controller itself. In this case, a cross debugging is possible. That is, the script runs on the controller while the developer works on the PC and operates the debugger from there.

All PI user programs as well as libraries and drivers for the programming languages additionally offer logging possibilities. The communication with the controller is logged with a time stamp therefore making an analysis of the time behavior possible.