Exemple #1
0
        /// <summary cref="IEncodeable.IsEqual(IEncodeable)" />
        public virtual bool IsEqual(IEncodeable encodeable)
        {
            if (Object.ReferenceEquals(this, encodeable))
            {
                return(true);
            }

            CycleStepDataType value = encodeable as CycleStepDataType;

            if (value == null)
            {
                return(false);
            }

            if (!Utils.IsEqual(m_name, value.m_name))
            {
                return(false);
            }
            if (!Utils.IsEqual(m_duration, value.m_duration))
            {
                return(false);
            }

            return(true);
        }
Exemple #2
0
        /// <summary cref="Object.MemberwiseClone" />
        public new object MemberwiseClone()
        {
            CycleStepDataType clone = (CycleStepDataType)base.MemberwiseClone();

            clone.m_name     = (string)Utils.Clone(this.m_name);
            clone.m_duration = (double)Utils.Clone(this.m_duration);

            return(clone);
        }
Exemple #3
0
        /// <summary>
        /// Does the simulation.
        /// </summary>
        /// <param name="state">The state.</param>
        private void DoSimulation(object state)
        {
            try
            {
                for (int ii = 1; ii < 3; ii++)
                {
                    // construct translation object with default text.
                    TranslationInfo info = new TranslationInfo(
                        "SystemCycleStarted",
                        "en-US",
                        "The system cycle '{0}' has started.",
                        ++m_cycleId);

                    // construct the event.
                    SystemCycleStartedEventState e = new SystemCycleStartedEventState(null);

                    e.Initialize(
                        SystemContext,
                        null,
                        (EventSeverity)ii,
                        new LocalizedText(info));

                    e.SetChildValue(SystemContext, Opc.Ua.BrowseNames.SourceName, "System", false);
                    e.SetChildValue(SystemContext, Opc.Ua.BrowseNames.SourceNode, Opc.Ua.ObjectIds.Server, false);
                    e.SetChildValue(SystemContext, new QualifiedName(BrowseNames.CycleId, NamespaceIndex), m_cycleId.ToString(), false);

                    CycleStepDataType step = new CycleStepDataType();
                    step.Name     = "Step 1";
                    step.Duration = 1000;

                    e.SetChildValue(SystemContext, new QualifiedName(BrowseNames.CurrentStep, NamespaceIndex), step, false);
                    e.SetChildValue(SystemContext, new QualifiedName(BrowseNames.Steps, NamespaceIndex), new CycleStepDataType[] { step, step }, false);

                    Server.ReportEvent(e);
                }
            }
            catch (Exception e)
            {
                Utils.Trace(e, "Unexpected error during simulation.");
            }
        }