Sample API Programs

Sample programs are located in these default installation directories:

C# Examples

C:\ProgramData\Keysight\Signal Studio\WLAN\ApiSample\CS

Visual Basic.Net Examples

C:\ProgramData\Keysight\Signal Studio\WLAN\ApiSample\VB

Requirements

Before you start to run these examples, make sure you have added "Agilent.SignalStudio.N7617.dll" and "Agilent.SignalStudio.dll" as the references to your API Project in Microsoft Visual Studio .NET 2003 IDE. The following steps, using Microsoft Visual Studio .NET 2003 IDE, outline a procedure for adding these references, if needed. The steps may vary depending on your development environment.

  1. From the File menu, create a new project or open an existing project in your Visual Studio.Net programming environment.

  2. Select Project > Add Reference.

  3. A window opens in which you can select the reference files. Locate the directory C:\Program Files\Keysight\Signal Studio\WLAN (This assumes that you installed Signal Studio for WLAN 802.11a/b/g/n/ac/ah/ax in the default location). Highlight "Agilent.SignalStudio.N7617.dll" and "Agilent.SignalStudio.dll".

  4. Click Add to add them in the project as references.

Control Procedure for 802.11a/b/g/j/p

This procedure provides information on how to build a typical program to generate, download, and run an 802.11a/b/g/j/p waveform using the WLAN API in C# programming code. See Tips for troubleshooting help.

1. Create API Handle

2. Configure Hardware

3. Configure the Waveform

4. Generate, Download, and Run the Waveform

5. Set RF On

6. Set RF Off

Tips

Control Procedure for 802.11n

This procedure provides information on how to build a typical program to generate, download, and run an Mx2 802.11n waveform package using the WLAN API in C# programming code. See Tips for troubleshooting help.

1. Create API Handle

2. Select MIMO function

3. Configure Hardware

4. Configure the Waveform

5. Generate, Download, and Run the Waveform

6. Set RF On

7. Set RF Off

Tips

Control Procedure for 802.11ac

This procedure provides information on how to build a typical program to generate, download, and run an Mx2 802.11ac waveform package using the WLAN API in C# programming code. See Tips for troubleshooting help.

1. Create API Handle

2. Select MIMO Function

3. Configure Hardware

4. Configure the Waveform

5. Generate, Download and Run the Waveform

6. Set RF On

7. Set RF Off

Tips

Control Procedure for 802.11ah

This procedure provides information on how to build a typical program to generate, download, and run an Mx2 802.11ah waveform package using the WLAN API in C# programming code. See Tips for troubleshooting help.

1. Create API Handle

2. Select MIMO Function

3. Configure Hardware

4. Configure the Waveform

5. Generate, Download and Run the Waveform

6. Set RF On

7. Set RF Off

Tips

Control Procedure for 802.11ax

This procedure provides information on how to build a typical program to generate, download, and run an Mx2 802.11ax waveform package using the WLAN API in C# programming code. See Tips for troubleshooting help.

1. Create API Handle

2. Select MIMO Function

3. Configure Hardware

4. Configure the Waveform

5. Generate, Download and Run the Waveform

6. Set RF On

7. Set RF Off

Tips

Control Procedure for 802.11a/b/g/j/p

1. Create API Handle

These commands specify how the software creates an API project handler:

using Agilent.SignalStudio.N7617;

LegacyAPI api = new LegacyAPI();

2. Configure Hardware

Connect to the signal generator using the correct address format:

For example, if the signal generator is connected via LAN, and the IP address is 192.168.100.10, the VISA name is

"TCPIP0::192.168.100.10::INSTR".

string inst = "TCPIP0::192.168.100.10::INSTR";

bool connected = api.ConnectInstrument (inst);

3. Configure the Waveform

Get a carrier object.

Agilent.SignalStudio.N7617.CarrierLegacy carrier = waveformSetup.Carrier[0];

Get the signal generator object.

Agilent.SignalStudio.N7617.SigGenConfigD sigGen = api.Hardware.OneSG;

Set the RF frequency to 2.412 GHz (1e9)

sigGen.Frequency = 2.412e9;

Set the amplitude to -30.0 dBm.

sigGen.Amplitude = -30.0;

4. Generate, Download and Run the Waveform

Generate and download the waveform to the signal generator, then run it.

api.Download();

5. Set RF On

Turn the signal generator's RF output on.

api.Hardware.OneSG.RfOutputEnabled = true;

api.Hardware.UpdateToInstrument();

6. Set RF Off

Turn off the RF output.

api.Hardware.SignalGenerator.RFOutputEnabled = false;

api.Hardware.UpdateToInstrument();

Control Procedure for 802.11n

1. Create API Handle

These commands specify how the software creates an API project handler:

using Agilent.SignalStudio.N7617;

MimoAPI api = new MimoAPI ();

2. Select MIMO Function

Before connecting to the signal generator, select the MIMO function:

api.SetMimoFunction(MimoFunction.MIMO_Mx2_2SG);

3. Configure Hardware

Connect to the signal generators using the correct address format:

For example, if the two signal generators are connected via LAN, and the IP addresses are 192.168.100.10 and 192.168.100.11 respectively, the VISA names are

"TCPIP0::192.168.100.10::INSTR" and "TCPIP0::192.168.100.11::INSTR".

string inst1 = "TCPIP0::192.168.100.10::INSTR";

string inst2 = "TCPIP0::192.168.100.11::INSTR";

bool connected = api1.ConnectInstrument (inst1, inst2);

4. Configure the Waveform

Select the spatial mapping scheme and MCS index:

api.WaveformSetup.Config.SpatialMappingScheme = SpatialMappingScheme.SpatialExpansion;

api.WaveformSetup.Config.McsIndex.Index = 15;

Get the first signal generator object.

Agilent.SignalStudio.N7617.SigGenConfigD sigGen0 = api.Hardware.SGArray[0];

Get the second signal generator object.

Agilent.SignalStudio.N7617.SigGenConfigD sigGen1 = api.Hardware.SGArray[1];

Set the RF frequency to 2.412 GHz (1e9).

sigGen0.Frequency = 2.412e9;

sigGen1.Frequency = 2.412e9;

Set the amplitude to -30.0 dBm.

sigGen0.Amplitude = -30.0;

sigGen1.Amplitude = -30.0;

5. Generate, Download and Run the Waveform

Generate and download the waveform packages to the signal generators, then run them.

api.Download();

6. Set RF On

Turn the signal generator's RF output on.

sigGen0.RfOutputEnabled = true;

sigGen1.RfOutputEnabled = true;

api.Hardware.UpdateToInstrument();

7. Set RF Off

Turn off the RF output.

sigGen0.RfOutputEnabled = false;

sigGen1.RfOutputEnabled = false;

api.Hardware.UpdateToInstrument();

Tips

use try..catch( )

If an error occurs, the software produces an exception.

Using try..catch() is a way to program the software's API to capture exceptions.

You may use try..catch() for each method call or one try..catch() for all methods to call. The example below opens the

settings file test1.scp and displays an error message if the software produces an exception.

string FullpathFilename1 = "C:\\Program Files\\Keysight\\Signal Studio\\N7617B WLAN\\test1.scp";

LegacyApi api = new LegacyApi ();

try

{

api.OpenSettingsFile(FullpathFilename1);

}

catch (Exception ex)

{

MessageBox.Show(ex.Message);

}

Control Procedure for 802.11ac

1. Create API Handle

These commands specify how the software creates an API project handler:

using Agilent.SignalStudio.N7617;

Wlan11acAPI api = new Wlan11acAPI();

2. Select MIMO Function

Before connecting to the signal generator, select the MIMO function:

api.SetWlan11acFunction(Mimo11acFunction.MIMO_MxN_1SG);

3. Configure Hardware

Connect to the signal generators using the correct address format:

For example, if the two signal generators are connected via LAN, and the IP addresses are 192.168.100.10 and 192.168.100.11 respectively, the VISA names are "TCPIP0::192.168.100.10::INSTR" and "TCPIP0::192.168.100.11::INSTR".

string inst1 = "TCPIP0::192.168.100.10::INSTR";

string inst2 = "TCPIP0::192.168.100.11::INSTR";

bool connected = api1.ConnectInstrument (inst1, inst2);

4. Configure the Waveform

Get an IEEE 802.11ac object.

Agilent.SignalStudio.Wlan11ac.CarrierSetup carrier = api.WaveformSetup.CarrierConfig;

Get a User object.

UserSetup usr = api.WaveformSetup.CarrierConfig.UserSetups[0];

Get a MPDU object.

MpduSetup mpdu = api.WaveformSetup.CarrierConfig.UserSetups[0].MpduSetups[0];

Select the spatial mapping scheme:

api.WaveformSetup.CarrierConfig.SpatialMappingScheme = Agilent.SignalStudio.Wlan11ac.SpatialMappingScheme.SpatialExpansion;

Get the first signal generator object.

Agilent.SignalStudio.N7617.SigGenConfigD sigGen0 = api.Hardware.SGArray[0];

Get the second signal generator object.

Agilent.SignalStudio.N7617.SigGenConfigD sigGen1 = api.Hardware.SGArray[1];

Set the RF frequency to 2.412 GHz (1e9).

sigGen0.Frequency = 2.412e9;

sigGen1.Frequency = 2.412e9;

Set the amplitude to -30.0 dBm.

sigGen0.Amplitude = -30.0;

sigGen1.Amplitude = -30.0;

5. Generate, Download and Run the Waveform

Generate and download the waveform packages to the signal generators, then run them.

api.Download();

6. Set RF On

Turn the signal generator's RF output on.

sigGen0.RfOutputEnabled = true;

sigGen1.RfOutputEnabled = true;

api.Hardware.UpdateToInstrument();

7. Set RF Off

Turn off the RF output.

sigGen0.RfOutputEnabled = false;

sigGen1.RfOutputEnabled = false;

api.Hardware.UpdateToInstrument();

Control Procedure for 802.11ah

1. Create API Handle

These commands specify how the software creates an API project handler:

using Agilent.SignalStudio.N7617;

using Agilent.SignalStudio;

using Agilent.SignalStudio.Wlan11ah;

Wlan11ahAPI api = new Wlan11ahAPI();

2. Select MIMO Function

Before connecting to the signal generator, select the MIMO function:

api.SetWlan11ahFunction(Mimo11ahFunction.MIMO_MxN_1SG);

3. Configure Hardware

Connect to the signal generators using the correct address format:

For example, if the two signal generators are connected via LAN, and the IP addresses are 192.168.100.10 and 192.168.100.11 respectively, the VISA names are "TCPIP0::192.168.100.10::INSTR" and "TCPIP0::192.168.100.11::INSTR".

string inst1 = "TCPIP0::192.168.100.10::INSTR";

string inst2 = "TCPIP0::192.168.100.11::INSTR";

bool connected = api1.ConnectInstrument (inst1, inst2);

4. Configure the Waveform

Get an IEEE 802.11ah object.

Agilent.SignalStudio.Wlan11ah.SignalSetup carrier = api.WaveformSetup.SignalConfig;

Get a User object.

UserSetup usr = api.WaveformSetup.SignalConfig.UserSetups[0];

Get a MPDU object.

MpduSetup mpdu = api.WaveformSetup.SignalConfig.UserSetups[0].MpduSetups[0];

Select the spatial mapping scheme:

api.WaveformSetup.SignalConfig.SpatialMappingScheme = Agilent.SignalStudio.Wlan11ah.SpatialMappingScheme.SpatialExpansion;

Get the first signal generator object.

Agilent.SignalStudio.N7617.SigGenConfigD sigGen0 = api.Hardware.SGArray[0];

Get the second signal generator object.

Agilent.SignalStudio.N7617.SigGenConfigD sigGen1 = api.Hardware.SGArray[1];

Set the RF frequency to 920 MHz (1e6).

sigGen0.Frequency = 920e6;

sigGen1.Frequency = 920e6;

Set the amplitude to -30.0 dBm.

sigGen0.Amplitude = -30.0;

sigGen1.Amplitude = -30.0;

5. Generate, Download and Run the Waveform

Generate and download the waveform packages to the signal generators, then run them.

api.Download();

6. Set RF On

Turn the signal generator's RF output on.

sigGen0.RfOutputEnabled = true;

sigGen1.RfOutputEnabled = true;

api.Hardware.UpdateToInstrument();

7. Set RF Off

Turn off the RF output.

sigGen0.RfOutputEnabled = false;

sigGen1.RfOutputEnabled = false;

api.Hardware.UpdateToInstrument();

Control Procedure for 802.11ax

1. Create API Handle

These commands specify how the software creates an API project handler:

using Agilent.SignalStudio.N7617;

Wlan11axAPI api = new Wlan11axAPI();

2. Select MIMO Function

Before connecting to the signal generator, select the MIMO function:

api.SetWlan11axFunction(Mimo11axFunction.MIMO_MxN_1SG);

3. Configure Hardware

Connect to the signal generators using the correct address format:

For example, if the two signal generators are connected via LAN, and the IP addresses are 192.168.100.10 and 192.168.100.11 respectively, the VISA names are "TCPIP0::192.168.100.10::INSTR" and "TCPIP0::192.168.100.11::INSTR".

string inst1 = "TCPIP0::192.168.100.10::INSTR";

string inst2 = "TCPIP0::192.168.100.11::INSTR";

bool connected = api1.ConnectInstrument (inst1, inst2);

4. Configure the Waveform

Get an IEEE 802.11ax object.

Agilent.SignalStudio.Wlan11ax.CarrierSetup carrier = api.WaveformSetup.CarrierConfig;

Get a User object.

UserSetup usr = api.WaveformSetup.CarrierConfig.UserSetups[0];

Get a MPDU object.

MpduSetup mpdu = api.WaveformSetup.CarrierConfig.UserSetups[0].MpduSetups[0];

Select the spatial mapping scheme:

api.WaveformSetup.CarrierConfig.SpatialMappingScheme = Agilent.SignalStudio.Wlan11ax.SpatialMappingScheme.SpatialExpansion;

Get the first signal generator object.

Agilent.SignalStudio.N7617.SigGenConfigD sigGen0 = api.Hardware.SGArray[0];

Get the second signal generator object.

Agilent.SignalStudio.N7617.SigGenConfigD sigGen1 = api.Hardware.SGArray[1];

Set the RF frequency to 2.412 GHz (1e9).

sigGen0.Frequency = 2.412e9;

sigGen1.Frequency = 2.412e9;

Set the amplitude to -30.0 dBm.

sigGen0.Amplitude = -30.0;

sigGen1.Amplitude = -30.0;

5. Generate, Download and Run the Waveform

Generate and download the waveform packages to the signal generators, then run them.

api.Download();

6. Set RF On

Turn the signal generator's RF output on.

sigGen0.RfOutputEnabled = true;

sigGen1.RfOutputEnabled = true;

api.Hardware.UpdateToInstrument();

7. Set RF Off

Turn off the RF output.

sigGen0.RfOutputEnabled = false;

sigGen1.RfOutputEnabled = false;

api.Hardware.UpdateToInstrument();

API Help

Microsoft.Net-Based API