Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

131 Posts in 47 Topics- by 43 Members - Latest Member: Sherry Lammott

September 10, 2010, 06:42:32 am
Coding Conditioning ProceduresProgram RequestFR1 program help
Pages: [1]
Print
Author Topic: FR1 program help  (Read 4661 times)
gdillon
Newbie
*
Posts: 10


View Profile Email
« on: July 21, 2006, 02:01:54 pm »

I am trying to write a section of code in an FR1 program that would discriminate between response types.  I would like the program to count visits to the receptacle within 30secs following a lever press as chain responses.  And visits to the receptacle at any other time as unchained responses.  I am having trouble making this work.  Any suggestions?
Logged
Filip*
Newbie
*
Posts: 5


View Profile Email
« Reply #1 on: July 21, 2006, 03:34:14 pm »

So what do you have so far?
Logged
gdillon
Newbie
*
Posts: 10


View Profile Email
« Reply #2 on: July 24, 2006, 09:15:33 am »

\Inputs
^LeftLever=1
^Receptacle=2

\Outputs
^House = 1
^Reward=2 \ In this code, this is a Pellet Dispenser
^RewardLight=3

\Defined Variables
\A=# of total lever presses
\B=# of rewards received
\C=# Chained responses
\U=# Unchained responses
\T=temporary counter for time window after response
\X=number of receptacle visits during window

S.S.1,
S1,
#START: ON ^House --> S2

S2,
#R^LeftLever: ON ^Reward; ON^RewardLight; Z1 --> S3

S3,
2": -->S1

S.S.2,
\This is state set that contains the response count and display.  This will now put label the \"Responses" and its value "A" on screen until the START command is issued

S1,
#START: SHOW 1, Responses, A-->S2

S2,
#R^LeftLever: ADD A; SHOW 1, Responses, A --> SX

S.S.3,
\Reward Counter and Timer

S1,
#Z1: ADD B; SHOW 2, Rewards, B --> S2

S2,
0.05": OFF ^Reward--> S1

S.S.4,
\Chained vs unchained responses

S1,
#Z1:  SET T=0-->S2

S2,
#R^Receptacle: ADD T; ADD X-->S2
#Z1: SET T=0-->S2
1": ADD T; IF T<=30 THEN {@Chained; @Unchained}
@Chain: ADD C; SHOW 3, Chain, C-->S1
@Unchained: ADD U; SHOW 4, Unchained, U-->S1


S.S.5,
\Session Timer

S1,
#START:-->S2

S2,
60':-->STOPABORT
Logged
Filip*
Newbie
*
Posts: 5


View Profile Email
« Reply #3 on: July 24, 2006, 01:36:47 pm »

1. Why not modify S.S.1/S2 like this:
Code:
S2,
  #R^LeftLever: ON ^Reward; ON^RewardLight; Z1 ---> S2 (NOTE: YOUR REDIRECTION WAS MISSING A '-')
  #R^Magazine: Z2 ---> S2

Of course, you need another stateset to count these magazine responses. It will be very similar to your S.S.4.

2. Also, I'd move all the reward and signal code into a separat states that listens for Z1 only. This way, you keep switching the reward and signal on and off close to each other.

3. Third, I'd move all user messages to a separate stateset for clarity.
Logged
gdillon
Newbie
*
Posts: 10


View Profile Email
« Reply #4 on: July 24, 2006, 02:08:07 pm »

Filip,
Thanks for the suggestions. 
In my current program I am trying to count the magazine responses in my If/Then statement, so that every nose poke into the food hooper is measured as either a chain or unchained response, but it doesn't seem to be working.

S.S.4,
\Chained vs unchained responses

S1,
#Z1:  SET T=0-->S2

S2,
#R^Receptacle: ADD T; ADD X-->S2
#Z1: SET T=0-->S2
1": ADD T; IF T<=30 THEN {@Chained; @Unchained}
@Chain: ADD C; SHOW 3, Chain, C-->S1
@Unchained: ADD U; SHOW 4, Unchained, U-->S1

Logged
Gary Bamberger
Administrator
Newbie
*****
Posts: 39


View Profile WWW Email
« Reply #5 on: August 03, 2006, 07:39:02 am »

Hi Greg,

See my response to your other question in the coding help section:

http://www.med-associates.com/mednr/forum/index.php?topic=10.0

I think that it will answer your question.
« Last Edit: December 14, 2007, 11:09:43 am by Gary Bamberger » Logged
Pages: [1]
Print
Jump to: