Modbus data to CSV file - NAN error occurs

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

Can anyone help me out to figure out this issue

NODE-RED Flow for Modbus to Csv file

CSV File with NAN error

Appreciate , your effort in notifying the issue
Energy charges

Add debug nodes further back in the flow and work out which node is causing the problem.

Thanks for your response @Colin

I checked by adding debug nodes. Program is running 24*7 , NAN error occurs once in a while , cant able to figure it out

  1. Is there any possible way to log my debug nodes to cross verify , from which node is causing error .

  2. In a week once or twice error occurs , rest all time its working fine

Energy charges

this problem will be occuring because the node that generates them data items has not respond with in 7 seconds.

You have set your join node to release whatever data is has after 7 seconds (regardless if all values are collected)...


Thanks for your timely help @Steve-Mcl

I have a doubt @Steve-Mcl, Data is running 24*7. Once or Twice in a week error occurs, rest all data is working fine

I will check with Join node

Appreciate , your effort in notifying the issue
Energy charges

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.

Thank you for your response :smiley:

As per your suggestion, changed value to within 30 seconds, still I receive a NAN error for a data, rest all data working fine .

Can you please guide me , in what ways it can be rectified.

Energy Charges

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.

Thanks for your timely response @Steve-Mcl

Yes, I'm getting NaN error in CSV file and database , but in CSV from Address 24 - 1024 getting error, Address 0 working fine .

Can you share any docs for my reference.

Appreciate , your effort in notifying the issue
Energy charges

I have nothing to share with you more than I have already said.

So go give that a try - delete the wires from the inject & wire from Modbus to next part like this...

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)

Please guide me to write some logic to retry the modbus node if it doesn't reply within xx Seconds.

Can you share any docs for reference

Energy Charges

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.

Did you rewire nodes to read in series?

Share a screenshot of your flow & further explain what is happening so I can assess the issue.

Thanks for your timely response

How many times do you want to retry?

I'm not able to figure it out ,NAN error occurs once , next data coming from mod-bus works fine.

If i get a NAN error is it possible to inject the node again , to overcome NAN error problem.

I'm injecting the node for every 5 minutes , and using a join node for 120 seconds

I'm not able to identify from where error occur

Appreciate , your effort in notifying the issue
Energy charges

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).

Best of luck

Extremely Sorry @Steve-Mcl i'm not ignoring your advice.

I'm a beginner working on programming and node-red , quite challenging for me to connect.

I'm not getting a clear understanding on how to connect the wires in series. Still working on your suggestion .

Do you have any reference on how to connect in series

Energy charges

@Energycharges I explained how...

It really is as simple as don't wire in parallel. Wire in series.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.