10-15-2009 08:08 AM
Hello
does anyone know a elegant way to share data between a loop running inside a mathscriptnode (process data) and a parallel loop running LV (display UI and DAQ) (2009 RT).
So far I have not found a way other than to write a file to disk and read this file in the other loop. Obviously this is not very clean and RT-compliant solution but for small data transfers at low speed it should do the trick.
In my case the LV daq loop should run at 1K to record and pre-process data (e.g. debounce) and the mathscript loop should run at 50 Hz. Calling the mathscript node at a 50Hz time was not feasible.
Is there a way to e.g. use DMA?
thanks for all input
Pieter
10-15-2009 10:51 AM - edited 10-15-2009 10:51 AM
10-16-2009 03:14 PM
Thanks for the fast response but the problem is not in the mathscript node itself but in the fact that the code inside the mathscript node is a 50Hz while loop. If I would use a LV loop around the mathscript node,instead of the while loop inside MSnode, this would mean that I would have to "open" the mathscript node 50 times a second creating a large CPU load. Would breaking up the node speed up the program? I thought there could only be one MSnode be running at a given time (not multi-threaded yet?)
Access to the LV shared variable would be ideal. does anyone know how to e.g. access LV shared variables (NI-psp protocol) in a parallel matlab routine?
Pieter
10-22-2009 07:50 AM
Is there anyone with some experience for the following
Create a small Vi that reads / writes shared variables (without processing). Compile the vi to a dll. Call the dll inside a mathscript node to read/write shared variables.
would this cause a lot of overhead/performance loss?
Pieter
11-23-2009 10:43 AM
11-30-2009 09:22 AM
Hello Grant
thanks for the answer. I have some additional questions.
I have been running a small test (see image) to check for speed. On a PXI 8106 running this test, which has no separate UI, at 1k loop rate needed 3.7% CPU of which 0.6% went to timed structures. Does this mean that the overhead for calling a mathscript on a RT target is very small? Will this be the same on a windows platform. From what I have been testing the behaviour on a windows platform differs from the one on a RT target or in the case of a compiled program that uses the run-time engine. If I run a mathscript program on my windows machine and call a .m file I can still change the contents of that .m file while my program is running. The next time the mathscript is executed it will execute the new code. Since I can not set a search path for the .m file on the RT target I suspect that the .m file is compiled when the program is deployed and that it is not necessary to transfer the .m file to the target. Is this correct? I did not succeed in calling my own .m file on a RT target yet.
thanks for the help
pieter
12-08-2009 10:48 AM