var cfg = { xaxis: { min:0, max:15, tickSize: 3 }, yaxis: { min:-20, max:20, show: false }, series: { lines: { lineWidth: 4, }, points: { radius: 0.1, } }, colors: ['gray'], }; function engine(element, reaction_rate_function) { var e = {}; // the engine object! e.container = $(element); var q = {}; e.reaction_rate_function = reaction_rate_function; e.quantities = q; q.temperature = { "update": function () { var old_value = this.value; this.value += reaction_rate_function(q)*timestep/1000 if (this.value < 0) { this.value = 0; } if (old_value != this.value) { return true; } }, "out": function () { e.container.find('.temp-out').html(this.value.toFixed(2)); if (this.value > q.damage_threshhold.value) { e.container.find('.damage').show();} else { e.container.find('.damage').hide(); } if (this.value < q.ignition_threshhold.value) { e.container.find('.noignition').show(); } else { e.container.find('.noignition').hide(); } for (var i=0; i