double CSunRiseSet::calcSunsetGMT(int iJulDay, double dLatitude, double dLongitude) { // First calculates sunrise and approx length of day double dGamma = CalcGamma(iJulDay + 1); double eqTime = CalcEqofTime(dGamma); double solarDec = CalcSolarDec(dGamma); double hourAngle = CalcHourAngle(dLatitude, solarDec, 0); double delta = dLongitude - dRadToDeg(hourAngle); double timeDiff = 4 * delta; double setTimeGMT = 720 + timeDiff - eqTime; // first pass used to include fractional day in gamma calc double gamma_sunset = CalcGamma2(iJulDay, setTimeGMT/60); eqTime = CalcEqofTime(gamma_sunset); solarDec = CalcSolarDec(gamma_sunset); hourAngle = CalcHourAngle(dLatitude, solarDec, false); delta = dLongitude - dRadToDeg(hourAngle); timeDiff = 4 * delta; setTimeGMT = 720 + timeDiff - eqTime; // in minutes return setTimeGMT; }
void cPositioner::StartMovementTimer(int Longitude) { if (Setup.PositionerSpeed <= 0) return; cMutexLock MutexLock(&mutex); lastLongitude = CurrentLongitude(); // in case the dish was already in motion targetLongitude = Longitude; lastHourAngle = CalcHourAngle(lastLongitude); targetHourAngle = CalcHourAngle(targetLongitude); swingTime = abs(targetHourAngle - lastHourAngle) * 1000 / Setup.PositionerSpeed; // time (ms) it takes to move the dish from lastHourAngle to targetHourAngle movementStart.Set(); Setup.PositionerLastLon = targetLongitude; }
cPositioner::cPositioner(void) { capabilities = pcCanNothing; frontend = -1; targetLongitude = lastLongitude = Setup.PositionerLastLon; targetHourAngle = lastHourAngle = CalcHourAngle(lastLongitude); swingTime = 0; delete positioner; positioner = this; }
double CSunRiseSet::calcSunriseGMT(int iJulDay, double dLatitude, double dLongitude) { // *** First pass to approximate sunrise double gamma = CalcGamma(iJulDay); double eqTime = CalcEqofTime(gamma); double solarDec = CalcSolarDec(gamma); double hourAngle = CalcHourAngle(dLatitude, solarDec, true); double delta = dLongitude - dRadToDeg(hourAngle); double timeDiff = 4 * delta; double timeGMT = 720 + timeDiff - eqTime; // *** Second pass includes fractional jday in gamma calc double gamma_sunrise = CalcGamma2(iJulDay, timeGMT/60); eqTime = CalcEqofTime(gamma_sunrise); solarDec = CalcSolarDec(gamma_sunrise); hourAngle = CalcHourAngle(dLatitude, solarDec, 1); delta = dLongitude - dRadToDeg(hourAngle); timeDiff = 4 * delta; timeGMT = 720 + timeDiff - eqTime; // in minutes return timeGMT; }