Commit Graph

27 Commits

Author SHA1 Message Date
Don Cross
9495e4e45f Fixed warning in top2013.c: unnecessary variable assignment.
The newer version of cppcheck reported that I was assigning
a value to a variable that was never used before another
assignment occurred. Fixed this to eliminate the warning.
2023-06-16 21:19:17 -04:00
Don Cross
b31c0185df TOP2013: greatly decrease waviness in Pluto curve.
The high-frequency wobble in the Pluto position function was bothering me.
Decreased the arcminute error threshold from 1.0 to 0.5, resulting
in a much larger model, but a lot less ripple:

   547 [    78   140    94   115    21    99]
2020-07-07 15:38:39 -04:00
Don Cross
6588e21d72 TOP2013: Relaxed required accuracy to 1 arcminute; some optimizations.
Relax apparent angular error threshold from 0.4 to 1.0 arcminutes.
No longer compare TOP2013 to NOVAS while optimizing.
Use worst-case distance between Earth and Pluto:
Pluto radius from Sun, minus Earth aphelion distance.

Sample 503 points intead of 293.
Measure 2 full orbits before J2000 and 2 full orbits after J2000.

Statistics for output/8.top :
OptimizeTop:    268 terms [     34     57     72     90      9      6]
2020-07-05 13:31:43 -04:00
Don Cross
0afc803b94 TOP2013: First draft of a random-ray search for small models. 2020-07-04 19:31:39 -04:00
Don Cross
3ce9f07c63 TOP2013: Implemented function for picking random 6D unit vectors.
Created functions for generating random unit vectors in
6-dimensional space. Will use this for trying different
directions along which to do a binary search between
truncated TOP2013 models that have acceptable error
and those which have unacceptable error. Will home in on
the smallest model that is within tolerable error.
2020-07-04 14:24:06 -04:00
Don Cross
cb9e5e9107 TOP2013: added helper function to directly calculate rectangular coordinates.
Also optimized calculation of rotation matrix.
2020-07-03 20:37:24 -04:00
Don Cross
ac6a101607 TOP2013: Changed my mind. Will squash models by integer skip values.
Instead of calculating amplitudes and truncating based on them,
I realized when it comes right down to it, all I want to do
is truncate fewer or more terms from each formula until I find
a good compromise between size and accuracy. A term is either
included or excluded. Therefore the degree of freedom is discrete,
not continuous. There is no need to calculate a continuous value
to adjust something with only discrete options available.
2020-07-03 20:15:53 -04:00
Don Cross
f8be7797bf TOP2013: Incorporate the pruning amplitudes inside the contribution map itself.
This change allows me to automatically initialize the pruning amplitudes
to the largest possible value that won't cause any pruning.
It establishes a lower bound for pruning each of the 6 elliptical formulas.
2020-07-03 17:23:13 -04:00
Don Cross
acac092e03 TOP2013: TopSquash() never returns an error code, so made it return void. 2020-07-03 17:04:48 -04:00
Don Cross
c2eedd6e2c TOP2013: simplified data structure.
Eliminated a layer of abstraction from the data structure
for a TOP2013 model. Just represent a flat [6][13] array of series.
2020-07-03 16:59:27 -04:00
Don Cross
70faf02b4d TOP2013: Eliminated nseries_calc; it causes more trouble than it's worth.
It's more elegant to assume there are always 13 series,
even if many of them are empty of any terms.
The increased calculation time is negligible.
2020-07-03 14:41:46 -04:00
Don Cross
ab5df8fc5d TOP2013: Implemented "clone" and "squash" functions.
The TopCloneModel function makes a deep copy of a model,
allocating separate term arrays for the copy.

TopSquash uses a contribution map and an array of 6 amplitude thresholds
to pack down an original model into a cloned model.
2020-07-03 14:33:31 -04:00
Don Cross
e2f5d47cc9 Eliminated top_formula_t::nseries_total.
Because the series array size is fixed, there is no reason
to have an nseries_total field.
2020-07-03 12:47:45 -04:00
Don Cross
13c02dcfc9 TOP2013: Implemented "contrib map" idea.
The contrib map is an array of 6 sortable lists, one for each
elliptical formula. Each list contains a tuple (m, s, t)
where m = the magnitude of the contribution of a term,
and (s, t) are the indices of the term in the formula.
I sort the tuples in ascending order of magnitude.
This should allow me to efficiently eliminate terms from
each formula.

I will have to add an "ignore" flag for each term, because
eliminated terms will not generally be at the end of the list.
Before saving, I will need to compact the lists.
2020-07-02 22:05:12 -04:00
Don Cross
5679aace89 TOP2013: Starting to work on pruner/optimizer.
The first step is measuring the error between TOP2013 and NOVAS
over a range of time values and finding the maximum error in
worst-case parallax arcminutes as seen from the Earth.

Next I will be able to automate pruning the model to make
it as small as possible without exceeding our error tolerance.
2020-07-02 20:19:40 -04:00
Don Cross
3fef403834 Updated build for Windows to include TOP2013 code. 2020-07-01 22:32:06 -04:00
Don Cross
4306f09f92 More debug info about errors comparing JPL/TOP, NOVAS/TOP. 2020-07-01 22:15:52 -04:00
Don Cross
7132080e8f Compared JPL Horizons data with TOP2013. Very good fit.
This makes me think there is something wrong with how
I am calling NovasBodyPos(). I don't understand why the errors
are tiny fractions of arcminutes here, but up to 0.11 arcmin
compared to NOVAS.
2020-07-01 21:59:18 -04:00
Don Cross
61eef7531a TOP2013: Verified calculation of rectangular coordinates.
Ported the original FORTRAN code for converting elliptical
elements to ecliptic/equatorial rectangular coordinates.
Verified against the output of the original FORTRAN program.
The results include both position vectors and velocity vectors,
and all are identical to 10 places after the decimal.
2020-07-01 19:07:35 -04:00
Don Cross
460044df83 TOP2013: calculating correct elliptical elements. 2020-07-01 15:57:36 -04:00
Don Cross
4c7981d325 Finally regenerated binary identical TOP2013 output.
There was one place where a couple of powers of t had empty series.
This was an important thing to fix because it would have messed
up calculations.
2020-07-01 13:07:39 -04:00
Don Cross
33d5df6280 Fixed rounding problems regenerating TOP2013.dat.
When I load TOP2013.dat, I have to simulate regenerating the output
in order to find discrepancies and fix them.
This is a total hack, but it satisfies multiple goals:

1. Generate identical output as the loaded input.
2. Confirm that what we loaded is what we meant to load.
3. Allow saving modified/calculated models correctly.
2020-07-01 12:55:29 -04:00
Don Cross
8ea3fc8c5e Track line numbers in top2013 output for debugging purposes. 2020-07-01 12:08:03 -04:00
Don Cross
87da232113 Very close to generating binary identical TOP2013 file.
I want to make sure I can load and save a TOP2013 data set perfectly
before proceeding with calculation, truncation, etc.
I'm really close, but there are occasional rounding problems
writing floating point numbers back to the file in the weird
format they use.
2020-07-01 11:52:29 -04:00
Don Cross
b5c2926b54 Needed to initialize nseries_calc in each formula. 2020-06-30 22:48:37 -04:00
Don Cross
75c1a75098 First draft of loading a TOP2013 planet model. Needs more testing. 2020-06-30 22:18:58 -04:00
Don Cross
ff5ef2b3bb Starting to implement ValidateTop2013().
Adding infrastructure for loading TOP2013 models of planets
and calculating them. Will start with a unit test to verify
I'm calculating the formulas correctly.
2020-06-30 17:58:42 -04:00