Exemplo n.º 1
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            double[] buf = sgSet.ReadL502();
            prstat("buf=" + (buf == null ? "null" : buf.Length.ToString()));
            chart1.SuspendLayout();
            chart1.Series.SuspendUpdates();
            chart1.ChartAreas.SuspendUpdates();
            Clear();
            int packets = buf.Length / 6;

            for (int p = 0; p < packets; p++)
            {
                mpI.AddY(buf[p * 6]);
                mpU.AddY(buf[p * 6 + 1]);
                mpB.AddY(buf[p * 6 + 2]);
                mpD0.AddY(buf[p * 6 + 3]);
                mpD1.AddY(buf[p * 6 + 4]);
                mpD2.AddY(buf[p * 6 + 5]);
            }
            chart1.Series.ResumeUpdates();
            chart1.ChartAreas.ResumeUpdates();
            chart1.ResumeLayout();
        }
Exemplo n.º 2
0
        public void Exec(int _tick)
        {
            if (!started)
            {
                return;
            }
            if (IsComplete)
            {
                return;
            }
            if (IsError)
            {
                return;
            }
            foreach (IJob job in J)
            {
                job.Exec(_tick);
                if (job.IsError)
                {
                    LastError = job.LastError;
                    Finish();
                    return;
                }
            }
            switch (Step)
            {
            case 0:
                if (!sgSet.CheckDTypeSize())
                {
                    LastError = "Датчики не соответствуют типоразмеру";
                    break;
                }
                Step = 1;
                break;

            case 1:
                jAlarm.Add(SL.iCC, true);
                jAlarm.Add(SL.iSGIN, true);
                jAlarm.Add(SL.iSGOUT, true);
                Step = 2;
                break;

            case 2:
                SolidGroupPars sgpars = ParAll.SG;
                L502Ch[]       MCh    = new L502Ch[2]
                {
                    sgpars.Sensor_I,
                    sgpars.Sensor_B,
                };
                jDemagnetizer.Start(_tick);
                string ret = sgSet.Start(tsDefSG, MCh);
                if (ret != null)
                {
                    LastError = ret;
                    break;
                }
                bank.Start(EUnit.SG, _tick);
                Step = 3;
                break;

            case 3:
                bank.AddGroup(EUnit.Cross, sgSet.ReadL502());
                break;
            }
            if (IsError)
            {
                Finish();
            }
        }