LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

UI design - what is the best way to allow the user to set some kind of infusion at varying (non periodic) times?

Solved!
Go to solution

I want to allow the user to specify a curve like this:

 

Such that some subVI outputs the value A2 when a time variable is within the range R1, A1 when the time variable is within the range R2, and A3 when the time is within the range R3.

 

My design looks something like this:

snippet5.png

 

With error checking that looks like this: snippet4.png

 

My question is, is the array based approach optimal? How else could I tackle this?

0 Kudos
Message 1 of 9
(3,735 Views)

I fixed some faulty logic and got rid of that concatenating string thingy. This should be much better at error checking, even though it spawns a windows for each individual error.

0 Kudos
Message 2 of 9
(3,718 Views)

I am not at all sure that I understand what you want.  I see three time intervals, R1, R2, and R3 -- I assume it starts at T = 0, and the intervals are contiguous (even though the intervals in the picture are separated by an unspecified amount).  I see three values, A1, A2, and A3, and assume A1 goes with interval R1, even though the picture shows A1 going with interval R2.

 

Can I assume that T starts at 0 (with value A1), and always increases?  If so, then the algorithm is much simpler than you developed.  However, if my assumptions are not correct, it doesn't make sense to proceed (I'll only muddy the procedings).

 

BS

0 Kudos
Message 3 of 9
(3,640 Views)

Okay, sorry for the diagram confusion. I made the labels before thinking about associations. T starts at 0, and the infusion is 0 for some amount of time (or no time at all, the user decides this). Then, at a user specified time, an infusion of some amplitude starts, and stops at another user-specified time. The user can repeat this as many times as they want. Two infusions can't run at the same time (even for just a small amount of time, hence the error checking), can't be less than 0, and the start time must be less than the end time.

 

Now, I'm implementing this by allowing the user to fill in values into an array, which are then checked. There may be a better way to do this, though. The pics are snippets so you should be able to download the VI directly.

0 Kudos
Message 4 of 9
(3,627 Views)

Sigh. You still seem to contradict the diagram, which shows R1, R2, R3 as time intervals, which are (by Common Sense) always positive, so you never have to do any error checking on the Arrays, though you could, I suppose, test if the values are all positive, which can be done "all at once" -- 

All Positive.png

BS

0 Kudos
Message 5 of 9
(3,595 Views)

Sorry for the poor explanations. The array will be user-editable, so they can enter whatever they want. That's why it needs to be checked for validity. Column 1 is amplitude, column 2 is start time of infusion, column 3 is end time. They could enter (-5,4,2), which is invalid, but I have to check for that. That is, unless there's some other way to do this that I'm missing.

0 Kudos
Message 6 of 9
(3,592 Views)

I haven't looked at the code, but there are a couple of things you can change:

 

  1. You can right click the control in the array and set its properties so that the user can't enter negative numbers (and then you don't need any error checking).
  2. You can change the logic such that instead of a time index, the user inputs a duration. So your array might have a ring (to set the type none, R1, R2, etc.) and a duration. Add up the durations and you know the relevant time index. If you want to be more fancy, you can do something like this:
    Times.png

___________________
Try to take over the world!
0 Kudos
Message 7 of 9
(3,528 Views)
Solution
Accepted by topic author ijustlovemath

I think I can summarize the conversation to this point as an answer to the original question (What is the best way ...) -- before starting to write any code, think carefully about what you want to accomplish, and write it down (otherwise known as "Write the Documentation First").  One of the points of a good User Interface is that it doesn't allow users to "make silly mistakes" -- it leads the user "by the hand", restricting the entries to "legal values" and requiring that entries be made in a logical manner.

 

So if you were going to have a list of Infusions to enter, it makes sense to decide on whether to enter Time Intervals (which are always >0) or Times (which, logically) are always in ascending order.  You can (and should) decide which you want (or you could have a control that would let the User decide, but that might be too flexible) and then enforce your "rules".

 

Suppose you decided on "Intervals" (which seems, to me, to be more User Friendly).  After the User has entered the intervals (and you've provided a nice plot of Infusion vs Time), you could allow the User to "split" an Interval, "Remove" an Interval, or "Edit the Infusion" of an Interval, or you could decide to have a simpler "Accept or Start Over" choice -- if you only have a few intervals, the last might be the simplest (and thus the Best) Design Choice.

 

Spending more time thinking before coding usually pays Big Dividends!

 

Bob (speaking from Sad Experience) Schor

Message 8 of 9
(3,432 Views)

Bob,

 

As always, your advice has been very helpful. Back to the drawing board!

0 Kudos
Message 9 of 9
(3,396 Views)