So I have completed my first LabVIEW program as you can read from the title. Sorry it took so long for me to post this. I had a lot of help from online tutorials and Bianca. I really hope not to bother her so much for the next couple of ones but I'm still learning the ropes. Programming has been pretty fun; I feel like I can see myself getting it more every time I open up the program. Hopefully I don't hit a wall. I'm gonna have to progress into more complicated programs (all before my trial versions of the software end, 19 days remaining). It's going to expand into multiple regions of interest (ROI), mathematical operations and transforms, and possibly multiple data sources. But let's not count any chickens. I got a lot of reading to do as well so I will have to find a way to balance my time wisely. My focus is going to be on THz-Time Domain Sprectroscopy (TDS), which includes Time Domain Trans/Reflection Spec (TDTS and TDRS).
Anyway, here's what my program looks like. I plan to explain the diagram and front panel in detail so now would be the time to stop reading. Just kidding.. But seriously.
I suggest to open the image in a new window beside this blog post so it's easiest to follow along.
The Front Panel
As I have mentioned before, the front panel is what the user will see when they open up the LabVIEW program. At the top left the user is asked to input a data file, which in this case is strictly a 2 column .txt file spreadsheet. Once selected the user can click Run (arrow button right below the file menu) and the data points in the spreadsheet generate a waveform on the plot. There are also two cursors, Start and End, on the plot. These cursors can be moved around freely but snap their coordinates to the data points they intersect on the waveform. The cursor legend below the file input indicates the name, color, and coordinates of the cursors. Note green, Start, cursor ahead of red, End, cursor. Once the cursors enclose a desired region of interest the user can click Run again and the data table below the plot will produce max and min information such as amplitude, time on the plot, and index.
As I have mentioned before, the front panel is what the user will see when they open up the LabVIEW program. At the top left the user is asked to input a data file, which in this case is strictly a 2 column .txt file spreadsheet. Once selected the user can click Run (arrow button right below the file menu) and the data points in the spreadsheet generate a waveform on the plot. There are also two cursors, Start and End, on the plot. These cursors can be moved around freely but snap their coordinates to the data points they intersect on the waveform. The cursor legend below the file input indicates the name, color, and coordinates of the cursors. Note green, Start, cursor ahead of red, End, cursor. Once the cursors enclose a desired region of interest the user can click Run again and the data table below the plot will produce max and min information such as amplitude, time on the plot, and index.
Block Diagram
All the work behind creating a user friendly interface can be found here. The block diagram starts with the File Path VI which allows you to open a .txt file. Once entered, it's read by the Read From Spreadsheet VI (block with glasses) and spat out as a 2D array (orange line). The transpose port at the bottom of this block is set to true because the text file data points are arranged in one time column and one amplitude column, and LabVIEW likes to work with rows of data types. The 2D array information is sorted out by the Index Array function. With this VI you can select 1D sub-arrays and individual elements. Elements t1 and and t0 are selected and then subtracted to get dt. Then element Y0 (first amplitude point) is subtracted from the Y array in order to baseline the amplitude data values. So now dt and Y are fed into the Build Waveform VI and can output a Waveform Graph. On this plot two cursors are added and assigned Property Nodes. A Cursor List VI (which is in the form of a cluster) containing information for Start and End cursors hat used. The information is then sorted out using an Index Array again (with Start indexed as 0 and End as 1). The output of the VI is still in cluster form but using the Unbundle by Name VI the X, time , position of each cursor can be singled out. The reason why this is done is because tstart and tend define your region of interest and are used to reproduce the selected waveform section with the help of the Get Wave Subset VI. The Statistic Express VI then gives you the values, times, and indexes of the max and min amplitude points. Indexes (unlike time and amplitude) are reset at the start of the cursor so, for example, the index of the max is relative to the cursor instead of the original plot. We want index relative to the original plot so just like before when the cursor 'Position X' was unbundled by name, we do the same for Index of the Start cursors and add it to the index of the max and min. This way we get Indexmax as indexed in the original plot not the sub waveform. All of the data components become Dynamic Data after the Statistic VI so they are converted into scalar form through a conversion VI and bundled by name. This way I can add a neat array indicator with labels. Et voila!
All the work behind creating a user friendly interface can be found here. The block diagram starts with the File Path VI which allows you to open a .txt file. Once entered, it's read by the Read From Spreadsheet VI (block with glasses) and spat out as a 2D array (orange line). The transpose port at the bottom of this block is set to true because the text file data points are arranged in one time column and one amplitude column, and LabVIEW likes to work with rows of data types. The 2D array information is sorted out by the Index Array function. With this VI you can select 1D sub-arrays and individual elements. Elements t1 and and t0 are selected and then subtracted to get dt. Then element Y0 (first amplitude point) is subtracted from the Y array in order to baseline the amplitude data values. So now dt and Y are fed into the Build Waveform VI and can output a Waveform Graph. On this plot two cursors are added and assigned Property Nodes. A Cursor List VI (which is in the form of a cluster) containing information for Start and End cursors hat used. The information is then sorted out using an Index Array again (with Start indexed as 0 and End as 1). The output of the VI is still in cluster form but using the Unbundle by Name VI the X, time , position of each cursor can be singled out. The reason why this is done is because tstart and tend define your region of interest and are used to reproduce the selected waveform section with the help of the Get Wave Subset VI. The Statistic Express VI then gives you the values, times, and indexes of the max and min amplitude points. Indexes (unlike time and amplitude) are reset at the start of the cursor so, for example, the index of the max is relative to the cursor instead of the original plot. We want index relative to the original plot so just like before when the cursor 'Position X' was unbundled by name, we do the same for Index of the Start cursors and add it to the index of the max and min. This way we get Indexmax as indexed in the original plot not the sub waveform. All of the data components become Dynamic Data after the Statistic VI so they are converted into scalar form through a conversion VI and bundled by name. This way I can add a neat array indicator with labels. Et voila!
No comments:
Post a Comment