	PRO SIM_WRT_PKT, UNIT, PACKET
;+
; Project     :	SOHO - CDS
;
; Name        :	SIM_WRT_PKT
;
; Purpose     :	Writes out a simulated packet
;
; Category    :	CDS, Telemetry
;
; Explanation :	Writes out a simulated packet to a telemetry file.  Called from
;		SIM_RASTER.
;
; Syntax      :	SIM_WRT_PKT, UNIT, PACKET
;
; Examples    :	
;
; Inputs      :	UNIT	= Logical unit number of file opened for write.  The
;			  telemetry packets are written into this file.
;		PACKET	= The packet to write out.
;
; Opt. Inputs :	None.
;
; Outputs     :	None.
;
; Opt. Outputs:	None.
;
; Keywords    :	None.
;
; Calls       :	
;
; Common      :	None.
;
; Restrictions:	The routine TM_DEFINE_STRUC must be called first to define all
;		the structures.
;
; Side effects:	None.
;
; Prev. Hist. :	None.
;
; History     :	Version 1, 6-Jul-1995, William Thompson, GSFC
;
; Contact     :	WTHOMPSON
;-
;
	ON_ERROR, 2
;
;  Store the current pointer position.
;
	POINT_LUN, -UNIT, CUR_POS
;
;  Form a dummy realtime packet header, and write it out to the file.
;
	RT = {RTPKTHDRDFN}
	RT.MSGID = 516
	RT.MSGLEN = 302
	RT.MSGREQID = 3
	WRITEU, UNIT, RT
;
;  Convert the raster header packet to IEEE format and write it out.
;
	HOST_TO_IEEE, PACKET
	WRITEU, UNIT, PACKET
	FLUSH, UNIT
;
;  Rewind the file, and use TM_ENOUGH to reread the packet and calculate a
;  checksum.
;
	POINT_LUN, UNIT, CUR_POS
	TEST = TM_ENOUGH( UNIT, 306, CHECKSUM )
;
;  Rewrite the packet with the checksum included.
;
	HOST_TO_IEEE, CHECKSUM
	PACKET.PKT.CHKSUM = CHECKSUM
	WRITEU, UNIT, RT
	WRITEU, UNIT, PACKET
;
	RETURN
	END
