Jump to content

Rate of Change


Recommended Posts

I have a chart that displays my load and indicators stating the current load values from test lab equipment. I've been asked to have my program also display ramp loading, so basically i have to chart the rate of change of the load. Can I some how graph the rate of change, or difference between a value and it's previous value?

Link to comment

Welcome single poster,

Maybe I am paranoid, but this sounds like class work. You should be showing us what you have done (attach code or screen dumps of the block diagram) to encourage us that you are doing real work rather than trying to get a leg up on your classmates.

I will give you a hint though. You need to understand and use shift regsiters on your loop structures. Then you must understand how to feed more than one plot to a chart or graph. All the information you need to do these things is part of the regular help and example code of LabVIEW. There are also a comprehensive knowledge bases that you should learn to use at ni.com.

Best regards,

Mike

Link to comment

QUOTE (mross @ Jul 3 2008, 09:03 AM)

Welcome single poster,

Maybe I am paranoid, but this sounds like class work. You should be showing us what you have done (attach code or screen dumps of the block diagram) to encourage us that you are doing real work rather than trying to get a leg up on your classmates.

I will give you a hint though. You need to understand and use shift regsiters on your loop structures. Then you must understand how to feed more than one plot to a chart or graph. All the information you need to do these things is part of the regular help and example code of LabVIEW. There are also a comprehensive knowledge bases that you should learn to use at ni.com.

Best regards,

Mike

I appreciate the help mike. This isn't class work, it is code for an double slid ACTR (track roller) test machine. I did not write the (rather large amount of) code for it since its been in use long before i entered the company but i have been asked to modify it. I apologize that i can not post the code for our test rig. However, thank you for the direction. Anything else would be greatly appreciated

Link to comment

As Mike suggested, store the current value in a shift register, then on the next iteration use the shift reg value (prev val) and subtract from current value, and add that to the chart.

should be easy enough. Look at examples on shift registers. I would advise spending a few days with the LabVIEW introduction books and manuals that came with the software. Or look through all the basic examples to get your head around LV.

Changing complex code without knowing what your doing can be catastrophic.

Neville.

Link to comment

QUOTE (solerpwr07 @ Jul 3 2008, 10:31 AM)

I appreciate the help mike. This isn't class work, it is code for an double slid ACTR (track roller) test machine. I did not write the (rather large amount of) code for it since its been in use long before i entered the company but i have been asked to modify it. I apologize that i can not post the code for our test rig. However, thank you for the direction. Anything else would be greatly appreciated

OK.

Actually a shif register is not needed (but you should learn about them). Here is how to take an array and calculate the rate of change between points. I faked up a sine wave, calculated the slopes, put them together with the sine wave an show them in a graph. But the easy way that doesn't teach much is to take the derivative.

It is kind of a dirty trick, but you will have to create all this yourself. Your penance for not posting your own code, so to speak.

Link to comment

QUOTE (mross @ Jul 3 2008, 01:00 PM)

Actually a shif register is not needed (but you should learn about them). Here is how to take an array and calculate the rate of change between points. I faked up a sine wave, calculated the slopes, put them together with the sine wave an show them in a graph. But the easy way that doesn't teach much is to take the derivative.

I may be missing something, but this approach only works for post-processing, doesn't it? If that's all you need to do, this can also be done with a lot less real estate using the Rotate Array function.

Link to comment

QUOTE (Gary Rubin @ Jul 3 2008, 01:12 PM)

I may be missing something, but this approach only works for post-processing, doesn't it? If that's all you need to do, this can also be done with a lot less real estate using the Rotate Array function.

I suppose you are right - sort of. Since you must have more than one datum to get rate of change doesn't that make it always post processing? And you can't rotate an array until you have one. Hard to beat the derivative for real estate.

I tend to do everything as post processing so it slipped my mind that he was sounding like it was on the fly. Another good reason to post code. No misunderstandings and no benefactors wasting time.

As for on the fly, using a shift register to save that last datum allows one to calculate rate of change as each new point comes in.

Link to comment

QUOTE (mross @ Jul 3 2008, 06:30 PM)

LV 8.5 (PDS anyway) has a point-by-point differentiation vi, although I've never actually used it myself. What I've tended to do is to use a shoft register to store thae last n data points (and timestamps if the data is not being evenly sampled) using a rotate array and replace array element to insert the new data points and having initialised the array with the first datapoint repeated n times. You then feed that to a linear fit and use the slope as the first derivative. That is more robust against eexperimental noise than just using (y[n]-y[n-1])/t[n]-t[n-1]), although it does mean that the derivative lags behind the data by n/2 points, which is a problem if the data changes slope suddenly. You can work around this a bit at the expense of a noiser derivative by fitting a higher order polynomial and using the co-efficients of the fit to calculate the derivative. That's broadly what http://en.wikipedia.org/wiki/Savitzky%E2%80%93Golay_smoothing_filter' rel='nofollow' target="_blank">Savitsky-Golay filtering

does.

Link to comment

Hope all had a good holiday and long weekend.

ive put up the area of code where it displays the loads put on each of the different (8) test specimens. can the change in load be carried out directly from (after) the doubles; replace the area where you all generated data? i know there is a space issue, but that can be taken care of.

MyBitmap.jpg

Link to comment

Space issue...this is the fault of less than optimal coding preactice. I don't see a single sub-Vi on there and that is wrong. Very hard to read and hard to trouble shoot. You should make it a point to encapsulate functional sections of the code into sub-Vis. I understand that it doesn't add much value relative to proper coding up front, but it may have some merit just the same. When writing new code you should become familiar with the practice.

Mike

Link to comment

QUOTE (solerpwr07 @ Jul 7 2008, 06:14 PM)

Hope all had a good holiday and long weekend.

ive put up the area of code where it displays the loads put on each of the different (8) test specimens. can the change in load be carried out directly from (after) the doubles; replace the area where you all generated data? i know there is a space issue, but that can be taken care of.

Hi,

This code is unmaintaneble. I suppose it grows every week.

What's the use of the 2D arrays? You can use 'concatenate arrays' (right click on the build array nodes)

Why devide by 5, absolute, multiply by 5? Absolute would do.

You should write wrappers around a lot of the functionality you use, you can place the feedback nodes inside those VIs

Ton

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.