LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Delay two boolean switches tracking the placement of a fish in two tanks

Hi and thank you for your time and help in advance.

 

I have a system that consists of two connected aquarium tanks (tank A and tank B) with two lasers between them. When the fish goes from e.g. tank A to tank B it will trigger laser B last and my system will let me know that the fish has chosen to go into another tank. However, I would like to add a function that delays my system so that when the fish goes from tank A to tank B, the system will not register it until 10 sec after it has triggered laser B, and if the fish within that 10 sec goes back into the tank A from tank B, i.e., triggers laser A last, nothing will have happened. 

 

I have tried many different combinations with an elapsed time VI and shift registers. But I can't make it work. 

 

See the attached VI below.

0 Kudos
Message 1 of 7
(2,700 Views)

I apologize, uploaded the wrong file, here is the correct one. This is as far as I have gotten. And just to clarify: when the fish goes from tank A to tank B I want the system to still think it's in tank A and switch only when 10 seconds have passed. There cannot be a period where the system does not "know" where the fish is.

0 Kudos
Message 2 of 7
(2,681 Views)

Due also to an incoming headache, I'm unable to follow your code in all boolean manipulations. Plus, I never used the Elapsed Time express vi so I'm not familiar with it.

I attach two working versions. The first uses boolean as well, but mainly with Case Structures. Not elegant, indeed, but it works.

However, if we go beyond booleans and use a threefold state machine, the code becomes much more simpler and easy to read and maintain.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
Message 3 of 7
(2,646 Views)

Thank you so much!

 

I am not to experienced with state machines but am starting to learn and yours make a lot of sense. However, I need it to be continues thing where the fish can keep going back and forth between A and B and every time it changes tank there needs to be that delay/wait until it actually registers it in the opposite tank. Would that just mean I add an additional state that says from B to A?

 

 

0 Kudos
Message 4 of 7
(2,621 Views)

It would be polite to give a link to the code template you were using, especially since I wrote it. 😄

0 Kudos
Message 5 of 7
(2,610 Views)

Here's a quick modification that can hopefully give you some ideas. Modify as needed.

 

altenbach_0-1625268094820.png

 

 

 

0 Kudos
Message 6 of 7
(2,608 Views)

@Math808  ha scritto:

Thank you so much!

 

I am not to experienced with state machines but am starting to learn and yours make a lot of sense. However, I need it to be continues thing where the fish can keep going back and forth between A and B and every time it changes tank there needs to be that delay/wait until it actually registers it in the opposite tank. Would that just mean I add an additional state that says from B to A?


Yes, you can add a state "B to A" which is the symmetrical of "A to B".

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 7 of 7
(2,546 Views)