Skip to content

Commit

Permalink
K factor for standard deviation in cartesian and polar subframes, ver…
Browse files Browse the repository at this point in the history
…tical -1=N=n or 1=V=v and nothing else
  • Loading branch information
cle authored and jmmuller committed Jul 10, 2024
1 parent 5a68c8b commit c4d75e9
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 34 deletions.
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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


27 changes: 17 additions & 10 deletions doc_uni/obs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -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:

Expand Down
50 changes: 35 additions & 15 deletions src/station_bascule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)<MINIMAL_SIGMA)||(fabs(sigma_abs2_original)<MINIMAL_SIGMA)||(fabs(sigma_abs3_original)<MINIMAL_SIGMA))
{
Project::theInfo()->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());
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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)
{
}

Expand Down Expand Up @@ -1075,8 +1080,8 @@ Json::Value Station_Bascule::toJson(FileRefJson &fileRef) const
if (isGeocentric)
{
val["station_height"]=static_cast<double>(stationHeight);
val["variance_factor"]=static_cast<double>(varianceFactor);
}
val["sigma_factor"]=static_cast<double>(sigmaFactor);

val["ang_to_vert"]=angleInstr2Vert()/toRad(1.0,Project::theone()->config.filesUnit);
return val;
Expand Down Expand Up @@ -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;
}

Expand Down
3 changes: 2 additions & 1 deletion src/station_bascule.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
15 changes: 8 additions & 7 deletions tests/data/baselines/ex_ref.comp
Original file line number Diff line number Diff line change
@@ -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" :
{
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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" :
{
Expand Down Expand Up @@ -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
},
{
Expand Down
2 changes: 1 addition & 1 deletion tests/tests_nonreg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ void Tests_NonReg::test_baselines()
{
std::cout<<"\nPrepare test_baselines"<<std::endl;
std::string refFile="./data/baselines/ex_ref.comp";
std::string refMD5="c771484db5f9691401925f5820bdbbac";
std::string refMD5="399a84b6b3722a45c4fa74004c380046";

test_template(refFile, refMD5,false);
}
Expand Down

0 comments on commit c4d75e9

Please sign in to comment.