using Aitex.Core.RT.Device; using Aitex.Core.Util; using MECF.Framework.Common.Equipment; using PunkHPX8_RT.Devices.AXIS; using PunkHPX8_RT.Devices.SRD; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace PunkHPX8_RT.Devices.VpwCell { public class VpwCellDeviceTimer : BaseDevice, IDevice { #region 常量 private const string VPW = "Vpw"; #endregion #region 内部变量 private PeriodicJob _periodicJob; private JetAxisBase _vpw1RotationAxis; private JetAxisBase _vpw2RotationAxis; #endregion /// /// 构造函数 /// public VpwCellDeviceTimer() : base(VPW, VPW, VPW, VPW) { _periodicJob = new PeriodicJob(20, OnTimer, $"{VPW}.OnTimer", false); } /// /// 初始化 /// /// public bool Initialize() { _vpw1RotationAxis = DEVICE.GetDevice($"{ModuleName.VpwCell1}.Rotation"); _vpw1RotationAxis = DEVICE.GetDevice($"{ModuleName.VpwCell2}.Rotation"); _periodicJob.Start(); return true; } public void Monitor() { } public void Reset() { } public void Terminate() { _periodicJob.Stop(); } /// /// 定时器执行 /// /// private bool OnTimer() { if (_vpw1RotationAxis != null) { _vpw1RotationAxis.OnTimer(); } if (_vpw2RotationAxis != null) { _vpw2RotationAxis.OnTimer(); } return true; } } }