Exemplo n.º 1
0
        public override void run(double dt)
        {
            bool resultx = true;

            if (CountTime(dt))
            {
                return;
            }
            var device        = new ActionDevice(node);
            var inject_device = (InjectorDevice)node;

            switch (step)
            {
            case 0:
            {
                int[] absorbs = { 0, 0, 0, 0 };
                foreach (var ent in injects)
                {
                    absorbs[ent.Index] = (int)ent.PumpMotor.Maximum.SetValue;
                }
                resultx = device.MovePump(injects, 100, absorbs);
                if (resultx)
                {
                    step++;
                }
            }
            break;

            case 1:
                if (device.DonePump(injects))
                {
                    step++;
                }
                isfinish = injects.Count() == 0;
                break;

            case 2:
            {
                int[] absorbs = { 0, 0, 0, 0 };
                resultx = device.MovePump(injects, 100, absorbs);
                if (resultx)
                {
                    step++;
                }
            }
            break;

            case 3:
                if (device.DonePump(injects))
                {
                    step++;
                }
                break;

            case 4:
                isfinish = true;
                break;
            }
        }
Exemplo n.º 2
0
        public override void run(double dt)
        {
            bool resulty = true;

            if (CountTime(dt))
            {
                return;
            }
            var device        = new ActionDevice(node);
            var inject_device = (InjectorDevice)node;

            switch (step)
            {
            case 0:
                resulty = device.MovePump(injects, speed, absorbs);
                if (resulty)
                {
                    step++;
                }
                break;

            case 1:
                isfinish = device.DonePump(injects);
                break;
            }
        }
Exemplo n.º 3
0
        public override void run(double dt)
        {
            bool resulty = true;

            if (CountTime(dt))
            {
                return;
            }
            var device        = new ActionDevice(node);
            var inject_device = (InjectorDevice)node;

            switch (step)
            {
            case 0:
                //容量检测
                bool is_ok = true;
                int  index = 0;
                foreach (var inject in injects)
                {
                    bool is_timeout = false;
                    inject_device.CanComm.ReadRegister(inject.PumpMotor.RealDistance.Addr);
                    int curz = inject_device.CanComm.GetIntBlock(inject.PumpMotor.RealDistance.Addr, 1000, out is_timeout);
                    movez[inject.Index] = curz + absorbs[inject.Index];
                    bool is_enough = is_timeout == false && movez[inject.Index] <= (int)inject.PumpMotor.Maximum.SetValue && movez[inject.Index] >= 0;
                    if (is_enough == false || is_timeout)
                    {
                        index = inject.Index;
                        is_ok = false;
                        break;
                    }
                }
                if (is_ok)
                {
                    step++;
                }
                else
                {
                    bool ret = ErrorSystem.WriteActError("液泵:" + index + "容量不足!");
                    if (ret == false)
                    {
                        istimeout = true;
                        errmsg    = "液泵:" + index + "容量不足!";
                        return;
                    }
                }
                if (injects.Count() == 0)
                {
                    bool ret = ErrorSystem.WriteActError("没有可用加样器");
                    if (ret == false)
                    {
                        istimeout = true;
                        errmsg    = "没有可用加样器";
                        return;
                    }
                }
                break;

            case 1:
                resulty = device.MovePump(injects, speed, movez);
                if (resulty)
                {
                    step++;
                }
                break;

            case 2:
                isfinish = device.DonePump(injects);
                break;
            }
        }