From 81f90d1e9ab2043257bc83d95ca0e8353b199b43 Mon Sep 17 00:00:00 2001 From: erzhongxmu Date: Sat, 22 Oct 2022 17:45:13 +0800 Subject: [PATCH] PLC --- .../com/zzjee/plc/controller/WmsPlcController.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/zzjee/plc/controller/WmsPlcController.java b/src/main/java/com/zzjee/plc/controller/WmsPlcController.java index e95edde1..bff414f5 100644 --- a/src/main/java/com/zzjee/plc/controller/WmsPlcController.java +++ b/src/main/java/com/zzjee/plc/controller/WmsPlcController.java @@ -243,15 +243,26 @@ public class WmsPlcController extends BaseController { } } else if(split[0].equals("float")){ + Float runfloat = Float.parseFloat(split[2]) * stepNumrun; + System.out.println("runfloat:"+Math.abs(runfloat)); + siemensS7Net.Write(defaultAddress,runfloat); + } + else if(split[0].equals("-float")){ Float runfloat = Float.parseFloat(split[2]) * stepNumrun; System.out.println("runfloat:"+runfloat); siemensS7Net.Write(defaultAddress,runfloat); } else if(split[0].equals("int")){ + Float runfloat = Float.parseFloat(split[2]) * stepNumrun; + Float abs = Math.abs(runfloat); + int runint = abs.intValue(); + System.out.println("runint:"+runint); + siemensS7Net.Write(defaultAddress,runint); + } + else if(split[0].equals("-int")){ Float runfloat = Float.parseFloat(split[2]) * stepNumrun; int runint = runfloat.intValue(); System.out.println("runint:"+runint); - siemensS7Net.Write(defaultAddress,runint); } }