///
/// 轴参数
///
public class AxisPrm : EntityBase
{
public AxisPrm() : base()
{
}
private AxisPrm(string name, AxisKey key) : base(key)
{
Name = name;
}
///
/// 普通轴构造函数
///
/// 轴名称
/// 轴对应的控制卡编号
/// 轴在这台几台上的编号,由自己定义
/// 轴在控制卡上的编号值,16轴卡就是1到16,这里用枚举值
public AxisPrm(string name, short cardNum, short code, AxisKey key) : this(name, key)
{
CardNum = cardNum;
Code = code;
}
///
/// 龙门(Master)轴的构造函数
///
public AxisPrm(string name, short cardNum, short code, short followCode, AxisKey key) : this(name, cardNum, code, key)
{
FollowAxisCode = followCode;
Type = AxisType.Master;
}
///
/// 反转(Reverse)轴的构造函数
///
public AxisPrm(string name, AxisKey key, AxisKey reverseKey) : this(name, key)
{
ReverseAxisKey = reverseKey;
Type = AxisType.Reverse;
}
///
/// TwoPos气缸轴的构造函数
public AxisPrm(string name, AxisKey key, IOName[] mov, IOName[] arrive) : this(name, key)
{
OutDo = mov;
InDi = arrive;
Type = AxisType.Cylinder_TwoPos;
}
private const string CategoryConstant = "固有参数";
private const string CategoryLM = "龙门参数";
private const string CategoryOther = "其他轴";
private const string CategoryJogMotion = "Jog运动参数";
private const string CategoryDotMotion = "点动运动参数";
private const string CategoryLimit = "限位参数";
#region 固有属性
///
/// 轴名字
///
[JsonProperty]
[ReadOnly(true)]
[Category(CategoryConstant)]
[Description("轴名字")]
[DisplayName("轴名")]
public string Name { get; set; }
///
/// 轴类型
///
[JsonProperty]
[ReadOnly(true)]
[Category(CategoryConstant)]
[Description("轴类型")]
[DisplayName("轴类型")]
public AxisType Type { get; set; } = AxisType.Common;
///
/// 编号
///
[JsonProperty]
[ReadOnly(true)]
[Category(CategoryConstant)]
[Description("轴编号")]
[DisplayName("轴编号")]
public short Code { get; set; }
///
/// 所属控制卡编号
///
[JsonProperty]
[ReadOnly(true)]
[Category(CategoryConstant)]
[Description("所属控制卡编号")]
[DisplayName("所属控制卡编号")]
public short CardNum { get; set; } = 0;
///
/// 脉冲当量
///
[JsonProperty]
[Category(CategoryConstant)]
[Description("脉冲当量")]
[DisplayName("脉冲当量")]
public double PulseEquiv { get; set; } = 1000;
[JsonProperty]
[Category(CategoryConstant)]
[DisplayName("Encoder")]
[Description("编码器转一圈脉冲数")]
public int Encoder { get; set; } = 16777216;
[JsonProperty]
[Category(CategoryConstant)]
[DisplayName("Gear")]
[Description("编码器转一圈需发脉冲数")]
public int Gear { get; set; } = 10000;
///
/// 驱动器品牌
///
[JsonProperty]
[Category(CategoryConstant)]
[Description("驱动器品牌")]
[DisplayName("驱动器品牌")]
public DriveType DriveType { get; set; } = DriveType.众为兴;
#endregion
#region 龙门相关
[JsonProperty]
[Category(CategoryLM)]
[Description("龙门学习长度/mm")]
[DisplayName("学习长度")]
[Browsable(false)]
[JsonIgnore]
public int LMLength { get; set; } = 100;
[JsonProperty]
[Category(CategoryLM)]
[Description("龙门学习方向是否为负")]
[DisplayName("学习方向")]
[Browsable(false)]
[JsonIgnore]
public bool DicIsNeg { get; set; } = false;
[Category(CategoryLM)]
[Description("龙门从轴轴号")]
[DisplayName("从轴号")]
[JsonIgnore]
[Browsable(false)]
public short FollowAxisCode { get; set; }
#endregion
#region 其他
///
/// TwoPos气缸轴独有,输出的运动指令
///
[JsonProperty]
[Browsable(false)]
public IOName[] OutDo { get; set; }
///
/// TwoPos气缸轴独有,到位信号
///
[JsonProperty]
[Browsable(false)]
public IOName[] InDi { get; set; }
///
/// Reverse轴特有,表示跟随它反转的轴号
///
[JsonProperty]
[Browsable(false)]
public AxisKey ReverseAxisKey { get; set; }
#endregion
#region 回零相关
[JsonProperty]
[Category("回零相关")]
[Description("回零模式")]
[DisplayName("回零模式")]
public AxisHomeType HomeMode { get; set; } = AxisHomeType.NegLimitIndex_1;
[JsonProperty]
[Category("回零相关")]
[Description("高速回零速度")]
[DisplayName("高速回零速度")]
public double HomeVel { get; set; } = 20;
[JsonProperty]
[Category("回零相关")]
[Description("最大高速回零速度")]
[DisplayName("最大高速回零速度")]
public double MaxHomeVel { get; set; } = 20;
[JsonProperty]
[Category("回零相关")]
[Description("低速回零速度")]
[DisplayName("低速回零速度")]
public double HomeLowVel { get; set; } = 10;
[JsonProperty]
[Category("回零相关")]
[Description("回零加速度")]
[DisplayName("回零加速度")]
public double HomeAcc { get; set; } = 100;
[JsonProperty]
[Category("回零相关")]
[Description("原点偏移 / mm")]
[DisplayName("原点偏移")]
public double HomeOffset { get; set; } = 0;
#endregion
#region Dot运动参数
[JsonProperty]
[Category(CategoryDotMotion)]
[Description("默认速度 mm/s,即定点移动")]
[DisplayName("速度")]
public double DefVel { get; set; } = 50;
[JsonProperty]
[Category(CategoryDotMotion)]
[Description("默认起步速度 mm/s,即定点移动")]
[DisplayName("起步速度")]
public double DefStartVel { get; set; } = 0;
[JsonProperty]
[Category(CategoryDotMotion)]
[Description("默认加速度 mm/s,即定点移动")]
[DisplayName("加速度")]
public double DefAcc { get; set; } = 4000;
[JsonProperty]
[Category(CategoryDotMotion)]
[Description("默认减速度 mm/s^2,即定点移动")]
[DisplayName("减速度")]
public double DefDec { get; set; } = 4000;
[JsonProperty]
[Category(CategoryDotMotion)]
[Description("默认最大速度 mm/s,即定点移动")]
[DisplayName("最大速度")]
public double MaxDefVel { get; set; } = 200;
[JsonProperty]
[Category(CategoryDotMotion)]
[Description("默认最大加速度 mm/s,即定点移动")]
[DisplayName("最大加速度")]
public double MaxDefAcc { get; set; } = 4000;
[JsonProperty]
[Category(CategoryDotMotion)]
[Description("默认最大减速度 mm/s^2,即定点移动")]
[DisplayName("最大减速度")]
public double MaxDefDec { get; set; } = 4000;
#endregion
#region Jog运动参数
[JsonProperty]
[Category(CategoryJogMotion)]
[Description("默认Jog运动速度 mm/s")]
[DisplayName("Jog速度")]
public double DefJogVel { get; set; } = 100;
[JsonProperty]
[Category(CategoryJogMotion)]
[Description("默认Jog起步速度 mm/s")]
[DisplayName("Jog起步速度")]
public double DefJogStartVel { get; set; } = 0;
[JsonProperty]
[Category(CategoryJogMotion)]
[Description("默认Jog运动加速度 mm/s^2")]
[DisplayName("Jog加速度")]
public double DefJogAcc { get; set; } = 4000;
[JsonProperty]
[Category(CategoryJogMotion)]
[Description("默认Jog运动减速度 mm/s^2")]
[DisplayName("Jog减速度")]
public double DefJogDec { get; set; } = 4000;
[JsonProperty]
[Category(CategoryJogMotion)]
[Description("默认插补坐标系[0,1]")]
[DisplayName("插补坐标系")]
public short DefCrd { get; set; } = 0;
[JsonProperty]
[Category(CategoryJogMotion)]
[Description("匀速时间 ms")]
[DisplayName("匀速时间")]
public double SmoothTime { get; set; } = 10;
[JsonProperty]
[Category(CategoryJogMotion)]
[Description("默认最大Jog运动速度 mm/s")]
[DisplayName("最大Jog速度")]
public double MaxDefJogVel { get; set; } = 100;
[JsonProperty]
[Category(CategoryJogMotion)]
[Description("默认最大Jog运动加速度 mm/s^2")]
[DisplayName("最大Jog加速度")]
public double MaxDefJogAcc { get; set; } = 4000;
[JsonProperty]
[Category(CategoryJogMotion)]
[Description("默认最大Jog运动减速度 mm/s^2")]
[DisplayName("最大Jog减速度")]
public double MaxDefJogDec { get; set; } = 4000;
#endregion
#region 限位相关
[JsonProperty]
[Category(CategoryLimit)]
[DisplayName("硬件正限位端口号")]
[Description("查询硬件正限位时的端口号")]
public int PosLimitNum { get; set; } = 0;
[JsonProperty]
[Category(CategoryLimit)]
[DisplayName("硬件负限位端口号")]
[Description("查询硬件负限位时的端口号")]
public int NegLimitNum { get; set; } = 1;
[JsonProperty]
[Category(CategoryLimit)]
[DisplayName("启用软限位")]
[Description("启用软限位,0:禁用 1:启用")]
public bool IsSoftLimit { get; set; } = true;
[JsonProperty]
[Category(CategoryLimit)]
[DisplayName("负软限位")]
[Description("负方向软限位 mm")]
public int SoftNegLimit { get; set; } = -1500;
[JsonProperty]
[Category(CategoryLimit)]
[DisplayName("正软限位")]
[Description("正方向软限位 mm")]
public int SoftPosLimit { get; set; } = 1500;
#endregion
public object Clone()
{
return MemberwiseClone();
}
}
///
/// 驱动器品牌枚举
///
public enum DriveType
{
[Browsable(false)]
NULL = 0,
汇川,
Elmo,
高创,
众为兴,
}