Reconnect Ethernet DAQ Automatically During Data Acquisition Process

Updated Sep 29, 2023

Environment

Hardware

  • cDAQ-9191
  • NI-9232

Software

  • LabVIEW

Programming Language

  • C# .NET

I bought a cDAQ 9191 and NI 9232 to run a data acquisition task continuously (more than 1 hour). However, the cDAQ system stopped data acquisition due to unknown reason. Is there any way to reconnect the cDAQ automatically?

IDEA CONCEPT
  1. Reserve network device (cDAQ 9191) before acquire data in each turn.
  2. If cDAQ chassis lost connection, the program coding just return error but continue next data acquisition turn.

METHOD 1          RESERVE CHASSIS IN NI MAX
You can click “Reserve Chassis” in NI MAX to reserve cDAQ 9191.





METHOD 2          RESERVE CHASSIS IN LABVIEW
Components below are main factor to reconnect chassis after facing unknown issue:
  1. External While Loop  
    • To keep VI running even reserve device failed.
  2. DAQmx Reserve Network Device  
    • Reserve cDAQ 9191
  3. Case Structure
    • Error case
      • Must link FALSE constant to External While Loop condition terminal
    • No Error case


METHOD 3          RESERVE CHASSIS IN C# PROGRAMMING LANGUAGE
**National instrument got provide other programming language example API and usually provided in driver (Example: NI-DAQmx Driver). In this article C# is selected for example programming language. C# programming resources can refer to the link .NET Resources for NI Hardware and Software - NI.
  1. Make sure the C# code won’t be stopped if error occurred.
    • Unfortunately, C# is non-NI programming language, and we can’t provide so much details on this part.
  2. Reserve chassis code:
    • DaqSystem.Local.AddNetworkDevice("IPv4 address","Chassis name",Timeout);
    • DaqSystem.Local.LoadDevice("Chassis name").ReserveNetworkDevice();
  3. Reserve Chassis code is added under data acquisition code part.

METHOD 2          RESERVE CHASSIS IN LABVIEW
Reserve Chassis in Labview.png


METHOD 3          RESERVE CHASSIS IN C# PROGRAMMING LANGUAGE

private void startButton_Click(object sender, System.EventArgs e)
{
if (runningTask == null)
{
DaqSystem.Local.AddNetworkDevice("10.10.10.3","cDAQ9191-16E500C",10);
DaqSystem.Local.LoadDevice("cDAQ9191-16E500C").ReserveNetworkDevice();
Try