ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Writing/Reading Speed issues (c#)

Solved!
Go to solution

Hello everyone!
I had serious problems with speed of writing and reading in c#. Ive done tests (look at NI.jpg) and speed of writing is about 2 sec, and reading about 7-8 sec

Its a disaster for my project. This is a peice of my code of reading:

double[] PV=firstchannelsInterpol[0].GetData<double>();
double[] SP = firstchannelsInterpol[1].GetData<double>();
double[] OP = firstchannelsInterpol[2].GetData<double>();
double[] OPmin = firstchannelsInterpol[3].GetData<double>();
double[] OPmax = firstchannelsInterpol[4].GetData<double>();
double[] PVmin = firstchannelsInterpol[5].GetData<double>();
double[] PVmax = firstchannelsInterpol[6].GetData<double>();
Int32[] Mode = firstchannelsInterpol[7].GetData<Int32>();
string[] Time = firstchannelsInterpol[8].GetData<string>();

Am I doing smth wrong?
Thanks

0 Kudos
Message 1 of 10
(4,146 Views)

How did you configure your task and the sampleclock? I had a similar problem when i read at high frequencys. I could fix it for me with changing the setup of the sampleclock.

_mainTask.Timing.SampleTimingType = SampleTimingType.SampleClock; // To slow. 
_mainTask.Timing.SampleTimingType = SampleTimingType.PipelinedSampleClock; // Fast, no problems.

Also, what device are you using?

0 Kudos
Message 2 of 10
(4,114 Views)

In real project I receive data from OPC. But now  generate it. Im using this article https://www.ni.com/en/support/documentation/supplemental/06/introduction-to-labview-tdm-streaming-vi... and there is nothing about sampleclock and task. 
I will really appreciate if you give me some examples or well written articles

0 Kudos
Message 3 of 10
(4,102 Views)

When you generating the data yourself then its strange that you get a timing issues. Maybe this can help you. It is also described in detail in the Measurement Studio help.

 

Learn 10 Functions in NI-DAQmx and Handle 80 Percent of Your Data Acquisition Applications

0 Kudos
Message 4 of 10
(4,099 Views)

Thanks, I will read it. But what do you think about the article I gave. Is it not modern?

0 Kudos
Message 5 of 10
(4,095 Views)

I used the same for my TDMS Streaming helper class but its more about streaming data to a file and not reading from a device.

measuredData = channels[0].GetData<double>();

Is used to read data from an aleady opened TDMS file.

0 Kudos
Message 6 of 10
(4,085 Views)

Im creating a database based on tdms. So I have to read from an opened tdms file.

0 Kudos
Message 7 of 10
(4,081 Views)
Solution
Accepted by Rob777

In this case if you really want faster read times you can defragment your TDMS file before reading or consider using a faster harddrive like a Solid State Disk. The bottleneck is probably your Drive/IOPS. As far as i know there is not much that you can do software wise to speed up the read and write operations except defragmenting the TDMS files.

0 Kudos
Message 8 of 10
(4,071 Views)

My academic supervisor made similar tasks by LabView and speed is very high about 200 ms. Maybe problem in measurement studio's functions, i dont know

0 Kudos
Message 9 of 10
(4,062 Views)

Defragmentation really helped me. Thank you!

0 Kudos
Message 10 of 10
(4,053 Views)