03-25-2016 11:34 AM
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
Solved! Go to Solution.
03-25-2016 11:44 AM
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
03-25-2016 12:01 PM
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.
03-25-2016 12:14 PM
Hi Emadjaddaa,
learn to use shift registers (aka feedback nodes)!
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"!
03-25-2016 12:55 PM
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.
03-25-2016 01:42 PM
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