Using LabVIEW, CompactDAQ, and NI TestStand to Create a Production Test System for Automated Milking Points

  Print Print

"The modular instrument system architecture makes the system expandable as the product evolves over time. Using LabVIEW and modular instruments helped us focus solely on solving problems."

- Andreas Beckman, AddQ Consulting

The Challenge:
Automating a final inspection and function test of milking points to improve production capacity and quality, as well as to comply with R&D requirements and government regulations.

The Solution:
Using NI LabVIEW software, NI CompactDAQ, and NI TestStand to rapidly design and develop a test system with industrial grade test equipment.

Andreas Beckman - AddQ Consulting
Björn Svedberg - AddQ


DeLaval has more than 125 years of innovation and experience in supporting dairy farmers in managing their farms. DeLaval’s smart farming strategy is influencing and shaping the future of dairy farming. The company’s goal is to accelerate the transition from milking management to global farm profitability management by harnessing emerging decision-making tools and automation technologies for better milk quality and profits.

DeLaval asked us to partner with them to ensure high-quality products for their automated milking equipment. We were challenged with building a function and final inspection rig to test milking point modules in DeLaval’s latest invention, the automated milking rotary (AMR).

Milking Point

A milking point is a connection in the cowshed where the cow is milked. The milk is then transferred through a milk line to a storage tank.

The milking point in the AMR uses a vacuum to perform milking and then transports the milk through the milk line. The AMR milk point is equipped with a precise, real-time electronic control system that regulates the milking. The milking point acts as a distributed system and communicates with a main control unit through a controller area network (CAN) interface.

Test Software

We created a fully object-oriented test system with LabVIEW and the G# StarUML Plug-in based on a G# framework and the Q-Library, a source code library for test.

From the milking point test specification, we created a set of test methods. A typical test method could involve analyzing a waveform sampled with a flow sensor connected to the milking point or communicating with the test object through CAN. We developed the test methods generically for reuse. A test case consists of one test method paired with one set of test parameters and requirements. Test cases are then executed in sequence using NI TestStand test management software.

Instrument information, along with test and result data, is exported as an HTML report and to a corporate enterprise solution.

Industrial and Modular Test Rig

During the test, the milking point is placed next to the test rig and connected with a custom-built connection fixture (see Figure 1 and Figure 2). The operator uses the fixture to easily contact the test object. As the test system executes, it applies electric stimuli with a power supply and relays controlled by an NI 9477 digital output module. To accurately control vacuum flow to the test object, we designed a vacuum regulation module with pneumatic valves, regulators, and flow sensors. We achieved communication with the test object through an NI USB-8473 CAN interface. We measured the test object response with NI 9203 and NI 9208 modules through 4 mA to 20 mA flow and vacuum sensors.


We created a 19-in. test rack specially designed to measure and control vacuum flow as well as communicate with the test object (see Figure 3). The test equipment consists of standard measurement and control instruments from the NI CompactDAQ family. The system measures and detects faulty seals in the milking point that could lead to contamination of the milk. It also analyzes the characteristics of the milking so that the milking point fully complies with government regulations.

When a test is completed, the system interacts with the factory enterprise systems and generates an HTML report.


Our object-oriented system designed with the G# framework gave us great results both in performance and code reusability. The G# StarUML Plug-in, with its ability to generate and reverse engineer code, was ideal for the project members during code design discussions. Using the test code base, Q-Library, we cut time to market by more than half. The free and open source tools and the code base we used catalyzed development and ensured a high-quality test software.

The modular instrument system architecture makes the system expandable as the product evolves over time. Using LabVIEW and modular instruments helped us focus solely on solving problems.

Author Information:
Andreas Beckman
AddQ Consulting

Bookmark and Share

Explore the NI Developer Community

Discover and collaborate on the latest example code and tutorials with a worldwide community of engineers and scientists.

‌Check‌ out‌ the‌ NI‌ Community

Who is National Instruments?

National Instruments provides a graphical system design platform for test, control, and embedded design applications that is transforming the way engineers and scientists design, prototype, and deploy systems.

‌Learn‌ more‌ about‌ NI