LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Weight management

Good day everyone,

I am fairly new to LabVIEW interface and this problem might not even a "problem" to pros.

So my task is to create a system that calculates remaining weight. First, the user will enter the maximum weight available. Then, as we enter a weight value, the available weight will be decreased. The process will need 4-5 weights to be entered. I really need your recommendations on how to do this.

Thanks in advance!

0 Kudos
Message 1 of 10
(1,695 Views)

Hi Qii,

 

First, the user will enter the maximum weight available. Then, as we enter a weight value, the available weight will be decreased. The process will need 4-5 weights to be entered.

- So you want to get the difference of two values? Use a subtract function!

- you want to repeat a certain task several times? Use a loop!

- you want to keep a value for the next loop iteration? Use a shift register!

 

General hint: Before starting to code you should create an algorithm. Draw that algorithm on a sheet of paper. (Yes, paper and pen…)

Best regards,
GerdW


using LV2020 on Win8.1+cRIO
Message 2 of 10
(1,681 Views)

Thanks for your bright explanation. But still, I am clueless. The shift register does store previous values, but how do I stop it from a continuous loop; as I want to enter a new weight each time. Can you show me? I have attached you the picture of the code.

0 Kudos
Message 3 of 10
(1,621 Views)

You are subtracting the same value millions of times per second, soon you'll be at -infinity. 😮

The "Weight of baggage" control will only get read once at the start of the program. If it should get read whenever it changes, place it inside the loop and use an event structure

 

You really need to start with a few LabVIEW beginners tutorials!

 


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
Message 4 of 10
(1,619 Views)

Thank you. How do I initialize the maximum weight, without causing trouble to the shift register's value? While the rest of the work involves only weight of baggage and the weight available.

0 Kudos
Message 5 of 10
(1,579 Views)

define what you mean by "trouble". You can initialize the shift register with the max if that's what you want.


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 6 of 10
(1,575 Views)

How do I do that? Setting the maximum weight to max. Btw, can you please take a look on my coding attached. It seems that I could not involve the weight of baggage as I run the program.

0 Kudos
Message 7 of 10
(1,557 Views)

Your event structure is set up for the value change of the wrong control.  You set it for the indicator Weight Available which will never trigger an event.  You need to change it to the control Weight of Baggage.

 

Be sure to stretch out your labels so that we can see the whole label.  Since you went to the bigger font, most of the words are getting cut off.

0 Kudos
Message 8 of 10
(1,548 Views)

In addition to what Ravens said:

 

  • The "weight available" indiicator belongs before the event structure (and subtract node) so it updates as soon as the program starts. Right now if could contain stale data from the previous run until the event is triggered.
  • All you need is a single event case (for weight & stop: value changed)
  • Since the "Max weight" cannot be changed during the run, you might want to disable/grayed it.
  • A better way would be to keep it inside the loop and loop changing it. Add the baggage weights inside the shift register (initialized with zero) and subtract from the max whenever either changes.
  • ...

 


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 9 of 10
(1,532 Views)

Maybe this can give you some ideas .... (other event case is for max/esc: value changed)

 

Baggage.png


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 10 of 10
(1,529 Views)