Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Converting Double Array to Segment Array

This is not a question, but a solution to a common problem.
 
The problem:
 
You have an array of values (i.e. test frequencies) that need to be converted to an array of segments with Start, Stop, and Step for upload to an 8510 Vector Network Analyzer (or similar instrument).  This problem exists due to the 8510's limit on the maximum number of segments allowed.  If the array of frequencies is large, you will most likely not be able to upload all of the test frequencies.
 
Example of large frequency array data:
FrequenciesMHz() = {10,30,50,100,300,500,1000,2000,...,12400,...,50000,...}
 
 
The Solution:
 
Attached is the code I use to convert the frequency array to a FrequencyListSegmentCollection of FrequencyListSegment's.
 
Example conversion input/output:
FrequenciesMHz() = {10,30,50,100,300,500,1000,2000,...,12400,...,50000}
Dim Segments As FrequencyListSegmentCollection = FrequencyListSegmentCollection.FromDoubleArray(FrequenciesMHz)
For Each Seg As FrequencyListSegment In Segments
    Console.WriteLine("Start={0}; Stop={1}; Step={2}", Seg.StartFrequencyMHz, Seg.StopFrequencyMHz, Seg.StepFrequencyMHz)
Next
 
Output...
Start=10; Stop=50; Step=20
Start=50; Stop=100; Step=50
Start=100; Stop=500; Step=200
Start=500; Stop=1000; Step=500
Start=1000; Stop=12000; Step=1000
Start=12000; Stop=12400; Step=400
Start=12400; Stop=13000; Step=600
Start=13000; Stop=50000; Step=1000
 
As you can see from the example output, there is still some work to be done on removing the overlapping Start/Stop frequencies between each segment.  However, it should be obvious that the input array has been reduced to a usable segment collection for upload to instruments with limited number of segment memory.  Further, the 8510 has a 'Delete Duplicates' feature that does what it implies; it removes the overlapping Start/Stop frequencies instead of counting them as two separate points.
 
Hope this helps,
Scott Page
 
0 Kudos
Message 1 of 1
(3,194 Views)