public FAReelPickerUpDownServo(FASequenceManager aSequenceManager)
            : base(aSequenceManager)
        {
            PickPos = new FAAPlusMMCPosition();
            MoveStandbyPos = new FAPartAction();
            MoveGripPos = new FAPartAction();
            MovePickPos = new FAPartAction();
            MovePlacePos = new FAPartAction();
            MoveTopPushingPos = new FAPartAction();
            MoveAlignPos = new FAPartAction();

            MoveStandbyPos.SetActionMethod(DoMoveStandbyPos);
            MoveGripPos.SetActionMethod(DoMoveGripPos);
            MovePickPos.SetActionMethod(DoMovePickPos);
            MovePlacePos.SetActionMethod(DoMovePlacePos);
            MoveTopPushingPos.SetActionMethod(DoMoveTopPushingPos);
            MoveAlignPos.SetActionMethod(DoMoveAlignPos);

            MoveStandbyPos.CreateSequence(aSequenceManager);
            MoveGripPos.CreateSequence(aSequenceManager);
            MovePickPos.CreateSequence(aSequenceManager);
            MovePlacePos.CreateSequence(aSequenceManager);
            MoveTopPushingPos.CreateSequence(aSequenceManager);
            MoveAlignPos.CreateSequence(aSequenceManager);

            MakeMoveStandbyPos();
            MakeMoveGripPos();
            MakeMovePickPos();
            MakeMovePlacePos();
            MakeMoveTopPushingPos();
            MakeMoveAlignPos();
        }
        public FAReelProtectBandDetectorServo(FASequenceManager aSequenceManager)
            : base(aSequenceManager)
        {
            ScanPos = new FAAPlusMMCPosition();
            MoveStandbyPos = new FAPartAction();
            MoveScanPos = new FAPartAction();

            MoveStandbyPos.SetActionMethod(DoMoveStandbyPos);
            MoveScanPos.SetActionMethod(DoMoveScanPos);

            MoveStandbyPos.CreateSequence(aSequenceManager);
            MoveScanPos.CreateSequence(aSequenceManager);

            MakeMoveStandbyPos();
            MakeMoveScanPos();
        }
 public void CopyTo(FAAPlusMMCPosition position)
 {
     position.AccelTime = this.AccelTime;
     position.DeaccelTime = this.DeaccelTime;
     position.DriveSpeed = this.DriveSpeed;
     position.Position = this.Position;
     position.StartSpeed = this.StartSpeed;
 }
        private void LoadPositionDefine(XElement xml)
        {
            foreach (XElement item in xml.Elements())
            {
                double position = 0;
                uint startSpeed = 0;
                uint driveSpeed = 0;
                uint accelTime = 0;
                uint deaccelTime = 0;

                string name = item.Element("Name").Value.ToString();

                if (item.Element("Position") != null)
                    if (double.TryParse(item.Element("Position").Value.Trim(), out position) == false)
                        throw new Exception("Position Value is not double.\n" +
                            "Part Name : " + Name + ", " +
                            "Position : " + item.Element("Position").Value);

                if (item.Element("StartSpeed") != null)
                    if (uint.TryParse(item.Element("StartSpeed").Value.Trim(), out startSpeed) == false)
                        throw new Exception("StartSpeed Value is not Unsigned Integer.\n" +
                            "Part Name : " + Name + ", " +
                            "StartSpeed : " + item.Element("StartSpeed").Value);

                if (item.Element("DriveSpeed") != null)
                    if (uint.TryParse(item.Element("DriveSpeed").Value.Trim(), out driveSpeed) == false)
                        throw new Exception("DriveSpeed Value is not Unsigned Integer.\n" +
                            "Part Name : " + Name + ", " +
                            "DriveSpeed : " + item.Element("DriveSpeed").Value);

                if (item.Element("AccelTime") != null)
                    if (uint.TryParse(item.Element("AccelTime").Value.Trim(), out accelTime) == false)
                        throw new Exception("AccelTime Value is not Unsigned Integer.\n" +
                            "Part Name : " + Name + ", " +
                            "AccelTime : " + item.Element("AccelTime").Value);

                if (item.Element("DeaccelTime") != null)
                    if (uint.TryParse(item.Element("DeaccelTime").Value.Trim(), out deaccelTime) == false)
                        throw new Exception("DeaccelTime Value is not Unsigned Integer.\n" +
                            "Part Name : " + Name + ", " +
                            "DeaccelTime : " + item.Element("DeaccelTime").Value);

                FAAPlusMMCPosition positionDefine = new FAAPlusMMCPosition();
                positionDefine.Name = name;
                positionDefine.Position = position;
                positionDefine.StartSpeed = startSpeed;
                positionDefine.DriveSpeed = driveSpeed;
                positionDefine.AccelTime = accelTime;
                positionDefine.DeaccelTime = deaccelTime;
                FAReflection.SetPropertyValue(this, name, positionDefine);
            }
        }
        private void CreatePositionDefine()
        {
            PropertyInfo[] propList;
            propList = this.GetType().GetProperties();

            foreach (PropertyInfo info in propList)
            {
                if (info.PropertyType == typeof(FAAPlusMMCPosition))
                {
                    FAAPlusMMCPosition pos = new FAAPlusMMCPosition();
                    info.SetValue(this, pos, null);
                }
            }
        }
 public void MovePosition(FAAPlusMMCPosition positionDefine)
 {
     if (MotionDone && IsInPosition(positionDefine))
         return;
     else
     {
         Device.MovePos(AxisNo,
             (int)(positionDefine.Position / Scale),
             SpeedMode,
             (uint)(positionDefine.StartSpeed / Scale),
             (uint)(positionDefine.DriveSpeed / Scale),
             positionDefine.AccelTime,
             positionDefine.DeaccelTime);
     }
 }
 public bool IsInPosition(FAAPlusMMCPosition position)
 {
     if (Math.Abs(ActualPos - position.Position) <= Tolerance &&
         Math.Abs(CommandPos - position.Position) <= Tolerance)
         return true;
     else
         return false;
 }
 public void SetPickPos(FAAPlusMMCPosition position)
 {
     position.CopyTo(PickPos);
 }
        private void AddPositionConfigToListView()
        {
            PositionList = new List<FAAPlusMMCPosition>();
            PropertyInfo[] propList;
            propList = Part.GetType().GetProperties();

            foreach (PropertyInfo info in propList)
            {
                if (info.PropertyType == typeof(FAAPlusMMCPosition))
                {
                    PositionList.Add((FAAPlusMMCPosition)info.GetValue(Part, null));
                }
            }

            ListView listView = Utility.AttributeUtility.CreateListView(this, "PositionList");
            listView.Margin = new Thickness(2);
            listView.SelectionChanged +=
                delegate(object sender, SelectionChangedEventArgs e)
                {
                    if (listView.SelectedItem != null)
                    {
                        _position = (FAAPlusMMCPosition)listView.SelectedItem;
                        BindingPositionConfig(_position);
                    }
                };

            gridBase.Children.Add(listView);
            Grid.SetColumn(listView, 1);
        }
        public void Initialize()
        {
            if (Part == null) return;

            if (Unit != null && Unit != "")
            {
                labelCommandPosUnit.Content = Unit;
                labelActualPosUnit.Content = Unit;
            }

            SetBindingObject(labelORG, BindingMode.OneWay, Part, Label.IsEnabledProperty, "Origin");
            SetBindingObject(labelEZ, BindingMode.OneWay, Part, Label.IsEnabledProperty, "EncoderZ");
            SetBindingObject(labelEMG, BindingMode.OneWay, Part, Label.IsEnabledProperty, "Emergency");
            SetBindingObject(labelINP, BindingMode.OneWay, Part, Label.IsEnabledProperty, "InPosition");
            SetBindingObject(labelARM, BindingMode.OneWay, Part, Label.IsEnabledProperty, "ServoAlarm");
            SetBindingObject(labelPOSLMT, BindingMode.OneWay, Part, Label.IsEnabledProperty, "PositiveLimit");
            SetBindingObject(labelNEGLMT, BindingMode.OneWay, Part, Label.IsEnabledProperty, "NegativeLimit");
            SetBindingObject(labelRUN, BindingMode.OneWay, Part, Label.IsEnabledProperty, "RunFlag");
            SetBindingObject(labelERR, BindingMode.OneWay, Part, Label.IsEnabledProperty, "ErrorFlag");
            SetBindingObject(labelHOME, BindingMode.OneWay, Part, Label.IsEnabledProperty, "HomeFlag");
            SetBindingObject(labelSON, BindingMode.OneWay, Part, Label.IsEnabledProperty, "ServoOn");
            SetBindingObject(labelCommandPos, BindingMode.OneWay, Part, Label.ContentProperty, "CommandPos");
            SetBindingObject(labelActualPos, BindingMode.OneWay, Part, Label.ContentProperty, "ActualPos");
            SetBindingObject(textBoxJogSpeed, BindingMode.TwoWay, Part, TextBox.TextProperty, "JogMoveSpeed");

            SetBindingObject(buttonSetPos, BindingMode.OneWay, Part, Button.IsEnabledProperty, "MotionDone");

            _position = Part.TargetPosition;
            BindingPositionConfig(_position);
            AddPositionConfigToListView();

            _timer.Tick += OnTick;
            _timer.Interval = new TimeSpan(0, 0, 0, 0, 100);
            _timer.Start();
        }
 private void BindingPositionConfig(FAAPlusMMCPosition position)
 {
     SetBindingObject(textBoxPosition, BindingMode.TwoWay, position, TextBox.TextProperty, "Position");
     SetBindingObject(textBoxStartSpeed, BindingMode.TwoWay, position, TextBox.TextProperty, "StartSpeed");
     SetBindingObject(textBoxMoveSpeed, BindingMode.TwoWay, position, TextBox.TextProperty, "DriveSpeed");
     SetBindingObject(textBoxAccTime, BindingMode.TwoWay, position, TextBox.TextProperty, "AccelTime");
     SetBindingObject(textBoxDecTime, BindingMode.TwoWay, position, TextBox.TextProperty, "DeaccelTime");
 }
        public void MovePosition(FAAPlusMMCPosition positionDefine)
        {
            if (SimulationMode)
            {
                ServoOn = true;
                CommandPos = positionDefine.Position;
                ActualPos = CommandPos;
                MotionDone = true;
            }
            else
            {
                if (MotionDone && IsInPosition(positionDefine))
                    return;
                else
                {
                    positionDefine.CopyTo(TargetPosition);

                    Device.MovePos(AxisNo,
                        (int)(positionDefine.Position / Scale),
                        SpeedMode,
                        (uint)(positionDefine.StartSpeed / Scale),
                        (uint)(positionDefine.DriveSpeed / Scale),
                        positionDefine.AccelTime,
                        positionDefine.DeaccelTime);
                }
            }
        }
 private void BindingPositionConfig(FAAPlusMMCPosition position)
 {
     FAFramework.Utility.BindingUtility.SetBindingObject(textBoxPosition, BindingMode.OneWay, position, TextBox.TextProperty, "Position");
     FAFramework.Utility.BindingUtility.SetBindingObject(textBoxStartSpeed, BindingMode.OneWay, position, TextBox.TextProperty, "StartSpeed");
     FAFramework.Utility.BindingUtility.SetBindingObject(textBoxMoveSpeed, BindingMode.OneWay, position, TextBox.TextProperty, "DriveSpeed");
     FAFramework.Utility.BindingUtility.SetBindingObject(textBoxAccTime, BindingMode.OneWay, position, TextBox.TextProperty, "AccelTime");
     FAFramework.Utility.BindingUtility.SetBindingObject(textBoxDecTime, BindingMode.OneWay, position, TextBox.TextProperty, "DeaccelTime");
 }