JSim v1.1
import nsrunit;
unit conversion on;
math uncatCrev
{ // Simple uncatalyzed 2nd order reversible chemical reaction model
// Solve the ordinary differential equations for the following system
//
// kf
// S1 + S2 <--> P1 + P2
// kb
//
//
// where S stands for Substrate and P for product,
// kf is forward reaction rate parameter and kb is backward reaction
// rate.
//
realDomain t sec; // time
t.min=0.0; t.max=20.0; t.delta=0.2;
real kf=1 mM^(-1)*sec^(-1), // Reaction rate parameter
kb=1 mM^(-1)*sec^(-1);
real S1(t) mM, S2(t) mM, P1(t) mM, P2(t) mM; // State Variables
// Initial Conditions
when(t=t.min) {S1 =100; S2 = 50; P1 = 0; P2 = 0; }
// Ordinary Differential Equations:
S1:t = kb*P1*P2-kf*S1*S2;
S2:t = kb*P1*P2-kf*S1*S2;
P1:t = kf*S1*S2-kb*P1*P2;
P2:t = kf*S1*S2-kb*P1*P2;
}