using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Xml.Serialization; namespace Rs.Motion.Base.Config { public class AxisConfig { [XmlIgnore] public IAxis Axis { get; set; } /// /// 卡号 /// [CommonPropertyDescription("卡号")] [XmlElement] public ushort CardId { get; set; } = 0; [CommonPropertyDescription("ZTM MC")] [XmlElement] public short CardMc { get; set; } = 0; /// /// 轴号 /// [CommonPropertyDescription("轴号")] [XmlElement] public ushort AxisId { get; set; } = 0; [XmlElement] [CommonPropertyDescription("别名")] public string AxisName { get; set; } = "AxisName"; [XmlElement] [CommonPropertyDescription("卡类型 \r\n 脉冲卡 0 \r\n 总线卡 1 ")] [CopyAttribute] public ushort CardType { get; set; } = 0; [XmlElement] [CommonPropertyDescription("回零方向 \r\n0:负方向回零 \r\n1:正方向回零")] [CopyAttribute] public short HomeDir { get; set; } = 0; [XmlElement] [LeisaiPropertyDescription("回零模式 \r\n0:一次回零\r\n1:一次回零加回找\r\n2:二次回零\r\n3:原点加同向 EZ\r\n4:单独记一个 EZ\r\n5:原点加反向 EZ\r\n6:原点锁存\r\n7:原点锁存加同向 EZ\r\n8:单独记一个 EZ 锁存\r\n9:原点锁存加反向 EZ")] [ZTMPropertyDescription("回零模式 \r\n 0-无效 \r\n1-HOME,零点开关一次回零 \r\n 2-LMT,限位开关一次回零\r\n 3-Z,编码器Z相信号一次回零\r\n 4-HOME+Z,原点与编码器Z相信号联合回零\r\n5-LMT+Z,限位开关与编码器Z相信号联合回零\r\n 6-LMT+HOME,限位开关与零点开关联合回零\r\n7-LMT+HOME+Z,限位开关、零点开关与编码器Z相信号联合回零\r\n 8-原地,仅仅将轴的位置清零")] [CopyAttribute] public ushort HomeMode { get; set; } = 3; [XmlElement] [CommonPropertyDescription("原点信号有效电平 \r\n0:低有效,\r\n1:高有效")] [CopyAttribute] public ushort HomeOrgLogic { get; set; } = 0; [XmlElement] [CommonPropertyDescription("设置捕获沿:0-下降沿,1-上升沿")] [CopyAttribute] public ushort CaptureEdge { get; set; } = 0; [XmlElement] [LeisaiPropertyDescription("回零速度模式: \r\n0:低速回零 \r\n1:高速回零")] [ZTMPropertyDescription("不用此属性")] [CopyAttribute] public ushort HomeVelMode { get; set; } = 0; [XmlElement] [CommonPropertyDescription("回零速度: 单位 mm/s")] [CopyAttribute] public int HomeSpeed { get; set; } = 2; [XmlElement] [CommonPropertyDescription("回原点偏后偏移 mm")] [CopyAttribute] public double HomeOffset { get; set; } = 0.0; [XmlElement] [CommonPropertyDescription("是否启用编码器 \r\n 0禁用 \r\n 1启用")] [CopyAttribute] public ushort EnableEncoder { get; set; } = 0; [XmlElement] [DisplayName("脉冲模式")] [Description("脉冲模式")] [CopyAttribute] public ushort PulseMode { get; set; } = 1; [XmlElement] [CommonPropertyDescription("脉冲输出模式")] [CopyAttribute] public ushort PulseOutMode { get; set; } = 5; [XmlElement] [CommonPropertyDescription("脉冲输出方向")] [CopyAttribute] public short PulseOutDir { get; set; } = 0; [XmlElement] [CommonPropertyDescription("脉冲输出索引方向")] [CopyAttribute] public short PulseOutIndexDir { get; set; } = 0; [XmlElement] [CommonPropertyDescription("编码器输入口的计数方式 \r\n0:非 A/B 相(脉冲/方向) \r\n1:1×A/B \r\n2:2×A/B \r\n3:4×A/B")] [CopyAttribute] public ushort CounterInMode { get; set; } = 0; [XmlElement] [CommonPropertyDescription("启用EMG急停信号 \r\n0:禁用 \r\n1:启用")] [CopyAttribute] public ushort EnableEmg { get; set; } [XmlElement] [CommonPropertyDescription("EMG信号有效电平,\r\n0:低有效,\r\n1:高有效")] [CopyAttribute] public ushort EmgLogic { get; set; } [XmlElement] [CommonPropertyDescription("最大速度 单位:mm/s")] [CopyAttribute] public double MaxSpeed { get; set; } [XmlElement] [CommonPropertyDescription("最小速度 单位:mm/s")] [CopyAttribute] public double MinSpeed { get; set; } [XmlElement] [CommonPropertyDescription("停止速度 单位:mm/s")] [CopyAttribute] public double StopSpeed { get; set; } [XmlElement] [CommonPropertyDescription("S型曲线时间 单位:秒")] [CopyAttribute] public double STime { get; set; } = 0.02; [XmlElement] [CommonPropertyDescription("电机转一圈的脉冲数 pulse/r")] [CopyAttribute] public int PulseOneRound { get; set; } = 10000; [XmlElement] [CommonPropertyDescription("电机转一圈运动距离 mm/r")] [CopyAttribute] public double DistOneRound { get; set; } = 5; [XmlElement] [CommonPropertyDescription("正向软极限位置 mm")] [CopyAttribute] public double PelSoftwarePosition { get; set; } = 50.0; [XmlElement] [CopyAttribute] [CommonPropertyDescription("负向软极限位置 mm")] public double NelSoftwarePosition { get; set; } = -50.0; [XmlElement] [CommonPropertyDescription("是否启用软限位 0:禁止 1-允许")] [CopyAttribute] public ushort EnableSoftwareEL { get; set; } = 0; [XmlElement] [CommonPropertyDescription("软极限源 0:指令位置 1:编码器位置")] [CopyAttribute] public ushort SoftSource { get; set; } = 1; [XmlElement] [CommonPropertyDescription("限位信号的有效电平 0:正负限位低电平有效 1:正负限位高电平有效")] [CopyAttribute] public ushort ElLogic { get; set; } = 0; [XmlElement] [CommonPropertyDescription("限位开关是否启用 根据卡的相关说明配置")] [CopyAttribute] public short EnableEL { get; set; } [XmlElement] [CommonPropertyDescription("软极限制动模式 0:减速停止 1:立即停止")] [CopyAttribute] public ushort EL_stop_mode { get; set; } = 0; [XmlElement] [CommonPropertyDescription("Z信号电平 0:低电平有效 1:高电平有效")] [CopyAttribute] public ushort EzLogic { get; set; } = 0; [XmlElement] [CommonPropertyDescription("加速度时间S")] [CopyAttribute] public double AccTime { get; set; } = 0.0; [XmlElement] [CommonPropertyDescription("减速度时间S")] [CopyAttribute] public double DecTime { get; set; } = 0.0; [XmlElement] [CommonPropertyDescription("到位信号电平 0:低电平有效 1:高电平有效")] [CopyAttribute] public ushort InpLogic { get; set; } = 0; [XmlElement] [CommonPropertyDescription("到位信号启用")] [CopyAttribute] public ushort EnableInp { get; set; } = 0; [XmlElement] [CommonPropertyDescription("报警信号电平 0:低电平有效 1:高电平有效")] [CopyAttribute] public ushort AlarmLogic { get; set; } = 0; [XmlElement] [CommonPropertyDescription("报警信号启用 0:禁用 1:启用")] [CopyAttribute] public ushort EnableAlarm { get; set; } = 0; [XmlElement] [CommonPropertyDescription("允许的误差 单位:mm")] [CopyAttribute] public double Tolerance { get; set; } = 0.1; [XmlElement] [CommonPropertyDescription("高速位置对比的电平脉冲宽度 单位:us")] [CopyAttribute] public int HcmpPulseWidth { get; set; } = 50; [XmlElement] [CommonPropertyDescription("高速位置比较有效电平:\r\n0:低电平,\r\n1:高电平")] [CopyAttribute] public ushort HcmpOutLogic { get; set; } = 0; [XmlElement] [ZTMPropertyDescription("电流值 ma")] [CopyAttribute] public short Current { get; set; } = 500; [XmlElement] public ushort AbsoluteEncoder { get; set; } = 0; [XmlElement] public ushort AssistEncoder { get; set; } = 0; /// /// 是否允许JOG运动 /// public bool CanJogMove { get; set; } = false; /// /// 是否需要回原 /// public int NeedGoHome { get; set; } = 1; } public class CopyAttribute:Attribute { } }