- Timestamp:
- Sep 8, 2010, 4:09:27 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/bncmodel.cpp
r2583 r2599 168 168 } 169 169 170 _tRangeAverage = settings.value("pppAverage").toDouble() * 60.; 171 if (_tRangeAverage < 0) { 172 _tRangeAverage = 0; 173 } 174 if (_tRangeAverage > 86400) { 175 _tRangeAverage = 86400; 176 } 177 170 178 int nextPar = 0; 171 179 _params.push_back(new bncParam(bncParam::CRD_X, ++nextPar, "")); … … 215 223 _nmeaStream->setDevice(_nmeaFile); 216 224 } 225 //Perlt Anfang 226 _xyzAverage[0] = 0.0; _xyzAverage[1] = 0.0; _xyzAverage[2] = 0.0; 227 _xyzAverage[3] = 0.0; _xyzAverage[4] = 0.0; _xyzAverage[5] = 0.0; 228 _xyzAverageSqr[0] = 0.0; _xyzAverageSqr[1] = 0.0; _xyzAverageSqr[2] = 0.0; 229 _xyzAverageSqr[3] = 0.0; _xyzAverageSqr[4] = 0.0; _xyzAverageSqr[5] = 0.0; 230 for (int ii = 0; ii < _posAverage.size(); ++ii) { delete _posAverage[ii]; } 231 _posAverage.clear(); 232 //Perlt Ende 233 217 234 } 218 235 … … 222 239 delete _nmeaStream; 223 240 delete _nmeaFile; 241 //Perlt Anfang 242 for (int ii = 0; ii < _posAverage.size(); ++ii) { delete _posAverage[ii]; } 243 //Perlt Ende 224 244 } 225 245 … … 715 735 emit newMessage(_log, false); 716 736 737 717 738 // Final Message (both log file and screen) 718 739 // ---------------------------------------- … … 720 741 strC.setf(ios::fixed); 721 742 strC << _staID.data() << " PPP " 722 << epoData->tt.timestr(1) << " " << epoData->sizeAll() << " " 743 << epoData->tt.timestr(1) << " " << epoData->sizeAll() << " " 723 744 << setw(14) << setprecision(3) << x() << " +- " 724 745 << setw(6) << setprecision(3) << sqrt(_QQ(1,1)) << " " … … 748 769 << setw(8) << setprecision(3) << _neu[2]; 749 770 } 750 751 strC << endl; 771 //Perlt Anfang 772 // strC << endl; 773 //Perlt Ende 774 775 emit newMessage(QByteArray(strC.str().c_str()), true); 776 777 //Perlt Anfang 778 ostringstream strD; 779 strD.setf(ios::fixed); 780 ostringstream strE; 781 strE.setf(ios::fixed); 782 783 if (settings.value("pppOrigin").toString() != "No plot" && settings.value("pppAverage").toString() != "") { 784 double xyzRef[3]; 785 if (settings.value("pppOrigin").toString() == "X Y Z") { 786 xyzRef[0] = settings.value("pppRefCrdX").toDouble(); 787 xyzRef[1] = settings.value("pppRefCrdY").toDouble(); 788 xyzRef[2] = settings.value("pppRefCrdZ").toDouble(); 789 _xyzAverage[3]+=(x()-xyzRef[0]); 790 _xyzAverage[4]+=(y()-xyzRef[1]); 791 _xyzAverage[5]+=(z()-xyzRef[2]); 792 _xyzAverageSqr[3]+=((x()-xyzRef[0])*(x()-xyzRef[0])); 793 _xyzAverageSqr[4]+=((y()-xyzRef[1])*(y()-xyzRef[1])); 794 _xyzAverageSqr[5]+=((z()-xyzRef[2])*(z()-xyzRef[2])); 795 } 796 797 pppPos* newPos = new pppPos; 798 newPos->time = epoData->tt; 799 newPos->xyz[0] = x(); 800 newPos->xyz[1] = y(); 801 newPos->xyz[2] = z(); 802 _posAverage.push_back(newPos); 803 804 _xyzAverage[0]+=x(); 805 _xyzAverage[1]+=y(); 806 _xyzAverage[2]+=z(); 807 _xyzAverageSqr[0]+=(x()*x()); 808 _xyzAverageSqr[1]+=(y()*y()); 809 _xyzAverageSqr[2]+=(z()*z()); 810 811 QMutableVectorIterator<pppPos*> it(_posAverage); 812 while (it.hasNext()) { 813 pppPos* pp = it.next(); 814 if ( (epoData->tt - pp->time) >= _tRangeAverage ) { 815 _xyzAverage[0]-=pp->xyz[0]; 816 _xyzAverage[1]-=pp->xyz[1]; 817 _xyzAverage[2]-=pp->xyz[2]; 818 _xyzAverageSqr[0]-=(pp->xyz[0]*pp->xyz[0]); 819 _xyzAverageSqr[1]-=(pp->xyz[1]*pp->xyz[1]); 820 _xyzAverageSqr[2]-=(pp->xyz[2]*pp->xyz[2]); 821 _xyzAverage[3]-=(pp->xyz[0]-xyzRef[0]); 822 _xyzAverage[4]-=(pp->xyz[1]-xyzRef[1]); 823 _xyzAverage[5]-=(pp->xyz[2]-xyzRef[2]); 824 _xyzAverageSqr[3]-=((pp->xyz[0]-xyzRef[0])*(pp->xyz[0]-xyzRef[0])); 825 _xyzAverageSqr[4]-=((pp->xyz[1]-xyzRef[1])*(pp->xyz[1]-xyzRef[1])); 826 _xyzAverageSqr[5]-=((pp->xyz[2]-xyzRef[2])*(pp->xyz[2]-xyzRef[2])); 827 delete pp; 828 it.remove(); 829 } 830 } 831 _xyzAverageN=_posAverage.size(); 832 double AveX; 833 double AveY; 834 double AveZ; 835 double dAveX; 836 double dAveY; 837 double dAveZ; 838 if (_xyzAverageN>1) { 839 AveX= _xyzAverage[0]/_xyzAverageN; 840 AveY= _xyzAverage[1]/_xyzAverageN; 841 AveZ= _xyzAverage[2]/_xyzAverageN; 842 dAveX= sqrt((_xyzAverageSqr[0]-_xyzAverage[0]*_xyzAverage[0]/(_xyzAverageN))/(_xyzAverageN-1)); 843 dAveY= sqrt((_xyzAverageSqr[1]-_xyzAverage[1]*_xyzAverage[1]/(_xyzAverageN))/(_xyzAverageN-1)); 844 dAveZ= sqrt((_xyzAverageSqr[2]-_xyzAverage[2]*_xyzAverage[2]/(_xyzAverageN))/(_xyzAverageN-1)); 845 strD << _staID.data() << " AVE-XYZ " 846 << epoData->tt.timestr(1) << " " 847 << setw(13) << setprecision(3) << AveX << " +- " 848 << setw(6) << setprecision(3) << dAveX << " " 849 << setw(14) << setprecision(3) << AveY << " +- " 850 << setw(6) << setprecision(3) << dAveY << " " 851 << setw(14) << setprecision(3) << AveZ << " +- " 852 << setw(6) << setprecision(3) << dAveZ; 853 emit newMessage(QByteArray(strD.str().c_str()), true); 854 } 855 if (settings.value("pppOrigin").toString() == "X Y Z" && settings.value("pppAverage").toString() != "") { 856 double _xyz[3]; 857 double ellRef[3]; 858 double _dxyz[3]; 859 double _neu[3]; 860 double _dneu[3]; 861 xyz2ell(xyzRef, ellRef); 862 _xyz[0]= _xyzAverage[3]/_xyzAverageN; 863 _xyz[1]= _xyzAverage[4]/_xyzAverageN; 864 _xyz[2]= _xyzAverage[5]/_xyzAverageN; 865 if (_xyzAverageN>1) { 866 _dxyz[0]= sqrt((_xyzAverageSqr[3]-_xyzAverage[3]*_xyzAverage[3]/(_xyzAverageN))/(_xyzAverageN-1)); 867 _dxyz[1]= sqrt((_xyzAverageSqr[4]-_xyzAverage[4]*_xyzAverage[4]/(_xyzAverageN))/(_xyzAverageN-1)); 868 _dxyz[2]= sqrt((_xyzAverageSqr[5]-_xyzAverage[5]*_xyzAverage[5]/(_xyzAverageN))/(_xyzAverageN-1)); 869 xyz2neu(ellRef, _xyz, _neu); 870 xyz2neu(ellRef, _dxyz, _dneu); 871 _dneu[0]=sqrt(_dneu[0]*_dneu[0]); 872 _dneu[1]=sqrt(_dneu[1]*_dneu[1]); 873 _dneu[2]=sqrt(_dneu[2]*_dneu[2]); 874 strE << _staID.data() << " AVE-NEU " 875 << epoData->tt.timestr(1) << " " 876 << setw(8) << setprecision(3) << _neu[0] << " +- " 877 << setw(6) << setprecision(3) << _dneu[0] << " " 878 << setw(8) << setprecision(3) << _neu[1] << " +- " 879 << setw(6) << setprecision(3) << _dneu[1] << " " 880 << setw(8) << setprecision(3) << _neu[2] << " +- " 881 << setw(6) << setprecision(3) << _dneu[2]; 882 emit newMessage(QByteArray(strE.str().c_str()), true); 883 } 884 } 885 } 886 //Perlt Ende 752 887 753 emit newMessage(QByteArray(strC.str().c_str()), true);754 888 755 889 // NMEA Output
Note:
See TracChangeset
for help on using the changeset viewer.