I am using Node red version v1.1.3
I am getting resistance data from PLC and then using Node-red for acquistion and monitoring with data on grafana.
But, all data are not synchronized.I want data to be synchronous, for every timestamp I should get data of that point.
I will really appreciate any suggestions and idea
1.Siemens simatic PLC : CPU 1512SP-1 PN with analog card : AI 4xRTD/TC 2-,3-,4-wire HF_1
Siemens sinumerik controller: to get axis positions
2. I am using Opc ua communication
3. Iam getting array of float type values to Node-red. There I am distributing array to single float value to different Influx db node.All data get stored in Influxdb database . From Influx db database I taking these data and displaying on Grafana.
4. Also, there are two opc ua client node in node red for different controller (simatic and sinumerik)
If you are getting all the data values at one time then the best thing is to write them all to one Measurement at the same time, then they will all have the same timestamp. If you want them to go to different Measurements then use the influxdb batch node and again you can write them all in one message so they will have the same timestamps.
If I write all the different data to one measurement with one name, then how I will seprate them in grafana , where I am monitoring the many data?
If I use influxdb batch node , then I can see there is no option of measurement name. which measurement name I will use in grafana ?
influx db out: I tried connectiong trwo input wires to single influx db out with one measurement. How to seprate my measurements in grafana, I am not able to see my data in garafana.
influxdb batch node : when used this , I gave two input data wires to single influx db batch node . but, again I am not able to see the data in grafana. what sholld be the measurement name ?
can you please tell me how to see my data in influxdb database, I tried the syntax
" SELECT *FROM databasename LIMIT 10 ", but console shows no measurements. Even though I can see my measurement names with syntax " show field keys". I wanted to check if I am getting all data with same time stamp.
Use one Measurement but different Fields within that measurement.
The help for the node says:
The msg.payload needs to be an array of point objects.
The measurement property of a point contains the name of the measurement for the point. The fields property will contain the fields of the point. If supplied, the tags property will contain the tags for the point. To set the time for the point, supply a timestamp property.
However you don't need to use the batch node, see below.
Answering your numbered points:
You don't need to connect multiple wires. You said you start with all the values in an array, instead of splitting it up build a single message containing all the field values and pass that to the node. Again see the help text for the node:
If msg.payload is an object containing multiple properties, the fields will be written to the measurement.
You don't need to use the batch node.
Do you mean using the command line influx client? If so then you first have to tell it which database to use. use mydatabase. Then show measurements will show you the measurement names, then select * from mymeasurement will show you the fields and tags in that measurement. In influxdb a measurement is approximately the same as a table in a normal database. show field keys shows you the names and types of the fields within each measurement.
I am using two OPC ua read node, one gets a array of data and when I see it on grafana its almost synchronous .
Sorry, but other OPC ua read is not getting a array but instead it getting many data of , most of them float format. I want all these float data to be synchronized.
I checked in influxdb database, array data are synchronized .but the different other float data for other OPCua node which are not in array are not geeting same time stamp or not synchronized.
In that case you need to join them together. You can probably use a Join node for this, this example from the cookbook shows how this can be done. https://cookbook.nodered.org/basic/join-streams
I am already using function node to join all the float data.
Infact, I am giving all the Node ID of different data (8 float and 1 integer data).
see, the picture for refrence.
But, I dont know if its making an array.
If I use join ,
What should I put in inject node msg.payload (I a using timestamp)? if I am using join, and try to join msg the, output of join is array with timestamp as payload.
how should i seprate msg at output of Opcua client node? Earlier I was using divide node and function node, there I was giving all node id for sepration.
Look at the example I linked to again. If you are getting an array you have not configured it as in the example. Import the example and play with it to see how it works.
I haven't go through all the post and reply but what you have going on is similar with what i have done.
In my project, all the data are from PLC by Modbus Tcp directly. More than 300 float points should be read from it. And all the data will be write into influxDB by every result trigger.I am not care about the timestamp because all the data are write to database at the same time.The time gap between plc reading and database insert should less than 1s.You can set the msg.payload with tag information before write the data to influxdb. For grafara, you can deal with the data by tag group later.
Thank you for all your replies
now ,I run the example and I have configured exactly as in the example. After the OPCua communication by opcua client read node, I am using switch node to seprate the output with property msg.topics.
But at output of opcua read node I am not getting payload for all the different data injected.
I am only getting the payload of last inject node to the join node(I checked the topic with debug node, I am only getting data of the last inject node. I dont know how to split the payload at output of opcua node
Also, I am using 2 Opcua communication node,to communicate with two different server (2 siemens controller) .Both controllers are giving sending many float data. So, I have to synchronize both the opc ua data too.
I thought the problem was that you were reading the data ok, but because it came in at different times it didn't get written to influx at the same timestamp. The suggestion was to use the Join node after the opc node in order to join all the values into one message. However, looking at the screenshot you posted you seem to be splitting the message after the opc mode, so the question is why are you doing that? Why are you not just writing it to the database at that point?