Ejemplo n.º 1
0
        /// <summary>
        /// Initializes <see cref="PhasorInputOscillationDetector" />.
        /// </summary>
        public override void Initialize()
        {
            InputCount  = 4;
            OutputCount = Outputs.Length;

            base.Initialize();

            MeasurementKey getMeasurementKey(SignalType signalType) => InputMeasurementKeys.Where((_, index) => InputMeasurementKeyTypes[index] == signalType).FirstOrDefault();

            // Validate input contains voltage and current phase angle / magnitude measurement keys
            m_voltageMagnitude = getMeasurementKey(SignalType.VPHM) ?? throw new InvalidOperationException("One voltage magnitude input measurement is required. Cannot initialize adapter.");
            m_voltageAngle     = getMeasurementKey(SignalType.VPHA) ?? throw new InvalidOperationException("One voltage angle input measurement is required. Cannot initialize adapter.");
            m_currentMagnitude = getMeasurementKey(SignalType.IPHM) ?? throw new InvalidOperationException("One current magnitude input measurement is required. Cannot initialize adapter.");
            m_currentAngle     = getMeasurementKey(SignalType.IPHA) ?? throw new InvalidOperationException("One current angle input measurement is required. Cannot initialize adapter.");

            // Make sure input measurement keys are in desired order
            InputMeasurementKeys = new[] { m_voltageMagnitude, m_voltageAngle, m_currentMagnitude, m_currentAngle };

            // Provide algorithm with parameters as configured by adapter
            PseudoConfiguration configuration = new PseudoConfiguration
            {
                FramesPerSecond = FramesPerSecond,
                IsLineToNeutral = AdjustmentStrategy == VoltageAdjustmentStrategy.LineToNeutral
            };

            m_detector.DetectorAPI = new PseudoDetectorAPI
            {
                Configuration = configuration
            };

            m_detector.OutputMeasurements = OutputMeasurements;
            m_detector.FramesPerSecond    = FramesPerSecond;
            m_detector.InputTypes         = InputMeasurementKeyTypes;
            m_detector.Initialize(Name);
        }
        /// <summary>
        /// Initializes <see cref="SingleInputOscillationDetector" />.
        /// </summary>
        public override void Initialize()
        {
            InputCount  = 1;
            OutputCount = Outputs.Length;

            base.Initialize();

            // Provide algorithm with parameters as configured by adapter
            PseudoConfiguration configuration = new PseudoConfiguration
            {
                FramesPerSecond = FramesPerSecond
            };

            m_detector.DetectorAPI = new PseudoDetectorAPI
            {
                Configuration = configuration
            };

            m_detector.OutputMeasurements = OutputMeasurements;
            m_detector.FramesPerSecond    = FramesPerSecond;
            m_detector.InputTypes         = InputMeasurementKeyTypes;
            m_detector.Initialize(Name);
        }