• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

kstars

  • sources
  • kde-4.12
  • kdeedu
  • kstars
  • kstars
  • tools
  • whatsinteresting
obsconditions.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  obsconditions.cpp - K Desktop Planetarium
3  -------------------
4  begin : 2012/10/07
5  copyright : (C) 2012 by Samikshan Bairagya
6  email : samikshan@gmail.com
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #include "obsconditions.h"
19 #include "math.h"
20 #include "kdebug.h"
21 
22 ObsConditions::ObsConditions(int bortle, double aperture, Equipment equip, TelescopeType telType):
23  m_BortleClass(bortle), m_Equip(equip), m_TelType(telType), m_Aperture(aperture)
24 {
25  // 't' parameter
26  switch (m_TelType)
27  {
28  case Reflector:
29  m_tParam = 0.7;
30  break;
31  case Refractor:
32  m_tParam = 0.9;
33  break;
34  case Invalid:
35  m_tParam = -1; //invalid value
36  break;
37  }
38  setLimMagnitude();
39 
40  kDebug()<<"Aperture value being used:"<<m_Aperture;
41 }
42 
43 ObsConditions::~ObsConditions() {}
44 
45 QMap<int, double> ObsConditions::setLMMap()
46 {
47  QMap<int, double> LMMap;
48  LMMap.insert(1, 7.8);
49  LMMap.insert(2, 7.3);
50  LMMap.insert(3, 6.8);
51  LMMap.insert(4, 6.3);
52  LMMap.insert(5, 5.8);
53  LMMap.insert(6, 5.3);
54  LMMap.insert(7, 4.8);
55  LMMap.insert(8, 4.3);
56  LMMap.insert(9, 3.8);
57 
58  return LMMap;
59 }
60 
61 const QMap<int, double> ObsConditions::m_LMMap = setLMMap();
62 
63 void ObsConditions::setLimMagnitude()
64 {
65  m_LM = m_LMMap[m_BortleClass];
66 }
67 
68 double ObsConditions::getOptimumMAG()
69 {
70  double power = (2.81 + 2.814 * m_LM - 0.3694 * pow(m_LM, 2)) / 5;
71  return 0.1333 * m_Aperture * sqrt(m_tParam ) * pow(power, 10);
72 }
73 
74 double ObsConditions::getTrueMagLim()
75 {
76 // kDebug()<< (4.12 + 2.5 * log10( pow(aperture,2)*t ));
77 // return 4.12 + 2.5 * log10( pow(aperture,2)*t ); //Taking optimum magnification into consideration
78 
80  if (m_Equip == None || m_Aperture == -1) return m_LM;
81 
93  return m_LM + 5 * log10(m_Aperture / 7.5);
94 }
95 
96 bool ObsConditions::isVisible(GeoLocation *geo, dms *lst, SkyObject *so)
97 {
98  KStarsDateTime ut = geo->LTtoUT(KStarsDateTime(KDateTime::currentLocalDateTime()));
99  SkyPoint sp = so->recomputeCoords(ut, geo);
100 
101  //check altitude of object at this time.
102  sp.EquatorialToHorizontal(lst, geo->lat());
103 
104  return (sp.alt().Degrees() > 6.0 && so->mag() < getTrueMagLim());
105 }
106 
107 void ObsConditions::setObsConditions(int bortle, double aperture, ObsConditions::Equipment equip, ObsConditions::TelescopeType telType)
108 {
109  m_BortleClass = bortle;
110  setLimMagnitude();
111  m_Aperture = aperture;
112  m_Equip = equip;
113  m_TelType = telType;
114 
115  kDebug()<<"Aperture value being used:"<<m_Aperture;
116 }
dms::Degrees
const double & Degrees() const
Definition: dms.h:98
ObsConditions::Refractor
Definition: obsconditions.h:44
ObsConditions::setLimMagnitude
void setLimMagnitude()
Set limiting magnitude depending on Bortle dark-sky rating.
Definition: obsconditions.cpp:63
GeoLocation::LTtoUT
KStarsDateTime LTtoUT(const KStarsDateTime &lt) const
Definition: geolocation.h:234
ObsConditions::None
Definition: obsconditions.h:38
ObsConditions::setLMMap
static QMap< int, double > setLMMap()
Create QMap to be initialised to static member variable m_LMMap.
Definition: obsconditions.cpp:45
ObsConditions::getOptimumMAG
double getOptimumMAG()
Get optimum magnification under current observing conditions.
Definition: obsconditions.cpp:68
SkyPoint
The sky coordinates of a point in the sky.
Definition: skypoint.h:50
ObsConditions::getTrueMagLim
double getTrueMagLim()
Get true limiting magnitude after taking equipment specifications into consideration.
Definition: obsconditions.cpp:74
ObsConditions::Equipment
Equipment
Equipment available to the user.
Definition: obsconditions.h:38
GeoLocation
Contains all relevant information for specifying a location on Earth: City Name, State/Province name...
Definition: geolocation.h:39
ObsConditions::ObsConditions
ObsConditions(int bortle, double aperture, Equipment equip, TelescopeType telType)
Constructor.
Definition: obsconditions.cpp:22
KStarsDateTime
Extension of KDateTime for KStars KStarsDateTime can represent the date/time as a Julian Day...
Definition: kstarsdatetime.h:45
dms
An angle, stored as degrees, but expressible in many ways.
Definition: dms.h:42
SkyPoint::EquatorialToHorizontal
void EquatorialToHorizontal(const dms *LST, const dms *lat)
Determine the (Altitude, Azimuth) coordinates of the SkyPoint from its (RA, Dec) coordinates, given the local sidereal time and the observer's latitude.
Definition: skypoint.cpp:55
ObsConditions::setObsConditions
void setObsConditions(int bortle, double aperture, Equipment equip, TelescopeType telType)
Set new observing conditions.
Definition: obsconditions.cpp:107
SkyObject::mag
float mag(void) const
Definition: skyobject.h:182
GeoLocation::lat
const dms * lat() const
Definition: geolocation.h:79
ObsConditions::isVisible
bool isVisible(GeoLocation *geo, dms *lst, SkyObject *so)
Evaluate visibility of sky-object based on current observing conditions.
Definition: obsconditions.cpp:96
SkyObject::recomputeCoords
SkyPoint recomputeCoords(const KStarsDateTime &dt, const GeoLocation *geo=0)
The coordinates for the object on date dt are computed and returned, but the object's internal coordi...
Definition: skyobject.cpp:296
ObsConditions::Invalid
Definition: obsconditions.h:44
ObsConditions::Reflector
Definition: obsconditions.h:44
SkyPoint::alt
const dms & alt() const
Definition: skypoint.h:180
ObsConditions::~ObsConditions
~ObsConditions()
Destructor.
Definition: obsconditions.cpp:43
SkyObject
Provides all necessary information about an object in the sky: its coordinates, name(s), type, magnitude, and QStringLists of URLs for images and webpages regarding the object.
Definition: skyobject.h:46
obsconditions.h
ObsConditions::TelescopeType
TelescopeType
Telescope Type (Reflector/Refractor)
Definition: obsconditions.h:44
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:36:20 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kstars

Skip menu "kstars"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal