解析
This commit is contained in:
parent
c39b0b7889
commit
96fd7a1ee9
@ -1196,6 +1196,18 @@ namespace JiShe.CollectBus.Common.Extensions
|
||||
return string.Join(" ", strArr);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断数据是否有误
|
||||
/// </summary>
|
||||
/// <param name="str"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsEE(this string str)
|
||||
{
|
||||
if (str == "EE")
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
private static string AddHex33(this string strGet)
|
||||
{
|
||||
string result;
|
||||
|
||||
@ -21,6 +21,8 @@ namespace JiShe.CollectBus.Protocol.Contracts.Abstracts
|
||||
|
||||
public const int tPLen = 6;
|
||||
|
||||
public const string errorData = "EE";
|
||||
|
||||
|
||||
public abstract Task<ProtocolInfo> GetAsync();
|
||||
|
||||
@ -291,7 +293,6 @@ namespace JiShe.CollectBus.Protocol.Contracts.Abstracts
|
||||
//当前B相视在功率:Error: 数据不符合BCD码格式 kVA EE EE EE
|
||||
//当前C相视在功率:Error: 数据不符合BCD码格式 kVA EE EE EE
|
||||
//++++++++++++++++++++++++++++++++++++
|
||||
|
||||
/// <summary>
|
||||
/// 当前三相及总有/无功功率、功率因数、三相电压、电流、零序电流、视在功率
|
||||
/// </summary>
|
||||
@ -386,6 +387,10 @@ namespace JiShe.CollectBus.Protocol.Contracts.Abstracts
|
||||
/// <returns></returns>
|
||||
private decimal AnalysisA05(string singleDigitNumberAndDeciles, string hundredDigitNumbersAndTenDigitNumber)
|
||||
{
|
||||
if (singleDigitNumberAndDeciles.IsEE() && hundredDigitNumbersAndTenDigitNumber.IsEE())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
var bin1 = hundredDigitNumbersAndTenDigitNumber.HexToBin().PadLeft(8, '0');
|
||||
var hundredDigitNumbers = bin1.Substring(1, 3).BinToDec();//百位
|
||||
var tenDigitNumber = bin1.Substring(4).BinToDec();//十位
|
||||
@ -406,6 +411,10 @@ namespace JiShe.CollectBus.Protocol.Contracts.Abstracts
|
||||
/// <returns></returns>
|
||||
private decimal AnalysisA07(string singleDigitNumberAndDeciles,string hundredDigitNumbersAndTenDigitNumber)
|
||||
{
|
||||
if (singleDigitNumberAndDeciles.IsEE() && hundredDigitNumbersAndTenDigitNumber.IsEE())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
var bin1 = hundredDigitNumbersAndTenDigitNumber.HexToBin().PadLeft(8, '0');
|
||||
var hundredDigitNumbers = bin1.Substring(1, 3).BinToDec();//百位
|
||||
var tenDigitNumber = bin1.Substring(4).BinToDec();//十位
|
||||
@ -427,6 +436,11 @@ namespace JiShe.CollectBus.Protocol.Contracts.Abstracts
|
||||
/// <returns></returns>
|
||||
private decimal AnalysisA09(string thousandthPercentileAndTenThousandPositions, string decilesAndPercentile, string tenAndSingleDigit)
|
||||
{
|
||||
if (thousandthPercentileAndTenThousandPositions.IsEE() && decilesAndPercentile.IsEE() && tenAndSingleDigit.IsEE())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
var bin3 = tenAndSingleDigit.HexToBin().PadLeft(8, '0');
|
||||
var tenDigitNumber = bin3.Substring(1, 3).BinToDec();//十位
|
||||
var singleDigitNumber = bin3.Substring(4).BinToDec();//个位
|
||||
@ -448,19 +462,18 @@ namespace JiShe.CollectBus.Protocol.Contracts.Abstracts
|
||||
/// <summary>
|
||||
/// 数据格式12 TODO:待优化
|
||||
/// </summary>
|
||||
/// <param name="tenDigitNumberAndSingleDigitNumber">十位 个位</param>
|
||||
/// <param name="hundredsOfPositionAndThousandOfPosition">千位 百位</param>
|
||||
/// <param name="hundredThousandOfPositionAndTenThousandOfPosition">十万位 万位</param>
|
||||
/// <param name="millionsOfPositionAndMillionOfPosition">千万位 百万位</param>
|
||||
/// <param name="billionOfPositionAndHundredMillionOfPosition">十亿位 亿位</param>
|
||||
/// <param name="hundredBillionsOfPositionAndBillionsOfPosition">千亿位 百亿位</param>
|
||||
/// <param name="tenDigitAndSingleDigitNumber">十位 个位</param>
|
||||
/// <param name="thousandAndHundredsOfPosition">千位 百位</param>
|
||||
/// <param name="hundredThousandAndTenThousandOfPosition">十万位 万位</param>
|
||||
/// <param name="millionsAndMillionOfPosition">千万位 百万位</param>
|
||||
/// <param name="hundredMillionAndBillionOfPosition">十亿位 亿位</param>
|
||||
/// <param name="hundredBillionsAndBillionsOfPosition">千亿位 百亿位</param>
|
||||
/// <returns></returns>
|
||||
private string AnalysisA12(string tenDigitNumberAndSingleDigitNumber, string hundredsOfPositionAndThousandOfPosition, string hundredThousandOfPositionAndTenThousandOfPosition,
|
||||
string millionsOfPositionAndMillionOfPosition, string billionOfPositionAndHundredMillionOfPosition, string hundredBillionsOfPositionAndBillionsOfPosition)
|
||||
private string AnalysisA12(string tenDigitAndSingleDigitNumber, string thousandAndHundredsOfPosition, string hundredThousandAndTenThousandOfPosition,
|
||||
string millionsAndMillionOfPosition, string hundredMillionAndBillionOfPosition, string hundredBillionsAndBillionsOfPosition)
|
||||
{
|
||||
|
||||
var value = $"{hundredBillionsOfPositionAndBillionsOfPosition}{billionOfPositionAndHundredMillionOfPosition}{millionsOfPositionAndMillionOfPosition}" +
|
||||
$"{hundredThousandOfPositionAndTenThousandOfPosition}{hundredsOfPositionAndThousandOfPosition}{tenDigitNumberAndSingleDigitNumber}";
|
||||
var value = $"{hundredBillionsAndBillionsOfPosition}{hundredMillionAndBillionOfPosition}{millionsAndMillionOfPosition}" +
|
||||
$"{hundredThousandAndTenThousandOfPosition}{thousandAndHundredsOfPosition}{tenDigitAndSingleDigitNumber}";
|
||||
|
||||
return value;
|
||||
}
|
||||
@ -471,14 +484,17 @@ namespace JiShe.CollectBus.Protocol.Contracts.Abstracts
|
||||
/// <param name="tenThousandPositionsAndThousandthPercentile">千分,万分</param>
|
||||
/// <param name="decilesAndPercentile">十分、百分</param>
|
||||
/// <param name="tenDigitNumberAndSingleDigitNumber">十位、个位</param>
|
||||
/// <param name="thousandOfPositionAndHundredsOfPosition">千位、百位</param>
|
||||
/// <param name="hundredThousandOfPositionAndTenThousandOfPosition">十万位、万位</param>
|
||||
/// <param name="thousandAndHundredsOfPosition">千位、百位</param>
|
||||
/// <param name="hundredThousandAndTenThousandOfPosition">十万位、万位</param>
|
||||
/// <returns></returns>
|
||||
private decimal AnalysisA14(string tenThousandPositionsAndThousandthPercentile, string decilesAndPercentile,
|
||||
string tenDigitNumberAndSingleDigitNumber, string thousandOfPositionAndHundredsOfPosition, string hundredThousandOfPositionAndTenThousandOfPosition)
|
||||
string tenDigitNumberAndSingleDigitNumber, string thousandAndHundredsOfPosition, string hundredThousandAndTenThousandOfPosition)
|
||||
{
|
||||
if (tenThousandPositionsAndThousandthPercentile.IsEE() && decilesAndPercentile.IsEE() && tenDigitNumberAndSingleDigitNumber.IsEE()
|
||||
&& thousandAndHundredsOfPosition.IsEE() && hundredThousandAndTenThousandOfPosition.IsEE())
|
||||
return 0;
|
||||
|
||||
var value = decimal.Parse($"{hundredThousandOfPositionAndTenThousandOfPosition}{thousandOfPositionAndHundredsOfPosition}" +
|
||||
var value = decimal.Parse($"{hundredThousandAndTenThousandOfPosition}{thousandAndHundredsOfPosition}" +
|
||||
$"{tenDigitNumberAndSingleDigitNumber}.{decilesAndPercentile}{tenThousandPositionsAndThousandthPercentile}");
|
||||
|
||||
return value;
|
||||
@ -561,6 +577,9 @@ namespace JiShe.CollectBus.Protocol.Contracts.Abstracts
|
||||
|
||||
private decimal AnalysisA25(string percentileAndThousandthPercentile,string singleDigitNumberAndDeciles, string hundredDigitNumbersAndTenDigitNumber)
|
||||
{
|
||||
if (percentileAndThousandthPercentile.IsEE() && singleDigitNumberAndDeciles.IsEE() && hundredDigitNumbersAndTenDigitNumber.IsEE())
|
||||
return 0;
|
||||
|
||||
var bin1 = hundredDigitNumbersAndTenDigitNumber.HexToBin().PadLeft(8, '0');
|
||||
var hundredDigitNumbers = bin1.Substring(1, 3).BinToDec();//百位
|
||||
var tenDigitNumber = bin1.Substring(4).BinToDec();//十位
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user