代码调整
This commit is contained in:
11
pom.xml
11
pom.xml
@@ -108,6 +108,7 @@
|
|||||||
<mqtt.version>1.2.7</mqtt.version>
|
<mqtt.version>1.2.7</mqtt.version>
|
||||||
<easypoi.version>4.4.0</easypoi.version>
|
<easypoi.version>4.4.0</easypoi.version>
|
||||||
<spring-cloud-huawei.version>1.7.0-Hoxton</spring-cloud-huawei.version>
|
<spring-cloud-huawei.version>1.7.0-Hoxton</spring-cloud-huawei.version>
|
||||||
|
<fastjson.version>1.2.83</fastjson.version>
|
||||||
</properties>
|
</properties>
|
||||||
<dependencyManagement>
|
<dependencyManagement>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
@@ -390,6 +391,16 @@
|
|||||||
<artifactId>influxdb-java</artifactId>
|
<artifactId>influxdb-java</artifactId>
|
||||||
<version>${influxdb-java.version}</version>
|
<version>${influxdb-java.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba</groupId>
|
||||||
|
<artifactId>fastjson</artifactId>
|
||||||
|
<version>${fastjson.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.logging.log4j</groupId>
|
||||||
|
<artifactId>log4j-api</artifactId>
|
||||||
|
<version>2.18.0</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
@@ -48,8 +48,9 @@ public class WaveFileComponent {
|
|||||||
ComtradeCfgDTO comtradeCfgDTO = getComtradeCfg(cfgStream);
|
ComtradeCfgDTO comtradeCfgDTO = getComtradeCfg(cfgStream);
|
||||||
// 为空或者未找到结束符号
|
// 为空或者未找到结束符号
|
||||||
if (comtradeCfgDTO == null || !"BINARY".equalsIgnoreCase(comtradeCfgDTO.getStrBinType())) {
|
if (comtradeCfgDTO == null || !"BINARY".equalsIgnoreCase(comtradeCfgDTO.getStrBinType())) {
|
||||||
return waveDataDTO;
|
throw new BusinessException(WaveFileResponseEnum.CFG_DATA_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****根据通道号计算相别** add by yexb -----Start****
|
/*****根据通道号计算相别** add by yexb -----Start****
|
||||||
* 1、判断是否是3的倍数,是3的倍数则是3相
|
* 1、判断是否是3的倍数,是3的倍数则是3相
|
||||||
* 2、假如不是3的倍数 ,是1的倍数则是单相
|
* 2、假如不是3的倍数 ,是1的倍数则是单相
|
||||||
@@ -59,16 +60,22 @@ public class WaveFileComponent {
|
|||||||
} else {
|
} else {
|
||||||
comtradeCfgDTO.setNPhasic(1);
|
comtradeCfgDTO.setNPhasic(1);
|
||||||
}
|
}
|
||||||
// 给相别幅值
|
|
||||||
|
// 给相别数量赋值
|
||||||
waveDataDTO.setIPhasic(comtradeCfgDTO.getNPhasic());
|
waveDataDTO.setIPhasic(comtradeCfgDTO.getNPhasic());
|
||||||
|
|
||||||
// 组装解析抬头
|
// 组装解析抬头
|
||||||
getWaveTitle(waveDataDTO,comtradeCfgDTO);
|
getWaveTitle(waveDataDTO, comtradeCfgDTO);
|
||||||
|
|
||||||
// 解析.dat文件
|
// 解析.dat文件
|
||||||
List<List<Float>> listWaveData = getComtradeDat(comtradeCfgDTO, datStream, iType);
|
List<List<Float>> listWaveData = getComtradeDat(comtradeCfgDTO, datStream, iType);
|
||||||
|
|
||||||
waveDataDTO.setComtradeCfgDTO(comtradeCfgDTO);
|
waveDataDTO.setComtradeCfgDTO(comtradeCfgDTO);
|
||||||
|
|
||||||
waveDataDTO.setListWaveData(listWaveData);
|
waveDataDTO.setListWaveData(listWaveData);
|
||||||
|
|
||||||
//add by hongawen,将暂态触发起始时间记录下来
|
//add by hongawen,将暂态触发起始时间记录下来
|
||||||
waveDataDTO.setTime(DateUtil.format(comtradeCfgDTO.getFirstTime(), DatePattern.NORM_DATETIME_PATTERN).concat(StrPool.DOT)+comtradeCfgDTO.getFirstMs());
|
waveDataDTO.setTime(DateUtil.format(comtradeCfgDTO.getTimeTrige(),DatePattern.NORM_DATETIME_MS_PATTERN));
|
||||||
/*****根据通道号计算相别** add by yexb -----end****/
|
/*****根据通道号计算相别** add by yexb -----end****/
|
||||||
|
|
||||||
return waveDataDTO;
|
return waveDataDTO;
|
||||||
@@ -298,7 +305,7 @@ public class WaveFileComponent {
|
|||||||
// 瞬时波形值
|
// 瞬时波形值
|
||||||
List<List<Float>> lstWave = waveDataDTO.getListWaveData();
|
List<List<Float>> lstWave = waveDataDTO.getListWaveData();
|
||||||
//获取最终采样率
|
//获取最终采样率
|
||||||
Long finalSampleRate = comtradeCfgDTO.getFinalSampleRate();
|
int finalSampleRate = comtradeCfgDTO.getFinalSampleRate();
|
||||||
// 返回值
|
// 返回值
|
||||||
List<EigenvalueDTO> lstEigenvalueDTO = new ArrayList<>();
|
List<EigenvalueDTO> lstEigenvalueDTO = new ArrayList<>();
|
||||||
|
|
||||||
@@ -346,41 +353,25 @@ public class WaveFileComponent {
|
|||||||
**********************************/
|
**********************************/
|
||||||
private ComtradeCfgDTO getComtradeCfg(InputStream cfgStream) {
|
private ComtradeCfgDTO getComtradeCfg(InputStream cfgStream) {
|
||||||
ComtradeCfgDTO comtradeCfgDTO = new ComtradeCfgDTO();
|
ComtradeCfgDTO comtradeCfgDTO = new ComtradeCfgDTO();
|
||||||
InputStreamReader read = null;
|
try (
|
||||||
BufferedReader bufferedReader = null;
|
InputStreamReader read = new InputStreamReader(cfgStream, CharsetUtil.CHARSET_GBK);
|
||||||
try {
|
BufferedReader bufferedReader = new BufferedReader(read);
|
||||||
// 将.cfg文件转换为管道流
|
) {
|
||||||
read = new InputStreamReader(cfgStream, CharsetUtil.CHARSET_GBK);
|
|
||||||
bufferedReader = new BufferedReader(read);
|
|
||||||
//WW 2019-11-14
|
|
||||||
float nFreq;
|
|
||||||
// 第一行不关心仅仅是一些描述类的信息
|
// 第一行不关心仅仅是一些描述类的信息
|
||||||
String strFileLine = bufferedReader.readLine();
|
String strFileLine = bufferedReader.readLine();
|
||||||
|
|
||||||
// 第二行需要关心第二个(模拟量的个数)和第三个参数(开关量的个数)
|
// 第二行需要关心第二个(模拟量的个数)和第三个参数(开关量的个数)
|
||||||
strFileLine = bufferedReader.readLine();
|
strFileLine = bufferedReader.readLine();
|
||||||
// 按“,”进行分割
|
// 按“,”进行分割
|
||||||
String[] strTempArray = strFileLine.split(StrUtil.COMMA);
|
String[] strTempArray = strFileLine.split(StrUtil.COMMA);
|
||||||
// 按“,”进行分割
|
|
||||||
for (int i = 0; i < strTempArray.length; i++) {
|
|
||||||
switch (i) {
|
|
||||||
// 总个数
|
// 总个数
|
||||||
case 0:
|
comtradeCfgDTO.setNChannelNum(Integer.parseInt(strTempArray[0]));
|
||||||
comtradeCfgDTO.setNChannelNum(Integer.parseInt(strTempArray[i]));
|
|
||||||
break;
|
|
||||||
// 模拟量的个数
|
// 模拟量的个数
|
||||||
case 1:
|
comtradeCfgDTO.setNAnalogNum(Integer.parseInt(strTempArray[1].substring(0, strTempArray[1].length() - 1)));
|
||||||
comtradeCfgDTO.setNAnalogNum(Integer.parseInt(strTempArray[i].substring(0, strTempArray[i].length() - 1)));
|
|
||||||
break;
|
|
||||||
// 开关量的个数
|
// 开关量的个数
|
||||||
case 2:
|
comtradeCfgDTO.setNDigitalNum(Integer.parseInt(strTempArray[2].substring(0, strTempArray[2].length() - 1)));
|
||||||
comtradeCfgDTO.setNDigitalNum(Integer.parseInt(strTempArray[i].substring(0, strTempArray[i].length() - 1)));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 从第三行到第ComtradeCfg.nChannelNum + 3行是模拟量通道和数字量通道
|
// 从第三行开始的ComtradeCfg.nChannelNum行是模拟量通道和数字量通道
|
||||||
List<AnalogDTO> lstAnalogDTO = new ArrayList<>();
|
List<AnalogDTO> lstAnalogDTO = new ArrayList<>();
|
||||||
comtradeCfgDTO.setLstAnalogDTO(lstAnalogDTO);
|
comtradeCfgDTO.setLstAnalogDTO(lstAnalogDTO);
|
||||||
for (int i = 0; i < comtradeCfgDTO.getNChannelNum(); i++) {
|
for (int i = 0; i < comtradeCfgDTO.getNChannelNum(); i++) {
|
||||||
@@ -388,104 +379,76 @@ public class WaveFileComponent {
|
|||||||
lstAnalogDTO.add(analogDTO);
|
lstAnalogDTO.add(analogDTO);
|
||||||
strFileLine = bufferedReader.readLine();
|
strFileLine = bufferedReader.readLine();
|
||||||
strTempArray = strFileLine.split(StrUtil.COMMA);
|
strTempArray = strFileLine.split(StrUtil.COMMA);
|
||||||
// 配置总共13项
|
//通道序号
|
||||||
for (int j = 0; j < strTempArray.length; j++) {
|
analogDTO.setNIndex(Integer.parseInt(strTempArray[0]));
|
||||||
switch (j) {
|
|
||||||
// 通道序号
|
|
||||||
case 0:
|
|
||||||
analogDTO.setNIndex(Integer.parseInt(strTempArray[j]));
|
|
||||||
break;
|
|
||||||
// 通道名称
|
// 通道名称
|
||||||
case 1:
|
analogDTO.setSzChannleName(strTempArray[1]);
|
||||||
analogDTO.setSzChannleName(strTempArray[j]);
|
|
||||||
break;
|
|
||||||
// 相位名称
|
// 相位名称
|
||||||
case 2:
|
analogDTO.setSzPhasicName(strTempArray[2]);
|
||||||
analogDTO.setSzPhasicName(strTempArray[j]);
|
|
||||||
break;
|
|
||||||
// 监视的通道名称
|
// 监视的通道名称
|
||||||
case 3:
|
analogDTO.setSzMonitoredChannleName(strTempArray[3]);
|
||||||
analogDTO.setSzMonitoredChannleName(strTempArray[j]);
|
|
||||||
break;
|
|
||||||
// 通道的单位
|
// 通道的单位
|
||||||
case 4:
|
analogDTO.setSzUnitName(strTempArray[4]);
|
||||||
analogDTO.setSzUnitName(strTempArray[j]);
|
|
||||||
break;
|
|
||||||
// 通道的系数
|
// 通道的系数
|
||||||
case 5:
|
analogDTO.setFCoefficent(Float.parseFloat(strTempArray[5]));
|
||||||
analogDTO.setFCoefficent(Float.parseFloat(strTempArray[j]));
|
|
||||||
break;
|
|
||||||
// 通道的偏移量
|
// 通道的偏移量
|
||||||
case 6:
|
analogDTO.setFOffset(Float.parseFloat(strTempArray[6]));
|
||||||
analogDTO.setFOffset(Float.parseFloat(strTempArray[j]));
|
|
||||||
break;
|
|
||||||
// 起始采样时间的偏移量
|
// 起始采样时间的偏移量
|
||||||
case 7:
|
analogDTO.setFTimeOffset(Float.parseFloat(strTempArray[7]));
|
||||||
analogDTO.setFTimeOffset(Float.parseFloat(strTempArray[j]));
|
|
||||||
break;
|
|
||||||
// 采样值的最小值
|
// 采样值的最小值
|
||||||
case 8:
|
analogDTO.setNMin(Integer.parseInt(strTempArray[8]));
|
||||||
analogDTO.setNMin(Integer.parseInt(strTempArray[j]));
|
|
||||||
break;
|
|
||||||
// 采样值的最大值
|
// 采样值的最大值
|
||||||
case 9:
|
analogDTO.setNMax(Integer.parseInt(strTempArray[9]));
|
||||||
analogDTO.setNMax(Integer.parseInt(strTempArray[j]));
|
|
||||||
break;
|
|
||||||
// 一次变比
|
// 一次变比
|
||||||
case 10:
|
analogDTO.setFPrimary(Float.parseFloat(strTempArray[10]));
|
||||||
analogDTO.setFPrimary(Float.parseFloat(strTempArray[j]));
|
|
||||||
break;
|
|
||||||
// 二次变比
|
// 二次变比
|
||||||
case 11:
|
analogDTO.setFSecondary(Float.parseFloat(strTempArray[11]));
|
||||||
analogDTO.setFSecondary(Float.parseFloat(strTempArray[j]));
|
|
||||||
break;
|
|
||||||
// 一次值还是二次值标志
|
// 一次值还是二次值标志
|
||||||
case 12:
|
analogDTO.setSzValueType(strTempArray[12]);
|
||||||
analogDTO.setSzValueType(strTempArray[j]);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//WW 2019-11-14 // 采样频率
|
//WW 2019-11-14 // 采样频率
|
||||||
nFreq = Float.parseFloat(bufferedReader.readLine());
|
int nFreq = Integer.parseInt(bufferedReader.readLine());
|
||||||
|
|
||||||
// 获取采样段数
|
// 获取采样段数
|
||||||
strFileLine = bufferedReader.readLine();
|
strFileLine = bufferedReader.readLine();
|
||||||
int nRates = Integer.parseInt(strFileLine);
|
int nRates = Integer.parseInt(strFileLine);
|
||||||
comtradeCfgDTO.setNRates(nRates);
|
comtradeCfgDTO.setNRates(nRates);
|
||||||
// 获得每段的采样率 //采样率
|
// 获得每段的采样率 //采样率
|
||||||
List<RateDTO> lstRate = new ArrayList<>();
|
List<RateDTO> lstRate = new ArrayList<>();
|
||||||
long nOffset = 0;
|
int nOffset = 0;
|
||||||
for (int i = 0; i < nRates; i++) {
|
for (int i = 0; i < nRates; i++) {
|
||||||
strFileLine = bufferedReader.readLine();
|
strFileLine = bufferedReader.readLine();
|
||||||
strTempArray = strFileLine.split(StrUtil.COMMA);
|
strTempArray = strFileLine.split(StrUtil.COMMA);
|
||||||
RateDTO rateDTO = new RateDTO();
|
RateDTO rateDTO = new RateDTO();
|
||||||
// 单周波采样点数 //WW 2019-11-14
|
// 单周波采样点数 //WW 2019-11-14
|
||||||
rateDTO.setNOneSample((long) (Float.parseFloat(strTempArray[0]) / nFreq));
|
rateDTO.setNOneSample((Integer.parseInt(strTempArray[0]) / nFreq));
|
||||||
// 总点数 //这里的strTemp是一个偏移量
|
// 总点数 //这里的strTemp是一个偏移量
|
||||||
rateDTO.setNSampleNum((long) (Float.parseFloat(strTempArray[1]) - nOffset));
|
rateDTO.setNSampleNum((Integer.parseInt(strTempArray[1]) - nOffset));
|
||||||
lstRate.add(rateDTO);
|
lstRate.add(rateDTO);
|
||||||
}
|
}
|
||||||
comtradeCfgDTO.setLstRate(lstRate);
|
comtradeCfgDTO.setLstRate(lstRate);
|
||||||
// 增加读取波形起始时间个结束时间
|
// 增加读取波形起始时间个结束时间
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss.SSS");
|
String timeFormat = "dd/MM/yyyy,HH:mm:ss.SSS";
|
||||||
// 波形起始时间
|
// 波形起始时间
|
||||||
strFileLine = bufferedReader.readLine();
|
strFileLine = bufferedReader.readLine();
|
||||||
strFileLine = strFileLine.substring(0, strFileLine.length() - 3).replace(StrUtil.COMMA, StrUtil.SPACE);
|
strFileLine = strFileLine.substring(0, strFileLine.length() - 3);
|
||||||
comtradeCfgDTO.setTimeStart(sdf.parse(strFileLine));
|
comtradeCfgDTO.setTimeStart(DateUtil.parse(strFileLine, timeFormat));
|
||||||
|
|
||||||
// 暂态触发时间
|
// 暂态触发时间
|
||||||
strFileLine = bufferedReader.readLine();
|
strFileLine = bufferedReader.readLine();
|
||||||
strFileLine = strFileLine.substring(0, strFileLine.length() - 3).replace(StrUtil.COMMA, StrUtil.SPACE);
|
strFileLine = strFileLine.substring(0, strFileLine.length() - 3);
|
||||||
comtradeCfgDTO.setTimeTrige(sdf.parse(strFileLine));
|
comtradeCfgDTO.setTimeTrige(DateUtil.parse(strFileLine, timeFormat));
|
||||||
|
|
||||||
// 获取触发时间的时间 + 毫秒
|
// 获取触发时间的时间 + 毫秒
|
||||||
Calendar calendar = Calendar.getInstance();
|
Calendar calendar = DateUtil.calendar(comtradeCfgDTO.getTimeTrige());
|
||||||
calendar.setTime(comtradeCfgDTO.getTimeTrige());
|
|
||||||
comtradeCfgDTO.setFirstMs(calendar.get(Calendar.MILLISECOND));
|
comtradeCfgDTO.setFirstMs(calendar.get(Calendar.MILLISECOND));
|
||||||
comtradeCfgDTO.setFirstTime(calendar.getTime());
|
comtradeCfgDTO.setFirstTime(calendar.getTime());
|
||||||
|
|
||||||
|
|
||||||
long a = comtradeCfgDTO.getTimeStart().getTime();
|
long a = comtradeCfgDTO.getTimeStart().getTime();
|
||||||
long b = comtradeCfgDTO.getTimeTrige().getTime();
|
long b = comtradeCfgDTO.getTimeTrige().getTime();
|
||||||
|
|
||||||
int c = (int) (b - a);
|
int c = (int) (b - a);
|
||||||
if (c >= 90 && c <= 110) {
|
if (c >= 90 && c <= 110) {
|
||||||
comtradeCfgDTO.setNPush(100);
|
comtradeCfgDTO.setNPush(100);
|
||||||
@@ -497,17 +460,6 @@ public class WaveFileComponent {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// 解析.cfg文件出错
|
// 解析.cfg文件出错
|
||||||
comtradeCfgDTO = null;
|
comtradeCfgDTO = null;
|
||||||
} finally {
|
|
||||||
try {
|
|
||||||
bufferedReader.close();
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new BusinessException(CommonResponseEnum.CLOSE_RESOURCE_ERROR);
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
read.close();
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new BusinessException(CommonResponseEnum.CLOSE_RESOURCE_ERROR);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return comtradeCfgDTO;
|
return comtradeCfgDTO;
|
||||||
}
|
}
|
||||||
@@ -520,9 +472,8 @@ public class WaveFileComponent {
|
|||||||
* List<List<Float>> 返回波形瞬时值
|
* List<List<Float>> 返回波形瞬时值
|
||||||
**********************************/
|
**********************************/
|
||||||
private List<List<Float>> getComtradeDat(ComtradeCfgDTO comtradeCfgDTO, InputStream datStream, int iType) {
|
private List<List<Float>> getComtradeDat(ComtradeCfgDTO comtradeCfgDTO, InputStream datStream, int iType) {
|
||||||
//返回数据
|
//返回数据,如果仅仅做展示后期考虑换String类型,降低内存开销
|
||||||
List<List<Float>> listWaveData = new ArrayList<>();
|
List<List<Float>> listWaveData = new ArrayList<>();
|
||||||
// 波形文件路径由 .cfg 换成 .dat
|
|
||||||
//初始化xValue的值
|
//初始化xValue的值
|
||||||
float xValueAll = 0;
|
float xValueAll = 0;
|
||||||
//判断是否首次登陆
|
//判断是否首次登陆
|
||||||
@@ -531,23 +482,24 @@ public class WaveFileComponent {
|
|||||||
try {
|
try {
|
||||||
datArray = IoUtil.readBytes(datStream);
|
datArray = IoUtil.readBytes(datStream);
|
||||||
if (ArrayUtil.isEmpty(datArray)) {
|
if (ArrayUtil.isEmpty(datArray)) {
|
||||||
return listWaveData;
|
throw new BusinessException(WaveFileResponseEnum.DAT_DATA_ERROR);
|
||||||
}
|
}
|
||||||
// 计算每个单独的数据块的大小 4个字节的序号 4个字节的时间 2个字节的值
|
// 计算每个单独的数据块的大小 4个字节的序号 4个字节的时间 2个字节的值
|
||||||
// 示例中的排布是 4个字节的序号 4个字节的时间 UA(2字节) UB(2字节) UC(2字节) IA(2字节) IB(2字节) IC(2字节)
|
// 示例中的排布是 4个字节的序号 4个字节的时间 UA(2字节) UB(2字节) UC(2字节) IA(2字节) IB(2字节) IC(2字节)
|
||||||
int nDigSize = (comtradeCfgDTO.getNDigitalNum() % 16) > 0 ? (comtradeCfgDTO.getNDigitalNum() / 16 + 1) * 2 : comtradeCfgDTO.getNDigitalNum() / 16 * 2;
|
int nDigSize = (comtradeCfgDTO.getNDigitalNum() % 16) > 0 ? (comtradeCfgDTO.getNDigitalNum() / 16 + 1) * 2 : comtradeCfgDTO.getNDigitalNum() / 16 * 2;
|
||||||
int nBlockSize = 2 * Integer.SIZE / 8 + comtradeCfgDTO.getNAnalogNum() * 2 + nDigSize;
|
int nBlockSize = 2 * Integer.SIZE / 8 + comtradeCfgDTO.getNAnalogNum() * 2 + nDigSize;
|
||||||
// 总长度除以每个快的大小
|
// 总长度除以每个块的大小
|
||||||
int nBlockNum = datArray.length / nBlockSize;
|
int nBlockNum = datArray.length / nBlockSize;
|
||||||
|
|
||||||
// 获取采样率
|
// 获取采样率
|
||||||
long finalSampleRate = getFinalWaveSample(comtradeCfgDTO.getLstRate(), iType);
|
int finalSampleRate = getFinalWaveSample(comtradeCfgDTO.getLstRate(), iType);
|
||||||
if (finalSampleRate != -1) {
|
if (finalSampleRate != -1) {
|
||||||
//设置最终采样率
|
//设置最终采样率
|
||||||
comtradeCfgDTO.setFinalSampleRate(finalSampleRate);
|
comtradeCfgDTO.setFinalSampleRate(finalSampleRate);
|
||||||
// 计算转换后的采样率
|
// 计算转换后的采样率
|
||||||
int nnInd = 0;
|
int nnInd = 0;
|
||||||
// 抽点后总共多少点数据
|
// 抽点后总共多少点数据
|
||||||
long nWaveNum;
|
int nWaveNum;
|
||||||
//抽点后新的的采样率
|
//抽点后新的的采样率
|
||||||
List<RateDTO> newLstRate = new ArrayList<>();
|
List<RateDTO> newLstRate = new ArrayList<>();
|
||||||
for (int iRate = 0; iRate < comtradeCfgDTO.getNRates(); iRate++) {
|
for (int iRate = 0; iRate < comtradeCfgDTO.getNRates(); iRate++) {
|
||||||
@@ -689,14 +641,14 @@ public class WaveFileComponent {
|
|||||||
* @param lstRate cfg中关于采样率参数
|
* @param lstRate cfg中关于采样率参数
|
||||||
* @return 返回最小采样率
|
* @return 返回最小采样率
|
||||||
**********************************/
|
**********************************/
|
||||||
private long getFinalWaveSample(List<RateDTO> lstRate, int iType) {
|
private int getFinalWaveSample(List<RateDTO> lstRate, int iType) {
|
||||||
// 最终返回采样率
|
// 最终返回采样率
|
||||||
long nFinalOneSample = -1;
|
int nFinalOneSample = -1;
|
||||||
// 最小采样率
|
// 最小采样率
|
||||||
long nMinOneSample = -1;
|
int nMinOneSample = -1;
|
||||||
if (lstRate.size() > 0) {
|
if (lstRate.size() > 0) {
|
||||||
nMinOneSample = lstRate.get(0).getNOneSample();
|
nMinOneSample = lstRate.get(0).getNOneSample();
|
||||||
long tmpOneSample;
|
int tmpOneSample;
|
||||||
for (RateDTO rateDTO : lstRate) {
|
for (RateDTO rateDTO : lstRate) {
|
||||||
tmpOneSample = rateDTO.getNOneSample();
|
tmpOneSample = rateDTO.getNOneSample();
|
||||||
if (tmpOneSample >= 32) {
|
if (tmpOneSample >= 32) {
|
||||||
@@ -1276,7 +1228,7 @@ public class WaveFileComponent {
|
|||||||
InputStream cfgStream = waveFileComponent.getFileInputStreamByFilePath("D:\\comtrade\\00-B7-8D-00-B7-25\\1_20200629_164016_234.CFG");
|
InputStream cfgStream = waveFileComponent.getFileInputStreamByFilePath("D:\\comtrade\\00-B7-8D-00-B7-25\\1_20200629_164016_234.CFG");
|
||||||
InputStream datStream = waveFileComponent.getFileInputStreamByFilePath("D:\\comtrade\\00-B7-8D-00-B7-25\\1_20200629_164016_234.DAT");
|
InputStream datStream = waveFileComponent.getFileInputStreamByFilePath("D:\\comtrade\\00-B7-8D-00-B7-25\\1_20200629_164016_234.DAT");
|
||||||
// 获取瞬时波形 //获取原始波形值
|
// 获取瞬时波形 //获取原始波形值
|
||||||
WaveDataDTO waveDataDTO = waveFileComponent.getComtrade(cfgStream,datStream, 1);
|
WaveDataDTO waveDataDTO = waveFileComponent.getComtrade(cfgStream, datStream, 1);
|
||||||
d = new Date();
|
d = new Date();
|
||||||
s = sdf.format(d);
|
s = sdf.format(d);
|
||||||
System.out.println(s);
|
System.out.println(s);
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
package com.njcn.event.file.pojo.dto;
|
package com.njcn.event.file.pojo.dto;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DatePattern;
|
||||||
|
import cn.hutool.core.date.DateTime;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
@@ -18,14 +21,15 @@ import java.util.List;
|
|||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class ComtradeCfgDTO implements Serializable {
|
public class ComtradeCfgDTO implements Serializable {
|
||||||
private Integer nChannelNum;
|
private Integer nChannelNum;//总个数
|
||||||
private Integer nPhasic;// 模拟量通道的个数 yxb 2020-12-15
|
private Integer nPhasic;// 相别的个数 yxb 2020-12-15
|
||||||
private Integer nAnalogNum;// 模拟量通道的个数 WW 2013-05-15
|
private Integer nAnalogNum;// 模拟量通道的个数 WW 2013-05-15
|
||||||
private Integer nDigitalNum;// 数字量通道的个数 WW 2013-05-15
|
private Integer nDigitalNum;// 开关量的个数 WW 2013-05-15
|
||||||
private Date timeStart;// 暂态记录时间 yxb 2022-06-06
|
private Date timeStart;// 暂态记录时间 yxb 2022-06-06
|
||||||
private Date timeTrige;// 暂态触发时间 yxb 2022-06-06
|
private Date timeTrige;// 暂态触发时间 yxb 2022-06-06
|
||||||
|
|
||||||
private List<AnalogDTO> lstAnalogDTO;//模拟量通道记录
|
private List<AnalogDTO> lstAnalogDTO;//模拟量通道记录
|
||||||
|
|
||||||
private List<DigitalDTO> lstDigitalDTO;//数字量通道记录
|
private List<DigitalDTO> lstDigitalDTO;//数字量通道记录
|
||||||
|
|
||||||
public Integer nRates;//对应采样次数
|
public Integer nRates;//对应采样次数
|
||||||
@@ -38,13 +42,16 @@ public class ComtradeCfgDTO implements Serializable {
|
|||||||
// 波形前推周波束
|
// 波形前推周波束
|
||||||
private Integer nPush = 0;
|
private Integer nPush = 0;
|
||||||
// 最终采样率,计算的时候只用一个采样率
|
// 最终采样率,计算的时候只用一个采样率
|
||||||
private Long finalSampleRate;
|
private Integer finalSampleRate;
|
||||||
// 整个波形大小
|
// 整个波形大小
|
||||||
private Long nAllWaveNum = 0L;
|
private Integer nAllWaveNum = 0;
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* 赋值编码格式(二进制)
|
* 赋值编码格式(二进制)
|
||||||
*/
|
*/
|
||||||
private String strBinType;
|
private String strBinType;
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
System.out.println(0/16);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import java.io.Serializable;
|
|||||||
public class RateDTO implements Serializable {
|
public class RateDTO implements Serializable {
|
||||||
|
|
||||||
// 1秒钟内的采样点数
|
// 1秒钟内的采样点数
|
||||||
private Long nOneSample;
|
private Integer nOneSample;
|
||||||
// 总采样点数
|
// 总采样点数
|
||||||
private Long nSampleNum;
|
private Integer nSampleNum;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,8 @@ public enum WaveFileResponseEnum {
|
|||||||
EVENT_NOT_FOUND("A00651","暂降事件或监测点不存在"),
|
EVENT_NOT_FOUND("A00651","暂降事件或监测点不存在"),
|
||||||
ANALYSE_WAVE_NOT_FOUND("A00652","波形文件找不到"),
|
ANALYSE_WAVE_NOT_FOUND("A00652","波形文件找不到"),
|
||||||
WAVE_DATA_INVALID("A00654","波形文件数据缺失"),
|
WAVE_DATA_INVALID("A00654","波形文件数据缺失"),
|
||||||
DAT_DATA_ERROR("A00653","dat文件数据读取失败"),
|
CFG_DATA_ERROR("A00653","CFG文件解析有误"),
|
||||||
|
DAT_DATA_ERROR("A00653","DAT文件数据读取失败"),
|
||||||
RMS_DATA_ERROR("A00653","rms数据读取失败"),
|
RMS_DATA_ERROR("A00653","rms数据读取失败"),
|
||||||
COMPOSE_PIC_ERROR("A00653","合成波形图失败"),
|
COMPOSE_PIC_ERROR("A00653","合成波形图失败"),
|
||||||
;
|
;
|
||||||
|
|||||||
@@ -26,11 +26,11 @@
|
|||||||
<artifactId>pq-device-boot</artifactId>
|
<artifactId>pq-device-boot</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!--<dependency>
|
<!-- <dependency>-->
|
||||||
<groupId>com.njcn</groupId>
|
<!-- <groupId>com.njcn</groupId>-->
|
||||||
<artifactId>pms-device-boot</artifactId>
|
<!-- <artifactId>pms-device-boot</artifactId>-->
|
||||||
<version>${project.version}</version>
|
<!-- <version>${project.version}</version>-->
|
||||||
</dependency>-->
|
<!-- </dependency>-->
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.njcn</groupId>
|
<groupId>com.njcn</groupId>
|
||||||
|
|||||||
Reference in New Issue
Block a user