void ReleaseDesignerOutlets()
        {
            if (HistoryGraph != null)
            {
                HistoryGraph.Dispose();
                HistoryGraph = null;
            }

            if (InventoryIDLabel != null)
            {
                InventoryIDLabel.Dispose();
                InventoryIDLabel = null;
            }

            if (MachineStatesLogTable != null)
            {
                MachineStatesLogTable.Dispose();
                MachineStatesLogTable = null;
            }

            if (SensorSettingsButon != null)
            {
                SensorSettingsButon.Dispose();
                SensorSettingsButon = null;
            }

            if (ServiceButton != null)
            {
                ServiceButton.Dispose();
                ServiceButton = null;
            }
        }
Esempio n. 2
0
        //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        public override void ViewWillAppear(bool animated)
        {
            Title = Application.selectedMachine.name;

            base.ViewWillAppear(animated);

            UpdateViewValues();

            SetLayout();

            DataManager.SheduleGetMachineStatesLogRequest(Application.selectedMachine, Settings.machineStatesLogMaxElements, DataUpdateCallback);
            lastUpdateTime = DateTime.Now;

            sensorHistoryTimeStart = DateTime.Now.AddDays(-1);
            sensorHistoryTimeEnd   = DateTime.Now;

            HistoryGraph.SetData(sensorHistoryList, sensorHistoryTimeStart, sensorHistoryTimeEnd);

            if (Application.selectedMachine.sensors.Count != 0)
            {
                DataManager.SheduleGetSensorHistoryDataRequest(Application.selectedMachine.sensors[0], (byte)SensorValueArrayIndexes.MainValue, sensorHistoryTimeStart, sensorHistoryTimeEnd, Settings.sensorHistoryPointsCount, DataUpdateCallback);
            }

            Application.StartUpdateTimer(CheckNewData);
        }
Esempio n. 3
0
        public HistoryGraph GetGraph()
        {
            var history   = new HistoryGraph();
            var pump1list = _context.History.Where(x => x.Mrid == "Flow_AM1").ToList();

            pump1list.Skip(Math.Max(0, pump1list.Count() - 30)).ToList().ForEach(x => {
                history.Pump1.XAxe.Add(DateTime.Parse(x.TimeStamp));
                history.Pump1.YAxe.Add(x.Value);
            });
            var pump2list = _context.History.Where(x => x.Mrid == "Flow_AM2").ToList();

            pump2list.Skip(Math.Max(0, pump2list.Count() - 30)).ToList().ForEach(x => {
                history.Pump2.XAxe.Add(DateTime.Parse(x.TimeStamp));
                history.Pump2.YAxe.Add(x.Value);
            });
            var pump3list = _context.History.Where(x => x.Mrid == "Flow_AM3").ToList();

            pump3list.Skip(Math.Max(0, pump3list.Count() - 30)).ToList().ForEach(x => {
                history.Pump3.XAxe.Add(DateTime.Parse(x.TimeStamp));
                history.Pump3.YAxe.Add(x.Value);
            });

            var fluidlist = _context.History.Where(x => x.Mrid == "FluidLevel_Tank").ToList();

            fluidlist.Skip(Math.Max(0, fluidlist.Count() - 30)).ToList().ForEach(x => {
                history.FluidLevel.XAxe.Add(DateTime.Parse(x.TimeStamp));
                history.FluidLevel.YAxe.Add(x.Value);
            });
            return(history);
        }
Esempio n. 4
0
    public LogicEngine(ISettings _settings, string projectName)
    {
        settings = _settings;
        string rules = FileReader.ReadFile(Path.Combine(GetRulesDirectory(projectName), projectName + RulesSuffix + rulesExtension));

        historyGraph = (HistoryGraph)LogicOperations.GetHistoryGraph(rules);
        SetStates(projectName);
    }
Esempio n. 5
0
        //----------------------------------------------------------------------------------------------------------------------------------------------------------------------
        public void UpdateViewValues()
        {
            InventoryIDLabel.Text = "Инв. №: " + Application.selectedMachine.inventoryID;
            if (Application.selectedMachine.sensors.Count != 0)
            {
                InventoryIDLabel.Text += " (" + BitConverter.ToString(BitConverter.GetBytes(Application.selectedMachine.sensors[0].nodeID), 1, 1)
                                         + BitConverter.ToString(BitConverter.GetBytes(Application.selectedMachine.sensors[0].nodeID), 0, 1) + ")";
            }
            MachineStatesLogTable.ReloadData();

            HistoryGraph.SetNeedsDisplay();
        }
Esempio n. 6
0
        //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        public void CheckNewData()
        {
            if (DataManager.ConnectState == ConnectStates.AuthPassed)
            {
                Title = Application.selectedMachine.name;
            }
            else if (DataManager.ConnectState == ConnectStates.SocketConnected)
            {
                Title = "Нет авторизации";
            }
            else
            {
                Title = "Нет связи";
            }

            if ((HistoryGraph.readyToDataUpdate == true) && ((sensorHistoryTimeStart != HistoryGraph.timeStart) || (sensorHistoryTimeEnd != HistoryGraph.timeEnd)))
            {
                HistoryGraph.readyToDataUpdate = false;

                sensorHistoryTimeStart = HistoryGraph.timeStart;
                sensorHistoryTimeEnd   = HistoryGraph.timeEnd;

                if (Application.selectedMachine.sensors.Count != 0)
                {
                    DataManager.SheduleGetSensorHistoryDataRequest(Application.selectedMachine.sensors[0], (byte)SensorValueArrayIndexes.MainValue, sensorHistoryTimeStart, sensorHistoryTimeEnd, Settings.sensorHistoryPointsCount, DataUpdateCallback);
                }
            }

            if (needHistoryGraphRedraw == true)
            {
                needHistoryGraphRedraw = false;
                HistoryGraph.SetNeedsDisplay();
            }

            if (needDataUpdate > 0)
            {
                needDataUpdate--;
                UpdateViewValues();
            }
            else if ((DateTime.Now.Subtract(lastUpdateTime).TotalMilliseconds > Settings.updatePeriodMs) && (DataManager.machineTypes.Count != 0) && (DataManager.NotAnsweredRequestsCount == 0))
            {
                DataManager.SheduleGetMachineStatesLogRequest(Application.selectedMachine, Settings.machineStatesLogMaxElements, DataUpdateCallback);

                lastUpdateTime = DateTime.Now;
            }
        }