Millisecond Forums

Terminate Experiment After Elapsed Time X

https://forums.millisecond.com/Topic15560.aspx

By DCole9 - 2/19/2015

Hey Inquisiters,
I'm trying to have my experiment terminate itself after expt.name.elapsedtime becomes > a certain duration.  I tried doing the following.

<trial>
...
/branch = [if (expt.myexpt.elapsedtime < 810000) block.theblock)]
</trial>
<exp myexptt>
/blocks [1 = theblock]
</expt>


This is giving me the error that block.theblock is the wrong element type.  I suspect that is because I am trying to branch to a block from a trial?  I have to code my experiment this way b/c my trials refresh on each button press (fills a bar).  So I have blocks as my "trials".  Is there a way to 'break' the experiment with a certain command or to branch to a block from a trial?  Maybe there is something I am missing.

Thanks for your time,
Dan




By DCole9 - 2/19/2015

I discovered the stop command--- seems to work well.  I was testing it in my experiment section and set it to stop the experiment after just 1 second.  However I noticed that the experiment continues well beyond one second.  Does it always finish the current block/trial/etc. before it terminates?
By Dave - 2/19/2015

<trial>
...
/branch = [if (expt.myexpt.elapsedtime < 810000) block.theblock)]
</trial>

You cannot branch from a trial to a block. Branches must be at the same level, i.e. a trial can branch to another trial, a block can branch to another block.

The /stop attribute will *not* interrupt the currently running trial. It will only kick in once the trial terminates.

If you want a *hard* interrupt, use the /timeout attribute.
By DCole9 - 2/19/2015

Thanks for the response Dave.  /stop seems suitable for me.