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 | ||
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:
Update master schedule: ADAPSTABLES/master.sch 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 then fork a SHOACQU child. This SHOACQU child as well as ACQUMAN will run until terminated by the user. ACQUMAN then registers the callbacks, sets the start alarm to trigger an acquisition event, and then iterates in an event loop until terminated by the user.
ACQUMAN will also update the AVHRR master schedule with the status of each scheduled acquisition as either acquired or missed and generate an AVHRR production system master schedule update file. The manager will operate continuously until stopped by the user.
main get next pending scene from schedule start SHOACQU with start time of next pending scene loop until done get next pending scene from schedule get the current time if we are within one minute of the pass start determine output file name Unix signal to SHOACQU to start reading output file name miscellaneous communication ACU (to be determined) receiver fork an ACQUIRE, args: output file name, input data type wait while image is being acquired 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 move modsid file to production system ADAPSACQ do post processing on image file move to net copy directory ADAPSACQ on production system else sleep for 10 minutes or until one minute from pass start whichever is smaller end-if end-loop end-main
Detail Design
1.1) main
ACQUMAN is the main interface between ACQUIRE and SHOACQU, and will have an X-Windows GUI. Begin by initializing the system, get the next scene to acquire, and fork a child process to display the acquisitions. Register the callbacks, set a 'start' alarm, and go into an event loop. The program will remain in this event loop until terminated by the user. initialization call get_next_scene_from_sch fork SHOACQU with next start time and port number: "-next HH:MM:XM -port NNNNN" where HH is the local acquisition hour MM is the local acquisition minute XM is AM (morning) or PM (afternoon) NNNNN is the socket port number register the callbacks call set_start_alarm event loop end (main)1.2) start callback
The start CB 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 SIGTERM signal - send via socket: "-f ahxxxxxxxxxxxxxx.sfl -dn X" where ahxxxxxxxxxxxxxx is 16 char sceneid X is D (day) or N (night) flag fork ACQUIRE with file and and data type specified: "-f ahxxxxxxxxxxxxxx.sfl -dtype XXX" where ahxxxxxxxxxxxxxx is 16 char sceneid XXX is ATN or KLM call set_stop_alarm return end (start callback)1.3) stop callback
The stop CB 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 an alarm is set to trigger the acquisition of the next pass. 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 - send signal SIGTERM - socket call sending the next start time: "-next HH:MM:XM" where HH is the local acquisition hour MM is the local acquisition minute XM is AM (morning) or PM (afternoon) call set_start_alarm do cleanup: - move modbysid file to ADAPSACQ directory on production system - do post processing on image file - move to net copy directory ADAPSACQ on production system return end (stop callback)1.4) exit callback
Terminate ACQUMAN and all of it's associated programs. popup confirmation window if confirmation stop SHOACQU via signal SIGTERM if ACQUIRE is running stop it exit main else return endif end (exit callback)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
Set an alarm to initiate the acquisition of a pass. Get the current system time Subtract current system time from start acquisition time = alarm time Subtract a buffer period of time (about 1 minute) from alarm time. Set the start alarm with this alarm time. return end (set_start_alarm)1.7) set_stop_alarm
Set an alarm to terminate the acquisition of a pass. Subtract start acquisition time from end acquisition time = alarm time Add a buffer period of time (about 20 seconds) to alarm time. Set the stop alarm with this alarm time. return end (set_stop_alarm) 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 increase priority to highest possible 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 multicast ethernet port on the framesync loop read from multicast port compute a time correction value get current time get time stamp from data make comparison and store result pre-process data, remove framesync header write data to output file end-loop close multicast socket connection close output file determine overall time correction from results append overall time correction to ADAPSTABLES/naooXX.timcor 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
The process function reads from the socket, calls calc_error, removes the frame synchronizer header and writes the data to the output file. This loop is continuously executed until a Unix SIGTERM is received from Acquman to terminate. Process returns when terminated.
loop read four bytes from socket: buffer size loop get current system time in milliseconds since midnight read buffer size bytes get first milsec in data stream call calc_error with milsec and current time point to data start write data to output file end-loop end-loop return
Calculate the difference between the satellite milsec and system time. Add an offset to the difference. This offset will be determined empirically after the system in is test. Store the time correction in an array of time corrections.
From the errors calculated in calc_error determine a time correction for the scene. Open the appropriate ADAPSTABLES/noaaXX.timcor file and append the date time and error to the file in the following format:
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 acquisition The following will be via Unix signals: signal to stop the active display, SIGTERM signal to exit, SIGTERMOutputs:
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 ACQUMAN.
main get command line arguments open communication with parent 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 continuously checks for the existance of modsid_xxxxxx.sch and ahxxxxxxxxxx.sfl files in ADAPSACQ. When files are found they are copied to the production system. Additionally, if an ahxxxxxxxxxx.sfl file is found, the appropriate ADAPSTABLES/noaaXX.timcor file is copied to the production system.
main loop until killed if ADAPSTABLES/modsid* exists copy ADAPSTABLES/modsid* to production system ADAPSTABLES if copy is successful remove file endif endif if ADAPSACQ/ah*.sfl 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 sleep a while end loop end-main