/// <summary> /// Initialize the event. /// </summary> /// <param name="ensemble">Ensemble to send in event.</param> /// <param name="source">Source of the ensemble.</param> /// <param name="type">Type of ensemble: single or averaged. Default is SINGLE.</param> /// <param name="origDataFormat">Original data forma.</param> public EnsembleRawEvent(DataSet.Ensemble ensemble, EnsembleSource source, EnsembleType type = EnsembleType.Single, AdcpCodec.CodecEnum origDataFormat = AdcpCodec.CodecEnum.Binary) { Ensemble = ensemble; Source = source; Type = type; OrigDataFormat = origDataFormat; }
/// <summary> /// Add the NMEA data to the codec. /// </summary> /// <param name="data">NMEA data.</param> /// <param name="source">Ensemble source.</param> /// <returns>Negative value indicates an error.</returns> public int AddNmeaData(byte[] data, EnsembleSource source) { // Convert the data to ASCII string ascii = System.Text.ASCIIEncoding.ASCII.GetString(data); // Add data to codec _codec.AddNmeaData(ascii); log.Debug(string.Format("Add NMEA data: {0}", ascii)); return(data.Length); }
/// <summary> /// Ensemble data to add to the codec. /// </summary> /// <param name="data">Ensemble data.</param> /// <returns>Negative number indicates an error.</returns> public int AddData(byte[] data, EnsembleSource source) { // Add data to codec, set flags for data to decode _codec.AddIncomingData(data, _options.IsRTB, _options.IsRTD, _options.IsPD0, _options.IsPD6_13, _options.IsPD4_5); log.Debug(string.Format("Add data to codec: Source: {0} Count: {1} IsRTB: {2} IsRTD: {3} IsPD0 {4} IsPD6_13: {5} IsPD4_5: {6}", source, data.Length, _options.IsRTB, _options.IsRTD, _options.IsPD0, _options.IsPD6_13, _options.IsPD4_5)); return(data.Length); }
/// <summary> /// Process the ensemble to display on the dashboard. /// </summary> /// <param name="ensemble">Latest ensemble.</param> /// <param name="source">Source of the data.</param> public void ProcessEnsemble(DataSet.Ensemble ensemble, EnsembleSource source) { // Set the latest ensemble _ensemble = ensemble; //Application.Current.Dispatcher.Invoke((System.Action)delegate //{ // Process the information ProcessData(); // Update the display NotifyOfPropertyChange(null); //}); }
/// <summary> /// Process the ensembles. Look for new subsystem configurations with each ensemble. /// </summary> /// <param name="ensemble"></param> /// <param name="source"></param> /// <param name="dataFormat"></param> /// <returns></returns> public void ProcessEnsemble(Ensemble ensemble, EnsembleSource source, AdcpCodec.CodecEnum dataFormat) { if (ensemble != null && ensemble.IsEnsembleAvail) { // Create subsystem config ViewSubsystemConfig config = new ViewSubsystemConfig(ensemble.EnsembleData.SubsystemConfig, source); // Check if the config exist already if (!_dictSsConfig.ContainsKey(config)) { // Create the viewmodel for each subsystem config/source found DashboardSubsystemConfigViewModel vm = new DashboardSubsystemConfigViewModel(config); // Add the vm to the list _dictSsConfig.Add(config, vm); // Add to the list of subsystems Application.Current.Dispatcher.Invoke((System.Action) delegate { SsConfigList.Add(vm); }); log.Debug(string.Format("Add configuration {0}", config.Config.DescString())); // Select the last config add SelectedSsConfigIndex = SsConfigList.Count(); // Pass the ensemble to the viewmodel vm.ProcessEnsemble(ensemble, source); //return config; } else { // Viewmodel already exist, so send the ensemble //DashboardSubsystemConfigViewModel vm = null; //if (_dictSsConfig.TryGetValue(config, out vm)) //{ // vm.ProcessEnsemble(ensemble, source); //} //return config; } } // Not a valid ensemble //return null; }
/// <summary> /// Configuration of the Subsystem data. /// This will determine where the data comes from /// and where it should go based off the SubsystemConfiguration. /// </summary> /// <param name="ssConfig">Subsystem Configuration.</param> /// <param name="source">Ensemble source.</param> public SubsystemDataConfig(SubsystemConfiguration ssConfig, EnsembleSource source) : base(ssConfig.SubSystem, ssConfig.CepoIndex, ssConfig.SubsystemConfigIndex) { Source = source; }
/// <summary> /// Configuration of the Subsystem data. /// This will determine where the data comes from /// and where it should go based off the SubsystemConfiguration. /// </summary> /// <param name="ss">Subsystem for the configuration.</param> /// <param name="cepoIndex">CEPO index.</param> /// <param name="ssConfigIndex">SubsystemConfiguration Index.</param> /// <param name="source">Source of the data.</param> public SubsystemDataConfig(Subsystem ss, byte cepoIndex, byte ssConfigIndex, EnsembleSource source) : base(ss, cepoIndex, ssConfigIndex) { // Initialize values Source = source; }
/// <summary> /// Process the ensemble. /// Cause a blink. /// </summary> /// <param name="ensemble"></param> /// <param name="source"></param> /// <param name="dataFormat"></param> /// <returns></returns> public void ProcessEnsemble(Ensemble ensemble, EnsembleSource source, AdcpCodec.CodecEnum dataFormat) { // Cause a blink }
/// <summary> /// Initialize the event. /// </summary> /// <param name="ensemble">Ensemble to send in event.</param> /// <param name="source">Source of the ensemble.</param> /// <param name="type">Type of ensemble: single or averaged. Default is SINGLE.</param> /// <param name="ms">Mouse Selection.</param> public SelectedEnsembleEvent(DataSet.Ensemble ensemble, EnsembleSource source, EnsembleType type = EnsembleType.Single, ContourPlotMouseSelection ms = null) { Ensemble = ensemble; Source = source; Type = type; }
/// <summary> /// Receive a bulk package of ensembles. This is usually all the /// ensembles in the project. /// The cache contains the row ID and the ensemble. /// </summary> /// <param name="ensembles">Cache of ensembles.</param> /// <param name="source">Source of the ensembles. Playback or live.</param> /// <param name="type">Type of ensembles: Averaged or not.</param> public BulkEnsembleEvent(Cache <long, DataSet.Ensemble> ensembles, EnsembleSource source, EnsembleType type = EnsembleType.Single) { Ensembles = ensembles; Source = source; Type = type; }
/// <summary> /// Initialize the event. /// </summary> /// <param name="ensemble">Ensemble to send in event.</param> /// <param name="source">Source of the ensemble.</param> /// <param name="type">Type of ensemble: single or averaged. Default is SINGLE.</param> public EnsembleEvent(DataSet.Ensemble ensemble, EnsembleSource source, EnsembleType type = EnsembleType.Single) { Ensemble = ensemble; Source = source; Type = type; }
/// <summary> /// Initialize the values. /// </summary> /// <param name="config">Subystem configuration.</param> /// <param name="source">Ensemble source.</param> public ViewSubsystemConfig(SubsystemConfiguration config, EnsembleSource source) { Config = config; Source = source; }
/// <summary> /// Initalize. /// </summary> public ViewSubsystemConfig() { Config = new SubsystemConfiguration(); Source = EnsembleSource.Serial; }
/// <summary> /// Screen the ensemble. Then pass it along to the average layer. /// </summary> /// <param name="data">Raw binary Ensemble.</param> /// <param name="ensemble">Ensemble object.</param> /// <param name="source">Source of the ensemble.</param> /// <param name="dataFormat">Format of the ensemble.</param> /// <returns>Negative number indicates an error.</returns> public int ScreenEnsemble(byte[] data, Ensemble ensemble, EnsembleSource source, AdcpCodec.CodecEnum dataFormat) { // Fill in for missing data if only Bottom Track is turned on FillInMissingWpData(ref ensemble); // Screen for bad heading ScreenData.ScreenBadHeading.Screen(ref ensemble, _prevHeading); SetPreviousHeading(ensemble); // Force 3 Beam Solution if (_Options.IsForce3BeamSolution) { ScreenData.ScreenForce3BeamSolution.Force3BeamSolution(ref ensemble, _Options.Force3BeamSolutionBeam, dataFormat); } // Force 3 Beam Bottom Track solution if (_Options.IsForceBt3BeamSolution) { ScreenData.ScreenForce3BeamSolution.Force3BottomTrackBeamSolution(ref ensemble, _Options.ForceBt3BeamSolutionBeam, dataFormat); } // Retransform the data if (_Options.IsRetransformData) { // PD0 has a different cooridiate matrix // And the beams are in different positions Transform.ProfileTransform(ref ensemble, dataFormat, _Options.RetransformWpCorrThresh, _Options.RetransformHeadingSource, _Options.RetransformHeadingOffset); Transform.BottomTrackTransform(ref ensemble, dataFormat, _Options.RetransformBtCorrThresh, _Options.RetransformBtSnrThresh, _Options.RetransformHeadingSource, _Options.RetransformHeadingOffset); // WaterMass transform data // This will also create the ship data if (ensemble.IsInstrumentWaterMassAvail) { Transform.WaterMassTransform(ref ensemble, dataFormat, _Options.RetransformBtCorrThresh, _Options.RetransformBtSnrThresh, _Options.RetransformHeadingSource, _Options.RetransformHeadingOffset, 0.0f); } } // Mark Bad Below Bottom if (_Options.IsMarkBadBelowBottom) { ScreenData.ScreenMarkBadBelowBottom.Screen(ref ensemble, _prevBtRange); } // Remove Ship Speed if (_Options.IsRemoveShipSpeed) { ScreenData.RemoveShipSpeed.RemoveVelocity(ref ensemble, _prevBtEast, _prevBtNorth, _prevBtVert, _Options.IsRemoveShipSpeedBottomTrack, _Options.IsRemoveShipSpeedGps, _Options.RemoveShipSpeedHeadingOffset); ScreenData.RemoveShipSpeed.RemoveVelocityInstrument(ref ensemble, _prevShipSpeedX, _prevShipSpeedY, _prevShipSpeedZ, _Options.IsRemoveShipSpeedBottomTrack, _Options.IsRemoveShipSpeedGps, _Options.RemoveShipSpeedHeadingOffset); ScreenData.RemoveShipSpeed.RemoveVelocityShip(ref ensemble, _prevShipSpeedTransverse, _prevShipSpeedLongitudinal, _prevShipSpeedNormal, _Options.IsRemoveShipSpeedBottomTrack, _Options.IsRemoveShipSpeedGps, _Options.RemoveShipSpeedHeadingOffset); // Create the new velocity vectors based off the new data DataSet.VelocityVectorHelper.CreateVelocityVector(ref ensemble); } // Record the previous ship speed values SetPreviousShipSpeed(ensemble); // Pass the ensemble to the Processed Ensemble Layer foreach (var vm in IoC.GetAllInstances(typeof(IProcessEnsLayer))) { ((IRecordEnsLayer)vm).RecordEnsemble(data, ensemble, EnsembleSource.Serial, dataFormat); } return(0); }