LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Lengthy Data Reads in Actor Framework

Hello everyone,

 

I've been working with Actor Framework for a couple of months now and am feeling more confident with it as of late. Unfortunately, I've been running into an issue with long delays in the time it takes to read data from the various devices in my system. I've put this off for some time, but I want to address it now. 

 

System Overview

My system is deployed on a PXI RT target and has the following architecture:

  • A controller actor that launches multiple device actors

  • The controller uses a timer to periodically send read commands to each device actor

  • A base device actor class defines overridable methods for connect and read (both reentrant)

  • Each device actor currently performs its read in its Message Handling Loop (MHL)

    • I understand this is generally discouraged because it blocks message handling

    • I have begun experimenting with helper loops instead

 

The Problem

When communicating with multiple devices simultaneously:

  • 2 Modbus TCP devices: 170–200 ms read time each
  • 1 CAN XNET device: 200–220 ms read time

However, when communicating with devices individually:

  • Modbus TCP: ~10 ms read time
  • CAN XNET: ~40–50 ms read time

These individual read times match expectations.

 

 

Troubleshooting Performed

I’ve tried the following:

  • Removed other actors (such as data logging actors)
    • This slightly improved read times, but delays remained significant
    • The total actor count is well below 24, so I wouldn't expect thread limits to be an issue
  • Thinking this was related to thread starvation, I changed the thread execution of these read vis to "daq."
    • No noticeable improvement
  • Moved the CAN XNET read into a helper loop
    • This significantly improved performance across all devices
    • TCP reads dropped to ~20 ms
    • XNET read dropped to ~80 ms

 

I can't exactly share my code here, but I hope what I've provided sets off some alarm bells for someone else. This issue has left me stumped for quite some time, and I'd love any insight into what may be causing this.

 

If anyone needs any more clarifying information, I'll try to answer ASAP. 

 

Thank you all for your time and insight!

0 Kudos
Message 1 of 1
(230 Views)