Yea, see that's exactly what I want to avoid. That will be in the wrong setting every time. I want to hit each actual setpoint from either side.
I'm gonna have to read these values back at the plant to make this work aren't I?
It isn't easy. You have read all values to main plc then comparing then to lastly changed variables and write then to remote plc if values are newer on main plc.
Lot of coding and you need sevaral temp data arrays for comparing.
Or you can do selection bit on remote plc. Then read this bit on main plc and if there is rising edge on this bit then disable writing on main plc and start read setpoints to main plc from remote.
Main plc can have timer which disables this remote plc's permission automatically after certain time and made also switch to remote hmi for disabling without need of wait of timer.
Also you can disable remote permission on remote HMI / plc side after changed setpoints and waited at least so long that remote plc have allready readed them.
As you read or write setpoints to remote there is needed some 4-5 different messages but no need for temp arrays and data comparing whit this method.
Comparing data approach can be done less messages (3) but it is more complex.
1. Read measurements
2. read setpoint source selection bit from remote
3.1 write setpoints from main to remote (if selection is = 0)
3.2 read setpoints from 3 remote to main plc. (if select is = 1)
4. write setpoint source selection bit to 0 if timer expires. (you can use different bit and rising edge detection on remote plc so no need to oneshot write)
Only 2 messages of these are used depending if main or remote is source for setpoints. No need to 2 different setpoints and it is easier than comparing values.