Esempio n. 1
0
 public function testpo()
 {
     // Define number of tests to run
     $testLimit = 250;
     // Create reader, and obtain testpo file reference
     $reader = new Reader(DE::DE421());
     $testpo = Reader::testpo(DE::DE421());
     // Seek initial test line
     $testpo->seek(8);
     // Iterate through each line in the testpo file
     for ($i = 0; $i < $testLimit; $i++) {
         // Read and split next line to array
         $testpo->next();
         $line = $testpo->splitCurrent(' ');
         // Check if array has the tests
         if (count($line) != 7) {
             continue;
         }
         // Parse out test values
         $jde = $line[2];
         $target = $line[3];
         $center = $line[4];
         $elem = $line[5];
         $valExp = (double) $line[6];
         // Only test Planets
         if ($target > 9 || $center > 9) {
             continue;
         }
         // Get SSObj instance for target & center
         $target = $target == 3 ? SSObj::Earth() : new SSObj($target);
         $center = $center == 3 ? SSObj::Earth() : new SSObj($center);
         // Interpolate position/velocity & grab test coordinate element
         $posvel = $reader->jde($jde)->position($target, $center);
         $valAct = $posvel[$elem - 1];
         /*
          $e = sprintf('%+11.13E', $valExp);
          $a = sprintf('%+11.13E', $valAct);
          echo "\n{$center} -> {$target}\n--- $e\n+++ $a\n";
         *
         */
         $this->assertEquals($valExp, $valAct, $jde, 1.0E-13);
     }
     echo "\n";
 }