LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

csv,2D

Hello, I created a CSV with the first column as time and the second column as output values, but it doesn't read them in array order. I'm using DaQ.mx, but it doesn't follow the timing and movement exactly as in the CSV. I would appreciate it if you could help me.

sheep
0 Kudos
Message 1 of 8
(217 Views)

I created a CSV with the first column as time and the second column as output values.

Good.  Please attach this CSV so we can examine it.

It doesn't read them in array order.

Please attach the LabVIEW code that you use to read this text file.  Did the file have headers (such as "Time" and "Output Values", with the rest of the (I'm assuming) rows being the time (in some format) and output (presumably in decimal format)?

I'm using DaQ.mx, but it doesn't follow the timing and movement exactly as in the CSV.

I'm not certain what you mean.  DAQmx is how LabVIEW communicates with devices.  What are you trying to do with this 2D array of Time and Output Values?  Are you writing the Time and Output to some device (to get it to move, for example)?

 

This is a very curious Post.  So little information is presented that it is hard to believe that this is a serious question.  I'm half-expecting some of my colleagues to post that this is a cross-post from Reddit or some other site ...

 

Bob Schor

0 Kudos
Message 2 of 8
(201 Views)

I apologize for the lack of explanation and for not attaching any photos. Regarding the creation content → I want to take the output from AO in CSV, read it every 0.1 seconds with AI, and save it to a new CSV while controlling the output according to the time written in the CSV. However, I have no idea how to handle the timing of this output and which part of it to produce, so I would like some help.

I was told to create them using DAQ.mx. However, I was also told that using the DAQ Assistant is not allowed.

Red is the time, blue is the output value at that moment.

nananass_0-1769055622198.png

 

sheep
0 Kudos
Message 3 of 8
(173 Views)

This is VI. Please, help me.

nananass_0-1769064583207.png

 

sheep
0 Kudos
Message 4 of 8
(149 Views)

@nananass wrote:

This is VI. Please, help me.


This is a picture of a diagram, not a VI!

 

At first glance:

 

  • the entire file IO is contained in a subVI that we don't have.
  • Another subVI is also missing
  • You are doing equal comparisons on floating point data, which is unpredictable and dangerous.
  • the lower loop cannot be stopped
  • The entire comparison operation is very convoluted, doing a comparison with an array, then picking one result, instead of doing a comparison on the relevant element,
  • How often does the file change? Do you really need to constantly read it?
  • If you just want to do data exchange between two loops, a text file is probably the least efficient.
  • Since most labels are not in English, I can't really tell what they say.
  • ...
0 Kudos
Message 5 of 8
(109 Views)

It's urgent. I have no idea how to proceed from here. What I'm trying to create involves measurement using analog output. The details are as follows: First, when the actual time of the VI matches the time written in the CSV, output the value written in the CSV. After that, measure every 0.1 seconds with the AI and save the corresponding time period and output value to the CSV. The use of the DAQ Assistant is strictly prohibited. This is being created on a cRIO-9042. I’ve attached the VI. I want to create this without changing the VI's structure too much, but I haven’t made any progress. Please, I need your help.

sheep
0 Kudos
Message 6 of 8
(68 Views)

Hi nananass,

 


@nananass wrote:

It's urgent. I have no idea how to proceed from here. 


It's urgent to you, not for us: you better start some basic LabVIEW lessons fast…

 


@nananass wrote:

What I'm trying to create involves measurement using analog output.


You don't "measure" with an AnaOut. You should use an AnaIn to measure a signal…

 


@nananass wrote:

First, when the actual time of the VI matches the time written in the CSV, output the value written in the CSV. 


As already said: never compare floats for equality!

Why don't you change your approach to "wait some time, set a new AO value". Then wait for the next value to set the next AO value… (Your timings don't seem to require very accurate delays. Correct me if my impression is wrong.)

 

Btw. it should be sufficient to read the CSV data once before the loop. ("Thinking DATAFLOW" is a very basic LabVIEW mantra!)

 


@nananass wrote:

After that, measure every 0.1 seconds with the AI and save the corresponding time period and output value to the CSV. 


So you want to output ALL the AO values first, then you want to start an AI task with a samplerate of 10Hz?

(This sentence is a very clear hint on what you should implement for your AI requirement!)

 


@nananass wrote:

The use of the DAQ Assistant is strictly prohibited. This is being created on a cRIO-9042. 


Using plain DAQmx functions is fine, and they are easy to use!

The cRIO904x supports DAQmx, so go with those functions.

Have you tried to learn from all those DAQmx example VIs in the example finder?

 


@nananass wrote:

I want to create this without changing the VI's structure too much, but I haven’t made any progress. 


You should change the VI structure quite a lot to reach your goal.

To make progress it would help to learn some LabVIEW basics…

Best regards,
GerdW


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

Something like this:

Yamaeda_0-1769184703002.png

 

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

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 8 of 8
(37 Views)