Kstars

obsconditions.cpp
1 /*
2  SPDX-FileCopyrightText: 2012 Samikshan Bairagya <[email protected]>
3 
4  SPDX-License-Identifier: GPL-2.0-or-later
5 */
6 
7 #include "obsconditions.h"
8 
9 #include <QDebug>
10 
11 #include <cmath>
12 
13 ObsConditions::ObsConditions(int bortle, double aperture, Equipment equip, TelescopeType telType)
14  : m_BortleClass(bortle), m_Equip(equip), m_TelType(telType), m_Aperture(aperture)
15 {
16  // 't' parameter
17  switch (m_TelType)
18  {
19  case Reflector:
20  m_tParam = 0.7;
21  break;
22  case Refractor:
23  m_tParam = 0.9;
24  break;
25  case Invalid:
26  m_tParam = -1; //invalid value
27  break;
28  }
30 
31  qDebug() << Q_FUNC_INFO << "Aperture value being used:" << m_Aperture;
32 }
33 
35 {
36  QMap<int, double> LMMap;
37  LMMap.insert(1, 7.8);
38  LMMap.insert(2, 7.3);
39  LMMap.insert(3, 6.8);
40  LMMap.insert(4, 6.3);
41  LMMap.insert(5, 5.8);
42  LMMap.insert(6, 5.3);
43  LMMap.insert(7, 4.8);
44  LMMap.insert(8, 4.3);
45  LMMap.insert(9, 3.8);
46 
47  return LMMap;
48 }
49 
50 const QMap<int, double> ObsConditions::m_LMMap = setLMMap();
51 
53 {
54  m_LM = m_LMMap[m_BortleClass];
55 }
56 
58 {
59  double power = (2.81 + 2.814 * m_LM - 0.3694 * pow(m_LM, 2)) / 5;
60  return 0.1333 * m_Aperture * sqrt(m_tParam) * pow(power, 10);
61 }
62 
64 {
65  // qDebug()<< (4.12 + 2.5 * log10( pow(aperture,2)*t ));
66  // return 4.12 + 2.5 * log10( pow(aperture,2)*t ); //Taking optimum magnification into consideration
67 
68  ///If there is no equipment available then return limiting magnitude for naked-eye
69  if (m_Equip == None || m_Aperture == -1)
70  return m_LM;
71 
72  /**
73  * This is a more traditional formula which does not take the
74  * 't' parameter into account. It also does not take into account
75  * the magnification being used. The formula used is:
76  *
77  * TLM_trad = LM + 5*log10(aperture/7.5)
78  *
79  * The calculation is just based on the calculation of the
80  * telescope's aperture to eye's pupil surface ratio.
81  */
82 
83  return m_LM + 5 * log10(m_Aperture / 7.5);
84 }
85 
87 {
88  if (so->type() == SkyObject::SATELLITE)
89  {
90  return so->alt().Degrees() > 6.0;
91  }
92  KStarsDateTime ut = geo->LTtoUT(KStarsDateTime(QDateTime::currentDateTime().toLocalTime()));
93  SkyPoint sp = so->recomputeCoords(ut, geo);
94 
95  //check altitude of object at this time.
96  sp.EquatorialToHorizontal(lst, geo->lat());
97 
98  return (sp.alt().Degrees() > 6.0 && so->mag() < getTrueMagLim());
99 }
100 
101 void ObsConditions::setObsConditions(int bortle, double aperture, ObsConditions::Equipment equip,
103 {
104  m_BortleClass = bortle;
105  setLimMagnitude();
106  m_Aperture = aperture;
107  m_Equip = equip;
108  m_TelType = telType;
109 
110  qDebug() << Q_FUNC_INFO << "Aperture value being used:" << m_Aperture;
111 }
const dms & alt() const
Definition: skypoint.h:281
Extension of QDateTime for KStars KStarsDateTime can represent the date/time as a Julian Day,...
QDateTime currentDateTime()
Stores dms coordinates for a point in the sky. for converting between coordinate systems.
Definition: skypoint.h:44
float mag() const
Definition: skyobject.h:206
void EquatorialToHorizontal(const CachingDms *LST, const CachingDms *lat)
Determine the (Altitude, Azimuth) coordinates of the SkyPoint from its (RA, Dec) coordinates,...
Definition: skypoint.cpp:77
int type(void) const
Definition: skyobject.h:188
void setObsConditions(int bortle, double aperture, Equipment equip, TelescopeType telType)
Set new observing conditions.
QMap::iterator insert(const Key &key, const T &value)
void setLimMagnitude()
Set limiting magnitude depending on Bortle dark-sky rating.
double getTrueMagLim()
Get true limiting magnitude after taking equipment specifications into consideration.
SkyPoint recomputeCoords(const KStarsDateTime &dt, const GeoLocation *geo=nullptr) const
The equatorial coordinates for the object on date dt are computed and returned, but the object's inte...
Definition: skyobject.cpp:295
double getOptimumMAG()
Get optimum magnification under current observing conditions.
ObsConditions(int bortle, double aperture, Equipment equip, TelescopeType telType)
Constructor.
An angle, stored as degrees, but expressible in many ways.
Definition: dms.h:37
const double & Degrees() const
Definition: dms.h:141
bool isVisible(GeoLocation *geo, dms *lst, SkyObject *so)
Evaluate visibility of sky-object based on current observing conditions.
Information about an object in the sky.
Definition: skyobject.h:41
Relevant data about an observing location on Earth.
Definition: geolocation.h:27
static QMap< int, double > setLMMap()
Create QMap<int, double> to be initialised to static member variable m_LMMap.
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Sat Aug 13 2022 04:01:56 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.