Hello GregorP,
today i am going to change the structure a little bit, like it´s done in the example vi state machines fundamentals...
so that i don´t have that much code in the event-structure anymore. I don´t know, why that should help anything, but maybe the timing is better.
So, you use implicit timing if you don't need to have a reference, like for counting edges. Therefore you use a Sampleclock.
I don´t get it. I use sample-clock if i want to set the sample rate by my own? And i use the implicit -timing if i (for example) just want to count edges?
What do you think, does my program have a timing-problem? Because i think, that i must get samples in the same time. I read the Period-Task and de Counter-Task as long as the velocity is 1mm/s.
When its slower, i stopp the measurement. After that i need the last value oft the Counter and also the number of samples i read.
The time, my measurement required is : numbers of samples while the measurement/sample Rate.
Therefore i need a exact sample rate!
Are you sure its Error -20028?
Sorry, my fault. It´s Error 200284. The problem is, that i don´t finde any descriptions for this error, I think it has to do with the timeout from my read-task. But i set it to 10 sec, and the while-loop should end when the period is >1s which is equivalent to a velocitiy 1mm/s.
Which Values?
When the measurement ends, i get the values (nachlaufzeit = measurement-time; nachlaufweg= measurement-way)
measurement-time = samples while the measurement/samplerate
measurement-way = max.counter value * 0,1 ( because 10 inkrements = 1mm)
And this values aren´t consistent true. I don´t know why, but mostly i geht 860ms for the measurement-time...even if i start the measurement with 3m/s or 0,2 m/s.
The measurment-way is mostly correct. Just if the velocity is too slow, i get wrong values. For example(sample-rate is 10.000 Hz) i simulate an braking action at 2m/s highspeed and 800mm braking distance. Then my measurement for the measurement-way is good and i get the 800m. But when i simulate the same settings, just change the velocity highspeed from 2m/s to 0,2 m/s the value of the measurement-way is totaly wrong. About 17mm or something. When i have such slow velocity´s, i have to scale down the sample rate to ~1000Hz to get correct values. But whats the difference? I just get less values/sec.
do you have an idea?
For your information: the idea of this program is to measure the way and the time a machine needs from highspeed to stopp after an emergency-stopp!
My measurement is triggert by an input which i get from the safety of the machine. So exactly when i get the trigger at PFI6, de machine begins to stopp! And then my measurement ends when the velocity of the machine is < 1mm/s.
So i count the edges and the period of an encoder.
thank you for your help!
amadeus