Home

1MA268_e_IVINET_Drivers

image

Contents

1. 2 RsScope IVLNET Instrument Driver Help G f Fint Options Contents index Search Vertical Range Range Welcome Why Instrument Drivers Supported Environments C definition supported Interfaces public double Range get get What s New Getting started and Examples E Instrument Driver Tree Structure Purpose E G RsScope RsScopeProbe El RsScopeChannel Enabled Sets the voltage range across the 10 vertical divisions of the diagram Scale ChannelOffset Bandwidth Limit Figure 3 5 Channel property Range with valid values 0 07 10V If you try to set value outside this defined range the driver doesn t send any command to the instrument and throws the IVINET Internal ErrorException In rare cases an instrument can accept the values outside the driver defined valid range In this case you can disable the driver range checking and send the value to the instrument anyway Since the instrument also has its own checking of valid parameter values it will report an error in its error queue To properly react on instrument errors you need to set the property driver DriverOperation QuerylInstrumentStatus described in the next chapter to true driver DriverOperation QueryInstrumentStatus Default value after initialization true If this property is set to true it causes the driver to query the instrument status byte STB command after every command or query This brings the advantage of detecting an er
2. ing Compared to other drivers VXlpnp LabVIEW where the traces are read into a simple array IVI NET driver uses an IWaveform lt T gt interface or its extensions IMemoryWaveform lt T gt ISpectrum lt T gt IMemorySpectrum lt T gt lt T gt stands for a generic type from which you can choose equivalents to double array 132 array 18 3 8 3 Acquisition and reading waveforms array but not all methods accept all types For example the method FetchWaveform only accepts double or sbyte types Initialization of two new waveforms TWaveform lt double gt waveform CHL null IWaveform lt double gt waveform CH2 null According the IVI NET specification all functions returning waveforms must also have waveforms as input parameters There are 2 main reasons for this e defining the output variable type in this case the waveform CH1 is of double type hence the output from the FetchWaveform will be of I Waveform lt double gt type as well e it allows for reusing the previously allocated resources if the waveform CH1 is not yet initialized null the FetchWaveform waveform CH1 will initialize it with the required capacity number of samples With the subsequent calls of FetchWaveform waveform CH1 the method doesn t do any reallocation of the resources Therefore the performance is optimized by reusing the existing ones To change the size of the expected waveform recordLength you need to use the propertywaveform C
3. 3 8 1 2 ReadWaveform method This method combines calling the RunSingle with the option to define the timeout and reading of one waveform see the equivalent codes below Wavetorm CHL driver Channel CH1 Waveform W0O ReadWaveform timeout waveform CHl1 is equivalent to oldTimeout driver Miscellaneous OPCTimeout driver Miscellaneous OPCTimeout timeout driver WaveformAcquisition RunSingle driver Miscellaneous OPCTimeout oldTimeout waveform CH1 driver Channel CH1 Waveform WO FetchWaveform wavetorm CH 3 8 1 3 Acquisition and reading waveforms Synchronization provided Same as in the case of RunSingle the method ReadWaveform waits until the acquisition has successfully finished If the waiting time exceeds the provided timeout a TimeoutException will be raised RunSingleWithoutWait WaitForMeasurementComplete This method splits the method RunSingle to two separate methods where the user has an option of inserting another action in between the arming of the scope and wait ing for the acquisition to be finished This is often the case when a measurement of non periodical event needs to be recorded Consider the following case A DUT Device Under Test generates a non periodical burst signal after remotely commanded to do so let s call the method DUT GenerateBurst How to reliably acquire this signal Option 1 producing Race Condition DUT GenerateBurst driver Wavef
4. Create directory for solution _ Add to Rational ClearCase must be in a view Adding assembly references 3 1 1 Changing the Active solution platform This settings in Visual Studio allows for changing or adding the target application type 32 bit x86 or 64 bit x64 Avoid using the setting Any CPU and choose the desired target platform explicitly og IMA268_Rs5copeWLNET Microsoft Visual Studio Administrator FILE EDIT VIEW PROJECT DEBUG TEAM CLEARCASE SQL TOOLS TEST ANALYZE TEAM CC O B dl W a Build Solution z Rebuild Solution Clean Solution Run Code Analysis on Solution Program cs 4 X _1MA268_RsScopelVI NET Progra Build 1MA268_RsScopelVLNET Rebuild 1MA268 RsScopelVLNET Clean 1MA268 RsScopelVLNET Publish 1MA268_RsScopelVLNET Run Code Analysis on LMA268_RsScopelVI NET Batch Build Configuration Manager Configuration Manager Active solution configuration Active solution platform Debug Project Configuration IMA268_RsScopelVLNET Debug Type or select the new platform Copy settings from Any CPU Create new project platforms Figure 3 2 Adding new solution platform x64 in Visual Studio 2012 3 2 Adding assembly references The next step is adding references to the assemblies e IVI Driver dll e IVI Scope dll RohdeSchwarz RsScope Fx40 dll Adding assembly references Solution Explorer e 20dg i s f Search Solution Explorer Ctri fr fg Solution LMA268
5. available If you choose an incorrect reference processor architecture you will receive the follow ing warning s Error List T 0 Errors ning 0 Messages Description 1 There was a mismatch between the processor architecture of the project being built x86 and the processor architecture of the reference RohdeSchwarz RsScope Pxd0 Version 1 4 1 0 Culture neutral PublickeyToken 2laccha00227 cd processorArchitecture AMD64 AMD64 This mismatch may cause runtime failures Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project A 2 Assembly generation Referenced assembly RohdeSchwarz RsScope Px40 dll targets a different processor Figure 3 4 Visual Studio 2012 mismatching processor architecture warnings In this case remove the mismatching assembly and add a correct one Initializing of a HISLIP session HISLIP stands for High Speed LAN Instrument Protocol A dedicated application note www rohde schwarz com appnote 1MA208 describes the HISLIP principles and differences to VXI 11 in great detail Initializing a new session is performed by creating a new RsScope object RsScope driver new RsScope TCPIP 192 168 1 100 HISLIPO true true Simulate F
6. content string folderContent driver DataManagement FileDirectoryContent folderPathRTx The response string comes in the following format lt UsedMemory gt lt FreeMemory gt lt ParentFolder gt lt ParentFolder gt lt Polderconbent gt For more details refer to the SCPI query MMEMory CATalog in the RTx user manual region 3 12 Reading RTx Folder List read the hcpy_ file path_RTx content string TolderContent driver DataManagement FileDirectoryContent hcpyFolderPathRTx parse the response the header lt UsedMemory gt lt FreeMemory gt lt ParentFolder gt lt ParentFolder gt Match match new Regex d Ad ADAN AVO AT AN AV Match folderContent if match Success int usedSize Int32 Parse match Groups 1 Value 1624 string info match Groups 2 Value Console WriteLine n nFolder size 1 kb files list hcpyFolderPathRTx usedSize while match new Regex 14 J Match into Success 1 info match Groups 4 Value Console WriteLine File name type 1 size 2 kb match Groups 1 Value match Groups 2 Value Int32 Parse match Groups 3 Value 1624 I endregion Figure 3 24 Code snippet that performs reading and parsing of the RTx folder content response The first match red rectangle parses the header part which is always present The second match blue rectangle is performed in a loop
7. driver this database is called IVI Config Store Because of IVI class standardized API the program works without a further change e Instrument specific interface this part of the driver is not mandatory However if the programmer wants to use the capabilities of an instrument that are beyond the scope of class interface specification he will have to make use of this part of the IVI driver From that moment on the interchangeability feature is compromised For example the lviScope interface class provides the capability of changing the vertical horizontal scale input coupling basic trigger settings reading the acquired traces etc But the advanced features that the R amp S RTx offers e g math FFT bus protocol analysis Power analysis Mixed Signal characterizations are only available in the instrument specific IVI driver interface Application Note IVI NET 1MA268 Oe 6 Introduction to IVI drivers The common component of all the IVI drivers IVI Engine was build to communicate with ANSI C libraries only As a consequence in order to use ANSI C IVI class driver API e g the function Viotat s Iviscope init iksre Logical Name Viboolean ID Query ViBoolean Reset Device ViPSession Instrument Handle in your code you have to use an IVI C driver The IVI COM and IVI NET drivers need an adapter that converts the class driver calls to ANSI C formats Currently these exist only for IVI COM IVI NET adapters are s
8. nGeneral error occured n exception Message n nStackTrace n exception StackTrace Figure 3 28 VINET Internal ErrorException catch case 3 13 3 3 13 4 3 13 5 Handling of exceptions lvi Driver DataArray TooSmallException The next catch case handles the exception coming from IVI library called Ivi Driver DataArrayTooSmallException that is raised by e g the FetchWaveform method in case the given waveform capacity is smaller than the data to be read from a device 3 13 3 Ivi Driver DataArrayTooSmallException handling catch Ivi Driver DataArrayTooSmallException exception exceptionMessage nError waveform array is too small for the datan exception Message n nStackTrace n exception StackTrace Figure 3 29 Ivi Driver DataArray TooSmallException catch case System TimeoutException System TimeoutException is generated e g by the method driver WaveformAcquisition WaitForMeasurementComplete 3 13 4 System TimeoutException handling catch System TimeoutException exception exceptionMessage n5ystem operation timeout occured n nStackTrace n exception StackTrace Figure 3 30 System TimeoutException catch case Case finally Using the block finally ensures that this code is performed always regardless whether any exception was raised or not Usually it is the place to call all the cleanup methods in our case closing of the session and showing the er
9. with repeat workaround on page 34 Chapter 3 15 Extended method for synchronization on page 35 Note that the region pragma names in the attached example correspond to the chapter names in this application note E g chapter 3 11 Hardcopy describes the part of the example code enclosed by the region 3 11 Hardcopy Creating new Visual Studio project To create a new project in Visual Studio select File gt New gt Project NET Framework 4 5 Sort by Default c Windows Forms Application m WPF Application lt m gt c G Console Application mci icati e ASP NET Web Forms Application cH al Class Library c a Portable Class Library c _ ASP NET MVC 3 Web Application LightSwitch c gt b Other Languages ASP NET MVC 4 Web Application b Other Project Types a Samples c gt Visual C FG Silverlight Application c b Online gi Silverlight Class Library c FG Silverlight Business Application c ld WCF RIA Services Class Library Name 1MA268_RsScopeConsolelVI NET sIn Location C DriverTests IVI NET RsScope Solution name 1MA268_RsScopeConsolelVLNETsIn J Figure 3 1 Visual Studio New Project window Visual C Visual C Visual C Visual C Visual C Visual C Visual C Visual C Visual C Visual C Visual C Visual C Search Installed Templates Ctrl E Type Visual C A project for creating a command line application v
10. 4 seconds idnResponse repetitions stopWatch Elapsed TotalSeconds repetitions idnResponse driver Miscellaneous QueryCommand IDN endregion Figure 3 10 Direct SCP command write and query example plus measuring the query execution time By default at the end of each WriteCommand and QueryCommand the driver queries the RTx status with the SCPI query STB Therefore an attempt to send a query with the WriteCommand will cause the instrument error query interrupted You have to either use the QueryCommand or disable querying of the status byte before A small example of write read combination with disabled instrument status querying bool oldStatus driver DriverOperation QuerylInstrumentStatus driver DriverOperation QuerylInstrumentStatus false driver Miscellaneous WriteCommand IDN string response driver Miscellaneous ReadCommand driver DriverOperation QuerylInstrumentStatus oldStatus For more details on QueryInstrumentStatus refer to Chapter 3 3 4 driver Driver Operation QuerylnstrumentStatus on page 14 3 6 Channels setup using repeated capabilities Channels setup using repeated capabilities Horizontal settings of the acquisition can be adjusted by 2 different ways Resolution or Record length see the RTx GUI Horizontal gt Resolution The example chooses the latter In this mode you have to define the length of the entire acquisition and the num b
11. CHANNEL COUNT item go to the Contents tab to see in which interface tree branch is the property ChannelCount available EP RsScope IVLNET Instrument Driver Help Teat Hide RsScopePowerAnalysis ReScopeProtocalsMSO BW ReScopelQSoftware Rs ScopeClock DataRecovery m ReScopeDisplay 2 peace area ComputerName MaterialNumber SerialNumber star Seltest Selftest Status SetQueryPattem Format Channel Count ChannelCount C definition Public int ChannelCount get Purpose Returns the channel count Valid Values Not checked Default Value None Figure 3 7 Selected element ChannelCount in Help Contents Reading basic info Therefore the syntax will be the following int channelCount driver System ChannelCount Another example is reading out the instrument firmware version the property FirmwareVersion also belongs to the System interface string fwVersion driver System FirmwareVersion Enabling the Channel 1 To find out the syntax the best is to use the Intellisense Type driver and the Intellisense shows all available methods and properties region 3 4 Reading basic into freading the channel count trom the instrument int channelCount driver System ChannelCount driver i i teal ie RC lt IRsScopeChannel gt RsScope Channel F Channels ClockDataRecovery Close Figure 3 8 The driver Intellisense suggestions Use CTRL Space to force the Intellisense suggestio
12. Channel CH1 Level 3 setting the trigger level on CH_1 to 6 3V endregion Figure 3 14 Configuring Trigger A for Channel 1 and Channel 2 TriggerModifier can be set to Normal standard trigger function the scope waits for the trigger event until it rea ches the specified trigger timeout Auto the scope waits for the trigger event but when it doesn t arrive within a cer tain time based on horizontal settings it performs the acquisition anyway Free Run the trigger is disabled an acquisition starts immediately Acquisition and reading waveforms The proper measurement synchronization is the critical part of any remote control application Therefore a special attention needs to be dedication to this issue with the clear understanding of the application progress in relation to the status of the instru ment While on some instruments it s usually not critical at which exact moment a measure ment starts the oscilloscope triggered measurement is all about the correct timing An improper waveform acquisition synchronization leads to sub optimal performance or unreliable results User might read the waveform out of the oscilloscope at an incorrect moment too soon the result from previous acquisition or too late it is already over written by the next acquisition It is often much harder to filter out the improper measurement results than to prepare the instrument to capture the correct wanted signal only
13. H1 Capacity The capacity means maximum capacity smaller recordLength can be accommodated without a change The actual record length is in a separate property waveform CH1 ValidPointCount In this example this is the first reading of the waveforms the required capacity is allo cated by the FetchWaveform because the waveform CH1 waveform CH2 objects have not been yet initialized copy the waveforms from Channel 1 and Channel 2 to the PC IWaveTtormdouble gt waveform _CH1 null IWaveTtormdouble gt waveform _CH2 null wavetorm CH1 CH1 Waveform We FetchWaveform waveform_CH1 wavetorm CH2 CH2 Waveform We FetchWaveform waveform CH2 Acquisition 1 parameters Console WriteLine Trigger source TriggerA Source Console WriteLine CH1 Samples count 0 CH2 Samples count endregion Figure 3 16 First reading of the waveforms Acquisition 2 and converting waveforms Second acquisition is done with increased number of samples To simulate repeating of an unsuccessful acquisition the driver WaveformAcquisition RunSingle is wrapped in an extension method Extended RunSingleWithRepeat For more details refer to Chapter 3 14 RunSingle with repeat workaround on page 34 Acquisition and reading waveforms region 3 8 3 Acquisition 2 and converting waveforms Acquisition 2 with increased number of samples higher record length int newRecordLength 1106 driver Acquisition HorizontalR
14. Hcpy DE1 driver HardcopyAndPrinter Destination DE1 string hcpyFolderPathRTx f c Temp string hcpyFilePathRTx hcpyFolderPathRTx 1MA268 screenshot_RTx pne string hcpyFilePathPC c Temp 1MA2668 screenshot PC png Hcpy DE1 DeviceDestination HardcopyDevice File Hcpy DE1 Color true Hcpy DE1 DeviceLanguageOutputFormat HardcopyDeviceLang png Hcpy DE1L WhiteBackground false Hcpy DE1 PrintColorSet HardcopyPrintColorSet Default4 Hcpy DE1 Inversetolors false Hcpy FileName hcpyFilePathRTx fmake a screenshot now Hcpy Print dicopy the file from the RTx to the PC driver DataManagement ReadToFileFromInstrument hcpyFilePathRTx hcpyFilePathPCc endregion Figure 3 22 RTx hardcopy code snippet Included at the end is the transfer of the file from the RTx to the PC 2015 09 15 14 13 12 Horizontal Diagram1 Ch1 Ch2 7 Res 9 0 s 110 kSa s RL 1 1kSa RT Scl 999 999 us div Pos Os Meas Results x Trigger Norma A Edge eas 1 988 14 m i Lvl 300 m eas 2 999 89 Hz eas 3 59 289 mY Figure 3 23 RTx screenshot transferred to the Control PC the default PC path Is in the example set to C Temp 1MA268_screenshot_PC png E Application Note IVI NET 1MA268 Oe 29 Reading RTx Folder List 3 12 Reading RTx Folder List This part of the example code shows how to obtain a content of an RTx folder Method for reading of a desired folder
15. How to use Rohde amp Schwarz IVILNET instrument drivers Application Note This paper is a guide for C programmers wanting to automate a measurement task using the native Rohde amp Schwarz IVI NET instrument drivers in Visual Studio development environment The IVI Interchangeable Virtual Instruments define new level of quality completeness usability and functionality that reduces the cost of test system development and ownership NET is a programming framework created by Microsoft that developers can use to create applications more easily Without writing a single line of code NET provides a scalable and powerful environment to code upon Note Please find the most up to date Application Note on our homepage www rohde schwarz com appnote 1MA268 IVILNET 1MA268_0e Miloslav Macko Application Note a A A WD N Contents MT OGG Ul OM nE EAE ESE 3 Starting with Rohde amp Schwarz IVI NET drivers c cccscecssseeeees 5 Creating a new Console application ccccccsceseecseeeeeeeeeseneeeeeeneeees 8 Additional INTOPIMALON seesstcciicesanccicdescetucsenasavwsdincdacmsenesixavanntetamemsnets 36 ROMGC amp SCMWAN2 senenin naani EErEE EERTE 37 1 1 1 2 Required Software Introduction Used abbreviations The following abbreviations are used in this application note RTx is the name used for both Rohde amp Schwarz RTO or RTE Digital Oscillo scopes API stands for Application Pr
16. Queryable lt gt f Equals T Average lt gt ExternalAttenuationScale Channel Subsystem IRsScopeChannel Purpose Channel based aftributes that you use to configure the channel subsys Supported Repeated Capabilities El RsScope Trigger Type paw Channel CH1 CH2 CH3 CH4 CHExt E1 Madifier More info Figure 3 12 Adding the objects indexing All possible indexing strings are mentioned in the Channel Subsystem help text Channels setup using repeated capabilities Options to select a desired subsystem e with the RepCap name e g CH2 the valid strings are to be found in the help file driver Channel CH2 Enabled true e with an 0 based index using the method ElementAt index driver Channel ElementAt 1 Enabled true The following code snippet creates a list of all available RepCap names for the driver Channel subsystem Console Write nRepCap 0 count 1 all values driver Channel Name driver Channel Count loop operation with all the elements foreach var element in driver Channel Console Write O element RCKey You can now create a variable called CH1 and assign one object driver Channel CH1 to it in order to use it later for all operations related to Channel 1 e g configuring the basic parameters with the Configure method var CH1 driver Channel CH1 CHl Contigure 2 000 0 0 RohdeSchwarz RsScope VerticalCoupling AC true The same approac
17. Vector Signal Generators SMW200A SMVB100A SMU200A SMJ100A AMU200A SMATE200A e Spectrum Analyzers FSW FSV FPS FSVR e Oscilloscopes RTO RTE RTM2000 e EMI Test Receivers ESR ESRP e New family of Power Sensors NRPxxS N e Power Supplies HMC Installation of IVI LNET driver For demonstration purposes the driver for Oscilloscopes RsScope will be used in this paper However the presented procedures are applicable to all Rohde amp Schwarz IVI NET drivers You have to install the IVI NET Shared components IVI Shared Components and IVI compliance package before the installation of the IVI NET driver If you don t follow this order the RsScope driver installation will not be successful The RsScope driver can be downloaded from IVI NET RsScope driver link On the 64 bit OS you have to use x64 installer which will install both 32 bit and 64 bit assemblies dlls On the 32 bit OS use the x86 installer Installation paths on 64 bit OS c Program Files Rohde Schwarz RsScope c Program Files x86 Rohde Schwarz RsScope Installation paths on 32 bit OS c Program Files Rohde Schwarz RsScope Starting with Rohde amp Schwarz IVI NET drivers E eS Both locations have the same folder structure Bin the folder containing the driver assembly RohdeSchwarz RsScope Fx40 dll Documentation driver help file folder RsScope chm This file is also accessible through the Start Menu gt Rohde Schwarz gt RsScope
18. _RsScopelVLNET 1 project 4 k IMA268_RsScopelVLNET gt Properties gt OC References Add Reference Add Service Reference A Manage NuGet Packages Scope to This New Solution Explorer View Figure 3 3 Adding reference to an existing assembly You can select multiple assemblies at once Assembly paths for 64 bit target application also used in the attached example c Program Files IVI Foundation IVI Microsoft NET Framework64 v2 0 50727 IviFoundationSharedComponents 1 1 0 Ivi Driver dll c Program Files IVI Foundation IVI Microsoft NET Framework64 v2 0 50727 IviFoundationSharedComponents 1 1 0 Ivi Scope dll c Program Files Rohde Schwarz RsScope Bin RohdeSchwarz RsScope Fx40 d1l Assembly paths for 32 bit target application c Program Files x86 IVI Foundation IVI Microsoft NET Framework64 v2 0 50727 IviFoundationSharedComponents 1 1 0 Ivi Driver dll c Program Files x86 IVI Foundation IVI Microsoft NET Framework64 v2 0 50727 IviFoundationSharedComponents 1 1 0 IVi scope dil c Program Files x86 Rohde Schwarz RsScope Bin RohdeSchwarz RsScope Fx40 dll After adding the references you need to add the using directives to the code Program cs file using Ivi Driver using Ivi Scope using RohdeSchwarz RsScope 3 3 Initializing of a HISLIP session Afterwards you can use the RsScope driver methods and properties In addition the Intellisense for RsScope will also be
19. all both 64 bit and 32 bit components Used software configuration The software configuration used in this Application Note e Windows 7 64 bit e Microsoft Visual Studio 2012 Rohde amp Schwarz VISA 5 4 10 e IVI compliance package 14 0 e lviSharedComponents64_ 2 2 1 e lviNetSharedComponents64_Fx20_ 1 1 2 e RsScope 1 4 2 0 x64 e 1MA268 RsScopelVI NET example project version 1 0 0 Used instruments The instruments used in this Application Note e RTO 1044 4 Channel Firmware 2 70 1 0 e Passive Voltage Probe RT ZP10 Attenuation rate 1 10 The RT ZP10 is connected to the CH1 input and the Probe Compensation output on the front panel Installation of IVI NET driver 2 Starting with Rohde amp Schwarz IVI NET 2 1 drivers Rohde amp Schwarz provides a range of free Instrument Drivers follow the link Rohde amp Schwarz drivers to simplify the development process of instrument remote control applications Rohde amp Schwarz have been driving the introduction of IVI NET drivers as a new Standard in the industry The first IVI NET driver RsScope was introduced in 08 2013 for the RTO Digital Oscilloscope IVI LNET drivers comes in a form of NET assembly e g for RsScope c Program Files Rohde Schwarz RsScope Bin RohdeSchwarz RsScope Fx40 dll This application note will focus only on Instrument specific interface of the drivers Currently the IVI NET drivers are available for the following instruments e
20. alse The third parameter in the constructor specify whether to reset the device during the initialization You can invoke the reset separately by calling driver Utility Reset The IVI NET inherent capabilities are organized into several interfaces I viDriverOperation driver DriverOperation settings for operation of the driver TIIviDriverIdentity driver Identity general info about the driver JiIviDriverUtility driver Utility basic set of utility operations tTiIviDriverLock driver Utility Lock multi thread locking of the ses sion See the full description chapter 4 1 here http www ivifoundation org downloads Architecture 20Specifications IVI 3 2_Inherent_Capabilities 2015 03 09 doc Below is the selection of the most common used IVI Inherent capabilities Creating a new Console application 3 3 1 3 3 2 3 3 3 driver DriverOperation Simulate Default value after initialization false When this property is set to true the driver operates in simulation mode an instrument presence Is not required e A send command performs no action e A query returns a fixed response that is equal to the default value of the property e g reading the for Channel property Range will return the value 0 04 see the blue framed part in Figure 3 5 Use the Simulate property only if you d like to change the settings ON and OFF dur ing the run of your application or in parts of your pr
21. by proper synchronization The next chapter will discuss some of the basic synchronization principles that the RsScope driver offers Application Note IVI LNET 1MA268_ Oe 20 Acquisition and reading waveforms 3 8 1 Acquisition synchronization methods For all the types of synchronization methods it is required that the RTx instrument has been set to single acquisition mode Therefore the option of using the method driver WaveformAcquisition RunContinuous will not be discussed here The following examples contain IWaveform lt T gt types that are explained here Chap ter 3 8 2 Acquisition 1 and reading waveforms on page 23 3 8 1 1 RunSingle method For a basic waveform acquisition the driver offers the following method driver WaveformAcquisition RunSingle This method arms the oscilloscope to wait for a trigger and perform a single acquisi tion Then it waits for the acquisition to be finished Next step usually involves fetching of one or more acquired waveforms waveform CHL driver Channel CH1 Waveform WO FetchWaveform waveform CHL waveform CH2 driver Channel CH2 Wavetorm WO PetchWaveform waverorm CH2 7 Synchronization provided The remote control application waits inside the RunSingle method until the acquisition has successfully finished If the waiting time exceeds the timeout defined by driver Miscellaneous OPCTimeout a TimeoutException will be raised by the method
22. de Meas1 GeneralSettings Source WaveformParameter ChanneliWavetorm1 WaveformParameter ChannellWaveform1 Meas1 GeneralSettings Enabled true measurement 2 Meas AmplitudeTime MainMeasurement AmplitudeTimeMeasurementType Frequency Meas2 GeneralSettings Source WavetormParameter ChannellWaveforml WaveftormParameter ChannellWaveform1 Meas2 GeneralSettings Enabled true measurement 3 Meas3 AmplitudeTime MainMeasurement AmplitudeTimeMeasurementType Amplitude Meas3 GeneralSettings Source WaveftormParameter Channel2Waveforml WaveftormParameter Channel2Waveform1 Meas3 GeneralSettings Enabled true Continue only when all previous commands were processed driver Extended_ Synchro SynchroType OPC Console WriteLine Current waveforms measurement results Console WriteLine CH1 Amplitude F3 V Measl Results FetchMainMeasurement StatisticsType Actual Console WriteLine CH1 Frequency F3 Hz Meas2 Results FetchMainMeasurement StatisticsType Actual Console WriteLine CH2 Frequency F3 V Meas3 Results FetchMainMeasurement StatisticsType Actual endregion Figure 3 20 Measurements of three different parameters settings and fetching of the results are separated by the method driver Extended_Synchro Not using the Extended Synchro method might cause a reading timeout during one of the FetchMainMeasurement Calls because the result of the measurement is not available that fast after s
23. e Control PC e Reads the RTx folder content By performing these actions the following commonly used features are presented e Using of IVI NET driver Help that is available here Start Menu gt Rohde Schwarz gt RsScope gt RsScope e Creating a new driver session in HISLIP mode Chapter 3 3 Initializing of a HISLIP session on page 12 e Changing the common IVI NET driver session properties Simulation mode Status Checking Range checking Chapter 3 3 1 driver DriverOperation Simulate on page 13 e Showing a direct SCPI write query actions and measuring the execution time Chapter 3 5 Direct SCPI write query on page 17 e Showing how to use Repeated Capabilities Chapter 3 6 Channels setup using repeated capabilities on page 18 e Explaining different type of synchronization methods used for signal acquisitions Chapter 3 8 1 Acquisition synchronization methods on page 21 3 1 Creating new Visual Studio project e Working with waveforms Fetching changing capacity reusing waveforms Chapter 3 8 3 Acquisition 2 and converting waveforms on page 24 e Showing parsing of an RTx response using Regex object Chapter 3 12 Reading RTx Folder List on page 30 e Basic handling of exceptions raised by the driver Chapter 3 13 Handling of exceptions on page 31 e Assuming that a certain feature is missing in the driver extending the RsScope object by new methods Chapter 3 14 RunSingle
24. eats the acquisition maximum of maxRepeats times in case of a timeout It also gives an option to choose the trigger source or cancel the acquisition process Figure 3 33 RsScope extended methods Intellisense suggestions For the extended methods to be available you need to include the directive using RsScopeExtensions The RsScopeExtensions Is the namespace in which the extension methods are pro grammed The class name itself is not important 3 15 Extended method for synchronization Similar to the previous chapter you can define an extended function for synchroniza tion The enum SynchroType must be defined in the namespace RsScopeExtensions as public to be accessible by the main program region 3 15 Extended method for synchronization f f lt summary gt This is an example of extension method added to the RsScope driver lt para gt The method sends the WAI command or OPC query to the scope lt para gt f lt summary gt public static void Extended Synchro this RsScope driver SynchroType syncType if syncType SynchroType WAL bool oldQueryInstrumentStatus driver DriverOperation QueryInstrumentStatus driver DriverOperation QueryInstrumentStatus false driver Miscellaneous WriteCommand WAI driver DriverOperation QueryInstrumentStatus oldQueryInstrumentStatus else if syncType SynchroType OPC i driver Miscellaneous QueryCommand OPC I endregion Figu
25. ecordLength newRecordLength start the new acquisition and wait for it to finish timeout 3s driver Miscellaneous OPCTimeout 3000 to simulate the acquisition timeout change the trigger source to Channel 2 TriggerA Source RohdeSchwarz RsScope TriggerSource Channel2 TriggerA Channel CH2 Level 6 2 setting the trigger level on CH 2 to 2V custom method for driver WaveformAcquisition RunSingle with repeat workaround Console WriteLine n n quisition 2 bool success driver Extended RunSigleWithRepeat TriggerA 5 Figure 3 17 Acquisition 2 Extended_RunSingleWithRepeat method with repeated workaround With the fetching of the waveforms you can reuse the objects waveform CH1 waveform CH2 If the increased capacity is required you have to change it with the Capacity property fincrease the waveforms capacity and fetch the data from RTx if success i waveform_CH1 Capacity newRecordLength waveform CH2 Capacity newRecordLength waveform CH1 CH1 Waveform wWe FetchWaveform waveform_ CH1 waveform_CH2 CH2 Waveform We FetchWaveform waveform_CH2 fAcquisition 2 parameters Console WriteLine Trigger source 0 TriggerA Source Console WriteLine CH1 Samples count 0 CH2 Samples count 1 else t Console WriteLine Acquisition 2 is cancelled nBoth waveforms st Figure 3 18 Fetching the waveforms reusing of the existing waveforms but with increased capacit
26. ented by the waveform properties StartTime EndTime TotalTime IntervalPerPoint Use the Intellisense to explore all the methods and properties that the IWaveform lt T gt object offers Measurements Very often it is not necessary to transfer the entire waveform sample by sample to the control PC but instead it is sufficient to analyze the properties of the signal amplitude frequency pulse width etc For this purpose the RTx offers the measurement subsys tem Measurement is always performed on the last acquired waveform A change in the measurement settings immediately produces an updated result in remote control application you need to use a synchronization OPC query or WAI command after a change in measurement settings It is not necessary to perform a new wave form acquisition The following example sets three different measurements on both channels Although in manual operation the measurement results are immediately available after switching them ON the remote control operation requires the synchronization using OPC query before fetching any measurement result This is achieved by calling a method driver Extended Synchro highlighted in the red rectangle Measurements region 3 9 Measurements var Measl driver Measurements M1 var Meas driver Measurements M2 var Meas3 driver Measurements M3 measurement 1 Meas1 AmplitudeTime MainMeasurement AmplitudeTimeMeasurementType Amplitu
27. er of samples The acquisition time is a special IVI object type called Ivi Driver PrecisionTimeSpan region 3 6 Channels setup using repeated capabilities horizontal setting Acquisition time and Record Length driver Acquisition HorizontalRecordSelection RecordSelection RecordTime driver Acquisition HorizontalTimePerRecord Ivi Driver PrecisionTimeSpan FromMilliseconds 16 1 ms driver Acquisition HorizontalRecordLength 1602 Figure 3 11 Configuring Horizontal scale by defining Record length and Acquisition time Many instruments have capabilities which are duplicated For example an oscilloscope might have several channels with identical functionality Repeated capability instances e g selection of a certain channel in IVI NET drivers are specified by selecting one of the objects from the available list When the Intellisense offers the suggestions shown on the screenshot below methods for sequence objects this means that the addressed object driver Channe1 rep resents an IEnumerable object an array or a list of objects You need to select only one element the channel you would like to address Afterwards the Channel sub system methods and properties are available a a si intl D All lt gt ChannelOffset Any lt gt tf Configure D AsEnumerable lt gt F Pp AsParallel DigitalFilterCutOff AsParallelk gt DigitalFilterEnabled H rallel lt Se D AsQueryable Enabled C As
28. from the DUT Synchronization provided The remote control application waits inside the WaitForMeasurementComplete method until the acquisition has successfully fin ished If the acquisition has already finished before this method is called the method finishes immediately If the waiting time exceeds the defined timeout a System TimeoutException will be raised Acquisition 1 and reading waveforms In remote control application utilizing of continuous measurement mode should be limi ted to none there are only very few special cases where it is really justified Most of the times it can be substituted for properly synchronized on request invoked single measurements The following two chapters perform two acquisitions to show reuse of the waveform resources and the usage of two different synchronization methods Acquisition 1 RunSinglewithoutWait WaitForMeasurementComplete timeout region 3 8 2 Acquisition 1 and reading waveforms f Acquisition 1 arming the RTx Console WriteLine n n Acquisition 1 driver WaveformAcquisition RunSinglewWithoutWait fhere adjust your DUT to produce a signal DUT GenerateBurst wait until the acquisition has finished driver WaveformAcquisition WaitForMeasurementComplete 16000 10000ms Figure 3 15 Acquisition 1 with the option to perform a middle action after arming the RTx After this code the latest waveforms from all enabled channels are available for read
29. gt RsScope Sample Simple example Visual Studio project ReadWaveformExample Source complete source files of the driver 2 2 Introduction to IVI drivers The IVI Interchangeable Virtual Instruments define new level of quality complete ness usability and functionality that reduces the cost of test system development and ownership The first IVI drivers started as IVI C drivers the drivers were programmed in ANSI C Later as the COM technology became more popular especially due to the C lan guage the IVI COM drivers were introduced Today the main choice of the object ori ented programmers are NET languages meaning either C or Visual Basic There fore the next logical step for IVI was to introduce the IVI NET drivers Regardless of the technology IVI C IVI COM IVI NET an IVI driver always consists of two parts e IVI class interface this interface API is mandatory defined in IVI class specifi cations There are several classes in IVI definition depending on type of instrument e g lviScope for Oscilloscopes IviSpecAn for Spectrum Analyzers lviRFSigGen for RF Signal Generators etc The main idea is that as long as the programmer sticks to using only this interface he will be granted the advantage of instrument interchangeability without having to change the source code The only thing he needs to change when swapping the instruments is a database configuration con necting an instrument with an IVI
30. h can be applied to the second channel configuring the Channel 1 var CH1 driver Channel CH1 CH1 Configure 600 0 0 RohdeSchwarz RsScope VerticalCoupling AC true fcontiguring the Channel 2 var CH2 driver Channel CH2 CH2 Configure 5 600 0 0 RohdeSchwarz RsScope VerticalCoupling AC true endregion Figure 3 13 Creating CH1 and CH2 objects using them later for accessing the subsystems or implicit type declarations The following two declarations are equivalent ERSScopeChannel Col driver Chennel Cai Z var CH1 driver Channel CH1 The objects CH1 and CH2 are of a type IRsScopeChannel You can use the explicit Using implicit type is easier than finding out the actual type of the CH1 object Hovering a cursor over the word var will show the help text for the interface including the available RepCap strings Channel CH1 CH2 CH3 CH4 CHExt Creating a new Console application 3 7 3 8 Trigger Settings Next section sets up the trigger system Trigger Subsystem with the Trigger A selected region 3 7 Trigger settings set up the trigger var TriggerA driver Trigger TrigA TriggerA Modifier RohdeSchwarz RsScope TriggerModitier Normal TriggerA Timeout TimeoutValue 13 0 TriggerA Source RohdeSchwarz RsScope TriggerSource Channell TriggerA Type RohdeSchwarz RsScope TriggerType Edge TriggerA Edge Slope RohdeSchwarz RsScope 5Slope Positive TriggerA
31. i ToString F3 columnSeparator samplesArray CH2 1 ToString F3 rowSeparator H Console WriteLine Waveform data saved to H 0 file size 1 F3 kB csvFile Close endregion Figure 3 21 Exporting the waveforms to a csv file Hardcopy This chapter shows the steps for capturing an RTx screenshot and transferring the pic ture to the control PC The picture settings can be changed in the set up part For this example the setting that produces the exact copy of the RTx screen is chosen The code snippet below shows the set up of the hardcopy format taking a screenshot with Hcpy Print and afterwards transferring the created screenshot file to the Control PC If the file with the same name already exists it will be overwritten The method ReadToFileFromInstrument Is universal for file transfer from the instrument to the Control PC Note that both parameters of the method require the entire path including the file name therefore the target file in the PC can have a differ ent name than the original file Here the original file name is 1MA268 screenshot RTx png while the target file name is IMAZ6c screenshot PC png To transfer a file in the opposite direction PC gt RTx use the following method driver DataManagement WriteFromFileToInstrument filePathPC filePathRTx Creating a new Console application SSS region 3 11 Hardcopy set up the hardcopy var Hcpy driver HardcopyAndPrinter var
32. n 3 14 RunSingle with repeat workaround ff lt summary gt This is an example of extension method added to the RsScope driver f lt para gt The method repeats the acquisition maximum of maxRepeats times in case of a timeout lt para gt lt para gt It also gives an option to choose the trigger source or cancel the acquisition process lt para gt lt summary gt public static bool Extended _RunSigleWithRepeat this RsScope driver IRsScopeTrigger trigger int maxRepeats i bool repeat bool success false do repeat false catch IVINET Internal ErrorException exception fhandle only the exception with error VI_ERROR_TMO xBFFF 15 Operation timed out fall the other types of exceptions will be re raised and processed by the higher level of catch if exception Errortode IVINET Internal Errors VI_ERROR_TMO throw Figure 3 32 RunSingle method with catching of the code VI_ERROR_TMO The next steps are capturing the keystrokes and changing the TriggerA settings or canceling the acquisition see the code in Program cs Extended method for synchronization Notice that the original and the extended methods are treated the same way driver E DataManagement Display Dispose DriverOperation extension bool RsScope Extended_RunSigleWithRepeat IRsScopeT rigger trigger int maxRepeats This is an example of extension method added to the RsScope driver The method rep
33. ns The suggested list corresponds to the help file tree structure the Intellisense shows the alphabetical order EX RsScope IVLNET Instrument Driver Help Channel Subsystem IRsScopeChannel Purpose m amp FeS Te pelos pei ee ee eee ae Ce Rs ScopeCursors Channel based attributes that you use to configure Re Scope Measurements TE Supported Repeated Capabilities Rs Scope Reference Waveforms More info RsScopeProtacols Channel CH1 CH2 CH3 CH4 CHExt RsScopeAcquisition Re Scope TriggerinputProbe g ReScopeHighDefinition ReScope WavefomAcdquisition Figure 3 9 The driver help tree structure Direct SCPI write query 3 9 Direct SCPI write query The driver still offers the option of using direct SCPI commands and queries An exam ple sending the command SYST DISP UPD ON and the query IDN performed in a loop with measuring the execution time region 3 5 Direct SCPI write query f direct string write use for the commands not for the queries driver Miscellaneous WriteCommand SYST DISP UPD ON driver Display DisplayUpdate true fdirect string query string idnResponse null int repetitions 1000 var stopWatch new Stopwatch pertorm 1000x IDN query and evaluate an average execution time stopWatch Reset stopWatch Start for int i i lt repetitions i stopWatch Stop Console WriteLine n n IDN response Average time over 1 repetitions 2 F
34. ogram However in case you don t have the physical instrument you need to already switch the simulation ON during the initialization This is achieved by initializing with the fol lowing option string the last input parameter RsScope driver new RsScope TCPIP 192 168 1 100 HISLIPO true true Simulate True After that you cannot switch the simulation OFF anymore driver DriverOperation OResourceDescriptor If you used the logical name in the session init e g RsScope driver new RsScope MyRTO1024 true true string 10Resource driver DriverOperation ITOResourceDescriptor string logName driver DriverOperation LogicalName The result of ioResource will be the actual O resource descriptor as it is declared in the IVI Configuration store The value of logName will be MyRTO1024 In our case when we are using the direct O resource descriptor both string values will be identi cal driver DriverOperation RangeCheck Default value after initialization true Setting of this property enables disables the driver functionality of checking whether the entered value is within the allowed range defined in the driver for example the channel property Range has a valid range of values from 0 01V to 10V red rectangle The blue rectangle shows the value of the property returned when the driver is in simu lation mode a a Application Note IVI NET 1MA268 Oe 13 3 3 4 Initializing of a HISLIP session
35. ogramming Interface a set of function prototypes types and protocols for building software applications The Repeated Capabilities are referred to as RepCaps Interchangeable Virtual Instruments are referred to as IVI See more at ivifoundation org The IVI NET driver is referred to as IVI driver The driver documentation RsScope chm help file is referred to as help file Microsoft Intellisense is refered to as Intellisense Required Software To follow the steps described in this Application Note the following additional software is required Windows 7 8 32 bit 64 bit operating system Microsoft Visual Studio 2012 or later VISA I O library e g Rohde amp Schwarz VISA download from https www rohde schwarz com RS_Visa html RsScope driver and the required IVI packages IVI compliance package 14 0 or newer download from ni com IVI Shared Components 2 2 1 or newer download from http www ivifoundation org shared_components IVI LNET Shared Components 1 1 2 or newer download from http www ivifoundation org shared_components RsScope 1 4 2 0 or newer download from IVI LNET RsScope driver 1 2 1 1 3 1 4 Used instruments 32 bit vs 64 bit operating system While 32 bit operating system allows only for installation of 32 bit software components and running of only 32 bit applications 64 bit OS allows for both 32 bit and 64 bit applications to be used For this reason the 64 bit installers inst
36. ormAcquisition RunSingle This might just work if the DUT is slow enough with generating a signal and the RTx manages to get to the armed state initiated by ReadWaveform method The behavior of such order of commands is undefined and therefore should be avoided Option 2 always raising a timeout exception driver WaveformAcquisition RunSingle DUT GenerateBurst Swapping the order will always cause raising of a timeout exception by RunSingle method because it waits for a signal that will only be generated after it finishes waiting Option 3 driver WaveformAcquisition RunSingleWithoutWait DUT GEneraveburse driver WaveformAcquisition WaitForMeasurementComplete timeout waveform CHL driver Channel CH1 Waveform WO FetchWaveform waveform CHL In this case as first the RTx is armed and prepared to acquire the signal from the DUT before the DUT is commanded The key difference is that the application passes through the RunSingleWithoutWait method without waiting 3 8 2 Acquisition and reading waveforms The methods starting with Read always start a new measurement wait for the results and then provide the data The methods starting with Fetch only provide an actual data without starting any new measurement An actual synchronization is performed after commanding the DUT in the method WaitForMeasurementComplete where the RTx trigger system is with certainty prepared to react on the signal
37. ow 3 13 1 3 13 2 Handling of exceptions IVINET Internal VisaException Handling of all the exceptions coming from VISA library The VisaErrorCode are the codes defined in VISA interface description region 3 13 Handling of exceptions f 3 13 1 IVINET Internal VisaException handling catch IVINET Internal VisaException exception i exceptionMessage nVisa error occured code exception VisaErrorCode ToString x n exception Message n nStackTrace n exception StackTrace Figure 3 27 IVINET Internal VisaException catch case IVINET Internal ErrorException This code handles all the exceptions raised by the IVI LNET RsScope driver excluding VISA exceptions The error code RS ERROR INSTR SPECIFIC signals an internal instrument error that will be followed by sending SCPI query SYST ERR in a loop until the instrument error queue is empty All the read out error messages are appen ded into the exception message string 3 13 2 IVINET Internal ErrorException handling catch IVINET Internal ErrorException exception i fif an instrument error is detected if exception ErrorCode IVINET Internal Errors RS ERROR _INSTR_ SPECIFIC i f read the instrument error queue var errorDetail driver Utility Errorquery exceptionMessage nInstrument error occured n errorDetail Message n nStackTrace n exception StackTrace else general error handling i exceptionMessage
38. pport la rohde schwarz com Phone 1 410 910 7988 e Asia Pacific customersupport asia rohde schwarz com Phone 65 65 13 04 88 e China customersupport china rohde schwarz com Phone 86 800 810 8228 86 400 650 5896 Headquarters Rohde amp Schwarz GmbH amp Co KG Muhldorfstrake 15 D 81671 Munchen 49 89 4129 0 Fax 49 89 4129 13777 www rohde schwarz com This application note and the supplied programs may only be used subject to the conditions of use set forth in the download area of the Rohde amp Schwarz website R amp S is a registered trademark of Rohde amp Schwarz GmbH amp Co KG Trade names are trademarks of the owners
39. re 3 34 Extension method Extended_Synchro code snippet 4 Additional information Please send your comments and suggestions regarding this Application Note to TM Applications rohde schwarz com Using tag 1MA268 in the mail subject will help us to quickly identify the topic and speed up the response process 5 Rohde amp Schwarz The Rohde amp Schwarz electronics group offers innovative solutions in the following business fields test and measurement broadcast and media secure communications cybersecurity radiomonitoring and radiolocation Founded more than 80 years ago this independent company has an extensive sales and service network and is present in more than 70 countries The electronics group is among the world market leaders in its established business fields The company is headquartered in Munich Germany It also has regional head quarters in Singapore and Columbia Maryland USA to manage its operations in these regions Sustainable product design e Environmental compatibility and eco footprint e Energy efficiency and low emissions e Longevity and optimized total cost of ownership Certified Quality Management Certified Environmental Management ISO 9001 ISO 14001 Regional contact e Europe Africa Middle East customersupport rohde schwarz com Phone 49 89 4129 12345 e North America customer support rsa rohde schwarz com Phone 1 888 TEST RSA 1 888 837 8772 e Latin America customersu
40. ror immediately after the command that caused it It is recommended to keep the QueryInstrumentStatus set to true However the disadvantage is slightly decreased performance When you perform a repeated number of short acquisition where every microsecond counts set this prop erty to false before the acquisitions but set it back to true afterwards This combines the fast execution with the proper error handling Action after reading the instrument status byte In case an instrument error is detected the driver generates an IVINET Internal ErrorException For more details on handling the exceptions refer to the Chapter 3 13 Handling of exceptions on page 31 3 4 Reading basic info Reading basic info To read out how many channels does the instrument have use the Help Search tab with count search word RsScope IVLNET Instrument Driver Help gt RSSCOPE ATTR_AMPLITUDE EDGES SLOPE RSSCOPE_ATTR_AMPLITUDE_PULSES_SLOPE RSSCOPE_ATTR_AMPT_DELAY_DIRECTION WENE hlut italla MAIN E arijai RSSCOPE ATTA FFT FRAME MAX FRAME_COUNT RSsCOPE_ATTR_HISTOGRAM_MAIN_MEASUREME Dco ADC ATTO WeTADY CCT ACI INCITAR Channel Count ChannelCount C definition public int ChannelCount get Purpose Returns the channel Peli Valid Values Not checked Default Value None Supported Repeated Capabilities More info None Figure 3 6 Searching for a term in driver help file After selecting the RSSCOPE ATTR
41. ror message finally i if exceptionMessage null Console WriteLine exceptionMessage wait for a keypress Console WriteLine nPress any key to close Console ReadKey f close the driver and disposing of the driver object driver Dispose Figure 3 31 Case finally the path of the code which is always performed RunSingle with repeat workaround 3 14 RunSingle with repeat workaround An extended method of the RsScope driver is defined as a static method with the fol lowing syntax public static bool Extended RunSigleWithRepeat this RsScope driver IRsScopeTrigger trigger int maxRepeats The fact that it can be used as a standard RsScope method is achieved by the follow ing e itis defined in a static class The class name is not important public static class Extensions Of Rsscope e itis defines as a static method public static bool Extended RunSigleWithRepeat e its first parameter is defined as this RsScope driver Inside the acquisition itself is done with RunSingle The repetition workaround is achieved by catching an exception raised by the method in case the acquisition wasn t performed within the defined time set by the property driver Miscellaneous OPCTimeout Because the exception is of more generic type IVINET Internal ErrorException the catch will re raise it again if the error code doesn t correspond to the VI_ERROR_TMO Operation timed out regio
42. till under development You can find the IVI COM adapters included in the IVI compliance software package Creating a new Console application This chapter describes creating of a new console application from scratch The com plete project 1MA268 RsScopelIVI NET is available in the attachment to this applica tion note The entire source code is placed in a file Program cs all the code screen shots are taken from that file The region pragma names in the attached example correspond to the chapter names in this application note E g the chapter 3 11 Hardcopy describes the part of the example code enclosed by the region 3 11 Hardcopy To make the hardware set up easy the RTx setting is adjusted to measure the front panel Probe Compensation square signal Connect the passive probe to the CH1 input and the Probe Compensation output This example performs the following actions e Sets up the RTx channels CH1 and CH2 for measurement of a probe compensa tion signal available on a RTx front panel e Sets up the trigger system to normal edge mode e Starts two acquisitions each with different types of synchronization The second one includes a workaround for repeated acquisition in case of unsuccessful one e Performs post acquisition measurements of amplitude and frequency on both channels e Reads two waveforms from both channels and stores the results in one csv file e Takes a RTx screenshot and transfers the picture to th
43. to parse the folderContent for all available entries Handling of exceptions 3 13 Handling of exceptions The big advantage of C over ANSI C programming is handling of errors in a form of raising exceptions The basic construct is as follows the code for which to catch the exceptions fin our case it starts with the region region 3 3 Initializing of a HISLIP session fup to the region region 3 12 Reading RTx Folder List H catch ExceptionTypel exception i H catch ExceptionType2 exception i t Tinally i H fexception code 1 fexception code 2 perform this code always Figure 3 25 Visual Studio try catch construct Our entire code starting from the region 3 3 is enclosed in the try construct If any exception is raised by the code enclosed within the program looks for that specific type of catch case If it exists the code will be executed and the exception will be suppressed All unhandled exceptions will break the program and show the default exception info window I TargetinvocationException was unhandled Exception has been thrown by the target of an invocation Troubleshooting tips Get general help for this exception InnerException Make sure you are not dividing by zero Get general help for the inner exception search for more Help Online Exception settings Break when this exception type is thrown Actions View Detail Figure 3 26 Unhandled exception wind
44. witching it on The alternative is including a fixed time pause but it is much more time efficient to let the instrument to decide how fast it can proceed Please note the difference between calling the method with the parameter Synchro Type WAI and SynchroType OPC driver Extended Synchro SynchroType OPC waits inside the method until all the previous commands have been processed driver Extended Synchro SynchroType WAI doesn t wait your program con tinues immediately it only tells the instrument that it should not continue with process ing any further commands before it has finished all the previous ones The actual nec essary pause will be achieved by waiting for a response of the next query in this case the first call of FetchMainMeasurement Hardcopy 3 10 Exporting the Waveforms to a csv file 3 11 This part of the example will export the waveforms to a csv file region 3 10 Exporting the Waveforms to a csv file string csvFileName c Temp data csv string columnSeparator string rowSeparator n double sampleTime var csvFile new StreamWriter csvFileName false Encoding Default csvFile Write Sample time in secs CH1 sample in V CH2 sample in V n for int i 1 lt waveform _CH1 Capacity i sampleTime waveform CH1 StartTime Totalseconds i waveform CH1 IntervalPerPoint TotalSeconds csvFile Write sampleTime ToString F6 columnSeparator samplesArray CH1 1
45. y RTx allows only for even number of samples Setting the odd number will cause the O RTx to coerce real number of samples to the closest higher even number e g 1101 gt 1102 Changing the variable newRecordLength from 1100 to 1101 Figure 3 17 would cause the FetchWaveform method to raise an exception Ivi Driver DataArrayTooSmallException because the actual capacity required would be 1102 samples Notice that prior to the call of Extended RunSingleWithRepeat the trigger source is changed to Channel 2 Since the hardware cabling is feeding the Probe Compensation signal to the Channel 1 the first attempt to acquire a new waveform will 3 9 Measurements result in timeout The Extended RunSingleWithRepeat will give you an option to change the trigger source back to Channel 1 or reconnect the probe to the Channel 2 and repeat the acquisition The workaround of repeated unsuccessful acquisition is very often the case in real remote control applications Conversion to an array object is achieved by using the GetAl1lElements method fconvert from waveforms to arrays double samplesArray CH1 new double waveform_CH1 Capacity double samplesArray CH2 new double waveTorm_CH2 Capacity samplesArray CH1 waveform _CH1 GetAllElements samplesArray CH2 waveform CH2 GetAllElements endregion Figure 3 19 Reading all the waveform elements into a double array The horizontal scale is repres

Download Pdf Manuals

image

Related Search

Related Contents

Honeywell THM6000R User's Manual  ISUCUTTERFS - ISU Judging System  Stereo Memory Man with Hazarai Instructions - Electro  EVBUM2065 - NB3N5573DTGEVB Evaluation Board User`s Manual  Colibri serie 5 : User's guide  Infinity CLASSIA PSW310W User's Manual  

Copyright © All rights reserved.
Failed to retrieve file