Oleg Posted December 22, 2023 Share Posted December 22, 2023 I need to record bursts of 1000 samples (10ms) from AnalogIn at a sampling rate of 10MS/s, triggered by another AnalogIn channel. After that there is a dead time of another 10ms before the next trigger. I'm working with WaveFormsSDK. What is the preferred more of operation for such a task - Single Mode or Record Mode? Single Mode seems relevant, but I have a feeling that waiting for trigger status takes too long. Record Mode seems to ignore the triggers, so I'll have to just record continuously (which is an option). Also, which interface should I use for the best throughput: USB or Ethernet? Link to comment Share on other sites More sharing options...
0 attila Posted December 22, 2023 Share Posted December 22, 2023 Hi @Oleg The 10ms should be sufficient for the acqmodeSingle to transfer the capture to the computer and rearm for the next capture. ADP3X50 lets you capture up to 128Mi samples on up to 4 channels at up to 125MHz. For this acqmodeSingle or Record can be used. The acqmodeRecord is intended to be used for larger captures than the device buffer using data streaming. ADP3X50 also provides device buffering (memory segmentation) with <1us latency between captures which can be enabled with FDwfAnalogInBuffersSet. Link to comment Share on other sites More sharing options...
0 Oleg Posted December 27, 2023 Author Share Posted December 27, 2023 Thank you @attila for the feedback. However, I do not seem to get the desired sample rate in such a burst mode. Here's the approach I'm using (based on examples): #set up acquisition dwf.FDwfAnalogInFrequencySet(hdwf, c_double(10000000.0)) dwf.FDwfAnalogInBufferSizeSet(hdwf, c_int(1000000)) dwf.FDwfAnalogInChannelEnableSet(hdwf, c_int(-1), c_int(1)) dwf.FDwfAnalogInChannelRangeSet(hdwf, c_int(-1), c_double(5)) dwf.FDwfAnalogInAcquisitionModeSet(hdwf, acqmodeSingle) dwf.FDwfAnalogInRecordLengthSet(hdwf, 1000) dwf.FDwfAnalogInBuffersSet(hdwf, 100) dwf.FDwfAnalogInTriggerAutoTimeoutSet(hdwf, 0) # disable auto trigger dwf.FDwfAnalogInTriggerSourceSet(hdwf, trigsrcDetectorAnalogIn); # one of the analog in channels dwf.FDwfAnalogInTriggerTypeSet(hdwf, trigtypeEdge) dwf.FDwfAnalogInTriggerChannelSet(hdwf, 0) # 1nd channel dwf.FDwfAnalogInTriggerLevelSet(hdwf, c_double(1.0)) # V dwf.FDwfAnalogInTriggerConditionSet(hdwf, DwfTriggerSlopeFall) dwf.FDwfAnalogInTriggerPositionSet(hdwf, 0) time.sleep(2) print("Starting oscilloscope") dwf.FDwfAnalogInConfigure(hdwf, c_int(1), c_int(1)) tStartTotal = time.time() for cFrame in range(0, 10): tStartFrame = time.time() while True: dwf.FDwfAnalogInStatus(hdwf, c_int(1), byref(sts)) if sts.value == DwfStateDone.value: break time.sleep(0.001) print("Acquisition done") tEndWait = time.time() dwf.FDwfAnalogInStatusData(hdwf, 0, rgdSamples, nSamples) # get channel 1 data tEndGet = time.time() #plot window dc = 0 #sum(rgdSamples)/len(rgdSamples) print(f"Time wait={tEndWait-tStartFrame}, total={tEndGet-tStartFrame}") tEndTotal = time.time() tTimeOverall = tEndTotal - tStartTotal print(f"Time overall={tTimeOverall}, {tTimeOverall/nFrames} per each of {nFrames} frames, {nFrames*nSamples/tTimeOverall/1000000} MS/s") dwf.FDwfDeviceCloseAll() plt.plot(numpy.fromiter(rgdSamples[:6000], dtype=float)) plt.show() This outputs: ... Acquisition done Time wait=0.1982564926147461, total=0.2032620906829834 Time overall=2.1467978954315186, 0.21467978954315187 per each of 10 frames, 4.658100336915946 MS/s 1. Acquisition time is about 0.2 sec for 1M samples at 10MS/s, not 0.1 sec. Without AnalogInBuffersSet it is even slower. 2. Also, it looks that the acquisition is continuous for 1M samples, not 1000 waveforms 1000 samples each. I try to set AnalogInRecordLengthSet for that, but with no success. How do I record by 1000 samples, and then transfer in larger batches? Link to comment Share on other sites More sharing options...
0 attila Posted December 29, 2023 Share Posted December 29, 2023 Hi @Oleg The samples are 16 bits, so 4 channels take 8 bytes, x 1M samples = 8MB, / 40MBps = 0.2 sec to transfer However the captures can be performed much faster, at up to 1GBps, 125MHz x 4 channels See the following example with device buffering: AnalogIn_Buffers.py Link to comment Share on other sites More sharing options...
Question
Oleg
I need to record bursts of 1000 samples (10ms) from AnalogIn at a sampling rate of 10MS/s, triggered by another AnalogIn channel.
After that there is a dead time of another 10ms before the next trigger.
I'm working with WaveFormsSDK.
What is the preferred more of operation for such a task - Single Mode or Record Mode?
Single Mode seems relevant, but I have a feeling that waiting for trigger status takes too long.
Record Mode seems to ignore the triggers, so I'll have to just record continuously (which is an option).
Also, which interface should I use for the best throughput: USB or Ethernet?
Link to comment
Share on other sites
3 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now