Package Array

Class PamArray

java.lang.Object
Array.PamArray
All Implemented Interfaces:
Serializable, Cloneable, ManagedParameters

public class PamArray extends Object implements Serializable, Cloneable, ManagedParameters
Author:
Doug Gillespie

Contains information on the hydrophone array. Individual hydrophones are not given channel numbers - channel numbers are the position of the hydrophone in the arraylist.

This class should eventually be extended so that Hydrophones positions can be updated dynamically and functions added to give distances / angles between them, interpolate the hydrophones position based on the ships track, etc.

See Also:
  • Field Details

  • Constructor Details

    • PamArray

      public PamArray(String arrayName, Class hydrophoneLocatorClass)
  • Method Details

    • getInstrumentType

      public String getInstrumentType()
    • setInstrumentType

      public void setInstrumentType(String instrumentType)
    • getInstrumentId

      public String getInstrumentId()
    • setInstrumentId

      public void setInstrumentId(String instrumentId)
    • notifyModelChanged

      public void notifyModelChanged(int changeType, boolean initComplete)
    • getSnapshotGeometry

      public SnapshotGeometry getSnapshotGeometry(long timeMillis)
      Get a snapshot geometry for the entire array for a given time. will reuse the last value if at all possible.
      Parameters:
      timeMillis - time in millis.
      Returns:
      Snapshot geometry
    • addHydrophone

      public int addHydrophone(Hydrophone hydrophone)
    • removeHydrophone

      public boolean removeHydrophone(Hydrophone hydrophone)
    • updateHydrophone

      public int updateHydrophone(int oldIndex, Hydrophone hydrophone)
    • getHiddenHydrophone

      public Hydrophone getHiddenHydrophone(int channel)
      public version of getHydrophone(). you probably shouldn't be calling this unless it's from within an array locator looking for nominal position data.
      Parameters:
      channel -
      Returns:
    • clearArray

      public void clearArray()
    • getHydrophoneArray

      public ArrayList<Hydrophone> getHydrophoneArray()
    • getHydrophoneCount

      public int getHydrophoneCount()
      Gets the size of the hydrophone array which is implicitly the hydrophone count.
      Returns:
      The values reflecting the size of the hydrophone array with 0 being zero or a null object reference.
    • getStreamerHydrophoneCount

      public int getStreamerHydrophoneCount(int iStreamer)
      Parameters:
      iStreamer - streamer Id
      Returns:
      number of hydrophone elements associated with that streamer.
    • checkHydrophoneIds

      public void checkHydrophoneIds()
      Ensures that hydrophone numbering in in sequential order
    • getSeparation

      public double getSeparation(int a1, int a2, long timeMillis)
      Parameters:
      a1 - phone 1
      a2 - phone 2
      Returns:
      separation between two hydrophones in metres
    • getAbsHydrophoneVector

      public PamVector getAbsHydrophoneVector(int iPhone, long timeMillis)
      Get the true location vector for a hydrophone element which is the phone vector + the array vector.
      Parameters:
      iPhone - hydrophone number
      Returns:
      absolute location.
    • getHydrophoneVector

      public PamVector getHydrophoneVector(int iPhone, long timeMillis)
      Get the hydrophone coordinates for a given time. These are just the hydrophone coordinates, and do NOT include the array coordinates.
      Parameters:
      iPhone -
      timeMillis -
      Returns:
    • updateStreamer

      public void updateStreamer(int iStreamer, Streamer newStreamer)
    • newStreamerFromUpdate

      public void newStreamerFromUpdate(long timeMilliseconds, int iStreamer, String name, double[] coord, double[] coordError, OriginSettings originSettings, LocatorSettings locatorSettings)
      Update a streamer with information from elsewhere in PAMGuard - currently called from the network receiver when new buoy gps data arrive.

      Any parameters that are null will not be updated.

      Parameters:
      iStreamer - Streamer index
      name - Streamer name
      coord - Streamer coordinates
      coordError - streamer coordinate errors
      originSettings - origin settings (what the streamer is referenced to)
      locatorSettings - locator settings (not yet used).
    • newStreamer

      public void newStreamer(long timeMilliseconds, Streamer newStreamerData)
      Update a streamer and create a new StreamerDataUnit based on an existing streamer from elsewhere in PAMGuard - currently called from the DIFAR invalid input: '&' network receiver modules.

      This will not only update the streamer, but will also create a new streamer data unit and all that is associated with it.

      Parameters:
      timeMilliseconds -
      newStreamerData - - the new streamer invalid input: '&' data unit will be based on this
    • updateStreamerAndDataUnit

      public void updateStreamerAndDataUnit(long timeMilliseconds, Streamer newStreamerData)
      Update a streamer and update an existing StreamerDataUnit with information from elsewhere in PAMGuard.
      Parameters:
      timeMilliseconds -
      newStreamerData -
    • getSeparationInSeconds

      public double getSeparationInSeconds(int channelMap, long timeMillis)
      Get the separation of two hydrophones - hopefully, channelMap will contain just two set bits !
      Parameters:
      channelMap -
      Returns:
      the separation between two hydrophones in milliseconds
    • getSeparationInSeconds

      public double getSeparationInSeconds(int a1, int a2, long timeMillis)
      Parameters:
      a1 - phone 1
      a2 - phone 2
      Returns:
      separation of two hydrophones in seconds.
    • getMaxPhoneSeparation

      public double getMaxPhoneSeparation(long timeMillis)
      Get the max phone separation in metres for all hydrophones in the array.
      Returns:
      max phone separation in metres.
    • getMaxPhoneSeparation

      public double getMaxPhoneSeparation(int phoneMap, long timeMillis)
      Get the max phone separation in metres.

      this will not currently work if hydrophones are in different clusters

      Parameters:
      phoneMap - bit map of used hydrophones.
      Returns:
      max phone separation in metres.
    • getSeparationError

      public double getSeparationError(int a1, int a2, long timeMillis)
      Get the error in the separation between two hydrophones along the axis joining the two phones
      Parameters:
      a1 - phone 1
      a2 - phone 1
      Returns:
      error in m.
    • getSeparationError

      public double getSeparationError(int a1, int a2, PamVector direction, long timeMillis)
      Get the separation error in a given direction
      Parameters:
      a1 - phone 1
      a2 - phone 2
      direction - direction of interest.
      Returns:
      error in that direction
    • getWobbleRadians

      public double getWobbleRadians(int a1, int a2, long timeMillis)
    • getPerpendicularError

      public double getPerpendicularError(int a1, int a2, long timeMillis)
      Get the error in the plane perpendicular to the line separating two hydrophones.
      Parameters:
      a1 - hydrophone 1
      a2 - hydrophone 2
      Returns:
      magnitude of error perpendicular to the line between them.
    • getPerpendicularError

      public double getPerpendicularError(int a1, int a2, PamVector direction)
      Parameters:
      a1 -
      a2 -
      direction -
      Returns:
    • getSeparationErrorVector

      public PamVector getSeparationErrorVector(int a1, int a2, long timeMillis)
      Gets the error of the separation between two hydrophones as a vector.

      If the hydrophones are in the same streamer, then the error is the error on the coordinate of each phone added in quadrature, and the streamer errors are ignored.

      If the hydrophones are in different streamers, then the streamer errors are also incorporated.

      Parameters:
      a1 - phone number 1
      a2 - phone number 2
      timeMillis - the current time in milliseconds
      Returns:
      vector representing components of error in each direction.
    • getTimeDelayError

      public double getTimeDelayError(int a1, int a2, long timeMillis)
      Parameters:
      a1 - phone number 1
      a2 - phone number 2
      timeMillis -
      Returns:
    • createSimpleArray

      public static PamArray createSimpleArray(String arrayName, double y0, double height, double separation, int nElements, double sensitivity, double gain, double[] bandwidth)
      Create a simple linear array.
      Parameters:
      arrayName - name
      y0 - y position of first hydrophone
      separation - separation between each element
      nElements - number of eleemnts
      sensitivity - hydrophone sensitivity
      gain - preamp gain
      bandwidth - preamp bandwidth
      depth - depth
      Returns:
      new array
    • getSpeedOfSound

      public double getSpeedOfSound()
      Returns:
      Speed of sound in m/s
    • setSpeedOfSound

      public void setSpeedOfSound(double speedOfSound)
      Parameters:
      speedOfSound - speed of sound in m/s
    • getSpeedOfSoundError

      public double getSpeedOfSoundError()
    • setSpeedOfSoundError

      public void setSpeedOfSoundError(double speedOfSoundError)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getArrayFileName

      public String getArrayFileName()
    • clone

      public PamArray clone()
    • getArrayFile

      public String getArrayFile()
      Returns:
      Returns the arrayFile.
    • setArrayFile

      public void setArrayFile(String arrayFile)
      Parameters:
      arrayFile - The arrayFile to set.
    • getArrayName

      public String getArrayName()
      Returns:
      Returns the arrayName.
    • setArrayName

      public void setArrayName(String arrayName)
      Parameters:
      arrayName - The arrayName to set.
    • getHydrophoneLocator

      public HydrophoneLocator getHydrophoneLocator()
      Returns:
      Returns the fixedPointReferenceBlock.
    • getNumStreamers

      public int getNumStreamers()
      Returns:
      the number of streamers in the system.
    • indexOfStreamer

      public int indexOfStreamer(Streamer aStreamer)
      Get the index of a specified streamer.
      Parameters:
      aStreamer -
      Returns:
      index of streamer or -1.
    • getStreamer

      public Streamer getStreamer(int streamerIndex)
      Get the streamer at a specific index.
      Parameters:
      streamerIndex -
      Returns:
      reference to a streamer.
    • getStreamerCount

      public int getStreamerCount()
      Get the number of different streamers (not the number of streamer data units)
      Returns:
      number of unique streamers.
    • findStreamer

      public Streamer findStreamer(String streamerName)
    • cloneStreamer

      public Streamer cloneStreamer()
      Clone a streamer, doing a hard clone of all hydrophones, localiser stuff, etc.
      Returns:
      the new streamer reference (which will be added already to the array)
    • cloneStreamer

      public Streamer cloneStreamer(Streamer aStreamer)
      Clone a streamer, doing a hard clone of all hydrophones, localiser stuff, etc.
      Parameters:
      streamer - to clone.
      Returns:
      the new streamer reference (which will be added already to the array)
    • getDimensionLimits

      public double[][] getDimensionLimits()
      Get the limits of the dimensions of the entire array.
      Returns:
      a 3 by 2 double array of the min and max of x,y,z.
    • getPhonesForStreamer

      public int getPhonesForStreamer(Streamer streamer)
      Get a bitmap of hydrophones used with a particular streamer.
      Parameters:
      streamer - Hydrophone streamer.
      Returns:
      bitmap of used hydrophones.
    • getPhonesForStreamer

      public int getPhonesForStreamer(int streamerId)
      Get a bitmap of hydrophones used with a particular streamer.
      Parameters:
      streamerId - Hydrophone streamer index.
      Returns:
      bitmap of used hydrophones.
    • getStreamerForPhone

      public int getStreamerForPhone(int phoneId)
      Get the streamer id for a particular hydrophone
      Parameters:
      phoneId - hydrophone index
      Returns:
      stramer index.
    • getHydroponeData

      public Hydrophone getHydroponeData(int hydrophoneIndex, long timeMilliseconds)
      Get data for a specific hydrophone at a specific time. This is the raw hydrophone data, which may later get modified by a hydroponelocaliser.
      Parameters:
      hydrophoneIndex -
      timeMilliseconds -
      Returns:
    • getStreamerData

      public Streamer getStreamerData(int streamerIndex, long timeMilliseconds)
      Get the streamer information for the given time. Should always be able to return something. May be an existing object or may be able to interpret between them. Note that this is the basic streamer data and is NOT iterated through the origin systems or anything.
      Parameters:
      timeMilliseconds -
      Returns:
    • addStreamer

      public int addStreamer(Streamer streamer)
      Add a streamer and return the streamer id which will be one less than the number of streamers.
      Parameters:
      streamer -
      Returns:
    • removeStreamer

      public void removeStreamer(int row)
    • getArrayShape

      public int getArrayShape()
      Returns:
      the array shape, this is either point, line, plane or volumetric
    • setArrayShape

      public void setArrayShape(int arrayShape)
      Parameters:
      arrayShape - set the array shape - point, line, plane or volumetric.
    • getArrayTypeString

      public String getArrayTypeString()
      Return the type of array this is (e.g. "Point Array", "Line Array", etc)
      Returns:
    • getArrayLocatorClass

      public Class getArrayLocatorClass()
      Returns:
      the arrayLocator class. This is NOT the master locator, but the default class for the array which will get used by the sub locators running behind the master locator.
    • getHydrophoneSensitivityAndGain

      public double getHydrophoneSensitivityAndGain(int hydrophoneChannel)
      Get the hydrophone sensitivity and gain added together.
      Parameters:
      hydrophoneChannel - hydrophone hardware number
      Returns:
      Sum of hydrophone sensitivity and gain.
    • getClipLevel

      public double getClipLevel(int hydrophoneChannel)
      Get the clip level - this is the level at which a signal will clip using the specified DAQ system. The level is in dB re 1uPa if in water or dB re 20uPa if in air.
      Parameters:
      hydrophoneChannel - - the hydrophone/microphone hardware number
      Returns:
      the clip level.
    • getHydrophoneCoordinates

      public double[] getHydrophoneCoordinates(int iHydrophone, long timeMilliseconds)
      Get the hydrophone coordinates as a three element (x,y,z) vector referenced to the streamer position

      Hydrophone locators which want to vary location as a function of time should override this function and use the timeMilliseconds parameter to get the true location of the hydrophones in their own way.

      Parameters:
      iHydrophone - hydrophone number
      timeMilliseconds - time of location
      Returns:
      three element position vector.
    • getHydrophoneCoordinateErrors

      public double[] getHydrophoneCoordinateErrors(int iHydrophone, long timeMilliseconds)
      Get the hydrophone coordinate errors as a three element (x,y,z) vector.

      Hydrophone locators which want to vary this error as a function of time should override this function and use the timeMilliseconds parameter to get the true errors in their own way.

      Parameters:
      iHydrophone - hydrophone number
      timeMilliseconds - time of location
      Returns:
      three element error vector.
    • getHydrophoneCoordinate

      public double getHydrophoneCoordinate(int iHydrophone, int iCoordinate, long timeMilliseconds)
      Get a hydrophone coordinate referenced to the nominal array position (GPS for towed systems, a fixed point, etc.)

      Hydrophone locators which want to vary location as a function of time should override this function and use the timeMilliseconds parameter to get the true location of the hydrophones in their own way.

      Parameters:
      iHydrophone - hydrophone number
      iCoordinate - coordinate number (0,1,2 for x,y,z);
      timeMilliseconds - time of location
      Returns:
      three element position vector.
    • getHydrophoneCoordinateError

      public double getHydrophoneCoordinateError(int iHydrophone, int iCoordinate, long timeMilliseconds)
      Get a hydrophone coordinate error

      Hydrophone locators which want to vary this error as a function of time should override this function and use the timeMilliseconds parameter to get the true errors in their own way.

      Parameters:
      iHydrophone - hydrophone number
      iCoordinate - coordinate number (0,1,2 for x,y,z);
      timeMilliseconds - time of location
      Returns:
      three element error vector.
    • getHydrophoneX

      public double getHydrophoneX(int iHydrophone, long timeMilliseconds)
      Get a hydrophone x coordinate for a given time
      Parameters:
      iHydrophone - hydrophone number
      timeMilliseconds - time in milliseconds
      Returns:
      hydrophone x coordinate.
    • getHydrophoneY

      public double getHydrophoneY(int iHydrophone, long timeMilliseconds)
      Get a hydrophone y coordinate for a given time
      Parameters:
      iHydrophone - hydrophone number
      timeMilliseconds - time in milliseconds
      Returns:
      hydrophone y coordinate.
    • getHydrophoneZ

      public double getHydrophoneZ(int iHydrophone, long timeMilliseconds)
      Get a hydrophone z coordinate for a given time
      Parameters:
      iHydrophone - hydrophone number
      timeMilliseconds - time in milliseconds
      Returns:
      hydrophone z coordinate.
    • getHydrophoneSymbol

      public PamSymbol getHydrophoneSymbol(int iHydrophone)
      Get the preferred symbol for a given hydrophone.
      Parameters:
      iHydrophone - hydrophone number
      Returns:
      Symbol to plot
    • prepareToSerialize

      public void prepareToSerialize()
      Called just before the array is serialised into Pam settings so it can get data out of the localisers, etc.
    • arrayDeserialized

      public void arrayDeserialized()
      called just after the array settings have been loaded so that data can be loaded back into the Hydrophone localisers.
    • getOriginInterpolation

      public int getOriginInterpolation()
      Returns:
      the originInterpolation
    • setOriginInterpolation

      public void setOriginInterpolation(int originInterpolation)
      Parameters:
      originInterpolation - the originInterpolation to set
    • getHydrophoneInterpolation

      public int getHydrophoneInterpolation()
      Returns:
      the hydrophoneInterpolation
    • setHydrophoneInterpolation

      public void setHydrophoneInterpolation(int hydrophoneInterpolation)
      Parameters:
      hydrophoneInterpolation - the hydrophoneInterpolation to set
    • setHydrophoneGain

      public boolean setHydrophoneGain(int iPhone, double phoneGain)
      Set the hydrophone preamplifier gain
      Parameters:
      iPhone - hydrophone index
      phoneGain - preamplifier gain
      Returns:
      true if set successfully
    • setHydrophoneFilter

      public boolean setHydrophoneFilter(int iPhone, double phoneFilter)
      Set the hydrophone bandwidth
      Parameters:
      iPhone - hydrophone index
      phoneGain - preamplifier bandwidth
      Returns:
      true if set successfully
    • getParameterSet

      public PamParameterSet getParameterSet()
      Description copied from interface: ManagedParameters
      Get a set of data that describes all of the parameters in a class
      Specified by:
      getParameterSet in interface ManagedParameters
      Returns:
      description of the parameters in a class.
    • setDefaultSensitivity

      public void setDefaultSensitivity(double defaultRecieverSens)
      Set all sensitivities on all hydrophones to a new value
      Parameters:
      defaultRecieverSens - - the new sensitivity to set in dB re 1V/uPa (units may differ depending on medium)