Ejemplo n.º 1
0
        public Level2()
        {
            Console.WriteLine("Level2");
            Reset();
            timebarSpace = 10.768F;
            this.Add(new SpriteGameObject("spr_background"));

            thePlayer = new Player(3, 3);
            door      = new Door(14, 0);
            goal      = new MainGoal(26, 3);
            xaxis     = new Xaxis(8, "Map/spr_horizontal_art_blue");
            yaxis     = new Yaxis(20, "Map/spr_vertical_art_blue");

            Mouse.SetPosition(GameEnvironment.Screen.X / 2, GameEnvironment.Screen.Y / 2);

            floors = new GameObjectList();
            walls  = new GameObjectList();
            goals  = new GameObjectList();

            inputScreen = new InputScreen(GameEnvironment.Screen.X / 2 - 64 * 2, GameEnvironment.Screen.Y);
            inputanswer = new InputAnswer(GameEnvironment.Screen.X / 2 - 64 * 2, GameEnvironment.Screen.Y);
            timeGround  = new SpriteGameObject("Map/time_ground");

            guards       = new GameObjectList();
            lasers       = new GameObjectList();
            times        = new GameObjectList();
            score        = new Score(12, 20, (int)time);
            Axis_nums    = new Axis_numbers(20, 8);
            switchBoards = new GameObjectList();

            this.Add(floors);
            this.Add(switchBoards);
            this.Add(lasers);
            this.Add(walls);
            this.Add(door);
            this.Add(xaxis);
            this.Add(yaxis);
            this.Add(Axis_nums);
            this.Add(goal);
            this.Add(goals);
            this.Add(guards);
            this.Add(thePlayer);
            this.Add(inputScreen);
            this.Add(timeGround);
            this.Add(times);
            this.Add(score);
            this.Add(inputanswer);

            goals.Add(new ExtraGoal(11, 9));
            guards.Add(new Guard(new Vector2(3, 13), new Vector2(25, 13)));
            FloorSetup();
            WallSetup();
            TimeBarSetup();
            SoundSetup();
            lasers.Add(new Laser(new Vector2(11, 6), new Vector2(14, 10), Color.Red, xaxis.gridPos, yaxis.gridPos));
            lasers.Add(new Laser(new Vector2(23, 10), new Vector2(28, 7), Color.Blue, xaxis.gridPos, yaxis.gridPos));
            switchBoards.Add(new SwitchBoard(3, 7, Color.Blue));
            switchBoards.Add(new SwitchBoard(22, 3, Color.Red));
        }
Ejemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        Xaxis = GameObject.Find("XAxis");
        Yaxis = GameObject.Find("YAxis");
        Zaxis = GameObject.Find("ZAxis");

        Xaxis.SetActive(false);
        Yaxis.SetActive(false);
        Zaxis.SetActive(false);
    }
Ejemplo n.º 3
0
    // Use this for initialization
    void Start()
    {
        count       = 1;
        state       = 1;
        endPosition = new Vector3(.3f, 0, 1f);
        //endPosition = new Vector3(.4f, .6f, 1.7f);

        /*Xaxis = GameObject.Find("XAxis");
        *  Yaxis = GameObject.Find("YAxis");
        *  Zaxis = GameObject.Find("ZAxis");*/
        v2.SetActive(false);
        v3.SetActive(false);
        v4.SetActive(false);
        Yaxis.SetActive(false);
        Zaxis.SetActive(false);
        holderStart = false;
    }
Ejemplo n.º 4
0
        public object GetChartDataSourse(string BTime, string ETime, DataTable dt)
        {
            columnChart retChart_column = new columnChart();

            retChart_column.Tittle        = "HWDLineFailReport";
            retChart_column.ChartTitle    = "HWD" + BTime + "-" + ETime + "生產投入統計圖";
            retChart_column.ChartSubTitle = "線別/機種產出趨勢圖";
            XAxis _XAxis = new XAxis();

            _XAxis.Title = "機種";
            //_XAxis.Categories = new List<string> { "B32S1","B32S2","B32S3","B32S4"};
            //_XAxis.XAxisType = XAxisType.datetime;
            retChart_column.XAxis   = _XAxis;
            retChart_column.Tooltip = "Pic";

            Yaxis _YAxis = new Yaxis();

            _YAxis.Title          = "投入數";
            retChart_column.YAxis = _YAxis;

            ChartData ChartData1 = new ChartData();

            ChartData1.name         = "HWD 產出統計";
            ChartData1.type         = ChartType.column.ToString();
            ChartData1.colorByPoint = true;
            List <object> chartDataSourse = new List <object>();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                columnData columnData = new columnData();
                columnData.name = dt.Rows[i]["料號"].ToString();
                columnData.y    = Convert.ToInt32(dt.Rows[i]["投入"]);
                chartDataSourse.Add(columnData);
            }
            ChartData1.data = chartDataSourse;
            List <ChartData> _ChartDatas = new List <ChartData> {
                ChartData1
            };

            retChart_column.ChartDatas = _ChartDatas;
            return(retChart_column);
        }
Ejemplo n.º 5
0
    // Use this for initialization
    void Start()
    {
        txtRef1.text = "We can represent a scalar in a one dimentional space using a point on a scaled line";
        count        = 1;
        state        = 1;
        endPosition  = new Vector3(.6f, 0, 1.5f);
        //endPosition = new Vector3(.4f, .6f, 1.7f);
        Xaxis = GameObject.Find("XAxis");
        Yaxis = GameObject.Find("YAxis");
        Zaxis = GameObject.Find("ZAxis");
        cube1 = GameObject.Find("cube1");
        cube2 = GameObject.Find("cube2");
        cube3 = GameObject.Find("cube3");

        Yaxis.SetActive(false);
        Zaxis.SetActive(false);
        cube1.SetActive(false);
        cube2.SetActive(false);
        cube3.SetActive(false);
        holderStart = false;
    }
Ejemplo n.º 6
0
        private Box <IPlotProperty> _CreateLayoutProperties()
        {
            var xaxis  = Scene.xaxis(Xaxis.color("red"));
            var yaxis  = Scene.yaxis(Yaxis.color("green"));
            var zaxis  = Scene.zaxis(Zaxis.color("blue"));
            var camera = Camera.up(Up.x(0), Up.y(1), Up.z(0));
            var scene  = Layout.scene(Scene.Aspectmode.data(), Scene.camera(camera), xaxis, yaxis, zaxis);
            var shapes = Layout.shapes(_Shapes.ToArray());



            return(Plot.layout
                       (Layout.autosize(true)
                       // , Layout.width(0)
                       , Layout.height(920)
                       // , Layout.margin(Margin.autoexpand(true))
                       // , Layout.margin(Margin.pad(5))
                       // , Layout.margin(Margin.t(5), Margin.b(5))
                       , scene
                       , shapes
                       ));
        }
Ejemplo n.º 7
0
        private void frmTeach_Load(object sender, EventArgs e)
        {
            //defaultView = new PositionDefaultView();

            ProductTeach       = new ProductTeach(m_station1);
            mCameraAxis        = new CameraAxis(m_station1);
            CameraRelationship = new CameraRelationship(m_station1);
            RootAxis           = new RootAxis(m_station1);

            mYaxis              = new Yaxis(m_station1);
            mZaxis              = new Zaxis(m_station1);
            m_panelOperate      = new Panel();
            m_panelOperate.Dock = DockStyle.Fill;

            treeView1.Nodes.Add("贴框设备");
            foreach (string str in Enum.GetNames(typeof(PositionName)))
            {
                treeView1.Nodes[0].Nodes.Add(str);
            }

            treeView1.ExpandAll();
            timer1.Enabled = true;
        }
Ejemplo n.º 8
0
    // Update is called once per frame
    void Update()
    {
        timer += Time.deltaTime;
        if (Vector3.Distance(this.transform.position, endPosition) > .0005f)
        {
            transform.position = Vector3.Lerp(this.transform.position, endPosition, Time.deltaTime);
        }
        else
        {
            transform.position = endPosition;
            if (timer >= 0 && timer < 5 * speed)
            {
                endPosition = GameObject.Find("XAxisNumber4").transform.position;
            }
            if (timer >= 5 * speed && timer < 10 * speed)
            {
                endPosition = GameObject.Find("XAxisNumber-3").transform.position;
            }
            if (timer >= 10 * speed && timer < 15 * speed)
            {
                endPosition = GameObject.Find("XAxisNumber0").transform.position;
            }
            if (timer >= 15 * speed && timer < 20 * speed)
            {
                Yaxis.SetActive(true);
                endPosition = GameObject.Find("YAxisNumber2").transform.position;
            }
            if (timer >= 20 * speed && timer < 25 * speed)
            {
                endPosition = new Vector3(0.12f + x0, .08f, z0);
            }
            if (timer >= 25 * speed && timer < 30 * speed)
            {
                endPosition = new Vector3(0.12f + x0, .14f, z0);
            }
            if (timer >= 30 * speed && timer < 35 * speed)
            {
                Zaxis.SetActive(true);
                endPosition = new Vector3(.12f + x0, .08f, .08f + z0);
            }
            if (timer >= 35 * speed && timer < 40 * speed)
            {
                endPosition = new Vector3(.08f + x0, .12f, .04f + z0);
            }
            if (timer >= 60 * speed && timer < 65 * speed)
            {
                v3.SetActive(true);
            }
            if (timer >= 85 * speed && timer < 90 * speed)
            {
                v2.SetActive(true);
                v4.SetActive(true);
            }
            if (timer >= 95 * speed && timer < 100 * speed)
            {
                v2.SetActive(false);
                v4.SetActive(false);
            }
            if (timer >= 100 * speed && timer < 105 * speed)
            {
                MeshRenderer gameObjectRenderer = v3.transform.Find("x1").GetComponent <MeshRenderer>();
                Material     newMaterial        = new Material(Shader.Find("Standard"));
                newMaterial.color           = new Color(1, 0, 0, 1);
                gameObjectRenderer.material = newMaterial;
            }
            if (timer >= 105 * speed && timer < 110 * speed)
            {
                MeshRenderer gameObjectRenderer = v3.transform.Find("y1").GetComponent <MeshRenderer>();
                Material     newMaterial        = new Material(Shader.Find("Standard"));
                newMaterial.color           = new Color(0, 1, 0, 1);
                gameObjectRenderer.material = newMaterial;
            }
            if (timer >= 110 * speed && timer < 115 * speed)
            {
                MeshRenderer gameObjectRenderer = v3.transform.Find("z1").GetComponent <MeshRenderer>();
                Material     newMaterial        = new Material(Shader.Find("Standard"));
                newMaterial.color           = new Color(0, 0, 1, 1);
                gameObjectRenderer.material = newMaterial;
            }
            if (timer >= 115 * speed && timer < 120 * speed)
            {
                Material newMaterial = new Material(Shader.Find("Standard"));
                newMaterial.color = new Color(1, 1, 1, 1);
                MeshRenderer gameObjectRenderer1 = v3.transform.Find("x1").GetComponent <MeshRenderer>();
                MeshRenderer gameObjectRenderer2 = v3.transform.Find("y1").GetComponent <MeshRenderer>();
                MeshRenderer gameObjectRenderer3 = v3.transform.Find("z1").GetComponent <MeshRenderer>();
                gameObjectRenderer1.material = newMaterial;
                gameObjectRenderer2.material = newMaterial;
                gameObjectRenderer3.material = newMaterial;
            }
            //switch (state){
            //    case(1):
            //        endPosition = GameObject.Find("XAxisNumber4").transform.position;//new Vector3(-0.16f, 0, 1.5f);
            //        state++;
            //        break;
            //    case (2):
            //        endPosition = GameObject.Find("XAxisNumber0").transform.position;//new Vector3(-0.16f, 0, 1.5f);
            //        state++;
            //        break;
            //    case (3):
            //        //txtRef1.text ="This number can refer to other directions of axes";
            //        Yaxis.SetActive(true);
            //        endPosition = GameObject.Find("YAxisNumber2").transform.position;//new Vector3(-0.16f, 0, 1.5f);
            //        state++;
            //        break;
            //    case (4):
            //        //txtRef1.text = "These components can represent a vector in a space, in this case a two dimensional space";
            //        endPosition = new Vector3(0.6f, .4f, .5f);
            //        state++;
            //        break;
            //    case (5):
            //        endPosition = new Vector3(0.6f, .4f, .5f);
            //        state++;
            //        break;
            //    case (6):
            //        //txtRef1.text = "If we use a third demension we can represent it like this";
            //        Zaxis.SetActive(true);
            //        endPosition = new Vector3(.6f, .4f, .9f);
            //        state++;
            //        break;
            //    case (7):
            //        //txtRef1.text = "and also represent it as a vector... we can represent the values of each dimen";
            //        endPosition = new Vector3(.4f, .6f, .7f);
            //        state++;
            //        break;
            //    case (8):
            //        //txtRef1.text = "Now we can represent the values of each component of a vector as colors in cubes. ";
            //        Xaxis.SetActive(false);
            //        Yaxis.SetActive(false);
            //        Zaxis.SetActive(false);
            //        state++;
            //        break;
            //    case (9):
            //        //txtRef1.text = "and also represent it as a vector by concatenating cubes";
            //        endPosition = new Vector3(0, 0, 20f);
            //        holderStart = true;
            //        //Camera.current.transform.Translate(new Vector3(0, 0, -3.5f));
            //        state++;
            //        break;
            //    case (10):
            //       // txtRef1.text = "now if we concatenate these cube vectores we can represnt a matrix, accessing each component with two indices.";
            //        //txtRef2.text = "";
            //        endPosition = new Vector3(0, 0, 0);
            //        //Camera.current.transform.Translate(new Vector3(-.5f, 0, 1.8f));
            //        //Camera.current.transform.Rotate(Vector3.up, -90);
            //        state++;
            //        break;
            //    case (11):
            //        //txtRef1.text = "if we go furthur and concatenate matrices we can find a rank 3 tensor represented liek this";
            //        //Camera.current.transform.Translate(new Vector3(-1.0f, 0, 0));
            //        endPosition = new Vector3(0, 0, 20f);
            //        state++;
            //        break;
            //    case (12):
            //       // txtRef1.text = "Tensors can have higher or lower ranks. scalar is a rank 0 tensor, vector is a rank 1 tensor and matrix is rank 2 vector.";
            //        //Camera.current.transform.Rotate(Vector3.up, 90);
            //        //Camera.current.transform.Translate(new Vector3(0, 0, -2.3f));

            //        endPosition = new Vector3(0, 0, 0);
            //        state++;
            //        break;
            //    default:
            //        break;
            //}
        }
    }
Ejemplo n.º 9
0
    // Update is called once per frame
    void Update()
    {
        timer += Time.deltaTime;
        float speed = 1;

        if (Vector3.Distance(this.transform.position, endPosition) > .005f)
        {
            transform.position = Vector3.Lerp(this.transform.position, endPosition, speed * Time.deltaTime);
        }
        else
        {
            transform.position = endPosition;
            switch (state)
            {
            case (1):
                endPosition = GameObject.Find("XAxisNumber-4").transform.position;    //new Vector3(-0.16f, 0, 1.5f);
                state++;
                break;

            case (2):
                endPosition = GameObject.Find("XAxisNumber0").transform.position;    //new Vector3(-0.16f, 0, 1.5f);
                state++;
                break;

            case (3):
                txtRef1.text = "This number can refer to other directions of axes";
                Yaxis.SetActive(true);
                endPosition = GameObject.Find("YAxisNumber2").transform.position;    //new Vector3(-0.16f, 0, 1.5f);
                state++;
                break;

            case (4):
                txtRef1.text = "These components can represent a vector in a space, in this case a two dimensional space";
                endPosition  = new Vector3(0.6f, .4f, 1.5f);
                state++;
                break;

            case (5):
                endPosition = new Vector3(0.6f, .4f, 1.5f);
                state++;
                break;

            case (6):
                txtRef1.text = "If we use a third demnsion we can represent it like this";
                Zaxis.SetActive(true);
                endPosition = new Vector3(.6f, .4f, 1.9f);
                state++;
                break;

            case (7):
                txtRef1.text = "and also represent it as a vector... we can represent the values of each dimen";
                endPosition  = new Vector3(.4f, .6f, 1.7f);
                state++;
                break;

            case (8):
                txtRef1.text = "Now we can represent the values of each component of a vector as colors in cubes. ";
                //Xaxis.SetActive(false);
                //Yaxis.SetActive(false);
                //Zaxis.SetActive(false);
                cube1.SetActive(true);
                cube2.SetActive(true);
                cube3.SetActive(true);
                if (timer > 50)
                {
                    state++;
                }
                break;

            case (9):
                txtRef1.text = "and also represent it as a vector by concatenating cubes";
                //endPosition = new Vector3(0, 0, 20f);
                //cube1.SetActive(false);
                //cube2.SetActive(false);
                //cube3.SetActive(false);
                if (timer > 60)
                {
                    holderStart = true;
                    //Camera.current.transform.Translate(new Vector3(0, 0, -3.5f));
                    state++;
                }
                break;

            case (10):
                txtRef1.text = "now if we concatenate these cube vectores we can represnt a matrix, accessing each component with two indices.";
                //endPosition = new Vector3(0, 0, 0);
                //Camera.current.transform.Translate(new Vector3(-.5f, 0, 1.8f));
                //Camera.current.transform.Rotate(Vector3.up, -90);
                state++;
                break;

            case (11):
                txtRef1.text = "if we go furthur and concatenate matrices we can find a rank 3 tensor represented liek this";
                //Camera.current.transform.Translate(new Vector3(-1.0f, 0, 0));
                //endPosition = new Vector3(0, 0, 20f);
                state++;
                break;

            case (12):
                txtRef1.text = "Tensors can have higher or lower ranks. scalar is a rank 0 tensor, vector is a rank 1 tensor and matrix is rank 2 vector.";
                //Camera.current.transform.Rotate(Vector3.up, 90);
                //Camera.current.transform.Translate(new Vector3(0, 0, -2.3f));

                //endPosition = new Vector3(0, 0, 0);
                state++;
                break;

            default:
                break;
            }
        }
    }
Ejemplo n.º 10
0
        public override void Running(RunningModes runningMode)
        {
            var step               = 0;
            var ScrewIsDone        = 0;
            var CannotTorIn        = false;
            var GetScrewPos        = new Point3D <int>();
            var ScrewHolePos       = new Point3D <int>();
            var ZaxisScrewpos      = 0;
            var watchCameratimeout = new Stopwatch();
            //var watchScrewtimeout = new Stopwatch();
            var tempPut1    = false;
            var tempPut2    = false;
            var GetScrew1   = false;
            var GetScrew2   = false;
            var pressPulse  = false;
            var startForbid = false;
            var _watch      = new Stopwatch();

            _watch.Start();

            PlateformAlarm alarm = 0;

            while (true)
            {
                Thread.Sleep(10);
                InhaleCylinder.Condition.External = externalSign;
                #region 判断后端设备交互信号
                if (tempPut1 && !GetScrew2)
                {
                    tempPut1  = false;
                    GetScrew1 = true;
                }
                if (tempPut2 && !GetScrew1)
                {
                    tempPut2  = false;
                    GetScrew2 = true;
                }
                if (!IoPoints.TDI7.Value && !Global.GetScrew1SignSheild)
                {
                    tempPut1 = false;
                }
                if (!IoPoints.TDI8.Value && !Global.GetScrew2SignSheild)
                {
                    tempPut2 = false;
                }
                if ((IoPoints.TDI7.Value || Global.GetScrew1SignSheild) && !GetScrew1 && !GetScrew2)
                {
                    tempPut1 = true;
                }
                if ((IoPoints.TDI8.Value || Global.GetScrew2SignSheild) && !GetScrew1 && !GetScrew2)
                {
                    tempPut2 = true;
                }
                #endregion
                #region 自动流程
                if (stationOperate.Running)
                {
                    switch (step)
                    {
                    case 0:
                        Marking.CoderResult.SN     = "";
                        Marking.CoderResult.Result = "";
                        step = 10;
                        Marking.watchCT.Restart();
                        break;

                    case 10:    //触发读码器读码
                        ReadCodePort.Trigger(new TriggerArgs()
                        {
                            tryTimes = 1
                        });
                        step = 20;
                        break;

                    case 20:    //判断读码器是否读到SN
                        Thread.Sleep(300);
                        if (Marking.CoderResult.SN == "")
                        {
                            step = 10;
                        }
                        else
                        {
                            step = 30;
                        }
                        break;

                    case 30:    //双按钮启动,双按钮按下的时间间隔必须小于500ms才正常启动设备
                        if (!pressPulse && (IoPoints.TDI15.Value || IoPoints.TDI16.Value))
                        {
                            pressPulse  = true;
                            startForbid = true;
                            _watch.Restart();
                        }
                        if (startForbid && IoPoints.TDI15.Value && IoPoints.TDI16.Value)
                        {
                            step        = 40;
                            startForbid = false;
                            pressPulse  = false;
                        }
                        else
                        {
                            if (500 <= _watch.ElapsedMilliseconds)
                            {
                                startForbid = false;
                            }
                        }
                        if (!IoPoints.TDI15.Value && !IoPoints.TDI16.Value)
                        {
                            pressPulse  = false;
                            startForbid = false;
                        }
                        break;

                    case 40:    //判断哪个螺丝整列机优先准备好
                        if (GetScrew1 && !GetScrew2)
                        {
                            GetScrewPos = Position.Put1ScrewPosition;
                            step        = 50;
                        }
                        else if (!GetScrew1 && GetScrew2)
                        {
                            GetScrewPos = Position.Put2ScrewPosition;
                            step        = 50;
                        }
                        break;

                    case 50:    //判断Z轴是否在0位置,X轴移动到取螺丝位置
                        if (Zaxis.IsInPosition(0))
                        {
                            Xaxis.MoveTo(GetScrewPos.X, AxisParameter.XvelocityCurve);
                            step = 60;
                        }
                        break;

                    case 60:    //X轴到达取螺丝位置,Z轴下降
                        if (Xaxis.IsInPosition(GetScrewPos.X))
                        {
                            Zaxis.MoveTo(GetScrewPos.Z, AxisParameter.ZvelocityCurve);
                            step = 70;
                        }
                        break;

                    case 70:    //Z轴到达取螺丝位置,吸真空
                        if (Zaxis.IsInPosition(GetScrewPos.Z))
                        {
                            InhaleCylinder.Set();
                            step = 80;
                        }
                        break;

                    case 80:    //Z轴上升0位置
                        if (InhaleCylinder.OutMoveStatus)
                        {
                            Zaxis.MoveTo(0, AxisParameter.ZvelocityCurve);
                            ScrewHolePos = Position.ScrewHolePosition[Marking.WorkIndex - 1];
                            step         = 90;
                        }
                        break;

                    case 90:    //Z轴到达0位置,XY轴移动拧螺丝位置
                        if (Zaxis.IsInPosition(0))
                        {
                            Xaxis.MoveTo(ScrewHolePos.X, AxisParameter.XvelocityCurve);
                            Yaxis.MoveTo(ScrewHolePos.Y, AxisParameter.YvelocityCurve);
                            step = 100;
                        }
                        break;

                    case 100:    //XY轴到达拧螺丝位置,Z轴下降
                        if (Xaxis.IsInPosition(ScrewHolePos.X) && Yaxis.IsInPosition(ScrewHolePos.Y))
                        {
                            Zaxis.MoveTo(ScrewHolePos.Z, AxisParameter.ZvelocityCurve);
                            step = 110;
                        }
                        break;

                    case 110:    //Z轴到达拧螺丝位置,启动电批,并Z轴慢速下行
                        if (Zaxis.IsInPosition(ScrewHolePos.Z))
                        {
                            IoPoints.TDO11.Value = true;
                            ZaxisScrewpos        = ScrewHolePos.Z + Position.ScrewDepth;
                            if (IoPoints.TDI9.Value)
                            {
                                Zaxis.MoveTo(ZaxisScrewpos, new VelocityCurve(0, (double)Position.ZScrewSpeed, 0));
                                step = 120;
                            }
                        }
                        break;

                    case 120:    //Z轴到达位置,判断螺丝是否拧紧
                        if (Zaxis.IsInPosition(ZaxisScrewpos))
                        {
                            if (alarm == PlateformAlarm.收不到电批的螺丝拧紧正常或拧紧异常信号)
                            {
                                CannotTorIn          = true;
                                alarm                = PlateformAlarm.无消息;
                                IoPoints.TDO11.Value = false;
                                IoPoints.TDO12.Value = true;
                                Thread.Sleep(200);
                                IoPoints.TDO12.Value = false;
                                step = 130;
                            }
                            if (IoPoints.TDI10.Value || IoPoints.TDI11.Value)
                            {
                                step = 130;
                            }
                            else
                            {
                                if (ScrewIsDone > 2)
                                {
                                    alarm   = PlateformAlarm.收不到电批的螺丝拧紧正常或拧紧异常信号;
                                    m_Alarm = PlateformAlarm.收不到电批的螺丝拧紧正常或拧紧异常信号;
                                }
                                Thread.Sleep(100);
                                ScrewIsDone++;
                            }
                        }
                        break;

                    case 130:    //触发读取数据
                        ScrewPort.Trigger(new TriggerArgs()
                        {
                            tryTimes = 1,
                            message  = "0,TR"
                        });
                        HeightGaugePort.Trigger(new TriggerArgs()
                        {
                            tryTimes = 1
                        });
                        Thread.Sleep(200);
                        step = 140;
                        break;

                    case 140:    //判断检测结果
                        if (CannotTorIn)
                        {
                            Marking.ResultScrew[Marking.WorkIndex].Result = "NG";
                            step = 150;
                        }
                        else
                        {
                            if (Marking.ResultScrew[Marking.WorkIndex].Result == "OK")
                            {
                                var data = Marking.ResultScrew[Marking.WorkIndex].HeightValue - Global.BaseHeight;
                                if (data > Position.MinHeight && data <= Position.MaxHeight)
                                {
                                    Marking.ResultScrew[Marking.WorkIndex].Result = "OK";
                                }
                                else
                                {
                                    Marking.ResultScrew[Marking.WorkIndex].Result = "NG";
                                }
                                step = 150;
                            }
                            if (Marking.ResultScrew[Marking.WorkIndex].Result == "NG")
                            {
                                step = 150;
                            }
                        }
                        break;

                    case 150:    //电批停止,真空吸气OFF,Z轴回到0位置
                        IoPoints.TDO11.Value = false;
                        InhaleCylinder.Reset();
                        Zaxis.MoveTo(0, AxisParameter.ZvelocityCurve);
                        step = 160;
                        break;

                    case 160:    //真空吸气达到,Z轴到达0位置,计数加+1
                        if (InhaleCylinder.OutOriginStatus && Zaxis.IsInPosition(0))
                        {
                            Marking.WorkIndex++;
                            if (Marking.WorkIndex < Position.HoleNum)
                            {
                                step = 40;
                            }
                            else
                            {
                                step = 170;
                            }
                        }
                        break;

                    case 170:    //判断产品拧螺丝结果
                        for (var i = 0; i < Position.HoleNum; i++)
                        {
                            if (Marking.ResultScrew[i].Result == "OK")
                            {
                                Marking.ProductResult &= true;
                            }
                            else
                            {
                                Marking.ProductResult &= false;
                            }
                        }
                        if (Marking.ProductResult)
                        {
                            Config.ProductOkTotal++;
                        }
                        else
                        {
                            Config.ProductNgTotal++;
                        }
                        step = 180;
                        break;

                    case 180:    //XY轴回到0位置
                        Xaxis.MoveTo(0, AxisParameter.XvelocityCurve);
                        Yaxis.MoveTo(0, AxisParameter.YvelocityCurve);
                        step = 190;
                        break;

                    case 190:    //XY轴到达0位置
                        if (Xaxis.IsInPosition(0) && Yaxis.IsInPosition(0))
                        {
                            step = 200;
                        }
                        break;

                    default:
                        Marking.ProductResult      = true;
                        stationOperate.RunningSign = false;
                        Marking.WorkIndex          = 0;
                        step = 0;
                        break;
                    }
                }
                #endregion

                #region 初始化流程
                if (stationInitialize.Running)
                {
                    switch (stationInitialize.Flow)
                    {
                    case 0:       //清除所有标志位的状态
                        stationInitialize.InitializeDone = false;
                        stationOperate.RunningSign       = false;
                        alarm = PlateformAlarm.无消息;
                        Marking.ProductResult = true;
                        Marking.WorkIndex     = 0;
                        step = 0;
                        Xaxis.Stop();
                        Yaxis.Stop();
                        Zaxis.Stop();
                        if (!Xaxis.IsAlarmed && !Yaxis.IsAlarmed)
                        {
                            Xaxis.IsServon         = true;
                            Yaxis.IsServon         = true;
                            Zaxis.IsServon         = true;
                            stationInitialize.Flow = 10;
                        }
                        break;

                    case 10:      //复位Z轴,真空
                        IoPoints.ApsController.BackHome(Zaxis.NoId);
                        InhaleCylinder.InitExecute();
                        InhaleCylinder.Reset();
                        stationInitialize.Flow = 20;
                        break;

                    case 20:        //判断所有气缸到位,启动Z轴回原点
                        if (InhaleCylinder.OutOriginStatus)
                        {
                            if (IoPoints.ApsController.CheckHomeDone(Zaxis.NoId, 10.0) == 0)
                            {
                                IoPoints.ApsController.BackHome(Xaxis.NoId);
                                IoPoints.ApsController.BackHome(Yaxis.NoId);
                                stationInitialize.Flow = 30;
                            }
                            else
                            {
                                Zaxis.Stop();
                                stationInitialize.InitializeDone = false;;
                                stationInitialize.Flow           = -1;
                            }
                        }
                        break;

                    case 30:    //判断XY轴是否异常,为0,正常,为1:原点异常,为<0:故障
                        var resultX = IoPoints.ApsController.CheckHomeDone(Xaxis.NoId, 10.0);
                        var resultY = IoPoints.ApsController.CheckHomeDone(Yaxis.NoId, 10.0);
                        if (IoPoints.ApsController.CheckHomeDone(Xaxis.NoId, 10.0) == 0 &&
                            IoPoints.ApsController.CheckHomeDone(Yaxis.NoId, 10.0) == 0)
                        {
                            stationInitialize.InitializeDone = true;
                            stationInitialize.Flow           = 40;
                        }
                        else    //异常处理
                        {
                            stationInitialize.InitializeDone = false;;
                            stationInitialize.Flow           = -1;
                        }
                        break;

                    default:
                        break;
                    }
                }
                #endregion

                //故障清除
                if (externalSign.AlarmReset)
                {
                    m_Alarm = PlateformAlarm.无消息;
                }
            }
        }
Ejemplo n.º 11
0
        public Level4()
        {
            Console.WriteLine("Level4");
            Reset();
            timebarSpace = 10.768F;
            this.Add(new SpriteGameObject("spr_background"));

            thePlayer = new Player(2, 2);
            door      = new Door(1, 0);
            xaxis     = new Xaxis(8, "Map/spr_horizontal_art_blue");
            yaxis     = new Yaxis(13, "Map/spr_vertical_art_blue");
            goal      = new MainGoal(3, 13);

            Mouse.SetPosition(GameEnvironment.Screen.X / 2, GameEnvironment.Screen.Y / 2);

            floors = new GameObjectList();
            walls  = new GameObjectList();
            goals  = new GameObjectList();

            inputScreen = new InputScreen(GameEnvironment.Screen.X / 2 - 64 * 2, GameEnvironment.Screen.Y);
            inputanswer = new InputAnswer(GameEnvironment.Screen.X / 2 - 64 * 2, GameEnvironment.Screen.Y);
            timeGround  = new SpriteGameObject("Map/time_ground");

            guards       = new GameObjectList();
            lasers       = new GameObjectList();
            times        = new GameObjectList();
            score        = new Score(12, 20, (int)time);
            Axis_nums    = new Axis_numbers(13, 8);
            switchBoards = new GameObjectList();

            this.Add(floors);
            this.Add(switchBoards);
            this.Add(lasers);
            this.Add(walls);
            this.Add(door);
            this.Add(xaxis);
            this.Add(yaxis);
            this.Add(Axis_nums);
            this.Add(goal);
            this.Add(goals);
            this.Add(guards);
            this.Add(thePlayer);
            this.Add(inputScreen);
            this.Add(timeGround);
            this.Add(times);
            this.Add(score);
            this.Add(inputanswer);

            goals.Add(new ExtraGoal(7, 2));
            goals.Add(new ExtraGoal(12, 2));
            goals.Add(new ExtraGoal(22, 2));
            goals.Add(new ExtraGoal(26, 2));
            goals.Add(new ExtraGoal(27, 2));
            goals.Add(new ExtraGoal(26, 3));
            goals.Add(new ExtraGoal(27, 3));
            goals.Add(new ExtraGoal(17, 8));
            goals.Add(new ExtraGoal(9, 13));
            goals.Add(new ExtraGoal(26, 13));
            FloorSetup();
            WallSetup();
            TimeBarSetup();
            SoundSetup();
            lasers.Add(new Laser(new Vector2(21, 9), new Vector2(28, 6), Color.Red, xaxis.gridPos, yaxis.gridPos));
            lasers.Add(new Laser(new Vector2(13, 10), new Vector2(19, 4), Color.Blue, xaxis.gridPos, yaxis.gridPos));
            lasers.Add(new Laser(new Vector2(14, 12), new Vector2(26, 15), Color.Yellow, xaxis.gridPos, yaxis.gridPos));
            lasers.Add(new Laser(new Vector2(7, 12), new Vector2(5, 15), Color.Purple, xaxis.gridPos, yaxis.gridPos));
            lasers.Add(new Laser(new Vector2(1, 9), new Vector2(5, 11), Color.Green, xaxis.gridPos, yaxis.gridPos));
            lasers.Add(new Laser(new Vector2(26, 5), new Vector2(28, 5), Color.DarkGray, xaxis.gridPos, yaxis.gridPos));
            lasers.Add(new Laser(new Vector2(1, 5), new Vector2(6, 10), Color.Aqua, xaxis.gridPos, yaxis.gridPos));
            switchBoards.Add(new SwitchBoard(15, 10, Color.Red));
            switchBoards.Add(new SwitchBoard(6, 10, Color.Blue));
            switchBoards.Add(new SwitchBoard(23, 10, Color.Yellow));
            switchBoards.Add(new SwitchBoard(20, 11, Color.Purple));
            switchBoards.Add(new SwitchBoard(10, 11, Color.Green));
            switchBoards.Add(new SwitchBoard(17, 11, Color.DarkGray));
            switchBoards.Add(new SwitchBoard(4, 4, Color.Aqua));
            guards.Add(new Guard(new Vector2(2, 13), new Vector2(25, 13)));
            guards.Add(new Guard(new Vector2(26, 13), new Vector2(27, 1)));
            guards.Add(new Guard(new Vector2(5, 8), new Vector2(11, 2)));
        }
Ejemplo n.º 12
0
        public override void Run()
        {
            if (wo.Value == null || wo.Value.ToString().Equals(""))
            {
                throw new Exception("WO Can not be null");
            }

            OleExec sfcdb = DBPools["SFCDB"].Borrow();


            //string workorderno = wo.Value.ToString();
            //string ClosedFlag = CloseFlag.Value.ToString();

            T_R_SN t = new T_R_SN(sfcdb, MESDataObject.DB_TYPE_ENUM.Oracle);

            //DataTable dt = t.GetSNByWo(workorderno,sfcdb);


            //ReportTable retTab = new ReportTable();
            //retTab.LoadData(dt, null);
            //retTab.Tittle = "ASSY Manufacture Report";
            //Outputs.Add(retTab);

            #region 折綫圖
            LineChart lChart = new LineChart();
            lChart.GetSample1();
            //lChart.Tittle = "SampleChart_折線圖";
            //lChart.ChartTitle = "主标题";
            //lChart.ChartSubTitle = "副标题";
            //XAxis _XAxis = new XAxis();
            //_XAxis.Title = "X轴标题";
            //_XAxis.XAxisType = XAxisType.datetime;
            //lChart.XAxis = _XAxis;
            //lChart.Tooltip = "%";

            //Yaxis _YAxis = new Yaxis();
            //_YAxis.Title = "Y轴标题";
            //lChart.YAxis = _YAxis;

            //ChartData lChartData = new ChartData();
            //lChartData.name = "B32S1";
            //lChartData.type = ChartType.line.ToString();

            //PlotOptions PlotOptions = new PlotOptions();
            //PlotOptions.type = PlotType.datetime;
            ////PlotOptions.pointStartDateTime = DateTime.Parse("2018-08-20 12:00:00");
            ////PlotOptions.pointInterval = 3600000;
            //lChart.Plot = PlotOptions;
            //lChartData.data = new List<object> { new List<object>{ "2018-08-20 12:00:00" ,new string[] { "11","22","33"} },
            //new List<object>{ "2018-08-20 13:00:00" ,new string[] { "111","222","333"} }} ;

            //List<ChartData> lChartDatas = new List<ChartData> { lChartData };
            //lChart.ChartDatas = lChartDatas;
            Outputs.Add(lChart);
            #endregion

            #region 曲綫圖
            LineChart spLineChart = new LineChart();
            spLineChart.Tittle        = "SampleChart_曲線圖";
            spLineChart.ChartTitle    = "主标题";
            spLineChart.ChartSubTitle = "副标题";
            XAxis _spXAxis = new XAxis();
            _spXAxis.Title     = "X轴标题";
            _spXAxis.XAxisType = XAxisType.datetime;
            spLineChart.XAxis  = _spXAxis;
            //spLineChart.Tooltip = "%";

            Yaxis _spYAxis = new Yaxis();
            _spYAxis.Title    = "Y轴标题";
            spLineChart.YAxis = _spYAxis;

            ChartData spChartData = new ChartData();
            spChartData.name = "B32S1";
            spChartData.type = ChartType.spline.ToString();

            PlotOptions spPlotOptions = new PlotOptions();
            spPlotOptions.type = PlotType.datetime;
            spLineChart.Plot   = spPlotOptions;
            //日期會顯示在當鼠標經過圖標的時候
            spChartData.data = new List <object> {
                new List <object> {
                    "2018-05-29 10:00:00", 64
                }, new List <object> {
                    "2018-05-29 11:00:00", 78
                }, new List <object> {
                    "2018-05-29 12:00:00", 35
                }, new List <object> {
                    "2018-05-29 14:00:00", 235
                }, new List <object> {
                    "2018-05-29 15:00:00", 135
                }, new List <object> {
                    "2018-05-29 16:00:00", 85
                }, new List <object> {
                    "2018-05-29 17:00:00", 56
                }, new List <object> {
                    "2018-05-29 18:00:00", 15
                }, new List <object> {
                    "2018-05-29 19:00:00", 133
                }
            };
            List <ChartData> _spChartDatas = new List <ChartData> {
                spChartData
            };
            spLineChart.ChartDatas = _spChartDatas;
            Outputs.Add(spLineChart);
            #endregion

            #region 面積圖
            LineChart aLineChart = new LineChart();
            aLineChart.Tittle        = "SampleChart_面積圖";
            aLineChart.ChartTitle    = "主标题";
            aLineChart.ChartSubTitle = "副标题";
            XAxis _aXAxis = new XAxis();
            _aXAxis.Title = "2018/08/20 降雨分佈";
            //_aXAxis.XAxisType = XAxisType.BarChart;
            //_aXAxis.Categories = new string[] { "12","13","14","15","16","17","18" };
            aLineChart.XAxis   = _aXAxis;
            aLineChart.Tooltip = "%";

            Yaxis _aYAxis = new Yaxis();
            _aYAxis.Title    = "降雨量";
            aLineChart.YAxis = _aYAxis;

            ChartData aChartData = new ChartData();
            aChartData.name = "降雨圖";
            aChartData.type = ChartType.area.ToString();

            PlotOptions aPlotOptions = new PlotOptions();
            aPlotOptions.type = PlotType.intdata;
            aPlotOptions.pointStartIntdata = 8;
            //aPlotOptions.pointInterval = 2;
            aLineChart.Plot = aPlotOptions;
            aChartData.data = new List <object> {
                198, 384, 64, 78, 35, 235, 135
            };

            List <ChartData> _aChartDatas = new List <ChartData> {
                aChartData
            };
            aLineChart.ChartDatas = _aChartDatas;
            Outputs.Add(aLineChart);
            #endregion

            #region 餅狀圖
            pieChart pChart = new pieChart();
            pChart.Tittle        = "餅狀圖測試 ZGJ";
            pChart.ChartTitle    = "餅狀圖主標題";
            pChart.ChartSubTitle = "餅狀圖副標題";
            ChartData pChartData = new ChartData();
            pChartData.name         = "餅狀圖數據";
            pChartData.type         = ChartType.pie.ToString();
            pChartData.data         = t.GetPieChartTestData(sfcdb);
            pChartData.colorByPoint = true;
            List <ChartData> pChartDatas = new List <ChartData> {
                pChartData
            };
            pChart.ChartDatas = pChartDatas;
            Outputs.Add(pChart);
            #endregion

            #region 柱狀圖
            columnChart cChart = new columnChart();
            cChart.Tittle        = "SampleChart_柱狀圖";
            cChart.ChartTitle    = "主标题";
            cChart.ChartSubTitle = "副标题";
            XAxis _cXAxis = new XAxis();
            _cXAxis.Title     = "X轴标题";
            _cXAxis.XAxisType = XAxisType.BarChart;
            //不可以省略,表示X軸上面顯示的内容,如果沒有設定的話,就會變成 0,1,2,3,4 這些毫無意義的數據
            _cXAxis.Categories = new string[] { "苹果", "橘子", "梨", "葡萄", "香蕉" };

            cChart.XAxis   = _cXAxis;
            cChart.Tooltip = "%";

            Yaxis _cYAxis = new Yaxis();
            _cYAxis.Title = "Y轴标题";
            cChart.YAxis  = _cYAxis;

            ChartData cChartData = new ChartData();
            cChartData.name         = "HWD 各線別產出";
            cChartData.type         = ChartType.column.ToString();
            cChartData.colorByPoint = true;
            cChartData.data         = new List <object> {
                new columnData()
                {
                    name = "苹果", y = 10
                },
                new columnData()
                {
                    name = "橘子", y = 2
                },
                new columnData()
                {
                    name = "梨", y = -3
                },
                new columnData()
                {
                    name = "葡萄", y = 4
                },
                new columnData()
                {
                    name = "香蕉", y = 0.0
                }
            };
            List <ChartData> _cChartDatas = new List <ChartData> {
                cChartData
            };
            cChart.ChartDatas = _cChartDatas;
            Outputs.Add(cChart);
            #endregion


            #region 指針式儀表圖
            //EChartBase Chart1 = new EChartBase();
            //Chart1.title = new { text = "測試指針式儀表數據" };
            //for (int i = 0; i < 5; i++)
            //{
            //    GAUGE_Chart_Data GCD = new GAUGE_Chart_Data();
            //    GCD.min = 80;
            //    GCD.max = 100;
            //    GCD.splitNumber = 2;
            //    GCD.endAngle = -45;
            //    GCD.radius = "50%";
            //    GCD.name = "第" + i + "小時";
            //    GCD.axisLine = new
            //    {
            //        lineStyle = new
            //        {
            //            width = 8,
            //            color = new List<Object>()
            //            { new List<object>() { 0.5, "#FF0000"  }, new List<object>() { 1, "#00FF00" }}
            //        }
            //    };
            //    int j = i + 1;
            //    GCD.center = new List<string>() { $@"{j * 10 + 5}%", $@"50%" };
            //    GCD.data = new List<object> { new { value = 80 + i * 5, name = GCD.name } };
            //    Chart1.series.Add(GCD);
            //}

            //Chart1.Zone_ID = "TopZone";
            //Outputs.Add(Chart1);
            #endregion

            if (sfcdb != null)
            {
                DBPools["SFCDB"].Return(sfcdb);
            }
        }
Ejemplo n.º 13
0
        public void UpdateAI(float DT)
        {
            if (firstInit)
            {
                waveSegment = (float)wavePosition / (float)waveSize;
                initSpeed();
                UpdateTransform();
                AI_Functions.Instance.RandomiseHover(this);
            }

            // Set variables for specific wave AI.
            switch (waveBehaviour)
            {
            case SPAWN_BEHAVIOUR.STRAIGHT:
                UpdateStraight(DT);
                break;

            case SPAWN_BEHAVIOUR.ZIGZAGGED:
                updateZigzagWave(DT);
                break;

            case SPAWN_BEHAVIOUR.FORMATION:
                if (firstInit)
                {
                    initFormationDelay(1);
                }
                updateFormationWave(DT);
                break;

            case SPAWN_BEHAVIOUR.SLOW_THEN_FAST:
                if (firstInit)
                {
                    initFormationDelay(1);
                }
                updateSlowThenFastWave(DT);
                break;

            case SPAWN_BEHAVIOUR.IN_THEN_OUT:
                if (firstInit)
                {
                    initFormationDelay(1);    //this probably isn't necessary now
                }
                UpdateInThenOut(DT);
                break;

            case SPAWN_BEHAVIOUR.PATROLLING_EDGE:
                UpdatePatrollingEdge(DT);
                break;

            case SPAWN_BEHAVIOUR.ASSAULT:
                UpdateAssault(DT);
                break;

            case SPAWN_BEHAVIOUR.COVERT:
                UpdateCovert(DT);
                break;

            case SPAWN_BEHAVIOUR.ROLLING_TOPBOTTOM:
                UpdateRollingTopBottom(DT);
                break;

            case SPAWN_BEHAVIOUR.TOPBOTTOM:
                UpdateTopBottom(DT);
                break;

            case SPAWN_BEHAVIOUR.STRAIGHT_AIMING:
                UpdateStraightAiming(DT);
                break;

            case SPAWN_BEHAVIOUR.MIDDLE_TOPBOTTOM:
                UpdateMiddleTopBottom(DT);
                break;

            case SPAWN_BEHAVIOUR.KAMIKAZE:
                UpdateKamikaze(DT);
                break;

            case SPAWN_BEHAVIOUR.STRAIGHT_SLOW:
                UpdateStraightSlow(DT);
                break;
            }

            // Limit Y-axis.
            if (waveFormation != SPAWN_STATE.SINGLE_FROM_SIDE && waveFormation != SPAWN_STATE.SINGLE_FROM_TOPBOTTOM)
            {
                if (m_Position.Y < -110)
                {
                    m_Position.Y = -110;
                }
                if (m_Position.Y > 110)
                {
                    m_Position.Y = 110;
                }
            }

            // Fix bounding error.
            if (waveFormation == SPAWN_STATE.SINGLE_FROM_SIDE || waveFormation == SPAWN_STATE.SINGLE_FROM_TOPBOTTOM)
            {
                if (currentMove != 0)
                {
                    if (waveBehaviour == SPAWN_BEHAVIOUR.ASSAULT || currentMove != (totalMoves - 1))
                    {
                        if (m_Position.Y < -110)
                        {
                            Yaxis.pushValue += DT * 2;
                        }
                        if (m_Position.Y > 110)
                        {
                            Yaxis.pushValue -= DT * 2;
                        }

                        // For the rare chance that highly mobile ship ends up too close to the left, just out of range.
                        if (m_Position.Y < -80 && m_Position.Z > -100)
                        {
                            Yaxis.pushValue += DT;
                        }
                        if (m_Position.Y > 80 && m_Position.Z > -100)
                        {
                            Yaxis.pushValue -= DT;
                        }
                    }
                }
            }

            rotationX = MathHelper.Clamp(rotationX, -1f, 1f);
            rotationX = MathHelper.Lerp(0.0f, rotationX, 0.97f);

            if (waveFormation != SPAWN_STATE.SINGLE_FROM_TOPBOTTOM)
            {
                rotationZ = MathHelper.Lerp(0.5f, rotationZ, 0.97f);
                rotationZ = MathHelper.Clamp(rotationZ, -0.25f, 1.3f);
            }

            m_Position.Y += Yaxis.baseSpeed;
            m_Position.Z += Zaxis.baseSpeed;
            Zaxis.Update(DT);
            Yaxis.Update(DT);
            currentMoveTimer += DT;
        }