| Author |
Message |
niels
Joined: Nov 12, 2007 Posts: 7
|
Posted: Nov 16, 2007 6:04 PM Post subject: Pausing and resuming the EDF witer |
|
Hi Jarek,
I thought I had everything covered but I'm experiencing a weird problem. I have an EDF witer in my designs. It has \"do not start\" checked and is started automatically after a time period. Also after another timerperiod it is being \"paused.\" The edf writer is set to \"overwrite\" and the file is created when I press stop on the buttonmenu.
Now the weird thing I experience is that with short time intervals for pausing and resuming the element this works just fine. That is, the recording length matches the time intervals. But when I use time intervals like 5 min I notice that the edf file has a greater recording length then the interval. I don't understand what's causing this.
Any ideas on this?
Thanks |
|
 |
jarek
Joined: Oct 22, 2007 Posts: 1075
|
Posted: Nov 16, 2007 8:06 PM Post subject: |
|
Hi Niels,
what is the difference, how much longer then 5min is the EDF file?
EDFWriter saves whatever is gets. So maybe the 5min time is not measured so precisely?
Jarek
|
|
 |
niels
Joined: Nov 12, 2007 Posts: 7
|
Posted: Nov 16, 2007 8:27 PM Post subject: |
|
Hi,
Well, the difference seems to increase with the interval length. With a 300 sec interval the difference was 6 sec.
I've already tried to bring the EDF writer closer to the interval source. The interval elements are burried in the buttoncontrol design a few nested designs deeper.
This seems to make a difference. Now the difference is 2 sec between recording length and interval length. (For recording length I also look at the file properties in the EDF reader in the \"source\" design.)
The interval elements trigger element interactors which put the EDF writer either to \"start\" or \"pause.\" Is the reaction time maybe to slow for this? The other elements that are triggered in the same way, act much more precise. But then the element interactors just put them to \"start\" and \"stop\"
Niels |
|
 |
jarek
Joined: Oct 22, 2007 Posts: 1075
|
Posted: Nov 16, 2007 9:31 PM Post subject: |
|
Niels,
the 2 seconds would make sense. Because that is the default length of the input buffer. The buffers of inactive elements are cleared, but if an element is just stopped, then this data stays in there, and when you start it, those 2 seconds are written at once. That would be my guess. I can't explain the 6 seconds though.
The interactors are very fast, definitely faster then 10ms, so it should not matter. More likely is that the time interval is somehow rounded up or down, and fires the event to interactor later.
Jarek
|
|
 |
niels
Joined: Nov 12, 2007 Posts: 7
|
Posted: Nov 17, 2007 12:08 AM Post subject: |
|
But those samples that could still be in the buffer, are from before pausing the EDF writer? Or are there always samples in the buffer even before the element is recording?
Niels |
|
 |
jarek
Joined: Oct 22, 2007 Posts: 1075
|
Posted: Nov 17, 2007 12:38 AM Post subject: |
|
Niels,
I looked closer at the code. I think my previous idea was wrong. Because when element is not started, then it is automatically deactivated (I forgot about that). So input buffers of the EDFWriter do not receive anything in this case.
So it is probably something with the time interval. But I am only guessing, it is hard to know without debugging the design.
One idea to debug would be to use Counter and see how many samples and when are sent to the EDFWriter. This counter should be \"not started\" and then started from Interactor exactly the same as the EDFWriter. It would precisely show how the number of samples changes in time. Number of samples would be Rate x Time.
Jarek
|
|
 |
niels
Joined: Nov 12, 2007 Posts: 7
|
Posted: Nov 17, 2007 2:19 AM Post subject: |
|
Hi Jarek,
I've followed your advice. If I connect a counter with a display exactly set (started and stopped) as the EDF writer the samplecount is greater than 76800 samples (300 seconds at 256 sps). So indeed the intervals are the problem. But this made me think of a new idea. To just trigger the EDF to start and pause at 76800 samples. Is there an easy way to do this?
Niels |
|
 |
jarek
Joined: Oct 22, 2007 Posts: 1075
|
Posted: Nov 17, 2007 2:33 AM Post subject: |
|
| There are ways, one would be to use Counter + Threshold, and then stop EDFWriter when this number is reached. |
|
 |
niels
Joined: Nov 12, 2007 Posts: 7
|
Posted: Nov 17, 2007 6:41 PM Post subject: |
|
Hi Jarek,
The counter + threshold did the trick. Everything is working flawlessly now. Excellent.
Thanks
Niels |
|