LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to input a time to a Function node?

the tick count works just like a watch ~ but how to set the number to 0 when a press the stop button?

 

i use a indicator to indicate the time value ~ but this value is just keep on increasing, and can not return to zero. 

0 Kudos
Message 11 of 17
(1,268 Views)
For the tick count~ every time i stop the VI, when i restarted it, the output value will started from the last value when i stop it, how can i make it to started from 0?
0 Kudos
Message 12 of 17
(1,259 Views)
Tick count is a timer that keeps running forever from the moment you startup the computer. Its absolute value is rather meaningless and has an interval of 4294967 s = 1193 hours after which the counter rolls over and starts from 0 again. However the most meaningful use of the Tick Count is the calculation of the difference between two values. Since it is an unsigned integer the result of a subtraction is correct even if the counter has rolled over in between (of course rolling over more than once can't be detected and therefore won't be possible to time in such a way).
Message Edited by rolfk on 04-15-2010 08:30 AM
Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 13 of 17
(1,256 Views)

Hi fourteen,

 

use a loop. Outside the loop you get a "start" tickcount value. In the loop you subtract the start value from the current tickcount to get "elapsed time" starting from zero. Simple math Smiley Wink

 

TickCount just provides a counter. To get elapsed time you have to subtract two counter values...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 14 of 17
(1,254 Views)

I have managed to get a example for a tick count to reset the counter.

 

Right now i am facing another problem, as the lab computer so not have matlab, i have to use the function node to generate the trapezoidal profile!

i use Vmax, Amax, t, Pi as the input, and Po as the out put, and define

double p0, p1, p2, t0, t1, t2;

and the things i wrote in the function is below, but labview keep on show me that there are errors, like con not use double to define the data type, and the use of if else is also wrong~

can you do me a fever to point out where is the problem and how to correct this??

or which way i should go to solve this problem??

Can i use this to command the position continuously??? 

 

 

p0 = (Vmax*Vmax)/Amax;

t0 =sqrt(Pi/Amax);

p1=(Vmax*Vmax)/(Amax*2);

p2=Pi-p1;

t1= Vmax/Amax;

t2= Pi/Vmax; 

if (Pi <=p0 && t<=t0) {

Po=0.5*Amax*t*t

}

elseif (Pi<=p0 && t0<t<=2*t0)

{

Po=Pi-0.5*Amax*(2*t0-t)*(2*t0-t)

}

elseif (Pi>po && t<=t1) {

Po=0.5*Amax*t*t;

}

 elseif(Pi>P0 && t1<t<=t2) {

Po=p1+Vmax(t-t1)

}

elseif(Pi>p0 && t2<t<(t2+t1) ) 

{

Po=Pi-0.5*Amax*(t-t2)(t-t2)

0 Kudos
Message 15 of 17
(1,237 Views)

Hi fourteen,

 

a formula node does not work with MatLab code (here you have to use the mathscript node), but resembles C code. It also has an extensive context help, where you could read a lot on syntax and supported functions!

 

All of the shown program could be done in pure LV functions (it mostly InRange-checks and simple math).

 

But it seems you are focused on your single approach to solve the problem.

You approach uses the current time to calculate the needed output. Could be done, but involves some overhead as you have to calculate for each and every time you want.

 

I would advise a different approach:

First calculate all needed outputs by creating a waveform (concat different waveforms like RampUp, Hold, RampDown). Then you simply need to index the value corresponding to current time! Also some output devices support to output a waveform, so you wouldn't need a loop anymore to output the whole "profile"...

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 16 of 17
(1,234 Views)

Yeah, i have been trying to use basic labview structure to solve this problem also! but i think that if i can use a function node, or a matlab script, this would be easier.

 

And eventually i find out that this function node can not deliver what i want, and yet the lab computer do not have a matlab.

 

for your suggestion, the main problem, i have no ideal about how to  index the value corresponding to current time, that's why even though i have come out the wave form, i do not know how to implant it. And that why i have been trying to find a time source to continuously input the time to get the position.

 

May be, i still have to go to the old way, use  the basic logical functions in the labview to create the result i want.

 

 

All the problem that i was facing is because labview is such a huge thing, there are so many functions inside, and i only know very few of it, even i have read some of the books about labview, still get confused all the time.

 

just now, when i try to create a simple function according to the given simple, i still do not know how to get the icon that has been shown in the example, there are just so many options.

 

Thank you very much, i think i will still have many stupid questions to ask before i get what i want.

 

Best regards. 

0 Kudos
Message 17 of 17
(1,224 Views)