dScope Series III Programming and Automation
OverviewThe dScope III is essentially a software instrument with a dedicated hardware interface. This becomes increasingly apparent when looking at the instrument's flexibility when it comes to programming and automation. The advantages of a programmable software instrument fall broadly into two areas:
- Custom Measurements and
- Test automation
Custom MeasurementsMany aspects of the dScope measurement system are programmable. This ranges from defining custom presets for measurements that are used repeatedly up to programming custom measurements based on sample or FFT data. Essentially, anything that you can calculate from a buffer of time domain sample data or frequency domain FFT data can be created as a custom measurement in dScope. This extends to user traces which can also be created based on calculations from measured parameters, sample data or FFT data.
AutomationThe dScope, being entirely software controlled, can also be automated in order to perform complex tasks or test sequences. This can be done using the built in automation, or it can be automated from external software. dScope exposes nearly all its methods and properties as ActiveX controls meaning it can be automated from a wide range of third party software from Visual Basic up to C++. Almost anything you can do from the user interface, you can do from the automation interface. There are relatively few exceptions, mainly to do with the less used settings of the trace window. The result of this flexibility is that dScope can run complex test sequences such as production line QC testing, with results logging etc, direct from its own scripting environment, or it can be integrated into other test systems.
How does it work?The dScope software has been written from the ground up to allow it to be controlled and automated. Almost every control on the user interface has an associated ActiveX control that allows it to be accessed by other programs or its own automation interface. Within the dScope, these controls are accessed using "scripts" - short sequences of program code. Scripts in dScope are written in VBScript (Visual Basic Script), a Microsoft language used extensively for automating web sites in ASP. This is well documented and the internet is full of sites offering forums and technical notes about using VBS. Normally a VBScript will be saved with the file extension .vbs, which tells the Windows Scripting Host, built into most recent Microsoft operating systems, how to execute it. While it is possible to automate dScope using .vbs scripts, this would require you to declare the dScope object before you could access it. To make this a little simpler, the dScope provides a variation on the .vbs file with a .dss extension ("dScope Script"). This is essentially still a VBS file, but because of the way it is executed, the dScope object is implicit and you can automate it directly. For example, just writing the line:
and saving it as a .dss file is enough to produce a valid dScope automation file. When executed, this will create a message box that reports what the Channel A RMS amplitude is from the Signal Analyzer. Obviously this is a bit simplistic, but it's a starting point, and from here, the sky is the limit. The Scripts can:
- Change almost any setting on the dScope
- Read almost any parameter from the dScope
- Create, name, export traces, files and results etc. etc.
- Access the Windows File System Object in order to manipulate files and folders, including writing text, HTML, XML files etc,
- Access the Windows Scripting Host Shell Object to execute other programs and access the Registry,
- Create instances of other programs such as Microsoft Excel or Word and automate them (for example, reading and writing to Excel spreadsheets for further analysis or storing results).
- Control other devices that expose their ActiveX controls, this can include other test or control equipment such as IR controllers, relays boxes, digital I/O etc.
- Create user interfaces with buttons, check-boxes, message boxes, drop lists etc. for control of automated test sequences.
Types of dScope ScriptWithin the dScope automation system, there are a range of different types of scripts that are used for different tasks. They are all .dss and they all use VBScript as their language but they differ in the details of how they are used and what you can do within them. The dScope distinguishes between the different types of script by the comments on the first two lines of the script. For example, an Automation Script will have the lines:
' TYPE Automation ' LANGUAGE VBScript
The language is nearly always VBScript, although dScope can technically also be scripted in JScript. The different types of dScope script are:
Automation ScriptThis is probably the most common and easily understood script. It is a general purpose script used to automate the dScope as described above.
Generator Wavetable ScriptThis is a special class of script that is specifically designed to calculate waveforms used in the signal generator. Any waveform that can be mathematically described within the VBScript language can created as a generator wavetable within the bounds of sample rate, word length and buffer size.
FFT Detector Weighting FilterAs well as the built in standard weightings, an arbitrary weighting filter can be generated using a script and applied to the FFT buffer. This script can also access other parameters from the dScope such as the Signal Analyzer frequency reading so as to create adaptive filters.
FFT Window ScriptIf you're not happy with the range of FFT window functions supplied with dScope (which includes some of the very best window functions to be found anywhere), you can create your own. Again, anything you can describe mathematically can be created and added to the list of available window functions.
CT Detector FunctionWithin the Continuous-Time Detector (CTD) dialogue is a function drop-list. This is essentially a collection of presets for all the other parameters that are available such as the bandwidth, filter, relativity etc. Behind the scenes, each one of these is a simple script. You can create more presets by adding more CT Detector Function scripts to the appropriate folder.
FFT Detector Function ScriptAs with the CTD, within each FFT Detector dialogue is a function drop-list which acts as a collection of presets for all the other parameters that are available. Here again, behind the scenes, each one of these is a simple script although now, because of the flexibility of the FFT detectors being able to use custom weightings etc, there are even more possibilities.
FFT Detector Calculation ScriptNot to be confused with a Function script, the Calculation script typifies the power of dScope. This script allows the user to define a calculation based on the time domain sample data or frequency domain FFT data that returns a value directly as an FFT detector reading. An example could be a special meter to measure the statistical properties of a noise signal by analyzing the sample data and displaying, for example, the variance of the data. Again, any numerical value that you can derive mathematically from the sample or FFT data can be displayed as an FFT detector reading. This then becomes available as a normal parameter that can be swept or used as a regulation parameter to control some other setting. This reading can also use custom filters and FFT windows etc. There is almost no limit to what can be measured in this way. (Note that this feature is not available in the dScope Series IIIA)
Sweep Data Table ScriptAs well as conventional sweeps, the dScope can also sweep a wide range of parameters using sweep data tables. These can be generated by a script so as to give additional control over what values are swept and these values can themselves be based on other dScope parameters.
Limit Table ScriptFor graphs and sweep traces, the limit lines can also be created by a script.
Note that for many of the above, the script creates a file of another type, for example, the Generator Wavetable script creates a .wfm wavetable file and the FFT Detector Weighting filter creates a .wtg weighting file. The dScope can either load the created .wtg file (which tends to be faster) or it can load the .dss script, in which case the script is executed each time a new buffer is processed and generation of the file is done on the fly. As an example, with the weighting filter, you could load the script into the FFT detector and it could update every time the FFT is triggered. The parameters used in the calculation could be determined base on some other parameter such as the input frequency, allowing you to measure, for example, the 3rd and 8th harmonic of a varying input signal should you want to do such a thing. Loading the generated weighting filter file would be appropriate if it was a static weighting filter such as A-weighting as it wouldn't need to re-calculate and would be a little faster.
- dScope Scripting Page - scripting examples and resources
- Download the Scripting manual - the full dScope scripting and automation reference