예제 #1
0
 protected override void ControlsToData()
 {
     if (_driver != null)
     {
         base.ControlsToData();
         IVI ivi = _driver as IVI;
         if (ivi != null)
         {
             ivi.ComplianceDocument = documentControl.HasDocument ? documentControl.Document : null;
             if (lvClassNames.RowCount > 0)
             {
                 if (ivi.Class == null)
                 {
                     ivi.Class = new List <string>();
                 }
                 ivi.Class.Clear();
                 foreach (List <string> row in lvClassNames.GetTable())
                 {
                     if (row.Count > 0)
                     {
                         ivi.Class.Add(row[0]);
                     }
                 }
             }
             else
             {
                 ivi.Class = null;
             }
         }
     }
 }
예제 #2
0
        public E084ActiveTransferSimEngine(LPM.Sim.ILPMSimPart lpmSimPart)
            : base(lpmSimPart.PartID + ".E84Sim", "E084ActiveTransferSimEngine", initialSettings: SimpleActivePartBaseSettings.DefaultVersion2.Build(disableBusyBehavior: true))
        {
            ActionLoggingConfig = Modular.Action.ActionLoggingConfig.Info_Error_Trace_Trace;    // redefine the log levels for actions

            //This part is a simulated primary part
            PrivateBaseState = new BaseState(true, true)
            {
                ConnState = ConnState.NotApplicable
            };

            this.lpmSimPart = lpmSimPart;

            IVI = Modular.Interconnect.Values.Values.Instance;

            statePublisherIVA = IVI.GetValueAccessor("{0}.State".CheckedFormat(PartID));

            instantActionQ = new MosaicLib.Modular.Action.ActionQueue(PartID + ".iq", true, 10);

            enableAutoLoadIVA   = IVI.GetValueAccessor("{0}.EnableAutoLoad".CheckedFormat(PartID));
            enableAutoUnloadIVA = IVI.GetValueAccessor("{0}.EnableAutoUnload".CheckedFormat(PartID));

            string lpmPartBaseName = lpmSimPart.PartID;

            lpmPresentPlacedInputIVA       = IVI.GetValueAccessor("{0}.PresentPlacedInput".CheckedFormat(lpmPartBaseName));
            ohtPassiveToActivePinsStateIVA = IVI.GetValueAccessor("{0}.E84.OHT.PassiveToActivePinsState".CheckedFormat(lpmPartBaseName));
            agvPassiveToActivePinsStateIVA = IVI.GetValueAccessor("{0}.E84.AGV.PassiveToActivePinsState".CheckedFormat(lpmPartBaseName));
            ohtActiveToPassivePinsStateIVA = IVI.GetValueAccessor("{0}.E84.OHT.ActiveToPassivePinsState".CheckedFormat(lpmPartBaseName));
            agvActiveToPassivePinsStateIVA = IVI.GetValueAccessor("{0}.E84.AGV.ActiveToPassivePinsState".CheckedFormat(lpmPartBaseName));

            SetupConfig();

            PublishBaseState("Constructor.Complete");
        }
예제 #3
0
        private void InitializePrivateState()
        {
            privateState = new TagRWSimEngineState()
            {
                Config           = new TagRWSimEngineConfig(CurrentConfig),
                ContentByteArray = (byte[])CurrentConfig.InitialPageContentsByteArray.Clone(),
                Count            = CurrentConfig.InitialCounterValue,
                TagIsPresent     = true,
            };

            stateIVA            = IVI.GetValueAccessor("{0}.State".CheckedFormat(PartID));
            tagIsPresentIVA     = IVI.GetValueAccessor("{0}.TagIsPresent".CheckedFormat(PartID)).Set(privateState.TagIsPresent);
            counterIsEnabledIVA = IVI.GetValueAccessor("{0}.CounterIsEnabled".CheckedFormat(PartID)).Set(true);
            isOnlineIVA         = IVI.GetValueAccessor("{0}.IsOnline".CheckedFormat(PartID)).Set(true);

            privateState.UpdateCounterPostfix();

            PublishPrivateState();
        }
예제 #4
0
 protected override void DataToControls()
 {
     if (_driver != null)
     {
         base.DataToControls();
         IVI ivi = _driver as IVI;
         if (ivi != null)
         {
             documentControl.Document = ivi.ComplianceDocument;
             if (ivi.Class != null)
             {
                 foreach (String _class in ivi.Class)
                 {
                     var lvi = new ListViewItem(_class);
                     lvi.Tag = _class;
                     var row = lvClassNames.AddRow();
                     lvClassNames.AddColumnData(row, "class", _class);
                 }
             }
         }
     }
 }
예제 #5
0
        private void ServiceBridge()
        {
            if (useNominalSyncHoldoffTimer)
            {
                nominalSyncHoldoffTimer.Reset();
            }

            // service IVI table additions:
            if (lastIVINamesArrayLength != IVI.ValueNamesArrayLength)
            {
                string[] iviValueNamesArray = IVI.ValueNamesArray ?? emptyStringArray;
                lastIVINamesArrayLength = iviValueNamesArray.Length;

                // check for new IVI additions
                foreach (string ivaNativeName in iviValueNamesArray)
                {
                    if (ivaNameToSyncItemDictionary.ContainsKey(ivaNativeName) || lookAtLaterDictionary.ContainsKey(ivaNativeName))
                    {
                        continue;
                    }

                    bool propagateIVAName = BridgeConfig.IVAPropagateNameMatchRuleSet.MatchesAny(ivaNativeName);

                    string mappedFromIVAName = ivaNativeName;

                    propagateIVAName &= (BridgeConfig.IVAMapNameFromTo == null || BridgeConfig.IVAMapNameFromTo.Map(ivaNativeName, ref mappedFromIVAName));

                    string mappedToCKAKeyName = mappedFromIVAName;
                    propagateIVAName &= (BridgeConfig.CKAMapNameFromTo == null || BridgeConfig.CKAMapNameFromTo.MapInverse(mappedFromIVAName, ref mappedToCKAKeyName));

                    // check if we should add a sync item for this key or if we should indicate that we have seen it and that it will not be synced
                    if (propagateIVAName)
                    {
                        var attemptToAddSyncItemInfo = new AttemptToAddSyncItemForIVAInfo()
                        {
                            ivaNativeName      = ivaNativeName,
                            mappedFromIVAName  = mappedFromIVAName,
                            mappedToCKAKeyName = mappedToCKAKeyName,
                            iva = IVI.GetValueAccessor(ivaNativeName),
                        };

                        if (!AttemptToAddSyncItemForIVA(attemptToAddSyncItemInfo, requireUpdateNeeded: false))
                        {
                            lookAtLaterDictionary[ivaNativeName] = attemptToAddSyncItemInfo;

                            Log.Debug.Emit("IVA [{0}] has been added to look at later list", attemptToAddSyncItemInfo.iva);

                            useLookAtLaterTimer = !BridgeConfig.MinLookAtLaterInterval.IsZero();
                            if (useLookAtLaterTimer)
                            {
                                lookAtLaterTimer.StartIfNeeded(BridgeConfig.MinLookAtLaterInterval);
                            }
                        }
                    }
                    else
                    {
                        ivaNameToSyncItemDictionary[ivaNativeName] = null;
                    }
                }
            }

            // if we have lookAtLater items and the corresponding timer has triggered then
            if (lookAtLaterDictionary.Count > 0 && (!useLookAtLaterTimer || lookAtLaterTimer.IsTriggered))
            {
                foreach (var item in lookAtLaterDictionary.Values.ToArray())
                {
                    if (AttemptToAddSyncItemForIVA(item, requireUpdateNeeded: true))
                    {
                        Log.Debug.Emit("IVA [{0}] has been removed from the look at later list", item.iva);

                        lookAtLaterDictionary.Remove(item.ivaNativeName);
                    }
                }

                if (lookAtLaterDictionary.Count == 0)
                {
                    lookAtLaterTimer.Stop();
                }
            }

            // service CKA table addition:
            ConfigSubscriptionSeqNums configSeqNum = Config.SeqNums;

            if (lastConfigSeqNums.KeyAddedSeqNum != configSeqNum.KeyAddedSeqNum || lastConfigSeqNums.EnsureExistsSeqNum != configSeqNum.EnsureExistsSeqNum)
            {
                string[] configKeyNamesArray = Config.SearchForKeys();   // find all of the current keys

                foreach (string configKeyName in (configKeyNamesArray ?? emptyStringArray))
                {
                    if (configKeyNameToSyncItemDictionary.ContainsKey(configKeyName))
                    {
                        continue;
                    }

                    bool propagateConfigKeyName = BridgeConfig.CKAPropagateKeyMatchRuleSet.MatchesAny(configKeyName);

                    IConfigKeyAccess cka = (propagateConfigKeyName ? Config.GetConfigKeyAccess(new ConfigKeyAccessSpec()
                    {
                        Key = configKeyName, Flags = new ConfigKeyAccessFlags()
                        {
                            MayBeChanged = true
                        }
                    }) : null);

                    propagateConfigKeyName &= (BridgeConfig.CKAPropagateFilterPredicate == null || (cka != null && BridgeConfig.CKAPropagateFilterPredicate(cka.Key, cka.MetaData, cka.VC)));

                    string mappedFromConfigKeyName = configKeyName;
                    propagateConfigKeyName &= (BridgeConfig.CKAMapNameFromTo == null || BridgeConfig.CKAMapNameFromTo.MapInverse(configKeyName, ref mappedFromConfigKeyName));

                    string mappedToIVAName = mappedFromConfigKeyName;
                    propagateConfigKeyName &= (BridgeConfig.IVAMapNameFromTo == null || BridgeConfig.IVAMapNameFromTo.Map(mappedFromConfigKeyName, ref mappedToIVAName));

                    if (propagateConfigKeyName)
                    {
                        IValueAccessor iva = IVI.GetValueAccessor(mappedToIVAName);

                        AddSyncItemAndPerformInitialPropagation(iva, cka, mappedToIVAName, mappedFromConfigKeyName, null, configKeyName);
                    }
                    else
                    {
                        configKeyNameToSyncItemDictionary[configKeyName] = null;
                    }
                }
            }

            bool syncItemArrayUpdated = false;

            if (syncItemArray == null)
            {
                syncItemArray = syncItemList.ToArray();
                ivaArray      = syncItemArray.Select(syncItem => syncItem.iva).ToArray();
            }

            // service existing IVA -> CKA items
            if (syncItemArrayUpdated || ivaArray.IsUpdateNeeded())
            {
                foreach (SyncItem syncItem in syncItemArray)
                {
                    if (syncItem.iva.IsUpdateNeeded)
                    {
                        ValueContainer vc = syncItem.iva.Update().VC;

                        if (!vc.IsEqualTo(syncItem.icka.VC))
                        {
                            ValueTraceEmitter.Emit("Propagating iva change '{0}' to cka '{1}'", syncItem.iva, syncItem.icka);
                            syncItem.icka.SetValue(vc, "{0}: Propagating value change from iva '{1}'".CheckedFormat(PartID, syncItem.iva), autoUpdate: false);
                            syncItem.UpdateCopyInSet(ReferenceSet);
                        }
                        else
                        {
                            ValueTraceEmitter.Emit("iva '{0}' updated, value matches cka '{1}'", syncItem.iva, syncItem.icka);
                        }
                    }
                }
            }

            // service existing CKA -> IVA items
            if (lastConfigSeqNums.ChangeSeqNum != configSeqNum.ChangeSeqNum)
            {
                foreach (SyncItem syncItem in syncItemArray)
                {
                    if (syncItem.icka.UpdateValue())
                    {
                        ValueContainer vc = syncItem.icka.VC;

                        if (!vc.IsEqualTo(syncItem.iva.VC))
                        {
                            ValueTraceEmitter.Emit("Propagating cka change '{0}' to iva '{1}'", syncItem.icka, syncItem.iva);
                            syncItem.iva.Set(vc);
                            syncItem.UpdateCopyInSet(ReferenceSet);
                        }
                        else
                        {
                            ValueTraceEmitter.Emit("cka '{0}' updated, value matches iva '{1}'", syncItem.icka, syncItem.iva);
                        }
                    }
                }
            }

            // update lastConfigSeqNum as a whole
            if (!lastConfigSeqNums.Equals(configSeqNum))
            {
                lastConfigSeqNums = configSeqNum;
            }
        }
예제 #6
0
        public Window1()
        {
            Logger = new Logging.Logger("Window1", Logging.LogGate.All);

            IConfig configInstance = Config.Instance;

            new ConfigValueSetAdapter <ConfigValues>(configInstance)
            {
                ValueSet = config, SetupIssueEmitter = Logger.Error, ValueNoteEmitter = Logger.Debug
            }.Setup();

            System.Reflection.Assembly currentExecAssy = System.Reflection.Assembly.GetExecutingAssembly();
            Title = currentExecAssy.FullName.Split(' ').SafeAccess(0).Trim(',');

            IVI       = Values.Instance;
            RemoteIVI = new ValuesInterconnection("RemoteIVI");

            InitializeComponent();

            WVIA = new WPFValueInterconnectAdapter(IVI);

            // Remoting part
            remotingClientConfig = new RemotingClientConfig()
            {
                PartID    = "Remoting.Client",
                PartIVI   = IVI,
                ConfigNVS = new NamedValueSet()
                {
                    { "ConnectionType", config.ConnectionType },
                    { "Port", config.Port },
                    { "IPAddress", config.IPAddress },
                    { "Transport.TraceLogger.InitialInstanceLogGate", config.TraceSelect },
                    { "AutoReconnectHoldoff", config.AutoReconnectHoldoff },
                    { "BufferPool.BufferSize", config.BufferSize },
                    { "SessionExpirationPeriod", config.SessionExpirationPeriod },
                },
                StreamToolsConfigArray = new MessageStreamToolConfigBase[]
                {
                    new ActionRelayMessageStreamToolConfig()
                    {
                        ToolLogGate = config.ToolLogGate,
                    },
                    new IVIRelayMessageStreamToolConfig()
                    {
                        ToolLogGate       = config.ToolLogGate,
                        ClientIVI         = RemoteIVI,
                        RemoteIVIName     = config.IVITableName,
                        IVIRelayDirection = IVIRelayDirection.FromServer,
                        ResetClientSideIVAsOnCloseOrFailure = true,
                    },
                    new SetRelayMessageStreamToolConfig <Logging.LogMessage>()
                    {
                        ToolLogGate = config.ToolLogGate,
                        ClearClientSetOnCloseOrFailure = true,
                        SetID = new Modular.Interconnect.Sets.SetID(config.RemoteLogMessageSetName, generateUUIDForNull: false),
                        MaximumItemsPerMessage = config.RemoteLogMessageSetMaximumItemsPerMessage,
                    },
                    new SetRelayMessageStreamToolConfig <E039Object>()
                    {
                        ToolLogGate = config.ToolLogGate,
                        ClearClientSetOnCloseOrFailure = true,
                        SetID = new Modular.Interconnect.Sets.SetID(E039ObjectTableSetName, generateUUIDForNull: false),
                    },
                }.WhereIsNotDefault().ToArray(),
            };
            remotingClient = new RemotingClient(remotingClientConfig);
            partsList.Add(remotingClient);

            IVI.GetValueAccessor("{0}.ConfigNVS".CheckedFormat(remotingClient.PartID)).Set(remotingClientConfig.ConfigNVS);

            // ANManager set view tab

            DataContext = WVIA;

            E039ObjectSetTracker = SetTracker.GetSetTracker(E039ObjectTableSetName);
            var test = e039ListView;
        }