8. Speed Optimization
By Speed Optimization in relation to remote-control application, we mean performing a measurement task as fast as possible, but still with reliable and repeatable results.
VISA Trace Tools mentioned in Chapter 3 - VISA and VISA Tools can help you to point to operations taking big amounts of time. Their logs contain timestamps which you can use to calculate measurement task durations.
When starting with speed optimization, always consider your application overhead in relation to the measurement duration. If, for example, an oscilloscope acquisition time is 2ms, reducing your overall overhead from 5ms to 3ms results to approximately 30% speed increase. However, if the acquisition time is 2 seconds, the same overhead reduction leads to only a 0.1% speed increase.
Hints on how to improve the speed of your measurement task:
- Never sacrifice proper measurement synchronization for speed. At the end it costs you more time to debug problems and repeat measurements, than do it properly the first time.
- If you have more than one measurement instruments in your test setup, try to parallelize tasks. For example, you can set up signal generator and oscilloscope in parallel and only synchronize them before an acquisition.
- Do not perform instrument error checking in loops with many repetitions and short acquisition times (less than 10ms). If you use the instrument drivers, switch the error checking off before the loop and switch it back ON after the loop.
- Switch the instrument’s display OFF after you have debugged your application. This usually improves the instrument's performance.
- Try to avoid reading entire traces or waveforms. Rohde & Schwarz instruments offer many trace / waveform evaluation possibilities. You do not need every point of an oscilloscope waveform to evaluate frequency, amplitude or pulse rise time. The instrument provides ready-to-use measurements for such parameters.
- Use the instrument's averaging or maxhold functions for traces and waveforms instead of performing these operations in your application. This saves data transfer time and the measurement triggering overhead.
- Use limit lines and mask functions for the cases when you only need to evaluate simple pass/fail criteria. Transferring the entire trace and evaluating it in your application is unnecessary.
- Rohde & Schwarz instruments are capable of parallel command processing. Always set the parameter that takes the maximum time first. If for example, you set the spectrum analyzer manual attenuator first, then the center frequency and then resolution bandwidth, it is faster than setting them in the reversed order.
- Combine several SCPI commands (separated by semicolons) into one string to send to the instrument; It is faster than sending them separately. In addition, it lets the instrument decide the most optimal order of executing the commands. An example of already mentioned three parameters of a spectrum analyzer – mechanical attenuator, center frequency, resolution bandwidth settings: INP:ATT 50;:FREQ:CENT 2GHz;:BWIDth 5MHz