PhysioDesigner
A modeling tool for multilevel physiological systems

Modeling with extra-implementation


Sometimes we encounter a model with supplementary definition to modulate the dynamics of the model when a certain condition is fulfilled. For example, the following is one of models of neuron membrane potential.

Pasted Graphic

where v represents the membrane potential [mV ], u is a membrane recovery variable, a and b control the time scale of the recovery variable and its sensitivity to the subthreshold fluctuation of the membrane potential. This model generates an action potential with a continuous dynamics.

To avoid divergence of the values of the variable, the following supplementary definitions accompany the above ODE system representing the membrane potential dynamics.

Pasted Graphic

If we set parameters as a = 0:02, b = 0:2, c = -65, d = 8 so to mimic the behavior of a regular spiking neuron, the dynamics will be like the following.

Pasted Graphic 1

The model can be implemented on PhysioDesigner as

Pasted Graphic 1

This kind of supplementary definitions can be described as "extra-implementation" on PhysioDesigner.
In this section, how to define the extar-implementation such as value resetting is explained.


1. Membrane potential module

1.1. Ordinal implementation


Let us start from the usual modeling by taking the above neuron model as an example.
This model includes two variable v and u. We will create two modules "Membrane potential" and "Membrane recovery variable" for each of v and u, respectively.
Selecting both of them on the canvas and encapsulate them, then both of them can be encapsulated simultaneously by one capsule module as shown in the above figure.

There are state type physical quantity v, static parameter c, variable parameters u and Iext in Membrane potential module.

The implementation of v is
diff(v, time) = ((( 0.04 * v * v + 5 * v + 140 ) - u ) + Iext ).
and initial value is v=-70



Do not forget to assign u to an out-port named u so that the other module can utilize this value via the out-port.


1.2. Implementation with "extra-implementation"


The value of v will be reset to c when v >= 30.
This definition is described in extra-implementation.

Pasted Graphic

Select "conditional" at Definition-type combo box.
The oder defines the timing to evaluate this extra-implementation in computation process. Users need to select one of "Before" or "After". "Before" means that the extra-implementation is evaluated before the numerical integration of ODEs in a computation of a single time step. Hence the result of the extra-implementation is used in ODEs integration. Similarly "After" means that the extra-implementation is evaluated after the numerical integration of ODEs. Then the result of the extra-implementation is used in a computation of the next time step.

Once "conditional" is set at Definition-type, a combo box including "if", "else if", and "else" appears with text boxes to input math expression for defining condition, and definition which is evaluated when the condition is satisfied.

Here we set v >= 30 for condition, and v =c for definition.

That's all for extra-implementation.


1.3. Other parameters in Membrane potential module


One static parameter c as c=-65, and two variable parameter u and Iext assigned to an in-port named u and Iext, respectively.

Pasted Graphic


2. Membrane recovery variable module


This module has a state u defined as diff(u, time) = a * ( b * v - u ). The initial value is u=0. The state should be assigned to an out-port u, so that the other module can utilize this value via the out-port.

The extra-implementation for the state u needs to be implemented. Similarly to the case of the state v, we can define it in the extra-implementation tab as the following figure.

Pasted Graphic

The other parameters to be defined in this module are the following.
Three static-parameters a, b, d set as 0.02, 0.2 and 8, respectively. And one variable-parameter v assigned to an in-port named v to receive a value from the other module.


Link edges


Link edges between two modules as the following figure.
Pasted Graphic 1Pasted GraphicPasted Graphic 2




Input stimulus module


For performing simulation, we need to give a stimulus current to membrane potential module. Let us create a stimulus current generator module which generates a pulse current such as the following figure.

Pasted Graphic

At first four static-parameters are defined:
pulse_onset_time = 50
pulse_width = 200
pulse_height = 10
initial_current = 0

And then variable parameter stimulus_current is defined using conditional as follows,
if (pulse_onset_time <= time) && (time <= ( pulse_onset_time + pulse_width ))
then stimulus_current = initial_current + pulse_height + gauss_variate(0,10)
else stimulus_current = initial_current + gauss_variate(0,10)
These definitions are defined in Implementation.

Do not forget to assign an out-port current to the variable-parameter stimulus_current.

Then encapsulate the module for future reuse. And link the out-port current to the in-port Iext of the membrane potential module.
The following is the complete model.
Pasted Graphic 1


Simulation result


Pasted Graphic 1