edu.nrao.sss.electronics
Class SignalMixer

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

public class SignalMixer
extends Object
implements SignalProcessor, SignalSource

A device that mixes a signal with another frequency. The output of this mixing is a third signal that represents the first, but that has been transformed to an intermediate frequency.

In contrast to a true signal mixer, this object produces a single signal that contains either the sum or difference of the input signals and the mixing signal. A true mixer produces both the sum and difference simultaneously.

Version Info:

$Revision: 1204 $
$Date: 2008-04-07 16:53:41 -0600 (Mon, 07 Apr 2008) $
$Author: dharland $ (last person to modify)

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

Method Summary
 void eraseSignalMemory()
          Erases this device's memory of its most recent execution.
 void execute()
          Runs this device on the signal received from its input pipe and then executes the processor connected to its output pipe, if any.
 void executeFromStartOfChainUpTo(SignalProcessor firstUnexecutedDevice)
          Retreats upstream from this processor to the source of the stream and executes that device(s), telling it to stop execution at firstUnexecutedDevice.
 void executeUpTo(SignalProcessor firstUnexecutedDevice)
          Executes this device and all downstream devices up to, but not including, the firstUnexecutedDevice.
 SignalPipe getInputPipe()
          Returns the input pipe of this device.
 SignalPipe getLocalOscillatorInputPipe()
          Returns the pipe that carries a local oscillator's signal into this mixer.
 Signal getMostRecentInput()
          Returns a copy of the input signal most recently processed by this device.
 Signal getMostRecentOutput()
          Returns a copy of the output signal most recently produced by this device.
 String getName()
          Returns the name of this mixer.
 SignalPipe getOutputPipe()
          Returns the output pipe of this device.
 Signal getSignal()
          Returns a copy of the signal produced by the most recent execution of this device.
static SignalMixer makeAdditiveMixer(String deviceName)
          Creates and returns a new mixer that produces an output signal by adding an input signal to a local oscillator signal.
static SignalMixer makeSubtractiveMixer(String deviceName)
          Creates and returns a new mixer that produces an output signal by subtracting an input signal from a local oscillator signal.
 Signal mix(Signal input)
          Creates and returns a new signal that is the result of applying this mixer to the given input signal.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

makeAdditiveMixer

public static SignalMixer makeAdditiveMixer(String deviceName)
Creates and returns a new mixer that produces an output signal by adding an input signal to a local oscillator signal.

Parameters:
deviceName - an optional name for this mixer. If this value is null a default name will be used in its place.
Returns:
a new mixer that uses addition to produce its output.

makeSubtractiveMixer

public static SignalMixer makeSubtractiveMixer(String deviceName)
Creates and returns a new mixer that produces an output signal by subtracting an input signal from a local oscillator signal.

Parameters:
deviceName - an optional name for this mixer. If this value is null a default name will be used in its place.
Returns:
a new mixer that uses subtraction to produce its output.

getLocalOscillatorInputPipe

public SignalPipe getLocalOscillatorInputPipe()
Returns the pipe that carries a local oscillator's signal into this mixer. A typical usage pattern for this method is:
 myMixer.getLocalOscillatorInputPipe().connectInputTo(myOscillator);

Note that any SignalSource, not just a LocalOscillator, can be connected to input of the returned pipe.

Returns:
the pipe that carries a local oscillator's signal into this mixer.

getInputPipe

public SignalPipe getInputPipe()
Returns the input pipe of this device. A typical usage pattern for this method is:
 myMixer.getInputPipe().connectInputTo(mySource);

Returns:
the input pipe of this device.

getOutputPipe

public SignalPipe getOutputPipe()
Returns the output pipe of this device. A typical usage pattern for this method is:
 myMixer.getOutputPipe().connectOutputTo(myProcessor);

Returns:
the output pipe of this device.

getMostRecentInput

public Signal getMostRecentInput()
Returns a copy of the input signal most recently processed by this device. If this processor has never been executed, or if the input signal it processed most recently was null, the returned value will be null.

Returns:
the input signal most recently sent into this mixer.

getMostRecentOutput

public Signal getMostRecentOutput()
Returns a copy of the output signal most recently produced by this device. If this processor has never been executed, or if the input signal it processed most recently was null, the returned value will be null.

Returns:
the output signal most recently produced by this mixer.

getName

public String getName()
Returns the name of this mixer. The returned name is either a client-specified name or a default name, but will never be null.

Returns:
the name of this mixer.

eraseSignalMemory

public void eraseSignalMemory()
Erases this device's memory of its most recent execution.

See Also:
getMostRecentInput(), getMostRecentOutput(), getSignal()

getSignal

public Signal getSignal()
Returns a copy of the signal produced by the most recent execution of this device. If this device has never been run, or if the input signal it processed most recently was null, the returned value will be null.

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

execute

public void execute()
Runs this device on the signal received from its input pipe and then executes the processor connected to its output pipe, if any. Both the input signal and the output produced by mixing it are remembered by this mixer and are available via the getMostRecentInput() and getMostRecentOutput() methods.

Specified by:
execute in interface SignalProcessor

executeUpTo

public void executeUpTo(SignalProcessor firstUnexecutedDevice)
Description copied from interface: SignalProcessor
Executes this device and all downstream devices up to, but not including, the firstUnexecutedDevice. See SignalProcessor.execute() for more information about the linking of processors.

Specified by:
executeUpTo in interface SignalProcessor
Parameters:
firstUnexecutedDevice - the first device downstream that is not to be executed. If all downstream devices should be executed you may use a null value here or call SignalProcessor.execute().

executeFromStartOfChainUpTo

public void executeFromStartOfChainUpTo(SignalProcessor firstUnexecutedDevice)
Description copied from interface: SignalProcessor
Retreats upstream from this processor to the source of the stream and executes that device(s), telling it to stop execution at firstUnexecutedDevice.

Specified by:
executeFromStartOfChainUpTo in interface SignalProcessor
Parameters:
firstUnexecutedDevice - the first device in a chain of processors that is not to be executed. If all devices should be executed you may use a null value here. The first unexecuted device should be downstream of this device.

mix

public Signal mix(Signal input)
Creates and returns a new signal that is the result of applying this mixer to the given input signal.

Note that the input signal and this mixer are not affected by calls to this method. In other words this mixer will not remember the input signal sent in or the output signal produced. This is in contrast to a call to the execute() methods. Note also that in order to ensure an up to date local oscillator signal, this method executes the devices chained to this mixer's LO pipe from the beginning of that chain.

Parameters:
input - the signal to be mixed.
Returns:
a new signal that is the result of applying this mixer to input.


Copyright © 2009. All Rights Reserved.