Today we are releasing the first version of our SCPI command application. This is the first of several releases that delivers a Python based, multi-instrument, "hardened" software application that can be used for simple bench testing as well as more sophisticated design validation. There are many examples of Python scripts that are freely available for specific instrument use cases, but when building solutions for our customers we haven't come across many general purpose frameworks that allow for resiliency, failure recovery, logging, and multi-instrument control. We've designed this from the ground up with many of those capabilities included. Read below for more on how it works. Requirements First, you'll need to make sure you have the below software packages installed:
Usage The scpi_runner.py reads a scpi_script file to open a connection with an instrument and send commands. The commands and their responses are logged to a log file. A sample script is provided in scpi_script.sample for you to modify as needed. We've added features in the program to make it more "hardened". These include resiliency features for exception handling and other errors that can be caught without crashing the application. Timeouts The scpi_runner will time out commands and scripts that take too long to run. The command timeouts will raise an exception and run the next command. If the whole script times out then an exception is raised and the remaining commands are not run. These timeouts can be modified by editing the values set in settings.py GradientOne Script Logic The scpi_runner.py supports basic loops and sleeps (delays). The syntax for the GradienOne ScriptLogic objects is not case-sensitive, so G1:StartLoop and g1:startloop are equivalent. To start a block of commands to loop, a StartLoop command is needed. G1:StartLoop:Max=<NumberOfTimes>:BreakOn=<ResponseToBreak> The Max is required, otherwise the block of commands will only run once. The BreakOn is optional. The string G1:StartLoop:Max=3 will start a loop that runs 3 times. You then enter as many commands as needed in the next lines and end the block of code to loop with a line with G1:EndLoop Example: G1:StartLoop:Max=3 *IDN? G1:EndLoop Will run the *IDN? command 3 times. Sleeps To add a delay to your script in between commands, use a G1:Sleep. G1:Sleep=<NumberOfSeconds> For example, to sleep 2 seconds: G1:Sleep=2 This calls python's time.sleep() function to delay running the next line. This can also be used within a loop. Example SCPI Script
1. Establish a connection to the instrument: The above script opens a connection to the instrument using the IP address of 192.168.1.238, which can be found on most instruments network/LAN settings. 2. The next several lines include the SCPI commands *IDN?, *RST, and :SAVE:IMAGE D:\screenshot.png. These commands will obtain basic instrument information, reset the devoce, and download the screenshot to onboard instrument storage. 3. The next two commands are GradientOne specific commands for inserting a sleep and a loop. These are followed by a SYST:ERR? which checks to see if there is an error. 4. The last line is another GradientOne specific command signifying the end of the loop. See below for the example in action: Terminal output
Below is an example of the logging: Log Output
Stay tuned...more advanced features to come.
0 Comments
Oscilloscope Test Automation For Tektronix MDO3012 With Function Generator and RIGOL DS1054Z6/10/2019 GradientOne's test automation can be used to remotely control multiple instruments over the web. In this video we demonstrate how that is done, along with the instrument screenshots and waveforms that are acquired. 1) Setup: The function generator on the Tek MDO3012 is connected to Channel 4 on the RIGOL DS1054Z. 2) Instrument Programming: The RIGOL needs to be programmed to enable channel 4, set the trigger, and the horizontal scale. The Tektronix needs to have the function generator enabled. In this example two types of commands are used: i. A previously stored test recipe of SCPI commands are used to program the test setup. An example is shown below. ii. Abstracted commands for common test routines such as saving the screenshot and waveform. RIGOL DS1054Z Setup
3) Data Acquisition: The data that is acquired from the test setup includes the raw waveform (times and voltages) as well as the screenshot of the oscilloscope and the current instrument settings. This gives engineers the ability to post-process the data, compare it to other results, and collaborate with their teammates. Video DemonstrationHave you ever needed to compare a saved waveform to another waveform? Historically you may have needed to save a waveform on your oscilloscope, then load it on the same screen as a different waveform that you captured. GradientOne offers a new way to do this using your web browser.
GradientOne automatically stores waveforms and metadata when tests are run. So in addition to things like screenshots, test setups, and measurements, the raw waveform data, including times and voltages is stored. While storing the screenshot gives the ability to view what the oscilloscope captured, storing the waveform data itself provides the ability to perform various measurements and analyses, including overlays. In the video below, we show how you can compare waveforms using the overlay feature, use cursors (some engineers refer to these as rulers) to perform custom measurements, and use the integrated collaboration features to review with your teammates. If you are interested in seeing for yourself, give the 14 day free trial a try, it is the best way to get familiar with some of the capabilities of the product. |