From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Store 1st iteration value

Solved!
Go to solution

Hello all,

 

I need to do a sort of calibration for a load cell device. I want to subtract the "resting" or intial value of the load cell from the current value that it is reading continuously. I think there should be a way to use shift registers for this, but remember that I am only concerned with the VERY FIRST iteration value.

 

Please let me know if you have any suggestions as to how I can achieve this goal. I have attached a vi for reference. It uses hardware so you will not be able to run it, but you may be able to get a better understanding of my question by looking. 

 

Thank you very much,

 

Paige

0 Kudos
Message 1 of 13
(5,042 Views)

I can't open your VI, but there is a first call node under synchronization in the menu that returns true the first time something has been called in the VI.

 

If you'll be running a while loop more than once, set a shift register instantiated to a true case, then once inside reassign a false to it.

 

There may be better ways to go about it, but these are what I've done so far for first time exceptions.

0 Kudos
Message 2 of 13
(5,032 Views)
Use a select node or case structure to place the value into the shift register if I=0, leave the sr value unchanged at later iterations.

0 Kudos
Message 3 of 13
(5,024 Views)

Try to follow LabVIEW Coding Standards

 

Use Proper Design Pattern (State Machine Architecture in this particular case)

Avoid unnecessary usage of Sequence Structure.

 

Kindly Provide which is your Initial or resting Value and the Current Value based on your code.

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 4 of 13
(4,997 Views)

Hey ,PL have look at attached snippest image for use of shift reg.

Let me know if you are not getting this 

Download All
0 Kudos
Message 5 of 13
(4,971 Views)

@piZviZ wrote:

Hey ,PL have look at attached snippest image for use of shift reg.

Let me know if you are not getting this 


That's not a good example.  I believe your logic is backwards, and nowhere do you store the calibration value.  You are only storing a "counter" which actually stops counting.

 

Here is the way you store a calibration value on the first call of the loop.

 

0 Kudos
Message 6 of 13
(4,964 Views)

That was basically my suggestion. Sometimes you even want an option to manually recalibrate the system later, e.g. as follows (switches are latch action).

 

 

 

 

Message 7 of 13
(4,937 Views)

Callibration logic can be developed in case structure (as shown in my post-true case).You are logically corrected but architecture wise this solution is not flexible.

My answer to this question reflect only logic for 1st iteration not for calibration .

0 Kudos
Message 8 of 13
(4,921 Views)

@piZviZ wrote:

Callibration logic can be developed in case structure (as shown in my post-true case).You are logically corrected but architecture wise this solution is not flexible.

My answer to this question reflect only logic for 1st iteration not for calibration .


Please quote relevant parts so we know what you are replying to. What solution is not "flexible" and what does that term even mean in this context? In what way is your solution more flexible?

0 Kudos
Message 9 of 13
(4,919 Views)

Hello,

 

My problem is that I am reading from an array, so I need to use a for loop. I want the first value of the array to be subtracted from every other value as it comes in. This is the portion of the code I have so far, but I am still a little confused.

 

Can I create a local variable for the first element or something in the true case? This seems simple, but I am having quite the time!

 

Thank you all very much for your help!

0 Kudos
Message 10 of 13
(4,871 Views)