LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Pump Test Loop - Data acquisition and Modbus

Hello, I am working on a labview program for measurement and control of a simple pump test loop.

 

The VFD that controls the motor is connected to a pc with an rs232-usb connection and controlled via LabVIEW using the modbus library.

Sensors that measure pressure are connected to a NI-9203 module in a NI-9174 cDAQ chassis.

 

Please see attached vi for the control system. The current program lets me control the speed of the pump and will automatically shut down the pump should the pressure in the system increase or decrease, in addition to logging the data from the sensors and motor. Due to pressure pulsations I am using an averaging filter to smooth the data from the sensors.

 

My issues are that i would like pressure sensors to sample and log data faster than the execution time of the while loop (~160 ms). At the moment im using a 200 ms wait in the while loop and a sample rate of 5 for the sensors to sync them with the time stamp and data from the motor. I'm looking for a better way of doing this.

 

Another issue is that i sometimes get Error 56 - the network operation exceeded the user-specified or system time limit, which i guess is because the communication with the vfd times out. I have a suspicion that it might be the rs232-usb converter that is causing the problem. 

 

With regards to solutions, purchasing different hardware or software is an option.

 

 

 

0 Kudos
Message 1 of 7
(3,173 Views)

Hi Sur,

 

use separate loops for DAQ and ModBus to decouple samplerate from serial communication speed…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 7
(3,165 Views)

Hi Gerd

 

I was looking into using seperate loops but i read something about it was not possible to send data between them if they run at different speed, which I need for control of the motor.

 

I am relatively new to LabVIEW so I might have misunderstood.

0 Kudos
Message 3 of 7
(3,151 Views)

Hi Sur,

 

i read something about it was not possible to send data between them if they run at different speed,

It's possible to send data from one loop to another, even when they run at different speeds…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 7
(3,136 Views)

Have had limitied time to work on the program lately but here is an update.

 

For now I've split it into three loops, one which control the motor, one which reads data from sensors and one which writes it to a file, using the Producer/Consumer architecture. I'm planning to use a consumer to use the sensor data to control the motor as well.

 

Now the motor control loop and the write loop is running at the same speed while the data gathering loop runs much faster. Is there a way to get the write loop to run faster than the motor control loop and just write the same data from the motor until it updates?

0 Kudos
Message 5 of 7
(3,089 Views)

Hi Kaktus,

 

Is there a way to get the write loop to run faster than the motor control loop and just write the same data from the motor until it updates?

Yes.

😄

Spoiler
Use a notifier to keep the latest motor state. Read that notifier in the consumer and apply a timeout on this read operation…
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 7
(3,087 Views)

Hi, I changed my program to use notifiers instead and it works great if the motor control loop runs faster than the write loop, however if the write loop runs faster, the data is not written correctly, even though the timeout for the notifier is included.

0 Kudos
Message 7 of 7
(3,056 Views)