Build AM NRSC masks for SIGLENT SSA3000X/SVA1015Xs using a Python script
October 19, 2017
Many broadcast applications require monitoring a transmitter and observing the output amplitude vs. frequency. For AM radio applications, a common mask is defined by the National Radio Systems Committee (NRSC) and is commonly referred to as the AM NRSC mask.
Table 1 shows the general analog AM NRSC-2-B mask values around a center frequency (fc).
|Segment||Point||Frequency (kHz)||Amplitude (dB)|
|1||1||fc – 100||-80|
|2||fc – 75||-80|
|2||3||fc – 75||-65|
|4||fc – 60||-65|
|3||5||fc – 60||-65|
|6||fc – 30||-35|
|4||7||fc – 30||-35|
|8||fc – 20||-35|
|5||9||fc – 20||-25|
|10||fc – 10.2||-25|
|6||11||fc – 10.2||0|
|12||fc + 10.2||0|
|7||13||fc + 10.2||-25|
|14||fc + 20||-25|
|8||15||fc + 20||-35|
|16||fc + 30||-35|
|9||17||fc + 30||-35|
|18||fc + 60||-65|
|10||19||fc + 60||-65|
|20||fc + 75||-65|
|11||21||fc + 75||-80|
|22||fc + 100||-80|
Table 1: NRSC-2-B mask for analog AM broadcasts
Figure 1 below shows the graphic of a mask built for a center frequency (fc) of 1320 kHz and a 0 dB signal maximum. Be aware that the mask may need to be adjusted to meet your application requirements.
Figure 1: NRSC-2-B AM mask centered on 1320 kHz.
As you can see, the mask is built around a center frequency and is composed of multiple line segments. The SSA3000X and the companion EasySpectrum software have the ability to manually create limit lines, but building more than a few can become time-consuming and would increase the potential for errors. This is a perfect application for automation using software
In this application note, we are going to describe how to set up and use a sample program written in Python that automatically builds a limit file for use with SIGLENT SSA3000X spectrum analyzers. Simply enter the desired center frequency and the limit line segments will be built and saved as a limit file (*.LIM extension) that can be transferred to the analyzer via USB memory stick or SIGLENT EasySpectrum software.
We will also briefly show how the application can be edited to build masks for other applications (IBOC, FM, etc..).
NOTE: For NRSC transmitters > 500 W, the SSA3000X/X Plus/X-R/SVA1000X models may not be suitable due to DANL limitations when used with the recommended NRSC antenna.
1. Download Python 2.7.12:
NOTE: Python is a free open source object-oriented programming language. It has been used to build many applications that you may use on a daily basis, as well as some games:
This installation version contains IDLE, the integrated development environment. A development environment lets you configure and edit the code as well as troubleshoot and execute the program. Many of the images used in this note will be screenshots of the program loaded into the IDLE environment.
2. Download and open the zip file SSA3XNRSC_AM_Limit.zip. It may be best to put the entire zip file into a folder named “NRSC” or similar and unzip it there.
The zip should be available on the SIGLENT SSA3000X Product page.
The file contains:
– SSA3XNRSC_AM_Limit_062017.py : This is the python code that will create the mask files.
– NRSC_AM.xlsx : This is an Excel file with the generic table of NRSC data and a small calculator to verify that the mask shape meets the application requirements.
– 1320_NRSC.lim : An example of a mask file created for 1320 kHz.
– NRSCPythonMaskBuilder_062017.PDF : Instructions on how to use the files.
NOTE: You can use a free utility like WinZip or 7-Zip to unzip a compressed file. A quick Google Search for “zip utility” or similar should help.
RUNNING THE PROGRAM FROM THE DESKTOP:
You can run a *.PY a number of ways. For this application, we will show a convenient method using the Windows (WIN10) command line.
1. Find SSA3XNRSC_AM_Limit_062017.py:
2. Right-click on the file and select “Create Shortcut”
3. Drag the shortcut to the desktop:
4. Right-click on the desktop shortcut, type “cmd /k ” in front of the Target text, and press Apply:
You should notice that the desktop shortcut icon changes shape. This visually helps indicate that the shortcut will run the “Command Line” or cmd interface of Windows:
Shortcut with .PY target
Shortcut with CMD target
You can rename the shortcut by right-clicking on the icon and select “Rename”.
BUILDING LIMIT FILES:
Now that everything is configured, we can get down to the actual task at hand. Building limit files.
1. Left-click on the shortcut for the limit builder on the desktop.
2. The program will open a command line window with a prompt asking if you want to build a mask or close the program:
3. After typing Y and pressing ENTER, the program will open a file dialog box. Browse to folder that you wish to use to store the limit files, give the file a name, and press Save.
In this example, we will save 1320_NRSC.lim:
4. Enter the center frequency in kHz.
5. The program will then print the center frequency in Hz, then list the actual frequency and amplitude data for each line segment in the limit line:
6. Press Y to build another mask or N to close.
7. You can check the created file by opening it using a text editor like Notepad:
8. You can transfer the file to USB and manually load the limit line to an analyzer or use the EasySpectrum software to load the file to the instrument. See the SSA3000X User’s guide for more information on loading files from USB or the EasySpectrum Getting Started Guide for more details.
Here are two limit lines (1320 and 1420 kHz NRSC) manually loaded via a USB stick on the front panel:
EDITING THE MASK CODE
Editing the mask is actually quite simple. The standard mask is comprised of 17 line segments. Each segment is defined by two points: The first point is comprised of a start frequency and amplitude. The second point is comprised of the end frequency and amplitude of the end point.
Opening the .PY file with IDLE or another python development environment will show you the following:
A closer look at the first line segment list shows this:
strCenterFreq is a string that represents the center frequency (fc) in kHz
-100000 is the frequency point that lies -100 kHz away from fc as defined by the mask standard
-8.000000e+001 represents the amplitude in dB of the point
Before you edit, save the .PY file as a copy so as to preserve the original NRSC mask data. After saving the copy, edit the frequency and amplitude limit values for each point and resave. You can also delete or add points to the fly_Segment_List.
For more information, check the SSA3000X Product Page, or contact your local Siglent office.