LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Force Case Structure to Next Case

Hello! I am working on a project for school and have exhausted all of my resources (until now, hopefully.) This VI is meant to run like a blood pressure monitor. There is a part of the program where if the patient tries to "meausre their blood pressure" more than 5 times using the quick 1 minute reading time, the program should automatically switch the slower 5 minute reading time. I have used a case structure for the different reading times. 

 

In previous attempts, I have used a while loop where if the iteration count is equal to 5 after being incremented by 1, then the loop stops. However, this presented two problems: 

1. It causes the program to run continuously for 5 iterations. I need the program to only run once unless the "Patient" chooses to run it again. 

2. Even after it stops, I have no idea how to get it to the next case in the case structure, which is the 5 minute option. 

 

So to summarize, I need help getting the program to only run once each time it is called, keep track of the iterations, and then force to the next case if it is called 5 times consecutively. 

 

I have attached what I have so far below. Thank you!!

0 Kudos
Message 1 of 4
(2,306 Views)

Some comments (as this is a very incomplete "program" -- there are no loops, for example):

  • The code inside the Case statement is identical except for one tiny piece.  Only that tiny piece belongs inside the Case.
  • Learn to use the LabVIEW functions when learning LabVIEW.  (On the other hand, it does document the code ...).
  • I really did not understand what you were trying to do.  I don't see any loops, I don't see any While iteration inputs, I don't know what the conditions are supposed to be to "succeed" or "fail", nor what you want to do in any such case.  I don't understand the relationship between the Case Label (e.g. "5 minutes") and the time interval (e.g. 500 ms) (except that they are related by a factor of 600).

Homework Assignment (before coming back with your Reply):

  • Describe the Project better.  If you have it as a Written Assignment, tell it to us (so we can understand what you are trying to code).
  • Attach a VI that includes the While Loop.  Think about the conditions that stop the While Loop, and how to tell (once the loop has stopped) if "things are OK" or "Need to Do It Again".

Bob Schor

0 Kudos
Message 2 of 4
(2,286 Views)

I decided to delete the While loop because I wasn't sure of how to use it in order to accomplish what I need, thus, it was mostly taking up space at the moment. 

 

In terms of the project, it is meant to simulate a blood pressure monitor, so I have to ensure the monitor does not cause damage to the arteries, hence why I need to add in this part to begin with. If the patient tries to test their blood pressure five consecutive times using the 1 minute interval, the monitor should automatically switch over to the 5 minute interval in order to prevent harming the patient. It is for this reason that I am trying to get my program to keep a running count of the iterations and switch from the "1 minute" case to the "5 minute" case automatically if the iteration count exceeds 5. Like I said before, these iterations will not be consecutive unless the program is run consecutively manually. 

 

As far as the relationship between the case labels and these time intervals, they were provided to me within the project description. 

 

I hope this helps clear any confusion. I also took your advice and only kept the wait function inside each case, with the rest of the original code outside of it. 

0 Kudos
Message 3 of 4
(2,272 Views)

Sorry, posting by phone, cannot see vi.

 

What you need is a simple state machine that track attempts and such. Look at the design templates that ship with LabVIEW and also search the forum for ideas.

0 Kudos
Message 4 of 4
(2,252 Views)