예제 #1
0
        public MetricRecorder(Graph g) : base("Recorder", g)
        {
            _portData   = InputPort.Create <DataInputPort>("Data", this);
            _portEnable = InputPort.Create <ValueInputPort>("En", this);

            _set = NodeSystemSettings.Instance.SystemHost.RecordSetForGraph(Parent);
        }
예제 #2
0
 public MetricMultiplyValue(Graph graph)
     : base("Multiply", graph,
            InputPort.CreateMany(InputPort.Create("in", PortDataType.Array),
                                 InputPort.Create("f", PortDataType.Value)),
            OutputPort.CreateMany(OutputPort.Create("out", PortDataType.Array)))
 {
     _portInp    = (DataInputPort)InputPorts[0];
     _inputValue = (ValueInputPort)InputPorts[1];
     _portOut    = (DataOutputPort)OutputPorts[0];
 }
예제 #3
0
        protected override void ValueAvailable(ValueInputPort port)
        {
            TimeLocatedValue val;

            while (port.Values.TryDequeue(out val))
            {
                double result = val.Value < 0.5 ? 1 : 0;
                ((ValueOutputPort)OutputPorts[0]).SendData(new TimeLocatedValue(result, val.Stamp));
            }
        }
예제 #4
0
        protected override void ValueAvailable(ValueInputPort port)
        {
            TimeLocatedValue val;

            if (port.Values.TryDequeue(out val))
            {
                LastValue = val.Stamp;
                UpdateUi();
            }
        }
예제 #5
0
 protected override void ValueAvailable(ValueInputPort port)
 {
     while (port.Values.Count > 0)
     {
         TimeLocatedValue value = null;
         if (!port.Values.TryDequeue(out value))
         {
             return;
         }
         LastValue = value.Value;
         Console.WriteLine($"Sink got value: {value.Value}");
     }
     UpdateUi();
 }
예제 #6
0
        protected override void ValueAvailable(ValueInputPort port)
        {
            TimeLocatedValue value = null;

            while (_portEn.Values.Count > 0)
            {
                if (_portEn.Values.TryDequeue(out value))
                {
                    Recording = value.Value > 0.5;
                }
            }

            while (_portInp.Values.Count > 0)
            {
                if (_portInp.Values.TryDequeue(out value))
                {
                    ProcessValue(value);
                }
            }
        }
예제 #7
0
        protected override void ValueAvailable(ValueInputPort port)
        {
            lock (_valueLock) {
                while (_portInp.Values.Count > 0)
                {
                    _portInp.Values.TryDequeue(out _input);
                }
            }

            while (_portThresh.Values.Count > 0)
            {
                _portThresh.Values.TryDequeue(out _threshold);
            }

            lock (_valueLock) {
                if (_input != null && _threshold != null)
                {
                    Process();
                }
            }
        }
예제 #8
0
 public MetricValueRecorder(Graph graph) : base("Value Recorder", graph)
 {
     _portInp = InputPort.Create <ValueInputPort>("In", this);
     _portEn  = InputPort.Create <ValueInputPort>("En", this);
 }
예제 #9
0
 protected override void ValueAvailable(ValueInputPort port)
 {
     _sqrt = port.Value > 0.5;
 }
예제 #10
0
 public MetricThresholdEvent(Graph g) : base("Treshold Event", g)
 {
     _dataIn   = InputPort.Create <DataInputPort>("Inp", this);
     _threshIn = InputPort.Create <ValueInputPort>("Thresh", this);
     _eventOut = OutputPort.Create <EventOutputPort>("Ev", this);
 }