Beispiel #1
0
        public Main()
        {
            InitializeComponent();
            Serial_port_keithley.setCallback(process_keithley_output);
            GraphPane pane_it = this.ZedGraph_I_t.GraphPane;

            pane_it.XAxis.Title = new AxisLabel("t, ms", "Verdana", (float)14, Color.Black, true, false, false);
            pane_it.YAxis.Title = new AxisLabel("I, A", "Verdana", (float)14, Color.Black, true, false, false);
            pane_it.Title.Text  = "Transient current I(t)"; ZedGraph_I_t.AxisChange();
            ZedGraph_I_t.Invalidate();
            GraphPane pane_iv = this.ZedGraph_I_V.GraphPane;

            pane_iv.XAxis.Title = new AxisLabel("U, V", "Verdana", (float)14, Color.Black, true, false, false);
            pane_iv.YAxis.Title = new AxisLabel("I, A", "Verdana", (float)14, Color.Black, true, false, false);
            pane_iv.Title.Text  = "Volt-Ampere Characteristic I(V)";
            ZedGraph_I_V.AxisChange();
            ZedGraph_I_V.Invalidate();
        }
Beispiel #2
0
        public void process_keithley_output(object obj)
        {
            if (InvokeRequired)
            {
                ObjectDelegate method = new ObjectDelegate(process_keithley_output);
                Invoke(method, obj);
                return;
            }
            try
            {
                NumberStyles style = NumberStyles.AllowExponent | NumberStyles.Number;
                System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-US");
                char[] trim_char = { 'A' };
                //logger.Info("\n Data: " + (String)obj);
                List <String> data = new List <String>(((string)obj).Split(','));

                data[0] = data[0].TrimEnd(trim_char);
                double x = Double.Parse(data[1], style);
                double y = Double.Parse(data[0], style);
                x -= TransientSession.measurement_start_time;

                this.text_box_keithley_output.Text          += x.ToString("####.##", CultureInfo.InvariantCulture) + "\t" + y + "\t" + TransientSession.voltage + "\r\n";
                this.text_box_keithley_output.SelectionStart = this.text_box_keithley_output.Text.Length;
                this.text_box_keithley_output.ScrollToCaret();
                this.text_box_keithley_output.Refresh();

                list_keithley.Add(x, y);
                data_logger.Trace("keithley: " + x.ToString("####.##", CultureInfo.InvariantCulture) + " " + y.ToString());
                GraphPane pane = ZedGraph_I_t.GraphPane;

                pane.CurveList.Clear();
                pane.AddCurve("Iph", list_keithley, Color.Blue, SymbolType.Default);
                ZedGraph_I_t.AxisChange();
                ZedGraph_I_t.Invalidate();
            }
            catch (Exception ex)
            {
                logger.Error(ex.ToString() + "\n Data: " + (String)obj);
            }
        }