コード例 #1
0
ファイル: AnswerAnalyzer.cs プロジェクト: userIsTaken/SCpNew
        public static string getBigAnswer(byte[] bytes)
        {
            string getAnswer  = String.Empty;
            int    indexShift = 4;
            /**/
            string newLine       = Environment.NewLine;
            string empty         = "\t";
            uint   Ni            = BitConverter.ToUInt32(bytes, 0x0 + indexShift);
            uint   Tn            = BitConverter.ToUInt16(bytes, 0x4 + indexShift);     //kas 100 ms čia, 0xFFFF - riba, po kurios stoja
            double Tn_in_seconds = (double)Tn * 0.1;                                   //Tn dabar čia bus sekundėmis, jį grąžiname;
            uint   HV45          = BitConverter.ToUInt16(bytes, 0x6 + indexShift);     //HV45, dauginant 1,0498V gaunama įtampa nuo 0 iki 4,5 kV;
            double HV45_d        = (double)HV45 * 1.0498;                              //00HV45 šaltinio įtampa 0-4,5kV skalėje;
            uint   HV35          = BitConverter.ToUInt16(bytes, 0x8 + indexShift);     //00HV35, 3,5-4,5 kV skalėje;
            double HV35_d        = 3490 - HV35 * 0.1813;                               //00HV35 vertė voltais, 3,5-4,5 kV skalėje;
            uint   PWM           = bytes[0xa + indexShift];                            //PWM vertė?
            uint   Ti            = bytes[0xb + indexShift];                            //
            /**/
            uint   Tm      = BitConverter.ToUInt32(bytes, 0x60 + indexShift);          //tm trukmė milisekundėmis; be konvertavimo grąžinama;
            double HV45_15 = BitConverter.ToUInt16(bytes, 0x64 + indexShift) * 0.1813; //įtampa 00HV45_15 voltais 0-4,5kV skalėje; jau konvertuota;
            uint   Iin     = BitConverter.ToUInt16(bytes, 0x66 + indexShift);          //iin vertė, kokiais vienetais?

            //Viskas sujungiama į string'ą:
            getAnswer = Ni.ToString() + empty + Tn_in_seconds.ToString() + empty + HV45_d.ToString() + empty + HV35_d.ToString() + empty + PWM.ToString() + empty + Ti.ToString() + empty + Tm.ToString() + empty + HV45_15.ToString() + empty + Iin.ToString() + newLine;

            return(getAnswer);
        }
コード例 #2
0
        public static El Ne(this Ci CommonItem, int ControlNo, string Type, string AdditionalData, bool Checked = false)
        {
            var n = new Ni()
            {
                Cn = ControlNo
            };

            return(new El()
            {
                D = Ndi(), C = CommonItem, A = AdditionalData, Ch = Checked, Et = Type, N = n
            });
        }
コード例 #3
0
 public List <int> CalcNi()
 {
     Ni.Clear();
     Values.Sort();// Here we sort, be careful
     for (int i = 0; i < Xi.Count - 1; i++)
     {
         Ni.Add(0);
         foreach (var v in Values)
         {
             if (Xi[i] <= v && v < Xi[i + 1] && v != 0)
             {
                 Ni[i] += 1;
             }
         }
     }
     return(Ni);
 }
コード例 #4
0
 static IEnumerable <string> GetIpList()
 {
     foreach (var Ni in NetworkInterface.GetAllNetworkInterfaces())
     {
         if (Ni.OperationalStatus == OperationalStatus.Up && (Ni.NetworkInterfaceType == NetworkInterfaceType.Ethernet ||
                                                              Ni.NetworkInterfaceType == NetworkInterfaceType.Wireless80211 ||
                                                              Ni.NetworkInterfaceType == NetworkInterfaceType.Loopback))
         {
             foreach (var IpInfo in Ni.GetIPProperties().UnicastAddresses)
             {
                 if (IpInfo.Address.AddressFamily == AddressFamily.InterNetwork)
                 {
                     yield return(IpInfo.Address.ToString());
                 }
             }
         }
     }
 }
コード例 #5
0
        public List <double> CalcRightRangeNiList()
        {
            RightRangeNi.Clear();
            RightRangeNi = Ni.ToDoubleList();
            if (Ni.Count > 4)
            {
                var zeroAndfirstSum   = Ni[0] + Ni[1];
                var prelastAndlastSum = Ni[Ni.Count - 2] + Ni.Last();

                //Видалення меж що не входять в модифікований діапазон
                RightRangeNi.RemoveRange(0, 2);
                //Вставка пропущених значень знового діапазону
                RightRangeNi.Insert(0, zeroAndfirstSum);

                RightRangeNi.RemoveRange(Ni.Count - 3, 2);
                RightRangeNi.Add(prelastAndlastSum);
            }
            return(RightRangeNi);
        }
コード例 #6
0
ファイル: Bridge.cs プロジェクト: billhu0228/BridgeBuilder
        /// <summary>
        /// 生成拱肋节点、单元
        /// </summary>
        /// <returns></returns>
        void GenArchPoints()
        {
            Database db = Application.DocumentManager.MdiActiveDocument.Database;
            DBPoint  Ni, Nj;
            Line     Elem = new Line();
            DBPoint  Node;

            for (int j = 0; j < 2; j++)
            {
                foreach (double x0 in Xlist)
                {
                    double xx = x0 / 1000;
                    double yy = 0.9397 * Math.Sqrt(200 * xx - xx * xx + 7963.93) - 0.9397 * Math.Sqrt(7963.93);
                    double zz = 0;
                    if (j == 0)
                    {
                        zz = 0.3420 * Math.Sqrt(200 * xx - xx * xx + 7963.93) - 0.3420 * Math.Sqrt(7963.93);
                    }
                    else
                    {
                        zz = 0.3420 * Math.Sqrt(200 * xx - xx * xx + 7963.93) - 0.3420 * Math.Sqrt(7963.93);
                        zz = -zz - 35.8;
                    }
                    Point3d pt = new Point3d(xx * 1000, yy * 1000, zz * 1000);
                    Node = new DBPoint(pt);
                    Node.SetNodeId(db, GlobalNodeId);
                    NodeList.Add(Node);
                    GlobalNodeId++;

                    // 单元
                    Nj = Node;
                    if (x0 != Xlist[0])
                    {
                        var previesid = from n in NodeList where n.GetID() == Nj.GetID() - 1 select n;
                        Ni   = previesid.ToList()[0];
                        Elem = new Line(Ni.Position, Nj.Position);
                        int nk = j == 0 ? 9999 : 8888;
                        Elem.SetElemXData(db, Ni.GetID(), Nj.GetID(), nk, GlobalElemId, "拱肋");
                        ElemList.Add(Elem);
                        double dx     = Math.Max(Math.Abs(Nj.Position.X - 100000), Math.Abs(Ni.Position.X - 100000));
                        double height = 3000 + dx / 100000 * 500;
                        ArchHeightList.Add(GlobalElemId, height);
                        if (Math.Abs(x0 - 100000) >= 40000)
                        {
                            ArchThickList.Add(GlobalElemId, 70);
                        }
                        else if (Math.Abs(x0 - 100000) >= 20000)
                        {
                            ArchThickList.Add(GlobalElemId, 60);
                        }
                        else
                        {
                            ArchThickList.Add(GlobalElemId, 50);
                        }
                        GlobalElemId++;
                    }
                }
            }

            return;
        }
コード例 #7
0
ファイル: Bridge.cs プロジェクト: billhu0228/BridgeBuilder
        /// <summary>
        /// 生成桥面系
        /// </summary>
        void GenBeamPoints()
        {
            Database db = Application.DocumentManager.MdiActiveDocument.Database;
            DBPoint  Ni, Nj;
            Line     Elem = new Line();
            DBPoint  Node;

            foreach (double x0 in Xlist)
            {
                foreach (double z0 in Zlist)
                {
                    if ((x0 == Xlist[0] || x0 == Xlist[Xlist.Length - 1]) && (z0 != Zlist[1]))
                    {
                        continue;
                    }
                    Node = new DBPoint(new Point3d(x0, 0, z0));
                    Node.SetNodeId(db, GlobalNodeId);
                    NodeList.Add(Node);
                    GlobalNodeId++;
                }
            }

            foreach (double x0 in Xlist)
            {
                foreach (double z0 in Zlist)
                {
                    if (z0 == Zlist[0])
                    {
                        continue;
                    }
                    else
                    {
                        var njsel = from nn in NodeList
                                    where nn.Position.X == x0 && nn.Position.Z == z0
                                    select nn;
                        Nj = njsel.ToList()[0];

                        int index = Zlist.ToList().FindIndex(item => item.Equals(z0));
                        var nisel = from nj in NodeList
                                    where nj.Position.X == x0 && nj.Position.Z == Zlist[index - 1]
                                    select nj;
                        Ni   = nisel.ToList()[0];
                        Elem = new Line(Ni.Position, Nj.Position);
                        Elem.SetElemXData(db, Ni.GetID(), Nj.GetID(), 7777, GlobalElemId, "刚臂");
                        ElemList.Add(Elem);
                        GlobalElemId++;
                    }
                }
            }
            foreach (double x0 in Xlist)
            {
                double z0 = -17900;
                if (x0 != Xlist[0])
                {
                    var njsel = from nn in NodeList
                                where nn.Position.X == x0 && nn.Position.Z == z0
                                select nn;
                    Nj = njsel.ToList()[0];
                    int index = Xlist.ToList().FindIndex(item => item.Equals(x0));
                    var nisel = from nj in NodeList
                                where nj.Position.X == Xlist[index - 1] && nj.Position.Z == z0
                                select nj;
                    Ni   = nisel.ToList()[0];
                    Elem = new Line(Ni.Position, Nj.Position);
                    Elem.SetElemXData(db, Ni.GetID(), Nj.GetID(), 7777, GlobalElemId, "主梁");

                    //if (z0==Zlist[2])
                    //{
                    //    Elem.SetElemXData(db, Ni.GetID(), Nj.GetID(),7777, GlobalElemId,"主梁");
                    //}
                    //else
                    //{
                    //    Elem.SetElemXData(db, Ni.GetID(), Nj.GetID(),7777,GlobalElemId, "刚臂");
                    //}

                    ElemList.Add(Elem);
                    GlobalElemId++;
                }
            }
        }
コード例 #8
0
        ///// <summary>
        ///// Test Sample Storage
        ///// </summary>
        //public static void Ts(bool Ensure = true)
        //{
        //    if (Ensure)
        //        new BloggingContext().N();
        //    AppDataModels.sv();
        //}

        /// <summary>
        /// Test Sample Storage with custom context
        /// </summary>
        public static void Tcs(bool Ensure = true)
        {
            var qs = "name=Model1"; // Model1   Testing_DB_Common

            var cs = new DCx <El, Ni, Ts>(qs);

            if (Ensure)
            {
                cs.N();
            }

            cs.U(c =>
            {
                var e = new El()
                {
                    Et = "fghfgh ", ElId = _.g
                };
                e.C = new Ci()
                {
                    T = "gdfgdfgdfg", CiId = _.g
                };
                var n = new Ni()
                {
                    A = _.g, NiId = _.g
                };
                e.N   = n;
                var t = new Ts()
                {
                    U = true, TsId = _.g
                };
                t.W = new Tr()
                {
                    D = "gdfgdfgdfg", TrId = _.g
                };
                t.S = new Tr()
                {
                    D = "gdfgdfgdfg dfgg df hgfhd fg", TrId = _.g
                };
                //b. = new List<Ts>();
                //b.Posts.Add(new Ts() { Content = "gdf dgdg ", Title = "gfhjfghg hhfh" });
                //b.Posts.Add(new Ts() { Content = "gdf dgdg  3232423", Title = "gfhjfghg hhfh 2422342423" });
                c.d1.Add(e);
                c.d2.Add(n);
                c.d3.Add(t);
            });

            var cs2 = new DCx <El, Ni, Ts>(qs);

            cs2.R(c =>
            {
                var tt = c.d1
                         .Include(a => a.N).Include(a => a.D).Include(a => a.C)
                         //.Include(blog => blog.Posts)
                         .L();
                var tt2 = c.d2
                          //.Include(a => a)
                          .L();
                var tt3 = c.d3
                          .Include(a => a.W)
                          .Include(a => a.S)
                          .L();
            });

            //AppDataModels.sv();
        }