Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

Datasocket read of psp:// cRIO channels

I have some AI channels on a cRIO-9014 with Scan mode. I read them dynamically using Datasocket blocks and psp:// URLs. Sometimes, probably when CPU was very busy, i experienced a strange behavior: there was no timeout or delay, but the values read were not the current ones but past ones, like they were buffered. For example i applied a known voltage to an AI channel, but it didn't appear in the readings until some seconds or even minutes. This didn't happen using the Distributed system manager 8.6. I have not enabled RT FIFO for the variables in the project (the option is even greyed). What could that be?
0 Kudos
Message 1 of 6
(4,461 Views)

Hi SnamProgetti,

 

how's the Datasocket API chain configured? Are you opening a Read or a BufferedRead connection? Remember also that you must check the scan rate for the NI-Scan Engine (see the controller properties) and adapt code to such rate (by using a Timed Loop or a "Synchronize to Scan Engine" function into a while loop.

 

Also, there's an advanced API for controlling Scan Engine I/O nodes:

 

NI Scan Engine Advanced I/O Access

 

Hope this helps,

 

Fabio

Fabio M.
NI
Principal Engineer
0 Kudos
Message 2 of 6
(4,445 Views)

There's a "Datasocket open" with "mode" set to "Read", then a "Datasocket read" with "type" set to DBL and "wait for updated value" set to false. The scan rate for the NI-Scan Engine is set to much faster than the timed loop with the Datasocket read.

Is the "Advanced I/O access" recommended over Datasocket, even for single variable readings?

0 Kudos
Message 3 of 6
(4,443 Views)

Hi Snamprogetti,

 

sorry for the late reply. The behavior you're describing is really odd. What you could do in order to speed up things is to use Direct I/O access for your I/O node instead of Scanned I/O, as described into this document:

 

Using I/O Variables (NI Scan Engine)

 

Anyhow, Scan Engine process is normally set as a priority higher than other processes running on your cRIO, as you can see from Scan Engine configuration page. Another thing you can try is to use new API's described here

 

Programmatic Discovery, Configuration, and Access of CompactRIO Scan Mode I/O with LabVIEW

 

for programmatic access to Scan nodes.

 

Hope this helps,

 

Best regards,

 

Fabio

Fabio M.
NI
Principal Engineer
0 Kudos
Message 4 of 6
(4,381 Views)

Hi Snamprogetti, 

 

The datasocket VIs go through the network stack to read the I/O values. Pushing the scanned I/O values out to the network is lower priority than the local I/O scan, so I would not be surprised if you see old value when your CPU load is high.

 

The correct way to programmatically access I/O at runtime is to use the new API introduce in LabVIEW 2009 for Programmatic Discovery, Configuration, and Access of CompactRIO Scan Mode I/O with LabVIEW

 

Refer to the "Reading and Writing I/O" section. 

 

Kurt 

Message Edited by jkurtw on 10-12-2009 09:34 AM
0 Kudos
Message 5 of 6
(4,372 Views)
Thanks, that makes sense. The only strange thing is that Distributed system manager worked fine, though it is going thru the network stack too, isn't it?
0 Kudos
Message 6 of 6
(4,363 Views)