Exemple #1
0
        //Returns the azimuth and elevation from a TLE
        private double[] getSkyCoords(Tle tle)
        {
            double[] array = { -1, -1 };
            //create a viewing site
            Site site = new Site(latitude, longitude, 0.240949);
            //make an orbit out of the tle
            Orbit orbit = new Orbit(tle);
            //get the date
            DateTime dt = DateTime.UtcNow;
            //get the time since the epoch
            TimeSpan ts = orbit.TPlusEpoch(dt);

            //then calculate the position
            try
            {
                EciTime eci      = orbit.GetPosition(dt);
                Topo    topoLook = site.GetLookAngle(eci);
                array[0] = topoLook.AzimuthDeg;
                array[1] = topoLook.ElevationDeg;
                return(array);
            }
            catch
            {
                return(array);
            }
        }
Exemple #2
0
        private void ShowData()
        {
            if (tle != null)
            {
                var Location = new LatLon(53.9, 27.56667);
                var dt       = DateTime.UtcNow;

                var JDdate = Utils.Utils.JDtime(dt);
                MJD.Text = JDdate.ToString("f5");
                orbit    = new Orbit(tle);
                Site    site     = new Site(Location.Lat, Location.Lon, 0.290);
                EciTime eci      = orbit.GetPosition(dt);
                Topo    topoLook = site.GetLookAngle(eci);
                main.Altitude.Text = topoLook.ElevationDeg.ToString("f3");
                main.Azimuth.Text  = topoLook.AzimuthDeg.ToString("f3");
                var altAzm = new AltAzm(topoLook.ElevationDeg, topoLook.AzimuthDeg);
                var RaDec  = Utils.Utils.AltAzm2RaDec(altAzm, Location, dt, 0.29);

                var tt2 = Utils.Utils.RaDec2AltAzm2(
                    new Coordinates(16.695, 36.466667),
                    new LatLon(52.5, -1.9166667),
                    new DateTime(1998, 8, 10, 23, 10, 00),
                    0);
                var ttt = Utils.Utils.RaDec2AltAzm2(RaDec, Location, dt, 0.2);

                RA.Text  = DMS.FromDeg(RaDec.Ra).ToString();
                Dec.Text = DMS.FromDeg(RaDec.Dec).ToString();
            }
        }
Exemple #3
0
 /// <summary>
 /// 清除没有用到的节点
 /// </summary>
 public void ClearEmptyNode()
 {
     Topo.RemoveAll((TopolotyNode node) =>
     {
         return(node.device == null);
     });
 }
        // /////////////////////////////////////////////////////////////////////
        static void Main(string[] args)
        {
            // Sample code to test the SGP4 and SDP4 implementation. The test
            // TLEs come from the NORAD document "Space Track Report No. 3".

            // Test SGP4
            string str1 = "SGP4 Test";
            string str2 = "1 88888U          80275.98708465  .00073094  13844-3  66816-4 0     8";
            string str3 = "2 88888  72.8435 115.9689 0086731  52.6988 110.5714 16.05824518   105";

            Tle tle1 = new Tle(str1, str2, str3);

            PrintPosVel(tle1);

            Console.WriteLine();

            // Test SDP4
            str1 = "SDP4 Test";
            str2 = "1 11801U          80230.29629788  .01431103  00000-0  14311-1       8";
            str3 = "2 11801  46.7916 230.4354 7318036  47.4722  10.4117  2.28537848     6";

            Tle tle2 = new Tle(str1, str2, str3);

            PrintPosVel(tle2);

            Console.WriteLine("\nExample output:");

            // Example: Define a location on the earth, then determine the look-angle
            // to the SDP4 satellite defined above.

            // Create an orbit object using the SDP4 TLE object.
            Satellite satSDP4 = new Satellite(tle2);

            // Get the location of the satellite from the Orbit object. The
            // earth-centered inertial information is placed into eciSDP4.
            // Here we ask for the location of the satellite 90 minutes after
            // the TLE epoch.
            EciTime eciSDP4 = satSDP4.PositionEci(90.0);

            // Now create a site object. Site objects represent a location on the
            // surface of the earth. Here we arbitrarily select a point on the
            // equator.
            Site siteEquator = new Site(0.0, -100.0, 0); // 0.00 N, 100.00 W, 0 km altitude

            // Now get the "look angle" from the site to the satellite.
            // Note that the ECI object "eciSDP4" has a time associated
            // with the coordinates it contains; this is the time at which
            // the look angle is valid.
            Topo topoLook = siteEquator.GetLookAngle(eciSDP4);

            // Print out the results. Note that the Azimuth and Elevation are
            // stored in the CoordTopo object as radians. Here we convert
            // to degrees using Rad2Deg()
            Console.Write("AZ: {0:f3}  EL: {1:f3}\n",
                          topoLook.AzimuthDeg,
                          topoLook.ElevationDeg);
        }
Exemple #5
0
 /// <summary>
 /// 查找拓扑节点
 /// </summary>
 /// <param name="sideNodes">左边或右边的拓扑节点</param>
 private void FillNodes(List <TopolotyNode> sideNodes)
 {
     for (int i = 0; i < sideNodes.Count; i++)
     {
         sideNodes[i] = Topo.Find((TopolotyNode node) =>
         {
             return(node.device.Name == sideNodes[i].device.Name &&
                    node.device.Id == sideNodes[i].device.Id &&
                    node.device.CiId == sideNodes[i].device.CiId);
         });
     }
 }
Exemple #6
0
    public Model simulatorDataFromSampling()
    {
        List <Model> _mods = new List <Model>();

        for (int i = 0; i < _mods.Count; i++ /* Model model */)
        {
            startFromInitializer();

            if (Topo.couldBeParallel())
            {
                filingData();
            }
            else if (Topo.couldbeSerial())
            {
                waitTillNewDataFiledTo();
            }
        }
        return(new Model());
    }
Exemple #7
0
        /// <summary>
        /// 读取拓扑文件
        /// </summary>
        /// <param name="fileName">文件名</param>
        public void LoadTopo(string fileName)
        {
            XmlDocument doc = new XmlDocument();

            doc.Load(fileName);

            var nodes = doc.SelectNodes("StationTopoloty/TopolotyNode");

            // 读取 Topo 节点
            foreach (XmlElement item in nodes)
            {
                Topo.Add(new TopolotyNode(item, Devices));
            }

            // 读取每个节点的左右节点
            for (int i = 0; i < Topo.Count; i++)
            {
                Topo[i].LoadSideNodes(nodes[i] as XmlElement, Topo);
            }
        }
Exemple #8
0
        public int gen_chain_char(string[] words, int len, string[] result, char head, char tail, bool enable_loop)
        {
            if (!((head <= 'z' && head >= 'a') || (head == '\0')))
            {
                throw new Exception("首字母不符合规范");
            }
            if (!((tail <= 'z' && tail >= 'a') || (tail == '\0')))
            {
                throw new Exception("尾字母不符合规范");
            }

            if (head == '\0')
            {
                head = '#';
            }
            if (tail == '\0')
            {
                tail = '#';
            }

            Word.setWeightChosen('c');

            if (!enable_loop) //没有-r的情况
            {
                ReadFile readFile = new ReadFile();
                readFile.buildWordList(words);
                readFile.run2();
                Topo tp = new Topo();
                tp.run(head, tail);
                return(tp.getLongesChain().getWeight());
            }
            else //有
            {
                ReadFile readFile = new ReadFile();
                readFile.buildWordList(words);
                WordChainProcessor wcp    = new WordChainProcessor(ReadFile.GetWordChainUnDo(), 'c', head, tail);
                WordChain          wchain = wcp.getResultChain();
                return(wchain.getWeight());
            }
            throw new NotImplementedException();
        }
Exemple #9
0
        public WordChain build_chain_char(string[] words, int len, string[] result, char head, char tail, bool enable_loop)
        {
            Word.setWeightChosen('c');

            if (!enable_loop) //没有-r的情况
            {
                ReadFile readFile = new ReadFile();
                readFile.buildWordList(words);
                readFile.run2();
                Topo tp = new Topo();
                tp.run(head, tail);
                return(tp.getLongesChain());
            }
            else //有
            {
                ReadFile readFile = new ReadFile();
                readFile.buildWordList(words);
                WordChainProcessor wcp    = new WordChainProcessor(ReadFile.GetWordChainUnDo(), 'c', head, tail);
                WordChain          wchain = wcp.getResultChain();
                return(wchain);
            }
            throw new NotImplementedException();
        }