From 79f7731457483d10f3baacfb56859e9b97d2c73f Mon Sep 17 00:00:00 2001 From: oboebel <oboebel@bkli03p121.dmawi.de> Date: Fri, 4 Nov 2022 09:43:43 +0100 Subject: [PATCH] --- artoa.ini | 3 +- .../+edit/+offsets/buttonCalculateOffsets.m | 1 + .../+controller/+file/saveOptimumTables.m | 6 ++-- lib/+artoa/+load/rfb.m | 2 +- lib/+artoa/+offsets/createCalculationTables.m | 3 ++ lib/+artoa/+offsets/solve.m | 31 ++++++++++++++++++- 6 files changed, 40 insertions(+), 6 deletions(-) diff --git a/artoa.ini b/artoa.ini index 59a7bfb..acb0d3e 100644 --- a/artoa.ini +++ b/artoa.ini @@ -1,7 +1,8 @@ % ARTOA ini file for dimes first three floats [files] --soundsourcefile C:\MyData\RAFOS\HAFOS.soso +%-soundsourcefile C:\MyData\RAFOS\HAFOS.soso +-soundsourcefile C:\MyData\RAFOS\TESTwithOFFSETS.soso -floatfile ..\HAFOS.flo % not used in artoa4 yet -bathyfile ..\HAFOS.prj % not used in artoa4 yet -etopo C:\MyData\TOPO\etopo1_ice_c.flt diff --git a/lib/+artoa/+controller/+edit/+offsets/buttonCalculateOffsets.m b/lib/+artoa/+controller/+edit/+offsets/buttonCalculateOffsets.m index 0bfea9a..a018852 100644 --- a/lib/+artoa/+controller/+edit/+offsets/buttonCalculateOffsets.m +++ b/lib/+artoa/+controller/+edit/+offsets/buttonCalculateOffsets.m @@ -22,6 +22,7 @@ toaData.toa = artoaDataInput.toaData.toa; artoaWorkspace.editOffsets.unfilteredA, ... artoaWorkspace.editOffsets.unfilteredB, ... artoaWorkspace.editOffsets.D, ... + artoaWorkspace.editOffsets.soundspeed,... % Olaf Boebel 2022-10-07 ] = artoa.offsets.solve( ... artoaDataInput.rfb, ... soundsources, ... diff --git a/lib/+artoa/+controller/+file/saveOptimumTables.m b/lib/+artoa/+controller/+file/saveOptimumTables.m index d0fb2f1..9e14a87 100644 --- a/lib/+artoa/+controller/+file/saveOptimumTables.m +++ b/lib/+artoa/+controller/+file/saveOptimumTables.m @@ -8,10 +8,10 @@ global artoaWorkspace artoaConfig; unfilteredA = artoa.data.getMember(artoaWorkspace, {'editOffsets', 'unfilteredA'}, false); unfilteredB = artoa.data.getMember(artoaWorkspace, {'editOffsets', 'unfilteredB'}, false); A = artoa.data.getMember(artoaWorkspace, {'editOffsets', 'A'}, false); -B = artoa.data.getMember(artoaWorkspace, {'editOffsets', 'B'}, false); -X = artoa.data.getMember(artoaWorkspace, {'editOffsets', 'X'}, false); +B = artoa.data.getMember(artoaWorkspace, {'editOffsets', 'B'}, false); % retains columns corresponding to fitted values +X = artoa.data.getMember(artoaWorkspace, {'editOffsets', 'X'}, false); % fitted values D = artoa.data.getMember(artoaWorkspace, {'editOffsets', 'D'}, false); -offsets = artoa.data.getMember(artoaWorkspace, {'editOffsets', 'offsets'}, false); +offsets = artoa.data.getMember(artoaWorkspace, {'editOffsets', 'offsets'}, false); % the current offset table soundspeed = artoa.data.getMember(artoaWorkspace, {'editOffsets', 'soundspeed'}, false); if islogical(unfilteredA) || islogical(unfilteredB) ... diff --git a/lib/+artoa/+load/rfb.m b/lib/+artoa/+load/rfb.m index f06b87f..e58bd55 100644 --- a/lib/+artoa/+load/rfb.m +++ b/lib/+artoa/+load/rfb.m @@ -33,4 +33,4 @@ end rfbfile = artoa.load.tomlini(pFilename); -end +cdend diff --git a/lib/+artoa/+offsets/createCalculationTables.m b/lib/+artoa/+offsets/createCalculationTables.m index 6e76564..6e08fce 100644 --- a/lib/+artoa/+offsets/createCalculationTables.m +++ b/lib/+artoa/+offsets/createCalculationTables.m @@ -2,6 +2,9 @@ function [a, b, c, d] = createCalculationTables(pRfb, pSoundsources, pTrackingPa %CREATECALCULATIONMATRICES Summary of this function goes here % Detailed explanation goes here +% Olaf Boebel 2022-10-18: the calling function passes pSoundvelocity to his function. +% pSoundvelocity semms to host the "Applied to" sound source velocities + %% Initialize required variables %pSoundsources = artoa.controller.getSoundsourcesWithAppliedToa(); satPositions = [pSatData.lat_sat, pSatData.lon_sat]; diff --git a/lib/+artoa/+offsets/solve.m b/lib/+artoa/+offsets/solve.m index d2bbc26..5edf4ed 100644 --- a/lib/+artoa/+offsets/solve.m +++ b/lib/+artoa/+offsets/solve.m @@ -1,4 +1,8 @@ -function [A, B, X, unfilteredA, unfilteredB, D] = solve(pRfb, pSoundsources, pTrackingParameter, pToaData, pSatData, pLeapsecondsMatrix, pOffsetsParameter) +%function [A, B, X, unfilteredA, unfilteredB, D] = solve(pRfb, pSoundsources, pTrackingParameter, pToaData, pSatData, pLeapsecondsMatrix, pOffsetsParameter) +% Olaf Boebel 2022-11-03 added 'soundspeed' to output arguments +function [A, B, X, unfilteredA, unfilteredB, D, soundspeed] = solve(pRfb, pSoundsources, pTrackingParameter, pToaData, pSatData, pLeapsecondsMatrix, pOffsetsParameter) + + %UNTITLED Summary of this function goes here % Detailed explanation goes here @@ -14,6 +18,10 @@ function [A, B, X, unfilteredA, unfilteredB, D] = solve(pRfb, pSoundsources, pTr pLeapsecondsMatrix ... ); +%OB% 20221018 The above function call passes the Sosos' AppliedSoundspeed to artoa.offsets.createCalculationTables +%If it is NaN, solve does not work, unclear if tables are %constructed nevertheless. Why should the Soso's sound speed be mandatory +%and not a fitting parameter? + %% Subtract all known offsets [B] = artoa.offsets.subtractKnownOffsets( ... unfilteredA, ... @@ -51,6 +59,24 @@ end %% Solve it! X = A{:, :} \ B.toa; +% Olaf Boebel 2022 11 03 +% the above solves the liner equation system if solvable. However, due to +% noise this is not necessarily the case. Rather, we seek to find a +% solution which minimizes the differnce between the found solution and the +% true solution. This is given by: + +H = A{:, :}; +B2 = H'*B.toa; +A2 = H'*H; +X2 = A2\B2; +DET = det(A2) +CONDITION = rcond(A2) +[X X2] + +X = X2; + +% End Olaf Boebel 2022 11 03 + %% Apply row names to X if isrow(X) X = X'; @@ -65,5 +91,8 @@ for i = 1:length(varNames) end end +%OB% 20221007 +soundspeed = pOffsetsParameter.offsets{'Float', 'AppliedSoundspeed'}; + end -- GitLab