LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to write a "change of error" problem?

I get a AI value(error(t)) from USB-6008, then I need to find out the Change of error. How I can do that?

 

"Change of error" = error(t) - error(t-1)

 

I try delay function to write that but can't do it

0 Kudos
Message 1 of 7
(3,243 Views)
I am not understanding it very clearly. Do you mean you want to keep track of the error flow? like different stages?
0 Kudos
Message 2 of 7
(3,232 Views)

See attached image. You'll need to measure the Error(0) outside of the loop to initialize the shift register, then continuously read the error signal Error(t) inside the loop.

 

 

0 Kudos
Message 3 of 7
(3,223 Views)

The code example in your diagram does not make sense...  Which is probably why you are asking for help..

 

The value in the shift register will not change.

 

Can you write a pseudo code representation of what you would like to achieve?

 

R

0 Kudos
Message 4 of 7
(3,217 Views)
Ray, I was using numeric controls for the example instead of whatever method fung would use to measure the error signal.
0 Kudos
Message 5 of 7
(3,188 Views)

Hi fung,

 

The code that sgregor249 posted does execute the formula you requested.  (You'll have to add a stop condition to the while loop, though)

 

If your AI Error(t) measurement is simply a voltage, all you need to do is replace the AI Error(t) control in his example with your DAQmx Read and set the initial error value as well.  After doing so the voltage measurement from the previous iteration will be subtracted from the voltage measurement from the current iteration.

 

If you want more information about how shift registers work (the up and down arrow on the edge of the while loop) check out the LabVIEW Help: Transferring Values between Loop Iterations

Eric S.
AE Specialist | Global Support
National Instruments
0 Kudos
Message 6 of 7
(3,167 Views)

sgregor249 wrote:
Ray, I was using numeric controls for the example instead of whatever method fung would use to measure the error signal.

 - sorry - 

😞

 

my bad..

0 Kudos
Message 7 of 7
(3,134 Views)