1.暂降高级类型原因调用dll报错问题
This commit is contained in:
@@ -67,7 +67,9 @@ public interface QvvrCauseDLL extends Library {
|
|||||||
|
|
||||||
// 创建临时文件
|
// 创建临时文件
|
||||||
String tempDir = System.getProperty("java.io.tmpdir");
|
String tempDir = System.getProperty("java.io.tmpdir");
|
||||||
File tempLibFile = new File(tempDir, "qvvr_" + System.currentTimeMillis() + "_" + libFileName);
|
File tempLibFile = new File(tempDir, libFileName);
|
||||||
|
|
||||||
|
//File tempLibFile = new File(tempDir, "qvvr_" + System.currentTimeMillis() + "_" + libFileName);
|
||||||
|
|
||||||
// 提取库文件到临时目录
|
// 提取库文件到临时目录
|
||||||
try (FileOutputStream out = new FileOutputStream(tempLibFile)) {
|
try (FileOutputStream out = new FileOutputStream(tempLibFile)) {
|
||||||
|
|||||||
@@ -1,14 +1,11 @@
|
|||||||
package com.njcn.advance.event.service.impl;
|
package com.njcn.advance.event.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.njcn.advance.event.cause.core.VoltageSagAnalyzer;
|
|
||||||
import com.njcn.advance.event.cause.jna.QvvrCauseDLL;
|
import com.njcn.advance.event.cause.jna.QvvrCauseDLL;
|
||||||
import com.njcn.advance.event.cause.model.AnalysisResult;
|
|
||||||
import com.njcn.advance.event.cause.model.DataFeature;
|
import com.njcn.advance.event.cause.model.DataFeature;
|
||||||
import com.njcn.advance.event.cause.model.QvvrDataStruct;
|
import com.njcn.advance.event.type.jna.*;
|
||||||
import com.njcn.advance.pojo.dto.EventAnalysisDTO;
|
import com.njcn.advance.pojo.dto.EventAnalysisDTO;
|
||||||
import com.njcn.advance.event.service.IEventAdvanceService;
|
import com.njcn.advance.event.service.IEventAdvanceService;
|
||||||
import com.njcn.advance.event.type.jna.QvvrDLL;
|
|
||||||
import com.njcn.common.config.GeneralInfo;
|
import com.njcn.common.config.GeneralInfo;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.event.file.component.WaveFileComponent;
|
import com.njcn.event.file.component.WaveFileComponent;
|
||||||
@@ -89,8 +86,55 @@ public class EventAdvanceServiceImpl implements IEventAdvanceService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
List<List<Float>> listWaveData = waveDataDTO.getListWaveData();
|
List<List<Float>> listWaveData = waveDataDTO.getListWaveData();
|
||||||
|
// 暂降类型
|
||||||
|
// 创建数据结构
|
||||||
|
QvvrDLL.QvvrDataStruct typeDataStruct = new QvvrDLL.QvvrDataStruct();
|
||||||
|
System.out.println("初始化qvvrdll成功-----------");
|
||||||
|
typeDataStruct.smp_rate = waveDataDTO.getComtradeCfgDTO().getFinalSampleRate();
|
||||||
|
System.out.println("采样率-----------" + typeDataStruct.smp_rate);
|
||||||
|
typeDataStruct.smp_len = listWaveData.size();
|
||||||
|
System.out.println("波形长度-----------" + listWaveData.size());
|
||||||
|
|
||||||
|
// 获取ABC三相的瞬时数据
|
||||||
|
for (int i = 0; i < listWaveData.size(); i++) {
|
||||||
|
typeDataStruct.smp_va[i] = listWaveData.get(i).get(1);
|
||||||
|
typeDataStruct.smp_vb[i] = listWaveData.get(i).get(2);
|
||||||
|
typeDataStruct.smp_vc[i] = listWaveData.get(i).get(3);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 执行算法分析 - 直接调用C DLL
|
||||||
|
try {
|
||||||
|
QvvrDLL.INSTANCE.qvvr_fun(typeDataStruct);
|
||||||
|
System.out.println("调用qvvrdll成功-----------");
|
||||||
|
|
||||||
|
if (typeDataStruct.evt_num > 0) {
|
||||||
|
// 全局比较找出最小三相电压特征值
|
||||||
|
float globalMinVoltage = Float.MAX_VALUE;
|
||||||
|
int globalFaultType = 10;
|
||||||
|
for (int i = 0; i < typeDataStruct.evt_num; i++) {
|
||||||
|
QvvrDLL.EventBuffer evt = typeDataStruct.evt_buf[i];
|
||||||
|
for (int j = 0; j < evt.u_min_num; j++) {
|
||||||
|
float u3min = evt.u3_min[j];
|
||||||
|
if (u3min < globalMinVoltage) {
|
||||||
|
globalMinVoltage = u3min;
|
||||||
|
globalFaultType = evt.qvvr_cata_type[j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
eventAnalysis.setType(globalFaultType);
|
||||||
|
} else {
|
||||||
|
eventAnalysis.setType(DataFeature.TYPE10);
|
||||||
|
}
|
||||||
|
System.out.println("结束qvvrdll方法调用-----------");
|
||||||
|
} catch (Exception e) {
|
||||||
|
eventAnalysis.setType(DataFeature.TYPE10);
|
||||||
|
eventAnalysis.setTypeFlag(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// 暂降原因JNA的方式
|
// 暂降原因JNA的方式
|
||||||
com.njcn.advance.event.cause.jna.QvvrCauseDLL.QvvrDataStruct causeDataStruct = new com.njcn.advance.event.cause.jna.QvvrCauseDLL.QvvrDataStruct();
|
QvvrCauseDLL.QvvrDataStruct causeDataStruct = new QvvrCauseDLL.QvvrDataStruct();
|
||||||
causeDataStruct.smp_rate = waveDataDTO.getComtradeCfgDTO().getFinalSampleRate();
|
causeDataStruct.smp_rate = waveDataDTO.getComtradeCfgDTO().getFinalSampleRate();
|
||||||
causeDataStruct.smp_len = listWaveData.size();
|
causeDataStruct.smp_len = listWaveData.size();
|
||||||
// 获取ABC三相的瞬时数据
|
// 获取ABC三相的瞬时数据
|
||||||
@@ -112,45 +156,6 @@ public class EventAdvanceServiceImpl implements IEventAdvanceService {
|
|||||||
}
|
}
|
||||||
System.out.println("暂降原因分析完毕===============");
|
System.out.println("暂降原因分析完毕===============");
|
||||||
System.out.println("cause:" + eventAnalysis);
|
System.out.println("cause:" + eventAnalysis);
|
||||||
|
|
||||||
// 暂降类型
|
|
||||||
// 创建数据结构
|
|
||||||
// com.njcn.advance.event.type.jna.QvvrDLL.QvvrDataStruct typeDataStruct = new com.njcn.advance.event.type.jna.QvvrDLL.QvvrDataStruct();
|
|
||||||
// typeDataStruct.smp_rate = waveDataDTO.getComtradeCfgDTO().getFinalSampleRate();
|
|
||||||
// typeDataStruct.smp_len = listWaveData.size();
|
|
||||||
// // 获取ABC三相的瞬时数据
|
|
||||||
// for (int i = 0; i < listWaveData.size(); i++) {
|
|
||||||
// typeDataStruct.smp_va[i] = listWaveData.get(i).get(1);
|
|
||||||
// typeDataStruct.smp_vb[i] = listWaveData.get(i).get(2);
|
|
||||||
// typeDataStruct.smp_vc[i] = listWaveData.get(i).get(3);
|
|
||||||
// }
|
|
||||||
// // 执行算法分析 - 直接调用C DLL
|
|
||||||
// try {
|
|
||||||
// QvvrDLL.INSTANCE.qvvr_fun(typeDataStruct);
|
|
||||||
// if (typeDataStruct.evt_num > 0) {
|
|
||||||
// // 全局比较找出最小三相电压特征值
|
|
||||||
// float globalMinVoltage = Float.MAX_VALUE;
|
|
||||||
// int globalFaultType = 10;
|
|
||||||
// for (int i = 0; i < typeDataStruct.evt_num; i++) {
|
|
||||||
// QvvrDLL.EventBuffer evt = typeDataStruct.evt_buf[i];
|
|
||||||
// for (int j = 0; j < evt.u_min_num; j++) {
|
|
||||||
// float u3min = evt.u3_min[j];
|
|
||||||
// if (u3min < globalMinVoltage) {
|
|
||||||
// globalMinVoltage = u3min;
|
|
||||||
// globalFaultType = evt.qvvr_cata_type[j];
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// eventAnalysis.setType(globalFaultType);
|
|
||||||
// } else {
|
|
||||||
// eventAnalysis.setType(DataFeature.TYPE10);
|
|
||||||
// }
|
|
||||||
// } catch (Exception e) {
|
|
||||||
// eventAnalysis.setType(DataFeature.TYPE10);
|
|
||||||
// eventAnalysis.setTypeFlag(0);
|
|
||||||
// }
|
|
||||||
return eventAnalysis;
|
return eventAnalysis;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,7 +65,9 @@ public interface QvvrDLL extends Library {
|
|||||||
|
|
||||||
// 创建临时文件
|
// 创建临时文件
|
||||||
String tempDir = System.getProperty("java.io.tmpdir");
|
String tempDir = System.getProperty("java.io.tmpdir");
|
||||||
File tempLibFile = new File(tempDir, "qvvr_" + System.currentTimeMillis() + "_" + libFileName);
|
File tempLibFile = new File(tempDir, libFileName);
|
||||||
|
|
||||||
|
// File tempLibFile = new File(tempDir, "qvvr_" + System.currentTimeMillis() + "_" + libFileName);
|
||||||
|
|
||||||
// 提取库文件到临时目录
|
// 提取库文件到临时目录
|
||||||
try (FileOutputStream out = new FileOutputStream(tempLibFile)) {
|
try (FileOutputStream out = new FileOutputStream(tempLibFile)) {
|
||||||
@@ -95,6 +97,8 @@ public interface QvvrDLL extends Library {
|
|||||||
*/
|
*/
|
||||||
void qvvr_fun(QvvrDataStruct data);
|
void qvvr_fun(QvvrDataStruct data);
|
||||||
|
|
||||||
|
void ping();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 对应C语言的qvvr_data_struct结构体
|
* 对应C语言的qvvr_data_struct结构体
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -854,6 +854,21 @@ public class EventRelevantAnalysisServiceImpl extends ServiceImpl<RmpEventAdvanc
|
|||||||
/*************************************************************************************
|
/*************************************************************************************
|
||||||
* 获取变压器信息并生成矩阵
|
* 获取变压器信息并生成矩阵
|
||||||
*************************************************************************************/
|
*************************************************************************************/
|
||||||
|
public Map<String, Map<String, Integer>> getNodeBefore(){
|
||||||
|
Map<String, EntityMtrans> entityMtranMap = new HashMap<>(32);
|
||||||
|
|
||||||
|
HandleEvent handleEvent = new HandleEvent();
|
||||||
|
List<EntityLogic> list = relevantLogMapper.getLogic();
|
||||||
|
Map<String, Map<String, Integer>> setNodeSort = new HashMap<>();
|
||||||
|
if (CollectionUtil.isNotEmpty(list)) {
|
||||||
|
Map<String, List<String>> map = getLogicInfo(list);
|
||||||
|
setNodeSort = nodeSort(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
return setNodeSort;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public Map<String, EntityMtrans> getNodeInfo( ) {
|
public Map<String, EntityMtrans> getNodeInfo( ) {
|
||||||
Map<String, EntityMtrans> entityMtranMap = new HashMap<>(32);
|
Map<String, EntityMtrans> entityMtranMap = new HashMap<>(32);
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -147,6 +147,8 @@ public enum DicDataTypeEnum {
|
|||||||
Major_Nonlinear_Device("主要非线性设备类型","Major_Nonlinear_Device"),
|
Major_Nonlinear_Device("主要非线性设备类型","Major_Nonlinear_Device"),
|
||||||
EVALUATION_DEPT("主要非线性设备类型","evaluation_dept"),
|
EVALUATION_DEPT("主要非线性设备类型","evaluation_dept"),
|
||||||
EVALUATION_TYPE("评估类型","Evaluation_Type"),
|
EVALUATION_TYPE("评估类型","Evaluation_Type"),
|
||||||
|
|
||||||
|
DATA_DAY("日表表名","Data_Day")
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user