CARMA C++
carma::control::DriveHandle Class Reference

Manages antenna drive control DO connections. More...

#include <carma/control/DriveHandle.h>

Inheritance diagram for carma::control::DriveHandle:
carma::control::RemoteObjHandleT< T > carma::control::RemoteObjHandleBase

Public Types

enum  SourceMode { SOURCE_MODE_RA_DEC, SOURCE_MODE_AZ_EL, SOURCE_MODE_IDLE, SOURCE_MODE_INVALID }
 

Public Member Functions

void checkModeForEquatOffset (void)
 Check if the drive mode is in an appropriate state for calling setEquatOffset. More...
 
void conditionallyUpdateTrackTolerance (const double freq)
 Check to see if the HPBW has changed enough to warrant a threshold update, converting from hpbw to arcsec. More...
 
 DriveHandle (unsigned short carmaAntNo, const services::Location &coords, monitor::MonitorSystem &monitorSystem, monitor::ControlSubsystemBase::Antenna &antenna)
 Constructor. More...
 
::std::string getCarmaAntennaName () const
 Returns antenna name as full carma name. More...
 
unsigned short getCarmaAntennaNo () const
 
services::Ephemeris getEphemeris () const
 
services::Location getLocation () const
 Method to get antenna's location as longitude, latitude, altitude. More...
 
carma::services::Source getSource ()
 
SourceMode getSourceMode () const
 Method to get source mode of antenna - it can point at nothing, or at a source specified by RA/DEC, or a point in the sky specified by Az/El. More...
 
::std::string getSourceName ()
 
::std::string getTypedAntennaName () const
 Returns antenna name as full type qualified name. More...
 
bool isActionComplete (const monitor::MonitorSystem &monsys, int monDataErrorLimit)
 Compare next sequence number with one returned by the monitor system. More...
 
void setAz (double azDegrees, int preferredSequenceNo)
 Set antenna azimuth. More...
 
void setAzel (double azDegrees, double elDegrees, int preferredSequenceNo)
 Set antenna azimuth and elevation. More...
 
void setAzOffset (double azArcmin, int preferredSequenceNo)
 Set antenna Az offset for astronomy or engineering. More...
 
void setBimaMountPointingConstants (::std::vector< double > dazCoefs,::std::vector< double > delCoefs)
 Set BIMA mount pointing constants. More...
 
void setEl (double elDegrees, int preferredSequenceNo)
 Set antenna elevation. More...
 
void setElOffset (double elArcmin, int preferredSequenceNo)
 Set antenna El offset for astronomy or engineering. More...
 
void setEquatOffset (double ra, double dec)
 Defines equatorial offsets in ra and dec from the input source. More...
 
void setLocation (const services::Location &location)
 Method to set antenna's absolute location. More...
 
void setMountOffset (double azArcmin, double elArcmin, int preferredSequenceNo)
 Set mount offsets. More...
 
void setOffset (double azArcmin, double elArcmin, int preferredSequenceNo)
 Set antenna Az/El offsets for astronomy or engineering. More...
 
void setOvroMountPointingConstants (double m1, double m2, double m3, double m4, double m5)
 Set OVRO mount pointing constants. More...
 
void setSafeRange (float azLow, float azHigh, float elLow, float elHigh)
 Set the azimuth and elevation ranges within which this antenna is safe from collisions with other antennas. More...
 
void setSzaEncoderLimits (double azMinEncoderCount, double azMaxEncoderCount, double elMinEncoderCount, double elMaxEncoderCount)
 Set SZA encoder limits. More...
 
void setSzaEncoderZeros (double azEncoderZeroDegrees, double elEncoderZeroDegrees)
 Set SZA encoder zeros. More...
 
void setSzaMountPointingConstants (double azEncoderCountsPerTurn, double elEncoderCountsPerTurn, double azMinEncoderCount, double azMaxEncoderCount, double elMinEncoderCount, double elMaxEncoderCount, double azEncoderZeroDegrees, double elEncoderZeroDegrees, double haTiltDegrees, double latTiltDegrees, double elTiltDegrees, double opticalXCollimationDegrees, double opticalYCollimationDegrees, double opticalFlexureSinDegrees, double opticalFlexureCosDegrees, double radioXCollimationDegrees, double radioYCollimationDegrees, double radioFlexureSinDegrees, double radioFlexureCosDegrees)
 Set SZA mount pointing constants. More...
 
void setSzaTilts (double haTiltDegrees, double latTiltDegrees, double elTiltDegrees)
 Set SZA tilts. More...
 
void startTrack (const ::std::string source, const carma::control::MjdTriplet mjdTriplet, const ::std::string userCatalog, const carma::control::AzWrapMode azWrapMode, double time, int preferredSequenceNo)
 For use the first time this drive tracks a given object. More...
 
void startTrackX (const carma::services::Source source, const carma::control::MjdTriplet mjdTriplet, const carma::control::AzWrapMode azWrapMode, double time, int preferredSequenceNo)
 Version of startTrack that takes a Source object instead of a source name and catalog. More...
 
void stop ()
 Stop the antenna at its current azimuth and elevation. More...
 
void stow (antenna::common::DriveControl::Position position, int preferredSequenceNo)
 Move the antenna one of the stow positions (zenith, service, safe). More...
 
void test (double aSeconds, double bSeconds, long whichTest)
 
void trackCurrentSourceWithOffsets (const carma::control::MjdTriplet mjdTriplet, const ::std::string userCatalog, carma::control::AzWrapMode azWrapMode, int preferredSequenceNo)
 Continue tracking the current source with new equatorial offsets. More...
 
void trackCurrentSourceWithOffsets (const carma::control::MjdTriplet mjdTriplet, carma::control::AzWrapMode azWrapMode, int preferredSequenceNo)
 
void trackingThreshold (float hpbw)
 Set the tracking threshold. More...
 
void updateTracking (double mjd)
 Updates tracking information to antenna,. More...
 
void updateTrackTolerance (const float tolerance, const double freq)
 Set the tracking threshold to the antennas. More...
 
void updateWeather (double mjd, const services::Temperature &airTemp, const services::Pressure &atmPressure, double relhumid, const services::Temperature &dewpointTemp, const services::Velocity &windSpeed, const services::Angle &windDirection, bool logGoodSend)
 Updates weather information to drive. More...
 
- Public Member Functions inherited from carma::control::RemoteObjHandleT< T >
template<typename S >
S::_var_type narrowedRemoteObj () const
 Returns remote object handle as var. More...
 
T::_var_type remoteObj () const
 Returns remote object handle as var. More...
 
 RemoteObjHandleT (const ::std::string &doName, monitor::MonitorPointBool *mpReachable, const monitor::MonitorSubsystem *subsystem, monitor::MonitorSystem *system, bool defaultLogIfNotReachable, bool defaultLogSentCommands)
 Constructor. More...
 
virtual ~RemoteObjHandleT ()
 Destructor. More...
 
- Public Member Functions inherited from carma::control::RemoteObjHandleBase
bool attemptToReconnectIfNeeded ()
 Try reconnect to the DO if needed. More...
 
::std::string doName () const
 get the DO name More...
 
void forceFullReconnect ()
 Force a full re-lookup of the DO by name. More...
 
bool isObjReachable ()
 If state is 'not reachable' and monitor system is current, tries to reconnect. More...
 
bool isObjReachable (bool logIfNotReachable)
 
 RemoteObjHandleBase (const ::std::string &doName, monitor::MonitorPointBool *mpReachable, const monitor::MonitorSubsystem *subsystem, monitor::MonitorSystem *system, bool defaultLogIfNotReachable, bool defaultLogSentCommands)
 Constructor. More...
 
virtual ~RemoteObjHandleBase ()
 Destructor. More...
 

Additional Inherited Members

- Protected Member Functions inherited from carma::control::RemoteObjHandleT< T >
virtual bool resolveObjRef ()
 
- Protected Member Functions inherited from carma::control::RemoteObjHandleBase
bool getDefaultLogIfNotReachable () const
 
bool getDefaultLogSentCommands () const
 
void invalidateObjRef ()
 
void invalidateObjRefIfNeededForCaught ()
 
void logException (const ::std::string &callString, const ::std::string &exString) const
 
void logSentCommand (const ::std::string &callString, const double mjd) const
 
void logSentCommand (const ::std::string &callString, const double mjd, const ::std::string &subDoName) const
 
void logSentCommandIfNeeded (const ::std::string &callString, const double mjd) const
 
void logSentCommandIfNeeded (const ::std::string &callString, const double mjd, const ::std::string &subDoName) const
 
void markObjRefValid ()
 
void processException (const ::std::string &callString, const ::CORBA::Exception &corbaException)
 
void throwBadRemoteObjAccess () const
 
void throwIfObjRefIsNotValid () const
 

Detailed Description

Manages antenna drive control DO connections.

Definition at line 55 of file DriveHandle.h.

Constructor & Destructor Documentation

carma::control::DriveHandle::DriveHandle ( unsigned short  carmaAntNo,
const services::Location coords,
monitor::MonitorSystem monitorSystem,
monitor::ControlSubsystemBase::Antenna &  antenna 
)

Constructor.

Parameters
carmaAntNoconst long - CARMA antenna number
coordsantenna location coordinates
monitorSystemcarma monitor system Allows antenna to get a reference to its own monitor stream.
antennaconst monitor::ControlSubsystemBase::Antenna& antenna control monitor system, which contains control and monitor points set by the control subsystem.

Member Function Documentation

void carma::control::DriveHandle::checkModeForEquatOffset ( void  )

Check if the drive mode is in an appropriate state for calling setEquatOffset.

This method will throw an exception if the drive mode is wrong. This method is necessary to inform observers what they did wrong, since firing off setEquatOffset in a WorkerPool swallows the exception message. So call this first in a iterative loop, before doing WorkerPool magic.

This method is not expensive since the call stays inside the drive handle and never goes to the DO.

void carma::control::DriveHandle::conditionallyUpdateTrackTolerance ( const double  freq)

Check to see if the HPBW has changed enough to warrant a threshold update, converting from hpbw to arcsec.

We use a 3% change criterion. If it has, then update the threshold to the antennas. This is used when the frequency is updated.

Parameters
Thecurrent LO freq in GHz (used in conversion to arcsec).
::std::string carma::control::DriveHandle::getCarmaAntennaName ( ) const

Returns antenna name as full carma name.

For OVRO antenna 3 returns "carma3".

Returns
std::string full, carma name of antenna
unsigned short carma::control::DriveHandle::getCarmaAntennaNo ( ) const
Returns
the antenna number associated with this drive.
services::Ephemeris carma::control::DriveHandle::getEphemeris ( ) const
Returns
a copy of this DriveHandle's ephemeris object.
services::Location carma::control::DriveHandle::getLocation ( ) const

Method to get antenna's location as longitude, latitude, altitude.

Parameters
none
Returns
Location
SourceMode carma::control::DriveHandle::getSourceMode ( ) const

Method to get source mode of antenna - it can point at nothing, or at a source specified by RA/DEC, or a point in the sky specified by Az/El.

Parameters
none
Returns
const enum SourceMode mode for antenna
See Also
SourceMode
::std::string carma::control::DriveHandle::getSourceName ( )
Returns
the name of the source this antenna is tracking.
::std::string carma::control::DriveHandle::getTypedAntennaName ( ) const

Returns antenna name as full type qualified name.

For OVRO antenna 3 returns "ovro3".

Returns
std::string full, type qualified name of antenna
bool carma::control::DriveHandle::isActionComplete ( const monitor::MonitorSystem monsys,
int  monDataErrorLimit 
)

Compare next sequence number with one returned by the monitor system.

If they are the same then the last drive action is complete.

Parameters
monsysmonitor system from which to retrieve completion
monitorDataErrorLimitnumber of consecutive monitor data invalid limit before thowing an exception
Returns
true if last action is complete
Exceptions
ifnumber of consecutive monitor data errors is exceeed
void carma::control::DriveHandle::setAz ( double  azDegrees,
int  preferredSequenceNo 
)

Set antenna azimuth.

Parameters
azDegreesazimuth
preferredSequenceNowill be used unless it is already the one returned by the monitor system, in which case one that is ten greater will be used.
void carma::control::DriveHandle::setAzel ( double  azDegrees,
double  elDegrees,
int  preferredSequenceNo 
)

Set antenna azimuth and elevation.

Parameters
azDegreesazimuth
elDegreeselevation
preferredSequenceNowill be used unless it is already the one returned by the monitor system, in which case one that is ten greater will be used.
void carma::control::DriveHandle::setAzOffset ( double  azArcmin,
int  preferredSequenceNo 
)

Set antenna Az offset for astronomy or engineering.

Parameters
azArcminoffset (arcmin)
preferredSequenceNowill be used unless it is already the one returned by the monitor system, in which case one that is ten greater will be used.
void carma::control::DriveHandle::setBimaMountPointingConstants ( ::std::vector< double >  dazCoefs,
::std::vector< double >  delCoefs 
)

Set BIMA mount pointing constants.

Note
The vector argument is passed by value so we can safely insure that it is fully and deeply copied across the thread barrier when this method is forked out to the worker pool
void carma::control::DriveHandle::setEl ( double  elDegrees,
int  preferredSequenceNo 
)

Set antenna elevation.

Parameters
elDegreeselevation
preferredSequenceNowill be used unless it is already the one returned by the monitor system, in which case one that is ten greater will be used.
void carma::control::DriveHandle::setElOffset ( double  elArcmin,
int  preferredSequenceNo 
)

Set antenna El offset for astronomy or engineering.

Parameters
elArcminoffset (arcmin)
preferredSequenceNowill be used unless it is already the one returned by the monitor system, in which case one that is ten greater will be used.
void carma::control::DriveHandle::setEquatOffset ( double  ra,
double  dec 
)

Defines equatorial offsets in ra and dec from the input source.

Note that these are sky offsets, not coordinate offsets; to convert an ra coord offset to a sky offset, multiply by cos(dec) Has no effect if not in equatorial mode. These offsets are set to zero when a new track command is given.

void carma::control::DriveHandle::setLocation ( const services::Location location)

Method to set antenna's absolute location.

Parameters
locationThe longitude, latitude, and altitude, represented by a Location object. The input is expected to be in the geocentric coordinate system (ECEF), but gets changed to WGS84 before it is sent to the antennas. Baselines and interferometry geometry are done in ECEF but antennas are pointed in WGS84.
void carma::control::DriveHandle::setMountOffset ( double  azArcmin,
double  elArcmin,
int  preferredSequenceNo 
)

Set mount offsets.

Parameters
azArcminAzimuth offset in arcminutes on the sky.
elArcminElevation offset in arcminutes on the sky.
preferredSequenceNowill be used unless it is already the one returned by the monitor system, in which case one that is ten greater will be used.
void carma::control::DriveHandle::setOffset ( double  azArcmin,
double  elArcmin,
int  preferredSequenceNo 
)

Set antenna Az/El offsets for astronomy or engineering.

Parameters
azArcminoffset (arcmin)
elArcminoffset (arcmin)
preferredSequenceNowill be used unless it is already the one returned by the monitor system, in which case one that is ten greater will be used.
void carma::control::DriveHandle::setOvroMountPointingConstants ( double  m1,
double  m2,
double  m3,
double  m4,
double  m5 
)

Set OVRO mount pointing constants.

void carma::control::DriveHandle::setSafeRange ( float  azLow,
float  azHigh,
float  elLow,
float  elHigh 
)

Set the azimuth and elevation ranges within which this antenna is safe from collisions with other antennas.

Note: an invocation DriveControl::stow(SAFE) must throw an exception if valid safe ranges have not been set with this command beforehand.

Parameters
azLow- the low end of the safe azimuth range, in degrees.
azHigh- the high end of the safe azimuth range, in degrees.
elLow- the low end of the safe elevation range, in degrees.
elHigh- the high end of the safe elevation range, in degrees.
carmaAntNoSeqSequence of carma antenna numbers. A sequence of the single value zero means all subarray antennas.
See Also
antenna::common::DriveControl::setSafeRange()
void carma::control::DriveHandle::setSzaEncoderLimits ( double  azMinEncoderCount,
double  azMaxEncoderCount,
double  elMinEncoderCount,
double  elMaxEncoderCount 
)

Set SZA encoder limits.

void carma::control::DriveHandle::setSzaEncoderZeros ( double  azEncoderZeroDegrees,
double  elEncoderZeroDegrees 
)

Set SZA encoder zeros.

void carma::control::DriveHandle::setSzaMountPointingConstants ( double  azEncoderCountsPerTurn,
double  elEncoderCountsPerTurn,
double  azMinEncoderCount,
double  azMaxEncoderCount,
double  elMinEncoderCount,
double  elMaxEncoderCount,
double  azEncoderZeroDegrees,
double  elEncoderZeroDegrees,
double  haTiltDegrees,
double  latTiltDegrees,
double  elTiltDegrees,
double  opticalXCollimationDegrees,
double  opticalYCollimationDegrees,
double  opticalFlexureSinDegrees,
double  opticalFlexureCosDegrees,
double  radioXCollimationDegrees,
double  radioYCollimationDegrees,
double  radioFlexureSinDegrees,
double  radioFlexureCosDegrees 
)

Set SZA mount pointing constants.

void carma::control::DriveHandle::setSzaTilts ( double  haTiltDegrees,
double  latTiltDegrees,
double  elTiltDegrees 
)

Set SZA tilts.

void carma::control::DriveHandle::startTrack ( const ::std::string  source,
const carma::control::MjdTriplet  mjdTriplet,
const ::std::string  userCatalog,
const carma::control::AzWrapMode  azWrapMode,
double  time,
int  preferredSequenceNo 
)

For use the first time this drive tracks a given object.

This method calls track() three times to send a full triplet to the drives. All tracking offsets are set to zero.

Parameters
sourceThe source name
Tripletof MJDs aligned to the antenna update cycle.
userCatalog- The fully qualified name of the user source catalog to search for the source, before looking in the system catalog.
azWrapMode- The azimuth wrap mode, one of ZERO, ADD, SUB, TIME
See Also
carma::control::AzWrapMode
Parameters
timewhen azWrapMode==TIME, an az wrap will be requested that allows the source to be tracked for 'time' minutes. Ignored if azWrapMode != TIME.
preferredSequenceNowill be used unless it is already the one returned by the monitor system, in which case one that is ten greater will be used.
void carma::control::DriveHandle::startTrackX ( const carma::services::Source  source,
const carma::control::MjdTriplet  mjdTriplet,
const carma::control::AzWrapMode  azWrapMode,
double  time,
int  preferredSequenceNo 
)

Version of startTrack that takes a Source object instead of a source name and catalog.

This avoids multiple file system reads, which can cause command timeouts if the filesystem is under stress. See bug 906

void carma::control::DriveHandle::stop ( )

Stop the antenna at its current azimuth and elevation.

void carma::control::DriveHandle::stow ( antenna::common::DriveControl::Position  position,
int  preferredSequenceNo 
)

Move the antenna one of the stow positions (zenith, service, safe).

Parameters
positionStow position to move to.
preferredSequenceNowill be used unless it is already the one returned by the monitor system, in which case one that is ten greater will be used.
void carma::control::DriveHandle::trackCurrentSourceWithOffsets ( const carma::control::MjdTriplet  mjdTriplet,
const ::std::string  userCatalog,
carma::control::AzWrapMode  azWrapMode,
int  preferredSequenceNo 
)

Continue tracking the current source with new equatorial offsets.

This method will send a new triplet to the drive DO.

Parameters
Tripletof MJDs aligned to the antenna update cycle.
userCatalog- The fully qualified name of the user source catalog to search for the source, before looking in the system catalog.
azWrapMode- The azimuth wrap mode, one of ZERO, ADD, SUB, TIME
preferredSequenceNowill be used unless it is already the one returned by the monitor system, in which case one that is ten greater will be used.
See Also
carma::control::AzWrapMode
void carma::control::DriveHandle::trackingThreshold ( float  hpbw)

Set the tracking threshold.

Parameters
thresholdtracking threshold in HPBW (halfpower beam widths)
void carma::control::DriveHandle::updateTracking ( double  mjd)

Updates tracking information to antenna,.

Parameters
mjdAntTimestamp for antenna tracking
void carma::control::DriveHandle::updateTrackTolerance ( const float  tolerance,
const double  freq 
)

Set the tracking threshold to the antennas.

Parameters
toleranceThe tracking threshold in HPBW.
freqThe current LO freq in GHz (used in conversion to arcsec).
void carma::control::DriveHandle::updateWeather ( double  mjd,
const services::Temperature airTemp,
const services::Pressure atmPressure,
double  relhumid,
const services::Temperature dewpointTemp,
const services::Velocity windSpeed,
const services::Angle windDirection,
bool  logGoodSend 
)

Updates weather information to drive.

Parameters
mjd,double,timeinstant for which tracking info is to be updated
airTempAmbient temperature
atmPressureAtmospheric pressure
relHumidRelative humidity, percent (a number between 0 and 100)
dewPointTempDew point temperature
windspeedWind speed
windDirectionWind direction, 0 degrees = north, 90 = east

The documentation for this class was generated from the following file: