LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

HOW AND WHERE TO INSERT EVENT STRUCTURE IN PRODUCER/CONSUMER LOOP FOR DATA LOGGING?

Hi mc,

 

why don't you cleanup your block diagram? It would really help in understanding what that code does:

(I guess you only read one value per Modbus read call so I use IndexArray to use only the first element of the read responses…)

Best regards,
GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
0 Kudos
Message 21 of 28
(282 Views)

Hi GerdW,

 

1 data is 32bit and it  consists of two 16-bit registers that I read, so is this way correct?

 

And thaaaaank You very much for help!

0 Kudos
Message 22 of 28
(254 Views)

Hi mc,

 


@mc50100 wrote:

1 data is 32bit and it  consists of two 16-bit registers that I read, so is this way correct?


The "correctness" depends on the byte/word order, maybe you need to switch the high/low word at the Join function.

Your block diagram is not cleaned up, there are a lot of hidden (and so seemingly broken/bended) wires…

Best regards,
GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
0 Kudos
Message 23 of 28
(241 Views)

And I have this one problem, I need to save my data in .csv file, I upload my VI and Sub VI for that part of program, but you can see that my header is not good because every measurement need to be in own column.

 

If you need I can upload my program. Thank you!

0 Kudos
Message 24 of 28
(236 Views)

Hi mc,

 


@mc50100 wrote:

I need to save my data in .csv file, I upload my VI and Sub VI for that part of program, but you can see that my header is not good because every measurement need to be in own column.


Well, real VIs instead of snippets would have been nice… (But snippets are much better than plain images!)

 

The header looks ok for me:

At this stage the files you create are fine - but your example CSV file also includes quotation marks around the remaining content! Where are those quotation marks are coming from?

 

Other stuff:

While I commonly use FormatIntoString in favor of several ConcatString functions you really need to check those constructs in your code.

See this example:

One of both ways is much simpler than the other…

Best regards,
GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
Download All
0 Kudos
Message 25 of 28
(233 Views)

Thank you, I did everything what you said but but the header is again written in one column instead of being separate for each measurement (csv.png)

 

 

I also have question because I need to use Write Delimited Spreadsheet instead of writespreadsheetstring,  so do I need convert string Header to array (in File init.vi) or  not to convert the array to a spreadsheet string in the FileHeader.vi?


 

Download All
0 Kudos
Message 26 of 28
(224 Views)

Hi mc,

 


@mc50100 wrote:

the header is again written in one column instead of being separate for each measurement (csv.png)

 

I also have question because I need to use Write Delimited Spreadsheet instead of writespreadsheetstring,  so do I need convert string Header to array (in File init.vi) or  not to convert the array to a spreadsheet string in the FileHeader.vi? 


Ah, now I see…

 

Two options:

  1. output an array of strings in FileHeader, i.e. delete the ArrayToSpreadsheetString inside this subVI.
  2. Don't use WriteDelimitedSpreadsheet, but WriteTextFile instead…
Best regards,
GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
0 Kudos
Message 27 of 28
(219 Views)

Hi guys,

 

I'm finishing the project, but I had 2 big problems.

 

The first problem: in the Consumer loop when I want to write data to a file, the data is written to me when I just start the program and they are not refreshed further. I think the problem is in the queues, but I'm not sure how to solve it so that my data is refreshed (the program is attached).

 

Second problem: I have to arrange the measurements below each title (attached txt) to be in columns.

0 Kudos
Message 28 of 28
(122 Views)