SNAPPER

Simple snapshot/analysis/archive/playback macro for a single ICE card.

SNAPPER - simple snapshot/analysis/archive/playback macro for a single ICE card

<card>    Name of card alias in hardware config file
<flags>   List of flags to append to the card's config
<config>  Configuration table, if blank uses a global results SNAPSET

This macro is a GUI to deploy various resources on an ICE card, to snapshot or
continuously acquire to memory or disk, and then to play them back if the card
is configured to do so.  There are also a few simple analysis tools.

The recognized fields in the configuration table and their defaults are:

  port=MODULE1		Data source port name
  format=SB		Data source format
  rate=10		Samplerate in MHz
  clock=N		Clock source
  length=1.0		RAM buffer length in seconds
  dec=512		Tuner decimation
  freq=1		Tuner frequency in MHz
  gain=0		Tuner gain in dB
  nfft=1024		PSD FFT size
  psdr=10		PSD production rate in Hz
  psda=1		PSD averages before plotting
  frame=512		Frame size for time series plots
  afname="archive"	Archive filename 
  afqual=""		Archive filename qualifiers 
  wave=none		Output waveform

Controls:

  gcontrol label  "FUNC"   "Acquire|Playback"
  gcontrol button "MODE"   ""         "Setup,RTMemory,Snapshot,Exit,RTArchive,Archive" "
  gcontrol choice "REPLAY" "Replay"   "One,Cont,Stop,ReStart" "Stop"
  gcontrol choice "WAVE"   "Waveform" 
  gcontrol tval   "TIME"   "TC"     

  gcontrol label  "ARCH"   "Archive"
  gcontrol prompt "AFNAME" "File" 
  gcontrol tval   "ATCT"   "Top" 
  gcontrol tval   "ATCL"   "Len" 
  gcontrol lval   "AUXU"   "Disk" 

  gcontrol label  "CFG"    "Port Config"
  gcontrol prompt "CARD"   "Card  "  card
  gcontrol choice "PORT"   "Port  "  
  gcontrol choice "FORMAT" "Format"  
  gcontrol choice "RATE"   "Rate  "  
  gcontrol choice "LENGTH" "Length"  
  gcontrol choice "CLOCK"  "Clock "  
  gcontrol choice "DEC"    "Dec   "  
  gcontrol dval   "FREQ"   "Freq  "  
  gcontrol lval   "GAIN"   "Gain  "  

  gcontrol label  "DISP"   "Displays" 
  gcontrol choice "FRAME"  "Frame Size" 
  gcontrol choice "NFFT"   "Fft Size  " 
  gcontrol choice "PSDR"   "Disp Rate " 
  gcontrol choice "PSDA"   "Disp Avg  " 

  gcontrol label  "ANAL"   "Analysis" 
  gcontrol button "APLOT"  "Plots  " "TD-Line,TD-Raster,Histogram,FD-Line,FD-Raster,Stats"

  gcontrol label  "OPTS"   "Options" 
  gcontrol choice "AOVER"  "Overlay" "Ask,Erase,OverWrite,Append,Leave,Abort" "Ask"
  gcontrol choice "HDR"    "Headers" "Attached,Detached" "Det"
  gcontrol choice "APKT"   "Packets" "On,Off" "Off"
  gcontrol lval   "STATS"  "Stats  " 
  gcontrol choice "ASF"    "OneFilePerBuffer" "On,Off" "Off"

  gcontrol label  "SYS"    "System" 
  gcontrol choice "AUX0"   "Aux-0 " 
  gcontrol lval   "AUX0U"  "Used-0" 
  gcontrol lval   "FULL"   "FullAt" 

These controls can be initialized using the /GC={MODE=xx,...} syntax.

A Midas log file is created by the name <card>_<port>.mlog.  This file can be filtered
for error messages, up/down times, performance metrics, etc.  It can be retrieved via
NFS, FTP, HTTP, MFTP, etc.

In archive mode, the macro creates a report in the form of a table of contents file 
named <archive>_toc.  This is a midas file containing a record for each file archived
to disk.  The file can be filtered by the user for files of interest which can then be
retrieved via NFS, FTP, HTTP or MFTP.  

The /RCVR=alias switch adds widgets for controlling a reciever.  If alias=ICE, the 
reciever is an ICE I/O Module.  Otherwise, the alias must exist in the Hardware Config 
file and have commands for frequency (F=MHz) and attenuation (ATN=dB).

See the HELP on HTTP for the HTTP or Hyper Text Transfer Protocol syntax.
See the HELP on RMIF for the MFTP or Midas File Transfer Protocol syntax.

Messages:

These are RMIF messages sent in UDP packets.  The results are returned to the calling host:port
in UDP packets with an RMIF header.  See help on RMIF for information on RMIF payload headers.

  GET - Get information from the macro - message is copied back in a RET message

	DOWNLOAD={NAME=localFileName,TIME=start,LENGTH=len}  - Causes client macro to download a piece of the archive file
	  This basically hits the download menu item with the dialog box filled in with these parameters.

	+ all other controls listed above

where n is a channel number, start is in J1950 seconds, and len is in seconds.

  SET   Set information in the macro - message is copied back in an ACK message

	VLAN=address	- sets the VLAN for the input port (do before JOIN)

	JOIN=address	- connect the UDP address to the input port

	LEAVE=address	- disconnect the UDP address from the input port

	INFO=TEXT - text line to be added to the report file (ex. Receiver freq change messages, latches, ...)

	+ all other controls listed above

  DOWNLOAD={NAME=localFileName,TIME=start,LENGTH=len}  - Causes client macro to download a piece of the archive file
        This basically hits the download menu item with the dialog box filled in with these parameters.

Switches:

  /DUAL     Runs both ports 1|2 to seperate files with Master/Slave relationship
  /PLAY     Use this macro for output or playback mode
  /WRAP     ReStart play back at beginning of file when end is reached
  /SERVER=p Run this macro as a server on port p
  /CLIENT   Run this macro as a client
  /REMOTE=h:p The server host and port to feed this client
  /HEADLESS Run this server without graphics

  /ATL=n    Archive transfer length (in samples) tuned to maximize disk performance
	      (usually 1-2Mby, but less than 1/4 of the RAM buffer length)
  /AAUX=n   Archive auxiliary for single channel archives
  /AAUX1=n  Archive auxiliary for channel 1 in dual channel archives
  /AAUX2=n  Archive auxiliary for channel 2 in dual channel archives

  /GC={}    Table of default parameters for any of the controls.
            This has the form {MODE=RTARCHIVE,HDR=ATTACH,...}

  /TSP      Use Time Series Plots only instead of mixed time/frequency
  /FDP      Use Frequency Domain Plots only instead of mixed time/frequency
  /NBP      Add Narrowband plot with click tune capability
  /WBP      Add Wideband plot with click tune capability
  /RCVR=alias Add widgets to control a front end reciever frequency and gain
  /TB=N     TunerBank mode with number channels N from 4 to 4K
  /SDDS     View packet headers in line plots and decode packet data for PSD plots
  /NORESET  Bypass reset of card so multiple instances can be run at once
  /OVSR=n   Set oversampling ratio for tuners
  /PKT      Produce additional archive files <archname>.pkt of packet headers
            corresponding to archive buffers with timecode, channel #, etc.
  /TCPP=n   Compute a new timecode every Nth packet, defaults to each buffer
  /ARCHSF   Causes each ICE buffer to be archived to a seperate file.  Files
            may be APPENDed to each other to reconstruct larger blocks of data.
            Each filename gets a one-up suffix of the form _###.
  /DISKFULL=%  Percentage of disk full at which to stop archive (default=99).
  /DETACHED=0|1 Use detached files for performance on overwrite (default=1);
  /TIVO=len Operates archive in circular mode with disk buffer of <len> seconds.
  /SDDS     Add control widgets for SDDS VLAN and Address
  /SDDSMULTI=n Setup archiver for Multi-channel SDDS mode to seperate files.
  /OVERLAY=mode Switch form of Archive Overlay mode for inheriting from parent macro