예제 #1
0
def TimeFuncLoadFile(tconfile):
    """
	Loads timing constants data and prediction control (6P-card) from an input file. Time constants can be included directly in the main input file or they can be read from a separate file identified with "TIMFIL=[pathname/filename]". The input file is read in two passes. The function first looks for "TIMFIL=" lines, then it looks for timing constant data which was included directly. The result of this is that data entered using both methods will be processed, but the "TIMFIL=" data will be processed first. The time constants are also read in from each VCM. However, only the most recent time constants among VCMs are stored in the memory, see VCM.dll documentation.
	
	:param str tconfile: the location of the timing constants and prediction control file
	:return:
		**retcode** (*int*) - 0 if input file loaded successfully, !0 otherwise
	"""
    tconfile = tconfile.encode('ascii')
    tconfile = settings.enforce_limit(tconfile, 512)
    tconfile = c.c_char_p(tconfile)
    retcode = C_TIMEDLL.TimeFuncLoadFile(tconfile)
    return retcode
예제 #2
0
def OpenLogFile(logfile):
	"""
	Opens a log file that all objects connected to maindll will write to.
	
	:param str logfile: name of the file to write to
	
	:return:
		**retcode** (*int*) - the return status of the linked function, 0 on success, <0 on various failures
	"""
	logfile = logfile.encode('ascii')
	logfile = settings.enforce_limit(logfile, 128)
	logfile = c.c_char_p(logfile)
	retcode = C_MAINDLL.OpenLogFile(logfile)
	return retcode
예제 #3
0
def TConLoadFile(tconfile):
    """

	Loads timing constants data from an input file. Time constants can be included directly in the main input file or they can be read from a separate file identified with "TIMFIL=[pathname/filename]". The input file is read in two passes. The function first looks for "TIMFIL=" lines, then it looks for timing constant data which was included directly. The result of this is that data entered using both methods will be processed, but the "TIMFIL=" data will be processed first. The time constants are also read in from each VCM. However, only the most recent time constants among VCMs are stored in the memory, see VCM.dll documentation. See the "Time Constants Data Description" section in the accompanying TimeFunc documentation file for supported formats.
	
	:param str tconfile: The name of the time constant file to load
	:return:
		**retcode** (*int*) - 0 if file successfully loaded, nonzero if file not successfully loaded
		
	"""
    tconfile = tconfile.encode('ascii')
    tconfile = settings.enforce_limit(tconfile, 512)
    tconfile = c.c_char_p(tconfile)
    retcode = C_TIMEDLL.TConLoadFile(tconfile)
    return retcode
예제 #4
0
def LogMessage(message):
	"""
	Writes a message into the log file. 
	
	Make sure the log file is open by calling OpenLogFile before using this function. 
	
	The message is limited to 128 characters. If the message is longer than this, it will be truncated. 

	:return:
		**None** (*None*) - This is a void function
	"""
	message = message.encode('ascii')
	message = settings.enforce_limit(message, 128)
	message = c.c_char_p(message)
	C_MAINDLL.LogMessage(message)
예제 #5
0
def EnvSaveFile(envConstFile, saveMode, saveForm):
    """
	Saves the current Earth constants (GEO) model and fundamental catalogue (FK) model settings to a file.

	:param str envConstFile: The name of the file in which to save the settings. (string[512])
	:param int saveMode: Specifies whether to create a new file or append to an existing one. (0 = create, 1= append)
	:param int saveForm: Specifies the mode in which to save the file. (0 = text format, 1 = xml (not yet implemented, reserved for future))
	:return: 
		**retcode** (*int*) - Returns zero indicating the GEO and FK settings have been successfully saved to the file. Other values indicate an error.
	"""
    envConstFile = envConstFile.encode('ascii')
    envConstFile = settings.enforce_limit(envConstFile, 512)
    envConstFile = c.c_char_p(envConstFile)
    saveMode = c.c_int(saveMode)
    saveForm = c.c_int(saveForm)
    retcode = C_ENVDLL.EnvSaveFile(envConstFile, saveMode, saveForm)
    return retcode
예제 #6
0
def TConSaveFile(tconfile, saveMode, saveForm):
    """
	Saves currently loaded timing constants data to a file.

	TODO: Determine if XML format has been implemented.
	
	:param str tconfile: The name of the file in which to save the timing constants data, 512 character limit
	:param int saveMode: Specifies whether to create a new file or append to an existing one. (0 = Create new file, 1= Append to existing file)
	:param int saveForm: Specifies the format in which to save the file. (0 = SPECTER Print Record format, 1 = XML format (future implementation))
	:return:
		**retcode** (*int*) - 0 if the data is successfully saved to the file, non-0 if there is an error.
	"""
    tconfile = tconfile.encode('ascii')
    tconfile = settings.enforce_limit(tconfile, 512)
    tconfile = c.c_char_p(tconfile)
    saveMode = c.c_int(saveMode)
    saveForm = c.c_int(saveForm)
    retcode = C_TIMEDLL.TConSaveFile(tconfile, saveMode, saveForm)
    return retcode
예제 #7
0
def EnvLoadFile(envFile):
    """
	Reads Earth constants (GEO) model and fundamental catalogue (FK) model settings from a file. 

	The users can use NAME=VALUE pair to setup the GEO and FK models in the input file. 

	For GEO model, the valid names are GEOCONST, BCONST and the valid values are WGS-72, WGS72, 72, WGS-84, WGS84, 84, EGM-96, EGM96, 96, JGM-2, JGM2, 2, SEM68R, 68, GEM5, 5, GEM9, and 9. 

	For FK model, the valid name is FKCONST and the valid values are: FK4, 4, FK5, 5. 

	All the string literals are case-insensitive. 

	:return:
		**retcode** (*int*) - Returns zero indicating the input file has been loaded successfully. Other values indicate an error
	"""
    envFile = envFile.encode('ascii')
    envFile = settings.enforce_limit(envFile, 512)
    envFile = c.c_char_p(envFile)
    retcode = C_ENVDLL.EnvLoadFile(envFile)
    return retcode
예제 #8
0
def EnvSetGeoStr(geoStr):
    """
	Changes the Earth constants (GEO) setting to the model specified by a string literal. 

	:param str geoStr:

		If you specify an invalid value for geoStr, the program will continue to use the current setting. 

		The GEO model is globally shared among the Standardized Astrodynamic Algorithms DLLs. If its setting is changed, the new setting takes effect immediately. 

		The following table lists possible values of the parameter value GEO setting: 

			+--------------------------------+------------------+
			| geoStr (any string in the row) | Interpretation   |
			+--------------------------------+------------------+
			| 'WGS-84', 'WGS84', '84'        | WGS-84           |
			+--------------------------------+------------------+
			| 'EGM-96', 'EGM96', '96'        | EGM-96           |
			+--------------------------------+------------------+
			| 'WGS-72', 'WGS72', '72'        | WGS-72 (default) |
			+--------------------------------+------------------+
			| 'JGM-2, 'JGM2', '2'            | JGM-2            |
			+--------------------------------+------------------+
			| 'SEM68R', '68'                 | STEM68R, SEM68R  |
			+--------------------------------+------------------+
			| 'GEM5', '5'                    | GEM5             |
			+--------------------------------+------------------+
			| 'GEM9', '9'                    | GEM9             |
			+--------------------------------+------------------+

		The GEO model must be set to WGS-72 to use the SGP4 propagator. 


	"""
    geoStr = geoStr.encode('ascii')
    geoStr = settings.enforce_limit(geoStr, 6, terminator=False)
    geoStr = c.c_char_p(geoStr)
    f = C_ENVDLL.EnvSetGeoStr
    C_ENVDLL.EnvSetGeoStr(geoStr)