10-10-2022 04:27 AM
Hi everyone,
I'm trying to derivate an edge-counting-signal using the derivative x(t) PtByPT VI. The problem is that I want dt to be exactely 1 second. It seems that setting the dt-Input to 1 doesn't mean that dt = 1 second. However, the derivative worked perfectely when I added a wait-function to my programm and set 1 second as waiting-time. It seems that the programm take the value I set in the wait function as "dt" of my derivative VI ?
Now my problem is that my wait function dramatically delays the data-logging.
any suggestions?
best regards
Solved! Go to Solution.
10-10-2022 04:38 AM
@Ezzow wrote:It seems that setting the dt-Input to 1 doesn't mean that dt = 1 second. However, the derivative worked perfectely when I added a wait-function to my programm and set 1 second as waiting-time. It seems that the programm take the value I set in the wait function as "dt" of my derivative VI ?
Now my problem is that my wait function dramatically delays the data-logging.
The dT you provide the derivative should match the real dT.
If you set it to 1 s, the dT should be 1 s.
If your dT isn't 1 s, derivative doesn't magically start working at 1 s (it is PtByPT, so each input has an output).
You can:
a) make a parallel loop that takes derivatives every 1 s, with a current value from the other loop,
b) provide the derivative with the real dT (time - previous time).
@Ezzow wrote:
I'm trying to derivate an edge-counting-signal using the derivative x(t) PtByPT VI. The problem is that I want dt to be exactely 1 second.
You need to explain this...
If you want dT to be exactly 1 s, you should sample at 1 s.
You can set dT to exactly 1 s, but the output will be wrong (unless dT is 1s).
In the end, the derivative is simply (x - x previous) / dT...
10-10-2022 04:45 AM
@wiebe@CARYA
Thank you for your reply 😊
I tried to use parallel while loops but they didn't work simultaniously when any kind of data is transfered from one to anther loop. Did I miss something by doing this?
It would be great if you could add another loop in my VI so I understand how it actually works.
best regards
ezzow
10-10-2022 06:11 AM
@Ezzow wrote:
I tried to use parallel while loops but they didn't work simultaniously when any kind of data is transfered from one to anther loop. Did I miss something by doing this?
Probably. Hard to say without seeing any code.
@Ezzow wrote:It would be great if you could add another loop in my VI so I understand how it actually works.
We'd first need to know (and understand) your goal.
If you want 1 s derivatives, why would you sample faster?
If you don't need 1 s derivatives, why not use the actual dT?
If you want to split loops, why split the DAQ and derivative? Why not split the 2 DAQ devices?
10-10-2022 06:47 AM - edited 10-10-2022 06:50 AM
@wiebe@CARYA
If you want 1 s derivatives, why would you sample faster?
If you don't need 1 s derivatives, why not use the actual dT?
I think you're right. My dt must be the real dt. Please forget about what I said about 1s. I think it was just a random value.
My goal is to calculate a normal derivative: (X(i+1) - X(i)) / dt
So I need the actual dt. That's why I tried the attached solution. Now my dt must be real. However, the part my X(i) is not saved after every iteration so I can build the difference (X(i+1) - X(i)). With this my X(i) is always equal 0.
how can I save my X(i) ?
If you want to split loops, why split the DAQ and derivative? Why not split the 2 DAQ devices?
Because the wait functions delays my data logging. If I split the 2 DAQ devices I have to put the wait function in their loop. Which will delays the data.
10-10-2022 07:00 AM
@Ezzow wrote:
@wiebe@CARYA
If you want 1 s derivatives, why would you sample faster?
If you don't need 1 s derivatives, why not use the actual dT?
I think you're right. My dt must be the real dt. Please forget about what I said about 1s. I think it was just a random value.
My goal is to calculate a normal derivative: (X(i+1) - X(i)) / dt
So I need the actual dt. That's why I tried the attached solution. Now my dt must be real. However, the part my X(i) is not saved after every iteration so I can build the difference (X(i+1) - X(i)). With this my X(i) is always equal 0.
how can I save my X(i) ?
With a shift register (or feedback node).
10-10-2022 07:04 AM
@Ezzow wrote:If you want to split loops, why split the DAQ and derivative? Why not split the 2 DAQ devices?
Because the wait functions delays my data logging. If I split the 2 DAQ devices I have to put the wait function in their loop. Which will delays the data.
If you have two DAQ loops, they can both run independent of each other. You wouldn't need waits, both DAQ loop can run as fast as they want.
Both loops would simply publish their most recent value, and another (3rd) loop could run any paste and get the most recent value.
But if you want them time synchronized, you wouldn't need two loops.
10-10-2022 07:13 AM - edited 10-10-2022 07:15 AM
I don't see from this picture where my X(i) output is? ( I'm quite new to labVIEW 🤓)
I only see how to calculate the real dT which I already did in the programm in my last reply (see attachement)
10-10-2022 07:14 AM
I got your point. But I want them synchronized
10-10-2022 07:25 AM
It worked perfectely with the feedback node. Many thanks @wiebe@CARYA
However, I would like to understand how you did it with the screenshot you sent 😄