LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problems in Clearing Build Table Express VI

Solved!
Go to solution

I am building a VI which generates step signals and sine wave signals using USB - 6001's both output channels. I am acquiring the generated command signals whether it is a step signal or sine wave by looping back the generated command to AI0 and the feedback from other 4 motors as well to AI1 ~ AI3. 

 

I am using build table express VI to log data and then to write it in file. I want to switch between manual command (Step signal) and sine wave command whenever I want during a session and at the end of session I wish to plot all the command signals and feedback signals in a single plot in the order and magnitude as they were given. That is why i am appending the data in a single file. However, when I use manual command for the first time to give let's say three command signals the data is logged properly after pressing 'save data' I also press 'clear data' after saving the data. Then I switch to sine wave it also logs the data properly. At this point if i press plot results the are plotted as I wish. After that I switch to manual command and when I press the 'send command' signal i see that table is not cleared and it remembers the old data as well so I see four data entries in the table while I was expecting to see only one.

 

I have used the "Reinitialize to default value" option already that is of no use because the data temporarily goes but when I write new data the previous data also comes back. I tried to use the reset option of the table as well but since the tables are built in the case structure elsewhere so the clear data button does not serve the pupose even if it is attached to the reset input of table vi. So i tried to use local variables and "Value" property node of tables but that is of no use too. 

 

Please help I am attaching the VI and screen shots as well which show that step signal data is appended with the first three signals while it should not be like that. I wished to get a plot in which there were three step signals before and two step signals after the sine wave.

Hoping for a prompt response from the experts on this. Please forgive me for any stupid mistakes and the messy code because I know I am still learning.

 
 
0 Kudos
Message 1 of 8
(2,978 Views)

Hi shami,

 

are you sure you really need to convert nice waveforms to DDT wires to fulfill your task?

check.png

Beside all those DDT wires: all the BuildTable ExpressVIs are set to NOT clear the data.

Other problem: each instance of the BuildTable ExpressVI will create its own buffer: when you try to fill your table from two different instances they will not know the buffer of each other!

 

Please forgive me … the messy code because I know I am still learning.

Well, you should start to clean up right now. Immediately!

 

Why do you need to write to a local variable AND a property node of the very same FP element in the same place?

check.png

For "Manual Command & Feedback" you even use 3 ways in parallel… 😞

Best regards,
GerdW


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

@GerdW wrote:

Hi shami,

 

are you sure you really need to convert nice waveforms to DDT wires to fulfill your task?

check.png

Beside all those DDT wires: all the BuildTable ExpressVIs are set to NOT clear the data.

Other problem: each instance of the BuildTable ExpressVI will create its own buffer: when you try to fill your table from two different instances they will not know the buffer of each other!

 

Please forgive me … the messy code because I know I am still learning.

Well, you should start to clean up right now. Immediately!

 

Why do you need to write to a local variable AND a property node of the very same FP element in the same place?

check.png

For "Manual Command & Feedback" you even use 3 ways in parallel… 😞


"are you sure you really need to convert nice waveforms to DDT wires to fulfill your task?"

The answer is yes i really am sure. You see that I am using two tables "Manual command and feedback data" and "Manual command and feedback". The first one stores the complete samples i.e. 1000 samples per second and the second table is for presentation to user who only wants to see what command was given and what feedback was acquired so i show the user only one sample after taking mean of the data acquired.

 

For "Manual Command & Feedback" you even use 3 ways in parallel… 😞

I appologize for that 🙂 but you see I was quite frustrated because nothing was working for me when i was trying to reset the tables so I thought of trying all the methods I know to reset the tables and get what I want.

 

I hope you understand now what my intentions were and why i did this? By the way i was working to find the solution and I got an idea about that if i use a global boolean variable whose initial value is False and set it to True whenever i press save data or stop acquisition. This global variable will be used to reset the table when i press send command again and then i set the value of the global boolean variable to False again. What do you say?

Actually I am used to of using programming languages in which I have to write code and specially I am quite good at using MATLAB and that's the reason you see a piece of code of MATLAB in the end to plot the data as well. Anyhow I am going to try the solution I just thought of in the meanwhile if you come up with any other suggestions then please let me know.

Thanks for the quick reply though.

 

 

0 Kudos
Message 3 of 8
(2,925 Views)
Solution
Accepted by topic author shami81

"By the way i was working to find the solution and I got an idea about that if i use a global boolean variable whose initial value is False and set it to True whenever i press save data or stop acquisition. This global variable will be used to reset the table when i press send command again and then i set the value of the global boolean variable to False again. What do you say?"

I think this will be the first time in the history when the person who started the question found the answer by himself :). The above suggested solution in the quotes worked for me.

Thanks but no thanks 🙂

0 Kudos
Message 4 of 8
(2,921 Views)

I forgot to post the solution VI. So there you go guys. Have fun.

0 Kudos
Message 5 of 8
(2,919 Views)

Hi shami,

 

Actually I am used to of using programming languages in which I have to write code and specially I am quite good at using MATLAB and that's the reason you see a piece of code of MATLAB in the end to plot the data as well.

I hope you don't create all that duplicated code in other programming languages as well…

 

See the attachment: I made some "subtle" changes to your measurement loop and the filepath creation.

 

The answer is yes i really am sure. You see that I am using two tables "Manual command and feedback data" and "Manual command and feedback".

That's not the point.

The point is: you don't need DDT wires to create your table content! It will be much easier using the waveform array coming from DAQmxRead! (See attachment: replacing that part of those ExpressVIs and DDT wires reduces VI size by 50%.)

 

This global variable will be used to reset the table when i press send command again and then i set the value of the global boolean variable to False again. What do you say?

There is no global variable in your "solution"…

 

I do say:

- You are using way too much local variables (or even worse "Value" property nodes)!

- You are using way too much duplicated code…

Best regards,
GerdW


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

Thanks for the quick response. However, please upload the file for labview 2014 or earlier I couldn't open the file you uploaded.

Please also guide me about how to avoid using (Value) property nodes. I hope you don't mind teaching me that.

0 Kudos
Message 7 of 8
(2,910 Views)

Hi shami,

 

see attachment.

 

how to avoid using (Value) property nodes.

Use wire.

Best regards,
GerdW


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