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); }
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]; }
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)); } }
protected override void ValueAvailable(ValueInputPort port) { TimeLocatedValue val; if (port.Values.TryDequeue(out val)) { LastValue = val.Stamp; UpdateUi(); } }
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(); }
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); } } }
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(); } } }
public MetricValueRecorder(Graph graph) : base("Value Recorder", graph) { _portInp = InputPort.Create <ValueInputPort>("In", this); _portEn = InputPort.Create <ValueInputPort>("En", this); }
protected override void ValueAvailable(ValueInputPort port) { _sqrt = port.Value > 0.5; }
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); }