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"); }
public WiseHAEncoder(string name, WiseDecEncoder decEncoder) { WiseName = "HAEncoder"; Novas31 = new Astrometry.NOVAS.NOVAS31(); astroutils = new Astrometry.AstroUtils.AstroUtils(); _decEncoder = decEncoder; axisEncoder = new WiseEncoder("HAAxis", 1 << 16, new List <WiseEncSpec>() { new WiseEncSpec() { brd = hw.teleboard, port = DigitalPortType.FourthPortA, mask = 0xff }, new WiseEncSpec() { brd = hw.teleboard, port = DigitalPortType.FourthPortB, mask = 0xff }, } ); wormEncoder = new WiseEncoder("HAWorm", 1 << 12, new List <WiseEncSpec>() { new WiseEncSpec() { brd = hw.teleboard, port = DigitalPortType.FourthPortCL, mask = 0x0f }, new WiseEncSpec() { brd = hw.teleboard, port = DigitalPortType.ThirdPortA, mask = 0xff }, } ); WiseName = name; if (Simulated) { _angle = new Angle("00h00m00.0s"); } }
public WiseDecEncoder(string name) { WiseName = "DecEncoder"; Novas31 = new Astrometry.NOVAS.NOVAS31(); astroutils = new Astrometry.AstroUtils.AstroUtils(); axisEncoder = new WiseEncoder("DecAxis", 1 << 16, new List <WiseEncSpec>() { new WiseEncSpec() { brd = hw.teleboard, port = DigitalPortType.SecondPortA, mask = 0xff }, // [0] new WiseEncSpec() { brd = hw.teleboard, port = DigitalPortType.SecondPortB, mask = 0xff }, // [1] } ); wormEncoder = new WiseEncoder("DecWorm", 1 << 12, new List <WiseEncSpec>() { new WiseEncSpec() { brd = hw.teleboard, port = DigitalPortType.SecondPortCL, mask = 0x0f }, // [0] new WiseEncSpec() { brd = hw.teleboard, port = DigitalPortType.FirstPortA, mask = 0xff }, // [1] } ); WiseName = name; Angle = Simulated ? Angle.FromDegrees(85, Angle.Type.Dec) : Angle.FromRadians(Radians, Angle.Type.Dec); }
public static double NowLST(LatLon location) { var nov = new Astrometry.NOVAS.NOVAS31(); var ast = new Astrometry.AstroUtils.AstroUtils(); var currJD = ast.JulianDateUT1(0); double lstNow = 0; var res = nov.SiderealTime( currJD, 0d, 0, GstType.GreenwichApparentSiderealTime, Method.EquinoxBased, Accuracy.Full, ref lstNow); if (res != 0) throw new InvalidValueException("Error getting Local Apparent Sidereal time"); return lstNow; }
public void init() { if (initialized) { return; } name = "Wise40 SafeToOperate"; driverDescription = string.Format("{0} v{1}", driverID, version.ToString()); if (_profile == null) { _profile = new Profile() { DeviceType = "SafetyMonitor" }; } WiseSite.initOCH(); WiseSite.och.Connected = true; humiditySensor = new HumiditySensor(this); windSensor = new WindSensor(this); sunSensor = new SunSensor(this); cloudsSensor = new CloudsSensor(this); rainSensor = new RainSensor(this); humanInterventionSensor = new HumanInterventionSensor(this); computerControlSensor = new ComputerControlSensor(this); platformSensor = new PlatformSensor(this); doorLockSensor = new DoorLockSensor(this); pressureSensor = new PressureSensor(this); temperatureSensor = new TemperatureSensor(this); // // The sensors in priotity order. The first one that: // - is enabled // - not bypassed // - forces decision // - is not safe // causes SafeToOperate to be NOT SAFE // _prioritizedSensors = new List <Sensor>() { humanInterventionSensor, // Immediate sensors computerControlSensor, platformSensor, doorLockSensor, sunSensor, // Weather sensors - affecting isSafe windSensor, cloudsSensor, rainSensor, humiditySensor, pressureSensor, // Weather sensors - NOT affecting isSafe temperatureSensor, }; _cumulativeSensors = new List <Sensor>(); foreach (Sensor s in _prioritizedSensors) { if (!s.HasAttribute(Sensor.SensorAttribute.Immediate)) { _cumulativeSensors.Add(s); } } _connected = false; novas31 = new NOVAS31(); astroutils = new AstroUtils(); ascomutils = new Util(); novas31.MakeObject(0, Convert.ToInt16(Body.Sun), "Sun", new CatEntry3(), ref Sun); ReadProfile(); // Read device configuration from the ASCOM Profile store _safetyState = Event.SafetyEvent.SafetyState.Unknown; activityMonitor.Event(new Event.SafetyEvent() { _safetyState = _safetyState, _details = "WiseSafeToOperate.init()", }); initialized = true; }