取消
显示结果 
搜索替代 
您的意思是: 

Reverse engineering a VI

已解决!
转到解答

Hello,

 

   Please check out the attached VI. I've inherited code from a previous engineer and I'm trying to wrap my head around how this particular VI works. I appreciate it!

 

 

Jay

 

 

0 项奖励
1 条消息(共 13 条)
3,901 次查看

You did not attach your typedefs, but you have a cluster of two enums, each with four choices. Two bits are sufficient to describe four states, so you create an output array with four bits to fully describe the state of the two enums.

You can look at the help for any of the primitives. Let us know if anything is not clear..

2 条消息(共 13 条)
3,825 次查看

Without the VIT Config cluster i can't tell you exactly what it does, but assuming that Voltage is in volts and Current is in amperes then what you are doing here is you convert an 8 bit number to boolean array, negate it and then take the first two values of boolean array.

 

So it basically ignores values less than 64 (so 64V or 64A) and then writes two most significant digits negated to DAQ.

 

EDIT: It'd also help to know what this controls, because right now i can't really imagine what you would control like this.

 

 

3 条消息(共 13 条)
3,784 次查看

Hello,

 

   Thanks for the replies! I've attached the .ctl files that go with this.

 

So this VI sets the voltage and current range to be sensed and measured. Rather than having enum drop-down windows to select the ranges, I'm attempting to allow the user to just type in the what voltage and current the device under test requires, then the ranges automatically get set without needing to be selected.

 

I'm not sure what the best approach to this would be. Maybe tie the enums into a case structure? Although I believe the VIT may need the binary settings to be written to it all at once.

 

Any suggestions would be appreciated!

 

Jay

 

 

0 项奖励
4 条消息(共 13 条)
3,767 次查看

@JayWW wrote:

So this VI sets the voltage and current range to be sensed and measured. Rather than having enum drop-down windows to select the ranges, I'm attempting to allow the user to just type in the what voltage and current the device under test requires, then the ranges automatically get set without needing to be selected.


What I have done for this is use the Threshold 1D Array with the desired range and an array of available ranges.  You can use Round To +Infinity To then use Index Array on the available ranges to get the actual range to use.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
5 条消息(共 13 条)
3,754 次查看

@crossrulz wrote:

@JayWW wrote:

So this VI sets the voltage and current range to be sensed and measured. Rather than having enum drop-down windows to select the ranges, I'm attempting to allow the user to just type in the what voltage and current the device under test requires, then the ranges automatically get set without needing to be selected.


What I have done for this is use the Threshold 1D Array with the desired range and an array of available ranges.  You can use Round To +Infinity To then use Index Array on the available ranges to get the actual range to use.


 

How would I interface this with the needed binary output to properly communicate what range to set the VIT?

 

Thanks,

Jay

0 项奖励
6 条消息(共 13 条)
3,741 次查看
解答
已被主题作者 JayWW 接受

@JayWW wrote:

How would I interface this with the needed binary output to properly communicate what range to set the VIT?


Instead of indexing the original array, index another lookup table.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
7 条消息(共 13 条)
3,734 次查看
LVedit.PNG
@crossrulz wrote:

@JayWW wrote:

How would I interface this with the needed binary output to properly communicate what range to set the VIT?


Instead of indexing the original array, index another lookup table.


What kind of array is the circled icon? It doesn't look familiar.

 

Thanks,

Jay

0 项奖励
8 条消息(共 13 条)
3,702 次查看

Hi Jay,

 

it's still an IndexArray function…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
9 条消息(共 13 条)
3,693 次查看

@JayWW wrote:

What kind of array is the circled icon? It doesn't look familiar.


 

"index array". It looks different because the input is a 2D array, requiring two inputs for the index. The primitive automatically adapts to the wired input.

10 条消息(共 13 条)
3,689 次查看