1、间接平差基础大作业测量平差基础间接平差法报告书 姓名: 学号:日期:2016 指导老师:目录1) 平差原理.22) 平差过程.3 2.1平差流程.3 2.2平差相关代码.33) 平差结果(要求以表格形式表达;注意单位统一及有效位数的取位).254) 结论.295) 课程设计的体会及建议.306) 参考文献.311)平差原理2)平差过程 2.1平差流程 .读取观测数据与已知点坐标数据(包括一些数据的精度); .计算未知点近似坐标; .建立角度与边长误差方程; .计算角度观测值误差方程的系数和常数项; .计算边长观测值误差方程的系数和常数项; .组成误差方程,得到系数阵和常数阵; .定权,得到权矩
2、阵; .组成并解算法方程; .计算观测值的平差值及其方差协方差阵DLL与坐标平差值(Xi,Yi)及其方差协方差阵DXX;.精度评定(单位权中误差,点位中误差,边长相对中误差)。2.2平差相关代码:#include StdAfx.h#include SingleTraverse.h#include CommonSurveyFunctions.h#include math.h#include CSingleTraverse:CSingleTraverse(short TraverseType,short AngleType) m_nType=TraverseType; m_nAngleType=A
3、ngleType; if(m_nType=1)/附合导线,4个已知点 m_pKnownPoint=new CControlPoint4;/已知点数组 m_iKnownPointCount=4;/已知点个数 else if(m_nType=2|m_nType=3)/闭合导线与无定向导线,2个已知点 m_pKnownPoint=new CControlPoint2;/已知点数组 m_iKnownPointCount=2;/已知点个数 else if(m_nType=4)/支导线 m_pKnownPoint=new CControlPoint;/已知点数组 m_iKnownPointCount=1;
4、/已知点个数 else m_pKnownPoint=NULL; /已知点数组 m_iKnownPointCount=0; /已知点个数 m_pUnknownPoint=NULL;/未知点数组 m_iUnknownPointCount=0; /未知点个数 m_pAngleObs=NULL; /角度观测值数组 m_iAngleObsCount=0; /角度观测值个数 m_pDistObs=NULL; /距离观测值数组 m_iDistObsCount=0; /距离观测值个数CSingleTraverse:CSingleTraverse(void) /释放动态数组内存 if(m_pUnknownPoi
5、nt!=NULL) delete m_pUnknownPoint; m_pUnknownPoint=NULL; if(m_pKnownPoint!=NULL) delete m_pKnownPoint; m_pKnownPoint=NULL; if(m_pAngleObs!=NULL) delete m_pAngleObs; m_pAngleObs=NULL; if(m_pDistObs!=NULL) delete m_pDistObs; m_pDistObs=NULL; /根据单导线类型,设置已知点个数和数组void CSingleTraverse:SetKnownPointSize(sho
6、rt nType) m_nType=nType; if(m_nType=1)/附合导线,4个已知点 m_pKnownPoint=new CControlPoint4;/已知点数组 m_iKnownPointCount=4;/已知点个数 else if(m_nType=2|m_nType=3)/闭合导线与无定向导线,2个已知点 m_pKnownPoint=new CControlPoint2;/已知点数组 m_iKnownPointCount=2;/已知点个数 else if(m_nType=4)/支导线 m_pKnownPoint=new CControlPoint;/已知点数组 m_iKno
7、wnPointCount=1;/已知点个数 else m_pKnownPoint=NULL; /已知点数组 m_iKnownPointCount=0; /已知点个数 /设置未知点个数,根据导线类型计算出角度与距离观测值个数/注意:调用该函数后,原有数据被删除void CSingleTraverse:SetUnknownPointSize(int size) if(m_pUnknownPoint!=NULL) delete m_pUnknownPoint; m_pUnknownPoint=NULL; if(m_pAngleObs!=NULL) delete m_pAngleObs; m_pAng
8、leObs=NULL; if(m_pDistObs!=NULL) delete m_pDistObs; m_pDistObs=NULL; m_iUnknownPointCount=size; m_pUnknownPoint=new CControlPointsize; if(m_nType=1|m_nType=2)/闭合导线或附合导线 m_pAngleObs=new CAngleObssize+2; m_iAngleObsCount=size+2; m_pDistObs=new CDistObssize+1; m_iDistObsCount=size+1; else if(m_nType=3)
9、/无定向导线 m_pAngleObs=new CAngleObssize; m_iAngleObsCount=size; m_pDistObs=new CDistObssize+1; m_iDistObsCount=size+1; else/支导线 m_pAngleObs=new CAngleObssize; m_iAngleObsCount=size; m_pDistObs=new CDistObssize; m_iDistObsCount=size; /对已知点数组中的第pos点赋值,pos从0开始bool CSingleTraverse:SetKnownPoint(int pos,con
10、st CControlPoint& CP) if(pos=m_iKnownPointCount) return false; m_pKnownPointpos=CP; return true;/对未知点数组中的第pos点赋值,pos从0开始bool CSingleTraverse:SetUnKnownPoint(int pos,const CControlPoint& CP) if(pos=m_iUnknownPointCount) return false; m_pUnknownPointpos=CP; return true;/对角度观测数组中的第pos个观测值赋值,pos从0开始bool
11、 CSingleTraverse:SetAngleObs(int pos, const CAngleObs& AngObs) if(pos=m_iAngleObsCount) return false; m_pAngleObspos=AngObs; return true;/对距离观测数组中的第pos个观测值赋值,pos从0开始bool CSingleTraverse:SetDistObs(int pos, const CDistObs& DistObs) if(pos=m_iDistObsCount) return false; m_pDistObspos=DistObs; return t
12、rue;/已知两个控制点,求P1-P2的方位角CAngle CSingleTraverse:Azi(const CControlPoint& P1, const CControlPoint& P2) CAngle angAzi; angAzi(RAD)=Azimuth(P1.X,P1.Y,P2.X,P2.Y); return angAzi;/已知两个控制点,求P1-P2的距离double CSingleTraverse:HDist(const CControlPoint& P1, const CControlPoint& P2) return Dist(P1.X,P1.Y,P2.X,P2.Y)
13、;/计算角度闭合差CAngle CSingleTraverse:ComAngleClosedError(void) CAngle angClosedError;/闭合差角度对象 /* A(i+1)=A(i)+左角180 A(i+1)=A(i)-右角180 如果大于360度还要减360*/ if (m_nType = 1) /附合导线 CAngle StartBearing;/起始方位角 CAngle EndBearing;/终点附合方位角 StartBearing = Azi(m_pKnownPoint0,m_pKnownPoint1); EndBearing = Azi(m_pKnownPo
14、int2,m_pKnownPoint3); /沿导线路线递推终止边的方位角 for(int i=0;i 360) StartBearing(DEG) = StartBearing(DEG) - 360; else if (StartBearing(DEG) 0) StartBearing(DEG) = StartBearing(DEG) + 360; angClosedError= StartBearing- EndBearing; else if (m_nType = 2)/闭合导线 CAngle angSum(0,DEG); /第一个角为连接角,不参与闭合差计算与角度分配 for( int
15、 i = 1;im_iAngleObsCount;i+) angSum= angSum+ m_pAngleObsi.ObsValue ; angClosedError(DEG)= angSum(DEG) - (m_iAngleObsCount - 2) * 180; return angClosedError;/分配角度闭合差void CSingleTraverse:DistributeAngleError(const CAngle& AngleError) if(m_nType= 1) /附合导线 for(int i=0;im_iAngleObsCount;i+) m_pAngleObsi.
16、ObsValue(DEG) = m_pAngleObsi.ObsValue(DEG) - (AngleError(DEG) / m_iAngleObsCount); else if( m_nType= 2)/闭合导线 /第一个角为连接角,不参与闭合差计算与角度分配 for(int i=1;im_iAngleObsCount;i+) m_pAngleObsi.ObsValue(DEG) = m_pAngleObsi.ObsValue(DEG) - (AngleError(DEG) / (m_iAngleObsCount-1); /近似坐标推算及坐标闭合差计算/注意:fx,fy以引用的方式调用,把
17、闭合差传递出来void CSingleTraverse:CoorClosedError(double& fx, double& fy) double dx, dy; if(m_nType= 1|m_nType= 2)/附合导线或闭合导线 CAngle StartBearing;/起始方位角 StartBearing = Azi(m_pKnownPoint0,m_pKnownPoint1); /沿导线路线递推终止边的方位角 for(int i=0;i 360) StartBearing(DEG) = StartBearing(DEG) - 360; else if (StartBearing(D
18、EG) X+ dx - m_pAngleObsi.cpEndObj-X; fy = m_pAngleObsi.cpStation-Y+ dy - m_pAngleObsi.cpEndObj-Y; else/计算未知点近似坐标 m_pAngleObsi.cpEndObj-X = m_pAngleObsi.cpStation-X + dx; m_pAngleObsi.cpEndObj-Y = m_pAngleObsi.cpStation-Y + dy; /分配坐标闭合差,得到简易平差结果void CSingleTraverse:DistributeCoorError(const double& f
19、x, const double& fy) /导线全长 double dTotalLength = 0; for(int i=0;im_iDistObsCount;i+) dTotalLength=dTotalLength+m_pDistObsi.dDist; /分配坐标闭合差,注意:是坐标增量按比例分配,反号分配 double dx=0, dy=0; for(int i=0;iX=m_pDistObsi.cpEnd-X-dx; m_pDistObsi.cpEnd-Y=m_pDistObsi.cpEnd-Y-dy; /简易平差计算主程序void CSingleTraverse:SimpleAdj
20、ust(const CString& strFileName) CAngle AngleError; AngleError = ComAngleClosedError();/计算角度闭合差 DistributeAngleError(AngleError);/分配角度闭合差 double fx, fy, fD, K; CoorClosedError(fx, fy);/近似坐标推算及坐标闭合差计算 DistributeCoorError(fx, fy);/分配坐标闭合差 /相对误差计算 fD = sqrt(fx * fx + fy * fy); /导线全长 double dTotalLength
21、= 0; for(int i=0;im_iDistObsCount;i+) dTotalLength=dTotalLength+m_pDistObsi.dDist; K = fD / dTotalLength; /开始输出简易平差的结果 CStdioFile SF; CString strLine; setlocale(LC_ALL,); if(!SF.Open(strFileName, CFile:modeCreate|CFile:modeWrite) return; /开始写数据 SF.WriteString(_T(单导线近似平差结果n); strLine.Format(_T(导线类型:%
22、dn),m_nType); SF.WriteString(strLine); /写已知点数据 strLine.Format(_T(已知点个数:%dn),m_iKnownPointCount); SF.WriteString(strLine); for(int i=0;im_iKnownPointCount;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
23、.WriteString(strLine); /写未知点平差后数据 /写未知点数据 strLine.Format(_T(未知点个数:%dn),m_iUnknownPointCount); 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_pUnknownPoin
24、ti.H); SF.WriteString(strLine); /写角度闭合差 strLine.Format(_T(角度闭合差:%.1f秒n角度闭合差限差为:%.1f秒n), AngleError(DEG) * 3600,40 * sqrt(double (m_iAngleObsCount); SF.WriteString(strLine); /写坐标闭合差 strLine.Format(_T(坐标闭合差:fx=%.2fcm fy=%.2fcmn),fx,fy); SF.WriteString(strLine); /写边长观测精度 strLine.Format(_T(边长观测精度:1/%d),int(1.0/K); SF.WriteString(strLine); SF.Close();/字符串分割函数CStr
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1