Timing of DigOut on the Test device


Recommended Posts

I have two channels setup as Test devices, Dig Out channels and the issue is that if the timing for either one is >zero, then both channels attempt to use that timing. How can I get these two channels to operate independently? Is there something built into the Test device which prevents this from happening?

I'm trying to use these two dummy channels to mirror data from remote copies of DAQFactory into local channels so they can actually be logged (a missing feature?) and I'm using the Event of each dummy channel to do so. Now if A has ?-print statements in its Event and the timing of channel B is changed to >0, then the ?s from A will begin printing as if the timing of A had been affected. Reversing channels A & B in this scenario produces the same result.

Since I've already mentioned it, are there any suggestions on making data from networked copies of DAQFactory available to log into local datasets? I'm having a very difficult time keeping timestamps the same, data spaced evenly, lines not skipped, etc.

Link to comment
Share on other sites

First, you really shouldn't have any timing on a digital out channel. Digital In, yes, but it doesn't make sense for an output channel to have Timing, and in most cases we try and prevent you from setting an output channel's timing to anything but 0. However, even if you switch to Digital In, you need to make sure the two channels have different channel #'s, unless you are using addValue(), otherwise they are essentially the same channel. If you are using Dig Outs with Timing = 0, and doing myChan = someValue, then again they have to have unique channel numbers, otherwise they are essentially the same channel and the data will go to both places.

I'm assuming by networked DAQFactory you mean with multiple Connections giving you live data. Synchronizing this can be a challenge, especially since PC clocks can drift significantly, even over the course of just one day, and any OS time correction is ignored by DAQFactory until it restarts.

How you pull all the data into one log set depends a little on your criteria. If your polling interval is the same across all machines and all channels, and you can put up with a little slop in the timestamp (meaning the timestamp might be slightly off from the actual time the data point was taken), then the easiest way to do this is to create an export set that references all the desired channels across all connections, but with [0] after each so it only exports the most recent reading. Then create a simple sequence like this:

while(1)
   beginExport(myexport)
   delay(1)
endwhile

This assumes your polling interval is one second. It will write a line to the log once a second with whatever the most recent reading is.

Link to comment
Share on other sites

I hadn't given these two unique channel numbers so that behavior is making sense now. I guess Dig Out isn't really intended to have a timing interval.

I'm trying to collect data at ten hertz from 1 remote channel via Connection A, 2 remote channels via Connection B and about a dozen channels on the local connection. It looks like the export() method would be equivalent to a fixed-interval logging set (I'm using AddValue) unless it also has the ability to export data from channels over Connections?

The best solution (least missing points) I've come up so thus far is a loop running @ 50Hz, comparing the timestamp of the remote channel @[1] vs. a local mirror @[1] and adding the most recent two values whenever the local is smaller. Checking [0] resulted in every-other record being a duplicate of the previous but copying two-at-a-time nearly worked (~4% loss based on ~10 min period). Creating a unique sequence for each channel to be copied also seemed to help.

Is it necessary to make data from a channel on a Connection local before logging it? If I understand right, I can just create an export set with those remote channels and call it at my desired interval?

Link to comment
Share on other sites

Logging sets only work with channels on the Local connection. Export sets can export anything. Each column is an expression, so you can have mychannel[0] in one, and remote.mychannel[0] in another, both in the same export set. Then just run the export set at the desired logging interval.

Link to comment
Share on other sites

Archived

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