LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

control and acquisition app using cRIO

Hallo Everybody,

I am trying to make an application using LV RT that runs on a cRIO.  I’ve read many of the threads here but I have some fundamental questions before I start bugging you with questions.

 

Just a few words about what I am trying to do. I have a system similar to the AFM but not an AFM. It comprises of an XYZ positioner and a force sensor hanging above the positioner. The positioner receives analog input and gives its position as analog out and the force sensor is also analog. The task is this: the positioner moves in Z-axis against the sensor until a threshold force is reached and then down again to the initial force (i.e voltage), goes to the next (X,Y) point and repeats the former procedure (move up/down). It is crucial that the acquisition is deterministic and the values I read for force, position and time are synchronized. The reason is mainly for post-processing the data.

 

I want to accomplish the following:

1)      control of the positioner’s movement depending on the force sensor’s signal

2)       acquire the data (force, z position and time)

 

I did implement task (1) using a state machine within a timed loop and it works fine when I use it on its own. In the aforementioned loop I read the values of the force sensor directly from the binded variables.

 

 For the acquisition task (2) I use a second timed loop, with lower priority, and in there I pass the value from the variable that is binded to I/O directly to a network-published variable (with buffering enabled) and then on the host pc I read the values from the network-published variable.

 

I see that I have under-/overflow when I try to read the values on the host PC. What should my top priority task be, the control task or the acquisition task? I don’t know if it makes sense but I was thinking something like…

a)Create a timed loop that passes the data from the binded variables to a RT FIFO variable

b) A second timed loop does the control of the positioner by reading the values from the RT FIFO variables and not directly from the binded variables

c)a third timed loop(timed or not?) that passes the data from the RT FIFO to a shared variable and this shared variable is read from the host pc

 

Does the above make sense and if so, is it the best way to achieve what I want? Or should I stick the approach I follow in my very first (quick n dirty) application I wrote? (find the latter attached)

 

I would really appreciate any advice on this! Thanks in advance.

 

Best,

Dimitris

ps: I am using: cRIO-9022, LV 2010, NI-RIO 3.5.1 with Scan Engine

 

0 Kudos
Message 1 of 4
(2,288 Views)

Hi, 

The thing that I am seeing here is too many variables going and coming. From your PC you will sending the position to your cRIO and then you want to display the measured force in your PC, isn't it? the over/underflowing that you see is a lack of sychronisation between the PC and the cRIO.

 

I think that your first approach is a good one: first control the position and the read the force and control the position again depending on the force. 

 

You could use some producer/consumer arquitecture (your producer will receive the values from your variables) and then your consumer can write those values into a file (you can do this in your computer or to log directly in your cRIO, and then you can access to your cRIO by using the browser: https://decibel.ni.com/content/groups/wire/blog/2010/08/10/the-ni-network-browser-is-here.  

Here you have an example of producer/consumer:

https://decibel.ni.com/content/docs/DOC-15453

 

Also, I am sending you some useful information about RT buffered variables:

http://digital.ni.com/public.nsf/allkb/EDC006610A2E4DBB8625794F004F31DC

http://zone.ni.com/devzone/cda/tut/p/id/12176

 

I have also a question, do you want to read the cRIO variables from severals computers or only from your host PC? because if you are going to read only from your host PC you don't need to publish the variables in the network. 

I hope this information will help you

 

Regards

 

0 Kudos
Message 2 of 4
(2,225 Views)

Carmen,

 

thanks a lot for your time and your help.

 


The thing that I am seeing here is too many variables going and coming. From your PC you will sending the position to your cRIO and then you want to display the measured force in your PC, isn't it? 

 


The PC is used only for displaying and saving the data. From the PC to the RT module there is not command/data sent.

 


the over/underflowing that you see is a lack of sychronisation between the PC and the cRIO. 


Is there a way to synchronize the PC and the cRIO or i do it by trial and error?

 

 


I have also a question, do you want to read the cRIO variables from severals computers or only from your host PC? because if you are going to read only from your host PC you don't need to publish the variables in the network. 


Only from my host PC. Thanks for the information, i misunderstood the network publishing..
Best,
Dimitris



 

0 Kudos
Message 3 of 4
(2,217 Views)

Sorry for the misunderstanding, you are running VI in several targets (your cRIO and your PC, so to communicate those VI at least you must enable network publishing). This is done by creating an I/O variable in your cRIO I/O port and then select the option enable network publishing.

 

The PC is used only for displaying and saving the data. From the PC to the RT module there is not command/data sent.

- State machine in your cRIO: basic states: move the sensor, read the force and update the data periodically (could be done with the timed loop). 

- Host computer: read data periodically (also you can use the timed loop) and log the data.

 

To communicate your host computer with your pc you can use also the LabVIEW Simple Messaging Reference Library:

http://zone.ni.com/devzone/cda/tut/p/id/4095

 

After taking a look at your Transfer Data.vi, in which you are working with arrays, avoid constantly using these functions (build array and array subset), because your program uses more data memory and executes more slowly because it is constantly copying data. Please refer to the AVOID CONSTANTLY RESIZING DATA section in the following link: http://zone.ni.com/reference/en-XX/help/371361H-01/lvconcepts/vi_memory_usage/

 

I hope this helps. Have a nice day

0 Kudos
Message 4 of 4
(2,210 Views)