Main siteMain site  ForumForum  ForumSearch  Private messageEmail contact  RegisterRegister  Log inLog in 
Topic: Pulling the Time Range for an Oscilloscope from...
Reply to topic
Author Message
Keith



Joined: Jun 1, 2008
Posts: 24

PostPosted: Jul 6, 2008 3:23 AM    Post subject: Pulling the Time Range for an Oscilloscope from...

Jarek,

I am trying to pull the Time Range for an Oscilloscope from the Recording Length field from the File Reader, but I am having some difficulties. When I try to use Prop Getter using Digi Float of Scaler I get an error because it pulls the \"[s]\" from the field as well, and if I try to pull it as object then I can't get rid of the [s] to send the value to the oscilloscope.

Is there a simple way to go about removing the text characters from the Recording Length field? I am trying to get the oscilloscope to display the entire file condensed on one screen without having to manually reset the time range when I have a different length of file.

Thanks a million!!

-Keith
jarek



Joined: Oct 22, 2007
Posts: 1075

PostPosted: Jul 6, 2008 3:46 AM    Post subject:

Keith,

I assume you mean EDFFileReader. You can use PropertyGetter and read 'Recorded samples' variable from Interactive Properties. It provides length of the file (counted in samples, to get seconds you need to divide by recorded rate).

Let me know if that is not what you were looking for.

Jarek

Keith



Joined: Jun 1, 2008
Posts: 24

PostPosted: Jul 6, 2008 7:31 AM    Post subject:

Jarek,

My bad, I should have specified EDFFileReader!

I followed your advice and pulled from Record Samples from Interactive Properties. I followed this with with an ExpressionEvaluator to divide the samples by the recorded rate. I piped this into a PropertySetter so I could direct the value to the Time Range variable in the oscilloscope.

It works in that it sets the Time Range in the Osc. for the initial file, but the only problem is that it retains that value even when I load a file with a different length. For example, if the first file I select (I am loading files into the EFFileReader froma menu) has a length of 30 seconds, it sets the Time Range to 30 seconds. But if I then select a file with a length of 120 seconds, the osc. Time Range stays at 30 seconds. I have tried evrything from reinit target to stop-reinit-start target (in PropertySetter) but nothing works.

I did, however, set up a button that uses a SystemInteractor to send an init command to the Osc. and that works! I just have to hit my reinit button when I load a new file and the new Time Range value is accepted.

If you can see anything obvious I am doing wrong, please advise, but don't wrack your brain over it. I am perfectly satisfied using an init button, I just can't shake the feeling I am overlooking someting simple! Which is usually the case.. :)

Thanks again!!

-Keith
jarek



Joined: Oct 22, 2007
Posts: 1075

PostPosted: Jul 6, 2008 4:16 PM    Post subject:

Keith,

when a property like Time range is modified in Oscilloscope using PropertySetter, you do need to reinit the element. The Reinit Target (in PopertySetter) should be sufficient in that case. Are you doing this?

Jarek
Keith



Joined: Jun 1, 2008
Posts: 24

PostPosted: Jul 6, 2008 7:20 PM    Post subject:

Jarek,

I have tried with both reinit and stop-reinit-start in PropertySetter. I have discovered that when I load a new file with a different length, regardless of which of the two above settings I use, it retains the Time Range from the first file, but then if I hit stop and then play again, it resets the value second time correctly.

In other words, if I load a 30 second file, and run it, it sets the Time Range value to 30 seconds, no problem. Then if I load a 60 second file, it keeps the old value (30 seconds) when I hit play. BUT:: if I then hit stop and play again, it sets the new value (60 seconds). I would have thought that using the stop-reinit-start setting in the PropertySetter wouldhave fixed that, but it runs the same whether I use stop-reinit-start, or simply reinit.

Like I said, its no big deal, I just have to hit play, stop, and then play again when I load a new file with a different length. And now that I know this, I no longer need my reinit button. It is a very, very minor thing, and its still much easier than resetting the Time Range manually. My goal with designs is to be able to do everything from the runtime window, and hitting play-stop-play for the new file length fits that criteria.

I have no doubt that it is something I am doing or not doing correctly, and as I get better at programing in Bioera I tend to go back and fix these little problems later.

-Keith
jarek



Joined: Oct 22, 2007
Posts: 1075

PostPosted: Jul 6, 2008 7:59 PM    Post subject:

Keith,

one idea. The PropertyGetter you are using to pull the value from EDFFileRead has to be triggered when a new file is loaded. Are you doing this?

Jarek
Keith



Joined: Jun 1, 2008
Posts: 24

PostPosted: Jul 8, 2008 1:15 AM    Post subject:

Jarek,

That was it!

There was nothing triggering the PropertyGetter. I had assumed that getting new field data from the EDFFile Reader would serve as a trigger, but now that I think about it, why would it? That data is passive in the sense that nothing was telling the Getter that there was something to get! Which also explains why it worked when I stopped and restarted. This was jump starting PropertyGetter.

I tried running a pipe from the EDFFileReader to the PropertyGetter. This worked in that it changed the Time Range as desired, but the wave in the Oscilloscope jammed. It would \"play\" a second or less and then immediately reset to the beginning. I am guessing that the nature of the signal coming from EDF Reader was looping in such a manner that PropertyGetter was being constantly triggered, so I needed something that would trigger it once and then leave it alone.

I set up a SystemEventSource to send a signal to the Trigger input on PropertyGetter, with the Event Type in the SystemEventSource set to Processing_Started. That way instead of needing a stop-start to trigger the element, there was now an element set to specifically listen for system processing to begin in order to send a single signal to the Property Getter. Now it works perfectly!

Does the above seem to reflect an accurate understanding of what my problem was and why your suggestion fixed it? I don't want to just fix the problems, I want to learn from them as well.

-Keith
jarek



Joined: Oct 22, 2007
Posts: 1075

PostPosted: Jul 8, 2008 1:37 AM    Post subject:

Keith,

if you method works then it is good.

You can't trigger the Getter from the output of EDFFileReader. But you could trigger it from the menu (I assume you load new design from a menu), that way it is done only once. Make sure it is triggered after the file is already loaded into EDFFileReader, you may need to use Delay (maybe not).

Jarek
Reply to topic