예제 #1
0
        /// <summary>
        /// Creates an instance of an event.
        /// </summary>
        public BaseEventState CreateInstance(ServerSystemContext context, AeEventTypeState eventType)
        {
            BaseEventState instance = null;

            switch (eventType.EventType.EventTypeMapping)
            {
            case EventTypeMapping.AlarmConditionType: { instance = new AlarmConditionState(null); break; }

            case EventTypeMapping.AuditEventType: { instance = new AuditEventState(null); break; }

            case EventTypeMapping.BaseEventType: { instance = new BaseEventState(null); break; }

            case EventTypeMapping.DeviceFailureEventType: { instance = new DeviceFailureEventState(null); break; }

            case EventTypeMapping.DiscreteAlarmType: { instance = new DiscreteAlarmState(null); break; }

            case EventTypeMapping.NonExclusiveDeviationAlarmType: { instance = new NonExclusiveDeviationAlarmState(null); break; }

            case EventTypeMapping.ExclusiveLevelAlarmType: { instance = new ExclusiveLevelAlarmState(null); break; }

            case EventTypeMapping.LimitAlarmType: { instance = new LimitAlarmState(null); break; }

            case EventTypeMapping.NonExclusiveLevelAlarmType: { instance = new NonExclusiveLevelAlarmState(null); break; }

            case EventTypeMapping.OffNormalAlarmType: { instance = new OffNormalAlarmState(null); break; }

            case EventTypeMapping.SystemEventType: { instance = new SystemEventState(null); break; }

            case EventTypeMapping.TripAlarmType: { instance = new TripAlarmState(null); break; }
            }

            return(instance);
        }
        public new void Initialize(
            uint alarmTypeIdentifier,
            string name,
            double maxTimeShelved = AlarmDefines.NORMAL_MAX_TIME_SHELVED)
        {
            if (m_alarm == null)
            {
                m_alarm = new OffNormalAlarmState(m_parent);
            }

            OffNormalAlarmState alarm = GetAlarm();

            base.Initialize(alarmTypeIdentifier, name, maxTimeShelved);

            alarm.NormalState.Value = new NodeId();
        }
예제 #3
0
        /// <summary>
        /// Creates an instance of an event.
        /// </summary>
        public BaseEventState CreateInstance(ServerSystemContext context, AeEventTypeState eventType)
        {
            BaseEventState instance = null;

            switch (eventType.EventType.EventTypeMapping)
            {
                case EventTypeMapping.AlarmConditionType: { instance = new AlarmConditionState(null); break; }
                case EventTypeMapping.AuditEventType: { instance = new AuditEventState(null); break; }
                case EventTypeMapping.BaseEventType: { instance = new BaseEventState(null); break; }
                case EventTypeMapping.DeviceFailureEventType: { instance = new DeviceFailureEventState(null); break; }
                case EventTypeMapping.DiscreteAlarmType: { instance = new DiscreteAlarmState(null); break; }
                case EventTypeMapping.NonExclusiveDeviationAlarmType: { instance = new NonExclusiveDeviationAlarmState(null); break; }
                case EventTypeMapping.ExclusiveLevelAlarmType: { instance = new ExclusiveLevelAlarmState(null); break; }
                case EventTypeMapping.LimitAlarmType: { instance = new LimitAlarmState(null); break; }
                case EventTypeMapping.NonExclusiveLevelAlarmType: { instance = new NonExclusiveLevelAlarmState(null); break; }
                case EventTypeMapping.OffNormalAlarmType: { instance = new OffNormalAlarmState(null); break; }
                case EventTypeMapping.SystemEventType: { instance = new SystemEventState(null); break; }
                case EventTypeMapping.TripAlarmType: { instance = new TripAlarmState(null); break; }
            }

            return instance;
        }
        private ConditionState CreateAlarmOrCondition(SimAlarmStateBackend alarm, NodeId branchId)
        {
            ISystemContext context = _nodeManager.SystemContext;

            ConditionState node;

            // Condition
            if (alarm.AlarmType == AlarmObjectStates.ConditionType)
            {
                node = new ConditionState(this);
            }
            // All alarms inherent from AlarmConditionState
            else
            {
                switch (alarm.AlarmType)
                {
                case AlarmObjectStates.TripAlarmType:
                    node = new TripAlarmState(this);
                    break;

                case AlarmObjectStates.LimitAlarmType:
                    node = new LimitAlarmState(this);
                    break;

                case AlarmObjectStates.OffNormalAlarmType:
                    node = new OffNormalAlarmState(this);
                    break;

                default:
                    node = new AlarmConditionState(this);
                    break;
                }

                // create elements that conditiontype doesn't have
                CreateAlarmSpecificElements(context, (AlarmConditionState)node, branchId);
            }

            CreateCommonFieldsForAlarmAndCondition(context, node, alarm, branchId);

            // This call initializes the condition from the type model (i.e. creates all of the objects
            // and variables requried to store its state). The information about the type model was
            // incorporated into the class when the class was created.
            //
            // This method also assigns new NodeIds to all of the components by calling the INodeIdFactory.New
            // method on the INodeIdFactory object which is part of the system context. The NodeManager provides
            // the INodeIdFactory implementation used here.
            node.Create(
                context,
                null,
                new QualifiedName(alarm.Name, this.BrowseName.NamespaceIndex),
                null,
                true);

            // initialize event information.node
            node.EventType.Value     = node.TypeDefinitionId;
            node.SourceNode.Value    = this.NodeId;
            node.SourceName.Value    = this.SymbolicName;
            node.ConditionName.Value = node.SymbolicName;
            node.Time.Value          = DateTime.UtcNow;
            node.ReceiveTime.Value   = node.Time.Value;
            node.BranchId.Value      = branchId;

            // don't add branches to the address space.
            if (NodeId.IsNull(branchId))
            {
                this.AddChild(node);
            }

            return(node);
        }