Exemple #1
0
        public void AddProperties(SpeciesType st, Compartment c, Double iA,
            Double iC, String sU, Boolean hOSU, Boolean bC, Boolean con)
        {
            this.speciesType = st;
            this.compartment = c;
            this.initialAmount = iA;
            this.initialConcentration = iC;
            this.substanceUnits = sU;
            this.hasOnlySubstanceUnits = hOSU;
            this.boundaryCondition = bC;
            this.constant = con;

            // Set an inital value based on whether we have a concentration or amount
            // Used as an optimisation in the model for boundaryCondition species
            if (this.initialAmount == -1d)
            {
                this.initialValue = this.initialConcentration;
            }
            else
            {
                this.initialValue = this.initialAmount;
            }
        }
Exemple #2
0
 public void AddProperties(CompartmentType cType, int sD, double size,
     String units, Compartment outside, Boolean constant)
 {
     this.compartmentType = cType;
     this.spatialDimensions = sD;
     this.size = size;
     this.outside = outside;
     this.constant = constant;
 }
Exemple #3
0
        public void CompartmentElement(Hashtable attrs)
        {
            Compartment compartment = new Compartment(attrs);

            CompartmentType compartmentType = null;
            int spatialDimensions = 3;
            double size = 1;
            String units = null; // unit enum or user-defined unit
            Compartment outside = null;
            Boolean constant = true;

            if (attrs.ContainsKey("constant"))
            {
                constant = Boolean.Parse((String)attrs["constant"]);
            }

            if (attrs.ContainsKey("spatialdimensions"))
            {
                spatialDimensions = (int)(Int32.Parse((String)attrs["spatialdimensions"]));
            }

            if (attrs.ContainsKey("size"))
            {
                size = (double)(double.Parse((String)attrs["size"]));
            }
            else if (attrs.ContainsKey("volume")) // from SBML Level 1
            {
                size = (double)(double.Parse((String)attrs["volume"]));
            }

            if (attrs.ContainsKey("units") && this.model.IsUnits((String)attrs["units"]))
            {
                units = (String)attrs["units"];
            }
            else
            {
                switch (spatialDimensions)
                {
                    case 1:
                        units = "length";
                        break;
                    case 2:
                        units = "area";
                        break;
                    case 3:
                        units = "volume";
                        break;
                }
            }

            if (attrs.ContainsKey("compartmenttype"))
            {
                String cTypeId = (String)attrs["compartmenttype"];
                compartmentType = (CompartmentType)this.model.findObject(cTypeId);
            }
            if (attrs.ContainsKey("outside"))
            {
                String cId = (String)attrs["outside"];
                outside = (Compartment)this.model.findObject(cId);
            }

            compartment.AddProperties(compartmentType, spatialDimensions, size,
                units, outside, constant);
            if (compartment.ID != null)
            {
                this.model.AddId(compartment.ID, compartment);
            }

            this.model.listOfCompartments.Add(compartment);
        }