'Ideas to communciate with a BMS and a PLC on RPI using RS 485

I am currently working on a project that involves communication between a PLC , Raspberry Pi 4 and a BMS (Battery Management System) system on a battery.All three device use RS485 for communication using minimalmodbus via python on the RPI. The Raspberry pi has a generic CAN/RS485 HAT (similar to this : https://www.waveshare.com/rs485-can-hat.htm)

Currently I am able to communicate with the PLC to receive and send data from the RPI with the PLC as a master and the RPI as a slave. As per my understanding , in order to read data from the BMS using the Pi, the RPI has to be a master. But in this case, as the RPI is a slave to the PLC, and the PLC cannot be used to read data from the BMS.

I would like to know if it is possible for the RPI to function as a Master to the BMS when being a Slave to the PLC at the same time ? Assuming that it is possible able to connect another RS 485 HAT to the same RPI and run separate scripts for each HAT.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source