Beispiel #1
0
        /// <summary>
        /// Generates a new set for the CDM voltage, interpolated from the JS-002 specification.
        /// </summary>
        /// <param name="cdmVoltage">The voltage of the CDM pulse waveform (polarity is ignored, absolute value will be used)</param>
        /// <param name="isLargeTarget">A value indicating whether the CDM target is large or not (if not, then it is small)</param>
        /// <param name="oscilloscopeIsHighBandwidth">A value indicating whether the oscilloscope is high bandwidth (6GHz+) or not</param>
        /// <returns>A new set for the CDM voltage, interpolated from the JS-002 specification</returns>
        private static CDMJS002WaveformCharacteristicsSet GenerateSetForCDMVoltageAndCharacteristics(double cdmVoltage, bool isLargeTarget, bool oscilloscopeIsHighBandwidth)
        {
            double absCDMVoltage = System.Math.Abs(cdmVoltage);

            List <CDMJS002WaveformCharacteristicsSet> possibleSets =
                (from set in CDMJS002WaveformCharacteristics.characteristicSets
                 where set.IsLargeTarget == isLargeTarget && set.IsHighBandwidth == oscilloscopeIsHighBandwidth
                 select set).ToList();

            if (possibleSets.Any(set => set.TestCondition == absCDMVoltage))
            {
                // If the voltage is an exact match to a set, use it
                return(possibleSets.First(set => set.TestCondition == absCDMVoltage).Clone());
            }
            else
            {
                // The voltage isn't an exact match to the table, so interpolate it
                CDMJS002WaveformCharacteristicsSet below = null;
                CDMJS002WaveformCharacteristicsSet above = null;

                // Try to find the closest sets that are below and above the Test Condition voltage
                foreach (CDMJS002WaveformCharacteristicsSet set in possibleSets)
                {
                    if (set.TestCondition < absCDMVoltage)
                    {
                        if (below == null || below.TestCondition < set.TestCondition)
                        {
                            below = set;
                        }
                    }
                    else
                    {
                        if (above == null || above.TestCondition > set.TestCondition)
                        {
                            above = set;
                        }
                    }
                }

                if (below != null && above != null)
                {
                    // Interpolate between the below and above table entries
                    double percentWithinRange = DoubleRangeExtensions.PercentWithinRange(absCDMVoltage, above.TestCondition, below.TestCondition);

                    // Only the Peak Current varies between different Test Conditions.
                    // All other properties are constant for a given target size and bandwidth.
                    Tuple <double, double> interpolatedPeakCurrent = new Tuple <double, double>(
                        DoubleRangeExtensions.EquivalentValueInNewRange(percentWithinRange, 1, 0, above.PeakCurrent.Item1, below.PeakCurrent.Item1),
                        DoubleRangeExtensions.EquivalentValueInNewRange(percentWithinRange, 1, 0, above.PeakCurrent.Item2, below.PeakCurrent.Item2));

                    return(new CDMJS002WaveformCharacteristicsSet()
                    {
                        IsHighBandwidth = below.IsHighBandwidth,
                        IsLargeTarget = below.IsLargeTarget,
                        TestCondition = absCDMVoltage,
                        PeakCurrent = interpolatedPeakCurrent,
                        RiseTimeMax = below.RiseTimeMax,
                        FullWidthAtHalfMaximum = new Tuple <double, double>(below.FullWidthAtHalfMaximum.Item1, below.FullWidthAtHalfMaximum.Item2),
                        UndershootMaxPercent = below.UndershootMaxPercent,
                    });
                }
                else if (below != null)
                {
                    // The CDM voltage is higher than the highest table entry, so scale the largest one
                    double multiplier = absCDMVoltage / below.TestCondition;

                    // Only the Peak Current varies between different Test Conditions.
                    // All other properties are constant for a given target size and bandwidth.
                    Tuple <double, double> scaledPeakCurrent = new Tuple <double, double>(
                        below.PeakCurrent.Item1 * multiplier,
                        below.PeakCurrent.Item2 * multiplier);

                    return(new CDMJS002WaveformCharacteristicsSet()
                    {
                        IsHighBandwidth = below.IsHighBandwidth,
                        IsLargeTarget = below.IsLargeTarget,
                        TestCondition = absCDMVoltage,
                        PeakCurrent = scaledPeakCurrent,
                        RiseTimeMax = below.RiseTimeMax,
                        FullWidthAtHalfMaximum = new Tuple <double, double>(below.FullWidthAtHalfMaximum.Item1, below.FullWidthAtHalfMaximum.Item2),
                        UndershootMaxPercent = below.UndershootMaxPercent,
                    });
                }
                else if (above != null)
                {
                    // The CDM voltage is lower than the lowest table entry, so scale the smallest one
                    double multiplier = absCDMVoltage / above.TestCondition;

                    // Only the Peak Current varies between different Test Conditions.
                    // All other properties are constant for a given target size and bandwidth.
                    Tuple <double, double> scaledPeakCurrent = new Tuple <double, double>(
                        above.PeakCurrent.Item1 * multiplier,
                        above.PeakCurrent.Item2 * multiplier);

                    return(new CDMJS002WaveformCharacteristicsSet()
                    {
                        IsHighBandwidth = above.IsHighBandwidth,
                        IsLargeTarget = above.IsLargeTarget,
                        TestCondition = absCDMVoltage,
                        PeakCurrent = scaledPeakCurrent,
                        RiseTimeMax = above.RiseTimeMax,
                        FullWidthAtHalfMaximum = new Tuple <double, double>(above.FullWidthAtHalfMaximum.Item1, above.FullWidthAtHalfMaximum.Item2),
                        UndershootMaxPercent = above.UndershootMaxPercent,
                    });
                }
                else
                {
                    throw new InvalidOperationException("Finding table entries for the CDM voltage " + absCDMVoltage + " failed.");
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Generates a new set for the HBM voltage from the JS-001 standard
        /// </summary>
        /// <param name="hbmVoltage">The voltage of the HBM pulse waveform (polarity is ignored, absolute value will be used)</param>
        /// <returns>A new set for the HBM voltage from the JS-001 standard</returns>
        private static HBM500OhmJS001WaveformCharacteristicsSet GenerateSetForHBMVoltage(double hbmVoltage)
        {
            double absHBMVoltage = System.Math.Abs(hbmVoltage);

            if (HBM500OhmJS001WaveformCharacteristics.characteristicSets.Any(set => set.TestCondition == absHBMVoltage))
            {
                // If the voltage is an exact match to a set, use it
                return(HBM500OhmJS001WaveformCharacteristics.characteristicSets.First(set => set.TestCondition == absHBMVoltage).Clone());
            }
            else
            {
                // The voltage isn't an exact match to the table, so interpolate it
                HBM500OhmJS001WaveformCharacteristicsSet below = null;
                HBM500OhmJS001WaveformCharacteristicsSet above = null;

                // Try to find the closest sets that are below and above the Test Condition voltage
                foreach (HBM500OhmJS001WaveformCharacteristicsSet set in HBM500OhmJS001WaveformCharacteristics.characteristicSets)
                {
                    if (set.TestCondition < absHBMVoltage)
                    {
                        if (below == null || below.TestCondition < set.TestCondition)
                        {
                            below = set;
                        }
                    }
                    else
                    {
                        if (above == null || above.TestCondition > set.TestCondition)
                        {
                            above = set;
                        }
                    }
                }

                if (below != null && above != null)
                {
                    // Interpolate between the below and above table entries
                    double percentWithinRange = DoubleRangeExtensions.PercentWithinRange(absHBMVoltage, above.TestCondition, below.TestCondition);

                    // Only the Peak Current varies between different Test Conditions.
                    // All other properties are constant for a given target size and bandwidth.
                    Tuple <double, double> interpolatedPeakCurrent = new Tuple <double, double>(
                        DoubleRangeExtensions.EquivalentValueInNewRange(percentWithinRange, 1, 0, above.PeakCurrent.Item1, below.PeakCurrent.Item1),
                        DoubleRangeExtensions.EquivalentValueInNewRange(percentWithinRange, 1, 0, above.PeakCurrent.Item2, below.PeakCurrent.Item2));

                    return(new HBM500OhmJS001WaveformCharacteristicsSet()
                    {
                        TestCondition = absHBMVoltage,
                        PeakCurrent = interpolatedPeakCurrent,
                    });
                }
                else if (below != null)
                {
                    // The HBM voltage is higher than the highest table entry, so scale the largest one
                    double multiplier = absHBMVoltage / below.TestCondition;

                    // Only the Peak Current varies between different Test Conditions.
                    // All other properties are constant for a given target size and bandwidth.
                    Tuple <double, double> scaledPeakCurrent = new Tuple <double, double>(
                        below.PeakCurrent.Item1 * multiplier,
                        below.PeakCurrent.Item2 * multiplier);

                    return(new HBM500OhmJS001WaveformCharacteristicsSet()
                    {
                        TestCondition = absHBMVoltage,
                        PeakCurrent = scaledPeakCurrent,
                    });
                }
                else if (above != null)
                {
                    // The HBM voltage is lower than the lowest table entry, so scale the smallest one
                    double multiplier = absHBMVoltage / above.TestCondition;

                    // Only the Peak Current varies between different Test Conditions.
                    // All other properties are constant for a given target size and bandwidth.
                    Tuple <double, double> scaledPeakCurrent = new Tuple <double, double>(
                        above.PeakCurrent.Item1 * multiplier,
                        above.PeakCurrent.Item2 * multiplier);

                    return(new HBM500OhmJS001WaveformCharacteristicsSet()
                    {
                        TestCondition = absHBMVoltage,
                        PeakCurrent = scaledPeakCurrent,
                    });
                }
                else
                {
                    throw new InvalidOperationException("Finding table entries for the HBM voltage " + absHBMVoltage + " failed.");
                }
            }
        }