LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

XY graph in event structure

•We are developing a program  to input a data file, and calculate the Total Area with Event Structure.

•The area of the graph  is bounded by the red line cursors in the X Y graph.

•The red cursor lines depends on two external parameters, the dx (FWHM) and the peak difference.

•When the program is run initially, we firstly load the data into the program and the program can calculate the area once.

•Problem: we further vary the value of dx (FWHM) or peak difference in the front panel,  but the calculated areas do not vary accordingly. How can we revise the program? (So, when we vary the value of dx or peak difference, the program can calculate the areas automatically.)

0 Kudos
Message 1 of 7
(1,109 Views)

Hi M,

 


@M_HUI wrote:

•Problem: we further vary the value of dx (FWHM) or peak difference in the front panel,  but the calculated areas do not vary accordingly. How can we revise the program? (So, when we vary the value of dx or peak difference, the program can calculate the areas automatically.)


Then your VI is not programmed correctly and you need to debug it. As you forgot to attach the VI we cannot help you with this task...

 

Hint: check the event settings! This event case is not executed when you change the values on those marked controls...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 7
(1,099 Views)
0 Kudos
Message 3 of 7
(1,089 Views)

I looked at it, but your block diagram is giant and messy.  So I stopped looking at it.

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 4 of 7
(1,035 Views)

Hi M,

 


@M_HUI wrote:

•Problem: we further vary the value of dx (FWHM) or peak difference in the front panel,  but the calculated areas do not vary accordingly. How can we revise the program? (So, when we vary the value of dx or peak difference, the program can calculate the areas automatically.)


Did you follow the hint I gave you in my first answer? It is still valid!

 

Please cleanup your VI!

Why are there unused terminals in the block diagram? Why do you use so many local variables and "value" property nodes instead? Learn to use (more) shift registers!

Why is there no (graceful) way of stopping your VI?

 

Best regards,
GerdW


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

Sorry I am new to Labview.

 

I want to vary the value of Control in the event case, and then execute the calculation in the the event case. How can I improve the program? Thanks.   

0 Kudos
Message 6 of 7
(1,016 Views)

@M_HUI wrote:

Sorry I am new to Labview.


We've all been there. No need to apologize!

 


@M_HUI wrote:

 How can I improve the program? Thanks.   


Try to simplify things.

Try to straighten things out. 

Try to remove redundant code (like setting cursors to a position and then reading them).

Try to remove empty space.

Try to use 1 event structure.

 

Changing nothing functionally, this will reduce your VI to one loop and one event structure, fitting a modest screen.

 

You don't have a lot of code (yet) and it should look as simple as it is.

 

Bugs that cannot be found always have only one cause: things are too complicated.

 

Your bug is still manageable for one with experience, but it's not as simple as it could be. This is preventing you from finding the problem.  

 

Another way to simplify the main is to 'hide' complexity in sub VIs that are in itself simple. Divide and concur. 

0 Kudos
Message 7 of 7
(1,009 Views)