| | |
| | | |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | import static com.example.springboot.component.InitUtil.readAndUpdateBitValues; |
| | |
| | | return instance; |
| | | } |
| | | |
| | | String jsonFilePath = PLCAutomaticParameterSettingReview2.class.getResource("/JsonFile/PlcParameter.json").getPath(); |
| | | String jsonFilePath2 = PLCAutomaticParameterSettingReview2.class.getResource("/JsonFile/PlcSign.json").getPath(); |
| | | String jsonFilePath4 = PLCAutomaticParameterSettingReview2.class.getResource("/JsonFile/PlcState.json").getPath(); |
| | | //System.out.println(jsonFilePath4); |
| | | // 调用initword方法 |
| | | PlcParameterObject plcParameterObject = initUtil.initword(jsonFilePath); |
| | | PlcParameterObject plcStateObject = initUtil.initword(jsonFilePath4); |
| | | |
| | | // 调用initbit方法 |
| | | PlcBitObject plcBitObject = initUtil.initbit(jsonFilePath2); |
| | | |
| | | @Override |
| | | public void run() { |
| | | while (this != null) { |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | String jsonFilePath = PLCAutomaticParameterSettingReview2.class.getResource("/JsonFile/PlcParameter.json").getPath(); |
| | | String jsonFilePath2 = PLCAutomaticParameterSettingReview2.class.getResource("/JsonFile/PlcSign.json").getPath(); |
| | | String jsonFilePath4 = PLCAutomaticParameterSettingReview2.class.getResource("/JsonFile/PlcState.json").getPath(); |
| | | //System.out.println(jsonFilePath4); |
| | | |
| | | // int index3 = plcParameterObject.getPlcParameter("A01A02conveyorVelocity(Max)").getAddressIndex(); |
| | | // System.out.println(index3); |
| | | // System.out.println(plcParameterObject.getPlcParameter("A01A02conveyorVelocity(Max)").getAddress(index3)); |
| | | |
| | | |
| | | // 调用initword方法 |
| | | PlcParameterObject plcParameterObject = initUtil.initword(jsonFilePath); |
| | | PlcParameterObject plcStateObject = initUtil.initword(jsonFilePath4); |
| | | // readAndUpdateBitValues(plcBitObject); |
| | | // readAndUpdateWordValues(plcParameterObject); |
| | | // readAndUpdateWordValues(plcStateObject); |
| | | |
| | | // 调用initbit方法 |
| | | PlcBitObject plcBitObject = initUtil.initbit(jsonFilePath2); |
| | | readAndUpdateBitValues(plcBitObject); |
| | | readAndUpdateWordValues(plcParameterObject); |
| | | readAndUpdateWordValues(plcStateObject); |
| | | List<String> addresses = new ArrayList<>(); |
| | | addresses.add("conveyorVelocity(AutoFAST)"); |
| | | addresses.add("A02ID"); |
| | | addresses.add("conveyorVelocity(Manual)"); |
| | | |
| | | |
| | | List<String> address = plcParameterObject.getAddressListByCodeId(addresses); |
| | | System.out.println(address); |
| | | |
| | | // int index = plcParameterObject.getPlcParameter("A01turnAngle1").getAddressIndex(); |
| | | // List<Short> arraylist = S7control.getinstance().ReadWord(plcParameterObject.getPlcParameter("A01turnAngle1").getAddress(index), 8); |
| | | |
| | | |
| | | // List<Boolean> getplcvlues = S7control.getinstance().ReadBits(plcBitObject.getPlcAddressBegin(), plcBitObject.getPlcAddressLength()); |
| | | // plcBitObject.setPlcBitList(getplcvlues); |
| | | |
| | | // int index = plcParameterObject.getPlcParameter("A01A02conveyorVelocity(Max)").getAddressIndex(); |
| | | // System.out.println(index); |
| | | // plcParameterObject.getPlcParameter("A01A02conveyorVelocity(Max)").getAddress(index); |
| | | // System.out.println(plcParameterObject.getPlcParameter("A01A02conveyorVelocity(Max)").getAddress(index)); |
| | | |
| | | // plcParameterObject.getPlcParameter("A01A02conveyorVelocity(Max)").getAddress(index); |
| | | // |
| | | // S7control.getinstance().WriteWord(plcParameterObject.getPlcParameter("conveyorVelocity(AutoFAST)").getAddress(index), (short) 100); |
| | | // List<String> addresses = new ArrayList<>(); |
| | | // addresses.add("conveyorVelocity(AutoFAST)"); |
| | | // addresses.add("A02ID"); |
| | | //System.out.println(plcParameterObject.getPlcParameterValues(addresses)); |
| | | List<String> addresses2 = new ArrayList<>(); |
| | | addresses2.add("D01.SRdec"); |
| | | addresses2.add("D01.SRinpos"); |
| | | addresses2.add("D05.SRinpos"); |
| | | |
| | | |
| | | |
| | | |
| | | System.out.println(plcBitObject.getPlcBitValues(addresses2)); |
| | | |
| | | int index2 = plcBitObject.getPlcBit("D05.SRinpos").getAddressIndex(); |
| | | System.out.println(index2); |
| | | |
| | | plcBitObject.getPlcBit("D05.SRinpos").getAddress(index2); |
| | | System.out.println(plcBitObject.getPlcBit("D05.SRinpos").getAddress(index2)); |
| | | // List<String> addresses2 = new ArrayList<>(); |
| | | // addresses2.add("D01.SRdec"); |
| | | // addresses2.add("D01.SRinpos"); |
| | | // addresses2.add("D05.SRinpos"); |
| | | // |
| | | // |
| | | // |
| | | // |
| | | // System.out.println(plcBitObject.getPlcBitValues(addresses2)); |
| | | // |
| | | // int index2 = plcBitObject.getPlcBit("D05.SRinpos").getAddressIndex(); |
| | | // System.out.println(index2); |
| | | // |
| | | // plcBitObject.getPlcBit("D05.SRinpos").getAddress(index2); |
| | | // System.out.println(plcBitObject.getPlcBit("D05.SRinpos").getAddress(index2)); |
| | | // |
| | | // |
| | | // List<String> addresses3 = new ArrayList<>(); |