Why Am I Getting Error -1074116198, When Using Fetch More Than Available Memory

Updated Aug 15, 2018

Reported In

Software

  • LabVIEW

Issue Details

I am using NI-Scope Fetch More than Available Memory attribute in order to stream more data into my digitizer, but I am getting the overwrite error shown below.
I did not expect to get this error, since I am telling the device to read more than available memory. Why am I getting Error -1074116198?

Solution

There may be several reasons for receiving this error:
1. You are expecting the Fetch More than Available Memory attribute to cause your digitizer to act like a benchtop oscilloscope (that is not what this attribute is designed for.)
2. The Fetch Record Number attribute is not updated in your porgram before each Fetch function call.
3. One of several subsystems is creating a "bottleneck" effect and limiting your overall streaming capacity.
4. You have requested an acquisition which is beyond the capabilities of your hardware.
 

Additional Information

Detailed explanation:
Before discussing the four main reasons for this error, it is important to understand the purpose of the Fetch More Than Available Memory attribute and how memory is allocated on a digitizer. Suppose each sample is 1 byte, as in an 8-bit digitizer like the PXI-5114, and for the device there is a maximum 8MB/ch.  Depending on how many samples are in each record, there is a maximum number of records that can be acquired and held onto the 8MB/ch digitizer onboard memory at one time. If we are using the full digitizer memory, then as we increase the number of digitizer records, the maximum number of samples per record decreases. This can be represented graphically. 
This particular graph is given as an example of an 8MB digitizer. You can compare the number of records and number of samples per record ("record length") with this graph to estimate whether or not your acquisition will require the Fetch More than Available Memory attribute to be set to TRUE or FALSE (default). If the number of records and samples per record you have requested lies below the line (in the gray shaded area) then you can set the attribute to FALSE (all memory can be stored on the digitizer at once.) However, if these two parameters lie above the line (in the white region, where the X is), then you must set the attribute to TRUE (the acquisition will rely on fetching while acquiring). Theoretically, the curve of the maximum number of records vs the maximum number of samples per record is a straightforward calculation:
Number of Records * Number of Samples per Record * Sample Resolution = Total Onboard Digitizer Memory
As an example, we could request 16 records at 1M samples per record on an 8-bit PXI-5114 digitizer with 8MB of memory per channel:
16 [records] * 1e6 [samples/record] * 8 [bits/sample] = 8 MB/channel = 16 MB total
However, the actual number of samples per record (record size) will be slightly lower due to memory overhead requirements. The Allocated Onboard Memory per Record section of each digitizer's specifications document explains how to mathematically determine exactly how much memory is required for each record. However, it is not necessary to manually calculate this. The NI-SCOPE driver will automatically calculate the maximum number of samples per record and will provide an Error -1074116198 whenever the limit is exceeded with the Fetch More Than Available Memoryattribute set to FALSE.

Of course, you may try to fetch data in your software program while an acquisition is running on the digitizer (reading from the digitizer while the digitizer is still acquiring data.) This is known as "fetch while acquiring". However, as long as the Fetch More Than Available Memory attribute is set to FALSE, and your acquisition parameters exceed the available memory of the digitizer, you will continue to receive the Error -1074116198.
Now, if we change the Fetch More Than Available Memory attribute to TRUE, the NI-SCOPE driver no longer reports Error -1074116198 when the maximum memory of the digitizer is exceeded. Instead, setting this attribute to TRUE means the software program takes responsibility for fetching data off the digitizer to the host quickly enough to keep up with the digitizer acquisition. In other words, by setting the Fetch More Than Available Memory attribute to TRUE, the NI-SCOPE driver relies upon fetching while acquiring. If the fetch commands do not transfer records quickly enough to keep up with the acquisition, eventually the NI-SCOPE driver will return Error -1074116198.

1. The first common mistake with using the Fetch More Than Available Memory attribute is that it is often misunderstood as an attribute that allows a digitizer to operate like a continuously acquiring benchtop oscilloscope. There are two things wrong with this idea.
First, a benchtop oscilloscope in it's regular "running" acquisition mode does not acquire continuously. A benchtop oscilloscope will acquire one record, display it, and then immediately grab another record. This means there are samples in-between records that are never displayed to the user. If a benchtop oscilloscope is set to trigger off of a signal level, it will appear to pause or freeze indefinitely until that trigger arrives. This is also the functionality the NI-SCOPE Soft Front Panel (SFP) incorporates. However, when writing an application using the NI-SCOPE driver, if a trigger is not received within a user-specified timeout (default of 5s) then the driver will throw a timeout Error -1074126845 Please reference KB 5EOHKJIE for more information on Error -1074126845.
Second, the misunderstanding is that this Fetch More Than Available Memory attribute will cause a digitizer to operate in this acquire, display, and repeat mode described immediately above. (The NI-SCOPE Soft Front Panel operates in this fashion.) This attribute is designed for streaming applications, which are not native to benchtop oscilloscopes or the NI-SCOPE Soft Front Panel.
To make a digitizer run continuously as a benchtop oscilloscope typically does, please set the Auto Triggered attribute to TRUE. Setting this attribute to TRUE will return whatever samples are available if a trigger was not received within the specified time limit, meaning the Error -1074126845 will no longer be reported.

2. A second reason you may encounter this error is because your program does not update the Fetch Record Number attribute within your fetching loop. The Fetch Record Number attribute is basically a read pointer. If you do not update the read pointer after each completed read, you will be reading the same record(s) several times. The NI-SCOPE driver will throw the Error -1074116198 just before it overwrites records that have not been read. If the Fetch Record Number attribute is not updated after each read, you may be receiving this error and erroneously think that you have hit the limitation of your digitizer's streaming capability. The Community Example niScope Multi Record Fetch More than Available Memory - Prevent Overwrite, linked below, demonstrates how to correctly fetch while acquiring, and how to correctly update the Fetch Record Number attribute.

3. A third reason you may encounter this Error -1074116198 is that there is a bottleneck in one of the sub-systems of your system implementation. For instance, there is a data throughput (usually in MB/s) limitation to any bus, any disk or memory reading/writing, and any digitizer product. There are several examples which can help identify a bottleneck in each of these systems:

Community Example Benchmark Loop Iteration Time with Tick Count Timer can be used to determine how long a certain subset of code, such as the Fetch function, requires to complete. Generally, the more data you specify to transfer with each Fetch function call, the more efficiently the data will transfer. Slow transfer speeds using this example will indicate either indicate inefficient code, a busy bus, a bus bandwidth limitation, or a memory DMA or copy limitation from the digitizer to host memory.

LabVIEW shipping example Write to File Speed Test can be used to identify the data throughput speed from your host memory to disk, if you are performing FIle I/O operations on your data.

There are several other streaming examples, which can be obtained at the Community ExampleScope Streaming Example, which combine these elements into a complete streaming example program.

Suggestions for how to avoid this error in this case are given with the error message (in the error description itself).

4. Finally, if the other causes of this error have been ruled out, your acquisition requirements may exceed the needs of your controlling hardware or your digitizing hardware. If you suspect this is the case, you may contact National Instruments technical support at ni.com/ask for further guidance and for help with evaluating other options.

WAS THIS ARTICLE HELPFUL?

Not Helpful