Template:Team:Paris Saclay/simbox

From 2013.igem.org

(Difference between revisions)
Line 30: Line 30:
  this.molecules= Array();
  this.molecules= Array();
  this.running= false;
  this.running= false;
-
  this.refresh_interval= 100;
+
  this.refresh_run_time= 50;
-
  this.refresh_min_interval= 50;
+
  this.refresh_interval= 50;
  this.timeout= null;
  this.timeout= null;
}
}
Line 199: Line 199:
  var time1= tmpdate.getTime();
  var time1= tmpdate.getTime();
-
  simulations[simid].molecules[2].quantity += 10;
+
  while(tmpdate.getTime() - time1 < simulations[simid].refresh_run_time)
 +
  simulation_step(simid);
   
   
  simbox_update_controls(simid);
  simbox_update_controls(simid);
-
  var dtime= tmpdate.getTime() - time1;
+
  simulations[simid].timeout= setTimeout(function() {simbox_refresh(simid);}, refresh_run_time);
-
var reswait= null;
+
}
-
if(simulations[simid].refresh_interval - dtime < simulations[simid].refresh_min_interval)
+
 
-
  reswait= simulations[simid].refresh_min_interval;
+
function simulation_step(simid)
-
  else
+
{
-
  reswait= simulations[simid].refresh_interval - dtime;
+
  simulations[simid].molecules[2].value += 1;
-
simulations[simid].timeout= setTimeout(function() {simbox_refresh(simid);}, reswait);
+
}
}

Revision as of 22:39, 2 August 2013