Jump to content

Grant Mathieson

Members
  • Posts

    3
  • Joined

  • Last visited

Posts posted by Grant Mathieson

  1. On 9/4/2018 at 5:44 PM, attila said:

    Hi @Grant Mathieson

    Sorry but I don't understand what problem you are facing.

    Here the same phase measurement is calculated in Scope and in Script:

    image.thumb.png.fda059b41c2065a607067b4769642b2d.png

     

    Hi Attila,

    Yes, I see that Scope and Scripting can do it, thank you. But I want to get it working in Logger. This is because I have signal changes that occur in the 10 ns to 100 ns timescale, but these occur in response to inputs that change over 0.1 s to 10 s. The Record mode in Scope seems limited by buffer size.  Is it any better in Logger? I also want to log the difference between Ch1 and Ch2, and preferably calculate the AC RMS, Peak2Peak, rise/fall time of that difference in Logger. Those calculations are trivial in Scope. Any advice would be appreciated. I'll keep trying in the meantime. Thank you.  Regards, Grant

  2. Any advice on how to get a phase measurement (between Ch1 and Ch2) included in Logging?

    Digilent offer the following code, which works fine for me on Scope, but not (so far) Logging. I get the error, "Uncaught exception at <anonymous script, id=2091515652512>:6: ReferenceError: Can't find variable: Scope"

     

    Thanks in advance.

    Version from Digilent

    // initialize local variables
    var sum1 = 0
    var sum2 = 0
    var sum12 = 0
    // for better performance get and use local copy of data array
    var d1 = Scope.Channel1.data
    var d2 = Scope.Channel2.data
    var c = d1.length
    for(var i = 0; i < c; i++){
    sum1 += d1*d1
    sum2 += d2*d2
    sum12 += d1*d2
    }
    sum1 /= c
    sum2 /= c
    sum12 /= c
    // last line of code is the measurement value
    acos(sum12/sqrt(sum1*sum2))*180/PI

     

    Version I use on Scope but does not work on Logging

     

    var sum1 = 0

    var sum2 = 0

    var sum12 = 0

    var d1 = Scope.Channel1.data

    var d2 = Scope.Channel2.data

    for(var i = 0; i < d1.length; i++){

    sum1 += d1*d1

    sum2 += d2*d2

    sum12 += d1*d2

    }

    sum1 /= d1.length

    sum2 /= d1.length

    sum12 /= d1.length

    acos(sum12/sqrt(sum1*sum2))*180/PI

×
×
  • Create New...