LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Accumulating indicator results, and ignoring zero values

Solved!
Go to solution

Hi dear NI members.

 

I have been introduced to labview just three days ago by a friend of mine, an electrical engineering student, i wanted to have a computer based monitoring station for my power consumption, he helped me with designing/purchasing the hardware needed to interface the hardware to the PC (Labview), and i ordered a daq which i should have in a few days, meanwhile i am trying to implement the code which i want to use to display the kWh of which i consume, at this point, i was able to figure out how to display the Kwh value of any given voltage and current values, i am stuck at how can i prevent the indicator (kWh) from dropping below the last displayed value ?, since if i change the current input to zero, the whole accumulation goes to zero, as well as any other low value drops the indicator reading significently, below is a video showing my code with annotations further explaining the issue,  please keep in mind i only started using labview three days ago, any help is appreciated,

 

https://www.youtube.com/watch?v=HmIiCSOrSlU

0 Kudos
Message 1 of 6
(3,728 Views)

Hi Emadjaddaa,

 

attaching a VI here in the forum would be so much better than linking to a video…

 

What do you expect, when you multiply your data with I=0? Multiplying by zero will result in zero…

 

i am stuck at how can i prevent the indicator (kWh) from dropping below the last displayed value ?

You should rething your algorithm!

kWh_current := kWh_previous + I*U*dt
Best regards,
GerdW


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

Ofcourse i understand that multiplying by zero will result in a zero, that is my issue, how can i creat some kind of an array which stores each previous data, and only add to it whatever power is being consumed in an hour base 😄

 

in terms of the formula you have just mentioned, i am assuming ":=" means updated value ?, sorry for my lack of knowledge, but i will give it a shot and post my new code, thank you for now.

 

 

0 Kudos
Message 3 of 6
(3,703 Views)
Solution
Accepted by topic author Emadjaddaa

Hi Emadjaddaa,

 

learn to use shift registers (aka feedback nodes)!

 

check.png

 

in terms of the formula you have just mentioned, i am assuming ":=" means updated value ?, sorry for my lack of knowledge,

You should have heard of "pseudo code"…

":=" is a value assignment: "a := b+c" means "let a be the result of b plus c"!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 6
(3,696 Views)

As Gerd shows, you need to multiply before adding (and storing in the feedback node/shift register). Your existing code is flawed because the I and V are global and don't currently enter in the accumulated values.

Message 5 of 6
(3,674 Views)

After concidering your tips, shift registers really are the way to go in such an application, after carefully analyzing the capture you posted, i did the nessecarry adjustments and got it to work perfectly as shown below, thank you for your guidance

 

Capture.PNG

0 Kudos
Message 6 of 6
(3,651 Views)