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 MetricThresholdHystersis(Graph g) : base("Hysteresis Threshold", g)
 {
     _portIn         = new InputPortData1D(this, "In");
     _portThreshHigh = new InputPortValueDouble(this, "High");
     _portThreshLow  = new InputPortValueDouble(this, "Low");
     _portOut        = new OutputPortValueDouble(this, "Out");
 }
Exemplo n.º 3
0
 private static void SaveDataInputBuffer(InputPortValueDouble p, NodeState to)
 {
     if (p.Values != null)
     {
         to.WriteValue(to.PortValues, p.Name, p.Values.Clone());
     }
 }
Exemplo n.º 4
0
        public MetricThreshold(Graph graph) : base("Threshold", graph)
        {
            _portInp    = new InputPortData1D(this, "In");
            _portThresh = new InputPortValueDouble(this, "Threshold");
            _portOut    = new OutputPortValueDouble(this, "Out");

            _output = new TimeLocatedValue <double>(0, TimeStamp.Zero);
        }
Exemplo n.º 5
0
 private static void LoadValueInputBuffer(NodeState from, InputPortValueDouble to)
 {
     if (to.Values != null)
     {
         var values = (ConcurrentTreeBag <TimeLocatedValue <> >)from.PortValues[to.Name];
         to.Values = values.Clone();
     }
 }
Exemplo n.º 6
0
        public MetricMultiplyValue(Graph graph) : base("Multiply", graph)
        {
            _portInp    = new InputPortData1D(this, "In");
            _portInpVal = new InputPortValueDouble(this, "f");
            _portOut    = new OutputPortData1D(this, "out");

            _portInp.SamplerateChanged += (s, e) => _portOut.Samplerate = _portInp.Samplerate;
        }
Exemplo n.º 7
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.º 8
0
 private void AddData2D(InputPortValueDouble p, TimeLocatedValue <double> v)
 {
     if (IsDisposed)
     {
         return;
     }
     lock (_renderers) {
         var render = ((DataLine2D)_renderers[p]);
         render.Add(new PointF(v.Stamp.ToRate(render.SamplesPerSecond), (float)v.Value));
     }
 }
Exemplo n.º 9
0
        private void AddRenderer(InputPortValueDouble p, double millisWindow)
        {
            var colors = new [] { Color.Red, Color.Blue, Color.Green, Color.Orange, Color.Navy, Color.Black };
            var data   = new DataLine2D(p.Connection.Parent.Description, millisWindow)
            {
                LineColor        = colors[_renderers.Count % colors.Length],
                SamplesPerSecond = 1000000
            };

            _renderers.Add(p, data);
            _set?.Data.Add(data);
        }
Exemplo n.º 10
0
        public MetricFile(Graph g) : base("File Node", g)
        {
            _portOut     = new OutputPortData1D(this, "Out");
            _portTrigger = new InputPortValueDouble(this, "Trig");

            _attrFilePath   = new AttributeValueFile(this, "Path", true);
            _attrSamplerate = new AttributeValueInt(this, "Samplerate", 1000);
            _attrDataType   = new AttributeValueEnum <DataType>(this, "DataType");

            _attrSamplerate.Changed += (o, e) => _portOut.Samplerate = _attrSamplerate.TypedGet();

            _attrSamplerate.SetRuntimeReadonly();
            _attrDataType.SetRuntimeReadonly();
            _attrFilePath.SetRuntimeReadonly();
        }
Exemplo n.º 11
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);
 }