Question: COMP160 Virtual Device Measurement Assume we are measuring the state of an electronic device. We want to take measurements every 10 milliseconds until the sum

 COMP160 Virtual Device Measurement Assume we are measuring the state of

COMP160 Virtual Device Measurement Assume we are measuring the state of an electronic device. We want to take measurements every 10 milliseconds until the sum of the measurements equals 100.0 and report how long it took to reach that value To make the assignment casier, we will use a virtual device instead of a real piece of hardware. Before taking measurements, the virtual device must be initialized by calling initDevice ( yourt Dnumber ) where pour number is your student id. After initialization, your program should loop until the sum of the measurements exceeds 100. A measurement can be made by calling get Sample () which returns a value of type double Your computer can run much faster than the device. Measurements will be inaccurate if they occur more frequently than every 10 milliseconds. In the program's loop, it will need to pause for 10 milliseconds before taking the measurement. A program can pause for 10 milliseconds by calling this thread::sleep_for(chronoswilliseconds(10); // wait 10 milliseconds Since the measurement are taken every 10 milliseconds, you can calculate the time in seconds by counting the number of measurements and, at the end, multiplying the count by 0.010 seconds measurement. Experiments show that it will take between one and four seconds for the sum of the measurements to reach 100. At the end, your program should print the amount of time taken to reach 100 Download the device.h file from Blackboard and save it in the same directory as your program source. At the top of your program, you will need: include Il for cout include 11 for waiting 10 milliseconds #include "device.h" I for virtual device functions Upload the .cpp file of your program to Blackboard when completed. COMP160 Virtual Device Measurement Assume we are measuring the state of an electronic device. We want to take measurements every 10 milliseconds until the sum of the measurements equals 100.0 and report how long it took to reach that value To make the assignment casier, we will use a virtual device instead of a real piece of hardware. Before taking measurements, the virtual device must be initialized by calling initDevice ( yourt Dnumber ) where pour number is your student id. After initialization, your program should loop until the sum of the measurements exceeds 100. A measurement can be made by calling get Sample () which returns a value of type double Your computer can run much faster than the device. Measurements will be inaccurate if they occur more frequently than every 10 milliseconds. In the program's loop, it will need to pause for 10 milliseconds before taking the measurement. A program can pause for 10 milliseconds by calling this thread::sleep_for(chronoswilliseconds(10); // wait 10 milliseconds Since the measurement are taken every 10 milliseconds, you can calculate the time in seconds by counting the number of measurements and, at the end, multiplying the count by 0.010 seconds measurement. Experiments show that it will take between one and four seconds for the sum of the measurements to reach 100. At the end, your program should print the amount of time taken to reach 100 Download the device.h file from Blackboard and save it in the same directory as your program source. At the top of your program, you will need: include Il for cout include 11 for waiting 10 milliseconds #include "device.h" I for virtual device functions Upload the .cpp file of your program to Blackboard when completed

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 Databases Questions!