Beispiel #1
0
void liqss3::dext(Event x, double t) {
//The input event is in the 'x' variable.
//where:
//     'x.value' is the value
//     'x.port' is the port number
double *derx;
double diffxq[10];
double dt1,dt2,dt3;

derx=(double*)x.value;

if (x.port==0) { 
	//linear model estimation
		if((e>0)||(t==0)){
			band=false;
			band3=false;
		}
		if (band&&fabs(q_old+dq_old-q[0]-dq)>1e-12){
			a=(dx_old-derx[0])/(q_old+dq_old-q[0]-dq);
		       	if ((a<-1e30)||(a>0)){a=0;}
	  	} else {
			advance_time(q,e,2);
		};
		//printLog("en t=%g estimamos a=%g\n",t,a);
		u[0]=derx[0]-a*(q[0]+dq);
		u[1]=derx[1]-a*q[1];
		u[2]=derx[2]-a*q[2];

		X[0]=X[0]+X[1]*e+X[2]*e*e+X[3]*e*e*e;
	  X[1]=derx[0];
		X[2]=derx[1]/2;
		X[3]=derx[2]/3;
		//printLog("t=%g: e=%g, X=[%g, %g, %g, %g], q= [%g, %g, %g], u=[%g ,%g, %g], a=%g \n",t,e,X[0],X[1],X[2],X[3],q[0],q[1],q[2],u[0],u[1],u[2],a);
		if (band4){
		 //printLog("t=%g: e=%g, X=[%g, %g, %g, %g], q= [%g, %g, %g], u=[%g ,%g, %g], a=%g \n",t,e,X[0],X[1],X[2],X[3],q[0],q[1],q[2],u[0],u[1],u[2],a);
		 sigma=0;
		}
		if (sigma>0){
		  	diffxq[1]=q[1]-X[1];
			  diffxq[2]=q[2]-X[2];
			  diffxq[3]=-X[3];
	   		diffxq[0]=q[0]-X[0]-dQ;
		   	sigma=minposroot(diffxq,3);
	   		diffxq[0]=q[0]-X[0]+dQ;
		   	dt1=minposroot(diffxq,3);
		   	if (dt1<sigma) sigma=dt1;
				if (dt1!=sigma) {diffxq[0]=q[0]-X[0]-dQ;}
		 	  if (a!=0&&(fabs(X[3])>1e-10)&&!band3&&!band2){
					double diff1[10];
					diff1[0]=a*a*a*(q[0]+dq)+a*a*u[0]+a*u[1]+2*u[2];
					diff1[1]=a*a*a*q[1]+a*a*u[1]+a*2*u[2];
					diff1[2]=a*a*a*q[2]+a*a*u[2];
					dt3=minposroot(diff1,2);
					if (dt3<sigma){
						band2=true;				
						sigma=dt3;
					} else {
						band2=false;
					}
				}
  		//if (sigma==0)printLog("t=%g: e=%g, X=[%g, %g, %g, %g], q= [%g, %g, %g], u=[%g ,%g, %g], a=%g \n",t,e,X[0],X[1],X[2],X[3],q[0],q[1],q[2],u[0],u[1],u[2],a);
				if (sigma>getFinalTime())sigma=getFinalTime();
		  	advance_time(diffxq,sigma/2,3);
		  	if (fabs(diffxq[0])>3*dQ) {
					sigma=1e-12;	
		 	}
	
		};
} else {
	advance_time(X,e,3);
	X[0]=derx[0];
	sigma=0;
	band2=false;
  band=false;
  band3=false;
  band4=false;
  a=0;
}
}
Beispiel #2
0
      /// Overload TabularSatStore::dump()
      /// Dump information about the object to an ostream.
      /// @param[in] os ostream to receive the output; defaults to std::cout
      /// @param[in] detail integer level of detail to provide; allowed values are
      ///    0: number of satellites, time step and time limits, flags,
      ///           gap and interval flags and values, and file information
      ///    1: number of data/sat
      ///    2: above plus all the data tables
      virtual void dump(std::ostream& os = std::cout, int detail = 0) const throw()
      {
         os << "Dump of RinexClockStore(" << detail << "):" << std::endl;
         if(detail >= 0) {
            const char *fmt="%4Y/%02m/%02d %2H:%02M:%02S";

            os << " Data stored for " << nsats()
               << " satellites\n";

            CommonTime initialTime(getInitialTime()), finalTime(getFinalTime());
            os << " Time span of data: ";
            if(initialTime == CommonTime::END_OF_TIME ||
               finalTime == CommonTime::BEGINNING_OF_TIME)
                  os << "(there are no time limits)" << std::endl;
            else
               os << initialTime.printf(fmt) << " TO "
                  << finalTime.printf(fmt) << std::endl;

            os << " This store contains:"
               << (haveClockBias ? "":" not") << " bias,"
               << (haveClockDrift ? "":" not") << " drift, and"
               << (haveClockAccel ? "":" not") << " acceleration data." << std::endl;
            os << " Checking for data gaps? " << (checkDataGap ? "yes":"no");
            if(checkDataGap) os << "; gap interval is "
               << std::fixed << std::setprecision(2) << gapInterval;
            os << std::endl;
            os << " Checking data interval? " << (checkInterval ? "yes":"no");
            if(checkInterval) os << "; max interval is "
               << std::fixed << std::setprecision(2) << maxInterval;
            os << std::endl;
            os << " Interpolation type is "
               << (interpType == 2 ? "Lagrange" : "Linear")
               << " using " << interpOrder << " consecutive data." << std::endl;
            os << " Rejecting bad clock data is turned "
               << (rejectBadClockFlag ? "ON":"OFF") << std::endl;

            // dump FileStore
            clkFiles.dump(os,detail);

            if(detail == 0) return;

            os << " List of satellites and number of records:\n";
            SatTable::const_iterator it;
            for(it=tables.begin(); it!=tables.end(); it++) {
               os << "  Sat " << it->first << " : "
                  << it->second.size() << " records.";

               if(detail == 1) { os << std::endl; continue; }

               os << "  Data:" << std::endl;
               DataTable::const_iterator jt;
               for(jt=it->second.begin(); jt!=it->second.end(); jt++) {
                  os << " " << jt->first.printf(fmt)
                     << " " << it->first
                     << std::scientific << std::setprecision(12)
                     << " " << std::setw(19) << jt->second.bias
                     << " " << std::setw(19) << jt->second.sig_bias;
                  if(haveClockDrift) os
                     << " " << std::setw(19) << jt->second.drift
                     << " " << std::setw(19) << jt->second.sig_drift;
                  if(haveClockAccel) os
                     << " " << std::setw(19) << jt->second.accel
                     << " " << std::setw(19) << jt->second.sig_accel;
                  os << std::endl;
               }
            }
         }
         os << "End dump of RinexClockStore." << std::endl;
      }