home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume22 / n3emo-orbit / patch02 next >
Text File  |  1991-09-13  |  5KB  |  168 lines

  1. Newsgroups: comp.sources.misc
  2. From: Bob Berger <rwb@vi.ri.cmu.edu>
  3. Subject:  v22i105:  n3emo-orbit - track earth satellites, Patch02
  4. Message-ID: <1991Sep10.220229.13205@sparky.IMD.Sterling.COM>
  5. X-Md4-Signature: d8c2b34458bd80184ff7a8c8980c23bf
  6. Date: Tue, 10 Sep 1991 22:02:29 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: Bob Berger <rwb@vi.ri.cmu.edu>
  10. Posting-number: Volume 22, Issue 105
  11. Archive-name: n3emo-orbit/patch02
  12. Environment: UNIX
  13. Patch-To: n3emo-orbit: Volume 11, Issue 20
  14.  
  15. Below is a patch to N3EMO, originally posted to comp.sources.misc in 
  16. volume11. You will need to get the following articles in order to apply
  17. this patch:
  18.  
  19. v11i020   n3emo-orbit/part01    orbit: track earth satellites
  20. v14i095   n3emo-orbit/patch01   Patch to orbit3.7
  21.  
  22.   The  N3EMO  orbit  program  simulates  the  motions  of earth satellites.
  23. The program was written for use by amateur radio operators, but is useful to
  24. others, such as astronomers  interested  in observing artificial satellites,
  25. space enthusiasts tracking shuttle missions, and meteorologists using  weather
  26. satellites.  The program is distributed in source form in the C language, and
  27. has been used on a wide variety of computers, from micros to mainframes.
  28.  
  29. ------
  30. diff -c ../orbit3.9/orbit.c ./orbit.c
  31. *** ../orbit3.9/orbit.c    Tue Sep 10 14:25:33 1991
  32. --- ./orbit.c    Tue Sep 10 14:27:28 1991
  33. ***************
  34. *** 1,7 ****
  35. ! /* Copyright (c) 1986,1987,1988,1989,1990 Robert W. Berger N3EMO
  36.      May be freely distributed, provided this notice remains intact. */
  37.   
  38.   /* Change Log
  39.       4/2/1990    v3.9 Misc bug fixes. Changed ElementSet and
  40.               EpochRev to unsigned longs in nasa.c. Allow
  41.               satellite names with spaces in mode.dat.
  42. --- 1,13 ----
  43. ! /* Copyright (c) 1986,1987,1988,1989,1990,1991 Robert W. Berger N3EMO
  44.      May be freely distributed, provided this notice remains intact. */
  45.   
  46.   /* Change Log
  47. +     8/9/1991    v3.9.2 Fix orbital decay correction (it was
  48. +             underestimated by a factor of 2 in previous versions).
  49. +     9/25/1990    v3.9.1 Ignore trailing whitespace after 
  50. +                    satellite names.
  51.       4/2/1990    v3.9 Misc bug fixes. Changed ElementSet and
  52.               EpochRev to unsigned longs in nasa.c. Allow
  53.               satellite names with spaces in mode.dat.
  54. ***************
  55. *** 101,107 ****
  56.                   char ModeStr[20];
  57.                  }  ModeRec;
  58.    
  59. ! char VersionStr[] = "N3EMO Orbit Simulator  v3.9";
  60.    
  61.       /*  Keplerian Elements and misc. data for the satellite              */
  62.       double  EpochDay;                   /* time of epoch                 */
  63. --- 107,113 ----
  64.                   char ModeStr[20];
  65.                  }  ModeRec;
  66.    
  67. ! char VersionStr[] = "N3EMO Orbit Simulator  v3.9.2";
  68.    
  69.       /*  Keplerian Elements and misc. data for the satellite              */
  70.       double  EpochDay;                   /* time of epoch                 */
  71. ***************
  72. *** 236,242 ****
  73. --- 242,264 ----
  74.       return 0;
  75.   }
  76.   
  77. + /* Strip trailing whitespace from a string */
  78. + StripTrailing(s)
  79. + char *s;
  80. + {
  81. +     char *tmp;
  82.   
  83. +     tmp = s;
  84. +     while (*tmp != '\0')
  85. +     tmp++;
  86. +     tmp--;
  87. +     while (*tmp == ' ' || *tmp == '\t')
  88. +     tmp--;
  89. +     tmp[1] = '\0';
  90. + }
  91.   GetSatelliteParams()
  92.   {
  93.       FILE *InFile;
  94. ***************
  95. *** 255,260 ****
  96. --- 277,283 ----
  97.       {
  98.       printf("Letter or satellite name :");
  99.       gets(SatName);
  100. +     StripTrailing(SatName);
  101.   
  102.       if ((InFile = fopen("kepler.dat","r")) == 0)
  103.           {
  104. ***************
  105. *** 280,285 ****
  106. --- 303,309 ----
  107.           }
  108.           found = 1;
  109.           strncpy(SatName,&str[11],strlen(str)-12);
  110. +         StripTrailing(SatName);
  111.           }
  112.           
  113.        else 
  114. ***************
  115. *** 289,294 ****
  116. --- 313,320 ----
  117.               if (! fgets(str,100,InFile))
  118.                   break;    /* EOF */
  119.   
  120. +         StripTrailing(str);
  121.               if (strncmp(str,"Satellite: ",11) == 0)
  122.              if (cstrncmp(SatName,&str[11],strlen(SatName)) == 0)
  123.               found = 1;
  124. ***************
  125. *** 380,385 ****
  126. --- 406,412 ----
  127.           {
  128.       if (! fgets(str,100,InFile))
  129.           break;    /* EOF */
  130. +     StripTrailing(str);
  131.        if (strncmp(str,"Satellite: ",11) == 0)
  132.          if (cstrncmp(SatName,&str[11],strlen(SatName)) == 0)
  133.           found = 1;
  134. ***************
  135. *** 567,575 ****
  136.           {
  137.    
  138.           AverageMotion = epochMeanMotion
  139. -        + (CurrentTime-EpochDay)*OrbitalDecay/2;
  140. -         CurrentMotion = epochMeanMotion
  141.          + (CurrentTime-EpochDay)*OrbitalDecay;
  142.   
  143.           SemiMajorAxis = 331.25 * exp(2*log(MinutesPerDay/CurrentMotion)/3);
  144.    
  145. --- 594,602 ----
  146.           {
  147.    
  148.           AverageMotion = epochMeanMotion
  149.          + (CurrentTime-EpochDay)*OrbitalDecay;
  150. +         CurrentMotion = epochMeanMotion
  151. +        + (CurrentTime-EpochDay)*OrbitalDecay*2;
  152.   
  153.           SemiMajorAxis = 331.25 * exp(2*log(MinutesPerDay/CurrentMotion)/3);
  154.    
  155.  
  156. exit 0 # Just in case...
  157. -- 
  158. Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
  159. Sterling Software, IMD           UUCP:     uunet!sparky!kent
  160. Phone:    (402) 291-8300         FAX:      (402) 291-4362
  161. Please send comp.sources.misc-related mail to kent@uunet.uu.net.
  162.