新增双晟指令

This commit is contained in:
wangshilong 2024-12-10 19:13:44 +08:00
parent 3c31c70070
commit 6fc63e7563
7 changed files with 226 additions and 5 deletions

View File

@ -157,7 +157,7 @@ public class ScssPersistenceHandler extends AbstractPersistenceHandler {
ScssPersistenceHandler.this.setValue(ps, newRow, 34, "flowVoltageMinValue", Types.DECIMAL);
ScssPersistenceHandler.this.setValue(ps, newRow, 35, "flowVoltageMaxValue", Types.DECIMAL);
ScssPersistenceHandler.this.setValue(ps, newRow, 36, "continuousSamplingIntervalDuration", Types.INTEGER);
ScssPersistenceHandler.this.setValue(ps, newRow, 37, "sensorSignalEffectiveLevel", Types.INTEGER);
ScssPersistenceHandler.this.setValue(ps, newRow, 37, "sensorSignalEffectiveLevel", Types.DECIMAL);
ScssPersistenceHandler.this.setValue(ps, newRow, 38, "pressureCompensationPolarityFlag", Types.INTEGER);
ScssPersistenceHandler.this.setValue(ps, newRow, 39, "pressureCompensationValueSetting", Types.INTEGER);
ScssPersistenceHandler.this.setValue(ps, newRow, 40, "oilPressureCompensationPolarityFlag", Types.INTEGER);

View File

@ -84,6 +84,12 @@ public abstract class Command implements Serializable {
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";
/* 时间模式 */
public static final String SCSS_TIME_MODE = "SCSS.TIME_MODE";
/* 套压模式 */
public static final String SCSS_CASING_MODE = "SCSS.CASING_MODE";
/* 采样间隔 */
public static final String SCSS_SAMPLING_INTERVAL_MODE = "SCSS.SAMPLING_INTERVAL";
/* 点表类型SCSS end */

View File

@ -0,0 +1,58 @@
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 jakarta.validation.constraints.NotNull;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.SuperBuilder;
import java.io.Serial;
import java.math.BigDecimal;
import java.util.Collection;
/**
* 套压模式
*
* @author <a href="mailto:shilong.wang@alpha-ess.com">王仕龙</a>
* 2024/12/10 17:01
*/
@Getter
@Setter
@SuperBuilder
public class CasingMode extends Command implements Timing {
@Serial
private static final long serialVersionUID = -6609483152571838191L;
/**
* 开井套压
*/
@NotNull(message = "开井套压不能为空")
private BigDecimal wellOpenPressureValue = BigDecimal.ZERO;
/**
* 关井套压
*/
@NotNull(message = "关井套压不能为空")
private BigDecimal wellClosePressureValue = BigDecimal.ZERO;
/**
* 最小关井时间
*/
@NotBlank(message = "最小关井时间不能为空格式HH:mm:ss")
private String minWellCloseTimeDuration;
/**
* 最大关井时间
*/
@NotBlank(message = "最大关井时间不能为空格式HH:mm:ss")
private String maxWellCloseTimeDuration;
public CasingMode() {
this.setCode("SCSS.CASING_MODE");
}
@Override
protected Collection<ModbusCommandDto> builderModbusCommand() {
return null;
}
}

View File

@ -118,7 +118,8 @@ public class ControlMode extends Command {
/**
* 到达传感器有效电平
*/
private int sensorSignalEffectiveLevel;
@NotNull(message = "到达传感器有效电平不能为空")
private BigDecimal sensorSignalEffectiveLevel;
/**
* 套压补偿极性
*/
@ -160,7 +161,7 @@ public class ControlMode extends Command {
protected Collection<ModbusCommandDto> builderModbusCommand() {
StringBuilder command = new StringBuilder(250);
// 地址码 功能码 起始地址 连续长度 连续字长
// 01 10 0032 0036 6C
// 01 10 0054 0036 6C
command.append("0110003200366C");
command.append(StringUtils.leftPad(Integer.toHexString(this.ctlModel), 8, "0"));
command.append(StringUtils.leftPad(Integer.toHexString(this.minPressure.multiply(ONE_HUNDRED).intValue()), 8, "0"));
@ -180,7 +181,7 @@ public class ControlMode extends Command {
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.sensorSignalEffectiveLevel.multiply(ONE_HUNDRED).intValue()), 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"));
@ -191,4 +192,5 @@ public class ControlMode extends Command {
command.append(StringUtils.leftPad(Integer.toHexString(this.flowCompensationValueSetting), 8, "0"));
return List.of(ModbusCommandDto.builder().command(command.toString()).length(16).build());
}
}

View File

@ -0,0 +1,59 @@
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.math.BigDecimal;
import java.util.Collection;
import java.util.List;
/**
* 采样间隔
*
* @author <a href="mailto:shilong.wang@alpha-ess.com">王仕龙</a>
* 2024/12/10 17:24
*/
@Getter
@Setter
@SuperBuilder
public class SamplingInterval extends Command {
@Serial
private static final long serialVersionUID = -649748614798682095L;
/**
* 连续采样间隔
*/
private int continuousSamplingIntervalDuration;
/**
* 到达传感器有效电平
*/
private BigDecimal sensorSignalEffectiveLevel;
public SamplingInterval() {
this.setCode("SCSS.SAMPLING_INTERVAL");
}
@Override
public boolean validate() {
return super.validate()
&& this.continuousSamplingIntervalDuration > 0
&& this.sensorSignalEffectiveLevel.compareTo(BigDecimal.ZERO) > 0;
}
@Override
protected Collection<ModbusCommandDto> builderModbusCommand() {
StringBuilder command = new StringBuilder(250);
// 地址码 功能码 起始地址 连续长度 连续字长
// 01 10 0055 0004 08
command.append("01100055000408");
command.append(StringUtils.leftPad(Integer.toHexString(this.continuousSamplingIntervalDuration), 8, "0"));
command.append(StringUtils.leftPad(Integer.toHexString(this.sensorSignalEffectiveLevel.multiply(ONE_HUNDRED).intValue()), 8, "0"));
return List.of(ModbusCommandDto.builder().command(command.toString()).length(16).build());
}
}

View File

@ -0,0 +1,96 @@
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;
import org.apache.commons.lang3.StringUtils;
import java.io.Serial;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
/**
* 时间模式
*
* @author <a href="mailto:shilong.wang@alpha-ess.com">王仕龙</a>
* 2024/12/10 16:57
*/
@Getter
@Setter
@SuperBuilder
public class TimeMode extends Command implements Timing {
@Serial
private static final long serialVersionUID = -8623186068280286623L;
/**
* 开井时间以秒为单位的时间
* 150 2
*/
@NotBlank(message = "开井时间不能为空格式HH:mm:ss")
private String wellOpenTimeTimestamp;
/**
* 关井时间
* 158 2
*/
@NotBlank(message = "关井时间不能为空格式HH:mm:ss")
private String wellCloseTimeTimestamp;
/**
* 柱塞延迟时间
* 200 2
*/
@NotBlank(message = "柱塞延迟时间不能为空格式HH:mm:ss")
private String plungerDelayDuration;
public TimeMode() {
this.setCode("SCSS.TIME_MODE");
}
@Override
public boolean validate() {
return super.validate()
&& StringUtils.isNotBlank(this.wellOpenTimeTimestamp)
&& StringUtils.isNotBlank(this.wellCloseTimeTimestamp)
&& StringUtils.isNotBlank(this.plungerDelayDuration);
}
@Override
protected Collection<ModbusCommandDto> builderModbusCommand() {
List<ModbusCommandDto> resultList = new ArrayList<ModbusCommandDto>(3);
StringBuilder command = new StringBuilder(250);
// 地址码 功能码 起始地址 连续长度 连续字长
// 01 10 0096 0002 04
command.append("01100096000204");
command.append(StringUtils.leftPad(Long.toHexString(this.toSeconds(this.wellOpenTimeTimestamp)), 8, "0"));
resultList.add(ModbusCommandDto.builder().command(command.toString()).length(16).build());
command.setLength(0);
// 地址码 功能码 起始地址 连续长度 连续字长
// 01 10 0096 0002 04
command.append("01100096000204");
command.append(StringUtils.leftPad(Long.toHexString(this.toSeconds(this.wellOpenTimeTimestamp)), 8, "0"));
resultList.add(ModbusCommandDto.builder().command(command.toString()).length(16).build());
return resultList;
}
public void setWellOpenTimeTimestamp(String wellOpenTimeTimestamp) {
this.wellOpenTimeTimestamp = this.timingValidate(wellOpenTimeTimestamp, "wellOpenTimeTimestamp");
}
public void setWellCloseTimeTimestamp(String wellCloseTimeTimestamp) {
this.wellCloseTimeTimestamp = this.timingValidate(wellCloseTimeTimestamp, "wellCloseTimeTimestamp");
}
public void setPlungerDelayDuration(String plungerDelayDuration) {
this.plungerDelayDuration = this.timingValidate(plungerDelayDuration, "plungerDelayDuration");
}
}

View File

@ -37,7 +37,7 @@ CREATE TABLE `$TableName$`
`flow_voltage_min_value` decimal(10, 2) NULL DEFAULT NULL COMMENT '流量最小电压',
`flow_voltage_max_value` decimal(10, 2) NULL DEFAULT NULL COMMENT '流量最大电压',
`continuous_sampling_interval_duration` int NULL DEFAULT NULL COMMENT '连续采样间隔',
`sensor_signal_effective_level` int NULL DEFAULT NULL COMMENT '到达传感器有效电平',
`sensor_signal_effective_level` decimal(10, 2) NULL DEFAULT NULL COMMENT '到达传感器有效电平',
`pressure_compensation_polarity_flag` int NULL DEFAULT NULL COMMENT '套压补偿极性',
`pressure_compensation_value_setting` int NULL DEFAULT NULL COMMENT '套压补偿值',
`oil_pressure_compensation_polarity_flag` int NULL DEFAULT NULL COMMENT '油压补偿极性',