Integration


goldfronts1

Recommended Posts

I'm referring to your post#19 where you state "You can plot it against integral time by setting a variable with the start time and subtracting it from the absolute time. There are a number of recent posts on this forum about doing graphs against dt instead of absolute t."

I am trying to plot against the integral time, new_time. I have a conversion on this called dt.

Thanks

Link to comment
Share on other sites

  • Replies 86
  • Created
  • Last Reply

Yes, add a stream channel for the new_time channel. You might also add /60 to your conversion to have it in minutes from the start. You should not - starttime in your graph because you are already subtracting it in the conversion.

I doubt you get an error from getTime(value). Conversions don't usually generate error messages, they just don't convert.

Link to comment
Share on other sites

I am getting an error message C1013. Attached

The integral time in my x-axis is just a constant number in the table. I have new_time/60 in the x-axis expression. Also the int_v2 data is not consistent to what I am getting if I do the integral by hand. I think this is something to do with the time range that the integral is taking. It should just be from the start of the voltage2 channel time to the stop time.

I hope this is not confusing

Thanks

post-8150-1331315097_thumb.jpg

Link to comment
Share on other sites

The error message is pretty self explanatory. DF can't log the data, probably because you haven't specified a file name in your logging set to actually log to.

The integral isn't the same, but is it the same shape, just shifted? This is what would happen if the integral started early. Also, and I guess we are going round in circles on this, but the method of using a channel Event won't work if you are streaming the data. Try doing this without streaming. You'll still need to reset int_v2 to 0 as you do in the 1st line of the startStream sequence.

Finally, if older data is disappearing, its because the History parameter for the channel is too small. Its set to 36,000, and if you are streaming at 1khz, that means you only get 36 seconds worth of data before old data gets rolled out.

Link to comment
Share on other sites

Ok. I know that you are getting frustrated with me, but I do appreciate your help.

I followed the integral template you posted regarding doing this integral without streaming.

I can see the data in the int_v2 channel however it is not plotting against my new_time channel. The data in the new_time channel is not recording.

I have attached a copy of my .ctl file.

Again, thanks for your help

Setup10.ctl

Link to comment
Share on other sites

Nah, I'm not getting frustrated with you, though you do probably win the contest for longest forum post thread at 62 posts so far. I'm just trying to get you to think about things rather than just cut / paste what I tell you. For one thing, I usually do this off the cuff and so sometimes have typos, but more importantly, by thinking about it, you will learn the concepts and be able to do other things, where simply copying my work will do nothing to better empower you.

I've attached your document, modified to use a Test channel simply so it works without a LabJack. The conversion applied to the voltage channels you can remove as its just to make the Test channel work with the integral. Simply change the two voltage channels back to LabJack channels and you should be good.

No where did I see you updating new_time, which is why the plot wouldn't work.

Setup10.ctl

Link to comment
Share on other sites

  • 4 weeks later...

Hi

I've attached my .ctl file. My question is that the integral that is not actually the integral of the current vs time graph. It is the integral but when I compare it with a numerical integration of the current vs time data in Originlab the y-axis units are off. I am not sure what is causing the y-axis units to be off.

Thanks

Link to comment
Share on other sites

Attached are the integration plots from matlab and origin just for a comparison (the integral was taken from the current vs time plot). Also attached is the integration plot from DAQ Factory Express and the plot in which the integration was done from (current vs time plot).

I just can't seem to figure out what the difference in the units is?

Thanks

post-8150-0-36861100-1334244544_thumb.jp

post-8150-0-79015500-1334244559_thumb.jp

post-8150-0-13637800-1334244571_thumb.jp

post-8150-0-61720700-1334244584_thumb.jp

Link to comment
Share on other sites

I mean that you are apply the conversion from secs to min in the trend, not in the channel. And, yes, you need to convert both X and Y. DAQFactory doesn't know what you are measuring and can't apply conversions automatically. It doesn't know what you are thinking.

And yes, you need to divide by 60. Just try it and you'll see that the graphs match what you are expecting.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.