02-27-2020 03:20 AM
@RavensFan wrote:
No, the use of those functions is not correct.
Wiring in a 1 set the timer to wait 1 millisecond.
The output of that function returns the time in milliseconds of the overall PC timer. Basically the number of milliseconds since the PC booted up. Put a probe on that wire and see how large that number is. And be sure to read the help file on that function like was mentioned earlier.
I have yet to see a use for the output of the timer unless you are using it to compare different times to see how much has elapsed between two iterations of a for loop by taking the difference between those values. And when I want to do that, I just use the Tick Count function.
I think you need to have a little talk with your "senior" and clue her in.
Usually I put only one Wait for each loop that acts as a delay between iterations. However, as I said I just refer blindly to my "senior's" coding as shown in Figure below, she put wait function for every derivative or integrator block. This is why I don't understand. I could not manage to ask her as she already graduated and fly back to her country.
and yes, you're correct to use Tick Count function to see how much has elapsed between two iterations of a for loop.
02-27-2020 03:22 AM
Hi mansamewoi,
I just follow people's work blindly. What should it be?
Following other people blindly will not make you a good programmer…
@mansamewoi wrote:
Is there any example for the correct one please?
Please:
02-27-2020 04:16 AM
@GerdW wrote:
Hi mansamewoi,
I just follow people's work blindly. What should it be?Following other people blindly will not make you a good programmer…
@mansamewoi wrote:
Is there any example for the correct one please?Please:
I am trying to do as yours, but I have got broken wires since there are two different data type.
Then, I keep the datatype as before :
I'm trying to run, unfortunately the reading is still zero at the output of derivative block (Vib (mm) 4). Then, I I removed the LPF, the results are still the same as
02-27-2020 04:28 AM
GerdW has used the point by point differential block
02-27-2020 04:31 AM
Hi mansamewoi,
@mansamewoi wrote:
I am trying to do as yours, but I have got broken wires since there are two different data type.
No, you don't do as me: I used Pt-By-Pt functions from signal processing -> Point-by-Point palette…
(Do you see that red arrow in their icon?)
02-27-2020 06:34 AM
@GerdW wrote:
Hi mansamewoi,
@mansamewoi wrote:
I am trying to do as yours, but I have got broken wires since there are two different data type.
No, you don't do as me: I used Pt-By-Pt functions from signal processing -> Point-by-Point palette…
(Do you see that red arrow in their icon?)
Sorry, my bad. I just knew there still have another blocks for integration/derivative. BTW, why do we need to divide by 1000? what does it mean?
another thing, I also try to use another continuous derivative block as here as
and I've got the same pattern of the chart with different values of y-axis as
How to use continuous derivative block?
02-27-2020 06:46 AM
The /1000 is converting milliseconds to seconds. This will result in your output having the units of change in value/second. (V/s for example)
I've not seen that second block you have added before, but it looks like an express VI and I am guessing that it is giving you an output which is change in value/millisecond (e.g V/ms) seeing as the y axis is 1000 times smaller
02-27-2020 06:56 AM
@Niatross wrote:
The /1000 is converting milliseconds to seconds. This will result in your output having the units of change in value/second. (V/s for example)
Is it a must to divide by 1000 or depends?
I've not seen that second block you have added before, but it looks like an express VI and I am guessing that it is giving you an output which is change in value/millisecond (e.g V/ms) seeing as the y axis is 1000 times smaller
Yes, you're correct.
02-27-2020 07:07 AM
It is up to you. It depends upon what you want your output units to be.
In the detailed help it gives the equation for the maths which is going on. When you wire the dT terminal you are just supplying a value to use as dT in that equation. if that is in seconds and you measurement is in volts your output units will be V/s, if you put milliseconds into the dT terminal your output units will be V/ms.
02-27-2020 07:24 AM
@GerdW wrote:
Hi RavensFan,
@RavensFan wrote:
I have yet to see a use for the output of the timer unless you are using it to compare different times to see how much has elapsed between two iterations of a for loop by taking the difference between those values. And when I want to do that, I just use the Tick Count function.
I use that quite often: have a loop wait for a certain amount of time AND calculate the elapsed time for the last loop iteration. Why use two functions (Wait + TickCount) when one (Wait) provides all needed inputs/outputs?
I've never felt the need to do both things in the same loop.
I only want to time the loops that I have no idea how long they take, and then only for troubleshooting purposes.
If I'm trying to control the loop iteration time with a wait function, it's because I'm sure the other code is going to run fast than that anyway, so the iteration time is usually the same as the wait time.
If I do want to do both, like for troubleshooting, then I wind up adding separate timing functions for that because I want something to be able to easily remove later.