fix qvvr time and fix fluc error

This commit is contained in:
lnk
2025-07-29 18:10:03 +08:00
parent 46b7603ed0
commit cc41842077
4 changed files with 100 additions and 11 deletions

View File

@@ -121,7 +121,7 @@ public:
class CDataType //数据类型类
{
public:
int iDataType; //数据类型值1-稳态 2-闪变 3-暂态
int iDataType; //数据类型值1-稳态 2-闪变 3-长闪
QString type; //参数等级type类型0-DataType 1-监测点 2-剔除标记 3-发生时刻,毫秒 4-数据链表 5-相位 6-值索引 9-实时SOE事件
int BaseFlag1; //zw修改 2023-8-25 记录基础数据总个数
int BaseFlag0; //zw修改 2023-8-25 记录非基础数据个数
@@ -385,7 +385,7 @@ bool ParseXMLConfig2(int xml_flag, XmlConfig *cfg, list<CTopic*> *ctopiclist,QSt
if (node4.isElement())
{
QString strPhase = node4.toElement().attribute("value"); //相别
if ((!xml_flag || "V" != it->strItemName) && "7" == strPhase) //⑤-①读取ABC三相数据 //lnk2024-8-14 角型判断
if ((!xml_flag || ("V" != it->strItemName && "F_S" != it->strItemName && "F_L" != it->strItemName)) && "7" == strPhase) //⑤-①读取ABC三相数据 //lnk2024-8-14 角型判断
{
for (int n = 0; n < 3; n++) //遍历 相别(ABC三相)
{
@@ -558,7 +558,7 @@ bool ParseXMLConfig2(int xml_flag, XmlConfig *cfg, list<CTopic*> *ctopiclist,QSt
}
} //⑤-①读取ABC三相数据 结束
if (xml_flag && "V" == it->strItemName && "112" == strPhase) //lnk2024-8-13角型
if (xml_flag && ("V" == it->strItemName || "F_S" == it->strItemName || "F_L" == it->strItemName) && "112" == strPhase) //lnk2024-8-13角型//lnk20250729闪变也要加上角形
{
for (int n = 0; n < 3; n++) //遍历 相别(AB、BC、CA三相)
{
@@ -965,6 +965,68 @@ QString line_to_phasic(QString qstrSeq) {
}
}
//调试用
void printCTopicList(const std::list<CTopic*>& ctopic_list) {
int topicIndex = 0;
for (const auto& topic : ctopic_list) {
printf("==== Topic[%d] ====\n", topicIndex++);
printf("Topic name: %s\n", topic->strTopic.toStdString().c_str());
int dtypeIndex = 0;
for (const auto& dtype : topic->DataTypeList) {
printf(" -- DataType[%d] --\n", dtypeIndex++);
printf(" iDataType: %d, type: %s, BaseFlag1: %d, BaseFlag0: %d\n",
dtype->iDataType,
dtype->type.toStdString().c_str(),
dtype->BaseFlag1,
dtype->BaseFlag0);
int monitorIndex = 0;
for (const auto& monitor : dtype->MonitorList) {
printf(" >> Monitor[%d] name: %s, type: %s\n",
monitorIndex++,
monitor->strMonitor.toStdString().c_str(),
monitor->type.toStdString().c_str());
int itemIndex = 0;
for (const auto& item : monitor->ItemList) {
printf(" >> Item[%d] name: %s, value: %s, type: %s\n",
itemIndex++,
item->strItemName.toStdString().c_str(),
item->strItemValue.toStdString().c_str(),
item->type.toStdString().c_str());
int seqIndex = 0;
for (const auto& seq : item->SequenceList) {
printf(" >> Sequence[%d] strSeq: %s, strSValue: %s, type: %s\n",
seqIndex++,
seq->strSeq.toStdString().c_str(),
seq->strSValue.toStdString().c_str(),
seq->type.toStdString().c_str());
int valIndex = 0;
for (const auto& val : seq->DataValueList) {
printf(" >> DataValue[%d] name: %s, value: %f\n",
valIndex++,
val->strName.toStdString().c_str(),
val->fValue);
}
}
}
}
// 如果需要打印 SOEList可加以下
/*
int soeIndex = 0;
for (const auto& soe : dtype->SOEList) {
printf(" >> SOE[%d] ... \n", soeIndex++);
// 打印 SOE 具体字段(如有定义)
}
*/
}
}
}
//20250214添加角型接线处理
int transfer_json_block_data(char v_wiring_type[], json_block_data *data) //json生成函数 zw修改 2023-8-11 调整传送json结构 目前仅限历史稳态数据
{
@@ -989,10 +1051,13 @@ int transfer_json_block_data(char v_wiring_type[], json_block_data *data) //json
if (xmlinfo_list2.contains(data->dev_type)) {
cout << "transfer_json_block_data contain data->dev_type" << endl;
ctopic_list = xmlinfo_list2[data->dev_type]->topicList;
//printCTopicList(ctopic_list);
}
else {
cout << "transfer_json_block_data not contain data->dev_type:" << data->dev_type.toStdString() << " !!!!"<< endl;
ctopic_list = topicList2;
}
}
@@ -1261,7 +1326,7 @@ int transfer_json_block_data(char v_wiring_type[], json_block_data *data) //json
if (isJump) continue; //跳出本数据类型循环
KafkaData.strText.append("}"); //拼接 json稳态数据结尾
cout<< countflag << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!send name=\"DATA_TYPE\" value=\"04\" " << num << endl;
cout<< countflag << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!send name=\"DATA_TYPE\" value=\"03\" " << num << endl;
cout << KafkaData.strText.toAscii().data() << endl;
if (countflag < num && 0 == time_sec % 7200) {
kafka_data_list_mutex.lock(); //加锁
@@ -1439,6 +1504,9 @@ int transfer_json_block_data(char v_wiring_type[], json_block_data *data) //json
if (isJump) continue; //跳出本数据类型循环
KafkaData.strText.append("}"); //拼接 json稳态数据结尾
//调试用
//cout << KafkaData.strText.toAscii().data() << endl;
kafka_data_list_mutex.lock(); //加锁
kafka_data_list.append(KafkaData); //添加 kafka发送链表
kafka_data_list_mutex.unlock(); //解锁
@@ -2136,7 +2204,7 @@ int transfer_json_block_data(char v_wiring_type[], json_block_data *data) //json
if (isJump) continue; //跳出本数据类型循环
KafkaData.strText.append("}"); //拼接 json稳态数据结尾
cout << countflag << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!send name=\"DATA_TYPE\" value=\"04\" " << num << endl;
cout << countflag << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!send name=\"DATA_TYPE\" value=\"03\" " << num << endl;
cout << KafkaData.strText.toAscii().data() << endl;
if (countflag < num && 0 == time_sec % 7200) {
kafka_data_list_mutex.lock(); //加锁

View File

@@ -2387,6 +2387,20 @@ int json_block_create_end(char v_wiring_type[], char monid_char[], int flicker_f
pdata = json_pst_data_map.value(monid_char);
}
//调试用
/*if (pdata != nullptr) {
printf("monitorId: %d\n", pdata->monitorId);
printf("func_type: %d\n", pdata->func_type);
printf("flag: %d\n", pdata->flag);
printf("time: %lld\n", pdata->time);
printf("voltage_level: %f\n", pdata->voltage_level);
printf("mp_id: %s\n", pdata->mp_id.toStdString().c_str());
printf("dev_type: %s\n", pdata->dev_type.toStdString().c_str());
printf("mms_str_map count: %d\n", pdata->mms_str_map.size());
} else {
printf("pdata is NULL\n");
}*/
if (pdata->mms_str_map.count() == 0) {
if (flicker_flag == 1) {
json_flicker_data_map.remove(monid_char);

View File

@@ -1898,7 +1898,7 @@ apr_status_t call_cn_wavelist(LD_info_t *LD_info )
if (ret2==SD_SUCCESS && ret3==SD_SUCCESS ) { //两个文件都写好了
//mq日志
DIY_INFOLOG(full_key_m_c,"【NORMAL】监测点:%s - id:%s从终端获取录波文件成功,开始上传录波文件到web并更新暂态事件", LD_info->name,LD_info->mp_id);
DIY_INFOLOG(full_key_m_c,"【NORMAL】监测点:%s - id:%s从终端获取录波文件成功", LD_info->name,LD_info->mp_id);
QVVR_t *qvvr; //暂态事件
long long start_tm,trig_tm,end_tm;
@@ -1906,6 +1906,7 @@ apr_status_t call_cn_wavelist(LD_info_t *LD_info )
ret2 = extract_timestamp_from_cfg_file(filenames[cfg_idx],&start_tm,&trig_tm);//提取文件的开始时间和触发时间
printf(">>>>>>>> extract_timestamp_from_cfg_file end \n");
if (ret2 ==APR_SUCCESS) {
DIY_INFOLOG(full_key_m_c,"【NORMAL】监测点:%s - id:%s提取录波文件时间成功", LD_info->name,LD_info->mp_id);
//to find the paired qvvr by the time of trig_tm
printf(">>>>>>>> extract_timestamp_from_cfg_file success \n");
qvvr = find_qvvr_by_trig_tm(LD_info,trig_tm); //根据文件的触发时间查找检测点记录的匹配上的暂态事件
@@ -2019,7 +2020,7 @@ apr_status_t call_cn_wavelist(LD_info_t *LD_info )
}
if(strcmp(cfg1.ValueOfTimeUnit, "utc") == 0){//上送的是utc还是北京
utc_or_beijing = 28800000;
utc_or_beijing = 0;//61850库已经转换过
}
else{
utc_or_beijing = 0;
@@ -2116,9 +2117,15 @@ apr_status_t call_cn_wavelist(LD_info_t *LD_info )
free(wavepath_dat);
}
}
}
else
{
DIY_ERRORLOG(full_key_m_c,"【NORMAL】监测点:%s - id:%s匹配录波文件失败请检查装置的暂态时间是秒还是毫秒并修改映射文件", LD_info->name,LD_info->mp_id);
}
}
}
}
else {
if (ied && chnl_usr){

View File

@@ -553,7 +553,7 @@ void processQVVR_end(LD_info_t* LD_info)
}
if(strcmp(cfg.ValueOfTimeUnit, "utc") == 0){//上送的是utc还是北京
utc_or_beijing = 28800000;
utc_or_beijing = 0;//61850库已经转换过了八小时毫秒数28800000;
}
else{
utc_or_beijing = 0;