Kstars

obsconditions.cpp
1/*
2 SPDX-FileCopyrightText: 2012 Samikshan Bairagya <samikshan@gmail.com>
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
13ObsConditions::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{
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
50const 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
101void ObsConditions::setObsConditions(int bortle, double aperture, ObsConditions::Equipment equip,
103{
104 m_BortleClass = bortle;
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}
Contains all relevant information for specifying a location on Earth: City Name, State/Province name,...
Definition geolocation.h:28
Extension of QDateTime for KStars KStarsDateTime can represent the date/time as a Julian Day,...
void setObsConditions(int bortle, double aperture, Equipment equip, TelescopeType telType)
Set new observing conditions.
ObsConditions(int bortle, double aperture, Equipment equip, TelescopeType telType)
Constructor.
static QMap< int, double > setLMMap()
Create QMap<int, double> to be initialised to static member variable m_LMMap.
Equipment
Equipment available to the user.
double getOptimumMAG()
Get optimum magnification under current observing conditions.
bool isVisible(GeoLocation *geo, dms *lst, SkyObject *so)
Evaluate visibility of sky-object based on current observing conditions.
TelescopeType
Telescope Type (Reflector/Refractor)
double getTrueMagLim()
Get true limiting magnitude after taking equipment specifications into consideration.
void setLimMagnitude()
Set limiting magnitude depending on Bortle dark-sky rating.
Provides all necessary information about an object in the sky: its coordinates, name(s),...
Definition skyobject.h:42
int type(void) const
Definition skyobject.h:189
float mag() const
Definition skyobject.h:207
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...
The sky coordinates of a point in the sky.
Definition skypoint.h:45
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
const dms & alt() const
Definition skypoint.h:281
An angle, stored as degrees, but expressible in many ways.
Definition dms.h:38
const double & Degrees() const
Definition dms.h:141
QDateTime currentDateTime()
iterator insert(const Key &key, const T &value)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 20 2024 11:53:01 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.