コード例 #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);
        }
コード例 #2
0
ファイル: AeTypeCache.cs プロジェクト: OPCFoundation/UA-.NET
        /// <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;
        }
コード例 #3
0
        public void Initialize(
            uint alarmTypeIdentifier,
            string name,
            double maxTimeShelved = AlarmDefines.NORMAL_MAX_TIME_SHELVED,
            bool isLimit          = true)
        {
            // Create an alarm and trigger name - Create a base method for creating the trigger, just provide the name

            if (m_alarm == null)
            {
                m_alarm = new LimitAlarmState(m_parent);
            }

            m_isLimit = isLimit;

            LimitAlarmState alarm = GetAlarm();

            if (alarm.HighLimit == null)
            {
                alarm.HighLimit = new PropertyState <double>(alarm);
            }
            if (alarm.HighHighLimit == null)
            {
                alarm.HighHighLimit = new PropertyState <double>(alarm);
            }
            if (alarm.LowLimit == null)
            {
                alarm.LowLimit = new PropertyState <double>(alarm);
            }
            if (alarm.LowLowLimit == null)
            {
                alarm.LowLowLimit = new PropertyState <double>(alarm);
            }

            if (Optional)
            {
                alarm.BaseHighLimit     = new PropertyState <double>(alarm);
                alarm.BaseHighHighLimit = new PropertyState <double>(alarm);
                alarm.BaseLowLimit      = new PropertyState <double>(alarm);
                alarm.BaseLowLowLimit   = new PropertyState <double>(alarm);
            }

            // Call the base class to set parameters
            base.Initialize(alarmTypeIdentifier, name, maxTimeShelved);

            alarm.HighLimit.Value     = AlarmDefines.HIGH_ALARM;
            alarm.HighHighLimit.Value = AlarmDefines.HIGHHIGH_ALARM;
            alarm.LowLimit.Value      = AlarmDefines.LOW_ALARM;
            alarm.LowLowLimit.Value   = AlarmDefines.LOWLOW_ALARM;

            if (Optional)
            {
                alarm.BaseHighLimit.Value     = AlarmDefines.HIGH_ALARM;
                alarm.BaseHighHighLimit.Value = AlarmDefines.HIGHHIGH_ALARM;
                alarm.BaseLowLimit.Value      = AlarmDefines.LOW_ALARM;
                alarm.BaseLowLowLimit.Value   = AlarmDefines.LOWLOW_ALARM;
            }
            else
            {
                alarm.BaseHighHighLimit = null;
                alarm.BaseLowLimit      = null;
                alarm.BaseLowLowLimit   = null;
            }
        }
コード例 #4
0
        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);
        }