Esempio n. 1
0
        private void Poll()
        {
            double   nidbuff = double.MaxValue;
            DateTime dt      = DateTime.Now;

            while (!bExit)
            {
                if (ReadCount - ChartCount < 99 && !Pause)
                {
                    byte[] data = sc.GetAppdata();

                    double nid = (DateTime.Now - dt).TotalSeconds;
                    if (!GetDataByTime)
                    {
                        nid = StaubliXML.GetXMLDouble("nID", StaubliXML.Byte2xd(data));
                    }
                    double nSpeed = StaubliXML.GetXMLDouble("nRobotSpeed", StaubliXML.Byte2xd(data));

                    if (nid != nidbuff && nid > 0)
                    {
                        nidbuff = nid;

                        speeddata[ReadCount % 100, 0] = nid;
                        speeddata[ReadCount % 100, 1] = nSpeed;
                        ReadCount++;
                    }
                }
                System.Threading.Thread.Sleep(polltime);
            }
        }
Esempio n. 2
0
        private void Poll()
        {
            double   nidbuff = double.MaxValue;
            DateTime dt      = DateTime.Now;

            while (!bExit)
            {
                if (ReadCount - ChartCount < 99 && !Pause)
                {
                    byte[] data = sc.GetAppdata();

                    double nid = (DateTime.Now - dt).TotalSeconds;
                    if (!GetDataByTime)
                    {
                        nid = StaubliXML.GetXMLDouble("nID", StaubliXML.Byte2xd(data));
                    }
                    double[] nJointForce = StaubliXML.GetXMLDoubleArray("nJointForce", StaubliXML.Byte2xd(data));

                    if (nid != nidbuff && nid > 0)
                    {
                        nidbuff = nid;

                        speeddata[ReadCount % 100, 0] = nid;
                        if (nJointForce == null)
                        {
                            nJointForce = new double[6];
                        }
                        for (int i = 0; i < nJointForce.Length; i++)
                        {
                            speeddata[ReadCount % 100, 1 + i] = nJointForce[i];
                        }

                        ReadCount++;
                    }
                }
                System.Threading.Thread.Sleep(polltime);
            }
        }
Esempio n. 3
0
        static public void ReadApplicationSlave(byte[] data)
        {
            if (data == null)
            {
                TxtData.DataBase.InterfaceType = -1;


                return;
            }
            MemoryStream sm = null;
            StreamReader rd = null;
            XmlDocument  xd = null;

            try
            {
                sm          = new MemoryStream(data);
                sm.Position = 0;
                rd          = new StreamReader(sm);
                xd          = new XmlDocument();
                xd.LoadXml(rd.ReadToEnd());
                TxtData.DataBaseSlave.nProcedure    = StaubliXML.GetXMLInt("nProcedure", xd);
                TxtData.DataBaseSlave.bCycle        = StaubliXML.GetXMLBool("bCycle", xd);
                TxtData.DataBaseSlave.bPcStartCycle = StaubliXML.GetXMLBool("bPcStartCycle", xd);
                TxtData.DataBaseSlave.bPcStopCycle  = StaubliXML.GetXMLBool("bPcStopCycle", xd);

                //TxtData.DataBase.Upload = StaubliXML.GetXMLBool("bUpload", xd);
                //TxtData.DataBase.IsHome = StaubliXML.GetXMLBool("bIsHome", xd);
                //TxtData.DataBase.PowerOn = StaubliXML.GetXMLBool("bPowerOn", xd);
                //TxtData.DataBase.InterfaceType = StaubliXML.GetXMLInt("nInterfaceType", xd);
                //TxtData.DataBase.ToolMode = StaubliXML.GetXMLInt("nToolMode", xd);
                //TxtData.DataBase.CurrentJoint = StaubliXML.GetXMLJoint("jCurrentJoint", xd);
                //TxtData.DataBase.CurrentPoint = StaubliXML.GetXMLCarten("pCurrentPoint", xd);
                //TxtData.DataBase.CycleIndex = (int)StaubliXML.GetXMLDouble("nCycleIndex", xd);
                //TxtData.DataBase.CycleCount = (int)StaubliXML.GetXMLDouble("nCycleCount", xd);
                //TxtData.DataBase.RobotSpeed = StaubliXML.GetXMLDouble("nRobotSpeed", xd);
                //TxtData.DataBase.WorkPlaceCount = StaubliXML.GetXMLInt("nWorkPlaceCount", xd);
                //TxtData.DataBase.WorkPlaceIndex = StaubliXML.GetXMLInt("nWorkPlaceIndex", xd);
                //TxtData.DataBase.PresetData = StaubliXML.GetXMLIntArray("nPresetData", xd);
                //TxtData.DataBase.CycleTime = StaubliXML.GetXMLDouble("nCycleTime", xd);
                //TxtData.DataBase.PointType = (int)StaubliXML.GetXMLDouble("nPointType", xd);
                //TxtData.DataBase.TrajIndex = (int)StaubliXML.GetXMLDouble("nTrajIndex", xd);


                //TxtData.DataBase.Custom = StaubliXML.GetXMLString("sCustom",xd);
                //TxtData.DataBase.WorkPlaceProductCount = StaubliXML.GetXMLIntArray("nWpProduct", xd);
                //TxtData.DataBase.ProductName = StaubliXML.GetXMLStringArray("sProductName", xd);
                //TxtData.DataBase.AirOn = StaubliXML.GetXMLBool("bAirOn", xd);
                //TxtData.DataBase.FollowOn = StaubliXML.GetXMLBool("bFollowOn", xd);
                //TxtData.DataBase.LaserOn = StaubliXML.GetXMLBool("bLaserOn", xd);
            }
            catch
            {
                return;
            }
            finally
            {
                if (sm != null)
                {
                    sm.Close();
                }
                if (rd != null)
                {
                    rd.Close();
                }
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 读取应用程序
        /// </summary>
        /// <param name="data"></param>
        static public void ReadApplication(byte[] data)
        {
            if (data == null || data.Length < 1)
            {
                TxtData.SoapData.InterfaceType = -1;


                return;
            }
            MemoryStream sm = null;
            StreamReader rd = null;
            XmlDocument  xd = null;

            try
            {
                sm          = new MemoryStream(data);
                sm.Position = 0;
                rd          = new StreamReader(sm);
                xd          = new XmlDocument();
                xd.LoadXml(rd.ReadToEnd());
                TxtData.SoapData.Upload = StaubliXML.GetXMLBool("bUpload", xd);



                //TxtData.SoapData.CycleIndex = (int)StaubliXML.GetXMLDouble("nCycleIndex", xd);
                //TxtData.SoapData.CycleCount = (int)StaubliXML.GetXMLDouble("nCycleCount", xd);
                //TxtData.SoapData.RobotSpeed = StaubliXML.GetXMLDouble("nRobotSpeed", xd);
                //TxtData.SoapData.WorkPlaceCount = StaubliXML.GetXMLInt("nWorkPlaceCount", xd);
                //TxtData.SoapData.WorkPlaceIndex = StaubliXML.GetXMLInt("nWorkPlaceIndex", xd);
                //TxtData.SoapData.PresetData = StaubliXML.GetXMLIntArray("nPresetData", xd);
                //TxtData.SoapData.CycleTime = StaubliXML.GetXMLDouble("nCycleTime", xd);
                //TxtData.SoapData.PointType = (int)StaubliXML.GetXMLDouble("nPointType", xd);
                //TxtData.SoapData.TrajIndex = (int)StaubliXML.GetXMLDouble("nTrajIndex", xd);
                //TxtData.SoapData.Custom = StaubliXML.GetXMLString("sCustom", xd);
                //TxtData.SoapData.WorkPlaceProductCount = StaubliXML.GetXMLIntArray("nWpProduct", xd);
                //TxtData.SoapData.ProductName = StaubliXML.GetXMLStringArray("sProductName", xd);



                TxtData.SoapData.InterfaceType = StaubliXML.GetXMLInt("nInterfaceType", xd);
                TxtData.SoapData.CurrentJoint  = StaubliXML.GetXMLJoint("jCurrentJoint", xd);
                TxtData.SoapData.CurrentPoint  = StaubliXML.GetXMLCarten("pCurrent", xd);
                TxtData.SoapData.ToolMode      = StaubliXML.GetXMLInt("nWorkingMode", xd);
                TxtData.SoapData.IsHome        = StaubliXML.GetXMLBool("bHome", xd);
                TxtData.SoapData.PowerOn       = StaubliXML.GetXMLBool("bIsPower", xd);
                TxtData.SoapData.bZero         = StaubliXML.GetXMLBool("bZero", xd);
                TxtData.SoapData.BIOValue      = StaubliXML.GetXMLBoolArray("bBIO", xd);

                TxtData.SoapData.Home          = StaubliXML.GetXMLJoint("jJHome", xd);
                TxtData.SoapData.Tool          = StaubliXML.GetXMLCarten("tTTool", xd);
                TxtData.SoapData.Frame         = StaubliXML.GetXMLCarten("trFrame", xd);
                TxtData.SoapData.productStatus = StaubliXML.GetXMLStringArray("sPrdStatus", xd);
                TxtData.SoapData.Moveid        = StaubliXML.GetXMLDouble("nMoveID", xd);


                TxtData.SoapData.ATIPress = StaubliXML.GetXMLDouble("nATIPress", xd);
            }
            catch
            {
                return;
            }
            finally
            {
                if (sm != null)
                {
                    sm.Close();
                }
                if (rd != null)
                {
                    rd.Close();
                }
            }
        }