Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

New User in programming Real time needs help

Hi,
I am new user to Labview Real time. I had experinec in LAbview. I am trying to do a DAQ in Realtime. When I run the application onto the target I see the data acquired displayed in the chart. But now I want to save the data, ...... reading thru the manuals I used the Real time communication Wizard so that I could get the data from the (communication loop) host program.
Now I would like to know what I am doing is correct.
1. I run the Time critical priority loop.vi in the RT Target
2. run the Normal Priority.vi in the RT Target
3. and run the Host.vi in the host computer.

Is this correct.
I dont see acquired data in the front panel chart when running the application. My host computer slows down

I need to save data to the host computer disk. can I do that using the Host.vi running the computer.
Can I program to save the array data that I have the host.vi

I need some help this is my first progrma in realtime any help would be aprreciated.

Thanks

Swam
0 Kudos
Message 1 of 15
(7,495 Views)
Hi Swam,
I understand that you would like some help with transferring data from the RT target to the host computer. The RT Communications Wizard is a great tool to set up your application. The Wizard guides you through the process of setting up communication between the time critical (TCL) and normal priority loops (NPL) as well as the communication between the NPL and the host. For the TCL<-->NPL communication, the Wizard uses RT FIFO Communication. For the NPL<-->Host communication, the Wizard uses TCP/IP communication. This TCP communication is how you transfer the data from the target to the host where you can save it for analysis.
It sounds like you have the correct approach with where you are running the TCL, NPL, and host VI's. If the host VI doesn't reflect the data that you acquire in the TCL, it's possible that your TCL is taking all of the processor's time, and the NPL doesn't have a chance to transfer the data from the target to the host. I recommend that you try using some of the example programs from the LabVIEW Example Finder located on the Help menu. If you can get those working, then we can apply those techniques to your program. The examples that I recommend trying are

"LabVIEW Example Finder >> Toolkits and Modules >> Real-Time >> Communication >> RT FIFO Communication.vi"

"LabVIEW Example Finder >> Toolkits and Modules >> Real-Time >> Communication >> TCP Communication - Host Computer.vi" and "TCP Communication - RT Engine.vi"

You can also find several great documents on our website:

LabVIEW Real-Time Architecture and Good Programming Practices
http://zone.ni.com/devzone/conceptd.nsf/webmain/dc6ee13f8612fc4686256b510066724f?OpenDocument

Real-Time FIFO for Deterministic Data Transfer Between VIs.
http://zone.ni.com/devzone/devzoneweb.nsf/Opendoc?openagent&95659432CC4261CA86256AB8004F3EF8

Deterministic Data Streaming in Distributed Data Acquisition Systems
http://zone.ni.com/devzone/conceptd.nsf/webmain/41CA2262079C570686256E5C005CFF6C

Using the LabVIEW Real-Time Communication Wizard
http://zone.ni.com/devzone/conceptd.nsf/webmain/a6f17ee4adcab99686256d5e0053e210?OpenDocument

Hopefully these will help you get your first RT program up and running. If you have any more questions, please let us know.

Best Regards,
Marcus G.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 15
(7,474 Views)
Marcus,
Thanks for the information. I will let you know what happens

swam
0 Kudos
Message 3 of 15
(7,460 Views)
Hi Marcus,

I get an error network conection time exceeded the error number is 56.
I also see when I run the TCL.vi the NPL.vi shows a broken run button as its subvi(TCL.vi) is running.
The example ran perfectly. I ran the RT engine.vi and then exited properly as mentioned in the example help and started the host.vi.

From the example I understand only two vi's are run . The RT communication wizard creates three vis and I run the order previously mentioned but now its giving me error 56.
I have attached the files from the RT communication wizard. I have a PXI 8187 controller thru a TCP/IP.


Swam
0 Kudos
Message 4 of 15
(7,463 Views)
I also see when I run the TCL.vi the NPL.vi shows a broken run button as its subvi(TCL.vi) is running

Sunswam,

You don't need to run the TCL VI. If you run the TCL VI first, LabVIEW reserves the TCL VI and that is why the NPL VI becomes broken. Just run the NPL VI, this will automatically execute the TCL VI, since it is a subVI within NPL VI. Then switch execution targets to Windows without closing the RT Engine VIs. Open your host VI while the execution target is set to Windows and you should be able to connect to your RT VI.

Gerardo
0 Kudos
Message 5 of 15
(7,451 Views)
Hi gerardo,
I ran the NPL.vi first and the host.vi I have errors. Once when I target the NPL.vi to the RT ebgine and when I hit exit without closing RT engine.
A window pops up saying

"Waiting for RT engine to respond"

and then one more window shows up after sometime saying

"Connection to RT target has been lost. Switching to host Labview".

Also even the example gave errors like above once.
This is happening from the very beginning.

You can run my code that I attached for any posiible errors.

Thanks

swam
0 Kudos
Message 6 of 15
(7,443 Views)
Swam,

You need to include some sleep time into the TC VI, otherwise, all other threads get starved including the thread that executes the NPL code. This is not a bug within LabVIEW Real-Time, rather, the RTOS runs the time-critical thread until completion to ensure determinism. If you never explicitly tell the time-critical thread to take a break, it won't. Unlike Windows, the RTOS will not preempt it.

Use the Real-Time Timing VIs and put a wait within your Time Critical Loop, that should solve the problem.

Gerardo
0 Kudos
Message 7 of 15
(7,431 Views)
Hi marcas,
Now its running good. I have no errors runs perfect.
Now I need to read and store the data from the RT engine to the host thru TCP/IP I have a PXI controller 8187. Any examples or suggestions.

I am trying with the help in your website. Any suggestions

Swam
0 Kudos
Message 8 of 15
(7,423 Views)
Hi Swam,
You're on the right track with wanting to transfer data from the NPL on the RT target to the host VI using TCP/IP. There are quite a few examples both on the website and included in LabVIEW that demonstrate how to transfer data from the target to the host. I recommend using "TCP Communication - RT Engine.vi" and "TCP Communication - Host Computer.vi" example programs that ship with LabVIEW. You can find them in the example finder which is located on the Help menu under "Find Examples". Once the example finder window opens, you can browse to the examples by going to "Toolkits and Modules >> Real-Time >> Communication". Once you get these VI's working, you can modify them to transfer whatever data you need.
Thanks for contacting NI,
Marcus G.
Applications Engineer
National Instruments
0 Kudos
Message 9 of 15
(7,415 Views)
Hello,

I have that create a wizard very similar to Real Time Module Wizard from LabVIEW. My questions is ...? How I do to develop a user interface like RT Wizard ??. What techinques of programming from LabVIEW I have to use??

The important is:
1. From TCL.vi to modify adding RT FIFO (How I modify a VI automatically in LabVIEW????).
2. Generate NPL.vi ( incluiding RT FIFO with TCL and communication with TCP protocol at Host).
3. Generale Host.vi (including communication with TCP protocol at NLP).

I would like to know if it's posible to create something similar.

From here, thanks very much!!!!.

rgds,

Héctor.-


0 Kudos
Message 10 of 15
(6,751 Views)