From bff89bede0b78c8f90e6303b9fa5b394d2e29362 Mon Sep 17 00:00:00 2001 From: hongawen <83944980@qq.com> Date: Mon, 18 May 2026 16:42:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wave/component/WaveFileComponent.java | 44 ++++++++++++++++--- 1 file changed, 39 insertions(+), 5 deletions(-) diff --git a/tools/wave-tool/src/main/java/com/njcn/gather/tool/wave/component/WaveFileComponent.java b/tools/wave-tool/src/main/java/com/njcn/gather/tool/wave/component/WaveFileComponent.java index daa3495..09b14b7 100644 --- a/tools/wave-tool/src/main/java/com/njcn/gather/tool/wave/component/WaveFileComponent.java +++ b/tools/wave-tool/src/main/java/com/njcn/gather/tool/wave/component/WaveFileComponent.java @@ -17,6 +17,8 @@ import java.io.*; import java.math.BigDecimal; import java.math.RoundingMode; import java.nio.file.Files; +import java.text.DateFormat; +import java.text.SimpleDateFormat; import java.util.*; @@ -45,7 +47,7 @@ public class WaveFileComponent { throw new BusinessException(WaveFileResponseEnum.CFG_DATA_ERROR); } - + if (comtradeCfgDTO.getNAnalogNum() % 3 == 0) { comtradeCfgDTO.setNPhasic(3); } else { @@ -63,7 +65,7 @@ public class WaveFileComponent { waveDataDTO.setListWaveData(listWaveData); waveDataDTO.setTime(DateUtil.format(comtradeCfgDTO.getTimeTrige(), DatePattern.NORM_DATETIME_MS_PATTERN)); - + return waveDataDTO; } @@ -81,7 +83,7 @@ public class WaveFileComponent { } int halfTs = comtradeCfgDTO.getFinalSampleRate().intValue(); - + double iWave; int nPhasic; List> listRmsMin = new ArrayList<>(); @@ -712,7 +714,7 @@ public class WaveFileComponent { } } } - + switch (iType) { case 0: if (nMinOneSample < 32) { @@ -813,7 +815,7 @@ public class WaveFileComponent { } } int nSJ = comtradeCfgDTO.getFinalSampleRate().intValue(); - + List lstEigenvalueDTO = new ArrayList<>(); for (int i = 0; i < 3; i++) { EigenvalueDTO eigenvalueDTO = new EigenvalueDTO(); @@ -1088,6 +1090,38 @@ public class WaveFileComponent { private int tableIndex; } + public static void main(String[] args) { + /******************************************************** + * iFlag == 0 高级算法的要求,采样率只能是32-128 + * iFlag == 1 普通展示,采样率按照cfg里面最小的(大于32) + * iFlag == 2 App抽点要求,采样率抽点成32 + * iFlag == 3 高级算法原始波形(大于32) + ********************************************************/ + /** 输出格式: 2014-5-05 00:00:00 大写H为24小时制 */ + DateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String s; + Date d = new Date(); + s = sdf.format(d); + System.out.println(s); + WaveFileComponent waveFileComponent = new WaveFileComponent(); + InputStream cfgStream = waveFileComponent.getFileInputStreamByFilePath("C:\\Users\\Administrator\\Desktop\\wave\\PQMonitor_PQM1_000062_20260501_053729_063_WAV.cfg"); + InputStream datStream = waveFileComponent.getFileInputStreamByFilePath("C:\\Users\\Administrator\\Desktop\\wave\\PQMonitor_PQM1_000062_20260501_053729_063_WAV.dat"); + // 获取瞬时波形 //获取原始波形值 + WaveDataDTO waveDataDTO = waveFileComponent.getComtrade(cfgStream, datStream, 1); + d = new Date(); + s = sdf.format(d); + System.out.println(s); + // 获取RMS波形 + WaveDataDTO waveDataDTO1 = waveFileComponent.getValidData(waveDataDTO); + d = new Date(); + s = sdf.format(d); + System.out.println(s); + // 获取特征值 + List lstEigenvalueDTO = waveFileComponent.getEigenvalue(waveDataDTO, true); + System.out.println(1); + } + + }