Question: ( 3 0 points ) Using a flat sequence structure is an effective method for controlling execution order when bench - marking code performance. By

(30 points) Using a flat sequence structure is an effective method for controlling execution order when bench-
marking code performance. By combining the flat sequence structure with tick count function nodes, users can
accurately measure the execution time of code within a sequence frame. As an example, Figure 2 shows two
methods for creating a 1 D array of 32-bit signed integers. One approach uses a for loop, while the second uses
a while loop. It turns out that one of these approaches takes less time to execute than the other; this is true
even if we add an Equal? function node in the for loop to balance out the tinne required by the similar function
in the while loop. In this exercise, you will use the flat sequence structure to determine execution time of both
loop structures. Be sure to include the VIs you create for this problem with your solutions.
Figure 2: Block diagram for the sub VI.
(a)(6 points) The for loop and while loop structures use auto-indexing tunnels to generate 1D arrays of signed
32-bit integers. Assume the value for N is set to be 7,200,000. How many elements are in the 1D arrays
displayed by the indicators labeled output 1 and output 3, respectively? What are the 10000 th elements
in output 1 and output 3, respectively?
(b)(4 points) Describe the indicators labeled output 2 and output 4 in a sentence or two.
(c)(20 points) Code and execute the sub VI shown in Figure 2. Using the LabVIEW code provided in
"ps3_p9_starter.vi" as a starting point, complete a VI to automate the measurement of the average loop
execution time. Place the sub-VI inside a for loop and execute it 31 times. Initialize the sub-VI to make a
small change to the size of the array it creates during each iteration. Use the loop to generate arrays of the
execution times for both the for and while loops within the sub-VI. Exclude the first measured time
and compute the average execution time for each loop type. Run your code and include screenshots of
both the front panel and block diagram in your written submission. Additionally, submit the entire code
as a zip file along with your written solutions. Record the average execution time for both the for and
the while loops, and based on your results, determine which loop structure is more efficient.
Figure 3: Initialization code for the sub VI.
( 3 0 points ) Using a flat sequence structure is

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!