解析下面m_CurrentTestPoint 的产生过程
if (this.m_TestPoints == null || this.m_TestPoints.Count < 4)
{
throw new OperationCanceledException("number of interpolation points is less than 4");
}
此方法中的所有方法都引用RegisterInterpolationPoint
public void Trim(bool toggleIsUp) // 此方法中的所有方法都引用RegisterInterpolationPoint
{
if (DigitalSingleL3FSM.m_MachineConfig.SensorMeasureSystem == MachineConfig.SensorMeasureCards.AESI2_Parallel)
{
this.TrimParallel(toggleIsUp);
return;
}
if (DigitalSingleL3FSM.m_MachineConfig.SensorMeasureSystem == MachineConfig.SensorMeasureCards.AESI2_Parallel_observed)
{
this.TrimParallel_Sychronized(toggleIsUp);
return;
}
if (DigitalSingleL3FSM.m_MachineConfig.SensorMeasureSystem == MachineConfig.SensorMeasureCards.IMM_Parallel_observed)
{
this.Trim_IMM_Parallel_Sychronized(toggleIsUp);
return;
}
if (DigitalSingleL3FSM.m_MachineConfig.SensorMeasureSystem == MachineConfig.SensorMeasureCards.IMM_Sequencial)
{
this.TrimSequencial(toggleIsUp);
}
}
选取其中一个方法,其中调用registerInterpolationtPoint.RegisterInterpolationPoint(ref sensor, false);方法
err = m_Sensor.ASICs[asicCount].RegisterInterpolationPoint(data, ref asicMeas, out bool repeateIPP)
private void TrimParallel(bool toggleIsUp)
{
DateTime start = DateTime.Now;
Action<string> subStepChanged = this.fsmParent.SubStepChanged;
if (subStepChanged != null)
{
subStepChanged("Init SignalPath");
}
else
{
}
Parallel.ForEach<GenerallySensorElement>(DigitalSingleL3FSM.m_SensorList, (GenerallySensorElement sensorInList) => {
int i;
if (!sensorInList.isDummy && !sensorInList.isNiO && !sensorInList.isRundläufer && !sensorInList.isBurned)
{
sensorInList.StepName = "Init SignalPath";
DigitalSingleL3FSM.DigitalSingleSensor sensor = (DigitalSingleL3FSM.DigitalSingleSensor)sensorInList;
try
{
ITip500_AsicIo[] aSICs = sensor.ASICs;
for (i = 0; i < (int)aSICs.Length; i++)
{
ITip500_AsicIo asic = aSICs[i];
if (!asic.isInitialized)
{
asic.InitAsic();
}
}
}
catch (Exception exception)
{
Exception ex = exception;
sensor.isRundläufer = true;
sensor.ProgressColor = 2;
sensor.ErrorMessage = Texte.InitSignalPathFail;
string[] str = new string[] { Texte.Sensor, " ", null, null, null };
i = sensor.NestNumber;
str[2] = i.ToString();
str[3] = " :";
str[4] = Texte.InitSignalPathFail;
Logger.WriteToLog(string.Concat(str), LoggerLevel.Warning);
Logger.WriteToLog(ex, LoggerLevel.Warning);
}
}
});
string initSignalPathAfter = Texte.InitSignalPathAfter;
double totalSeconds = (DateTime.Now - start).TotalSeconds;
Logger.WriteToLog(string.Concat(initSignalPathAfter, totalSeconds.ToString(), "s"), LoggerLevel.Info);
start = DateTime.Now;
Thread.Sleep(10);
Action<string> action = this.fsmParent.SubStepChanged;
if (action != null)
{
action("PrefetchInterpolationPoint");
}
else
{
}
DigitalSingleL3FSM.RegisterInterpolationtPoint registerInterpolationtPoint = new DigitalSingleL3FSM.RegisterInterpolationtPoint(this.fsmParent.avgTemp, toggleIsUp, DigitalSingleL3FSM.currentTemperatureNumber, DigitalSingleL3FSM.currentPressureIndex)
{
PressureSensors = this.fsmParent.RefSensors
};
DigitalSingleL3FSM.RegisterInterpolationtPoint registerInterpolationtPoint1 = registerInterpolationtPoint;
int num = DigitalSingleL3FSM.currentPressureIndex;
int? index = this.ConvertNumberToIndex(DigitalSingleL3FSM.m_trimSpec.Temperatures, DigitalSingleL3FSM.currentTemperatureNumber);
registerInterpolationtPoint1.startMeasThread(num, index.Value);
Parallel.ForEach<GenerallySensorElement>(DigitalSingleL3FSM.m_SensorList, (GenerallySensorElement sensorInList) => {
if (!sensorInList.isDummy && !sensorInList.isNiO && !sensorInList.isRundläufer && !sensorInList.isBurned)
{
sensorInList.StepName = "Prefetch IPP";
DigitalSingleL3FSM.DigitalSingleSensor sensor = (DigitalSingleL3FSM.DigitalSingleSensor)sensorInList;
try
{
registerInterpolationtPoint.PrefetchInterpolationPoint(ref sensor);
}
catch (Exception exception)
{
Exception ex = exception;
sensor.isRundläufer = true;
sensor.ProgressColor = 2;
sensor.ErrorMessage = Texte.PrefetchIppFail;
string[] str = new string[] { Texte.Sensor, " ", null, null, null };
str[2] = sensor.NestNumber.ToString();
str[3] = " :";
str[4] = Texte.PrefetchIppFail;
Logger.WriteToLog(string.Concat(str), LoggerLevel.Warning);
Logger.WriteToLog(ex, LoggerLevel.Warning);
}
}
});
registerInterpolationtPoint.StopMeasThread(false);
DateTime startTime = DateTime.Now;
while (registerInterpolationtPoint.measThreadAlive)
{
if ((DateTime.Now - startTime) <= TimeSpan.FromSeconds(5))
{
continue;
}
registerInterpolationtPoint.StopMeasThread(true);
Logger.WriteToLog(Texte.MeasThreadNotStopped, LoggerLevel.Error);
throw new TimeoutException(Texte.MeasThreadNotStopped);
}
Action<string> subStepChanged1 = this.fsmParent.SubStepChanged;
if (subStepChanged1 != null)
{
subStepChanged1("RegisterInterpolationPoint");
}
else
{
}
Parallel.ForEach<GenerallySensorElement>(DigitalSingleL3FSM.m_SensorList, (GenerallySensorElement sensorInList) => {
if (!sensorInList.isDummy && !sensorInList.isNiO && !sensorInList.isRundläufer && !sensorInList.isBurned)
{
sensorInList.StepName = "Register IPP";
DigitalSingleL3FSM.DigitalSingleSensor sensor = (DigitalSingleL3FSM.DigitalSingleSensor)sensorInList;
try
{
if (DigitalSingleL3FSM.m_MachineConfig.AdjustmentZone != MachineConfig.Zone.startZone)
{
registerInterpolationtPoint.RegisterInterpolationPoint(ref sensor, false);
}
else
{
registerInterpolationtPoint.RegisterInterpolationPoint(ref sensor, true);
}
}
catch (Exception exception)
{
Exception ex = exception;
sensor.ErrorMessage = Texte.RegisterIppFail;
sensor.isRundläufer = true;
sensor.isNiO = false;
sensor.ProgressColor = 2;
string[] str = new string[] { Texte.Sensor, " ", null, null, null };
str[2] = sensor.NestNumber.ToString();
str[3] = " :";
str[4] = Texte.RegisterIppFail;
Logger.WriteToLog(string.Concat(str), LoggerLevel.Warning);
Logger.WriteToLog(ex, LoggerLevel.Warning);
}
}
});
}
TIP500BASE内RegisterInterpolationPoint(BenchMeasData measData, ref AsicMeasData asicMeasData, out bool repeateIPP)
public long RegisterInterpolationPoint(BenchMeasData measData, ref AsicMeasData asicMeasData, out bool repeateIPP)
{
ulong fixValue;
long num;
double average;
DateTime timeStamp;
Polynom benchPresPoly;
Polynom benchTempPoly;
try
{
try
{
this.DebugLog("RegisterInterpolationPoint started");
this.NewDbLog(false);
repeateIPP = false;
this.fileLoggerStream = new MemoryStream();
this.fileLoggerSW = new StreamWriter(this.fileLoggerStream);
PTSensorBenchMeasData pTSensorBenchMeasDatum = (PTSensorBenchMeasData)measData;
if (pTSensorBenchMeasDatum.Pressures == null || pTSensorBenchMeasDatum.Pressures.Count == 0)
{
throw new ArgumentException("BenchMeasData pressures must not be null or empty");
}
if (pTSensorBenchMeasDatum.Temperatures == null || pTSensorBenchMeasDatum.Temperatures.Count == 0)
{
throw new ArgumentException("BenchMeasData temperatures must not be null or empty");
}
if (this.m_IppDataCollection == null)
{
this.PrefetchInterpolationPoint();
}
this.m_CurrentTestPoint = new TestPoint()
{
PressureIndex = pTSensorBenchMeasDatum.PressureTestCondition.Number,
TemperatureIndex = pTSensorBenchMeasDatum.TemperatureTestCondition.Number,
NominalPressure = pTSensorBenchMeasDatum.PressureTestCondition.NominalSetValue,
NominalTemperature = pTSensorBenchMeasDatum.TemperatureTestCondition.NominalSetValue
};
string tpName = string.Format("T{0}P{1}_", pTSensorBenchMeasDatum.TemperatureTestCondition.Number, pTSensorBenchMeasDatum.PressureTestCondition.Number);
List<DDLDataLogItem> mDBLogData = this.m_DBLogData;
string str = string.Concat(tpName, "NominalPressure");
double nominalPressure = this.m_CurrentTestPoint.NominalPressure;
PhysicalUnits unit = pTSensorBenchMeasDatum.Pressures[0].Unit;
mDBLogData.Add(new DDLDataLogItem(str, nominalPressure, unit.ToString()));
List<DDLDataLogItem> dDLDataLogItems = this.m_DBLogData;
string str1 = string.Concat(tpName, "NominalTemperature");
double nominalTemperature = this.m_CurrentTestPoint.NominalTemperature;
unit = pTSensorBenchMeasDatum.Temperatures[0].Unit;
dDLDataLogItems.Add(new DDLDataLogItem(str1, nominalTemperature, unit.ToString()));
if (this.EnableDebugLog)
{
this.CreateMemDump("PrefetchIppDone", this.mem);
this.DebugLog("reading of all memory blocks done");
}
DataStatistic tStatistics = new DataStatistic(
from v in pTSensorBenchMeasDatum.Temperatures
select v.Value);
DataStatistic pStatistics = new DataStatistic(
from v in pTSensorBenchMeasDatum.Pressures
select v.Value);
List<DDLDataLogItem> mDBLogData1 = this.m_DBLogData;
string str2 = string.Concat(tpName, "T");
unit = pTSensorBenchMeasDatum.Temperatures[0].Unit;
mDBLogData1.AddRange(tStatistics.ToDDLDataLogItem(str2, unit.ToString()));
List<DDLDataLogItem> dDLDataLogItems1 = this.m_DBLogData;
string str3 = string.Concat(tpName, "P");
unit = pTSensorBenchMeasDatum.Pressures[0].Unit;
dDLDataLogItems1.AddRange(pStatistics.ToDDLDataLogItem(str3, unit.ToString()));
DataStatistic ptatInStatistics = new DataStatistic(
from v in this.m_IppDataCollection.PtatIns
select v.Value);
DataStatistic pressureInStatistics = new DataStatistic(
from v in this.m_IppDataCollection.PressureIns
select v.Value);
DataStatistic baeStatistics = new DataStatistic(
from v in this.m_IppDataCollection.BaeMuxOuts
select v.Value);
double presLowLim = -0.5;
double presUpLim = 0.4;
if (this.BoschTTnr == "0261547000")
{
presUpLim = 0.6;
}
this.m_DBLogData.AddRange(ptatInStatistics.ToDDLDataLogItem(string.Concat(tpName, "PtatIn"), ""));
this.m_DBLogData.AddRange(pressureInStatistics.ToDDLDataLogItem(string.Concat(tpName, "PressureIn"), "", presLowLim, presUpLim, 0, 0.05));
this.m_DBLogData.AddRange(baeStatistics.ToDDLDataLogItem(string.Concat(tpName, "BaeMuxOut"), ""));
if (this.m_IppDataCollection.BaeMuxOuts.Any<IPPValue>((IPPValue v) => v.Value == 0) && !this.DeactivatePlausiCheck)
{
this.PCS.ReadAndMap(this.mem[RAM_Signals.adjust_alpha_bae]);
fixValue = this.mem[RAM_Signals.bondabriss_in].FixValue;
string str4 = fixValue.ToString();
fixValue = this.mem[RAM_Signals.adjust_alpha_bae].FixValue;
this.ErrReport = new ErrorReport("RegisterInterpolationPoint", "BaeMuxOut-Test", string.Concat("BaeMuxOut must no be zero. Signal bondabriss_in = ", str4, " Signal adjust_alpha_bae = ", fixValue.ToString()));
num = (long)2;
}
else if ((pressureInStatistics.Min < presLowLim || pressureInStatistics.Max > presUpLim) && !this.DeactivatePlausiCheck)
{
object[] objArray = new object[] { "one or more recorded pressure_in values is out of valid range ", presLowLim, " < pressure_in < ", presUpLim, "\r\navg=", null, null, null, null, null, null, null };
average = pressureInStatistics.Average;
objArray[5] = average.ToString("F5");
objArray[6] = " StdDev= ";
average = pressureInStatistics.StdDeviation;
objArray[7] = average.ToString("F5");
objArray[8] = " max=";
average = pressureInStatistics.Max;
objArray[9] = average.ToString("F5");
objArray[10] = " min = ";
average = pressureInStatistics.Min;
objArray[11] = average.ToString("F5");
this.ErrReport = new ErrorReport("RegisterInterpolationPoint", "pressure_in-Test", string.Concat(objArray));
num = (long)8;
}
else if (pressureInStatistics.StdDeviation > 0.05 && !this.DeactivatePlausiCheck)
{
string[] strArrays = new string[] { "standard deviation of pressure_in values is larger than 0.05\r\navg=", null, null, null, null, null, null, null };
average = pressureInStatistics.Average;
strArrays[1] = average.ToString("F5");
strArrays[2] = " StdDev= ";
average = pressureInStatistics.StdDeviation;
strArrays[3] = average.ToString("F5");
strArrays[4] = " max=";
average = pressureInStatistics.Max;
strArrays[5] = average.ToString("F5");
strArrays[6] = " min = ";
average = pressureInStatistics.Min;
strArrays[7] = average.ToString("F5");
this.ErrReport = new ErrorReport("RegisterInterpolationPoint", "pressure_in-Test", string.Concat(strArrays));
num = (long)8;
}
else if (pressureInStatistics.StdDeviation != 0 || this.DeactivatePlausiCheck)
{
double[] presIn = (
from e in this.m_IppDataCollection.PressureIns
select e.Value).ToArray<double>();
Polynom presInPoly = Polynom.Polyfit((
from e in this.m_IppDataCollection.PressureIns
select this.DateTimeToDouble(e.TimeStamp)).ToArray<double>(), presIn, 1, Polynom.FitMethod.NormalEquations);
double[] ptatIn = (
from e in this.m_IppDataCollection.PtatIns
select e.Value).ToArray<double>();
Polynom ptatInPoly = Polynom.Polyfit((
from e in this.m_IppDataCollection.PtatIns
select this.DateTimeToDouble(e.TimeStamp)).ToArray<double>(), ptatIn, 0);
List<double> baeMuxOut = (
from e in this.m_IppDataCollection.BaeMuxOuts
select e.Value).ToList<double>();
(
from e in this.m_IppDataCollection.BaeMuxOuts
select this.DateTimeToDouble(e.TimeStamp)).ToArray<double>();
if (baeMuxOut.Count > 5)
{
this.m_IppDataCollection.BaeMuxOuts.Max<IPPValue>((IPPValue t) => t.Value);
this.m_IppDataCollection.BaeMuxOuts.Min<IPPValue>((IPPValue t) => t.Value);
}
Polynom baeMoutOutPoly = new Polynom(new double[] { baeMuxOut.Average() });
double tCalc = 0;
long tCalcLong = (long)0;
if (pTSensorBenchMeasDatum.Pressures.Count >= 2)
{
DateTime btMin = (
from t in pTSensorBenchMeasDatum.Pressures
select t.TimeStamp).ToArray<DateTime>().Min<DateTime>();
DateTime btMax = (
from t in pTSensorBenchMeasDatum.Pressures
select t.TimeStamp).ToArray<DateTime>().Max<DateTime>();
DateTime dateTime = (
from t in this.m_IppDataCollection.PressureIns
select t.TimeStamp).ToArray<DateTime>().Min<DateTime>();
DateTime dateTime1 = (
from t in this.m_IppDataCollection.PressureIns
select t.TimeStamp).ToArray<DateTime>().Max<DateTime>();
if (btMax < dateTime || dateTime1 < btMin)
{
throw new ArgumentException("bench meas data are not covering the time frame gathered by PrefetchInterpolationPoint()");
}
List<MeasData> relevantPressures = pTSensorBenchMeasDatum.Pressures.Where<MeasData>((MeasData p) => {
if (p.TimeStamp < dateTime)
{
return false;
}
return p.TimeStamp <= dateTime1;
}).ToList<MeasData>();
double[] benchTimeStamps = (
from t in relevantPressures
select this.DateTimeToDouble(t.TimeStamp)).ToArray<double>();
double[] benchPres = new double[relevantPressures.Count];
for (int i = 0; i < (int)benchPres.Length; i++)
{
benchPres[i] = PhysicalUnitsConverter.Convert(relevantPressures[i].Value, relevantPressures[i].Unit, PhysicalUnits.kPa);
}
benchPresPoly = ((int)benchPres.Length <= 50 ? Polynom.Polyfit(benchTimeStamps, benchPres, 1, Polynom.FitMethod.QR_Householder) : Polynom.Polyfit(benchTimeStamps, benchPres, 1, Polynom.FitMethod.NormalEquations));
benchTimeStamps = (
from t in pTSensorBenchMeasDatum.Temperatures
select this.DateTimeToDouble(t.TimeStamp)).ToArray<double>();
double[] benchTemp = new double[pTSensorBenchMeasDatum.Temperatures.Count];
for (int i = 0; i < (int)benchTemp.Length; i++)
{
benchTemp[i] = PhysicalUnitsConverter.Convert(pTSensorBenchMeasDatum.Temperatures[i].Value, pTSensorBenchMeasDatum.Temperatures[i].Unit, PhysicalUnits.Celsius);
}
benchTempPoly = ((int)benchTemp.Length <= 50 ? Polynom.Polyfit(benchTimeStamps, benchTemp, 1, Polynom.FitMethod.QR_Householder) : Polynom.Polyfit(benchTimeStamps, benchTemp, 1, Polynom.FitMethod.NormalEquations));
tCalcLong = (Math.Max(btMin.Ticks, dateTime.Ticks) + Math.Min(btMax.Ticks, dateTime1.Ticks)) / (long)2;
tCalc = this.DateTimeToDouble(new DateTime(tCalcLong));
this.m_CurrentTestPoint.P = benchPresPoly.PolyVal(tCalc);
this.m_CurrentTestPoint.T = benchTempPoly.PolyVal(tCalc);
this.m_CurrentTestPoint.PressureIn = presInPoly.PolyVal(tCalc);
this.m_CurrentTestPoint.PtatIn = ptatInPoly.PolyVal(tCalc);
this.m_CurrentTestPoint.BaeMuxOut = baeMoutOutPoly.PolyVal(tCalc);
this.m_CurrentTestPoint.TimeStamp = new DateTime(tCalcLong);
}
else
{
tCalc = this.DateTimeToDouble(pTSensorBenchMeasDatum.Pressures[0].TimeStamp);
this.m_CurrentTestPoint.PressureIn = presInPoly.PolyVal(tCalc);
this.m_CurrentTestPoint.BaeMuxOut = baeMoutOutPoly.PolyVal(tCalc);
TestPoint mCurrentTestPoint = this.m_CurrentTestPoint;
timeStamp = pTSensorBenchMeasDatum.Temperatures[0].TimeStamp;
mCurrentTestPoint.PtatIn = ptatInPoly.PolyVal((double)timeStamp.Ticks);
this.m_CurrentTestPoint.P = PhysicalUnitsConverter.Convert(pTSensorBenchMeasDatum.Pressures[0].Value, pTSensorBenchMeasDatum.Pressures[0].Unit, PhysicalUnits.kPa);
this.m_CurrentTestPoint.T = PhysicalUnitsConverter.Convert(pTSensorBenchMeasDatum.Temperatures[0].Value, pTSensorBenchMeasDatum.Temperatures[0].Unit, PhysicalUnits.Celsius);
this.m_CurrentTestPoint.TimeStamp = pTSensorBenchMeasDatum.Pressures[0].TimeStamp;
}
unit = PhysicalUnits.Celsius;
this.m_DBLogData.Add(new DDLDataLogItem(string.Concat(tpName, "T_CurrentTestPoint"), this.m_CurrentTestPoint.T, unit.ToString()));
unit = PhysicalUnits.kPa;
this.m_DBLogData.Add(new DDLDataLogItem(string.Concat(tpName, "P_CurrentTestPoint"), this.m_CurrentTestPoint.P, unit.ToString()));
this.m_DBLogData.Add(new DDLDataLogItem(string.Concat(tpName, "PtatIn_CurrentTestPoint"), this.m_CurrentTestPoint.PtatIn, ""));
this.m_DBLogData.Add(new DDLDataLogItem(string.Concat(tpName, "PressureIn_CurrentTestPoint"), this.m_CurrentTestPoint.PressureIn, ""));
this.m_DBLogData.Add(new DDLDataLogItem(string.Concat(tpName, "BaeMuxOut_CurrentTestPoint"), this.m_CurrentTestPoint.BaeMuxOut, ""));
Dictionary<string, Polynom> polys = new Dictionary<string, Polynom>()
{
{ "pressure_in", presInPoly },
{ "ptat_in", ptatInPoly },
{ "bae_mux_out", baeMoutOutPoly }
};
Tip500ChartData chartData = new Tip500ChartData(pTSensorBenchMeasDatum, this.m_IppDataCollection, polys)
{
TargetTime = new DateTime(tCalcLong)
};
if (this.ChartDataList == null)
{
this.ChartDataList = new Tip500ChartDataList();
}
this.ChartDataList.Add(chartData);
Tip500AsicMeasData myAsicMeasData = new Tip500AsicMeasData();
Tip500DspPath tip500DspPath = new Tip500DspPath(this.m_pavAsicConfig.MathConfig)
{
AdjParameter = this.m_AdjustValues
};
DspInValues inValues = new DspInValues()
{
PressureIn = this.m_CurrentTestPoint.PressureIn,
PtatIn = this.m_CurrentTestPoint.PtatIn
};
DspOutValues outValues = tip500DspPath.DspCalculation(inValues);
this.mem[RAM_Signals.ptat_Tlin_mux].Value = outValues.TOut;
myAsicMeasData.Temperature.Value = (double)((float)this.mem[RAM_Signals.ptat_Tlin_mux].FixValue) * 0.125 - 73.15;
myAsicMeasData.Temperature.LowLimit = new double?(myAsicMeasData.Temperature.Value - 10);
myAsicMeasData.Temperature.UpLimit = new double?(myAsicMeasData.Temperature.Value + 10);
myAsicMeasData.Temperature.Unit = PhysicalUnits.Celsius;
myAsicMeasData.TemperatureNtc = null;
this.mem[RAM_Signals.p_val_mux].Value = outValues.POut;
myAsicMeasData.Pressure.Value = (double)((float)this.mem[RAM_Signals.p_val_mux].FixValue) * (this.m_Spec.General.PressureRange.MaxSetValue - this.m_Spec.General.PressureRange.MinSetValue) / 3703;
myAsicMeasData.Pressure.Unit = this.m_Spec.General.PressureUnit;
myAsicMeasData.Pressure.ReferenceValue = new double?(this.m_CurrentTestPoint.P);
myAsicMeasData.Temperature.ReferenceValue = new double?(this.m_CurrentTestPoint.T);
myAsicMeasData.BaeMuxOut = new double?(this.m_CurrentTestPoint.BaeMuxOut);
myAsicMeasData.Pressure_in = new double?(this.m_CurrentTestPoint.PressureIn);
myAsicMeasData.Ptat_in = new double?(this.m_CurrentTestPoint.PtatIn);
if (!this.m_pavAsicConfig.isAnalogOutput || this.m_CurrentTestPoint.Clin0Presets == null || this.m_CurrentTestPoint.Clin0Presets.Length == 0)
{
myAsicMeasData.DacDatas = null;
}
else
{
myAsicMeasData.DacDatas = new List<Tip500DacRawData>();
for (int i = 0; i < (int)this.m_CurrentTestPoint.Clin0Presets.Length; i++)
{
Tip500DacRawData rawData = new Tip500DacRawData()
{
Clin0 = this.m_CurrentTestPoint.Clin0Presets[i],
Vout = this.m_CurrentTestPoint.VoutRaw[i, 1],
Vsupply = this.m_CurrentTestPoint.VoutRaw[i, 0],
Ratio = this.m_CurrentTestPoint.VoutRaw[i, 1] / this.m_CurrentTestPoint.VoutRaw[i, 0]
};
myAsicMeasData.DacDatas.Add(rawData);
}
}
asicMeasData = myAsicMeasData;
this.m_CurrentTestPoint.BistDacValues = this.CharcterizeBistDac();
for (int i = 0; i < this.m_CurrentTestPoint.BistDacValues.Count; i++)
{
this.m_DBLogData.AddRange(this.m_CurrentTestPoint.BistDacValues[i].ToDDLDataLogItem(tpName, i));
}
if (!this.m_pavAsicConfig.isAnalogOutput)
{
this.m_CurrentTestPoint.Vout = null;
this.m_CurrentTestPoint.Clin0Presets = null;
}
else
{
this.InitMath();
this.math.GenerateAnalogPreset();
double[] clins = this.math.PressureAnalogPreset.CLin0PresetArray;
this.m_CurrentTestPoint.Clin0Presets = clins;
if (pTSensorBenchMeasDatum.PressureTestCondition.NominalSetValue == this.m_Spec.Tip500TrimSpec.Pressures.Min<TestCondition>((TestCondition p) => p.NominalSetValue))
{
this.m_CurrentTestPoint.VoutRaw = this.CharacterizeDAC(clins);
this.m_CurrentTestPoint.Vout = new double[(int)clins.Length];
double[] dacVoutRaw = new double[this.m_CurrentTestPoint.VoutRaw.GetLength(0)];
double[] dacUb = new double[this.m_CurrentTestPoint.VoutRaw.GetLength(0)];
for (int i = 0; i < this.m_CurrentTestPoint.VoutRaw.GetLength(0); i++)
{
this.m_CurrentTestPoint.Vout[i] = this.m_CurrentTestPoint.VoutRaw[i, 1] / this.m_CurrentTestPoint.VoutRaw[i, 0];
dacVoutRaw[i] = this.m_CurrentTestPoint.VoutRaw[i, 1];
dacUb[i] = this.m_CurrentTestPoint.VoutRaw[i, 0];
}
DataStatistic dacUbStatistics = new DataStatistic(dacUb);
DataStatistic dataStatistic = new DataStatistic(this.m_CurrentTestPoint.Vout);
double dacUbLowLim = 4.9;
double dacUbUpLim = 5.1;
unit = PhysicalUnits.V;
this.m_DBLogData.AddRange(dacUbStatistics.ToDDLDataLogItem(string.Concat(tpName, "DacUb"), unit.ToString(), dacUbLowLim, dacUbUpLim, double.NaN, double.NaN));
double dacVoutLowLim = 0.05;
double dacVoutUpLim = 0.95;
DDLDataLogItemExtended voutItem = new DDLDataLogItemExtended()
{
Unit = "",
UpLim = dacVoutUpLim,
LowLim = dacVoutLowLim,
DDLCheckType = DDLCheckType.ValueGreaterLowLimAndSmallerUpLim
};
for (int i = 0; i < (int)this.m_CurrentTestPoint.Vout.Length; i++)
{
DDLDataLogItemExtended item = voutItem.DeepPropertiesCopy<DDLDataLogItemExtended>();
item.Name = string.Concat(tpName, "DacVout_", i + 1);
item.Value = this.m_CurrentTestPoint.Vout[i];
this.m_DBLogData.Add(item);
}
if (this.m_CurrentTestPoint.Vout.Min() < dacVoutLowLim)
{
this.ErrReport = new ErrorReport("RegisterInterpolationPoint", "DAC Characterisation", string.Concat(new object[] { "ratiometric value (", this.m_CurrentTestPoint.Vout.Min(), ") out of valid range (", dacVoutLowLim, " - ", dacVoutUpLim, ")" }));
num = (long)1024;
return num;
}
else if (this.m_CurrentTestPoint.Vout.Max() > dacVoutUpLim)
{
this.ErrReport = new ErrorReport("RegisterInterpolationPoint", "DAC Characterisation", string.Concat(new object[] { "ratiometric value (", this.m_CurrentTestPoint.Vout.Max(), ") out of valid range (", dacVoutLowLim, " - ", dacVoutUpLim, ")" }));
num = (long)1024;
return num;
}
else if (dacUbStatistics.Min < dacUbLowLim)
{
this.ErrReport = new ErrorReport("RegisterInterpolationPoint", "DAC Characterisation", string.Concat(new object[] { "supply voltage (", dacUbStatistics.Min, " V) lower than ", dacUbLowLim, " V" }));
num = (long)1024;
return num;
}
else if (dacUbStatistics.Max > dacUbUpLim)
{
this.ErrReport = new ErrorReport("RegisterInterpolationPoint", "DAC Characterisation", string.Concat(new object[] { "supply voltage (", dacUbStatistics.Max, " V) upper than ", dacUbUpLim, " V" }));
num = (long)1024;
return num;
}
}
if (this.m_CurrentTestPoint.Vout == null && this.m_TestPoints != null && this.m_TestPoints.Any<TestPoint>((TestPoint t) => {
if (t.PressureIndex != 1)
{
return false;
}
return t.TemperatureIndex == pTSensorBenchMeasDatum.TemperatureTestCondition.Number;
}))
{
this.m_CurrentTestPoint.Vout = this.m_TestPoints.Where<TestPoint>((TestPoint t) => {
if (t.PressureIndex != 1)
{
return false;
}
return t.TemperatureIndex == pTSensorBenchMeasDatum.TemperatureTestCondition.Number;
}).FirstOrDefault<TestPoint>().Vout;
this.m_CurrentTestPoint.VoutRaw = this.m_TestPoints.Where<TestPoint>((TestPoint t) => {
if (t.PressureIndex != 1)
{
return false;
}
return t.TemperatureIndex == pTSensorBenchMeasDatum.TemperatureTestCondition.Number;
}).FirstOrDefault<TestPoint>().VoutRaw;
this.m_CurrentTestPoint.Clin0Presets = this.m_TestPoints.Where<TestPoint>((TestPoint t) => {
if (t.PressureIndex != 1)
{
return false;
}
return t.TemperatureIndex == pTSensorBenchMeasDatum.TemperatureTestCondition.Number;
}).FirstOrDefault<TestPoint>().Clin0Presets;
}
if (this.m_CurrentTestPoint.Vout != null && this.m_TestPoints != null)
{
foreach (TestPoint list in (
from t in this.m_TestPoints
where t.TemperatureIndex == pTSensorBenchMeasDatum.TemperatureTestCondition.Number
where t.Vout == null
select t).ToList<TestPoint>())
{
list.Vout = this.m_CurrentTestPoint.Vout;
list.VoutRaw = this.m_CurrentTestPoint.VoutRaw;
list.Clin0Presets = this.m_CurrentTestPoint.Clin0Presets;
}
}
}
if (this.m_TestPoints == null)
{
CultureInfo cult = CultureInfo.InvariantCulture;
if (!this.mem.Memories["OTP"].Signals.Exists("PTAT_RT_VALUE") || !this.mem.Memories["OTP"].Signals.Exists("PTAT_HT_VALUE"))
{
StreamWriter streamWriter = this.fileLoggerSW;
fixValue = this.GetAsicId();
streamWriter.WriteLine(string.Concat("#IPP; AsicId=", fixValue.ToString()));
}
else
{
StreamWriter streamWriter1 = this.fileLoggerSW;
string[] strArrays1 = new string[] { "#IPP; AsicId=", null, null, null, null, null };
fixValue = this.GetAsicId();
strArrays1[1] = fixValue.ToString();
strArrays1[2] = "; TI_Ptat_RT=";
average = this.mem[OTP_Signals.PTAT_RT_VALUE].ScaledValue;
strArrays1[3] = average.ToString(cult);
strArrays1[4] = "; TI_Ptat_HT=";
average = this.mem[OTP_Signals.PTAT_HT_VALUE].ScaledValue;
strArrays1[5] = average.ToString(cult);
streamWriter1.WriteLine(string.Concat(strArrays1));
}
this.fileLoggerSW.Write("Zeit; P_Number;P_Nominal; Druck; T_Number; T_Nominal; Temperatur; Pressure_in; ptat_in; BaeMuxOut; ");
if (this.m_pavAsicConfig.isAnalogOutput)
{
this.fileLoggerSW.Write(" Clin0s; ");
int presetLength = (int)this.m_CurrentTestPoint.Clin0Presets.Length;
for (int i = 0; i < presetLength; i++)
{
this.fileLoggerSW.Write(string.Concat(this.m_CurrentTestPoint.Clin0Presets[i].ToString(cult), "; ; "));
}
}
if (this.m_CurrentTestPoint.BistDacValues != null && this.m_CurrentTestPoint.BistDacValues.Count != 0)
{
this.fileLoggerSW.Write("BistPDac;");
int bistDacLength = this.m_CurrentTestPoint.BistDacValues.Count;
for (int i = 0; i < bistDacLength; i++)
{
StreamWriter streamWriter2 = this.fileLoggerSW;
average = this.m_CurrentTestPoint.BistDacValues[i].BistInPStim;
streamWriter2.Write(string.Concat(average.ToString(cult), "; "));
}
this.fileLoggerSW.Write("BistTDac;");
for (int i = 0; i < bistDacLength; i++)
{
StreamWriter streamWriter3 = this.fileLoggerSW;
average = this.m_CurrentTestPoint.BistDacValues[i].BistInTStim;
streamWriter3.Write(string.Concat(average.ToString(cult), "; "));
}
}
this.fileLoggerSW.WriteLine("");
this.m_TestPoints = new List<TestPoint>();
}
this.m_TestPoints.Add(this.m_CurrentTestPoint);
if (this.EnableDebugLog)
{
this.DebugLog("RegisterInterpolationPoint: IPP recorded successfully");
}
if (this.LogFile != null)
{
CultureInfo cult = CultureInfo.InvariantCulture;
StreamWriter streamWriter4 = this.fileLoggerSW;
string[] strArrays2 = new string[20];
timeStamp = this.m_CurrentTestPoint.TimeStamp;
strArrays2[0] = timeStamp.ToString(cult);
strArrays2[1] = ";";
int pressureIndex = this.m_CurrentTestPoint.PressureIndex;
strArrays2[2] = pressureIndex.ToString(cult);
strArrays2[3] = ";";
average = this.m_CurrentTestPoint.NominalPressure;
strArrays2[4] = average.ToString(cult);
strArrays2[5] = "; ";
average = this.m_CurrentTestPoint.P;
strArrays2[6] = average.ToString(cult);
strArrays2[7] = ";";
pressureIndex = this.m_CurrentTestPoint.TemperatureIndex;
strArrays2[8] = pressureIndex.ToString(cult);
strArrays2[9] = "; ";
average = this.m_CurrentTestPoint.NominalTemperature;
strArrays2[10] = average.ToString(cult);
strArrays2[11] = "; ";
average = this.m_CurrentTestPoint.T;
strArrays2[12] = average.ToString(cult);
strArrays2[13] = ";";
average = this.m_CurrentTestPoint.PressureIn;
strArrays2[14] = average.ToString(cult);
strArrays2[15] = ";";
average = this.m_CurrentTestPoint.PtatIn;
strArrays2[16] = average.ToString(cult);
strArrays2[17] = ";";
average = this.m_CurrentTestPoint.BaeMuxOut;
strArrays2[18] = average.ToString(cult);
strArrays2[19] = ";";
streamWriter4.Write(string.Concat(strArrays2));
if (this.m_pavAsicConfig.isAnalogOutput && this.m_CurrentTestPoint.Vout != null)
{
this.fileLoggerSW.Write("Ua/Ub; ");
for (int i = 0; i < (int)this.m_CurrentTestPoint.Vout.Length; i++)
{
this.fileLoggerSW.Write(string.Concat(this.m_CurrentTestPoint.VoutRaw[i, 1].ToString(cult), ";", this.m_CurrentTestPoint.VoutRaw[i, 0].ToString(cult), "; "));
}
}
if (this.m_CurrentTestPoint.BistDacValues != null && this.m_CurrentTestPoint.BistDacValues.Count != 0)
{
int bistDacLength = this.m_CurrentTestPoint.BistDacValues.Count;
this.fileLoggerSW.Write("Bist_PressureIn; ");
for (int i = 0; i < bistDacLength; i++)
{
StreamWriter streamWriter5 = this.fileLoggerSW;
average = this.m_CurrentTestPoint.BistDacValues[i].PressureIn;
streamWriter5.Write(string.Concat(average.ToString(cult), "; "));
}
this.fileLoggerSW.Write("Bist_PtatIn; ");
for (int i = 0; i < bistDacLength; i++)
{
StreamWriter streamWriter6 = this.fileLoggerSW;
average = this.m_CurrentTestPoint.BistDacValues[i].PtatIn;
streamWriter6.Write(string.Concat(average.ToString(cult), "; "));
}
}
this.fileLoggerSW.WriteLine("");
this.fileLoggerSW.Flush();
this.LogFile(this, "IPP", this.fileLoggerStream);
}
return (long)0;
}
else
{
string[] strArrays3 = new string[] { "standard deviation of pressure_in values is 0.0, signal path or data communication seems to hang\r\navg=", null, null, null, null, null, null, null };
average = pressureInStatistics.Average;
strArrays3[1] = average.ToString("F5");
strArrays3[2] = " StdDev= ";
average = pressureInStatistics.StdDeviation;
strArrays3[3] = average.ToString("F5");
strArrays3[4] = " max=";
average = pressureInStatistics.Max;
strArrays3[5] = average.ToString("F5");
strArrays3[6] = " min = ";
average = pressureInStatistics.Min;
strArrays3[7] = average.ToString("F5");
this.ErrReport = new ErrorReport("RegisterInterpolationPoint", "pressure_in-Test", string.Concat(strArrays3));
num = (long)3;
}
}
catch (Exception exception)
{
Exception ex = exception;
if (this.EnableDebugLog)
{
this.DebugLog(string.Concat("RegisterInterpolationPoint Exception: ", ex.Message, "\r\n", ex.StackTrace));
}
throw;
}
}
finally
{
if (this.EnableDebugLog)
{
this.DebugLog("RegisterInterpolationPoint finally block excecuted");
}
this.m_IppDataCollection = null;
this.m_CurrentTestPoint = null;
}
return num;
}
public void RegisterInterpolationPoint(ref DigitalSingleL3FSM.DigitalSingleSensor sensor, bool start = false)
{
bool repeateIPP;
if (sensor.isBurned || sensor.isDummy || sensor.isNiO || sensor.isRundläufer)
{
throw new OperationCanceledException("Sensor ist Dummy,NiO oder schon gebrannt");
}
DigitalSingleL3FSM.DigitalSingleSensor m_Sensor = sensor;
double railoffset = (m_Sensor.NestNumber > 8 ? 0.5 : 0);
int asicCount = 0;
try
{
while (asicCount < (int)m_Sensor.ASICs.Length)
{
AsicMeasData asicMeas = new AsicMeasData();
long err = (long)0;
if (!start)
{
err = m_Sensor.ASICs[asicCount].RegisterInterpolationPoint(DigitalSingleL3FSM.RegisterInterpolationtPoint.actuallBenchMeasData, ref asicMeas, out repeateIPP);
}
else
{
PTSensorBenchMeasData data = new PTSensorBenchMeasData()
{
PressureTestCondition = DigitalSingleL3FSM.RegisterInterpolationtPoint.actuallBenchMeasData.PressureTestCondition,
TemperatureTestCondition = DigitalSingleL3FSM.RegisterInterpolationtPoint.actuallBenchMeasData.TemperatureTestCondition,
Pressures = DigitalSingleL3FSM.RegisterInterpolationtPoint.actuallBenchMeasData.Pressures,
SupplyCurrent = DigitalSingleL3FSM.RegisterInterpolationtPoint.actuallBenchMeasData.SupplyCurrent,
SupplyVoltage = DigitalSingleL3FSM.RegisterInterpolationtPoint.actuallBenchMeasData.SupplyVoltage,
Temperatures = DigitalSingleL3FSM.RegisterInterpolationtPoint.actuallBenchMeasData.Temperatures.DeepCopy<MeasDataList>()
};
for (int i = 0; i < data.Temperatures.Count; i++)
{
if (data.PressureTestCondition.NominalSetValue != 0)
{
data.Temperatures[i].Value = data.Temperatures[i].Value - railoffset;
}
else
{
data.Temperatures[i].Value = data.Temperatures[i].Value - railoffset - 0.2;
}
}
err = m_Sensor.ASICs[asicCount].RegisterInterpolationPoint(data, ref asicMeas, out repeateIPP);
}
m_Sensor.AsicMeasData = asicMeas;
if (m_Sensor.AsicMeasData != null && err == 0)
{
Tip500AsicMeasData myAsicMeasData = (Tip500AsicMeasData)m_Sensor.AsicMeasData;
object[] nestNumber = new object[] { "Sensor: ", m_Sensor.NestNumber, " PP_rph= ", null, null, null, null };
double value = myAsicMeasData.Pressure.Value;
nestNumber[3] = value.ToString();
nestNumber[4] = "bar ; T_roh= ";
value = myAsicMeasData.Temperature.Value;
nestNumber[5] = value.ToString();
nestNumber[6] = "°C";
Logger.WriteToLog(string.Concat(nestNumber), LoggerLevel.Info);
if (m_Sensor.AsicMeasDataList[asicCount] != null && !m_Sensor.AsicMeasDataList[asicCount].Contains(myAsicMeasData))
{
m_Sensor.AsicMeasDataList[asicCount].Add(myAsicMeasData);
}
}
if (err != 0)
{
m_Sensor.isRundläufer = true;
m_Sensor.ProgressColor = 2;
m_Sensor.ErrorCode = err;
m_Sensor.ErrorMessage = m_Sensor.ASICs[asicCount].GetErrorCode().Description;
Logger.WriteToLog(string.Concat(new object[] { "Sensor ", m_Sensor.NestNumber, ": ", m_Sensor.ErrorMessage }), LoggerLevel.Info);
throw new OperationCanceledException(Texte.Sensadjustended);
}
asicCount++;
}
}