From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Writing dynamic data to chart

Hello,

I'm very new at LabVIEW and have run in to a problem that I can't find a good answer for.

Unfortunately, I'm not allowed to post my VI due to company rules, so I hope that my pictures and explanation will be enough, otherwise ask! 

 

So, I'm getting data with Modbus TCP and are presenting it on my front panel. The code is in a while-loop with a 100ms polling speed. All the data should then be both saved in a file and displayed in a chart. I'm currently connecting all my data to different subVIs, where they get transformed to dynamic data and given names for the excel-file, see image "step 1". The subVIs are then connected to a "merge signals" and then added to a "Write to measurement file", see image "step 2". This part works exactly as intended!

 

The problem is the chart. Connecting the dynamic data to the chart, either directly or as in image "step 3" will only result in a dot in the chart, and not actually a line with values. I know that dynamic data is only one value, but I'm missing something. If I take the values directly, merge them and then in to the chart it works as intended. Is there a way to do the same with the dynamic data? Or a good other way to do all this? I really do not want 119 values that has to be drawn across the entire VI to a giant "merge signals" and then into the chart. 

 

Thanks in advance!

 

Regards, 

Elina

 

 

0 Kudos
Message 1 of 8
(3,118 Views)

Hi elicom,

 

The problem is the chart.

Most often the problem is NOT the chart, but the data wired to it…

 

Is there a way to do the same with the dynamic data? Or a good other way to do all this?

Sure: get rid of dynamic data wires (and ExpressVIs)…

 

I really do not want 119 values that has to be drawn across the entire VI to a giant "merge signals" and then into the chart. 

When you need to handle a lot of values an array is usually the tool of choice…

 

On your images:

We cannot debug images. Attach the VI!

Your "Write APPL" subVI has way too many wires going into the VI…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 8
(3,112 Views)

Hello GerdW,

 


The problem is the chart.

Most often the problem is NOT the chart, but the data wired to it…

No, the problem is of course that I can not get the data to be displayed as I want in the chart, but I guess you already knew that. 


 

Is there a way to do the same with the dynamic data? Or a good other way to do all this?

Sure: get rid of dynamic data wires (and ExpressVIs)…

Okey, thank you for the tip, but not very helpful for a beginner if a replacement isn't suggested. 

 


 

I really do not want 119 values that has to be drawn across the entire VI to a giant "merge signals" and then into the chart. 

When you need to handle a lot of values an array is usually the tool of choice…


Yes, I have considered arrays. The problem is that the data is sometimes "word" and sometimes "unsigned words", which arrays do not like. I've tried to make them all the same, but for example a "Boolean To (0,1)" requires "word", while I have another calculation at another place that requires "unsigned word". Do you have any suggestions for that?

 


On your images:

We cannot debug images. Attach the VI!

Your "Write APPL" subVI has way too many wires going into the VI…


As I said in the third sentence, I'm not allowed to attach the VI. A request is sent to my boss for approval, but for now images is the best I can do. 

What do you mean by "to many"? Yes, there are many wires since that are the values belonging to that group, but a subVI can handle up to 28 wires. Is there a recommendation for how many wires that should be used?

 

Regards, 
Elina

0 Kudos
Message 3 of 8
(3,084 Views)

Hi Elina,

 

not very helpful for a beginner if a replacement isn't suggested. 

I don't know where those DDT wires are coming from, so I cannot suggest a replacement for the data source functions!

You don't provide enough information to answer your questions…

When the data source are DataAssistent ExpressVIs: you can easily replace them with DAQmx functions.

 

The problem is that the data is sometimes "word" and sometimes "unsigned words", which arrays do not like.

- LabVIEW doesn't know about "word" and "unsigned word", the datatypes are called I16 and U16, respectively.

- An array of I32 can handle both I16 and U16…

 

but a subVI can handle up to 28 wires. Is there a recommendation for how many wires that should be used?

Yes, there is a recommandation: use the 4-2-2-4 pattern…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 8
(3,079 Views)

@elicom wrote:

 Yes, there are many wires since that are the values belonging to that group, but a subVI can handle up to 28 wires. Is there a recommendation for how many wires that should be used?

 

Regards, 
Elina


If you have that many wires, the SubVI is either doing to much and should be split up, or you should use a Cluster to group the data.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 5 of 8
(3,069 Views)

From your 4th image, it looks like the data (Y-array) is a single value, not much for a graph to draw. That might be a problem.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 6 of 8
(3,065 Views)

God morning,

If I scaled the VI down to the most necessary, I was allowed to post it! *yeay*

 

So, here is the VI and 3 subvi that is working in the same way as the real program. As I said before, the program uses Modbus TCP to get the values. I'm using LabVIEW 2017 and addon "NI Modbus Library v1.1.5.39" by National Instruments. The base is built upon the example "Modbus Library - Master API - Modbus Master example" that is provided in the addon. 

 

As both GerdW and Yamaeda suggested, I have tried with both arrays and clusters but cannot get it to work. (Since I'm a beginner, I'm assuming that I'm doing something wrong).

 

So, I hope this helps and that you might find a way to help me! I would be so grateful!

 

Regards, Elina

0 Kudos
Message 7 of 8
(3,031 Views)

Hi Elina,

 

gosh…

 

- Why do you need to convert numbers to strings just to display them? Why not use simple numeric indicators?

- Why don't you use arrays to display Info1-9 and Acc1-3? Why don't you use a numeric indicator set to binary display mode to display Pre1-4?

- Why do you need to convert numbers that often (example: from U16 to bool to I16 to DBL to DDT)???

 

The attached example just addresses these points of data display/handling. It does not handle all those DDT wires yet. See if you understand the changes I made…

 

I have tried with both arrays and clusters but cannot get it to work. (Since I'm a beginner, I'm assuming that I'm doing something wrong).

As long as you don't attach your code nor explain what exactly "don't work" we cannot tell you what's wrong with your code…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 8 of 8
(3,026 Views)