Skip to content

Commit

Permalink
some obs...
Browse files Browse the repository at this point in the history
  • Loading branch information
axd1967 committed Nov 11, 2021
1 parent 72528d1 commit 984084d
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 30 deletions.
16 changes: 8 additions & 8 deletions guide/app_ssystem_ini.tex
Original file line number Diff line number Diff line change
Expand Up @@ -322,12 +322,12 @@ \subsection{File ssystem\_minor.ini}

Orbital elements for minor bodies are always given for a particular
\indexterm{equinox} like J2000.0 (which indicates the coordinate
reference system) and \indexterm{epoch} (date). The other planets pull
on the objects and change their orbits, most usually leading to the
reference system) and \indexterm{epoch} (date). Other bodies pull
on these objects and change their orbits, most usually leading to the
objects appearing too early or too late in their orbits, but also
changing the other orbital elements. In addition, outgassing events of
comets can act like jet propulsion and change orbits in unpredictable
ways. It is heavily recommended to update the orbital elements on a
comets and other phenomena (such as the Yarkovsky effect) can change orbits in unpredictable
ways. It is therefore crucial to update the orbital elements on a
regular basis ($2\times$/year?), or at least before you go out and are
actually observing minor bodies. Use the Solar System Editor plugin
for this task (section~\ref{sec:plugins:SolarSystemEditor}).
Expand All @@ -349,8 +349,8 @@ \subsection{File ssystem\_minor.ini}
\item[orbit\_Epoch] JDE when these elements are valid. Defaults to
2451545.0 = the J2000.0 standard epoch.

\item[orbit\_good] can be given in days to limit computation of the
object to the time range
\item[orbit\_good] [days] is an optional property to limit computation of the
object to the time range before/after the epoch.
$\mathtt{epoch}\pm\mathtt{orbit\_good}$. If\newFeature{0.21.3}
specified as \texttt{0} there is no check for out-of-range dates. If
specified as \texttt{-1}, half the orbital period is used. The main
Expand All @@ -365,7 +365,7 @@ \subsection{File ssystem\_minor.ini}
\item[orbit\_SemiMajorAxis] $a$ [AU]
\item[orbit\_visualization\_period] [days] %TODO does that default to sth meaningful? Do we need it at all?
\end{description}
The other parameters are like those for the major planets.
The other parameters are similar to those for the major planets.

\subsubsection{Minor Planet section}
\label{sec:ssystem.ini:MinorPlanet}
Expand Down Expand Up @@ -451,7 +451,7 @@ \subsubsection{Comet section}
which is more typical for comets which may have no orbital period when
they are on parabolic or hyperbolic orbits. Frequently orbital
elements are given for a date very close to perihelion so that the
perihel date can be used as default for the optional
perihelion date can be used as default for the optional
\texttt{orbit\_Epoch}. However, this assumption does not always hold,
so we\newFeature{0.21.3} recommend to state \texttt{orbit\_Epoch} explicitly.

Expand Down
10 changes: 5 additions & 5 deletions plugins/SolarSystemEditor/src/SolarSystemEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ SsoElements SolarSystemEditor::readMpcOneLineCometElements(QString oneLineElemen
// result.insert("coord_func", "kepler_orbit"); // 0.20: omit default
result.insert("coord_func", "comet_orbit"); // 0.20: add this default for compatibility with earlier versions!
// GZ: moved next line below!
//result.insert("orbit_good", 1000); // default validity for osculating elements, days
//result.insert("orbit_good", KeplerOrbit::defaultOrbitGood_days); // default validity for osculating elements, days

//result.insert("color", "1.0, 1.0, 1.0"); // 0.16: omit obvious default.
//result.insert("tex_map", "nomap.png"); // 0.16: omit obvious default.
Expand Down Expand Up @@ -598,10 +598,10 @@ SsoElements SolarSystemEditor::readMpcOneLineCometElements(QString oneLineElemen
const double a=perihelionDistance/(1.-eccentricity); // semimajor axis.
const double meanMotion=std::sqrt(mu/(a*a*a)); // radians/day
double period=M_PI*2.0 / meanMotion; // period, days
result.insert("orbit_good", qMin(1000, static_cast<int>(floor(0.5*period)))); // validity for elliptical osculating elements, days. Goes from aphel to next aphel or max 1000 days.
result.insert("orbit_good", qMin(KeplerOrbit::defaultOrbitGood_days, static_cast<int>(floor(0.5*period)))); // validity for elliptical osculating elements, days. Goes from aphel to next aphel or max KeplerOrbit::defaultOrbitGood_days days.
}
else
result.insert("orbit_good", 1000); // default validity for osculating elements, days
result.insert("orbit_good", KeplerOrbit::defaultOrbitGood_days); // default validity for osculating elements, days

double absoluteMagnitude = mpcParser.cap(15).toDouble(&ok);
result.insert("absolute_magnitude", absoluteMagnitude);
Expand Down Expand Up @@ -832,12 +832,12 @@ SsoElements SolarSystemEditor::readMpcOneLineMinorPlanetElements(QString oneLine
result.insert("orbit_MeanAnomaly", meanAnomalyAtEpoch);
// We assume from now on that orbit_good is 1/2 orbital duration for elliptical orbits if not given explicitly.
// This allows following full ellipses. However, elsewhere we should signal to users when
// it should be assumed that elements are outdated and thus positions wrong. (Let's take "1000 earth days" for that.)
// it should be assumed that elements are outdated and thus positions wrong. (Let's take "KeplerOrbit::defaultOrbitGood_days earth days" for that.)
if (eccentricity >=1.)
{
// This should actually never happen for minor planets!
qWarning() << "Strange eccentricity for " << name << ":" << eccentricity;
result.insert("orbit_good", 1000); // default validity for osculating elements for parabolic/hyperbolic comets, days
result.insert("orbit_good", KeplerOrbit::defaultOrbitGood_days); // use default validity for osculating elements for parabolic/hyperbolic comets, days
}

// add period for visualization of orbit
Expand Down
14 changes: 8 additions & 6 deletions src/core/modules/Orbit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ using namespace std;
#define cbrt(x) pow((x),1./3.)
#endif

const int KeplerOrbit::defaultOrbitGood_days = 3*365;

//! Solve true anomaly nu for hyperbolic "orbit" (better: trajectory) around the sun.
//! @param dt: days from perihel
//! @param rCosNu: r*cos(nu)
Expand Down Expand Up @@ -155,10 +157,10 @@ KeplerOrbit::KeplerOrbit(double epochJDE,
{
// For Comets and Minor planets, this just builds a unity matrix. For moons, it rotates into the equatorial system of the parent planet
setParentOrientation(parentRotObliquity, parentRotAscendingnode, parentRotJ2000Longitude);
if (orbitGood<0.)
if (orbitGood < e_orbit_valid)
{
const double period=calculateSiderealPeriod();
orbitGood=(period==0. ? 1000. : period*0.5);
const double period = calculateSiderealPeriod();
orbitGood = (period==0. ? KeplerOrbit::defaultOrbitGood_days : period*0.5);
}
}

Expand Down Expand Up @@ -274,10 +276,10 @@ Vec2d KeplerOrbit::objectDateValidRange() const
{
double min=std::numeric_limits<double>::min();
double max=std::numeric_limits<double>::max();
if (orbitGood>0)
if (orbitGood > e_orbit_valid)
{
min=epochJDE-orbitGood;
max=epochJDE+orbitGood;
min = epochJDE - orbitGood;
max = epochJDE + orbitGood;
}
return Vec2d(min, max);
}
Expand Down
15 changes: 12 additions & 3 deletions src/core/modules/Orbit.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ class Orbit
//! - Heafner: Fundamental Ephemeris Computations 1999
class KeplerOrbit : public Orbit {
public:

enum E_orbit_quality {

This comment has been minimized.

Copy link
@alex-w

alex-w Nov 13, 2021

Did you hear about human readable names for enums and variables?

This comment has been minimized.

Copy link
@axd1967
e_orbit_valid = 0, // XXX do not change this value... (smelly!)
e_orbit_always_good = -1 // e.g. moons/natural satellites
};

//! Constructor.
//! @param epochJDE JDE epoch of orbital elements.
//! @param pericenterDistance [AU] pericenter distance
Expand All @@ -70,8 +76,8 @@ class KeplerOrbit : public Orbit {
//! @param argOfPerhelion [radians]
//! @param timeAtPerihelion JDE
//! @param orbitGoodDays [earth days] can be used to exclude computation for dates too far outside epoch.
//! 0: always good (use that for planet moons. Not really correct, but most users won't care)
//! -1: signal "auto-compute to 1/2 the orbital period or 1000 days if there is no period [e>=1]")
//! 0 XXX ????? : always ? good (used for natural satellites. Not really correct, but most users won't care)
//! -1: signal "auto-compute to 1/2 the orbital period or defaultOrbitGood_days days if there is no period [e>=1]")
//! @param meanMotion [radians/day] for parabolics, this is W/dt in Heafner's lettering
//! @param parentRotObliquity [radians] Comets/Minor Planets only have parent==sun, no need for these? --> Oh yes, these relate VSOP/J2000 eq frames!
//! @param parentRotAscendingnode [radians]
Expand Down Expand Up @@ -104,7 +110,7 @@ class KeplerOrbit : public Orbit {
//! Returns semimajor axis [AU] for elliptic orbit, 0 for a parabolic orbit, and a negative value [AU] for hyperbolic orbit.
virtual double getSemimajorAxis() const Q_DECL_OVERRIDE { return (e==1. ? 0. : q / (1.-e)); }
virtual double getEccentricity() const Q_DECL_OVERRIDE { return e; }
bool objectDateValid(const double JDE) const { return ((orbitGood==0.) || (fabs(epochJDE-JDE)<orbitGood)); }
bool objectDateValid(const double JDE) const { return ((orbitGood == e_orbit_valid) || (fabs(epochJDE-JDE)<orbitGood)); }
//! Return minimal and maximal JDE values where this orbit should be used. (if orbitGood is configured)
Vec2d objectDateValidRange() const;
//! Calculate sidereal period in days from semi-major axis and central mass. If SMA<=0 (hyperbolic orbit), return 0.
Expand All @@ -113,6 +119,9 @@ class KeplerOrbit : public Orbit {
//! @param centralMass in units of Solar masses
static double calculateSiderealPeriod(const double semiMajorAxis, const double centralMass);

//! range around epoch within which the orbit elements can be considered accurate enough
static const int defaultOrbitGood_days;

private:
const double epochJDE; //!< epoch (date of validity) of the elements.
const double q; //!< pericenter distance [AU]
Expand Down
13 changes: 7 additions & 6 deletions src/core/modules/Planet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@ QString Planet::getInfoString(const StelCore* core, const InfoStringGroup& flags
oss << getInfoStringExtra(core, flags);
if (!hasValidPositionalData(core->getJDE()))
{
oss << q_("NOTE: orbital elements outdated -- consider updating!") << "<br/>";
oss << q_("*** orbital elements outdated -- consider updating!") << "<br/>";
}
postProcessInfoString(str, flags);
return str;
Expand Down Expand Up @@ -991,7 +991,7 @@ QString Planet::getInfoStringExtra(const StelCore *core, const InfoStringGroup&
}
else if (re.period==0.)
{
oss << q_("The period of rotation is chaotic") << "<br />";
oss << q_("The period of rotation is chaotic") << "<br/>";
}
if (qAbs(re.W1)>0.)
{
Expand Down Expand Up @@ -1057,7 +1057,7 @@ QString Planet::getInfoStringExtra(const StelCore *core, const InfoStringGroup&
oss << QString("%1: %2 %3").arg(q_("Moon age"), QString::number(age, 'f', 1), q_("days old"));
if (!moonPhase.isEmpty())
oss << QString(" (%4)").arg(moonPhase);
oss << "<br />";
oss << "<br/>";

if (useTopocentric)
{
Expand All @@ -1077,7 +1077,8 @@ QString Planet::getInfoStringExtra(const StelCore *core, const InfoStringGroup&
oss << QString("<tr><td colspan=\"2\">%1:</td><td align=\"right\"> %2</td></tr>").arg(q_("Position angle of bright limb"), chiStr);
}
else
oss << QString("%1: %2<br/>").arg(q_("Position angle of bright limb"), chiStr);
oss << QString("%1: %2").arg(q_("Position angle of bright limb"), chiStr);
oss << "<br/>";

// Everything around libration
const QStringList compassDirs={
Expand Down Expand Up @@ -1146,7 +1147,7 @@ QString Planet::getInfoStringExtra(const StelCore *core, const InfoStringGroup&
oss << QString("<tr><td>%1:</td><td align=\"right\">L: %2</td><td align=\"right\">B: %3</td></tr>").arg(q_("Libration"), libLStr, libBStr);
oss << QString("<tr><td>%1:</td><td align=\"right\">L<sub>s</sub>: %2</td><td align=\"right\">B<sub>s</sub>: %3</td></tr>").arg(q_("Subsolar point"), subsolarLStr, subsolarBStr);
oss << QString("<tr><td>%1:</td><td align=\"right\">c<sub>0</sub>: %2</td></tr>").arg(q_("Colongitude"), colongitudeStr);
oss << "</table>";
oss << "</table><br/>";
}
else
{
Expand Down Expand Up @@ -1189,7 +1190,7 @@ QString Planet::getInfoStringExtra(const StelCore *core, const InfoStringGroup&
oss << QString("<tr><td colspan=\"2\">%1:</td><td align=\"right\"> %2</td></tr>").arg(q_("Position Angle of axis"), paAxisStr);
oss << QString("<tr><td>%1:</td><td align=\"right\">L<sub>%2e</sub>: %3</td><td align=\"right\">&phi;<sub>e</sub>: %4</td></tr>").arg(q_("Center point"), lngSystem, subearthLStr, subearthBStr);
oss << QString("<tr><td>%1:</td><td align=\"right\">L<sub>%2s</sub>: %3</td><td align=\"right\">&phi;<sub>s</sub>: %4</td></tr>").arg(q_("Subsolar point"), lngSystem, subsolarLStr, subsolarBStr);
oss << "</table>";
oss << "</table><br/>";
}
else
{
Expand Down
5 changes: 3 additions & 2 deletions src/core/modules/SolarSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,8 @@ bool SolarSystem::loadPlanets(const QString& filePath)
parent_rot_j2000_longitude = atan2(J2000NodeOrigin*OrbitAxis1,J2000NodeOrigin*OrbitAxis0);
}

const double orbitGoodDays=pd.value(secname+"/orbit_good", parent->englishName!="Sun" ? 0. : -1.).toDouble(); // "Moons" have permanently good orbits.
const bool isNaturalSatellite = parent->englishName != "Sun";
const double orbitGoodDays = pd.value(secname+"/orbit_good", isNaturalSatellite ? KeplerOrbit::e_orbit_valid : KeplerOrbit::e_orbit_always_good /* sure ? */ ).toDouble(); // "Moons" have permanently good orbits.
const double inclination = pd.value(secname+"/orbit_Inclination", 0.0).toDouble()*(M_PI/180.0);

// Create a Keplerian orbit. This has been called CometOrbit before 0.20.
Expand All @@ -863,7 +864,7 @@ bool SolarSystem::loadPlanets(const QString& filePath)
ascending_node, // [radians]
arg_of_pericenter, // [radians]
time_at_pericenter, // JDE
orbitGoodDays, // orbitGoodDays. 0=always good, -1=compute_half_orbit_duration
orbitGoodDays, // orbitGoodDays. 0=always good? or just valid?, -1=compute_half_orbit_duration
meanMotion, // [radians/day]
parentRotObliquity, // [radians]
parent_rot_asc_node, // [radians]
Expand Down

0 comments on commit 984084d

Please sign in to comment.