This is a brief functional description of the current implimentation of TimeMaster, the software running on the TPC.
Table of Contents:
Functionality
Implimentation
Run Control Interface
Expert Interface
Controls Far Detector timing hardware (either a TRC or
TCU)
Status:
-TRC code is implimented and tested against the development board at Oxford.
-TRC/master code is running at CalDet
-Running on a TCU revision 1 at Soudan
Monitors GPS, Electronics PPS clock, and external time
references.
Status:
-Interface with TimeGoblin, which performs the above duties, is complete
Communicates with RunControl on a Master/Slave basis,
works according to the run model
Status:
-Works
Intelligent logic to report problems with timing
hardware,
NTP process, NTP clients, and/or GPS protocol
Status:
-Working, but still needs stress-testing to identify failure modes and recovery at Soudan.
Provide detailed logging of activities
Status:Provide 'expert' controls
-Complete
Status:
-Working. See below.
The code is available in the online software
CVS repository, under
online/components/timing/TimeMaster
Processor load is minimal; most of the time the
program
is waiting in select() statements.
When TimeMaster stars up, it reads the
$DAQ_CONFIG_DIR/tpc.config file to get information on the hardware, IP
address, etc.
When PREPARE is recieved, a run configuration is
loaded:
1) First, built-in defaults for the run are loaded.
2) Apply the Run Prepare string provided by RC. (This sets RunType)
3) Load any RunConfig values from tpc.config (<global>,
<timemaster>, <defaults>)
4) Load any RunConfig values from daq.config(<global>)
5) Load any RunConfig values from li.config (<global>)
6) Re-apply the RunPrepare string to override any of these defaults.
That is, in order of importance, the data sources
are:
RunPrepare string
li.config
daq.config
tpc.config
built-in defaults
Many of the configuration parameters to TimeMaster will
be times, like the buffer swap interval. These parameters can be
specified in one of three ways, but the first is preferred:
String: (prefered!)
examples:Consists of a floating point number, and a suffix, which may be one of:
buffSwapFreq#S=10.0ms;
delayOnStart#s=5s;
Floating Point: (not bad)
Time is assumed to be in milliseconds. Examples:
buffSwapFreq#F1=10; -> 10 ms
delayOnStart#F1=50000.0; -> 50 seconds
| logPath |
#s |
Obsolete: relative path to dump
some custom logging info |
| farHardwareType |
#s |
"NONE"
-TimeMaster is running Near Detector hardware only "TRC" - a real Timing Reciver Card. Used for CalDet "TCU_Rev1"- a real Timing Central Unit. Used at Soudan "fakeTRC" - a built-in test mode; simulates a TRC in software. Used for testing only. "TCU" - prototype TCU communication. Probably obsolete. Used for testing. "fakeTCU" - a built in test mode for the obsolete TCU communication. Used for testing only. |
| nearHardwareType |
#s |
"NONE"
- TimeMaster runs Far Detector hardware only "CALDET" - The ND MasterClockController is slaved to the FD system. For use at CalDet. (Duh!). This is a special case of "MCP" "MCP" - Standard ND-only running. MCP is the protocol used to talk to the Master Clock Processor |
| requireGPS |
#i |
0 - No GPS 1 - GPS is available; throw errors if it is not responsive |
| ppsDevice |
#s |
Name of device (e.g.
"/dev/ttyS0") of the serial port that the TRC/TCU pulse-per-second is
connected to |
| trcDevice |
#s |
Name of serial port device that
is used to talk to the TRC or TCU |
| nearMcpHost |
#s |
IP address or hostname of the
RIO processor in the Master Clock Crate of the ND |
| goblinHost |
#s |
Name of computer running
TimeGoblin. Usually "localhost" |
| ntpPeer1, ntpPeer2,... |
#s |
Names of the NTP peers that
TimeGoblin is accessing. (for logging, expert screen) |
| goblinPeriod |
<time> |
Time in seconds between polls to TimeGoblin |
| hardwareCheckPeriod |
<time> |
Time in seconds between full
polls to hardware (rechecking online status) |
| runCoWaitPeriod |
<time> |
Time in seconds to wait for a message from RunControl when polling. |
| hbPeriod |
<time> |
Time in seconds between
'HeartBeats': single-line log messages showing status (obsolete) |
| hiPeriod |
<time> |
Time in seconds between updates
of the expert user screen |
| remindNtpJump |
#i | 0 = do nothing, n = remind user
every N hours to jump the clock when needed at CalDet |
| debugLevel | #i |
Level of debugging messages to
dump |
| port |
#i |
Port to listen for RunControl
messages |
| bufferSwapFreq |
<time> (ms) |
The buffer swap speed. Applies
to both far detector (i.e. interrupt rate) and ND (CNTRST) Possible values: 10ms, 25ms, 50ms, 100ms |
| nearMainInjectorMode |
#i <bool> |
0 = Local mode, 1 = Mean
Injector mode (i.e. slaved to MI clock) |
| nearSgatePeriodic |
#i <bool> |
0 = off, 1= on. Generate
'fake' SGATE signals on board the MCC during run. |
| nearTcalPeriodic |
#i <bool> | 0 = off, 1= on. Generate
TCAL signals during run. (See also Li parameters, below) |
| nearCaldetMode |
#i <bool> | 0 = off, 1=on. Go to Caldet run
mode. This is set automatically, and can be ignored |
| nearExtSgateMode |
#i <bool> | 0 = off, 1= on. Generate
'fake' SGATE signals when triggered externally. For CalDet 2003. |
| nearLightInjTrig |
#i <bool> | 0 = off, 1 = on. Generate Light
Injection Triggers on an external output at the same time as TCAL. |
| nearGlobalPhase |
<time> (ns) |
Global phase adjustment of the
ND clock with respect to the MI clock. (Not available for Caldet) Values: 24 steps of 758 ps |
| nearSgateDelay |
<time> (ns) |
On-board delay of the SGATE
signal when in MI mode. (Not available for Caldet) Values: 255 steps of 11us |
| nearSgateDuration |
<time> (us) |
Length of a single SGATE Values: 1024 values of 37.6ns |
| nearCntrstPeriod |
<time> (ms) |
Period between CNTRST signals.
Redundant with bufferSwapFreq, above Values: 10ms, 25ms, 50 ms, 100ms (CalDet) OR: 1024 steps of 616us (ND) |
| nearTcalPeriod |
<time> (ms) |
Period between TCAL signals Values: Steps of 154 us |
| nearExtSgateNum |
#i |
Number of 'fake' SGATEs to
provide every time an external trigger is recieved. (Caldet 2003) Values: 0 to 8191 |
| nearExtSgateDelay |
<time> (ns) |
Delay before generaterating the
first fake SGATE on extertnal trigger (Caldet 2003) Values: 16 steps of 37.6 ns |
| nearExtSgatePeriod |
<time> (ms) |
Time between fake SGATE triggers
when triggered externally. Should be set to match ND detector read-out dead time. (Caldet 2003) Values: 255 steps of 154us |
| nearLiTrigDelay |
<time> (ns) |
Time between TCAL and ExtLiTrig
pulse on MCC panel Values: 16 steps of 37.6ns |
| LiEnable LiTrigMode LiPulseFreq |
#i <bool> #i #i |
0=off, 1=on.
| If both these values are set to 1, TimeMaster runs the ND to
generate Light 0=off, 1=on. | Injection signals, using TCAL Value = approximate frequency in Hz of TCAL signals |
| startSyncToHardware |
#i <bool> |
Obsolete. Expert only, do not use |
| startSyncToNTP |
#i <bool> |
Obsolete. Expert only, do not
use. |
| pingsOnStart pingFreqOnStart |
#i <time> (ms) |
Obsolete. Used to provide EXEC
pulses to the FD on run-start to signal the hardware of the mode change. |
| execNumBursts |
#i |
Number of EXEC bursts to provide
to the FD. (All ints, -1 = infinite) |
| execNumPerBurst | #i |
Number of EXECs in each burst. Values: -1(continuous), 1, 2, 10, 100, 1000 |
| execFreq |
<time> (us) | Time between EXEC pulses within
a burst Values: 100us, 1ms, 10ms, 100ms |
| execPhase |
<time> (ns) |
Fine-grain shift of EXECs
relative to 40 MHz clock. Not implimented. |
| execPhaseShift |
<time> (ns) |
Not yet implimented |
| delayBetweenBursts |
<time> (s) |
Time between bursts. Note that
at least one second will pass between the end of one burst and the start of the next. Set this value to 0 or 1 for efficient running. |
| pingsOnStop pingFreqOnStop delayOnStop |
#i <time> (ms) <time> (s) |
Obsolete. A vauge idea
that sending EXEC signals to the FD front-end could be used to close a run down cleanly. |
| runNumber subRun |
#i #i |
Run number. Not really used for
anything. Sub run number. Not really used for anything. |
| runType |
#i |
Run type. Can be used to choose
sections from config files. |

A list of commands can be
obtained by typing 'help' on the command line.
You can return to the display screen by hitting <return> on a
blank line.
Far Hardware Low-Level Commands
SetPhaseTo
time (ns) Phase of exec relative to pulse. (not
implimented)
SetPhaseBy
time (ns) Relative phase of exec (not implimented)
SetBuffSwapSpeedTo time
(ms) Period of a single buffer
StartBufferSwap
<none> Start Far Hardware
buffer swaps
StopBufferSwap
<none> Stop Far Hardware
buffer swaps
SetExecSpeedTo
time (ms) Period between execs
SetExecNum
int Number of
execs to perform (1,2,10,100,1000 on TRC)
SetExecContinuous
<none> Set execs to fire
continuously
StartExec
<none> Start an exec burst
StopExec
<none> Stop an exec burst
Near Hardware Low-Level Commands
StartNearRunning
<none> Turn on CNTRST and
TBMKR
StopNearRunning
<none> Turn off CNTRST and
TBMKR
StartTcal
<none> Start TCAL
StopTcal
<none> Stop TCAL
StartSgate
<none> Start fake SGATE
StopSgate
<none> Stop fake SGATE
OneShotSgate
<none> Fire SGATE once
(immediate)
OneShotCntrst
<none> Fire CNTRST once
(immediate)
OneShotTcal
<none> Fire TCAL once
(immediate)
OneShotTbmkr
<none> Fire TBMKR once
(immediate)
SetGlobalPhaseTo time
(ns) Global delay relative to refclock
SetSgateDelayTo time
(ms) Gelay on external SGATE
SetSgateDurationTo time
(us) Duration of SGATE signal
SetSgatePeriodTo time
(ms) Period between fake SGATE signals
SetCntsrtPeriodTo time
(s) Time between CNTRST pulses
SetTcalPeriodTo time
(ms) Time between TCAL pulses
SetTbmkrPeriodTo time
(s) Time between TBMKR (time block markers)
MainInjectorMode
<none> Set Near Master Clock
to Main Injector Mode
LocalMode
<none> Set Near Master Clock
to Local Mode
CaldetMode
<none> Set Near Master Clock
to Caldet Mode
NoCaldetMode
<none> Set Near Master Clock
out of Caldet Mode
StartExtSgate
<none> Start generating
SGATEs with external trigger (Caldet)
StopExtSgate
<none> Stop generating SGATEs
with external trigger (Caldet)
StartLiTrig
<none> Start generating
extneral LI triggers
StopLiTrig
<none> Stop generatign
external LI triggers
SetExtSgateNumTo
1-4095 Set number of SGATES
generated per external trigger. (Caldet)
SetExtSgateDelayTo time
(ns) Set delay between ext trigger and SGATE (Caldet)
SetExtSgatePeriodTo time
(ms) Set period between SGATEs of ext trigger (Caldet)
setLiTrigDelayTo time
(ns) Set delay between external LI triggers
Time Goblin Commands
GoblinJumpNtp
<none> Tell the TimeGoblin to
sync up to external time reference.
Run Model Commands
Prepare
<none> Prepare a run
Start
<none> Start a run
Pause
<none> Pause a run
Resume
<none> Resume a run
Stop
<none> Stop a run
Abort
<none> Abort a run
Reset
<none> Reset from ERROR
NextSubRun
<none> Increment the subrun
number
Error
<none> Force TRC into ERROR
DefaultConfig
<none> Set run configuration
to default