diff --git a/etc/uldaq.conf b/etc/uldaq.conf index 94c33dabf..d2806fa78 100644 --- a/etc/uldaq.conf +++ b/etc/uldaq.conf @@ -1,3 +1,7 @@ +http = { + enabled = false +} + nodes = { ul201 = { type = "uldaq" @@ -6,11 +10,41 @@ nodes = { range = "bipolar-10", input_mode = "single-ended" signals = ( - { name = "ch0", type = "float", channel = 0, } + { name = "ch0", type = "float", channel = 0 }, ) - sample_rate = 1000, + sample_rate = 5000, vectorize = 100 } + }, + + sigGen = { + type = "signal" + signal = "sine" + frequency = 50 + rate = 1000 + } + vpmu = { + type = "socket", + layer = "udp", + + format = "raw.32.be", + + in = { + address = "*:13001" + + signals = () + }, + out = { + vectorize = 100 + address = "127.0.0.1:13000" + } } } + +paths = ( + { + in = "ul201", + out = "vpmu" + } +) diff --git a/include/villas/nodes/uldaq.h b/include/villas/nodes/uldaq.h index 776547f6d..870061289 100644 --- a/include/villas/nodes/uldaq.h +++ b/include/villas/nodes/uldaq.h @@ -50,6 +50,7 @@ struct uldaq { DaqDeviceInterface device_interface_type; uint64_t sequence; + uint32_t buffer_pos; struct { double sample_rate; diff --git a/lib/nodes/uldaq.c b/lib/nodes/uldaq.c index 6ef1be9b8..af62127c6 100644 --- a/lib/nodes/uldaq.c +++ b/lib/nodes/uldaq.c @@ -319,7 +319,7 @@ void uldaq_data_available(DaqDeviceHandle device_handle, DaqEventType event_type pthread_mutex_lock(&u->in.mutex); -#if 1 +#if 0 UlError err; err = ulAInScanStatus(device_handle, &u->in.status, &u->in.transfer_status); if (err != ERR_NO_ERROR) @@ -339,6 +339,7 @@ int uldaq_start(struct node *n) struct uldaq *u = (struct uldaq *) n->_vd; u->sequence = 0; + u->buffer_pos = 0; unsigned num_devs = ULDAQ_MAX_DEV_COUNT; DaqDeviceDescriptor descriptors[num_devs]; @@ -465,7 +466,8 @@ int uldaq_read(struct node *n, struct sample *smps[], unsigned cnt, unsigned *re if (cnt != n->in.vectorize) return -1; - long long start_index = u->in.transfer_status.currentIndex - (n->in.vectorize-1) * u->in.channel_count; + //long long start_index = u->in.transfer_status.currentIndex - (n->in.vectorize-1) * u->in.channel_count; + long long start_index = u->buffer_pos; if(start_index < 0){ start_index += u->in.buffer_len; } @@ -493,7 +495,7 @@ int uldaq_read(struct node *n, struct sample *smps[], unsigned cnt, unsigned *re smp->sequence = u->sequence++; smp->flags = SAMPLE_HAS_SEQUENCE | SAMPLE_HAS_DATA; } - + u->buffer_pos += u->in.channel_count * n->in.vectorize; pthread_mutex_unlock(&u->in.mutex); return cnt;