上回我们说到茴香豆有四种写法X的立方已经有四种办法可以搞定,下面我们来看看更多得办法~
使用公式节点也可以
M脚本也可以
微软的.NET也可以
如果我们都使用同样的算法,到底这几种接口有没有不同,那种效率更高呢?
我们还是用事实说话:
首先有请 LabVIEW Unit Test Framework Toolkit 1.0 for LabVIEW 8.6.1
安装好以后我们就可以对LabVIEW VI进行自定义的测试了
我们来回顾一下程序代码这里我把循环次数都变为控件
然后新建一个测试
配置输入和输出参数
别忘了在工程里面配置一下报表
点击运行测试就可以让LabVIEW替我们干活了
大功告成~
我们来总结一下~
Use LabVIEW Power Function | Use Expression Node with Power Function | Use Formula Node with Power | Use M Script with Power | Use Dot NET Power | |
Calculating Time(ms) | 0.0004777 | 0.0004948 | 0.0005344 | 0.1214 | 0.925 |
从表格和下图可以看出**LabVIEW的原生节点和框图效率都还不错,使用外部接口和脚本时效率较低。**
另付LabVIEW Unit Test Framework Toolkit的测试报告:
The 3rd Power of X
Time: 2009-3-27 14:54:04
Operator: lhb
Operating System: Windows NT 5.1
LabVIEW Version: 8.6.1 (en)
Test Summary
0 Test Errors
0 Tests Failed
0 Tests Skipped
5 Tests Passed
Time elapsed: 00:00:36
Test Results
Failed
None.
Passed
Test Name | Test Location | VI Name | Test Cases | Duration [s] | Code Coverage [%] | Requirements |
---|---|---|---|---|---|---|
[Use LabVIEW Power Function.lvtest](#Link0) | My Computer/LabVIEW Block Diagram | Use LabVIEW Power Function.vi | 1 | 5.77 | 100.0 | |
[Use Expression Node with Power Function.lvtest](#Link1) | My Computer/Expression Node | Use Expression Node with Power Function.vi | 1 | 5.91 | 100.0 | |
[Use Formula Node with Power.lvtest](#Link2) | My Computer/Fomula Node | Use Formula Node with Power.vi | 1 | 6.20 | 100.0 | |
[Use M Script with Power.lvtest](#Link3) | My Computer/M SCRIPT | Use M Script with Power.vi | 1 | 2.03 | 100.0 | |
[Use Dot NET Power.lvtest](#Link4) | My Computer/Dot NET | Use Dot NET Power.vi | 1 | 1.77 | 100.0 |
Test Details
1. My Computer
1.1. LabVIEW Block Diagram
1.1.1. Use LabVIEW Power Function.lvtest
VI Under Test: | C:Documents and SettingslhbDesktopInterface TestUse LabVIEW Power Function.vi |
Result: | Passed |
VI Timestamp: | 2009-3-27 11:59:53 |
VI Revision: | 10 |
Test Started: | 2009-3-27 14:53:27 |
Test Duration: | 00:00:06 |
Code Coverage: | 100.0 % |
Setup VI: | |
Teardown VI: |
- Test Case 1: Passed**1.2. Expression Node
1.2.1. Use Expression Node with Power Function.lvtest
**
VI Under Test: | C:Documents and SettingslhbDesktopInterface TestUse Expression Node with Power Function.vi |
Result: | Passed |
VI Timestamp: | 2009-3-27 11:59:53 |
VI Revision: | 6 |
Test Started: | 2009-3-27 14:53:33 |
Test Duration: | 00:00:06 |
Code Coverage: | 100.0 % |
Setup VI: | |
Teardown VI: |
1.3. Fomula Node
1.3.1. Use Formula Node with Power.lvtest
VI Under Test: | C:Documents and SettingslhbDesktopInterface TestUse Formula Node with Power.vi |
Result: | Passed |
VI Timestamp: | 2009-3-27 13:56:38 |
VI Revision: | 12 |
Test Started: | 2009-3-27 14:53:40 |
Test Duration: | 00:00:06 |
Code Coverage: | 100.0 % |
Setup VI: | |
Teardown VI: |
1.4. M SCRIPT
1.4.1. Use M Script with Power.lvtest
VI Under Test: | C:Documents and SettingslhbDesktopInterface TestUse M Script with Power.vi |
Result: | Passed |
VI Timestamp: | 2009-3-27 14:19:42 |
VI Revision: | 11 |
Test Started: | 2009-3-27 14:53:58 |
Test Duration: | 00:00:02 |
Code Coverage: | 100.0 % |
Setup VI: | |
Teardown VI: |
1.5. Dot NET
1.5.1. Use Dot NET Power.lvtest
VI Under Test: | C:Documents and SettingslhbDesktopInterface TestUse Dot NET Power.vi |
Result: | Passed |
VI Timestamp: | 2009-3-27 11:59:53 |
VI Revision: | 12 |
Test Started: | 2009-3-27 14:54:01 |
Test Duration: | 00:00:02 |
Code Coverage: | 100.0 % |
Setup VI: | |
Teardown VI: |