These commands specify how the software create an API project handler:
using System;
using Keysight.SignalStudio.N7611;
using Keysight.SignalStudio.Hardware;
API api = new API();
BroadcastRadioProject project = api.CreateProject("DAB") as BroadcastRadioProject;
Connect to the signal generator using the correct address format:
GPIB(board address)::(primary address)::(secondary address)::INSTR
TCPIP0::(IP address)::INSTR
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";
bproject.ConnectToInstrument(inst);
Get the waveform setup object.
Keysight.SignalStudio.N7611.WaveformSetup waveformSetup = project.WaveformSetup;
waveformSetup.WaveformName = "DAB_TEST";
Get the carrier object.
DAB_Carrier carrier = waveformSetup.Carrier[0] as DAB_Carrier;
carrier.Ensemble.EnsembleLabel = "New Label";
DAB_ServiceComponent serviceComponent = carrier.Ensemble.Services[0].ServiceComponents[0] as DAB_ServiceComponent;
serviceComponent.DataSourceType = DataSourceType.Demo;
serviceComponent.DemoFile = DemoFile.DAB_Mono_128;
Get the signal generator object.
Keysight.SignalStudio.Hardware.SignalGenerator sigGen = project.Hardware.SignalGenerator;
Set the RF frequency to 229.072 MHz (229.072e6)
sigGen.Frequency = 229.072e6;
Set the amplitude to -8.0 dBm.
sigGen.Amplitude = -8.0;
Generates and downloads the waveform to the signal generator, then runs it.
project.Download();
Set the signal generator's RF output on.
project.Hardware.SignalGenerator.RFOutputEnabled = true;
project.Hardware.UpdateToInstrument();
Turn off the RF output.
project.Hardware.SignalGenerator.RFOutputEnabled = false;
project.Hardware.UpdateToInstrument();
End the program.
project.Close();
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\\SignalStudio\\Broadcast Radio\\test1.scp";
API api = new API();
BroadcastRadioProject project;
try
{
project = (BroadcastRadioProject) api.OpenSettingsFile(FullpathFilename1);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}