Dave Lloyd, Tim Baltzer
Computer Services Branch
Software Engineering Department
Mar 08, 2001
Prepared by: | Dave Lloyd - Tim Baltzer |
---|---|
Software Engineer, | |
Raytheon, ITSS | |
Concurred by: | Carla Damme |
Technical Area Lead, CSB/SED | |
Raytheon, ITSS | |
Approved by: | Mike Benson |
Project Manager, | |
Raytheon, ITSS |
Number | Date and Sections | Notes |
1 | Mar 08, 2001 | Document Created |
2 | Jul 22, 2002 | Changed design of ACQUMAN to a non-X-windows application, also to not start SHOACQU. All communication between ACQUMAN and SHOACQU is now via sockets. |
3 | ||
4 | ||
5 | ||
6 |
The acquisition manager, ACQUMAN, controls the operation of the acquisition display, SHOACQU, and the frame synchronizer interface, ACQUIRE. ACQUMAN determines when scheduled passes are to be acquired by reading the AVHRR master schedule in ADAPSTABLES. SHOACQU is a moving window display that gives the user a visual depiction of the scene as it is acquired and also a line of text with the next acquisition time. ACQUIRE communicates with the frame synchronizer, downloads data and stores it in an output file.
PUSHACQU is an ancillary module that transfers all acquired images, 'modsid' files, and time correction files to the ADAPS production system. 'modsid' files contain data to update the master schedule file (modify-by-scene-id), and are part of the legacy AVHRR scheduling system.
AVHRR master schedule: ADAPSTABLES/master.schOutputs:
Modify 'modsid' master schedule file: ADAPSACQ/modsid_xxxxxxxx.sch (where xxxxxxxx is a unique time stamp).Returns:
NoneACQUMAN will initialize itself, read the schedule to determine the next pending scene, and attemp to setup communications with SHOACQU. ACQUMAN then enters a loop which continuously executes until terminated by the user. Within the loop the start alarm is checked for expiration, communication with SHOACQU is checked, the schedule is checked for updates and status of the chidren processes are checked.
main initial setup: get environment variables get next pending scene from schedule attempt communication with SHOACQU if attemp was successful, send it the next start time loop until done check for a stop file and exit if found if we are within one minute of the pass start determine output file name send a message to SHOACQU to start displaying the scene miscellaneous communication ACU (to be determined) receiver fork an ACQUIRE, args: output file name, input data type set alarm time for the stop time else if we are at the stop time signal ACQUIRE to terminate signal SHOACQU to release input file and display next start time check file size of image file, if GT (some minimum size) generate modsid file with scene acquired else generate modsid file with scene missed endif fork a TIMECORR process check the status of acquire and timecorr children if not during a live acquisition check the schedule if next pending scene is different set new start alarm time endif endif if there is no communication with SHOACQU attemp to set up communication else check status of connection endif sleep for 10 minutes or until one minute from pass start whichever is smaller end-loop end-main
Detail Design
1.1) main
ACQUMAN is the main interface between ACQUIRE and SHOACQU. Begin by initializing the system, get the next scene to acquire, and attemp to set up communiction with the process that displays the acquisitions. initialization call get_next_scene_from_sch attemp to set up a socket connection with SHOACQU if successful send a next acquisition message: "-next HH:MM:SS:XM" where HH is the local acquisition hour MM is the local acquisition minute XM is AM (morning) or PM (afternoon) enter while loop (see main described above) end while end (main)1.2) start acquisition
The start acquisition function initiates the reception of a pass. The receiver is instructed to record at the appropriate frequency, the SHOACQU child is notified to start displaying the pass, an ACQUIRE child is forked to interface with the framesync. communication with the receiver tell SHOACQU to display pass as it is acquired - send via socket: "-file ahxxxxxxxxxxxxxx.sf2 -dnflag X -rgb R G B" where ahxxxxxxxxxxxxxx is 16 char sceneid X is D (day) or N (night) flag R G B is [1...5], the channel to display in red, blue and green fork ACQUIRE with file and and data type specified: "-f ahxxxxxxxxxxxxxx.sf2" where ahxxxxxxxxxxxxxx is 16 char sceneid return STOP end (start acquisition)1.3) stop acquisition
The stop acquisition function initiates the termination of an acquistion. The ACQUIRE interface to the framesync is terminated, the SHOACQU child is notified to stop updating the acquisition display, and the time correction process is started. tell ACQUIRE to stop via signal SIGTERM check file size of image file, if GT (some minimum size) generate modsid file with scene acquired else generate modsid file with scene missed endif call get_next_scene_from_sch tell SHOACQU to release pass and display next sceneid - socket call sending the next start time: "-next HH:MM:SS:XM" where HH is the local acquisition hour MM is the local acquisition minute SS is the local acquisition second XM is AM (morning) or PM (afternoon) fork a timecorr process return START end (stop acquisition)1.4) exit
Terminate ACQUMAN and all of it's associated programs. check for the file $ADAPSTABLES/acquman.stop if it's there remove the file if ACQUIRE is running stop it return TRUE else return FALSE endif end (exit)1.5) get_next_scene_from_sch
Determine the next scheduled live (EROS) scene in the schedule. If one is not found, nothing will be returned. Read thru the schedule looking for an EROS scene whose end time is after the current time. if one is found return scene id start time end time day/night flag else return null endif end (get_next_scene_from_sch)1.6) set_start_alarm
Deleted.1.7) set_stop_alarm
Deleted. Unresolved: - communication with ACU
output file name input data type: ATN for satellites <= NOAA 14 KLM for NOAA 15, 16 and 17 (KLM series satellites)Outputs:
file of acquired data time correction valueReturns:
NoneACQUIRE is the interface between the frame synchronizer and the Linux server. ACQUIRE is started by ACQUMAN. The command line argument contains the output file name. ACQUIRE opens a TCP connection with the frame synchronizer and sets the data type. The output file is created with the header. A UDP multicast connection with the frame synchronizer is opened. Once the connection is established, ACQUIRE reads from the port, computes a time correction and writes to the output file until signalled by ACQUMAN. The signal from ACQUMAN will be the Unix signal SIGTERM. Upon receiving the signal to terminate, ACQUIRE closes the multicast connection and computes an overall time correction. The time correction is appended to the appropriate satellite time correction file and ACQUIRE terminates.
main retrieve the output file name from command arguments retrieve data type from command arguments set framesync data type open output file create header and write to output file open commucication with the unicast ethernet port on the framesync loop read from unicast port determine the type of message received if timestamp save to timestamp file else if miscellaneous save to miscellaneous file else save to image file end-loop close unicast socket connection close output file end-main Unix signal handler if signal is SIGTERM exit from read/write loop end-if end-signal handler
The set_data_type function is called with the scene data type. Communication is set up with the frame synchronizer unicast port with a TCP socket. The data type is sent via the socket and the response checked for validity. If an invalid data type is encountered the data type will be set to KLM. Finally the socket connection is closed. If an error occurs setting the data type the type is left the same as it was and a fail is returned.
Notes:
create a stream socket establish the connection if data type is "ATN" (satellites through NOAA14) set message to "0007:DTP 0;" else if data type is "KLM" (satellites NOAA15 through NOAA17) set message to "0007:DTP 1;" else log an error set message to "0007:DTP 1;" end-if write message to socket read response from socket if response = message return success else return fail end-if close socket connection
Deleted.
Deleted.
Deleted.
Required: Next scheduled start time Required if communication with parent is needed: socket port number Optional: input file name Required only if input file is given: day/night flagInputs: via InterProcess Communication (IPC) with parent
The following will be sent using socket: Next scheduled start time input file name day/night flag signal to start a new acquisitionOutputs:
X display with next scheduled start time, or current acquisition imageReturns:
NoneSHOACQU is a graphical display of the image being acquired. It reads from the output file of ACQUIRE and displays pixels subsampled from each line of data. The image bands chosen for the RGB display are determined based on whether the pass is a daytime or nighttime pass for example: a NOAA 14 daytime pass could use Band 2 for red and Band 1 for green and blue, a nighttime pass could use Band 4 for red and Band 3 for green and blue. When ACQUMAN signals to start a new acquisition it also sends the input file to use for the display. SHOACQU displays data from the input file until signalled to stop active display of the acquisition. Once signalled to stop, SHOACQU displays a line of text with the next scheduled acquisition time. SHOACQU will sleep until signalled again. SHOACQU will remain operational until stopped by user or when communications with ACQUMAN are terminated.
main get command line arguments open communication with ACQUMAN initialize X windows loop if input file is present or signalled display input file else wait for signal to start end-if end-loop end-main
The main function gets command line arguments and sets up communication with the parent. The X windows widgets are created and initialized. Call backs are registered. After the display window is realized the next acquisition time is displayed. If an input file is specified a display call back is issued. Finally main enters an infinite event loop.
if input file present get input file from command arguments get day/night flag end-if get next scene start time from command arguments get socket port number if present and open communication with parent (ACQUMAN) socket connection set up X display register CB's realize main window display next scene start time if input file issue display CB end-if enter event loop
The purpose of the display function is to show a moving window depiction of the current acquisition as it's being acquired and, at the end of the acquisition, display the next acquisition time. It first gets the file name (this is the file that Acquire will write the scene to) and the day night flag. The input file may not exist yet so wait until the file exists before continuing. Read and discard the 512-byte header and go into a loop.
The loop will execute until Acquman signals to stop, the signal handler will set the exit flag to TRUE. The main display loop reads from the input file as it grows and sleeps if the file has not gotten bigger. Each line of data is subsampled based on the day/night flag and possibly SATID. The SATID (satellite number) may come into play with NOAA 16 due to the differences in channel 3. The SATID will be obtained from the input file name characters three and four. The subsampled line is displayed. If the scene is a day (ascending) scene the line will be displayed above the previous one. For night (descending) scenes the line will be displayed below the previous line. When the top or bottom of the display is reached, the previous lines will be scrolled down or up before displaying the current line.
When the display loop exits, the input file is closed and the next acquisition time is read from the parent and displayed.
clear display window get message from ACQUMAN: input file and day/night flag /* wait for file to be created by acquire */ while opening input file is unsuccessful sleep 1 end-while while input file size < 512 bytes end-while read and discard 512-byte header /* display loop */ while loop exit flag is FALSE if input file is bigger remember current file size read line of data subsample appropriate display bands, based on D/N and SATID display subsampled line else sleep 1 second or some appropriate short interval end-if end-while close input file get message from ACQUMAN, next scene start time display next scene start time
if signal is SIGTERM if displaying an image set display loop exit flag to TRUE else issue display event end-if end-if return
remove display exit
NoneOutputs:
NoneReturns:
NonePUSHACQU checks for the existance of modsid_xxxxxx.sch and ahxxxxxxxxxx.sf2 files in ADAPSACQ. If files are found they are copied to the production system. Additionally, if an ahxxxxxxxxxx.sf2 file is found, the appropriate ADAPSTABLES/noaaXX.timcor file is copied to the production system. PUSHACQU will be run from opsavhrr cron at 10 minute intervals.
main if ADAPSTABLES/modsid* exists copy ADAPSTABLES/modsid* to production system ADAPSTABLES if copy is successful remove file endif endif if ADAPSACQ/ah*.sf2 exists copy ADAPSACQ/ah*.sfl to production system ADAPSACQ if copy is successful remove file endif get satellite number from file name copy ADAPSTABLES/noaaXX.timcor to production system ADAPSTABLES endif end-main