コード例 #1
0
        public void InitializeDataProfileExtTCTemp(double[] pointsProfileExtTCTemp)
        {
            m_dataProfileExtTCTemp.Clear();

            for (int i = 0; i <= DataPoints - 1; i++)
            {
                DataSerie objDataSerie = new DataSerie();
                objDataSerie.Value = CTemperature.ToCelsius(System.Convert.ToInt32(pointsProfileExtTCTemp[i]));
                objDataSerie.Time  = i;
                m_dataProfileExtTCTemp.Add(objDataSerie);
            }
        }
コード例 #2
0
ファイル: Cserie.cs プロジェクト: damaro05/JenkingsTest
        public void getNextPoint(System.Drawing.PointF pt, bool last, string tempUnitsIfTemp, int filterGrade)
        {
            try
            {
                //reading the current line
                if (initReadPoint)
                {
                    string line = fReadPoint.ReadLine();
                    if (line.Length > 0)
                    {
                        pt.X = (float)(Convert.ToDouble(line.Substring(0, line.IndexOf(";"))));
                        pt.Y = (float)(Convert.ToDouble(line.Substring(line.IndexOf(";") + 1, line.Length - (line.IndexOf(";") + 1))));

                        // 13/04/2014 convert UTI to Celsius or Faharenheit
                        // do here to convert from UTI before filtering (result may be decimal)
                        if ((int)myAxis == Cplot.TEMPERATURE)
                        {
                            // convert UTI values to requested temp unit. if requested temp unit is blank or UTI, return UTI value
                            CTemperature auxTemp = new CTemperature(System.Convert.ToInt32(pt.Y));
                            if (tempUnitsIfTemp == ManRegGlobal.tempunitCELSIUS)
                            {
                                pt.Y = auxTemp.ToCelsius();
                            }
                            else if (tempUnitsIfTemp == ManRegGlobal.tempunitFAHRENHEIT)
                            {
                                pt.Y = auxTemp.ToFahrenheit();
                            }
                        }

                        //Add raw point
                        filterMemo.Add(pt.Y);

                        //Clearing the old points
                        while (filterMemo.Count > filterGrade)
                        {
                            filterMemo.RemoveAt(0);
                        }

                        //Filtering
                        if (filterMemo.Count >= filterGrade)
                        {
                            pt.Y = 0;
                            for (int i = filterMemo.Count - 1; i >= 0; i--)
                            {
                                pt.Y = pt.Y + (float)filterMemo[i];
                            }
                            pt.Y = pt.Y / filterGrade;
                        }

                        // 13/04/2014 convert UTI to Celsius or Faharenheit
                        // do here to convert from UTI after filtering (result will be always integer)
                        //If myAxis = Cplot.TEMPERATURE Then
                        //    ' convert UTI values to requested temp unit. if requested temp unit is blank or UTI, return UTI value
                        //    Dim auxTemp As JBC_ConnectRemote.Ctemperature = New JBC_ConnectRemote.Ctemperature(pt.Y)
                        //    Select Case tempUnitsIfTemp
                        //        Case tempunitCELSIUS
                        //            pt.Y = auxTemp.ToCelsius
                        //        Case tempunitFAHRENHEIT
                        //            pt.Y = auxTemp.ToFahrenheit
                        //    End Select
                        //End If
                    }
                    else
                    {
                        fReadPoint.Close();
                        initReadPoint = false;
                    }

                    //if the end of stream achieved
                    if (fReadPoint.EndOfStream)
                    {
                        fReadPoint.Close();
                        initReadPoint = false;
                    }
                }

                //if last point desired
                if (last)
                {
                    fReadPoint.Close();
                    initReadPoint = false;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Cserie::getNextPoint . error:" + ex.Message);
            }
        }
コード例 #3
0
ファイル: Cserie.cs プロジェクト: damaro05/JenkingsTest
        public void getPoints(List <System.Drawing.PointF> lst, double tMin, double tMax, string tempUnitsIfTemp, int filterGrade = 0)
        {
            //if the points aren't lodaed, loading them
            if (points.Count > 0)
            {
                if ((Math.Round(System.Convert.ToDouble(points[0].X), 3) > Math.Round(tMin, 3) && Math.Round(System.Convert.ToDouble(points[0].X), 3) > 0) || (Math.Round(System.Convert.ToDouble(points.Last().X), 3) < Math.Round(tMax, 3) && Math.Round(lastTimeInFile, 3) > Math.Round(System.Convert.ToDouble(points.Last().X), 3)))
                {
                    //FileIO.FileSystem.WriteAllText("E:\Trabajo JBC\JBCstationPlotter\out.txt", _
                    //                               "tMin: " & tMin & "; tMax: " & tMax & "; last: " & _
                    //                               points.Last.X & "; first: " & points(0).X & "; file: " & lastTimeInFile & vbCrLf, True)
                    ulong initTime = (ulong)(Environment.TickCount & int.MaxValue);
                    loadPointsFromFile(tMin, tMax);
                    //If (Environment.TickCount And Int32.MaxValue) - initTime > 0 Then Debug.Print("getPoints: " & (Environment.TickCount And Int32.MaxValue) - initTime)
                }

                //determinating the index range for the raw points
                int first = 0;
                int last  = 0;
                getTimeIntervalPointIndex(ref first, ref last, tMin, tMax);

                //getting the previous point of the interval if posible. It's to allow intervals concatenation
                if (first > 0)
                {
                    first--;
                }

                //the point list has the proper points loaded, filtering the points
                int    i      = 0;
                int    j      = 0;
                double sum    = 0;
                double result = 0;
                float  y      = 0;
                lst.Clear();
                try
                {
                    for (i = first; i <= last; i++)
                    {
                        if (i - filterGrade + 1 >= 0)
                        {
                            //filter can be applied
                            sum = 0;
                            for (j = 0; j <= filterGrade - 1; j++)
                            {
                                if ((int)myAxis == Cplot.TEMPERATURE)
                                {
                                    CTemperature auxTemp = new CTemperature(System.Convert.ToInt32(points[i - j].Y));
                                    if (tempUnitsIfTemp == ManRegGlobal.tempunitCELSIUS)
                                    {
                                        y = auxTemp.ToCelsius();
                                        //Debug.Print(String.Format("GetPoints as Celsius: UTI: {0} Celsius {1}", points.Item(i - j).Y.ToString, y.ToString))
                                    }
                                    else if (tempUnitsIfTemp == ManRegGlobal.tempunitFAHRENHEIT)
                                    {
                                        y = auxTemp.ToFahrenheit();
                                        //Debug.Print(String.Format("GetPoints as Fahrenheit: UTI: {0} Fahr {1}", points.Item(i - j).Y.ToString, y.ToString))
                                    }
                                    else
                                    {
                                        y = System.Convert.ToSingle(points[i - j].Y);
                                        //Debug.Print(String.Format("GetPoints as UTI: {0}", points.Item(i - j).Y.ToString))
                                    }
                                }
                                else
                                {
                                    y = System.Convert.ToSingle(points[i - j].Y);
                                }
                                sum = sum + y;
                            }
                            result = sum / filterGrade;

                            //assigning the point
                            lst.Add(new System.Drawing.PointF(System.Convert.ToSingle(points[i].X), (float)result));
                        }
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Cserie::getPoints . error:" + ex.Message);
                }
            }
        }
コード例 #4
0
        private void exportData(string folder)
        {
            bool          bHeader       = false;
            string        sHeader       = "";
            string        sRec          = "";
            int           iMS           = 0;
            string        currentUID    = "";
            string        filename      = "";
            List <string> listFilenames = new List <string>();
            string        sSep          = "";

            Cursor = Cursors.WaitCursor;

            if (rbSepComma.Checked)
            {
                sSep = ",";
            }
            if (rbSepSemicolon.Checked)
            {
                sSep = ";";
            }
            if (rbSepTab.Checked)
            {
                sSep = System.Convert.ToString("\t");
            }

            foreach (DataGridViewRow row in gridTraceData.Rows)
            {
                if (row.Cells["colgridUID"].Value != currentUID)
                {
                    currentUID = System.Convert.ToString(row.Cells["colgridUID"].Value);
                    filename   = Path.Combine(folder, getNameForFilename(currentUID) + "_" + DateTime.Now.ToString(EXPORT_TIME_FORMAT) + ".csv");
                    if (!listFilenames.Contains(filename))
                    {
                        listFilenames.Add(filename);
                    }
                }
                iMS += System.Convert.ToInt32(row.Cells["colgridInterval"].Value);
                string          jsonData  = System.Convert.ToString(row.Cells["colgridPortsDataJson"].Value);
                TracePortData[] portsData = getPortsData(jsonData);

                if (!bHeader)
                {
                    sHeader = "Time (ms)";
                }
                sRec = iMS.ToString();
                foreach (TracePortData p in portsData)
                {
                    if (!bHeader)
                    {
                        sHeader += sSep + "Tool_" + ((System.Convert.ToInt32(p.port)) + 1).ToString();
                        sHeader += sSep + "Temp_" + ((System.Convert.ToInt32(p.port)) + 1).ToString() + " (ºC)";
                        sHeader += sSep + "Power_" + ((System.Convert.ToInt32(p.port)) + 1).ToString() + " (%)";
                        sHeader += sSep + "Status_" + ((System.Convert.ToInt32(p.port)) + 1).ToString();
                    }
                    CTemperature temp = new CTemperature(p.temperature);
                    sRec += sSep + p.tool.ToString();
                    sRec += sSep + temp.ToCelsius().ToString();
                    sRec += sSep + (p.power / 10).ToString();
                    sRec += sSep + p.status.ToString();
                }
                if (!bHeader)
                {
                    (new Microsoft.VisualBasic.Devices.ServerComputer()).FileSystem.WriteAllText(filename, sHeader + "\r\n", true);
                    bHeader = true;
                }
                (new Microsoft.VisualBasic.Devices.ServerComputer()).FileSystem.WriteAllText(filename, sRec + "\r\n", true);
            }

            foreach (string fil in listFilenames)
            {
                log("Exported to '" + System.IO.Path.GetFileName(fil) + "' in '" + System.IO.Path.GetDirectoryName(fil) + "'");
            }

            Cursor = Cursors.Default;
        }
コード例 #5
0
ファイル: frmPorts.cs プロジェクト: damaro05/JenkingsTest
        private void updatePortInstance(int port, PictureBox pcb, Label lbl)
        {
            // Required var's
            bool sleep               = false;
            bool hiber               = false;
            bool extractor           = false;
            bool desolder            = false;
            GenericStationTools tool = default(GenericStationTools);
            string status            = "";

            // If the port exists
            if (port < nPorts)
            {
                // Setting the tool image
                tool = jbc.GetPortToolID(myID, (Port)port);
                pcb.BackgroundImage = (Image)My.Resources.Resources.ResourceManager.GetObject(tool.ToString() + "_mini");

                // Determinating the tool status
                sleep     = jbc.GetPortToolSleepStatus(myID, (Port)port) == OnOff._ON;
                hiber     = jbc.GetPortToolHibernationStatus(myID, (Port)port) == OnOff._ON;
                extractor = jbc.GetPortToolExtractorStatus(myID, (Port)port) == OnOff._ON;
                desolder  = jbc.GetPortToolDesolderStatus(myID, (Port)port) == OnOff._ON;
                if (sleep)
                {
                    status = Localization.getResStr(Configuration.PortsSleepId);
                }
                else if (hiber)
                {
                    status = Localization.getResStr(Configuration.PortsHiberId);
                }
                else if (extractor)
                {
                    status = Localization.getResStr(Configuration.PortsExtractorId);
                }
                else if (desolder)
                {
                    status = Localization.getResStr(Configuration.PortsDesolderId);
                }
                else if (tool == GenericStationTools.NO_TOOL)
                {
                    status = Localization.getResStr(Configuration.PortsNoToolId);
                }
                else
                {
                    status = Localization.getResStr(Configuration.PortsWorkId);
                }

                // Getting the temperature string
                string       tempStr = "";
                CTemperature temp    = jbc.GetPortToolActualTemp(myID, (Port)port);
                if (!Equals(temp, null))
                {
                    if (temp.isValid())
                    {
                        if (Configuration.Tunits == Configuration.CELSIUS_STR)
                        {
                            tempStr = temp.ToCelsius().ToString() + Configuration.Tunits;
                        }
                        if (Configuration.Tunits == Configuration.FAHRENHEIT_STR)
                        {
                            tempStr = temp.ToFahrenheit().ToString() + Configuration.Tunits;
                        }
                    }
                }

                // Showing the port data depending on the status
                int    textW   = System.Convert.ToInt32(lbl.CreateGraphics().MeasureString(Localization.getResStr(Configuration.PortsPortTitleId) + " " + (port + 1).ToString(), Configuration.PortsFont).Width);
                int    spaceW  = System.Convert.ToInt32(lbl.CreateGraphics().MeasureString(" ", Configuration.PortsFont).Width);
                int    nSpaces = System.Convert.ToInt32((lbl.Width - textW) / spaceW);
                string sTool   = tool.ToString();
                if (tool == GenericStationTools.NO_TOOL)
                {
                    sTool = " ";
                }
                lbl.Text = new string(' ', nSpaces);
                lbl.Text = lbl.Text + Localization.getResStr(Configuration.PortsPortTitleId) + " " + (port + 1).ToString() + "\r\n";
                lbl.Text = lbl.Text + sTool + "\r\n";
                if (status == Localization.getResStr(Configuration.PortsWorkId))
                {
                    lbl.Text = lbl.Text + tempStr;
                }
                else
                {
                    lbl.Text = lbl.Text + status;
                }
            }
        }