When monitoring the sound level exposure, so-called dosimeters (image above) can be handed out to subjects, monitoring their continous sound level exposure. However, the sound level will fluctuate constantly. Therefore, it is common to calculate the equivalent sound level (Leq); a value at a constant sound level, equal to the varying sound level for a given duration.
In this exercise, you will be handed 12 datasets from a 2002 study, monitoring the noise exposure amongst industries suspected to be heavily exposed to high noise levels and a reference group of bankers. 6 of the datasets are from a noise-exposed industry and 6 from the reference group.
You will construct a VI to load the different sound measurement files, categorizing each file as either exposed or control depending on their total exposure. Each file contains the measurements for roughly 24 hours, taken at 5 second intervals. However, each noise measurement is measured using the decibel scale. Therefore, calculating an average of all the measurements would be incorrect; as a general rule of thumb, the sound level is doubled for every 3 dB increase in sound pressure. To calculate the Leq you will need to use the following formula:
However, in addition to the total noise exposure, a measure of the Work Leq is wanted. For each file, you will need to calculate the Leq from the beginning until the end of the working day (see this file for the times). This leaves out the next day, which is okay for the purposes of the exercise.
Finally, your VI should be able to measure the Leq between two user controlled time points, which can be controlled through the use of so-called "Cursors" - a device LabVIEW uses for dragging control points in a graph - more on this later.
Instructions:
Construct a front panel like this:
- The graph is an XY graph
- You can add the cursors by right-clicking your graph and going to the "Cursor" tab - here you can also change the display style, color, and name of each cursor.
When loading the file, use a "Read from spreadsheet" function. As the values in the file use commas for decimal separators, you will need to input the values as strings for later processing.
Using array subsets, you can access each column of data. Beware, that the data themselves only start at row 14 - the beginning of the file is a header.
When converting strings to numbers, you can use a function called "Scan from string". This converts a string according to what you write in the "format string". In the example shown, &,; tells LabVIEW to use the comma decimal operator, while %5.1f tells it to load a floating number, with 5 significant digits and one decimal. Note that you can expand the "Scan from string" to read more than one number at a time. For a more user-friendly way of editing the format string, you can right-click the control and select "Edit scan string".
Unfortunately, the dosimeters employed in the study could not measure lower than 50 dB. Values below this are marked " ---,-" (note the beginning space - this is important!). You will need to replace these strings with 50,0 in your VI.
You will need to construct timestamps for controlling the times. To do so, you can find inspiration in the Convert_String_to_TimeStamp.vi function. Basically, you will need to "glue" two of the data columns together using so-called string concatenation before converting to timestamps.
In order to find the end of work time, you can convert this to another timestamp, combining the time input with the date of the first datapoint. Subtracting this from your timepoint array and finding the minimal absolute difference will yield the wanted index.
To use the cursors for calculating a user-defined Leq, you can use a "Property Node" named "Cursor List". This will yield an array of the cursors employed; each cursor has a property called "Position -> X". This yield the timestamp for each cursor - note that you will need to convert this to an index before using them to extract an array subset.