03-30-2024 07:56 PM - edited 03-30-2024 08:00 PM
Hi there,
I have a LV program which contains voltage, current and power data into the same waveform. I am planning to extract each of them one by one and putting into array. Currently, I have extracted only the voltage waveform and converted the data into a CSV file.
However, the problem is that the time stamp (dt) and the y value are in the same cell of the CSV file which requires to post process in excel to get tab delimited format. I would like to get the end result without post processing.
Can anyone help me to correct the code with delimitor?
Moreover, If I want to add two more data (Current and power), how can I append them into another two columns in the CSV file and synchronize with the relative time (dt)?
03-31-2024 05:08 AM
Hi hk,
@Hk637 wrote:
Moreover, If I want to add two more data (Current and power), how can I append them into another two columns in the CSV file and synchronize with the relative time (dt)?
You just need to add more columns to your array...
To find the correct delimiter you could create a CSV file with Excel and read it in a text editor to actually see the used delimiter char. Usually you could use a Tab, comma or semicolon: Excel can handle them all...
On your VI: replace the local variable by a wire!
What's the point of wiring a constant to the case structure selector?
03-31-2024 05:11 AM - edited 03-31-2024 05:18 AM
In assumption that your "Value" array contains all three waveforms and you have the same dt and t0 for all of them, then try this way:
Side notes:
* "Default" Delimeter for Excel *.csv files is ";"
* Avoid race condition between terminal and local variable (you can't say what will be first — write to terminal or read from variable), so you don't need to wire N terminal if you need to iterate over all input array elemenths:
These two construction semantically equivalent:
* And you don't need parallel for loop in this case
Hope it helps.
03-31-2024 09:54 AM - edited 03-31-2024 10:04 AM
Hi Andrey,
Thanks for the details code and explanation. I modified the code a bit using event structure and from there I am giving the file path.
It worked :).
Moreover, I noticed that the power data are not correct (P=VI), when voltage is zero. There is still power which is not true I think. Do you think that the time is not properly synchronized?
Thanks in advance.
03-31-2024 02:34 PM - edited 03-31-2024 02:36 PM
This is still convoluted and probably wrong. You assume that all waveforms have the same dt (since you only do one time column!), but yet you calculate the same time array N times while only keeping the last one..
See if this can give you some ideas