双晟命令入参调整
This commit is contained in:
parent
47fd97f6a9
commit
db67195702
|
@ -166,11 +166,11 @@ public class ScssPersistenceHandler extends AbstractPersistenceHandler {
|
|||
ScssPersistenceHandler.this.setValue(ps, newRow, 43, "inputPressureCompensationValueSetting", Types.INTEGER);
|
||||
ScssPersistenceHandler.this.setValue(ps, newRow, 44, "flowCompensationPolarityFlag", Types.INTEGER);
|
||||
ScssPersistenceHandler.this.setValue(ps, newRow, 45, "flowCompensationValueSetting", Types.INTEGER);
|
||||
ScssPersistenceHandler.this.setValue(ps, newRow, 46, "wellOpenTimeTimestamp", Types.INTEGER);
|
||||
ScssPersistenceHandler.this.setValue(ps, newRow, 46, "wellOpenTimeTimestamp", Types.VARCHAR);
|
||||
ScssPersistenceHandler.this.setValue(ps, newRow, 47, "wellOpenPressureValue", Types.DECIMAL);
|
||||
ScssPersistenceHandler.this.setValue(ps, newRow, 48, "wellOpenOilPressureValue", Types.DECIMAL);
|
||||
ScssPersistenceHandler.this.setValue(ps, newRow, 49, "wellOpenLoadFactorPresets", Types.DECIMAL);
|
||||
ScssPersistenceHandler.this.setValue(ps, newRow, 50, "wellCloseTimeTimestamp", Types.INTEGER);
|
||||
ScssPersistenceHandler.this.setValue(ps, newRow, 50, "wellCloseTimeTimestamp", Types.VARCHAR);
|
||||
ScssPersistenceHandler.this.setValue(ps, newRow, 51, "wellClosePressureValue", Types.DECIMAL);
|
||||
ScssPersistenceHandler.this.setValue(ps, newRow, 52, "wellCloseOilPressureValue", Types.DECIMAL);
|
||||
ScssPersistenceHandler.this.setValue(ps, newRow, 53, "wellCloseFlowValue", Types.INTEGER);
|
||||
|
|
|
@ -21,6 +21,7 @@ import org.apache.commons.lang3.StringUtils;
|
|||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.security.InvalidParameterException;
|
||||
import java.util.Collection;
|
||||
import java.util.Objects;
|
||||
|
@ -96,6 +97,9 @@ public abstract class Command implements Serializable {
|
|||
|
||||
/* 点表类型:ETC end */
|
||||
|
||||
public static final BigDecimal ONE_HUNDRED = BigDecimal.valueOf(100);
|
||||
public static final BigDecimal ONE_THOUSAND = BigDecimal.valueOf(1000);
|
||||
|
||||
@NotBlank(message = "指令编码不能为空")
|
||||
private String code;
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ import org.apache.commons.lang3.math.NumberUtils;
|
|||
import java.security.InvalidParameterException;
|
||||
import java.time.LocalTime;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:scwsl@foxmail.com">王仕龙</a>
|
||||
|
@ -80,4 +81,33 @@ public interface Timing {
|
|||
StringUtils.leftPad(Integer.toHexString(minutes), 4, "0") +
|
||||
StringUtils.leftPad(Integer.toHexString(seconds), 4, "0");
|
||||
}
|
||||
|
||||
/**
|
||||
* 支持:[0-999]:[0-59]:[0-59]
|
||||
*
|
||||
* @param stringTime 时间
|
||||
* @return 返回秒数
|
||||
*/
|
||||
default long toSeconds(String stringTime) {
|
||||
String[] values = StringUtils.split(stringTime, ":");
|
||||
int hours = 0, minutes = 0, seconds = 0;
|
||||
switch (values.length) {
|
||||
case 1 -> {
|
||||
seconds = NumberUtils.createInteger(values[0]);
|
||||
}
|
||||
case 2 -> {
|
||||
minutes = NumberUtils.createInteger(values[0]);
|
||||
seconds = NumberUtils.createInteger(values[1]);
|
||||
}
|
||||
case 3 -> {
|
||||
hours = NumberUtils.createInteger(values[0]);
|
||||
minutes = NumberUtils.createInteger(values[1]);
|
||||
seconds = NumberUtils.createInteger(values[2]);
|
||||
}
|
||||
default -> {
|
||||
throw new RuntimeException("格式不合法");
|
||||
}
|
||||
}
|
||||
return TimeUnit.HOURS.toSeconds(hours) + TimeUnit.MINUTES.toSeconds(minutes) + seconds;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,12 +2,14 @@ package com.isu.gaswellwatch.vo.command.scss;
|
|||
|
||||
import com.isu.gaswellwatch.dto.modbus.ModbusCommandDto;
|
||||
import com.isu.gaswellwatch.vo.command.Command;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -32,67 +34,83 @@ public class ControlMode extends Command {
|
|||
/**
|
||||
* 套压最小值
|
||||
*/
|
||||
private int minPressure;
|
||||
@NotNull(message = "套压最小值不能为空")
|
||||
private BigDecimal minPressure;
|
||||
/**
|
||||
* 套压最大值
|
||||
*/
|
||||
private int maxPressure;
|
||||
@NotNull(message = "套压最大值不能为空")
|
||||
private BigDecimal maxPressure;
|
||||
/**
|
||||
* 套压最小电压
|
||||
*/
|
||||
private int pressureMinVoltage;
|
||||
@NotNull(message = "套压最小电压不能为空")
|
||||
private BigDecimal pressureMinVoltage;
|
||||
/**
|
||||
* 套压最大电压
|
||||
*/
|
||||
private int pressureMaxVoltage;
|
||||
@NotNull(message = "套压最大电压不能为空")
|
||||
private BigDecimal pressureMaxVoltage;
|
||||
/**
|
||||
* 油压最小值
|
||||
*/
|
||||
private int oilMin;
|
||||
@NotNull(message = "油压最小值不能为空")
|
||||
private BigDecimal oilMin;
|
||||
/**
|
||||
* 油压最大值
|
||||
*/
|
||||
private int oliMax;
|
||||
@NotNull(message = "油压最大值不能为空")
|
||||
private BigDecimal oliMax;
|
||||
/**
|
||||
* 油压最小电压
|
||||
*/
|
||||
private int oilMinVoltage;
|
||||
@NotNull(message = "油压最小电压不能为空")
|
||||
private BigDecimal oilMinVoltage;
|
||||
/**
|
||||
* 油压最大电压
|
||||
*/
|
||||
private int oilMaxVoltage;
|
||||
@NotNull(message = "油压最大电压不能为空")
|
||||
private BigDecimal oilMaxVoltage;
|
||||
/**
|
||||
* 输压最小值
|
||||
*/
|
||||
private int inputPressureMinValue;
|
||||
@NotNull(message = "输压最小值不能为空")
|
||||
private BigDecimal inputPressureMinValue;
|
||||
/**
|
||||
* 输压最大值
|
||||
*/
|
||||
private int inputPressureMaxValue;
|
||||
@NotNull(message = "输压最大值不能为空")
|
||||
private BigDecimal inputPressureMaxValue;
|
||||
/**
|
||||
* 输压最小电压
|
||||
*/
|
||||
private int inputVoltageMinValue;
|
||||
@NotNull(message = "输压最小电压不能为空")
|
||||
private BigDecimal inputVoltageMinValue;
|
||||
/**
|
||||
* 输压最大电压
|
||||
*/
|
||||
private int inputVoltageMaxValue;
|
||||
@NotNull(message = "输压最大电压不能为空")
|
||||
private BigDecimal inputVoltageMaxValue;
|
||||
/**
|
||||
* 流量最小值
|
||||
*/
|
||||
private int flowRateMinValue;
|
||||
@NotNull(message = "流量最小值不能为空")
|
||||
private BigDecimal flowRateMinValue;
|
||||
/**
|
||||
* 流量最大值
|
||||
*/
|
||||
private int flowRateMaxValue;
|
||||
@NotNull(message = "流量最大值不能为空")
|
||||
private BigDecimal flowRateMaxValue;
|
||||
/**
|
||||
* 流量最小电压
|
||||
*/
|
||||
private int flowVoltageMinValue;
|
||||
@NotNull(message = "流量最小电压不能为空")
|
||||
private BigDecimal flowVoltageMinValue;
|
||||
/**
|
||||
* 流量最大电压
|
||||
*/
|
||||
private int flowVoltageMaxValue;
|
||||
@NotNull(message = "流量最大电压不能为空")
|
||||
private BigDecimal flowVoltageMaxValue;
|
||||
/**
|
||||
* 连续采样间隔
|
||||
*/
|
||||
|
@ -145,22 +163,22 @@ public class ControlMode extends Command {
|
|||
// 01 10 0032 0036 6C
|
||||
command.append("0110003200366C");
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.ctlModel), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.minPressure), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.maxPressure), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.pressureMinVoltage), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.pressureMaxVoltage), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.oilMin), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.oliMax), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.oilMinVoltage), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.oilMaxVoltage), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.inputPressureMinValue), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.inputPressureMaxValue), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.inputVoltageMinValue), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.inputVoltageMaxValue), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.flowRateMinValue), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.flowRateMaxValue), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.flowVoltageMinValue), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.flowVoltageMaxValue), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.minPressure.multiply(ONE_HUNDRED).intValue()), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.maxPressure.multiply(ONE_HUNDRED).intValue()), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.pressureMinVoltage.multiply(ONE_HUNDRED).intValue()), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.pressureMaxVoltage.multiply(ONE_HUNDRED).intValue()), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.oilMin.multiply(ONE_HUNDRED).intValue()), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.oliMax.multiply(ONE_HUNDRED).intValue()), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.oilMinVoltage.multiply(ONE_HUNDRED).intValue()), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.oilMaxVoltage.multiply(ONE_HUNDRED).intValue()), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.inputPressureMinValue.multiply(ONE_HUNDRED).intValue()), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.inputPressureMaxValue.multiply(ONE_HUNDRED).intValue()), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.inputVoltageMinValue.multiply(ONE_HUNDRED).intValue()), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.inputVoltageMaxValue.multiply(ONE_HUNDRED).intValue()), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.flowRateMinValue.multiply(ONE_HUNDRED).intValue()), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.flowRateMaxValue.multiply(ONE_HUNDRED).intValue()), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.flowVoltageMinValue.multiply(ONE_HUNDRED).intValue()), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.flowVoltageMaxValue.multiply(ONE_HUNDRED).intValue()), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.continuousSamplingIntervalDuration), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.sensorSignalEffectiveLevel), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.pressureCompensationPolarityFlag), 8, "0"));
|
||||
|
|
|
@ -2,6 +2,8 @@ package com.isu.gaswellwatch.vo.command.scss;
|
|||
|
||||
import com.isu.gaswellwatch.dto.modbus.ModbusCommandDto;
|
||||
import com.isu.gaswellwatch.vo.command.Command;
|
||||
import com.isu.gaswellwatch.vo.command.Timing;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
@ -20,7 +22,7 @@ import java.util.List;
|
|||
@Getter
|
||||
@Setter
|
||||
@SuperBuilder
|
||||
public class PlungerLogicMode extends Command {
|
||||
public class PlungerLogicMode extends Command implements Timing {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = -3715097823142330692L;
|
||||
|
@ -28,19 +30,23 @@ public class PlungerLogicMode extends Command {
|
|||
/**
|
||||
* 柱塞上升时间
|
||||
*/
|
||||
private int plungerRiseDuration;
|
||||
@NotBlank(message = "柱塞上升时间为空;格式:HH:mm:ss")
|
||||
private String plungerRiseDuration;
|
||||
/**
|
||||
* 续流时间
|
||||
*/
|
||||
private int continuosFlowDuration;
|
||||
@NotBlank(message = "续流时间不能为空;格式:HH:mm:ss")
|
||||
private String continuosFlowDuration;
|
||||
/**
|
||||
* 关井时间
|
||||
*/
|
||||
private int wellCloseTimeDuration;
|
||||
@NotBlank(message = "关井时间不能为空;格式:HH:mm:ss")
|
||||
private String wellCloseTimeDuration;
|
||||
/**
|
||||
* 未到达关井时间
|
||||
*/
|
||||
private int wellCloseTimeNotReachedDuration;
|
||||
@NotBlank(message = "未到达关井时间不能为空;格式:HH:mm:ss")
|
||||
private String wellCloseTimeNotReachedDuration;
|
||||
/**
|
||||
* 未到达次数
|
||||
*/
|
||||
|
@ -60,43 +66,53 @@ public class PlungerLogicMode extends Command {
|
|||
/**
|
||||
* 续流增加时间
|
||||
*/
|
||||
private int continuosFlowIncreaseDuration;
|
||||
@NotBlank(message = "续流增加时间不能为空;格式:HH:mm:ss")
|
||||
private String continuosFlowIncreaseDuration;
|
||||
/**
|
||||
* 续流减少时间
|
||||
*/
|
||||
private int continuosFlowDecreaseDuration;
|
||||
@NotBlank(message = "最大开井时间不能为空;格式:HH:mm:ss")
|
||||
private String continuosFlowDecreaseDuration;
|
||||
/**
|
||||
* 关井增加时间
|
||||
*/
|
||||
private int wellCloseIncreaseDuration;
|
||||
@NotBlank(message = "关井增加时间不能为空;格式:HH:mm:ss")
|
||||
private String wellCloseIncreaseDuration;
|
||||
/**
|
||||
* 关井减少时间
|
||||
*/
|
||||
private int wellCloseDecreaseDuration;
|
||||
@NotBlank(message = "关井减少时间不能为空;格式:HH:mm:ss")
|
||||
private String wellCloseDecreaseDuration;
|
||||
/**
|
||||
* 最小关井时间
|
||||
*/
|
||||
private int minWellCloseTimeDuration2;
|
||||
@NotBlank(message = "最小关井时间不能为空;格式:HH:mm:ss")
|
||||
private String minWellCloseTimeDuration2;
|
||||
/**
|
||||
* 最大关井时间
|
||||
*/
|
||||
private int maxWellCloseTimeDuration2;
|
||||
@NotBlank(message = "最大关井时间不能为空;格式:HH:mm:ss")
|
||||
private String maxWellCloseTimeDuration2;
|
||||
/**
|
||||
* 最小续流时间
|
||||
*/
|
||||
private int minContinuosFlowTimeDuration;
|
||||
@NotBlank(message = "最小续流时间不能为空;格式:HH:mm:ss")
|
||||
private String minContinuosFlowTimeDuration;
|
||||
/**
|
||||
* 最大续流时间
|
||||
*/
|
||||
private int maxContinuosFlowTimeDuration;
|
||||
@NotBlank(message = "最大续流时间不能为空;格式:HH:mm:ss")
|
||||
private String maxContinuosFlowTimeDuration;
|
||||
/**
|
||||
* 最小开井时间
|
||||
*/
|
||||
private int minWellOpenTimeDuration2;
|
||||
@NotBlank(message = "最小开井时间不能为空;格式:HH:mm:ss")
|
||||
private String minWellOpenTimeDuration2;
|
||||
/**
|
||||
* 最大开井时间
|
||||
*/
|
||||
private int maxWellOpenTimeDuration2;
|
||||
@NotBlank(message = "最大开井时间不能为空;格式:HH:mm:ss")
|
||||
private String maxWellOpenTimeDuration2;
|
||||
/**
|
||||
* 开井套压
|
||||
*/
|
||||
|
@ -126,30 +142,50 @@ public class PlungerLogicMode extends Command {
|
|||
this.setCode("SCSS.PLUNGER_LOGIC_MODE");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean validate() {
|
||||
return super.validate()
|
||||
&& StringUtils.isNotBlank(this.plungerRiseDuration)
|
||||
&& StringUtils.isNotBlank(this.continuosFlowDuration)
|
||||
&& StringUtils.isNotBlank(this.wellCloseTimeDuration)
|
||||
&& StringUtils.isNotBlank(this.wellCloseTimeNotReachedDuration)
|
||||
&& StringUtils.isNotBlank(this.continuosFlowIncreaseDuration)
|
||||
&& StringUtils.isNotBlank(this.continuosFlowDecreaseDuration)
|
||||
&& StringUtils.isNotBlank(this.wellCloseIncreaseDuration)
|
||||
&& StringUtils.isNotBlank(this.wellCloseDecreaseDuration)
|
||||
&& StringUtils.isNotBlank(this.minWellCloseTimeDuration2)
|
||||
&& StringUtils.isNotBlank(this.maxWellCloseTimeDuration2)
|
||||
&& StringUtils.isNotBlank(this.minContinuosFlowTimeDuration)
|
||||
&& StringUtils.isNotBlank(this.maxContinuosFlowTimeDuration)
|
||||
&& StringUtils.isNotBlank(this.minWellOpenTimeDuration2)
|
||||
&& StringUtils.isNotBlank(this.maxWellOpenTimeDuration2)
|
||||
&& StringUtils.isNotBlank(this.minContinuosFlowTimeDuration);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Collection<ModbusCommandDto> builderModbusCommand() {
|
||||
StringBuilder command = new StringBuilder(130);
|
||||
// 地址码 功能码 起始地址 连续长度 连续字长
|
||||
// 01 10 00C8 0030 60
|
||||
command.append("011000C8003060");
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.plungerRiseDuration), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.continuosFlowDuration), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.wellCloseTimeDuration), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.wellCloseTimeNotReachedDuration), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Long.toHexString(this.toSeconds(this.plungerRiseDuration)), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Long.toHexString(this.toSeconds(this.continuosFlowDuration)), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Long.toHexString(this.toSeconds(this.wellCloseTimeDuration)), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Long.toHexString(this.toSeconds(this.wellCloseTimeNotReachedDuration)), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.wellCloseNotReachedCountValue), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.plungerDelayDurationRepeat), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.targetTimeTimestamp), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.targetTimeRangeValue), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.continuosFlowIncreaseDuration), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.continuosFlowDecreaseDuration), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.wellCloseIncreaseDuration), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.wellCloseDecreaseDuration), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.minWellCloseTimeDuration2), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.maxWellCloseTimeDuration2), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.minContinuosFlowTimeDuration), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.maxContinuosFlowTimeDuration), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.minWellOpenTimeDuration2), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.maxWellOpenTimeDuration2), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Long.toHexString(this.toSeconds(this.continuosFlowIncreaseDuration)), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Long.toHexString(this.toSeconds(this.continuosFlowDecreaseDuration)), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Long.toHexString(this.toSeconds(this.wellCloseIncreaseDuration)), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Long.toHexString(this.toSeconds(this.wellCloseDecreaseDuration)), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Long.toHexString(this.toSeconds(this.minWellCloseTimeDuration2)), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Long.toHexString(this.toSeconds(this.maxWellCloseTimeDuration2)), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Long.toHexString(this.toSeconds(this.minContinuosFlowTimeDuration)), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Long.toHexString(this.toSeconds(this.maxContinuosFlowTimeDuration)), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Long.toHexString(this.toSeconds(this.minWellOpenTimeDuration2)), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Long.toHexString(this.toSeconds(this.maxWellOpenTimeDuration2)), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.wellOpenPressureValueAtOpen), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.wellOpenOilPressureValueAtOpen), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.wellOpenLoadFactorPresetsAtOpen), 8, "0"));
|
||||
|
@ -158,4 +194,61 @@ public class PlungerLogicMode extends Command {
|
|||
command.append(StringUtils.leftPad(Integer.toHexString(this.wellCloseFlowValueAtClose), 8, "0"));
|
||||
return List.of(ModbusCommandDto.builder().command(command.toString()).length(16).build());
|
||||
}
|
||||
|
||||
public void setPlungerRiseDuration(String plungerRiseDuration) {
|
||||
this.plungerRiseDuration = this.timingValidate(plungerRiseDuration, "plungerRiseDuration");
|
||||
}
|
||||
|
||||
public void setContinuosFlowDuration(String continuosFlowDuration) {
|
||||
this.continuosFlowDuration = this.timingValidate(continuosFlowDuration, "continuosFlowDuration");
|
||||
}
|
||||
|
||||
public void setWellCloseTimeDuration(String wellCloseTimeDuration) {
|
||||
this.wellCloseTimeDuration = this.timingValidate(wellCloseTimeDuration, "wellCloseTimeDuration");
|
||||
}
|
||||
|
||||
public void setWellCloseTimeNotReachedDuration(String wellCloseTimeNotReachedDuration) {
|
||||
this.wellCloseTimeNotReachedDuration = this.timingValidate(wellCloseTimeNotReachedDuration, "wellCloseTimeNotReachedDuration");
|
||||
}
|
||||
|
||||
public void setContinuosFlowIncreaseDuration(String continuosFlowIncreaseDuration) {
|
||||
this.continuosFlowIncreaseDuration = this.timingValidate(continuosFlowIncreaseDuration, "continuosFlowIncreaseDuration");
|
||||
}
|
||||
|
||||
public void setContinuosFlowDecreaseDuration(String continuosFlowDecreaseDuration) {
|
||||
this.continuosFlowDecreaseDuration = this.timingValidate(continuosFlowDecreaseDuration, "continuosFlowDecreaseDuration");
|
||||
}
|
||||
|
||||
public void setWellCloseIncreaseDuration(String wellCloseIncreaseDuration) {
|
||||
this.wellCloseIncreaseDuration = this.timingValidate(wellCloseIncreaseDuration, "wellCloseIncreaseDuration");
|
||||
}
|
||||
|
||||
public void setWellCloseDecreaseDuration(String wellCloseDecreaseDuration) {
|
||||
this.wellCloseDecreaseDuration = this.timingValidate(wellCloseDecreaseDuration, "wellCloseDecreaseDuration");
|
||||
}
|
||||
|
||||
public void setMinWellCloseTimeDuration2(String minWellCloseTimeDuration2) {
|
||||
this.minWellCloseTimeDuration2 = this.timingValidate(minWellCloseTimeDuration2, "minWellCloseTimeDuration2");
|
||||
}
|
||||
|
||||
public void setMaxWellCloseTimeDuration2(String maxWellCloseTimeDuration2) {
|
||||
this.maxWellCloseTimeDuration2 = this.timingValidate(maxWellCloseTimeDuration2, "maxWellCloseTimeDuration2");
|
||||
}
|
||||
|
||||
public void setMinContinuosFlowTimeDuration(String minContinuosFlowTimeDuration) {
|
||||
this.minContinuosFlowTimeDuration = this.timingValidate(minContinuosFlowTimeDuration, "minContinuosFlowTimeDuration");
|
||||
}
|
||||
|
||||
public void setMaxContinuosFlowTimeDuration(String maxContinuosFlowTimeDuration) {
|
||||
this.maxContinuosFlowTimeDuration = this.timingValidate(maxContinuosFlowTimeDuration, "maxContinuosFlowTimeDuration");
|
||||
}
|
||||
|
||||
public void setMinWellOpenTimeDuration2(String minWellOpenTimeDuration2) {
|
||||
this.minWellOpenTimeDuration2 = this.timingValidate(minWellOpenTimeDuration2, "minWellOpenTimeDuration2");
|
||||
}
|
||||
|
||||
public void setMaxWellOpenTimeDuration2(String maxWellOpenTimeDuration2) {
|
||||
this.maxWellOpenTimeDuration2 = this.timingValidate(maxWellOpenTimeDuration2, "maxWellOpenTimeDuration2");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,7 +2,9 @@ package com.isu.gaswellwatch.vo.command.scss;
|
|||
|
||||
import com.isu.gaswellwatch.dto.modbus.ModbusCommandDto;
|
||||
import com.isu.gaswellwatch.vo.command.Command;
|
||||
import com.isu.gaswellwatch.vo.command.Timing;
|
||||
import com.isu.gaswellwatch.vo.command.knpcv1.mode.PressureMode;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
@ -24,13 +26,14 @@ import java.util.Objects;
|
|||
@Getter
|
||||
@Setter
|
||||
@SuperBuilder
|
||||
public class SimpleLogicMode extends Command {
|
||||
public class SimpleLogicMode extends Command implements Timing {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 8899565585137994751L;
|
||||
/**
|
||||
* 开井时间,以秒为单位的时间
|
||||
*/
|
||||
private int wellOpenTimeTimestamp;
|
||||
@NotBlank(message = "开井时间不能为空,格式:HH:mm:ss")
|
||||
private String wellOpenTimeTimestamp;
|
||||
/**
|
||||
* 开井套压
|
||||
*/
|
||||
|
@ -49,15 +52,18 @@ public class SimpleLogicMode extends Command {
|
|||
/**
|
||||
* 关井时间
|
||||
*/
|
||||
private int wellCloseTimeTimestamp;
|
||||
@NotBlank(message = "关井时间不能为空,格式:HH:mm:ss")
|
||||
private String wellCloseTimeTimestamp;
|
||||
/**
|
||||
* 关井套压
|
||||
*/
|
||||
private int wellClosePressureValue;
|
||||
@NotNull(message = "关井套压不能为空")
|
||||
private BigDecimal wellClosePressureValue = BigDecimal.ZERO;
|
||||
/**
|
||||
* 关井油压
|
||||
*/
|
||||
private int wellCloseOilPressureValue;
|
||||
@NotNull(message = "关井油压不能为空")
|
||||
private BigDecimal wellCloseOilPressureValue = BigDecimal.ZERO;
|
||||
/**
|
||||
* 关井流量
|
||||
*/
|
||||
|
@ -65,35 +71,43 @@ public class SimpleLogicMode extends Command {
|
|||
/**
|
||||
* 最小开井时间
|
||||
*/
|
||||
private int minWellOpenTimeDuration;
|
||||
@NotBlank(message = "最小开井时间不能为空,格式:HH:mm:ss")
|
||||
private String minWellOpenTimeDuration;
|
||||
/**
|
||||
* 最大开井时间
|
||||
*/
|
||||
private int maxWellOpenTimeDuration;
|
||||
@NotBlank(message = "最大开井时间不能为空,格式:HH:mm:ss")
|
||||
private String maxWellOpenTimeDuration;
|
||||
/**
|
||||
* 最小关井时间
|
||||
*/
|
||||
private int minWellCloseTimeDuration;
|
||||
@NotBlank(message = "最小关井时间不能为空,格式:HH:mm:ss")
|
||||
private String minWellCloseTimeDuration;
|
||||
/**
|
||||
* 最大关井时间
|
||||
*/
|
||||
private int maxWellCloseTimeDuration;
|
||||
@NotBlank(message = "最大关井时间不能为空,格式:HH:mm:ss")
|
||||
private String maxWellCloseTimeDuration;
|
||||
/**
|
||||
* 压力稳定时间
|
||||
*/
|
||||
private int pressureStabilizationDuration;
|
||||
@NotBlank(message = "压力稳定时间不能为空,格式:HH:mm:ss")
|
||||
private String pressureStabilizationDuration;
|
||||
/**
|
||||
* 流量稳定时间
|
||||
*/
|
||||
private int flowStabilizationDuration;
|
||||
@NotBlank(message = "流量稳定时间不能为空,格式:HH:mm:ss")
|
||||
private String flowStabilizationDuration;
|
||||
/**
|
||||
* 载荷因子稳定时间
|
||||
*/
|
||||
private int loadFactorStabilizationDuration;
|
||||
@NotBlank(message = "载荷因子稳定时间不能为空,格式:HH:mm:ss")
|
||||
private String loadFactorStabilizationDuration;
|
||||
/**
|
||||
* 柱塞延迟时间
|
||||
*/
|
||||
private int plungerDelayDuration;
|
||||
@NotBlank(message = "柱塞延迟时间不能为空,格式:HH:mm:ss")
|
||||
private String plungerDelayDuration;
|
||||
|
||||
public SimpleLogicMode() {
|
||||
this.setCode("SCSS.SIMPLE_LOGIC_MODE");
|
||||
|
@ -103,6 +117,16 @@ public class SimpleLogicMode extends Command {
|
|||
public boolean validate() {
|
||||
return super.validate()
|
||||
&& Objects.nonNull(this.wellOpenPressureValue)
|
||||
&& StringUtils.isNotBlank(this.plungerDelayDuration)
|
||||
&& StringUtils.isNotBlank(this.wellOpenTimeTimestamp)
|
||||
&& StringUtils.isNotBlank(this.wellCloseTimeTimestamp)
|
||||
&& StringUtils.isNotBlank(this.minWellOpenTimeDuration)
|
||||
&& StringUtils.isNotBlank(this.maxWellOpenTimeDuration)
|
||||
&& StringUtils.isNotBlank(this.minWellCloseTimeDuration)
|
||||
&& StringUtils.isNotBlank(this.maxWellCloseTimeDuration)
|
||||
&& StringUtils.isNotBlank(this.flowStabilizationDuration)
|
||||
&& StringUtils.isNotBlank(this.pressureStabilizationDuration)
|
||||
&& StringUtils.isNotBlank(this.loadFactorStabilizationDuration)
|
||||
&& this.wellOpenPressureValue.compareTo(BigDecimal.ZERO) >= 0
|
||||
&& this.wellOpenPressureValue.multiply(PressureMode.MULTIPLE).compareTo(PressureMode.MAX_VALUE) <= 0
|
||||
&& Objects.nonNull(this.wellOpenOilPressureValue)
|
||||
|
@ -119,22 +143,63 @@ public class SimpleLogicMode extends Command {
|
|||
// 地址码 功能码 起始地址 连续长度 连续字长
|
||||
// 01 10 0096 0020 40
|
||||
command.append("01100096002040");
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.wellOpenTimeTimestamp), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Long.toHexString(this.toSeconds(this.wellOpenTimeTimestamp)), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.wellOpenPressureValue.multiply(PressureMode.MULTIPLE).intValue()), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.wellOpenOilPressureValue.multiply(PressureMode.MULTIPLE).intValue()), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.wellOpenLoadFactorPresets.multiply(PressureMode.MULTIPLE).intValue()), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.wellCloseTimeTimestamp), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.wellClosePressureValue), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.wellCloseOilPressureValue), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Long.toHexString(this.toSeconds(this.wellCloseTimeTimestamp)), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.wellClosePressureValue.multiply(ONE_HUNDRED).intValue()), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.wellCloseOilPressureValue.multiply(ONE_HUNDRED).intValue()), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.wellCloseFlowValue), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.minWellOpenTimeDuration), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.maxWellOpenTimeDuration), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.minWellCloseTimeDuration), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.maxWellCloseTimeDuration), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.pressureStabilizationDuration), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.flowStabilizationDuration), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.loadFactorStabilizationDuration), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.plungerDelayDuration), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Long.toHexString(this.toSeconds(this.minWellOpenTimeDuration)), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Long.toHexString(this.toSeconds(this.maxWellOpenTimeDuration)), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Long.toHexString(this.toSeconds(this.minWellCloseTimeDuration)), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Long.toHexString(this.toSeconds(this.maxWellCloseTimeDuration)), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Long.toHexString(this.toSeconds(this.pressureStabilizationDuration)), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Long.toHexString(this.toSeconds(this.flowStabilizationDuration)), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Long.toHexString(this.toSeconds(this.loadFactorStabilizationDuration)), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Long.toHexString(this.toSeconds(this.plungerDelayDuration)), 8, "0"));
|
||||
return List.of(ModbusCommandDto.builder().command(command.toString()).length(16).build());
|
||||
}
|
||||
|
||||
public void setWellOpenTimeTimestamp(String wellOpenTimeTimestamp) {
|
||||
this.wellOpenTimeTimestamp = this.timingValidate(wellOpenTimeTimestamp, "wellOpenTimeTimestamp");
|
||||
}
|
||||
|
||||
public void setWellCloseTimeTimestamp(String wellCloseTimeTimestamp) {
|
||||
this.wellCloseTimeTimestamp = this.timingValidate(wellCloseTimeTimestamp, "wellCloseTimeTimestamp");
|
||||
}
|
||||
|
||||
public void setMinWellOpenTimeDuration(String minWellOpenTimeDuration) {
|
||||
this.minWellOpenTimeDuration = this.timingValidate(minWellOpenTimeDuration, "minWellOpenTimeDuration");
|
||||
}
|
||||
|
||||
public void setMaxWellOpenTimeDuration(String maxWellOpenTimeDuration) {
|
||||
this.maxWellOpenTimeDuration = this.timingValidate(maxWellOpenTimeDuration, "maxWellOpenTimeDuration");
|
||||
}
|
||||
|
||||
public void setMinWellCloseTimeDuration(String minWellCloseTimeDuration) {
|
||||
this.minWellCloseTimeDuration = this.timingValidate(minWellCloseTimeDuration, "minWellCloseTimeDuration");
|
||||
}
|
||||
|
||||
public void setMaxWellCloseTimeDuration(String maxWellCloseTimeDuration) {
|
||||
this.maxWellCloseTimeDuration = this.timingValidate(maxWellCloseTimeDuration, "maxWellCloseTimeDuration");
|
||||
}
|
||||
|
||||
public void setPressureStabilizationDuration(String pressureStabilizationDuration) {
|
||||
this.pressureStabilizationDuration = this.timingValidate(pressureStabilizationDuration, "pressureStabilizationDuration");
|
||||
}
|
||||
|
||||
public void setFlowStabilizationDuration(String flowStabilizationDuration) {
|
||||
this.flowStabilizationDuration = this.timingValidate(flowStabilizationDuration, "flowStabilizationDuration");
|
||||
}
|
||||
|
||||
public void setLoadFactorStabilizationDuration(String loadFactorStabilizationDuration) {
|
||||
this.loadFactorStabilizationDuration = this.timingValidate(loadFactorStabilizationDuration, "loadFactorStabilizationDuration");
|
||||
}
|
||||
|
||||
public void setPlungerDelayDuration(String plungerDelayDuration) {
|
||||
this.plungerDelayDuration = this.timingValidate(plungerDelayDuration, "plungerDelayDuration");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -46,11 +46,11 @@ CREATE TABLE `$TableName$`
|
|||
`input_pressure_compensation_value_setting` int NULL DEFAULT NULL COMMENT '输压补偿值',
|
||||
`flow_compensation_polarity_flag` int NULL DEFAULT NULL COMMENT '流量补偿极性',
|
||||
`flow_compensation_value_setting` int NULL DEFAULT NULL COMMENT '流量补偿值',
|
||||
`well_open_time_timestamp` int NULL DEFAULT NULL COMMENT '开井时间',
|
||||
`well_open_time_timestamp` varchar(10) NULL DEFAULT NULL COMMENT '开井时间',
|
||||
`well_open_pressure_value` decimal(10, 2) NULL DEFAULT NULL COMMENT '开井套压',
|
||||
`well_open_oil_pressure_value` decimal(10, 2) NULL DEFAULT NULL COMMENT '开井油压',
|
||||
`well_open_load_factor_presets` decimal(10, 2) NULL DEFAULT NULL COMMENT '开井载荷因子预设值',
|
||||
`well_close_time_timestamp` int NULL DEFAULT NULL COMMENT '关井时间时间戳',
|
||||
`well_close_time_timestamp` varchar(10) NULL DEFAULT NULL COMMENT '关井时间时间戳',
|
||||
`well_close_pressure_value` decimal(10, 2) NULL DEFAULT NULL COMMENT '关井压力值',
|
||||
`well_close_oil_pressure_value` decimal(10, 2) NULL DEFAULT NULL COMMENT '关井油压值',
|
||||
`well_close_flow_value` int NULL DEFAULT NULL COMMENT '关井流量值',
|
||||
|
|
Loading…
Reference in New Issue