using System; using System.ComponentModel.DataAnnotations; namespace Aitex.Core.RT.Device.PmDevices { public enum FlowMode { Purge, Vent, Run, Close, } public enum ArH2Switch { Ar, H2, } /// /// 2704每通道工作模式 /// public enum TCModes { /// /// 自动模式 /// Auto, /// /// 手动模式 /// Manual } /// /// 温度控制策略。 /// public enum HeatStrategy { /// /// 功率控制 /// [Display(Name = "Power")] Power, /// /// 对于PSU:L2自动控温;L1、L3功率控制,输出功率按比例跟随L2 /// 对于SCR:L3自动控温;L1、L2功率控制,输出功率按比例跟随L2 /// [Display(Name = "Follow")] PyroFollow, /// /// L2、L3自动控温;L1功率控制,输出功率按比例跟随L1 /// [Display(Name = "Auto")] PyroAuto } /// /// 加热控制单元。 /// /// TC1即PSU;TC2即SCR /// /// public enum TCUnits { PSU, SCR, TC1, // PSU TC2 // SCR } public class DicMode { /// /// 检查指定名称的设备是否为PSU。 /// /// 设备名称 /// public static bool IsPSU(string name) { return name == TCUnits.PSU.ToString() || name == TCUnits.TC1.ToString(); } /// /// 检查类型为的设备是否为PSU。 /// /// 设备类型 /// public static bool IsPSU(TCUnits tc) { return tc is TCUnits.PSU or TCUnits.TC1; } /// /// 检查指定名称的设备是否为SCR。 /// /// 设备名称 /// public static bool IsSCR(string name) { return name == TCUnits.SCR.ToString() || name == TCUnits.TC2.ToString(); } /// /// 检查类型为的设备是否为SCR。 /// /// 设备类型 /// public static bool IsSCR(TCUnits tc) { return tc is TCUnits.SCR or TCUnits.TC2; } /// /// 将指定的数字转换为枚举。 /// /// /// public static TCModes ConvertToTcModes(int mode) { if (Enum.IsDefined(typeof(TCModes), mode)) return (TCModes)mode; return TCModes.Manual; } /// /// 将指定的数字转换为枚举。 /// /// /// public static HeatStrategy ConvertToHeatStrategy(int mode) { var strategy = HeatStrategy.Power; if (Enum.IsDefined(typeof(HeatStrategy), mode)) strategy = (HeatStrategy)mode; return strategy; } } }