|
|
@@ -92,12 +92,17 @@ public class ModbusCenter { |
|
|
|
} |
|
|
|
try{ |
|
|
|
if(WokModbusTcpServer.get().plcIsConnect){ |
|
|
|
int i = 0; |
|
|
|
for (Res_PLCADDRESS item : ConfigName.getInstance().PlcAddress_Wok) { |
|
|
|
i++; |
|
|
|
if(item!=null){ |
|
|
|
if (item.isread == 1) { |
|
|
|
if(WokModbusTcpServer.get().plcIsConnect){ |
|
|
|
LogUtils.d("//////////time for "+i+" time="+(b-a)); |
|
|
|
Object val = wokReadPlc(1,item.name); |
|
|
|
LogUtils.d("//////////time for "+i+" time="+(b-a)); |
|
|
|
WokModbusTcpServer.get().listeningValue.put(item.name, val); |
|
|
|
LogUtils.d("//////////time for "+i+" time="+(b-a)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@@ -135,11 +140,7 @@ public class ModbusCenter { |
|
|
|
TempControl(1); |
|
|
|
ReadPLCStatus(1); |
|
|
|
} |
|
|
|
if (Wok2ModbusTcpServer.get().plcIsConnect) { |
|
|
|
WritePlc(2,"心跳位", 0, null); |
|
|
|
TempControl(2); |
|
|
|
ReadPLCStatus(2); |
|
|
|
} |
|
|
|
|
|
|
|
b = System.currentTimeMillis(); |
|
|
|
LogUtils.d("//////////time 4"+(b-a)); |
|
|
|
} catch (Exception ex) { |
|
|
@@ -156,11 +157,6 @@ public class ModbusCenter { |
|
|
|
ReadPLCStatus(2); |
|
|
|
} |
|
|
|
try{ |
|
|
|
if (WokModbusTcpServer.get().plcIsConnect) { |
|
|
|
WritePlc(1,"心跳位", 0, null); |
|
|
|
TempControl(1); |
|
|
|
ReadPLCStatus(1); |
|
|
|
} |
|
|
|
if (Wok2ModbusTcpServer.get().plcIsConnect) { |
|
|
|
WritePlc(2,"心跳位", 0, null); |
|
|
|
TempControl(2); |
|
|
|