Ejemplo n.º 1
0
 public DynamicState(DynamicStateType type, EOMS eoms, Matrix <double> initialConditions)
 {
     _stateData.Add(0.0, initialConditions);
     Type = type;
     Eoms = eoms;
     //_stateDataTimeStep = stateDataTimeStep;
 }
Ejemplo n.º 2
0
        public DynamicState(XmlNode dynamicStateXMLNode)
        {
            // TODO add a line to pre-propagate to simEndTime if the type is predetermined
            // TODO catch exception if _type or initial conditions are not set from teh XML file
            if (dynamicStateXMLNode.Attributes["DynamicStateType"] != null)
            {
                string typeString = dynamicStateXMLNode.Attributes["DynamicStateType"].Value.ToString();
                Type = (DynamicStateType)Enum.Parse(typeof(DynamicStateType), typeString);
            }
            Matrix <double> ics = new Matrix <double>(dynamicStateXMLNode.Attributes["ICs"].Value.ToString());

            _stateData = new SortedList <double, Matrix <double> >();
            _stateData.Add(0.0, ics);

            if (!(Type == DynamicStateType.STATIC_LLA || Type == DynamicStateType.STATIC_ECI))
            {
                // I think this should be a constructor...  The EOMS should be some sort of delegate function which can be generated from the xml...
                string eomsType = dynamicStateXMLNode["EOMS"].GetAttribute("EOMSType");
                if (eomsType == "orbital_EOMS")
                {
                    Eoms = new OrbitalEOMS();
                }

                // Returns a null reference if INTEGRATOR is not set in XML
                XmlNode integratorNode = dynamicStateXMLNode["INTEGRATOR"];

                _integratorOptions = new IntegratorOptions();

                if (integratorNode != null)
                {
                    if (integratorNode.Attributes["h"] != null)
                    {
                        _integratorOptions.h = Convert.ToDouble(integratorNode.Attributes["h"].Value);
                    }
                    if (integratorNode.Attributes["rtol"] != null)
                    {
                        _integratorOptions.rtol = Convert.ToDouble(integratorNode.Attributes["rtol"].Value);
                    }
                    if (integratorNode.Attributes["atol"] != null)
                    {
                        _integratorOptions.atol = Convert.ToDouble(integratorNode.Attributes["atol"].Value);
                    }
                    if (integratorNode.Attributes["eps"] != null)
                    {
                        _integratorOptions.eps = Convert.ToDouble(integratorNode.Attributes["eps"].Value);
                    }
                }
            }
            else
            {
                Eoms = null;
                //_stateDataTimeStep = 30.0;
            }
        }