|
@@ -2,17 +2,61 @@
|
|
|
#include "GlobalInfo.h"
|
|
|
#include "spdlog/spdlog.h"
|
|
|
|
|
|
-// ************************** StConsistencyResult ************************** 【【
|
|
|
-StConsistencyResult::StConsistencyResult()
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+/* --------------------------------------------------------------------------------
|
|
|
+ * 一致性检测参数 StConsistencyParam
|
|
|
+ * -------------------------------------------------------------------------------- */
|
|
|
+StConsistencyParam::StConsistencyParam()
|
|
|
{
|
|
|
- Init();
|
|
|
+ Init();
|
|
|
}
|
|
|
-StConsistencyResult::StConsistencyResult(StConsistencyParam ¶m)
|
|
|
+
|
|
|
+StConsistencyParam::StConsistencyParam(const StConsistencyParam& obj)
|
|
|
{
|
|
|
- Init();
|
|
|
- m_stConsistencyParam = param;
|
|
|
+ *this = obj;
|
|
|
+}
|
|
|
+
|
|
|
+StConsistencyParam& StConsistencyParam::operator=(const StConsistencyParam& obj)
|
|
|
+{
|
|
|
+ m_bConsistencySwitch = obj.m_bConsistencySwitch;
|
|
|
+
|
|
|
+ m_iConsistencyThreshold = obj.m_iConsistencyThreshold;
|
|
|
+ m_iConsistencyThresholdNum = obj.m_iConsistencyThresholdNum;
|
|
|
+ m_iConsistencyThresholdNot = obj.m_iConsistencyThresholdNot;
|
|
|
+ m_iConsistencyThresholdNotNum = obj.m_iConsistencyThresholdNotNum;
|
|
|
+ m_nConsistencyThresholdWarningNum = obj.m_nConsistencyThresholdWarningNum;
|
|
|
+ return *this;
|
|
|
}
|
|
|
|
|
|
+void StConsistencyParam::Init()
|
|
|
+{
|
|
|
+ m_bConsistencySwitch = false;
|
|
|
+
|
|
|
+ m_iConsistencyThreshold = 0;
|
|
|
+ m_iConsistencyThresholdNum = 0;
|
|
|
+ m_iConsistencyThresholdNot = 0;
|
|
|
+ m_iConsistencyThresholdNotNum = 0;
|
|
|
+ m_nConsistencyThresholdWarningNum = 0;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+/* --------------------------------------------------------------------------------
|
|
|
+ * 一致性检测参数 StConsistencyResult
|
|
|
+ * -------------------------------------------------------------------------------- */
|
|
|
+StConsistencyResult::StConsistencyResult()
|
|
|
+{
|
|
|
+ // Init();
|
|
|
+}
|
|
|
+// StConsistencyResult::StConsistencyResult(StConsistencyParam ¶m)
|
|
|
+// {
|
|
|
+// // Init();
|
|
|
+// // m_stConsistencyParam = param;
|
|
|
+// }
|
|
|
+
|
|
|
StConsistencyResult::~StConsistencyResult()
|
|
|
{
|
|
|
|
|
@@ -25,18 +69,18 @@ StConsistencyResult::StConsistencyResult(const StConsistencyResult& obj)
|
|
|
|
|
|
StConsistencyResult& StConsistencyResult::operator=(const StConsistencyResult &obj)
|
|
|
{
|
|
|
- m_bIsNoiseOfCur = obj.m_bIsNoiseOfCur;
|
|
|
- m_stNoiseConsistencyParam = obj.m_stNoiseConsistencyParam;
|
|
|
+ // m_bIsNoiseOfCur = obj.m_bIsNoiseOfCur;
|
|
|
+ // m_stNoiseConsistencyParam = obj.m_stNoiseConsistencyParam;
|
|
|
|
|
|
- // m_nRetPythonCompareFile = obj.m_nRetPythonCompareFile;
|
|
|
- m_stConsistencyParam = obj.m_stConsistencyParam;
|
|
|
+ // // m_nRetPythonCompareFile = obj.m_nRetPythonCompareFile;
|
|
|
+ // m_stConsistencyParam = obj.m_stConsistencyParam;
|
|
|
|
|
|
- iCurPos = obj.iCurPos;
|
|
|
- for(int i = 0; i < RESULT_NUM_OF_ONETIME_COMPARE; ++i)
|
|
|
- {
|
|
|
- aryOfDelN[i] = obj.aryOfDelN[i];
|
|
|
- aryOfSimilarity[i] = obj.aryOfSimilarity[i];
|
|
|
- }
|
|
|
+ // iCurPos = obj.iCurPos;
|
|
|
+ // for(int i = 0; i < RESULT_NUM_OF_ONETIME_COMPARE; ++i)
|
|
|
+ // {
|
|
|
+ // aryOfDelN[i] = obj.aryOfDelN[i];
|
|
|
+ // aryOfSimilarity[i] = obj.aryOfSimilarity[i];
|
|
|
+ // }
|
|
|
|
|
|
for(int i = 0; i < 10; ++i)
|
|
|
{
|
|
@@ -45,38 +89,38 @@ StConsistencyResult& StConsistencyResult::operator=(const StConsistencyResult &o
|
|
|
return *this;
|
|
|
}
|
|
|
|
|
|
-void StConsistencyResult::Init()
|
|
|
-{
|
|
|
- m_bIsNoiseOfCur = false;
|
|
|
- InitAICompareFile();
|
|
|
- // m_nRetPythonCompareFile = ERCF_3_CompareFile_Unkonw;
|
|
|
- iCurPos = 0;
|
|
|
- for(int i = 0; i < RESULT_NUM_OF_ONETIME_COMPARE; ++i)
|
|
|
- {
|
|
|
- aryOfDelN[i] = 0;
|
|
|
- aryOfSimilarity[i] = 0.0;
|
|
|
- }
|
|
|
-}
|
|
|
+// void StConsistencyResult::Init()
|
|
|
+// {
|
|
|
+// m_bIsNoiseOfCur = false;
|
|
|
+// InitAICompareFile();
|
|
|
+// // m_nRetPythonCompareFile = ERCF_3_CompareFile_Unkonw;
|
|
|
+// iCurPos = 0;
|
|
|
+// for(int i = 0; i < RESULT_NUM_OF_ONETIME_COMPARE; ++i)
|
|
|
+// {
|
|
|
+// aryOfDelN[i] = 0;
|
|
|
+// aryOfSimilarity[i] = 0.0;
|
|
|
+// }
|
|
|
+// }
|
|
|
|
|
|
void StConsistencyResult::InitAICompareFile()
|
|
|
{
|
|
|
- m_tLastAITime = QDateTime::currentDateTime();
|
|
|
- m_nLastRetAICompareFile = ERCF_3_CompareFile_Unkonw;
|
|
|
+ // m_tLastAITime = QDateTime::currentDateTime();
|
|
|
+ // m_nLastRetAICompareFile = ERCF_3_CompareFile_Unkonw;
|
|
|
for(int i = 0; i < 10; ++i)
|
|
|
{
|
|
|
aryOfAICompareFile[i] = -1.0;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-int StConsistencyResult::GetLastRetAICompareFile()
|
|
|
-{
|
|
|
- auto span = m_tLastAITime.secsTo(QDateTime::currentDateTime());
|
|
|
- if (span < GInfo.compareTimeSpan())
|
|
|
- {
|
|
|
- return m_nLastRetAICompareFile;
|
|
|
- }
|
|
|
- return ERCF_3_CompareFile_Unkonw;
|
|
|
-}
|
|
|
+// int StConsistencyResult::GetLastRetAICompareFile()
|
|
|
+// {
|
|
|
+// // auto span = m_tLastAITime.secsTo(QDateTime::currentDateTime());
|
|
|
+// // if (span < GInfo.compareTimeSpan())
|
|
|
+// // {
|
|
|
+// // return m_nLastRetAICompareFile;
|
|
|
+// // }
|
|
|
+// return ERCF_3_CompareFile_Unkonw;
|
|
|
+// }
|
|
|
|
|
|
int StConsistencyResult::AddRetAICompareFile(float fVal)
|
|
|
{
|
|
@@ -86,15 +130,15 @@ int StConsistencyResult::AddRetAICompareFile(float fVal)
|
|
|
}
|
|
|
aryOfAICompareFile[0] = fVal;
|
|
|
|
|
|
- m_tLastAITime = QDateTime::currentDateTime();
|
|
|
- if (fVal > 0.99)
|
|
|
- {
|
|
|
- m_nLastRetAICompareFile = ERCF_1_CompareFile_TRUE;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- m_nLastRetAICompareFile = ERCF_0_CompareFile_FALSE;
|
|
|
- }
|
|
|
+ // m_tLastAITime = QDateTime::currentDateTime();
|
|
|
+ // if (fVal > 0.99)
|
|
|
+ // {
|
|
|
+ // m_nLastRetAICompareFile = ERCF_1_CompareFile_TRUE;
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // {
|
|
|
+ // m_nLastRetAICompareFile = ERCF_0_CompareFile_FALSE;
|
|
|
+ // }
|
|
|
return 10;
|
|
|
}
|
|
|
|
|
@@ -108,7 +152,7 @@ bool StConsistencyResult::IsAIConsistency(int nThresholdNum, float dThreshold, s
|
|
|
{
|
|
|
if (aryOfAICompareFile[i] < -0.9)
|
|
|
{
|
|
|
- strAIValue += ",数据未初始化直接返回-1";
|
|
|
+ strAIValue += "数据未初始化直接返回 -1";
|
|
|
return -1;
|
|
|
}
|
|
|
if (aryOfAICompareFile[i] < dThreshold)
|
|
@@ -116,8 +160,7 @@ bool StConsistencyResult::IsAIConsistency(int nThresholdNum, float dThreshold, s
|
|
|
bConsistency = false;
|
|
|
strAIValue = fmt::format("{},{:.3f}<{:.3f}不能判断为一致", strAIValue, aryOfAICompareFile[i], dThreshold);
|
|
|
break;
|
|
|
- }
|
|
|
- else
|
|
|
+ } else
|
|
|
{
|
|
|
strAIValue = fmt::format("{},{:.3f}", strAIValue, aryOfAICompareFile[i]);
|
|
|
}
|
|
@@ -139,7 +182,7 @@ bool StConsistencyResult::IsAINotConsistency(int nThresholdNum, float dThreshold
|
|
|
{
|
|
|
if (aryOfAICompareFile[i] < -0.9)
|
|
|
{
|
|
|
- strAIValue = fmt::format("{}, 数据未初始化直接返回-1", strAIValue);
|
|
|
+ strAIValue = fmt::format("数据未初始化直接返回 -1");
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
@@ -148,8 +191,7 @@ bool StConsistencyResult::IsAINotConsistency(int nThresholdNum, float dThreshold
|
|
|
bNotConsistency = false;
|
|
|
strAIValue = fmt::format("{},{:.3f} > {:.3f}不能判断为不一致", strAIValue, aryOfAICompareFile[i], dThreshold);
|
|
|
break;
|
|
|
- }
|
|
|
- else
|
|
|
+ } else
|
|
|
{
|
|
|
strAIValue = fmt::format("{}, {:.3f}", strAIValue, aryOfAICompareFile[i]);
|
|
|
}
|
|
@@ -161,119 +203,257 @@ bool StConsistencyResult::IsAINotConsistency(int nThresholdNum, float dThreshold
|
|
|
return bNotConsistency;
|
|
|
}
|
|
|
|
|
|
-std::string StConsistencyResult::OutPutConsistencyInfo(const bool bConsistencyInfo)
|
|
|
-{
|
|
|
- std::string strInfo;
|
|
|
- for(int i = 0; i < RESULT_NUM_OF_ONETIME_COMPARE; ++i)
|
|
|
- {
|
|
|
+// std::string StConsistencyResult::OutPutConsistencyInfo(const bool bConsistencyInfo)
|
|
|
+// {
|
|
|
+// std::string strInfo;
|
|
|
+// for(int i = 0; i < RESULT_NUM_OF_ONETIME_COMPARE; ++i)
|
|
|
+// {
|
|
|
|
|
|
- std::string str = fmt::format("{:.2f}(相似度) {}(采样率偏移量)", aryOfSimilarity[i], aryOfDelN[i]);
|
|
|
- strInfo += str;
|
|
|
- }
|
|
|
-
|
|
|
- StConsistencyParam param = m_stConsistencyParam;
|
|
|
- if (m_bIsNoiseOfCur)
|
|
|
- {
|
|
|
- param = m_stNoiseConsistencyParam;
|
|
|
- }
|
|
|
-
|
|
|
- std::string strMsg = fmt::format("{}: {}-{} {}-{}", strInfo,
|
|
|
- param.GetConsistencyThreshold(),
|
|
|
- param.GetConsistencyThresholdNum(),
|
|
|
- param.GetConsistencyThresholdNot(),
|
|
|
- param.GetConsistencyThresholdNotNum());
|
|
|
+// std::string str = fmt::format("{:.2f}(相似度) {}(采样率偏移量)", aryOfSimilarity[i], aryOfDelN[i]);
|
|
|
+// strInfo += str;
|
|
|
+// }
|
|
|
+
|
|
|
+// StConsistencyParam param = m_stConsistencyParam;
|
|
|
+// if (m_bIsNoiseOfCur)
|
|
|
+// {
|
|
|
+// param = m_stNoiseConsistencyParam;
|
|
|
+// }
|
|
|
+
|
|
|
+// std::string strMsg = fmt::format("{}: {}-{} {}-{}", strInfo,
|
|
|
+// param.GetConsistencyThreshold(),
|
|
|
+// param.GetConsistencyThresholdNum(),
|
|
|
+// param.GetConsistencyThresholdNot(),
|
|
|
+// param.GetConsistencyThresholdNotNum());
|
|
|
|
|
|
- SPDLOG_DEBUG("一致性检测结果: {}", strMsg);
|
|
|
- return strMsg;
|
|
|
+// SPDLOG_DEBUG("一致性检测结果: {}", strMsg);
|
|
|
+// return strMsg;
|
|
|
+// }
|
|
|
+
|
|
|
+// bool StConsistencyResult::IsConsistency() const
|
|
|
+// {
|
|
|
+// StConsistencyParam param = m_stConsistencyParam;
|
|
|
+// if (m_bIsNoiseOfCur)
|
|
|
+// {
|
|
|
+// param = m_stNoiseConsistencyParam;
|
|
|
+// }
|
|
|
+
|
|
|
+// if(param.GetConsistencyThreshold() <= GetMaxResult())
|
|
|
+// {
|
|
|
+// return true;
|
|
|
+// }
|
|
|
+
|
|
|
+// return false;
|
|
|
+// }
|
|
|
+
|
|
|
+// bool StConsistencyResult::IsNotConsistency() const
|
|
|
+// {
|
|
|
+// StConsistencyParam param = m_stConsistencyParam;
|
|
|
+// if (m_bIsNoiseOfCur)
|
|
|
+// {
|
|
|
+// param = m_stNoiseConsistencyParam;
|
|
|
+// }
|
|
|
+
|
|
|
+// if(param.GetConsistencyThresholdNot() > GetMaxResult())
|
|
|
+// {
|
|
|
+// return true;
|
|
|
+// }
|
|
|
+
|
|
|
+// return false;
|
|
|
+// }
|
|
|
+
|
|
|
+// int StConsistencyResult::GetMaxResult() const
|
|
|
+// {
|
|
|
+// int iRet = 0;
|
|
|
+// for(int i = 0; i < RESULT_NUM_OF_ONETIME_COMPARE; ++i)
|
|
|
+// {
|
|
|
+// int iTmp = aryOfSimilarity[i];
|
|
|
+// if(iRet <= iTmp)
|
|
|
+// {
|
|
|
+// iRet = iTmp;
|
|
|
+// }
|
|
|
+// }
|
|
|
+// return iRet;
|
|
|
+// }
|
|
|
+
|
|
|
+// int StConsistencyResult::AddResult(const float f, const int iDelN)
|
|
|
+// {
|
|
|
+// if(iCurPos < RESULT_NUM_OF_ONETIME_COMPARE)
|
|
|
+// {
|
|
|
+// return -1;
|
|
|
+// }
|
|
|
+
|
|
|
+// aryOfDelN[iCurPos] = iDelN;
|
|
|
+// aryOfSimilarity[iCurPos] = f;
|
|
|
+
|
|
|
+// return ++iCurPos;
|
|
|
+// }
|
|
|
+
|
|
|
+// int StConsistencyResult::GetConsistencyThresholdNum() const
|
|
|
+// {
|
|
|
+// int iNum = m_stConsistencyParam.GetConsistencyThresholdNum();
|
|
|
+// if (iNum < m_stNoiseConsistencyParam.GetConsistencyThresholdNum())
|
|
|
+// {
|
|
|
+// iNum = m_stNoiseConsistencyParam.GetConsistencyThresholdNum();
|
|
|
+// }
|
|
|
+
|
|
|
+// return iNum;
|
|
|
+// }
|
|
|
+
|
|
|
+// int StConsistencyResult::GetConsistencyThresholdNotNum() const
|
|
|
+// {
|
|
|
+// int iNotNum = m_stConsistencyParam.GetConsistencyThresholdNotNum();
|
|
|
+// if (iNotNum < m_stNoiseConsistencyParam.GetConsistencyThresholdNotNum())
|
|
|
+// {
|
|
|
+// iNotNum = m_stNoiseConsistencyParam.GetConsistencyThresholdNotNum();
|
|
|
+// }
|
|
|
+// return iNotNum;
|
|
|
+// }
|
|
|
+
|
|
|
+// int StConsistencyResult::GetConsistencyThresholdWarningNum() const
|
|
|
+// {
|
|
|
+// int iNum = m_stConsistencyParam.GetConsistencyThresholdWarningNum();
|
|
|
+// if (iNum < m_stNoiseConsistencyParam.GetConsistencyThresholdWarningNum())
|
|
|
+// {
|
|
|
+// iNum = m_stNoiseConsistencyParam.GetConsistencyThresholdWarningNum();
|
|
|
+// }
|
|
|
+// return iNum;
|
|
|
+// }
|
|
|
+// ************************** stConsistency ************************** 】】
|
|
|
+
|
|
|
+
|
|
|
+/* --------------------------------------------------------------------------------
|
|
|
+ * 一致性检测结果 ConsistencyResult_t
|
|
|
+ * -------------------------------------------------------------------------------- */
|
|
|
+
|
|
|
+ConsistencyResult_t::ConsistencyResult_t()
|
|
|
+{
|
|
|
+ Init();
|
|
|
}
|
|
|
|
|
|
-bool StConsistencyResult::IsConsistency() const
|
|
|
+ConsistencyResult_t::ConsistencyResult_t(const ConsistencyResult_t& obj)
|
|
|
{
|
|
|
- StConsistencyParam param = m_stConsistencyParam;
|
|
|
- if (m_bIsNoiseOfCur)
|
|
|
- {
|
|
|
- param = m_stNoiseConsistencyParam;
|
|
|
- }
|
|
|
|
|
|
- if(param.GetConsistencyThreshold() <= GetMaxResult())
|
|
|
- {
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- return false;
|
|
|
}
|
|
|
|
|
|
-bool StConsistencyResult::IsNotConsistency() const
|
|
|
+ConsistencyResult_t& ConsistencyResult_t::operator=(const ConsistencyResult_t& obj)
|
|
|
{
|
|
|
- StConsistencyParam param = m_stConsistencyParam;
|
|
|
- if (m_bIsNoiseOfCur)
|
|
|
+ m_fInitThreshold = obj.m_fInitThreshold;
|
|
|
+ m_nCurPos = obj.m_nCurPos;
|
|
|
+ for(int i = 0; i < m_numArryCount; ++i)
|
|
|
{
|
|
|
- param = m_stNoiseConsistencyParam;
|
|
|
+ m_arryResult[i] = obj.m_arryResult[i];
|
|
|
}
|
|
|
|
|
|
- if(param.GetConsistencyThresholdNot() > GetMaxResult())
|
|
|
- {
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- return false;
|
|
|
+ return *this;
|
|
|
}
|
|
|
|
|
|
-int StConsistencyResult::GetMaxResult() const
|
|
|
+void ConsistencyResult_t::Init()
|
|
|
{
|
|
|
- int iRet = 0;
|
|
|
- for(int i = 0; i < RESULT_NUM_OF_ONETIME_COMPARE; ++i)
|
|
|
- {
|
|
|
- int iTmp = aryOfSimilarity[i];
|
|
|
- if(iRet <= iTmp)
|
|
|
- {
|
|
|
- iRet = iTmp;
|
|
|
- }
|
|
|
- }
|
|
|
- return iRet;
|
|
|
+ m_fInitThreshold = 0.9; /* 初始化阈值 */
|
|
|
+ m_nCurPos = 0;
|
|
|
+ for(int i = 0; i < m_numArryCount; ++i)
|
|
|
+ {
|
|
|
+ m_arryResult[i] = -1.0;
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
-int StConsistencyResult::AddResult(const float f, const int iDelN)
|
|
|
+/* 添加结果 */
|
|
|
+bool ConsistencyResult_t::AddResult(float fVal)
|
|
|
{
|
|
|
- if(iCurPos < RESULT_NUM_OF_ONETIME_COMPARE)
|
|
|
- {
|
|
|
- return -1;
|
|
|
- }
|
|
|
-
|
|
|
- aryOfDelN[iCurPos] = iDelN;
|
|
|
- aryOfSimilarity[iCurPos] = f;
|
|
|
+ for(int i = 8; i >= 0; --i)
|
|
|
+ {
|
|
|
+ m_arryResult[i + 1] = m_arryResult[i];
|
|
|
+ }
|
|
|
+ m_arryResult[0] = fVal;
|
|
|
|
|
|
- return ++iCurPos;
|
|
|
+ return true;
|
|
|
}
|
|
|
|
|
|
-int StConsistencyResult::GetConsistencyThresholdNum() const
|
|
|
+/*
|
|
|
+ 计算一致性
|
|
|
+ 计算要求:需要 nThresholdNum 全部大于一致性阈值 fThreshold 方可判断为一致,否则返回无法判断为一致
|
|
|
+ */
|
|
|
+eConsistencyState ConsistencyResult_t::computeConsistency(int nThresholdNum, float fThreshold, std::string& strInfo)
|
|
|
{
|
|
|
- int iNum = m_stConsistencyParam.GetConsistencyThresholdNum();
|
|
|
- if (iNum < m_stNoiseConsistencyParam.GetConsistencyThresholdNum())
|
|
|
+ strInfo.clear();
|
|
|
+ bool bConsistency = true;
|
|
|
+ if (nThresholdNum < 0)
|
|
|
{
|
|
|
- iNum = m_stNoiseConsistencyParam.GetConsistencyThresholdNum();
|
|
|
+ nThresholdNum = 1;
|
|
|
+ strInfo += "一致性最小检测数目为1 ";
|
|
|
+ }
|
|
|
+ if (nThresholdNum > 10)
|
|
|
+ {
|
|
|
+ nThresholdNum = 10;
|
|
|
+ strInfo += "一致性最大检测数目为10 ";
|
|
|
}
|
|
|
|
|
|
- return iNum;
|
|
|
+ for(int i = 0; i < nThresholdNum; ++i)
|
|
|
+ {
|
|
|
+ if (m_arryResult[i] < -0.9)
|
|
|
+ {
|
|
|
+ strInfo += "数据未初始化";
|
|
|
+ return eConsistencyState::eCS_Unknown;
|
|
|
+ }
|
|
|
+ if (m_arryResult[i] < fThreshold)
|
|
|
+ {
|
|
|
+ bConsistency = false;
|
|
|
+ strInfo = fmt::format("{},{:.3f}<{:.3f}不能判断为一致", strInfo, m_arryResult[i], fThreshold);
|
|
|
+ break;
|
|
|
+ } else
|
|
|
+ {
|
|
|
+ strInfo = fmt::format("{},{:.3f}", strInfo, m_arryResult[i]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (bConsistency)
|
|
|
+ {
|
|
|
+ return eConsistencyState::eCS_Consistency;
|
|
|
+ }else {
|
|
|
+ return eConsistencyState::eCS_Unknown;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
-int StConsistencyResult::GetConsistencyThresholdNotNum() const
|
|
|
+/* 计算不一致性 */
|
|
|
+eConsistencyState ConsistencyResult_t::computeNotConsistency(int nThresholdNum, float fThreshold, std::string& strInfo)
|
|
|
{
|
|
|
- int iNotNum = m_stConsistencyParam.GetConsistencyThresholdNotNum();
|
|
|
- if (iNotNum < m_stNoiseConsistencyParam.GetConsistencyThresholdNotNum())
|
|
|
+ strInfo.clear();
|
|
|
+ bool bNotConsistency = true;
|
|
|
+ if (nThresholdNum < 0)
|
|
|
{
|
|
|
- iNotNum = m_stNoiseConsistencyParam.GetConsistencyThresholdNotNum();
|
|
|
+ nThresholdNum = 1;
|
|
|
+ strInfo += "一致性最小检测数目为1 ";
|
|
|
+ }
|
|
|
+ if (nThresholdNum > 10)
|
|
|
+ {
|
|
|
+ nThresholdNum = 10;
|
|
|
+ strInfo += "一致性最大检测数目为10 ";
|
|
|
}
|
|
|
- return iNotNum;
|
|
|
-}
|
|
|
|
|
|
-int StConsistencyResult::GetConsistencyThresholdWarningNum() const
|
|
|
-{
|
|
|
- int iNum = m_stConsistencyParam.GetConsistencyThresholdWarningNum();
|
|
|
- if (iNum < m_stNoiseConsistencyParam.GetConsistencyThresholdWarningNum())
|
|
|
+ for(int i = 0; i < nThresholdNum; ++i)
|
|
|
{
|
|
|
- iNum = m_stNoiseConsistencyParam.GetConsistencyThresholdWarningNum();
|
|
|
+ if (m_arryResult[i] < -0.9)
|
|
|
+ {
|
|
|
+ strInfo = fmt::format("数据未初始化直接返回");
|
|
|
+ return eConsistencyState::eCS_Unknown;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (m_arryResult[i] > fThreshold)
|
|
|
+ {
|
|
|
+ bNotConsistency = false;
|
|
|
+ strInfo = fmt::format("{},{:.3f} > {:.3f}不能判断为不一致", strInfo, m_arryResult[i], fThreshold);
|
|
|
+ break;
|
|
|
+ } else
|
|
|
+ {
|
|
|
+ strInfo = fmt::format("{}, {:.3f}", strInfo, m_arryResult[i]);
|
|
|
+ }
|
|
|
}
|
|
|
- return iNum;
|
|
|
-}
|
|
|
-// ************************** stConsistency ************************** 】】
|
|
|
+ if (bNotConsistency)
|
|
|
+ {
|
|
|
+ strInfo = fmt::format("{}, 判断为不一致", strInfo);
|
|
|
+ }
|
|
|
+ if(bNotConsistency)
|
|
|
+ {
|
|
|
+ return eConsistencyState::eCS_NotConsistency;
|
|
|
+ }else {
|
|
|
+ return eConsistencyState::eCS_Unknown;
|
|
|
+ }
|
|
|
+}
|