public ObservationLocation() { iProfile = new Utilities.Profile(); iProfile.DeviceType = "Telescope"; iHelper = new Utilities.Util(); iProgID = Telescope.ProgId; if (iProfile.IsRegistered(Telescope.ProgId)) { String storedLongitude; storedLongitude = iProfile.GetValue(iProgID, "Longitude", ""); if (storedLongitude.Length != 0) { iLongitude = Convert.ToDouble(storedLongitude); } else { iLongitude = 0; } } else { iLongitude = 0; } }
/** * @brief * Calculate the mean Greenwhich Siderial Time for the given GMT * * @param aDate * Date and Time in UTC */ internal double GST(DateTime aDate) { Utilities.Util helper2 = new Utilities.Util(); double JD = helper2.DateUTCToJulian(aDate.Date); double gst0 = GST0(JD); double gst = gst0 + kSiderialSeconds * aDate.TimeOfDay.TotalHours; if (gst >= 24.0) { gst -= 24.0; } return(gst); }
public static double ToSiderealTime(DateTime dt) { var utilities = new Utilities.Util(); double siderealTime = (18.697374558 + 24.065709824419081 * (utilities.DateLocalToJulian(dt) - 2451545.0)) % 24.0; return siderealTime; }
public void RefreshDisplay() { //if (!panelControls.Visible) // return; DateTime now = DateTime.Now; DateTime utc = now.ToUniversalTime(); ASCOM.Utilities.Util u = new Utilities.Util(); labelDate.Text = utc.ToLongDateString(); labelLTValue.Text = now.TimeOfDay.ToString(@"hh\hmm\mss\.f\s"); labelUTValue.Text = utc.TimeOfDay.ToString(@"hh\hmm\mss\.f\s"); labelSiderealValue.Text = wisesite.LocalSiderealTime.ToString(); labelRightAscensionValue.Text = Angle.FromHours(wisetele.RightAscension).ToNiceString(); labelDeclinationValue.Text = Angle.FromDegrees(wisetele.Declination).ToNiceString(); labelHourAngleValue.Text = Angle.FromHours(wisetele.HourAngle, Angle.Type.HA).ToNiceString(); labelNewRA.Text = ""; labelNewRARadians.Text = Angle.FromHours(wisetele.RightAscension).Radians.ToString(); labelNewDec.Text = ""; labelNewDecRadians.Text = Angle.FromDegrees(wisetele.Declination).Radians.ToString(); labelAltitudeValue.Text = Angle.FromDegrees(wisetele.Altitude).ToNiceString(); labelAzimuthValue.Text = Angle.FromDegrees(wisetele.Azimuth).ToNiceString(); labelHAEncValue.Text = wisetele.HAEncoder.Value.ToString(); labelDecEncValue.Text = wisetele.DecEncoder.Value.ToString(); axisValue.Text = wisetele.HAEncoder.AxisValue.ToString(); wormValue.Text = wisetele.HAEncoder.WormValue.ToString(); string why; if (wisesite.computerControl == null) { labelTelescopeComputerControl.ForeColor = Color.Yellow; why = "Cannot read the computer control switch!"; } else if (wisesite.computerControl.IsSafe) { labelTelescopeComputerControl.ForeColor = Color.Green; why = "Computer control is enabled."; } else { labelTelescopeComputerControl.ForeColor = Color.Red; why = why = "Computer control switch is OFF!"; } toolTip.SetToolTip(labelTelescopeComputerControl, why); if (wisesite.safeToOpen == null) { labelTelescopeSafeToOpen.ForeColor = Color.Yellow; why = "Cannot connect to the safeToOpen driver!"; } else if (wisesite.safeToOpen.IsSafe) { labelTelescopeSafeToOpen.ForeColor = Color.Green; why = "Conditions are safe to open the dome."; } else { labelTelescopeSafeToOpen.ForeColor = Color.Red; why = wisesite.safeToOpen.CommandString("unsafeReasons", false); } toolTip.SetToolTip(labelTelescopeSafeToOpen, why); if (wisesite.safeToImage == null) { labelTelescopeSafeToImage.ForeColor = Color.Yellow; why = "Cannot connect to the safeToImage driver!"; } else if (wisesite.safeToImage.IsSafe) { labelTelescopeSafeToImage.ForeColor = Color.Green; why = "Conditions are safe to image."; } else { labelTelescopeSafeToImage.ForeColor = Color.Red; why = wisesite.safeToImage.CommandString("unsafeReasons", false); } toolTip.SetToolTip(labelTelescopeSafeToImage, why); checkBoxPrimaryIsActive.Checked = wisetele.AxisIsMoving(TelescopeAxes.axisPrimary); checkBoxSecondaryIsActive.Checked = wisetele.AxisIsMoving(TelescopeAxes.axisSecondary); string activeSlewers = wisetele.slewers.ToString(); checkBoxSlewingIsActive.Text = (activeSlewers == string.Empty) ? "Slewing" : "Slewing (" + activeSlewers + ")"; checkBoxSlewingIsActive.Checked = wisetele.Slewing; checkBoxTrackingIsActive.Checked = wisetele.Tracking; WiseVirtualMotor m; m = null; if (wisetele.WestMotor.isOn) { m = wisetele.WestMotor; } else if (wisetele.EastMotor.isOn) { m = wisetele.EastMotor; } checkBoxPrimaryIsActive.Text = "Primary"; if (m != null) { checkBoxPrimaryIsActive.Text += ": " + m.Name.Remove(m.Name.IndexOf('M')) + "@" + WiseTele.RateName(m.currentRate).Replace("rate", ""); } m = null; if (wisetele.NorthMotor.isOn) { m = wisetele.NorthMotor; } else if (wisetele.SouthMotor.isOn) { m = wisetele.SouthMotor; } checkBoxSecondaryIsActive.Text = "Secondary"; if (m != null) { checkBoxSecondaryIsActive.Text += ": " + m.Name.Remove(m.Name.IndexOf('M')) + "@" + WiseTele.RateName(m.currentRate).Replace("rate", ""); } checkBoxTrack.Checked = wisetele.Tracking; if (scopeBackgroundMover != null && scopeBackgroundMover.IsBusy) { TextBoxLog.Text = "Working ..."; } if (resultsAvailable) { TextBoxLog.Clear(); if (results.Count == 0) { TextBoxLog.Text = "Cancelled by user!"; } else { TelescopeAxes axis = results[0].axis; for (int i = 0; i < results.Count; i++) { TextBoxLog.Text += string.Format("[{0}]: ({2})\r\n{1}", i, results[i].ToString(), results[i].cancelled ? "cancelled" : "completed"); } } resultsAvailable = false; } if (panelDome.Visible) { labelDomeAzimuthValue.Text = domeSlaveDriver.Azimuth; labelDomeStatusValue.Text = domeSlaveDriver.Status; labelDomeShutterStatusValue.Text = domeSlaveDriver.ShutterStatus; checkBoxVent.Checked = WiseDome.Instance.Vent; } if (groupBoxWeather.Visible) { if (!wisesite.observingConditions.Connected) { string nc = "???"; labelAgeValue.Text = nc; labelCloudCoverValue.Text = nc; labelCloudCoverValue.Text = nc; labelDewPointValue.Text = nc; labelSkyTempValue.Text = nc; labelTempValue.Text = nc; labelHumidityValue.Text = nc; labelPressureValue.Text = nc; labelRainRateValue.Text = nc; labelWindSpeedValue.Text = nc; labelWindDirValue.Text = nc; } else { try { ObservingConditions oc = wisesite.observingConditions; labelAgeValue.Text = ((int)Math.Round(oc.TimeSinceLastUpdate(""), 2)).ToString() + "sec"; double d = oc.CloudCover; if (d == 0.0) { labelCloudCoverValue.Text = "Clear"; } else if (d == 50.0) { labelCloudCoverValue.Text = "Cloudy"; } else if (d == 90.0) { labelCloudCoverValue.Text = "VeryCloudy"; } else { labelCloudCoverValue.Text = "Unknown"; } labelDewPointValue.Text = oc.DewPoint.ToString() + "°C"; labelSkyTempValue.Text = oc.SkyTemperature.ToString() + "°C"; labelTempValue.Text = oc.Temperature.ToString() + "°C"; labelHumidityValue.Text = oc.Humidity.ToString() + "%"; labelPressureValue.Text = oc.Pressure.ToString() + "mB"; labelRainRateValue.Text = (oc.RainRate > 0.0) ? "Wet" : "Dry"; labelWindSpeedValue.Text = oc.WindSpeed.ToString() + "m/s"; labelWindDirValue.Text = oc.WindDirection.ToString() + "°"; } catch (PropertyNotImplementedException e) { debugger.WriteLine(Debugger.DebugLevel.DebugLogic, "OC: exception: {0}", e.Message); } } } if (panelFocuser.Visible) { labelFocusCurrentValue.Text = wisefocuser.position.ToString();; } }
/** * @brief * Calculate the mean Greenwhich Siderial Time for the given GMT * * @param aDate * Date and Time in UTC */ internal double GST(DateTime aDate) { Utilities.Util helper2 = new Utilities.Util(); double JD = helper2.DateUTCToJulian(aDate.Date); double gst0 = GST0(JD); double gst = gst0 + kSiderialSeconds * aDate.TimeOfDay.TotalHours; if (gst >= 24.0) { gst -= 24.0; } return gst; }