キャンセル
次の結果を表示 
次の代わりに検索 
もしかして: 

Case Statements or While Loop

Hi guys,

 

I need some advice on what is the best approach.

 

I am modifying a current Labview program (the same VI just renamed) to take advantage of two readings from a Force Gauge. My requirements are:

 

  1. Take the first dip in the force gauge. This will be the first reading and it's distance.
  2. Find the next rise in force
  3. Take the next dip and place this as the second reading along where the distance occurs.

I have four fields: 1st Peak Force, 1st Distance, 2nd Peak Force, 2nd Distance.

 

Do I use multiple case statements, a while loop, or something else?

 

I've enclosed my VI. I know, there are a lot of local references in here スマイリー 悲しい, but I've got a short time frame and I'll have to rewrite this later.

0 件の賞賛
メッセージ1/13
4,341件の閲覧回数

By the way, it's #23 in the case structure.

0 件の賞賛
メッセージ2/13
4,339件の閲覧回数

Could you reduce the problem to a simple VI with an array of typical test data?

 

 

(btw, all these "read local variable-modify-write to the same local variable" constructs should be done with shift registers instead of locals of hidden controls/indicators. If you keep the data in a shift register, you don't need to involve the front panel. This is not text based programming 😉 Overall, the code is very hard to read. There is also something wrong with your state enum, because it gets coerced to a simple number. Most likely you are mixing different enums. You should have made it a type def. )

メッセージ3/13
4,321件の閲覧回数

Sounds like you might want to look into the peak finding vi's.  Search the examples for "peak"

--
Tim Elsey
Certified LabVIEW Architect
0 件の賞賛
メッセージ4/13
4,312件の閲覧回数

 


@altenbach wrote:

Most likely you are mixing different enums. You should have made it a type def. )


In case "10", the two enums with selection "User Input (Start Button)" have an extra item "Read Gauge (R.T.C.)", replace those with the more common enum and things will look much better. Make it a type def to keep things manageable.

 

メッセージ5/13
4,306件の閲覧回数

Thank you so much! That would have taken me hours to find out.

0 件の賞賛
メッセージ6/13
4,298件の閲覧回数

You can reduce the complexity of your timestamp code:

 

23972iA2990533C6E225E6

- tbob

Inventor of the WORM Global
0 件の賞賛
メッセージ7/13
4,286件の閲覧回数

tbob, won't I still need the date/time vi wired into the format date/time string?

0 件の賞賛
メッセージ8/13
4,266件の閲覧回数

 


@BadAzzS10 wrote:

tbob, won't I still need the date/time vi wired into the format date/time string?


 

No, that's an implicit input, it per default uses the current timestamp, you can always use another moment in time.

 

If you are looking for information of a typedef, see this video.

 

Ton

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 件の賞賛
メッセージ9/13
4,254件の閲覧回数

I don't think the Peak Reading VI will work. I need to read the force of the gauge and at what distance it was taken at. I don't think that the Peak Finding VI will do that (although my knowledge level is very low with labview).

0 件の賞賛
メッセージ10/13
4,243件の閲覧回数