openPDC icon indicating copy to clipboard operation
openPDC copied to clipboard

Frame reduction plugin

Open rapido-liebre opened this issue 1 year ago • 0 comments

Hi, I'm writing a plugin for filtering data frames. My goal is to get the frame from the input, check if the frame meets the filter condition and publish if so, otherwise cut it from further processing (only positively verified frames should appear in the output).

To do that I created a plugin based on OutputAdapterBase and incoming data frames are visible in log (when ProcessMeasurements is called).

protected override void ProcessMeasurements(IMeasurement[] measurements) { foreach (IMeasurement m in measurements) { OnStatusMessage(MessageLevel.Info, ">> ProcessMeasurements measurement: " + m.ToString() + " " + m.Timestamp + " " + m.Value); } }

Log:

[FRAME_REDUCTOR] 'FrameReductionAdapter' has been successfully initialized. INITIALIZE:Success(15) - Adapter "FRAME_REDUCTOR" (15) was successfully initialized... [FRAME_REDUCTOR] AttemptDisconnection.. [FRAME_REDUCTOR] UseAsyncConnect.. [FRAME_REDUCTOR] Disconnected from . [FRAME_REDUCTOR] Disposed. [FRAME_REDUCTOR] 'FrameReductionAdapter' has been successfully initialized. [FRAME_REDUCTOR] Attempting connection... [FRAME_REDUCTOR] AttemptConnection.. [FRAME_REDUCTOR] UseAsyncConnect.. [FRAME_REDUCTOR] Connection established. [FRAME_REDUCTOR] ProcessMeasurements.. [FRAME_REDUCTOR] >> ProcessMeasurements measurement: GPA_SHELBY:FREQ [PPA:2] 9/12/2022 7:15:48 AM 59.968 [FRAME_REDUCTOR] >> ProcessMeasurements measurement: GPA_SHELBY:FREQ [PPA:2] 9/12/2022 7:15:48 AM 59.967 [FRAME_REDUCTOR] >> ProcessMeasurements measurement: GPA_SHELBY:FREQ [PPA:2] 9/12/2022 7:15:48 AM 59.966 [FRAME_REDUCTOR] >> ProcessMeasurements measurement: GPA_SHELBY:FREQ [PPA:2] 9/12/2022 7:15:48 AM 59.966 [FRAME_REDUCTOR] >> ProcessMeasurements measurement: GPA_SHELBY:FREQ [PPA:2] 9/12/2022 7:15:48 AM 59.961 [FRAME_REDUCTOR] >> ProcessMeasurements measurement: GPA_SHELBY:FREQ [PPA:2] 9/12/2022 7:15:48 AM 59.966 ...

My questions are:

  1. How to stop sending frames further, is it even possible in the output plugin?
  2. Is it better to use an action plugin for this purpose? If so, please describe to me briefly how it should be done correctly.

Any insight will be greatly appreciated. Thanks, Rafal

rapido-liebre avatar Sep 12 '22 07:09 rapido-liebre