Esempio n. 1
0
        public void init()
        {
            if (initialized)
            {
                return;
            }

            och = new ObservingConditions("ASCOM.OCH.ObservingConditions");
            if (tl == null)
            {
                tl = new TraceLogger("", "Wise40.SafeToOpen");
            }
            name              = "Wise40 SafeToOpen";
            driverID          = Const.wiseSafeToOperateDriverID;
            driverDescription = string.Format("ASCOM Wise40.SafeToOpen v{0}", version.ToString());

            if (_profile == null)
            {
                _profile = new Profile()
                {
                    DeviceType = "SafetyMonitor"
                };
            }

            humiditySensor          = new HumiditySensor(this);
            windSensor              = new WindSensor(this);
            sunSensor               = new SunSensor(this);
            cloudsSensor            = new CloudsSensor(this);
            rainSensor              = new RainSensor(this);
            humanInterventionSensor = new HumanInterventionSensor(this);
            _sensors = new List <Sensor>()
            {
                windSensor,
                cloudsSensor,
                rainSensor,
                humiditySensor,
                sunSensor,
                humanInterventionSensor
            };

            tl.Enabled = debugger.Tracing;
            tl.LogMessage("SafetyMonitor", "Starting initialisation");

            _connected = false;

            novas31    = new NOVAS31();
            astroutils = new AstroUtils();
            ascomutils = new Util();

            siteLatitude  = ascomutils.DMSToDegrees("30:35:50.43");
            siteLongitude = ascomutils.DMSToDegrees("34:45:43.86");
            siteElevation = 882.9;
            novas31.MakeOnSurface(siteLatitude, siteLongitude, siteElevation, 0.0, 0.0, ref onSurface);
            novas31.MakeObject(0, Convert.ToInt16(Body.Sun), "Sun", new CatEntry3(), ref Sun);

            ReadProfile(); // Read device configuration from the ASCOM Profile store
            initialized = true;

            tl.LogMessage("SafetyMonitor", "Completed initialisation");
        }
Esempio n. 2
0
        public void init()
        {
            if (_initialized)
            {
                return;
            }

            siteLatitude  = ascomutils.DMSToDegrees("30:35:50.43");
            siteLongitude = ascomutils.DMSToDegrees("34:45:43.86");
            siteElevation = 882.9;
            novas31.MakeOnSurface(siteLatitude, siteLongitude, siteElevation, 0.0, 0.0, ref onSurface);
            refractionOption = Astrometry.RefractionOption.LocationRefraction;

            _initialized = true;
        }
Esempio n. 3
0
        private void buttonOk_Click(object sender, EventArgs e)
        {
            settings.Observatory              = defaultSettings[machine].Observatory;
            settings.Machine                  = machine;
            settings.Server.Address           = textBoxServerAddress.Text.Trim();
            settings.Server.Port              = Convert.ToUInt16(textBoxServerPort.Text.Trim());
            settings.WeatherStationIsReliable = checkBoxLocalWeatherIsReliable.Checked;
            settings.Saved = DateTime.Now;
            settings.Telescope.MonitoringEnabled = checkBoxMonitoringEnabled.Checked;
            settings.Telescope.AltLimit          = ascomutil.DMSToDegrees(textBoxTeleAltLimit.Text);
            settings.Telescope.HourAngle         = ascomutil.HMSToDegrees(textBoxTeleParkingHA.Text);
            settings.Telescope.Declination       = ascomutil.DMSToDegrees(textBoxTeleParkingDec.Text);
            settings.Dome.HomePosition           = ascomutil.DMSToDegrees(textBoxDomeHomePosition.Text);

            File.WriteAllText(settingsFile, JsonConvert.SerializeObject(settings, Formatting.Indented));
            Close();
        }
 private void textBoxLongitude_TextChanged(object sender, EventArgs e)
 {
     if (ts != null)
     {
         var util = new ASCOM.Utilities.Util();
         ts.SiteLongitude      = util.DMSToDegrees(textBoxLongitude.Text);
         textBoxLongitude.Text = util.DegreesToDMS(ts.SiteLongitude);
     }
 }