Esempio n. 1
0
        /// <summary>
        /// 转换GT读数到产品坐标系
        /// </summary>
        /// <param name="station"></param>
        /// <param name="calib"></param>
        /// <param name="productData"></param>
        public static void TransformRawData(string station, CalibrationConfig calib, Thermo1Product productData)
        {
            foreach (var p in productData.RawDataUp)
            {
                p.Z = TransGtRaw(station, calib, p);
            }

            foreach (var p in productData.RawDataDown)
            {
                p.Z = TransGtRaw(station, calib, p);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 转换当前点gt到产品坐标系
        /// </summary>
        /// <param name="platform"></param>
        /// <param name="calib"></param>
        /// <param name="gtPos"></param>
        /// <returns></returns>
        public static double TransGtRaw(string platform, CalibrationConfig calib, PosXYZ gtPos)
        {
            var gtWork  = gtPos.OffsetZ;
            var gtRaw   = gtPos.Z;
            var gtDesc  = gtPos.Description;
            var gtWorkX = gtPos.X;
            var gtWorkY = gtPos.Y;

            var gt = 0;

            switch (gtDesc)
            {
            case "GT":
                gt = 0;
                break;

            case "GT1":
                gt = 1;
                break;

            case "GT2":
                gt = 2;
                break;

            default:
                throw new Exception("gt Error");
            }

            var gtCalibWork      = 0d;
            var gtCalibRaw       = 0d;
            var gtStandardHeight = 0d;
            var gtDirection      = false;

            if (platform == "LeftStation")
            {
                if (gt == 0)
                {
                    //gt convert to calib coord
                    gtCalibWork      = calib.LeftHeightCalibGtPos.Z;
                    gtCalibRaw       = calib.LeftUpStandardPlaneGT.CalcZ(gtWorkX, gtWorkY);
                    gtStandardHeight = calib.LeftHeightStandard.Z;
                    gtDirection      = false;
                }
                else if (gt == 1)
                {
                    //gt1 convert to calib coord
                    gtCalibWork      = calib.LeftHeightCalibGt1Pos.Z;
                    gtCalibRaw       = calib.LeftDownStandardPlaneGT1.CalcZ(gtWorkX, gtWorkY);
                    gtStandardHeight = 0;
                    gtDirection      = true;
                }
                else if (gt == 2)
                {
                    //gt2 convert to calib coord
                    gtStandardHeight = 0;
                    var gtCalibWork2 = calib.LeftHeightCalibGt2Pos.Z;
                    var gtCalibRaw2  = calib.LeftDownStandardPlaneGT2.CalcZ(gtWorkX, gtWorkY);
                    var gt1OffsetZ   = calib.LeftDownStandardPlaneGT1.CalcZ(gtWorkX, gtWorkY);;
                    gtDirection = true;
                    var gt2Raw = GTTransform.TransGT2ToGT1(gtWork, gtRaw, gtCalibWork2, gtCalibRaw2, gtStandardHeight, gtDirection) + gt1OffsetZ;

                    //gt1 convert to calib coord
                    gtCalibWork      = calib.LeftHeightCalibGt1Pos.Z;
                    gtCalibRaw       = calib.LeftDownStandardPlaneGT1.CalcZ(gtWorkX, gtWorkY);
                    gtStandardHeight = 0;

                    gtWork = calib.LeftHeightCalibGt1Pos.Z;
                    gtRaw  = gt2Raw;

                    return(GTTransform.TransGT2ToGT1(gtWork, gtRaw, gtCalibWork, gtCalibRaw, gtStandardHeight, gtDirection) + calib.LeftGt2ZOffset.OffsetZ);
                }
            }
            else if (platform == "RightStation")
            {
                if (gt == 0)
                {
                    //gt convert to calib coord
                    gtCalibWork      = calib.RightHeightCalibGtPos.Z;
                    gtCalibRaw       = calib.RightUpStandardPlaneGT.CalcZ(gtWorkX, gtWorkY);
                    gtStandardHeight = calib.RightHeightStandard.Z;
                    gtDirection      = false;
                }
                else if (gt == 1)
                {
                    //gt1 convert to calib coord
                    gtCalibWork      = calib.RightHeightCalibGt1Pos.Z;
                    gtCalibRaw       = calib.RightDownStandardPlaneGT1.CalcZ(gtWorkX, gtWorkY);
                    gtStandardHeight = 0;
                    gtDirection      = true;
                }
                else if (gt == 2)
                {
                    //single point calib convert
                    //gtStandardHeight = 0;
                    //gtDirection = true;
                    //var gt2Raw = calib.RightHeightCalibGt1Pos.OffsetZ +
                    //             GTTransform.TransGT2ToGT1(gtWork, gtRaw, calib.RightHeightCalibGt2Pos.Z, calib.RightHeightCalibGt2Pos.OffsetZ, gtStandardHeight, gtDirection);


                    //plane calib convert
                    //gt2 convert to calib pos
                    gtStandardHeight = 0;
                    var gtCalibWork2 = calib.RightHeightCalibGt2Pos.Z;
                    var gtCalibRaw2  = calib.RightDownStandardPlaneGT2.CalcZ(gtWorkX, gtWorkY);
                    var gt1OffsetZ   = calib.RightDownStandardPlaneGT1.CalcZ(gtWorkX, gtWorkY);;
                    gtDirection = true;
                    var gt2Raw = GTTransform.TransGT2ToGT1(gtWork, gtRaw, gtCalibWork2, gtCalibRaw2, gtStandardHeight, gtDirection) + gt1OffsetZ;

                    //gt1 convert to calib pos
                    gtCalibWork      = calib.RightHeightCalibGt1Pos.Z;
                    gtCalibRaw       = calib.RightDownStandardPlaneGT1.CalcZ(gtWorkX, gtWorkY);
                    gtStandardHeight = 0;


                    gtWork = calib.RightHeightCalibGt1Pos.Z;
                    gtRaw  = gt2Raw;

                    return(GTTransform.TransGT2ToGT1(gtWork, gtRaw, gtCalibWork, gtCalibRaw, gtStandardHeight, gtDirection) + calib.RightGt2ZOffset.OffsetZ);
                }
            }
            else
            {
                throw new Exception("Platform Error");
            }

            return(GTTransform.TransGT2ToGT1(gtWork, gtRaw, gtCalibWork, gtCalibRaw, gtStandardHeight, gtDirection));
        }