Add SlotThreadLocker & Bug Fix
This commit is contained in:
Binary file not shown.
@@ -654,6 +654,41 @@ namespace Testrong.User.Program
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ----------SlotThreadLocker-------------
|
||||||
|
* int SlotNum: Current Slot Number,
|
||||||
|
* List<int> slotList: Slot List,
|
||||||
|
* string pathFlag: Path Selector, Possible Value="Freq","CAL_Init","CAL","RINT","CAL_COM",
|
||||||
|
*/
|
||||||
|
public void SlotThreadLocker(int SlotNum, List<int> slotList, string pathFlag)
|
||||||
|
{
|
||||||
|
string WritePath;
|
||||||
|
switch (pathFlag)
|
||||||
|
{
|
||||||
|
case "Freq":
|
||||||
|
WritePath = EXT_CAL_FREQ_PATH;
|
||||||
|
break;
|
||||||
|
case "CAL_Init":
|
||||||
|
WritePath = EXT_CAL_INIT_PATH;
|
||||||
|
break;
|
||||||
|
case "RINT":
|
||||||
|
WritePath = RINT_COMPFILE_PATH;
|
||||||
|
break;
|
||||||
|
case "CAL_COM":
|
||||||
|
WritePath = CAL_COMPFILE_PATH;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
WritePath = EXT_CAL_PATH;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (SlotNum < slotList[slotList.Count - 1])
|
||||||
|
{
|
||||||
|
StreamWriter swSignal = new StreamWriter(WritePath + SlotNum + ".flag"); //Create file flagging end of current thread
|
||||||
|
swSignal.WriteLine();
|
||||||
|
swSignal.Flush();
|
||||||
|
swSignal.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
private int GetPMUTempSensorIndex(int channel)
|
private int GetPMUTempSensorIndex(int channel)
|
||||||
{
|
{
|
||||||
if ((channel >= 65 && channel <= 80) || (channel >= 97 && channel <= 112) || (channel >= 193 && channel <= 208) || (channel >= 241 && channel <= 256))
|
if ((channel >= 65 && channel <= 80) || (channel >= 97 && channel <= 112) || (channel >= 193 && channel <= 208) || (channel >= 241 && channel <= 256))
|
||||||
@@ -892,8 +927,7 @@ namespace Testrong.User.Program
|
|||||||
return DmmDic;
|
return DmmDic;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Write Data To File
|
/*----------Write Data To File-------------
|
||||||
/*
|
|
||||||
* Variable Definition
|
* Variable Definition
|
||||||
* string filename: filename
|
* string filename: filename
|
||||||
* int slot: Slot Number
|
* int slot: Slot Number
|
||||||
@@ -945,7 +979,7 @@ namespace Testrong.User.Program
|
|||||||
}
|
}
|
||||||
else if (mode == "FVMI")
|
else if (mode == "FVMI")
|
||||||
{
|
{
|
||||||
if (range == "60mA")
|
if (range == "60mA" || range == "1A")
|
||||||
{
|
{
|
||||||
sw.Write($"{ForceValue[writeLine]:F10},");
|
sw.Write($"{ForceValue[writeLine]:F10},");
|
||||||
sw.Write($"{AteMeasure[writeLine]:F15},");
|
sw.Write($"{AteMeasure[writeLine]:F15},");
|
||||||
@@ -960,7 +994,7 @@ namespace Testrong.User.Program
|
|||||||
}
|
}
|
||||||
else if (mode == "FIMV")
|
else if (mode == "FIMV")
|
||||||
{
|
{
|
||||||
if (range == "60mA")
|
if (range == "60mA" || range == "5uA")
|
||||||
{
|
{
|
||||||
sw.Write($"{ForceValue[writeLine]:F10},");
|
sw.Write($"{ForceValue[writeLine]:F10},");
|
||||||
sw.Write($"{AteMeasure[writeLine]:F15},");
|
sw.Write($"{AteMeasure[writeLine]:F15},");
|
||||||
@@ -1189,13 +1223,7 @@ namespace Testrong.User.Program
|
|||||||
swResult = new StreamWriter(EXT_CAL_FREQ_PATH + "f_Result.csv", true, Encoding.UTF8);
|
swResult = new StreamWriter(EXT_CAL_FREQ_PATH + "f_Result.csv", true, Encoding.UTF8);
|
||||||
FrequencyProcess(SlotNum, swResult, EXT_CAL_FREQ_PATH, 25);
|
FrequencyProcess(SlotNum, swResult, EXT_CAL_FREQ_PATH, 25);
|
||||||
swResult.Close();
|
swResult.Close();
|
||||||
if (SlotNum < slotList[slotList.Count - 1])
|
SlotThreadLocker(SlotNum:SlotNum,slotList:slotList,pathFlag:"Freq");
|
||||||
{
|
|
||||||
StreamWriter swSignal = new StreamWriter(EXT_CAL_FREQ_PATH + SlotNum + ".flag");
|
|
||||||
swSignal.WriteLine();
|
|
||||||
swSignal.Flush();
|
|
||||||
swSignal.Close();
|
|
||||||
}
|
|
||||||
if (SlotNum == slotList[slotList.Count - 1])
|
if (SlotNum == slotList[slotList.Count - 1])
|
||||||
{
|
{
|
||||||
swResult.Close();
|
swResult.Close();
|
||||||
@@ -1289,13 +1317,7 @@ namespace Testrong.User.Program
|
|||||||
var isPmurUploadOK = extCaliHandle.UploadFile(context.Communicator.ServerIP, EXT_CAL_INIT_PATH + "Pmur_init.csv", FileType.pmu_r);
|
var isPmurUploadOK = extCaliHandle.UploadFile(context.Communicator.ServerIP, EXT_CAL_INIT_PATH + "Pmur_init.csv", FileType.pmu_r);
|
||||||
LogRawText($"Pmu_r Status: {isPmurUploadOK}");
|
LogRawText($"Pmu_r Status: {isPmurUploadOK}");
|
||||||
|
|
||||||
if (SlotNum < slotList[slotList.Count - 1])
|
SlotThreadLocker(SlotNum: SlotNum, slotList: slotList, pathFlag: "CAL_Init");
|
||||||
{
|
|
||||||
StreamWriter swSignal = new StreamWriter(EXT_CAL_INIT_PATH + SlotNum + ".flag"); //Create file flagging end of current thread
|
|
||||||
swSignal.WriteLine();
|
|
||||||
swSignal.Flush();
|
|
||||||
swSignal.Close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
void Rint_FVMV_2mA_Pre(IFlowRunnerContext context, TestVersion testVersion)
|
void Rint_FVMV_2mA_Pre(IFlowRunnerContext context, TestVersion testVersion)
|
||||||
{
|
{
|
||||||
@@ -1435,13 +1457,8 @@ namespace Testrong.User.Program
|
|||||||
filetime: filetime
|
filetime: filetime
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (SlotNum < slotList[slotList.Count - 1])
|
|
||||||
{
|
SlotThreadLocker(SlotNum: SlotNum, slotList: slotList, pathFlag: "CAL");
|
||||||
StreamWriter swSignal = new StreamWriter(EXT_CAL_PATH + SlotNum + ".flag"); //Create file flagging end of current thread
|
|
||||||
swSignal.WriteLine();
|
|
||||||
swSignal.Flush();
|
|
||||||
swSignal.Close();
|
|
||||||
}
|
|
||||||
swdata.Flush();
|
swdata.Flush();
|
||||||
swdata.Close();
|
swdata.Close();
|
||||||
}
|
}
|
||||||
@@ -1490,13 +1507,7 @@ namespace Testrong.User.Program
|
|||||||
var isMVUploadOK = extCaliHandle.UploadFile(context.Communicator.ServerIP, RINT_COMPFILE_PATH + context.Communicator.ServerIP + "_MV.csv", FileType.mv);
|
var isMVUploadOK = extCaliHandle.UploadFile(context.Communicator.ServerIP, RINT_COMPFILE_PATH + context.Communicator.ServerIP + "_MV.csv", FileType.mv);
|
||||||
LogRawText($"MV Status: {isMVUploadOK}");
|
LogRawText($"MV Status: {isMVUploadOK}");
|
||||||
|
|
||||||
if (SlotNum < slotList[slotList.Count - 1])
|
SlotThreadLocker(SlotNum: SlotNum, slotList: slotList, pathFlag: "RINT");
|
||||||
{
|
|
||||||
StreamWriter swSignal = new StreamWriter(RINT_COMPFILE_PATH + SlotNum + ".flag"); //Create file flagging end of current thread
|
|
||||||
swSignal.WriteLine();
|
|
||||||
swSignal.Flush();
|
|
||||||
swSignal.Close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
void Pmur_Upload(IFlowRunnerContext context)
|
void Pmur_Upload(IFlowRunnerContext context)
|
||||||
{
|
{
|
||||||
@@ -1755,13 +1766,7 @@ namespace Testrong.User.Program
|
|||||||
Pmur.Close();
|
Pmur.Close();
|
||||||
|
|
||||||
#region Thread Lock
|
#region Thread Lock
|
||||||
if (SlotNum < slotList[slotList.Count - 1])
|
SlotThreadLocker(SlotNum: SlotNum, slotList: slotList, pathFlag: "CAL");
|
||||||
{
|
|
||||||
StreamWriter swSignal = new StreamWriter(EXT_CAL_PATH + SlotNum + ".flag"); //Create file flagging end of current thread
|
|
||||||
swSignal.WriteLine();
|
|
||||||
swSignal.Flush();
|
|
||||||
swSignal.Close();
|
|
||||||
}
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
void ExternalCalibrationReset(IFlowRunnerContext context)
|
void ExternalCalibrationReset(IFlowRunnerContext context)
|
||||||
@@ -1812,13 +1817,7 @@ namespace Testrong.User.Program
|
|||||||
var isMIUploadOK = extCaliHandle.UploadFile(context.Communicator.ServerIP, EXT_CAL_INIT_PATH + "MI_init.csv", FileType.mi);
|
var isMIUploadOK = extCaliHandle.UploadFile(context.Communicator.ServerIP, EXT_CAL_INIT_PATH + "MI_init.csv", FileType.mi);
|
||||||
LogRawText($"MI Status: {isMIUploadOK}");
|
LogRawText($"MI Status: {isMIUploadOK}");
|
||||||
|
|
||||||
if (SlotNum < slotList[slotList.Count - 1])
|
SlotThreadLocker(SlotNum: SlotNum, slotList: slotList, pathFlag: "CAL_Init");
|
||||||
{
|
|
||||||
StreamWriter swSignal = new StreamWriter(EXT_CAL_INIT_PATH + SlotNum + ".flag");
|
|
||||||
swSignal.WriteLine();
|
|
||||||
swSignal.Flush();
|
|
||||||
swSignal.Close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
void DmmGetResValue(IFlowRunnerContext context, TestVersion testVersion)
|
void DmmGetResValue(IFlowRunnerContext context, TestVersion testVersion)
|
||||||
{
|
{
|
||||||
@@ -1923,13 +1922,8 @@ namespace Testrong.User.Program
|
|||||||
{
|
{
|
||||||
Thread.Sleep(1);
|
Thread.Sleep(1);
|
||||||
}
|
}
|
||||||
if (SlotNum < slotList[slotList.Count - 1])
|
|
||||||
{
|
SlotThreadLocker(SlotNum: SlotNum, slotList: slotList, pathFlag: "CAL_Init");
|
||||||
StreamWriter swSignal = new StreamWriter(EXT_CAL_INIT_PATH + SlotNum + ".flag");
|
|
||||||
swSignal.WriteLine();
|
|
||||||
swSignal.Flush();
|
|
||||||
swSignal.Close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
void ExternalCalibrationCollect(IFlowRunnerContext context, TestVersion testVersion, bool isFirstTest, bool isPreCheck)
|
void ExternalCalibrationCollect(IFlowRunnerContext context, TestVersion testVersion, bool isFirstTest, bool isPreCheck)
|
||||||
{
|
{
|
||||||
@@ -2829,13 +2823,7 @@ namespace Testrong.User.Program
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Thread Lock
|
#region Thread Lock
|
||||||
if (SlotNum < slotList[slotList.Count - 1])
|
SlotThreadLocker(SlotNum: SlotNum, slotList: slotList, pathFlag: "CAL");
|
||||||
{
|
|
||||||
StreamWriter swSignal = new StreamWriter(EXT_CAL_PATH + SlotNum + ".flag"); //Create file flagging end of current thread
|
|
||||||
swSignal.WriteLine();
|
|
||||||
swSignal.Flush();
|
|
||||||
swSignal.Close();
|
|
||||||
}
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
dmm.ResetInstrument();
|
dmm.ResetInstrument();
|
||||||
@@ -2893,13 +2881,8 @@ namespace Testrong.User.Program
|
|||||||
Thread.Sleep(10);
|
Thread.Sleep(10);
|
||||||
var isMIUploadOK = extCaliHandle.UploadFile(context.Communicator.ServerIP, CAL_COMPFILE_PATH + context.Communicator.ServerIP + "_MI.csv", FileType.mi);
|
var isMIUploadOK = extCaliHandle.UploadFile(context.Communicator.ServerIP, CAL_COMPFILE_PATH + context.Communicator.ServerIP + "_MI.csv", FileType.mi);
|
||||||
LogRawText($"MI Status: {isMIUploadOK}");
|
LogRawText($"MI Status: {isMIUploadOK}");
|
||||||
if (SlotNum < slotList[slotList.Count - 1])
|
|
||||||
{
|
SlotThreadLocker(SlotNum: SlotNum, slotList: slotList, pathFlag: "CAL_COM");
|
||||||
StreamWriter swSignal = new StreamWriter(CAL_COMPFILE_PATH + SlotNum + ".flag"); //Create file flagging end of current thread
|
|
||||||
swSignal.WriteLine();
|
|
||||||
swSignal.Flush();
|
|
||||||
swSignal.Close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Rint_GND_FVMI_2mA(IFlowRunnerContext context)
|
void Rint_GND_FVMI_2mA(IFlowRunnerContext context)
|
||||||
@@ -2956,21 +2939,17 @@ namespace Testrong.User.Program
|
|||||||
double Vstep = 0.0004;
|
double Vstep = 0.0004;
|
||||||
string filepath = "Slot" + SlotNum + "_PMU_" + "ch" + ChannelPmu[loopk] + "_" + "FVMI" + "_" + "Hi-Z" + "_" + "2mA" + ".csv";
|
string filepath = "Slot" + SlotNum + "_PMU_" + "ch" + ChannelPmu[loopk] + "_" + "FVMI" + "_" + "Hi-Z" + "_" + "2mA" + ".csv";
|
||||||
string filename = EXT_CAL_PATH + filepath;
|
string filename = EXT_CAL_PATH + filepath;
|
||||||
StreamWriter sw = new StreamWriter(filename, true, Encoding.UTF8);
|
int ch = ChannelPmu[loopk];
|
||||||
sw.AutoFlush = true;
|
double[] AteMeasure = new double[SampliCount];
|
||||||
sw.Write("Tester_Name,Foo\n");
|
double[] ForceValue = new double[SampliCount];
|
||||||
sw.Write($"Slot_No,{SlotNum}\n");
|
double[] DMMValue = new double[SampliCount];
|
||||||
sw.Write($"Board_Dna,{arm_dna}\n");
|
double[] TempValue = new double[SampliCount];
|
||||||
sw.Write("Channel_Type,PMU\n");
|
|
||||||
sw.Write($"Channel_No,{ChannelPmu[loopk]}\n");
|
StreamWriter sw = new StreamWriter(filename, true, Encoding.UTF8)
|
||||||
sw.Write($"Mode,FVMI\n");
|
{
|
||||||
sw.Write($"R_Load,Hi-Z\n");
|
AutoFlush = true
|
||||||
sw.Write($"R_Int,{0}\n");
|
};
|
||||||
sw.Write($"R_Ext,{0}\n");
|
|
||||||
sw.Write($"I_Range,2mA\n");
|
|
||||||
sw.Write("V_Range,20V\n");
|
|
||||||
sw.Write("Meas_Range,13V\n");
|
|
||||||
sw.Write("\n");
|
|
||||||
if (loopk == 0)
|
if (loopk == 0)
|
||||||
{
|
{
|
||||||
DelayHelper.Sleep(20);
|
DelayHelper.Sleep(20);
|
||||||
@@ -3009,6 +2988,23 @@ namespace Testrong.User.Program
|
|||||||
ForceV += Vstep;
|
ForceV += Vstep;
|
||||||
}
|
}
|
||||||
PPMU.Force(PmuPinName, 0, PpmuMode.FVMI, PpmuIRange._2mA, VRange.Normal);
|
PPMU.Force(PmuPinName, 0, PpmuMode.FVMI, PpmuIRange._2mA, VRange.Normal);
|
||||||
|
|
||||||
|
WriteSingleFile(
|
||||||
|
filename: filename,
|
||||||
|
slot: SlotNum,
|
||||||
|
dna: arm_dna,
|
||||||
|
type: "PMU",
|
||||||
|
channel: ch,
|
||||||
|
mode: "FVMI",
|
||||||
|
rload: "Hi-Z",
|
||||||
|
extR: ExtBoard_Res,
|
||||||
|
range: "2mA",
|
||||||
|
ForceValue: ForceValue,
|
||||||
|
AteMeasure: AteMeasure,
|
||||||
|
DmmMeasure: DMMValue,
|
||||||
|
TempValue: TempValue
|
||||||
|
);
|
||||||
|
|
||||||
sw.Flush();
|
sw.Flush();
|
||||||
sw.Close();
|
sw.Close();
|
||||||
swdata.Write($"{arm_dna},");
|
swdata.Write($"{arm_dna},");
|
||||||
@@ -3026,13 +3022,8 @@ namespace Testrong.User.Program
|
|||||||
swdata.Flush();
|
swdata.Flush();
|
||||||
swdata.Close();
|
swdata.Close();
|
||||||
Thread.Sleep(100);
|
Thread.Sleep(100);
|
||||||
if (SlotNum < slotList[slotList.Count - 1])
|
|
||||||
{
|
SlotThreadLocker(SlotNum: SlotNum, slotList: slotList, pathFlag: "CAL");
|
||||||
StreamWriter swSignal = new StreamWriter(EXT_CAL_PATH + SlotNum + ".flag"); //Create file flagging end of current thread
|
|
||||||
swSignal.WriteLine();
|
|
||||||
swSignal.Flush();
|
|
||||||
swSignal.Close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
Reference in New Issue
Block a user