How to use the RS®NRP-Z Instrument Drivers - Rohde Schwarz

Miloslav Macko
August 28, 2013
How to use R&S NRPZ
instrument drivers
Table of Contents
2
NRP-Z Powersensors system drivers installation ............... 3
2.1
NRP-Toolkit installation .............................................................................. 4
2.2
Powersensor connection verification ........................................................ 5
3
NRP-Z Powersensors instrument drivers installation ......... 7
3.1
LabVIEW Instrument driver installation .................................................... 7
3.1.1
Location of installed files............................................................................ 7
3.1.1.1
32bit driver version ...................................................................................... 7
3.1.1.2
64bit driver version ...................................................................................... 8
3.2
LabWindows/CVI Instrument driver installation ....................................... 9
3.3
VXIplug&play Instrument driver installation ............................................. 9
3.3.1
Location of installed files............................................................................ 9
3.3.1.1
32bit driver version ...................................................................................... 9
3.3.1.2
64bit driver version ...................................................................................... 9
4
Usage of NRP-Z Powersensor Instrument drivers ............. 11
4.1
Instrument driver structure....................................................................... 11
4.2
Powersensor connection initialization .................................................. 13
4.2.1
Resource name .......................................................................................... 13
4.2.1.1
Resource name Examples ........................................................................ 14
4.2.2
Working with more than 1 powersensor ................................................. 14
4.2.2.1
1 VISA session, distinction by Channel .................................................. 14
2 NRP-Z Powersensors system drivers installation
Before using any instrument driver, the NRP-Z powersensor USB driver must be installed, since the
NRP-Z sensors are not USB TMC class devices. For that, Rohde & Schwarz provides free software
package called NRP-Toolkit. To download it, please follow the link:
http://www.rohde-schwarz.com/en/software/nrpz/
Figure 1: Rohde & Schwarz web-page NRP-Z related software
NRP-Toolkit includes NRP-Z powersensors USB driver and Power Viewer software that provides
graphical interface to use NRP-Z powersensors with just the computer. Power Viewer software
manual is also available for download through the link above.
2.1 NRP-Toolkit installation
-
-
Download and run NRP-Toolkit_x_x_x_x.exe
Connect the powersensor to you PC USB port. Powersensor’s power supply comes from USB
hub. Therefore, use only self-powered USB Hubs. All USB cables and hubs should have the
logo:
Don’t cascade USB hubs unnecessarily or extend USB cable lengths beyond total length of 5
meters.
Open Device Manager to see if powersensor is available:
Figure 2: Windows Device Manager with NRP-Z91 properly installed
Depending on NRP-Toolkit version, the device R&S NRP-Zxx can appear also in the group Universal
Serial Bus controllers. In case the NRP-Z USB driver is missing or not installed correctly, the Device
Manager will show NRP-Z in Other devices group:
Figure 3: Windows Device Manager with missing NRP-Z91 system drivers
2.1.1 Powersensor connection verification
After successful installation, run Power Viewer (c:\Program Files (x86)\Rohde-Schwarz\NRPToolkit\NrpFlashup.exe, select Power Viewer) The Powersensor type and serial number are
displayed in bottom right corner. In case more than 1 sensor is connected, you can switch between
them through menu item Options -> Select Sensor.
Figure 4: Power View with NRP-Z91 SN100025 connected
Power Viewer Plus (c:\Program Files (x86)\Rohde-Schwarz\NRP-Toolkit\PowerViewerPlus.exe)
offers much more functionalities, but for detecting the presence and proper connection of the
powersensor simple Power Viewer is sufficient. This is how Power Viewer Plus User interface looks
like with NRP-Z91 connected:
Figure 5: Power Viewer Plus with NRP-Z91 SN100025 connected
After succesfull connection verification, NRP-Z powersensor system drivers have been installed and
working correctly and NRP-Z powersensors are ready to work in all instrument drivers programming
environments.
3 NRP-Z Powersensors instrument drivers installation
3.1 LabVIEW Instrument driver installation
Follow the link:
http://www.rohdeschwarz.com/en/driver/nrpz/?&facet=facet.DriverTechnologie&facet.DriverTechnologie=LabVIEW
LabVIEW 2009 or higher is required to use this driver.
Windows version doesn’t play a role in selection whether to chose x64 or x86 version of the driver.
For 32bit version of LabVIEW download LabVIEW x86 Windows Driver rsnrpz
For 64bit version of LabVIEW download LabVIEW x64 Windows Driver rsnrpz
Run the installer. Since the LabVIEW driver is only a wrapper over VXIplug&play driver, VXIplug&play
driver will be installed along with it.
3.1.1 Location of installed files
Paths described in this chapter are default installation paths using Windows 7 64bit version. For
Windows 32bit version use Program Files instead of Program Files (x86) directory.
3.1.1.1
32bit driver version
VXIplug&play driver:
c:\Program Files (x86)\IVI Foundation\VISA\WinNT\rsnrpz
c:\Program Files (x86)\IVI Foundation\VISA\WinNT\include\rsnrpz.h
c:\Program Files (x86)\IVI Foundation\VISA\WinNT\Bin\rsnrpz_32.dll
LabVIEW driver (wrapper over rsnrpz_32.dll):
c:\Program Files (x86)\IVI Foundation\VISA\GWinNT\rsnrpz
c:\Program Files (x86)\IVI Foundation\VISA\GWinNT\rsnrpz
LabVIEW help file:
c:\Program Files (x86)\\IVI Foundation\VISA\GWinNT\rsnrpz\RSNRPZ.chm
In order to use this driver as a standard LabVIEW driver, please copy the contents of c:\Program
Files (x86)\IVI Foundation\VISA\GWinNT\rsnrpz directory into your LabVIEW directory c:\Program
Files (x86)\National Instruments\LabVIEW x.x\instr.lib. The driver will then be directly accessible
from the LabVIEW Instrument Driver function palette menu:
Figure 6: Accessing NRP-Z Instrument driver from LabVIEW palette
3.1.1.2
64bit driver version
VXIplug&play driver:
c:\Program Files\IVI Foundation\VISA\WinNT\rsnrpz
c:\Program Files\IVI Foundation\VISA\WinNT\include\rsnrpz.h
c:\Program Files\IVI Foundation\VISA\WinNT\Bin\rsnrpz_64.dll
LabVIEW driver (wrapper over rsnrpz_64.dll):
c:\Program Files\IVI Foundation\VISA\GWinNT\rsnrpz
LabVIEW help file:
c:\Program Files\IVI Foundation\VISA\GWinNT\rsnrpz\RSNRPZ.chm
In order to use this driver as a standard LabVIEW driver, please copy the contents of c:\Program
Files\IVI Foundation\VISA\GWinNT\rsnrpz directory into your LabVIEW directory c:\Program
Files\National Instruments\LabVIEW x.x\instr.lib. The driver will then be directly accessible from
the LabVIEW Instrument Driver function palette menu (see Figure 6)
3.2 LabWindows/CVI Instrument driver installation
Follow the link:
http://www.rohdeschwarz.com/en/driver/nrpz/?&facet=facet.DriverTechnologie&facet.DriverTechnologie=LabWindows
%2FCVI%20Plug%26Play
The LabWindows/CVI NRP-Powersensors instrument driver consists of a ZIP archive containing the
driver sources. In addition, the instrument driver documentation rsnrpz_vxi.chm.
Copy driver source to your CVI project and load instrument by selecting rsnrpz.fp. Header file
NrpControl2.h is a header file for dynamic link library NrpControl2.dll / NrpControl2_64.dll that is
placed in c:\Windows\System32 directory.
3.3 VXIplug&play Instrument driver installation
This driver is the most universal of all and can be used in all environments that support calling
dynamic link library functions. To download it, follow the link:
http://www.rohdeschwarz.com/en/driver/nrpz/?&facet=facet.DriverTechnologie&facet.DriverTechnologie=VXIplug%26pl
ay
3.3.1 Location of installed files
Paths described in this chapter are default installation paths using Windows 7 64bit version. For
Windows 32bit version use Program Files instead of Program Files (x86) directory.
3.3.1.1
32bit driver version
Additional driver files directory:
c:\Program Files (x86)\IVI Foundation\VISA\WinNT\rsnrpz
Help file:
c:\Program Files (x86)\IVI Foundation\VISA\WinNT\rsnrpz\rsnrpz_vxi.chm
Driver DLL:
c:\Program Files (x86)\IVI Foundation\VISA\WinNT\Bin\rsnrpz_32.dll
Header file:
c:\Program Files (x86)\IVI Foundation\VISA\WinNT\include\rsnrpz.h
C# wrapper:
c:\Program Files (x86)\IVI Foundation\VISA\WinNT\include\rsnrpz.cs
Visual Basic .NET wrapper:
c:\Program Files (x86)\IVI Foundation\VISA\WinNT\include\rsnrpz.vb
3.3.1.2
64bit driver version
Additional driver files directory:
c:\Program Files\IVI Foundation\VISA\WinNT\rsnrpz
Help file:
c:\Program Files\IVI Foundation\VISA\WinNT\rsnrpz\rsnrpz_vxi.chm
Driver DLL:
c:\Program Files\IVI Foundation\VISA\WinNT\Bin\rsnrpz_64.dll
Header file:
c:\Program Files\IVI Foundation\VISA\WinNT\include\rsnrpz.h
C# wrapper:
c:\Program Files\IVI Foundation\VISA\WinNT\include\rsnrpz64.cs
Visual Basic .NET wrapper:
c:\Program Files\IVI Foundation\VISA\WinNT\include\rsnrpz64.vb
4 Usage of NRP-Z Powersensor Instrument drivers
4.1 Instrument driver structure
Here, only VXIplug&play driver usage will be explained. LabWindows/CVI uses exactly the same API
as VXIplug&play driver. For LabVIEW, wrapper VI names are different from function names. For
example function rsnrpz_init() is in LabVIEW represented by RSNRPZ Initialize.vi. However, the
structure of both instrument drivers is the same. To find corresponding function, refer to help files
rsnrpz_vxi.chm and RSNRPZ.chm (see chapter 3 for location of help files)
Example of finding corresponding function rsnrpz_meass_readBufferMeasurement in LabVIEW:
Figure 7: Function rsnrpz_meass_readBufferMeasurement in VXPplug&play help file
Figure 8: Function “RSNRPZ Read Buffer Data.vi” in LabVIEW help file
LabVIEW driver location of VIs in folders directly corresponds to tree structure described in LabVIEW
help file:
Figure 9: LabVIEW driver folder structure
For backwards compatibility the following functions are still available, although not recommended to
be used anymore (see chapter 4.2.2 for more details):
rsnrpz_AddSensor / RSNRPZ Add Sensor.vi
rsnrpz_CloseSensor / RSNRPZ Close Sensor.vi
In LabVIEW, the VIs RSNRPZ One Sensor Connection.vi and RSNRPZ Two Sensor
Connection.vi are examples of how to connect one or more sensors using the Channel as identifier.
This is one of two methods how to work with more than one sensor. The other one is to use different
VISA session for each sensor (see chapter 4.2.2 for more details):
4.2 Powersensor connection initialization
Usage of the instrument driver always starts with Initializing of one or more powersensors.
Function prototype:
ViStatus rsnrpz_init ( ViRsrc resourceName,
ViBoolean idQuery,
ViBoolean resetDevice,
ViSession* instrumentHandle
);
4.2.1 Resource name
Resource name is the string with the following format:
USB::<VendorID>::<ProductID>::<SerialNumber>
VendorID is 0xAAD for all Rohde & Schwarz instrument
ProductID depends on powersensor model:
Powersensor model
ProductID
Powersensor model
ProductID
NRP-Z21
NRP-FU
FSH-Z1
NRP-Z11
NRP-Z22
NRP-Z23
NRP-Z24
NRP-Z51
NRP-Z52
NRP-Z55
NRP-Z56
FSH-Z18
NRP-Z91
NRP-Z81
NRP-Z31
NRP-Z37
0x0003
0x0004
0x000b
0x000c
0x0013
0x0014
0x0015
0x0016
0x0017
0x0018
0x0019
0x001a
0x0021
0x0023
0x002c
0x002d
NRP-Z96
NRP-Z27
NRP-Z28
NRP-Z98
NRP-Z92
NRP-Z57
NRP-Z85
NRPC40
NRPC50
NRP-Z86
NRP-Z211
NRP-Z221
NRP-Z58
NRPC33
NRPC18
0x002e
0x002f
0x0051
0x0052
0x0062
0x0070
0x0083
0x008f
0x0090
0x0095
0x00a6
0x00a7
0x00a8
0x00b6
0x00bf
In case the device is not listed in table above, Product ID can be read out from Device Manager
Properties Window. Right-click on device you want to find more details about and chose Properties
from context menu. Then, click on tab Details. In Property selector chose Hardware Ids:
Or including device serial number in Device Instance Path:
4.2.1.1
Resource name Examples
USB::0x0aad::0x000c::100001 – NRP-Z11 with Serial Number 100001
USB::0x0aad::0x021::* - first available NRP-Z91 Powersensor
USB::0xaad::* - first available Powersensor
4.2.2 Working with more than 1 powersensor
For legacy reasons, there are 2 ways how to work with more than 1 powersensor:
4.2.2.1
One session, powersensors addressed by Channel
This was the original way how to communicate with more than 1 powersensor in instrument driver.
That’s why almost all functions have parameter Channel still as their input parameter. The biggest
down-side of this solution is the dependency of n-th powersensor on using all n-1 ones. If user wants
to open powersensor in channel 5, he has to open 4 powersensors before that. In addition, opening
st
the very 1 one is done with different function than the rest of them.
Although this solution is still supported by the instrument driver, it is not recommended for
development of new applications.
Here’s the example how to open, access and close powersensors in this manner:
ViStatus iStatus;
ViSession iHandle;
//opening of 3 powersensors
iStatus = rsnrpz_init (“USB::0xAAD::0x000C::100001”, VI_TRUE, VI_TRUE, &iHandle);
iStatus = rsnrpz_AddSensor (iHandle, “USB::0xAAD::0x0021::100011”, 2, VI_TRUE, VI_TRUE);
iStatus = rsnrpz_AddSensor (iHandle, “USB::0xAAD::0x0003::100010”, 3, VI_TRUE, VI_TRUE);
//Usage of powersensors (zeroing all of them)
st
iStatus = rsnrpz_chan_zero (iHandle, 1); //zeroing the 1 powersensor
nd
iStatus = rsnrpz_chan_zero (iHandle, 2); //zeroing the 2 powersensor
rd
iStatus = rsnrpz_chan_zero (iHandle, 3); //zeroing the 3 powersensor
//Closing of all 3 powersensors
iStatus = rsnrpz_CloseSensor (iHandle, 1);
iStatus = rsnrpz_CloseSensor (iHandle, 2);
iStatus = rsnrpz_CloseSensor (iHandle, 3);
4.2.2.2
Unique session for each powersensor
With this approach every powersensor has its unique handle and they can be operated
independently. The parameter Channel is always set to 1 (or in LabVIEW not connected). This is the
recommended way of working with more than one powersensor
Same example as in previous chapter using unique sessions approach:
ViStatus iStatus;
ViSession iHandle1, iHandle2, iHandle3;
//opening of 3 powersensors
iStatus = rsnrpz_init (“USB::0xAAD::0x000C::100001”, VI_TRUE, VI_TRUE, &iHandle1);
iStatus = rsnrpz_init (“USB::0xAAD::0x0021::100011”, VI_TRUE, VI_TRUE, &iHandle2);
iStatus = rsnrpz_init (“USB::0xAAD::0x0003::100010”, VI_TRUE, VI_TRUE, &iHandle3);
//Usage of powersensors (zeroing all of them)
st
iStatus = rsnrpz_chan_zero (iHandle1, 1); //zeroing the 1 powersensor
nd
iStatus = rsnrpz_chan_zero (iHandle2, 1); //zeroing the 2 powersensor
rd
iStatus = rsnrpz_chan_zero (iHandle3, 1); //zeroing the 3 powersensor
//Closing of all 3 powersensors
iStatus = rsnrpz_Close (iHandle1); //or iStatus = rsnrpz_CloseSensor (iHandle1, 1);
iStatus = rsnrpz_Close (iHandle2); //or iStatus = rsnrpz_CloseSensor (iHandle2, 1);
iStatus = rsnrpz_Close (iHandle3); //or iStatus = rsnrpz_CloseSensor (iHandle3, 1);
Please notice that the function rsnrpz_Close closes all channels if more than one was added, while
rsnrpz_CloseSensor only closes the specified channel. That’s why for only one powersensor per
session both functions perform identical operation.
4.3 Examples
All examples are written in LabWindows/CVI with the intention to give user template about steps and
order of function calls to perform similar measurement tasks in his own programming language.
4.3.1 Simple non-triggered average mode
In this mode powersensor measures immediately for certain time (set by
rsnrpz_avg_configureAvgManual) and returns the result:
ViSession iHandle;
ViBoolean meas_complete = VI_FALSE;
ViReal64 dResultArray[1];
ViReal dMeasValue = 0.0;
ViInt32 iReadCount;
//initialization
rsnrpz_init (”USB::0x0aad::0x0021::100001”, 1, 1, & iHandle);
//configuration of the measurement
rsnrpz_chan_mode (iHandle, 1, 0); //continue average mode
rsnrpz_chan_setCorrectionFrequency (iHandle, 1, 1E9)); //setting corr. frequency to 1GHz
rsnrpz_trigger_setSource (iHandle, 1, 3); //immediate trigger
rsnrpz_avg_configureAvgManual (iHandle, 1, 5); //manual averaging of 5 values
//measurement – this section can be repeated to get more measurements
rsnrpz_chans_initiate (iHandle); //start the measurement – from this moment instrument reacts on
trigger event. In case of immediate trigger, it starts measuring immediately
//waiting for measurement to finish
do
{
rsnrpz_chan_isMeasurementComplete(io, 1, &meas_complete)); //check if measurement is complete
Delay (0.1); //wait 100ms
} while (meas_complete == VI_FALSE); //wait until measurement is completed. Include timeout for
this loop to prevent deadlock
rsnrpz_meass_fetchBufferMeasurement(io, 1, 1, &dResultArray, &iReadCount);
dMeasValue = dResultArray[0];
alternatively, for //measurement section the following code is functionally identical (see the difference
between functions rsnrpz_meass_readBufferMeasurement and
rsnrpz_meass_fetchBufferMeasurement
rsnrpz_meass_readBufferMeasurement (iHandle, 1, 5000, 1, &dResultArray, &iReadCount); //initialize
the measurement with timeout of 5000ms, wait for measurement to finish and read the result;
dMeasValue = dResultArray[0];
4.3.2 Externally triggered average mode
In this mode powersensor measurement is triggered by external signal on connector pin, measures
for certain time (set by rsnrpz_avg_configureAvgManual) and returns the result. The only difference to
the previous Simple non-triggered average mode is the following line:
rsnrpz_trigger_setSource (iHandle, 1, 1); //external trigger
Setting of the Trigger delay in this case is possible with rsnrpz_trigger_configureExternal
4.3.3 Internally triggered average mode
In this mode powersensor is triggered internally based on incoming signal and configured trigger
conditions. After that, it measures for certain time (set by rsnrpz_avg_configureAvgManual) and
returns the result.
ViSession iHandle;
ViBoolean meas_complete = VI_FALSE;
ViReal64 dResultArray[1];
ViReal dMeasValue = 0.0;
ViInt32 iReadCount;
//initialization
rsnrpz_init (”USB::0x0aad::0x0021::100001”, 1, 1, & iHandle);
//configuration of the measurement
rsnrpz_chan_mode (iHandle, 1, 0); //continue average mode
rsnrpz_chan_setCorrectionFrequency (iHandle, 1, 1E9)); //setting corr. frequency to 1GHz
rsnrpz_trigger_setSource (iHandle, 1, 4); //internal trigger
rsnrpz_trigger_configureInternal (iHandle, 1, 1.0e-6, 0); //trigger level 1uW, positive slope
rsnrpz_avg_configureAvgManual (iHandle, 1, 5); //manual averaging of 5 values
//measurement – this section can be repeated to get more measurements
rsnrpz_chans_initiate (iHandle); //start the measurement – from this moment instrument reacts on
trigger event.
//waiting for measurement to finish
do
{
rsnrpz_chan_isMeasurementComplete(io, 1, &meas_complete)); //check if measurement is complete
Delay (0.1); //wait 100ms
} while (meas_complete == VI_FALSE); //wait until measurement is completed. Include timeout for
this loop to prevent deadlock
rsnrpz_meass_fetchBufferMeasurement(io, 1, 1, &dResultArray, &iReadCount);
dMeasValue = dResultArray[0];
4.3.4 Internally triggered timeslot mode
In this mode powersensor is triggered internally based on incoming signal and configured trigger
conditions. After that, it measures integrated power over defined number of timeslots (set by
rsnrpz_tslot_configureTimeSlot) and returns the result.
ViSession iHandle;
ViBoolean meas_complete = VI_FALSE;
ViReal64 dResultArray[1];
ViReal dMeasValue = 0.0;
ViInt32 iReadCount;
//initialization
rsnrpz_init (”USB::0x0aad::0x0021::100001”, 1, 1, & iHandle);
//configuration of the measurement
rsnrpz_chan_mode (iHandle, 1, 2); //timeslot measurement mode
rsnrpz_chan_setCorrectionFrequency (iHandle, 1, 1E9)); //setting corr. frequency to 1GHz
rsnrpz_trigger_setSource (iHandle, 1, 4); //internal trigger
rsnrpz_trigger_configureInternal (iHandle, 1, 1.0e-6, 0); //trigger level 1uW, positive slope
rsnrpz_tslot_configureTimeSlot (io, 1, 3, 2e-3)); //measurement of 3 timeslots, each of 2ms width
//measurement – this section can be repeated to get more measurements
rsnrpz_chans_initiate (iHandle); //start the measurement – from this moment instrument reacts on
trigger event.
//waiting for measurement to finish
do
{
rsnrpz_chan_isMeasurementComplete(io, 1, &meas_complete)); //check if measurement is complete
Delay (0.1); //wait 100ms
} while (meas_complete == VI_FALSE); //wait until measurement is completed. Include timeout for
this loop to prevent deadlock
rsnrpz_meass_fetchBufferMeasurement(io, 1, 1, &dResultArray, &iReadCount);
dMeasValue = dResultArray[0];
About Rohde & Schwarz
Rohde & Schwarz is an independent group
of companies specializing in electronics. It is
a leading supplier of solutions in the fields of
test and measurement, broadcasting,
radiomonitoring and radiolocation, as well as
secure communications. Established more
than 75 years ago, Rohde & Schwarz has a
global presence and a dedicated service
network in over 70 countries. Company
headquarters are in Munich, Germany.
Environmental commitment
в—Џ Energy-efficient products
в—Џ Continuous improvement in
environmental sustainability
в—Џ ISO 14001-certified environmental
management system
Regional contact
Europe, Africa, Middle East
+49 89 4129 12345
customersupport@rohde-schwarz.com
North America
1-888-TEST-RSA (1-888-837-8772)
customer.support@rsa.rohde-schwarz.com
Latin America
+1-410-910-7988
customersupport.la@rohde-schwarz.com
Asia/Pacific
+65 65 13 04 88
customersupport.asia@rohde-schwarz.com
R&SВ® is a registered trademark of Rohde & Schwarz
GmbH & Co. KG; Trade names are trademarks of the
owners.
Rohde & Schwarz GmbH & Co. KG
MГјhldorfstraГџe 15 | D - 81671 MГјnchen
Phone + 49 89 4129 - 0 | Fax + 49 89 4129 – 13777
www.rohde-schwarz.com