예제 #1
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="process"></param>
 /// <returns></returns>
 public static EcellProcess PingPongBiBiFlux2Expression(EcellProcess process)
 {
     EcellProcess newProcess = new EcellProcess(process.ModelID, process.Key, process.Type, ProcessConstants.ExpressionFluxProcess, new List<EcellData>());
     newProcess.ReferenceList = process.ReferenceList;
     newProcess.SetEcellValue("KcF", process.GetEcellValue("KcF"));
     newProcess.SetEcellValue("KcR", process.GetEcellValue("KcR"));
     newProcess.SetEcellValue("Keq", process.GetEcellValue("Keq"));
     newProcess.SetEcellValue("KmS0", process.GetEcellValue("KmS0"));
     newProcess.SetEcellValue("KmS1", process.GetEcellValue("KmS1"));
     newProcess.SetEcellValue("KmP0", process.GetEcellValue("KmP0"));
     newProcess.SetEcellValue("KmP1", process.GetEcellValue("KmP1"));
     newProcess.SetEcellValue("KiS0", process.GetEcellValue("KiS0"));
     newProcess.SetEcellValue("KiP1", process.GetEcellValue("KiP1"));
     newProcess.Expression = "( KcF * KcR * C0.Value * ( S0.MolarConc * S1.MolarConc - P0.MolarConc * P1.MolarConc / Keq ) ) / ( KcR * KmS1 * S0.MolarConc + KcR * KmS0 * S1.MolarConc + KmP1 * P0.MolarConc * KcF / Keq + KmP0 * P1.MolarConc * KcF / Keq + KcR * S0.MolarConc * S1.MolarConc + KmP1 * S0.MolarConc * P0.MolarConc * KcF / Keq / KiS0 + P0.MolarConc * P1.MolarConc * KcF / Keq + KcR * KmS0 * S1.MolarConc * P1.MolarConc / KiP1 )";
     newProcess.Layout = process.Layout;
     return newProcess;
 }
예제 #2
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="process"></param>
 /// <returns></returns>
 public static EcellProcess MassAction2Expression(EcellProcess process)
 {
     EcellProcess newProcess = new EcellProcess(process.ModelID, process.Key, process.Type, ProcessConstants.ExpressionFluxProcess, new List<EcellData>());
     newProcess.ReferenceList = process.ReferenceList;
     newProcess.SetEcellValue("k", process.GetEcellValue("k"));
     newProcess.Expression = "k * S0.Value";
     newProcess.Layout = process.Layout;
     return newProcess;
 }
예제 #3
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="process"></param>
 /// <returns></returns>
 public static EcellProcess MichaelisUniUniFlux2Expression(EcellProcess process)
 {
     EcellProcess newProcess = new EcellProcess(process.ModelID, process.Key, process.Type, ProcessConstants.ExpressionFluxProcess, new List<EcellData>());
     newProcess.ReferenceList = process.ReferenceList;
     newProcess.SetEcellValue("KmS", process.GetEcellValue("KmS"));
     newProcess.SetEcellValue("KmP", process.GetEcellValue("KmP"));
     newProcess.SetEcellValue("KcF", process.GetEcellValue("KcF"));
     newProcess.SetEcellValue("KcR", process.GetEcellValue("KcR"));
     newProcess.Expression = "( ( KcF * KmP * S0.MolerConc - KcR * KmS * P0.MolerConc ) * C0.Value ) / ( KmS * P0.MolerConc + KmP * S0.MolerConc + KmS * KmP )";
     newProcess.Layout = process.Layout;
     return newProcess;
 }
예제 #4
0
        public void TestGetImageIndex_EcellObject()
        {
            EcellObject obj = null;
            int expectedInt32 = -1;
            int resultInt32 = 0;
            resultInt32 = _unitUnderTest.GetImageIndex(obj);
            Assert.AreEqual(expectedInt32, resultInt32, "GetImageIndex method returned unexpected result.");

            obj = new EcellProject("", "", "", "", new List<EcellData>());
            expectedInt32 = 0;
            resultInt32 = 0;
            resultInt32 = _unitUnderTest.GetImageIndex(obj);
            Assert.AreEqual(expectedInt32, resultInt32, "GetImageIndex method returned unexpected result.");

            obj = new EcellModel("", "", "", "", new List<EcellData>());
            expectedInt32 = 1;
            resultInt32 = 0;
            resultInt32 = _unitUnderTest.GetImageIndex(obj);
            Assert.AreEqual(expectedInt32, resultInt32, "GetImageIndex method returned unexpected result.");

            obj = new EcellSystem("", "", "", "", new List<EcellData>());
            expectedInt32 = 2;
            resultInt32 = 0;
            resultInt32 = _unitUnderTest.GetImageIndex(obj);
            Assert.AreEqual(expectedInt32, resultInt32, "GetImageIndex method returned unexpected result.");

            obj = new EcellProcess("", "", "", "", new List<EcellData>());
            expectedInt32 = 3;
            resultInt32 = 0;
            resultInt32 = _unitUnderTest.GetImageIndex(obj);
            Assert.AreEqual(expectedInt32, resultInt32, "GetImageIndex method returned unexpected result.");

            obj = new EcellVariable("", "", "", "", new List<EcellData>());
            expectedInt32 = 4;
            resultInt32 = 0;
            resultInt32 = _unitUnderTest.GetImageIndex(obj);
            Assert.AreEqual(expectedInt32, resultInt32, "GetImageIndex method returned unexpected result.");

            obj = new EcellText("", "/:Text", "", "", new List<EcellData>());
            expectedInt32 = 10;
            resultInt32 = 0;
            resultInt32 = _unitUnderTest.GetImageIndex(obj);
            Assert.AreEqual(expectedInt32, resultInt32, "GetImageIndex method returned unexpected result.");

            obj = new EcellStepper("", "", "", "", new List<EcellData>());
            expectedInt32 = 11;
            resultInt32 = 0;
            resultInt32 = _unitUnderTest.GetImageIndex(obj);
            Assert.AreEqual(expectedInt32, resultInt32, "GetImageIndex method returned unexpected result.");

            obj.Layout.Figure = "System";
            expectedInt32 = 2;
            resultInt32 = 0;
            resultInt32 = _unitUnderTest.GetImageIndex(obj);
            Assert.AreEqual(expectedInt32, resultInt32, "GetImageIndex method returned unexpected result.");
        }
예제 #5
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="process"></param>
 /// <returns></returns>
 public static EcellProcess DecayFlux2Expression(EcellProcess process)
 {
     EcellProcess newProcess = new EcellProcess(process.ModelID, process.Key, process.Type, ProcessConstants.ExpressionFluxProcess, new List<EcellData>());
     newProcess.ReferenceList = process.ReferenceList;
     newProcess.SetEcellValue("T", process.GetEcellValue("T"));
     newProcess.Expression = "( log ( 2 ) ) / ( T ) * S0.Value";
     newProcess.Layout = process.Layout;
     return newProcess;
 }
예제 #6
0
        /// <summary>
        /// Returns the new "EcellObject" instance with initialized arguments.
        /// </summary>
        /// <param name="modelID">The model ID</param>
        /// <param name="key">The key</param>
        /// <param name="type">The type</param>
        /// <param name="classname">The class</param>
        /// <param name="data">The data</param>
        /// <returns>The new "EcellObject" instance</returns>
        public static EcellObject CreateObject(string modelID, string key,
            string type, string classname, List<EcellData> data)
        {
            //if (string.IsNullOrEmpty(modelID))
            //    throw new EcellException(string.Format(MessageResources.ErrInvalidParam, MODEL));
            if (Util.IsNGforType(type))
                throw new EcellException(string.Format(MessageResources.ErrInvalidParam, TYPE));

            EcellObject obj = null;
            if (type.Equals(MODEL))
                obj = new EcellModel(modelID, key, type, classname, data);
            else if (type.Equals(PROCESS))
                obj = new EcellProcess(modelID, key, type, classname, data);
            else if (type.Equals(VARIABLE))
                obj = new EcellVariable(modelID, key, type, classname, data);
            else if (type.Equals(SYSTEM))
                obj = new EcellSystem(modelID, key, type, classname, data);
            else if (type.Equals(TEXT))
                obj = new EcellText(modelID, key, type, classname, data);
            else if (type.Equals(STEPPER))
                obj = new EcellStepper(modelID, key, type, classname, data);
            else if (type.Equals(PROJECT))
                obj = new EcellProject(modelID, key, type, classname, data);
            return obj;
        }
예제 #7
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="process"></param>
 /// <param name="variable"></param>
 /// <param name="coefficient"></param>
 public LayoutReference(EcellProcess process, EcellVariable variable, int coefficient)
 {
     _process = process;
     _variable = variable;
     _coefficient = coefficient;
 }
예제 #8
0
        public void TestRemoveValue()
        {
            EcellProcess process = new EcellProcess("Model", "/:P0", "Process", "ConstantFluxProcess", new List<EcellData>());
            string str = "((\"S1\", \"Variable:/:S1\", 1, 0), (\"S2\", \"Variable:/:S2\", 1, 1))";
            List<EcellReference> expected = EcellReference.ConvertFromString(str);
            process.ReferenceList = expected;
            Assert.AreEqual(expected, process.ReferenceList, "ReferenceList is not expected value.");

            process.RemoveEcellValue(EcellProcess.VARIABLEREFERENCELIST);
            Assert.IsNull(process.GetEcellValue(EcellProcess.VARIABLEREFERENCELIST), "GetEcellValue method returned unexpected result.");

            process.RemoveEcellValue(EcellProcess.VARIABLEREFERENCELIST);
            Assert.IsNull(process.GetEcellValue(EcellProcess.VARIABLEREFERENCELIST), "GetEcellValue method returned unexpected result.");
        }
예제 #9
0
        public void TestEquals()
        {
            bool expectedBoolean = false;
            bool resultBoolean = false;
            EcellObject obj;

            obj = new EcellProcess("Model", "/:P0", "Process", "ConstantFluxProcess", new List<EcellData>());
            expectedBoolean = false;
            resultBoolean = false;

            resultBoolean = obj.Equals(new object());
            Assert.AreEqual(expectedBoolean, resultBoolean, "Equals method returned unexpected result.");

            resultBoolean = obj.Equals(new EcellProcess("Model", "/:P1", "Process", "ConstantFluxProcess", new List<EcellData>()));
            Assert.AreEqual(expectedBoolean, resultBoolean, "Equals method returned unexpected result.");

            resultBoolean = obj.Equals(new EcellProcess("Model1", "/:P0", "Process", "ConstantFluxProcess", new List<EcellData>()));
            Assert.AreEqual(expectedBoolean, resultBoolean, "Equals method returned unexpected result.");

            resultBoolean = obj.Equals(new EcellVariable("Model", "/:P0", "Variable", "Variable", new List<EcellData>()));
            Assert.AreEqual(expectedBoolean, resultBoolean, "Equals method returned unexpected result.");

            resultBoolean = obj.Equals(new EcellSystem("Model", "/", "System", "System", new List<EcellData>()));
            Assert.AreEqual(expectedBoolean, resultBoolean, "Equals method returned unexpected result.");

            expectedBoolean = true;

            resultBoolean = obj.Equals(new EcellProcess("Model", "/:P0", "Process", "ConstantFluxProcess", new List<EcellData>()));
            Assert.AreEqual(expectedBoolean, resultBoolean, "Equals method returned unexpected result.");

            obj = new EcellVariable("Model", "/:P0", "Variable", "Variable", new List<EcellData>());
            expectedBoolean = false;
            resultBoolean = false;

            resultBoolean = obj.Equals(new object());
            Assert.AreEqual(expectedBoolean, resultBoolean, "Equals method returned unexpected result.");

            resultBoolean = obj.Equals(new EcellVariable("Model", "/:P1", "Variable", "Variable", new List<EcellData>()));
            Assert.AreEqual(expectedBoolean, resultBoolean, "Equals method returned unexpected result.");

            resultBoolean = obj.Equals(new EcellVariable("Model1", "/:P0", "Variable", "Variable", new List<EcellData>()));
            Assert.AreEqual(expectedBoolean, resultBoolean, "Equals method returned unexpected result.");

            resultBoolean = obj.Equals(new EcellProcess("Model", "/:P0", "Process", "ConstantFluxProcess", new List<EcellData>()));
            Assert.AreEqual(expectedBoolean, resultBoolean, "Equals method returned unexpected result.");

            resultBoolean = obj.Equals(new EcellSystem("Model", "/:P0", "System", "System", new List<EcellData>()));
            Assert.AreEqual(expectedBoolean, resultBoolean, "Equals method returned unexpected result.");

            expectedBoolean = true;

            resultBoolean = obj.Equals(new EcellVariable("Model", "/:P0", "Variable", "Variable", new List<EcellData>()));
            Assert.AreEqual(expectedBoolean, resultBoolean, "Equals method returned unexpected result.");

            obj = new EcellSystem("Model", "/P0", "System", "System", new List<EcellData>());
            expectedBoolean = false;
            resultBoolean = false;

            resultBoolean = obj.Equals(new object());
            Assert.AreEqual(expectedBoolean, resultBoolean, "Equals method returned unexpected result.");

            resultBoolean = obj.Equals(new EcellSystem("Model", "/P1", "System", "System", new List<EcellData>()));
            Assert.AreEqual(expectedBoolean, resultBoolean, "Equals method returned unexpected result.");

            resultBoolean = obj.Equals(new EcellSystem("Model1", "/P0", "System", "System", new List<EcellData>()));
            Assert.AreEqual(expectedBoolean, resultBoolean, "Equals method returned unexpected result.");

            resultBoolean = obj.Equals(new EcellProcess("Model", "/P0", "Process", "ConstantFluxProcess", new List<EcellData>()));
            Assert.AreEqual(expectedBoolean, resultBoolean, "Equals method returned unexpected result.");

            resultBoolean = obj.Equals(new EcellVariable("Model", "/P0", "Variable", "Variable", new List<EcellData>()));
            Assert.AreEqual(expectedBoolean, resultBoolean, "Equals method returned unexpected result.");

            expectedBoolean = true;

            resultBoolean = obj.Equals(new EcellSystem("Model", "/P0", "System", "System", new List<EcellData>()));
            Assert.AreEqual(expectedBoolean, resultBoolean, "Equals method returned unexpected result.");
        }
예제 #10
0
        public void TestEcellProcess()
        {
            EcellProcess process = new EcellProcess("Model", "/:P0", "Process", "ConstantFluxProcess", new List<EcellData>());
            Assert.AreEqual(0, process.Activity, "Activity is not expected value.");
            Assert.AreEqual(null, process.Expression, "Expression is not expected value.");
            Assert.AreEqual(0, process.IsContinuous, "IsContinuous is not expected value.");
            Assert.AreEqual(0, process.Priority, "Priority is not expected value.");
            Assert.AreEqual(null, process.StepperID, "StepperID is not expected value.");

            process.Activity = 1;
            process.Expression = "sin ( 1 )";
            process.IsContinuous = 1;
            process.Priority = 1;
            process.StepperID = "DE";

            Assert.AreEqual(1, process.Activity, "Activity is not expected value.");
            Assert.AreEqual("sin ( 1 )", process.Expression, "Expression is not expected value.");
            Assert.AreEqual(1, process.IsContinuous, "IsContinuous is not expected value.");
            Assert.AreEqual(1, process.Priority, "Priority is not expected value.");
            Assert.AreEqual("DE", process.StepperID, "StepperID is not expected value.");

            string str = "((\"S1\", \"Variable:/:S1\", 1, 0), (\"S2\", \"Variable:/:S2\", 1, 1))";
            List<EcellReference> expected = EcellReference.ConvertFromString(str);
            process.ReferenceList = expected;
            Assert.AreEqual(expected, process.ReferenceList, "ReferenceList is not expected value.");
        }