Technical Article

Using LabVIEW for Motor and Motion Control

June 29, 2021 by Antonio Armenta

Learn about the numerous libraries, toolkits, and interfaces to achieve motor and motion control using LabVIEW.

One of the main advantages of the LabVIEW software platform is the availability of a large number of libraries and add-ons that have been released by National Instruments, third-party vendors, and users alike over the years. 

Thanks to the platform’s longevity, these add-ons have been improved upon, producing an ecosystem of functionalities that makes LabVIEW capable of handling complex tasks. Some of these tools are created especially for making motor and motion control possible in LabVIEW. These tools can do this both in a simulation environment and in a real physical motion system. This article will discuss some of the most common tools used for motion control in both environments.

 

Motor Control Simulation

LabVIEW offers several ways to simulate a DC-motor control system. One way that you can use simulation in LabVIEW is by using the NI Electric Motor Simulation Toolkit. This toolkit enhances NI Veristand and LabVIEW. NI Veristand is another tool, providing the framework necessary to execute near real-time control, including motion control. Additionally, this makes it possible to run finite element analysis on the electric motor simulation. 

With the Electric Motor Simulation Toolkit, new dedicated DC motor simulation VI’s become available in LabVIEW. There are also sample projects included that can be used for reference. One drawback is that there has not been a new release of the Toolkit since the LabVIEW 2016 compatible version. 

 

Fig. 1. An example of a DC motor control VI created using the Electric Motor Simulation Toolkit. Image used courtesy of National Instruments

 

Another method of simulating DC-motor control in LabVIEW is by modeling a closed-loop control system. This is a system in which the output is used in a feedback path back to the controller and that, together with the input, affects the next iteration of the controller output with the intent to produce the desired result. A DC-motor control is a classic example of this type of system.

By using the LabVIEW Control Design and Simulation Module together with the LabVIEW MathScript Module, users can design, model, and simulate a DC-control system. 

In the control loop, the motor is the plant, and a mathematical model (or transfer function) that describes its behavior must be modeled using MathScript. The Simulation Module adds new elements to LabVIEW that make it possible to create the controller in the VI, using the Continuous Linear Systems function blocks.

Putting together the MathScript model with the LabVIEW VI block diagram comprises a fully functional closed-loop system. With this, different settings and inputs to the system can be tested, validating the results of the controller model are as required.

 

Fig. 2. A closed-loop DC motor control system using MathScript and block diagram functions. Image used courtesy of National Instruments

 

LabVIEW and SolidWorks

Another form of motion simulation in LabVIEW is possible thanks to NI Motion Software. With it, users can import 3D CAD models created in SolidWorks into the front page of LabVIEW and, at the same time, code functions in the block diagram. This feature is extremely useful in the design stage of machines and automated systems. 

Many OEMs already create 3D models of the machines and systems before they are built. Now, with LabVIEW, these models can be put under several simulation cycles that help understand the system’s responses in real-world conditions, validate performance requirements are met and inspect for collisions preemptively. A PLC feature enables the simulation of inputs and outputs from a real physical PLC. 

 

Motion Systems

LabVIEW, used together with other applications from National Instruments, makes it possible to create motion control systems with all of the necessary components. 

 

Input/Output Management 

Using the NI SoftMotion application user interface, many components of the motion system can be added as modules in LabVIEW, including the control loop design. 

 

User Interface

The HMI-equivalent of the system can be executed on and the LabVIEW Front Page.

 

Trajectory Generation and Supervisory Control

With the NI SoftMotion Engine, real-time control of the I/O is possible. The engine manages the configuration of the axis, as well as a simulation module to test the design before connecting the physical I/O.

 

Interpolation and Control Loops

Another module is the LabVIEW FPGA (Field-Programmable Gate Array), which upgrades the VI libraries to simplify coding in the data block. 

The FPGA module makes it easier to configure and test the control loop and communication protocols. FPGA works together with the LabVIEW Real-Time Module, which helps compile the application that can be executed in an embedded hardware component. 

 

Fig. 3. The different NI and LabVIEW modules needed to create a fully functional motion control system. Image used courtesy of National Instruments

 

Beyond single-axis control applications, these modules can be applied to complex multiple-axis control systems. For decentralized systems, the LabVIEW motion control environment has been developed to more easily integrate with devices that communicate using the EtherCAT protocol, which is ethernet-based. There is a wide variety of such devices that can be configured from one of the LabVIEW libraries. These methods are several ways you can use LabVIEW for motor and motion control. 

How do you use LabVIEW? Let us know in the comments.