HSZ_HeSongZhen 2 months ago
parent
commit
0d85ad6469
  1. 24
      src/main/java/com/iflytop/sgs/common/enums/DevicePartId.java
  2. 31
      src/main/java/com/iflytop/sgs/common/enums/SensorStateCode.java
  3. 58
      src/main/java/com/iflytop/sgs/common/service/GDDeviceStatusInterface.java
  4. 20
      src/main/java/com/iflytop/sgs/hardware/service/GDDeviceStatusService.java
  5. 30
      src/main/java/com/iflytop/sgs/hardware/type/IO/InputIOMId.java

24
src/main/java/com/iflytop/sgs/common/enums/DevicePartId.java

@ -0,0 +1,24 @@
package com.iflytop.sgs.common.enums;
import lombok.Getter;
@Getter
public enum DevicePartId {
DoorM("门电机"),
LiquidM("加液电机"),
ZM("Z轴电机"),
LiquidPumpM("加液泵"),
HEATER_ROD1_ID("加热棒1"),
HEATER_ROD2_ID("加热棒2"),
HEATER_ROD3_ID("加热棒3"),
HEATER_ROD4_ID("加热棒4"),
;
private final String description;
DevicePartId(String description){
this.description = description;
}
}

31
src/main/java/com/iflytop/sgs/common/enums/SensorStateCode.java

@ -0,0 +1,31 @@
package com.iflytop.sgs.common.enums;
import lombok.Getter;
/**
* 系统配置累
*
*/
@Getter
public enum SensorStateCode {
E_STOP("急停"),
HEATER_TRAY_1_EXIST("加热位1托盘存在状态"),
HEATER_TRAY_2_EXIST("加热位2托盘存在状态"),
HEATER_TRAY_3_EXIST("加热位3托盘存在状态"),
HEATER_TRAY_4_EXIST("加热位4托盘存在状态"),
WASTE_EXIST("废液桶是否存在"),
LIQUID_TRAY_EXIST("加液区托盘是否存在"),
THIN_LOW_LEVEL("稀硝酸低液位"),
THICK_LOW_LEVEL("浓硝酸低液位"),
WATER_LOW_LEVEL("水低液位"),
WASTE_HIGH_LEVEL("废液高液位");
private String description;
SensorStateCode(String description) {
this.description = description;
}
}

58
src/main/java/com/iflytop/sgs/common/service/GDDeviceStatusInterface.java

@ -0,0 +1,58 @@
package com.iflytop.sgs.common.service;
import com.iflytop.sgs.hardware.exception.HardwareException;
import com.iflytop.sgs.hardware.type.IO.InputIOMId;
import com.iflytop.sgs.hardware.type.Servo.LeisaiServoMId;
import com.iflytop.sgs.hardware.type.StepMotor.StepMotorMId;
import com.iflytop.sgs.hardware.type.driver.HeaterRodSlavedId;
public interface GDDeviceStatusInterface {
/**
* 获取步进电机的原点状态
* @param stepMotorMId
* @return true 在原点 false 不在原点
*/
Boolean stepMotorIsOrigin(StepMotorMId stepMotorMId) throws HardwareException;
/**
* 获取XY 伺服的原点状态
* @param mid
* @return
* @throws HardwareException
*/
Boolean getXYServoIsOrigin(LeisaiServoMId mid) throws HardwareException;
/**
* 获取 传感器信号
* @param inputIOMId
* @return
* @throws HardwareException
*/
Boolean getInputState(String inputIOMId) throws HardwareException;
/**
* 获取加热棒温度
* @param heaterRodSlavedId
* @return
* @throws Exception
*/
Double getHeaterRodTemperature(String heaterRodSlavedId) throws Exception;
/**
* 获取电机位置
* @param stepMotorMId
* @return
* @throws HardwareException
*/
Double getStepMotorPostion(String stepMotorMId) throws HardwareException;
/**
* 获取伺服类电机位置
* @param mid
* @return
* @throws HardwareException
*/
Double getXYServoPosition(LeisaiServoMId mid) throws HardwareException;
}

20
src/main/java/com/iflytop/sgs/hardware/service/GDDeviceStatusService.java

@ -1,6 +1,7 @@
package com.iflytop.sgs.hardware.service;
import com.iflytop.sgs.app.model.bo.Point3D;
import com.iflytop.sgs.common.service.GDDeviceStatusInterface;
import com.iflytop.sgs.hardware.drivers.DIDriver.InputDetectDriver;
import com.iflytop.sgs.hardware.drivers.HeaterRodDriver;
import com.iflytop.sgs.hardware.drivers.LeisaiServoDriver;
@ -19,7 +20,7 @@ import org.springframework.stereotype.Component;
@Slf4j
@Component
@RequiredArgsConstructor
public class GDDeviceStatusService {
public class GDDeviceStatusService implements GDDeviceStatusInterface {
private final InputDetectDriver inputDetectDriver;
private final HeaterRodDriver heaterRodDriver;
private final StepMotorCtrlDriver stepMotorCtrlDriver;
@ -47,32 +48,35 @@ public class GDDeviceStatusService {
}
/**
* 获取 拍子 试管架拍子 急停 到位信号
* @param inputIOMId
* 获取传感器信号
* @param inputIOMIdStr
* @return
* @throws HardwareException
*/
public Boolean getInputState(InputIOMId inputIOMId) throws HardwareException {
public Boolean getInputState(String inputIOMIdStr) throws HardwareException {
InputIOMId inputIOMId = InputIOMId.valueOf(inputIOMIdStr);
return inputDetectDriver.getIOState(inputIOMId);
}
/**
* 获取加热棒温度
* @param heaterRodSlavedId
* @param heaterRodSlavedIdStr
* @return
* @throws Exception
*/
public Double getHeaterRodTemperature(HeaterRodSlavedId heaterRodSlavedId) throws Exception {
public Double getHeaterRodTemperature(String heaterRodSlavedIdStr) throws Exception {
HeaterRodSlavedId heaterRodSlavedId=HeaterRodSlavedId.valueOf(heaterRodSlavedIdStr);
return heaterRodDriver.getTemperature(heaterRodSlavedId);
}
/**
* 获取电机位置
* @param stepMotorMId
* @param stepMotorMIdStr
* @return
* @throws HardwareException
*/
public Double getStepMotorPostion(StepMotorMId stepMotorMId) throws HardwareException {
public Double getStepMotorPostion(String stepMotorMIdStr) throws HardwareException {
StepMotorMId stepMotorMId=StepMotorMId.valueOf(stepMotorMIdStr);
Integer motorPosition = stepMotorCtrlDriver.stepMotorReadPos(stepMotorMId);
Double realPosition = StepMotorConverter.toUserPosition(motorPosition);
return realPosition;

30
src/main/java/com/iflytop/sgs/hardware/type/IO/InputIOMId.java

@ -4,28 +4,28 @@ import com.iflytop.sgs.hardware.type.MId;
public enum InputIOMId {
E_STOP("E_STOP [ 急停 ]", MId.IO1_IO, 0, false),
Heater_CAP1_EXIST("Heater_CAP1_EXIST [ 加热模块拍子1到位 ]", MId.IO1_IO, 1, false),
Heater_CAP2_EXIST("Heater_CAP2_EXIST [ 加热模块拍子2到位 ]", MId.IO1_IO, 2, false),
Heater_CAP3_EXIST("Heater_CAP3_EXIST [ 加热模块拍子3到位 ]", MId.IO1_IO, 3, false),
Heater_CAP4_EXIST("Heater_CAP4_EXIST [ 加热模块拍子4到位 ]", MId.IO1_IO, 4, false),
WASTE_LIQUID_BARREL_EXIST("WASTE_LIQUID_BARREL_EXIST [ 废液桶存在 ]", MId.IO1_IO, 5, false),
LIQUID_TRAY_EXIST("CLAW_TRAY_EXIST [ 加液位托盘存在 ]", MId.IO1_IO, 6, false),
DILUTE_NITRIC_ACID_LOW_LEVEL("DILUTE_NITRIC_ACID_LOW_LEVEL [ 稀硝酸低液位检测 ]", MId.IO1_IO, 7, false),
CONCENTRATED_NITRIC_ACID_LOW_LEVEL("CONCENTRATED_NITRIC_ACID_LOW_LEVEL [ 浓硝酸低液位检测 ]", MId.IO1_IO, 8, false),
DISTILLED_WATER_LOW_LEVEL("DISTILLED_WATER_LOW_LEVEL [ 蒸馏水低液位检测 ]", MId.IO1_IO, 9, false),
WASTE_LIQUID_BARREL_HIGH_LEVEL("WASTE_LIQUID_BARREL_LOW_LEVEL [ 废液桶高液位检测 ]", MId.IO1_IO, 10, false),
HEATER_TRAY_1_EXIST("HEATER_TRAY_1_EXIST [ 加热模块拍子1到位 ]", MId.IO1_IO, 1, false),
HEATER_TRAY_2_EXIST("HEATER_TRAY_2_EXIST [ 加热模块拍子2到位 ]", MId.IO1_IO, 2, false),
HEATER_TRAY_3_EXIST("HEATER_TRAY_3_EXIST [ 加热模块拍子3到位 ]", MId.IO1_IO, 3, false),
HEATER_TRAY_4_EXIST("HEATER_TRAY_4_EXIST [ 加热模块拍子4到位 ]", MId.IO1_IO, 4, false),
WASTE_EXIST("WASTE_EXIST [ 废液桶存在 ]", MId.IO1_IO, 5, false),
LIQUID_TRAY_EXIST("LIQUID_TRAY_EXIST [ 加液位托盘存在 ]", MId.IO1_IO, 6, false),
THIN_LOW_LEVEL("THIN_LOW_LEVEL [ 稀硝酸低液位检测 ]", MId.IO1_IO, 7, false),
THICK_LOW_LEVEL("THICK_LOW_LEVEL [ 浓硝酸低液位检测 ]", MId.IO1_IO, 8, false),
WATER_LOW_LEVEL("WATER_LOW_LEVEL [ 蒸馏水低液位检测 ]", MId.IO1_IO, 9, false),
WASTE_HIGH_LEVEL("WASTE_HIGH_LEVEL [ 废液桶高液位检测 ]", MId.IO1_IO, 10, false),
;
final public String description;
final public MId mid;
final public int ioIndex;
final public boolean mirror;
final public MId mid;
final public int ioIndex;
final public boolean mirror;
InputIOMId(String description, MId mid, int ioIndex, boolean mirror) {
this.description = description;
this.mid = mid;
this.mid = mid;
this.ioIndex = ioIndex;
this.mirror = mirror;
this.mirror = mirror;
}
}
Loading…
Cancel
Save