| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- using System;
- using System.Collections.Generic;
- namespace TeamAAS.Global.Devices
- {
- /// <summary>轴状态。</summary>
- public sealed class AxisStatus
- {
- public int Index { get; set; }
- public string Name { get; set; }
- /// <summary>当前位置(用户单位)。</summary>
- public double Position { get; set; }
- /// <summary>当前速度(用户单位/秒)。</summary>
- public double Velocity { get; set; }
- public bool IsMoving { get; set; }
- public bool IsHomed { get; set; }
- public bool IsEnabled { get; set; }
- /// <summary>正/负限位触发。</summary>
- public bool PositiveLimit { get; set; }
- public bool NegativeLimit { get; set; }
- public bool Alarm { get; set; }
- }
- /// <summary>
- /// 运动控制卡统一契约(设备内核·第5项):
- /// 覆盖点/限位/IO 的最小生产集 —— 使能、回零、绝对/相对定位、点动、停止、状态读取。
- /// 品牌适配器(雷赛/固高/IMC60G 等)实现本接口后注册进 MotionManager;调试页通过 IDeviceDebugPageFactory 拓展。
- /// </summary>
- public interface IMotionCard : IConnectableDevice
- {
- /// <summary>轴数量。</summary>
- int AxisCount { get; }
- /// <summary>使能/下使能指定轴(axis=-1 表示全部轴)。</summary>
- bool SetEnable(int axis, bool enable);
- /// <summary>回零(mode 由品牌适配器解释,如 0=原点开关回零)。</summary>
- bool Home(int axis, int mode = 0);
- /// <summary>是否回零完成。</summary>
- bool IsHomed(int axis);
- /// <summary>绝对定位。position=目标位置(用户单位),velocity=运行速度。</summary>
- bool MoveAbsolute(int axis, double position, double velocity);
- /// <summary>相对定位。</summary>
- bool MoveRelative(int axis, double distance, double velocity);
- /// <summary>点动开始(direction: 1正 -1负)。</summary>
- bool JogStart(int axis, int direction, double velocity);
- /// <summary>点动停止。</summary>
- bool JogStop(int axis);
- /// <summary>急停指定轴(axis=-1 全部)。</summary>
- bool Stop(int axis = -1);
- /// <summary>读指定轴状态(null=轴号无效)。</summary>
- AxisStatus GetAxisStatus(int axis);
- /// <summary>读全部轴状态。</summary>
- List<AxisStatus> GetAllAxisStatus();
- }
- /// <summary>
- /// IO 卡(如 GR20T-ECT-1616ETN,16进/16出)统一契约:
- /// 全部接口按“批量”设计 —— 生产上一次事务读全量/写全量,避免逐点往返。
- /// </summary>
- public interface IIOCard : IConnectableDevice
- {
- /// <summary>输入点数量。</summary>
- int InputCount { get; }
- /// <summary>输出点数量。</summary>
- int OutputCount { get; }
- /// <summary>批量读全部输入点(index=点位序号,value=是否有效)。</summary>
- bool[] ReadAllInputs();
- /// <summary>批量读全部输出点(当前输出锁存状态)。</summary>
- bool[] ReadAllOutputs();
- /// <summary>写单个输出点。</summary>
- bool WriteOutput(int index, bool value);
- /// <summary>批量写输出点(values 长度不足时按可用位写)。</summary>
- bool WriteOutputs(bool[] values);
- }
- }
|