IO.cs 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. using System;
  2. using System.Collections.Generic;
  3. using Aitex.Core.RT.IOCore;
  4. using Aitex.Core.Util;
  5. namespace Aitex.Core.RT.IOCore
  6. {
  7. public class Index<T> where T : class
  8. {
  9. public T this[string name]
  10. {
  11. get
  12. {
  13. return Singleton<IOGroupManager>.Instance.GetIO<T>(name);
  14. }
  15. }
  16. }
  17. public static class IO
  18. {
  19. public static Index<DIAccessor> DI = new Index<DIAccessor>();
  20. public static Index<DOAccessor> DO = new Index<DOAccessor>();
  21. public static Index<AIAccessor> AI = new Index<AIAccessor>();
  22. public static Index<AOAccessor> AO = new Index<AOAccessor>();
  23. public static bool CanSetDO(string doName, bool onOff, out string reason)
  24. {
  25. return Singleton<IOGroupManager>.Instance.CanSetDo(doName, onOff, out reason);
  26. }
  27. public static List<Tuple<int, int, string>> GetIONameList(string group, IOType ioType)
  28. {
  29. return Singleton<IOGroupManager>.Instance.GetIONameList(group, ioType);
  30. }
  31. /// <summary>
  32. /// IO表中的编号,数组偏移,IO名
  33. /// </summary>
  34. /// <param name="ioType"></param>
  35. /// <returns></returns>
  36. public static List<Tuple<int, int, string>> GetIONameList(IOType ioType)
  37. {
  38. return Singleton<IOGroupManager>.Instance.GetIONameList("local", ioType);
  39. }
  40. public static bool ReloadInterlockConfig(out string reason)
  41. {
  42. reason = "not implemented";
  43. return true;
  44. //return Singleton<IOGroupManager>.Instance.InitializeInterlock(out reason);
  45. }
  46. //public static void SetScale(string ioName, double logicalMin, double logicalMax, double physicalMin, double physicalMax)
  47. //{
  48. // Singleton<IOGroupManager>.Instance.SetScale(ioName, logicalMin, logicalMax, physicalMin, physicalMax);
  49. //}
  50. //public static Dictionary<string, IOScale> GetScale()
  51. //{
  52. // return Singleton<IOGroupManager>.Instance.GetScale();
  53. //}
  54. }
  55. }