using Newtonsoft.Json; using Prism.Mvvm; using SKMC.Api.Motion.Model; using System; namespace SKMC.Api.Recipe.Model { /// /// 点位单轴位置模型 /// [JsonObject(MemberSerialization.OptIn)] public class RecipePointPosition : BindableBase, ICloneable { private short _axisNo; /// /// 电机序号 /// [JsonProperty] public short AxisNo { get { return _axisNo; } set { _axisNo = value; RaisePropertyChanged(); } } /// /// 电机对象 /// public MotionAxis MotionAxis { get; set; } private double _position; /// /// 位置值(通常为绝对值) /// [JsonProperty] public double Position { get { return _position; } set { _position = Math.Round(value, 3); RaisePropertyChanged(); } } private double _offset; /// /// 偏移量 /// [JsonProperty] public double Offset { get { return _offset; } set { _offset = Math.Round(value, 3); RaisePropertyChanged(); } } private double _fixsetVal; /// /// 补偿值(只生效一次) /// public double FixsetVal { get { return _fixsetVal; } set { _fixsetVal = value; } } public double PosVal { get => _position + _offset; } public double PosValFixset { get => PosVal + _fixsetVal; } /// /// 单轴速度码, 可以从点位的速度码继承 /// public string SpeedCode { get; set; } public object Clone() { var model = new RecipePointPosition { AxisNo = this.AxisNo, MotionAxis = this.MotionAxis, Position = this.Position, Offset = this.Offset, SpeedCode = this.SpeedCode }; return model; } } }