NickB Posted September 16, 2022 Posted September 16, 2022 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? Quote
AzeoTech Posted September 16, 2022 Posted September 16, 2022 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). Quote
Recommended Posts
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.