LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

ブロックダイアグラムの整理に関して

Solved!
Go to solution

スクリーンショット 2024-06-14 222307.png

初歩的な質問で申し訳ございません。

写真のように各ボタンが押されると各グラフが保存されたり、各スクロールを動かすと各配列が動くダイアグラムを作成したのですが

これらが場所を取って困っています。

写真保存のダイアグラムやスクロールのダイアグラムをケースストラクチャのように重ねて、省スペース化することは出来ますか?

 

0 Kudos
Message 1 of 7
(453 Views)
Solution
Accepted by topic author kuro_ro_orz

@kuro_ro_orz wrote:

スクリーンショット 2024-06-14 222307.png


 

We can't really troubleshoot a truncated picture full of local variables and race conditions.

Please attach you actual IV. (Where is the toplevel loop? What is the overall architecture?, etc.)

 

  • If the booleans are switch action (zero to all can be true at any given time) you could use a FOR loop and iterate over an array of booleans and paths.
  • If the booleans are latch action (only one can be true at any given time), use a case structure with N cases.
0 Kudos
Message 2 of 7
(405 Views)

Thanks for the reply.
Here is the actual vi.

0 Kudos
Message 3 of 7
(400 Views)

Sorry, I have to look at this in detail later. My laptop screen is insufficient for this diagram.

 

You need to eliminate ALL local variables because your code is full of race conditions Most local variables will get read way before the terminal gets written. In LabVIEW, the wire is the variable and it automatically determines execution order!

 

Do you really need to read each file 10x per second? Ho often do the files change? You can eliminate all that duplicate code by indexing over an array of paths. Same for the case structures, they only differ by a few inputs, the rest can be the same. I am almost 100% sure that "latch until released" is not the correct mechanical action for all these switches. All hidden controls should be diagram constants. There is a colorbox diagram constant, no need to form a color dozens of times in parallel!

 

Cleaned up, you code could probably fit on a postcard!

0 Kudos
Message 4 of 7
(396 Views)

Hi kuro,

 


@kuro_ro_orz wrote:

but these are taking up space and I'm having trouble with it.

Is it possible to save space by stacking the photo saving diagram and the scroll diagram like a case structure?


Recommendations:

  • Replace ALL LOCAL VARIABLES by wires! Really ALL OF THEM!
  • Create labels for all those buttons: it is VERY BAD behaviour to delete the labels of frontpanel items!
  • Follow the style guide and apply simple left-to-right wiring! (Or use auto-cleanup!)
  • Instead of duplicating code you should create a subVI and call it multiple times!

Please attach your code again after doing all this work!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 7
(391 Views)

Dear GerdW

 

Thanks for the advice!

 

I've only been doing labview for about 3 months and have not mastered the basics of labview, so I'm creating code as I look it up.

I think this is why the code looks weird to an advanced user.

 

I was making everything by wire without using local variables until a while ago, but even after cleanup, it was still too complicated.

Using local variables is by far the easiest way to look at it personally.

 

Why do you not recommend local variables?

 

 

Many thanks, 

kuro

 

0 Kudos
Message 6 of 7
(386 Views)

Dear altenbach

 

Thanks for the advice!

 

I've only been on labview for about 3 months and I haven't learned any of the basics. So those advices are fateful for me as I was struggling with duplicate codes. I didn't even know that I could turn paths into arrays.

 

I made the code form dozens of times because I was having trouble getting the graph to update in real time with changes in the value of the running controller, and it worked when I put everything inside the structure, and I don't really know how it works.

 

In the meantime, I'll try my best to get rid of the duplicate code based on your advice! Thanks!

 

I approve of you being the first to reply.

 

Many thanks, 

kuro

0 Kudos
Message 7 of 7
(382 Views)