/* * This code is generated by BioUML FrameWork * for BIOMD0000000090.xml diagram at 2008.03.20 15:08:20 */ import biouml.plugins.simulation.ae.NewtonSolver; import biouml.plugins.simulation.java.JavaBaseModel; import ru.biosoft.math.MathRoutines; public class BIOMD0000000090 extends JavaBaseModel { /* * Write rules to calculate equation parameters */ private void __internalVarInitFunc_0(double time, double[] x) { _c0_c1_A2c_ = Ac - x[0]; _c0_c1_c2_A2m_ = Am - x[3]; c0_c1_N1 = N - x[11]; c0_c1_c2_S2 = S - x[12]; } /* * Write rules to calculate equation parameters excluding internal variables. */ public void __internalRateVarInitFunc_0(double time, double[] x) { rate_v1 = c0*k_v0/(1 + Math.pow((x[5]/Kc), n)); rate_v10 = c0*k_v10; rate_v11a = c0_c1_c2*k11*x[11]*x[4]/((a*x[11] + x[4])*(1 + Math.pow((x[7]/Kh), m))); rate_v11a2 = c0_c1_c2*k11*x[11]*x[4]/((a*x[11] + x[4])*(1 + Math.pow((x[7]/Kh), m))); rate_v11b = c0_c1_c2*3*k11*x[11]*x[4]/((a*x[11] + x[4])*(1 + Math.pow((x[7]/Kh), m)))*_c0_c1_c2_A2m_/(Ka + _c0_c1_c2_A2m_); rate_v12 = c0_c1*k12*x[0]; rate_v13 = c0*k_v13; rate_v14 = c0_c1_c2*k14*x[4]; rate_v15 = c0_c1*k15*x[1]; rate_v16 = c0_c1_c2*k16*x[3]*_c0_c1_A2c_; rate_v17 = c0_c1*k17*x[7]; rate_v18 = c0_c1*k18*x[8]; rate_v2 = c0_c1*k2*x[10]*x[0]; rate_v3 = c0_c1*k3*x[2]*x[0]; rate_v4 = c0_c1*k4*x[9]*x[11]; rate_v5 = c0_c1*k5*x[7]*x[8]; rate_v6 = c0_c1*k6*x[5]; rate_v7 = c0_c1*k7*x[6]*c0_c1_N1; rate_v8 = c0_c1_c2*k8*x[1]*c0_c1_c2_S2; rate_v9 = c0_c1_c2*k9*x[12]*c0_c1_N1; rate_vLEAK = 0; } public void Init() { initialValues = getInitialValues(); /* * Initialize variables */ _c0_c1_A2c_ = 0.5; // initial value of $"c0.c1.A2c" _c0_c1_c2_A2m_ = 0.5; // initial value of $"c0.c1.c2.A2m" c0 = 1.0; // initial value of $c0 c0_c1 = 1.0; // initial value of $c0.c1 c0_c1_c2 = 1.0; // initial value of $c0.c1.c2 c0_c1_c2_S2 = 0.5; // initial value of $c0.c1.c2.S2 Ac = 2.0; // initial value of Ac Am = 2.0; // initial value of Am Ka = 1.0; // initial value of Ka Kc = 0.1; // initial value of Kc Kh = 0.5; // initial value of Kh N = 2.0; // initial value of N S = 2.0; // initial value of S a = 0.1; // initial value of a k11 = 10.0; // initial value of k11 k12 = 5.0; // initial value of k12 k14 = 10.0; // initial value of k14 k15 = 5.0; // initial value of k15 k16 = 10.0; // initial value of k16 k17 = 0.02; // initial value of k17 k18 = 1.0; // initial value of k18 k2 = 0.2; // initial value of k2 k3 = 0.2; // initial value of k3 k4 = 0.2; // initial value of k4 k5 = 0.1; // initial value of k5 k6 = 0.12; // initial value of k6 k7 = 10.0; // initial value of k7 k8 = 10.0; // initial value of k8 k9 = 10.0; // initial value of k9 k_v0 = 1.6; // initial value of k_v0 k_v10 = 80.0; // initial value of k_v10 k_v13 = 4.0; // initial value of k_v13 m = 4.0; // initial value of m n = 4.0; // initial value of n } /* * Model variables initial values */ protected double _c0_c1_A2c_; protected double _c0_c1_PPi_; protected double _c0_c1_c2_A2m_; protected double _c0_c1_c2_H2O_; protected double _c0_eth_ex_; protected double _c0_oxy_ex_; protected double _c0_sul_ex_; protected double rate_v1; protected double rate_v10; protected double rate_v11a; protected double rate_v11a2; protected double rate_v11b; protected double rate_v12; protected double rate_v13; protected double rate_v14; protected double rate_v15; protected double rate_v16; protected double rate_v17; protected double rate_v18; protected double rate_v2; protected double rate_v3; protected double rate_v4; protected double rate_v5; protected double rate_v6; protected double rate_v7; protected double rate_v8; protected double rate_v9; protected double rate_vLEAK; protected double c0; protected double c0_c1; protected double c0_c1_Ho; protected double c0_c1_N1; protected double c0_c1_c2; protected double c0_c1_c2_C1; protected double c0_c1_c2_C2; protected double c0_c1_c2_Hm; protected double c0_c1_c2_S2; protected double Ac; protected double Am; protected double Ka; protected double Kc; protected double Kh; protected double N; protected double S; protected double a; protected double k11; protected double k12; protected double k14; protected double k15; protected double k16; protected double k17; protected double k18; protected double k2; protected double k3; protected double k4; protected double k5; protected double k6; protected double k7; protected double k8; protected double k9; protected double k_v0; protected double k_v10; protected double k_v13; protected double m; protected double n; public double[] extendResult(double time,double [] x) { this.time = time; __internalVarInitFunc_0(time, x); double[] y = new double[17]; y[0] = _c0_c1_A2c_; y[1] = x[0]; y[2] = x[1]; y[3] = x[2]; y[4] = _c0_c1_c2_A2m_; y[5] = x[3]; y[6] = x[4]; y[7] = x[5]; y[8] = x[6]; y[9] = x[7]; y[10] = x[8]; y[11] = x[9]; y[12] = x[10]; y[13] = c0_c1_N1; y[14] = x[11]; y[15] = x[12]; y[16] = c0_c1_c2_S2; return y; } public double[] getInitialValues() { double [] x = new double[13]; this.time = 0.0; x[0] = 1.5; // - $"c0.c1.A3c" x[1] = 0.3; // - $"c0.c1.aco" x[2] = 0.5; // - $"c0.c1.aps" x[3] = 1.5; // - $"c0.c1.c2.A3m" x[4] = 7.0; // - $"c0.c1.c2.oxy" x[5] = 0.3; // - $"c0.c1.cys" x[6] = 4.0; // - $"c0.c1.eth" x[7] = 0.5; // - $"c0.c1.hyd" x[8] = 1.5; // - $"c0.c1.oah" x[9] = 0.4; // - $"c0.c1.pap" x[10] = 0.4; // - $"c0.c1.sul" x[11] = 2.0; // - $c0.c1.N2 x[12] = 1.5; // - $c0.c1.c2.S1 __internalVarInitFunc_0(time, x); __internalRateVarInitFunc_0(time, x); return x; } /* * code for algebraic rules calculations */ /* * end of code for algebraic rules calculations */ protected void calculateRates(double time, double[] x) { __internalVarInitFunc_0(time, x); __internalRateVarInitFunc_0(time, x); } /* * calculate dy/dt for 'BIOMD0000000090.xml' model */ public void __internalDyDt_0(double time, double [] x, double[] result) { result[0] = -rate_v12+rate_v16-rate_v2-rate_v3; result[1] = -rate_v15+rate_v7-rate_v8; result[2] = +rate_v2-rate_v3; result[3] = +rate_v11b-rate_v16; result[4] = +rate_v10-rate_v11a2-rate_v14; result[5] = +rate_v5-rate_v6; result[6] = +rate_v13-rate_v7; result[7] = -rate_v17+rate_v4-rate_v5; result[8] = +rate_v15-rate_v18-rate_v5; result[9] = +rate_v3-rate_v4; result[10] = +rate_v1-rate_v2; result[11] = -rate_v11a-rate_v4*3+rate_v7*2+rate_v9*4; result[12] = +rate_v8-rate_v9; } protected double [] calculateResult(double time, double[] x) { double[] result = new double[13]; __internalDyDt_0(time, x, result); return result; } public double[] dy_dt(double time, double[] x) { this.time = time; calculateRates( time,x ); return calculateResult( time,x ); } } // class ...