[amsat-bb] Programming question - frequency units

Phil phillor at telstra.com
Tue Dec 15 23:49:45 PST 2009

Thank you for reading this.

After a five year rest from the satellites I may soon be in a position to once 
again resume one of my favourite hobbies. So, over the past couple of 
months I have been updating my tracking programme. In the process I have 
discovered that I need to make a design change.

Originally the whole programme used Hertz as the frequency unit until 
AO-40 came along and the numbers became too large for the int variables. 
It wasn't too difficult, at the time, to change to long variables but I found 
the long strings of numbers confusing especially in the configuration file. So 
then I experimented with double variables in Kilohertz. Around the same 
time AO-40 died and a lifestyle change ended my access to all satellites as 

I've rewritten the configuration class and modelled it around Erich 
Eichmann's sqf Doppler file which has made selecting satellites with multiple 
modes neater. This is where the design decision comes in.

The main class now uses Kilohertz as the frequency unit while the radio 
class still uses Hertz. The main class is responsible for the conversion each 
way but confusion reigns supreme because some variables are in Hertz and 
others in Kilohertz. This is currently causing me a problem where I'm 
modifying the code that takes care of calculating a new uplink frequency 
when the receiver VFO dial is moved.

It seems to me that the best idea is to rewrite the radio class so that it 
accepts double type Kilohertz parameters. This introduces minor frequency 
errors of a few Hertz due to rounding errors but I don't think that is a 
problem since my FT-847 only has a ten Hertz resolution anyway.

Alternatively, I could convert the double frequencies in the configuration 
class to longs and use long variables in all other classes. This will now be a 
more difficult and error prone task to undertake.

To answer my own question, I think working in Kilohertz might be the best 
option but I'd still like to know how others have handled frequency units.  


More information about the AMSAT-BB mailing list