Ejemplo n.º 1
0
        private void ComboBoxStatus_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            string status = this.comboBoxStatus.SelectedItem.ToString();

            switch (status)
            {
            case "Start Up":
                SubWork.GetSubWork().ToLua.Stateto = (int)WorkState.WORK_STARTUP;
                break;

            case "Idle":
                SubWork.GetSubWork().ToLua.Stateto = (int)WorkState.WORK_IDLE;
                break;

            case "Measure":
                SubWork.GetSubWork().ToLua.Stateto = (int)WorkState.WORK_MEASURE;
                break;

            case "Maintain":
                SubWork.GetSubWork().ToLua.Stateto = (int)WorkState.WORK_MAINTAIN;
                break;

            case "Sleep":
                SubWork.GetSubWork().ToLua.Stateto = (int)WorkState.WORK_SLEEP;
                break;
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 达到测试预设时间
 /// </summary>
 /// <returns></returns>
 public bool ArrivedTime()
 {
     if (this.time == 0)
     {
         return(false);
     }
     else
     {
         double   time     = SubWork.GetSubWork().FromLua.Testsecs * 5;
         TimeSpan duration = TimeSpan.FromMilliseconds(time);
         int      mins     = (int)duration.TotalMinutes;
         int      secs     = (int)Math.Round(duration.TotalSeconds - mins * 60);
         if (secs == 60)
         {
             mins++;
             secs = 0;
         }
         int totalseconds = mins * 60 + secs;
         if (totalseconds == this.time || DoubleEquals(totalseconds, this.time))
         {
             SubWork.GetSubWork().ToLua.Stateto = (int)WorkState.WORK_IDLE;
             SubWork.GetSubWork().workQuit = WOEK_QUIT.WORK_QUIT_Wait;
             SubWork.GetSubWork().ToLua.Subref1 = 0;
             SubWork.GetSubWork().ToLua.Subref2 = 0;
             return(true);
         }
         else
         {
             return(false);
         }
     }
 }
Ejemplo n.º 3
0
        private void StateChangeHandler()
        {
            //this.comboBoxStatus.SelectedIndex = SubWork.GetSubWork().FromLua.State - 1;
            string state = GetState(SubWork.GetSubWork().FromLua.State);

            //this.toolStripStatus.Text = string.Format("Status: {0}", state);
            Console.WriteLine("simulator form set state to : " + state);
        }
Ejemplo n.º 4
0
 public override bool Decode(byte[] buf)
 {
     if (this.Decode(message, buf, out parameter))
     {
         //样本流速(单位uL/min),范围5~120
         SubWork.GetSubWork().ToLua.Rate = BitConverter.ToUInt16(parameter, 0);
         //config.Device.Cell.SampleVelocity = BitConverter.ToUInt16(parameter, 0);
         _c78.R = 0x01;
         _c78.M = this.message;
         return(true);
     }
     else
     {
         return(false);
     }
 }
Ejemplo n.º 5
0
        /// <summary>
        /// 达到测试预设体积
        /// </summary>
        /// <returns></returns>
        public bool ArrivedSize()
        {
            double volumn = SubWork.GetSubWork().FromLua.Testsize;

            if (volumn == this.size || DoubleEquals(volumn, this.size))
            {
                SubWork.GetSubWork().ToLua.Stateto = (int)WorkState.WORK_IDLE;
                SubWork.GetSubWork().workQuit = WOEK_QUIT.WORK_QUIT_Wait;
                SubWork.GetSubWork().ToLua.Subref1 = 0;
                SubWork.GetSubWork().ToLua.Subref2 = 0;
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 6
0
 public override bool Decode(byte[] buf)
 {
     if (this.Decode(message, buf, out parameter))
     {
         var Time   = BitConverter.ToUInt16(parameter, 0);
         var Points = BitConverter.ToUInt32(parameter, 2);
         var Size   = BitConverter.ToUInt16(parameter, 6);
         CollectionParams.GetCollectionParams().SetParams(Time, Points, Size);
         SubWork.GetSubWork().ToLua.Size = Size;
         Console.WriteLine(string.Format("Time: {0}, Points: {1}, Size: {2}", Time, Points, Size));
         _c78.M = this.message;
         _c78.R = 0x01;
         return(true);
     }
     else
     {
         return(false);
     }
 }
Ejemplo n.º 7
0
 public override bool Decode(byte[] buf)
 {
     if (this.Decode(message, buf, out parameter))
     {
         SubWork.GetSubWork().ToLua.Numclean = parameter[2];
         SubWork.GetSubWork().ToLua.Testsel = parameter[3];
         SubWork.GetSubWork().ToLua.Isextdata = false;
         SubWork.GetSubWork().workQuit = WOEK_QUIT.WORK_QUIT_Normal;
         var StartStopCellCollection   = parameter[0];
         UpdateCellCollectionStateHandler?.Invoke(StartStopCellCollection);
         var Version       = parameter[1];
         var CleaningTimes = parameter[2];
         var TestSel       = (Equipment.Device.TEST_Sel)parameter[3];
         _c78.M = this.message;
         _c78.R = 0x01;
         return(true);
     }
     else
     {
         return(false);
     }
 }
Ejemplo n.º 8
0
 private void button1_Click(object sender, EventArgs e)
 {
     SubWork subwork   = SubWork.GetSubWork();
     var     state     = subwork.ToLua.Stateto;
     var     fromState = subwork.FromLua.State;
 }
Ejemplo n.º 9
0
 private void ChangeStateToExitSleep()
 {
     SubWork.GetSubWork().ToLua.Stateto = (int)WorkState.WORK_SLEEPEXIT;
 }
Ejemplo n.º 10
0
 public void ChangeState(int state)
 {
     SubWork.GetSubWork().ToLua.Stateto = state;
 }
Ejemplo n.º 11
0
 private void InitializeStateChangeHandler()
 {
     SubWork.GetSubWork().FromLua.StateChangeHandler += StateChangeHandler;
 }
Ejemplo n.º 12
0
        public byte[] CreateDeviceWorkingStateParam()
        {
            byte[] param = new byte[35];
            byte[] M1    = new byte[4];
            subwork = SubWork.GetSubWork();
            int workMode = (int)subwork.FromLua.State;

            M1[0] = (byte)(workMode);
            M1[1] = (byte)(workMode >> 8);
            M1[2] = (byte)(workMode >> 16);
            M1[3] = (byte)(workMode >> 24);
            Array.Copy(M1, 0, param, 0, 4);

            byte[] M2    = new byte[4];
            int    state = subwork.FromLua.Ref1;

            M2[0] = (byte)(state);
            M2[1] = (byte)(state >> 8);
            M2[2] = (byte)(state >> 16);
            M2[3] = (byte)(state >> 24);
            //switch (config.Device.SystemMainWorkMode)
            //{
            //    case Equipment.Device.ESystemMainWorkMode.WM_Testing:
            //        state = (int)config.Device.MeasState;
            //        M2[0] = (byte)(state);
            //        M2[1] = (byte)(state >> 8);
            //        M2[2] = (byte)(state >> 16);
            //        M2[3] = (byte)(state >> 24);
            //        break;
            //    case Equipment.Device.ESystemMainWorkMode.WM_FlowMaintenance:
            //        state = (int)config.Device.FlowMaintainMode;
            //        M2[0] = (byte)(state);
            //        M2[1] = (byte)(state >> 8);
            //        M2[2] = (byte)(state >> 16);
            //        M2[3] = (byte)(state >> 24);
            //        break;
            //    case Equipment.Device.ESystemMainWorkMode.WM_FirstPriming:
            //    case Equipment.Device.ESystemMainWorkMode.WM_Drain:
            //        //M2 - H | M2 - L
            //        //INT16U | INT16U
            //        //M2 - H为M2的高字节,0表示执行完成,1表示执行中
            //        //M2 - L为M2的低字节,表示执行的步骤
            //        //M2 = 0表示等待上位机命令
            //        break;
            //    case Equipment.Device.ESystemMainWorkMode.WM_ErrorHandle:
            //        //M2为错误代码值,表示正在执行的错误处理
            //        break;
            //    case Equipment.Device.ESystemMainWorkMode.WM_ShutDown:
            //        //M2 - H | M2 - L
            //        //INT16U | INT16U
            //        //M2 - H为M2的高字节,0表示执行完成,1表示执行中
            //        //M2 - L为M2的低字节,表示执行的步骤
            //        //M2 = 0表示正常关机流程
            //        break;
            //}
            Array.Copy(M2, 0, param, 4, 4);

            //当前警告数
            byte[] W = new byte[2];
            Array.Copy(W, 0, param, 8, 2);

            //当前错误个数
            byte[] E = new byte[2];
            Array.Copy(E, 0, param, 10, 2);

            //测试开始时间
            byte[] T    = new byte[4];
            int    time = (int)SubWork.GetSubWork().FromLua.Testsecs * 5;

            T[0] = (byte)(time);
            T[1] = (byte)(time >> 8);
            T[2] = (byte)(time >> 16);
            T[3] = (byte)(time >> 24);
            Array.Copy(T, 0, param, 12, 4);

            //测试样本量
            byte[] V     = new byte[4];
            float  volum = (float)SubWork.GetSubWork().FromLua.Testsize;

            V = BitConverter.GetBytes(volum);
            Array.Copy(V, 0, param, 16, 4);

            //重力传感器检测是否使能(0:关闭,1:开启)
            //byte C = novoCyteConfig.Config.Device.GravitySensorDetectionEnable;
            param[20] = config.Device.GravitySensorDetectionEnable;
            //Console.WriteLine("startTime:{0}, volum:{1}, " , time, volum);

            //流程执行的节拍数
            byte[] t1    = new byte[4];
            double ticks = SubWork.GetSubWork().FromLua.Testsecs;

            t1 = BitConverter.GetBytes(ticks);
            Array.Copy(t1, 0, param, 21, 4);

            //总节拍数
            byte[] t2         = new byte[4];
            double TotalTicks = subwork.FromLua.Ttotal;

            t2 = BitConverter.GetBytes(TotalTicks);
            Array.Copy(t2, 0, param, 25, 4);
            //Console.WriteLine("ticks:{0}, totalTicks:{1}, " , ticks, TotalTicks);
            //AutoSampler联机状态
            param[29] = (byte)config.Device.AutoSampleConnectStateType;

            //QC状态
            param[30] = (byte)config.Device.QCStateType;

            //子状态
            byte[] M3 = new byte[4];

            int M2State = BitConverter.ToInt32(M2, 0);

            if (M2State == (int)config.Device.BoostingState)
            {
                state = (int)config.Device.BoostingState;
                M3[0] = (byte)(state);
                M3[1] = (byte)(state >> 8);
                M3[2] = (byte)(state >> 16);
                M3[3] = (byte)(state >> 24);
            }
            else if (M2State == (int)config.Device.TestingState)
            {
                state = (int)config.Device.TestingState;
                M3[0] = (byte)(state);
                M3[1] = (byte)(state >> 8);
                M3[2] = (byte)(state >> 16);
                M3[3] = (byte)(state >> 24);
            }
            Array.Copy(M3, 0, param, 31, 4);
            return(param);
        }