-
Notifications
You must be signed in to change notification settings - Fork 2
/
ntpd_tut9.sh
3678 lines (2374 loc) · 104 KB
/
ntpd_tut9.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# TUTORIAL 9: Differential Positioning and
# Carrier Ambiguity Fixing
#==========================================
# Create the Working directory and copy Programs and Files
# into this directory.
mkdir ./WORK 2> /dev/null
mkdir ./WORK/TUT9
mkdir ./WORK/TUT9/FIG
# Go to the working directory:
cd ./WORK/TUT9
#PROGRAM FILES
#-------------
cp ../../PROG/TUT9/* .
if [[ $(uname -s) =~ "CYGWIN" ]]
then
cp -d /bin/gLAB_linux /bin/gLAB_GUI /bin/graph.py .
fi
#DATA FILES
#----------
cp ../../FILES/TUT9/* .
gzip -df *.gz
# ========================
# PRELIMINARY computations
# ========================
# P.1. Computate the reference values for the receivers coordinates:
#====================================================================
# P.1.1 Using gLAB and precise orbits and clocks, compute the PPP solution
# ----- for the precise coordinates of the Antenna Phase Centre of receivers
# PLAN, GARR, INDR1, INDR2, INDR3
#
# Files: igs17286.sp3, igs17286.clk, igs08_1719.atx.
#
# Note: the values of "APPROXIMATE COORDINATES" written in RINEX files
# correspond to the precise APC of LC coordinates.
#
# Assume the APC for L1 and LC are the same.
# APC coordinates computation
# .........................
#
# The following procedure can be applied:
./gLAB_linux -input:cfg gLAB_2files_APC.cfg -input:obs PLAN0540.13O -input:orb igs17286.sp3 -input:clk igs17286.clk -input:ant igs08_1719.atx
grep OUTPUT gLAB.out | tail -1|gawk '{print "PLAN",$6,$7,$8,$15,$16,$17}' >> sta.pos
./gLAB_linux -input:cfg gLAB_2files_APC.cfg -input:obs GARR0540.13O -input:orb igs17286.sp3 -input:clk igs17286.clk -input:ant igs08_1719.atx
grep OUTPUT gLAB.out | tail -1|gawk '{print "GARR",$6,$7,$8,$15,$16,$17}' >> sta.pos
./gLAB_linux -input:cfg gLAB_2files_APC.cfg -input:obs IND10540.13O -input:orb igs17286.sp3 -input:clk igs17286.clk -input:ant igs08_1719.atx
grep OUTPUT gLAB.out | tail -1|gawk '{print "IND1",$6,$7,$8,$15,$16,$17}' >> sta.pos
./gLAB_linux -input:cfg gLAB_2files_APC.cfg -input:obs IND20540.13O -input:orb igs17286.sp3 -input:clk igs17286.clk -input:ant igs08_1719.atx
grep OUTPUT gLAB.out | tail -1|gawk '{print "IND2",$6,$7,$8,$15,$16,$17}' >> sta.pos
./gLAB_linux -input:cfg gLAB_2files_APC.cfg -input:obs IND30540.13O -input:orb igs17286.sp3 -input:clk igs17286.clk -input:ant igs08_1719.atx
grep OUTPUT gLAB.out | tail -1|gawk '{print "IND3",$6,$7,$8,$15,$16,$17}' >> sta.pos
# Plot the results (North, East, Up errors):
./graph.py -f gLAB.out -x4 -y18 -s.- -c '($1=="OUTPUT")' -l "North error" -f gLAB.out -x4 -y19 -s.- -c '($1=="OUTPUT")' -l "East error" -f gLAB.out -x4 -y20 -s.- -c '($1=="OUTPUT")' -l "Up error" --yn -.5 --yx .5 --xl "time (s)" --yl "error (m)" -t "PPP" --sv FIG/Tu6_exP1.png
#Results:
#------
more sta.pos
# PLAN 4787328.7916 166086.0719 4197602.8893 41.418528940 1.986956885 320.0721
# GARR 4796983.5170 160309.1774 4187340.3887 41.292941948 1.914040816 634.5682
# IND1 4787678.1496 183409.7131 4196172.3056 41.403026173 2.193853893 109.5681
# IND2 4787678.9809 183402.5915 4196171.6833 41.403018646 2.193768411 109.5751
# IND3 4787689.5146 183392.8859 4196160.1653 41.402880392 2.193647610 109.5743
# Question:
# ---------
# What is the expected accuracy of the computed coordinates?
# P.1.2.- Using octave, compute the baseline length between the different receivers:
# ...........................
########################## OCTAVE or MATLAB ####################
#Execute for instance (you can use either octave or MATLAB):
octave
IND1=[ 4787678.1496 183409.7131 4196172.3056 ]
IND2=[ 4787678.9809 183402.5915 4196171.6833]
norm(IND1-IND2,2)
#ans = 7.1969
exit
###################### END OCTAVE ##############################
# Results:
#--------
# IND1-IND2: 7.197 m
# IND2-IND3: 18.380 m
# IND1-IND3: 23.658 m
# PLAN-GARR: 15.228 km
# PLAN-IND1: 17.386 km
# IND1-GARR: 26.424 km
# P.2.- MODEL COMPONENTS COMPUTATION
# ==================================
# The script "ObsFile.scr" generates a data file with the following content
# 1 2 3 4 5 6 7 8 9 10 11 12 13
# [sta sat DoY sec P1 L1 P2 L2 rho Trop Ion elev azim]
# 1.- Run this script for all the receivers:
./ObsFile.scr PLAN0540.13O brdc0540.13n
./ObsFile.scr GARR0540.13O brdc0540.13n
./ObsFile.scr IND10540.13O brdc0540.13n
./ObsFile.scr IND20540.13O brdc0540.13n
./ObsFile.scr IND30540.13O brdc0540.13n
# Merge all files in a single file:
cat ????.obs > ObsFile.dat
# 2.- Select the satellites with elevation over 10deg within the time interval
# [14500:16500]
cat ObsFile.dat|gawk '{if ($4>=14500 && $4<=16500 && $12>10) print $0}' >obs.dat
# 3.- Confirm that the satellite PRN06 is the satellite with the highest
# elevation (this satellite will be used as the reference satellite).
# ------------------- obs.dat -----------------------
# 1 2 3 4 5 6 7 8 9 10 11 12 13
# [sta sat DoY sec P1 L1 P2 L2 rho Trop Ion elev azim]
# ----------------------------------------------------
#////////////////////////////////////////////////////////////////////////////
#/////////////////////////// SESSION A //////////////////////////////////////
#////////////////////////////////////////////////////////////////////////////
# =========
# SESSION A: Differential positioning between the receivers: IND2- IND3
# =========
# A.1 Double-Differences computation
# ==================================
#
# Using the previously generated file "obs.dat", compute the Double Differences
# of measurements between the receivers "IND2" (reference) and IND3, and the satellites
# PRN06 (reference) and [PRN 03, 07, 11, 16, 18, 19, 21, 22, 30]
#
#
# The following procedure can be applied:
#
# The script "DDobs.scr" computes the double differences between receivers and
# satellites.
#
# For instance, the following sentence, generates the file (among other files):
#
# ------------------- DD_${sta1}_${sta2}_${sat1}_${sat2}.dat -------------------------
#
# 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
# [sta1 sta2 sat1 sat2 DoY sec DDP1 DDL1 DDP2 DDL2 DDrho DDTrop DDIon El1 Az1 El2 Az2]
# <--- sta2 --->
# -------------------------------------------------------------------------------------
#
#
# Where:
# The elevation and azimuth correspond to the satellites in view from station 2
# El1 Az1 are for satellite 1
# El2 Az2 are for satellite 2
# Compute the double differences between the receivers "IND2" (reference) and IND3# and the satellites PRN06 (reference) and [PRN 03, 07, 11, 16, 18, 19, 21, 22, 30]
./DDobs.scr obs.dat IND2 IND3 06 03
./DDobs.scr obs.dat IND2 IND3 06 07
./DDobs.scr obs.dat IND2 IND3 06 11
./DDobs.scr obs.dat IND2 IND3 06 16
./DDobs.scr obs.dat IND2 IND3 06 18
./DDobs.scr obs.dat IND2 IND3 06 19
./DDobs.scr obs.dat IND2 IND3 06 21
./DDobs.scr obs.dat IND2 IND3 06 22
./DDobs.scr obs.dat IND2 IND3 06 30
# Merge the files in a single file and sort by time:
cat DD_IND2_IND3_06_??.dat|sort -n -k +6 > DD_IND2_IND3_06_ALL.dat
#-----------------------------------------------------------------------------------
#OUTPUT file:
#
#[IND2 IND3 06 PRN DoY sec DDP1 DDL1 DDP2 DDL2 DDrho DDTrop DDIon El1 Az1 El2 Az2]
# PRN06 PRNXX
# <-- from IND2 -->
#-----------------------------------------------------------------------------------
# A.2 Baseline Estimation (IND2-IND3 receivers)
# =============================================
# Using "octave" and the receiver's coordinates estimated before, compute the
# baseline vector between IND2 and IND3. Give the results in ENU system.
# Hint:
#------
########################## OCTAVE ##############################
#Execute for instance:
octave
#output_precision(3)
format long
IND2=[4787678.9809 183402.5915 4196171.6833]
IND3=[4787689.5146 183392.8859 4196160.1653]
IND3-IND2
# [10.5337 -9.7056 -11.5180]
#IND3 (latitude and longitude):
l=2.193647610*pi/180
f=41.402880392*pi/180
R=[-sin(l) cos(l) 0; -cos(l)*sin(f) -sin(l)*sin(f) cos(f); cos(l)*cos(f) sin(l)*cos(f) sin(f)]
bsl_enu=R*(IND3-IND2)'
#bsl_enu =[-10.1017 -15.3551 -0.0008]
exit
####################### END OCTAVE ###############################
# A.2.1.- Baseline vector estimation using P1 code measurements:
#-----------------------------------------------------------
# Estimate the baseline vector between IND2 and IND3 receivers using the code
# measurements of file (DD_IND2_IND3_06_ALL.dat).
# Use the entire file (i.e. time interval [14500:16500])
# Questions:
# ----------
# 1) Justify that the next sentence allows to build the equations system:
# [DDP1]=[Los_k-Los_06]*[baseline]
cat DD_IND2_IND3_06_ALL.dat | gawk 'BEGIN{g2r=atan2(1,1)/45}{e1=$14*g2r;a1=$15*g2r;e2=$16*g2r;a2=$17*g2r;;printf "%14.4f %8.4f %8.4f %8.4f \n",$7,-cos(e2)*sin(a2)+cos(e1)*sin(a1),-cos(e2)*cos(a2)+cos(e1)*cos(a1),-sin(e2)+sin(e1)}' > M.dat
# Note:
# - The first column of "M.dat" file corresponds to "DDP1" (i.e. to the
# measurements DD).
# - The other three columns correspond to the Geometry matrix
# "[Los_k-Los_06]".
# Solve the equations system using octave and assess the estimation error:
#Solution:
#---------
########################## OCTAVE ##############################
#Execute for instance:
octave
format long
load M.dat
y=M(:,1);
G=M(:,2:4);
x=inv(G'*G)*G'*y
x(1:3)'
# -10.290863988521810 -15.385561719991301 -0.651068411484908
bsl_enu =[-10.1017 -15.3551 -0.0008]
x(1:3)-bsl_enu'
# -0.1891639885218108
# -0.0304617199913011
# -0.6502684114849081
exit
######################### END OCTAVE #############################
# A.2.2 Repeat the previous computation, but using just the two epochs: 14500
# ----- and 14515.
#Solution:
#---------
# a) Select the two epochs:
cat DD_IND2_IND3_06_ALL.dat|gawk '{if ($6==14500||$6==14515) print $0}' > tmp.dat
# b) Build the navigation system:
cat tmp.dat| gawk 'BEGIN{g2r=atan2(1,1)/45}{e1=$14*g2r;a1=$15*g2r;e2=$16*g2r;a2=$17*g2r;;printf "%14.4f %8.4f %8.4f %8.4f \n",$7,-cos(e2)*sin(a2)+cos(e1)*sin(a1),-cos(e2)*cos(a2)+cos(e1)*cos(a1),-sin(e2)+sin(e1)}' > M.dat
########################## OCTAVE ##############################
#Execute for instance:
octave
format long
load M.dat
y=M(:,1);
G=M(:,2:4);
x=inv(G'*G)*G'*y
x(1:3)'
# -10.95246374869830 -14.73629676316433 -1.77796717481061
bsl_enu =[-10.1017 -15.3551 -0.0008]
x(1:3)-bsl_enu'
# -0.850763748698302
# 0.618803236835673
# -1.777167174810606
exit
######################## END OCTAVE #############################
# Questions:
# -----------
#
# 1.- What is the level of accuracy?
# 2.- Why does the solution degrade when taking only two epochs?
# A.3. Baseline vector estimation using L1 carrier measurements
# =============================================================
# Estimate the baseline vector between IND2 and IND3 receivers using the
# L1 carrier measurements of file (DD_IND2_IND3_06_ALL.dat).
# Consider only the two epochs used in the previous exercise: t1=14500s and
# t2=14515s.
# The following procedure can be applied:
# A.3.1. Compute the Baseline solution:
# ------
# In the previous computation we have not taken into account the correlations
# between the double differences of measurements. This matrix will be used now,
# as the LAMBDA method will be applied to FIX the carrier ambiguities.
#
# a) Show that the covariance matrix of DDL1 is given by:
#
# [2 1 1 ... 1]
# [1 2 1 ... 1]
# Py= [1 1 2 ... 1]
# [ ..... ]
# [1 1 1 ... 2]
#
#
# b) Generate the measurement vectors and matrices for the selected epochs t1,t2
# y1:=y[t1] G1:=G[t1] Py
# y2:=y[t2] G2:=G[t2] Py
#
# Merge the two vectors and matrices into a common system and show
# that the solution is given by:
#
# P=inv(G1'*W*G1+G2'*W*G2);
# x=P*(G1'*W*y1+G2'*W*y2)
#
# where: W=inv(Py)
#
#
# The script "MakeL1BslMat.scr" builds the equations system
#
# [DDL1]=[Los_k-Los_06]*[baseline] + [ A ]*[lambda1*DDN1]
#
# for the two required epochs t1=14500 and t2=14515, using
# the input file "DD_IND2_IND3_06_ALL.dat" generated before.
#
# ============================================================
# Execute:
./MakeL1BslMat.scr DD_IND2_IND3_06_ALL.dat 14500 14515
# ============================================================
#
# The OUTPUT are the files "M1.dat" and "M2.dat" associated with
# each epoch.
#
# Example:
# --------
#
# [DDL1] [ Los_k-Los_REF] [ A ]
# ------ -------------------- -------------
# -3.3762 0.3398 -0.1028 0.0714 1 0 0 0 0 0 0
# -7.1131 0.1725 0.5972 0.0691 0 1 0 0 0 0 0
# 4.3881 -0.6374 0.0227 0.2725 0 0 1 0 0 0 0 t=t1
# -5.6982 0.6811 -0.1762 0.3022 0 0 0 1 0 0 0 <===> M1.dat
# 9.4853 -0.6876 -0.2881 0.5093 0 0 0 0 1 0 0
# -5.2016 -0.4148 0.6119 0.1935 0 0 0 0 0 1 0
# -16.8894 -0.0264 1.0181 0.4078 0 0 0 0 0 0 1
#
#
# -3.3709 0.3398 -0.1031 0.0707 1 0 0 0 0 0 0
# -7.1438 0.1739 0.5982 0.0701 0 1 0 0 0 0 0
# 4.4156 -0.6356 0.0199 0.2729 0 0 1 0 0 0 0 t=t2
# -5.6819 0.6814 -0.1776 0.3012 0 0 0 1 0 0 0 <===> M2.dat
# 9.4911 -0.6868 -0.2891 0.5109 0 0 0 0 1 0 0
# -5.1689 -0.4133 0.6090 0.1927 0 0 0 0 0 1 0
# -16.9101 -0.0248 1.0183 0.4097 0 0 0 0 0 0 1
# ----------------------------------------------------------------------
# c) Solve the equations system using octave and apply the LAMBDA
# method to FIX the ambiguities.
#
# c.1) Compute the FLOATED solution, solving the equations system
# with octave. Assess the accuracy of the floated solution.
#
# c.2) Apply the LAMBDA method to FIX the ambiguities.
# Compare the results with the solution obtained by
# rounding directly the floated solution and by rounding
# the solution after decorrelation.
#
# c.3) Repair the DDL1 carrier measurements with the DDN1 FIXED
# ambiguities and plot the results to analyse the data.
#
# c.4) Compute the FIXED solution.
# Solution:
# ---------
########################## OCTAVE ##############################
#Execute for instance:
# c.1) Compute the FLOATED solution, solving the equations system.
# The following procedure can be applied
# (justify the computations done)
octave
format long
load M1.dat
load M2.dat
y1=M1(:,1);
G1=M1(:,2:11);
y2=M2(:,1);
G2=M2(:,2:11);
n=7;
# Take sigma=2cm for the DDL1 carrier measurement noise.
# (actually, the prefit residuals).
Py=(diag(ones(1,n))+ones(n))*2e-4;
W=inv(Py);
P=inv(G1'*W*G1+G2'*W*G2);
x=P*(G1'*W*y1+G2'*W*y2);
x(1:3)'
# -8.946290850626383 -15.910175771706690 -0.786356288049205
bsl_enu =[-10.1017 -15.3551 -0.0008]
x(1:3)-bsl_enu'
# 1.155409149373616
# -0.555075771706690
# -0.785556288049205
# c.2) Apply the LAMBDA method to FIX the ambiguities.
# Compare the results with the solution obtained by
# rounding the floated solution.
# The following procedure can be applied
# (justify the computations done):
c=299792458;
f0=10.23e+6;
f1=154*f0;
lambda1=c/f1
a=x(4:10)/lambda1;
Q=P(4:10,4:10);
[Qz,Zt,Lz,Dz,az,iZ] = decorrel (Q,a);
[azfixed,sqnorm] = lsearch (az,Lz,Dz,2);
afixed=iZ*azfixed
sqnorm(2)/sqnorm(1)
# ans = 3.31968973623500
# 1) Ambiguities fixed from the LS integer
# search:
afixed(:,1)'
# -8 20 -9 -8 -10 0 -8
# 2) Ambiguities fixed by rounding the
# decorrelated floated solution:
afix=iZ*round(az);
afix'
# -8 20 -9 -8 -10 0 -8
# 3) Ambiguities fixed by rounding directly the
# floated solution:
round(a)'
# -10 21 -4 -11 -4 5 -3
# Save the fixed ambiguities from the LS
# integer search in file "ambL1.dat" to
# compute the FIXED solution.
amb=lambda1*afixed(:,1);
save ambL1.dat amb
exit
######################## END OCTAVE #############################
# c.3) Repair the DDL1 carrier measurements with the DDN1 FIXED
# ambiguities and plot the results to analyse the data.
# Saving the FIXED ambiguities:
# ------
#
# Using the previous files "ambL1.dat" and "DD_IND2_IND3_06_ALL.dat",
# generate a file with the following content:
#---------------------------- DD_IND2_IND3_06_ALL.fix -------------------------------------------
#
# 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#[sta1 sta2 sat1 sat2 DoY sec DDP1 DDL1 DDP2 DDL2 DDrho DDTrop DDIon El1 Az1 El2 Az2 lambda*DDN1]
# <--- sta2 --->
#------------------------------------------------------------------------------------------------
# Note: This file is identical to file "DD_IND2_IND3_06_30.dat", but with the
# ambiguities added in the last field #18.
# The following procedure can be applied:
# 1) Generate a file with the satellite PRN number and the ambiguities:
grep -v \# ambL1.dat > na1
cat DD_IND2_IND3_06_ALL.dat | gawk '{print $4}' | sort -nu | gawk '{print $1,NR}' > sat.lst
paste sat.lst na1 > sat.ambL1
# 2) Generate the "DD_IND2_IND3_06_30.fix" file:
cat DD_IND2_IND3_06_ALL.dat |gawk 'BEGIN{for (i=1;i<1000;i++) {getline <"sat.ambL1";A[$1]=$3}}{printf "%s %02i %02i %s %14.4f %14.4f %14.4f %14.4f %14.4f %14.4f %14.4f %14.4f %14.4f %14.4f %14.4f %14.4f %14.4f %14.4f \n",$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,A[$4]}' > DD_IND2_IND3_06_ALL.fixL1
# 3) Make the following plots and discuss the results:
./graph.py -f DD_IND2_IND3_06_ALL.fixL1 -x6 -y'($8-$18-$11)' -so --yn -0.06 --yx 0.06 -l "(DDL1-DDN1)-DDrho" --xl "time (s)" --yl "metres" --sv FIG/Tu6_exA.3.1a.png
./graph.py -f DD_IND2_IND3_06_ALL.fixL1 -x6 -y'($8-$11)' -so --yn -5 --yx 5 -l "(DDL1-DDRho)" --xl "time (s)" --yl "metres" --sv FIG/Tu6_exA.3.1b.png
./graph.py -f DD_IND2_IND3_06_ALL.fixL1 -x6 -y'($8-$18)' -so --yn -20 --yx 20 -l "(DDL1-DDN1)" --xl "time (s)" --yl "metres" --sv FIG/Tu6_exA.3.1c.png
# Questions:
# ----------
# Expalin what is the meaning of each plot?
# c.4) Compute the FIXED solution.
# -------------------------------
#
# Remove the ambiguities on L1 carrier and compute the FIXED SOLUTION:
# 1) Build the equations system:
# [DDL1-Lambda*DDN1]=[Los_k-Los_06]*[baseline]
cat DD_IND2_IND3_06_ALL.fixL1 |gawk 'BEGIN{g2r=atan2(1,1)/45}{e1=$14*g2r;a1=$15*g2r;e2=$16*g2r;a2=$17*g2r;;printf "%14.4f %8.4f %8.4f %8.4f \n",$8-$18,-cos(e2)*sin(a2)+cos(e1)*sin(a1),-cos(e2)*cos(a2)+cos(e1)*cos(a1),-sin(e2)+sin(e1)}' > M.dat
# 2) Solve the equations system using octave:
########################## OCTAVE ##############################
#Execute for instance:
octave
format long
load M.dat
y=M(:,1);
G=M(:,2:4);
x=inv(G'*G)*G'*y
P=inv(G'*G);
x(1:3)'
# -1.01144454057522e+01 -1.53615270576494e+01 3.06638285676705e-03
bsl_enu =[-10.1017 -15.3551 -0.0008]
x(1:3)-bsl_enu'
# -0.01274540575222005
# -0.00642705764942164
# 0.00386638285676705
exit
######################## END OCTAVE #############################
# A.3.2 Using the DDL1 carrier with the ambiguities FIXED, compute the single
# ----- epoch solution for the whole interval 145000< t <165000 with the
# program LS.f
#
# Note: The program "LS.f" computes the Least Square solution for each
# measurement epoch of the input file (see the FORTRAN code "LS.f")
#
#
# The next procedure can be applied:
#
# 1) Generate a file with the following content:
#
# ["time" "DDL1-DDRho-Lambda*DDN1" "Los_k-Los_06"]
#
# where:
# time= second of day
# DDL1-DDRho-Lambda*DDN1= Prefit residuals
# (i.e., "y" values in program LS.f)
# Los_k-Los_06= the three components of the geometry matrix
# (i.e., matrix "a" in program LS.f).
#
cat DD_IND2_IND3_06_ALL.fixL1 | gawk 'BEGIN{g2r=atan2(1,1)/45}{e1=$14*g2r;a1=$15*g2r;e2=$16*g2r;a2=$17*g2r;;printf "%s %14.4f %8.4f %8.4f %8.4f \n",$6,$8-$18,-cos(e2)*sin(a2)+cos(e1)*sin(a1),-cos(e2)*cos(a2)+cos(e1)*cos(a1),-sin(e2)+sin(e1)}' > L1model.dat
# 2) compute the Least Squares solution for the epochs given in the file:
cat L1model.dat |./LS > L1fix.pos
# 3) Plot the baseline error:
# bsl_enu =[-10.1017 -15.3551 -0.0008]
./graph.py -f L1fix.pos -x1 -y'($2+10.1017)' -s.- -l "North error" -f L1fix.pos -x1 -y'($3+15.3551)' -s.- -l "East error" -f L1fix.pos -x1 -y'($4+0.0008)' -s.- -l "Up error" --yn -.1 --yx .1 --xl "time (s)" --yl "error (m)" -t "Baseline error: IND2-IND3: 18.38m: L1 ambiguities fixed" --sv FIG/Tu6_exA.3.2.png
# A.3.3 Repeat the previous computation, but using the unsmoothed code
# ----- measurements.
#
#
# 1) Generate a file with the following content:
#
# ["time" "DDP1-DDRho" "Los_k-Los_06"]
cat DD_IND2_IND3_06_ALL.fixL1 | gawk 'BEGIN{g2r=atan2(1,1)/45}{e1=$14*g2r;a1=$15*g2r;e2=$16*g2r;a2=$17*g2r;;printf "%s %14.4f %8.4f %8.4f %8.4f \n",$6,$7-$11,-cos(e2)*sin(a2)+cos(e1)*sin(a1),-cos(e2)*cos(a2)+cos(e1)*cos(a1),-sin(e2)+sin(e1)}' > P1model.dat
# 2) compute the Least Squares solution for the epochs given in the file:
cat P1model.dat |./LS > P1.pos
# 3) Plot the results:
./graph.py -f P1.pos -x1 -y2 -s.- -l "North error" -f P1.pos -x1 -y3 -s.- -l "East error" -f P1.pos -x1 -y4 -s.- -l "Up error" --yn -5 --yx 5 --xl "time (s)" --yl "error (m)" -t "IND2-IND3: 18.38m: P1 code pseudorange" --sv FIG/Tu6_exA.3.3.png
# Questions:
# ----------
# 1.- Discuss the results by comparing them with the previous ones computed
# with DDL1 carrier measurements.
# 2.- Discuss the pattern seen in the plot.
# A.4. Repeat the computation of exercise A.3, but using the two epochs: 14500
# ============================================= and 14600.
# a) The next sentence builds the equations system:
# [DDP1]=[Los_k-Los_06]*[baseline] + [ A ]*[lambda*DDN1]
./MakeL1BslMat.scr DD_IND2_IND3_06_ALL.dat 14500 14600
# b) Solve the equations system using octave and assess the estimation error:
#Solution:
#---------
########################## OCTAVE ##############################
#Execute for instance:
# b.1) Compute the FLOATED solution, solving the equations system.
# The following procedure can be applied:
octave
format long
load M1.dat
load M2.dat
y1=M1(:,1);
G1=M1(:,2:11);
y2=M2(:,1);
G2=M2(:,2:11);
n=7;
Py=(diag(ones(1,n))+ones(n))*2*1e-4;
W=inv(Py);
P=inv(G1'*W*G1+G2'*W*G2);
x=P*(G1'*W*y1+G2'*W*y2);
x(1:3)'
# -9.7700067335170075 -15.1862528010743603 -0.0821273504816880
bsl_enu =[-10.1017 -15.3551 -0.0008]
x(1:3)-bsl_enu'
# 0.3316932664829917
# 0.1688471989256399
# -0.0813273504816880
# b.2) Apply the LAMBDA method to FIX the ambiguities.
# Compare the results with the solution obtained by
# rounding the floated solution.
# The following procedure can be applied:
c=299792458;
f0=10.23e+6;
f1=154*f0;
lambda1=c/f1
a=x(4:10)/lambda1;
Q=P(4:10,4:10);
[Qz,Zt,Lz,Dz,az,iZ] = decorrel (Q,a);
[azfixed,sqnorm] = lsearch (az,Lz,Dz,2);
afixed=iZ*azfixed
sqnorm(2)/sqnorm(1)
# ans = 34.4801936204742
# 1) Ambiguities fixed from the LS integer
# search
afixed(:,1)'
# -8 20 -9 -8 -10 0 -8
# 2) Ambiguities fixed by rounding the
# decorrelated floated solution:
afix=iZ*round(az);
afix'
# -8 20 -9 -8 -10 0 -8
# 3) Ambiguities fixed by rounding directly the
# floated solution:
round(a)'
# -8 19 -8 -9 -8 0 -9
exit
######################## END OCTAVE #############################
# OPTIONAL:
# Repeat by using the two epochs 14500 and 15000
# Questions:
# ----------
# 1.- Has the accuracy improved?
# 2.- Can the ambiguities be well fixed?
# 3.- Has the reliability improved? Why?
# A.5.- Differential Positioning: Absolute coordinates estimation
# ===============================================================
# Estimate the coordinates of receiver IND3 taking IND2 as a reference station.
#
# Note: assume there is no error in the IND2 coordinates
# A.5.1 Estimation using P1 code measurements:
# -------------------------------------------
# Estimate the coordinates using the code measurements of file
# (DD_IND2_IND3_06_ALL.dat). Use the entire file (i.e., time interval
# [14500:16500])
#---------------------------- DD_IND2_IND3_06_30.dat ------------------------------
#
# 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#[sta1 sta2 sat1 sat2 DoY sec DDP1 DDL1 DDP2 DDL2 DDrho DDTrop DDIon El1 Az1 El2 Az2
# <--- sta2 --->
#-----------------------------------------------------------------------------------
# Questions:
# ----------
#
# 1) Justify that the next sentence allows to build the equations system:
#
# [DDP1-DDRho]=[Los_k-Los_06]*[dx]
cat DD_IND2_IND3_06_ALL.dat | gawk 'BEGIN{g2r=atan2(1,1)/45}{e1=$14*g2r;a1=$15*g2r;e2=$16*g2r;a2=$17*g2r;;printf "%14.4f %8.4f %8.4f %8.4f \n",$7-$11,-cos(e2)*sin(a2)+cos(e1)*sin(a1),-cos(e2)*cos(a2)+cos(e1)*cos(a1),-sin(e2)+sin(e1)}' > M.dat
# 2) Solve the equations system using octave and assess the estimation error:
# Solution:
#---------
########################## OCTAVE ##############################
#Execute for instance:
octave
format long
load M.dat
y=M(:,1);
G=M(:,2:4);
x=inv(G'*G)*G'*y
x(1:3)'
# -0.1892084058110140 -0.0304516682557553 -0.6504447633705878
# Taking into account that the "a priori" coordinates of IND3 are:
IND3=[4787689.5146 183392.8859 4196160.1653]
# thence, the estimated absolute coordinates of IND3 are:
IND3+ x(1:3)'
# [4787689.3254 183392.8554 4196159.5149]
exit
######################### END OCTAVE #############################
# A.5.2 Repeat the previous computation, but using just the two epochs: 14500
# ------ and 14515.
#Solution:
#---------
# a) Select the two epochs:
cat DD_IND2_IND3_06_ALL.dat|gawk '{if ($6==14500||$6==14515) print $0}' >tmp.dat
# b) Build the navigation equations system:
cat tmp.dat| gawk 'BEGIN{g2r=atan2(1,1)/45}{e1=$14*g2r;a1=$15*g2r;e2=$16*g2r;a2=$17*g2r;printf "%14.4f %8.4f %8.4f %8.4f \n",$7-$11,-cos(e2)*sin(a2)+cos(e1)*sin(a1),-cos(e2)*cos(a2)+cos(e1)*cos(a1),-sin(e2)+sin(e1)}' > M.dat
########################## OCTAVE ##############################
#Execute for instance:
octave
format long
load M.dat
y=M(:,1);
G=M(:,2:4);
x=inv(G'*G)*G'*y
x'
# -0.850914928283142 0.619002781048194 -1.778309021185260
# Taking into account that the "a priori" coordinates of IND3 are:
IND3=[4787689.5146 183392.8859 4196160.1653]
# thence, the estimated absolute coordinates of IND3 are:
IND3+ x'
# [4787688.6637 183393.5049 4196158.3870]
exit
######################## END OCTAVE #############################
# Questions:
# ----------
#
# 1.- What is the level of accuracy?
# 2.- Why does the solution degrade when taking only two epochs?
# A.6- Estimation using L1 carrier measurements:
# ==============================================
# Estimate the IND3 using the L1 carrier measurements of file
# (DD_IND2_IND3_06_ALL.dat). Consider only the two epochs used in the previous
# example: t1= 14500 and t2=14515.
# A.6.1. Compute the floated solution:
# ------
# Note that, as in the previous case (with the baseline vector estimation),
# we have to take into account that the covariance matrix of DDL1 is given by:
#