home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
HAM Radio 3
/
hamradioversion3.0examsandprograms1992.iso
/
cw
/
robocopy
/
robo.alg
next >
Wrap
Text File
|
1990-09-21
|
7KB
|
118 lines
Thσ ROBO-COP┘ CW Algorithm
Before we start writing the program, we
have to decide on the algorithm (method) to be used to time the
dits and dahs. How does the computer decide that a "mark" (Mark
is the presence of signal, either dit or dah. Space is absence of
signal.) falls into the dit or dah category ?
A good approach to try would be to cal-
culate the average of some number of marks. The average, or as it
is called by statisticians, the arithmetic mean, is calculated by
adding up a number of related values then dividing that sum by
that number of values. The ARRL tells us that proper Morse
timing is that a dah is three times as long as a dit. This means
that the calculated mark average should be 2 dits, assuming equal
numbers of dits and dahs. As you can see in Figure 2, this
average is an excellent point of reference for sorting marks into
dits and dahs.
WPM = 2.4/(Average of Marks in milliseconds)
AVERAGE
DIT | DAH
|________|_________|_________|
Time in milliseconds 0ms 60ms 120ms 180ms
Deviation from mean < -60ms > < +60ms >
Figure 2. Time values for 20 wpm cw.
5
The important factor here is the number
of marks used to calculate the average. If that number is too
small the average will become easily skewed by uneven occurrences
of either dits or dahs. An example of this skew can be seen in
the phrase "1000 watt"; it contains 24 dahs but only 3 dits. In
this example the average would quickly converge to the length
(time) of a dah.
If we select a very large number (>250)
of samples for the averaging calculation, we can effectively
"swamp out" all but the most absurd of the "pathological" pat-
terns that would significantly skew the average. An additional
benefit to having a large number of samples in the average would
be better noise immunity should an errant value enter the cal-
culation due to QRM or QRN.
A scheme based on a large sample average
would work well if all cw operators could standardize on a fixed
baud rate, much like the way the asyncronous serial protocols
work. Unfortunately, the real world of cw is anything but stand-
ard when it comes to transmission speed. CW speed not only varies
from operator to operator but it also changes if the operator
fatigues or desires to emphasize certain portions of the trans-
mission such as signal reports, QTH, etc.
There are two major disadvantages to the
large sample average. The larger the number of samples used in an
average the less responsive to change it becomes. When a big
change in the transmission rate is encountered, such a system
requires an infusion of many dozens of new mark values before it
would have an accurate enough average to operate properly. During
this time much of the QSO would have be lost in a sea of garbled
characters. Large sample averages are also computationally
intensive, restricting their use with only the fastest machines.
The MEAN Machine.
ROBO-COPY's algorithm uses a smaller
number of samples, 32, allowing it to "sync up" rapidly to vary-
ing transmission rates. The trick is to manage the entries that
are used in the calculation of the average. First, errant mark
values due to noise are reduced by the sampling filter that-
qualifies each mark as it happens. Then a pre-screening function
ensures that skew is minimized by disallowing more than 3 suc-
cesive marks of the same length (+/- 12.5%) from being entered
into the average calculation.
Another type of statistical operation
used in ROBO-COPY is the mean deviation. It is used to detect
large changes in the transmission speed and adjust for dah to ditè ratios that aren't 3:1. The mean deviation is the difference be-
tween the average and the current mark value. A record of the
past 32 deviations from average is maintained. Figure 2 shows
6
that under nominal circumstances that the mean deviation of the
dit and dah are of equal value but have different signs. If you
add all 32 mean deviations together the dits and dahs will cancel
each other out and the sum will be near or at zero for "normal"
copy.
If the speed of the incoming code should
change rapidly however, like when you change frequency from a 13
wpm QSO to a 50 wpm QSO, the mean deviation really "kicks-in".
When the value of the mean deviation exceeds 25% of the average
value, the average is "opened-up" so that any mark will be in-
cluded in the calculation of the new average. The program tem-
porarily suspends the pre-screening of entries into the average
in an effort to purge the average of the out-of-date values it
contains. After the mean deviation recedes back below 25% of the
average value the program will again start the pre-screening
process using the new average as the basis for qualification.
Becausσ oµ thesσ algorithms¼ ROB╧-COPY is
responsive to changing copy conditions, yet stable without being
computationally cumbersome.