Add ExtBoard_Verify() & NPLC = 5

This commit is contained in:
YuYang Shen
2025-06-11 10:23:23 +08:00
parent fc794c971c
commit 7af77b7cfe
16 changed files with 755 additions and 28 deletions
+644 -13
View File
@@ -18,6 +18,7 @@ using Testrong.Core.Model.Ppmu;
using Testrong.Core.Model.Relay;
using Testrong.Core.Primitives;
using Testrong.Core.Primitives.Extend;
using Testrong.Core.Primitives.Service.AcTiming;
using Testrong.Core.Primitives.TestrongSystem;
namespace Testrong.User.Program
@@ -2802,7 +2803,7 @@ namespace Testrong.User.Program
List<SiteInfo> siList = DPS.Measure(DpsPinName, true, context.BinHandler.GetBinningByTestSuite("ExtCalibration_FVMV"), testParaSet_dps_fvmv[Range].avgTimes, testParaSet_dps_fvmv[Range].samDelay);
double chResult = GetATEChannelMeasure(siList, DpsPinName);
double[] readTemp = DPS.ReadTemperature();
int TempIndex = GetDPSTempSensorIndex(ch);
int TempIndex = GetDPSTempSensorIndex(ListChannels[loopk]);
double chTemp;
if (TempIndex > readTemp.Length - 1 )
{
@@ -2841,7 +2842,7 @@ namespace Testrong.User.Program
List<SiteInfo> siList = DPS.Measure(DpsPinName, true, context.BinHandler.GetBinningByTestSuite("ExtCalibration_FVMI"), testParaSet_dps_fvmi[Range].avgTimes, testParaSet_dps_fvmi[Range].samDelay);
double chResult = GetATEChannelMeasure(siList, DpsPinName);
double[] readTemp = DPS.ReadTemperature();
int TempIndex = GetDPSTempSensorIndex(ch);
int TempIndex = GetDPSTempSensorIndex(ListChannels[loopk]);
double chTemp;
if (TempIndex > readTemp.Length - 1 )
{
@@ -2889,7 +2890,7 @@ namespace Testrong.User.Program
List<SiteInfo> siList = DPS.Measure(DpsPinName, true, context.BinHandler.GetBinningByTestSuite("ExtCalibration_FVMI"), testParaSet_dps_fvmi[Range].avgTimes, testParaSet_dps_fvmi[Range].samDelay);
double chResult = GetATEChannelMeasure(siList, DpsPinName);
double[] readTemp = DPS.ReadTemperature();
int TempIndex = GetDPSTempSensorIndex(ch);
int TempIndex = GetDPSTempSensorIndex(ListChannels[loopk]);
double chTemp;
if (TempIndex > readTemp.Length - 1 )
{
@@ -2955,7 +2956,7 @@ namespace Testrong.User.Program
List<SiteInfo> siList = DPS.Measure(DpsPinName, true, context.BinHandler.GetBinningByTestSuite("ExtCalibration_FIMV"), testParaSet_dps_fimv[Range].avgTimes, testParaSet_dps_fimv[Range].samDelay);
double chResult = GetATEChannelMeasure(siList, DpsPinName);
double[] readTemp = DPS.ReadTemperature();
int TempIndex = GetDPSTempSensorIndex(ch);
int TempIndex = GetDPSTempSensorIndex(ListChannels[loopk]);
double chTemp;
if (TempIndex > readTemp.Length - 1 )
{
@@ -3218,7 +3219,7 @@ namespace Testrong.User.Program
double[] ForceValue = new double[SampliCount];
double[] DMMValue = new double[SampliCount];
double[] TempValue = new double[SampliCount];
double[] customData = new double[65535];
StreamWriter sw = new StreamWriter(filename, true, Encoding.UTF8)
{
AutoFlush = true
@@ -3232,20 +3233,22 @@ namespace Testrong.User.Program
PPMU.Force(PmuPinName, 0, PpmuMode.FVMV, PpmuIRange._2mA, VRange.Normal);
List<SiteInfo> zero_V_List = PPMU.Measure(PmuPinName, true, context.BinHandler.GetBinningByTestSuite("ExtCalibration_FVMV"), 128, 100);
double zeroVResult = GetATEChannelMeasure(zero_V_List, PmuPinName);
sw.Write($"Force_0V_MV={zeroVResult * 1000:F8}mV\n");
//sw.Write($"Force_0V_MV={zeroVResult * 1000:F8}mV\n");
customData[0] = zeroVResult;
//Force 0V Measure Current
PPMU.Force(PmuPinName, 0, PpmuMode.FVMI, PpmuIRange._2mA, VRange.Normal);
List<SiteInfo> zero_I_List = PPMU.Measure(PmuPinName, true, context.BinHandler.GetBinningByTestSuite("ExtCalibration_FVMI"), 128, 100);
double zeroIResult = GetATEChannelMeasure(zero_I_List, PmuPinName);
sw.Write($"Force_0V_MI={zeroIResult * 1000:F8}mA\n");
//sw.Write($"Force_0V_MI={zeroIResult * 1000:F8}mA\n");
customData[1] = zeroIResult;
sw.Write("Force Voltage(mV),Measure Voltage(mV),Measure Current(mA),Diff_Voltage(mV),Resistance(FV/MI),Resistance(Caled)\n");
for (int p = 0; p < 50; p++)
{
PPMU.Force(PmuPinName, ForceV, PpmuMode.FVMI, PpmuIRange._2mA, VRange.Normal);
sw.Write($"{ForceV * 1000:F8},");
Thread.Sleep(20);
List<SiteInfo> siList = PPMU.Measure(PmuPinName, true, context.BinHandler.GetBinningByTestSuite("ExtCalibration_FVMI"), 128, 100);
double chResult = GetATEChannelMeasure(siList, PmuPinName);
@@ -3253,11 +3256,13 @@ namespace Testrong.User.Program
PPMU.Force(PmuPinName, ForceV, PpmuMode.FVMV, PpmuIRange._2mA, VRange.Normal);
List<SiteInfo> svList = PPMU.Measure(PmuPinName, true, context.BinHandler.GetBinningByTestSuite("ExtCalibration_FVMV"), 128, 100);
double chVResult = GetATEChannelMeasure(svList, PmuPinName);
sw.Write($"{chVResult * 1000:F8},");
sw.Write($"{chResult * 1000:F8},");
sw.Write($"{(chVResult - ForceV) * 1000:F8},");
sw.Write($"{ForceV / chResult:F8},");
sw.Write($"{(ForceV - zeroVResult) / (chResult - zeroIResult):F8}\n");
double[] readTemp = PPMU.ReadTemperature();
double chTemp = readTemp[GetPMUTempSensorIndex(ch)];
ForceValue[p] = ForceV;
customData[p + 2] = chVResult;
AteMeasure[p] = chResult;
TempValue[p] = chTemp;
//ForceCurrent += CurrentStep;
ForceV += Vstep;
}
@@ -3303,6 +3308,621 @@ namespace Testrong.User.Program
SlotThreadLocker(SlotNum: SlotNum, slotList: slotList, pathFlag: "CAL");
}
void Rint_FVMI_Test(IFlowRunnerContext context, TestVersion testVersion)
{
#region Init Config & Variables
List<int> ChannelDps = new List<int>();
List<int> ChannelPmu = new List<int>();
//-----Select PreTest or ReTest-----
for (int m = 0; m < 256; m++)
{
ChannelPmu.Add(m + 1);
}
//-----get all connect slot number-----
var slotInfos = context.FlowCatalog.GetAll<SlotInfo>();
List<int> slotList = new List<int>();
for (int slotLen = 0; slotLen < slotInfos.Count; slotLen++)
{
if (slotInfos[slotLen].FirmwareVersion == "")
{
continue;
}
slotList.Add(slotInfos[slotLen].No);
}
//-----config Board-----
byte[] armDnaPortCmd = new byte[2] { 14, 57 };
byte[] armDnaRaw = context.Communicator.Send(armDnaPortCmd);
armDnaRaw = armDnaRaw.Reverse().ToArray();
string arm_dna = BitConverter.ToUInt64(armDnaRaw, 0).ToString();
int SlotNum = context.Communicator.SlotNo;
Dictionary<int, int> M013_PMU = new Dictionary<int, int>()
{
{166,178 },
{167,177 },
{168,176 },
{169,175 },
{230,242 },
{231,241 },
{232,240 },
{233,239 }
};
//-----Move File To History-----
File_Mover(SlotNum: SlotNum, slotList: slotList, pathFlag: "CAL_Single");
//---------Thread Locker--------
SlotThreadLocker(SlotNum: SlotNum, slotList: slotList, pathFlag: "CAL", lockFlag: true);
//-----Start Write MetaData-----
StreamWriter swdata;
swdata = new StreamWriter(METADATA_PATH, true, Encoding.UTF8)
{
AutoFlush = true
};
Metadata_handler(
swdata: swdata,
SlotNum: SlotNum,
slotList: slotList,
arm_dna: arm_dna,
context: context,
init_Flag: true
);
#endregion
#region Config DMM
//-----config dmm3458A and ExtCalibrationBoard-----
KeysightDMM3458A dmm = new KeysightDMM3458A();
ExternalCalibrationHandle extCaliHandle = new ExternalCalibrationHandle();
string extConnStr = Select_IP[testVersion];
int extPort = port;
dmm.InitDMM(ksightConnStr);
#endregion
//-----Read R File-----
double[,] ExtBoard_Res = ReadRext(EXT_CAL_INIT_PATH + "ExtBoardRes.csv");
extCaliHandle.SetPpmuExternalCalibration(extConnStr, extPort, 1, ExternalCalibrationMode.Channel, 1, ExtCaliVI.V, ExtCaliLoad.RC_RL7, 0); //1kΩ
double rload = GetRloadValue(dmm, 2000, 5);
string filetime = DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss");
#region The Test
for (int loopk = 0; loopk < 256; loopk++)
{
int ch = ChannelPmu[loopk];
int ch1 = ChannelPmu[loopk];
if (ChannelPmu[loopk] >= 1 && ChannelPmu[loopk] <= 18)
{
ch1 = ChannelPmu[loopk] + 46;
}
else if (ChannelPmu[loopk] >= 19 && ChannelPmu[loopk] <= 23)
{
ch1 = ChannelPmu[loopk] + 110;
}
else if (ChannelPmu[loopk] >= 24 && ChannelPmu[loopk] <= 46)
{
ch1 = ChannelPmu[loopk];
}
else if (ChannelPmu[loopk] >= 47 && ChannelPmu[loopk] <= 64)
{
ch1 = ChannelPmu[loopk] - 46;
}
else if (ChannelPmu[loopk] >= 65 && ChannelPmu[loopk] <= 82)
{
ch1 = ChannelPmu[loopk] + 46;
}
else if (ChannelPmu[loopk] >= 83 && ChannelPmu[loopk] <= 87)
{
ch1 = ChannelPmu[loopk] + 110;
}
else if (ChannelPmu[loopk] >= 88 && ChannelPmu[loopk] <= 110)
{
ch1 = ChannelPmu[loopk];
}
else if (ChannelPmu[loopk] >= 111 && ChannelPmu[loopk] <= 113)
{
ch1 = ChannelPmu[loopk] - 46;
}
else if (ChannelPmu[loopk] >= 114 && ChannelPmu[loopk] <= 128)
{
ch1 = ChannelPmu[loopk] - 46;
}
else if (ChannelPmu[loopk] >= 129 && ChannelPmu[loopk] <= 133)
{
ch1 = ChannelPmu[loopk] - 110;
}
else if (ChannelPmu[loopk] >= 134 && ChannelPmu[loopk] <= 147)
{
ch1 = ChannelPmu[loopk] + 45;
}
else if (ChannelPmu[loopk] >= 148 && ChannelPmu[loopk] <= 165)
{
ch1 = ChannelPmu[loopk] + 9;
}
else if (ChannelPmu[loopk] >= 166 && ChannelPmu[loopk] <= 169)
{
ch1 = M013_PMU[ChannelPmu[loopk]];
}
else if (ChannelPmu[loopk] >= 170 && ChannelPmu[loopk] <= 172)
{
ch1 = ChannelPmu[loopk] - 36;
}
else if (ChannelPmu[loopk] >= 173 && ChannelPmu[loopk] <= 192)
{
ch1 = ChannelPmu[loopk] - 36;
}
else if (ChannelPmu[loopk] >= 193 && ChannelPmu[loopk] <= 197)
{
ch1 = ChannelPmu[loopk] - 110;
}
else if (ChannelPmu[loopk] >= 198 && ChannelPmu[loopk] <= 211)
{
ch1 = ChannelPmu[loopk] + 45;
}
else if (ChannelPmu[loopk] >= 212 && ChannelPmu[loopk] <= 229)
{
ch1 = ChannelPmu[loopk] + 9;
}
else if (ChannelPmu[loopk] >= 230 && ChannelPmu[loopk] <= 233)
{
ch1 = M013_PMU[ChannelPmu[loopk]];
}
else if (ChannelPmu[loopk] >= 234 && ChannelPmu[loopk] <= 256)
{
ch1 = ChannelPmu[loopk] - 36;
}
#region Test Config
double ForceVoltage = -2;
double VoltageStep = 1;
string[] PmuPinName = { ("A" + (ChannelPmu[loopk] < 10 ? "0" : "") + ChannelPmu[loopk]) };
// int ch = ChannelPmu[loopk];
double[] AteMeasure = new double[SampliCount];
double[] ForceValue = new double[SampliCount];
double[] DMMValue = new double[SampliCount];
double[] TempValue = new double[SampliCount];
RELAY.SwitchMode(RelayMode.Open);
RELAY.SwitchToPPMU(PmuPinName);
string filepath = "Slot" + SlotNum + "_PMU_" + "ch" + ChannelPmu[loopk] + "_" + "FVMV" + "_" + "Hi-Z" + "_" + "2mA" + ".csv";
string filename = EXT_CAL_PATH + filepath;
#endregion
extCaliHandle.SetPpmuExternalCalibration(extConnStr, extPort, SlotNum, ExternalCalibrationMode.Channel, ch1, ExtCaliVI.V, ExtCaliLoad.RC_RL7, 0);//change channel
if (loopk == 0)
{
DelayHelper.Sleep(20);
}
#region Actual Test
for (int p = 0; p < SampliCount; p++)
{
PPMU.Force(PmuPinName, ForceVoltage, PpmuMode.FVMV, PpmuIRange._2mA, VRange.Normal);
Thread.Sleep(20);
List<SiteInfo> siList = PPMU.Measure(PmuPinName, true, context.BinHandler.GetBinningByTestSuite("ExtCalibration_FVMV"), 128, 100);
double chResult = GetATEChannelMeasure(siList, PmuPinName);
double dmmRead = dmm.GetDmmMeasureData(KeysightDMM3458A.KeysightMeasMode.VOLT, 1, 7.5);
double[] readTemp = PPMU.ReadTemperature();
double chTemp = readTemp[GetPMUTempSensorIndex(ch)];
ForceValue[p] = ForceVoltage;
AteMeasure[p] = chResult;
DMMValue[p] = dmmRead;
TempValue[p] = chTemp;
ForceVoltage += VoltageStep;
}
#endregion
PPMU.Force(PmuPinName, 0, PpmuMode.FVMV, PpmuIRange._2mA, VRange.Normal);
#region File Writing
StreamWriter sw = new StreamWriter(filename, true, Encoding.UTF8)
{
AutoFlush = true
};
WriteSingleFile(sw: sw,
slot: SlotNum,
dna: arm_dna,
type: "PMU",
channel: ch,
mode: "FVMV",
rload: rload.ToString(),
extR: ExtBoard_Res,
range: "2mA",
ForceValue: ForceValue,
AteMeasure: AteMeasure,
DmmMeasure: DMMValue,
TempValue: TempValue);
sw.Flush();
sw.Close();
Metadata_handler(swdata: swdata,
SlotNum: SlotNum,
slotList: slotList,
arm_dna: arm_dna,
context: context,
init_Flag: false,
Type: "PMU",
Channel: ch,
Mode: "FVMV",
Rload: rload.ToString(),
Range: "2mA",
filepath: filepath,
filetime: filetime);
#endregion
}
#endregion
swdata.Flush();
swdata.Close();
Thread.Sleep(1000);
#region Post Process
#region File Process
StreamReader metareader = new StreamReader(METADATA_PATH, Encoding.UTF8);
List<string> dnaip = new List<string>();
List<string> path = new List<string>();
List<string> datassingle = new List<string>();
int cnnt = 0;
while (!metareader.EndOfStream)
{
string str = metareader.ReadLine();
if (cnnt > 6)
{
if (str.Split(',')[0] == arm_dna)
{
path.Add(str);
}
}
cnnt = cnnt + 1;
}
metareader.Close();
string pmurapth = EXT_CAL_PATH + context.Communicator.ServerIP + "_" + "Pmur" + ".txt";
StreamWriter Pmur = new StreamWriter(pmurapth, true);
Pmur.AutoFlush = true;
#endregion
#region Rint Calculation
for (int p = 0; p < path.Count; p++)
{
string dna = path[p].Split(',')[0];
string file = path[p].Split(',')[8];
StreamReader singlefile = new StreamReader(EXT_CAL_PATH + file, Encoding.UTF8);
while (!singlefile.EndOfStream)
{
datassingle.Add(singlefile.ReadLine());
}
double RL = Convert.ToDouble(datassingle[6].Split(',')[1]);//150
double rext = Convert.ToDouble(datassingle[8].Split(',')[1]);
int ChannelNum = Convert.ToInt32(datassingle[4].Split(',')[1]);
double res = 0;
for (int linefile = 14; linefile < 19; linefile++)
{
if (linefile == 16)
{
continue;
}
double ateV = Convert.ToDouble(datassingle[linefile].Split(',')[1]);
double voltage = Convert.ToDouble(datassingle[linefile].Split(',')[2]);
double iii = voltage / RL; //???
double diff = ateV - voltage;
double rrr = diff / iii; //???
res = res + (rrr - rext); //Rint?
}
res = res / 4; //Average
string ChannelFormat;
if (ChannelNum < 10)
{
ChannelFormat = "00" + Convert.ToString(ChannelNum);
}
else if ((ChannelNum >= 10) && (ChannelNum < 100))
{
ChannelFormat = "0" + Convert.ToString(ChannelNum);
}
else
{
ChannelFormat = Convert.ToString(ChannelNum);
}
Pmur.WriteLine($"ch {ChannelFormat} : {res:F3}");
rInt[ChannelNum - 1] = res; //Put R_Int into array
datassingle.Clear();
singlefile.Close();
}
#endregion
Pmur.Close();
#endregion
#region Thread Lock
SlotThreadLocker(SlotNum: SlotNum, slotList: slotList, pathFlag: "CAL", lockFlag: false);
#endregion
}
/// <summary>
/// Verify if the ExtCalibration Board is working as it should.
/// </summary>
/// <param name="context"></param>
/// <param name="testVersion"></param>
void ExtBoard_Verify(IFlowRunnerContext context,TestVersion testVersion,double diff_Limit)
{
#region Init Config & Variables
List<int> ChannelDps = new List<int>();
List<int> ChannelPmu = new List<int>();
//-----Select PreTest or ReTest-----
for (int m = 0; m < 256; m++)
{
ChannelPmu.Add(m + 1);
}
//-----get all connect slot number-----
var slotInfos = context.FlowCatalog.GetAll<SlotInfo>();
List<int> slotList = new List<int>();
for (int slotLen = 0; slotLen < slotInfos.Count; slotLen++)
{
if (slotInfos[slotLen].FirmwareVersion == "")
{
continue;
}
slotList.Add(slotInfos[slotLen].No);
}
//-----config Board-----
byte[] armDnaPortCmd = new byte[2] { 14, 57 };
byte[] armDnaRaw = context.Communicator.Send(armDnaPortCmd);
armDnaRaw = armDnaRaw.Reverse().ToArray();
string arm_dna = BitConverter.ToUInt64(armDnaRaw, 0).ToString();
int SlotNum = context.Communicator.SlotNo;
//-----Move File To History-----
File_Mover(SlotNum: SlotNum, slotList: slotList, pathFlag: "CAL_Single");
//---------Thread Locker--------
SlotThreadLocker(SlotNum: SlotNum, slotList: slotList, pathFlag: "CAL", lockFlag: true);
//-----Start Write MetaData-----
StreamWriter swdata;
swdata = new StreamWriter(METADATA_PATH, true, Encoding.UTF8)
{
AutoFlush = true
};
Metadata_handler(
swdata: swdata,
SlotNum: SlotNum,
slotList: slotList,
arm_dna: arm_dna,
context: context,
init_Flag: true
);
#endregion
#region Config DMM
//-----config dmm3458A and ExtCalibrationBoard-----
KeysightDMM3458A dmm = new KeysightDMM3458A();
ExternalCalibrationHandle extCaliHandle = new ExternalCalibrationHandle();
string extConnStr = Select_IP[testVersion];
int extPort = port;
dmm.InitDMM(ksightConnStr);
#endregion
//-----Read R File-----
double[,] ExtBoard_Res = ReadRext(EXT_CAL_INIT_PATH + "ExtBoardRes.csv");
string filetime = DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss");
#region The Test
extCaliHandle.SetPpmuExternalCalibration(extConnStr, extPort, 1, ExternalCalibrationMode.Channel, 1, ExtCaliVI.I, ExtCaliLoad.RC_RL18, 0);
double rload = GetRloadValue(dmm, 2000, 5);
if (rload > 1)
{
throw new Exception("rload larger than 1");
}
for (int loopk = 0; loopk < 256; loopk++)
{
int ch = ChannelPmu[loopk];
#region Test Config
string[] PmuPinName = { ("A" + (ChannelPmu[loopk] < 10 ? "0" : "") + ChannelPmu[loopk]) };
RELAY.SwitchMode(RelayMode.Open);
RELAY.SwitchToPPMU(PmuPinName);
double ForceVoltage = -0.015;
double VoltageStep = 0.0075;
string filepath = "Slot" + SlotNum + "_PMU_" + "ch" + ChannelPmu[loopk] + "_" + "FVMI" + "_" + "Hi-Z" + "_" + "2mA" + ".csv";
string filename = EXT_CAL_PATH + filepath;
// int ch = ChannelPmu[loopk];
double[] AteMeasure = new double[SampliCount];
double[] ForceValue = new double[SampliCount];
double[] DMMValue = new double[SampliCount];
double[] TempValue = new double[SampliCount];
#endregion
extCaliHandle.SetPpmuExternalCalibration(extConnStr, extPort, SlotNum, ExternalCalibrationMode.Channel, ch, ExtCaliVI.I, ExtCaliLoad.RC_RL18, 0);//change channel
if (loopk == 0)
{
DelayHelper.Sleep(20);
}
#region Actual Test
for (int p = 0; p < SampliCount; p++)
{
PPMU.Force(PmuPinName, ForceVoltage, PpmuMode.FVMI, PpmuIRange._2mA, VRange.Normal);
Thread.Sleep(20);
List<SiteInfo> siList = PPMU.Measure(PmuPinName, true, context.BinHandler.GetBinningByTestSuite("ExtCalibration_FVMI"), 128, 100);
double chResult = GetATEChannelMeasure(siList, PmuPinName);
double dmmRead = dmm.GetDmmMeasureData(KeysightDMM3458A.KeysightMeasMode.CURR, 1, 1);
double[] readTemp = PPMU.ReadTemperature();
double chTemp = readTemp[GetPMUTempSensorIndex(ch)];
ForceValue[p] = ForceVoltage;
AteMeasure[p] = chResult;
DMMValue[p] = dmmRead;
TempValue[p] = chTemp;
ForceVoltage += VoltageStep;
}
#endregion
PPMU.Force(PmuPinName, 0, PpmuMode.FVMV, PpmuIRange._2mA, VRange.Normal);
#region File Writing
StreamWriter sw = new StreamWriter(filename, true, Encoding.UTF8)
{
AutoFlush = true
};
WriteSingleFile(sw: sw,
slot: SlotNum,
dna: arm_dna,
type: "PMU",
channel: ch,
mode: "FVMV",
rload: "Hi-Z",
extR: ExtBoard_Res,
range: "2mA",
ForceValue: ForceValue,
AteMeasure: AteMeasure,
DmmMeasure: DMMValue,
TempValue: TempValue);
sw.Flush();
sw.Close();
Metadata_handler(swdata: swdata,
SlotNum: SlotNum,
slotList: slotList,
arm_dna: arm_dna,
context: context,
init_Flag: false,
Type: "PMU",
Channel: ch,
Mode: "FVMI",
Rload: "Hi-Z",
Range: "2mA",
filepath: filepath,
filetime: filetime);
#endregion
}
#endregion
swdata.Flush();
swdata.Close();
#region Post Process
#region File Process
StreamReader metareader = new StreamReader(METADATA_PATH, Encoding.UTF8);
List<string> dnaip = new List<string>();
List<string> path = new List<string>();
List<string> datassingle = new List<string>();
int cnnt = 0;
while (!metareader.EndOfStream)
{
string str = metareader.ReadLine();
if (cnnt > 6)
{
if (str.Split(',')[0] == arm_dna)
{
path.Add(str);
}
}
cnnt = cnnt + 1;
}
metareader.Close();
string pmurapth = EXT_CAL_PATH + context.Communicator.ServerIP + "_" + "Pmur" + ".txt";
StreamWriter Pmur = new StreamWriter(pmurapth, true);
Pmur.AutoFlush = true;
#endregion
#region Rint Calculation
for (int p = 0; p < path.Count; p++)
{
string dna = path[p].Split(',')[0];
string file = path[p].Split(',')[8];
StreamReader singlefile = new StreamReader(EXT_CAL_PATH + file, Encoding.UTF8);
while (!singlefile.EndOfStream)
{
datassingle.Add(singlefile.ReadLine());
}
int ChannelNum = Convert.ToInt32(datassingle[4].Split(',')[1]);
double res = 0;
double sum = 0;
for (int linefile = 14; linefile < 19; linefile++)
{
if (linefile == 16)
{
continue;
}
double forceV = Convert.ToDouble(datassingle[linefile].Split(',')[0]);
double voltage = Convert.ToDouble(datassingle[linefile].Split(',')[2]);
res = forceV / voltage;
sum += res;
}
res = sum / 4; //Average
rInt[ChannelNum - 1] = res; //Put R_Int into array
datassingle.Clear();
singlefile.Close();
}
double diff = 0;
for (int i = 0; i < path.Count - 1; i++)
{
if (Math.Abs(rInt[i] - rInt[i + 1]) > diff) //Check R Diff
{
diff = Math.Abs(rInt[i] - rInt[i + 1]);
}
if (diff > diff_Limit)
{
Pmur.WriteLine($"Failed! At Channel {i + 1}, Diff={diff}");
break;
}
if (diff == 0 || Math.Abs(rInt[i])>50) //Same Value OR Unreasonable Value
{
Pmur.WriteLine($"Failed! At Channel {i + 1}, Diff={diff}");
break;
}
}
if (Math.Abs(rInt[path.Count - 1])>50) //We shall check the last Channel
{
Pmur.WriteLine($"Failed! At Channel {path.Count}, Diff={diff}");
}
else if (diff < diff_Limit)
{
Pmur.WriteLine($"Passed! Max Diff={diff}");
}
for (global::System.Int32 i = 0; i < path.Count; i++)
{
string ChannelFormat;
if (i < 9)
{
ChannelFormat = "00" + Convert.ToString(i+1);
}
else if ((i >= 9) && (i < 99))
{
ChannelFormat = "0" + Convert.ToString(i+1);
}
else
{
ChannelFormat = Convert.ToString(i+1);
}
Pmur.WriteLine($"ch {ChannelFormat} : {rInt[i]:F3}");
}
#endregion
Pmur.Close();
#endregion
SlotThreadLocker(SlotNum: SlotNum, slotList: slotList, pathFlag: "CAL");
}
#endregion
[TestrongTestCase]
@@ -3349,6 +3969,17 @@ namespace Testrong.User.Program
Rint_DataUpload(context);
}
[TestrongTestCase]
public void Check_ExtBoard(IFlowRunnerContext context)
{
ExtBoard_Verify(context, SelectTestVersion, 5);
}
[TestrongTestCase]
public void Rint_test(IFlowRunnerContext context)
{
Rint_FVMI_Test(context, SelectTestVersion);
}
[TestrongTestCase]
public void Rint_Post(IFlowRunnerContext context)
{
Rint_FVMV_2mA_Post(context, SelectTestVersion);