private MTConnect.Application.Components.ReturnData GetProbe(Data.AgentInfo config) { MTConnect.Application.Components.ReturnData result = null; string address = config.Address; int port = config.Port; string deviceName = config.DeviceName; // Set Proxy Settings var proxy = new HTTP.ProxySettings(); proxy.Address = config.ProxyAddress; proxy.Port = config.ProxyPort; DateTime requestTimestamp = DateTime.Now; string url = HTTP.GetUrl(address, port, deviceName) + "probe"; result = MTConnect.Application.Components.Requests.Get(url, proxy, 2000, 1); if (result != null) { if (verbose) Logger.Log("Probe Successful : " + url + " @ " + requestTimestamp.ToString("o"), LogLineType.Console); } else { Logger.Log("Probe Error : " + url + " @ " + requestTimestamp.ToString("o") + " : Retrying in " + (config.Heartbeat / 1000) + " sec.."); } return result; }
public DeviceDescription(Data.DeviceInfo deviceInfo) { UniqueId = deviceInfo.UniqueId; Enabled = deviceInfo.Enabled; Index = deviceInfo.Index; Description = deviceInfo.Description; Agent = deviceInfo.Agent; }
public void Add(Data.DeviceInfo deviceInfo) { lock (_lock) { if (deviceInfo != null) { int index = queuedInfos.FindIndex(o => o.UniqueId == deviceInfo.UniqueId); if (index >= 0) queuedInfos[index] = deviceInfo; else queuedInfos.Add(deviceInfo); } } }
public void UpdateData(Data.ControllerInfo info) { if (info != null) { Availability = info.Availability; //EmergencyStop = info.EmergencyStop; ControllerMode = info.ControllerMode; ExecutionMode = info.ExecutionMode; //Program = info.ProgramName; //Block = info.ProgramBlock; //Line = info.ProgramLine; //if (!string.IsNullOrEmpty(info.SystemStatus)) SystemStatus = info.SystemStatus; //SystemMessage = info.SystemMessage; } }
public void UpdateData(Data.TimersInfo info) { if (info != null) { double total = info.Total; double active = info.Active; double idle = info.Idle; double alert = info.Alert; if (total > 0) { ActivePercentage = active / total; IdlePercentage = idle / total; AlertPercentage = alert / total; } if (active > idle && active > alert) Status = 2; else if (idle > alert && idle > active) Status = 1; else Status = 0; ActiveTime = TimeSpan.FromSeconds(Math.Min(active, double.MaxValue)); IdleTime = TimeSpan.FromSeconds(Math.Min(idle, double.MaxValue)); AlertTime = TimeSpan.FromSeconds(Math.Min(alert, double.MaxValue)); } }
public void UpdateData(Data.StatusInfo info) { if (info != null) { if (!string.IsNullOrEmpty(info.DeviceStatus)) { switch (info.DeviceStatus.ToLower()) { case "active": StatusBrush = Brush_Functions.GetSolidBrushFromResource(this, "StatusGreen"); break; case "idle": StatusBrush = Brush_Functions.GetSolidBrushFromResource(this, "StatusOrange"); break; case "alert": StatusBrush = Brush_Functions.GetSolidBrushFromResource(this, "StatusRed"); break; default: StatusBrush = Brush_Functions.GetSolidBrushFromResource(this, "Disabled"); break; } } else StatusBrush = Brush_Functions.GetSolidBrushFromResource(this, "Disabled"); Connected = info.Connected == 1; if (!string.IsNullOrEmpty(info.DeviceStatus)) DeviceStatus = info.DeviceStatus; } }
private void UpdateDeviceInfo(Data.TimersInfo info) { if (info != null) { ActiveTime = TimeSpan.FromSeconds(Math.Min(info.Active, double.MaxValue)); IdleTime = TimeSpan.FromSeconds(Math.Min(info.Idle, double.MaxValue)); AlertTime = TimeSpan.FromSeconds(Math.Min(info.Alert, double.MaxValue)); if (info.Total > 0) { ActivePercentage = info.Active / info.Total; IdlePercentage = info.Idle / info.Total; AlertPercentage = info.Alert / info.Total; } int i = -1; // Update Active Pie Chart Value i = DeviceStatusPieChartData.ToList().FindIndex(o => o.ID == "Active"); if (i >= 0) DeviceStatusPieChartData[i].Value = Math.Min(ActivePercentage, double.MaxValue); // Update Idle Pie Chart Value i = DeviceStatusPieChartData.ToList().FindIndex(o => o.ID == "Idle"); if (i >= 0) DeviceStatusPieChartData[i].Value = Math.Min(IdlePercentage, double.MaxValue); // Update Alert Pie Chart Value i = DeviceStatusPieChartData.ToList().FindIndex(o => o.ID == "Alert"); if (i >= 0) DeviceStatusPieChartData[i].Value = Math.Min(AlertPercentage, double.MaxValue); } }
private void UpdateDeviceInfo(Data.ControllerInfo info) { if (info != null) { EmergencyStop = info.EmergencyStop; ControllerMode = info.ControllerMode; ExecutionMode = info.ExecutionMode; Program = info.ProgramName; ProgramLine = info.ProgramLine; ProgramBlock = info.ProgramBlock; SystemStatus = info.SystemStatus; SystemMessage = info.SystemMessage; } }
public void UpdateData(Data.StatusInfo info) { if (info != null) { Connected = info.Connected == 1; if (!string.IsNullOrEmpty(info.DeviceStatus)) DeviceStatus = info.DeviceStatus; if (!string.IsNullOrEmpty(info.ProductionStatus)) ProductionStatus = info.ProductionStatus; DayRunTime = TimeSpan.FromSeconds(info.DayRun); DayOperatingTime = TimeSpan.FromSeconds(info.DayOperating); DayCuttingTime = TimeSpan.FromSeconds(info.DayCutting); DaySpindleTime = TimeSpan.FromSeconds(info.DaySpindle); TotalRunTime = info.TotalRun / 3600; TotalOperatingTime = info.TotalOperating / 3600; TotalCuttingTime = info.TotalCutting / 3600; TotalSpindleTime = info.TotalSpindle / 3600; } }
private MTConnect.Application.Streams.ReturnData GetSample(Streams header, Data.AgentInfo ac, DeviceConfiguration config) { MTConnect.Application.Streams.ReturnData result = null; string address = ac.Address; int port = ac.Port; string deviceName = ac.DeviceName; // Set Proxy Settings var proxy = new HTTP.ProxySettings(); proxy.Address = ac.ProxyAddress; proxy.Port = ac.ProxyPort; SampleInfo info = GetSampleInfo(header, config); if (info != null) { if (info.Count > 0) { DateTime requestTimestamp = DateTime.Now; string url = HTTP.GetUrl(address, port, deviceName) + "sample?from=" + info.From.ToString() + "&count=" + info.Count.ToString(); result = MTConnect.Application.Streams.Requests.Get(url, proxy, ac.Heartbeat / 2, 2); if (result != null) { UpdateAgentData(header.InstanceId, info.From + info.Count); if (verbose) Logger.Log("Sample Successful : " + url + " @ " + requestTimestamp.ToString("o"), LogLineType.Console); } else { Logger.Log("Sample Error : " + url + " @ " + requestTimestamp.ToString("o")); } } else UpdateAgentData(header.InstanceId, header.LastSequence); } return result; }
public void Remove(Data.DeviceInfo deviceInfo) { lock (_lock) { if (deviceInfo != null) { int index = queuedInfos.FindIndex(o => o.UniqueId == deviceInfo.UniqueId); if (index >= 0) queuedInfos.RemoveAt(index); } } }
public static void InsertHourInfo(SQLiteConnection connection, string uniqueId, Data.HourInfo hourInfo) { string columnFormat = "`{0}`"; string valueFormat = "'{0}'"; string query = "INSERT OR REPLACE INTO `hours` (" + string.Format(columnFormat, "unique_id") + ", " + string.Format(columnFormat, "date") + ", " + string.Format(columnFormat, "hour") + ", " + string.Format(columnFormat, "planned_production_time") + ", " + string.Format(columnFormat, "operating_time") + ", " + string.Format(columnFormat, "ideal_operating_time") + ", " + string.Format(columnFormat, "total_pieces") + ", " + string.Format(columnFormat, "good_pieces") + ", " + string.Format(columnFormat, "active") + ", " + string.Format(columnFormat, "idle") + ", " + string.Format(columnFormat, "alert") + ", " + string.Format(columnFormat, "production") + ", " + string.Format(columnFormat, "setup") + ", " + string.Format(columnFormat, "teardown") + ", " + string.Format(columnFormat, "maintenance") + ", " + string.Format(columnFormat, "process_development") + ") VALUES (" + string.Format(valueFormat, uniqueId) + ", " + string.Format(valueFormat, hourInfo.Date) + ", " + string.Format(valueFormat, hourInfo.Hour) + ", " + string.Format(valueFormat, hourInfo.PlannedProductionTime) + ", " + string.Format(valueFormat, hourInfo.OperatingTime) + ", " + string.Format(valueFormat, hourInfo.IdealOperatingTime) + ", " + string.Format(valueFormat, hourInfo.TotalPieces) + ", " + string.Format(valueFormat, hourInfo.GoodPieces) + ", " + string.Format(valueFormat, hourInfo.Active) + ", " + string.Format(valueFormat, hourInfo.Idle) + ", " + string.Format(valueFormat, hourInfo.Alert) + ", " + string.Format(valueFormat, hourInfo.Production) + ", " + string.Format(valueFormat, hourInfo.Setup) + ", " + string.Format(valueFormat, hourInfo.Teardown) + ", " + string.Format(valueFormat, hourInfo.Maintenance) + ", " + string.Format(valueFormat, hourInfo.ProcessDevelopment) + ")"; Query.Run(connection, query); }
public void UpdateData(Data.StatusInfo info) { if (info != null) { Connected = info.Connected == 1; if (!string.IsNullOrEmpty(info.DeviceStatus)) DeviceStatus = info.DeviceStatus; } }
public void UpdateData(Data.OeeInfo info) { if (info != null) { Oee = info.Oee; Availability = info.Availability; Performance = info.Performance; Quality = info.Quality; } }
private void UpdateDeviceData(string uniqueId, Data.TimersInfo info) { var deviceInfo = cachedDevicesInfos.Find(o => o.UniqueId == uniqueId); if (deviceInfo == null) { deviceInfo = new Data.DeviceInfo(); deviceInfo.UniqueId = uniqueId; cachedDevicesInfos.Add(deviceInfo); } deviceInfo.Timers = info; }
public void UpdateData(Data.OeeInfo info) { if (info != null) { PartCount = info.TotalPieces; } }
public void UpdateData(Data.ControllerInfo info) { if (info != null) { if (!string.IsNullOrEmpty(info.EmergencyStop)) EmergencyStop = info.EmergencyStop; if (!string.IsNullOrEmpty(info.ControllerMode)) ControllerMode = info.ControllerMode; if (!string.IsNullOrEmpty(info.ExecutionMode)) ExecutionMode = info.ExecutionMode; Program = info.ProgramName; SystemStatus = info.SystemStatus; SystemMessage = info.SystemMessage; } }
private void UpdateDeviceInfo(Data.StatusInfo info) { if (info != null) { Connected = info.Connected == 1; if (!string.IsNullOrEmpty(info.DeviceStatus)) DeviceStatus = info.DeviceStatus; DeviceStatusTime = TimeSpan.FromSeconds(info.DeviceStatusTimer); } }
public void UpdateData(Data.StatusInfo info) { if (info != null) { Connected = info.Connected == 1; if (!string.IsNullOrEmpty(info.DeviceStatus)) DeviceStatus = info.DeviceStatus; if (!string.IsNullOrEmpty(info.ProductionStatus)) ProductionStatus = info.ProductionStatus; DeviceStatusTime = TimeSpan.FromSeconds(info.DeviceStatusTimer); } }
private void UpdateDeviceInfo(Data.OeeInfo info) { if (info != null) { Oee = info.Oee; Availability = info.Availability; Performance = info.Performance; Quality = info.Quality; } }
public void UpdateData(Data.OeeInfo info) { if (info != null) { Oee = info.Oee * 100; Availability = info.Availability * 100; Performance = info.Performance * 100; Quality = info.Quality * 100; PartCount = info.TotalPieces; } }
public Page(DeviceDescription device, Data.DeviceInfo deviceInfo, UserConfiguration userConfig) { InitializeComponent(); root.DataContext = this; UserConfiguration = userConfig; Device = device; // Active Hour Segments ActiveHourDatas = new List<HourData>(); for (var x = 0; x < 24; x++) ActiveHourDatas.Add(new HourData(x, x + 1)); // Idle Hour Segments IdleHourDatas = new List<HourData>(); for (var x = 0; x < 24; x++) IdleHourDatas.Add(new HourData(x, x + 1)); // Alert Hour Segments AlertHourDatas = new List<HourData>(); for (var x = 0; x < 24; x++) AlertHourDatas.Add(new HourData(x, x + 1)); // Oee Hour Segments OeeHourDatas = new List<HourData>(); for (var x = 0; x < 24; x++) OeeHourDatas.Add(new HourData(x, x + 1)); // Availability Hour Segments AvailabilityHourDatas = new List<HourData>(); for (var x = 0; x < 24; x++) AvailabilityHourDatas.Add(new HourData(x, x + 1)); // Performance Hour Segments PerformanceHourDatas = new List<HourData>(); for (var x = 0; x < 24; x++) PerformanceHourDatas.Add(new HourData(x, x + 1)); // Quality Hour Segments QualityHourDatas = new List<HourData>(); for (var x = 0; x < 24; x++) QualityHourDatas.Add(new HourData(x, x + 1)); // Parts Count Hour Segments PartCountHourDatas = new List<HourData>(); for (var x = 0; x < 24; x++) PartCountHourDatas.Add(new HourData(x, x + 1)); // Initialize Device Status Pie Chart DeviceStatusPieChartData.Clear(); DeviceStatusPieChartData.Add(new PieChartData("Active")); DeviceStatusPieChartData.Add(new PieChartData("Idle")); DeviceStatusPieChartData.Add(new PieChartData("Alert")); if (deviceInfo != null) { UpdateDeviceInfo(deviceInfo.Status); UpdateDeviceInfo(deviceInfo.Controller); UpdateDeviceInfo(deviceInfo.Oee); UpdateDeviceInfo(deviceInfo.Timers); UpdateDeviceInfo(deviceInfo.Hours); } Loading = false; }
public void UpdateData(Data.TimersInfo info) { if (info != null) { double total = info.Total; // Device Status double active = info.Active; double idle = info.Idle; double alert = info.Alert; if (total > 0) { ActivePercentage = (active / total) * 100; IdlePercentage = (idle / total) * 100; AlertPercentage = (alert / total) * 100; } ActiveTime = TimeSpan.FromSeconds(Math.Min(active, double.MaxValue)); IdleTime = TimeSpan.FromSeconds(Math.Min(idle, double.MaxValue)); AlertTime = TimeSpan.FromSeconds(Math.Min(alert, double.MaxValue)); // Production Status double production = info.Production; double setup = info.Setup; double teardown = info.Teardown; double maintenance = info.Maintenance; double processDevelopment = info.ProcessDevelopment; if (total > 0) { ProductionPercentage = (production / total) * 100; SetupPercentage = (setup / total) * 100; TeardownPercentage = (teardown / total) * 100; MaintenancePercentage = (maintenance / total) * 100; ProcessDevelopmentPercentage = (processDevelopment / total) * 100; } ProductionTime = TimeSpan.FromSeconds(Math.Min(production, double.MaxValue)); SetupTime = TimeSpan.FromSeconds(Math.Min(setup, double.MaxValue)); TeardownTime = TimeSpan.FromSeconds(Math.Min(teardown, double.MaxValue)); MaintenanceTime = TimeSpan.FromSeconds(Math.Min(maintenance, double.MaxValue)); ProcessDevelopmentTime = TimeSpan.FromSeconds(Math.Min(processDevelopment, double.MaxValue)); } }
public void UpdateData(Data.ControllerInfo info) { if (info != null) { Availability = info.Availability; ControllerMode = info.ControllerMode; ExecutionMode = info.ExecutionMode; } }
public void UpdateData(Data.TimersInfo info) { if (info != null) { TotalSeconds = info.Total; ProductionSeconds = info.Production; SetupSeconds = info.Setup; TeardownSeconds = info.Teardown; MaintenanceSeconds = info.Maintenance; ProcessDevelopmentSeconds = info.ProcessDevelopment; } }