PLCAccessorsCreater.cs 715 B

12345678910111213141516171819202122232425
  1. using WCS.Core;
  2. using PLCType = WCS.Core.PLCType;
  3. namespace WCS.Service.PLCAccessors
  4. {
  5. /// <summary>
  6. /// PLC访问器创建者
  7. /// </summary>
  8. public class PLCAccessorsCreater : IPLCAccessorCreater
  9. {
  10. /// <summary>
  11. /// 创建PLC访问器
  12. /// </summary>
  13. /// <param name="data">PLC信息</param>
  14. /// <returns></returns>
  15. /// <exception cref="Exception"> </exception>
  16. public IPLCAccessor Create(PLCInfo data)
  17. {
  18. if (data.Type == PLCType.Siemens)
  19. return new SiemensS7PLC(data.IP, data.Port, data.Rack, data.Slot);
  20. else
  21. throw new Exception("不支持此PLC");
  22. }
  23. }
  24. }