From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using Multiple Timed Sequences with offsets

Hi All,

 

I am trying to implement a series of timed sequences with an offset for each of them. I have attached the labview file for reference. Each sequence is to control a specific vibration motor (turn it on and turn it off). They use a non-re-entrant sub-vi to either turn a specific motor on or off. Each successive vibrator has an offset of starting to the previous one, but it will normally start before the previous one finishes (have some overlap time where more than one is vibrating. When call this sub-vi (without the while loop that is currently surround it) the first time it works well, but each successive time I call it the offsets do not correctly work. Likewise if I run It in a loop (like it is currently set up) it will work the first time correctly but not each successive time. I have  tried playing with the timer source to reset each time but that makes no difference. Is anyone able to help me as to why this would be happening and/or an alternative way to program this? Ideally I would like it as a sub-vi

 

Regards,

Ben

0 Kudos
Message 1 of 5
(2,422 Views)

Hi Ben,

 

do you think it is a good idea to give all those sequences the very same name?

 

Have you tried to use simple DATAFLOW with wait functions between those different subVI calls?

Can you attach that subVI too?

Best regards,
GerdW


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

Hi Gerd,

 

My understanding is the name is for the timing source, not the actual sequence, so that they all operate off the same timer (hence offsets will be relative to each other). Is that not correct?

 

Also I cannot use wait functions because the duration and time between vibration motors are  them is variable so they may not always be in the same order. (i.e.) it may be turn 1 motor on, then turn 2 on then 1 off then 1 off etc. Or it could be turn 1 motor on, then turn 2 then three on, then 1 off etc. My understanding is the wait functions lock up the whole function, so nothing else can run in that function while the wait is happening.

 

Regards,

Ben

0 Kudos
Message 3 of 5
(2,397 Views)

Hi Ben,

 

my context help calls that input "Structure name".

I don't know why you think it denotes the timing source…

 

Also I cannot use wait functions because the duration and time between vibration motors are  them is variable so they may not always be in the same order.

A state machine (or queued message handler) may help here too: you just need to convert all your delays to a kind of table describing which event is to be processed next at which time.

Example:

motor1 on

wait 2ms

motor2 on

wait 3ms

motor1 off

wait 20ms

motor2 off

Best regards,
GerdW


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

Sorry I got confused with the structure name because in the help for the timing source it talks about if you have the same timing source name then they will be in phase with each other. However, I got this confused with the structure name because I was unable to give a name to the timing source. Thank you for pointing that out.

 

I will have a look at the state machine.

 

Thanks,

Benjamin

 

0 Kudos
Message 5 of 5
(2,387 Views)