离线数据上传第一版代码提交
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
package com.njcn.csdevice.constant;
|
||||
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
@@ -42,4 +42,15 @@ public interface DataParam {
|
||||
|
||||
String evtData = "evt_data";
|
||||
|
||||
String wlRecordPath = "test/";
|
||||
|
||||
//中断标志
|
||||
List<Integer> intrStr = Arrays.asList(0,26,40,54,68,82);
|
||||
//暂降标志
|
||||
List<Integer> dipStr = Arrays.asList(1,27,41,55,69,83);
|
||||
//暂升标志
|
||||
List<Integer> swlStr = Arrays.asList(13,36,50,64,78,92);
|
||||
|
||||
String wlRecordUpload = "Offline_Data_Upload";
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.njcn.csdevice.param;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author gfh
|
||||
* @version 1.0.0
|
||||
* @createTime 2024/7/19
|
||||
*/
|
||||
@Data
|
||||
public class UploadDataParam {
|
||||
|
||||
@ApiModelProperty("设备ID")
|
||||
private String devId;
|
||||
|
||||
@ApiModelProperty("监测点ID")
|
||||
private String lineId;
|
||||
|
||||
@ApiModelProperty("文件集合")
|
||||
List<MultipartFile> files = new ArrayList<>();
|
||||
|
||||
@ApiModelProperty("文件对应的目录")
|
||||
List<String> paths = new ArrayList<>();
|
||||
|
||||
}
|
||||
@@ -27,6 +27,11 @@ public class PortableOfflLog extends BaseEntity {
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 文件路径(上传的文件夹路径)
|
||||
*/
|
||||
private String path;
|
||||
|
||||
/**
|
||||
* 文件路径
|
||||
*/
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.njcn.csdevice.pojo.param.WlRecordTemplete;
|
||||
import com.njcn.csdevice.pojo.po.PortableOfflLog;
|
||||
import com.njcn.csdevice.service.IPortableOfflLogService;
|
||||
import com.njcn.csdevice.utils.ExcelStyleUtil;
|
||||
import com.njcn.csdevice.param.UploadDataParam;
|
||||
import com.njcn.poi.excel.ExcelUtil;
|
||||
import com.njcn.poi.util.PoiUtil;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
@@ -20,15 +21,20 @@ import com.njcn.web.pojo.param.BaseParam;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springframework.web.multipart.support.StandardMultipartHttpServletRequest;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@@ -75,12 +81,23 @@ public class PortableOfflLogController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@ApiOperation("批量导入便携式设备信息")
|
||||
@PostMapping(value = "importEquipment")
|
||||
public HttpResult<String> importEquipment(@ApiParam(value = "文件", required = true) @RequestPart("file") MultipartFile file, HttpServletResponse response) {
|
||||
public HttpResult<String> importEquipment(@RequestParam("devId") String devId
|
||||
, @RequestParam("lineId") String lineId, @RequestParam("paths") String paths,HttpServletRequest request) {
|
||||
String methodDescribe = getMethodDescribe("importEquipment");
|
||||
iPortableOfflLogService.importEquipment(file, response);
|
||||
UploadDataParam uploadDataParam = new UploadDataParam();
|
||||
uploadDataParam.setDevId(devId);
|
||||
uploadDataParam.setLineId(lineId);
|
||||
uploadDataParam.setPaths(Arrays.asList(paths.split(",")));
|
||||
MultipartHttpServletRequest Murequest = (MultipartHttpServletRequest) request;
|
||||
Map<String, MultipartFile> files = Murequest.getFileMap() ;
|
||||
List<MultipartFile> fileList = new ArrayList<>();
|
||||
for(MultipartFile file : files.values()){
|
||||
fileList.add(file);
|
||||
}
|
||||
uploadDataParam.setFiles(fileList);
|
||||
iPortableOfflLogService.importEquipment(uploadDataParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,9 +3,8 @@ package com.njcn.csdevice.service;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.csdevice.pojo.po.PortableOfflLog;
|
||||
import com.njcn.csdevice.param.UploadDataParam;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -19,5 +18,5 @@ public interface IPortableOfflLogService extends IService<PortableOfflLog> {
|
||||
|
||||
Page<PortableOfflLog> queryPage(BaseParam baseParam);
|
||||
|
||||
void importEquipment(MultipartFile file, HttpServletResponse response);
|
||||
void importEquipment(UploadDataParam uploadDataParam);
|
||||
}
|
||||
|
||||
@@ -1,20 +1,31 @@
|
||||
package com.njcn.csdevice.service.impl;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelImportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ImportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.google.gson.Gson;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.csdevice.constant.DataParam;
|
||||
import com.njcn.csdevice.mapper.PortableOfflLogMapper;
|
||||
import com.njcn.csdevice.pojo.param.WlRecordTemplete;
|
||||
import com.njcn.csdevice.pojo.po.PortableOfflLog;
|
||||
import com.njcn.csdevice.service.IPortableOfflLogService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.csdevice.param.UploadDataParam;
|
||||
import com.njcn.csharmonic.api.OfflineDataUploadFeignClient;
|
||||
import com.njcn.csharmonic.offline.log.vo.NewTaglogbuffer;
|
||||
import com.njcn.csharmonic.offline.vo.Response;
|
||||
import com.njcn.oss.utils.FileStorageUtil;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -25,8 +36,15 @@ import java.util.List;
|
||||
* @since 2024-07-03
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMapper, PortableOfflLog> implements IPortableOfflLogService {
|
||||
|
||||
private final FileStorageUtil fileStorageUtil;
|
||||
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
|
||||
private final OfflineDataUploadFeignClient offlineDataUploadFeignClient;
|
||||
|
||||
@Override
|
||||
public Page<PortableOfflLog> queryPage(BaseParam baseParam) {
|
||||
Page<PortableOfflLog> returnpage = new Page<> (baseParam.getPageNum(), baseParam.getPageSize ());
|
||||
@@ -37,28 +55,77 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
||||
}
|
||||
|
||||
@Override
|
||||
public void importEquipment(MultipartFile file, HttpServletResponse response) {
|
||||
ImportParams params = new ImportParams ( );
|
||||
params.setHeadRows(1);
|
||||
params.setTitleRows(1);
|
||||
//第一个sheet为台账信息
|
||||
params.setStartSheetIndex(0);
|
||||
params.setSheetNum(1);
|
||||
try {
|
||||
ExcelImportResult<WlRecordTemplete> terminalBaseList = ExcelImportUtil.importExcelMore (file.getInputStream ( ), WlRecordTemplete.class, params);
|
||||
List<WlRecordTemplete> list = terminalBaseList.getList();
|
||||
//开始解析.......
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
public void importEquipment(UploadDataParam uploadDataParam) {
|
||||
//获取离线上传对应的字典规则
|
||||
List<DictData> dictDatas = dicDataFeignClient.getDicDataByTypeCode(DataParam.wlRecordUpload).getData();
|
||||
List<Response> responses = new ArrayList<>();
|
||||
List<MultipartFile> files = uploadDataParam.getFiles();
|
||||
List<String> paths = uploadDataParam.getPaths();
|
||||
for(DictData dictData : dictDatas){
|
||||
List<MultipartFile> fileList = new ArrayList<>();
|
||||
for (int i = 0; i < files.size(); i++) {
|
||||
if(paths.get(i).indexOf(dictData.getName())!=-1){
|
||||
fileList.add(files.get(i));
|
||||
}
|
||||
}
|
||||
if(!fileList.isEmpty()){
|
||||
byte[] resp = offlineDataUploadFeignClient.uploadAnalysis(fileList,dictData.getCode()).getData();
|
||||
ByteArrayInputStream bis = new ByteArrayInputStream(resp);
|
||||
ObjectInputStream ois = null;
|
||||
try {
|
||||
ois = new ObjectInputStream(bis);
|
||||
Object obj = ois.readObject();
|
||||
List<Response> response = (List<Response>) obj;
|
||||
responses.addAll(response);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new BusinessException("数据集对象转字节数组失败");
|
||||
} finally {
|
||||
try {
|
||||
ois.close();
|
||||
bis.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//记录导入信息
|
||||
PortableOfflLog portableOfflLog = new PortableOfflLog();
|
||||
portableOfflLog.setName(file.getOriginalFilename());
|
||||
portableOfflLog.setDataPath("D//file//"+file.getOriginalFilename());
|
||||
portableOfflLog.setLogsIndex(IdUtil.simpleUUID());
|
||||
portableOfflLog.setAllCount(100);
|
||||
portableOfflLog.setRealCount(70);
|
||||
portableOfflLog.setState(1);
|
||||
this.baseMapper.insert(portableOfflLog);
|
||||
|
||||
//开始上传文件、记录上传日志、解析的文件结果入库
|
||||
//最外层便利所有文件确保所有文件都上传及记录上传日志
|
||||
for(MultipartFile file : uploadDataParam.getFiles()){
|
||||
//初始上传日志基本信息
|
||||
PortableOfflLog portableOfflLog = new PortableOfflLog();
|
||||
portableOfflLog.setName(file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("/")+1));
|
||||
portableOfflLog.setPath(file.getOriginalFilename());
|
||||
portableOfflLog.setDataPath(fileStorageUtil.uploadMultipart(file, DataParam.wlRecordPath+uploadDataParam.getDevId()+"/"+uploadDataParam.getLineId()+"/"));
|
||||
portableOfflLog.setLogsIndex(IdUtil.simpleUUID());
|
||||
portableOfflLog.setState(1);
|
||||
//默认总条数及入库数为0(防止解析的数据重复插入及上传的文件目录路径错误)
|
||||
portableOfflLog.setAllCount(0);
|
||||
portableOfflLog.setRealCount(0);
|
||||
//开始匹配解析的文件结果入库
|
||||
for(Response response : responses){
|
||||
//当前文件匹配到解析结果
|
||||
if(file.getOriginalFilename().indexOf(response.getFilename())!=-1){
|
||||
//设置当前文件总条数
|
||||
//portableOfflLog.setAllCount(allCount);
|
||||
//判断当前解析的数据属于哪种结果(目前来说三种:comtrade、log、min)
|
||||
}
|
||||
}
|
||||
this.baseMapper.insert(portableOfflLog);
|
||||
}
|
||||
}
|
||||
|
||||
private static <T> T convertToObj(LinkedHashMap<String,Object> map,Class<T> clazz) throws Exception{
|
||||
T obj = clazz.newInstance();
|
||||
for(Map.Entry<String,Object> entry : map.entrySet()){
|
||||
String fieldName = entry.getKey();
|
||||
Object fieldValue = entry.getValue();
|
||||
Field field = clazz.getDeclaredField(fieldName);
|
||||
field.setAccessible(true);
|
||||
field.set(obj,fieldValue);
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,6 +39,18 @@
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>pqs-influx</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>cs-device-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.njcn.csharmonic.api;
|
||||
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.csharmonic.api.fallback.EventUserFeignClientFallbackFactory;
|
||||
import com.njcn.csharmonic.offline.vo.Response;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author gfh
|
||||
*/
|
||||
@FeignClient(value = ServerInfo.CS_HARMONIC_BOOT, path = "/offlineDataUpload", fallbackFactory = EventUserFeignClientFallbackFactory.class,contextId = "offlineDataUpload")
|
||||
public interface OfflineDataUploadFeignClient {
|
||||
|
||||
@PostMapping(value = "/uploadAnalysis",consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||
HttpResult<byte[]> uploadAnalysis(@RequestPart("files") List<MultipartFile> files,@RequestParam("type") String type);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.njcn.csharmonic.api.fallback;
|
||||
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.csharmonic.api.OfflineDataUploadFeignClient;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author gfh
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class OfflineDataUploadFeignClientFallbackFactory implements FallbackFactory<OfflineDataUploadFeignClient> {
|
||||
@Override
|
||||
public OfflineDataUploadFeignClient create(Throwable cause) {
|
||||
//判断抛出异常是否为解码器抛出的业务异常
|
||||
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||
if (cause.getCause() instanceof BusinessException) {
|
||||
BusinessException businessException = (BusinessException) cause.getCause();
|
||||
}
|
||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
return new OfflineDataUploadFeignClient() {
|
||||
@Override
|
||||
public HttpResult<byte[]> uploadAnalysis(List<MultipartFile> files,@RequestParam("type") String type) {
|
||||
log.error("{}异常,降级处理,异常为:{}",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,269 @@
|
||||
package com.njcn.csharmonic.offline.log;
|
||||
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.csharmonic.offline.log.vo.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
public class Log {
|
||||
private static String logPath = "C:\\Users\\Administrator\\Desktop\\浙江无线\\离线数据上传\\09\\log";//事件文件路径
|
||||
private static LocalDateTime event_starttime = null;
|
||||
private static LocalDateTime event_endtime = null;
|
||||
private static List<TagComtradeCfg> tagComtradeCfgs = new ArrayList();//波形文件cfg信息队列
|
||||
public static void main(String[] args) throws Exception {
|
||||
boolean logbin = false;
|
||||
File log = new File(logPath);
|
||||
if (log.isDirectory()) {
|
||||
File[] files = log.listFiles();
|
||||
for (File file : files) {
|
||||
convertLog(file);
|
||||
logbin = true;
|
||||
}
|
||||
}
|
||||
if (!logbin) {
|
||||
System.out.println("----------事件文件不存在----------");
|
||||
}
|
||||
}
|
||||
|
||||
//事件参数文件解析
|
||||
public static List<NewTaglogbuffer> convertLog(File file) throws Exception {
|
||||
InputStream binFile = new FileInputStream(file);
|
||||
List<NewTaglogbuffer> newTaglogbuffers = new ArrayList<>();//事件队列
|
||||
//转换为byte[]
|
||||
if (binFile.available() == 0) {
|
||||
log.warn("文件:{}长度为0字节,程序将跳过本文件的转换",file.getName());
|
||||
binFile.close();
|
||||
return newTaglogbuffers;
|
||||
}
|
||||
long nBufSize = binFile.available(); //计算需要解析的文件总长
|
||||
int logLen = 28; //NewHeadTaglogbuffer大小 由于结构固定所这边直接写死28字节
|
||||
int n1BufLen = logLen + 4 * 8; //单个固定结构大小
|
||||
int nEventNum = (int) (nBufSize / n1BufLen); //确认共多少事件数据结构
|
||||
try {
|
||||
for (int i = 0; i < nEventNum; i++) {
|
||||
byte[] bBuf = new byte[n1BufLen]; //单个统计结构
|
||||
try {
|
||||
binFile.read(bBuf, 0, bBuf.length);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
throw new BusinessException("文件" + file.getName() + " 读取时发生错误");
|
||||
}
|
||||
NewTaglogbuffer newTaglogbuffer = getnewTaglogbuffer(bBuf);
|
||||
newTaglogbuffers.add(newTaglogbuffer);
|
||||
TagMsTime devtime = newTaglogbuffer.getNewHeadTaglogbuffer().getDevtime();
|
||||
LocalDateTime time = LocalDateTime.of(devtime.getYear(), devtime.getMonth(), devtime.getDay(), devtime.getHour(), devtime.getMin(), devtime.getSec(), devtime.getMs());
|
||||
//存在启动时间
|
||||
if (event_starttime != LocalDateTime.MIN && event_starttime != null) {
|
||||
if (time.compareTo(event_starttime) <= 0) {
|
||||
event_starttime = time;
|
||||
}
|
||||
} else {
|
||||
//不存在启动时间 填入当前时间
|
||||
event_starttime = time;
|
||||
}
|
||||
if (event_endtime != LocalDateTime.MIN && event_endtime != null) {
|
||||
if (time.compareTo(event_endtime) >= 0) {
|
||||
event_endtime = time;
|
||||
}
|
||||
} else {
|
||||
//不存在结束时间 填入当前时间
|
||||
event_endtime = time;
|
||||
}
|
||||
|
||||
long sec = 0;
|
||||
for (NewBodyTaglogbuffer sing : newTaglogbuffer.getNewBodyTaglogbuffers()) {
|
||||
switch (sing.getParaCode()) {
|
||||
case 0: //特征幅值
|
||||
//fParam2 = sing.ParaValue / 65536.0f;
|
||||
break;
|
||||
case 1: //持续时间
|
||||
sec = sing.getParaValue() / 65536L;
|
||||
break;
|
||||
case 5: //相别
|
||||
break;
|
||||
case 25: //浮动门槛值
|
||||
//fParam3 = sing.ParaValue / 65536.0f;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
newTaglogbuffer.setStart(time); //事件开始时间
|
||||
newTaglogbuffer.setEnd(time.plusSeconds(sec)); //事件结束时间
|
||||
for (TagComtradeCfg sing : tagComtradeCfgs) {
|
||||
if (sing.getTimeTrigger().compareTo(newTaglogbuffer.getStart()) <= 0 && sing.getTimeEnd().compareTo(newTaglogbuffer.getStart()) >= 0) {
|
||||
newTaglogbuffer.setPath(sing.getPath());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (BusinessException e) {
|
||||
e.printStackTrace();
|
||||
throw new BusinessException("文件" + file.getName() + " 解析失败");
|
||||
}finally {
|
||||
binFile.close();
|
||||
}
|
||||
return newTaglogbuffers;
|
||||
}
|
||||
|
||||
//事件参数文件解析
|
||||
public static List<NewTaglogbuffer> convertLog(MultipartFile file) throws Exception {
|
||||
InputStream binFile = file.getInputStream();
|
||||
List<NewTaglogbuffer> newTaglogbuffers = new ArrayList<>();//事件队列
|
||||
//转换为byte[]
|
||||
if (binFile.available() == 0) {
|
||||
log.warn("文件:{}长度为0字节,程序将跳过本文件的转换",file.getOriginalFilename());
|
||||
binFile.close();
|
||||
return newTaglogbuffers;
|
||||
}
|
||||
long nBufSize = binFile.available(); //计算需要解析的文件总长
|
||||
int logLen = 28; //NewHeadTaglogbuffer大小 由于结构固定所这边直接写死28字节
|
||||
int n1BufLen = logLen + 4 * 8; //单个固定结构大小
|
||||
int nEventNum = (int) (nBufSize / n1BufLen); //确认共多少事件数据结构
|
||||
try {
|
||||
for (int i = 0; i < nEventNum; i++) {
|
||||
byte[] bBuf = new byte[n1BufLen]; //单个统计结构
|
||||
try {
|
||||
binFile.read(bBuf, 0, bBuf.length);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
throw new BusinessException("文件" + file.getOriginalFilename() + " 读取时发生错误");
|
||||
}
|
||||
NewTaglogbuffer newTaglogbuffer = getnewTaglogbuffer(bBuf);
|
||||
newTaglogbuffers.add(newTaglogbuffer);
|
||||
TagMsTime devtime = newTaglogbuffer.getNewHeadTaglogbuffer().getDevtime();
|
||||
LocalDateTime time = LocalDateTime.of(devtime.getYear(), devtime.getMonth(), devtime.getDay(), devtime.getHour(), devtime.getMin(), devtime.getSec(), devtime.getMs());
|
||||
//存在启动时间
|
||||
if (event_starttime != LocalDateTime.MIN && event_starttime != null) {
|
||||
if (time.compareTo(event_starttime) <= 0) {
|
||||
event_starttime = time;
|
||||
}
|
||||
} else {
|
||||
//不存在启动时间 填入当前时间
|
||||
event_starttime = time;
|
||||
}
|
||||
if (event_endtime != LocalDateTime.MIN && event_endtime != null) {
|
||||
if (time.compareTo(event_endtime) >= 0) {
|
||||
event_endtime = time;
|
||||
}
|
||||
} else {
|
||||
//不存在结束时间 填入当前时间
|
||||
event_endtime = time;
|
||||
}
|
||||
|
||||
long sec = 0;
|
||||
for (NewBodyTaglogbuffer sing : newTaglogbuffer.getNewBodyTaglogbuffers()) {
|
||||
switch (sing.getParaCode()) {
|
||||
case 0: //特征幅值
|
||||
//fParam2 = sing.ParaValue / 65536.0f;
|
||||
break;
|
||||
case 1: //持续时间
|
||||
sec = sing.getParaValue() / 65536L;
|
||||
break;
|
||||
case 5: //相别
|
||||
break;
|
||||
case 25: //浮动门槛值
|
||||
//fParam3 = sing.ParaValue / 65536.0f;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
newTaglogbuffer.setStart(time); //事件开始时间
|
||||
newTaglogbuffer.setEnd(time.plusSeconds(sec)); //事件结束时间
|
||||
for (TagComtradeCfg sing : tagComtradeCfgs) {
|
||||
if (sing.getTimeTrigger().compareTo(newTaglogbuffer.getStart()) <= 0 && sing.getTimeEnd().compareTo(newTaglogbuffer.getStart()) >= 0) {
|
||||
newTaglogbuffer.setPath(sing.getPath());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (BusinessException e) {
|
||||
e.printStackTrace();
|
||||
throw new BusinessException("文件" + file.getOriginalFilename() + " 解析失败");
|
||||
}finally {
|
||||
binFile.close();
|
||||
}
|
||||
return newTaglogbuffers;
|
||||
}
|
||||
|
||||
private static NewTaglogbuffer getnewTaglogbuffer(byte[] data) {
|
||||
NewHeadTaglogbuffer head = getNewHeadTaglogbuffer(data);
|
||||
ArrayList<NewBodyTaglogbuffer> bodylist = getNewBodyTaglogbuffer(data, head);
|
||||
NewTaglogbuffer newTaglogbuffer = new NewTaglogbuffer(head, bodylist);
|
||||
return newTaglogbuffer;
|
||||
}
|
||||
|
||||
private static NewHeadTaglogbuffer getNewHeadTaglogbuffer(byte[] data) {
|
||||
int structlen = 28;
|
||||
byte[] buff = new byte[structlen];
|
||||
System.arraycopy(data, 0, buff, 0, structlen);
|
||||
for (int i = 0; i < 12 * 2; i += 2) {
|
||||
reversalBuff(buff, i, 2);
|
||||
}
|
||||
for (int i = 12 * 2; i < (12 * 2 + 1 * 4); i += 4) {
|
||||
reversalBuff(buff, i, 4);
|
||||
}
|
||||
//数据区转换为结构
|
||||
NewHeadTaglogbuffer logBuff = (NewHeadTaglogbuffer) bytesToStruct(buff, 0, 28, "NewHeadTaglogbuffer");
|
||||
return logBuff;
|
||||
}
|
||||
|
||||
private static ArrayList<NewBodyTaglogbuffer> getNewBodyTaglogbuffer(byte[] data, NewHeadTaglogbuffer head) {
|
||||
ArrayList<NewBodyTaglogbuffer> newBodyTaglogbuffers = new ArrayList<NewBodyTaglogbuffer>();
|
||||
int structlen = 28;
|
||||
int bodylen = head.getLogParaNum() * 8;
|
||||
byte[] buff = new byte[bodylen];
|
||||
System.arraycopy(data, structlen, buff, 0, bodylen);
|
||||
for (int i = 0; i < bodylen; i += 4) {
|
||||
reversalBuff(buff, i, 4);
|
||||
}
|
||||
for (int i = 0; i < head.getLogParaNum(); i++) {
|
||||
NewBodyTaglogbuffer logBuff = (NewBodyTaglogbuffer) bytesToStruct(buff, (i * 8), 8, "NewBodyTaglogbuffer");
|
||||
newBodyTaglogbuffers.add(logBuff);
|
||||
}
|
||||
return newBodyTaglogbuffers;
|
||||
}
|
||||
|
||||
private static boolean reversalBuff(byte[] buffer, int StartIndex, int bufflen) {
|
||||
//确保长度为偶数
|
||||
if (bufflen % 2 != 0){
|
||||
return false;
|
||||
}
|
||||
int halflen = bufflen / 2;
|
||||
byte[] temp = new byte[halflen];
|
||||
for (int i = 0; i < halflen; i++) {
|
||||
temp[i] = buffer[i + StartIndex];
|
||||
buffer[i + StartIndex] = buffer[bufflen + StartIndex - i - 1];
|
||||
buffer[bufflen + StartIndex - i - 1] = temp[i];
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static Object bytesToStruct(byte[] buf, int nStart, int len, String type) {
|
||||
if ("NewHeadTaglogbuffer".equals(type)) {
|
||||
TagMsTime tagMsTime = new TagMsTime(Service.convertInt16(buf, 2),
|
||||
Service.convertInt16(buf, 4),Service.convertInt16(buf, 6),
|
||||
Service.convertInt16(buf, 8),Service.convertInt16(buf, 10),
|
||||
Service.convertInt16(buf, 12),Service.convertInt16(buf, 14)
|
||||
);
|
||||
NewHeadTaglogbuffer newHeadTaglogbuffer = new NewHeadTaglogbuffer(Service.convertInt16(buf, 0),
|
||||
tagMsTime,Service.convertInt16(buf, 16),Service.convertInt16(buf, 18),
|
||||
Service.convertInt16(buf, 20),Service.convertInt16(buf, 22),
|
||||
Service.convertInt32(buf, 24));
|
||||
return newHeadTaglogbuffer;
|
||||
} else if ("NewBodyTaglogbuffer".equals(type)) {
|
||||
NewBodyTaglogbuffer newBodyTaglogbuffer = new NewBodyTaglogbuffer(Service.convertInt32(buf, nStart),Service.convertInt32(buf, nStart + 4));
|
||||
return newBodyTaglogbuffer;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,470 @@
|
||||
package com.njcn.csharmonic.offline.log;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
public class Service
|
||||
{
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
|
||||
///#region 解析通讯报文相关代码
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
|
||||
///#region 整型->浮点 浮点->整型
|
||||
public static float IntToFloat(int num)
|
||||
{
|
||||
// uint i_middle = 0xffff0000;
|
||||
// uint j_middle = 0x0000ffff;
|
||||
// bool bNav = false;
|
||||
// if ((num & 0x8000000) == 0x8000000)
|
||||
// {
|
||||
// int nTemp = num & 0x7fffffff;
|
||||
// num = ~nTemp + 1;
|
||||
// bNav = true;
|
||||
// }
|
||||
// int i = (int)((num & i_middle) / 65536);
|
||||
// float j = (num & j_middle) / 65536.0f;
|
||||
// if (bNav)
|
||||
// return -((float)i + j);
|
||||
// return (float)i + j;
|
||||
float j = (float)num / 65536.0f;
|
||||
return (float)j;
|
||||
}
|
||||
public static float IntToFloat1000(int num)
|
||||
{
|
||||
// uint i_middle = 0xffff0000;
|
||||
// uint j_middle = 0x0000ffff;
|
||||
// bool bNav = false;
|
||||
// if ((num & 0x8000000) == 0x8000000)
|
||||
// {
|
||||
// int nTemp = num & 0x7fffffff;
|
||||
// num = ~nTemp + 1;
|
||||
// bNav = true;
|
||||
// }
|
||||
// int i = (int)((num & i_middle) / 65536);
|
||||
// float j = (num & j_middle) / 65536.0f;
|
||||
// if (bNav)
|
||||
// return -((float)i + j);
|
||||
// return (float)i + j;
|
||||
float j = (float)num / 1000.0f;
|
||||
return (float)j;
|
||||
}
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public static float UintToFloat(uint num)
|
||||
public static float UintToFloat(int num)
|
||||
{
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: uint i_middle = 0xffff0000;
|
||||
int i_middle = 0xffff0000;
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: uint j_middle = 0x0000ffff;
|
||||
int j_middle = 0x0000ffff;
|
||||
boolean bNav = false;
|
||||
if ((num & 0x8000000) == 0x8000000)
|
||||
{
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: uint nTemp = num & 0x7fffffff;
|
||||
int nTemp = num & 0x7fffffff;
|
||||
num = ~nTemp + 1;
|
||||
bNav = true;
|
||||
}
|
||||
int i = (int)((num & i_middle) / 65536);
|
||||
float j = (num & j_middle) / 65536.0f;
|
||||
if (bNav)
|
||||
{
|
||||
return -((float)i + j);
|
||||
}
|
||||
return (float)i + j;
|
||||
}
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public static float UshorToFloat(ushort num)
|
||||
public static float UshorToFloat(short num)
|
||||
{
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: ushort i_middle = 0xff00;
|
||||
short i_middle = (short) 0xff00;
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: ushort j_middle = 0x00ff;
|
||||
short j_middle = 0x00ff;
|
||||
boolean bNav = false;
|
||||
if ((num & 0x8000) == 0x8000)
|
||||
{
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: ushort nTemp = (ushort)(num & 0x7fff);
|
||||
short nTemp = (short)(num & 0x7fff);
|
||||
num = (short)(~nTemp + 1);
|
||||
bNav = true;
|
||||
}
|
||||
int i = (num & i_middle) / 256;
|
||||
float j = (num & j_middle) / 256.0f;
|
||||
if (bNav)
|
||||
{
|
||||
return -((float)i + j);
|
||||
}
|
||||
return (float)i + j;
|
||||
}
|
||||
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public static ushort FloatToShort(float num)
|
||||
public static short FloatToShort(float num)
|
||||
{
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: ushort i = (ushort)num;
|
||||
short i = (short)num;
|
||||
float middle_j = num - (float)i;
|
||||
float j = 256 * middle_j;
|
||||
return (short)(i + (short)j);
|
||||
}
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public static float UshorToFloat10000(ushort num)
|
||||
public static float UshorToFloat10000(short num)
|
||||
{
|
||||
float j = num / 10000.0f;
|
||||
return j;
|
||||
}
|
||||
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public static ushort FloatToShort10000(float num)
|
||||
public static short FloatToShort10000(float num)
|
||||
{
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: ushort i = (ushort)(num * 10000.0f);
|
||||
short i = (short)(num * 10000.0f);
|
||||
return i;
|
||||
}
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public static float UshorToFloat100(ushort num)
|
||||
public static float UshorToFloat100(short num)
|
||||
{
|
||||
float j = num / 100.0f;
|
||||
return j;
|
||||
}
|
||||
public static float ShorToFloat100(short num)
|
||||
{
|
||||
float j = num / 100.0f;
|
||||
return j;
|
||||
}
|
||||
public static float ShorToFloat1000(short num)
|
||||
{
|
||||
float j = num / 1000.0f;
|
||||
return j;
|
||||
}
|
||||
public static float ShorToFloat10000(short num)
|
||||
{
|
||||
float j = num / 10000.0f;
|
||||
return j;
|
||||
}
|
||||
|
||||
public static void reverseByteArray(byte[] arr) {
|
||||
int start = 0;
|
||||
int end = arr.length - 1;
|
||||
while (start < end) {
|
||||
byte temp = arr[start];
|
||||
arr[start] = arr[end];
|
||||
arr[end] = temp;
|
||||
start++;
|
||||
end--;
|
||||
}
|
||||
}
|
||||
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
|
||||
///#endregion
|
||||
public static byte[] ByteReversa(byte[] temp) //翻转Byte数组
|
||||
{
|
||||
|
||||
reverseByteArray(temp);
|
||||
return temp;
|
||||
}
|
||||
public enum enum_Value_type
|
||||
{
|
||||
Value_uint(1),
|
||||
Value_int(2),
|
||||
Value_ushort(3),
|
||||
Value_short(4),
|
||||
Value_float(5),
|
||||
Value_Long(6),
|
||||
Value_UInt64(7);
|
||||
|
||||
private int intValue;
|
||||
private static java.util.HashMap<Integer, enum_Value_type> mappings;
|
||||
private synchronized static java.util.HashMap<Integer, enum_Value_type> getMappings()
|
||||
{
|
||||
if (mappings == null)
|
||||
{
|
||||
mappings = new java.util.HashMap<Integer, enum_Value_type>();
|
||||
}
|
||||
return mappings;
|
||||
}
|
||||
|
||||
private enum_Value_type(int value)
|
||||
{
|
||||
intValue = value;
|
||||
enum_Value_type.getMappings().put(value, this);
|
||||
}
|
||||
|
||||
public int getValue()
|
||||
{
|
||||
return intValue;
|
||||
}
|
||||
|
||||
public static enum_Value_type forValue(int value)
|
||||
{
|
||||
return getMappings().get(value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@brief 将二进制流的数组转换为制定的数据类型,增加字节序的转换
|
||||
// @param byte[] in 二进制流数据
|
||||
// @param int in 需转换的数据在二进制流的位置
|
||||
@return uint out 32位无符号整型数据
|
||||
|
||||
*/
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public static uint convertUInt32_net(byte[] b, int haveread)
|
||||
public static int convertUInt32_net(byte[] b, int haveread)
|
||||
{
|
||||
String s1 = (new Byte(b[haveread])).toString();
|
||||
String s2 = (new Byte(b[haveread + 1])).toString();
|
||||
String s3 = (new Byte(b[haveread + 2])).toString();
|
||||
String s4 = (new Byte(b[haveread + 3])).toString();
|
||||
return (int)convertInt32(s1, s2, s3, s4);
|
||||
}
|
||||
/**
|
||||
@brief 将二进制流的数组转换为制定的数据类型
|
||||
// @param byte[] in 二进制流数据
|
||||
// @param int in 需转换的数据在二进制流的位置
|
||||
@return uint out 32位无符号整型数据
|
||||
|
||||
*/
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public static uint convertUInt32(byte[] b, int haveread)
|
||||
public static int convertUInt32(byte[] b, int haveread)
|
||||
{
|
||||
String s1 = (new Byte(b[haveread + 3])).toString();
|
||||
String s2 = (new Byte(b[haveread + 2])).toString();
|
||||
String s3 = (new Byte(b[haveread + 1])).toString();
|
||||
String s4 = (new Byte(b[haveread])).toString();
|
||||
return (int)convertInt32(s1, s2, s3, s4);
|
||||
}
|
||||
/**
|
||||
@brief 将二进制流的数组转换为制定的数据类型,增加字节序的转换
|
||||
// @param byte[] in 二进制流数据
|
||||
// @param int in 需转换的数据在二进制流的位置
|
||||
@return int out 32位整型数据
|
||||
|
||||
*/
|
||||
public static int convertInt32_net(byte[] b, int haveread)
|
||||
{
|
||||
String s1 = (new Byte(b[haveread])).toString();
|
||||
String s2 = (new Byte(b[haveread + 1])).toString();
|
||||
String s3 = (new Byte(b[haveread + 2])).toString();
|
||||
String s4 = (new Byte(b[haveread + 3])).toString();
|
||||
return convertInt32(s1, s2, s3, s4);
|
||||
}
|
||||
/**
|
||||
@brief 将二进制流的数组转换为制定的数据类型
|
||||
// @param byte[] in 二进制流数据
|
||||
// @param int in 需转换的数据在二进制流的位置
|
||||
@return int out 32位整型数据
|
||||
|
||||
*/
|
||||
public static int convertInt32(byte[] b, int haveread)
|
||||
{
|
||||
String s1 = (new Byte(b[haveread + 3]) & 0xFF)+"";
|
||||
String s2 = (new Byte(b[haveread + 2])& 0xFF)+"";
|
||||
String s3 = (new Byte(b[haveread + 1])& 0xFF)+"";
|
||||
String s4 = (new Byte(b[haveread])& 0xFF)+"";
|
||||
return convertInt32(s1, s2, s3, s4);
|
||||
}
|
||||
/**
|
||||
@brief 将字符型的数据转换无符号的整数
|
||||
// @param string in 高位字符
|
||||
// @param string in 低位字符
|
||||
@return int out 16位无符号整型数据
|
||||
|
||||
*/
|
||||
public static int convertInt32(String s1, String s2, String s3, String s4)
|
||||
{
|
||||
int nValue = (Integer.parseInt(s1, 10) * 256 * 256 * 256 + Integer.parseInt(s2, 10) * 256 * 256 + Integer.parseInt(s3, 10) * 256 + Integer.parseInt(s4, 10));
|
||||
return nValue;
|
||||
}
|
||||
/**
|
||||
@brief 将二进制流写入到数组中
|
||||
// @param byte[] in 待转换的二进制流
|
||||
// @param int in 已读取的二进制个数
|
||||
// @param int[] in 需写入的数组
|
||||
@return int out 总共转换了多少个byte
|
||||
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
@brief 将二进制流写入到数组中
|
||||
// @param byte[] in 待转换的二进制流
|
||||
// @param int in 已读取的二进制个数
|
||||
// @param uint[] in 需写入的数组
|
||||
@return int out 总共转换了多少个byte
|
||||
|
||||
*/
|
||||
|
||||
/**
|
||||
@brief 将二进制流的数组转换为制定的数据类型
|
||||
// @param byte[] in 二进制流数据
|
||||
// @param int in 需转换的数据在二进制流的位置
|
||||
@return float out 32位浮点数据
|
||||
|
||||
*/
|
||||
public static float convertfloat(byte[] b, int haveread)
|
||||
{
|
||||
// 确保有足够的数据来读取一个float(4字节)
|
||||
if (haveread + 4 > b.length) {
|
||||
throw new IndexOutOfBoundsException("Not enough bytes to read a float.");
|
||||
}
|
||||
|
||||
// 创建一个ByteBuffer来处理字节
|
||||
ByteBuffer buffer = ByteBuffer.wrap(b, haveread, 4);
|
||||
// 设置字节顺序,假设是大端序(与许多C#系统和网络协议相同)
|
||||
buffer.order(ByteOrder.BIG_ENDIAN);
|
||||
|
||||
// 从ByteBuffer中读取float
|
||||
float fValue = buffer.getFloat();
|
||||
|
||||
return fValue;
|
||||
}
|
||||
/**
|
||||
@brief 将二进制流的数组转换为制定的数据类型,增加字节序的转换
|
||||
// @param byte[] in 二进制流数据
|
||||
// @param int in 需转换的数据在二进制流的位置
|
||||
@return float out 32位浮点数据
|
||||
|
||||
*/
|
||||
public static float convertfloat_net(byte[] b, int haveread)
|
||||
{
|
||||
// 确保有足够的数据来读取一个float(4字节)
|
||||
if (haveread + 4 > b.length) {
|
||||
throw new IndexOutOfBoundsException("Not enough bytes to read a float.");
|
||||
}
|
||||
|
||||
// 创建一个ByteBuffer来处理字节
|
||||
ByteBuffer buffer = ByteBuffer.wrap(b, haveread, 4);
|
||||
// 设置字节顺序,假设是大端序(与许多C#系统和网络协议相同)
|
||||
buffer.order(ByteOrder.BIG_ENDIAN);
|
||||
|
||||
// 从ByteBuffer中读取float
|
||||
float fValue = buffer.getFloat();
|
||||
|
||||
return fValue;
|
||||
}
|
||||
/**
|
||||
@brief 将二进制流写入到数组中
|
||||
// @param byte[] in 待转换的二进制流
|
||||
// @param int in 已读取的二进制个数
|
||||
// @param float[] in 需写入的数组
|
||||
@return int out 总共转换了多少个byte
|
||||
|
||||
*/
|
||||
|
||||
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public static ushort convertUInt16_net(byte[] b, int haveread)
|
||||
// public static short convertUInt16_net(byte[] b, int haveread)
|
||||
// {
|
||||
// String s1 = (new Byte(b[haveread])).toString();
|
||||
// String s2 = (new Byte(b[haveread + 1])).toString();
|
||||
// return (short)convertInt16(s1, s2);
|
||||
// }
|
||||
|
||||
public static short convertUInt16_net(byte[] b, int offset) {
|
||||
// 确保offset是有效的,并且偏移量之后至少还有一个字节
|
||||
if (b == null || offset < 0 || offset + 1 >= b.length) {
|
||||
throw new IndexOutOfBoundsException("Invalid offset or array length");
|
||||
}
|
||||
|
||||
// 假设字节顺序是大端的(网络字节序通常是大端的),我们需要先读取高字节再读取低字节
|
||||
// Java的byte类型是有符号的,但我们可以使用无符号右移(>>>)来确保结果是无符号的
|
||||
return (short) (((b[offset] & 0xFF) << 8) | (b[offset + 1] & 0xFF));
|
||||
|
||||
// 如果需要确保结果是正的(即无符号的),并且不会超出short的范围,可以返回强制类型转换后的short
|
||||
// 但请注意,如果结果超过了short的最大值(32767),这里会丢失高位的信息
|
||||
// 在大多数情况下,这不会是一个问题,因为网络数据通常被设计为不会超出这些范围
|
||||
// return (short) result;
|
||||
}
|
||||
/**
|
||||
@brief 将二进制流的数组转换为制定的数据类型
|
||||
// @param byte[] in 二进制流数据
|
||||
// @param int in 需转换的数据在二进制流的位置
|
||||
@return int out 16位无符号整型数据
|
||||
|
||||
*/
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public static ushort convertUInt16(byte[] b, int haveread)
|
||||
public static short convertUInt16(byte[] b, int haveread)
|
||||
{
|
||||
String s1 = (new Byte(b[haveread + 1])).toString();
|
||||
String s2 = (new Byte(b[haveread])).toString();
|
||||
return (short)convertInt16(s1, s2);
|
||||
}
|
||||
/**
|
||||
@brief 将二进制流的数组转换为制定的数据类型
|
||||
// @param byte[] in 二进制流数据
|
||||
// @param int in 需转换的数据在二进制流的位置
|
||||
@return int out 16位整型数据
|
||||
|
||||
*/
|
||||
public static short convertInt16_net(byte[] b, int haveread)
|
||||
{
|
||||
String s1 = (new Byte(b[haveread])).toString();
|
||||
String s2 = (new Byte(b[haveread + 1])).toString();
|
||||
return convertInt16(s1, s2);
|
||||
}
|
||||
/**
|
||||
@brief 将二进制流的数组转换为制定的数据类型
|
||||
// @param byte[] in 二进制流数据
|
||||
// @param int in 需转换的数据在二进制流的位置
|
||||
@return int out 16位整型数据
|
||||
|
||||
*/
|
||||
public static short convertInt16(byte[] b, int haveread)
|
||||
{
|
||||
String s1 = (new Byte(b[haveread + 1]) & 0xFF)+"";
|
||||
String s2 = (new Byte(b[haveread]) & 0xFF)+"";
|
||||
return convertInt16(s1, s2);
|
||||
}
|
||||
/**
|
||||
@brief 将字符型的数据转换无符号的整数
|
||||
// @param string in 高位字符
|
||||
// @param string in 低位字符
|
||||
@return int out 16位无符号整型数据
|
||||
|
||||
*/
|
||||
public static short convertInt16(String s1, String s2)
|
||||
{
|
||||
short Value = (short)(Short.parseShort(s1, 10) * 256 + Integer.parseInt(s2, 10));
|
||||
return Value;
|
||||
}
|
||||
//解析结构体
|
||||
// public static Object BytesToStuct(byte[] bytes, Class type)
|
||||
// {
|
||||
// //得到结构体的大小
|
||||
// int size = Marshal.SizeOf(type);
|
||||
// //byte数组长度小于结构体的大小
|
||||
// if (size > bytes.length)
|
||||
// {
|
||||
// //返回空
|
||||
// return null;
|
||||
// }
|
||||
// //分配结构体大小的内存空间
|
||||
// IntPtr structPtr = Marshal.AllocHGlobal(size);
|
||||
// //将byte数组拷到分配好的内存空间
|
||||
// Marshal.Copy(bytes, 0, structPtr, size);
|
||||
// //将内存空间转换为目标结构体
|
||||
// Object obj = Marshal.PtrToStructure(structPtr, type);
|
||||
// //释放内存空间
|
||||
// Marshal.FreeHGlobal(structPtr);
|
||||
// //返回结构体
|
||||
// return obj;
|
||||
// }
|
||||
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
|
||||
///#endregion
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.njcn.csharmonic.offline.log.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class NewBodyTaglogbuffer implements Serializable {
|
||||
|
||||
private int ParaCode; // 参数编码
|
||||
private int ParaValue; // 参数值
|
||||
|
||||
public NewBodyTaglogbuffer(int paraCode, int paraValue) {
|
||||
ParaCode = paraCode;
|
||||
ParaValue = paraValue;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.njcn.csharmonic.offline.log.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class NewHeadTaglogbuffer implements Serializable {
|
||||
private short name; // 监测点序号
|
||||
private TagMsTime Devtime; // 绝对时间
|
||||
private short LogType; // 日志类型(装置故障类、越限类)
|
||||
private short LogCode; // 日志代码
|
||||
private short LogLb; // 日志录波
|
||||
private short LogBackup; // 日志补零位
|
||||
private int LogParaNum; // 日志参数项数
|
||||
|
||||
public NewHeadTaglogbuffer(short name, TagMsTime devtime, short logType, short logCode, short logLb, short logBackup, int logParaNum) {
|
||||
this.name = name;
|
||||
Devtime = devtime;
|
||||
LogType = logType;
|
||||
LogCode = logCode;
|
||||
LogLb = logLb;
|
||||
LogBackup = logBackup;
|
||||
LogParaNum = logParaNum;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.njcn.csharmonic.offline.log.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class NewTaglogbuffer implements Serializable {
|
||||
private NewHeadTaglogbuffer newHeadTaglogbuffer;
|
||||
private List<NewBodyTaglogbuffer> newBodyTaglogbuffers;
|
||||
private LocalDateTime start, end; //事件起始和结束时间
|
||||
private String path = ""; //事件对应波形文件名称
|
||||
|
||||
public NewTaglogbuffer(NewHeadTaglogbuffer head, ArrayList<NewBodyTaglogbuffer> body) {
|
||||
newHeadTaglogbuffer = head;
|
||||
newBodyTaglogbuffers = body;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.njcn.csharmonic.offline.log.vo;
|
||||
|
||||
import lombok.Data;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
|
||||
@Data
|
||||
public class TagComtradeCfg {
|
||||
private int nChannelNum; //通道总个数
|
||||
private int nAnalogNum; //模拟量通道的个数 WW 2013-05-15
|
||||
private int nDigitalNum; //数字量通道的个数 WW 2013-05-15
|
||||
private ArrayList<TagOneChannleCfg> oneChannleCfg; //模拟量通道记录类链表
|
||||
private ArrayList<TagOneChannleCfgDigital> oneChannleCfgDig; //数字量通道记录类链表
|
||||
private LocalDateTime timeTrigger = LocalDateTime.MIN; //暂态触发时间
|
||||
private LocalDateTime timeStart = LocalDateTime.MIN; //波形起始时间 注:相较于TimeTrigger波形触发时间起始有一段平滑过渡波形时间,约100ms
|
||||
private LocalDateTime timeEnd = LocalDateTime.MIN; //波形结束时间
|
||||
private String path; //对应波形cfg文件全路径名称
|
||||
|
||||
public TagComtradeCfg() {
|
||||
oneChannleCfg = new ArrayList<TagOneChannleCfg>();
|
||||
oneChannleCfgDig = new ArrayList<TagOneChannleCfgDigital>();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.njcn.csharmonic.offline.log.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class TagMsTime implements Serializable {
|
||||
private short year;
|
||||
private short month;
|
||||
private short day;
|
||||
private short hour;
|
||||
private short min;
|
||||
private short sec;
|
||||
private short ms;
|
||||
|
||||
public TagMsTime(short year, short month, short day, short hour, short min, short sec, short ms) {
|
||||
this.year = year;
|
||||
this.month = month;
|
||||
this.day = day;
|
||||
this.hour = hour;
|
||||
this.min = min;
|
||||
this.sec = sec;
|
||||
this.ms = ms;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.njcn.csharmonic.offline.log.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class TagOneChannleCfg {
|
||||
//通道序号
|
||||
private int nIndex;
|
||||
//通道名称
|
||||
private String szChannleName;
|
||||
//相位名称
|
||||
private String szPhasicName;
|
||||
//监视的通道名称
|
||||
private String szMonitoredChannleName;
|
||||
//通道的单位
|
||||
private String szUnitName;
|
||||
//通道的系数
|
||||
private float fCoefficent;
|
||||
//通道的便宜量
|
||||
private float fOffset;
|
||||
//起始采样时间的偏移量
|
||||
private float fTimeOffset;
|
||||
//采样值的最小值
|
||||
private int nMin;
|
||||
//采样值的最大值
|
||||
private int nMax;
|
||||
//一次变比
|
||||
private float fPrimary;
|
||||
//二次变比
|
||||
private float fSecondary;
|
||||
//一次值还是二次值标志
|
||||
private String szValueType;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.njcn.csharmonic.offline.log.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class TagOneChannleCfgDigital {
|
||||
//通道序号
|
||||
private int nIndex;
|
||||
//通道名称
|
||||
private String szChannleName;
|
||||
//相位名称
|
||||
private String szPhasicName;
|
||||
//监视的通道名称
|
||||
private String szMonitoredChannleName;
|
||||
//通道的单位
|
||||
private int initial;
|
||||
}
|
||||
@@ -0,0 +1,686 @@
|
||||
package com.njcn.csharmonic.offline.mincfg;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||
import com.njcn.influx.pojo.po.cs.PqdData;
|
||||
import com.njcn.csharmonic.offline.mincfg.vo.RTC_Timer_MS;
|
||||
import com.njcn.csharmonic.offline.mincfg.vo.tagPQDataCmn;
|
||||
import com.njcn.csharmonic.offline.mincfg.vo.tagPQDataCmnHh;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Date: 2024/7/15 15:42【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public class AnalyseComtradeCfg {
|
||||
|
||||
private static Date minStarttime = new Date(0);
|
||||
private static Date minEndtime = new Date(0); //分钟数据的时间范围
|
||||
|
||||
private static Date minHh_starttime = new Date(0);
|
||||
private static Date minHh_endtime = new Date(0);
|
||||
|
||||
//解析分钟数据和分钟数据下的高频谐波
|
||||
public static List<PqdData> processDirectory(List<MultipartFile> files) throws IOException {
|
||||
HashMap<Date, MinDataHh> minDataHhHashMap = new HashMap<>();
|
||||
HashMap<Date, MinData> minDataHashMap = new HashMap<>();
|
||||
for(MultipartFile file : files){
|
||||
if(file.getOriginalFilename().indexOf(".bin")!=-1){
|
||||
if (file.getOriginalFilename().toUpperCase().indexOf("HH") >= 0) { // 读取分钟秒下的高频谐波数据
|
||||
convertMinHh(file,minDataHhHashMap);
|
||||
} else { // 读取分钟数据
|
||||
convertMin(file,minDataHashMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
System.out.println(minDataHhHashMap);
|
||||
System.out.println(minDataHashMap);
|
||||
return convertMinData(minDataHashMap);
|
||||
}
|
||||
|
||||
private static List<PqdData> convertMinData(HashMap<Date, MinData> minDataHashMap) {
|
||||
List<PqdData> result = new ArrayList<>();
|
||||
minDataHashMap.forEach((dateTime,data)->{
|
||||
|
||||
List<PqdData> pqdDataA = convertDataByValueType(data.getMin(), "min",dateTime);
|
||||
List<PqdData> pqdDataB = convertDataByValueType(data.getMax(), "max",dateTime);
|
||||
List<PqdData> pqdDataC = convertDataByValueType(data.getAvg(), "avg",dateTime);
|
||||
List<PqdData> pqdDataT = convertDataByValueType(data.getCp95(), "cp95",dateTime);
|
||||
result.addAll(pqdDataA);
|
||||
result.addAll(pqdDataB);
|
||||
result.addAll(pqdDataC);
|
||||
result.addAll(pqdDataT);
|
||||
});
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
private static List<PqdData> convertDataByValueType(tagPQDataCmn min, String valueType,Date dateTime) {
|
||||
|
||||
List<PqdData> pqdData = new ArrayList<>();
|
||||
|
||||
HashMap hashMapA = new HashMap<>();
|
||||
hashMapA.put("phasic_type","A");
|
||||
hashMapA.put("value_type",valueType);
|
||||
hashMapA.put("time",dateTime.toInstant());
|
||||
|
||||
HashMap hashMapB = new HashMap<>();
|
||||
hashMapB.put("phasic_type","B");
|
||||
hashMapB.put("value_type",valueType);
|
||||
hashMapB.put("time",dateTime.toInstant());
|
||||
|
||||
HashMap hashMapC = new HashMap<>();
|
||||
hashMapC.put("phasic_type","C");
|
||||
hashMapC.put("value_type",valueType);
|
||||
hashMapC.put("time",dateTime.toInstant());
|
||||
|
||||
HashMap hashMapM = new HashMap<>();
|
||||
hashMapM.put("phasic_type","M");
|
||||
hashMapM.put("value_type",valueType);
|
||||
hashMapM.put("time",dateTime.toInstant());
|
||||
|
||||
|
||||
HashMap hashMapAB = new HashMap<>();
|
||||
hashMapAB.put("phasic_type","AB");
|
||||
hashMapAB.put("value_type",valueType);
|
||||
hashMapAB.put("time",dateTime.toInstant());
|
||||
|
||||
HashMap hashMapBC = new HashMap<>();
|
||||
hashMapBC.put("phasic_type","BC");
|
||||
hashMapBC.put("value_type",valueType);
|
||||
hashMapBC.put("time",dateTime.toInstant());
|
||||
|
||||
HashMap hashMapCA = new HashMap<>();
|
||||
hashMapCA.put("phasic_type","CA");
|
||||
hashMapCA.put("value_type",valueType);
|
||||
hashMapCA.put("time",dateTime.toInstant());
|
||||
|
||||
|
||||
//RMS电压A B C 电流A B C 线电压AB BC CA
|
||||
Float[] rms = min.getRms();
|
||||
hashMapA.put("pq_RmsU",rms[0]);
|
||||
hashMapB.put("pq_RmsU",rms[1]);
|
||||
hashMapC.put("pq_RmsU",rms[2]);
|
||||
hashMapA.put("pq_RmsU",rms[3]);
|
||||
hashMapB.put("pq_RmsI",rms[4]);
|
||||
hashMapC.put("pq_RmsI",rms[5]);
|
||||
hashMapA.put("pq_RmsLU",rms[6]);
|
||||
hashMapB.put("pq_RmsLU",rms[7]);
|
||||
hashMapC.put("pq_RmsLU",rms[8]);
|
||||
|
||||
|
||||
// pqdDataA.setpq_RmsU(rms[0]);
|
||||
// pqdDataB.setpq_RmsU(rms[1]);
|
||||
// pqdDataC.setpq_RmsU(rms[2]);
|
||||
// pqdDataA.setpq_RmsI(rms[3]);
|
||||
// pqdDataB.setpq_RmsI(rms[4]);
|
||||
// pqdDataC.setpq_RmsI(rms[5]);
|
||||
// pqdDataA.setpq_RmsLU(rms[6]);
|
||||
// pqdDataB.setpq_RmsLU(rms[7]);
|
||||
// pqdDataC.setpq_RmsLU(rms[8]);
|
||||
//电压上偏差相电压abc,线电压AB BC CA
|
||||
Float[] uuDeviation = min.getUU_Deviation();
|
||||
Float[] ulDeviation = min.getUL_Deviation();
|
||||
//电能质量只有电压偏差,上偏差正,下偏差负,判断上偏差是否为0如果为0取下偏差负数,反正取上偏差
|
||||
hashMapA.put("pq_UDev",AnalyseComtradeCfg.isZero(uuDeviation[0])?(-ulDeviation[0]):uuDeviation[0]);
|
||||
hashMapB.put("pq_UDev",AnalyseComtradeCfg.isZero(uuDeviation[1])?(-ulDeviation[1]):uuDeviation[1]);
|
||||
hashMapC.put("pq_RmsU",AnalyseComtradeCfg.isZero(uuDeviation[2])?(-ulDeviation[2]):uuDeviation[2]);
|
||||
hashMapAB.put("pq_LUDev",AnalyseComtradeCfg.isZero(uuDeviation[3])?(-ulDeviation[3]):uuDeviation[3]);
|
||||
hashMapBC.put("pq_LUDev",AnalyseComtradeCfg.isZero(uuDeviation[4])?(-ulDeviation[4]):uuDeviation[4]);
|
||||
hashMapCA.put("pq_LUDev",AnalyseComtradeCfg.isZero(uuDeviation[5])?(-ulDeviation[5]):uuDeviation[5]);
|
||||
|
||||
// pqdDataA.setpq_RmsU(AnalyseComtradeCfg.isZero(uuDeviation[0])?(-ulDeviation[0]):uuDeviation[0]);
|
||||
// pqdDataB.setpq_RmsU(AnalyseComtradeCfg.isZero(uuDeviation[1])?(-ulDeviation[1]):uuDeviation[1]);
|
||||
// pqdDataC.setpq_RmsU(AnalyseComtradeCfg.isZero(uuDeviation[2])?(-ulDeviation[2]):uuDeviation[2]);
|
||||
// pqdDataA.setpq_RmsI(AnalyseComtradeCfg.isZero(uuDeviation[3])?(-ulDeviation[3]):uuDeviation[3]);
|
||||
// pqdDataB.setpq_RmsI(AnalyseComtradeCfg.isZero(uuDeviation[4])?(-ulDeviation[4]):uuDeviation[4]);
|
||||
// pqdDataC.setpq_RmsI(AnalyseComtradeCfg.isZero(uuDeviation[5])?(-ulDeviation[5]):uuDeviation[5]);
|
||||
///频率偏差 ,频率存M相
|
||||
Float[] fDeviation = min.getF_Deviation();
|
||||
|
||||
hashMapM.put("pq_FreqDev",fDeviation[0]);
|
||||
hashMapM.put("pq_Freq",fDeviation[1]);
|
||||
|
||||
/* pqdDataT.setpq_FreqDev(fDeviation[0]);
|
||||
pqdDataT.setpq_Freq(fDeviation[1]);*/
|
||||
|
||||
//电压电流零、正、负序、不平衡度32 第一个[]电压,电流;第二个[]零、正、负序、不平衡度
|
||||
Float[][] uiSeq = min.getUI_Seq();
|
||||
|
||||
hashMapM.put("pq_SeqZeroU",uiSeq[0][0]);
|
||||
hashMapM.put("pq_SeqNegU",uiSeq[0][1]);
|
||||
hashMapM.put("pq_SeqPosU",uiSeq[0][2]);
|
||||
hashMapM.put("pq_UnbalNegU",uiSeq[0][3]);
|
||||
|
||||
hashMapM.put("pq_SeqZeroI",uiSeq[1][0]);
|
||||
hashMapM.put("pq_SeqNegI",uiSeq[1][1]);
|
||||
hashMapM.put("pq_SeqPosI",uiSeq[1][2]);
|
||||
hashMapM.put("pq_UnbalNegI",uiSeq[1][3]);
|
||||
|
||||
// pqdDataT.setpq_SeqZeroU(uiSeq[0][0]);
|
||||
// pqdDataT.setpq_SeqNegU(uiSeq[0][1]);
|
||||
// pqdDataT.setpq_SeqPosU(uiSeq[0][2]);
|
||||
// pqdDataT.setpq_UnbalNegU(uiSeq[0][3]);
|
||||
|
||||
// pqdDataT.setpq_SeqZeroI(uiSeq[1][0]);
|
||||
// pqdDataT.setpq_SeqNegI(uiSeq[1][1]);
|
||||
// pqdDataT.setpq_SeqPosI(uiSeq[1][2]);
|
||||
// pqdDataT.setpq_UnbalNegI(uiSeq[1][3]);
|
||||
//电压存含有率,电流存幅值
|
||||
//整次谐波 电压A B C N 电流A B C N 1200
|
||||
//幅值
|
||||
Float[][] fuHarm = min.getFuHarm();
|
||||
//谐波相角-送一半数据 600
|
||||
Float[][] fuHarmPhase = min.getFuHarmPhase();
|
||||
|
||||
|
||||
|
||||
//含有率
|
||||
Float[][] harmContain = min.getHarm_Contain();
|
||||
//谐波功率
|
||||
Float[][][] harmPower = min.getHarm_Power();
|
||||
for (int i = 0; i < 49; i++) {
|
||||
//电压含有率
|
||||
hashMapA.put("pq_HarmU_"+(i+2),harmContain[0][i]);
|
||||
hashMapB.put("pq_HarmU_"+(i+2),harmContain[1][i]);
|
||||
hashMapC.put("pq_HarmU_"+(i+2),harmContain[2][i]);
|
||||
|
||||
//谐波相角
|
||||
hashMapA.put("pq_HarmUAng_"+(i+2),fuHarmPhase[0][i]);
|
||||
hashMapB.put("pq_HarmUAng_"+(i+2),fuHarmPhase[1][i]);
|
||||
hashMapC.put("pq_HarmUAng_"+(i+2),fuHarmPhase[2][i]);
|
||||
|
||||
hashMapA.put("pq_HarmIAng_"+(i+2),fuHarmPhase[3][i]);
|
||||
hashMapB.put("pq_HarmIAng_"+(i+2),fuHarmPhase[4][i]);
|
||||
hashMapC.put("pq_HarmIAng_"+(i+2),fuHarmPhase[5][i]);
|
||||
|
||||
//电流幅值
|
||||
hashMapA.put("pq_HarmI_"+(i+2),fuHarm[3][i]);
|
||||
hashMapB.put("pq_HarmI_"+(i+2),fuHarm[4][i]);
|
||||
hashMapC.put("pq_HarmI_"+(i+2),fuHarm[5][i]);
|
||||
|
||||
|
||||
//谐波功率
|
||||
hashMapA.put("pq_HarmP_"+(i+2),harmPower[0][i][0]);
|
||||
hashMapA.put("pq_HarmQ_"+(i+2),harmPower[0][i][1]);
|
||||
hashMapA.put("pq_HarmS_"+(i+2),harmPower[0][i][2]);
|
||||
|
||||
hashMapB.put("pq_HarmP_"+(i+2),harmPower[1][i][0]);
|
||||
hashMapB.put("pq_HarmQ_"+(i+2),harmPower[1][i][1]);
|
||||
hashMapB.put("pq_HarmS_"+(i+2),harmPower[1][i][2]);
|
||||
|
||||
hashMapC.put("pq_HarmP_"+(i+2),harmPower[2][i][0]);
|
||||
hashMapC.put("pq_HarmQ_"+(i+2),harmPower[2][i][1]);
|
||||
hashMapC.put("pq_HarmS_"+(i+2),harmPower[2][i][2]);
|
||||
//M相目前没有
|
||||
// hashMapT.put("pq_HarmP_"+(i+2),harmPower[3][i][0]);
|
||||
// hashMapT.put("pq_HarmQ_"+(i+2),harmPower[3][i][1]);
|
||||
// hashMapT.put("pq_HarmS_"+(i+2),harmPower[3][i][2]);
|
||||
}
|
||||
//间谐波-送一半数据
|
||||
Float[][] inHarm = min.getInHarm();
|
||||
|
||||
|
||||
for (int i = 0; i < 50; i++) {
|
||||
//间谐波幅值
|
||||
hashMapA.put("pq_InHarmIAmp_"+(i+1),inHarm[3][i]);
|
||||
hashMapB.put("pq_InHarmIAmp_"+(i+1),inHarm[4][i]);
|
||||
hashMapC.put("pq_InHarmIAmp_"+(i+1),inHarm[5][i]);
|
||||
|
||||
|
||||
|
||||
}
|
||||
//a,b,c,total 总功率(P.Q.S)
|
||||
Float[][] totalPower = min.getTotal_Power();
|
||||
hashMapA.put("pq_P",totalPower[0][0]);
|
||||
hashMapB.put("pq_P",totalPower[1][0]);
|
||||
hashMapC.put("pq_P",totalPower[2][0]);
|
||||
|
||||
hashMapA.put("pq_Q",totalPower[0][1]);
|
||||
hashMapB.put("pq_Q",totalPower[1][1]);
|
||||
hashMapC.put("pq_Q",totalPower[2][1]);
|
||||
|
||||
hashMapA.put("pq_S",totalPower[0][2]);
|
||||
hashMapB.put("pq_S",totalPower[1][2]);
|
||||
hashMapC.put("pq_S",totalPower[2][2]);
|
||||
|
||||
hashMapM.put("pq_TotHarmP",totalPower[3][0]);
|
||||
hashMapM.put("pq_TotHarmQ",totalPower[3][1]);
|
||||
hashMapM.put("pq_TotHarmS",totalPower[3][2]);
|
||||
|
||||
/*todo 谐波畸变率,电压波动,电压闪变,电压长闪变会根据监测点接线方式是星型存A,B,C相,角型或者V型存AB,BC,CA相,目前全存在A,B,C相*/
|
||||
//谐波畸变率
|
||||
Float[] harmAberrance = min.getHarm_Aberrance();
|
||||
hashMapA.put("pq_ThdU",harmAberrance[0]);
|
||||
hashMapB.put("pq_ThdU",harmAberrance[1]);
|
||||
hashMapC.put("pq_ThdU",harmAberrance[2]);
|
||||
|
||||
hashMapA.put("pq_ThdI",harmAberrance[3]);
|
||||
hashMapB.put("pq_ThdI",harmAberrance[4]);
|
||||
hashMapC.put("pq_ThdI",harmAberrance[5]);
|
||||
|
||||
//视在功率因数
|
||||
Float[] cosPf = min.getCos_PF();
|
||||
hashMapA.put("pq_PF",cosPf[0]);
|
||||
hashMapB.put("pq_PF",cosPf[1]);
|
||||
hashMapC.put("pq_PF",cosPf[2]);
|
||||
hashMapM.put("pq_TotPF",cosPf[3]);
|
||||
//位移功率因数=
|
||||
Float[] cosDf = min.getCos_DF();
|
||||
hashMapA.put("pq_DF",cosDf[0]);
|
||||
hashMapB.put("pq_DF",cosDf[1]);
|
||||
hashMapC.put("pq_DF",cosDf[2]);
|
||||
hashMapM.put("pq_TotDF",cosDf[3]);
|
||||
//电压波动
|
||||
Float[] uFluctuation = min.getU_Fluctuation();
|
||||
hashMapA.put("pq_Fluct",uFluctuation[0]);
|
||||
hashMapB.put("pq_Fluct",uFluctuation[1]);
|
||||
hashMapC.put("pq_Fluct",uFluctuation[2]);
|
||||
//电压闪变
|
||||
Float[] uFlicker = min.getU_Flicker();
|
||||
hashMapA.put("pq_Plt",uFlicker[0]);
|
||||
hashMapB.put("pq_Plt",uFlicker[1]);
|
||||
hashMapC.put("pq_Plt",uFlicker[2]);
|
||||
//电压长闪变
|
||||
Float[] ulFlicker = min.getUL_Flicker();
|
||||
hashMapA.put("pq_Plt",ulFlicker[0]);
|
||||
hashMapB.put("pq_Plt",ulFlicker[1]);
|
||||
hashMapC.put("pq_Plt",ulFlicker[2]);
|
||||
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
mapper.registerModule(new JavaTimeModule());
|
||||
PqdData pqdDataA = mapper.convertValue(hashMapA, PqdData.class);
|
||||
PqdData pqdDataB = mapper.convertValue(hashMapB, PqdData.class);
|
||||
PqdData pqdDataC = mapper.convertValue(hashMapC, PqdData.class);
|
||||
PqdData pqdDataM = mapper.convertValue(hashMapM, PqdData.class);
|
||||
|
||||
pqdData.add(pqdDataA);
|
||||
pqdData.add(pqdDataB);
|
||||
pqdData.add(pqdDataC);
|
||||
pqdData.add(pqdDataM);
|
||||
|
||||
return pqdData;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static boolean isZero(float value) {
|
||||
return Math.abs(value) < 1e-6; // 判断value是否在精度范围内近似等于0
|
||||
}
|
||||
|
||||
// 实现转换高频谐波数据的逻辑
|
||||
private static HashMap<Date, MinDataHh> convertMinHh(MultipartFile file,HashMap<Date, MinDataHh> minDataHhDic) throws IOException {
|
||||
String strFile = file.getOriginalFilename();
|
||||
// 实现转换高频谐波数据的逻辑
|
||||
System.out.println("Converting HH data from: " + file.getOriginalFilename());
|
||||
InputStream binFile = null;
|
||||
try{
|
||||
try {
|
||||
binFile = file.getInputStream();
|
||||
} catch (FileNotFoundException e) {
|
||||
binFile.close();
|
||||
System.out.println(String.format("文件%1$s 长度为0字节,程序将跳过本文件的转换", strFile));
|
||||
}
|
||||
|
||||
long nBufSize = binFile.available(); //计算需要解析的文件总长
|
||||
int n1BufLen = tagPQDataCmnHh.GetSize(); //计算单个统计结构大小
|
||||
int nSecNum = (int)(nBufSize / n1BufLen); //确认共多少事件数据结构
|
||||
|
||||
int nStep = 0; //读取偏移量
|
||||
for (int i = 0; i < nSecNum; i++) {
|
||||
byte[] bBuf = new byte[n1BufLen]; //单个统计结构
|
||||
int nReadLen = 0;
|
||||
try {
|
||||
//java流不需要跳
|
||||
// binFile.skip(nStep);
|
||||
nReadLen = binFile.read(bBuf, 0, bBuf.length);
|
||||
} catch (IOException e) {
|
||||
System.out.println(String.format("文件%1$s 读取时发生错误,代码为%2$s", strFile, e.getClass().getName()));
|
||||
binFile.close();
|
||||
}
|
||||
|
||||
tagPQDataCmnHh tagPqData = new tagPQDataCmnHh();
|
||||
tagPqData.SetStructBuf(bBuf, 0);
|
||||
nStep += n1BufLen;
|
||||
|
||||
RTC_Timer_MS Devtime = tagPqData.time;
|
||||
Date time = new Date(Devtime.year - 1900, Devtime.month - 1, Devtime.day, Devtime.hour, Devtime.minute, Devtime.second);
|
||||
if (!minHh_starttime.equals(new Date(0))) { //存在启动时间
|
||||
if (time.compareTo(minHh_starttime) <= 0) {
|
||||
minHh_starttime = time;
|
||||
}
|
||||
} else { //不存在启动时间 填入当前时间
|
||||
minHh_starttime = time;
|
||||
}
|
||||
if (!minHh_endtime.equals(new Date(0))) {
|
||||
if (time.compareTo(minHh_endtime) >= 0) {
|
||||
minHh_endtime = time;
|
||||
}
|
||||
} else { //不存在结束时间 填入当前时间
|
||||
minHh_endtime = time;
|
||||
}
|
||||
|
||||
if (strFile.toUpperCase().indexOf("AVG") >= 0) {
|
||||
if (minDataHhDic.containsKey(time)) {
|
||||
minDataHhDic.get(time).avg = tagPqData;
|
||||
} else {
|
||||
MinDataHh minData = new MinDataHh();
|
||||
minData.avg = tagPqData;
|
||||
minDataHhDic.put(time, minData);
|
||||
}
|
||||
} else if (strFile.toUpperCase().indexOf("CP95") >= 0) {
|
||||
if (minDataHhDic.containsKey(time)) {
|
||||
minDataHhDic.get(time).cp95 = tagPqData;
|
||||
} else {
|
||||
MinDataHh minData = new MinDataHh();
|
||||
minData.cp95 = tagPqData;
|
||||
minDataHhDic.put(time, minData);
|
||||
}
|
||||
} else if (strFile.toUpperCase().indexOf("MAX") >= 0) {
|
||||
if (minDataHhDic.containsKey(time)) {
|
||||
minDataHhDic.get(time).max = tagPqData;
|
||||
} else {
|
||||
MinDataHh minData = new MinDataHh();
|
||||
minData.max = tagPqData;
|
||||
minDataHhDic.put(time, minData);
|
||||
}
|
||||
} else if (strFile.toUpperCase().indexOf("MIN") >= 0) {
|
||||
if (minDataHhDic.containsKey(time)) {
|
||||
minDataHhDic.get(time).min = tagPqData;
|
||||
} else {
|
||||
MinDataHh minData = new MinDataHh();
|
||||
minData.min = tagPqData;
|
||||
minDataHhDic.put(time, minData);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
binFile.close();
|
||||
System.out.println(String.format("文件%1$s 长度为0字节,程序将跳过本文件的转换", strFile));
|
||||
}
|
||||
|
||||
return minDataHhDic;
|
||||
}
|
||||
// 实现转换分钟数据的逻辑
|
||||
private static void convertMin(MultipartFile file, HashMap<Date, MinData> minDataDic) {
|
||||
String strFile = file.getOriginalFilename();
|
||||
InputStream binFile = null;
|
||||
|
||||
try {
|
||||
|
||||
// 实现转换分钟数据的逻辑
|
||||
System.out.println("Converting minute data from: " + strFile);
|
||||
|
||||
binFile = file.getInputStream();
|
||||
|
||||
|
||||
long nBufSize = 0;
|
||||
|
||||
nBufSize = binFile.available(); //计算需要解析的文件总长
|
||||
|
||||
|
||||
int n1BufLen = tagPQDataCmn.GetSize(); //计算单个统计结构大小
|
||||
int nMinNum = (int) (nBufSize / n1BufLen); //确认共多少分钟数据结构
|
||||
|
||||
int nStep = 0; //读取偏移量
|
||||
for (int i = 0; i < nMinNum; i++) {
|
||||
byte[] bBuf = new byte[n1BufLen]; //单个统计结构
|
||||
int nReadLen = 0;
|
||||
try {
|
||||
//java流不需要跳
|
||||
// binFile.skip(nStep);
|
||||
nReadLen = binFile.read(bBuf, 0, bBuf.length);
|
||||
} catch (IOException e) {
|
||||
System.out.println("文件读取时发生错误,代码为" + e.getClass().getName());
|
||||
binFile.close();
|
||||
}
|
||||
|
||||
tagPQDataCmn tagPqData = new tagPQDataCmn();
|
||||
tagPqData.SetStructBuf(bBuf, 0);
|
||||
nStep += n1BufLen;
|
||||
|
||||
RTC_Timer_MS Devtime = tagPqData.time;
|
||||
Date time = new Date(Devtime.year - 1900, Devtime.month - 1, Devtime.day, Devtime.hour, Devtime.minute, Devtime.second);
|
||||
if (!minStarttime.equals(new Date(0))) { //存在启动时间
|
||||
if (time.compareTo(minStarttime) <= 0) {
|
||||
minStarttime = time;
|
||||
}
|
||||
} else { //不存在启动时间 填入当前时间
|
||||
minStarttime = time;
|
||||
}
|
||||
if (!minEndtime.equals(new Date(0))) {
|
||||
if (time.compareTo(minEndtime) >= 0) {
|
||||
minEndtime = time;
|
||||
}
|
||||
} else { //不存在结束时间 填入当前时间
|
||||
minEndtime = time;
|
||||
}
|
||||
|
||||
if (strFile.toUpperCase().indexOf("AVG") >= 0) {
|
||||
if (minDataDic.containsKey(time)) {
|
||||
minDataDic.get(time).avg = tagPqData;
|
||||
} else {
|
||||
MinData minData = new MinData();
|
||||
minData.avg = tagPqData;
|
||||
minDataDic.put(time, minData);
|
||||
}
|
||||
} else if (strFile.toUpperCase().indexOf("CP95") >= 0) {
|
||||
if (minDataDic.containsKey(time)) {
|
||||
minDataDic.get(time).cp95 = tagPqData;
|
||||
} else {
|
||||
MinData minData = new MinData();
|
||||
minData.cp95 = tagPqData;
|
||||
minDataDic.put(time, minData);
|
||||
}
|
||||
} else if (strFile.toUpperCase().indexOf("MAX") >= 0) {
|
||||
if (minDataDic.containsKey(time)) {
|
||||
minDataDic.get(time).max = tagPqData;
|
||||
} else {
|
||||
MinData minData = new MinData();
|
||||
minData.max = tagPqData;
|
||||
minDataDic.put(time, minData);
|
||||
}
|
||||
} else if (strFile.toUpperCase().indexOf("MIN") >= 0) {
|
||||
if (minDataDic.containsKey(time)) {
|
||||
minDataDic.get(time).min = tagPqData;
|
||||
} else {
|
||||
MinData minData = new MinData();
|
||||
minData.min = tagPqData;
|
||||
minDataDic.put(time, minData);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
System.out.println("处理文件时发生错误: " + strFile);
|
||||
} finally {
|
||||
if (binFile != null) {
|
||||
try {
|
||||
binFile.close();
|
||||
} catch (IOException e) {
|
||||
System.out.println("关闭文件时发生错误: " + strFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public static List<tagComtradeCfg> convertCfgFile(String strFilePath) { //解析cfg录波文件
|
||||
List<tagComtradeCfg> tagComtradeCfgList = new ArrayList<>();
|
||||
// File folder = new File(strFilePath);
|
||||
// File[] files = folder.listFiles((dir, name) -> name.endsWith(".cfg")); //获取文件夹下所有cfg文件
|
||||
// Arrays.stream(files).forEach(file -> {
|
||||
// tagComtradeCfg tagComtradeCfg = analyseComtradeCfg(file.getAbsolutePath());
|
||||
// tagComtradeCfgList.add(tagComtradeCfg);
|
||||
// });
|
||||
return tagComtradeCfgList;
|
||||
}
|
||||
/**
|
||||
* @Description: analyseComtradeCfg 读取、分析cfg录波文件!!!
|
||||
* @Param:
|
||||
* @return: com.njcn.user.utils.test.tagComtradeCfg
|
||||
* @Author: clam
|
||||
* @Date: 2024/7/15
|
||||
*/
|
||||
public static tagComtradeCfg analyseComtradeCfg(MultipartFile file) {
|
||||
tagComtradeCfg comtradeCfg = new tagComtradeCfg();
|
||||
String strFilePath = file.getOriginalFilename();
|
||||
int i = 0; //用于遍历 字符串转换的字段数组
|
||||
String strFileLine;//临时存放 cfg每行读取的字符串
|
||||
String[] strTempArray; //临时存放 字符串转换的字段数组
|
||||
|
||||
tagRates ratesCfg = new tagRates();
|
||||
try {
|
||||
InputStream readFile = file.getInputStream();
|
||||
InputStreamReader isr = new InputStreamReader(readFile, StandardCharsets.UTF_8);
|
||||
BufferedReader sr = new BufferedReader(isr);
|
||||
comtradeCfg = new tagComtradeCfg();//配置文件总类对象初始化
|
||||
ratesCfg = new tagRates();//多段采样类对象初始化
|
||||
long nFreq = 0; //临时存放 采样频率 例:50Hz
|
||||
//第一行不关心仅仅是一些描述类的信息
|
||||
strFileLine = sr.readLine(); // ①
|
||||
//第二行需要关心第二个:模拟通道编号(模拟量的个数)和第三个:状态通道参数(开关量的个数)
|
||||
strFileLine = sr.readLine(); // ②
|
||||
strTempArray = strFileLine.split(",");
|
||||
for (i = 0; i < strTempArray.length; i++) {
|
||||
switch (i) {
|
||||
case 0: //通道总个数
|
||||
comtradeCfg.nChannelNum = Integer.parseInt(strTempArray[i]);
|
||||
break;
|
||||
case 1: //模拟量的个数
|
||||
String str = strTempArray[i].substring(0, strTempArray[i].length() - 1);
|
||||
comtradeCfg.nAnalogNum = Integer.parseInt(str);
|
||||
break;
|
||||
case 2://开关量的个数
|
||||
str = strTempArray[i].substring(0, strTempArray[i].length() - 1);
|
||||
comtradeCfg.nDigitalNum = Integer.parseInt(str);
|
||||
break;
|
||||
}
|
||||
}
|
||||
//从第三行到第ComtradeCfg.nChannelNum+3行是模拟量通道和数字量通道
|
||||
List<tagOneChannleCfg> OneChannleCfgList =new ArrayList<>();
|
||||
for (i = 0; i < comtradeCfg.nChannelNum; i++) {
|
||||
tagOneChannleCfg oneChannlecfg = new tagOneChannleCfg();
|
||||
|
||||
strFileLine = sr.readLine(); // ③ or ④ or ⑤
|
||||
strTempArray = strFileLine.split(",");
|
||||
for (int j = 0; j < strTempArray.length; j++) {
|
||||
switch (j) {
|
||||
case 0://通道序号
|
||||
oneChannlecfg.nIndex = Integer.parseInt(strTempArray[j]);
|
||||
break;
|
||||
case 1://通道名称
|
||||
oneChannlecfg.szChannleName = strTempArray[j];
|
||||
break;
|
||||
case 2://监视的通道名称
|
||||
oneChannlecfg.szPhasicName = strTempArray[j];
|
||||
break;
|
||||
case 3://监视的通道名称
|
||||
oneChannlecfg.szMonitoredChannleName = strTempArray[j];
|
||||
break;
|
||||
case 4://通道的单位
|
||||
oneChannlecfg.szUnitName = strTempArray[j];
|
||||
break;
|
||||
case 5://通道的系数
|
||||
oneChannlecfg.fCoefficent = Float.parseFloat(strTempArray[j]);
|
||||
break;
|
||||
case 6://通道的偏移量
|
||||
oneChannlecfg.fOffset = Float.parseFloat(strTempArray[j]);
|
||||
break;
|
||||
case 7://起始采样时间的偏移量
|
||||
oneChannlecfg.fTimeOffset = Float.parseFloat(strTempArray[j]);
|
||||
break;
|
||||
case 8://采样值的最小值
|
||||
oneChannlecfg.nMin = Integer.parseInt(strTempArray[j]);
|
||||
break;
|
||||
case 9://采样值的最大值
|
||||
oneChannlecfg.nMax = Integer.parseInt(strTempArray[j]);
|
||||
break;
|
||||
case 10://一次变比
|
||||
oneChannlecfg.fPrimary = Float.parseFloat(strTempArray[j]);
|
||||
break;
|
||||
case 11://二次变比
|
||||
oneChannlecfg.fSecondary = Float.parseFloat(strTempArray[j]);
|
||||
break;
|
||||
case 12://一次值还是二次值标志
|
||||
oneChannlecfg.szValueType = strTempArray[j];
|
||||
break;
|
||||
}
|
||||
}
|
||||
OneChannleCfgList.add(oneChannlecfg);
|
||||
|
||||
}
|
||||
comtradeCfg.setOneChannleCfg(OneChannleCfgList);
|
||||
//采样频率:在交变电流电路中一秒钟内交流电所允许而必须变化的周期数,即:在单位时间内振动的次数
|
||||
strFileLine = sr.readLine(); // ⑥
|
||||
float fFreq = Float.parseFloat(strFileLine);
|
||||
nFreq = (long) fFreq;
|
||||
|
||||
strFileLine = sr.readLine(); // ⑦
|
||||
int nRates = Integer.parseInt(strFileLine);
|
||||
ratesCfg.nRates = nRates;
|
||||
|
||||
long nOffset = 0;//上一段单周波采样点数
|
||||
long nMSTotal = 0;//录波总毫秒数
|
||||
for (i = 0; i < nRates; i++) {
|
||||
strFileLine = sr.readLine(); //⑧例:3200,22400 ——> 理解为:1到22400这22400个数据的采样率是3200
|
||||
strTempArray = strFileLine.split(",");
|
||||
|
||||
tagOneRate oneRate = new tagOneRate();//1段采样类对象
|
||||
ratesCfg.getOneRate().add(oneRate);
|
||||
for (int j = 0; j < strTempArray.length; j++) {
|
||||
switch (j) {
|
||||
case 0://采样率:1秒钟内的采样点数
|
||||
oneRate.nOneSample = (long) (Float.parseFloat(strTempArray[j]) / nFreq);
|
||||
break;
|
||||
case 1: //总采样点数
|
||||
oneRate.nSampleNum = (long) (Float.parseFloat(strTempArray[j]) - nOffset);
|
||||
nOffset += oneRate.nSampleNum;
|
||||
break;
|
||||
}
|
||||
nMSTotal += oneRate.nSampleNum / oneRate.nOneSample;
|
||||
}
|
||||
}
|
||||
|
||||
nMSTotal *= 20; //录波总毫秒数 注:一个周波20ms,所以此处要乘以20
|
||||
if (nMSTotal > 60000) {//如果事件长度超过1分钟,则结束处理,不调用录波高级算法qvvr_fun
|
||||
|
||||
sr.close();
|
||||
readFile.close();
|
||||
return comtradeCfg;
|
||||
}
|
||||
//波形起始时间
|
||||
strFileLine = sr.readLine(); // ⑨
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy,HH:mm:ss.SSSSSS");
|
||||
comtradeCfg.setTimeTrigger(sdf.parse(strFileLine));
|
||||
|
||||
strFileLine = sr.readLine(); // ⑩
|
||||
comtradeCfg.setTimeStart(sdf.parse(strFileLine));
|
||||
comtradeCfg.setTimeEnd(new Date(comtradeCfg.getTimeStart().getTime() + nMSTotal));;
|
||||
comtradeCfg.setPath(file.getOriginalFilename());
|
||||
|
||||
sr.close();
|
||||
readFile.close();
|
||||
} catch (IOException | ParseException e) {
|
||||
System.out.println("Error opening file: " + strFilePath + " " + e.getMessage());
|
||||
return comtradeCfg;
|
||||
}
|
||||
|
||||
return comtradeCfg;
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
// tagComtradeCfg tagComtradeCfg = AnalyseComtradeCfg.analyseComtradeCfg("C:\\Users\\Administrator\\Desktop\\浙江无线\\离线数据上传\\09\\comtrade\\line1_20240704_143908_213.cfg");
|
||||
// System.out.println(tagComtradeCfg);
|
||||
// HashMap<Date, MinData> minDataHashMap = AnalyseComtradeCfg.processDirectory("C:\\Users\\Administrator\\Desktop\\浙江无线\\离线数据上传\\09\\min");
|
||||
// PqdData pqdData = new PqdData();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.njcn.csharmonic.offline.mincfg;
|
||||
|
||||
|
||||
import com.njcn.csharmonic.offline.mincfg.vo.tagPQDataCmn;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Date: 2024/7/16 10:45【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Data
|
||||
public class MinData {
|
||||
public tagPQDataCmn max;
|
||||
public tagPQDataCmn min;
|
||||
public tagPQDataCmn cp95;
|
||||
public tagPQDataCmn avg;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.njcn.csharmonic.offline.mincfg;
|
||||
|
||||
import com.njcn.csharmonic.offline.mincfg.vo.tagPQDataCmnHh;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Date: 2024/7/16 10:35【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Data
|
||||
public class MinDataHh {
|
||||
public tagPQDataCmnHh max;
|
||||
public tagPQDataCmnHh min;
|
||||
public tagPQDataCmnHh cp95;
|
||||
public tagPQDataCmnHh avg;
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.njcn.csharmonic.offline.mincfg;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Date: 2024/7/15 19:18【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public class RTC_Timer_MS {
|
||||
public short year;
|
||||
public short month;
|
||||
public short day;
|
||||
public short hour;
|
||||
public short minute;
|
||||
public short second;
|
||||
public short millisecond;
|
||||
|
||||
public static int GetSize() {
|
||||
return 7 * Short.BYTES;
|
||||
}
|
||||
|
||||
public boolean setStructBuf(byte[] bArray, int nHaveRead) {
|
||||
int nByteSize = bArray.length;
|
||||
if (nByteSize < GetSize()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ByteBuffer byteBuffer = ByteBuffer.wrap(bArray).order(ByteOrder.LITTLE_ENDIAN);
|
||||
int iStep = nHaveRead;
|
||||
|
||||
year = byteBuffer.getShort(iStep);
|
||||
iStep += Short.BYTES;
|
||||
month = byteBuffer.getShort(iStep);
|
||||
iStep += Short.BYTES;
|
||||
day = byteBuffer.getShort(iStep);
|
||||
iStep += Short.BYTES;
|
||||
hour = byteBuffer.getShort(iStep);
|
||||
iStep += Short.BYTES;
|
||||
minute = byteBuffer.getShort(iStep);
|
||||
iStep += Short.BYTES;
|
||||
second = byteBuffer.getShort(iStep);
|
||||
iStep += Short.BYTES;
|
||||
millisecond = byteBuffer.getShort(iStep);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public int GetStructBuf(byte[] bArray, int nHaveRead) {
|
||||
int nSize = bArray.length;
|
||||
if (nSize < (nHaveRead + GetSize())) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
ByteBuffer byteBuffer = ByteBuffer.wrap(bArray).order(ByteOrder.LITTLE_ENDIAN);
|
||||
int iStep = nHaveRead;
|
||||
|
||||
byteBuffer.putShort(iStep, year);
|
||||
iStep += Short.BYTES;
|
||||
byteBuffer.putShort(iStep, month);
|
||||
iStep += Short.BYTES;
|
||||
byteBuffer.putShort(iStep, day);
|
||||
iStep += Short.BYTES;
|
||||
byteBuffer.putShort(iStep, hour);
|
||||
iStep += Short.BYTES;
|
||||
byteBuffer.putShort(iStep, minute);
|
||||
iStep += Short.BYTES;
|
||||
byteBuffer.putShort(iStep, second);
|
||||
iStep += Short.BYTES;
|
||||
byteBuffer.putShort(iStep, millisecond);
|
||||
|
||||
return GetSize();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,126 @@
|
||||
package com.njcn.csharmonic.offline.mincfg;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Date: 2024/7/15 19:14【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public class TagPQDataCmnHh {
|
||||
short name; /*监测点序号 2 */
|
||||
short dataType; /*数据类型 2 */
|
||||
public int dataTag; /* 标记 1:暂态标记 2:无效数据*/
|
||||
public RTC_Timer_MS time; /* 时标 */
|
||||
/*2-9k谐波 2.1kHz / 2.3kHZ … 8.9kHz */
|
||||
public float[][] hharmRmsList29K; /*6-35 谐波有效值序列(Uabc/Iabc) */
|
||||
public float[][] hharmThdList29K; /*6-35 谐波含有率序列 */
|
||||
public float[] hharmTotalRms29K; /*6 谐波总有效值 */
|
||||
public float[] hharmTotalThd29K; /*6 谐波总畸变率 */
|
||||
public float[] hharmMaxRms29K; /*6 谐波最大有效值 */
|
||||
public float[] hharmMaxThd29K; /*6 谐波最大畸变率 */
|
||||
public float[] hharmMaxFreq29K; /*6 谐波最大值频点 */
|
||||
/*2-150k谐波 2kHz / 4kHz … 150kHz */
|
||||
public float[][] hharmRmsList2150K; /*6-75 谐波有效值序列(2-150) */
|
||||
public float[][] hharmThdList2150K; /*6-75 谐波含有率序列 */
|
||||
public float[] hharmTotalRms2150K; /*6 谐波总有效值 */
|
||||
public float[] hharmTotalThd2150K; /*6 谐波总畸变率 */
|
||||
public float[] hharmMaxRms2150K; /*6 谐波最大有效值 */
|
||||
public float[] hharmMaxThd2150K; /*6 谐波最大畸变率 */
|
||||
public float[] hharmMaxFreq2150K; /*6 谐波最大值频点 */
|
||||
|
||||
public static int getSize() {
|
||||
int len = RTC_Timer_MS.GetSize() + 2 * Short.BYTES + 1 * Integer.BYTES + 6 * 35 * 2 * Float.BYTES + 6 * 75 * 2 * Float.BYTES + 6 * 10 * Float.BYTES;
|
||||
return len;
|
||||
}
|
||||
|
||||
public TagPQDataCmnHh() {
|
||||
time = new RTC_Timer_MS();
|
||||
hharmRmsList29K = new float[6][35];
|
||||
hharmThdList29K = new float[6][35];
|
||||
hharmTotalRms29K = new float[6];
|
||||
hharmTotalThd29K = new float[6];
|
||||
hharmMaxRms29K = new float[6];
|
||||
hharmMaxThd29K = new float[6];
|
||||
hharmMaxFreq29K = new float[6];
|
||||
hharmRmsList2150K = new float[6][75];
|
||||
hharmThdList2150K = new float[6][75];
|
||||
hharmTotalRms2150K = new float[6];
|
||||
hharmTotalThd2150K = new float[6];
|
||||
hharmMaxRms2150K = new float[6];
|
||||
hharmMaxThd2150K = new float[6];
|
||||
hharmMaxFreq2150K = new float[6];
|
||||
}
|
||||
|
||||
public boolean setStructBuf(byte[] bArray, int nHaveRead) {
|
||||
int nByteSize = bArray.length;
|
||||
//int size = getSize();
|
||||
if (nByteSize < getSize()){
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
int iStep = nHaveRead;
|
||||
name = ByteBuffer.wrap(Arrays.copyOfRange(bArray, iStep, iStep + Short.BYTES)).order(ByteOrder.LITTLE_ENDIAN).getShort(); iStep += Short.BYTES;
|
||||
dataType = ByteBuffer.wrap(Arrays.copyOfRange(bArray, iStep, iStep + Short.BYTES)).order(ByteOrder.LITTLE_ENDIAN).getShort(); iStep += Short.BYTES;
|
||||
dataTag = ByteBuffer.wrap(Arrays.copyOfRange(bArray, iStep, iStep + Integer.BYTES)).order(ByteOrder.LITTLE_ENDIAN).getInt(); iStep += Integer.BYTES;
|
||||
time.setStructBuf(bArray, iStep);
|
||||
iStep += RTC_Timer_MS.GetSize();
|
||||
|
||||
for (int i = 0; i < 6; i++) {
|
||||
for (int j = 0; j < 35; j++) {
|
||||
hharmRmsList29K[i][j] = ByteBuffer.wrap(Arrays.copyOfRange(bArray, iStep, iStep + Float.BYTES)).order(ByteOrder.LITTLE_ENDIAN).getFloat(); iStep += Float.BYTES;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < 6; i++) {
|
||||
for (int j = 0; j < 35; j++) {
|
||||
hharmThdList29K[i][j] = ByteBuffer.wrap(Arrays.copyOfRange(bArray, iStep, iStep + Float.BYTES)).order(ByteOrder.LITTLE_ENDIAN).getFloat(); iStep += Float.BYTES;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < 6; i++) {
|
||||
hharmTotalRms29K[i] = ByteBuffer.wrap(Arrays.copyOfRange(bArray, iStep, iStep + Float.BYTES)).order(ByteOrder.LITTLE_ENDIAN).getFloat(); iStep += Float.BYTES;
|
||||
}
|
||||
for (int i = 0; i < 6; i++) {
|
||||
hharmTotalThd29K[i] = ByteBuffer.wrap(Arrays.copyOfRange(bArray, iStep, iStep + Float.BYTES)).order(ByteOrder.LITTLE_ENDIAN).getFloat(); iStep += Float.BYTES;
|
||||
}
|
||||
for (int i = 0; i < 6; i++) {
|
||||
hharmMaxRms29K[i] = ByteBuffer.wrap(Arrays.copyOfRange(bArray, iStep, iStep + Float.BYTES)).order(ByteOrder.LITTLE_ENDIAN).getFloat(); iStep += Float.BYTES;
|
||||
}
|
||||
for (int i = 0; i < 6; i++) {
|
||||
hharmMaxThd29K[i] = ByteBuffer.wrap(Arrays.copyOfRange(bArray, iStep, iStep + Float.BYTES)).order(ByteOrder.LITTLE_ENDIAN).getFloat(); iStep += Float.BYTES;
|
||||
}
|
||||
for (int i = 0; i < 6; i++) {
|
||||
hharmMaxFreq29K[i] = ByteBuffer.wrap(Arrays.copyOfRange(bArray, iStep, iStep + Float.BYTES)).order(ByteOrder.LITTLE_ENDIAN).getFloat(); iStep += Float.BYTES;
|
||||
}
|
||||
for (int i = 0; i < 6; i++) {
|
||||
for (int j = 0; j < 75; j++) {
|
||||
hharmRmsList2150K[i][j] = ByteBuffer.wrap(Arrays.copyOfRange(bArray, iStep, iStep + Float.BYTES)).order(ByteOrder.LITTLE_ENDIAN).getFloat(); iStep += Float.BYTES;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < 6; i++) {
|
||||
for (int j = 0; j < 75; j++) {
|
||||
hharmThdList2150K[i][j] = ByteBuffer.wrap(Arrays.copyOfRange(bArray, iStep, iStep + Float.BYTES)).order(ByteOrder.LITTLE_ENDIAN).getFloat(); iStep += Float.BYTES;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < 6; i++) {
|
||||
hharmTotalRms2150K[i] = ByteBuffer.wrap(Arrays.copyOfRange(bArray, iStep, iStep + Float.BYTES)).order(ByteOrder.LITTLE_ENDIAN).getFloat(); iStep += Float.BYTES;
|
||||
}
|
||||
for (int i = 0; i < 6; i++) {
|
||||
hharmTotalThd2150K[i] = ByteBuffer.wrap(Arrays.copyOfRange(bArray, iStep, iStep + Float.BYTES)).order(ByteOrder.LITTLE_ENDIAN).getFloat(); iStep += Float.BYTES;
|
||||
}
|
||||
for (int i = 0; i < 6; i++) {
|
||||
hharmMaxRms2150K[i] = ByteBuffer.wrap(Arrays.copyOfRange(bArray, iStep, iStep + Float.BYTES)).order(ByteOrder.LITTLE_ENDIAN).getFloat(); iStep += Float.BYTES;
|
||||
}
|
||||
for (int i = 0; i < 6; i++) {
|
||||
hharmMaxThd2150K[i] = ByteBuffer.wrap(Arrays.copyOfRange(bArray, iStep, iStep + Float.BYTES)).order(ByteOrder.LITTLE_ENDIAN).getFloat(); iStep += Float.BYTES;
|
||||
}
|
||||
for (int i = 0; i < 6; i++) {
|
||||
hharmMaxFreq2150K[i] = ByteBuffer.wrap(Arrays.copyOfRange(bArray, iStep, iStep + Float.BYTES)).order(ByteOrder.LITTLE_ENDIAN).getFloat(); iStep += Float.BYTES;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.njcn.csharmonic.offline.mincfg;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Date: 2024/7/15 15:40【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Data
|
||||
public class tagComtradeCfg implements Serializable {
|
||||
|
||||
public int nChannelNum; //通道总个数
|
||||
public int nAnalogNum; //模拟量通道的个数 WW 2013-05-15
|
||||
public int nDigitalNum; //数字量通道的个数 WW 2013-05-15
|
||||
public List<tagOneChannleCfg> OneChannleCfg; //模拟量通道记录类链表
|
||||
public List<tagOneChannleCfg_digital> OneChannleCfgDig; //数字量通道记录类链表
|
||||
public Date TimeTrigger; //暂态触发时间
|
||||
public Date TimeStart; //波形起始时间 注:相较于TimeTrigger波形触发时间起始有一段平滑过渡波形时间,约100ms
|
||||
public Date TimeEnd; //波形结束时间
|
||||
public String path;//对应波形cfg文件全路径名称
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.njcn.csharmonic.offline.mincfg;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Date: 2024/7/15 15:37【需求编号】
|
||||
*模拟量通道记录类
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Data
|
||||
public class tagOneChannleCfg implements Serializable {
|
||||
//通道序号
|
||||
public int nIndex;
|
||||
//通道名称
|
||||
public String szChannleName;
|
||||
//相位名称
|
||||
public String szPhasicName;
|
||||
//监视的通道名称
|
||||
public String szMonitoredChannleName;
|
||||
//通道的单位
|
||||
public String szUnitName;
|
||||
//通道的系数
|
||||
public float fCoefficent;
|
||||
//通道的便宜量
|
||||
public float fOffset;
|
||||
//起始采样时间的偏移量
|
||||
public float fTimeOffset;
|
||||
//采样值的最小值
|
||||
public int nMin;
|
||||
//采样值的最大值
|
||||
public int nMax;
|
||||
//一次变比
|
||||
public float fPrimary;
|
||||
//二次变比
|
||||
public float fSecondary;
|
||||
//一次值还是二次值标志
|
||||
public String szValueType;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.njcn.csharmonic.offline.mincfg;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Date: 2024/7/15 15:36【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
//数字量通道记录类
|
||||
@Data
|
||||
public class tagOneChannleCfg_digital implements Serializable {
|
||||
|
||||
//通道序号
|
||||
public int nIndex;
|
||||
//通道名称
|
||||
public String szChannleName;
|
||||
//相位名称
|
||||
public String szPhasicName;
|
||||
//监视的通道名称
|
||||
public String szMonitoredChannleName;
|
||||
//通道的单位
|
||||
public int Initial;;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.njcn.csharmonic.offline.mincfg;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Date: 2024/7/15 15:38【需求编号】
|
||||
*1段采样类
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Data
|
||||
public class tagOneRate {
|
||||
//采样率:1秒钟内的采样点数
|
||||
public long nOneSample;
|
||||
//总采样点数
|
||||
public long nSampleNum;
|
||||
//(1段录波中)波形个数
|
||||
public long nWaveNum;
|
||||
//抽点采样间隔 = CFG中每段录波采样率 / 实际抽点采样率
|
||||
public long nWaveSpan;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.njcn.csharmonic.offline.mincfg;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Date: 2024/7/15 15:39【需求编号】
|
||||
*多段采样类
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Data
|
||||
public class tagRates {
|
||||
public int nRates; //采样段数
|
||||
public List<tagOneRate> OneRate; //(每周波)采样率链表
|
||||
public tagRates()
|
||||
{
|
||||
this.OneRate = new ArrayList<>(); //(每周波)采样率链表 初始化
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,703 @@
|
||||
package com.njcn.csharmonic.offline.mincfg.vo;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||
import com.njcn.csharmonic.offline.mincfg.*;
|
||||
import com.njcn.influx.pojo.po.cs.PqdData;
|
||||
import com.njcn.csharmonic.offline.mincfg.vo.RTC_Timer_MS;
|
||||
import com.njcn.csharmonic.offline.mincfg.vo.tagPQDataCmn;
|
||||
import com.njcn.csharmonic.offline.mincfg.vo.tagPQDataCmnHh;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Date: 2024/7/15 15:42【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public class AnalyseComtradeCfg1 {
|
||||
|
||||
private static Date minStarttime = new Date(0);
|
||||
private static Date minEndtime = new Date(0); //分钟数据的时间范围
|
||||
|
||||
private static Date minHh_starttime = new Date(0);
|
||||
private static Date minHh_endtime = new Date(0);
|
||||
|
||||
//解析分钟数据和分钟数据下的高频谐波
|
||||
public static void processDirectory(String minPath) throws IOException {
|
||||
HashMap<Date, MinDataHh> minDataHhHashMap = new HashMap<>();
|
||||
HashMap<Date, MinData> minDataHashMap = new HashMap<>();
|
||||
File minDir = new File(minPath);
|
||||
if (minDir.exists() && minDir.isDirectory() && minDir.listFiles().length != 0) { // 分钟数据文件夹存在且不为空
|
||||
File[] dirs = minDir.listFiles(File::isDirectory); // 获取所有子目录
|
||||
for (File dir : dirs) {
|
||||
// 获取文件夹下所有.bin文件
|
||||
File[] files = dir.listFiles((dir1, name) -> name.endsWith(".bin"));
|
||||
|
||||
if (files != null) { // 确保files不为null
|
||||
for (File file : files) {
|
||||
if (file.getName().toUpperCase().indexOf("HH") >= 0) { // 读取分钟秒下的高频谐波数据
|
||||
convertMinHh(file.getAbsolutePath(),minDataHhHashMap);
|
||||
} else { // 读取分钟数据
|
||||
convertMin(file.getAbsolutePath(),minDataHashMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println(minDataHhHashMap);
|
||||
System.out.println(minDataHashMap);
|
||||
convertMinData(minDataHashMap);
|
||||
|
||||
|
||||
}
|
||||
|
||||
private static List<PqdData> convertMinData(HashMap<Date, MinData> minDataHashMap) {
|
||||
List<PqdData> result = new ArrayList<>();
|
||||
minDataHashMap.forEach((dateTime,data)->{
|
||||
|
||||
List<PqdData> pqdDataA = convertDataByValueType(data.getMin(), "min",dateTime);
|
||||
List<PqdData> pqdDataB = convertDataByValueType(data.getMax(), "max",dateTime);
|
||||
List<PqdData> pqdDataC = convertDataByValueType(data.getAvg(), "avg",dateTime);
|
||||
List<PqdData> pqdDataT = convertDataByValueType(data.getCp95(), "cp95",dateTime);
|
||||
result.addAll(pqdDataA);
|
||||
result.addAll(pqdDataB);
|
||||
result.addAll(pqdDataC);
|
||||
result.addAll(pqdDataT);
|
||||
});
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
private static List<PqdData> convertDataByValueType(tagPQDataCmn min, String valueType,Date dateTime) {
|
||||
|
||||
List<PqdData> pqdData = new ArrayList<>();
|
||||
|
||||
HashMap hashMapA = new HashMap<>();
|
||||
hashMapA.put("phasic_type","A");
|
||||
hashMapA.put("value_type",valueType);
|
||||
hashMapA.put("time",dateTime.toInstant());
|
||||
|
||||
HashMap hashMapB = new HashMap<>();
|
||||
hashMapB.put("phasic_type","B");
|
||||
hashMapB.put("value_type",valueType);
|
||||
hashMapB.put("time",dateTime.toInstant());
|
||||
|
||||
HashMap hashMapC = new HashMap<>();
|
||||
hashMapC.put("phasic_type","C");
|
||||
hashMapC.put("value_type",valueType);
|
||||
hashMapC.put("time",dateTime.toInstant());
|
||||
|
||||
HashMap hashMapM = new HashMap<>();
|
||||
hashMapM.put("phasic_type","M");
|
||||
hashMapM.put("value_type",valueType);
|
||||
hashMapM.put("time",dateTime.toInstant());
|
||||
|
||||
|
||||
HashMap hashMapAB = new HashMap<>();
|
||||
hashMapAB.put("phasic_type","AB");
|
||||
hashMapAB.put("value_type",valueType);
|
||||
hashMapAB.put("time",dateTime.toInstant());
|
||||
|
||||
HashMap hashMapBC = new HashMap<>();
|
||||
hashMapBC.put("phasic_type","BC");
|
||||
hashMapBC.put("value_type",valueType);
|
||||
hashMapBC.put("time",dateTime.toInstant());
|
||||
|
||||
HashMap hashMapCA = new HashMap<>();
|
||||
hashMapCA.put("phasic_type","CA");
|
||||
hashMapCA.put("value_type",valueType);
|
||||
hashMapCA.put("time",dateTime.toInstant());
|
||||
|
||||
|
||||
//RMS电压A B C 电流A B C 线电压AB BC CA
|
||||
Float[] rms = min.getRms();
|
||||
hashMapA.put("pq_RmsU",rms[0]);
|
||||
hashMapB.put("pq_RmsU",rms[1]);
|
||||
hashMapC.put("pq_RmsU",rms[2]);
|
||||
hashMapA.put("pq_RmsU",rms[3]);
|
||||
hashMapB.put("pq_RmsI",rms[4]);
|
||||
hashMapC.put("pq_RmsI",rms[5]);
|
||||
hashMapA.put("pq_RmsLU",rms[6]);
|
||||
hashMapB.put("pq_RmsLU",rms[7]);
|
||||
hashMapC.put("pq_RmsLU",rms[8]);
|
||||
|
||||
|
||||
// pqdDataA.setpq_RmsU(rms[0]);
|
||||
// pqdDataB.setpq_RmsU(rms[1]);
|
||||
// pqdDataC.setpq_RmsU(rms[2]);
|
||||
// pqdDataA.setpq_RmsI(rms[3]);
|
||||
// pqdDataB.setpq_RmsI(rms[4]);
|
||||
// pqdDataC.setpq_RmsI(rms[5]);
|
||||
// pqdDataA.setpq_RmsLU(rms[6]);
|
||||
// pqdDataB.setpq_RmsLU(rms[7]);
|
||||
// pqdDataC.setpq_RmsLU(rms[8]);
|
||||
//电压上偏差相电压abc,线电压AB BC CA
|
||||
Float[] uuDeviation = min.getUU_Deviation();
|
||||
Float[] ulDeviation = min.getUL_Deviation();
|
||||
//电能质量只有电压偏差,上偏差正,下偏差负,判断上偏差是否为0如果为0取下偏差负数,反正取上偏差
|
||||
hashMapA.put("pq_UDev", AnalyseComtradeCfg.isZero(uuDeviation[0])?(-ulDeviation[0]):uuDeviation[0]);
|
||||
hashMapB.put("pq_UDev",AnalyseComtradeCfg.isZero(uuDeviation[1])?(-ulDeviation[1]):uuDeviation[1]);
|
||||
hashMapC.put("pq_RmsU",AnalyseComtradeCfg.isZero(uuDeviation[2])?(-ulDeviation[2]):uuDeviation[2]);
|
||||
hashMapAB.put("pq_LUDev",AnalyseComtradeCfg.isZero(uuDeviation[3])?(-ulDeviation[3]):uuDeviation[3]);
|
||||
hashMapBC.put("pq_LUDev",AnalyseComtradeCfg.isZero(uuDeviation[4])?(-ulDeviation[4]):uuDeviation[4]);
|
||||
hashMapCA.put("pq_LUDev",AnalyseComtradeCfg.isZero(uuDeviation[5])?(-ulDeviation[5]):uuDeviation[5]);
|
||||
|
||||
// pqdDataA.setpq_RmsU(AnalyseComtradeCfg.isZero(uuDeviation[0])?(-ulDeviation[0]):uuDeviation[0]);
|
||||
// pqdDataB.setpq_RmsU(AnalyseComtradeCfg.isZero(uuDeviation[1])?(-ulDeviation[1]):uuDeviation[1]);
|
||||
// pqdDataC.setpq_RmsU(AnalyseComtradeCfg.isZero(uuDeviation[2])?(-ulDeviation[2]):uuDeviation[2]);
|
||||
// pqdDataA.setpq_RmsI(AnalyseComtradeCfg.isZero(uuDeviation[3])?(-ulDeviation[3]):uuDeviation[3]);
|
||||
// pqdDataB.setpq_RmsI(AnalyseComtradeCfg.isZero(uuDeviation[4])?(-ulDeviation[4]):uuDeviation[4]);
|
||||
// pqdDataC.setpq_RmsI(AnalyseComtradeCfg.isZero(uuDeviation[5])?(-ulDeviation[5]):uuDeviation[5]);
|
||||
///频率偏差 ,频率存M相
|
||||
Float[] fDeviation = min.getF_Deviation();
|
||||
|
||||
hashMapM.put("pq_FreqDev",fDeviation[0]);
|
||||
hashMapM.put("pq_Freq",fDeviation[1]);
|
||||
|
||||
/* pqdDataT.setpq_FreqDev(fDeviation[0]);
|
||||
pqdDataT.setpq_Freq(fDeviation[1]);*/
|
||||
|
||||
//电压电流零、正、负序、不平衡度32 第一个[]电压,电流;第二个[]零、正、负序、不平衡度
|
||||
Float[][] uiSeq = min.getUI_Seq();
|
||||
|
||||
hashMapM.put("pq_SeqZeroU",uiSeq[0][0]);
|
||||
hashMapM.put("pq_SeqNegU",uiSeq[0][1]);
|
||||
hashMapM.put("pq_SeqPosU",uiSeq[0][2]);
|
||||
hashMapM.put("pq_UnbalNegU",uiSeq[0][3]);
|
||||
|
||||
hashMapM.put("pq_SeqZeroI",uiSeq[1][0]);
|
||||
hashMapM.put("pq_SeqNegI",uiSeq[1][1]);
|
||||
hashMapM.put("pq_SeqPosI",uiSeq[1][2]);
|
||||
hashMapM.put("pq_UnbalNegI",uiSeq[1][3]);
|
||||
|
||||
// pqdDataT.setpq_SeqZeroU(uiSeq[0][0]);
|
||||
// pqdDataT.setpq_SeqNegU(uiSeq[0][1]);
|
||||
// pqdDataT.setpq_SeqPosU(uiSeq[0][2]);
|
||||
// pqdDataT.setpq_UnbalNegU(uiSeq[0][3]);
|
||||
|
||||
// pqdDataT.setpq_SeqZeroI(uiSeq[1][0]);
|
||||
// pqdDataT.setpq_SeqNegI(uiSeq[1][1]);
|
||||
// pqdDataT.setpq_SeqPosI(uiSeq[1][2]);
|
||||
// pqdDataT.setpq_UnbalNegI(uiSeq[1][3]);
|
||||
//电压存含有率,电流存幅值
|
||||
//整次谐波 电压A B C N 电流A B C N 1200
|
||||
//幅值
|
||||
Float[][] fuHarm = min.getFuHarm();
|
||||
//谐波相角-送一半数据 600
|
||||
Float[][] fuHarmPhase = min.getFuHarmPhase();
|
||||
|
||||
|
||||
|
||||
//含有率
|
||||
Float[][] harmContain = min.getHarm_Contain();
|
||||
//谐波功率
|
||||
Float[][][] harmPower = min.getHarm_Power();
|
||||
for (int i = 0; i < 49; i++) {
|
||||
//电压含有率
|
||||
hashMapA.put("pq_HarmU_"+(i+2),harmContain[0][i]);
|
||||
hashMapB.put("pq_HarmU_"+(i+2),harmContain[1][i]);
|
||||
hashMapC.put("pq_HarmU_"+(i+2),harmContain[2][i]);
|
||||
|
||||
//谐波相角
|
||||
hashMapA.put("pq_HarmUAng_"+(i+2),fuHarmPhase[0][i]);
|
||||
hashMapB.put("pq_HarmUAng_"+(i+2),fuHarmPhase[1][i]);
|
||||
hashMapC.put("pq_HarmUAng_"+(i+2),fuHarmPhase[2][i]);
|
||||
|
||||
hashMapA.put("pq_HarmIAng_"+(i+2),fuHarmPhase[3][i]);
|
||||
hashMapB.put("pq_HarmIAng_"+(i+2),fuHarmPhase[4][i]);
|
||||
hashMapC.put("pq_HarmIAng_"+(i+2),fuHarmPhase[5][i]);
|
||||
|
||||
//电流幅值
|
||||
hashMapA.put("pq_HarmI_"+(i+2),fuHarm[3][i]);
|
||||
hashMapB.put("pq_HarmI_"+(i+2),fuHarm[4][i]);
|
||||
hashMapC.put("pq_HarmI_"+(i+2),fuHarm[5][i]);
|
||||
|
||||
|
||||
//谐波功率
|
||||
hashMapA.put("pq_HarmP_"+(i+2),harmPower[0][i][0]);
|
||||
hashMapA.put("pq_HarmQ_"+(i+2),harmPower[0][i][1]);
|
||||
hashMapA.put("pq_HarmS_"+(i+2),harmPower[0][i][2]);
|
||||
|
||||
hashMapB.put("pq_HarmP_"+(i+2),harmPower[1][i][0]);
|
||||
hashMapB.put("pq_HarmQ_"+(i+2),harmPower[1][i][1]);
|
||||
hashMapB.put("pq_HarmS_"+(i+2),harmPower[1][i][2]);
|
||||
|
||||
hashMapC.put("pq_HarmP_"+(i+2),harmPower[2][i][0]);
|
||||
hashMapC.put("pq_HarmQ_"+(i+2),harmPower[2][i][1]);
|
||||
hashMapC.put("pq_HarmS_"+(i+2),harmPower[2][i][2]);
|
||||
//M相目前没有
|
||||
// hashMapT.put("pq_HarmP_"+(i+2),harmPower[3][i][0]);
|
||||
// hashMapT.put("pq_HarmQ_"+(i+2),harmPower[3][i][1]);
|
||||
// hashMapT.put("pq_HarmS_"+(i+2),harmPower[3][i][2]);
|
||||
}
|
||||
//间谐波-送一半数据
|
||||
Float[][] inHarm = min.getInHarm();
|
||||
|
||||
|
||||
for (int i = 0; i < 50; i++) {
|
||||
//间谐波幅值
|
||||
hashMapA.put("pq_InHarmIAmp_"+(i+1),inHarm[3][i]);
|
||||
hashMapB.put("pq_InHarmIAmp_"+(i+1),inHarm[4][i]);
|
||||
hashMapC.put("pq_InHarmIAmp_"+(i+1),inHarm[5][i]);
|
||||
|
||||
|
||||
|
||||
}
|
||||
//a,b,c,total 总功率(P.Q.S)
|
||||
Float[][] totalPower = min.getTotal_Power();
|
||||
hashMapA.put("pq_P",totalPower[0][0]);
|
||||
hashMapB.put("pq_P",totalPower[1][0]);
|
||||
hashMapC.put("pq_P",totalPower[2][0]);
|
||||
|
||||
hashMapA.put("pq_Q",totalPower[0][1]);
|
||||
hashMapB.put("pq_Q",totalPower[1][1]);
|
||||
hashMapC.put("pq_Q",totalPower[2][1]);
|
||||
|
||||
hashMapA.put("pq_S",totalPower[0][2]);
|
||||
hashMapB.put("pq_S",totalPower[1][2]);
|
||||
hashMapC.put("pq_S",totalPower[2][2]);
|
||||
|
||||
hashMapM.put("pq_TotHarmP",totalPower[3][0]);
|
||||
hashMapM.put("pq_TotHarmQ",totalPower[3][1]);
|
||||
hashMapM.put("pq_TotHarmS",totalPower[3][2]);
|
||||
|
||||
/*todo 谐波畸变率,电压波动,电压闪变,电压长闪变会根据监测点接线方式是星型存A,B,C相,角型或者V型存AB,BC,CA相,目前全存在A,B,C相*/
|
||||
//谐波畸变率
|
||||
Float[] harmAberrance = min.getHarm_Aberrance();
|
||||
hashMapA.put("pq_ThdU",harmAberrance[0]);
|
||||
hashMapB.put("pq_ThdU",harmAberrance[1]);
|
||||
hashMapC.put("pq_ThdU",harmAberrance[2]);
|
||||
|
||||
hashMapA.put("pq_ThdI",harmAberrance[3]);
|
||||
hashMapB.put("pq_ThdI",harmAberrance[4]);
|
||||
hashMapC.put("pq_ThdI",harmAberrance[5]);
|
||||
|
||||
//视在功率因数
|
||||
Float[] cosPf = min.getCos_PF();
|
||||
hashMapA.put("pq_PF",cosPf[0]);
|
||||
hashMapB.put("pq_PF",cosPf[1]);
|
||||
hashMapC.put("pq_PF",cosPf[2]);
|
||||
hashMapM.put("pq_TotPF",cosPf[3]);
|
||||
//位移功率因数=
|
||||
Float[] cosDf = min.getCos_DF();
|
||||
hashMapA.put("pq_DF",cosDf[0]);
|
||||
hashMapB.put("pq_DF",cosDf[1]);
|
||||
hashMapC.put("pq_DF",cosDf[2]);
|
||||
hashMapM.put("pq_TotDF",cosDf[3]);
|
||||
//电压波动
|
||||
Float[] uFluctuation = min.getU_Fluctuation();
|
||||
hashMapA.put("pq_Fluct",uFluctuation[0]);
|
||||
hashMapB.put("pq_Fluct",uFluctuation[1]);
|
||||
hashMapC.put("pq_Fluct",uFluctuation[2]);
|
||||
//电压闪变
|
||||
Float[] uFlicker = min.getU_Flicker();
|
||||
hashMapA.put("pq_Plt",uFlicker[0]);
|
||||
hashMapB.put("pq_Plt",uFlicker[1]);
|
||||
hashMapC.put("pq_Plt",uFlicker[2]);
|
||||
//电压长闪变
|
||||
Float[] ulFlicker = min.getUL_Flicker();
|
||||
hashMapA.put("pq_Plt",ulFlicker[0]);
|
||||
hashMapB.put("pq_Plt",ulFlicker[1]);
|
||||
hashMapC.put("pq_Plt",ulFlicker[2]);
|
||||
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
mapper.registerModule(new JavaTimeModule());
|
||||
PqdData pqdDataA = mapper.convertValue(hashMapA, PqdData.class);
|
||||
PqdData pqdDataB = mapper.convertValue(hashMapB, PqdData.class);
|
||||
PqdData pqdDataC = mapper.convertValue(hashMapC, PqdData.class);
|
||||
PqdData pqdDataM = mapper.convertValue(hashMapM, PqdData.class);
|
||||
|
||||
pqdData.add(pqdDataA);
|
||||
pqdData.add(pqdDataB);
|
||||
pqdData.add(pqdDataC);
|
||||
pqdData.add(pqdDataM);
|
||||
|
||||
return pqdData;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static boolean isZero(float value) {
|
||||
return Math.abs(value) < 1e-6; // 判断value是否在精度范围内近似等于0
|
||||
}
|
||||
|
||||
// 实现转换高频谐波数据的逻辑
|
||||
private static HashMap<Date, MinDataHh> convertMinHh(String strFile,HashMap<Date, MinDataHh> minDataHhDic) throws IOException {
|
||||
|
||||
|
||||
// 实现转换高频谐波数据的逻辑
|
||||
System.out.println("Converting HH data from: " + strFile);
|
||||
FileInputStream binFile = null;
|
||||
try{
|
||||
try {
|
||||
binFile = new FileInputStream(strFile);
|
||||
} catch (FileNotFoundException e) {
|
||||
binFile.close();
|
||||
System.out.println(String.format("文件%1$s 长度为0字节,程序将跳过本文件的转换", strFile));
|
||||
}
|
||||
|
||||
long nBufSize = binFile.available(); //计算需要解析的文件总长
|
||||
int n1BufLen = tagPQDataCmnHh.GetSize(); //计算单个统计结构大小
|
||||
int nSecNum = (int)(nBufSize / n1BufLen); //确认共多少事件数据结构
|
||||
|
||||
int nStep = 0; //读取偏移量
|
||||
for (int i = 0; i < nSecNum; i++) {
|
||||
byte[] bBuf = new byte[n1BufLen]; //单个统计结构
|
||||
int nReadLen = 0;
|
||||
try {
|
||||
//java流不需要跳
|
||||
// binFile.skip(nStep);
|
||||
nReadLen = binFile.read(bBuf, 0, bBuf.length);
|
||||
} catch (IOException e) {
|
||||
System.out.println(String.format("文件%1$s 读取时发生错误,代码为%2$s", strFile, e.getClass().getName()));
|
||||
binFile.close();
|
||||
}
|
||||
|
||||
tagPQDataCmnHh tagPqData = new tagPQDataCmnHh();
|
||||
tagPqData.SetStructBuf(bBuf, 0);
|
||||
nStep += n1BufLen;
|
||||
|
||||
RTC_Timer_MS Devtime = tagPqData.time;
|
||||
Date time = new Date(Devtime.year - 1900, Devtime.month - 1, Devtime.day, Devtime.hour, Devtime.minute, Devtime.second);
|
||||
if (!minHh_starttime.equals(new Date(0))) { //存在启动时间
|
||||
if (time.compareTo(minHh_starttime) <= 0) {
|
||||
minHh_starttime = time;
|
||||
}
|
||||
} else { //不存在启动时间 填入当前时间
|
||||
minHh_starttime = time;
|
||||
}
|
||||
if (!minHh_endtime.equals(new Date(0))) {
|
||||
if (time.compareTo(minHh_endtime) >= 0) {
|
||||
minHh_endtime = time;
|
||||
}
|
||||
} else { //不存在结束时间 填入当前时间
|
||||
minHh_endtime = time;
|
||||
}
|
||||
|
||||
if (strFile.toUpperCase().indexOf("AVG") >= 0) {
|
||||
if (minDataHhDic.containsKey(time)) {
|
||||
minDataHhDic.get(time).avg = tagPqData;
|
||||
} else {
|
||||
MinDataHh minData = new MinDataHh();
|
||||
minData.avg = tagPqData;
|
||||
minDataHhDic.put(time, minData);
|
||||
}
|
||||
} else if (strFile.toUpperCase().indexOf("CP95") >= 0) {
|
||||
if (minDataHhDic.containsKey(time)) {
|
||||
minDataHhDic.get(time).cp95 = tagPqData;
|
||||
} else {
|
||||
MinDataHh minData = new MinDataHh();
|
||||
minData.cp95 = tagPqData;
|
||||
minDataHhDic.put(time, minData);
|
||||
}
|
||||
} else if (strFile.toUpperCase().indexOf("MAX") >= 0) {
|
||||
if (minDataHhDic.containsKey(time)) {
|
||||
minDataHhDic.get(time).max = tagPqData;
|
||||
} else {
|
||||
MinDataHh minData = new MinDataHh();
|
||||
minData.max = tagPqData;
|
||||
minDataHhDic.put(time, minData);
|
||||
}
|
||||
} else if (strFile.toUpperCase().indexOf("MIN") >= 0) {
|
||||
if (minDataHhDic.containsKey(time)) {
|
||||
minDataHhDic.get(time).min = tagPqData;
|
||||
} else {
|
||||
MinDataHh minData = new MinDataHh();
|
||||
minData.min = tagPqData;
|
||||
minDataHhDic.put(time, minData);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
binFile.close();
|
||||
System.out.println(String.format("文件%1$s 长度为0字节,程序将跳过本文件的转换", strFile));
|
||||
}
|
||||
|
||||
return minDataHhDic;
|
||||
}
|
||||
// 实现转换分钟数据的逻辑
|
||||
private static void convertMin(String strFile, HashMap<Date, MinData> minDataDic) {
|
||||
|
||||
FileInputStream binFile = null;
|
||||
|
||||
try {
|
||||
|
||||
// 实现转换分钟数据的逻辑
|
||||
System.out.println("Converting minute data from: " + strFile);
|
||||
|
||||
binFile = new FileInputStream(strFile);
|
||||
|
||||
|
||||
long nBufSize = 0;
|
||||
|
||||
nBufSize = binFile.available(); //计算需要解析的文件总长
|
||||
|
||||
|
||||
int n1BufLen = tagPQDataCmn.GetSize(); //计算单个统计结构大小
|
||||
int nMinNum = (int) (nBufSize / n1BufLen); //确认共多少分钟数据结构
|
||||
|
||||
int nStep = 0; //读取偏移量
|
||||
for (int i = 0; i < nMinNum; i++) {
|
||||
byte[] bBuf = new byte[n1BufLen]; //单个统计结构
|
||||
int nReadLen = 0;
|
||||
try {
|
||||
//java流不需要跳
|
||||
// binFile.skip(nStep);
|
||||
nReadLen = binFile.read(bBuf, 0, bBuf.length);
|
||||
} catch (IOException e) {
|
||||
System.out.println("文件读取时发生错误,代码为" + e.getClass().getName());
|
||||
binFile.close();
|
||||
}
|
||||
|
||||
tagPQDataCmn tagPqData = new tagPQDataCmn();
|
||||
tagPqData.SetStructBuf(bBuf, 0);
|
||||
nStep += n1BufLen;
|
||||
|
||||
RTC_Timer_MS Devtime = tagPqData.time;
|
||||
Date time = new Date(Devtime.year - 1900, Devtime.month - 1, Devtime.day, Devtime.hour, Devtime.minute, Devtime.second);
|
||||
if (!minStarttime.equals(new Date(0))) { //存在启动时间
|
||||
if (time.compareTo(minStarttime) <= 0) {
|
||||
minStarttime = time;
|
||||
}
|
||||
} else { //不存在启动时间 填入当前时间
|
||||
minStarttime = time;
|
||||
}
|
||||
if (!minEndtime.equals(new Date(0))) {
|
||||
if (time.compareTo(minEndtime) >= 0) {
|
||||
minEndtime = time;
|
||||
}
|
||||
} else { //不存在结束时间 填入当前时间
|
||||
minEndtime = time;
|
||||
}
|
||||
|
||||
if (strFile.toUpperCase().indexOf("AVG") >= 0) {
|
||||
if (minDataDic.containsKey(time)) {
|
||||
minDataDic.get(time).avg = tagPqData;
|
||||
} else {
|
||||
MinData minData = new MinData();
|
||||
minData.avg = tagPqData;
|
||||
minDataDic.put(time, minData);
|
||||
}
|
||||
} else if (strFile.toUpperCase().indexOf("CP95") >= 0) {
|
||||
if (minDataDic.containsKey(time)) {
|
||||
minDataDic.get(time).cp95 = tagPqData;
|
||||
} else {
|
||||
MinData minData = new MinData();
|
||||
minData.cp95 = tagPqData;
|
||||
minDataDic.put(time, minData);
|
||||
}
|
||||
} else if (strFile.toUpperCase().indexOf("MAX") >= 0) {
|
||||
if (minDataDic.containsKey(time)) {
|
||||
minDataDic.get(time).max = tagPqData;
|
||||
} else {
|
||||
MinData minData = new MinData();
|
||||
minData.max = tagPqData;
|
||||
minDataDic.put(time, minData);
|
||||
}
|
||||
} else if (strFile.toUpperCase().indexOf("MIN") >= 0) {
|
||||
if (minDataDic.containsKey(time)) {
|
||||
minDataDic.get(time).min = tagPqData;
|
||||
} else {
|
||||
MinData minData = new MinData();
|
||||
minData.min = tagPqData;
|
||||
minDataDic.put(time, minData);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
System.out.println("处理文件时发生错误: " + strFile);
|
||||
} finally {
|
||||
if (binFile != null) {
|
||||
try {
|
||||
binFile.close();
|
||||
} catch (IOException e) {
|
||||
System.out.println("关闭文件时发生错误: " + strFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public static List<tagComtradeCfg> convertCfgFile(String strFilePath) { //解析cfg录波文件
|
||||
List<tagComtradeCfg> tagComtradeCfgList = new ArrayList<>();
|
||||
File folder = new File(strFilePath);
|
||||
File[] files = folder.listFiles((dir, name) -> name.endsWith(".cfg")); //获取文件夹下所有cfg文件
|
||||
Arrays.stream(files).forEach(file -> {
|
||||
tagComtradeCfg tagComtradeCfg = analyseComtradeCfg(file.getAbsolutePath());
|
||||
tagComtradeCfgList.add(tagComtradeCfg);
|
||||
});
|
||||
return tagComtradeCfgList;
|
||||
}
|
||||
/**
|
||||
* @Description: analyseComtradeCfg 读取、分析cfg录波文件!!!
|
||||
* @Param:
|
||||
* @return: com.njcn.user.utils.test.tagComtradeCfg
|
||||
* @Author: clam
|
||||
* @Date: 2024/7/15
|
||||
*/
|
||||
public static tagComtradeCfg analyseComtradeCfg(String strFilePath) {
|
||||
tagComtradeCfg comtradeCfg = new tagComtradeCfg();
|
||||
|
||||
if (strFilePath.equals("")) {
|
||||
return comtradeCfg;
|
||||
}
|
||||
|
||||
int i = 0; //用于遍历 字符串转换的字段数组
|
||||
String strFileLine;//临时存放 cfg每行读取的字符串
|
||||
String[] strTempArray; //临时存放 字符串转换的字段数组
|
||||
|
||||
tagRates ratesCfg = new tagRates();
|
||||
try {
|
||||
FileInputStream readFile = new FileInputStream(strFilePath);
|
||||
InputStreamReader isr = new InputStreamReader(readFile, StandardCharsets.UTF_8);
|
||||
BufferedReader sr = new BufferedReader(isr);
|
||||
comtradeCfg = new tagComtradeCfg();//配置文件总类对象初始化
|
||||
ratesCfg = new tagRates();//多段采样类对象初始化
|
||||
long nFreq = 0; //临时存放 采样频率 例:50Hz
|
||||
//第一行不关心仅仅是一些描述类的信息
|
||||
strFileLine = sr.readLine(); // ①
|
||||
//第二行需要关心第二个:模拟通道编号(模拟量的个数)和第三个:状态通道参数(开关量的个数)
|
||||
strFileLine = sr.readLine(); // ②
|
||||
strTempArray = strFileLine.split(",");
|
||||
for (i = 0; i < strTempArray.length; i++) {
|
||||
switch (i) {
|
||||
case 0: //通道总个数
|
||||
comtradeCfg.nChannelNum = Integer.parseInt(strTempArray[i]);
|
||||
break;
|
||||
case 1: //模拟量的个数
|
||||
String str = strTempArray[i].substring(0, strTempArray[i].length() - 1);
|
||||
comtradeCfg.nAnalogNum = Integer.parseInt(str);
|
||||
break;
|
||||
case 2://开关量的个数
|
||||
str = strTempArray[i].substring(0, strTempArray[i].length() - 1);
|
||||
comtradeCfg.nDigitalNum = Integer.parseInt(str);
|
||||
break;
|
||||
}
|
||||
}
|
||||
//从第三行到第ComtradeCfg.nChannelNum+3行是模拟量通道和数字量通道
|
||||
List<tagOneChannleCfg> OneChannleCfgList =new ArrayList<>();
|
||||
for (i = 0; i < comtradeCfg.nChannelNum; i++) {
|
||||
tagOneChannleCfg oneChannlecfg = new tagOneChannleCfg();
|
||||
|
||||
strFileLine = sr.readLine(); // ③ or ④ or ⑤
|
||||
strTempArray = strFileLine.split(",");
|
||||
for (int j = 0; j < strTempArray.length; j++) {
|
||||
switch (j) {
|
||||
case 0://通道序号
|
||||
oneChannlecfg.nIndex = Integer.parseInt(strTempArray[j]);
|
||||
break;
|
||||
case 1://通道名称
|
||||
oneChannlecfg.szChannleName = strTempArray[j];
|
||||
break;
|
||||
case 2://监视的通道名称
|
||||
oneChannlecfg.szPhasicName = strTempArray[j];
|
||||
break;
|
||||
case 3://监视的通道名称
|
||||
oneChannlecfg.szMonitoredChannleName = strTempArray[j];
|
||||
break;
|
||||
case 4://通道的单位
|
||||
oneChannlecfg.szUnitName = strTempArray[j];
|
||||
break;
|
||||
case 5://通道的系数
|
||||
oneChannlecfg.fCoefficent = Float.parseFloat(strTempArray[j]);
|
||||
break;
|
||||
case 6://通道的偏移量
|
||||
oneChannlecfg.fOffset = Float.parseFloat(strTempArray[j]);
|
||||
break;
|
||||
case 7://起始采样时间的偏移量
|
||||
oneChannlecfg.fTimeOffset = Float.parseFloat(strTempArray[j]);
|
||||
break;
|
||||
case 8://采样值的最小值
|
||||
oneChannlecfg.nMin = Integer.parseInt(strTempArray[j]);
|
||||
break;
|
||||
case 9://采样值的最大值
|
||||
oneChannlecfg.nMax = Integer.parseInt(strTempArray[j]);
|
||||
break;
|
||||
case 10://一次变比
|
||||
oneChannlecfg.fPrimary = Float.parseFloat(strTempArray[j]);
|
||||
break;
|
||||
case 11://二次变比
|
||||
oneChannlecfg.fSecondary = Float.parseFloat(strTempArray[j]);
|
||||
break;
|
||||
case 12://一次值还是二次值标志
|
||||
oneChannlecfg.szValueType = strTempArray[j];
|
||||
break;
|
||||
}
|
||||
}
|
||||
OneChannleCfgList.add(oneChannlecfg);
|
||||
|
||||
}
|
||||
comtradeCfg.setOneChannleCfg(OneChannleCfgList);
|
||||
//采样频率:在交变电流电路中一秒钟内交流电所允许而必须变化的周期数,即:在单位时间内振动的次数
|
||||
strFileLine = sr.readLine(); // ⑥
|
||||
float fFreq = Float.parseFloat(strFileLine);
|
||||
nFreq = (long) fFreq;
|
||||
|
||||
strFileLine = sr.readLine(); // ⑦
|
||||
int nRates = Integer.parseInt(strFileLine);
|
||||
ratesCfg.nRates = nRates;
|
||||
|
||||
long nOffset = 0;//上一段单周波采样点数
|
||||
long nMSTotal = 0;//录波总毫秒数
|
||||
for (i = 0; i < nRates; i++) {
|
||||
strFileLine = sr.readLine(); //⑧例:3200,22400 ——> 理解为:1到22400这22400个数据的采样率是3200
|
||||
strTempArray = strFileLine.split(",");
|
||||
|
||||
tagOneRate oneRate = new tagOneRate();//1段采样类对象
|
||||
ratesCfg.getOneRate().add(oneRate);
|
||||
for (int j = 0; j < strTempArray.length; j++) {
|
||||
switch (j) {
|
||||
case 0://采样率:1秒钟内的采样点数
|
||||
oneRate.nOneSample = (long) (Float.parseFloat(strTempArray[j]) / nFreq);
|
||||
break;
|
||||
case 1: //总采样点数
|
||||
oneRate.nSampleNum = (long) (Float.parseFloat(strTempArray[j]) - nOffset);
|
||||
nOffset += oneRate.nSampleNum;
|
||||
break;
|
||||
}
|
||||
nMSTotal += oneRate.nSampleNum / oneRate.nOneSample;
|
||||
}
|
||||
}
|
||||
|
||||
nMSTotal *= 20; //录波总毫秒数 注:一个周波20ms,所以此处要乘以20
|
||||
if (nMSTotal > 60000) {//如果事件长度超过1分钟,则结束处理,不调用录波高级算法qvvr_fun
|
||||
|
||||
sr.close();
|
||||
readFile.close();
|
||||
return comtradeCfg;
|
||||
}
|
||||
//波形起始时间
|
||||
strFileLine = sr.readLine(); // ⑨
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy,HH:mm:ss.SSSSSS");
|
||||
comtradeCfg.setTimeTrigger(sdf.parse(strFileLine));
|
||||
|
||||
strFileLine = sr.readLine(); // ⑩
|
||||
comtradeCfg.setTimeStart(sdf.parse(strFileLine));
|
||||
comtradeCfg.setTimeEnd(new Date(comtradeCfg.getTimeStart().getTime() + nMSTotal));;
|
||||
comtradeCfg.setPath(new File(strFilePath).getName());
|
||||
|
||||
sr.close();
|
||||
readFile.close();
|
||||
} catch (IOException | ParseException e) {
|
||||
System.out.println("Error opening file: " + strFilePath + " " + e.getMessage());
|
||||
return comtradeCfg;
|
||||
}
|
||||
|
||||
return comtradeCfg;
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
tagComtradeCfg tagComtradeCfg = AnalyseComtradeCfg1.analyseComtradeCfg("C:\\Users\\Administrator\\Desktop\\浙江无线\\离线数据上传\\09\\comtrade\\line1_20240704_143908_213.cfg");
|
||||
System.out.println(tagComtradeCfg);
|
||||
AnalyseComtradeCfg1.processDirectory("C:\\Users\\Administrator\\Desktop\\浙江无线\\离线数据上传\\09\\min");
|
||||
PqdData pqdData = new PqdData();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.njcn.csharmonic.offline.mincfg.vo;
|
||||
|
||||
public class DATA_FLICK //波动闪变
|
||||
{
|
||||
private RTC_Timer time; //数据时标
|
||||
private Float[] FLUCT; //波动
|
||||
private Float[] FLICT; //短闪
|
||||
private Float[] LFLICT; //长闪
|
||||
public DATA_FLICK()
|
||||
{
|
||||
time = new RTC_Timer();
|
||||
FLUCT = new Float[3];
|
||||
FLICT = new Float[3];
|
||||
LFLICT = new Float[3];
|
||||
}
|
||||
public static int GetSize()
|
||||
{
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
return 6 * Short.SIZE / Byte.SIZE + 9 * Float.SIZE / Byte.SIZE;
|
||||
}
|
||||
public final boolean SetStructBuf(byte[] bArray, int nHaveRead)
|
||||
{
|
||||
int nByteSize = bArray.length;
|
||||
if (nByteSize < GetSize())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int iStep = nHaveRead;
|
||||
time.SetStructBuf(bArray, iStep);
|
||||
iStep = iStep + RTC_Timer.GetSize();
|
||||
RefObject<Float[]> tempRef_FLUCT = new RefObject<Float[]>(FLUCT);
|
||||
iStep += Service.convertFloatArraySingle(bArray, iStep, tempRef_FLUCT);
|
||||
FLUCT = tempRef_FLUCT.argvalue;
|
||||
RefObject<Float[]> tempRef_FLICT = new RefObject<Float[]>(FLICT);
|
||||
iStep += Service.convertFloatArraySingle(bArray, iStep, tempRef_FLICT);
|
||||
FLICT = tempRef_FLICT.argvalue;
|
||||
RefObject<Float[]> tempRef_LFLICT = new RefObject<Float[]>(LFLICT);
|
||||
iStep += Service.convertFloatArraySingle(bArray, iStep, tempRef_LFLICT);
|
||||
LFLICT = tempRef_LFLICT.argvalue;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.njcn.csharmonic.offline.mincfg.vo;
|
||||
|
||||
public class DATA_HARMI //谐波电流幅值
|
||||
{
|
||||
private RTC_Timer time; //数据时标
|
||||
private Float[][] HARMI; //3-?谐波电流幅值
|
||||
public DATA_HARMI(int num)
|
||||
{
|
||||
time = new RTC_Timer();
|
||||
HARMI = new Float[3][num];
|
||||
}
|
||||
public static int GetSize(int num)
|
||||
{
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
return 6 * Short.SIZE / Byte.SIZE + 3 * num * Float.SIZE / Byte.SIZE;
|
||||
}
|
||||
public final boolean SetStructBuf(byte[] bArray, int nHaveRead, int num)
|
||||
{
|
||||
int nByteSize = bArray.length;
|
||||
if (nByteSize < GetSize(num))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int iStep = nHaveRead;
|
||||
time.SetStructBuf(bArray, iStep);
|
||||
iStep = iStep + RTC_Timer.GetSize();
|
||||
RefObject<Float[][]> tempRef_HARMI = new RefObject<Float[][]>(HARMI);
|
||||
iStep += Service.convertFloatArrayTwo(bArray, iStep, tempRef_HARMI);
|
||||
HARMI = tempRef_HARMI.argvalue;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.njcn.csharmonic.offline.mincfg.vo;
|
||||
|
||||
public class DATA_HARMIP //谐波电流相位
|
||||
{
|
||||
private RTC_Timer time; //数据时标
|
||||
private Float[][] HARMIP; //3-?谐波电流相位
|
||||
public DATA_HARMIP(int num)
|
||||
{
|
||||
time = new RTC_Timer();
|
||||
HARMIP = new Float[3][num];
|
||||
}
|
||||
public static int GetSize(int num)
|
||||
{
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
return 6 * Short.SIZE / Byte.SIZE/Byte.SIZE + 3 * num * Float.SIZE / Byte.SIZE;
|
||||
}
|
||||
public final boolean SetStructBuf(byte[] bArray, int nHaveRead, int num)
|
||||
{
|
||||
int nByteSize = bArray.length;
|
||||
if (nByteSize < GetSize(num))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int iStep = nHaveRead;
|
||||
time.SetStructBuf(bArray, iStep);
|
||||
iStep = iStep + RTC_Timer.GetSize();
|
||||
RefObject<Float[][]> tempRef_HARMIP = new RefObject<Float[][]>(HARMIP);
|
||||
iStep += Service.convertFloatArrayTwo(bArray, iStep, tempRef_HARMIP);
|
||||
HARMIP = tempRef_HARMIP.argvalue;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.njcn.csharmonic.offline.mincfg.vo;
|
||||
|
||||
public class DATA_HARMP //谐波有功
|
||||
{
|
||||
private RTC_Timer time; //数据时标
|
||||
private Float[][] HARMP; //4-?谐波有功
|
||||
public DATA_HARMP(int num)
|
||||
{
|
||||
time = new RTC_Timer();
|
||||
HARMP = new Float[4][num];
|
||||
}
|
||||
public static int GetSize(int num)
|
||||
{
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
return 6 * Short.SIZE + 4 * num * Float.SIZE;
|
||||
}
|
||||
public final boolean SetStructBuf(byte[] bArray, int nHaveRead, int num)
|
||||
{
|
||||
int nByteSize = bArray.length;
|
||||
if (nByteSize < GetSize(num))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int iStep = nHaveRead;
|
||||
time.SetStructBuf(bArray, iStep);
|
||||
iStep = iStep + RTC_Timer.GetSize();
|
||||
RefObject<Float[][]> tempRef_HARMP = new RefObject<Float[][]>(HARMP);
|
||||
iStep += Service.convertFloatArrayTwo(bArray, iStep, tempRef_HARMP);
|
||||
HARMP = tempRef_HARMP.argvalue;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.njcn.csharmonic.offline.mincfg.vo;
|
||||
|
||||
public class DATA_HARMQ //谐波无功
|
||||
{
|
||||
private RTC_Timer time; //数据时标
|
||||
private Float[][] HARMQ; //4-?谐波无功
|
||||
public DATA_HARMQ(int num)
|
||||
{
|
||||
time = new RTC_Timer();
|
||||
HARMQ = new Float[4][num];
|
||||
}
|
||||
public static int GetSize(int num)
|
||||
{
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
return 6 * Short.SIZE + 4 * num * Float.SIZE;
|
||||
}
|
||||
public final boolean SetStructBuf(byte[] bArray, int nHaveRead, int num)
|
||||
{
|
||||
int nByteSize = bArray.length;
|
||||
if (nByteSize < GetSize(num))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int iStep = nHaveRead;
|
||||
time.SetStructBuf(bArray, iStep);
|
||||
iStep = iStep + RTC_Timer.GetSize();
|
||||
RefObject<Float[][]> tempRef_HARMQ = new RefObject<Float[][]>(HARMQ);
|
||||
iStep += Service.convertFloatArrayTwo(bArray, iStep, tempRef_HARMQ);
|
||||
HARMQ = tempRef_HARMQ.argvalue;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.njcn.csharmonic.offline.mincfg.vo;
|
||||
|
||||
public class DATA_HARMS //谐波视在
|
||||
{
|
||||
private RTC_Timer time; //数据时标
|
||||
private Float[][] HARMS; //4-?谐波视在
|
||||
public DATA_HARMS(int num)
|
||||
{
|
||||
time = new RTC_Timer();
|
||||
HARMS = new Float[4][num];
|
||||
}
|
||||
public static int GetSize(int num)
|
||||
{
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
return 6 * Short.SIZE + 4 * num * Float.SIZE / Byte.SIZE;
|
||||
}
|
||||
public final boolean SetStructBuf(byte[] bArray, int nHaveRead, int num)
|
||||
{
|
||||
int nByteSize = bArray.length;
|
||||
if (nByteSize < GetSize(num))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int iStep = nHaveRead;
|
||||
time.SetStructBuf(bArray, iStep);
|
||||
iStep = iStep + RTC_Timer.GetSize();
|
||||
RefObject<Float[][]> tempRef_HARMS = new RefObject<Float[][]>(HARMS);
|
||||
iStep += Service.convertFloatArrayTwo(bArray, iStep, tempRef_HARMS);
|
||||
HARMS = tempRef_HARMS.argvalue;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.njcn.csharmonic.offline.mincfg.vo;
|
||||
|
||||
public class DATA_HARMV //谐波电压含有率
|
||||
{
|
||||
private RTC_Timer time; //数据时标
|
||||
private Float[][] HARMV; //3-?谐波电压含有率
|
||||
public DATA_HARMV(int num)
|
||||
{
|
||||
time = new RTC_Timer();
|
||||
HARMV = new Float[3][num];
|
||||
}
|
||||
public static int GetSize(int num)
|
||||
{
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
return 6 * Short.SIZE / Byte.SIZE + 3 * num * Float.SIZE / Byte.SIZE;
|
||||
}
|
||||
public final boolean SetStructBuf(byte[] bArray, int nHaveRead, int num)
|
||||
{
|
||||
int nByteSize = bArray.length;
|
||||
if (nByteSize < GetSize(num))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int iStep = nHaveRead;
|
||||
time.SetStructBuf(bArray, iStep);
|
||||
iStep = iStep + RTC_Timer.GetSize();
|
||||
RefObject<Float[][]> tempRef_HARMV = new RefObject<Float[][]>(HARMV);
|
||||
iStep += Service.convertFloatArrayTwo(bArray, iStep, tempRef_HARMV);
|
||||
HARMV = tempRef_HARMV.argvalue;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.njcn.csharmonic.offline.mincfg.vo;
|
||||
|
||||
public class DATA_HARMVP //谐波电压相位
|
||||
{
|
||||
private RTC_Timer time; //数据时标
|
||||
private Float[][] HARMVP; //3-?谐波电压相位
|
||||
public DATA_HARMVP(int num)
|
||||
{
|
||||
time = new RTC_Timer();
|
||||
HARMVP = new Float[3][num];
|
||||
}
|
||||
public static int GetSize(int num)
|
||||
{
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
return 6 * Short.SIZE / Byte.SIZE + 3 * num * Float.SIZE / Byte.SIZE;
|
||||
}
|
||||
public final boolean SetStructBuf(byte[] bArray, int nHaveRead, int num)
|
||||
{
|
||||
int nByteSize = bArray.length;
|
||||
if (nByteSize < GetSize(num))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int iStep = nHaveRead;
|
||||
time.SetStructBuf(bArray, iStep);
|
||||
iStep = iStep + RTC_Timer.GetSize();
|
||||
RefObject<Float[][]> tempRef_HARMVP = new RefObject<Float[][]>(HARMVP);
|
||||
iStep += Service.convertFloatArrayTwo(bArray, iStep, tempRef_HARMVP);
|
||||
HARMVP = tempRef_HARMVP.argvalue;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.njcn.csharmonic.offline.mincfg.vo;
|
||||
|
||||
public class DATA_INHARMI //间谐波电流幅值
|
||||
{
|
||||
private RTC_Timer time; //数据时标
|
||||
private Float[][] INHARMI; //3-?间谐波电流幅值
|
||||
public DATA_INHARMI(int num)
|
||||
{
|
||||
time = new RTC_Timer();
|
||||
INHARMI = new Float[3][num];
|
||||
}
|
||||
public static int GetSize(int num)
|
||||
{
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
return 6 * Short.SIZE / Byte.SIZE + 3 * num * Float.SIZE / Byte.SIZE;
|
||||
}
|
||||
public final boolean SetStructBuf(byte[] bArray, int nHaveRead, int num)
|
||||
{
|
||||
int nByteSize = bArray.length;
|
||||
if (nByteSize < GetSize(num))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int iStep = nHaveRead;
|
||||
time.SetStructBuf(bArray, iStep);
|
||||
iStep = iStep + RTC_Timer.GetSize();
|
||||
RefObject<Float[][]> tempRef_INHARMI = new RefObject<Float[][]>(INHARMI);
|
||||
iStep += Service.convertFloatArrayTwo(bArray, iStep, tempRef_INHARMI);
|
||||
INHARMI = tempRef_INHARMI.argvalue;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.njcn.csharmonic.offline.mincfg.vo;
|
||||
|
||||
public class DATA_INHARMV //间谐波电压幅值
|
||||
{
|
||||
private RTC_Timer time; //数据时标
|
||||
private Float[][] INHARMV; //3-?间谐波电压幅值
|
||||
public DATA_INHARMV(int num)
|
||||
{
|
||||
time = new RTC_Timer();
|
||||
INHARMV = new Float[3][num];
|
||||
}
|
||||
public static int GetSize(int num)
|
||||
{
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
return 6 * Short.SIZE + 3 * num * Float.SIZE / Byte.SIZE;
|
||||
}
|
||||
public final boolean SetStructBuf(byte[] bArray, int nHaveRead, int num)
|
||||
{
|
||||
int nByteSize = bArray.length;
|
||||
if (nByteSize < GetSize(num))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int iStep = nHaveRead;
|
||||
time.SetStructBuf(bArray, iStep);
|
||||
iStep = iStep + RTC_Timer.GetSize();
|
||||
RefObject<Float[][]> tempRef_INHARMV = new RefObject<Float[][]>(INHARMV);
|
||||
iStep += Service.convertFloatArrayTwo(bArray, iStep, tempRef_INHARMV);
|
||||
INHARMV = tempRef_INHARMV.argvalue;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.njcn.csharmonic.offline.mincfg.vo;
|
||||
|
||||
public class DATA_RMS //有效值数据
|
||||
{
|
||||
private RTC_Timer time; //数据时标
|
||||
private Float[] RMS; //9 相电压、线电压、电流有效值
|
||||
private Float[] UU_DEV; //6 相电压、线电压上偏差
|
||||
private Float[] UL_DEV; //6 相电压、线电压上偏差
|
||||
private Float[] THD; //6 电压电流畸变率
|
||||
private Float[] FREQ; //2 频率及频率偏差
|
||||
private Float[][] UI_SEQ; //2-5 电压电流序分量及不平衡度
|
||||
private Float[][] TOTAL_POWER; //4-3 分相及总功率P、Q、S
|
||||
private Float[] COS_PF; //4 视在功率因数
|
||||
private Float[] COS_DF; //4 位移功率因数
|
||||
public DATA_RMS()
|
||||
{
|
||||
time = new RTC_Timer();
|
||||
RMS = new Float[9];
|
||||
UU_DEV = new Float[6];
|
||||
UL_DEV = new Float[6];
|
||||
THD = new Float[6];
|
||||
FREQ = new Float[2];
|
||||
UI_SEQ = new Float[2][5];
|
||||
TOTAL_POWER = new Float[4][3];
|
||||
COS_PF = new Float[4];
|
||||
COS_DF = new Float[4];
|
||||
}
|
||||
public static int GetSize()
|
||||
{
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
return 6 * Short.SIZE + 59 * Float.SIZE;
|
||||
}
|
||||
public final boolean SetStructBuf(byte[] bArray, int nHaveRead)
|
||||
{
|
||||
int nByteSize = bArray.length;
|
||||
if (nByteSize < GetSize())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int iStep = nHaveRead;
|
||||
time.SetStructBuf(bArray, iStep);
|
||||
iStep = iStep + RTC_Timer.GetSize();
|
||||
RefObject<Float[]> tempRef_RMS = new RefObject<Float[]>(RMS);
|
||||
iStep += Service.convertFloatArraySingle(bArray, iStep, tempRef_RMS);
|
||||
RMS = tempRef_RMS.argvalue;
|
||||
RefObject<Float[]> tempRef_UU_DEV = new RefObject<Float[]>(UU_DEV);
|
||||
iStep += Service.convertFloatArraySingle(bArray, iStep, tempRef_UU_DEV);
|
||||
UU_DEV = tempRef_UU_DEV.argvalue;
|
||||
RefObject<Float[]> tempRef_UL_DEV = new RefObject<Float[]>(UL_DEV);
|
||||
iStep += Service.convertFloatArraySingle(bArray, iStep, tempRef_UL_DEV);
|
||||
UL_DEV = tempRef_UL_DEV.argvalue;
|
||||
RefObject<Float[]> tempRef_THD = new RefObject<Float[]>(THD);
|
||||
iStep += Service.convertFloatArraySingle(bArray, iStep, tempRef_THD);
|
||||
THD = tempRef_THD.argvalue;
|
||||
RefObject<Float[]> tempRef_FREQ = new RefObject<Float[]>(FREQ);
|
||||
iStep += Service.convertFloatArraySingle(bArray, iStep, tempRef_FREQ);
|
||||
FREQ = tempRef_FREQ.argvalue;
|
||||
RefObject<Float[][]> tempRef_UI_SEQ = new RefObject<Float[][]>(UI_SEQ);
|
||||
iStep += Service.convertFloatArrayTwo(bArray, iStep, tempRef_UI_SEQ);
|
||||
UI_SEQ = tempRef_UI_SEQ.argvalue;
|
||||
RefObject<Float[][]> tempRef_TOTAL_POWER = new RefObject<Float[][]>(TOTAL_POWER);
|
||||
iStep += Service.convertFloatArrayTwo(bArray, iStep, tempRef_TOTAL_POWER);
|
||||
TOTAL_POWER = tempRef_TOTAL_POWER.argvalue;
|
||||
RefObject<Float[]> tempRef_COS_PF = new RefObject<Float[]>(COS_PF);
|
||||
iStep += Service.convertFloatArraySingle(bArray, iStep, tempRef_COS_PF);
|
||||
COS_PF = tempRef_COS_PF.argvalue;
|
||||
RefObject<Float[]> tempRef_COS_DF = new RefObject<Float[]>(COS_DF);
|
||||
iStep += Service.convertFloatArraySingle(bArray, iStep, tempRef_COS_DF);
|
||||
COS_DF = tempRef_COS_DF.argvalue;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,29 @@
|
||||
package com.njcn.csharmonic.offline.mincfg.vo;
|
||||
|
||||
/**
|
||||
告警事件结构扩展——身体定义
|
||||
|
||||
*/
|
||||
//C# TO JAVA CONVERTER WARNING: Java does not allow user-defined value types. The behavior of this class will differ from the original:
|
||||
//ORIGINAL LINE: public struct NewBodyTaglogbuffer
|
||||
//C# TO JAVA CONVERTER TODO TASK: Java annotations will not correspond to .NET attributes:
|
||||
//[StructLayout(LayoutKind.Sequential)]
|
||||
public final class NewBodyTaglogbuffer
|
||||
{
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public UInt32 ParaCode;
|
||||
public int ParaCode; // 参数编码
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public UInt32 ParaValue;
|
||||
public int ParaValue; // 参数值
|
||||
@Override
|
||||
public NewBodyTaglogbuffer clone()
|
||||
{
|
||||
NewBodyTaglogbuffer varCopy = new NewBodyTaglogbuffer();
|
||||
|
||||
varCopy.ParaCode = this.ParaCode;
|
||||
varCopy.ParaValue = this.ParaValue;
|
||||
|
||||
return varCopy;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.njcn.csharmonic.offline.mincfg.vo;
|
||||
|
||||
/**
|
||||
告警事件结构扩展——头定义
|
||||
|
||||
*/
|
||||
//C# TO JAVA CONVERTER WARNING: Java does not allow user-defined value types. The behavior of this class will differ from the original:
|
||||
//ORIGINAL LINE: public struct NewHeadTaglogbuffer
|
||||
//C# TO JAVA CONVERTER TODO TASK: Java annotations will not correspond to .NET attributes:
|
||||
//[StructLayout(LayoutKind.Sequential)]
|
||||
public final class NewHeadTaglogbuffer
|
||||
{
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public UInt16 name;
|
||||
public short name; // 监测点序号
|
||||
public TagMsTime Devtime; // 绝对时间
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public UInt16 LogType;
|
||||
public short LogType; // 日志类型(装置故障类、越限类)
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public UInt16 LogCode;
|
||||
public short LogCode; // 日志代码
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public UInt16 LogLb;
|
||||
public short LogLb; // 日志录波
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public UInt16 LogBackup;
|
||||
public short LogBackup; // 日志补零位
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public UInt32 LogParaNum;
|
||||
public int LogParaNum; // 日志参数项数
|
||||
@Override
|
||||
public NewHeadTaglogbuffer clone()
|
||||
{
|
||||
NewHeadTaglogbuffer varCopy = new NewHeadTaglogbuffer();
|
||||
|
||||
varCopy.name = this.name;
|
||||
varCopy.Devtime = this.Devtime.clone();
|
||||
varCopy.LogType = this.LogType;
|
||||
varCopy.LogCode = this.LogCode;
|
||||
varCopy.LogLb = this.LogLb;
|
||||
varCopy.LogBackup = this.LogBackup;
|
||||
varCopy.LogParaNum = this.LogParaNum;
|
||||
|
||||
return varCopy;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.njcn.csharmonic.offline.mincfg.vo;
|
||||
|
||||
//事件结构
|
||||
public class NewTaglogbuffer
|
||||
{
|
||||
public NewHeadTaglogbuffer newHeadTaglogbuffer;
|
||||
public java.util.ArrayList<NewBodyTaglogbuffer> newBodyTaglogbuffers;
|
||||
|
||||
public java.util.Date start, end = new java.util.Date(0); //事件起始和结束时间
|
||||
public String path = ""; //事件对应波形文件名称
|
||||
public NewTaglogbuffer(NewHeadTaglogbuffer head, java.util.ArrayList<NewBodyTaglogbuffer> body)
|
||||
{
|
||||
newHeadTaglogbuffer = head.clone();
|
||||
newBodyTaglogbuffers = body;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,170 @@
|
||||
package com.njcn.csharmonic.offline.mincfg.vo;
|
||||
|
||||
//风电光伏功率区间数据 //数据时标
|
||||
public class PowerReg
|
||||
{
|
||||
public RTC_Timer_MS time;
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public uint line;
|
||||
public int line; //监测点
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public uint reg;
|
||||
public int reg; //功率区间
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public uint data_type;
|
||||
public int data_type; //数据类型
|
||||
//1平均值 2最大值 4最小值 8CP95值
|
||||
public Float u_blance; //电压不平衡度
|
||||
public Float i_blance; //电流不平衡度
|
||||
public Float[] uu_dev; //电压上偏差 3
|
||||
public Float[] ul_dev; //电压下偏差 3
|
||||
public Float[] harmu_thd; //谐波电压畸变率 3
|
||||
public Float[] harmi_thd; //谐波电流畸变率 3
|
||||
public Float[][] harmu; //谐波电压含有率 3-50
|
||||
public Float[][] harmi; //谐波电流幅值 3-50
|
||||
public Float[][] inharmu; //间谐波电压含有率 3-50
|
||||
public Float[][] inharmi; //间谐波电流幅值 3-50
|
||||
public Float[] flick; //短时闪变 3
|
||||
public Float freq; //频率
|
||||
|
||||
public Float[] fluct; //电压波动
|
||||
public Float[] lflick; //长时闪变
|
||||
public Float[] udd_ss; //稳态变动
|
||||
public Float[] udd_max; //最大变动
|
||||
public Float[] p; //总有功
|
||||
public Float[] p_fund; //总基波有功
|
||||
public Float[] q; //总无功
|
||||
public Float[] q_fund; //总基波无功
|
||||
// 高频谐波增加的数据 *************************************************************
|
||||
//中心频率从2.1kHz到8.9kHz,以200Hz为间隔
|
||||
public Float[][] hf_harmu; //高频谐波电压
|
||||
public Float[][] hf_harmi; //高频谐波电流
|
||||
public Float[] data_by_2; //备用
|
||||
public PowerReg()
|
||||
{
|
||||
time = new RTC_Timer_MS();
|
||||
uu_dev = new Float[3];
|
||||
ul_dev = new Float[3];
|
||||
harmu_thd = new Float[3];
|
||||
harmi_thd = new Float[3];
|
||||
harmu = new Float[3][50];
|
||||
harmi = new Float[3][50];
|
||||
inharmu = new Float[3][50];
|
||||
inharmi = new Float[3][50];
|
||||
flick = new Float[3];
|
||||
|
||||
|
||||
fluct = new Float[3];
|
||||
lflick = new Float[3];
|
||||
udd_ss = new Float[3];
|
||||
udd_max = new Float[3];
|
||||
p = new Float[4];
|
||||
p_fund = new Float[4];
|
||||
q = new Float[4];
|
||||
q_fund = new Float[4];
|
||||
|
||||
hf_harmu = new Float[3][35];
|
||||
hf_harmi = new Float[3][35];
|
||||
data_by_2 = new Float[210];
|
||||
}
|
||||
public static int GetSize()
|
||||
{
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
int len = 7 * Short.SIZE / Byte.SIZE + 3 * Integer.SIZE / Byte.SIZE + (15 + 600 + 3 + 28 + 420) * Float.SIZE / Byte.SIZE;
|
||||
return len;
|
||||
}
|
||||
|
||||
public final boolean SetStructBuf(byte[] bArray, int nHaveRead)
|
||||
{
|
||||
int nByteSize = bArray.length;
|
||||
if (nByteSize < GetSize())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int iStep = nHaveRead;
|
||||
time.SetStructBuf(bArray, iStep);
|
||||
iStep = iStep + RTC_Timer_MS.GetSize();
|
||||
line = Service.convertUInt32_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
reg = Service.convertUInt32_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
data_type = Service.convertUInt32_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
u_blance = Service.convertfloat(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Float.SIZE / Byte.SIZE;
|
||||
i_blance = Service.convertfloat(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Float.SIZE / Byte.SIZE;
|
||||
RefObject<Float[]> tempRef_uu_dev = new RefObject<Float[]>(uu_dev);
|
||||
iStep += Service.convertFloatArraySingle(bArray, iStep, tempRef_uu_dev);
|
||||
uu_dev = tempRef_uu_dev.argvalue;
|
||||
RefObject<Float[]> tempRef_ul_dev = new RefObject<Float[]>(ul_dev);
|
||||
iStep += Service.convertFloatArraySingle(bArray, iStep, tempRef_ul_dev);
|
||||
ul_dev = tempRef_ul_dev.argvalue;
|
||||
RefObject<Float[]> tempRef_harmu_thd = new RefObject<Float[]>(harmu_thd);
|
||||
iStep += Service.convertFloatArraySingle(bArray, iStep, tempRef_harmu_thd);
|
||||
harmu_thd = tempRef_harmu_thd.argvalue;
|
||||
RefObject<Float[]> tempRef_harmi_thd = new RefObject<Float[]>(harmi_thd);
|
||||
iStep += Service.convertFloatArraySingle(bArray, iStep, tempRef_harmi_thd);
|
||||
harmi_thd = tempRef_harmi_thd.argvalue;
|
||||
RefObject<Float[][]> tempRef_harmu = new RefObject<Float[][]>(harmu);
|
||||
iStep += Service.convertFloatArrayTwo(bArray, iStep, tempRef_harmu);
|
||||
harmu = tempRef_harmu.argvalue;
|
||||
RefObject<Float[][]> tempRef_harmi = new RefObject<Float[][]>(harmi);
|
||||
iStep += Service.convertFloatArrayTwo(bArray, iStep, tempRef_harmi);
|
||||
harmi = tempRef_harmi.argvalue;
|
||||
RefObject<Float[][]> tempRef_inharmu = new RefObject<Float[][]>(inharmu);
|
||||
iStep += Service.convertFloatArrayTwo(bArray, iStep, tempRef_inharmu);
|
||||
inharmu = tempRef_inharmu.argvalue;
|
||||
RefObject<Float[][]> tempRef_inharmi = new RefObject<Float[][]>(inharmi);
|
||||
iStep += Service.convertFloatArrayTwo(bArray, iStep, tempRef_inharmi);
|
||||
inharmi = tempRef_inharmi.argvalue;
|
||||
RefObject<Float[]> tempRef_flick = new RefObject<Float[]>(flick);
|
||||
iStep += Service.convertFloatArraySingle(bArray, iStep, tempRef_flick);
|
||||
flick = tempRef_flick.argvalue;
|
||||
freq = Service.convertfloat(bArray, iStep);
|
||||
RefObject<Float[]> tempRef_fluct = new RefObject<Float[]>(fluct);
|
||||
iStep += Service.convertFloatArraySingle(bArray, iStep, tempRef_fluct);
|
||||
fluct = tempRef_fluct.argvalue;
|
||||
RefObject<Float[]> tempRef_lflick = new RefObject<Float[]>(lflick);
|
||||
iStep += Service.convertFloatArraySingle(bArray, iStep, tempRef_lflick);
|
||||
lflick = tempRef_lflick.argvalue;
|
||||
RefObject<Float[]> tempRef_udd_ss = new RefObject<Float[]>(udd_ss);
|
||||
iStep += Service.convertFloatArraySingle(bArray, iStep, tempRef_udd_ss);
|
||||
udd_ss = tempRef_udd_ss.argvalue;
|
||||
RefObject<Float[]> tempRef_udd_max = new RefObject<Float[]>(udd_max);
|
||||
iStep += Service.convertFloatArraySingle(bArray, iStep, tempRef_udd_max);
|
||||
udd_max = tempRef_udd_max.argvalue;
|
||||
RefObject<Float[]> tempRef_p = new RefObject<Float[]>(p);
|
||||
iStep += Service.convertFloatArraySingle(bArray, iStep, tempRef_p);
|
||||
p = tempRef_p.argvalue;
|
||||
RefObject<Float[]> tempRef_p_fund = new RefObject<Float[]>(p_fund);
|
||||
iStep += Service.convertFloatArraySingle(bArray, iStep, tempRef_p_fund);
|
||||
p_fund = tempRef_p_fund.argvalue;
|
||||
RefObject<Float[]> tempRef_q = new RefObject<Float[]>(q);
|
||||
iStep += Service.convertFloatArraySingle(bArray, iStep, tempRef_q);
|
||||
q = tempRef_q.argvalue;
|
||||
RefObject<Float[]> tempRef_q_fund = new RefObject<Float[]>(q_fund);
|
||||
iStep += Service.convertFloatArraySingle(bArray, iStep, tempRef_q_fund);
|
||||
q_fund = tempRef_q_fund.argvalue;
|
||||
|
||||
RefObject<Float[][]> tempRef_hf_harmu = new RefObject<Float[][]>(hf_harmu);
|
||||
iStep += Service.convertFloatArrayTwo(bArray, iStep, tempRef_hf_harmu);
|
||||
hf_harmu = tempRef_hf_harmu.argvalue;
|
||||
RefObject<Float[][]> tempRef_hf_harmi = new RefObject<Float[][]>(hf_harmi);
|
||||
iStep += Service.convertFloatArrayTwo(bArray, iStep, tempRef_hf_harmi);
|
||||
hf_harmi = tempRef_hf_harmi.argvalue;
|
||||
RefObject<Float[]> tempRef_data_by_2 = new RefObject<Float[]>(data_by_2);
|
||||
iStep += Service.convertFloatArraySingle(bArray, iStep, tempRef_data_by_2);
|
||||
data_by_2 = tempRef_data_by_2.argvalue;
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Float.SIZE / Byte.SIZE;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
package com.njcn.csharmonic.offline.mincfg.vo;
|
||||
|
||||
//风电光伏配置
|
||||
public class PowerSet
|
||||
{
|
||||
public float rated_p; //额定功率
|
||||
public float rated_i; //额定电流
|
||||
public float mk_p; //启停机功率
|
||||
public float mk_i; //启停机电流
|
||||
public float set_p; //功率调节功率目标量
|
||||
public float set_p_mk; //功率调节量目标门槛
|
||||
public float set_q; //无功功率调节功率目标量
|
||||
public float set_q_mk; //无功功率调节量目标门槛
|
||||
public float set_q_xz; //无功功率调节限值
|
||||
//以上参数为一次值,功率单位MW,电流单位A
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public uint reg_ok_num;
|
||||
public int reg_ok_num; //功率区间所需个数
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public uint run_time;
|
||||
public int run_time; //测试超时时间,以分钟为单位
|
||||
public char[] by = new char[1024]; //1024个字节,留着后期扩展备用
|
||||
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public uint uStatus;
|
||||
public int uStatus;
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public uint Check_sum;
|
||||
public int Check_sum;
|
||||
public static int GetSize()
|
||||
{
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
int len = 9 * Float.SIZE / Byte.SIZE+ 4 * Integer.SIZE / Byte.SIZE + 1024;
|
||||
return len;
|
||||
}
|
||||
public final boolean SetStructBuf(byte[] bArray, int nHaveRead)
|
||||
{
|
||||
int nSize = bArray.length;
|
||||
int nStep = nHaveRead; //读取数据的步长
|
||||
|
||||
if (nSize < (GetSize() + nHaveRead))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
rated_p = Service.convertfloat(bArray, nStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
nStep += Float.SIZE / Byte.SIZE;
|
||||
rated_i = Service.convertfloat(bArray, nStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
nStep += Float.SIZE / Byte.SIZE;
|
||||
mk_p = Service.convertfloat(bArray, nStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
nStep += Float.SIZE / Byte.SIZE;
|
||||
mk_i = Service.convertfloat(bArray, nStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
nStep += Float.SIZE / Byte.SIZE;
|
||||
set_p = Service.convertfloat(bArray, nStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
nStep += Float.SIZE / Byte.SIZE;
|
||||
set_p_mk = Service.convertfloat(bArray, nStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
nStep += Float.SIZE / Byte.SIZE;
|
||||
set_q = Service.convertfloat(bArray, nStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
nStep += Float.SIZE / Byte.SIZE;
|
||||
set_q_mk = Service.convertfloat(bArray, nStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
nStep += Float.SIZE / Byte.SIZE;
|
||||
set_q_xz = Service.convertfloat(bArray, nStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
nStep += Float.SIZE / Byte.SIZE;
|
||||
reg_ok_num = Service.convertUInt32_net(bArray, nStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
nStep += Integer.SIZE / Byte.SIZE;
|
||||
run_time = Service.convertUInt32_net(bArray, nStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
nStep += Integer.SIZE / Byte.SIZE;
|
||||
for (int i = 0; i < by.length; i++)
|
||||
{
|
||||
by[i] = (char)bArray[nStep];
|
||||
nStep++;
|
||||
}
|
||||
uStatus = Service.convertUInt32_net(bArray, nStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
nStep += Integer.SIZE / Byte.SIZE;
|
||||
Check_sum = Service.convertUInt32_net(bArray, nStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
nStep += Integer.SIZE / Byte.SIZE;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public final int GetStructBuf(RefObject<Byte[]> bArray, int nHaveRead)
|
||||
{
|
||||
int nSize = bArray.argvalue.length;
|
||||
if (nSize < (nHaveRead + GetSize()))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
int iStep = nHaveRead;
|
||||
|
||||
iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Float)rated_p, Service.enum_Value_type.Value_float);
|
||||
iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Float)rated_i, Service.enum_Value_type.Value_float);
|
||||
iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Float)mk_p, Service.enum_Value_type.Value_float);
|
||||
iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Float)mk_i, Service.enum_Value_type.Value_float);
|
||||
iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Float)set_p, Service.enum_Value_type.Value_float);
|
||||
iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Float)set_p_mk, Service.enum_Value_type.Value_float);
|
||||
iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Float)set_q, Service.enum_Value_type.Value_float);
|
||||
iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Float)set_q_mk, Service.enum_Value_type.Value_float);
|
||||
iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Float)set_q_xz, Service.enum_Value_type.Value_float);
|
||||
iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Integer)reg_ok_num, Service.enum_Value_type.Value_uint);
|
||||
iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Integer)run_time, Service.enum_Value_type.Value_uint);
|
||||
|
||||
for (int i = 0; i < by.length; i++)
|
||||
{
|
||||
bArray.argvalue[iStep] = (byte)by[i];
|
||||
iStep++;
|
||||
}
|
||||
iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Integer)uStatus, Service.enum_Value_type.Value_uint);
|
||||
iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Integer)Check_sum, Service.enum_Value_type.Value_uint);
|
||||
return GetSize();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.njcn.csharmonic.offline.mincfg.vo;//package com.njcn.user.utils.test.test1;
|
||||
//
|
||||
//public class Program
|
||||
//{
|
||||
// private static void main(String[] args)
|
||||
// {
|
||||
// //Console.WriteLine("Hello World!");
|
||||
// DealDataFile dealDataFile = new DealDataFile();
|
||||
// dealDataFile.Run("C:\\Users\\ZW\\Desktop\\普测测试文档\\09");
|
||||
// }
|
||||
//}
|
||||
@@ -0,0 +1,92 @@
|
||||
package com.njcn.csharmonic.offline.mincfg.vo;
|
||||
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
|
||||
///#region 3秒实时数据报文
|
||||
public class RTC_Timer //数据时标
|
||||
{
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public ushort year;
|
||||
public short year;
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public ushort month;
|
||||
public short month;
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public ushort day;
|
||||
public short day;
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public ushort hour;
|
||||
public short hour;
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public ushort minute;
|
||||
public short minute;
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public ushort second;
|
||||
public short second;
|
||||
public static int GetSize()
|
||||
{
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
return 6 * Short.SIZE / Byte.SIZE;
|
||||
}
|
||||
public final boolean SetStructBuf(byte[] bArray, int nHaveRead)
|
||||
{
|
||||
int nByteSize = bArray.length;
|
||||
if (nByteSize < GetSize())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int iStep = nHaveRead;
|
||||
|
||||
year = Service.convertUInt16_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Short.SIZE / Byte.SIZE;
|
||||
month = Service.convertUInt16_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Short.SIZE / Byte.SIZE;
|
||||
day = Service.convertUInt16_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Short.SIZE / Byte.SIZE;
|
||||
hour = Service.convertUInt16_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Short.SIZE / Byte.SIZE;
|
||||
minute = Service.convertUInt16_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Short.SIZE / Byte.SIZE;
|
||||
second = Service.convertUInt16_net(bArray, iStep);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@brief 将类中的变量组装成byte[]二进制流
|
||||
@param byte[] in 已分配的二进制流
|
||||
@return byte[] out 二进制数组
|
||||
|
||||
*/
|
||||
public final int GetStructBuf(RefObject<Byte[]> bArray, int nHaveRead)
|
||||
{
|
||||
int nSize = bArray.argvalue.length;
|
||||
if (nSize < (nHaveRead + GetSize()))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
int iStep = nHaveRead;
|
||||
iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Short)year, Service.enum_Value_type.Value_ushort);
|
||||
iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Short)month, Service.enum_Value_type.Value_ushort);
|
||||
iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Short)day, Service.enum_Value_type.Value_ushort);
|
||||
iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Short)hour, Service.enum_Value_type.Value_ushort);
|
||||
iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Short)minute, Service.enum_Value_type.Value_ushort);
|
||||
iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Short)second, Service.enum_Value_type.Value_ushort);
|
||||
|
||||
return GetSize();
|
||||
}
|
||||
public final void clone(RTC_Timer Src)
|
||||
{
|
||||
year = Src.year;
|
||||
month = Src.month;
|
||||
day = Src.day;
|
||||
hour = Src.hour;
|
||||
minute = Src.minute;
|
||||
second = Src.second;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package com.njcn.csharmonic.offline.mincfg.vo;
|
||||
|
||||
public class RTC_Timer_MS //数据时标
|
||||
{
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public ushort year;
|
||||
public short year;
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public ushort month;
|
||||
public short month;
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public ushort day;
|
||||
public short day;
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public ushort hour;
|
||||
public short hour;
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public ushort minute;
|
||||
public short minute;
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public ushort second;
|
||||
public short second;
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public ushort millisecond;
|
||||
public short millisecond;
|
||||
public static int GetSize()
|
||||
{
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
return 7 * Short.SIZE / Byte.SIZE;
|
||||
}
|
||||
public final boolean SetStructBuf(byte[] bArray, int nHaveRead)
|
||||
{
|
||||
int nByteSize = bArray.length;
|
||||
if (nByteSize < GetSize())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int iStep = nHaveRead;
|
||||
|
||||
year = Service.convertUInt16_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Short.SIZE / Byte.SIZE;
|
||||
month = Service.convertUInt16_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Short.SIZE / Byte.SIZE;
|
||||
day = Service.convertUInt16_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Short.SIZE / Byte.SIZE;
|
||||
hour = Service.convertUInt16_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Short.SIZE / Byte.SIZE;
|
||||
minute = Service.convertUInt16_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Short.SIZE / Byte.SIZE;
|
||||
second = Service.convertUInt16_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Short.SIZE / Byte.SIZE;
|
||||
millisecond = Service.convertUInt16_net(bArray, iStep);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@brief 将类中的变量组装成byte[]二进制流
|
||||
@return byte[] out 二进制数组
|
||||
|
||||
*/
|
||||
public final int GetStructBuf(RefObject<Byte[]> bArray, int nHaveRead)
|
||||
{
|
||||
int nSize = bArray.argvalue.length;
|
||||
if (nSize < (nHaveRead + GetSize()))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
int iStep = nHaveRead;
|
||||
iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Short)year, Service.enum_Value_type.Value_ushort);
|
||||
iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Short)month, Service.enum_Value_type.Value_ushort);
|
||||
iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Short)day, Service.enum_Value_type.Value_ushort);
|
||||
iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Short)hour, Service.enum_Value_type.Value_ushort);
|
||||
iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Short)minute, Service.enum_Value_type.Value_ushort);
|
||||
iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Short)second, Service.enum_Value_type.Value_ushort);
|
||||
iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Short)millisecond, Service.enum_Value_type.Value_ushort);
|
||||
return GetSize();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.njcn.csharmonic.offline.mincfg.vo;
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
// Copyright ? 2006 - 2010 Tangible Software Solutions Inc.
|
||||
// This class can be used by anyone provided that the copyright notice remains intact.
|
||||
//
|
||||
// This class is used to simulate the ability to pass arguments by reference in Java.
|
||||
//----------------------------------------------------------------------------------------
|
||||
public final class RefObject<T>
|
||||
{
|
||||
public T argvalue;
|
||||
public RefObject(T refarg)
|
||||
{
|
||||
argvalue = refarg;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,817 @@
|
||||
package com.njcn.csharmonic.offline.mincfg.vo;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
public class Service
|
||||
{
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
|
||||
///#region 解析通讯报文相关代码
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
|
||||
///#region 整型->浮点 浮点->整型
|
||||
public static float IntToFloat(int num)
|
||||
{
|
||||
// uint i_middle = 0xffff0000;
|
||||
// uint j_middle = 0x0000ffff;
|
||||
// bool bNav = false;
|
||||
// if ((num & 0x8000000) == 0x8000000)
|
||||
// {
|
||||
// int nTemp = num & 0x7fffffff;
|
||||
// num = ~nTemp + 1;
|
||||
// bNav = true;
|
||||
// }
|
||||
// int i = (int)((num & i_middle) / 65536);
|
||||
// float j = (num & j_middle) / 65536.0f;
|
||||
// if (bNav)
|
||||
// return -((float)i + j);
|
||||
// return (float)i + j;
|
||||
float j = (float)num / 65536.0f;
|
||||
return (float)j;
|
||||
}
|
||||
public static float IntToFloat1000(int num)
|
||||
{
|
||||
// uint i_middle = 0xffff0000;
|
||||
// uint j_middle = 0x0000ffff;
|
||||
// bool bNav = false;
|
||||
// if ((num & 0x8000000) == 0x8000000)
|
||||
// {
|
||||
// int nTemp = num & 0x7fffffff;
|
||||
// num = ~nTemp + 1;
|
||||
// bNav = true;
|
||||
// }
|
||||
// int i = (int)((num & i_middle) / 65536);
|
||||
// float j = (num & j_middle) / 65536.0f;
|
||||
// if (bNav)
|
||||
// return -((float)i + j);
|
||||
// return (float)i + j;
|
||||
float j = (float)num / 1000.0f;
|
||||
return (float)j;
|
||||
}
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public static float UintToFloat(uint num)
|
||||
public static float UintToFloat(int num)
|
||||
{
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: uint i_middle = 0xffff0000;
|
||||
int i_middle = 0xffff0000;
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: uint j_middle = 0x0000ffff;
|
||||
int j_middle = 0x0000ffff;
|
||||
boolean bNav = false;
|
||||
if ((num & 0x8000000) == 0x8000000)
|
||||
{
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: uint nTemp = num & 0x7fffffff;
|
||||
int nTemp = num & 0x7fffffff;
|
||||
num = ~nTemp + 1;
|
||||
bNav = true;
|
||||
}
|
||||
int i = (int)((num & i_middle) / 65536);
|
||||
float j = (num & j_middle) / 65536.0f;
|
||||
if (bNav)
|
||||
{
|
||||
return -((float)i + j);
|
||||
}
|
||||
return (float)i + j;
|
||||
}
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public static float UshorToFloat(ushort num)
|
||||
public static float UshorToFloat(short num)
|
||||
{
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: ushort i_middle = 0xff00;
|
||||
short i_middle = (short) 0xff00;
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: ushort j_middle = 0x00ff;
|
||||
short j_middle = 0x00ff;
|
||||
boolean bNav = false;
|
||||
if ((num & 0x8000) == 0x8000)
|
||||
{
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: ushort nTemp = (ushort)(num & 0x7fff);
|
||||
short nTemp = (short)(num & 0x7fff);
|
||||
num = (short)(~nTemp + 1);
|
||||
bNav = true;
|
||||
}
|
||||
int i = (num & i_middle) / 256;
|
||||
float j = (num & j_middle) / 256.0f;
|
||||
if (bNav)
|
||||
{
|
||||
return -((float)i + j);
|
||||
}
|
||||
return (float)i + j;
|
||||
}
|
||||
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public static ushort FloatToShort(float num)
|
||||
public static short FloatToShort(float num)
|
||||
{
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: ushort i = (ushort)num;
|
||||
short i = (short)num;
|
||||
float middle_j = num - (float)i;
|
||||
float j = 256 * middle_j;
|
||||
return (short)(i + (short)j);
|
||||
}
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public static float UshorToFloat10000(ushort num)
|
||||
public static float UshorToFloat10000(short num)
|
||||
{
|
||||
float j = num / 10000.0f;
|
||||
return j;
|
||||
}
|
||||
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public static ushort FloatToShort10000(float num)
|
||||
public static short FloatToShort10000(float num)
|
||||
{
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: ushort i = (ushort)(num * 10000.0f);
|
||||
short i = (short)(num * 10000.0f);
|
||||
return i;
|
||||
}
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public static float UshorToFloat100(ushort num)
|
||||
public static float UshorToFloat100(short num)
|
||||
{
|
||||
float j = num / 100.0f;
|
||||
return j;
|
||||
}
|
||||
public static float ShorToFloat100(short num)
|
||||
{
|
||||
float j = num / 100.0f;
|
||||
return j;
|
||||
}
|
||||
public static float ShorToFloat1000(short num)
|
||||
{
|
||||
float j = num / 1000.0f;
|
||||
return j;
|
||||
}
|
||||
public static float ShorToFloat10000(short num)
|
||||
{
|
||||
float j = num / 10000.0f;
|
||||
return j;
|
||||
}
|
||||
|
||||
public static void reverseByteArray(byte[] arr) {
|
||||
int start = 0;
|
||||
int end = arr.length - 1;
|
||||
while (start < end) {
|
||||
byte temp = arr[start];
|
||||
arr[start] = arr[end];
|
||||
arr[end] = temp;
|
||||
start++;
|
||||
end--;
|
||||
}
|
||||
}
|
||||
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
|
||||
///#endregion
|
||||
public static byte[] ByteReversa(byte[] temp) //翻转Byte数组
|
||||
{
|
||||
|
||||
reverseByteArray(temp);
|
||||
return temp;
|
||||
}
|
||||
public enum enum_Value_type
|
||||
{
|
||||
Value_uint(1),
|
||||
Value_int(2),
|
||||
Value_ushort(3),
|
||||
Value_short(4),
|
||||
Value_float(5),
|
||||
Value_Long(6),
|
||||
Value_UInt64(7);
|
||||
|
||||
private int intValue;
|
||||
private static java.util.HashMap<Integer, enum_Value_type> mappings;
|
||||
private synchronized static java.util.HashMap<Integer, enum_Value_type> getMappings()
|
||||
{
|
||||
if (mappings == null)
|
||||
{
|
||||
mappings = new java.util.HashMap<Integer, enum_Value_type>();
|
||||
}
|
||||
return mappings;
|
||||
}
|
||||
|
||||
private enum_Value_type(int value)
|
||||
{
|
||||
intValue = value;
|
||||
enum_Value_type.getMappings().put(value, this);
|
||||
}
|
||||
|
||||
public int getValue()
|
||||
{
|
||||
return intValue;
|
||||
}
|
||||
|
||||
public static enum_Value_type forValue(int value)
|
||||
{
|
||||
return getMappings().get(value);
|
||||
}
|
||||
}
|
||||
/**
|
||||
@brief 将数据写入到byte[]中去
|
||||
// @param byte[] in 二进制流数组
|
||||
// @param int in 二进制流数组
|
||||
// @param object in 待写入的数据
|
||||
// @param uint in 数据类型 enum_Value_type的枚举类型
|
||||
@return int out 转换的长度
|
||||
注:AddObjectToByteArray函数中的nType其实可以换成typeof来进行数据类型定义。——zl 2018-4-12 10:44:45
|
||||
|
||||
*/
|
||||
public static int AddObjectToByteArray(RefObject<Byte[]> bArray, int nHaveRead, Object ob_Value, enum_Value_type nType)
|
||||
{
|
||||
byte[] bTemp = new byte[8];
|
||||
int nSize = 0;
|
||||
switch (nType)
|
||||
{
|
||||
case Value_uint:
|
||||
{
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: uint nValue = (uint)ob_Value;
|
||||
int nValue = ((Integer)ob_Value).intValue();
|
||||
bTemp = ByteBuffer.allocate(4).putInt(nValue).array();
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
nSize = Integer.SIZE / Byte.SIZE;
|
||||
break;
|
||||
}
|
||||
case Value_int:
|
||||
{
|
||||
int nValue = ((Integer)ob_Value).intValue();
|
||||
bTemp = ByteBuffer.allocate(4).putInt(nValue).array();
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
nSize = Integer.SIZE / Byte.SIZE;
|
||||
break;
|
||||
}
|
||||
case Value_ushort:
|
||||
{
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: ushort nValue = (ushort)ob_Value;
|
||||
short nValue = ((Short)ob_Value).shortValue();
|
||||
bTemp = ByteBuffer.allocate(4).putInt(nValue).array();
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
nSize = Short.SIZE / Byte.SIZE;
|
||||
break;
|
||||
}
|
||||
case Value_short:
|
||||
{
|
||||
short nValue = ((Short)ob_Value).shortValue();
|
||||
bTemp = ByteBuffer.allocate(4).putInt(nValue).array();
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
nSize = Short.SIZE / Byte.SIZE;
|
||||
break;
|
||||
}
|
||||
case Value_float:
|
||||
{
|
||||
float nValue = ((Float)ob_Value).floatValue();
|
||||
bTemp = ByteBuffer.allocate(4).putFloat(nValue).array();
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
nSize = Float.SIZE / Byte.SIZE;
|
||||
break;
|
||||
}
|
||||
case Value_Long:
|
||||
{
|
||||
long nValue = ((Long)ob_Value).longValue();
|
||||
bTemp = ByteBuffer.allocate(4).putLong(nValue).array();
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
nSize = Long.SIZE;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
int i = 0;
|
||||
for (i = 0; i < nSize; i++)
|
||||
{
|
||||
bArray.argvalue[nHaveRead + i] = bTemp[i];
|
||||
}
|
||||
|
||||
return nSize;
|
||||
}
|
||||
/**
|
||||
@brief 将数据写入到byte[]中去,字节颠倒
|
||||
// @param byte[] in 二进制流数组
|
||||
// @param int in 二进制流数组
|
||||
// @param object in 待写入的数据
|
||||
// @param uint in 数据类型 enum_Value_type的枚举类型
|
||||
@return int out 转换的长度
|
||||
|
||||
*/
|
||||
public static int AddObjectToByteArray_net(RefObject<Byte[]> bArray, int nHaveRead, Object ob_Value, enum_Value_type nType)
|
||||
{
|
||||
byte[] bTemp = new byte[8];
|
||||
int nSize = 0;
|
||||
|
||||
switch (nType)
|
||||
{
|
||||
case Value_uint:
|
||||
{
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: uint nValue = (uint)ob_Value;
|
||||
int nValue = ((Integer)ob_Value).intValue();
|
||||
bTemp = ByteBuffer.allocate(Integer.BYTES).putInt(nValue).array();
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
nSize = Integer.SIZE / Byte.SIZE;
|
||||
break;
|
||||
}
|
||||
case Value_int:
|
||||
{
|
||||
int nValue = ((Integer)ob_Value).intValue();
|
||||
bTemp = ByteBuffer.allocate(Integer.BYTES).putInt(nValue).array();
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
nSize = Integer.SIZE / Byte.SIZE;
|
||||
break;
|
||||
}
|
||||
case Value_ushort:
|
||||
{
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: ushort nValue = (ushort)ob_Value;
|
||||
short nValue = ((Short)ob_Value).shortValue();
|
||||
bTemp = ByteBuffer.allocate(Short.BYTES).putInt(nValue).array();
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
nSize = Short.SIZE / Byte.SIZE;
|
||||
break;
|
||||
}
|
||||
case Value_short:
|
||||
{
|
||||
short nValue = ((Short)ob_Value).shortValue();
|
||||
bTemp = ByteBuffer.allocate(4).putInt(nValue).array();
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
nSize = Short.SIZE / Byte.SIZE;
|
||||
break;
|
||||
}
|
||||
case Value_float:
|
||||
{
|
||||
float nValue = ((Float)ob_Value).floatValue();
|
||||
bTemp = ByteBuffer.allocate(Float.BYTES).putFloat(nValue).array();
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
nSize = Float.SIZE / Byte.SIZE;
|
||||
break;
|
||||
}
|
||||
case Value_Long:
|
||||
{
|
||||
long nValue = ((Long)ob_Value).longValue();
|
||||
bTemp = ByteBuffer.allocate(Long.BYTES).putLong(nValue).array();
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
nSize = Long.SIZE;
|
||||
break;
|
||||
}
|
||||
case Value_UInt64:
|
||||
{
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: UInt64 nValue = (UInt64)ob_Value;
|
||||
long nValue = ((Long)ob_Value).longValue();
|
||||
bTemp = ByteBuffer.allocate(Long.BYTES).putLong(nValue).array();
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
nSize = Long.SIZE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
int i = 0;
|
||||
for (i = 0; i < nSize; i++)
|
||||
{
|
||||
bArray.argvalue[nHaveRead + i] = bTemp[nSize - i - 1];
|
||||
}
|
||||
|
||||
return nSize;
|
||||
}
|
||||
/**
|
||||
@brief 将二进制流的数组转换为制定的数据类型,增加字节序的转换
|
||||
// @param byte[] in 二进制流数据
|
||||
// @param int in 需转换的数据在二进制流的位置
|
||||
@return uint out 32位无符号整型数据
|
||||
|
||||
*/
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public static uint convertUInt32_net(byte[] b, int haveread)
|
||||
public static int convertUInt32_net(byte[] b, int haveread)
|
||||
{
|
||||
String s1 = (new Byte(b[haveread])).toString();
|
||||
String s2 = (new Byte(b[haveread + 1])).toString();
|
||||
String s3 = (new Byte(b[haveread + 2])).toString();
|
||||
String s4 = (new Byte(b[haveread + 3])).toString();
|
||||
return (int)convertInt32(s1, s2, s3, s4);
|
||||
}
|
||||
/**
|
||||
@brief 将二进制流的数组转换为制定的数据类型
|
||||
// @param byte[] in 二进制流数据
|
||||
// @param int in 需转换的数据在二进制流的位置
|
||||
@return uint out 32位无符号整型数据
|
||||
|
||||
*/
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public static uint convertUInt32(byte[] b, int haveread)
|
||||
public static int convertUInt32(byte[] b, int haveread)
|
||||
{
|
||||
String s1 = (new Byte(b[haveread + 3])).toString();
|
||||
String s2 = (new Byte(b[haveread + 2])).toString();
|
||||
String s3 = (new Byte(b[haveread + 1])).toString();
|
||||
String s4 = (new Byte(b[haveread])).toString();
|
||||
return (int)convertInt32(s1, s2, s3, s4);
|
||||
}
|
||||
/**
|
||||
@brief 将二进制流的数组转换为制定的数据类型,增加字节序的转换
|
||||
// @param byte[] in 二进制流数据
|
||||
// @param int in 需转换的数据在二进制流的位置
|
||||
@return int out 32位整型数据
|
||||
|
||||
*/
|
||||
public static int convertInt32_net(byte[] b, int haveread)
|
||||
{
|
||||
String s1 = (new Byte(b[haveread])).toString();
|
||||
String s2 = (new Byte(b[haveread + 1])).toString();
|
||||
String s3 = (new Byte(b[haveread + 2])).toString();
|
||||
String s4 = (new Byte(b[haveread + 3])).toString();
|
||||
return convertInt32(s1, s2, s3, s4);
|
||||
}
|
||||
/**
|
||||
@brief 将二进制流的数组转换为制定的数据类型
|
||||
// @param byte[] in 二进制流数据
|
||||
// @param int in 需转换的数据在二进制流的位置
|
||||
@return int out 32位整型数据
|
||||
|
||||
*/
|
||||
public static int convertInt32(byte[] b, int haveread)
|
||||
{
|
||||
String s1 = (new Byte(b[haveread + 3])).toString();
|
||||
String s2 = (new Byte(b[haveread + 2])).toString();
|
||||
String s3 = (new Byte(b[haveread + 1])).toString();
|
||||
String s4 = (new Byte(b[haveread])).toString();
|
||||
return convertInt32(s1, s2, s3, s4);
|
||||
}
|
||||
/**
|
||||
@brief 将字符型的数据转换无符号的整数
|
||||
// @param string in 高位字符
|
||||
// @param string in 低位字符
|
||||
@return int out 16位无符号整型数据
|
||||
|
||||
*/
|
||||
public static int convertInt32(String s1, String s2, String s3, String s4)
|
||||
{
|
||||
int nValue = (Integer.parseInt(s1, 10) * 256 * 256 * 256 + Integer.parseInt(s2, 10) * 256 * 256 + Integer.parseInt(s3, 10) * 256 + Integer.parseInt(s4, 10));
|
||||
return nValue;
|
||||
}
|
||||
/**
|
||||
@brief 将二进制流写入到数组中
|
||||
// @param byte[] in 待转换的二进制流
|
||||
// @param int in 已读取的二进制个数
|
||||
// @param int[] in 需写入的数组
|
||||
@return int out 总共转换了多少个byte
|
||||
|
||||
*/
|
||||
public static int convertInt32ArraySigle(byte[] b, int haveread, RefObject<Integer[]> int32Array)
|
||||
{
|
||||
int i = 0, iStep = 0;
|
||||
int nSize = int32Array.argvalue.length;
|
||||
for (i = 0; i < nSize; i++)
|
||||
{
|
||||
int32Array.argvalue[i]= convertInt32_net(b, haveread + iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
}
|
||||
|
||||
return iStep;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@brief 将二进制流写入到数组中
|
||||
// @param byte[] in 待转换的二进制流
|
||||
// @param int in 已读取的二进制个数
|
||||
// @param uint[] in 需写入的数组
|
||||
@return int out 总共转换了多少个byte
|
||||
|
||||
*/
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public static int convertUInt32Array(byte[] b, int haveread, ref uint[] UInt32Array)
|
||||
public static int convertUInt32Array(byte[] b, int haveread, RefObject<Integer[]> UInt32Array)
|
||||
{
|
||||
int i = 0, iStep = 0;
|
||||
int nSize = UInt32Array.argvalue.length;
|
||||
for (i = 0; i < nSize; i++)
|
||||
{
|
||||
UInt32Array.argvalue[i] = convertUInt32_net(b, haveread + iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
}
|
||||
|
||||
return iStep;
|
||||
}
|
||||
/**
|
||||
@brief 将二进制流写入到数组中
|
||||
// @param byte[] in 待转换的二进制流
|
||||
// @param int in 已读取的二进制个数
|
||||
@return int out 总共转换了多少个byte
|
||||
|
||||
*/
|
||||
public static int convertInt32Array(byte[] b, int haveread, RefObject<Integer[][]> Int32Array)
|
||||
{
|
||||
int i = 0, j = 0, iStep = 0;
|
||||
int nColLength = Int32Array.argvalue[0].length;
|
||||
int nSize = Int32Array.argvalue.length;
|
||||
for (i = 0; i < nSize; i++)
|
||||
{
|
||||
for (j = 0; j < nColLength; j++)
|
||||
{
|
||||
Int32Array.argvalue[i][j] = convertInt32_net(b, haveread + iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
}
|
||||
}
|
||||
|
||||
return iStep;
|
||||
}
|
||||
/**
|
||||
@brief 将二进制流写入到数组中
|
||||
// @param byte[] in 待转换的二进制流
|
||||
// @param int in 已读取的二进制个数
|
||||
// @param short[] in 需写入的数组
|
||||
@return int out 总共转换了多少个byte
|
||||
|
||||
*/
|
||||
public static int convertInt16Array(byte[] b, int haveread, RefObject<Short[][]> Int16Array)
|
||||
{
|
||||
int i = 0, j = 0, iStep = 0;
|
||||
int nColLength = Int16Array.argvalue[0].length;
|
||||
int nSize = Int16Array.argvalue.length;
|
||||
for (i = 0; i < nSize; i++)
|
||||
{
|
||||
for (j = 0; j < nColLength; j++)
|
||||
{
|
||||
Int16Array.argvalue[i][j] = convertInt16_net(b, haveread + iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Short.SIZE / Byte.SIZE;
|
||||
}
|
||||
}
|
||||
|
||||
return iStep;
|
||||
}
|
||||
/**
|
||||
@brief 将二进制流写入到数组中
|
||||
// @param byte[] in 待转换的二进制流
|
||||
// @param int in 已读取的二进制个数
|
||||
// @param short[] in 需写入的数组
|
||||
@return int out 总共转换了多少个byte
|
||||
|
||||
*/
|
||||
public static int convertInt16ArraySingle(byte[] b, int haveread, RefObject<Short[]> Int16Array)
|
||||
{
|
||||
int i = 0, iStep = 0;
|
||||
int nSize = Int16Array.argvalue.length;
|
||||
for (i = 0; i < nSize; i++)
|
||||
{
|
||||
Int16Array.argvalue[i] = convertInt16_net(b, haveread + iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Short.SIZE / Byte.SIZE;
|
||||
}
|
||||
|
||||
return iStep;
|
||||
}
|
||||
/**
|
||||
@brief 将二进制流写入到数组中
|
||||
// @param byte[] in 待转换的二进制流
|
||||
// @param int in 已读取的二进制个数
|
||||
// @param ushort[] in 需写入的数组
|
||||
@return int out 总共转换了多少个byte
|
||||
|
||||
*/
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public static int convertUInt16Array(byte[] b, int haveread, ref ushort[] UInt16Array)
|
||||
public static int convertUInt16Array(byte[] b, int haveread, RefObject<Short[]> UInt16Array)
|
||||
{
|
||||
int i = 0, iStep = 0;
|
||||
int nSize = UInt16Array.argvalue.length;
|
||||
for (i = 0; i < nSize; i++)
|
||||
{
|
||||
UInt16Array.argvalue[i] = convertUInt16_net(b, haveread + iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Short.SIZE / Byte.SIZE;
|
||||
}
|
||||
|
||||
return iStep;
|
||||
}
|
||||
/**
|
||||
@brief 将二进制流的数组转换为制定的数据类型
|
||||
// @param byte[] in 二进制流数据
|
||||
// @param int in 需转换的数据在二进制流的位置
|
||||
@return float out 32位浮点数据
|
||||
|
||||
*/
|
||||
public static float convertfloat(byte[] b, int haveread)
|
||||
{
|
||||
// 确保有足够的数据来读取一个float(4字节)
|
||||
if (haveread + 4 > b.length) {
|
||||
throw new IndexOutOfBoundsException("Not enough bytes to read a float.");
|
||||
}
|
||||
|
||||
// 创建一个ByteBuffer来处理字节
|
||||
ByteBuffer buffer = ByteBuffer.wrap(b, haveread, 4);
|
||||
// 设置字节顺序,假设是大端序(与许多C#系统和网络协议相同)
|
||||
buffer.order(ByteOrder.BIG_ENDIAN);
|
||||
|
||||
// 从ByteBuffer中读取float
|
||||
float fValue = buffer.getFloat();
|
||||
|
||||
return fValue;
|
||||
}
|
||||
/**
|
||||
@brief 将二进制流的数组转换为制定的数据类型,增加字节序的转换
|
||||
// @param byte[] in 二进制流数据
|
||||
// @param int in 需转换的数据在二进制流的位置
|
||||
@return float out 32位浮点数据
|
||||
|
||||
*/
|
||||
public static float convertfloat_net(byte[] b, int haveread)
|
||||
{
|
||||
// 确保有足够的数据来读取一个float(4字节)
|
||||
if (haveread + 4 > b.length) {
|
||||
throw new IndexOutOfBoundsException("Not enough bytes to read a float.");
|
||||
}
|
||||
|
||||
// 创建一个ByteBuffer来处理字节
|
||||
ByteBuffer buffer = ByteBuffer.wrap(b, haveread, 4);
|
||||
// 设置字节顺序,假设是大端序(与许多C#系统和网络协议相同)
|
||||
buffer.order(ByteOrder.BIG_ENDIAN);
|
||||
|
||||
// 从ByteBuffer中读取float
|
||||
float fValue = buffer.getFloat();
|
||||
|
||||
return fValue;
|
||||
}
|
||||
/**
|
||||
@brief 将二进制流写入到数组中
|
||||
// @param byte[] in 待转换的二进制流
|
||||
// @param int in 已读取的二进制个数
|
||||
// @param float[] in 需写入的数组
|
||||
@return int out 总共转换了多少个byte
|
||||
|
||||
*/
|
||||
public static int convertFloatArrayTwo(byte[] b, int haveread, RefObject<Float[][]> FloatArray)
|
||||
{
|
||||
int i = 0, j = 0, iStep = 0;
|
||||
int nColLength = FloatArray.argvalue[0].length;
|
||||
int nSize = FloatArray.argvalue.length;
|
||||
for (i = 0; i < nSize; i++)
|
||||
{
|
||||
for (j = 0; j < nColLength; j++)
|
||||
{
|
||||
FloatArray.argvalue[i][j] = convertfloat(b, haveread + iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Float.SIZE / Byte.SIZE;
|
||||
}
|
||||
}
|
||||
|
||||
return iStep;
|
||||
}
|
||||
public static int convertFloatArrayThree(byte[] b, int haveread, RefObject<Float[][][]> FloatArray)
|
||||
{
|
||||
int i = 0, j = 0, k = 0, iStep = 0;
|
||||
int n2ColLength = FloatArray.argvalue[0][0].length;
|
||||
int nColLength = FloatArray.argvalue[0].length;
|
||||
int nSize = FloatArray.argvalue.length;
|
||||
for (i = 0; i < nSize; i++)
|
||||
{
|
||||
for (j = 0; j < nColLength; j++)
|
||||
{
|
||||
for (k = 0; k < n2ColLength; k++)
|
||||
{
|
||||
FloatArray.argvalue[i][j][k] = convertfloat(b, haveread + iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Float.SIZE / Byte.SIZE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return iStep;
|
||||
}
|
||||
/**
|
||||
@brief 将二进制流写入到数组中
|
||||
// @param byte[] in 待转换的二进制流
|
||||
// @param int in 已读取的二进制个数
|
||||
// @param float[] in 需写入的数组
|
||||
@return int out 总共转换了多少个byte
|
||||
|
||||
*/
|
||||
public static int convertFloatArraySingle(byte[] b, int haveread, RefObject<Float[]> FloatArray)
|
||||
{
|
||||
int i = 0, iStep = 0;
|
||||
int nSize = FloatArray.argvalue.length;
|
||||
for (i = 0; i < nSize; i++)
|
||||
{
|
||||
FloatArray.argvalue[i] = convertfloat(b, haveread + iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Float.SIZE / Byte.SIZE;
|
||||
}
|
||||
|
||||
return iStep;
|
||||
}
|
||||
/**
|
||||
@brief 将二进制流的数组转换为制定的数据类型
|
||||
// @param byte[] in 二进制流数据
|
||||
// @param int in 需转换的数据在二进制流的位置
|
||||
@return int out 16位无符号整型数据
|
||||
|
||||
*/
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public static ushort convertUInt16_net(byte[] b, int haveread)
|
||||
// public static short convertUInt16_net(byte[] b, int haveread)
|
||||
// {
|
||||
// String s1 = (new Byte(b[haveread])).toString();
|
||||
// String s2 = (new Byte(b[haveread + 1])).toString();
|
||||
// return (short)convertInt16(s1, s2);
|
||||
// }
|
||||
|
||||
public static short convertUInt16_net(byte[] b, int offset) {
|
||||
// 确保offset是有效的,并且偏移量之后至少还有一个字节
|
||||
if (b == null || offset < 0 || offset + 1 >= b.length) {
|
||||
throw new IndexOutOfBoundsException("Invalid offset or array length");
|
||||
}
|
||||
|
||||
// 假设字节顺序是大端的(网络字节序通常是大端的),我们需要先读取高字节再读取低字节
|
||||
// Java的byte类型是有符号的,但我们可以使用无符号右移(>>>)来确保结果是无符号的
|
||||
return (short) (((b[offset] & 0xFF) << 8) | (b[offset + 1] & 0xFF));
|
||||
|
||||
// 如果需要确保结果是正的(即无符号的),并且不会超出short的范围,可以返回强制类型转换后的short
|
||||
// 但请注意,如果结果超过了short的最大值(32767),这里会丢失高位的信息
|
||||
// 在大多数情况下,这不会是一个问题,因为网络数据通常被设计为不会超出这些范围
|
||||
// return (short) result;
|
||||
}
|
||||
/**
|
||||
@brief 将二进制流的数组转换为制定的数据类型
|
||||
// @param byte[] in 二进制流数据
|
||||
// @param int in 需转换的数据在二进制流的位置
|
||||
@return int out 16位无符号整型数据
|
||||
|
||||
*/
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public static ushort convertUInt16(byte[] b, int haveread)
|
||||
public static short convertUInt16(byte[] b, int haveread)
|
||||
{
|
||||
String s1 = (new Byte(b[haveread + 1])).toString();
|
||||
String s2 = (new Byte(b[haveread])).toString();
|
||||
return (short)convertInt16(s1, s2);
|
||||
}
|
||||
/**
|
||||
@brief 将二进制流的数组转换为制定的数据类型
|
||||
// @param byte[] in 二进制流数据
|
||||
// @param int in 需转换的数据在二进制流的位置
|
||||
@return int out 16位整型数据
|
||||
|
||||
*/
|
||||
public static short convertInt16_net(byte[] b, int haveread)
|
||||
{
|
||||
String s1 = (new Byte(b[haveread])).toString();
|
||||
String s2 = (new Byte(b[haveread + 1])).toString();
|
||||
return convertInt16(s1, s2);
|
||||
}
|
||||
/**
|
||||
@brief 将二进制流的数组转换为制定的数据类型
|
||||
// @param byte[] in 二进制流数据
|
||||
// @param int in 需转换的数据在二进制流的位置
|
||||
@return int out 16位整型数据
|
||||
|
||||
*/
|
||||
public static short convertInt16(byte[] b, int haveread)
|
||||
{
|
||||
String s1 = (new Byte(b[haveread + 1])).toString();
|
||||
String s2 = (new Byte(b[haveread])).toString();
|
||||
return convertInt16(s1, s2);
|
||||
}
|
||||
/**
|
||||
@brief 将字符型的数据转换无符号的整数
|
||||
// @param string in 高位字符
|
||||
// @param string in 低位字符
|
||||
@return int out 16位无符号整型数据
|
||||
|
||||
*/
|
||||
public static short convertInt16(String s1, String s2)
|
||||
{
|
||||
short Value = (short)(Short.parseShort(s1, 10) * 256 + Integer.parseInt(s2, 10));
|
||||
return Value;
|
||||
}
|
||||
//解析结构体
|
||||
// public static Object BytesToStuct(byte[] bytes, Class type)
|
||||
// {
|
||||
// //得到结构体的大小
|
||||
// int size = Marshal.SizeOf(type);
|
||||
// //byte数组长度小于结构体的大小
|
||||
// if (size > bytes.length)
|
||||
// {
|
||||
// //返回空
|
||||
// return null;
|
||||
// }
|
||||
// //分配结构体大小的内存空间
|
||||
// IntPtr structPtr = Marshal.AllocHGlobal(size);
|
||||
// //将byte数组拷到分配好的内存空间
|
||||
// Marshal.Copy(bytes, 0, structPtr, size);
|
||||
// //将内存空间转换为目标结构体
|
||||
// Object obj = Marshal.PtrToStructure(structPtr, type);
|
||||
// //释放内存空间
|
||||
// Marshal.FreeHGlobal(structPtr);
|
||||
// //返回结构体
|
||||
// return obj;
|
||||
// }
|
||||
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
|
||||
///#endregion
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.njcn.csharmonic.offline.mincfg.vo;
|
||||
|
||||
/**
|
||||
告警事件结构扩展——时间结构定义
|
||||
|
||||
*/
|
||||
//C# TO JAVA CONVERTER WARNING: Java does not allow user-defined value types. The behavior of this class will differ from the original:
|
||||
//ORIGINAL LINE: public struct TagMsTime
|
||||
//C# TO JAVA CONVERTER TODO TASK: Java annotations will not correspond to .NET attributes:
|
||||
//[StructLayout(LayoutKind.Sequential)]
|
||||
public final class TagMsTime
|
||||
{
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public UInt16 Year;
|
||||
public short Year;
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public UInt16 Month;
|
||||
public short Month;
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public UInt16 Day;
|
||||
public short Day;
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public UInt16 Hour;
|
||||
public short Hour;
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public UInt16 Min;
|
||||
public short Min;
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public UInt16 Sec;
|
||||
public short Sec;
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public UInt16 Ms;
|
||||
public short Ms;
|
||||
@Override
|
||||
public TagMsTime clone()
|
||||
{
|
||||
TagMsTime varCopy = new TagMsTime();
|
||||
|
||||
varCopy.Year = this.Year;
|
||||
varCopy.Month = this.Month;
|
||||
varCopy.Day = this.Day;
|
||||
varCopy.Hour = this.Hour;
|
||||
varCopy.Min = this.Min;
|
||||
varCopy.Sec = this.Sec;
|
||||
varCopy.Ms = this.Ms;
|
||||
|
||||
return varCopy;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,363 @@
|
||||
package com.njcn.csharmonic.offline.mincfg.vo;
|
||||
|
||||
|
||||
/**
|
||||
装置普测工程配置信息
|
||||
|
||||
*/
|
||||
public class cmn_mode_cfg
|
||||
{
|
||||
public byte[] prj_name = new byte[128]; //工程名称
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public uint line_idx;
|
||||
public int line_idx; //监测点序号,备用,配置文件按文件名区分
|
||||
public float un; //电压等级,一次值,单位kV
|
||||
public float u_run; //运行电压,一次值,单位kV
|
||||
public float pt_ratio; //pt变比
|
||||
public float ct_ratio; //ct变比
|
||||
|
||||
public float fDL_Capability; //短路容量,单位MW
|
||||
public float fJZ_Capability; //基准容量,单位MW
|
||||
public float fSB_Capability; //设备容量,单位MW
|
||||
public float fXY_Capability; //协议容量,单位MW
|
||||
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public uint vol_sel;
|
||||
public int vol_sel; //电压接线方式选择 星型 三角形 V型 1 2 4
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public uint cur_sel;
|
||||
public int cur_sel; //电流接线方式选择 //IA和IC合成计算 IB //IA和IB合成计算 IC
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public uint sel_cur_input;
|
||||
public int sel_cur_input; //电流输入选择:各类电流钳或柔性环
|
||||
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public uint data_type;
|
||||
public int data_type; //记录数据类型
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public uint stat_min_time;
|
||||
public int stat_min_time; //分钟统计时间间隔,单位分钟,范围1-10
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public uint min_max_file_size;
|
||||
public int min_max_file_size; //分钟文件分配空间,单位MB
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public uint sec_max_file_size;
|
||||
public int sec_max_file_size; //3秒文件分配空间,单位MB
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public uint ms_max_file_size;
|
||||
public int ms_max_file_size; //200ms文件分配空间,单位MB
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public uint lb_max_file_size;
|
||||
public int lb_max_file_size; //暂态录波分配空间,单位MB
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public uint lb_max_file_num;
|
||||
public int lb_max_file_num; //录波文件最大个数
|
||||
|
||||
//*********************************************************************************
|
||||
//数字化配置
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: ushort app_id_u;
|
||||
private short app_id_u; //电压通道APPID
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: ushort app_id_i;
|
||||
private short app_id_i; //电流通道APPID
|
||||
private byte[] mult_mac_u = new byte[6]; //电压通道组播MAC
|
||||
private byte[] mult_mac_i = new byte[6]; //电流通道组播MAC
|
||||
private int smp_rate; //采样率
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: ushort[] link_cfg = new ushort[8];
|
||||
private Short[] link_cfg = new Short[8]; //虚拟端子配置
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: ushort is_91_or_92;
|
||||
private Short is_91_or_92; //9-1 或9-2选择,初始化系数 // 0位置1选择9-1; 1位置1选择9-2;
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: ushort dig_is_use;
|
||||
private Short dig_is_use; //数字化是否投入,0:退出 1:投入
|
||||
//*********************************************************************************
|
||||
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public uint sel_vol_input;
|
||||
public int sel_vol_input; //电压输入选择:目前电阻分压回路不需要,备用
|
||||
public char[] by = new char[1024]; //1024个字节,留着后期扩展备用
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public ushort uStatus;
|
||||
public short uStatus; //配置有效位
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public ushort crc;
|
||||
public short crc; //校验码
|
||||
|
||||
public static int GetSize() //用于定义Byte数组
|
||||
{
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
int nSize = 12 * Integer.SIZE / Byte.SIZE + 8 * Float.SIZE / Byte.SIZE+ 2 * Short.SIZE / Byte.SIZE + 1152 + 12 * Short.SIZE / Byte.SIZE + 12 + 1 * Integer.SIZE / Byte.SIZE; //CComtradeDataItem数据结构数据长度
|
||||
return nSize;
|
||||
}
|
||||
public final boolean SetStructBuf(byte[] bArray, int nHaveRead)
|
||||
{
|
||||
int nByteSize = bArray.length;
|
||||
if (nByteSize < GetSize())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
int iStep = nHaveRead;
|
||||
|
||||
for (int i = 0; i < prj_name.length; i++)
|
||||
{
|
||||
prj_name[i] = bArray[iStep];
|
||||
iStep++;
|
||||
}
|
||||
line_idx = Service.convertUInt32_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
un = Service.convertfloat(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Float.SIZE / Byte.SIZE;
|
||||
u_run = Service.convertfloat(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Float.SIZE / Byte.SIZE;
|
||||
pt_ratio = Service.convertfloat(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Float.SIZE / Byte.SIZE;
|
||||
ct_ratio = Service.convertfloat(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Float.SIZE / Byte.SIZE;
|
||||
fDL_Capability = Service.convertfloat(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Float.SIZE / Byte.SIZE;
|
||||
fJZ_Capability = Service.convertfloat(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Float.SIZE / Byte.SIZE;
|
||||
fSB_Capability = Service.convertfloat(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Float.SIZE / Byte.SIZE;
|
||||
fXY_Capability = Service.convertfloat(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Float.SIZE / Byte.SIZE;
|
||||
vol_sel = Service.convertUInt32_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
cur_sel = Service.convertUInt32_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
sel_cur_input = Service.convertUInt32_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
data_type = Service.convertUInt32_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
stat_min_time = Service.convertUInt32_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
min_max_file_size = Service.convertUInt32_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
sec_max_file_size = Service.convertUInt32_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
ms_max_file_size = Service.convertUInt32_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
lb_max_file_size = Service.convertUInt32_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
lb_max_file_num = Service.convertUInt32_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
|
||||
app_id_u = Service.convertUInt16_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Short.SIZE / Byte.SIZE;
|
||||
app_id_i = Service.convertUInt16_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Short.SIZE / Byte.SIZE;
|
||||
for (int i = 0; i < mult_mac_u.length; i++)
|
||||
{
|
||||
mult_mac_u[i] = bArray[iStep];
|
||||
iStep++;
|
||||
}
|
||||
for (int i = 0; i < mult_mac_i.length; i++)
|
||||
{
|
||||
mult_mac_i[i] = bArray[iStep];
|
||||
iStep++;
|
||||
}
|
||||
smp_rate = Service.convertInt32_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Short.SIZE / Byte.SIZE;
|
||||
RefObject<Short[]> tempRef_link_cfg = new RefObject<Short[]>(link_cfg);
|
||||
iStep += Service.convertUInt16Array(bArray, iStep, tempRef_link_cfg);
|
||||
link_cfg = tempRef_link_cfg.argvalue;
|
||||
is_91_or_92 = Service.convertUInt16_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Short.SIZE / Byte.SIZE;
|
||||
dig_is_use = Service.convertUInt16_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Short.SIZE / Byte.SIZE;
|
||||
|
||||
sel_vol_input = Service.convertUInt32_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
for (int i = 0; i < by.length; i++)
|
||||
{
|
||||
by[i] = (char)bArray[iStep];
|
||||
iStep++;
|
||||
}
|
||||
uStatus = Service.convertUInt16_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Short.SIZE / Byte.SIZE;
|
||||
crc = Service.convertUInt16_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Short.SIZE / Byte.SIZE;
|
||||
return true;
|
||||
}
|
||||
public final boolean SetStructBuf_net(byte[] bArray, int nHaveRead) //报文大小头处理
|
||||
{
|
||||
int nByteSize = bArray.length;
|
||||
if (nByteSize < GetSize())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
int iStep = nHaveRead;
|
||||
|
||||
for (int i = 0; i < prj_name.length; i++)
|
||||
{
|
||||
prj_name[i] = bArray[iStep];
|
||||
iStep++;
|
||||
}
|
||||
line_idx = Service.convertUInt32(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
un = Service.convertfloat_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Float.SIZE / Byte.SIZE;
|
||||
u_run = Service.convertfloat_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Float.SIZE / Byte.SIZE;
|
||||
pt_ratio = Service.convertfloat_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Float.SIZE / Byte.SIZE;
|
||||
ct_ratio = Service.convertfloat_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Float.SIZE / Byte.SIZE;
|
||||
fDL_Capability = Service.convertfloat_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Float.SIZE / Byte.SIZE;
|
||||
fJZ_Capability = Service.convertfloat_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Float.SIZE / Byte.SIZE;
|
||||
fSB_Capability = Service.convertfloat_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Float.SIZE / Byte.SIZE;
|
||||
fXY_Capability = Service.convertfloat_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Float.SIZE / Byte.SIZE;
|
||||
vol_sel = Service.convertUInt32(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
cur_sel = Service.convertUInt32(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
sel_cur_input = Service.convertUInt32(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
data_type = Service.convertUInt32(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
stat_min_time = Service.convertUInt32(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
min_max_file_size = Service.convertUInt32(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
sec_max_file_size = Service.convertUInt32(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
ms_max_file_size = Service.convertUInt32(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
lb_max_file_size = Service.convertUInt32(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
lb_max_file_num = Service.convertUInt32(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
sel_vol_input = Service.convertUInt32(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
for (int i = 0; i < by.length; i++)
|
||||
{
|
||||
by[i] = (char)bArray[iStep];
|
||||
iStep++;
|
||||
}
|
||||
uStatus = Service.convertUInt16(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Short.SIZE / Byte.SIZE;
|
||||
crc = Service.convertUInt16(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Short.SIZE / Byte.SIZE;
|
||||
return true;
|
||||
}
|
||||
public final int GetStructBuf(RefObject<Byte[]> bArray, int nHaveRead)
|
||||
{
|
||||
int nSize = bArray.argvalue.length;
|
||||
if (nSize < (nHaveRead + GetSize()))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
int iStep = nHaveRead;
|
||||
|
||||
for (int i = 0; i < prj_name.length; i++)
|
||||
{
|
||||
bArray.argvalue[iStep] = (byte)prj_name[i];
|
||||
iStep++;
|
||||
}
|
||||
iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Integer)line_idx, Service.enum_Value_type.Value_uint);
|
||||
iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Float)un, Service.enum_Value_type.Value_float);
|
||||
iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Float)u_run, Service.enum_Value_type.Value_float);
|
||||
iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Float)pt_ratio, Service.enum_Value_type.Value_float);
|
||||
iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Float)ct_ratio, Service.enum_Value_type.Value_float);
|
||||
iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Float)fDL_Capability, Service.enum_Value_type.Value_float);
|
||||
iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Float)fJZ_Capability, Service.enum_Value_type.Value_float);
|
||||
iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Float)fSB_Capability, Service.enum_Value_type.Value_float);
|
||||
iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Float)fXY_Capability, Service.enum_Value_type.Value_float);
|
||||
iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Integer)vol_sel, Service.enum_Value_type.Value_uint);
|
||||
iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Integer)cur_sel, Service.enum_Value_type.Value_uint);
|
||||
iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Integer)sel_cur_input, Service.enum_Value_type.Value_uint);
|
||||
iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Integer)data_type, Service.enum_Value_type.Value_uint);
|
||||
iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Integer)stat_min_time, Service.enum_Value_type.Value_uint);
|
||||
iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Integer)min_max_file_size, Service.enum_Value_type.Value_uint);
|
||||
iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Integer)sec_max_file_size, Service.enum_Value_type.Value_uint);
|
||||
iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Integer)ms_max_file_size, Service.enum_Value_type.Value_uint);
|
||||
iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Integer)lb_max_file_size, Service.enum_Value_type.Value_uint);
|
||||
iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Integer)lb_max_file_num, Service.enum_Value_type.Value_uint);
|
||||
|
||||
iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Short)app_id_u, Service.enum_Value_type.Value_ushort);
|
||||
iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Short)app_id_i, Service.enum_Value_type.Value_ushort);
|
||||
for (int i = 0; i < mult_mac_u.length; i++)
|
||||
{
|
||||
bArray.argvalue[iStep] = mult_mac_u[i];
|
||||
iStep++;
|
||||
}
|
||||
for (int i = 0; i < mult_mac_i.length; i++)
|
||||
{
|
||||
bArray.argvalue[iStep] = mult_mac_i[i];
|
||||
iStep++;
|
||||
}
|
||||
iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Integer)smp_rate, Service.enum_Value_type.Value_int);
|
||||
for (int i = 0; i < link_cfg.length; i++)
|
||||
{
|
||||
iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Short)link_cfg[i], Service.enum_Value_type.Value_ushort);
|
||||
}
|
||||
iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Short)is_91_or_92, Service.enum_Value_type.Value_ushort);
|
||||
iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Short)dig_is_use, Service.enum_Value_type.Value_ushort);
|
||||
|
||||
iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Integer)sel_vol_input, Service.enum_Value_type.Value_uint);
|
||||
for (int i = 0; i < by.length; i++)
|
||||
{
|
||||
bArray.argvalue[iStep] = (byte)by[i];
|
||||
iStep++;
|
||||
}
|
||||
iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Short)uStatus, Service.enum_Value_type.Value_ushort);
|
||||
iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Short)crc, Service.enum_Value_type.Value_ushort);
|
||||
return GetSize();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.njcn.csharmonic.offline.mincfg.vo;
|
||||
|
||||
/**
|
||||
装置固化信息
|
||||
|
||||
*/
|
||||
public class pqv_dev_info_int
|
||||
{
|
||||
public byte[] dev_type = new byte[64]; //装置型号,如"PQV-520A"
|
||||
public byte[] soft_app_ver = new byte[64]; //装置程序版本,格式为"版本号:日期:校验码",如"V1.00:20230606:xxxx"。
|
||||
public byte[] MAC = new byte[6]; //装置有线网口MAC地址
|
||||
public byte[] line_num = new byte[1]; //检测点数目
|
||||
public byte[] max_prj_num = new byte[1]; //最大测量工程数 默认10
|
||||
public byte[] protocol_ver = new byte[16]; //通讯协议版本号
|
||||
public byte[] by = new byte[240]; //备用信息
|
||||
|
||||
public static int GetSize() //用于定义Byte数组
|
||||
{
|
||||
return 392;
|
||||
}
|
||||
public final boolean SetStructBuf(byte[] bArray, int nHaveRead)
|
||||
{
|
||||
int nByteSize = bArray.length;
|
||||
if (nByteSize < GetSize())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
int iStep = nHaveRead;
|
||||
|
||||
for (int i = 0; i < dev_type.length; i++)
|
||||
{
|
||||
dev_type[i] = bArray[iStep];
|
||||
iStep++;
|
||||
}
|
||||
for (int i = 0; i < soft_app_ver.length; i++)
|
||||
{
|
||||
soft_app_ver[i] = bArray[iStep];
|
||||
iStep++;
|
||||
}
|
||||
for (int i = 0; i < MAC.length; i++)
|
||||
{
|
||||
MAC[i] = bArray[iStep];
|
||||
iStep++;
|
||||
}
|
||||
for (int i = 0; i < line_num.length; i++)
|
||||
{
|
||||
line_num[i] = bArray[iStep];
|
||||
iStep++;
|
||||
}
|
||||
for (int i = 0; i < max_prj_num.length; i++)
|
||||
{
|
||||
max_prj_num[i] = bArray[iStep];
|
||||
iStep++;
|
||||
}
|
||||
for (int i = 0; i < protocol_ver.length; i++)
|
||||
{
|
||||
protocol_ver[i] = bArray[iStep];
|
||||
iStep++;
|
||||
}
|
||||
|
||||
for (int i = 0; i < by.length; i++)
|
||||
{
|
||||
by[i] = bArray[iStep];
|
||||
iStep++;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.njcn.csharmonic.offline.mincfg.vo;
|
||||
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
|
||||
///#region 报文解析格式
|
||||
/**
|
||||
装置固化信息
|
||||
|
||||
*/
|
||||
//C# TO JAVA CONVERTER WARNING: Java does not allow user-defined value types. The behavior of this class will differ from the original:
|
||||
//ORIGINAL LINE: public struct pqv_dev_info_int1
|
||||
public final class pqv_dev_info_int1
|
||||
{
|
||||
//C# TO JAVA CONVERTER TODO TASK: Java annotations will not correspond to .NET attributes:
|
||||
//[MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)]
|
||||
private char[] dev_type; //装置型号,如"PQV-520A"
|
||||
//C# TO JAVA CONVERTER TODO TASK: Java annotations will not correspond to .NET attributes:
|
||||
//[MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)]
|
||||
private char[] soft_app_ver; //装置程序版本,格式为"版本号:日期:校验码",如"V1.00:20230606:xxxx"。
|
||||
//C# TO JAVA CONVERTER TODO TASK: Java annotations will not correspond to .NET attributes:
|
||||
//[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
|
||||
private char[] MAC; //装置有线网口MAC地址
|
||||
//C# TO JAVA CONVERTER TODO TASK: Java annotations will not correspond to .NET attributes:
|
||||
//[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)]
|
||||
private char[] line_num; //检测点号
|
||||
//C# TO JAVA CONVERTER TODO TASK: Java annotations will not correspond to .NET attributes:
|
||||
//[MarshalAs(UnmanagedType.ByValArray, SizeConst = 257)]
|
||||
private char[] by; //备用信息
|
||||
@Override
|
||||
public pqv_dev_info_int1 clone()
|
||||
{
|
||||
pqv_dev_info_int1 varCopy = new pqv_dev_info_int1();
|
||||
|
||||
varCopy.dev_type = this.dev_type;
|
||||
varCopy.soft_app_ver = this.soft_app_ver;
|
||||
varCopy.MAC = this.MAC;
|
||||
varCopy.line_num = this.line_num;
|
||||
varCopy.by = this.by;
|
||||
|
||||
return varCopy;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.njcn.csharmonic.offline.mincfg.vo;
|
||||
|
||||
public class pqv_dev_info_run
|
||||
{
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: uint[] line_run_sts;
|
||||
private Integer[] line_run_sts; //各个监测点测试运行状态
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: uint[] line_cur_dir_idx;
|
||||
private Integer[] line_cur_dir_idx; //各个监测点当前存储数据文件目录序号1-10.只有记录运行状态时有效
|
||||
public static int GetSize(int count)
|
||||
{
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
int len = 2 * count * Integer.SIZE / Byte.SIZE;
|
||||
return len;
|
||||
}
|
||||
public pqv_dev_info_run(int count)
|
||||
{
|
||||
line_run_sts = new Integer[count];
|
||||
line_cur_dir_idx = new Integer[count];
|
||||
}
|
||||
public final boolean SetStructBuf(byte[] bArray, int nHaveRead, int count)
|
||||
{
|
||||
int nByteSize = bArray.length;
|
||||
if (nByteSize < GetSize(count))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
int iStep = nHaveRead;
|
||||
|
||||
RefObject<Integer[]> tempRef_line_run_sts = new RefObject<Integer[]>(line_run_sts);
|
||||
iStep += Service.convertUInt32Array(bArray, iStep, tempRef_line_run_sts);
|
||||
line_run_sts = tempRef_line_run_sts.argvalue;
|
||||
RefObject<Integer[]> tempRef_line_cur_dir_idx = new RefObject<Integer[]>(line_cur_dir_idx);
|
||||
iStep += Service.convertUInt32Array(bArray, iStep, tempRef_line_cur_dir_idx);
|
||||
line_cur_dir_idx = tempRef_line_cur_dir_idx.argvalue;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package com.njcn.csharmonic.offline.mincfg.vo;
|
||||
|
||||
/**
|
||||
工程数据文件信息
|
||||
|
||||
*/
|
||||
public class prj_record_info
|
||||
{
|
||||
public pqv_dev_info_int dev_info; //装置信息
|
||||
public cmn_mode_cfg cfg; //测试记录工程配置
|
||||
public prj_store_info store_mag; //存储管理缓冲
|
||||
public int tv_sec_s; //开始记录时间
|
||||
public int tv_sec_e; //结束记录时间
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public uint status;
|
||||
public int status; //测试工程数据是否有效标志
|
||||
|
||||
public prj_record_info()
|
||||
{
|
||||
dev_info = new pqv_dev_info_int();
|
||||
cfg = new cmn_mode_cfg();
|
||||
store_mag = new prj_store_info();
|
||||
}
|
||||
public static int GetSize() //用于定义Byte数组
|
||||
{
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
int nSize = 2 * Integer.SIZE / Byte.SIZE + 1 * Integer.SIZE / Byte.SIZE + pqv_dev_info_int.GetSize() + cmn_mode_cfg.GetSize() + prj_store_info.GetSize(); //CComtradeDataItem数据结构数据长度
|
||||
return nSize;
|
||||
}
|
||||
public final boolean SetStructBuf(byte[] bArray, int nHaveRead)
|
||||
{
|
||||
int nByteSize = bArray.length;
|
||||
if (nByteSize < GetSize())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
int iStep = nHaveRead;
|
||||
|
||||
dev_info.SetStructBuf(bArray, iStep);
|
||||
iStep = iStep + pqv_dev_info_int.GetSize();
|
||||
cfg.SetStructBuf(bArray, iStep);
|
||||
iStep = iStep + cmn_mode_cfg.GetSize();
|
||||
store_mag.SetStructBuf(bArray, iStep);
|
||||
iStep = iStep + prj_store_info.GetSize();
|
||||
tv_sec_s = Service.convertInt32_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
tv_sec_e = Service.convertInt32_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
status = Service.convertUInt32_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
return true;
|
||||
}
|
||||
|
||||
public final boolean SetStructBuf_net(byte[] bArray, int nHaveRead) //处理文件解析时 需要处理报文大小头
|
||||
{
|
||||
int nByteSize = bArray.length;
|
||||
if (nByteSize < GetSize())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
int iStep = nHaveRead;
|
||||
|
||||
dev_info.SetStructBuf(bArray, iStep);
|
||||
iStep = iStep + pqv_dev_info_int.GetSize();
|
||||
cfg.SetStructBuf_net(bArray, iStep);
|
||||
iStep = iStep + cmn_mode_cfg.GetSize();
|
||||
store_mag.SetStructBuf_net(bArray, iStep);
|
||||
iStep = iStep + prj_store_info.GetSize();
|
||||
tv_sec_s = Service.convertInt32(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
tv_sec_e = Service.convertInt32(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
status = Service.convertUInt32(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,300 @@
|
||||
package com.njcn.csharmonic.offline.mincfg.vo;
|
||||
|
||||
/**
|
||||
存储管理缓冲
|
||||
|
||||
*/
|
||||
public class prj_store_info
|
||||
{
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public uint ms_file_num;
|
||||
public int ms_file_num; //200ms数据文件个数
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public uint ms_file_size;
|
||||
public int ms_file_size; //200ms数据文件大小
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public uint sec_file_num;
|
||||
public int sec_file_num; //3s数据文件个数
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public uint sec_file_size;
|
||||
public int sec_file_size; //3s数据文件大小
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public uint min_file_num;
|
||||
public int min_file_num; //min数据文件个数
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public uint min_file_size;
|
||||
public int min_file_size; //min数据文件大小
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public uint lb_file_num;
|
||||
public int lb_file_num; //录波文件个数
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public uint lb_file_size;
|
||||
public int lb_file_size; //录波文件大小
|
||||
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public uint ms_file_on;
|
||||
public int ms_file_on; //200ms数据记录开关
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public uint sec_file_on;
|
||||
public int sec_file_on; //3s数据记录开关
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public uint min_file_on;
|
||||
public int min_file_on; //分钟数据记录开关
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public uint lb_file_on;
|
||||
public int lb_file_on; //录波数据记录开关
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public uint log_file_on;
|
||||
public int log_file_on; //日志数据记录开关
|
||||
|
||||
//大小限制,单位kb
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public uint max_ms_file_num;
|
||||
public int max_ms_file_num; //200ms数据文件个数
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public uint max_ms_file_size;
|
||||
public int max_ms_file_size; //200ms数据文件大小
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public uint max_sec_file_num;
|
||||
public int max_sec_file_num; //3s数据文件个数
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public uint max_sec_file_size;
|
||||
public int max_sec_file_size; //3s数据文件大小
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public uint max_min_file_num;
|
||||
public int max_min_file_num; //min数据文件个数
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public uint max_min_file_size;
|
||||
public int max_min_file_size; //min数据文件大小
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public uint max_lb_file_num;
|
||||
public int max_lb_file_num; //录波文件个数
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public uint max_lb_file_size;
|
||||
public int max_lb_file_size; //录波文件大小*(字节)
|
||||
|
||||
public byte[] path = new byte[32]; //32字节 文件存储全路径
|
||||
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public uint fg_file_num;
|
||||
public int fg_file_num; //风电光伏文件个数
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public uint fg_file_size;
|
||||
public int fg_file_size; //风电光伏文件大小(kB)
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public uint fg_file_on;
|
||||
public int fg_file_on; //风电光优数据记录开关
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public uint log_file_num;
|
||||
public int log_file_num; //日志文件个数
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public uint log_file_size;
|
||||
public int log_file_size; //日志文件大小
|
||||
public char[] by = new char[1016]; //1024个字节,留着后期扩展备用
|
||||
|
||||
public static int GetSize() //用于定义Byte数组
|
||||
{
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
int nSize = 26 * Integer.SIZE / Byte.SIZE + 32 + 1016; //数据结构数据长度
|
||||
return nSize;
|
||||
}
|
||||
public final boolean SetStructBuf(byte[] bArray, int nHaveRead)
|
||||
{
|
||||
int nByteSize = bArray.length;
|
||||
if (nByteSize < GetSize())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
int iStep = nHaveRead;
|
||||
|
||||
ms_file_num = Service.convertUInt32_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
ms_file_size = Service.convertUInt32_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
sec_file_num = Service.convertUInt32_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
sec_file_size = Service.convertUInt32_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
min_file_num = Service.convertUInt32_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
min_file_size = Service.convertUInt32_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
lb_file_num = Service.convertUInt32_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
lb_file_size = Service.convertUInt32_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
ms_file_on = Service.convertUInt32_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
sec_file_on = Service.convertUInt32_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
min_file_on = Service.convertUInt32_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
lb_file_on = Service.convertUInt32_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
log_file_on = Service.convertUInt32_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
max_ms_file_num = Service.convertUInt32_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
max_ms_file_size = Service.convertUInt32_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
max_sec_file_num = Service.convertUInt32_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
max_sec_file_size = Service.convertUInt32_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
max_min_file_num = Service.convertUInt32_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
max_min_file_size = Service.convertUInt32_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
max_lb_file_num = Service.convertUInt32_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
max_lb_file_size = Service.convertUInt32_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
for (int i = 0; i < path.length; i++)
|
||||
{
|
||||
path[i] = bArray[iStep];
|
||||
iStep++;
|
||||
}
|
||||
fg_file_num = Service.convertUInt32_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
fg_file_size = Service.convertUInt32_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
fg_file_on = Service.convertUInt32_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
log_file_num = Service.convertUInt32_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
log_file_size = Service.convertUInt32_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
for (int i = 0; i < by.length; i++)
|
||||
{
|
||||
by[i] = (char)bArray[iStep];
|
||||
iStep++;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public final boolean SetStructBuf_net(byte[] bArray, int nHaveRead) //处理文件大小头
|
||||
{
|
||||
int nByteSize = bArray.length;
|
||||
if (nByteSize < GetSize())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
int iStep = nHaveRead;
|
||||
|
||||
ms_file_num = Service.convertUInt32(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
ms_file_size = Service.convertUInt32(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
sec_file_num = Service.convertUInt32(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
sec_file_size = Service.convertUInt32(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
min_file_num = Service.convertUInt32(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
min_file_size = Service.convertUInt32(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
lb_file_num = Service.convertUInt32(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
lb_file_size = Service.convertUInt32(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
ms_file_on = Service.convertUInt32(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
sec_file_on = Service.convertUInt32(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
min_file_on = Service.convertUInt32(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
lb_file_on = Service.convertUInt32(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
log_file_on = Service.convertUInt32(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
max_ms_file_num = Service.convertUInt32(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
max_ms_file_size = Service.convertUInt32(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
max_sec_file_num = Service.convertUInt32(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
max_sec_file_size = Service.convertUInt32(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
max_min_file_num = Service.convertUInt32(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
max_min_file_size = Service.convertUInt32(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
max_lb_file_num = Service.convertUInt32(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
max_lb_file_size = Service.convertUInt32(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
|
||||
for (int i = 0; i < path.length; i++)
|
||||
{
|
||||
path[i] = bArray[iStep];
|
||||
iStep++;
|
||||
}
|
||||
fg_file_num = Service.convertUInt32_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
fg_file_size = Service.convertUInt32_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
fg_file_on = Service.convertUInt32_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
log_file_num = Service.convertUInt32_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
log_file_size = Service.convertUInt32_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
for (int i = 0; i < by.length; i++)
|
||||
{
|
||||
by[i] = (char)bArray[iStep];
|
||||
iStep++;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.njcn.csharmonic.offline.mincfg.vo;
|
||||
|
||||
//间谐波的幅值和频率结构
|
||||
public class tagInHarmData
|
||||
{
|
||||
public int Val;
|
||||
public int f;
|
||||
|
||||
public static int GetSize()
|
||||
{
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
return 2 * Integer.SIZE / Byte.SIZE;
|
||||
}
|
||||
|
||||
public final boolean SetStructBuf(byte[] bArray, int nHaveRead)
|
||||
{
|
||||
int nByteSize = bArray.length;
|
||||
if (nByteSize < GetSize())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int iStep = nHaveRead;
|
||||
|
||||
Val = Service.convertInt32_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
f = Service.convertInt32_net(bArray, iStep);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@brief 将类中的变量组装成byte[]二进制流
|
||||
@return byte[] out 二进制数组
|
||||
|
||||
*/
|
||||
public final int GetStructBuf(RefObject<Byte[]> bArray, int nHaveRead)
|
||||
{
|
||||
int nSize = bArray.argvalue.length;
|
||||
if (nSize < (nHaveRead + GetSize()))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
int iStep = nHaveRead;
|
||||
iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Integer)Val, Service.enum_Value_type.Value_int);
|
||||
iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Integer)f, Service.enum_Value_type.Value_int);
|
||||
|
||||
return GetSize();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.njcn.csharmonic.offline.mincfg.vo;
|
||||
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: //波动闪变
|
||||
///#endregion
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
|
||||
///#region 浮点数据结构
|
||||
|
||||
public class tagInHarmData_float
|
||||
{
|
||||
public float Val;
|
||||
public float f;
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
package com.njcn.csharmonic.offline.mincfg.vo;
|
||||
|
||||
//新版 3秒,分钟统计结构
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class tagPQDataCmn
|
||||
{
|
||||
public short name; ///监测点号 12 /// </summary>
|
||||
public short Data_Type; ///数据类型 2 /// </summary>
|
||||
public int DataTag; // 标记 1:暂态标记 2:无效数据
|
||||
public RTC_Timer_MS time; ///时间 /// </summary>
|
||||
public Float[] Rms; ///电压A B C 电流A B C 线电压AB BC CA/// </summary>
|
||||
public Float[] UU_Deviation; ///电压上偏差相电压abc,线电压AB BC CA /// </summary>
|
||||
public Float[] UL_Deviation; ///电压下偏差相电压abc,线电压AB BC CA/// </summary>
|
||||
public Float[] F_Deviation; ///频率偏差 8 /// </summary>
|
||||
public Float[][] UI_Seq; ///电压电流零、正、负序、不平衡度32 第一个[]电压,电流;第二个[]零、正、负序、不平衡度/// </summary>
|
||||
public Float[][] FuHarm; ///整次谐波 电压A B C N 电流A B C N 1200 /// </summary>
|
||||
public Float[][] FuHarmPhase; ///谐波相角-送一半数据 600 /// </summary>
|
||||
public Float[][] InHarm; ///间谐波-送一半数据 1200 /// </summary>
|
||||
public Float[][] Total_Power; ///a,b,c,total 总功率(P.Q.S) 48 /// </summary>
|
||||
public Float[][][] Harm_Power; ///谐波功率-送一半数据 1200 /// </summary>
|
||||
public Float[][] Harm_Contain; ///谐波含有率 xxx.xx 600 /// </summary>
|
||||
public Float[] Harm_Aberrance; ///谐波畸变率 xxx.xx 12 /// </summary>
|
||||
public Float[] Cos_PF; ///视在功率因数 =P/S xx.xxx 8 /// </summary>
|
||||
public Float[] Cos_DF; ///位移功率因数=P/S1 xx.xxx 8 /// </summary>
|
||||
public Float[] U_Fluctuation; ///电压波动 xx.xxx 6 /// </summary>
|
||||
public Float[] U_Flicker; ///电压闪变 xx.xxx 6 /// </summary>
|
||||
public Float[] UL_Flicker; ///电压长闪变 xx.xxx 6 /// </summary>
|
||||
public static int GetSize()
|
||||
{
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
int nLen = RTC_Timer_MS.GetSize() + 1 * Integer.SIZE / Byte.SIZE + 2 * Short.SIZE / Byte.SIZE + 1866 * Float.SIZE / Byte.SIZE;
|
||||
return nLen;
|
||||
}
|
||||
public tagPQDataCmn()
|
||||
{
|
||||
time = new RTC_Timer_MS();
|
||||
Rms = new Float[9];
|
||||
UU_Deviation = new Float[6];
|
||||
UL_Deviation = new Float[6];
|
||||
F_Deviation = new Float[2];
|
||||
UI_Seq = new Float[2][4];
|
||||
FuHarm = new Float[6][50];
|
||||
FuHarmPhase = new Float[6][50];
|
||||
InHarm = new Float[6][50];
|
||||
Total_Power = new Float[4][3];
|
||||
Harm_Power = new Float[4][50][3];
|
||||
Harm_Contain = new Float[6][50];
|
||||
Harm_Aberrance = new Float[6];
|
||||
Cos_PF = new Float[4];
|
||||
Cos_DF = new Float[4];
|
||||
U_Fluctuation = new Float[3];
|
||||
U_Flicker = new Float[3];
|
||||
UL_Flicker = new Float[3];
|
||||
}
|
||||
public final boolean SetStructBuf(byte[] bArray, int nHaveRead)
|
||||
{
|
||||
int nSize = bArray.length;
|
||||
int nStep = nHaveRead; //读取数据的步长
|
||||
|
||||
if (nSize < (GetSize() + nHaveRead))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
name = Service.convertInt16_net(bArray, nStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
nStep += Short.SIZE / Byte.SIZE;
|
||||
Data_Type = Service.convertInt16_net(bArray, nStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
nStep += Short.SIZE / Byte.SIZE;
|
||||
DataTag = Service.convertInt32_net(bArray, nStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
nStep += Integer.SIZE / Byte.SIZE;
|
||||
time.SetStructBuf(bArray, nStep);
|
||||
nStep += RTC_Timer_MS.GetSize();
|
||||
RefObject<Float[]> tempRef_Rms = new RefObject<Float[]>(Rms);
|
||||
nStep += Service.convertFloatArraySingle(bArray, nStep, tempRef_Rms);
|
||||
Rms = tempRef_Rms.argvalue;
|
||||
RefObject<Float[]> tempRef_UU_Deviation = new RefObject<Float[]>(UU_Deviation);
|
||||
nStep += Service.convertFloatArraySingle(bArray, nStep, tempRef_UU_Deviation);
|
||||
UU_Deviation = tempRef_UU_Deviation.argvalue;
|
||||
RefObject<Float[]> tempRef_UL_Deviation = new RefObject<Float[]>(UL_Deviation);
|
||||
nStep += Service.convertFloatArraySingle(bArray, nStep, tempRef_UL_Deviation);
|
||||
UL_Deviation = tempRef_UL_Deviation.argvalue;
|
||||
RefObject<Float[]> tempRef_F_Deviation = new RefObject<Float[]>(F_Deviation);
|
||||
nStep += Service.convertFloatArraySingle(bArray, nStep, tempRef_F_Deviation);
|
||||
F_Deviation = tempRef_F_Deviation.argvalue;
|
||||
RefObject<Float[][]> tempRef_UI_Seq = new RefObject<Float[][]>(UI_Seq);
|
||||
nStep += Service.convertFloatArrayTwo(bArray, nStep, tempRef_UI_Seq);
|
||||
UI_Seq = tempRef_UI_Seq.argvalue;
|
||||
RefObject<Float[][]> tempRef_FuHarm = new RefObject<Float[][]>(FuHarm);
|
||||
nStep += Service.convertFloatArrayTwo(bArray, nStep, tempRef_FuHarm);
|
||||
FuHarm = tempRef_FuHarm.argvalue;
|
||||
RefObject<Float[][]> tempRef_FuHarmPhase = new RefObject<Float[][]>(FuHarmPhase);
|
||||
nStep += Service.convertFloatArrayTwo(bArray, nStep, tempRef_FuHarmPhase);
|
||||
FuHarmPhase = tempRef_FuHarmPhase.argvalue;
|
||||
RefObject<Float[][]> tempRef_InHarm = new RefObject<Float[][]>(InHarm);
|
||||
nStep += Service.convertFloatArrayTwo(bArray, nStep, tempRef_InHarm);
|
||||
InHarm = tempRef_InHarm.argvalue;
|
||||
RefObject<Float[][]> tempRef_Total_Power = new RefObject<Float[][]>(Total_Power);
|
||||
nStep += Service.convertFloatArrayTwo(bArray, nStep, tempRef_Total_Power);
|
||||
Total_Power = tempRef_Total_Power.argvalue;
|
||||
RefObject<Float[][][]> tempRef_Harm_Power = new RefObject<Float[][][]>(Harm_Power);
|
||||
nStep += Service.convertFloatArrayThree(bArray, nStep, tempRef_Harm_Power);
|
||||
Harm_Power = tempRef_Harm_Power.argvalue;
|
||||
RefObject<Float[][]> tempRef_Harm_Contain = new RefObject<Float[][]>(Harm_Contain);
|
||||
nStep += Service.convertFloatArrayTwo(bArray, nStep, tempRef_Harm_Contain);
|
||||
Harm_Contain = tempRef_Harm_Contain.argvalue;
|
||||
RefObject<Float[]> tempRef_Harm_Aberrance = new RefObject<Float[]>(Harm_Aberrance);
|
||||
nStep += Service.convertFloatArraySingle(bArray, nStep, tempRef_Harm_Aberrance);
|
||||
Harm_Aberrance = tempRef_Harm_Aberrance.argvalue;
|
||||
RefObject<Float[]> tempRef_Cos_PF = new RefObject<Float[]>(Cos_PF);
|
||||
nStep += Service.convertFloatArraySingle(bArray, nStep, tempRef_Cos_PF);
|
||||
Cos_PF = tempRef_Cos_PF.argvalue;
|
||||
RefObject<Float[]> tempRef_Cos_DF = new RefObject<Float[]>(Cos_DF);
|
||||
nStep += Service.convertFloatArraySingle(bArray, nStep, tempRef_Cos_DF);
|
||||
Cos_DF = tempRef_Cos_DF.argvalue;
|
||||
RefObject<Float[]> tempRef_U_Fluctuation = new RefObject<Float[]>(U_Fluctuation);
|
||||
nStep += Service.convertFloatArraySingle(bArray, nStep, tempRef_U_Fluctuation);
|
||||
U_Fluctuation = tempRef_U_Fluctuation.argvalue;
|
||||
RefObject<Float[]> tempRef_U_Flicker = new RefObject<Float[]>(U_Flicker);
|
||||
nStep += Service.convertFloatArraySingle(bArray, nStep, tempRef_U_Flicker);
|
||||
U_Flicker = tempRef_U_Flicker.argvalue;
|
||||
RefObject<Float[]> tempRef_UL_Flicker = new RefObject<Float[]>(UL_Flicker);
|
||||
nStep += Service.convertFloatArraySingle(bArray, nStep, tempRef_UL_Flicker);
|
||||
UL_Flicker = tempRef_UL_Flicker.argvalue;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
package com.njcn.csharmonic.offline.mincfg.vo;
|
||||
|
||||
public class tagPQDataCmnHh //高频谐波结构
|
||||
{
|
||||
private short name; //监测点序号 2
|
||||
private short Data_Type; //数据类型 2
|
||||
public int DataTag; // 标记 1:暂态标记 2:无效数据
|
||||
public RTC_Timer_MS time; // 时标
|
||||
//2-9k谐波 2.1kHz / 2.3kHZ … 8.9kHz
|
||||
public Float[][] Hharm_rms_list_2_9K; //6-35 谐波有效值序列(Uabc/Iabc)
|
||||
public Float[][] Hharm_thd_list_2_9K; //6-35 谐波含有率序列
|
||||
public Float[] Hharm_total_rms_2_9K; //6 谐波总有效值
|
||||
public Float[] Hharm_total_thd_2_9K; //6 谐波总畸变率
|
||||
public Float[] Hharm_max_rms_2_9K; //6 谐波最大有效值
|
||||
public Float[] Hharm_max_thd_2_9K; //6 谐波最大畸变率
|
||||
public Float[] Hharm_max_freq_2_9K; //6 谐波最大值频点
|
||||
//2-150k谐波 2kHz / 4kHz … 150kHz
|
||||
public Float[][] Hharm_rms_list_2_150K; //6-75 谐波有效值序列(2-150)
|
||||
public Float[][] Hharm_thd_list_2_150K; //6-75 谐波含有率序列
|
||||
public Float[] Hharm_total_rms_2_150K; //6 谐波总有效值
|
||||
public Float[] Hharm_total_thd_2_150K; //6 谐波总畸变率
|
||||
public Float[] Hharm_max_rms_2_150K; //6 谐波最大有效值
|
||||
public Float[] Hharm_max_thd_2_150K; //6 谐波最大畸变率
|
||||
public Float[] Hharm_max_freq_2_150K; //6 谐波最大值频点
|
||||
public static int GetSize()
|
||||
{
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
int len = RTC_Timer_MS.GetSize() + 2 * Short.SIZE / Byte.SIZE + 1 * Integer.SIZE / Byte.SIZE + 6 * 35 * 2 * Float.SIZE / Byte.SIZE+ 6 * 75 * 2 * Float.SIZE / Byte.SIZE+ 6 * 10 * Float.SIZE / Byte.SIZE;
|
||||
return len;
|
||||
}
|
||||
public tagPQDataCmnHh()
|
||||
{
|
||||
time = new RTC_Timer_MS();
|
||||
Hharm_rms_list_2_9K = new Float[6][35];
|
||||
Hharm_thd_list_2_9K = new Float[6][35];
|
||||
Hharm_total_rms_2_9K = new Float[6];
|
||||
Hharm_total_thd_2_9K = new Float[6];
|
||||
Hharm_max_rms_2_9K = new Float[6];
|
||||
Hharm_max_thd_2_9K = new Float[6];
|
||||
Hharm_max_freq_2_9K = new Float[6];
|
||||
Hharm_rms_list_2_150K = new Float[6][75];
|
||||
Hharm_thd_list_2_150K = new Float[6][75];
|
||||
Hharm_total_rms_2_150K = new Float[6];
|
||||
Hharm_total_thd_2_150K = new Float[6];
|
||||
Hharm_max_rms_2_150K = new Float[6];
|
||||
Hharm_max_thd_2_150K = new Float[6];
|
||||
Hharm_max_freq_2_150K = new Float[6];
|
||||
}
|
||||
public final boolean SetStructBuf(byte[] bArray, int nHaveRead)
|
||||
{
|
||||
int nByteSize = bArray.length;
|
||||
//int size = GetSize();
|
||||
if (nByteSize < GetSize())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int iStep = nHaveRead;
|
||||
name = Service.convertInt16_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Short.SIZE / Byte.SIZE;
|
||||
Data_Type = Service.convertInt16_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Short.SIZE / Byte.SIZE;
|
||||
DataTag = Service.convertInt32_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
time.SetStructBuf(bArray, iStep);
|
||||
iStep += RTC_Timer_MS.GetSize();
|
||||
|
||||
RefObject<Float[][]> tempRef_Hharm_rms_list_2_9K = new RefObject<Float[][]>(Hharm_rms_list_2_9K);
|
||||
iStep += Service.convertFloatArrayTwo(bArray, iStep, tempRef_Hharm_rms_list_2_9K);
|
||||
Hharm_rms_list_2_9K = tempRef_Hharm_rms_list_2_9K.argvalue;
|
||||
RefObject<Float[][]> tempRef_Hharm_thd_list_2_9K = new RefObject<Float[][]>(Hharm_thd_list_2_9K);
|
||||
iStep += Service.convertFloatArrayTwo(bArray, iStep, tempRef_Hharm_thd_list_2_9K);
|
||||
Hharm_thd_list_2_9K = tempRef_Hharm_thd_list_2_9K.argvalue;
|
||||
RefObject<Float[]> tempRef_Hharm_total_rms_2_9K = new RefObject<Float[]>(Hharm_total_rms_2_9K);
|
||||
iStep += Service.convertFloatArraySingle(bArray, iStep, tempRef_Hharm_total_rms_2_9K);
|
||||
Hharm_total_rms_2_9K = tempRef_Hharm_total_rms_2_9K.argvalue;
|
||||
RefObject<Float[]> tempRef_Hharm_total_thd_2_9K = new RefObject<Float[]>(Hharm_total_thd_2_9K);
|
||||
iStep += Service.convertFloatArraySingle(bArray, iStep, tempRef_Hharm_total_thd_2_9K);
|
||||
Hharm_total_thd_2_9K = tempRef_Hharm_total_thd_2_9K.argvalue;
|
||||
RefObject<Float[]> tempRef_Hharm_max_rms_2_9K = new RefObject<Float[]>(Hharm_max_rms_2_9K);
|
||||
iStep += Service.convertFloatArraySingle(bArray, iStep, tempRef_Hharm_max_rms_2_9K);
|
||||
Hharm_max_rms_2_9K = tempRef_Hharm_max_rms_2_9K.argvalue;
|
||||
RefObject<Float[]> tempRef_Hharm_max_thd_2_9K = new RefObject<Float[]>(Hharm_max_thd_2_9K);
|
||||
iStep += Service.convertFloatArraySingle(bArray, iStep, tempRef_Hharm_max_thd_2_9K);
|
||||
Hharm_max_thd_2_9K = tempRef_Hharm_max_thd_2_9K.argvalue;
|
||||
RefObject<Float[]> tempRef_Hharm_max_freq_2_9K = new RefObject<Float[]>(Hharm_max_freq_2_9K);
|
||||
iStep += Service.convertFloatArraySingle(bArray, iStep, tempRef_Hharm_max_freq_2_9K);
|
||||
Hharm_max_freq_2_9K = tempRef_Hharm_max_freq_2_9K.argvalue;
|
||||
RefObject<Float[][]> tempRef_Hharm_rms_list_2_150K = new RefObject<Float[][]>(Hharm_rms_list_2_150K);
|
||||
iStep += Service.convertFloatArrayTwo(bArray, iStep, tempRef_Hharm_rms_list_2_150K);
|
||||
Hharm_rms_list_2_150K = tempRef_Hharm_rms_list_2_150K.argvalue;
|
||||
RefObject<Float[][]> tempRef_Hharm_thd_list_2_150K = new RefObject<Float[][]>(Hharm_thd_list_2_150K);
|
||||
iStep += Service.convertFloatArrayTwo(bArray, iStep, tempRef_Hharm_thd_list_2_150K);
|
||||
Hharm_thd_list_2_150K = tempRef_Hharm_thd_list_2_150K.argvalue;
|
||||
RefObject<Float[]> tempRef_Hharm_total_rms_2_150K = new RefObject<Float[]>(Hharm_total_rms_2_150K);
|
||||
iStep += Service.convertFloatArraySingle(bArray, iStep, tempRef_Hharm_total_rms_2_150K);
|
||||
Hharm_total_rms_2_150K = tempRef_Hharm_total_rms_2_150K.argvalue;
|
||||
RefObject<Float[]> tempRef_Hharm_total_thd_2_150K = new RefObject<Float[]>(Hharm_total_thd_2_150K);
|
||||
iStep += Service.convertFloatArraySingle(bArray, iStep, tempRef_Hharm_total_thd_2_150K);
|
||||
Hharm_total_thd_2_150K = tempRef_Hharm_total_thd_2_150K.argvalue;
|
||||
RefObject<Float[]> tempRef_Hharm_max_rms_2_150K = new RefObject<Float[]>(Hharm_max_rms_2_150K);
|
||||
iStep += Service.convertFloatArraySingle(bArray, iStep, tempRef_Hharm_max_rms_2_150K);
|
||||
Hharm_max_rms_2_150K = tempRef_Hharm_max_rms_2_150K.argvalue;
|
||||
RefObject<Float[]> tempRef_Hharm_max_thd_2_150K = new RefObject<Float[]>(Hharm_max_thd_2_150K);
|
||||
iStep += Service.convertFloatArraySingle(bArray, iStep, tempRef_Hharm_max_thd_2_150K);
|
||||
Hharm_max_thd_2_150K = tempRef_Hharm_max_thd_2_150K.argvalue;
|
||||
RefObject<Float[]> tempRef_Hharm_max_freq_2_150K = new RefObject<Float[]>(Hharm_max_freq_2_150K);
|
||||
iStep += Service.convertFloatArraySingle(bArray, iStep, tempRef_Hharm_max_freq_2_150K);
|
||||
Hharm_max_freq_2_150K = tempRef_Hharm_max_freq_2_150K.argvalue;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
//高频谐波结构
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
|
||||
///#endregion
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.njcn.csharmonic.offline.mincfg.vo;
|
||||
|
||||
//功率结构
|
||||
public class tagPowerData
|
||||
{
|
||||
public int P;
|
||||
public int Q;
|
||||
public int S;
|
||||
|
||||
public static int GetSize()
|
||||
{
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
return 3 * Integer.SIZE / Byte.SIZE;
|
||||
}
|
||||
|
||||
public final boolean SetStructBuf(byte[] bArray, int nHaveRead)
|
||||
{
|
||||
int nByteSize = bArray.length;
|
||||
if (nByteSize < GetSize())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int iStep = nHaveRead;
|
||||
|
||||
P = Service.convertInt32_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
Q = Service.convertInt32_net(bArray, iStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
iStep += Integer.SIZE / Byte.SIZE;
|
||||
S = Service.convertInt32_net(bArray, iStep);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@brief 将类中的变量组装成byte[]二进制流
|
||||
@return byte[] out 二进制数组
|
||||
|
||||
*/
|
||||
public final int GetStructBuf(RefObject<Byte[]> bArray, int nHaveRead)
|
||||
{
|
||||
int nSize = bArray.argvalue.length;
|
||||
if (nSize < (nHaveRead + GetSize()))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
int iStep = nHaveRead;
|
||||
iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Integer)P, Service.enum_Value_type.Value_int);
|
||||
iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Integer)Q, Service.enum_Value_type.Value_int);
|
||||
iStep += Service.AddObjectToByteArray_net(bArray, iStep, (Object)(Integer)S, Service.enum_Value_type.Value_int);
|
||||
|
||||
return GetSize();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.njcn.csharmonic.offline.mincfg.vo;
|
||||
|
||||
public class tagPowerData_float
|
||||
{
|
||||
public float P;
|
||||
public float Q;
|
||||
public float S;
|
||||
}
|
||||
@@ -0,0 +1,211 @@
|
||||
package com.njcn.csharmonic.offline.mincfg.vo;
|
||||
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
|
||||
///#endregion
|
||||
|
||||
/**
|
||||
@brief 3秒、分钟统计数据、日统计单个类型结构
|
||||
|
||||
*/
|
||||
public class tagPqData
|
||||
{
|
||||
public short name; ///监测点号 12 /// </summary>
|
||||
public short Data_Type; ///数据类型 2 /// </summary>
|
||||
public RTC_Timer time; ///时间 /// </summary>
|
||||
public Integer[] Rms; ///电压A B C N 电流A B C N 线电压AB BC CA/// </summary>
|
||||
public Integer[] UU_Deviation; ///电压上偏差(3线电压)24 /// </summary>
|
||||
public Integer[] UL_Deviation; ///电压下偏差/// </summary>
|
||||
public Integer[] F_Deviation; ///频率偏差 8 /// </summary>
|
||||
public Integer[][] UI_Seq; ///电压电流零、正、负序、不平衡度32 第一个[]电压,电流;第二个[]零、正、负序、不平衡度/// </summary>
|
||||
public Integer[][] FuHarm; ///整次谐波 电压A B C N 电流A B C N 1200 /// </summary>
|
||||
public Integer[][] FuHarmPhase; ///谐波相角-送一半数据 600 /// </summary>
|
||||
public tagInHarmData[][] InHarm; ///间谐波-送一半数据 1200 /// </summary>
|
||||
public Integer[][] Total_Power; ///a,b,c,total 总功率(P.Q.S) 48 /// </summary>
|
||||
public tagPowerData[][] Harm_Power; ///谐波功率-送一半数据 1200 /// </summary>
|
||||
public Short[][] Harm_Contain; ///谐波含有率 xxx.xx 600 /// </summary>
|
||||
public Short[] Harm_Aberrance; ///谐波畸变率 xxx.xx 12 /// </summary>
|
||||
public Short[] Cos_PF; ///视在功率因数 =P/S xx.xxx 8 /// </summary>
|
||||
public Short[] Cos_DF; ///位移功率因数=P/S1 xx.xxx 8 /// </summary>
|
||||
public Short[] U_Fluctuation; ///电压波动 xx.xxx 6 /// </summary>
|
||||
public Short[] U_Flicker; ///电压闪变 xx.xxx 6 /// </summary>
|
||||
public Short[] UL_Flicker; ///电压长闪变 xx.xxx 6 /// </summary>
|
||||
|
||||
public tagPqData()
|
||||
{
|
||||
int i = 0, j = 0;
|
||||
|
||||
time = new RTC_Timer();
|
||||
Rms = new Integer[9];
|
||||
UU_Deviation = new Integer[6];
|
||||
UL_Deviation = new Integer[6];
|
||||
F_Deviation = new Integer[2];
|
||||
UI_Seq = new Integer[2][4];
|
||||
FuHarm = new Integer[6][50];
|
||||
FuHarmPhase = new Integer[6][50];
|
||||
InHarm = new tagInHarmData[6][50];
|
||||
for (i = 0; i < 6; i++)
|
||||
{
|
||||
for (j = 0; j < 50; j++)
|
||||
{
|
||||
InHarm[i][j] = new tagInHarmData();
|
||||
}
|
||||
}
|
||||
Total_Power = new Integer[4][3];
|
||||
Harm_Power = new tagPowerData[4][50];
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
for (j = 0; j < 50; j++)
|
||||
{
|
||||
Harm_Power[i][j] = new tagPowerData();
|
||||
}
|
||||
}
|
||||
Harm_Contain = new Short[6][50];
|
||||
Harm_Aberrance = new Short[6];
|
||||
Cos_PF = new Short[4];
|
||||
Cos_DF = new Short[4];
|
||||
U_Fluctuation = new Short[3];
|
||||
U_Flicker = new Short[3];
|
||||
UL_Flicker = new Short[3];
|
||||
}
|
||||
/**
|
||||
@brief 读取类的长度
|
||||
@return int out 类的长度
|
||||
|
||||
*/
|
||||
public static int GetSize()
|
||||
{
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
int nLen = RTC_Timer.GetSize() + (9 + 6 + 6 + 2 + 8 + 300 + 300 + 12) * Integer.SIZE / Byte.SIZE + 300 * tagInHarmData.GetSize() + 200 * tagPowerData.GetSize() + (300 + 6 + 4 + 4 + 3 + 3 + 3 + 2) * Short.SIZE / Byte.SIZE;
|
||||
|
||||
return nLen + 2; //2字节补齐
|
||||
}
|
||||
/**
|
||||
@brief 将通讯或者文件读取的二进制流写入到类中
|
||||
@return int out 类的长度
|
||||
|
||||
*/
|
||||
public final boolean GetStructBuf(RefObject<Byte[]> bArray, int nHaveRead)
|
||||
{
|
||||
int nSize = bArray.argvalue.length;
|
||||
int nStep = nHaveRead; //读取数据的步长
|
||||
|
||||
if (nSize < (GetSize() + nHaveRead))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
nStep += Service.AddObjectToByteArray_net(bArray, nStep, (Object)(Short)name, Service.enum_Value_type.Value_short);
|
||||
|
||||
nStep += Service.AddObjectToByteArray_net(bArray, nStep, (Object)(Short)Data_Type, Service.enum_Value_type.Value_short);
|
||||
|
||||
time.GetStructBuf(bArray, nStep);
|
||||
nStep += RTC_Timer.GetSize();
|
||||
|
||||
nStep += Service.AddObjectToByteArray_net(bArray, nStep, (Object)(Integer)Rms[0], Service.enum_Value_type.Value_int);
|
||||
nStep += Service.AddObjectToByteArray_net(bArray, nStep, (Object)(Integer)Rms[1], Service.enum_Value_type.Value_int);
|
||||
nStep += Service.AddObjectToByteArray_net(bArray, nStep, (Object)(Integer)Rms[2], Service.enum_Value_type.Value_int);
|
||||
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
@brief 将通讯或者文件读取的二进制流写入到类中
|
||||
@return int out 类的长度
|
||||
|
||||
*/
|
||||
public final boolean SetStructBuf(byte[] bArray, int nHaveRead)
|
||||
{
|
||||
int i = 0, j = 0;
|
||||
int nSize = bArray.length;
|
||||
int nStep = nHaveRead; //读取数据的步长
|
||||
|
||||
if (nSize < (GetSize() + nHaveRead))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
name = Service.convertInt16_net(bArray, nStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
nStep += Short.SIZE / Byte.SIZE;
|
||||
|
||||
Data_Type = Service.convertInt16_net(bArray, nStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
nStep += Short.SIZE / Byte.SIZE;
|
||||
|
||||
time.SetStructBuf(bArray, nStep);
|
||||
nStep += RTC_Timer.GetSize();
|
||||
|
||||
RefObject<Integer[]> tempRef_Rms = new RefObject<Integer[]>(Rms);
|
||||
nStep += Service.convertInt32ArraySigle(bArray, nStep, tempRef_Rms);
|
||||
Rms = tempRef_Rms.argvalue;
|
||||
RefObject<Integer[]> tempRef_UU_Deviation = new RefObject<Integer[]>(UU_Deviation);
|
||||
nStep += Service.convertInt32ArraySigle(bArray, nStep, tempRef_UU_Deviation);
|
||||
UU_Deviation = tempRef_UU_Deviation.argvalue;
|
||||
RefObject<Integer[]> tempRef_UL_Deviation = new RefObject<Integer[]>(UL_Deviation);
|
||||
nStep += Service.convertInt32ArraySigle(bArray, nStep, tempRef_UL_Deviation);
|
||||
UL_Deviation = tempRef_UL_Deviation.argvalue;
|
||||
RefObject<Integer[]> tempRef_F_Deviation = new RefObject<Integer[]>(F_Deviation);
|
||||
nStep += Service.convertInt32ArraySigle(bArray, nStep, tempRef_F_Deviation);
|
||||
F_Deviation = tempRef_F_Deviation.argvalue;
|
||||
RefObject<Integer[][]> tempRef_UI_Seq = new RefObject<Integer[][]>(UI_Seq);
|
||||
nStep += Service.convertInt32Array(bArray, nStep, tempRef_UI_Seq);
|
||||
UI_Seq = tempRef_UI_Seq.argvalue;
|
||||
RefObject<Integer[][]> tempRef_FuHarm = new RefObject<Integer[][]>(FuHarm);
|
||||
nStep += Service.convertInt32Array(bArray, nStep, tempRef_FuHarm);
|
||||
FuHarm = tempRef_FuHarm.argvalue;
|
||||
RefObject<Integer[][]> tempRef_FuHarmPhase = new RefObject<Integer[][]>(FuHarmPhase);
|
||||
nStep += Service.convertInt32Array(bArray, nStep, tempRef_FuHarmPhase);
|
||||
FuHarmPhase = tempRef_FuHarmPhase.argvalue;
|
||||
|
||||
for (i = 0; i < 6; i++)
|
||||
{
|
||||
for (j = 0; j < 50; j++)
|
||||
{
|
||||
InHarm[i][j].Val = Service.convertInt32_net(bArray, nStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
nStep += Integer.SIZE / Byte.SIZE;
|
||||
InHarm[i][j].f = Service.convertInt32_net(bArray, nStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
nStep += Integer.SIZE / Byte.SIZE;
|
||||
}
|
||||
}
|
||||
RefObject<Integer[][]> tempRef_Total_Power = new RefObject<Integer[][]>(Total_Power);
|
||||
nStep += Service.convertInt32Array(bArray, nStep, tempRef_Total_Power);
|
||||
Total_Power = tempRef_Total_Power.argvalue;
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
for (j = 0; j < 50; j++)
|
||||
{
|
||||
Harm_Power[i][j].P = Service.convertInt32_net(bArray, nStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
nStep += Integer.SIZE / Byte.SIZE;
|
||||
Harm_Power[i][j].Q = Service.convertInt32_net(bArray, nStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
nStep += Integer.SIZE / Byte.SIZE;
|
||||
Harm_Power[i][j].S = Service.convertInt32_net(bArray, nStep);
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
nStep += Integer.SIZE / Byte.SIZE;
|
||||
}
|
||||
}
|
||||
RefObject<Short[][]> tempRef_Harm_Contain = new RefObject<Short[][]>(Harm_Contain);
|
||||
nStep += Service.convertInt16Array(bArray, nStep, tempRef_Harm_Contain);
|
||||
Harm_Contain = tempRef_Harm_Contain.argvalue;
|
||||
RefObject<Short[]> tempRef_Harm_Aberrance = new RefObject<Short[]>(Harm_Aberrance);
|
||||
nStep += Service.convertInt16ArraySingle(bArray, nStep, tempRef_Harm_Aberrance);
|
||||
Harm_Aberrance = tempRef_Harm_Aberrance.argvalue;
|
||||
RefObject<Short[]> tempRef_Cos_PF = new RefObject<Short[]>(Cos_PF);
|
||||
nStep += Service.convertInt16ArraySingle(bArray, nStep, tempRef_Cos_PF);
|
||||
Cos_PF = tempRef_Cos_PF.argvalue;
|
||||
RefObject<Short[]> tempRef_Cos_DF = new RefObject<Short[]>(Cos_DF);
|
||||
nStep += Service.convertInt16ArraySingle(bArray, nStep, tempRef_Cos_DF);
|
||||
Cos_DF = tempRef_Cos_DF.argvalue;
|
||||
RefObject<Short[]> tempRef_U_Fluctuation = new RefObject<Short[]>(U_Fluctuation);
|
||||
nStep += Service.convertInt16ArraySingle(bArray, nStep, tempRef_U_Fluctuation);
|
||||
U_Fluctuation = tempRef_U_Fluctuation.argvalue;
|
||||
RefObject<Short[]> tempRef_U_Flicker = new RefObject<Short[]>(U_Flicker);
|
||||
nStep += Service.convertInt16ArraySingle(bArray, nStep, tempRef_U_Flicker);
|
||||
U_Flicker = tempRef_U_Flicker.argvalue;
|
||||
RefObject<Short[]> tempRef_UL_Flicker = new RefObject<Short[]>(UL_Flicker);
|
||||
nStep += Service.convertInt16ArraySingle(bArray, nStep, tempRef_UL_Flicker);
|
||||
UL_Flicker = tempRef_UL_Flicker.argvalue;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,164 @@
|
||||
package com.njcn.csharmonic.offline.mincfg.vo;
|
||||
|
||||
/**
|
||||
@brief 3秒、分钟统计数据、日统计单个类型结构
|
||||
|
||||
*/
|
||||
public class tagPqData_Float
|
||||
{
|
||||
public short name; ///监测点号 12 /// </summary>
|
||||
public short Data_Type; ///数据类型 2 /// </summary>
|
||||
public RTC_Timer time; ///时间 /// </summary>
|
||||
public float[] Rms; ///电压A B C N 电流A B C N 线电压AB BC CA/// </summary>
|
||||
public float[] UU_Deviation; ///电压上偏差(3线电压)24 /// </summary>
|
||||
public float[] UL_Deviation; ///电压下偏差/// </summary>
|
||||
public float[] F_Deviation; ///频率偏差 8 /// </summary>
|
||||
public float[][] UI_Seq; ///电压电流零、正、负序、不平衡度32 第一个[]电压,电流;第二个[]零、正、负序、不平衡度/// </summary>
|
||||
public float[][] FuHarm; ///整次谐波 电压A B C N 电流A B C N 1200 /// </summary>
|
||||
public float[][] FuHarmPhase; ///谐波相角-送一半数据 600 /// </summary>
|
||||
public tagInHarmData_float[][] InHarm; ///间谐波-送一半数据 1200 /// </summary>
|
||||
public float[][] Total_Power; ///a,b,c,total 总功率(P.Q.S) 48 /// </summary>
|
||||
public tagPowerData_float[][] Harm_Power; ///谐波功率-送一半数据 1200 /// </summary>
|
||||
public float[][] Harm_Contain; ///谐波含有率 xxx.xx 600 /// </summary>
|
||||
public float[] Harm_Aberrance; ///谐波畸变率 xxx.xx 12 /// </summary>
|
||||
public float[] Cos_PF; ///视在功率因数 =P/S xx.xxx 8 /// </summary>
|
||||
public float[] Cos_DF; ///位移功率因数=P/S1 xx.xxx 8 /// </summary>
|
||||
public float[] U_Fluctuation; ///电压波动 xx.xxx 6 /// </summary>
|
||||
public float[] U_Flicker; ///电压闪变 xx.xxx 6 /// </summary>
|
||||
public float[] UL_Flicker; ///电压长闪变 xx.xxx 6 /// </summary>
|
||||
|
||||
public int EventFlag = 0; //暂态发生标志 1表示期间发生暂态 0表示暂未发生暂态
|
||||
public int DataFlag = 0; //数据去除标志 1表示去除 0表示保留
|
||||
public tagPqData_Float()
|
||||
{
|
||||
int i = 0, j = 0;
|
||||
|
||||
time = new RTC_Timer();
|
||||
Rms = new float[9];
|
||||
UU_Deviation = new float[6];
|
||||
UL_Deviation = new float[6];
|
||||
F_Deviation = new float[2];
|
||||
UI_Seq = new float[2][4];
|
||||
FuHarm = new float[6][50];
|
||||
FuHarmPhase = new float[6][50];
|
||||
InHarm = new tagInHarmData_float[6][50];
|
||||
for (i = 0; i < 6; i++)
|
||||
{
|
||||
for (j = 0; j < 50; j++)
|
||||
{
|
||||
InHarm[i][j] = new tagInHarmData_float();
|
||||
}
|
||||
}
|
||||
Total_Power = new float[4][3];
|
||||
Harm_Power = new tagPowerData_float[4][50];
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
for (j = 0; j < 50; j++)
|
||||
{
|
||||
Harm_Power[i][j] = new tagPowerData_float();
|
||||
}
|
||||
}
|
||||
Harm_Contain = new float[6][50];
|
||||
Harm_Aberrance = new float[8];
|
||||
Cos_PF = new float[4];
|
||||
Cos_DF = new float[4];
|
||||
U_Fluctuation = new float[3];
|
||||
U_Flicker = new float[3];
|
||||
UL_Flicker = new float[3];
|
||||
}
|
||||
|
||||
public final void SetFloatValue(tagPqData SrcData, float fPT, float fCT)
|
||||
{
|
||||
name = SrcData.name;
|
||||
Data_Type = SrcData.Data_Type;
|
||||
time.clone(SrcData.time);
|
||||
int i = 0, j = 0;
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
F_Deviation[i] = Service.IntToFloat(SrcData.F_Deviation[i]);
|
||||
for (j = 0; j < 4; j++)
|
||||
{
|
||||
if (i == 0)
|
||||
{
|
||||
if (j == 2) //正序
|
||||
{
|
||||
UI_Seq[i][j] = Service.IntToFloat(SrcData.UI_Seq[i][j]) * fPT; // / 1000 2019/9/9 修改 正序的值小了1000倍
|
||||
}
|
||||
else if (j < 3)
|
||||
{
|
||||
UI_Seq[i][j] = Service.IntToFloat(SrcData.UI_Seq[i][j]) * fPT * 1000;
|
||||
}
|
||||
else
|
||||
{
|
||||
UI_Seq[i][j] = Service.IntToFloat(SrcData.UI_Seq[i][j]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (j < 3)
|
||||
{
|
||||
UI_Seq[i][j] = Service.IntToFloat(SrcData.UI_Seq[i][j]) * fCT;
|
||||
}
|
||||
else
|
||||
{
|
||||
UI_Seq[i][j] = Service.IntToFloat(SrcData.UI_Seq[i][j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
U_Fluctuation[i] = Service.ShorToFloat1000(SrcData.U_Fluctuation[i]);
|
||||
U_Flicker[i] = Service.ShorToFloat1000(SrcData.U_Flicker[i]);
|
||||
UL_Flicker[i] = Service.ShorToFloat1000(SrcData.UL_Flicker[i]);
|
||||
}
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
Cos_PF[i] = Service.ShorToFloat10000(SrcData.Cos_PF[i]);
|
||||
Cos_DF[i] = Service.ShorToFloat10000(SrcData.Cos_DF[i]);
|
||||
for (j = 0; j < 3; j++)
|
||||
{
|
||||
Total_Power[i][j] = Service.IntToFloat(SrcData.Total_Power[i][j]) * fPT * fCT;
|
||||
}
|
||||
for (j = 0; j < 50; j++)
|
||||
{
|
||||
Harm_Power[i][j].P = Service.IntToFloat(SrcData.Harm_Power[i][j].P) * fPT * fCT;
|
||||
Harm_Power[i][j].Q = Service.IntToFloat(SrcData.Harm_Power[i][j].Q) * fPT * fCT;
|
||||
Harm_Power[i][j].S = Service.IntToFloat(SrcData.Harm_Power[i][j].S) * fPT * fCT;
|
||||
}
|
||||
|
||||
}
|
||||
for (i = 0; i < 6; i++)
|
||||
{
|
||||
UU_Deviation[i] = Service.IntToFloat(SrcData.UU_Deviation[i]);
|
||||
UL_Deviation[i] = Service.IntToFloat(SrcData.UL_Deviation[i]);
|
||||
Harm_Aberrance[i] = Service.ShorToFloat100(SrcData.Harm_Aberrance[i]);
|
||||
for (j = 0; j < 50; j++)
|
||||
{
|
||||
if (i < 3)
|
||||
{
|
||||
FuHarm[i][j] = Service.IntToFloat(SrcData.FuHarm[i][j]) * fPT;
|
||||
}
|
||||
else
|
||||
{
|
||||
FuHarm[i][j] = Service.IntToFloat(SrcData.FuHarm[i][j]) * fCT;
|
||||
}
|
||||
FuHarmPhase[i][j] = Service.IntToFloat(SrcData.FuHarmPhase[i][j]);
|
||||
InHarm[i][j].Val = Service.IntToFloat(SrcData.InHarm[i][j].Val);
|
||||
Harm_Contain[i][j] = Service.ShorToFloat100(SrcData.Harm_Contain[i][j]);
|
||||
}
|
||||
}
|
||||
for (i = 0; i < 9; i++)
|
||||
{
|
||||
if (i > 2 && i < 6)
|
||||
{
|
||||
Rms[i] = Service.IntToFloat(SrcData.Rms[i]) * fCT;
|
||||
}
|
||||
else
|
||||
{
|
||||
Rms[i] = Service.IntToFloat(SrcData.Rms[i]) * fPT;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.njcn.csharmonic.offline.mincfg.vo;
|
||||
|
||||
/**
|
||||
文件目录信息
|
||||
|
||||
*/
|
||||
//C# TO JAVA CONVERTER WARNING: Java does not allow user-defined value types. The behavior of this class will differ from the original:
|
||||
//ORIGINAL LINE: public struct tag_dir_info
|
||||
public final class tag_dir_info
|
||||
{
|
||||
public int flag; //0-目录,1-文件
|
||||
|
||||
//C# TO JAVA CONVERTER TODO TASK: Java annotations will not correspond to .NET attributes:
|
||||
//[MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)]
|
||||
public char[] name; //目录名或者文件名
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
//ORIGINAL LINE: public UInt32 size;
|
||||
public int size; //文件大小
|
||||
@Override
|
||||
public tag_dir_info clone()
|
||||
{
|
||||
tag_dir_info varCopy = new tag_dir_info();
|
||||
|
||||
varCopy.flag = this.flag;
|
||||
varCopy.name = this.name;
|
||||
varCopy.size = this.size;
|
||||
|
||||
return varCopy;
|
||||
}
|
||||
} //单个记录信息(是否考虑增加文件修改时间)
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.njcn.csharmonic.offline.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class Response implements Serializable {
|
||||
|
||||
@ApiModelProperty("文件名")
|
||||
private String filename;
|
||||
|
||||
@ApiModelProperty("解析后数据")
|
||||
private Object obj;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.njcn.csharmonic.controller;
|
||||
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.csharmonic.service.OfflineDataUploadService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 类的介绍:离线数据上传解析控制类
|
||||
*
|
||||
* @author gfh
|
||||
* @version 1.0.0
|
||||
* @createTime 2024/7/22 13:56
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/offlineDataUpload")
|
||||
@Api(tags = "离线数据上传")
|
||||
@AllArgsConstructor
|
||||
public class OfflineDataUploadController extends BaseController {
|
||||
|
||||
private final OfflineDataUploadService offlineDataUploadService;
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping(value = "/uploadAnalysis",consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||
@ApiOperation("解析上传的文件")
|
||||
public HttpResult<byte[]> uploadAnalysis(@RequestPart("files") List<MultipartFile> files,@RequestParam("type") String type) throws Exception{
|
||||
String methodDescribe = getMethodDescribe("uploadAnalysis");
|
||||
byte[] result = offlineDataUploadService.uploadAnalysis(files,type);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.njcn.csharmonic.service;
|
||||
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 类的介绍:离线数据上传解析服务类
|
||||
* </p>
|
||||
*
|
||||
* @author gfh
|
||||
* @since 2024/7/22 13:56
|
||||
*/
|
||||
public interface OfflineDataUploadService {
|
||||
|
||||
byte[] uploadAnalysis(List<MultipartFile> files,String type) throws Exception;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package com.njcn.csharmonic.service.impl;
|
||||
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.csharmonic.offline.log.Log;
|
||||
import com.njcn.csharmonic.offline.log.vo.NewTaglogbuffer;
|
||||
import com.njcn.csharmonic.offline.mincfg.AnalyseComtradeCfg;
|
||||
import com.njcn.csharmonic.offline.mincfg.tagComtradeCfg;
|
||||
import com.njcn.csharmonic.offline.vo.Response;
|
||||
import com.njcn.csharmonic.service.OfflineDataUploadService;
|
||||
import com.njcn.influx.pojo.po.cs.PqdData;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 类的介绍:离线数据上传解析服务实现类
|
||||
*
|
||||
* @author gfh
|
||||
* @version 1.0.0
|
||||
* @createTime 2024/7/22 13:56
|
||||
*/
|
||||
@Service
|
||||
public class OfflineDataUploadServiceImpl implements OfflineDataUploadService {
|
||||
|
||||
@Override
|
||||
public byte[] uploadAnalysis(List<MultipartFile> files,String type) throws Exception{
|
||||
byte[] bytes = null;
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
ObjectOutputStream oos = new ObjectOutputStream(baos);
|
||||
|
||||
List<Response> responses = new ArrayList<>();
|
||||
//min解析较为特殊需要同时解析所有文件
|
||||
if(!files.isEmpty() && "min".equals(type)){
|
||||
Response response = new Response();
|
||||
response.setFilename("min");
|
||||
List<PqdData> pqdData = AnalyseComtradeCfg.processDirectory(files);
|
||||
response.setObj(pqdData);
|
||||
responses.add(response);
|
||||
}else{
|
||||
for(MultipartFile file : files){
|
||||
Response response = new Response();
|
||||
response.setFilename(file.getOriginalFilename());
|
||||
if("comtrade".equals(type) && file.getOriginalFilename().indexOf(".cfg") != -1) {
|
||||
tagComtradeCfg tagComtradeCfg = AnalyseComtradeCfg.analyseComtradeCfg(file);
|
||||
response.setObj(tagComtradeCfg);
|
||||
}else if("log".equals(type) && file.getOriginalFilename().indexOf(".bin") != -1){
|
||||
List<NewTaglogbuffer> newTaglogbuffers = Log.convertLog(file);
|
||||
response.setObj(newTaglogbuffers);
|
||||
}
|
||||
responses.add(response);
|
||||
}
|
||||
}
|
||||
try {
|
||||
oos.writeObject(responses);
|
||||
bytes = baos.toByteArray();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
throw new BusinessException("数据集对象转字节数组失败");
|
||||
} finally {
|
||||
oos.close();
|
||||
baos.close();
|
||||
}
|
||||
return bytes;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user