How to apply zero feature to data logged


Recommended Posts

Hello,

Very new to DAQFactory, the program I am trying to create is a simple loadcell and LVDT, has a zero loadcell and LVDT button and shows the values and logs the value - zero'd value. 

I have everything but the logging working, because it is only logging the V on the input. I was doing all of my conversions with V channels and when I zero my sensors and hit log it still only records the original and not zero'd value. Haven't had a great look at converting the value to a different unit yet using conversions.

Assume the test channel I create are called LVDTTest andLoadcellTest.

I had a look on the forum and found people saying to do something along the lines of LVDTTest.addvalue(myinput[0] * 50 + 4) to a test channel. Not exactly sure I am doing it correctly, is it meant to go into the event of the LVDTTest channel or somewhere else.

Or is there an easier way that I just cant think of.

Any help much appreciated.

Kind Regards

Cameron

Capture.JPG

Link to comment
Share on other sites

First, I would not use V channels.  They are a left over from a very long time ago that remain because customers still like them for some things.  However, they do not work directly with Logging Sets, which is why you aren't able to log them.

Instead you should either create a Test channel and stuff it with your converted data as you described, or use a Conversion to convert the data as it comes in.  Which you use really depends on whether you need to still see the raw, unconverted data.  If you do, then you'll need two places for data, one for raw (the actual I/O channel) and one for the converted data (the Test channel).  If not, then you can just apply a conversion to the actual I/O channel.  The tricky part if you are using a Conversion and single channel is that when you zero, you have to back out the existing zero value.  So for example, if your conversion is:

Value - zeroValue

where zeroValue is some global variable that is initialized to 0 on startup.  If you then have a Zero button that basically takes the current raw value and make it read 0 (like a Tare), then you have to remember to back out the existing zeroValue first.  So if the channel the above conversion is applied to is called LoadCell, the zero button would be:

zeroValue = LoadCell[0] + zeroValue

It would NOT be:

zeroValue = LoadCell[0]

because LoadCell[0] has been shifted based on the current value of zeroValue.

Link to comment
Share on other sites

Hello, 

So I should use global variables and put those into a test channel. The only real problem I am having is where to put the add value function. Is it in the test channel event tab or say where I run my quick sequence on the button? 

Eg button code:

Global loadcellZero = loadcell[0]

LoadcellTest. AddValue(loadcellZero)

Then create a conversion for the test channel:

LoadcellZero =Loadcell[0] - loadcellZero 

does this sound somewhat correct? 

kind regards

Cameron 

Link to comment
Share on other sites

You don't need addvalue() if you are using a conversion.  Just create a conversion:

Value - loadcellZero

Then apply that conversion to your LoadCell channel, by selecting it from the list.  Now your LoadCell channel will display zeroed values once you zero it.

Put:

global loadcellZero = 0

in a sequence marked Auto-Start so when the system loads it will initialize the zero value to nothing.

Then create a button to re-zero with a Quick Sequence action:

loadCellZero = LoadCell[0] + loadCellZero

That is it.  Don't use addValue.  Don't put the channel name in the conversion.  Also don't put an = sign in a conversion.  A conversion is an expression, not a statement.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

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.

 Share