11/3
Looking for main() in Antenna that is being run.
Run Antenna program:
It seems to be running when all sim flags are set to "t".
The only one it fails to run on is when simgps=f.
On Antenna xterm: kstory@bicep0:~/gcp/$ /home/bicep/gcp/bin/bicepAntennaControl host=localhost antenna=0 dataport=1500 cmdport=1600 simpmac=t simdata=t simgps=t sim1pps=t logd=/home/bicep0/kstory/gcp/runlogs logf=bicepTestAntennaControl debuglevel=0 03-NOV-2008 18:08:38.812: In void gcp::util::LogFile::open(): Opened logfile: /home/bicep0/kstory/gcp/runlogs/bicepTestAntennaControl38 on Mon Nov 3 10:08:38 2008 (obviously something is running, but nothing is printing out) On another terminal: kstory@bicep0:~/gcp/$ /home/bicep0/kstory/gcp/misc/scripts/common/killAll bicepAntenna killing 7380 killing On Antenna xterm: kstory@bicep0:~/gcp/$ /home/bicep/gcp/bin/bicepAntennaControl host=localhost antenna=0 dataport=1500 cmdport=1600 simpmac=t simdata=t simgps=f sim1pps=t logd=/home/bicep0/kstory/gcp/runlogs logf=bicepTestAntennaControl debuglevel=0 03-NOV-2008 18:10:09.898: In void gcp::util::LogFile::open(): Opened logfile: /home/bicep0/kstory/gcp/runlogs/bicepTestAntennaControl39 on Mon Nov 3 10:10:09 2008 Caught exception: In void gcp::antenna::control::Tfp::open(): In void gcp::antenna::control::Tfp::open(): In open(): No such file or directory.
I put print statements in all of the main() programs in the entire gcp. However, when I run the Antenna control code, none of them print out. I really don't understand what code is being run the!!
Search for simgps. Only found in two files that I already have print statements for.
New thought; what I am compiling is not actually showing up in the binary directory.
Rename lib/libGcpAntennaControlSpecific.so to mylibGcpAntennaControlSpecific.so.
Run:
Kills Mediator level, Antenna is still the same.
Mediator Requires:
libGcpAntennaControlSpecific.so
libGcpControlCommon.so
libGcpControlSpecific.so
libGcpGrabberCommon.so
libGcpMediatorSpecific.so
libGcpMonitor.so
libGcpMonitor.so
libGcpProgramCommon.so
libGcpUtilCommon.so
etc.
Antenna Does NOT require:
libGcpAntennaControlSpecific.so
libGcpControlCommon.so
libGcpControlSpecific.so
libGcpGrabberCommon.so
libGcpMediatorSpecific.so
libGcpMonitor.so
libGcpMonitor.so
libGcpProgramCommon.so
libGcpUtilCommon.so
Thus I am convinced that the binary /home/bicep/gcp/bim/bicepAntennaControl is not running any of the code that is in my directories. Where is the code I am compiling going?
11/4
Code Mystery Solved!!
I was running the antenna code from /home/bicep/gcp/, when to run my version I need /home/bicep0/kstory/gcp.
It works!!
Now figure out where the code is resting, and try to find out why the data simulation is not working.
Current Antenna code does the following:
In Program::initialize() program name = bicepAntennaControl Leave Program::initialize() In Program::run(), after initialize(), returnValue = 0 In Program::run() after initialize(), return 0 In try this->main() In Antenna::main() in Antenna::main(), after sigfillset() and pthread_sigmask(). in Antenna::main(), about to initialize AntennaMaster. in Antenna::main(), in try. 04-NOV-2008 22:53:05.413: In void gcp::util::LogFile::open(): Opened logfile: /home/bicep0/kstory/gcp/runlogs/bicepTestAntennaControl54 on Tue Nov 4 14:53:05 2008 In Antenna::main(), about to create AntennaMaster. In AntennaMaster::constructor. In AntennaMaster::constructor, about to initialize AntennaControl thread. In AntennaMaster::constructor, about to initialize AntennaRx thread. In AntennaMaster::constructor, about to initialize thread. In AntennaMaster::constructor, about to initialize AntennaMonitor thread. In AntennaMaster::constructor, about to initialize AntennaSignal thread. In AntennaMaster::constructor, done with threads. In Tfp constructor, simulate = 1 In AntennaMaster::constructor, about to installSignals(). In AntennaMaster::constructor, about to installTimers(). In AntennaMaster::constructor, about to startThreads(). In AntennaMaster::THREAD_START(startAntennaControl()) In AntennaMaster::THREAD_START(startAntennaRx()) In AntennaMaster::THREAD_START(startAntennaRx()), call parent->getThread(AntennaRx) In AntennaMaster::THREAD_START(startAntennaRx()), define parent->rxTask_
For tomorrow, keep working...
11/5
Working through Antenna running process.
Function startThreads():
Defined in GenericTask. Calls the run() method of all Threads managed by this task, which calls pthread_create() for each thread.
AntennaRx threads:
To see which threads we are instantiating, need to understand Antennamaster private field prio.
Called with Program::getbParameter("prio").
Calls Program::getParameter("prio").
int i = findKey("prio") // returns index for keyname "prio". Here, "prio" = t.
return keys_[i].val
keys_ of type Keyword.
KeyWord:
Program object has struct keyword
field keys_
string key, val, help
int count // reference count
int upd // 0=read, 1=unread original 2=unread updated
int system // system key word, 0=no, 1=yes
This gets instantiated in bin_AntennaControl.cc, or anywhere where there is a main function.
Once I turn off priority, the antenna actually looks like it is running something!!!
For tomorrow, keep working through details of how Antenna runs, starting with AntennaMaster constructor.
Thread Basics
pthread tutorial
Thread operations: creation, termination, synchronization, scheduling, data management, process installation.
A thread does not know who created it or who it has created.
Thread has:
- Thread ID
- set of registers, stack pointer
- stack for local variables, return addresses
- signal mask
- priority
- return value: errno
Thread Creation
created with pthread_create(pthread_t * thread, const pthread_attr_t * attr, void * (start_routine)(void ), void arg);
- thread: returns the thread id.
- attr: set to NULL if default thread attributes are used.
- void (*start_routine): pointer to the function to be threaded. Function has a single argument: pointer to void.
- \*arg: pointer to argument of function.
Thread Synchronization
mutexes: Mutual exclusion lock: Block access to variables by other theads. This enforces exclusive access by a thread to a variable or set of variables.
join: Make a thread wait till others are complete (terminated).
condition variables: data type pthread_cond_t
Thread Scheduling
When this option is enabled, each thread may have its own scheduling properties.
11/7
DataBase.cc has a simulation constructor that is not being called currently.
Working through Antenna code; I will type up my findings next week.
11/10
Working through Antenna code.
I know that the GpsTimer simulate mode is working.
Overview of the Initialization of the AntennaControl
kstory@bicep0:~/gcp/$ /home/bicep0/kstory/gcp/bin/bicepAntennaControl host=localhost antenna=0 dataport=1500 cmdport=1600 simpmac=t simdata=t simgps=t sim1pps=t logd=/home/bicep0/kstory/gcp/runlogs logf=bicepTestAntennaControl debuglevel=0 pr io=f In Program::main(antenna=0) In Program::run(13) In Program::initialize() program name = bicepAntennaControl Leave Program::initialize() In Program::run(), after initialize(), returnValue = 0 In Program::run() after initialize(), return 0 In try this->main() In Antenna::main() in Antenna::main(), after sigfillset() and pthread_sigmask(). in Antenna::main(), about to initialize AntennaMaster. in Antenna::main(), in try. 10-NOV-2008 20:17:39.034: In void gcp::util::LogFile::open(): Opened logfile: /home/bicep0/kstory/gcp/runlogs/bicepTestAn tennaControl78 on Mon Nov 10 12:17:39 2008 In Antenna::main(), about to create AntennaMaster. In AntennaMaster::constructor. In AntennaMaster::constructor, about to initialize AntennaControl thread. In AntennaMaster::constructor, about to initialize AntennaRx thread. In AntennaMaster::constructor, about to initialize AntennaDrive thread. In AntennaMaster::constructor, about to initialize AntennaMonitor thread. In AntennaMaster::constructor, about to initialize AntennaSignal thread. In AntennaMaster::constructor, done with threads. In AntennaMaster::constructor, about to initialize share_. In Tfp constructor, simulate = 1 In AntennaMaster::constructor, about to installSignals(). In AntennaMaster::constructor, about to installTimers(). In AntennaMaster::constructor, about to startThreads(). In AntennaMaster::THREAD_START(startAntennaControl()) In AntennaControl::constructor() In AntennaControl::constructor(), About to call startThreads(). Leaving AntennaControl::constructor() ... In AntennaControl::serviceMsgQ(). In AntennaMaster::THREAD_START(startAntennaRx) In AntennaMaster::THREAD_START(startAntennaRx), call parent->getThread(AntennaRx) In AntennaMaster::THREAD_START(startAntennaRx), define parent->rxTask_ In AntennaRx::constructor. In AntennaRx::constructor, calling parent_->prio(), start Data thread. In AntennaRx::constructor, parent_->prio() == false. In AntennaRx::constructor, start Command thread. In AntennaRx::constructor, call startThreads(). In THREAD_START(AntennaRx::startData) In THREAD_START(AntennaRx::startData), call rx->getThread(Data). In THREAD_START(AntennaRx::startData), instantiate DataNew object with DataBase constructor. In DataBase::constructor(). In DataBase::constructor(), simData_ = 1. In DataBase::constructor(), create new NetDataBoard at dataport 1500. In DataBase::constructor(), creating new PmacBoard, simPmac= 1. In DataBase::constructor(), initialize NetDataParse objects. In DataBase::constructor(), add fast registers. Leaving DataBase::constructor(). In DataNew::constructor(), simData_ = 1. In DataNew::constructor(), dumpData = 0. Leaving DataNew::constructor(). In THREAD_START(AntennaRx::startData), let others know data thread is ready. In THREAD_START(AntennaRx::startData), call DataNew::run(). In DataNew::run(), call serviceMsgQ(). In DataNew::serviceMsgQ(). In DataNew::serviceMsgQ(), simData_ = true. In DataNew::serviceMsgQ(), About to drop into while(). In THREAD_START(AntennaRx::startCommand). In THREAD_START(AntennaRx::startCommand), instantiate new CommandTask(). In THREAD_START(AntennaRx::startCommand), broadcastReady(). In THREAD_START(AntennaRx::startCommand), call commandTask_->run(). In CommandTask::serviceMsgQ(). In AntennaMaster::THREAD_START(startAntennaRx), set internal thread pointer pointing to AntennaRx thread. In AntennaMaster::THREAD_START(startAntennaRx), thread->broadcastReady() In CommandTask::serviceMsgQ(), about to drop into while(). In AntennaMaster::THREAD_START(startAntennaRx), call rxTask_->run() In AntennaMaster::THREAD_START(startAntennaDrive). In AntennaMaster::THREAD_START(startAntennaDrive), call AntennaDrive constructor. In AntennaDrive::constructor(). Unsing no prio for AntennaDrive In AntennaDrive::constructor(), create Tracker thread. In AntennaDrive::constructor(), startThreads(). In AntennaDrive::THREAD_START(AntennaDrive::startTracker). About to start tracker Using no prio In Tfp constructor, simulate = 1 In GPSTimer::RUN_RN(Gpstimer::runFn). In GPSTimer::run(), simulatetimer_ = 1. In GpsTimer::runSim(), about to enter while(). In Tracker::privateConstructor(). In Tracker::privateConstructor(), instantiate PmacBoard. In Tracker::privateConstructor(), instantiate TrackerBoard. In Tracker::privateConstructor(), instantiate WeatherMonitor. Leaving QuaMonitor constructor: spawn = 1 Inside connect In Tracker::privateConstructor(), call initialize(). In Tracker::initialize(). In Tracker::initialize, call gps_.registerCallback(). In Tracker::initialize, halt Telescope. Just executed setupForHalt Leaving Tracker::initialize. Leaving Tracker::privateConstructor(). Leaving AntennaDrive::constructor(). In AntennaDrive::THREAD_START(AntennaDrive::startTracker), call trackertask_->run(). In AntennaMaster::THREAD_START(startAntennaMonitor()) Unknown TCP/IP host: "omega0.southpole.usap.gov". In AntennaMonitor::connect(). Attempting to connect to host: localhost on port 5467 AntennaMonitor Successfully connected In AntennaMaster::THREAD_START(startAntennaSignal()) In AntennaMaster::constructor, about to run(). In AntennaMaster::THREAD_START(startAntennaSignal()), About to call signalTask::run(). In SignalTask::run(). In AntennaControl::processMsg() from MsgQ. In AntennaControl::connectControl(), client is: not connected. In AntennaControl::connect(). In AntennaControl::connect(), call client_.connectToServer(antMaster->host(),...). In AntennaControl::connect(), successfully connected to server. In AntennaControl::sendAntennaIdMsg(). Got a collimation command Got a collimation command In DataNew::serviceMsgQ() while, nready = 1. In DataNew::serviceMsgQ() while, iterate over Boxes: fdSet_.isSerInRead(iBox) = [0, 0, 0, 0, 0, 0, 0, 0, 0, ] In GpsTimer::runSim(), in while(), TimeVal = 1226348260 sec. In GpsTimer::callHandlers(). In Tracker::GPS_CALLBACK_FN(Tracker::sendTickMsg). Tracker thinks clock has jumped: diff = 1.22635e+09 In GpsTimer::runSim(), in while(), TimeVal = 1226348261 sec. In GpsTimer::callHandlers(). In Tracker::GPS_CALLBACK_FN(Tracker::sendTickMsg). In GpsTimer::runSim(), in while(), TimeVal = 1226348262 sec. In GpsTimer::callHandlers(). In Tracker::GPS_CALLBACK_FN(Tracker::sendTickMsg). 10-NOV-2008 20:17:42.050: The telescope is halted In AntennaControl::processMsg() from MsgQ. In AntennaControl::processMsg() from MsgQ. In GpsTimer::runSim(), in while(), TimeVal = 1226348263 sec. In GpsTimer::callHandlers(). In Tracker::GPS_CALLBACK_FN(Tracker::sendTickMsg). In GpsTimer::runSim(), in while(), TimeVal = 1226348264 sec. In GpsTimer::callHandlers(). In Tracker::GPS_CALLBACK_FN(Tracker::sendTickMsg). In GpsTimer::runSim(), in while(), TimeVal = 1226348265 sec. In GpsTimer::callHandlers(). In Tracker::GPS_CALLBACK_FN(Tracker::sendTickMsg). Killed kstory@bicep0:~/gcp/$
Start with ./bin/bicepAntennaControl
Program::main() name bicepAntennaControl
Program::getProgram() to initialize Program* object.
calls devault constructor of Program object.
call program->run(argc, argv)
delete calling instance of program after run() is finished (which is indefinitely long.
Program::run(argc, argv)
try{ initialize(); } -> catch error
try{ this->main(); } -> catch error // main() defined in bin_AntennaControl.cc
try {Program:: terminate(); } -> catch error
Program::initialize(void)
call initializeUsage() -> defined in bin_AntennaControl.cc, empty function.
store program name in progName_ field.
deal with program keys:
npkeys_ // # program keys
nskeys_ // # system keys
bin_AntennaControl.cc
Program::main(void)
sigfillset(&allSignals) // standard c++ function in signal.h library, initializes a signal set so that it includes all supported signals.
pthread_sigmask(...)
AntNum antNum
set Id for antNum
open log files
//create new instance of AntennaMaster:
AntennaMaster master(args from keywords)
AntennaMaster
Threads:
- AntennaControl
- AntennaRx
- AntennaDrive
- AntennaMonitor
- AntennaSignal
AntennaMaster::constructor
Create threads for:
- AntennaControl
- AntennaRx
- AntennaDrive
- AntennaMonitor
- AntennaSignal
antNum_ = new AntNum()
initialize BicepShare share_
installSignals() // call sendInstallSignalMsg(...)
installTimers() // see below
startThreads() // calls THREAD_START() function for each thread. See below:
AntennaMaster::installTimers()
install "heartbeat" timer
# if BICEP_DATA // if we ahve a data source, let it drive the dataframe sending
sendInstallTimerMsg("monitor", ANTENNA_MONITOR_SIGNAL,
0, ANTENNA_MONITOR_NSEC,
&sendDataStrobeMsg);
# else
sendInstallTimerMsg("monitor", ANTENNA_MONITOR_SIGNAL,
0, ANTENNA_MONITOR_NSEC,
&sendPackDataFrameMsg);
//sendPackDataFrameMsg is of type SIGNALTASK_HANDLER_FN(* handler), defined in AntennaMaster
// tells AntennaMonitor to send a data frame back to the ACC.
# endif
install "pmac" timer
install "connect" timer
AntennaControl
Threads: none
_THREAD_START(AntennaMaster::startAntennaControl)_
AntennaMaster* ant = (AntennaMaster*) arg;
ant->controlTask_ = new AntennaControl(ant); // see below
controlTask_->thread_ = ant->getThread("AntennaControl");
thread->broadcastReady()
controlTask_->run() // calls ?? which calls AntennaControl::serviceMsgQ()
// stays in MessageQ, waiting for messages from above or below.
AntennaControl::constructor
class derived from BicepTask, GenericTask
forwarder_ = new AntNetCmdForwarder(parent);
startThreads(this); // No threads to start here.
AntennaControl::connect
connect to AntennaMaster
register handlers.
AntennaRx
Threads:
- data
- command
_THREAD_START(AntennaMaster::startAntennaRx)_
parent is type AntennaMaster*.
thread = parent->getThread("AntennaRx");
parent->rxTask_ = new AntennaRx(parent); // instantiate new AntennaRx object. See below.
rxTask_->thread_ - thread; // set internal pointer pointing to Rx thread.
thread->broadcastReady();
rxTask_->run(); // calls ??
AntennaRx::constructor
instantiate threads:
- data // call different constructors depending on whether or not we have priority.
- command
startThreads(this); // calls THREAD_START(AntennaRx::type).
_THREAD_START(AntennaRx::startData)_ in AntennaRx.cc
Thread* thread = rx->getThread("Data") // get thread object which will manage this thread.
have field DataBase* dataTask_
rx->dataTask_ = new DataNew(rx) // calls DataBase constructor
dataTask_->thread_ = thread; // set internal thread
thread->broadcastReady()
dataTask_->run() // calls DataNew::run(), which calls DataNew::serviceMsgQ().
_THREAD_START(AntennaRx::startCommand)_ in AntennaRx.cc
rx->commandTask_ = new CommandTask(rx) // see below
rx->commandTask_->thread_ = rx->getThread("Command");
thread->broadcastReady();
commandTask_->run(); // calls ?? which ends up at CommandTask::serviceMsgQ
DataNew
Fields:
- TimeVal timeOut_
- FdSet fdSet_
- std::ofstream* fout_
Methods:
- run() -> calls serviceMsgQ()
- serviceMsgQ()
DataNew::constructor : DataBase(parent)
This first calls the DataBase constructor.
if !simData_
fdSet_.registerReadFd( data_->fd(i) ); where (i) is the box number up to NBOX
DataNew::run()
call serviceMsgQ()
DataNew::serviceMsgQ()
Wait for data to arrive
Once a message has arrived:
- processTaskMsg
- Loop over boxes:
> read box with NetDataBoard::read(unsigned iBox)
deal with time stuff
- update seq number if necessary
- update time and calculate dTime between current and time last packet arrived
case: data is in current set i.e. seq==currSeq
- note that the box data for that sequence number has arrived, and keep waiting for all boxes
- if all boxes have arrived, call incrimentSampleCount() to buffer the data
case new sequence number i.e. seq > currSeq
if dCurrSeq != 1, log a message. If dCurrSeq > seqJumpThreshold, do not read new data
Usually, dCurrSeq == 1.
Calculate change in seq number and time between most recent packets.
bufferTimeData(iSamp, )
bufferPmacData(iSamp)
Wait for more data to arrive.
DataBase
Fields:
- NetDataBoard data_
- PmacBoard pmac_
- ThermalControl thermalControl_
- NetDataParse bolo_, fridge_, rot_, dewar_, timep_, datasys_, aux_, level_, cal_
- vector
Methods:
- addFastPmacRegs()
- writeBoxData(), writePmacData(), writeTimeData(), writeData()
- bufferBoxData(), bufferPmacData(), bufferTimeData(), bufferData()
- run() -> virtual, does nothing.
DataBase::constructor
data_ = new NetDataBoard(parent_->dataport_, NBOX);
pmac_ = new PmacBoard(share_, "pmac", parent_->simPmac());
initParsers(); // initialize NetDataParse() for:
bolo, fridge, rotator, time, datasystem, dewar, auxiliary, level, cal
addFastPmacRegs(); // add pmac registers we want to monitor at the fast rate:
az_pos, el_pos, dk_pos, mtr_pos, mtr_com_pos, mtr_mean_err, mtr_vel, mtr_com_vel, mtr_com_i, aux_input, new_position.
NetDataBoard : class for reading/writing data and messages to and from BICEP's UDP-based data acquisition system.
NetDataBoard::constructor(int port, int n)
init(port, n);
for(i < nBox)
socket[i].configure(port+i); // sockets are UDPSocket[] objects.
NetDataParse :
Fields:
- float* cosine, sine, quadsum, cAvg, sAvg, phase, voltage, current, frequency, etc.
- RegMapBlock* received_, cosine_, sine_, quandsum_, phase_, sequence_, etc.
Methods:
- fake_bolo_sample()
- init_bolo_registers()
- read_bolo_sample()
- pack_bolo_frame()
- [init, read, pack] bolo, fridge, rotator, time, datasys, auxiliary, dewar, level, cal
_NetDataParse::read_bolo_sample(unsigned nsample, NetDataBoard* data, unsigned rcvd, double* thermalcontrolVals)_
char* word1=data->box[BOLO_BIAS_OFFSET].sdata[BOLO_BIAS_CHAN_SEND]
int freq = word11;
for(bindex) //box index
for(cindex) // channel index
data->words2components2( data->box[bindex+BOLO_DATA_SET].sdata[cindex], &s, &c, VMAX );
index=bindex*NCHAN + cindex;
cosine[...] =
sine[...]=
sAvg[], cAvg[], quadsum[], thermalControlVals[], phase[]
[Aside] Simulate Data
_fake_bolo_sample(nsample, NetDataBoard* data, rcvd, double* thermalControlVals)_
for(bindex) // box index
for(cindex) // channel index
index=bindex*NCHAN + cindex;
c = 10.*cos(2*M_PI*(double)(count)/(100 + index)) + index;
s = 10.*sin(2*M_PI*(double)(count)/(100 + index)) + index;
fill in everything else based on index number.
CommandTask Still in AntennaRx, looking at command thread.
Fields: AntennaRx* parent_, NetDataBoard cmdBrd_
Method: serviceMsgQ().
CommandTask::constructor
create instances of:
- PeriodicHeLevelCommand
- ContinuousHeLevelCommand
- AutoResetCommand
- FridgeCommand
simData_ = parent->simData().
AntennaDrive
Threads:
- Tracker
AntennaDrive::constructor
instantiate Tracker thread, depending on whether or not we have thread prioritization.
startThreads() -> start Tracker.
_THREAD_START(AntennaDrive::startTracker)_
Thread* thread = drive->getThread("Tracker") // get thread object which will manage this thread.
drive->trackertask_ = new Tracker() // which constructor depends on prio
trackertask_->thread_ = thread; // set internal thread
thread->broadcastReady()
trackertaskask_->run() // calls ??
Tracker
Fields:
- CameraBoard* camera_
- PmacBoard* pmac_
- TrackerBoard* tracker_
- Scan scan_
- GpsTimer gps_
- WeatherMonitor* wx_
Methods:
- serviceMsgQ() // defined only if we have areal GPSTracker
- Many Pmac control commands.
Tracker::constructor
instantiate GpsTimer gps_
create instances of:
- PmacBoard
- TrackerBoard
- Weathermonitor
initialize()
Tracker::initialize
pmac_->connect();
gps_.registerCallback()
haltTelescope(NULL)
_GPS_CALLBACK_FN(Tracker::sendTickMsg)_
TrackerMsg msg
msg.packTickMsg()
tracker->sendTaskmsg(&msg)
CameraBoard derrived class of Board
Fields: RegMapBlock* angle_
Methods: recordAngle()
CameraBoard::constructr
instantiate Board(share, name)
angle_ = findReg("angle"); // calls writeReg(angle_,0,1,value)
Board
Fields:
- BicepShare* share_
- RegMapBoard* board_
Methods:
- RegMapBlock* findReg(char* name)
- readReg()
- writeReg()
Board::constructor
board_ = share_->findRegMapBoard(name)
Board::findReg(name)
RebMapBlock8 block = find_RegMapBoard_Block()
return block
Board::readReg()
share_->readReg()
Board::writeReg()
share_->writeReg()
PmacBoard
Fields:
- PmacComms* comms_
- RegMapBlock* hostRead_, pmacWrite_, newPosition_, positionFault_, newMode_, scanMode_, newAz_, newAl_, newDk_, newAcRate_, newElRate_, azPos_, elPos_, dkPos_, driveStatus_, statusMask_
Methods:
- readReg()
- writeReg()
- connect() // connect to the pmac
- computeDparmStats() // determine size of used portion of the DPRAM
PmacBoard::constructor
set all variables to 0
use findReg() to look up relevant registers
computeDpramStats()
if(!simPmac-) comms_ = new PmaccommsPci
share_->writeReg(newPosition)
share_->writeReg(hostRead)
PmacBoard::readReg()
if(!simPmac_) comms_->readReg(...)
PmacBoard::writeReg()
if(!simPmac_) comms_->writeReg(...)
PmacBoard::connect()
if(simPmac_)
return true
bool connected = comms_->connect()
TrackerBoard
Fields:
- RegMapBlock* lacking_, utc_, 1st_, ut1utc_, eqneqx_, mode_, deck_mode_, refraction_, encoder_off_, encoder_mul_, az_limits_, el_limits_, dk_limits_, tilts_, flexure_, axis_, fixedCollimation_,
polarCollimation_, siteActual_, siteFiducial_, location_, source_, scanState_, scanName_, scanOff_, scanInd_, scanRep_, equat_geoc_, equat_off_, horiz_geoc_, horiz_topo_, horiz_mount_,
horiz_off_, sky_xy_off_, counts_, rates_, actual_, expected_, errors_, state_, stateMask_, off_source_
Methods:
- packLst()
- packUt1Utc()
- packEqnEqx()
- archivePointing()
- archiveStatus()
TrackerBoard::constructor
set all variables to 0
use findReg() to look up relevant registers
GpsTimer
Fields:
- Tfp gps_ // the Gps card itself
Methods:
- RUN_FN() // calls run()
- run()
- runReal()
- runSim()
- runTest()
- getDate()
GpsTimer::constructor
instantiate gcp::util::Runnable() object
instantiate Tfp gps_(simulateGpsCard)
set simulateTimer_
set simulateGpsCard_
GpsTimer::run()
if(simulateTimer_)
runSim();
else runReal();
GpsTimer::runSim()
Sit in while(true).
Every 1 sec, call
gps_.getDate(lastTick_)
callHandlers()
Gpstimer::getDate()
GpsTimer::runReal()
open() // open device
sit in select(), watching for the file descriptor to become readable
When it does, get the date.
When told to stop, close connection with Gps.
Tfp
Fields:
Methods:
- getDate()
Tfp::getDate()
if(simulate_)
tVal.settoCurrentTime()
return;
else
readUnixTime(TimeVal)
WeatherMonitor derrived class of QuadMonitor
Fields:
- Tracker* parent_
- BicepShare* share_
- TipperClient* tipper_
- airTemp_, pressure_, humidity_, windSpeed_, windDir_, utc_,
- RegMapBlock* airTempBlock_, pressureBlock_, humidityBlock_, windSpeedblock_, windDirBlock_, utcBlock_
Methods:
- readdoneAction()
- sendWeatherUpdate()
WeatherMonitor::constructor
call QuadMonitor(spawnThread, "omega0.southpole.usap.gov", "/dev/null") constructor
set all registers to 0
selections_.push_back(gcp::quad::MonitorSelection("weather", "regName", selections_.size()))
do this for all registers
use findReg() to look up relevant registers.
instantiate TipperClient
WeatherMonitor::sendWeatherUpdate()
if we have passed the updateInterval_,
TrackerMsg msg;
msg.packWeatherMsg(...)
parent_->forwardTrackerMsg(&msg)
QuadMonitor location: gcp/util/common/QuadMonitor.h
Fields:
- vector
- vector
- gcp::quad::MonitorStream* ms_
Methods:
- RUN_FN()
- run()
- readRegs()
- connect()
- gcp::quad::MsReadState readNextFrame()
QuadMonitor::constructor
call gcp::util::Runnable(spawnThread, runFn)
call privateConstructor()
setMonitoringInterval(1)
tioeOut_.setSeconds(0)
MonitorSelection in control/code/unix/libquad_src/monitor_stream.h
This is a struct in this file
Fields:
- int id // index of this MonitorSelection in its parent array
- string board_name
- string block_name
- unsigned regIndex // first element of the register to select
- unsigned nreg // number of elements to select
and others
TipperClient
Fields:
- TipperData tipperData_
- vector
- BicepShare share_
- RegMapBlock* utcBlock_, tauBlock_, tAtmBlock_
Methods:
- readServerData(NetHandler&)
TipperClient::constructor
call gcp::util::TipperClient::constructor
call Client(spawnThread, host, TIPPER_SERVER_PORT) constructor
setReadBufSize()
setSendbufSize()
use findReg() to look up relevant regs.
TipperClient::readServerData(NetHandler& handler)
handler.getReadStr()->getChar()
handler.getReadStr()->endGet()
tipperData_.deserialize(bytes_)
share->write()
AntennaMonitor
Threads: none
Fields:
- Scanner* scanner_
- AntennaMaster* parent_
- FrameSender* sender_
- string host_ // IP address of the control host
- TcpClient client_ // object to manage connection to the control program
- NetHandler netDataFrameHandler_ // TCP network handler for sending data frames
- NetMsgHandler netMsgHandler_ // network stream handler for sending a greeting to the archiver program
Methods:
- connect(), disconnect() // connect to control host
- connectScanner()
- serviceMsgQ()
- packNextFrame()
- packFrame()
- NET_READ_HANDLER(), NET_SEND_HANDLER()
_THREAD_START(AntennaMaster::startAntennaMonitor)_
Thread* thread = ant->getThread("AntennaMonitor")
ant->monitorTask_ = new AntennaMonitor(ant)
monitorTask_->thread_ = thread;
thread->broadcastReady()
ant->monitorTask_->run(); // calls ??
AntennaMonitor::constructor
call BicepTask() generic constructor
call GenericTask() generic constructor
share_ = parent_->getShare()
scanner_ = new Scanner(share_, parent_->getAnt())
connectScanner(true)
AntennaMonitor::connectScanner()
call connect()
sendScannerconnectedMsg() to report result.
AntennaMonitor::connect()
client_.connectToServer(parent_->host(), TRANS_ANT_SCANNER_PORT, true) // connect to control program
netMsgHandler_.attach(client_.getFd()) // Attach send stream of the msg handler to the new client socket.
netMsgHandler_.installSendHandler() // install handler to be called when msg is sent
netMsgHandler_.installReadHandler() // install handler to be called when msg is read
netMsgHandler_.installErrorHandler()// install handler to be called when error occurs
fdSet_.registerReadFd(client_.getFd()) // Register the socket to be watched for input
sendAntennaIdMsg() // send greeting message to controller.
AntennaMonitor::serviceMsgQ()
fdSet_.registerReadFd()
while(!stop)
nready=select() // deal with messages depending on their type
if(fdSet_.isSetInRead(msgqFd))
processTaskMsg()
if(isSetInWrite(netDataFrameHandler )
netDataFrameHandler_.send()
if(isSetInWrite(netMsgHandler )
netMsgHandler_.send()
if(isSetInRead(netMsgHandler )
netMsgHandler_.read()
Scanner
Fields:
- BicepShare* share_
- AntennaFrameBuffer fb_
- FrameBoard* frame_
- struct Features // manage details of feature bits received from control program
- struct Walsh // store current bit mask of receiver walsh states
Methods:
- packNextFrame()
- dispatchNextFrame()
- listBoards()
Scanner::constructor
set fb_(ant), share_(share)
frame_ = new FrameBoard(share, "frame")
call initialize()
features_.reset()
recordWalshState()
Scanner::packNextFrame()
setTime()
recordRecordNumber()
recordTime()
recordFeatures()
recordWalshState()
share_->packFrame(fb_.getNextFrame())
FrameBoard
A class that encapsulates details of the frame software board.
Fields:
- RegMapBlock* nsnap_, record_, utc_, lst_, features_, markSeq_, walshstate_
Methods:
- setTime(),
- archiveTime(), archiveFeatures(), archiveWalshState(), archiveNsnap()
AntennaFrameBuffer derrived class of FrameBuffer
Fields:
- struct FrameBufferSlot{
unsigned int id_
DataFrameManager* frame_
struct FrameBufferSlot* next_ }
- vector
- Mutex guard_
- std::map
Methods:
- getFrame()
- getNextFrame()
- dispatchNextFrame()
- findSlot()
- getNextSlot()
- clearSlot()
AntennaSignal
Threads:
Fields:
Methods:
_THREAD_START(AntennaMaster::startAntennaSignal)_
Thread* thread = ant->getThread("AntennaSignal")
ant->signal_ = new gcp::util::SignalTask()
thread->broadcastReady()
ant->signal_->run(); // calls ??
gcp::util::SignalTask
Classes:
- TimerInfo
- Signalhandler
Fields:
- struct HandlerPair
- vector
-
Methods:
- sendInstallTimerMsg()
- sendAddHandlerMsg()
- sendenabletimerMsg()
- stopTimers()
- getIosig()
- run()
- serviceMsgQ()
SignalTask::constructor
id_ = pthread_self()
sigIo_ = SIGNALTASK_IO_SIGNAL
installSignal(sigIo_, &checkMsgQ)
For after lunch
1) Figure out why I can't type into bicepViewer
2) Plug KyleWave into Tracker.
3) Where is Data coming from??
For Tomorrow
- Start with THREAD_START(AntennaRx::startCommand) and work forward.
- look for where simulate mode could be put into the NewData stuff. Idea is somewhere in the NetDataBoard.
- look for Pmac simulate stuff, starting with PmacBoard constructor.
11/11
Continue above.
How Things Simulate:
GpsTimer: gets current time from localhost.
Pmac: does not connect, does not read or write anything.
Data: ????(#$*(&^#?
SOMETHING SIMULATE IS WORKING!!!!!
I got bolometer cosine data (simulated, obviously) to show up on a viewer page!!!
11/12
Continue within 11/10.
11/13
Bicep viewer is not working; I cannot type into the browser.
Try using 8.08_gcp -> does not work either.
Try checking out a completely new version of the gcp:
It compiles.
Everything runs, but I still can't type into the Viewer.
Hypothesis; it is too slow coming from caltech. But then why could I type into it before?
Create new KyleWave2 board
Model after TrackerBoard.
Ease; Only added two files.
Plug into Tracker.
Time to break stuff...
11/14
Now no numbers from bolo.
Try re-running 11.12_gcp -> ok.
Go back to current version and remove anything that calls KyleWave. -> segfault in addTick().
Remove calls to KyleWave -> no more segfault, bolo numbers show up again.
Try again.
Follow example of TrackerBoard.
Looking at 3 RegMapBlocks, lst_, eqneqx_, and scanState_
It seems that lst_ and eqneqx_ are not being updated.
Try to match scanState_.
Seg faulting. Compiled, and it didn't work. make clean all -> fail;
Can't find libGcpUtilCommon
Try checking out new file and compiling.
This is also failing.
Try adding back in Makefile.rules that they were telling me to delete before.
Remove the MakeFile.rules, and the freshly copied version compiles. Good.
Now my 11.14_gcp compiles. ??
Try running.
Same Segmentation fault.
Try 'make clean all'
Compiling library: /export/home/bicep0/kstory/gcp/lib/libGcpControlCommon.so g++ -shared -o /export/home/bicep0/kstory/gcp/lib/libGcpControlCommon.so archiver.o ArchiverWriterDirfile.o ArchiverWriterFrame.o controlscript.o fitsio.o genericcontrol.o genericscheduler.o genericscript.o generictypes.o grabber.o InitScript.o logger.o navigator.o NewNetCmd.o NewNetMsg.o NewRtcNetMsg.o pipe.o terminal.o TransactionStatus.o make[5]: Leaving directory `/export/home/bicep0/kstory/gcp/control/code/unix/control_src/common' g++ -o /export/home/bicep0/kstory/gcp/bin/bicepControl genericcontrol.o -L /export/home/bicep0/kstory/gcp/lib -L /export/home/bicep0/kstory/gcp/control/code/unix/lib -Xlinker -R -Xlinker /export/home/bicep0/kstory/gcp/lib -Xlinker -R -Xlinker /export/home/bicep0/kstory/gcp/control/code/unix/lib \ -lGcpControlCommon -lGcpControlSpecific -lGcpProgramCommon \ -lGcpShareCommon -lGcpShareSpecific \ -lGcpUtilCommon -lGcpUtilSpecific \ -lGcpScript -lGcpSla -lGcpSrc -lGcpScan -lGcpMonitor \ -lGcpTransaction -lGcpQuadSrc \ -lrt -lreadline -ltermcap -lpthread -lnsl -lm /usr/lib64/gcc/x86_64-suse-linux/4.0.2/../../../../x86_64-suse-linux/bin/ld: cannot find -lGcpUtilCommon collect2: ld returned 1 exit status make[4]: *** [/export/home/bicep0/kstory/gcp/bin/bicepControl] Error 1 make[4]: Leaving directory `/export/home/bicep0/kstory/gcp/control/code/unix/control_src/common' make[3]: *** [make_control] Error 2 make[3]: Leaving directory `/export/home/bicep0/kstory/gcp/control/code/unix' make[2]: *** [bins] Error 2 make[2]: Leaving directory `/export/home/bicep0/kstory/gcp/control/code' make[1]: *** [bins] Error 2 make[1]: Leaving directory `/export/home/bicep0/kstory/gcp/control' make: *** [make_control] Error 2
Check out new version and compile with make clean all:
cvs -d bicep0.caltech.edu:/home/bicep0/cvsroot checkout -r working14Feb gcp kstory@bicep0:~$ cd gcp/control/code/unix/libscan_src/ kstory@bicep0:libscan_src$ mv Makefile.rules BKMakefile_rules kstory@bicep0:libscan_src$ cd kstory@bicep0:~$ cd gcp/ kstory@bicep0:gcp$ make clean all ... make[2]: *** [clean_depend] Error 2 make[1]: *** [clean_code] Error 2 make: *** [make_control] Error 2 kstory@bicep0:gcp$ make /usr/lib64/gcc/x86_64-suse-linux/4.0.2/../../../../x86_64-suse-linux/bin/ld: cannot find -lGcpUtilCommon collect2: ld returned 1 exit status make[4]: *** [/export/home/bicep0/kstory/gcp/bin/bicepControl] Error 1 make[4]: Leaving directory `/export/home/bicep0/kstory/gcp/control/code/unix/control_src/common' make[3]: *** [make_control] Error 2 make[3]: Leaving directory `/export/home/bicep0/kstory/gcp/control/code/unix' make[2]: *** [bins] Error 2 make[2]: Leaving directory `/export/home/bicep0/kstory/gcp/control/code' make[1]: *** [bins] Error 2 make[1]: Leaving directory `/export/home/bicep0/kstory/gcp/control' make: *** [make_control] Error 2
GCP compiling error 11.14
makeErrors11-14.html11/17
Looking for compiler errors.
Erik Leitch emailed back:
Kyle -- The makefiles are set up to keep going even if errors occur, so you might not see the initial error that's preventing GcpUtilCommon to compile if you just let all the output blitz past you. Capture and look at the output, or do 'make |& less' (tcsh) and watch for the first error.
readline error on bicep0
Found error:
In gcp/util/common/pmacterm.cc,
change to:
Files containing readline:
gcp/control/code/unix/misc_src/command_interp.c : L14
gcp/control/code/unix/misc_src/pmacterm.c : L20
gcp/util/common/Control.cc : L3
gcp/util/common/pmacterm.cc : L20
11/19
KyleWave2 is working!!!
I have successfully added a board to the gcp called KyleWave2, which prints out a triangle wave with values from 0-10, which update every second along with the Tracker register information.
Questions:
Antenna0: keeps trying to connect to bicep3.
This is in the line
antenna/control/bicep/bin_AntennaControl.cc:25: { "tipperhost", "bicep3", "s", "Tipper host"},
I still cannot type into the Viewer
Next:
- How to type into the Viewer -> ?? Try on laptop.
- Get it compiling on find. -> Done
- Subversion
11/20
Check out gcp code to find.uchicago
Check out the code
kstory@find:~/$ cvs -d bicep0.caltech.edu:/home/bicep0/cvsroot checkout -r working14Feb gcp
remove gcp/control/code/unix/libscan_src/Makefile.rules:
kstory@find:~/gcp/$ mv control/code/unix/libscan_src/Makefile.rules control/code/unix/libscan_src/BadMakefile_rules
make -> ok.
Now run: -> ok.
Still can't type into BicepViewer. ??
The problem is not the readline stuff.
Idea: try on my laptop at home.
Subversion:
11/21
Clem changed my desktop environment to Fluxbox. Grr!!
edit things in .fluxbox/init
Set up .tcshrc file.
http://www.over-yonder.net/~fullermd/projects/tcshrc/
change xterm to have white background:
http://mail.afterstep.org/pipermail/as-users/2003-November/001142.html
I want all open things to show up on the tool bar, not just when I minimize them.
right-click on tool bar:
Iconbar mode -> Workspace
I want 'tab tab' to show a list of possibilities.
add to .tcshrc:
set autolist = ambiguous
syntax highlighting of shell script:
Need to include the following at the beginning of the .tcshrc.local file:
I want to enable ctrl-alt left (right) to switch windows.
edit .fluxbox/keys
add:
Control Mod1 Left :PrevWorkspace
Control Mod1 Right :NextWorkspace
http://www.math.colostate.edu/~reinholz/freebsd/fluxconfig.html
Wow, Leo updated my fluxbox version, and everything broke. I couldn't even log in!
Here we go again...
Fluxbox
clock:
right click,
choose 12h
toolbar:
right click
bottom left, width = 90%
Iconbar Mode -> Workspace = > places all current items on the bar.
menu: open .fluxbox/menu
In
[submenu] (Window)
add
[restart] (kde) {startkde}
Add the following in [begin] (Fluxbox) and [submenu] (Terminals):
[exec] (gnome-terminal) {gnome-terminal}
.fluxbox/init
number of windows:
session.screen0.workspaces: 6
background:
session.screen1.rootCommand: fbsetbg -f /home/kstory/pictures/wallpaper.JPG
fonts:
session.screen1.toolbar.font: misc-12:bold
This doesn't seem to be working.
.fluxbox/keys
add:
Control Mod1 Left :PrevWorkspace
Control Mod1 Right :NextWorkspace
.fluxbox/overlay
menu.title.font: sans-16:bold
menu.frame.font: sans-14
toolbar.clock.font: sans-16:bold
toolbar.workspace.font: sans-16:bold
.font: sans-16
Problems:
- Toolbar and all fonts are tiny.
background:
Must have feh installed.
kstory@spudws2:~> fbsetbg -f personal/MtHooker8-08.JPG
Set this up automatically:
In .fluxbox/startup,
fbsetbg -f /home/kstory/pictures/wallpaper.JPG
Now as long as wallpaper.JPG is defined, this should work.
Nope.
startup is not working.
I tried putting the fbsetbg command in the .tcshrc. this produced the background, but got rid of the title bar and all right-click options.
Try adding Fluxbox to GDM:
http://fluxbox-wiki.org/index.php?title=GDM
create new file ~/.Xsession
add:
exec /usr/bin/startfluxbox
-> changed nothing.
Try creating:
/usr/share/xsessions/fluxbox.desktop
add:
[Desktop Entry]
Encoding=UTF-8
Name=Fluxbox
Comment=Highly configureable low resource X11 Window Manager
Exec=/usr/local/bin/startfluxbox
Terminal=False
TryExec=/usr/local/bin/startfluxbox
Type=Application
Please don't die...
-> changed nothing.
Remove /usr/share/xsessions/fluxbox.desktop
call /usr/local/bin/startfluxbox -> works!!
add this to .tcshrc:
exec /usr/local/bin/startfluxbox
BAD BAD
this made it such that I could not login as kstory anymore.
Errors:
/home/kstory/.fluxbox/startup: line 45: /usr/bin/fluxbox: No such file or directory.
Try this later:
Try editing .fluxbox/startup:
change:
exec /usr/bin/fluxbox
to:
exec /usr/local/bin/fluxbox
Try adding the following to .tcshrc.local
fbsetbg -f /home/kstory/pictures/wallpaper.JPG
-> crashes immediately.
Add to .tcshrc.local:
exec /usr/local/bin/startfluxbox
and change .fluxbox/startup to
exec /usr/local/bin/fluxbox
Close, logs in, tool bar, but can't open terminal.
add:
session.screen1.rootCommand: fbsetbg -f /home/kstory/pictures/wallpaper.JPG
Previously just
session.screen1.rootCommand:
Nope.
Here is what worked:
in .fluxbox/init, add the line session.screen1.rootCommand: fbsetbg -f /home/kstory/pictures/wallpaper.JPG
11/24
Look for calendar later. Time to work now.
To do:
- subversion of gcp on find.
- Make KyleWave2 work on find. -> Done
- Look at Grabber and figure out how to add new GCP board.
Checkout brand new version of gcp onto Find:
kstory@find:~/$ cvs -d bicep0.caltech.edu:/home/bicep0/cvsroot checkout -r working14Feb gcp kstory@find:~/$ mv gcp/control/code/unix/libscan_src/Makefile.rules gcp/control/code/unix/libscan_src/BADMakefile.rules kstory@find:~/$ cd gcp kstory@find:~/gcp/$ make > & compileLog-11.24 kstory@find:~/gcp/$ mkdir runlogs
Run. It is all working:
- I can type into the bicepViewer
- I can plot the bolo->cosine11 which produces a cool star parttern.
- Try to check into subversion. -> no subversion on Find.
- Fix stat page. -> Done.
Create svnRepos on Find for my gcp code.
Create a new subversion directory:
kstory@find:~/$ svnadmin create /home/kstory/svnRepos svnadmin: Command not found. kstory@find:~/$ which svn svn: Command not found. kstory@find:~/$
Grr...
Fix stat page:
kstory@find:~/gcp/$ en control/code/unix/viewer_src/viewer.tcl
comment out line 2396:
# set ::viewer(conf_file) {stat.page} ;# The configuration file.
in viewer.tcl
Edit L:2395
set ::viewer(conf_dir) $::env(GCP_DIR)/conf/bicep ;# The directory containing configuration files.
set ::viewer(conf_file) {viewer_conf.page} ;# The configuration file.
and write a file called viewer_conf.page.
Works.
Make KyleWave2 work on Find.
Here we go...
1) create gcp/antenna/control/bicep/KyleWave2.cc, .h
2) edit gcp/antenna/control/bicep/Makefile.rules
- AntennaDrive -> yes
- AntennaMaster -> yes
- KyleWave2 -> yes
- PmacComms -> no
- PmacCommsPci -> no
- Tracker -> yes
- WeatherMonitor-> yes
3) Add KyleWave2 board to Tracker.h
4) Add read functions to Tracker.cc
a) Instantiate KyleWave2 board in the Tracker::privateConstructor().
b) Add to destructor.
c) call kyleWave2_->recordWaveVal() from Tracker::addTick()
5) Add KyleWave to the registers: gcp/control/code/unix/libunix_src/bicep/specificregs.c
- Add RegBlockTemp bicepKyleWave2[]
- Add the kyleWave2 block to the bicep_antenna_boards[] RegBoardTemp.
Compile. -> Ok.
Run. -> Ok.
How Antenna connects to the Mediator
AntennaMonitor
Fields:
- Scanner* scanner_
- AntennaMaster* parent_
- FrameSender* sender_
- string host_ // IP address of the control host
- TcpClient client_ // object to manage connection to the Mediator.
- NetMsgHandler netMsgHandler_ // network stream handler for sending a greeting to the archiver program.
- NetHandler netDataFrameHandler_ // TCP network handler for sending data frames
From GenericTask:
- Thread* thread_ // pointer to the thread that sponed the AntennaMonitor
- PipeQ
- FdSet fdSet_
- vector
Methods:
- connect(), disconnect() // control host i.e. Mediator.
- connectScanner(), disconnectScanner()
- serviceMsgQ()
- packNextFrame()
- packFrame()
- NET_READ_HANDLER(netMsgReadHandler)
- NET_SEND_HANDLER(netMsgSentHandler)
- NET_SEND_HANDLER(netDataFrameSentHandler)
- packNextFrame() // If there is room in the circular frame buffer, record another data frame and push it onto the event channel.
- dispatchNextFrame() // Send data frame.
- packFrame() // Install the frame buffer as teh network buffer and pre-format the register frame output message.
- sendScannerConnectedMsg() // sent to parent (AntennaMaster)
- sendAntennaIdMst() // Pack a greeting message to be sent to the controller
- pareseGreetingMsg() // from control program
Look at how Antenna layer connects to the Mediator layer and how frames are packed, queued, and sent / received.
AntennaMaster has thread AntennaMonitor which takes care of this stuff.
AntennaMonitor
TcpClient client_ maintains connection to Mediator layer.
serviceMsgQ has 4 message type options:
- fdSet_.isSetInRead(msgqFd) -> processTaskMsg()
- fdSet_.isSetInWrite(netDataFrameHandler_.getSendFd()) -> netDataFrameHandler_.send()
- fdSet_.isSetInWrite(netMessageHandler_.getSendFd()) -> netMessageHandler_.send()
- fdSet_.isSetInRead(netMessageHandler_.getReadFd()) -> netMessageHandler_.read()
send is NetHandler::send()
AntennaMaster::packNextFrame
scanner_->packNextFrame()
sendDispatchDataFrameMsg();
For tomorrow:
- Look at how AntennaMonitor packs frames, starting with scanner::packNextFrame
- How does polling of Antenna (pmac etc) stuff work?
- How does the Mediator maintain a connection to the Antenna layer?
- Look at Grabber.
11/25
Trying to get screensave to run automatically.
1) In .Xsession, add
2) remove from .fluxbox/init:
session.screen0.rootCommand: fbsetbg -f /home/kstory/pictures/wallpaper.JPG
--> nope.
to .fluxbox/startup, add
exec /usr/bin/gnome-screensaver
In .Xsession
change line to
/usr/local/bin/startfluxbox
this works in the command line:
/usr/local/bin/startfluxbox
In .tcshrc.local, Add
exec /usr/local/bin/startfluxbox -> BAD
Change .Xsession to executable -> nothing.
create .xsession and .xinitrc -> BAD
Create .xsession: #!/bin/sh xsetroot -solid steelblue kstory@spudws2:~> chmod 700 .xsession kstory@spudws2:~> ln -s .xsession .xinitrc
Can't log in anymore. Login with root and remove these files.
Change permissions on my home file:
cd /home chmod g+rx kstory/ chmod a+x kstory
put .xsession back in. -> BAD
I give up. Just run command
gnome-screensaver
from a terminal every time I log in.
Check out new copy of gcp onto spudws2:
1) checkout 2) move Makefile.rules 3) mkdir runlogs 4) compile -> failure Copy over pgplot directory from find compile -> ok.
Fix stat page:
Edit /gcp/control/code/unix/viewer_src/viewer.tcl
set ::viewer(conf_dir) $::env(GCP_DIR)/conf/bicep
set ::viewer(conf_file) {viewer_conf.page}
and write viewer_conf.page file.
Run: Fix mysimpleStartup, myclose, viewer_conf.page. -> OK.
AntennaMonitor packing frames
AntennaMonitor::packNextFrame()
calls scanner_->packNextFrame()
Scanner::packNextFrame()
setTime() // Set the current time in the database.
recordRecordNumber(recordNumber_ + 1); // incrimented whenever a frame is recorded.
recordTime()
recordFeatures()
recordWalshState() // empty ??
share_->packFrame(fb_.getNextFrame()) // copy the shared-memory object into the next frame in the frame buffer
features_.transient_ = 0; // clear the transient feature mask.
Scanner::setTime() -> frame_->setTime(); -> share_->setClock()
BicepShare::setTime(void)
LogStream ls;
INSTALL_MUTEX_CLEANUP(guard_, ls); // pthread_mutex_t guard_
if(pthread_mutex_lock(&guard_) != 0)
// log error
time_.setToCurrentTime(); // gcp::util::TimeVal time_
if(pthread_mutex_unlock(&guard_) != 0)
UNINSTALL_MUTEX_CLEANUP(ls);
Scanner::recordRecordNumber(unsigned record)
frame_->archiveRecordNumber(record); -> writeReg(redord_,0,1,&record);
recordNumber_ = record;
Scanner::recordTime() -> frame_->archiveTime()
FrameBoard::archiveTime()
double mjd = share->getUtc(); -> time_.getTimeInMjdDays()
gcp::util::RegDate date(utc[0], utc[1\])
unsigned lst = share->getLst(mjd)* (daysec/twopi)*1000.
share->writeReg(utc_, date.data());
writeReg(lst_, 0, 1, &lst);
Scanner::recordFeatures()
unsigned features = features_.transient_ (or) features_.persistent_;
frame_->archiveFeatures(features, features_.seq_);
Scanner:: struct Features{
unsigned seq_ // sequence number of the last feature marker command received from the control program
unsitned transient_ // Bit-mask union of persistent feature markers received from the last control program since last frame
unsigned persistent_; // bitmask union of persistent features previously received from the control program but not cancelled.
void reset()
FrameBoard::archiveFeatures(unsigned features, unsigned seq)
writeReg(features_, 0, 1, &features)
writeReg(markSeq_, 0, 1, &seq)
BicepShare::packFrame(DataFrameManager* frame)
for(unsigned int iboard=0; iboard < regmap_->nboard_; iboard++) {
RegMapBoard* brd = regmap_->boards_[iboard];
Field RegMap* regmap_
// if the board is marked as reachable, attempt to copy the contents of the board's registers into the frame buffer.
if(brd->nbyteArchive_ > 0) {
if(verifyBoard(iboard) {
try{ packRegBoard(brd, frame) } catch(...){
frame->fillBuffer(0, brd->nByteArchive_)
flagBoard(iboard);
}
RegMap:: defined in control/code/unix/libunix_src/common/regmap.h
std::vector
RegMapBoard::
std::vector
RegMapBlock::
char name_
unsigned flags_ // I think this denotes the type
unsigned ireg_ // the sequential number of the first register
unsigned nreg_ // total number of elements in the block
int slot_ // The start index of the block in the archive array
int iSlot_ // The sequential slot index of the first register in parent slot array
int iArcSlot_ // The sequential slot index of the first register in parent archived slot array
int iByte_ // The sequential byte index of the first register in the parent register map
int iArcByte_ // The starting index of this block in the archive byte array, or -1 if this register is not archived
unsigned nBytePerEl_ // The number of bytes in each element of this register
BicepShare::BicepRegDb::verifyBoard(int board)
INSTALL_MUTEX_CLEANUP(guard_, ls);
grabRegs(WAIT_FOREVER); // don't time out
status \* boardStatusReg(board);
ungrabRegs();
UNINSTALL_MUTEX_CLEANUP(ls);
BicepShare::grabRegs(TimeOut timeout)
regdb_-> grabRegs(timeout)
BicepShare::BicepRegDb::grabRegs(TimeOut timeout)
if(timeout==WAIT_FOREVER)
status = pthread_mutex_lock(&guard_);
BicepRegDb class defined in BicepShare.h
Fields:
friend class BicepShare
RegMap* regmap_
pthread_mutex_t guard_
unsigned* shadnw) // shadow and local register buffer
int nshadow_ // dimension of shadow[]
Methods:
void grabRegs(TimeOut timeout);
void ungrabRegs()
RegMapBoard* findRegMapBoard(string boardName)
void flagBoard(int board) // flag board as unreachable
AntennaDataFrameManager class defined in gcp/util/common/AntennaDataFrameManager.h
Fields:
AntennaDataFrame* antFrame_
Methods:
SetAnt(gcp::util::AntNum::Id) // set teh antenna number associated with this dataframe.
getAntIntId() // return the antenna number associated with this dataframe.
AntNum getAnt() // Return the antenna descriptor associated with this dataframe.
void initialize()
AntennaDataFrame class defined in gcp/util/common/AntennaDataFrame.h
Fields:
AntNum antNum_
Methods:
setAnt()
getAnt()
unsigned char* data() // Get a pointer to our interna data suitable for using an external network buffer.
Questions:
- where is AntennaMonitor::packNextFrame() called from?
- Where is Share::packRegBoard(brd, frame) defined?
For Tomorrow:
- Start with BicepShare::packFrame()
- Figure out where data is getting polled from.
- How does polling of Antenna (pmac etc) stuff work?
- How does the Mediator maintain a connection to the Antenna layer?
- Look at Grabber.
11/25
continue above.
For next week:
- work backwords from AntennaMonitor::packNextFrame()
- where do the boards get put into the BicepShare object?
- where does data, Antenna stuff get polled from?
- How does the Mediator maintain a connection to the Antenn lyer?
~ are there multiple connections for data and commands?
- Look at Grabber.
- Diagram out how data is polled and flows up from Antenna to Mediator to archive.