04-15-2010 01:02 AM
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.
04-15-2010 01:25 AM
04-15-2010 01:29 AM - edited 04-15-2010 01:30 AM
04-15-2010 01:30 AM
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
TickCount just provides a counter. To get elapsed time you have to subtract two counter values...
04-15-2010 03:23 AM
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)
}
04-15-2010 03:32 AM
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"...
04-15-2010 05:11 AM
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.