Hi,
@tst wrote:
Since you're using 8.2, you might wish to look at MGI's read\write anything VIs. They work like the OpenG variant config VIs, but use functionality which was added in LV 8.0 and which makes this much faster and much less resource intensive. I'm not sure if the code works on RT targets, but it might.
Since both the OpenG and the MGI tools are open source, you can just open the VIs and try to figure out how to change them to do what you want.
What's the reason? This is definitely the source of your problems, because TC code should not format data for display and for logging. That should be done in lower priority threads and less frequent. You can transfer the data using a queue.
Olaf Stetzer wrote:
For some reason this has to be done in the time critical part of the software
For some part, the reason is historical. We have two TC loops and one non TC loop. The latter corresponds with the TC loops via RT FIFO's. Since there is data and mesages to be sent, it was decided to communicate via strings and use a custom RT FIFO that uses strings. Maybe not the best solution but it would be a lot of work to change this. If I go with your suggestion we would need even more FIFO's or QUEUE's to communicate between the different loops (we already have 4 currently) because we would need one per datatype.
@tst wrote:
Since both the OpenG and the MGI tools are open source, you can just open the VIs and try to figure out how to change them to do what you want.
What's the reason? This is definitely the source of your problems, because TC code should not format data for display and for logging. That should be done in lower priority threads and less frequent. You can transfer the data using a queue.
How about flattening the cluster to a string and unflattening it on the other side and then converting it for display?
Flattening isn't the best method either when doing TC code, because it also has to play with memory allocation, but it's MUCH faster than the other options.
So I used the MGI write anything as a template for a new version of my formatting routine (I removed the QUEUE and therefore also the nested cluster/array functionality). When using the same format string (this makes a big difference in performance I realized), the old opne G routine needed 2.6 seconds for 1000 cycles on my host PC and the "new" one 3.3, so the old version is still faster. This is for the host PC I did not yet check the performance on the RT target but I guess the tendency will be the same.
@Olaf Stetzer wrote:Hi,
@tst wrote:
Since you're using 8.2, you might wish to look at MGI's read\write anything VIs. They work like the OpenG variant config VIs, but use functionality which was added in LV 8.0 and which makes this much faster and much less resource intensive. I'm not sure if the code works on RT targets, but it might.
thanks for the suggestion. I have downloaded the MGI library and looked at the vi's you suggested. Unfortunately, I need the steps for formatting and writing to a file seperated, and I alos need one tab-separated line per cluster (without element names, that would be too much oberhead for 30-40 values per second to log!)
I also forgot to mention that some cluster elements are floating point values with some without physical units and there are also binary values. I do not have subclusters
though.
Cheers,
Olaf
I did a quick test. I went into NI's VIs and disabled the piece of code which actually does all the stuff. This caused the OpenG code to run in ~0.5 sec, showing that it is indeed NI's VIs which are the problem.
tst wrote:
This includes writing to the file, which in the OpenG code is done by the inefficient NI VIs. I suppose it's possible that part took a lot of the processor time