Installing the FCC’s ‘TVStudy’ in 24 Easy Steps

Doug Lung In early February, the FCC released “TVStudy” as a compiled program for Mac OS-X and as source code for other operating systems to illustrate how coverage and interference could be calculated for TV stations before and after Incentive Auction repacking. I've provided a step-by-step how-to get it running under Linux.

An easy way to run Linux on an existing OS like Windows is set to up a virtual machine by downloading and installing Oracle Virtual- Box from http://www.virtualbox.org. Allow at least 60 GB for Linux and the TVStudy program. I recommend using the Xfce version of Manjaro, a pre-configured version of Arch Linux from http://manjaro.org/. See the VirtualBox and Manjaro web sites and the wiki at https://wiki.archlinux.org/ for details on installation and configuration.

After booting Manjaro in VirtualBox you should see a screen like the one in Fig. 1. The TVStudy installation uses the terminal program in Manjaro. Information you need to input at the command prompt in the terminal window is in bold.

These steps should work with other Linux distributions if you verify and change the file locations in the Makefile and tvstudy.h if necessary and the package installation command. See the instructions the FCC link in step 8 for a description of the output files and more program options.

Next month I’ll provide more details on the settings and show how to display cell by cell results in Google Earth.

E-mail me at dlung@transmitter.com with any questions or comments.

After booting Manjaro in VirtualBox you should see a screen like the one in Fig. 1. The TVStudy installation uses the terminal program in Manjaro. Information you need to input at the command prompt in the terminal window is in bold.

1) Install MySQL using: sudo pacman -S mysql libmysqlclient mysql-clients

Fig. 1: Screenshot after booting Manjaro in VirtualBox 2) Install Java: sudo pacman -S jdk7-openjdk

3) Install the Fortran compiler: sudio pacman -S gcc-fortran

4) Install the core bsd libraries: sudo pacman -S libbsd

5) Install git, needed to download the libnostd library: sudo pacman –S git

6) Download libnostd (http://25thandclement.com/~william/projects/libnostd.html) using git: git clonehttp://25thandClement.com/~william/projects/libnostd.git

7) From the downloaded libnostd/ directory, copy the files in libnostd/bsd to /usr/include/bsd– sudo cp -R bsd/ /usr/include/

8) Download the FCC TVStudy files from http://data.fcc.gov/download/ incentive-auctions/OET-69/ and put them in your home directory. The files total over 16 GB so it may take days to download depending on your Internet connection. The tar archive is broken into 2 GB files that can be downloaded individually.

8) Install the par2 library and program to test and repair the FCC files (optional): sudo pacman -S libpar2 par2cmdline

Fig. 2: Longley Rice error flags 9) Verify the files: par2 v 2013Jan_tvstudy_files.par2
This will also take a long time. Be patient.
If errors are found repeat using “r” to repair instead of “v”.

11) Concatenate the tgz (gzip compressed tar files). All eight files must be listed in the correct order! Due to page formatting it shows here as multiple lines, but everything must be entered on one line. It will take a long time to complete.

cat 2013Jan_tvstudy_files.tgz.001 2013Jan_tvstudy_files.tgz.002
2013Jan_tvstudy_files.tgz.003 2013Jan_tvstudy_files.tgz.004
2013Jan_tvstudy_files.tgz.005 2013Jan_tvstudy_files.tgz.006
2013Jan_tvstudy_files.tgz.007 2013Jan_tvstudy_files.tgz.008 >
2013Jan_tvstudy_files.tgz

12) Extract the files: tar zxvf 2013Jan_tvstudy_files.tgz This will also take a long time

13) Download modified Makefile and tvstudy.h files from: http://xmtr.com/tvstudy/Arch/Makefile and http://xmtr.com/tvstudy/Arch/tvstudy.h

14) Copy Makefile to 2013Jan_tvstudy_files/dev/Makefile

15) Copy tvstudy.h to 2013Jan_tvstudy_files/dev/src/tvstudy.h

16) Change to the 2013Jan_tvstudy_files/dev directory. Clean out any old compiled programs (just to be sure...) and then compile the program. Although warnings may appear it should complete without errors:
make clean
make all

17) If there are no errors, install: make install

18) Configure systemd to start MySQL automatically when Linux starts then start MySQL:
sudo systemctl enable mysqld
sudo systemctl start mysqld

19) Start a MySQL shell. You should see the greeting and a mysql> prompt if all goes well: mysql -u root

20) Set the MySQL password. I used “tv”. Don’t forget the “;” at the end! update mysql.user set password = password(‘tv’) where user = ‘root’;

21) Exit MySQL by typing exit without the “;”

22) Change to the 2013Jan_tvstudy_files/sql directory. Build the database for TVStudy. Like some of other steps, this will take a long time. Go do something else for a while! This command MUST be run from the 2013Jan_tvstudy_files/sql directory!
mysql -u root -p

enter the password from step 20 at the password prompt. At the mysql> prompt enter: source build_root.sql When the mysql>prompt returns, type exit

23) Change to the 2013Jan_tvstudy_files/ directory and start your first study: java -jar tvstudy.jar

The password is the one set in step 20. Under the “Study” menu select “New”. Before clicking “Create”, click “Browse” to select the CDBS file location, normally at 2013Jan_tvstudy_files/cdbs/22Feb2012 then after a while a dialog will appear to change the default parameters. Ignore it for now.

Create a Scenario by selecting “New” in the Scenario window that opens after the study is created. Give the Scenario a name and hit “Create”. Do not bother with the other options on the screen for now.

On the next screen, click the “Add” button at the bottom of the window. You can now search CDBS for a specific station by facility ID, Call Sign, File Number or channel and city.

If you want to analyze interference check the “Add undesired stations” box. A list of matching records will be displayed in a box below. Click “Use” to select the one to study.

Once all the stations are loaded the list will be displayed and stations can be added or removed. DO NOT USE THE [X] on the frame to close any TVStudy Java windows! Only use the “Close” menu item under “Window”!

In the window for the study you have created there will be three tabs— Scenarios, Rules, and Study. “Rules” allows you to modify OET-69 interference rules and “Study” changes the Longley-Rice parameters, including treatment of Longley Rice error flags.

To replicate the current OET-69 defaults, change “Longley-Rice Error Handling” to “Assume Service” and the “Depression angle method” to “Effective Height” rather than “True Geometry.” The 2010 population data is the default, but to match existing OET-69 studies 2000 population will have to be selected.

Click the “Save Study” button in the lower right. It can also be saved under the “Scenario” menu. Close the windows using the “Window” menus’ “Close” function.

24) The study has to be run from the command line. For example, if the study created in step 23 was called “KNBC”, the scenario was called “KNBC_default” and the output file name is to be “knbc_default” the command would be:
./tvstudy localhost root tv “KNBC” “KNBC_default” knbc_default

Doug Lung

Doug Lung is one of America's foremost authorities on broadcast RF technology. As vice president of Broadcast Technology for NBCUniversal Local, H. Douglas Lung leads NBC and Telemundo-owned stations’ RF and transmission affairs, including microwave, radars, satellite uplinks, and FCC technical filings. Beginning his career in 1976 at KSCI in Los Angeles, Lung has nearly 50 years of experience in broadcast television engineering. Beginning in 1985, he led the engineering department for what was to become the Telemundo network and station group, assisting in the design, construction and installation of the company’s broadcast and cable facilities. Other projects include work on the launch of Hawaii’s first UHF TV station, the rollout and testing of the ATSC mobile-handheld standard, and software development related to the incentive auction TV spectrum repack.
A longtime columnist for TV Technology, Doug is also a regular contributor to IEEE Broadcast Technology. He is the recipient of the 2023 NAB Television Engineering Award. He also received a Tech Leadership Award from TV Tech publisher Future plc in 2021 and is a member of the IEEE Broadcast Technology Society and the Society of Broadcast Engineers.