SCPI is a programming language for controlling instrumentation using a computer. It consists of ASCII characters, sent over Ethernet, USB, GPIB, RS232. Many test equipment vendors offer libraries and tools for their equipment. Serving as the bedrock of test engineering, it’s reach spans the engineer’s test bench to the manufacturing production line, with broad support across the test equipment vendor community. However, the S in SCPI stands for "Standard", not "Simple". Using it in conjunction with contemporary computer science fundamentals such as conditional statements, loops, and comparisons, with appropriate logging, error handling, and resiliency, requires a solid foundation in both software programming and the specifics of the hardware you are using in your test. We’ve recently introduced an open source, Python based, multi-instrument, "hardened" software application, called Simple-SCPI, that can be used for simple bench testing as well as more sophisticated design validation. While there are many examples of Python scripts that are freely available for specific instrument use cases, none of them were good solutions with failure recovery, logging, and multi-instrument control. We've designed ours from the ground up with those capabilities included to provide an extensible and resilient tool for users. How it works: Getting started is easy. It requires downloading and installing free software packages, via our instructions on Github. Once installed, the user creates a configuration file for instrument control. It contains addressing details (e.g. TCP/IP address resource string) and any additional SCPI related commands and control features. Then all the user needs to do is execute the scpi_runner.py program and it reads the configuration file and processes the SCPI commands accordingly. The basic steps for getting started are available at the Github repository. In this blog post, there are more detailed examples for various use cases that may prove helpful, ranging from simple, to more advanced. Examples: These examples use a Rigol oscilloscope connected via an ethernet cable to a Windows laptop. This example would apply to any instrument that supports SCPI, though some of the SCPI related commands may vary. #1: Perform *IDN? query A common SCPI command in test plans includes using the *IDN? query to collect instrument specific metadata such as manufacturer and model number, serial number, firmware version, etc. To do that, using simple-scpi, create a configuration file that includes the address of the instrument, and then the command for obtaining instrument info (*IDN?).
The below log output shows the output into the terminal after running the scpi runner application. It shows the instrument being initialized, the script construction, and then the response to the SCPI commands. The response to the *IDN? is: RIGOL TECHNOLOGIES,DS2202A,DS2D180100040,00.03.05.SP1 Log Output
#2 Take voltage measurements in 1 second intervals for 5 seconds using GradientOne commands Now imagine you wanted to take waveform measurements in 1 second intervals. The command is: :MEASure:VAMP?. Additionally, in this case, you also wanted to do this over a 5 second period. We've also added a host of GradientOne specific commands. In this case, to add a delay to your script in between commands, use a GradientOne provided command that inserts a user specified delay G1:Sleep(<NumberOfSeconds>) . To simplify and minimize errors we've also provided loop commands G1:StartLoop:Max=<NumberOfTimes>. In this example we will have a 1 second sleep and will perform the loop 5 times. More details of the GradientOne specific commands are available in the Github repository.
See below for the log output which includes the voltage measurements, in 1 second intervals. Log Output
#3: Save a screenshot of the Rigol DS2202A Saving the screenshot of the instrument is a common task. For many instruments there may be multiple SCPI commands and other data manipulation required to get the screenshot saved. We've designed in a framework to allow for abstracted, common sets of SCPI commands such as fetching a screenshot, to be reduced to a one line entry in your configuration file. In this case, you can use the GradientOne specific command: G1:FetchScreenshot. In a future blog post, we will walk through how to add a new instrument that supports this type of command.
Log Output
Below is the screenshot that was saved: #4 Save the waveform of the Rigol DS2202A Similar to saving the screenshot, saving a waveform is also a multi sequence set of SCPI commands with post processing of the data. We have also streamlined this set of commands to the GradientOne specific command: G1:FetchWaveform.
Log Output
Waveform JSON Excerpt
Summary
Simple-SCPI provides a quick, easy to use, free tool for a variety of test automation use cases, from the hobbyist to the compliance lab. It is also possible to use it in conjunction with the GradientOne service that automatically archives and plots your waveforms and screenshots. In the next blog post we will show you how that works. If you're interested in learning more about his, feel free to reach out and we can help you get started.
0 Comments
Current events highlight the need for enabling efficient and effective remote work environments around the world. The impact on test engineers and lab managers is particularly acute due to the needs of accessing equipment and instrumentation in a lab. If lab access is restricted, how can teams minimize the impact to product development while maintaining high levels of quality and test coverage? This post will highlight different ways GradientOne can help support remote instrument control and collaboration via automatic waveform upload when lab access may be limited. Remote Instrument Control With lab access potentially limited the test engineering function will be impacted by challenging access to instruments, developing test plans, and accessing/viewing test data in a collaborative approach. Some tools such as VPNs and Remote Desktop Software have historically been used to address some of these issues, but they come with various limitations. GradientOne’s approach is purpose built from the ground up to leverage contemporary technologies to enable instruments without the need of any software installed on the computer trying to access the instrument. Regardless of whether it is a laptop, desktop, tablet, or smartphone, a user can securely log into a portal via a web browser, select an instrument to use, and then configure the device and execute tests. Below are example use cases of how an engineer might use GradientOne to control instruments and run tests remotely:
Automatic Upload of Test Results Another common challenge in remote environments is accessing the test results and archiving them for review, report generation, and collaboration. Our approach provides an automatic upload capability of every bit of relevant information from the test and index and archive it in the secure GradientOne cloud or a local server in the customer environment for users to access at any point in the future:
Enabling remote lab operations historically has required home grown solutions or technology designed for a different purpose, shoehorned into the lab environment. In our next post we'll describe how we can help make data driven decisions around instrument asset utilization to optimize budgeting and lab allocations to meet your current operating environment. We've developed an approach from the ground up, to address these issues in a way to simplify and streamline remote or local work flows. We offer this to customers directly or via consulting services. If you'd like to learn more click below to let us know how we can help.
With every new technology inflection point, Test Engineering teams have embraced these benefits to accelerate time to market, reduce costs, and build higher quality products. Internet technologies, powered by the web browser and cloud computing ushered a new opportunity for organizations to further advance the productivity of the test engineering function while unlocking new capabilities associated with test data analytics and collaboration. GradientOne provides a new approach to simplify the adoption of web technologies in test engineering by giving customers a 'Plug and Play' solution to programming instruments using SCPI in three simple steps.
The dividends this approach pays for customers compounds over several dimensions:
Whereas before, customers had to develop their own abstraction layers, API libraries, databases, and user interface/visualization tools, GradientOne has already taken care of this. Simply download the client software, open a web browser, and start running tests. You can try it here at our free customer facing demonstration site: https://examples.gradientone.com If you want to see how it works in your own lab, get started with a 14 day free trial. Capturing data with an oscilloscope is straightforward but once you have the data it can be pretty tricky to dig into. That’s where GradientOne’s web interface can help! With the aid of the data visualization tool D3, and the power of web browsers, we enable you to easily recall saved results and explore what you have captured. In this blog post we will take a closer look at a few of the features available, how they work, and how they can help you make the most of your data. We'll also provide you with example code that can be used as a reference. Let’s start by loading a saved result from the Results Library, in this example we will be looking at a result from a Rigol DS1054Z oscilloscope. TOOLTIP: First let’s take a look at the Tooltip. It’s easy to use, simply move your cursor across the plot window and the Tooltip will snap to the closest data point, giving you a quick look at the x, y values of your plot. It works by calculating the nearest data point to your cursor location and displaying its value. Take a look at the code snippet below for details. ZOOM: Now that we have something to look at lets explore a bit using the Zoom feature. Using the left hand menu select ‘Zoom’, once activated this feature allows you to use your cursor to draw a rectangle around the part of the waveform you want a closer look at. It’s really that simple. This feature works by taking the dimensions of the rectangle dawn on the plot and calculating a new plot scale. The scale feature in D3 makes it easy to convert from pixel dimensions to plot scale. Take a look at the code snippet to see how it’s done. Overlay: GradientOne’s Overlay feature is a great way to compare two sets of data and identify discrepancies. Start by selecting two or more results of interest from your library then click ‘Overlay Results’ at the bottom left of your screen. When the page loads the first two results will automatically be overlaid on top of one another. Use the thumbnails at the top of the screen to select different results for overlay. Some of the more advanced features are disabled while using Overlay, however the Tooltip and Zoom are still available to use at your convenience. In order for Overlay to work the selected results must be compatible, i.e. have channels and y_values in the data. Once the data is gathered and compatibility is established, it’s just a matter of combining the channels and scaling the plot appropriately. Check out the code snippet for details. Example Code: Tooltip
Example Code: Zoom
Example Code: Overlay
GradientOne's approach to test automation provides a simple way to implement a global test solution for your organization. One of the key design tenets enabling this capability is an API-First philosophy. This provides a simple and consistent interface to our instrument/DUT programming, data acquisition, waveform visualization, and analytical features. This also helps customers use existing scripts and test programs they are currently using to test hardware, while also using GradientOne for data acquisition, search capabilities, and analysis. This post will provide an example of how to use the open source SCPI Runner provided by GradientOne to control multiple instruments, while storing the results on GradientOne's platform. Though this example uses the SCPI Runner which is written in Python, customers can use their own scripts, written in any language, to achieve the same results. 1) Setup: The function generator on the Tek MDO3012 is connected to Channel 4 on the RIGOL DS1054Z. 2. Script outline: This script will configure a Rigol 1054Z oscilloscope to trigger and acquire a signal on channel 4. The signal is a sine wave created by a Tektronix MDO3012 Function Generator. A few details about the script:
Example Script
3. Run the script: Terminal output
4. View the results: When the script runs, it provides the user with links to the screenshots and waveforms that are stored on the GradientOne cloud: Screenshot: 2019-08-20 11:45:06 :: [ INFO ] You can view the result at: https://gradientone-acme.appspot.com/results/R6154227045793447 Waveform: 2019-08-20 11:45:12 :: [ INFO ] You can view the result at: https://gradientone-acme.appspot.com/results/R9283269107066087 This is just one example of how to combine the use of your existing test automation scripts with GradientOne's cloud platform for storing results, collaboration, and visualization. Documentation is available here if you'd like to learn more about the analytical features that can be used for test results that are stored on GradientOne's servers.
If you are interested in seeing how your own scripts might work with GradientOne's cloud platform, click below to get started for your free trial. GradientOne supports rich interactions between instruments and cloud databases. These include industry standard protocols such as SCPI, VISA, and VXI11. Data derived from the frequency of instrument's interaction with the database as well as information in the embedded operating system support a range of utilization estimates. This utilization data is presented to the user with automated reporting using bar graphs, pie charts, and other trend data. For the cases where customers have custom applications they need to use in conjunction with utilization data, GradientOne provides users with an API or downloadable CSVs to get access to data in its more raw form. This blog post will walk you through how to use the API to run custom queries for utilization data and generate CSV and JSON files containing the data. Step 1: Download Configuration File First, download your configuration file. The configuration file manages the authentication and access details to perform queries. The name of the file must be: "GradientOneConfig.txt" The file includes the following:
Example GradientOneAuthConfig.txt
Step 2: Download the sample API script The GradientOne API offers a wide range of capabilities for uploading and downloading instrument usage data. We've generated an example program written in Python you can execute. Step 3: Run the API query For this example, I will run a query against https://examples.gradientone.com to obtain a days worth of utilization data for an oscilloscope in the GradientOne lab. Its asset_id is GradientOne_Keysight_600MHZ. The time arguments are in UTC. You will need to adjust accordingly for your time zone. I am running this program from the Pacific time zone, so a full day would be from 07:00 to 07:00. The query requires these arguments: asset_id -- the unique identifier string of the asset of interest (GradientOne_Keysight_600MHZ) start_date -- start date of the query (2019-07-17) start_time -- start time of the query (07:00) end_date -- end date of the query (2019-07-18) end_time -- end time of the query (07:00) mode -- query GradientOne API for minute or hourly summaries (hours or minutes) > python utilizationInfo.py GradientOne_Keysight_600MHZ 2019-07-17 07:00 2019-07-18 07:00 hours <Response [200]> The Response [200] means that the query was completed successfully. The data are available in the JSON and CSV files: GradientOne_Keysight_600MHZ_avg_CPU.json GradientOne_Keysight_600MHZ_avg_CPU.csv This returns 24 hours worth of data. Below is an example hour, which would be available in the .json file. Interesting takeaways are:
Example hour:
This script also generates a CSV file. This shows the average CPU for a given hour and how many minutes the instrument was online during that hour. It contains the below information: Example CSV file
Example Python Script
If you'd like to see how this works in your environment, start your free trial today by clicking on the below link.
Building a test lab for an engineering team is easily a million dollar investment. Test equipment, chambers, networking gear, and PCs are 'must-have' assets that test engineers use to successfully do their job, yet oftentimes finance teams have limited visibility into their actual usage and status for reporting purposes. We've recently published an application note that describes how customers can use GradientOne's utilization reports to help provide both engineering leadership and the finance team with information they need to better optimize existing investments in lab gear, as well as improve budgetary planning for future equipment acquisitions.
Learn how to join data from GradientOne's utilization reports and a company's fixed asset register to help finance and engineering teams take specific actions that improve productivity and save money. Read this application note to view:
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.
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. |