Exemplo n.º 1
0
        public List <string> GetManuallyEditableDevices(AceModelRestricted model)
        {
            List <string> editableList = new List <string>();
            var           manualDevs   = (from e in model.GetDevices()
                                          where (e is ModelDeviceSample) && (e.StaticallyDefined == true)
                                          select string.Format(Consts.EDITABLE_FORMATE, Consts.SAMPLE_INSTRUMENT, e.VisaName)).ToList <string>();
            var manualIntfcs = (from e in model.GetInterfaces()
                                where (e is ModelInterfaceSample)
                                select string.Format(Consts.EDITABLE_FORMATE, Consts.SAMPLE_INTERFACE, e.VisaName)).ToList <string>();

            editableList.AddRange(manualDevs);
            editableList.AddRange(manualIntfcs);
            return(editableList);
        }
Exemplo n.º 2
0
        private ModelElement GenerateAddingInterface(AceModelRestricted model)
        {
            var intfc            = new ModelInterfaceSample();
            var activeInterfaces = model.GetInterfaces().Where(i => i.AgentName == AgentId).Select(e => e as ModelInterfaceSample)
                                   .OrderBy(i => i.VisaInterfaceId.ToUpper(), new SampleIOAgentComparer(Consts.VISA_PRIFIX));
            var latestVisaInterface = activeInterfaces.LastOrDefault();
            var visaIndex           = latestVisaInterface.VisaInterfaceId.ToUpper().GetIndex(Consts.VISA_PRIFIX);

            var siclInterfaces      = activeInterfaces.OrderBy(i => i.SiclInterfaceId, new SampleIOAgentComparer(Consts.SICL_PRIFIX));
            var latestSiclInterface = siclInterfaces.LastOrDefault();
            var siclIndex           = (latestSiclInterface != null) ? latestVisaInterface.SiclInterfaceId.ToLower().GetIndex(Consts.SICL_PRIFIX) : -1;

            visaIndex++;
            siclIndex = siclIndex >= 0 ? ++siclIndex : 1;
            var visaIntfID = Consts.VISA_PRIFIX.GenerateNewPrifix(visaIndex);
            var siclIntfID = Consts.SICL_PRIFIX.GenerateNewPrifix(siclIndex);

            var luInterfaces = activeInterfaces.OrderBy(i => i.LogicalUnit, new LUComparer());
            var latestLUIntf = luInterfaces.LastOrDefault();
            var lu           = Consts.DEFAULT_LU;

            if (latestLUIntf != null)
            {
                int luValue;
                if (int.TryParse(latestLUIntf.LogicalUnit, out luValue))
                {
                    luValue++;
                    lu = luValue.ToString();
                }
                else
                {
                    lu = Consts.DEFAULT_LU;
                }
            }
            else
            {
                lu = Consts.DEFAULT_LU;
            }
            intfc.VisaInterfaceId   = visaIntfID;
            intfc.SiclInterfaceId   = siclIntfID;
            intfc.LogicalUnit       = lu;
            intfc.StaticallyDefined = true;
            return(intfc);
        }
Exemplo n.º 3
0
        private ModelElement GenerateAddingInterface(AceModelRestricted model)
        {
            var intfc = new ModelInterfaceSample();
            var activeInterfaces = model.GetInterfaces().Where(i => i.AgentName == AgentId).Select(e => e as ModelInterfaceSample)
                .OrderBy(i => i.VisaInterfaceId.ToUpper(), new SampleIOAgentComparer(Consts.VISA_PRIFIX));
            var latestVisaInterface = activeInterfaces.LastOrDefault();
            var visaIndex = latestVisaInterface.VisaInterfaceId.ToUpper().GetIndex(Consts.VISA_PRIFIX);

            var siclInterfaces = activeInterfaces.OrderBy(i => i.SiclInterfaceId, new SampleIOAgentComparer(Consts.SICL_PRIFIX));
            var latestSiclInterface = siclInterfaces.LastOrDefault();
            var siclIndex = (latestSiclInterface != null) ? latestVisaInterface.SiclInterfaceId.ToLower().GetIndex(Consts.SICL_PRIFIX) : -1;
            visaIndex++;
            siclIndex = siclIndex >= 0 ? ++siclIndex : 1;
            var visaIntfID = Consts.VISA_PRIFIX.GenerateNewPrifix(visaIndex);
            var siclIntfID = Consts.SICL_PRIFIX.GenerateNewPrifix(siclIndex);

            var luInterfaces = activeInterfaces.OrderBy(i => i.LogicalUnit, new LUComparer());
            var latestLUIntf = luInterfaces.LastOrDefault();
            var lu = Consts.DEFAULT_LU;
            if (latestLUIntf != null)
            {
                int luValue;
                if (int.TryParse(latestLUIntf.LogicalUnit, out luValue))
                {
                    luValue++;
                    lu = luValue.ToString();
                }
                else
                {
                    lu = Consts.DEFAULT_LU;
                }
            }
            else
            {
                lu = Consts.DEFAULT_LU;
            }
            intfc.VisaInterfaceId = visaIntfID;
            intfc.SiclInterfaceId = siclIntfID;
            intfc.LogicalUnit = lu;
            intfc.StaticallyDefined = true;
            return intfc;
        }
Exemplo n.º 4
0
        public List<string> GetManuallyEditableDevices(AceModelRestricted model)
        {
            List<string> editableList = new List<string>();
            var manualDevs = (from e in model.GetDevices()
                              where (e is ModelDeviceSample) && (e.StaticallyDefined == true)
                              select string.Format(Consts.EDITABLE_FORMATE, Consts.SAMPLE_INSTRUMENT, e.VisaName)).ToList<string>();
            var manualIntfcs = (from e in model.GetInterfaces()
                                where (e is ModelInterfaceSample)
                                select string.Format(Consts.EDITABLE_FORMATE, Consts.SAMPLE_INTERFACE, e.VisaName)).ToList<string>();

            editableList.AddRange(manualDevs);
            editableList.AddRange(manualIntfcs);
            return editableList;
        }