📄 tenmodel.java
字号:
/* This is the main file of the program, it contains the values of all paramaters,
initial values of the state variables, size of the time step, duration of the
simulation, and the specification of a dynamic and S1S2 restitution protocol.
It contains the function Start which serves to get the name of the destinationpath
(where output files should be put) from the commandline (if you do not supply this
pathname the program aborts) and the function Main which contains a time loop in which
the other functions are called:
Step: in which the computations of currents and the updating of voltage, intracellular
concentrations and states of gates takes place and in which an output file of the currents
is generated. (See file Step.cc)
Var.writebackup: this is a function of the Variable object Var. The Variable object
merely serves to create a single object that contains the different state variables that
together describe the state of the cell and to be able to pass them on as a single item
to other functions. The function writebackup writes to file a backup of the states of all
variables at the times it is called (each row corresponds to a single point in time, the
columns correspond to the different variables). (See files Variables.h and Variables.cc)
In addition there is a file Header.h which contains the function definitions and in which we
can define whether we want to simulate and epicardial endocardial or mid-myocardial human
ventricular cell. Finally there is a makefile that serves as an example of how the different
files that make up the program can be linked into a single executable (called model).*/
/* ERRATA:
We found a typo in the parameter values in the ms describing this model.
Below we list the value the parameter should have and which is used
in this implementation but that is wrong in the ms:
GpCa=0.825nS/pF
*/
import java.io.*;
public class TenModel{
final boolean FALSE = false;
final boolean TRUE = true;
final static int DYNRESTPROTOCOL = 1;
final static int S1S2RESTPROTOCOL = 2;
final static int EPI = 1;
final static int ENDO = 2;
final static int MCELL = 3;
public static int protocol = DYNRESTPROTOCOL;
public static int cellType = EPI;
/*------------------------------------------------------------------------------
PARAMETER FOR INTEGRATION
------------------------------------------------------------------------------*/
//timestep (ms)
double HT =0.02;
/*-----------------------------------------------------------------------------
PARAMETERS FOR INITIAL CONDITIONS
------------------------------------------------------------------------------*/
//Initial values of state variables
double V_init=-86.2;
double Cai_init=0.0002;
double CaSR_init=0.2;
double Nai_init=11.6;
double Ki_init=138.3;
/*--------------------------------------- ------------------------------------
PARAMETER FOR SIMULATION DURATION
---------------------------------------------------------------------------*/
//duration of the simulation
double STOPTIME=10000;
/*-----------------------------------------------------------------------------
PARAMETERS FOR STIMULATION PROTOCOLS
-----------------------------------------------------------------------------*/
// DYNRESTPROTOCOL
int i_low=0;
int i_high=1;
int j_low=0;
int j_high=1;
double stimduration=1.0;
double stimstrength=-52;
double period=5000;
double sum=period*30.;
double tbegin=0;
double tend=tbegin+stimduration;
// S1S2RESTPROTOCOL
// same with DYNRESTPROTOCOL
double tbeginS2 = 0;
int counter=1;
double dia=5000;
double basicperiod=1000.;
double basicapd=274;
int repeats=10;
// #ifdef DYNRESTPROTOCOL
// int i_low=0,i_high=1;
// int j_low=0,j_high=1;
// double stimduration=1.0;
// double stimstrength=-52;
// double period=5000;
// double sum=period*30.;
// double tbegin=0;
// double tend=tbegin+stimduration;
// #endif
//
//
// #ifdef S1S2RESTPROTOCOL
// int i_low=0,i_high=1;
// int j_low=0,j_high=1;
// double stimduration=1.;
// double stimstrength=-52;
// double tbegin=0;
// double tend=tbegin+stimduration;
// int counter=1;
// double dia=5000;
// double basicperiod=1000.;
// double basicapd=274;
// int repeats=10;
// #endif
void init(){
/*-----------------------------------------------------------------------------
FLAG TO CHOOSE BETWEEN DYNAMIC AND S1S2 RESTITUTION PROTOCOL
-----------------------------------------------------------------------------*/
// #define DYNRESTPROTOCOL
// //#define S1S2RESTPROTOCOL
/*-----------------------------------------------------------------------------
ELECTROPHYSIOLOGICAL PARAMETERS:
-----------------------------------------------------------------------------*/
//External concentrations
Step.Ko=5.4;
Step.Cao=2.0;
Step.Nao=140.0;
//Intracellular volumes
Step.Vc=0.016404;
Step.Vsr=0.001094;
//Calcium dynamics
Step.Bufc=0.15;
Step.Kbufc=0.001;
Step.Bufsr=10.;
Step.Kbufsr=0.3;
Step.taufca=2.;
Step.taug=2.;
Step.Vmaxup=0.000425;
Step.Kup=0.00025;
//Constants
Step.R=8314.472;
Step.F=96485.3415;
Step.T=310.0;
Step.RTONF=(Step.R*Step.T)/Step.F;
//Cellular capacitance
Step.CAPACITANCE=0.185;
//Parameters for currents
//Parameters for IKr
Step.Gkr=0.096;
//Parameters for Iks
Step.pKNa=0.03;
if (cellType == EPI){
Step.Gks=0.245;
}
if (cellType == ENDO){
Step.Gks=0.245;
}
if (cellType == MCELL){
Step.Gks=0.062;
}
//Parameters for Ik1
Step.GK1=5.405;
//Parameters for Ito
if (cellType == EPI){
Step.Gto=0.294;
}
if (cellType == ENDO){
Step.Gto=0.073;
}
if (cellType == MCELL){
Step.Gto=0.294;
}
//Parameters for INa
Step.GNa=14.838;
//Parameters for IbNa
Step.GbNa=0.00029;
//Parameters for INaK
Step.KmK=1.0;
Step.KmNa=40.0;
Step.knak=1.362;
//Parameters for ICaL
Step.GCaL=0.000175;
//Parameters for IbCa
Step.GbCa=0.000592;
//Parameters for INaCa
Step.knaca=1000;
Step.KmNai=87.5;
Step.KmCa=1.38;
Step.ksat=0.1;
Step.n=0.35;
//Parameters for IpCa
Step.GpCa=0.825;
Step.KpCa=0.0005;
//Parameters for IpK;
Step.GpK=0.0146;
}
/*----------------------------------------------------------------------------
OTHER PARAMETERS
---------------------------------------------------------------------------*/
//destination path to put in output files
// char despath[200];
/*---------------------------------------------------------------------------*/
double time=0;
public static void main(String argv[])
{
TenModel tenCell = new TenModel();
tenCell.init();
tenCell.start();
}// MAIN
public void start(){
int step;
double Istim = 0;
File f;
FileOutputStream out = null;
Variable Var = new Variable(V_init,Cai_init,CaSR_init,Nai_init,Ki_init);
try {
f = new File("D:\\out.txt");
out = new FileOutputStream(f);
}catch (FileNotFoundException e){
System.out.println(" Cannot open this file");
System.exit(1);
}
for(step=0;time<=STOPTIME;step++){
time+=HT;
if(protocol == DYNRESTPROTOCOL){
if(time>sum){
if(period>4000){
period=period-1000;
sum=sum+period*30;
}else if(period>3000){
period=period-1000;
sum=sum+period*30;
}else if(period>2000){
period=period-1000;
sum=sum+period*30;
}else if(period>1000){
period=period-1000;
sum=sum+period*100;
}else if(period>500){
period=period-250;
sum=sum+period*100;
}else if(period>400){
period=period-50;
sum=sum+period*100;
}else if(period>300){
period=period-10;
sum=sum+period*100;
}else if(period>250){
period=period-5;
sum=sum+period*100;
}else if(period>50){
period=period-1;
sum=sum+period*100;
}else {
System.out.println("restitution protocol finished");
System.exit(1);
}
}
if(time>=tbegin && time<=tend){
Istim=stimstrength;
}
if(time>tend){
Istim=0.;
tbegin=tbegin+period;
tend=tbegin+stimduration;
}
}else if( protocol == S1S2RESTPROTOCOL){
if(counter<repeats){
if(time>=tbegin && time<=tend){
Istim=stimstrength;
}
if(time>tend){
Istim=0.;
tbegin=tbegin+basicperiod;
tend=tbegin+stimduration;
counter++;
}
}else if(counter==repeats){
if(time>=tbegin && time<=tend){
Istim=stimstrength;
}
if(time>tend){
Istim=0.;
tbegin=tbegin+basicapd+dia;
tbeginS2=tbegin;
tend=tbegin+stimduration;
counter++;
}
}else if(counter==repeats+1){
if(time>=tbegin && time<=tend){
Istim=stimstrength;
}
if(time>tend){
Istim=0.;
tbegin=tbegin+basicperiod;
tend=tbegin+stimduration;
counter=0;
if(dia>1000){
dia=dia-1000;
}else if(dia>300){
dia=dia-100;
}else if(dia>150){
dia=dia-5;
}else if(dia>5){
dia=dia-1;
}else{
System.out.println("restitution protocol finished");
System.exit(1);
}
}
}// end of else if(counter==repeats+1)
}// S1S2RESTPROTOCOL
Step step1 = new Step();
step1.step(Var,HT,time,step,Istim,out);
}// end for
try{
out.close();
}catch(IOException e){
}
}// end of start
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -