/*
 * This code is generated by BioUML FrameWork 
 * for BIOMD0000000087.xml diagram  at 2008.03.20 15:08:08
 */
import biouml.plugins.simulation.ae.NewtonSolver;
import biouml.plugins.simulation.java.JavaBaseModel;
import ru.biosoft.math.MathRoutines;

public class BIOMD0000000087 extends JavaBaseModel
{

/*
 * Write rules to calculate equation parameters
 */


/*
 * Write rules to calculate equation parameters excluding internal variables.
 */
    public void __internalRateVarInitFunc_0(double time, double[] x)
    {
        rate_Capping = Capping_k1*x[3]*x[51]*kalive;
        rate_Chk1Activation = x[5]*Chk1Activation_k12*x[42]*kalive;
        rate_Chk1cellArrest = x[4]*x[23]*Chk1cellArrest_k15*kalive;
        rate_Dun1activation = x[8]*Dun1activation_k14*x[40]*kalive;
        rate_Dun1cellArrest = x[7]*x[23]*Dun1cellArrest_k16*kalive;
        rate_Exo1Rad17dependentActivity = Exo1Rad17dependentActivity_k7b*x[38]*x[9]*kalive;
        rate_Exo1Rad17independentActivity = Exo1Rad17independentActivity_k7a*x[51]*x[9]*kalive;
        rate_Exo1Rad24dependentActivation = Exo1Rad24dependentActivation_k6b*x[10]*x[39]*kalive;
        rate_Exo1activation = Exo1activation_k6a*x[10]*kalive;
        rate_Exo1inhibition = x[9]*Exo1inhibition_k13*x[40]*kalive;
        rate_ExoXactivation = ExoXactivation_k4*x[12]*x[38]*kalive;
        rate_ExoXactivity = ExoXactivity_k5*x[11]*x[38]*kalive;
        rate_ExoXinhibition = x[11]*ExoXinhibition_k10a*x[42]*kalive;
        rate_ExoXinhibition2 = x[11]*ExoXinhibition2_k10b*x[43]*kalive;
        rate_G1cyclinDegradation = x[18]*G1cyclinDegradation_kc3*kalive;
        rate_G1cyclinSynthesis = x[13]*G1cyclinSynthesis_kc1*kalive;
        rate_G1toSGenesOn = x[13]*x[14]*x[16]*G1toSGenesOn_kc2*kalive;
        rate_G1toSProgession = x[13]*x[14]*x[17]*G1toSProgession_kc4*kalive;
        rate_G2DNArepair1 = x[19]*x[22]*G2DNArepair1_k17b*x[32]*kalive;
        rate_G2DNArepair2 = x[19]*x[22]*G2DNArepair2_k18b*x[53]*kalive;
        rate_G2cyclinDegradation = x[24]*G2cyclinDegradation_kc3*kalive;
        rate_G2cyclinSynthesis = x[19]*G2cyclinSynthesis_kc1*kalive;
        rate_G2toMGenesOn = x[19]*x[20]*x[22]*G2toMGenesOn_kc2*kalive;
        rate_G2toMProgession = x[19]*x[20]*x[23]*G2toMProgession_kc4*kalive;
        rate_McyclinDegradation = McyclinDegradation_kc3*x[30]*kalive;
        rate_McyclinSynthesis = McyclinSynthesis_kc1*x[25]*kalive;
        rate_Mec1binding = Mec1binding_k8d*x[34]*x[31]*kalive;
        rate_MtoG1GenesOn = MtoG1GenesOn_kc2*x[25]*x[26]*x[28]*kalive;
        rate_MtoG1Progession = MtoG1Progession_kc4*x[25]*x[26]*x[29]*kalive;
        rate_RPAbinding = RPAbinding_k8c*x[36]*x[53]*kalive;
        rate_RPAbinding1 = RPAbinding1_k8a*x[33]*x[53]*kalive;
        rate_RPAbinding2 = RPAbinding2_k8b*x[35]*x[53]*kalive;
        rate_Rad17binding = Rad17binding_k3*x[51]*x[37]*x[39]*x[2]*kalive/(5000 + x[2]);
        rate_Rad53activation = Rad53activation_k11*x[41]*x[42]*kalive;
        rate_Rad9activation = Rad9activation_k9*x[44]*x[43]*kalive;
        rate_Recovery = x[3]*Recovery_k19*x[38]*x[52]*kalive;
        rate_SDNArepair1 = SDNArepair1_k17a*x[32]*x[45]*kalive;
        rate_SDNArepair2 = SDNArepair2_k18a*x[45]*x[53]*kalive;
        rate_ScyclinDegradation = ScyclinDegradation_kc3*x[50]*kalive;
        rate_ScyclinSynthesis = ScyclinSynthesis_kc1*x[45]*kalive;
    }
    public void __internalRateVarInitFunc_1(double time, double[] x)
    {
        rate_StoG2GenesOn = StoG2GenesOn_kc2*x[45]*x[46]*x[48]*kalive;
        rate_StoG2Progession = StoG2Progession_kc4*x[45]*x[46]*x[49]*kalive;
        rate_Uncapping = Uncapping_k2*x[6]*kalive;
    }

    public void Init()
    {
        initialValues = getInitialValues();
/*
 * Initialize variables
 */
        Capping_k1 = 5.0E-4; // initial value of Capping_k1
        Chk1Activation_k12 = 1.7E-4; // initial value of Chk1Activation_k12
        Chk1cellArrest_k15 = 0.2; // initial value of Chk1cellArrest_k15
        Dun1activation_k14 = 3.3E-6; // initial value of Dun1activation_k14
        Dun1cellArrest_k16 = 0.1; // initial value of Dun1cellArrest_k16
        Exo1Rad17dependentActivity_k7b = 3.0E-5; // initial value of Exo1Rad17dependentActivity_k7b
        Exo1Rad17independentActivity_k7a = 3.0E-5; // initial value of Exo1Rad17independentActivity_k7a
        Exo1Rad24dependentActivation_k6b = 5.0E-4; // initial value of Exo1Rad24dependentActivation_k6b
        Exo1activation_k6a = 5.0E-5; // initial value of Exo1activation_k6a
        Exo1inhibition_k13 = 1.0; // initial value of Exo1inhibition_k13
        ExoXactivation_k4 = 0.01; // initial value of ExoXactivation_k4
        ExoXactivity_k5 = 3.0E-4; // initial value of ExoXactivity_k5
        ExoXinhibition2_k10b = 0.05; // initial value of ExoXinhibition2_k10b
        ExoXinhibition_k10a = 0.05; // initial value of ExoXinhibition_k10a
        G1cyclinDegradation_kc3 = 0.0012; // initial value of G1cyclinDegradation_kc3
        G1cyclinSynthesis_kc1 = 0.16; // initial value of G1cyclinSynthesis_kc1
        G1toSGenesOn_kc2 = 0.01; // initial value of G1toSGenesOn_kc2
        G1toSProgession_kc4 = 0.01; // initial value of G1toSProgession_kc4
        G2DNArepair1_k17b = 0.05; // initial value of G2DNArepair1_k17b
        G2DNArepair2_k18b = 1.0E-5; // initial value of G2DNArepair2_k18b
        G2cyclinDegradation_kc3 = 0.0012; // initial value of G2cyclinDegradation_kc3
        G2cyclinSynthesis_kc1 = 0.16; // initial value of G2cyclinSynthesis_kc1
        G2toMGenesOn_kc2 = 0.01; // initial value of G2toMGenesOn_kc2
        G2toMProgession_kc4 = 0.01; // initial value of G2toMProgession_kc4
        McyclinDegradation_kc3 = 0.0012; // initial value of McyclinDegradation_kc3
        McyclinSynthesis_kc1 = 0.16; // initial value of McyclinSynthesis_kc1
        Mec1binding_k8d = 0.0040; // initial value of Mec1binding_k8d
        MtoG1GenesOn_kc2 = 0.01; // initial value of MtoG1GenesOn_kc2
        MtoG1Progession_kc4 = 0.01; // initial value of MtoG1Progession_kc4
        RPAbinding1_k8a = 0.0010; // initial value of RPAbinding1_k8a
        RPAbinding2_k8b = 100.0; // initial value of RPAbinding2_k8b
        RPAbinding_k8c = 100.0; // initial value of RPAbinding_k8c
        Rad17binding_k3 = 1.5E-8; // initial value of Rad17binding_k3
        Rad53activation_k11 = 1.0E-5; // initial value of Rad53activation_k11
        Rad9activation_k9 = 100.0; // initial value of Rad9activation_k9
        Recovery_k19 = 0.0010; // initial value of Recovery_k19
        SDNArepair1_k17a = 0.05; // initial value of SDNArepair1_k17a
        SDNArepair2_k18a = 0.0010; // initial value of SDNArepair2_k18a
        ScyclinDegradation_kc3 = 0.0012; // initial value of ScyclinDegradation_kc3
        ScyclinSynthesis_kc1 = 0.16; // initial value of ScyclinSynthesis_kc1
        StoG2GenesOn_kc2 = 0.01; // initial value of StoG2GenesOn_kc2
        StoG2Progession_kc4 = 0.01; // initial value of StoG2Progession_kc4
        Uncapping_k2 = 3.85E-4; // initial value of Uncapping_k2
        kalive = 1.0; // initial value of kalive
    }

    /*
     * Model variables initial values
     */
    protected double _cellMembrane_nucleus_sink_;
    protected double rate_Capping;
    protected double rate_Chk1Activation;
    protected double rate_Chk1cellArrest;
    protected double rate_Dun1activation;
    protected double rate_Dun1cellArrest;
    protected double rate_Exo1Rad17dependentActivity;
    protected double rate_Exo1Rad17independentActivity;
    protected double rate_Exo1Rad24dependentActivation;
    protected double rate_Exo1activation;
    protected double rate_Exo1inhibition;
    protected double rate_ExoXactivation;
    protected double rate_ExoXactivity;
    protected double rate_ExoXinhibition;
    protected double rate_ExoXinhibition2;
    protected double rate_G1cyclinDegradation;
    protected double rate_G1cyclinSynthesis;
    protected double rate_G1toSGenesOn;
    protected double rate_G1toSProgession;
    protected double rate_G2DNArepair1;
    protected double rate_G2DNArepair2;
    protected double rate_G2cyclinDegradation;
    protected double rate_G2cyclinSynthesis;
    protected double rate_G2toMGenesOn;
    protected double rate_G2toMProgession;
    protected double rate_McyclinDegradation;
    protected double rate_McyclinSynthesis;
    protected double rate_Mec1binding;
    protected double rate_MtoG1GenesOn;
    protected double rate_MtoG1Progession;
    protected double rate_RPAbinding;
    protected double rate_RPAbinding1;
    protected double rate_RPAbinding2;
    protected double rate_Rad17binding;
    protected double rate_Rad53activation;
    protected double rate_Rad9activation;
    protected double rate_Recovery;
    protected double rate_SDNArepair1;
    protected double rate_SDNArepair2;
    protected double rate_ScyclinDegradation;
    protected double rate_ScyclinSynthesis;
    protected double rate_StoG2GenesOn;
    protected double rate_StoG2Progession;
    protected double rate_Uncapping;
    protected double Capping_k1;
    protected double Chk1Activation_k12;
    protected double Chk1cellArrest_k15;
    protected double Dun1activation_k14;
    protected double Dun1cellArrest_k16;
    protected double Exo1Rad17dependentActivity_k7b;
    protected double Exo1Rad17independentActivity_k7a;
    protected double Exo1Rad24dependentActivation_k6b;
    protected double Exo1activation_k6a;
    protected double Exo1inhibition_k13;
    protected double ExoXactivation_k4;
    protected double ExoXactivity_k5;
    protected double ExoXinhibition2_k10b;
    protected double ExoXinhibition_k10a;
    protected double G1cyclinDegradation_kc3;
    protected double G1cyclinSynthesis_kc1;
    protected double G1toSGenesOn_kc2;
    protected double G1toSProgession_kc4;
    protected double G2DNArepair1_k17b;
    protected double G2DNArepair2_k18b;
    protected double G2cyclinDegradation_kc3;
    protected double G2cyclinSynthesis_kc1;
    protected double G2toMGenesOn_kc2;
    protected double G2toMProgession_kc4;
    protected double McyclinDegradation_kc3;
    protected double McyclinSynthesis_kc1;
    protected double Mec1binding_k8d;
    protected double MtoG1GenesOn_kc2;
    protected double MtoG1Progession_kc4;
    protected double RPAbinding1_k8a;
    protected double RPAbinding2_k8b;
    protected double RPAbinding_k8c;
    protected double Rad17binding_k3;
    protected double Rad53activation_k11;
    protected double Rad9activation_k9;
    protected double Recovery_k19;
    protected double SDNArepair1_k17a;
    protected double SDNArepair2_k18a;
    protected double ScyclinDegradation_kc3;
    protected double ScyclinSynthesis_kc1;
    protected double StoG2GenesOn_kc2;
    protected double StoG2Progession_kc4;
    protected double Uncapping_k2;
    protected double kalive;

    public double[] extendResult(double time,double [] x)
    {
        this.time = time;


        double[] y = new double[55];
        y[0] = x[0];
        y[1] = x[1];
        y[2] = x[2];
        y[3] = x[3];
        y[4] = x[4];
        y[5] = x[5];
        y[6] = x[6];
        y[7] = x[7];
        y[8] = x[8];
        y[9] = x[9];
        y[10] = x[10];
        y[11] = x[11];
        y[12] = x[12];
        y[13] = x[13];
        y[14] = x[14];
        y[15] = x[15];
        y[16] = x[16];
        y[17] = x[17];
        y[18] = x[18];
        y[19] = x[19];
        y[20] = x[20];
        y[21] = x[21];
        y[22] = x[22];
        y[23] = x[23];
        y[24] = x[24];
        y[25] = x[25];
        y[26] = x[26];
        y[27] = x[27];
        y[28] = x[28];
        y[29] = x[29];
        y[30] = x[30];
        y[31] = x[31];
        y[32] = x[32];
        y[33] = x[33];
        y[34] = x[34];
        y[35] = x[35];
        y[36] = x[36];
        y[37] = x[37];
        y[38] = x[38];
        y[39] = x[39];
        y[40] = x[40];
        y[41] = x[41];
        y[42] = x[42];
        y[43] = x[43];
        y[44] = x[44];
        y[45] = x[45];
        y[46] = x[46];
        y[47] = x[47];
        y[48] = x[48];
        y[49] = x[49];
        y[50] = x[50];
        y[51] = x[51];
        y[52] = x[52];
        y[53] = x[53];
        y[54] = kalive;
        return y;
    }
    public double[] getInitialValues()
    {
        double [] x = new double[54];
        this.time = 0.0;
        x[0] = 0.0; // - $"cellMembrane.budscar"
        x[1] = 1000.0; // - $"cellMembrane.nucleus.ADP"
        x[2] = 10000.0; // - $"cellMembrane.nucleus.ATP"
        x[3] = 300.0; // - $"cellMembrane.nucleus.Cdc13"
        x[4] = 0.0; // - $"cellMembrane.nucleus.Chk1A"
        x[5] = 60.0; // - $"cellMembrane.nucleus.Chk1I"
        x[6] = 64.0; // - $"cellMembrane.nucleus.Ctelo"
        x[7] = 0.0; // - $"cellMembrane.nucleus.Dun1A"
        x[8] = 3000.0; // - $"cellMembrane.nucleus.Dun1I"
        x[9] = 0.0; // - $"cellMembrane.nucleus.Exo1A"
        x[10] = 670.0; // - $"cellMembrane.nucleus.Exo1I"
        x[11] = 0.0; // - $"cellMembrane.nucleus.ExoXA"
        x[12] = 70.0; // - $"cellMembrane.nucleus.ExoXI"
        x[13] = 1.0; // - $"cellMembrane.nucleus.G1"
        x[14] = 0.0; // - $"cellMembrane.nucleus.G1CdkA"
        x[15] = 1.0; // - $"cellMembrane.nucleus.G1CdkI"
        x[16] = 1.0; // - $"cellMembrane.nucleus.G1Soff"
        x[17] = 0.0; // - $"cellMembrane.nucleus.G1Son"
        x[18] = 0.0; // - $"cellMembrane.nucleus.G1cyclin"
        x[19] = 0.0; // - $"cellMembrane.nucleus.G2"
        x[20] = 0.0; // - $"cellMembrane.nucleus.G2CdkA"
        x[21] = 1.0; // - $"cellMembrane.nucleus.G2CdkI"
        x[22] = 1.0; // - $"cellMembrane.nucleus.G2Moff"
        x[23] = 0.0; // - $"cellMembrane.nucleus.G2Mon"
        x[24] = 0.0; // - $"cellMembrane.nucleus.G2cyclin"
        x[25] = 0.0; // - $"cellMembrane.nucleus.M"
        x[26] = 0.0; // - $"cellMembrane.nucleus.MCdkA"
        x[27] = 1.0; // - $"cellMembrane.nucleus.MCdkI"
        x[28] = 1.0; // - $"cellMembrane.nucleus.MG1off"
        x[29] = 0.0; // - $"cellMembrane.nucleus.MG1on"
        x[30] = 0.0; // - $"cellMembrane.nucleus.Mcyclin"
        x[31] = 4000.0; // - $"cellMembrane.nucleus.Mec1"
        x[32] = 0.0; // - $"cellMembrane.nucleus.Mec1RPAssDNA"
        x[33] = 4000.0; // - $"cellMembrane.nucleus.RPA"
        x[34] = 0.0; // - $"cellMembrane.nucleus.RPAssDNA"
        x[35] = 0.0; // - $"cellMembrane.nucleus.RPAssDNA1"
        x[36] = 0.0; // - $"cellMembrane.nucleus.RPAssDNA2"
        x[37] = 70.0; // - $"cellMembrane.nucleus.Rad17"
        x[38] = 0.0; // - $"cellMembrane.nucleus.Rad17Utelo"
        x[39] = 70.0; // - $"cellMembrane.nucleus.Rad24"
        x[40] = 0.0; // - $"cellMembrane.nucleus.Rad53A"
        x[41] = 6900.0; // - $"cellMembrane.nucleus.Rad53I"
        x[42] = 0.0; // - $"cellMembrane.nucleus.Rad9A"
        x[43] = 20.0; // - $"cellMembrane.nucleus.Rad9I"
        x[44] = 0.0; // - $"cellMembrane.nucleus.Rad9Kin"
        x[45] = 0.0; // - $"cellMembrane.nucleus.S"
        x[46] = 0.0; // - $"cellMembrane.nucleus.SCdkA"
        x[47] = 1.0; // - $"cellMembrane.nucleus.SCdkI"
        x[48] = 1.0; // - $"cellMembrane.nucleus.SG2off"
        x[49] = 0.0; // - $"cellMembrane.nucleus.SG2on"
        x[50] = 0.0; // - $"cellMembrane.nucleus.Scyclin"
        x[51] = 0.0; // - $"cellMembrane.nucleus.Utelo"
        x[52] = 0.0; // - $"cellMembrane.nucleus.recovery"
        x[53] = 0.0; // - $"cellMembrane.nucleus.ssDNA"

        __internalRateVarInitFunc_0(time, x);
        __internalRateVarInitFunc_1(time, x);

        return x;
    }

/*
 * code for algebraic rules calculations
 */

/*
 * end of code for algebraic rules calculations
 */

    protected void calculateRates(double time, double[] x)
    {

        __internalRateVarInitFunc_0(time, x);
        __internalRateVarInitFunc_1(time, x);

    }

        /*
         * calculate dy/dt for 'BIOMD0000000087.xml' model
         */
    public void __internalDyDt_0(double time, double [] x, double[] result)
    {
        result[0] = +rate_MtoG1Progession;
        result[1] = +rate_Rad17binding;
        result[2] = -rate_Rad17binding;
        result[3] = -rate_Capping-rate_Recovery+rate_Uncapping;
        result[4] = +rate_Chk1Activation+rate_Chk1cellArrest-rate_Chk1cellArrest;
        result[5] = -rate_Chk1Activation;
        result[6] = +rate_Capping+rate_Recovery-rate_Uncapping;
        result[7] = +rate_Dun1activation+rate_Dun1cellArrest-rate_Dun1cellArrest;
        result[8] = -rate_Dun1activation;
        result[9] = +rate_Exo1Rad17dependentActivity-rate_Exo1Rad17dependentActivity+rate_Exo1Rad17independentActivity-rate_Exo1Rad17independentActivity+rate_Exo1Rad24dependentActivation+rate_Exo1activation-rate_Exo1inhibition;
        result[10] = -rate_Exo1Rad24dependentActivation-rate_Exo1activation+rate_Exo1inhibition;
        result[11] = +rate_ExoXactivation+rate_ExoXactivity-rate_ExoXactivity-rate_ExoXinhibition2-rate_ExoXinhibition;
        result[12] = -rate_ExoXactivation+rate_ExoXinhibition2+rate_ExoXinhibition;
        result[13] = +rate_G1cyclinSynthesis-rate_G1cyclinSynthesis+rate_G1toSGenesOn-rate_G1toSGenesOn-rate_G1toSProgession+rate_MtoG1Progession;
        result[14] = +rate_G1toSGenesOn-rate_G1toSGenesOn-rate_G1toSProgession;
        result[15] = +rate_G1toSProgession;
        result[16] = -rate_G1toSGenesOn+rate_G1toSProgession;
        result[17] = +rate_G1toSGenesOn-rate_G1toSProgession;
        result[18] = -rate_G1cyclinDegradation+rate_G1cyclinSynthesis;
        result[19] = +rate_G2DNArepair1-rate_G2DNArepair1+rate_G2DNArepair2-rate_G2DNArepair2+rate_G2cyclinSynthesis-rate_G2cyclinSynthesis+rate_G2toMGenesOn-rate_G2toMGenesOn-rate_G2toMProgession+rate_StoG2Progession;
        result[20] = +rate_G2toMGenesOn-rate_G2toMGenesOn-rate_G2toMProgession;
        result[21] = +rate_G2toMProgession;
        result[22] = +rate_Chk1cellArrest+rate_Dun1cellArrest+rate_G2DNArepair1-rate_G2DNArepair1+rate_G2DNArepair2-rate_G2DNArepair2-rate_G2toMGenesOn+rate_G2toMProgession;
        result[23] = -rate_Chk1cellArrest-rate_Dun1cellArrest+rate_G2toMGenesOn-rate_G2toMProgession;
        result[24] = -rate_G2cyclinDegradation+rate_G2cyclinSynthesis;
        result[25] = +rate_G2toMProgession+rate_McyclinSynthesis-rate_McyclinSynthesis+rate_MtoG1GenesOn-rate_MtoG1GenesOn-rate_MtoG1Progession;
        result[26] = +rate_MtoG1GenesOn-rate_MtoG1GenesOn-rate_MtoG1Progession;
        result[27] = +rate_MtoG1Progession;
        result[28] = -rate_MtoG1GenesOn+rate_MtoG1Progession;
        result[29] = +rate_MtoG1GenesOn-rate_MtoG1Progession;
        result[30] = -rate_McyclinDegradation+rate_McyclinSynthesis;
        result[31] = +rate_G2DNArepair1-rate_Mec1binding+rate_SDNArepair1;
        result[32] = -rate_G2DNArepair1+rate_Mec1binding-rate_SDNArepair1;
        result[33] = +rate_G2DNArepair1-rate_RPAbinding1+rate_SDNArepair1;
        result[34] = -rate_Mec1binding+rate_RPAbinding;
        result[35] = +rate_RPAbinding1-rate_RPAbinding2;
        result[36] = +rate_RPAbinding2-rate_RPAbinding;
        result[37] = -rate_Rad17binding+rate_Recovery;
        result[38] = +rate_Exo1Rad17dependentActivity-rate_Exo1Rad17dependentActivity+rate_ExoXactivation-rate_ExoXactivation+rate_ExoXactivity-rate_ExoXactivity+rate_Rad17binding-rate_Recovery;
        result[39] = +rate_Exo1Rad24dependentActivation-rate_Exo1Rad24dependentActivation+rate_Rad17binding-rate_Rad17binding;
        result[40] = +rate_Dun1activation-rate_Dun1activation+rate_Exo1inhibition-rate_Exo1inhibition+rate_Rad53activation;
        result[41] = -rate_Rad53activation;
        result[42] = +rate_Chk1Activation-rate_Chk1Activation+rate_ExoXinhibition-rate_ExoXinhibition+rate_Rad53activation-rate_Rad53activation+rate_Rad9activation;
        result[43] = +rate_ExoXinhibition2-rate_ExoXinhibition2-rate_Rad9activation;
        result[44] = +rate_Rad9activation-rate_Rad9activation;
        result[45] = +rate_G1toSProgession+rate_SDNArepair1-rate_SDNArepair1+rate_SDNArepair2-rate_SDNArepair2+rate_ScyclinSynthesis-rate_ScyclinSynthesis+rate_StoG2GenesOn-rate_StoG2GenesOn-rate_StoG2Progession;
        result[46] = +rate_StoG2GenesOn-rate_StoG2GenesOn-rate_StoG2Progession;
        result[47] = +rate_StoG2Progession;
        result[48] = -rate_StoG2GenesOn+rate_StoG2Progession;
        result[49] = +rate_StoG2GenesOn-rate_StoG2Progession;
        result[50] = -rate_ScyclinDegradation+rate_ScyclinSynthesis;
        result[51] = -rate_Capping+rate_Exo1Rad17independentActivity-rate_Exo1Rad17independentActivity-rate_Rad17binding+rate_Uncapping;
        result[52] = +rate_Recovery-rate_Recovery;
        result[53] = +rate_Exo1Rad17dependentActivity+rate_Exo1Rad17independentActivity+rate_ExoXactivity+rate_G2DNArepair1*3-rate_G2DNArepair2-rate_RPAbinding1-rate_RPAbinding2-rate_RPAbinding+rate_SDNArepair1*3-rate_SDNArepair2;
    }
    protected double [] calculateResult(double time, double[] x)
    {
        double[] result = new double[54];
        __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 );
    }

    public double[] checkEvent(double time, double[] x)
    {
        this.time = time;

        __internalRateVarInitFunc_0(time, x);
        __internalRateVarInitFunc_1(time, x);

        double [] flags = new double[9];
        flags[0] = (x[32] + x[34] + x[53] >= 2000) ? +1 : -1; //CellDeath
        flags[1] = (x[18] > 100) ? +1 : -1; //G1CdkActivation
        flags[2] = (x[24] > 100) ? +1 : -1; //G2CdkActivation
        flags[3] = (x[19] == 1 && x[38] == 0) ? +1 : -1; //G2MRecoveryCompleted
        flags[4] = (x[30] > 100) ? +1 : -1; //MCdkActivation
        flags[5] = (x[32] >= 800) ? +1 : -1; //Rad9KinaseActivation
        flags[6] = (x[50] > 100) ? +1 : -1; //SCdkActivation
        flags[7] = (x[38] == 0) ? +1 : -1; //SphaseRecoveryCompleted
        flags[8] = (x[32] + x[34] + x[53] <= 1) ? +1 : -1; //ssDNAremoval
        return flags;
    }

    public void processEvent(int __internalVar12060040885150, double time, double[] x)
    {
        this.time = time;
        if ( __internalVar12060040885150 == 0) //CellDeath
        {
            kalive = 0;
        } else if ( __internalVar12060040885150 == 1) //G1CdkActivation
        {
            x[14] = 1;
            x[15] = 0;
        } else if ( __internalVar12060040885150 == 2) //G2CdkActivation
        {
            x[20] = 1;
            x[21] = 0;
        } else if ( __internalVar12060040885150 == 3) //G2MRecoveryCompleted
        {
            x[23] = 1;
            x[22] = 0;
            x[52] = 0;
            x[42] = 0;
            x[43] = 20;
            x[4] = 0;
            x[5] = 60;
            x[7] = 0;
            x[8] = 3000;
            x[9] = 0;
            x[10] = 670;
            x[11] = 0;
            x[12] = 70;
            x[41] = 6900;
            x[40] = 0;
        } else if ( __internalVar12060040885150 == 4) //MCdkActivation
        {
            x[26] = 1;
            x[27] = 0;
        } else if ( __internalVar12060040885150 == 5) //Rad9KinaseActivation
        {
            x[44] = 1;
        } else if ( __internalVar12060040885150 == 6) //SCdkActivation
        {
            x[46] = 1;
            x[47] = 0;
        } else if ( __internalVar12060040885150 == 7) //SphaseRecoveryCompleted
        {
            x[52] = 0;
        } else if ( __internalVar12060040885150 == 8) //ssDNAremoval
        {
            x[52] = 1;
            x[32] = 0;
            x[34] = 0;
            x[53] = 0;
        }
    }

} // class ...