fdhwlib  2.0.25
GpsUnit Class Reference

#include <gpsunit.h>

List of all members.

Classes

Public Types

Public Member Functions

Public Attributes

Private Attributes


Detailed Description

The class defines the interface to the hardware gps unit for the FD detector.

Todo:
Throw exceptions in case of an abnormal function result / no connection.

Definition at line 122 of file gpsunit.h.


Member Enumeration Documentation

Status of the gps unit and gps unit commands.

Enumerator:
Ok 

Ok.

Failed 

Operation failed.

Unknown 

Unknown state or error.

NoConnection 

No connection to the gps unit/server.

OutdatedTimeStamp 

The data with this time stamp is not available any more.

FutureTimeStamp 

The time stamp lies in the future; request again later?!

MissingData 

The data for a valid time stamp is missing; possible cause is a communication error between gps unit and server?!

OncoreError 

The oncore moudle is not in run mode.

OncoreStartup 

The Gps is in startup phase.

AugerSecondError 

The auger second counter is not synchronized.

VersionMismatch 

The version of gpsserver and gps clock are not compatible.

SiteSurvey 

The Gps clock performs a site survey to determine the position of the device.

PositionNotFix 

The Gps clock is not in position fix mode The mode is necessary to increase clock precision.

OncoreSecondError 

The oncore second counter is not synchronized.

OncoreTimezoneError 

The gps clock displays time information of a wrong time zone (not UTC)

NoLeapSeconds 

The actual number of leap second has not been loaded.

BadAlmanac 

The oncore module was not able to receive an almanac.

BadSatellites 

The oncore module can not access enough satellites to determine position/time.

Definition at line 127 of file gpsunit.h.


Constructor & Destructor Documentation

GpsUnit::GpsUnit ( const char *  inifile = "FE.ini")

Create instance and read parameters form the given inifile.

Format:

    [GpsUnit]
    hostname = localhost
    port = 5198
    
GpsUnit::GpsUnit ( const char *  inifile,
const char *  host,
int  port = 0 
)
GpsUnit::~GpsUnit ( )

Member Function Documentation

Status GpsUnit::checkActalTime ( )
Status GpsUnit::checkTime ( int *  tOncoreDiff = 0,
int *  tAugerDiff = 0 
)

Check second counters of the gps clock.

Compare with PC time. The offset of the gps messages from about 300ms is taken into account. If the functions is during the message window between 250 and 350ms the check will wait for the message window to pass by. before the message window the second counters will be compared with the last second of the PC.

Returns:
Ok, Failed
Status GpsUnit::connect ( char *  host = 0,
int  port = 0 
)

Connect to the gps server.

The arguments overwrite the standard parameter read from the inifile.

Returns:
The status of the command will be Ok or Failed.
Status GpsUnit::disconnect ( )

Disconnect from the gps server.

Returns:
The status of the command will be Ok or Failed.
void GpsUnit::displayRawData ( FILE *  fout)

Display raw gpsclock messages.

void GpsUnit::getCapturedInputs ( FILE *  fout,
int  n = 1,
int  ch = 0 
)

Get time stamps of signal changes.

int GpsUnit::getInputMode ( int  ch,
int *  mode = 0,
int *  state = 0 
)

Get the mode for the input signals (external trigger, veto).

If the the parameters are not required it is possible to set the pointers to zero.

Parameters:
chnumber of the input channel (0..3)
modemeaning of the input signal (0 veto, 1 external trigger)
statethe input channels can be deactivate if required. (-1 no change, 0 off, 1 on)
int GpsUnit::getLeapSeconds ( )

Get number of leap seconds.

int GpsUnit::getLidarTriggerFrequency ( )

Get the frequency of the lidar trigger output of the GPS unit.

Returns:
freq Frequency of the trigger
void GpsUnit::getPosition ( std::string *  name,
int *  latitude = 0,
int *  longitude = 0,
int *  height = 0 
)

Get the postion of the gps clock.

void GpsUnit::getPosition ( int *  id,
std::string *  name,
int *  latitude = 0,
int *  longitude = 0,
int *  height = 0 
)

Get the position and id of the gps clock Id and name of the position are determined from the gpsserver ini file.

Arguments that are set to zero will be not considered in the request.

Parameters:
idId of the position (0=Unknown) For the FD eye station in Argentina the numbers 1 to 4 are reserved.
nameName of the position returned from the database
latitudelatitude
longitudelongitude
heightheight
void GpsUnit::getPulseGeneratorParameter ( int  ch,
struct pulseGen parameter 
)

Set the parameters for a pulse generator channel.

Parameters:
chnumber of the input channel (0..3)
parameterArray with the pulse generator parameters
const char* GpsUnit::getServerHostname ( )

Get the hostname of the server machine.

int GpsUnit::getServerPort ( )

Get gpsserver port number.

Status GpsUnit::getStatus ( )

Get the status of the gps unit.

The following list is checked to determine the status of the gps unit.

  • (Is the gpsclock connected?) --> Will terminate gpsserver!
  • (Time of the last messages from the oncore module?) --> Will automatically be checked with sec counter
  • Are enough satelites in the field of view?
  • Is the almanac loaded?
  • Is the number of leap seconds known?
  • Correct timezone used for messages?
  • Do oncore and PC time fit?
  • Position fix mode enabled?
  • Site Survey progress?
  • Oncore RUN mode?
  • (Time of the last auger-F messages?) --> Will automatically be checked with sec counter
  • Do the versions of auger-FPGA and driver fit?
  • Is the auger counter and the PC clock fit?
Returns:
Status returns "Details", use displayVerboseStatus to see the first error in the list above.
unsigned int GpsUnit::getTime ( unsigned int *  augerSec = 0)

Read the (oncore) gps second counter.

Parameters:
augerSecValue of the auger second counter. The values of both counters can be different, if the adjustment of the counters is turned off.
Status GpsUnit::getTimeCorrection ( unsigned int  gpsSec,
unsigned int *  count,
int *  phase,
int *  lastSawtooth,
int *  nextSawtooth 
)

Get the parameters for the correction of the time base from the FD camera electronic.

Parameters:
gpsSecRequested second according to the gps convention (Seconds since beginning of 1980)
countNumber of 80MHz ticks for this second
phasemeasured delay between 1pps pulse of the oncore module and second strobe generated for the camera electronic in nanoseconds
lastSawtoothnegative sawtooth time error of the last 1pps pulse of the oncore module in nanoseconds.
nextSawtoothnegative sawtooth time error of the next 1pps pulse of the oncore module in nanoseconds
Returns:
The status of the request is returned. Possible status messages are no connection to the gps server available (NoConnection), data for the requested time stamp is not available any more (OutDatedTimeStamp), the time stamp lies in the future (FutureTimeStamp), the time stamp is valid but the data is missing (MissingData), vaild data (Ok).
Status GpsUnit::getTimeCorrection ( unsigned int  gpsSec,
double *  T10,
double *  offset 
)

Get the correction parameter.

Parameters:
gpsSecName of the gps second
T10Length of the a 10MHz pulse from the gps unit [ns].
offsetOffset between 1pps signal and 10MHz signal [ns].
std::string GpsUnit::getVerboseStatus ( GpsUnit::Status  status)

Get the verbose meaning of the passed status value.

int GpsUnit::getVersion ( enum deviceId  dev,
int  len = 0,
char *  buildnote = 0 
)

Get the version number of a subdevice.

The version number is mulitplied by 100

void GpsUnit::init ( )

(Re-)Initialize the oncore module.

The command will also cause a new measurement of the gps coordinates.

bool GpsUnit::isAdjustActive ( )

Adjustment of auger second counter active?

bool GpsUnit::isInhibit ( )

Request the state of the GPS timing unit.

void GpsUnit::releaseInhibit ( )

Release inhibit signal for the FD electronic.

void GpsUnit::sendMsg ( unsigned char *  msg,
int  n 
)

Send raw message to server.

void GpsUnit::setAdjustMode ( int  mode)

Set the adjustment mode (0 disabled, 1 once, 2 active)

void GpsUnit::setCommunicationWindow ( int  begin,
int  end 
)

Define the communication window for the time control module of the GPS unit.

Parameters:
beginBegin of the interval [ms]
endEnd of the interval [ms]
void GpsUnit::setInhibit ( )

Set the inhibit signal for the FD electronic.

void GpsUnit::setInputMode ( int  ch,
int  mode,
int  state = -1 
)

Set the mode for the input signals (external trigger, veto).

Parameters:
chnumber of the input channel (0..3)
modemeaning of the input signal (0 veto, 1 external trigger)
statethe input channels can be deactivate if required. (-1 no change, 0 off, 1 on)
void GpsUnit::setLidarTriggerFrequency ( int  freq)

Set the frequency of the lidar trigger output of the GPS unit.

Parameters:
freqFrequency of the trigger (0, 20, 1000Hz).
void GpsUnit::setPulseGeneratorParameter ( int  ch,
struct pulseGen  parameter 
)

Set the parameters for a pulse generator channel.

Parameters:
chnumber of the input channel (0..3)
parameterArray with the pulse generator parameters

Note: If you set a start time in the past, there will be nothing done. A start time of 0 will use 'now' as starting time.

Status GpsUnit::shutdown ( )

Shutdown the gps server.

Returns:
The status of the command will be Ok or Failed.

Member Data Documentation

bool GpsUnit::connected [private]

Definition at line 444 of file gpsunit.h.

std::string GpsUnit::host [private]

Definition at line 446 of file gpsunit.h.

Definition at line 164 of file gpsunit.h.

int GpsUnit::port [private]

Definition at line 447 of file gpsunit.h.

Socket to connect to the gps server.

Definition at line 442 of file gpsunit.h.

unsigned int GpsUnit::status [private]

Definition at line 450 of file gpsunit.h.


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