这是第二篇LabVIEW NXG教程文章,我们将介绍使用前面板的基础知识。
![](https://habrastorage.org/webt/ph/54/sa/ph54sa9mdzlbkj_yow-b_s-49qg.png)
想象一下我们在美国,酒店有空调,但是那里的温度控制器配备了华氏度标尺。我们想设定一个舒适的20度,但华氏度数将是多少?因此,让我们在LabVIEW NXG中对其进行计数。我们仍然处于一个非常基本的层次上-削减后会涉及很多关于简单的词语(以便将来您可以谈论复杂的词语)
上一部分- 基础知识和框图
与往常一样,启动LabVIEW NXG并创建一个新的空虚拟工具。但是现在我们的主要空间是“前面板”(实际上,它默认情况下会打开,可以在“文件”->“首选项”设置中更改此行为):
![](https://habrastorage.org/webt/pj/ms/-u/pjms-uvnmfvbnpda_8lmv2w3jc8.png)
操作原理与程序框图相同-我们有调色板(在本例中为控件),我们将必要的元素从调色板拖到面板上。如果您以前使用过类似的工具(使用Winforms或WPF的Visual Studio,或者使用Delphi),那么您可以轻松自在-这里的一切都非常简单直观,此外,对调色板进行了方便的分组:
![](https://habrastorage.org/webt/u2/pd/fs/u2pdfsp86kvcplbkfoszcyrlle8.gif)
对于我们的练习,我们需要从使用数字的调色板中选择几个元素-在一个元素中,我们将输入以摄氏度为单位的温度,在第二个元素中,我们将以华氏度为单位获取值。
控件和指标
, , , ( ). , . , — , — . — ( "" — ).
, , :
![](https://habrastorage.org/webt/mu/mr/ej/mumrejhqxbkbnwz3aotwt2jtka8.png)
, , — QuckDrop, Ctrl+Space "" "nc" "nn":
![](https://habrastorage.org/webt/wx/pw/hj/wxpwhjob0kaqzl8ylmul2ilwxfk.png)
" "- , , :
![](https://habrastorage.org/webt/eb/fb/ep/ebfbepp9sdqqg1q3wfc8okhoa5e.png)
, , . , , :
![](https://habrastorage.org/webt/1r/qt/gs/1rqtgsq4ks0qqnfzz9egwhctmi4.gif)
, , , , , ( - — ). , Visual Studio, C#/WPF, , " " , — - .
, , — -. , , (LabVIEW — ):
![](https://habrastorage.org/webt/9y/bx/ki/9ybxkiq65aghrozf2dtcuhpziya.png)
— - "". -, Ctrl+E. — . , , LabVIEW, , — , .
, - , , "" , ( — ):
![](https://habrastorage.org/webt/b3/h3/n5/b3h3n5xyypernt9_d58pg0ciiji.png)
- , , , (Uplaced Items) "2"
![](https://habrastorage.org/webt/l5/pf/cs/l5pfcsc-ltsivs2zb-agl-sc9fc.png)
, , , . :
![](https://habrastorage.org/webt/rb/4e/59/rb4e59dldohqcf6puwuygjuy8wq.png)
, — ( Data Flow):
![](https://habrastorage.org/webt/oq/s-/o3/oqs-o3ey_z5zg3_dyh_x_i0cvya.png)
.
, , — , (Label) , :
![](https://habrastorage.org/webt/lu/rv/cx/lurvcx0bydbwynwiaaunvmpuix8.png)
, , , — . , , ( Reference).
. : (T°C × 9/5) + 32 = T°F ( , "google.com/search?q=c in f", ), #
double tC = 20.0;
double tF = tC * 9.0/5.0 + 32.0;
Console.WriteLine(tF);
LabVIEW :
![](https://habrastorage.org/webt/ly/px/cm/lypxcmsma8jhnl3rmbsmq2gqut4.png)
— " , " — , , ...
— "9", "5" "32" , ( Coercion Dots). , . , ( "Representation", , ), "9,0" "5,0" ( "9.0" "5.0") — LabVIEW , :
![](https://habrastorage.org/webt/ij/c7/lu/ijc7lueitcu4iypf3ixdafesdv4.png)
, , , , — , :
![](https://habrastorage.org/webt/be/hr/0e/behr0ed_umyzmxwtxn6iqbzhrte.png)
( , ):
![](https://habrastorage.org/webt/-d/g3/cz/-dg3czeurbyqm-4xpsrkfm8guhc.png)
(Ctrl+E), "20" (Ctrl+R):
![](https://habrastorage.org/webt/ol/wm/q0/olwmq0kdsvlbjdau3pv47co60h4.png)
— , 1k — .
— . . — "Find on Panel/Find on Diagram".
— , :
![](https://habrastorage.org/webt/rj/9e/gd/rj9egdxr0zbto1wj4lwg4zybx_k.png)
, , " ", <Ctrl+U> :
![](https://habrastorage.org/webt/ml/lm/cz/mllmczu4u6ivhkw9riz0wiifm2y.png)
, . .
. :
![](https://habrastorage.org/webt/iw/1h/zb/iw1hzbgrmmanemas4ame4vjjxxw.png)
. , , , , . , — , Quick Drop, … , "Ctrl" , . , - (Unplaced Items) . — , . , .
( ) LabVIEW.
LabVIEW ? "" LabVIEW ("Variables"), ( , , ). LabVIEW NXT — "" (Duplicate Terminal), ( ) .
, , , .
, :
![](https://habrastorage.org/webt/_v/rt/wi/_vrtwi7he0qxxocql6pi8f3suci.png)
" " ( "Create duplicate terminal") :
![](https://habrastorage.org/webt/bs/2k/pq/bs2kpqo9nfymixaxkvgi4iwusew.png)
, "" , , , .
— , . " ".
, , temp:
double tC = 20.0;
double temp = 9.0/5.0;
double tF = tC * temp + 32.0;
Console.WriteLine(tF);
, , LabVIEW: , "temp", , :
![](https://habrastorage.org/webt/2u/of/xd/2uofxdynlhcioeiv3hs0dg1jqta.png)
, LabVIEW , " " .
, , , , temp . , , , :
![](https://habrastorage.org/webt/jx/qb/_w/jxqb_wbly-scdwq0t3by3367tdc.gif)
, , , . - temp, .
— "" , , :
![](https://habrastorage.org/webt/kn/6t/pn/kn6tpn0bpvdi7fyuz4ggi4am_fy.png)
, Ctrl+B (Remove Broken Wires — Ctrl+U). — , "" , (, ).
, . LabVIEW . . , , "" , .
Duplicate Terminal, . , "" , , , "" - GoTo, , , , . , (, , , , , ), . - , .
( — ), , , , "Make current value default" ( "Capture Data", "Create Reference" "Change to Type Definition"):
![](https://habrastorage.org/webt/zy/ha/xo/zyhaxogqqiowresnomca0jw2qcw.png)
, :
![](https://habrastorage.org/webt/ht/cx/rb/htcxrb64ao2fwcvm7wjox-beyc8.png)
— , . , . .
— , , , — :
![](https://habrastorage.org/webt/m8/e7/qw/m8e7qwl2o6ncriffyi4nccqv9ou.png)
— , :
![](https://habrastorage.org/webt/5g/3i/kl/5g3iklzyaddb2gjnt9kf-u7h5vq.png)
, , , — .
总结一下-今天,我们研究了使用面板的基本原理,了解了如何通过Ctrl + E快速切换到框图,最重要的是,更深入了数据流。
我在幕后留下了非常明显的内容,例如缩放前面板-不仅可以从下拉列表中完成,而且可以使用鼠标滚轮完成。在此阶段,遍历设置已经很有意义了(并不是所有设置都将很清晰,但是还没有很多)并进行实验-例如,当在导体附近单击以开始创建新分支时,以这种方式使用导体对我来说更方便:
![](https://habrastorage.org/webt/np/mi/bj/npmibjtdau5n1pku1zuxv3ovuge.png)
在下一小节课中,我们将讨论上面提到的简单数据类型及其强制。