mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
uldaq: add sample configuratioen for ul201
uldaq: fix missing samples by not using the uldaq counter. this may create race iussues
This commit is contained in:
parent
d0a55b91d5
commit
c837b4bebc
3 changed files with 42 additions and 5 deletions
|
@ -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"
|
||||
}
|
||||
)
|
||||
|
|
|
@ -50,6 +50,7 @@ struct uldaq {
|
|||
DaqDeviceInterface device_interface_type;
|
||||
|
||||
uint64_t sequence;
|
||||
uint32_t buffer_pos;
|
||||
|
||||
struct {
|
||||
double sample_rate;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue