-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathppp.c
1235 lines (1094 loc) · 43.8 KB
/
ppp.c
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
/*------------------------------------------------------------------------------
* ppp.c : precise point positioning
*
* Copyright (C) 2010-2016 by T.TAKASU, All rights reserved.
*
* options : -DIERS_MODEL use IERS tide model
* -DOUTSTAT_AMB output ambiguity parameters to solution status
*
* references :
* [1] D.D.McCarthy, IERS Technical Note 21, IERS Conventions 1996, July 1996
* [2] D.D.McCarthy and G.Petit, IERS Technical Note 32, IERS Conventions
* 2003, November 2003
* [3] D.A.Vallado, Fundamentals of Astrodynamics and Applications 2nd ed,
* Space Technology Library, 2004
* [4] J.Kouba, A Guide to using International GNSS Service (IGS) products,
* May 2009
* [5] RTCM Paper, April 12, 2010, Proposed SSR Messages for SV Orbit Clock,
* Code Biases, URA
* [6] MacMillan et al., Atmospheric gradients and the VLBI terrestrial and
* celestial reference frames, Geophys. Res. Let., 1997
* [7] G.Petit and B.Luzum (eds), IERS Technical Note No. 36, IERS
* Conventions (2010), 2010
* [8] J.Kouba, A simplified yaw-attitude model for eclipsing GPS satellites,
* GPS Solutions, 13:1-12, 2009
* [9] F.Dilssner, GPS IIF-1 satellite antenna phase center and attitude
* modeling, InsideGNSS, September, 2010
* [10] F.Dilssner, The GLONASS-M satellite yaw-attitude model, Advances in
* Space Research, 2010
* [11] IGS MGEX (http://igs.org/mgex)
*
* version : $Revision:$ $Date:$
* history : 2010/07/20 1.0 new
* added api:
* tidedisp()
* 2010/12/11 1.1 enable exclusion of eclipsing satellite
* 2012/02/01 1.2 add gps-glonass h/w bias correction
* move windupcorr() to rtkcmn.c
* 2013/03/11 1.3 add otl and pole tides corrections
* involve iers model with -DIERS_MODEL
* change initial variances
* suppress acos domain error
* 2013/09/01 1.4 pole tide model by iers 2010
* add mode of ionosphere model off
* 2014/05/23 1.5 add output of trop gradient in solution status
* 2014/10/13 1.6 fix bug on P0(a[3]) computation in tide_oload()
* fix bug on m2 computation in tide_pole()
* 2015/03/19 1.7 fix bug on ionosphere correction for GLO and BDS
* 2015/05/10 1.8 add function to detect slip by MW-LC jump
* fix ppp solutin problem with large clock variance
* 2015/06/08 1.9 add precise satellite yaw-models
* cope with day-boundary problem of satellite clock
* 2015/07/31 1.10 fix bug on nan-solution without glonass nav-data
* pppoutsolsat() -> pppoutstat()
* 2015/11/13 1.11 add L5-receiver-dcb estimation
* merge post-residual validation by rnx2rtkp_test
* support support option opt->pppopt=-GAP_RESION=nnnn
* 2016/01/22 1.12 delete support for yaw-model bug
* add support for ura of ephemeris
*-----------------------------------------------------------------------------*/
#include "rtklib.h"
#define SQR(x) ((x)*(x))
#define SQRT(x) ((x)<=0.0||(x)!=(x)?0.0:sqrt(x))
#define MAX(x,y) ((x)>(y)?(x):(y))
#define MIN(x,y) ((x)<(y)?(x):(y))
#define ROUND(x) (int)floor((x)+0.5)
#define MAX_ITER 8 /* max number of iterations */
#define MAX_STD_FIX 0.15 /* max std-dev (3d) to fix solution */
#define MIN_NSAT_SOL 4 /* min satellite number for solution */
#define THRES_REJECT 4.0 /* reject threshold of posfit-res (sigma) */
#define THRES_MW_JUMP 10.0
#define VAR_POS SQR(60.0) /* init variance receiver position (m^2) */
#define VAR_VEL SQR(10.0) /* init variance of receiver vel ((m/s)^2) */
#define VAR_ACC SQR(10.0) /* init variance of receiver acc ((m/ss)^2) */
#define VAR_CLK SQR(60.0) /* init variance receiver clock (m^2) */
#define VAR_ZTD SQR( 0.6) /* init variance ztd (m^2) */
#define VAR_GRA SQR(0.01) /* init variance gradient (m^2) */
#define VAR_DCB SQR(30.0) /* init variance dcb (m^2) */
#define VAR_BIAS SQR(60.0) /* init variance phase-bias (m^2) */
#define VAR_IONO SQR(60.0) /* init variance iono-delay */
#define VAR_GLO_IFB SQR( 0.6) /* variance of glonass ifb */
#define ERR_SAAS 0.3 /* saastamoinen model error std (m) */
#define ERR_BRDCI 0.5 /* broadcast iono model error factor */
#define ERR_CBIAS 0.3 /* code bias error std (m) */
#define REL_HUMI 0.7 /* relative humidity for saastamoinen model */
#define GAP_RESION 120 /* default gap to reset ionos parameters (ep) */
#define EFACT_GPS_L5 10.0 /* error factor of GPS/QZS L5 */
#define MUDOT_GPS (0.00836*D2R) /* average angular velocity GPS (rad/s) */
#define MUDOT_GLO (0.00888*D2R) /* average angular velocity GLO (rad/s) */
#define EPS0_GPS (13.5*D2R) /* max shadow crossing angle GPS (rad) */
#define EPS0_GLO (14.2*D2R) /* max shadow crossing angle GLO (rad) */
#define T_POSTSHADOW 1800.0 /* post-shadow recovery time (s) */
#define QZS_EC_BETA 20.0 /* max beta angle for qzss Ec (deg) */
/* number and index of states */
#define NF(opt) ((opt)->ionoopt==IONOOPT_IFLC?1:(opt)->nf)
#define NP(opt) ((opt)->dynamics?9:3)
#define NC(opt) (NSYS)
#define NT(opt) ((opt)->tropopt<TROPOPT_EST?0:((opt)->tropopt==TROPOPT_EST?1:3))
#define NI(opt) ((opt)->ionoopt==IONOOPT_EST?MAXSAT:0)
#define ND(opt) ((opt)->nf>=3?1:0)
#define NR(opt) (NP(opt)+NC(opt)+NT(opt)+NI(opt)+ND(opt))
#define NB(opt) (NF(opt)*MAXSAT)
#define NX(opt) (NR(opt)+NB(opt))
#define IC(s,opt) (NP(opt)+(s))
#define IT(opt) (NP(opt)+NC(opt))
#define II(s,opt) (NP(opt)+NC(opt)+NT(opt)+(s)-1)
#define ID(opt) (NP(opt)+NC(opt)+NT(opt)+NI(opt))
#define IB(s,f,opt) (NR(opt)+MAXSAT*(f)+(s)-1)
/* standard deviation of state -----------------------------------------------*/
static double STD(rtk_t *rtk, int i)
{
if (rtk->sol.stat==SOLQ_FIX) return SQRT(rtk->Pa[i+i*rtk->nx]);
return SQRT(rtk->P[i+i*rtk->nx]);
}
/* write solution status for PPP ---------------------------------------------*/
extern int pppoutstat(rtk_t *rtk, char *buff)
{
ssat_t *ssat;
double tow,pos[3],vel[3],acc[3],*x;
int i,j,week;
char id[32],*p=buff;
if (!rtk->sol.stat) return 0;
trace(3,"pppoutstat:\n");
tow=time2gpst(rtk->sol.time,&week);
x=rtk->sol.stat==SOLQ_FIX?rtk->xa:rtk->x;
/* receiver position */
p+=sprintf(p,"$POS,%d,%.3f,%d,%.4f,%.4f,%.4f,%.4f,%.4f,%.4f\n",week,tow,
rtk->sol.stat,x[0],x[1],x[2],STD(rtk,0),STD(rtk,1),STD(rtk,2));
/* receiver velocity and acceleration */
if (rtk->opt.dynamics) {
ecef2pos(rtk->sol.rr,pos);
ecef2enu(pos,rtk->x+3,vel);
ecef2enu(pos,rtk->x+6,acc);
p+=sprintf(p,"$VELACC,%d,%.3f,%d,%.4f,%.4f,%.4f,%.5f,%.5f,%.5f,%.4f,%.4f,"
"%.4f,%.5f,%.5f,%.5f\n",week,tow,rtk->sol.stat,vel[0],vel[1],
vel[2],acc[0],acc[1],acc[2],0.0,0.0,0.0,0.0,0.0,0.0);
}
/* receiver clocks */
i=IC(0,&rtk->opt);
p+=sprintf(p,"$CLK,%d,%.3f,%d,%d,%.3f,%.3f,%.3f,%.3f\n",
week,tow,rtk->sol.stat,1,x[i]*1E9/CLIGHT,x[i+1]*1E9/CLIGHT,
STD(rtk,i)*1E9/CLIGHT,STD(rtk,i+1)*1E9/CLIGHT);
/* tropospheric parameters */
if (rtk->opt.tropopt==TROPOPT_EST||rtk->opt.tropopt==TROPOPT_ESTG) {
i=IT(&rtk->opt);
p+=sprintf(p,"$TROP,%d,%.3f,%d,%d,%.4f,%.4f\n",week,tow,rtk->sol.stat,
1,x[i],STD(rtk,i));
}
if (rtk->opt.tropopt==TROPOPT_ESTG) {
i=IT(&rtk->opt);
p+=sprintf(p,"$TRPG,%d,%.3f,%d,%d,%.5f,%.5f,%.5f,%.5f\n",week,tow,
rtk->sol.stat,1,x[i+1],x[i+2],STD(rtk,i+1),STD(rtk,i+2));
}
/* ionosphere parameters */
if (rtk->opt.ionoopt==IONOOPT_EST) {
for (i=0;i<MAXSAT;i++) {
ssat=rtk->ssat+i;
if (!ssat->vs) continue;
j=II(i+1,&rtk->opt);
if (rtk->x[j]==0.0) continue;
satno2id(i+1,id);
p+=sprintf(p,"$ION,%d,%.3f,%d,%s,%.1f,%.1f,%.4f,%.4f\n",week,tow,
rtk->sol.stat,id,rtk->ssat[i].azel[0]*R2D,
rtk->ssat[i].azel[1]*R2D,x[j],STD(rtk,j));
}
}
#ifdef OUTSTAT_AMB
/* ambiguity parameters */
for (i=0;i<MAXSAT;i++) for (j=0;j<NF(&rtk->opt);j++) {
k=IB(i+1,j,&rtk->opt);
if (rtk->x[k]==0.0) continue;
satno2id(i+1,id);
p+=sprintf(p,"$AMB,%d,%.3f,%d,%s,%d,%.4f,%.4f\n",week,tow,
rtk->sol.stat,id,j+1,x[k],STD(rtk,k));
}
#endif
return (int)(p-buff);
}
/* exclude meas of eclipsing satellite (block IIA) ---------------------------*/
static void testeclipse(const obsd_t *obs, int n, const nav_t *nav, double *rs)
{
double rsun[3],esun[3],r,ang,erpv[5]={0},cosa;
int i,j;
const char *type;
trace(3,"testeclipse:\n");
/* unit vector of sun direction (ecef) */
sunmoonpos(gpst2utc(obs[0].time),erpv,rsun,NULL,NULL);
normv3(rsun,esun);
for (i=0;i<n;i++) {
type=nav->pcvs[obs[i].sat-1].type;
if ((r=norm(rs+i*6,3))<=0.0) continue;
/* only block IIA */
if (*type&&!strstr(type,"BLOCK IIA")) continue;
/* sun-earth-satellite angle */
cosa=dot(rs+i*6,esun,3)/r;
cosa=cosa<-1.0?-1.0:(cosa>1.0?1.0:cosa);
ang=acos(cosa);
/* test eclipse */
if (ang<PI/2.0||r*sin(ang)>RE_WGS84) continue;
trace(3,"eclipsing sat excluded %s sat=%2d\n",time_str(obs[0].time,0),
obs[i].sat);
for (j=0;j<3;j++) rs[j+i*6]=0.0;
}
}
/* nominal yaw-angle ---------------------------------------------------------*/
static double yaw_nominal(double beta, double mu)
{
if (fabs(beta)<1E-12&&fabs(mu)<1E-12) return PI;
return atan2(-tan(beta),sin(mu))+PI;
}
/* yaw-angle of satellite ----------------------------------------------------*/
extern int yaw_angle(int sat, const char *type, int opt, double beta, double mu,
double *yaw)
{
*yaw=yaw_nominal(beta,mu);
return 1;
}
/* satellite attitude model --------------------------------------------------*/
static int sat_yaw(gtime_t time, int sat, const char *type, int opt,
const double *rs, double *exs, double *eys)
{
double rsun[3],ri[6],es[3],esun[3],n[3],p[3],en[3],ep[3],ex[3],E,beta,mu;
double yaw,cosy,siny,erpv[5]={0};
int i;
sunmoonpos(gpst2utc(time),erpv,rsun,NULL,NULL);
/* beta and orbit angle */
matcpy(ri,rs,6,1);
ri[3]-=OMGE*ri[1];
ri[4]+=OMGE*ri[0];
cross3(ri,ri+3,n);
cross3(rsun,n,p);
if (!normv3(rs,es)||!normv3(rsun,esun)||!normv3(n,en)||
!normv3(p,ep)) return 0;
beta=PI/2.0-acos(dot(esun,en,3));
E=acos(dot(es,ep,3));
mu=PI/2.0+(dot(es,esun,3)<=0?-E:E);
if (mu<-PI/2.0) mu+=2.0*PI;
else if (mu>=PI/2.0) mu-=2.0*PI;
/* yaw-angle of satellite */
if (!yaw_angle(sat,type,opt,beta,mu,&yaw)) return 0;
/* satellite fixed x,y-vector */
cross3(en,es,ex);
cosy=cos(yaw);
siny=sin(yaw);
for (i=0;i<3;i++) {
exs[i]=-siny*en[i]+cosy*ex[i];
eys[i]=-cosy*en[i]-siny*ex[i];
}
return 1;
}
/* phase windup model --------------------------------------------------------*/
static int model_phw(gtime_t time, int sat, const char *type, int opt,
const double *rs, const double *rr, double *phw)
{
double exs[3],eys[3],ek[3],exr[3],eyr[3],eks[3],ekr[3],E[9];
double dr[3],ds[3],drs[3],r[3],pos[3],cosp,ph;
int i;
if (opt<=0) return 1; /* no phase windup */
/* satellite yaw attitude model */
if (!sat_yaw(time,sat,type,opt,rs,exs,eys)) return 0;
/* unit vector satellite to receiver */
for (i=0;i<3;i++) r[i]=rr[i]-rs[i];
if (!normv3(r,ek)) return 0;
/* unit vectors of receiver antenna */
ecef2pos(rr,pos);
xyz2enu(pos,E);
exr[0]= E[1]; exr[1]= E[4]; exr[2]= E[7]; /* x = north */
eyr[0]=-E[0]; eyr[1]=-E[3]; eyr[2]=-E[6]; /* y = west */
/* phase windup effect */
cross3(ek,eys,eks);
cross3(ek,eyr,ekr);
for (i=0;i<3;i++) {
ds[i]=exs[i]-ek[i]*dot(ek,exs,3)-eks[i];
dr[i]=exr[i]-ek[i]*dot(ek,exr,3)+ekr[i];
}
cosp=dot(ds,dr,3)/norm(ds,3)/norm(dr,3);
if (cosp<-1.0) cosp=-1.0;
else if (cosp> 1.0) cosp= 1.0;
ph=acos(cosp)/2.0/PI;
cross3(ds,dr,drs);
if (dot(ek,drs,3)<0.0) ph=-ph;
*phw=ph+floor(*phw-ph+0.5); /* in cycle */
return 1;
}
/* measurement error variance ------------------------------------------------*/
static double varerr(int sat, int sys, double el, int freq, int type,
const prcopt_t *opt)
{
double fact=1.0,sinel=sin(el);
if (type==1) fact*=opt->eratio[freq==0?0:1];
fact*=sys==SYS_GLO?EFACT_GLO:(sys==SYS_SBS?EFACT_SBS:EFACT_GPS);
if (sys==SYS_GPS||sys==SYS_QZS) {
if (freq==2) fact*=EFACT_GPS_L5; /* GPS/QZS L5 error factor */
}
if (opt->ionoopt==IONOOPT_IFLC) fact*=3.0;
return SQR(fact*opt->err[1])+SQR(fact*opt->err[2]/sinel);
}
/* initialize state and covariance -------------------------------------------*/
static void initx(rtk_t *rtk, double xi, double var, int i)
{
int j;
rtk->x[i]=xi;
for (j=0;j<rtk->nx;j++) {
rtk->P[i+j*rtk->nx]=rtk->P[j+i*rtk->nx]=i==j?var:0.0;
}
}
/* geometry-free phase measurement -------------------------------------------*/
static double gfmeas(const obsd_t *obs, const nav_t *nav)
{
const double *lam=nav->lam[obs->sat-1];
int i=(satsys(obs->sat,NULL)&(SYS_GAL|SYS_SBS))?2:1;
if (lam[0]==0.0||lam[i]==0.0||obs->L[0]==0.0||obs->L[i]==0.0) return 0.0;
return lam[0]*obs->L[0]-lam[i]*obs->L[i];
}
/* Melbourne-Wubbena linear combination --------------------------------------*/
static double mwmeas(const obsd_t *obs, const nav_t *nav)
{
const double *lam=nav->lam[obs->sat-1];
int i=(satsys(obs->sat,NULL)&(SYS_GAL|SYS_SBS))?2:1;
if (lam[0]==0.0||lam[i]==0.0||obs->L[0]==0.0||obs->L[i]==0.0||
obs->P[0]==0.0||obs->P[i]==0.0) return 0.0;
return lam[0]*lam[i]*(obs->L[0]-obs->L[i])/(lam[i]-lam[0])-
(lam[i]*obs->P[0]+lam[0]*obs->P[i])/(lam[i]+lam[0]);
}
/* antenna corrected measurements --------------------------------------------*/
static void corr_meas(const obsd_t *obs, const nav_t *nav, const double *azel,
const prcopt_t *opt, const double *dantr,
const double *dants, double phw, double *L, double *P,
double *Lc, double *Pc)
{
const double *lam=nav->lam[obs->sat-1];
double C1,C2;
int i,sys;
for (i=0;i<NFREQ;i++) {
L[i]=P[i]=0.0;
if (lam[i]==0.0||obs->L[i]==0.0||obs->P[i]==0.0) continue;
if (testsnr(0,0,azel[1],obs->SNR[i]*0.25,&opt->snrmask)) continue;
/* antenna phase center and phase windup correction */
L[i]=obs->L[i]*lam[i]-dants[i]-dantr[i]-phw*lam[i];
P[i]=obs->P[i] -dants[i]-dantr[i];
/* P1-C1,P2-C2 dcb correction (C1->P1,C2->P2) */
if (obs->code[i]==CODE_L1C) {
P[i]+=nav->cbias[obs->sat-1][1];
}
else if (obs->code[i]==CODE_L2C||obs->code[i]==CODE_L2X||
obs->code[i]==CODE_L2L||obs->code[i]==CODE_L2S) {
P[i]+=nav->cbias[obs->sat-1][2];
#if 0
L[i]-=0.25*lam[i]; /* 1/4 cycle-shift */
#endif
}
}
/* iono-free LC */
*Lc=*Pc=0.0;
sys=satsys(obs->sat,NULL);
i=(sys&(SYS_GAL|SYS_SBS))?2:1; /* L1/L2 or L1/L5 */
if (lam[0]==0.0||lam[i]==0.0) return;
C1= SQR(lam[i])/(SQR(lam[i])-SQR(lam[0]));
C2=-SQR(lam[0])/(SQR(lam[i])-SQR(lam[0]));
#if 0
/* P1-P2 dcb correction (P1->Pc,P2->Pc) */
if (sys&(SYS_GPS|SYS_GLO|SYS_QZS)) {
if (P[0]!=0.0) P[0]-=C2*nav->cbias[obs->sat-1][0];
if (P[1]!=0.0) P[1]+=C1*nav->cbias[obs->sat-1][0];
}
#endif
if (L[0]!=0.0&&L[i]!=0.0) *Lc=C1*L[0]+C2*L[i];
if (P[0]!=0.0&&P[i]!=0.0) *Pc=C1*P[0]+C2*P[i];
}
/* detect cycle slip by LLI --------------------------------------------------*/
static void detslp_ll(rtk_t *rtk, const obsd_t *obs, int n)
{
int i,j;
trace(3,"detslp_ll: n=%d\n",n);
for (i=0;i<n&&i<MAXOBS;i++) for (j=0;j<rtk->opt.nf;j++) {
if (obs[i].L[j]==0.0||!(obs[i].LLI[j]&3)) continue;
trace(3,"detslp_ll: slip detected sat=%2d f=%d\n",obs[i].sat,j+1);
rtk->ssat[obs[i].sat-1].slip[j]=1;
}
}
/* detect cycle slip by geometry free phase jump -----------------------------*/
static void detslp_gf(rtk_t *rtk, const obsd_t *obs, int n, const nav_t *nav)
{
double g0,g1;
int i,j;
trace(3,"detslp_gf: n=%d\n",n);
for (i=0;i<n&&i<MAXOBS;i++) {
if ((g1=gfmeas(obs+i,nav))==0.0) continue;
g0=rtk->ssat[obs[i].sat-1].gf;
rtk->ssat[obs[i].sat-1].gf=g1;
trace(4,"detslip_gf: sat=%2d gf0=%8.3f gf1=%8.3f\n",obs[i].sat,g0,g1);
if (g0!=0.0&&fabs(g1-g0)>rtk->opt.thresslip) {
trace(3,"detslip_gf: slip detected sat=%2d gf=%8.3f->%8.3f\n",
obs[i].sat,g0,g1);
for (j=0;j<rtk->opt.nf;j++) rtk->ssat[obs[i].sat-1].slip[j]|=1;
}
}
}
/* detect slip by Melbourne-Wubbena linear combination jump ------------------*/
static void detslp_mw(rtk_t *rtk, const obsd_t *obs, int n, const nav_t *nav)
{
double w0,w1;
int i,j;
trace(3,"detslp_mw: n=%d\n",n);
for (i=0;i<n&&i<MAXOBS;i++) {
if ((w1=mwmeas(obs+i,nav))==0.0) continue;
w0=rtk->ssat[obs[i].sat-1].mw;
rtk->ssat[obs[i].sat-1].mw=w1;
trace(4,"detslip_mw: sat=%2d mw0=%8.3f mw1=%8.3f\n",obs[i].sat,w0,w1);
if (w0!=0.0&&fabs(w1-w0)>THRES_MW_JUMP) {
trace(3,"detslip_mw: slip detected sat=%2d mw=%8.3f->%8.3f\n",
obs[i].sat,w0,w1);
for (j=0;j<rtk->opt.nf;j++) rtk->ssat[obs[i].sat-1].slip[j]|=1;
}
}
}
/* temporal update of position -----------------------------------------------*/
static void udpos_ppp(rtk_t *rtk)
{
double *F,*P,*FP,*x,*xp,pos[3],Q[9]={0},Qv[9];
int i,j,*ix,nx;
trace(3,"udpos_ppp:\n");
/* fixed mode */
if (rtk->opt.mode==PMODE_PPP_FIXED) {
for (i=0;i<3;i++) initx(rtk,rtk->opt.ru[i],1E-8,i);
return;
}
/* initialize position for first epoch */
if (norm(rtk->x,3)<=0.0) {
for (i=0;i<3;i++) initx(rtk,rtk->sol.rr[i],VAR_POS,i);
if (rtk->opt.dynamics) {
for (i=3;i<6;i++) initx(rtk,rtk->sol.rr[i],VAR_VEL,i);
for (i=6;i<9;i++) initx(rtk,1E-6,VAR_ACC,i);
}
}
/* static ppp mode */
if (rtk->opt.mode==PMODE_PPP_STATIC) {
for (i=0;i<3;i++) {
rtk->P[i*(1+rtk->nx)]+=SQR(rtk->opt.prn[5])*fabs(rtk->tt);
}
return;
}
/* kinmatic mode without dynamics */
if (!rtk->opt.dynamics) {
for (i=0;i<3;i++) {
initx(rtk,rtk->sol.rr[i],VAR_POS,i);
}
return;
}
/* generate valid state index */
ix=imat(rtk->nx,1);
for (i=nx=0;i<rtk->nx;i++) {
if (rtk->x[i]!=0.0&&rtk->P[i+i*rtk->nx]>0.0) ix[nx++]=i;
}
if (nx<9) {
free(ix);
return;
}
/* state transition of position/velocity/acceleration */
F=eye(nx); P=mat(nx,nx); FP=mat(nx,nx); x=mat(nx,1); xp=mat(nx,1);
for (i=0;i<6;i++) {
F[i+(i+3)*nx]=rtk->tt;
}
for (i=0;i<3;i++) {
F[i+(i+6)*nx]=SQR(rtk->tt)/2.0;
}
for (i=0;i<nx;i++) {
x[i]=rtk->x[ix[i]];
for (j=0;j<nx;j++) {
P[i+j*nx]=rtk->P[ix[i]+ix[j]*rtk->nx];
}
}
/* x=F*x, P=F*P*F+Q */
matmul("NN",nx,1,nx,1.0,F,x,0.0,xp);
matmul("NN",nx,nx,nx,1.0,F,P,0.0,FP);
matmul("NT",nx,nx,nx,1.0,FP,F,0.0,P);
for (i=0;i<nx;i++) {
rtk->x[ix[i]]=xp[i];
for (j=0;j<nx;j++) {
rtk->P[ix[i]+ix[j]*rtk->nx]=P[i+j*nx];
}
}
/* process noise added to only acceleration */
Q[0]=Q[4]=SQR(rtk->opt.prn[3])*fabs(rtk->tt);
Q[8]=SQR(rtk->opt.prn[4])*fabs(rtk->tt);
ecef2pos(rtk->x,pos);
covecef(pos,Q,Qv);
for (i=0;i<3;i++) for (j=0;j<3;j++) {
rtk->P[i+6+(j+6)*rtk->nx]+=Qv[i+j*3];
}
free(ix); free(F); free(P); free(FP); free(x); free(xp);
}
/* temporal update of clock --------------------------------------------------*/
static void udclk_ppp(rtk_t *rtk)
{
double dtr;
int i;
trace(3,"udclk_ppp:\n");
/* initialize every epoch for clock (white noise) */
for (i=0;i<NSYS;i++) {
if (rtk->opt.sateph==EPHOPT_PREC) {
/* time of prec ephemeris is based gpst */
/* negelect receiver inter-system bias */
dtr=rtk->sol.dtr[0];
}
else {
dtr=i==0?rtk->sol.dtr[0]:rtk->sol.dtr[0]+rtk->sol.dtr[i];
}
initx(rtk,CLIGHT*dtr,VAR_CLK,IC(i,&rtk->opt));
}
}
/* temporal update of tropospheric parameters --------------------------------*/
static void udtrop_ppp(rtk_t *rtk)
{
double pos[3],azel[]={0.0,PI/2.0},ztd,var;
int i=IT(&rtk->opt),j;
trace(3,"udtrop_ppp:\n");
if (rtk->x[i]==0.0) {
ecef2pos(rtk->sol.rr,pos);
ztd=sbstropcorr(rtk->sol.time,pos,azel,&var);
initx(rtk,ztd,var,i);
if (rtk->opt.tropopt>=TROPOPT_ESTG) {
for (j=i+1;j<i+3;j++) initx(rtk,1E-6,VAR_GRA,j);
}
}
else {
rtk->P[i+i*rtk->nx]+=SQR(rtk->opt.prn[2])*fabs(rtk->tt);
if (rtk->opt.tropopt>=TROPOPT_ESTG) {
for (j=i+1;j<i+3;j++) {
rtk->P[j+j*rtk->nx]+=SQR(rtk->opt.prn[2]*0.1)*fabs(rtk->tt);
}
}
}
}
/* temporal update of ionospheric parameters ---------------------------------*/
static void udiono_ppp(rtk_t *rtk, const obsd_t *obs, int n, const nav_t *nav)
{
const double *lam;
double ion,sinel,pos[3],*azel;
char *p;
int i,j,k,gap_resion=GAP_RESION;
trace(3,"udiono_ppp:\n");
if ((p=strstr(rtk->opt.pppopt,"-GAP_RESION="))) {
sscanf(p,"-GAP_RESION=%d",&gap_resion);
}
for (i=0;i<MAXSAT;i++) {
j=II(i+1,&rtk->opt);
if (rtk->x[j]!=0.0&&(int)rtk->ssat[i].outc[0]>gap_resion) {
rtk->x[j]=0.0;
}
}
for (i=0;i<n;i++) {
j=II(obs[i].sat,&rtk->opt);
if (rtk->x[j]==0.0) {
k=satsys(obs[i].sat,NULL)==SYS_GAL?2:1;
lam=nav->lam[obs[i].sat-1];
if (obs[i].P[0]==0.0||obs[i].P[k]==0.0||lam[0]==0.0||lam[k]==0.0) {
continue;
}
ion=(obs[i].P[0]-obs[i].P[k])/(1.0-SQR(lam[k]/lam[0]));
ecef2pos(rtk->sol.rr,pos);
azel=rtk->ssat[obs[i].sat-1].azel;
ion/=ionmapf(pos,azel);
initx(rtk,ion,VAR_IONO,j);
}
else {
sinel=sin(MAX(rtk->ssat[obs[i].sat-1].azel[1],5.0*D2R));
rtk->P[j+j*rtk->nx]+=SQR(rtk->opt.prn[1]/sinel)*fabs(rtk->tt);
}
}
}
/* temporal update of L5-receiver-dcb parameters -----------------------------*/
static void uddcb_ppp(rtk_t *rtk)
{
int i=ID(&rtk->opt);
trace(3,"uddcb_ppp:\n");
if (rtk->x[i]==0.0) {
initx(rtk,1E-6,VAR_DCB,i);
}
}
/* temporal update of phase biases -------------------------------------------*/
static void udbias_ppp(rtk_t *rtk, const obsd_t *obs, int n, const nav_t *nav)
{
const double *lam;
double L[NFREQ],P[NFREQ],Lc,Pc,bias[MAXOBS],offset=0.0,pos[3]={0};
double ion,dantr[NFREQ]={0},dants[NFREQ]={0};
int i,j,k,l,f,sat,slip[MAXOBS]={0},clk_jump=0;
trace(3,"udbias : n=%d\n",n);
/* handle day-boundary clock jump */
if (rtk->opt.posopt[5]) {
clk_jump=ROUND(time2gpst(obs[0].time,NULL)*10)%864000==0;
}
for (i=0;i<MAXSAT;i++) for (j=0;j<rtk->opt.nf;j++) {
rtk->ssat[i].slip[j]=0;
}
/* detect cycle slip by LLI */
detslp_ll(rtk,obs,n);
/* detect cycle slip by geometry-free phase jump */
detslp_gf(rtk,obs,n,nav);
/* detect slip by Melbourne-Wubbena linear combination jump */
detslp_mw(rtk,obs,n,nav);
ecef2pos(rtk->sol.rr,pos);
for (f=0;f<NF(&rtk->opt);f++) {
/* reset phase-bias if expire obs outage counter */
for (i=0;i<MAXSAT;i++) {
if (++rtk->ssat[i].outc[f]>(unsigned int)rtk->opt.maxout||
rtk->opt.modear==ARMODE_INST||clk_jump) {
initx(rtk,0.0,0.0,IB(i+1,f,&rtk->opt));
}
}
for (i=k=0;i<n&&i<MAXOBS;i++) {
sat=obs[i].sat;
j=IB(sat,f,&rtk->opt);
corr_meas(obs+i,nav,rtk->ssat[sat-1].azel,&rtk->opt,dantr,dants,
0.0,L,P,&Lc,&Pc);
bias[i]=0.0;
if (rtk->opt.ionoopt==IONOOPT_IFLC) {
bias[i]=Lc-Pc;
slip[i]=rtk->ssat[sat-1].slip[0]||rtk->ssat[sat-1].slip[1];
}
else if (L[f]!=0.0&&P[f]!=0.0) {
slip[i]=rtk->ssat[sat-1].slip[f];
l=satsys(sat,NULL)==SYS_GAL?2:1;
lam=nav->lam[sat-1];
if (obs[i].P[0]==0.0||obs[i].P[l]==0.0||
lam[0]==0.0||lam[l]==0.0||lam[f]==0.0) continue;
ion=(obs[i].P[0]-obs[i].P[l])/(1.0-SQR(lam[l]/lam[0]));
bias[i]=L[f]-P[f]+2.0*ion*SQR(lam[f]/lam[0]);
}
if (rtk->x[j]==0.0||slip[i]||bias[i]==0.0) continue;
offset+=bias[i]-rtk->x[j];
k++;
}
/* correct phase-code jump to ensure phase-code coherency */
if (k>=2&&fabs(offset/k)>0.0005*CLIGHT) {
for (i=0;i<MAXSAT;i++) {
j=IB(i+1,f,&rtk->opt);
if (rtk->x[j]!=0.0) rtk->x[j]+=offset/k;
}
trace(2,"phase-code jump corrected: %s n=%2d dt=%12.9fs\n",
time_str(rtk->sol.time,0),k,offset/k/CLIGHT);
}
for (i=0;i<n&&i<MAXOBS;i++) {
sat=obs[i].sat;
j=IB(sat,f,&rtk->opt);
rtk->P[j+j*rtk->nx]+=SQR(rtk->opt.prn[0])*fabs(rtk->tt);
if (bias[i]==0.0||(rtk->x[j]!=0.0&&!slip[i])) continue;
/* reinitialize phase-bias if detecting cycle slip */
initx(rtk,bias[i],VAR_BIAS,IB(sat,f,&rtk->opt));
/* reset fix flags */
for (k=0;k<MAXSAT;k++) rtk->ambc[sat-1].flags[k]=0;
trace(5,"udbias_ppp: sat=%2d bias=%.3f\n",sat,bias[i]);
}
}
}
/* temporal update of states --------------------------------------------------*/
static void udstate_ppp(rtk_t *rtk, const obsd_t *obs, int n, const nav_t *nav)
{
trace(3,"udstate_ppp: n=%d\n",n);
/* temporal update of position */
udpos_ppp(rtk);
/* temporal update of clock */
udclk_ppp(rtk);
/* temporal update of tropospheric parameters */
if (rtk->opt.tropopt==TROPOPT_EST||rtk->opt.tropopt==TROPOPT_ESTG) {
udtrop_ppp(rtk);
}
/* temporal update of ionospheric parameters */
if (rtk->opt.ionoopt==IONOOPT_EST) {
udiono_ppp(rtk,obs,n,nav);
}
/* temporal update of L5-receiver-dcb parameters */
if (rtk->opt.nf>=3) {
uddcb_ppp(rtk);
}
/* temporal update of phase-bias */
udbias_ppp(rtk,obs,n,nav);
}
/* satellite antenna phase center variation ----------------------------------*/
static void satantpcv(const double *rs, const double *rr, const pcv_t *pcv,
double *dant)
{
double ru[3],rz[3],eu[3],ez[3],nadir,cosa;
int i;
for (i=0;i<3;i++) {
ru[i]=rr[i]-rs[i];
rz[i]=-rs[i];
}
if (!normv3(ru,eu)||!normv3(rz,ez)) return;
cosa=dot(eu,ez,3);
cosa=cosa<-1.0?-1.0:(cosa>1.0?1.0:cosa);
nadir=acos(cosa);
antmodel_s(pcv,nadir,dant);
}
/* precise tropospheric model ------------------------------------------------*/
static double trop_model_prec(gtime_t time, const double *pos,
const double *azel, const double *x, double *dtdx,
double *var)
{
const double zazel[]={0.0,PI/2.0};
double zhd,m_h,m_w,cotz,grad_n,grad_e;
/* zenith hydrostatic delay */
zhd=tropmodel(time,pos,zazel,0.0);
/* mapping function */
m_h=tropmapf(time,pos,azel,&m_w);
if (azel[1]>0.0) {
/* m_w=m_0+m_0*cot(el)*(Gn*cos(az)+Ge*sin(az)): ref [6] */
cotz=1.0/tan(azel[1]);
grad_n=m_w*cotz*cos(azel[0]);
grad_e=m_w*cotz*sin(azel[0]);
m_w+=grad_n*x[1]+grad_e*x[2];
dtdx[1]=grad_n*(x[0]-zhd);
dtdx[2]=grad_e*(x[0]-zhd);
}
dtdx[0]=m_w;
*var=SQR(0.01);
return m_h*zhd+m_w*(x[0]-zhd);
}
/* tropospheric model ---------------------------------------------------------*/
static int model_trop(gtime_t time, const double *pos, const double *azel,
const prcopt_t *opt, const double *x, double *dtdx,
const nav_t *nav, double *dtrp, double *var)
{
double trp[3]={0},std[3];
if (opt->tropopt==TROPOPT_SAAS) {
*dtrp=tropmodel(time,pos,azel,REL_HUMI);
*var=SQR(ERR_SAAS);
return 1;
}
if (opt->tropopt==TROPOPT_SBAS) {
*dtrp=sbstropcorr(time,pos,azel,var);
return 1;
}
if (opt->tropopt==TROPOPT_EST||opt->tropopt==TROPOPT_ESTG) {
matcpy(trp,x+IT(opt),opt->tropopt==TROPOPT_EST?1:3,1);
*dtrp=trop_model_prec(time,pos,azel,trp,dtdx,var);
return 1;
}
if (opt->tropopt==TROPOPT_ZTD) {
if (pppcorr_trop(&nav->pppcorr,time,pos,trp,std)) {
*dtrp=trop_model_prec(time,pos,azel,trp,dtdx,var);
*var=SQR(dtdx[0]*std[0]);
return 1;
}
}
return 0;
}
/* ionospheric model ---------------------------------------------------------*/
static int model_iono(gtime_t time, const double *pos, const double *azel,
const prcopt_t *opt, int sat, const double *x,
const nav_t *nav, double *dion, double *var)
{
static double iono_p[MAXSAT]={0},std_p[MAXSAT]={0};
static gtime_t time_p;
if (opt->ionoopt==IONOOPT_SBAS) {
return sbsioncorr(time,nav,pos,azel,dion,var);
}
if (opt->ionoopt==IONOOPT_TEC) {
return iontec(time,nav,pos,azel,1,dion,var);
}
if (opt->ionoopt==IONOOPT_BRDC) {
*dion=ionmodel(time,nav->ion_gps,pos,azel);
*var=SQR(*dion*ERR_BRDCI);
return 1;
}
if (opt->ionoopt==IONOOPT_EST) {
*dion=x[II(sat,opt)];
*var=0.0;
return 1;
}
if (opt->ionoopt==IONOOPT_IFLC) {
*dion=*var=0.0;
return 1;
}
if (opt->ionoopt==IONOOPT_STEC) {
if (timediff(time,time_p)!=0.0&&
!pppcorr_stec(&nav->pppcorr,time,pos,iono_p,std_p)) return 0;
if (iono_p[sat-1]==0.0||std_p[sat-1]>0.1) return 0;
time_p=time;
*dion=iono_p[sat-1];
*var=SQR(std_p[sat-1]);
return 1;
}
return 0;
}
/* constraint to local correction --------------------------------------------*/
static int const_corr(const obsd_t *obs, int n, const int *exc,
const nav_t *nav, const double *x, const double *pos,
const double *azel, rtk_t *rtk, double *v, double *H,
double *var)
{
gtime_t time=obs[0].time;
double trop[3],std_trop[3],iono[MAXSAT],std_iono[MAXSAT];
int i,j,k,sat,nv=0;
/* constraint to external troposphere correction */
if ((rtk->opt.tropopt==TROPOPT_EST||rtk->opt.tropopt==TROPOPT_ESTG)&&
pppcorr_trop(&nav->pppcorr,time,pos,trop,std_trop)) {
for (i=0;i<(rtk->opt.tropopt==TROPOPT_EST?1:3);i++) {
if (std_trop[i]==0.0) continue;
j=IT(&rtk->opt)+i;
v[nv]=trop[i]-x[j];
for (k=0;k<rtk->nx;k++) H[k+nv*rtk->nx]=k==j?1.0:0.0;
var[nv++]=SQR(std_trop[i]);
}
}
/* constraint to external ionosphere correction */
if (rtk->opt.ionoopt==IONOOPT_EST&&
pppcorr_stec(&nav->pppcorr,time,pos,iono,std_iono)) {
for (i=0;i<n;i++) {
sat=obs[i].sat;
if (exc[i]||iono[sat-1]==0.0||std_iono[sat-1]>0.5) continue;
j=II(sat,&rtk->opt);
v[nv]=iono[sat-1]-x[j];
for (k=0;k<rtk->nx;k++) H[k+nv*rtk->nx]=k==j?1.0:0.0;
var[nv++]=SQR(std_iono[sat-1]);
}
}
return nv;
}
/* phase and code residuals --------------------------------------------------*/
static int ppp_res(int post, const obsd_t *obs, int n, const double *rs,
const double *dts, const double *var_rs, const int *svh,
const double *dr, int *exc, const nav_t *nav,
const double *x, rtk_t *rtk, double *v, double *H, double *R,
double *azel)
{
const double *lam;
prcopt_t *opt=&rtk->opt;
double y,r,cdtr,bias,C,rr[3],pos[3],e[3],dtdx[3],L[NFREQ],P[NFREQ],Lc,Pc;
double var[MAXOBS*2],dtrp=0.0,dion=0.0,vart=0.0,vari=0.0,dcb;
double dantr[NFREQ]={0},dants[NFREQ]={0};
double ve[MAXOBS*2*NFREQ]={0},vmax=0;
char str[32];
int ne=0,obsi[MAXOBS*2*NFREQ]={0},frqi[MAXOBS*2*NFREQ],maxobs,maxfrq,rej;
int i,j,k,sat,sys,nv=0,nx=rtk->nx,stat=1;
time2str(obs[0].time,str,2);
for (i=0;i<MAXSAT;i++) for (j=0;j<opt->nf;j++) rtk->ssat[i].vsat[j]=0;
for (i=0;i<3;i++) rr[i]=x[i]+dr[i];
ecef2pos(rr,pos);
for (i=0;i<n&&i<MAXOBS;i++) {
sat=obs[i].sat;
lam=nav->lam[sat-1];
if (lam[j/2]==0.0||lam[0]==0.0) continue;
if ((r=geodist(rs+i*6,rr,e))<=0.0||
satazel(pos,e,azel+i*2)<opt->elmin) {
exc[i]=1;
continue;
}
if (!(sys=satsys(sat,NULL))||!rtk->ssat[sat-1].vs||
satexclude(obs[i].sat,svh[i],opt)||exc[i]) {
exc[i]=1;
continue;
}
/* tropospheric and ionospheric model */
if (!model_trop(obs[i].time,pos,azel+i*2,opt,x,dtdx,nav,&dtrp,&vart)||
!model_iono(obs[i].time,pos,azel+i*2,opt,sat,x,nav,&dion,&vari)) {
continue;
}
/* satellite and receiver antenna model */
if (opt->posopt[0]) satantpcv(rs+i*6,rr,nav->pcvs+sat-1,dants);
antmodel(opt->pcvr,opt->antdel[0],azel+i*2,opt->posopt[1],dantr);
/* phase windup model */
if (!model_phw(rtk->sol.time,sat,nav->pcvs[sat-1].type,
opt->posopt[2]?2:0,rs+i*6,rr,&rtk->ssat[sat-1].phw)) {
continue;
}
/* corrected phase and code measurements */
corr_meas(obs+i,nav,azel+i*2,&rtk->opt,dantr,dants,
rtk->ssat[sat-1].phw,L,P,&Lc,&Pc);
/* stack phase and code residuals {L1,P1,L2,P2,...} */
for (j=0;j<2*NF(opt);j++) {
dcb=bias=0.0;
if (opt->ionoopt==IONOOPT_IFLC) {
if ((y=j%2==0?Lc:Pc)==0.0) continue;
}
else {
if ((y=j%2==0?L[j/2]:P[j/2])==0.0) continue;
/* receiver DCB correction for P2 */
if (j/2==1) dcb=-nav->rbias[0][sys==SYS_GLO?1:0][0];
}
C=SQR(lam[j/2]/lam[0])*ionmapf(pos,azel+i*2)*(j%2==0?-1.0:1.0);
for (k=0;k<nx;k++) H[k+nx*nv]=k<3?-e[k]:0.0;
/* receiver clock */
k=sys==SYS_GLO?1:(sys==SYS_GAL?2:(sys==SYS_CMP?3:0));