edu.nrao.sss.electronics
Class LocalOscillator

java.lang.Object
  extended by edu.nrao.sss.electronics.LocalOscillator
All Implemented Interfaces:
SignalSource, Cloneable

public class LocalOscillator
extends Object
implements Cloneable, SignalSource

A frequency generator.

The frequency generated by this device is usually mixed with a signal in order to move that signal to an intermediate frequency.

Version Info:

$Revision: 1707 $
$Date: 2008-11-14 10:23:59 -0700 (Fri, 14 Nov 2008) $
$Author: dharland $ (last person to modify)

Since:
2007-10-24
Author:
David M. Harland

Constructor Summary
LocalOscillator(FrequencyRange tunableRange)
          Creates a continuously tunable oscillator whose frequencies are limited to the given range.
LocalOscillator(FrequencyRange tunableRange, Frequency tuningStepSize)
          Creates an oscillator whose tunings are limited to the given range and whose "dial" moves in increments of tuningStepSize.
 
Method Summary
 LocalOscillator clone()
          Creates and returns a copy of this oscillator.
 boolean equals(Object o)
          Returns true if o is equal to this local oscillator.
 Frequency getClosestTunableFrequency(Frequency potentialTuning)
          Returns the legal tuning that is closed to potentialTuning.
 Frequency getCurrentTuning()
          Returns the frequency to which this oscillator is currently tuned.
 String getName()
          Returns the name of this oscillator.
 Signal getSignal()
          Returns a signal holding the frequency to which this oscillator is currently tuned.
 Frequency getStepSize()
          Returns the distance between adjacent tunings of this oscillator.
 FrequencyRange getTunableRange()
          Returns the frequency range over which this oscillator may be tuned.
 int hashCode()
          Returns a hash code value for this signal.
 boolean isContinuouslyTunable()
          Returns true if this oscillator is continuously tunable.
 boolean isTunableTo(Frequency potentialTuning)
          Returns true if this oscillator can be tuned to the given frequency.
 void setName(String newName)
          Sets a new name for this oscillator.
 Frequency tuneTo(Frequency desiredFrequency)
          Attempts to change the output frequency of this oscillator to desiredFrequency.
 Frequency tuneToCenter()
          Tunes this local oscillator as closely as possible to the center of its range.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocalOscillator

public LocalOscillator(FrequencyRange tunableRange)
Creates a continuously tunable oscillator whose frequencies are limited to the given range.

This oscillator will be initially tuned to its lowest frequency.

Parameters:
tunableRange - the minimum and maximum frequencies to which this oscillator may be tuned. If this value is null a NullPointerException will be thrown.

LocalOscillator

public LocalOscillator(FrequencyRange tunableRange,
                       Frequency tuningStepSize)
Creates an oscillator whose tunings are limited to the given range and whose "dial" moves in increments of tuningStepSize.

The minimum frequency to which this oscillator may be tuned is tunableRange.getLowFrequency(). The next lowest frequency is tunableRange.getLowFrequency() + tuningStepSize. The highest frequency is given by the largest value N such that tunableRange.getLowFrequency() + tuningStepSize * N <= tunableRange.getHighFrequency(). That is, the greatest frequency to which this oscillator may be tuned might be lower than the high frequency of tunableRange.

This oscillator will be initially tuned to its lowest frequency.

Parameters:
tunableRange - the minimum and maximum frequencies to which this oscillator may be tuned. If this value is null a NullPointerException will be thrown.
tuningStepSize - the distance, in frequency units, between two adjacent tunings of this oscillator. If this value is null a NullPointerException will be thrown.
Method Detail

isContinuouslyTunable

public boolean isContinuouslyTunable()
Returns true if this oscillator is continuously tunable.

Returns:
true if this oscillator is continuously tunable.

getStepSize

public Frequency getStepSize()
Returns the distance between adjacent tunings of this oscillator. If this oscillator is continuously tunable, the returned step size will be zero.

The returned frequency is a copy of the one held internally by this object, so changes made to it after this call will not be reflected herein.

The returned frequency will never be null.

Returns:
the distance between adjacent tunings of this oscillator.

getTunableRange

public FrequencyRange getTunableRange()
Returns the frequency range over which this oscillator may be tuned.

The returned range is a copy of the one held internally by this object, so changes made to it after this call will not be reflected herein.

The returned range will never be null.

Returns:
the frequency range over which this oscillator may be tuned.

getCurrentTuning

public Frequency getCurrentTuning()
Returns the frequency to which this oscillator is currently tuned.

Returns:
the frequency to which this oscillator is currently tuned.

tuneTo

public Frequency tuneTo(Frequency desiredFrequency)
Attempts to change the output frequency of this oscillator to desiredFrequency.

An attempt to tune to a frequency below this oscillator's minimum will result in a tuning equal to the lowest allowable frequency, and likewise for exceeding this oscillator's maximum.

If this oscillator is not continuously tunable, then this method will tune to the allowable frequency that is closest to desiredFrequency. If the desiredFrequency is not a tunable frequency and is equally distant from two allowable tuning frequencies, this oscillator will be tuned to the lower of those frequencies.

Returns:
the frequency to which this oscillator was tuned as a result of this call.

tuneToCenter

public Frequency tuneToCenter()
Tunes this local oscillator as closely as possible to the center of its range.

It may not be possible to tune a discretely tunable LO to the center of its range. In that situation the closest legal tuning will be chosen. If there are two such tunings, the one chosen will be determined as outlined in tuneTo(Frequency).

Returns:
the frequency to which this local oscillator is now tuned.

isTunableTo

public boolean isTunableTo(Frequency potentialTuning)
Returns true if this oscillator can be tuned to the given frequency.

Parameters:
potentialTuning - the frequency to be tested.
Returns:
true if this oscillator can be tuned to potentialTuning.
Since:
2008-10-30

getClosestTunableFrequency

public Frequency getClosestTunableFrequency(Frequency potentialTuning)
Returns the legal tuning that is closed to potentialTuning. If two frequencies are equally close, the lower is returned.

Parameters:
potentialTuning - a frequency to which this oscillator might be tuned.
Returns:
the legal tuning that is closed to potentialTuning.
Since:
2008-10-30

setName

public void setName(String newName)
Sets a new name for this oscillator. Clients are not required to name their oscillator.

If newName is null or the empty string (""), the request to change the name will be denied and the current name will remain in place.

Parameters:
newName - the new name of this oscillator.

getName

public String getName()
Returns the name of this oscillator. The returned value will be either a client-specified name or a default name. It will never be null.

Returns:
the name of this oscillator.

getSignal

public Signal getSignal()
Returns a signal holding the frequency to which this oscillator is currently tuned.

Specified by:
getSignal in interface SignalSource
Returns:
the signal provided by this device.

clone

public LocalOscillator clone()
Creates and returns a copy of this oscillator.

If anything goes wrong during the cloning procedure, a RuntimeException will be thrown.

Overrides:
clone in class Object

equals

public boolean equals(Object o)
Returns true if o is equal to this local oscillator.

Overrides:
equals in class Object

hashCode

public int hashCode()
Returns a hash code value for this signal.

Overrides:
hashCode in class Object


Copyright © 2009. All Rights Reserved.