public void RangeInput() { PredictionModel model = new PredictionModel(); PredictionModelInput input = new PredictionModelInput(); input.CWPON = true; input.CWPBB_TransmitPulseType = Commands.AdcpSubsystemCommands.eCWPBB_TransmitPulseType.BROADBAND; input.CWPBS = 4.0f; input.CWPBN = 30; input.CWPBL = 1.00f; input.CBTON = true; input.CBTBB_TransmitPulseType = Commands.AdcpSubsystemCommands.eCBTBB_Mode.BROADBAND_CODED; input.SystemFrequency = 288000.0; input.BeamDiameter = 0.075; input.CyclesPerElement = 12; input.BeamAngle = 20; input.SpeedOfSound = 1490; input.CWPBB_LagLength = 1.0; input.BroadbandPower = true; PredictionModel.PredictedRanges ranges = model.GetPredictedRange(input); double correctWpRange = 100.05; double correctBtRange = 199.14; double correctFirstBin = 5.484; double correctWpRangeUserSettings = input.CWPBL + (input.CWPBS * input.CWPBN); Assert.AreEqual(correctWpRange, ranges.WaterProfile, 0.01); Assert.AreEqual(correctBtRange, ranges.BottomTrack, 0.01); Assert.AreEqual(correctFirstBin, ranges.FirstBinPosition, 0.01); Assert.AreEqual(correctWpRangeUserSettings, ranges.ProfileRangeSettings); }
public void RangeNB() { PredictionModel model = new PredictionModel(); bool _CWPON_ = true; Commands.AdcpSubsystemCommands.eCWPBB_TransmitPulseType _CWPBB_TransmitPulseType_ = Commands.AdcpSubsystemCommands.eCWPBB_TransmitPulseType.NARROWBAND; double _CWPBS_ = 4.0; double _CWPBN_ = 30.0; double _CWPBL_ = 1.00; bool _CBTON_ = true; Commands.AdcpSubsystemCommands.eCBTBB_Mode _CBTBB_TransmitPulseType_ = Commands.AdcpSubsystemCommands.eCBTBB_Mode.NARROWBAND_LONG_RANGE; double _SystemFrequency_ = 288000.0; double _BeamDiameter_ = 0.075; double _CyclesPerElement_ = 12.0; double _BeamAngle_ = 20; double _SpeedOfSound_ = 1490; double _CWPBB_LagLength_ = 1.0; bool _BroadbandPower_ = true; double temperature = 10.0; double salinity = 35.0; double xdcrDepth = 0.0; PredictionModel.PredictedRanges ranges = model.GetPredictedRange(_CWPON_, _CWPBB_TransmitPulseType_, _CWPBS_, _CWPBN_, _CWPBL_, _CBTON_, _CBTBB_TransmitPulseType_, _SystemFrequency_, _BeamDiameter_, _CyclesPerElement_, _BeamAngle_, _SpeedOfSound_, _CWPBB_LagLength_, _BroadbandPower_, salinity, temperature, xdcrDepth); double correctWpRange = 152.57; double correctBtRange = 319.14; double correctFirstBin = 5.025; double correctWpRangeUserSettings = _CWPBL_ + (_CWPBS_ * _CWPBN_); Assert.AreEqual(correctWpRange, ranges.WaterProfile, 0.01); Assert.AreEqual(correctBtRange, ranges.BottomTrack, 0.01); Assert.AreEqual(correctFirstBin, ranges.FirstBinPosition); Assert.AreEqual(correctWpRangeUserSettings, ranges.ProfileRangeSettings); }
/// <summary> /// Setup the predictor. /// </summary> public void CalcPrediction() { if (_pm.SelectedProject.Configuration.SubsystemConfigDict.ContainsKey(ConfigKey)) { PredictionModelInput predInput = new PredictionModelInput(_pm.SelectedProject.Configuration.SubsystemConfigDict[ConfigKey].SubsystemConfig.SubSystem); if (_pm.SelectedProject.Configuration.DeploymentOptions.Duration <= 0) { predInput.DeploymentDuration = 1; } else { predInput.DeploymentDuration = _pm.SelectedProject.Configuration.DeploymentOptions.Duration; } // Absorption predInput.Temperature = _pm.SelectedProject.Configuration.Commands.CWT; predInput.Salinity = _pm.SelectedProject.Configuration.Commands.CWS; predInput.XdcrDepth = _pm.SelectedProject.Configuration.Commands.CTD; predInput.CEI = _pm.SelectedProject.Configuration.Commands.CEI.ToSecondsD(); predInput.CWPON = _pm.SelectedProject.Configuration.SubsystemConfigDict[ConfigKey].Commands.CWPON; predInput.CBTON = _pm.SelectedProject.Configuration.SubsystemConfigDict[ConfigKey].Commands.CBTON; predInput.CBTTBP = _pm.SelectedProject.Configuration.SubsystemConfigDict[ConfigKey].Commands.CBTTBP; predInput.CBTBB_TransmitPulseType = _pm.SelectedProject.Configuration.SubsystemConfigDict[ConfigKey].Commands.CBTBB_Mode; //predInput.CBTBB_TransmitPulseType = Commands.AdcpSubsystemCommands.eCBTBB_Mode.NARROWBAND_LONG_RANGE; // DEFAULT to narrowband because it autoswitches now predInput.CWPTBP = _pm.SelectedProject.Configuration.SubsystemConfigDict[ConfigKey].Commands.CWPTBP; predInput.CWPBN = _pm.SelectedProject.Configuration.SubsystemConfigDict[ConfigKey].Commands.CWPBN; predInput.CWPBS = _pm.SelectedProject.Configuration.SubsystemConfigDict[ConfigKey].Commands.CWPBS; predInput.CWPBL = _pm.SelectedProject.Configuration.SubsystemConfigDict[ConfigKey].Commands.CWPBL; predInput.CWPBB_TransmitPulseType = _pm.SelectedProject.Configuration.SubsystemConfigDict[ConfigKey].Commands.CWPBB_TransmitPulseType; predInput.CWPBB_LagLength = _pm.SelectedProject.Configuration.SubsystemConfigDict[ConfigKey].Commands.CWPBB_LagLength; predInput.CWPP = _pm.SelectedProject.Configuration.SubsystemConfigDict[ConfigKey].Commands.CWPP; predInput.BatteryType = _pm.SelectedProject.Configuration.DeploymentOptions.BatteryType; predInput.CBI_BurstInterval = _pm.SelectedProject.Configuration.SubsystemConfigDict[ConfigKey].Commands.CBI_BurstInterval.ToSecondsD(); predInput.CBI_SamplesPerBurst = _pm.SelectedProject.Configuration.SubsystemConfigDict[ConfigKey].Commands.CBI_NumEnsembles; predInput.CBI_IsInterleaved = _pm.SelectedProject.Configuration.SubsystemConfigDict[ConfigKey].Commands.CBI_BurstPairFlag; // Create Prediction model PredictionModel Predictor = new PredictionModel(); // Set the prediction values PredictionModel.PredictedRanges ranges = Predictor.GetPredictedRange(predInput); PredictedBottomRange = ranges.BottomTrack; PredictedProfileRange = ranges.WaterProfile; ProfileFirstBinPosition = ranges.FirstBinPosition.ToString("0.0000"); double maxVel = Predictor.GetMaxVelocity(predInput); MaximumVelocity = maxVel.ToString("0.0000"); double std = Predictor.GetStandardDeviation(predInput); StandardDeviation = std.ToString("0.0000"); double numBatts = Predictor.BatteryUsage(predInput); NumberBatteryPacks = numBatts; if (CBI_NumEnsembles > 0) { NumberBytes = Predictor.GetDataStorageBurst(predInput); } else { NumberBytes = Predictor.GetDataStorage(predInput); } if (RangeVM != null) { // Update all the properites RangeVM.WaterProfileRange = ranges.WaterProfile; RangeVM.BottomTrackRange = ranges.BottomTrack; RangeVM.WpBlank = predInput.CWPBL; RangeVM.WpFirstBinRange = ranges.FirstBinPosition; if (_pm.IsProjectSelected && _pm.SelectedProject.Configuration != null) { RangeVM.DepthToBottom = predInput.XdcrDepth; } } //this.NotifyOfPropertyChange(() => this.CWPP); //this.NotifyOfPropertyChange(() => this.CWPTBP); //this.NotifyOfPropertyChange(() => this.CWPBS); //this.NotifyOfPropertyChange(() => this.CWPBN); //this.NotifyOfPropertyChange(() => this.CWPBL); //this.NotifyOfPropertyChange(() => this.CWPBB_TransmitPulseType); //this.NotifyOfPropertyChange(() => this.CWPBB_LagLength); //this.NotifyOfPropertyChange(() => this.CBTON); //this.NotifyOfPropertyChange(() => this.CBI_BurstInterval); //this.NotifyOfPropertyChange(() => this.DataSize); //this.NotifyOfPropertyChange(() => this.NumberBatteryPackStr); //this.NotifyOfPropertyChange(() => this.PredictedBottomRangeStr); //this.NotifyOfPropertyChange(() => this.PredictedProfileRangeStr); //this.NotifyOfPropertyChange(() => this.ProfileFirstBinPosition); //this.NotifyOfPropertyChange(() => this.MaximumVelocity); //this.NotifyOfPropertyChange(() => this.StandardDeviation); } }