private static void AddProgramPausedValue(string prefix, DataTable table, List <DataItem> dataItems)
        {
            // Add Value
            string valuePrefix = prefix + "/Value||01";

            DeviceConfiguration.EditTable(table, valuePrefix, null, "id||01;");

            // Add Triggers
            string triggerPrefix = valuePrefix + "/Triggers";

            // Availability
            var item = dataItems.Find(x => x.Category == DataItemCategory.EVENT && x.Type == "AVAILABILITY");

            if (item != null)
            {
                DeviceConfiguration.EditTable(table, triggerPrefix + "/Trigger||00", null, "id||00;link||" + item.Id + ";link_type||ID;value||AVAILABLE;");
            }

            // Emergency Stop
            item = dataItems.Find(x => x.Category == DataItemCategory.EVENT && x.Type == "EMERGENCY_STOP");
            if (item != null)
            {
                DeviceConfiguration.EditTable(table, triggerPrefix + "/Trigger||01", null, "id||01;link||" + item.Id + ";link_type||ID;value||ARMED;");
            }

            // System
            item = dataItems.Find(x => x.Category == DataItemCategory.CONDITION && x.Type == "SYSTEM" && x.FullAddress.ToLower().Contains("controller"));
            if (item != null)
            {
                DeviceConfiguration.EditTable(table, triggerPrefix + "/Trigger||02", null, "id||02;link||" + item.Id + ";link_type||ID;modifier||NOT;value||Fault;");
            }

            // Controller Mode
            item = dataItems.Find(x => x.Category == DataItemCategory.EVENT && x.Type == "CONTROLLER_MODE");
            if (item != null)
            {
                DeviceConfiguration.EditTable(table, triggerPrefix + "/Trigger||03", null, "id||03;link||" + item.Id + ";link_type||ID;value||AUTOMATIC;");
            }

            // Execution Mode
            item = dataItems.Find(x => x.Category == DataItemCategory.EVENT && x.Type == "EXECUTION");
            if (item != null)
            {
                DeviceConfiguration.EditTable(table, triggerPrefix + "/MultiTrigger||00", null, "id||00;");
                DeviceConfiguration.EditTable(table, triggerPrefix + "/MultiTrigger||00/Trigger||00", null, "id||00;link||" + item.Id + ";link_type||ID;value||INTERRUPTED;");
                DeviceConfiguration.EditTable(table, triggerPrefix + "/MultiTrigger||00/Trigger||01", null, "id||01;link||" + item.Id + ";link_type||ID;value||FEED_HOLD;");
                DeviceConfiguration.EditTable(table, triggerPrefix + "/MultiTrigger||00/Trigger||02", null, "id||02;link||" + item.Id + ";link_type||ID;value||OPTIONAL_STOP;");
                DeviceConfiguration.EditTable(table, triggerPrefix + "/MultiTrigger||00/Trigger||03", null, "id||03;link||" + item.Id + ";link_type||ID;value||PROGRAM_STOPPED;");
            }

            // Program Name
            item = dataItems.Find(x => x.Category == DataItemCategory.EVENT && x.Type == "PROGRAM");
            if (item != null)
            {
                DeviceConfiguration.EditTable(table, triggerPrefix + "/Trigger||05", null, "id||05;link||" + item.Id + ";link_type||ID;modifier||not;value||;");
            }

            // Add Result
            DeviceConfiguration.EditTable(table, valuePrefix + "/Result", "Paused", "numval||1;");
        }
Esempio n. 2
0
        public static void Add(DataTable table, List <DataItem> dataItems)
        {
            DeviceConfiguration.EditTable(table, "/Cycles/CycleEventName", "cycle_execution", null);
            DeviceConfiguration.EditTable(table, "/Cycles/StoppedEventValue", "Stopped", null);

            var item = dataItems.Find(x => x.Category == DataItemCategory.EVENT && x.Type == "PROGRAM");

            if (item != null)
            {
                DeviceConfiguration.EditTable(table, "/Cycles/CycleNameLink", item.Id, null);
            }

            // Add Production Types
            DeviceConfiguration.EditTable(table, "/Cycles/ProductionTypes/Value||00", null, "id||00;name||Started;type||IN_PRODUCTION;");
            DeviceConfiguration.EditTable(table, "/Cycles/ProductionTypes/Value||01", null, "id||01;name||Paused;type||PAUSED;");
            DeviceConfiguration.EditTable(table, "/Cycles/ProductionTypes/Value||02", null, "id||02;name||Stopped;type||STOPPED;");

            // Add Override Values
            var ovrItems = dataItems.FindAll(x => x.Category == DataItemCategory.EVENT && x.Type == "PATH_FEEDRATE_OVERRIDE" && x.SubType != "JOG");

            if (ovrItems != null)
            {
                for (var x = 0; x < ovrItems.Count; x++)
                {
                    DeviceConfiguration.EditTable(table, "/Cycles/OverrideLinks/Value||" + x.ToString("00"), ovrItems[x].Id, "id||" + x.ToString("00"));
                }
            }
        }
Esempio n. 3
0
 public static void Add(DataTable table, string address, string port, string deviceName)
 {
     DeviceConfiguration.EditTable(table, "/Agent/Address", address, null);
     DeviceConfiguration.EditTable(table, "/Agent/Port", port, null);
     DeviceConfiguration.EditTable(table, "/Agent/DeviceName", deviceName, null);
     DeviceConfiguration.EditTable(table, "/Agent/Heartbeat", 5000, null);
 }
Esempio n. 4
0
        private static void AddTimers(DataTable table, List <MTConnectDevices.DataItem> dataItems)
        {
            // Run Time
            var item = dataItems.Find(x => x.Category == DataItemCategory.SAMPLE && x.Type == "ACCUMULATED_TIME" && x.SubType == "x:RUNNING_TIME");

            if (item != null)
            {
                DeviceConfiguration.EditTable(table, "/GeneratedData/SnapShotData/Collected||90", null, "id||90;name||Day Run Time;link||" + item.Id + ";");
            }

            item = dataItems.Find(x => x.Category == DataItemCategory.SAMPLE && x.Type == "ACCUMULATED_TIME" && x.SubType == "x:TOTAL_RUNNING_TIME");
            if (item != null)
            {
                DeviceConfiguration.EditTable(table, "/GeneratedData/SnapShotData/Collected||91", null, "id||91;name||Total Run Time;link||" + item.Id + ";");
            }

            // Operating Time
            item = dataItems.Find(x => x.Category == DataItemCategory.SAMPLE && x.Type == "ACCUMULATED_TIME" && x.SubType == "x:OPERATING_TIME");
            if (item != null)
            {
                DeviceConfiguration.EditTable(table, "/GeneratedData/SnapShotData/Collected||92", null, "id||92;name||Day Operating Time;link||" + item.Id + ";");
            }

            item = dataItems.Find(x => x.Category == DataItemCategory.SAMPLE && x.Type == "ACCUMULATED_TIME" && x.SubType == "x:TOTAL_OPERATING_TIME");
            if (item != null)
            {
                DeviceConfiguration.EditTable(table, "/GeneratedData/SnapShotData/Collected||93", null, "id||93;name||Total Operating Time;link||" + item.Id + ";");
            }

            // Cutting Time
            item = dataItems.Find(x => x.Category == DataItemCategory.SAMPLE && x.Type == "ACCUMULATED_TIME" && x.SubType == "x:CUTTING_TIME");
            if (item != null)
            {
                DeviceConfiguration.EditTable(table, "/GeneratedData/SnapShotData/Collected||94", null, "id||94;name||Day Cutting Time;link||" + item.Id + ";");
            }

            item = dataItems.Find(x => x.Category == DataItemCategory.SAMPLE && x.Type == "ACCUMULATED_TIME" && x.SubType == "x:TOTAL_CUTTING_TIME");
            if (item != null)
            {
                DeviceConfiguration.EditTable(table, "/GeneratedData/SnapShotData/Collected||95", null, "id||95;name||Total Cutting Time;link||" + item.Id + ";");
            }

            // Spindle Run Time
            item = dataItems.Find(x => x.Category == DataItemCategory.SAMPLE && x.Type == "ACCUMULATED_TIME" && x.SubType == "x:SPINDLE_RUN_TIME");
            if (item != null)
            {
                DeviceConfiguration.EditTable(table, "/GeneratedData/SnapShotData/Collected||96", null, "id||96;name||Day Spindle Time;link||" + item.Id + ";");
            }

            item = dataItems.Find(x => x.Category == DataItemCategory.SAMPLE && x.Type == "ACCUMULATED_TIME" && x.SubType == "x:TOTAL_SPINDLE_RUN_TIME");
            if (item != null)
            {
                DeviceConfiguration.EditTable(table, "/GeneratedData/SnapShotData/Collected||97", null, "id||97;name||Total Spindle Time;link||" + item.Id + ";");
            }
        }
Esempio n. 5
0
        public static void Add(DataTable table, List <MTConnectDevices.DataItem> dataItems)
        {
            int e = 0;

            DeviceConfiguration.EditTable(table, "/Parts/Event||" + e.ToString("00"), null, "id||" + e.ToString("00") + ";");
            DeviceConfiguration.EditTable(table, "/Parts/Event||" + e.ToString("00") + "/EventName", "cycle_execution", null);
            DeviceConfiguration.EditTable(table, "/Parts/Event||" + e.ToString("00") + "/EventValue", "Stopped", null);
            DeviceConfiguration.EditTable(table, "/Parts/Event||" + e.ToString("00") + "/PreviousEventValue", "Started", null);
            DeviceConfiguration.EditTable(table, "/Parts/Event||" + e.ToString("00") + "/ValueType", "static_increment", null);
            DeviceConfiguration.EditTable(table, "/Parts/Event||" + e.ToString("00") + "/StaticIncrementValue", 1, null);
        }
        public static void Add(DataTable table, List <MTConnectDevices.DataItem> dataItems)
        {
            DeviceConfiguration.EditTable(table, "/GeneratedData/SnapShotData/Generated||00", null, "id||00;name||Device Status;link||device_status;");
            DeviceConfiguration.EditTable(table, "/GeneratedData/SnapShotData/Generated||01", null, "id||01;name||Production Status;link||production_status;");
            DeviceConfiguration.EditTable(table, "/GeneratedData/SnapShotData/Generated||02", null, "id||02;name||Program Execution;link||program_execution;");

            int id = 3;

            // Feedrate Overrides
            var items = dataItems.FindAll(x => x.Category == DataItemCategory.EVENT && x.Type == "PATH_FEEDRATE_OVERRIDE" && x.SubType == "PROGRAMMED" && x.TypePath.ToLower().Contains("controller"));

            if (items != null)
            {
                int i = 1;

                foreach (var item in items)
                {
                    DeviceConfiguration.EditTable(table, "/GeneratedData/SnapShotData/Collected||" + id.ToString("00"), null, "id||" + id.ToString("00") + ";name||Feedrate Override " + i.ToString("00") + ";link||" + item.Id + ";");
                    i++;
                    id++;
                }
            }

            // Rapidrate Overrides
            items = dataItems.FindAll(x => x.Category == DataItemCategory.EVENT && x.Type == "PATH_FEEDRATE_OVERRIDE" && x.SubType == "RAPID" && x.TypePath.ToLower().Contains("controller"));
            if (items != null)
            {
                int i = 1;

                foreach (var item in items)
                {
                    DeviceConfiguration.EditTable(table, "/GeneratedData/SnapShotData/Collected||" + id.ToString("00"), null, "id||" + id.ToString("00") + ";name||Rapid Override " + i.ToString("00") + ";link||" + item.Id + ";");
                    i++;
                    id++;
                }
            }

            // Spindle Overrides
            items = dataItems.FindAll(x => x.Category == DataItemCategory.EVENT && x.Type == "ROTARY_VELOCITY_OVERRIDE" && x.TypePath.ToLower().Contains("rotary"));
            if (items != null)
            {
                int i = 1;

                foreach (var item in items)
                {
                    DeviceConfiguration.EditTable(table, "/GeneratedData/SnapShotData/Collected||" + id.ToString("00"), null, "id||" + id.ToString("00") + ";name||Spindle Override " + i.ToString("00") + ";link||" + item.Id + ";");
                    i++;
                    id++;
                }
            }
        }
        public static void Add(DataTable table, List <DataItem> dataItems)
        {
            // Add Event
            string eventPrefix = "/GeneratedEvents/Event||02";

            DeviceConfiguration.EditTable(table, eventPrefix, null, "id||02;name||cycle_execution;");

            AddProgramStartedValue(eventPrefix, table, dataItems);
            AddProgramPausedValue(eventPrefix, table, dataItems);
            AddCaptureItems(eventPrefix, table, dataItems);

            // Add Default
            DeviceConfiguration.EditTable(table, eventPrefix + "/Default", "Stopped", "numval||0;");
        }
Esempio n. 8
0
        private static void SetDescription(DataTable table)
        {
            // Read IP Address
            string ip = DeviceConfiguration.GetTableValue(table, "/Agent/Address");

            if (!string.IsNullOrEmpty(ip))
            {
                DeviceConfiguration.EditTable(table, "/Description/Description", ip, null);
            }
            else
            {
                DeviceConfiguration.EditTable(table, "/Description/Description", string.Empty, null);
            }
        }
Esempio n. 9
0
        public static void Add(DataTable table, List <MTConnectDevices.DataItem> dataItems)
        {
            // Add Event
            string eventPrefix = "/GeneratedEvents/Event||00";

            //string eventPrefix = "/GeneratedData/GeneratedEvents/Event||00";
            DeviceConfiguration.EditTable(table, eventPrefix, null, "id||00;name||device_status;");

            AddActiveValue(eventPrefix, table, dataItems);
            AddIdleValue(eventPrefix, table, dataItems);

            // Add Default
            DeviceConfiguration.EditTable(table, eventPrefix + "/Default", "Alert", "numval||0;");
        }
Esempio n. 10
0
        public static void Add(DataTable table, List <DataItem> dataItems)
        {
            // Add Event
            string eventPrefix = "/GeneratedEvents/Event||01";

            DeviceConfiguration.EditTable(table, eventPrefix, null, "id||01;name||production_status;");

            AddSetupValue(eventPrefix, table, dataItems);
            AddTeardownValue(eventPrefix, table, dataItems);
            AddMaintenanceValue(eventPrefix, table, dataItems);
            AddProcessDevelopmentValue(eventPrefix, table, dataItems);

            // Add Default
            DeviceConfiguration.EditTable(table, eventPrefix + "/Default", "Production", "numval||0;");
        }
Esempio n. 11
0
        private static void AddPartsProducedValue(string prefix, DataTable table, MTConnectDevices.DataItem dataItem)
        {
            // Add Value
            string valuePrefix = prefix + "/Value||00";

            DeviceConfiguration.EditTable(table, valuePrefix, null, "id||00;");

            // Add Triggers
            string triggerPrefix = valuePrefix + "/Triggers";

            DeviceConfiguration.EditTable(table, triggerPrefix + "/Trigger||00", null, "id||00;link||" + dataItem.Id + ";link_type||ID;value||UNAVAILABLE;modifier||not;");

            // Add Result
            DeviceConfiguration.EditTable(table, valuePrefix + "/Result", "Parts Produced", "numval||1;");
        }
        private static void AddCaptureItems(string prefix, DataTable table, List <DataItem> dataItems)
        {
            string capturePrefix = prefix + "/Capture";

            var item = dataItems.Find(x => x.Category == DataItemCategory.EVENT && x.Type == "PROGRAM");

            if (item != null)
            {
                DeviceConfiguration.EditTable(table, capturePrefix + "/Item||00", null, "id||00;name||program_name;link||" + item.Id + ";");
            }

            item = dataItems.Find(x => x.Category == DataItemCategory.EVENT && x.Type == "EXECUTION");
            if (item != null)
            {
                DeviceConfiguration.EditTable(table, capturePrefix + "/Item||01", null, "id||01;name||execution_mode;link||" + item.Id + ";");
            }
        }
Esempio n. 13
0
        private static void AddIdleValue(string prefix, DataTable table, List <MTConnectDevices.DataItem> dataItems)
        {
            // Add Value
            string valuePrefix = prefix + "/Value||01";

            DeviceConfiguration.EditTable(table, valuePrefix, null, "id||01;");

            // Add Triggers
            string triggerPrefix = valuePrefix + "/Triggers";

            int i = 0;

            var item = dataItems.Find(x => x.Category == DataItemCategory.EVENT && x.Type == "AVAILABILITY");

            if (item != null)
            {
                DeviceConfiguration.EditTable(table, triggerPrefix + "/Trigger||" + i.ToString("00"), null, "id||" + i.ToString("00") + ";link||" + item.Id + ";link_type||ID;value||AVAILABLE;");
                i++;
            }

            item = dataItems.Find(x => x.Category == DataItemCategory.EVENT && x.Type == "EMERGENCY_STOP");
            if (item != null)
            {
                DeviceConfiguration.EditTable(table, triggerPrefix + "/Trigger||" + i.ToString("00"), null, "id||" + i.ToString("00") + ";link||" + item.Id + ";link_type||ID;value||ARMED;");
                i++;
            }

            // Add any Controller/Path Faults
            var items = dataItems.FindAll(x => x.Category == DataItemCategory.CONDITION &&
                                          (x.Type == "SYSTEM" || x.Type == "LOGIC_PROGRAM" || x.Type == "MOTION_PROGRAM") &&
                                          (x.TypePath.ToLower().Contains("controller") || x.TypePath.ToLower().Contains("path")));

            if (items != null)
            {
                foreach (var item1 in items)
                {
                    DeviceConfiguration.EditTable(table, triggerPrefix + "/Trigger||" + i.ToString("00"), null, "id||" + i.ToString("00") + ";link||" + item1.Id + ";link_type||ID;modifier||NOT;value||Fault;");
                    i++;
                }
            }

            // Add Result
            DeviceConfiguration.EditTable(table, valuePrefix + "/Result", "Idle", "numval||1;");
        }
Esempio n. 14
0
        public static void Add(DataTable table, List <MTConnectDevices.DataItem> dataItems)
        {
            DeviceConfiguration.EditTable(table, "/OEE/OperatingEventName", "device_status", null);
            DeviceConfiguration.EditTable(table, "/OEE/OperatingEventValue", "Active", null);

            int i = 0;

            // Add Feedrate Override Values
            var items = dataItems.FindAll(x => (x.Category == DataItemCategory.EVENT && x.Type == "PATH_FEEDRATE_OVERRIDE" && x.SubType == "PROGRAMMED") ||
                                          (x.Category == DataItemCategory.SAMPLE && x.Type == "PATH_FEEDRATE" && x.Units == "PERCENT"));

            foreach (var item in items)
            {
                string format     = "id||{0};";
                string attributes = string.Format(format, i.ToString("00"));

                DeviceConfiguration.EditTable(table, "/OEE/Overrides/Override||" + i.ToString("00"), "Feedrate Override " + (i + 1).ToString(), attributes);
                i++;
            }
        }
Esempio n. 15
0
        public static void Add(DataTable table, List <DataItem> dataItems)
        {
            int i = 0;

            // Add Feedrate Override Values
            var items = dataItems.FindAll(x => (x.Category == DataItemCategory.EVENT && x.Type == "PATH_FEEDRATE_OVERRIDE" && x.SubType == "PROGRAMMED") ||
                                          (x.Category == DataItemCategory.SAMPLE && x.Type == "PATH_FEEDRATE" && x.Units == "PERCENT"));

            foreach (var item in items)
            {
                string format     = "id||{0};name||{1};link||{2};type||feedrate_override;";
                string attributes = string.Format(format, i.ToString("00"), "Feedrate Override " + (i + 1).ToString(), item.Id);

                DeviceConfiguration.EditTable(table, "/Overrides/Override||" + i.ToString("00"), null, attributes);
                i++;
            }

            // Add Spindle Override Values
            items = dataItems.FindAll(x => (x.Category == DataItemCategory.EVENT && x.Type == "ROTARY_VELOCITY_OVERRIDE" && x.SubType == "PROGRAMMED") ||
                                      (x.Category == DataItemCategory.SAMPLE && x.Type == "SPINDLE_SPEED" && x.Units == "PERCENT"));
            foreach (var item in items)
            {
                string format     = "id||{0};name||{1};link||{2};type||spindle_override;";
                string attributes = string.Format(format, i.ToString("00"), "Spindle Override " + (i + 1).ToString(), item.Id);

                DeviceConfiguration.EditTable(table, "/Overrides/Override||" + i.ToString("00"), null, attributes);
                i++;
            }

            // Add Rapid Override Values
            items = dataItems.FindAll(x => x.Category == DataItemCategory.EVENT && x.Type == "PATH_FEEDRATE_OVERRIDE" && x.SubType == "RAPID");
            foreach (var item in items)
            {
                string format     = "id||{0};name||{1};link||{2};type||rapid_override;";
                string attributes = string.Format(format, i.ToString("00"), "Rapid Override " + (i + 1).ToString(), item.Id);

                DeviceConfiguration.EditTable(table, "/Overrides/Override||" + i.ToString("00"), null, attributes);
                i++;
            }
        }
Esempio n. 16
0
        public static void Add(DataTable table, MTConnectDevices.Device device)
        {
            if (device.Description != null)
            {
                DeviceConfiguration.EditTable(table, "/Description/Manufacturer", Trim(device.Description.Manufacturer), null);
                DeviceConfiguration.EditTable(table, "/Description/Model", Trim(device.Description.Model), null);
                DeviceConfiguration.EditTable(table, "/Description/Serial", Trim(device.Description.SerialNumber), null);
                DeviceConfiguration.EditTable(table, "/Description/Description", Trim(device.Description.CDATA), null);

                if (!string.IsNullOrEmpty(device.Description.Manufacturer))
                {
                    string logoUrl = new Uri("https://images.trakhound.com/device-image?manufacturer=" + device.Description.Manufacturer).ToString();
                    DeviceConfiguration.EditTable(table, "/Description/LogoUrl", logoUrl, null);

                    if (!string.IsNullOrEmpty(device.Description.Model))
                    {
                        string imageUrl = new Uri("https://images.trakhound.com/device-image?manufacturer=" + device.Description.Manufacturer + "&model=" + device.Description.Model).ToString();
                        DeviceConfiguration.EditTable(table, "/Description/ImageUrl", imageUrl, null);
                    }
                }
            }
        }
Esempio n. 17
0
        private static void AddProcessDevelopmentValue(string prefix, DataTable table, List <DataItem> dataItems)
        {
            // Only add if there is a Functional Mode tag available
            if (dataItems.Exists(x => x.Category == DataItemCategory.EVENT && x.Type == "FUNCTIONAL_MODE"))
            {
                // Add Value
                string valuePrefix = prefix + "/Value||03";
                DeviceConfiguration.EditTable(table, valuePrefix, null, "id||03;");

                // Add Triggers
                string triggerPrefix = valuePrefix + "/Triggers";

                var item = dataItems.Find(x => x.Category == DataItemCategory.EVENT && x.Type == "FUNCTIONAL_MODE");
                if (item != null)
                {
                    DeviceConfiguration.EditTable(table, triggerPrefix + "/Trigger||00", null, "id||00;link||" + item.Id + ";link_type||ID;value||PROCESS_DEVELOPMENT;");
                }

                // Add Result
                DeviceConfiguration.EditTable(table, valuePrefix + "/Result", "Process Development", "numval||4;");
            }
        }
Esempio n. 18
0
        private static void AddMaintenanceValue(string prefix, DataTable table, List <DataItem> dataItems)
        {
            // Only add if there is a Functional Mode tag available
            if (dataItems.Exists(x => x.Category == DataItemCategory.EVENT && x.Type == "FUNCTIONAL_MODE"))
            {
                // Add Value
                string valuePrefix = prefix + "/Value||02";
                DeviceConfiguration.EditTable(table, valuePrefix, null, "id||02;");

                // Add Triggers
                string triggerPrefix = valuePrefix + "/Triggers";

                var item = dataItems.Find(x => x.Category == DataItemCategory.EVENT && x.Type == "FUNCTIONAL_MODE");
                if (item != null)
                {
                    DeviceConfiguration.EditTable(table, triggerPrefix + "/Trigger||00", null, "id||00;link||" + item.Id + ";link_type||ID;value||MAINTENANCE;");
                }

                // Add Result
                DeviceConfiguration.EditTable(table, valuePrefix + "/Result", "Maintenance", "numval||3");
            }
        }
Esempio n. 19
0
        public static void Add(DataTable table, List <MTConnectDevices.DataItem> dataItems)
        {
            int i = 1;
            int e = 3;

            var partCountItems = dataItems.FindAll(x => x.Category == DataItemCategory.EVENT && x.Type == "PART_COUNT");

            foreach (var partCountItem in partCountItems)
            {
                // Add Event
                string eventPrefix = "/GeneratedEvents/Event||" + e.ToString("00");
                DeviceConfiguration.EditTable(table, eventPrefix, null, "id||" + e.ToString("00") + ";name||parts_count_" + i.ToString() + ";");

                AddPartsProducedValue(eventPrefix, table, partCountItem);
                AddCaptureItems(eventPrefix, table, partCountItem);

                // Add Default
                DeviceConfiguration.EditTable(table, eventPrefix + "/Default", "No Parts Produced", "numval||0;");

                i++;
                e++;
            }
        }
 private static void SetIds(DataTable table)
 {
     DeviceConfiguration.EditTable(table, "/UniqueId", DeviceConfiguration.GenerateUniqueID(), null);
     DeviceConfiguration.EditTable(table, "/UpdateId", DeviceConfiguration.GenerateUniqueID(), null);
 }
        private static void AddActiveValue(string prefix, DataTable table, List <DataItem> dataItems)
        {
            // Add Value
            string valuePrefix = prefix + "/Value||00";

            DeviceConfiguration.EditTable(table, valuePrefix, null, "id||00;");

            // Add Triggers
            string triggerPrefix = valuePrefix + "/Triggers";

            int i = 0;

            // Availability
            var item = dataItems.Find(x => x.Category == DataItemCategory.EVENT && x.Type == "AVAILABILITY");

            if (item != null)
            {
                DeviceConfiguration.EditTable(table, triggerPrefix + "/Trigger||" + i.ToString("00"), null, "id||" + i.ToString("00") + ";link||" + item.Id + ";link_type||ID;value||AVAILABLE;");
                i++;
            }

            // Emergency Stop
            item = dataItems.Find(x => x.Category == DataItemCategory.EVENT && x.Type == "EMERGENCY_STOP");
            if (item != null)
            {
                DeviceConfiguration.EditTable(table, triggerPrefix + "/Trigger||" + i.ToString("00"), null, "id||" + i.ToString("00") + ";link||" + item.Id + ";link_type||ID;value||ARMED;");
                i++;
            }

            // Add any Controller/Path Faults
            var items = dataItems.FindAll(x => x.Category == DataItemCategory.CONDITION &&
                                          (x.Type == "SYSTEM" || x.Type == "LOGIC_PROGRAM" || x.Type == "MOTION_PROGRAM") &&
                                          (x.FullAddress.ToLower().Contains("controller") || x.FullAddress.ToLower().Contains("path")));

            if (items != null)
            {
                foreach (var item1 in items)
                {
                    DeviceConfiguration.EditTable(table, triggerPrefix + "/Trigger||" + i.ToString("00"), null, "id||" + i.ToString("00") + ";link||" + item1.Id + ";link_type||ID;modifier||NOT;value||Fault;");
                    i++;
                }
            }

            // Controller Mode
            item = dataItems.Find(x => x.Category == DataItemCategory.EVENT && x.Type == "CONTROLLER_MODE");
            if (item != null)
            {
                DeviceConfiguration.EditTable(table, triggerPrefix + "/Trigger||" + i.ToString("00"), null, "id||" + i.ToString("00") + ";link||" + item.Id + ";link_type||ID;value||AUTOMATIC;");
                i++;
            }

            // Execution Mode
            item = dataItems.Find(x => x.Category == DataItemCategory.EVENT && x.Type == "EXECUTION");
            if (item != null)
            {
                DeviceConfiguration.EditTable(table, triggerPrefix + "/Trigger||" + i.ToString("00"), null, "id||" + i.ToString("00") + ";link||" + item.Id + ";link_type||ID;value||ACTIVE;");
                i++;
            }

            // Add Result
            DeviceConfiguration.EditTable(table, valuePrefix + "/Result", "Active", "numval||2;");
        }
 private static void SetEnabled(DataTable table)
 {
     DeviceConfiguration.EditTable(table, "/Enabled", true, null);
 }
Esempio n. 23
0
        private static void AddCaptureItems(string prefix, DataTable table, MTConnectDevices.DataItem dataItem)
        {
            string capturePrefix = prefix + "/Capture";

            DeviceConfiguration.EditTable(table, capturePrefix + "/Item||00", null, "id||00;name||part_count;link||" + dataItem.Id + ";");
        }