Changeset 14302 for trunk/FACT++/src/smartfact.cc
- Timestamp:
- 08/02/12 09:56:31 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/smartfact.cc
r14228 r14302 1897 1897 return make_pair(alt, make_pair(maxjd, maxjd>jd+jd0&&maxjd<jd+jd1?max:0)); 1898 1898 } 1899 1900 pair<vector<float>, pair<Time, float>> GetLightCondition(ln_equ_posn *src, ln_lnlat_posn *observer, double jd) 1901 { 1902 jd = floor(jd); 1903 1904 const double jd0 = fmod(fSun.fSetAstronomical.JD(), 1); 1905 const double jd1 = fmod(fSun.fRiseAstronomical.JD(), 1); 1906 1907 ln_equ_posn moon; 1908 1909 double max = -1; 1910 double maxjd = 0; 1911 1912 int cnt = 0; 1913 1914 vector<float> alt; 1915 for (double h=0; h<1; h+=1./(24*12)) 1916 { 1917 double lc = -1; 1918 1919 if (h>jd0 && h<jd1) 1920 { 1921 const double disk = ln_get_lunar_disk(jd+h); 1922 ln_get_lunar_equ_coords(jd+h, &moon); 1923 1924 ln_hrz_posn hrz; 1925 ln_get_hrz_from_equ(&moon, observer, jd+h, &hrz); 1926 1927 Moon m; 1928 m.ra = moon.ra; 1929 m.dec = moon.dec; 1930 1931 const double angle = m.Angle(src->ra, src->dec); 1932 1933 lc = angle*hrz.alt*disk*M_PI*M_PI/180/180; 1934 1935 alt.push_back(lc); 1936 } 1937 1938 if (lc>max) 1939 { 1940 max = lc; 1941 maxjd = jd+h; 1942 } 1943 1944 if (h>jd0 && h<jd1 && lc>0) 1945 cnt++; 1946 } 1947 1948 if (max<=15 || cnt==0) 1949 return make_pair(vector<float>(), make_pair(Time(), 0)); 1950 1951 return make_pair(alt, make_pair(maxjd, maxjd>jd+jd0&&maxjd<jd+jd1?max:0)); 1952 } 1899 1953 #endif 1900 1954 … … 1957 2011 } 1958 2012 1959 ostringstream out2, out3 ;2013 ostringstream out2, out3, out4; 1960 2014 out2 << setprecision(3); 1961 2015 out2 << now.JavaDate() << '\n'; 1962 2016 out3 << now.JavaDate() << '\n'; 2017 out4 << now.JavaDate() << '\n'; 1963 2018 1964 2019 map<Time, pair<string, float>> culmination; 2020 map<Time, pair<string, float>> lightcond; 1965 2021 vector<vector<float>> alt; 1966 2022 … … 1987 2043 out2 << HTML::kWhite << '\t'; 1988 2044 out3 << HTML::kWhite << '\t'; 2045 out4 << HTML::kWhite << '\t'; 1989 2046 1990 2047 for (vector<mysqlpp::Row>::const_iterator v=res.begin(); v<res.end(); v++) … … 2006 2063 alt.push_back(vis.first); 2007 2064 culmination[vis.second.first] = make_pair(name, vis.second.second); 2065 } 2066 2067 const pair<vector<float>, pair<Time, float>> lc = GetLightCondition(&pos, &observer, now.JD()); 2068 if (lc.first.size()>0) 2069 { 2070 alt.push_back(lc.first); 2071 lightcond[lc.second.first] = make_pair(name, lc.second.second); 2008 2072 } 2009 2073 … … 2046 2110 } 2047 2111 2112 for (auto it=lightcond.begin(); it!=lightcond.end(); it++) 2113 { 2114 if (it!=lightcond.begin()) 2115 out4 << ", "; 2116 out4 << "<B>" << it->second.first << "</B>"; 2117 if (it->second.second>0) 2118 out4 << " [" << nearbyint(90-it->second.second) << "°]"; 2119 } 2120 2048 2121 ostringstream title; 2049 2122 title << "Alt "; … … 2057 2130 out2 << '\n'; 2058 2131 out3 << '\n'; 2132 out4 << '\n'; 2059 2133 out << HTML::kWhite << '\t' << Time()-now << '\n'; 2060 2134 out2 << HTML::kWhite << '\t' << Time()-now << '\n'; … … 2069 2143 out2 << HTML::kWhite << '\t' << "ERROR - "+string(e.what()) << '\n'; 2070 2144 out3 << HTML::kWhite << '\t' << "ERROR - "+string(e.what()) << '\n'; 2145 out4 << HTML::kWhite << '\t' << "ERROR - "+string(e.what()) << '\n'; 2071 2146 } 2072 2147 #endif … … 2075 2150 ofstream(fPath+"/source-list.data") << out2.str(); 2076 2151 ofstream(fPath+"/visibility.data") << out3.str(); 2152 ofstream(fPath+"/light-condition.data") << out4.str(); 2077 2153 } 2078 2154 … … 2793 2869 ("pixel-map-file", var<string>("FACTmapV5a.txt"), "Pixel mapping file. Used here to get the default reference voltage") 2794 2870 ("path", var<string>("www/smartfact/data"), "Output path for the data-files") 2795 ("source-database", var<string>( ), "Database link as in\n\tuser:password@server[:port]/database.")2871 ("source-database", var<string>(""), "Database link as in\n\tuser:password@server[:port]/database.") 2796 2872 ("client", po_bool(false), "For a standalone client choose this option.") 2797 2873 ;
Note:
See TracChangeset
for help on using the changeset viewer.