Single-Time Write via Modbus

Für Themen rund um das Prozessabbild des RevPi Core
Post Reply
Nils
Posts: 15
Joined: 01 Jan 2022, 21:09
Answers: 0

Single-Time Write via Modbus

Post by Nils »

Hi,

I need to send a calibration value to different probes, e.g. PH and EC. Setting a register to 1 will activate the calibration function. However, I will only need to send this value once (when calibration should be initiated, not repeatedly).

I am defining an Output_Word variable in Pictory, e.g. OUTPUT_ph_tmp_comp, and assign the following WRITE_SINGLE_REGISTER action for the corresponding slave.
output.PNG
output.PNG (4.57 KiB) Viewed 8096 times
Since there is an action interval item in the list of attributes I am wondering how often revPI will send this command out. Even if the variable is set back to 0. Is revPI checking if a change in the register happened and only sends the update command once a change was observed or is it constantly sending the content of the register according to the action interval, no matter what?

I am asking since some other write commands might overwrite EEPROM on a probe and this storage might break after too many write operations. If revPI would continue to send a 0 afterwards and the probe would overwrite the storage every 1000ms, it might break after a while.

Thanks!
Nils
Nils
Posts: 15
Joined: 01 Jan 2022, 21:09
Answers: 0

Re: Single-Time Write via Modbus

Post by Nils »

I think I have confirmed that revPI keeps on sending the Output variable with the given action interval.

Now my questions is, how do I send a ModBus command for calibration only once?
The problem with the process image is that I don´t have direct control over the interface. So how can I send out just one command alone?
User avatar
nicolaiB
KUNBUS
Posts: 869
Joined: 21 Jun 2018, 10:33
Answers: 7
Location: Berlin
Contact:

Re: Single-Time Write via Modbus

Post by nicolaiB »

Hi Niels,

For use cases like this the process image is indeed not the best fit. I would suggest to implement it without the virtual modbus device and directly use modbus with a library (like pymodbus for python).

Nicolai
Nils
Posts: 15
Joined: 01 Jan 2022, 21:09
Answers: 0

Re: Single-Time Write via Modbus

Post by Nils »

Hi Nicolai,

Thanks for your quick reply.

Since there can only be one Modbus Master at a time, would it be possible to use such a script in co-existence with the revPI Modbus Master running?
E.g. the revPI Modbus Master service would poll the sensor registers at defined intervalls from Pictory and the pymodbus script would send the calibration command? Or is it possible to inject commands with pymodbus in a already initiated communication channel controlled by the Modbus master service?

If co-existence is not possible, I could think of a dirty hack that would first disable the Modbus Master service via the script, initiate its own communication and send the calibration command, and then restart the ModBus Master service. But I think that would be really ugly for a production environment the revPI is designed for...

I would suggest to implement a functionality into the Pictory service that allows to send a one-time request that could for example be used for calibration (or to set other attributes like response-delay on a sensor). Otherwise I will need to disconnect the sensor from the revPI setup every single time I want to perform a calibration. With many sensors and a calibration to be performed once in a month, this is quite a burden. Therefore, I would like to implement all features of the sensor via the GUI to make it user friendly.

Cheers,
Nils
User avatar
nicolaiB
KUNBUS
Posts: 869
Joined: 21 Jun 2018, 10:33
Answers: 7
Location: Berlin
Contact:

Re: Single-Time Write via Modbus

Post by nicolaiB »

Hi Niels,

it should be possible to have multiple modbus master instances (at least for TCP). More details you can have a look at this article: https://www.rtautomation.com/rtas-blog/ ... e-masters/

Nicolai
Nils
Posts: 15
Joined: 01 Jan 2022, 21:09
Answers: 0

Re: Single-Time Write via Modbus

Post by Nils »

Hi Nicolai,

I tried and it leads to many errors during the communication. There can only be one Modbus RTU master on a serial bus at a time.

Therefore, the problem remains. I will have to disable Modbus service / manually send RTU command / enable Modbus service which is not very elegant and might lead to other problems. It would be nice to have the one-time functionality via Pictory/revPI in the future.

Cheers,
Nils
User avatar
nicolaiB
KUNBUS
Posts: 869
Joined: 21 Jun 2018, 10:33
Answers: 7
Location: Berlin
Contact:

Re: Single-Time Write via Modbus

Post by nicolaiB »

Hi Nils,

Yes, it is only possible with TCP (as I mentioned above). I didn't know that you are using RTU. With RTU your solution makes sense and might be the only solution without a custom implementation at the moment.

I'll add your feedback to our backlog, but can't promise any date yet.

Nicolai
User avatar
ostermann
Posts: 36
Joined: 11 Dec 2021, 14:51
Answers: 0

Re: Single-Time Write via Modbus

Post by ostermann »

Single-Time write on startup may be useful for many applications, e.g. to integrate the download of config parameters and settings into the master application on the RevPi. This can help to avoid configuration of slave devices with vendor specific tools, e.g. when replacing components in the field.

Best Regards
Thorsten
--
https://www.mechapro.de - Wir bewegen Ihre Ideen!
Nils
Posts: 15
Joined: 01 Jan 2022, 21:09
Answers: 0

Re: Single-Time Write via Modbus

Post by Nils »

Hi Nicolai,

Have you considered implementing such a single-time write feature for the new release?

Cheers,
Nils
User avatar
hakaies
Posts: 12
Joined: 27 Apr 2021, 21:10
Answers: 0
Location: Vancouver Island, Canada
Contact:

Re: Single-Time Write via Modbus

Post by hakaies »

+1 for single-time modbus write function
Post Reply