Exemplo n.º 1
0
        private void GNSS_RMCSentenceReceived(object sender, RMCMessageEventArgs e)
        {
            AUXGNSSTimeoutTS = 0;
            AUXGNSSTimeout   = false;

            if (e.IsValid)
            {
                AUXLatitude.Value  = e.Latitude;
                AUXLongitude.Value = e.Longitude;
                if (!double.IsNaN(e.TrackTrue))
                {
                    AUXTrack.Value = e.TrackTrue;
                }
                if (!double.IsNaN(e.SpeedKmh))
                {
                    AUXSpeed.Value = e.SpeedKmh;
                }

                gnssTimeFix        = e.TimeFix;
                gnssTimeFixLocalTS = DateTime.Now;

                UpdateDistanceToTarget();

                LocationUpdatedEvent.Rise(this, new LocationUpdatedEventArgs("AUX GNSS", e.Latitude, e.Longitude, 0.0, true, e.TimeFix));
                OnSystemUpdate();
            }
        }
Exemplo n.º 2
0
        private void pCore_TargetLocationUpdatedExEventHandler(object sender, TargetLocationUpdatedExEventArgs e)
        {
            targetFixTimeStamp           = e.TimeStamp;
            TargetCourse.Value           = e.Course;
            IsRadialErrorExeedsThreshold = false;

            LocationUpdatedEvent.Rise(this,
                                      new LocationUpdatedEventArgs("RWLT (RAW)",
                                                                   e.Location.Latitude, e.Location.Longitude, e.Location.Depth,
                                                                   e.Location.RadialError <= pCore.RadialErrorThreshold,
                                                                   e.TimeStamp));


            GeoPoint locationFlt = new GeoPoint();

            if (TargetDepth.IsInitialized)
            {
                locationFlt = trkFilter.Filter(e.Location.Latitude, e.Location.Longitude);
            }
            else
            {
                locationFlt = new GeoPoint(e.Location.Latitude, e.Location.Longitude);
            }

            LocationUpdatedEvent.Rise(this,
                                      new LocationUpdatedEventArgs("RWLT (FLT)",
                                                                   locationFlt.Latitude, locationFlt.Longitude, e.Location.Depth,
                                                                   e.Location.RadialError <= pCore.RadialErrorThreshold,
                                                                   e.TimeStamp));

            if (isStatistics)
            {
                UpdateStat(locationFlt.Latitude, locationFlt.Longitude);
            }


            if (OutPortUsed)
            {
                double wTemp = double.NaN;
                if (TargetTemperature.IsInitialized)
                {
                    wTemp = TargetTemperature.Value;
                }

                WriteOutData(locationFlt.Latitude,
                             locationFlt.Longitude,
                             e.Location.Depth,
                             e.Location.RadialError,
                             e.Course,
                             e.Location.RadialError <= pCore.RadialErrorThreshold,
                             wTemp);
            }

            TargetLocationRadialError.Value = e.Location.RadialError;
            TargetLatitude.Value            = locationFlt.Latitude;
            TargetLongitude.Value           = locationFlt.Longitude;

            UpdateDistanceToTarget();
        }
Exemplo n.º 3
0
 public void MarkCurrentLocation()
 {
     if (TargetLatitude.IsInitialized && TargetLongitude.IsInitialized)
     {
         LocationUpdatedEvent.Rise(this,
                                   new LocationUpdatedEventArgs("Marked", TargetLatitude.Value, TargetLongitude.Value,
                                                                TargetDepth.IsInitialized ? TargetDepth.Value : 0.0, true, targetFixTimeStamp));
     }
 }
 public void Apply(LocationUpdatedEvent e)
 {
     Locations.Add(new LocationEntity()
     {
         Longitude = e.Longitude,
         Latitude  = e.Latitude,
         Zindex    = e.ZIndex,
         TimeStamp = e.TimeStamp
     });
 }
Exemplo n.º 5
0
        private void OnLBLA(object[] parameters)
        {
            // IC_D2H_LBLA $PRWLA,bID,baseLat,baseLon,[baseDpt],baseBat,pingerDataID,pingerData,TOAsecond,MSR_dB
            BaseIDs baseID = (parameters[0] == null) ? BaseIDs.BASE_INVALID : (BaseIDs)(int)parameters[0];

            double baseLat   = doubleNullChecker(parameters[1]);
            double baseLon   = doubleNullChecker(parameters[2]);
            double baseDepth = (parameters[3] == null) ? RWLT.DEFAULT_BASE_DPT_M : (double)parameters[3];

            double        baseBat = doubleNullChecker(parameters[4]);
            PingerDataIDs pDataID = (parameters[5] == null) ? PingerDataIDs.DID_INVALID : (PingerDataIDs)(int)parameters[5];
            double        pData   = doubleNullChecker(parameters[6]);
            double        TOAs    = doubleNullChecker(parameters[7]);
            double        MSR     = doubleNullChecker(parameters[8]);

            if ((baseID != BaseIDs.BASE_INVALID) &&
                (!double.IsNaN(baseLat)) &&
                (!double.IsNaN(baseLon)) &&
                (!double.IsNaN(baseDepth)))
            {
                if ((baseID == auxGNSSBuoyID) && (!AUXGNSSUsed))
                {
                    GNSS_RMCSentenceReceived(this,
                                             new RMCMessageEventArgs(0xFF,
                                                                     TalkerIdentifiers.GN,
                                                                     GetTimeStamp(),
                                                                     baseLat,
                                                                     baseLon,
                                                                     double.NaN,
                                                                     double.NaN,
                                                                     double.NaN,
                                                                     true));
                }

                LocationUpdatedEvent.Rise(this, new LocationUpdatedEventArgs(baseID.ToString().Replace('_', ' '),
                                                                             baseLat, baseLon, baseDepth,
                                                                             true,
                                                                             GetTimeStamp()));

                if (!double.IsNaN(MSR))
                {
                    BaseMSRs[baseID].Value = MSR;
                }

                if (!double.IsNaN(baseBat))
                {
                    BaseBatVoltages[baseID].Value = baseBat;
                }

                if (gravityAccNeedsUpdate)
                {
                    gravityAcc            = PHX.Gravity_constant_wgs84_calc(baseLat);
                    gravityAccNeedsUpdate = false;
                }

                if (pDataID == PingerDataIDs.DID_BAT)
                {
                    TargetBatVoltage.Value = pData;
                }
                else if (pDataID == PingerDataIDs.DID_TMP)
                {
                    TargetTemperature.Value = pData;
                    if (IsAutoSoundSpeed && TargetPressure.IsInitialized)
                    {
                        Soundspeed = PHX.Speed_of_sound_UNESCO_calc(TargetTemperature.Value, TargetPressure.Value / 2.0, salinity);
                    }
                }
                else if (pDataID == PingerDataIDs.DID_PRS)
                {
                    TargetPressure.Value = pData;
                    if (TargetTemperature.IsInitialized)
                    {
                        if (IsAutoSoundSpeed)
                        {
                            Soundspeed = PHX.Speed_of_sound_UNESCO_calc(TargetTemperature.Value, TargetPressure.Value / 2.0, salinity);
                        }

                        double rho = PHX.Water_density_calc(TargetTemperature.Value, TargetPressure.Value / 2.0, salinity);
                        // p0 is zero, because pinger calibrates surface pressure on start and transmits pressure relative to the surface
                        TargetDepth.Value = PHX.Depth_by_pressure_calc(TargetPressure.Value, 0, rho, gravityAcc);
                    }
                    else if (TargetPressure.IsInitialized)
                    {
                        TargetDepth.Value = PHX.Depth_by_pressure_calc(TargetPressure.Value, 0, PHX.PHX_FWTR_DENSITY_KGM3, gravityAcc);
                    }
                }
                else if (pDataID == PingerDataIDs.DID_CODE)
                {
                    TargetAlarm.Value = (PingerCodeIDs)Enum.ToObject(typeof(PingerCodeIDs), Convert.ToInt32(pData));
                }

                var bases = baseProcessor.ProcessBase(baseID, baseLat, baseLon, baseDepth, TOAs);
                if (bases != null)
                {
                    TryLocate(bases);
                }
            }

            OnSystemUpdate();
        }