AnalogueSampleSignal

Top  Previous  Next

Development status

 

NOT IMPLEMENTED YET.

 

Message

 

AnalogueSampleSignal <Channel> <ChannelLabel> [–TimeToSample <TimeToSample>] [–Rate <rate>] [–OutputTCP] [-OutputFile <filehandle>] [–MaxTimeToHoard <MaxTimeToHoard>|–MaxSamplesToHoard <MaxSamplesToHoard>]

 

Originator

 

Client

 

Response

 

Info: Sampling channel <channel> as <ChannelLabel>

SyntaxError: insufficient parameters to AnalogueSampleSignal

SyntaxError: invalid parameters to AnalogueSampleSignal

Error: no such file handle open

 

Response (immediate socket)

 

Success

Failure

 

Details

 

Channel = the name or number of the channel to sample

ChannelLabel = the label used to tag data returning from this channel

 

–TimeToSample = the time (in ms) for which to sample the channel (e.g. 60000 for a 1-minute sample, 3600000 for a 1-hour sample). A sample time of '0' will cause Whisker to sample until an AnalogueCancelSample command is received; this is the default.

 

–Rate = the frequency, in Hz, with which to sample the channel. The default is 1 Hz. An analogue input card such as the Amplicon PCI230 can sample at up to 312 kHz (–rate 312000). A typical slow-technique electrochemistry experiment might sample once every 20 s (–rate 0.05).

 

–OutputTCP causes data to be returned down the TCP socket directly to the client. The main socket is used, and never the immediate socket, as data can turn up unpredictably (just like digital events). Data returned over the TCP socket is prefixed with AnalogueData: (see AnalogueData for the data format). The –OutputTCP command can be used in conjunction with –OutputFile.

 

–OutputFile causes data to be logged to the file with the specified handle (see AnalogueOpenOutputFile and AnalogueCloseOutputFile). The file format is described under AnalogueData. This command can be used in conjunction with –OutputTCP.

 

–MaxTimeToHoard and –MaxSamplesToHoard determine the number of samples (or the time in milliseconds) that the server will 'hoard' before sending them to the client. You may specify this either as a time or as a number of samples (but not both). If you are sampling at 250 Hz, for example, you might want the server to tell you the sampled value as soon as each sample comes in (–MaxTimeToHoard 4 or –MaxSamplesToHoard 1), or you might want to be kept up to date only every second (–MaxTimeToHoard 1000 or –MaxSamplesToHoard 250). Note 1: the server reserves the right to send data out more frequently than you specify (it may do this if its buffers are becoming full and it wants to offload some data). Note 2: if you specify a MaxTimeToHoard that exceeds the sampling period (e.g. if you sample at 0.05 Hz or every 20 s and ask the server to hoard samples for a maximum of 1 s before sending them to you) the server will not send you data until it has some, but it will send data when that time comes.

 

Samples are always time-stamped with the system 24h clock and the internal system clock, to millisecond accuracy.

 

Examples

 

AnalogueSampleSignal 2 Bed2_ECG_LeadII –Rate 250 –OutputTCP

AnalogueSampleSignal 3 Bed2_PCWP –Rate 100 –OutputTCP

 

Comments

 

One AnalogueSampleSignal command sets up sampling on one channel only. Similarly, one AnalogueData: message contains data for one channel only. If multiple channels are being sampled simultaneously, multiple messages will be sent.

 

Output lines can be sampled. Why? So you can correlate input voltages from the ADCs precisely with output values that are being played back from a buffer to a DAC — see below — and have both input and output voltages accurately time-stamped. Note: At high data rates, Whisker delivers a sequence of output values to the DAC and relies on the DAC to time them correctly. Similarly, at high data rates, Whisker requests a whole series of data values from the ADC (and relies on the ADC to time them correctly). Therefore, as a tip: if the DAC values must be precisely correlated to ADC input values, you should wire a copy of the DAC output to a spare ADC directly.

 

If you issue a second AnalogueSampleSignal command on a channel you were already sampling, the new settings will override the old, effective as soon as possible.

 

See also

 

AnalogueData
File format for analogue data written directly to disk