近日中国信鸽协会公布了GPS空距算法,要求各个厂家按照此算法计算空距。这结束了信鸽竞翔系统空距计算的混乱局面,向中国信鸽竞翔系统标准的制定迈出了具有历史意义的一步。GPS算法如下:(VFox语言编写)varu_x1,u_y1,u_x2,u_y2:string;u_dxy,u_x,u_y,u_mx1,u_mx2,u_my1,u_my2,tmpany:string;begintmpany:=str((u_x1-int(u_x1))*10000,4);end;
para u_x1,u_y1,u_x2,u_y2prive u_dxy,u_x,u_y,u_mx1,u_mx2,u_my1,u_my2,tmpanyif u_x1=0 and u_y1=0u_xy=0return u_xyendif
u_dxy=3.141592654//地点1tmpany=str((u_x1-int(u_x1))*10000,4)//经度u_mx1=int(u_x1)+(val(left(tmpany,2))/60)+(val(right(tmpany,2))/3600)
tmpany=str((u_y1-int(u_y1))*10000,4)//纬度u_my1=int(u_y1)+(val(left(tmpany,2))/60)+(val(right(tmpany,2))/3600)//地点2tmpany=str((u_x2-int(u_x2))*1000000,6)u_mx2=int(u_x2)+(val(left(tmpany,2))/60+(val(substr(tmpany,3,2))/3600+(val(right(tmpany,2))/360000)
tmpany=str((u_y2-int(u_x2))*1000000,6)u_my2=int(u_y2)+(val(left(tmpany,2))/60+(val(substr(tmpany,3,2))/3600+(val(right(tmpany,2))/360000)
u_x=(round((111.3200144*cos(dtor(u_my1))+111.3200144*cos(dtor(u_my2)))*(u_mx1-u_mx2)/2.7))*2u_y=(round(110.9481458*(u_my1-u_my2),7))**2*u_x=((12756.334*u_dxy/360*cos(dtor(u_my1))+12756.334*u_dxy/360*cos(dtor(u_my2)))*(u_mx1-u_mx2)/2)**2*u_y=(12713.721*u_dxy/360*(u_my1-u_my2))*2
tmpany=round(sqrt(u_x+u_y)*1000,0)u_xy=iif(tmpany>=9999999,9999999,tmpany)u_xy=u_xy/1000replace sv with u_xy@13.35 say u_xyreturn |