|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectPamguardMVC.PamProcess
Acquisition.AcquisitionProcess
public class AcquisitionProcess
Data acquisition process for all types of input device. This arranges the output data block and starts and stops the device in the detected DaqSystem. Each DaqSystem should operate a different thread to read the device / file and add its data to the volatile Vector newDataUnits. AcquisitonProcess will poll newDataUnits on a timer and when new data is found, put that data into PamDataUnits and PamRawDataBlocks to be sent out for processing.
DaqSystem,
PamRawDataBlock,
PamDataUnit| Nested Class Summary | |
|---|---|
(package private) class |
AcquisitionProcess.BufferTimerTest
|
(package private) class |
AcquisitionProcess.ReallyStart
|
(package private) class |
AcquisitionProcess.RestartTimerFunction
|
(package private) class |
AcquisitionProcess.WaitForData
|
| Field Summary | |
|---|---|
(package private) AcquisitionControl |
acquisitionControl
|
(package private) AcquisitionProcess |
acquisitionProcess
|
private boolean |
bufferOverflow
|
(package private) javax.swing.Timer |
bufferTimer
|
(package private) java.lang.Thread |
collectDataThread
|
(package private) int |
counts
|
private PamDataBlock<DaqStatusDataUnit> |
daqStatusDataBlock
|
private int |
dataBlockLength
|
(package private) double |
fixedAmplitudeConstantTerm
A Constant used for fast amplitude calculations when things like preamp gain will remain constant. |
private boolean |
keepRunning
|
private double |
lastError
|
(package private) long |
levelSamples
|
(package private) double |
maxLevel
|
private java.util.List<RawDataUnit> |
newDataUnits
|
(package private) double[] |
rawData
|
private PamRawDataBlock |
rawDataBlock
|
private javax.swing.Timer |
restartTimer
|
private java.lang.Object |
runingSynchObject
|
private DaqSystem |
runningSystem
|
private double |
sqrt2
|
private boolean |
systemPrepared
|
(package private) long[] |
totalSamples
|
(package private) int |
trials
|
| Fields inherited from class PamguardMVC.PamProcess |
|---|
outputDataBlocks, processName, sampleRate |
| Constructor Summary | |
|---|---|
protected |
AcquisitionProcess(AcquisitionControl acquisitionControl)
|
protected |
AcquisitionProcess(AcquisitionControl acquisitionControl,
boolean isSimulator)
|
| Method Summary | |
|---|---|
private boolean |
acquireData()
|
void |
acquisitionStopped()
|
private double |
checkClockSpeed(long totalSamples,
int print)
Check and optionally display clock speed error |
private void |
clearData()
|
double |
dbMicropascalToSignal(int channel,
double dBMuPascal)
|
double[] |
fftAmplitude2dB(double[] fftAmplitude,
int channel,
int fftLength,
boolean isSquared)
Convert the amplitude of fft data into a spectrum level measurement in dB re 1 micropacal / sqrt(Hz) for an array of double values. |
double |
fftAmplitude2dB(double fftAmplitude,
int channel,
int fftLength,
boolean isSquared,
boolean fast)
Convert the amplitude of fft data into a spectrum level measurement in dB re 1 micropacal / sqrt(Hz). |
double |
fftBandAmplitude2dB(double fftAmplitude,
int channel,
int fftLength,
boolean isSquared,
boolean fast)
Convert the amplitude of fft data into a level measurement in dB re 1 micropacal / sqrt(Hz). |
AcquisitionControl |
getAcquisitionControl()
|
private double |
getAmplitudeConstantTerm(int channel)
Gets the fixedAmplitudeConstantTerm based on channel and hydrophone numbers. |
double |
getBufferSeconds()
|
double |
getMaxBufferSeconds()
|
java.util.List<RawDataUnit> |
getNewDataUnits()
|
int |
getOfflineData(PamDataBlock dataBlock,
PamObserver endUser,
long startMillis,
long endMillis)
Request offline data. |
double |
getPeak2PeakVoltage(int swChannel)
Some devices may be setting this per channel. |
PamRawDataBlock |
getRawDataBlock()
|
DaqSystem |
getRunningSystem()
|
boolean |
needRestart()
|
void |
newData(PamObservable o,
PamDataUnit arg)
|
void |
pamStart()
Interval between daq checks in milliseconds |
void |
pamStop()
Stops the process. |
void |
pamStop(java.lang.String reason)
|
void |
prepareFastAmplitudeCalculation(int channel)
Prepares for fast amplitude calculations |
void |
prepareProcess()
Called for each process before any of them receive the PamStart command |
double[] |
rawAmplitude2dB(double[] rawAmplitude,
int channel)
Convert a raw amplitude to dB re 1 micropascal based on calibration information held in the AcquisitionController for an array of double data |
double |
rawAmplitude2dB(double rawAmplitude,
int channel,
boolean fast)
Convert a raw amplitude to dB re 1 micropascal based on calibration information held in the AcquisitionController |
void |
setNumChannels(int numChannels)
|
void |
setNumChannels(int numChannels,
int[] channelList)
Set up channels when using a channel list - note that hardware channels are no longer passed through the system so software channels are now used throughout. |
void |
setSampleRate(float sampleRate,
boolean notify)
New sample rate |
void |
setupDataBlock()
called when acquisition parameters change. |
private boolean |
shouldPrintSoundCardError(double error)
|
void |
streamClosed()
|
void |
streamEnded()
|
void |
streamOpen()
|
void |
streamPaused()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
AcquisitionControl acquisitionControl
private volatile DaqSystem runningSystem
private PamRawDataBlock rawDataBlock
private PamDataBlock<DaqStatusDataUnit> daqStatusDataBlock
private volatile java.util.List<RawDataUnit> newDataUnits
AcquisitionProcess acquisitionProcess
private int dataBlockLength
long[] totalSamples
private volatile boolean keepRunning
private volatile boolean bufferOverflow
private javax.swing.Timer restartTimer
private final double sqrt2
private java.lang.Object runingSynchObject
private boolean systemPrepared
java.lang.Thread collectDataThread
javax.swing.Timer bufferTimer
int trials
int counts
double maxLevel
long levelSamples
double[] rawData
private double lastError
double fixedAmplitudeConstantTerm
| Constructor Detail |
|---|
protected AcquisitionProcess(AcquisitionControl acquisitionControl)
protected AcquisitionProcess(AcquisitionControl acquisitionControl,
boolean isSimulator)
| Method Detail |
|---|
public void setupDataBlock()
public void pamStart()
pamStart in class PamProcesspublic void pamStop()
PamProcess
pamStop in class PamProcesspublic void pamStop(java.lang.String reason)
public void acquisitionStopped()
public void prepareProcess()
PamProcess
prepareProcess in class PamProcess
public void setSampleRate(float sampleRate,
boolean notify)
PamObserver
setSampleRate in interface PamObserversetSampleRate in class PamProcessnotify - Notify other PamObservers and PamObservables in the chain.public void setNumChannels(int numChannels)
public void setNumChannels(int numChannels,
int[] channelList)
numChannels - channelList - public void streamClosed()
public void streamEnded()
public void streamOpen()
public void streamPaused()
private boolean acquireData()
private void clearData()
private double checkClockSpeed(long totalSamples,
int print)
totalSamples - total samples acquiredprint - 0 = never, 1 = if the error is > .2%, 2 always
private boolean shouldPrintSoundCardError(double error)
public double getBufferSeconds()
public double getMaxBufferSeconds()
public boolean needRestart()
public void newData(PamObservable o,
PamDataUnit arg)
newData in class PamProcesspublic java.util.List<RawDataUnit> getNewDataUnits()
public DaqSystem getRunningSystem()
public double rawAmplitude2dB(double rawAmplitude,
int channel,
boolean fast)
rawAmplitude - raw amplitude (should be -1 < rawAmplitude < 1)
public double getPeak2PeakVoltage(int swChannel)
swChannel - software channel number
private double getAmplitudeConstantTerm(int channel)
channel - = single software channel
public void prepareFastAmplitudeCalculation(int channel)
channel -
public double[] rawAmplitude2dB(double[] rawAmplitude,
int channel)
rawAmplitude - raw amplitude (should be -1 < rawAmplitude < 1)
public double fftAmplitude2dB(double fftAmplitude,
int channel,
int fftLength,
boolean isSquared,
boolean fast)
fftAmplitude - magnitude of the fft data (not the magnitude squared !)fftLength - lengthof the fft (needed for Parsevals correction)
public double fftBandAmplitude2dB(double fftAmplitude,
int channel,
int fftLength,
boolean isSquared,
boolean fast)
Note that this function differs from fftAmplitude2dB in that this one used the FFT length to correct for Parsevals theorum and integratin over the length of the FFT, but it does NOT convert the result to a spectrum level measurement.
fftAmplitude - magnitude of the fft data (not the magnitude squared !)fftLength - lengthof the fft (needed for Parsevals correction)
public double[] fftAmplitude2dB(double[] fftAmplitude,
int channel,
int fftLength,
boolean isSquared)
fftAmplitude - magnitude of the fft data (not the magnitude squared !)fftLength - lengthof the fft (needed for Parsevals correction)
public double dbMicropascalToSignal(int channel,
double dBMuPascal)
public AcquisitionControl getAcquisitionControl()
public PamRawDataBlock getRawDataBlock()
public int getOfflineData(PamDataBlock dataBlock,
PamObserver endUser,
long startMillis,
long endMillis)
PamProcessThis will be called from a PamDatablock in offline viewer mode from requestOfflineData(PamObserver observer, long startMillis, long endMillis).
this is used to request data from upstream processes, e.g. o get raw data to turn into FFT data units to go to the spectrogram display (possible going via decimators and any other processes before spitting out the right data.
getOfflineData in class PamProcessdataBlock - data block making the request.endUser - observer which made the original data request.startMillis - start time in millisecondsendMillis - end time in milliseconds.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||