From d09adfa7a1fa11cfeeb78c648d17f692febc28b5 Mon Sep 17 00:00:00 2001 From: Lewin Probst <info@emirror.de> Date: Sat, 14 Dec 2019 13:15:24 +0100 Subject: [PATCH] Updated soundspeed selection/calculation algorithm. --- VERSION | 2 +- .../+edit/+offsets/buttonCalculateOffsets.m | 3 +- .../+edit/+offsets/checkboxFixedSoundspeed.m | 12 --- .../+offsets/initializeSoundspeedTable.m | 31 +++++++ .../+edit/+offsets/inputSoundspeed.m | 14 --- lib/+artoa/+controller/+edit/+offsets/open.m | 5 +- .../+edit/+offsets/saveOptimumToWorkspace.m | 2 +- .../+edit/+offsets/tableSoundspeedEdit.m | 31 +++++++ .../+controller/+edit/+offsets/updateGui.m | 15 +--- .../+offsets/updateWorkspaceOffsetsTable.m | 2 +- .../+edit/+timeOfArrival/calculateGpsToas.m | 12 +-- .../+parameter/comboboxSoundspeedMethod.m | 2 + lib/+artoa/+controller/+track/run.m | 19 +--- lib/+artoa/+controller/selectSoundspeed.m | 51 +++++++++++ lib/+artoa/+gui/+edit/offsets.m | 86 ++++--------------- lib/+artoa/+offsets/createCalculationTables.m | 14 +-- lib/+artoa/+offsets/solve.m | 12 +-- lib/+artoa/+toa/predictFromGps.m | 7 +- 18 files changed, 167 insertions(+), 153 deletions(-) delete mode 100644 lib/+artoa/+controller/+edit/+offsets/checkboxFixedSoundspeed.m create mode 100644 lib/+artoa/+controller/+edit/+offsets/initializeSoundspeedTable.m delete mode 100644 lib/+artoa/+controller/+edit/+offsets/inputSoundspeed.m create mode 100644 lib/+artoa/+controller/+edit/+offsets/tableSoundspeedEdit.m create mode 100644 lib/+artoa/+controller/selectSoundspeed.m diff --git a/VERSION b/VERSION index 4701cc7..c663e4d 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -150 \ No newline at end of file +151 \ No newline at end of file diff --git a/lib/+artoa/+controller/+edit/+offsets/buttonCalculateOffsets.m b/lib/+artoa/+controller/+edit/+offsets/buttonCalculateOffsets.m index cd74d39..75d28e9 100644 --- a/lib/+artoa/+controller/+edit/+offsets/buttonCalculateOffsets.m +++ b/lib/+artoa/+controller/+edit/+offsets/buttonCalculateOffsets.m @@ -30,7 +30,8 @@ toaData.toa = artoaDataInput.toaData.toa; artoaWorkspace.temperature(artoaWorkspace.statusTemperature == 1), ... artoaWorkspace.pressure(artoaWorkspace.statusPressure == 1), ... artoa.data.getMember(artoaDataInput, {'ini', 'leapseconds'}), ... - artoaWorkspace.editOffsets ... + artoaWorkspace.editOffsets, ... + artoa.controller.selectSoundspeed() ... ); %% Store offsets in table diff --git a/lib/+artoa/+controller/+edit/+offsets/checkboxFixedSoundspeed.m b/lib/+artoa/+controller/+edit/+offsets/checkboxFixedSoundspeed.m deleted file mode 100644 index b680f11..0000000 --- a/lib/+artoa/+controller/+edit/+offsets/checkboxFixedSoundspeed.m +++ /dev/null @@ -1,12 +0,0 @@ -function [newValue] = checkboxFixedSoundspeed(~, ~) -%CHECKBOXDOPPLERCORRECTION Summary of this function goes here -% Detailed explanation goes here - -global artoaGui artoaWorkspace; - -newValue = logical(artoaGui.editOffsets.checkboxFixedSoundspeed.Value); - -artoaWorkspace.editOffsets.useFixedSoundspeed = newValue; - -end - diff --git a/lib/+artoa/+controller/+edit/+offsets/initializeSoundspeedTable.m b/lib/+artoa/+controller/+edit/+offsets/initializeSoundspeedTable.m new file mode 100644 index 0000000..fee3567 --- /dev/null +++ b/lib/+artoa/+controller/+edit/+offsets/initializeSoundspeedTable.m @@ -0,0 +1,31 @@ +function [] = initializeSoundspeedTable() +%INITIALIZESOUNDSPEEDTABLE Summary of this function goes here +% Detailed explanation goes here + +global artoaWorkspace; + + +%% Check if edit offsets is ready +if ~artoa.data.hasMember(artoaWorkspace, {'editOffsets'}) + return; +end + +%% Initialize soundspeed table for calculations +artoaWorkspace.editOffsets.soundspeed = table(); + +artoaWorkspace.editOffsets.soundspeed{1, :} = [ ... + artoa.data.calculateSoundVelocity( ... + artoaWorkspace.temperature(artoaWorkspace.statusTemperature == 1), ... + artoaWorkspace.pressure(artoaWorkspace.statusPressure == 1), ... + artoaWorkspace.trackParameter.soundspeedMethodString ... + ) ... + NaN ... + NaN ... +]; + +artoaWorkspace.editOffsets.soundspeed.Properties.RowNames = {'Soundspeed'}; +artoaWorkspace.editOffsets.soundspeed.Properties.VariableNames = ... + {'Measured', 'Optimum', 'Empirical'}; + +end + diff --git a/lib/+artoa/+controller/+edit/+offsets/inputSoundspeed.m b/lib/+artoa/+controller/+edit/+offsets/inputSoundspeed.m deleted file mode 100644 index 7617399..0000000 --- a/lib/+artoa/+controller/+edit/+offsets/inputSoundspeed.m +++ /dev/null @@ -1,14 +0,0 @@ -function [newValue] = inputSoundspeed(~, ~) -%COMBOBOXTRACKINGMETHOD Summary of this function goes here -% Detailed explanation goes here - -global artoaGui artoaWorkspace; - -newValue = artoaGui.editOffsets.inputSoundspeed.String; - -% required in km/s -artoaWorkspace.editOffsets.fixedSoundspeed = str2double(newValue) / 1000; - - -end - diff --git a/lib/+artoa/+controller/+edit/+offsets/open.m b/lib/+artoa/+controller/+edit/+offsets/open.m index 7d8ea17..5e77113 100644 --- a/lib/+artoa/+controller/+edit/+offsets/open.m +++ b/lib/+artoa/+controller/+edit/+offsets/open.m @@ -15,9 +15,9 @@ end callbacks = struct(); callbacks.tableSoundsourceOffsetsEdit = @artoa.controller.edit.offsets.tableSoundsourceOffsetsEdit; +callbacks.tableSoundspeedEdit = @artoa.controller.edit.offsets.tableSoundspeedEdit; callbacks.buttonCalculateOffsets = @artoa.controller.edit.offsets.buttonCalculateOffsets; callbacks.checkboxUseOffsets = @artoa.controller.edit.offsets.checkboxUseOffsets; -callbacks.checkboxFixedSoundspeed = @artoa.controller.edit.offsets.checkboxFixedSoundspeed; callbacks.inputSoundspeed = @artoa.controller.edit.offsets.inputSoundspeed; callbacks.buttonCopyFromOptimum = @artoa.controller.edit.offsets.buttonCopyFromOptimum; callbacks.buttonCopyFromMeasured = @artoa.controller.edit.offsets.buttonCopyFromMeasured; @@ -35,8 +35,7 @@ end %% Create workspace variables artoaWorkspace.editOffsets = struct(); artoaWorkspace.editOffsets.useOffsets = false; -artoaWorkspace.editOffsets.useFixedSoundspeed = false; -artoaWorkspace.editOffsets.fixedSoundspeed = 0; +artoa.controller.edit.offsets.initializeSoundspeedTable(); artoa.controller.edit.offsets.updateWorkspaceOffsetsTable(); %% Update gui diff --git a/lib/+artoa/+controller/+edit/+offsets/saveOptimumToWorkspace.m b/lib/+artoa/+controller/+edit/+offsets/saveOptimumToWorkspace.m index 7c86d9c..9ca39ae 100644 --- a/lib/+artoa/+controller/+edit/+offsets/saveOptimumToWorkspace.m +++ b/lib/+artoa/+controller/+edit/+offsets/saveOptimumToWorkspace.m @@ -25,7 +25,7 @@ for i = 1:length(varNames) % check if it is soundspeed if strcmp(varNames{i}, 'Soundspeed') % [km/s] * 1000 - artoaWorkspace.editOffsets.optimumSoundspeed = X{varNames{i}, 'Value'} * 1000; + artoaWorkspace.editOffsets.soundspeed{'Soundspeed', 'Optimum'} = X{varNames{i}, 'Value'} * 1000; continue; end % check if it is offset diff --git a/lib/+artoa/+controller/+edit/+offsets/tableSoundspeedEdit.m b/lib/+artoa/+controller/+edit/+offsets/tableSoundspeedEdit.m new file mode 100644 index 0000000..79f4452 --- /dev/null +++ b/lib/+artoa/+controller/+edit/+offsets/tableSoundspeedEdit.m @@ -0,0 +1,31 @@ +function [] = tableSoundspeedEdit(~, event) +%TABLESOUNDSOURCEOFFSETSEDIT Summary of this function goes here +% Detailed explanation goes here + + +global artoaGui artoaWorkspace; + +%% Get data +try + selectedColumn = event.Indices(2); +catch + selectedColumn = NaN; +end + +%% Check if the column that has been edited is locked +if 1 <= selectedColumn & selectedColumn <= 2 + artoa.controller.edit.offsets.updateGui(); + return; +end + +if ~artoa.data.hasMember(artoaWorkspace, {'editOffsets', 'soundspeed'}) + return; +end + +%% Save to workspace +artoaWorkspace.editOffsets.soundspeed(:, :) = artoaGui.editOffsets.tableSoundspeed.Data; + +%% Recalculate +artoa.controller.edit.recalculateToaGpsAndPlot(); + +end diff --git a/lib/+artoa/+controller/+edit/+offsets/updateGui.m b/lib/+artoa/+controller/+edit/+offsets/updateGui.m index ef79937..5f6006c 100644 --- a/lib/+artoa/+controller/+edit/+offsets/updateGui.m +++ b/lib/+artoa/+controller/+edit/+offsets/updateGui.m @@ -18,10 +18,10 @@ for i = 1:length(fieldNames) switch fieldNames{i} case 'useOffsets' artoaGui.editOffsets.checkboxUseOffsets.Value = currentValue; - case 'useFixedSoundspeed' - artoaGui.editOffsets.checkboxFixedSoundspeed.Value = currentValue; - case 'fixedSoundspeed' - artoaGui.editOffsets.inputSoundspeed.String = num2str(currentValue); + case 'soundspeed' + artoaGui.editOffsets.tableSoundspeed.Data = table2cell(currentValue); + artoaGui.editOffsets.tableSoundspeed.RowName = currentValue.Properties.RowNames; + artoaGui.editOffsets.tableSoundspeed.ColumnName = currentValue.Properties.VariableNames; case 'offsets' artoaGui.editOffsets.tableSoundsourceOffsets.Data = table2cell( ... currentValue ... @@ -31,12 +31,5 @@ for i = 1:length(fieldNames) end end -%% Update soundspeed field -if artoaWorkspace.editOffsets.useFixedSoundspeed - artoaGui.editOffsets.textOptimumSoundspeedValue.String = num2str(artoaWorkspace.editOffsets.fixedSoundspeed); -elseif artoa.data.hasMember(artoaWorkspace, {'editOffsets', 'optimumSoundspeed'}) - artoaGui.editOffsets.textOptimumSoundspeedValue.String = num2str(artoaWorkspace.editOffsets.optimumSoundspeed); -end - end diff --git a/lib/+artoa/+controller/+edit/+offsets/updateWorkspaceOffsetsTable.m b/lib/+artoa/+controller/+edit/+offsets/updateWorkspaceOffsetsTable.m index bc32a65..12a5724 100644 --- a/lib/+artoa/+controller/+edit/+offsets/updateWorkspaceOffsetsTable.m +++ b/lib/+artoa/+controller/+edit/+offsets/updateWorkspaceOffsetsTable.m @@ -4,7 +4,7 @@ function [] = updateWorkspaceOffsetsTable() global artoaWorkspace; -%% Check if track parameter already exist +%% Check if edit offsets already exist if ~artoa.data.hasMember(artoaWorkspace, {'editOffsets'}) return; end diff --git a/lib/+artoa/+controller/+edit/+timeOfArrival/calculateGpsToas.m b/lib/+artoa/+controller/+edit/+timeOfArrival/calculateGpsToas.m index 28d73f0..ab2fff3 100644 --- a/lib/+artoa/+controller/+edit/+timeOfArrival/calculateGpsToas.m +++ b/lib/+artoa/+controller/+edit/+timeOfArrival/calculateGpsToas.m @@ -10,6 +10,7 @@ fnames = fieldnames(artoaWorkspace.filteredSoundsources); artoaWorkspace.editTimeOfArrival.satToa = struct(); + %% Calculate GPS TOAs for every soundsource for o = 1:length(fnames) % initialize data storage @@ -22,14 +23,13 @@ for o = 1:length(fnames) artoaDataInput.soundsources.(fnames{o}).endemis(2), ... artoaDataInput.soundsources.(fnames{o}).endemis(1)); + + % get soundspeed + soundvelocity = artoa.controller.selectSoundspeed(); + [gpsDates, predictedToas] = artoa.toa.predictFromGps( ... artoaDataInput.rfb, artoaWorkspace.filteredSoundsources.(fnames{o}), ... - struct( ... - 'temperature', artoaWorkspace.temperature(artoaWorkspace.statusTemperature == 1), ... - 'pressure', artoaWorkspace.pressure(artoaWorkspace.statusPressure == 1), ... - 'method', 'del grosso', ... - 'soundSource', NaN ... - ), ... + soundvelocity{fnames{o}, 1}, ... artoa.data.getMember(artoaDataInput, {'ini', 'leapseconds'}) ... ); diff --git a/lib/+artoa/+controller/+track/+parameter/comboboxSoundspeedMethod.m b/lib/+artoa/+controller/+track/+parameter/comboboxSoundspeedMethod.m index db10bcf..07f0559 100644 --- a/lib/+artoa/+controller/+track/+parameter/comboboxSoundspeedMethod.m +++ b/lib/+artoa/+controller/+track/+parameter/comboboxSoundspeedMethod.m @@ -11,6 +11,8 @@ newValue = artoaGui.trackParameter.comboboxSoundspeedMethod.String{selectedIndex artoaWorkspace.trackParameter.soundspeedMethodValue = selectedIndex; artoaWorkspace.trackParameter.soundspeedMethodString = newValue; +%% Recalculate and plot TOA +artoa.controller.edit.recalculateToaGpsAndPlot(); end diff --git a/lib/+artoa/+controller/+track/run.m b/lib/+artoa/+controller/+track/run.m index 481870d..c31fe73 100644 --- a/lib/+artoa/+controller/+track/run.m +++ b/lib/+artoa/+controller/+track/run.m @@ -26,17 +26,9 @@ soundVelocity = NaN( ... ); %% Get sound velocity +selectedVelocity = artoa.controller.selectSoundspeed(); for i = 1:size(soundVelocity, 1) if strcmpi( ... - artoaWorkspace.trackParameter.soundspeedMethodString, ... - 'manual' ... - ) - soundVelocity(i, :) = [ ... - artoaWorkspace.trackParameter.soundsourceCombinations.soundspeed1(i), ... - artoaWorkspace.trackParameter.soundsourceCombinations.soundspeed2(i), ... - artoaWorkspace.trackParameter.soundsourceCombinations.soundspeed3(i) ... - ]; - elseif strcmpi( ... artoaWorkspace.trackParameter.soundspeedMethodString, ... 'soundsource file' ... ) @@ -44,15 +36,10 @@ for i = 1:size(soundVelocity, 1) soundsourceNames = strsplit(artoaWorkspace.trackParameter.soundsourceCombinations.soundsources{i}); % get soundspeed for every soundsource for oName = 1:length(soundsourceNames) - soundVelocity(i, oName) = ... - artoaWorkspace.filteredSoundsources.(soundsourceNames{oName}).sound_speed; + soundVelocity(i, oName) = selectedVelocity{soundsourceNames{oName}, 1}; end else - soundVelocity(i, :) = artoa.data.calculateSoundVelocity( ... - artoaWorkspace.temperature(artoaWorkspace.statusTemperature == 1), ... - artoaWorkspace.pressure(artoaWorkspace.statusPressure == 1), ... - artoaWorkspace.trackParameter.soundspeedMethodString ... - ); + soundVelocity(i, :) = selectedVelocity{1, 1}; end end diff --git a/lib/+artoa/+controller/selectSoundspeed.m b/lib/+artoa/+controller/selectSoundspeed.m new file mode 100644 index 0000000..e097d59 --- /dev/null +++ b/lib/+artoa/+controller/selectSoundspeed.m @@ -0,0 +1,51 @@ +function [soundvelocity] = selectSoundspeed() +%SELECTSOUNDSPEED Summary of this function goes here +% Detailed explanation goes here + +global artoaWorkspace; + +%% Get required variables +soundsourceNames = fieldnames(artoaWorkspace.filteredSoundsources); +trackParameter = artoa.data.getMember(artoaWorkspace, {'trackParameter'}, false); +soundspeedTable = artoa.data.getMember(artoaWorkspace, {'editOffsets', 'soundspeed'}, false); + +%% Get used method +if ~islogical(trackParameter) + method = trackParameter.soundspeedMethodString; +else + method = 'del grosso'; +end + +%% Fill with manual values or NaN +if ~islogical(soundspeedTable) + initMatrix = repmat(soundspeedTable{'Soundspeed', 'Empirical'}, length(soundsourceNames), 1); +else + initMatrix = NaN(length(soundsourceNames), 1); +end + +%% Initialize table +soundvelocity = table(initMatrix, 'RowNames', soundsourceNames); + +%% If manual has been chosen, we are ready +if strcmpi(method, 'manual') + return; +end + +%% Get every velocity for each soundsource +if strcmpi(method, 'soundsource file') + for i = 1:length(soundsourceNames) + soundvelocity{soundsourceNames{i}, 1} = ... + artoaWorkspace.filteredSoundsources.(soundsourceNames{i}).sound_speed; + end + return; +end + +soundvelocity{:, :} = artoa.data.calculateSoundVelocity( ... + artoaWorkspace.temperature(artoaWorkspace.statusTemperature == 1), ... + artoaWorkspace.pressure(artoaWorkspace.statusPressure == 1), ... + method ... +); + + +end + diff --git a/lib/+artoa/+gui/+edit/offsets.m b/lib/+artoa/+gui/+edit/offsets.m index 58c0401..1070036 100644 --- a/lib/+artoa/+gui/+edit/offsets.m +++ b/lib/+artoa/+gui/+edit/offsets.m @@ -13,10 +13,9 @@ availableCallbacks = { ... 'CloseRequestFcn', ... 'tableSoundsourceOffsetsSelect', ... 'tableSoundsourceOffsetsEdit', ... + 'tableSoundspeedEdit', ... 'buttonCalculateOffsets', ... 'checkboxUseOffsets', ... - 'checkboxFixedSoundspeed', ... - 'inputSoundspeed', ... 'buttonCopyFromOptimum', ... 'buttonCopyFromMeasured', ... 'buttonUndoLastCopy' ... @@ -39,6 +38,7 @@ artoaGui.figures.editOffsets = figure( ... % adjust width artoaGui.figures.editOffsets.Position(3) = 120; +artoaGui.figures.editOffsets.Position(4) = 35; artoaGui.editOffsets = struct(); @@ -56,19 +56,28 @@ fullwidth = 1 - (2 * left); artoaGui.editOffsets.tableSoundsourceOffsets = uitable( ... artoaGui.figures.editOffsets, ... 'Units', 'normalized', ... - 'Position', [left, 0.45, fullwidth, 0.5], ... + 'Position', [left, 0.45, fullwidth, 0.525], ... 'ColumnEditable', true, ... 'CellSelectionCallback', pCallbacks.tableSoundsourceOffsetsSelect, ... 'CellEditCallback', pCallbacks.tableSoundsourceOffsetsEdit ... ); +%% Initialize soundspeed table +artoaGui.editOffsets.tableSoundspeed = uitable( ... + artoaGui.figures.editOffsets, ... + 'Units', 'normalized', ... + 'Position', [left, 0.35, fullwidth, 0.1], ... + 'ColumnEditable', true, ...'CellSelectionCallback', pCallbacks.tableSoundsourceOffsetsSelect, ... + 'CellEditCallback', pCallbacks.tableSoundspeedEdit ... +); + %% Optimum offsets frame artoaGui.editOffsets.frameOptimumOffsets = uipanel( ... 'Parent', artoaGui.figures.editOffsets, ... 'Title', 'Offset controls', ... 'Units', 'normalized', ... 'BackgroundColor', 'white', ... - 'Position', [left .05 fullwidth/2 .35] ... + 'Position', [left .025 fullwidth .3] ... ); %% Setup calculate offsets button @@ -78,7 +87,7 @@ artoaGui.editOffsets.buttonCalculateOffsets = uicontrol( ... 'Style', 'PushButton', ... 'FontSize', 8, ... 'Units', 'normalized', ... - 'Position', [.65 .1 .25 .2], ... + 'Position', [left .25 fullwidth/2 .2], ... 'CallBack', pCallbacks.buttonCalculateOffsets ... ); @@ -98,7 +107,7 @@ artoaGui.editOffsets.buttonCopyFromMeasured = uicontrol( ... 'Style', 'PushButton', ... 'FontSize', 8, ... 'Units', 'normalized', ... - 'Position', [left .5 fullwidth/2 .2], ... + 'Position', [(1.5*left + fullwidth/2) .75 fullwidth/2 .2], ... 'CallBack', pCallbacks.buttonCopyFromMeasured ... ); @@ -108,7 +117,7 @@ artoaGui.editOffsets.buttonCopyFromOptimum = uicontrol( ... 'Style', 'PushButton', ... 'FontSize', 8, ... 'Units', 'normalized', ... - 'Position', [left .275 fullwidth/2 .2], ... + 'Position', [(1.5*left + fullwidth/2) .5 fullwidth/2 .2], ... 'CallBack', pCallbacks.buttonCopyFromOptimum ... ); @@ -119,70 +128,9 @@ artoaGui.editOffsets.buttonUndoLastCopy = uicontrol( ... 'Style', 'PushButton', ... 'FontSize', 8, ... 'Units', 'normalized', ... - 'Position', [left .05 fullwidth/2 .2], ... + 'Position', [(1.5*left + fullwidth/2) .25 fullwidth/2 .2], ... 'CallBack', pCallbacks.buttonUndoLastCopy ... ); -%% Soundspeed frame -artoaGui.editOffsets.frameSoundspeed = uipanel( ... - 'Parent', artoaGui.figures.editOffsets, ... - 'Title', 'Soundspeed settings', ... - 'Units', 'normalized', ... - 'BackgroundColor', 'white', ... - 'Position', [(2*left + fullwidth/2) .05 fullwidth/4 .35] ... -); - -artoaGui.editOffsets.checkboxFixedSoundspeed = uicontrol( ... - 'Parent', artoaGui.editOffsets.frameSoundspeed, ... - 'String', 'Use fixed soundspeed', ... - 'Style', 'checkbox', ... - 'FontSize', 8, ... - 'Units', 'normalized', ... - 'Position', [left .05 fullwidth .2], ... - 'CallBack', pCallbacks.checkboxFixedSoundspeed ... -); - -artoaGui.editOffsets.textSoundspeed = uicontrol( ... - 'Parent', artoaGui.editOffsets.frameSoundspeed, ... - 'String', 'Fixed soundspeed [m/s]', ... - 'Style', 'text', ... - 'FontSize', 8, ... - 'Units', 'normalized', ... - 'Position', [left .3 (fullwidth/3*2 - 2*left) .2], ... - 'CallBack', '' ... -); - -artoaGui.editOffsets.inputSoundspeed = uicontrol( ... - 'Parent', artoaGui.editOffsets.frameSoundspeed, ... - 'String', '0', ... - 'Style', 'edit', ... - 'FontSize', 8, ... - 'Units', 'normalized', ... - 'Position', [(fullwidth/3)*2 .3 fullwidth/3 .2], ... - 'CallBack', pCallbacks.inputSoundspeed ... -); - - -artoaGui.editOffsets.textOptimumSoundspeedLabel = uicontrol( ... - 'Parent', artoaGui.editOffsets.frameSoundspeed, ... - 'String', 'Optimum soundspeed [m/s]', ... - 'Style', 'text', ... - 'FontSize', 8, ... - 'Units', 'normalized', ... - 'Position', [left .55 (fullwidth/3*2 - 2*left) .2], ... - 'CallBack', '' ... -); - - -artoaGui.editOffsets.textOptimumSoundspeedValue = uicontrol( ... - 'Parent', artoaGui.editOffsets.frameSoundspeed, ... - 'String', 'NaN', ... - 'Style', 'text', ... - 'FontSize', 8, ... - 'Units', 'normalized', ... - 'Position', [(fullwidth/3)*2 .55 fullwidth/3 .2], ... - 'CallBack', '' ... -); - end diff --git a/lib/+artoa/+offsets/createCalculationTables.m b/lib/+artoa/+offsets/createCalculationTables.m index 1b456ac..e600ecc 100644 --- a/lib/+artoa/+offsets/createCalculationTables.m +++ b/lib/+artoa/+offsets/createCalculationTables.m @@ -1,4 +1,4 @@ -function [a, b, c] = createCalculationTables(pRfb, pSoundsources, pTrackingParameter, pToaData, pSatData, pAppliedTemperature, pAppliedPressure, pLeapsecondsMatrix) +function [a, b, c] = createCalculationTables(pRfb, pSoundsources, pTrackingParameter, pToaData, pSatData, pSoundvelocity, pLeapsecondsMatrix) %CREATECALCULATIONMATRICES Summary of this function goes here % Detailed explanation goes here @@ -26,16 +26,16 @@ for i = 1:length(fnames) pSoundsources.(fnames{i}).endemis(2), ... pSoundsources.(fnames{i}).endemis(1)); + try + soundvelocity = pSoundvelocity{fnames{i}, 1}; + catch + soundvelocity = pSoundvelocity{1, 1}; + end [date, toa] = artoa.toa.predictFromGps( ... pRfb, ... pSoundsources.(fnames{i}), ... - struct( ... - 'temperature', pAppliedTemperature, ... - 'pressure', pAppliedPressure, ... - 'method', pTrackingParameter.soundspeedMethodString, ... - 'soundSource', NaN ... - ), ... + soundvelocity, ... pLeapsecondsMatrix ... ); results.(fnames{i}).satDate = date; diff --git a/lib/+artoa/+offsets/solve.m b/lib/+artoa/+offsets/solve.m index 2e327f4..e4ddc37 100644 --- a/lib/+artoa/+offsets/solve.m +++ b/lib/+artoa/+offsets/solve.m @@ -1,4 +1,4 @@ -function [A, B, X, unfilteredA, unfilteredB] = solve(pRfb, pSoundsources, pTrackingParameter, pToaData, pSatData, pAppliedTemperature, pAppliedPressure, pLeapsecondsMatrix, pOffsetsParameter) +function [A, B, X, unfilteredA, unfilteredB] = solve(pRfb, pSoundsources, pTrackingParameter, pToaData, pSatData, pAppliedTemperature, pAppliedPressure, pLeapsecondsMatrix, pOffsetsParameter, pSoundvelocity) %UNTITLED Summary of this function goes here % Detailed explanation goes here @@ -9,8 +9,7 @@ function [A, B, X, unfilteredA, unfilteredB] = solve(pRfb, pSoundsources, pTrack pTrackingParameter, ... pToaData, ... pSatData, ... - pAppliedTemperature, ... - pAppliedPressure, ... + pSoundvelocity, ... pLeapsecondsMatrix ... ); @@ -37,13 +36,14 @@ function [A, B, X, unfilteredA, unfilteredB] = solve(pRfb, pSoundsources, pTrack %% Subtract window start and soundsource reference time B.toa = B.toa - unfilteredC.ReferenceTime; -%% Use fixed soundspeed -if pOffsetsParameter.useFixedSoundspeed +%% Use soundspeed +if ~isnan(pOffsetsParameter.soundspeed{'Soundspeed', 'Empirical'}) if isempty(A) return; % nothing to be done, everything is given and soundspeed is fixed end - B.toa = B.toa - A{:, 'Distances'} * (pOffsetsParameter.fixedSoundspeed / 1000); + % Distances are in km, soundspeed m/s + B.toa = B.toa - A{:, 'Distances'} * (pOffsetsParameter.soundspeed{'Soundspeed', 'Empirical'} / 1000); A.Distances = []; end diff --git a/lib/+artoa/+toa/predictFromGps.m b/lib/+artoa/+toa/predictFromGps.m index fda0719..2af1e64 100644 --- a/lib/+artoa/+toa/predictFromGps.m +++ b/lib/+artoa/+toa/predictFromGps.m @@ -1,4 +1,4 @@ -function [gpsRafosDates, predictedToa] = predictFromGps(pRfb, pSoundSource, pSoundSpeedParameter, pLeapsecondsMatrix) +function [gpsRafosDates, predictedToa] = predictFromGps(pRfb, pSoundSource, pSoundspeed, pLeapsecondsMatrix) %ESTIMATETOAFROMGPS Summary of this function goes here % Detailed explanation goes here @@ -65,10 +65,7 @@ for o = 1:gpsMeasurementCount distanceSoundSourceToFloat = artoa.data.calculateGeodist(currentGpsPosition, soundSourcePosition); predictedToa(o) = windowStartTime * 3600 - leapSeconds ... - + distanceSoundSourceToFloat / (artoa.data.calculateSoundVelocity( ... - pSoundSpeedParameter.temperature, pSoundSpeedParameter.pressure, ... - pSoundSpeedParameter.method ... - )/1000) - pRfb.FLOAT.windowstart * 60; + + distanceSoundSourceToFloat / (pSoundspeed / 1000) - pRfb.FLOAT.windowstart * 60; end -- GitLab