間接平差基礎(chǔ)大作業(yè)_第1頁(yè)
間接平差基礎(chǔ)大作業(yè)_第2頁(yè)
間接平差基礎(chǔ)大作業(yè)_第3頁(yè)
間接平差基礎(chǔ)大作業(yè)_第4頁(yè)
間接平差基礎(chǔ)大作業(yè)_第5頁(yè)
已閱讀5頁(yè),還剩25頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、測(cè)量平差基礎(chǔ)間接平差法報(bào)告書姓名: 學(xué)號(hào):日期:2016指導(dǎo)老師:目錄 TOC o 1-5 h z 1)平差原理22)平差過(guò)程3平差流程3平差相關(guān)代碼33)平差結(jié)果(要求以表格形式表達(dá);注意單位統(tǒng)一及有效位數(shù)的取位) 254)結(jié)論295)課程設(shè)計(jì)的體會(huì)及建議 306) 參考文獻(xiàn)311)平差原理設(shè)有n個(gè)觀測(cè)值L,必要觀測(cè)個(gè)數(shù)為七,選定的獨(dú)立參數(shù)文 近似值取為*。有L=L + V平差值方程為 4 +匕=afX +瓦德+ F區(qū)+4L = t J LfJti.l匕=伙匕匕 TOC o 1-5 h z 1K T%.X = X,X、- r1,1 L1d=H小乙1仇 4 廠B =a2b2. P P12* 曲

2、 * a,tbn “ri-ri 1L + V = BX + J4=X。+I = L-(BX” +d)V = Bx-1誤差方程要求:V1 PV = min對(duì)自變量X求導(dǎo),令一階導(dǎo)數(shù)為0dVTPV T eV=2V P-f 4% iroxdx= 2VrPf =0Br PV=QV - Bx-1BTPV =0基礎(chǔ)方程ri J v Bx-1法方程的解:BTPV =0,BTPBx-fTPl=()法方程x = (Bt PR) RtPlN面二1 PB, w = B Pl 口Nhhx-W=0I pact Uj + pttbix +- + patxt = pal I pabxy +| pbbx2 +* + f?bt

3、xi = pbl 觀測(cè)值和參數(shù)的平差值: = +匕X = Xn+xlpwdi1+1“加氏+1M戊=lpP為對(duì)角陣2)平差過(guò)程平差流程.讀取觀測(cè)數(shù)據(jù)與已知點(diǎn)坐標(biāo)數(shù)據(jù)(包括一些數(shù)據(jù)的精度);.計(jì)算未知點(diǎn)近似坐標(biāo);.建立角度與邊長(zhǎng)誤差方程;.計(jì)算角度觀測(cè)值誤差方程的系數(shù)和常數(shù)項(xiàng);.計(jì)算邊長(zhǎng)觀測(cè)值誤差方程的系數(shù)和常數(shù)項(xiàng);.組成誤差方程,得到系數(shù)陣和常數(shù)陣;.定權(quán),得到權(quán)矩陣;.組成并解算法方程;.計(jì)算觀測(cè)值的平差值及其方差協(xié)方差陣DLL與坐標(biāo)平差值(Xi,Yi )及其方差協(xié)方差陣 DXX.精度評(píng)定(單位權(quán)中誤差,點(diǎn)位中誤差,邊長(zhǎng)相對(duì)中誤差),平差相關(guān)代碼:#include StdAfx.h#inclu

4、de SingleTraverse.h#include CommonSurveyFunctions.h#include math.h#include CSingleTraverse二CSingleTraverse(short TraverseType,short AngleType) m_nType=TraverseType;m_nAngleType=AngleType;if(m_nType=1)/附合導(dǎo)線,4個(gè)已知點(diǎn)m_pKnownPoint=new CControlPoint4;/已知點(diǎn)數(shù)組m_iKnownPointCount=4;/已知點(diǎn)個(gè)數(shù)2個(gè)已知點(diǎn)).else if(m_nType=

5、2|m_nType=3)/閉合導(dǎo)線與無(wú)定向?qū)Ь€,(m_pKnownPoint=new CControlPoint2;/已知點(diǎn)數(shù)組m_iKnownPointCount=2;/已知點(diǎn)個(gè)數(shù)).else if(m_nType=4)/ 支導(dǎo)線 (.m_pKnownPoint=new CControlPoint;/已知點(diǎn)數(shù)組m_iKnownPointCount=1;/已知點(diǎn)個(gè)數(shù)).else(m_pKnownPoint=NULL; /已知點(diǎn)數(shù)組m_iKnownPointCount=0; /已知點(diǎn)個(gè)數(shù))m_pUnknownPoint=NULL;/ 未知點(diǎn)數(shù)組miUnknownPointCount=0; /未知

6、點(diǎn)個(gè)數(shù)m_pAngleObs=NULL; / m_iAngleObsCount=0;m_pDistObs=NULL; /m_iDistObsCount=0;).角度觀測(cè)值數(shù)組/角度觀測(cè)值個(gè)數(shù)距離觀測(cè)值數(shù)組/距離觀測(cè)值個(gè)數(shù)CSingleTraverse:CSingleTraverse(void)(/釋放動(dòng)態(tài)數(shù)組內(nèi)存 if(m_pUnknownPoint!=NULL) (delete m_pUnknownPoint;m_pUnknownPoint=NULL;).if(m_pKnownPoint!=NULL)(delete m_pKnownPoint; m_pKnownPoint=NULL;)if(

7、m_pAngleObs!=NULL)(delete m_pAngleObs;第4頁(yè)m_pAngleObs=NULL;if(m_pDistObs!=NULL)(delete m_pDistObs;m_pDistObs=NULL;).)/根據(jù)單導(dǎo)線類型,設(shè)置已知點(diǎn)個(gè)數(shù)和數(shù)組void CSingleTraverse二SetKnownPointSize(short nType)(m_nType=nType;if(m_nType=1)/附合導(dǎo)線,4個(gè)已知點(diǎn)(m_pKnownPoint=new CControlPoint4;/已知點(diǎn)數(shù)組m_iKnownPointCount=4;/ 已知點(diǎn)個(gè)數(shù)).else

8、if(m_nType=2|m_nType=3)/閉合導(dǎo)線與無(wú)定向?qū)Ь€,2個(gè)已知點(diǎn)(m_pKnownPoint=new CControlPoint2;/已知點(diǎn)數(shù)組m_iKnownPointCount=2;/ 已知點(diǎn)個(gè)數(shù)).else if(m_nType=4)/ 支導(dǎo)線(.m_pKnownPoint=new CControlPoint;/已知點(diǎn)數(shù)組m_iKnownPointCount=1;/ 已知點(diǎn)個(gè)數(shù)).else(m_pKnownPoint=NULL; / 已知點(diǎn)數(shù)組m_iKnownPointCount=0; /已知點(diǎn)個(gè)數(shù)).)/設(shè)置未知點(diǎn)個(gè)數(shù),根據(jù)導(dǎo)線類型計(jì)算出角度與距離觀測(cè)值個(gè)數(shù)/注意:調(diào)用

9、該函數(shù)后,原有數(shù)據(jù)被刪除 void CSingleTraverse二SetUnknownPointSize(int size) (if(m_pUnknownPoint!=NULL)(delete m_pUnknownPoint; m_pUnknownPoint=NULL;if(m_pAngleObs!=NULL)(delete m_pAngleObs;m_pAngleObs=NULL;.if(m_pDistObs!=NULL)(delete m_pDistObs;m_pDistObs=NULL;m_iUnknownPointCount=size;m_pUnknownPoint=new CCon

10、trolPointsize;if(m_nType=1|m_nType=2)/ 閉合導(dǎo)線或附合導(dǎo)線(m_pAngleObs=new CAngleObssize+2;m_iAngleObsCount=size+2;m_pDistObs=new CDistObssize+1;m_iDistObsCount=size+1;else if(m_nType=3)/ 無(wú)定向?qū)Ь€(.m_pAngleObs=new CAngleObssize;m_iAngleObsCount=size;m_pDistObs=new CDistObssize+1;m_iDistObsCount=size+1;else/支導(dǎo)線(m

11、_pAngleObs=new CAngleObssize;m_iAngleObsCount=size;m_pDistObs=new CDistObssize;m_iDistObsCount=size;/對(duì)已知點(diǎn)數(shù)組中的第pos點(diǎn)賦值,pos從0開(kāi)始bool CSingleTraverse二SetKnownPoint(int pos,const CControlPoint& CP) (if(pos=m_iKnownPointCount) return false;m_pKnownPointpos=CP;return true;)/對(duì)未知點(diǎn)數(shù)組中的第pos點(diǎn)賦值,pos從0開(kāi)始bool CSing

12、leTraverse:SetUnKnownPoint(int pos,const CControlPoint& CP)(if(pos=m_iUnknownPointCount) return false;m_pUnknownPointpos=CP;return true;)/對(duì)角度觀測(cè)數(shù)組中的第pos個(gè)觀測(cè)值賦值,pos從0開(kāi)始bool CSingleTraverse二SetAngleObs(int pos, const CAngleObs& AngObs)(if(pos=m_iAngleObsCount) return false;m_pAngleObspos=AngObs;return t

13、rue;)/對(duì)距離觀測(cè)數(shù)組中的第pos個(gè)觀測(cè)值賦值,pos從0開(kāi)始bool CSingleTraverse二SetDistObs(int pos, const CDistObs& DistObs)(if(pos=m_iDistObsCount) return false;m_pDistObspos=DistObs;return true;)/已知兩個(gè)控制點(diǎn),求P1-P2的方位角CAngle CSingleTraverse:Azi(const CControlPoint& P1, constCControlPoint& P2)(CAngle angAzi;angAzi(RAD尸Azimuth(P

14、1.X,P1.Y,P2.X,P2.Y);return angAzi;)/已知兩個(gè)控制點(diǎn),求P1-P2的距離double CSingleTraverse:HDist(const CControlPoint& P1, constCControlPoint& P2)(return Dist(P1.X,P1.Y,P2.X,P2.Y);)/計(jì)算角度閉合差CAngle CSingleTraverse:ComAngleClosedError(void)(CAngle angClosedError;/閉合差角度對(duì)象/* A(i+1)=A(i)+ 左角一180A(i+1)=A(i)- 右角 + 180如果大于3

15、60度還要減360*/if (m_nType = 1) / 附合導(dǎo)線.CAngle StartBearing;/ 起始方位角CAngle EndBearing;/終點(diǎn)附合方位角StartBearing = Azi(m_pKnownPoint0,m_pKnownPoint1);EndBearing = Azi(m_pKnownPoint2,m_pKnownPoint3);/沿導(dǎo)線路線遞推終止邊的方位角for(int i=0;i 360)StartBearing(DEG) = StartBearing(DEG) - 360;else if (StartBearing(DEG) 0)StartBea

16、ring(DEG) = StartBearing(DEG) + 360;angClosedError= StartBearing- EndBearing;else if (m_nType = 2)/ 閉合導(dǎo)線CAngle angSum(0,DEG);/第一個(gè)角為連接角,不參與閉合差計(jì)算與角度分配for( int i = 1;im_iAngleObsCount;i+) angSum= angSum+ m_pAngleObsi.ObsValue ;angClosedError(DEG)= angSum(DEG- (m_iAngleObsCount - 2) * 180;return angClos

17、edError;/分配角度閉合差void CSingleTraverse二DistributeAngleError(const CAngle& AngleError) (if(m_nType= 1) /附合導(dǎo)線(for(int i=0;im_iAngleObsCount;i+)(.m_pAngleObsi.ObsValue(DEG) = m_pAngleObsi.ObsValue(DEG) -(AngleError(DEG)/m_iAngleObsCount); else if( m_nType= 2)/ 閉合導(dǎo)線 (./第一個(gè)角為連接角,不參與閉合差計(jì)算與角度分配for(int i=1;im

18、_iAngleObsCount;i+)(.m_pAngleObsi.ObsValue(DEG) = m_pAngleObsi.ObsValue(DEG) -(AngleError(DEG)/(m_iAngleObsCount-1); 一 /近似坐標(biāo)推算及坐標(biāo)閉合差計(jì)算 注意:fx,fy以引用的方式調(diào)用,把閉合差傳遞出來(lái) void CSingleTraverse二CoorClosedError(double& fx, double& fy) ( double dx, dy; if(m_nType= 1|m_nType= 2)/附合導(dǎo)線或閉合導(dǎo)線( CAngle StartBearing;/ 起始

19、方位角 StartBearing = Azi(m_pKnownPoint0,m_pKnownPoint1);/沿導(dǎo)線路線遞推終止邊的方位角 for(int i=0;i 360)StartBearing(DEG) = StartBearing(DEG) - 360;else if (StartBearing(DEG) X+dx-m_pAngleObsi.cpEndObj-X;fy=m_pAngleObsi.cpStation-Y+dy-m_pAngleObsi.cpEndObj-Y; 一 )else/計(jì)算未知點(diǎn)近似坐標(biāo)(m_pAngleObsi.cpEndObj-X=m_pAngleObsi.c

20、pStation-X + dx; m_pAngleObsi.cpEndObj-Y=m_pAngleObsi.cpStation-Y + dy; 一 ) ) ) )/分配坐標(biāo)閉合差,得到簡(jiǎn)易平差結(jié)果void CSingleTraverse二DistributeCoorError(constdouble& fx, constdouble& fy)(/ 導(dǎo)線全長(zhǎng)double dTotalLength = 0;for(int i=0;im_iDistObsCount;i+)(.dTotalLength=dTotalLength+m_pDistObsi.dDist;)/分配坐標(biāo)閉合差,注意:是坐標(biāo)增量按

21、比例分配,反號(hào)分配double dx=0, dy=0;for(int i=0;iX=m_pDistObsi.cpEnd-X-dx;m_pDistObsi.cpEnd-Y=m_pDistObsi.cpEnd-Y-dy;) 一一)/簡(jiǎn)易平差計(jì)算主程序void CSingleTraverse:SimpleAdjust(const CString& strFileName)(CAngle AngleError;AngleError = ComAngleClosedError();/計(jì)算角度閉合差DistributeAngleError(AngleError);/分配角度閉合差double fx, fy

22、, fD, K;CoorClosedError(fx, fy);/近似坐標(biāo)推算及坐標(biāo)閉合差計(jì)算DistributeCoorError(fx, fy);/分配坐標(biāo)閉合差/相對(duì)誤差計(jì)算 fD = sqrt(fx * fx + fy * fy); /導(dǎo)線全長(zhǎng)double dTotalLength = 0;for(int i=0;im_iDistObsCount;i+) (.dTotalLength=dTotalLength+m_pDistObsi.dDist;一K = fD / dTotalLength;/開(kāi)始輸出簡(jiǎn)易平差的結(jié)果CStdioFile SF;CString strLine; setlo

23、cale(LC_ALL,);if(!SF.Open(strFileName, CFile:modeCreate|CFile:modeWrite) return; / 開(kāi)始寫數(shù)據(jù) SF.WriteString(_T( 單導(dǎo)線近似平差結(jié)果n); strLine.Format(_T(導(dǎo)線類型:%dn),m_nType);SF.WriteString(strLine);第11頁(yè)/ 寫已知點(diǎn)數(shù)據(jù)strLine.Format(_T(已知點(diǎn)個(gè)數(shù):%dn),m_iKnownPointCount);SF.WriteString(strLine);for(int i=0;im_iKnownPointCount;i

24、+).strLine.Format(_T(%s,%s,%.4f,%.4f,%.4fn),m_pKnownPointi.strName,m_pKnownPointi.strID,m_pKnownPointi.X,m_pKnownPointi.Y,m_pKnownPointi.H);SF.WriteString(strLine);/寫未知點(diǎn)平差后數(shù)據(jù)/寫未知點(diǎn)數(shù)據(jù)strLine.Format(_T(未知點(diǎn)個(gè)數(shù):dn),m_iUnknownPointCount);SF.WriteString(strLine);for(int i=0;im_iUnknownPointCount;i+) strLine

25、.Format(_T(%s,%s,%.4f,%.4f,%.4fn),m_pUnknownPointi.strName,m_pUnknownPointi.strID,m_pUnknownPointi.X,m_pUnknownPointi.Y,m_pUnknownPointi.H); SF.WriteString(strLine);/ 寫角度閉合差strLine.Format(_T( 角度閉合差:%.1f秒n角度閉合差限差為:%.1f 秒 n),AngleError(DEG)*3600,40* sqrt(double(m_iAngleObsCount);SF.WriteString(strLine

26、);/ 寫坐標(biāo)閉合差strLine.Format(_T(坐標(biāo)閉合差:fx=%.2fcm fy=%.2fcmn),fx,fy);SF.WriteString(strLine);/寫邊長(zhǎng)觀測(cè)精度strLine.Format(_T(邊長(zhǎng)觀測(cè)精度:1/%d),int(1.0/K);SF.WriteString(strLine);SF.Close();第12頁(yè)/字符串分割函數(shù)CString* CSingleTraverse:SplitString(CString str , char split, int iSubStrs) (int iPos = 0; /分割符位置int iNums = 0; / 分

27、割符的總數(shù)CString strTemp = str;CString strRight;/先計(jì)算子字符串的數(shù)量while (iPos != -1) (iPos = strTemp.Find(split);if (iPos = -1)( break;strRight = strTemp.Mid(iPos + 1, str.GetLength();strTemp = strRight;iNums+;if (iNums = 0) /沒(méi)有找到分割符(/子字符串?dāng)?shù)就是字符串本身iSubStrs = 1;return NULL;/ 子字符串?dāng)?shù)組iSubStrs = iNums + 1; / 子用的數(shù)量=

28、分割符數(shù)量+ 1CString* pStrSplit;pStrSplit = new CStringiSubStrs;strTemp = str;CString strLeft;for (int i = 0; i iNums; i+) (iPos = strTemp.Find(split);/左子用strLeft = strTemp.Left(iPos);/右子用strRight = strTemp.Mid(iPos + 1, strTemp.GetLength();strTemp = strRight;pStrSpliti = strLeft;第13頁(yè)pStrSplitiNums = str

29、Temp; return pStrSplit;/導(dǎo)入觀測(cè)數(shù)據(jù)函數(shù)bool CSingleTraverse:LoadObsData(const CString& strFileName) (CStdioFile sf; /創(chuàng)建文件對(duì)象/以讀的形式打開(kāi)文件,如果打開(kāi)失敗則返回if(!sf.Open(strFileName, CFile:modeRead) return false;CString strLine;BOOL bEOF=sf.ReadString(strLine);/ 讀取第一行,單導(dǎo)線類型 m_nType= _ttoi(strLine); /把讀取的第一行字符串轉(zhuǎn)換為數(shù)值型SetKn

30、ownPointSize(m_nType);/根據(jù)單導(dǎo)線類型設(shè)置已知點(diǎn)個(gè)數(shù)及數(shù)組大 小/開(kāi)始讀取已知點(diǎn)數(shù)據(jù)sf.ReadString(strLine);/ 已知點(diǎn)個(gè)數(shù)if(m_iKnownPointCount!= _ttoi(strLine)一一return false;)int n=0;/讀取并保存已知點(diǎn)數(shù)據(jù)for(int i=0;im_iKnownPointCount;i+)sf.ReadString(strLine);CString *pstrData=SplitString(strLine,n);m_pKnownPointi.strName=pstrData0;m_pKnownPoin

31、ti.strID=pstrData1;m_pKnownPointi.X=_tstof(pstrData2);m_pKnownPointi.Y=_tstof(pstrData3);m_pKnownPointi.H=_tstof(pstrData4);delete pstrData;pstrData=NULL;)/開(kāi)始讀取未知知點(diǎn)數(shù)據(jù)sf.ReadString(strLine);/ 未知點(diǎn)個(gè)數(shù)SetUnknownPointSize(_ttoi(strLine);/讀取并保存未知點(diǎn)數(shù)據(jù)for(int i=0;im_iUnknownPointCount;i+)第14頁(yè)sf.ReadString(str

32、Line);CString *pstrData=SplitString(strLine,n);m_pUnknownPointi.strName=pstrData0;m_pUnknownPointi.strID=pstrData1;delete pstrData;pstrData=NULL;/開(kāi)始讀取角度觀測(cè)值數(shù)據(jù)sf.ReadString(strLine);/ 角度類型m_nAngleType=_ttoi(strLine);sf.ReadString(strLine);/角度觀測(cè)值個(gè)數(shù)if(m_iAngleObsCount!= _ttoi(strLine).return false;/讀取并保

33、存角度觀測(cè)值數(shù)據(jù)for(int i=0;im_iAngleObsCount;i+)sf.ReadString(strLine);CString *pstrData=SplitString(strLine,n);m_pAngleObsi.cpStation =SearchPointUsingID(pstrData0);m_pAngleObsi.cpStartObj =SearchPointUsingID(pstrData1);m_pAngleObsi.cpEndObj =SearchPointUsingID(pstrData2);m_pAngleObsi.ObsValue =CAngle(_ts

34、tof(pstrData3),DMS);delete pstrData;pstrData=NULL;/開(kāi)始讀取邊長(zhǎng)觀測(cè)值數(shù)據(jù)sf.ReadString(strLine);/邊長(zhǎng)觀測(cè)值個(gè)數(shù)if(m_iDistObsCount!= _ttoi(strLine)return false;/讀取并保存邊長(zhǎng)觀測(cè)值數(shù)據(jù)for(int i=0;im_iDistObsCount;i+)sf.ReadString(strLine);CString *pstrData=SplitString(strLine,n);m_pDistObsi.cpStart =SearchPointUsingID(pstrData0)

35、;m_pDistObsi.cpEnd =SearchPointUsingID(pstrData1);m_pDistObsi.dDist =_tstof(pstrData2);delete pstrData;第15頁(yè)pstrData=NULL;) sf.Close(); return true;)/根據(jù)點(diǎn)號(hào)從已知點(diǎn)數(shù)組中找到控制點(diǎn),并返回該點(diǎn)的指針 CControlPoint* CSingleTraverse:SearchKnownPointUsingID(CString strID) for(int i=0;im_iKnownPointCount;i+) if(strID=m_pKnownPo

36、inti.strID) return &m_pKnownPointi;).) return NULL;)/根據(jù)點(diǎn)號(hào)從未知點(diǎn)數(shù)組中找到控制點(diǎn),并返回該點(diǎn)的指針CControlPoint* CSingleTraverse:SearchUnknownPointUsingID(CString strID) for(int i=0;im_iUnknownPointCount;i+) if(strID=m_pUnknownPointi.strID) return &m_pUnknownPointi;).) return NULL;)/根據(jù)點(diǎn)號(hào)從未知點(diǎn)和已知點(diǎn)數(shù)組中找到控制點(diǎn),并返回該點(diǎn)的指針 CContr

37、olPoint* CSingleTraverse:SearchPointUsingID(CString strID) CControlPoint* pCP=NULL;pCP=SearchKnownPointUsingID(strID);if(pCP=NULL) pCP=SearchUnknownPointUsingID(strID);) return pCP;)第16頁(yè)/嚴(yán)密平差(間接平差)計(jì)算主函數(shù)void CSingleTraverse二RigorousAdjust(const CString& strFileName) (/開(kāi)始輸出間接平差的結(jié)果CStdioFile SF;CString

38、 strLine;setlocale(LC_ALL,);if(!SF.Open(strFileName,CFile二modeCreate|CFile二modeWrite)return;/開(kāi)始寫數(shù)據(jù)SF.WriteString(_T( 單導(dǎo)線間接平差結(jié)果n);strLine.Format(_T(導(dǎo)線類型:dn),m_nType);SF.WriteString(strLine);/ 寫已知點(diǎn)數(shù)據(jù)strLine.Format(_T(已知點(diǎn)個(gè)數(shù):dn),m_iKnownPointCount);SF.WriteString(strLine);for(int i=0;im_iKnownPointCount

39、;i+)(strLine.Format(_T(%s,%s,%.4f,%.4f,%.4fn),m_pKnownPointi.strName,m_pKnownPointi.strID,m_pKnownPointi.X,m_pKnownPointi.Y,m_pKnownPointi.H);SF.WriteString(strLine);/第一步:計(jì)算未知點(diǎn)近似坐標(biāo)double fx, fy;CoorClosedError(fx, fy);/該函數(shù)計(jì)算坐標(biāo)閉合差的同時(shí)推算了未知點(diǎn)的近似坐標(biāo)/ 把未知點(diǎn)近似坐標(biāo)寫入文件strLine.Format(_T(未知點(diǎn)個(gè)數(shù):dn),m_iUnknownPoint

40、Count);SF.WriteString(strLine);for(int i=0;im_iUnknownPointCount;i+)(strLine.Format(_T(%s,%s,%.4f,%.4f,%.4fn),m_pUnknownPointi.strName,m_pUnknownPointi.strID,m_pUnknownPointi.X,m_pUnknownPointi.Y,m_pUnknownPointi.H);SF.WriteString(strLine);第17頁(yè)/寫坐標(biāo)閉合差strLine.Format(_T( 坐 標(biāo) 閉 合 差 : fx=%,2fcmfy=%.2fcm

41、n),fx*100,fy*100);SF.WriteString(strLine);/ 第二步:計(jì)算角度觀測(cè)值誤差方程的系數(shù)和常數(shù)項(xiàng)/ 第三步:計(jì)算邊長(zhǎng)觀測(cè)值誤差方程的系數(shù)和常數(shù)項(xiàng)/ 第四步:組成誤差方程/以上三步包含在FormErrorEquations函數(shù)中/ 第五步:定權(quán),得到權(quán)矩陣int iTotalObsCount=m_iAngleObsCount+m_iDistObsCount;CMatrix P(iTotalObsCount,iTotalObsCount);P=Weight(10, 1);/ 第六步:組成并解算法方程CMatrix B, L;CMatrix BT, N, InvN

42、, detX, V;/ 注意:detX,即坐標(biāo)改正數(shù)的單位為mmdoFormErrorEquations(B, L);BT = B;N = BT*P * B;InvN = N.Inv();detX = InvN * (BT * P * L);while(MaxAbsDetX(detX) 0.1);/ 第六步:精度評(píng)定V = B * detX - L;/輸出系數(shù)陣和常數(shù)項(xiàng)SF.WriteString(_T(B 矩陣:rn);OutMatrixToFile(B,SF);/輸出權(quán)矩陣SF.WriteString(_T(rnP 矩陣(對(duì)角陣):rn);OutMatrixToFile(P,SF);SF.

43、WriteString(_T( 坐標(biāo)改正數(shù)(mm): rn);for(int i=0;im_iUnknownPointCount;i+)(m_pUnknownPointi.X+=detX(2 * i, 0) / 1000;m_pUnknownPointi.Y+=detX(2 * i+1,0) / 1000;strLine.Format(_T(%.1f,%.1frn),detX(2 * i, 0),detX(2 * i+1,0);第18頁(yè)SF.WriteString(strLine);)SF.WriteString(_T(N矩陣:rn);OutMatrixToFile(N,SF);SF.Writ

44、eString(_T(N矩陣的逆矩陣:rn);OutMatrixToFile(InvN,SF);CMatrix W;W = BT * P * L;SF.WriteString(_T(W 矩陣:rn);OutMatrixToFile(W,SF);/第七步:輸出平差結(jié)果至結(jié)果文件中/輸出觀測(cè)值殘差SF.WriteString(_T(觀測(cè)值殘差(mm): rn);OutMatrixToFile(V,SF);/計(jì)算單位權(quán)中誤差,并輸出CMatrix Omiga,Dxx,DLL;Omiga = -V * P * V;double Sigma;Sigma = sqrt(Omiga(0, 0) / (m_i

45、AngleObsCount + m_iDistObsCount - m_iUnknownPointCount * 2);strLine.Format(_T( 單位權(quán)中誤差(mm): %.1frn),Sigma);SF.WriteString(strLine);Dxx=Sigma*Sigma*InvN;SF.WriteString(_T(Dxx(mm):rn);OutMatrixToFile(Dxx,SF);DLL=B*Dxx*BT;SF.WriteString(_T(DLL(mm):rn);OutMatrixToFile(DLL,SF);double Qx;SF.WriteString(_T(

46、 點(diǎn)位誤差(mm): rn);for(int i=0;iInvN.Row();i+)(Qx=sqrt(InvN(i,i)*Sigma;strLine.Format(_T(%.1f ),Qx);SF.WriteString(strLine);)SF.WriteString(_T(Hrn);第19頁(yè)/輸出平差后觀測(cè)值SF.WriteString(_T(平差后角度觀測(cè)值(DMS): rn);CAngle angAdj;for(int i=0;im_iAngleObsCount;i+).angAdj(DEG)=m_pAngleObsi.ObsValue(DEG)+ V(i, 0)/3600;strLi

47、ne.Format(_T(%.5f ),angAdj(DMS);SF.WriteString(strLine);SF.WriteString(_T(Hrn);SF.WriteString(_T( 平差后邊長(zhǎng)觀測(cè)值(m): rn);for(int i=0;im_iDistObsCount;i+)strLine.Format(_T(%.4f),m_pDistObsi.dDist+V(i+m_iAngleObsCount, 0);SF.WriteString(strLine);SF.WriteString(_T(Hrn);/寫未知點(diǎn)平差后未知點(diǎn)坐標(biāo)SF.WriteString(_T(未知點(diǎn)平差后坐標(biāo)

48、如下(m): rn);for(int i=0;im_iUnknownPointCount;i+) strLine.Format(_T(%s,%s,%.4f,%.4frn), m_pUnknownPointi.strName, m_pUnknownPointi.strID, m_pUnknownPointi.X, m_pUnknownPointi.Y);SF.WriteString(strLine);SF.Close();/把矩陣輸出到文件中void CSingleTraverse二OutMatrixToFile(const CMatrix& mat,CStdioFile& SF)CString

49、 strLine,strTmp;for(int i=0;imat.Row();i+)strLine.Empty();for(int j=0;jmat.Col();j+)第20頁(yè)strTmp.Format(_T(%.4f ),mat(i,j);strLine=strLine+strTmp;)SF.WriteString(strLine+_T(rn);)/定權(quán),SigmaAng為角度觀測(cè)值先驗(yàn)精度(以秒為單位),/SigmaDist距離觀測(cè)的精度(以厘米為單位)CMatrix CSingleTraverse:Weight(double SigmaAng, double SigmaDist) (in

50、t iTotalObsCount=m_iAngleObsCount+m_iDistObsCount;CMatrix P(iTotalObsCount, iTotalObsCount);P.Unit();for(int i=0;iY - AngObs.cpStation-Y) / (Sij *Sij) / 1000;Bij = -Ro * (AngObs.cpStartObj-X - AngObs.cpStation-X) / (Sij*Sij) / 1000;Sik = HDist(*AngObs.cpEndObj, *AngObs.cpStation);Aik = Ro * (AngObs.

51、cpEndObj-Y - AngObs.cpStation-Y) / (Sik*Sik) /第21頁(yè)1000;Bik = -Ro * (AngObs.cpEndObj-X - AngObs.cpStation-X) / (Sik*Sik) / 1000;Ai = Aik - Aij;Bi = Bik - Bij;Aj = Aij;Bj = Bij;Ak = -Aik;Bk = -Bik;CAngle Fij, Fik;Fij = Azi(*AngObs.cpStation , *AngObs.cpStartObj );Fik = Azi(*AngObs.cpStation , *AngObs.

52、cpEndObj);double Beta;Beta= Fik(RAD) - Fij(RAD);/左角的計(jì)算值if(BetaX - DistObs.cpStart-X) / Sik;第22頁(yè)d = (DistObs.cpEnd-Y - DistObs.cpStart-Y) / Sik;Ci = -c;Di = -d;Ck = c;Dk = d;Li = (DistObs.dDist - Sik) * 1000;/常數(shù)項(xiàng)以毫米為單位)/組成誤差方程,B為系數(shù)矩陣,L為常數(shù)項(xiàng)向量void CSingleTraverse:FormErrorEquations(CMatrix& B, CMatrix&

53、 L) (int iObsCount, iUnknownCount;iObsCount = m_iAngleObsCount + m_iDistObsCount;iUnknownCount = m_iUnknownPointCount * 2;B.SetSize(iObsCount, iUnknownCount);L.SetSize(iObsCount, 1);/計(jì)算角度觀測(cè)值系數(shù)與常數(shù)項(xiàng)double Ai, Bi, Aj, Bj, Ak, Bk, Li;for(int i=0;im_iAngleObsCount;i+)(.ComAngleObsEff(m_pAngleObsi, Li, Ai

54、, Bi, Aj, Bj, Ak, Bk);L(i, 0) = Li;if(i= 0)(B(i, 0) = Ak;B(i, 1) = Bk;)else if(i = 1)(B(i, 0) = Ai;B(i, 1) = Bi;B(i, 2) = Ak;B(i, 3) = Bk;)else if( i = m_iAngleObsCount - 2)(.B(i, (m_iAngleObsCount - 4) * 2) = Aj;B(i, (m_iAngleObsCount - 4) * 2 + 1) = Bj;B(i, (m_iAngleObsCount - 3) * 2) = Ai;B(i, (m

55、_iAngleObsCount - 3) * 2 + 1) = Bi;).else if( i = m_iAngleObsCount - 1)第23頁(yè)(B(i, (m_iAngleObsCount - 3) * 2) = Aj;B(i, (m_iAngleObsCount - 3) * 2 + 1) = Bj;). else (B(i, (i - 2) * 2) = Aj;B(i, (i - 2) * 2 + 1) = Bj;B(i, (i - 1) * 2) = Ai;B(i, (i - 1) * 2 + 1) = Bi;B(i, i * 2) = Ak;B(i, i * 2 + 1) =

56、Bk;) )/計(jì)算邊長(zhǎng)觀測(cè)值系數(shù)與常數(shù)項(xiàng)double Ci, Di, Ck, Dk;for(int i=0;im_iDistObsCount;i+)(ComDistObsEff(m_pDistObsi, Li, Ci, Di, Ck, Dk);L(i + m_iAngleObsCount, 0) = Li;if(i=0)(B(i + m_iAngleObsCount, 0) = Ck;B(i + m_iAngleObsCount, 1) = Dk;)else if( i = m_iDistObsCount - 1) (.B(i + m_iAngleObsCount, (m_iDistObsCo

57、unt - 2) * 2) = Ci;B(i + m_iAngleObsCount, (m_iDistObsCount - 2) * 2 + 1) = Di; )一一else (B(i + m_iAngleObsCount, (i - 1) * 2) = Ci;B(i + m_iAngleObsCount, (i - 1) * 2 + 1) = Di;B(i + m_iAngleObsCount, i * 2) = Ck;B(i + m_iAngleObsCount, i * 2 + 1) = Dk;).)/求未知改正數(shù)絕對(duì)值最大的 double CSingleTraverse:MaxAbsD

58、etX(const CMatrix& detX)第24頁(yè)double max=0;for(int i=0;imax)(max=fabs(detX(i,0);return max;3)平差結(jié)果(計(jì)算數(shù)據(jù)是自己找的有正確答案的數(shù)據(jù))導(dǎo)線類型:1*已知點(diǎn)個(gè)數(shù):4A,A,3157.3850,-8904.1270,0.0000B,B,3020.3480,-9049.8010,0.0000C,C,3702.4370,-10133.3990,0.0000D,D,3808.4450,-9963.8040,0.0000*未知點(diǎn)個(gè)數(shù):41,1,3046.3670,-9253.0947,0.00002,2,3071

59、.8143,-9451.6003,0.00003,3,3059.5355,-9796.5348,0.00004,4,3286.6704,-9956.9298,0.0000*坐標(biāo)閉合差:fx=5.44cm fy=6.49cm*B矩陣:0.99830.12780.00000.00000.00000.00000.00000.0000-2.0206-0.25881.02230.13110.00000.00000.00000.0000第25頁(yè)P(yáng)矩陣(對(duì)角陣):1.00000.00000.00000.00000.00000.00000.00000.00000.00000.00000.00000.00000

60、.00001.00000.00000.00000.00000.00000.00000.00000.00000.00000.00000.00000.00000.00001.00000.00000.00000.00000.00000.00000.00000.00000.00000.00000.00000.00000.00001.00000.00000.00000.00000.00000.00000.00000.00000.00000.00000.00000.00001.00000.00000.00000.00000.00000.00000.00000.00000.00000.00000.00000

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論