Difference between revisions of "Doppler Tuning Algorithm for Gpredict"

From MyLabWiki
Jump to: navigation, search
 
(33 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
[[Category:Gpredict]]
 
[[Category:Gpredict]]
[[Category:Ideas]]
+
[[Category:Completed]]
  
 
== Objectives ==
 
== Objectives ==
Line 11: Line 11:
 
# Gpredict shall be able to perform Doppler tuning for both uplink and downlink.
 
# Gpredict shall be able to perform Doppler tuning for both uplink and downlink.
 
# Gpredict shall be able to take external frequency changes into account, e.g. when the user turns the dial.
 
# Gpredict shall be able to take external frequency changes into account, e.g. when the user turns the dial.
# Gpredict shall be able to perform Doppler tuning using a receiver, a simplex transceiver, or a duplex transceiver.
+
# Gpredict shall be able to perform Doppler tuning using a receiver, a transmitter, a simplex transceiver, a duplex transceiver — or any combination of these (i.e. separate device for uplink and downlink).
 
# Gpredict shall take into account that there might be transverters in the loop.
 
# Gpredict shall take into account that there might be transverters in the loop.
 +
 +
== Configurations ==
 +
 +
In order to configure a radio device for use, the user has to specify:
 +
# The host name where rigctld is running
 +
# The port number of the rigctld server
 +
# The radio type, i.e. whether it is RIG_TYPE_RX, RIG_TYPE_TX, RIG_TYPE_TRX or RIG_TYPE_DUPLEX
 +
# The conversion frequencies for the transverters, if any.
  
 
== Operating Modes ==
 
== Operating Modes ==
Line 20: Line 28:
 
; Receiver Mode
 
; Receiver Mode
 
: The radio is only a receiver or a transceiver where tuning via CAT is only possible in receive mode. In this case, Gpredict shall perform Doppler tuning on the downlink only.
 
: The radio is only a receiver or a transceiver where tuning via CAT is only possible in receive mode. In this case, Gpredict shall perform Doppler tuning on the downlink only.
 +
 +
; Transmitter Mode
 +
: The radio is only used as transmitter only. Tuning via CAT must be possible in transmit mode. Gpredict shall perform Doppler tuning on the uplink only.
  
 
; Simplex Mode
 
; Simplex Mode
Line 26: Line 37:
 
; Duplex Mode
 
; Duplex Mode
 
: The radio is a full duplex transceiver like the IC-910H or FT-847. Gpredict will perform continuous Doppler tuning  using VFO_MAIN for uplink and VFO_SUB on the downlink regardless of the PTT setting.
 
: The radio is a full duplex transceiver like the IC-910H or FT-847. Gpredict will perform continuous Doppler tuning  using VFO_MAIN for uplink and VFO_SUB on the downlink regardless of the PTT setting.
 +
 +
; Dual RIG Mode
 +
: This mode has been introduced to allow using two different radios at the same time: One for downlink (primary device) and one for uplink (secondary device). This is kind of full duplex mode
  
 
== The Controller Algorithm ==
 
== The Controller Algorithm ==
Line 63: Line 77:
 
=== Receiver Mode ===
 
=== Receiver Mode ===
  
In this mode the radio is used for reception only even if it is a transceiver. The reason could be that frequency setting via CAT is not possible in transmit mode as would be the case for the FT-817. If configured with UsePTT = true, gpredict will also poll the PTT setting and ensure that downlink correction are only set to the radio when RadioPTT = false.
+
In this mode the radio is used for reception only even if it is a transceiver. The reason could be that frequency setting via CAT is not possible in transmit mode as would be the case for the FT-817.  
  
 
'''Pseudo code'''
 
'''Pseudo code'''
Line 69: Line 83:
  
 
/* Receiver chain */
 
/* Receiver chain */
if ((UsePTT = true) AND (RadioPTT = true))
 
    return;
 
endif;
 
 
 
read RadioRX;
 
read RadioRX;
  
Line 84: Line 94:
 
     PrevRX = RadioRX;
 
     PrevRX = RadioRX;
 
     write RadioRX;
 
     write RadioRX;
 +
endif;
 +
 +
</pre>
 +
 +
=== Transmitter Mode ===
 +
 +
In this mode the radio is used for uplink only even if it is a transceiver. A prerequisite for this mode is the the frequency can be adjusted via CAT in transmit mode.
 +
 +
'''Pseudo code'''
 +
<pre>
 +
 +
/* Transmitter chain */
 +
read RadioTX;
 +
 +
if (RadioTX != PrevTX)
 +
    update SatTX;
 +
    calculate SatRX if locked to SatTX;
 +
    PrevTX = RadioTX;
 +
else
 +
    /* update Doppler correction */
 +
    RadioTX += SatTX * Doppler / 100 MHz;
 +
    PrevTX = RadioTX;
 +
    write RadioTX;
 
endif;
 
endif;
  
Line 136: Line 169:
 
</pre>
 
</pre>
  
=== Duplex Mode ===
+
Note that it is left to the user to set the split mode up on the radio.
 +
 
 +
=== Full-Duplex Mode ===
 +
 
 +
In this mode, gpredict updates both uplink and downlink frequencies continuously and at the same time regardless of the RadioPTT setting. To implement this algorithm, the current full-duplex radios were investigated.
 +
 
 +
;IC-910H
 +
: Rig must be in duplex mode but not SAT mode to avoid auto-tracking by the radio. VFO_SUB is used for reception VFO_MAIN is used for transmission. In hamlib this can be done calling set_vfo before set_freq / get_freq &ndash; it will not toggle the vfo on the radio but simply change the target VFO in the rig.
 +
 
 +
;FT-847
 +
: Rig must be in SAT mode but TRACKING disabled! VFO_MAIN is RX and VFO_SUB is TX.
 +
 
 +
;TS-2000
 +
: It was slightlys difficult to make sense out of the ops manual, but it seems that VFO_A is RX and VFO_B is TX. TRACE must be turned OFF.
  
In this mode, gpredict updates both uplink and downlink frequencies continuously and at the same time regardless of the RadioPTT setting &mdash; RadioPTT is still used though to decide which VFO to track.
 
  
 
'''Pseudo code'''
 
'''Pseudo code'''
  
 
<pre>
 
<pre>
To be written
+
set_vfo (vfoDown)
 +
ecec_rx_cycle ()
 +
set_vfo (vfoUp)
 +
exec_tx_cycle ()
 
</pre>
 
</pre>
  
 +
=== Dual RIG Mode ===
  
'''Configurations'''
+
This is a full duplex mode using two radios. The controller algorithm is very simple:
 +
<pre>
 +
Execute RX mode controller using primary device
 +
Execute TX mode controller using the secondary device
 +
</pre>
 +
However, in reality there needs to be an interaction between the uplink and downlink controller, in particular if a particular frequency in the transponder passband is tracked. For example, if the user changes the dial on the receiver, the uplink shall follow along. So the complete logic for dual RIG mode is:
  
 +
# If RX dial has changed
 +
## Update downlink transponder frequency
 +
## Update uplink transponder frequency
 +
## Update transmitter frequency
 +
# Else
 +
## Perform forward tracking on downlink
 +
## If uplink dial has changed
 +
### Update uplink transponder frequency
 +
### Update downlink transponder frequency
 +
### Update receiver frequency
 +
## Else
 +
###Perform forward tracking ono uplink
 +
## Endif
 +
# Endif
  
 +
Okay, the logic is slightly complicated, but if it works it will surely kick some ass!
  
 
== Implementation ==
 
== Implementation ==
  
 
== Tests ==
 
== Tests ==
 +
 +
=== Overview ===
 +
Tests on the RX, TX, and Simplex modes were carried out using an FT-817 (RX only), as well as an IC-765 (RX, TX, Simplex). The FT-817 supports get_ptt via CAT, while the IC-765 does not. However, the IC-765 was connected using a [http://www.microham.com microham USB II] interface, which support PTT via the RTS line. The hamlib setup for this was:
 +
<pre>
 +
rigctl -m 329 -r /dev/ttyUSB0 --set-conf=dtr_state=OFF,rts_state=OFF --ptt-file=/dev/ttyUSB0 --ptt-type=RTS
 +
</pre>
 +
Unfortunately, this allows PTT to be set and read, but it does not read correctly when PTT is set using the radio front panel. So this option was abandoned.
 +
 +
Later I have found out, that I can use the <code>get_dcd</code> command to read a kind-of PTT status. Kind-of only, because the microham USB II interface actually returns the status of the squelch on the CTS line, and squelch is closed during transmission. To configure hamlib:
 +
<pre>
 +
rigctld -m 329 -t 4533 -r /dev/ttyUSB0 -d /dev/ttyUSB0 --dcd-type=CTS --set-conf=dtr_state=OFF,rts_state=OFF -vvvvv
 +
</pre>
 +
&ndash; that is use /dev/ttyUSB0 as DCD device and make DCD type CTS.
 +
 +
=== Radio Confiogurations ===
 +
Note that the screenshot below does not reflect the IC-765 being set up as a simplex transceiver (that happened later in the test campaign).
 +
[[Image:GpredictRigSetup.png]]
 +
 +
=== RX Only Test ===
 +
This option was tested using:
 +
# FT-817 with PTT feedback ON
 +
# IC-765 with PTT feedback OFF
 +
During the test and error was discovered that caused the controller to be very confused and go into a mode when it was continuously updating the downlink frequency. This was only observed on the FT-817; both the Dummy backend and the IC-765 worked fine. Investigations showed that this was because the smallest tuning step the FT-817 can take is 10 Hz, thus the read frequency was almost always different from the one that has been set in the previous cycle.
 +
 +
The problem was solved by adding an extra <code>get_freq_simplex()</code> right after setting the new frequency, and using the read back value as <code>ctrl->lastrxf</code>.
 +
 +
The updated version of the code is available in r238.
 +
 +
=== TX Only Test ===
 +
This mode was tested using the IC-765 configured as TX only device, no PTT feedback.
 +
 +
After a minor correction was made (ptt = TRUE by default), the controller worked just fine as it should!
 +
 +
=== Simplex Test ===
 +
Setting up hamlib to read CTS signal as DCD:
 +
<pre>
 +
rigctld -m 329 -t 4533 -r /dev/ttyUSB0 -d /dev/ttyUSB0 --dcd-type=CTS --set-conf=dtr_state=OFF,rts_state=OFF -vvvvv
 +
</pre>
 +
The Simplex TRX controller was thus tested using the IC-765 and it worked perfectly! Works using both split or same VFO.
 +
 +
=== Duplex TRX Test ===
 +
''To be done''
 +
 +
=== Dual RIG Test ===
 +
Receiver: FT-817<br>
 +
Transmitter: IC-765
 +
 +
Works fine!
  
 
== Conclusion ==
 
== Conclusion ==

Latest revision as of 20:57, 2 June 2010


Objectives

The first beta version of Gpredict 1.0 included a simple Doppler tuning algorithm that could adjust the receiver frequency and even take external frequency changes (e.g. tuning dial) into account. While it was a very good first cut at automatic Doppler tuning, the shortcomings were quickly identified. For example, it didn't take the PTT status for simplex radios into account and so Gpredict kept on sending RX correction commands to the radio even when the user was trying to transmit.

Clearly, a more sophisticated algorithm is needed and this page describes the design and prototyping of that algorithm.

Requirements

  1. Gpredict shall be able to perform Doppler tuning for both uplink and downlink.
  2. Gpredict shall be able to take external frequency changes into account, e.g. when the user turns the dial.
  3. Gpredict shall be able to perform Doppler tuning using a receiver, a transmitter, a simplex transceiver, a duplex transceiver — or any combination of these (i.e. separate device for uplink and downlink).
  4. Gpredict shall take into account that there might be transverters in the loop.

Configurations

In order to configure a radio device for use, the user has to specify:

  1. The host name where rigctld is running
  2. The port number of the rigctld server
  3. The radio type, i.e. whether it is RIG_TYPE_RX, RIG_TYPE_TX, RIG_TYPE_TRX or RIG_TYPE_DUPLEX
  4. The conversion frequencies for the transverters, if any.

Operating Modes

The operating mode for the controller depends on what kind of radio is used. For now, the following options are considered:

Receiver Mode
The radio is only a receiver or a transceiver where tuning via CAT is only possible in receive mode. In this case, Gpredict shall perform Doppler tuning on the downlink only.
Transmitter Mode
The radio is only used as transmitter only. Tuning via CAT must be possible in transmit mode. Gpredict shall perform Doppler tuning on the uplink only.
Simplex Mode
The radio can be tuned via CAT both in receive and transmit modes. Gpredict will perform Doppler tuning on the downlink and uplink depending on the PTT setting.
Duplex Mode
The radio is a full duplex transceiver like the IC-910H or FT-847. Gpredict will perform continuous Doppler tuning using VFO_MAIN for uplink and VFO_SUB on the downlink regardless of the PTT setting.
Dual RIG Mode
This mode has been introduced to allow using two different radios at the same time: One for downlink (primary device) and one for uplink (secondary device). This is kind of full duplex mode

The Controller Algorithm

The control algorithm will need the following parameters:

Doppler
The current Doppler shift at 100 MHz.
SatRX
The downlink frequency at the satellite. This is set by the user on the Gpredict control panel or automatically if the uplink and downlink frequencies are locked, or if RadioRX is changed externally (e.g. via tuning dial).
SatTX
The uplink frequency at the satellite. This is set by the user on the Gpredict control panel or automatically if the uplink and downlink frequencies are locked, or if RadioTX is changed externally (e.g. via tuning dial).
RadioRX
The downlink frequency of the radio.
RadioTX
The uplink frequency of the radio.
RadioPTT
The PTT status of the radio. When available, this is used to switch between RadioRX and RadioTX tuning on simplex radios.
UsePTT
Flag indicating whether the PTT status on the radio should be polled and taken into acount (i.e. don't set RadioRX when RadioPTT = true).
PrevRX
The RadioRX frequency set during the previous cycle. This can be different than RadioRX in that the user may have turned the tuning dial since the last cycle.
PrevTX
The RadioTX frequency set during the previous cycle. This can be different than RadioTX in that the user may have turned the tuning dial since the last cycle.

There are also other user interface parameters like Engage and Track that influence the overall functionality, but these parameters are outside the scope of the controller algorithm.


Receiver Mode

In this mode the radio is used for reception only even if it is a transceiver. The reason could be that frequency setting via CAT is not possible in transmit mode as would be the case for the FT-817.

Pseudo code


/* Receiver chain */
read RadioRX;

if (RadioRX != PrevRX)
    update SatRX;
    calculate SatTX if locked to SatRX;
    PrevRX = RadioRX;
else
    /* update Doppler correction */
    RadioRX += SatRX * Doppler / 100 MHz;
    PrevRX = RadioRX;
    write RadioRX;
endif;

Transmitter Mode

In this mode the radio is used for uplink only even if it is a transceiver. A prerequisite for this mode is the the frequency can be adjusted via CAT in transmit mode.

Pseudo code


/* Transmitter chain */
read RadioTX;

if (RadioTX != PrevTX)
    update SatTX;
    calculate SatRX if locked to SatTX;
    PrevTX = RadioTX;
else
    /* update Doppler correction */
    RadioTX += SatTX * Doppler / 100 MHz;
    PrevTX = RadioTX;
    write RadioTX;
endif;

Simplex Mode

In this situation the user uses the same radio for uplink and downlink but in simplex mode, i.e. can not receive and transmit at the same time. The prerequisites for this mode are:

  • Radio is set to split mode. Gpredict will not care about VFO A and B — it will simply send uplink or downlink correction to the active VFO.
  • RadioPTT can be read
  • Radio can receive SET_FREQ commands via CAT in both receive and transmit modes.


Pseudo code

/* Are we in RX mode? */
if (RadioPTT = false)

    read RadioRX;

    /* did user change RX frequency on dial? */
    if (RadioRX != PrevRX)
        update SatRX;
        calculate SatTX if locked to SatRX;
        PrevRX = RadioRX;
    else
        /* update Doppler correction */
        RadioRX += SatRX * Doppler / 100 MHz;
        PrevRX = RadioRX;
        write RadioRX;
    endif;

else   /* we are in TX mode */

    read RadioTX;

    /* did user change TX frequency on dial? */
    if (RadioTX != PrevTX)
        update SatTX;
        calculate SatRX if locked to SatTX;
        PrevTX = RadioTX;
    else
        /* update Doppler correction */
        RadioTX += SatTX * Doppler / 100 MHz;
        PrevTX = RadioTX;
        write RadioTX;
    endif;

endif;

Note that it is left to the user to set the split mode up on the radio.

Full-Duplex Mode

In this mode, gpredict updates both uplink and downlink frequencies continuously and at the same time regardless of the RadioPTT setting. To implement this algorithm, the current full-duplex radios were investigated.

IC-910H
Rig must be in duplex mode but not SAT mode to avoid auto-tracking by the radio. VFO_SUB is used for reception VFO_MAIN is used for transmission. In hamlib this can be done calling set_vfo before set_freq / get_freq – it will not toggle the vfo on the radio but simply change the target VFO in the rig.
FT-847
Rig must be in SAT mode but TRACKING disabled! VFO_MAIN is RX and VFO_SUB is TX.
TS-2000
It was slightlys difficult to make sense out of the ops manual, but it seems that VFO_A is RX and VFO_B is TX. TRACE must be turned OFF.


Pseudo code

set_vfo (vfoDown)
ecec_rx_cycle ()
set_vfo (vfoUp)
exec_tx_cycle ()

Dual RIG Mode

This is a full duplex mode using two radios. The controller algorithm is very simple:

Execute RX mode controller using primary device
Execute TX mode controller using the secondary device

However, in reality there needs to be an interaction between the uplink and downlink controller, in particular if a particular frequency in the transponder passband is tracked. For example, if the user changes the dial on the receiver, the uplink shall follow along. So the complete logic for dual RIG mode is:

  1. If RX dial has changed
    1. Update downlink transponder frequency
    2. Update uplink transponder frequency
    3. Update transmitter frequency
  2. Else
    1. Perform forward tracking on downlink
    2. If uplink dial has changed
      1. Update uplink transponder frequency
      2. Update downlink transponder frequency
      3. Update receiver frequency
    3. Else
      1. Perform forward tracking ono uplink
    4. Endif
  3. Endif

Okay, the logic is slightly complicated, but if it works it will surely kick some ass!

Implementation

Tests

Overview

Tests on the RX, TX, and Simplex modes were carried out using an FT-817 (RX only), as well as an IC-765 (RX, TX, Simplex). The FT-817 supports get_ptt via CAT, while the IC-765 does not. However, the IC-765 was connected using a microham USB II interface, which support PTT via the RTS line. The hamlib setup for this was:

rigctl -m 329 -r /dev/ttyUSB0 --set-conf=dtr_state=OFF,rts_state=OFF --ptt-file=/dev/ttyUSB0 --ptt-type=RTS

Unfortunately, this allows PTT to be set and read, but it does not read correctly when PTT is set using the radio front panel. So this option was abandoned.

Later I have found out, that I can use the get_dcd command to read a kind-of PTT status. Kind-of only, because the microham USB II interface actually returns the status of the squelch on the CTS line, and squelch is closed during transmission. To configure hamlib:

rigctld -m 329 -t 4533 -r /dev/ttyUSB0 -d /dev/ttyUSB0 --dcd-type=CTS --set-conf=dtr_state=OFF,rts_state=OFF -vvvvv

– that is use /dev/ttyUSB0 as DCD device and make DCD type CTS.

Radio Confiogurations

Note that the screenshot below does not reflect the IC-765 being set up as a simplex transceiver (that happened later in the test campaign). GpredictRigSetup.png

RX Only Test

This option was tested using:

  1. FT-817 with PTT feedback ON
  2. IC-765 with PTT feedback OFF

During the test and error was discovered that caused the controller to be very confused and go into a mode when it was continuously updating the downlink frequency. This was only observed on the FT-817; both the Dummy backend and the IC-765 worked fine. Investigations showed that this was because the smallest tuning step the FT-817 can take is 10 Hz, thus the read frequency was almost always different from the one that has been set in the previous cycle.

The problem was solved by adding an extra get_freq_simplex() right after setting the new frequency, and using the read back value as ctrl->lastrxf.

The updated version of the code is available in r238.

TX Only Test

This mode was tested using the IC-765 configured as TX only device, no PTT feedback.

After a minor correction was made (ptt = TRUE by default), the controller worked just fine as it should!

Simplex Test

Setting up hamlib to read CTS signal as DCD:

rigctld -m 329 -t 4533 -r /dev/ttyUSB0 -d /dev/ttyUSB0 --dcd-type=CTS --set-conf=dtr_state=OFF,rts_state=OFF -vvvvv

The Simplex TRX controller was thus tested using the IC-765 and it worked perfectly! Works using both split or same VFO.

Duplex TRX Test

To be done

Dual RIG Test

Receiver: FT-817
Transmitter: IC-765

Works fine!

Conclusion