Skip to content

Analysis

Shreyansh Singh edited this page Apr 19, 2021 · 6 revisions

The easiest way to test the system is to run it in the simulation mode. This can be done by passing the -s 1 argument to drmhk program. The simulation generates a synthetic bpm triangular waveform. It can be seen that whenever the bpm goes below the threshold,and after waiting for a certain time to make sure that the subject has slept, the sleep parameter is set to True, which starts the audio. Below is the graph when delay is set to two second (default). As one can see there is a time difference between the event of BPM going below the threshold and sleep value rise. This delay, in real scenarios must be around half an hour or more than that, to ensure the person is asleep.

Analysis Graph

Figure: Graph Showing Systems response to simulated BPM with delay = 2 seconds.

The below graph is plotted with -w 0 parameter. Analysis Graph Two

Figure: Graph Showing Systems response to simulated BPM with delay = 0 second.

In the above, apparently the difference in time between the events of BPM falling below the threshold and sleep variable being raised is one second, but in reality it is just 5 ms. Tis happens because the temporal resolution of time axis in the graph is one second.

The delay of 5ms

The delay of 5 ms happens because, the program first goes in the maybesleep state and in the next firing of the timer goes to sleep state.

Clone this wiki locally