My test system has two equations. One is an algebraic equation that defines a variable 'b' that is just an oscillator. The other is a differential equation for variable 'a' that is driven by 'b' but which enforces a lower limit of zero for 'a'. The goal of this endeavor is to use the same approach for a much larger model (i.e. many more differential equations), such that major components of the system are separated into separate .mod files. This will require using POINTER to access state variables between each POINT_PROCESS.
Here is a version with both equations in a single .mod file:
Code: Select all
NEURON {
POINT_PROCESS equations
}
PARAMETER { :: Declare and set any parameters required for this mod file here.
b0 = 1.0 :: Scaling parameter
w = 0.628 :: Frequency parameter
}
STATE { a b } :: Declare state variables here.
BREAKPOINT {
SOLVE states METHOD derivimplicit :: See template for instructions.
}
INITIAL {
a = 1.0 :: Set initial value of state variable.
b = 1 :: Set initial value.
net_send(0,1)
}
DERIVATIVE states {
b = b0 * cos(w * t) :: Algebraic equation
a' = a * (1 - a) - b :: Differential equation
}
NET_RECEIVE (dummy_weight) {
if (flag == 1) {
WATCH (a < 0.0) 2
}
else if (flag == 2) {
net_event(t)
a = 0.0
}
}
Code: Select all
create model
access model
objref obj
obj = new equations(0.5)
objref cvode
cvode = new CVode(1)
cvode_active(1)
Code: Select all
NEURON {
POINT_PROCESS brain
POINTER b
}
ASSIGNED { b } :: Declare all pointer variables here.
STATE { a } :: Declare state variables here.
BREAKPOINT {
SOLVE states METHOD derivimplicit :: See template for instructions.
}
INITIAL {
a = 1.0 :: Set initial value of state variable.
net_send(0,1)
}
DERIVATIVE states {
a' = a * (1 - a) - b :: Differential equation
}
NET_RECEIVE (dummy_weight) {
if (flag == 1) {
WATCH (a < 0.0) 2
}
else if (flag == 2) {
net_event(t)
a = 0.0
}
}
Code: Select all
NEURON {
POINT_PROCESS body
}
PARAMETER { :: Declare and set any parameters required for this mod file here.
b0 = 1.0 :: Scaling parameter
w = 0.628 :: Frequency parameter
}
STATE { b } :: Declare state variables here.
BREAKPOINT {
b = b0 * cos(w * t) :: Algebraic equation
}
INITIAL {
b = 1 :: Set initial value.
}
Code: Select all
create model
access model
objref objBrain, objBody
objBrain = new brain(0.5)
objBody = new body(0.5)
// Set pointer
setpointer objBrain.b, objBody.b
objref cvode
cvode = new CVode(1)
cvode_active(1)