DevicePlcS7.cs 664 B

1234567891011121314151617181920212223242526272829303132
  1. using S7.Net;
  2. namespace IMCS.CCS.DeviceProtocol
  3. {
  4. public class DevicePlcS7
  5. {
  6. public static Plc S7(string ip,string type)
  7. {
  8. Plc s7Plc = new Plc(CpuType.S71500, ip, 0, 1);
  9. if (type == "S7_1200")
  10. {
  11. s7Plc = new Plc(CpuType.S71200, ip, 0, 1);
  12. }
  13. else if (type == "S7_400")
  14. {
  15. s7Plc = new Plc(CpuType.S7400, ip, 0, 1);
  16. }
  17. else if (type == "S7_300")
  18. {
  19. s7Plc = new Plc(CpuType.S7300, ip, 0, 1);
  20. }
  21. return s7Plc;
  22. }
  23. }
  24. }