59 if (!conf.DoParse(argc, argv))
71 if (conf.Has(
"date-time"))
72 time.
SetFromStr(conf.Get<
string>(
"date-time"));
74 const double max_current = conf.Get<
double>(
"max-current");
75 const double max_zd = conf.Get<
double>(
"max-zd");
76 const double no_limits = conf.Get<
bool>(
"no-limits");
82 const double jd = floor(time.
Mjd())+2400001;
83 const double mjd = floor(time.
Mjd())+49718+0.5;
86 const double jd0 = fmod(sun_set.set, 1);
87 const double jd1 = fmod(sun_rise.rise, 1);
89 cout <<
Time::iso << time <<
", " << mjd-49718 <<
", ";
93 if (!conf.Has(
"source-name"))
96 const string source_name = conf.Get<
string>(
"source-name");
97 const string fDatabase = conf.Get<
string>(
"source-database");
101 const mysqlpp::StoreQueryResult res =
102 Database(fDatabase).query(
"SELECT fRightAscension, fDeclination FROM Source WHERE fSourceName='"+source_name+
"'").store();
106 vector<mysqlpp::Row>::const_iterator row=res.begin();
111 pos.ra = double((*row)[0])*15;
112 pos.dec = double((*row)[1]);
115 for (
int i=0;
i<24*12;
i++)
117 const double h = double(
i)/(24*12);
132 const double ratio = pow(cos((90-hrz.alt)*M_PI/180), -2.664);
138 t += boost::posix_time::minutes(
i*5);
140 cout <<
t <<
", " << h <<
", ";
142 if (no_limits || cur<max_current)
146 if (no_limits || 90-hrz.alt<max_zd)
150 if (no_limits || (cur<max_current && 90-hrz.alt<max_zd))
151 cout << ratio*cur/6.2;
154 if (no_limits || (cur<max_current && 90-hrz.alt<max_zd))
Adds some functionality to boost::posix_time::ptime for our needs.
void SetupConfiguration(Configuration &conf)
static const _time_format iso
set to format to the sql format (without the fraction of seconds)
Warning because the service this data corrsponds to might have been last updated longer ago than Local time
Commandline parsing, resource file parsing and database access.
void SetFromStr(const std::string &str, const char *fmt="%Y-%m-%d %H:%M:%S")
RstTime GetSolarRst(double jd, const LnLatPosn &obs, double hrz=LN_SOLAR_STANDART_HORIZON)
HrzPosn GetHrzFromEqu(const EquPosn &equ, const LnLatPosn &obs, double jd)
double GetAngularSeparation(const EquPosn &p1, const EquPosn &p2)
double PredictI(const Nova::SolarObjects &so, const Nova::EquPosn &srcEqu)