LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Understanding event structure

Solved!
Go to solution

I was searching how to display multiple plots on a single chart and came across this thread.

 

@altenbach provided a neat solution to program chart characteristics, which I have used in my VI. But the chart doesn't update. It changes only when I check/uncheck one of the plots or when I click on clear.

girish_jadhav_0-1606831839018.png

 

Even the stop button doesn't function when the event structure is in the VI and I have to click on Abort Execution.

 

Can anyone please explain to me what is going on?

0 Kudos
Message 1 of 12
(2,076 Views)

The event structure waits for an event.  Your loop will once per event.

Add a timeout case to the event structure.

Wire that a constant (<<1000) to the timeout terminal of the event structure.

"If you weren't supposed to push it, it wouldn't be a button."
Message 2 of 12
(2,050 Views)

Get rid of the event structure. Since you are spinning the loop anyway, you can just poll these buttons and activate certain code based on controls (use simple case structure with the FALSE case empty).

 

.I would recommend NOT to use the timeout case, because it will interfere with your loop timing.

 

You can get rid of the "select channels control". Just show the visibility checkbox. No code needed.

 

I would probably place the event structure in a parallel loop.

 

There are plenty of problematic issues in your code. Let me look at it.

0 Kudos
Message 3 of 12
(2,029 Views)
Solution
Accepted by topic author girish_jadhav

@altenbach wrote:

I would probably place the event structure in a parallel loop.

 

There are plenty of problematic issues in your code. Let me look at it.


Here are some comments:

 

(Also never maximize the front panel and diagram to the screen. Makes it hard to debug)

 

 

altenbach_0-1606845424759.png

 

Message 4 of 12
(2,022 Views)

(Also never maximize the front panel and diagram to the screen. Makes it hard to debug)

 

 

altenbach_0-1606845424759.png

 


Thank you for the comments @altenbach.

I did not understand what you mean by do not maximize the front panel and diagram to the screen. I didn't do this! Or may be I did and do not what the correct terminology is. 

0 Kudos
Message 5 of 12
(1,993 Views)

@girish_jadhav wrote:

I did not understand what you mean by do not maximize the front panel and diagram to the screen. I didn't do this! Or may be I did and do not what the correct terminology is. 


When I open your main.vi, the front panel fills my entire 2560x1440 screen. Same for your diagram. I am not sure why that is, but my own VIs never do that. This makes it difficult to e.g. look at the help while editing. You would constantly need to switch between windows and lose focus. A gigantic diagram windows also promotes sloppy, oversized code.

 

Can you explain your use of the integration and what you are expecting from it.

0 Kudos
Message 6 of 12
(1,981 Views)

@altenbach wrote:

@girish_jadhav wrote:

I did not understand what you mean by do not maximize the front panel and diagram to the screen. I didn't do this! Or may be I did and do not what the correct terminology is. 


When I open your main.vi, the front panel fills my entire 2560x1440 screen. Same for your diagram. I am not sure why that is, but my own VIs never do that. This makes it difficult to e.g. look at the help while editing. You would constantly need to switch between windows and lose focus. A gigantic diagram windows also promotes sloppy, oversized code.

 

Can you explain your use of the integration and what you are expecting from it.


I wanted to calculate E = P * t and used the integration. But I see my mistake now as it just displays whatever the power value is being read from the digital power meter. I think it is better if I log all these data and later calculate the energy consumed. 

0 Kudos
Message 7 of 12
(1,957 Views)

@girish_jadhav wrote:
I wanted to calculate E = P * t and used the integration. But I see my mistake now as it just displays whatever the power value is being read from the digital power meter. I think it is better if I log all these data and later calculate the energy consumed. 

 

As I mentioned, maybe Integral x(t) PtByPt VI would work.

0 Kudos
Message 8 of 12
(1,948 Views)

@altenbach wrote:

@girish_jadhav wrote:
I wanted to calculate E = P * t and used the integration. But I see my mistake now as it just displays whatever the power value is being read from the digital power meter. I think it is better if I log all these data and later calculate the energy consumed. 

 

As I mentioned, maybe Integral x(t) PtByPt VI would work.


I will try that method (y)

0 Kudos
Message 9 of 12
(1,944 Views)

@girish_jadhav wrote:

(Also never maximize the front panel and diagram to the screen. Makes it hard to debug)

 

 

altenbach_0-1606845424759.png

 


Thank you for the comments @altenbach.

I did not understand what you mean by do not maximize the front panel and diagram to the screen. I didn't do this! Or may be I did and do not what the correct terminology is. 


I have one more question. Why did you add clear and stop control for the event? I removed stop and I don't see any changes. 

0 Kudos
Message 10 of 12
(1,867 Views)