Author Topic: Fastest way to get sample memory out of Rigol scope???.......  (Read 3838 times)

0 Members and 1 Guest are viewing this topic.

Offline SmokeyTopic starter

  • Super Contributor
  • ***
  • Posts: 2536
  • Country: us
  • Not An Expert
Fastest way to get sample memory out of Rigol scope???.......
« on: November 26, 2015, 06:10:14 am »
What's the fastest way to dump the full 24Mpoints sample memory to a PC?  I'm up for using any interface, driver, and OS.

Using the python library and Ethernet, it takes about 65 seconds to transfer 12M.  That's the best I have done so far.
https://github.com/pklaus/ds1054z

Can the labview drivers do better?  Is USB faster than ethernet?
 

Offline Gribo

  • Frequent Contributor
  • **
  • Posts: 629
  • Country: ca
Re: Fastest way to get sample memory out of Rigol scope???.......
« Reply #1 on: November 26, 2015, 12:38:00 pm »
LV won't help you in this case, neither will USB. The SCPI communication protocol (not very efficient) sits on top of TCP, which also has a certain overhead. If the Rigol scope supports some sort of binary protocol over UDP, you might be able to get better results.
I am available for freelance work.
 

Offline Karel

  • Super Contributor
  • ***
  • Posts: 2214
  • Country: 00
Re: Fastest way to get sample memory out of Rigol scope???.......
« Reply #2 on: November 26, 2015, 12:47:18 pm »
Last time I tried, DSRemote downloaded 24Mpts in 90 seconds (one channel).
 

Offline SmokeyTopic starter

  • Super Contributor
  • ***
  • Posts: 2536
  • Country: us
  • Not An Expert
Re: Fastest way to get sample memory out of Rigol scope???.......
« Reply #3 on: November 26, 2015, 05:33:46 pm »
Cool.  I was not getting very good performance from dsremote but i was running it on a virtual machine so that might have had something to do with it.  Dsremote uses the python library too.  Dunno.
 

Offline Karel

  • Super Contributor
  • ***
  • Posts: 2214
  • Country: 00
Re: Fastest way to get sample memory out of Rigol scope???.......
« Reply #4 on: November 26, 2015, 06:38:27 pm »
Dsremote uses the python library too.

No, it does not.
 

Offline SmokeyTopic starter

  • Super Contributor
  • ***
  • Posts: 2536
  • Country: us
  • Not An Expert
Re: Fastest way to get sample memory out of Rigol scope???.......
« Reply #5 on: November 26, 2015, 07:49:36 pm »
The python lib github listed dsremote and i just figured that it was under the hood.  Ill have to see what the difference is between the two transfer functions. 
 

Online Mechatrommer

  • Super Contributor
  • ***
  • Posts: 11535
  • Country: my
  • reassessing directives...
Re: Fastest way to get sample memory out of Rigol scope???.......
« Reply #6 on: February 06, 2016, 03:26:48 pm »
maybe not that stellar and not your cup of tea, just for the sake of sharing, others may benefit. Windows environment, my testing construct program... 62.5 Seconds copying 24MB points... below is the code snip in VB, not your cup of tea again :P hmm, feel free to comment ... FWIW

Code: [Select]

'return data length given by visa/dso. dat must be preallocated with enough (lpLength) amount of memory
Public Function GetData(chId As Long, dat() As Byte, ByVal lpLength As Long) As Long
    Const TMC_SIZE = 11 'base-0 array index value
    Const MAX_BLOCK = 125000

    Dim datPtr As Long
    Dim datIdx As Long
    Dim blockSize As Long

    'multiple block read
    Dim sta As Long
    Dim enn As Long
    Dim lft As Long
    Dim req As Long
    Dim fCancel As Boolean

    If Not Connected Then Exit Function

    'check index and send command
    If chId < CH1_IDX And chId >= MATH_IDX Then Exit Function

    'make sure dat is allocated
    If lpLength <= TMC_SIZE Then Exit Function

    datPtr = VarPtr(dat(0))
    dat(0) = 0

    'get the return value. older DS1000E FW (TMC_SIZE = 0)
    If protocol = 1 Then
        SendCommand ":WAV:DATA? CHAN" + CStr(chId)
        viVScanf hWnd, "%t", datPtr
        GetData = strLength(dat, lpLength)
        Exit Function
    End If

    'newer DS1000Z FW. check if we are reading multiple block internal memory
    If TrigStat = "STOP" Then
        If Left(MemLength, 4) <> "NORM" Then

            'can read at once
            If lpLength <= MAX_BLOCK Then
                SendCommand ":WAV:STOP " + CStr(lpLength)

            'need multiple read
            Else
                SendCommand ":WAV:SOUR CHAN" + CStr(chId)
                lft = lpLength

                Do Until lft <= 0
                    sta = enn + 1

                    If lft >= MAX_BLOCK Then
                        req = MAX_BLOCK
                    Else
                        req = lft
                    End If

                    enn = sta + req - 1

                    SendCommand ":WAV:STOP " + CStr(enn)
                    SendCommand ":WAV:START " + CStr(sta)
                    SendCommand ":WAV:DATA?"

                    viVScanf hWnd, "%t", datPtr
                    blockSize = getTmcDataSize(dat(), datIdx)

                    'we have copied data
                    If blockSize > 0 Then
                        CopyMemory dat(datIdx), dat(datIdx + TMC_SIZE), blockSize
                        datIdx = datIdx + blockSize
                        datPtr = VarPtr(dat(datIdx))
   
                        'partial data copied, offset enn
                        If blockSize < req Then enn = enn - (req - blockSize)
                        lft = lft - blockSize

                        'callback for copy progress
                        RaiseEvent Downloading(blockSize, lpLength - lft, fCancel)
                        If fCancel Then Exit Do

                    'zero data copied, quit
                    Else
                        Exit Do
                    End If
                Loop

                'reset memory position
                If sta > 1 Then
                    SendCommand ":WAV:START 1"
                    SendCommand ":WAV:STOP " + CStr(RIG_SCREEN_RES_V2)
                End If

                GetData = lpLength - lft
                Exit Function
            End If
        End If
    End If

    'reading single block at once
    SendCommand ":WAV:SOUR CHAN" + CStr(chId)
    SendCommand ":WAV:DATA?"

    viVScanf hWnd, "%t", datPtr
    blockSize = getTmcDataSize(dat(), datIdx)

    If blockSize > 0 Then CopyMemory dat(0), dat(TMC_SIZE), blockSize
    GetData = blockSize
End Function

'send visa command to rigol, return -1 if not connected
Public Function SendCommand(cmd As String) As Long
    SendCommand = -1
    If Not Connected Then Exit Function
    SendCommand = viVPrintf(hWnd, cmd + Chr(10), 0)
End Function

« Last Edit: February 06, 2016, 03:29:29 pm by Mechatrommer »
Nature: Evolution and the Illusion of Randomness (Stephen L. Talbott): Its now indisputable that... organisms “expertise” contextualizes its genome, and its nonsense to say that these powers are under the control of the genome being contextualized - Barbara McClintock
 

Offline uncle_bob

  • Supporter
  • ****
  • Posts: 2441
  • Country: us
Re: Fastest way to get sample memory out of Rigol scope???.......
« Reply #7 on: February 06, 2016, 06:24:09 pm »
maybe not that stellar and not your cup of tea, just for the sake of sharing, others may benefit. Windows environment, my testing construct program... 62.5 Seconds copying 24MB points... below is the code snip in VB, not your cup of tea again :P hmm, feel free to comment ... FWIW


Hi

Just looking at this from the outside:

If it's running 100Mb ethernet, you get (at most) 6Gb in 60 seconds. With 100% efficiency ( no overhead) that comes out to 750 MB. If you get 24M points (and they are 2 bytes each) you are grabbing 48 MB of data. Either there is a lot more overhead (like 15X), or the LAN speed is not anywhere near your limiting factor.

Bob
 

Online Mechatrommer

  • Super Contributor
  • ***
  • Posts: 11535
  • Country: my
  • reassessing directives...
Re: Fastest way to get sample memory out of Rigol scope???.......
« Reply #8 on: February 06, 2016, 07:49:51 pm »
sorry i didnt mention i thought its understandable. thats a USB2 connection using visa32.dll driver, no ethernet, i dont play ethernet. and its a plain 24 Mega Bytes, not 24 Mega Words... fwiw...
Nature: Evolution and the Illusion of Randomness (Stephen L. Talbott): Its now indisputable that... organisms “expertise” contextualizes its genome, and its nonsense to say that these powers are under the control of the genome being contextualized - Barbara McClintock
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf