Exemplo n.º 1
0
        public MetricDisplay2(Graph g) : base("Display", g)
        {
            var dataInp  = new InputPortData1D(this, "Dinp 1");
            var valueInp = new InputPortValueDouble(this, "Vinp 1");

            _attrLookAheadFactor = new AttributeValueDouble(this, "Look Ahead Factor", 1);
            _attrWindowLength    = new AttributeValueInt(this, "Window Length", "ms", 1000);
            _attrLookAheadFactor.SetRuntimeReadonly();

            _attrWindowLength.Changed += (s, e) => {
                lock (_processingLock) {
                    lock (_wndLock) {
                        if (State == Graph.State.Running)
                        {
                            CreateChannels();
                            _wnd?.PrepareProcessing();
                        }
                    }
                }
            };

            PortConnectionChanged += MetricDisplay2_PortConnectionChanged;

            try {
                CreateWindow();
            } catch (Exception e) {
                throw new InvalidOperationException("Error in constructor while creating window: " + e);
            }
        }
Exemplo n.º 2
0
        public TimeDisplayWaterfall(Graph g) : base("Waterfall", g)
        {
            _port = new InputPortDataFFT(this, "In");

            _attrDbMax      = new AttributeValueDouble(this, "dB max", "dB");
            _attrDbMin      = new AttributeValueDouble(this, "dB min", "dB");
            _attrTimeWindow = new AttributeValueInt(this, "Window Length", "ms");

            _attrDbMin.Changed += (s, e) => {
                if (_attrDbMin.TypedGet() >= _attrDbMax.TypedGet())
                {
                    _attrDbMin.Set(_attrDbMax.TypedGet() - 0.0001);
                }
                if (_wnd != null)
                {
                    _wnd.DbMin = (float)_attrDbMin.TypedGet();
                }
            };

            _attrDbMax.Changed += (s, e) => {
                if (_attrDbMax.TypedGet() <= _attrDbMin.TypedGet())
                {
                    _attrDbMax.Set(_attrDbMin.TypedGet() + 0.0001);
                }
                if (_wnd != null)
                {
                    _wnd.DbMax = (float)_attrDbMax.TypedGet();
                }
            };

            _attrTimeWindow.Changed += (s, e) => {
                UpdateWindowSettings();
            };
            _attrTimeWindow.SetRuntimeReadonly();
        }
Exemplo n.º 3
0
        public MetricValue(Graph graph) : base("Value", graph)
        {
            _portOut   = new OutputPortValueDouble(this, "Out");
            _attrValue = new AttributeValueDouble(this, "Value");
            TimeValue  = new TimeLocatedValue <double>(0, TimeStamp.Zero);

            _attrValue.Changed += attrValue_Changed;
        }
Exemplo n.º 4
0
 public MetricSustainedThreshold(Graph g) : base("Sustained Threshold", g)
 {
     _portIn     = new InputPortData1D(this, "In");
     _portThresh = new InputPortValueDouble(this, "Thresh");
     _portOut    = new OutputPortValueDouble(this, "Out");
     _attrActiveDurationMillis = new AttributeValueDouble(this, "SustainDuration", "ms", 1000);
     _attrStartAt = new AttributeValueEnum <SustainMode>(this, "SustainStart");
 }
Exemplo n.º 5
0
        public MetricBuffer(Graph graph) : base(graph)
        {
            _portOut    = new OutputPortData1D(this, "out");
            _portInp    = new InputPortData1D(this, "inp");
            _attrMillis = new AttributeValueDouble(this, "Milliseconds", "ms", 1000);
            _attrMillis.SetRuntimeReadonly();

            _portInp.SamplerateChanged += (sender, ev) => _portOut.Samplerate = _portInp.Samplerate;
        }
Exemplo n.º 6
0
        public MetricFFTBandEnergy(Graph graph) : base("Band Energy", graph)
        {
            _portInp = new NodeSystemLib2.FormatDataFFT.InputPortDataFFT(this, "In");
            _portOut = new NodeSystemLib2.FormatData1D.OutputPortData1D(this, "Out");

            _portInp.SamplerateChanged += (s, e) => _portOut.Samplerate = e.NewSamplerate / _portInp.FFTSize;

            _attrBandwidth       = new AttributeValueDouble(this, "Bandwidth", "Hz");
            _attrCenterFrequency = new AttributeValueDouble(this, "Center Frequency", "Hz");
        }
Exemplo n.º 7
0
        public MetricRms(Graph g) : base("RMS", g)
        {
            _portIn  = new InputPortData1D(this, "In");
            _portOut = new OutputPortData1D(this, "Out");

            _portIn.SamplerateChanged += (s, e) => UpdateSamplerate();

            _attrMilliseconds          = new AttributeValueDouble(this, "Window Length", "ms");
            _attrMilliseconds.Changed += (s, e) => UpdateSamplerate();
            _attrMilliseconds.SetRuntimeReadonly();
        }
Exemplo n.º 8
0
        public Recorder3(Graph g) : base("Recorder 3", g)
        {
            CreateLine(PortDataTypes.TypeIdSignal1D);
            CreateLine(PortDataTypes.TypeIdValueDouble);
            _portEnable            = new NodeSystemLib2.FormatValue.InputPortValueDouble(this, "Enable");
            _attrPrebufferLengthMs = new AttributeValueDouble(this, "PreBuffer", "ms", 1000);

            _attrNumOfLines1D = new AttributeValueInt(this, "NumOfLines1D", 1);
            _attrNumOfLines2D = new AttributeValueInt(this, "NumOfLines2D", 1);
            _attrNumOfLines1D.SetRuntimeReadonly();
            _attrNumOfLines2D.SetRuntimeReadonly();
            _attrNumOfLines1D.Changed += _numOfLines1D_Changed;
            _attrNumOfLines2D.Changed += _numOfLines2D_Changed;
        }
Exemplo n.º 9
0
        public MetricFilter(Graph graph) : base("Filter", graph)
        {
            _portInp = new InputPortData1D(this, "In");
            _portOut = new OutputPortData1D(this, "Out");

            _portInp.SamplerateChanged += portInp_SamplerateChanged;

            _attrCenterFrequency = new AttributeValueDouble(this, "Center", "Hz");
            _attrPeakGainDb      = new AttributeValueDouble(this, "Gain", "dB");
            _attrQFactor         = new AttributeValueDouble(this, "Q");
            _attrType            = new AttributeValueEnum <Biquad.BiquadType>(this, "Type");

            _attrCenterFrequency.Changed += (s, e) => _bpf.Fc = _portOut.Samplerate > 0 ? _attrCenterFrequency.TypedGet() / _portOut.Samplerate : 0;
            _attrPeakGainDb.Changed      += (s, e) => _bpf.PeakGainDb = _attrPeakGainDb.TypedGet();
            _attrQFactor.Changed         += (s, e) => _bpf.Q = _attrQFactor.TypedGet();
            _attrType.Changed            += (s, e) => _bpf.Type = _attrType.TypedGet();
        }
Exemplo n.º 10
0
        public MetricAnalogInput(NidaqSingleton.Device device, NidaqSingleton.Channel channel, Graph g)
            : base("AI " + channel.Path, g, UniquenessBy(channel))
        {
            _portOut = new NodeSystemLib2.FormatData1D.OutputPortData1D(this, "Out");
            Channel  = channel;
            Device   = device;

            // only add to session after the initialization is done
            Session = NidaqSingleton.Instance.AddToSession(this);

            _attrVMax        = new AttributeValueDouble(this, "Vmax");
            _attrVMin        = new AttributeValueDouble(this, "Vmin");
            _attrTerminalCfg = new AttributeValueEnum <NidaQmxHelper.TerminalCfg>(this, "TerminalConfig");

            _attrVMax.SetRuntimeReadonly();
            _attrVMin.SetRuntimeReadonly();
            _attrTerminalCfg.SetRuntimeReadonly();
        }
Exemplo n.º 11
0
        public MetricValueRange(Graph graph) : base("Range", graph)
        {
            _portOut = new OutputPortValueDouble(this, "Out");

            _attrValue = new AttributeValueDouble(this, "Value", IsRunning);
            _attrMax   = new AttributeValueDouble(this, "Max", IsRunning);
            _attrMin   = new AttributeValueDouble(this, "Min", IsRunning);
            _attrSteps = new AttributeValueInt(this, "Steps", IsRunning);

            _attrValue.Changed += (s, e) => {
                if (State == Graph.State.Running)
                {
                    SendValue(_attrValue.TypedGet());
                }
            };

            _attrMax.Changed += (s, e) => {
                if (_slider != null)
                {
                    _slider.Max = _attrMax.TypedGet();
                }
            };

            _attrMin.Changed += (s, e) => {
                if (_slider != null)
                {
                    _slider.Min = _attrMin.TypedGet();
                }
            };

            _attrSteps.Changed += (s, e) => {
                if (_slider != null)
                {
                    _slider.Steps = _attrSteps.TypedGet();
                }
            };
        }
 public PropertyRowNodeAttrDouble(AttributeValueDouble attr)
 {
     _box           = new PropertyRowContainer <TextBox>(new TextBox(), attr.Unit);
     _attr          = attr;
     _attr.Changed += _attr_Changed;
 }
Exemplo n.º 13
0
 public MetricValueTimeDelay(Graph g) : base("Value Time Delay", g)
 {
     _portIn          = new InputPortValueDouble(this, "In");
     _portOut         = new OutputPortValueDouble(this, "Out");
     _attrMillisDelay = new AttributeValueDouble(this, "Delay", "ms", 0);
 }