增加pmu通道数的全局变量,可以方便控制PMU测试的通道数,增加SampliCount传参,方便控制测试点数,修改读校准板阻值文件的函数,现在会根据文件提供的实际槽位文件读取,文件不必写满12个slot的数值

This commit is contained in:
2025-09-11 16:37:05 +08:00
parent 89aec53990
commit 2e40d40a40
18 changed files with 668 additions and 124 deletions
+373 -89
View File
@@ -99,11 +99,11 @@ namespace Testrong.User.Program
#region FVMV
Dictionary<string, TestParaSet> avgDelays_fvmv_pmu = new Dictionary<string, TestParaSet>()
{
{"5uA", new TestParaSet{delayMs = 40, avgTimes = 64, samDelay = 100 } },
{"20uA", new TestParaSet{delayMs = 20, avgTimes = 64, samDelay = 100 } },
{"200uA", new TestParaSet{delayMs = 15, avgTimes = 64, samDelay = 100 } },
{"2mA", new TestParaSet{delayMs = 15, avgTimes = 64, samDelay = 100 } },
{"60mA", new TestParaSet{delayMs = 15, avgTimes = 64, samDelay = 100 } },
{"5uA", new TestParaSet{delayMs = 40, avgTimes = 255, samDelay = 100 } },
{"20uA", new TestParaSet{delayMs = 20, avgTimes = 255, samDelay = 100 } },
{"200uA", new TestParaSet{delayMs = 15, avgTimes = 255, samDelay = 100 } },
{"2mA", new TestParaSet{delayMs = 15, avgTimes = 255, samDelay = 100 } },
{"60mA", new TestParaSet{delayMs = 15, avgTimes = 128, samDelay = 100 } },
};
Dictionary<string, TestParaSet> avgDelays_fvmv_dps = new Dictionary<string, TestParaSet>()
@@ -113,17 +113,17 @@ namespace Testrong.User.Program
{"200uA", new TestParaSet{delayMs = 15, avgTimes = 64, samDelay = 100 } },
{"2mA", new TestParaSet{delayMs = 15, avgTimes = 64, samDelay = 100 } },
{"60mA", new TestParaSet{delayMs = 15, avgTimes = 64, samDelay = 100 } },
{"1A", new TestParaSet{delayMs = 30, avgTimes = 128, samDelay = 100 } },
{"1A", new TestParaSet{delayMs = 30, avgTimes = 255, samDelay = 100 } },
};
#endregion
#region FZMV
Dictionary<string, TestParaSet> avgDelays_fzmv_pmu = new Dictionary<string, TestParaSet>()
{
{"5uA", new TestParaSet{delayMs = 30, avgTimes = 64, samDelay = 100 } },
{"20uA", new TestParaSet{delayMs = 10, avgTimes = 64, samDelay = 100 } },
{"200uA", new TestParaSet{delayMs = 10, avgTimes = 64, samDelay = 100 } },
{"2mA", new TestParaSet{delayMs = 10, avgTimes = 64, samDelay = 100 } },
{"60mA", new TestParaSet{delayMs = 10, avgTimes = 64, samDelay = 100 } },
{"5uA", new TestParaSet{delayMs = 30, avgTimes = 200 ,samDelay = 100 } },
{"20uA", new TestParaSet{delayMs = 10, avgTimes = 200, samDelay = 100 } },
{"200uA", new TestParaSet{delayMs = 10, avgTimes = 200, samDelay = 100 } },
{"2mA", new TestParaSet{delayMs = 10, avgTimes = 200, samDelay = 100 } },
{"60mA", new TestParaSet{delayMs = 10, avgTimes = 128, samDelay = 100 } },
};
#endregion
#region FIMV PMU
@@ -137,19 +137,19 @@ namespace Testrong.User.Program
};
Dictionary<string, TestParaSet> avgDelays_1kcp_fimv_pmu = new Dictionary<string, TestParaSet>()
{
{"5uA", new TestParaSet{delayMs = 60, avgTimes = 128, samDelay = 100 } },
{"20uA", new TestParaSet{delayMs = 20, avgTimes = 64, samDelay = 100 } },
{"5uA", new TestParaSet{delayMs = 200, avgTimes = 255, samDelay = 200 } },
{"20uA", new TestParaSet{delayMs = 20, avgTimes = 255, samDelay = 100 } },
{"200uA", new TestParaSet{delayMs = 15, avgTimes = 64, samDelay = 100 } },
{"2mA", new TestParaSet{delayMs = 15, avgTimes = 64, samDelay = 100 } },
{"60mA", new TestParaSet{delayMs = 30, avgTimes = 255, samDelay = 100 } },
};
Dictionary<string, TestParaSet> avgDelays_2kft_fimv_pmu = new Dictionary<string, TestParaSet>()
{
{"5uA", new TestParaSet{delayMs = 60, avgTimes = 128, samDelay = 100 } },
{"20uA", new TestParaSet{delayMs = 20, avgTimes = 64, samDelay = 100 } },
{"200uA", new TestParaSet{delayMs = 15, avgTimes = 64, samDelay = 100 } },
{"2mA", new TestParaSet{delayMs = 15, avgTimes = 64, samDelay = 100 } },
{"60mA", new TestParaSet{delayMs = 30, avgTimes = 128, samDelay = 100 } },
{"5uA", new TestParaSet{delayMs = 60, avgTimes = 255, samDelay = 300 } },
{"20uA", new TestParaSet{delayMs = 60, avgTimes = 255, samDelay = 200 } },
{"200uA", new TestParaSet{delayMs = 20, avgTimes = 255, samDelay = 100 } },
{"2mA", new TestParaSet{delayMs = 25, avgTimes = 255, samDelay = 100 } },
{"60mA", new TestParaSet{delayMs = 50, avgTimes = 255, samDelay = 400 } },
};
Dictionary<string, TestParaSet> avgDelays_ppmucp_fimv_pmu = new Dictionary<string, TestParaSet>()
{
@@ -162,10 +162,10 @@ namespace Testrong.User.Program
Dictionary<string, TestParaSet> avgDelays_ppmuft_fimv_pmu = new Dictionary<string, TestParaSet>()
{
{"5uA", new TestParaSet{delayMs = 60, avgTimes = 255, samDelay = 300 } },
{"20uA", new TestParaSet{delayMs = 20, avgTimes = 128, samDelay = 300 } },
{"200uA", new TestParaSet{delayMs = 30, avgTimes = 64, samDelay = 300 } },
{"2mA", new TestParaSet{delayMs = 15, avgTimes = 64, samDelay = 100 } },
{"60mA", new TestParaSet{delayMs = 30, avgTimes = 255, samDelay = 100 } },
{"20uA", new TestParaSet{delayMs = 60, avgTimes = 255, samDelay = 200 } },
{"200uA", new TestParaSet{delayMs = 20, avgTimes = 255, samDelay = 100 } },
{"2mA", new TestParaSet{delayMs = 25, avgTimes = 255, samDelay = 100 } },
{"60mA", new TestParaSet{delayMs = 50, avgTimes = 255, samDelay = 400 } },
};
Dictionary<string, TestParaSet> avgDelays_2km_fimv_pmu = new Dictionary<string, TestParaSet>()
{
@@ -195,11 +195,11 @@ namespace Testrong.User.Program
};
Dictionary<string, TestParaSet> avgDelays_2kft_fimv_dps = new Dictionary<string, TestParaSet>()
{
{"5uA", new TestParaSet{delayMs = 250, avgTimes = 64, samDelay = 100 } },
{"20uA", new TestParaSet{delayMs = 70, avgTimes = 32, samDelay = 100 } },
{"200uA", new TestParaSet{delayMs = 15, avgTimes = 32, samDelay = 100 } },
{"2mA", new TestParaSet{delayMs = 15, avgTimes = 32, samDelay = 100 } },
{"60mA", new TestParaSet{delayMs = 15, avgTimes = 32, samDelay = 100 } },
{"5uA", new TestParaSet{delayMs = 250, avgTimes = 16, samDelay = 100 } },
{"20uA", new TestParaSet{delayMs = 100, avgTimes = 16, samDelay = 100 } },
{"200uA", new TestParaSet{delayMs = 15, avgTimes = 16, samDelay = 100 } },
{"2mA", new TestParaSet{delayMs = 15, avgTimes = 16, samDelay = 100 } },
{"60mA", new TestParaSet{delayMs = 15, avgTimes = 16, samDelay = 100 } },
};
Dictionary<string, TestParaSet> avgDelays_ppmucp_fimv_dps = new Dictionary<string, TestParaSet>()
{
@@ -237,18 +237,18 @@ namespace Testrong.User.Program
};
Dictionary<string, TestParaSet> avgDelays_1kcp_fvmi_pmu = new Dictionary<string, TestParaSet>()
{
{"5uA", new TestParaSet{delayMs = 50, avgTimes = 255, samDelay = 200 } },
{"20uA", new TestParaSet{delayMs = 20, avgTimes = 128, samDelay = 100 } },
{"200uA", new TestParaSet{delayMs = 10, avgTimes = 64, samDelay = 100 } },
{"2mA", new TestParaSet{delayMs = 10, avgTimes = 64, samDelay = 100 } },
{"60mA", new TestParaSet{delayMs = 10, avgTimes = 128, samDelay = 100 } },
{"5uA", new TestParaSet{delayMs = 50, avgTimes = 255, samDelay = 500 } },
{"20uA", new TestParaSet{delayMs = 20, avgTimes = 255, samDelay = 200 } },
{"200uA", new TestParaSet{delayMs = 10, avgTimes = 255, samDelay = 200 } },
{"2mA", new TestParaSet{delayMs = 10, avgTimes = 255, samDelay = 200 } },
{"60mA", new TestParaSet{delayMs = 10, avgTimes = 255, samDelay = 100 } },
};
Dictionary<string, TestParaSet> avgDelays_2kft_fvmi_pmu = new Dictionary<string, TestParaSet>()
{
{"5uA", new TestParaSet{delayMs = 50, avgTimes = 255, samDelay = 500 } },
{"20uA", new TestParaSet{delayMs = 20, avgTimes = 128, samDelay = 300 } },
{"200uA", new TestParaSet{delayMs = 10, avgTimes = 64, samDelay = 100 } },
{"2mA", new TestParaSet{delayMs = 10, avgTimes = 64, samDelay = 100 } },
{"5uA", new TestParaSet{delayMs = 50, avgTimes = 255, samDelay = 300 } },
{"20uA", new TestParaSet{delayMs = 20, avgTimes = 255, samDelay = 100 } },
{"200uA", new TestParaSet{delayMs = 70, avgTimes = 255, samDelay = 100 } },
{"2mA", new TestParaSet{delayMs = 50, avgTimes = 255, samDelay = 100 } },
{"60mA", new TestParaSet{delayMs = 10, avgTimes = 255, samDelay = 100 } },
};
Dictionary<string, TestParaSet> avgDelays_ppmucp_fvmi_pmu = new Dictionary<string, TestParaSet>()
@@ -262,9 +262,9 @@ namespace Testrong.User.Program
Dictionary<string, TestParaSet> avgDelays_ppmuft_fvmi_pmu = new Dictionary<string, TestParaSet>()
{
{"5uA", new TestParaSet{delayMs = 50, avgTimes = 255, samDelay = 300 } },
{"20uA", new TestParaSet{delayMs = 20, avgTimes = 255, samDelay = 300 } },
{"200uA", new TestParaSet{delayMs = 10, avgTimes = 128, samDelay = 100 } },
{"2mA", new TestParaSet{delayMs = 10, avgTimes = 128, samDelay = 100 } },
{"20uA", new TestParaSet{delayMs = 20, avgTimes = 255, samDelay = 100 } },
{"200uA", new TestParaSet{delayMs = 70, avgTimes = 255, samDelay = 100 } },
{"2mA", new TestParaSet{delayMs = 50, avgTimes = 255, samDelay = 100 } },
{"60mA", new TestParaSet{delayMs = 10, avgTimes = 255, samDelay = 100 } },
};
Dictionary<string, TestParaSet> avgDelays_2km_fvmi_pmu = new Dictionary<string, TestParaSet>()
@@ -297,12 +297,12 @@ namespace Testrong.User.Program
};
Dictionary<string, TestParaSet> avgDelays_2kft_fvmi_dps = new Dictionary<string, TestParaSet>()
{
{"5uA", new TestParaSet{delayMs = 70, avgTimes = 255, samDelay = 200 } },
{"20uA", new TestParaSet{delayMs = 30, avgTimes = 255, samDelay = 100 } },
{"200uA", new TestParaSet{delayMs = 15, avgTimes = 128, samDelay = 100 } },
{"2mA", new TestParaSet{delayMs = 15, avgTimes = 128, samDelay = 100 } },
{"60mA", new TestParaSet{delayMs = 20, avgTimes = 128, samDelay = 100 } },
{"1A", new TestParaSet{delayMs = 20, avgTimes = 128, samDelay = 100 } },
{"5uA", new TestParaSet{delayMs = 70, avgTimes = 255, samDelay = 500 } },
{"20uA", new TestParaSet{delayMs = 30, avgTimes =255, samDelay = 100 } },
{"200uA", new TestParaSet{delayMs = 15, avgTimes = 255, samDelay = 100 } },
{"2mA", new TestParaSet{delayMs = 15, avgTimes = 255, samDelay = 100 } },
{"60mA", new TestParaSet{delayMs = 20, avgTimes = 255, samDelay = 100 } },
{"1A", new TestParaSet{delayMs = 20, avgTimes = 255, samDelay = 100 } },
};
Dictionary<string, TestParaSet> avgDelays_ppmucp_fvmi_dps = new Dictionary<string, TestParaSet>()
{
@@ -315,12 +315,12 @@ namespace Testrong.User.Program
};
Dictionary<string, TestParaSet> avgDelays_ppmuft_fvmi_dps = new Dictionary<string, TestParaSet>()
{
{"5uA", new TestParaSet{delayMs = 70, avgTimes = 255, samDelay = 500 } },
{"20uA", new TestParaSet{delayMs = 50, avgTimes = 255, samDelay = 500 } },
{"200uA", new TestParaSet{delayMs = 50, avgTimes = 128, samDelay = 100 } },
{"2mA", new TestParaSet{delayMs = 50, avgTimes = 128, samDelay = 100 } },
{"60mA", new TestParaSet{delayMs = 30, avgTimes = 255, samDelay = 100 } },
{"1A", new TestParaSet{delayMs = 30, avgTimes = 255, samDelay = 100 } },
{"5uA", new TestParaSet{delayMs = 70, avgTimes = 255, samDelay = 500 } },
{"20uA", new TestParaSet{delayMs = 30, avgTimes =255, samDelay = 100 } },
{"200uA", new TestParaSet{delayMs = 15, avgTimes = 255, samDelay = 100 } },
{"2mA", new TestParaSet{delayMs = 15, avgTimes = 255, samDelay = 100 } },
{"60mA", new TestParaSet{delayMs = 20, avgTimes = 255, samDelay = 100 } },
{"1A", new TestParaSet{delayMs = 20, avgTimes = 255, samDelay = 100 } },
};
Dictionary<string, TestParaSet> avgDelays_2km_fvmi_dps = new Dictionary<string, TestParaSet>()
{
@@ -334,6 +334,7 @@ namespace Testrong.User.Program
#endregion
#region Variables Definition
readonly List<string> testRangesPmu = new List<string> { "5uA", "20uA", "200uA", "2mA", "60mA" };
readonly List<string> testRangesDps = new List<string> { "5uA", "20uA", "200uA", "2mA", "60mA", "1A" };
readonly string[] FreqStr_Test = { "1M", "2M", "2.5M", "5M", "10M" };
@@ -476,6 +477,7 @@ namespace Testrong.User.Program
{"60mA", ExtCaliLoad.RC_RL5},
{"1A", ExtCaliLoad.RC_RL3},
};
readonly int PmuChannelCount = 256;
readonly double VoltageInitialDefault = -7.5;
readonly double VoltageStepDefault = 3.75;
readonly double VoltageInitialDps1A = 1.5;
@@ -924,28 +926,57 @@ namespace Testrong.User.Program
}
public double[,] ReadRext(string RextFilePath)
{
double[,] ExtBoard_Res = new double[256, 12];
int cnt2 = 0;
StreamReader ExtResReader = new StreamReader(RextFilePath, Encoding.UTF8);
while (!ExtResReader.EndOfStream)
// 检查文件是否存在
//if (!File.Exists(RextFilePath))
//{
// return new double[0, 0];
//}
if (!File.Exists(RextFilePath))
{
string rstr = ExtResReader.ReadLine();
ExtBoard_Res[cnt2, 0] = Convert.ToDouble(rstr.Split(',')[0]);
ExtBoard_Res[cnt2, 1] = Convert.ToDouble(rstr.Split(',')[1]);
ExtBoard_Res[cnt2, 2] = Convert.ToDouble(rstr.Split(',')[2]);
ExtBoard_Res[cnt2, 3] = Convert.ToDouble(rstr.Split(',')[3]);
ExtBoard_Res[cnt2, 4] = Convert.ToDouble(rstr.Split(',')[4]);
ExtBoard_Res[cnt2, 5] = Convert.ToDouble(rstr.Split(',')[5]);
ExtBoard_Res[cnt2, 6] = Convert.ToDouble(rstr.Split(',')[6]);
ExtBoard_Res[cnt2, 7] = Convert.ToDouble(rstr.Split(',')[7]);
ExtBoard_Res[cnt2, 8] = Convert.ToDouble(rstr.Split(',')[8]);
ExtBoard_Res[cnt2, 9] = Convert.ToDouble(rstr.Split(',')[9]);
ExtBoard_Res[cnt2, 10] = Convert.ToDouble(rstr.Split(',')[10]);
ExtBoard_Res[cnt2, 11] = Convert.ToDouble(rstr.Split(',')[11]);
cnt2 = cnt2 + 1;
LogRawText($"错误:找不到外部电阻文件 {RextFilePath},请检查文件是否存在。");
throw new FileNotFoundException($"外部电阻文件不存在: {RextFilePath}");
}
try
{
// 先读取文件以确定行数和列数
string[] lines = File.ReadAllLines(RextFilePath);
if (lines.Length == 0)
{
return new double[0, 0];
}
// 确定列数(通过第一行)
int columns = lines[0].Split(',').Length;
// 创建适当大小的数组
double[,] ExtBoard_Res = new double[lines.Length, columns];
// 填充数据
for (int i = 0; i < lines.Length; i++)
{
string[] values = lines[i].Split(',');
for (int j = 0; j < Math.Min(values.Length, columns); j++)
{
if (double.TryParse(values[j], out double result))
{
ExtBoard_Res[i, j] = result;
}
else
{
ExtBoard_Res[i, j] = 0;
}
}
}
return ExtBoard_Res;
}
catch
{
// 如果发生任何异常,返回空数组
return new double[0, 0];
}
ExtResReader.Close();
return ExtBoard_Res;
}
public double[] ReadRint(string RintFilePath)
{
@@ -1001,12 +1032,12 @@ namespace Testrong.User.Program
int dmmFlag = 0;
while (dmmFlag < data.Length)
{
int number = dmmFlag / 5;
int number = dmmFlag / SampliCount;
int group = listCh[number];
double[] DmmMeasure = new double[5];
for (int readNum = dmmFlag; readNum < (number + 1) * 5; readNum++)
double[] DmmMeasure = new double[SampliCount];
for (int readNum = dmmFlag; readNum < (number + 1) * SampliCount; readNum++)
{
DmmMeasure[dmmFlag % 5] = data[readNum];
DmmMeasure[dmmFlag % SampliCount] = data[readNum];
dmmFlag += 1;
}
DmmDic.Add(group, DmmMeasure);
@@ -1481,7 +1512,7 @@ namespace Testrong.User.Program
#region Init Config & Variables
List<int> ChannelDps = new List<int>();
List<int> ChannelPmu = new List<int>();
for (int m = 0; m < 256; m++)
for (int m = 0; m < PmuChannelCount; m++)
{
ChannelPmu.Add(m + 1);
}
@@ -1541,7 +1572,7 @@ namespace Testrong.User.Program
string filetime = DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss");
#region The Test
for (int loopk = 0; loopk < 256; loopk++)
for (int loopk = 0; loopk <PmuChannelCount; loopk++)
{
#region Test Config
string[] PmuPinName = { ("A" + (ChannelPmu[loopk] < 10 ? "0" : "") + ChannelPmu[loopk]) };
@@ -1647,7 +1678,7 @@ namespace Testrong.User.Program
List<int> ChannelDps = new List<int>();
List<int> ChannelPmu = new List<int>();
//-----Select PreTest or ReTest-----
for (int m = 0; m < 256; m++)
for (int m = 0; m < PmuChannelCount; m++)
{
ChannelPmu.Add(m + 1);
}
@@ -1712,7 +1743,7 @@ namespace Testrong.User.Program
#region The Test
for (int loopk = 0; loopk < 256; loopk++)
for (int loopk = 0; loopk < PmuChannelCount; loopk++)
{
#region Test Config
double ForceVoltage = -2;
@@ -1760,7 +1791,7 @@ namespace Testrong.User.Program
PPMU.Force(PmuPinName, 0, PpmuMode.FVMV, PpmuIRange._2mA, VRange.Normal);
#region File Writing
#region File Writing
StreamWriter sw = new StreamWriter(filename, true, Encoding.UTF8)
{
AutoFlush = true
@@ -1885,6 +1916,252 @@ namespace Testrong.User.Program
#endregion
}
void Rint_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 < PmuChannelCount; 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;
//---------Thread Locker--------
SlotThreadLocker(SlotNum: SlotNum, slotList: slotList, pathFlag: "CAL", lockFlag: true);
//-----Move File To History-----
File_Mover(SlotNum: SlotNum, slotList: slotList, pathFlag: "CAL_Single");
//-----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 < PmuChannelCount; loopk++)
{
#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, ch, ExtCaliVI.V, ExtCaliLoad.RC_RL7, 0);//change channel
if (loopk == 0)
{
DelayHelper.Sleep(20);
}
#region Actual Test
for (int p = 0; p < 1; 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",
SampliCount: 1,
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>
/// Use TFTP to upload DNA/MV file into Zynq
/// </summary>
@@ -2272,7 +2549,7 @@ namespace Testrong.User.Program
if (isFirstTest == true)
{
ChannelDps = Select_Dps[testVersion];
for (int m = 0; m < 256; m++)
for (int m = 0; m < PmuChannelCount; m++)
{
ChannelPmu.Add(m + 1);
}
@@ -2687,7 +2964,7 @@ namespace Testrong.User.Program
{
Thread.Sleep(50);
}
Thread.Sleep(20);
Thread.Sleep(80);
}
if (Range == "200uA")
{
@@ -3014,6 +3291,7 @@ namespace Testrong.User.Program
rload: rl,
extR: ExtBoard_Res,
range: Range,
SampliCount: SampliCount,
ForceValue: ForceValueDir[ch],
AteMeasure: AteMeasureDir[ch],
DmmMeasure: DmmMeasureDir[ch],
@@ -3063,6 +3341,7 @@ namespace Testrong.User.Program
rload: rl,
extR: ZeroExtR,
range: Range,
SampliCount:SampliCount,
ForceValue: ForceValueDir[ch],
AteMeasure: AteMeasureDir[ch],
DmmMeasure: DmmMeasureDir[ch],
@@ -3159,7 +3438,7 @@ namespace Testrong.User.Program
void Rint_GND_FVMI_2mA(IFlowRunnerContext context)
{
List<int> ChannelPmu = new List<int>();
for (int m = 0; m < 256; m++)
for (int m = 0; m < PmuChannelCount; m++)
{
ChannelPmu.Add(m + 1);
}
@@ -3201,7 +3480,7 @@ namespace Testrong.User.Program
init_Flag: true
);
string filetime = DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss");
for (int loopk = 0; loopk < 256; loopk++)
for (int loopk = 0; loopk < PmuChannelCount; loopk++)
{
string[] PmuPinName = { ("A" + (ChannelPmu[loopk] < 10 ? "0" : "") + ChannelPmu[loopk]) };
RELAY.SwitchMode(RelayMode.Open);
@@ -3312,7 +3591,7 @@ namespace Testrong.User.Program
List<int> ChannelDps = new List<int>();
List<int> ChannelPmu = new List<int>();
//-----Select PreTest or ReTest-----
for (int m = 0; m < 256; m++)
for (int m = 0; m < PmuChannelCount; m++)
{
ChannelPmu.Add(m + 1);
}
@@ -3388,7 +3667,7 @@ namespace Testrong.User.Program
#region The Test
for (int loopk = 0; loopk < 256; loopk++)
for (int loopk = 0; loopk < PmuChannelCount; loopk++)
{
int ch = ChannelPmu[loopk];
int ch1 = ChannelPmu[loopk];
@@ -3954,7 +4233,7 @@ namespace Testrong.User.Program
}
[TestrongTestCase]
public void RintReset(IFlowRunnerContext context)
{
{
Rint_Reset(context);
}
[TestrongTestCase]
@@ -3981,7 +4260,12 @@ namespace Testrong.User.Program
[TestrongTestCase]
public void Rint_Post(IFlowRunnerContext context)
{
Rint_FVMV_2mA_Post(context, SelectTestVersion);
Rint_FVMV_2mA_Post(context, SelectTestVersion);
}
[TestrongTestCase]
public void Rint_Test(IFlowRunnerContext context)
{
Rint_Test(context, SelectTestVersion);
}
[TestrongTestCase]
public void PmurUpload(IFlowRunnerContext context)
@@ -3991,7 +4275,7 @@ namespace Testrong.User.Program
[TestrongTestCase]
public void ReTest(IFlowRunnerContext context)
{
ExternalCalibrationCollect(context, SelectTestVersion, false, false);
ExternalCalibrationCollect(context, SelectTestVersion, false, false);
}
[TestrongTestCase]