HPInc / HP-Digital-Microfluidics

HP Digital Microfluidics Software Platform and Libraries
MIT License
3 stars 1 forks source link

Make drop moves self-timing #29

Open EvanKirshenbaum opened 9 months ago

EvanKirshenbaum commented 9 months ago

As I've been working on mixing (#21), I added a task that

In an effort to make that last step look good, I've spent far too much time working out the appropriate delays on paper. It would be really nice to see if I can figure out a way to have it done automatically.

To a first-order approximation, I basically want to say "if the place I want to walk to isn't safe" (i.e., is a neighbor of a cell with a drop) "wait and try again next time". That should sort of work, but I can see a couple of wrinkles:

  1. It could be the case that two streams of drops want to cross one another, and one of them never gets a chance. If that stream backs up, it's possible that it could block the first one, causing gridlock.
  2. If you have a situation like
    A _ _ _ B

    where A wants to walk right two steps and then turn down and B wants to walk left two steps and then turn, on the next tick you'll have

    _ A _  B _

    and then you deadlock, as each sits there waiting for the other to get out of the way.

So, obviously, some more intricate scheduling would be needed.

Migrated from internal repository. Originally created by @EvanKirshenbaum on Jun 21, 2021 at 6:29 PM PDT.
EvanKirshenbaum commented 9 months ago

This issue was referenced by the following commits before migration:

EvanKirshenbaum commented 9 months ago

I've added the basic safety checks on motion and dispensing:

In all of these cases, we just delay a tick and re-check. The effect is that I now no longer need to add after delay parameters to any of the tasks, including being able to schedule dispensing all drops for the mix task at the same time.

Note that we may run into problems if the delays (especially in dispensing) wind up executed in a different order. As currently implemented, any that are delayed will always be retried in the same order, but I'm not sure what happens if another one gets added while we're checking. It might get tried (for the first time) before the others get re-checked.

This is not a full solution, as it doesn't address fairness or deadlock avoidance, but it should make creating the paths a fair bit simpler.

Migrated from internal repository. Originally created by @EvanKirshenbaum on Jun 28, 2021 at 10:56 AM PDT.