示例#1
0
        /// <summary>
        /// 轴物理位置转换为脉冲数
        /// </summary>
        /// <param name="axis">轴</param>
        /// <param name="position">轴的物理位置</param>
        /// <returns></returns>
        public static int TransferPhysicalPositionToPulse(ProCommon.Communal.Axis axis, float position)
        {
            int pls = 0;

            if (axis != null)
            {
                axis.PulseUnit = axis.PulsePerRound / axis.HelicalPitch;
                pls            = Convert.ToInt32(axis.PulseUnit * position);
            }
            return(pls);
        }
示例#2
0
 public ProCommon.Communal.Axis Clone()
 {
     ProCommon.Communal.Axis destAxis = new ProCommon.Communal.Axis(this.ID);
     destAxis.Accel = this.Accel;
     destAxis.AlarmClearOutBitNumber = this.AlarmClearOutBitNumber;
     destAxis.AlarmClearOutLevel     = this.AlarmClearOutLevel;
     destAxis.AlarmInBitNumber       = this.AlarmInBitNumber;
     destAxis.AlarmInLevel           = this.AlarmInLevel;
     destAxis.DatumCreepSpeed        = this.DatumCreepSpeed;
     destAxis.CurrentPos             = this.CurrentPos;
     destAxis.DatumDirection         = this.DatumDirection;
     destAxis.DatumInBitNumber       = this.DatumInBitNumber;
     destAxis.DatumInLevel           = this.DatumInLevel;
     destAxis.DatumMode              = this.DatumMode;
     destAxis.Decel                  = this.Decel;
     destAxis.FirstPos               = this.FirstPos;
     destAxis.HardForwarInBitNumber  = this.HardForwarInBitNumber;
     destAxis.HardForwardInLevel     = this.HardForwardInLevel;
     destAxis.HardReverseInBitNumber = this.HardReverseInBitNumber;
     destAxis.HardReverseInLevel     = this.HardReverseInLevel;
     destAxis.SoftForwardLimit       = this.SoftForwardLimit;
     destAxis.SoftReverseLimit       = this.SoftReverseLimit;
     destAxis.StartSpeed             = this.StartSpeed;
     destAxis.Name                = this.Name;
     destAxis.Number              = this.Number;
     destAxis.PulseOutMode        = this.PulseOutMode;
     destAxis.PulseUnit           = this.PulseUnit;
     destAxis.SecondPos           = this.SecondPos;
     destAxis.ServoOnLevel        = this.ServoOnLevel;
     destAxis.ServoOnOutBitNumber = this.ServoOnOutBitNumber;
     destAxis.RunSpeed            = this.RunSpeed;
     destAxis.Sramp               = this.Sramp;
     destAxis.StatusALM           = this.StatusALM;
     destAxis.StatusOfHardDatum   = this.StatusOfHardDatum;
     destAxis.StatusOfHardForward = this.StatusOfHardForward;
     destAxis.StatusOfHardReverse = this.StatusOfHardReverse;
     destAxis.ThirdPos            = this.ThirdPos;
     destAxis.AxisType            = this.AxisType;
     destAxis.HelicalPitch        = this.HelicalPitch;
     destAxis.PulsePerRound       = this.PulsePerRound;
     destAxis.DatumSpeed          = this.DatumSpeed;
     destAxis.DatumOffset         = this.DatumOffset;
     destAxis.AxisLimitMode       = this.AxisLimitMode;
     return(destAxis);
 }
示例#3
0
        /// <summary>
        /// 创建硬件配置时的板卡轴配置
        /// [需要根据项目情况重定义]
        /// </summary>
        /// <param name="axesList"></param>
        /// <returns></returns>
        private bool CreateAxesInstance(ref ProCommon.Communal.AxisList axesList)
        {
            bool rt = false;

            if (axesList != null)
            {
                axesList.Clear();
                int tmpServoOnPort = 0, tmpALMIn = 0, tmpDatumIn = 0, tmpHFwdIn = 0, tmpHRevIn = 0, tmpALMCLROut = 0;
                ProCommon.Communal.Axis axis = null;
                for (int i = 0; i < 3; i++)
                {
                    axis              = new ProCommon.Communal.Axis("Axis_" + i.ToString("00"));
                    axis.AxisType     = 1;
                    axis.PulseOutMode = 0;
                    axis.ServoOnLevel = ProCommon.Communal.ElectricalLevel.Low;
                    axis.PulseUnit    = 100;
                    switch (i)
                    {
                    case 0:
                    {
                        axis.Name          = "X";
                        tmpServoOnPort     = 16;
                        tmpALMIn           = 40;
                        tmpDatumIn         = 16;
                        tmpHFwdIn          = 20;
                        tmpHRevIn          = 21;
                        tmpALMCLROut       = 17;
                        axis.HelicalPitch  = 10.0f;
                        axis.PulsePerRound = 4000;
                        axis.PulseUnit     = 400;
                    }
                    break;

                    case 1:
                    {
                        axis.Name          = "Y";
                        tmpServoOnPort     = 18;
                        tmpALMIn           = 41;
                        tmpDatumIn         = 17;
                        tmpHFwdIn          = 22;
                        tmpHRevIn          = 23;
                        tmpALMCLROut       = 19;
                        axis.HelicalPitch  = 20.0f;
                        axis.PulsePerRound = 4000;
                        axis.PulseUnit     = 200;
                    }
                    break;

                    case 2:
                    {
                        axis.Name          = "R";
                        tmpServoOnPort     = 20;
                        tmpALMIn           = 42;
                        tmpDatumIn         = 18;
                        tmpHFwdIn          = 24;
                        tmpHRevIn          = 25;
                        tmpALMCLROut       = 21;
                        axis.HelicalPitch  = 360.0f;
                        axis.PulsePerRound = 4000;
                        axis.PulseUnit     = 11.11f;
                    }
                    break;

                    case 3:
                    {
                        axis.Name      = "U";
                        tmpServoOnPort = 22;
                        tmpALMIn       = 43;
                        tmpDatumIn     = 19;
                        tmpHFwdIn      = 26;
                        tmpHRevIn      = 27;
                        tmpALMCLROut   = 23;
                    }
                    break;

                    case 4:
                    {
                        tmpServoOnPort = 24;
                        tmpALMIn       = 44;
                        tmpDatumIn     = 28;
                        tmpHFwdIn      = 32;
                        tmpHRevIn      = 33;
                        tmpALMCLROut   = 25;
                    }
                    break;

                    case 5:
                    {
                        tmpServoOnPort = 26;
                        tmpALMIn       = 45;
                        tmpDatumIn     = 29;
                        tmpHFwdIn      = 34;
                        tmpHRevIn      = 35;
                        tmpALMCLROut   = 27;
                    }
                    break;

                    case 6:
                    {
                        tmpServoOnPort = 28;
                        tmpALMIn       = 46;
                        tmpDatumIn     = 30;
                        tmpHFwdIn      = 36;
                        tmpHRevIn      = 37;
                        tmpALMCLROut   = 29;
                    }
                    break;

                    case 7:
                    {
                        tmpServoOnPort = 30;
                        tmpALMIn       = 47;
                        tmpDatumIn     = 31;
                        tmpHFwdIn      = 38;
                        tmpHRevIn      = 39;
                        tmpALMCLROut   = 31;
                    }
                    break;
                    }

                    //通用输入或输出口做专用信号
                    axis.ServoOnOutBitNumber    = tmpServoOnPort;
                    axis.AlarmInBitNumber       = tmpALMIn;
                    axis.AlarmInLevel           = ProCommon.Communal.ElectricalLevel.High;
                    axis.AlarmClearOutBitNumber = tmpALMCLROut;
                    axis.AlarmClearOutLevel     = ProCommon.Communal.ElectricalLevel.Low;
                    axis.StatusALM              = false;
                    axis.DatumInBitNumber       = tmpDatumIn;
                    axis.DatumInLevel           = ProCommon.Communal.ElectricalLevel.Low;
                    axis.StatusOfHardDatum      = false;
                    axis.HardForwarInBitNumber  = tmpHFwdIn;
                    axis.HardForwardInLevel     = ProCommon.Communal.ElectricalLevel.Low;
                    axis.StatusOfHardForward    = false;
                    axis.HardReverseInBitNumber = tmpHRevIn;
                    axis.HardReverseInLevel     = ProCommon.Communal.ElectricalLevel.Low;
                    axis.StatusOfHardReverse    = false;
                    axis.DatumDirection         = "负向";
                    axis.DatumMode              = 14;

                    axis.StartSpeed      = 50.0f;
                    axis.RunSpeed        = 500.0f;
                    axis.Accel           = 1000.0f;
                    axis.Decel           = 1000.0f;
                    axis.DatumCreepSpeed = 20.0f;
                    axis.DatumSpeed      = 100.0f;
                    axis.EndSpeed        = 200.0f;

                    axis.SoftReverseLimit = 0.0f;
                    axis.SoftForwardLimit = 200.0f;

                    axis.CurrentPos = 0.0f;
                    axis.FirstPos   = 10.0f;
                    axis.SecondPos  = 50.0f;
                    axis.ThirdPos   = 80.0f;

                    axesList.Add(axis);
                }

                rt = true;
            }
            return(rt);
        }