Add Comments & Bug fixes

This commit is contained in:
YuYang Shen
2025-03-21 15:36:43 +08:00
parent fc2d8e9fcb
commit 4b70eeaedb
13 changed files with 607 additions and 471 deletions
Binary file not shown.
@@ -5,13 +5,6 @@
{ {
"AbsoluteMoniker": "D:0:0:{E96B1A19-D109-4F67-B1AA-5BF15E580D77}|Testrong.User.Program\\Testrong.User.Program.csproj|d:\\work\\manlin\\verify\\userprogram_time\\testrong.user.program\\userprogram.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", "AbsoluteMoniker": "D:0:0:{E96B1A19-D109-4F67-B1AA-5BF15E580D77}|Testrong.User.Program\\Testrong.User.Program.csproj|d:\\work\\manlin\\verify\\userprogram_time\\testrong.user.program\\userprogram.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{E96B1A19-D109-4F67-B1AA-5BF15E580D77}|Testrong.User.Program\\Testrong.User.Program.csproj|solutionrelative:testrong.user.program\\userprogram.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" "RelativeMoniker": "D:0:0:{E96B1A19-D109-4F67-B1AA-5BF15E580D77}|Testrong.User.Program\\Testrong.User.Program.csproj|solutionrelative:testrong.user.program\\userprogram.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\ProgramData\\Testrong\\ATE_Tester\\setting\\NLog.config||{FA3CD31E-987B-443A-9B81-186104E8DAC1}"
},
{
"AbsoluteMoniker": "D:0:0:{E96B1A19-D109-4F67-B1AA-5BF15E580D77}|Testrong.User.Program\\Testrong.User.Program.csproj|D:\\WORK\\ManLin\\Verify\\UserProgram_time\\testrong.user.program\\keysight53220a.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{E96B1A19-D109-4F67-B1AA-5BF15E580D77}|Testrong.User.Program\\Testrong.User.Program.csproj|solutionrelative:testrong.user.program\\keysight53220a.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
} }
], ],
"DocumentGroupContainers": [ "DocumentGroupContainers": [
@@ -21,34 +14,12 @@
"DocumentGroups": [ "DocumentGroups": [
{ {
"DockedWidth": 200, "DockedWidth": 200,
"SelectedChildIndex": 3, "SelectedChildIndex": 1,
"Children": [ "Children": [
{ {
"$type": "Bookmark", "$type": "Bookmark",
"Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}" "Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}"
}, },
{
"$type": "Document",
"DocumentIndex": 1,
"Title": "NLog.config",
"DocumentMoniker": "C:\\ProgramData\\Testrong\\ATE_Tester\\setting\\NLog.config",
"ToolTip": "C:\\ProgramData\\Testrong\\ATE_Tester\\setting\\NLog.config",
"ViewState": "AQIAADgAAAAAzszMzMwgwE8AAAAjAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000601|",
"WhenOpened": "2024-07-10T10:20:55.074Z"
},
{
"$type": "Document",
"DocumentIndex": 2,
"Title": "Keysight53220A.cs",
"DocumentMoniker": "D:\\WORK\\ManLin\\Verify\\UserProgram_time\\Testrong.User.Program\\Keysight53220A.cs",
"RelativeDocumentMoniker": "Testrong.User.Program\\Keysight53220A.cs",
"ToolTip": "D:\\WORK\\ManLin\\Verify\\UserProgram_time\\Testrong.User.Program\\Keysight53220A.cs",
"RelativeToolTip": "Testrong.User.Program\\Keysight53220A.cs",
"ViewState": "AQIAAHMAAAAAAAAAAAAYwKkAAAAiAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-06-18T12:27:43.62Z"
},
{ {
"$type": "Document", "$type": "Document",
"DocumentIndex": 0, "DocumentIndex": 0,
@@ -57,7 +28,7 @@
"RelativeDocumentMoniker": "Testrong.User.Program\\UserProgram.cs", "RelativeDocumentMoniker": "Testrong.User.Program\\UserProgram.cs",
"ToolTip": "D:\\WORK\\ManLin\\Verify\\UserProgram_time\\Testrong.User.Program\\UserProgram.cs", "ToolTip": "D:\\WORK\\ManLin\\Verify\\UserProgram_time\\Testrong.User.Program\\UserProgram.cs",
"RelativeToolTip": "Testrong.User.Program\\UserProgram.cs", "RelativeToolTip": "Testrong.User.Program\\UserProgram.cs",
"ViewState": "AgIAALsEAAAAAAAAAAAQwNAEAAA6AAAAAAAAAA==", "ViewState": "AgIAAEEEAAAAAAAAAAAIwGAEAAAdAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-06-18T12:27:43.78Z", "WhenOpened": "2024-06-18T12:27:43.78Z",
"EditorCaption": "" "EditorCaption": ""
@@ -5,13 +5,6 @@
{ {
"AbsoluteMoniker": "D:0:0:{E96B1A19-D109-4F67-B1AA-5BF15E580D77}|Testrong.User.Program\\Testrong.User.Program.csproj|d:\\work\\manlin\\verify\\userprogram_time\\testrong.user.program\\userprogram.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", "AbsoluteMoniker": "D:0:0:{E96B1A19-D109-4F67-B1AA-5BF15E580D77}|Testrong.User.Program\\Testrong.User.Program.csproj|d:\\work\\manlin\\verify\\userprogram_time\\testrong.user.program\\userprogram.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{E96B1A19-D109-4F67-B1AA-5BF15E580D77}|Testrong.User.Program\\Testrong.User.Program.csproj|solutionrelative:testrong.user.program\\userprogram.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" "RelativeMoniker": "D:0:0:{E96B1A19-D109-4F67-B1AA-5BF15E580D77}|Testrong.User.Program\\Testrong.User.Program.csproj|solutionrelative:testrong.user.program\\userprogram.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\ProgramData\\Testrong\\ATE_Tester\\setting\\NLog.config||{FA3CD31E-987B-443A-9B81-186104E8DAC1}"
},
{
"AbsoluteMoniker": "D:0:0:{E96B1A19-D109-4F67-B1AA-5BF15E580D77}|Testrong.User.Program\\Testrong.User.Program.csproj|D:\\WORK\\ManLin\\Verify\\UserProgram_time\\testrong.user.program\\keysight53220a.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{E96B1A19-D109-4F67-B1AA-5BF15E580D77}|Testrong.User.Program\\Testrong.User.Program.csproj|solutionrelative:testrong.user.program\\keysight53220a.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
} }
], ],
"DocumentGroupContainers": [ "DocumentGroupContainers": [
@@ -21,43 +14,21 @@
"DocumentGroups": [ "DocumentGroups": [
{ {
"DockedWidth": 200, "DockedWidth": 200,
"SelectedChildIndex": 3, "SelectedChildIndex": 1,
"Children": [ "Children": [
{ {
"$type": "Bookmark", "$type": "Bookmark",
"Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}" "Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}"
}, },
{
"$type": "Document",
"DocumentIndex": 1,
"Title": "NLog.config",
"DocumentMoniker": "C:\\ProgramData\\Testrong\\ATE_Tester\\setting\\NLog.config",
"ToolTip": "C:\\ProgramData\\Testrong\\ATE_Tester\\setting\\NLog.config",
"ViewState": "AQIAADgAAAAAzszMzMwgwE8AAAAjAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000601|",
"WhenOpened": "2024-07-10T10:20:55.074Z"
},
{
"$type": "Document",
"DocumentIndex": 2,
"Title": "Keysight53220A.cs",
"DocumentMoniker": "D:\\WORK\\ManLin\\Verify\\UserProgram_time\\Testrong.User.Program\\Keysight53220A.cs",
"RelativeDocumentMoniker": "Testrong.User.Program\\Keysight53220A.cs",
"ToolTip": "D:\\WORK\\ManLin\\Verify\\UserProgram_time\\Testrong.User.Program\\Keysight53220A.cs",
"RelativeToolTip": "Testrong.User.Program\\Keysight53220A.cs",
"ViewState": "AQIAAHMAAAAAAAAAAAAYwKkAAAAiAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-06-18T12:27:43.62Z"
},
{ {
"$type": "Document", "$type": "Document",
"DocumentIndex": 0, "DocumentIndex": 0,
"Title": "UserProgram.cs", "Title": "UserProgram.cs",
"DocumentMoniker": "D:\\WORK\\ManLin\\Verify\\UserProgram_time\\Testrong.User.Program\\UserProgram.cs", "DocumentMoniker": "D:\\WORK\\ManLin\\Verify\\UserProgram_time\\Testrong.User.Program\\UserProgram.cs",
"RelativeDocumentMoniker": "Testrong.User.Program\\UserProgram.cs", "RelativeDocumentMoniker": "Testrong.User.Program\\UserProgram.cs",
"ToolTip": "D:\\WORK\\ManLin\\Verify\\UserProgram_time\\Testrong.User.Program\\UserProgram.cs*", "ToolTip": "D:\\WORK\\ManLin\\Verify\\UserProgram_time\\Testrong.User.Program\\UserProgram.cs",
"RelativeToolTip": "Testrong.User.Program\\UserProgram.cs*", "RelativeToolTip": "Testrong.User.Program\\UserProgram.cs",
"ViewState": "AgIAAEsGAAAAAAAAAAAowFcGAAAAAAAAAAAAAA==", "ViewState": "AgIAAMwDAAAAAAAAAAAmwOoDAAAyAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-06-18T12:27:43.78Z", "WhenOpened": "2024-06-18T12:27:43.78Z",
"EditorCaption": "" "EditorCaption": ""
+2 -2
View File
@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16 # Visual Studio Version 17
VisualStudioVersion = 16.0.30320.27 VisualStudioVersion = 17.13.35806.99 d17.13
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testrong.User.Program", "Testrong.User.Program\Testrong.User.Program.csproj", "{E96B1A19-D109-4F67-B1AA-5BF15E580D77}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testrong.User.Program", "Testrong.User.Program\Testrong.User.Program.csproj", "{E96B1A19-D109-4F67-B1AA-5BF15E580D77}"
EndProject EndProject
+42 -27
View File
@@ -11,8 +11,14 @@ using Testrong.User.Program;
namespace Testrong.User.Program namespace Testrong.User.Program
{ {
/// <summary>
/// Keysight53220A Related
/// </summary>
public class Keysight53220A public class Keysight53220A
{ {
/// <summary>
/// Global variables
/// </summary>
public class Globals public class Globals
{ {
public static int videfaultRM; public static int videfaultRM;
@@ -24,14 +30,22 @@ namespace Testrong.User.Program
public static bool connected; public static bool connected;
} }
/// <summary>
/// KeysightMeasMode
/// </summary>
public enum KeysightMeasMode public enum KeysightMeasMode
{ {
FREQ, FREQ,
INIT INIT
} }
// KeysightMeasMode PresentMode;
/// <summary>
/// Initial DMM
/// </summary>
/// <param name="address">DMM USB ADDR</param>
/// <param name="funcMode">KeysightMeasMode</param>
/// <returns>true if connected, false if not</returns>
public bool InitDMM53220A(string address, KeysightMeasMode funcMode) public bool InitDMM53220A(string address, KeysightMeasMode funcMode)
{ {
try try
@@ -73,7 +87,11 @@ namespace Testrong.User.Program
return false; return false;
} }
} }
/// <summary>
/// Get DMM Measured Data
/// </summary>
/// <param name="count">count</param>
/// <returns>ReturnReadings()</returns>
public double GetDmm53220AMeasureData(int count = 1) public double GetDmm53220AMeasureData(int count = 1)
{ {
if (!Globals.connected) if (!Globals.connected)
@@ -85,8 +103,12 @@ namespace Testrong.User.Program
} }
//bool GlobalSetup = false;
/// <summary>
/// Setup DMM
/// </summary>
/// <param name="funcMode">KeysightMeasMode</param>
/// <returns>SendCmd(text) if Success, false if Failed</returns>
private bool Setup(KeysightMeasMode funcMode) private bool Setup(KeysightMeasMode funcMode)
{ {
try try
@@ -96,47 +118,27 @@ namespace Testrong.User.Program
text += "*CLS\n"; text += "*CLS\n";
text += "STAT:PRES\n"; text += "STAT:PRES\n";
text += "CONF:FREQ\n"; text += "CONF:FREQ\n";
//switch (funcMode)
//{
// case KeysightMeasMode.FREQ:
// {
// //text += "TRIG:COUN 1\n";
// //text += "SAMP:COUN 10\n";
// //text += "INIT\n";
// }
// break;
// default:
// {
// return false;
// }
//}
text += "INP:COUP DC\n"; text += "INP:COUP DC\n";
//text += "INP:NREJ ON\n";
text += "INP:LEV 2\n"; text += "INP:LEV 2\n";
text += "INP:SLOP NEG\n"; text += "INP:SLOP NEG\n";
//text += "INP:LEV 10\n";
text += "SYST:BEEP:STAT OFF\n"; text += "SYST:BEEP:STAT OFF\n";
text += "FREQ:GATE:SOUR TIME\n"; text += "FREQ:GATE:SOUR TIME\n";
text += "FREQ:GATE:TIME .0001\n"; text += "FREQ:GATE:TIME .0001\n";
text += "TRIG:SOUR BUS\n"; text += "TRIG:SOUR BUS\n";
text += "TRIG:COUN 100000\n"; text += "TRIG:COUN 100000\n";
text += "SAMP:COUN 1\n"; text += "SAMP:COUN 1\n";
//text += "INP:LEV:AUTO ON\n";
//text += "SAMP:COUN 2\n";
//text += "TRIG:DEL .01\n";
text += "INIT\n"; text += "INIT\n";
//GlobalSetup = true;
//PresentMode = funcMode;
return SendCmd(text); return SendCmd(text);
} }
catch (Exception) catch (Exception)
{ {
return false; return false;
} }
//return true;
} }
/// <summary>
/// Return DMM Readings
/// </summary>
/// <returns></returns>
private double ReturnReadings() private double ReturnReadings()
{ {
string text = ""; string text = "";
@@ -182,6 +184,11 @@ namespace Testrong.User.Program
} }
} }
/// <summary>
/// Send CMD to DMM
/// </summary>
/// <param name="Cmds">CMD String</param>
/// <returns></returns>
private bool SendCmd(string Cmds) private bool SendCmd(string Cmds)
{ {
try try
@@ -200,12 +207,20 @@ namespace Testrong.User.Program
} }
} }
/// <summary>
/// Close DMM Connection
/// </summary>
/// <returns>true</returns>
public bool CloseDMM53220A() public bool CloseDMM53220A()
{ {
Globals.errorStatus = visa32.viClose(Globals.vi); Globals.errorStatus = visa32.viClose(Globals.vi);
return true; return true;
} }
/// <summary>
///
/// </summary>
/// <returns></returns>
private string GetData() private string GetData()
{ {
StringBuilder stringBuilder = new StringBuilder(2048); StringBuilder stringBuilder = new StringBuilder(2048);
@@ -22,6 +22,8 @@
<LangVersion>7.3</LangVersion> <LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<DocumentationFile>bin\x64\Debug\UserProgram.xml</DocumentationFile>
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath> <OutputPath>bin\x64\Release\</OutputPath>
+387 -211
View File
@@ -4,7 +4,6 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Runtime.Remoting.Contexts;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using Testrong.Core.Common; using Testrong.Core.Common;
@@ -17,11 +16,13 @@ using Testrong.Core.Model.Ppmu;
using Testrong.Core.Model.Relay; using Testrong.Core.Model.Relay;
using Testrong.Core.Primitives; using Testrong.Core.Primitives;
using Testrong.Core.Primitives.Extend; using Testrong.Core.Primitives.Extend;
using Testrong.Core.Primitives.Service.AcTiming;
using Testrong.Core.Primitives.TestrongSystem; using Testrong.Core.Primitives.TestrongSystem;
namespace Testrong.User.Program namespace Testrong.User.Program
{ {
/// <summary>
/// ALL BOARDS
/// </summary>
public enum TestVersion public enum TestVersion
{ {
Board_1K_FT, Board_1K_FT,
@@ -32,6 +33,9 @@ namespace Testrong.User.Program
Board_Ppmu_FT, Board_Ppmu_FT,
KM_2 KM_2
} }
/// <summary>
/// Test Parameters
/// </summary>
public class TestParaSet public class TestParaSet
{ {
public int delayMs; public int delayMs;
@@ -325,7 +329,7 @@ namespace Testrong.User.Program
}; };
#endregion #endregion
#region #region Variables Definition
List<string> testRangesPmu = new List<string> { "5uA", "20uA", "200uA", "2mA", "60mA" }; List<string> testRangesPmu = new List<string> { "5uA", "20uA", "200uA", "2mA", "60mA" };
List<string> testRangesDps = new List<string> { "5uA", "20uA", "200uA", "2mA", "60mA", "1A" }; List<string> testRangesDps = new List<string> { "5uA", "20uA", "200uA", "2mA", "60mA", "1A" };
string[] FreqStr_Test = { "1M", "2M", "2.5M", "5M", "10M" }; string[] FreqStr_Test = { "1M", "2M", "2.5M", "5M", "10M" };
@@ -466,10 +470,17 @@ namespace Testrong.User.Program
int port = 200; int port = 200;
string ksightConnStr = "GPIB1::22::INSTR"; string ksightConnStr = "GPIB1::22::INSTR";
TestVersion SelectTestVersion = Select_Version[Readjson(CONFIG_JSON_PATH).Version]; TestVersion SelectTestVersion = Select_Version[Readjson(CONFIG_JSON_PATH).Version];
const int ChannelCount = 256;
double[] rInt = new double[ChannelCount];
#endregion #endregion
#region #region
/// <summary>
/// Read JSON From json_path
/// </summary>
/// <param name="json_path">The Path of JSON</param>
/// <returns>Json TYPE</returns>
public static Json Readjson(string json_path) public static Json Readjson(string json_path)
{ {
Json get = new Json(); Json get = new Json();
@@ -481,22 +492,23 @@ namespace Testrong.User.Program
return get; return get;
} }
/// <summary>
/* ----------Metadata_handler------------- /// Metadata_handler, Write metadata.csv
* StreamWriter swdata: File Handler, Should be Initialized ahead, /// Also Prevents thread conflict
* int SlotNum: Current Slot Number, /// </summary>
* List<int> slotList: Slot List, /// <param name="swdata">File Handler, Should be Initialized ahead,</param>
* string arm_dna: DNA Data from Zynq, /// <param name="SlotNum">Current Slot Number, </param>
* IFlowRunnerContext context: info from ATE Software, /// <param name="slotList">Slot List, </param>
* bool init_Flag: choose from Header to Body| True=Header/False=Body, /// <param name="arm_dna">DNA Data from Zynq, </param>
* string Type:[OPTIONAL] Only need if init_Flag == False, Channel Type, Possible Value="PMU","DPS", "NULL"(Default), /// <param name="context">info from ATE Software, </param>
* int Channel:[OPTIONAL] Only need if init_Flag == False, Channel Number, Default = -1, /// <param name="init_Flag">choose from Header to Body| True=Header/False=Body, </param>
* string Mode:[OPTIONAL] Only need if init_Flag == False, Test Mode, Possible Value="FVMV","FVMI","FIMV","FIMI","FZMV"(PMU Only), "NULL"(Default), /// <param name="Type">[OPTIONAL] Only need if init_Flag == False, Channel Type, Possible Value="PMU","DPS", "NULL"(Default), </param>
* string Rload:[OPTIONAL] Only need if init_Flag == False,Resistance Load, Default = "NaN", /// <param name="Channel">[OPTIONAL] Only need if init_Flag == False, Channel Number, Default = -1, </param>
* string Range:[OPTIONAL] Only need if init_Flag == False,Range, Possible Value="5uA", "20uA", "200uA", "2mA", "60mA", "1A"(DPS Only), Default = "N/A", /// <param name="Mode">[OPTIONAL] Only need if init_Flag == False, Test Mode, Possible Value="FVMV","FVMI","FIMV","FIMI","FZMV"(PMU Only), "NULL"(Default),</param>
* string filepath:[OPTIONAL] Only need if init_Flag == False, CSV File Path, Default = "N/A", /// <param name="Rload">[OPTIONAL] Only need if init_Flag == False,Resistance Load, Default = "NaN", </param>
* string filetime:[OPTIONAL] Only need if init_Flag == False, CSV File Creation Time, Default = "N/A" /// <param name="Range">[OPTIONAL] Only need if init_Flag == False,Range, Possible Value="5uA", "20uA", "200uA", "2mA", "60mA", "1A"(DPS Only), Default = "N/A", </param>
*/ /// <param name="filepath">[OPTIONAL] Only need if init_Flag == False, CSV File Path, Default = "N/A", </param>
/// <param name="filetime">[OPTIONAL] Only need if init_Flag == False, CSV File Creation Time, Default = "N/A"</param>
public void Metadata_handler(StreamWriter swdata, int SlotNum, List<int> slotList, string arm_dna, IFlowRunnerContext context, bool init_Flag, string Type = "NULL", int Channel = -1, string Mode = "NULL", string Rload = "NaN", string Range = "N/A", string filepath = "N/A", string filetime = "N/A") public void Metadata_handler(StreamWriter swdata, int SlotNum, List<int> slotList, string arm_dna, IFlowRunnerContext context, bool init_Flag, string Type = "NULL", int Channel = -1, string Mode = "NULL", string Rload = "NaN", string Range = "N/A", string filepath = "N/A", string filetime = "N/A")
{ {
//Are We Writing the header of MetaData? //Are We Writing the header of MetaData?
@@ -584,12 +596,13 @@ namespace Testrong.User.Program
} }
} }
/* ----------File_Mover------------- /// <summary>
* int SlotNum: Current Slot Number, /// Move Folder to Bak/History
* List<int> slotList: Slot List, /// </summary>
* string pathFlag: Path Selector, Possible Value="Freq","CAL_Single"(No Pre/Post),"CAL_Normal", /// <param name="SlotNum">Current Slot Number, </param>
* bool isPreCheck:[OPTIONAL] Only need if pathFlag =="CAL_Normal",PreCheck Flag, Default = false /// <param name="slotList">Slot List, </param>
*/ /// <param name="pathFlag">Path Selector, Possible Value="Freq","CAL_Single"(No Pre/Post),"CAL_Normal",</param>
/// <param name="isPreCheck">[OPTIONAL] Only need if pathFlag =="CAL_Normal",PreCheck Flag, Default = false</param>
public void File_Mover(int SlotNum, List<int> slotList, string pathFlag, bool isPreCheck = false) public void File_Mover(int SlotNum, List<int> slotList, string pathFlag, bool isPreCheck = false)
{ {
string DateCode = DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss"); string DateCode = DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss");
@@ -655,11 +668,12 @@ namespace Testrong.User.Program
} }
/* ----------SlotThreadLocker------------- /// <summary>
* int SlotNum: Current Slot Number, /// Prevent thread run at the same time
* List<int> slotList: Slot List, /// </summary>
* string pathFlag: Path Selector, Possible Value="Freq","CAL_Init","CAL","RINT","CAL_COM", /// <param name="SlotNum">Current Slot Number, </param>
*/ /// <param name="slotList">Slot List, </param>
/// <param name="pathFlag">Path Selector, Possible Value="Freq","CAL_Init","CAL","RINT","CAL_COM",</param>
public void SlotThreadLocker(int SlotNum, List<int> slotList, string pathFlag) public void SlotThreadLocker(int SlotNum, List<int> slotList, string pathFlag)
{ {
string WritePath; string WritePath;
@@ -712,7 +726,7 @@ namespace Testrong.User.Program
private int GetDPSTempSensorIndex(int channel) private int GetDPSTempSensorIndex(int channel)
{ {
return ((channel-1)/4); return ((channel - 1) / 4);
} }
public int GetFileSize(string path) public int GetFileSize(string path)
@@ -747,6 +761,10 @@ namespace Testrong.User.Program
} }
} }
} }
/// <summary>
/// Delete Anything inside Folder
/// </summary>
/// <param name="DirPath"></param>
public void EmptyDir(string DirPath) public void EmptyDir(string DirPath)
{ {
System.IO.DirectoryInfo di = new DirectoryInfo(DirPath); System.IO.DirectoryInfo di = new DirectoryInfo(DirPath);
@@ -765,6 +783,13 @@ namespace Testrong.User.Program
} }
return ans; return ans;
} }
/// <summary>
/// Get ATE Measure Result
/// </summary>
/// <param name="InfoList">SiteInfo</param>
/// <param name="PinName">PinName</param>
/// <returns>double Measured Value</returns>
private double GetATEChannelMeasure(List<SiteInfo> InfoList, string[] PinName) private double GetATEChannelMeasure(List<SiteInfo> InfoList, string[] PinName)
{ {
double result = 0; double result = 0;
@@ -784,6 +809,20 @@ namespace Testrong.User.Program
} }
return result; return result;
} }
/// <summary>
/// Get Rload
/// Will Loop Measure 100 times,do average
/// And measure 101th
/// Then Compare the difference between them
/// if Out-Of-Limit
/// Will Try Again
/// For INIFINATE Times
/// </summary>
/// <param name="rdmm">DMM Handler</param>
/// <param name="range">DMM Measure Range</param>
/// <param name="limit">Resistance Diff limit</param>
/// <returns></returns>
private double GetRloadValue(KeysightDMM3458A rdmm, double range, double limit) private double GetRloadValue(KeysightDMM3458A rdmm, double range, double limit)
{ {
double value = 0; double value = 0;
@@ -927,26 +966,72 @@ namespace Testrong.User.Program
return DmmDic; return DmmDic;
} }
/*----------Write Data To File------------- /// <summary>
* Variable Definition /// Write Data To File, Need import StreamWriter and close FileHandler after using this func
* string filename: filename /// </summary>
* int slot: Slot Number /// <param name="sw">StreamWriter, Need to be initialized first</param>
* string dna: DNA Number /// <param name="slot">Slot Number</param>
* string type: DPS/PMU /// <param name="dna">DNA Number</param>
* int channel: Channel Number(PMU:1-256, DPS:1-32/64) /// <param name="type">DPS/PMU</param>
* string mode: FVMV/FVMI/FIMV/FZMV(PMU Only) /// <param name="channel">Channel Number(PMU:1-256, DPS:1-32/64)</param>
* string rload: External Resistance Load /// <param name="mode">FVMV/FVMI/FIMV/FZMV(PMU Only)</param>
* double[,] extR: Internal Resistance On the External Calibration Board /// <param name="rload">External Resistance Load</param>
* string range: Board Measurment Range(5uA; 20uA; 200uA; 2mA; 60mA; 1A(DPS Only)) /// <param name="extR">Internal Resistance On the External Calibration Board</param>
* double[] ForceValue: ForceValue /// <param name="range">Board Measurment Range(5uA; 20uA; 200uA; 2mA; 60mA; 1A(DPS Only))</param>
* double[] AteMeasure: ATE Measure Value /// <param name="ForceValue">ForceValue</param>
* double[] DmmMeasure: DMM Measure Value /// <param name="AteMeasure">ATE Measure Value</param>
* double[] TempValue: Temperature Value(May Not Available) /// <param name="DmmMeasure">DMM Measure Value</param>
*/ /// <param name="TempValue">Temperature Value(May Not Available)</param>
public void WriteSingleFile(string filename, int slot, string dna, string type, int channel, string mode, string rload, double[,] extR, string range, double[] ForceValue, double[] AteMeasure, double[] DmmMeasure, double[] TempValue) /// <param name="contextFormat">[OPTIONAL] For custom CSV content</param>
/// <param name="customData">[OPTIONAL]</param>
/// <param name="SampliCount">[OPTIONAL]</param>
public void WriteSingleFile(StreamWriter sw, int slot, string dna, string type, int channel, string mode, string rload, double[,] extR, string range, double[] ForceValue, double[] AteMeasure, double[] DmmMeasure, double[] TempValue, string contextFormat = "Normal", double[] customData = null, int SampliCount = 5)
{ {
StreamWriter sw = new StreamWriter(filename, true, Encoding.UTF8); switch (contextFormat)
sw.AutoFlush = true; {
case "Freq":
sw.Write("Channel_No,Freq_Force,Freq_Measure\n");
for (int fCount = 0; fCount < SampliCount; fCount++) // 625K - 32M
{
for(int ch=0; ch<channel;ch ++)
{
sw.Write($"{ch},");
sw.Write($"{customData[2 * (fCount)]:F3},");
sw.Write($"{customData[2 * (fCount+1)]:F5}\n");
sw.Flush();
}
}
break;
case "RintGND":
sw.Write("Tester_Name,Foo\n");
sw.Write($"Slot_No,{slot}\n");
sw.Write($"Board_Dna,{dna}\n");
sw.Write("Channel_Type,PMU\n");
sw.Write($"Channel_No,{channel}\n");
sw.Write($"Mode,FVMI\n");
sw.Write($"R_Load,Hi-Z\n");
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");
sw.Write($"Force_0V_MV={customData[0] * 1000:F8}mV\n"); //Write MV at ForceV=0
sw.Write($"Force_0V_MI={customData[1] * 1000:F8}mA\n"); //Write MI at ForceV=0
sw.Write("Force Voltage(mV),Measure Voltage(mV),Measure Current(mA),Diff_Voltage(mV),Resistance(FV/MI),Resistance(Caled),Temperature\n");
for (int writeLine = SampliCount; writeLine < SampliCount; writeLine++)
{
sw.Write($"{ForceValue[writeLine] * 1000:F8},");
sw.Write($"{customData[writeLine + 2] * 1000:F8},"); //customData[writeLine + 2] = Measure Voltage
sw.Write($"{AteMeasure[writeLine] * 1000:F8},");
sw.Write($"{(customData[writeLine + 2] - ForceValue[writeLine]) * 1000:F8},");
sw.Write($"{ForceValue[writeLine] / AteMeasure[writeLine]:F8},");
sw.Write($"{(ForceValue[writeLine]- customData[0]) / (AteMeasure[writeLine]- customData[1]):F8},");
sw.Write($"{TempValue[writeLine]:F8}\n");
}
break;
case "Normal":
default:
sw.Write("Tester_Name,Foo\n"); sw.Write("Tester_Name,Foo\n");
sw.Write($"Slot_No,{slot}\n"); sw.Write($"Slot_No,{slot}\n");
sw.Write($"Board_Dna,{dna}\n"); sw.Write($"Board_Dna,{dna}\n");
@@ -968,7 +1053,7 @@ namespace Testrong.User.Program
sw.Write("Meas_Range,13V\n"); sw.Write("Meas_Range,13V\n");
sw.Write("\n"); sw.Write("\n");
sw.Write("Force Value,ATE Measure,DMM Measure,Temperature\n"); sw.Write("Force Value,ATE Measure,DMM Measure,Temperature\n");
for (int writeLine = 0; writeLine < 5; writeLine++) for (int writeLine = SampliCount; writeLine < SampliCount; writeLine++)
{ {
if (mode == "FVMV" || mode == "FZMV") if (mode == "FVMV" || mode == "FZMV")
@@ -1009,8 +1094,8 @@ namespace Testrong.User.Program
} }
sw.Write($"{TempValue[writeLine]:F8}\n"); sw.Write($"{TempValue[writeLine]:F8}\n");
} }
sw.Flush(); break;
sw.Close(); }
} }
#endregion #endregion
@@ -1130,7 +1215,7 @@ namespace Testrong.User.Program
} }
//creat dir //creat dir
File_Mover(SlotNum:SlotNum,slotList:slotList,pathFlag:"Freq"); File_Mover(SlotNum: SlotNum, slotList: slotList, pathFlag: "Freq");
StreamWriter swResult; StreamWriter swResult;
if (SlotNum == slotList[0]) if (SlotNum == slotList[0])
@@ -1158,11 +1243,11 @@ namespace Testrong.User.Program
FreqCounter53220A.InitDMM53220A(addressFreq, Keysight53220A.KeysightMeasMode.FREQ); FreqCounter53220A.InitDMM53220A(addressFreq, Keysight53220A.KeysightMeasMode.FREQ);
} }
Thread.Sleep(100); Thread.Sleep(100);
double[] customData = new double[2 * (FreqStr.Length + 1)];
for (int fCount = 0; fCount < FreqStr.Length; fCount++) // 625K - 32M for (int fCount = 0; fCount < FreqStr.Length; fCount++) // 625K - 32M
{ {
string FreqFileNmae = EXT_CAL_FREQ_PATH + "Slot" + SlotNum + "_" + "Freq" + "_" + FreqStr[fCount] + ".csv"; string FreqFileNmae = EXT_CAL_FREQ_PATH + "Slot" + SlotNum + "_" + "Freq" + "_" + FreqStr[fCount] + ".csv";
StreamWriter sw = new StreamWriter(FreqFileNmae, true, Encoding.UTF8); StreamWriter sw = new StreamWriter(FreqFileNmae, true, Encoding.UTF8);
sw.Write("Channel_No,Freq_Force,Freq_Measure\n");
Thread.Sleep(10); Thread.Sleep(10);
string strPattern = FreqInfo[FreqStr[fCount]]; string strPattern = FreqInfo[FreqStr[fCount]];
PATTERN.DCLevel.Set("level_5V"); PATTERN.DCLevel.Set("level_5V");
@@ -1211,11 +1296,33 @@ namespace Testrong.User.Program
break; break;
} }
} }
sw.Write($"{ChannelPmu[loopk]},"); customData[2 * (fCount)] = FreqForce[fCount];
sw.Write($"{FreqForce[fCount]:F3},"); customData[2 * (fCount + 1)] = freqValue;
sw.Write($"{freqValue:F5}\n");
sw.Flush(); sw.Flush();
} }
double[,] ZeroExtR = {
{ 0.0 , 0.0 , 0.0}
};
double[] Zero=new double[1];
Zero[0] = 0;
WriteSingleFile(
sw:sw,
slot:SlotNum,
dna:arm_dna,
type:"K7",
channel: PmuChannelCount,
mode:"Freq",
rload:"0",
extR: ZeroExtR,
range:"NULL",
ForceValue: Zero,
AteMeasure: Zero,
DmmMeasure: Zero,
TempValue: Zero,
contextFormat:"Freq",
customData:customData,
SampliCount: FreqStr.Length
);
sw.Close(); sw.Close();
} }
@@ -1223,14 +1330,19 @@ 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();
SlotThreadLocker(SlotNum:SlotNum,slotList:slotList,pathFlag:"Freq"); SlotThreadLocker(SlotNum: SlotNum, slotList: slotList, pathFlag: "Freq");
if (SlotNum == slotList[slotList.Count - 1]) if (SlotNum == slotList[slotList.Count - 1])
{ {
swResult.Close(); swResult.Close();
} }
} }
/// <summary>
/// Reset Rint
/// Empty Local Rint Folder and Files
/// Put Initial Files into Zynq (Not only Rint,but also others)
/// </summary>
/// <param name="context">info from ATE Software</param>
void Rint_Reset(IFlowRunnerContext context) void Rint_Reset(IFlowRunnerContext context)
{ {
var slotInfos = context.FlowCatalog.GetAll<SlotInfo>(); var slotInfos = context.FlowCatalog.GetAll<SlotInfo>();
@@ -1319,6 +1431,13 @@ namespace Testrong.User.Program
SlotThreadLocker(SlotNum: SlotNum, slotList: slotList, pathFlag: "CAL_Init"); SlotThreadLocker(SlotNum: SlotNum, slotList: slotList, pathFlag: "CAL_Init");
} }
/// <summary>
/// To Pre-Test Rint with External Calibration Board
/// Mainly get FVMV data to Calibrate ForceV
/// </summary>
/// <param name="context">info from ATE Software</param>
/// <param name="testVersion"></param>
void Rint_FVMV_2mA_Pre(IFlowRunnerContext context, TestVersion testVersion) void Rint_FVMV_2mA_Pre(IFlowRunnerContext context, TestVersion testVersion)
{ {
List<int> ChannelDps = new List<int>(); List<int> ChannelDps = new List<int>();
@@ -1352,7 +1471,7 @@ namespace Testrong.User.Program
double[,] ExtBoard_Res = ReadRext(EXT_CAL_INIT_PATH + "ExtBoardRes.csv"); double[,] ExtBoard_Res = ReadRext(EXT_CAL_INIT_PATH + "ExtBoardRes.csv");
//Folder Related //Folder Related
File_Mover(SlotNum:SlotNum,slotList:slotList,pathFlag:"CAL_Single"); File_Mover(SlotNum: SlotNum, slotList: slotList, pathFlag: "CAL_Single");
//-----Start Slot Number----- //-----Start Slot Number-----
StreamWriter swdata; StreamWriter swdata;
@@ -1383,10 +1502,6 @@ namespace Testrong.User.Program
string filename = EXT_CAL_PATH + filepath; string filename = EXT_CAL_PATH + filepath;
int ch = ChannelPmu[loopk]; int ch = ChannelPmu[loopk];
StreamWriter sw = new StreamWriter(filename, true, Encoding.UTF8)
{
AutoFlush = true
};
double[] AteMeasure = new double[SampliCount]; double[] AteMeasure = new double[SampliCount];
double[] ForceValue = new double[SampliCount]; double[] ForceValue = new double[SampliCount];
@@ -1422,8 +1537,11 @@ namespace Testrong.User.Program
PPMU.Force(PmuPinName, 0, PpmuMode.FVMV, PpmuIRange._2mA, VRange.Normal); PPMU.Force(PmuPinName, 0, PpmuMode.FVMV, PpmuIRange._2mA, VRange.Normal);
WriteSingleFile( StreamWriter sw = new StreamWriter(filename, true, Encoding.UTF8)
filename: filename, {
AutoFlush = true
};
WriteSingleFile(sw: sw,
slot: SlotNum, slot: SlotNum,
dna: arm_dna, dna: arm_dna,
type: "PMU", type: "PMU",
@@ -1435,14 +1553,12 @@ namespace Testrong.User.Program
ForceValue: ForceValue, ForceValue: ForceValue,
AteMeasure: AteMeasure, AteMeasure: AteMeasure,
DmmMeasure: DMMValue, DmmMeasure: DMMValue,
TempValue:TempValue TempValue: TempValue);
);
sw.Flush(); sw.Flush();
sw.Close(); sw.Close();
Metadata_handler( Metadata_handler(swdata: swdata,
swdata: swdata,
SlotNum: SlotNum, SlotNum: SlotNum,
slotList: slotList, slotList: slotList,
arm_dna: arm_dna, arm_dna: arm_dna,
@@ -1454,8 +1570,7 @@ namespace Testrong.User.Program
Rload: "Hi-Z", Rload: "Hi-Z",
Range: "2mA", Range: "2mA",
filepath: filepath, filepath: filepath,
filetime: filetime filetime: filetime);
);
} }
SlotThreadLocker(SlotNum: SlotNum, slotList: slotList, pathFlag: "CAL"); SlotThreadLocker(SlotNum: SlotNum, slotList: slotList, pathFlag: "CAL");
@@ -1463,97 +1578,13 @@ namespace Testrong.User.Program
swdata.Close(); swdata.Close();
} }
void Rint_DataUpload(IFlowRunnerContext context) /// <summary>
{ /// Post-Test Rint with External Calibration Board
var slotInfos = context.FlowCatalog.GetAll<SlotInfo>(); /// Do FVMV Second time with MV Compensate
List<int> slotList = new List<int>(); /// Calculate Rint value and generate Pmu_r file
for (int slotLen = 0; slotLen < slotInfos.Count; slotLen++) /// </summary>
{ /// <param name="context">info from ATE Software</param>
if (slotInfos[slotLen].FirmwareVersion == "") /// <param name="testVersion"></param>
{
continue;
}
slotList.Add(slotInfos[slotLen].No);
}
byte[] armDnaPortCmd = new byte[2] { 14, 57 }; // command to read arm dna
byte[] armDnaRaw = context.Communicator.Send(armDnaPortCmd); //send command
armDnaRaw = armDnaRaw.Reverse().ToArray();
string arm_dna = BitConverter.ToUInt64(armDnaRaw, 0).ToString(); //convert hex dna to decimal
int SlotNum = context.Communicator.SlotNo;
ExternalCalibrationHandle extCaliHandle = new ExternalCalibrationHandle();
if (SlotNum == slotList[0])
{
DelayHelper.Sleep(1);
}
else
{
int Cried = slotList.FindIndex(x => x.Equals(SlotNum));
while (true)
{
Thread.Sleep(1000);
if (File.Exists(RINT_COMPFILE_PATH + slotList[Cried - 1] + ".flag"))
{
File.Delete(RINT_COMPFILE_PATH + slotList[Cried - 1] + ".flag");
break;
}
}
}
Thread.Sleep(10);
var isDnaUploadOK = extCaliHandle.UploadFile(context.Communicator.ServerIP, RINT_COMPFILE_PATH + "DNA_" + context.Communicator.ServerIP + ".csv", FileType.dna);
LogRawText($"Dna Status: {isDnaUploadOK}");
Thread.Sleep(10);
var isMVUploadOK = extCaliHandle.UploadFile(context.Communicator.ServerIP, RINT_COMPFILE_PATH + context.Communicator.ServerIP + "_MV.csv", FileType.mv);
LogRawText($"MV Status: {isMVUploadOK}");
SlotThreadLocker(SlotNum: SlotNum, slotList: slotList, pathFlag: "RINT");
}
void Pmur_Upload(IFlowRunnerContext context)
{
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);
}
byte[] armDnaPortCmd = new byte[2] { 14, 57 }; // command to read arm dna
byte[] armDnaRaw = context.Communicator.Send(armDnaPortCmd); //send command
armDnaRaw = armDnaRaw.Reverse().ToArray();
string arm_dna = BitConverter.ToUInt64(armDnaRaw, 0).ToString(); //convert hex dna to decimal
int SlotNum = context.Communicator.SlotNo;
ExternalCalibrationHandle extCaliHandle = new ExternalCalibrationHandle();
if (SlotNum == slotList[0])
{
DelayHelper.Sleep(1);
}
else
{
int Cried = slotList.FindIndex(x => x.Equals(SlotNum));
while (true)
{
Thread.Sleep(1000);
if (File.Exists(RINT_FILE_PATH + slotList[Cried - 1] + ".flag"))
{
File.Delete(RINT_FILE_PATH + slotList[Cried - 1] + ".flag");
break;
}
}
}
Thread.Sleep(10);
var isPmurUploadOK = extCaliHandle.UploadFile(context.Communicator.ServerIP, RINT_FILE_PATH + context.Communicator.ServerIP + "_Pmur.txt", FileType.pmu_r);
LogRawText($"Pmur Status: {isPmurUploadOK}");
if (SlotNum < slotList[slotList.Count - 1])
{
StreamWriter swSignal = new StreamWriter(RINT_FILE_PATH + SlotNum + ".flag");
swSignal.Flush();
swSignal.Close();
}
}
void Rint_FVMV_2mA_Post(IFlowRunnerContext context, TestVersion testVersion) void Rint_FVMV_2mA_Post(IFlowRunnerContext context, TestVersion testVersion)
{ {
List<int> ChannelDps = new List<int>(); List<int> ChannelDps = new List<int>();
@@ -1592,7 +1623,7 @@ namespace Testrong.User.Program
double[,] ExtBoard_Res = ReadRext(EXT_CAL_INIT_PATH + "ExtBoardRes.csv"); double[,] ExtBoard_Res = ReadRext(EXT_CAL_INIT_PATH + "ExtBoardRes.csv");
//-----Move File To History----- //-----Move File To History-----
File_Mover(SlotNum:SlotNum,slotList:slotList,pathFlag:"CAL_Single"); File_Mover(SlotNum: SlotNum, slotList: slotList, pathFlag: "CAL_Single");
//-----Start Slot Number----- //-----Start Slot Number-----
StreamWriter swdata; StreamWriter swdata;
@@ -1606,7 +1637,7 @@ namespace Testrong.User.Program
slotList: slotList, slotList: slotList,
arm_dna: arm_dna, arm_dna: arm_dna,
context: context, context: context,
init_Flag:true init_Flag: true
); );
dmm.InitDMM(ksightConnStr); dmm.InitDMM(ksightConnStr);
@@ -1628,10 +1659,7 @@ namespace Testrong.User.Program
RELAY.SwitchToPPMU(PmuPinName); RELAY.SwitchToPPMU(PmuPinName);
string filepath = "Slot" + SlotNum + "_PMU_" + "ch" + ChannelPmu[loopk] + "_" + "FVMV" + "_" + "Hi-Z" + "_" + "2mA" + ".csv"; string filepath = "Slot" + SlotNum + "_PMU_" + "ch" + ChannelPmu[loopk] + "_" + "FVMV" + "_" + "Hi-Z" + "_" + "2mA" + ".csv";
string filename = EXT_CAL_PATH + filepath; string filename = EXT_CAL_PATH + filepath;
StreamWriter sw = new StreamWriter(filename, true, Encoding.UTF8)
{
AutoFlush = true
};
extCaliHandle.SetPpmuExternalCalibration(extConnStr, extPort, SlotNum, ExternalCalibrationMode.Channel, ch, ExtCaliVI.V, ExtCaliLoad.RC_RL7, 0);//change channel extCaliHandle.SetPpmuExternalCalibration(extConnStr, extPort, SlotNum, ExternalCalibrationMode.Channel, ch, ExtCaliVI.V, ExtCaliLoad.RC_RL7, 0);//change channel
if (loopk == 0) if (loopk == 0)
@@ -1659,8 +1687,11 @@ namespace Testrong.User.Program
} }
PPMU.Force(PmuPinName, 0, PpmuMode.FVMV, PpmuIRange._2mA, VRange.Normal); PPMU.Force(PmuPinName, 0, PpmuMode.FVMV, PpmuIRange._2mA, VRange.Normal);
WriteSingleFile( StreamWriter sw = new StreamWriter(filename, true, Encoding.UTF8)
filename: filename, {
AutoFlush = true
};
WriteSingleFile(sw: sw,
slot: SlotNum, slot: SlotNum,
dna: arm_dna, dna: arm_dna,
type: "PMU", type: "PMU",
@@ -1672,14 +1703,12 @@ namespace Testrong.User.Program
ForceValue: ForceValue, ForceValue: ForceValue,
AteMeasure: AteMeasure, AteMeasure: AteMeasure,
DmmMeasure: DMMValue, DmmMeasure: DMMValue,
TempValue: TempValue TempValue: TempValue);
);
sw.Flush(); sw.Flush();
sw.Close(); sw.Close();
Metadata_handler( Metadata_handler(swdata: swdata,
swdata: swdata,
SlotNum: SlotNum, SlotNum: SlotNum,
slotList: slotList, slotList: slotList,
arm_dna: arm_dna, arm_dna: arm_dna,
@@ -1691,8 +1720,8 @@ namespace Testrong.User.Program
Rload: rload.ToString(), Rload: rload.ToString(),
Range: "2mA", Range: "2mA",
filepath: filepath, filepath: filepath,
filetime: filetime filetime: filetime);
);
} }
swdata.Flush(); swdata.Flush();
swdata.Close(); swdata.Close();
@@ -1760,6 +1789,7 @@ namespace Testrong.User.Program
ChannelFormat = Convert.ToString(ChannelNum); ChannelFormat = Convert.ToString(ChannelNum);
} }
Pmur.WriteLine($"ch {ChannelFormat} : {res:F3}"); Pmur.WriteLine($"ch {ChannelFormat} : {res:F3}");
rInt[ChannelNum] = res; //Put R_Int into array
datassingle.Clear(); datassingle.Clear();
singlefile.Close(); singlefile.Close();
} }
@@ -1769,6 +1799,112 @@ namespace Testrong.User.Program
SlotThreadLocker(SlotNum: SlotNum, slotList: slotList, pathFlag: "CAL"); SlotThreadLocker(SlotNum: SlotNum, slotList: slotList, pathFlag: "CAL");
#endregion #endregion
} }
/// <summary>
/// Use TFTP to upload DNA/MV file into Zynq
/// </summary>
/// <param name="context">info from ATE Software</param>
void Rint_DataUpload(IFlowRunnerContext context)
{
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);
}
byte[] armDnaPortCmd = new byte[2] { 14, 57 }; // command to read arm dna
byte[] armDnaRaw = context.Communicator.Send(armDnaPortCmd); //send command
armDnaRaw = armDnaRaw.Reverse().ToArray();
string arm_dna = BitConverter.ToUInt64(armDnaRaw, 0).ToString(); //convert hex dna to decimal
int SlotNum = context.Communicator.SlotNo;
ExternalCalibrationHandle extCaliHandle = new ExternalCalibrationHandle();
if (SlotNum == slotList[0])
{
DelayHelper.Sleep(1);
}
else
{
int Cried = slotList.FindIndex(x => x.Equals(SlotNum));
while (true)
{
Thread.Sleep(1000);
if (File.Exists(RINT_COMPFILE_PATH + slotList[Cried - 1] + ".flag"))
{
File.Delete(RINT_COMPFILE_PATH + slotList[Cried - 1] + ".flag");
break;
}
}
}
Thread.Sleep(10);
var isDnaUploadOK = extCaliHandle.UploadFile(context.Communicator.ServerIP, RINT_COMPFILE_PATH + "DNA_" + context.Communicator.ServerIP + ".csv", FileType.dna);
LogRawText($"Dna Status: {isDnaUploadOK}");
Thread.Sleep(10);
var isMVUploadOK = extCaliHandle.UploadFile(context.Communicator.ServerIP, RINT_COMPFILE_PATH + context.Communicator.ServerIP + "_MV.csv", FileType.mv);
LogRawText($"MV Status: {isMVUploadOK}");
SlotThreadLocker(SlotNum: SlotNum, slotList: slotList, pathFlag: "RINT");
}
/// <summary>
/// Use TFTP to upload PMU_R(Rint) file into Zynq
/// </summary>
/// <param name="context">info from ATE Software</param>
void Pmur_Upload(IFlowRunnerContext context)
{
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);
}
byte[] armDnaPortCmd = new byte[2] { 14, 57 }; // command to read arm dna
byte[] armDnaRaw = context.Communicator.Send(armDnaPortCmd); //send command
armDnaRaw = armDnaRaw.Reverse().ToArray();
string arm_dna = BitConverter.ToUInt64(armDnaRaw, 0).ToString(); //convert hex dna to decimal
int SlotNum = context.Communicator.SlotNo;
ExternalCalibrationHandle extCaliHandle = new ExternalCalibrationHandle();
if (SlotNum == slotList[0])
{
DelayHelper.Sleep(1);
}
else
{
int Cried = slotList.FindIndex(x => x.Equals(SlotNum));
while (true)
{
Thread.Sleep(1000);
if (File.Exists(RINT_FILE_PATH + slotList[Cried - 1] + ".flag"))
{
File.Delete(RINT_FILE_PATH + slotList[Cried - 1] + ".flag");
break;
}
}
}
Thread.Sleep(10);
var isPmurUploadOK = extCaliHandle.UploadFile(context.Communicator.ServerIP, RINT_FILE_PATH + context.Communicator.ServerIP + "_Pmur.txt", FileType.pmu_r);
LogRawText($"Pmur Status: {isPmurUploadOK}");
if (SlotNum < slotList[slotList.Count - 1])
{
StreamWriter swSignal = new StreamWriter(RINT_FILE_PATH + SlotNum + ".flag");
swSignal.Flush();
swSignal.Close();
}
}
/// <summary>
/// Put Initial Files into Zynq (MV MI DNA)
/// </summary>
/// <param name="context">info from ATE Software</param>
void ExternalCalibrationReset(IFlowRunnerContext context) void ExternalCalibrationReset(IFlowRunnerContext context)
{ {
var slotInfos = context.FlowCatalog.GetAll<SlotInfo>(); var slotInfos = context.FlowCatalog.GetAll<SlotInfo>();
@@ -1819,6 +1955,14 @@ namespace Testrong.User.Program
SlotThreadLocker(SlotNum: SlotNum, slotList: slotList, pathFlag: "CAL_Init"); SlotThreadLocker(SlotNum: SlotNum, slotList: slotList, pathFlag: "CAL_Init");
} }
/// <summary>
/// Get External Calibration Board's Resistance Value
/// Will Call GetRloadValue(),
/// Will get R Value for each different Type and Mode
/// </summary>
/// <param name="context">info from ATE Software</param>
/// <param name="testVersion"></param>
void DmmGetResValue(IFlowRunnerContext context, TestVersion testVersion) void DmmGetResValue(IFlowRunnerContext context, TestVersion testVersion)
{ {
//config DMM3458A //config DMM3458A
@@ -1925,6 +2069,15 @@ namespace Testrong.User.Program
SlotThreadLocker(SlotNum: SlotNum, slotList: slotList, pathFlag: "CAL_Init"); SlotThreadLocker(SlotNum: SlotNum, slotList: slotList, pathFlag: "CAL_Init");
} }
/// <summary>
/// Main Function to Do External Instrument Calibration
/// </summary>
/// <param name="context">info from ATE Software</param>
/// <param name="testVersion"></param>
/// <param name="isFirstTest">Flag for first test or retest</param>
/// <param name="isPreCheck">Flag for Precheck/Postcheck</param>
void ExternalCalibrationCollect(IFlowRunnerContext context, TestVersion testVersion, bool isFirstTest, bool isPreCheck) void ExternalCalibrationCollect(IFlowRunnerContext context, TestVersion testVersion, bool isFirstTest, bool isPreCheck)
{ {
#region Read JSON #region Read JSON
@@ -2164,7 +2317,7 @@ namespace Testrong.User.Program
#region File/Folder Prepartion #region File/Folder Prepartion
//-----Move File To History----- //-----Move File To History-----
File_Mover(SlotNum: SlotNum, slotList: slotList, pathFlag: "CAL_Normal",isPreCheck:isPreCheck); File_Mover(SlotNum: SlotNum, slotList: slotList, pathFlag: "CAL_Normal", isPreCheck: isPreCheck);
//-----Start Slot Number----- //-----Start Slot Number-----
// Write MetaData.csv Header // Write MetaData.csv Header
@@ -2740,8 +2893,13 @@ namespace Testrong.User.Program
string filepath = "Slot" + SlotNum + "_PMU_" + "ch" + ch + "_" + Mode + "_" + Rload + "_" + Range + ".csv"; string filepath = "Slot" + SlotNum + "_PMU_" + "ch" + ch + "_" + Mode + "_" + Rload + "_" + Range + ".csv";
string filename = EXT_CAL_PATH + filepath; string filename = EXT_CAL_PATH + filepath;
string filetime = DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss"); string filetime = DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss");
WriteSingleFile(
filename: filename, StreamWriter sw = new StreamWriter(filename, true, Encoding.UTF8)
{
AutoFlush = true
};
WriteSingleFile(sw: sw,
slot: SlotNum, slot: SlotNum,
dna: arm_dna, dna: arm_dna,
type: Type, type: Type,
@@ -2753,11 +2911,12 @@ namespace Testrong.User.Program
ForceValue: ForceValueDir[ch], ForceValue: ForceValueDir[ch],
AteMeasure: AteMeasureDir[ch], AteMeasure: AteMeasureDir[ch],
DmmMeasure: DmmMeasureDir[ch], DmmMeasure: DmmMeasureDir[ch],
TempValue: TempValueDir[ch] TempValue: TempValueDir[ch]);
);
Metadata_handler( sw.Flush();
swdata: swdata, sw.Close();
Metadata_handler(swdata: swdata,
SlotNum: SlotNum, SlotNum: SlotNum,
slotList: slotList, slotList: slotList,
arm_dna: arm_dna, arm_dna: arm_dna,
@@ -2769,11 +2928,10 @@ namespace Testrong.User.Program
Rload: rl, Rload: rl,
Range: Range, Range: Range,
filepath: filepath, filepath: filepath,
filetime: filetime filetime: filetime);
);
} }
} }
else if(Type == "DPS") else if (Type == "DPS")
{ {
for (int writeNum = 0; writeNum < testCh.Count; writeNum++) for (int writeNum = 0; writeNum < testCh.Count; writeNum++)
{ {
@@ -2784,8 +2942,13 @@ namespace Testrong.User.Program
double[,] ZeroExtR = { double[,] ZeroExtR = {
{ 0.0 , 0.0 , 0.0} { 0.0 , 0.0 , 0.0}
}; };
WriteSingleFile(
filename: filename, StreamWriter sw = new StreamWriter(filename, true, Encoding.UTF8)
{
AutoFlush = true
};
WriteSingleFile(sw: sw,
slot: SlotNum, slot: SlotNum,
dna: arm_dna, dna: arm_dna,
type: Info[loopi].chType, type: Info[loopi].chType,
@@ -2797,11 +2960,12 @@ namespace Testrong.User.Program
ForceValue: ForceValueDir[ch], ForceValue: ForceValueDir[ch],
AteMeasure: AteMeasureDir[ch], AteMeasure: AteMeasureDir[ch],
DmmMeasure: DmmMeasureDir[ch], DmmMeasure: DmmMeasureDir[ch],
TempValue: TempValueDir[ch] TempValue: TempValueDir[ch]);
);
Metadata_handler( sw.Flush();
swdata: swdata, sw.Close();
Metadata_handler(swdata: swdata,
SlotNum: SlotNum, SlotNum: SlotNum,
slotList: slotList, slotList: slotList,
arm_dna: arm_dna, arm_dna: arm_dna,
@@ -2813,8 +2977,7 @@ namespace Testrong.User.Program
Rload: rl, Rload: rl,
Range: Range, Range: Range,
filepath: filepath, filepath: filepath,
filetime: filetime filetime: filetime);
);
} }
} }
#endregion #endregion
@@ -2832,6 +2995,10 @@ namespace Testrong.User.Program
} }
/// <summary>
/// Use TFTP to upload DNA/MV/MI file into Zynq
/// </summary>
/// <param name="context">info from ATE Software</param>
void ExternalCalibrationWriteCalFiles(IFlowRunnerContext context) void ExternalCalibrationWriteCalFiles(IFlowRunnerContext context)
{ {
//read dna and ip //read dna and ip
@@ -2885,6 +3052,12 @@ namespace Testrong.User.Program
SlotThreadLocker(SlotNum: SlotNum, slotList: slotList, pathFlag: "CAL_COM"); SlotThreadLocker(SlotNum: SlotNum, slotList: slotList, pathFlag: "CAL_COM");
} }
/// <summary>
/// Get Measurments For Rint w/ GND Board
/// Only Use FVMI 2mA Range
/// </summary>
/// <param name="context">info from ATE Software</param>
void Rint_GND_FVMI_2mA(IFlowRunnerContext context) void Rint_GND_FVMI_2mA(IFlowRunnerContext context)
{ {
List<int> ChannelPmu = new List<int>(); List<int> ChannelPmu = new List<int>();
@@ -2989,8 +3162,7 @@ namespace Testrong.User.Program
} }
PPMU.Force(PmuPinName, 0, PpmuMode.FVMI, PpmuIRange._2mA, VRange.Normal); PPMU.Force(PmuPinName, 0, PpmuMode.FVMI, PpmuIRange._2mA, VRange.Normal);
WriteSingleFile( WriteSingleFile(sw: sw,
filename: filename,
slot: SlotNum, slot: SlotNum,
dna: arm_dna, dna: arm_dna,
type: "PMU", type: "PMU",
@@ -3002,22 +3174,26 @@ namespace Testrong.User.Program
ForceValue: ForceValue, ForceValue: ForceValue,
AteMeasure: AteMeasure, AteMeasure: AteMeasure,
DmmMeasure: DMMValue, DmmMeasure: DMMValue,
TempValue: TempValue TempValue: TempValue,
); contextFormat: "RintGND");
sw.Flush(); sw.Flush();
sw.Close(); sw.Close();
swdata.Write($"{arm_dna},");
swdata.Write("PMU,"); Metadata_handler(swdata: swdata,
swdata.Write($"{ChannelPmu[loopk]},"); SlotNum: SlotNum,
swdata.Write($"FVMI,"); slotList: slotList,
swdata.Write($"Hi-Z,"); arm_dna: arm_dna,
swdata.Write($"2mA,"); context: context,
swdata.Write("20V,"); init_Flag: false,
swdata.Write("13V,"); Type: "PMU",
swdata.Write($"{filepath},"); Channel: ch,
swdata.Write($"{filetime}\n"); Mode: "FVMI",
swdata.Flush(); Rload: "Hi-Z",
Range: "2mA",
filepath: filepath,
filetime: filetime);
} }
swdata.Flush(); swdata.Flush();
swdata.Close(); swdata.Close();
Binary file not shown.
Binary file not shown.
@@ -2421,3 +2421,4 @@ D:\WORK\ManLin\Verify\UserProgram_time\Testrong.User.Program\obj\x64\Debug\Testr
D:\WORK\ManLin\Verify\UserProgram_time\Testrong.User.Program\obj\x64\Debug\Testrong.A8AD3C05.Up2Date D:\WORK\ManLin\Verify\UserProgram_time\Testrong.User.Program\obj\x64\Debug\Testrong.A8AD3C05.Up2Date
D:\WORK\ManLin\Verify\UserProgram_time\Testrong.User.Program\obj\x64\Debug\UserProgram.dll D:\WORK\ManLin\Verify\UserProgram_time\Testrong.User.Program\obj\x64\Debug\UserProgram.dll
D:\WORK\ManLin\Verify\UserProgram_time\Testrong.User.Program\obj\x64\Debug\UserProgram.pdb D:\WORK\ManLin\Verify\UserProgram_time\Testrong.User.Program\obj\x64\Debug\UserProgram.pdb
D:\WORK\ManLin\Verify\UserProgram_time\Testrong.User.Program\bin\x64\Debug\UserProgram.xml
Binary file not shown.
Binary file not shown.