Example #1
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
            string typeString = dynamicStateXMLNode.Attributes["DynamicStateType"].Value;

            Type = (DynamicStateType)Enum.Parse(typeof(DynamicStateType), typeString);

            Matrix <double> ics = new Matrix <double>(dynamicStateXMLNode["ICs"]["Matrix"]);

            _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...
                //_eoms = createEOMSObject(dynamicStateXMLNode["EOMS"]);

                // Returns a null reference if INTEGRATOR is not set in XML
                _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;
                _integratorNode = null;
                //_stateDataTimeStep = 30.0;
            }
        }