While working with Modbus data to csv file , For every 5 minutes Interval injecting data from Modbus to csv file . Receiving data for parameters from Modbus to csv file , for a random interval NAN error occurs .
Cannot figure out why NAN error occurs
You can doubt as much as you want but I can tell you what is definitely happening is...
The flow part that grabs address 24 --> modbus --> P/S/Q (and perhaps others) IS NOT giving you a value within 7 seconds. That is what is definitely happening.
Possibly a network or some other interruption is occasionally making things very slow to respond. but definitely - values are not reaching the join node before 7 seconds.
Personally (though I have yet to prove it) I suspect the modbus nodes are occasionally tripping up when you trigger them at the same time.
What I often recommend is they are operated in a sequence (i.e. wire them in series one after another instead of in parallel)
As for handling rows with NaN, you might just have to handle this. E.g. check data before input to database. If you have any NaN, throw it away. Or you could write some logic to retry the modbus node if it doesn't reply within xx Seconds. Or... Many ways to handle it. It depends what you want and how critical the data is.
PS, you should REALLY put logging on the output of each of the modbus nodes (log to file, with timestamps) to see what is REALLY happening. It might be the modbus nodes are not responding? it might be the modbus nodes are sending bad data. you should also put a catch node on the form and also write the catch nodes to a log & check for errors.
For logging, I recommend node-red-contrib-flogger (you can store JSON objects in the log & entries are nicely timestamped)
It isn't quite as easy as that. How many times do you want to retry? How far apart do you want the retries?
Normally when using modus you will be polling the device regularly so it will automatically retry at the next poll.
You are still triggering the modbus reads in parallel. I have previously explained a few times this can cause an issue. You still ignore my advise to try wiring the nodes in series.
I will not be wasting any more of my time if you do not try what I have suggested (several times).