FR1 program help
MEDState Notation Repository › Forums › Coding Help Archive › FR1 program help
- This topic has 5 replies, 1 voice, and was last updated 8 years, 9 months ago by
Med_Support.
-
AuthorPosts
-
July 21, 2006 at 3:01 pm #12598
Med_Support
Moderatorgdillon
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?
July 21, 2006 at 4:34 pm #12599Med_Support
ModeratorFilip*
So what do you have so far?
July 24, 2006 at 10:15 am #12602Med_Support
Moderatorgdillon
\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':-->STOPABORTJuly 24, 2006 at 2:36 pm #12604Med_Support
ModeratorFilip*
1. Why not modify S.S.1/S2 like this:
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.
July 24, 2006 at 3:08 pm #12606Med_Support
Moderatorgdillon
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-->S1August 3, 2006 at 8:39 am #12608Med_Support
ModeratorGary Bamberger
Hi Greg,
See my response to your other question in the coding help section:
S1, #R1: ADD R; SET T = 0 ---> SX #R2: IF (T >= 30) AND (R >= 1) [@Chained, @Unchained] @Chained: ADD C; SHOW 3,Chained,C; SET R = 0, T = 0 ---> S1 @Unchained: ADD U; SHOW 4,Unchained,U; SET R = 0, T = 0 ---> S1 1": ADD T ---> SXI think that it will answer your question.
-
AuthorPosts
- You must be logged in to reply to this topic.