LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to get the actual time and the varible changed as the program running

hi, I have some gabs to get the actual time and the varible changed as the program running, as the attachment shown I would like to have the variable actual time when I run the program; A and B as well.

What should I do?

Thanks a lot!
0 Kudos
Message 1 of 11
(2,991 Views)
Well,

there are several vi's in the time&dialog palette that give you an actual values for the time. Just grab an appropriate one...
Most of those functions give you an absolute time value with zero somewhere around 1. Jan. 1902. So you have to take the actual time at starting your program and subtract that value each time you ask for a new value. SO you get the relative time (regarding the start of your program).
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 11
(2,981 Views)
thanks for your answer!

well, the problem is, I could not think of a method to realize this flow chart....
0 Kudos
Message 3 of 11
(2,976 Views)
Hello,

the straight forward solution is to use a case structure for each decision point and a subVi (for having better overview) for each task (rectangular boxes).
But this can lead to programs hard to maintain, when there is a change in the flow chart...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 11
(2,973 Views)
That's the point!

As the attachment shown, I could just make the first circle fulfill Tactual <=Ttast + Tstart, however, I could not change this Tstart to the last Tactual, that is to say, since Tstart should changes as the program runs, it should be variable......the problem is I could make it.....
0 Kudos
Message 5 of 11
(2,969 Views)
Hello,

whenever you need a 'variable' you can use a wire in LV...

I made some changes to your vi, maybe it shows you the concept. I tried to follow your flow chart, but it isn't as easy as it's not really clear to me how to handle the different constants (A, B, T_actual, T_total...).

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 11
(2,962 Views)
Thank you very much for your help!
I will read it carefully....

Smiley Very Happy



0 Kudos
Message 7 of 11
(2,960 Views)
Hello,

in addition to my last post:
You say T_start should change in the program run, but your flow chart shows it different. Here T_start is set just once in the beginning...
So you better carefully draw your flow chart 🙂

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 11
(2,958 Views)
I think I should pay more attention to my expression...
Tstart is fixed, but Tactuall should be variable..

I got the new version, based on what you gave me..
Thanks a lot!
0 Kudos
Message 9 of 11
(2,949 Views)
Hello ??,

try to minimize the use of local variables. Use wires when possible! This way you don't break the dataflow and get no race conditions.
See changed example.
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 11
(2,946 Views)