public void TestEvaluationInfrastructure_DefaultConstructor_CalculatePerformance()
        {
            infrastructure = new EvaluationInfrastructure(
                new GeoPoint(113, 23), new GeoPoint(113.003, 23.003), cellList);
            infrastructure.Region.CalculatePerformance(0.1);
            Assert.IsTrue(infrastructure.Region[5].Result.NominalSinr > 2);
            Assert.IsTrue(infrastructure.Region[7].Result.NominalSinr > 12);
            MeasurePoint point16 = infrastructure.MeasurePointList[16];

            Assert.AreEqual(point16.Longtitute, 113.000899, eps);
            Assert.AreEqual(point16.Lattitute, 23.000899, eps);
            Assert.IsTrue(point16.Result.NominalSinr > 15);
            MeasurePoint point24 = infrastructure.MeasurePointList[24];

            Assert.AreEqual(point24.Longtitute, 113.001349, eps);
            Assert.AreEqual(point24.Lattitute, 23.001349, eps);
            Assert.IsTrue(point24.Result.NominalSinr > 21);
            IEnumerable <MeasurePoint> orderedList = infrastructure.MeasurePointList.OrderByDescending(
                x => x.Result.NominalSinr);
            MeasurePoint point = orderedList.ElementAt(0);

            Assert.IsTrue(point.Result.NominalSinr > 28);
            Assert.AreEqual(point.Longtitute, 113.0022483, eps);
            Assert.AreEqual(point.Lattitute, 23, eps);
        }
 protected void Initialize()
 {
     budgetList      = new List <ILinkBudget <double> >();
     model           = new BroadcastModel();
     outdoorCellList = new List <IOutdoorCell>();
     measurablePoint = new MeasurePoint();
 }
示例#3
0
    private static Packet writeMeasureFile(DM_ModelProject modelProject, DM_ModelPart modelPart, DM_WorkPlace modelWorkPalce, DM_ModelWorkshop modelWorkShop, DataTable dtPoint, DataTable dtInfo, string strProgressName, ref string strError)
    {
        DateTime dtNow = DateTime.Now;

        MeasureFile     file        = new MeasureFile();
        string          strFileName = FileFun.CreateFileName(dtNow, "MeasureFile.txt");
        string          strFilePath = HttpContext.Current.Server.MapPath("~") + "\\MeasureFile\\" + strFileName;
        MeasureFileHead head        = new MeasureFileHead();

        head.MeasureDate = dtNow.Year + "-" + dtNow.Month + "-" + dtNow.Day;
        head.MeasureTime = dtNow.Hour + ":" + dtNow.Minute + ":" + dtNow.Second;
        head.ProjectName = modelProject.ProjectName;
        head.ProjectNo   = modelProject.ProjectNo;
        head.PartName    = modelPart.PartName;
        head.PartNo      = modelPart.PartNO;
        head.SerNumber   = "";
        head.ComPonent   = "";
        head.Progress    = strProgressName;
        head.WorkPlace   = modelWorkPalce.WorkPlaceName;
        head.WorkShop    = modelWorkShop.WorkshopName;
        file.FileHead    = head;
        for (int i = 0; i < dtPoint.Rows.Count; i++)
        {
            string    strPointName = dtPoint.Rows[i]["PointName"].ToString();
            string    strPointID   = dtPoint.Rows[i]["PointID"].ToString();
            float     fMeas        = dtPoint.Rows[i]["Value"].ToString() == "" ? MeasureFileBase.GlobalData.NULL_NUM : Convert.ToSingle(dtPoint.Rows[i]["Value"]);
            DataRow[] nomRows      = dtInfo.Select("PointID = " + strPointID);
            float     fNom         = nomRows[0]["Nominal"].ToString() == "" ? MeasureFileBase.GlobalData.NULL_NUM : Convert.ToSingle(nomRows[0]["Nominal"]);
            float     fUpTol       = nomRows[0]["UpTol"].ToString() == "" ? MeasureFileBase.GlobalData.NULL_NUM : Convert.ToSingle(nomRows[0]["UpTol"]);
            float     fLowTol      = nomRows[0]["LowTol"].ToString() == "" ? MeasureFileBase.GlobalData.NULL_NUM : Convert.ToSingle(nomRows[0]["LowTol"]);

            MeasurePoint point = new MeasurePoint(strPointName, fMeas, fNom, fUpTol, fLowTol);
            file.AddPoint(point);
        }
        if (file.Save(strFilePath))
        {
            byte[] byFileData = null;
            using (FileStream fs = new FileStream(strFilePath, FileMode.Open, FileAccess.Read))
            {
                byFileData = new byte[(int)fs.Length];
                fs.Read(byFileData, 0, (int)fs.Length);
            }
            PacketTable table = new PacketTable();
            table.AddField("FileName", PacketTable.FieldType.TypeString);
            table.AddField("File", PacketTable.FieldType.TypeImage);
            table.MakeTable(1);
            table.SetValue(0, 0, strFileName);
            table.SetValue(0, 1, byFileData);
            PacketTable[] TableArray = new PacketTable[1];
            TableArray[0] = table;
            ServerConnection conn       = new ServerConnection();
            Packet           recvPacket = conn.ExecuteCommand(10001, TableArray);
            return(recvPacket);
        }
        else
        {
            strError = "生成文件或者上传文件出错!";
            return(null);
        }
    }
示例#4
0
        public EvaluationRegion(IGeoPoint <double> leftBottom, IGeoPoint <double> rightTop,
                                double distanceInMeter)
        {
            if ((leftBottom.Longtitute >= rightTop.Longtitute) || (leftBottom.Lattitute >= rightTop.Lattitute))
            {
                throw new ArgumentOutOfRangeException("leftBottom");
            }

            degreeInterval = distanceInMeter.GetDegreeInterval();
            int xDimensionPoints = (int)Math.Ceiling((rightTop.Longtitute - leftBottom.Longtitute) / degreeInterval);
            int yDimensionPoints = (int)Math.Ceiling((rightTop.Lattitute - leftBottom.Lattitute) / degreeInterval);

            pointList = new MeasurePoint[xDimensionPoints * yDimensionPoints];

            for (int i = 0; i < xDimensionPoints; i++)
            {
                for (int j = 0; j < yDimensionPoints; j++)
                {
                    pointList[i * yDimensionPoints + j] = new MeasurePoint
                    {
                        Longtitute = leftBottom.Longtitute + i * degreeInterval,
                        Lattitute  = leftBottom.Lattitute + j * degreeInterval
                    };
                }
            }
        }
示例#5
0
        public void IndexSample2(bool useServerSession)
        {
            CreateDirectoryAndCopyLicenseDb();
            Random rd = new Random();

            using (SessionBase session = useServerSession ? (SessionBase) new ServerClientSession(systemDir) : (SessionBase) new SessionNoServer(systemDir))
            {
                session.BeginUpdate();

                for (int i = 0; i < 100; i++)
                {
                    MeasurePoint p = new MeasurePoint(i + 1)
                    {
                        Data = new List <float>()
                    };
                    for (int j = 0; j < 440000; j++)
                    {
                        p.Data.Add(rd.Next(100));
                    }
                    session.Persist(p);
                }

                var      value = session.DatabaseNumberOf(typeof(MeasurePoint));
                Database db    = session.OpenDatabase(value, false, false);
                if (db != null)
                {
                    var q = from point in session.Index <MeasurePoint>("key", db) where point.Key == 10 select point;
                    foreach (MeasurePoint obj in q)
                    {
                        Console.WriteLine(obj.Key + " " + obj.Data.Count);
                    }
                }
                session.Commit();
            }
        }
示例#6
0
        public float Calculate(CrossSectionDataModel data)
        {
            ValidateData(data);

            MeasurePoint second       = data.MeasurePoints[1];
            float        startSection = second.Depth * second.DistanceFromInitialPoint / 8 * (second.Velocity.Average() * _riverBankFlowFactor);

            MeasurePoint beforeLast = data.MeasurePoints[data.MeasurePoints.Length - 1];
            float        endSection = beforeLast.Depth * (data.MeasurePoints.Last().DistanceFromInitialPoint - beforeLast.DistanceFromInitialPoint) / 8 * (beforeLast.Velocity.Average() * _riverBankFlowFactor);

            float discharge = startSection + endSection;

            for (var i = 1; i < data.MeasurePoints.Length - 1; i++)
            {
                MeasurePoint previous = data.MeasurePoints[i - 1];
                MeasurePoint next     = data.MeasurePoints[i + 1];

                float sectionWidth     = next.DistanceFromInitialPoint - previous.DistanceFromInitialPoint;
                float sectionArea      = sectionWidth / 2 * data.MeasurePoints[i].Depth;
                float sectionDischarge = data.MeasurePoints[i].Velocity.Average() * sectionArea;
                discharge += sectionDischarge;
            }

            return(discharge);
        }
 private void UpdateSpeedometer(MeasurePoint measurePoint)
 {
     speedometer.text = $"{Math.Round(measurePoint.AverageSpeed, 2)} m/s";
     UpdateSpeedLimitIndicator(measurePoint.AverageSpeed);
     if (playerClone.activeSelf)
     {
         UpdatePlayerCloneAnimation(measurePoint.AverageSpeed);
     }
 }
示例#8
0
        public async Task <IActionResult> Create(MeasurePoint measurePoint)
        {
            if (ModelState.IsValid)
            {
                await my_context.CreateMeasurePointAsync(measurePoint);

                return(RedirectToAction(nameof(Index)));
            }
            return(View(measurePoint));
        }
 public void GenerateMeasurableCellList(ComparableCell[] compCells, MeasurePoint point)
 {
     CellList.Clear();
     int count = Math.Min(compCells.Length, _maxMeasurableCells);
     for (int i = 0; i < count; i++)
     {
         MeasurableCell c = new MeasurableCell(compCells[i], point);
         c.CalculateRsrp();
         CellList.Add(c);
     }
 }
示例#10
0
 public void TestInitialize()
 {
     _point = new MeasurePoint(new GeoPoint(112.1, 23.2))
     {
         Result = new SfMeasurePointResult
         {
             SameModInterferenceLevel      = 0.5,
             DifferentModInterferenceLevel = 1.5,
             TotalInterferencePower        = 2.5,
             NominalSinr = 3.5
         }
     };
 }
示例#11
0
 public void TestInitialize()
 {
     _point = new MeasurePoint(new GeoPoint(112.1, 23.2))
     {
         Result = new SfMeasurePointResult
         {
             SameModInterferenceLevel = 0.5,
             DifferentModInterferenceLevel = 1.5,
             TotalInterferencePower = 2.5,
             NominalSinr = 3.5
         }
     };
 }
 public void TestInitialize()
 {
     MeasurePoint point = new MeasurePoint();
     point.MockMeasurePointProperties(-33, -105, -110, -78);
     mesurePointList.Add(point);
     point = new MeasurePoint();
     point.MockMeasurePointProperties(-28, -3000, -110, -98);
     mesurePointList.Add(point);
     point = new MeasurePoint();
     point.MockMeasurePointProperties(-26, -2000, -300, -88);
     mesurePointList.Add(point);
     point = new MeasurePoint();
     point.MockMeasurePointProperties(-20, -199, -400, -301);
     mesurePointList.Add(point);
 }
        private void MoveClone()
        {
            if (currentListIndex == speedMeasurer.MeasurePoints.Count - 1)
            {
                CancelInvoke();
                isCloneMoving = false;
                replayFinishedCallback();
                return;
            }

            nextPointToMove = speedMeasurer.MeasurePoints[currentListIndex++];
            isCloneMoving   = true;
            clone.SetActive(true);
            replayUpdateCallback(nextPointToMove);
        }
示例#14
0
        public void ValidateData(CrossSectionDataModel data)
        {
            if (data?.MeasurePoints == null)
            {
                throw new ArgumentException("Missing data", nameof(MeasurePoint));
            }

            data.MeasurePoints = data.MeasurePoints
                                 .Where(x => x != null)
                                 .OrderBy(x => x.OrderId).ToArray();

            if (data.MeasurePoints.Length < 3)
            {
                throw new ArgumentException("Missing data", nameof(MeasurePoint));
            }

            MeasurePoint last  = data.MeasurePoints.Last();
            MeasurePoint first = data.MeasurePoints.First();
            IEnumerable <MeasurePoint> failedMeasures = data.MeasurePoints
                                                        .Where(x => x.OrderId > first.OrderId && x.OrderId < last.OrderId && (Math.Abs(x.Velocity.Average()) < 0.0001 || Math.Abs(x.DistanceFromInitialPoint) < 0.0001)).ToArray();

            data.MeasurePoints = data.MeasurePoints.Except(failedMeasures).ToArray();

            if (first.Depth > 0 || last.Depth > 0)
            {
                throw new FloodingException("Flooding alarm");
            }

            if (failedMeasures.Count() > _allowedErrors)
            {
                throw new ArgumentException("Incomplete data", nameof(MeasurePoint));
            }

            float lastDistance = -1;

            foreach (MeasurePoint measurePoint in data.MeasurePoints)
            {
                if (measurePoint.DistanceFromInitialPoint <= lastDistance)
                {
                    throw new Exception("Measurements order disruption");
                }
                lastDistance = measurePoint.DistanceFromInitialPoint;
            }

            data.ReadAccuracy = failedMeasures.Any()
                            ? 100 - failedMeasures.Count() / (float)data.MeasurePoints.Length * 100
                            : 100;
        }
示例#15
0
        /// <summary>
        /// Источник изображения с состоянием точки учёта.
        /// </summary>
        public static string StateImageSource(MeasurePoint measurePoint)
        {
            switch (measurePoint.State)
            {
            case MeasurePointState.Normal: return("State_Normal.png");

            case MeasurePointState.Error: return("State_Error.png");

            case MeasurePointState.None: return("State_Unknown.png");

            case MeasurePointState.Warning: return("State_Warning.png");

            default:
                throw new NotSupportedException($"{Droid.Resources.Messages.Text_State_Not_Supported} {measurePoint.State}");
            }
        }
示例#16
0
        public void TestInitialize()
        {
            MeasurePoint mPoint =
                FakeMeasurePoint.GenerateMeasurePoint(
                    new IOutdoorCell[2] {
                mainCell, otherCell1
            },
                    new byte[2] {
                2, 1
            },
                    new double[2] {
                -10, -12
            });

            mpcRelation = mPoint.GenerateMeasurePlanCellRelation(0.1);
        }
示例#17
0
        public void TestInitialize()
        {
            MeasurePoint point = new MeasurePoint();

            point.MockMeasurePointProperties(-33, -105, -110, -78);
            mesurePointList.Add(point);
            point = new MeasurePoint();
            point.MockMeasurePointProperties(-28, -3000, -110, -98);
            mesurePointList.Add(point);
            point = new MeasurePoint();
            point.MockMeasurePointProperties(-26, -2000, -300, -88);
            mesurePointList.Add(point);
            point = new MeasurePoint();
            point.MockMeasurePointProperties(-20, -199, -400, -301);
            mesurePointList.Add(point);
        }
示例#18
0
        public IActionResult Post([FromBody] MeasurePoint MeasurePoint)
        {
            //MeasurePoint MeasurePoint = JsonConvert.DeserializeObject<MeasurePoint>(JsonString);
            using (PowerContext db = new PowerContext())
            {
                if (MeasurePoint.ElectricMeter.MeterType != null && MeasurePoint.VoltageTransformer.VTType != null && MeasurePoint.CurrentTransformer.CTType != null)
                {
                    var ExistingMeterName = db.MeterTypes.SingleOrDefault(p => p.Title == MeasurePoint.ElectricMeter.MeterType.Title);
                    if (ExistingMeterName != null)
                    {
                        MeasurePoint.ElectricMeter.MeterType = ExistingMeterName;
                    }
                    else
                    {
                        db.MeterTypes.Add(MeasurePoint.ElectricMeter.MeterType);
                    }

                    var ExistingVTName = db.VTTypes.SingleOrDefault(p => p.Title == MeasurePoint.VoltageTransformer.VTType.Title);
                    if (ExistingVTName != null)
                    {
                        MeasurePoint.VoltageTransformer.VTType = ExistingVTName;
                    }
                    else
                    {
                        db.VTTypes.Add(MeasurePoint.VoltageTransformer.VTType);
                    }

                    var ExistingCTName = db.CTTypes.SingleOrDefault(p => p.Title == MeasurePoint.CurrentTransformer.CTType.Title);
                    if (ExistingCTName != null)
                    {
                        MeasurePoint.CurrentTransformer.CTType = ExistingCTName;
                    }
                    else
                    {
                        db.CTTypes.Add(MeasurePoint.CurrentTransformer.CTType);
                    }

                    db.VoltageTransformers.Add(MeasurePoint.VoltageTransformer);
                    db.CurrentTransformers.Add(MeasurePoint.CurrentTransformer);
                    db.ElectricMeters.Add(MeasurePoint.ElectricMeter);

                    db.MeasurePoints.Add(MeasurePoint);
                    db.SaveChanges();
                }
                return(Ok(MeasurePoint));
            }
        }
示例#19
0
        public MeasurePointInfo(MeasurePoint point, StatValueField field, double degreeSpan) : this()
        {
            X1 = point.Longtitute - degreeSpan / 2;
            X2 = point.Longtitute + degreeSpan / 2;
            Y1 = point.Lattitute - degreeSpan / 2;
            Y2 = point.Lattitute + degreeSpan / 2;
            double value;

            switch (field.FieldName)
            {
            case "同模干扰电平":
                value = point.Result.SameModInterferenceLevel;
                break;

            case "不同模干扰电平":
                value = point.Result.DifferentModInterferenceLevel;
                break;

            case "总干扰电平":
                value = point.Result.TotalInterferencePower;
                break;

            case "信号RSRP":
                value = point.Result.StrongestCell.ReceivedRsrp;
                break;

            default:
                value = point.Result.NominalSinr;
                break;
            }
            if (field.IntervalList.Count > 0)
            {
                StatValueInterval interval = field.IntervalList.FirstOrDefault(
                    x => x.IntervalLowLevel < value && value < x.IntervalUpLevel);
                if (interval != null)
                {
                    interval.Color.ColorA = 128;
                    ColorString           = interval.Color.ColorStringForHtml;
                    ColorStringForKml     = interval.Color.ColorStringForKml;
                }
                else
                {
                    ColorString       = "ffffff";
                    ColorStringForKml = "80FFFFFF";
                }
            }
        }
示例#20
0
 private void InitializeAlarmOldList()
 {
     _alarmOldList.Clear();
     // Initialize the buffer alarm list with 0 (no alarms)
     for (int i = 0; i < N3PR.ALARM_ADDRESS.Count(); i++)
     {
         var mp = new MeasurePoint
         {
             Date     = DateTime.Now,
             Reg_Name = N3PR.ALARM_NAMES[i],
             b_val    = Convert.ToBoolean(0),
             i_val    = 0,
             ui_val   = 0
         };
         _alarmOldList.Add(mp);
     }
 }
    public void Start()
    {
        startPoint = anchorStage1.GetComponent <MeasurePoint>();
        endPoint   = anchorStage1.GetComponent <MeasurePoint>();
        if (anchorStage1 == null)
        {
            Debug.Log("AnchorStage must be specified");
            return;
        }
        initialPos = anchorStage1.transform.position;
        anchorStage1.SetActive(false);
        anchorStage2.SetActive(false);
        SaveMenu.SetActive(false);

        MidAirPositioner.SetActive(false);
        SetGridValues();
    }
示例#22
0
    // Start is called before the first frame update
    void Start()
    {
        m_lineRenderer = GetComponent <LineRenderer>();
        //m_lineRenderer.startWidth = 0.003f;
        //m_lineRenderer.endWidth = 0.003f;
        //m_lineRenderer.startColor = Color.cyan;
        //m_lineRenderer.endColor = Color.cyan;

        EventManager.AddHandler(eEventEnum.DrawLine, new System.Action <object>((p_points) => {
            Vector3[] points              = (Vector3[])p_points;
            m_lineRenderer.positionCount += 2;
            m_lineRenderer.SetPosition(m_lineRenderer.positionCount - 2, points[0]);
            m_lineRenderer.SetPosition(m_lineRenderer.positionCount - 1, points[1]);
        }));

        EventManager.AddHandler(eEventEnum.AddMeasurePoint, new System.Action <object>((p_measurePoint) =>
        {
            MeasurePoint measurePoint = (MeasurePoint)p_measurePoint;
            GameObject prefab         = Instantiate(measurePoint.PrefabToInstantiate);
            prefab.transform.position = measurePoint.InstantiatePosition;
            m_pointIconsList.Add(prefab);
        }));

        EventManager.AddHandler(eEventEnum.DrawMeasureText, new System.Action <object>((p_measureText) =>
        {
            MeasureText measureText   = (MeasureText)p_measureText;
            GameObject prefab         = Instantiate(measureText.PrefabToInstantiate);
            prefab.transform.position = measureText.InstantiatePosition;
            prefab.GetComponentInChildren <TextMesh>().text = measureText.DistanceValue;
        }));

        EventManager.AddHandler(eEventEnum.ExitRuller, new System.Action <object>((p_obj) =>
        {
            m_lineRenderer.positionCount = 0;
            Object[] obj = Object.FindObjectsOfType(typeof(GameObject));
            for (int i = 0; i < obj.Length; i++)
            {
                if (obj[i].name == "PointIconObject(Clone)" || obj[i].name == "MeasureTextObject(Clone)")
                {
                    Destroy(obj[i]);
                }
            }
            m_pointIconsList.ForEach(p_prefab => Destroy(p_prefab));
            m_pointIconsList.Clear();
        }));
    }
示例#23
0
        public static void MockMeasurePointProperties(this MeasurePoint point,
                                                      double nominalSinr, double strongestCellRsrp, double strongestInterferenceRsrp,
                                                      double totalInterferencePower)
        {
            Mock <IMeasurePointResult> mockResult = new Mock <IMeasurePointResult>();

            mockResult.Setup(x => x.NominalSinr).Returns(nominalSinr);
            MeasurableCell signal = new MeasurableCell();

            signal.ReceivedRsrp = strongestCellRsrp;
            mockResult.Setup(x => x.StrongestCell).Returns(signal);
            MeasurableCell interference = new MeasurableCell();

            interference.ReceivedRsrp = strongestInterferenceRsrp;
            mockResult.Setup(x => x.StrongestInterference).Returns(interference);
            mockResult.Setup(x => x.TotalInterferencePower).Returns(totalInterferencePower);
            point.Result = mockResult.Object;
        }
示例#24
0
        public static Facility FillFacility()
        {
            var fac           = new Facility();
            var device        = new Device();
            var device2       = new Device();
            var measurepoint  = new MeasurePoint();
            var measurestate  = new MeasureState();
            var measurepoint2 = new MeasurePoint();
            var measurestate2 = new MeasureState();
            var measurepoint3 = new MeasurePoint();
            var measurestate3 = new MeasureState();
            var device3       = new Device();

            fac.FacilityId            = "12345678";
            measurestate.AccumulDate  = DateTime.Now;
            measurestate.Value        = (decimal)10.5;
            measurepoint.measureState = measurestate;
            measurepoint.Medium       = "Wasser";
            measurepoint.Tarif        = 0;
            measurepoint.Unit         = "m^3";
            device.MeasurePoints.Add(measurepoint);
            device.SRC_Id = "00001214";
            fac.Devices.Add(device);
            measurestate2.AccumulDate  = DateTime.Now;
            measurestate2.Value        = (decimal)19.5;
            measurepoint2.measureState = measurestate2;
            measurepoint2.Medium       = "Warmwasser";
            measurepoint2.Tarif        = 1;
            measurepoint2.Unit         = "m^3";
            device2.MeasurePoints.Add(measurepoint2);
            device2.SRC_Id = "00001215";
            fac.Devices.Add(device2);
            measurestate3.AccumulDate  = DateTime.Today;
            measurestate3.Value        = (decimal)1254.54;
            measurepoint3.measureState = measurestate3;
            measurepoint3.Medium       = "Elektrizität";
            measurepoint3.Tarif        = 2;
            measurepoint3.Unit         = "kWh";
            device3.MeasurePoints.Add(measurepoint3);
            device3.SRC_Id = "00005715";
            fac.Devices.Add(device3);

            return(fac);
        }
示例#25
0
        private void InstantiateTheListOfMeasurePoints()
        {
            Vector3    originalPosition = gameObjectToTrack.transform.localPosition;
            Quaternion originalRotation = gameObjectToTrack.transform.localRotation;

            MeasurePoint point = new MeasurePoint()
            {
                Position     = originalPosition,
                Rotation     = originalRotation,
                Second       = 0,
                Meter        = 0,
                AverageSpeed = 0
            };

            MeasurePoints = new List <MeasurePoint>()
            {
                point
            };
        }
        public void TestEvaluationInfrastructure_CellConstructor_CalculatePerformance()
        {
            infrastructure = new EvaluationInfrastructure();
            infrastructure.ImportCellList(cellList);
            infrastructure.Region.CalculatePerformance(0.1);
            Assert.IsTrue(infrastructure.Region[5].Result.NominalSinr > 1);
            Assert.IsTrue(infrastructure.Region[7].Result.NominalSinr > 1);
            IEnumerable <MeasurePoint> orderedList = infrastructure.MeasurePointList.OrderByDescending(
                x => x.Result.NominalSinr);
            MeasurePoint point = orderedList.ElementAt(0);

            Assert.IsTrue(point.Result.NominalSinr > 30);
            Assert.IsTrue(point.Result.StrongestCell.ReceivedRsrp > -65);
            Assert.IsTrue(point.Result.StrongestCell.DistanceInMeter < 30);
            Assert.AreEqual(point.CellRepository.CellList.Count, 6);
            Assert.AreEqual(point.CellRepository.CellList[0].ReceivedRsrp, point.Result.StrongestCell.ReceivedRsrp, eps);

            Assert.AreEqual(point.CellRepository.CellList[0].PciModx, 2);
        }
示例#27
0
        public void TestImportMeasurePoint_MainCellIsNotStrongest()
        {
            MeasurePoint mPoint =
                FakeMeasurePoint.GenerateMeasurePoint(
                    new IOutdoorCell[2] {
                mainCell, otherCell2
            },
                    new byte[2] {
                1, 3
            },
                    new double[2] {
                -11, -9
            });

            mpcRelation.ImportMeasurePoint(mPoint);
            Assert.AreEqual(mpcRelation.MainCell.ReceivePower, 0.1);
            Assert.AreEqual(mpcRelation.MainCell.Cell.Azimuth, 10);
            Assert.AreEqual(mpcRelation.InterferenceCells.Count, 1);
            Assert.AreEqual(mpcRelation.InterferenceCells[0].Cell.Azimuth, 70);
        }
示例#28
0
        public void TestImportMeasurePoint_SameCells()
        {
            MeasurePoint mPoint =
                FakeMeasurePoint.GenerateMeasurePoint(
                    new IOutdoorCell[2] {
                mainCell, otherCell1
            },
                    new byte[2] {
                2, 1
            },
                    new double[2] {
                -10, -12
            });

            mpcRelation.ImportMeasurePoint(mPoint);
            Assert.AreEqual(mpcRelation.MainCell.ReceivePower, 0.2);
            Assert.AreEqual(mpcRelation.MainCell.Cell.Azimuth, 10);
            Assert.AreEqual(mpcRelation.InterferenceCells.Count, 1);
            Assert.AreEqual(mpcRelation.InterferenceCells[0].Cell.Azimuth, 70);
            Assert.AreEqual(mpcRelation.InterferenceCells[0].ReceivePower, 0.126191, 1E-6);
        }
示例#29
0
        /// <summary>
        /// Пользователь выбрал пункт меню или навигационного окна "Удалённый пульт"
        /// </summary>
        /// <param name="actionId"></param>
        /// <param name="sender"></param>
        private void OnRemoteConsoleOpen(int actionId, object sender)
        {
            MeasurePoint measurePoint = (MeasurePoint)sender;

            // Запрашиваем требуемую для работы информацию
            measurePoint.Refresh(MeasurePointInfoFlags.Equipment);

            // Проверим, что у точки учёта есть устройство
            if (measurePoint.Device == null)
            {
                MessageBox.Show("У выбранной точки учёта не задано устройство. Выберите точку учёта с поддерживаемым устройством.",
                                "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Warning);

                return;
            }

            // Проверим, что мы работаем с ВКТ-5
            if (!CheckDeviceModel(measurePoint.Device))
            {
                MessageBox.Show("Удалённый пульт ВКТ-5 не поддерживает работу с устройствами "
                                + measurePoint.Device.Model.Title, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Warning);

                return;
            }

            // Проверим, открыто ли окно с опросом этого устройства
            Vkt5RemoteConsoleForm currentForm = GetOpenedForm(measurePoint.Device);

            if (currentForm == null)
            {
                // Такого окна нет, открываем
                NewForm(measurePoint.Device);
            }
            else
            {
                // Окно уже есть, переводим фокус на него
                currentForm.Show();
                currentForm.Focus();
            }
        }
示例#30
0
        public void ImportMeasurePoint(MeasurePoint mPoint)
        {
            if (MainCell.Cell != mPoint.Result.StrongestCell.Cell.Cell) { return; }
            MainCell.UpdateRsrpPower(mPoint.Result.StrongestCell);
            CoverPoints++;

            foreach (MeasurableCell mcell
                in mPoint.CellRepository.CellList.Where(x => x != mPoint.Result.StrongestCell))
            {
                MeasurePlanCell mpCell = InterferenceCells.FirstOrDefault(
                    x => x.Cell == mcell.Cell.Cell);

                if (mpCell != null)
                {
                    mpCell.UpdateRsrpPower(mcell);
                }
                else
                {
                    InterferenceCells.Add(new MeasurePlanCell(mcell));
                }
            }
        }
示例#31
0
    public void UpdatePosition(float givenDistance, float givenExerciseTime)
    {
        //create a new measure point with the given data
        MeasurePoint newMeasurement = new MeasurePoint();

        newMeasurement.Distance     = givenDistance;
        newMeasurement.ExerciseTime = givenExerciseTime;
        newMeasurement.Timestamp    = Time.time;
        measurements.Add(newMeasurement);

        //keep only enough measurements to be able to calculate good values
        while (measurements.Count > MAX_MEASUREMENTS)
        {
            measurements.Remove(measurements.First());
        }

        if (distanceText != null)
        {
            //update the text-labels, these should display the most accurate data instead of calculated values
            distanceText.text = givenDistance.ToString("0") + "m";
        }
    }
示例#32
0
        public void TestImportMeasurePoint_SameMainCell_DifferentOtherCells()
        {
            MeasurePoint mPoint =
                FakeMeasurePoint.GenerateMeasurePoint(
                    new IOutdoorCell[3] {
                mainCell, otherCell2, otherCell3
            },
                    new byte[3] {
                2, 1, 2
            },
                    new double[3] {
                -7, -12, -9
            });

            mpcRelation.ImportMeasurePoint(mPoint);
            Assert.AreEqual(mpcRelation.MainCell.ReceivePower, 0.299526, 1E-6);
            Assert.AreEqual(mpcRelation.MainCell.Cell.Azimuth, 10);
            Assert.AreEqual(mpcRelation.InterferenceCells.Count, 3);
            Assert.AreEqual(mpcRelation.InterferenceCells[0].Cell.Azimuth, 70);
            Assert.AreEqual(mpcRelation.InterferenceCells[0].ReceivePower, 0.063096, 1E-6);
            Assert.AreEqual(mpcRelation.InterferenceCells[1].Cell.Azimuth, 160);
            Assert.AreEqual(mpcRelation.InterferenceCells[2].Cell.Azimuth, 200);
        }
示例#33
0
        private void Measure()
        {
            Vector3 previousPosition = MeasurePoints[MeasurePoints.Count - 1].Position;
            Vector3 currentPosition  = gameObjectToTrack.transform.localPosition;

            double traveledDistance = Vector3.Distance(previousPosition, currentPosition);
            double averageSpeed     = traveledDistance / MeasurementIntervalInSeconds;

            pathLength += traveledDistance;

            MeasurePoint point = new MeasurePoint()
            {
                Position     = currentPosition,
                Rotation     = gameObjectToTrack.transform.localRotation,
                Second       = MeasurePoints.Count * MeasurementIntervalInSeconds,
                Meter        = pathLength,
                AverageSpeed = averageSpeed
            };

            MeasurePoints.Add(point);

            newMeasureCallback(point);
        }
 public void TestInitialize()
 {
     measurePoint = new MeasurePoint(position);
     budget = new LinkBudget(model);
 }
示例#35
0
 /// <summary>
 /// Конструктор.
 /// </summary>
 /// <param name="core"></param>
 /// <param name="measurePoint"></param>
 public MeasurePointPoller(MobileCore core, MeasurePoint measurePoint)
 {
     this.core         = core ?? throw new ArgumentNullException(nameof(core));
     this.measurePoint = measurePoint ?? throw new ArgumentNullException(nameof(measurePoint));
 }
示例#36
0
 protected void Initialize()
 {
     budgetList = new List<ILinkBudget<double>>();
     model = new BroadcastModel();
     outdoorCellList = new List<IOutdoorCell>();
     measurablePoint = new MeasurePoint();
 }