Virtual Channel Help


Recommended Posts

I am trying to create a virtual channel that uses the last 2 values of an analog channel, but it is not saving a history.  The channel is reading data but no history only one line shows up in the table.

 

What am i missing, does a virtual channel with an expression not write a time stamp each iteration?

 

Link to comment
Share on other sites

I'm assuming you are creating a calculated virtual channel, i.e. you put something like:

mean(myChannel[0,1])

in the expression.  In this case, no, the virtual channel doesn't keep anything.  It does the calculation every time you reference it, and since the calculation doesn't result in history, neither does the V channel.  To do this, you need to use the event of myChannel to update the V channel (and you'll probably have to delete your existing V channel and create a new one).  I personally prefer using a Test D/A channel for this as regular Channels offer additional features, like events, logging, etc, but the concept is the same.

In the event for MyChannel, put:

v.myVChannel = mean(myChannel[0,1])

An event in a channel is script that runs every time a new value shows up in the channel (with the exception of streaming data, where it is called once per block of data).

 

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.