添加四川双晟控制指令
This commit is contained in:
parent
412ede0301
commit
a48c60bcdb
|
@ -3,7 +3,13 @@ package com.isu.gaswellwatch.vo.command;
|
|||
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||
import com.isu.gaswellwatch.dto.modbus.ModbusCommandDto;
|
||||
import com.isu.gaswellwatch.vo.command.etc.PlungerTimer;
|
||||
import com.isu.gaswellwatch.vo.command.etc.SensorDelay;
|
||||
import com.isu.gaswellwatch.vo.command.knpcv1.mode.*;
|
||||
import com.isu.gaswellwatch.vo.command.scss.ControlMode;
|
||||
import com.isu.gaswellwatch.vo.command.scss.PlungerLogicMode;
|
||||
import com.isu.gaswellwatch.vo.command.scss.SimpleLogicMode;
|
||||
import com.isu.gaswellwatch.vo.command.scss.SystemInfo;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
@ -31,6 +37,12 @@ import java.util.Objects;
|
|||
@JsonSubTypes.Type(value = PlungerMode.class, name = Command.KNPCV1_RUN_PLUNGER),
|
||||
@JsonSubTypes.Type(value = PressureMode.class, name = Command.KNPCV1_RUN_PRESSURE),
|
||||
@JsonSubTypes.Type(value = TimePressureMode.class, name = Command.KNPCV1_RUN_TIME_PRESSURE),
|
||||
@JsonSubTypes.Type(value = SensorDelay.class, name = Command.ETC_SENSOR_DELAY),
|
||||
@JsonSubTypes.Type(value = PlungerTimer.class, name = Command.ETC_PLUNGER_TIMER),
|
||||
@JsonSubTypes.Type(value = SystemInfo.class, name = Command.SCSS_SYSTEM_INFO),
|
||||
@JsonSubTypes.Type(value = ControlMode.class, name = Command.SCSS_CONTROL_MODE),
|
||||
@JsonSubTypes.Type(value = SimpleLogicMode.class, name = Command.SCSS_SIMPLE_LOGIC_MODE),
|
||||
@JsonSubTypes.Type(value = PlungerLogicMode.class, name = Command.SCSS_PLUNGER_LOGIC_MODE),
|
||||
@JsonSubTypes.Type(value = com.isu.gaswellwatch.vo.command.etc.TurnOn.class, name = Command.ETC_TURN_ON_THE_WELL),
|
||||
@JsonSubTypes.Type(value = com.isu.gaswellwatch.vo.command.etc.TurnOff.class, name = Command.ETC_TURN_OFF_THE_WELL),
|
||||
@JsonSubTypes.Type(value = com.isu.gaswellwatch.vo.command.scss.TurnOn.class, name = Command.SCSS_TURN_ON_THE_WELL),
|
||||
|
@ -62,10 +74,15 @@ public abstract class Command implements Serializable {
|
|||
/* 点表类型:KNPCV1 end */
|
||||
|
||||
/* 点表类型:SCSS start */
|
||||
/* 系统基本信息 */
|
||||
public static final String SCSS_SYSTEM_INFO = "SCSS.SYSTEM_INFO";
|
||||
/* 开关井 */
|
||||
public static final String SCSS_TURN_ON_THE_WELL = "SCSS.TURN_ON_THE_WELL";
|
||||
public static final String SCSS_TURN_OFF_THE_WELL = "SCSS.TURN_OFF_THE_WELL";
|
||||
/* 运行模式*/
|
||||
/* 模式指令 */
|
||||
public static final String SCSS_CONTROL_MODE = "SCSS.CONTROL_MODE";
|
||||
public static final String SCSS_SIMPLE_LOGIC_MODE = "SCSS.SIMPLE_LOGIC_MODE";
|
||||
public static final String SCSS_PLUNGER_LOGIC_MODE = "SCSS.PLUNGER_LOGIC_MODE";
|
||||
|
||||
/* 点表类型:SCSS end */
|
||||
|
||||
|
@ -73,7 +90,9 @@ public abstract class Command implements Serializable {
|
|||
/* 开关井 */
|
||||
public static final String ETC_TURN_ON_THE_WELL = "ETC.TURN_ON_THE_WELL";
|
||||
public static final String ETC_TURN_OFF_THE_WELL = "ETC.TURN_OFF_THE_WELL";
|
||||
/* 运行模式*/
|
||||
/* 模式指令*/
|
||||
public static final String ETC_SENSOR_DELAY = "ETC.SENSOR_DELAY";
|
||||
public static final String ETC_PLUNGER_TIMER = "ETC.PLUNGER_TIMER";
|
||||
|
||||
/* 点表类型:ETC end */
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ import java.util.Collection;
|
|||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:shilong.wang@alpha-ess.com">王仕龙</a>
|
||||
* @author <a href="mailto:scwsl@foxmail.com">王仕龙</a>
|
||||
* 2024/11/27 22:56
|
||||
*/
|
||||
@Getter
|
||||
|
@ -31,6 +31,10 @@ public class PlungerTimer extends Command implements Timing {
|
|||
@NotBlank(message = "柱塞上升时间不能为空")
|
||||
private String plungerRiseTime;
|
||||
|
||||
public PlungerTimer() {
|
||||
this.setCode("ETC.PLUNGER_TIMER");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean validate() {
|
||||
return super.validate() && StringUtils.isNotBlank(this.plungerRiseTime);
|
||||
|
|
|
@ -14,7 +14,7 @@ import java.util.Collection;
|
|||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:shilong.wang@alpha-ess.com">王仕龙</a>
|
||||
* @author <a href="mailto:scwsl@foxmail.com">王仕龙</a>
|
||||
* 2024/11/27 23:04
|
||||
*/
|
||||
@Getter
|
||||
|
@ -40,6 +40,10 @@ public class SensorDelay extends Command implements Timing {
|
|||
@NotBlank(message = "续流时间不能为空")
|
||||
private String afterFlowTime;
|
||||
|
||||
public SensorDelay() {
|
||||
this.setCode("ETC.SENSOR_DELAY");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean validate() {
|
||||
return super.validate()
|
||||
|
|
|
@ -0,0 +1,176 @@
|
|||
package com.isu.gaswellwatch.vo.command.scss;
|
||||
|
||||
import com.isu.gaswellwatch.dto.modbus.ModbusCommandDto;
|
||||
import com.isu.gaswellwatch.vo.command.Command;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 控制定值数据寄存器地址
|
||||
*
|
||||
* @author <a href="mailto:scwsl@foxmail.com>王仕龙</a>
|
||||
* 2024/11/28 0:15
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@SuperBuilder
|
||||
public class ControlMode extends Command {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = -3782424709053622334L;
|
||||
|
||||
/**
|
||||
* 控制模式
|
||||
*/
|
||||
private int ctlModel;
|
||||
/**
|
||||
* 套压最小值
|
||||
*/
|
||||
private int minPressure;
|
||||
/**
|
||||
* 套压最大值
|
||||
*/
|
||||
private int maxPressure;
|
||||
/**
|
||||
* 套压最小电压
|
||||
*/
|
||||
private int pressureMinVoltage;
|
||||
/**
|
||||
* 套压最大电压
|
||||
*/
|
||||
private int pressureMaxVoltage;
|
||||
/**
|
||||
* 油压最小值
|
||||
*/
|
||||
private int oilMin;
|
||||
/**
|
||||
* 油压最大值
|
||||
*/
|
||||
private int oliMax;
|
||||
/**
|
||||
* 油压最小电压
|
||||
*/
|
||||
private int oilMinVoltage;
|
||||
/**
|
||||
* 油压最大电压
|
||||
*/
|
||||
private int oilMaxVoltage;
|
||||
/**
|
||||
* 输压最小值
|
||||
*/
|
||||
private int inputPressureMinValue;
|
||||
/**
|
||||
* 输压最大值
|
||||
*/
|
||||
private int inputPressureMaxValue;
|
||||
/**
|
||||
* 输压最小电压
|
||||
*/
|
||||
private int inputVoltageMinValue;
|
||||
/**
|
||||
* 输压最大电压
|
||||
*/
|
||||
private int inputVoltageMaxValue;
|
||||
/**
|
||||
* 流量最小值
|
||||
*/
|
||||
private int flowRateMinValue;
|
||||
/**
|
||||
* 流量最大值
|
||||
*/
|
||||
private int flowRateMaxValue;
|
||||
/**
|
||||
* 流量最小电压
|
||||
*/
|
||||
private int flowVoltageMinValue;
|
||||
/**
|
||||
* 流量最大电压
|
||||
*/
|
||||
private int flowVoltageMaxValue;
|
||||
/**
|
||||
* 连续采样间隔
|
||||
*/
|
||||
private int continuousSamplingIntervalDuration;
|
||||
/**
|
||||
* 到达传感器有效电平
|
||||
*/
|
||||
private int sensorSignalEffectiveLevel;
|
||||
/**
|
||||
* 套压补偿极性
|
||||
*/
|
||||
private int pressureCompensationPolarityFlag;
|
||||
/**
|
||||
* 套压补偿值
|
||||
*/
|
||||
private int pressureCompensationValueSetting;
|
||||
/**
|
||||
* 油压补偿极性
|
||||
*/
|
||||
private int oilPressureCompensationPolarityFlag;
|
||||
/**
|
||||
* 油压补偿值
|
||||
*/
|
||||
private int oilPressureCompensationValueSetting;
|
||||
/**
|
||||
* 输压补偿极性
|
||||
*/
|
||||
private int inputPressureCompensationPolarityFlag;
|
||||
/**
|
||||
* 输压补偿值
|
||||
*/
|
||||
private int inputPressureCompensationValueSetting;
|
||||
/**
|
||||
* 流量补偿极性
|
||||
*/
|
||||
private int flowCompensationPolarityFlag;
|
||||
/**
|
||||
* 流量补偿值
|
||||
*/
|
||||
private int flowCompensationValueSetting;
|
||||
|
||||
public ControlMode() {
|
||||
this.setCode("SCSS.CONTROL_MODE");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Collection<ModbusCommandDto> builderModbusCommand() {
|
||||
StringBuilder command = new StringBuilder(250);
|
||||
// 地址码 功能码 起始地址 连续长度 连续字长
|
||||
// 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.continuousSamplingIntervalDuration), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.sensorSignalEffectiveLevel), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.pressureCompensationPolarityFlag), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.pressureCompensationValueSetting), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.oilPressureCompensationPolarityFlag), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.oilPressureCompensationValueSetting), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.inputPressureCompensationPolarityFlag), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.inputPressureCompensationValueSetting), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.flowCompensationPolarityFlag), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.flowCompensationValueSetting), 8, "0"));
|
||||
return List.of(ModbusCommandDto.builder().command(command.toString()).length(16).build());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,161 @@
|
|||
package com.isu.gaswellwatch.vo.command.scss;
|
||||
|
||||
import com.isu.gaswellwatch.dto.modbus.ModbusCommandDto;
|
||||
import com.isu.gaswellwatch.vo.command.Command;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 逻辑定值-柱塞模式定值数据寄存器地址
|
||||
*
|
||||
* @author <a href="mailto:scwsl@foxmail.com>王仕龙</a>
|
||||
* 2024/11/28 0:45
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@SuperBuilder
|
||||
public class PlungerLogicMode extends Command {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = -3715097823142330692L;
|
||||
|
||||
/**
|
||||
* 柱塞上升时间
|
||||
*/
|
||||
private int plungerRiseDuration;
|
||||
/**
|
||||
* 续流时间
|
||||
*/
|
||||
private int continuosFlowDuration;
|
||||
/**
|
||||
* 关井时间
|
||||
*/
|
||||
private int wellCloseTimeDuration;
|
||||
/**
|
||||
* 未到达关井时间
|
||||
*/
|
||||
private int wellCloseTimeNotReachedDuration;
|
||||
/**
|
||||
* 未到达次数
|
||||
*/
|
||||
private int wellCloseNotReachedCountValue;
|
||||
/**
|
||||
* 柱塞延迟时间
|
||||
*/
|
||||
private int plungerDelayDurationRepeat;
|
||||
/**
|
||||
* 目标时间
|
||||
*/
|
||||
private int targetTimeTimestamp;
|
||||
/**
|
||||
* 目标时间范围
|
||||
*/
|
||||
private int targetTimeRangeValue;
|
||||
/**
|
||||
* 续流增加时间
|
||||
*/
|
||||
private int continuosFlowIncreaseDuration;
|
||||
/**
|
||||
* 续流减少时间
|
||||
*/
|
||||
private int continuosFlowDecreaseDuration;
|
||||
/**
|
||||
* 关井增加时间
|
||||
*/
|
||||
private int wellCloseIncreaseDuration;
|
||||
/**
|
||||
* 关井减少时间
|
||||
*/
|
||||
private int wellCloseDecreaseDuration;
|
||||
/**
|
||||
* 最小关井时间
|
||||
*/
|
||||
private int minWellCloseTimeDuration2;
|
||||
/**
|
||||
* 最大关井时间
|
||||
*/
|
||||
private int maxWellCloseTimeDuration2;
|
||||
/**
|
||||
* 最小续流时间
|
||||
*/
|
||||
private int minContinuosFlowTimeDuration;
|
||||
/**
|
||||
* 最大续流时间
|
||||
*/
|
||||
private int maxContinuosFlowTimeDuration;
|
||||
/**
|
||||
* 最小开井时间
|
||||
*/
|
||||
private int minWellOpenTimeDuration2;
|
||||
/**
|
||||
* 最大开井时间
|
||||
*/
|
||||
private int maxWellOpenTimeDuration2;
|
||||
/**
|
||||
* 开井套压
|
||||
*/
|
||||
private int wellOpenPressureValueAtOpen;
|
||||
/**
|
||||
* 开井油压
|
||||
*/
|
||||
private int wellOpenOilPressureValueAtOpen;
|
||||
/**
|
||||
* 开井载荷因子预设值
|
||||
*/
|
||||
private int wellOpenLoadFactorPresetsAtOpen;
|
||||
/**
|
||||
* 关井套压
|
||||
*/
|
||||
private int wellClosePressureValueAtClose;
|
||||
/**
|
||||
* 关井油压
|
||||
*/
|
||||
private int wellCloseOilPressureValueAtClose;
|
||||
/**
|
||||
* 关井流量
|
||||
*/
|
||||
private int wellCloseFlowValueAtClose;
|
||||
|
||||
public PlungerLogicMode() {
|
||||
this.setCode("SCSS.PLUNGER_LOGIC_MODE");
|
||||
}
|
||||
|
||||
@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(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(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"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.wellClosePressureValueAtClose), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.wellCloseOilPressureValueAtClose), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.wellCloseFlowValueAtClose), 8, "0"));
|
||||
return List.of(ModbusCommandDto.builder().command(command.toString()).length(16).build());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,119 @@
|
|||
package com.isu.gaswellwatch.vo.command.scss;
|
||||
|
||||
import com.isu.gaswellwatch.dto.modbus.ModbusCommandDto;
|
||||
import com.isu.gaswellwatch.vo.command.Command;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 逻辑定值-简单模式定值数据寄存器地址
|
||||
*
|
||||
* @author <a href="mailto:scwsl@foxmail.com>王仕龙</a>
|
||||
* 2024/11/28 0:31
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@SuperBuilder
|
||||
public class SimpleLogicMode extends Command {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 8899565585137994751L;
|
||||
/**
|
||||
* 开井时间,以秒为单位的时间
|
||||
*/
|
||||
private int wellOpenTimeTimestamp;
|
||||
/**
|
||||
* 开井套压
|
||||
*/
|
||||
private int wellOpenPressureValue;
|
||||
/**
|
||||
* 开井油压
|
||||
*/
|
||||
private int wellOpenOilPressureValue;
|
||||
/**
|
||||
* 开井载荷因子预设值
|
||||
*/
|
||||
private int wellOpenLoadFactorPresets;
|
||||
/**
|
||||
* 关井时间
|
||||
*/
|
||||
private int wellCloseTimeTimestamp;
|
||||
/**
|
||||
* 关井套压
|
||||
*/
|
||||
private int wellClosePressureValue;
|
||||
/**
|
||||
* 关井油压
|
||||
*/
|
||||
private int wellCloseOilPressureValue;
|
||||
/**
|
||||
* 关井流量
|
||||
*/
|
||||
private int wellCloseFlowValue;
|
||||
/**
|
||||
* 最小开井时间
|
||||
*/
|
||||
private int inWellOpenTimeDuration;
|
||||
/**
|
||||
* 最大开井时间
|
||||
*/
|
||||
private int axWellOpenTimeDuration;
|
||||
/**
|
||||
* 最小关井时间
|
||||
*/
|
||||
private int inWellCloseTimeDuration;
|
||||
/**
|
||||
* 最大关井时间
|
||||
*/
|
||||
private int axWellCloseTimeDuration;
|
||||
/**
|
||||
* 压力稳定时间
|
||||
*/
|
||||
private int ressureStabilizationDuration;
|
||||
/**
|
||||
* 流量稳定时间
|
||||
*/
|
||||
private int lowStabilizationDuration;
|
||||
/**
|
||||
* 载荷因子稳定时间
|
||||
*/
|
||||
private int loadFactorStabilizationDuration;
|
||||
/**
|
||||
* 柱塞延迟时间
|
||||
*/
|
||||
private int plungerDelayDuration;
|
||||
|
||||
public SimpleLogicMode() {
|
||||
this.setCode("SCSS.SIMPLE_LOGIC_MODE");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Collection<ModbusCommandDto> builderModbusCommand() {
|
||||
StringBuilder command = new StringBuilder(130);
|
||||
// 地址码 功能码 起始地址 连续长度 连续字长
|
||||
// 01 10 0096 0020 40
|
||||
command.append("01100096002040");
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.wellOpenTimeTimestamp), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.wellOpenPressureValue), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.wellOpenOilPressureValue), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.wellOpenLoadFactorPresets), 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(Integer.toHexString(this.wellCloseFlowValue), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.inWellOpenTimeDuration), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.axWellOpenTimeDuration), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.inWellCloseTimeDuration), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.axWellCloseTimeDuration), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.ressureStabilizationDuration), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.lowStabilizationDuration), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.loadFactorStabilizationDuration), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.plungerDelayDuration), 8, "0"));
|
||||
return List.of(ModbusCommandDto.builder().command(command.toString()).length(16).build());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
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.time.LocalDateTime;
|
||||
import java.time.temporal.ChronoField;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:scwsl@foxmail.com">王仕龙</a>
|
||||
* 2024/11/27 23:53
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@SuperBuilder
|
||||
public class SystemInfo extends Command {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = -4927792179148968016L;
|
||||
|
||||
/**
|
||||
* 日期时间, yyyy-MM-dd HH:mm:ss.SSS
|
||||
*/
|
||||
@NotNull(message = "系统时间不能为空")
|
||||
private LocalDateTime dataTime;
|
||||
/**
|
||||
* 显示延时
|
||||
*/
|
||||
private int showDelay = 0;
|
||||
/**
|
||||
* 开井采样间隔
|
||||
*/
|
||||
private int openWellSamplingInterval = 0;
|
||||
/**
|
||||
* 关井采样间隔
|
||||
*/
|
||||
private int closeWellSamplingInterval = 0;
|
||||
|
||||
public SystemInfo() {
|
||||
this.setCode("SCSS.SYSTEM_INFO");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean validate() {
|
||||
return super.validate() && Objects.isNull(this.dataTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Collection<ModbusCommandDto> builderModbusCommand() {
|
||||
StringBuilder command = new StringBuilder(100);
|
||||
// 0014*2->hex
|
||||
// 地址码 功能码 起始地址 连续长度 连续字长
|
||||
// 01 10 0000 0014 28
|
||||
command.append("01100000001428");
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.dataTime.getYear() - 2000), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.dataTime.getMonthValue()), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.dataTime.getDayOfMonth()), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.dataTime.getHour()), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.dataTime.getMinute()), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.dataTime.getSecond()), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.dataTime.get(ChronoField.MILLI_OF_SECOND)), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.showDelay), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.openWellSamplingInterval), 8, "0"));
|
||||
command.append(StringUtils.leftPad(Integer.toHexString(this.closeWellSamplingInterval), 8, "0"));
|
||||
return List.of(ModbusCommandDto.builder().command(command.toString()).length(16).build());
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue