Hello everyone,
We are developing a communication library for a proprietary serial communication protocol for Bristol hardware, called BSAP (Just Server side for remote stations, similar to Modbus slaves). We would like some suggestions about the best approach for the final integration into the PLCNext architecture.
In our first phase, we successfully developed a Python package for the protocol, which uses the PyPlcnextRsc Python package as a connector to read and write data to the PLC and manage the send and receive buffers of the serial module over the AXL_RSUNI_PD function block.
We have migrated the protocol’s core methods to C++**** and implemented them as an ACF component. We are currently considering two approaches for handling data/messages in the serial buffer:
Cyclic Polling with a Worker Thread
A dedicated thread in the ACF component directly checks the serial buffer for incoming data through the AXL_RSUNI_PD function block, builds the response, and handles its transmission.
Event-Driven Handling with a Realtime Component or C# Function Block
A Realtime Component or a C# Function Block manages the serial buffer. A notification service triggers when data is received, forwarding the message to the ACF component for processing. Once processed, the ACF component sends back a response.
Considering these two approaches, which one would you recommend, or do you see an alternative that might be more effective?
**This protocol does not have a fixed data structure—it can handle any combination of Boolean and Real variables in an ordered list, which is defined in the PLC Engineer program using a string array containing the variable names.