Skip to content

Problems detecting ADC Overloads using Python and RSA API #1

Open

Description

@heatherottke

I am using Python and the RSA API to control the RSA306B. I've written the following two functions in order to query the ADC overload status. If I understand correctly, the DEVICE_GetEventStatus API call when the event_id argument is set to zero, queries whether an overload event has occurred. The IQBLK_GetIQAcqInfo call returns the relevant overload status and associated timestamp information.

In order to detect the overload, I injected a CW into the RSA and increased the power until I expected to see an overload (I determined what this level should be by using the SignalVu software), yet my software failed to detect the overload event. I have scaled down and attached my code hoping that you can help me trouble shoot what I may be doing wrong. Thanks in advance!

adcOverload.txt

def query_device_status():
    event_id = c_int(0)
    event_occurred = c_bool()
    event_timestamp = c_uint64()
    rsa.DEVICE_GetEventStatus(event_id, byref(event_occurred),
                              byref(event_timestamp))
    return event_id.value, event_occurred.value, event_timestamp.value


def get_acq_info():
    acqInfo = IQBLK_ACQINFO()
    rsa.IQBLK_GetIQAcqInfo(byref(acqInfo))
    return acqInfo

Activity

  1. tkzilla commented on Jun 19, 2017

    @tkzilla
    Owner

    You are using the function correctly, but don't think it is in the right place in your code. According to the API documentation, DEVICE_GetEventStatus() must be called while the RSA is in the Run state since the device status is not updated while the RSA is in the Stop state. Even then I found that the command should be used directly prior to grabbing acquisition data (e.g. SPECTRUM_GetTrace(), IQBLK_GetIQData(), DPX_GetFrameBuffer(), etc.). It did not consistently update if I used it right after calling DEVICE_Run() or SPECTRUM_AcquireTrace(), only when used right before the XXX_GetXXX() functions.

    Try this out and let me know if that fixes the issue!

    Example below from rsa_api_full_example.py in the acquire_spectrum function:

    def acquire_spectrum(specSet):
        ready = c_bool(False)
        traceArray = c_float * specSet.traceLength
        traceData = traceArray()
        outTracePoints = c_int(0)
        traceSelector = SpectrumTraces.SpectrumTrace1
    
        rsa.DEVICE_Run()
        rsa.SPECTRUM_AcquireTrace()
        while not ready.value:
            rsa.SPECTRUM_WaitForDataReady(c_int(100), byref(ready))
        # Put it here!
        print(query_device_status())
        rsa.SPECTRUM_GetTrace(traceSelector, specSet.traceLength, byref(traceData),
                              byref(outTracePoints))
        rsa.DEVICE_Stop()
        return np.array(traceData)
    
  2. heatherottke commented on Jun 20, 2017

    @heatherottke
    Author
  3. tkzilla commented on Jun 20, 2017

    @tkzilla
    Owner

    Again you're correct that IQBLK_AcquireIQData() puts the instrument in the Run state. I believe the timing of the query_device_status() may not be quite right. Where are you putting query_device_status() in the acquisition section of your code?

  4. Repository owner deleted a comment from heatherottke on Jul 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions