From c4d75e9a9049c0f5739607c7030f00a7e1f30164 Mon Sep 17 00:00:00 2001 From: cle Date: Mon, 8 Jul 2024 11:05:12 +0200 Subject: [PATCH] K factor for standard deviation in cartesian and polar subframes, vertical -1=N=n or 1=V=v and nothing else --- changelog.txt | 1 + doc_uni/obs.rst | 27 ++++++++++------- src/station_bascule.cpp | 50 ++++++++++++++++++++++---------- src/station_bascule.h | 3 +- tests/data/baselines/ex_ref.comp | 15 +++++----- tests/tests_nonreg.cpp | 2 +- 6 files changed, 64 insertions(+), 34 deletions(-) diff --git a/changelog.txt b/changelog.txt index cd793de2..accbecb5 100644 --- a/changelog.txt +++ b/changelog.txt @@ -3,5 +3,6 @@ Comp V5.23 (next version): - new rot export xyz - faster solver solver - change sigma_total + - sigma factor applicable to cartesian and polar subframes diff --git a/doc_uni/obs.rst b/doc_uni/obs.rst index b0f0c098..8807d7b5 100644 --- a/doc_uni/obs.rst +++ b/doc_uni/obs.rst @@ -146,13 +146,16 @@ Cartesian Subframes The protocol of a cartesian subframe (code ``11``) in *.obs* file is: - +----------------------------------------------+ - |:math:`11\ origin\ @file.xyz\ [1]\ [*comment]`| - +----------------------------------------------+ + +-----------------------------------------------------------+ + | :math:`11\ origin\ @file.xyz\ [vertical\ [K]]\ [*comment]`| + +-----------------------------------------------------------+ Code ``11`` is used in case of frame change computation or terrestrial lidar measurements adjustment. -It is possible to add a ``1`` in the 4\ :sup:`th` column to indicate that the station is verticalized, i.e. the subframe's Z axis is vertical. +- Optional parameters: + + - *vertical*: ``V`` (or ``1``) indicates that the station is verticalized, i.e. the subframe's Z axis is vertical. ``N`` (or ``-1``) means that the station isn't verticalized (default: not verticalized) + - *K*: factor to be applied to the standard deviations in the cartesian subframe file (default: 1) The observations file *.xyz* contains the cartesian coordinates of points in a subframe centered on *origin*. Each line in the *.xyz* file contains the point name, its coordinates in the subframe and its precision(s). Therefore, the possible protocols in *.xyz* file are: @@ -204,13 +207,17 @@ Polar Subframes The protocol of a polar subframe (code ``12``) is: - +----------------------------------------------+ - |:math:`12\ origin\ @file.xyz\ [1]\ [*comment]`| - +----------------------------------------------+ + +-----------------------------------------------------------+ + | :math:`12\ origin\ @file.xyz\ [vertical\ [K]]\ [*comment]`| + +-----------------------------------------------------------+ Code ``12`` is used in case of non-verticalized total station, laser tracker or photogrammetric measurements. -It is possible to add a ``1`` in the 4\ :sup:`th` column to indicate that the station is verticalized, i.e. the subframe's Z axis is vertical. +- Optional parameters: + + - *vertical*: ``V`` (or ``1``) indicates that the station is verticalized, i.e. the subframe's Z axis is vertical. ``N`` (or ``-1``) means that the station isn't verticalized (default: not verticalized) + - *K*: factor to be applied to the standard deviations in the polar subframe file (default: 1) + The observations file *.xyz* contains the polar coordinates of points in a subframe centered on *origin*. Each line in the *.xyz* file contains the point name, its polar coordinates (pseudo-horizontal angle :math:`\alpha`, pseudo-vertical angle :math:`\beta`, distance) and their precisions. @@ -333,8 +340,8 @@ The protocol of GNSS baselines *.obs* file is: - *pt*: starting point of all baselines described in *.bas* file - optional parameters: - - *K*: factor to be applied squarred to the baselines' variance-covariance matrix; this amends for potential overestimation of the output precision given by the GNSS software - - :math:`h_{station}`: station height + - *K*: factor to be applied squarred to the baselines' variance-covariance matrix; this amends for potential overestimation of the output precision given by the GNSS software (default: 1) + - :math:`h_{station}`: station height (default: 0) The *.bas* file contains, for each point, its name, vector from the station, variance-covariance upper-half matrix, and, eventually, target height. Therefore, the protocol in *.bas* file is: diff --git a/src/station_bascule.cpp b/src/station_bascule.cpp index 64a2909c..9a59bafb 100644 --- a/src/station_bascule.cpp +++ b/src/station_bascule.cpp @@ -181,6 +181,10 @@ bool Obs3D::read_obs(const std::string& line, int line_number, DataFile *_file, if ((station->triplet_type==STATION_CODE::BASC_XYZ_CART)||(station->triplet_type==STATION_CODE::BASC_ANG_CART)) { + sigma_abs1_original*=station->sigmaFactor; //apply standard deviation factor + sigma_abs2_original*=station->sigmaFactor; + sigma_abs3_original*=station->sigmaFactor; + if ((fabs(sigma_abs1_original)warning(INFO_OBS,_file->get_fileDepth()+1,QT_TRANSLATE_NOOP("QObject","At line %d: %s => Observation sigma_abs is too small."),line_number,line.c_str()); @@ -233,13 +237,14 @@ bool Obs3D::read_obs(const std::string& line, int line_number, DataFile *_file, else if (station->triplet_type==STATION_CODE::BASELINE_GEO_XYZ) { active1 = active2 = active3 = active1 && active2 && active3; //semi-active baselines not allowed - - sigma_abs1_original*=station->varianceFactor; //apply variance factor - sigma_abs2_original*=station->varianceFactor; - sigma_abs3_original*=station->varianceFactor; - sigma_xy*=station->varianceFactor; - sigma_xz*=station->varianceFactor; - sigma_yz*=station->varianceFactor; + //sigma_abs 1,2,3 are variances and not standard deviations + double varianceFactor = station->sigmaFactor*station->sigmaFactor; + sigma_abs1_original*=varianceFactor; //apply variance factor + sigma_abs2_original*=varianceFactor; + sigma_abs3_original*=varianceFactor; + sigma_xy*=varianceFactor; + sigma_xz*=varianceFactor; + sigma_yz*=varianceFactor; station->observations.emplace_back(station->origin(),to,station,OBS_CODE::BASELINE_X,active1,value1_original,sqrt(sigma_abs1_original), 0,station->stationHeight,target_height, @@ -854,7 +859,7 @@ Coord Obs3D::obsToInstrumentFrameCoords(bool simul) Station_Bascule::Station_Bascule(Point *origin):Station(origin, STATION_TYPE::ST_BASCULE),isVertical(false),isGeocentric(false), da(0.0),db(0.0),dc(0.0),a(0.0),b(0.0),c(0.0),R_vert2instr(Mat3::Zero()), - stationHeight(0.0),varianceFactor(1.0),triplet_type(STATION_CODE::BASC_XYZ_CART),file(nullptr) + stationHeight(0.0),sigmaFactor(1.0),triplet_type(STATION_CODE::BASC_XYZ_CART),file(nullptr) { } @@ -1075,8 +1080,8 @@ Json::Value Station_Bascule::toJson(FileRefJson &fileRef) const if (isGeocentric) { val["station_height"]=static_cast(stationHeight); - val["variance_factor"]=static_cast(varianceFactor); } + val["sigma_factor"]=static_cast(sigmaFactor); val["ang_to_vert"]=angleInstr2Vert()/toRad(1.0,Project::theone()->config.filesUnit); return val; @@ -1234,13 +1239,28 @@ bool Station_Bascule::read_obs(std::string line, if (!isGeocentric) //test if bascule is verticalized { - int vertical_int=-1; - if (iss >> vertical_int) - isVertical=(vertical_int>=0); - }else{ //test if variance factor and station height - if ((iss >> varianceFactor)) + std::string vertical_str; + if (iss >> vertical_str){ + if(vertical_str == "1" || vertical_str == "V" || vertical_str == "v") + isVertical=true; + else if (vertical_str == "-1" || vertical_str == "N" || vertical_str == "n") + isVertical=false; + else{ + Project::theInfo()->warning(INFO_OBS,_file->get_fileDepth(),QT_TRANSLATE_NOOP("QObject","At line %d: %s => %s is not a valid value for Vertical."),line_number,line.c_str(),vertical_str.c_str()); + ok=false; + } + if (!(iss >> sigmaFactor)) + sigmaFactor=1.0; + } + else + isVertical=false; + } + else{ //test if variance factor and station height + if (iss >> sigmaFactor) iss >> stationHeight; - varianceFactor*=varianceFactor;//varianceFactor=K**2 + else + sigmaFactor=1.0; + isVertical=false; } diff --git a/src/station_bascule.h b/src/station_bascule.h index 32676f23..69e24655 100644 --- a/src/station_bascule.h +++ b/src/station_bascule.h @@ -89,7 +89,8 @@ class Station_Bascule : public Station tdouble a,b,c;//value of orientations unknowns Mat3 R_vert2instr;//Matrix between vertical on station point and instrument z (should be I if bubbuled) - tdouble stationHeight, varianceFactor; //only for GNSS baselines + tdouble stationHeight; //Only for GNSS baselines + tdouble sigmaFactor; //for GNSS baselines (19) and cartesian subframes (11) and polar subframes (12) //only when reading transfo std::string readStationName; diff --git a/tests/data/baselines/ex_ref.comp b/tests/data/baselines/ex_ref.comp index f84b8ba0..4bc7f2d4 100644 --- a/tests/data/baselines/ex_ref.comp +++ b/tests/data/baselines/ex_ref.comp @@ -1,9 +1,10 @@ data= { - "COMP3D_COMMIT" : "v5.22-21-ge6096736-dirty", - "COMP3D_COPYRIGHT" : "Copyright 1992-2024 IGN France", - "COMP3D_LICENSE" : "Licensed for tests only", + "COMP3D_COMMIT" : "InitPublic-12-g17577e34-dirty", + "COMP3D_COPYRIGHT" : "Copyright 1992-2024 IGN France www.ign.fr", + "COMP3D_LICENSE" : "Provided with absolutely no warranty, under GPLv3 license", "COMP3D_OPTIONS" : "QT SIM ", + "COMP3D_REPO" : "https://github.com/IGNF/Comp3D", "COMP3D_VERSION" : "COMP3D v5.23dev-linux", "all_data_files" : { @@ -50,8 +51,8 @@ data= "min" : 0.48340294863001054 }, "compensation_done" : true, - "computation_duration" : "00:00:00.002352", - "computation_start" : "2024-May-14 11:35:09.882589", + "computation_duration" : "00:00:00.000216", + "computation_start" : "2024-Jul-04 16:37:51.524487", "internal_constraints" : false, "internal_constraints_obs" : [], "interrupted" : false, @@ -152,7 +153,7 @@ data= "use_ellips_height" : true, "use_proj" : true }, - "config_file" : "/home/JMMuller/prog/comp3d_cpp/tests/data/baselines/ex_ref.comp_test.comp", + "config_file" : "/home/CBellon/Documents/Developpement/Comp3D/Comp3D/comp3d_cpp/tests/data/baselines/ex_ref.comp_test.comp", "other_stations" : null, "points" : { @@ -555,10 +556,10 @@ data= } ], "params" : null, + "sigma_factor" : 1.0, "station_height" : 0.0, "triplet_type" : 19, "type" : "bascule", - "variance_factor" : 1.0, "vertical" : false }, { diff --git a/tests/tests_nonreg.cpp b/tests/tests_nonreg.cpp index 03c2ace2..eec854f3 100644 --- a/tests/tests_nonreg.cpp +++ b/tests/tests_nonreg.cpp @@ -85,7 +85,7 @@ void Tests_NonReg::test_baselines() { std::cout<<"\nPrepare test_baselines"<