DSIAC Journal: Spring 2015 - Volume 2/Number 2

Page 37

Step 2: Read the data into separate arrays for each data column. Before we read the data into arrays, we need to count the number of data rows to be processed. This will provide the length of each data array, which is the number of samples (n) for each measurement type. A call to the samplecount() function, pictured in Figure 6, with the required inputs is used to obtain the result. The samplecount() function uses the csv module to count the total number of rows in the file and then subtracts the number of header rows to get n. Now that we know the number of samples, we are ready to read the data values into five separate arrays: t for the time measurements, and LF_a, RF_a, LR_a, and RR_a for the vertical acceleration measurements.

Five separate calls to the construct() function, pictured in Figure 7, are used. The construct() function uses the csv module to read each measurement in a specified column of data and then stores these values in the assigned array.

86 with the required inputs is used to obtain sample rate. The time step is easily obtained by the calculation on line 89.

Step 3: Calculate sample rate (sr) and time step (dt).

Numerical methods are used for solving equations or mathematical models too complicated or too timeconsuming for an analytic solution. Using integral calculus to obtain velocity and displacement data from our blast response data is a perfect example of this type of problem. There are numerous methods available for numerical integration. We will focus on a method called composite trapezoidal rule numerical integration, which is wellsuited to our task.

The sample rate (sr), given in samples/ second, is the rate at which data were recorded during the test event. The time step (dt), given in seconds, is the reciprocal of sample rate and is the time interval between samples. Both sr and dt are used in the animation process. To make these calculations more straightforward, we can shift the time array to start at zero and convert the time data units from milliseconds to seconds, as pictured in Figure 8. A call to the samplerate() function on line

Step 4: Use numerical integration to calculate velocity and displacement.

To refresh everyone’s memory, there are two types of integrals in calculus,

Figure 7: Read Data and Create Arrays.

Figure 5: Identify Data File and Data Columns.

Figure 6: Count Data Samples.

Figure 8: Source Code for Calculating sr and dt.

SV

DSIAC Journal • Volume 2 • Number 2 • Spring 2015 / 37


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.