| | |
| | | public readonly string PlcIP; |
| | | private SiemensClient _client; |
| | | private WcsPlc _modPlc; |
| | | private Task<WcsPlc> modPlc; |
| | | private readonly object OLock = new object(); |
| | | public PLCUtil(WcsPlc modPlc) |
| | | { |
| | |
| | | _client = new SiemensClient((SiemensVersion)modPlc.PLCType, modPlc.IP, modPlc.Port); |
| | | _client.Open(); |
| | | } |
| | | |
| | | public bool Connected |
| | | { |
| | | get { return _client.Connected; } |
| | |
| | | address = DbNumber + "." + Pos; |
| | | else |
| | | address = DbNumber + Pos; |
| | | return this.SetPlcDBValue(PosType, address, Pos, Value); |
| | | return this.SetPlcDBValue(PosType, address, Value); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 写入PLC值 |
| | | /// </summary> |
| | | //public IoTClient.Result SetPlcDBValue(PLCDataTypeEnum PosType, string DbNumber, string Pos, byte Value) |
| | | //{ |
| | | // string address; |
| | | // if (DbNumber.StartsWith("DB")) |
| | | // address = DbNumber + "." + Pos; |
| | | // else |
| | | // address = DbNumber + Pos; |
| | | // return this.SetPlcDBValue(PosType, address, Value); |
| | | //} |
| | | /// <summary> |
| | | /// 写入PLC值 |
| | | /// </summary> |