'****************************************************************** '* NearSys GPS Simulator * '* * '* Define the mission by setting the first five parameters * '* GPGGA Sentence transmitted every second, beginning at noon UTC * '* Ascent rate after knee = 80% of initial ascent rate * '* Lat and Long changes are uniform and linear * '* PIN1 available for changing GPS status * '* LPV 26 February 2009 * '* 237 bytes * '****************************************************************** symbol LaunchAltitude = 400 ' altitude of launch site in meters symbol InitAscentRate = 6 ' ascent rate in meters/per second symbol KneeAltitude = 9000 ' altitude of ascent rate knee symbol BurstAltitude = 27000 ' altitude of balloon burst in meters symbol RecoveryAltitude = 350 ' altitude or recovery zone in meters symbol Altitude = W0 ' altitude in meters symbol Seconds = W1 ' mission elapsed time in seconds symbol LatMinutes = W2 ' fractional decimal minutes of lattitude symbol LongMinutes = W2 ' fractional decimal minutes of longitude - same as lattitude symbol UTCSeconds = B6 ' gps time symbol UTCminutes = B7 ' gps time symbol UTChours = B8 ' gps time symbol phase = B9 ' 0=ascending, 1=descending symbol DescentRate = B10 ' calculated descent rate in meters per second symbol Ascent_Rate = B11 ' ascent rate in meters per second Simulator_Initialization: Altitude = LaunchAltitude Ascent_Rate = InitAscentRate GPS_Simulator: for UTChours = 12 to 15 for UTCMinutes = 0 to 59 for UTCSeconds = 0 to 59 Seconds = Seconds + 1 LatMinutes = Seconds LatMinutes = LatMinutes/10 LatMinutes = LatMinutes + 200 LatMinutes = LatMinutes/2 if phase = 1 then Descending Ascending: if Altitude < KneeAltitude then New_Ascent_Altitude Ascent_Rate = InitAscentRate * 4 Ascent_Rate = Ascent_Rate/5 New_Ascent_Altitude: Altitude = Altitude + Ascent_Rate if Altitude < BurstAltitude then Check_Time_Field phase = 1 Descending: if Altitude < RecoveryAltitude then Check_Time_Field DescentRate = Altitude/1000 DescentRate = DescentRate + 1 New_Descent_Altitude: Altitude = Altitude - DescentRate Check_Time_Field: sertxd ("$GPGGA,") if UTCMinutes<10 AND UTCSeconds<10 then Both_Zeros if UTCMinutes<10 then Zero_Minutes if UTCSeconds<10 then Zero_Seconds No_Zeros: ' no preceding zeros in both minutes and seconds field sertxd (#UTChours,#UTCminutes,#UTCseconds) goto Finish_GPS Both_Zeros: ' preceding zeros in both minutes and seconds field sertxd (#UTChours,"0",#UTCminutes,"0",#UTCseconds) goto Finish_GPS Zero_Minutes: ' preceding zero in only minutes field sertxd (#UTChours,"0",#UTCminutes,#UTCseconds) goto Finish_GPS Zero_Seconds: ' preceding zero in only seconds field sertxd (#UTChours,#UTCminutes,"0",#UTCseconds) Finish_GPS: sertxd (".00,3812.",#LatMinutes,",N,09810.",#LongMinutes,",W,1,07,1.1,",#Altitude,".0,M,18.3,M,,*78",CR,LF) pause 1000 next next next end